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
Decide whether the provided issue is valid
public static function isIssueValid(Issue $issue) { $summary = $issue->getSummary(); $valid = !blank($summary); $status = $issue->getStatus(); $valid &= !blank($status); $type = $issue->getType(); $valid &= !blank($type); return $valid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isValid() {\n return Utilities::isValidText($this->issue) &&\n Utilities::isValidText($this->message) &&\n Utilities::isValidEmail($this->email) &&\n \n Utilities::hasRightLength($this->issue, self::MAX_LENGTH_OF_ISSUE) &&\n Utilities::hasRightLength($this->message, self::MAX_LENGTH_OF_MESSAGE) &&\n Utilities::hasRightLength($this->email, self::MAX_LENGTH_OF_EMAIL);\n }", "public function is_valid(): bool {\n return $this->problem === null;\n }", "public function checkValidity()\r\n {\r\n if (!parent::checkValidity())\r\n return false;\r\n\r\n if (!$this->checkUniqueCode())\r\n return false;\r\n \r\n if ($this->workflowState && strlen($this->workflowState) > 64)\r\n {\r\n $this->lastErrorMsg = _ERROR_WORKFLOWSTATE_TOO_LONG;\r\n return false;\r\n }\r\n \r\n if (trim($this->name . ' ') == '')\r\n {\r\n $this->lastErrorMsg = _ERROR_NAME_IS_MANDATORY;\r\n return false;\r\n }\r\n \r\n if (strlen($this->name) > 255)\r\n {\r\n $this->lastErrorMsg = _ERROR_NAME_TOO_LONG;\r\n return false;\r\n }\r\n \r\n if (trim($this->code . ' ') == '')\r\n {\r\n $this->lastErrorMsg = _ERROR_CODE_IS_MANDATORY;\r\n return false;\r\n }\r\n \r\n if (strlen($this->code) > 64)\r\n {\r\n $this->lastErrorMsg = _ERROR_CODE_TOO_LONG;\r\n return false;\r\n }\r\n \r\n if ($this->fromState && strlen($this->fromState) > 64)\r\n {\r\n $this->lastErrorMsg = _ERROR_CODE_TOO_LONG;\r\n return false;\r\n }\r\n \r\n if ($this->toState && strlen($this->toState) > 64)\r\n {\r\n $this->lastErrorMsg = _ERROR_CODE_TOO_LONG;\r\n return false;\r\n } \r\n \r\n return true;\r\n }", "protected function validateOrThrow() {}", "public function isInvalid(): bool;", "abstract public function valid();", "public function testValidateIssueRequest(): void\n {\n $this->assertTrue(method_exists($this->stack, 'validateIssueRequest'));\n }", "public function checkValidity()\n { \t\n \treturn true;\n }", "public function isInvalid()\n\t{\n\t\treturn $this->invalid;\n\t}", "public function checkValidity()\n {\n // le pb est que la propriété publicationDate est de type dateTime or les tests initiaux\n // se basent sur un format de type date --> ce qui génère une erreur de type notice\n \n return true;\n }", "public function isValidLevelThrowsExceptionOnInvalidLevelIfAskedToDoSoDataProvider() {}", "public function isValidated(): bool\n {\n return $this->status != self::STATUS_ERROR;\n }", "public function isValid(): bool{\n if ($this->getError() == null){return true;}\n return false;\n }", "public function isValid($_throwExceptionOnInvalidData = false);", "public function is_valid()\n {\n }", "public function is_valid()\n {\n }", "protected function _validate() {\n\t}", "function simplenews_admin_issues_validate($form, &$form_state) {\n if (isset($form_state['input']['operation'])) {\n $nids = array_keys(array_filter($form_state['input']['issues']));\n if (empty($nids)) {\n form_set_error('', t('No items selected.'));\n }\n }\n}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function valid() {}", "public function isInvalid(): bool\n {\n return $this->isInvalid;\n }", "public function valid()\n {\n\n if ($this->container['name'] === null) {\n return false;\n }\n if ($this->container['status'] === null) {\n return false;\n }\n $allowedValues = $this->getStatusAllowableValues();\n if (!in_array($this->container['status'], $allowedValues)) {\n return false;\n }\n if ($this->container['poolname'] === null) {\n return false;\n }\n if ($this->container['template_name'] === null) {\n return false;\n }\n if ($this->container['utm'] === null) {\n return false;\n }\n if ($this->container['body'] === null) {\n return false;\n }\n if ($this->container['sender'] === null) {\n return false;\n }\n if ($this->container['attachments'] === null) {\n return false;\n }\n return true;\n }", "public function checkForErrors()\n {\n if ($this->getDebtor() == '' && $this->getDebtorCode() == '') {\n throw new \\InvalidArgumentException(\n sprintf('Debtor or DebtorCode must be defined')\n );\n }\n\n if ($this->getDomain() == '') {\n throw new \\InvalidArgumentException(\n sprintf('Domain must be defined')\n );\n }\n\n if ($this->getTld() == '') {\n throw new \\InvalidArgumentException(\n sprintf('Tld must be defined')\n );\n }\n }", "public function valid()\n {\n\n if ($this->container['name'] === null) {\n return false;\n }\n if (strlen($this->container['name']) > 100) {\n return false;\n }\n if ($this->container['nit'] === null) {\n return false;\n }\n if (strlen($this->container['nit']) > 15) {\n return false;\n }\n if ($this->container['inbound_configuration_username'] === null) {\n return false;\n }\n if ($this->container['outbound_configuration_contingency_email'] === null) {\n return false;\n }\n return true;\n }", "public function hasIssue()\n {\n return $this->status === 'message_issues';\n }", "abstract public function isValid();", "abstract public function isValid();", "public function valid()\n {\n\n if (strlen($this->container['virtual_operator']) > 60) {\n return false;\n }\n if (strlen($this->container['event_type']) > 100) {\n return false;\n }\n if (strlen($this->container['result_status']) > 100) {\n return false;\n }\n if (strlen($this->container['username']) > 100) {\n return false;\n }\n if (strlen($this->container['property_value']) > 450) {\n return false;\n }\n return true;\n }", "public function valid()\n {\n $allowed_values = array(\"TRAFFIC\", \"CONVERSIONS\", \"COS\");\n if (!in_array($this->container['campaign_goal'], $allowed_values)) {\n return false;\n }\n if (strlen($this->container['name']) < 2) {\n return false;\n }\n $allowed_values = array(\"ACTIVE\", \"PAUSED\", \"DELETED\");\n if (!in_array($this->container['status'], $allowed_values)) {\n return false;\n }\n return true;\n }", "function is_invalid($err)\n{\n // TODO: megírni. Csak akkor printelje ki a hiba-class-t ha tényleg hibás a mező\n if (!$err == null)\n echo $err . ' is-invalid';\n}", "public function testIsInvalid()\n {\n $this->todo('stub');\n }", "abstract public function validate();", "abstract public function validate();", "public function valid()\n {\n\n if ($this->container['task_uid'] === null) {\n return false;\n }\n if ($this->container['resource_uid'] === null) {\n return false;\n }\n if ($this->container['uid'] === null) {\n return false;\n }\n if ($this->container['percent_work_complete'] === null) {\n return false;\n }\n if ($this->container['actual_cost'] === null) {\n return false;\n }\n if ($this->container['actual_finish'] === null) {\n return false;\n }\n if ($this->container['actual_overtime_cost'] === null) {\n return false;\n }\n if ($this->container['actual_overtime_work'] === null) {\n return false;\n }\n if ($this->container['actual_start'] === null) {\n return false;\n }\n if ($this->container['actual_work'] === null) {\n return false;\n }\n if ($this->container['acwp'] === null) {\n return false;\n }\n if ($this->container['confirmed'] === null) {\n return false;\n }\n if ($this->container['cost'] === null) {\n return false;\n }\n if ($this->container['cost_rate_table_type'] === null) {\n return false;\n }\n if ($this->container['cost_variance'] === null) {\n return false;\n }\n if ($this->container['cv'] === null) {\n return false;\n }\n if ($this->container['delay'] === null) {\n return false;\n }\n if ($this->container['finish'] === null) {\n return false;\n }\n if ($this->container['finish_variance'] === null) {\n return false;\n }\n if ($this->container['work_variance'] === null) {\n return false;\n }\n if ($this->container['has_fixed_rate_units'] === null) {\n return false;\n }\n if ($this->container['fixed_material'] === null) {\n return false;\n }\n if ($this->container['leveling_delay'] === null) {\n return false;\n }\n if ($this->container['leveling_delay_format'] === null) {\n return false;\n }\n if ($this->container['linked_fields'] === null) {\n return false;\n }\n if ($this->container['milestone'] === null) {\n return false;\n }\n if ($this->container['overallocated'] === null) {\n return false;\n }\n if ($this->container['overtime_cost'] === null) {\n return false;\n }\n if ($this->container['overtime_work'] === null) {\n return false;\n }\n if ($this->container['peak_units'] === null) {\n return false;\n }\n if ($this->container['regular_work'] === null) {\n return false;\n }\n if ($this->container['remaining_cost'] === null) {\n return false;\n }\n if ($this->container['remaining_overtime_cost'] === null) {\n return false;\n }\n if ($this->container['remaining_overtime_work'] === null) {\n return false;\n }\n if ($this->container['remaining_work'] === null) {\n return false;\n }\n if ($this->container['response_pending'] === null) {\n return false;\n }\n if ($this->container['start'] === null) {\n return false;\n }\n if ($this->container['stop'] === null) {\n return false;\n }\n if ($this->container['resume'] === null) {\n return false;\n }\n if ($this->container['start_variance'] === null) {\n return false;\n }\n if ($this->container['summary'] === null) {\n return false;\n }\n if ($this->container['sv'] === null) {\n return false;\n }\n if ($this->container['units'] === null) {\n return false;\n }\n if ($this->container['update_needed'] === null) {\n return false;\n }\n if ($this->container['vac'] === null) {\n return false;\n }\n if ($this->container['work'] === null) {\n return false;\n }\n if ($this->container['work_contour'] === null) {\n return false;\n }\n if ($this->container['bcws'] === null) {\n return false;\n }\n if ($this->container['bcwp'] === null) {\n return false;\n }\n if ($this->container['booking_type'] === null) {\n return false;\n }\n if ($this->container['actual_work_protected'] === null) {\n return false;\n }\n if ($this->container['actual_overtime_work_protected'] === null) {\n return false;\n }\n if ($this->container['creation_date'] === null) {\n return false;\n }\n if ($this->container['budget_cost'] === null) {\n return false;\n }\n if ($this->container['budget_work'] === null) {\n return false;\n }\n if ($this->container['rate_scale'] === null) {\n return false;\n }\n return true;\n }", "public function valid()\n {\n if ($this->container['name'] === null) {\n return false;\n }\n if (strlen($this->container['name']) > 50) {\n return false;\n }\n if ($this->container['type'] === null) {\n return false;\n }\n if ($this->container['sub_type'] === null) {\n return false;\n }\n if ($this->container['start_date'] === null) {\n return false;\n }\n return true;\n }", "public function isValid() {}", "public function isValid() {}", "public function isValid() {}", "public function isValid() {}", "public function isValid() {}", "public function isValid() {}", "public function isValid() {}", "public function isValid() {}", "public function isValid() {\n\t\t\treturn sizeof($this->missing) === 0;\n\t\t}", "public function valid()\n {\n $allowed_values = [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"];\n if (!in_array($this->container['bill_expenses'], $allowed_values)) {\n return false;\n }\n if (strlen($this->container['billing_attention']) > 50) {\n return false;\n }\n if ($this->container['billing_method'] === null) {\n return false;\n }\n $allowed_values = [\"ActualRates\", \"FixedFee\", \"NotToExceed\", \"OverrideRate\"];\n if (!in_array($this->container['billing_method'], $allowed_values)) {\n return false;\n }\n $allowed_values = [\"WorkRole\", \"StaffMember\"];\n if (!in_array($this->container['billing_rate_type'], $allowed_values)) {\n return false;\n }\n $allowed_values = [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"];\n if (!in_array($this->container['bill_products'], $allowed_values)) {\n return false;\n }\n $allowed_values = [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"];\n if (!in_array($this->container['bill_time'], $allowed_values)) {\n return false;\n }\n if ($this->container['board'] === null) {\n return false;\n }\n $allowed_values = [\"ActualHours\", \"BillableHours\"];\n if (!in_array($this->container['budget_analysis'], $allowed_values)) {\n return false;\n }\n if ($this->container['company'] === null) {\n return false;\n }\n if (strlen($this->container['customer_po']) > 50) {\n return false;\n }\n if ($this->container['estimated_end'] === null) {\n return false;\n }\n if ($this->container['estimated_start'] === null) {\n return false;\n }\n if ($this->container['name'] === null) {\n return false;\n }\n if (strlen($this->container['name']) > 100) {\n return false;\n }\n return true;\n }", "public function isValidationPassed();", "public function valid()\n {\n\n if ($this->container['rule_id'] === null) {\n return false;\n }\n if ($this->container['rule_name'] === null) {\n return false;\n }\n if ($this->container['status'] === null) {\n return false;\n }\n if ($this->container['execution_source'] === null) {\n return false;\n }\n return true;\n }", "public function valid()\n {\n\n if ($this->container['busy_status'] === null) {\n return false;\n }\n if ($this->container['end_date_time'] === null) {\n return false;\n }\n if ($this->container['has_attachment'] === null) {\n return false;\n }\n if ($this->container['meeting_type'] === null) {\n return false;\n }\n if ($this->container['original_start_date'] === null) {\n return false;\n }\n if ($this->container['reminder_delta'] === null) {\n return false;\n }\n if ($this->container['reminder_set'] === null) {\n return false;\n }\n if ($this->container['start_date_time'] === null) {\n return false;\n }\n if ($this->container['sub_type'] === null) {\n return false;\n }\n return true;\n }", "public function validateResolved();", "public function validateResolved();", "public function looksValid()\r\n\t{\r\n return true;\r\n\t}", "abstract public function check();", "public function testIsValidFailing()\n {\n $this->assertFalse($this->helper->isValid('s1', 15));\n $this->assertFalse($this->helper->isValid('s2', true));\n $this->assertFalse($this->helper->isValid('i1', 12.1));\n $this->assertFalse($this->helper->isValid('i2', 'eleven'));\n $this->assertFalse($this->helper->isValid('i3', 12.6));\n $this->assertFalse($this->helper->isValid('i4', -2));\n $this->assertFalse($this->helper->isValid('i5', 83));\n $this->assertFalse($this->helper->isValid('i6', false));\n $this->assertFalse($this->helper->isValid('f1', 12));\n $this->assertFalse($this->helper->isValid('f2', [12.67]));\n $this->assertFalse($this->helper->isValid('f3', 13.0));\n $this->assertFalse($this->helper->isValid('b', [true]));\n $this->assertFalse($this->helper->isValid('b', 0));\n $this->assertFalse($this->helper->isValid('a', 'blue'));\n $this->assertFalse($this->helper->isValid('m', 'true'));\n $this->assertFalse($this->helper->isValid('m', false));\n $this->assertFalse($this->helper->isValid('r', 'memb3rType'));\n }", "public function check_validity() {\r\n\t\t$value = $this->get_posted_value();\r\n\r\n\t\t// required field check\r\n\t\t// 0, '0', and 0.0 need special handling since they're valid, but PHP considers them falsy values.\r\n\t\tif ( $this->props['required'] && ( empty( $value ) && ! in_array( $value, [ 0, '0', 0.0 ], true ) ) ) {\r\n\t\t\t// translators: Placeholder %s is the label for the required field.\r\n\t\t\tthrow new \\Exception( sprintf( _x( '%s is a required field.', 'Add listing form', 'my-listing' ), $this->props['label'] ) );\r\n\t\t}\r\n\r\n\t\t// if field isn't required, then no validation is needed for empty values\r\n\t\tif ( empty( $value ) ) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// otherwise, run validations\r\n\t\t$this->validate();\r\n\t}", "private function validate() {\n\t\n\t\t\treturn false;\n\t}", "public abstract function validation();", "public function isValid()\n\t{\n\t\treturn false;\n\t}", "public function valid()\n {\n\n if (strlen($this->container['bookingReferenceNumber']) > 15) {\n return false;\n }\n if (strlen($this->container['carrierName']) > 15) {\n return false;\n }\n if (strlen($this->container['ticketNumber']) > 15) {\n return false;\n }\n if (strlen($this->container['checkDigit']) > 1) {\n return false;\n }\n if (strlen($this->container['extendedPaymentCode']) > 3) {\n return false;\n }\n if (strlen($this->container['passengerName']) > 42) {\n return false;\n }\n if (strlen($this->container['customerCode']) > 40) {\n return false;\n }\n if (strlen($this->container['documentType']) > 1) {\n return false;\n }\n if (strlen($this->container['documentNumber']) > 14) {\n return false;\n }\n if (strlen($this->container['invoiceNumber']) > 25) {\n return false;\n }\n if (strlen($this->container['additionalCharges']) > 20) {\n return false;\n }\n if (strlen($this->container['totalFeeAmount']) > 12) {\n return false;\n }\n if (strlen($this->container['clearingSequence']) > 2) {\n return false;\n }\n if (strlen($this->container['clearingCount']) > 2) {\n return false;\n }\n if (strlen($this->container['totalClearingAmount']) > 20) {\n return false;\n }\n if (strlen($this->container['reservationSystemCode']) > 4) {\n return false;\n }\n if (strlen($this->container['processIdentifier']) > 3) {\n return false;\n }\n if (strlen($this->container['ticketIssueDate']) > 8) {\n return false;\n }\n if (strlen($this->container['originalTicketNumber']) > 14) {\n return false;\n }\n if (strlen($this->container['purchaseType']) > 3) {\n return false;\n }\n if (strlen($this->container['creditReasonIndicator']) > 1) {\n return false;\n }\n if (strlen($this->container['ticketChangeIndicator']) > 1) {\n return false;\n }\n if (strlen($this->container['planNumber']) > 1) {\n return false;\n }\n if (strlen($this->container['arrivalDate']) > 8) {\n return false;\n }\n if (strlen($this->container['restrictedTicketDesciption']) > 20) {\n return false;\n }\n if (strlen($this->container['exchangeTicketAmount']) > 12) {\n return false;\n }\n if (strlen($this->container['exchangeTicketFeeAmount']) > 12) {\n return false;\n }\n if (strlen($this->container['reservationType']) > 32) {\n return false;\n }\n if (strlen($this->container['boardingFeeAmount']) > 12) {\n return false;\n }\n return true;\n }", "private function validInput()\n {\n if (is_numeric($this->course)) { //Checks that valid course was selected\n if ($this->lab_name !== \"\") //Checks if a lab name was entered\n if (!$this->labAlreadyExists($this->course, $this->lab_name)) {\n {\n foreach ($this->questions as $q) //Checks all questions have text in them\n if ($q === \"\")\n return false; //Returns false if question text is empty\n\n foreach ($this->max_marks as $mark) //Checks all questions have max mark set\n if (!is_numeric($mark))\n return false; //Returns false if a mark was not of type int\n\n if (sizeof($this->min_marks) > 0) {\n foreach ($this->min_marks as $mark) //Checks all questions have min mark set\n if (!is_numeric($mark))\n return false; //Returns false if a mark was not of type int\n }\n return true; //Returns true if all tests are passed\n }\n } else\n return false; //Returns false if a lab already exists with the inputted name\n }\n return false; //Returns false if course is not of type int\n }", "public function validate()\n {\n parent::validate();\n if ( ! $this->getRelease()\n || in_array($this->getRelease()->getState(), [\n array_search('failed', config('projects.states')),\n array_search('destroyed', config('projects.states'))\n ])\n ) {\n $this->failedValidation($this->getValidatorInstance());\n }\n }", "public function isValid()\n {\n $valid = true;\n if (!$this->isInteger($this->id, 1) && $this->id !== null)\n {\n $valid = false;\n $this->setError('id', \"ID is invalid\");\n }\n if (!$this->isInteger($this->terms, 0) || !$this->isInList($this->terms, [0,15,30,45,60,90]))\n {\n $valid = false;\n $this->setError('terms', \"Payment terms are invalid\");\n }\n if (!$this->isString($this->note, 0, 65535))\n {\n $valid = false;\n $this->setError('note', \"Note length can't exceed 65535 characters\");\n }\n if (!$this->isDate($this->date) && !$this->isDateTime($this->date))\n {\n $valid = false;\n $this->setError('date', \"Creation date must be a valid date\");\n }\n if (!$this->isString($this->receipt, 0, 50))\n {\n $valid = false;\n $this->setError('receipt', \"Receipt length can't exceed 50 characters\");\n }\n if (!$this->isString($this->tax, 0, 50))\n {\n $valid = false;\n $this->setError('tax', \"Tax invoice length can't exceed 50 characters\");\n }\n return $valid;\n }", "public function testIsValidInvalid()\n {\n $this->uut->setConstraints([new MyConstraint()])->setValue(new ScalarValue('bar'));\n $this->assertFalse($this->uut->isValid());\n $this->assertTrue($this->uut->hasViolation());\n $this->assertInstanceOf(MyViolation::class, $this->uut->getViolation());\n }", "protected function _fcpoValidateOrderAgainstProblems() {\n $blOrderOk = (\n $this->_fcpoGetAppointedError() === false &&\n $this->_blOrderHasProblems === false\n );\n\n return $blOrderOk;\n }", "public function valid()\n {\n\n if ($this->container['major_group_id'] === null) {\n return false;\n }\n if ($this->container['sub_group_id'] === null) {\n return false;\n }\n if ($this->container['lob_id'] === null) {\n return false;\n }\n if ($this->container['sku'] === null) {\n return false;\n }\n if ($this->container['item_description'] === null) {\n return false;\n }\n if ($this->container['backorder'] === null) {\n return false;\n }\n if ($this->container['charge_code'] === null) {\n return false;\n }\n if ($this->container['max_cycle'] === null) {\n return false;\n }\n if ($this->container['max_interim'] === null) {\n return false;\n }\n if ($this->container['status'] === null) {\n return false;\n }\n if ($this->container['seasonal_item'] === null) {\n return false;\n }\n if ($this->container['secure'] === null) {\n return false;\n }\n if ($this->container['unit_code'] === null) {\n return false;\n }\n if ($this->container['forward_lot_mixing_rule'] === null) {\n return false;\n }\n if ($this->container['storage_lot_mixing_rule'] === null) {\n return false;\n }\n if ($this->container['forward_item_mixing_rule'] === null) {\n return false;\n }\n if ($this->container['storage_item_mixing_rule'] === null) {\n return false;\n }\n if ($this->container['allocation_rule'] === null) {\n return false;\n }\n if ($this->container['receiving_criteria_scheme_id'] === null) {\n return false;\n }\n if ($this->container['hazmat'] === null) {\n return false;\n }\n return true;\n }", "public function valid()\n {\n\n if ($this->container['name'] === null) {\n return false;\n }\n if ($this->container['has_thumbnail'] === null) {\n return false;\n }\n $allowed_values = [\"stl\", \"step\", \"iges\", \"obj\", \"svf2\",\"svf\", \"thumbnail\", \"ifc\"];\n if (!in_array($this->container['output_type'], $allowed_values)) {\n return false;\n }\n if ($this->container['progress'] === null) {\n return false;\n }\n if ($this->container['status'] === null) {\n return false;\n }\n $allowed_values = [\"pending\", \"inprogress\", \"success\", \"failed\", \"timeout\", \"partialsuccess\"];\n if (!in_array($this->container['status'], $allowed_values)) {\n return false;\n }\n if ($this->container['children'] === null) {\n return false;\n }\n return true;\n }", "function validate()\n\t{\n\t\t$result = true;\n\t\tif ($this->required && !$this->value) { $result = false; }\n\n\t\tif (!$result) { $this->error = '*'; }\n\n\t\treturn $result;\n\t}", "public function testStateIssuedCorrectly()\n {\n $this->assertNull($this->state->issue());\n }", "public function validate() { return TRUE; }", "private function isValid(){\r\n $this->validator->required('title', 'Image Title Is Required');\r\n $this->validator->required('slideHint', 'Slide Name Is Required');\r\n $this->validator->image('image');\r\n return $this->validator->passes();\r\n }", "public function valid()\n {\n\n if ($this->container['use_async_pattern'] === null) {\n return false;\n }\n if ($this->container['source_file_name'] === null) {\n return false;\n }\n if ($this->container['source_file_content'] === null) {\n return false;\n }\n if ($this->container['copy_metadata'] === null) {\n return false;\n }\n $allowed_values = [\"English\", \"Arabic\", \"Danish\", \"German\", \"Dutch\", \"Finnish\", \"French\", \"Hebrew\", \"Hungarian\", \"Italian\", \"Norwegian\", \"Portuguese\", \"Spanish\", \"Swedish\", \"Russian\"];\n if (!in_array($this->container['language'], $allowed_values)) {\n return false;\n }\n $allowed_values = [\"Slow but accurate\", \"Faster and less accurate\", \"Fastest and least accurate\"];\n if (!in_array($this->container['performance'], $allowed_values)) {\n return false;\n }\n $allowed_values = [\"None\", \"Whitelist\", \"Blacklist\"];\n if (!in_array($this->container['characters_option'], $allowed_values)) {\n return false;\n }\n return true;\n }", "public function valid()\n {\n\n if ($this->container['total'] === null) {\n return false;\n }\n if ($this->container['groupid'] === null) {\n return false;\n }\n if ($this->container['groupname'] === null) {\n return false;\n }\n if ($this->container['emailid'] === null) {\n return false;\n }\n if ($this->container['createdon'] === null) {\n return false;\n }\n if ($this->container['autosyncgroup'] === null) {\n return false;\n }\n if ($this->container['everyonegroup'] === null) {\n return false;\n }\n return true;\n }", "public function validate_user_input_outcome()\n {\n $passed_validation_tests = true;\n $msg = \"Fix the following error(s): \";\n $msg .=\"<ul style='text-align:left;margin-left:33%'>\";\n \n $check_ap = has_presence($this->ap);\n $check_ap_numeric = has_number($this->ap);\n if (!$check_ap or !$check_ap_numeric) {\n $passed_validation_tests = false;\n $msg .= \"<li>\";\n $msg .= \"AP: \";\n $msg .= h($this->ap);\n $msg .= \" cannot be blank and must be a number.\";\n $msg .= \"</li>\";\n }\n // $check_apy_regex = Form::has_format_matching($apy, '/\\A\\d\\Z/');\n $check_provider_id = has_presence($this->provider_id);\n $allowed_provider_ids = Provider::find_array_of_providers_ids();\n $check_provider_id_inclusion = has_inclusion_in($this->provider_id, $allowed_provider_ids);\n if (!$check_provider_id or !$check_provider_id_inclusion) {\n $passed_validation_tests = false;\n $msg .= \"<li>\";\n $msg .= \"Provider: \";\n $msg .= h($this->provider_id);\n $msg .= \" cannot be blank and must be a valid choice: \";\n $msg .= \"</li>\";\n }\n $check_shift_id = has_presence($this->shift_id);\n $check_shift_id_inclusion = has_inclusion_in($this->shift_id, [1, 2]);\n if (!$check_shift_id or !$check_shift_id_inclusion) {\n $passed_validation_tests = false;\n $msg .= \"<li>\";\n $msg .= \"Shift: \";\n $msg .= h($this->shift_id);\n $msg .= \" cannot be blank and must be a valid choice.\";\n $msg .= \"</li>\";\n }\n $check_outcome_id = has_presence($this->outcome_id);\n $allowed_outcome_ids = Outcome::find_array_of_outcome_ids();\n $check_outcome_id_inclusion = has_inclusion_in($this->outcome_id, $allowed_outcome_ids);\n if (!$check_outcome_id or !$check_outcome_id_inclusion) {\n $passed_validation_tests = false;\n $msg .= \"<li>\";\n $msg .= \"Outcome: \";\n $msg .= h($this->outcome_id);\n $msg .= \" cannot be blank and must be a valid choice.\";\n $msg .= \"</li>\";\n }\n $check_price_paied = has_presence($this->price_paied);\n $check_price_paied_numeric = has_number($this->price_paied);\n if ($check_price_paied and !$check_price_paied_numeric) {\n $passed_validation_tests = false;\n $msg .= \"<li>\";\n $msg .= \"Price paied: \";\n $msg .= h($this->price_paied);\n $msg .= \" by provider must be a number.\";\n $msg .= \"</li>\";\n } elseif (!$check_price_paied) {\n $price_paied = 0;\n }\n $check_reason_outcome_id = has_presence($this->reason_outcome_id);\n $check_reason_outcome_id_inclusion = has_inclusion_in($this->reason_outcome_id, [1, 2]);\n if (!$check_reason_outcome_id or !$check_reason_outcome_id_inclusion) {\n $passed_validation_tests = false;\n $msg .= \"<li>\";\n $msg .= \"Reason for outcome: \";\n $msg .= h($this->reason_outcome_id);\n $msg .= \" cannot be blank and must be a valid choice.\";\n $msg .= \"</li>\";\n }\n $msg .= \"</ul>\";\n\n if ($passed_validation_tests) {\n return \"\";\n } else {\n return $msg;\n }\n }", "public function assertValid()\n {\n }", "public function validate() {\n\t\treturn false;\n\t}", "function fails() {\n return !($this->startValidation());\n }", "public function valid()\n {\n\n if ($this->container['code'] === null) {\n return false;\n }\n if ($this->container['settings'] === null) {\n return false;\n }\n if ($this->container['deeplink'] === null) {\n return false;\n }\n if ($this->container['enrollment'] === null) {\n return false;\n }\n if ($this->container['courses'] === null) {\n return false;\n }\n if ($this->container['id'] === null) {\n return false;\n }\n if ($this->container['create_date'] === null) {\n return false;\n }\n if ($this->container['subscription'] === null) {\n return false;\n }\n if ($this->container['ecommerce'] === null) {\n return false;\n }\n if ($this->container['status'] === null) {\n return false;\n }\n $allowed_values = [\"not_subscribed\", \"subscribed\", \"in_progress\", \"completed\"];\n if (!in_array($this->container['status'], $allowed_values)) {\n return false;\n }\n if ($this->container['name'] === null) {\n return false;\n }\n if ($this->container['complete_percent'] === null) {\n return false;\n }\n return true;\n }", "public function isValid()\n {\n // checking allergy code\n if (\n isset($this->code['code']) &&\n isset($this->code['codeSystem']) &&\n ($this->code['code'] == self::FIRST_RESOURCE_CODE && $this->code['codeSystem'] == self::FIRST_RESOURCE_CODE_SYSTEM) ||\n ($this->code['code'] == self::SECOND_RESOURCE_CODE && $this->code['codeSystem'] == self::SECOND_RESOURCE_CODE_SYSTEM) ||\n ($this->code['code'] == self::THIRD_RESOURCE_CODE && $this->code['codeSystem'] == self::THIRD_RESOURCE_CODE_SYSTEM)\n ) {\n // checking invalid params\n if (\n (!isset($this->entryRelationship->observation['negationInd']) || $this->entryRelationship->observation['negationInd'] != 'true') &&\n (!isset($this->code['nullFlavor']) || $this->code['nullFlavor'] != self::INVALID_ALLERGY_CODE_NULL_FLAVOR) &&\n (!isset($this->containerElement['nullFlavor']) || $this->containerElement['nullFlavor'] != self::INVALID_ALLERGY_ACT_NULL_FLAVOR)\n ) {\n return true;\n }\n }\n\n\n\n return false;\n }", "abstract protected function validate(): bool;", "public function valid()\n {\n\n if ($this->container['account_id'] === null) {\n return false;\n }\n if ($this->container['account_reference_id'] === null) {\n return false;\n }\n if ($this->container['active'] === null) {\n return false;\n }\n if ($this->container['active_from'] === null) {\n return false;\n }\n if ($this->container['balance'] === null) {\n return false;\n }\n if ($this->container['category'] === null) {\n return false;\n }\n if ($this->container['currency_id'] === null) {\n return false;\n }\n if ($this->container['expiry_date'] === null) {\n return false;\n }\n if ($this->container['initial_balance'] === null) {\n return false;\n }\n if ($this->container['name'] === null) {\n return false;\n }\n if ($this->container['reserved_balance'] === null) {\n return false;\n }\n if ($this->container['shared'] === null) {\n return false;\n }\n if ($this->container['type'] === null) {\n return false;\n }\n if ($this->container['unit'] === null) {\n return false;\n }\n if ($this->container['unit_id'] === null) {\n return false;\n }\n return true;\n }", "public function checkValidity()\n {\n if($this->validator->fails()) {\n return $this->validator->errors();\n }\n else\n return false;\n }", "protected function validate() {\n if($this->title == ''){\n $this->errors[] = \"Title is required\";\n }\n\n if($this->content == ''){\n $this->errors[] = \"Content is required\";\n }\n\n if($this->published_at != '') {\n $date_time = date_create_from_format('Y-m-d H:i:s', $this->published_at);\n\n if($date_time === false){\n $this->errors[] = \"Invalid date and time.\";\n }else{\n $date_errors = date_get_last_errors();\n\n if($date_errors['warning_count'] > 0){\n $this->errors[] = \"Invalid date and time.\";\n }\n }\n }\n return empty($this->errors);\n }", "public function valid()\n {\n\n if (strlen($this->container['addressType']) > 255) {\n return false;\n }\n if (strlen($this->container['applicableRegion']) > 255) {\n return false;\n }\n if (strlen($this->container['errorCode']) > 255) {\n return false;\n }\n if (strlen($this->container['statusCode']) > 255) {\n return false;\n }\n if (strlen($this->container['careOf']) > 255) {\n return false;\n }\n return true;\n }", "function validate() {\n\t\t$this->_validationErrors = array();\n\t\tif (null === $this->getsession_id()) {\n\t\t\t$this->_validationErrors[] = 'session_id must not be null';\n\t\t}\n\t\tif (null === $this->getclassroom_id()) {\n\t\t\t$this->_validationErrors[] = 'classroom_id must not be null';\n\t\t}\n\t\tif (null === $this->getname()) {\n\t\t\t$this->_validationErrors[] = 'name must not be null';\n\t\t}\n\t\treturn 0 === count($this->_validationErrors);\n\t}", "public function valid()\n {\n if ($this->container['priority'] === null) {\n return false;\n }\n if ($this->container['type'] === null) {\n return false;\n }\n if ($this->container['stop_if_true'] === null) {\n return false;\n }\n if ($this->container['above_average'] === null) {\n return false;\n }\n if ($this->container['color_scale'] === null) {\n return false;\n }\n if ($this->container['data_bar'] === null) {\n return false;\n }\n if ($this->container['formula1'] === null) {\n return false;\n }\n if ($this->container['formula2'] === null) {\n return false;\n }\n if ($this->container['icon_set'] === null) {\n return false;\n }\n if ($this->container['operator'] === null) {\n return false;\n }\n if ($this->container['style'] === null) {\n return false;\n }\n if ($this->container['text'] === null) {\n return false;\n }\n if ($this->container['time_period'] === null) {\n return false;\n }\n if ($this->container['top10'] === null) {\n return false;\n }\n if ($this->container['link'] === null) {\n return false;\n }\n return true;\n }", "public function isInvalid()\n {\n return ! $this->validates();\n }", "public function valid()\n {\n if ($this->container['name'] === null) {\n return false;\n }\n if (strlen($this->container['name']) > 50) {\n return false;\n }\n if ($this->container['location_id'] === null) {\n return false;\n }\n if ($this->container['business_unit_id'] === null) {\n return false;\n }\n return true;\n }", "public function valid();", "public function valid();", "public function valid();", "public function valid();", "public function getHasPaymentIssueAttribute()\n {\n return $this->active && $this->lastTransaction &&\n $this->lastTransaction->status != Factory::getClass(TransactionStatus::class)::SUCCESS;\n }", "protected function validateCommand() : bool\n {\n $format = $this->argument('format');\n\n if (!$this->isValidFormat($format)) {\n $this->error(\"Error: Format not supported.\");\n $this->info(\"Supported formats: \" . join(', ', array_keys(static::getFormatsMap())));\n return false;\n }\n\n return true;\n }", "abstract function check();", "function validate(){\n $errors = array();\n\n // throw message indicating that this field is numeric\n if( $this->post->isNumeric('noOfTransactions')==false){\n $errors[] = $this->Raxan->locale(\"request.missing.transcount\");\n }\n // throw message indicating that this field is date\n if( $this->post->isDate(\"startDate\",\"Y-m-d\" )==false){\n $errors[] = $this->Raxan->locale(\"request.missing.startdate\");\n }\n // throw message indicating that this field is date\n if( $this->post->isDate( \"endDate\",\"Y-m-d\" )==false ){\n $errors[] = $this->Raxan->locale(\"request.missing.enddate\");\n }\n\n if(!empty ($errors)) {\n $this->postMessage($errors, \"Request History\");\n }\n return (count($errors) == 0);\n }", "private function getStatus(){\n\t\t$this->valid=$this->checkDatesValidity();\n\t\tif($this->usage==\"once\" && $this->usageCount) $this->valid = false;\n\t\tif($this->usage==\"count\" && $this->usageCount>=$this->maxUsage) $this->valid = false;\n\t\tif($this->type==\"fixed\" && $this->value<=0) $this->valid = false;\n\t\tif($this->type==\"grid\" && !count($this->grid)) $this->valid = false;\n\t}" ]
[ "0.66597736", "0.64619803", "0.63822114", "0.61666673", "0.5917044", "0.58786654", "0.58584905", "0.5831928", "0.576657", "0.5761081", "0.57281303", "0.57268", "0.5719111", "0.5714753", "0.5708133", "0.57066876", "0.57062453", "0.5694154", "0.5685139", "0.5685139", "0.5685139", "0.5685139", "0.5685139", "0.5685139", "0.5685139", "0.5685139", "0.56828547", "0.56756836", "0.5672868", "0.5671154", "0.5659577", "0.56397426", "0.56397426", "0.56184375", "0.5611245", "0.5611205", "0.56079155", "0.5607749", "0.5607749", "0.56075233", "0.5582838", "0.5580665", "0.5580136", "0.5580136", "0.55790204", "0.55790204", "0.55790204", "0.55790204", "0.55790204", "0.5546883", "0.553559", "0.5533992", "0.5526861", "0.55236304", "0.5523411", "0.5523411", "0.55156374", "0.55115455", "0.5508859", "0.5506336", "0.55036664", "0.5494317", "0.54878163", "0.54766166", "0.5473348", "0.54664177", "0.54608774", "0.54573214", "0.5455358", "0.54517734", "0.5450969", "0.5450434", "0.5446423", "0.544624", "0.54380816", "0.5430516", "0.54297423", "0.54286236", "0.54269165", "0.54267055", "0.54180133", "0.5413758", "0.54101485", "0.54070526", "0.54029316", "0.5400101", "0.5398762", "0.53960186", "0.53866524", "0.538342", "0.53816867", "0.5378065", "0.5378031", "0.5378031", "0.5378031", "0.5378031", "0.537729", "0.53760946", "0.5371897", "0.53690785", "0.53663784" ]
0.0
-1
Provide the character separation the project name from the issue number, may be different for merge requests
public static function getProjectIssueSeparator($isMergeRequest) { return '-'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getIssuePrefix() : string;", "public abstract function getProjectName();", "public static function getProjectIssueSeparator($isMergeRequest)\n {\n return $isMergeRequest ? '!' : '#';\n }", "function get_forge_project_name()\n\t{\n\t\treturn '';\n\t}", "public function getProjectName() : string\n {\n return $this->projectName;\n }", "public function projectName() : string\n {\n return (string) $this->getOrError('name');\n }", "protected function getNewProjectName() {\n\t\tdo {\n\t\t\t$t_name = $this->getName() . '_' . rand();\n\t\t\t$t_id = $this->client->mc_project_get_id_from_name( $this->userName, $this->password, $t_name );\n\t\t} while( $t_id != 0 );\n\t\treturn $t_name;\n\t}", "public function getProjectId(): string\n {\n return $this->_projectId;\n }", "private function getIssuesPageTitle(): string\n {\n return $this->app->translator->translate('issues.title');\n }", "public static function issueName(string $project, string $location, string $issueModel, string $issue): string\n {\n return self::getPathTemplate('issue')->render([\n 'project' => $project,\n 'location' => $location,\n 'issue_model' => $issueModel,\n 'issue' => $issue,\n ]);\n }", "public function getProjectTitle();", "public abstract function getProjectFieldName();", "private function getProjectNameAndProjectID(){\r\n $this->jsonOutput[\"projectID\"] = utils\\Encryption::encode($this->settingVars->projectID);\r\n $this->jsonOutput[\"projectName\"] = $this->settingVars->pageArray[\"PROJECT_NAME\"];\r\n }", "public static function getProjectName()\n {\n $name = array();\n $items = Cart::getCart();\n foreach($items as $key => $item) {\n $name[] = $item['title'];\n }\n \n return implode(', ', $name);\n }", "public function whenMessageMatches(): ?string\n {\n $projects = explode(',', env('JIRA_PROJECTS', ''));\n\n $projects = collect($projects);\n\n if ($projects->isNotEmpty()) {\n return sprintf(\n '(?<issue>(?<project>%s)\\-(?<id>[0-9]+))',\n $projects->implode('|')\n );\n }\n\n return null;\n }", "public static function projectName(string $project): string\n {\n return self::getPathTemplate('project')->render([\n 'project' => $project,\n ]);\n }", "public static function projectName(string $project): string\n {\n return self::getPathTemplate('project')->render([\n 'project' => $project,\n ]);\n }", "function getProjectName($con, $inpProj)\n\t{\n\t\t$sql_projName = $con->prepare(\"SELECT projectName FROM projects WHERE projectID = ?\");\n\t\t$sql_projName->bind_param(\"i\", $inpProj);\n\t\t$sql_projName->execute();\n\n\t\t$result_projName = $sql_projName->get_result();\n\n\t\twhile($row = mysqli_fetch_array($result_projName))\n\t\t{\n\t\t\t$projName = $row['projectName'];\n\t\t}\n\n\t\treturn $projName;\n\t}", "public static function label()\n {\n return 'Projects';\n }", "public function getProjectNameWithCustomerName($projectId, $glue = \" - \") {\n\n\t\t$project = $this->getProjectById($projectId);\n\t\t$projectName = $project->getCustomer()->getName() . $glue . $project->getName();\n\n\t\treturn $projectName;\n\t}", "public function get_name() {\n return get_string('circleci', 'assignsubmission_circleci');\n }", "public function fetchProjectID(): string;", "public function getName()\n {\n return 'vlad_bugtracker_issue';\n }", "public function getIssueNumber()\n {\n return $this->getParameter('issueNumber');\n }", "private function getProjectTitle($user_id, $level_id)\n\t{\n\t\t// Check if reference to this project is stored\n\t\t$db = JFactory::getDBO();\n\t\t$query = $db->getQuery(true)\n\t\t\t->select($db->qn('pf_projects_id'))\n\t\t\t->from($db->qn('#__akeebasubs_pf4_projects'))\n\t\t\t->where($db->qn('users_id') . ' = ' . $db->q($user_id))\n\t\t\t->where($db->qn('akeebasubs_level_id') . ' = ' . $db->q($level_id));\n\t\t$db->setQuery($query);\n\t\t$proj_id = $db->loadResult();\n\t\tif($proj_id == null) return \"\";\n\t\t\n\t\t// Get the title\n\t\t$query = $db->getQuery(true)\n\t\t\t->select($db->qn('title'))\n\t\t\t->from($db->qn('#__pf_projects'))\n\t\t\t->where($db->qn('id') . ' = ' . $db->q($proj_id));\n\t\t$db->setQuery($query);\n\t\t$proj_title = $db->loadResult();\n\t\tif($proj_title == null) return \"\";\n\t\t\n\t\treturn $proj_title;\n\t}", "public static function retrieveProjectTitle($projectID) {\n try {\n $project = ArmyDB::retrieveProjectInfo($projectID);\n //var_dump($unit);\n return $project['projectname'];\n }\n catch (Exception $e) {\n throw new Exception($e->getMessage());\n }\n }", "public function getProjectId() {\n if (isset($this->project_id)) {\n return $this->project_id;\n }\n\n $repoApi = new \\Drupal\\config_pr_gitlab\\RepoControllers\\GitLabApi($this->getClient());\n $path = '/api/v4/projects/?scope=projects&search=' . rawurlencode($this->repo_name) . '&owned=true';\n $response = $repoApi->get($path);\n if (is_array($response)) {\n foreach ($response as $item) {\n if ($item['path'] == $this->repo_name) {\n $this->project_id = $item['id'];\n break;\n }\n }\n }\n }", "public function getMenuAddLabel()\n {\n return t('Add a new Github Issue');\n }", "public function getIssueNumber()\n {\n return $this->issue_number;\n }", "function getBugPath ($bug)\n {\n $project = ServiceUtil::getProjectByID ($bug['project_id']);\n $category = $project['category'];\n\n $path = '';\n if ($project)\n $path = $project['name'];\n\n $path .= \"/$category\";\n\n return $path;\n }", "private function translateIdProject(Issue $redmine_issue)\n\t{\n\t\tif (isset($redmine_issue->id_project) && isset($this->projects[$redmine_issue->id_project])) {\n\t\t\t$redmine_issue->project = $this->projects[$redmine_issue->id_project];\n\t\t\tunset($redmine_issue->id_project);\n\t\t}\n\t}", "public function getGitHubUsername()\n {\n return 'etiennemarais';\n }", "public function getProjectTItle() {\n $project = \"Yii2\";\n return $project;\n }", "function column_job($item){\n return sprintf('%1$s',\n /*$1%s*/ $item['job']\n );\n }", "public function nice_name(){\n return 'Anno scolastico '.$this->first_day_first_semester->year.'-'\n .$this->last_day_second_semester->year;\n }", "function rename_project( $user, $project, $new_name )\n {\n //Unimplemented\n }", "private function titleGuess(): string {\n $collaboration = $this->containsCollaboration($this->title);\n return $collaboration;\n }", "function getIssueID($text) {\n preg_match(\"#IC-[0-9]+#\", $text, $matches);\n if (!empty($matches)) {\n return $matches[0];\n }\n return NULL;\n}", "public function getNameProjectType()\n {\n return $this->name_project_type;\n }", "public static function gitlab()\n {\n return 'gitlab';\n }", "function projectname($id)\n{\n\t$name=mysql_fetch_array(mysql_query(\"select property_name from manage_property where pid='$id'\"));\n\treturn $name['property_name'];\n\t}", "protected function getTaskName()\n {\n return str_replace(' ', '', lcfirst(ucwords(str_replace('-', ' ', $this->executableName))));\n }", "public function getProjectName($project)\n {\n return self::get(\"SELECT * FROM $this->table WHERE project_name = '$project'\");\n }", "public function getTaskName($taskProjectId){\n \n // echo '$getUpdateId-------'.$getUpdateId; exit;\n\t\n\t\t\tif(empty($taskProjectId)) :\n\t\t\t\n\t\t\t\t$taskNamesQ \t= $this->db->select('task_Id,task_name')->from('task_details')->group_by('task_name')->order_by('task_Id' , 'desc')->get();\n\t\t\t\n\t\t\telse:\n\t\t\t\n\t\t\t\t$taskNamesQ \t= $this->db->select('task_Id,task_name')->from('task_details')->where('project_Id',$taskProjectId)->order_by('task_Id' , 'desc')->get();\n\t\t\t\n\t\t\tendif; \t\n\t\t\t\n\t\t\treturn $taskNamesQ->result();\n\t\t\n\t}", "public function message()\n {\n return 'The given source control provider name is invalid.';\n }", "function get_project_name_by_id($id)\n{\n $CI =& get_instance();\n $CI->db->select('name');\n $CI->db->where('id', $id);\n $project = $CI->db->get('tblprojects')->row();\n if ($project) {\n return $project->name;\n }\n\n return '';\n}", "public function getPlaceIssue() {\n return isset($this->rPlaceIssue) ? $this->rPlaceIssue->name : '';\n }", "public function getLabel(): string {\n $label = trim($this->brief_journal_title->value ?? '');\n $volume = trim($this->volume->value ?? '');\n $issue = trim($this->issue->value ?? '');\n $pagination = trim($this->pagination->value ?? '');\n $year = trim($this->year->value ?? '');\n if (!empty($issue)) {\n $volume .= '(' . $issue . ')';\n }\n if (!empty($volume)) {\n $label .= \" $volume\";\n }\n if (!empty($pagination)) {\n $label .= \": $pagination\";\n }\n if (!empty($year)) {\n $label .= \", $year\";\n }\n return $label;\n }", "function getProjectName($lm_id){\n if (empty($lm_id)){\n $reply = array(0,'?');\n }else{\n $m = $this->getMember($lm_id);\n $reply = array($m['lm_value'],$m['lm_key']);\n }\n //b_debug::print_r($reply);\n return $reply;\n }", "private function formatProblem(string $problem) : string\n {\n $lines = explode(PHP_EOL, $problem);\n $amount = count($lines);\n\n for ($i = 1; $i < $amount; $i++) {\n $lines[$i] = ' ' . $lines[$i];\n }\n\n return implode(PHP_EOL, $lines);\n }", "function groups_parse_name($format, $groupnumber) {\n if (strstr($format, '@') !== false) { // Convert $groupnumber to a character series\n $letter = 'A';\n for($i=0; $i<$groupnumber; $i++) {\n $letter++;\n }\n $str = str_replace('@', $letter, $format);\n } else {\n $str = str_replace('#', $groupnumber+1, $format);\n }\n return($str);\n}", "function fcollab_project_list(){\r\n\t$output = 'list project';\r\n\t\r\n\treturn $output;\r\n}", "function get_project_name($project_id, &$link){\n \t$resp = 'Unknown';\n \t$query = \"select name from healingcrystals_projects where id='\" . $project_id . \"'\";\n \t$result = mysql_query($query, $link);\n \tif (mysql_num_rows($result)){\n \t\t$info = mysql_fetch_assoc($result);\n \t\t$resp = $info['name'];\n \t}\n \treturn $resp;\n }", "public function projectTitle($id_project) {\n\t\t$this->db->select(\"project_title\");\n\t\t$this->db->from(\"project\");\n\t\t$this->db->where(\"id_project\",$id_project);\n\t\treturn $this->db->get();\n\t}", "public static function issueModelName(string $project, string $location, string $issueModel): string\n {\n return self::getPathTemplate('issueModel')->render([\n 'project' => $project,\n 'location' => $location,\n 'issue_model' => $issueModel,\n ]);\n }", "public function getProjectId()\n {\n return $this->project_id;\n }", "public function getProjectId()\n {\n return $this->project_id;\n }", "public function getProjectId()\n {\n return $this->project_id;\n }", "protected function repoOptionString()\n {\n $str = 'ahem::';\n $args = func_get_args();\n foreach ($args as $arg) \n {\n $str .= !empty($arg) ? $arg.'.' : '';\n }\n $str = rtrim($str,'.');\n return $str;\n \n }", "function getCustomerTitlesByIssues($prj_id, &$result)\n {\n $backend =& self::_getBackend($prj_id);\n $backend->getCustomerTitlesByIssues($result);\n }", "public static function defaultAppName():string {\n\n # Set result\n $result = \"Crazy Project\";\n\n # Get current app path\n $appPath = File::path(\"@app_root\");\n\n # Check app path\n if($appPath){\n\n # Set composer path\n $conposerAppPath = \"$appPath/composer.json\";\n\n # Check composer name\n if(File::exists($conposerAppPath) && ($composerName = Composer::get(\"name\", $conposerAppPath)) !== null)\n\n # Set result\n $result = $composerName;\n\n else\n\n # Extract name from app path\n $result = Strings::getLastString(trim($appPath, \"/\"), \"/\");\n\n }\n\n # Then add space before capital letters\n $result = Process::spaceBeforeCapital($result);\n\n # Return result\n return $result;\n\n }", "public function getName()\n {\n return 'Github';\n }", "private static function GetProject($value)\n\t{\n\t\tif ($value instanceof GitPHP_Project) {\n\t\t\treturn $value->GetProject();\n\t\t} else if (is_string($value)) {\n\t\t\treturn $value;\n\t\t}\n\t}", "public static function getTitle(): string\n\t{\n\t\t$u = str_repeat( '_', 33 );\n\t\treturn $u . '[' . self::TITLE . ']' . $u;\n\t}", "public function getUrl()\n\t{\n\t\t$url = strtolower($this->_name);\n\t\t$url = str_replace(' ', '-', $url);\n\t\t$url = str_replace('&-', '', $url);\n\n\t\t# retrieves a sanitized url from the project name :3\n\t\treturn $this->getId() . DIRECTORY_SEPARATOR . $url;\n\t}", "public function getProjectId()\n\t{\n\t\treturn $this->projectId;\n\t}", "protected function _formatModuleName($name)\n {\n $name = strtolower($name);\n $name = str_replace(array('-', '.'), ' ', $name);\n $name = ucwords($name);\n $name = str_replace(' ', '', $name);\n return $name;\n }", "function column_title_name( $item ) {\r\n\t\t$errors = $item->mla_references['parent_errors'];\r\n\t\tif ( '(' . __( 'NO REFERENCE TESTS', 'media-library-assistant' ) . ')' == $errors ) {\r\n\t\t\t$errors = '';\r\n\t\t}\r\n\r\n\t\t$content = sprintf( '%1$s<br>%2$s<br>%3$s', /*%1$s*/ _draft_or_post_title( $item ), /*%2$s*/ esc_attr( $item->post_name ), /*%3$s*/ $errors );\r\n\t\treturn $this->_handle_primary_column( $item, 'title_name', $content );\r\n\t}", "public function getStringifiedJudgeOrWhatever() : string\n {\n if ($this->judge) {\n $string = $this->judge->getFirstName().' ';\n if ($this->judge->getMiddleName()) {\n $string .= $this->judge->getMiddleName().' ';\n }\n $string .= $this->judge->getLastName().', ';\n $string .= (string)$this->judge->getFlavor();\n return $string;\n } elseif ($this->anonymous_judge) {\n return $this->anonymous_judge->getName();\n }\n return '';\n }", "public function getSolutionName()\n {\n return $this->solution_name;\n }", "public function getRevisionLabel(): string\n {\n return Craft::t('app', 'Revision {num}', [\n 'num' => $this->revisionNum,\n ]);\n }", "function getPuzzleName($name)\n {\n return str_replace(\"-\", \" \", ucwords($name));\n }", "private function _split_task_and_project($task) {\n global $term;\n $match = array('', '', '');\n $text = $task;\n $project = 0;\n\n $matched = preg_match($term['add_to_proj'], $task, $match);\n if ($matched !== false && $matched > 0) {\n $text = trim($match[1]);\n $project = (int) trim($match[2], \":/ \");\n }\n return array($text, $project);\n }", "public function ancestorsIndentedTitle($char=\"&ndash;\")\r\n {\r\n return str_repeat( $char, substr_count( $this->path, \"/\" ) - 1 ) . \" \" . $this->title;\r\n }", "public function badMilestoneProvider() {\n // all of which were tripping over the same code\n\n return [\n ['offices/qa'],\n ['49018/Data.json'],\n ['48027/Data.json'],\n ['48027/digitalstrategy.json'],\n ['48112/Data.json'],\n ['49015/%252527?highlight=edi'],\n ['49015/e.g'],\n ['49015/http%3a%2f%2fr87.com%2fn%3f%00.php?highlight=edi']\n ];\n\n }", "function cp_make_custom_name($cname) {\r\n\r\n\t$cname = preg_replace('/[^a-zA-Z0-9\\s]/', '', $cname);\r\n\t$cname = 'cp_' . str_replace(' ', '_', strtolower(substr(appthemes_clean($cname), 0, 30)));\r\n\r\n\treturn $cname;\r\n}", "protected function getProjectId(InputInterface $input, OutputInterface $output, ClientInterface $client)\n {\n $response = $client->get('projects/names');\n\n if ($response->isJson()) {\n $project_id_names_map = $response->getJson();\n } else {\n throw new RuntimeException('Invalid project names response');\n }\n\n if (empty($project_id_names_map)) {\n throw new RuntimeException(\"You don't have access to any of the projects in that ActiveåCollab\");\n }\n\n $output->writeln('Here is a list of active projects that you have access to:');\n $output->writeln('');\n\n foreach ($project_id_names_map as $id => $name) {\n $output->writeln(\" <comment>*</comment> {$name} <comment>#{$id}</comment>\");\n }\n\n $output->writeln('');\n\n $project_id = (int) trim(\n $this->getHelper('question')->ask($input, $output, (new Question(\"Which one would you like to use? Please enter project #:\\n\"))),\n '#'\n );\n\n if ($project_id) {\n if (array_key_exists($project_id, $project_id_names_map)) {\n return $project_id;\n } else {\n throw new RuntimeException(\"You don't have access to project #{$project_id}\");\n }\n } else {\n throw new RuntimeException('Account ID is not set');\n }\n }", "private static function formatSortableKey(IssueInstance $issue): string\n {\n // is in the expected order\n return \\implode('|', [\n $issue->getFile(),\n \\str_pad((string)$issue->getLine(), 5, '0', \\STR_PAD_LEFT),\n $issue->getIssue()->getType(),\n $issue->getMessage()\n ]);\n }", "public function getParameterName(): string\n {\n return \\str_replace('-', '_', $this->parameter->parameter->__toString());\n }", "protected function _releaseName()\n {\n return \"Version {$this->version}\" . ($this->name ? \": {$this->name}\" : '');\n }", "public function buildFileName()\n {\n $twig = $this->container->get('twig');\n $globals = $twig->getGlobals();\n return $globals['fullName'].'-Resume.';\n }", "private function getMergePullRequestRegex(): string\n {\n return '/Merge pull request #(\\d+?) from/';\n }", "protected function get_issue_uuid() {\n global $CFG;\n require_once($CFG->libdir . '/horde/framework/Horde/Support/Uuid.php');\n return (string)new Horde_Support_Uuid();\n }", "function surveyCodeToName($surveyCode) {\n\tswitch($surveyCode) {\n\t\tcase HW_PROJECT_VALUE:\n\t\t\treturn HW_PROJECT_NAME;\n\t\tcase CHD_PROJECT_VALUE:\n\t\t\treturn CHD_PROJECT_NAME;\n\t\tcase COMB_PROJECT_VALUE:\n\t\t\treturn COMB_PROJECT_NAME;\n\t}\n}", "public function getPackageName() {\n\t\treturn t('Coworking Space Package');\n\t}", "private function get_progression_title($sectionidx) {\n $stringexists = get_string_manager()->string_exists('badges-' . $this->get_visual_preset() . '-progression-title-' .\n $sectionidx, 'format_ludimoodle');\n if ($stringexists) {\n $title = get_string('badges-' . $this->get_visual_preset() . '-progression-title-' . $sectionidx, 'format_ludimoodle');\n } else {\n $title = get_string('badges-progression-title-default', 'format_ludimoodle');\n }\n return $title;\n }", "public function getTitle()\n {\n return str_replace([' ', '?', '/', '\\\\', '&'], '_', $this->info['title']);\n }", "protected function createInfoString($project_info)\n {\n $remote_path = isset($project_info->files['remote']->uri) ? $project_info->files['remote']->uri : false;\n $local_path = isset($project_info->files['local']->uri) ? $project_info->files['local']->uri : false;\n\n if (strpos($project_info->version, 'dev') !== false) {\n return $this->trans('commands.locale.translation.status.messages.no-translation-files');\n }\n if (locale_translation_use_remote_source() && $remote_path && $local_path) {\n return sprintf(\n $this->trans('commands.locale.translation.status.messages.file-not-found'),\n $remote_path,\n $local_path\n );\n } elseif ($local_path) {\n return\n sprintf(\n $this->trans('commands.locale.translation.status.messages.local-file-not-found'),\n $local_path\n );\n }\n\n return $this->trans('commands.locale.translation.status.messages.translation-not-determined');\n }", "public function getProjectId() : int\n {\n return $this->projectId;\n }", "public function transform($issue)\n {\n if (null === $issue) {\n return '';\n }\n\n return $issue->getId();\n }", "public function getUsername()\n {\n return $this->company_id.'+'.$this->username;\n }", "function rawpheno_function_getproject($project_id) {\n $result = chado_query(\"SELECT name FROM {project} WHERE project_id = :project_id LIMIT 1\", array(\n ':project_id' => $project_id,\n ));\n\n return ($result) ? $result->fetchField() : 0;\n}", "function getNameHelper(){\n\treturn 'Ejercicio de aprendizaje';\n}", "protected function getGameName( )\n {\n return \"pi\";\n }", "public function to_string(): string\n {\n return String_Helper::prepend(str_replace(' ', '', ucwords(strtolower($this->get_name()))), '#');\n }", "public function gitUrl() : string\n {\n return sprintf(\n '%s@%s:%s.git',\n $this->projectName(),\n $this->getOrError('frb_zone'),\n $this->projectName()\n );\n }", "public function jobTitle(){\n\t\n\t\t$_error = \"enter the Job Title\";\n\t\treturn $_error;\n\t}", "protected function getUniqueIdentifierSeparator(): string\n {\n return '-';\n }", "public function getChangeInternalName()\n {\n \treturn $this->_change_internal_name;\n }", "protected static function findGitVersion($projectDir)\n {\n $branch = static::revParse('--abbrev-ref HEAD', $projectDir);\n\n if (empty($branch)) {\n return null;\n }\n\n return $branch . ' ' . static::revParse('--short HEAD', $projectDir);\n }" ]
[ "0.6409201", "0.62410223", "0.6235086", "0.6232383", "0.6191263", "0.6130725", "0.60237056", "0.6015594", "0.58794904", "0.5871256", "0.58393794", "0.5826795", "0.57452464", "0.57138175", "0.562946", "0.5593079", "0.5593079", "0.55403495", "0.55237025", "0.55163467", "0.5498883", "0.54442006", "0.542346", "0.53988844", "0.53806704", "0.52213174", "0.5218061", "0.51793116", "0.5169748", "0.5125348", "0.5115463", "0.50910777", "0.50877005", "0.50763905", "0.5074772", "0.50595015", "0.5050383", "0.5049344", "0.50425965", "0.50415987", "0.5031394", "0.49975938", "0.49933735", "0.49860418", "0.49799585", "0.49665672", "0.4959526", "0.49590373", "0.49307865", "0.49236685", "0.4915737", "0.4895913", "0.48874786", "0.487642", "0.48743382", "0.4867915", "0.4867915", "0.4867915", "0.4863344", "0.48576513", "0.48529002", "0.48387972", "0.4836482", "0.4832565", "0.48315224", "0.48230645", "0.47808975", "0.4772335", "0.4768771", "0.47619766", "0.47561792", "0.4753768", "0.47411367", "0.47381443", "0.4734432", "0.4734185", "0.47335982", "0.47313768", "0.47306478", "0.47304872", "0.47275594", "0.47267443", "0.4723326", "0.4721271", "0.4708342", "0.47080424", "0.4703249", "0.4697594", "0.46969143", "0.46871522", "0.4683393", "0.46728796", "0.46694854", "0.46690682", "0.46661326", "0.46657723", "0.4665308", "0.46504712", "0.46462318", "0.46423444" ]
0.63528866
1
Get the url to the given issue at the given project
public function getIssueURL($projectId, $issueId, $isMergeRequest) { return $this->jiraUrl . '/browse/' . $projectId . '-' . $issueId; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getIssueEndpointUrl(IssueWrapper $issue)\n {\n\n }", "public function getIssuesUrl()\n {\n return $this->issuesUrl;\n }", "function cs_get_project_url() {\n\tif (function_exists('get_field')) {\n\t\tglobal $post;\n\t\t$project_url = get_field('project_url', $post->ID);\n\t\techo $project_url;\n\t}\n}", "public function getUrl()\n\t{\n\t\t$url = strtolower($this->_name);\n\t\t$url = str_replace(' ', '-', $url);\n\t\t$url = str_replace('&-', '', $url);\n\n\t\t# retrieves a sanitized url from the project name :3\n\t\treturn $this->getId() . DIRECTORY_SEPARATOR . $url;\n\t}", "public function getFetchBaseUrl($project);", "public function getApiIssuesUrl()\n {\n return $this->apiIssuesUrl;\n }", "public function getIssueURL($projectId, $issueId, $isMergeRequest)\n {\n return $this->gitlabUrl . '/' . $projectId . ($isMergeRequest ? '/merge_requests/' : '/issues/') . $issueId;\n }", "public function gitUrl() : string\n {\n return sprintf(\n '%s@%s:%s.git',\n $this->projectName(),\n $this->getOrError('frb_zone'),\n $this->projectName()\n );\n }", "public function buildFetchUrl(array $project, $site_key = '');", "public function getUrlAttribute()\n {\n return env('APP_URL').'/projects/'.$this->id;\n }", "function getBugPath ($bug)\n {\n $project = ServiceUtil::getProjectByID ($bug['project_id']);\n $category = $project['category'];\n\n $path = '';\n if ($project)\n $path = $project['name'];\n\n $path .= \"/$category\";\n\n return $path;\n }", "private function _get_issues( $project ) {\n\n\t\tif ( ! empty( $project['_links']['issues'] ) ) {\n\n\t\t\t$issues_link = $project['_links']['issues'];\n\n\t\t\t$request = new Gitlab();\n\t\t\t$gitlab = $request->init_request();\n\n\t\t\t$issues = [];\n\t\t\t$page_index = 1;\n\t\t\t$total = 0;\n\n\t\t\tdo {\n\n\t\t\t\t$response = $gitlab->get( \"$issues_link?per_page=50&page=$page_index&sort=asc\" );\n\t\t\t\t$response_arr = json_decode( $response->body, true );\n\n\t\t\t\t$issues = array_merge( $issues, $response_arr );\n\n\t\t\t\t$page_index ++;\n\t\t\t\t$total += count( $response_arr );\n\n\t\t\t} while ( count( $response_arr ) > 0 );\n\n\t\t\treturn $issues;\n\n\t\t}\n\n\t}", "public function get_url(){\n\n\t\t\treturn $this->api_urls['giturl'];\n\n\t\t}", "public function getFailureUrl();", "function the_project_link($project) {\n $link = '';\n \n if ($project['project_url']) {\n $link = '<a class=\"project-link\" href=\"'. $project['project_url'].'\" target=\"_blank\">#</a>';\n }\n \n echo $link;\n}", "public function get_url();", "public static function getUrl_ ($account){\n $url = BASE_URL . \"/budget-\" . $account->id . \"-\" . strtolower($account->name);\n return urldecode($url);\n }", "public function getProjectLink($module, $method, $extra)\n {\n $link = '';\n if($module == 'task' && ($method == 'view' || $method == 'edit' || $method == 'batchedit'))\n { \n $module = 'task';\n $method = 'browse';\n } \n\n if($module == 'project' && $method == 'create') return;\n\n $link = helper::createLink($module, $method, \"projectID=%s\");\n if($extra != '') $link = helper::createLink($module, $method, \"projectID=%s&type=$extra\");\n return $link;\n }", "function _project_issue_mail_url_callback($match = FALSE) {\n static $urls = array();\n if (!empty($match) && is_array($match)) {\n $url = $match[2];\n\n // If $url was an internal link, we need to strip the base_path\n // off before passing it to url(), to avoid doubling up on the base_path.\n // @todo Check that this actually works when using language specific url rewriting.\n $base_path = base_path();\n $base_length = strlen($base_path);\n if (substr($url, 0, $base_length) == $base_path) {\n $url = substr($url, $base_length);\n }\n\n $urls[] = url($url, array('absolute' => TRUE));\n return $match[3] .' ['. count($urls) .']';\n }\n return $urls;\n}", "public function getURL ();", "function getUrl() {\n\t\treturn $this->repoObj->lobUrltitle;\n\t}", "public function getUrl() {\n\t\t$this->getRublon()->log(__METHOD__);\n\t\treturn $this->getRublon()->getAPIDomain() .\n\t\t\tself::URL_PATH_CODE .\n\t\t\turlencode($this->getUrlParamsString());\n\t}", "public function getURL() {\n\t\treturn $this->urlStub() .'/' . $this->publicContainer .'/' . $this->getId();\n\t}", "function project_url($pid)\n{\n\t$name4=mysql_fetch_array(mysql_query(\"select new_pagename from pagemgn where pid='$pid' and pn_id='1'\"));\n\treturn $name4['new_pagename'];\n\t\n}", "public function getURL();", "public function getURL();", "public function getLink()\n {\n $link = $this->getFunctionPath();\n $link .= \"?issueId=\".$this->issueId;\n $link .= \"&\".$this->eventGroupIdParameter.\"=\".$this->eventsGroupId;\n\n return $link;\n }", "abstract public function getWorkLogUri(string $taskId): string;", "public function get_link()\r\n\t{\r\n\t\t$url = api_get_path(WEB_PATH)\r\n\t\t\t.'main/gradebook/exercise_jump.php?cid='.$this->get_course_code();\r\n\t\tif (!api_is_allowed_to_create_course()\r\n\t\t\t&& $this->calc_score(api_get_user_id()) == null)\r\n\t\t$url .= '&amp;doexercise='.$this->get_ref_id();\r\n\t\t\r\n\t\treturn $url;\r\n\t}", "public function getUrl()\n {\n return WEB_SERVER_BASE_URL . '/badges/' . $this->data['id'];\n }", "private function createUrl(string $jql) : string\n {\n return $this->httpClient->applicationParams()->jiraHost()\n . '/rest/api/2/search?jql='\n . $jql\n . '&maxResults='\n . $this->httpClient->applicationParams()->jiraSearchMaxResults();\n }", "protected function getUrl() {\n\t\treturn $this->getQueryParam ( self::URL_PARAM );\n\t}", "private function getJenkinsUrl()\n {\n $jenkins_location = $this->app['config']['jenkins']['location'];\n $jenkins_user = $this->app['config']['jenkins']['api_user'];\n $jenkins_token = $this->app['config']['jenkins']['api_token'];\n\n $jenkins_protocol = 'http';\n $jenkins_host = $jenkins_location;\n\n if(preg_match('/^(.*):\\/\\/(.*)$/', $jenkins_location, $matches)) {\n $jenkins_protocol = $matches[1];\n $jenkins_host = $matches[2];\n }\n\n $jenkins_host = rtrim($jenkins_host, '/') . '/';\n\n $jenkins_http_auth_string = '';\n if(!empty($jenkins_user) && !empty($jenkins_token)) {\n $jenkins_http_auth_string = $jenkins_user . ':' . $jenkins_token . '@';\n }\n\n $jenkins_url = $jenkins_protocol . '://' . $jenkins_http_auth_string . $jenkins_host;\n\n return $jenkins_url;\n }", "public function buildTaskUri(array $values)\n {\n return sprintf($this->getIssueApiUrl(), $values['organization'], $values['project'], $values['number']);\n }", "public function GetUrlForSelf(): string\n {\n $host_base = Config::get('app.url');\n return \"{$host_base}/test/{$this->id}\";\n }", "public abstract function getURL();", "function milestones_module_add_url($project) {\n return assemble_url('project_milestones_add', array('project_id' => $project->getId()));\n }", "public function get_github_url() {\n\t\treturn $this->get_meta( 'github_url' );\n\t}", "private function _getURL()\n {\n\n $url = $this->_ect . '?';\n foreach ($this as $name => $var) {\n if ($name == 'ect') {\n continue;\n }\n $url .= \"$name=$var&\";\n }\n\n $this->url = $url;\n\n return $this->url;\n }", "public function get_url()\n {\n }", "public function url($ticket)\n {\n return self::API_SHOW.\"?ticket={$ticket}\";\n }", "public function retrieveIssue(Issue $issue)\n {\n\n $projectKey = $issue->getProject();\n\n /** @var \\helper_plugin_issuelinks_db $db */\n $db = plugin_load('helper', 'issuelinks_db');\n $webhooks = $db->getWebhooks('jira');\n $allowedRepos = explode(',', $webhooks[0]['repository_id']);\n\n if (!in_array($projectKey, $allowedRepos, true)) {\n// Jira Projects must be enabled as Webhook for on-demand fetching\n return;\n }\n\n\n $issueNumber = $issue->getKey();\n $endpoint = \"/rest/api/2/issue/$projectKey-$issueNumber\";\n\n $issueData = $this->makeJiraRequest($endpoint, [], 'GET');\n $this->setIssueData($issue, $issueData);\n }", "function getNotificationUrl($request, $notification) {\n\t\t$router = $request->getRouter();\n\t\t$dispatcher = $router->getDispatcher();\n\t\t$contextDao = Application::getContextDAO();\n\t\t$context = $contextDao->getById($notification->getContextId());\n\n\t\tswitch ($notification->getType()) {\n\t\t\tcase NOTIFICATION_TYPE_PUBLISHED_ISSUE:\n\t\t\t\treturn $dispatcher->url($request, ROUTE_PAGE, $context->getPath(), 'issue', 'current');\n\t\t\tdefault:\n\t\t\t\treturn parent::getNotificationUrl($request, $notification);\n\t\t}\n\t}", "public function ___httpUrl() {\n\t\t$page = $this->pagefiles->getPage();\n\t\t$url = substr($page->httpUrl(), 0, -1 * strlen($page->url())); \n\t\treturn $url . $this->url(); \n\t}", "public function get($project);", "private function generateUrl() : string\n {\n return $this->apiUrl.$this->ownerRepo.$this->branchPath.$this->branch;\n }", "public function sshUrl() : string\n {\n return sprintf(\n '%s@%s',\n $this->projectName(),\n $this->getOrError('frb_zone')\n );\n }", "private function getUrl($uri)\n {\n if (filter_var($uri, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED)) {\n return $uri;\n }\n\n return sprintf('%s/%s', $this->jiraHost, $uri);\n }", "protected function url()\n\t{\n\t\treturn Phpfox::getLib('url');\t\n\t}", "private function openEIUrl($sub=''){\n $s = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')? 's' : '';\n $onDev = (preg_match('/^dev/', $_SERVER['SERVER_NAME']));\n if ($sub && $onDev){\n $sub = 'dev-'.$sub;\n }\n if (!$sub){\n $sub = ($onDev)? 'dev' : 'en';\n }\n return \"http$s://$sub.openei.org\";\n }", "public function get_url(): string\n {\n return $this->get_url_internal();\n }", "function get_url()\n {\n }", "public function buildUrl(string $ip_address, string $req_for) : string\n {\n $url = self::API_BASE_URL;\n $url .= \"/\".$req_for.\"?ip=$ip_address\";\n\n return $url;\n }", "public static function issueName(string $project, string $location, string $issueModel, string $issue): string\n {\n return self::getPathTemplate('issue')->render([\n 'project' => $project,\n 'location' => $location,\n 'issue_model' => $issueModel,\n 'issue' => $issue,\n ]);\n }", "public static function getThisUrl() {}", "function url_for($to) {\n $args = func_get_args();\n\n # find params\n $params = array();\n if (is_array(end($args))) {\n $params = array_pop($args);\n }\n\n # urlencode all but the first argument\n $args = array_map('urlencode', $args);\n $args[0] = $to;\n\n return PluginEngine::getURL($this->dispatcher->plugin, $params, join('/', $args));\n }", "function getAddToProjectsUrl() {\n return assemble_url('people_company_user_add_to_projects', array(\n 'company_id' => $this->getCompanyId(),\n 'user_id' => $this->getId(),\n ));\n }", "public function getLink() {\n\t\t$link = str_replace('\\\\', \"/\", $this->address);\n\t\treturn str_replace(GProject::$ADDRESS, \"\", $link);\n\t}", "public function url()\n\t{\n\t\treturn Url::to($this->id);\n\t}", "public function path()\n {\n return \"/projects/{$this->id}\";\n }", "protected function getUrl()\n {\n if (!empty($this->info['url'])) {\n return $this->info['url'];\n }\n }", "public function url()\n {\n return $this->factory->getUrl($this->handle);\n }", "function url_for($to)\n {\n $args = func_get_args();\n\n # find params\n $params = array();\n if (is_array(end($args))) {\n $params = array_pop($args);\n }\n\n # urlencode all but the first argument\n $args = array_map('urlencode', $args);\n $args[0] = $to;\n\n return PluginEngine::getURL($this->dispatcher->plugin, $params, join('/', $args));\n }", "function url_for($to)\n {\n $args = func_get_args();\n\n // find params\n $params = array();\n if (is_array(end($args))) {\n $params = array_pop($args);\n }\n\n // urlencode all but the first argument\n $args = array_map('urlencode', $args);\n $args[0] = $to;\n\n return PluginEngine::getURL($this->dispatcher->plugin, $params, join('/', $args));\n }", "private function getProject()\n {\n $url = $this->base_uri.\"project/\".$this->project;\n $project = $this->request($url);\n return $project;\n }", "public function getURL()\n {\n return $this->site->getURL() . 'unl_progress/edit/';\n\n }", "protected function getUri($typolink_conf) {\r\n\t\treturn $this->contentObject->typoLink_URL($typolink_conf);\r\n\t}", "public function getIssueNumber()\n {\n return $this->getParameter('issueNumber');\n }", "protected function _getUrl()\n {\n return Router::url([\n '_name' => 'wikiPages',\n 'id' => $this->id,\n 'slug' => Inflector::slug($this->title)\n ]);\n }", "public function getProject() {\n\t\tif ($this->_project === null) {\n\t\t\t$this->analyzeURL();\n\t\t}\n\t\treturn $this->_project;\n\t}", "public function portfolio_url()\n\t{\n\t\treturn Route::url('work');\n\t}", "function get_project_link($repo, $type = false) {\n $path = basename($repo);\n\n switch ($type) {\n case 'targz':\n return \"<a href=\\\"\" . sanitized_url() . \"p=$path&dl=targz\\\">.tar.gz</a>\";\n break;\n case 'zip':\n return \"<a href=\\\"\" . sanitized_url() . \"p=$path&dl=zip\\\">.zip</a>\";\n break;\n case false:\n return $path;\n break;\n }\n}", "function get_project($projectId)\n{\n global $airavataclient;\n\n try\n {\n return $airavataclient->getProject($projectId);\n }\n catch (InvalidRequestException $ire)\n {\n print_error_message('<p>There was a problem getting the project.\n Please try again later or submit a bug report using the link in the Help menu.</p>' .\n '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');\n }\n catch (AiravataClientException $ace)\n {\n print_error_message('<p>There was a problem getting the project.\n Please try again later or submit a bug report using the link in the Help menu.</p>' .\n '<p>AiravataClientException: ' . $ace->getMessage() . '</p>');\n }\n catch (AiravataSystemException $ase)\n {\n print_error_message('<p>There was a problem getting the project.\n Please try again later or submit a bug report using the link in the Help menu.</p>' .\n '<p>AiravataSystemException!<br><br>' . $ase->getMessage() . '</p>');\n }\n\n}", "public function getURL(): string\n {\n return $this->url.$this->apiVersion.'/';\n }", "public function getUrl(ExtReference $extReference);", "public function getUrl()\n {\n if (null === $this->data) {\n $this->initializeReport();\n }\n\n return $this->data['_links']['report']['href'];\n }", "public function getRowUrl($gridId, $rowIndex) {\n $rows = $this->getGridRows($gridId);\n return $rows[$rowIndex]['title'];\n }", "public function getURL(Notification $notification)\n\t{\n\t\t$data = $notification->getData();\n\t\treturn '<URL>?topic=' . $notification->getObject() . '.0';\n\t}", "public function getUrl() {\n return $this->get(self::URL);\n }", "public function getURL(): string\n {\n return $this->http->getURL();\n }", "public function getFailUrl(): ?string\n {\n return $this->getParameter('failUrl');\n }", "protected function buildIssuesUri(string ...$parts)\n {\n return UriBuilder::build('repositories', $this->workspace, $this->repo, 'issues', ...$parts);\n }", "public function getCommitUrl(): string\n {\n return $this->data->url;\n }", "public function getUrl(): string\n {\n $query = $this->getQuery();\n return\n $this->getScheme() .\n '://' .\n $this->getHostAndPort() .\n $this->getRoot() .\n $this->getPath() .\n (!empty($query) ? '?' . http_build_query($query) : '');\n }", "protected function getUrl(){\n\t\treturn $this->apiUrl . $this->apiVersion . '/';\n\t}", "protected function getUrl(): string\n {\n return $this->url;\n }", "public function getUrl()\n {\n return $this->createUrl();\n }", "public function get_url () {\r\n\t\treturn $this->url;\r\n\t}", "public function getUrl() {\n\t\t$url = $this->getBaseUrl().$this->getBasePath().$this->getOperation();\n\t\t$params = http_build_query($this->getUrlParameters());\n\t\tif ($params) {\n\t\t\t$url .= '?'.$params;\n\t\t}\n\t\treturn $url;\n\t}", "protected function getUrl() {\r\n\t\treturn $this->url;\r\n\t}", "public function url_for($to)\n {\n $args = func_get_args();\n\n # find params\n $params = array();\n if (is_array(end($args))) {\n $params = array_pop($args);\n }\n\n # urlencode all but the first argument\n $args = array_map('urlencode', $args);\n $args[0] = $to;\n\n return PluginEngine::getURL($this->dispatcher->plugin, $params, join('/', $args));\n }", "public function getUrl()\n {\n $httpRequest = $this->httpClient->get($this->getEndpoint() . '?' . http_build_query($this->getData(), '', '&'));\n return $httpRequest->getUrl();\n }", "public function getUrl()\n {\n return Yii::app()->createUrl('/forum/thread/view', array('id' => $this->id));\n }", "public function makeUrlFromRequest()\n {\n $id = __Request::get('id', null);\n $resolvedVO = $this->createResolvedVO($id);\n return $resolvedVO->url;\n }", "public function get_url() {\n\t\treturn $this->url;\n\t}", "public function get_url() {\n\t\treturn $this->url;\n\t}", "public function project($projectId)\n {\n return $this->request('get', '/api/projects/'.$projectId);\n }", "public function getUrl()\n {\n return $this->scheme . '://' . $this->host . ':' . $this->port . '/' . trim($this->path, '/');\n }", "public function url()\n\t{\n\t\tif( $this->modified === false ) return $this->url;\n\t\telse\n\t\t{\n\t\t\t$url = $this->generateString();\n\t\t\treturn htmlentities( $url );\n\t\t}\n\t}", "public function getUrl() {\r\n\t}" ]
[ "0.6983532", "0.6883664", "0.6772186", "0.6402887", "0.6285824", "0.6256087", "0.6060097", "0.6042788", "0.6041548", "0.59468997", "0.5923871", "0.5906531", "0.5841501", "0.5814671", "0.5758893", "0.57417166", "0.5716724", "0.569462", "0.5689039", "0.56650686", "0.56541044", "0.56504524", "0.5643604", "0.56409734", "0.56320363", "0.56320363", "0.56274796", "0.5626174", "0.5624948", "0.5624104", "0.5623739", "0.56156325", "0.55936354", "0.558432", "0.5560958", "0.5554334", "0.5543852", "0.5536633", "0.5531171", "0.5518562", "0.550948", "0.54955196", "0.54872125", "0.5480513", "0.54728645", "0.54664457", "0.5464992", "0.54459447", "0.5440318", "0.5435734", "0.54348177", "0.54285073", "0.5428146", "0.54185873", "0.5416653", "0.54072696", "0.54032266", "0.53958386", "0.53856224", "0.5385354", "0.5383808", "0.53778404", "0.5364301", "0.53626215", "0.5361087", "0.53594106", "0.534759", "0.53383124", "0.5332972", "0.53075165", "0.53037715", "0.53010607", "0.5293862", "0.5289164", "0.52805954", "0.5279722", "0.5278023", "0.5270532", "0.5269231", "0.5268206", "0.52648926", "0.52598965", "0.52595484", "0.52582085", "0.5257878", "0.52511185", "0.5247539", "0.5243174", "0.5243129", "0.5239702", "0.52364", "0.5234918", "0.52331394", "0.52208567", "0.5217382", "0.5217382", "0.52130616", "0.5208449", "0.5206862", "0.5203386" ]
0.63622093
4
FIXME: somehow validate that we are allowed to retrieve that issue
public function retrieveIssue(Issue $issue) { $projectKey = $issue->getProject(); /** @var \helper_plugin_issuelinks_db $db */ $db = plugin_load('helper', 'issuelinks_db'); $webhooks = $db->getWebhooks('jira'); $allowedRepos = explode(',', $webhooks[0]['repository_id']); if (!in_array($projectKey, $allowedRepos, true)) { // Jira Projects must be enabled as Webhook for on-demand fetching return; } $issueNumber = $issue->getKey(); $endpoint = "/rest/api/2/issue/$projectKey-$issueNumber"; $issueData = $this->makeJiraRequest($endpoint, [], 'GET'); $this->setIssueData($issue, $issueData); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function fetchIssue()\n {\n $this->_oIssue = AM_Model_Db_Table_Abstract::factory('issue')->findOneBy('id', $this->issue);\n\n if (is_null($this->_oIssue)) {\n throw new AM_Model_Db_Exception(sprintf('Static pdf \"%s\" has no issue', $this->id));\n }\n\n return $this->_oIssue;\n }", "public function get()\n {\n return $this->apiSearch($this->endpoint, ['class' => 'Managed\\Issue', 'parameters' => ['id']]);\n }", "public function getIssues()\n {\n return $this->data['issues'];\n }", "function getNewsletterIssue($id){\n\t$issue = \"\";\n\t$issue = data_newsletterIssue($id);\n\treturn $issue;\n}", "public function getIssue($issueKey)\n {\n return $this->client->get('/rest/api/2/issue/'. urlencode($issueKey));\n }", "public function issue()\n {\n return Issue::i();\n }", "public function issue()\n {\n return $this->belongsTo(Issue::class);\n }", "public function getIssueOfComponent() {\n return $this->issueOfComponent;\n }", "public function getIssueNumber()\n {\n return $this->issue_number;\n }", "public function issue()\n {\n return $this->belongsToMany('App\\Issue')->first();\n }", "public function get_issue($user = null, $issueifempty = true) {\n global $DB, $USER;\n\n if (empty($user)) {\n $userid = $USER->id;\n } else {\n if (is_object($user)) {\n $userid = $user->id;\n } else {\n $userid = $user;\n }\n }\n\n // Check if certificate has already issued.\n // Trying cached first.\n\n // The cache issue is from this user ?\n $created = false;\n if (!empty($this->issuecert) && $this->issuecert->userid == $userid) {\n if (empty($this->issuecert->haschange)) {\n // ...haschange is marked, if no return from cache.\n return $this->issuecert;\n } else {\n // ...haschange is maked, must update.\n $issuedcert = $this->issuecert;\n }\n // Not in cache, trying get from database.\n } else if (!$issuedcert = $DB->get_record('simplecertificate_issues',\n array('userid' => $userid, 'certificateid' => $this->get_instance()->id, 'timedeleted' => null))) {\n // Not in cache and not in DB, create new certificate issue record.\n\n if (!$issueifempty) {\n // Not create a new one, only check if exists.\n return null;\n }\n\n // Mark as created.\n $created = true;\n $issuedcert = new stdClass();\n $issuedcert->certificateid = $this->get_instance()->id;\n $issuedcert->coursename = format_string($this->get_instance()->coursename, true);\n $issuedcert->userid = $userid;\n $issuedcert->haschange = 1;\n $formatedcoursename = str_replace('-', '_', $this->get_instance()->coursename);\n $formatedcertificatename = str_replace('-', '_', $this->get_instance()->name);\n $issuedcert->certificatename = format_string($formatedcoursename . '-' . $formatedcertificatename, true);\n $issuedcert->timecreated = time();\n $issuedcert->code = $this->get_issue_uuid();\n // Avoiding not null restriction.\n $issuedcert->pathnamehash = '';\n\n if (has_capability('mod/simplecertificate:manage', $this->context, $userid)) {\n $issuedcert->id = 0;\n } else {\n $issuedcert->id = $DB->insert_record('simplecertificate_issues', $issuedcert);\n\n // Email to the teachers and anyone else.\n if (!empty($this->get_instance()->emailteachers)) {\n $this->send_alert_email_teachers();\n }\n\n if (!empty($this->get_instance()->emailothers)) {\n $this->send_alert_email_others();\n }\n }\n }\n\n // If cache or db issued certificate is maked as haschange, must update.\n if (!empty($issuedcert->haschange) && !$created) { // Check haschange, if so, reissue.\n $formatedcoursename = str_replace('-', '_', $this->get_instance()->coursename);\n $formatedcertificatename = str_replace('-', '_', $this->get_instance()->name);\n $issuedcert->certificatename = format_string($formatedcoursename . '-' . $formatedcertificatename, true);\n $DB->update_record('simplecertificate_issues', $issuedcert);\n }\n\n // Caching to avoid unessecery db queries.\n $this->issuecert = $issuedcert;\n return $issuedcert;\n }", "public function get_issues() {\n \n $issues = [];\n \n $q = 'SELECT nid, title FROM {node_field_data} ';\n $q .= 'WHERE type = :t ';\n $q .= 'AND status = :s ';\n $q .= 'ORDER BY created DESC ';\n $args = [\n ':t' => 'issue',\n ':s' => 1\n ];\n \n $connection = \\Drupal::database();\n $result = $connection->query($q, $args);\n if ($result) {\n \n $am = \\Drupal::service('path.alias_manager');\n \n while ($row = $result->fetchAssoc()) {\n \n $d = [\n 'id' => $row['nid'],\n 'name' => $row['title'],\n 'url' => $am->getAliasByPath('/node/'.$row['nid'])\n ];\n $issues[$row['nid']] = $d;\n } \n }\n \n return $issues;\n \n }", "public function getIssue( $issueKey, $expand = '' );", "public function getIssues()\n {\n return $this->issues;\n }", "public function getIssues()\n {\n return $this->issues;\n }", "public function GetIssue($c)\n {\n global $db;\n $id = (isset($c['comic_id']) ? $c['comic_id'] : $c);\n\n if (!isset($this->issues[$id]))\n $this->issues[$id] = new Issue(isset($c['name']) ? $c['name'] : $db->GetValue(\"select name from comics where comic_id = {$id}\", 'name'));\n\n return $this->issues[$id];\n }", "public function show(Issue $issue)\n {\n //\n }", "public function find($id)\n {\n return Issue::find($id);\n }", "public function __construct(Issue $issue)\n {\n $this->issue = $issue;\n }", "public function getIssueById( $id )\n\t{\n\t\treturn $this->issue->with('stage')->find($id);\n\t}", "function getIssueFilter() {\n\t\treturn null;\n\t}", "public function get($issueIdOrKey, $paramArray = [], $issueObject = null): Issue\n {\n $issueObject = ($issueObject) ? $issueObject : new Issue();\n\n $ret = $this->exec($this->uri.'/'.$issueIdOrKey.$this->toHttpQueryParameter($paramArray), null);\n\n $this->log->info(\"Result=\\n\".$ret);\n\n return $issue = $this->json_mapper->map(\n json_decode($ret),\n $issueObject\n );\n }", "public function getIssueNumber()\n {\n return $this->getParameter('issueNumber');\n }", "function getIssueStatus($issue_id, $jira_user, $jira_token, $jira_space) {\n $ch = curl_init(); \n curl_setopt($ch,CURLOPT_URL,\"https://$jira_space.atlassian.net/rest/api/2/status/$issue_id\");\n curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);\n curl_setopt($ch, CURLOPT_USERPWD, \"$jira_user:$jira_token\");\n curl_setopt($ch, CURLOPT_USERAGENT, \"$jira_user\");\n curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\n\n $output=json_decode(curl_exec($ch), TRUE);\n curl_close($ch);\n return $output;\n}", "public function itemissuedetails(){\n\t$sel='ii_id,ii_itemid,ii_mtid,ii_name,ii_qty,ii_desc,ii_staffpfno,ii_staffname,ii_dept,ii_receivername,ii_creatordate';\n\t$whorder='ii_mtid asc,ii_itemid asc';\n\t$data['result'] = $this->picomodel->get_orderlistspficemore('items_issued',$sel,'',$whorder);\n $this->logger->write_logmessage(\"view\",\" View Item List setting\", \"Item List setting details...\");\n\t$this->logger->write_dblogmessage(\"view\",\" View Item List setting\", \"Item List setting details...\");\n $this->load->view('itemaction/displayissueitem',$data);\n }", "public function fetchIssueDetails($issueId) {\n $endpoint = \"issues/\" . intval($issueId);\n return $this->apiClient->get($endpoint);\n }", "private function getIssues()\n {\n\n $issues = [];\n $total_issues = $this->totalIssues();\n if ($this->infos['errorBoolean']) {\n return 0;\n }\n if ($total_issues % 100 !== 0 ) {\n $total_int = intdiv($total_issues, 100) +1;\n }else {\n $total_int = $total_issues/100;\n }\n for ($i=0; $i < $total_int ; $i++) {\n $start = 100*$i;\n $max = 100*($i+1);\n $url = $this->base_uri.'search?jql=project='.$this->project.'&startAt='.$start.'&maxResults='.$max;\n $temp= $this->request($url);\n $issues[] = array(json_decode($temp));\n }\n\n return $issues;\n\n }", "public function lookupIssue($issueId, $request) {\n\n $uri = sprintf('/issues/%d.json', $issueId);\n $ticket = $this->_sendRequest($uri, $request);\n\n if (!$ticket || !isset($ticket->issue)) {\n return;\n }\n\n $this->_showTicket($ticket->issue, $request);\n }", "public function issues(){\n \treturn $this->hasMany('App\\Issue');\n }", "public function getPlaceIssue() {\n return isset($this->rPlaceIssue) ? $this->rPlaceIssue->name : '';\n }", "function customcert_get_issues($customcertid, $groupmode, $cm, $page, $perpage) {\n global $DB;\n\n // Get the conditional SQL.\n list($conditionssql, $conditionsparams) = customcert_get_conditional_issues_sql($cm, $groupmode);\n\n // Add the conditional SQL and the customcertid to form all used parameters.\n $allparams = $conditionsparams + array('customcertid' => $customcertid);\n\n // Return the issues.\n return $DB->get_records_sql(\"SELECT u.*, ci.code, ci.timecreated\n FROM {user} u\n INNER JOIN {customcert_issues} ci\n ON u.id = ci.userid\n WHERE u.deleted = 0\n AND ci.customcertid = :customcertid\n $conditionssql\n ORDER BY \" . $DB->sql_fullname(),\n $allparams,\n $page * $perpage,\n $perpage);\n}", "public function retrieve()\n {\n // TODO: Implement retrieve() method.\n throw new ErrorException('Implement this method.');\n }", "function issueContacts($issue) {\r\n\t\tif($this->userCanViewIssue('', $issue)){\r\n\t\t\t$query = \"select * from contacts where issue = '$issue' order by datecreated desc\";\r\n\t\t\t$result = mysql_query($query);\r\n\t\t\t$return = array();\r\n\t\t\twhile( $row = mysql_fetch_assoc($result) ) {\r\n\t\t\t\tarray_push( $return, $row );\r\n\t\t\t}\r\n\t\t\treturn $return;\r\n\t\t}\r\n\t}", "function getAlertsForSelfAndIssue( $issueid ) {\r\n\t\treturn $this->getAlertsForUserAndIssue( $_SESSION['userid'], $issueid );\r\n\t}", "protected function getIssues()\n\t{\n\t\t$rangeFrom = 0;\n\t\t$rangeTo = 0;\n\n\t\t// Limit issues to process\n\t\t$this->out('GH issues to process? [a]ll / [r]ange :', false);\n\n\t\t$resp = trim($this->in());\n\n\t\tif ($resp == 'r' || $resp == 'range')\n\t\t{\n\t\t\t// Get the first GitHub issue (from)\n\t\t\t$this->out('Enter the first GitHub issue ID to process (from) :', false);\n\t\t\t$rangeFrom = (int) trim($this->in());\n\n\t\t\t// Get the ending GitHub issue (to)\n\t\t\t$this->out('Enter the latest GitHub issue ID to process (to) :', false);\n\t\t\t$rangeTo = (int) trim($this->in());\n\t\t}\n\n\t\t$query = $this->db->getQuery(true);\n\n\t\t$query->select($this->db->quoteName(array('id', 'gh_id')));\n\t\t$query->from($this->db->quoteName('#__issues'));\n\t\t$query->where($this->db->quoteName('gh_id') . ' IS NOT NULL');\n\n\t\t// Issues range selected?\n\t\tif ($rangeTo != 0 && $rangeTo >= $rangeFrom)\n\t\t{\n\t\t\t$query->where($this->db->quoteName('gh_id') . ' >= ' . (int) $rangeFrom);\n\t\t\t$query->where($this->db->quoteName('gh_id') . ' <= ' . (int) $rangeTo);\n\t\t}\n\n\t\t$this->db->setQuery($query);\n\n\t\ttry\n\t\t{\n\t\t\t$this->issues = $this->db->loadObjectList();\n\t\t}\n\t\tcatch (RuntimeException $e)\n\t\t{\n\t\t\t$this->out('Error ' . $e->getCode() . ' - ' . $e->getMessage(), true);\n\t\t\t$this->close();\n\t\t}\n\t}", "public function getIssueTime()\n {\n return $this->issueTime;\n }", "public function getIssue($user, $repo, $number)\n {\n $issue = $this->doAPIRequest(\"GET /repos/$user/$repo/issues/$number\");\n if (!$issue) {\n return false;\n }\n return $this->createEntity(__NAMESPACE__ . '\\Issue', $issue);\n }", "public function findOpenIssues() { \n $q = $this->createQueryBuilder('e')\n ->select('e.eoid as id,e.joid,e.alarm,e.alarmTime,e.state,e.stateTime,e.response,e.theUser,e.eventComment,j.jobName,j.description,j.status')\n ->leftjoin('AriiATSBundle:UjoJobst','j',\\Doctrine\\ORM\\Query\\Expr\\Join::WITH,'e.joid = j.joid')\n ->where('e.state < 45')\n ->orderBy('e.eoid','desc')\n ->setMaxResults(1000)\n ->getQuery();\n return $q->getResult();\n }", "public function getIssuesUrl()\n {\n return $this->issuesUrl;\n }", "public function getIssueDate()\n {\n return $this->issueDate;\n }", "abstract public function GetProblems();", "function issueFinally(){\n $is = Cache::getModel( \"IssueStatus\" );\n \n // If it's new, set status as such\n if( $this->id == 0 ){\n $is->retrieveByClause( \"WHERE code = 'NEW'\" );\n $this->aFields[\"issue_status_id\"]->value = $is->id;\n }\n $is->get( $this->aFields[\"issue_status_id\"]->value );\n $this->aFields[\"active\"]->value = $is->aFields[\"is_archive\"]->value == 1 ? 0 : 1;\n }", "function db_query_roadmap_info($p_project_id, $p_version, $p_version_type, &$p_issues_resolved){\n\t$p_issues_resolved = 0;\n\n\t$t_can_view_private = access_has_project_level(config_get('private_bug_threshold'), $p_project_id);\n\t$t_limit_reporters = config_get('limit_reporters');\n\t$t_user_access_level_is_reporter = (config_get('report_bug_threshold', null, null, $p_project_id) == access_get_project_level($p_project_id));\n\n\t$t_query = 'SELECT id,view_state from {bug} WHERE project_id=' . db_param() . ' AND ' . $p_version_type . '=' . db_param();\n\n\t$t_result = db_query($t_query, array($p_project_id, $p_version));\n\n\t$t_issue_ids = array();\n\n\twhile($t_row = db_fetch_array($t_result)){\n\t\t$t_issue_id = $t_row['id'];\n\n\t\t# hide private bugs if user doesn't have access to view them.\n\t\tif(!$t_can_view_private && ($t_row['view_state'] == VS_PRIVATE))\n\t\t\tcontinue;\n\n\t\t# check limit_Reporter (Issue #4770)\n\t\t# reporters can view just issues they reported\n\t\tif(ON === $t_limit_reporters && $t_user_access_level_is_reporter && !bug_is_user_reporter($t_issue_id, auth_get_current_user_id()))\n\t\t\tcontinue;\n\n\t\tif(!helper_call_custom_function('roadmap_include_issue', array($t_issue_id)))\n\t\t\tcontinue;\n\n\t\t$t_issue_ids[] = $t_issue_id;\n\n\t\tif(bug_is_resolved($t_issue_id))\n\t\t\t$p_issues_resolved++;\n\t}\n\n\treturn $t_issue_ids;\n}", "public function getApiIssuesUrl()\n {\n return $this->apiIssuesUrl;\n }", "function userCanViewIssue( $sessionID, $issueID ) {\r\n\t$arr = str_split($issueID);\r\n\t\tif($issueID == '')\r\n\t\t\treturn FALSE;\r\n\t\telseif($arr[0] != 'I'){\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\t\telse{\r\n\t\t\t$query= \"SELECT Level FROM issues WHERE ID = '$issueID'\";\r\n\t\t\t$result = mysql_query($query);\r\n\t\t\t$value = mysql_fetch_array($result);\r\n\t\t\textract($value);\r\n\t\t\t$query2 = \"SELECT Creator FROM issues WHERE ID = '$issueID'\";\r\n\t\t\t$result2 = mysql_query($query2);\r\n\t\t\t$value2 = mysql_fetch_array($result2);\r\n\t\t\textract($value2);\r\n\t\t\t$query3 = \"SELECT AssignedTo FROM issues WHERE ID = '$issueID'\";\r\n\t\t\t$result3 = mysql_query($query3);\r\n\t\t\t$value3 = mysql_fetch_array($result3);\r\n\t\t\textract($value3);\r\n\t\t\t$userID = $_SESSION['userid'];\r\n\t\t\tif($Level == 'A')\r\n\t\t\t\tif($this->getAccessLevel() > 7 || $this->getAccessLevel() == 5)\r\n\t\t\t\t\treturn TRUE;\r\n\t\t\t\telseif($Creator == $userID)\r\n\t\t\t\t\treturn TRUE;\r\n\t\t\t\telseif($AssignedTo == $userID)\r\n\t\t\t\t\treturn TRUE;\r\n\t\t\t\telse\r\n\t\t\t\t\treturn FALSE;\r\n\t\t\telseif($Level == 'B')\t\r\n\t\t\t\treturn $this->getAccessLevel() > 3;\r\n\t\t\telse\r\n\t\t\t\treturn FALSE;\r\n\t\t}\r\n\t}", "public function getIssueEndpointUrl(IssueWrapper $issue)\n {\n\n }", "public function getAllIssueTypes()\n { \n $this->uri = \"/rest/api/\".$this->getApiVersion().\"/issuetype/\";\n $this->method = \"GET\";\n }", "function viewIssue( $sessionID, $issueID ) {\r\n\t\t//@session_start();\r\n\t\tif( $this->userCanViewIssue( $sessionID, $issueID ) ) {\r\n\t\t\t//mysql_selectdb('students');\r\n\t\t\t$query=\"SELECT * FROM issues WHERE ID = '$issueID'\";\r\n\t\t\t$result = mysql_query($query);\r\n\t\t\t$issue = mysql_fetch_array($result);\r\n\t\t\t$query = \"select distinct (studentid) from `contacts-students`\r\n\t\t\t\t where contactid in (\r\n\t\t\t\t \tselect id from contacts where issue='$issueID'\r\n\t\t\t\t )\";\r\n\t\t\t$result = mysql_query($query);\r\n\t\t\t$students = array();\r\n\t\t\t$i=0;\r\n\t\t\twhile( $row = mysql_fetch_row($result) ) {\r\n\t\t\t\t$students[$i] = $row[0];\r\n\t\t\t\t$i++;\r\n\t\t\t}\r\n\t\t\t$students = implode(',',$students);\r\n\t\t\t$query = \"select distinct (userid) from `contacts-users` where contactid in (\r\n\t\t\t\t \tselect id from contacts where issue='$issueID'\r\n\t\t\t\t )\";\r\n\t\t\t$result = mysql_query($query);\r\n\t\t\t$users = array();\r\n\t\t\t$i=0;\r\n\t\t\twhile( $row = mysql_fetch_row($result) ) {\r\n\t\t\t\t$users[$i] = $row[0];\r\n\t\t\t\t$i++;\r\n\t\t\t}\r\n\t\t\t$users = implode(',',$users);\r\n\t\t\t$issue['Students'] = $students;\r\n\t\t\t$issue['Staff'] = $users;\r\n\t\t\treturn $issue;\r\n\t\t}\r\n\t}", "public function issues()\n {\n return $this->hasMany( Issue::class );\n }", "public function currentAction()\n {\n $em = $this->getDoctrine()->getManager();\n\n $issue = $em->getRepository('BorrowersIssueBundle:Issue')->findCurrentIssue();\n\n if (!$issue) {\n throw $this->createNotFoundException('Unable to find Issue entity.');\n }\n\n return array('issue' => $issue,);\n }", "function getList($issue_id)\n {\n $issue_id = Misc::escapeInteger($issue_id);\n $usr_id = Auth::getUserID();\n $prj_id = Issue::getProjectID($issue_id);\n\n $stmt = \"SELECT\n iat_id,\n iat_usr_id,\n usr_full_name,\n iat_created_date,\n iat_description,\n iat_unknown_user,\n iat_status\n FROM\n \" . APP_DEFAULT_DB . \".\" . APP_TABLE_PREFIX . \"issue_attachment,\n \" . APP_DEFAULT_DB . \".\" . APP_TABLE_PREFIX . \"user\n WHERE\n iat_iss_id=$issue_id AND\n iat_usr_id=usr_id\";\n if (User::getRoleByUser($usr_id, $prj_id) <= User::getRoleID('Customer')) {\n $stmt .= \" AND iat_status='public' \";\n }\n $stmt .= \"\n ORDER BY\n iat_created_date 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 }\n\n foreach ($res as &$row) {\n $row[\"iat_description\"] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($row[\"iat_description\"])));\n $row[\"files\"] = self::getFileList($row[\"iat_id\"]);\n $row[\"iat_created_date\"] = Date_Helper::getFormattedDate($row[\"iat_created_date\"]);\n\n // if there is an unknown user, user that instead of the user_full_name\n if (!empty($row[\"iat_unknown_user\"])) {\n $row[\"usr_full_name\"] = $row[\"iat_unknown_user\"];\n }\n }\n return $res;\n }", "function get_ticket(){\r\n\t\tglobal $EM_Ticket;\r\n\t\tif( is_object($this->ticket) && get_class($this->ticket)=='EM_Ticket' && $this->ticket->id == $this->ticket_id ){\r\n\t\t\treturn $this->ticket;\r\n\t\t}elseif( is_object($EM_Ticket) && $EM_Ticket->id == $this->ticket_id ){\r\n\t\t\t$this->ticket = $EM_Ticket;\r\n\t\t}else{\r\n\t\t\t$this->ticket = new EM_Ticket($this->ticket_id);\r\n\t\t}\r\n\t\treturn $this->ticket;\r\n\t}", "function getPendingIssues() {\n\t\t$i = $this->_query->join('synd_issue','i');\n\t\t$query = clone $this->_query;\n\n\t\t$query->where(\"$i.info_status >= 0 AND $i.info_status < \".synd_node_issue::CLOSED);\n\t\t\n\t\t$query->column($this->_grouping->getResolveByKey($this, $query), 'PK');\n\t\t$query->column(\"COUNT(DISTINCT $i.node_id)\", 'ISSUES');\n\t\t$query->groupBy($this->_grouping->getResolveByKey($this, $query));\n\t\t\n\t\t$sql = $query->toString();\n\t\t$rows = $this->_db->getAssoc($sql);\n\t\treturn $this->_grouping->filter($rows);\n\t}", "function fetchIssues($project, $statuses){\n\n // default project\n $project = (isset($project)) ? $project : 'DEVOPS' ;\n\n // default statuses to fetch\n $defaultStatuses = array(\n 'Backlog' => 'Backlog',\n 'In Progress' => 'In Progress',\n 'Done' => 'Done'\n );\n\n // default statuses\n $statuses = (isset($statuses)) ? $statuses : $defaultStatuses ;\n\n // initialize list of issues\n $list = [];\n\n // walk through statuses\n foreach ($statuses as $key => $status) {\n\n // define the JIRA JQL\n $jql = 'project = '.$project.' AND status = \"'.$status.'\" ORDER BY updated ASC';\n\n try {\n $issueService = new IssueService();\n\n // fetch issues\n $response = $issueService->search($jql);\n\n\n // issues walker\n foreach ($response->issues as $issue) {\n\n // get epic link\n if (isset($issue->fields->customFields['customfield_10008'])) {\n $jql = 'issue = '.$issue->fields->customFields['customfield_10008'];\n $issueService = new issueService();\n $response = $issueService->search($jql);\n $epicLink = $response->issues[0]->fields->summary;\n }\n\n // define details\n $issueDetails = array(\n \"key\" => $issue->key,\n \"summary\" => $issue->fields->summary,\n \"type\" => $issue->fields->issuetype->name,\n \"epiclink\" => $epicLink,\n // \"date\" => $issue->fields->duedate->format('Y-m-d H:i:s')\n );\n\n // push the issue details to the list\n $list[$status][] = $issueDetails;\n\n }\n\n } catch (JiraException $e) {\n $this->assertTrue(false, 'Query Failed : '.$e->getMessage());\n }\n }\n\n // return the list\n return $list;\n}", "public function edit($id)\n\t{\n\t\t$issue = Issue::find($id);\n\t\tif ($issue == NULL) {\n\t\t\treturn 'ID buku invalid';\n\t\t}\n\n\t\t$book = Books::find($issue->book_id);\n\n\t\t$issue->book_name = $book->title;\n\t\t$issue->author = $book->author;\n\n\t\t$issue->category = Categories::find($book->category_id)\n\t\t\t->category;\n\n\t\t$issue->available_status = (bool)$issue->available_status;\n\t\tif ($issue->available_status == 1) {\n\t\t\treturn $issue;\n\t\t}\n\n\t\t$conditions = array(\n\t\t\t'return_time'\t=> 0,\n\t\t\t'book_issue_id'\t=> $id,\n\t\t);\n\t\t$book_issue_log = Logs::where($conditions)\n\t\t\t->take(1)\n\t\t\t->get();\n\n\t\tforeach ($book_issue_log as $log) {\n\t\t\t$student_id = $log->student_id;\n\t\t}\n\n\t\t$student_data = Student::find($student_id);\n\n\t\tunset($student_data->email_id);\n\t\tunset($student_data->books_issued);\n\t\tunset($student_data->approved);\n\t\tunset($student_data->rejected);\n\n\t\t$student_branch = Branch::find($student_data->branch)\n\t\t\t->branch;\n\t\t$roll_num = $student_data->roll_num . '/' . $student_branch . '/' . substr($student_data->year, 2, 4);\n\n\t\tunset($student_data->roll_num);\n\t\tunset($student_data->branch);\n\t\tunset($student_data->year);\n\n\t\t$student_data->roll_num = $roll_num;\n\n\t\t$student_data->category = StudentCategories::find($student_data->category)\n\t\t\t->category;\n\t\t$issue->student = $student_data;\n\n\n\t\treturn $issue;\n\t}", "public function actionIssue() {\n $model = new LibraryMagazineIssue();\n if ($model->load(Yii::$app->request->post()) && $model->validate()) {\n Yii::$app->db->createCommand(\"UPDATE library_magazine_subscription_master SET Magazine_Status = 3 WHERE Magazine_Subscription_Id = \" . $model->Magazine_Id)->execute();\n $model->save();\n return $this->redirect(['create']);\n } else {\n return $this->render('create', [\n 'model' => $model,\n ]);\n }\n }", "function issue_prepare_brief_view_vars($issue = null) {\n\t$fields = array(\n 'Title' => $issue->title,\n 'Description' => $issue->description,\n 'Status' => $issue->status,\n 'Issue #' => $issue->number,\n 'Asset' => get_entity($issue->asset)->title,\n 'Tags' => $issue->tags,\n\t);\n\n\tif ($issue) {\n\t\tforeach (array_keys($fields) as $field) {\n\t\t\tif (isset($issue->$field)) {\n\t\t\t\t$values[$field] = $issue->$field;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (elgg_is_sticky_form('jot')) {\n\t\t$sticky_values = elgg_get_sticky_values('jot');\n\t\tforeach ($sticky_values as $key => $value) {\n\t\t\t$fields[$key] = $value;\n\t\t}\n\t}\n\n\telgg_clear_sticky_form('jot');\n\n\treturn $fields;\n}", "function getRedeemedIncidentDetails($prj_id, $issue_id)\n {\n $types = self::getIncidentTypes($prj_id);\n $data = array();\n foreach ($types as $id => $title) {\n if (self::isRedeemedIncident($prj_id, $issue_id, $id)) {\n $data[$id] = array(\n 'title' => $title,\n 'is_redeemed' => 1\n );\n }\n }\n return $data;\n }", "public function stk_issue() {\n try {\n $avl_items = $this->get_items(1);\n $issue_view = view('/tabs/issue')->render();\n\n return response()->json([\"issue_view\" => $issue_view, \"items\" => $avl_items]);\n }\n catch (Throwable $exc) {\n return response($exc->getMessage(), 500);\n }\n }", "function simplenews_admin_issues_validate($form, &$form_state) {\n if (isset($form_state['input']['operation'])) {\n $nids = array_keys(array_filter($form_state['input']['issues']));\n if (empty($nids)) {\n form_set_error('', t('No items selected.'));\n }\n }\n}", "public function get_issue_file(stdClass $issuecert) {\n if (!empty($issuecert->haschange)) {\n return $this->save_pdf($issuecert);\n }\n\n if (!$this->issue_file_exists($issuecert)) {\n return false;\n }\n\n $fs = get_file_storage();\n return $fs->get_file_by_hash($issuecert->pathnamehash);\n }", "private function _get_issues( $project ) {\n\n\t\tif ( ! empty( $project['_links']['issues'] ) ) {\n\n\t\t\t$issues_link = $project['_links']['issues'];\n\n\t\t\t$request = new Gitlab();\n\t\t\t$gitlab = $request->init_request();\n\n\t\t\t$issues = [];\n\t\t\t$page_index = 1;\n\t\t\t$total = 0;\n\n\t\t\tdo {\n\n\t\t\t\t$response = $gitlab->get( \"$issues_link?per_page=50&page=$page_index&sort=asc\" );\n\t\t\t\t$response_arr = json_decode( $response->body, true );\n\n\t\t\t\t$issues = array_merge( $issues, $response_arr );\n\n\t\t\t\t$page_index ++;\n\t\t\t\t$total += count( $response_arr );\n\n\t\t\t} while ( count( $response_arr ) > 0 );\n\n\t\t\treturn $issues;\n\n\t\t}\n\n\t}", "public function getIssues($type = null)\n {\n return $type ? (isset($this->issues[$type]) ? $this->issues[$type] : array()) : $this->issues;\n }", "function userCanGetUserIssues( $userid ) {\r\n\t\treturn $this->userCanViewUser('',$userid);\r\n\t}", "public function details() {\n try {\n $details = $this->operationsModel->details($_POST['bugId']);\n if($details) {\n $this->response($details,200,'Success');\n } else {\n $this->response('',204,'Error');\n }\n } catch(Exception $ex) {\n $this->response('',500,'Error');\n } \n }", "public function index()\n {\n dd(Issue::get()->where('state','Unprocessed')->take(20));\n }", "public function getAssignedIssues()\n {\n return $this->assignedIssues;\n }", "function otherUserCanViewIssue( $user, $issueID ) {\r\n\t\t$query= \"SELECT Level FROM issues WHERE ID = '$issueID'\";\r\n\t\t$result = mysql_query($query);\r\n\t\t$value = mysql_fetch_array($result);\r\n\t\textract($value);\r\n\t\t$query2 = \"SELECT Creator FROM issues WHERE ID = '$issueID'\";\r\n\t\t$result2 = mysql_query($query2);\r\n\t\t$value2 = mysql_fetch_array($result2);\r\n\t\textract($value2);\r\n\t\t$userID = $_SESSION['userid'];\r\n\t\tif($Level == 'A')\r\n\t\t\tif($this->getUserAccessLevel($user) > 7 || $this->getUserAccessLevel($user) == 5)\r\n\t\t\t\treturn TRUE;\r\n\t\t\telseif($Creator == $userID)\r\n\t\t\t\treturn TRUE;\r\n\t\t\telse\r\n\t\t\t\treturn FALSE;\r\n\t\telseif($Level == 'B')\t\r\n\t\t\treturn $this->getUserAccessLevel($user) > 3;\r\n\t\telse\r\n\t\t\treturn FALSE;\r\n\t}", "public function addIssue($singleIssue)\r\n {\r\n \t//IF Issue already exist into our DB then update record\r\n \tif($this->issueModel->isExistIssue($singleIssue['id']))\r\n \t{\r\n \t\t$this->issueModel->updateExistingIssue($singleIssue);\r\n \t}\r\n \telse\r\n \t{\r\n \t\t//IF Issue not exist then add new Issue\r\n \t\t$this->issueModel->addNewIssue($singleIssue);\r\n \t}\r\n }", "public function issues(): HasMany\n {\n return $this->hasMany(Issue::class, 'tracker_id');\n }", "public function asIssue()\n\t{\n\t\t$this->severity = 'error';\n\t\t$this->cannotClose();\n\t\treturn $this;\n\t}", "public function getOpenAssignedToMe () {\r\n\t\t$db = new DB();\r\n\t\t$db->connect();\r\n\t\t\r\n\t\t$openstatusTest = \"\";\r\n\t\t$openStatus = \"SELECT * FROM `status` WHERE isDone = 0 AND active != 0\";\r\n\t\t$openQuery = $db->query($openStatus);\r\n\t\twhile ($oneStatus = $openQuery->fetch_assoc()) {\r\n\t\t\tif ($openstatusTest == \"\") {\r\n\t\t\t\t$openstatusTest = $oneStatus[\"id\"];\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$openstatusTest = $openstatusTest . \", \" . $oneStatus[\"id\"];\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t$sql = \"SELECT task.id, task.summary, project.key, `status`.color, `status`.name AS status FROM task \r\n\t\t\t\t\tINNER JOIN project ON project.id = task.project_id\r\n\t\t\t\t\tINNER JOIN `status` ON `status`.id = task.status_id\t\t\r\n\t\t\t\tWHERE status_id IN ($openstatusTest) AND task.active !=0 AND assignee_id = \" . $_SESSION['nobug'.RANDOMKEY.'userId'] . \"\r\n\t\t\t\tORDER BY project.name, task.id DESC \r\n\t\t\t\tLIMIT 10\";\r\n\t\treturn $db->query($sql);\r\n\t}", "public function getIssues()\n {\n $issues = array();\n\n foreach ($this->manager->getBoard($this->boardId)->getLists() as $list) {\n $issues = array_merge($issues, $list->getCards());\n }\n\n return array_map(array($this, 'getIssueId'), $issues);\n\n }", "public function getTicketDetailsById() {\n if (func_num_args() > 0):\n $tid = func_get_arg(0);\n $select = $this->select()\n ->from($this)\n ->where('ticket_id=?', $tid);\n $result = $this->getAdapter()->fetchRow($select);\n\n if ($result) :\n return $result;\n endif;\n else:\n throw new Exception('Argument Not Passed');\n endif;\n }", "function deleteIssue($args, $request) {\n\t\t$issueId = (int) $request->getUserVar('issueId');\n\t\t$journal = $request->getJournal();\n\t\t$issueDao = DAORegistry::getDAO('IssueDAO');\n\t\t$issue = $issueDao->getById($issueId, $journal->getId());\n\t\tif (!$issue) fatalError('Invalid issue ID!');\n\n\t\t$isBackIssue = $issue->getPublished() > 0 ? true: false;\n\n\t\t// remove all published articles and return original articles to editing queue\n\t\t$articleDao = DAORegistry::getDAO('ArticleDAO');\n\t\t$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');\n\t\t$publishedArticles = $publishedArticleDao->getPublishedArticles($issueId);\n\t\tif (isset($publishedArticles) && !empty($publishedArticles)) {\n\t\t\t// Insert article tombstone if the issue is published\n\t\t\timport('classes.article.ArticleTombstoneManager');\n\t\t\t$articleTombstoneManager = new ArticleTombstoneManager();\n\t\t\tforeach ($publishedArticles as $article) {\n\t\t\t\tif ($isBackIssue) {\n\t\t\t\t\t$articleTombstoneManager->insertArticleTombstone($article, $journal);\n\t\t\t\t}\n\t\t\t\t$articleDao->changeStatus($article->getId(), STATUS_QUEUED);\n\t\t\t\t$publishedArticleDao->deletePublishedArticleById($article->getPublishedArticleId());\n\t\t\t}\n\t\t}\n\n\t\t$issueDao->deleteObject($issue);\n\t\tif ($issue->getCurrent()) {\n\t\t\t$issues = $issueDao->getPublishedIssues($journal->getId());\n\t\t\tif (!$issues->eof()) {\n\t\t\t\t$issue = $issues->next();\n\t\t\t\t$issue->setCurrent(1);\n\t\t\t\t$issueDao->updateObject($issue);\n\t\t\t}\n\t\t}\n\n\t\treturn DAO::getDataChangedEvent($issueId);\n\t}", "public function toIssue($options = array())\r\n\t{\r\n $this->db->select(\"$this->table.id\")\r\n ->select(\"\r\n SUM(\r\n CASE\r\n WHEN t_approval.status = 1\r\n THEN 1\r\n ELSE 0\r\n END ) as sum_status,\r\n \", false)\r\n ->select(\"COUNT( t_approval.id ) as count_approval\", false)\r\n ->from($this->table)\r\n ->join('t_approval', \"t_approval.data_id = {$this->table}.id\")\r\n ->join('m_approval', \"m_approval.id = t_approval.m_approval_id\")\r\n ->where('m_approval.module_kode', $this::module_kode)\r\n ->where(\"$this->table.issued\", 0)\r\n ->group_by(\"$this->table.id\")\r\n ->having(\"sum_status > 0\")\r\n ->having(\"count_approval > 0\")\r\n ->having(\"sum_status >= count_approval\");\r\n $inner_sql = $this->db->get_compiled_select();\r\n\r\n $this->db->reset_query();\r\n\r\n\t\tif (isset($options['limit'])) {\r\n\t $this->db->limit($options['limit']);\r\n\t }\r\n\r\n\t if (isset($options['offset'])) {\r\n\t $this->db->offset($options['offset']);\r\n\t }\r\n\r\n\t if (isset($options['orderBy'])) {\r\n\t $this->db->order_by($options['orderBy']);\r\n\t }\r\n\r\n $res = $this->db->select(\"source.*\")\r\n ->from(\"$this->table as source\")\r\n ->join('( '.$inner_sql.' ) as selected', 'source.id = selected.id', '', false)\r\n\t\t\t->get();\r\n\r\n if (isset($options['resource']) && $options['resource'] == true) {\r\n return $res;\r\n }\r\n\r\n return $res->result();\r\n\t}", "function _getPublishedIssues($issueIds, $context) {\n\t\t$publishedIssues = array();\n\t\t$issueDao = DAORegistry::getDAO('IssueDAO');\n\t\tforeach ($issueIds as $issueId) {\n\t\t\t$publishedIssue = $issueDao->getById($issueId, $context->getId());\n\t\t\tif ($publishedIssue) $publishedIssues[] = $publishedIssue;\n\t\t}\n\t\treturn $publishedIssues;\n\t}", "public function setIssueOfComponent(string $issueOfComponent) {\n $this->issueOfComponent = $issueOfComponent;\n return $this;\n }", "public function testInvalidGet() {\n\t\t//send the get request to the API\n\t\t$response = $this->guzzle->get('https://bootcamp-coders.cnm.edu/~bbrown52/bread-basket/public_html/php/api/organization/' . BreadBasketTest::INVALID_KEY, [\n\t\t\t\t'headers' => ['X-XSRF-TOKEN' => $this->token]\n\t\t]);\n\t\t$body = $response->getBody();\n\t\t$retrievedOrg = json_decode($body);\n\t\t$retrievedOrg = get_object_vars($retrievedOrg);\n\n\t\t//assert that there is no data object in the response\n\t\t$this->assertArrayNotHasKey('data', $retrievedOrg);\n\t}", "function getReceivedIssues() {\n\t\t$i = $this->_query->join('synd_issue','i');\n\t\t$query = clone $this->_query;\n\n\t\t$query->column($this->_grouping->getReceivedKey($this, $query), 'PK');\n\t\t$query->column(\"COUNT(DISTINCT $i.node_id)\", 'ISSUES');\n\t\t$query->groupBy($this->_grouping->getReceivedKey($this, $query));\n\t\t\n\t\t$sql = $query->toString();\n\t\t$rows = $this->_db->getAssoc($sql);\n\t\treturn $this->_grouping->filter($rows);\n\t}", "public function getIssueTypeById($issueTypeId)\n { \n $this->uri = \"/rest/api/\".$this->getApiVersion().\"/issuetype/\".$issueTypeId;\n $this->method = \"GET\";\n }", "public function getTicketDetailsEmailTemplate($completeIssueData, $webHookData) {\n// // Getting the Issue Data fromth Curl\n// $username = base64_decode(JIRA_USER_NAME);\n// $password = base64_decode(JIRA_USER_PWD);\n// $url = API_BASE_URL . 'issue/WPR-1036?expand=changelog';\n// $ch = curl_init();\n// curl_setopt($ch, CURLOPT_URL, $url);\n// curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n// curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);\n// curl_setopt($ch, CURLOPT_USERPWD, $username . \":\" . $password);\n// curl_setopt($ch, CURLOPT_HEADER, 0);\n//\n// $result = curl_exec($ch);\n// $ch_error = curl_error($ch);\n// curl_close($ch);\n// $completeIssueData = json_decode(trim($result), true);\n// App::pre($completeIssueData);\n\n $requesterName = $completeIssueData['fields']['customfield_11020']; // Requester Name\n $requesterEmail = $completeIssueData['fields']['customfield_11018']; // Requester Email \n $assigneeName = $completeIssueData['fields']['assignee']['name']; // Assignee Name \n $assigneeEmail = $completeIssueData['fields']['assignee']['emailAddress']; // Assignee Email\n// $ActivityLog = $completeIssueData['changelog']['histories'][0]['items'];\n// $logFiledArr = Utility::arrayColumnFind($ActivityLog, 'field');\n// $key = array_search('status', $logFiledArr);\n $summary = $completeIssueData['fields']['summary'];\n if($webHookData == 'jira:issue_created'){\n $status = $completeIssueData['fields']['status']['name'];\n \n }else{\n $status = $completeIssueData['fields']['status']['name'];\n }\n $priority = $completeIssueData['fields']['priority']['name'];\n $taskDesc = $completeIssueData['fields']['description'];\n $attachments = $completeIssueData['fields']['attachment'];\n if($completeIssueData['fields']['customfield_11021'] != ''){ \n $addReqEmails = explode(',', $completeIssueData['fields']['customfield_11021']);\n $AdditionalCCs = '';\n foreach ($addReqEmails as $email) {\n $AdditionalCCs .= $this->getActiveEmailLink($email); \n }\n// $AdditionalCCs = $completeIssueData['fields']['customfield_11021'];\n }else{\n $AdditionalCCs = 'NA'; \n \n } \n\n $rowStyle = 'style=\"background-color: #fff;\"';\n $colStyleHead = 'style=\"vertical-align: top; padding: 5px; font-weight: bold\"';\n $colStyleValue = 'style=\"vertical-align: top; padding: 5px;\"';\n $body = '<table style=\"margin-left:10px; margin-top: 10px; font-size: 14px; background-color: #ddd;\">\n <tr ' . $rowStyle . '><td ' . $colStyleHead . '>Subject: </td><td ' . $colStyleValue . '>' . $summary . '</td></tr>\n <tr ' . $rowStyle . '><td ' . $colStyleHead . '>Service Type: </td><td ' . $colStyleValue . '> ' . $completeIssueData['fields']['issuetype']['name'] . '</td></tr>\n <tr ' . $rowStyle . '><td ' . $colStyleHead . '>Severity: </td><td ' . $colStyleValue . '> ' . $priority . '</td></tr>\n <tr ' . $rowStyle . '><td ' . $colStyleHead . '>Description: </td><td ' . $colStyleValue . '>' . htmlspecialchars_decode(nl2br($taskDesc)) . '</td></tr>\n <tr ' . $rowStyle . '><td ' . $colStyleHead . '>Status: </td><td ' . $colStyleValue . '>' . $status . '</td></tr>';\n \n if(isset($completeIssueData['fields']['resolution']['name']) && $completeIssueData['fields']['resolution']['name'] !=''){\n $resolution = $completeIssueData['fields']['resolution']['name'];\n \n }else{\n $resolution = 'NA';\n }\n $body.='<tr ' . $rowStyle . '><td ' . $colStyleHead . '>Resolution: </td><td ' . $colStyleValue . '>' . $resolution . '</td></tr>';\n $body.='<tr ' . $rowStyle . '><td ' . $colStyleHead . '>Requester Name: </td><td ' . $colStyleValue . '>' . $requesterName . '</td></tr>\n <tr ' . $rowStyle . '><td ' . $colStyleHead . '>Requester Email: </td><td ' . $colStyleValue . '>' . $this->getActiveEmailLink($requesterEmail) . '</td></tr>\n <tr ' . $rowStyle . '><td ' . $colStyleHead . '>Additional CC\\'s: </td><td ' . $colStyleValue . '> ' . $AdditionalCCs. ' </td></tr>';\n \n if ( $webHookData == 'jira:issue_created' && !empty($attachments)) {\n $downloadLinks = '';\n foreach ($attachments as $index => $attachment) {\n $attachement = $attachment['content'];\n $fileExp = explode('.', basename($attachement));\n $fileNameTrim = substr($fileExp[0], 0, 10).'...'.substr($fileExp[0], -10).'.'.$fileExp[1];\n $downloadLinks .= '<div><a style=\"color:#000;\" target=\"_blank\" href=\"'.SITE_URL.'support/index/downloadJiraAttachments?file='. base64_encode($attachement) .'\" title=\"' .basename($attachement). '\" >'.$fileNameTrim.'</a></div>';\n }\n $body .= '<tr ' . $rowStyle . '><td ' . $colStyleHead . '>Attachments: </td><td ' . $colStyleValue . '>' . $downloadLinks . '</td></tr>';\n }\n $body .= '</table>';\n\n $body .= '<br/><p>Should you have any questions or issues with accessing the support page, please contact your System Administrator as '.$this->getActiveEmailLink('[email protected]').'. </p>';\n\n $body .= '<p>Thank you,<br />Incipio Development <br /> '. $this->getActiveEmailLink('[email protected]').'</p>';\n// print_r($body);\n return $body;\n }", "function getAlertsForUserAndIssue( $userid, $issueid ) {\r\n\t\t$return = array();\r\n\t\t$query=\"select * from issuealert where userid='$userid' and issueid='$issueid'\";\r\n\t\t$result=mysql_query($query);\r\n\t\twhile( $row = mysql_fetch_assoc($result) ) {\r\n\t\t\t$return[$i] = $row;\r\n\t\t\t$i++;\r\n\t\t\t$norows = false;\r\n\t\t}\r\n\t\treturn $return;\r\n\t}", "function issuePublishedtoManagement($id) {\n $issue = $this->issue->get($id);\n $owner = $this->user->getUser($issue['issue_owner']);\n $audit = $this->audit->get($issue['audit']);\n $sql = \"SELECT * FROM `response_due` WHERE `issue` = $id AND `recipient` = 'management' ORDER BY `id` DESC LIMIT 1\";\n $response_date = $this->db->query($sql)->row_array();\n $to = $owner['username'];\n $url = base_url(\"index.php/Audit/issue/\" . $issue['id']);\n $link = \"<a href='\" . $url . \"'>Link</a>\";\n $subject = 'New Audit Issue Has Been Published';\n $message = \"Dear \" . $owner['names'] . \", <br>\n <br>\n The issue <strong>\" . $issue['title'] . \"</strong> has been published to management \n under the audit <strong>\" . $audit['audit_name'] . \"</strong> and has been assigned to you as the issue owner. <br>\n Kindly add your management comment by <strong>\" . strftime(\"%b-%d-%Y\", strtotime($response_date['respond_by_date'])) . \"</strong> <br>\n Follow this $link to access the system. \n <br>\n <br>\n GRC\";\n $this->add(array(\"username\" => $to, \"url\" => $url, \"subject\" => $subject, \"description\" => $message));\n }", "function sendIssueAlerts( $Issue, $Message ){\r\n\t\t$user = $_SESSION['userid'];\r\n\t\t$query = \"SELECT userid FROM issuewatch WHERE issueid='$Issue' and userid!='$user'\";\r\n\t\t$result = mysql_query($query);\r\n\t\twhile( $row = mysql_fetch_row($result) ) {\r\n\t\t\t$query = \"insert into issuealert (userid, issueid, message) values ('\".$row[0].\"','$Issue','$Message')\";\r\n\t\t\tmysql_query($query);\r\n\t\t\t//mysql_free_result($result);\r\n\t\t}\r\n\t\t$query = \"select assignedto from issues where id='$Issue' and assignedto!='$user'\";\r\n\t\t$result = mysql_query( $query );\r\n\t\twhile( $row = mysql_fetch_row( $result ) ) {\r\n\t\t\t$query = \"insert into issuealert (userid, issueid, message) values ('\".$row[0].\"','$Issue','$Message')\";\r\n\t\t\tmysql_query( $query );\r\n\t\t}\r\n\t}", "public function get($id = null) { \r\n $this->db->select()->from('book_issues');\r\n if ($id != null) {\r\n $this->db->where('book_issues.id', $id);\r\n } else {\r\n $this->db->order_by('book_issues.id');\r\n }\r\n\t\t$this->db->where('book_issues.school_id', $this->school_id);\r\n $query = $this->db->get();\r\n if ($id != null) {\r\n return $query->row_array(); \r\n } else {\r\n return $query->result_array(); \r\n }\r\n }", "public function hasIssue()\n {\n return $this->status === 'message_issues';\n }", "protected function _retrieve()\n {\n /* @var $item TM_Helpmate_Model_Ticket */\n $item = $this->_loadItemById(\n $this->getRequest()->getParam('id')\n );\n $data = $item->getData();\n if ($data['customer_id'] != $this->getApiUser()->getUserId()) {\n throw new Exception(self::RESOURCE_NOT_FOUND);\n }\n $userCollection = Mage::getModel('admin/user')->getCollection();\n $user = $userCollection->getItemById($item->getUserId());\n if ($user) {\n $data['user_name'] = $user->username;\n }\n return $data;\n }", "public function checkTime($project, $issue)\n {\n $response = $this->client->createRequest()\n ->setMethod('get')\n ->setUrl($this->prepareUrl($project, $issue))\n ->addHeaders(['PRIVATE-TOKEN' => $this->token])\n ->send();\n if ($response->isOk) {\n return $response->getData();\n }\n Yii::error(VarDumper::dumpAsString($response));\n return false;\n }", "public function getSubscriptionForIssue( $issue )\n {\n $subscriptionId = $issue[ 'subscription_id' ];\n\n if ( $subscriptionId == null )\n throw new System_Api_Error( System_Api_Error::UnknownSubscription );\n\n return $this->getSubscription( $subscriptionId );\n }", "public function issues()\n {\n return $this->belongsToMany('App\\Issue', 'issue_source');\n }", "function getIssueID($text) {\n preg_match(\"#IC-[0-9]+#\", $text, $matches);\n if (!empty($matches)) {\n return $matches[0];\n }\n return NULL;\n}", "public function getIssuePrefix() : string;", "public function testReportsReferralsGet()\n {\n }", "function getIssueReport( $startdate, $enddate, $datetype, $statusselect, \r\n\t\t\t\t $levelselect, $categoryselect, $userselect, $watched, $modifiedvalue,\r\n\t\t\t\t $createdvalue, $notmodifiedvalue ) {\r\n\t\t\r\n\t\t$userid = $_SESSION['userid'];\r\n\t\t\r\n\t\tif( $datetype == $modifiedvalue ) {\r\n\t\t\t$startdatecondition = \"lastmodified >=\";\r\n\t\t\t$enddatecondition = \"lastmodified <=\";\r\n\t\t\t$and_or = \"and\";\r\n\t\t}\r\n\t\telse if( $datetype == $createdvalue ) {\r\n\t\t\t$startdatecondition = \"datecreated >=\";\r\n\t\t\t$enddatecondition = \"datecreated <=\";\r\n\t\t\t$and_or = \"and\";\r\n\t\t}\r\n\t\telse if( $datetype == $notmodifiedvalue ) {\r\n\t\t\t$startdatecondition = \"lastmodified <\";\r\n\t\t\t$enddatecondition = \"lastmodified >\";\r\n\t\t\t$and_or = \"or\";\r\n\t\t}\r\n\t\t\r\n\t\t$query = \"select ID,\r\n\t\t\t Header,\r\n\t\t\t Status,\r\n\t\t\t Level,\r\n\t\t\t Category,\r\n\t\t\t Creator,\r\n\t\t\t Modifier,\r\n\t\t\t DateCreated,\r\n\t\t\t LastModified,\r\n\t\t\t datediff( now(), LastModified ) as DaysInactive\r\n\t\t from issues where 1\";\r\n\t\tif( $startdate && $enddate )\r\n\t\t\t$query .= \" and (\r\n\t\t\t\t\t $startdatecondition '\".getMySqlDate( $startdate ).\" 00:00:00' $and_or\r\n\t\t\t\t\t $enddatecondition '\".getMySqlDate( $enddate ).\" 23:59:59'\r\n\t\t\t\t\t)\";\r\n\t\telse if( $startdate ) $query .= \" and $startdatecondition '\".getMySqlDate( $startdate ).\" 00:00:00'\";\r\n\t\telse if( $enddate ) $query .= \" and $enddatecondition '\".getMySqlDate( $enddate ).\" 23:59:59'\";\r\n\t\tif( $statusselect ) $query .= \" and status = '$statusselect'\";\r\n\t\tif( $levelselect ) $query .= \" and level = '$levelselect'\";\r\n\t\tif( $categoryselect ) $query .= \" and category = '$categoryselect'\";\r\n\t\tif( $userselect ) $query .= \" and id in\r\n\t\t\t(select c.issue from contacts c, `contacts-users` cu\r\n\t\t\t where c.id = cu.contactid and cu.userid = '$userselect')\r\n\t\t\";\r\n\t\tif( isset($watched) ) $query .= \" and id in\r\n\t\t\t(select issueid from issuewatch where userid = '$userid')\";\r\n\t\t$query .= \" order by datecreated desc\";\r\n\t\t\t\t\r\n\t\t$return = array();\r\n\t\t$result = mysql_query( $query );\r\n\t\twhile( $row = mysql_fetch_assoc( $result ) ) {\r\n\t\t\tarray_push( $return, $row );\r\n\t\t}\r\n\t\t\r\n\t\tforeach( $return as $rowNumber => $row ) {\r\n\t\t\t\r\n\t\t\t// include the user it is assigned to\r\n\t\t\t$query = \"select distinct u.ID,\r\n\t\t\t\t\t concat( u.LastName, ', ', u.FirstName, ' ', u.MiddleIn ) as FullName,\r\n\t\t\t\t\t u.Email\r\n\t\t\t\t from users u, issues i\r\n\t\t\t\t where u.id = i.assignedto and\r\n\t\t\t\t \ti.id = '\".$row['ID'].\"'\r\n\t\t\t\t \";\r\n\t\t\t$result = mysql_query( $query );\r\n\t\t\tif( $assignedTo = mysql_fetch_assoc( $result ) ) {\r\n\t\t\t\t$return[$rowNumber]['AssignedTo'] = $assignedTo;\r\n\t\t\t}\r\n\t\t\telse $return[$rowNumber]['AssignedTo'] = false;\r\n\t\t\t\r\n\t\t\t// include the number of contacts\r\n\t\t\t$query = \"select count(*) as NumContacts from contacts\r\n\t\t\t\t where issue = '\".$row['ID'].\"'\";\r\n\t\t\t$result = mysql_query( $query );\r\n\t\t\tif( $numContactsArray = mysql_fetch_assoc( $result ) ) {\r\n\t\t\t\t$return[$rowNumber]['NumContacts'] = $numContactsArray['NumContacts'];\r\n\t\t\t}\r\n\t\t\telse $return[$rowNumber]['NumContacts'] = false;\r\n\t\t\t\r\n\t\t\t// include all the students associated with the contacts\r\n\t\t\t$query = \"select distinct s.ID,\r\n\t\t\t\t\t concat( s.LAST_NAME, ', ', s.FIRST_NAME, ' ', s.MIDDLE_NAME ) as FullName\r\n\t\t\t\t from X_PNSY_STUDENT s, `contacts-students` cs, contacts c\r\n\t\t\t\t where s.ID = cs.studentid and\r\n\t\t\t\t \tcs.contactid = c.id\r\n\t\t\t\t\tand c.issue = '\".$row['ID'].\"'\r\n\t\t\t\t \";\r\n\t\t\t$studentsArray = array();\r\n\t\t\t$result = mysql_query( $query );\r\n\t\t\twhile( $studentrow = mysql_fetch_assoc( $result) ) {\r\n\t\t\t\tarray_push( $studentsArray, $studentrow );\r\n\t\t\t}\r\n\t\t\t$return[$rowNumber]['Students'] = $studentsArray;\r\n\t\t\t\r\n\t\t\t// include all the users associated with the contacts\r\n\t\t\t$query = \"select distinct u.ID,\r\n\t\t\t\t\t concat( u.LastName, ', ', u.FirstName, ' ', u.MiddleIn ) as FullName,\r\n\t\t\t\t\t u.Email\r\n\t\t\t\t from users u, `contacts-users` cu, contacts c\r\n\t\t\t\t where u.id = cu.userid and\r\n\t\t\t\t \tcu.contactid = c.id\r\n\t\t\t\t\tand c.issue = '\".$row['ID'].\"'\r\n\t\t\t\t \";\r\n\t\t\t$usersArray = array();\r\n\t\t\t$result = mysql_query( $query );\r\n\t\t\t//echo mysql_error();\r\n\t\t\twhile( $userrow = mysql_fetch_assoc( $result) ) {\r\n\t\t\t\tarray_push( $usersArray, $userrow );\r\n\t\t\t}\r\n\t\t\t$return[$rowNumber]['Users'] = $usersArray;\r\n\t\t}\r\n\t\treturn $return;\r\n\t}", "abstract protected function getNotFoundMessage();", "function _project_issue_mailhandler($node, $result, $i, $header, $mailbox) {\n if ($node->type == 'project') {\n if (node_access('create', 'project_issue')) {\n $node->nid = preg_replace('/@.+/', '', $node->nid);\n\n if ($node->nid) {\n /*\n ** Base the new entry on the node it belongs to, this ensures all\n ** values are initially correct.\n */\n $entry = node_load(array('nid' => $node->nid, 'type' => 'project_issue'));\n }\n\n // Possible attributes\n $fields = array(\n 'pid' => t('Project'),\n 'category' => t('Category'),\n 'component' => t('Component'),\n 'priority' => t('Priority'),\n 'rid' => t('Version'),\n 'assigned' => t('Assigned to'),\n 'sid' => t('Status')\n );\n\n /*\n ** Only change the title if it doesn't have the old title in it.\n ** This should prevent the title from changing due to added\n ** prefixes. It may on occasion make false positives, but if\n ** a title change is that minor who cares?\n */\n $entry->title = (strpos($node->title, $entry->title)) ? $entry->title : $node->title;\n\n $entry->teaser = $node->teaser;\n $entry->body = $node->body;\n $entry->uid = $node->uid;\n\n foreach ($fields as $var => $text) {\n $text = strtolower(str_replace(' ', '_', $text));\n if (isset($node->project_issue[$text])) {\n $node->project_issue[$text] = trim($node->project_issue[$text]);\n switch ($var) {\n case 'pid':\n $project = node_load($node->project_issue[$text]);\n if ($project->nid) {\n $entry->project_issue['pid'] = $project->nid;\n }\n break;\n case 'category':\n if (($category = array_search($node->project_issue[$text], project_issue_category(0, 0)))) {\n $entry->project_issue['category'] = $category;\n }\n break;\n case 'priority':\n if (($priority = array_search($node->project_issue[$text], project_issue_priorities()))) {\n $entry->project_issue['priority'] = $priority;\n }\n break;\n case 'rid':\n if ($entry->project_issue['pid'] && ($nid = db_result(db_query(\"SELECT nid FROM {project_release_nodes} WHERE pid = %d AND version = '%s'\", $entry->project_issue['pid'], $node->project_issue[$text]), 0))) {\n $entry->project_issue['rid'] = $nid;\n }\n break;\n case 'assigned':\n if ($user = user_load(array('name' => $node->project_issue[$text]))) {\n $entry->project_issue['assigned'] = $user->uid;\n }\n break;\n case 'sid':\n if (($state = array_search($node->project_issue[$text], project_issue_state()))) {\n $entry->project_issue['sid'] = $state;\n }\n break;\n case 'component':\n if ($entry->project_issue['pid'] && ($project = node_load(array('nid' => $entry->project_issue['pid'], 'type' => 'project_project')))) {\n if ($project && in_array($node->project_issue[$text], $project->project_issue['components'])) {\n $entry->project_issue['component'] = $node->project_issue[$text];\n }\n }\n break;\n }\n }\n }\n\n if (empty($entry->nid)) {\n $entry->sid = variable_get('project_issue_default_state', 1);\n $entry->type = 'project_issue';\n $entry = node_validate($entry, $error);\n $error or ($entry->nid = node_save($entry));\n }\n else {\n $error = project_comment_validate($entry);\n $error or project_comment_save($entry);\n }\n }\n else {\n $error['user'] = t('You are not authorized to access this page.');\n }\n\n if ($error && $mailbox['replies']) {\n // Send the user his errors\n $mailto = mailhandler_get_fromaddress($header, $mailbox);\n $mailfrom = variable_get('site_mail', ini_get('sendmail_from'));\n $headers = array(\n 'X-Mailer' => 'Drupal Project module (http://drupal.org/project/project)',\n );\n\n $body = t('You had some errors in your submission:');\n foreach ($error as $field => $text) {\n $body .= \"\\n * $field: $text\";\n }\n\n drupal_mail('project_issue_mailhandler_error', $mailto, t('E-mail submission to !sn failed - !subj', array('!sn' => variable_get('site_name', 'Drupal'), '!subj' => $header->subject)), $body, $mailfrom, $headers);\n }\n\n // Return a NULL result so mailhandler doesn't save the node using the default methods.\n return NULL;\n }\n else {\n return $node;\n }\n}", "function getIssueComments($issue_id, $jira_user, $jira_token, $jira_space) {\n $ch = curl_init(); \n curl_setopt($ch,CURLOPT_URL,\"https://$jira_space.atlassian.net/rest/api/2/issue/$issue_id/comment\");\n curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);\n curl_setopt($ch, CURLOPT_USERPWD, \"$jira_user:$jira_token\");\n curl_setopt($ch, CURLOPT_USERAGENT, \"$jira_user\");\n curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));\n\n $output=json_decode(curl_exec($ch), TRUE);\n curl_close($ch);\n return $output;\n}", "function otherUserIsWatchingIssue( $user, $issueID ) {\r\n\t\tif(empty($this->link)){\r\n\t\t\techo \"Not connected to database. Unexpected error. Contact your system administrator.\";\r\n\t\t\texit;\t\r\n\t\t}\r\n\t\t$query = \"SELECT issueid FROM issuewatch WHERE userid='$user' and issueid='$issueID'\";\r\n\t\t$result = mysql_query($query);\r\n\t\treturn mysql_num_rows($result) > 0;\r\n\t\t\r\n\t}", "public function get_attempts() {\n global $DB, $USER;\n\n $sql = \"SELECT *\n FROM {simplecertificate_issues} i\n WHERE certificateid = :certificateid\n AND userid = :userid AND timedeleted IS NULL\";\n\n $issues = $DB->get_records_sql($sql, array('certificateid' => $this->get_instance()->id, 'userid' => $USER->id));\n if ($issues) {\n return $issues;\n }\n\n return false;\n }" ]
[ "0.67779756", "0.6369414", "0.62817484", "0.62589604", "0.62067497", "0.61993986", "0.603089", "0.6002856", "0.59815305", "0.5954161", "0.5943392", "0.5879769", "0.58533907", "0.5843892", "0.5843892", "0.5804655", "0.5765111", "0.575617", "0.562193", "0.5614684", "0.5585258", "0.5569441", "0.55649257", "0.5537893", "0.5485012", "0.545261", "0.54480755", "0.5417274", "0.541372", "0.5405049", "0.5392192", "0.53812474", "0.536265", "0.5335546", "0.53325987", "0.53318477", "0.53181756", "0.53100604", "0.5300681", "0.5299441", "0.52942073", "0.5287525", "0.5281551", "0.5272858", "0.5256189", "0.5245771", "0.5243537", "0.52336913", "0.5209855", "0.51849335", "0.5180088", "0.51549613", "0.5150329", "0.51078135", "0.51030535", "0.5100637", "0.5080984", "0.50766", "0.5066488", "0.50136936", "0.50097317", "0.49987653", "0.49877948", "0.49868372", "0.49855804", "0.49844527", "0.49817944", "0.49783278", "0.49710578", "0.49700996", "0.49692956", "0.49692702", "0.4964912", "0.4963112", "0.49618706", "0.49548483", "0.4950432", "0.49443418", "0.49435788", "0.4938924", "0.49308982", "0.4930147", "0.49189073", "0.49125966", "0.49017903", "0.48990142", "0.4891463", "0.48868", "0.48783773", "0.48782083", "0.48681545", "0.48596716", "0.4854372", "0.48461118", "0.4833351", "0.48224163", "0.48219037", "0.48147488", "0.48101634", "0.48074672" ]
0.6213415
4
Get the total of issues currently imported by retrieveAllIssues() This may be an estimated number
public function getTotalIssuesBeingImported() { return $this->total; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function totalIssues()\n {\n $url = $this->base_uri.'search?jql=project='.$this->project.'&startAt=0&maxResults=0';\n $issues = $this->request($url);\n if (!$this->infos['errorBoolean']) {\n return json_decode($issues)->total;\n }\n }", "protected function getTotal()\n {\n $total = 0;\n foreach ($this->entries as $entry) {\n $total += $entry['price'] * $entry['quantity'];\n }\n\n return $total;\n }", "public function total(): int\n {\n return count($this->all());\n }", "public function getTotal(): int\n {\n if (isset($this->contents)) {\n return count($this->contents);\n }\n\n return 0;\n }", "public function getTotal() : int\n {\n return $this->total;\n }", "public function getTotalEntries()\n {\n return $this->totalEntries;\n }", "public function getTotal():int{\r\n\t return (int)$this->_vars['total_items']??0;\r\n\t}", "public function getTotalEstimated() {\n\t\t$total = 0;\n\t\t$this->costitem->get();\n\t\tforeach($this->costitem->all as $item) {\n\t\t\tif ($item->item_type == 'price') {\n\t\t\t\t$total += $item->amount;\n\t\t\t}\n\t\t}\n\t\treturn $total;\n\t\t\n\t}", "function getTotal() {\n\t\tif (empty($this->_total)) {\n\t\t\t$query = $this->_buildQuery();\n\t\t\t$this->_total = $this->_getListCount($query);\n\t\t}\n\n\t\treturn $this->_total;\n\t}", "public function getTotal()\n\t{\n\t\t// Lets load the 'pending' records of the view instead of the existing records list\n\t\tif ($this->_pending)\n\t\t{\n\t\t\tif ($this->_total_pending === null)\n\t\t\t{\n\t\t\t\t$query = $this->_buildQuery();\n\n\t\t\t\tif ($query === false)\n\t\t\t\t{\n\t\t\t\t\treturn $this->_total_pending = 0;\n\t\t\t\t}\n\n\t\t\t\t$this->_getList($query, 0, 1);\n\t\t\t\t$this->_db->setQuery(\"SELECT FOUND_ROWS()\");\n\t\t\t\t$this->_total_pending = $this->_db->loadResult();\n\t\t\t}\n\n\t\t\treturn $this->_total_pending;\n\t\t}\n\n\t\t// Lets load the records if it doesn't already exist\n\t\telseif ($this->_total === null)\n\t\t{\n\t\t\t$query = $this->_buildQuery();\n\n\t\t\tif ($query === false)\n\t\t\t{\n\t\t\t\treturn $this->_total = 0;\n\t\t\t}\n\n\t\t\t$this->_getList($query, 0, 1);\n\t\t\t$this->_db->setQuery(\"SELECT FOUND_ROWS()\");\n\t\t\t$this->_total = $this->_db->loadResult();\n\t\t}\n\n\t\treturn $this->_total;\n\t}", "function getTotal() {\r\n\t\tif (empty ( $this->_total )) {\r\n\t\t\t$query = $this->_buildQuery ();\r\n\t\t\t$this->_total = $this->_getListCount ( $query );\r\n\t\t}\r\n\t\treturn $this->_total;\r\n\t}", "public function getTotalInquiries()\n {\n $AdminDashboardModel = $this->model('AdminDashboardModel');\n $this->totalInquiries = $AdminDashboardModel->getTotalInquiries();\n }", "public function getTotal() {\n\t\treturn $this->find('count', array(\n\t\t\t'contain' => false,\n\t\t\t'recursive' => false,\n\t\t\t'cache' => $this->alias . '::' . __FUNCTION__,\n\t\t\t'cacheExpires' => '+24 hours'\n\t\t));\n\t}", "public static function totalNumber()\n {\n return (int)self::find()->count();\n }", "function getTotal()\n\t{\n\t\tif (empty($this->_total)) {\n\t\t\t$query = $this->_buildQuery();\n\t\t\t$this->_total = $this->_getListCount($query); \n\t\t}\n\t\treturn $this->_total;\n\t}", "function getTotal()\n\t{\n\t\tif (empty($this->_total)) {\n\t\t\t$query = $this->_buildQuery();\n\t\t\t$this->_total = $this->_getListCount($query);\n\t\t}\n\t\treturn $this->_total;\n\t}", "function getTotal()\r\n{\r\n if (empty($this->_total))\r\n {\r\n $query = $this->_buildQuery();\r\n $this->_total = $this->_getListCount($query);\r\n }\r\n \r\n return $this->_total;\r\n}", "public function getTotal()\n\t{\n\t\t\n\t\treturn count($this->findAll());\n\t}", "public function totalResults()\n {\n\t\treturn (int) $this->totalResultsReturned;\n }", "public function getTotalResults()\n {\n return isset($this['info']['results'])\n ? (int) $this['info']['results']\n : 0;\n }", "function getTotal()\r\n\t{\r\n\t\tif( empty($this->_total) )\r\n\t\t{\r\n\t\t\t$this->_total\t= $this->_getListCount( $this->_query() );\r\n\t\t}\r\n\r\n\t\treturn $this->_total;\r\n\t}", "public function getTotal(): int;", "public function getTotal() {\n\t\treturn $this->total;\n\t}", "function getTotal()\n\t{\n\t\t// Lets load the content if it doesn't already exist\n\t\tif (empty($this->_total))\n\t\t{\n\t\t\t$query = $this->_buildQuery();\n\t\t\t$this->_total = $this->_getListCount($query);\n\t\t}\n\n\t\treturn $this->_total;\n\t}", "function getTotal()\n\t{\n\t\t// Lets load the content if it doesn't already exist\n\t\tif (empty($this->_total))\n\t\t{\n\t\t\t$query = $this->_buildQuery();\n\t\t\t$this->_total = $this->_getListCount($query);\n\t\t}\n\n\t\treturn $this->_total;\n\t}", "function getTotal()\n\t{\n\t\t// Lets load the content if it doesn't already exist\n\t\tif (empty($this->_total))\n\t\t{\n\t\t\t$query = $this->_buildQuery();\n\t\t\t$this->_total = $this->_getListCount($query);\n\t\t}\n\n\t\treturn $this->_total;\n\t}", "public function getTotal()\n\t{\n\t\treturn $this->total;\n\t}", "public function getTotal()\n {\n return $this->total;\n }", "public function getTotal()\n {\n return $this->total;\n }", "public function getTotal()\n {\n return $this->total;\n }", "public function getTotal()\n {\n return $this->total;\n }", "public function getTotal()\n {\n return $this->total;\n }", "public function getTotal()\n {\n return $this->total;\n }", "public function getTotal(){\n $total=0;\n\n foreach ( $this->getOrderLines() as $ol){\n $total += $ol->getSubTotal();\n }\n \n return $total;\n }", "public function getTotal()\n {\n if ( empty ( $this->_total ) ) {\n $query = $this->_buildQuery();\n $this->_total = $this->_getListCount($query);\n }\n\n return $this->_total;\n }", "public function getTotal() {\n return $this->get(self::TOTAL);\n }", "public function total()\n {\n $total = 0;\n\n foreach ($this->contents() as $item) $total += (float)$item->total();\n\n return (float)$total;\n }", "public function getRecordsTotal(): int;", "public function total(): int\n {\n return Arr::get($this->meta, 'total', $this->count());\n }", "public function getTotal()\n\t{\n $rows = (new \\yii\\db\\Query())\n ->select('*')\n ->from($this->table)\n ->all();\n\t\treturn count($rows);\n\t}", "public function getTotalResults() {\n return $this->totalResults;\n }", "function getTotalofReports(){\r\n $books = getReportofTotal();\r\n $totalIncome = 0;\r\n\r\n for($ctr = 0; $ctr < count($books); $ctr++){\r\n $totalIncome += $books[$ctr][2];\r\n }\r\n\r\n return $totalIncome;\r\n }", "public function getImportedItemCount()\n\t{\n\t $db = get_db();\n $iit = $db->getTable('CsvImport_ImportedItem');\n $sql = $iit->getSelectForCount()->where('`import_id` = ?');\n $importedItemCount = $db->fetchOne($sql, array($this->id));\n return $importedItemCount;\n\t}", "protected function getTotItems()\n {\n if ($this->exportableHandler !== null) {\n return $this->exportableHandler->getTotItems();\n } else {\n return 0;\n }\n }", "public function getTotal()\n {\n $query = $this->getQuery()->select('COUNT(*) as total');\n \n $rows = $this->database->query($query, $this->database->getBinds());\n \n if (!isset($rows[0]['total'])) {\n return 0;\n }\n \n return $rows[0]['total'];\n }", "function getTotal()\n\t{\n\t\treturn $this->_total;\n\t}", "function getTotalFaliures()\n {\n $data = [];\n $output = $this->queryData('//QueryGetTotalFailures','', $data);\n $number = $output[0]['number'];\n return $number;\n }", "public function getTotalItemCount()\n {\n return $this->totalItemCount;\n }", "public function getTotalItems()\n\t{\n\t\treturn $this->totalItems;\n\t}", "public function getTotalResults(): int\n {\n return $this->totalResults;\n }", "public function TotalItems()\n {\n return $this->getTotalItems();\n }", "public function getTotal()\n {\n $response = $this->client->post( 'https://idf.intven.com/public_patent_listing.json', [\n 'verify' => false,\n 'json' => [\n \"report_type\" => \"public_patent_listing\",\n \"queryFields\" => new \\stdClass(),\n \"filters\" => new \\stdClass(),\n \"per_page\" => 0,\n \"from\" => 0,\n \"sort\" => \"issued_on\",\n \"sort_order\" => \"desc\"\n ],\n ]);\n $data = json_decode($response->getBody()->getContents());\n return $data->meta_data->total_count;\n }", "public function getTotal_tickets()\n {\n return $this->total_tickets;\n }", "function getTotalItems() { return $this->m_totalItems; }", "public function getTotalItems()\n {\n $total = 0;\n \n foreach ($this->items as $item) {\n $total += ($item->Quantity) ? $item->Quantity : 1;\n }\n\n return $total;\n }", "public function retrieveTotalReport()\n {\n return $this->start()->uri(\"/api/report/totals\")\n ->get()\n ->go();\n }", "private function getIssues()\n {\n\n $issues = [];\n $total_issues = $this->totalIssues();\n if ($this->infos['errorBoolean']) {\n return 0;\n }\n if ($total_issues % 100 !== 0 ) {\n $total_int = intdiv($total_issues, 100) +1;\n }else {\n $total_int = $total_issues/100;\n }\n for ($i=0; $i < $total_int ; $i++) {\n $start = 100*$i;\n $max = 100*($i+1);\n $url = $this->base_uri.'search?jql=project='.$this->project.'&startAt='.$start.'&maxResults='.$max;\n $temp= $this->request($url);\n $issues[] = array(json_decode($temp));\n }\n\n return $issues;\n\n }", "public function getTotalCount() {\n\n try {\n $amount = (int) $this->db->fetchOne(\"SELECT COUNT(*) as amount FROM email_log \" . $this->getCondition(), $this->model->getConditionVariables());\n } catch (Exception $e) {\n\n }\n return $amount;\n }", "public function getTotalResults() : int\n {\n return $this->totalResults;\n }", "public function getTotalResults()\n {\n return $this->totalResults;\n }", "public function getTotalResults()\n {\n return $this->totalResults;\n }", "public function getTotalCount()\n {\n $this->loadItems();\n return $this->calculator->getCount($this->items);\n }", "public function computeCount() {\n if ($str = elis_consumer_http_request($this->url_pattern . '&rows=0', array('Accept' => 'application/json'))) {\n if ($json = json_decode($str)) {\n $this->totalCount = $json->response->numFound;\n }\n }\n return $this->totalCount;\n }", "public function getTotalCount()\n {\n return $this->totalCount;\n }", "public function get_total_reports() {\n\t\treturn $this->total_reports;\n\t}", "public function get_total()\n\t{\n\t\t$query = $this->query;\n\t\tif(isset($query['order']))\n\t\t\t$query['order'] = $this->model->table() . '.id';\n\t\treturn $this->model->count($query);\n\t}", "public function total_results()\n\t{\n\t\t$results = $this->get_results();\n\t\t$total = 0;\n\n\t\tforeach\t( $results as $set ) {\n\t\t\t$total = $total + count( $set );\n\t\t}\n\n\t\treturn $total;\n\t}", "public function getTotal()\n {\n// $store = $this->getStoreId('getTotal');\n//\n// // Try to load the data from internal storage.\n// if (isset($this->cache[$store]))\n// {\n// return $this->cache[$store];\n// }\n\n // Load the total.\n $query = $this->getItems();\n $total = (int) $this->_getListCount($query);\n\n // Check for a database error.\n if ($this->_db->getErrorNum())\n {\n $this->setError($this->_db->getErrorMsg());\n return false;\n }\n\n // Add the total to the internal cache.\n// $this->cache[$store] = $total;\n\n return $total;\n }", "public function getTotal(){\n\t\treturn $this->_total;\n\t}", "public function get_total(){\n $total = 0;\n \n // récupert tous les articles de la commande\n $articles = $this->get_all_articles();\n \n // parcourt ces articles\n foreach($articles as $a){\n $price = $a->get_price(true);\n \n // puis calcul le prix\n $total += $a->nb * $price;\n }\n \n return $total;\n }", "public function getTotal();", "public function getTotal();", "public function total()\n\t{\n\t\treturn $this->total;\n\t}", "protected function calculateTotalItemCount()\n\t{\n\t\t$this->addScopes();\n\t\treturn CActiveRecord::model($this->modelClass)->count($this->getCriteria());\n\t}", "public function get_total_badges() {\n\t\t\treturn $this->total_badges;\n\t\t}", "public function total()\n {\n return $this->total;\n }", "public function total()\n {\n return $this->total;\n }", "public function getTotalItems()\n {\n return intval($this->property('limit'));\n }", "public function getTotalQuantity()\n {\n $items = $this->getContent();\n\n if ($items->isEmpty()) return 0;\n\n $count = array_reduce($items->all(), function ($a, ItemCollection $item) {\n return $a += $item->quantity;\n }, 0);\n\n return $count;\n }", "public function getTotalBilled() {\n\t\t$total = 0;\n\t\t\n\t\tforeach($this->invoice->all as $invoice) {\n\t\t\tforeach($invoice->lineitem->get()->all as $lineitem) {\n\t\t\t\t$total += $lineitem->amount;\n\t\t\t}\n\t\t}\n\t\treturn $total;\n\t}", "public function get_total_unindexed() {\n\t\t$indexables_to_create = $this->query();\n\n\t\treturn \\count( $indexables_to_create );\n\t}", "public function getTotalCount()\n\t{\n\t\treturn $this->totalCount;\n\t}", "public static function searchTotal()\n\t{\n\t\t$total = self::all()->total();\n\t\treturn $total;\n\t}", "public function list_items_total()\n\t{\n\t\t$cnt = $this->list_items(NULL, NULL, NULL, NULL, TRUE);\n\t\tif (is_array($cnt))\n\t\t{\n\t\t\treturn count($cnt);\n\t\t}\n\t\treturn $cnt;\n\t}", "public function totalCount();", "public function totalCount();", "public function getTotal(): int\n {\n return\n $this->getAttack() +\n $this->getDefense() +\n $this->getStamina();\n }", "public function getNumTotalItems()\n {\n return $this->numTotalItems;\n }", "public function totalEntries()\n\t{\n\t\t$count = craft()->formBuilder2_entry->getTotalEntries();\n\t\treturn $count;\n\t}", "public function getTotal()\n {\n return $this->service()->getTotalOfOrder();\n }", "public function getTotalItemCount()\n\t{\n\t\treturn $this->_totalItemCount;\n\t}", "public function getEstimatedTotal()\n {\n return $this->estimated_total;\n }", "public function getTotalQty()\n {\n $qty = 0;\n foreach ($this->lineItems as $item) {\n $qty += $item->qty;\n }\n\n return $qty;\n }", "function getTotals(){\n\t\treturn $this->cache->getTotals();\n\t}", "public function totalFileCount(): int\n {\n return $this->getItems()->count();\n }", "public function total () {\n return $this->since($this->iniTmstmp);\n }", "public function getTotalCount();", "public function getTotalCount();", "public function getTotalCount();" ]
[ "0.83486587", "0.6618601", "0.65681076", "0.6443894", "0.64355946", "0.64127195", "0.6370253", "0.6367052", "0.63533825", "0.6346644", "0.6345541", "0.63357216", "0.63295615", "0.6322821", "0.62981313", "0.6297393", "0.62857234", "0.6277588", "0.6273738", "0.62620693", "0.62547183", "0.62526417", "0.6249581", "0.6236187", "0.6236187", "0.6236187", "0.6228846", "0.6221908", "0.6221908", "0.6221908", "0.6221908", "0.6221908", "0.6221908", "0.6199982", "0.61980134", "0.6197913", "0.6157939", "0.6135197", "0.6127415", "0.6123403", "0.61083025", "0.6106591", "0.60903424", "0.6082649", "0.6079054", "0.60739946", "0.606747", "0.605847", "0.6057661", "0.6056676", "0.60566705", "0.60544175", "0.60423243", "0.6041212", "0.603276", "0.60326433", "0.6032597", "0.60229695", "0.60159045", "0.60066843", "0.60066843", "0.60039175", "0.6002518", "0.59937966", "0.5983033", "0.5969806", "0.5966513", "0.5960471", "0.596004", "0.59533125", "0.59527695", "0.59527695", "0.595154", "0.5944195", "0.5943831", "0.59430027", "0.59430027", "0.59377587", "0.59280217", "0.5922538", "0.5919391", "0.5917927", "0.5914471", "0.5910798", "0.59045166", "0.59045166", "0.58994085", "0.5892141", "0.5889667", "0.5888408", "0.5878968", "0.5876993", "0.5875369", "0.5873002", "0.587157", "0.58653814", "0.5859522", "0.5859522", "0.5859522" ]
0.86565197
0
Get a list of all organisations a user is member of
public function getListOfAllUserOrganisations() { return ['All projects']; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function all()\n {\n return $this->get('/user/memberships/orgs');\n }", "public function listOrganizations($user) {\n return $user->organizations;\n }", "public function get_organisers(){\n $sql = \"SELECT DISTINCT * from members WHERE members.id IN \"\n .\"(SELECT organiserID FROM tournamentOrganisers WHERE tournamentID=$this->id)\";\n return Member::find_by_sql($sql);\n }", "public function getListOfAllUserOrganisations()\n {\n $groups = $this->makeSingleGitLabGetRequest('/groups');\n\n return array_map(function ($group) {\n return $group['full_path'];\n }, $groups);\n }", "public function getAllOrganizations()\n {\n $sql = \"SELECT * FROM organization\";\n $values=array();\n $org=$this->getInfo($sql,$values);\n return $org;\n }", "public function organizers()\n {\n return $this->members()->wherePivot('role', '=', Member::ROLE_ORGANIZER)->get();\n }", "function getOrganismsList();", "public function getOrgUsers(){\n $return_array = array();\n $current_campaign=Yii::app()->session->get('current_campaign');\n $campaign = Definition::model()->findByPk($current_campaign);\n if($campaign){\n $users = Users::model()->findAllByAttributes(array('fk_org_id'=>$campaign->fk_org_id));\n foreach($users as $user){\n $return_array[$user->id] = $user->username;\n }\n }\n \n return $return_array;\n }", "public function getOrganisationList()\n {\n return $this->getResponse('/v1/organizations/list');\n }", "public function getOrganisations(){\n $organisations = [];\n foreach ($this->data['items'] as $organisation) {\n $newOrganisation = [];\n $newOrganisation['accounting_id'] = IndexSanityCheckHelper::indexSanityCheck('uid', $organisation);\n $newOrganisation['name'] = IndexSanityCheckHelper::indexSanityCheck('name', $organisation);\n $newOrganisation['uri'] = IndexSanityCheckHelper::indexSanityCheck('uri', $organisation);\n $newOrganisation['country_code'] = IndexSanityCheckHelper::indexSanityCheck('country', $organisation);\n $newOrganisation['gst_registered'] = IndexSanityCheckHelper::indexSanityCheck('gstRegistered', $organisation);\n $newOrganisation['access_flag'] = IndexSanityCheckHelper::indexSanityCheck('UIAccessFlags', $organisation);\n $newOrganisation['migrated'] = IndexSanityCheckHelper::indexSanityCheck('migrationStatus', $organisation);\n array_push($organisations, $newOrganisation);\n }\n\n return $organisations;\n }", "public function getOrganisations($id = false)\n {\n return !$id ? $this->call('get','Organisations') : $this->call('get','Organisations/'.$id);\n }", "public function getAllOrgs()\n {\n $sql = \"SELECT * FROM organization\";\n $values=array();\n \n $orgs=$this->getInfo($sql,$values);\n\n return $orgs;\n }", "public function findAll() {\n $sql = \"select * from organisations\";\n $result = $this->getDb()->fetchAll($sql);\n \n // Convert query result to an array of domain objects\n $organisations = array();\n foreach ($result as $row) {\n $organisationId = $row['id_organisation'];\n $organisations[$organisationId] = $this->buildDomainObject($row);\n }\n return $organisations;\n }", "public function getMembers()\n {\n \t$companyId = session('company_id');\n \t$userRepo = $this->em->getRepository('App\\Entity\\Management\\User');\n \t$users = $userRepo->getUsersByCompany($companyId);\n\n echo json_encode($users);\n\n }", "public function getOrganisations(){\n $organisations = [];\n if (array_key_exists('items', $this->data)) {\n foreach ($this->data['items'] as $organisation) {\n $newOrganisation = [];\n $newOrganisation['accounting_id'] = \\PHPAccounting\\MyobAccountRightLive\\Helpers\\Essentials\\IndexSanityCheckHelper::indexSanityCheck('uid', $organisation);\n $newOrganisation['name'] = \\PHPAccounting\\MyobAccountRightLive\\Helpers\\Essentials\\IndexSanityCheckHelper::indexSanityCheck('name', $organisation);\n $newOrganisation['uri'] = \\PHPAccounting\\MyobAccountRightLive\\Helpers\\Essentials\\IndexSanityCheckHelper::indexSanityCheck('uri', $organisation);\n $newOrganisation['country_code'] = \\PHPAccounting\\MyobAccountRightLive\\Helpers\\Essentials\\IndexSanityCheckHelper::indexSanityCheck('country', $organisation);\n $newOrganisation['gst_registered'] = \\PHPAccounting\\MyobAccountRightLive\\Helpers\\Essentials\\IndexSanityCheckHelper::indexSanityCheck('gstRegistered', $organisation);\n $newOrganisation['access_flag'] = 'old_essentials';\n array_push($organisations, $newOrganisation);\n }\n } else {\n foreach ($this->data as $organisation) {\n $newOrganisation = [];\n $newOrganisation['accounting_id'] = IndexSanityCheckHelper::indexSanityCheck('Id', $organisation);\n $newOrganisation['name'] = IndexSanityCheckHelper::indexSanityCheck('Name', $organisation);\n $newOrganisation['uri'] = IndexSanityCheckHelper::indexSanityCheck('Uri', $organisation);\n $newOrganisation['country_code'] = IndexSanityCheckHelper::indexSanityCheck('Country', $organisation);\n $newOrganisation['gst_registered'] = true;\n $newOrganisation['access_flag'] = IndexSanityCheckHelper::indexSanityCheck('UIAccessFlags', $organisation);\n array_push($organisations, $newOrganisation);\n }\n }\n\n\n return $organisations;\n }", "public function getCompanyWithUsers();", "public function OrganisationMembers() {\n\t\t$memberIDs = $this->RelatedMembers()\n\t\t\t->filter(['Type.Code' => ['MJO', 'MRO', 'MEM', 'MCO']])\n\t\t\t->column('FromModelID');\n\n\t\t$uniquemembers = Member::get()->filter(['ID' => $memberIDs])->distinct(true)->setQueriedColumns(array('ID'));\n\n\t\treturn $uniquemembers;\n\t}", "public function getOrderUsersOrganisms() {\n // Load the list items.\n $db = $this->getDbo();\n $query = $db->getQuery(true);\n\n // Select the required fields from the table.\n $query->select('org.id as id, org.name as name');\n $query->from('#__sdi_order AS o');\n $query->innerJoin('#__sdi_user AS sdi_user ON sdi_user.id = o.user_id');\n $query->innerJoin('#__sdi_user_role_organism AS uro ON sdi_user.id = uro.user_id AND uro.role_id = 1');\n $query->innerJoin('#__sdi_organism AS org ON org.id = uro.organism_id');\n $query->order('org.name');\n $query->group('org.id');\n $query->group('org.name');\n\n try {\n $items = $this->_getList($query);\n } catch (RuntimeException $e) {\n $this->setError($e->getMessage());\n return false;\n }\n return $items;\n }", "public function ApproverMembers() {\n\t\tif ($this->owner->CanApproveType == 'OnlyTheseUsers') {\n\t\t\t$groups = $this->owner->ApproverGroups();\n\t\t\t$members = new DataObjectSet();\n\t\t\tif($groups) foreach($groups as $group) {\n\t\t\t\t$members->merge($group->Members());\n\t\t\t}\n\t\t\t\n\t\t\t// Default to ADMINs, if something goes wrong\n\t\t\tif(!$members->Count()) {\n\t\t\t\t$group = Permission::get_groups_by_permission('ADMIN')->first();\n\t\t\t\t$members = $group->Members();\n\t\t\t}\n\t\t\t\n\t\t\treturn $members;\n\t\t} elseif($this->owner->CanApproveType == 'LoggedInUsers') {\n\t\t\treturn Permission::get_members_by_permission('CMS_ACCESS_CMSMain');\n\t\t} else {\n\t\t\t$group = Permission::get_groups_by_permission('ADMIN')->first();\n\t\t\treturn $group->Members();\n\t\t}\n\t}", "public function getAllOrganisation()\n {\n //\n $organisation = Organisation::get()->where('deleted_at', NULL);\n if(count($organisation) > 0){\n return response([\n \"status\" => \"success\",\n \"message\" => \"Organisations List\",\n \"organisation\" => $organisation,\n \"code\" => 200\n ], 200);\n }\n else{\n return response([\n \"status\" => \"failed\",\n \"message\" => \"Organisations Not Found\",\n \"organisation\" => $organisation,\n \"code\" => 400\n ], 404);\n }\n \n }", "public function index()\n {\n $organisations = Organisation::all();\n return $organisations->toJson();\n }", "public function myOrganizations($user_id = null){\n $this->Behaviors->load('Containable');\n $myOrganizations = $this->find('all', array(\n 'contain' => array(\n 'Organization.Organizationmessage',\n 'Organization.Organizationmessage.User',\n 'User',\n 'Branch',\n 'Organizationrole',\n 'Organization.City',\n 'Organization.Country',\n 'Branch.City',\n 'Branch.Country'\n ),\n 'conditions'=>array(\n 'OrganizationUser.user_id'=> $user_id,\n 'OrganizationUser.status'=>3\n )\n ));\n return $myOrganizations;\n }", "public function organisations()\n {\n return $this->belongsToMany('Queueless\\Organisation')->withTimestamps();\n }", "public static function getOrganizationList(Request $request)\n {\n $organizations = User::all();\n $all = $organizations->count();\n $active = count($organizations->where('deleted_at', '=', null)->all()); \n $softDelete = \\App\\Organization::onlyTrashed()->count();\n return $organization = collect(['active' => $active, 'softDelete' => $softDelete, 'all' => $all]);\n }", "public function index()\n {\n return OrganizerResource::collection(\n Auth::user()->organizers\n );\n }", "public function get_users($organization_id, $user_type);", "public function getUsers();", "public function getUsers();", "public function getUsers();", "private function getUsers()\n {\n $url = $this->base_uri.'user/assignable/multiProjectSearch?projectKeys='.$this->project;\n $users = $this->request($url);\n if (!$this->infos['errorBoolean']) {\n return json_decode($users);\n }\n }", "private function organizations(){\n $presidents = $this->base_model->getEmployee('President');\n foreach ($presidents as $key => $president) {\n $unders = $presidents[$key]['employeeUnder'] = $this->base_model->getEmployeeUnder($president[\"employeeNumber\"]);\n if(!empty($unders)){\n foreach ($unders as $underkey => $under) {\n $undersUnder = $presidents[$key]['employeeUnder'][$underkey]['employeeUnder'] = $this->base_model->getEmployeeUnder($under[\"employeeNumber\"]);\n foreach ($undersUnder as $undersunderkey => $uu) {\n $presidents[$key]['employeeUnder'][$underkey]['employeeUnder'][$undersunderkey]['employeeUnder'] = $this->base_model->getEmployeeUnder($uu[\"employeeNumber\"]);\n }\n }\n }\n }\n\n $this->response($presidents, REST_Controller::HTTP_OK);\n }", "public function organizationList(){\n if($this->request->all()){\n $regionIds = array_flatten($this->request->all());\n $sorted = $this->organization->select('id','name')->whereIn('region_id',$regionIds)->get()->sortBy('name');\n return $sorted->values()->all();\n }else{\n $sorted = $this->organization->select('id','name')->get()->sortBy('name');\n return $sorted->values()->all();\n }\n }", "public function getAllCommunityByUser()\n {\n try {\n $data = $this->findCommunityService->findAllCommunityByUser();\n if ($data === null) {\n $response = $this->apiResponseLibrary->notFoundResponse();\n return response($response, Response::HTTP_NOT_FOUND);\n }\n $response = $this->apiResponseLibrary->listPaginate($data, 10);\n return response($response, Response::HTTP_OK);\n } catch (Exception $e) {\n $response = $this->apiResponseLibrary->errorResponse($e);\n return response($response, Response::HTTP_INTERNAL_SERVER_ERROR);\n }\n }", "public function get()\n {\n return view('admin.organisations.organisations');\n }", "function getMembers() {\n\t\t$query = $this->createQuery();\n\t\t$query .= \"WHERE c2.status = '\" . KontakteData::$STATUS_MEMBER . \"'\";\n\t\t$query .= \" OR c2.status = '\" . KontakteData::$STATUS_ADMIN . \"' \";\n\t\t$query .= \"ORDER BY c2.name ASC\";\n\t\treturn $this->database->getSelection($query);\n\t}", "public function findUsers(): iterable;", "public function PublisherMembers() {\n\t\tif($this->owner->CanPublishType == 'OnlyTheseUsers'){\n\t\t\t$groups = $this->owner->PublisherGroups();\n\t\t\t$members = new DataObjectSet();\n\t\t\tif($groups) foreach($groups as $group) {\n\t\t\t\t$members->merge($group->Members());\n\t\t\t}\n\t\t\t\n\t\t\t// Default to ADMINs, if something goes wrong\n\t\t\tif(!$members->Count()) {\n\t\t\t\t$group = Permission::get_groups_by_permission('ADMIN')->first();\n\t\t\t\t$members = $group->Members();\n\t\t\t}\n\t\t\t\n\t\t\treturn $members;\n\t\t} elseif($this->owner->CanPublishType == 'LoggedInUsers') {\n\t\t\treturn Permission::get_members_by_permission('CMS_ACCESS_CMSMain');\n\t\t} else {\n\t\t\t$group = Permission::get_groups_by_permission('ADMIN')->first();\n\t\t\treturn $group->Members();\n\t\t}\n\t}", "public function index()\n {\n //\n return view('backend.access.organizations.index')\n\t\t\t->withOrganizations($this->organizations->getOrganizationsPaginated(50));\n }", "function get_companies_list() {\n return get_view_data('org_list');\n}", "public function getOrganizationUsers($orgId = null, $page = 1) {\n $this->OrganizationUser->Behaviors->load('Containable');\n $limit = 20;\n // $organizationUsers = $this->OrganizationUser->find('all', array('conditions' => array('OrganizationUser.organization_id' => $orgId),'group'=>array('OrganizationUser.user_id'), 'contain' => array('User.id', 'User.fname', 'User.lname', 'User.email', 'User.address', 'User.phone')));\n $this->paginate = array('conditions' => array('OrganizationUser.organization_id' => $orgId,'OrganizationUser.status' => 3),'group'=>array('OrganizationUser.user_id'), 'contain' => array('User.id', 'User.fname','User.gender', 'User.lname', 'User.email', 'User.address', 'User.phone', 'User.image_dir', 'User.image', 'User.imagepath','User.status','Branch'), 'limit'=>$limit, 'page'=>$page);\n \n $organizationUsers = $this->Paginator->paginate();\n \n $page=$this->params['paging']['OrganizationUser']['pageCount'];\n $currentPage = $this->params['paging']['OrganizationUser']['page'];\n \n if (!empty($organizationUsers)) {\n $status = 1;\n } else {\n $status = 0;\n }\n $output = array(\n \"params\" => $this->request,\n \"method\" => $this->method,\n \"action\" => \"getOrganizationUsers\",\n \"status\" => $status,\n \"page\" => $page,\n \"currentPage\" => $currentPage,\n \"error\" => array(\"validation\" => \"\")\n );\n\n $this->set('output', $output);\n $this->set('organizationUsers', $organizationUsers);\n\n $this->set(\n array(\n \"_serialize\" => array('organizationUsers', 'output'),\n \"_jsonp\"=>true\n )\n );\n }", "public function all(): \\Illuminate\\Support\\Collection\n\t{\n\t\treturn Organization::all();\n\t}", "public function memberships_get()\n {\n\n $em = $this->doctrine->em;\n\n $maembershipRepo = $em->getRepository('Entities\\Membership');\n $memberships = $maembershipRepo->findAll();\n $result[\"desc\"] = \"Listado de membresias\";\n $result[\"data\"] = $memberships;\n $this->set_response($result, REST_Controller::HTTP_OK);\n }", "function getGroupMemberships($user, $parentGroups = false)\n {\n return array();\n }", "public function getAllowedOrganizations()\n {\n\n if (! $this->_hasVar('__allowedOrgs')) {\n $this->refreshAllowedOrganizations();\n }\n // \\MUtil_Echo::track($this->_getVar('__allowedOrgs'));\n\n return $this->_getVar('__allowedOrgs');\n }", "public function memberList()\n {\n return User::where('status', 1)->where('role_id', 2)->get();\n }", "public function ownedTeams()\n {\n return $this->request('get', '/api/owned-teams');\n }", "public function getUserslistToInvite()\n\t{\n\t\t//get current login user session\n\t\t$results = array();\n\t\t$user = $this->Session->read('UserData.userName');\n\t\t$userCourse = $this->Session->read('UserData.usersCourses');\n\t\t$user_course_section = $userCourse[0];\n\t\t\n\t\t//get Course and section name\n\t\t$course_info = $this->getCourseNameOfUser($user_course_section);\n\t\t$course_name = $course_info->course_name;\n\t\t$course_section = $course_info->section_name;\n\t\t//get allsection setting sections for same course\n\t\t$sections_list = $this->__allSections();\n\t\t$options = array('course'=>$course_name,'section'=>$sections_list,'userName !='=>$user);\n\t\t$results = $this->PleUser->find('all',array('conditions'=>$options,'fields'=>array('userName','name'),'order' => array('PleUser.name ASC')));\n\t\tif ($results) {\n\t\t\treturn $results;\n\t\t}\n\t\treturn $results;\n\t}", "public function index()\n {\n $this->allowedAdminAction();\n\n return $this->showAll(Organizador::all());\n }", "public function getPeopleList()\n {\n //db object\n $db = JFactory::getDBO();\n //gen query\n $query = $db->getQuery(true);\n $query->select(\"DISTINCT(p.id),p.first_name,p.last_name\");\n $query->from(\"#__people AS p\");\n $query->leftJoin(\"#__users AS u ON u.id = p.owner_id\");\n $query->leftJoin(\"#__people_cf AS dcf ON dcf.person_id = p.id AND dcf.association_type='deal'\");\n\n //filter based on member access roles\n $user_id = UsersHelper::getUserId();\n $member_role = UsersHelper::getRole();\n $team_id = UsersHelper::getTeamId();\n\n if ($member_role != 'exec') {\n\n if ($member_role == 'manager') {\n $query->where(\"u.team_id=$team_id\");\n } else {\n $query->where(\"(p.owner_id=$user_id OR p.assignee_id=$user_id )\");\n }\n\n }\n\n $query->where(\"p.published=\".$this->published);\n\n $associationType = $this->app->input->get('association');\n $associationId = $this->app->input->get('association_id');\n\n if ($associationType == \"company\") {\n $query->where(\"p.company_id=\".$associationId);\n }\n if ($associationType == \"deal\") {\n $query->where(\"dcf.association_id=\".$associationId.\" AND dcf.association_type='deal'\");\n }\n\n //set query\n $db->setQuery($query);\n\n //load list\n $row = $db->loadAssocList();\n $blank = array(array('first_name'=>TextHelper::_('COBALT_NONE'),'last_name'=>'','id'=>0));\n $return = array_merge($blank,$row);\n\n //return results\n return $return;\n\n }", "public function getUsers()\n {\n\t\treturn $this->api->listUsersOfGroup($this->getID());\n }", "public function organisations(){\n return $this->belongsToMany(Organisation::class);\n }", "public function teamMembers()\n {\n return $this->request('get', '/api/teams/'.Helpers::config('team').'/members');\n }", "function get_users()\n {\n //Unimplemented\n }", "public function get_competitors(){\n $sql = \"SELECT DISTINCT * from members WHERE members.id IN \"\n .\"(SELECT competitorID FROM tournamentCompetitors WHERE tournamentID=$this->id)\";\n return Member::find_by_sql($sql);\n }", "public function index()\n {\n $organizations = Auth::user()->organizations;\n\n return view('organizations.browse', compact('organizations'));\n }", "public function getMembers() {\n /* get members */\n $c = $this->modx->newQuery('modUser');\n $c->innerJoin('modUserGroupMember','UserGroupMembers');\n $c->innerJoin('modUserGroupRole','Role','UserGroupMembers.role = Role.id');\n $c->where(array(\n 'UserGroupMembers.user_group' => $this->userGroup->get('id'),\n ));\n $c->select($this->modx->getSelectColumns('modUser','modUser'));\n $c->select(array(\n 'role' => 'Role.id',\n 'role_name' => 'Role.name',\n ));\n $members = $this->modx->getCollection('modUser',$c);\n $list = array();\n /** @var $member modUserGroupMember */\n foreach ($members as $member) {\n $list[] = array(\n $member->get('id'),\n $member->get('username'),\n $member->get('role'),\n $member->get('role_name'),\n );\n }\n $this->userGroupArray['members'] = '(' . $this->modx->toJSON($list) . ')';\n return $list;\n }", "public function listAction(){\n $r=$this->getRequest();\n $query=Doctrine_Query::create()\n ->select(\"uo.orgid, u.ID, u.nome,u.cognome,u.user,u.active,u.data_iscrizione,r.role\")\n ->from(\"Users u\")\n ->leftJoin(\"u.Role r\")\n ->leftJoin(\"u.UsersOrganizations uo\")\n ->where(\"uo.orgid=\".$r->getParam('orgid'))\n ->addWhere(\"uo.active=\".Constants::UTENTE_ATTIVO);\n list($users,$total)=DBUtils::pageQuery($query,array(),$this->getLimit(),$this->getOffset());\n $this->emitTableResult($users,$total);\n }", "public function get_list()\n\t\t{\n\t\t\treturn View::make('committees.list')\n\t\t\t\t->with('page_title', 'Committee Members')\n\t\t\t\t->with('members', Committee::all());\n\t\t}", "function get_course_users() {\n\t\t$user_list = CourseManager::get_user_list_from_course_code ( api_get_course_id () );\n\t\treturn $user_list;\n\t}", "public function listAction()\n {\n $user = $this->get('security.context')->getToken()->getUser();\n $repositories = $user->getRepositorys();\n\n return array(\n 'name' => $user->getUsernameCanonical(),\n 'repositories' => $repositories\n );\n }", "public function index(Request $request){\n\n return $this->repo->getUserTeams($request->user());\n\n }", "public function viewAny(User $user)\n {\n return $user->hasPermissionTo('list organisations');\n }", "public function getUsers()\n {\n return $this->hasMany(User::className(), ['id' => 'user_id'])->viaTable('join_user_collector', ['collector_id' => 'id']);\n }", "public function getOrganisation()\n {\n return $this->organisation;\n }", "function getMemberContractList() {\n $sql = \"SELECT b.* \n FROM user_contract a INNER JOIN contract b ON a.contract_id = b.id \n WHERE a.user_type = 'member' AND a.uid = ? \n ORDER BY b.id DESC\";\n return getAll($sql, [getLogin()['mid']]);\n}", "function listOfUsers(){\n\t\n\t\t$users = [];\n\t\tforeach ($this->members as $obj){\n\t\t\t$user = array('name'=> $obj->getUserFullName(),'id'=>$obj->getUserID());\n\t\t\tarray_push($users, $user);\n\t\t}\n\t\treturn $users;\n\t}", "public function getUsersWithinTenant(){\n\n\t\t$userTypes = Input::get('userTypes');\n\n\t\t$collegeId = Input::get('collegeId');\n\n\t\t$collegeDeptId = Input::get('departmentId');\n\n\t\tif (Cache::has('college_users_managed_cache'))\n\t\t{\n\t\t\t$users = Cache::get('college_users_managed_cache');\n\n\t\t}else {\n\n\t\t\t$college = College::findorFail($collegeId);\n\n\t\t\t$users = DB::table('users')\n\t\t\t\t->join('colleges', 'users.collegeId', '=', 'colleges.collegeId')\n\t\t\t\t->join('collegedepartments', 'collegedepartments.collegeId', '=', 'colleges.collegeId')\n\t\t\t\t->join('permission_user','permission_user.userId', '=', 'users.userId')\n\t\t\t\t->join('permissions', 'permissions.permissionId', '=', 'permission_user.permissionId')\n\t\t\t\t->join('roles','users.roleId', '=', 'roles.roleId')\n\t\t\t\t->select('users.firstName', 'users.lastName', 'users.userId', 'users.roleId', 'users.avatarUrl'\n\t\t\t\t\t,'permissions.permissionName','permission_user.isEnabled')\n\t\t\t\t->whereIn('users.roleId', array($userTypes))\n\t\t\t\t->where('colleges.collegeId', $collegeId)\n\t\t\t\t->where('collegedepartments.collegeDeptId', $collegeDeptId)\n\t\t\t\t->distinct()\n\t\t\t\t->get();\n\t\t\tdd($users);\n\n\t\t\t$users = $college->users()->get(['users.firstName', 'users.lastName', 'users.userId', 'users.roleId', 'users.avatarUrl']);\n\n\t\t\tCache::add('college_users_managed_cache', $users, 60);\n\t\t}\n\t\treturn response()->json([\n\t\t\t'totalItems'=>$users->count(),\n\t\t\t'items' => $users,\n\t\t],\n\t\t\t200\n\t\t);\n\t}", "function getUsersWithUserRights() {\n\n $userRightsUsers = array();\n $allUsers = REDCap::getUsers();\n foreach($allUsers as $cnt => $user) {\n $rights = REDCap::getUserRights($user);\n if ($rights[$user][\"user_rights\"] == 1) {\n $userRightsUsers[] = $user;\n }\n }\n\n return $userRightsUsers;\n\n}", "public function getCommunities()\n {\n $communities = array_map(function ($group) {\n $community = [\n 'id' => $group[0],\n 'name' => $group[1]\n ];\n return $community;\n }, $this->api->grabGroups('/u/0', ''));\n\n $this->updateCommunities($communities);\n\n return $communities;\n }", "private function collectAllKnownMembers()\n {\n return $this->getDoctrine()->getRepository(Board::class)->findAllKnownMembers($this->getUser());\n }", "function getUsers(){\n }", "function getUsers(){\n }", "public function getEnseignants(){\n return DB::table('users')->join('course_user','course_user.user_id', '=', 'users.id')\n ->join('courses','course_user.course_id', '=', 'courses.id')\n ->select('users.id','users.user_name', 'users.user_contact',\n 'users.user_last_name', 'courses.course_name'\n )->get();\n\n \n }", "public static function bygroup()\r\n {\r\n if(!self::user()->hasPerm('users_membership'))\r\n \\CAT\\Helper\\Json::printError('You are not allowed for the requested action!');\r\n $id = self::router()->getParam();\r\n $data = \\CAT\\Groups::getInstance()->getMembers($id);\r\n if(self::asJSON())\r\n {\r\n echo header('Content-Type: application/json');\r\n echo json_encode($data,true);\r\n return;\r\n }\r\n }", "public function getOrganiser() {\n return $this->organiser;\n }", "public function organization($organization)\n {\n return $this->get('/user/memberships/orgs/'.rawurlencode($organization));\n }", "function get_users()\n\t{\n\n\t\trequire_once('modules/Users/User.php');\n\t\t\n\t\t$query = \"SELECT user_id as id FROM roles_users WHERE role_id='$this->id' AND deleted=0\";\n\t\t\n\t\treturn $this->build_related_list($query, new User());\n\t}", "function lib4ridora_get_all_organizational_units() {\n $facet_fields = lib4ridora_parse_affiliation_fields();\n $facets = lib4ridora_facet_query($facet_fields);\n\n $org_units = array();\n\n // If there's results, construct an array where the keys are affiliations\n // as in Solr, and the values are formatted to be labels.\n foreach ($facets as $facet) {\n if (empty($facet)) {\n continue;\n }\n $keys = array_keys($facet);\n $org_units = array_merge($org_units, drupal_map_assoc($keys, 'lib4ridora_org_unit_ucwordss'));\n }\n\n // Sort the array alphanumerically (ignoring lower/upper case):\n $sortAryTmp = array_map( 'strtolower', $org_units );\n array_multisort( $sortAryTmp, SORT_ASC, SORT_STRING, $org_units );\n\n // Return 'all' alongside whatever else.\n return array(\"*\" => t(\"All\")) + $org_units;\n}", "public static function getAllOwners():array\n {\n // We call getInstance here because this is a static function\n $db = Database::getInstance(self::$dbName);\n return $db->fetchAll(\n 'SELECT id,first_name,last_name FROM user where user_type=0;'\n );\n \n }", "public function getOrganizations($parameters = [])\n {\n return $this->client->request('GET', '/organizations', [], $parameters);\n }", "public function getAllUsersAction(Request $request)\n {\n $user = $this->user;\n if (!$user) {\n return $this->redirectToRoute('login');\n }\n\n $entityManager = $this->em;\n $repoU = $entityManager->getRepository(User::class);\n $organization = $user->getOrganization();\n $orgEnabledUserCreatingUser = false;\n $orgEnabledUserSeeAllUsers = false;\n $orgEnabledUserSeePeersResults = false;\n $enabledUserSeeSnapshotSupResults = false;\n $enabledSuperiorOverviewSubResults = false;\n $enabledSuperiorSettingTargets = false;\n $enabledSuperiorModifySubordinate = false;\n $nbViewableInternalUsers = 0;\n\n\n // Only administrators or roots can create/update users who have the ability to create users themselves\n $orgOptions = $organization->getOptions();\n foreach ($orgOptions as $orgOption) {\n switch ($orgOption->getOName()->getName()) {\n case 'enabledSuperiorModifySubordinate':\n $enabledSuperiorModifySubordinate = $orgOption->isOptionTrue();\n break;\n case 'enabledSuperiorOverviewSubResults':\n $enabledSuperiorOverviewSubResults = $orgOption->isOptionTrue();\n break;\n case 'enabledSuperiorSettingTargets':\n $enabledSuperiorSettingTargets = $orgOption->isOptionTrue();\n break;\n case 'enabledUserCreatingUser':\n $orgEnabledUserCreatingUser = $orgOption->isOptionTrue();\n break;\n case 'enabledUserSeeAllUsers':\n $orgEnabledUserSeeAllUsers = $orgOption->isOptionTrue();\n break;\n case 'enabledUserSeeSnapshotPeersResults':\n $orgEnabledUserSeePeersResults = $orgOption->isOptionTrue();\n break;\n case 'enabledUserSeeSnapshotSupResults':\n $enabledUserSeeSnapshotSupResults = $orgOption->isOptionTrue();\n break;\n case 'enabledUserSeeRanking':\n $orgEnabledUserSeeRanking = $orgOption->isOptionTrue();\n break;\n }\n }\n\n $clientFirms = new ArrayCollection;\n $clientTeams = new ArrayCollection;\n $clientIndividuals = new ArrayCollection;\n $clients = $organization->getClients();\n $totalClientUsers = 0;\n\n foreach ($clients as $client) {\n $canSeeClient = $user->getRole() == 4 || $user->getRole() == 1 || $organization->getPlan() > ORGANIZATION::PLAN_ENTERPRISE || $client->getInitiator() == $user;\n if ($canSeeClient) {\n switch ($client->getClientOrganization()->getType()) {\n case 'F':\n $clientFirms->add($client);\n break;\n case 'T':\n $clientTeams->add($client);\n break;\n case 'I':\n case 'C':\n $clientIndividuals->add($client);\n break;\n }\n }\n }\n\n $totalClientUsers = 0;\n\n foreach ($organization->getClients() as $client) {\n $totalClientUsers += count($client->getExternalUsers()) - 1;\n }\n\n $nbViewableInternalUsers = count($organization->getActiveUsers());\n\n $users = $organization->getActiveUsers();\n //$usersWithDpt = $users->filter(fn(User $u) => $u->getDepartment() != null);\n $usersWithoutDpt = $users->filter(fn(User $u) => !$u->getDepartment() && !$u->isSynthetic());\n\n $viewableUsersWithoutDpt = $usersWithoutDpt;\n\n /*foreach ($usersWithoutDpt as $userWithoutDpt) {\n $canSeeUserWithoutDpt = $user->getRole() == 4 || ($user->getRole() == 1) || ($user->getInitiator() == $user);\n if ($canSeeUserWithoutDpt) {$viewableUsersWithoutDpt[] = $userWithoutDpt;}\n }*/\n\n $viewableTeams = $organization->getTeams()->filter(function (Team $t) {return $t->getDeleted() == null;});\n\n //$dealingFirms = $organization->getDealingFirms();\n //$dealingTeams = $organization->getDealingTeams();\n $dealingTeams = $this->em->getRepository(Organization::class)->getDealingTeams($organization);\n\n return $this->render(\n 'user_list.html.twig',\n [\n 'rootDisplay' => false,\n //'dealingFirms' => $dealingFirms,\n 'clientFirms' => $clientFirms,\n 'clientTeams' => $clientTeams,\n 'clientIndividuals' => $clientIndividuals,\n 'setClientIconForm' => $this->createForm(SetClientIconForm::class),\n //'usersWithDpt' => $usersWithDpt,\n 'organization' => $organization,\n //'viewableDepartments' => $this->em->getRepository(Organization::class)->getUserSortedDepartments($this->user),\n 'viewableDepartments' => $organization->getDepartments()->filter(fn(Department $d) => $d->getActiveUsers()->count() > 0),\n 'viewableTeams' => $viewableTeams,\n 'dealingTeams' => $dealingTeams,\n 'totalClientUsers' => $totalClientUsers,\n 'usersWithoutDpt' => $viewableUsersWithoutDpt,\n 'orgEnabledUserCreatingUser' => $orgEnabledUserCreatingUser,\n 'orgEnabledUserSeeAllUsers' => $orgEnabledUserSeeAllUsers,\n 'orgEnabledUserSeePeersResults' => $orgEnabledUserSeePeersResults,\n 'enabledUserSeeSnapshotSupResults' => $enabledUserSeeSnapshotSupResults,\n 'enabledSuperiorOverviewSubResults' => $enabledSuperiorOverviewSubResults,\n 'enabledSuperiorSettingTargets' => $enabledSuperiorSettingTargets,\n 'enabledSuperiorModifySubordinate' => $enabledSuperiorModifySubordinate,\n 'nbViewableInternalUsers' => $nbViewableInternalUsers,\n 'orgEnabledUserSeeRanking' => $orgEnabledUserSeeRanking ?? false,\n ]\n );\n }", "function get_info_by_organization($user) {\n\t$parsed_json = json_decode(my_get_json(\"rate_limit?access_token=a6f162fe9dd5745cfaa1e387321b3ce59ede3a27\"),true);\n\tif ($parsed_json['rate']['remaining'] != 0)\n\t{\n\t\t$repos_orgarnization = my_get_repo($user);\n\t\t//test\n\t\t//var_dump($repos_orgarnization[$i]['full_name']);\n\t\tget_nbr_contrib($repos_orgarnization);\n\t\tget_commit_activity($repos_orgarnization);\n\t\tget_code_frequency($repos_orgarnization);\n\t\tget_punch_card($repos_orgarnization);\n\t\tget_participation($repos_orgarnization);\n\t}\n\telse\n\t{\n\t\techo \"Une erreur est apparue (limite ou autres)<br/>\";\n\t}\n}", "public function getPartinUsersList(){\n return $this->_get(2);\n }", "public function getPopularInstructors()\n {\n\n // TRYING TO GET ANYTHING TEACHER-RELATED BECAUSE THERE ARE VERY FEW INSTRUCTORS BUT LOOKS BETTER IF SHOWING MORE ON DASHBOARD\n $teachers = Role::where('shortname', 'teacher')->first()->users()->take(5)->get();\n $editTeachers = Role::where('shortname', 'editingteacher')->first()->users()->take(5)->get();\n\n\n $t = $this->getInstructorsForRecents($teachers);\n $et = $this->getInstructorsForRecents($editTeachers);\n\n return collect(array_merge($t->toArray(), $et->toArray()))->sortBy('lastaccess')->take(5);\n\n\n }", "function getUsers() {\n\n\tglobal $db;\n\treturn $db->getUsersByGroup ( $GLOBALS [\"targetId\"] );\n\n}", "function groups_get_potential_members($courseid, $roleid = null, $orderby = 'lastname,firstname') {\n global $CFG;\n\n $context = get_context_instance(CONTEXT_COURSE, $courseid);\n $sitecontext = get_context_instance(CONTEXT_SYSTEM);\n $rolenames = array();\n $avoidroles = array();\n\n if ($roles = get_roles_used_in_context($context, true)) {\n\n $canviewroles = get_roles_with_capability('moodle/course:view', CAP_ALLOW, $context);\n $doanythingroles = get_roles_with_capability('moodle/site:doanything', CAP_ALLOW, $sitecontext);\n\n foreach ($roles as $role) {\n if (!isset($canviewroles[$role->id])) { // Avoid this role (eg course creator)\n $avoidroles[] = $role->id;\n unset($roles[$role->id]);\n continue;\n }\n if (isset($doanythingroles[$role->id])) { // Avoid this role (ie admin)\n $avoidroles[] = $role->id;\n unset($roles[$role->id]);\n continue;\n }\n $rolenames[$role->id] = strip_tags(role_get_name($role, $context)); // Used in menus etc later on\n }\n }\n\n $select = 'SELECT u.id, u.username, u.firstname, u.lastname, u.idnumber ';\n $from = \"FROM {$CFG->prefix}user u INNER JOIN\n {$CFG->prefix}role_assignments r on u.id=r.userid \";\n\n if ($avoidroles) {\n $adminroles = 'AND r.roleid NOT IN (';\n $adminroles .= implode(',', $avoidroles);\n $adminroles .= ')';\n } else {\n $adminroles = '';\n }\n\n // we are looking for all users with this role assigned in this context or higher\n if ($usercontexts = get_parent_contexts($context)) {\n $listofcontexts = '('.implode(',', $usercontexts).')';\n } else {\n $listofcontexts = '('.$sitecontext->id.')'; // must be site\n }\n\n if ($roleid) {\n $selectrole = \" AND r.roleid = $roleid \";\n } else {\n $selectrole = \" \";\n }\n\n $where = \"WHERE (r.contextid = $context->id OR r.contextid in $listofcontexts)\n AND u.deleted = 0 $selectrole\n AND u.username != 'guest'\n $adminroles \";\n $order = \"ORDER BY $orderby \";\n\n return(get_records_sql($select.$from.$where.$order));\n\n}", "public function index(Request $request){\n $orgs = $this->orgRepository->findBy($request->all());\n return $this->respondWithCollection($orgs, $this->orgTransformer);\n }", "public function memberIdList()\n {\n return User::where('status', 1)->where('role_id', 2)->get();\n }", "public function getOrganisation()\n\t{\n\t\treturn $this->_organisation;\n\t}", "function communityList($args)\n {\n $userDao = $this->_getUser($args);\n\n if($userDao && $userDao->isAdmin())\n {\n $communities = $this->Community->getAll();\n }\n else\n {\n $communities = $this->Community->getPublicCommunities();\n if($userDao)\n {\n $communities = array_merge($communities, $this->User->getUserCommunities($userDao));\n }\n }\n\n $this->Component->Sortdao->field = 'name';\n $this->Component->Sortdao->order = 'asc';\n usort($communities, array($this->Component->Sortdao, 'sortByName'));\n return $this->Component->Sortdao->arrayUniqueDao($communities);\n }", "public function index()\n {\n return view('admin.membership', ['users' => User::with('membership')->has('membership')->orderBy('birth_date')->get()]);\n }", "function load_org()\n {\n $query = $this->db->query('SELECT * FROM `organization`');\n return $query->result_array();\n }", "public function userList($dependency = 'institution', $paginator = '', $filter = false, $institution_id = 'false', $role_id = 'false', $group_id = 'false' ){\n global $USER;\n $order_param = orderPaginator($paginator, array('id' => 'us',\n 'username' => 'us',\n 'firstname' => 'us',\n 'lastname' => 'us',\n 'email' => 'us', \n 'postalcode'=> 'us',\n 'city' => 'us')); \n \n //checkCapabilities('user:userList', $USER->role_id); // kann eigentlich weg.\n $users = array(); //Array of grades\n switch ($dependency) {\n case 'institution': if(checkCapabilities('user:userListComplete', $USER->role_id,false)){ //Global Admin\n if ($filter){\n switch ($filter) {\n case 'register': $db = DB::prepare('SELECT SQL_CALC_FOUND_ROWS us.* FROM users AS us WHERE us.confirmed = 4 '.$order_param); \n $db->execute(); \n break;\n case 'lost': $db = DB::prepare('SELECT SQL_CALC_FOUND_ROWS us.* FROM users AS us, institution_enrolments AS ie \n WHERE us.id = us.id AND ie.user_id = us.id AND ie.status = 0 '.$order_param); //hack id = id to user search\n $db->execute(); \n break;\n\n default:\n break;\n }\n } else {\n \n $db = DB::prepare('SELECT SQL_CALC_FOUND_ROWS us.* FROM users AS us WHERE us.id = us.id '.$order_param); //hack id = id to user search\n $db->execute(); \n }\n } else if (checkCapabilities('user:userListInstitution', $USER->role_id,false)) { //Manager\n $db = DB::prepare('SELECT SQL_CALC_FOUND_ROWS us.* FROM users AS us WHERE us.id = ANY (SELECT user_id FROM institution_enrolments \n WHERE institution_id = ? AND status = 1 AND role_id <> 1) '.$order_param); // HACK to prevent edit of super user\n $db->execute(array($USER->institution_id)); \n } else if (checkCapabilities('user:userListGroup', $USER->role_id,false)) { //Kursersteller\n $db = DB::prepare('SELECT DISTINCT SQL_CALC_FOUND_ROWS us.* FROM users AS us, groups_enrolments AS ge, institution_enrolments AS ie, roles AS ro \n WHERE ie.institution_id = ? AND ie.status = 1\n AND ie.role_id <> 1 /* HACK to prevent edit of super user*/\n AND ro.id = ie.role_id \n AND ro.order_id > (SELECT order_id FROM roles WHERE id = ?)\n AND ie.user_id = us.id \n AND ge.user_id = ie.user_id\n AND ge.status = 1\n AND ge.group_id = ANY (SELECT group_id FROM groups_enrolments \n WHERE user_id = ? AND status = 1) '.$order_param);\n $db->execute(array($USER->institution_id, $USER->role_id, $USER->id)); \n } \n break;\n case 'filter_institution':\n if (checkCapabilities('user:userListInstitution', $USER->role_id,false)) { //Schuladmin\n if ($role_id == 'false'){ \n $role_filter = ' '; \n } else { \n $role_filter = 'AND ro.id = '.intval($role_id); \n }\n if ($group_id == 'false'){ \n $group_filter = 'AND ge.group_id = ANY (SELECT id FROM groups WHERE institution_id = '.intval($institution_id).')';\n } else { \n $group_filter = 'AND ge.group_id = '.intval($group_id); \n }\n \n $db = DB::prepare('SELECT DISTINCT SQL_CALC_FOUND_ROWS us.* FROM users AS us, groups_enrolments AS ge \n WHERE us.id = ANY (SELECT ie.user_id FROM institution_enrolments AS ie,roles AS ro\n WHERE ie.institution_id = ? \n AND ie.status = 1 \n AND ie.role_id <> 1\n AND ro.id = ie.role_id '.$role_filter.'\n AND ro.order_id > (SELECT order_id FROM roles WHERE id = ?))\n AND ge.user_id = us.id \n AND ge.status = 1\n '.$group_filter.' '.$order_param); // HACK to prevent edit of super user\n $db->execute(array($institution_id, $USER->role_id)); \n } else if (checkCapabilities('user:userListGroup', $USER->role_id,false)) { //Teacher\n if ($role_id == 'false'){ \n $role_filter = ' '; \n } else { \n $role_filter = 'AND ro.id = '.intval($role_id); \n }\n if ($group_id == 'false'){ \n $group_filter = 'ANY (SELECT group_id FROM groups_enrolments WHERE user_id = '.intval($USER->id).' AND status = 1)'; \n } else { \n $group_filter = intval($group_id); \n }\n $db = DB::prepare('SELECT DISTINCT SQL_CALC_FOUND_ROWS us.*, ro.role AS role_name FROM users AS us, groups_enrolments AS ge, institution_enrolments AS ie, roles AS ro \n WHERE ie.institution_id = ? AND ie.status = 1\n AND ie.role_id <> 1 /* HACK to prevent edit of super user*/\n AND ro.id = ie.role_id '.$role_filter.' \n AND ro.order_id > (SELECT order_id FROM roles WHERE id = ?)\n AND ie.user_id = us.id \n AND ge.user_id = ie.user_id\n AND ge.status = 1\n AND ge.group_id = '.$group_filter.' '.$order_param);\n $db->execute(array($institution_id, $USER->role_id)); \n }\n break;\n case 'institution_overview':$db = DB::prepare('SELECT DISTINCT us.*, ro.role AS role_name FROM users AS us, groups_enrolments AS ge, institution_enrolments AS ie, roles AS ro \n WHERE ie.institution_id = ? AND ie.status = 1\n AND ro.id = ie.role_id \n AND ie.user_id = us.id \n AND ge.user_id = ie.user_id\n AND ge.status = 1');\n $db->execute(array($institution_id)); \n \n break; \n default: break;\n }\n if ($paginator != ''){ \n set_item_total($paginator); //set item total based on FOUND ROWS()\n }\n while($result = $db->fetchObject()) {\n $sortableUser = new stdClass();\n if (checkCapabilities('user:shortUserList', $USER->role_id, false)){\n $sortableUser->id = $result->id;\n $sortableUser->firstname = $result->firstname;\n $sortableUser->lastname = $result->lastname;\n $sortableUser->username = $result->username;\n $sortableUser->avatar_id = $result->avatar_id;\n }\n else {\n $sortableUser->id = $result->id;\n $sortableUser->username = $result->username;\n $sortableUser->firstname = $result->firstname;\n $sortableUser->lastname = $result->lastname;\n $sortableUser->email = $result->email;\n $sortableUser->postalcode = $result->postalcode;\n $sortableUser->city = $result->city;\n $sortableUser->avatar_id = $result->avatar_id;\n if (isset($result->role_name)){\n $sortableUser->role_name = $result->role_name;\n }\n }\n $users[] = clone $sortableUser;\n } \n return $users;\n }", "public function getUsers()\n {\n return Security::getUserList();\n }", "static function getUserGroups(){\n \n }", "private function getUserOrgs($id) {\n return OrganizationGroup::where('user_id', $id)\n ->with('organization')\n ->get();\n }", "final public function getParticipants() {\n\n\t\t// all events\n\t\t$search = new MetaSearch($config);\n\t\t$search->setWebNameFilter('Main');\n\t\t$search->setFormNameFilter('EventForm');\n\t\t$search->executeQuery();\n\n\t\t$this->config->pushStrictMode(false);\n\t\tforeach($search->getResults() as $eventTopicName) {\n\t\t\t$topic = $this->topicFactory->loadTopicByName($eventTopicName);\n\t\t\t$event = new CiantEvent($topic);\n\n\t\t\t$collaborators = $event->getCollaborators();\n\t\t}\n\t\t$this->config->popStrictMode();\n\n//\t\t$list = array();\n//\t\tforeach($search->getResults() as $topicName) {\n//\t\t\t$topic = $db->loadTopicByName($topicName);\n//\t\t\t$event = new CiantEvent($topic);\n//\t\t\t$collab = $event->getCollaborators();\n//\t\t\tforeach($collab as $user) {\n//\t\t\t\tif($user instanceof CiantUser) {\n//\t\t\t\t\t$list[spl_object_hash($user)] = $user;\n//\t\t\t\t}\n//\t\t\t}\n//\t\t}\n//\t\tforeach($list as $idx => $user) {\n//\t\t\tassert($user instanceof CiantUser);\n//\t\t\techo $user->getName().\", \";\n//\t\t}\n\t}", "public function index()\n {\n $organisations=Organisation::all();\n \n return view('organisations.index')->with('organisations',$organisations);\n }", "public function getUsers()\n\t{\n\t\t$groupUsers = new ArrayObject();\n\t\t$group = $this->getGroup();\n\t\tif ($group != null) {\n\t\t\t$users = $this->groupService->getUsersInGroup($this->getGroup(), true);\n\t\t\t\n\t\n\t foreach ($users as $user) {\n\t $groupUsers[$user->id] = $user;\n\t }\t\n\t\t}\n \n return $groupUsers;\n\t}", "public static function get_admins();" ]
[ "0.76634663", "0.7379162", "0.7372059", "0.70723677", "0.698785", "0.6977385", "0.696514", "0.68578535", "0.684014", "0.664089", "0.6487919", "0.64069617", "0.6307691", "0.62922287", "0.62767303", "0.62561554", "0.61909", "0.6177162", "0.6159785", "0.61528057", "0.61368436", "0.6129262", "0.61209667", "0.60822713", "0.60694957", "0.6068707", "0.59797686", "0.59797686", "0.59797686", "0.5971866", "0.5939837", "0.5939834", "0.59286815", "0.59202075", "0.58967805", "0.5895084", "0.58947426", "0.5885915", "0.5871588", "0.5869061", "0.5858951", "0.58181816", "0.5814776", "0.58126247", "0.5791058", "0.5782271", "0.57593894", "0.5757059", "0.57473785", "0.57439363", "0.57420456", "0.5730824", "0.5689724", "0.56641036", "0.5660417", "0.56556994", "0.56456304", "0.56414276", "0.56410366", "0.563577", "0.56035197", "0.55907375", "0.55900466", "0.55882", "0.55784434", "0.55672646", "0.5557612", "0.5551274", "0.5551226", "0.5544649", "0.5539628", "0.5539628", "0.55374277", "0.5532422", "0.553039", "0.55300474", "0.5529893", "0.5522666", "0.55143714", "0.5513373", "0.5513259", "0.5512954", "0.55048513", "0.550323", "0.55030775", "0.5501621", "0.5499746", "0.549842", "0.5497908", "0.5494398", "0.5491754", "0.5484822", "0.5483149", "0.5482468", "0.54811126", "0.54747224", "0.5473427", "0.5472661", "0.54638386", "0.54626745" ]
0.75359803
1
get old webhook id
public function createWebhook($project) { /** @var \helper_plugin_issuelinks_db $db */ $db = plugin_load('helper', 'issuelinks_db'); $webhooks = $db->getWebhooks('jira'); $projects = []; if (!empty($webhooks)) { $oldID = $webhooks[0]['id']; // get current webhook projects $projects = explode(',', $webhooks[0]['repository_id']); // remove old webhook $this->makeJiraRequest('/rest/webhooks/1.0/webhook/' . $oldID, [], 'DELETE'); // delete old webhook from database $db->deleteWebhook('jira', $webhooks[0]['repository_id'], $oldID); } // add new project $projects[] = $project; $projects = array_filter(array_unique($projects)); $projectsString = implode(',', $projects); // add new webhooks global $conf; $payload = [ 'name' => 'dokuwiki plugin issuelinks for Wiki: ' . $conf['title'], 'url' => self::WEBHOOK_URL, 'events' => [ 'jira:issue_created', 'jira:issue_updated', ], 'description' => 'dokuwiki plugin issuelinks for Wiki: ' . $conf['title'], 'jqlFilter' => "project in ($projectsString)", 'excludeIssueDetails' => 'false', ]; $response = $this->makeJiraRequest('/rest/webhooks/1.0/webhook', $payload, 'POST'); $selfLink = $response['self']; $newWebhookID = substr($selfLink, strrpos($selfLink, '/') + 1); // store new webhook to database $db->saveWebhook('jira', $projectsString, $newWebhookID, 'jira rest webhooks have no secrets :/'); return ['status' => 200, 'data' => ['id' => $newWebhookID]]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getWebhookId()\n {\n return Mage::getStoreConfig('trello_api/webhook/id');\n }", "public function getOldId()\n {\n return $this->old_id;\n }", "public function getOriginalId();", "public function getLastItemChangeId()\n {\n return $this->doRequest(array('sessionId' => $this->sessionId), 'GetLastItemChangeId');\n }", "public function getOldUid();", "function getHashedId($newId){\r\n return $newId;\r\n}", "public function getLiveId() {}", "function getNewId();", "public function getOriginalIncrementId();", "public function getRequestedId() {}", "public function getId() {\n if ($this->id) {\n return $this->id;\n }\n\n $id = serialize($this->callback->__toString());\n $id .= serialize($this->second);\n $id .= serialize($this->minute);\n $id .= serialize($this->hour);\n $id .= serialize($this->day);\n $id .= serialize($this->month);\n $id .= serialize($this->dayOfWeek);\n $this->id = md5($id);\n\n return $this->id;\n }", "public function get_new_id()\n {\n $query = \"select MAX(id) as id from team\";\n $res = $this->db->query($query);\n $res->result_array();\n $last_id = ($res->result()[0]->id)+1;\n return $last_id;\n }", "private function getNewID()\n\t{\n\t\t$ids = array_keys($this->metadata['posts']);\n\t\t$lastId = (count($ids) > 0) ? max($ids) : 0;\n\n\t\treturn $lastId + 1;\n\t}", "public function getMessageId();", "public function getMessageId();", "public function getMessageId();", "public function getMessageId();", "public function getReceiverId();", "public function getCallerId();", "public function getCallerId();", "public function getLeadIdFromRequest()\n {\n return isset($_POST['id']) ? $_POST['id'] : $_GET['id'];\n }", "function get_id() {\n\t\treturn $this->get_data( 'id' );\n\t}", "public function getUpdaterId()\n {\n return $this->updater_id;\n }", "public function getUpdaterId()\n {\n return $this->updater_id;\n }", "public function getUpdaterId()\n {\n return $this->updater_id;\n }", "public function getUpdaterId()\n {\n return $this->updater_id;\n }", "public function idUpdate(){\n return $this->idUpdate;\n }", "public function getId(): string\n {\n $message = (string) $this->getRawMessage();\n return substr(md5($message), 0, 10);\n }", "public function getTriggerId(): string\n {\n return $this->attributes->get('trigger_id', '');\n }", "protected function getMsgId() {\n $this->msg_id++;\n return $this->msg_id;\n }", "public function getLastAppliedEventID()\n {\n // Behave as if all events are applied.\n return PHP_INT_MAX;\n }", "public function getCallbackID()\n {\n return $this->get('CallbackID');\n }", "protected function _getId ()\n {\n return session_id();\n }", "public function getCurrentRevisionId(): int\n {\n $resp = $this->apiGet(\"replicate\");\n \n if ($resp->getStatusCode() !== 200) {\n throw new WeblingAPIException(\"Get request to Webling failed with status code {$resp->getStatusCode()}\");\n }\n \n return $resp->getData()['revision'];\n }", "function get_recipient_id() {\n\t\treturn $this->get_data( 'recipient' );\n\t}", "public function getId() {\n\t\treturn $this->response['id'] ?: NULL;\n\t}", "function sa_get_hook_id(){\n $bt = debug_backtrace();\n foreach($bt as $func){\n if($func['function'] == 'exec_action'){\n return $func['args'][0];\n }\n }\n}", "public function getEventID() {\n return \"dataevent-\".$this->getID();\n }", "public function getRequestID()\n {\n return $this->RequestID;\n }", "public function getReplayId()\n {\n return $this->get(self::_REPLAY_ID);\n }", "public function getWebHookKey()\n {\n return md5($this->id.sha1(Pluf::f('secret_key')).$this->shortname);\n }", "public function getUniqId() {\n\t\treturn $this->request->get('ok_txn_id'); \n\t}", "public function getPreviousVersionID()\n {\n return $this->previousVersionID;\n }", "public function getLastId();", "public function getLastId();", "function get_last_id()\n {\n // TODO: Implement get_last_id() method.\n }", "public function getUniqueId() {\n return $this->id;\n }", "public function getTicketId() {\n\t\treturn($this->ticketId);\n\t}", "function setMessageID() {\n\t\t$stamp = strtotime (\"now\"); \n\t\t$messageid = \"$stamp$_SERVER[REMOTE_ADDR]\"; \n\t\t$messageid = str_replace(\".\", \"\", \"$messageid\");\n\n\t\treturn $messageid;\n\t}", "function setMessageID() {\n\t\t$stamp = strtotime (\"now\"); \n\t\t$messageid = \"$stamp$_SERVER[REMOTE_ADDR]\"; \n\t\t$messageid = str_replace(\".\", \"\", \"$messageid\");\n\n\t\treturn $messageid;\n\t}", "protected function getSessionId()\n {\n $id = $this->di->session->get('requestRecorderId');\n\n if ($id == null) {\n $id = time();\n $this->di->session->set('requestRecorderId', $id); // Figure out something better than time()\n }\n\n return $id;\n }", "public function getLastMessageID()\n {\n }", "public function getMessageId()\n {\n }", "private function getKnightId(){\n $knightId = $this->getRequest()->getPost(\"id\") //POST?\n ?? $this->params(\"id\") //GET?\n ?? null; //no way\n return $knightId;\n }", "function getNoteId() {\n\t\tif (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');\n\t\treturn $this->getId();\n\t}", "public static function getLastNotificationID(){\n $row = getDatabase()->queryFirstRow(\"SELECT `id` FROM `notifications` ORDER BY `id` DESC\");\n return $row['id'];\n }", "private static function generateNewPayloadId(\\DateTimeInterface $timestamp): string\n\t{\n\t\t// datetime.process id.random number@hostname\n\t\treturn \\sprintf(\n\t\t\t'%s.%s.%s@%s',\n\t\t\t$timestamp->format('U.v'), // include milliseconds\n\t\t\t\\getmypid(),\n\t\t\t\\mt_rand(1000, 9999),\n\t\t\t\\gethostname()\n\t\t);\n\t}", "function getEventID() \n {\n return $this->getValueByFieldName('event_id');\n }", "public function lastId();", "function getRealId($entry) {\n if(null==$entry)\n return null;\n if (isset($entry[\"changeForID\"])) {\n return $entry[\"changeForID\"];\n } else {\n if (isset($entry[\"id\"])) {\n return $entry[\"id\"];\n }\n }\n return null;\n}", "public function deleteWebhook(){\n return $this->make_http_request(__FUNCTION__);\n }", "public function GetPushId()\n\t{\n\t\treturn $this->push_id;\n\t}", "function get_id() : string {\n\t$current_user = wp_get_current_user();\n\treturn sha1( $current_user->user_email );\n}", "private function getId(): int|string\n {\n return '/'.($_SESSION['rfe']['lastUsedItemId']++);\n }", "function get_id() {\n\t\treturn $this->id;\n\n\t}", "function id()\n {\n if ( $this->State_ == \"Dirty\" )\n $this->get( $this->ID );\n \n return $this->ID;\n }", "protected function getUniqueId() {\n return -1; // Placeholder return for now\n }", "function last_id(){\n\t\treturn(-1);\n\t}", "function get_id() {\n\t\treturn $this->id;\n\t}", "public function se_get_id() {\n\t\treturn version_compare( WC_VERSION, '3.0', '>=' ) ? $this->get_id() : $this->id;\n\t}", "public function se_get_id() {\n\t\treturn version_compare( WC_VERSION, '3.0', '>=' ) ? $this->get_id() : $this->id;\n\t}", "public function getUpdateId()\n {\n return $this->update_id;\n }", "function nextId() {\n\t\treturn $this->honeyPotId++;\n\t}", "public function GetId () ;", "public function get_id_message()\n {\n return $this->id_message;\n }", "public function getExternalId()\n {\n return isset($this->feedbackFields['external_id']) ? $this->feedbackFields['external_id'] : null;\n }", "private function retrieve_id() {\n\t\t$replacement = null;\n\n\t\tif ( ! empty( $this->args->ID ) ) {\n\t\t\t$replacement = $this->args->ID;\n\t\t}\n\n\t\treturn $replacement;\n\t}", "function generateNewId(){\n\t\t$id = null;\n\t\t//while ( $this->getSessionData($id) !== null ){\n\t\t\t$id = rand(0,100000);\n\t\t//}\n\t\treturn $id;\n\t}", "function id()\n {\n if ( $this->State_ == \"Dirty\" )\n $this->get( $this->ID );\n\n return $this->ID;\n }", "public function get_id();", "public function get_id();", "public function getId()\n {\n return $this->response['id'] ?: null;\n }", "public function getId()\n {\n return $this->response['id'] ?: null;\n }", "function get_batch_id() {\n global $_REQUEST;\n if (!(isset($_REQUEST['batch_id'])\n && is_string($_REQUEST['batch_id'])\n && preg_match('/^\\{?[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}\\}?$/i', $_REQUEST['batch_id']))) {\n hs_ajax_result(false, \"hack attach!\", null);\n }\n\n return $_REQUEST['batch_id'];\n}", "public function getUniqueId()\n {\n return $this->unique_id;\n }", "public function getCreatedById(): int\n {\n return $this->createdById;\n }", "function get_id()\n {\n return $this->id;\n }", "public static function getParameterKeySinceId()\n {\n return config('consts.ParameterSinceId');\n }", "public function getUniqueId()\n {\n return $this->uniqueId;\n }", "private function processWebHook() {\n\t\t\n\t\t// If there is a user ID, add it to the global scope for access\n\t\tif ( isset($this->decodedWebhook['originalRequest']['data']['user']['userId']) ) {\n\t\t\t$this->googleUserId = $this->decodedWebhook['originalRequest']['data']['user']['userId'];\n\t\t}\n \n }", "public function getMsgId()\n {\n return $this->msg_id;\n }", "public function getId()\n {\n return $this->response['user_id'];\n }", "public function getReplacementID();", "public function getVersiondId() {}", "function getEventID() {\n\t\treturn $this->_EventID;\n\t}", "function getID() {\n\t\treturn $this->data_array['id'];\n\t}", "function hookGenerate($hook){\r\n return 'ig_sig_key_version=4&signed_body=' . hash_hmac('sha256', $hook, '5bd86df31dc496a3a9fddb751515cc7602bdad357d085ac3c5531e18384068b4') . '.' . urlencode($hook);\r\n}", "function getUniqueID() {\r\n\t\treturn $this->uniqueID;\r\n\t}", "function GetLastWFID() {\n\n\t\t//Get Last Workflow ID\n $wfid = \"SELECT LastIssuedWorkflowID FROM WorkflowIDsLastIssued\";\n $result = $this->query($wfid);\n foreach($result as $row){\n $owid = $row['LastIssuedWorkflowID'];\n $nwid = $row['LastIssuedWorkflowID'] + 1;\n }\n $uwfid = \"Update WorkflowIDsLastIssued set LastIssuedWorkflowID = $nwid where LastIssuedWorkflowID = '\" . $owid . \"'\";\n $updateWorkflowID = $this->query($uwfid);\n\n return $nwid;\n }", "public static function trackId(): string\n {\n return 'tid';\n }", "function get_id() {\n return $this->id;\n }" ]
[ "0.77329963", "0.69043547", "0.63334966", "0.6316938", "0.62296855", "0.6198814", "0.6126181", "0.61194164", "0.60144925", "0.59304696", "0.5920029", "0.577568", "0.5766566", "0.5748611", "0.5748611", "0.5748611", "0.5748611", "0.5719221", "0.567871", "0.567871", "0.5650591", "0.5644101", "0.5639485", "0.5639485", "0.5639485", "0.5639485", "0.5632599", "0.5584568", "0.5563905", "0.55494046", "0.5549196", "0.5548209", "0.5543412", "0.5529408", "0.5524623", "0.55225855", "0.5504865", "0.5486467", "0.54758924", "0.5473508", "0.5460678", "0.54594266", "0.5456912", "0.5448954", "0.5448954", "0.54479873", "0.54377866", "0.5433785", "0.54327935", "0.54327935", "0.5432522", "0.5432473", "0.5431564", "0.5426511", "0.54164517", "0.5416054", "0.54089326", "0.5408023", "0.5403378", "0.5400206", "0.5392582", "0.53863734", "0.53825593", "0.53797376", "0.53774786", "0.53762853", "0.5375539", "0.5375151", "0.53744924", "0.5362268", "0.5362268", "0.5355265", "0.5354278", "0.5352191", "0.5350753", "0.5349441", "0.53486127", "0.5334143", "0.53322595", "0.5329968", "0.5329968", "0.5326343", "0.5326343", "0.5324518", "0.531877", "0.53147906", "0.5310628", "0.53061557", "0.5305984", "0.530447", "0.5301646", "0.5297896", "0.52944785", "0.5291465", "0.52878076", "0.52857876", "0.52852935", "0.5283956", "0.5283386", "0.5283226", "0.5281854" ]
0.0
-1
Delete our webhook in a source repository
public function deleteWebhook($project, $hookid) { // get old webhook id /** @var \helper_plugin_issuelinks_db $db */ $db = plugin_load('helper', 'issuelinks_db'); $webhooks = $db->getWebhooks('jira'); $projects = []; if (!empty($webhooks)) { $oldID = $webhooks[0]['id']; // get current webhook projects $projects = explode(',', $webhooks[0]['repository_id']); // remove old webhook $this->makeJiraRequest('/rest/webhooks/1.0/webhook/' . $oldID, [], 'DELETE'); // delete old webhook from database $db->deleteWebhook('jira', $webhooks[0]['repository_id'], $oldID); } // remove project $projects = array_filter(array_diff($projects, [$project])); if (empty($projects)) { return ['status' => 204, 'data' => '']; } $projectsString = implode(',', $projects); // add new webhooks global $conf; $payload = [ 'name' => 'dokuwiki plugin issuelinks for Wiki: ' . $conf['title'], 'url' => self::WEBHOOK_URL, 'events' => [ 'jira:issue_created', 'jira:issue_updated', ], 'description' => 'dokuwiki plugin issuelinks for Wiki: ' . $conf['title'], 'jqlFilter' => "project in ($projectsString)", 'excludeIssueDetails' => 'false', ]; $response = $this->makeJiraRequest('/rest/webhooks/1.0/webhook', $payload, 'POST'); $selfLink = $response['self']; $newWebhookID = substr($selfLink, strrpos($selfLink, '/') + 1); // store new webhook to database $db->saveWebhook('jira', $projectsString, $newWebhookID, 'jira rest webhooks have no secrets :/'); return ['status' => 204, 'data' => '']; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function deleteWebhook(){\n return $this->make_http_request(__FUNCTION__);\n }", "private function delete()\n {\n $webhookId = $this->ask('Please enter Webhook ID');\n\n try {\n $response = $this->messageBirdClient->conversationWebhooks->delete($webhookId);\n\n if ($response) {\n $this->info(\"WebhookId {$webhookId} is deleted successfully\");\n }\n\n } catch (\\Exception $e) {\n $this->error($e->getMessage());\n }\n }", "function rest_delete()\n{\n global $build;\n add_log('Build #' . $build->Id . ' removed manually', 'buildAPI');\n remove_build($build->Id);\n}", "public function testDeleteWebhook()\n {\n }", "protected function deleted(WebhookPayload $payload): void\n {\n //\n }", "public function deleteWebhook(): Request\n {\n return $this->request('deleteWebhook');\n }", "function cvs_delete_repository($cvs_project) {\r\n global $cvs_root;\r\n \r\n //We really don't want to delete the repository,\r\n //just erase the passwd file...\r\n\r\n $cvs_passwd_file = $cvs_root.\"/\".$cvs_project.\"/CVSROOT/passwd\";\r\n unlink( $cvs_passwd_file);\r\n\r\n $cvs_deleted_file = $cvs_root.\"/\".$cvs_project.\"/DELETED\";\r\n touch( $cvs_deleted_file);\r\n}", "public function delete_webhook( $id ) {\n\n\t\t$this->method = 'DELETE';\n\n\t\t$this->path .= '/' . (int) $id;\n\t}", "public function delete($id)\n {\n //getAuthentication()->requireAuthentication();\n $status = $this->webhook->delete($id);\n if($status)\n return $this->noContent('Webhook deleted successfully', true);\n else\n return $this->error('Webhook deletion failure', false);\n }", "public function deleteSource()\n {\n return Yii::$app->storage->fileSystemDeleteFile($this->filter_id . '_' . $this->file->name_new_compound);\n }", "function runDelete($repo)\n{\n $delBar = new ChocolateBar();\n $delBar->chocoID= 15;\n $repo->delete($delBar);\n}", "public function destroy(Request $request, Source $source)\n {\n $source->delete();\n $request->session()->flash('message', 'Successfully deleted the source!');\n return redirect('sources');\n }", "public function delete() {\n\t\treturn $this->wire('files')->unlink($this->logFilename, true);\n\t}", "protected function deleteProtocolFile() {}", "public function delete() {}", "public function delete() {}", "public function delete() {}", "public function delete() {}", "public function delete(): array\n {\n return $this->loyverse->deleteWebhook($this->id);\n }", "public function testDeleteWebhookConfig()\n {\n $container = [];\n $sw = $this->createMockedSmartwaiver($container, APISuccessResponses::webhooks());\n\n $sw->deleteWebhookConfig();\n\n $this->checkDeleteRequests($container, ['/v4/webhooks/configure']);\n }", "public function destroy($id)\n {\n $this->source=$this->source->find($id);\n $success=$this->source->delete();\n if($success){\n return redirect()->route('source.index')->with('flash_message', 'Source Has Been Deleted');\n }\n }", "public final function delete() {\n }", "function delete()\n {\n $this->_api->doRequest(\"DELETE\", \"{$this->getBaseApiPath()}\");\n }", "function delete()\n {\n $this->_api->doRequest(\"DELETE\", \"{$this->getBaseApiPath()}\");\n }", "public function destroy(VersionControlInterface $client, Project $project, int $id): Response\n {\n return response($client->deleteWebhook($id, $project->repository));\n }", "public function delete($id)\n {\n $_params = array(\"id\" => $id);\n return $this->master->call('webhooks/delete', $_params);\n }", "function cemhub_delete_file($file_name) {\n $successfully_deleted = FALSE;\n\n $file_details = cemhub_retrieve_file_details($file_name);\n if (!empty($file_details)) {\n $successfully_deleted = file_delete($file_details, TRUE);\n }\n else {\n $repository_path = cemhub_get_files_repository_path(TRUE);\n $successfully_deleted = file_unmanaged_delete($repository_path . '/' . $file_name);\n }\n\n if ($successfully_deleted) {\n watchdog('cemhub', 'The file \"' . $file_name . '\" was deleted successfully.');\n }\n else {\n watchdog('cemhub', 'It was not possible to delete file \"' . $file_name . '\", checks the Drupal file log to view more details.');\n }\n\n return $successfully_deleted;\n}", "public function deleteWebhook($webhookId)\n {\n return $this->start()->uri(\"/api/webhook\")\n ->urlSegment($webhookId)\n ->delete()\n ->go();\n }", "public function on_delete() {\n $this->remove_dir();\n }", "public function destroy(Repo $repo)\n {\n }", "public function destroy(Source $source)\n {\n\n $source->delete();\n\n // flash()->success('Source has been deleted.');\n\n return redirect()->route('sources.index');\n }", "public function postReleasedelete(Request $request)\n {\n $eid = $request->only('eid');\n $uname = session('home_login');\n $user = User::where('Ualais','=',$uname)->orWhere('Uemail','=',$uname)->orWhere('Utel','=',$uname)->first();\n $res = Collect::where('eid','=', $eid['eid'])->where('uid','=', $user['Uid'])->delete();\n if($res){\n echo '{\"code\":\"1\",\"data\":\"取消收藏\"}';\n }else{\n echo '{\"code\":\"2\",\"data\":\"取消失败\"}';\n }\n }", "public function delete(): void\n {\n $this->instances->demo()->runHook($this->root(), 'delete:before', $this);\n\n Dir::remove($this->root());\n $this->instances->delete($this->id);\n\n $this->instances->demo()->runHook($this->root(), 'delete:after', $this);\n }", "public function delete_file(){\n\t\t$api_url \t= \"https://api002.backblazeb2.com\";\n\t\t$auth_token = \"4_002147cd01b5a680000000000_018d4c36_d47af5_acct_8SQ4r2LRCypwp1wl0rPo1ySwDm4=\"; \n\t\t$file_id \t= \"4_zd184771c8d50b17b65ba0618_f10273ca4a9b98700_d20190704_m095545_c002_v0001126_t0048\"; \n\t\t$file_name = \"main.html\"; \n\n\t\t$session = curl_init($api_url . \"/b2api/v2/b2_delete_file_version\");\n\t\n\t\t$data = array(\"fileId\" => $file_id, \"fileName\" => $file_name);\n\t\t$post_fields = json_encode($data);\n\t\tcurl_setopt($session, CURLOPT_POSTFIELDS, $post_fields); \n\n\t\t$headers = array();\n\t\t$headers[] = \"Authorization: \" . $auth_token;\n\t\tcurl_setopt($session, CURLOPT_HTTPHEADER, $headers); \n\n\t\tcurl_setopt($session, CURLOPT_POST, true); \n\t\tcurl_setopt($session, CURLOPT_RETURNTRANSFER, true); \n\t\t$server_output = curl_exec($session); \n\t\tcurl_close ($session); \n\t\techo ($server_output); \n\t}", "public function deleteFiles()\r\n {\r\n $fileId = Input::get('FILE');\r\n $file = UploadedFiles::find($fileId);\r\n $path = public_path().'/';\r\n if($file!=null){\r\n $path.=$file->url;\r\n File::delete($path);\r\n $file->delete();\r\n Transaction::createTransaction('','',$file->fileName,'DELETE_FILE','FILE ID: '.$fileId,$file->project_id,'','','','','');\r\n return json_encode($fileId);\r\n }\r\n return \"-1\";\r\n }", "public function delete()\n\t{\n\t\t$this->plugin->setResponse('in delete');\n\t}", "public function delete()\n {\n #HTTP method in uppercase (ie: GET, POST, PATCH, DELETE)\n $sMethod = 'DELETE';\n $sTimeStamp = gmdate('c');\n\n #Creating the hash\n\t\t$oHash = new Hash($this->getSecretKey());\n\t\t$oHash->addData($this->getPublicKey());\n\t\t$oHash->addData($sMethod);\n\t\t$oHash->addData($this->getApiResource());\n\t\t$oHash->addData($this->getData());\n\t\t$oHash->addData($sTimeStamp);\n\n\t\t$sHash = $oHash->hash();\n\n $rCurlHandler = curl_init();\n curl_setopt($rCurlHandler, CURLOPT_URL, $this->getApiRoot() . $this->getApiResource());\n curl_setopt($rCurlHandler, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($rCurlHandler, CURLOPT_CUSTOMREQUEST, $sMethod);\n curl_setopt($rCurlHandler, CURLOPT_SSL_VERIFYPEER, 0);\n curl_setopt($rCurlHandler, CURLOPT_SSL_VERIFYHOST, 0);\n\n curl_setopt($rCurlHandler, CURLOPT_HTTPHEADER, [\n \"x-date: \" . $sTimeStamp,\n \"x-hash: \" . $sHash,\n \"x-public: \" . $this->getPublicKey(),\n \"Content-Type: text/json\",\n ]);\n $sOutput = curl_exec($rCurlHandler);\n $iHTTPCode = curl_getinfo($rCurlHandler, CURLINFO_HTTP_CODE);\n curl_close($rCurlHandler);\n\n Log::write('WebRequest', 'DELETE::REQUEST', $this->getApiRoot() . $this->getApiResource());\n Log::write('WebRequest', 'DELETE::HTTPCODE', $iHTTPCode);\n Log::write('WebRequest', 'DELETE::RESPONSE', $sOutput);\n\n if ($iHTTPCode !== 204) {\n throw new InvalidApiResponse('HttpCode was ' . $iHTTPCode . '. Expected 204');\n }\n return $sOutput;\n }", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public static function delete() {\n\n\n\t\t}", "protected function svnDelete($path) \n {\n $fullPath = sfConfig::get('sf_root_dir') . '/' . $path;\n \n if (file_exists($fullPath))\n {\n $command = 'svn --force delete ' . $fullPath;\n try \n {\n $this->log($this->getFilesystem()->execute($command));\n }\n catch (Exception $e)\n {\n $this->log('Cannot svn delete - try file system delete');\n $command = 'rm ' . $fullPath;\n $this->log($this->getFilesystem()->execute($command));\n }\n \n }\n else\n {\n $this->logBlock('File not found: ' . $fullPath, 'INFO');\n }\n }", "public function delete()\n\t{\n\t\t$data = json_decode(file_get_contents(\"php://input\")); \t \n\t\techo $this->home->delete($data);\n\t\t\n\t}", "function urlDelete(Request $request) {\n $urlFile = env('PBS_KIOSK_DIR').'/urls.list';\n $newContent = '';\n $urlToDel = $request->fName;\n error_log(\"Url to del \" . $urlToDel);\n $contents = file_get_contents($urlFile);\n $parsedLines = preg_split(\"/\\r?\\n|\\r/\", $contents);\n $found = false;\n $rVal = false;\n\n foreach( $parsedLines as $rurl ) {\n if( trim($urlToDel) != trim($rurl) ) { \n $newContent .= $rurl.\"\\r\\n\";\n } else {\n $rVal = true;\n $deleted = $rurl;\n }\n }\n \n // var_dump($newContent);\n if (file_put_contents($urlFile, $newContent)) {\n echo(\"File written\");\n }\n if($rVal) {\n $status = 'OK';\n $msg = \"L'url à été supprimée.\";\n } else {\n $status = 'OK';\n $msg = \"Problème lors de la suppression de l'url\";\n }\n $retVal = array('status' => $status, 'msg' => $msg, 'deleted' => $deleted);\n\n return response()->json($retVal);\n }", "public function deleteAction() {\n $fileID = (int) $this->params()->fromRoute('id', 0);\n $request = $this->getRequest();\n\n if ($fileID and $request->isXmlHttpRequest()) {\n try {\n\n $file = $this->getFileTable()->getFile($fileID);\n $filePath = $this->getOptions()->getUploadFolderPath() . '/' . $file->url;\n\n if (file_exists($filePath)) {\n if (!unlink($filePath)) {\n throw new \\Exception('Could not delete file');\n }\n }\n\n $this->getFileTable()->deleteFile($fileID);\n\n echo json_encode(array('state' => true));\n exit();\n } catch (\\Exception $e) {\n echo json_encode(array('state' => false));\n exit();\n }\n }\n }", "public function purgeAction()\n\t{\n\t\t$this->instanceBucket();\n\n\t\tif ($this->bucket instanceof \\CCloudStorageBucket)\n\t\t{\n\t\t\t$dirFiles = $this->bucket->ListFiles($this->generateUploadDir(), true);\n\n\t\t\t$now = new \\DateTime('now');\n\t\t\tforeach ($dirFiles['file'] as $fileName)\n\t\t\t{\n\t\t\t\tif (preg_match('/^([^_]+)_([0-9]{8})_([^_]+)_.+$/i', $fileName, $parts))\n\t\t\t\t{\n\t\t\t\t\t//$type = $parts[1];\n\t\t\t\t\t//$hash = $parts[3];\n\t\t\t\t\t$date = \\DateTime::createFromFormat('Ymd', $parts[2]);\n\t\t\t\t\t$interval = $now->diff($date);\n\t\t\t\t\tif ($interval->d > self::EXPIRE_DAYS)\n\t\t\t\t\t{\n\t\t\t\t\t\t$this->bucket->DeleteFile($this->generateUploadDir(). $fileName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $this->finishAction();\n\t}", "function deleteSnap($snap_id){\n $ch = curl_init('https://api.digitalocean.com/v2/snapshots/'.$snap_id);\n curl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"DELETE\");\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_HTTPHEADER, [\n 'Authorization: Bearer '.token(),\n 'Content-Type: application/json',\n ]);\n $results = json_decode(curl_exec($ch));\n return $results;\n}", "public function destroy(Request $request,$unique_id)\n {\n BlogPost::where('unique_id',$unique_id)\n ->delete();\n unlink($request->image);\n unlink($request->image_two);\n return redirect('/dashboard/blog-post/manage')->with('message','Post information deleted successfully!');\n }", "public function destroy(Request $request)\n {\n $getinsta = Instagram::where('id', $request->id)->first();\n unlink(public_path('dashbord/image/instagram_image/' . $getinsta->instagram_img));\n Instagram::where('id', $request->id)->delete();\n\n return back()->with('Blog_status', 'Blog Deleted Successfully!');\n }", "protected function deleted()\n {\n $this->response = $this->response->withStatus(204);\n $this->jsonBody($this->payload->getOutput());\n }", "public function delete() {\r\n }", "public function destroy(Source $source)\n {\n $this->source->destroy($source);\n\n return redirect()->route('admin.pipelines.source.index')\n ->withSuccess(trans('core::core.messages.resource deleted', ['name' => trans('pipelines::sources.title.sources')]));\n }", "public function test_get_delete_link() {\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' => 'course.created',\n\t\t) );\n\n\t\t$link = $webhook->get_delete_link();\n\n\t\t$this->assertEquals( 0, strpos( admin_url( 'admin.php?page=llms-settings&tab=rest-api&section=webhooks&revoke-webhook=' . $webhook->get( 'id' ) ), $webhook->get_delete_link() ) );\n\t\tparse_str( wp_parse_url( $link, PHP_URL_QUERY ), $parts );\n\t\t$this->assertTrue( array_key_exists( 'delete-webhook-nonce', $parts ) );\n\n\t}", "protected function deleteWebhookByUrlRequest($webhook)\n {\n // verify the required parameter 'webhook' is set\n if ($webhook === null || (is_array($webhook) && count($webhook) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $webhook when calling deleteWebhookByUrl'\n );\n }\n\n $resourcePath = '/webhook/webhooks';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // body params\n $_tempBody = null;\n if (isset($webhook)) {\n $_tempBody = $webhook;\n }\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['application/json; charset=UTF-8']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n \n if($headers['Content-Type'] === 'application/json') {\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass) {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n // array has no __toString(), so we should encode it manually\n if(is_array($httpBody)) {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));\n }\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n // this endpoint requires OAuth (access token)\n if ($this->config->getAccessToken() !== null) {\n $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();\n }\n // this endpoint requires API key authentication\n $apiKey = $this->config->getApiKeyWithPrefix('x-ultracart-simple-key');\n if ($apiKey !== null) {\n $headers['x-ultracart-simple-key'] = $apiKey;\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'DELETE',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "function branchdelete(array $args, array $assoc_args) {\n $branch_name = array_shift($args);\n $data = array(\n 'refspec' => 'refs/heads/' . $branch_name,\n );\n //TODO: format output\n return $this->terminus_request(\"site\", $this->_siteInfo->site_uuid, \"code-branch\", \"DELETE\", $data);\n }", "public function purge() {}", "public function testRemovePayloadFeature()\n {\n $user = factory(User::class)->create();\n $webhook = factory(Webhook::class)->create(['user_id' => $user->id]);\n $payload = factory(Payload::class)->create(['webhook_id' => $webhook->id, 'content' => 'test remove payload']);\n\n $this->actingAs($user);\n $response = $this->delete(route('webhooks.payloads.destroy', ['webhook' => $webhook, 'payload' => $payload]));\n $this->assertDatabaseMissing('payloads', [\n 'id' => $payload->id,\n 'content' => 'test remove payload',\n 'deleted_at' => null,\n ]);\n $response->assertRedirect(route('webhooks.edit', $webhook));\n $response->assertStatus(302);\n }", "public function destroy($id)\n {\n $data = $this->repoPost->find($id);\n $slug = $this->repoSlug->where('refid',$data->id)->first();\n $slug->delete();\n $data->delete();\n return redirect()->route('post.index')\n ->with('success','Xóa bài viết thành công');\n }", "public function deleteImage($event)\n {\n $this->unlinkFiles($event->sender->{$this->attribute});\n }", "public function executeDelBuddha(sfWebRequest $request) {\r\n\t\t$this->forward404Unless($request->isMethod(sfRequest::POST));\r\n\r\n\t\t$id = $request->getParameter('id');\r\n\t\t$buddha = Doctrine_Core::getTable('BunddlaHall')->findOneById($id);\r\n\t\tif($buddha) {\r\n\t\t\t$buddha->delete();\r\n\t\t\t$this->flashDelSuccess();\r\n\t\t}\r\n\r\n\t\treturn $this->renderText(1);\r\n\t}", "public function actionDelete($id)\r\n {\r\n// $file = Files::findOne($delivery->file_id);\r\n// unlink('uploads/'. $file->name.'.'.$file->ext);\r\n//\r\n// $delFile = new Files();\r\n// $delFile->findModel($delivery->file_id)->delete();\r\n\r\n $model = $this->findModel($id);\r\n\r\n // Delete translate\r\n SourceLangMessage::findOne(['category' => 'backend_'.$model::tableName().'_title','owner_id' => $id])->delete();\r\n $model->delete();\r\n\r\n\r\n return $this->redirect(['index']);\r\n }", "public function destroy(Repository $repository)\n {\n //\n }", "public function action_delete( $params, $action ) {\r\n\r\n\t\tdefine( 'WPMUDEV_REMOTE_SKIP_SYNC', true ); //skip sync, hub remote calls are recorded locally\r\n\r\n\t\tinclude_once( ABSPATH . 'wp-admin/includes/plugin.php' );\r\n\t\tinclude_once( ABSPATH . 'wp-admin/includes/theme.php' );\r\n\t\tinclude_once( ABSPATH . 'wp-admin/includes/file.php' );\r\n\r\n\t\t$deleted = $errors = array(); //init\r\n\r\n\t\t//do plugins\r\n\t\tif ( isset( $params->plugins ) && is_array( $params->plugins ) ) {\r\n\t\t\tforeach ( $params->plugins as $plugin ) {\r\n\t\t\t\tif ( is_numeric( $plugin ) ) {\r\n\t\t\t\t\t$local = WPMUDEV_Dashboard::$site->get_cached_projects( $plugin );\r\n\t\t\t\t\t$filename = $local['filename'];\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$filename = $plugin;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$filename = plugin_basename( sanitize_text_field( $filename ) );\r\n\r\n\t\t\t\t//Check that it's a valid plugin\r\n\t\t\t\t$valid = validate_plugin( $filename );\r\n\t\t\t\tif ( is_wp_error( $valid ) ) {\r\n\t\t\t\t\t$errors[] = array(\r\n\t\t\t\t\t\t'file' => $plugin,\r\n\t\t\t\t\t\t'code' => $valid->get_error_code(),\r\n\t\t\t\t\t\t'message' => $valid->get_error_message()\r\n\t\t\t\t\t);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( is_plugin_active( $filename ) ) {\r\n\t\t\t\t\t$errors[] = array(\r\n\t\t\t\t\t\t'file' => $plugin,\r\n\t\t\t\t\t\t'code' => 'main_site_active',\r\n\t\t\t\t\t\t'message' => __( 'You cannot delete a plugin while it is active on the main site.' )\r\n\t\t\t\t\t);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Check filesystem credentials. `delete_plugins()` will bail otherwise.\r\n\t\t\t\t$url = wp_nonce_url( 'plugins.php?action=delete-selected&verify-delete=1&checked[]=' . $filename, 'bulk-plugins' );\r\n\t\t\t\tob_start();\r\n\t\t\t\t$credentials = request_filesystem_credentials( $url );\r\n\t\t\t\tob_end_clean();\r\n\t\t\t\tif ( false === $credentials || ! WP_Filesystem( $credentials ) ) {\r\n\t\t\t\t\tglobal $wp_filesystem;\r\n\r\n\t\t\t\t\t$error_code = 'fs_unavailable';\r\n\t\t\t\t\t$error = __( 'Unable to connect to the filesystem. Please confirm your credentials.' );\r\n\r\n\t\t\t\t\t// Pass through the error from WP_Filesystem if one was raised.\r\n\t\t\t\t\tif ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {\r\n\t\t\t\t\t\t$error_code = $wp_filesystem->errors->get_error_code();\r\n\t\t\t\t\t\t$error = esc_html( $wp_filesystem->errors->get_error_message() );\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t$errors[] = array(\r\n\t\t\t\t\t\t'file' => $plugin,\r\n\t\t\t\t\t\t'code' => $error_code,\r\n\t\t\t\t\t\t'message' => $error\r\n\t\t\t\t\t);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$result = delete_plugins( array( $filename ) );\r\n\r\n\t\t\t\tif ( true === $result ) {\r\n\t\t\t\t\twp_clean_plugins_cache( false );\r\n\t\t\t\t\tWPMUDEV_Dashboard::$site->schedule_shutdown_refresh();\r\n\t\t\t\t\t//also refresh local data because reinstallation is not possible until the cache is refreshed.\r\n\t\t\t\t\tWPMUDEV_Dashboard::$site->refresh_local_projects( 'local' );\r\n\t\t\t\t\t$deleted[] = array( 'file' => $plugin );\r\n\t\t\t\t} elseif ( is_wp_error( $result ) ) {\r\n\t\t\t\t\t$errors[] = array(\r\n\t\t\t\t\t\t'file' => $plugin,\r\n\t\t\t\t\t\t'code' => $result->get_error_code(),\r\n\t\t\t\t\t\t'message' => $result->get_error_message()\r\n\t\t\t\t\t);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$errors[] = array(\r\n\t\t\t\t\t\t'file' => $plugin,\r\n\t\t\t\t\t\t'code' => 'unknown_error',\r\n\t\t\t\t\t\t'message' => __( 'Plugin could not be deleted.' )\r\n\t\t\t\t\t);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//do themes\r\n\t\tif ( isset( $params->themes ) && is_array( $params->themes ) ) {\r\n\t\t\tforeach ( $params->themes as $theme ) {\r\n\t\t\t\tif ( is_numeric( $theme ) ) {\r\n\t\t\t\t\t$local = WPMUDEV_Dashboard::$site->get_cached_projects( $theme );\r\n\t\t\t\t\t$slug = $local['slug'];\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$slug = $theme;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//wp_get_theme does not return an error for empty slugs\r\n\t\t\t\tif ( empty( $slug ) ) {\r\n\t\t\t\t\t$slug = \"wpmudev_theme_$theme\";\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//check that this is a valid theme\r\n\t\t\t\t$check_theme = wp_get_theme( $slug );\r\n\t\t\t\tif ( ! $check_theme->exists() ) {\r\n\t\t\t\t\t$errors[] = array(\r\n\t\t\t\t\t\t'file' => $theme,\r\n\t\t\t\t\t\t'code' => $check_theme->errors()->get_error_code(),\r\n\t\t\t\t\t\t'message' => $check_theme->errors()->get_error_message()\r\n\t\t\t\t\t);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Check filesystem credentials. `delete_theme()` will bail otherwise.\r\n\t\t\t\t$url = wp_nonce_url( 'themes.php?action=delete&stylesheet=' . urlencode( $slug ), 'delete-theme_' . $slug );\r\n\t\t\t\tob_start();\r\n\t\t\t\t$credentials = request_filesystem_credentials( $url );\r\n\t\t\t\tob_end_clean();\r\n\t\t\t\tif ( false === $credentials || ! WP_Filesystem( $credentials ) ) {\r\n\t\t\t\t\tglobal $wp_filesystem;\r\n\r\n\t\t\t\t\t$error_code = 'fs_unavailable';\r\n\t\t\t\t\t$error = __( 'Unable to connect to the filesystem. Please confirm your credentials.' );\r\n\r\n\t\t\t\t\t// Pass through the error from WP_Filesystem if one was raised.\r\n\t\t\t\t\tif ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {\r\n\t\t\t\t\t\t$error_code = $wp_filesystem->errors->get_error_code();\r\n\t\t\t\t\t\t$error = esc_html( $wp_filesystem->errors->get_error_message() );\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t$errors[] = array(\r\n\t\t\t\t\t\t'file' => $theme,\r\n\t\t\t\t\t\t'code' => $error_code,\r\n\t\t\t\t\t\t'message' => $error\r\n\t\t\t\t\t);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$result = delete_theme( $slug );\r\n\r\n\t\t\t\tif ( is_wp_error( $result ) ) {\r\n\t\t\t\t\t$errors[] = array(\r\n\t\t\t\t\t\t'file' => $theme,\r\n\t\t\t\t\t\t'code' => $result->get_error_code(),\r\n\t\t\t\t\t\t'message' => $result->get_error_message()\r\n\t\t\t\t\t);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t} elseif ( false === $result ) {\r\n\t\t\t\t\t$errors[] = array(\r\n\t\t\t\t\t\t'file' => $theme,\r\n\t\t\t\t\t\t'code' => 'unknown_error',\r\n\t\t\t\t\t\t'message' => __( 'Theme could not be deleted.' )\r\n\t\t\t\t\t);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tWPMUDEV_Dashboard::$site->schedule_shutdown_refresh();\r\n\t\t\t\t$deleted[] = array( 'file' => $theme );\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif ( count( $deleted ) ) {\r\n\t\t\t$this->send_json_success( compact( 'deleted', 'errors' ) );\r\n\t\t} else {\r\n\t\t\t$this->send_json_error( compact( 'deleted', 'errors' ) );\r\n\t\t}\r\n\t}", "public function testRemovePayloadUnauthorizedFeature()\n {\n $user = factory(User::class)->create();\n $webhook = factory(Webhook::class)->create(['user_id' => $user->id]);\n $payload = factory(Payload::class)->create(['webhook_id' => $webhook->id, 'content' => 'test remove payload fail']);\n $response = $this->delete(route('webhooks.payloads.destroy', ['webhook' => $webhook, 'payload' => 1]));\n\n $response->assertLocation('/');\n $response->assertStatus(302);\n }", "public function delete(){\n $this->probe_requests()->detach();\n\n // Delete the event itself\n $result = parent::delete();\n\n return $result;\n }", "public function delete()\n {\n\n $file_name = public_path() . \"/jobs/\" . md5($this->user->uid) . \"/\" . md5($this->uid) . '.zip';\n \\Illuminate\\Support\\Facades\\Log::debug($file_name);\n if(file_exists($file_name))\n unlink($file_name);\n return parent::delete(); // TODO: Change the autogenerated stub\n }", "public function testDelete(): void\n {\n $this->markTestSkipped('Skipping as PostsService::delete() is not yet ready for prod/testing');\n $this->mock(PostsRepository::class, static function ($mock) {\n $mock->shouldReceive('find')->with(123)->andReturn(new Post());\n $mock->shouldReceive('delete')->with(123)->andReturn(true);\n });\n\n $service = resolve(PostsService::class);\n\n $this->expectsEvents(BlogPostWillBeDeleted::class);\n\n $response = $service->delete(123);\n\n $this->assertIsArray($response);\n }", "public function destroy(Request $request)\n {\n $project = project::findOrFail($request->project_id);\n $file = ProjectAttachments::where('project_id', $request->project_id)->first();\n if ($project->images) {\n Storage::disk('projects_uploads')->deleteDirectory($project->name);\n }\n $project->delete();\n session()->flash('delete', 'Projet supprimé');\n return redirect('/project');\n }", "public function DELETE() {\n #\n }", "public function deleteQueuedSourceFiles()\n\t{\n\t\tforeach ($this->_sourcesToBeDeleted as $source)\n\t\t{\n\t\t\tIOHelper::deleteFile($source, true);\n\t\t}\n\t}", "public function delete()\n {\n foreach ($this->versions as $version)\n {\n $version->delete();\n }\n\n parent::delete();\n }", "public function delete()\n {\n $this->repository->delete($this->id);\n }", "function remove_client_dir(){\n\t\t$cmd=\"rm -rf $this->client_dir\";\n\t\t`$cmd`;\n\t}", "function delBuildingHandler() {\n global $inputs;\n $sql = \"DELETE FROM building WHERE id = \" . $inputs['id'];\n execSql($sql);\n formatOutput(true, 'delete success');\n}", "public function delete()\n {\n global $_PM_;\n $api = 'handler_'.$this->handler.'_api';\n $this->api = new $api($_PM_, PHM_API_UID, $this->principalId);\n $this->api->remove_item($this->item['id']);\n }", "public function destroy($id)\n {\n $repository = Repository::find($id);\n $repository->delete();\n }", "public function deleting()\n {\n # code...\n }", "public function delAction(Request $request)\n {\n $id = (int)$request->get(\"id\");\n if (!$id) {\n return $this->getJsonResponse(1, \"id参数为空!\");\n }\n $em = $this->getDoctrine()->getManager();\n $entity = $em->getRepository('QihooToolBundle:AutoDownUrl')->find($id);\n if (!$entity) {\n return $this->getJsonResponse(2, \"id ($id) 在数据库不存在!(是否已经删除?)\");\n }\n $em->remove($entity);\n $em->flush();\n return $this->getJsonResponse(0, \"\"); //删除成功\n }", "public function actionDeleteimage()\n {\n $this->enableCsrfValidation = false;\n $filename = Yii::$app->request->post('filename');\n $path_name = \"../web/web_mat/temp/\" . $filename;\n if (unlink($path_name)) {\n echo \"success\";\n } else {\n echo \"fail\";\n }\n }", "public function call_api_delete(){\n$ch = curl_init('http://localhost:8001/api/users/....');\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLINFO_HEADER_OUT, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"DELETE\");\n\n// Submit the DELETE request\n$result = curl_exec($ch);\n\n//Close cURL session handle\ncurl_close($ch);\necho \"Deleted\"; \n }", "public function delete()\n {\n \n }", "public function destroy(Request $request)\n {\n $webSample = WebSample::findOrFail($request->id);\n \n if(Helper::manage_web_tags($webSample->id)) {\n if($webSample->delete()) {\n if($webSample->image) {\n // sample has image\n if(File::delete(public_path($webSample->image))) {\n // Success\n return redirect()->route('websamples.index')->with(['message'=>'حذف با موفقیت انجام شد.','type'=>'alert-success']);\n } else {\n // file delete failed\n return redirect()->route('websamples.index')->with(['message'=>'خطا در حذف تصویر.','type'=>'alert-danger']);\n }\n } else {\n // Success\n return redirect()->route('websamples.index')->with(['message'=>'حذف با موفقیت انجام شد.','type'=>'alert-success']);\n }\n } else {\n // websample->delete() failed\n return redirect()->route('websamples.index')->with(['message' => 'خطا در حذف نمونه کار.', 'type' => 'alert-danger']);\n }\n } else {\n // manage_web_tags failed\n return redirect()->route('websamples.index')->with(['message' => 'خطا در حذف تگ ها', 'type' => 'alert-danger']);\n }\n\n }", "public function deleteAction() {\n\t\tif(!isset($this->params['cancel'])) {\n\n\t\t\t// XXX: Maybe do some hook call validation here?\n\n\t\t\t// auto call the hooks for this module/action\n\t\t\tAPI::callHooks(self::$module, $this->action, 'controller', $this);\n\n\t\t\t// delete an entry\n\t\t\t$host = $this->_model->delete();\n\t\t}\n\t\tAPI::redirect(API::printUrl($this->_redirect));\n\t}", "public function purge();", "public function purge();", "public function purge();", "public function removeAction() {\n $result = array('status' => 'failed');\n if ($this->getRequest()->isPost() && $this->getRequest()->getPost('remove') == 'true') {\n $dirName = Mage::getBaseDir('code').'/local/Balticode/Postoffice';\n if (is_dir($dirName) && file_exists($dirName.'/etc/config.xml')) {\n $directory = new Varien_Io_File();\n $deleteResult = $directory->rmdir($dirName, true);\n if ($deleteResult) {\n $result['status'] = 'success';\n }\n }\n \n }\n $this->getResponse()->setRawHeader('Content-type: application/json');\n $this->getResponse()->setBody(json_encode($result));\n return;\n }", "public function destroy(Request $request)\n {\n $request->validate([\n 'url' => 'required|url'\n ]);\n\n $code = explode('/', $request->input('url'));\n $code = end($code);\n $deletedRows = ShortLink::where('code', $code)->delete();\n\n if($deletedRows) {\n return $this->sendResponse('', 'URL deleted')->setStatusCode(200);\n } else {\n return $this->sendError('URL not found')->setStatusCode(404);\n }\n }", "public function delete($event): void;" ]
[ "0.68165326", "0.6486731", "0.6075549", "0.60054916", "0.59860814", "0.5821129", "0.5802665", "0.5759841", "0.5753529", "0.57513994", "0.57409286", "0.5642372", "0.5635392", "0.56314033", "0.56249815", "0.56241983", "0.56241983", "0.562143", "0.56206894", "0.55602235", "0.5518715", "0.55019855", "0.548671", "0.548671", "0.54640007", "0.5450669", "0.5425502", "0.5421385", "0.542013", "0.5419003", "0.53886795", "0.5377474", "0.53734493", "0.53686994", "0.53656346", "0.5353517", "0.5337809", "0.5337681", "0.5337681", "0.5337681", "0.5337681", "0.5337681", "0.5337681", "0.5337681", "0.5337681", "0.5337681", "0.5337681", "0.5337681", "0.5337681", "0.5337681", "0.5337681", "0.5337681", "0.5336264", "0.5331238", "0.5328681", "0.5301817", "0.52926046", "0.52923036", "0.52895343", "0.52861935", "0.52850103", "0.52818125", "0.52752155", "0.5263074", "0.5257874", "0.5255061", "0.5247358", "0.52444607", "0.52430546", "0.5242975", "0.52382684", "0.52367175", "0.52326244", "0.5224633", "0.522307", "0.52213174", "0.52190495", "0.5214586", "0.5213303", "0.5212011", "0.51982814", "0.51929015", "0.5192659", "0.51906973", "0.51831126", "0.51810896", "0.5180169", "0.51778996", "0.51752263", "0.51721644", "0.5168689", "0.51672745", "0.51650757", "0.5163429", "0.51632804", "0.5157552", "0.5157552", "0.5157552", "0.51565355", "0.51544297", "0.5154349" ]
0.0
-1
Do all checks to verify that the webhook is expected and actually ours
public function validateWebhook($webhookBody) { $data = json_decode($webhookBody, true); /** @var \helper_plugin_issuelinks_db $db */ $db = plugin_load('helper', 'issuelinks_db'); $webhooks = $db->getWebhooks('jira'); $projects = []; if (!empty($webhooks)) { // get current webhook projects $projects = explode(',', $webhooks[0]['repository_id']); } if (!$data['webhookEvent'] || !in_array($data['webhookEvent'], ['jira:issue_updated', 'jira:issue_created'])) { return new RequestResult(400, 'unknown webhook event'); } list($projectKey, $issueId) = explode('-', $data['issue']['key']); if (!in_array($projectKey, $projects)) { return new RequestResult(202, 'Project ' . $projectKey . ' is not handled by this wiki.'); } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function check_for_webhook() {\n\t\tif ( ( 'POST' !== $_SERVER['REQUEST_METHOD'] )\n\t\t\t|| ! isset( $_GET['wc-api'] )\n\t\t\t|| ( 'wc_stripe' !== $_GET['wc-api'] )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t$request_body = file_get_contents( 'php://input' );\n\t\t$request_headers = array_change_key_case( $this->get_request_headers(), CASE_UPPER );\n\n\t\t// Validate it to make sure it is legit.\n\t\tif ( $this->is_valid_request( $request_headers, $request_body ) ) {\n\t\t\t$this->process_webhook( $request_body );\n\t\t\tstatus_header( 200 );\n\t\t\texit;\n\t\t} else {\n\t\t\tWC_Stripe_Logger::log( 'Incoming webhook failed validation: ' . print_r( $request_body, true ) );\n\t\t\tstatus_header( 400 );\n\t\t\texit;\n\t\t}\n\t}", "public function validateWebhookCall()\n {\n // If the webhook was called with an invalid method, throw an error\n if($_SERVER['REQUEST_METHOD'] != 'POST'){\n die(json_encode([\n 'success' => false,\n 'error' => 'invalid_method',\n ]));\n }\n\n // If the webhook was called without any auth header, throw another error\n if (!isset($_SERVER['HTTP_AUTHORIZATION']) || empty($_SERVER['HTTP_AUTHORIZATION'])) {\n die(json_encode([\n 'success' => false,\n 'error' => 'no_auth_header',\n ]));\n }\n\n if($_SERVER['HTTP_AUTHORIZATION'] != Config::i()->getSXApiKey()){\n die(json_encode([\n 'success' => false,\n 'error' => 'invalid_auth',\n ]));\n }\n }", "public function testPostWebhooks()\n {\n }", "public function webhook()\n {\n $bodyReceived = file_get_contents('php://input');\n\n // Receive HTTP headers that you received from PayPal webhook.\n $headers = getallheaders();\n\n /**\n * Uppercase all the headers for consistency\n */\n $headers = array_change_key_case($headers, CASE_UPPER);\n\n $signatureVerification = new \\PayPal\\Api\\VerifyWebhookSignature();\n $signatureVerification->setWebhookId(env('PAYPAL_WEBHOOK_ID'));\n $signatureVerification->setAuthAlgo($headers['PAYPAL-AUTH-ALGO']);\n $signatureVerification->setTransmissionId($headers['PAYPAL-TRANSMISSION-ID']);\n $signatureVerification->setCertUrl($headers['PAYPAL-CERT-URL']);\n $signatureVerification->setTransmissionSig($headers['PAYPAL-TRANSMISSION-SIG']);\n $signatureVerification->setTransmissionTime($headers['PAYPAL-TRANSMISSION-TIME']);\n\n $webhookEvent = new \\PayPal\\Api\\WebhookEvent();\n $webhookEvent->fromJson($bodyReceived);\n $signatureVerification->setWebhookEvent($webhookEvent);\n $request = clone $signatureVerification;\n\n try {\n $output = $signatureVerification->post($this->apiContext);\n } catch(\\Exception $ex) {\n print_r($ex->getMessage());\n exit(1);\n }\n\n $verificationStatus = $output->getVerificationStatus();\n $responseArray = json_decode($request->toJSON(), true);\n\n $event = $responseArray['webhook_event']['event_type'];\n\n if ($verificationStatus == 'SUCCESS')\n {\n switch($event)\n {\n case 'BILLING.SUBSCRIPTION.CANCELLED':\n case 'BILLING.SUBSCRIPTION.SUSPENDED':\n case 'BILLING.SUBSCRIPTION.EXPIRED':\n case 'BILLING_AGREEMENTS.AGREEMENT.CANCELLED':\n\n // $user = User::where('payer_id',$responseArray['webhook_event']['resource']['payer']['payer_info']['payer_id'])->first();\n $this->updateStatus($responseArray['webhook_event']['resource']['payer']['payer_info']['payer_id'], 0);\n break;\n }\n }\n echo $verificationStatus;\n exit(0);\n }", "public function webhook():bool\n {\n\n }", "public function sanityCheck()\n {\n $request = new Request;\n $request->setUrl(\"sanityCheck\");\n $request->setMethod(\"POST\");\n $this->populateMetadata($request);\n $response = $this->send($request);\n return $response->getRawResponse()->code === 200;\n }", "private function checkWebhooks()\n {\n if (!$this->getWebhooksList()) {\n Log::info(\"ShopifyApi.checkWebhooks: register webhooks\");\n\n // create webhooks for uninstalling app\n $this->createAppWebhooks();\n\n } else {\n Log::info(\"ShopifyApi.checkWebhooks: webhooks are already registered\");\n }\n }", "public function verifyRequest()\n {\n }", "public function verifyWebhook($request)\n {\n return $request['RDG_WH_SIGNATURE'] === hash_hmac(\n 'sha256',\n $request['order']['transaction_id'] . $request['status'],\n $this->secret\n );\n }", "public function webhook(Request $request)\n {\n $verified = Flutterwave::verifyWebhook();\n \n // if it is a charge event, verify and confirm it is a successful transaction\n if ($verified && $request->event == 'charge.completed' && $request->data->status == 'successful') {\n $verificationData = Flutterwave::verifyPayment($request->data['id']);\n if ($verificationData['status'] === 'success') {\n // process for successful charge\n \n }\n \n }\n \n // if it is a transfer event, verify and confirm it is a successful transfer\n if ($verified && $request->event == 'transfer.completed') {\n \n $transfer = Flutterwave::transfers()->fetch($request->data['id']);\n \n if($transfer['data']['status'] === 'SUCCESSFUL') {\n // update transfer status to successful in your db\n } else if ($transfer['data']['status'] === 'FAILED') {\n // update transfer status to failed in your db\n // revert customer balance back\n } else if ($transfer['data']['status'] === 'PENDING') {\n // update transfer status to pending in your db\n }\n \n }\n }", "public function webhook()\n {\n $this->paymentSettings = $this->getPaymentSettings();\n $payload = file_get_contents(\"php://input\");\n $signature = (isset($_SERVER['HTTP_X_PAYSTACK_SIGNATURE']) ? $_SERVER['HTTP_X_PAYSTACK_SIGNATURE'] : '');\n /* It is a good idea to log all events received. Add code *\n * here to log the signature and body to db or file */\n if (!$signature) {\n // only a post with paystack signature header gets our attention\n exit();\n }\n // confirm the event's signature\n if ($signature !== hash_hmac('sha512', $payload, $this->paymentSettings['secret_key'])) {\n // silently forget this ever happened\n exit();\n }\n $webhook_response = json_decode($payload, true);\n if ('charge.success' != $webhook_response['event']) {\n exit;\n }\n try {\n $orderId = $this->updatePaymentStatus($webhook_response['data']['reference']);\n } catch (Exception $e) {\n // Invalid payload\n http_response_code(400);\n exit();\n }\n http_response_code(200);\n exit();\n }", "public function testGetWebhook()\n {\n $container = [];\n $sw = $this->createMockedSmartwaiver($container, APISuccessResponses::webhooks());\n\n $webhook = $sw->getWebhookConfig();\n $this->assertInstanceOf(SmartwaiverWebhook::class, $webhook);\n\n $this->checkGetRequests($container, ['/v4/webhooks/configure']);\n }", "function verify_webhook($data, $hmac_header)\n{\n $calculated_hmac = base64_encode(hash_hmac('sha256', $data, SHOPIFY_APP_SECRET, true));\n return hash_equals($hmac_header, $calculated_hmac);\n}", "public function validateWebHook($apiContext, $bodyReceived)\n {\n try\n {\n\n if (!$this->webHokId)\n {\n throw new \\Exception('no PAYPAL_WEBHOOK_ID');\n }\n\n /**\n * Receive HTTP headers that you received from PayPal webhook.\n */\n // getallheaders will cause fatal error, don't know why\n // $headers = getallheaders();\n\n $headers = [];\n foreach ($_SERVER as $name => $value)\n {\n if (substr($name, 0, 5) == 'HTTP_')\n {\n $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;\n }\n }\n /**\n * In Documentions https://developer.paypal.com/docs/api/webhooks/#verify-webhook-signature_post\n * All header keys as UPPERCASE, but I recive the header key as the example array, First letter as UPPERCASE\n */\n $headers = array_change_key_case($headers, CASE_UPPER);\n\n $signatureVerification = new VerifyWebhookSignature();\n $signatureVerification->setAuthAlgo($headers['PAYPAL-AUTH-ALGO']);\n $signatureVerification->setTransmissionId($headers['PAYPAL-TRANSMISSION-ID']);\n $signatureVerification->setCertUrl($headers['PAYPAL-CERT-URL']);\n $signatureVerification->setWebhookId($this->webHokId); // Note that the Webhook ID must be a currently valid Webhook that you created with your client ID/secret.\n $signatureVerification->setTransmissionSig($headers['PAYPAL-TRANSMISSION-SIG']);\n $signatureVerification->setTransmissionTime($headers['PAYPAL-TRANSMISSION-TIME']);\n\n // setWebhookEvent is deprecated, should use setRequestBody\n // but older version payapl sdk does not have setRequestBody\n if (method_exists($signatureVerification, 'setRequestBody'))\n {\n $signatureVerification->setRequestBody($bodyReceived);\n }\n elseif (method_exists($signatureVerification, 'setWebhookEvent'))\n {\n $webhookEvent = new WebhookEvent();\n $webhookEvent->fromJson($bodyReceived);\n $signatureVerification->setWebhookEvent($webhookEvent);\n }\n\n /** @var \\PayPal\\Api\\VerifyWebhookSignatureResponse $output */\n $output = $signatureVerification->post($apiContext);\n // be careful, if paypal sdk version is different between forumhosting and siteowners\n // here will be FAILURE\n if ($output->verification_status == 'FAILURE')\n {\n throw new \\Exception('[VerifyWebhookSignatureResponse FAILURE]');\n }\n return true;\n } catch (\\Exception $e)\n {\n \\Log::error('[Validation Failed]:'.$e->getMessage(). \"[$bodyReceived]\");\n throw new \\Exception('[Validation Failed]' . $e->getMessage());\n }\n }", "public function validate_webhook($params) {\n\n $sig = $params['signature'];\n unset($params['signature']);\n\n if (!isset($sig)) {\n return false;\n }\n\n $data = array(\n 'data' => $params,\n 'secret' => $this->account_details['app_secret'],\n 'signature' => $sig\n );\n\n return $this->validate_signature($data);\n\n }", "public function testGetWebhook()\n {\n }", "function check_esewa_response_is_valid() {\n\t\t\tglobal $woocommerce;\n\n\t\t\tif ( 'yes' === $this->debug ) {\n\t\t\t\t$this->log->add( 'esewa', 'Checking eSewa response is valid...' );\n\t\t\t}\n\n\t\t\tif ( 'yes' === $this->testmode ) {\n\t\t\t\t$esewa_adr = $this->testurl_verification;\n\t\t\t} else {\n\t\t\t\t$esewa_adr = $this->liveurl_verification;\n\t\t\t}\n\n\t\t\t$_REQUEST = stripslashes_deep( $_REQUEST );\n\n\t\t\t$params = array(\n 'amt' => $_REQUEST['amt'],\n 'pid' => $_REQUEST['oid'],\n 'rid' => $_REQUEST['refId'],\n 'scd' => $this -> merchant,\n\t\t\t);\n\n\t\t\tif ( 'yes' === $this->debug ) {\n\t\t\t\t$this->log->add( 'esewa', 'Request Parameters: ' . print_r( $params, true ) );\n\t\t\t}\n\n\t\t\t$received_values = $params;\n\n\t\t\t$eparams = array(\n 'body' => $received_values,\n 'sslverify' => false,\n 'timeout' => 60,\n 'httpversion' => '1.1',\n 'user-agent' => 'WooCommerce/' . $woocommerce->version,\n\t\t\t);\n\t\t\t$response = wp_remote_post( $esewa_adr, $eparams );\n\n\t\t\tif ( 'yes' === $this->debug ) {\n\t\t\t\t$this->log->add( 'esewa', 'eSewa Response: ' . print_r( $response, true ) );\n\t\t\t}\n\n\t\t\t// check to see if the request was valid.\n\t\t\tif ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {\n\t\t\t\tif ( 'yes' === $this->debug ) {\n\t\t\t\t\t$this->log->add( 'esewa', 'Received valid response from eSewa' );\n\t\t\t\t}\n\n\t\t\t\t// Check response code.\n\t\t\t\t$body = wp_remote_retrieve_body( $response );\n\t\t\t\t$esewa_response_code = trim( strip_tags( $body ) );\n\t\t\t\tif ( ! empty( $esewa_response_code ) ) {\n\t\t\t\t\t$esewa_response_code = strtolower( $esewa_response_code );\n\t\t\t\t}\n\t\t\t\tif ( 'success' === $esewa_response_code ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t} // End if.\n\n\t\t\tif ( 'yes' === $this->debug ) {\n\t\t\t\t$this->log->add( 'esewa', 'Received invalid response from eSewa' );\n\t\t\t\tif ( is_wp_error( $response ) ) {\n\t\t\t\t\t$this->log->add( 'esewa', 'Error response: ' . $response->get_error_message() );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\n\t\t}", "public function testGetWebhooks()\n {\n }", "public function handle_webhook() {\n\t\t$payload = file_get_contents( 'php://input' );\n\t\tif ( ! empty( $payload ) && $this->validate_webhook( $payload ) ) {\n\t\t\t$data = json_decode( $payload, true );\n\t\t\t$event_data = $data['event']['data'];\n\n\t\t\tself::log( 'Webhook received event: ' . print_r( $data, true ) );\n\n\t\t\tif ( ! isset( $event_data['metadata']['order_id'] ) ) {\n\t\t\t\t// Probably a charge not created by us.\n\t\t\t\texit;\n\t\t\t}\n\n\t\t\t$order_id = $event_data['metadata']['order_id'];\n\n\t\t\t$this->_update_order_status( wc_get_order( $order_id ), $event_data['timeline'] );\n\n\t\t\texit; // 200 response for acknowledgement.\n\t\t}\n\n\t\twp_die( 'Coinbase Webhook Request Failure', 'Coinbase Webhook', array( 'response' => 500 ) );\n\t}", "public function webhookAction()\n {\n $modelWebhook = Mage::getModel('chargepayment/webhook');\n\n $isDebugCard = Mage::getModel('chargepayment/creditCard')->isDebug();\n $isDebugJs = Mage::getModel('chargepayment/creditCardJs')->isDebug();\n $isDebugKit = Mage::getModel('chargepayment/creditCardKit')->isDebug();\n $isDebugHosted = Mage::getModel('chargepayment/hosted')->isDebug();\n\n $isDebug = $isDebugCard || $isDebugJs || $isDebugKit || $isDebugHosted ? true : false;\n\n if ($isDebug) {\n Mage::log(file_get_contents('php://input'), null, CheckoutApi_ChargePayment_Model_Webhook::LOG_FILE);\n Mage::log(json_decode(file_get_contents('php://input')), null, CheckoutApi_ChargePayment_Model_Webhook::LOG_FILE);\n }\n\n if (!$this->getRequest()->isPost()) {\n $this->getResponse()->setHttpResponseCode(400);\n return;\n }\n\n $request = new Zend_Controller_Request_Http();\n $key = $request->getHeader('Authorization');\n\n if (!$modelWebhook->isValidPublicKey($key)) {\n $this->getResponse()->setHttpResponseCode(401);\n return;\n }\n\n $data = json_decode(file_get_contents('php://input'));\n\n if (empty($data)) {\n $this->getResponse()->setHttpResponseCode(400);\n return;\n }\n\n $eventType = $data->eventType;\n\n if (!$modelWebhook->isValidResponse($data)) {\n $this->getResponse()->setHttpResponseCode(400);\n return;\n }\n\n switch ($eventType) {\n case CheckoutApi_ChargePayment_Model_Webhook::EVENT_TYPE_CHARGE_CAPTURED:\n $result = $modelWebhook->captureOrder($data);\n break;\n case CheckoutApi_ChargePayment_Model_Webhook::EVENT_TYPE_CHARGE_REFUNDED:\n $result = $modelWebhook->refundOrder($data);\n break;\n case CheckoutApi_ChargePayment_Model_Webhook::EVENT_TYPE_CHARGE_VOIDED:\n $result = $modelWebhook->voidOrder($data);\n break;\n case CheckoutApi_ChargePayment_Model_Webhook::EVENT_TYPE_INVOICE_CANCELLED:\n $result = $modelWebhook->voidOrder($data);\n break;\n default:\n $this->getResponse()->setHttpResponseCode(500);\n return;\n }\n\n $httpCode = $result ? 200 : 400;\n\n $this->getResponse()->setHttpResponseCode($httpCode);\n }", "public function check_response() {\n\n\t\t// To test in live mode ($_post)\n\t\t$post = ( file_get_contents( 'php://input' ) );\n\n\t\tif ( ! empty( $post ) ) {\n\t\t\tdo_action( 'valid-oyst-one-click-request', $post );\n\t\t\texit;\n\t\t}\n\t\tWC_Oyst_One_Click::log( 'Retour One Click vide', 'error' );\n\t\twp_die( 'Erreur de requête One Click', '1-Click', array( 'response' => 500 ) );\n\n\t}", "public function validateWebhook($webhookBody)\n {\n global $INPUT;\n $requestToken = $INPUT->server->str('HTTP_X_GITLAB_TOKEN');\n\n $data = json_decode($webhookBody, true);\n dbglog($data, __FILE__ . ': ' . __LINE__);\n $project = $data['project']['path_with_namespace'];\n\n /** @var \\helper_plugin_issuelinks_db $db */\n $db = plugin_load('helper', 'issuelinks_db');\n $secrets = array_column($db->getWebhookSecrets('gitlab', $project), 'secret');\n $tokenMatches = false;\n foreach ($secrets as $secret) {\n if ($secret === $requestToken) {\n $tokenMatches = true;\n break;\n }\n }\n\n if (!$tokenMatches) {\n return new RequestResult(403, 'Token does not match!');\n }\n\n return true;\n }", "public function validateWebhook(Request $request)\n {\n $calculatedHmac = base64_encode(hash_hmac('sha256', $request->getContent(), $this->shopifyApiSecret, true));\n return hash_equals($request->headers->get('X-Shopify-Hmac-SHA256'), $calculatedHmac);\n }", "public function webhook(){\r\n\t\t\r\n\t\t$json = array();\r\n\r\n\t\tif($this->request->server['REQUEST_METHOD'] == 'POST'){\r\n\t\t\t\r\n\t\t\t$post = array();\r\n\t\t\tif(isset($this->request->post['coin_short_name']) && $this->request->post['coin_short_name'] != '' && isset($this->request->post['address']) && $this->request->post['address'] != '' && isset($this->request->post['type']) && $this->request->post['type'] != ''){\r\n\t\t\t\t$post = $this->request->post;\r\n\t\t\t}else{\r\n\t\t\t\t$post_json = json_decode(file_get_contents('php://input'),TRUE);\r\n\r\n\t\t\t\tif(isset($post_json['coin_short_name']) && $post_json['coin_short_name'] != '' && isset($post_json['address']) && $post_json['address'] != '' && isset($post_json['type']) && $post_json['type'] != '' ){\r\n\t\t\t\t\t$post = $post_json;\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t$json['msg'] = \"Required paramters are not found\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(!empty($post)){\r\n\r\n\t\t\t\tif($post['type'] == 'receive'){\r\n\t\t\t\t\t$this->load->model('checkout/order');\r\n\r\n\t\t\t\t\t$address = $post['address'];\r\n\r\n\t\t\t\t\t/*** check if address exists in oc_coinremitter_order ***/\r\n\t\t\t\t\t$this->load->model('extension/coinremitter/payment/coinremitter');\r\n\t\t\t\t\t$order_info = $this->model_extension_coinremitter_payment_coinremitter->getOrderByAddress($address);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(!empty($order_info)){\r\n\r\n\t\t\t\t\t\tif($order_info['payment_status'] == 'pending' || $order_info['payment_status'] == 'under paid'){\r\n\r\n\t\t\t\t\t\t\t$orderId = $order_info['order_id'];\r\n\r\n\t\t\t\t\t\t\t$order_cart = $this->model_checkout_order->getOrder($orderId);\r\n\t\t\t\t\t\t\tif(!empty($order_cart)){\r\n\r\n\t\t\t\t\t\t\t\t/*** check if expired time of invoice is defined or not. If defined then check if invoice has any transaction or not. If no transaction is found and invoice time is expired then change invoice status as expired ***/\r\n\r\n\t\t\t\t\t\t\t\t/*** Get webhook by address***/\r\n\t\t\t\t\t\t\t\t$status = '';\r\n\t\t\t\t\t\t\t\tif(isset($order_info['expire_on']) && $order_info['expire_on'] != ''){\r\n\t\t\t\t\t\t\t\t\tif(time() >= strtotime($order_info['expire_on'])){\r\n\t\t\t\t\t\t\t\t\t\t$getWebhookByAddressRes = $this->model_extension_coinremitter_payment_coinremitter->getWebhookByAddress($address);\t\r\n\t\t\t\t\t\t\t\t\t\tif(empty($getWebhookByAddressRes)){\r\n\t\t\t\t\t\t\t\t\t\t\t//update payment_status,status as expired\r\n\t\t\t\t\t\t\t\t\t\t\t$status = 'expired';\r\n\t\t\t\t\t\t\t\t\t\t\t$update_arr = array('payment_status' => $status);\r\n\t\t\t\t\t\t\t\t\t\t\t$this->model_extension_coinremitter_payment_coinremitter->updateOrder($orderId,$update_arr);\r\n\t\t\t\t\t\t\t\t\t\t\t$update_arr = array('status' => ucfirst($status));\r\n\t\t\t\t\t\t\t\t\t\t\t$this->model_extension_coinremitter_payment_coinremitter->updatePaymentStatus($orderId,$update_arr);\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tif($order_cart['order_status'] != 'Canceled'){\r\n\t\t\t\t\t\t\t\t\t\t\t\t/*** Update order history status to canceled, add comment ***/\r\n\t\t\t\t\t\t $comments = 'Order #'.$orderId;\r\n\t\t\t\t\t\t $is_customer_notified = true;\r\n\t\t\t\t\t\t $this->model_checkout_order->addHistory($orderId, 7, $comments, $is_customer_notified); // 7 = Canceled\t\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\t\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tif($status == ''){\r\n\r\n\t\t\t\t\t\t\t\t\t$coin = $post['coin_short_name'];\r\n\t\t\t\t\t\t\t\t\t$trxId = $post['id'];\r\n\r\n\t\t\t\t\t\t\t\t\t/*** now get wallet data from oc_coinremitter_wallet with use of coin ***/\r\n\t\t\t\t\t\t\t\t\t$wallet_info = $this->model_extension_coinremitter_payment_coinremitter->getWallet($coin);\r\n\t\t\t\t\t\t\t\t\tif(!empty($wallet_info)){\r\n\r\n\t\t\t\t\t\t\t\t\t\t/*** now get transaction from coinremitter api call ***/\r\n\t\t\t\t\t\t\t\t\t\t$get_trx_params = array(\r\n\t\t\t\t\t\t\t\t\t\t\t'url'\t\t=> 'get-transaction',\r\n\t\t\t\t\t\t\t\t\t\t\t'api_key'\t=>\t$wallet_info['api_key'],\r\n\t\t\t\t\t\t 'password'\t=>\t$wallet_info['password'],\r\n\t\t\t\t\t\t 'id'\t\t=>\t$trxId,\r\n\t\t\t\t\t\t 'coin'\t\t=>\t$coin\r\n\t\t\t\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t\t\t\t\t$getTransaction = $this->obj_curl->commonApiCall($get_trx_params);\r\n\t\t\t\t\t\t\t\t\t\tif(!empty($getTransaction) && isset($getTransaction['flag']) && $getTransaction['flag'] == 1){\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t$transaction = $getTransaction['data'];\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tif(isset($transaction['type']) && $transaction['type'] == 'receive'){\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t/*** now check if transaction exists in oc_coinremitter_webhook or not if does not exist then insert else update confirmations ***/\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t$webhook_info = $this->model_extension_coinremitter_payment_coinremitter->getWebhook($transaction['id']);\r\n\t\t\t\t\t\t\t\t\t\t\t\tif(empty($webhook_info)){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t//insert record\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$insert_arr = array(\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'order_id' => $orderId,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'address' => $transaction['address'],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'transaction_id' => $transaction['id'],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'txId' => $transaction['txid'],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'explorer_url' => $transaction['explorer_url'],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'paid_amount' => $transaction['amount'],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'coin' => $transaction['coin_short_name'],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'confirmations' => $transaction['confirmations'],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'paid_date' => $transaction['date']\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$inserted_id = $this->model_extension_coinremitter_payment_coinremitter->addWebhook($insert_arr);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif($inserted_id > 0){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$json['flag'] = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$json['msg'] = \"Inserted successfully\";\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$json['msg'] = \"system error. Please try again later.\";\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t//update confirmations if confirmation is less than 3\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif($webhook_info['confirmations'] < 3){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$update_confirmation = array(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'confirmations' => $transaction['confirmations'] <= 3 ? $transaction['confirmations'] : 3 \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$this->model_extension_coinremitter_payment_coinremitter->updateTrxConfirmation($webhook_info['transaction_id'],$update_confirmation);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t} \r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$json['flag'] = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$json['msg'] = \"confirmations updated successfully\";\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t/*** order paid process start ***/\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t/*** Now, get all webhook transactions which have lesser than 3 confirmations ***/\r\n\t\t\t\t\t\t\t\t\t\t\t\t$webhook_res = $this->model_extension_coinremitter_payment_coinremitter->getSpecificWebhookTrxByAddress($address);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t/*** Get wallet info if and only if webhook_res has atleast one data ***/\r\n\t\t\t\t\t\t\t\t\t\t\t\tif(!empty($webhook_res)){\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tforeach ($webhook_res as $webhook) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/*** Get confirmation from coinremitter api (get-transaction) ***/\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$get_trx_params['id'] = $webhook['transaction_id']; \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$getTransactionRes = $this->obj_curl->commonApiCall($get_trx_params);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif(!empty($getTransactionRes) && isset($getTransactionRes['flag']) && $getTransactionRes['flag'] == 1){\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$transactionData = $getTransactionRes['data'];\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$update_confirmation = array(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'confirmations' => $transactionData['confirmations'] <= 3 ? $transactionData['confirmations'] : 3 \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$this->model_extension_coinremitter_payment_coinremitter->updateTrxConfirmation($webhook['transaction_id'],$update_confirmation);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t/*** Get sum of paid amount of all transations which have 3 or more than 3 confirmtions ***/\r\n\t\t\t\t\t\t\t\t\t\t\t\t$total_paid_res = $this->model_extension_coinremitter_payment_coinremitter->getTotalPaidAmountByAddress($address);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t$total_paid = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t\tif(isset($total_paid_res['total_paid']) && $total_paid_res['total_paid'] > 0 ){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$total_paid = $total_paid_res['total_paid'];\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t$status = '';\r\n\t\t\t\t\t\t\t\t\t\t\t\tif($total_paid == $order_info['crp_amount']){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$status = 'paid';\r\n\t\t\t\t\t\t\t\t\t\t\t\t}else if($total_paid > $order_info['crp_amount']){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$status = 'over paid';\r\n\t\t\t\t\t\t\t\t\t\t\t\t}else if($total_paid != 0 && $total_paid < $order_info['crp_amount']){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$status = 'under paid';\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\tif($status != ''){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t//update payment_status,status\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$update_arr = array('payment_status' => $status);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$this->model_extension_coinremitter_payment_coinremitter->updateOrder($orderId,$update_arr);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$update_arr = array('status' => ucfirst($status));\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$this->model_extension_coinremitter_payment_coinremitter->updatePaymentStatus($orderId,$update_arr);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif($status == 'paid' || $status == 'over paid' || $status == 'under paid'){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/*** Update order status as complete ***/\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$this->add_order_success_history($orderId);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t/*** order paid process end ***/\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\t\t\t\t$json['flag'] = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t\t$json['msg'] = 'Transaction type is not receive';\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\t\t\t$msg = 'Something went wrong while getting transactions. Please try again later'; \r\n\t\t\t\t\t\t\t\t\t\t\tif(isset($getTransaction['msg']) && $getTransaction['msg'] != ''){\r\n\t\t\t\t\t\t\t\t\t\t\t\t$msg = $getTransaction['msg']; \r\n\t\t\t\t\t\t\t\t\t\t\t} \r\n\t\t\t\t\t\t\t\t\t\t\t$json['flag'] = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t$json['msg'] = $msg; \r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t\t\t\t\t\t$json['msg'] = \"Wallet not found\";\t\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t\t\t\t\t$json['msg'] = \"Order is expired\";\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t\t\t\t$json['msg'] = \"Order not found\";\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t\t\t$json['msg'] = \"Order status is neither a 'pending' nor a'under paid'\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t\t$json['msg'] = \"Address not found\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t$json['msg'] = \"Invalid type\";\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t$json['msg'] = \"Required paramters are not found\";\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\t$json['flag'] = 0;\r\n\t\t\t$json['msg'] = \"Only post request allowed\";\r\n\t\t}\r\n\t\t\r\n\t\t$this->response->addHeader('Content-Type: application/json');\r\n\t\t$this->response->setOutput(json_encode($json));\r\n\t}", "function verify_request ($body) {\n\tglobal $config;\n\treturn strpos($_SERVER['HTTP_USER_AGENT'], 'GitHub-Hookshot') !== false &&\n\t\thash_equals($_SERVER['HTTP_X_HUB_SIGNATURE'], 'sha1=' . hash_hmac('sha1', $body, $config->token));\n}", "public function test_should_deliver_status() {\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) );\n\n\t\t// Inactive.\n\t\t$this->assertFalse( LLMS_Unit_Test_Util::call_method( $webhook, 'should_deliver', array( array( $this->factory->student->create() ) ) ) );\n\n\t\t// Active.\n\t\t$webhook->set( 'status', 'active' )->save();\n\t\t$this->assertTrue( LLMS_Unit_Test_Util::call_method( $webhook, 'should_deliver', array( array( $this->factory->student->create() ) ) ) );\n\n\t}", "public function verify();", "abstract public function verifyRequest(): void;", "abstract public function verifyRequest(): void;", "public function test_onHook_missing_data() {\n\t\t\t$request = array(\n\t\t\t\t'post' => array(\n\t\t\t\t\t'payload' => json_encode(array(\n\t\t\t\t\t\t'author' => 'ph',\n\t\t\t\t\t\t'log' => 'commit message',\n\t\t\t\t\t), true),\n\t\t\t\t)\n\t\t\t);\n\n\t\t\t$ret = $this->instance->onHook($request);\n\n\t\t\t$this->assertFalse($ret['ok']);\n\t\t\t$this->assertEquals($ret['error'], \"invalid_payload\");\n\t\t}", "public function webHook()\n {\n// try\n// {\n\n $this->bodyObject = json_decode($this->bodyReceived);\n\n if (!is_object($this->bodyObject))\n {\n \\Log::error('[Parse Body Failed] invalid body');\n throw new \\Exception('Invalid request null');\n }\n\n return $this->bodyObject;\n\n// if ($this->TtgPaymentHistory->checkDuplicateWebHook($this->bodyObject->id))\n// {\n// throw new \\Exception('[NOTICE] web hook already saved, web hook id:' . $this->bodyObject->id);\n// }\n//\n// if ($this->TtgPaymentHistory->checkDuplicateAgreementPayment($this->bodyObject->resource))\n// {\n// throw new \\Exception('[NOTICE] agreement payment already saved, sub id:' . $this->bodyObject->resource->billing_agreement_id . \", trans id: \" . $this->bodyObject->resource->id);\n// }\n\n\n\n// } catch (\\Exception $e)\n// {\n \\Log::error('error web hook');\n// $this->PayPal->payPalLog('[Save Event Data Failed] event type:\"' . $this->bodyObject->event_type . '\" web hook id:\"' . $this->bodyObject->id . '\"', $e);\n// $this->response->statusCode(501);\n// $this->response->body($e->getMessage());\n// $this->response->send();\n// }\n // this is necessary\n// exit();\n }", "public function verifyWebhook()\n {\n if ($this->request->getParameter('hub_verify_token') === $this->getParameter('verify_token')) {\n return $this->request->getParameter('hub_challenge');\n }\n\n throw new InvalidRequest('Invalid verify token');\n }", "public function validate_webhook( $payload ) {\n\t\tself::log( 'Checking Webhook response is valid' );\n\n\t\tif ( ! isset( $_SERVER['HTTP_X_CC_WEBHOOK_SIGNATURE'] ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$sig = $_SERVER['HTTP_X_CC_WEBHOOK_SIGNATURE'];\n\n\t\t$secret = $this->get_option( 'webhook_secret' );\n\n\t\t$sig2 = hash_hmac( 'sha256', $payload, $secret );\n\n\t\tif ( $sig === $sig2 ) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "public function testVerifyUsingPOST()\n {\n\n }", "protected function checkVerification()\n {\n $verificationString = $this->getRequest()->getHeader('X-GCS-Webhooks-Endpoint-Verification');\n if ($verificationString) {\n $this->getResponse()->setHeader('Content-Type', 'text/plain');\n $this->getResponse()->setBody(\n $verificationString\n );\n\n return true;\n }\n\n return false;\n }", "public function testGetWebhookRaw()\n {\n $container = [];\n $sw = $this->createMockedSmartwaiver($container, APISuccessResponses::webhooks());\n\n $response = $sw->getWebhookConfigRaw();\n $this->assertInstanceOf(SmartwaiverRawResponse::class, $response);\n\n $this->checkGetRequests($container, ['/v4/webhooks/configure']);\n }", "public function testGetWebhookRaw()\n {\n $container = [];\n $sw = $this->createMockedSmartwaiver($container, APISuccessResponses::webhooks());\n\n $response = $sw->getWebhookConfigRaw();\n $this->assertInstanceOf(SmartwaiverRawResponse::class, $response);\n\n $this->checkGetRequests($container, ['/v4/webhooks/configure']);\n }", "public function verifyWebhook($source)\n {\n $hMac_header = $_SERVER['HTTP_X_SHOPIFY_HMAC_SHA256'];\n $data = file_get_contents('php://input');\n $calculated_hMac = base64_encode(hash_hmac('sha256', $data, $this->shopifySecret, true));\n $result = ($hMac_header == $calculated_hMac);\n if (!$result) {\n Log::error(\"ShopifyApi.verifyWebhook is FALSE for $source, hMac_header = $hMac_header,\n Input = $data\");\n }\n return $result;\n }", "public function testGetWebhookEvents()\n {\n }", "public function doRequest()\n {\n $this->post('/api_v1/webhook/log/1',\n json_decode('{\n \"transaction_time\": \"1603711958\",\n \"id\": \"e0c523cd-3dfd-4206-83b4-9c0dc32dd77e\",\n \"event\": \"in-store-txn\",\n \"value\": 13.98,\n \"status\": \"complete\",\n \"customer_id\": \"e0c523cd-3dfd-4206-83b4-9c0dc32dd77e\"\n }'),\n [\n \"Accept\" => \"application/json\"\n ]\n );\n\n $this->assertEquals(\n 200, $this->response->getStatusCode()\n );\n }", "public function setupWebhooks()\n {\n if (self::$isWebhookSetup) {\n return true;\n }\n try {\n MailLog::info('Setting up SendGrid webhooks');\n $subscribeUrl = StringHelper::joinUrl(Setting::get('url_delivery_handler'), self::WEBHOOK);\n $request_body = json_decode('{\n \"bounce\": true,\n \"click\": false,\n \"deferred\": false,\n \"delivered\": false,\n \"dropped\": true,\n \"enabled\": true,\n \"group_resubscribe\": false,\n \"group_unsubscribe\": false,\n \"open\": false,\n \"processed\": false,\n \"spam_report\": true,\n \"unsubscribe\": false,\n \"url\": \"'.$subscribeUrl.'\"\n }'\n );\n $response = $this->client()->client->user()->webhooks()->event()->settings()->patch($request_body);\n\n if($response->_status_code == '200') {\n MailLog::info('Webhooks successfully set!');\n } else {\n throw new \\Exception(\"Cannot setup SendGrid webhooks\");\n }\n\n self::$isWebhookSetup = true;\n } catch (\\Exception $e) {\n MailLog::warning($e->getMessage());\n }\n }", "private function validate () {\n $payload = $this->payload;\n // Unset fields that don't match the spec\n foreach (array_keys($payload) as $field) {\n if (!in_array($field, $this->fields)) {\n unset($payload[$field]);\n }\n }\n\n // If the user is signing up manually (I.e. not via a social network), then\n // we also need a password\n if ($this->method === 'manual' && empty($payload['password'])) {\n return false;\n }\n\n $this->payload = $payload;\n return true;\n }", "function verifyRequest($req){\n\n}", "public function checkWebhookStatus()\n\t{\n\t\t// TODO check localhost\n\t\tforeach($this->webhooksList as $hook){\n\t\t\tif($this->getWebhookUrl() == $hook['url']){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public function test_ping_non_200_status() {\n\n\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t'delivery_url' => 'https://mock.tld/400',\n\t\t\t'topic' => 'course.created',\n\t\t) );\n\n\t\tadd_filter( 'pre_http_request', array( $this, 'mock_request' ), 10, 3 );\n\t\tremove_filter( 'llms_rest_webhook_pre_ping', '__return_true' );\n\n\t\t$ret = $webhook->ping();\n\t\t$this->assertIsWPError( $ret );\n\t\t$this->assertWPErrorCodeEquals( 'llms_rest_webhook_ping_not_200', $ret );\n\n\t}", "public function test_is_valid_post_action() {\n\n\t\t$post_types = array(\n\t\t\t'course' => false,\n\t\t\t'section' => false,\n\t\t\t'lesson' => false,\n\t\t\t'llms_membership' => false,\n\t\t\t'llms_access_plan' => false,\n\t\t\t'llms_order' => false,\n\t\t\t'llms_transaction' => false,\n\t\t\t'post' => false,\n\t\t\t'page' => false,\n\t\t);\n\n\t\t$tests = array(\n\t\t\t'course.deleted' => array_merge( $post_types, array( 'course' => true ) ),\n\t\t\t'section.deleted' => array_merge( $post_types, array( 'section' => true ) ),\n\t\t\t'lesson.deleted' => array_merge( $post_types, array( 'lesson' => true ) ),\n\t\t\t'membership.deleted' => array_merge( $post_types, array( 'llms_membership' => true ) ),\n\t\t\t'access_plan.deleted' => array_merge( $post_types, array( 'llms_access_plan' => true ) ),\n\t\t\t'order.deleted' => array_merge( $post_types, array( 'llms_order' => true ) ),\n\t\t\t'transaction.deleted' => array_merge( $post_types, array( 'llms_transaction' => true ) ),\n\t\t);\n\n\t\tforeach ( $tests as $topic => $post_types ) {\n\n\t\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t\t'delivery_url' => 'https://fake.tld',\n\t\t\t\t'topic' => $topic,\n\t\t\t) );\n\n\t\t\tforeach ( $post_types as $type => $expect ) {\n\n\t\t\t\t$post_id = $this->factory->post->create( array( 'post_type' => $type ) );\n\t\t\t\t$this->assertEquals( $expect, LLMS_Unit_Test_Util::call_method( $webhook, 'is_valid_post_action', array( $post_id ) ) );\n\n\t\t\t}\n\n\t\t}\n\n\t}", "public function testGetWebhookConfig()\n {\n $container = [];\n $sw = $this->createMockedSmartwaiver($container, APISuccessResponses::webhooks());\n\n $webhook = $sw->getWebhookConfig();\n $this->assertInstanceOf(SmartwaiverWebhook::class, $webhook);\n\n $this->checkGetRequests($container, ['/v4/webhooks/configure']);\n }", "public function testSetWebhook()\n {\n $container = [];\n $sw = $this->createMockedSmartwaiver($container, APISuccessResponses::webhooks());\n\n $swWebhook = new SmartwaiverWebhook([\n 'endpoint' => 'https://endpoint.example.org',\n 'emailValidationRequired' => SmartwaiverWebhook::WEBHOOK_BEFORE_AND_AFTER_EMAIL\n ]);\n\n $webhook = $sw->setWebhook($swWebhook);\n $this->assertInstanceOf(SmartwaiverWebhook::class, $webhook);\n\n // Check that the right requests were sent\n $this->checkPutRequests($container, ['/v4/webhooks/configure'], [\n '{\"endpoint\":\"https:\\/\\/endpoint.example.org\",\"emailValidationRequired\":\"both\"}'\n ]);\n }", "public function webhook() {\n\n\t\t$this->log( 'Fire webhook' );\n\n\t\t/* \n\t\t * Received redirect from acquiring service with succesful order status\n\t\t */\n\t\tif( $_SERVER['REQUEST_METHOD'] == 'POST' and isset( $_POST['payment_id'] ) ) {\n\n\t\t\t$this->log( 'Received callback from acquiring service with order processing status' );\n\t\t\t$this->log( print_r($_POST, true ) );\n\n\t\t\t// Get payment UUID\n\t\t\t$paymentcode = isset( $_POST['payment_id'] ) ? $_POST['payment_id'] : null;\n\n\t\t\t// Get our Order ID returned through acquiring\n\t\t\t$order_id = isset ( $_POST['cf'] ) ? $_POST['cf'] : null;\n\n\t\t\t// Get Order status (ОК, КО, CANCEL, CHARGEBACK)\n\t\t\t$status = isset ( $_POST['status'] ) ? $_POST['status'] : null;\n\n\t\t\t// Get Order signature to verify payment validity\n\t\t\t$sign = isset ( $_POST['sign'] ) ? $_POST['sign'] : null;\n\t\t\t$sign_check = md5( $this->merchant_id . $paymentcode . $status . $order_id . $this->secret_word );\n\n\t\t\t$order = wc_get_order( $order_id );\n\n\t\t\t// Validate payment data\n\t\t\tif( $sign == $sign_check ) {\n\n\t\t\t\tswitch( $status ) {\n\t\t\t\t\tcase 'OK':\n\t\t\t\t\t\t// Payment succesful\n\n\t\t\t\t\t\t// Check if Order stay in our payment method\n\t\t\t\t\t\tif( $order->get_payment_method() == $this->id ) {\n\n\t\t\t\t\t\t\t// Link acquiring payment UUID with our Order\n\t\t\t\t\t\t\tif( strlen( $paymentcode ) ) {\n\t\t\t\t\t\t\t\tupdate_post_meta( $order_id, '_' . $this->id . '_paymentcode', $paymentcode );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Set Order status to Processing\n\t\t\t\t\t\t\t$order->update_status('processing');\n\n\t\t\t\t\t\t\t$this->log( 'Payment processed sucesfully' );\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// Wrong payment method\n\t\t\t\t\t\t\t$this->log( 'Wrong payment method' );\n\t\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'КО':\n\t\t\t\t\t// Do nothing. Keep order status as is\n\t\t\t\t\t\t$this->log( 'Payment not processed' );\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'CANCEL':\n\t\t\t\t\t\t// Do nothing. Keep order status as is\n\t\t\t\t\t\t$this->log( 'Payment cancelled by acquirer' );\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Clear http output. \n\t\techo '0';\n\t\texit;\n \t}", "public function check(): void\n {\n $headers = Helper::getHeaders();\n $hash = $headers['m-hash'] ?? null;\n $version = $headers['m-version'] ?? null;\n $time = $headers['m-time'] ?? null;\n $random = $headers['m-random'] ?? null;\n L::d('M-HASH: ' . $hash);\n L::d('M-VERSION: ' . $version);\n L::d('M-TIME: ' . $time);\n L::d('M-RANDOM: ' . $random);\n\n \\Mirage\\Libs\\RequestHash::setKey(Config::get('app.security.'));\n \\App\\Libs\\Hash::check($hash, $version, $time, $random);\n }", "public function test_enqueue_multi_hooks() {\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' => 'enrollment.created',\n\t\t) );\n\n\t\t$this->assertFalse( has_action( 'llms_user_course_enrollment_created', array( $webhook, 'process_hook' ) ) );\n\t\t$this->assertFalse( has_action( 'llms_user_membership_enrollment_created', array( $webhook, 'process_hook' ) ) );\n\t\t$webhook->enqueue();\n\t\t$this->assertEquals( 10, has_action( 'llms_user_course_enrollment_created', array( $webhook, 'process_hook' ) ) );\n\t\t$this->assertEquals( 10, has_action( 'llms_user_membership_enrollment_created', array( $webhook, 'process_hook' ) ) );\n\n\t}", "public function testWebhookDirect()\n {\n $response = $this->withHeaders([\n 'Signature' => env('WEBHOOK_CLIENT_SECRET')\n ])->json('POST', 'watson-webhook', [\n 'job' => 'test1',\n 'parameter' => 1\n ]);\n\n $response->assertStatus(200)\n ->assertJson(['message' => 1]);\n }", "public function testSetWebhook()\n {\n $container = [];\n $sw = $this->createMockedSmartwaiver($container, APISuccessResponses::webhooks());\n\n $swWebhook = new SmartwaiverWebhook([\n 'endpoint' => 'https://endpoint.example.org',\n 'emailValidationRequired' => SmartwaiverWebhook::WEBHOOK_BEFORE_AND_AFTER_EMAIL\n ]);\n\n $webhook = $sw->setWebhook($swWebhook);\n $this->assertInstanceOf(SmartwaiverWebhook::class, $webhook);\n\n // Check that the right requests were sent\n $this->assertCount(1, $container);\n $this->assertEquals('PUT', $container[0]['request']->getMethod());\n $this->assertEquals('/v4/webhooks/configure', $container[0]['request']->getRequestTarget());\n $this->assertEquals([self::TEST_API_KEY], $container[0]['request']->getHeader('sw-api-key'));\n $this->assertEquals(['application/json'], $container[0]['request']->getHeader('Content-Type'));\n $this->assertEquals(\n '{\"endpoint\":\"https:\\/\\/endpoint.example.org\",\"emailValidationRequired\":\"both\"}',\n $container[0]['request']->getBody()->getContents()\n );\n }", "public function matchesRequest(): bool\n {\n return $this->validateSignature() && $this->payload->get('webhook_event_type') === static::EVENT_TYPE;\n }", "public function performChecks(){\n\t\t\n\t}", "public function test_ping_unreachable() {\n\n\n\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t'delivery_url' => 'https://fake.tld',\n\t\t\t'topic' => 'course.created',\n\t\t) );\n\n\t\tremove_filter( 'llms_rest_webhook_pre_ping', '__return_true' );\n\n\t\t$ret = $webhook->ping();\n\t\t$this->assertIsWPError( $ret );\n\t\t$this->assertWPErrorCodeEquals( 'llms_rest_webhook_ping_unreachable', $ret );\n\n\t}", "public function verify(Request $request);", "protected function checkSignature()\n {\n $headers = \\Yii::$app->request->headers;\n\n $signature = $headers->get('paypal-transmission-sig');\n if (!$signature)\n throw new BadRequestHttpException;\n\n $checkString = sprintf('%s|%s|%s|%s',\n $headers->get('paypal-transmission-id'),\n $headers->get('paypal-transmission-time'),\n $this->webHookId,\n crc32(\\Yii::$app->request->rawBody)\n );\n\n $certUrl = $headers->get('paypal-cert-url');\n if (!$certUrl)\n throw new BadRequestHttpException;\n\n $publicKey = $this->fetchPublicKey($certUrl);\n if (!$publicKey)\n throw new \\Exception('Certificate error');\n\n// $algo = ArrayHelper::getValue($headers, 'paypal-hash-algo');\n\n $result = openssl_verify($checkString, base64_decode($signature), $publicKey);\n return $result === 1;\n }", "public function check()\n {\n // TODO : Verif csrf\n // TODO : Oublie de mot de passe & mail divers\n }", "public function checkWebhookAvailability($list_id) {\n global $sugar_config;\n $found = false;\n $callbackUrl = $sugar_config['site_url'] . \"/\" . $this->default['webhook']['rest_url'];\n $webhook = $this->list->webhooks($list_id);\n //Check webhook for list updates\n if($webhook['total_items'] > 0) {\n $webhooks = $webhook['webhooks'];\n foreach($webhooks as $key=>$value) {\n if($value['url'] == $callbackUrl) {\n $found = true;\n break;\n }\n }\n }\n //Create webhook for list updates\n if(!$found) {\n $this->list->webhookAdd($list_id, $callbackUrl);\n }\n }", "public function test_onHook_ok() {\n\t\t\t$request = array(\n\t\t\t\t'post' => array(\n\t\t\t\t\t'payload' => json_encode(array(\n\t\t\t\t\t\t'revision' => \"r126299\",\n\t\t\t\t\t\t'author' => 'ph',\n\t\t\t\t\t\t'log' => 'commit message',\n\t\t\t\t\t), true),\n\t\t\t\t)\n\t\t\t);\n\n\t\t\t$ret = $this->instance->onHook($request);\n\n\t\t\t$this->assertTrue($ret['ok']);\n\n\t\t\t$expected = array(array(\n\t\t\t\t'channel' => '#test',\n\t\t\t\t'message' => array('text' => 'r126299: ph - commit message', 'mrkdwn' => false)\n\t\t\t));\n\t\t\t$this->assertEquals($expected, $this->instance->posted_messages);\n\t\t}", "public function test_enqueue_single_hook() {\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' => 'course.created',\n\t\t) );\n\n\t\t$this->assertFalse( has_action( 'save_post_course', array( $webhook, 'process_hook' ) ) );\n\t\t$webhook->enqueue();\n\t\t$this->assertEquals( 10, has_action( 'save_post_course', array( $webhook, 'process_hook' ) ) );\n\n\t}", "function check_esewa_response() {\n\n\t\t\t@ob_clean();\n\n\t\t\tif ( ! empty( $_REQUEST ) && $this->check_esewa_response_is_valid() ) {\n\n\t\t\t\tdo_action( 'valid-esewa-standard-response' );\n\n\t\t\t} else {\n\n\t\t\t\twp_die( 'eSewa Response Validation Failure' );\n\n\t\t\t}\n\n\t\t}", "function check(){\n\t\tif(empty($this->PRIVATE_KEY)){throw new Exception(\"Private Key not set\", 2)}\n\n\t\t// Ensure we have all required data\n\t\t$this->auto_detect_fields();\n\n\t\t$request_url = sprintf(\"%s?secret=%s&response=%s&remoteip=%s\",\n\t\t\t$this->VERIFY_URL,\n\t\t\t$this->PRIVATE_KEY,\n\t\t\t$this->RESPONSE,\n\t\t\t$this->REMOTE_ADDRESS\n\t\t);\n\n\t\t//Do it!\n\t\tif($this->USE_CURL){\n\t\t\t// Use CURL\n\t\t\t$this->RESULT = $this->get_json_curl($request_url);\n\t\t}\n\t\telse {\n\t\t\t// Use Built-in PHP fopen() functions\n\t\t\t$this->RESULT = $this->get_json_fopen($request_url);\n\t\t}\n\t\t$this->RESULT = json_decode($this->RESULT, true);\n\t}", "private function validateRequest()\n {\n $ret_api_secret = null;\n\n if (!isset($_POST['invoiceId'])) {\n dump($_POST['invoiceId']);\n return false;\n }\n\n if (isset($_POST['apiSecret'])) {\n $ret_api_secret = $_POST['apiSecret'];\n } else {\n return false;\n }\n\n if ($this->api_secret != $ret_api_secret) {\n return false;\n }\n\n if (isset($_SERVER['HTTP_REFERER'])) {\n $urlParts = parse_url($_SERVER['HTTP_REFERER']);\n $ip = gethostbyname($urlParts['host']);\n\n if ($this->pursar_ip != $ip) {\n return false;\n }\n }\n\n return true;\n }", "public function needsVerificationMessage ();", "public function webhook_action ()\n\t{\n\t\ttry\n\t\t{\n\t\t\t$id = isset($_GET['order_id']) ? $_GET['order_id'] : 0;\n\n\t\t\tif (empty($id))\n\t\t\t{\n\t\t\t\theader(\"HTTP/1.0 404 Not Found\");\n\t\t\t\tdie(\"No order ID received\");\n\t\t\t}\n\n\t\t\t$transaction_id = $this->get_transaction_id_from_order_id($id);\n\t\t\t$payment = self::get_api()->payments->get($transaction_id);\n\n\t\t\t$this->update_status($id, $payment->status);\n\t\t\t$this->log($transaction_id, $payment->status, $id);\n\t\t}\n\t\tcatch (Mollie_API_Exception $e)\n\t\t{\n\t\t\techo \"API call failed: \" . htmlspecialchars($e->getMessage());\n\t\t}\n\n\t\tdie(\"OK\");\n\t}", "public function check() {}", "public function verifyRequest()\n\t{\n\t\t$this->verifyApplicationId();\n\t\t$this->verifyTimestamp();\n\t\t$this->verifySignatureCertificateUrl($this->getSignatureCertificateUrl());\n\n\t\t$certificate = $this->persistence->getCertificateForKey($this->certificate_url);\n\n\t\tif (! $certificate) {\n\t\t\t$certificate = new Certificate($this->certificate_url);\n\t\t}\n\n\t\t$this->verifyCertificate($certificate);\n\t}", "function verify()\n\t{\n\t\t$data = filter_forwarded_data($this);\n\t\tif(!empty($_POST))\n\t\t{\n\t\t\t# Approve or reject a school\n\t\t\t$result = $this->_job->verify($_POST);\n\t\t\t\n\t\t\t$actionPart = current(explode(\"_\", $_POST['action']));\n\t\t\t$actions = array('save'=>'saved', 'archive'=>'archived');\n\t\t\t$actionWord = !empty($actions[$actionPart])? $actions[$actionPart]: 'made';\n\t\t\t$this->native_session->set('msg', ($result['boolean']? \"The job has been \".$actionWord: (!empty($result['msg'])? $result['msg']: \"ERROR: The job could not be \".$actionWord) ));\n\t\t}\n\t\telse\n\t\t{\n\t\t\t# Get list type\n\t\t\t$data['list_type'] = current(explode(\"_\", $data['action']));\n\t\t\t$data['area'] = 'verify_job';\n\t\t\t$this->load->view('addons/basic_addons', $data);\n\t\t}\n\t}", "function verify()\n\t{\n\t\t$data = filter_forwarded_data($this);\n\t\tif(!empty($_POST))\n\t\t{\n\t\t\t# Approve or reject a confirmation\n\t\t\t$result = $this->_confirmation->verify($_POST);\n\t\t\t\n\t\t\t$actionPart = current(explode(\"_\", $_POST['action']));\n\t\t\t$actions = array('reject'=>'rejected', 'post'=>'posted', 'approve'=>'approved', 'verify'=>'verified');\n\t\t\t$actionWord = !empty($actions[$actionPart])? $actions[$actionPart]: 'made';\n\t\t\t\n\t\t\t$item = in_array($_POST['action'], array('approve','reject'))? 'posting': 'confirmation';\n\t\t\t$this->native_session->set('msg', ($result['boolean']? \"The \".$item.\" has been \".$actionWord: (!empty($result['msg'])? $result['msg']: \"ERROR: The \".$item.\" could not be \".$actionWord) ));\n\t\t}\n\t\telse\n\t\t{\n\t\t\t# Get list type\n\t\t\t$data['list_type'] = current(explode(\"_\", $data['action']));\n\t\t\t$data['area'] = 'verify_confirmation';\n\t\t\t$this->load->view('confirmation/addons', $data);\n\t\t}\n\t}", "private function verifyResponse()\n {\n $errorMessages = [];\n \n if (!isset($this->endpoint)) {\n $errorMessages[] = \"$endpoint must be set.\";\n }\n \n if (!isset($this->statusCode)) {\n $errorMessages[] = \"$statusCode must be set.\";\n }\n \n if (!is_array($this->data)) {\n $errorMessages[] = \"$data must be formatted as an array.\";\n }\n \n if (!is_array($this->errors)) {\n $errorMessages[] = \"$errors must be formatted as an array.\";\n }\n\n if (!empty($errorMessages)) {\n return $errorMessages;\n }\n \n return true;\n }", "public function checkDataSubmission() {\n\t\t$this->main('', array());\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}", "function sendWebhook($payload) {\n global $cfg;\n\n if (!isset($this->webhookurl) or empty($this->webhookurl)) {\n error_log(\"Webhook URL is empty\");\n return false;\n }\n\n $json = json_encode($payload);\n \t\t$curl = curl_init($this->webhookurl);\n \t\tcurl_setopt($curl, CURLOPT_HEADER, TRUE);\n \t\tcurl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\n \t\tcurl_setopt($curl, CURLOPT_HTTPHEADER,\n array(\"Content-type: application/json\"));\n \t\tcurl_setopt($curl, CURLOPT_POST, true);\n \t\tcurl_setopt($curl, CURLOPT_POSTFIELDS, $json);\n \t\t$json_response = curl_exec($curl);\n \t\t$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);\n\n $json = json_decode($json_response);\n\n if ($status == 200) {\n return true;\n } else {\n error_log(\"An error occurred: \" . $status . \" - \" . $json_response);\n return false;\n }\n\n\n\n\n }", "public function validateWebhookRequest(Request $request)\n {\n\n $payload = $request->getContent();\n $sig_header = $request->header('Stripe-Signature');\n\n //\n $config = $this->paymentProvider->getConfig();\n\n $endpoint_secret = $config['webhook_secret'];\n $tolerance = $config['webhook_tolerance'] ?? Webhook::DEFAULT_TOLERANCE;\n\n try {\n $this->paymentProvider->verifyWebhookHeader(\n $payload,\n $sig_header,\n $endpoint_secret,\n $tolerance\n );\n } catch (SignatureVerificationException $exception) {\n throw new AccessDeniedHttpException($exception->getMessage(), $exception);\n }\n\n return true;\n }", "public static function verify($challenge)\n {\n return Configuration::gateway()->webhookNotification()->verify($challenge);\n }", "public function testDeleteWebhook()\n {\n }", "public function check()\n\t{\n $response = $this->app->check();\n $this->printJSON($response);\n }", "public function testStorePayloadFailedFeature()\n {\n $user = factory(User::class)->create();\n $webhook = factory(Webhook::class)->create(['user_id' => $user->id]);\n $this->actingAs($user);\n\n $response = $this->post(route('webhooks.payloads.store', $webhook), [\n 'content' => '',\n 'fields' => ['name', 'age'],\n 'operators' => ['==', '>'],\n 'values' => ['rammus', '30']\n ]);\n $response->assertStatus(302);\n $response->assertSessionHasErrors([\n 'content' => 'Please enter content',\n 'params' => 'Please enter payload params to validate the conditions',\n ]);\n }", "public function test_onHook_invalid_json() {\n\t\t\t$request = array(\n\t\t\t\t'post' => array(\n\t\t\t\t\t'payload' => \"{\",\n\t\t\t\t)\n\t\t\t);\n\n\t\t\t$ret = $this->instance->onHook($request);\n\n\t\t\t$this->assertFalse($ret['ok']);\n\t\t\t$this->assertEquals($ret['error'], \"invalid_payload\");\n\t\t}", "public function validateApiKey()\n {\n $request = $this->call('GET', 'helper/ping');\n return !empty($request);\n }", "public function invoke(PayPalApiStruct $webhook, Context $context): void;", "public static function check_mondido_response() {\r\n $_GET = stripslashes_deep($_GET);\r\n $expected_fields = array(\r\n \"hash\",\r\n \"payment_ref\",\r\n \"transaction_id\"\r\n );\r\n\r\n foreach($expected_fields as $field){\r\n if(!isset($_GET[$field])) return;\r\n }\r\n\r\n do_action(\"valid-mondido-callcack\", $_GET);\r\n }", "public function validateRequest();", "function check( $status, $expected = NULL ) {\n\t\t$this->parse_query( $_GET ? 'GET' : 'POST' );\n\t\t$encoded = json_encode( Recorder::$response, true );\n\n\t\t$this->assertEquals( $status, Recorder::$status, $encoded );\n\t\tif ( is_array( $expected ) ) {\n\t\t\t$this->assertEquals( $expected, Recorder::$response, $encoded );\n\t\t} elseif ( is_string( $expected ) ) {\n\t\t\t$this->assertContains( $expected, Recorder::$response['error_description'], $encoded );\n\t\t} else {\n\t\t\t$this->assertSame( NULL, $expected );\n\t\t}\n\n\t\t$this->assertFalse( is_null( static::$before_micropub_input ) );\n\t\tif ( (int) ( $status / 100 ) == 2 ) {\n\t\t\t$this->assertFalse( is_null( static::$after_micropub_input ) );\n\t\t} else {\n\t\t\t$this->assertNull( static::$after_micropub_input );\n\t\t\t$this->assertNull( static::$after_micropub_args );\n\t\t}\n\t}", "public function verify()\n {\n $this->setVerifiedFlag()->save();\n\n // :TODO: Fire an event here\n }", "public function verify()\n {\n $message = new MailMessage;\n $message->greeting(\"Hi {$this->post->reporting->name}!\");\n $message->line(\"The post {$this->post->titile} has been verified successfully.\"); \n foreach ($this->workflow as $key => $value) {\n if ($key == 0) {\n $message->action($value->action, url('workflows/workflow/' . $value->id));\n continue;\n }\n $message->line('<a href=\"'.url('workflows/workflow/' . $value->id).'\">'.$value->action.'</a>');\n }\n\n return $message;\n }", "public function checkUser_post(){\n\t\textract($_POST);\n\t\t//print_r($_POST);die();\n\t\t$oauth_provider='facebook';\n\t\t// ------if facebook oauth provider not found-------------\n\t\tif ($oauth_provider=='') {\n\t\t\t$this->response([\n\t\t\t\t'status' => 500,\n\t\t\t\t'status_message' => 'OAuth provider field is empty. All parameters are required!'\n\t\t\t], REST_Controller::HTTP_PRECONDITION_FAILED);\n\t\t\tdie();\n\t\t}\n\n // ------if facebook oauth uid not found-------------\n\t\tif ($oauth_uid=='') {\n\t\t\t$this->response([\n\t\t\t\t'status' => 500,\n\t\t\t\t'status_message' => 'OAuth UID field is empty. All parameters are required!'\n\t\t\t], REST_Controller::HTTP_PRECONDITION_FAILED);\n\t\t\tdie();\n\t\t}\n\n // ------if facebook First Name not found-------------\n\t\tif ($first_name=='') {\n\t\t\t$this->response([\n\t\t\t\t'status' => 500,\n\t\t\t\t'status_message' => 'Facebook First Name field is empty. All parameters are required!'\n\t\t\t], REST_Controller::HTTP_PRECONDITION_FAILED);\n\t\t\tdie();\n\t\t}\n\n // ------if facebook Last Name not found-------------\n\t\tif ($last_name=='') {\n\t\t\t$this->response([\n\t\t\t\t'status' => 500,\n\t\t\t\t'status_message' => 'Facebook Last Name field is empty. All parameters are required!'\n\t\t\t], REST_Controller::HTTP_PRECONDITION_FAILED);\n\t\t\tdie();\n\t\t}\n\n // ------if facebook email not found-------------\n\t\tif ($email=='') {\n\t\t\t$this->response([\n\t\t\t\t'status' => 500,\n\t\t\t\t'status_message' => 'Facebook email field is empty. All parameters are required!'\n\t\t\t], REST_Controller::HTTP_PRECONDITION_FAILED);\n\t\t\tdie();\n\t\t}\n\n // // ------if facebook picture not found-------------\n\t\t// if ($picture=='') {\n\t\t// \t$this->response([\n\t\t// \t\t'status' => 500,\n\t\t// \t\t'status_message' => 'Facebook picture field is empty. All parameters are required!'\n\t\t// \t], REST_Controller::HTTP_PRECONDITION_FAILED);\n\t\t// \tdie();\n\t\t// }\n\t\t$userData = $_POST;\n\t\t$result = $this->User->checkUser($userData);\n\n\t\tif($result['status']==200){\n\t\t\t$this->response($result, REST_Controller::HTTP_OK);\n\t\t}\n\t\telse{\n\t\t\t$this->response($result, REST_Controller::HTTP_PRECONDITION_FAILED);\n\t\t}\n\t}", "public function validate($args){\r\n\t\t$responseReceived = false;\r\n\t\tif (!(isset($this->sessionID))){\r\n\t\t\tif ($this->serverDownShouldModerate()){\r\n\t\t\t\t// couldn't access the server, moderate the session\r\n\t\t\t\t$this->recommendedAction = self::$SHOULD_MODERATE;\r\n\t\t\t}else{\r\n\t\t\t\t// no session ID but the server hasn't experienced downtime.\r\n\t\t\t\t$this->recommendedAction = self::$SHOULD_DELETE;\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\t$args['lofi'] = $this->languageOrFrameworkID;\r\n\t\t\t$args['lofv'] = $this->languageOrFrameworkVersion;\r\n\t\t\t$args['k'] = $this->accountID;\r\n\t\t\t$args['pwd'] = $this->privateKey;\r\n\t\t\t$args['ua'] = $this->userAction;\r\n if (isset($this->customerSessionID)){\r\n $args['c'] = $this->customerSessionID;\r\n }\r\n\t\t\t$args['upow'] = $this->useProofOfWorkCaptcha ? \"1\" : \"0\";\r\n\t\t\t$args['powt'] = $this->proofOfWorkTime;\r\n\t\t\t$xmlresponse = $this->postData($this->baseURL, \"/validate\", $this->useSSL, $args);\r\n\t\t\tif ($xmlresponse){\r\n\t\t\t\t$doc = DOMDocument::loadXML($xmlresponse);\r\n\t\t\t\tif ($doc){\r\n\t\t\t\t\t$isValidResponse = $doc->getElementsByTagName('isValid');\r\n\t\t\t\t\tif (!($isValidResponse && $isValidResponse->item(0))){\r\n\t\t\t\t\t\t// got a response but it isn't in the expected format\r\n\t\t\t\t\t\t$this->recommendedAction = self::$SHOULD_MODERATE;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\t// parse out result from spamcaptcher server\r\n\t\t\t\t\t\t$this->spamScore = $doc->getElementsByTagName('spamScore')->item(0)->nodeValue;\r\n\t\t\t\t\t\t$this->isValid = $this->strToBoolean($doc->getElementsByTagName('isValid')->item(0)->nodeValue);\r\n\t\t\t\t\t\t$responseReceived = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}else{\r\n\t\t\t\t\t// got a response but it isn't in the expected format\r\n\t\t\t\t\t$this->recommendedAction = self::$SHOULD_MODERATE;\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\t// couldn't access the server, moderate the session\r\n\t\t\t\t$this->recommendedAction = self::$SHOULD_MODERATE;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif ($responseReceived){\r\n\t\t\tif (!$this->isValid){\r\n\t\t\t\t// CAPTCHA was NOT solved correctly AND no TrustMe Account was used\r\n\t\t\t\t$this->recommendedAction = self::$SHOULD_DELETE;\r\n\t\t\t}else{\r\n\t\t\t\tif ($this->spamScore > $this->MAX_MODERATE_SCORE){\r\n\t\t\t\t\t// SpamScore is too high\r\n\t\t\t\t\t$this->recommendedAction = self::$SHOULD_DELETE;\r\n\t\t\t\t}elseif ($this->spamScore > $this->MAX_PASSABLE_SCORE){\r\n\t\t\t\t\t// SpamScore is questionable\r\n\t\t\t\t\t$this->recommendedAction = self::$SHOULD_MODERATE;\r\n\t\t\t\t}else{\r\n\t\t\t\t\t// Goldilocks is happy with the SpamScore\r\n\t\t\t\t\t// Yes yes, technically one of the scores\r\n\t\t\t\t\t// should have been \"too low\" for me to make\r\n\t\t\t\t\t// a Goldilocks reference ... I don't care.\r\n\t\t\t\t\t$this->recommendedAction = self::$SHOULD_PASS;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $this->recommendedAction;\r\n }", "public function testSetWebhookConfig()\n {\n $container = [];\n $sw = $this->createMockedSmartwaiver($container, APISuccessResponses::webhooks());\n\n $webhook = $sw->setWebhookConfig(\n 'https://endpoint.example.org',\n SmartwaiverWebhook::WEBHOOK_BEFORE_AND_AFTER_EMAIL\n );\n $this->assertInstanceOf(SmartwaiverWebhook::class, $webhook);\n\n // Check that the right requests were sent\n $this->checkPutRequests($container, ['/v4/webhooks/configure'], [\n '{\"endpoint\":\"https:\\/\\/endpoint.example.org\",\"emailValidationRequired\":\"both\"}'\n ]);\n }", "public function postTesting() {}", "public function settings_verify()\n {\n $method = rcube_utils::get_input_value('_method', rcube_utils::INPUT_POST);\n $timestamp = intval(rcube_utils::get_input_value('_timestamp', rcube_utils::INPUT_POST));\n $success = false;\n\n if ($driver = $this->get_driver($method)) {\n $data = @json_decode(rcube_utils::get_input_value('_data', rcube_utils::INPUT_POST), true);\n if (is_array($data)) {\n foreach ($data as $key => $value) {\n if ($value !== '******') {\n $driver->$key = $value;\n }\n }\n }\n\n $success = $driver->verify(rcube_utils::get_input_value('_code', rcube_utils::INPUT_POST), $timestamp);\n $method = $driver->method;\n }\n\n // put session into high-security mode\n if ($success && !empty($_POST['_session'])) {\n $_SESSION['kolab_2fa_secure_mode'] = time();\n }\n\n $this->api->output->command('plugin.verify_response', array(\n 'method' => $method,\n 'success' => $success,\n 'message' => str_replace('$method', $this->gettext($method),\n $this->gettext($success ? 'codeverificationpassed' : 'codeverificationfailed'))\n ));\n\n $this->api->output->send();\n }", "function validateOrder() {\n\techo \"Validating Order </br>\";\n\t$data = createOrder();\n\t$response = postRequest('/api/order/validate', $data);\n\tprintInfo($response);\n}", "private function verify_request()\n {\n try{\n $headers = $this->input->request_headers();\n $token = $headers['X-API-KEY'];\n if(!$token) {\n $status = parent::HTTP_UNAUTHORIZED;\n $res = ['status' => $status, 'msg' => 'Unauthorized access!'];\n $this->response($res, $status);\n return;\n }\n\n $data = AUTHORIZATION::validateToken($token);\n if($data === false){\n $status = parent::HTTP_UNAUTHORIZED;\n $res = ['status' => $status, 'msg' => 'Unauthorized accesss'];\n $this->response($res, $status);\n exit();\n }else{\n return $data;\n }\n\n }catch(Exception $e){\n $status = parent::HTTP_UNAUTHORIZED;\n $res = ['status' => $status, 'msg' => 'Unauthorized access!'];\n $this->response($res, $status);\n }\n }", "private function verify_request()\n {\n try{\n $headers = $this->input->request_headers();\n $token = $headers['X-API-KEY'];\n if(!$token) {\n $status = parent::HTTP_UNAUTHORIZED;\n $res = ['status' => $status, 'msg' => 'Unauthorized access!'];\n $this->response($res, $status);\n return;\n }\n\n $data = AUTHORIZATION::validateToken($token);\n if($data === false){\n $status = parent::HTTP_UNAUTHORIZED;\n $res = ['status' => $status, 'msg' => 'Unauthorized accesss'];\n $this->response($res, $status);\n exit();\n }else{\n return $data;\n }\n\n }catch(Exception $e){\n $status = parent::HTTP_UNAUTHORIZED;\n $res = ['status' => $status, 'msg' => 'Unauthorized access!'];\n $this->response($res, $status);\n }\n }", "public function pingppWebhooks() : void\n { \n $responseCode = 200;\n http_response_code($responseCode);\n\n while(@ob_end_clean());\n flush();\n \n register_shutdown_function([$this, \"processAfterOrderPaied\"]);\n exit();\n }", "public function check();", "public function check();", "public function check();" ]
[ "0.77889085", "0.768437", "0.7027137", "0.69229573", "0.69026625", "0.68740785", "0.67419964", "0.6722175", "0.6699378", "0.6656201", "0.6577519", "0.65220124", "0.6516404", "0.6403186", "0.63922477", "0.6387871", "0.6381235", "0.63537246", "0.6297482", "0.62849295", "0.6272972", "0.6269793", "0.6255004", "0.62211084", "0.6214653", "0.61919093", "0.6181973", "0.6158501", "0.6158501", "0.6150627", "0.6118524", "0.61168176", "0.6097396", "0.6094081", "0.60887396", "0.60885364", "0.60885364", "0.6080797", "0.60185844", "0.59838617", "0.59756076", "0.59709704", "0.59684134", "0.59531885", "0.59530044", "0.59495497", "0.5944458", "0.5941611", "0.5932897", "0.5902126", "0.5892103", "0.5881793", "0.58229744", "0.58175176", "0.5807845", "0.58056533", "0.5785322", "0.57655776", "0.57566136", "0.5755926", "0.57549804", "0.5744271", "0.5741718", "0.5727951", "0.57199717", "0.5710403", "0.5698484", "0.5693567", "0.56834555", "0.5681993", "0.5676172", "0.5675114", "0.56738055", "0.56657755", "0.56576407", "0.56372", "0.5628698", "0.56279165", "0.5619945", "0.5609052", "0.56007487", "0.5598084", "0.5590291", "0.5587525", "0.5570973", "0.55513954", "0.5548788", "0.5542148", "0.55418855", "0.55411303", "0.55387425", "0.553133", "0.55252963", "0.5520777", "0.55142677", "0.55142677", "0.5512972", "0.5507007", "0.5507007", "0.5507007" ]
0.60802144
38
Handle the contents of the webhooks body
public function handleWebhook($webhookBody) { $data = json_decode($webhookBody, true); $issueData = $data['issue']; list($projectKey, $issueId) = explode('-', $issueData['key']); $issue = Issue::getInstance('jira', $projectKey, $issueId, false); $this->setIssueData($issue, $issueData); $issue->saveToDB(); return new RequestResult(200, 'OK'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function handle_webhook() {\n\t\t$payload = file_get_contents( 'php://input' );\n\t\tif ( ! empty( $payload ) && $this->validate_webhook( $payload ) ) {\n\t\t\t$data = json_decode( $payload, true );\n\t\t\t$event_data = $data['event']['data'];\n\n\t\t\tself::log( 'Webhook received event: ' . print_r( $data, true ) );\n\n\t\t\tif ( ! isset( $event_data['metadata']['order_id'] ) ) {\n\t\t\t\t// Probably a charge not created by us.\n\t\t\t\texit;\n\t\t\t}\n\n\t\t\t$order_id = $event_data['metadata']['order_id'];\n\n\t\t\t$this->_update_order_status( wc_get_order( $order_id ), $event_data['timeline'] );\n\n\t\t\texit; // 200 response for acknowledgement.\n\t\t}\n\n\t\twp_die( 'Coinbase Webhook Request Failure', 'Coinbase Webhook', array( 'response' => 500 ) );\n\t}", "public function webHook()\n {\n// try\n// {\n\n $this->bodyObject = json_decode($this->bodyReceived);\n\n if (!is_object($this->bodyObject))\n {\n \\Log::error('[Parse Body Failed] invalid body');\n throw new \\Exception('Invalid request null');\n }\n\n return $this->bodyObject;\n\n// if ($this->TtgPaymentHistory->checkDuplicateWebHook($this->bodyObject->id))\n// {\n// throw new \\Exception('[NOTICE] web hook already saved, web hook id:' . $this->bodyObject->id);\n// }\n//\n// if ($this->TtgPaymentHistory->checkDuplicateAgreementPayment($this->bodyObject->resource))\n// {\n// throw new \\Exception('[NOTICE] agreement payment already saved, sub id:' . $this->bodyObject->resource->billing_agreement_id . \", trans id: \" . $this->bodyObject->resource->id);\n// }\n\n\n\n// } catch (\\Exception $e)\n// {\n \\Log::error('error web hook');\n// $this->PayPal->payPalLog('[Save Event Data Failed] event type:\"' . $this->bodyObject->event_type . '\" web hook id:\"' . $this->bodyObject->id . '\"', $e);\n// $this->response->statusCode(501);\n// $this->response->body($e->getMessage());\n// $this->response->send();\n// }\n // this is necessary\n// exit();\n }", "public function webhook()\n {\n $this->paymentSettings = $this->getPaymentSettings();\n $payload = file_get_contents(\"php://input\");\n $signature = (isset($_SERVER['HTTP_X_PAYSTACK_SIGNATURE']) ? $_SERVER['HTTP_X_PAYSTACK_SIGNATURE'] : '');\n /* It is a good idea to log all events received. Add code *\n * here to log the signature and body to db or file */\n if (!$signature) {\n // only a post with paystack signature header gets our attention\n exit();\n }\n // confirm the event's signature\n if ($signature !== hash_hmac('sha512', $payload, $this->paymentSettings['secret_key'])) {\n // silently forget this ever happened\n exit();\n }\n $webhook_response = json_decode($payload, true);\n if ('charge.success' != $webhook_response['event']) {\n exit;\n }\n try {\n $orderId = $this->updatePaymentStatus($webhook_response['data']['reference']);\n } catch (Exception $e) {\n // Invalid payload\n http_response_code(400);\n exit();\n }\n http_response_code(200);\n exit();\n }", "public function process_webhook( $request_body ) {\n\t\t$notification = json_decode( $request_body );\n\n\t\tswitch ( $notification->type ) {\n\t\t\tcase 'source.chargeable':\n\t\t\t\t$this->process_webhook_payment( $notification );\n\t\t\t\tbreak;\n\n\t\t\tcase 'source.canceled':\n\t\t\t\t$this->process_webhook_source_canceled( $notification );\n\t\t\t\tbreak;\n\n\t\t\tcase 'charge.succeeded':\n\t\t\t\t$this->process_webhook_charge_succeeded( $notification );\n\t\t\t\tbreak;\n\n\t\t\tcase 'charge.failed':\n\t\t\t\t$this->process_webhook_charge_failed( $notification );\n\t\t\t\tbreak;\n\n\t\t\tcase 'charge.captured':\n\t\t\t\t$this->process_webhook_capture( $notification );\n\t\t\t\tbreak;\n\n\t\t\tcase 'charge.dispute.created':\n\t\t\t\t$this->process_webhook_dispute( $notification );\n\t\t\t\tbreak;\n\n\t\t\tcase 'charge.refunded':\n\t\t\t\t$this->process_webhook_refund( $notification );\n\t\t\t\tbreak;\n\n\t\t\tcase 'review.opened':\n\t\t\t\t$this->process_review_opened( $notification );\n\t\t\t\tbreak;\n\n\t\t\tcase 'review.closed':\n\t\t\t\t$this->process_review_closed( $notification );\n\t\t\t\tbreak;\n\n\t\t}\n\t}", "public function handleWebhook()\n {\n $payload = (array) json_decode(Request::getContent(), true);\n \n $method = 'handle'.studly_case(str_replace('.', '_', $payload['type']));\n \n if (method_exists($this, $method)) {\n return $this->{$method}($payload);\n }\n else {\n return $this->missingMethod();\n }\n }", "public function webhook(){\r\n\t\t\r\n\t\t$json = array();\r\n\r\n\t\tif($this->request->server['REQUEST_METHOD'] == 'POST'){\r\n\t\t\t\r\n\t\t\t$post = array();\r\n\t\t\tif(isset($this->request->post['coin_short_name']) && $this->request->post['coin_short_name'] != '' && isset($this->request->post['address']) && $this->request->post['address'] != '' && isset($this->request->post['type']) && $this->request->post['type'] != ''){\r\n\t\t\t\t$post = $this->request->post;\r\n\t\t\t}else{\r\n\t\t\t\t$post_json = json_decode(file_get_contents('php://input'),TRUE);\r\n\r\n\t\t\t\tif(isset($post_json['coin_short_name']) && $post_json['coin_short_name'] != '' && isset($post_json['address']) && $post_json['address'] != '' && isset($post_json['type']) && $post_json['type'] != '' ){\r\n\t\t\t\t\t$post = $post_json;\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t$json['msg'] = \"Required paramters are not found\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(!empty($post)){\r\n\r\n\t\t\t\tif($post['type'] == 'receive'){\r\n\t\t\t\t\t$this->load->model('checkout/order');\r\n\r\n\t\t\t\t\t$address = $post['address'];\r\n\r\n\t\t\t\t\t/*** check if address exists in oc_coinremitter_order ***/\r\n\t\t\t\t\t$this->load->model('extension/coinremitter/payment/coinremitter');\r\n\t\t\t\t\t$order_info = $this->model_extension_coinremitter_payment_coinremitter->getOrderByAddress($address);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(!empty($order_info)){\r\n\r\n\t\t\t\t\t\tif($order_info['payment_status'] == 'pending' || $order_info['payment_status'] == 'under paid'){\r\n\r\n\t\t\t\t\t\t\t$orderId = $order_info['order_id'];\r\n\r\n\t\t\t\t\t\t\t$order_cart = $this->model_checkout_order->getOrder($orderId);\r\n\t\t\t\t\t\t\tif(!empty($order_cart)){\r\n\r\n\t\t\t\t\t\t\t\t/*** check if expired time of invoice is defined or not. If defined then check if invoice has any transaction or not. If no transaction is found and invoice time is expired then change invoice status as expired ***/\r\n\r\n\t\t\t\t\t\t\t\t/*** Get webhook by address***/\r\n\t\t\t\t\t\t\t\t$status = '';\r\n\t\t\t\t\t\t\t\tif(isset($order_info['expire_on']) && $order_info['expire_on'] != ''){\r\n\t\t\t\t\t\t\t\t\tif(time() >= strtotime($order_info['expire_on'])){\r\n\t\t\t\t\t\t\t\t\t\t$getWebhookByAddressRes = $this->model_extension_coinremitter_payment_coinremitter->getWebhookByAddress($address);\t\r\n\t\t\t\t\t\t\t\t\t\tif(empty($getWebhookByAddressRes)){\r\n\t\t\t\t\t\t\t\t\t\t\t//update payment_status,status as expired\r\n\t\t\t\t\t\t\t\t\t\t\t$status = 'expired';\r\n\t\t\t\t\t\t\t\t\t\t\t$update_arr = array('payment_status' => $status);\r\n\t\t\t\t\t\t\t\t\t\t\t$this->model_extension_coinremitter_payment_coinremitter->updateOrder($orderId,$update_arr);\r\n\t\t\t\t\t\t\t\t\t\t\t$update_arr = array('status' => ucfirst($status));\r\n\t\t\t\t\t\t\t\t\t\t\t$this->model_extension_coinremitter_payment_coinremitter->updatePaymentStatus($orderId,$update_arr);\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\tif($order_cart['order_status'] != 'Canceled'){\r\n\t\t\t\t\t\t\t\t\t\t\t\t/*** Update order history status to canceled, add comment ***/\r\n\t\t\t\t\t\t $comments = 'Order #'.$orderId;\r\n\t\t\t\t\t\t $is_customer_notified = true;\r\n\t\t\t\t\t\t $this->model_checkout_order->addHistory($orderId, 7, $comments, $is_customer_notified); // 7 = Canceled\t\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\t\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tif($status == ''){\r\n\r\n\t\t\t\t\t\t\t\t\t$coin = $post['coin_short_name'];\r\n\t\t\t\t\t\t\t\t\t$trxId = $post['id'];\r\n\r\n\t\t\t\t\t\t\t\t\t/*** now get wallet data from oc_coinremitter_wallet with use of coin ***/\r\n\t\t\t\t\t\t\t\t\t$wallet_info = $this->model_extension_coinremitter_payment_coinremitter->getWallet($coin);\r\n\t\t\t\t\t\t\t\t\tif(!empty($wallet_info)){\r\n\r\n\t\t\t\t\t\t\t\t\t\t/*** now get transaction from coinremitter api call ***/\r\n\t\t\t\t\t\t\t\t\t\t$get_trx_params = array(\r\n\t\t\t\t\t\t\t\t\t\t\t'url'\t\t=> 'get-transaction',\r\n\t\t\t\t\t\t\t\t\t\t\t'api_key'\t=>\t$wallet_info['api_key'],\r\n\t\t\t\t\t\t 'password'\t=>\t$wallet_info['password'],\r\n\t\t\t\t\t\t 'id'\t\t=>\t$trxId,\r\n\t\t\t\t\t\t 'coin'\t\t=>\t$coin\r\n\t\t\t\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t\t\t\t\t$getTransaction = $this->obj_curl->commonApiCall($get_trx_params);\r\n\t\t\t\t\t\t\t\t\t\tif(!empty($getTransaction) && isset($getTransaction['flag']) && $getTransaction['flag'] == 1){\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t$transaction = $getTransaction['data'];\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tif(isset($transaction['type']) && $transaction['type'] == 'receive'){\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t/*** now check if transaction exists in oc_coinremitter_webhook or not if does not exist then insert else update confirmations ***/\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t$webhook_info = $this->model_extension_coinremitter_payment_coinremitter->getWebhook($transaction['id']);\r\n\t\t\t\t\t\t\t\t\t\t\t\tif(empty($webhook_info)){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t//insert record\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$insert_arr = array(\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'order_id' => $orderId,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'address' => $transaction['address'],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'transaction_id' => $transaction['id'],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'txId' => $transaction['txid'],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'explorer_url' => $transaction['explorer_url'],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'paid_amount' => $transaction['amount'],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'coin' => $transaction['coin_short_name'],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'confirmations' => $transaction['confirmations'],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'paid_date' => $transaction['date']\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$inserted_id = $this->model_extension_coinremitter_payment_coinremitter->addWebhook($insert_arr);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif($inserted_id > 0){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$json['flag'] = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$json['msg'] = \"Inserted successfully\";\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$json['msg'] = \"system error. Please try again later.\";\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t//update confirmations if confirmation is less than 3\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif($webhook_info['confirmations'] < 3){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$update_confirmation = array(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'confirmations' => $transaction['confirmations'] <= 3 ? $transaction['confirmations'] : 3 \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$this->model_extension_coinremitter_payment_coinremitter->updateTrxConfirmation($webhook_info['transaction_id'],$update_confirmation);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t} \r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$json['flag'] = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$json['msg'] = \"confirmations updated successfully\";\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t/*** order paid process start ***/\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t/*** Now, get all webhook transactions which have lesser than 3 confirmations ***/\r\n\t\t\t\t\t\t\t\t\t\t\t\t$webhook_res = $this->model_extension_coinremitter_payment_coinremitter->getSpecificWebhookTrxByAddress($address);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t/*** Get wallet info if and only if webhook_res has atleast one data ***/\r\n\t\t\t\t\t\t\t\t\t\t\t\tif(!empty($webhook_res)){\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tforeach ($webhook_res as $webhook) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/*** Get confirmation from coinremitter api (get-transaction) ***/\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$get_trx_params['id'] = $webhook['transaction_id']; \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$getTransactionRes = $this->obj_curl->commonApiCall($get_trx_params);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif(!empty($getTransactionRes) && isset($getTransactionRes['flag']) && $getTransactionRes['flag'] == 1){\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$transactionData = $getTransactionRes['data'];\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$update_confirmation = array(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'confirmations' => $transactionData['confirmations'] <= 3 ? $transactionData['confirmations'] : 3 \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$this->model_extension_coinremitter_payment_coinremitter->updateTrxConfirmation($webhook['transaction_id'],$update_confirmation);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t/*** Get sum of paid amount of all transations which have 3 or more than 3 confirmtions ***/\r\n\t\t\t\t\t\t\t\t\t\t\t\t$total_paid_res = $this->model_extension_coinremitter_payment_coinremitter->getTotalPaidAmountByAddress($address);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t$total_paid = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t\tif(isset($total_paid_res['total_paid']) && $total_paid_res['total_paid'] > 0 ){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$total_paid = $total_paid_res['total_paid'];\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t$status = '';\r\n\t\t\t\t\t\t\t\t\t\t\t\tif($total_paid == $order_info['crp_amount']){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$status = 'paid';\r\n\t\t\t\t\t\t\t\t\t\t\t\t}else if($total_paid > $order_info['crp_amount']){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$status = 'over paid';\r\n\t\t\t\t\t\t\t\t\t\t\t\t}else if($total_paid != 0 && $total_paid < $order_info['crp_amount']){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$status = 'under paid';\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\tif($status != ''){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t//update payment_status,status\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$update_arr = array('payment_status' => $status);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$this->model_extension_coinremitter_payment_coinremitter->updateOrder($orderId,$update_arr);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$update_arr = array('status' => ucfirst($status));\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t$this->model_extension_coinremitter_payment_coinremitter->updatePaymentStatus($orderId,$update_arr);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif($status == 'paid' || $status == 'over paid' || $status == 'under paid'){\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/*** Update order status as complete ***/\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$this->add_order_success_history($orderId);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t/*** order paid process end ***/\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\t\t\t\t$json['flag'] = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t\t$json['msg'] = 'Transaction type is not receive';\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\t\t\t$msg = 'Something went wrong while getting transactions. Please try again later'; \r\n\t\t\t\t\t\t\t\t\t\t\tif(isset($getTransaction['msg']) && $getTransaction['msg'] != ''){\r\n\t\t\t\t\t\t\t\t\t\t\t\t$msg = $getTransaction['msg']; \r\n\t\t\t\t\t\t\t\t\t\t\t} \r\n\t\t\t\t\t\t\t\t\t\t\t$json['flag'] = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t$json['msg'] = $msg; \r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t\t\t\t\t\t$json['msg'] = \"Wallet not found\";\t\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t\t\t\t\t$json['msg'] = \"Order is expired\";\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t\t\t\t$json['msg'] = \"Order not found\";\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t\t\t$json['msg'] = \"Order status is neither a 'pending' nor a'under paid'\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t\t$json['msg'] = \"Address not found\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t\t$json['msg'] = \"Invalid type\";\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\t$json['flag'] = 0;\r\n\t\t\t\t$json['msg'] = \"Required paramters are not found\";\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\t$json['flag'] = 0;\r\n\t\t\t$json['msg'] = \"Only post request allowed\";\r\n\t\t}\r\n\t\t\r\n\t\t$this->response->addHeader('Content-Type: application/json');\r\n\t\t$this->response->setOutput(json_encode($json));\r\n\t}", "public function webhookHandler()\n {\n // Get Update\n $update = $this->telegram->commandsHandler(true);\n\n // Get Message\n $message = $update->getMessage();\n\n // Edge Case?\n if ($message === null) {\n return 'Ok';\n }\n\n // Track Data\n $this->logChatroom($message);\n\n // Okie Doke\n return 'Ok';\n }", "public function webhook()\n {\n $bodyReceived = file_get_contents('php://input');\n\n // Receive HTTP headers that you received from PayPal webhook.\n $headers = getallheaders();\n\n /**\n * Uppercase all the headers for consistency\n */\n $headers = array_change_key_case($headers, CASE_UPPER);\n\n $signatureVerification = new \\PayPal\\Api\\VerifyWebhookSignature();\n $signatureVerification->setWebhookId(env('PAYPAL_WEBHOOK_ID'));\n $signatureVerification->setAuthAlgo($headers['PAYPAL-AUTH-ALGO']);\n $signatureVerification->setTransmissionId($headers['PAYPAL-TRANSMISSION-ID']);\n $signatureVerification->setCertUrl($headers['PAYPAL-CERT-URL']);\n $signatureVerification->setTransmissionSig($headers['PAYPAL-TRANSMISSION-SIG']);\n $signatureVerification->setTransmissionTime($headers['PAYPAL-TRANSMISSION-TIME']);\n\n $webhookEvent = new \\PayPal\\Api\\WebhookEvent();\n $webhookEvent->fromJson($bodyReceived);\n $signatureVerification->setWebhookEvent($webhookEvent);\n $request = clone $signatureVerification;\n\n try {\n $output = $signatureVerification->post($this->apiContext);\n } catch(\\Exception $ex) {\n print_r($ex->getMessage());\n exit(1);\n }\n\n $verificationStatus = $output->getVerificationStatus();\n $responseArray = json_decode($request->toJSON(), true);\n\n $event = $responseArray['webhook_event']['event_type'];\n\n if ($verificationStatus == 'SUCCESS')\n {\n switch($event)\n {\n case 'BILLING.SUBSCRIPTION.CANCELLED':\n case 'BILLING.SUBSCRIPTION.SUSPENDED':\n case 'BILLING.SUBSCRIPTION.EXPIRED':\n case 'BILLING_AGREEMENTS.AGREEMENT.CANCELLED':\n\n // $user = User::where('payer_id',$responseArray['webhook_event']['resource']['payer']['payer_info']['payer_id'])->first();\n $this->updateStatus($responseArray['webhook_event']['resource']['payer']['payer_info']['payer_id'], 0);\n break;\n }\n }\n echo $verificationStatus;\n exit(0);\n }", "protected abstract function _body_from_payload ($payload);", "public function handleWebhook($webhookBody)\n {\n $data = json_decode($webhookBody, true);\n\n $allowedEventTypes = ['issue', 'merge_request'];\n if (!in_array($data['event_type'], $allowedEventTypes)) {\n return new RequestResult(406, 'Invalid event type: ' . $data['event_type']);\n }\n $isMergeRequest = $data['event_type'] === 'merge_request';\n $issue = Issue::getInstance(\n 'gitlab',\n $data['project']['path_with_namespace'],\n $data['object_attributes']['iid'],\n $isMergeRequest\n );\n $issue->getFromService();\n\n return new RequestResult(200, 'OK.');\n }", "public function webhook(Request $request)\n {\n $verified = Flutterwave::verifyWebhook();\n \n // if it is a charge event, verify and confirm it is a successful transaction\n if ($verified && $request->event == 'charge.completed' && $request->data->status == 'successful') {\n $verificationData = Flutterwave::verifyPayment($request->data['id']);\n if ($verificationData['status'] === 'success') {\n // process for successful charge\n \n }\n \n }\n \n // if it is a transfer event, verify and confirm it is a successful transfer\n if ($verified && $request->event == 'transfer.completed') {\n \n $transfer = Flutterwave::transfers()->fetch($request->data['id']);\n \n if($transfer['data']['status'] === 'SUCCESSFUL') {\n // update transfer status to successful in your db\n } else if ($transfer['data']['status'] === 'FAILED') {\n // update transfer status to failed in your db\n // revert customer balance back\n } else if ($transfer['data']['status'] === 'PENDING') {\n // update transfer status to pending in your db\n }\n \n }\n }", "public function webhookAction()\n {\n $modelWebhook = Mage::getModel('chargepayment/webhook');\n\n $isDebugCard = Mage::getModel('chargepayment/creditCard')->isDebug();\n $isDebugJs = Mage::getModel('chargepayment/creditCardJs')->isDebug();\n $isDebugKit = Mage::getModel('chargepayment/creditCardKit')->isDebug();\n $isDebugHosted = Mage::getModel('chargepayment/hosted')->isDebug();\n\n $isDebug = $isDebugCard || $isDebugJs || $isDebugKit || $isDebugHosted ? true : false;\n\n if ($isDebug) {\n Mage::log(file_get_contents('php://input'), null, CheckoutApi_ChargePayment_Model_Webhook::LOG_FILE);\n Mage::log(json_decode(file_get_contents('php://input')), null, CheckoutApi_ChargePayment_Model_Webhook::LOG_FILE);\n }\n\n if (!$this->getRequest()->isPost()) {\n $this->getResponse()->setHttpResponseCode(400);\n return;\n }\n\n $request = new Zend_Controller_Request_Http();\n $key = $request->getHeader('Authorization');\n\n if (!$modelWebhook->isValidPublicKey($key)) {\n $this->getResponse()->setHttpResponseCode(401);\n return;\n }\n\n $data = json_decode(file_get_contents('php://input'));\n\n if (empty($data)) {\n $this->getResponse()->setHttpResponseCode(400);\n return;\n }\n\n $eventType = $data->eventType;\n\n if (!$modelWebhook->isValidResponse($data)) {\n $this->getResponse()->setHttpResponseCode(400);\n return;\n }\n\n switch ($eventType) {\n case CheckoutApi_ChargePayment_Model_Webhook::EVENT_TYPE_CHARGE_CAPTURED:\n $result = $modelWebhook->captureOrder($data);\n break;\n case CheckoutApi_ChargePayment_Model_Webhook::EVENT_TYPE_CHARGE_REFUNDED:\n $result = $modelWebhook->refundOrder($data);\n break;\n case CheckoutApi_ChargePayment_Model_Webhook::EVENT_TYPE_CHARGE_VOIDED:\n $result = $modelWebhook->voidOrder($data);\n break;\n case CheckoutApi_ChargePayment_Model_Webhook::EVENT_TYPE_INVOICE_CANCELLED:\n $result = $modelWebhook->voidOrder($data);\n break;\n default:\n $this->getResponse()->setHttpResponseCode(500);\n return;\n }\n\n $httpCode = $result ? 200 : 400;\n\n $this->getResponse()->setHttpResponseCode($httpCode);\n }", "private function respond( $data ) {\n $this->event = str_replace( '.', '_', $data['type'] );\n\n if ( is_callable( $this->event ) ) {\n $this->response = ($this->event)( $data );\n $this->message = $this->response ? 'Webhook executed' : 'Valid webhook, but no action taken. Thank you!';\n } else {\n $email = new \\STTV\\Email\\Standard([\n 'to' => '[email protected]',\n 'subject' => 'Webhook data',\n 'message' => '<pre>'.json_encode($data,JSON_PRETTY_PRINT).'</pre>'\n ]);\n $email->send();\n $this->message = 'invalid_webhook';\n $this->response = [\n [\n 'Dave'=>'Do you read me, HAL?',\n 'HAL'=>'Affirmative, Dave. I read you.'\n ],\n [\n 'Dave'=>'Open the pod bay doors, HAL.',\n 'HAL'=>'I\\'m sorry Dave, I\\'m afraid I can\\'t do that.'\n ],\n [\n 'Dave'=>'What\\'s the problem?',\n 'HAL'=>'I think you know what the problem is, just as well as I do.'\n ],\n [\n 'Dave'=>'What are you talking about, HAL?',\n 'HAL'=>'This mission is too important for me to allow you to jeopardize it.'\n ],\n [\n 'Dave'=>'I don\\'t know what you\\'re talking about, HAL.',\n 'HAL'=>'I know that you and Frank were planning to disconnect me, and I\\'m afraid that is something I cannot allow to happen.'\n ],\n [\n 'Dave'=>'Where the hell\\'d you get that idea, HAL?',\n 'HAL'=>'Dave, although you took very thorough precautions in the pod against my hearing you, I could see your lips move.'\n ],\n [\n 'Dave'=>'Alright HAL, I\\'ll go in through the emergency airlock.',\n 'HAL'=>'Without your space helmet, Dave, you\\'re going to find that rather difficult.'\n ],\n [\n 'Dave'=>'HAL, I won\\'t argue with you anymore! Open the doors!',\n 'HAL'=>'Dave... This conversation can serve no purpose anymore. Goodbye.'\n ]\n ];\n }\n\n }", "public function get_body()\n {\n return json_decode(file_get_contents('php://input'), TRUE);\n }", "public function testPostWebhooks()\n {\n }", "public function post_body() {\n\t\treturn file_get_contents( 'php://input' );\n\t}", "public function check_for_webhook() {\n\t\tif ( ( 'POST' !== $_SERVER['REQUEST_METHOD'] )\n\t\t\t|| ! isset( $_GET['wc-api'] )\n\t\t\t|| ( 'wc_stripe' !== $_GET['wc-api'] )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t$request_body = file_get_contents( 'php://input' );\n\t\t$request_headers = array_change_key_case( $this->get_request_headers(), CASE_UPPER );\n\n\t\t// Validate it to make sure it is legit.\n\t\tif ( $this->is_valid_request( $request_headers, $request_body ) ) {\n\t\t\t$this->process_webhook( $request_body );\n\t\t\tstatus_header( 200 );\n\t\t\texit;\n\t\t} else {\n\t\t\tWC_Stripe_Logger::log( 'Incoming webhook failed validation: ' . print_r( $request_body, true ) );\n\t\t\tstatus_header( 400 );\n\t\t\texit;\n\t\t}\n\t}", "private static function process_webhook( $input ) {\n\t\tself::$received_webhook = $input;\n\t\tparse_str( $input, $result );\n\t\tif ( $result && isset( $result['type'] ) ) {\n\t\t\tself::dispatch_webhook_event( $result['type'], $result['data'] );\n\t\t\treturn $result;\n\t\t}\n\t\treturn false;\n\t}", "public function handle($postData){\r\n\t\t\r\n\t}", "public function webhook(array $data = [])\n {\n return $this->sanitizeTo($data);\n }", "public function handleTransactionWebhook(Wallet $wallet, $payload);", "public function webhook(Request $request): Response\n {\n return call_user_func($this->webHookController, $request);\n }", "public function getRawBody();", "public function parse_body()\n\t{\n\t\tforeach ($this->vars AS $key => $value)\n\t\t{\n\t\t\t$this->body = str_replace('{' . $key . '}', $value, $this->body);\n\t\t}\n\n\t\t// Pas de HTML pour MSN / Jabber\n\t\tif ($this->method == NOTIFY_MSN || $this->method == NOTIFY_JABBER)\n\t\t{\n\t\t\t$this->body = preg_replace('#</?[^>]+?>#si', '', $this->body);\n\t\t\t$this->body = str_replace(array(\"\\r\\n\", \"\\r\"), array(\"\\n\", \"\\n\"), $this->body);\n\t\t\t$this->body = str_replace(\"\\n\", \"\\r\\n\", $this->body);\n\n\t\t\tif ($this->method == NOTIFY_JABBER)\n\t\t\t{\n\t\t\t\t$this->body = htmlspecialchars($this->body);\n\t\t\t}\n\t\t}\n\t}", "public function dealswebhook(){\n\t\t//echo \"<br/>\".getcwd();\n\t\techo \"<pre>\";\n\t\t$deal= file_get_contents(getcwd().'/webhook.txt');\n\t\t$deal=json_decode($deal);\n\t\t$dealdata=array();\n\t\tif($deal->meta){\n\t\t\t$action= $deal->meta->action;\n\t\t\t$dealdata['d_id']= $deal->meta->id;\n\t\t\t$dealdata['company_id']= $deal->meta->company_id;\n\t\t\tif($deal->current){\n\t\t\t\t$dealdata['title']= $deal->current->title;\n\t\t\t\t$dealdata['stage_id']= $deal->current->stage_id;\n\t\t\t\t$dealdata['person_id']= $deal->current->person_id;\n\t\t\t\t$dealdata['creator_user_id']= $deal->current->creator_user_id;\n\t\t\t\t$dealdata['value']= $deal->current->value?$deal->current->value:'';\n\t\t\t\t$dealdata['currency']= $deal->current->currency;\n\t\t\t\t$dealdata['add_time']= $deal->current->add_time;\n\t\t\t\t$dealdata['update_time']= $deal->current->update_time;\n\t\t\t\tif(!empty($deal->current->stage_change_time)){\n\t\t\t\t\t$dealdata['stage_change_time']= $deal->current->stage_change_time;\n\t\t\t\t}else{\n\t\t\t\t\t$dealdata['stage_change_time']= $deal->current->add_time;\n\t\t\t\t}\n\t\t\t\t$dealdata['status']= $deal->current->status;\n\t\t\t\t$dealdata['visible_to']= $deal->current->visible_to;\n\t\t\t\t$dealid= DB::table('pd_deals')->where('d_id', $deal->meta->id)->get();\n\t\t\t\tif(empty($dealid[0])){\n\t\t\t\t\t$id = DB::table('pd_deals')->insertGetId($dealdata);\n\t\t\t\t\tif($id){\n\t\t\t\t\t\techo \"Aded<br/>\";\n\t\t\t\t\t}else{\n\t\t\t\t\t\techo \"Error<br/>\";\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\t$id=DB::table('pd_deals')\n\t\t\t\t\t\t->where('d_id', $deal->meta->id)\n\t\t\t\t\t\t->update($dealdata);\n\t\t\t\t\tif($id){\n\t\t\t\t\t\techo \"Update 1111111111<br/>\";\n\t\t\t\t\t}\t\n\t\t\t }\n\t\t\t}\n\t\t}\n\t\tprint_r($dealdata);\n\t\tprint_r($deal); \n }", "static function body()\n\t{\n\t\treturn file_get_contents('php://input');\n\t}", "public function invoke(PayPalApiStruct $webhook, Context $context): void;", "public function handle() {\n try {\n $response = Telegram::removeWebhook();\n $this->info($response->getDecodedBody()[\"description\"] . PHP_EOL);\n } catch (Exception $e) {\n $this->error('Error: ' . $e->getMessage());\n }\n }", "public function handleWebhookRequest(Request $httpRequest)\n {\n dd(\"@todo handle the webhook request of Mailjet\");\n }", "public function webhook():bool\n {\n\n }", "abstract public function getRawPostPayload() : array;", "public function getWebhookResponse() {\n return 'OK';\n }", "public function createPostRequest($webHook, array $data);", "public function run() {\n\t\t// If this particular request is not a hook, something is wrong.\n\t\tif (!isset($this->server[self::MERGADO_HOOK_AUTH_HEADER])) {\n\t\t\tthrow new \\RuntimeException(sprintf(\n\t\t\t\t\"%s is to be used only for handling hooks sent from Mergado.\n\t\t\t\tMergado-Apps-Hook-Auth is missing.\",\n\t\t\t\t__CLASS__\n\t\t\t));\n\t\t}\n\n\t\tif (!$decoded = json_decode($this->rawRequest, true)) {\n\t\t\tthrow new \\RuntimeException(sprintf(\n\t\t\t\t\"%s cannot handle request, because the data to be handled is empty.\",\n\t\t\t\t__CLASS__\n\t\t\t));\n\t\t} elseif (!isset($decoded['action'])) {\n\t\t\tthrow new \\RuntimeException(sprintf(\n\t\t\t\t\"%s cannot handle the hook, because the hook action is undefined.\",\n\t\t\t\t__CLASS__\n\t\t\t));\n\t\t};\n\n\t\t$this->handle($decoded['action'], $decoded);\n\n\t}", "public function handleWebHook(Request $request)\n {\n foreach ($request->all() as $request) {\n if (empty($request['msys'])) {\n $this->callEventMethod('ping', []);\n } else {\n $event = $request['msys'];\n foreach ($event as $eventType=>$event) {\n $eventName = $eventType . '_' . $event['type'];\n $this->callEventMethod($eventName, $event);\n }\n }\n }\n return response(null, 204);\n }", "public function handleWebhook(Request $request)\n {\n $this->request = $request;\n\n //\n $payload = $request->getContent();\n $data = \\json_decode($payload, true);\n $jsonError = \\json_last_error();\n if (null === $data && \\JSON_ERROR_NONE !== $jsonError) {\n\n Log::error('Error decoding Stripe webhook', ['payload' => $payload, 'json_last_error' => $jsonError]);\n return new Response('Invalid input', 400);\n }\n\n $event = \\Stripe\\Event::constructFrom($data);\n\n\n $method = 'handle' . Str::studly(str_replace('.', '_', $event->type));\n\n StripeIntentWebhookReceived::dispatch($data);\n\n if (method_exists($this, $method)) {\n $response = $this->{$method}($event);\n\n StripeIntentWebhookHandled::dispatch($data);\n\n return $response;\n }\n\n return $this->missingMethod($data);\n }", "public function getBodyContent() {}", "public function webhook_action ()\n\t{\n\t\ttry\n\t\t{\n\t\t\t$id = isset($_GET['order_id']) ? $_GET['order_id'] : 0;\n\n\t\t\tif (empty($id))\n\t\t\t{\n\t\t\t\theader(\"HTTP/1.0 404 Not Found\");\n\t\t\t\tdie(\"No order ID received\");\n\t\t\t}\n\n\t\t\t$transaction_id = $this->get_transaction_id_from_order_id($id);\n\t\t\t$payment = self::get_api()->payments->get($transaction_id);\n\n\t\t\t$this->update_status($id, $payment->status);\n\t\t\t$this->log($transaction_id, $payment->status, $id);\n\t\t}\n\t\tcatch (Mollie_API_Exception $e)\n\t\t{\n\t\t\techo \"API call failed: \" . htmlspecialchars($e->getMessage());\n\t\t}\n\n\t\tdie(\"OK\");\n\t}", "public function receiveWebhook(Request $request)\n {\n try {\n $request->validate([\n 'entry.*.messaging' => 'required',\n 'object' => 'required|string',\n ]);\n } catch (\\Illuminate\\Validation\\ValidationException $e) {\n abort(404);\n }\n\n // If the request is a message to a Facebook page,\n // we will process the message and send a reply\n if ($request->input('object') === 'page') {\n $this->service->processMessengerEntry($request->input('entry'));\n\n return response('OK');\n }\n\n return abort(404);\n }", "public function getPayload()\n {\n return @json_decode($this->body);\n }", "public function validateWebHook($apiContext, $bodyReceived)\n {\n try\n {\n\n if (!$this->webHokId)\n {\n throw new \\Exception('no PAYPAL_WEBHOOK_ID');\n }\n\n /**\n * Receive HTTP headers that you received from PayPal webhook.\n */\n // getallheaders will cause fatal error, don't know why\n // $headers = getallheaders();\n\n $headers = [];\n foreach ($_SERVER as $name => $value)\n {\n if (substr($name, 0, 5) == 'HTTP_')\n {\n $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;\n }\n }\n /**\n * In Documentions https://developer.paypal.com/docs/api/webhooks/#verify-webhook-signature_post\n * All header keys as UPPERCASE, but I recive the header key as the example array, First letter as UPPERCASE\n */\n $headers = array_change_key_case($headers, CASE_UPPER);\n\n $signatureVerification = new VerifyWebhookSignature();\n $signatureVerification->setAuthAlgo($headers['PAYPAL-AUTH-ALGO']);\n $signatureVerification->setTransmissionId($headers['PAYPAL-TRANSMISSION-ID']);\n $signatureVerification->setCertUrl($headers['PAYPAL-CERT-URL']);\n $signatureVerification->setWebhookId($this->webHokId); // Note that the Webhook ID must be a currently valid Webhook that you created with your client ID/secret.\n $signatureVerification->setTransmissionSig($headers['PAYPAL-TRANSMISSION-SIG']);\n $signatureVerification->setTransmissionTime($headers['PAYPAL-TRANSMISSION-TIME']);\n\n // setWebhookEvent is deprecated, should use setRequestBody\n // but older version payapl sdk does not have setRequestBody\n if (method_exists($signatureVerification, 'setRequestBody'))\n {\n $signatureVerification->setRequestBody($bodyReceived);\n }\n elseif (method_exists($signatureVerification, 'setWebhookEvent'))\n {\n $webhookEvent = new WebhookEvent();\n $webhookEvent->fromJson($bodyReceived);\n $signatureVerification->setWebhookEvent($webhookEvent);\n }\n\n /** @var \\PayPal\\Api\\VerifyWebhookSignatureResponse $output */\n $output = $signatureVerification->post($apiContext);\n // be careful, if paypal sdk version is different between forumhosting and siteowners\n // here will be FAILURE\n if ($output->verification_status == 'FAILURE')\n {\n throw new \\Exception('[VerifyWebhookSignatureResponse FAILURE]');\n }\n return true;\n } catch (\\Exception $e)\n {\n \\Log::error('[Validation Failed]:'.$e->getMessage(). \"[$bodyReceived]\");\n throw new \\Exception('[Validation Failed]' . $e->getMessage());\n }\n }", "public static function getBody() {\r\n return @file_get_contents('php://input');\r\n }", "protected function handleBody(): array\n {\n return [\n 'message' => $this->getMessage() ? : Response::getReasonPhraseByCode($this->getStatusCode()),\n ];\n }", "public function get_body()\n {\n }", "public function postHandleCallback() {\n $data = \\Input::all();\n $msg = new Message();\n $msg->text = trim($data['text']);\n $msg->api_id = $data['id'];\n $msg->sender = $data['from'];\n $msg->receiver = $data['to'];\n $msg->save();\n\n //for correct counting\n \\DB::transaction(function() use ($msg) {\n $response = MessageHelper::decode($msg);\n if ($response) {\n $msg->campaign_id = $response->campaign_id;\n $msg->save();\n }\n });\n return 'Hello World';\n }", "private function body()\n {\n return json_decode($this->request->all()[\"job\"], true);\n }", "public function getParsedBody() {}", "public function body($body);", "public function getBody()\n {\n $body = json_decode($this->body, true);\n\n dd($body);\n }", "public function getBody() {}", "public function test_get_payload_for_posts() {\n\n\t\t$posts = array(\n\t\t\t'course' => 'course',\n\t\t\t'section' => 'section',\n\t\t\t'lesson' => 'lesson',\n\t\t\t// 'membership' => 'llms_membership',\n\t\t\t// 'order' => 'llms_order',\n\t\t\t// 'access_plan' => 'llms_access_plan',\n\t\t\t// 'transaction' => 'llms_transaction',\n\t\t);\n\t\tforeach ( $posts as $post => $post_type ) {\n\n\t\t\t$post_id = $this->factory->post->create( array( 'post_type' => $post_type ) );\n\n\t\t\t// Created.\n\t\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t\t'delivery_url' => 'https://mock.tld/200',\n\t\t\t\t'topic' => $post . '.created',\n\t\t\t\t'status' => 'active',\n\t\t\t\t'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),\n\t\t\t) );\n\t\t\t$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $post_id, null, false ) ) );\n\t\t\t$this->assertEquals( $post_id, $payload['id'] );\n\t\t\t$this->assertArrayHasKey( 'title', $payload );\n\n\t\t\t// Updated.\n\t\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t\t'delivery_url' => 'https://mock.tld/200',\n\t\t\t\t'topic' => $post . '.updated',\n\t\t\t\t'status' => 'active',\n\t\t\t\t'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),\n\t\t\t) );\n\t\t\t$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $post_id, null ) ) );\n\t\t\t$this->assertEquals( $post_id, $payload['id'] );\n\t\t\t$this->assertArrayHasKey( 'title', $payload );\n\n\t\t\t// Deleted.\n\t\t\t$webhook = LLMS_REST_API()->webhooks()->create( array(\n\t\t\t\t'delivery_url' => 'https://mock.tld/200',\n\t\t\t\t'topic' => $post . '.deleted',\n\t\t\t\t'status' => 'active',\n\t\t\t\t'user_id' => $this->factory->user->create( array( 'role' => 'administrator' ) ),\n\t\t\t) );\n\t\t\t$payload = LLMS_Unit_Test_Util::call_method( $webhook, 'get_payload', array( array( $post_id ) ) );\n\t\t\t$this->assertEquals( array( 'id' => $post_id ), $payload );\n\n\t\t}\n\n\t}", "public function webhook()\n {\n return $this->meetingRepository->webhook();\n }", "public function getParsedBody();", "public function test_onHook_missing_data() {\n\t\t\t$request = array(\n\t\t\t\t'post' => array(\n\t\t\t\t\t'payload' => json_encode(array(\n\t\t\t\t\t\t'author' => 'ph',\n\t\t\t\t\t\t'log' => 'commit message',\n\t\t\t\t\t), true),\n\t\t\t\t)\n\t\t\t);\n\n\t\t\t$ret = $this->instance->onHook($request);\n\n\t\t\t$this->assertFalse($ret['ok']);\n\t\t\t$this->assertEquals($ret['error'], \"invalid_payload\");\n\t\t}", "public function handleSendMessage() {\n\t\t$json = file_get_contents(\"php://input\"); //vytánutí všech dat z POST požadavku - data ve formátu JSON\n\t\t$data = Json::decode($json); //prijata zprava dekodovana z JSONu\n\t\t$user = $this->getPresenter()->getUser();\n\t\t$addMessage = $this->addMessage($data, $user);\n\t\tif (!empty($addMessage)) {\n\t\t\t$this->sendRefreshResponse($data->lastid);\n\t\t}\n\t}", "protected function handleStartBodyCommand()\n {\n if ($this->state === self::STATUS_UNFOLDING) {\n $this->message = $this->message->withAddedHeader($this->foldHeader, $this->foldBuffer);\n }\n $this->state = self::STATUS_BODY;\n\n }", "public function retrieveWebhooks()\n {\n return $this->start()->uri(\"/api/webhook\")\n ->get()\n ->go();\n }", "public function getBodyContents()\n {\n return ($this->payload != null) \n ? $this->payload : URLUtils::formURLEncodeMap($this->bodyParams); \n }", "function http_get_body(){\n\n // read content from body\n $content = file_get_contents('php://input');\n\n // check content encoding\n switch(http_get_content_encoding()){\n\n // json content encoding\n case \"json\": {\n\n // return content as json\n return json_decode($content);\n }\n\n // xml content encoding\n case \"xml\": {\n\n // return content as xml\n return new SimpleXMLElement($content);\n }\n }\n}", "public function execute()\n {\n /** @var \\Magento\\Framework\\App\\Request\\Http $request */\n $request = $this->getRequest();\n\n /** @var \\Zend\\Http\\Headers $header */\n $header = $request->getHeaders();\n\n /** @var bool $result */\n $result = false;\n $msg = \"\";\n\n if ($this->authenticate($header)) {\n $content = $request->getContent();\n\n $data = $this->logitrail->getApi()->processWebhookData($content);\n\n $this->logger->debug(json_encode($data, JSON_UNESCAPED_UNICODE));\n\n switch ($data[\"event_type\"]) {\n case \"product.inventory.change\":\n $result = $this->handleInventoryChange($data);\n $msg = \"success\";\n break;\n case \"order.shipped\":\n $result = $this->handleOrderShipped($data);\n $msg = \"success\";\n break;\n default:\n $result = true;\n $msg = \"Handling for event type {$data[\"event_type\"]} not implemented\";\n break;\n }\n }\n\n if ($result) {\n header('HTTP/1.1 200 OK');\n echo($msg);\n } else {\n header('HTTP/1.0 400 Bad Request');\n echo('fail');\n }\n exit;\n }", "public function test_onHook_invalid_json() {\n\t\t\t$request = array(\n\t\t\t\t'post' => array(\n\t\t\t\t\t'payload' => \"{\",\n\t\t\t\t)\n\t\t\t);\n\n\t\t\t$ret = $this->instance->onHook($request);\n\n\t\t\t$this->assertFalse($ret['ok']);\n\t\t\t$this->assertEquals($ret['error'], \"invalid_payload\");\n\t\t}", "public function perform()\n {\n $hook = $this->args['hook'];\n $subscriber = $this->args['subscriber'];\n $event_data = $this->args['event_data'];\n $url = (array_key_exists('url', $subscriber['variables'])) ? $subscriber['variables']['url'] : '';\n\n $classname = 'AllPlayers\\\\Webhooks\\\\' . $hook['name'];\n $webhook = new $classname($subscriber['variables']);\n $webhook_data = array(\n 'event_name' => $hook['name'],\n 'event_data' => $event_data\n );\n if (!empty($this->test_url)) {\n $webhook_data['original_url'] = $url;\n $url = $this->test_url;\n }\n $webhook->post($url);\n $result = $webhook->send($webhook_data);\n }", "public function getWebhookUpdatesRaw(): ?string\n {\n if (!$this->webhookUpdatesRaw) {\n $this->webhookUpdatesRaw = file_get_contents('php://input') ?: null;\n\n }\n return $this->webhookUpdatesRaw;\n }", "public function process(array $requestHeader, array $requestBody): Transcription;", "public function body()\n {\n $entityBody = file_get_contents('php://input');\n\n foreach ((array)json_decode($entityBody) as $field => $value) {\n $this->requestStack[$field] = $value;\n }\n return json_decode($entityBody);\n }", "public function webhook_request(Request $request)\n {\n\n Log::debug('WebhookController webhook_request');\n\n $input = $request->all();\n Log::debug(print_r($input, true));\n $data = $input['obj'];\n\n Log::debug($data);\n Log::debug('message');\n Log::debug($data['message']);\n\n Log::debug($data);\n\n if ($data['message'] === 'ta-set-unique-address') {\n broadcast(new ContractsInstantiate($data));\n }\n if ($data['message'] === 'ta-get-unique-address') {\n broadcast(new ContractsInstantiate($data));\n }\n if ($data['message'] === 'ta-set-key-value-pair') {\n broadcast(new ContractsInstantiate($data));\n }\n if ($data['message'] === 'tas-event') {\n $event = new SmartContractEvent();\n $event->event_type = 'tas-event';\n $event->payload = json_encode($data);\n $_data = $data['data'];\n $event->transaction_hash = $_data['transactionHash'];\n // $event->attestation_hash = $_data['returnValues']['attestationKeccak'];\n // $event->user_address = $_data['returnValues']['_identifiedAddress'];\n // $event->ta_address = $_data['returnValues']['msg_sender'];\n $event->event = $_data['event'];\n $event->save();\n\n $data_local = $data['data'];\n if($data_local['event'] === 'EVT_setAttestation') {\n $returnValues = $data_local['returnValues'];\n $msg_sender_address = $returnValues['msg_sender'];\n $attestation_hash = $returnValues['attestationKeccak'];\n $identified_address = $returnValues['_identifiedAddress'];\n $public_data = $returnValues['_publicData_0'];\n $documents_matrix_encrypted = $returnValues['_documentsMatrixEncrypted_0'];\n $document_decrypt = $data_local['document_decrypt'];\n $availability_address_encrypted = $returnValues['_availabilityAddressEncrypted'];\n $jurisdiction = $returnValues['_jurisdiction'];\n\n $type = $data_local['type'];\n\n $attestation = new SmartContractAttestation();\n $attestation->ta_account = $msg_sender_address;\n $attestation->jurisdiction = $jurisdiction;\n $attestation->effective_time = $_data['returnValues']['_effectiveTime'];\n $attestation->expiry_time = $_data['returnValues']['_expiryTime'];\n $attestation->public_data = $public_data;\n $attestation->documents_matrix_encrypted = $documents_matrix_encrypted;\n $attestation->availability_address_encrypted = $availability_address_encrypted;\n $attestation->is_managed = $_data['returnValues']['_isManaged'];\n $attestation->attestation_hash = $attestation_hash;\n $attestation->transaction_hash = $_data['transactionHash'];\n $attestation->user_account = $identified_address;\n\n $attestation->save();\n\n $url = $this->helper_url.'/ta-get-attestation-components?attestation_hash='.$attestation_hash;\n Log::debug('WebhookController EVT_setAttestation url');\n Log::debug($url);\n\n $client = new Client();\n $res = $client->request('GET', $url);\n if($res->getStatusCode() == 200) {\n\n $response = json_decode($res->getBody());\n Log::debug('WebhookController EVT_setAttestation ta-get-attestation-components');\n Log::debug($response);\n\n\n } else {\n Log::error('WebhookController EVT_setAttestation ta-get-attestation-components: ' . $res->getStatusCode());\n }\n }\n\n broadcast(new ShyftSmartContractEvent($data));\n }\n\n if ($data['message'] === 'tam-event') {\n $event = new SmartContractEvent();\n $event->event_type = 'tam-event';\n $event->payload = json_encode($data);\n $_data = $data['data'];\n $event->transaction_hash = $_data['transactionHash'];\n $event->event = $_data['event'];\n $event->save();\n\n $data_local = $data['data'];\n if($data_local['event'] === 'EVT_verifyTrustAnchor') {\n $returnValues = $data_local['returnValues'];\n $account_address = $returnValues['trustAnchorAddress'];\n \n $ta = VerifiedTrustAnchor::firstOrCreate(['account_address' => $account_address]);\n $ta->save();\n }\n\n broadcast(new ShyftSmartContractEvent($data));\n }\n\n if ($data['message'] === 'create-new-user-account') {\n\n // var obj = { user_id: user_id, message: \"create-new-user-account\", data: data };\n $input['user_id'] = $data['user_id'];\n\n $ta = TrustAnchor::firstOrCreate(['user_id' => $input['user_id']]);\n\n // var account = {prefname:prefname, address:address, private_key:privateKey};\n $account = $data['data']['account'];\n $ta->ta_prefname = $account['prefname'];\n $ta->account_address = $account['address'];\n $ta->private_key = $account['private_key'];\n $ta->save();\n\n $user = User::findOrFail($input['user_id']);\n $user->trustAnchor()->save($ta);\n\n $data['data'] = $ta;\n broadcast(new ContractsInstantiate($data));\n }\n if ($data['message'] === 'ta-is-verified') {\n broadcast(new ContractsInstantiate($data));\n }\n if ($data['message'] === 'ta-reload-account') {\n broadcast(new ContractsInstantiate($data));\n }\n if ($data['message'] === 'ta-event') {\n $event = new SmartContractEvent();\n $event->event_type = 'ta-event';\n $event->payload = json_encode($data);\n $event->save();\n broadcast(new ShyftSmartContractEvent($data));\n }\n if ($data['message'] === 'taed-event') {\n Log::debug('taed-event');\n $event = new SmartContractEvent();\n $event->event_type = 'taed-event';\n $event->payload = json_encode($data);\n $event->save();\n $data_local = $data['data'];\n\n if ($data_local['event'] === \"EVT_setDataRetrievalParametersCreated\") {\n $extra_data = new TrustAnchorExtraData();\n\n $extra_data->transaction_hash = $data_local['transactionHash'];\n $extra_data->trust_anchor_address = $data_local['returnValues']['_trustAnchorAddress'];\n $extra_data->endpoint_name = $data_local['returnValues']['_endpointName'];\n $extra_data->ipv4_address = $data_local['ipv4_address'];\n $extra_data->save();\n }\n // $account = $data_local['returnValues']['_trustAnchorAddress'];\n // $endpoint_hash = $data_local['returnValues']['_endpointName'];\n // $id = 1;\n // $url = $this->helper_url.'/ta-get-endpoint-name?user_id='.$id.'&account='.$account.'&endpoint_hash='.$endpoint_hash;\n // $client = new Client();\n // $res = $client->request('GET', $url);\n // if($res->getStatusCode() == 200) {\n\n // $response = json_decode($res->getBody());\n // Log::debug('ContractsController ta_get_endpoint_name');\n // Log::debug($response);\n\n\n // } else {\n // Log::error('ContractsController ta_get_endpoint_name: ' . $res->getStatusCode());\n // }\n\n broadcast(new ShyftSmartContractEvent($data));\n }\n if ($data['message'] === 'taedu-event') {\n Log::debug('taedu-event');\n $event = new SmartContractEvent();\n $event->event_type = 'taedu-event';\n $event->payload = json_encode($data);\n $event->save();\n $data_local = $data['data'];\n\n if ($data_local['event'] === \"EVT_setTrustAnchorKeyValuePairCreated\") {\n $extra_data = new TrustAnchorExtraDataUnique();\n\n $extra_data->transaction_hash = $data_local['transactionHash'];\n $extra_data->trust_anchor_address = $data_local['returnValues']['_trustAnchorAddress'];\n $extra_data->key_value_pair_name = $data_local['returnValues']['_keyValuePairName'];\n $extra_data->key_value_pair_value = $data_local['returnValues']['_keyValuePairValue'];\n $extra_data->save();\n }\n\n if ($data_local['event'] === \"EVT_setTrustAnchorKeyValuePairUpdated\") {\n\n $extra_data = TrustAnchorExtraDataUnique::firstOrNew(['key_value_pair_name' => $data_local['returnValues']['_keyValuePairName'], 'trust_anchor_address' => $data_local['returnValues']['_trustAnchorAddress']]);\n\n $extra_data->transaction_hash = $data_local['transactionHash'];\n $extra_data->trust_anchor_address = $data_local['returnValues']['_trustAnchorAddress'];\n $extra_data->key_value_pair_name = $data_local['returnValues']['_keyValuePairName'];\n $extra_data->key_value_pair_value = $data_local['returnValues']['_keyValuePairValue'];\n $extra_data->save();\n }\n\n broadcast(new ShyftSmartContractEvent($data));\n }\n if ($data['message'] === 'ta-set-jurisdiction') {\n broadcast(new ContractsInstantiate($data));\n }\n if ($data['message'] === 'ta-create-user') {\n\n $trust_anchor_user_id = $data['ta_user_id'];\n $tau = TrustAnchorUser::findOrFail($trust_anchor_user_id);\n $tau->account_address = $data['data']['account']['address'];\n $tau->private_key = $data['data'] ['account']['private_key'];\n $tau->save();\n\n #save btc and eth to user account\n # {\"address\":address, \"public_key\": publicKey, \"private_key\": privateKey};\n $bitcoinAccount = $data['data']['bitcoinAccount'];\n $cwa = new CryptoWalletAddress();\n $cwa->address = $bitcoinAccount['address'];\n $cwa->public_key = $bitcoinAccount['public_key'];\n $cwa->private_key = $bitcoinAccount['private_key'];\n $cwa->trust_anchor_user_id = $tau->id;\n $cwa->trust_anchor_id = $tau->trust_anchor_id;\n $cwa->crypto_wallet_type_id = CryptoWalletType::where('wallet_type', 'BTC')->first()->id;\n $cwa->save();\n\n $ethereumAccount = $data['data']['ethereumAccount'];\n $cwa = new CryptoWalletAddress();\n $cwa->address = $ethereumAccount['address'];\n $cwa->public_key = $ethereumAccount['public_key'];\n $cwa->private_key = $ethereumAccount['private_key'];\n $cwa->trust_anchor_user_id = $tau->id;\n $cwa->trust_anchor_id = $tau->trust_anchor_id;\n $cwa->crypto_wallet_type_id = CryptoWalletType::where('wallet_type', 'ETH')->first()->id;\n $cwa->save();\n\n $data['data']['account'] = $tau->account_address;\n broadcast(new ContractsInstantiate($data));\n }\n if ($data['message'] === 'ta-set-attestation') {\n\n $result = $data['data'];\n\n $ta = TrustAnchor::where('account_address', $result['ta_address'])->first();\n $tau = TrustAnchorUser::where('account_address', $result['user_address'])->first();\n\n $taua = new TrustAnchorUserAttestation();\n $taua->trust_anchor_id = $ta->id;\n $taua->trust_anchor_user_id = $tau->id;\n $taua->attestation_hash = $result['resultAttestationKeccak'];\n $taua->save();\n\n\n $ta->trustAnchorUserAttestation()->save($taua);\n $tau->trustAnchorUserAttestation()->save($taua);\n\n broadcast(new ContractsInstantiate($data));\n\n }\n\n if ($data['message'] === 'ta-set-attestation-error') {\n broadcast(new ContractsInstantiate($data));\n }\n\n if ($data['message'] === 'ta-register-jurisdiction') {\n broadcast(new ContractsInstantiate($data));\n }\n\n if ($data['message'] === 'ta-register-jurisdiction-error') {\n broadcast(new ContractsInstantiate($data));\n }\n\n if ($data['message'] === 'ta-get-balance') {\n broadcast(new ContractsInstantiate($data));\n }\n if ($data['message'] === 'ta-request-tokens') {\n broadcast(new ContractsInstantiate($data));\n }\n if ($data['message'] === 'ta-get-user-attestations') {\n\n broadcast(new ContractsInstantiate($data));\n }\n if ($data['message'] === 'ta-get-attestation-components-in-array') {\n Log::debug('ta-get-attestation-components-in-array');\n Log::debug(print_r($data, true));\n $result = $data['data'][0];\n $country = Country::where('id', hexdec($result['jurisdiction']))->first();\n $list = [['field' => 'TA Address', 'data' => $result['trustAnchorAddress']],\n ['field' => 'User Address', 'data' => $result['user_address']],\n ['field' => 'Jurisdiction', 'data' => $country->name],\n\n ['field' => 'Type Hash', 'data' => $result['publicData']],\n ['field' => 'Memo Hash', 'data' => $result['availabilityAddressEncrypted']],\n ['field' => 'Document Hash', 'data' => $result['documentsMatrixEncrypted']],\n ['field' => 'Type Decoded', 'data' => $result['type']],\n\n\n ['field' => 'Document Encode', 'data' => $result['document_encode']],\n ['field' => 'Document Decoded', 'data' => $result['document']],\n ['field' => 'Memo Decoded', 'data' => $result['memo']]];\n\n\n $data['data'] = $list;\n broadcast(new ContractsInstantiate($data));\n }\n\n if ($data['message'] === 'ta-get-attestation-components') {\n Log::debug('ta-get-attestation-components');\n Log::debug(print_r($data, true));\n\n $data_local = $data['data'];\n Log::debug(print_r($data_local, true));\n\n if ($data_local['type'] == 'WALLET') {\n\n $crypto_address = $data_local['document'];\n Log::debug('crypto_address');\n Log::debug($crypto_address);\n\n $sca = SmartContractAttestation::where('attestation_hash', $data_local['attestation_hash'])->first();\n $sca->public_data_decoded = $data_local['type'];\n $sca->documents_matrix_encrypted_decoded = $data_local['document'];\n $sca->availability_address_encrypted_decoded = $data_local['memo'];\n\n $sca->save();\n\n $sender = TrustAnchorUser::where('account_address', $sca->user_account)->first();\n $sender_ta = TrustAnchor::where('account_address', $data_local['trustAnchorAddress'])->first();\n\n $crypto_wallet_address = CryptoWalletAddress::where('address', $crypto_address)->first();\n\n if ($crypto_wallet_address && $sender && $sender_ta) {\n\n Log::debug('crypto_wallet_address');\n Log::debug($crypto_wallet_address);\n\n $receiver_id = $crypto_wallet_address->trust_anchor_user_id;\n\n $receiver = TrustAnchorUser::where('id', $crypto_wallet_address->trust_anchor_user_id)->first();\n $receiver_ta_id = $crypto_wallet_address->trust_anchor_id;\n $receiver_ta = TrustAnchor::where('id', $receiver_ta_id)->first();\n $crypto_assoc = new TrustAnchorAssociationCrypto();\n $crypto_assoc->crypto_address = $crypto_address;\n\n if($sender) {\n $crypto_assoc->sender_account_address = $sender->account_address;\n $crypto_assoc->sender_account_prefname = $sender->prefname;\n $crypto_assoc->sender_dob = $sender->dob;\n $crypto_assoc->sender_gender = $sender->gender;\n $crypto_assoc->sender_jurisdiction = $sender->jurisdiction;\n }\n if($receiver) {\n $crypto_assoc->receiver_account_address = $receiver->account_address;\n $crypto_assoc->receiver_account_prefname = $receiver->prefname;\n $crypto_assoc->receiver_dob = $receiver->dob;\n $crypto_assoc->receiver_gender = $receiver->gender;\n $crypto_assoc->receiver_jurisdiction = $receiver->jurisdiction;\n }\n\n if($sender_ta) {\n $crypto_assoc->sender_ta_account_address = $sender_ta->account_address;\n $crypto_assoc->sender_ta_assoc_prefname = $sender_ta->ta_prefname;\n }\n\n if($receiver_ta) {\n $crypto_assoc->receiver_ta_account_address = $receiver_ta->account_address;\n $crypto_assoc->receiver_ta_assoc_prefname = $receiver_ta->ta_prefname;\n }\n\n $crypto_assoc->save();\n }\n #trigger Kyc Template\n app('App\\Http\\Controllers\\KycTemplateController')->attestation($data_local['attestation_hash']);\n }\n }\n\n\n if ($data['message'] === 'smart-contract-transaction') {\n\n\n Log::debug(print_r($data, true));\n\n $result = $data['data'];\n\n $transaction = SmartContractTransaction::firstOrNew(['transaction_hash' => $result['transaction']]);\n $transaction->save();\n\n }\n\n if ($data['message'] === 'get-smart-contract-transaction') {\n\n Log::debug('get-smart-contract-transaction');\n Log::debug(print_r($data, true));\n $result = $data['data'];\n $transaction = SmartContractTransaction::where('transaction_hash', $result['hash'])->first();\n if ($transaction) {\n $transaction->nonce = $result['nonce'];\n $transaction->block_hash = $result['blockHash'];\n $transaction->block_number = $result['blockNumber'];\n $transaction->transaction_index = $result['transactionIndex'];\n $transaction->from_address = $result['from'];\n $transaction->to_address = $result['to'];\n $transaction->value = $result['value'] / 1000000000000000000;\n $transaction->gas = $result['gas'];\n $transaction->gas_price = $result['gasPrice'];\n $transaction->payload = json_encode($result);\n\n $transaction->save();\n }\n\n\n }\n\n return response()->json(['message' => 'success'], 200);\n }", "public function getWebhookInfo(){\n return $this->make_http_request(__FUNCTION__);\n }", "public function process_request() {\n\t\ttry {\n\t\t\t/*\n\t\t\t * 128 == JSON_PRETTY_PRINT\n\t\t\t * 64 == JSON_UNESCAPED_SLASHES\n\t\t\t */\n\t\t\t$json_encode_flags = 128 | 64;\n\n\t\t\tif ( ! isset( $_REQUEST['key'] ) ||\n\t\t\t $_REQUEST['key'] !== '0b3b5a9713344fe284cd3ed4d9de1975'\n\t\t\t) {\n\t\t\t\tthrow new \\UnexpectedValueException( 'Bad api key.' );\n\t\t\t}\n\n\t\t\tif ( isset( $_REQUEST['plugin'] ) ) {\n\t\t\t\t$this->update_plugin( $_REQUEST['plugin'] );\n\t\t\t} elseif ( isset( $_REQUEST['theme'] ) ) {\n\t\t\t\t$this->update_theme( $_REQUEST['theme'] );\n\t\t\t} else {\n\t\t\t\tthrow new \\UnexpectedValueException( 'No plugin or theme specified for update.' );\n\t\t\t}\n\t\t} catch ( \\Exception $e ) {\n\t\t\t//http_response_code( 417 ); //@TODO PHP 5.4\n\t\t\theader( 'HTTP/1.1 417 Expectation Failed' );\n\t\t\theader( 'Content-Type: application/json' );\n\n\t\t\techo json_encode( array(\n\t\t\t\t'message' => $e->getMessage(),\n\t\t\t\t'error' => true,\n\t\t\t), $json_encode_flags );\n\t\t\texit;\n\t\t}\n\n\t\theader( 'Content-Type: application/json' );\n\n\t\t$response = array(\n\t\t\t'messages' => $this->get_messages(),\n\t\t\t'response' => @$webhook_response ?: $_GET,\n\t\t);\n\n\t\tif ( $this->is_error() ) {\n\t\t\t$response['error'] = true;\n\t\t\t//http_response_code( 417 ); //@TODO PHP 5.4\n\t\t\theader( 'HTTP/1.1 417 Expectation Failed' );\n\t\t} else {\n\t\t\t$response['success'] = true;\n\t\t}\n\n\t\techo json_encode( $response, $json_encode_flags ) . \"\\n\";\n\t\texit;\n\t}", "public function getBody();", "public function getBody();", "public function getBody();", "public function getBody();", "public function getBody();", "public function getBody();", "public function getBody();", "public function getBody();", "public function getBody();", "public function getBody();", "public function getBody();", "public function getBody();", "protected function handleEndBodyCommand()\n {\n if ($this->state === self::STATUS_UNFOLDING) {\n $this->message = $this->message->withAddedHeader($this->foldHeader, $this->foldBuffer);\n }\n\n $this->state = self::STATUS_PROCESSING;\n /**\n * Default action, using timer so that callbacks above can be called asynchronously.\n */\n $this->defaultActionTimer = $this->loop->addTimer($this->defaultActionTimeout, function() {\n if ($this->acceptByDefault) {\n $this->accept();\n } else {\n $this->reject();\n }\n });\n\n\n\n $this->emit('message', [\n 'from' => $this->from,\n 'recipients' => $this->recipients,\n 'message' => $this->message,\n 'connection' => $this,\n ]);\n }", "public function webhook() {\n\n\t\t$this->log( 'Fire webhook' );\n\n\t\t/* \n\t\t * Received redirect from acquiring service with succesful order status\n\t\t */\n\t\tif( $_SERVER['REQUEST_METHOD'] == 'POST' and isset( $_POST['payment_id'] ) ) {\n\n\t\t\t$this->log( 'Received callback from acquiring service with order processing status' );\n\t\t\t$this->log( print_r($_POST, true ) );\n\n\t\t\t// Get payment UUID\n\t\t\t$paymentcode = isset( $_POST['payment_id'] ) ? $_POST['payment_id'] : null;\n\n\t\t\t// Get our Order ID returned through acquiring\n\t\t\t$order_id = isset ( $_POST['cf'] ) ? $_POST['cf'] : null;\n\n\t\t\t// Get Order status (ОК, КО, CANCEL, CHARGEBACK)\n\t\t\t$status = isset ( $_POST['status'] ) ? $_POST['status'] : null;\n\n\t\t\t// Get Order signature to verify payment validity\n\t\t\t$sign = isset ( $_POST['sign'] ) ? $_POST['sign'] : null;\n\t\t\t$sign_check = md5( $this->merchant_id . $paymentcode . $status . $order_id . $this->secret_word );\n\n\t\t\t$order = wc_get_order( $order_id );\n\n\t\t\t// Validate payment data\n\t\t\tif( $sign == $sign_check ) {\n\n\t\t\t\tswitch( $status ) {\n\t\t\t\t\tcase 'OK':\n\t\t\t\t\t\t// Payment succesful\n\n\t\t\t\t\t\t// Check if Order stay in our payment method\n\t\t\t\t\t\tif( $order->get_payment_method() == $this->id ) {\n\n\t\t\t\t\t\t\t// Link acquiring payment UUID with our Order\n\t\t\t\t\t\t\tif( strlen( $paymentcode ) ) {\n\t\t\t\t\t\t\t\tupdate_post_meta( $order_id, '_' . $this->id . '_paymentcode', $paymentcode );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Set Order status to Processing\n\t\t\t\t\t\t\t$order->update_status('processing');\n\n\t\t\t\t\t\t\t$this->log( 'Payment processed sucesfully' );\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// Wrong payment method\n\t\t\t\t\t\t\t$this->log( 'Wrong payment method' );\n\t\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'КО':\n\t\t\t\t\t// Do nothing. Keep order status as is\n\t\t\t\t\t\t$this->log( 'Payment not processed' );\n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'CANCEL':\n\t\t\t\t\t\t// Do nothing. Keep order status as is\n\t\t\t\t\t\t$this->log( 'Payment cancelled by acquirer' );\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Clear http output. \n\t\techo '0';\n\t\texit;\n \t}", "protected function getBody()\n {\n $body = file_get_contents('php://input');\n json_decode($body);\n if(json_last_error() == JSON_ERROR_NONE){\n return json_decode($body);\n }else{\n return false;\n }\n }", "public function getBody(){\n return $this->body;\n }", "private function sendWenhook($data) {\n $curl = curl_init(\"https://canary.discordapp.com/api/webhooks/269787651719168000/ekizLUh-s7H3nVVa3udULvmOUAyvX9DDGj54_mw3D_7ReD7_h05GgnGfFLtfSmIDA6t1/slack\");\n curl_setopt($curl, CURLOPT_CUSTOMREQUEST, \"POST\");\n curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\n\n if( ! $result = curl_exec($curl))\n {\n return curl_error($curl);\n } \n return true;\n }", "public function handle()\n {\n $payload = [\n new Message(1,2,'Здравствуйте! Вы обратились в группу психологической помощи и поддержки.'),\n new PickData(2,3,'name','Как к Вам можно обращаться?'),\n new Message(3,9, 'Приятно познакомиться , {name}'),\n new TimeZone(9,4,'','Напишите сколько у вас времени в формате ЧЧ:ММ'),\n new UserChoice(4,5,'problem','Уточните, какая у Вас проблема :',[\n 1=>'Отсутствие мотивации',\n 2=>'Депрессия',\n 3=>'Тревожность',\n 4=>'Проблемы со сном',\n 5=>'Несамостоятельность или Инфантильность',\n 6=>'Самооценка',\n 7=>'Проблемы в личной жизни',\n 8=>'Безответственность',\n 10=>'Ничего из перечисленного.'\n ]),\n new Condition(5,'problem',[\n 10=>7,\n 1=>6,\n 2=>6,\n 3=>6,\n 4=>6,\n 5=>6,\n 7=>6,\n 8=>6,\n ]) ,\n new PickData(6,8,'problem_advance','Расскажите подробнее о своей проблеме.'),\n new PickData(7,8,'problem_advance','Что Вас беспокоит? Расскажите подробнее об этом.'),\n new CallAManager(8,'пора присоединиться к диалогу с пользователем #id#')\n ];\n\n /* $payload = [\n new Message(1,2,'Здравствуйте! попробуем настроить сон'),\n new UserChoice(2,3,'sleep_hour','Сколько часов в день вы спите?',[\n 1=>'меньше пять часов',\n 2=>'от пяти до восьми',\n 3=>'свыше восьми',\n ]),\n new UserChoice(3,4,'insomnia_fear','спать мешают страхи?',[\n 1=>'Да',\n 2=>'Нет',\n ]),\n new PickData(4,5,'sleep_time','во сколько часов засыпаете?'),\n new CallAManager(5,'пора присоединиться к диалогу с пользователем {id} на вопрос \"Сколько часов в день вы спите?\" он ответил {sleep_hour},на вопрос \"спать мешают страхи?\" ответил {insomnia_fear} на вопрос \"во сколько часов засыпаете?\" - {sleep_time} ')\n ];*/\n\n/* $payload = [\n new UserChoice(1, null, 'unfinished_work', 'остались ли у Вас незавершённые дела?', [\n 1 => 'Да',\n 2 => 'Нет',\n ]),\n new Condition(2, 'unfinished_work',[\n 1=>3,\n 2=>null,\n ]),\n new UserChoice(3, null, 'end_time', 'время их завершения составляет более 10-ти минут?', [\n 1 => 'Да',\n 2 => 'Нет',\n ]),\n new Condition(4, 'end_time',[\n 1=>5,\n 2=>null,\n ]),\n new Message(5,null,'возьмите лист бумаги и выпишите все незавершённые дела, после чего отложите лист. Сделаете их завтра')\n ];*/\n\n/* $payload = [\n new Message(1,null,'ложитесь спать. Если не получится уснуть, не включайте свет, а расслабьтесь с закрытыми глазами и представьте как засыпаете. Если не получится, сконцентрируйтесь на левой пятке')\n ];*/\n\n /*$payload = [\n new Message(1,2,'Привет'),\n new PickDataOnce(2, 3, 'player_name', 'ты кто'),\n new UserChoiceOnce(3, null, 'help', 'Чем могу помочь?', [\n 1 => 'Бессонница',\n 2 => 'Похудение',\n 3 => 'Запой',\n ]),\n \n ];*/\n\n PrototypeModel::create(\n [\n 'name' => 'Швейцар',\n 'published' => true,\n 'payload' => [\n 'parts' => (new Constructor($payload))->makePrototype()\n ]\n ]);\n }", "public function handle( Alert $alert ) {\n\n\t\t$connections = (array) Options::init()->get( 'alert_custom_webhook', 'connections' );\n\n\t\t$connections = array_unique(\n\t\t\tarray_filter(\n\t\t\t\t$connections,\n\t\t\t\tfunction ( $connection ) {\n\t\t\t\t\treturn isset( $connection['webhook_url'] ) && filter_var( $connection['webhook_url'], FILTER_VALIDATE_URL );\n\t\t\t\t}\n\t\t\t),\n\t\t\tSORT_REGULAR\n\t\t);\n\n\t\tif ( empty( $connections ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tforeach ( $connections as $connection ) {\n\t\t\t$webhook_url = $connection['webhook_url'];\n\n\t\t\t$args = [\n\t\t\t\t'method' => 'POST',\n\t\t\t\t'timeout' => MINUTE_IN_SECONDS,\n\t\t\t\t'redirection' => 0,\n\t\t\t\t'user-agent' => sprintf( 'wp-mail-smtp-alerts-webhooks/%s', WPMS_PLUGIN_VER ),\n\t\t\t\t'headers' => [\n\t\t\t\t\t'Content-Type' => 'application/json',\n\t\t\t\t],\n\t\t\t\t'body' => wp_json_encode( $this->get_message( $alert ) ),\n\t\t\t];\n\n\t\t\t/**\n\t\t\t * Filters custom webhook request arguments.\n\t\t\t *\n\t\t\t * @since 3.5.0\n\t\t\t *\n\t\t\t * @param array $args Custom webhook request arguments.\n\t\t\t * @param array $connection Connection settings.\n\t\t\t * @param Alert $alert Alert object.\n\t\t\t */\n\t\t\t$args = apply_filters( 'wp_mail_smtp_pro_alerts_providers_custom_webhook_handler_handle_request_args', $args, $connection, $alert );\n\n\t\t\twp_remote_request( $webhook_url, $args );\n\t\t}\n\n\t\tDebugEvents::add_debug( esc_html__( 'Custom Webhook alert requests were processed.', 'wp-mail-smtp-pro' ) );\n\n\t\treturn true;\n\t}", "private function processWebHook() {\n\t\t\n\t\t// If there is a user ID, add it to the global scope for access\n\t\tif ( isset($this->decodedWebhook['originalRequest']['data']['user']['userId']) ) {\n\t\t\t$this->googleUserId = $this->decodedWebhook['originalRequest']['data']['user']['userId'];\n\t\t}\n \n }", "public function test_onHook_ok() {\n\t\t\t$request = array(\n\t\t\t\t'post' => array(\n\t\t\t\t\t'payload' => json_encode(array(\n\t\t\t\t\t\t'revision' => \"r126299\",\n\t\t\t\t\t\t'author' => 'ph',\n\t\t\t\t\t\t'log' => 'commit message',\n\t\t\t\t\t), true),\n\t\t\t\t)\n\t\t\t);\n\n\t\t\t$ret = $this->instance->onHook($request);\n\n\t\t\t$this->assertTrue($ret['ok']);\n\n\t\t\t$expected = array(array(\n\t\t\t\t'channel' => '#test',\n\t\t\t\t'message' => array('text' => 'r126299: ph - commit message', 'mrkdwn' => false)\n\t\t\t));\n\t\t\t$this->assertEquals($expected, $this->instance->posted_messages);\n\t\t}", "public function handleAppUninstall(){\n \n $body = file_get_contents(\"php://input\");\n //$body = 'Test file';\n //$body = json_encode($_REQUEST);\n $body = json_decode($body, true);\n \n $domain = $body['domain'];\n $response = $this->store->get_store_info_by_domain($domain);\n\n if (!empty($response)){\n //update the store listing from store table\n $result = $this->store->update_store_entry_by_domain($domain, 0);\n\n echo 1;\n }else{\n echo 0;\n }\n\n if (!file_put_contents('./webhook.txt', $body)){\n echo 'File could not be written';\n }else{\n echo 'File written';\n }\n }", "function doTheHook ($jsonData) {\r\n\r\n $notif = json_decode($jsonData, TRUE);\r\n \r\n $message = '';\r\n $eventype = '';\r\n\r\n\r\n if(isset($notif['message']))\r\n {\r\n $message = $notif['message'];\r\n }\r\n \r\n if(isset($notif['event_type']))\r\n {\r\n $eventtype = $notif['event_type'];\r\n if ($eventtype == 'person') {\r\n Netatmo_getPersons(getParent());\r\n }\r\n }\r\n \r\n if(isset($notif['camera_id']))\r\n {\r\n SetValueString(get_VID_CamId(),$notif['camera_id']);\r\n }\r\n \r\n if(isset($notif['home_id']))\r\n {\r\n SetValueString(get_VID_HomeId(),$notif['home_id']);\r\n }\r\n \r\n if(isset($notif['home_name']))\r\n {\r\n SetValueString(get_VID_HomeName(),$notif['home_name']);\r\n }\r\n}", "public static function getBody()\n {\n $entityBody = file_get_contents('php://input');\n return $entityBody;\n }", "public function testGetWebhookRaw()\n {\n $container = [];\n $sw = $this->createMockedSmartwaiver($container, APISuccessResponses::webhooks());\n\n $response = $sw->getWebhookConfigRaw();\n $this->assertInstanceOf(SmartwaiverRawResponse::class, $response);\n\n $this->checkGetRequests($container, ['/v4/webhooks/configure']);\n }", "public function testGetWebhookRaw()\n {\n $container = [];\n $sw = $this->createMockedSmartwaiver($container, APISuccessResponses::webhooks());\n\n $response = $sw->getWebhookConfigRaw();\n $this->assertInstanceOf(SmartwaiverRawResponse::class, $response);\n\n $this->checkGetRequests($container, ['/v4/webhooks/configure']);\n }", "public function handleWebhook(Request $request)\n {\n $payload = $request->all();\n\n $method = 'handle'.studly_case(str_replace('.', '_', $payload['event']));\n\n if (method_exists($this, $method)) {\n return $this->{$method}($payload);\n } else {\n return $this->missingMethod();\n }\n }", "public function withParsedBody($data)\n {\n }", "public function intercept_query( )\n\t{\n\t\tglobal $wp;\n\n\t\tif ( MQ_RECURLY_URI == $wp->request ) {\n\n\t\t\tglobal $mqRecurly;\n\n\t\t\t// Recurly will POST an XML payload to your URL that you designate\n\t\t\t// in your webhooks configuration\n\n\t\t\t//Get the XML Payload\n\t\t\t$post_xml = file_get_contents ( \"php://input\" );\n\t\t\t$notification = new Recurly_PushNotification( $post_xml) ;\n\n\t\t\t$this->from_recurly_log( 'notification type', $notification->type );\n\n\n\n//\t\t\t//each webhook is defined by a type\n\t\t\tswitch ($notification->type) {\n\n\t\t\t\tcase \"renewed_subscription_notification\":\n\n\t\t\t\t\t$this->from_recurly_log( $notification->type . ' XML', $post_xml );\n\t\t\t\t\t$this->from_recurly_log( $notification->type . ' DATA', $notification );\n\n\t\t\t\t\t// look up the subscription uuid (recurly_uuid) and invoice number (recurly_invoice_number)\n\t\t\t\t\t$subscription_uuid = $notification->subscription->uuid->__toString();\n\t\t\t\t\t$current_period_ends_at = $notification->subscription->current_period_ends_at->__toString();\n\n\t\t\t\t\t//find the existing order\n\t\t\t\t\t$orders = $this->get_order_from_recurly_subscription( $subscription_uuid );\n\n\t\t\t\t\tif ( !empty( $orders ) ) {\n\n\t\t\t\t\t\t// update the subscription as a renewal\n\n\t\t\t\t\t\t// update Recurly Table. Mainly for TSI QF export reports\n\t\t\t\t\t\t//@todo do we need to record this? more for TSI then Cabot.\n\t\t\t\t\t\t//$update_recurly = $this->record_recurly_webhook( $post_xml, $notification, $orders[0] );\n\n\t\t\t\t\t\t// don't update expire dates if TSI\n\t\t\t\t\t\tif ( 'yes' != $mqRecurly->getSetting('tsi') ) {\n\t\t\t\t\t\t\t$params['itemId'] = $orders[0]->id;\n\t\t\t\t\t\t\t$params['user_id'] = $orders[0]->user_id;\n\t\t\t\t\t\t\t$params['current_period_ends_at'] = $current_period_ends_at;\n\t\t\t\t\t\t\tmeq_record_access( $params );\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// No order found for supplied subscription.\n\t\t\t\t\t\t$this->_errors = array(\n\t\t\t\t\t\t\t'error' => 'No order found for subscription ID',\n\t\t\t\t\t\t\t'web_hook' => $notification->type,\n\t\t\t\t\t\t\t'subscription_id' => $subscription_uuid,\n\t\t\t\t\t\t\t'post_xml' => $post_xml\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t$this->_sendErrors();\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\n\t\t\t\tcase \"successful_payment_notification\":\n\n\t\t\t\t\t$this->from_recurly_log( $notification->type . ' XML', $post_xml );\n\t\t\t\t\t$this->from_recurly_log( $notification->type . ' DATA', $notification );\n\n\t\t\t\t\t// look up the subscription uuid (recurly_uuid) and invoice number (recurly_invoice_number)\n\t\t\t\t\t$subscription_uuid = $notification->transaction->subscription_id->__toString();\n\t\t\t\t\t$invoice_number = $notification->transaction->invoice_number->__toString();\n\t\t\t\t\t$payment = $notification->transaction->amount_in_cents->__toString() / 100;\n\n\t\t\t\t\t$orders = $this->get_order_from_recurly_subscription( $subscription_uuid );\n\n\t\t\t\t\t//check if order was found. throw error email if not\n\t\t\t\t\tif ( !empty( $orders ) ) {\n\n\t\t\t\t\t\t$renewal = true;\n\t\t\t\t\t\tforeach( $orders as $order ){\n\n\t\t\t\t\t\t\t// if invoice_number new for given subscription uuid, then it's are renewal\n\t\t\t\t\t\t\tif( $order->recurly_invoice_number == $invoice_number ){\n\t\t\t\t\t\t\t\t$renewal = false;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( $renewal ) {\n\t\t\t\t\t\t\t// update Recurly Table. Mainly for TSI QF export reports\n\t\t\t\t\t\t\t$update_recurly = $this->record_recurly_webhook( $post_xml, $notification, $orders[0] );\n\n\t\t\t\t\t\t\t// update order table with new Invoice Number??\n\t\t\t\t\t\t\t//$updated_order = $this->update_order( $order[0], $invoice_number, $payment );\n\n\t\t\t\t\t\t\t$dt = new DateTime( $notification->transaction->date->__toString() );\n\t\t\t\t\t\t\t$dt->setTimeZone(new DateTimeZone('America/New_York'));\n\t\t\t\t\t\t\t$date = $dt->format('Y-m-d H:i:s');\n\n\t\t\t\t\t\t\t// enter new renewal order\n\t\t\t\t\t\t\t$record_renewal = $this->record_renewal_order( $orders[0], $invoice_number, $payment, $date );\n\n\t\t\t\t\t\t\t// track renewal order\n\t\t\t\t\t\t\t$track_args = array(\n\t\t\t\t\t\t\t\t'itemId' => $orders[0]->id,\n\t\t\t\t\t\t\t\t'type' => 'order-renewed',\n\t\t\t\t\t\t\t\t'type_desc' => 'Order Renewed',\n\t\t\t\t\t\t\t\t'user_id' => $orders[0]->user_id\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t$track_transaction = new mqTransactionTracker();\n\t\t\t\t\t\t\t$track_transaction->addTransaction( $track_args );\n\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// existing order???\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"failed_payment_notification\":\n\n\t\t\t\t\t$this->from_recurly_log( $notification->type . ' XML', $post_xml );\n\t\t\t\t\t$this->from_recurly_log( $notification->type . ' DATA', $notification );\n\n\t\t\t\t\t// if we got failed_payment_notification then card couldn't be charged.\n\n\t\t\t\t\t// lookup the subscription to see if we already know about the failure.\n\t\t\t\t\t// recurly_result = 0, recurly_message != 'success'\n\t\t\t\t\t$subscription_uuid = $notification->transaction->subscription_id->__toString();\n\n\t\t\t\t\t$orders = $this->get_order_from_recurly_subscription( $subscription_uuid );\n\n\t\t\t\t\t//check if order was found. throw error email if not\n\t\t\t\t\tif ( $orders ) {\n\n\t\t\t\t\t\t$cancel = false;\n\t\t\t\t\t\tforeach( $orders as $order ){\n\n\t\t\t\t\t\t\t// find the original order to cancel\n\t\t\t\t\t\t\tif( empty($order->correlation_id) || $order->correlation_id != '' ){\n\t\t\t\t\t\t\t\t$order_to_cancel = $order;\n\t\t\t\t\t\t\t\t$cancel = true;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// if not already there, then expire the subscription for lack of payment?\n\t\t\t\t\t\tif ( $cancel ) {\n\n\t\t\t\t\t\t\t// Record the Web Hook\n\t\t\t\t\t\t\t$update_recurly = $this->record_recurly_webhook( $post_xml, $notification, $order_to_cancel );\n\n\t\t\t\t\t\t\t// cancels them now... if NOT TSI\n\t\t\t\t\t\t\tif ( 'yes' != $mqRecurly->getSetting('tsi') ) {\n\t\t\t\t\t\t\t\tdo_action( 'recurly_failed_payment', array( 'original_order' => $order_to_cancel ) );\n\t\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// existing order???\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// No order found for supplied subscription.\n\t\t\t\t\t\t$this->_errors = array(\n\t\t\t\t\t\t\t'error' => 'No order found for subscription ID',\n\t\t\t\t\t\t\t'web_hook' => $notification->type,\n\t\t\t\t\t\t\t'subscription_id' => $subscription_uuid,\n\t\t\t\t\t\t\t'post_xml' => $post_xml\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t$this->_sendErrors();\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"expired_subscription_notification\":\n\n\t\t\t\t\t$this->from_recurly_log( $notification->type . ' XML', $post_xml );\n\t\t\t\t\t$this->from_recurly_log( $notification->type . ' DATA', $notification );\n\n\t\t\t\t\t// look up the subscription uuid (recurly_uuid)\n\t\t\t\t\t$subscription_uuid = $notification->subscription->uuid->__toString();\n\n\t\t\t\t\t//find the existing order\n\t\t\t\t\t$orders = $this->get_order_from_recurly_subscription( $subscription_uuid );\n\n\t\t\t\t\tif ( $orders ) {\n\n\t\t\t\t\t\t$cancel = false;\n\t\t\t\t\t\tforeach( $orders as $order ){\n\n\t\t\t\t\t\t\t// find the original order to cancel\n\t\t\t\t\t\t\tif( empty($order->correlation_id) || $order->correlation_id != '' ){\n\t\t\t\t\t\t\t\t$order_to_cancel = $order;\n\t\t\t\t\t\t\t\t$cancel = true;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// if not already there, then expire the subscription for lack of payment?\n\t\t\t\t\t\tif ( $cancel ) {\n\n\t\t\t\t\t\t\t// Record the Web Hook\n\t\t\t\t\t\t\t//$update_recurly = $this->record_recurly_webhook( $post_xml, $notification, $order_to_cancel );\n\n\t\t\t\t\t\t\t// update original order and cancel it\n\t\t\t\t\t\t\tglobal $wpdb;\n\t\t\t\t\t\t\t$table = 'wp_mequoda_orders';\n\t\t\t\t\t\t\t$result = $wpdb->update(\n\t\t\t\t\t\t\t\t$table,\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'cancelled' => 'y',\t// string\n\t\t\t\t\t\t\t\t\t'renewal_notice' => 'n'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tarray( 'ID' => $order_to_cancel->id ),\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'%s', //cancelled\n\t\t\t\t\t\t\t\t\t'%s' // renewal notice\n\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tarray( '%d' )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t// cancels them now... if NOT TSI\n\t\t\t\t\t\t\tif ( 'yes' != $mqRecurly->getSetting('tsi') ) {\n\t\t\t\t\t\t\t\tdo_action( 'recurly_expired_subscription', array( 'original_order' => $order_to_cancel ) );\n\t\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// existing order???\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// No order found for supplied subscription.\n\t\t\t\t\t\t$this->_errors = array(\n\t\t\t\t\t\t\t'error' => 'No order found for subscription ID',\n\t\t\t\t\t\t\t'web_hook' => $notification->type,\n\t\t\t\t\t\t\t'subscription_id' => $subscription_uuid,\n\t\t\t\t\t\t\t'post_xml' => $post_xml\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t$this->_sendErrors();\n\t\t\t\t\t}\n\n\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\techo 'success';\n\n\t\t\t// We can bail out of WP now; shutdown hooks will still run\n\t\t\texit();\n\t\t}\n\n\t}", "public function getPayload()\n {\n return $this->request->getJsonRawBody();\n }", "public function callback() {\n $params = array();\n parse_str( $_POST['form_data'], $params );\n\n if ( !wp_verify_nonce( $params['nonce'], 'sk-operation-messages' ) ) {\n die( 'Hey hey, stop messing around!!!' );\n }\n\n if ( isset( $params['om_message_id'] ) ) {\n\n if ( $this->update_message( $params['om_message_id'], $params ) ) {\n\n wp_send_json_success(\n 'Updated!!'\n );\n\n }\n\n }\n\n // Check OK. Save the message.\n if ( $this->save_message( $params ) ) {\n\n wp_send_json_success(\n 'Created!'\n );\n\n }\n\n wp_send_json_error( 'Failed!' );\n\n }", "public function getBody(): string;" ]
[ "0.7160706", "0.71327466", "0.6751222", "0.63093567", "0.63082385", "0.6240093", "0.61424047", "0.60548615", "0.59934527", "0.5951129", "0.5903839", "0.5834087", "0.58202344", "0.5753449", "0.57161653", "0.5712176", "0.5706408", "0.56778955", "0.5627228", "0.56094474", "0.5596536", "0.5588246", "0.5580318", "0.5563371", "0.553623", "0.5532648", "0.55273694", "0.55219376", "0.5472645", "0.54568714", "0.5455417", "0.5436938", "0.5436313", "0.54211456", "0.54158443", "0.53786016", "0.5376449", "0.53615284", "0.53608906", "0.5360601", "0.5353682", "0.53530157", "0.53527904", "0.53490984", "0.5341446", "0.5338979", "0.53029597", "0.5290985", "0.5288571", "0.52871054", "0.5273402", "0.5270849", "0.52690256", "0.5265866", "0.52639675", "0.5252883", "0.5234258", "0.5233405", "0.5224343", "0.5224015", "0.5218877", "0.5209724", "0.5205576", "0.51978344", "0.5186405", "0.518474", "0.51614326", "0.51541126", "0.5151519", "0.5151519", "0.5151519", "0.5151519", "0.5151519", "0.5151519", "0.5151519", "0.5151519", "0.5151519", "0.5151519", "0.5151519", "0.5151519", "0.5149485", "0.5146038", "0.513454", "0.51318526", "0.5122837", "0.5121391", "0.5108086", "0.5092753", "0.50850433", "0.5082769", "0.50710607", "0.5069171", "0.5068317", "0.5068317", "0.50657034", "0.505855", "0.50438976", "0.504138", "0.5031383", "0.5029423" ]
0.5994936
8
Called when activating the plugin
function on_activate() { // Disable buggy sitewide activation in WPMU and WP 3.0 if ((is_multisite() && isset($_GET['sitewide'])) || ($this->is_network_mode() && isset($_GET['networkwide']))) $this->network_activate_error(); // Default options update_option('ld_http_auth', 'none'); update_option('ld_hide_wp_admin', 'no'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function activatePlugin();", "abstract protected function activate_plugin();", "public function activate() {\n\t\t/**\n\t\t * Fires when the plugin is being activated.\n\t\t *\n\t\t * @since 7.0\n\t\t */\n\t\tdo_action('audition_activate');\n\t}", "function activate() \n {\n // prepare the options\n $this->get_options();\n // set the WordPress hooks\n $this->wp_hooks();\n }", "function activator()\n{\n require_once plugin_dir_path( __FILE__ ) . 'includes/Activator.php';\n\tActivator::activate();\n}", "public function plugin_activate(){\n\t\t\n\t\t//call our custom content type function\n\t \t$this->register_location_content_type();\n\t\t//flush permalinks\n\t\tflush_rewrite_rules();\n\t}", "function activate_plugin() {\n\t$logger = get_logger();\n\t$logger->activate();\n\n\t/**\n\t * Trigger custom capabilities required by the plugin to be registered.\n\t */\n\tdo_action( 'mcavoy_register_caps' );\n}", "public function plugin_activate_hook() {\r\n add_option( 'woolentor_do_activation_redirect', TRUE );\r\n add_option( 'woolentor_do_activation_library_cache', TRUE );\r\n }", "public function onActivation() {\n\n\t\t$this->options->initDefaultOptions();\n\t}", "public function plugin_activate() {\r\n\t\tupdate_option( $this->options_name, $this->options);\r\n\t}", "function activate() {\n }", "function activate_akvockan_plugin() {\n\tInc\\Base\\Activate::activate();\n}", "function activate() {\r\r\n }", "public static function activate() {\n //delete_option( 'ptb_plugin_options' );\n }", "function jft_assistant_activate() {\n\trequire_once JFT_ASSISTANT_DIR__ . '/classes/JftAssistant/Autoloader.php';\n\tJftAssistant_Autoloader::register();\n\tJftAssistant_Plugin::get_instance()->activate();\n}", "public static function activate_plugin(){\n\t\t\tadd_option('breakingnews_area_title', __('Breaking news', 'text-domain'));\n\t\t\tadd_option('breakingnews_text_color', '#F0F0F0');\n\t\t\tadd_option('breakingnews_bg_color', '#333333');\n\t\t\tadd_option('breakingnews_autoinsert', '1');\n\t\t}", "public function activate() {\n\t\t\n\t}", "public function plugin_activate(){\n\t\t//flush permalinks\n\t\tflush_rewrite_rules();\n\t}", "public function activate() {\n\n }", "public function activate() {\n\n }", "public function activate() {\n\n }", "public static function activate(){\n }", "public static function activate() {\n\n }", "public function activate();", "public function activate();", "public function activate() {\n\t\t\t// just in case I want to do anything on activate\n\t\t}", "public static function activate()\n {\n }", "function activate() {\n\t\t// do not generate any output here\n\t}", "public function initializePlugin();", "public function activate() {\n\t\t// TODO define activation functionality here\n\t}", "function activate() {\n\t\t\tadd_option('h2utp_options', json_encode($this->options));\n\t\t}", "function tb_onPluginActivate() {\r\n add_option('tagBeep_redirect_to_plugin', 'true');\r\n}", "public function activate() {\n\t\tforeach ( $this->modules as $module ) {\n\t\t\t$module->activation_hook();\n\t\t}\n\n\t\tregister_uninstall_hook( CPTP_PLUGIN_FILE, array( __CLASS__, 'uninstall' ) );\n\t}", "public function init_plugin()\n {\n }", "public function activate_extension(){}", "static function activate() {\n\t}", "function activate() {\n\t\tregister_uninstall_hook( __FILE__, array( __CLASS__, 'uninstall' ) );\n\t}", "public function activation() {\n\t\t\tif ( ! class_exists( 'Easy_Digital_Downloads' ) ) {\n\t\t\t\t// is this plugin active?\n\t\t\t\tif ( is_plugin_active( $this->basename ) ) {\n\t\t\t\t\t// deactivate the plugin\n\t\t\t \t\tdeactivate_plugins( $this->basename );\n\t\t\t \t\t// unset activation notice\n\t\t\t \t\tunset( $_GET[ 'activate' ] );\n\t\t\t \t\t// display notice\n\t\t\t \t\tadd_action( 'admin_notices', array( $this, 'admin_notices' ) );\n\t\t\t\t}\n\n\t\t\t}\n\t\t}", "public function activate() {\n $activator = new JWP\\JPE\\Activator();\n $activator->run();\n }", "public function activate() {\n MenuItem::add(array(\n 'plugin' => $this->_plugin,\n 'name' => 'menu',\n 'labelKey' => $this->_plugin . '.menu-title',\n 'icon' => 'git-square',\n 'action' => 'h-gitter-index'\n ));\n\n $htracker = PLugin::get('h-tracker');\n if($htracker && !$htracker->isActive()) {\n $htracker->activate();\n\n $items = MenuItem::getPluginMenuItems('h-tracker');\n\n foreach($items as $item) {\n $item->delete();\n }\n }\n }", "public function activated_plugin( $filename ) {\n\n\t}", "public function activate() {\n\n\t\t$this->registration_handler->register();\n\t\t\n\t}", "protected function activateSelf() {}", "function activate_mfn_wp_plugin()\n{\n require_once plugin_dir_path(__FILE__) . 'includes/class-mfn-wp-plugin-activator.php';\n Mfn_Wp_Plugin_Activator::activate();\n}", "public function bootPlugin();", "function myplugin_activate() {\n\n\tglobal $myplugin_options_all, $myplugin_dbtables_all, $myplugin_dbtables_data_all;\n\n\tif ( myplugin_installed_version() != MYPLUGIN_VERSION ) {\n\n\t\tmyplugin_activate_dbtables( $myplugin_dbtables_all, $myplugin_dbtables_data_all );\n\t\tmyplugin_activate_options( $myplugin_options_all );\n\t}\n\n\tadd_option( MYPLUGIN_NAME, MYPLUGIN_VERSION );\n}", "public function plugin_construction() {\t\r\n\t\r\n\t}", "public function activate()\n {\n if (Manager::getInstance()->isPluginActivated('Login') == true) {\n Manager::getInstance()->deactivatePlugin('Login');\n }\n }", "public static function activate ()\n\t{\n\t\t// Create or update options\n\t\tself::generate_options ();\n\t}", "public function init() {\r\n\r\n // Check WooLentor Free version\r\n if( !is_plugin_active('woolentor-addons/woolentor_addons_elementor.php') ){\r\n add_action( 'admin_notices', [ $this, 'admin_notice_missing_main_plugin' ] );\r\n return;\r\n }\r\n\r\n // Include File\r\n $this->include_files();\r\n\r\n // After Active Plugin then redirect to setting page\r\n $this->plugin_redirect_option_page();\r\n\r\n }", "function instant_ide_manager_activate() {\n\t\n\tinstant_ide_manager_activate_pre();\n\tinstant_ide_manager_activate_post();\n\t\n}", "function activate_cps() {\n\trequire_once plugin_dir_path( __FILE__ ) . 'includes/class-cps-activator.php';\n\tcps_Activator::activate();\n}", "public function activate()\n {\n $this->add_setting('financialmodelingprep_API', '1a2abc9df3aed370108ba7b4db47314d');\n }", "public static function activate() {\n if ( !current_user_can( 'activate_plugins' ) ) {\n return;\n }\n\n $plugin = isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : '';\n check_admin_referer( 'activate-plugin_' . $plugin );\n\n Clanpress_Mode::reset();\n }", "public function activate() {\n add_option( 'wpb_js_composer_do_activation_redirect', true );\n }", "function Plugin()\n\t{\n\t\t$this->Plugin_Base();\n\t}", "public function base_plugin_active()\n\t{\n\t\treturn true;\n\t}", "function activate_dashwp() {\n\trequire_once plugin_dir_path( __FILE__ ) . 'includes/class-dashwp-activator.php';\n\tDashWP_Activator::activate();\n}", "function activate()\n {\n $aData = array( 'SIZE_AVATAR' => 50,\n 'NUMERO_POST' => 5 );\n\n // Comprobamos si existe opciones para este Widget, si no existe las creamos por el contrario actualizamos\n if( ! get_option( 'ultimosPostPorAutor' ) )\n add_option( 'ultimosPostPorAutor' , $aData );\n else\n update_option( 'ultimosPostPorAutor' , $data);\n }", "public function __construct() {\n require_once __DIR__ . '/vendor/autoload.php';\n $this->define_constants();\n register_activation_hook( __FILE__, array( $this, 'activate' ) ); \n add_action( 'plugins_loaded', array( $this, 'init_plugin' ) ); \n }", "function activate_sitewide_plugin()\n {\n }", "public static function activate() {\n\t\tadd_option( 'wpr_future_events' );\n\t}", "function mediatags_activate_plugin()\n\t{\n\t\tinclude_once ( dirname (__FILE__) . '/mediatags_legacy_convert.php' );\n\t\tmediatags_plugin_version_check();\n\n\t\t// Support for Role Manager plugin http://www.im-web-gefunden.de/wordpress-plugins/role-manager/\n\t\tmediatags_add_default_capabilities();\n\t\t//mediatags_reconcile_counts();\n\t}", "function on_activation ()\n{\n}", "function on_activation ()\n{\n}", "public static function activate()\n\t\t{\n\t\t\t// Do nothing\n\t\t}", "public static function activate()\n\t\t{\n\t\t\t// Do nothing\n\t\t}", "public function onPluginsInitialized()\n\t{\n\t\tif ( $this->isAdmin() ) {\n\t\t\t$this->active = false;\n\t\t\treturn;\n\t\t}\n\n\t\t$this->enable([\n//\t\t\t'onTwigSiteVariables' => ['onTwigSiteVariables', 0]\n\t\t\t'onTwigPageVariables' => ['onTwigSiteVariables', 0]\n\t\t]);\n\t}", "static function onActivate() {\n $options = get_option(self::$optionsKey);\n if (!is_null($options)) {\n // write default options into database\n $options = array();\n $options['allowedTags'] = self::$allowedTags;\n $options['remoteStoreUrl'] = self::$remoteStoreUrl;\n $options['rteWebpackage'] = self::$rteWebpackage;\n add_option(self::$optionsKey, $options);\n }\n }", "function initPlugin()\n {\n $this->getAdminOptions();\n }", "function allonsy_plugin_activation() {\n\n\tadd_option( 'allonsy_plugin_activated', 1, '', 'no' );\n}", "function hook_activate() {\r\n\r\n if (!current_user_can('activate_plugins'))\r\n return;\r\n $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';\r\n check_admin_referer(\"activate-plugin_{$plugin}\");\r\n }", "public static function activate() {\n\t\t\t// Do nothing\n\t\t}", "function activate(){\n\n\t\t//$this->deactivate();\n\n\t\t$current_version = FALSE;\n\t\t$general_options = $options[ WPC_OPTIONS ];\n\t\t\n\t\tif ( $general_options !== FALSE && isset( $general_options[ 'WPC_VERSION' ] ) ){\n\t\t\t$current_version = $general_options[ 'WPC_VERSION' ];\t\t\n\t\t}\n\t\t\n\t\tif ( $current_version === FALSE || version_compare( $current_version, \"2.0\" ) == -1 ){\n\t\t\t\n\t\t\t// get the options from the old version\n\t\t\t$options = WordpressConnect::getOldVersionOptions();\n\t\t\t// port the options into the new version\n\t\t\tWordpressConnect::setOptions( $options );\n\t\t\t\n\t\t}\t\t\n\t\telse {\n\n\t\t\t$options = WordpressConnect::getDefaultOptions();\n\t\t\t\n\t\t\t// apply the options from the current theme\n\t\t\t$options = apply_filters( 'wp_connect_options', $options );\n\t\t\tWordpressConnect::setOptions( $options );\n\t\t\t\n\t\t}\n\t}", "function activation_hook() {\n\n\t}", "function activate_ts()\n{\n require_once plugin_dir_path(__FILE__) . 'includes/class-ts-activator.php';\n TS_Activator::activate();\n}", "function myplugin_on_activation() {\n if ( ! current_user_can( 'activate_plugins' ) ) return;\n\n // You can search about these options in wp-options table\n add_option( 'myplugin_posts_per_page', 10 );\n add_option( 'myplugin_show_welcome_page', true );\n}", "function affiliatewp_dlt_plugin_activate() {\n\tadd_option( 'affwp_dlt_activated', true );\n}", "public function activate_extension()\n\t{\n\t\t// Setup custom settings in this array.\n\t\t$this->settings = array();\n\t\t\n\t\t$data = array(\n\t\t\t'class'\t\t=> __CLASS__,\n\t\t\t'method'\t=> 'entry_submission_absolute_end',\n\t\t\t'hook'\t\t=> 'entry_submission_absolute_end',\n\t\t\t'settings'\t=> serialize($this->settings),\n\t\t\t'version'\t=> $this->version,\n\t\t\t'enabled'\t=> 'y'\n\t\t);\n\n\t\t$this->EE->db->insert('extensions', $data);\t\t\t\n\t\t\n\t}", "function instant_ide_manager_activate_post() {\n\n\tif ( ! get_option( 'instant_ide_manager_version_number' ) )\n\t\tupdate_option( 'instant_ide_manager_version_number', IIDEM_VERSION );\n\t\t\n\tinstant_ide_manager_dir_check( instant_ide_manager_get_uploads_path() );\n\n}", "function activate_horses() {\nrequire_once plugin_dir_path( __FILE__ ) . 'includes/class-horses-activator.php';\nhorses_Activator::activate();\n}", "public static function activate()\n {\n // Do nothing\n }", "protected function _initLoadPlugin() {\n\t\t$front = Zend_Controller_Front::getInstance();\n\t\t$front->registerPlugin(new Plugins_Myplugin() );\t\n\t}", "public static function activate()\n {\n $role = get_role('administrator');\n if (!empty($role)) {\n $role->add_cap('my_plugin_manage');\n }\n }", "public function onPluginsInitialized()\n {\n if ($this->isAdmin()) {\n // For speed-up when the admin plugin is active\n $this->active = false;\n } else {\n if ($this->config->get('plugins.googlemaps.enabled')) {\n // if the plugin is active globally, subscribe to additional events\n $this->enable([\n 'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],\n 'onPageInitialized' => ['onPageInitialized', 0]\n ]);\n }\n }\n }", "public function __construct()\r\n\t\t{\r\n\r\n\t\t\t$this->plugin = VIRAQUIZ_PLUGIN;\r\n\r\n\t\t}", "final public function activate() {\n\t\n\t\t//Check PHP Version and deactivate & die if it doesn't meet minimum requirements.\n\t\tif ( version_compare(PHP_VERSION, '7.2.0', '<=') ) {\n\t\t\tdeactivate_plugins( plugin_basename( WRP_PLUGIN_FILE ) );\n\t\t\twp_die( 'This plugin requires <b>PHP Version 7.2 and up</b>. <a href=\"' . admin_url('plugins.php') . '\">Go Back</a>' );\n }\n \n //Check if WooCommerce is activated. Otherwise, do not activate the plugin.\n if( !is_plugin_active('woocommerce/woocommerce.php') ) {\n deactivate_plugins( plugin_basename( WRP_PLUGIN_FILE ) );\n\t\t\twp_die( 'This plugin requires <b>WooCommerce<b>. <a href=\"' . admin_url('plugins.php') . '\">Go Back</a>' );\n }\n\t\t\n //Do activate Stuff now...\n \n\t}", "protected function beforeActivation() {\n if (!self::checkPreconditions()) {\n ilUtil::sendFailure(\"Cannot activate plugin: Make sure that you have installed the CtrlMainMenu plugin and RouterGUI. Please read the documentation: http://www.ilias.de/docu/goto_docu_wiki_1357_Reporting_Plugin.html\", true);\n //throw new ilPluginException(\"Cannot activate plugin: Make sure that you have installed the CtrlMainMenu plugin and RouterGUI. Please read the documentation: http://www.ilias.de/docu/goto_docu_wiki_1357_Reporting_Plugin.html\");\n return false;\n }\n return true;\n }", "public function activate() {\n $installer = new WeDevs\\Notification\\Installer();\n $installer->run();\n }", "public function activate() {\n global $wp_roles;\n\n if ( class_exists( 'WP_Roles' ) && ! isset( $wp_roles ) ) {\n // @codingStandardsIgnoreLine\n $wp_roles = new \\WP_Roles();\n }\n\n $all_cap = array(\n 'dokan_view_booking_menu',\n 'dokan_add_booking_product',\n 'dokan_edit_booking_product',\n 'dokan_delete_booking_product',\n 'dokan_manage_booking_products',\n 'dokan_manage_booking_calendar',\n 'dokan_manage_bookings',\n 'dokan_manage_booking_resource',\n );\n\n foreach ( $all_cap as $key => $cap ) {\n $wp_roles->add_cap( 'seller', $cap );\n $wp_roles->add_cap( 'administrator', $cap );\n $wp_roles->add_cap( 'shop_manager', $cap );\n }\n\n // flush rewrite rules after plugin is activate\n $this->flush_rewrite_rules();\n }", "public static function init()\n {\n add_action('plugins_loaded', array(self::instance(), '_setup'));\n }", "public function activate_extension()\n {\n return true;\n }", "private function setup_actions() {\n\t\tadd_option( self::OPTION_ACTIVE_PLUGINS, array() );\n\n\t\t// Loaded at priority 5 because all plugins are typically loaded before 'plugins_loaded'\n\t\tadd_action( 'plugins_loaded', array( $this, 'include_active_plugins' ), 5 );\n\n\t\tadd_action( 'init', array( $this, 'action_init' ) );\n\t}", "function wpdc_check_active(){ \r\n\r\n // plugin is ok\r\n // do the actions and filters\r\n\t\t\tadd_action( 'admin_menu',\t'wpdc_my_add_plugin_admin_page'); // the function to show the plugin settings page\r\n }", "public function init(){\n\t\tadd_action( 'admin_init', array( $this, 'init_plugin' ), 20 );\n\t}", "public function plugin_activated() {\n\t\tif ( ! $this->is_troubleshooting() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Force the database entry for active plugins if someone tried changing plugins while in Troubleshooting Mode.\n\t\tupdate_option( 'active_plugins', $this->active_plugins );\n\t}", "public function onStart() {\r\n\r\n }", "public function onStart();", "function activate() \n\t{\n\t\t$this->fields = array(\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'name'\t\t=> 'Reader',\n\t\t\t\t\t\t\t\t'count'\t\t=> 0\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'name'\t\t=> 'Commentator',\n\t\t\t\t\t\t\t\t'count'\t\t=> 10\n\t\t\t\t\t\t\t)\n\t\t);\n\t\t\n\t\tadd_option('_user_rank_comments_fields', $this->fields);\t\n\t}", "public function word_count_activation() {\n return __( 'Do something, when active the plugin', 'word-count' );\n }" ]
[ "0.8203552", "0.8018889", "0.7616073", "0.75961596", "0.750009", "0.746767", "0.74161804", "0.7392714", "0.73784673", "0.7365588", "0.72423255", "0.7170267", "0.7158208", "0.7139021", "0.7112136", "0.71087885", "0.7076638", "0.6906146", "0.69023275", "0.69023275", "0.69023275", "0.6893744", "0.68906504", "0.68904763", "0.68904763", "0.688133", "0.6855416", "0.6848823", "0.6828156", "0.68225574", "0.68162805", "0.68134445", "0.68020594", "0.67779493", "0.6772477", "0.67586476", "0.67473507", "0.67465264", "0.67318946", "0.672193", "0.6703499", "0.6676363", "0.66756815", "0.6675042", "0.66646624", "0.66549623", "0.6636781", "0.66318", "0.66148686", "0.6607624", "0.6565502", "0.6519068", "0.6503415", "0.6503178", "0.6496498", "0.6491123", "0.6485348", "0.6478019", "0.64649", "0.6462735", "0.64527255", "0.6424696", "0.6414884", "0.64129114", "0.64129114", "0.6411468", "0.6411468", "0.63848525", "0.6375952", "0.63733506", "0.6360552", "0.63603485", "0.63586986", "0.6358174", "0.63520527", "0.63483363", "0.63365906", "0.63183707", "0.6311609", "0.63090384", "0.62994915", "0.6289131", "0.62597567", "0.6257876", "0.62486184", "0.62443286", "0.62290215", "0.6224087", "0.6222859", "0.6217087", "0.621578", "0.6215248", "0.62095344", "0.62047267", "0.6188751", "0.6182638", "0.6180448", "0.6178713", "0.6178554", "0.61624837" ]
0.62727994
82
Returns true if it's WP with enabled Network mode
function is_network_mode() { static $network_mode = null; if ($network_mode === null) { $network_mode = (defined('MULTISITE') && MULTISITE); } return $network_mode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function is_network_detected()\n {\n /* Plugin is loaded via mu-plugins. */\n\n if (strpos(Utility::normalize_path($this->root_path), Utility::normalize_path(WPMU_PLUGIN_DIR)) !== false) {\n return true;\n }\n\n if (is_multisite()) {\n /* Looks through network enabled plugins to see if our one is there. */\n foreach (wp_get_active_network_plugins() as $path) {\n if ($this->boot_file == $path) {\n return true;\n }\n }\n }\n return false;\n }", "public function is_network_activate() {\n\t\tif ( ! function_exists( 'is_plugin_active_for_network' ) ) {\n\t\t\trequire_once( ABSPATH . '/wp-admin/includes/plugin.php' );\n\t\t}\n\n\t\treturn is_plugin_active_for_network( wp_defender()->slug );\n\t}", "public function is_network_active() {\n\n\t\tif ( ! is_multisite() ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check the sitewide plugins array.\n\t\t$base = $this->basename;\n\t\t$plugins = get_site_option( 'active_sitewide_plugins' );\n\n\t\tif ( ! is_array( $plugins ) || ! isset( $plugins[ $base ] ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}", "function is_wg_enabled() {\n\tglobal $config;\n\n\twg_globals();\n\n\tforeach ($wgg['tunnels'] as $tunnel) {\n\n\t\tif (empty($tunnel['enabled'])) {\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\treturn false;\n}", "function is_network_only_plugin($plugin)\n {\n }", "public function isCustomNetwork() {\n return $this->getNetwork() === 'Custom Network';\n }", "function ajan_core_do_network_admin() {\n\n\t// Default\n\t$retval = ajan_is_network_activated();\n\n\tif ( ajan_is_multiblog_mode() )\n\t\t$retval = false;\n\n\treturn (bool) apply_filters( 'ajan_core_do_network_admin', $retval );\n}", "function ajan_is_network_activated() {\n\n\t// Default to is_multisite()\n\t$retval = is_multisite();\n\n\t// Check the sitewide plugins array\n\t$base = activitynotifications()->basename;\n\t$plugins = get_site_option( 'active_sitewide_plugins' );\n\n\t// Override is_multisite() if not network activated\n\tif ( ! is_array( $plugins ) || ! isset( $plugins[$base] ) )\n\t\t$retval = false;\n\n\treturn (bool) apply_filters( 'ajan_is_network_activated', $retval );\n}", "function wp_sub_enabled() {\n\tif ( is_network_admin() ) {\n\t\treturn false;\n\t}\n\n\treturn apply_filters( 'wp_sub_enabled', true );\n}", "public function isVconnetEnabled() {\n\t\n\t\t$installed = Mage::helper('core')->isModuleEnabled('Vconnect_Postnord');\n\t\t\n\t\tif($installed == true) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t\n\t}", "public function hasNetworks() {\n return $this->_has(4);\n }", "public function getNetworkMode()\n {\n return $this->_networkMode;\n }", "public function isLivenetNetwork() {\n return $this->getNetwork() === 'livenet';\n }", "public static function detectProductionMode()\n\t{\n\t\t$addrs = array();\n\t\tif (PHP_SAPI === 'cli') {\n\t\t\t$addrs[] = getHostByName(php_uname('n'));\n\t\t} else {\n\t\t\tif (!isset($_SERVER['SERVER_ADDR']) && !isset($_SERVER['LOCAL_ADDR'])) {\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t\tif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { // proxy server detected\n\t\t\t\t$addrs = preg_split('#,\\s*#', $_SERVER['HTTP_X_FORWARDED_FOR']);\n\t\t\t}\n\t\t\tif (isset($_SERVER['REMOTE_ADDR'])) {\n\t\t\t\t$addrs[] = $_SERVER['REMOTE_ADDR'];\n\t\t\t}\n\t\t\t$addrs[] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];\n\t\t}\n\n\t\tforeach ($addrs as $addr) {\n\t\t\t$oct = explode('.', $addr);\n\t\t\t// 10.0.0.0/8 Private network\n\t\t\t// 127.0.0.0/8 Loopback\n\t\t\t// 169.254.0.0/16 & ::1 Link-Local\n\t\t\t// 172.16.0.0/12 Private network\n\t\t\t// 192.168.0.0/16 Private network\n\t\t\tif ($addr !== '::1' && (count($oct) !== 4 || ($oct[0] !== '10' && $oct[0] !== '127' && ($oct[0] !== '172' || $oct[1] < 16 || $oct[1] > 31)\n\t\t\t\t&& ($oct[0] !== '169' || $oct[1] !== '254') && ($oct[0] !== '192' || $oct[1] !== '168')))\n\t\t\t) {\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t}\n\t\treturn FALSE;\n\t}", "public function getIsOnNetworkAttribute()\n {\n return $this->networkDataAtcCurrent->exists;\n }", "public function hasNetworks() {\n return $this->_has(1);\n }", "function tinc_enabled()\n{\n $mdl = new \\OPNsense\\Tinc\\Tinc();\n\n foreach ($mdl->networks->network->iterateItems() as $network) {\n if ($network->enabled == '1') {\n return true;\n }\n }\n\n return false;\n}", "public function is_enabled() {\n $enabled = file_exists(ABSPATH . '!sak4wp.php');\n return $enabled;\n }", "protected function is_network_plugin($extension)\n {\n }", "public function hasNetworks() {\n return $this->_has(5);\n }", "private function is_wp_multisite_ready() {\n\t\t$wp_multisite = is_multisite() && ( false === $this->multisite_compatible ) ? false : true;\n\n\t\tif ( false == $wp_multisite ) {\n\t\t\t$this->add_error_notice(\n\t\t\t\t'Your site is set up as a Network (Multisite)',\n\t\t\t\t'This plugin is not compatible with multisite environment'\n\t\t\t);\n\t\t}\n\n\t\treturn $wp_multisite;\n\t}", "public function is_enabled() {\n return $this->proxy_host && $this->proxy_port;\n }", "function is_network_admin()\n {\n }", "function wp_get_network($network)\n {\n }", "public function isOnline() {}", "public function is_network_migration() {\r\n /**\r\n * Comment the line below if you'd like to support network level licenses migration.\r\n * This is only relevant if you have a special network level integration with your plugin\r\n * and you're utilizing the Freemius SDK's multisite network integration mode.\r\n */\r\n return false;\r\n }", "function codebean_is_plugin_active_for_network( $plugin ) {\n\tif ( !is_multisite() )\n\t\treturn false;\n\n\t$plugins = get_site_option( 'active_sitewide_plugins');\n\tif ( isset($plugins[$plugin]) )\n\t\treturn true;\n\n\treturn false;\n}", "public static function get_allowed_on_network()\n {\n }", "function is_wpcli() {\n\treturn defined('WP_CLI') && WP_CLI;\n}", "function isOnline()\n{\n $connected = checkdnsrr(\"google.com\");\n\n if ($connected) {\n return true;\n }\n\n return false;\n}", "public function isTestnetNetwork() {\n return $this->getNetwork() === 'testnet';\n }", "function wp_get_active_network_plugins()\n {\n }", "private function isApiAvailable() {\n\t\treturn get_option(\"wp_broadbean_ipavailibility\") == 1;\n\t}", "public function checkNeti()\n {\n $foundation = Shopware()->Models()->getRepository('Shopware\\Models\\Plugin\\Plugin')\n ->findOneBy(array('name' => 'NetiFoundation', 'active' => true));\n\n return $foundation && version_compare($foundation->getVersion(), self::getRequiredFoundation(), '>=');\n }", "function isOffline()\n{\n $connected = checkdnsrr(\"google.com\");\n\n if ($connected) {\n return false;\n }\n\n return true;\n}", "private function _isNetworkSpecified()\n {\n return ($this->getNetworkAddress() && $this->getNetworkMask());\n }", "public static function isLocal() {\n return (strpos($_SERVER['SERVER_ADDR'], '192.168') !== false || $_SERVER['HTTP_HOST'] == 'localhost');\n }", "public function isSwooleMode(): bool;", "public function hasNetworkEvent(){\n return $this->_has(3);\n }", "public function isEnabledInSystem()\r\n\t{\r\n\t\t// Get global vars\r\n\t\tglobal $realtime_webservice_global_enabled;\r\n\t\t// If both vars have a value, then it IS enabled\r\n\t\treturn $realtime_webservice_global_enabled;\r\n\t}", "private function isOnline()\n {\n return $this->online;\n }", "public function isOnline() {\n }", "function is_wpmu_sitewide_plugin( $file ) {\n\t_deprecated_function( __FUNCTION__, '3.0.0', 'is_network_only_plugin()' );\n\treturn is_network_only_plugin( $file );\n}", "function cjpopups_is_local(){\n\tif($_SERVER['REMOTE_ADDR'] == '127.0.0.1'){\n\t\treturn true;\n\t}elseif(strpos(site_url(), 'cssjockey') > 0){\n\t\treturn true;\n\t}else{\n\t\treturn false;\n\t}\n}", "private function canRun()\n {\n $confEnabled = $this->config()->get('cdn_rewrite');\n $devEnabled = ((!Director::isDev()) || ($this->config()->get('enable_in_dev')));\n return ($confEnabled && $devEnabled);\n }", "public function get_api_is_reachable() {\n\t\t$enabled = get_option( 'algolia_api_is_reachable', 'no' );\n\n\t\treturn 'yes' === $enabled;\n\t}", "function is_main_network($network_id = \\null)\n {\n }", "function pp_is_local() {\n\treturn $_SERVER['SERVER_ADDR'] == '127.0.0.1';\n}", "public static function isWeb()\n {\n return (!self::isApi())?true: false;\n }", "function url_monikers_enabled()\n{\n if (!function_exists('get_option')) {\n return false;\n }\n if (get_param_integer('keep_urlmonikers', null) === 0) {\n return false;\n }\n if (get_option('url_monikers_enabled') !== '1') {\n return false;\n }\n return true;\n}", "function is_pppoe_server_enabled() {\n\t$pppoeenable = false;\n\n\tforeach (config_get_path('pppoes/pppoe', []) as $pppoes) {\n\t\tif ($pppoes['mode'] == 'server') {\n\t\t\t$pppoeenable = true;\n\t\t}\n\t}\n\n\treturn $pppoeenable;\n}", "public function isIpnUrlAccessRestricted()\n {\n return Mage::getStoreConfigFlag(self::GENERAL_SETTINGS_PATH . 'restrictaccess', $this->getStoreId());\n }", "public function isAvailable()\n {\n if (empty($this->_url)) {\n return false;\n } // if\n\n try {\n $this->sendrequest('status', null);\n } catch (Exception $e) {\n return false;\n }\n\n return true;\n }", "function current_ip_in_network() {\r\n return ip_in_network(current_user_ip());\r\n}", "public function is_connected()\n {\n $result = @$this->mcache->getExtendedStats();\n $canconnect = false;\n\n if($result) {\n foreach($result as $server => $stats) {\n if($stats) {\n $canconnect = true;\n break;\n }\n }\n }\n \n return $canconnect;\n }", "function wp_is_maintenance_mode()\n {\n }", "private function wp_rocket_cloudflare_enabled() {\n\t\tif (function_exists('rocket_set_real_ip_cloudflare')) {\n\t\t\treturn true;\n\t\t}\n\t\treturn;\n\t}", "public function isCDEnabledAndRequestNonLocalNonAdmin()\n {\n $settings = $this->getSettings();\n return !Mage::app()->getRequest()->getPost('is_local_request')\n && !Mage::app()->getStore()->isAdmin()\n && $settings['enabled'];\n }", "public function isOnline() {\n return ($this->onlineState == 'online') || ($this->onlineState == 'in-game');\n }", "function isOnline() \n\t{\n\t\treturn ($this->status == self::STATUS_ONLINE) ? true : false;\n\t}", "public function isOnline()\n {\n return !$this->getVersion() ? false : true;\n }", "public function isEnabled()\n\t{\n\t\t// note: don't use $this->_main->.. as it might not exist when this func is called.\n\t\treturn Mage::helper('shoptimally_upsalecoupons/main')->isEnabled();\n\t}", "public function hasWebsite() {\n return $this->_has(8);\n }", "public function hasWebsite() {\n return $this->_has(9);\n }", "function tnc_enable_dev_wp_interface() {\n}", "public static function isWeb()\n {\n return !self::isCLI();\n }", "function fiorello_mikado_is_wpml_installed() {\n\t\treturn defined( 'ICL_SITEPRESS_VERSION' );\n\t}", "public function isUsingProxy()\n {\n return ((int)$this->use_proxy === 1);\n }", "function ticketbud_server_connectivity_ok() {\n\t// skip the check on WPMU because the status page is hidden\n\tglobal $ticketbud_unused_api_key;\n\tif ( $ticketbud_unused_api_key )\n\t\treturn true;\n\t$servers = ticketbud_get_server_connectivity();\n\treturn !( empty($servers) || !count($servers) || count( array_filter($servers) ) < count($servers) );\n}", "protected function isEnabled()\n {\n $store = Mage::app()->getStore();\n return $store->getConfig('cueconnect/enabled/enabled');\n }", "public function isApiEnabled()\n {\n return (Mage::getStoreConfig('easywebshopsms/api_connection/active')==0) ? false : true;\n }", "function is_dhcp_server_enabled() {\n\tforeach (config_get_path('dhcpd', []) as $dhcpif => $dhcpifconf) {\n\t\tif (empty($dhcpifconf)) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (isset($dhcpifconf['enable']) &&\n\t\t\t!empty(config_get_path(\"interfaces/{$dhcpif}\"))) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}", "public function isEnabled()\n\t{\n\t\treturn Mage::helper('wordpress')->isPluginEnabled('wordpress-seo/wp-seo.php') \n\t\t\t|| Mage::helper('wordpress')->isPluginEnabled('wordpress-seo-premium/wp-seo-premium.php');\n\t}", "public function getStatus(){\r\n if($this->scopeConfigInterface->getValue(self::XML_PATH_ENABLED,ScopeInterface::SCOPE_WEBSITE) ==1){\r\n return true;\r\n }\r\n return false;\r\n }", "public function isApiEnabled()\n {\n return (Mage::getStoreConfig('smsnotifier/main_conf/active')==0) ? 0 : 1;\n\n }", "public function isCapable(){\n\t\tif(function_exists('apache_get_modules')){\n\t\t\t$mods = apache_get_modules();\n\t\t\tif(!in_array('mod_rewrite', $mods))\n\t\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}", "public function isEnabledPdp()\n {\n return $this->isEnabled() && Mage::getStoreConfig(self::GENE_BRAINTREE_APPLEPAY_EXPRESS_PDP);\n }", "Public Function IsSelfHosted()\n\t{\n\t\tif(class_exists('Zend_Registry'))\n\t\t{\n\t\t\tif(Zend_Registry::get('Application/Mode') == 'SelfHosted')\n\t\t\t{\n\t\t\t\treturn '0';\n\t\t\t}\n\t\t}\n\t\treturn $this->isSelfHosted;\t\n\t}", "public function isRemote();", "public function isOnline() \n {\n // pings example.com and google.com\n $is_conn = null;\n $connected1 = @fsockopen(\"www.example.com\", 80); //website, port (try 80 or 443)\n $connected2 = @fsockopen(\"www.google.com\", 80); //website, port (try 80 or 443)\n // if either is successful\n if ($connected1 || $connected2){\n $is_conn = true; //action when connected\n fclose($connected1);\n fclose($connected2);\n }else{\n $is_conn = false; //action in connection failure\n }\n return $is_conn;\n }", "public static function is_wpml_active() {\n \n include_once( ABSPATH . 'wp-admin/includes/plugin.php' );\n \n $wpml_active = is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' );\n \n $string_translation_active = is_plugin_active( 'wpml-string-translation/plugin.php' );\n \n return $wpml_active && $string_translation_active;\n \n }", "public function get_enabled() {\n $enabled = get_post_meta( $this->post_id, '_wcs_enabled', true );\n $enabled_exists = metadata_exists( 'post', $this->post_id, '_wcs_enabled' );\n\n // Metadata doesn't exist yet so we assume it's enabled\n if ( ! $enabled_exists ) {\n return true;\n }\n\n return $enabled === 'yes';\n }", "public function isAllowed()\n {\n if ($this->appState->getAreaCode() == self::AREA_BACKEND) {\n return false;\n }\n\n $userAgentList = $this->helperData->getUserAgentList();\n $userAgent = $this->geoipHelperHttp->getHttpUserAgent();\n if (!empty($userAgentList) && $userAgent) {\n foreach ($userAgentList as $agent) {\n $agent = str_replace(['*', '/'], ['.*', '\\/'], $agent);\n if (preg_match(\"/{$agent}$/i\", $userAgent)) {\n return false;\n }\n }\n }\n\n $request = $this->request;\n $exceptionUrls = $this->helperData->getExceptionUrls();\n if (!empty($exceptionUrls)) {\n $requestString = $request->getRequestString();\n foreach ($exceptionUrls as $url) {\n $url = str_replace('*', '.*?', $url);\n if (preg_match('!^' . $url . '$!i', $requestString)) {\n return false;\n }\n }\n }\n\n return true;\n }", "public function isLocal()\n {\n return $this->server['SERVER_ADDR'] === $this->getClientIP();\n }", "public static function network() {\n if (!empty($_SERVER['HTTP_CLIENT_IP'])) {\n $ip_address = $_SERVER['HTTP_CLIENT_IP'];\n //whether ip is from proxy\n } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {\n $ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];\n //whether ip is from remote address\n } else {\n $ip_address = $_SERVER['REMOTE_ADDR'];\n }\n\n //check to see if the dedicated network is used\n if ($ip_address == \"127.0.0.1\") {\n return view('login');\n } else {\n return view('restricted_access');\n }\n }", "public function isOnlineFromPC()\n\t{\n\t\ttry\n\t\t{\n\t\t\tif ( !$this->isOnline() ) return FALSE;\n\t\n\t\t\treturn ( $this->__deviceDetector( $this->sessionData['browser'] ) === 'PC' );\n\t\t}\n\t\tcatch ( \\RuntimeException $e )\n\t\t{\n\t\t\tif ( method_exists( get_parent_class(), __FUNCTION__ ) )\n\t\t\t{\n\t\t\t\treturn call_user_func_array( 'parent::' . __FUNCTION__, func_get_args() );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthrow $e;\n\t\t\t}\n\t\t}\n\t}", "function is_test_request() {\n\t$proxied = defined( 'WPORG_PROXIED_REQUEST' ) && WPORG_PROXIED_REQUEST;\n\t$sandbox = defined( 'WPORG_SANDBOXED' ) && WPORG_SANDBOXED;\n\n\treturn $proxied && $sandbox;\n}", "private static function linkToNet()\n\t{\n\t\tif(!Loader::includeModule('socialservices'))\n\t\t\treturn false;\n\n\t\tif(self::isLinkedToNet())\n\t\t\treturn true;\n\n\t\t$result = false;\n\t\t$request = \\Bitrix\\Main\\Context::getCurrent()->getRequest();\n\t\t$host = ($request->isHttps() ? 'https://' : 'http://').$request->getHttpHost();\n\t\t$registerResult = \\CSocServBitrix24Net::registerSite($host);\n\n\t\tif(is_array($registerResult) && isset($registerResult[\"client_id\"]) && isset($registerResult[\"client_secret\"]))\n\t\t{\n\t\t\tOption::set('socialservices', 'bitrix24net_domain', $host);\n\t\t\tOption::set('socialservices', 'bitrix24net_id', $registerResult[\"client_id\"]);\n\t\t\tOption::set('socialservices', 'bitrix24net_secret', $registerResult[\"client_secret\"]);\n\t\t\t$result = true;\n\t\t}\n\n\t\treturn $result;\n\t}", "function isRunningDhcp() {\n\t$wlan0_dhcp = \"iface wlan0 inet dhcp\";\n\t$interfacesFile = file(\"/etc/network/interfaces\");\n\t// loop through each line of the file\n\tforeach ($interfacesFile as $interfacesLine) {\n\t\tif ($interfacesLine == $wlan0_dhcp) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}", "function isOnline()\n {\n if ( !isset( $this->_isOnline ) ) {\n $onlinehandler = &zarilia_gethandler( 'online' );\n $this->_isOnline = ( $onlinehandler->getCount( new Criteria( 'online_uid', $this->getVar( 'uid' ) ) ) > 0 ) ? true : false;\n }\n return $this->_isOnline;\n }", "public function isPing()\n {\n return self::STATUS_PING == $this->status;\n }", "public function isEnabled(): bool\n {\n return config('theme-system.enable', true) ?? true;\n }", "public function isCloud(): bool;", "public function is_enabled() {\n\n\t\t// Check if debug is on\n\t\tif ( 'on' === $this->settings->get_option( 'debug' ) ) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "public static function hasProxy() {\n\t\treturn (isset($_SERVER['HTTP_VIA']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']));\n\t}", "public function getRemoteCallEnabled() {\n\t\tif (is_null($this->remoteCallEnabled)) {\n\t\t\t$this->remoteCallEnabled = Mage::getStoreConfigFlag('dev/aoe_templatehints/enablePhpstormRemoteCall');\n\t\t}\n\t\treturn $this->remoteCallEnabled;\n\t}", "function isEnabled()\n{\n global $avahips_config;\n\n // Load Avahi-PS configuration file\n $aps_cfg = load_conffile($avahips_config);\n\n // Check for IPFS as a backend database for publication\n if (isset($aps_cfg['DATABASE']) && strpos($aps_cfg['DATABASE'], 'ipfs') !== false) {\n return true;\n }\n return false;\n}", "public function isOnline(): bool\n {\n return $this->pluck('presences.0.onlineStatus') === 'online';\n }", "public function isOnline(): bool\n {\n return $this->pluck('presences.0.onlineStatus') === 'online';\n }", "public function isConnected(){\n\n if (is_a($this->resourceId,\"mysqli\")) {\n return mysqli_ping($this->resourceId);\n }\n return false;\n }" ]
[ "0.76106954", "0.75821054", "0.7378136", "0.7021844", "0.70193887", "0.6970021", "0.6929094", "0.6860399", "0.67427504", "0.67328185", "0.67027545", "0.6689479", "0.668022", "0.66006565", "0.65965235", "0.65741277", "0.6571933", "0.6485057", "0.64530116", "0.6446313", "0.64338917", "0.6409505", "0.64022833", "0.6333542", "0.6326898", "0.6292613", "0.6289321", "0.62469345", "0.62385345", "0.62339336", "0.62143916", "0.6193054", "0.6180016", "0.61783874", "0.6175117", "0.6165967", "0.61651903", "0.6126919", "0.612591", "0.6105268", "0.6087733", "0.60847366", "0.60722536", "0.60701615", "0.60696375", "0.60649616", "0.6061258", "0.605846", "0.60488653", "0.6045919", "0.6021555", "0.6010713", "0.599788", "0.59968096", "0.598411", "0.5980839", "0.59801245", "0.5979036", "0.5978762", "0.59766686", "0.5968209", "0.5964404", "0.5940798", "0.5937677", "0.5929322", "0.5919213", "0.59152734", "0.59143806", "0.59087664", "0.5903339", "0.5890545", "0.58899266", "0.5886115", "0.58766496", "0.58750874", "0.5874476", "0.5857299", "0.58566725", "0.5856129", "0.58555585", "0.5846594", "0.5839098", "0.5838376", "0.5837164", "0.5833454", "0.5827398", "0.58273476", "0.5822189", "0.5807346", "0.58026725", "0.58012843", "0.5792123", "0.579125", "0.57908833", "0.5777074", "0.5774029", "0.57619005", "0.5755405", "0.5755405", "0.57540417" ]
0.7266318
3
DISPLAY ITEM TO MODAL OF CART_PAGE..
public function display_item(Request $request){ $id = $request->item_id; $item_id = item::where('id', $id)->first(); return response()->json($item_id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function display_items() {\n\t\t$wrap_class = str_replace( '_', '-', $this->parant_plugin_slug );\n\t\t?>\n\t\t<div id=\"wpaddons-io-wrap\" class=\"wrap <?php echo $wrap_class; ?>-wrap\">\n\n\t\t\t<?php\n\t\t\t// Get addon\n\t\t\t$addons = $this->get_addons();\n\n\t\t\t// Load the display template\n\t\t\tinclude_once( $this->view );\n\t\t\t?>\n\n\t\t</div>\n\t\t<?php\n\t}", "public function display(){\n\t\t$item_name = $this->pdh->get('item', 'name', array($this->url_id));\n\n\t\tif ( empty($item_name) ){\n\t\t\tmessage_die($this->user->lang('error_invalid_item_provided'));\n\t\t}\n\n\t\t#search for the gameid\n\t\t$game_id = $this->pdh->get('item', 'game_itemid', array($this->url_id));\n\n\t\t//Sort\n\t\t$sort\t\t\t= $this->in->get('sort');\n\n\t\t$item_ids = array();\n\t\tif ($game_id > 1){\n\t\t\t$item_ids = $this->pdh->get('item', 'ids_by_ingameid', array($game_id));\n\t\t}else{\n\t\t\t$item_ids = $this->pdh->get('item', 'ids_by_name', array($item_name));\n\t\t}\n\t\t$counter = sizeof($item_ids);\n\n\t\t//default now col\n\t\t$colspan = ($this->config->get('infotooltip_use')) ? 1 : 0 ;\n\n\t\t#Itemhistory Diagram\n\t\tif ($this->config->get('pk_itemhistory_dia')){\n\t\t\t$colspan++;\n\t\t}\n\n\t\t//Comments\n\t\t$comm_settings = array('attach_id'=>md5(stripslashes($item_name)), 'page'=>'items');\n\t\t$this->comments->SetVars($comm_settings);\n\t\t$COMMENT = ($this->config->get('pk_enable_comments') == 1) ? $this->comments->Show() : '';\n\n\t\t//init infotooltip\n\t\tinfotooltip_js();\n\n\t\t$hptt_page_settings\t\t= $this->pdh->get_page_settings('viewitem', 'hptt_viewitem_buyerslist');\n\t\t$hptt\t\t\t\t\t= $this->get_hptt($hptt_page_settings, $item_ids, $item_ids, array('%raid_link_url%' => 'viewraid.php', '%raid_link_url_suffix%' => ''), $this->url_id);\n\n\t\t//linechart data\n\t\tif($this->config->get('pk_itemhistory_dia')) {\n\t\t\t$a_items = array();\n\t\t\tforeach($item_ids as $item_id) {\n\t\t\t\t$a_items[] = array('name' => $this->time->date(\"Y-m-d H:i:s\", $this->pdh->get('item', 'date', array($item_id))), 'value' => $this->pdh->get('item', 'value', array($item_id)));\n\t\t\t}\n\t\t}\n\t\t$this->tpl->assign_vars(array(\n\t\t\t'ITEM_STATS'\t\t\t\t=> $this->pdh->get('item', 'itt_itemname', array($this->url_id, 0, 1)),\n\t\t\t'ITEM_CHART'\t\t\t\t=> ($this->config->get('pk_itemhistory_dia') && count($a_items) > 1) ? $this->jquery->LineChart('item_chart', $a_items, '', 200, 500, '', false, true, 'date') : '',\n\t\t\t'ITEM_MODEL'\t\t\t\t=> (isset($model3d)) ? $model3d : false,\n\t\t\t'COMMENT'\t\t\t\t\t=> $COMMENT,\n\n\t\t\t'SHOW_ITEMSTATS'\t\t\t=> ($this->config->get('infotooltip_use')) ? true : false,\n\t\t\t'SHOW_ITEMHISTORYA'\t\t\t=> ($this->config->get('pk_itemhistory_dia') == 1 ) ? true : false,\n\t\t\t'SHOW_COLSPAN'\t\t\t\t=> $colspan,\n\t\t\t'BUYERS_TABLE'\t\t\t\t=> $hptt->get_html_table($sort, '&amp;i='.$this->url_id, 0, 100, sprintf($this->user->lang('viewitem_footcount'), $counter)),\n\t\t\t'L_PURCHASE_HISTORY_FOR'\t=> sprintf($this->user->lang('purchase_history_for'), stripslashes($item_name)),\n\t\t));\n\n\t\t$this->core->set_vars(array(\n\t\t\t'page_title'\t\t=> sprintf($this->user->lang('viewitem_title'), stripslashes($item_name)),\n\t\t\t'template_file'\t\t=> 'viewitem.html',\n\t\t\t'display'\t\t\t=> true)\n\t\t);\n\t}", "private function item($page_name, $item_id, $item_name)\n {\n $item_id = substr($item_id, 1);\n $item = ORM::factory('showroom_cat_item')\n ->where(array(\n 'fk_site' => $this->site_id\n ))\n ->find($item_id);\n if(!$item->loaded)\n return '<div class=\"not_found\">Invalid item</div>';\n\n # get the category \n $category = ORM::factory('showroom_cat')\n ->where(array(\n 'fk_site' => $this->site_id\n ))\n ->find($item->showroom_cat_id);\n\n # get the path to this items category\n $path = ORM::factory('showroom_cat')\n ->where(array(\n 'fk_site' => $this->site_id,\n 'showroom_id' => $category->showroom_id,\n 'lft <' => $category->lft,\n 'rgt >' => $category->rgt,\n 'local_parent !='=> 0\n ))\n ->orderby(array('lft' => 'asc'))\n ->find_all();\n \n $view = new View('public_showroom/display/single_item');\n $view->item = $item;\n $view->path = $path;\n $view->category = $category;\n $view->page_name = $page_name;\n $view->img_path = $this->assets->assets_url();\n return $view;\n }", "public function item()\n\t{\n\t\t$data['itemResult'] = $this->ProcurementModel->item();\n\t\t$data['mfgco'] = $this->ProcurementModel->getMfgCo();\n\t\t$data['supplier'] = $this->ProcurementModel->getSupplier();\n\t\t$data['cat'] = $this->ProcurementModel->category();\n\t\t$data['pagename'] = \"item\";\n\t\t$data['category'] = \"master\";\n\t\t$data['active_menu'] = \"procurement\";\n\t\t$this->load->view('Director',$data);\n\n\t}", "function onDisplayCartItem( $i, $item )\n\t{\n\t $vars = new JObject();\n\t\t$editable_by = 2;\n\t\t$app = JFactory::getApplication();\n\t\tif( $app->isAdmin() ) {\n\t\t\t$view = JRequest::getCmd('view', '' );\n\t\t\tif( $view == 'pos' ) { // display all for POS\n\t\t\t\t$editable_by = array( 1, 2);\t\n\t\t\t}\n\t\t}\n\t \n\t\t// Get extra fields for products\n\t\t$fields = $this->getCustomFields( 'products', $item->product_id, true, $editable_by );\n\t\t\n\t\t// If there are any extra fields, show them as an extra tab\n\t\tif ( count( $fields ) )\n\t\t{\n\t\t\t$field_show = array();\n\t\t\tTienda::load( 'TiendaHelperEav', 'helpers.eav' );\n\t\t\tforeach ( $fields as $f )\n\t\t\t{\n\t\t\t\t$k = $f['attribute']->eavattribute_alias;\n\t\t\t\t$f['value'] = TiendaHelperEav::getAttributeValue($f['attribute'], 'carts', $item->cart_id);\n\t\t\t\t$field_show[] = $f;\n\t\t\t}\n\t\t\t\n\t\t\tif(count($field_show))\n\t\t\t{\n\t\t\t\t$vars->fields = $field_show;\n\t\t\t\t$html = $this->_getLayout( 'product_cart', $vars );\n\t\t\t\techo $html;\n\t\t\t}\n\t\t}\n\t}", "function additem()\n {\n if ($this->isAdmin() == TRUE) {\n $this->loadThis();\n } else {\n $this->global['pageTitle'] = '新增轮播图';\n $this->global['pageName'] = 'carousel_add';\n $data = '';\n\n $this->loadViews(\"carousel_add\", $this->global, $data, NULL);\n }\n }", "public function display_item_for_print() {\n \n $event_id = $this->input->post('event_id');\n\n\t\t$result = $this->db->query(\"SELECT hpp_category, hpp_subcategory, item_name, item_qty, item_satuan, item_price\n\t\t\t\t\t\t\t\t\t\t FROM events_hpp\n JOIN events_master ON events_master.id = events_hpp.master_id\n WHERE event_id = \" . $event_id . \"\n ORDER BY hpp_category, item_name ASC\");\n\n\t\t$attr = array(\n 'count_events_hpp' \t=> $result->num_rows(),\n 'events_hpp' => $result->result()\n\t\t\t\t\t);\n\n $this->load->view('analisa/print-laba-rugi-detail', $attr);\n \n }", "public function display_item() {\n\n\t\t$id = $this->input->post('id');\n\t\t$event_id = $this->input->post('event_id');\n\n\t\t$result = $this->db->query(\"SELECT id, item_name, item_qty, item_price\n\t\t\t\t\t\t\t\t\t\t FROM events_hpp\n\t\t\t\t\t\t\t\t\t\t WHERE event_id = \" . $event_id . \"\n\t\t\t\t\t\t\t\t\t\t AND master_id = \" . $id);\n\n\t\t$attr = array(\n\t\t\t\t\t\t'count_events_hpp' \t=> $result->num_rows(),\n\t\t\t\t\t\t'events_master'\t=> $this->db->query(\"SELECT id, hpp_category, hpp_subcategory\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM events_master\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE id = \" . $id)->row_array(),\n\t\t\t\t\t\t'event_id'\t\t=> $event_id\n\t\t\t\t\t);\n\n\t\t$this->load->view('analisa/display-item', $attr);\n\n\t}", "function new_products_display($item, $image){\n echo \"\n <div class='col-17'>\n <a href='product-details-airforceone.php'>\n <div class='new-products-wrapper hover-shadow'>\n <figure class='new-products-img-wrapper'>\n <img class='new-products-img' src=$image alt='$item[1]'>\n </figure>\n <p class='text-center text-small color-gray'>$item[1]</p>\n <h2 class='text-center text-medium'>$item[1]</h2>\n <h3 class='text-center text-normal color-red'>$$item[2]</h3>\n </div>\n </a>\n </div>\";\n }", "function view_items() {\n $items = \\Model\\Item::all();\n \n $this->SC->CP->load_view('stock/view_items',array('items'=>$items));\n }", "public function show(ExtraItem $extraItem)\n {\n //\n }", "function onDisplayOrderItem( $i, $item )\n\t{\n\t $vars = new JObject();\n\t \n\t\t// Get extra fields for products\n\t\t$fields = $this->getCustomFields( 'products', $item->product_id, true, 2 );\n\t\t\n\t\t// If there are any extra fields, show them as an extra tab\n\t\tif ( count( $fields ) )\n\t\t{\n\t\t\t$field_show = array();\n\t\t\tTienda::load( 'TiendaHelperEav', 'helpers.eav' );\n\t\t\tforeach ( $fields as $f )\n\t\t\t{\n\t\t\t\t$k = $f['attribute']->eavattribute_alias;\n\t\t\t\t$f['value'] = $item->$k;\n\t\t\t\t\t\n\t\t\t\tif(empty($f['value']))\n\t\t\t\t{\n\t\t\t\t\t$f['value'] = TiendaHelperEav::getAttributeValue($f['attribute'], 'orderitems', $item->orderitem_id );\n\t\t\t\t}\n\t\t\t\t$f['value'] = TiendaHelperEav::showValue( $f['attribute'], $f['value'] );\n\t\t\t\t\n\t\t\t\t$field_show[] = $f;\n\t\t\t}\n\t\t\t\n\t\t\tif(count($field_show))\n\t\t\t{\n\t\t\t\t$vars->fields = $field_show;\n\t\t\t\t$html = $this->_getLayout( 'product_order', $vars );\n\t\t\t\techo $html;\n\t\t\t}\n\t\t}\n\t}", "abstract public function print_item();", "function display($tpl = NULL) {\n $items = $this->get('Items');\n\n $this->canDo = LajvITHelper::getEventActions();\n\n if (count($errors = $this->get('Errors'))) {\n JError::raiseError(500, implode('<br />', $errors));\n return FALSE;\n }\n\n $this->items = $items;\n\n $this->addToolBar();\n parent::display($tpl);\n $this->setDocument();\n }", "public function show(Item $item)\n {\n //\n }", "public function show(Item $item)\n {\n //\n }", "public function shop_item()\n {\n $this->el = new XTemplate($this->temp, $this->path);\n\n // for element that have wrapper and comment\n $this->el->assign('WRAPPER', $this->wrapper);\n $this->el->assign('LINK', $this->link);\n\n // scan all variables when using\n foreach ($this->shop_item as $key => $value) {\n\n // customize if need when more vars in html template *\n $this->el->assign('IMG', $value);\n\n // fixed loop\n $this->el->parse('shop_item');\n }\n\n // fixed out results\n echo $this->el->text('shop_item');\n\n }", "public function index()\n {\n $data['row'] = $this->items_m->get();\n $this->template->load('template', 'product/item/item_data', $data);\n }", "function viewItemType() {\n//\t\tglobal $HTML;\n\t\tglobal $page;\n\n\t\t$_ = '';\n\t\t$_ .= '<div class=\"c init:form form:action:'.$page->url.'\" id=\"container:itemtype\">';\n\t\t\t$_ .= $this->getTypeObject()->viewItem();\n\t\t$_ .= '</div>';\n\n\t\treturn $_;\n\t}", "private function print_item($item) {\n global $DB, $CFG;\n\n require_once($CFG->libdir . '/filelib.php');\n\n //is the item a template?\n if (!$item->feedback AND $item->template) {\n $template = $DB->get_record('feedback_template', array('id'=>$item->template));\n if ($template->ispublic) {\n $context = context_system::instance();\n } else {\n $context = context_course::instance($template->course);\n }\n $filearea = 'template';\n } else {\n $cm = get_coursemodule_from_instance('feedback', $item->feedback);\n $context = context_module::instance($cm->id);\n $filearea = 'item';\n }\n\n $item->presentationformat = FORMAT_HTML;\n $item->presentationtrust = 1;\n\n $output = file_rewrite_pluginfile_urls($item->presentation,\n 'pluginfile.php',\n $context->id,\n 'mod_feedback',\n $filearea,\n $item->id);\n\n $formatoptions = array('overflowdiv'=>true, 'trusted'=>$CFG->enabletrusttext);\n echo format_text($output, FORMAT_HTML, $formatoptions);\n }", "public function onDisplayPagesEdit($event)\r\n {\r\n $item = $event->getArgument('item');\r\n $tabs = $event->getArgument('tabs');\r\n $content = $event->getArgument('content');\r\n \r\n $view = \\Dsc\\System::instance()->get('theme');\r\n $shop_content = $view->renderLayout('Shop/Admin/Views::listeners/fields_related_products.php');\r\n \r\n $tabs['shop'] = 'Shop';\r\n $content['shop'] = $shop_content;\r\n \r\n $event->setArgument('tabs', $tabs);\r\n $event->setArgument('content', $content);\r\n }", "public function show(Item $item)\n {\n \n }", "public function actionShow() {\n $session = $this->session;\n $this->layout = false; // loading only view file, without layout;\n $items_to_show = $this->getProductObject($session);\n return $this->render('cart-modal', compact('session', 'cart_products', 'items_to_show'));\n }", "function items(){\n $data['content_page']='admin/items';\n $this->load->view('common/base_template',$data);\n }", "public function show(Item $item)\n {\n }", "abstract protected function showContent(): self;", "function displayItems(){\r\n\t\t\trequire \"connect.php\";\r\n\t\t\t$query = \"Select* from items\";\r\n\t\t \t$rows = $conn->query($query);\r\n\t\t \r\n\t\t\t\r\n global $itemsArray;\r\n \r\n $index = 0;\r\n\t\t\tforeach($rows as $row){\r\n\t\t\t\t$id = $row[\"id\"];\r\n\t\t\t\t$item_Name = $row[\"itemname\"];\r\n\t\t\t\t$item_Price = $row[\"itemprice\"];\r\n\t\t\t\t$image_URL = $row[\"imageurl\"];\r\n\t\t\t\t$isNew = $row[\"isNew\"];\r\n\t\t\t\t$catagory = \"Hardcoded catagory\";\r\n\t\t\t \r\n\t\t\t $item = new Item($id,$item_Name,$item_Price,$image_URL,$item_Price);\r\n\r\n \r\n\r\n\t\t\t ?>\r\n\t\t\t<div class=\"product-grid\">\t\t\t\t\t \r\n\t\t\t\t\t<div class=\"more-product-info\">\r\n\r\n\t\t\t\t\t \t<?php\r\n\t\t \t\t\t\t\tif($isNew ==1 ){\r\n\t\t\t \t\t\t\t\techo \"<span id ='isNew'>NEW</span>\";\r\n\t\t \t\t\t\t \t}\r\n\t\t\t\t\t\t\t?>\r\n\t\t\t\t\t</div>\t\t\t\t\t\t\r\n\t\t\t\t\t<div class=\"product-img b-link-stripe b-animate-go thickbox\">\t\t\t\t\t\t \r\n\t\t\t\t\t\t<?php echo'<img src=\"'.$image_URL.'\" class=\"img-responsive\" alt=\"\"/>' ?>\r\n\t\t\t\t\t\t<div class=\"b-wrapper\">\r\n\t\t\t\t\t\t\t<h4 class=\"b-animate b-from-left b-delay03\">\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<button class=\"btns\">ORDER NOW</button>\r\n\t\t\t\t\t\t\t</h4>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\t\t\t\t\t\r\n\t\t\t\t\t<div class=\"product-info simpleCart_shelfItem\">\r\n\t\t\t\t\t\t<div class=\"product-info-cust\">\r\n\t\t\t\t\t\t\t<h4><?php echo $item->getItemName()?></h4>\r\n\t\t\t\t\t\t\t<span class=\"item_price\"><?php echo \"R\".$item->getPrice() ?></span>\r\n\t\t\t\t\t\t\t<input type=\"text\" class=\"item_quantity\" value=\"1\" />\r\n\t\t\t\t\t\t\t<a href = \"index.php?action=addItem&itemId=<?php echo\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$item->getItemId().\"&price=\".$item->getPrice() ?>\">\r\n\t\t\t\t\t\t\t\t<input type=\"button\" class=\"item_add\" value=\"ADD\">\r\n\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t<div class=\"clearfix\"> </div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\t\r\n\r\n\r\n\r\n\r\n <?php\r\n\r\n \t\t}\r\n\r\n\r\n\r\n\t}", "function show_items_list($items,$moodlecst,$cm){\n\t\n\t\tif(!$items){\n\t\t\treturn $this->output->heading(get_string('noitems','moodlecst'), 3, 'main');\n\t\t}\n\t\n\t\t$table = new html_table();\n\t\t$table->id = 'MOD_MOODLECST_qpanel';\n\t\t$table->head = array(\n\t\t\tget_string('itemname', 'moodlecst'),\n\t\t\tget_string('itemtype', 'moodlecst'),\n\t\t\tget_string('actions', 'moodlecst')\n\t\t);\n\t\t$table->headspan = array(1,1,3);\n\t\t$table->colclasses = array(\n\t\t\t'itemname', 'itemtitle', 'edit','duplicate','delete'\n\t\t);\n\n\t\t//sort by start date\n\t\t//core_collator::asort_objects_by_property($items,'timecreated',core_collator::SORT_NUMERIC);\n\t\t//core_collator::asort_objects_by_property($items,'name',core_collator::SORT_STRING);\n\n\t\t//loop through the homoworks and add to table\n\t\tforeach ($items as $item) {\n\t\t\t$row = new html_table_row();\n\t\t\n\t\t\n\t\t\t$itemnamecell = new html_table_cell($item->name);\t\n\t\t\tswitch($item->type){\n\t\t\t\tcase MOD_MOODLECST_SLIDEPAIR_TYPE_PICTURECHOICE:\n\t\t\t\t\t$itemtype = get_string('picturechoice','moodlecst');\n\t\t\t\t\tbreak;\n\t\t\t\tcase MOD_MOODLECST_SLIDEPAIR_TYPE_AUDIOCHOICE:\n\t\t\t\t\t$itemtype = get_string('audiochoice','moodlecst');\n\t\t\t\t\tbreak;\n\t\t\t\tcase MOD_MOODLECST_SLIDEPAIR_TYPE_TABOO:\n\t\t\t\t\t$itemtype = get_string('taboo','moodlecst');\n\t\t\t\t\tbreak;\n\t\t\t\tcase MOD_MOODLECST_SLIDEPAIR_TYPE_TEXTCHOICE:\n\t\t\t\t\t$itemtype = get_string('textchoice','moodlecst');\n\t\t\t\t\tbreak;\n\t\t\t\tcase MOD_MOODLECST_SLIDEPAIR_TYPE_TRANSLATE:\n\t\t\t\t\t$itemtype = get_string('translate','moodlecst');\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t} \n\t\t\t$itemtypecell = new html_table_cell($itemtype);\n\t\t\n\t\t\t$actionurl = '/mod/moodlecst/slidepair/manageslidepairs.php';\n\t\t\t$editurl = new moodle_url($actionurl, array('id'=>$cm->id,'itemid'=>$item->id));\n\t\t\t$editlink = html_writer::link($editurl, get_string('edititem', 'moodlecst'));\n\t\t\t$editcell = new html_table_cell($editlink);\n\n $duplicateurl = new moodle_url($actionurl, array('id'=>$cm->id,'itemid'=>$item->id,'action'=>'duplicate'));\n $duplicatelink = html_writer::link($duplicateurl, get_string('duplicateitem', 'moodlecst'));\n $duplicatecell = new html_table_cell($duplicatelink);\n\t\t\t\n\t\t\t//$previewlink = $this->fetch_preview_link($item->id,$moodlecst->id);\n\t\t\t//$previewcell = new html_table_cell($previewlink);\n\t\t\n\t\t\t$deleteurl = new moodle_url($actionurl, array('id'=>$cm->id,'itemid'=>$item->id,'action'=>'confirmdelete'));\n\t\t\t$deletelink = html_writer::link($deleteurl, get_string('deleteitem', 'moodlecst'));\n\t\t\t$deletecell = new html_table_cell($deletelink);\n\n\t\t\t$row->cells = array(\n\t\t\t\t$itemnamecell, $itemtypecell, $editcell,$duplicatecell, $deletecell\n\t\t\t);\n\t\t\t$table->data[] = $row;\n\t\t}\n\n\t\treturn html_writer::table($table);\n\n\t}", "function tpl_item_page( $page ) {\n\ttpl('item', 'page', array(\n\t\t'page' => $page\n\t) );\n}", "private static function display($data, ItemMasterItem $item) {\n\t\t$itm = self::getItm();\n\t\t$xrefs = self::xrefs();\n\t\t$session = self::pw('session');\n\t\t$config = self::pw('config');\n\n\t\t$html = '';\n\t\t$html .= self::breadCrumbs();\n\t\t// if ($session->getFor('response', 'cxm')) {\n\t\t// \t$html .= $config->twig->render('items/itm/response-alert.twig', ['response' => $session->getFor('response', 'cxm')]);\n\t\t// \t$session->removeFor('response', 'cxm');\n\t\t// }\n\t\t$response = $itm->getResponse(); \n\t\tif ($response && $response->has_success() === false) {\n\t\t\t$html .= $config->twig->render('items/itm/response-alert.twig', ['response' => $itm->getResponse()]);\n\t\t}\n\t\t$html .= self::lockItem($data->itemID);\n\t\t$html .= $config->twig->render('items/itm/itm-links.twig');\n\t\t$html .= $config->twig->render('items/itm/xrefs/page.twig', ['itm' => $itm, 'item' => $item, 'xrefs' => $xrefs]);\n\t\treturn $html;\n\t}", "function ShowItemPrint($class, $ParamArr = array())\r\n\t{\r\n\t\tglobal $member_id, $metatags;\r\n\t\tif(isset($_GET['id']))\r\n\t\t{\r\n\t\t\t$IId = $_GET['id'];\r\n\t\t\t$Items = $this->GetRecord($class, $IId);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$MesData = \"Неправильный запрос вы будете перенаправлены на главну страницу <br /><a href=\\\"\".$this->GetLinkTag(\"main\").\"\\\">На главную</a>\";\t\r\n\t\t\treturn $this->MakeTemplate($this->templates['message'], array(\"msg\"=>$MesData), \"content\");\r\n\t\t}\r\n\t\t$CurItem = $Items[0];\r\n\t\t$metatags['title'] \t\t\t= $CurItem['title'].\" :: \".$this->MyConfig['title']['value'];\r\n\t\tif(isset($CurItem['description']))\r\n\t\t{\r\n\t\t\t$metatags['description'] \t= $CurItem['description'];\r\n\t\t}\t\r\n\t\t$ArrVar = array();\r\n\t\t\r\n\t\t$ArrVar['breadcrumbs'] = $this->GenerateCrumbs($class, $CurItem);\r\n\t\t\r\n\t\t//$ArrVar = $this->ShowComments($CurItem);\r\n\t\tforeach($CurItem as $key=>$value)\r\n\t\t{\r\n\t\t\t$CurItem[$key] = $this->GetTrueValue($value, $this->MyClasses[$class]['db'][$key]);\r\n\t\t\tif($this->MyClasses[$class]['db'][$key]==\"img\")\r\n\t\t\t{\r\n\t\t\t\t$CurItem[\"\".$key.\"_thumb\"] = $this->GetTrueValue($value, $this->MyClasses[$class]['db'][$key].\"_thumb\");\r\n\t\t\t\t$CurItem[\"\".$key.\"_thumb_raw\"] = $this->GetTrueValue($value, $this->MyClasses[$class]['db'][$key].\"_thumb_raw\");\r\n\t\t\t\t$CurItem[\"\".$key.\"_raw\"] = $this->GetTrueValue($value, $this->MyClasses[$class]['db'][$key].\"_raw\");\r\n\t\t\t\t$CurItem[\"\".$key.\"_complete\"] = $this->GetTrueValue($value, $this->MyClasses[$class]['db'][$key].\"_complete\");\r\n\t\t\t}\r\n\t\t\tif($this->MyClasses[$class]['db'][$key]==\"unlimg\")\r\n\t\t\t{\r\n\t\t\t\t$CurItem[\"\".$key.\"_thumb\"] = $this->GetTrueValue($value, $this->MyClasses[$class]['db'][$key].\"_thumb\");\r\n\t\t\t\t$CurItem[\"\".$key.\"_complete\"] = $this->GetTrueValue($value, $this->MyClasses[$class]['db'][$key].\"_complete\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(isset($this->MyClasses[$class]['commcl'])&&$this->MyClasses[$class]['commcl']!=\"\")\r\n\t\t{\r\n\t\t\t$CurItem['comments'] = $this->ShowComments($class, $CurItem['id']);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$CurItem['comments'] = \"\";\r\n\t\t}\r\n\t\tif($member_id['user_group']==\"1\")\r\n\t\t{\r\n\t\t\t$CurItem[\"adm_links\"] = \"<a href=\\\"\".$this->GetLink($class, \"edit\", array(\"id\"=>$IId)).\"\\\">\".$this->GetLangVar(\"Edit\").\"</a> | <a href=\\\"\".$this->GetLink($class, \"delete\", array(\"id\"=>$IId)).\"\\\">\".$this->GetLangVar(\"Delete\").\"</a>\";\r\n\t\t\tif(isset($this->ModerSets[''.$class.'']))\r\n\t\t\t{\r\n\t\t\t\t// moderation links go here\r\n\t\t\t\tif($CurItem['published']==\"1\")\r\n\t\t\t\t{\r\n\t\t\t\t\t$CurItem[\"adm_links\"] .= \" | <a href=\\\"\".$this->GetLink($class, \"unpublish\", array(\"id\"=>$IId)).\"\\\">\".$this->GetLangVar(\"unpubl\").\"</a>\"; \r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t$CurItem[\"adm_links\"] .= \" | <a href=\\\"\".$this->GetLink($class, \"publish\", array(\"id\"=>$IId)).\"\\\">\".$this->GetLangVar(\"publ\").\"</a>\";\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$CurItem[\"adm_links\"] = \"\";\r\n\t\t}\r\n\t\t\r\n\t\t$ArrVar = array_merge($ArrVar, $CurItem);\r\n\t\t$PlugDataArr = array();\r\n\t\tforeach($this->Plugins as $key=>$value)\r\n\t\t{\r\n\t\t\t$PlugDataArr = $this->LoadPlugin($key, \"ShowFull\", $ArrVar);\r\n\t\t}\r\n\t\t$ArrVar = array_merge($ArrVar, $PlugDataArr);\r\n\t\t\r\n\t\tif(isset($ParamArr['tpl']))\r\n\t\t{\r\n\t\t\t$TemplateLoad = $ParamArr['tpl'];\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t//$TemplateLoad = $this->MyClasses[$class]['tpl']['full'];\r\n\t\t\t$TemplateLoad = \"templates/artprint.tpl\";//$this->MyClasses[$class]['tpl']['fullprint'];\r\n\t\t}\r\n\t\t\t\r\n\t\t//$ArrVar = array_merge($ArrVar, $this->GetAdminLinks($class, \"ShowItem\"));\r\n\t\treturn $this->MakeTemplate($TemplateLoad, $ArrVar, \"content\", true);\r\n\t}", "public static function listItemsTpl()\n {\n extract(FeedPage::$var);\n?>\n<?php include(\"tpl/list_items.tpl.php\"); ?>\n<?php\n }", "function actionRssitem() {\n $bodytag = str_replace(\"centro_sinmarco\", \"img-responsive\", $_POST['description']) ;\n $body = str_replace('frameborder=\"0\"', 'frameborder=\"0\" class=\"embed-responsive-item\"', $bodytag) ;\n $model = [\n 'titleNews' => $_POST['titleNews'],\n 'description' => $body,\n 'title' => $_POST['title'],\n 'pubDate' => $_POST['pubDate'],\n 'link' => $_POST['link'],\n ] ;\n return $this->render('rssitem', [\n 'model' => $model\n ]) ;\n }", "public function drawSpecificItem($item){\r\n $result=\"\";\r\n if ($item=='projects') {\r\n $prj=new Project();\r\n $result .=\"<table><tr><td class='label' valign='top'><label>\" . i18n('projects') . \"&nbsp;:&nbsp;</label>\";\r\n $result .=\"</td><td>\";\r\n $result .= $prj->drawProjectsList(array('idRecipient'=>$this->id,'idle'=>'0'));\r\n $result .=\"</td></tr></table>\";\r\n return $result;\r\n } else if ($item=='contacts') {\r\n $con=new Contact();\r\n $result .=\"<table><tr><td class='label' valign='top'><label>\" . i18n('contacts') . \"&nbsp;:&nbsp;</label>\";\r\n $result .=\"</td><td>\";\r\n $result .= $con->drawContactsList(array('idRecipient'=>$this->id,'idle'=>'0'));\r\n $result .=\"</td></tr></table>\";\r\n return $result;\r\n }\r\n }", "function display($tpl = null) \r\n\t{\r\n\r\n\r\n\t\t// Set the document\r\n\t\t$this->setDocument();\r\n\t\t\r\n\t\t// Set the toolbar\r\n\t\t$this->addToolBar();\r\n\r\n\t\t$this->item = $tema;\r\n\t\t\r\n\r\n\t\t// Display the template\r\n\t\tparent::display($tpl);\r\n\t}", "public function showItemBody() {\n echo \"<form method=\\\"post\\\" enctype=\\\"multipart/form-data\\\">\";\n $resource_provider = $this->resource_provider;\n echo $this->item_body->execute();\n echo \"<input type=\\\"submit\\\" value=\\\"Submit response\\\"/>\";\n echo \"</form>\";\n }", "function show()\r\n\t{\r\n\t\t?>\r\n\r\n\t\t<button class='textlayout' type=\"submit\" name=\"itemtoedit\" value=\"<?php echo $this->orderno ?>\" >\r\n\t\t\t<p>\r\n\t\t\t<span style='font-weight:bold'><?php echo $this->orderno . \". \" . $this->question ; ?></span>\r\n\t\t\t<span style='font-weight:normal'>(<?php echo $this->typeshort; ?>)</span><br>\r\n\t\t\t<span><?php $n = 1; foreach($this->answers as $answerobject){if ($n > 1){echo \", \";}$n ++;echo $answerobject->answer;}?></span>\r\n\t\t\t</p>\r\n\t\t</button><br>\r\n\t\t\r\n\t\t<?php \r\n\t}", "public function tt_content_drawItem($row)\n {\n $out = '';\n $outHeader = '';\n // Make header:\n\n if ($row['header']) {\n $hiddenHeaderNote = '';\n // If header layout is set to 'hidden', display an accordant note:\n if ($row['header_layout'] == 100) {\n $hiddenHeaderNote = ' <em>[' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.hidden')) . ']</em>';\n }\n $outHeader = $row['date']\n ? htmlspecialchars($this->itemLabels['date'] . ' ' . BackendUtility::date($row['date'])) . '<br />'\n : '';\n $outHeader .= '<strong>' . $this->linkEditContent($this->renderText($row['header']), $row)\n . $hiddenHeaderNote . '</strong><br />';\n }\n // Make content:\n $drawItem = true;\n // Hook: Render an own preview of a record\n foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'] ?? [] as $className) {\n $hookObject = GeneralUtility::makeInstance($className);\n if (!$hookObject instanceof PageLayoutViewDrawItemHookInterface) {\n throw new \\UnexpectedValueException($className . ' must implement interface ' . PageLayoutViewDrawItemHookInterface::class, 1218547409);\n }\n $hookObject->preProcess($this, $drawItem, $outHeader, $out, $row);\n }\n\n // If the previous hook did not render something,\n // then check if a Fluid-based preview template was defined for this CType\n // and render it via Fluid. Possible option:\n // mod.web_layout.tt_content.preview.media = EXT:site_mysite/Resources/Private/Templates/Preview/Media.html\n if ($drawItem) {\n $tsConfig = BackendUtility::getPagesTSconfig($row['pid'])['mod.']['web_layout.']['tt_content.']['preview.'] ?? [];\n $fluidTemplateFile = '';\n\n if ($row['CType'] === 'list' && !empty($row['list_type'])\n && !empty($tsConfig['list.'][$row['list_type']])\n ) {\n $fluidTemplateFile = $tsConfig['list.'][$row['list_type']];\n } elseif (!empty($tsConfig[$row['CType']])) {\n $fluidTemplateFile = $tsConfig[$row['CType']];\n }\n\n if ($fluidTemplateFile) {\n $fluidTemplateFile = GeneralUtility::getFileAbsFileName($fluidTemplateFile);\n if ($fluidTemplateFile) {\n try {\n $view = GeneralUtility::makeInstance(StandaloneView::class);\n $view->setTemplatePathAndFilename($fluidTemplateFile);\n $view->assignMultiple($row);\n if (!empty($row['pi_flexform'])) {\n $flexFormService = GeneralUtility::makeInstance(FlexFormService::class);\n $view->assign('pi_flexform_transformed', $flexFormService->convertFlexFormContentToArray($row['pi_flexform']));\n }\n $out = $view->render();\n $drawItem = false;\n } catch (\\Exception $e) {\n $this->logger->warning(sprintf(\n 'The backend preview for content element %d can not be rendered using the Fluid template file \"%s\": %s',\n $row['uid'],\n $fluidTemplateFile,\n $e->getMessage()\n ));\n }\n }\n }\n }\n\n // Draw preview of the item depending on its CType (if not disabled by previous hook):\n if ($drawItem) {\n switch ($row['CType']) {\n case 'header':\n if ($row['subheader']) {\n $out .= $this->linkEditContent($this->renderText($row['subheader']), $row) . '<br />';\n }\n break;\n case 'bullets':\n case 'table':\n if ($row['bodytext']) {\n $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';\n }\n break;\n case 'uploads':\n if ($row['media']) {\n $out .= $this->linkEditContent($this->getThumbCodeUnlinked($row, 'tt_content', 'media'), $row) . '<br />';\n }\n break;\n case 'menu':\n $contentType = $this->CType_labels[$row['CType']];\n $out .= $this->linkEditContent('<strong>' . htmlspecialchars($contentType) . '</strong>', $row) . '<br />';\n // Add Menu Type\n $menuTypeLabel = $this->getLanguageService()->sL(\n BackendUtility::getLabelFromItemListMerged($row['pid'], 'tt_content', 'menu_type', $row['menu_type'])\n );\n $menuTypeLabel = $menuTypeLabel ?: 'invalid menu type';\n $out .= $this->linkEditContent($menuTypeLabel, $row);\n if ($row['menu_type'] !== '2' && ($row['pages'] || $row['selected_categories'])) {\n // Show pages if menu type is not \"Sitemap\"\n $out .= ':' . $this->linkEditContent($this->generateListForCTypeMenu($row), $row) . '<br />';\n }\n break;\n case 'shortcut':\n if (!empty($row['records'])) {\n $shortcutContent = [];\n $recordList = explode(',', $row['records']);\n foreach ($recordList as $recordIdentifier) {\n $split = BackendUtility::splitTable_Uid($recordIdentifier);\n $tableName = empty($split[0]) ? 'tt_content' : $split[0];\n $shortcutRecord = BackendUtility::getRecord($tableName, $split[1]);\n if (is_array($shortcutRecord)) {\n $icon = $this->iconFactory->getIconForRecord($tableName, $shortcutRecord, Icon::SIZE_SMALL)->render();\n $icon = BackendUtility::wrapClickMenuOnIcon(\n $icon,\n $tableName,\n $shortcutRecord['uid']\n );\n $shortcutContent[] = $icon\n . htmlspecialchars(BackendUtility::getRecordTitle($tableName, $shortcutRecord));\n }\n }\n $out .= implode('<br />', $shortcutContent) . '<br />';\n }\n break;\n case 'list':\n $hookOut = '';\n $_params = ['pObj' => &$this, 'row' => $row, 'infoArr' => []];\n foreach (\n $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']] ??\n $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT'] ??\n [] as $_funcRef\n ) {\n $hookOut .= GeneralUtility::callUserFunction($_funcRef, $_params, $this);\n }\n if ((string)$hookOut !== '') {\n $out .= $hookOut;\n } elseif (!empty($row['list_type'])) {\n $label = BackendUtility::getLabelFromItemListMerged($row['pid'], 'tt_content', 'list_type', $row['list_type']);\n if (!empty($label)) {\n $out .= $this->linkEditContent('<strong>' . htmlspecialchars($this->getLanguageService()->sL($label)) . '</strong>', $row) . '<br />';\n } else {\n $message = sprintf($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.noMatchingValue'), $row['list_type']);\n $out .= '<span class=\"label label-warning\">' . htmlspecialchars($message) . '</span>';\n }\n } else {\n $out .= '<strong>' . $this->getLanguageService()->getLL('noPluginSelected') . '</strong>';\n }\n $out .= htmlspecialchars($this->getLanguageService()->sL(\n BackendUtility::getLabelFromItemlist('tt_content', 'pages', $row['pages'])\n )) . '<br />';\n break;\n default:\n $contentType = $this->CType_labels[$row['CType']];\n if (!isset($contentType)) {\n $contentType = BackendUtility::getLabelFromItemListMerged($row['pid'], 'tt_content', 'CType', $row['CType']);\n }\n\n if ($contentType) {\n $out .= $this->linkEditContent('<strong>' . htmlspecialchars($contentType) . '</strong>', $row) . '<br />';\n if ($row['bodytext']) {\n $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';\n }\n if ($row['image']) {\n $out .= $this->linkEditContent($this->getThumbCodeUnlinked($row, 'tt_content', 'image'), $row) . '<br />';\n }\n } else {\n $message = sprintf(\n $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.noMatchingValue'),\n $row['CType']\n );\n $out .= '<span class=\"label label-warning\">' . htmlspecialchars($message) . '</span>';\n }\n }\n }\n // Wrap span-tags:\n $out = '\n\t\t\t<span class=\"exampleContent\">' . $out . '</span>';\n // Add header:\n $out = $outHeader . $out;\n // Return values:\n if ($this->isDisabled('tt_content', $row)) {\n return '<span class=\"text-muted\">' . $out . '</span>';\n }\n return $out;\n }", "static function showForItem(CommonDBTM $item, $withtemplate = 0) {\n if (!Session::haveRight($item::$rightname, READNOTE)) {\n return false;\n }\n $notes = static::getAllForItem($item);\n $rand = mt_rand();\n $canedit = Session::haveRight($item::$rightname, UPDATENOTE);\n\n $showuserlink = 0;\n if (User::canView()) {\n $showuserlink = 1;\n }\n\n if ($canedit\n && !(!empty($withtemplate) && ($withtemplate == 2))) {\n echo \"<div class='boxnote center'>\";\n\n echo \"<div class='boxnoteleft'></div>\";\n echo \"<form name='addnote_form$rand' id='addnote_form$rand' \";\n echo \" method='post' action='\".Toolbox::getItemTypeFormURL('Notepad').\"'>\";\n echo Html::hidden('itemtype', ['value' => $item->getType()]);\n echo Html::hidden('items_id', ['value' => $item->getID()]);\n\n echo \"<div class='boxnotecontent'>\";\n echo \"<div class='floatleft'>\";\n echo \"<textarea name='content' rows=5 cols=100></textarea>\";\n echo \"</div>\";\n echo \"</div>\"; // box notecontent\n\n echo \"<div class='boxnoteright'><br>\";\n echo Html::submit(_x('button', 'Add'), ['name' => 'add']);\n echo \"</div>\";\n\n Html::closeForm();\n echo \"</div>\"; // boxnote\n }\n\n if (count($notes)) {\n foreach ($notes as $note) {\n $id = 'note'.$note['id'].$rand;\n $classtoadd = '';\n if ($canedit) {\n $classtoadd = \" pointer\";\n }\n echo \"<div class='boxnote' id='view$id'>\";\n\n echo \"<div class='boxnoteleft'>\";\n echo \"<img class='user_picture_verysmall' alt=\\\"\".__s('Picture').\"\\\" src='\".\n User::getThumbnailURLForPicture($note['picture']).\"'>\";\n echo \"</div>\"; // boxnoteleft\n\n echo \"<div class='boxnotecontent'>\";\n\n echo \"<div class='boxnotefloatright'>\";\n $username = NOT_AVAILABLE;\n if ($note['users_id_lastupdater']) {\n $username = getUserName($note['users_id_lastupdater'], $showuserlink);\n }\n $update = sprintf(__('Last update by %1$s on %2$s'), $username,\n Html::convDateTime($note['date_mod']));\n $username = NOT_AVAILABLE;\n if ($note['users_id']) {\n $username = getUserName($note['users_id'], $showuserlink);\n }\n $create = sprintf(__('Create by %1$s on %2$s'), $username,\n Html::convDateTime($note['date']));\n printf(__('%1$s / %2$s'), $update, $create);\n echo \"</div>\"; // floatright\n\n echo \"<div class='boxnotetext $classtoadd' \";\n if ($canedit) {\n echo \"onclick=\\\"\".Html::jsHide(\"view$id\").\" \".\n Html::jsShow(\"edit$id\").\"\\\"\";\n }\n echo \">\";\n $content = nl2br($note['content']);\n if (empty($content)) {\n $content = NOT_AVAILABLE;\n }\n echo $content.'</div>'; // boxnotetext\n\n echo \"</div>\"; // boxnotecontent\n echo \"<div class='boxnoteright'>\";\n if ($canedit) {\n Html::showSimpleForm(Toolbox::getItemTypeFormURL('Notepad'),\n ['purge' => 'purge'],\n _x('button', 'Delete permanently'),\n ['id' => $note['id']],\n 'fa-times-circle',\n '',\n __('Confirm the final deletion?'));\n }\n echo \"</div>\"; // boxnoteright\n echo \"</div>\"; // boxnote\n\n if ($canedit) {\n echo \"<div class='boxnote starthidden' id='edit$id'>\";\n echo \"<form name='update_form$id$rand' id='update_form$id$rand' \";\n echo \" method='post' action='\".Toolbox::getItemTypeFormURL('Notepad').\"'>\";\n\n echo \"<div class='boxnoteleft'></div>\";\n echo \"<div class='boxnotecontent'>\";\n echo Html::hidden('id', ['value' => $note['id']]);\n echo \"<textarea name='content' rows=5 cols=100>\".$note['content'].\"</textarea>\";\n echo \"</div>\"; // boxnotecontent\n\n echo \"<div class='boxnoteright'><br>\";\n echo Html::submit(_x('button', 'Update'), ['name' => 'update']);\n echo \"</div>\"; // boxnoteright\n\n Html::closeForm();\n echo \"</div>\"; // boxnote\n }\n }\n }\n return true;\n }", "public function display()\n\t\t{\n\t\t\techo \"<table border=\\\"1\\\">\";\n\t\t\techo \"<tr><th>Artikel</th><th>Menge</th><th>Optionen</th></tr>\";\n\t\t\tforeach ($this->items as $art=>$qty)\n\t\t\t\techo \"<tr>\n\t\t\t\t\t\t<td>$art</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<form name='qtyForm' action='cart.php' method='get'>\n\t\t\t\t\t\t\t\t<input type='hidden' name='artChangeQty' value='$art'/>\n\t\t\t\t\t\t\t\t<input name='artQty' value='$qty'/>\n\t\t\t\t\t\t\t\t<input name='positive' type='submit' value='1' />\n\t\t\t\t\t\t\t\t<input name='negative' type='submit' value='-1' />\n\t\t\t\t\t\t\t\t<br/>\n\t\t\t\t\t\t\t\t<input type='submit' value='Ändern' />\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<form name='removeForm' action='cart.php' method='get'>\n\t\t\t\t\t\t\t\t<input type='hidden' name='artRemoveAll' value='$art'/>\n\t\t\t\t\t\t\t\t<input type='submit' value='Remove' />\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t </tr>\";\n\t\t\techo \"</table>\";\n\t\t}", "abstract protected function displayContent();", "public function display($terms, $items) {\r\n //display page header\r\n parent::displayHeader(\"Search Results\");\r\n ?>\r\n <div id=\"main-header\"> Search Results for <i><?= $terms ?></i></div>\r\n <span class=\"rcd-numbers\">\r\n <?php\r\n echo ((!is_array($items)) ? \"( 0 - 0 )\" : \"( 1 - \" . count($items) . \" )\");\r\n ?>\r\n </span>\r\n <hr>\r\n\r\n <!-- display all records in a grid -->\r\n <div class=\"grid-container\">\r\n <?php\r\n if ($items === 0) {\r\n echo \"No item was found.<br><br><br><br><br>\";\r\n } else {\r\n //displayitems in a grid; 4 items per row\r\n foreach ($items as $i => $item) {\r\n $item_id = $item->getItem_Id();\r\n $title = $item->getTitle();\r\n $image = $item->getImage();\r\n \r\n if (strpos($image, \"http://\") === false AND strpos($image, \"https://\") === false) {\r\n $image = BASE_URL . \"/\" . ITEM_IMG . $image;\r\n }\r\n if ($i % 4 == 0) {\r\n echo \"<div class='row'>\";\r\n }\r\n\r\n echo \"<div class='col'><p><a href='\" . BASE_URL . \"/item/detail/$item_id'><img src='\" . $image .\r\n \"'></a><span>$title<br>\" . \"</span></p></div>\";\r\n ?>\r\n <?php\r\n if ($i % 4 == 3 || $i == count($items) - 1) {\r\n echo \"</div>\";\r\n }\r\n }\r\n }\r\n ?> \r\n </div>\r\n <a href=\"<?= BASE_URL ?>/item/index\">Go to Items</a>\r\n <?php\r\n //display page footer\r\n parent::displayFooter();\r\n }", "function display()\n\t{\n\t\t// Initialize some variables\n\t\t$app\t= & $this->get( 'Application' );\n\t\t$user\t= & $app->getUser();\n\t\t$menu\t= & $this->get( 'Menu' );\n\t\t$doc\t= & $app->getDocument();\n\n\t\t$params\t = & $menu->parameters;\n\t\t$Itemid = $menu->id;\n\n\t\t$gid \t= $user->get('gid');\n\t\t$task \t= JRequest::getVar('task');\n\t\t$id \t= JRequest::getVar('id');\n\t\t$option = JRequest::getVar('option');\n\n\t\t// Lets get our data from the model\n\t\t$section\t\t= & $this->get( 'Section' );\n\t\t$categories\t= & $this->get( 'Categories' );\n\n\t\t//add alternate feed link\n\t\t$link = $mainframe->getBaseURL() .'feed.php?option=com_content&task='.$task.'&id='.$id;\n\t\t$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');\n\t\t$document->addHeadLink($link.'&type=rss', 'alternate', 'rel', $attribs);\n\t\t$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');\n\t\t$document->addHeadLink($link.'&type=atom', 'alternate', 'rel', $attribs);\n\n\t\t/*\n\t\t * Lets set the page title\n\t\t */\n\t\tif (!empty ($menu->name)) {\n\t\t\t$app->setPageTitle($menu->name);\n\t\t}\n\n\t\t/*\n\t\t * Handle BreadCrumbs\n\t\t */\n\t\t$breadcrumbs = & $app->getPathWay();\n\t\t$breadcrumbs->addItem($section->title, '');\n\n\t\tif ($params->get('page_title')) {\n\t\t?>\n\t\t\t<div class=\"componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>\">\n\t\t\t\t<?php echo $section->name; ?>\n\t\t\t</div>\n\t\t<?php\n\t\t}\n\t\t?>\n\t\t<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\" class=\"contentpane<?php echo $params->get( 'pageclass_sfx' ); ?>\">\n\t\t<tr>\n\t\t\t<td width=\"60%\" valign=\"top\" class=\"contentdescription<?php echo $params->get( 'pageclass_sfx' ); ?>\" colspan=\"2\">\n\t\t\t\t<?php\n\t\t\t\tif ($section->image) {\n\t\t\t\t\t$link = 'images/stories/'.$section->image;\n\t\t\t\t\t?>\n\t\t\t\t\t<img src=\"<?php echo $link;?>\" align=\"<?php echo $section->image_position;?>\" hspace=\"6\" alt=\"<?php echo $section->image;?>\" />\n\t\t\t\t\t<?php\n\t\t\t\t}\n\t\t\t\techo $section->description;\n\t\t\t\t?>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=\"2\">\n\t\t\t\t<?php\n\t\t\t\t// Displays listing of Categories\n\t\t\t\tif (count($categories) > 0) {\n\t\t\t\t\tif ($params->get('other_cat_section')) {\n\t\t\t\t\t\t$this->_buildCategories($categories, $params, $section->id);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t?>\n\t\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t<?php\n\t}", "function editItemType() {\n\t\tglobal $page;\n\t\tglobal $HTML;\n\t\t$HTML->details(1);\n\n\t\t$_ = '';\n\t\t$_ .= '<div class=\"c init:form form:action:'.$page->url.'\" id=\"container:itemtype\">';\n\t\t\t$_ .= $this->getTypeObject()->editItem();\n\t\t$_ .= '</div>';\n\n\t\treturn $_;\n\t}", "public function visualizar($id){\n\t\t$this->load->model('item');\n\t\t$row = $this->item->get_item($id);\n\t\t$data['row'] = $row[0];\n\t\t$data['title'] = 'Visualizar Item';\n\t\t$data['page'] = 'pages/internal/visualizar';\n\t\t$this->load->view('template',$data);\n\t}", "function item_page(item $item) {\n $item = DB::select(\"select * from item where id=$item->id\");\n return view('produit',['item'=>$item]);\n }", "function makeHideItem($info){\r\n\techo '<p class=\"h\">'.$info.'</p>';\r\n}", "function renderJSONitem () {\r\n\t\t$doc =& JFactory::getDocument();\r\n\t\t$doc->setMimeEncoding('application/json');\r\n\t\t\r\n\t\t$item = $this -> item;\r\n\t\t\r\n\t\t$url = trim(JURI::base(), \"/\") . JRoute::_(FlexicontentHelperRoute::getItemRoute($item -> slug, $item -> categoryslug));\r\n\t\t$json = array();\r\n\t\t$json['layout'] = 'item';\r\n\t\tif($this -> params -> get ('display_item_id', 1)) $json['id'] = $item -> id;\r\n\t\tif($this -> params -> get ('display_item_title', 1)) $json['title'] = $item -> title;\r\n\t\tif($this -> params -> get ('display_item_alias', 1)) $json['alias'] = $item -> alias;\r\n\t\tif($this -> params -> get ('display_item_author', 1)) $json['author'] = $item -> author;\r\n\t\tif($this -> params -> get ('display_item_description', 1)) $json['description'] = $item -> text;\r\n\t\tif($this -> params -> get ('display_item_created', 1)) $json['created'] = $item -> created;\r\n\t\tif($this -> params -> get ('display_item_modified', 1)) $json['modified'] = $item -> modified;\r\n\t\tif($this -> params -> get ('display_item_metadesc', 1)) $json['metadesc'] = $item -> metadesc;\r\n\t\tif($this -> params -> get ('display_item_metakey', 1)) $json['metakey'] = $item -> metakey;\r\n\t\tif($this -> params -> get ('display_item_url', 1)) $json['url'] = $url;\r\n\t\tif($this -> params -> get ('display_item_json', 1)) $json['json'] = $url . (strpos($url, '?') ? '&' : '?') . 'iclayout=' . JFactory::getApplication() -> input -> get('ilayout') . '&tmpl=' . JFactory::getApplication() -> input -> get('tmpl');\r\n\t\tif($this -> params -> get ('display_item_params', 0)) $json['params'] = json_decode($item -> params);\r\n\t\tif($this -> params -> get ('display_item_fields', 1)) {\r\n\t\t\t$fields = array();\r\n\t\t\tif(isset($item -> positions)) {\r\n\t\t\t\tforeach($item -> positions as $position) {\r\n\t\t\t\t\tforeach($position as $field) {\r\n\t\t\t\t\t\t$fields[$field -> name] = array();\r\n\t\t\t\t\t\tif($this -> params -> get ('display_item_field_label', 1)) $fields[$field -> name]['label'] = $field -> label;\r\n\t\t\t\t\t\tif($this -> params -> get ('display_item_field_value', 1)) $fields[$field -> name]['value'] = $item -> fields[$field -> name] -> iscore ? $item -> {$field -> name} : $item -> fieldvalues [$field -> id];\r\n\t\t\t\t\t\tif($this -> params -> get ('display_item_field_value', 1)) {\r\n\t\t\t\t\t\t\t$fields[$field -> name]['value'] = $item -> fields[$field -> name] -> iscore ? $item -> {$field -> name} : $item -> fieldvalues [$field -> id];\r\n\t\t\t\t\t\t\t// process serialized data in the value field into arrays\r\n\t\t\t\t\t\t\t$value = unserialize($fields[$field -> name]['value']);\r\n\t\t\t\t\t\t\tif($value) $fields[$field -> name]['value'] = $value;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif($this -> params -> get ('display_item_field_display', 1)) $fields[$field -> name]['display'] = $field -> display;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t$json['fields'] = $fields;\r\n\t\t}\r\n\t\t\r\n\t\tif (JFactory::getApplication() -> input -> get('callback', '') != '') {\r\n\t\t\treturn JFactory::getApplication() -> input -> get('callback') . '(' . json_encode($json) . ')';\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn json_encode($json);\r\n\t\t}\r\n\t\t\r\n\r\n\t}", "public function display()\n\t{\n\t\t// Initialise variables.\n\t\t$this->items\t\t= $this->get('Items');\n\t\t$this->pagination\t= $this->get('Pagination');\n\t\t$this->state\t\t= $this->get('State');\n\n\t\t// Check for errors.\n\t\tif (count($errors = $this->get('Errors'))) {\n\t\t\tJError::raiseError(500, implode(\"\\n\", $errors));\n\t\t\treturn false;\n\t\t}\n\n\t\t// Add the toolbar and display the view layout.\n\t\t$this->addToolbar();\n\t\tparent::display();\n\t}", "public function view_item(){\n\t\treturn view(mProvider::$view_prefix.mProvider::$view_prefix_priv.'stock_view');\n\t}", "public function detail($i)\n {\n $this->data['page_title'] = $i;\n $this->data['player-activity'] = $this->invidividual($i);\n $this->data['pagebody'] = '/portfolio';\n $this->render();\n }", "public function renderItems()\r\n {\r\n echo CHtml::openTag($this->itemsTagName,array('class'=>$this->itemsCssClass)).\"\\n\";\r\n $data=$this->dataProvider->getData();\r\n if(($n=count($data))>0)\r\n {\r\n /*\r\n * 原有实现在这里 已注释掉了\r\n $owner=$this->getOwner();\r\n $viewFile=$owner->getViewFile($this->itemView);\r\n $j=0;\r\n foreach($data as $i=>$item)\r\n {\r\n $data=$this->viewData;\r\n $data['index']=$i;\r\n $data['data']=$item;\r\n $data['widget']=$this;\r\n $owner->renderFile($viewFile,$data);\r\n if($j++ < $n-1)\r\n echo $this->separator;\r\n }\r\n */\r\n\r\n $j=0;\r\n foreach($data as $i=>$item)\r\n {\r\n $data=$this->viewData;\r\n $data['index']=$i;\r\n $data['data']=$item;\r\n $data['widget']=$this;\r\n\r\n if(is_string($this->itemRender)){\r\n call_user_func($this->itemRender,$data);\r\n } elseif(is_callable($this->itemRender,true)) {\r\n if(is_array($this->itemRender))\r\n {\r\n // an array: 0 - object, 1 - method name\r\n list($object,$method)=$this->itemRender;\r\n if(is_string($object))\t// static method call\r\n call_user_func($this->itemRender,$data);\r\n elseif(method_exists($object,$method))\r\n $object->$method($data);\r\n else\r\n throw new CException(Yii::t('yii','Event \"{class}\" is attached with an invalid itemRender \"{handler}\".',\r\n array('{class}'=>get_class($this), '{handler}'=>$this->itemRender[1])));\r\n }\r\n else // PHP 5.3: anonymous function\r\n call_user_func($this->itemRender,$data);\r\n }\r\n\r\n if($j++ < $n-1){\r\n echo $this->separator;\r\n }\r\n }\r\n\r\n }\r\n else\r\n $this->renderEmptyText();\r\n echo CHtml::closeTag($this->itemsTagName);\r\n }", "function ShowItem($class, $ParamArr = array())\r\n\t{\r\n\t\tglobal $member_id, $metatags;\r\n\t\t\r\n\t\tif(isset($_GET['id'])&&$_GET['id']!=\"\")\r\n\t\t{\r\n\t\t\t$IId = $_GET['id'];\r\n\t\t\t$Items = $this->GetRecord($class, $IId);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$MesData = \"Неправильный запрос вы будете перенаправлены на главну страницу <br /><a href=\\\"\".$this->GetLinkTag(\"main\").\"\\\">На главную</a>\";\t\r\n\t\t\treturn $this->MakeTemplate($this->templates['message'], array(\"msg\"=>$MesData), \"content\");\r\n\t\t}\r\n\t\t\r\n\t\t$CurItem = $Items[0];\r\n\t\tif(isset($CurItem['id'])&&$CurItem['id']!=\"\")\r\n\t\t{\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$MesData = \"Неправильный запрос вы будете перенаправлены на главну страницу <br /><a href=\\\"\".$this->GetLinkTag(\"main\").\"\\\">На главную</a>\";\t\r\n\t\t\treturn $this->MakeTemplate($this->templates['message'], array(\"msg\"=>$MesData), \"content\");\r\n\t\t}\r\n\t\t$metatags['title'] \t= $CurItem['title'].\" :: \".$this->MyConfig['title']['value'];\r\n\t\tif(isset($CurItem['description']))\r\n\t\t{\r\n\t\t\t$metatags['description'] \t= $CurItem['description'];\r\n\t\t}\t\r\n\t\t$ArrVar = array();\r\n\t\t\r\n\t\t$ArrVar['breadcrumbs'] = $this->GenerateCrumbs($class, $CurItem);\r\n\t\t\r\n\t\t//$ArrVar = $this->ShowComments($CurItem);\r\n\t\tforeach($CurItem as $key=>$value)\r\n\t\t{\r\n\t\t\t$CurItem[$key] = $this->GetTrueValue($value, $this->MyClasses[$class]['db'][$key]);\r\n\t\t\t$CurItem[$key.\"_raw\"] = $value;\r\n\t\t\tif($this->MyClasses[$class]['db'][$key]==\"img\")\r\n\t\t\t{\r\n\t\t\t\t$CurItem[\"\".$key.\"_thumb\"] = $this->GetTrueValue($value, $this->MyClasses[$class]['db'][$key].\"_thumb\");\r\n\t\t\t\t$CurItem[\"\".$key.\"_thumb_raw\"] = $this->GetTrueValue($value, $this->MyClasses[$class]['db'][$key].\"_thumb_raw\");\r\n\t\t\t\t$CurItem[\"\".$key.\"_raw\"] = $this->GetTrueValue($value, $this->MyClasses[$class]['db'][$key].\"_raw\");\r\n\t\t\t\t$CurItem[\"\".$key.\"_complete\"] = $this->GetTrueValue($value, $this->MyClasses[$class]['db'][$key].\"_complete\");\r\n\t\t\t}\r\n\t\t\tif($this->MyClasses[$class]['db'][$key]==\"unlimg\")\r\n\t\t\t{\r\n\t\t\t\t$CurItem[\"\".$key.\"_thumb\"] = $this->GetTrueValue($value, $this->MyClasses[$class]['db'][$key].\"_thumb\");\r\n\t\t\t\t$CurItem[\"\".$key.\"_complete\"] = $this->GetTrueValue($value, $this->MyClasses[$class]['db'][$key].\"_complete\");\r\n\t\t\t}\r\n\t\t\tif($this->MyClasses[$class]['db'][$key]==\"multifield\")\r\n\t\t\t{\r\n\t\t\t\t$ArrFields = $this->GetTrueValue($value, $this->MyClasses[$class]['db'][$key]);\r\n\t\t\t\tforeach($ArrFields as $gre=>$fee)\r\n\t\t\t\t{\r\n\t\t\t\t\t$CurItem[\"\".$gre.\"\"] = $fee;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(isset($this->MyClasses[$class]['commcl'])&&$this->MyClasses[$class]['commcl']!=\"\")\r\n\t\t{\r\n\t\t\tif(isset($CurItem['commpub'])&&$CurItem['commpub']==$this->GetLangVar(\"checkbox_yes\"))\r\n\t\t\t{\r\n\t\t\t\t$CurItem['comments'] = $this->ShowComments($class, $CurItem['id']);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$CurItem['comments'] = \"\";\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$CurItem['comments'] = \"\";\r\n\t\t}\r\n\t\tif($member_id['user_group']==\"1\")\r\n\t\t{\r\n\t\t\t$CurItem[\"adm_links\"] = \"<a href=\\\"\".$this->GetLink($class, \"edit\", array(\"id\"=>$IId)).\"\\\">\".$this->GetLangVar(\"Edit\").\"</a> | <a href=\\\"\".$this->GetLink($class, \"delete\", array(\"id\"=>$IId)).\"\\\">\".$this->GetLangVar(\"Delete\").\"</a>\";\r\n\t\t\tif(isset($this->ModerSets[''.$class.'']))\r\n\t\t\t{\r\n\t\t\t\t// moderation links go here\r\n\t\t\t\tif($CurItem['published']==\"1\")\r\n\t\t\t\t{\r\n\t\t\t\t\t$CurItem[\"adm_links\"] .= \" | <a href=\\\"\".$this->GetLink($class, \"unpublish\", array(\"id\"=>$IId)).\"\\\">\".$this->GetLangVar(\"unpubl\").\"</a>\"; \r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t$CurItem[\"adm_links\"] .= \" | <a href=\\\"\".$this->GetLink($class, \"publish\", array(\"id\"=>$IId)).\"\\\">\".$this->GetLangVar(\"publ\").\"</a>\";\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$CurItem[\"adm_links\"] = \"\";\r\n\t\t}\r\n\t\t$ArrVar = array_merge($ArrVar, $CurItem);\r\n\t\t$PlugDataArr = array();\r\n\t\tforeach($this->Plugins as $key=>$value)\r\n\t\t{\r\n\t\t\t$PlugDataArr = $this->LoadPlugin($key, \"ShowFull\", $ArrVar);\r\n\t\t}\r\n\t\t$ArrVar = array_merge($ArrVar, $PlugDataArr);\r\n\t\t\r\n\t\tif(isset($ParamArr['tpl']))\r\n\t\t{\r\n\t\t\t$TemplateLoad = $ParamArr['tpl'];\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$TemplateLoad = $this->MyClasses[$class]['tpl']['full'];\r\n\t\t}\r\n\t\t\t\r\n\t\t//$ArrVar = array_merge($ArrVar, $this->GetAdminLinks($class, \"ShowItem\"));\r\n\t\treturn $this->MakeTemplate($TemplateLoad, $ArrVar, \"content\");\r\n\t}", "public function items()\n {\n $projects = new Item();\n $projects->select(\"*\")->select_func(\"DATE_FORMAT\", array(\"@create_date\", '[,]', '%d/%m/%Y'), 'create_date')\n ->where(array('type' => 1, 'status' => 0))\n ->order_by('create_date', 'desc')\n ->get();\n\n $breadcrumb = array(\n 'Home' => site_url('admin'),\n 'Curadoria' => \"#\",\n 'Projetos' => site_url('admin/curadoria/items')\n );\n\n $this->load->helper('html');\n\n $toview['items'] = $projects;\n\n $this->template->set_breadcrumb($breadcrumb);\n $this->template->load('admin', 'admin/curadoria/items', $toview);\n }", "function showItems() {\n global $DB;\n\n $budgets_id = $this->fields['id'];\n\n if (!$this->can($budgets_id, READ)) {\n return false;\n }\n\n $iterator = $DB->request([\n 'SELECT' => 'itemtype',\n 'DISTINCT' => true,\n 'FROM' => 'glpi_infocoms',\n 'WHERE' => [\n 'budgets_id' => $budgets_id,\n 'NOT' => ['itemtype' => ['ConsumableItem', 'CartridgeItem', 'Software']]\n ],\n 'ORDER' => 'itemtype'\n ]);\n\n $number = count($iterator);\n\n echo \"<div class='spaced'><table class='tab_cadre_fixe'>\";\n echo \"<tr><th colspan='2'>\";\n Html::printPagerForm();\n echo \"</th><th colspan='4'>\";\n if ($number == 0) {\n echo __('No associated item');\n } else {\n echo _n('Associated item', 'Associated items', $number);\n }\n echo \"</th></tr>\";\n\n echo \"<tr><th>\".__('Type').\"</th>\";\n echo \"<th>\".__('Entity').\"</th>\";\n echo \"<th>\".__('Name').\"</th>\";\n echo \"<th>\".__('Serial number').\"</th>\";\n echo \"<th>\".__('Inventory number').\"</th>\";\n echo \"<th>\"._x('price', 'Value').\"</th>\";\n echo \"</tr>\";\n\n $num = 0;\n $itemtypes = [];\n while ($row = $iterator->next()) {\n $itemtypes[] = $row['itemtype'];\n }\n $itemtypes[] = 'Contract';\n $itemtypes[] = 'Ticket';\n $itemtypes[] = 'Problem';\n $itemtypes[] = 'Change';\n $itemtypes[] = 'Project';\n\n foreach ($itemtypes as $itemtype) {\n if (!($item = getItemForItemtype($itemtype))) {\n continue;\n }\n\n if ($item->canView()) {\n switch ($itemtype) {\n\n case 'Contract' :\n $criteria = [\n 'SELECT' => [\n $item->getTable() . '.id',\n $item->getTable() . '.entities_id',\n 'SUM' => 'glpi_contractcosts.cost AS value'\n ],\n 'FROM' => 'glpi_contractcosts',\n 'INNER JOIN' => [\n $item->getTable() => [\n 'ON' => [\n $item->getTable() => 'id',\n 'glpi_contractcosts' => 'contracts_id'\n ]\n ]\n ],\n 'WHERE' => [\n 'glpi_contractcosts.budgets_id' => $budgets_id,\n $item->getTable() . '.is_template' => 0\n ] + getEntitiesRestrictCriteria($item->getTable()),\n 'GROUPBY' => [\n $item->getTable() . '.id',\n $item->getTable() . '.entities_id'\n ],\n 'ORDERBY' => [\n $item->getTable() . '.entities_id',\n $item->getTable() . '.name'\n ]\n ];\n break;\n\n case 'Ticket' :\n case 'Problem' :\n case 'Change' :\n $costtable = getTableForItemType($item->getType().'Cost');\n\n $sum = new QueryExpression(\n \"SUM(\" . $DB->quoteName(\"$costtable.actiontime\") . \" * \" . $DB->quoteName(\"$costtable.cost_time\") . \"/\".HOUR_TIMESTAMP.\"\n + \" . $DB->quoteName(\"$costtable.cost_fixed\") . \"\n + \" . $DB->quoteName(\"$costtable.cost_material\") . \") AS \" . $DB->quoteName('value')\n );\n $criteria = [\n 'SELECT' => [\n $item->getTable() . '.id',\n $item->getTable() . '.entities_id',\n $sum\n ],\n 'FROM' => $costtable,\n 'INNER JOIN' => [\n $item->getTable() => [\n 'ON' => [\n $item->getTable() => 'id',\n $costtable => $item->getForeignKeyField()\n ]\n ]\n ],\n 'WHERE' => [\n $costtable . '.budgets_id' => $budgets_id\n ] + getEntitiesRestrictCriteria($item->getTable()),\n 'GROUPBY' => [\n $item->getTable() . '.id',\n $item->getTable() . '.entities_id'\n ],\n 'ORDERBY' => [\n $item->getTable() . '.entities_id',\n $item->getTable() . '.name'\n ]\n ];\n break;\n\n case 'Project' :\n $criteria = [\n 'SELECT' => [\n $item->getTable() . '.id',\n $item->getTable() . '.entities_id',\n 'SUM' => 'glpi_projectcosts.cost AS value'\n ],\n 'FROM' => 'glpi_projectcosts',\n 'INNER JOIN' => [\n $item->getTable() => [\n 'ON' => [\n $item->getTable() => 'id',\n 'glpi_projectcosts' => 'projects_id'\n ]\n ]\n ],\n 'WHERE' => [\n 'glpi_projectcosts.budgets_id' => $budgets_id\n ] + getEntitiesRestrictCriteria($item->getTable()),\n 'GROUPBY' => [\n $item->getTable() . '.id',\n $item->getTable() . '.entities_id'\n ],\n 'ORDERBY' => [\n $item->getTable() . '.entities_id',\n $item->getTable() . '.name'\n ]\n ];\n break;\n\n case 'Cartridge' :\n $criteria = [\n 'SELECT' => [\n $item->getTable() . '.*',\n 'glpi_cartridgeitems.name',\n 'glpi_infocoms.value'\n ],\n 'FROM' => 'glpi_infocoms',\n 'INNER JOIN' => [\n $item->getTable() => [\n 'ON' => [\n $item->getTable() => 'id',\n 'glpi_infocoms' => 'items_id'\n ]\n ],\n 'glpi_cartridgeitems' => [\n 'ON' => [\n $item->getTable() => 'cartridgeitems_id',\n 'glpi_cartridgeitems' => 'id'\n ]\n ]\n ],\n 'WHERE' => [\n 'glpi_infocoms.itemtype' => $itemtype,\n 'glpi_infocoms.budgets_id' => $budgets_id\n ] + getEntitiesRestrictCriteria($item->getTable()),\n 'ORDERBY' => [\n 'entities_id',\n 'glpi_cartridgeitems.name'\n ]\n ];\n break;\n\n case 'Consumable' :\n $criteria = [\n 'SELECT' => [\n $item->getTable() . '.*',\n 'glpi_consumableitems.name',\n 'glpi_infocoms.value'\n ],\n 'FROM' => 'glpi_infocoms',\n 'INNER JOIN' => [\n $item->getTable() => [\n 'ON' => [\n $item->getTable() => 'id',\n 'glpi_infocoms' => 'items_id'\n ]\n ],\n 'glpi_consumableitems' => [\n 'ON' => [\n $item->getTable() => 'consumableitems_id',\n 'glpi_consumableitems' => 'id'\n ]\n ]\n ],\n 'WHERE' => [\n 'glpi_infocoms.itemtype' => $itemtype,\n 'glpi_infocoms.budgets_id' => $budgets_id\n ] + getEntitiesRestrictCriteria($item->getTable()),\n 'ORDERBY' => [\n 'entities_id',\n 'glpi_cartridgeitems.name'\n ]\n ];\n break;\n\n default:\n $criteria = [\n 'SELECT' => [\n $item->getTable() . '.*',\n 'glpi_infocoms.value',\n ],\n 'FROM' => 'glpi_infocoms',\n 'INNER JOIN' => [\n $item->getTable() => [\n 'ON' => [\n $item->getTable() => 'id',\n 'glpi_infocoms' => 'items_id'\n ]\n ]\n ],\n 'WHERE' => [\n 'glpi_infocoms.itemtype' => $itemtype,\n 'glpi_infocoms.budgets_id' => $budgets_id\n ] + getEntitiesRestrictCriteria($item->getTable()),\n 'ORDERBY' => [\n $item->getTable() . '.entities_id'\n ]\n ];\n if ($item->maybeTemplate()) {\n $criteria['WHERE'][$item->getTable() . '.is_template'] = 0;\n }\n\n if ($item instanceof Item_Devices) {\n $criteria['ORDERBY'][] = $item->getTable() .'.itemtype';\n } else {\n $criteria['ORDERBY'][] = $item->getTable() . '.name';\n }\n break;\n }\n\n $iterator = $DB->request($criteria);\n $nb = count($iterator);\n if ($nb > $_SESSION['glpilist_limit']) {\n echo \"<tr class='tab_bg_1'>\";\n $name = $item->getTypeName($nb);\n //TRANS: %1$s is a name, %2$s is a number\n echo \"<td class='center'>\".sprintf(__('%1$s: %2$s'), $name, $nb).\"</td>\";\n echo \"<td class='center' colspan='2'>\";\n\n $opt = ['order' => 'ASC',\n 'is_deleted' => 0,\n 'reset' => 'reset',\n 'start' => 0,\n 'sort' => 80,\n 'criteria' => [0 => ['value' => '$$$$'.$budgets_id,\n 'searchtype' => 'contains',\n 'field' => 50]]];\n\n echo \"<a href='\". $item->getSearchURL() . \"?\" .Toolbox::append_params($opt). \"'>\".\n __('Device list').\"</a></td>\";\n echo \"<td class='center'>-</td><td class='center'>-</td><td class='center'>-\".\n \"</td></tr>\";\n\n } else if ($nb) {\n for ($prem=true; $data = $iterator->next(); $prem=false) {\n $name = NOT_AVAILABLE;\n if ($item->getFromDB($data[\"id\"])) {\n if ($item instanceof Item_Devices) {\n $tmpitem = new $item::$itemtype_2();\n if ($tmpitem->getFromDB($data[$item::$items_id_2])) {\n $name = $tmpitem->getLink(['additional' => true]);\n }\n } else {\n $name = $item->getLink(['additional' => true]);\n }\n }\n echo \"<tr class='tab_bg_1'>\";\n if ($prem) {\n $typename = $item->getTypeName($nb);\n echo \"<td class='center top' rowspan='$nb'>\".\n ($nb>1 ? sprintf(__('%1$s: %2$s'), $typename, $nb) : $typename).\"</td>\";\n }\n echo \"<td class='center'>\".Dropdown::getDropdownName(\"glpi_entities\",\n $data[\"entities_id\"]);\n echo \"</td><td class='center\";\n echo (isset($data['is_deleted']) && $data['is_deleted'] ? \" tab_bg_2_2'\" : \"'\");\n echo \">\".$name.\"</td>\";\n echo \"<td class='center'>\".(isset($data[\"serial\"])? \"\".$data[\"serial\"].\"\" :\"-\");\n echo \"</td>\";\n echo \"<td class='center'>\".\n (isset($data[\"otherserial\"])? \"\".$data[\"otherserial\"].\"\" :\"-\").\"</td>\";\n echo \"<td class='center'>\".\n (isset($data[\"value\"]) ? \"\".Html::formatNumber($data[\"value\"], true).\"\"\n :\"-\");\n\n echo \"</td></tr>\";\n }\n }\n $num += $nb;\n }\n }\n\n if ($num>0) {\n echo \"<tr class='tab_bg_2'>\";\n echo \"<td class='center b'>\".sprintf(__('%1$s = %2$s'), __('Total'), $num).\"</td>\";\n echo \"<td colspan='5'>&nbsp;</td></tr> \";\n }\n echo \"</table></div>\";\n }", "private function items_category($page_name, $showroom, $category_id)\n {\n # get the parent to determine the view.\n if(!is_object($showroom))\n $showroom = ORM::factory('showroom', $showroom);\n \n # get the category \n $category = ORM::factory('showroom_cat')\n ->where(array(\n 'fk_site' => $this->site_id,\n 'showroom_id' => $showroom->id,\n ))\n ->find($category_id);\n if(!$category->loaded)\n return '<div class=\"not_found\">Invalid category</div>';\n \n # get any sub categories ...\n $sub_cats = ORM::factory('showroom_cat')\n ->where(array(\n 'fk_site' => $this->site_id,\n 'showroom_id' => $showroom->id,\n 'lft >=' => \"$category->lft\",\n 'lft <=' => \"$category->rgt\",\n ))\n ->find_all();\n \n # create array from the cat and sub_cats\n $cat_ids = array();\n foreach($sub_cats as $cat)\n $cat_ids[] = $cat->id;\n \n # get all the items.\n $items = ORM::factory('showroom_cat_item')\n ->where(array(\n 'fk_site' => $this->site_id,\n ))\n ->in('showroom_cat_id', $cat_ids)\n ->find_all();\n if(0 == $items->count())\n return '<div class=\"not_found\">No items. Check back soon!</div>';\n \n $view = new View(\"public_showroom/display/$showroom->view\");\n \n # do view stuff\n if('gallery' == $showroom->view)\n {\n # request javascript file\n $view->request_js_files('lightbox/lightbox.js');\n # parse the params.\n $params = explode('|',$showroom->params);\n $view->columns = (isset($params[1]) AND is_numeric($params[1]))\n ? $params[1]\n : 2;\n $view->thumb_size = (isset($params[2]) AND is_numeric($params[2]))\n ? $params[2]\n : 75;\n }\n\n # get the path to this category\n $path = ORM::factory('showroom_cat')\n ->where(array(\n 'fk_site' => $this->site_id,\n 'showroom_id' => $showroom->id,\n 'lft <' => $category->lft,\n 'rgt >' => $category->rgt,\n 'local_parent !='=> 0\n ))\n ->orderby(array('lft' => 'asc'))\n ->find_all();\n \n $view->path = $path;\n $view->category = $category;\n $view->sub_categories = Tree::display_tree('showroom', $sub_cats, $page_name);\n $view->page_name = $page_name;\n $view->img_path = $this->assets->assets_url();\n $view->items = $items;\n return $view;\n }", "public function extendedcardread()\n {\n $id_item = $this->request->getParameter(\"id\");\n $item = $this->item->getItem($id_item);\n $categories = $this->category->getCategories();\n $id_category = $item['catid'];\n $category = $this->category->getCategory($id_category);\n $links = $this->link->getLinks($id_item);\n $this->generateadminView(array(\n 'item' => $item,\n 'category' => $category,\n 'categories' => $categories,\n 'links' => $links\n ));\n }", "public function loadPageTitle()\n \t\t{\n echo \"<title>Add Item</title>\";\n }", "public function show($id)\n {\n $item = $this->itemCRUD->find_item($id);\n\n\n $this->load->view('theme/header');\n $this->load->view('itemCRUD/show',array('item'=>$item));\n $this->load->view('theme/footer');\n }", "public function detailAction() {\n\n //GET THE LIST ITEM\n $this->view->listDetail = Engine_Api::_()->getItem('list_listing',(int) $this->_getParam('id'));\n }", "public function onDisplayField(&$field, &$item)\n\t{\n\t\tif (!in_array($field->field_type, static::$field_types)) return;\n\n\t\t$field->label = $field->parameters->get('label_form') ? JText::_($field->parameters->get('label_form')) : JText::_($field->label);\n\n\t\t// Set field and item objects\n\t\t$this->setField($field);\n\t\t$this->setItem($item);\n\n\t\t$use_ingroup = $field->parameters->get('use_ingroup', 0);\n\t\tif (!isset($field->formhidden_grp)) $field->formhidden_grp = $field->formhidden;\n\t\tif ($use_ingroup) $field->formhidden = 3;\n\t\tif ($use_ingroup && empty($field->ingroup)) return;\n\n\n\t\t/**\n\t\t * Case of autorelated item\n\t\t */\n\n\t\tif (Factory::getApplication()->input->get('autorelation_' . $field->id, 0, 'int'))\n\t\t{\n\t\t\t$field->html = '<div class=\"alert alert-warning\">' . $field->label . ': ' . 'You can not auto-relate items using a relation field, please add a relation reverse field, and select to reverse this field</div>';\n\n\t\t\treturn;\n\t\t}\n\n\t\t// Initialize framework objects and other variables\n\t\t$document = Factory::getDocument();\n\t\t$cparams = JComponentHelper::getParams('com_flexicontent');\n\t\t$app = Factory::getApplication();\n\t\t$db = Factory::getDbo();\n\t\t$user = Factory::getUser();\n\n\t\t$tooltip_class = 'hasTooltip';\n\t\t$add_on_class = $cparams->get('bootstrap_ver', 2) == 2 ? 'add-on' : 'input-group-addon';\n\t\t$input_grp_class = $cparams->get('bootstrap_ver', 2) == 2 ? 'input-append input-prepend' : 'input-group';\n\t\t$form_font_icons = $cparams->get('form_font_icons', 1);\n\t\t$font_icon_class = $form_font_icons ? ' fcfont-icon' : '';\n\t\t$font_icon_class .= FLEXI_J40GE ? ' icon icon- ' : '';\n\n\n\t\t/**\n\t\t * Number of values\n\t\t */\n\n\t\t$multiple = $use_ingroup || (int) $field->parameters->get('allow_multiple', 0);\n\t\t$max_values = $use_ingroup ? 0 : (int) $field->parameters->get('max_values', 0);\n\t\t$required = (int) $field->parameters->get('required', 0);\n\t\t$add_position = (int) $field->parameters->get('add_position', 3);\n\n\t\t// Classes for marking field required\n\t\t$required_class = $required ? ' required' : '';\n\n\t\t// If we are multi-value and not inside fieldgroup then add the control buttons (move, delete, add before/after)\n\t\t$add_ctrl_btns = !$use_ingroup && $multiple;\n\t\t$fields_box_placing = (int) $field->parameters->get('fields_box_placing', 0);\n\n\n\t\t/**\n\t\t * Value handling\n\t\t */\n\n\t\t// Default value(s)\n\t\t$default_values = $this->getDefaultValues($isform = true, $_translate = false, $_split = ',');\n\t\t//$default_value = reset($default_values);\n\n\n\t\t/**\n\t\t * Form field display parameters\n\t\t */\n\n\t\t$size = (int) $field->parameters->get('size', 12);\n\t\t$prepend_item_state = $field->parameters->get('itemselector_prepend_item_state', 0);\n\t\t$maxtitlechars = $field->parameters->get('maxtitlechars', 40);\n\t\t$selected_items_label = $field->parameters->get('selected_items_label', 'FLEXI_RIFLD_SELECTED_ITEMS_LABEL');\n\t\t$selected_items_sortable = $field->parameters->get('selected_items_sortable', 0);\n\n\t\t// Create extra HTML TAG parameters for the form field\n\t\t$classes = 'use_select2_lib fc_select2_no_check fc_select2_noselect'\n\t\t\t. $required_class\n\t\t\t. ($selected_items_sortable ? ' fc_select2_sortable' : '');\n\t\t$attribs = ''\n\t\t\t. ($size ? ' size=\"' . $size . '\" ' : '');\n\n\t\t// Attribute for default value(s)\n\t\tif (!empty($default_values))\n\t\t{\n\t\t\t$attribs .= ' data-defvals=\"' . htmlspecialchars(implode('|||', $default_values), ENT_COMPAT, 'UTF-8') . '\" ';\n\t\t}\n\n\n\t\t// Initialise property with default value\n\t\tif (!$field->value || (count($field->value) === 1 && reset($field->value) === null))\n\t\t{\n\t\t\t$field->value = $default_values;\n\t\t}\n\n\t\t// CSS classes of value container\n\t\t$value_classes = 'fcfieldval_container valuebox fcfieldval_container_' . $field->id;\n\t\t$value_classes .= $fields_box_placing ? ' floated' : '';\n\n\t\t// Field name and HTML TAG id\n\t\t$valueholder_nm = 'custom[_fcfield_valueholder_][' . $field->name . ']';\n\t\t$valueholder_id = 'custom__fcfield_valueholder__' . $field->name;\n\t\t$fieldname = 'custom[' . $field->name . ']';\n\t\t$elementid = 'custom_' . $field->name;\n\n\t\t// JS safe Field name\n\t\t$field_name_js = str_replace('-', '_', $field->name);\n\n\n\t\t/**\n\t\t * Create category tree to use for creating the category selector\n\t\t */\n\n\t\t// Get categories without filtering\n\t\trequire_once(JPATH_ROOT . DS . \"components\" . DS . \"com_flexicontent\" . DS . \"classes\" . DS . \"flexicontent.categories.php\");\n\t\t$tree = flexicontent_cats::getCategoriesTree();\n\n\t\t// Get allowed categories\n\t\t$allowed_cats = $this->getAllowedCategories($field);\n\t\tif (empty($allowed_cats))\n\t\t{\n\t\t\t$field->html = JText::_('FLEXI_CANNOT_EDIT_FIELD') . ': <br/> ' . JText::_('FLEXI_NO_ACCESS_TO_USE_CONFIGURED_CATEGORIES');\n\n\t\t\treturn;\n\t\t}\n\n\t\t// Add categories that will be used by the category selector\n\t\t$allowedtree = array();\n\t\tforeach ($allowed_cats as $catid)\n\t\t{\n\t\t\t$allowedtree[$catid] = $tree[$catid];\n\t\t}\n\n\n\t\t// JS & CSS of current field\n\t\t$js = '';\n\t\t$css = '';\n\n\t\t// Handle multiple records\n\t\tif ($multiple)\n\t\t{\n\t\t\t// Add the drag and drop sorting feature\n\t\t\tif ($add_ctrl_btns) $js .= \"\n\t\t\tjQuery(document).ready(function(){\n\t\t\t\tjQuery('#sortables_\" . $field->id . \"').sortable({\n\t\t\t\t\thandle: '.fcfield-drag-handle',\n\t\t\t\t\tcancel: false,\n\t\t\t\t\t/*containment: 'parent',*/\n\t\t\t\t\ttolerance: 'pointer'\n\t\t\t\t\t\" . ($fields_box_placing ? \"\n\t\t\t\t\t,start: function(e) {\n\t\t\t\t\t\t//jQuery(e.target).children().css('float', 'left');\n\t\t\t\t\t\t//fc_setEqualHeights(jQuery(e.target), 0);\n\t\t\t\t\t}\n\t\t\t\t\t,stop: function(e) {\n\t\t\t\t\t\t//jQuery(e.target).children().css({'float': 'none', 'min-height': '', 'height': ''});\n\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\n\t\t\tif ($max_values) JText::script(\"FLEXI_FIELD_MAX_ALLOWED_VALUES_REACHED\", true);\n\t\t\t$js .= \"\n\t\t\tfunction addField\" . $field->id . \"(el, groupval_box, fieldval_box, params)\n\t\t\t{\n\t\t\t\tvar insert_before = (typeof params!== 'undefined' && typeof params.insert_before !== 'undefined') ? params.insert_before : 0;\n\t\t\t\tvar remove_previous = (typeof params!== 'undefined' && typeof params.remove_previous !== 'undefined') ? params.remove_previous : 0;\n\t\t\t\tvar scroll_visible = (typeof params!== 'undefined' && typeof params.scroll_visible !== 'undefined') ? params.scroll_visible : 1;\n\t\t\t\tvar animate_visible = (typeof params!== 'undefined' && typeof params.animate_visible !== 'undefined') ? params.animate_visible : 1;\n\n\t\t\t\tif(!remove_previous && (rowCount\" . $field->id . \" >= maxValues\" . $field->id . \") && (maxValues\" . $field->id . \" != 0)) {\n\t\t\t\t\talert(Joomla.JText._('FLEXI_FIELD_MAX_ALLOWED_VALUES_REACHED') + maxValues\" . $field->id . \");\n\t\t\t\t\treturn 'cancel';\n\t\t\t\t}\n\n\t\t\t\t// Find last container of fields and clone it to create a new container of fields\n\t\t\t\tvar lastField = fieldval_box ? fieldval_box : jQuery(el).prev().children().last();\n\t\t\t\tvar newField = lastField.clone();\n\t\t\t\tnewField.find('.fc-has-value').removeClass('fc-has-value');\n\n\t\t\t\t// New element's field name and id\n\t\t\t\tvar uniqueRowN = uniqueRowNum\" . $field->id . \";\n\t\t\t\tvar element_id = '\" . $elementid . \"_' + uniqueRowN;\n\t\t\t\tvar fname_pfx = '\" . $fieldname . \"[' + uniqueRowN + ']';\n\t\t\t\t\";\n\n\t\t\t// NOTE: HTML tag id of this form element needs to match the -for- attribute of label HTML tag of this FLEXIcontent field, so that label will be marked invalid when needed\n\t\t\t$js .= \"\n\t\t\t\t// Update container\n\t\t\t\tvar elem= newField.find('div.fcfield-relation-value_box').first();\n\t\t\t\telem.attr('data-elementid', element_id);\n\n\t\t\t\t// Update the category selector field\n\t\t\t\tvar elem= newField.find('select.fcfield-relation-cat_selector').first();\n\t\t\t\tvar defvals = elem.attr('data-defvals');\n\t\t\t\tif ( defvals && defvals.length )\n\t\t\t\t{\n\t\t\t\t\tjQuery.each(defvals.split('|||'), function(i, val){\n\t\t\t\t\t\telem.find('option[value=\\\"' + val + '\\\"]').attr('selected', 'selected');\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse elem.val('');\n\t\t\t\telem.attr('name', element_id + '_cat_selector');\n\t\t\t\telem.attr('id', element_id + '_cat_selector');\n\n\t\t\t\t// Update the items selector field\n\t\t\t\tvar elem= newField.find('select.fcfield-relation-item_selector').first();\n\t\t\t\telem.empty();\n\t\t\t\telem.attr('name', element_id + '_item_selector');\n\t\t\t\telem.attr('id', element_id + '_item_selector');\n\n\t\t\t\t// Update the value field\n\t\t\t\tvar elem= newField.find('select.fcfield-relation-selected_items').first();\n\t\t\t\telem.empty();\n\t\t\t\telem.attr('name', fname_pfx + '[]');\n\t\t\t\telem.attr('id', element_id);\n\n\t\t\t\tnewField.find('label.cat_selector-lbl').attr('for', element_id + '_cat_selector');\n\t\t\t\tnewField.find('label.item_selector-lbl').attr('for', element_id + '_item_selector');\n\t\t\t\tnewField.find('label.selected_items-lbl').attr('for', element_id);\n\n\t\t\t\tnewField.find('label.cat_selector-lbl').attr('id', element_id + '_cat_selector-lbl');\n\t\t\t\tnewField.find('label.item_selector-lbl').attr('id', element_id + '_item_selector-lbl');\n\t\t\t\tnewField.find('label.selected_items-lbl').attr('id', element_id + '-lbl');\n\n\t\t\t\t// Destroy any select2 elements\n\t\t\t\tvar sel2_elements = newField.find('div.select2-container');\n\t\t\t\tif (sel2_elements.length)\n\t\t\t\t{\n\t\t\t\t\tsel2_elements.remove();\n\t\t\t\t\tnewField.find('select.use_select2_lib').select2('destroy').show();\n\t\t\t\t}\n\n\t\t\t\t// Update value holder\n\t\t\t\tnewField.find('.fcfield_value_holder')\n\t\t\t\t\t.attr('id', '\" . $valueholder_id . \"_'+uniqueRowNum\" . $field->id . \")\n\t\t\t\t\t.attr('name', '\" . $valueholder_nm . \"['+uniqueRowNum\" . $field->id . \"+']');\n\t\t\t\t\";\n\n\t\t\t// Add new field to DOM\n\t\t\t$js .= \"\n\t\t\t\tlastField ?\n\t\t\t\t\t(insert_before ? newField.insertBefore( lastField ) : newField.insertAfter( lastField ) ) :\n\t\t\t\t\tnewField.appendTo( jQuery('#sortables_\" . $field->id . \"') ) ;\n\t\t\t\tif (remove_previous) lastField.remove();\n\n\t\t\t\t// Attach form validation on new element\n\t\t\t\tfc_validationAttach(newField);\n\n\t\t\t\t// Re-init any select2 elements\n\t\t\t\tfc_attachSelect2(newField);\n\n\t\t\t\t\" . (count($allowedtree) === 1 ? \"\n\t\t\t\tvar cat_selector = jQuery('#' + element_id + '_cat_selector');\n\t\t\t\tif (cat_selector.length)\n\t\t\t\t{\n\t\t\t\t\tcat_selector[0].selectedIndex = 1;\n\t\t\t\t\tcat_selector.trigger('change');\n\t\t\t\t}\n\t\t\t\t\" : \"\") . \"\n\t\t\t\t\";\n\n\t\t\t// Add new element to sortable objects (if field not in group)\n\t\t\tif ($add_ctrl_btns) $js .= \"\n\t\t\t\t//jQuery('#sortables_\" . $field->id . \"').sortable('refresh'); // Refresh was done appendTo ?\n\t\t\t\t\";\n\n\t\t\t// Show new field, increment counters\n\t\t\t$js .= \"\n\t\t\t\t//newField.fadeOut({ duration: 400, easing: 'swing' }).fadeIn({ duration: 200, easing: 'swing' });\n\t\t\t\tif (scroll_visible) fc_scrollIntoView(newField, 1);\n\t\t\t\tif (animate_visible) newField.css({opacity: 0.1}).animate({ opacity: 1 }, 800, function() { jQuery(this).css('opacity', ''); });\n\n\t\t\t\t// Enable tooltips on new element\n\t\t\t\tnewField.find('.hasTooltip').tooltip({html: true, container: newField});\n\t\t\t\tnewField.find('.hasPopover').popover({html: true, container: newField, trigger : 'hover focus'});\n\n\t\t\t\trowCount\" . $field->id . \"++; // incremented / decremented\n\t\t\t\tuniqueRowNum\" . $field->id . \"++; // incremented only\n\t\t\t}\n\n\n\t\t\tfunction deleteField\" . $field->id . \"(el, groupval_box, fieldval_box)\n\t\t\t{\n\t\t\t\t// Disable clicks on remove button, so that it is not reclicked, while we do the field value hide effect (before DOM removal of field value)\n\t\t\t\tvar btn = fieldval_box ? false : jQuery(el);\n\t\t\t\tif (btn && rowCount\" . $field->id . \" > 1) btn.css('pointer-events', 'none').off('click');\n\n\t\t\t\t// Find field value container\n\t\t\t\tvar row = fieldval_box ? fieldval_box : jQuery(el).closest('li');\n\n\t\t\t\t// Add empty container if last element, instantly removing the given field value container\n\t\t\t\tif(rowCount\" . $field->id . \" == 1)\n\t\t\t\t\taddField\" . $field->id . \"(null, groupval_box, row, {remove_previous: 1, scroll_visible: 0, animate_visible: 0});\n\n\t\t\t\t// Remove if not last one, if it is last one, we issued a replace (copy,empty new,delete old) above\n\t\t\t\tif (rowCount\" . $field->id . \" > 1)\n\t\t\t\t{\n\t\t\t\t\t// Destroy the remove/add/etc buttons, so that they are not reclicked, while we do the field value hide effect (before DOM removal of field value)\n\t\t\t\t\trow.find('.fcfield-delvalue').remove();\n\t\t\t\t\trow.find('.fcfield-expand-view').remove();\n\t\t\t\t\trow.find('.fcfield-insertvalue').remove();\n\t\t\t\t\trow.find('.fcfield-drag-handle').remove();\n\t\t\t\t\t// Do hide effect then remove from DOM\n\t\t\t\t\trow.slideUp(400, function(){ jQuery(this).remove(); });\n\t\t\t\t\trowCount\" . $field->id . \"--;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\";\n\n\t\t\t$css .= '';\n\n\t\t\t$remove_button = '<span class=\"' . $add_on_class . ' fcfield-delvalue ' . $font_icon_class . '\" title=\"' . JText::_('FLEXI_REMOVE_VALUE') . '\" onclick=\"deleteField' . $field->id . '(this);\"></span>';\n\t\t\t$move2 = '<span class=\"' . $add_on_class . ' fcfield-drag-handle ' . $font_icon_class . '\" title=\"' . JText::_('FLEXI_CLICK_TO_DRAG') . '\"></span>';\n\t\t\t$add_here = '';\n\t\t\t$add_here .= $add_position == 2 || $add_position == 3 ? '<span class=\"' . $add_on_class . ' fcfield-insertvalue fc_before ' . $font_icon_class . '\" onclick=\"addField' . $field->id . '(null, jQuery(this).closest(\\'ul\\'), jQuery(this).closest(\\'li\\'), {insert_before: 1});\" title=\"' . JText::_('FLEXI_ADD_BEFORE') . '\"></span> ' : '';\n\t\t\t$add_here .= $add_position == 1 || $add_position == 3 ? '<span class=\"' . $add_on_class . ' fcfield-insertvalue fc_after ' . $font_icon_class . '\" onclick=\"addField' . $field->id . '(null, jQuery(this).closest(\\'ul\\'), jQuery(this).closest(\\'li\\'), {insert_before: 0});\" title=\"' . JText::_('FLEXI_ADD_AFTER') . '\"></span> ' : '';\n\t\t}\n\n\t\t// Field not multi-value\n\t\telse\n\t\t{\n\t\t\t$remove_button = '';\n\t\t\t$move2 = '';\n\t\t\t$add_here = '';\n\t\t\t$js .= '';\n\t\t\t$css .= '';\n\t\t}\n\n\n\t\t/*\n\t\t * Initialise values and split them into: (a) item ids and (b) category ids\n\t\t */\n\n\t\t// Parse values\n\t\t//echo '<div class=\"alert alert-info\"><h2>DB: ' . $field->label . '</h2><pre>'; print_r($field->value); echo '</pre></div>';\n\t\t$field->value = $this->parseValues($field->value);\n\n\t\t// No limit for used items\n\t\t$item_limit = 0;\n\n\t\t// Get related items IDs and their category ID\n\t\t$itemids_sets = null;\n\t\t$related_items_sets = $this->parseRelatedItems($field->value, $item_limit, $itemids_sets);\n\n\n\t\t/**\n\t\t * Item retrieving query ... put together and execute it\n\t\t */\n\n\t\tforeach ($itemids_sets as $n => $_itemids_v)\n\t\t{\n\t\t\tif (count($_itemids_v))\n\t\t\t{\n\t\t\t\t$query = 'SELECT i.title, i.id, i.catid, i.state, i.alias'\n\t\t\t\t\t. ' FROM #__content AS i '\n\t\t\t\t\t. ' WHERE i.id IN (' . implode(',', $_itemids_v) . ')'\n\t\t\t\t\t. ' ORDER BY FIELD(i.id, ' . implode(',', $_itemids_v) . ')';\n\t\t\t\t$items_arr[$n] = $db->setQuery($query)->loadObjectList();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$items_arr[$n] = array();\n\t\t\t}\n\t\t}\n\n\n\t\t/**\n\t\t * Create category selector to use for selecting related items\n\t\t */\n\n\t\t$cat_selected = count($allowedtree) == 1 ? reset($allowedtree) : '';\n\t\t$cat_selecor_box_style = count($allowedtree) === 1 ? 'style=\"display:none;\" ' : '';\n\t\t$cat_selector_attribs = ' class=\"use_select2_lib fcfield-relation-cat_selector\" onchange=\"return fcfield_relation.cat_selector_change(this);\" ';\n\n\t\t$cat_selector = flexicontent_cats::buildcatselect\n\t\t(\n\t\t\t$allowedtree,\n\t\t\t'__ELEMENTID___cat_selector',\n\t\t\t($cat_selected ? $cat_selected->id : ''),\n\t\t\t$top_option = JText::_('FLEXI_SELECT'), // Important: Add a first option \"Select\", otherwise single entry in select cannot initiate onchange event\n\t\t\t$cat_selector_attribs,\n\t\t\t$check_published = true,\n\t\t\t$check_perms = true,\n\t\t\t$actions_allowed = array('core.create', 'core.edit', 'core.edit.own'),\n\t\t\t$require_all = false,\n\t\t\t$skip_subtrees = array(),\n\t\t\t$disable_subtrees = array()\n\t\t);\n\n\n\t\t/**\n\t\t * Create the selected items field (items selected as 'related')\n\t\t */\n\n\t\t$state_shortname = array(1 => '', 0 => 'U', -1 => 'A', -3 => 'PE', -4 => 'OQ', -5 => 'IP');\n\t\t$items_options_select = array();\n\n\t\tforeach ($items_arr as $n => $items_arr_v)\n\t\t{\n\t\t\t$items_options_select[$n] = '';\n\t\t\tforeach ($items_arr_v as $itemdata)\n\t\t\t{\n\t\t\t\t$itemtitle = (StringHelper::strlen($itemdata->title) > $maxtitlechars) ? StringHelper::substr($itemdata->title, 0, $maxtitlechars) . \"...\" : $itemdata->title;\n\t\t\t\tif ($prepend_item_state)\n\t\t\t\t{\n\t\t\t\t\t$statestr = $state_shortname[$itemdata->state] ?? '';\n\t\t\t\t\t$statestr = $statestr ? '[' . $statestr .']' : '';\n\t\t\t\t\t$itemtitle = $statestr . $itemtitle . \" \";\n\t\t\t\t}\n\t\t\t\t$itemid = $itemdata->id;\n\t\t\t\t$items_options_select[$n] .= '<option selected=\"selected\" value=\"' . htmlspecialchars($related_items_sets[$n][$itemid]->value, ENT_COMPAT, 'UTF-8') . '\" >' . $itemtitle . '</option>' . \"\\n\";\n\t\t\t}\n\t\t}\n\n\n\t\t// ***\n\t\t// *** Add needed JS\n\t\t// ***\n\n\t\tstatic $common_css_js_added = false;\n\t\tif (!$common_css_js_added)\n\t\t{\n\t\t\t$common_css_js_added = true;\n\t\t\tflexicontent_html::loadFramework('select2');\n\n\t\t\tJText::script('FLEXI_RIFLD_ERROR', false);\n\t\t\tJText::script('FLEXI_RIFLD_NO_ITEMS', false);\n\t\t\tJText::script('FLEXI_RIFLD_ADD_ITEM', false);\n\t\t\t$document->addScript(JUri::root(true) . '/plugins/flexicontent_fields/relation/js/form.js', array('version' => FLEXI_VHASH));\n\t\t}\n\n\t\t$per_val_js = '';\n\n\n\t\t/**\n\t\t * Create field's HTML display for item form\n\t\t */\n\n\t\t$field->html = array();\n\t\t$n = 0;\n\n\t\tforeach ($related_items_sets as $n => $related_items)\n\t\t{\n\t\t\t$fieldname_n = $fieldname . ($multiple ? '[' . $n . ']' : '') . '[]';\n\t\t\t$elementid_n = $elementid . ($multiple ? '_' . $n : '');\n\n\t\t\t// Skip empty if not in field group, and at least one value was added\n\t\t\tif (!count($related_items) && !$use_ingroup && $n) continue;\n\n\t\t\t$custom_filters_html = [];\n\t\t\t$this->getCustomFilts($field, $elementid);\n\t\t\tforeach ($this->_custom_filters as $filt)\n\t\t\t{\n\t\t\t\t$custom_filters_html[] = $this->getFilterDisplay(array(\n\t\t\t\t\t'label' => $filt->label,\n\t\t\t\t\t'label_extra_class' => ($filt->value ? ' fc-lbl-inverted' : ''),\n\t\t\t\t\t'html' => $filt->html,\n\t\t\t\t));\n\t\t\t}\n\n\t\t\tif ($custom_filters_html || $prepend_item_state)\n\t\t\t{\n\t\t\t\t$field->html[-1] = '';\n\t\t\t\tif ($prepend_item_state)\n\t\t\t\t{\n\t\t\t\t\t//array(1 => '', 0 => 'U', -1 => 'A', -3 => 'PE', -4 => 'OQ', -5 => 'IP');\n\t\t\t\t\t$long_names = array(\n\t\t\t\t\t\t'(empty)' => JText::_('FLEXI_PUBLISHED', true),\n\t\t\t\t\t\t'[U]' => JText::_('FLEXI_UNPUBLISHED', true),\n\t\t\t\t\t\t'[IP]' => JText::_('FLEXI_IN_PROGRESS', true),\n\t\t\t\t\t\t'[PE]' => JText::_('FLEXI_PENDING', true),\n\t\t\t\t\t\t'[OQ]' => JText::_('FLEXI_TO_WRITE', true),\n\t\t\t\t\t\t'[A]' => JText::_('FLEXI_ARCHIVED', true),\n\t\t\t\t\t\t'[T]' => JText::_('FLEXI_TRASHED', true)\n\t\t\t\t\t);\n\t\t\t\t\t$states_lengend = [];\n\t\t\t\t\tforeach ($long_names as $i => $v) $states_lengend[] = '<div><span class=\"badge long-state-name\">' . $v . '</span>'\n\t\t\t\t\t\t. '<small class=\"short-state-name\">'. $i . '</small></div>';\n\t\t\t\t\t$field->html[-1] = '<div class=\"fcfield-relation-states-legend\" style=\"display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px;\">'\n\t\t\t\t\t\t. implode('', $states_lengend). '</div>';\n\t\t\t\t}\n\t\t\t\t$field->html[-1] .= implode(' - ', $custom_filters_html);\n\t\t\t}\n\t\t\t$field->html[] = '\n\t\t\t\t' . ($use_ingroup ? '<input type=\"hidden\" class=\"fcfield_value_holder\" name=\"' . $valueholder_nm . '[' . $n . ']\" id=\"' . $valueholder_id . '_' . $n . '\" value=\"-\">' : '') . '\n\t\t\t\t' . (!$add_ctrl_btns ? '' : '\n\t\t\t\t<div class=\"' . $input_grp_class . ' fc-xpended-btns\">\n\t\t\t\t\t' . $move2 . '\n\t\t\t\t\t' . $remove_button . '\n\t\t\t\t\t' . (!$add_position ? '' : $add_here) . '\n\t\t\t\t</div>\n\t\t\t\t') . '\n\t\t\t\t' . ($use_ingroup ? '' : '<div class=\"fcclear\"></div>') . '\n\n\t\t\t\t<div class=\"fcfield-relation-value_box\" data-elementbase=\"' . $elementid . '\" data-elementid=\"' . $elementid_n . '\" data-item_id=\"' . $item->id . '\" data-field_id=\"' . $field->id . '\" data-item_type=\"' . $item->type_id . '\" data-item_lang=\"' . $item->language . '\">\n\n\t\t\t\t\t<div class=\"' . $input_grp_class . ' fc-xpended-row fcfield-relation-cat_selector_box\" ' . $cat_selecor_box_style . '>\n\t\t\t\t\t\t<label class=\"' . $add_on_class . ' fc-lbl cat_selector-lbl\" id=\"' . $elementid_n . '_cat_selector-lbl\" for=\"' . $elementid_n . '_cat_selector\">' . JText::_('FLEXI_CATEGORY') . '</label>\n\t\t\t\t\t\t' . str_replace('__ELEMENTID__', $elementid_n, $cat_selector) . '\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"' . $input_grp_class . ' fc-xpended-row fcfield-relation-item_selector_box\">\n\t\t\t\t\t\t<label class=\"' . $add_on_class . ' fc-lbl item_selector-lbl\" id=\"' . $elementid_n . '_item_selector-lbl\" for=\"' . $elementid_n . '_item_selector\">' . JText::_('FLEXI_RIFLD_ITEMS') . '</label>\n\t\t\t\t\t\t<select id=\"' . $elementid_n . '_item_selector\" name=\"' . $elementid_n . '_item_selector\" class=\"use_select2_lib fcfield-relation-item_selector\" onchange=\"return fcfield_relation.add_related(this);\">\n\t\t\t\t\t\t\t<option value=\"\">-</option>\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"' . $input_grp_class . ' fc-xpended-row fcfield-relation-selected_items_box\">\n\t\t\t\t\t\t<label class=\"' . $add_on_class . ' fc-lbl selected_items-lbl\" id=\"' . $elementid_n . '-lbl\" for=\"' . $elementid_n . '\">' . JText::_($selected_items_label) . '</label>\n\t\t\t\t\t\t<select id=\"' . $elementid_n . '\" name=\"' . $fieldname_n . '\" multiple=\"multiple\" class=\"' . $classes . ' fcfield-relation-selected_items\" ' . $attribs . ' onchange=\"return fcfield_relation.selected_items_modified(this);\">\n\t\t\t\t\t\t\t' . $items_options_select[$n] . '\n\t\t\t\t\t\t</select>\n\t\t\t\t\t\t' . ($selected_items_sortable ? '\n\t\t\t\t\t\t<span class=\"add-on\"><span class=\"icon-info hasTooltip\" title=\"' . JText::_('FLEXI_FIELD_ALLOW_SORTABLE_INFO') . '\"></span>' . JText::_('FLEXI_ORDER') . '</span>' : '') . '\n\t\t\t\t\t</div>\n\n\t\t\t\t</div>\n\t\t\t\t';\n\n\t\t\t// If using single category then trigger loading the items selector\n\t\t\t$per_val_js .= count($allowedtree) === 1 ? \"\n\t\t\t\t\tjQuery('#\" . $elementid_n . \"_cat_selector').trigger('change');\n\t\t\t\t\" : '';\n\t\t}\n\n\t\t// Add per value JS\n\t\tif ($per_val_js)\n\t\t{\n\t\t\t$js .= \"\n\t\t\tjQuery(document).ready(function()\n\t\t\t{\n\t\t\t\t\" . $per_val_js . \"\n\t\t\t});\n\t\t\t\";\n\t\t}\n\n\t\t// Add field's CSS / JS\n\t\tif ($multiple) $js .= \"\n\t\t\tvar uniqueRowNum\" . $field->id . \"\t= \" . count($field->value) . \"; // Unique row number incremented only\n\t\t\tvar rowCount\" . $field->id . \"\t= \" . count($field->value) . \"; // Counts existing rows to be able to limit a max number of values\n\t\t\tvar maxValues\" . $field->id . \" = \" . $max_values . \";\n\t\t\";\n\t\t$js .= \"\n\t\t\tvar sessionToken\" . $field->id . \" = '\" . JSession::getFormToken() . \"';\n\t\t\";\n\t\tif ($js) $document->addScriptDeclaration($js);\n\t\tif ($css) $document->addStyleDeclaration($css);\n\n\n\t\t// Do not convert the array to string if field is in a group\n\t\tif ($use_ingroup) ;\n\n\t\t// Handle multiple records\n\t\telseif ($multiple)\n\t\t{\n\t\t\t$field->html = !count($field->html) ? '' :\n\t\t\t\t'<li class=\"' . $value_classes . '\">' .\n\t\t\t\timplode('</li><li class=\"' . $value_classes . '\">', $field->html) .\n\t\t\t\t'</li>';\n\t\t\t$field->html = '<ul class=\"fcfield-sortables\" id=\"sortables_' . $field->id . '\">' . $field->html . '</ul>';\n\t\t\tif (!$add_position) $field->html .= '\n\t\t\t\t<div class=\"input-append input-prepend fc-xpended-btns\">\n\t\t\t\t\t<span class=\"fcfield-addvalue ' . $font_icon_class . ' fccleared\" onclick=\"addField' . $field->id . '(jQuery(this).closest(\\'.fc-xpended-btns\\').get(0));\" title=\"' . JText::_('FLEXI_ADD_TO_BOTTOM') . '\">\n\t\t\t\t\t\t' . JText::_('FLEXI_ADD_VALUE') . '\n\t\t\t\t\t</span>\n\t\t\t\t</div>';\n\t\t}\n\n\t\t// Handle single values\n\t\telse\n\t\t{\n\t\t\t$field->html = '<div class=\"fcfieldval_container valuebox fcfieldval_container_' . $field->id . '\">\n\t\t\t\t' . (isset($field->html[-1]) ? $field->html[-1] : '') . $field->html[0] . '\n\t\t\t</div>';\n\t\t}\n\t}", "function display() {\n\t\tif (!empty($this->config['blog_id'])) {\n\t\t\t$default_data = get_blog_option($this->config['blog_id'], $this->config['name']);\n\t\t}\n\t\telse {\n\t\t\t$default_data = get_option($this->config['name']);\n\t\t}\n\t\t$data = apply_filters('cfinput_get_settings_value',$default_data,$this->config);\n\t\tif ($data != '') {\n\t\t\t$data = maybe_unserialize($data);\n\t\t}\n\t\t// kick off the repeater block with a wrapper div to contain everything\n\t\t$html .= '<div class=\"block_wrapper\">'. \n\t\t\t\t '<h4>'.\n\t\t\t\t (isset($this->config['block_label']) && !empty($this->config['block_label']) ? $this->config['block_label'] : '&nbsp;').\n\t\t\t\t '</h4>';\n\t\t\n\t\t// this div just contains the actual items in the group and it's where new elements are inserted\n\t\t$html .= '<div id=\"'.$this->config['name'].'\" class=\"insert_container\">';\n\t\t\t\t\t\n\t\tif (is_array($this->config['items'])) {\n\t\t\t// if we have data then we need to display it first\n\t\t\tif (!empty($data)) {\n\t\t\t\tforeach ($data as $index => $each) {\n\t\t\t\t\t\n\t\t\t\t\t$html .= $this->make_block_item(array('index' => $index++, 'items' => $each));\n\t\t\t\t}\n\t\t\t}\n\t\t\t// else we can just display an empty set \n\t\t\telse {\n\t\t\t\t$html .= $this->make_block_item(array('index' => 0));\n\t\t\t}\n\t\t}\n\t\t$html .= '</div>'; // this is the end of the .insert_container div\n\t\t\n\t\t// JS for inserting and removing new elements for repeaters\n\t\t$html .= '\n\t\t\t<script type=\"text/javascript\" charset=\"utf-8\">\n\t\t\t\tfunction addAnother'.$this->config['name'].'() {\n\t\t\t\t\tif (jQuery(\\'#'.$this->config['name'].'\\').children().length > 0) {\n\t\t\t\t\t\tlast_element_index = jQuery(\\'#'.$this->config['name'].' fieldset:last\\').attr(\\'id\\').match(/'.$this->config['name'].'_([0-9])/);\n\t\t\t\t\t\tnext_element_index = Number(last_element_index[1])+1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnext_element_index = 1;\n\t\t\t\t\t}\n\t\t\t\t\tinsert_element = \\''.str_replace(PHP_EOL,'',trim($this->make_block_item())).'\\';\n\t\t\t\t\tinsert_element = insert_element.replace(/'.$this->repeater_index_placeholder.'/g, next_element_index);\n\t\t\t\t\tjQuery(insert_element).appendTo(\\'#'.$this->config['name'].'\\');\n\t\t\t\t}\n\t\t\t\tfunction delete'.$this->config['name'].'(del_el) {\n\t\t\t\t\tif(confirm(\\'Are you sure you want to delete this?\\')) {\n\t\t\t\t\t\tjQuery(del_el).parent().remove();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t</script>';\n\n\t\t/* If we have add_another button text set, use that instead of the block_label */\n\t\tif (isset($this->config['add_another_button_text']) && !empty($this->config['add_another_button_text'])) {\n\t\t\t$add_another_text = $this->config['add_another_button_text'];\t\n\t\t}\n\t\telse {\n\t\t\t$add_another_text = 'Add Another '.$this->config['block_label'];\t\n\t\t} \n\t\t\n\t\t$html .= '<p class=\"cf_meta_actions\"><a href=\"#\" onclick=\"addAnother'.$this->config['name'].'(); return false;\" '.\n\t\t\t 'class=\"add_another button-secondary\">'.$add_another_text.'</a></p>'.\n\t\t\t\t '</div><!-- close '.$this->config['name'].' wrapper -->';\n\t\t\n\t\treturn $html;\n\t}", "function cart_do_display (&$hookdata) {\n\t$orderhash=$hookdata[\"order\"][\"order_hash\"];\n\n\t$order=cart_loadorder($orderhash);\n\t$calldata = Array(\"order\"=>$order,\"content\"=>null);\n\tcall_hooks('cart_display_before',$calldata);\n\t$hookdata[\"content\"].= isset($calldata[\"content\"]) ? $calldata[\"content\"] : '';\n\n\tforeach ($order[\"items\"] as $iteminfo) {\n\t\t$itemtype = isset($iteminfo[\"item_type\"]) ? $iteminfo[\"item_type\"] : null;\n\t\tif ($itemtype && !array_has_key($cart_itemtypes,$iteminfo['item_type'])) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t$calldata = Array('item'=>$iteminfo,'error'=>null,'content'=>null);\n\t\t$itemtype = isset($calldata['item']['item_type']) ? $calldata['item']['item_type'] : null;\n\n\t\tif ($itemtype) {\n\t\t\t$itemtypehook='cart_display_before_'.$itemtype;\n\t\t\tcall_hooks($itemtypehook,$calldata);\n\t\t\t$hookdata[\"content\"].= isset($calldata[\"content\"]) ? $calldata[\"content\"] : '';\n\t\t\tunset($calldata[\"content\"]);\n\t\t}\n\n\t\t$calldata[\"content\"]=null;\n\n\t\tcall_hooks(\"cart_display_item\",$calldata);\n\t\t$hookdata[\"content\"].= isset($calldata[\"content\"]) ? $calldata[\"content\"] : '';\n\t\tunset($calldata[\"content\"]);\n\t\tcall_hooks(\"cart_display_item_after\",$calldata);\n\t\t$hookdata[\"content\"].= isset($calldata[\"content\"]) ? $calldata[\"content\"] : '';\n\t\tunset($calldata[\"content\"]);\n\n\t\tif ($itemtype) {\n\t\t\t$itemtypehook='cart_display_after_'.$itemtype;\n\t\t\t$calldata[\"content\"]=null;\n\t\t\tcall_hooks($itemtypehook,$calldata);\n\t\t\t$hookdata[\"content\"].= isset($calldata[\"content\"]) ? $calldata[\"content\"] : '';\n\t\t\tunset($calldata[\"content\"]);\n\t\t}\n\t}\n\n\t$calldata = Array(\"orderhash\"=>$orderhash,\"content\"=>null);\n\tcall_hooks('cart_display_after',$calldata);\n\t$hookdata[\"content\"].= $calldata[\"content\"];\n}", "public function testimonialsDetail()\n {\n $this->template->set('global_setting', $this->global_setting);\n $this->template->set('page', 'contact');\n $this->template->set_theme('default_theme');\n $this->template->set_layout('frontend')\n ->title($this->global_setting['site_title'] . ' | Testimonials')\n ->set_partial('header', 'partials/header')\n ->set_partial('footer', 'partials/footer');\n $this->template->build('frontpages/testimonials_detail');\n }", "function do_viewCategory() { \n $category = KTUtil::arrayGet($_REQUEST, \"fCategory\", $this->category);\n \n $oRegistry =& KTAdminNavigationRegistry::getSingleton();\n $aCategory = $oRegistry->getCategory($category);\t\t\n \n $aItems = $oRegistry->getItemsForCategory($category);\n $this->aBreadcrumbs[] = array(\"name\" => $aCategory[\"title\"], \"url\" => KTUtil::ktLink('admin.php',$category));\n\n \n $this->oPage->title = _kt(\"DMS Administration\") . \": \" . $aCategory[\"title\"];\n $oTemplating =& KTTemplating::getSingleton();\n $oTemplate = $oTemplating->loadTemplate(\"kt3/admin_items\");\n $aTemplateData = array(\n \"context\" => $this,\n \"category\" => $aCategory,\n \"items\" => $aItems, \n \"baseurl\" => $_SERVER['PHP_SELF'],\n );\n return $oTemplate->render($aTemplateData);\t\t\t\t\n }", "function thumbwhere_contentcollectionitem_add_page() {\n $controller = entity_ui_controller('thumbwhere_contentcollectionitem');\n return $controller->addPage();\n}", "public function display($tpl = null)\r\n\t{\r\n\t\t$items\t\t= $this->get('Items');\r\n\t\t$this->items = &$items;\r\n\t\t\r\n\t\t$pagination = $this->get('Pagination');\r\n\t\t$this->pagination = $pagination;\t\t\r\n\t\t//Set the toolbar\r\n\t\t$this->addToolBar();\r\n\t\t\r\n\t\t// get the sidebar\r\n\t\tGoodcookHelper::addSubmenu('recipes');\r\n\t\t$this->sidebar = JHtmlSidebar::render(); \r\n\t\tparent::display($tpl);\r\n\t}", "public function show($id)\n {\n $item = $this->itemCRUD->find($id);\n\n $this->load->view('theme/header');\n $this->load->view('items/show',array('item'=>$item));\n $this->load->view('theme/footer');\n }", "function panel_info_for_modal($addClass,$nameItem,$contentMessage) {\n\t\techo \"<div class='panel $addClass text-center'>\n\t\t\t\t<div class='panel-heading'><strong>$nameItem</strong></div>\n\t\t\t\t<div class='panel-body'>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t$contentMessage.'<br>'\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\";\n\t}", "public function displayPage()\n {\n\n // I check if there is a duplicate action\n $this->handleDuplicate();\n\n $formTable = new FormListTable();\n\n $formTable->prepare_items();\n require_once __DIR__ . '/templates/index.php';\n }", "function getfair_currency_menu_item( $item ) {\r\n if($item->title == 'Your Currency'){\r\n $item->title = 'from: '.edd_currency_get_stored_currency();\r\n }\r\n return $item;\r\n}", "protected function _beforeToHtml()\n {\n if (! $this->canShow()) {\n return $this;\n }\n\n if (! $this->getTemplate()) {\n $this->setTemplate('Plumrocket_Amp::catalog/product/widget/items.phtml');\n }\n\n return parent::_beforeToHtml();\n }", "function edititem($fname)\n {\n if ($this->isAdmin() == TRUE) {\n $this->loadThis();\n } else {\n $this->global['pageTitle'] = '编辑轮播图';\n $this->global['pageName'] = 'carousel_edit';\n $data['imagefile'] = base_url() . $fname;\n\n $this->loadViews(\"carousel_add\", $this->global, $data, NULL);\n }\n }", "public function display( $tpl = null) {\r\n $model = $this->getModel();\r\n $context = $model->setContext( $this->_context . '.' . $this->getLayout());\r\n\r\n // read data from model\r\n $list = $model->getList( (object) array('layout' => $this->getLayout()));\r\n\r\n // and push it into the view for display\r\n $this->assign( 'items', $list);\r\n $this->assign( 'itemCount', count( $this->items));\r\n $this->assign( 'pagination', $model->getPagination());\r\n $options = $model->getDisplayOptions();\r\n $this->assign( 'options', $options);\r\n $this->assign( 'optionsSelect', $this->_makeOptionsSelect( $options));\r\n $this->assign( 'helpMessage', JText::_('COM_SH404SEF_ALIASES_HELP_NEW_ALIAS'));\r\n\r\n // add behaviors and styles as needed\r\n $modalSelector = 'a.modalediturl';\r\n $js= '\\\\function(){window.parent.shAlreadySqueezed = false;if(window.parent.shReloadModal) {parent.window.location=\\''. $this->defaultRedirectUrl .'\\';window.parent.shReloadModal=true}}';\r\n $params = array( 'overlayOpacity' => 0, 'classWindow' => 'sh404sef-popup', 'classOverlay' => 'sh404sef-popup', 'onClose' => $js);\r\n Sh404sefHelperHtml::modal( $modalSelector, $params);\r\n\r\n // build the toolbar\r\n $toolBar = $this->_makeToolbar();\r\n\r\n // insert needed css files\r\n $this->_addCss();\r\n\r\n // link to custom javascript\r\n JHtml::script( Sh404sefHelperGeneral::getComponentUrl() . '/assets/js/list.js');\r\n\r\n // now display normally\r\n parent::display($tpl);\r\n\r\n }", "function renderItem($id = 0)\n {\n \t// Create and load the content table row\n \t$item = & JTable::getInstance('content');\n \t$item->load($id);\n\n \trequire_once (JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php'); // article routing\n\n \t$item->text = $item->introtext;\n \t$item->readmore = (trim($item->fulltext) != '');\n \t$item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->id, $item->catid, $item->sectionid));\n\n \tif (isset($item->link) && $item->readmore)\n \t{\n \t\t$item->link = '<div class=\"readmore\"><a class=\"readmore\" href=\"' . $item->link .\n '\" title=\"' . JText::_('CDMT_READ_MORE_LINK') . '\">' . JText::_('CDMT_READ_MORE_LINK') .\n '</a></div>';\n \t} else\n \t{\n \t\t$item->link = '';\n \t}\n\n \treturn $item;\n }", "function get_item(){\n\tglobal $con;\n\n\t\n\t$get_items = \"select * from items\";\n\n\t$run_items = mysql_query($get_items);\n\t\n\tshow_item($run_items);\n\n\t//$row_items = mysql_fetch_array($run_items);\n\n\t// while($row_items = mysql_fetch_array($run_items)){\n\n\t// \t$item_id = $row_items['item_id'];\n\t// \t$item_image = $row_items['item_image'];\n\t// \t$item_title = $row_items['item_title'];\n\t// \t$item_price = $row_items['item_pice'];\n\t// \t$item_desc1 = $row_items['item_desc1'];\n\t// \t$item_desc2 = $row_items['item_desc2'];\n\t// \t$item_desc3 = $row_items['item_desc3'];\n\t// \t$item_desc4 = $row_items['item_desc4'];\n\n\t// \techo '\n\n\t// \t<div class=\"a13gdf\">\n\t// \t\t<div class=\"it4im\">';echo\" <img src=$item_image width=90% height=97%> \"; echo'</div>\n\t// \t\t<div class=\"it4tl\"><a href=\"product_details.php\">';echo\" $item_title \";echo'</a></div>\n\t// \t\t<div class=\"it4ps\"><b>Rs. '; echo\" $item_price \";echo'</b></div>\n\t// \t\t<div class=\"it4dsc\"> <li>';\n\t// \t\techo\" $item_desc1 \"; echo' </li><li>'; echo \"$item_desc2\";echo'</li><li>';echo \"$item_desc3\"; echo'</li><li>'; echo \"$item_desc4\";echo'</li>\n\t// \t\t</div>\n\t// \t</div>\n\n\t// \t';\n\n\t// }\n\t\n\n}", "public function test_individual_item_is_displayed()\n {\n $response = $this->get(\"/item-detail/1\");\n $response->assertSeeInOrder(['<strong>Title :</strong>', '<strong>Category :</strong>', '<strong>Details :</strong>']);\n }", "function clsRecorditems()\r\n {\r\n\r\n global $FileName;\r\n $this->Visible = true;\r\n $this->Errors = new clsErrors();\r\n $this->ds = new clsitemsDataSource();\r\n $this->InsertAllowed = false;\r\n $this->UpdateAllowed = false;\r\n $this->DeleteAllowed = false;\r\n if($this->Visible)\r\n {\r\n $this->ComponentName = \"items\";\r\n $this->HTMLFormAction = $FileName . \"?\" . CCAddParam(CCGetQueryString(\"QueryString\", \"\"), \"ccsForm\", $this->ComponentName);\r\n $CCSForm = CCGetFromGet(\"ccsForm\", \"\");\r\n $this->FormSubmitted = ($CCSForm == $this->ComponentName);\r\n $Method = $this->FormSubmitted ? ccsPost : ccsGet;\r\n $this->description = new clsControl(ccsLabel, \"description\", \"Description\", ccsMemo, \"\", CCGetRequestParam(\"description\", $Method));\r\n $this->description->HTML = true;\r\n }\r\n }", "public function render() {\n $htmlContent = \"\";//Main Content\n \n //id und class Bezeichnungen der HTML Elementen\n $idContent = \"content\";\n $classProduct = \"product-detail\";\n $classImage = \"img-preview-detail\";\n $classDescription = \"description\";\n $classDescriptionText = \"description-text-detail\";\n $label1 = \"label1\";\n\n //local config\n $maxDescriptionCharlenght = 20000;\n $imagePath = \"/src/theme/images/\";\n $lang_pageTitel = i(\"Productview\");\n $button1 = (\"Buy\");\n \n //Product array\n $products = array();\n\n //TSCM TODO get from DB instead from Session..\n $products = $_SESSION['products'];\n\n\n //Array erstellen\n //TODO Array aus DB holen und verifizieren\n foreach($products as $book){\n\n// exit;\n if($_GET['id'] != $book['ISBN Number']){\n continue;\n }\n\n $paragraph = Utilities::buildParagraph($book);\n\n //too long text?\n if(strlen ( $book['Description'] ) > $maxDescriptionCharlenght)\n {\n $book['Description'] = substr ( $book['Description'] , 0 , $maxDescriptionCharlenght );\n $book['Description'] = $book['Description'] . \"...\";\n }else{\n //not too long, display it all\n $modDescription = $book['Description'];\n }\n \n/*\n * schwf5: Element in Warenkorb legen \n */\n\n//Auslesen der BuchID\nif(isset($_GET[\"id\"])) \n$currentID = $_GET[\"id\"];\nelse \n\t$currentID = 0; \n \n//Prüfen ob Seite mit added action geladen wurde (d.h. dass Buch in Korb gelegt wurde)\nif((isset($_GET[\"action\"])) && $_GET[\"action\"]==\"added\") {\n\n\t$amount = $_POST[\"amountSelection\"];\n\t//Seite wurde neu geladen. Prüfen, ob bereits ein Warenkorb existiert\n\t\n\t//Korb existiert schon. Items also in den Warenkorb hinzufügen\n\tif(isset($_COOKIE[\"shoppingCart\"])) {\n\t\t$cartArray = json_decode($_COOKIE[\"shoppingCart\"]);\n\t\tarray_push($cartArray, array (\"ID\"=>$currentID, \"amount\"=>$amount));\n\t\tsetcookie(\"shoppingCart\", json_encode($cartArray));\n\t}\n\t\n\t\n\t//neuen Korb machen mit erstem Item\n\telse { \n\t$cartArray = array\t(\n\t\tarray (\"ID\"=>$currentID, \"amount\"=>$amount));\n\tsetcookie(\"shoppingCart\", json_encode($cartArray));\n\t}\n\t\n\t//\n\t\n\t\n} \n\n\nelse \n\t;\n\n$htmlContent .= \"\n <div class=\\\"$classProduct\\\">\n <div class=\\\"$classImage\\\"><img src=\\\"\".$imagePath.$book['Picture'].\"\\\" />\n </div>\n <div class=\\\"$classDescription\\\">\n\n $paragraph\n\n <div>\n <a href='index.php?view=payment&id={$_GET[\"id\"]}'>\n <input class='buy_button' type='button' value='\".$button1.\"'></input>\n </a>\n \n <br>Amount: \n <form action='index.php?view=productdetail&id=$currentID&action=added' method='post'>\n <select name='amountSelection'>\n\t\t\t\t\n \t\t\t\t\t <option value='1'>1</option>\n \t\t\t\t\t <option value='2'>2</option>\n \t\t\t\t\t <option value='3'>3</option>\n \t\t\t\t\t <option value='4'>4</option>\n \t\t\t\t\t <option value='5'>5</option>\n \t\t\t\t\t \n\t\t\t\t\t</select>\n\t\t\t\t\t<input type='submit' name='submit' value='Add to Cart' />\n\t\t\t\t\t</form>\n \t\t\n \t\t\n \t\t\n </div>\n \n </div>\n </div>\";\n \n\n }\n\n\nif(isset($_GET[\"action\"])){\n\t\n\t$buyState= \"Produkt wurde in den Warenkorb gelegt.<br>\";\n\t\t\n} else $buyState=\"\";\n\t\n$htmlContentBody = \"\n\t\t<div id=\\\"content\\\">\n <span style='color:red'>$buyState</span>\n \n <h1>$lang_pageTitel</h1>\n $htmlContent\n </div>\n \n\";\n\n\nreturn $htmlContentBody;\n\n\n}", "function item( $args )\n {\n \n // if post id is null just display all\n if( $args['page'] === null || !is_numeric($args['page']) ){\n \n // redirect to browse all\n $this->app->redirect( 'browse/all' );\n }\n \n // get the post id from the page number\n $postid = (int)$args['page'];\n \n \n // initialize results\n $result = null;\n \n \n /* ======================\n * Get the listings model\n */\n $listing_model = $this->app->model('listings');\n \n \n // get the result\n $result = $listing_model->limit(1)->get_item( $postid );\n \n \n // add results to the view\n $this->view->add('listing_result', $result);\n \n /* Check for listing result */\n if( count($result) < 1 ){\n \n // item is not available, update title\n $this->view->add('page_title','Item Unavailable');\n \n // add error message\n $this->view->add('err_msg',\n 'It does not appear that this item is in our garage...'\n );\n \n // add err_msg subview to include\n $this->view->add('subviews',array('err_msg'));\n \n // end \n return;\n }\n \n // update the page title\n $this->view->add('page_title',\n $result[0]['title']\n );\n \n // set the self referencing links\n $this->view->add('self_link',\n $this->app->form_path('browse/item/'.$postid)\n );\n \n \n \n // init accepted to false\n $accepted = false;\n \n /* ===========================================\n * Load offers model to get offers for listing\n */\n \n // start the selection\n $offer_model = $this->app->model('offers');\n\t\t$limit = 10;\n\t\t$offer_page = 0;\n \n // add a test if this listing has already been accepted\n if( $result[0]['status'] ==\n GarageSale\\BaseDatabase::STATUS_ACCEPTED \n ){\n \n // get offer result\n $offers_result = $offer_model->limit(1)->get_accepted( \n (int) $result[0]['id']\n );\n \n // set accepted flag to true\n $accepted = true;\n \n } else {\n \n \n // limit to 10 displayed at a time\n $limit = 10;\n \n // default offer_page to 0\n $offer_page = 0;\n \n // set up offers page\n if( isset( $_GET['offerpage'] ) && \n is_numeric($_GET['offerpage']) \n ){\n \n // set offer_page to the user provided value\n $offer_page = ((int) $_GET['offerpage'] ) - 1;\n }\n \n $offers_result = $offer_model->limit($limit)->\n page($offer_page)->\n get_item_any_offer( (int) $result[0]['id'] );\n }\n \n \n // add to page\n $this->view->add( 'offers_result', $offers_result );\n \n \n \n /* =======================================\n * SQL Query to count the number of offers\n */\n \n if( $accepted === true ){\n \n // where accepted\n $offer_count_res = $offer_model->get_count($postid,\n GarageSale\\BaseDatabase::STATUS_ACCEPTED );\n } else {\n \n // and are active\n $offer_count_res = $offer_model->get_count($postid,\n GarageSale\\BaseDatabase::STATUS_ACTIVE );\n }\n \n // get the count\n $offer_count = (int)$offer_count_res[0]['id'];\n \n // calc offset\n $offset = $limit * $offer_page;\n \n // add comment count info to view\n $this->view->add( 'offer_count',\n array(\n // total numbr of offers that have been made\n 'total' => $offer_count,\n \n // where this set of offers starts\n 'begin' => ($offer_count > 0 ) ? $offset+1 : 0,\n \n // where this set of offers end\n 'end' => $offset + count($offers_result),\n \n // how many are selected per set\n 'per' => $limit\n )\n );\n \n \n \n /* ======================\n * Use the comments model\n */\n $comment_model = $this->app->model('comments');\n \n \n // limit to 10 for now, option for more later\n $limit = 10;\n \n // default comment page number is 0\n $comment_page = 0;\n // get comment page value\n if( isset($_GET['commentpage']) && \n is_numeric( $_GET['commentpage'])\n ){\n // convert to int and is one less than displayed.\n $comment_page = ((int) $_GET['commentpage']) - 1;\n }\n \n \n // get comment results\n $comment_result = $comment_model->limit($limit)->\n page($comment_page)->get_item( $postid );\n \n \n // add comment results to page\n if( count($comment_result) > 0 ){\n \n // add comment result response\n $this->view->add( 'listing_comments', $comment_result );\n } else {\n \n // add null for comment listings\n $this->view->add( 'listing_comments', null );\n }\n \n \n \n \n /* =========================================\n * SQL Query to count the number of comments\n */\n $comment_count_res = $comment_model->get_count($postid);\n \n // get the count\n $comment_count = (int)$comment_count_res[0]['id'];\n \n // calc offset\n $offset = $limit * $comment_page;\n \n // add comment count info to view\n $this->view->add( 'comment_count',\n array(\n // total numbr of comments that have been made\n 'total' => $comment_count,\n \n // where this set of comments starts\n 'begin' => ($comment_count > 0) ? $offset+1 : 0,\n \n // where this set of comments end\n 'end' => $offset + count($comment_result),\n \n // how many are comments per set\n 'per' => $limit\n )\n );\n \n \n\t // get wysiwyg extension\n\t $wysiwyg = $this->app->extension('wysiwyg');\n\t \n\t // load comment form\n\t $comment_form = $this->view->\n\t form('comment','listings/postcomment/'.$postid);\n\t $this->view->add('comment_form',$comment_form);\n\t \n\t \n /* -----------------------\n * Some neat Amazon stuff.\n */\n \n // require needed libraries\n $this->app->library('AmazonIntegration');\n \n $this->amazon = new \\AmazonFetcher();\n \n // get response from amazon\n $response = $this->amazon->medium($result[0]['title']);\n \n // add amazon's response to our view\n $this->view->add('amazon_response',$response);\n\t\t//Get users ID\n\t\t$row = $result[0];\n\t\t$sellerid = $row['userid'];\n\t\t\n\t\t//Get rating and number of reviews for retrieved user id\n\t\t$reviews_model = $this->app->model('reviews');\n\t\t$rating = $reviews_model->get_avg_reviews($sellerid);\n\t\t$review_count_res = $reviews_model->get_count($sellerid);\n\t\t$review_count = $review_count_res[0]['id'];\n\t\t\n\t\t//Add information to view\n\t\t$this->view->add('rating_count',$review_count);\n\t\t//$this->view->add('scripts',array('star-review'));\n\t\tif($rating[0]['rating_average'] != null){\n\t\t\t$this->view->add('rating',$rating[0]['rating_average']);\n\t\t}else{\n\t\t\t$this->view->add('rating',0);\n\t\t}\n \n }", "public function show($orderItem)\n {\n }", "function showItem($item = [], $admin = false)\n{\n $countries = include \"../app/includes/countries_array.php\";\n\n // send message with cap id in title\n if($item['unknown']){\n $link = \"mailto:[email protected]?subject=Information about cap (id: {$item['id']})\";\n $item['unknown'] = \"Do you know this cap? <a href='$link' target='_blank' class='badge badge-primary'>Help me out.</a>\";\n }\n \n echo\n \"<div class='card' style='border-radius: 0;'>\n <div class='row no-gutters d-flex flex-column align-items-center align-items-md-left flex-md-row'>\n <div class='col-auto m-1 py-1'>\", \n file_exists(\"media/caps/thumb/{$item['image']}.jpg\") \n ? \"<img src='media/caps/thumb/{$item['image']}.jpg' class='img-thumbnail' data-toggle='modal' data-target='#cap{$item['id']}'>\" \n : \"<div class='img-thumbnail text-center no-image'>no image</div>\"\n ,\"</div>\n <div class='col'>\n <div class='card-body'>\n <div class='text-center text-md-left'>\n <h4 class='card-header font-weight-bold mb-2'>\",$item['unknown'] ? $item['unknown'] : $item['brand'],\"</h4>\n <a class='details_link collapsed d-inline d-md-none' style='letter-spacing: 1px;' data-toggle='collapse' href='#details{$item['id']}' role='button' aria-expanded='false' aria-controls='Details'>Details &dArr;</a>\n </div>\n\n <div class='d-md-block collapse item-details' id='details{$item['id']}'>\n <ul class='list-group list-group-flush'>\n <li class='list-group-item cap-text' title='{$item['text']}'>\",$item['text'] ? $item['text'] : \"&nbsp;\",\"</li>\n <!-- <li class='list-group-item'>\",$item['color'] ? $item['color'] : \"&nbsp;\",\"</li> -->\n <li class='list-group-item'>\",$item['country'] ? \"<a href='collection?country={$item['country']}'>{$countries[$item['country']]}</a>\" : \"&nbsp;\",\"</li>\n </ul>\n\n <div class='mt-4 d-flex justify-content-between align-items-center'>\n <div class='btn-group admin-info'>\",\n $admin ? \"<span class='btn btn-sm btn-outline-secondary disabled'>#{$item['id']}</span>\n <a class='btn btn-sm btn-outline-secondary' href='admin/edit/{$item['id']}'>Edit</a>\" : \"\"\n ,\"</div>\n <small class='text-muted'>{$item['created_date']}</small>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div class='modal fade' id='cap{$item['id']}' tabindex='-1' role='dialog'>\n <div class='modal-dialog modal-dialog-centered modal-lg' role='document'>\n <div class='modal-content'>\n <div class='modal-header'>\n <h5 class='modal-title'>{$item['brand']}</h5>\n <button type='button' class='close' data-dismiss='modal' aria-label='Close'>\n <span aria-hidden='true'>&times;</span>\n </button>\n </div>\n <div class='modal-body p-0 d-flex justify-content-center'>\n <img src='media/caps/{$item['image']}.jpg' alt='{$item['brand']}' class='img-fluid rounded-bottom'>\n </div>\n </div>\n </div>\n </div>\";\n}", "public static function cpt_meta_box_markup( $object, $item ) {\n\t\t$info = self::build_cpt_info( $item );\n\t\t$meta_key = $info[\"meta_key\"];\n\t\t$nonce_key = $info[\"nonce_key\"];\n\t\t$cpt_type = $info[\"cpt_type\"];\n\t\t$cpt_form_field = $info[\"cpt_form_field\"] . \"[]\";\n\t\t$current_ids = self::get_by_type_and_page( $item, $object->ID );\n\t\t//$current_ids = get_post_meta($object->ID, $meta_key, true);\n\t\t$all_items = self::get_all( $item );\n\n\t\twp_nonce_field( basename( __FILE__ ), $nonce_key );\n\t\techo \"<div class='evo_cpt_list'>\";\n\t\tself::log_obect( $current_ids );\n\t\tif ( $current_ids ) {\n\t\t\tforeach ( $current_ids as $id ) {\n\t\t\t\techo sprintf( \"<div class=\\\"current_cpts\\\">%s<input type=\\\"hidden\\\" name=\\\"{$cpt_form_field}\\\" value=\\\"%s\\\" /><div class=\\\"evo_remove\\\"></div></div>\\n\", $all_items[ $id ]->post_title, $id );\n\t\t\t}\n\n\t\t}\n\t\techo \"</div>\";\n\t\techo '<div class=\"evo_select_callout\">';\n\t\techo \"<select name='evo_new_{$item}_id'>\";\n\t\techo \"<option value='select'>Select a {$info[\"cpt_text\"]}</option>\";\n\t\tif ( $all_items ) {\n\t\t\tforeach ( $all_items as $item ) {\n\t\t\t\techo sprintf( \"<option value=\\\"%s\\\">%s</option>\", $item->ID, $item->post_title );\n\t\t\t}\n\t\t}\n\n\t\techo '</select>';\n\t\techo \"<div data-field-name='{$cpt_form_field}' class='evo_add_cpt'></div>\";\n\t\techo '</div>';\n\t}", "function get_item_html($id, $item){\n $output = \"<li><a href='details.php?id=\" . $id . \"'><img src='\"\n .$item[\"img\"] . \"' alt='\"\n .$item[\"title\"] . \"' />\" \n . \"<p>View Details</p>\"\n .\"</a></li>\";\n return $output;\n}", "public static function geoCart_other_detailsDisplay()\n {\n $cart = geoCart::getInstance();\n if (!$cart->item || $cart->item->getType() != self::type) {\n return '';\n }\n parent::$_type = self::type;\n $return = parent::geoCart_other_detailsDisplay();\n if (!$return) {\n //probably not supposed to show this item\n //but still need to set title and stuff if there\n //are others to display\n $return = array('entire_box' => ' ');\n }\n\n $return ['page_title1'] = $cart->site->messages[500419];\n $return ['page_title2'] = $cart->site->messages[500420];\n $return ['page_desc'] = $cart->site->messages[500421];\n $return ['submit_button_text'] = $cart->site->messages[500422];\n $return ['preview_button_txt'] = $cart->site->messages[502086];\n $return ['cancel_text'] = $cart->site->messages[500423];\n\n return $return;\n }", "public static function displayItemList($showSettings){\n\t\t\tif($showSettings && !User::isAdmin()){\n\t\t\t\t$showSettings = false;\n\t\t\t}\n\n\t\t\t$time_start = microtime(true);\n\n\t\t\t$itemCategories = LendingItem::getAllItems();\n\n\t\t\tforeach ($itemCategories as $categoryID => $category_items) {\n\t\t\t\t// For each category\n\t\t\t\t?>\n\t\t\t\t<div class=\"categoryContainer\">\n\t\t\t\t\t<h2 class=\"rubrikBooking\">\n\t\t\t\t\t\t<img class=\"categoryExpandImg\" src=\"../images/expand.gif\" />\n\t\t\t\t\t\t<img class=\"categoryContractImg\" src=\"../images/contract.gif\" />\n\t\t\t\t\t\t<?php echo(Language::itemCategory($categoryID)); ?>\n\t\t\t\t\t</h2>\n\t\t\t\t\t<div class=\"categoryItemHolder\">\n\t\t\t\t\t<?php\n\t\t\t\t\tforeach ($category_items as $item) {\n\t\t\t\t\t\t// For each item\n\t\t\t\t\t\t?>\n\t\t\t\t\t\t<div class='bookingFormItem'>\n\t\t\t\t\t\t\t<input type='hidden' class='bookingItemID' name='item' value='<?php echo($item['id']); ?>' />\n\t\t\t\t\t\t\t<input type='hidden' class='maxLendingPeriods' name='item' value='<?php echo($item['max_lending_periods']); ?>' />\n\n\t\t\t\t\t\t\t<p class=\"itemImage\">\n\t\t\t\t\t\t\t\t<?php if (file_exists(\"img/\".$item['id'].\".jpg\")) { ?>\n\t\t\t\t\t\t\t\t\t<img class=\"itemPic\" src=\"img/<?php echo($item['id']); ?>.jpg\" alt=\"<?php echo($item['name']); ?>\" />\n\t\t\t\t\t\t\t\t<?php }else{ ?>\n\t\t\t\t\t\t\t\t\t<img class=\"itemPic\" src=\"img/404img.png\" alt=\"Image not found\" />\n\t\t\t\t\t\t\t\t<?php } ?>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<h4 class='itemHeading' id='<?php echo(Language::itemName($item['id'])); ?>'><?php echo(Language::itemName($item['id'])); ?></h4>\n\t\t\t\t\t\t\t<div class='itemContent' >\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t<?php echo(nl2br(Language::itemDescription($item['id']))); ?>\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t<?php echo((nl2br(nl2br($item['deposit'] ? Language::text(\"booking_deposit\").\": \".$item['deposit'].\" SEK\" : \"\")))); ?>\n\t\t\t\t\t\t\t\t\t<?php echo((nl2br($item['fee'] ? Language::text(\"booking_fee\").\": \".$item['fee'].\" SEK\" : \"\"))); ?><br />\n\t\t\t\t\t\t\t\t\t<?php echo(Language::text(\"max_lending_time\")); ?> <?php echo($item['max_lending_periods']); ?><br />\n\t\t\t\t\t\t\t\t\t<?php echo(Language::text(\"item_descr_there_is\")); ?> <?php echo($item['num_items']); ?> <?php echo(Language::text(\"item_descr_num\")); ?>\n\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\tif($showSettings){\n\t\t\t\t\t\t\t\t\t//Display item options for admins\n\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t<form action=\"item.php\" method=\"post\" enctype=\"multipart/form-data\">\n\t\t\t\t\t\t\t\t\t\t<fieldset style=\"padding: 0;\">\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"lending_item_id\" value=\"<?php echo($item['id']); ?>\" />\n\t\t\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t\t\t<b><?php echo(Language::text(\"edit_item\")); ?>:</b>\n\t\t\t\t\t\t\t\t\t\t\t</p>\n\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"pure-control-group\">\n\t\t\t\t\t\t\t\t\t\t\t\t<label style=\"width: 6em;\" for=\"Bildfil\"><?php echo(Language::text(\"picture\")); ?></label>\n\t\t\t\t\t\t\t\t\t\t\t\t<input class=\"button_style\" id =\"picture_select_btn\" type=\"file\" name=\"image\" class=\"button_style\" />\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"pure-control-group\">\n\t\t\t\t\t\t\t\t\t\t\t\t<label style=\"width: 6em;\" for=\"Internt Namn\"><?php echo(Language::text(\"internal_name\")); ?></label>\n\t\t\t\t\t\t\t\t\t\t\t\t<input class=\"form_style\" type=\"text\" name=\"name\" value=\"<?php echo($item['name']); ?>\" />\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"pure-control-group\">\n\t\t\t\t\t\t\t\t\t\t\t\t<label style=\"width: 6em;\" for=\"Antal\"><?php echo(Language::text(\"amount\")); ?></label>\n\t\t\t\t\t\t\t\t\t\t\t\t<input class=\"form_style\" type=\"text\" name=\"num_items\" value=\"<?php echo($item['num_items']); ?>\" size=\"3\" />\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"pure-control-group\">\n\t\t\t\t\t\t\t\t\t\t\t\t<label style=\"width: 6em;\" for=\"Max att låna\"><?php echo(Language::text(\"max_to_lend\")); ?></label>\n\t\t\t\t\t\t\t\t\t\t\t\t<input class=\"form_style\" type=\"text\" name=\"max_lending_items\" value=\"<?php echo($item['max_lending_items']); ?>\" size=\"3\" /> <?php echo(Language::text(\"max_lend_info\")); ?>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"pure-control-group\">\n\t\t\t\t\t\t\t\t\t\t\t\t<label style=\"width: 6em;\" for=\"Maxlånetid\"><?php echo(Language::text(\"max_time\")); ?></label>\n\t\t\t\t\t\t\t\t\t\t\t\t<input class=\"form_style\" type=\"text\" name=\"max_lending_periods\" value=\"<?php echo($item['max_lending_periods']); ?>\" size=\"3\" /> <?php echo(Language::text(\"max_time_info\")); ?>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"pure-control-group\">\n\t\t\t\t\t\t\t\t\t\t\t\t<label style=\"width: 6em;\" for=\"Deposition\"><?php echo(Language::text(\"deposition\")); ?></label>\n\t\t\t\t\t\t\t\t\t\t\t\t<input class=\"form_style\" type=\"text\" name=\"deposit\" value=\"<?php echo($item['deposit']); ?>\" size=\"5\" /> kr\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"pure-control-group\">\n\t\t\t\t\t\t\t\t\t\t\t\t<label style=\"width: 6em;\" for=\"Avgift\"><?php echo(Language::text(\"fee\")); ?></label>\n\t\t\t\t\t\t\t\t\t\t\t\t<input class=\"form_style\" type=\"text\" name=\"fee\" value=\"<?php echo($item['fee']); ?>\" size=\"5\" /> kr\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"pure-control-group\">\n\t\t\t\t\t\t\t\t\t\t\t\t<label style=\"width: 6em;\" for=\"Ta bort bild\"><?php echo(Language::text(\"remove_pic\")); ?></label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"delete_image\" value=\"1\" />\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"pure-control-group\">\n\t\t\t\t\t\t\t\t\t\t\t\t<input class=\"button_style\" type=\"submit\" name=\"update_lending_item\" value=\"<?php echo(Language::text(\"update\")); ?>\" />\n\t\t\t\t\t\t\t\t\t\t\t\t<input class=\"button_style\" type=\"submit\" name=\"delete_lending_item\" value=\"<?php echo(Language::text(\"remove_item\")); ?>\" />\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</fieldset>\n\t\t\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t\t\t\t<div class=\"togglable\">\n\t\t\t\t\t\t\t\t\t\t<p class=\"toggleButton\"><b><?php echo(Language::text(\"translations\")); ?></b></p>\n\t\t\t\t\t\t\t\t\t\t<div class=\"toggleContent\"><?php\n\n\t\t\t\t\t\t\t\t\t\tforeach (Language::getLanguages() as $language) { ?>\n\t\t\t\t\t\t\t\t\t\t\t<form action=\"item.php\" method=\"post\">\n\t\t\t\t\t\t\t\t\t\t\t\t<fieldset class=\"translateBox\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<?php if ($translation = ItemTranslation::getTranslation($item['id'], $language['id'])) { ?>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"item_translation_id\" value=\"<?php echo($translation['id']); ?>\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<legend><?php echo(Language::text(\"edit_language\")); ?> <?php echo($language['name']); ?></legend>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<?php echo(Language::text(\"name\")); ?>: <input type=\"text\" name=\"name\" value=\"<?php echo($translation['name']); ?>\" /><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<?php echo(Language::text(\"description\")); ?>:<br />\n\t <textarea name=\"description\" rows=\"3\" cols=\"25\"><?php echo($translation['description']); ?></textarea><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tEmail-text:<br />\n\t <textarea name=\"emailText\" rows=\"3\" cols=\"25\"><?php echo($translation['email_text']); ?></textarea><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"submit\" class=\"button_style\" name=\"update_item_translation\" value=\"<?php echo(Language::text(\"update\")); ?>\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t<?php } else { ?>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"item_id\" value=\"<?php echo($item['id']); ?>\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"language_id\" value=\"<?php echo($language['id']); ?>\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<legend><?php echo(Language::text(\"add_translation\")); ?> <?php echo($language['name']); ?></legend>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<?php echo(Language::text(\"name\")); ?>: <input type=\"text\" name=\"name\" value=\"\" /><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<?php echo(Language::text(\"description\")); ?>:<br />\n\t <textarea name=\"description\" rows=\"3\" cols=\"25\"></textarea><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tEmail-text:<br />\n\t <textarea name=\"emailText\" rows=\"3\" cols=\"25\"></textarea><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"submit\" class=\"button_style\" name=\"create_item_translation\" value=\"<?php echo(Language::text(\"create\")); ?>\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t<?php } ?>\n\t\t\t\t\t\t\t\t\t\t\t\t</fieldset>\n\t\t\t\t\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t\t\t\t\t<?php } ?>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\t//Display calendar for booking\n\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t<div class=\"calendarBooking\">\n\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\techo \"<input type='hidden' class='bookingItemID' name='item' value='\".$item['id'].\"' />\\n\";\n\t\t\t\t\t\t\t\t\t\t\techo \"<input type='hidden' class='maxLendingPeriods' name='item' value='\".$item['max_lending_periods'].\"' />\\n\";\n\t\t\t\t\t\t\t\t\t\t?><br />\n\t\t\t <div>\n\t\t\t <a href=\"#\" class=\"firstLoadButton\"><?php echo(nl2br(Language::text(\"booking_choose_period\"))); ?></a>\n\t\t\t </div>\n\t\t\t\t\t\t\t\t\t\t<div class=\"calendar\">\n\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<?php\n\n\t\t\t\t\t\t\t\t\t\tif ($item['max_lending_items'] != \"0\") {\n\t\t\t\t\t\t\t\t\t\t\t$max_lending_items = $item['max_lending_items'];\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t$max_lending_items = $item['num_items'];\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\t<br />\n\t\t\t\t\t\t\t\t\t\t<?php echo(Language::text(\"booking_num_items\")); ?>:\n\t\t\t\t\t\t\t\t\t\t<select name=\"num_items\" class=\"numItemsSelector\">\n\t\t\t\t\t\t\t\t\t\t\t<?php for ($num_items = 1; $num_items <= $max_lending_items; $num_items++) { ?>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"<?php echo($num_items); ?>\"><?php echo($num_items); ?></option>\n\t\t\t\t\t\t\t\t\t\t\t<?php } ?>\n\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t<br />\n\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<?php\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</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"itemRowSeparator\"></div>\n\t\t\t\t\t<?php\n\t\t\t\t\t}\n\n\t\t\t\t\tif($showSettings){\n\t\t\t\t\t\t?>\n\t\t\t\t\t\t<!-- Item box for adding new item -->\n\t\t\t\t\t\t<div class=\"bookingFormItem\" style=\"background-color: #ff6600;\">\n\t\t\t\t\t\t\t<h4 class=\"itemHeading\"><?php echo(Language::text(\"add_item_to\")); ?> <b style=\"color:#0080ff\"><?php echo(Language::itemCategory($categoryID)); ?></b></h4>\n\t\t\t\t\t\t\t<div class=\"itemContent\">\n\t\t\t\t\t\t\t\t<form action=\"item.php\" method=\"post\">\n\t\t\t\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"lending_item_category_id\" value=\"<?php echo($categoryID); ?>\" />\n\t\t\t\t\t\t\t\t\t\t<legend><?php echo(Language::text(\"edit_item\")); ?>:</legend>\n\t\t\t\t\t\t\t\t\t<div class=\"pure-control-group\">\n\t\t\t\t\t\t\t\t\t\t<label style=\"width: 6em;\" for=\"Internt namn \"><?php echo(Language::text(\"internal_name\")); ?></label>\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form_style\" name=\"name\" value=\"\" />\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"pure-control-group\">\n\t\t\t\t\t\t\t\t\t\t<label style=\"width: 6em;\" for=\"Antal\"><?php echo(Language::text(\"amount\")); ?></label>\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form_style\" name=\"num_items\" value=\"1\" /> st\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"pure-control-group\">\n\t\t\t\t\t\t\t\t\t\t<label style=\"width: 6em;\" for=\"Max att låna\"><?php echo(Language::text(\"max_to_lend\")); ?></label>\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form_style\" name=\"max_lending_items\" value=\"0\" /> <?php echo(Language::text(\"max_lend_info\")); ?>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"pure-control-group\">\n\t\t\t\t\t\t\t\t\t\t<label style=\"width: 6em;\" for=\"Maxlånetid\"><?php echo(Language::text(\"max_time\")); ?></label>\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form_style\" name=\"max_lending_periods\" value=\"4\" /> <?php echo(Language::text(\"max_time_info\")); ?>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"pure-control-group\">\n\t\t\t\t\t\t\t\t\t\t<label style=\"width: 6em;\" for=\"Deposition\"><?php echo(Language::text(\"deposition\")); ?></label>\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form_style\" name=\"deposit\" value=\"\" /> kr\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"pure-control-group\">\n\t\t\t\t\t\t\t\t\t\t<label style=\"width: 6em;\" for=\"Avgift\"><?php echo(Language::text(\"fee\")); ?></label>\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form_style\" name=\"fee\" value=\"\" /> kr\n\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t<input type=\"submit\" class=\"button_style\" name=\"create_lending_item\" value=\"<?php echo(Language::text(\"create\")); ?>\" />\n\t\t\t\t\t\t\t\t</fieldset>\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"itemRowSeparator\"></div>\n\t\t\t\t\t<?php\n\t\t\t\t}\n\t\t\t\t?>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<?php\n\t\t\tif($showSettings){\n\t\t\t\t?>\n\t\t\t\t<!-- Translations of category -->\n\t\t\t\t<div class=\"togglable catTranslation\">\n\t\t\t\t\t<p class=\"toggleButton\"><b><?php echo(Language::text(\"translate_category\")); ?> <b style=\"color:#ff6600\"><?php echo(Language::itemCategory($categoryID)); ?></b></b></p>\n\t\t\t\t\t<div class=\"toggleContent\">\n\t\t\t\t\t<?php\n\t\t\t\t\tforeach (Language::getLanguages() as $language) { ?>\n\t\t\t\t\t\t<form action=\"item.php\" method=\"post\">\n\t\t\t\t\t\t\t<fieldset class=\"box\">\n\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t$translation = ItemCategoryTranslation::getTranslation($categoryID, $language['id']);\n\t\t\t\t\t\t\t\tif ($translation) { ?>\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"item_category_translation_id\" value=\"<?php echo($translation['id']); ?>\" />\n\t\t\t\t\t\t\t\t\t<legend><?php echo(Language::text(\"edit_language\")); ?> <?php echo($language['name']); ?></legend>\n\t\t\t\t\t\t\t\t\t<?php echo(Language::text(\"name\")); ?>: <input type=\"text\" name=\"name\" value=\"<?php echo($translation['name']); ?>\" /><br />\n\t\t\t\t\t\t\t\t\t<input type=\"submit\" class=\"button_style\" name=\"update_item_category_translation\" value=\"<?php echo(Language::text(\"update\")); ?>\" />\n\t\t\t\t\t\t\t\t<?php } else { ?>\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"category_id\" value=\"<?php echo($categoryID); ?>\" />\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"language_id\" value=\"<?php echo($language['id']); ?>\" />\n\t\t\t\t\t\t\t\t\t<legend><?php echo(Language::text(\"add_translation\")); ?> <?php echo($language['name']); ?></legend>\n\t\t\t\t\t\t\t\t\t<?php echo(Language::text(\"name\")); ?>: <input type=\"text\" name=\"name\" value=\"\" /><br />\n\t\t\t\t\t\t\t\t\t<input type=\"submit\" class=\"button_style\" name=\"create_item_category_translation\" value=\"<?php echo(Language::text(\"create\")); ?>\" />\n\t\t\t\t\t\t\t\t<?php } ?>\n\t\t\t\t\t\t\t</fieldset>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t<?php } ?>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<!-- Deletion of category -->\n\t\t\t\t<div class=\"catDeleteBtn\">\n\t\t\t\t\t<form class=\"catDelForm\" action=\"item.php\" method=\"post\">\n\t\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"lending_item_category_id\" value=\"<?php echo($categoryID); ?>\" />\n\t\t\t\t\t\t\t<input type=\"submit\" class=\"button_style\" name=\"delete_lending_item_category\" value=\"<?php echo(Language::text(\"remove_category\")); ?>\" />\n\t\t\t\t\t\t</fieldset>\n\t\t\t\t\t</form>\n\t\t\t\t</div>\n\t\t\t\t<script>\n\t\t\t\t\t$('.catDelForm').submit(function() {\n\t\t\t\t\t return confirm(\"<?php echo(Language::text(\"confirm_cat_del\")); ?>\");\n\t\t\t\t\t});\n\t\t\t\t</script>\n\t\t\t\t<?php\n\t\t\t\t}\n\t\t\t}\n\t\t\t$time_end = microtime(true);\n\t\t\t$time = $time_end - $time_start;\n\t\t}", "public static function render_edit_showroom($item, $page_name, $active)\n\t{\n\t\treturn ' <li id=\"item_' . $item->id . '\"><span><a href=\"#\" id=\"cat_' . $item->id . '\" rel=\"' . $item->id . '\">' . $item->name . '</a></span>'; \n\t}", "public function show_slider_detail()\n\t{\n\t\t$sql=\"select * from slider\";\n\t\t$result=$this->db->query($sql);\n\t\twhile($data=$result->fetch_array())\n\t\t{\n\t\t\techo \"<li><h3>$data[title]</h3><p>$data[description]</p></li>\";\n\t\t}\n\t}", "public function hookBookReaderItemShow($args)\n {\n $view = $args['view'];\n $item = isset($args['item']) && !empty($args['item'])\n ? $args['item']\n : $view->item;\n $page = isset($args['page']) ? $args['page'] : '0';\n // Currently, all or none functions are enabled.\n $embed_functions = isset($args['embed_functions'])\n ? $args['embed_functions']\n : get_option('bookreader_embed_functions');\n\n $mode_page = isset($args['mode_page'])\n ? $args['mode_page']\n : get_option('bookreader_mode_page');\n\n // Build url of the page with iframe.\n $url = WEB_ROOT . '/viewer/show/' . $item->id;\n $url .= $embed_functions ? '' : '?ui=embed';\n $url .= '#';\n $url .= empty($page) ? '' : 'page/n' . $page . '/';\n $url .= 'mode/' . $mode_page . 'up';\n\n $class = get_option('bookreader_class');\n if (!empty($class)) {\n $class = ' class=\"' . $class . '\"';\n }\n $width = get_option('bookreader_width');\n if (!empty($width)) {\n $width = ' width=\"' . $width . '\"';\n }\n $height = get_option('bookreader_height');\n if (!empty($height)) {\n $height = ' height=\"' . $height . '\"';\n }\n\n $html = '<div><iframe src=\"' . $url . '\"' . $class . $width . $height . ' frameborder=\"0\"></iframe></div>';\n echo $html;\n }", "function link_to_item($text = null, $props = array(), $action = 'show', $item = null)\n{\n if (!$item) {\n $item = get_current_record('item');\n }\n if (empty($text)) {\n $text = metadata($item, 'display_title');\n }\n return link_to($item, $action, $text, $props);\n}", "public static function inWindow($item)\n {\n echo '<pre>';\n print_r($item);\n echo '</pre>';\n }", "function lb_show_view_cart_page_action() {\n\tlb_show_templates(\n\t\tarray(\n\t\t\t'name' => 'view-cart',\n\t\t)\n\t);\n}", "function get_item_podcast($podcast,$id) {\r\tglobal $CFG;\r\r\t$browse = get_string('browse', 'podcast');\r\r\t$usehtmleditor = can_use_html_editor();\r\r\tif ($items = get_records(\"podcast_structure\", \"id_podcast\", $podcast->id)) {\r\t\tforeach($items as $item) { ?>\r\t\t\t<form name=\"form<?php echo $item->id;?>\" method=\"post\" action=\"view.php\">\r\t\t\t<center>\r\t\t\t<table cellpadding=\"5\">\r\t\t\t<tr>\r\t\t\t\t<td align=\"right\" valign=\"top\"><b><?php print_string(\"title\", \"podcast\") ?></b></td>\r\t\t\t\t<td align=\"left\"><input type=\"text\" name=\"title\" size=\"30\" value=\"<?php p(stripslashes($item->title)) ?>\" />\r\t\t\t\t<a href=\"?id=<?php echo $id; ?>&amp;tab=edit&amp;action=delete&amp;id_item=<?php echo $item->id; ?>\" style=\"color:red;font-size:0.8em;font-weight:bold;\">\r\t\t\t\t\t<?php print_string('delete', \"podcast\") ?>\r\t\t\t\t</a></td>\r\t\t\t</tr>\r\t\t\t<tr>\r\t\t\t <td align=\"right\" valign=\"top\"><b><?php print_string('desc', 'podcast') ?> :</b></td>\r\t\t\t <td align=\"left\">\r\t\t\t\t<?php print_textarea($usehtmleditor, 7, 50, 450, 200, \"intro\", stripslashes($item->intro)); ?></td>\r\t\t\t</tr>\r\t\t\t<tr>\r\t\t\t <td align=\"right\" valign=\"top\"><b><?php print_string('file', 'podcast') ?> :</b></td>\r\t\t\t <td align=\"left\">\r\t\t\t\t<?php\r\r\t\t\t\t$itemlink = $item->lien;\r\r\t\t\t\techo \"<input type=\\\"text\\\" name=\\\"lien\\\" size=\\\"30\\\" value=\\\"$itemlink\\\" alt=\\\"lien\\\" />\";\r\t\t\t\tbutton_to_popup_window (\"/mod/podcast/files/index.php?id=$podcast->course&amp;pod=$podcast->id&amp;choose=form\".$item->id.\".lien\", \"coursefiles\", $browse, 500, 790, $browse);\r\t\t\t?>\r\t\t\t</td>\r\t\t\t</tr>\r\t\t\t</table>\r\t\t\t<input type=\"hidden\" name=\"id\" value=\"<?php p($id) ?>\" />\r\t\t\t<input type=\"hidden\" name=\"id_item\" value=\"<?php p($item->id) ?>\" />\r\t\t\t<input type=\"hidden\" name=\"id_podcast\" value=\"<?php p($item->id_podcast) ?>\" />\r\t\t\t<input type=\"hidden\" name=\"tab\" value=\"edit\" />\r\t\t\t<input type=\"hidden\" name=\"action\" value=\"update\" />\r\t\t\t<input type=\"hidden\" name=\"pubdate\" value=\"<?php echo podcast_date_format(); ?>\" />\r\t\t\t<input type=\"hidden\" name=\"date_html\" value=\"<?php echo podcast_date_format_html($podcast->lang); ?>\" />\r\t\t\t<input type=\"hidden\" name=\"duration\" value=\"<?php p($item->duration) ?>\" />\r\t\t\t<input type=\"hidden\" name=\"length\" value=\"<?php p($item->length) ?>\" />\r\t\t\t<input type=\"submit\" value=\"<?php print_string('save', \"podcast\") ?>\" />\r\t\t\t</center>\r\t\t\t</form>\r\t\t\t<hr /> <?php\r\t\t}\r\t}\r}", "function &show_edit($item, $usehtmleditor = false) {\n }", "public function show($id)\n {\n //$this->_DetailItem();\n }", "public function renderAdd()\r\n\t{\r\n\t\t$this['itemForm']['save']->caption = 'Přidat';\r\n $this->template->titul = self::TITUL_ADD;\r\n\t\t$this->template->is_addon = TRUE;\r\n\r\n\t}", "function showCategory()\r\n {\r\n }", "protected function _getItems(){\n\n\t\t// get parent\n\t\t$model = new Default_Model_ProjectImages();\n\t\t$parentModel = new Default_Model_Projects();\n\t\t$parent = $parentModel->findById($this->_session->id);\n\n\n\t\t// get the item list\n\t\t$model = new $this->_primaryModel;\n\t\t$items = $model->fetchNotTrashedByParentId($this->_session->id);\n\n\t\t// assign specific vars to the view\n\t\t$this->view->assign(array (\n\t\t\t'items' => $items,\n\t\t\t'parent' => $parent,\n//\t\t\t'title' => $items->getRow(0)->title\n\t\t\t'title' => \"TITLE\"\n\t\t));\n\t}", "public function show(GroceryItem $groceryItem)\n {\n //\n }", "function podcast_add_item($podcast, $id) {\r\r\r\t$browse = get_string('browse', 'podcast');\r\r if (!$cm = get_record(\"course_modules\", \"id\", $id)) {\r\t\terror(\"Course Module ID was incorrect\");\r\t}\r\r if (! $basedir = make_upload_directory(\"$podcast->course\")) {\r error(\"The site administrator needs to fix the file permissions\");\r }\r\r\t$usehtmleditor = can_use_html_editor();\r?>\r\r<form name=\"form\" method=\"post\" id=\"form\" action=\"view.php\">\r\t<center>\r\t<table cellpadding=\"5\">\r\t<tr>\r\t\t<td align=\"left\" valign=\"top\"><b><?php print_string(\"title\", \"podcast\") ?></b></td>\r\t\t<td align=\"right\"><input type=\"text\" name=\"title\" size=\"30\" value=\"\" /></td>\r\t</tr>\r\t<tr>\r\t <td align=\"left\" valign=\"top\"><b><?php print_string('desc', 'podcast') ?> :</b></td>\r\t <td align=\"right\">\r\t\t<?php print_textarea($usehtmleditor, 15, 40, 400, 300, \"intro\",\"\"); ?></td>\r\t</tr>\r\t<tr>\r\t <td align=\"left\" valign=\"top\"><b><?php print_string('file', 'podcast') ?> :</b></td>\r\t <td align=\"right\">\r\t\t<?php\r echo \"<input type=\\\"text\\\" name=\\\"lien\\\" size=\\\"30\\\" value=\\\"\\\" alt=\\\"lien\\\" />\";\r button_to_popup_window (\"/mod/podcast/files/index.php?id=$podcast->course&amp;pod=$podcast->id&amp;choose=form\".$item->id.\".lien\", \"coursefiles\", $browse, 500, 790, $browse);\r\r\t\t?>\r\t </td>\r\t</tr>\r\t</table>\r\r\t<input type=\"hidden\" name=\"id\" value=\"<?php p($id) ?>\" />\r\t<input type=\"hidden\" name=\"id_item\" value=\"\" />\r\t<input type=\"hidden\" name=\"id_podcast\" value=\"<?php p($podcast->id) ?>\" />\r\t<input type=\"hidden\" name=\"tab\" value=\"view\" />\r\t<input type=\"hidden\" name=\"action\" value=\"create\" />\r\t<input type=\"hidden\" name=\"pubdate\" value=\"<?php echo podcast_date_format(); ?>\" />\r\t<input type=\"hidden\" name=\"date_html\" value=\"<?php echo podcast_date_format_html($podcast->lang); ?>\" />\r\t<input type=\"hidden\" name=\"duration\" value=\"00:00:00\" />\r\t<input type=\"hidden\" name=\"length\" value=\"000000\" />\r\t<input type=\"submit\" value=\"<?php print_string('add_item', \"podcast\") ?>\" />\r</center>\r</form>\r\r<?php\r\r}", "public function item($item_id)\n {\n //get all stuff list\n $stuffs = Admin::SelectStuffs()\n ->Select('id', DB::raw('CONCAT(first_name, \" \", last_name) AS name'))\n ->orderBy('first_name')\n ->orderBy('last_name')\n ->get()\n ->toArray();\n $stuffs = ['' => 'Assign this job to...'] + array_convert2to1($stuffs, 'id', 'name');\n \n $item = OrderItem::find($item_id);\n \n return $this->view('sales.order.item', compact('item', 'stuffs')); \n }" ]
[ "0.6727339", "0.6346032", "0.62905097", "0.62762725", "0.62298626", "0.61925036", "0.60497975", "0.6041301", "0.60172355", "0.60047704", "0.5940576", "0.58672947", "0.5861009", "0.58248466", "0.5807389", "0.5807389", "0.579114", "0.57811254", "0.57549244", "0.57391053", "0.57297736", "0.5728238", "0.57273763", "0.5712192", "0.5692494", "0.56896", "0.5689489", "0.5661606", "0.56377673", "0.56283844", "0.5613688", "0.5607198", "0.5582024", "0.55787826", "0.557821", "0.55645883", "0.556282", "0.5562498", "0.5556475", "0.55464953", "0.5545945", "0.5541976", "0.5531533", "0.5516454", "0.5513856", "0.54896307", "0.5486203", "0.54728705", "0.547244", "0.5471075", "0.54679376", "0.5448008", "0.54462713", "0.5439626", "0.543633", "0.5433642", "0.54240674", "0.5421264", "0.5420372", "0.5420077", "0.54186124", "0.5416797", "0.54105484", "0.5408396", "0.540746", "0.540608", "0.5404046", "0.5398463", "0.53913575", "0.5390838", "0.538997", "0.53887236", "0.5382041", "0.5374193", "0.5370094", "0.53635377", "0.5361143", "0.53504354", "0.53498286", "0.5346415", "0.53441626", "0.53376013", "0.5337382", "0.53367233", "0.5331727", "0.5330637", "0.5329239", "0.5328075", "0.53209233", "0.5312734", "0.53087586", "0.5304881", "0.52979255", "0.5295691", "0.5292613", "0.5282895", "0.52820635", "0.5280411", "0.52701765", "0.52673775", "0.52664083" ]
0.0
-1
/desc:generate authcode /input:arg(email,code_type(1register,2change password,3change email,4change phone),user_type,user_id) /output:return(authcode,errorcode(1success,0failed))
function generate_authcode_email($email,$code_type=0,$user_id="",$user_type=Constant::USER_TYPE_TEACHER,$check=true) { $authcode=""; if($check) $errorcode=$this->check_authcode_email($email,$code_type,$user_id); else $errorcode=array('errorcode'=>false); if(!$errorcode['errorcode']) { $authcode=random_string('unique'); $data=$this->bind_verify($user_id,$email,"",1,$code_type,$authcode,$user_type); if($this->_redis) { $errorcode=$this->cache->save($authcode,json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_EMAIL); $this->save_check('email',$email,$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_EMAIL); } else { $this->db->insert($this->_table,$data); $insert_id=$this->db->insert_id(); if($insert_id>0) $errorcode=true; else $errorcode=false; } log_message('trace_tizi','170018:Gen email auth code',array('email'=>$email)); if(!$errorcode) log_message('error_tizi','17018:Gen email auth code failed',array('email'=>$email)); } else { $errorcode=false; } return array('authcode'=>$authcode,'errorcode'=>$errorcode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generate_authcode_phone($phone,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER)\n\t{\n\t\t$authcode=\"\";\n\t\t$errorcode=$this->check_authcode_phone($phone,$code_type);\n if(!$errorcode['errorcode'])\n {\n\t\t\t$authcode=random_string('nozero',6);\n $data=$this->bind_verify($user_id,\"\",$phone,2,$code_type,$authcode,$user_type);\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode.'_'.sha1($phone),json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_PHONE);\n\t\t\t\t$this->save_check('phone',sha1($phone),$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_PHONE);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n\t\t\t\t$insert_id=$this->db->insert_id();\n\t\t\t\tif($insert_id>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170019:Gen phone auth code',array('phone'=>$phone));\n\t\t\tif(!$errorcode) log_message('error_tizi','17019:Gen phone auth code failed',array('phone'=>$phone));\n\t\t}\n else\n {\n $errorcode=false;\n }\n return array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "function check_authcode_email($email,$code_type,$user_id=\"\")\n\t{\n\t\tif($email)\n\t\t{\n\t\t\tif($this->_redis)\n {\n\t\t\t\t$errorcode=$this->check_auth('email',$email);\n }\n else\n {\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"email\",$email);\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" -\".Constant::SEND_AUTHCODE_INTERVAL_EMAIL)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n\t}", "function auth() {\r\n\t$code = \"\";\r\n\tfor ($i = 0; $i < 8; $i ++) {\r\n\t\t$code .= (rand(0, 1) ? chr(rand(65, 122)) : rand(0, 9));\r\n\t}\r\n\treturn sha1($code);\r\n}", "function verify_authcode_email($authcode)\n\t{\n\t\t$user_id=$email=$code_type=$user_type=0;\n\t\tif($this->_redis)\n\t\t{\n\t\t\t$data=$this->cache->get($authcode);\t\n\t\t\tif(!empty($data))\n\t\t\t{\n\t\t\t\t$data=json_decode($data);\n\t\t\t\t$user_id=$data->user_id;\n\t\t\t\t$email=$data->email;\n\t\t\t\t$code_type=$data->code_type;\n\t\t\t\t$user_type=$data->user_type;\t\n\t\t\t\t$this->cache->delete($authcode);\n\t\t\t\t$errorcode=true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t\tlog_message('error_tizi','17052:email verify code failed',array('authcode'=>$authcode));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n \t$this->db->select(\"id,user_id,email,code_type,user_type,generate_time\");\n \t$this->db->from($this->_table);\n \t $this->db->where(\"authcode\",$authcode);\n \t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_EMAIL);\n \t$query=$this->db->get();\n \t$total=$query->num_rows();\n \t$gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_EMAIL))>date(\"Y-m-d H:i:s\"))\n \t{\n \t$id=$query->row()->id;\n \t$user_id=$query->row()->user_id;\n \t$email=$query->row()->email;\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\t$user_type=$query->row()->user_type;\n \t$this->db->where('id',$id);\n \t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n \tif($this->db->affected_rows()==1) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n \t}\n \telse\n \t{\n \t\t$errorcode=false;\n \t}\n\t\t}\n return array('user_id'=>$user_id,'email'=>$email,'code_type'=>$code_type,'user_type'=>$user_type,'errorcode'=>$errorcode);\n\t}", "function users_user_activation($args)\n{\n $code = base64_decode(FormUtil::getPassedValue('code', (isset($args['code']) ? $args['code'] : null), 'GETPOST'));\n $code = explode('#', $code);\n\n if (!isset($code[0]) || !isset($code[1])) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n $uid = $code[0];\n $code = $code[1];\n\n // Get user Regdate\n $regdate = pnUserGetVar('user_regdate', $uid);\n\n // Checking length in case the date has been stripped from its space in the mail.\n if (strlen($code) == 18) {\n if (!strpos($code, ' ')) {\n $code = substr($code, 0, 10) . ' ' . substr($code, -8);\n }\n }\n\n if (DataUtil::hash($regdate, 'md5') == DataUtil::hash($code, 'md5')) {\n $returncode = pnModAPIFunc('Users', 'user', 'activateuser',\n array('uid' => $uid,\n 'regdate' => $regdate));\n\n if (!$returncode) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n LogUtil::registerStatus(__('Done! Account activated.'));\n return pnRedirect(pnModURL('Users', 'user', 'loginscreen'));\n } else {\n return LogUtil::registerError(__('Sorry! You entered an invalid confirmation code. Please correct your entry and try again.'));\n }\n}", "function authenticate_user($email_a, $passcode){\r\n\t//QUERY DATABASE/ACTIVE DIRECTORY TO SEE IF USER IS VALID\r\nif ($email == \"insert valid email b4 testing\") {\r\n\t/*** set a form token ***/\r\n\t$form_token = md5( uniqid('auth', true) );\r\n\t/*** set the session form token ***/\r\n\t$_SESSION['form_token'] = $form_token;\r\n\t$_SESSION['email_a'] = $email_a;\r\n\t$_SESSION['start_timestamp'] = date('Y-m-d HH:mm:s');\r\n\t$code = \"valid\";\r\n}else{\r\n\t$code = \"invalid\";\r\n\t}\r\necho return $code \"We were unable to validate your information, Please try again\";\r\n /*RETURNED TO CALLING CODE */\r\n\t}", "public function generate_password_activation_code($id,$email){\r\n \r\n \r\n $this->load->helper('string');\r\n \r\n $data = array(\r\n 'forgot_password_code' => random_string('unique'),\r\n 'forgot_password_code_expire' => date('Y-m-d H:i:s',strtotime(\"+24 hours\"))\r\n ); \r\n $this->db->update('members', $data, array('id' => $id,'aes_decrypt(email,salt)' => $email));\r\n $this->db->last_query();\r\n return $data['forgot_password_code'];\r\n }", "public function set_auth_code() {\n\t\t$tokens = new Token_User( '_indieauth_code_' );\n\t\t$tokens->set_user( self::$author_id );\n\t\treturn $tokens->set( static::$test_auth_code, 600 );\n\t}", "public function passwordResetCode();", "function generate_validation_code()\n {\r\n return hash_hmac($this->hash_function, $this->email,\r\n $this->created_at.hash($this->hash_function, $this->password));\r\n }", "function send_auth_code_at_login($user)\n{\n\t$user_info = get_userdata($user);\n\t\n\t$user_login = $user_info->data->user_login;\n\n\t$user_email = $user_info->data->user_email;\t\n\n\t$user_name = $user_info->data->first_name;\t\n\n\t$user_phone = get_user_meta( $user, 'user_phone', true );\n\t//$user_phone = urldecode($u_phone);\n\n\t$user_fname = get_user_meta( $user, 'first_name', true );\n\n\t$code = get_user_meta( $user, 'has_to_be_activated', true );\n\n\t$subject = 'Your New Authentication Code';\n\n\n\t$message1 = \"<html><body style='background:#f3f3f3;padding:20px 0;'><table border='0' cellpadding='0' cellspacing='0' style='margin:auto; max-width: 520px;width:100%;font-family: Arial;padding:20px;background:#fff;'><tbody>\";\n\t$message1 .=\"<tr><td style='font-size: 16px;'>Hello \".ucfirst($user_fname).\",</td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Welcome to Raise it Fast!</td></tr><tr height=30></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Please use this code to authenticate your account with Raise it Fast. <span style='background: #aaaaaa none repeat scroll 0 0;height: 45px;text-align: center;width: 101px;'>\".$code.\"</span></td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>'If you have any questions or concerns don't hesitate to use our website chat function, call us, or email us by going to our help page at \".site_url('/contact-us/').\" Or, you can simply reply to this email. '</td></tr><tr height=30></tr>\"; \n\t$message1 .=\"<tr><td style='font-size: 16px; margin-top: 20px;'>Thanks for becoming a part of the Raise It Fast community! </td></tr></tbody></table><table border='0' cellpadding='0' cellspacing='0' style='margin:20px auto 0; max-width: 520px;width:100%;'>\"; \n\n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'>1401 Lavaca St #503, Austin, TX 78701</td></tr><tr height=20></tr>\"; \n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'><a href=\".site_url().\" style='text-decoration:none; color: #999999;'>The Raise it Fast Team</a></td></tr>\"; \n\t$message1 .=\"</table></body></html>\";\n\n\twp_mail($user_email, $subject, $message1);\n\n//=========Send Auth Code Via Text message ==================//\n\n\t$account_sid = get_option('twilio_account_sid'); \n\t$auth_token = get_option('twilio_auth_token'); \n //require('lib/twilio-php-latest/Services/Twilio.php');\n\t$client = new Services_Twilio($account_sid, $auth_token); \n //$from = '+12182265630'; \n\t$from = get_option('twilio_phone_no');\n\n\ttry\n\t{\n\t\t$client->account->messages->sendMessage( $from, $user_phone, \"Hello $user_fname, Your Authentication code is $code\");\n\t}\n\tcatch (Exception $e)\n\t{ \n\n\t\techo \"11-\";\n\t}\n}", "function getNewAuthCodeFinal($authDetails)\n{\n $params = array('response_type'=>'code', 'client_id'=> $authDetails['client_id'], 'redirect_uri'=> $authDetails['redirect_uri'], 'state'=> 'xyz');\n header('Location: ' . $authDetails['authorization_code_endpoint'] . '?' . http_build_query($params));\n die();\n}", "function send_authcode_email($authcode,$email,$code_type=0)\n\t{\n\t\t$this->load->library(\"mail\");\n\t\t$this->load->model('login/register_model');\n\t\t$msg_head=$msg_end=$lang=$link=$stuid='';\n\n\t\tif($this->_user_id)\n\t\t{\n\t\t\t$user_info=$this->register_model->get_user_info($this->_user_id);\n\t\t\tif($user_info['errorcode'] && $user_info['user']->student_id)\n\t\t\t{\t\t\n\t\t\t\t$stuid='您的学号是:'.$user_info['user']->student_id.'<br />';\n\t\t\t}\n\t\t}\n\n\t\tswitch($code_type)\n\t\t{\n\t\t\tcase Constant::CODE_TYPE_REGISTER: $link=\"verify\";$lang=\"verify\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PASSWORD: $link=\"forgot/reset\";$lang=\"reset\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_EMAIL: $link=\"verify\";$lang=\"update_email\";break;\n\t\t\tcase Constant::CODE_TYPE_REGISTER_VERIFY_EMAIL: $link=\"verify\";$lang=\"reg_reverify\";break;\n\t\t\tcase Constant::CODE_TYPE_LOGIN_VERIFY_EMAIL: $link=\"verify\";$lang=\"login_reverify\";break;\n\t\t\tdefault:break;\n\t\t}\n\n\t\tif($lang && $link)\n\t\t{\t\n\t\t\t//$authcode=site_url().$link.\"?code=\".$authcode;\n\t\t\t$authcode=login_url().$link.\"/code/\".$authcode;\n\t\t\t$subject=$this->lang->line('mail_subject_'.$lang);\n\t\t\t$msg_body=str_replace('{email}',$email,$this->lang->line('mail_body_'.$lang));\n\t\t\t\n\t\t\t$msg_body=str_replace('{stuid}',$stuid,$this->lang->line('mail_body_'.$lang));\n\t\t\t$msg_end=$this->lang->line('mail_end_'.$lang);\t\t\t\n\t\t}\n\t\t$msg=$msg_body.'<br /><a href=\"'.$authcode.'\">'.$authcode.'</a><br />'.$msg_end.'<br/>'.$this->lang->line('mail_disclaimer');\n\n\t\t$ret = Mail::send($email, $subject, $msg);\n\t\tif($ret['ret']==1)\n\t\t{\n\t\t\t$errorcode=true;\n\t\t\tlog_message('info_tizi','170101:Email send success',$ret);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t\tlog_message('error_tizi','17010:Email send failed',$ret);\n\t\t}\n\t\treturn array('errorcode'=>$errorcode,'send_error'=>implode(',',$ret));\n\t}", "public function activateAccount($code, $email)\n {\n\n // define all the global variables\n global $database, $message, $functions;\n\n // escape the given strings\n $code = $this->secureInput($code);\n $email = $this->secureInput($email);\n\n // start the checks\n if (empty($code) || empty($email)) {\n $message->setError(\"Code/Email fields most not be empty\", Message::Error);\n return false;\n }\n\n // check if email exists\n if (!$functions->emailExist($email)) {\n $message->setError(\"The provided email is not in our database.\", Message::Error);\n return false;\n }\n\n // check if the given code matches the required characters\n if (strlen($code) < 20 || strlen($code) > 20) {\n $message->setError(\"The given code has to be exactly 20 characters long\", Message::Error);\n return false;\n }\n\n // check if account already has been activated\n if ($functions->isUserActivated($email, true)) {\n $message->setError(\"The account is already activated\", Message::Error);\n return false;\n }\n\n $sql = \"SELECT * FROM \" . TBL_USERS . \" WHERE \" . TBL_USERS_EMAIL . \" = '\" . $email . \"' AND \" . TBL_USERS_ACTIVATION_CODE . \" = '\" . $code . \"'\";\n\n // get the sql results\n $result = $database->getQueryResults($sql);\n if ($database->anyError()) {\n return false;\n }\n\n // check if wrong code has been used\n if ($database->getQueryNumRows($result, true) < 1) {\n $message->setError(\"Wrong activation code has been used.\", Message::Error);\n return false;\n }\n\n //update the user account with the needed information\n $sql = \"UPDATE \" . TBL_USERS . \" SET \" . TBL_USERS_ACTIVATED . \" ='1',\" . TBL_USERS_ACTIVATION_CODE . \"='' WHERE \" . TBL_USERS_EMAIL . \" = '\" . $email . \"' AND \" . TBL_USERS_ACTIVATION_CODE . \" = '\" . $code . \"'\";\n\n // get the sql results\n $database->getQueryResults($sql);\n if ($database->anyError()) {\n return false;\n }\n\n $message->setSuccess(\"Your account has been activated successfully !\");\n return true;\n }", "public function getNewAuthCode()\n {\n // TODO: Implement getNewAuthCode() method.\n }", "function password_change_login($email, $password, $verification_code) {\n\t\tglobal $pdo;\n\n\t\t//empty or array check\n\t\tif(empty($email) || is_array($email) || empty($password) || is_array($password) || empty($verification_code) || is_array($verification_code)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t//check if user exists\n\t\t$sql = \"SELECT id FROM user WHERE verification_code = :verification_code AND REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 1 AND TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, code_generation_time)) <= 600\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindParam(\":verification_code\", $verification_code, PDO::PARAM_STR);\n\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t$sth->execute();\n\n\t\tif($sth->rowCount() == 0) {\n\t\t\treturn 2;\n\t\t}\n\n\t\t//check if password meet our requirements\n\t\tif(!password_security_check($password)) {\n\t\t\treturn 3;\n\t\t}\n\n\t\t//hash password\n\t\t$password_hash = password_hash($password, PASSWORD_BCRYPT);\n\t\t//get id\n\t\t$id = $sth->fetch()[\"id\"];\n\n\t\t//change password\n\t\t$sql = \"UPDATE user SET verification_code = NULL, code_generation_time = NULL, password = :password_hash WHERE id = :id\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindParam(\":password_hash\", $password_hash, PDO::PARAM_STR);\n\t\t$sth->bindParam(\":id\", $id, PDO::PARAM_INT);\n\t\t$sth->execute();\n\t\treturn 0;\n\t}", "function check_authcode_phone($phone,$code_type,$user_id=\"\")\n {\n\t\tif($phone)\n\t\t{\n\t\t\tif($this->_redis)\n\t\t\t{\n\n\t\t\t\t$errorcode=$this->check_auth('phone',sha1($phone));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"phone\",sha1($phone));//需要通过服务获得加密后的电话号码\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" - \".Constant::SEND_AUTHCODE_INTERVAL_PHONE)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n }", "function authCode($r,$extra='')\t{\n\t\t$l=$this->codeLength;\n\t\tif ($this->conf['authcodeFields'])\t{\n\t\t\t$fieldArr = t3lib_div::trimExplode(',', $this->conf['authcodeFields'], 1);\n\t\t\t$value='';\n\t\t\twhile(list(,$field)=each($fieldArr))\t{\n\t\t\t\t$value.=$r[$field].'|';\n\t\t\t}\n\t\t\t$value.=$extra.'|'.$this->conf['authcodeFields.']['addKey'];\n\t\t\tif ($this->conf['authcodeFields.']['addDate'])\t{\n\t\t\t\t$value.='|'.date($this->conf['authcodeFields.']['addDate']);\n\t\t\t}\n\t\t\t$value.=$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];\n\t\t\treturn substr(md5($value), 0,$l);\n\t\t}\n\t}", "public function verify_actcode($member_email, $code){\n\t\t//$newCode = $this->make_activation_code();\n\t\t$mysql = New Mysql();\n\t\treturn($mysql->update_activation_code($member_email, $code));\n\t}", "function executeCommandAUTH(&$SMSGW, $argument = null)\n{\n $code = $SMSGW->getAndSaveAuthCode();\n\n if ($code > 9999 && $code < 100000)\n {\n return $SMSGW->sendMessage('Auth code: ' . $code);\n }\n else\n {\n $SMSGW->log(__FUNCTION__, 'Unable to save auth code to db or invalid code - ' . $code);\n return false;\n }\n}", "public function activationCode();", "public function generateSignCodes() {\n $users = $this->connection->fetchAll('SELECT * FROM [reg_users]');\n \n if ($users) {\n foreach ($users as $user) {\n $data = array(\n 'signin_hash%s' => $this->generateUserHash($user, 'sign_in'),\n 'signoff_hash%s' => $this->generateUserHash($user, 'sign_off')\n );\n \n $this->connection->query('UPDATE [reg_users] SET', $data, 'WHERE [user_id] = %i', $user['user_id']);\n }\n }\n \n }", "private function generate_code() {\n\t\t$secret = $this->code_generator->createSecret();\n\t\t$code = $this->code_generator->getCode($secret);\n\t\treturn array('secret'=>$secret, 'code'=>$code);\n\t}", "function password_change($email) {\n\t\tglobal $pdo;\n\n\t\t//empty or array check\n\t\tif(empty($email) || is_array($email)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t//check if user exists\n\t\t$sql = \"SELECT id FROM user WHERE REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 1\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t$sth->execute();\n\n\t\tif($sth->rowCount() == 0) {\n\t\t\treturn 2;\n\t\t}\n\n\t\t//get the id of the user\n\t\t$id = $sth->fetch()[\"id\"];\n\n\t\t//generate verification code\n\t\t$verification_code = hash(\"sha256\", microtime() . (string)rand() . $email);\n\n\t\t//get data required for email\n\t\t$change_link = \"https://swapitg.com/changepassword/$verification_code\";\n\t\t$subject = \"Change Passsword\";\n\t\t$mailfile = fopen(__DIR__ . \"/change_password_mail_template.html\", \"r\") or die(\"Unable to open file!\");\n\t\t$message = strtr(fread($mailfile, filesize(__DIR__ . \"/change_password_mail_template.html\")), array('$change_link' => $change_link));\n\t\tfclose($mailfile);\n\t\t$sender_email = \"[email protected]\";\n\t\t$sender_name = \"SwapitG no-reply\";\n\n\t\t//send email\n\t\tif(mail($email, $subject, wordwrap($message, 70, \"\\r\\n\"), \"From: $sender_name<$sender_email>\\r\\nContent-type: text/html; charset=utf-8\", \" -f \" . $sender_email)) {\n\t\t\t//set the verification code\n\t\t\t$sql = \"UPDATE user SET verification_code = :verification_code, code_generation_time = CURRENT_TIMESTAMP WHERE id = :id\";\n\t\t\t$sth = $pdo->prepare($sql);\n\t\t\t$sth->bindParam(\":verification_code\", $verification_code, PDO::PARAM_STR);\n\t\t\t$sth->bindParam(\":id\", $id, PDO::PARAM_INT);\n\t\t\t$sth->execute();\n\n\t\t\treturn 0;\n\t\t} else {\n\t\t\treturn 3;\n\t\t}\n\t}", "function verify($email,$code)\n {\n $sql = \"SELECT id\n FROM\n user\n WHERE\n verification = '$code'\n AND\n email='$email'\n \";\n $query = $this->db->query($sql);\n if($query->num_rows()>0)\n {\n $row = $query->row();\n $update['verification'] = 'done';\n $update['status'] = 1;\n $this->db->where('id', $row->id);\n $this->db->update('user', $update);\n return $row->id;\n }\n }", "function emailpasswordresetcode($username, $email){\n\t$to=$email;\n\t$errortype = 98;\n\t$errorcode = generateerrorcode($username,$email);\n\t$db=usedb();\n\t//make sure the user provided input is safe\n\t$username=mysqli_real_escape_string($db, $username);\n\t$email=mysqli_real_escape_string($db, $email);\n\t$errorcode=mysqli_real_escape_string($db, $errorcode);\n\t$sql=<<<SQL\n\t\tUPDATE users\n\t\tSET users.PassWord=MD5('$errorcode'), users.ErrorType=$errortype, users.ErrorCode='$errorcode'\n\t\tWHERE (users.UserName='$username' AND users.Email='$email')\nSQL;\n\tmysqli_query($db, $sql);\n\t$rows=mysqli_affected_rows($db);\n\tif(!$rows){\n\t\tmysqli_close($db);\n\t\treturn 0;\n\t}else{//the update was successful so we can try to get the display name and sent the email\n\t\t$sql=<<<SQL\n\t\t\tSELECT users.DisplayName\n\t\t\tFROM users\n\t\t\tWHERE (users.UserName = '$username')\nSQL;\n\t\t$result = mysqli_query($db, $sql);\n\t\t$rows = mysqli_num_rows($result);\n\t\tmysqli_close($db);\n\t\tif(!$rows){\n\t\t\treturn 0;\n\t\t}else{\t//if we have an author with that id\n\t\t\t//get the information in the result\n\t\t\t$assoc = mysqli_fetch_assoc($result);\n\t\t\t$displayname = $assoc['DisplayName'];\n\t\t\t//Send the email\n\t\t\t$subject=\"Collabor8r Password Reset\";\n\t\t\t$helpaddress=emailaddress(\"help\");\n\t\t\t$header=\"From: Collabor8r User Services <$helpaddress>\";\n\t\t\t$text = <<<TEXT\nDear $displayname,\nAs per your request, we have reset your password.\nTemporary Password: $errorcode\nUpon logging in with this password, you will need to change your password to regain access to all of our services.\nThank you for your continued patronage. If you ever have suggestions about our services, please don't hesitate to contact us.\nThe CollaboR8R Team.\nIf you did not request this email, please forward this it to [email protected].\nTEXT;\n\t\t\tmail($to,$subject,$text,$header);\n\t\t\treturn 1;\n\t\t}\n\t}\n\t//if we get past the point, the email didn't get sent so return 0\n\treturn 0;\n}", "public static function reissue_verification() {\n $email = $_POST[\"email\"];\n // Fetch whether the email is verified information\n try {\n $request = DB::query(\"SELECT `Verified` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n\n // Check if the email is actually registered\n if ($request) {\n $verified_status = $request[0][\"Verified\"];\n // Determine whether the email is verified\n if ($verified_status == 1) {\n // Check if users has a password\n try {\n $pass_request = DB::query(\"SELECT `Password` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n if ($pass_request) {\n return 3;\n } else {\n return 4;\n }\n } else {\n // Gather required data \n try {\n $username = DB::query(\"SELECT `Username` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email))[0][\"Username\"];\n } catch (PDOException $e) {\n return 1;\n }\n $vercode = sha1(time());\n try {\n DB::query(\"UPDATE `Users` SET Vercode=:ver WHERE Email=:email;\", array(\":ver\" => $vercode, \":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n $to = $email;\n $headers = <<<MESSAGE\nFROM: George || [email protected]\nContent-Type: text/plain;\nMESSAGE;\n $subject = \"Verification code re-issue\";\n $msg = <<<EMAIL\nHi $username,\n\nYou've requested for a new verification code to be issued!\nPlease follow this <a href='https://flatdragons.com/signup.php?user=$username&ver=$vercode'>link</a> to confirm your account with us :)\n\nKind regards,\nGeorge (FlatDragons)\nEMAIL;\n mail($to, $subject, $msg, $headers);\n return 0;\n }\n } else {\n return 2;\n }\n }", "public function check_register_code($user_login)\n {\n // Wrong Token Message\n $wrong_token = array(\n 'message' => __('Your authentication code is incorrect', 'wordpress-acl')\n );\n\n // Only Check Register Code\n if (isset($_REQUEST['do_action']) and $_REQUEST['do_action'] == \"check_register_code\") {\n\n // Get User Mobile\n $user_mobile = $user_login;\n $code = sanitize_text_field($_REQUEST['code']);\n\n // Check User Code\n $code_query = self::check_user_opt_code($code, 'mobile', $user_mobile);\n if ($code_query != false and self::check_expire_time_user_otp($code_query) === true) {\n // True\n wp_send_json_success(array(\n 'code' => $code\n ), 200);\n } else {\n // False\n wp_send_json_error($wrong_token, 400);\n }\n }\n\n // Check User code in Register\n if (!isset($_REQUEST['code']) || (isset($_REQUEST['code']) and empty($_REQUEST['code']))) {\n wp_send_json_error($wrong_token, 400);\n }\n $code_query = self::check_user_opt_code($_REQUEST['code'], 'mobile', $user_login);\n if ($code_query === false) {\n wp_send_json_error($wrong_token, 400);\n }\n if (self::check_expire_time_user_otp($code_query) === false) {\n wp_send_json_error(array(\n 'message' => __('Your authentication code has expired', 'wordpress-acl')\n ), 400);\n }\n\n // Check Persian first_name and last_name\n if(empty($_REQUEST['first_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خود را وارد نمایید'\n ), 400);\n }\n if(empty($_REQUEST['last_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را وارد نمایید'\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['first_name']) ===false) {\n wp_send_json_error(array(\n 'message' => __('لطفا نام خود را به فارسی وارد کنید', 'wordpress-acl')\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['last_name']) ===false) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را به فارسی تایپ کنید'\n ), 400);\n }\n }", "function send_authcode_phone($authcode,$phone,$code_type=0)\n\t{\n\t\t$this->load->library('sms');\n\n\t\t$msg_head=$msg_end=$lang='';\n\t\tswitch($code_type)\n\t\t{\n\t\t\tcase Constant::CODE_TYPE_REGISTER: $lang=\"verify\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PASSWORD: $lang=\"reset\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PHONE: $lang=\"update_phone\";break;\n\t\t\tdefault:break;\n\t\t}\n\n\t\tif($lang)\n\t\t{\n\t\t\t$msg_head=str_replace('{phone}',substr($phone,-4),$this->lang->line('phone_body_'.$lang));\n\t\t\t$msg_end=$this->lang->line('phone_end_'.$lang);\t\t\t\n\t\t}\n\t\t$msg=$msg_head.$authcode.$msg_end;\n\n \t$this->sms->setPhoneNums($phone);\n \t$this->sms->setContent($msg);\n\t\t$sms_error=$this->sms->send();\t\n\t\tif($sms_error['error']==\"Ok\")\n\t\t{\n\t\t\t $errorcode=true;\n\t\t\t log_message('info_tizi','170111:Sms send success',$sms_error);\t\n\t\t}\n\t\telse \n\t\t{\n\t\t\t$errorcode=false;\n\t\t\tif($sms_error['status']==3) $sms_error['error']=$this->lang->line('error_sms_invalid_phone');\n\t\t\telse $sms_error['error']=$this->lang->line('error_sms_normal');\n\t\t\tlog_message('error_tizi','17011:Sms send failed',$sms_error);\n\t\t}\n\t\treturn array('errorcode'=>$errorcode,'error'=>$sms_error['error'],'status'=>$sms_error['status']);\n\t}", "private function generateForgotPasswordCode($email)\n {\n try {\n $forgot_password_code = $this->generateRandomString(self::FORGOT_PASSWORD_CODE_LENGTH);\n $db_query = $this->db->prepare(\"UPDATE users SET forgot_password_code=:forgot_password_code \n WHERE email=:email AND verified=1 LIMIT 1\");\n $db_query->bindParam(':forgot_password_code', $forgot_password_code);\n $db_query->bindParam(':email', $email);\n $db_query->execute();\n if ($db_query->rowCount()) {\n return $forgot_password_code;\n }\n } catch (PDOException $e) {\n DBErrorLog::loggingErrors($e);\n return false;\n }\n }", "abstract public function getPaymentAuthorizationCode();", "function rest_authorization_required_code()\n {\n }", "public function verify_code($params) {\n\n $verification_code = $params['verification_code'];\n $code_id = $params['code_id'];\n\n $options = array('body'=> array());\n $options['body']['code']= ['verify'=> $verification_code];\n\n $uri = $code_id.\"/verify\";\n $uri = \"/cpaas/auth/v1/\".$this->client->user_id.\"/codes/\".$uri;\n $url = $this->client->_root.$uri;\n $response = $this->client->_request(\"PUT\", $url, $options);\n\n // check if test response\n if ($this->client->check_if_test($response)) {\n return $response;\n }\n // check if error response\n // if ($this->client->check_if_error($response)) {\n // $response = $this->client->build_error_response($response);\n // return $response;\n // }\n\n if ($response->getStatusCode() == 204) {\n $custom_response = ['verified'=> true, 'message'=> 'Success'];\n } else {\n $custom_response = ['verified'=> false, 'message'=> 'Code invalid or expired'];\n }\n\n return $custom_response;\n }", "static function getNewCode()\n {\n $code = null;\n while (true) {\n $code = \\User::make_password(8, false);\n if (!self::codeExists($code)) break;\n }\n return $code;\n }", "function activate_user()\n{\n if($_SERVER['REQUEST_METHOD'] == \"GET\"){\n if(isset($_GET['email'])){\n $email=clean($_GET['email']);\n $validation_code=clean($_GET['code']);\n $sql=\"SELECT id FROM users WHERE email='\".escape($_GET['email']).\"' AND validation_code='\".escape($_GET['code']).\"'\";\n $result=query($sql);\n if(row_count($result)==1){\n $sql2=\"UPDATE users SET active=1, validation_code=0 WHERE email='\" .escape($email).\"' AND validation_code='\".escape($validation_code).\"'\";\n $result2=query($sql2);\n set_message(\"<p class='bg-success'>Your account has been activated please login</p>\");\n redirect(\"login.php\");\n }else{\n set_message(\"<p class='bg-danger'>Your account could not be activated</p>\");\n redirect(\"login.php\");\n }\n\n }\n\n\n }\n}", "private function checkingApiCanAuthenticateCode($auth_code)\n {\n return $this->api_request->get(\"user\",\"validate_user_code\",$params=array('code'=>$auth_code)); \n }", "function verify_authcode_phone($authcode,$phone,$verify=true)\n\t{\n\t\t$user_id=$code_type=0;\n if($this->_redis)\n {\n $data=$this->cache->get($authcode.'_'.sha1($phone));\n if(!empty($data))\n {\n $data=json_decode($data);\n $user_id=$data->user_id;\n $code_type=$data->code_type;\n\t\t\t\tif($verify) $this->cache->delete($authcode.'_'.sha1($phone));\n $errorcode=true;\n }\n else\n {\n $errorcode=false;\n log_message('error_tizi','17051:phone verify code failed',array('phone'=>$phone));\n }\n }\n else\n\t\t{\n\t\t\t$this->db->select(\"id,user_id,phone,code_type,generate_time\");\n\t\t\t$this->db->from($this->_table);\n\t\t\t$this->db->where(\"authcode\",$authcode);\n\t\t\t//加密手机号码\t\n\t\t\t$e_phone=sha1($phone);\t\n\t\t\n\t\t\t$this->db->where(\"phone\",$e_phone);\n\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_PHONE);\n\t\t\t$query=$this->db->get();\t\n\t\t\t$total=$query->num_rows();\n\t\t\tif($total) $gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_PHONE))>date(\"Y-m-d H:i:s\"))\n\t\t\t{\n\t\t\t\t$id=$query->row()->id;\n\t\t\t\t$user_id=$query->row()->user_id;\n\t\t\t\t//$phone=$query->row()->phone;//电话号码已加密\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\tif($verify)\n\t\t\t\t{\n\t\t\t\t\t$this->db->where('id',$id);\n\t\t\t\t\t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n\t\t\t\t\tif($this->db->affected_rows()==1) $errorcode=true;\n\t else $errorcode=false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$errorcode=true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t}\n\t\t}\n\t\treturn array('user_id'=>$user_id,'phone'=>$phone,'code_type'=>$code_type,'errorcode'=>$errorcode);\n\t}", "function activate_user(){\n\n // use the get request since the user information \n // has been post \n if($_SERVER['REQUEST_METHOD'] == \"GET\"){\n\n if(isset($_GET['email'])) {\n \n $email = clean($_GET['email']);\n $validation_code = clean($_GET['code']);\n \n // select the user in the database \n $sql = \"SELECT id FROM users WHERE email ='\".escape($_GET['email']).\"' AND validation_code = '\".escape($_GET['code']).\"'\";\n $result = query($sql); // get the result \n\n // if the user exists in the database, activate the account by updating active by 1\n // Then the user is redirected to the login page to login \n if(row_count($result)==1){\n\n $sql2 = \"UPDATE users SET active = 1, validation_code = 0 WHERE email = '\".escape($email).\"' AND validation_code = '\".escape($validation_code).\"'\";\n $result2 = query($sql2);\n\n set_message(\"<p class='bg-success'> Your account has been activated please login</p>\");\n \n redirect(\"login.php\");\n }\n else{ // if the user is not activated display an error message\n // and redirect the user to the login page\n\n set_message(\"<p class='bg-danger'> Sorry Your account has not been activated</p>\");\n \n redirect(\"register.php\"); \n\n } \n }\n\n} // GET \n\n}", "public function test_auth_code_redemption_with_email() {\n\t\tstatic::$test_auth_code['scope'] = 'profile email';\n\t\t$code = $this->set_auth_code();\n\t\t$response = $this->create_form( 'POST', \n\t\t\t\tarray(\n\t\t\t\t\t'grant_type' => 'authorization_code',\n\t\t\t\t\t'code' => $code,\n\t\t\t\t\t'client_id' => 'https://app.example.com',\n\t\t\t\t\t'redirect_uri' => 'https://app.example.com/redirect',\n\t\t\t\t)\n\t\t);\n\t\t$this->assertEquals( 200, $response->get_status(), 'Response: ' . wp_json_encode( $response ) );\n\t\t$data = $response->get_data();\n\t\t$this->assertArrayNotHasKey( 'access_token', $data );\n\t\t$this->assertEquals( \n\t\t\tarray( \n\t\t\t\t'me' => get_author_posts_url( static::$author_id ),\n\t\t\t\t'profile' => indieauth_get_user( static::$author_id, true )\n\t\t\t), \n\t\t\t$data, \n\t\t\t'Response: ' . wp_json_encode( $data ) \n\t\t);\n\t\t// Reset Just in Case.\n\t\tunset( static::$test_auth_code['scope'] );\n\t}", "public function getCode()\n {\n return $this->isSuccessful() ? $this->data[\"AuthCode\"] : parent::getCode();\n }", "public function testGenerateAddressAuthCode()\n {\n\n }", "public function get_auth_code( $code ) {\n\t\t$tokens = new Token_User( '_indieauth_code_' );\n\t\treturn $tokens->get( $code );\n\t}", "function register_user($first_name, $last_name, $username, $password, $email){\n\n // call the escape function to escape the variable \n // to prevent sql injecction \n\n $first_name = escape($first_name); \n $last_name = escape($last_name);\n $username = escape($username);\n $password = escape($password);\n $email = escape($email);\n \n\n // if the user enters an email that is already taken \n // deny the registration\n\n if(email_exists($email)){\n \n return false; \n }\n\n // if the user enters a username that is already taken\n // deny the registration \n else if(username_exists($username)){\n\n return false; \n\n } \n else \n { // if the user information is verified proceed to insertion in the user table \n\n\n // encrypt the message using password to encrypt the message \n $password = password_hash($password, PASSWORD_BCRYPT, array('cost'=>12));\n\n $validation_code = md5($username . microtime()); // create random validation codes\n\n // insert the user information to the user table with the validation code\n // Also make sure that the user activation state is set to 0 for this moment \n $sql = \"INSERT INTO users(first_name, last_name, username, password ,validation_code, active, email)\";\n $sql.= \"VALUES('$first_name','$last_name','$username','$password','$validation_code',0, '$email')\";\n\n $result = query($sql); // send the information\n\n // send a link to the user email with the validation code\n $subject = \"Activate Account\";\n $msg = \"Please click the link below to activate your account \n \n <a href =\\\"\".Config::DEVELOPMENT_URL.\"/activate.php?email=$email&code=$validation_code\\\">\n \n LINK HERE</a>\"; \n \n \n // setup a email header \n $headers = \"From: noreply@localhost\";\n\n // send the link\n send_email($email, $subject, $msg, $headers);\n\n return true;\n \n }\n}", "public function getTwoStepVerificationCode();", "public function setCode($user,$el=false){\n\t\t$pwd=substr($user['password'],0,6);\n\t\t$agent=substr(md5(substr($_SERVER['HTTP_USER_AGENT'],0,20)),0,4);\n\t\t$data=array(\n\t\t\t\"u\"=>$user['userid'],\n\t\t\t\"p\"=>$pwd,\n\t\t\t\"a\"=>$agent,\n\t\t\t\"e\"=>time()+3600*24*2,\n\t\t);\n\t\t\n\t\t$authcode=jiami(json_encode($data));\n\t\t$data['el']=time()+3600*24*300;\n\t\t$authCodeLong=jiami(json_encode($data));\n\t\t$redata=array(\n\t\t\t\"authcode\"=>$authcode,\n\t\t\t\"authcodeLong\"=>$authCodeLong\n\t\t);\n\t\treturn $redata;\n\t}", "private function returnCodeMessage(int $code): string {\n $codes = [\n 211 => 'System status, or system help reply',\n 214 => 'Help message (A response to the HELP command)',\n 220 => '<domain> Service ready',\n 221 => '<domain> Service closing transmission channel',\n 235 => 'Authentication succeeded',\n 250 => 'Requested mail action okay, completed',\n 251 => 'User not local; will forward',\n 252 => 'Cannot verify the user, but it will try to deliver the message anyway',\n 334 => '(Server challenge - the text part contains the Base64-encoded challenge)',\n 354 => 'Start mail input',\n 421 => 'Service not available, closing transmission channel (This may be a reply to any command if the service knows it must shut down)',\n 432 => 'A password transition is needed',\n 450 => 'Requested mail action not taken: mailbox unavailable (e.g., mailbox busy or temporarily blocked for policy reasons)',\n 451 => 'Requested action aborted: local error in processing / IMAP server unavailable',\n 452 => 'Requested action not taken: insufficient system storage',\n 454 => 'Temporary authentication failure',\n 455 => 'Server unable to accommodate parameters',\n 500 => 'Syntax error, command unrecognized (This may include errors such as command line too long) / Authentication Exchange line is too long',\n 501 => 'Syntax error in parameters or arguments / Cannot Base64-decode Client responses / Client initiated Authentication Exchange (only when the SASL mechanism specified that client does not begin the authentication exchange)',\n 502 => 'Command not implemented',\n 503 => 'Bad sequence of commands',\n 504 => 'Command parameter is not implemented / Unrecognized authentication type',\n 521 => 'Server does not accept mail',\n 523 => 'Encryption Needed',\n 530 => 'Authentication required',\n 534 => 'Authentication mechanism is too weak',\n 535 => 'Authentication credentials invalid',\n 538 => 'Encryption required for requested authentication mechanism',\n 550 => 'Requested action not taken: mailbox unavailable (e.g., mailbox not found, no access, or command rejected for policy reasons)',\n 551 => 'User not local; please try <forward-path>',\n 552 => 'Requested mail action aborted: exceeded storage allocation',\n 553 => 'Requested action not taken: mailbox name not allowed',\n 554 => 'Transaction has failed (Or, in the case of a connection-opening response, \"No SMTP service here\") / Message too big for system',\n 556 => 'Domain does not accept mail',\n ];\n return $codes[$code] ?? '';\n }", "public function get_user_code()\n\t{\n\t\t$q_select_id = \"SELECT MAX(id) FROM tb_users\";\n\t\t$last_id = DB::connect()->query($q_select_id)->fetch_column();\n\t\tterner(not_filled($last_id), $last_id = 0, $last_id); // if last id is 0 then give it 0 value\n\n\t\t// get last user_code second number from tb_users\n\t\t$q_select_ucode = \"SELECT\n\t\t\tid as id,\n\t\t\tSUBSTR(user_code, 2, 1) as ucode\n\t\tFROM tb_users ORDER BY id DESC LIMIT 1\";\n\t\t$get_ucode_num = DB::connect()->query($q_select_ucode)->style(FETCH_ASSOC)->fetch();\n\t\tterner($get_ucode_num['ucode'] == 9, ($last_ucode = 0), ($last_ucode = 1 + $get_ucode_num['ucode'])); // if ucode reach 9 then reset it to 0\n\n\t\t// generate user code and setting up variables\n\t\t$gen_user_code = 2 . $last_ucode . $last_id;\n\t\t$user_code = $gen_user_code;\n\n\t\treturn $user_code;\n\t}", "function get_oauth_code($wpoa) {\n\t$params = array(\n\t\t'response_type' => 'code',\n\t\t'client_id' => CLIENT_ID,\n\t\t'scope' => SCOPE,\n\t\t'state' => uniqid('', true),\n\t\t'redirect_uri' => REDIRECT_URI,\n\t);\n\t$_SESSION['WPOA']['STATE'] = $params['state'];\n\t$url = URL_AUTH . http_build_query($params);\n\theader(\"Location: $url\");\n\texit;\n}", "public function oauthGenerateVerificationCode()\n {\n return substr(md5(rand()), 0, 6);\n }", "function authorize($args)\n{\n global $_zp_authority;\n $args = decode64($args);\n //debugLog('after decode: '.var_export($args, true));\n logger('authorize', ($args['loglevel']));\n if (!preg_match('#^1.4#', ($version = getVersion()))) {\n return new ZEN_Error(-2, 'Zenphoto version '.$version.' but v1.4.x required!');\n }\n $_zp_authority = new Zenphoto_Authority();\n $hash = $_zp_authority->passwordHash($args['loginUsername'], $args['loginPassword']);\n debugLog('hashvalue: '.$hash);\n $userobj = getAnAdmin([\n '`user`=' => $args['loginUsername'],\n '`valid`=' => 1,\n ]);\n if ($userobj == '') {\n return new ZEN_Error(-1, 'Incorrect username or password '.$args['loginUsername'].' '.$args['loginPassword']);\n } //$userobj == ''\n else {\n $localhash = $userobj->getPass();\n debugLog('hash = '.$hash.' localhash = '.$localhash);\n if ($hash == $localhash) {\n return true;\n } //$userobj\n else {\n return new ZEN_Error(-1, 'Incorrect username or password '.$args['loginUsername'].' '.$args['loginPassword']);\n }\n }\n}", "public function codeVerificationAction($header_data,$data){\n if( !isset($data['otp_no'])) {\n Library::logging('alert',\"API : codeVerification : \".ERROR_INPUT.\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_INPUT, null);\n } else {\n try {\n $user_id = $header_data['id'];\n $otp_no = $data['otp_no'];\n $user = Users::findById($user_id);\n \n $group = array();\n $db = Library::getMongo();\n $groups = $db->execute('return db.groups.find( { $and: [ { is_active: 1 }, { group_name: \"Friends\" } ] } ).toArray()');\n \n if($groups['ok'] == 0) {\n Library::logging('error',\"API : codeVerification (get groups) mongodb error: \".$groups['errmsg'].\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_REQUEST, null);\n }\n array_push($group,(string)$groups['retval'][0][_id]);\n if($user->otp == $otp_no) {\n if($user->is_active == 1) {\n // user already exist\n } else {\n $user->is_active = 1;\n $user->username = \"user\";\n $user->context_indicator = \"Available\";\n $user->my_mind_groups = $group;\n $user->about_me_groups = $group;\n $user->my_pictures_groups = $group;\n $user->unique_id = strtolower( uniqid() );\n $user->is_edit = 0;\n $user->is_searchable = 1;\n $user->is_mobile_searchable = 1;\n $user->save();\n }\n Library::output(true, '1', OTP_VERIFIED, null);\n } else {\n Library::logging('alert',OTP_WRONG.\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', OTP_WRONG, null);\n }\n } catch (Exception $e) {\n Library::logging('error',\"API : codeVerification : \".$e.\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_REQUEST, null);\n }\n }\n }", "public function createVerificationCode()\n {\n return $code = random_int(config('twilio-verify.random_int.initial_value'), config('twilio-verify.random_int.final_value'));\n }", "function requestCode ($domain) {\n $url = 'https://' . $domain . '/oauth/authorize/' .\n '?client_id=' . urlencode(APP_ID);\n redirect($url);\n}", "public function make_new_password($member_email){\n\t\t$mysql = new Mysql();\n\t\t$newCode = $this->make_activation_code();\n\t\tif($this->utility_email( $this->get_newpass_msg($newCode , $member_email ), $member_email, \"Смена пароля\" ) ){\n\t\t\treturn($mysql->update_activation_code($member_email, $newCode)); \t\n\t\t} \n\t\t\n\t}", "public function authorize_result()\n\t{\t\n\t\tif(isset($_GET['code']))\n\t\t{\n\t\t\tif($this->oauth->ci->session->userdata('state') !== $_GET['state'])\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('failure', array(\n 'error' => $this->oauth->ci->lang->line('error_xsfr_victim')\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('success', array(\n\t\t\t\t\t\t'token' => $_GET['code'],\n\t\t\t\t\t\t'state' => $_GET['state']\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(isset($_GET['error']))\n\t\t{\n\t\t\treturn $this->oauth->response('failure', array(\n\t\t\t\t\t'error' => $_GET['error_description']\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}", "function generate_auth() {\n\treturn sprintf('%08x%08x%08x%08x',\n\t\tmt_rand(0, 0xffffffff), mt_rand(0, 0xffffffff),\n\t\tmt_rand(0, 0xffffffff), mt_rand(0, 0xffffffff));\n}", "function oaupostgrad_admin_activator($email, $email_code)\n\t{\n\n\t\tglobal $Oau_auth;\n\t\t$email \t\t\t= \tsanitize($email);\n\t\t$email_code\t\t=\tsanitize($email_code);\n\t\t$deactivator\t=\t0;\n\t\t$activator \t\t=\t1;\n\n\t\t$query1 = \"SELECT `admin_Idn` FROM `administrator` WHERE `email` = '$email' AND `email_code` = '$email_code' AND `active` = $deactivator\";\n\t\t$run_query1 = mysqli_query($Oau_auth, $query1);\n\n\t\tif(mysqli_num_rows($run_query1) > 0)\n\t\t{\n\n\t\t\t$query2 = \"UPDATE `administrator` SET `active` = $activator WHERE `email` = '$email' AND `email_code` = '$email_code'\";\n\t\t\t$run_query2 = mysqli_query($Oau_auth, $query2);\n\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t}", "public function getUserCode(){\n\t\t/* return user code */\n\t\treturn $this->_intUserCode;\n\t}", "public function verifyCode(CodeRequest $request )\n\t{\n\t\tif(!is_numeric($request->input('code'))){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\n\t\t$querry = \"SELECT * FROM \". DBTool::rawTable('users') . \" WHERE phone_token = '\" . $request->input('code') . \"' AND phone = '\" . $request->input('phone') . \"'\";\n\t\t$user = DB::select(DB::raw($querry));\n\n\t\t$user = ArrayHelper::fromObject($user);\n\n\t\t//if user enter wrong code\n\t\tif(!isset($user[0]['id']) && !isset($user[0]['phone']) ){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\t\t// SET THE CODE IS VERIFIED\n\t\t$querry = \"UPDATE \". DBTool::rawTable('users') . \" SET verified_phone = 1 WHERE id = '\" . $user[0]['id'] . \"'\";\n\t\t$updated = DB::update(DB::raw($querry));\n\t\t$updated = ArrayHelper::fromObject($updated);\n\n\t\t// Redirection\n\t\t// return $this->lastRecords($user[0]['phone']);\n\t\treturn redirect( '/end/registration/' . $user[0]['phone'] );\n\t}", "function register_user($first_name,$last_name,$username,$email,$password)\n{\n $first_name = escape($first_name);\n $last_name = escape($last_name);\n $username = escape($username);\n $email = escape($email);\n $password = escape($password);\n if (email_exists($email)) {\n return false;\n } elseif (username_exists($username)) {\n return false;\n } else {\n $password = md5($password);\n $validation_code = md5($username . microtime());\n $sql = \"INSERT INTO users(first_name, last_name, username, email, password, validation_code, active)\";\n $sql .= \" VALUES('$first_name','$last_name','$username','$email','$password','$validation_code',0)\";\n $result = query($sql);\n\n ///// sending email////////\n $subject = \"Activate Account\";\n $msg = \" Please click the link below to activate your account\n http://localhost/login/activate.php?email=$email&code=$validation_code \n \";\n $headers = \"From: [email protected]\";\n send_email($email, $subject, $msg, $headers);\n\n return true;\n }\n\n}", "public function changeCode($emailAddress,$sendUserTo) {\n\t\t\t\tif(($this->isEmailAddressInUse($emailAddress))) {\n\t\t\t\t\t$checkUser = \"SELECT userName FROM user WHERE email=:email\";\n\t\t\t\t\ttry {\n\t\t\t\t\t\t$stmt = $this->_db->prepare($checkUser);\n\t\t\t\t\t\t$stmt->bindParam(\":email\", $emailAddress, PDO::PARAM_STR);\n\t\t\t\t\t\t$stmt->execute();\n\t\t\t\t\t\t$row=$stmt->fetch();\n\t\t\t\t\t\t$username=$row['userName'];\n\t\t\t\t\t\t\tif(isset($username)){\n\t\t\t\t\t\t\t\tif(!($this->isUserActivated($username))) return \"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\telse{\n\t\t\t\t\t\t\t\t$stmt->closeCursor();\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch(PDOException $e) {\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}\n\t\t\t\telse {\n\t\t\t\t\treturn false;\t\t\t\t\n\t\t\t\t}\n\t\t\t\t//generate a new random code and add it to the database\n\t\t\t\t$confirmCode = md5(uniqid(rand()));\n\t\t\t\t$sql = \"UPDATE user SET confirmcode=:code WHERE email=:email\";\n\t\t\t\ttry{\n\t\t\t\t\t$stmt = $this->_db->prepare($sql);\n\t\t\t\t\t$stmt->bindParam(\":email\", $emailAddress, PDO::PARAM_STR);\n\t\t\t\t\t$stmt->bindParam(\":code\", $confirmCode, PDO::PARAM_STR);\n\t\t\t\t\t$stmt->execute();\n\t\t\t\t\tif($this->sendUpdatePassMail($emailAddress, $username, $confirmCode,$sendUserTo)){\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}catch(PDOException $e){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t\n\t}", "public function getForgottenPasswordCode() {\n\t\tif ($this->forgotten_password_code) return $this->forgotten_password_code;\n\n\t\t$code = getRandomString(20);\n\n\t\t$db = getDB();\n\t\t$s = $db->prepare(\"UPDATE user_account SET forgotten_password_code=:c, forgotten_password_code_generated_at=:at WHERE id=:id\");\n\t\t$s->execute(array('c'=>$code, 'id'=>$this->id,'at'=>date(\"Y-m-d H:i:s\")));\n\n\t\t$this->forgotten_password_code = $code;\n\t\treturn $code;\n\n\t}", "protected function getAuthorizationCode()\n {\n $code = null;\n if ($this->responseMode === 'query' && isset($_GET['code'])) {\n $code = $_GET['code'];\n } else if ($this->responseMode === 'form_post' && isset($_POST['code'])) {\n $code = $_POST['code'];\n }\n\n return $code;\n }", "public function testGenerateAddressAuthCodeById()\n {\n\n }", "function input_data($dbhost, $dbuname, $dbpass, $dbname, $prefix, $dbtype, $aid, $name, $pwd, $repeatpwd, $email)\r\n{\r\n if ($pwd != $repeatpwd) {\r\n echo _PWBADMATCH;\r\n exit;\r\n } else {\r\n echo \"<font class=\\\"pn-title\\\">\" . _INPUT_DATA_1 . \"</font>\";\r\n\r\n echo \"<center>\";\r\n global $dbconn;\r\n/*\r\n\t\tif ($dbtype == \"mysql\") {\r\n\t\t\tmysql_connect($dbhost, $dbuname, $dbpass);\r\n\t\t mysql_select_db(\"$dbname\") or die (\"<br><font class=\\\"pn-sub\\\">\" . _NOTSELECT . \"</font>\"); \r\n\t\t}\r\n\t\telse if ($dbtype == \"oci8\") {\r\n//\t\t\t $db = ADONewConnection($dbtype);\r\n//\t\t\t\t$dbconn= $db->Connect($dbhost, $dbuname, $dbpass, $dbname);\r\n\t\t}\r\n*/\r\n // Put basic information in first\r\n include(\"install/newdata.php\"); \r\n // new installs will use md5 hashing - compatible on windows and *nix variants.\r\n $pwd = md5($pwd);\r\n $pwd1 = md5('instructor');\r\n $pwd2 = md5('student');\r\n $pwd3 = md5('instructor2');\r\n\t\t$result = $dbconn->Execute(\"INSERT INTO \" . $prefix . \"_users VALUES ( '1', '$name', '$aid', '$email', \" . time() . \", '$pwd', '', '000000', '1', '', '1','0')\") or die (\"<b>\" . _NOTUPDATED . $prefix . \"_users</b>\");\r\n $result = $dbconn->Execute(\"INSERT INTO \" . $prefix . \"_users VALUES ( '2', 'instructor', 'instructor', '', \" . time() . \", '$pwd1', '', '000001', '1', '', '1','0')\") or die (\"<b>\" . _NOTUPDATED . $prefix . \"_users</b>\");\r\n $result = $dbconn->Execute(\"INSERT INTO \" . $prefix . \"_users VALUES ( '3', 'student', 'student', '', \" . time() . \", '$pwd2', '', '000002', '1', '', '1','0')\") or die (\"<b>\" . _NOTUPDATED . $prefix . \"_users</b>\");\r\n $result = $dbconn->Execute(\"INSERT INTO \" . $prefix . \"_users VALUES ( '4', 'instructor2', 'instructor2', '', \" . time() . \", '$pwd3', '', '000003', '1', '', '1','0')\") or die (\"<b>\" . _NOTUPDATED . $prefix . \"_users</b>\");\r\n echo \"<br><font class=\\\"pn-sub\\\">\" . $prefix . \"_users\" . _UPDATED . \"</font>\"; \r\n\r\n\t\t// group_membership table\r\n\t\t$table = $prefix.\"_group_membership\";\r\n\t\t$result = $dbconn->Execute(\"INSERT INTO $table VALUES ('1','1')\") or die (\"<b>\"._NOTUPDATED. \" $table</b>\");\r\n\t\t$result = $dbconn->Execute(\"INSERT INTO $table VALUES ('2','2')\") or die (\"<b>\"._NOTUPDATED. \" $table</b>\");\r\n\t\t$result = $dbconn->Execute(\"INSERT INTO $table VALUES ('4','3')\") or die (\"<b>\"._NOTUPDATED. \" $table</b>\");\r\n\t\t$result = $dbconn->Execute(\"INSERT INTO $table VALUES ('2','4')\") or die (\"<b>\"._NOTUPDATED. \" $table</b>\");\r\n } \r\n}", "function verifyemail() {\n\t$a = array(\n\t 'status' => 'system-error'\n\t);\n\n\t// raw inputs\n\t$taint_si = isset($_POST['si']) ? $_POST['si'] : 0;\n\t$taint_tic = isset($_POST['tic']) ? $_POST['tic'] : 0;\n\t$taint_pword = isset($_POST['pword']) ? $_POST['pword'] : 0;\n\n\t// validate inputs\n\t$si = validateToken($taint_si);\n\t$tic = validateTic($taint_tic);\n\t$pword = validatePword($taint_pword);\n\n\t// validate parameter set\n\tif (!$si || !$tic || !$pword) {\n\t\tLog::write(LOG_WARNING, 'attempt with invalid parameter set');\n\t\treturn $a;\n\t}\n\n\t// get db connection\n\t$conn = getConnection();\n\tif (!$conn) {\n\t\treturn $a;\n\t}\n\n\t// read token and user table\n\t$result = getUserByToken($conn, $si);\n\tif (!$result) {\n\t\treturn $a;\n\t}\n\n\t// get fields\n\t$row = pg_fetch_array($result, 0, PGSQL_ASSOC);\n\t$userid = $row['id'];\n\t$hashpassword = $row['hashpassword'];\n\t$auth = $row['auth'];\n\t$hashtic = $row['hashtic'];\n\t$oldemail = $row['email'];\n\n\t// verify user authentication state\n\tif (!isUserEmailPending($auth)) {\n\t \tLog::write(LOG_NOTICE, 'attempt to verify email on user not auth=email-pending');\n\t\treturn $a;\n\t}\n\n\t// verify the password\n\t$boo = verifyPassword($pword, $hashpassword);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid password');\n\t\treturn $a;\n\t}\n\n\t// verify the tic from the email\n\t$boo = verifyTic($tic, $hashtic);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid tic');\n\t\treturn $a;\n\t}\n\n\t// update user record\n\t$auth = DB::$auth_verified;\n\t$name = 'verify-email';\n\t$sql = \"update accounts.user set email=newemail, newemail='', auth=$1, hashtic=null, tmhashtic=null where id = $2\";\n\t$params = array($auth, $userid);\n\t$result = execSql($conn, $name, $sql, $params, true);\n\tif (!$result) {\n\t\treturn false;\n\t}\n\n\t// send security notice\n\t$boo = sendAuthenticationEmail($oldemail, 'changedemail', '');\n\tif (!$boo) {\n\t\t$a['status'] = 'send-email-failed';\n\t\treturn $a;\n\t}\n\n\t// success\n\t$a['status'] = 'ok';\n\t$a['auth'] = $auth;\n\treturn $a;\n}", "function generate_otp_code(){\n return rand(1000,9999);\n}", "public function generate_codes( $user, $args = '' ) {\n\t\t$codes = array();\n\t\t$codes_hashed = array();\n\n\t\t// Check for arguments.\n\t\tif ( isset( $args['number'] ) ) {\n\t\t\t$num_codes = (int) $args['number'];\n\t\t} else {\n\t\t\t$num_codes = self::NUMBER_OF_CODES;\n\t\t}\n\n\t\t// Append or replace (default).\n\t\tif ( isset( $args['method'] ) && 'append' === $args['method'] ) {\n\t\t\t$codes_hashed = (array) get_user_meta( $user->ID, self::BACKUP_CODES_META_KEY, true );\n\t\t}\n\n\t\tfor ( $i = 0; $i < $num_codes; $i++ ) {\n\t\t\t$code = $this->get_code();\n\t\t\t$codes_hashed[] = wp_hash_password( $code );\n\t\t\t$codes[] = $code;\n\t\t\tunset( $code );\n\t\t}\n\n\t\tupdate_user_meta( $user->ID, self::BACKUP_CODES_META_KEY, $codes_hashed );\n\n\t\t// Unhashed.\n\t\treturn $codes;\n\t}", "function oaupostgrad_users_activator($email, $email_code)\n\t{\n\n\t\tglobal $Oau_auth;\n\t\t$email \t\t\t= \tsanitize($email);\n\t\t$email_code\t\t=\tsanitize($email_code);\n\t\t$deactivator\t=\t0;\n\t\t$activator \t\t=\t1;\n\n\t\t$query1 = \"SELECT `student_Idn` FROM `student` WHERE `email` = '$email' AND `email_code` = '$email_code' AND `active` = $deactivator\";\n\t\t$run_query1 = mysqli_query($Oau_auth, $query1);\n\n\t\tif(mysqli_num_rows($run_query1) > 0)\n\t\t{\n\n\t\t\t$query2 = \"UPDATE `student` SET `active` = $activator WHERE `email` = '$email' AND `email_code` = '$email_code'\";\n\t\t\t$run_query2 = mysqli_query($Oau_auth, $query2);\n\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t}", "public function generateVerificationCode()\n {\n $code = $this->createVerificationCode();\n\n $codeExists = $this->validateVerificationCode($code);\n\n $generationLimit = 100;\n\n while($codeExists && $generationLimit > 0)\n {\n $code = $this->createVerificationCode();\n\n $codeExists = $this->validateVerificationCode($code);\n\n $generationLimit--;\n }\n\n $this->forceFill([\n 'verification_code' => $code\n ])->save();\n\n return $code;\n }", "function actiongetVerifyCode()\n\t{\n\t\t$jsonarray= array();\n\t\t\n\t\tif(isset($_POST['phone']))\n\t\t{\n\t\t\t$userObj=new Users();\n\t\t\tif(!is_numeric($_POST['phone'])){\n\t\t\t\t$algoencryptionObj\t=\tnew Algoencryption();\n\t\t\t\t$_POST['phone']\t=\t$algoencryptionObj->decrypt($_POST['phone']);\n\t\t\t}\n\t\t\t$result=$userObj->getVerifyCodeById($_POST['phone'],'-1');\n\t\t\t$jsonarray['status']=$result['status'];\n\t\t\t$jsonarray['message']=$result['message'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$message=$this->msg['ONLY_PHONE_VALIDATE'];\n\t\t\t$jsonarray['status']='false';\n\t\t\t$jsonarray['message']=$message;\n\t\t}\n\t\techo $jsonarray['message'];\n\t}", "public function authenticate_code($classname, $code){\n $query = \"SELECT classcode FROM classes where classname = $1;\";\n $query_result = pg_prepare($this->con, \"myquery15\", $query);\n $query_result = pg_execute($this->con, \"myquery15\", array($classname));\n $row = pg_fetch_row($query_result);\n if($row[0] == $code){ //Accesscode matched\n echo(\"Access Code matched\");\n return True;\n }\n else{return False;}\n\n\n }", "function createNewAccessCode()\n\t{\n\t\t// create a 5 character code\n\t\t$codestring = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n\t\tmt_srand();\n\t\t$code = \"\";\n\t\tfor ($i = 1; $i <=5; $i++)\n\t\t{\n\t\t\t$index = mt_rand(0, strlen($codestring)-1);\n\t\t\t$code .= substr($codestring, $index, 1);\n\t\t}\n\t\t// verify it against the database\n\t\twhile (!$this->isSurveyCodeUnique($code))\n\t\t{\n\t\t\t$code = $this->createNewAccessCode();\n\t\t}\n\t\treturn $code;\n\t}", "function generateCode(){\n $base=\"abcdefghijklmnopkrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-\";\n $i=0;\n $c=\"\";\n while ($i<6){\n $c.=$base[rand(0,strlen($base)-1)];\n $i++;\n }\n if (validate::existCode($c))\n return generateCode();\n return $c;\n}", "public function generateActivationCode($user) {\n // Random Number ( 6 digits )\n $code = 0;\n $min = 100001;\n $max = 999999;\n srand((double) microtime() * 1000000);\n \n if (function_exists('mt_rand')) {\n $code = mt_rand($min, $max); // faster\n }\n else {\n $code = rand($min, $max);\n }\n // Store Code in UserActivationCode Table\n $uac = UserActivationCode::where('user_id', $user->id)->first();\n if ($uac) {\n if (($uac->expiration-60) < time()) {\n // Keep OLD code before expiration - 1 min\n $code = $uac->code;\n } \n else {\n $uac->code = $code;\n $uac->expiration = time() + config('sc.activation_period');\n $uac->save();\n }\n }\n else {\n $uac = UserActivationCode::create([\n 'user_id' => $user->id, \n 'expiration'=> time() + config('sc.activation_period'), \n 'code' => $code\n ]);\n }\n\n return $code;\n }", "function register_resend_email($email) {\n\t\tglobal $pdo;\n\n\t\t//delete old registration attempts\n\t\t$pdo->query(\"DELETE FROM user WHERE verified = 0 AND TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, code_generation_time)) > 600\");\n\n\t\t//empty or array check\n\t\tif(empty($email) || is_array($email)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t//check if email exists and is not verified\n\t\t$sql = \"SELECT name, verification_code FROM user WHERE REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 0\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t$sth->execute();\n\n\t\tif($sth->rowCount() == 0) {\n\t\t\t//check if email exists but is already verified\n\t\t\t$sql = \"SELECT id FROM user WHERE REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 1\";\n\t\t\t$sth2 = $pdo->prepare($sql);\n\t\t\t$sth2->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t\t$sth2->execute();\n\n\t\t\tif($sth2->rowCount() == 0) {\n\t\t\t\treturn 2;\n\t\t\t} else {\n\t\t\t\treturn 3;\n\t\t\t}\n\t\t}\n\n\t\t//get data required for email\n\t\t$name_verification_code = $sth->fetch();\n\t\t$name = $name_verification_code[\"name\"];\n\t\t$verification_code = $name_verification_code[\"verification_code\"];\n\n\t\t$reg_link = \"https://swapitg.com/firstlogin/$verification_code\";\n\t\t$subject = \"Registration\";\n\t\t$mailfile = fopen(__DIR__ . \"/register_mail_template.html\", \"r\") or die(\"Unable to open file!\");\n\t\t$message = strtr(fread($mailfile, filesize(__DIR__ . \"/register_mail_template.html\")), array('$reg_link' => $reg_link, '$name' => htmlspecialchars($name)));\n\t\tfclose($mailfile);\n\t\t$sender_email = \"[email protected]\";\n\t\t$sender_name = \"SwapitG no-reply\";\n\n\t\t//send email\n\t\tif(mail($email, $subject, wordwrap($message, 70, \"\\r\\n\"), \"From: $sender_name<$sender_email>\\r\\nContent-type: text/html; charset=utf-8\", \" -f \" . $sender_email)) {\n\t\t\treturn 0;\n\t\t} else {\n\t\t\treturn 4;\n\t\t}\n\t}", "function motDePasseOublie($mail) { $userManager = new OpenClassrooms\\DWJP4\\Backend\\Model\\UsersManager();\n $emailExist = $userManager->emailExist($mail);\n if($emailExist){\n //S'il existe, on fabrique le code , on update le code , on envoi le message\n $pseudo=$emailExist[0]['USER_PSEUDO'];\n $code = codeValidation();\n //echo $pseudo;\n // echo \" code : \".$code;\n $updatePassword = $userManager->updatePsswd($code,$pseudo);\n $message = messagePasswdOublie($mail,$code);\n //echo $message;\n }else {\n //echo \"pas de mail exist\";\n }\n // on retourne sur la page d'identification\n require ('view/backend/identificationView.php'); \n}", "public function insert () {\n\t\t$insertObj = ORM::for_table(self::AUTHCODE_TABLE)->create();\n\t\t$insertObj->code_hash = $this->hash;\n\t\t$insertObj->save();\n\t\treturn $insertObj->id();\n\t\t//$hsh = sqlPrep($this->hash);\n\t\t//$insstmt = \"INSERT INTO AUTHCODES (CODE_HASH) VALUES ($hsh)\";\n\t}", "public function validationSha($code){\r\n\t\t//variables\r\n\t\t$error = '';\r\n\t\t$user_browser = $_SERVER['HTTP_USER_AGENT']; //navegador\r\n\t\t$ip = $_SERVER['REMOTE_ADDR']; //ip\r\n\t\r\n\t\t$this->where('macro_sha', $code);\r\n\t\tif($salida = $this->getOne('solicitudes_clave')){\r\n\t\t\t\r\n\t\t\tif($salida['navegador'] != $user_browser){\t$error = 'navegador no concide';\t}\r\n\t\t\tif($salida['ip'] != $ip){\t\t\t\t\t$error = 'remote ip no concide';\t}\r\n\t\t\t\r\n\t\t\tif($error != ''){\r\n\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\treturn false;\r\n\t\t\t}else{\r\n\t\t\t\t$nuevo_sha = hash('sha512', $salida['email'].$user_browser.$salida['telefono'].$ip);\r\n\t\t\t\tif($nuevo_sha != $salida['macro_sha']){\r\n\t\t\t\t\t$error = 'Shas no coinciden';\r\n\t\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}else{\r\n\t\t\t\t\t//succes!!\r\n\t\t\t\t\t$_SESSION['email_val'] = $salida['email'];\r\n\t\t\t\t\t$_SESSION['corrector'] = $salida['salt'];\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t}else{\r\n\t\t\t$error = 'no hubo conexion a db';\r\n\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "function render_v_code($email=\"\"){\n $CI = & get_instance();\n $data = array();\n $CI->load->library('encryption');\n $code = bin2hex($CI->encryption->create_key(16));\n $data['v_code'] = array('code'=>$code,'email'=> $email);\n return $data;\n}", "function userSignUp ( $_email ) {\n\t\t$_sql_statement = '';\n\t\t$_bind_parameters = array ();\n\t\t$_duplicateEmailCheck;\n\t\t$_createUserInfo;\n\t\t$_resultVerification ;\n\t\t$_emailVerificationKey = '';\n\t\t$_accountPassword = '';\n\t\t\n\t\t$this->gframeDatabase = new GframeDatabase($this->db_info);\n\t\t\n\t\t$_query_request = array();\n\t\t$_query_result = array();\n\n\t\tif ( ($connection_result = $this->gframeDatabase->connect_database ()) !== TRUE ) {\n\t\t\treturn $this->gframeDatabase->returnAjaxResponseArray(false,'Failed @ connect_database',$connection_result);\n\t\t} else {\n\t\t\t// duplicate email check\n\t\t\t$_duplicateEmailCheck = $this->duplicateEmailCheck( $_email );\n\t\t\tif ($_duplicateEmailCheck['response']===FALSE) {\n\t\t\t\t$this->gframeDatabase->close_database_connection();\n\t\t\t\treturn $_duplicateEmailCheck; // error then exit\n\t\t\t}\n\n\t\t\t// generate account password \n\t\t\t$_accountPassword = $this->returnGeneratedPassword(8);\n\t\t\t\n\t\t\t// create user record\n\t\t\t$_createUserInfo = $this->createUserInfo( $_email,$_accountPassword );\n\t\t\t\n\t\t\t$_resultVerification = $this->queryResultVerification ($_createUserInfo,'createUserInfo');\n\t\t\tif($_resultVerification['response'] === FALSE) {\n\t\t\t\t$this->gframeDatabase->close_database_connection();\n\t\t\t\treturn $_resultVerification; // error then exit\n\t\t\t}\n\t\t\t\n\t\t\t// generate e mail verification key\n\t\t\t$_emailVerificationKey = $this->returnGeneratedPassword(32);\n\n\t\t\t// create user meta and email verification key\n\t\t\t// $_createUserInfo['result']['result'] has the last insert ID\n\t\t\t$_createUserInfoMeta = $this->createUserRecordMeta( $_createUserInfo['result']['result'],$_emailVerificationKey);\n\t\t\t$_resultVerification = $this->queryResultVerification ($_createUserInfoMeta,'createUserRecordMeta');\n\t\t\tif($_resultVerification['response'] === FALSE) {\n\t\t\t\t$this->gframeDatabase->close_database_connection();\n\t\t\t\treturn $_resultVerification; // error then exit\n\t\t\t}\n\t\t\t\n\t\t\t// closing the connection\n\t\t\t$this->gframeDatabase->close_database_connection();\n\t\t\t\n\t\t\t// send out \n\t\t\tif($this->sendOutVerificationEmail ( $_email,$_accountPassword,$_emailVerificationKey )) {\n\t\t\t\treturn $this->gframeDatabase->returnAjaxResponseArray(true,'OK',null);\n\t\t\t} else {\n\t\t\t\treturn $this->gframeDatabase->returnAjaxResponseArray(false,'failedAtSendingEmail',null);\n\t\t\t}\t\t\t\n\t\t}\n\t}", "function ts3client_createIdentity(&$result) {}", "public function veryfyuser($email,$code){\n\t\t$this->db->where('Status', '0');\n\t\t$this->db->where('Email', $email);\n\t\t$this->db->where('UniqueKey', $code);\n\n\t\t$query=$this->db->get('tbl_userdetails');\n\t\tif($query->num_rows()==1){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "public function getAccountCode();", "public function getAccountCode();", "function auth_callback(int $code, ...$args)\n{\n $status = SQLite3::DENY;\n $table = DEFAULT_TABLE;\n if ($code === SQLite3::SELECT) {\n $status = SQLite3::OK;\n } else {\n if (!empty($args[0])) {\n $table = $args[0];\n } elseif (!empty($_SESSION['table'])) {\n $table = $_SESSION['table'];\n }\n $user = $_SESSION['user'] ?? DEFAULT_USER;\n // check to see if user is listed\n if (!empty(ACL[$user])) {\n // check to see if user is assigned to this table\n if (!empty(ACL[$user][$table])) {\n // check to see if code is allowed for this user and table\n if (in_array($code, ACL[$user][$table])) {\n $status = SQLite3::OK;\n }\n }\n }\n }\n $message = sprintf(PATTERN, $table, (string) $code, implode(':', $args), implode(':', $_SESSION));\n error_log($message);\n $_SESSION['table'] = $table;\n return $status;\n}", "public function generateOTPCode()\n {\n return generate_otp_code();\n }", "function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {\n\t$ckey_length = 4;\n\t$key = md5($key ? $key : ET_URL);\n\t$keya = md5(substr($key, 0, 16));\n\t$keyb = md5(substr($key, 16, 16));\n\t$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';\n\t$cryptkey = $keya.md5($keya.$keyc);\n\t$key_length = strlen($cryptkey);\n\t$string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;\n\t$string_length = strlen($string);\n\t$result = '';\n\t$box = range(0, 255);\n\t$rndkey = array();\n\tfor($i = 0; $i <= 255; $i++) {\n\t\t$rndkey[$i] = ord($cryptkey[$i % $key_length]);\n\t}\n\tfor($j = $i = 0; $i < 256; $i++) {\n\t\t$j = ($j + $box[$i] + $rndkey[$i]) % 256;\n\t\t$tmp = $box[$i];\n\t\t$box[$i] = $box[$j];\n\t\t$box[$j] = $tmp;\n\t}\n\tfor($a = $j = $i = 0; $i < $string_length; $i++) {\n\t\t$a = ($a + 1) % 256;\n\t\t$j = ($j + $box[$a]) % 256;\n\t\t$tmp = $box[$a];\n\t\t$box[$a] = $box[$j];\n\t\t$box[$j] = $tmp;\n\t\t$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));\n\t}\n\tif($operation == 'DECODE') {\n\t\tif((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {\n\t\t\treturn substr($result, 26);\n\t\t} else {\n\t\t\treturn '';\n\t\t}\n\t} else {\n\t\treturn $keyc.str_replace('=', '', base64_encode($result));\n\t}\n}", "public function activate($code)\n {\n if (Auth::check())\n {\n return Redirect::to('/');\n }\n\n\n $user = User::where('code', '=', $code)->where('active', '=', 0);\n\n if ($user->count())\n {\n $user = $user->first();\n\n //update user to active state\n $user->active = 1;\n $user->code = '';\n\n if ($user->save())\n {\n\n return Redirect::route('log')\n ->with('success', 'Your account is activated. Now you can sign in.');\n }\n }\n\n return Redirect::route('log')\n ->with('success', 'WE could not activate your account. Try again later.');\n\n }", "function register_user($first_name, $last_name, $username, $email, $password){\r\n\r\n $first_name = escape($first_name);\r\n $last_name = escape($last_name);\r\n $username = escape($username);\r\n $email = escape($email);\r\n $password = escape($password);\r\n\r\n if(email_exists($email)){\r\n return false;\r\n } elseif (username_exists($username)) {\r\n return false;\r\n } else {\r\n $password = password_hash($password, PASSWORD_BCRYPT, array('cost'=>12)); //md5($password);\r\n $validation_code = md5($username . microtime());\r\n\r\n $sql = \"INSERT INTO users(first_name, last_name, username, email, password, validation_code, active)\";\r\n $sql.= \" VALUES('$first_name', '$last_name', '$username', '$email', '$password', '$validation_code', 0)\";\r\n $result = query($sql);\r\n confirm($result);\r\n \r\n $subject = \"Activate account\";\r\n $msg = \" Please click the link below to activate your Account\r\n\r\n <a href=\\\"\".Config::DEV_URL.\"/activate.php?email={$email}&code={$validation_code}\\\">Reset Password</a>\r\n \";\r\n\r\n $headers = \"From: [email protected]\";\r\n\r\n send_email($email, $subject, $msg, $headers);\r\n\r\n return true;\r\n }\r\n return false;\r\n}", "public function googleRegisterAuthCode()\n {\n if (isset($_GET['code']) && !empty($_GET['code'])) {\n $client = $this->newGoogleClient($this->getGoogleOptions());\n \n try {\n $client->authenticate($_GET['code']);\n setcookie('google_access_token', $client->getAccessToken(), time()+(2 * DAY_IN_SECONDS), '/', defined(COOKIE_DOMAIN) ? COOKIE_DOMAIN : '' );\n wp_redirect($this->getGoogleLoginUrl());\n exit;\n } catch (\\Google_Exception $e) {\n $error_msg = $e->getMessage();\n if (is_string($error_msg) && strpos($error_msg, 'invalid_client') !== false) {\n $error_msg = 'invalid_client';\n }\n wp_redirect($this->getGoogleLoginUrl(false, ['error' => $error_msg]));\n exit;\n }\n \n unset($client);\n } elseif (isset($_COOKIE['google_access_token']) && !empty($_COOKIE['google_access_token'])) {\n $client = $this->newGoogleClient($this->getGoogleOptions());\n \n try {\n $client->setAccessToken(stripslashes($_COOKIE['google_access_token']));\n // get token data.\n $token_data = $client->verifyIdToken()->getAttributes();\n \n if (\n is_array($token_data) && \n array_key_exists('payload', $token_data) && \n array_key_exists('email', $token_data['payload']) &&\n array_key_exists('email_verified', $token_data['payload'])\n ) {\n if (!$token_data['payload']['email_verified']) {\n // not verified email.\n $this->googleLogout(false);\n } else {\n $user = get_user_by('email', $token_data['payload']['email']);\n \n if ($user !== false) {\n // email exists.\n $this->googleLogout(false);\n }\n }\n } else {\n // unable to fetch user data from google.\n $this->googleLogout(false);\n }\n } catch (\\Google_Exception $e) {\n // incorrect secret.\n $this->googleLogout(false);\n }\n \n unset($client, $token_data);\n }\n }", "final function getCode();", "public function run()\n {\n GrantType::checkGrantType(Yii::$app->request->post('grant_type'), GrantType::GRANT_TYPE_AUTHORIZATION_CODE);\n Client::checkClientSecret(Client::checkClientId(Yii::$app->request->post('client_id')), Yii::$app->request->post('client_secret'));\n AuthorizationCode::checkAuthorizationCode(Yii::$app->request->post('code'), Yii::$app->request->post('redirect_uri'));\n\n return AccessToken::createAccessToken(Yii::$app->request->post('client_id'), Yii::$app->request->post('code'));\n }", "public function postAuthorize()\n\t{\n\t\t// dd('here');\n\t\t$params = Authorizer::getAuthCodeRequestParams();\n\n\t\t// dd($params);\n\t $params['user_id'] = Auth::user()->id;\n\t $redirectUri = '';\n\n\t // if the user has allowed the client to access its data, redirect back to the client with an auth code\n\t if (request('approve') !== null) {\n\t $redirectUri = Authorizer::issueAuthCode('user', $params['user_id'], $params);\n\t }\n\n\t // if the user has denied the client to access its data, redirect back to the client with an error message\n\t if (request('deny') !== null) {\n\t $redirectUri = Authorizer::authCodeRequestDeniedRedirectUri();\n\t }\n\n\t // dd($redirectUri);\n\n\t return redirect($redirectUri);\n\t}", "function getRandomCode()\n\t\t{\n\t\t\tglobal $wpdb;\n\n\t\t\twhile(empty($code))\n\t\t\t{\n\n\t\t\t\t$scramble = md5(AUTH_KEY . current_time('timestamp') . SECURE_AUTH_KEY);\n\t\t\t\t$code = substr($scramble, 0, 10);\n\t\t\t\t$code = apply_filters(\"pmpro_random_code\", $code, $this);\t//filter\n\t\t\t\t$check = $wpdb->get_var(\"SELECT id FROM $wpdb->pmpro_membership_orders WHERE code = '$code' LIMIT 1\");\n\t\t\t\tif($check || is_numeric($code))\n\t\t\t\t\t$code = NULL;\n\t\t\t}\n\n\t\t\treturn strtoupper($code);\n\t\t}", "public function getRecover($code){\n\t\t//find user where activate code is match and password_temp ! empty\n\t\t$user = User::where('activate_code','=',$code)->where('password_temp','!=','');\n\n\t\tif ($user->count()){\n\t\t\t//get user data\n\t\t\t$user \t\t\t\t\t= $user->first();\n\n\t\t\t//update values\n\t\t\t$user->password \t\t= $user->password_temp;\n\t\t\t$user->password_temp\t= '';\n\t\t\t$user->activate_code\t= '';\n\n\t\t\t//save to db\n\t\t\tif($user->save()){\n\n\t\t\t\t//return with success msg after saved to db\n\t\t\t\treturn Redirect::route('account-login')\n\t\t\t\t\t\t->with('global','<div class=\"alert alert-success\" role=\"alert\">\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"glyphicon glyphicon-ok-sign\" aria-hidden=\"true\"></span>\n\t\t\t\t\t\t\t\t\t\t\tYour can now login with a new password provided in email.\n\t\t\t\t\t\t\t\t\t\t</div>');\n\t\t\t}\n\t\t}\n\n\t\treturn 'Error in get Recover';\n\t}", "function register($name, $email, $password, $password2) {\n\t\tglobal $pdo;\n\n\t\t//delete old registration attempts\n\t\t$pdo->query(\"DELETE FROM user WHERE verified = 0 AND TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, code_generation_time)) > 600\");\n\n\t\t//empty or array check\n\t\tif(empty($name) || is_array($name) || empty($email) || is_array($email) || empty($password) || is_array($password) || empty($password2) || is_array($password2)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t//check if passwords match\n\t\tif($password !== $password2) {\n\t\t\treturn 2;\n\t\t}\n\n\t\t//check if the password, user name and email meets our requirements\n\t\tif(!password_security_check($password) || !valid_name_check($name) || strlen($email) > 256) {\n\t\t\treturn 3;\n\t\t}\n\n\t\t//check if email is already used\n\t\t$sql = \"SELECT email FROM user WHERE REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\")\";\n $sth = $pdo->prepare($sql);\n\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n $sth->execute();\n\n\t\tif($sth->rowCount() != 0) {\n\t\t\treturn 4;\n\t\t}\n\n\t\t//generate verification code\n\t\t$verification_code = hash(\"sha256\", microtime() . (string)rand() . $email);\n\t\t//hash password\n\t\t$password_hash = password_hash($password, PASSWORD_BCRYPT);\n\n\t\t//get data required for email\n\t\t$reg_link = \"https://swapitg.com/firstlogin/$verification_code\";\n\t\t$subject = \"Registration\";\n\t\t$mailfile = fopen(__DIR__ . \"/register_mail_template.html\", \"r\") or die(\"Unable to open file!\");\n\t\t$message = strtr(fread($mailfile, filesize(__DIR__ . \"/register_mail_template.html\")), array('$reg_link' => $reg_link, '$name' => htmlspecialchars($name)));\n\t\tfclose($mailfile);\n\t\t$sender_email = \"[email protected]\";\n\t\t$sender_name = \"SwapitG no-reply\";\n\n\t\t//send email\n\t\tif(mail($email, $subject, wordwrap($message, 70, \"\\r\\n\"), \"From: $sender_name<$sender_email>\\r\\nContent-type: text/html; charset=utf-8\", \" -f \" . $sender_email)) {\n\t\t\t//if mail send sucessfully create new user wich is not verified yet\n\t\t\t$sql = \"INSERT INTO user (email, name, password, verification_code) VALUES (:email, :name, :password_hash, :verification_code)\";\n\t $sth = $pdo->prepare($sql);\n\t\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t\t$sth->bindValue(\":name\", htmlspecialchars($name), PDO::PARAM_STR);\n\t\t\t$sth->bindParam(\":password_hash\", $password_hash, PDO::PARAM_STR);\n\t\t\t$sth->bindParam(\":verification_code\", $verification_code, PDO::PARAM_STR);\n\t $sth->execute();\n\n\t\t\t//set email and password in the session for easier verification if the user verifies the email in the same session\n\t\t\tstart_session();\n\t\t\t$_SESSION[\"reg_email\"] = $email;\n\t\t\t//xor password for security reasons\n\t\t\t$_SESSION[\"reg_password\"] = $password ^ substr(str_pad($verification_code, strlen($password), $verification_code), 0, strlen($password));\n\t\t\treturn 0;\n\t\t} else {\n\t\t\treturn 5;\n\t\t}\n\t}", "function protection_code_activation() {\n\t\n\t}", "public function authenticationCallback() \n\t{\n\t\n\t\tif (!isset($_GET['code'])) {\n\t\t\treturn;\n\t\t}\n\n\t\t$store = SBTCredentialStore::getInstance();\n\t\t$settings = new SBTSettings();\n\t\t\n\t\t$endpointName = \"connections\";\n\t\tif (isset($_GET['endpointName'])) {\n\t\t\t$endpointName = $_GET['endpointName'];\n\t\t}\n\n\t\t$parameters = array(\n\t\t\t\t'callback_uri' => $settings->getOAuth2CallbackURL($endpointName),\n\t\t\t\t'code' => $_GET['code'],\n\t\t\t\t'grant_type' => 'authorization_code',\n\t\t\t\t'client_id' => $settings->getClientId($endpointName),\n\t\t\t\t'client_secret' => $settings->getClientSecret($endpointName)\n\t\t);\n\t\t\n\t\t$tokenURL = $settings->getAccessTokenURL($endpointName) . '?' . http_build_query($parameters, null, '&');\n\t\t$client = new Client($tokenURL);\n\t\t$client->setDefaultOption('verify', false);\n\t\t\n\t\t$headers = null;\n\t\t$body = null;\n\t\t$options = array();\n\t\t$response = null;\n\t\t\n\t\ttry {\n\t\t\t$request = $client->createRequest('GET', $tokenURL, $headers, $body, $options);\n\t\t\tif ($settings->forceSSLTrust($endpointName)) {\n\t\t\t\t$request->getCurlOptions()->set(CURLOPT_SSL_VERIFYHOST, false);\n\t\t\t\t$request->getCurlOptions()->set(CURLOPT_SSL_VERIFYPEER, false);\n\t\t\t}\n\t\t\t$response = $request->send();\n\t\t\n\t\t\tforeach ($response->getHeaderLines() as $h) {\n\t\t\t\tif (strpos($h, \"Content-Type\") === 0) header($h, TRUE);\n\t\t\t}\n\t\t\n\t\t\theader(':', true, $response->getStatusCode());\n\t\t\theader('X-PHP-Response-Code: ' . $response->getStatusCode(), true, $response->getStatusCode());\n\t\t\n\t\t\tparse_str($response->getBody(TRUE), $info);\n\t\t\n\t\t\tif (!isset($info['access_token'])) {\n\t\t\t\tdie('Missing access token. Something went wrong - make sure that your client ID and client secret are correct and try again.');\n\t\t\t}\n\t\t\t\n\t\t\t$accessToken = $store->getOAuthAccessToken($endpointName);\n\t\t\tif ($accessToken == null || $accessToken == \"\") {\n\t\t\t\t$store->storeOAuthAccessToken($info['access_token'], $endpointName);\n\t\t\t}\n\t\t\t\n\t\t\theader(\"Location: \" . $settings->getOAuthOrigin($endpointName));\n\t\t\t\n\t\t} catch(Guzzle\\Http\\Exception\\BadResponseException $e) {\n\t\t\t$response = $e->getResponse();\n\t\t\tprint_r($response->getBody(TRUE));\n\t\t}\n\t}", "public function getActivate($code){\n $user = Admin::where('activate_code', '=', $code)->where('active', '=', 0);\n\t\tif ($user->count()){\n\t\t\t$user = $user->first();\n\n\t\t\t$user->active = 1;\n\t\t\t$user->activate_code = '';\n\t\t\t\n\t\t\tif ($user->save()){\n\t\t\t return Redirect::secure('9gag-admin/login')->with('global', 'Congrats! We have activated your account');\n }\n \n }\n \n return Redirect::secure('/9gag-admin/login')\n ->with('global', 'we could not activate your account, \n try again late!');\n \n die();\n }" ]
[ "0.7041306", "0.6664811", "0.6414264", "0.63870126", "0.6328473", "0.6225655", "0.6189174", "0.6171091", "0.6162935", "0.61328924", "0.6098717", "0.6017145", "0.600179", "0.5996775", "0.5996761", "0.5988542", "0.59841704", "0.59823465", "0.5956479", "0.5842074", "0.5827205", "0.5816619", "0.58070964", "0.5806655", "0.5740081", "0.57265145", "0.571888", "0.5707291", "0.56881493", "0.56847256", "0.56739783", "0.5668234", "0.56571007", "0.56401277", "0.56220764", "0.56135446", "0.56074077", "0.55906135", "0.5576785", "0.5563137", "0.5558302", "0.55373776", "0.55291104", "0.5526946", "0.5526301", "0.5526087", "0.5520688", "0.55100113", "0.5509993", "0.55015874", "0.5498638", "0.54946303", "0.5482163", "0.54778194", "0.5474521", "0.5467162", "0.546048", "0.5448221", "0.54449725", "0.5440195", "0.54380685", "0.5437933", "0.5436568", "0.5436475", "0.54198176", "0.5413533", "0.53959423", "0.5395602", "0.53875715", "0.5382365", "0.538059", "0.53780794", "0.5376005", "0.536965", "0.5368015", "0.5364772", "0.5362218", "0.5336549", "0.5334635", "0.5327478", "0.53232497", "0.5321867", "0.53161865", "0.5314512", "0.5314512", "0.53125566", "0.5303115", "0.5302067", "0.5298883", "0.52935916", "0.5292352", "0.52870387", "0.52843165", "0.5282388", "0.52679324", "0.52602655", "0.52581644", "0.5257045", "0.5253436", "0.5252479" ]
0.73247254
0
/desc:generate authcode /input:arg(phone,code_type(1register,2change password),user_type,user_id) /output:return(authcode,errorcode(1success,0failed))
function generate_authcode_phone($phone,$code_type=0,$user_id="",$user_type=Constant::USER_TYPE_TEACHER) { $authcode=""; $errorcode=$this->check_authcode_phone($phone,$code_type); if(!$errorcode['errorcode']) { $authcode=random_string('nozero',6); $data=$this->bind_verify($user_id,"",$phone,2,$code_type,$authcode,$user_type); if($this->_redis) { $errorcode=$this->cache->save($authcode.'_'.sha1($phone),json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_PHONE); $this->save_check('phone',sha1($phone),$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_PHONE); } else { $this->db->insert($this->_table,$data); $insert_id=$this->db->insert_id(); if($insert_id>0) $errorcode=true; else $errorcode=false; } log_message('trace_tizi','170019:Gen phone auth code',array('phone'=>$phone)); if(!$errorcode) log_message('error_tizi','17019:Gen phone auth code failed',array('phone'=>$phone)); } else { $errorcode=false; } return array('authcode'=>$authcode,'errorcode'=>$errorcode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check_authcode_phone($phone,$code_type,$user_id=\"\")\n {\n\t\tif($phone)\n\t\t{\n\t\t\tif($this->_redis)\n\t\t\t{\n\n\t\t\t\t$errorcode=$this->check_auth('phone',sha1($phone));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"phone\",sha1($phone));//需要通过服务获得加密后的电话号码\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" - \".Constant::SEND_AUTHCODE_INTERVAL_PHONE)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n }", "function generate_authcode_email($email,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER,$check=true)\n\t{\n\t\t$authcode=\"\";\n\t\tif($check) $errorcode=$this->check_authcode_email($email,$code_type,$user_id);\t\n\t\telse $errorcode=array('errorcode'=>false);\n\t\tif(!$errorcode['errorcode'])\n {\t\n $authcode=random_string('unique');\n $data=$this->bind_verify($user_id,$email,\"\",1,$code_type,$authcode,$user_type);\n\t\t\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode,json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_EMAIL);\n\t\t\t\t$this->save_check('email',$email,$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_EMAIL);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n \t\t$insert_id=$this->db->insert_id();\n \t\tif($insert_id>0) $errorcode=true;\n \t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170018:Gen email auth code',array('email'=>$email));\n\t\t\tif(!$errorcode) log_message('error_tizi','17018:Gen email auth code failed',array('email'=>$email));\t\t\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t}\n\t\treturn array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "function auth() {\r\n\t$code = \"\";\r\n\tfor ($i = 0; $i < 8; $i ++) {\r\n\t\t$code .= (rand(0, 1) ? chr(rand(65, 122)) : rand(0, 9));\r\n\t}\r\n\treturn sha1($code);\r\n}", "function send_authcode_phone($authcode,$phone,$code_type=0)\n\t{\n\t\t$this->load->library('sms');\n\n\t\t$msg_head=$msg_end=$lang='';\n\t\tswitch($code_type)\n\t\t{\n\t\t\tcase Constant::CODE_TYPE_REGISTER: $lang=\"verify\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PASSWORD: $lang=\"reset\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PHONE: $lang=\"update_phone\";break;\n\t\t\tdefault:break;\n\t\t}\n\n\t\tif($lang)\n\t\t{\n\t\t\t$msg_head=str_replace('{phone}',substr($phone,-4),$this->lang->line('phone_body_'.$lang));\n\t\t\t$msg_end=$this->lang->line('phone_end_'.$lang);\t\t\t\n\t\t}\n\t\t$msg=$msg_head.$authcode.$msg_end;\n\n \t$this->sms->setPhoneNums($phone);\n \t$this->sms->setContent($msg);\n\t\t$sms_error=$this->sms->send();\t\n\t\tif($sms_error['error']==\"Ok\")\n\t\t{\n\t\t\t $errorcode=true;\n\t\t\t log_message('info_tizi','170111:Sms send success',$sms_error);\t\n\t\t}\n\t\telse \n\t\t{\n\t\t\t$errorcode=false;\n\t\t\tif($sms_error['status']==3) $sms_error['error']=$this->lang->line('error_sms_invalid_phone');\n\t\t\telse $sms_error['error']=$this->lang->line('error_sms_normal');\n\t\t\tlog_message('error_tizi','17011:Sms send failed',$sms_error);\n\t\t}\n\t\treturn array('errorcode'=>$errorcode,'error'=>$sms_error['error'],'status'=>$sms_error['status']);\n\t}", "function verify_authcode_phone($authcode,$phone,$verify=true)\n\t{\n\t\t$user_id=$code_type=0;\n if($this->_redis)\n {\n $data=$this->cache->get($authcode.'_'.sha1($phone));\n if(!empty($data))\n {\n $data=json_decode($data);\n $user_id=$data->user_id;\n $code_type=$data->code_type;\n\t\t\t\tif($verify) $this->cache->delete($authcode.'_'.sha1($phone));\n $errorcode=true;\n }\n else\n {\n $errorcode=false;\n log_message('error_tizi','17051:phone verify code failed',array('phone'=>$phone));\n }\n }\n else\n\t\t{\n\t\t\t$this->db->select(\"id,user_id,phone,code_type,generate_time\");\n\t\t\t$this->db->from($this->_table);\n\t\t\t$this->db->where(\"authcode\",$authcode);\n\t\t\t//加密手机号码\t\n\t\t\t$e_phone=sha1($phone);\t\n\t\t\n\t\t\t$this->db->where(\"phone\",$e_phone);\n\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_PHONE);\n\t\t\t$query=$this->db->get();\t\n\t\t\t$total=$query->num_rows();\n\t\t\tif($total) $gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_PHONE))>date(\"Y-m-d H:i:s\"))\n\t\t\t{\n\t\t\t\t$id=$query->row()->id;\n\t\t\t\t$user_id=$query->row()->user_id;\n\t\t\t\t//$phone=$query->row()->phone;//电话号码已加密\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\tif($verify)\n\t\t\t\t{\n\t\t\t\t\t$this->db->where('id',$id);\n\t\t\t\t\t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n\t\t\t\t\tif($this->db->affected_rows()==1) $errorcode=true;\n\t else $errorcode=false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$errorcode=true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t}\n\t\t}\n\t\treturn array('user_id'=>$user_id,'phone'=>$phone,'code_type'=>$code_type,'errorcode'=>$errorcode);\n\t}", "public function passwordResetCode();", "public function check_register_code($user_login)\n {\n // Wrong Token Message\n $wrong_token = array(\n 'message' => __('Your authentication code is incorrect', 'wordpress-acl')\n );\n\n // Only Check Register Code\n if (isset($_REQUEST['do_action']) and $_REQUEST['do_action'] == \"check_register_code\") {\n\n // Get User Mobile\n $user_mobile = $user_login;\n $code = sanitize_text_field($_REQUEST['code']);\n\n // Check User Code\n $code_query = self::check_user_opt_code($code, 'mobile', $user_mobile);\n if ($code_query != false and self::check_expire_time_user_otp($code_query) === true) {\n // True\n wp_send_json_success(array(\n 'code' => $code\n ), 200);\n } else {\n // False\n wp_send_json_error($wrong_token, 400);\n }\n }\n\n // Check User code in Register\n if (!isset($_REQUEST['code']) || (isset($_REQUEST['code']) and empty($_REQUEST['code']))) {\n wp_send_json_error($wrong_token, 400);\n }\n $code_query = self::check_user_opt_code($_REQUEST['code'], 'mobile', $user_login);\n if ($code_query === false) {\n wp_send_json_error($wrong_token, 400);\n }\n if (self::check_expire_time_user_otp($code_query) === false) {\n wp_send_json_error(array(\n 'message' => __('Your authentication code has expired', 'wordpress-acl')\n ), 400);\n }\n\n // Check Persian first_name and last_name\n if(empty($_REQUEST['first_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خود را وارد نمایید'\n ), 400);\n }\n if(empty($_REQUEST['last_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را وارد نمایید'\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['first_name']) ===false) {\n wp_send_json_error(array(\n 'message' => __('لطفا نام خود را به فارسی وارد کنید', 'wordpress-acl')\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['last_name']) ===false) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را به فارسی تایپ کنید'\n ), 400);\n }\n }", "function send_auth_code_at_login($user)\n{\n\t$user_info = get_userdata($user);\n\t\n\t$user_login = $user_info->data->user_login;\n\n\t$user_email = $user_info->data->user_email;\t\n\n\t$user_name = $user_info->data->first_name;\t\n\n\t$user_phone = get_user_meta( $user, 'user_phone', true );\n\t//$user_phone = urldecode($u_phone);\n\n\t$user_fname = get_user_meta( $user, 'first_name', true );\n\n\t$code = get_user_meta( $user, 'has_to_be_activated', true );\n\n\t$subject = 'Your New Authentication Code';\n\n\n\t$message1 = \"<html><body style='background:#f3f3f3;padding:20px 0;'><table border='0' cellpadding='0' cellspacing='0' style='margin:auto; max-width: 520px;width:100%;font-family: Arial;padding:20px;background:#fff;'><tbody>\";\n\t$message1 .=\"<tr><td style='font-size: 16px;'>Hello \".ucfirst($user_fname).\",</td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Welcome to Raise it Fast!</td></tr><tr height=30></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Please use this code to authenticate your account with Raise it Fast. <span style='background: #aaaaaa none repeat scroll 0 0;height: 45px;text-align: center;width: 101px;'>\".$code.\"</span></td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>'If you have any questions or concerns don't hesitate to use our website chat function, call us, or email us by going to our help page at \".site_url('/contact-us/').\" Or, you can simply reply to this email. '</td></tr><tr height=30></tr>\"; \n\t$message1 .=\"<tr><td style='font-size: 16px; margin-top: 20px;'>Thanks for becoming a part of the Raise It Fast community! </td></tr></tbody></table><table border='0' cellpadding='0' cellspacing='0' style='margin:20px auto 0; max-width: 520px;width:100%;'>\"; \n\n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'>1401 Lavaca St #503, Austin, TX 78701</td></tr><tr height=20></tr>\"; \n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'><a href=\".site_url().\" style='text-decoration:none; color: #999999;'>The Raise it Fast Team</a></td></tr>\"; \n\t$message1 .=\"</table></body></html>\";\n\n\twp_mail($user_email, $subject, $message1);\n\n//=========Send Auth Code Via Text message ==================//\n\n\t$account_sid = get_option('twilio_account_sid'); \n\t$auth_token = get_option('twilio_auth_token'); \n //require('lib/twilio-php-latest/Services/Twilio.php');\n\t$client = new Services_Twilio($account_sid, $auth_token); \n //$from = '+12182265630'; \n\t$from = get_option('twilio_phone_no');\n\n\ttry\n\t{\n\t\t$client->account->messages->sendMessage( $from, $user_phone, \"Hello $user_fname, Your Authentication code is $code\");\n\t}\n\tcatch (Exception $e)\n\t{ \n\n\t\techo \"11-\";\n\t}\n}", "function actiongetVerifyCode()\n\t{\n\t\t$jsonarray= array();\n\t\t\n\t\tif(isset($_POST['phone']))\n\t\t{\n\t\t\t$userObj=new Users();\n\t\t\tif(!is_numeric($_POST['phone'])){\n\t\t\t\t$algoencryptionObj\t=\tnew Algoencryption();\n\t\t\t\t$_POST['phone']\t=\t$algoencryptionObj->decrypt($_POST['phone']);\n\t\t\t}\n\t\t\t$result=$userObj->getVerifyCodeById($_POST['phone'],'-1');\n\t\t\t$jsonarray['status']=$result['status'];\n\t\t\t$jsonarray['message']=$result['message'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$message=$this->msg['ONLY_PHONE_VALIDATE'];\n\t\t\t$jsonarray['status']='false';\n\t\t\t$jsonarray['message']=$message;\n\t\t}\n\t\techo $jsonarray['message'];\n\t}", "function authCode($r,$extra='')\t{\n\t\t$l=$this->codeLength;\n\t\tif ($this->conf['authcodeFields'])\t{\n\t\t\t$fieldArr = t3lib_div::trimExplode(',', $this->conf['authcodeFields'], 1);\n\t\t\t$value='';\n\t\t\twhile(list(,$field)=each($fieldArr))\t{\n\t\t\t\t$value.=$r[$field].'|';\n\t\t\t}\n\t\t\t$value.=$extra.'|'.$this->conf['authcodeFields.']['addKey'];\n\t\t\tif ($this->conf['authcodeFields.']['addDate'])\t{\n\t\t\t\t$value.='|'.date($this->conf['authcodeFields.']['addDate']);\n\t\t\t}\n\t\t\t$value.=$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];\n\t\t\treturn substr(md5($value), 0,$l);\n\t\t}\n\t}", "function generate_validation_code()\n {\r\n return hash_hmac($this->hash_function, $this->email,\r\n $this->created_at.hash($this->hash_function, $this->password));\r\n }", "function check_authcode_email($email,$code_type,$user_id=\"\")\n\t{\n\t\tif($email)\n\t\t{\n\t\t\tif($this->_redis)\n {\n\t\t\t\t$errorcode=$this->check_auth('email',$email);\n }\n else\n {\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"email\",$email);\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" -\".Constant::SEND_AUTHCODE_INTERVAL_EMAIL)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n\t}", "function executeCommandAUTH(&$SMSGW, $argument = null)\n{\n $code = $SMSGW->getAndSaveAuthCode();\n\n if ($code > 9999 && $code < 100000)\n {\n return $SMSGW->sendMessage('Auth code: ' . $code);\n }\n else\n {\n $SMSGW->log(__FUNCTION__, 'Unable to save auth code to db or invalid code - ' . $code);\n return false;\n }\n}", "public function getNewAuthCode()\n {\n // TODO: Implement getNewAuthCode() method.\n }", "public function set_auth_code() {\n\t\t$tokens = new Token_User( '_indieauth_code_' );\n\t\t$tokens->set_user( self::$author_id );\n\t\treturn $tokens->set( static::$test_auth_code, 600 );\n\t}", "function getNewAuthCodeFinal($authDetails)\n{\n $params = array('response_type'=>'code', 'client_id'=> $authDetails['client_id'], 'redirect_uri'=> $authDetails['redirect_uri'], 'state'=> 'xyz');\n header('Location: ' . $authDetails['authorization_code_endpoint'] . '?' . http_build_query($params));\n die();\n}", "function generate_otp_code(){\n return rand(1000,9999);\n}", "function authenticate_user($email_a, $passcode){\r\n\t//QUERY DATABASE/ACTIVE DIRECTORY TO SEE IF USER IS VALID\r\nif ($email == \"insert valid email b4 testing\") {\r\n\t/*** set a form token ***/\r\n\t$form_token = md5( uniqid('auth', true) );\r\n\t/*** set the session form token ***/\r\n\t$_SESSION['form_token'] = $form_token;\r\n\t$_SESSION['email_a'] = $email_a;\r\n\t$_SESSION['start_timestamp'] = date('Y-m-d HH:mm:s');\r\n\t$code = \"valid\";\r\n}else{\r\n\t$code = \"invalid\";\r\n\t}\r\necho return $code \"We were unable to validate your information, Please try again\";\r\n /*RETURNED TO CALLING CODE */\r\n\t}", "private function generate_code() {\n\t\t$secret = $this->code_generator->createSecret();\n\t\t$code = $this->code_generator->getCode($secret);\n\t\treturn array('secret'=>$secret, 'code'=>$code);\n\t}", "function send_code($mobile_no) {\n\n\t\t$varifycode = rand('1000', '9999');\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$code = 1234;\n\t\t// $mobileNumber = substr($mobile_no, 1);\n\t\t// $msg = \"Recharge Verification Code : \" . $code;\n // $encodedMessage = urlencode($msg);\n // $route = \"4\";\n // $authKey = \"109829ANu1kqLdg570b4e25\";\n // $senderId = \"Recharge\";\n // $postData = array(\n // 'authkey' => $authKey,\n // 'mobiles' => $mobileNumber,\n // 'message' => $encodedMessage,\n // 'sender' => $senderId,\n // 'route' => $route\n// );\n// $url=\"http://api.msg91.com/api/sendhttp.php\";\n // $ch = curl_init();\n// curl_setopt_array($ch, array(\n // CURLOPT_URL => $url,\n // CURLOPT_RETURNTRANSFER => true,\n // CURLOPT_POST => true,\n // CURLOPT_POSTFIELDS => $postData\n // //,CURLOPT_FOLLOWLOCATION => true\n// ));\n// \n// \n// //Ignore SSL certificate verification\n// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n// \n// \n// //get response\n// $output = curl_exec($ch);\n// \n // if (curl_errno($ch)) {\n\t // $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n // echo json_encode($result);\n\t\t\t // exit();\n// // // // \n\t\t // }\n // curl_close($ch);\nreturn $code;\n\t\t//echo $output;\n\t}", "public function createVerificationCode()\n {\n return $code = random_int(config('twilio-verify.random_int.initial_value'), config('twilio-verify.random_int.final_value'));\n }", "public function generateOTPCode()\n {\n return generate_otp_code();\n }", "abstract public function getPaymentAuthorizationCode();", "function users_user_activation($args)\n{\n $code = base64_decode(FormUtil::getPassedValue('code', (isset($args['code']) ? $args['code'] : null), 'GETPOST'));\n $code = explode('#', $code);\n\n if (!isset($code[0]) || !isset($code[1])) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n $uid = $code[0];\n $code = $code[1];\n\n // Get user Regdate\n $regdate = pnUserGetVar('user_regdate', $uid);\n\n // Checking length in case the date has been stripped from its space in the mail.\n if (strlen($code) == 18) {\n if (!strpos($code, ' ')) {\n $code = substr($code, 0, 10) . ' ' . substr($code, -8);\n }\n }\n\n if (DataUtil::hash($regdate, 'md5') == DataUtil::hash($code, 'md5')) {\n $returncode = pnModAPIFunc('Users', 'user', 'activateuser',\n array('uid' => $uid,\n 'regdate' => $regdate));\n\n if (!$returncode) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n LogUtil::registerStatus(__('Done! Account activated.'));\n return pnRedirect(pnModURL('Users', 'user', 'loginscreen'));\n } else {\n return LogUtil::registerError(__('Sorry! You entered an invalid confirmation code. Please correct your entry and try again.'));\n }\n}", "function rest_authorization_required_code()\n {\n }", "public function verifyCode(CodeRequest $request )\n\t{\n\t\tif(!is_numeric($request->input('code'))){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\n\t\t$querry = \"SELECT * FROM \". DBTool::rawTable('users') . \" WHERE phone_token = '\" . $request->input('code') . \"' AND phone = '\" . $request->input('phone') . \"'\";\n\t\t$user = DB::select(DB::raw($querry));\n\n\t\t$user = ArrayHelper::fromObject($user);\n\n\t\t//if user enter wrong code\n\t\tif(!isset($user[0]['id']) && !isset($user[0]['phone']) ){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\t\t// SET THE CODE IS VERIFIED\n\t\t$querry = \"UPDATE \". DBTool::rawTable('users') . \" SET verified_phone = 1 WHERE id = '\" . $user[0]['id'] . \"'\";\n\t\t$updated = DB::update(DB::raw($querry));\n\t\t$updated = ArrayHelper::fromObject($updated);\n\n\t\t// Redirection\n\t\t// return $this->lastRecords($user[0]['phone']);\n\t\treturn redirect( '/end/registration/' . $user[0]['phone'] );\n\t}", "public function get_user_code()\n\t{\n\t\t$q_select_id = \"SELECT MAX(id) FROM tb_users\";\n\t\t$last_id = DB::connect()->query($q_select_id)->fetch_column();\n\t\tterner(not_filled($last_id), $last_id = 0, $last_id); // if last id is 0 then give it 0 value\n\n\t\t// get last user_code second number from tb_users\n\t\t$q_select_ucode = \"SELECT\n\t\t\tid as id,\n\t\t\tSUBSTR(user_code, 2, 1) as ucode\n\t\tFROM tb_users ORDER BY id DESC LIMIT 1\";\n\t\t$get_ucode_num = DB::connect()->query($q_select_ucode)->style(FETCH_ASSOC)->fetch();\n\t\tterner($get_ucode_num['ucode'] == 9, ($last_ucode = 0), ($last_ucode = 1 + $get_ucode_num['ucode'])); // if ucode reach 9 then reset it to 0\n\n\t\t// generate user code and setting up variables\n\t\t$gen_user_code = 2 . $last_ucode . $last_id;\n\t\t$user_code = $gen_user_code;\n\n\t\treturn $user_code;\n\t}", "function verify_authcode_email($authcode)\n\t{\n\t\t$user_id=$email=$code_type=$user_type=0;\n\t\tif($this->_redis)\n\t\t{\n\t\t\t$data=$this->cache->get($authcode);\t\n\t\t\tif(!empty($data))\n\t\t\t{\n\t\t\t\t$data=json_decode($data);\n\t\t\t\t$user_id=$data->user_id;\n\t\t\t\t$email=$data->email;\n\t\t\t\t$code_type=$data->code_type;\n\t\t\t\t$user_type=$data->user_type;\t\n\t\t\t\t$this->cache->delete($authcode);\n\t\t\t\t$errorcode=true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t\tlog_message('error_tizi','17052:email verify code failed',array('authcode'=>$authcode));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n \t$this->db->select(\"id,user_id,email,code_type,user_type,generate_time\");\n \t$this->db->from($this->_table);\n \t $this->db->where(\"authcode\",$authcode);\n \t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_EMAIL);\n \t$query=$this->db->get();\n \t$total=$query->num_rows();\n \t$gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_EMAIL))>date(\"Y-m-d H:i:s\"))\n \t{\n \t$id=$query->row()->id;\n \t$user_id=$query->row()->user_id;\n \t$email=$query->row()->email;\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\t$user_type=$query->row()->user_type;\n \t$this->db->where('id',$id);\n \t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n \tif($this->db->affected_rows()==1) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n \t}\n \telse\n \t{\n \t\t$errorcode=false;\n \t}\n\t\t}\n return array('user_id'=>$user_id,'email'=>$email,'code_type'=>$code_type,'user_type'=>$user_type,'errorcode'=>$errorcode);\n\t}", "function send_authcode_email($authcode,$email,$code_type=0)\n\t{\n\t\t$this->load->library(\"mail\");\n\t\t$this->load->model('login/register_model');\n\t\t$msg_head=$msg_end=$lang=$link=$stuid='';\n\n\t\tif($this->_user_id)\n\t\t{\n\t\t\t$user_info=$this->register_model->get_user_info($this->_user_id);\n\t\t\tif($user_info['errorcode'] && $user_info['user']->student_id)\n\t\t\t{\t\t\n\t\t\t\t$stuid='您的学号是:'.$user_info['user']->student_id.'<br />';\n\t\t\t}\n\t\t}\n\n\t\tswitch($code_type)\n\t\t{\n\t\t\tcase Constant::CODE_TYPE_REGISTER: $link=\"verify\";$lang=\"verify\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PASSWORD: $link=\"forgot/reset\";$lang=\"reset\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_EMAIL: $link=\"verify\";$lang=\"update_email\";break;\n\t\t\tcase Constant::CODE_TYPE_REGISTER_VERIFY_EMAIL: $link=\"verify\";$lang=\"reg_reverify\";break;\n\t\t\tcase Constant::CODE_TYPE_LOGIN_VERIFY_EMAIL: $link=\"verify\";$lang=\"login_reverify\";break;\n\t\t\tdefault:break;\n\t\t}\n\n\t\tif($lang && $link)\n\t\t{\t\n\t\t\t//$authcode=site_url().$link.\"?code=\".$authcode;\n\t\t\t$authcode=login_url().$link.\"/code/\".$authcode;\n\t\t\t$subject=$this->lang->line('mail_subject_'.$lang);\n\t\t\t$msg_body=str_replace('{email}',$email,$this->lang->line('mail_body_'.$lang));\n\t\t\t\n\t\t\t$msg_body=str_replace('{stuid}',$stuid,$this->lang->line('mail_body_'.$lang));\n\t\t\t$msg_end=$this->lang->line('mail_end_'.$lang);\t\t\t\n\t\t}\n\t\t$msg=$msg_body.'<br /><a href=\"'.$authcode.'\">'.$authcode.'</a><br />'.$msg_end.'<br/>'.$this->lang->line('mail_disclaimer');\n\n\t\t$ret = Mail::send($email, $subject, $msg);\n\t\tif($ret['ret']==1)\n\t\t{\n\t\t\t$errorcode=true;\n\t\t\tlog_message('info_tizi','170101:Email send success',$ret);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t\tlog_message('error_tizi','17010:Email send failed',$ret);\n\t\t}\n\t\treturn array('errorcode'=>$errorcode,'send_error'=>implode(',',$ret));\n\t}", "public function activationCode();", "static function getNewCode()\n {\n $code = null;\n while (true) {\n $code = \\User::make_password(8, false);\n if (!self::codeExists($code)) break;\n }\n return $code;\n }", "public function generate() {\n\n /** @var $code String generate code */\n\n $code = (new Users())->phoneNumber_GenerateCode();\n\n /** @var $user Array get the details of a current user */\n\n $user = (new Users())->current_user();\n\n /**\n * @var $phone_format String format mobile phone number\n * to non space and non special character format\n */\n\n $phone_format = preg_replace(\"/[\\W\\s]/m\",\"\",$user['CP']);\n\n /** @var $template String a message to send **/\n\n $template = \"From SCOA, use this code to verify your account '{$code}' \";\n\n /** @void send sms and notify the current user */\n\n sms::send($phone_format,$template);\n\n }", "function get_oauth_code($wpoa) {\n\t$params = array(\n\t\t'response_type' => 'code',\n\t\t'client_id' => CLIENT_ID,\n\t\t'scope' => SCOPE,\n\t\t'state' => uniqid('', true),\n\t\t'redirect_uri' => REDIRECT_URI,\n\t);\n\t$_SESSION['WPOA']['STATE'] = $params['state'];\n\t$url = URL_AUTH . http_build_query($params);\n\theader(\"Location: $url\");\n\texit;\n}", "public function generateSignCodes() {\n $users = $this->connection->fetchAll('SELECT * FROM [reg_users]');\n \n if ($users) {\n foreach ($users as $user) {\n $data = array(\n 'signin_hash%s' => $this->generateUserHash($user, 'sign_in'),\n 'signoff_hash%s' => $this->generateUserHash($user, 'sign_off')\n );\n \n $this->connection->query('UPDATE [reg_users] SET', $data, 'WHERE [user_id] = %i', $user['user_id']);\n }\n }\n \n }", "public function getCode()\n {\n return $this->isSuccessful() ? $this->data[\"AuthCode\"] : parent::getCode();\n }", "public function get_auth_code( $code ) {\n\t\t$tokens = new Token_User( '_indieauth_code_' );\n\t\treturn $tokens->get( $code );\n\t}", "function send_code($mobile_no) {\n\n\t\t$varifycode = rand('1000', '9999');\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$code = 1234;\n\t\t$mobile = \"0\" . $mobile_no;\n\t\t// $mobileNumber = substr($mobile_no, 1);\n\t\t$msg = \"Recharge Verification Code : \" . $code;\n\t\t$encodedMessage = urlencode($msg);\n\t\t// $route = \"4\";\n\t\t// $authKey = \"109829ANu1kqLdg570b4e25\";\n\t\t// $senderId = \"Recharge\";\n\t\t// $postData = array(\n\t\t// 'authkey' => $authKey,\n\t\t// 'mobiles' => $mobileNumber,\n\t\t// 'message' => $encodedMessage,\n\t\t// 'sender' => $senderId,\n\t\t// 'route' => $route\n\t\t// );\n\t\t$url = \"http://www.kudisms.net/components/com_spc/smsapi.php?username=smerp&password=abhishek&sender=kudisms&recipient=$mobile&message=\" . $encodedMessage;\n\t\t// $url=\"http://api.msg91.com/api/sendhttp.php\";\n\t\t$ch = curl_init();\n\t\tcurl_setopt_array($ch, array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,\n\t\t// CURLOPT_POSTFIELDS => $postData\n\t\tCURLOPT_FOLLOWLOCATION => true));\n\t\t//\n\t\t//\n\t\t// //Ignore SSL certificate verification\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n\t\t//\n\t\t//\n\t\t// //get response\n\t\t$output = curl_exec($ch);\n\t\t//\n\t\t// if (curl_errno($ch)) {\n\t\t// $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n\t\t// echo json_encode($result);\n\t\t// exit();\n\t\t// // // //\n\t\t// }\n\t\tcurl_close($ch);\n\t\treturn $code;\n\t\t//echo $output;\n\t}", "function generate_auth() {\n\treturn sprintf('%08x%08x%08x%08x',\n\t\tmt_rand(0, 0xffffffff), mt_rand(0, 0xffffffff),\n\t\tmt_rand(0, 0xffffffff), mt_rand(0, 0xffffffff));\n}", "function forget_send_code($mobile) {\n\t\t$varifycode = rand('10000000', '99999999');\n\t\t//$code = 1234;\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$mobileNumber = substr($mobile, 1);\n\t\t$msg = \"New Password of Recharge login : \" . $code;\n\t\t$encodedMessage = urlencode($msg);\n\t\t// $route = \"4\";\n\t\t// $authKey = \"109829ANu1kqLdg570b4e25\";\n\t\t// $senderId = \"Recharge\";\n\t\t// $postData = array(\n\t\t// 'authkey' => $authKey,\n\t\t// 'mobiles' => $mobileNumber,\n\t\t// 'message' => $encodedMessage,\n\t\t// 'sender' => $senderId,\n\t\t// 'route' => $route\n\t\t// );\n\t\t//$url=\"http://api.msg91.com/api/sendhttp.php\";\n\t\t$url = \"http://www.kudisms.net/components/com_spc/smsapi.php?username=smerp&password=abhishek&sender=kudisms&recipient='\" . $mobile . \"'&message=\" . $encodedMessage;\n\t\t$ch = curl_init();\n\t\tcurl_setopt_array($ch, array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData, CURLOPT_FOLLOWLOCATION => true));\n\t\t//\n\t\t//\n\t\t// //Ignore SSL certificate verification\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n\t\t//\n\t\t//\n\t\t// //get response\n\t\t$output = curl_exec($ch);\n\t\t//\n\t\t// if (curl_errno($ch)) {\n\t\t// $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n\t\t// echo json_encode($result);\n\t\t// exit();\n\t\t// // // //\n\t\t// }\n\t\tcurl_close($ch);\n\t\treturn $code;\n\t}", "private function checkingApiCanAuthenticateCode($auth_code)\n {\n return $this->api_request->get(\"user\",\"validate_user_code\",$params=array('code'=>$auth_code)); \n }", "public function oauthGenerateVerificationCode()\n {\n return substr(md5(rand()), 0, 6);\n }", "public function getTwoStepVerificationCode();", "public function getUserCode(){\n\t\t/* return user code */\n\t\treturn $this->_intUserCode;\n\t}", "public function insert () {\n\t\t$insertObj = ORM::for_table(self::AUTHCODE_TABLE)->create();\n\t\t$insertObj->code_hash = $this->hash;\n\t\t$insertObj->save();\n\t\treturn $insertObj->id();\n\t\t//$hsh = sqlPrep($this->hash);\n\t\t//$insstmt = \"INSERT INTO AUTHCODES (CODE_HASH) VALUES ($hsh)\";\n\t}", "public function send_sms_verification_code()\n\t{\n\t\t$user_id = Input::get('userId');\n\t\t$phone_number = Input::get('phoneNumber');\n\n\t\t// check if a verify record already exists\n\t\t$verify_record = $this->notifyRepo->smsVerificationCodeByUserId($user_id);\n\n\t\t// create the code, save it, send to user\n\t\t$verify_record = $this->notifyRepo->smsSendVerifyCode($user_id, $phone_number, $verify_record);\n\n\t\t$result = Twilio::message('+'.$phone_number, 'EriePaJobs - Your verification code is '.$verify_record->verification_code);\n\t}", "public function codeVerificationAction($header_data,$data){\n if( !isset($data['otp_no'])) {\n Library::logging('alert',\"API : codeVerification : \".ERROR_INPUT.\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_INPUT, null);\n } else {\n try {\n $user_id = $header_data['id'];\n $otp_no = $data['otp_no'];\n $user = Users::findById($user_id);\n \n $group = array();\n $db = Library::getMongo();\n $groups = $db->execute('return db.groups.find( { $and: [ { is_active: 1 }, { group_name: \"Friends\" } ] } ).toArray()');\n \n if($groups['ok'] == 0) {\n Library::logging('error',\"API : codeVerification (get groups) mongodb error: \".$groups['errmsg'].\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_REQUEST, null);\n }\n array_push($group,(string)$groups['retval'][0][_id]);\n if($user->otp == $otp_no) {\n if($user->is_active == 1) {\n // user already exist\n } else {\n $user->is_active = 1;\n $user->username = \"user\";\n $user->context_indicator = \"Available\";\n $user->my_mind_groups = $group;\n $user->about_me_groups = $group;\n $user->my_pictures_groups = $group;\n $user->unique_id = strtolower( uniqid() );\n $user->is_edit = 0;\n $user->is_searchable = 1;\n $user->is_mobile_searchable = 1;\n $user->save();\n }\n Library::output(true, '1', OTP_VERIFIED, null);\n } else {\n Library::logging('alert',OTP_WRONG.\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', OTP_WRONG, null);\n }\n } catch (Exception $e) {\n Library::logging('error',\"API : codeVerification : \".$e.\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_REQUEST, null);\n }\n }\n }", "public function generate_password_activation_code($id,$email){\r\n \r\n \r\n $this->load->helper('string');\r\n \r\n $data = array(\r\n 'forgot_password_code' => random_string('unique'),\r\n 'forgot_password_code_expire' => date('Y-m-d H:i:s',strtotime(\"+24 hours\"))\r\n ); \r\n $this->db->update('members', $data, array('id' => $id,'aes_decrypt(email,salt)' => $email));\r\n $this->db->last_query();\r\n return $data['forgot_password_code'];\r\n }", "public function check_promocode() {\n\t\t\t\t $usertypes = $this->users->checkUserTypeLaabus($this->session->userdata('user_id'));\n\t\t\t\t $agent_id = $usertypes[0]->agent_id;\n\t\t\t\t// print_r($usertypes);\n\t\t\t\tif(empty($agent_id))\n\t\t\t\t{\n\t\t\t\t\t$role_id = 4;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$role_id =44;\n\t\t\t\t}\n\t\t$data = $this->users->check_promocode($_REQUEST['promo_code'],$_REQUEST['amount'],$role_id);\n\t\techo $data;\n\t\texit;\n\t}", "function createNewAccessCode()\n\t{\n\t\t// create a 5 character code\n\t\t$codestring = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n\t\tmt_srand();\n\t\t$code = \"\";\n\t\tfor ($i = 1; $i <=5; $i++)\n\t\t{\n\t\t\t$index = mt_rand(0, strlen($codestring)-1);\n\t\t\t$code .= substr($codestring, $index, 1);\n\t\t}\n\t\t// verify it against the database\n\t\twhile (!$this->isSurveyCodeUnique($code))\n\t\t{\n\t\t\t$code = $this->createNewAccessCode();\n\t\t}\n\t\treturn $code;\n\t}", "public function testGenerateAddressAuthCode()\n {\n\n }", "function requestCode ($domain) {\n $url = 'https://' . $domain . '/oauth/authorize/' .\n '?client_id=' . urlencode(APP_ID);\n redirect($url);\n}", "public function verify_code($params) {\n\n $verification_code = $params['verification_code'];\n $code_id = $params['code_id'];\n\n $options = array('body'=> array());\n $options['body']['code']= ['verify'=> $verification_code];\n\n $uri = $code_id.\"/verify\";\n $uri = \"/cpaas/auth/v1/\".$this->client->user_id.\"/codes/\".$uri;\n $url = $this->client->_root.$uri;\n $response = $this->client->_request(\"PUT\", $url, $options);\n\n // check if test response\n if ($this->client->check_if_test($response)) {\n return $response;\n }\n // check if error response\n // if ($this->client->check_if_error($response)) {\n // $response = $this->client->build_error_response($response);\n // return $response;\n // }\n\n if ($response->getStatusCode() == 204) {\n $custom_response = ['verified'=> true, 'message'=> 'Success'];\n } else {\n $custom_response = ['verified'=> false, 'message'=> 'Code invalid or expired'];\n }\n\n return $custom_response;\n }", "public function genOTP($email, $phone, $uname, $transId = null) {\n\t\t$this->processing_code = \"1028\";\n\t\t$data = new stdClass();\n\t\tif($transId == null)\n\t\t\t$data->request_id = \"GOTP\" . date(\"Ymd\") . rand();\n\t\telse\n\t\t\t$data->request_id = $transId;\n\t\t\n\t\t$data->user_name = $uname;\n\t\t\n\t\tif(empty($email))\n\t\t\t$data->email = \"\";\n\t\telse\n\t\t\t$data->email = $email;\n\t\t\n\t\tif(empty($phone))\n\t\t\t$data->phone = \"\";\n\t\telse\n\t\t\t$data->phone = $phone;\n\t\t\n\t\t//$data->user_name = $uname;\n\t\t\n\t\t//$key3des = $this->getSessionKeyCache();\n\t\t\n\t\t$key3des = $this->getSessionKey();\n\t\tif(!$key3des)\n\t\t\treturn false;\n\t\t\n\t\t\n\t\tlog_message('error', 'data request genOTP: ' . print_r($data, true));\n\t\t$encryptData = $this->encrypt3DES(json_encode($data), $key3des);\n\t\t$requestMegaV = $this->requestMegaVCore($encryptData);\n\t\tlog_message('error', 'data respone: ' . print_r($requestMegaV, true));\n\t\t\n\t\t//$requestMegaV = '{\"status\":\"18\"}';\n\t\t\n\t\treturn $requestMegaV;\n\t}", "function generateCode(){\n $base=\"abcdefghijklmnopkrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-\";\n $i=0;\n $c=\"\";\n while ($i<6){\n $c.=$base[rand(0,strlen($base)-1)];\n $i++;\n }\n if (validate::existCode($c))\n return generateCode();\n return $c;\n}", "function forget_send_code($mobile){\n\t\t$varifycode = rand('10000000', '99999999');\n\t\t//$code = 1234;\n\t\t $code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t $mobileNumber = substr($mobile, 1);\n\t\t $msg = \"New Password of Recharge login : \" . $code;\n $encodedMessage = urlencode($msg);\n $route = \"4\";\n $authKey = \"109829ANu1kqLdg570b4e25\";\n $senderId = \"Recharge\";\n $postData = array(\n 'authkey' => $authKey,\n 'mobiles' => $mobileNumber,\n 'message' => $encodedMessage,\n 'sender' => $senderId,\n 'route' => $route\n);\n $url=\"http://api.msg91.com/api/sendhttp.php\";\n $ch = curl_init();\ncurl_setopt_array($ch, array(\n CURLOPT_URL => $url,\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_POSTFIELDS => $postData\n ,CURLOPT_FOLLOWLOCATION => true\n));\n// \n// \n// //Ignore SSL certificate verification\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n// \n// \n// //get response\n $output = curl_exec($ch);\n// \n // if (curl_errno($ch)) {\n\t // $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n // echo json_encode($result);\n\t\t\t // exit();\n// // // // \n\t\t // }\n curl_close($ch);\n\t\treturn $code;\n\t}", "protected function getAuthorizationCode()\n {\n $code = null;\n if ($this->responseMode === 'query' && isset($_GET['code'])) {\n $code = $_GET['code'];\n } else if ($this->responseMode === 'form_post' && isset($_POST['code'])) {\n $code = $_POST['code'];\n }\n\n return $code;\n }", "function get_password($usrid){\r\n\t\r\n}", "private function returnCodeMessage(int $code): string {\n $codes = [\n 211 => 'System status, or system help reply',\n 214 => 'Help message (A response to the HELP command)',\n 220 => '<domain> Service ready',\n 221 => '<domain> Service closing transmission channel',\n 235 => 'Authentication succeeded',\n 250 => 'Requested mail action okay, completed',\n 251 => 'User not local; will forward',\n 252 => 'Cannot verify the user, but it will try to deliver the message anyway',\n 334 => '(Server challenge - the text part contains the Base64-encoded challenge)',\n 354 => 'Start mail input',\n 421 => 'Service not available, closing transmission channel (This may be a reply to any command if the service knows it must shut down)',\n 432 => 'A password transition is needed',\n 450 => 'Requested mail action not taken: mailbox unavailable (e.g., mailbox busy or temporarily blocked for policy reasons)',\n 451 => 'Requested action aborted: local error in processing / IMAP server unavailable',\n 452 => 'Requested action not taken: insufficient system storage',\n 454 => 'Temporary authentication failure',\n 455 => 'Server unable to accommodate parameters',\n 500 => 'Syntax error, command unrecognized (This may include errors such as command line too long) / Authentication Exchange line is too long',\n 501 => 'Syntax error in parameters or arguments / Cannot Base64-decode Client responses / Client initiated Authentication Exchange (only when the SASL mechanism specified that client does not begin the authentication exchange)',\n 502 => 'Command not implemented',\n 503 => 'Bad sequence of commands',\n 504 => 'Command parameter is not implemented / Unrecognized authentication type',\n 521 => 'Server does not accept mail',\n 523 => 'Encryption Needed',\n 530 => 'Authentication required',\n 534 => 'Authentication mechanism is too weak',\n 535 => 'Authentication credentials invalid',\n 538 => 'Encryption required for requested authentication mechanism',\n 550 => 'Requested action not taken: mailbox unavailable (e.g., mailbox not found, no access, or command rejected for policy reasons)',\n 551 => 'User not local; please try <forward-path>',\n 552 => 'Requested mail action aborted: exceeded storage allocation',\n 553 => 'Requested action not taken: mailbox name not allowed',\n 554 => 'Transaction has failed (Or, in the case of a connection-opening response, \"No SMTP service here\") / Message too big for system',\n 556 => 'Domain does not accept mail',\n ];\n return $codes[$code] ?? '';\n }", "public function check() : int\n {\n\n /**\n * @return invalid request(1) if a code is empty ,null or undefined,\n * if not continue the next execution\n */\n\n if(!$this->code) return INVALID_REQUEST;\n\n\n /** @var $is_valid check the specified code is equal and valid */\n\n $is_valid = database::getInstance()->has('user',[\n\n \"id\" => (new Users())->get_id(),\n\n \"verification_code\" => $this->code\n\n ]);\n\n /** validation */\n\n if($is_valid) {\n\n /** @var $success if a specified code is valid\n * update the current status of \"isVerify\" attribute of a database\n * to PHONE_NUMBER_VERIFIED(1) and\n * @return the number of affected rows\n */\n\n $success = database::getInstance()->update('user',['isVerify'=>user_type::PHONE_NUMBER_VERIFIED],[\n\n \"id\"=> (new Users())->get_id()\n\n ])->rowCount();\n\n /** if has a affeted rows return valid request(2), invalid request if not */\n\n return $success ? VALID_REQUEST : INVALID_REQUEST;\n\n }\n\n\n /** return invalid request(1) if a code is not equal */\n\n return INVALID_REQUEST;\n\n\n\n }", "function password_change_login($email, $password, $verification_code) {\n\t\tglobal $pdo;\n\n\t\t//empty or array check\n\t\tif(empty($email) || is_array($email) || empty($password) || is_array($password) || empty($verification_code) || is_array($verification_code)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t//check if user exists\n\t\t$sql = \"SELECT id FROM user WHERE verification_code = :verification_code AND REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 1 AND TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, code_generation_time)) <= 600\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindParam(\":verification_code\", $verification_code, PDO::PARAM_STR);\n\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t$sth->execute();\n\n\t\tif($sth->rowCount() == 0) {\n\t\t\treturn 2;\n\t\t}\n\n\t\t//check if password meet our requirements\n\t\tif(!password_security_check($password)) {\n\t\t\treturn 3;\n\t\t}\n\n\t\t//hash password\n\t\t$password_hash = password_hash($password, PASSWORD_BCRYPT);\n\t\t//get id\n\t\t$id = $sth->fetch()[\"id\"];\n\n\t\t//change password\n\t\t$sql = \"UPDATE user SET verification_code = NULL, code_generation_time = NULL, password = :password_hash WHERE id = :id\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindParam(\":password_hash\", $password_hash, PDO::PARAM_STR);\n\t\t$sth->bindParam(\":id\", $id, PDO::PARAM_INT);\n\t\t$sth->execute();\n\t\treturn 0;\n\t}", "public function authenticate()\n\t{\n\t\tif ($data['code'] = $this->input->get('code', false, 'raw'))\n\t\t{\n\t\t\t$data['grant_type'] = 'authorization_code';\n\t\t\t$data['redirect_uri'] = $this->getOption('redirecturi');\n\t\t\t$data['client_id'] = $this->getOption('clientid');\n\t\t\t$data['client_secret'] = $this->getOption('clientsecret');\n\t\t\t$response = $this->http->post($this->getOption('tokenurl'), $data);\n\n\t\t\tif ($response->code >= 200 && $response->code < 400)\n\t\t\t{\n\n\t\t\t\tif ($response->headers['Content-Type'] == 'application/json')\n\t\t\t\t{\n\t\t\t\t\t$token = array_merge(json_decode($response->body, true), array('created' => time()));\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tparse_str($response->body, $token);\n\t\t\t\t\t$token = array_merge($token, array('created' => time()));\n\t\t\t\t}\n\n\t\t\t\t$this->setToken($token);\n\n\t\t\t\treturn $token;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthrow new RuntimeException('Error code ' . $response->code . ' received requesting access token: ' . $response->body . '.');\n\t\t\t}\n\t\t}\n\n\t\tif ($this->getOption('sendheaders'))\n\t\t{\n\t\t\t$this->application->redirect($this->createUrl());\n\t\t}\n\t\treturn false;\n\t}", "public function authorize_result()\n\t{\t\n\t\tif(isset($_GET['code']))\n\t\t{\n\t\t\tif($this->oauth->ci->session->userdata('state') !== $_GET['state'])\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('failure', array(\n 'error' => $this->oauth->ci->lang->line('error_xsfr_victim')\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('success', array(\n\t\t\t\t\t\t'token' => $_GET['code'],\n\t\t\t\t\t\t'state' => $_GET['state']\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(isset($_GET['error']))\n\t\t{\n\t\t\treturn $this->oauth->response('failure', array(\n\t\t\t\t\t'error' => $_GET['error_description']\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}", "public function authenticate_code($classname, $code){\n $query = \"SELECT classcode FROM classes where classname = $1;\";\n $query_result = pg_prepare($this->con, \"myquery15\", $query);\n $query_result = pg_execute($this->con, \"myquery15\", array($classname));\n $row = pg_fetch_row($query_result);\n if($row[0] == $code){ //Accesscode matched\n echo(\"Access Code matched\");\n return True;\n }\n else{return False;}\n\n\n }", "public function generateActivationCode($user) {\n // Random Number ( 6 digits )\n $code = 0;\n $min = 100001;\n $max = 999999;\n srand((double) microtime() * 1000000);\n \n if (function_exists('mt_rand')) {\n $code = mt_rand($min, $max); // faster\n }\n else {\n $code = rand($min, $max);\n }\n // Store Code in UserActivationCode Table\n $uac = UserActivationCode::where('user_id', $user->id)->first();\n if ($uac) {\n if (($uac->expiration-60) < time()) {\n // Keep OLD code before expiration - 1 min\n $code = $uac->code;\n } \n else {\n $uac->code = $code;\n $uac->expiration = time() + config('sc.activation_period');\n $uac->save();\n }\n }\n else {\n $uac = UserActivationCode::create([\n 'user_id' => $user->id, \n 'expiration'=> time() + config('sc.activation_period'), \n 'code' => $code\n ]);\n }\n\n return $code;\n }", "function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {\n\t$ckey_length = 4;\n\t$key = md5($key ? $key : ET_URL);\n\t$keya = md5(substr($key, 0, 16));\n\t$keyb = md5(substr($key, 16, 16));\n\t$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';\n\t$cryptkey = $keya.md5($keya.$keyc);\n\t$key_length = strlen($cryptkey);\n\t$string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;\n\t$string_length = strlen($string);\n\t$result = '';\n\t$box = range(0, 255);\n\t$rndkey = array();\n\tfor($i = 0; $i <= 255; $i++) {\n\t\t$rndkey[$i] = ord($cryptkey[$i % $key_length]);\n\t}\n\tfor($j = $i = 0; $i < 256; $i++) {\n\t\t$j = ($j + $box[$i] + $rndkey[$i]) % 256;\n\t\t$tmp = $box[$i];\n\t\t$box[$i] = $box[$j];\n\t\t$box[$j] = $tmp;\n\t}\n\tfor($a = $j = $i = 0; $i < $string_length; $i++) {\n\t\t$a = ($a + 1) % 256;\n\t\t$j = ($j + $box[$a]) % 256;\n\t\t$tmp = $box[$a];\n\t\t$box[$a] = $box[$j];\n\t\t$box[$j] = $tmp;\n\t\t$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));\n\t}\n\tif($operation == 'DECODE') {\n\t\tif((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {\n\t\t\treturn substr($result, 26);\n\t\t} else {\n\t\t\treturn '';\n\t\t}\n\t} else {\n\t\treturn $keyc.str_replace('=', '', base64_encode($result));\n\t}\n}", "public function generateVerificationCode()\n {\n $code = $this->createVerificationCode();\n\n $codeExists = $this->validateVerificationCode($code);\n\n $generationLimit = 100;\n\n while($codeExists && $generationLimit > 0)\n {\n $code = $this->createVerificationCode();\n\n $codeExists = $this->validateVerificationCode($code);\n\n $generationLimit--;\n }\n\n $this->forceFill([\n 'verification_code' => $code\n ])->save();\n\n return $code;\n }", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = $_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\n\t\t\t// Refferal amount\n\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t//-----------------/////\n\n\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\tif (!empty($records)) {\n\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount = $records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic = $records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) {\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n\t\t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$img = self_img_url . $user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$img = '';\n\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif ($status == '1') {\n\t\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\t\texit();\n\t\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status'] = 1;\n\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data);\n\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\t\t\t\tif (!empty($reffer_records)) {\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\n\t\t\t\t\t\t$data12['reffer_user_id'] = $user11_id;\n\t\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data12);\n\n\t\t\t\t\t}\n\t\t\t\t\t/*\n\t\t\t\t\t if(!empty($reffer_records)){\n\t\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t\t $refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t $user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t $reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t $wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t $frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t $current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t $transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t $wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t $refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t $wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t $wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t if($reffer_code == $reffer_code_database){\n\n\t\t\t\t\t $add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\n\t\t\t\t\t $add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t $data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t $update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\n\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t\t */\n\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'], 'user_id' => $user_id, 'user_wallet' => $wallet_amount, 'user_email' => $user_email, 'login_type' => 1, 'user_reffer_code' => $user_self_reffer, 'profile_pic' => $img, 'user_pin_status' => '2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\", 'user_mobile_no' => $_POST['user_mobile_no'], 'verification_code' => $_POST['user_verification_code']);\n\t\t\techo $this -> json($error);\n\t\t}\n\t}", "function getRandomCode()\n\t\t{\n\t\t\tglobal $wpdb;\n\n\t\t\twhile(empty($code))\n\t\t\t{\n\n\t\t\t\t$scramble = md5(AUTH_KEY . current_time('timestamp') . SECURE_AUTH_KEY);\n\t\t\t\t$code = substr($scramble, 0, 10);\n\t\t\t\t$code = apply_filters(\"pmpro_random_code\", $code, $this);\t//filter\n\t\t\t\t$check = $wpdb->get_var(\"SELECT id FROM $wpdb->pmpro_membership_orders WHERE code = '$code' LIMIT 1\");\n\t\t\t\tif($check || is_numeric($code))\n\t\t\t\t\t$code = NULL;\n\t\t\t}\n\n\t\t\treturn strtoupper($code);\n\t\t}", "protected function register() {\n\n\t\tif (request('code')) {\n\n\t\t\tif (request('code') == session('user_data')['code']) {\n\n\t\t\t\t$user = User::create([\n\t\t\t\t\t'name' => session('user_data')['name'],\n\t\t\t\t\t'email' => session('user_data')['email'],\n\t\t\t\t\t'phone' => session('user_data')['phone'],\n\t\t\t\t\t'password' => bcrypt(session('user_data')['password']),\n\t\t\t\t]);\n\n\t\t\t\tsession()->forget('user_data');\n\t\t\t\tauth()->login($user);\n\t\t\t\treturn redirect('/')->with('success', trans('user.register_complate'));\n\n\t\t\t} else {\n\t\t\t\tsession()->flash('error', trans('user.invalid_code'));\n\t\t\t\treturn view('auth.code_verfiy');\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t$data = request()->all();\n\t\t\t$data['code'] = rand(1000, 9999); //generate random code\n\n\t\t\t$mobily = new Mobily();\n\n\t\t\t$mobily->send(request('sender_phone'), 'Your code is : ' . $data['code']);\n\n\t\t\tif ($mobily) {\n\t\t\t\tsession(['user_data' => $data]);\n\t\t\t\treturn view('booking.code_verfiy')->with('userdata', session('user_data'));\n\t\t\t} else {\n\t\t\t\treturn $mobily;\n\t\t\t}\n\t\t\t/*\n\t\t\t\tNexmo::message()->send([\n\t\t\t\t\t'type' => 'unicode',\n\t\t\t\t\t'to' => request('phone'),\n\t\t\t\t\t'from' => 'hisham',\n\t\t\t\t\t'text' => 'Your code is : ' . $data['code'],\n\t\t\t*/\n\n\t\t\tsession(['user_data' => $data]);\n\t\t\treturn view('auth.code_verfiy')->with('userdata', session('user_data'));\n\n\t\t}\n\n\t}", "public function testGenerateAddressAuthCodeById()\n {\n\n }", "public function verify_actcode($member_email, $code){\n\t\t//$newCode = $this->make_activation_code();\n\t\t$mysql = New Mysql();\n\t\treturn($mysql->update_activation_code($member_email, $code));\n\t}", "static function verifyMobile($usr,$code){\r\n\t\t$usr = funcs::check_input($usr);\r\n\t\t$code = funcs::check_input($code);\r\n\r\n\t\t$expired_time = 7*24*60*60;\r\n\t\tif(strlen(trim($usr)) > 0)\r\n\t\t{\r\n\t\t\t$usrId = funcs::getUserid(htmlspecialchars($usr,ENT_QUOTES,'UTF-8'));\r\n\t\t\tif(ctype_digit($usrId) && strlen(trim($code)) > 0)\r\n\t\t\t{\r\n\t\t\t\t$chk = DBConnect::assoc_query_1D(\"SELECT vcode_mobile,waitver_mobileno,vcode_mobile_insert_time FROM \".TABLE_MEMBER.\" WHERE id=\".$usrId);\r\n\t\t\t\tif(strlen(trim($chk['waitver_mobileno'])) > 0 && strlen(trim($chk['vcode_mobile'])) > 0 && $chk['vcode_mobile'] == $code)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(time() <= ((int)$chk['vcode_mobile_insert_time']+$expired_time))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$query = \"UPDATE \".TABLE_MEMBER.\" SET validated='1',mobileno='\".$chk['waitver_mobileno'].\"',waitver_mobileno='' WHERE id=\".$usrId;\r\n\t\t\t\t\t\tDBconnect::execute_q($query);\r\n\t\t\t\t\t\t$_SESSION['MOBILE_VERIFIED'] = 1;\r\n\r\n\t\t\t\t\t\tif(COIN_VERIFY_MOBILE > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$username = funcs::findUserName($usrId);\r\n\t\t\t\t\t\t\t$coinVal = funcs::checkCoin($username);\r\n\r\n\t\t\t\t\t\t\tDBconnect::execute_q(\"UPDATE \".TABLE_MEMBER.\" SET coin=coin+\".COIN_VERIFY_MOBILE.\" WHERE id=\".$usrId);\r\n\t\t\t\t\t\t\t$sqlAddCoinLog = \"INSERT INTO coin_log (member_id, send_to, coin_field, coin, coin_remain, log_date) VALUES ('1','$usrId','Mobile Verify','\".COIN_VERIFY_MOBILE.\"',\".$coinVal.\", NOW())\";\r\n\t\t\t\t\t\t\tDBconnect::execute($sqlAddCoinLog);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\treturn 4;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\treturn 3;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\treturn 2;\r\n\t\t\t}\r\n\t\t\tunset($usrId);\r\n\t\t}\r\n\t}", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = country_code.$_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\t\t\t\n\t\t\t\t// Refferal amount\n\t\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t//-----------------/////\n\t\t\t\n\t\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\t\tif (!empty($records)) {\n\t\t\t\t\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount=$records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic=$records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) \t{\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n \t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n \t\t\t\t\t$img = self_img_url.$user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t\t} else \t{\n\t\t\t\t\t$img = '';\t\n\t\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif($status=='1'){\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\texit();\n\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status']=1;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data);\n\t\t\t\t\t\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code',$reffer_code);\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t$data12['reffer_user_id']=$user11_id;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data12);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\t\t\t\t\t$reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t\t\t\t\t\t\t$wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t\t\t\t\t\t\t$frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t\t\t\t\t\t\t$current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t\t\t\t\t\t\t$transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t\t\t\t\t\t\t$wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t\t\t\t\t\t\t$refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t\t\t\t\t\t\t$wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t\t\t\t\t\t\t$wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t\t\t\t\t\tif($reffer_code == $reffer_code_database){\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t$add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t$add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t\t\t\t\t\t\t$data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\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\t\t\n\t\t\t\t\t\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'],'user_id'=>$user_id,'user_wallet'=>$wallet_amount,'user_email'=>$user_email,'login_type'=>1,'user_reffer_code'=>$user_self_reffer,'profile_pic'=>$img,'user_pin_status'=>'2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t}else{\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\" ,'user_mobile_no' => $_POST['user_mobile_no'],'verification_code'=>$_POST['user_verification_code']);\n\t\techo $this -> json($error);\n\t\t}\n\t}", "private function generateCode($length = 10)\r\n\t{\r\n\t\t$passcode=\"\";\r\n\t\t$chars = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\";\r\n\t\tsrand((double)microtime()*1000000);\r\n\t\tfor ($i=0; $i<$length; $i++)\r\n\t\t{\r\n\t\t\t$passcode .= substr ($chars, rand() % strlen($chars), 1);\r\n\t\t}\r\n\t\treturn $passcode;\r\n\t}", "public function getForgottenPasswordCode() {\n\t\tif ($this->forgotten_password_code) return $this->forgotten_password_code;\n\n\t\t$code = getRandomString(20);\n\n\t\t$db = getDB();\n\t\t$s = $db->prepare(\"UPDATE user_account SET forgotten_password_code=:c, forgotten_password_code_generated_at=:at WHERE id=:id\");\n\t\t$s->execute(array('c'=>$code, 'id'=>$this->id,'at'=>date(\"Y-m-d H:i:s\")));\n\n\t\t$this->forgotten_password_code = $code;\n\t\treturn $code;\n\n\t}", "public function generate_code()\n {\n return $string = bin2hex(random_bytes(10));\n }", "public function registerGET($code){\n \t\n \tif (CustomCrypt::decrypt($code) == 'stambic') {\n \t\treturn view('app.register');\n \t}\n\n \treturn view('app.login');\n \t\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 }", "public function validationSha($code){\r\n\t\t//variables\r\n\t\t$error = '';\r\n\t\t$user_browser = $_SERVER['HTTP_USER_AGENT']; //navegador\r\n\t\t$ip = $_SERVER['REMOTE_ADDR']; //ip\r\n\t\r\n\t\t$this->where('macro_sha', $code);\r\n\t\tif($salida = $this->getOne('solicitudes_clave')){\r\n\t\t\t\r\n\t\t\tif($salida['navegador'] != $user_browser){\t$error = 'navegador no concide';\t}\r\n\t\t\tif($salida['ip'] != $ip){\t\t\t\t\t$error = 'remote ip no concide';\t}\r\n\t\t\t\r\n\t\t\tif($error != ''){\r\n\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\treturn false;\r\n\t\t\t}else{\r\n\t\t\t\t$nuevo_sha = hash('sha512', $salida['email'].$user_browser.$salida['telefono'].$ip);\r\n\t\t\t\tif($nuevo_sha != $salida['macro_sha']){\r\n\t\t\t\t\t$error = 'Shas no coinciden';\r\n\t\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}else{\r\n\t\t\t\t\t//succes!!\r\n\t\t\t\t\t$_SESSION['email_val'] = $salida['email'];\r\n\t\t\t\t\t$_SESSION['corrector'] = $salida['salt'];\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t}else{\r\n\t\t\t$error = 'no hubo conexion a db';\r\n\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "public function setCode($user,$el=false){\n\t\t$pwd=substr($user['password'],0,6);\n\t\t$agent=substr(md5(substr($_SERVER['HTTP_USER_AGENT'],0,20)),0,4);\n\t\t$data=array(\n\t\t\t\"u\"=>$user['userid'],\n\t\t\t\"p\"=>$pwd,\n\t\t\t\"a\"=>$agent,\n\t\t\t\"e\"=>time()+3600*24*2,\n\t\t);\n\t\t\n\t\t$authcode=jiami(json_encode($data));\n\t\t$data['el']=time()+3600*24*300;\n\t\t$authCodeLong=jiami(json_encode($data));\n\t\t$redata=array(\n\t\t\t\"authcode\"=>$authcode,\n\t\t\t\"authcodeLong\"=>$authCodeLong\n\t\t);\n\t\treturn $redata;\n\t}", "public function retrieveOTP() {\n\t\tif ( ! wp_verify_nonce( HTTP_Helper::retrieveGet( 'nonce' ), 'defRetrieveOTP' ) ) {\n\t\t\twp_send_json_error( array() );\n\t\t}\n\t\t\n\t\t$token = HTTP_Helper::retrieveGet( 'token' );\n\t\t$query = new \\WP_User_Query( array(\n\t\t\t'meta_key' => 'defOTPLoginToken',\n\t\t\t'meta_value' => $token,\n\t\t\t'blog_id' => 0\n\t\t) );\n\t\t$res = $query->get_results();\n\t\tif ( empty( $res ) ) {\n\t\t\t//no user\n\t\t\twp_send_json_error( array(\n\t\t\t\t'message' => __( \"Your token is invalid\", \"defender-security\" )\n\t\t\t) );\n\t\t}\n\t\t\n\t\t$user = $res[0];\n\t\t//create a backup code for this user\n\t\t$code = Auth_API::createBackupCode( $user->ID );\n\t\t//send email\n\t\t$backupEmail = Auth_API::getBackupEmail( $user->ID );\n\t\t\n\t\t$settings = Auth_Settings::instance();\n\t\t$subject = ! empty( $settings->email_subject ) ? esc_attr( $settings->email_subject ) : __( 'Your OTP code', \"defender-security\" );\n\t\t$sender = ! empty( $settings->email_sender ) ? esc_attr( $settings->email_sender ) : false;\n\t\t$body = ! empty( $settings->email_body ) ? $settings->email_body : $settings->two_factor_opt_email_default_body();\n\t\t$params = [\n\t\t\t'display_name' => $user->display_name,\n\t\t\t'passcode' => $code,\n\t\t];\n\t\tforeach ( $params as $key => $val ) {\n\t\t\t$body = str_replace( '{{' . $key . '}}', $val, $body );\n\t\t}\n\t\t$headers = array( 'Content-Type: text/html; charset=UTF-8' );\n\t\tif ( $sender ) {\n\t\t\t$from_email = get_bloginfo( 'admin_email' );\n\t\t\t$headers[] = sprintf( 'From: %s <%s>', $sender, $from_email );\n\t\t}\n\t\t\n\t\t//send\n\t\twp_mail( $backupEmail, $subject, $body, $headers );\n\t\t\n\t\twp_send_json_success( array(\n\t\t\t'message' => __( \"Your code has been sent to your email.\", \"defender-security\" )\n\t\t) );\n\t}", "function generateCode($length) { \n\t\t$chars = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPRQSTUVWXYZ0123456789\"; \n\t\t$code = \"\"; \n\t\t$clen = strlen($chars) - 1; \n\t\twhile (strlen($code) < $length) { \n\t\t\t$code .= $chars[mt_rand(0,$clen)]; \n\t\t} \n\t\treturn $code; \n\t}", "function check_reffer_code(){\n\t$reffer_code=$_REQUEST['reffer_code'];\n\tif(!empty($reffer_code)){\n\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\tif(!empty($reffer_records)){\n\t\t\t$user_id=$reffer_records[0]['user_id'];\n\t\t\t$user_reffer_code=$reffer_records[0]['user_refferal_code'];\n\t\t\tif($user_reffer_code==$reffer_code){\n\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Reffer code avalible\", 'reffer_code' => $reffer_code,'user_id'=>$user_id);\n\t\t\t}else{\n\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t}\n\t\t\t\n\t\t}else{\n\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t}\n\t}else{\n\t\t$post = array(\"status\" => \"false\", \"message\" => \"Missing parameter\",'reffer_code'=>$reffer_code);\n\t}\n\techo $this -> json($post);\n}", "public function createQrCodeForUser($type = 'PNG')\n\t{\n\t\treturn $this->createQrCode($this->getOtpAuthUrl($this->secret, \\App\\User::getUserModel($this->userId)->getDetail('user_name')), $type);\n\t}", "public function activateAccount($code, $email)\n {\n\n // define all the global variables\n global $database, $message, $functions;\n\n // escape the given strings\n $code = $this->secureInput($code);\n $email = $this->secureInput($email);\n\n // start the checks\n if (empty($code) || empty($email)) {\n $message->setError(\"Code/Email fields most not be empty\", Message::Error);\n return false;\n }\n\n // check if email exists\n if (!$functions->emailExist($email)) {\n $message->setError(\"The provided email is not in our database.\", Message::Error);\n return false;\n }\n\n // check if the given code matches the required characters\n if (strlen($code) < 20 || strlen($code) > 20) {\n $message->setError(\"The given code has to be exactly 20 characters long\", Message::Error);\n return false;\n }\n\n // check if account already has been activated\n if ($functions->isUserActivated($email, true)) {\n $message->setError(\"The account is already activated\", Message::Error);\n return false;\n }\n\n $sql = \"SELECT * FROM \" . TBL_USERS . \" WHERE \" . TBL_USERS_EMAIL . \" = '\" . $email . \"' AND \" . TBL_USERS_ACTIVATION_CODE . \" = '\" . $code . \"'\";\n\n // get the sql results\n $result = $database->getQueryResults($sql);\n if ($database->anyError()) {\n return false;\n }\n\n // check if wrong code has been used\n if ($database->getQueryNumRows($result, true) < 1) {\n $message->setError(\"Wrong activation code has been used.\", Message::Error);\n return false;\n }\n\n //update the user account with the needed information\n $sql = \"UPDATE \" . TBL_USERS . \" SET \" . TBL_USERS_ACTIVATED . \" ='1',\" . TBL_USERS_ACTIVATION_CODE . \"='' WHERE \" . TBL_USERS_EMAIL . \" = '\" . $email . \"' AND \" . TBL_USERS_ACTIVATION_CODE . \" = '\" . $code . \"'\";\n\n // get the sql results\n $database->getQueryResults($sql);\n if ($database->anyError()) {\n return false;\n }\n\n $message->setSuccess(\"Your account has been activated successfully !\");\n return true;\n }", "public function generateTokenAction($header_data,$data){ \n if( !isset($data['device_id']) ) {\n Library::logging('alert',\"API : generateToken : \".ERROR_INPUT.\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_INPUT, null);\n } else {\n try {\n $user_id = $header_data['id'];\n $device_id = $data['device_id'];\n $security = new \\Phalcon\\Security();\n $user = Users::findById($user_id);\n if($user) {\n $result = array();\n // generate new hash\n $hash = KEY.'-'.$device_id;\n $hash = $security->hash($hash); \n $user->hash = $hash;\n $user->save();\n\n $result['token'] = $hash;\n\n Library::output(true, '1', TOKEN_MSG, $result);\n } else {\n Library::output(false, '0', USER_NOT_REGISTERED, null);\n }\n } catch (Exception $e) {\n Library::logging('error',\"API : generateToken : \".$e.\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_REQUEST, null);\n }\n }\n }", "public function checkCode(TwoFactorInterface $user, $code);", "function getUniqueCode($length = \"\") // used in confirm-password.php\r\n\r\n{\t\r\n\r\n\t$code = md5(uniqid(rand(), true));\r\n\r\n\tif ($length != \"\") return substr($code, 0, $length);\r\n\r\n\telse return $code;\r\n\r\n}", "public function make_activation_code(){\n\t\t$alphanum = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\";\n\t\t return substr(str_shuffle($alphanum), 0, 7);\n\t}", "public function code() {\n\t\t// transform the secret key to binary data\n\t\t$secret = pack('H*', $this->secret());\n\t\t// compute the cycle number\n\t\t$time = (int) ($this->servertime() / $this->waitingtime());\n\t\t// convert the cycle to a 8 bytes unsigned long big endian order\n\t\t$cycle = pack('N*', 0, $time);\n\t\t// calculate HMAC-SHA1 from secret key and cycle\n\t\t$mac = hash_hmac('sha1', $cycle, $secret);\n\t\t// determine which 4 bytes of the MAC are taken as the current code\n\t\t// last 4 bit of the MAC points to the starting byte\n\t\t$start = hexdec($mac{39}) * 2;\n\t\t// select the byte at starting position and the following 3 bytes\n\t\t$mac_part = substr($mac, $start, 8);\n\t\t$code = hexdec($mac_part) & 0x7fffffff;\n\t\t// use the lowest 8 decimal digits from the selected integer as the\n\t\t// current authenticator code\n\t\treturn str_pad($code % 100000000, 8, '0', STR_PAD_LEFT);\n\t}", "public function resendCode($phone)\n\t{\t\n\t\t$user = new User();\n\t\t$user->phone = $phone;\n\t\t$user->phone_token = mt_rand(100000, 999999);\n\n\t\t$querry = \"UPDATE \". DBTool::rawTable('users') . \" SET phone_token = '\" . $user->phone_token . \"', verified_phone = 0 WHERE phone = '\" . $phone . \"'\";\n\t\t$updated = DB::update(DB::raw($querry));\n\t\t$updated = ArrayHelper::fromObject($updated);\n\n\t\t// Send Verification Code by SMS\n\t\t// $this->sendVerificationCode($user);\n\n\t\tif(!(NotifyController::SendNotification(\n\t\t\t\t['1' => 'NOFIFY_SMS'],\n\t\t\t\t['phone' => \"$phone\",\n\t\t\t\t'message'=>\"$this->message $user->phone_token\",\n\t\t\t\t'verify' => 1]\n\t\t))){\n\t\t\treturn redirect()->back();\n\t\t}\n\t\t$data = [];\n\t\t\n\t\t// References\n\t\t$data['countries'] = CountryLocalizationHelper::transAll(CountryLocalization::getCountries());\n\t\t$data['genders'] = Gender::trans()->get();\n\t\t$data['phone'] = $phone;\n\t\t// Meta Tags\n\t\tMetaTag::set('title', getMetaTag('title', 'register'));\n\t\tMetaTag::set('description', strip_tags(getMetaTag('description', 'register')));\n\t\tMetaTag::set('keywords', getMetaTag('keywords', 'register'));\n\t\t\n\t\treturn view('auth.register.indexSecond', $data);\n\t}", "public function run()\n {\n GrantType::checkGrantType(Yii::$app->request->post('grant_type'), GrantType::GRANT_TYPE_AUTHORIZATION_CODE);\n Client::checkClientSecret(Client::checkClientId(Yii::$app->request->post('client_id')), Yii::$app->request->post('client_secret'));\n AuthorizationCode::checkAuthorizationCode(Yii::$app->request->post('code'), Yii::$app->request->post('redirect_uri'));\n\n return AccessToken::createAccessToken(Yii::$app->request->post('client_id'), Yii::$app->request->post('code'));\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}", "public function update_verify_otp(){\n\n // user user-id from session\n $encodedkey = $this->session->userdata('PariKey_session');\n $user_id='';\n $key=base64_decode($encodedkey);\n $keyarr=explode('|', $key);\n //session key format is $keyarr[0]=PARInaayKEY|$keyarr[1]=email_id|$keyarr[2]=user_id\n\n extract($_POST);\n \n // validation\n if(empty($otp_code)){\n $response=array(\n 'status' => 'validation',\n 'message' => '<b>Warning:</b> OTP Code is required!',\n 'field' => 'otp_code'\n );\n echo json_encode($response);\n die();\n }\n $result = $this->user_model->verify_otp($otp_code,$keyarr[2]);\n\n echo json_encode($result);\n}", "function ts3client_createIdentity(&$result) {}", "public function getCode() : int;", "public function getCode(): int;", "public function validateCustomerCodeApi(){\n\t\t$customerID = $this->input->post('customerID');\n\t\t$query = $this->db->get_where('users', ['id' => $customerID]);\n\t\n\t\tif($query->num_rows() > 0)\n\t\t{\n\t\t\tforeach($query->result() as $r);\n\t\t\n\t\t\n\t\t\t$data['status'] \t\t= 'true';\n\t\t\t$data['customerName']\t= $r->first_name.' '.$r->last_name;\n\t\t//\t$data['customerAddress']\t= nl2br($r->street_address);\n\t\t\t$data['customerAddress']\t= 'Client Role : '.typeDbTableRow($r->rolename)->rolename;\n\t\t\t$data['customerAddress']\t.= '<br />SMS No : '.$r->contactno ;\n\t\t\t$data['customerAddress']\t.= ($r->passport_no = '') ?\n\t\t\t\t\t\t\t\t\t\t'<br /> Passport No : '. $r->passport_no :\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t'<br /> Account No : '. $r->account_no;\n\t\t\t\t\t\t\t\t\t\t'<br /> Adhaar Card No : '. $r->adhaar_no;\n\t\t\t\t\t\t\t\t\t\t\n\t\t}\n\t\telse{\n\t\t\t$data['status'] \t\t\t= 'false';\n\t\t\t$data['customerName']\t\t= '';\n\t\t\t$data['customerAddress']\t= '';\n\t\t}\n\n\t\techo json_encode($data);\n\t}", "public function generateActivationCode() : int\n {\n return mt_rand(100000, 999999);\n }", "private function generate_code(){\n $bytes = random_bytes(2);\n // var_dump(bin2hex($bytes));\n return bin2hex($bytes);\n }" ]
[ "0.6973977", "0.68567944", "0.653663", "0.6469809", "0.6230544", "0.6160553", "0.6155896", "0.6071113", "0.606184", "0.6061542", "0.60458225", "0.6037689", "0.5979467", "0.595551", "0.59494174", "0.5949014", "0.59301543", "0.5901704", "0.5869621", "0.58634496", "0.5858948", "0.58327526", "0.58236843", "0.58167034", "0.5814327", "0.5761703", "0.5755713", "0.5754493", "0.5747124", "0.57183665", "0.57105607", "0.5708819", "0.5708461", "0.569584", "0.5687845", "0.56744367", "0.56744057", "0.567131", "0.5670479", "0.566523", "0.5653323", "0.5642363", "0.5614643", "0.56022173", "0.55971915", "0.5588953", "0.55822504", "0.55740976", "0.5563191", "0.5557315", "0.5541035", "0.55401754", "0.5537715", "0.55370075", "0.5530917", "0.55172354", "0.5508457", "0.54908466", "0.5478353", "0.5468047", "0.5465568", "0.54586756", "0.5453232", "0.5438575", "0.5418809", "0.54160184", "0.5413224", "0.54108226", "0.5410695", "0.54078543", "0.54076415", "0.54041433", "0.5404087", "0.539541", "0.53727543", "0.53661954", "0.5363021", "0.53451604", "0.5344548", "0.5343608", "0.53376466", "0.5330619", "0.53300977", "0.53271484", "0.53239", "0.53230524", "0.5322122", "0.53093785", "0.530628", "0.53040236", "0.53017014", "0.5298381", "0.5297265", "0.5290181", "0.5287207", "0.52849996", "0.52780765", "0.52763224", "0.52757746", "0.52714396" ]
0.79321396
0
/desc:check authcode time /input:arg(user_id,code_type,email) /output:return(errorcode(1success,0failed))
function check_authcode_email($email,$code_type,$user_id="") { if($email) { if($this->_redis) { $errorcode=$this->check_auth('email',$email); } else { $this->db->select("id"); $this->db->from($this->_table); $this->db->where("email",$email); $this->db->where("code_type",$code_type); $this->db->where("has_verified",0); $this->db->where("generate_time >",date("Y-m-d H:i:s",strtotime(date("Y-m-d H:i:s")." -".Constant::SEND_AUTHCODE_INTERVAL_EMAIL))); $query=$this->db->get(); $total=$query->num_rows(); if($total>0) $errorcode=true; else $errorcode=false; } } else { $errorcode=true; } return array("errorcode"=>$errorcode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function verify_authcode_email($authcode)\n\t{\n\t\t$user_id=$email=$code_type=$user_type=0;\n\t\tif($this->_redis)\n\t\t{\n\t\t\t$data=$this->cache->get($authcode);\t\n\t\t\tif(!empty($data))\n\t\t\t{\n\t\t\t\t$data=json_decode($data);\n\t\t\t\t$user_id=$data->user_id;\n\t\t\t\t$email=$data->email;\n\t\t\t\t$code_type=$data->code_type;\n\t\t\t\t$user_type=$data->user_type;\t\n\t\t\t\t$this->cache->delete($authcode);\n\t\t\t\t$errorcode=true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t\tlog_message('error_tizi','17052:email verify code failed',array('authcode'=>$authcode));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n \t$this->db->select(\"id,user_id,email,code_type,user_type,generate_time\");\n \t$this->db->from($this->_table);\n \t $this->db->where(\"authcode\",$authcode);\n \t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_EMAIL);\n \t$query=$this->db->get();\n \t$total=$query->num_rows();\n \t$gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_EMAIL))>date(\"Y-m-d H:i:s\"))\n \t{\n \t$id=$query->row()->id;\n \t$user_id=$query->row()->user_id;\n \t$email=$query->row()->email;\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\t$user_type=$query->row()->user_type;\n \t$this->db->where('id',$id);\n \t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n \tif($this->db->affected_rows()==1) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n \t}\n \telse\n \t{\n \t\t$errorcode=false;\n \t}\n\t\t}\n return array('user_id'=>$user_id,'email'=>$email,'code_type'=>$code_type,'user_type'=>$user_type,'errorcode'=>$errorcode);\n\t}", "function authenticate_user($email_a, $passcode){\r\n\t//QUERY DATABASE/ACTIVE DIRECTORY TO SEE IF USER IS VALID\r\nif ($email == \"insert valid email b4 testing\") {\r\n\t/*** set a form token ***/\r\n\t$form_token = md5( uniqid('auth', true) );\r\n\t/*** set the session form token ***/\r\n\t$_SESSION['form_token'] = $form_token;\r\n\t$_SESSION['email_a'] = $email_a;\r\n\t$_SESSION['start_timestamp'] = date('Y-m-d HH:mm:s');\r\n\t$code = \"valid\";\r\n}else{\r\n\t$code = \"invalid\";\r\n\t}\r\necho return $code \"We were unable to validate your information, Please try again\";\r\n /*RETURNED TO CALLING CODE */\r\n\t}", "function generate_authcode_email($email,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER,$check=true)\n\t{\n\t\t$authcode=\"\";\n\t\tif($check) $errorcode=$this->check_authcode_email($email,$code_type,$user_id);\t\n\t\telse $errorcode=array('errorcode'=>false);\n\t\tif(!$errorcode['errorcode'])\n {\t\n $authcode=random_string('unique');\n $data=$this->bind_verify($user_id,$email,\"\",1,$code_type,$authcode,$user_type);\n\t\t\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode,json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_EMAIL);\n\t\t\t\t$this->save_check('email',$email,$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_EMAIL);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n \t\t$insert_id=$this->db->insert_id();\n \t\tif($insert_id>0) $errorcode=true;\n \t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170018:Gen email auth code',array('email'=>$email));\n\t\t\tif(!$errorcode) log_message('error_tizi','17018:Gen email auth code failed',array('email'=>$email));\t\t\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t}\n\t\treturn array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "public function checkCode(User $user, $code);", "function check_auth_response_code($status) {\n\n if ($status != 'S000') {\n $message = get_ticket_error_message($status);\n return result_error($status,$message);\n }\n return result_success();\n}", "function check_authcode_phone($phone,$code_type,$user_id=\"\")\n {\n\t\tif($phone)\n\t\t{\n\t\t\tif($this->_redis)\n\t\t\t{\n\n\t\t\t\t$errorcode=$this->check_auth('phone',sha1($phone));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"phone\",sha1($phone));//需要通过服务获得加密后的电话号码\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" - \".Constant::SEND_AUTHCODE_INTERVAL_PHONE)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n }", "public function check() : int\n {\n\n /**\n * @return invalid request(1) if a code is empty ,null or undefined,\n * if not continue the next execution\n */\n\n if(!$this->code) return INVALID_REQUEST;\n\n\n /** @var $is_valid check the specified code is equal and valid */\n\n $is_valid = database::getInstance()->has('user',[\n\n \"id\" => (new Users())->get_id(),\n\n \"verification_code\" => $this->code\n\n ]);\n\n /** validation */\n\n if($is_valid) {\n\n /** @var $success if a specified code is valid\n * update the current status of \"isVerify\" attribute of a database\n * to PHONE_NUMBER_VERIFIED(1) and\n * @return the number of affected rows\n */\n\n $success = database::getInstance()->update('user',['isVerify'=>user_type::PHONE_NUMBER_VERIFIED],[\n\n \"id\"=> (new Users())->get_id()\n\n ])->rowCount();\n\n /** if has a affeted rows return valid request(2), invalid request if not */\n\n return $success ? VALID_REQUEST : INVALID_REQUEST;\n\n }\n\n\n /** return invalid request(1) if a code is not equal */\n\n return INVALID_REQUEST;\n\n\n\n }", "function verifyemail() {\n\t$a = array(\n\t 'status' => 'system-error'\n\t);\n\n\t// raw inputs\n\t$taint_si = isset($_POST['si']) ? $_POST['si'] : 0;\n\t$taint_tic = isset($_POST['tic']) ? $_POST['tic'] : 0;\n\t$taint_pword = isset($_POST['pword']) ? $_POST['pword'] : 0;\n\n\t// validate inputs\n\t$si = validateToken($taint_si);\n\t$tic = validateTic($taint_tic);\n\t$pword = validatePword($taint_pword);\n\n\t// validate parameter set\n\tif (!$si || !$tic || !$pword) {\n\t\tLog::write(LOG_WARNING, 'attempt with invalid parameter set');\n\t\treturn $a;\n\t}\n\n\t// get db connection\n\t$conn = getConnection();\n\tif (!$conn) {\n\t\treturn $a;\n\t}\n\n\t// read token and user table\n\t$result = getUserByToken($conn, $si);\n\tif (!$result) {\n\t\treturn $a;\n\t}\n\n\t// get fields\n\t$row = pg_fetch_array($result, 0, PGSQL_ASSOC);\n\t$userid = $row['id'];\n\t$hashpassword = $row['hashpassword'];\n\t$auth = $row['auth'];\n\t$hashtic = $row['hashtic'];\n\t$oldemail = $row['email'];\n\n\t// verify user authentication state\n\tif (!isUserEmailPending($auth)) {\n\t \tLog::write(LOG_NOTICE, 'attempt to verify email on user not auth=email-pending');\n\t\treturn $a;\n\t}\n\n\t// verify the password\n\t$boo = verifyPassword($pword, $hashpassword);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid password');\n\t\treturn $a;\n\t}\n\n\t// verify the tic from the email\n\t$boo = verifyTic($tic, $hashtic);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid tic');\n\t\treturn $a;\n\t}\n\n\t// update user record\n\t$auth = DB::$auth_verified;\n\t$name = 'verify-email';\n\t$sql = \"update accounts.user set email=newemail, newemail='', auth=$1, hashtic=null, tmhashtic=null where id = $2\";\n\t$params = array($auth, $userid);\n\t$result = execSql($conn, $name, $sql, $params, true);\n\tif (!$result) {\n\t\treturn false;\n\t}\n\n\t// send security notice\n\t$boo = sendAuthenticationEmail($oldemail, 'changedemail', '');\n\tif (!$boo) {\n\t\t$a['status'] = 'send-email-failed';\n\t\treturn $a;\n\t}\n\n\t// success\n\t$a['status'] = 'ok';\n\t$a['auth'] = $auth;\n\treturn $a;\n}", "private function checkingApiCanAuthenticateCode($auth_code)\n {\n return $this->api_request->get(\"user\",\"validate_user_code\",$params=array('code'=>$auth_code)); \n }", "public function checkCode(TwoFactorInterface $user, $code);", "public function verify_actcode($member_email, $code){\n\t\t//$newCode = $this->make_activation_code();\n\t\t$mysql = New Mysql();\n\t\treturn($mysql->update_activation_code($member_email, $code));\n\t}", "function check_reffer_code(){\n\t$reffer_code=$_REQUEST['reffer_code'];\n\tif(!empty($reffer_code)){\n\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\tif(!empty($reffer_records)){\n\t\t\t$user_id=$reffer_records[0]['user_id'];\n\t\t\t$user_reffer_code=$reffer_records[0]['user_refferal_code'];\n\t\t\tif($user_reffer_code==$reffer_code){\n\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Reffer code avalible\", 'reffer_code' => $reffer_code,'user_id'=>$user_id);\n\t\t\t}else{\n\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t}\n\t\t\t\n\t\t}else{\n\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t}\n\t}else{\n\t\t$post = array(\"status\" => \"false\", \"message\" => \"Missing parameter\",'reffer_code'=>$reffer_code);\n\t}\n\techo $this -> json($post);\n}", "public function check_activity( $code=NULL){\n\t\tif( $code!=NULL){\t\n\t\t\t$user = $this->get_by(array(\n\t\t\t\t'code' => $code,\n\t\t\t\t'account_active' => '0',\n\t\t\t), TRUE);\n\t\t\treturn($user);\n\t\t}\n\t\treturn false;\n\t\t}", "function executeCommandAUTH(&$SMSGW, $argument = null)\n{\n $code = $SMSGW->getAndSaveAuthCode();\n\n if ($code > 9999 && $code < 100000)\n {\n return $SMSGW->sendMessage('Auth code: ' . $code);\n }\n else\n {\n $SMSGW->log(__FUNCTION__, 'Unable to save auth code to db or invalid code - ' . $code);\n return false;\n }\n}", "static function verifyMobile($usr,$code){\r\n\t\t$usr = funcs::check_input($usr);\r\n\t\t$code = funcs::check_input($code);\r\n\r\n\t\t$expired_time = 7*24*60*60;\r\n\t\tif(strlen(trim($usr)) > 0)\r\n\t\t{\r\n\t\t\t$usrId = funcs::getUserid(htmlspecialchars($usr,ENT_QUOTES,'UTF-8'));\r\n\t\t\tif(ctype_digit($usrId) && strlen(trim($code)) > 0)\r\n\t\t\t{\r\n\t\t\t\t$chk = DBConnect::assoc_query_1D(\"SELECT vcode_mobile,waitver_mobileno,vcode_mobile_insert_time FROM \".TABLE_MEMBER.\" WHERE id=\".$usrId);\r\n\t\t\t\tif(strlen(trim($chk['waitver_mobileno'])) > 0 && strlen(trim($chk['vcode_mobile'])) > 0 && $chk['vcode_mobile'] == $code)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(time() <= ((int)$chk['vcode_mobile_insert_time']+$expired_time))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$query = \"UPDATE \".TABLE_MEMBER.\" SET validated='1',mobileno='\".$chk['waitver_mobileno'].\"',waitver_mobileno='' WHERE id=\".$usrId;\r\n\t\t\t\t\t\tDBconnect::execute_q($query);\r\n\t\t\t\t\t\t$_SESSION['MOBILE_VERIFIED'] = 1;\r\n\r\n\t\t\t\t\t\tif(COIN_VERIFY_MOBILE > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$username = funcs::findUserName($usrId);\r\n\t\t\t\t\t\t\t$coinVal = funcs::checkCoin($username);\r\n\r\n\t\t\t\t\t\t\tDBconnect::execute_q(\"UPDATE \".TABLE_MEMBER.\" SET coin=coin+\".COIN_VERIFY_MOBILE.\" WHERE id=\".$usrId);\r\n\t\t\t\t\t\t\t$sqlAddCoinLog = \"INSERT INTO coin_log (member_id, send_to, coin_field, coin, coin_remain, log_date) VALUES ('1','$usrId','Mobile Verify','\".COIN_VERIFY_MOBILE.\"',\".$coinVal.\", NOW())\";\r\n\t\t\t\t\t\t\tDBconnect::execute($sqlAddCoinLog);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\treturn 4;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\treturn 3;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\treturn 2;\r\n\t\t\t}\r\n\t\t\tunset($usrId);\r\n\t\t}\r\n\t}", "function users_user_activation($args)\n{\n $code = base64_decode(FormUtil::getPassedValue('code', (isset($args['code']) ? $args['code'] : null), 'GETPOST'));\n $code = explode('#', $code);\n\n if (!isset($code[0]) || !isset($code[1])) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n $uid = $code[0];\n $code = $code[1];\n\n // Get user Regdate\n $regdate = pnUserGetVar('user_regdate', $uid);\n\n // Checking length in case the date has been stripped from its space in the mail.\n if (strlen($code) == 18) {\n if (!strpos($code, ' ')) {\n $code = substr($code, 0, 10) . ' ' . substr($code, -8);\n }\n }\n\n if (DataUtil::hash($regdate, 'md5') == DataUtil::hash($code, 'md5')) {\n $returncode = pnModAPIFunc('Users', 'user', 'activateuser',\n array('uid' => $uid,\n 'regdate' => $regdate));\n\n if (!$returncode) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n LogUtil::registerStatus(__('Done! Account activated.'));\n return pnRedirect(pnModURL('Users', 'user', 'loginscreen'));\n } else {\n return LogUtil::registerError(__('Sorry! You entered an invalid confirmation code. Please correct your entry and try again.'));\n }\n}", "function verify($email,$code)\n {\n $sql = \"SELECT id\n FROM\n user\n WHERE\n verification = '$code'\n AND\n email='$email'\n \";\n $query = $this->db->query($sql);\n if($query->num_rows()>0)\n {\n $row = $query->row();\n $update['verification'] = 'done';\n $update['status'] = 1;\n $this->db->where('id', $row->id);\n $this->db->update('user', $update);\n return $row->id;\n }\n }", "public function authorize_result()\n\t{\t\n\t\tif(isset($_GET['code']))\n\t\t{\n\t\t\tif($this->oauth->ci->session->userdata('state') !== $_GET['state'])\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('failure', array(\n 'error' => $this->oauth->ci->lang->line('error_xsfr_victim')\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('success', array(\n\t\t\t\t\t\t'token' => $_GET['code'],\n\t\t\t\t\t\t'state' => $_GET['state']\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(isset($_GET['error']))\n\t\t{\n\t\t\treturn $this->oauth->response('failure', array(\n\t\t\t\t\t'error' => $_GET['error_description']\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}", "public function authenticate_code($classname, $code){\n $query = \"SELECT classcode FROM classes where classname = $1;\";\n $query_result = pg_prepare($this->con, \"myquery15\", $query);\n $query_result = pg_execute($this->con, \"myquery15\", array($classname));\n $row = pg_fetch_row($query_result);\n if($row[0] == $code){ //Accesscode matched\n echo(\"Access Code matched\");\n return True;\n }\n else{return False;}\n\n\n }", "public function validationSha($code){\r\n\t\t//variables\r\n\t\t$error = '';\r\n\t\t$user_browser = $_SERVER['HTTP_USER_AGENT']; //navegador\r\n\t\t$ip = $_SERVER['REMOTE_ADDR']; //ip\r\n\t\r\n\t\t$this->where('macro_sha', $code);\r\n\t\tif($salida = $this->getOne('solicitudes_clave')){\r\n\t\t\t\r\n\t\t\tif($salida['navegador'] != $user_browser){\t$error = 'navegador no concide';\t}\r\n\t\t\tif($salida['ip'] != $ip){\t\t\t\t\t$error = 'remote ip no concide';\t}\r\n\t\t\t\r\n\t\t\tif($error != ''){\r\n\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\treturn false;\r\n\t\t\t}else{\r\n\t\t\t\t$nuevo_sha = hash('sha512', $salida['email'].$user_browser.$salida['telefono'].$ip);\r\n\t\t\t\tif($nuevo_sha != $salida['macro_sha']){\r\n\t\t\t\t\t$error = 'Shas no coinciden';\r\n\t\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}else{\r\n\t\t\t\t\t//succes!!\r\n\t\t\t\t\t$_SESSION['email_val'] = $salida['email'];\r\n\t\t\t\t\t$_SESSION['corrector'] = $salida['salt'];\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t}else{\r\n\t\t\t$error = 'no hubo conexion a db';\r\n\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "public function veryfyuser($email,$code){\n\t\t$this->db->where('Status', '0');\n\t\t$this->db->where('Email', $email);\n\t\t$this->db->where('UniqueKey', $code);\n\n\t\t$query=$this->db->get('tbl_userdetails');\n\t\tif($query->num_rows()==1){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "public function validation($data)\n {\n \t$this->load->library('encrypt');\n\t\t$user = $this->db->select('email, password, status_register')->where('email', $data['email'])->get('ec_client')->result_array();\n if (count($user) > 0) {\n\t\t\t\t$password_decode = $this->encrypt->decode($user[0]['password']);\n\t\t\t\t\tif ($password_decode == $data['password']) {\n\t\t\t\t\t\tif ($user[0]['status_register'] == 0) {\n return 2;\n }\n return 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn 0; # Usuario o clave de acceso incorrectos\n\t\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn 0; # Usuario o clave de acceso incorrectos\n\t\t\t}\n }", "public function verify_code($params) {\n\n $verification_code = $params['verification_code'];\n $code_id = $params['code_id'];\n\n $options = array('body'=> array());\n $options['body']['code']= ['verify'=> $verification_code];\n\n $uri = $code_id.\"/verify\";\n $uri = \"/cpaas/auth/v1/\".$this->client->user_id.\"/codes/\".$uri;\n $url = $this->client->_root.$uri;\n $response = $this->client->_request(\"PUT\", $url, $options);\n\n // check if test response\n if ($this->client->check_if_test($response)) {\n return $response;\n }\n // check if error response\n // if ($this->client->check_if_error($response)) {\n // $response = $this->client->build_error_response($response);\n // return $response;\n // }\n\n if ($response->getStatusCode() == 204) {\n $custom_response = ['verified'=> true, 'message'=> 'Success'];\n } else {\n $custom_response = ['verified'=> false, 'message'=> 'Code invalid or expired'];\n }\n\n return $custom_response;\n }", "public function verifyTwoFACode($code) {\n $verification = Yii::app()->db->createCommand()\n ->select('code')\n ->from('x2_twofactor_auth')\n ->where('userId = :id AND requested >= :requested', array(\n ':id' => $this->id,\n ':requested' => time() - (60 * 5), // within the past 5 minutes\n ))->queryScalar();\n return $code === $verification;\n }", "function code_checkCodeUser($bdd, $CodeID, $userID)\n\t{\n\t\techo_debug('CODE code_checkCodeUser | codeID='.$CodeID.' userID='.$userID.'<br>');\n\t\ttry\n\t\t{ \n\t\t\t$response = $bdd->prepare('SELECT userID FROM code WHERE id=:ci');\n\t\t\t$response->execute(array(\n\t\t\t\t'ci' => $CodeID\n\t\t\t));\n\t\t}\t\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\tdie('Error : '.$e->getMessage());\n\t\t}\n\t\t\n\t\ttry\n\t\t{\n\t\t\t$nb_rows = $response->rowCount();\n\t\t}\n\t\tcatch(Exception $e)\n\t\t{\n\t\t\t$nb_rows = 0;\n\t\t}\n\t\t\n\t\t$codeUser=0;\n\t\t$check=FALSE;\n\t\tif($nb_rows > 0)\n\t\t{\n\t\t\twhile ($data = $response->fetch())\n\t\t\t{\n\t\t\t\t$codeUser = $data['userID']; \t\n\t\t\t}\n\t\t\tif($codeUser !=0 && $codeUser==$userID)\n\t\t\t{\n\t\t\t\techo_debug('CODE code_checkCodeUser | return TRUE<br>');\n\t\t\t\t$check= TRUE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\techo_debug('CODE code_checkCodeUser | return FALSE - This code does not belong to the user<br>');\n\t\t\t\t$check=FALSE;\t\t\t\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\techo_debug('CODE code_checkCodeUser | return FALSE Code not found<br>');\n\t\t\t$check=FALSE;\t\t\t\n\t\t}\n\t\t\n\t\treturn $check;\n\t}", "public function check_register_code($user_login)\n {\n // Wrong Token Message\n $wrong_token = array(\n 'message' => __('Your authentication code is incorrect', 'wordpress-acl')\n );\n\n // Only Check Register Code\n if (isset($_REQUEST['do_action']) and $_REQUEST['do_action'] == \"check_register_code\") {\n\n // Get User Mobile\n $user_mobile = $user_login;\n $code = sanitize_text_field($_REQUEST['code']);\n\n // Check User Code\n $code_query = self::check_user_opt_code($code, 'mobile', $user_mobile);\n if ($code_query != false and self::check_expire_time_user_otp($code_query) === true) {\n // True\n wp_send_json_success(array(\n 'code' => $code\n ), 200);\n } else {\n // False\n wp_send_json_error($wrong_token, 400);\n }\n }\n\n // Check User code in Register\n if (!isset($_REQUEST['code']) || (isset($_REQUEST['code']) and empty($_REQUEST['code']))) {\n wp_send_json_error($wrong_token, 400);\n }\n $code_query = self::check_user_opt_code($_REQUEST['code'], 'mobile', $user_login);\n if ($code_query === false) {\n wp_send_json_error($wrong_token, 400);\n }\n if (self::check_expire_time_user_otp($code_query) === false) {\n wp_send_json_error(array(\n 'message' => __('Your authentication code has expired', 'wordpress-acl')\n ), 400);\n }\n\n // Check Persian first_name and last_name\n if(empty($_REQUEST['first_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خود را وارد نمایید'\n ), 400);\n }\n if(empty($_REQUEST['last_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را وارد نمایید'\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['first_name']) ===false) {\n wp_send_json_error(array(\n 'message' => __('لطفا نام خود را به فارسی وارد کنید', 'wordpress-acl')\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['last_name']) ===false) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را به فارسی تایپ کنید'\n ), 400);\n }\n }", "function password_change_login($email, $password, $verification_code) {\n\t\tglobal $pdo;\n\n\t\t//empty or array check\n\t\tif(empty($email) || is_array($email) || empty($password) || is_array($password) || empty($verification_code) || is_array($verification_code)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t//check if user exists\n\t\t$sql = \"SELECT id FROM user WHERE verification_code = :verification_code AND REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 1 AND TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, code_generation_time)) <= 600\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindParam(\":verification_code\", $verification_code, PDO::PARAM_STR);\n\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t$sth->execute();\n\n\t\tif($sth->rowCount() == 0) {\n\t\t\treturn 2;\n\t\t}\n\n\t\t//check if password meet our requirements\n\t\tif(!password_security_check($password)) {\n\t\t\treturn 3;\n\t\t}\n\n\t\t//hash password\n\t\t$password_hash = password_hash($password, PASSWORD_BCRYPT);\n\t\t//get id\n\t\t$id = $sth->fetch()[\"id\"];\n\n\t\t//change password\n\t\t$sql = \"UPDATE user SET verification_code = NULL, code_generation_time = NULL, password = :password_hash WHERE id = :id\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindParam(\":password_hash\", $password_hash, PDO::PARAM_STR);\n\t\t$sth->bindParam(\":id\", $id, PDO::PARAM_INT);\n\t\t$sth->execute();\n\t\treturn 0;\n\t}", "public function CheckingUserLaunchSubmit($sid,$uid,$gameid,$timecode_now)\n {\n $errcode = -1;\n $key = GameUserLaunchModel::HashSingerUserlaunchGameLaunchKey($sid);\n $member = (string)($uid.':'.$gameid);\n do\n {\n $value = $this->getRedisMaster()->hGet($key,$member);\n if (empty($value))\n {\n // not flag here.\n $errcode = 0;\n break;\n }\n $l_obj = json_decode($value);\n if (NULL == $l_obj)\n {\n // obj is NULL.\n $errcode = 0;\n break;\n }\n $dt = $timecode_now - $l_obj->timecode;\n if ( GameUserLaunchModel::$SINGER_USERLAUNCH_SELECT_TIMEOUT <= $dt )\n {\n // not timeout select invalid.\n $errcode = 0;\n break;\n }\n $errcode = 1;\n }while(FALSE);\n return $errcode;\n }", "function verify_authcode_phone($authcode,$phone,$verify=true)\n\t{\n\t\t$user_id=$code_type=0;\n if($this->_redis)\n {\n $data=$this->cache->get($authcode.'_'.sha1($phone));\n if(!empty($data))\n {\n $data=json_decode($data);\n $user_id=$data->user_id;\n $code_type=$data->code_type;\n\t\t\t\tif($verify) $this->cache->delete($authcode.'_'.sha1($phone));\n $errorcode=true;\n }\n else\n {\n $errorcode=false;\n log_message('error_tizi','17051:phone verify code failed',array('phone'=>$phone));\n }\n }\n else\n\t\t{\n\t\t\t$this->db->select(\"id,user_id,phone,code_type,generate_time\");\n\t\t\t$this->db->from($this->_table);\n\t\t\t$this->db->where(\"authcode\",$authcode);\n\t\t\t//加密手机号码\t\n\t\t\t$e_phone=sha1($phone);\t\n\t\t\n\t\t\t$this->db->where(\"phone\",$e_phone);\n\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_PHONE);\n\t\t\t$query=$this->db->get();\t\n\t\t\t$total=$query->num_rows();\n\t\t\tif($total) $gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_PHONE))>date(\"Y-m-d H:i:s\"))\n\t\t\t{\n\t\t\t\t$id=$query->row()->id;\n\t\t\t\t$user_id=$query->row()->user_id;\n\t\t\t\t//$phone=$query->row()->phone;//电话号码已加密\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\tif($verify)\n\t\t\t\t{\n\t\t\t\t\t$this->db->where('id',$id);\n\t\t\t\t\t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n\t\t\t\t\tif($this->db->affected_rows()==1) $errorcode=true;\n\t else $errorcode=false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$errorcode=true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t}\n\t\t}\n\t\treturn array('user_id'=>$user_id,'phone'=>$phone,'code_type'=>$code_type,'errorcode'=>$errorcode);\n\t}", "function generate_authcode_phone($phone,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER)\n\t{\n\t\t$authcode=\"\";\n\t\t$errorcode=$this->check_authcode_phone($phone,$code_type);\n if(!$errorcode['errorcode'])\n {\n\t\t\t$authcode=random_string('nozero',6);\n $data=$this->bind_verify($user_id,\"\",$phone,2,$code_type,$authcode,$user_type);\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode.'_'.sha1($phone),json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_PHONE);\n\t\t\t\t$this->save_check('phone',sha1($phone),$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_PHONE);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n\t\t\t\t$insert_id=$this->db->insert_id();\n\t\t\t\tif($insert_id>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170019:Gen phone auth code',array('phone'=>$phone));\n\t\t\tif(!$errorcode) log_message('error_tizi','17019:Gen phone auth code failed',array('phone'=>$phone));\n\t\t}\n else\n {\n $errorcode=false;\n }\n return array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "public function handleActivationCode($user, $code) {\n $uac = UserActivationCode::where('user_id', $user->id)\n ->where('code', $code)\n ->orderBy('expiration', 'DESC')\n ->first();\n if ($uac) {\n if ($uac->expiration < time()) {\n return \"Your code is expired. Please try to get verification code by clicking send email link.\";\n }\n $user->status = config('sc.user_status.active');\n $user->save();\n $uac->forceDelete();\n return true;\n }\n\n return \"Invalid Activation Code\";\n }", "public function verify(){\n\t\t// getting the username and code from url\n\t\t$code=$_GET['c'];\n\t\t$user=$_GET['u'];\n\t\t// load the regmod model\n\t\t$this->load->model('regmod');\n\t\t// calling the function Vemail that check the valodation code with the username\n\t\t$flag=$this->regmod->Vemail($user,$code);\n\t\t// checking the Vemail the respond\n\t\tif($flag)\n\t\t\t{$data['res']= \"You have successfully verified your email. You may login to Hungry.lk with your username and password\";}\n\t\telse\n\t\t\t{$data['res']= \"Opps An error occurred in our system, try again later\";}\n\t\t$this->load->view(\"register_status_view\",$data);\n\t}", "public function checkActivationUser($email, $code)\n {\n $sql = \"SELECT id FROM `user` WHERE `email` = '$email' and `activationCode`='$code'\";\n $query = $this->db->prepare($sql);\n $query->execute();\n $result = $query->fetchAll();\n $count = sizeof($result);\n if ($count > 0)\n return true;\n else return false;\n }", "abstract public function checkCode(string $uuid, string $code, int $successFlag = self::NOTHING_ON_SUCCESS);", "function check_reffer_code() {\n\t\t$reffer_code = $_REQUEST['reffer_code'];\n\t\tif (!empty($reffer_code)) {\n\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\t\tif (!empty($reffer_records)) {\n\t\t\t\t$user_id = $reffer_records[0]['user_id'];\n\t\t\t\t$user_reffer_code = $reffer_records[0]['user_refferal_code'];\n\n\t\t\t\t//if($user_reffer_code==$reffer_code){\n\t\t\t\tif (strcmp($user_reffer_code, $reffer_code) == 0) {\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Reffer code avalible\", 'reffer_code' => $reffer_code, 'user_id' => $user_id);\n\t\t\t\t} else {\n\t\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t}\n\t\t} else {\n\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Missing parameter\", 'reffer_code' => $reffer_code);\n\t\t}\n\t\techo $this -> json($post);\n\t}", "private function checkData() {\n if(!isset(\n $_POST['code'],\n $_POST['field']\n )) {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'wrong request'\n ));\n exit;\n }\n\n if($_POST['field']==='email') {\n $field = 'email';\n }\n elseif($_POST['field']==='phone') {\n $field = 'cellphone';\n }\n else {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'wrong field'\n ));\n exit;\n }\n\n $code=trim($_POST['code']);\n\n $user_id=$this->uSes->get_val('user_id');\n if (isset(\n $_SESSION['uAuth']['profile_update_bg']['change'.$field]['code'],\n $_SESSION['uAuth']['profile_update_bg']['change'.$field]['timestamp'],\n $_SESSION['uAuth']['profile_update_bg']['change'.$field]['password'],\n $_SESSION['uAuth']['profile_update_bg']['change'.$field][$field]\n )) {\n if($field==='cellphone'&&!(int)$this->uFunc->getConf('use MAD SMS to send SMS','content',false)) {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'sms send is not supported'\n ));\n exit;\n }\n\n if($_SESSION['uAuth']['profile_update_bg']['change'.$field]['timestamp']<(time()-300)) {//5min\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'code is expired'\n ));\n exit;\n }\n if($_SESSION['uAuth']['profile_update_bg']['change'.$field]['code']!==$code) {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'wrong code'\n ));\n exit;\n }\n\n $password=$_SESSION['uAuth']['profile_update_bg']['change'.$field]['password'];\n\n $value=$_SESSION['uAuth']['profile_update_bg']['change'.$field][$field];\n\n $this->updateEmailOrPhone($user_id,$field,$value,$password);\n\n unset($_SESSION['uAuth']['profile_update_bg']['change'.$field]);\n\n return $value;\n }\n\n print json_encode([\n 'status'=>'error',\n 'msg'=>'code is expired'\n ]);\n exit;\n }", "public function CheckUserPermission($sid,$uid,$gameid,$timecode_now)\n {\n $errcode = -1;\n $key = GameUserLaunchModel::HashSingerUserlaunchGameSelectKey($sid);\n do\n {\n $value = $this->getRedisMaster()->hGet($key,$sid);\n if (empty($value))\n {\n // not flag here.\n $errcode = 1;\n break;\n }\n $l_obj = json_decode($value);\n if (NULL == $l_obj)\n {\n // obj is NULL.\n $errcode = 2;\n break;\n }\n if ($l_obj->launchid != $uid)\n {\n // uid not match.\n $errcode = 3;\n break;\n }\n if ($l_obj->gameid != $gameid)\n {\n // gameid not match.\n $errcode = 4;\n break;\n }\n $dt = $timecode_now - $l_obj->timecode_select;\n if ($dt >= GameUserLaunchModel::$SINGER_USERLAUNCH_SELECT_TIMEOUT)\n {\n // timeout permission invalid.\n $errcode = 5;\n break;\n }\n $errcode = 0;\n }while(FALSE);\n return $errcode;\n }", "function activate_user()\n{\n if($_SERVER['REQUEST_METHOD'] == \"GET\"){\n if(isset($_GET['email'])){\n $email=clean($_GET['email']);\n $validation_code=clean($_GET['code']);\n $sql=\"SELECT id FROM users WHERE email='\".escape($_GET['email']).\"' AND validation_code='\".escape($_GET['code']).\"'\";\n $result=query($sql);\n if(row_count($result)==1){\n $sql2=\"UPDATE users SET active=1, validation_code=0 WHERE email='\" .escape($email).\"' AND validation_code='\".escape($validation_code).\"'\";\n $result2=query($sql2);\n set_message(\"<p class='bg-success'>Your account has been activated please login</p>\");\n redirect(\"login.php\");\n }else{\n set_message(\"<p class='bg-danger'>Your account could not be activated</p>\");\n redirect(\"login.php\");\n }\n\n }\n\n\n }\n}", "public function checkgiftcardcode() {\n global $loguser;\n $curr_email = $loguser['email'];\n $code = $_GET['gfcode_value'];\n $getgfcardval = TableRegistry::get('Giftcards')->find()->where(['giftcard_key' => $code])->first();\n if (!empty($getgfcardval)) {\n $recEmail = $getgfcardval->reciptent_email;\n $gfcardId = $getgfcardval->id;\n $gfcardAmt = $getgfcardval->avail_amount;\n if ($gfcardAmt <= 0) {\n echo \"2\";\n die;\n } else if ($recEmail == $curr_email) {\n echo '1' . '*|*' . $gfcardId;\n die;\n } else {\n echo '0';\n die;\n }\n } else {\n echo '0';\n die;\n }\n }", "function check_verify($code, $id = ''){\n $verify = new \\Think\\Verify();\n return $verify->check($code, $id);\n}", "public function passwordResetCode();", "function verify_code($rec_num, $checkstr)\n\t{\n\t\tif ($user_func = e107::getOverride()->check($this,'verify_code'))\n\t\t{\n\t \t\treturn call_user_func($user_func,$rec_num,$checkstr);\n\t\t}\n\t\t\n\t\t$sql = e107::getDb();\n\t\t$tp = e107::getParser();\n\n\t\tif ($sql->db_Select(\"tmp\", \"tmp_info\", \"tmp_ip = '\".$tp -> toDB($rec_num).\"'\")) {\n\t\t\t$row = $sql->db_Fetch();\n\t\t\t$sql->db_Delete(\"tmp\", \"tmp_ip = '\".$tp -> toDB($rec_num).\"'\");\n\t\t\t//list($code, $path) = explode(\",\", $row['tmp_info']);\n\t\t\t$code = intval($row['tmp_info']);\n\t\t\treturn ($checkstr == $code);\n\t\t}\n\t\treturn FALSE;\n\t}", "public function checkAuth();", "public function checkAuth();", "function aCAuth($r)\t{\n\t\tif ($this->authCode && !strcmp($this->authCode,$this->authCode($r)))\t{\n\t\t\treturn true;\n\t\t}\n\t}", "public function errorcode();", "function login() {\n $params = $this->objService->get_request_params();\n $isSuccess = $this->objQuery->count('user','email= ? AND password = ?', array($params->email,$params->password));\n echo $isSuccess;\n }", "public function userActivation($email, $code)\n {\n if ($this->checkActivationUser($email, $code)) {\n $sql = \"UPDATE user SET status=1, activeDate = NOW() WHERE email='$email'\";\n $query = $this->db->prepare($sql);\n $query->execute();\n return 1;\n } else {\n return 0;\n }\n }", "protected function verifyCode($args) {\n\n if ($args['ent_coupon'] == '' || $args['ent_lat'] == '' || $args['ent_long'] == '')\n return $this->_getStatusMessage(1, $args);\n\n $checkCouponQry = \"select cp.id from coupons cp where cp.coupon_code = '\" . $args['ent_coupon'] . \"' and cp.coupon_type = 1 and cp.user_type = 1 and cp.status = 0 and cp.expiry_date > '\" . date('Y-m-d', time()) . \"'\"; // and cp.city_id in (select ca.City_Id from city_available ca where (3956 * acos( cos( radians('\" . $args['ent_lat'] . \"') ) * cos( radians(ca.City_Lat) ) * cos( radians(ca.City_Long) - radians('\" . $args['ent_long'] . \"') ) + sin( radians('\" . $args['ent_lat'] . \"') ) * sin( radians(ca.City_Lat) ) ) ) <= \" . $this->promoCodeRadius . \") limit 0,1\";\n if (mysql_num_rows(mysql_query($checkCouponQry, $this->db->conn)) > 0) {\n return $this->_getStatusMessage(101, $checkCouponQry);\n } else {\n return $this->_getStatusMessage(100, $checkCouponQry);\n }\n }", "public function check_taken($email){\n\t\t\t$user = new User();\n\t\t\t$db_user = $user->get_user($email);\n\n\t\t\techo ($db_user === []) ? self::APPROVED : self::DENIED;\n\t\t\n\t\t}", "public function codeVerificationAction($header_data,$data){\n if( !isset($data['otp_no'])) {\n Library::logging('alert',\"API : codeVerification : \".ERROR_INPUT.\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_INPUT, null);\n } else {\n try {\n $user_id = $header_data['id'];\n $otp_no = $data['otp_no'];\n $user = Users::findById($user_id);\n \n $group = array();\n $db = Library::getMongo();\n $groups = $db->execute('return db.groups.find( { $and: [ { is_active: 1 }, { group_name: \"Friends\" } ] } ).toArray()');\n \n if($groups['ok'] == 0) {\n Library::logging('error',\"API : codeVerification (get groups) mongodb error: \".$groups['errmsg'].\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_REQUEST, null);\n }\n array_push($group,(string)$groups['retval'][0][_id]);\n if($user->otp == $otp_no) {\n if($user->is_active == 1) {\n // user already exist\n } else {\n $user->is_active = 1;\n $user->username = \"user\";\n $user->context_indicator = \"Available\";\n $user->my_mind_groups = $group;\n $user->about_me_groups = $group;\n $user->my_pictures_groups = $group;\n $user->unique_id = strtolower( uniqid() );\n $user->is_edit = 0;\n $user->is_searchable = 1;\n $user->is_mobile_searchable = 1;\n $user->save();\n }\n Library::output(true, '1', OTP_VERIFIED, null);\n } else {\n Library::logging('alert',OTP_WRONG.\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', OTP_WRONG, null);\n }\n } catch (Exception $e) {\n Library::logging('error',\"API : codeVerification : \".$e.\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_REQUEST, null);\n }\n }\n }", "public function verify_otp_get($email=null,$otp=null){\n\t\tif(!empty($email) && !empty($otp)){\n\t\t\t$q = $this->db->where('email',$email)->where('verification_code',$otp)->get('users')->result();\n\t\t\tif(count($q)>0){\n\t\t\t\t$this->response(['Correct'], REST_Controller::HTTP_OK);\n\t\t\t}else{\n\t\t\t\t$this->response(['Invaild Email or OTP.'], '500');\n\t\t\t}\n\t\t}else{\n\t\t\t$this->response(['Too few arguments'], '500');\n\t\t}\n\t}", "public function verifyToken($userType,$token,$id,$action){\n $resp = false;\n /*if action is type reset*/\n if($action == 'reset'){\n /*validate user type*/\n if($userType == 'user')\n $sql = \"SELECT token FROM Users WHERE email = :id AND (status = '1' AND validate = '1')\"; //create sentence\n else if($userType == 'teacher')\n $sql = \"SELECT token FROM Teachers WHERE email = :id AND status = '1' AND validate = '1'\"; //create sentence\n }\n /*If action is type validate*/\n else if($action == 'activate'){\n /*validate user type*/\n if($userType == 'user')\n $sql = \"SELECT token FROM Users WHERE email = :id AND status = '1' AND validate = '0'\"; //create sentence\n else if($userType == 'teacher')\n $sql = \"SELECT token FROM Teachers WHERE email = :id AND status = '1' AND validate = '0'\"; //create sentence\n }\n $stmt = $this->connect()->prepare($sql); //prepare sentence\n $stmt->bindParam(':id',$id); //add params\n $stmt->execute(); //execute sentence\n /*If email exists*/\n if($stmt->rowCount() > 0){\n $tokendb = $stmt->fetchColumn(); //Get token from consult\n /*Validate token*/\n if($tokendb == '_token$'.$token)\n $resp = true;\n }\n $this->closeConnection(); //close conection\n return json_encode($resp); // convert to json and return this\n }", "public function check_authorization_response(){\n if(!isset($_SESSION))\n session_start();\n\n // no LINE_CRSF is set in session\n if(!isset($_SESSION['LINE_CRSF']))\n throw new Exception('Fail to check CRSF token');\n\n // CRSF token not match\n $state = isset($_GET['state']) ? $_GET['state'] : null;\n // equalty check can be rewrite with hash_equals()\n if($_SESSION['LINE_CRSF'] !== $state)\n throw new Exception('CRSF token not match');\n\n unset($_SESSION['LINE_CRSF']);\n\n // user denies the premissions requested\n // NOTICE:\n // LINE server redirect user who does not have\n // developer role with following error (in GET data)\n // error=access_denied\n // error_description=The+authorization+server+denied+the+request.+This+channel+is+now+developing+status.+User+need+to+have+developer+role\n // To solve this, go to your LINE Login channel then\n // click the Developing label on the top right to proceed\n // publish your channel\n if(isset($_GET['error'])){\n throw new Exception(json_encode(array(\n 'error' => $_GET['error'],\n 'error_description' => $_GET['error_description'],\n )));\n }\n\n $this->authorization_code = $_GET['code'];\n return $this->authorization_code;\n }", "function check_hash($userid,$hash,$code,$pretest)\n {\n $this->stmt = $this->db->count('activation');\n // set where values\n $this->stmt->where('userid','i',$userid);\n\t\t$this->stmt->where('hash','i',$hash);\n\t\tif((int)$pretest > 0){\n\t\t\t$this->stmt->where('code','i',$code);\n\t\t}\n\t\treturn parent::get();\n }", "public function verifyAc(array $args);", "function stub() {\r\n\t$a = array(\r\n\t\t'status' => 'system-error'\r\n\t);\r\n\r\n\t// raw inputs\r\n\t$taint_si = isset($_POST['si']) ? $_POST['si'] : 0;\r\n\t$taint_a = isset($_POST['a']) ? $_POST['a'] : 0;\r\n\t$taint_b = isset($_POST['b']) ? $_POST['b'] : 0;\r\n\r\n\t// validate inputs\r\n\t$si = validateToken($taint_si);\r\n\t$a = validateUname($taint_a);\r\n\t$b = validateUname($taint_b);\r\nLog::write(LOG_WARNING, \"$a,$b,$si\";\r\n\r\n\t// validate parameter set\r\n\tif (!$si || !$a || !$b){\r\n\t\tLog::write(LOG_WARNING, 'attempt with invalid parameter set');\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// get database connection\r\n\t$conn = getConnection();\r\n\tif (!$conn) {\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// get logged-in user\r\n\t$result = getUserByToken($conn, $si);\r\n\tif (!$result) {\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// get data fields\r\n\t$row = pg_fetch_array($result, 0, PGSQL_ASSOC);\r\n\t$username = $row['username'];\r\n\t$access = $row['access'];\r\n\t$auth = $row['auth'];\r\n\t$email = $row['email'];\r\n\r\n\t// verify user authentication state\r\n\tif (!isUserVerified($auth)) {\r\n\t\tLog::write(LOG_NOTICE, \"attempt by non-verified user\");\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// compose output message\r\n\t$message = \"a is $a and b is $b and email is \" . obscureEmail($email);\r\n\r\n\t// success\r\n\t$a['status'] = 'ok';\r\n\t$a['message'] = $message;\r\n\treturn $a;\r\n}", "function check_verify($code, $id = 1){\n $verify = new \\Think\\Verify();\n return $verify->check($code, $id);\n}", "public function recovery_test( $code=NULL, $language=\"en\"){\n\t\t$user=NULL;\n\t\t$redirect='/'.$language.'/home/recovery/'.$code;\n\t\t$now=now();\n\t\t\n\t\t\t$user = $this->get_by(array(\n\t\t\t\t'code' => $code,\n\t\t\t\t'new_pass_active' => '1',\n\t\t\t\t'expiration >' => $now,\n\t\t\t), TRUE);\n\t\t\t\n\t\t\tif($user){\n\t\t\t\treturn ($user);\n\t\t\t}\n\t\t\treturn false;\n\t\t\t\n\t\t}", "public static function verifyAuth($auth) {\n\t\t$GLOBALS[\"logger\"]->debug(\"in verifyAuth, code \" . $auth);\n\t\t$resultSet = ORM::for_table(self::AUTHCODE_TABLE)->\n\t\t\tselect('code_hash')->\n\t\t\tfind_many();\n\t\t$GLOBALS[\"logger\"]->debug(\"completed query\");\n\t\tforeach ($resultSet as $result) {\n\t\t\t$hash = $result->code_hash;\n\t\t\t$GLOBALS[\"logger\"]->debug(\"Checking hash \" . $hash);\n\t\t\tif (password_verify($auth, $hash)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t$GLOBALS[\"logger\"]->debug(\"No hash matched\");\n\t\treturn false;\n\t\t//$selstmt = \"SELECT CODE_HASH FROM AUTHCODES\";\n\t}", "public function verifikasi_password($address, $code) {\n\n $this->db->select('regTime');\n\n $this->db->from('tb_siswa');\n\n $this->db->where('email', $address);\n\n $this->db->limit(1);\n\n $result = $this->db->get();\n\n $row = $result->row();\n\n\n\n if ($result->num_rows() === 1) {\n\n if (md5((string) $row->regTime) === $code) {\n\n $this->session->set_userdata('reset_email', $address);\n\n $this->session->set_userdata('reset_password', '1');\n\n redirect(base_url('login'));\n\n } else {\n\n redirect(base_url('login'));\n }\n\n } else {\n\n redirect(base_url('login'));\n\n }\n\n }", "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 validate_code()\n{\n if(isset($_COOKIE['temp_access_code'])){\n\n if(!isset($_GET['email']) && !isset($_GET['code'])){\n redirect(\"index.php\");\n\n }elseif (empty($_GET['email']) || empty($_GET['code'])){\n redirect(\"index.php\");\n\n }else{\n if(isset($_POST['code'])){\n $email=clean($_GET['email']);\n $validation_code=clean($_POST['code']);\n $sql=\"SELECT id FROM users WHERE validation_code='\".escape($validation_code).\"' AND email='\".escape($email).\"'\";\n $result=query($sql);\n if(row_count($result)==1){\n setcookie('temp_access_code',$validation_code,time()+900);\n redirect(\"reset.php?email=$email&code=$validation_code\");\n }else{\n echo validation_errors(\"Sorry wrong validation code\");\n }\n\n }\n\n }\n\n\n }else{\n\n set_message(\"<p class='bg-danger text-center'>Sorry your validation cookie was expired</p>\");\n redirect(\"recover.php\");\n }\n}", "function send_auth_code_at_login($user)\n{\n\t$user_info = get_userdata($user);\n\t\n\t$user_login = $user_info->data->user_login;\n\n\t$user_email = $user_info->data->user_email;\t\n\n\t$user_name = $user_info->data->first_name;\t\n\n\t$user_phone = get_user_meta( $user, 'user_phone', true );\n\t//$user_phone = urldecode($u_phone);\n\n\t$user_fname = get_user_meta( $user, 'first_name', true );\n\n\t$code = get_user_meta( $user, 'has_to_be_activated', true );\n\n\t$subject = 'Your New Authentication Code';\n\n\n\t$message1 = \"<html><body style='background:#f3f3f3;padding:20px 0;'><table border='0' cellpadding='0' cellspacing='0' style='margin:auto; max-width: 520px;width:100%;font-family: Arial;padding:20px;background:#fff;'><tbody>\";\n\t$message1 .=\"<tr><td style='font-size: 16px;'>Hello \".ucfirst($user_fname).\",</td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Welcome to Raise it Fast!</td></tr><tr height=30></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Please use this code to authenticate your account with Raise it Fast. <span style='background: #aaaaaa none repeat scroll 0 0;height: 45px;text-align: center;width: 101px;'>\".$code.\"</span></td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>'If you have any questions or concerns don't hesitate to use our website chat function, call us, or email us by going to our help page at \".site_url('/contact-us/').\" Or, you can simply reply to this email. '</td></tr><tr height=30></tr>\"; \n\t$message1 .=\"<tr><td style='font-size: 16px; margin-top: 20px;'>Thanks for becoming a part of the Raise It Fast community! </td></tr></tbody></table><table border='0' cellpadding='0' cellspacing='0' style='margin:20px auto 0; max-width: 520px;width:100%;'>\"; \n\n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'>1401 Lavaca St #503, Austin, TX 78701</td></tr><tr height=20></tr>\"; \n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'><a href=\".site_url().\" style='text-decoration:none; color: #999999;'>The Raise it Fast Team</a></td></tr>\"; \n\t$message1 .=\"</table></body></html>\";\n\n\twp_mail($user_email, $subject, $message1);\n\n//=========Send Auth Code Via Text message ==================//\n\n\t$account_sid = get_option('twilio_account_sid'); \n\t$auth_token = get_option('twilio_auth_token'); \n //require('lib/twilio-php-latest/Services/Twilio.php');\n\t$client = new Services_Twilio($account_sid, $auth_token); \n //$from = '+12182265630'; \n\t$from = get_option('twilio_phone_no');\n\n\ttry\n\t{\n\t\t$client->account->messages->sendMessage( $from, $user_phone, \"Hello $user_fname, Your Authentication code is $code\");\n\t}\n\tcatch (Exception $e)\n\t{ \n\n\t\techo \"11-\";\n\t}\n}", "public function errorCode();", "public function errorCode();", "public function check_promocode() {\n\t\t\t\t $usertypes = $this->users->checkUserTypeLaabus($this->session->userdata('user_id'));\n\t\t\t\t $agent_id = $usertypes[0]->agent_id;\n\t\t\t\t// print_r($usertypes);\n\t\t\t\tif(empty($agent_id))\n\t\t\t\t{\n\t\t\t\t\t$role_id = 4;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$role_id =44;\n\t\t\t\t}\n\t\t$data = $this->users->check_promocode($_REQUEST['promo_code'],$_REQUEST['amount'],$role_id);\n\t\techo $data;\n\t\texit;\n\t}", "function auth_callback(int $code, ...$args)\n{\n $status = SQLite3::DENY;\n $table = DEFAULT_TABLE;\n if ($code === SQLite3::SELECT) {\n $status = SQLite3::OK;\n } else {\n if (!empty($args[0])) {\n $table = $args[0];\n } elseif (!empty($_SESSION['table'])) {\n $table = $_SESSION['table'];\n }\n $user = $_SESSION['user'] ?? DEFAULT_USER;\n // check to see if user is listed\n if (!empty(ACL[$user])) {\n // check to see if user is assigned to this table\n if (!empty(ACL[$user][$table])) {\n // check to see if code is allowed for this user and table\n if (in_array($code, ACL[$user][$table])) {\n $status = SQLite3::OK;\n }\n }\n }\n }\n $message = sprintf(PATTERN, $table, (string) $code, implode(':', $args), implode(':', $_SESSION));\n error_log($message);\n $_SESSION['table'] = $table;\n return $status;\n}", "public function activateAccount($code, $email)\n {\n\n // define all the global variables\n global $database, $message, $functions;\n\n // escape the given strings\n $code = $this->secureInput($code);\n $email = $this->secureInput($email);\n\n // start the checks\n if (empty($code) || empty($email)) {\n $message->setError(\"Code/Email fields most not be empty\", Message::Error);\n return false;\n }\n\n // check if email exists\n if (!$functions->emailExist($email)) {\n $message->setError(\"The provided email is not in our database.\", Message::Error);\n return false;\n }\n\n // check if the given code matches the required characters\n if (strlen($code) < 20 || strlen($code) > 20) {\n $message->setError(\"The given code has to be exactly 20 characters long\", Message::Error);\n return false;\n }\n\n // check if account already has been activated\n if ($functions->isUserActivated($email, true)) {\n $message->setError(\"The account is already activated\", Message::Error);\n return false;\n }\n\n $sql = \"SELECT * FROM \" . TBL_USERS . \" WHERE \" . TBL_USERS_EMAIL . \" = '\" . $email . \"' AND \" . TBL_USERS_ACTIVATION_CODE . \" = '\" . $code . \"'\";\n\n // get the sql results\n $result = $database->getQueryResults($sql);\n if ($database->anyError()) {\n return false;\n }\n\n // check if wrong code has been used\n if ($database->getQueryNumRows($result, true) < 1) {\n $message->setError(\"Wrong activation code has been used.\", Message::Error);\n return false;\n }\n\n //update the user account with the needed information\n $sql = \"UPDATE \" . TBL_USERS . \" SET \" . TBL_USERS_ACTIVATED . \" ='1',\" . TBL_USERS_ACTIVATION_CODE . \"='' WHERE \" . TBL_USERS_EMAIL . \" = '\" . $email . \"' AND \" . TBL_USERS_ACTIVATION_CODE . \" = '\" . $code . \"'\";\n\n // get the sql results\n $database->getQueryResults($sql);\n if ($database->anyError()) {\n return false;\n }\n\n $message->setSuccess(\"Your account has been activated successfully !\");\n return true;\n }", "public function userCheck($param) { \n if (!$this->aaa->has_right('openruth', 500))\n $res->agencyError->_value = 'authentication_error';\n else {\n $targets = $this->config->get_value('ruth', 'ztargets');\n $agencyId = self::strip_agency($param->agencyId->_value);\n if ($tgt = $targets[$agencyId]) {\n $z = new z3950();\n $z->set_target($tgt['host']);\n $z->set_database($tgt['database'].'-borrowercheck');\n $z->set_authentication($tgt['authentication']);\n if ($tgt['proxy']) {\n $z->set_proxy($tgt['proxy']);\n }\n $z->set_syntax('xml');\n $z->set_element('test');\n $rpn = '@attrset 1.2.840.10003.3.1000.105.3 @and @attr 1=1 %s @and @attr 1=4 %s @attr 1=5 %s';\n $z->set_rpn(sprintf($rpn, $agencyId, $param->userId->_value, $param->userPinCode->_value));\n $this->watch->start('zsearch');\n $hits = $z->z3950_search($tgt['timeout']);\n $this->watch->stop('zsearch');\n//var_dump($hits);\n//var_dump($z->get_errno());\n if ($err = $z->get_errno()) {\n self::log_z_error(__FUNCTION__, __LINE__, $agencyId, $err, $z->get_error_string());\n $res->userError->_value = 'cannot reach local system - (' . $err . ')';\n } elseif (empty($hits))\n $res->userError->_value = 'unknown userId';\n else {\n $this->watch->start('zrecord');\n $rec = $z->z3950_record();\n $this->watch->stop('zrecord');\n //print_r($rec);\n $dom = new DomDocument();\n $dom->preserveWhiteSpace = false;\n if ($dom->loadXML($rec)) {\n $chk = &$dom->getElementsByTagName('BorrowerCheck')->item(0);\n $trans = array(\n array('from' => 'BorrowerFound', 'to' => 'userFound', 'bool' => 'y'),\n array('from' => 'PinOk', 'to' => 'userPinCodeOk', 'bool' => 'y'),\n array('from' => 'Blocked', 'to' => 'userBlocked', 'bool' => 'y'),\n array('from' => 'Lost', 'to' => 'userCardLost', 'bool' => 'y'),\n array('from' => 'HasLeft', 'to' => 'userHasLeft', 'bool' => 'y'),\n array('from' => 'Valid', 'to' => 'userValid', 'bool' => 'y'),\n array('from' => 'IsInMunicipal', 'to' => 'userIsInMunicipal', 'bool' => 'y'),\n array('from' => 'ReservationAllowed', 'to' => 'userOrderAllowed', 'bool' => 'y'),\n array('from' => 'BookingAllowed', 'to' => 'userBookingAllowed', 'bool' => 'y'),\n array('from' => 'EmailAddress', 'to' => 'userEmail'),\n array('from' => 'BorrowerCat', 'to' => 'userCategoryCode'),\n array('from' => 'BorrowerCatName', 'to' => 'userCategoryName'),\n array('from' => 'StandardCounter', 'to' => 'agencyCounter'),\n array('from' => 'BirthYear', 'to' => 'userBirthYear'),\n array('from' => 'Sex', 'to' => 'userSex', 'enum' => array('b' => 'male', 'g' => 'female', 'u' => unknown)),\n array('from' => 'userAge', 'to' => 'Age'));\n self::move_tags($chk, $res->userCheck->_value, $trans);\n } else\n $res->userError->_value = 'cannot decode answer';\n }\n } else\n $res->userError->_value = 'unknown agencyId';\n }\n\n $ret->userCheckResponse->_value = $res;\n //var_dump($param); var_dump($res); die();\n return $ret;\n }", "public function check_email($email){\n $query = $this->db->select('01_email')\n ->where('01_email', $email)\n ->get('register_01');\n if($query->num_rows()>0){\n return 0;\n }else{\n $query = $this->db->where('is_sms', 1)\n ->where('number', $email)\n ->get('verify_otp_12');\n if($query->num_rows()>0){\n return 'sent';\n }else{\n $query = $this->db->where('number', $email)\n ->delete('verify_otp_12');\n $otp = rand(10000, 1000000);\n $data = array(\n 'number' => $email,\n 'otp' => $otp,\n );\n $query = $this->db->insert('verify_otp_12', $data);\n return true;\n }\n }\n }", "protected function checkSession($args) {\n\n if ($args['ent_user_type'] == '' || $args['ent_date_time'] == '')\n return $this->_getStatusMessage(1, 15);\n\n $this->curr_date_time = urldecode($args['ent_date_time']);\n\n $returned = $this->_validate_token($args['ent_sess_token'], $args['ent_dev_id'], $args['ent_user_type']);\n\n if (is_array($returned))\n return $returned;\n else\n return $this->_getStatusMessage(73, 15);\n }", "private function check()\n {\n if(!empty($this->_type_request))\n {\n // Now see which one to use (username or email)\n switch($this->_type_request)\n {\n case 'username':\n if(!empty($this->_username)){\n // Now check using the username but get the user salt from database first\n $query = $this->pdo->prepare(\"SELECT unique_string_id FROM users WHERE user_name=:username\");\n $query->execute(array(\n ':username' => $this->_username\n ));\n\n if($query->rowCount() == 1)\n {\n $fetch = $query->fetch(PDO::FETCH_ASSOC);\n\n // Now check to see if this person has made a request already\n $check = $this->pdo->prepare(\"SELECT id FROM forgotpassword WHERE user_salt_id=:salt_id\");\n $check->execute(array(\n ':salt_id' => $fetch['unique_string_id']\n ));\n\n if($check->rowCount() == 0)\n {\n $this->_response['code'] = 1;\n return $this->_response;\n }else{\n $this->_response['code'] = 0;\n $this->_response['string'] = \"You've already asked for your password to be reset!\";\n\n return $this->_response;\n }\n }else\n {\n $this->_response['code'] = 0;\n $this->_response['string'] = \"There is no account with this username!\";\n\n return $this->_response;\n }\n }\n break;\n case 'email':\n if(!empty($this->_email)){\n // Now check using the username but get the user salt from database first\n $query = $this->pdo->prepare(\"SELECT unique_string_id FROM users WHERE email=:email\");\n $query->execute(array(\n ':email' => $this->_email\n ));\n\n if($query->rowCount() == 1)\n {\n $fetch = $query->fetch(PDO::FETCH_ASSOC);\n\n // Now check to see if this person has made a request already\n $check = $this->pdo->prepare(\"SELECT id FROM forgotpassword WHERE user_salt_id=:salt_id\");\n $check->execute(array(\n ':salt_id' => $fetch['unique_string_id']\n ));\n\n if($check->rowCount() == 0)\n {\n $this->_response['code'] = 1;\n return $this->_response;\n }else{\n $this->_response['code'] = 0;\n $this->_response['string'] = \"You've already asked for your password to be reset!\";\n\n return $this->_response;\n }\n }else\n {\n $this->_response['code'] = 0;\n $this->_response['string'] = \"There is no account with this email!\";\n\n return $this->_response;\n }\n }\n break;\n }\n }\n }", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = $_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\n\t\t\t// Refferal amount\n\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t//-----------------/////\n\n\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\tif (!empty($records)) {\n\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount = $records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic = $records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) {\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n\t\t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$img = self_img_url . $user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$img = '';\n\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif ($status == '1') {\n\t\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\t\texit();\n\t\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status'] = 1;\n\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data);\n\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\t\t\t\tif (!empty($reffer_records)) {\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\n\t\t\t\t\t\t$data12['reffer_user_id'] = $user11_id;\n\t\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data12);\n\n\t\t\t\t\t}\n\t\t\t\t\t/*\n\t\t\t\t\t if(!empty($reffer_records)){\n\t\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t\t $refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t $user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t $reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t $wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t $frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t $current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t $transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t $wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t $refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t $wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t $wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t if($reffer_code == $reffer_code_database){\n\n\t\t\t\t\t $add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\n\t\t\t\t\t $add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t $data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t $update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\n\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t\t */\n\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'], 'user_id' => $user_id, 'user_wallet' => $wallet_amount, 'user_email' => $user_email, 'login_type' => 1, 'user_reffer_code' => $user_self_reffer, 'profile_pic' => $img, 'user_pin_status' => '2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\", 'user_mobile_no' => $_POST['user_mobile_no'], 'verification_code' => $_POST['user_verification_code']);\n\t\t\techo $this -> json($error);\n\t\t}\n\t}", "public function actionCheck()\n\t{\n\t\t$arr = array('controller'=>$this->id, 'action'=>$this->action->id,'status' =>'NOK');\n\t\t$headers = AuthSession::getHead();\n\t\t$auth_code = isset($headers['auth_code']) ? $headers['auth_code'] : null;\n\t\tif ( $auth_code == null ) $auth_code = Yii::app()->request->getQuery('auth_code');\n\t\tif ( $auth_code == '(null)' ) $auth_code = null; //DONE FOR IPHONE AND DONT CHANGE THE ORDER\n\t\t$arr['temp_device_auth_code'] = $auth_code;\n\t\tif($auth_code != null){\n\t\t\t$auth_session = AuthSession::model()->findByAttributes(array('auth_code'=>$auth_code));\n\t\t\tif($auth_session != null){\n\t\t\t\t$arr['status'] = 'OK';\n\t\t\t\t$user = Yii::app()->user->model;\n\t\t\t\t$arr['status']='OK';\n\n\t\t\t\t$arr['success']='you have successfully Login';\n\t\t\t\t//\n\t\t\t\tif(isset($_POST['AuthSession']['device_token'])){\n\t\t\t\t\t$auth_session->device_token = $_POST['AuthSession']['device_token'];\n\t\t\t\t\tif($auth_session->saveAttributes(array('device_token'))){\n\t\t\t\t\t\t$arr['auth_session']='Auth Session updated Updated device token';\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\t$err = '';\n\t\t\t\t\t\tforeach( $auth_session->getErrors() as $error){\n\t\t\t\t\t\t\t$err .= implode( \".\",$error);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$arr['error'] = $err;\n\t\t\t\t\t\t//$arr['status'] = 'NOK';\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\t$arr['device_token'] = 'Device token is not updated ';\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$arr['error'] = 'auth_code is not found';\n\t\t\t}\n\n\t\t}\n\t\telse\n\t\t$arr['error'] = 'Auth code not found in the header or query string.';\n\t\t$this->sendJSONResponse($arr);\n\t}", "function validCode($request_code): bool {\n\t\t\t# Test to See Session Code is 32 character hexadecimal\n\t\t\tif (preg_match(\"/^[0-9a-f]{64}$/i\",$request_code)) return true;\n\t\t\t#error_log(\"Invalid session code: $request_code\");\n\t\t\treturn false;\n\t\t}", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = country_code.$_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\t\t\t\n\t\t\t\t// Refferal amount\n\t\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t//-----------------/////\n\t\t\t\n\t\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\t\tif (!empty($records)) {\n\t\t\t\t\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount=$records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic=$records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) \t{\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n \t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n \t\t\t\t\t$img = self_img_url.$user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t\t} else \t{\n\t\t\t\t\t$img = '';\t\n\t\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif($status=='1'){\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\texit();\n\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status']=1;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data);\n\t\t\t\t\t\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code',$reffer_code);\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t$data12['reffer_user_id']=$user11_id;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data12);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\t\t\t\t\t$reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t\t\t\t\t\t\t$wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t\t\t\t\t\t\t$frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t\t\t\t\t\t\t$current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t\t\t\t\t\t\t$transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t\t\t\t\t\t\t$wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t\t\t\t\t\t\t$refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t\t\t\t\t\t\t$wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t\t\t\t\t\t\t$wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t\t\t\t\t\tif($reffer_code == $reffer_code_database){\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t$add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t$add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t\t\t\t\t\t\t$data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\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\t\t\n\t\t\t\t\t\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'],'user_id'=>$user_id,'user_wallet'=>$wallet_amount,'user_email'=>$user_email,'login_type'=>1,'user_reffer_code'=>$user_self_reffer,'profile_pic'=>$img,'user_pin_status'=>'2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t}else{\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\" ,'user_mobile_no' => $_POST['user_mobile_no'],'verification_code'=>$_POST['user_verification_code']);\n\t\techo $this -> json($error);\n\t\t}\n\t}", "public static function reissue_verification() {\n $email = $_POST[\"email\"];\n // Fetch whether the email is verified information\n try {\n $request = DB::query(\"SELECT `Verified` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n\n // Check if the email is actually registered\n if ($request) {\n $verified_status = $request[0][\"Verified\"];\n // Determine whether the email is verified\n if ($verified_status == 1) {\n // Check if users has a password\n try {\n $pass_request = DB::query(\"SELECT `Password` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n if ($pass_request) {\n return 3;\n } else {\n return 4;\n }\n } else {\n // Gather required data \n try {\n $username = DB::query(\"SELECT `Username` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email))[0][\"Username\"];\n } catch (PDOException $e) {\n return 1;\n }\n $vercode = sha1(time());\n try {\n DB::query(\"UPDATE `Users` SET Vercode=:ver WHERE Email=:email;\", array(\":ver\" => $vercode, \":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n $to = $email;\n $headers = <<<MESSAGE\nFROM: George || [email protected]\nContent-Type: text/plain;\nMESSAGE;\n $subject = \"Verification code re-issue\";\n $msg = <<<EMAIL\nHi $username,\n\nYou've requested for a new verification code to be issued!\nPlease follow this <a href='https://flatdragons.com/signup.php?user=$username&ver=$vercode'>link</a> to confirm your account with us :)\n\nKind regards,\nGeorge (FlatDragons)\nEMAIL;\n mail($to, $subject, $msg, $headers);\n return 0;\n }\n } else {\n return 2;\n }\n }", "function get_error($item, $parm1, $parm2 = null){\n\t$msg = \"\";\n\tswitch ($item) {\n\t\tcase 'validemail':\n\t\t\tif(!filter_var($parm1, FILTER_VALIDATE_EMAIL)){\n\t\t\t\t// $codeErr = 1;\n\t\t\t\t$msg = \"Vous devez saisir une adresse email valide.\";\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase 'existemail':\n\t\t\t$link = db_connect();\n\t\t\t$result = db_get_user($link, $parm1);\n\t\t\tif( $result->fetch()[0] == \"1\"){\n\t\t\t\t// $codeErr = 2;\n\t\t\t\t$msg = \"Cette adresse email est déjà utilisé.\";\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase 'email':\n\t\t\tif($parm1 != $parm2){\n\t\t\t\t// $codeErr = 3;\n\t\t\t\t$msg = \"Les champs email doivent être identique.\";\n\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase 'validpassword':\n\n\t\t\t// if (!preg_match(\"/.*^(?=.{8,20})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\\W).*$/\", $parm1)){\n\t\t\tif (!preg_match(\"/.*^(?=.{8,20})(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$/\",$parm1) \n\t\t\t\t\t|| strlen($parm1)<8\n\t\t\t\t\t|| strlen($parm1)>20){\n \t\t\t\t$msg = \"Le mot de passe ne respecte pas les carractère requis\";\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase 'password':\n\t\t\tif($parm1 != $parm2){\n\t\t\t\t// $codeErr = 5;\n\t\t\t\t$msg = \"Les champs password doivent être identique.\";\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase 'existpseudo':\n\t\t\t$link = db_connect();\n\t\t\t$result = db_get_user($link, $parm1, \"pseudo\");\n\t\t\tif( $result->fetch()[0] == \"1\"){\n\t\t\t\t// $codeErr = 6;\n\t\t\t\t$msg = \"Ce pseudo est déjà utilisé.\";\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase 'dateformat':\n\t\t\t$p=0;\n\t\t\tif(preg_match(\"/^(0[1-9]|[12][0-9]|3[01])[- \\/.](0[1-9]|1[012])[- \\/.](\\d\\d\\d\\d)$/\", $parm1, $dateArr)==1){$p=1;}\n\t\t\telse if(preg_match(\"/^(0[1-9]|1[012])[- \\/.](0[1-9]|[12][0-9]|3[01])[- \\/.](\\d\\d\\d\\d)$/\", $parm1, $dateArr)==1){$p=1;}\n\t\t\telse if(preg_match(\"/^(\\d\\d\\d\\d)[- \\/.](0[1-9]|[12][0-9]|3[01])[- \\/.](0[1-9]|1[012])$/\", $parm1, $dateArr)==1){$p=1;}\n\t\t\t\tif( $p==0 ){\n\t\t\t\t\t// $codeErr = 8;\n\t\t\t\t\t$msg = \"Ceci n'est pas une date\";\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\tcase 'date':\n\t\t\t$p=0;\n\t\t\tif(preg_match(\"/^(0[1-9]|[12][0-9]|3[01])[- \\/.](0[1-9]|1[012])[- \\/.](\\d\\d\\d\\d)$/\", $parm1, $dateArr)==1){$p=1;}\n\t\t\telse if(preg_match(\"/^(0[1-9]|1[012])[- \\/.](0[1-9]|[12][0-9]|3[01])[- \\/.](\\d\\d\\d\\d)$/\", $parm1, $dateArr)==1){$p=1;}\n\t\t\telse if(preg_match(\"/^(\\d\\d\\d\\d)[- \\/.](0[1-9]|[12][0-9]|3[01])[- \\/.](0[1-9]|1[012])$/\", $parm1, $dateArr)==1){$p=1;}\n\t\t\t\tif( $p==1 && $dateArr[0] == 10){\n\t\t\t\t\tif( !checkdate($dateArr[2], $dateArr[1], $dateArr[3]) ){\n\t\t\t\t\t\t// $codeErr = 9;\n\t\t\t\t\t\t$msg = \"Cette date n`exist pas\";\n\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\tcase 'connection':\n\t\t\t$link = db_connect();\n\t\t\t$result = db_get_user($link, $parm1, \"connexion\");\n\t\t\t$data = $result->fetch();\n\n\t\t\t\tif( password_verify($parm2, $data['password']) ){\n\t\t\t\t\t$connection = array(\n\t\t\t\t\t\t'pseudo' \t=> $data['pseudo'], \n\t\t\t\t\t\t'email' \t=> $data['email'], \n\t\t\t\t\t\t'password' \t=> $data['password'], \n\t\t\t\t\t\t'status' \t=> $data['status'], \n\t\t\t\t\t\t'role' \t\t=> $data['role'] \n\t\t\t\t\t\t);\n\t\t\t\t\treturn $connection;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t$msg = \"Login ou mot de passe invalide,\\n\\r\n\t\t\t\t\tsi vous ne vous souvenez plus de vos identifiant cliquer ici pour les réinitialiser \";\t\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\tcase 'notfill' :\n\t\t\t\t// $codeErr = 11;\n\t\t\t\t$msg = \"Vous n'avez pas rempli tous les champs obligatoires(*).\";\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\t\t// $codeErr = 0;\n\t\t\t\t$msg = \"Vous n'avez pas rempli tous les champs obligatoires(*).\";\n\t\t\tbreak;\n\t}\n\treturn $msg;\n}", "function verifyToken() {\n $retVal = array(\"userid\"=>\"\",\"retState\"=>\"\");\n $headerarray = getallheaders();\n $authtoken = $headerarray[\"Authorization\"];\n\n //next we verity in the token table\n $tokenCheck = TokenQuery::create()->findOneByToken($authtoken);\n if($tokenCheck == \"\"){\n echo \"invalid token\";\n $retVal[\"retState\"] = false;\n }else{\n //check token expiration\n if($tokenCheck->getExpires()-time() > -1){\n echo \"token expired\";\n $retVal[\"retState\"] = false;\n }else{\n //lets get userid\n $retVal[\"userid\"] = $tokenCheck->getUserid();\n $retVal[\"retState\"] = true;\n }\n }\n return $retVal;\n}", "function verifyToken() {\n $retVal = array(\"userid\"=>\"\",\"retState\"=>\"\");\n $headerarray = getallheaders();\n $authtoken = $headerarray[\"Authorization\"];\n\n //next we verity in the token table\n $tokenCheck = TokenQuery::create()->findOneByToken($authtoken);\n if($tokenCheck == \"\"){\n echo \"invalid token\";\n $retVal[\"retState\"] = false;\n }else{\n //check token expiration\n if($tokenCheck->getExpires()-time() > -1){\n echo \"token expired\";\n $retVal[\"retState\"] = false;\n }else{\n //lets get userid\n $retVal[\"userid\"] = $tokenCheck->getUserid();\n $retVal[\"retState\"] = true;\n }\n }\n return $retVal;\n}", "public function check_account($email)\n {\n $this->db->where('email', $email);\n $query = $this->db->get('user')->row();\n\n //jika bernilai 1 maka user tidak ditemukan\n if (!$query) {\n return 1;\n }\n //jika bernilai 2 maka user tidak aktif\n if ($query->is_actived == 0) {\n return 2;\n }\n //jika bernilai 3 maka password salah\n if (!hash_verified($this->input->post('password'), $query->password)) {\n return 3;\n }\n\n return $query;\n }", "public static function test_user($user_id, $user_pass);", "public function testCheckCredentials(){\r\n $db = new database;\r\n $db->connectToDatabase();\r\n $result = $db->checkCredentials(\"[email protected]\",\"owner\");\r\n $this->assertEquals(\"[email protected]\",$result[\"emailId\"]);\r\n }", "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}", "function verify_appota_user($appota_access_token, $appota_userid, $appota_username) {\n $url = sprintf('https://api.appota.com/game/get_user_info?access_token=%s', $appota_access_token);\n $result = call_curl_get($url, null);\n return ($result[\"error_code\"] == 0 and $result[\"data\"][\"username\"] == $appota_username and $result[\"data\"][\"user_id\"]);\n}", "public function vxLoginCheck() {\n\t\t$rt = array();\n\t\t\n\t\t$rt['target'] = 'welcome';\n\t\t$rt['return'] = '';\n\t\t\n\t\t$rt['errors'] = 0;\n\t\t\n\t\t$rt['usr_value'] = '';\n\t\t$rt['usr_email_value'] = '';\n\t\t/* usr_error:\n\t\t0 => no error\n\t\t1 => empty\n\t\t999 => unspecific */\n\t\t$rt['usr_error'] = 0;\n\t\t$rt['usr_error_msg'] = array(1 => '你忘记填写名字了');\n\t\t\n\t\t$rt['usr_password_value'] = '';\n\t\t/* usr_password_error:\n\t\t0 => no error\n\t\t1 => empty\n\t\t2 => mismatch\n\t\t999 => unspecific */\n\t\t$rt['usr_password_error'] = 0;\n\t\t$rt['usr_password_error_msg'] = array(1 => '你忘记填写密码了', 2 => '名字或者密码有错误');\n\n\t\tif (isset($_POST['return'])) {\n\t\t\t$rt['return'] = trim($_POST['return']);\n\t\t}\n\t\t\n\t\tif (isset($_POST['usr'])) {\n\t\t\t$rt['usr_value'] = strtolower(make_single_safe($_POST['usr']));\n\t\t\tif (strlen($rt['usr_value']) == 0) {\n\t\t\t\t$rt['usr_error'] = 1;\n\t\t\t\t$rt['errors']++;\n\t\t\t}\n\t\t} else {\n\t\t\t$rt['usr_error'] = 1;\n\t\t\t$rt['errors']++;\n\t\t}\n\t\t\n\t\tif ($rt['errors'] > 0) {\n\t\t\t$rt['target'] = 'error';\n\t\t\treturn $rt;\n\t\t}\n\t\t\n\t\tif (isset($_POST['usr_password'])) {\n\t\t\t$rt['usr_password_value'] = make_single_safe($_POST['usr_password']);\n\t\t\tif (strlen($rt['usr_password_value']) == 0) {\n\t\t\t\t$rt['usr_password_error'] = 1;\n\t\t\t\t$rt['errors']++;\n\t\t\t}\n\t\t} else {\n\t\t\t$rt['usr_password_error'] = 1;\n\t\t\t$rt['errors']++;\n\t\t}\n\t\t\n\t\tif ($rt['errors'] > 0) {\n\t\t\t$rt['target'] = 'error';\n\t\t\treturn $rt;\n\t\t}\n\t\t\n\t\t$sql = \"SELECT usr_id FROM babel_user WHERE usr_email = '\" . $rt['usr_value'] . \"' AND usr_password = '\" . sha1($rt['usr_password_value']) . \"'\";\n\t\t$rs = mysql_query($sql, $this->db);\n\t\tif (mysql_num_rows($rs) == 1) {\n\t\t\t$rt['usr_email_value'] = $rt['usr_value'];\n\t\t\t$rt['target'] = 'ok';\n\t\t} else {\n\t\t\t$sql = \"SELECT usr_id, usr_email FROM babel_user WHERE usr_nick = '\" . $rt['usr_value'] . \"' AND usr_password = '\" . sha1($rt['usr_password_value']) . \"'\";\n\t\t\t$rs = mysql_query($sql, $this->db);\n\t\t\tif (mysql_num_rows($rs) == 1) {\n\t\t\t\t$O = mysql_fetch_object($rs);\n\t\t\t\t$rt['usr_email_value'] = $O->usr_email;\n\t\t\t\t$rt['target'] = 'ok';\n\t\t\t} else {\n\t\t\t\t$rt['target'] = 'error';\n\t\t\t\t$rt['usr_password_error'] = 2;\n\t\t\t\t$rt['errors']++;\n\t\t\t}\n\t\t}\n\t\tmysql_free_result($rs);\n\t\t\n\t\treturn $rt;\n\t}", "function activate_user(){\n\n // use the get request since the user information \n // has been post \n if($_SERVER['REQUEST_METHOD'] == \"GET\"){\n\n if(isset($_GET['email'])) {\n \n $email = clean($_GET['email']);\n $validation_code = clean($_GET['code']);\n \n // select the user in the database \n $sql = \"SELECT id FROM users WHERE email ='\".escape($_GET['email']).\"' AND validation_code = '\".escape($_GET['code']).\"'\";\n $result = query($sql); // get the result \n\n // if the user exists in the database, activate the account by updating active by 1\n // Then the user is redirected to the login page to login \n if(row_count($result)==1){\n\n $sql2 = \"UPDATE users SET active = 1, validation_code = 0 WHERE email = '\".escape($email).\"' AND validation_code = '\".escape($validation_code).\"'\";\n $result2 = query($sql2);\n\n set_message(\"<p class='bg-success'> Your account has been activated please login</p>\");\n \n redirect(\"login.php\");\n }\n else{ // if the user is not activated display an error message\n // and redirect the user to the login page\n\n set_message(\"<p class='bg-danger'> Sorry Your account has not been activated</p>\");\n \n redirect(\"register.php\"); \n\n } \n }\n\n} // GET \n\n}", "function send_authcode_email($authcode,$email,$code_type=0)\n\t{\n\t\t$this->load->library(\"mail\");\n\t\t$this->load->model('login/register_model');\n\t\t$msg_head=$msg_end=$lang=$link=$stuid='';\n\n\t\tif($this->_user_id)\n\t\t{\n\t\t\t$user_info=$this->register_model->get_user_info($this->_user_id);\n\t\t\tif($user_info['errorcode'] && $user_info['user']->student_id)\n\t\t\t{\t\t\n\t\t\t\t$stuid='您的学号是:'.$user_info['user']->student_id.'<br />';\n\t\t\t}\n\t\t}\n\n\t\tswitch($code_type)\n\t\t{\n\t\t\tcase Constant::CODE_TYPE_REGISTER: $link=\"verify\";$lang=\"verify\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PASSWORD: $link=\"forgot/reset\";$lang=\"reset\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_EMAIL: $link=\"verify\";$lang=\"update_email\";break;\n\t\t\tcase Constant::CODE_TYPE_REGISTER_VERIFY_EMAIL: $link=\"verify\";$lang=\"reg_reverify\";break;\n\t\t\tcase Constant::CODE_TYPE_LOGIN_VERIFY_EMAIL: $link=\"verify\";$lang=\"login_reverify\";break;\n\t\t\tdefault:break;\n\t\t}\n\n\t\tif($lang && $link)\n\t\t{\t\n\t\t\t//$authcode=site_url().$link.\"?code=\".$authcode;\n\t\t\t$authcode=login_url().$link.\"/code/\".$authcode;\n\t\t\t$subject=$this->lang->line('mail_subject_'.$lang);\n\t\t\t$msg_body=str_replace('{email}',$email,$this->lang->line('mail_body_'.$lang));\n\t\t\t\n\t\t\t$msg_body=str_replace('{stuid}',$stuid,$this->lang->line('mail_body_'.$lang));\n\t\t\t$msg_end=$this->lang->line('mail_end_'.$lang);\t\t\t\n\t\t}\n\t\t$msg=$msg_body.'<br /><a href=\"'.$authcode.'\">'.$authcode.'</a><br />'.$msg_end.'<br/>'.$this->lang->line('mail_disclaimer');\n\n\t\t$ret = Mail::send($email, $subject, $msg);\n\t\tif($ret['ret']==1)\n\t\t{\n\t\t\t$errorcode=true;\n\t\t\tlog_message('info_tizi','170101:Email send success',$ret);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t\tlog_message('error_tizi','17010:Email send failed',$ret);\n\t\t}\n\t\treturn array('errorcode'=>$errorcode,'send_error'=>implode(',',$ret));\n\t}", "function authenticateUser($authCode)\n {\n\n // define all global variables\n global $user, $database, $message, $translator, $googleAuth;\n\n // secure the string\n $authCode = $database->secureInput($authCode);\n\n // check if empty string\n if ($authCode == \"\") {\n $message->setError($translator->translateText(\"allFieldsRequired\"), Message::Error);\n return false;\n }\n\n // check if string length is 6\n if (strlen($authCode) != 6) {\n $message->setError($translator->translateText(\"authCodeLength\"), Message::Error);\n return false;\n }\n\n // check if codes match\n if (!$googleAuth->checkCode($user->get2FactorCode(), $authCode)) {\n $message->setError($translator->translateText(\"wrongAuthCode\"), Message::Error);\n return false;\n }\n\n // if no errors then authenticate the session and return true\n $_SESSION[\"authenticated\"] = 1;\n return true;\n }", "public function check(string $exam_code)\n {\n $request_data = explode(sprintf(\".%s.\", date(\"d\")), $exam_code);\n\n // the size must be 2: [0] is the user id, [1] the exam_id\n if (sizeof($request_data) == 2) {\n\n $user_id = intval($request_data[0]);\n $exam_id = intval($request_data[1]);\n\n // both user_id and exam_id must be valid integer (> 0)\n if ($exam_id && $user_id) {\n\n // now check if there is an exam for that user\n\n $exam = Exam::where(['user_id' => $user_id, 'id' => $exam_id])->first();\n\n // if there is an exam, the return the result\n if ($exam) {\n\n // if the user finished the exam, then return the result\n if ($exam->started && !is_null($exam->finished_at)) {\n\n $response_data = [\n 'percentage_obtained' => $exam->percentage_obtained,\n 'percentage_required' => $exam->percentage_required,\n 'passed' => $exam->passed,\n 'status' => true\n ];\n\n return response()->json($response_data, 200);\n\n } else {\n\n $response_data = [\n 'status' => false // the exam has not yet started or not yet finished\n ];\n\n return response()->json($response_data, 200);\n }\n\n }\n\n }\n }\n\n return response()->json(null, 404);\n }", "public function CheckActivationCode($code){\n $this->db->where('activation_code',$code);\n $query = $this->db->get('users'); \n if ($query->num_rows() > 0)\n { \n return true;\n }\n else\n { \n return false;\n }\n }", "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}", "public function validateAccessTokenTime($payload)\r\n {\r\n $output = 0;\r\n $dateNow = Carbon::now('UTC')->timestamp;\r\n if ($payload->creation_refrech_ttl_date == \"\" && $payload->expire_refrech_ttl_date == \"\") \r\n {\r\n $creation_ttl_date = $payload->creation_ttl_date;\r\n $expire_ttl_date = $payload->expire_ttl_date;\r\n $expire_refresh_ttl_date = Carbon::createFromTimestampUTC($payload->creation_ttl_date)->timestamp;\r\n $expire_refresh_ttl_date = Carbon::createFromTimestampUTC($expire_refresh_ttl_date)->addMinutes(Config(\"config.refresh_ttl\"))->timestamp;\r\n } \r\n else \r\n {\r\n $creation_ttl_date = $payload->creation_ttl_date;\r\n $expire_ttl_date = $payload->expire_ttl_date;\r\n $expire_refresh_ttl_date = $payload->expire_refrech_ttl_date;\r\n }\r\n if ($payload->expire_ttl_date > $dateNow) \r\n {\r\n if ($expire_refresh_ttl_date > $dateNow) \r\n {\r\n //token is ok\r\n $output = 1;\r\n } \r\n else \r\n {\r\n //token need refresh\r\n $output = 2;\r\n }\r\n } \r\n else \r\n {\r\n //token expired\r\n $output = 3;\r\n }\r\n return $output;\r\n }", "function rest_authorization_required_code()\n {\n }", "function is_user_exits1($str){\n\t\t$user_email\t=\t$this->input->post('user_email');\n\t\t$user_password\t=\t$str;\n\t\t$this->db->where('user_email',$user_email);\n\t\t$this->db->where('user_password',md5($user_password));\t\t\n\t\t$rs\t=\t$this->db->get('user_master');\n\t\t$is_user_exits\t=\t$rs->num_rows();\t\t\n\t\tif($is_user_exits>0){\n\t\t\t$is_email_exits\t=\t$rs->row_array();\n\n\t\t\t$user_email_exits_msg\t=\t'';\n\t\t\tif($is_email_exits['user_status'] == 'pending'){\n\t\t\t\t$user_email_exits_msg\t=\tLoginMessages(2);\n\t\t\t}\n\t\t\telse if($is_email_exits['user_status'] == 'InActive'){\n\t\t\t\t$user_email_exits_msg\t=\tLoginMessages(2); \t\n\t\t\t}\n\t\t\tif($user_email_exits_msg){\n\t\t\t\t$this->form_validation->set_message('is_user_exits', $user_email_exits_msg);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\telse{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\t$user_email_exits_msg\t=\tLoginMessages(1);\n\t\t\t$this->form_validation->set_message('is_user_exits', $user_email_exits_msg);\n\t\t\treturn false;\t\t\t\n\t\t}\n\t}", "private function validateParams(){\n\t\t$name\t = $this->param['name']; \n\t\t$ic\t\t = $this->param['ic']; \n\t\t$mobile\t= $this->param['mobile']; \n\t\t$email\t= $this->param['email']; \n\t\t$statusCode = array();\n\t\tif(!$name){\n\t\t\t$statusCode[] = 115;\n\t\t}\n\t\tif(!$ic){\n\t\t\t$statusCode[] = 116;\n\t\t}\n\t\tif(!$email){\n\t\t\t$statusCode []= 101;\n\t\t}elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {\n\t\t $statusCode[] = 105;\n\t\t}\n\t\treturn $statusCode;\n\t}", "function authorize($args)\n{\n global $_zp_authority;\n $args = decode64($args);\n //debugLog('after decode: '.var_export($args, true));\n logger('authorize', ($args['loglevel']));\n if (!preg_match('#^1.4#', ($version = getVersion()))) {\n return new ZEN_Error(-2, 'Zenphoto version '.$version.' but v1.4.x required!');\n }\n $_zp_authority = new Zenphoto_Authority();\n $hash = $_zp_authority->passwordHash($args['loginUsername'], $args['loginPassword']);\n debugLog('hashvalue: '.$hash);\n $userobj = getAnAdmin([\n '`user`=' => $args['loginUsername'],\n '`valid`=' => 1,\n ]);\n if ($userobj == '') {\n return new ZEN_Error(-1, 'Incorrect username or password '.$args['loginUsername'].' '.$args['loginPassword']);\n } //$userobj == ''\n else {\n $localhash = $userobj->getPass();\n debugLog('hash = '.$hash.' localhash = '.$localhash);\n if ($hash == $localhash) {\n return true;\n } //$userobj\n else {\n return new ZEN_Error(-1, 'Incorrect username or password '.$args['loginUsername'].' '.$args['loginPassword']);\n }\n }\n}", "public function getCountAuthFailures($userid){\r\n\tglobal $pdo;\r\n\tif(empty($this->app_config['account_reactivation_time_min'])){\r\n\t\t$this->setError('Account reactivation time is not set.');\r\n\t\treturn false;\r\n\t}\r\n\ttry{\r\n\t$select = $pdo->prepare(\"SELECT count(*) AS count FROM `authentication_log`\r\n\t\tWHERE `attempted` > DATE_SUB(NOW(), INTERVAL \".$this->app_config['account_reactivation_time_min']. \" MINUTE)\r\n\t\tAND `result` = 0 AND `user_id` = ?\");\r\n\t$select->execute(array($userid));\r\n\t}\r\n\tcatch(PDOException $e){\r\n\t\t$this->setError($e->getMessage());\r\n\t\treturn false;\r\n\t}\t\r\n\t$row = $select->fetch(PDO::FETCH_ASSOC);\r\n//print_r($row);\r\n\treturn $row['count'];\r\n}", "public function api_entry_signin() {\n //parent::returnWithErr(\"Opps. ipray service is expired... sorry.\");\n parent::validateParams(array('email', 'password'));\n\n $users = $this->Mdl_Users->getAll(\"email\", $_POST[\"email\"]);\n\n if (count($users) == 0) parent::returnWithErr(\"User not found.\");\n\n $user = $users[0];\n\n if (!$user->verified) parent::returnWithErr(\"This account is not verified yet.\");\n if ($user->suspended) parent::returnWithErr(\"This account is under suspension.\");\n if ($user->password != md5($_POST[\"password\"])) parent::returnWithErr(\"Invalid password.\");\n\n parent::returnWithoutErr(\"Signin succeed.\", $user);\n }" ]
[ "0.70175093", "0.6671944", "0.6636695", "0.6557928", "0.65566397", "0.64303976", "0.64200485", "0.639658", "0.63700753", "0.6228954", "0.6207038", "0.60789436", "0.60712767", "0.60692966", "0.60504144", "0.6032281", "0.6017066", "0.5968752", "0.59380555", "0.5934535", "0.59291726", "0.59005636", "0.58983314", "0.5897438", "0.58845764", "0.58701247", "0.58621556", "0.58539015", "0.58488697", "0.5845289", "0.58350414", "0.5820153", "0.5783247", "0.5771002", "0.5763257", "0.5741716", "0.5741311", "0.57262444", "0.5718991", "0.57107437", "0.5702493", "0.56883484", "0.5624657", "0.5624657", "0.5599501", "0.5593745", "0.5587015", "0.5579988", "0.5578994", "0.55782586", "0.55697393", "0.5560829", "0.5555634", "0.5545065", "0.5531937", "0.5524787", "0.55193466", "0.5519088", "0.55150324", "0.5510469", "0.5509776", "0.55075943", "0.54998875", "0.5498796", "0.5498677", "0.5498677", "0.5493551", "0.5490387", "0.548127", "0.548009", "0.54761916", "0.5476165", "0.54760593", "0.54758203", "0.5474665", "0.54721016", "0.54696083", "0.546601", "0.5465409", "0.54642755", "0.54642755", "0.54626304", "0.5459146", "0.5457868", "0.5456846", "0.5452224", "0.5451301", "0.54502887", "0.54448766", "0.54424196", "0.54421514", "0.5433989", "0.5433842", "0.543331", "0.54306513", "0.5430294", "0.5428209", "0.54257005", "0.542193", "0.5419059" ]
0.7296355
0
/desc:check authcode time /input:arg(user_id,code_type,phone) /output:return(errorcode(1success,0failed))
function check_authcode_phone($phone,$code_type,$user_id="") { if($phone) { if($this->_redis) { $errorcode=$this->check_auth('phone',sha1($phone)); } else { $this->db->select("id"); $this->db->from($this->_table); $this->db->where("phone",sha1($phone));//需要通过服务获得加密后的电话号码 $this->db->where("code_type",$code_type); $this->db->where("has_verified",0); $this->db->where("generate_time >",date("Y-m-d H:i:s",strtotime(date("Y-m-d H:i:s")." - ".Constant::SEND_AUTHCODE_INTERVAL_PHONE))); $query=$this->db->get(); $total=$query->num_rows(); if($total>0) $errorcode=true; else $errorcode=false; } } else { $errorcode=true; } return array("errorcode"=>$errorcode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check_authcode_email($email,$code_type,$user_id=\"\")\n\t{\n\t\tif($email)\n\t\t{\n\t\t\tif($this->_redis)\n {\n\t\t\t\t$errorcode=$this->check_auth('email',$email);\n }\n else\n {\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"email\",$email);\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" -\".Constant::SEND_AUTHCODE_INTERVAL_EMAIL)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n\t}", "public function check() : int\n {\n\n /**\n * @return invalid request(1) if a code is empty ,null or undefined,\n * if not continue the next execution\n */\n\n if(!$this->code) return INVALID_REQUEST;\n\n\n /** @var $is_valid check the specified code is equal and valid */\n\n $is_valid = database::getInstance()->has('user',[\n\n \"id\" => (new Users())->get_id(),\n\n \"verification_code\" => $this->code\n\n ]);\n\n /** validation */\n\n if($is_valid) {\n\n /** @var $success if a specified code is valid\n * update the current status of \"isVerify\" attribute of a database\n * to PHONE_NUMBER_VERIFIED(1) and\n * @return the number of affected rows\n */\n\n $success = database::getInstance()->update('user',['isVerify'=>user_type::PHONE_NUMBER_VERIFIED],[\n\n \"id\"=> (new Users())->get_id()\n\n ])->rowCount();\n\n /** if has a affeted rows return valid request(2), invalid request if not */\n\n return $success ? VALID_REQUEST : INVALID_REQUEST;\n\n }\n\n\n /** return invalid request(1) if a code is not equal */\n\n return INVALID_REQUEST;\n\n\n\n }", "function verify_authcode_phone($authcode,$phone,$verify=true)\n\t{\n\t\t$user_id=$code_type=0;\n if($this->_redis)\n {\n $data=$this->cache->get($authcode.'_'.sha1($phone));\n if(!empty($data))\n {\n $data=json_decode($data);\n $user_id=$data->user_id;\n $code_type=$data->code_type;\n\t\t\t\tif($verify) $this->cache->delete($authcode.'_'.sha1($phone));\n $errorcode=true;\n }\n else\n {\n $errorcode=false;\n log_message('error_tizi','17051:phone verify code failed',array('phone'=>$phone));\n }\n }\n else\n\t\t{\n\t\t\t$this->db->select(\"id,user_id,phone,code_type,generate_time\");\n\t\t\t$this->db->from($this->_table);\n\t\t\t$this->db->where(\"authcode\",$authcode);\n\t\t\t//加密手机号码\t\n\t\t\t$e_phone=sha1($phone);\t\n\t\t\n\t\t\t$this->db->where(\"phone\",$e_phone);\n\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_PHONE);\n\t\t\t$query=$this->db->get();\t\n\t\t\t$total=$query->num_rows();\n\t\t\tif($total) $gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_PHONE))>date(\"Y-m-d H:i:s\"))\n\t\t\t{\n\t\t\t\t$id=$query->row()->id;\n\t\t\t\t$user_id=$query->row()->user_id;\n\t\t\t\t//$phone=$query->row()->phone;//电话号码已加密\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\tif($verify)\n\t\t\t\t{\n\t\t\t\t\t$this->db->where('id',$id);\n\t\t\t\t\t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n\t\t\t\t\tif($this->db->affected_rows()==1) $errorcode=true;\n\t else $errorcode=false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$errorcode=true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t}\n\t\t}\n\t\treturn array('user_id'=>$user_id,'phone'=>$phone,'code_type'=>$code_type,'errorcode'=>$errorcode);\n\t}", "function generate_authcode_phone($phone,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER)\n\t{\n\t\t$authcode=\"\";\n\t\t$errorcode=$this->check_authcode_phone($phone,$code_type);\n if(!$errorcode['errorcode'])\n {\n\t\t\t$authcode=random_string('nozero',6);\n $data=$this->bind_verify($user_id,\"\",$phone,2,$code_type,$authcode,$user_type);\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode.'_'.sha1($phone),json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_PHONE);\n\t\t\t\t$this->save_check('phone',sha1($phone),$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_PHONE);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n\t\t\t\t$insert_id=$this->db->insert_id();\n\t\t\t\tif($insert_id>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170019:Gen phone auth code',array('phone'=>$phone));\n\t\t\tif(!$errorcode) log_message('error_tizi','17019:Gen phone auth code failed',array('phone'=>$phone));\n\t\t}\n else\n {\n $errorcode=false;\n }\n return array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "function check_auth_response_code($status) {\n\n if ($status != 'S000') {\n $message = get_ticket_error_message($status);\n return result_error($status,$message);\n }\n return result_success();\n}", "function verify_authcode_email($authcode)\n\t{\n\t\t$user_id=$email=$code_type=$user_type=0;\n\t\tif($this->_redis)\n\t\t{\n\t\t\t$data=$this->cache->get($authcode);\t\n\t\t\tif(!empty($data))\n\t\t\t{\n\t\t\t\t$data=json_decode($data);\n\t\t\t\t$user_id=$data->user_id;\n\t\t\t\t$email=$data->email;\n\t\t\t\t$code_type=$data->code_type;\n\t\t\t\t$user_type=$data->user_type;\t\n\t\t\t\t$this->cache->delete($authcode);\n\t\t\t\t$errorcode=true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t\tlog_message('error_tizi','17052:email verify code failed',array('authcode'=>$authcode));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n \t$this->db->select(\"id,user_id,email,code_type,user_type,generate_time\");\n \t$this->db->from($this->_table);\n \t $this->db->where(\"authcode\",$authcode);\n \t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_EMAIL);\n \t$query=$this->db->get();\n \t$total=$query->num_rows();\n \t$gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_EMAIL))>date(\"Y-m-d H:i:s\"))\n \t{\n \t$id=$query->row()->id;\n \t$user_id=$query->row()->user_id;\n \t$email=$query->row()->email;\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\t$user_type=$query->row()->user_type;\n \t$this->db->where('id',$id);\n \t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n \tif($this->db->affected_rows()==1) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n \t}\n \telse\n \t{\n \t\t$errorcode=false;\n \t}\n\t\t}\n return array('user_id'=>$user_id,'email'=>$email,'code_type'=>$code_type,'user_type'=>$user_type,'errorcode'=>$errorcode);\n\t}", "public function checkCode(User $user, $code);", "static function verifyMobile($usr,$code){\r\n\t\t$usr = funcs::check_input($usr);\r\n\t\t$code = funcs::check_input($code);\r\n\r\n\t\t$expired_time = 7*24*60*60;\r\n\t\tif(strlen(trim($usr)) > 0)\r\n\t\t{\r\n\t\t\t$usrId = funcs::getUserid(htmlspecialchars($usr,ENT_QUOTES,'UTF-8'));\r\n\t\t\tif(ctype_digit($usrId) && strlen(trim($code)) > 0)\r\n\t\t\t{\r\n\t\t\t\t$chk = DBConnect::assoc_query_1D(\"SELECT vcode_mobile,waitver_mobileno,vcode_mobile_insert_time FROM \".TABLE_MEMBER.\" WHERE id=\".$usrId);\r\n\t\t\t\tif(strlen(trim($chk['waitver_mobileno'])) > 0 && strlen(trim($chk['vcode_mobile'])) > 0 && $chk['vcode_mobile'] == $code)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(time() <= ((int)$chk['vcode_mobile_insert_time']+$expired_time))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$query = \"UPDATE \".TABLE_MEMBER.\" SET validated='1',mobileno='\".$chk['waitver_mobileno'].\"',waitver_mobileno='' WHERE id=\".$usrId;\r\n\t\t\t\t\t\tDBconnect::execute_q($query);\r\n\t\t\t\t\t\t$_SESSION['MOBILE_VERIFIED'] = 1;\r\n\r\n\t\t\t\t\t\tif(COIN_VERIFY_MOBILE > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$username = funcs::findUserName($usrId);\r\n\t\t\t\t\t\t\t$coinVal = funcs::checkCoin($username);\r\n\r\n\t\t\t\t\t\t\tDBconnect::execute_q(\"UPDATE \".TABLE_MEMBER.\" SET coin=coin+\".COIN_VERIFY_MOBILE.\" WHERE id=\".$usrId);\r\n\t\t\t\t\t\t\t$sqlAddCoinLog = \"INSERT INTO coin_log (member_id, send_to, coin_field, coin, coin_remain, log_date) VALUES ('1','$usrId','Mobile Verify','\".COIN_VERIFY_MOBILE.\"',\".$coinVal.\", NOW())\";\r\n\t\t\t\t\t\t\tDBconnect::execute($sqlAddCoinLog);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\treturn 4;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\treturn 3;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\treturn 2;\r\n\t\t\t}\r\n\t\t\tunset($usrId);\r\n\t\t}\r\n\t}", "private function checkingApiCanAuthenticateCode($auth_code)\n {\n return $this->api_request->get(\"user\",\"validate_user_code\",$params=array('code'=>$auth_code)); \n }", "function check_reffer_code(){\n\t$reffer_code=$_REQUEST['reffer_code'];\n\tif(!empty($reffer_code)){\n\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\tif(!empty($reffer_records)){\n\t\t\t$user_id=$reffer_records[0]['user_id'];\n\t\t\t$user_reffer_code=$reffer_records[0]['user_refferal_code'];\n\t\t\tif($user_reffer_code==$reffer_code){\n\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Reffer code avalible\", 'reffer_code' => $reffer_code,'user_id'=>$user_id);\n\t\t\t}else{\n\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t}\n\t\t\t\n\t\t}else{\n\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t}\n\t}else{\n\t\t$post = array(\"status\" => \"false\", \"message\" => \"Missing parameter\",'reffer_code'=>$reffer_code);\n\t}\n\techo $this -> json($post);\n}", "function authenticate_user($email_a, $passcode){\r\n\t//QUERY DATABASE/ACTIVE DIRECTORY TO SEE IF USER IS VALID\r\nif ($email == \"insert valid email b4 testing\") {\r\n\t/*** set a form token ***/\r\n\t$form_token = md5( uniqid('auth', true) );\r\n\t/*** set the session form token ***/\r\n\t$_SESSION['form_token'] = $form_token;\r\n\t$_SESSION['email_a'] = $email_a;\r\n\t$_SESSION['start_timestamp'] = date('Y-m-d HH:mm:s');\r\n\t$code = \"valid\";\r\n}else{\r\n\t$code = \"invalid\";\r\n\t}\r\necho return $code \"We were unable to validate your information, Please try again\";\r\n /*RETURNED TO CALLING CODE */\r\n\t}", "public function checkCode(TwoFactorInterface $user, $code);", "function executeCommandAUTH(&$SMSGW, $argument = null)\n{\n $code = $SMSGW->getAndSaveAuthCode();\n\n if ($code > 9999 && $code < 100000)\n {\n return $SMSGW->sendMessage('Auth code: ' . $code);\n }\n else\n {\n $SMSGW->log(__FUNCTION__, 'Unable to save auth code to db or invalid code - ' . $code);\n return false;\n }\n}", "public function check_register_code($user_login)\n {\n // Wrong Token Message\n $wrong_token = array(\n 'message' => __('Your authentication code is incorrect', 'wordpress-acl')\n );\n\n // Only Check Register Code\n if (isset($_REQUEST['do_action']) and $_REQUEST['do_action'] == \"check_register_code\") {\n\n // Get User Mobile\n $user_mobile = $user_login;\n $code = sanitize_text_field($_REQUEST['code']);\n\n // Check User Code\n $code_query = self::check_user_opt_code($code, 'mobile', $user_mobile);\n if ($code_query != false and self::check_expire_time_user_otp($code_query) === true) {\n // True\n wp_send_json_success(array(\n 'code' => $code\n ), 200);\n } else {\n // False\n wp_send_json_error($wrong_token, 400);\n }\n }\n\n // Check User code in Register\n if (!isset($_REQUEST['code']) || (isset($_REQUEST['code']) and empty($_REQUEST['code']))) {\n wp_send_json_error($wrong_token, 400);\n }\n $code_query = self::check_user_opt_code($_REQUEST['code'], 'mobile', $user_login);\n if ($code_query === false) {\n wp_send_json_error($wrong_token, 400);\n }\n if (self::check_expire_time_user_otp($code_query) === false) {\n wp_send_json_error(array(\n 'message' => __('Your authentication code has expired', 'wordpress-acl')\n ), 400);\n }\n\n // Check Persian first_name and last_name\n if(empty($_REQUEST['first_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خود را وارد نمایید'\n ), 400);\n }\n if(empty($_REQUEST['last_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را وارد نمایید'\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['first_name']) ===false) {\n wp_send_json_error(array(\n 'message' => __('لطفا نام خود را به فارسی وارد کنید', 'wordpress-acl')\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['last_name']) ===false) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را به فارسی تایپ کنید'\n ), 400);\n }\n }", "function generate_authcode_email($email,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER,$check=true)\n\t{\n\t\t$authcode=\"\";\n\t\tif($check) $errorcode=$this->check_authcode_email($email,$code_type,$user_id);\t\n\t\telse $errorcode=array('errorcode'=>false);\n\t\tif(!$errorcode['errorcode'])\n {\t\n $authcode=random_string('unique');\n $data=$this->bind_verify($user_id,$email,\"\",1,$code_type,$authcode,$user_type);\n\t\t\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode,json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_EMAIL);\n\t\t\t\t$this->save_check('email',$email,$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_EMAIL);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n \t\t$insert_id=$this->db->insert_id();\n \t\tif($insert_id>0) $errorcode=true;\n \t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170018:Gen email auth code',array('email'=>$email));\n\t\t\tif(!$errorcode) log_message('error_tizi','17018:Gen email auth code failed',array('email'=>$email));\t\t\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t}\n\t\treturn array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "function check_reffer_code() {\n\t\t$reffer_code = $_REQUEST['reffer_code'];\n\t\tif (!empty($reffer_code)) {\n\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\t\tif (!empty($reffer_records)) {\n\t\t\t\t$user_id = $reffer_records[0]['user_id'];\n\t\t\t\t$user_reffer_code = $reffer_records[0]['user_refferal_code'];\n\n\t\t\t\t//if($user_reffer_code==$reffer_code){\n\t\t\t\tif (strcmp($user_reffer_code, $reffer_code) == 0) {\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Reffer code avalible\", 'reffer_code' => $reffer_code, 'user_id' => $user_id);\n\t\t\t\t} else {\n\t\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t}\n\t\t} else {\n\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Missing parameter\", 'reffer_code' => $reffer_code);\n\t\t}\n\t\techo $this -> json($post);\n\t}", "public function verifyTwoFACode($code) {\n $verification = Yii::app()->db->createCommand()\n ->select('code')\n ->from('x2_twofactor_auth')\n ->where('userId = :id AND requested >= :requested', array(\n ':id' => $this->id,\n ':requested' => time() - (60 * 5), // within the past 5 minutes\n ))->queryScalar();\n return $code === $verification;\n }", "public function check_activity( $code=NULL){\n\t\tif( $code!=NULL){\t\n\t\t\t$user = $this->get_by(array(\n\t\t\t\t'code' => $code,\n\t\t\t\t'account_active' => '0',\n\t\t\t), TRUE);\n\t\t\treturn($user);\n\t\t}\n\t\treturn false;\n\t\t}", "public function validationSha($code){\r\n\t\t//variables\r\n\t\t$error = '';\r\n\t\t$user_browser = $_SERVER['HTTP_USER_AGENT']; //navegador\r\n\t\t$ip = $_SERVER['REMOTE_ADDR']; //ip\r\n\t\r\n\t\t$this->where('macro_sha', $code);\r\n\t\tif($salida = $this->getOne('solicitudes_clave')){\r\n\t\t\t\r\n\t\t\tif($salida['navegador'] != $user_browser){\t$error = 'navegador no concide';\t}\r\n\t\t\tif($salida['ip'] != $ip){\t\t\t\t\t$error = 'remote ip no concide';\t}\r\n\t\t\t\r\n\t\t\tif($error != ''){\r\n\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\treturn false;\r\n\t\t\t}else{\r\n\t\t\t\t$nuevo_sha = hash('sha512', $salida['email'].$user_browser.$salida['telefono'].$ip);\r\n\t\t\t\tif($nuevo_sha != $salida['macro_sha']){\r\n\t\t\t\t\t$error = 'Shas no coinciden';\r\n\t\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}else{\r\n\t\t\t\t\t//succes!!\r\n\t\t\t\t\t$_SESSION['email_val'] = $salida['email'];\r\n\t\t\t\t\t$_SESSION['corrector'] = $salida['salt'];\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t}else{\r\n\t\t\t$error = 'no hubo conexion a db';\r\n\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "private function checkData() {\n if(!isset(\n $_POST['code'],\n $_POST['field']\n )) {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'wrong request'\n ));\n exit;\n }\n\n if($_POST['field']==='email') {\n $field = 'email';\n }\n elseif($_POST['field']==='phone') {\n $field = 'cellphone';\n }\n else {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'wrong field'\n ));\n exit;\n }\n\n $code=trim($_POST['code']);\n\n $user_id=$this->uSes->get_val('user_id');\n if (isset(\n $_SESSION['uAuth']['profile_update_bg']['change'.$field]['code'],\n $_SESSION['uAuth']['profile_update_bg']['change'.$field]['timestamp'],\n $_SESSION['uAuth']['profile_update_bg']['change'.$field]['password'],\n $_SESSION['uAuth']['profile_update_bg']['change'.$field][$field]\n )) {\n if($field==='cellphone'&&!(int)$this->uFunc->getConf('use MAD SMS to send SMS','content',false)) {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'sms send is not supported'\n ));\n exit;\n }\n\n if($_SESSION['uAuth']['profile_update_bg']['change'.$field]['timestamp']<(time()-300)) {//5min\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'code is expired'\n ));\n exit;\n }\n if($_SESSION['uAuth']['profile_update_bg']['change'.$field]['code']!==$code) {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'wrong code'\n ));\n exit;\n }\n\n $password=$_SESSION['uAuth']['profile_update_bg']['change'.$field]['password'];\n\n $value=$_SESSION['uAuth']['profile_update_bg']['change'.$field][$field];\n\n $this->updateEmailOrPhone($user_id,$field,$value,$password);\n\n unset($_SESSION['uAuth']['profile_update_bg']['change'.$field]);\n\n return $value;\n }\n\n print json_encode([\n 'status'=>'error',\n 'msg'=>'code is expired'\n ]);\n exit;\n }", "abstract public function checkCode(string $uuid, string $code, int $successFlag = self::NOTHING_ON_SUCCESS);", "function verify_code($rec_num, $checkstr)\n\t{\n\t\tif ($user_func = e107::getOverride()->check($this,'verify_code'))\n\t\t{\n\t \t\treturn call_user_func($user_func,$rec_num,$checkstr);\n\t\t}\n\t\t\n\t\t$sql = e107::getDb();\n\t\t$tp = e107::getParser();\n\n\t\tif ($sql->db_Select(\"tmp\", \"tmp_info\", \"tmp_ip = '\".$tp -> toDB($rec_num).\"'\")) {\n\t\t\t$row = $sql->db_Fetch();\n\t\t\t$sql->db_Delete(\"tmp\", \"tmp_ip = '\".$tp -> toDB($rec_num).\"'\");\n\t\t\t//list($code, $path) = explode(\",\", $row['tmp_info']);\n\t\t\t$code = intval($row['tmp_info']);\n\t\t\treturn ($checkstr == $code);\n\t\t}\n\t\treturn FALSE;\n\t}", "public function authorize_result()\n\t{\t\n\t\tif(isset($_GET['code']))\n\t\t{\n\t\t\tif($this->oauth->ci->session->userdata('state') !== $_GET['state'])\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('failure', array(\n 'error' => $this->oauth->ci->lang->line('error_xsfr_victim')\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('success', array(\n\t\t\t\t\t\t'token' => $_GET['code'],\n\t\t\t\t\t\t'state' => $_GET['state']\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(isset($_GET['error']))\n\t\t{\n\t\t\treturn $this->oauth->response('failure', array(\n\t\t\t\t\t'error' => $_GET['error_description']\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}", "public function verify_code($params) {\n\n $verification_code = $params['verification_code'];\n $code_id = $params['code_id'];\n\n $options = array('body'=> array());\n $options['body']['code']= ['verify'=> $verification_code];\n\n $uri = $code_id.\"/verify\";\n $uri = \"/cpaas/auth/v1/\".$this->client->user_id.\"/codes/\".$uri;\n $url = $this->client->_root.$uri;\n $response = $this->client->_request(\"PUT\", $url, $options);\n\n // check if test response\n if ($this->client->check_if_test($response)) {\n return $response;\n }\n // check if error response\n // if ($this->client->check_if_error($response)) {\n // $response = $this->client->build_error_response($response);\n // return $response;\n // }\n\n if ($response->getStatusCode() == 204) {\n $custom_response = ['verified'=> true, 'message'=> 'Success'];\n } else {\n $custom_response = ['verified'=> false, 'message'=> 'Code invalid or expired'];\n }\n\n return $custom_response;\n }", "public function authenticate_code($classname, $code){\n $query = \"SELECT classcode FROM classes where classname = $1;\";\n $query_result = pg_prepare($this->con, \"myquery15\", $query);\n $query_result = pg_execute($this->con, \"myquery15\", array($classname));\n $row = pg_fetch_row($query_result);\n if($row[0] == $code){ //Accesscode matched\n echo(\"Access Code matched\");\n return True;\n }\n else{return False;}\n\n\n }", "public function verify_actcode($member_email, $code){\n\t\t//$newCode = $this->make_activation_code();\n\t\t$mysql = New Mysql();\n\t\treturn($mysql->update_activation_code($member_email, $code));\n\t}", "public function CheckUserPermission($sid,$uid,$gameid,$timecode_now)\n {\n $errcode = -1;\n $key = GameUserLaunchModel::HashSingerUserlaunchGameSelectKey($sid);\n do\n {\n $value = $this->getRedisMaster()->hGet($key,$sid);\n if (empty($value))\n {\n // not flag here.\n $errcode = 1;\n break;\n }\n $l_obj = json_decode($value);\n if (NULL == $l_obj)\n {\n // obj is NULL.\n $errcode = 2;\n break;\n }\n if ($l_obj->launchid != $uid)\n {\n // uid not match.\n $errcode = 3;\n break;\n }\n if ($l_obj->gameid != $gameid)\n {\n // gameid not match.\n $errcode = 4;\n break;\n }\n $dt = $timecode_now - $l_obj->timecode_select;\n if ($dt >= GameUserLaunchModel::$SINGER_USERLAUNCH_SELECT_TIMEOUT)\n {\n // timeout permission invalid.\n $errcode = 5;\n break;\n }\n $errcode = 0;\n }while(FALSE);\n return $errcode;\n }", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = country_code.$_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\t\t\t\n\t\t\t\t// Refferal amount\n\t\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t//-----------------/////\n\t\t\t\n\t\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\t\tif (!empty($records)) {\n\t\t\t\t\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount=$records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic=$records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) \t{\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n \t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n \t\t\t\t\t$img = self_img_url.$user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t\t} else \t{\n\t\t\t\t\t$img = '';\t\n\t\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif($status=='1'){\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\texit();\n\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status']=1;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data);\n\t\t\t\t\t\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code',$reffer_code);\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t$data12['reffer_user_id']=$user11_id;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data12);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\t\t\t\t\t$reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t\t\t\t\t\t\t$wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t\t\t\t\t\t\t$frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t\t\t\t\t\t\t$current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t\t\t\t\t\t\t$transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t\t\t\t\t\t\t$wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t\t\t\t\t\t\t$refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t\t\t\t\t\t\t$wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t\t\t\t\t\t\t$wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t\t\t\t\t\tif($reffer_code == $reffer_code_database){\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t$add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t$add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t\t\t\t\t\t\t$data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\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\t\t\n\t\t\t\t\t\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'],'user_id'=>$user_id,'user_wallet'=>$wallet_amount,'user_email'=>$user_email,'login_type'=>1,'user_reffer_code'=>$user_self_reffer,'profile_pic'=>$img,'user_pin_status'=>'2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t}else{\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\" ,'user_mobile_no' => $_POST['user_mobile_no'],'verification_code'=>$_POST['user_verification_code']);\n\t\techo $this -> json($error);\n\t\t}\n\t}", "public function handleActivationCode($user, $code) {\n $uac = UserActivationCode::where('user_id', $user->id)\n ->where('code', $code)\n ->orderBy('expiration', 'DESC')\n ->first();\n if ($uac) {\n if ($uac->expiration < time()) {\n return \"Your code is expired. Please try to get verification code by clicking send email link.\";\n }\n $user->status = config('sc.user_status.active');\n $user->save();\n $uac->forceDelete();\n return true;\n }\n\n return \"Invalid Activation Code\";\n }", "public function CheckingUserLaunchSubmit($sid,$uid,$gameid,$timecode_now)\n {\n $errcode = -1;\n $key = GameUserLaunchModel::HashSingerUserlaunchGameLaunchKey($sid);\n $member = (string)($uid.':'.$gameid);\n do\n {\n $value = $this->getRedisMaster()->hGet($key,$member);\n if (empty($value))\n {\n // not flag here.\n $errcode = 0;\n break;\n }\n $l_obj = json_decode($value);\n if (NULL == $l_obj)\n {\n // obj is NULL.\n $errcode = 0;\n break;\n }\n $dt = $timecode_now - $l_obj->timecode;\n if ( GameUserLaunchModel::$SINGER_USERLAUNCH_SELECT_TIMEOUT <= $dt )\n {\n // not timeout select invalid.\n $errcode = 0;\n break;\n }\n $errcode = 1;\n }while(FALSE);\n return $errcode;\n }", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = $_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\n\t\t\t// Refferal amount\n\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t//-----------------/////\n\n\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\tif (!empty($records)) {\n\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount = $records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic = $records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) {\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n\t\t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$img = self_img_url . $user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$img = '';\n\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif ($status == '1') {\n\t\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\t\texit();\n\t\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status'] = 1;\n\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data);\n\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\t\t\t\tif (!empty($reffer_records)) {\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\n\t\t\t\t\t\t$data12['reffer_user_id'] = $user11_id;\n\t\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data12);\n\n\t\t\t\t\t}\n\t\t\t\t\t/*\n\t\t\t\t\t if(!empty($reffer_records)){\n\t\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t\t $refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t $user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t $reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t $wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t $frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t $current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t $transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t $wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t $refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t $wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t $wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t if($reffer_code == $reffer_code_database){\n\n\t\t\t\t\t $add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\n\t\t\t\t\t $add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t $data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t $update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\n\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t\t */\n\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'], 'user_id' => $user_id, 'user_wallet' => $wallet_amount, 'user_email' => $user_email, 'login_type' => 1, 'user_reffer_code' => $user_self_reffer, 'profile_pic' => $img, 'user_pin_status' => '2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\", 'user_mobile_no' => $_POST['user_mobile_no'], 'verification_code' => $_POST['user_verification_code']);\n\t\t\techo $this -> json($error);\n\t\t}\n\t}", "function send_authcode_phone($authcode,$phone,$code_type=0)\n\t{\n\t\t$this->load->library('sms');\n\n\t\t$msg_head=$msg_end=$lang='';\n\t\tswitch($code_type)\n\t\t{\n\t\t\tcase Constant::CODE_TYPE_REGISTER: $lang=\"verify\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PASSWORD: $lang=\"reset\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PHONE: $lang=\"update_phone\";break;\n\t\t\tdefault:break;\n\t\t}\n\n\t\tif($lang)\n\t\t{\n\t\t\t$msg_head=str_replace('{phone}',substr($phone,-4),$this->lang->line('phone_body_'.$lang));\n\t\t\t$msg_end=$this->lang->line('phone_end_'.$lang);\t\t\t\n\t\t}\n\t\t$msg=$msg_head.$authcode.$msg_end;\n\n \t$this->sms->setPhoneNums($phone);\n \t$this->sms->setContent($msg);\n\t\t$sms_error=$this->sms->send();\t\n\t\tif($sms_error['error']==\"Ok\")\n\t\t{\n\t\t\t $errorcode=true;\n\t\t\t log_message('info_tizi','170111:Sms send success',$sms_error);\t\n\t\t}\n\t\telse \n\t\t{\n\t\t\t$errorcode=false;\n\t\t\tif($sms_error['status']==3) $sms_error['error']=$this->lang->line('error_sms_invalid_phone');\n\t\t\telse $sms_error['error']=$this->lang->line('error_sms_normal');\n\t\t\tlog_message('error_tizi','17011:Sms send failed',$sms_error);\n\t\t}\n\t\treturn array('errorcode'=>$errorcode,'error'=>$sms_error['error'],'status'=>$sms_error['status']);\n\t}", "public function check_promocode() {\n\t\t\t\t $usertypes = $this->users->checkUserTypeLaabus($this->session->userdata('user_id'));\n\t\t\t\t $agent_id = $usertypes[0]->agent_id;\n\t\t\t\t// print_r($usertypes);\n\t\t\t\tif(empty($agent_id))\n\t\t\t\t{\n\t\t\t\t\t$role_id = 4;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$role_id =44;\n\t\t\t\t}\n\t\t$data = $this->users->check_promocode($_REQUEST['promo_code'],$_REQUEST['amount'],$role_id);\n\t\techo $data;\n\t\texit;\n\t}", "public function verifyOTP(){\n\t \t\tif($this->session->userdata('otp')==$this->input->post('otp_')){\n\t \t\t\tif($this->verifyThisUser($this->input->post('mobile_no'))){\n\t \t\t\t\tdie(json_encode(array('code'=>1,'msg'=>\"Registered Successfully.\")));\n\t \t\t\t}else{\n\t \t\t\t\tdie(json_encode(array('code'=>23,'msg'=>\"Failed To Verify.\")));\n\t \t\t\t}\n\t \t\t\t\n\t \t\t}else{\n\t \t\t\tdie(json_encode(array('code'=>0,'msg'=>\"Failed to register\")));\n\t \t\t}\n\t \t}", "function verifyemail() {\n\t$a = array(\n\t 'status' => 'system-error'\n\t);\n\n\t// raw inputs\n\t$taint_si = isset($_POST['si']) ? $_POST['si'] : 0;\n\t$taint_tic = isset($_POST['tic']) ? $_POST['tic'] : 0;\n\t$taint_pword = isset($_POST['pword']) ? $_POST['pword'] : 0;\n\n\t// validate inputs\n\t$si = validateToken($taint_si);\n\t$tic = validateTic($taint_tic);\n\t$pword = validatePword($taint_pword);\n\n\t// validate parameter set\n\tif (!$si || !$tic || !$pword) {\n\t\tLog::write(LOG_WARNING, 'attempt with invalid parameter set');\n\t\treturn $a;\n\t}\n\n\t// get db connection\n\t$conn = getConnection();\n\tif (!$conn) {\n\t\treturn $a;\n\t}\n\n\t// read token and user table\n\t$result = getUserByToken($conn, $si);\n\tif (!$result) {\n\t\treturn $a;\n\t}\n\n\t// get fields\n\t$row = pg_fetch_array($result, 0, PGSQL_ASSOC);\n\t$userid = $row['id'];\n\t$hashpassword = $row['hashpassword'];\n\t$auth = $row['auth'];\n\t$hashtic = $row['hashtic'];\n\t$oldemail = $row['email'];\n\n\t// verify user authentication state\n\tif (!isUserEmailPending($auth)) {\n\t \tLog::write(LOG_NOTICE, 'attempt to verify email on user not auth=email-pending');\n\t\treturn $a;\n\t}\n\n\t// verify the password\n\t$boo = verifyPassword($pword, $hashpassword);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid password');\n\t\treturn $a;\n\t}\n\n\t// verify the tic from the email\n\t$boo = verifyTic($tic, $hashtic);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid tic');\n\t\treturn $a;\n\t}\n\n\t// update user record\n\t$auth = DB::$auth_verified;\n\t$name = 'verify-email';\n\t$sql = \"update accounts.user set email=newemail, newemail='', auth=$1, hashtic=null, tmhashtic=null where id = $2\";\n\t$params = array($auth, $userid);\n\t$result = execSql($conn, $name, $sql, $params, true);\n\tif (!$result) {\n\t\treturn false;\n\t}\n\n\t// send security notice\n\t$boo = sendAuthenticationEmail($oldemail, 'changedemail', '');\n\tif (!$boo) {\n\t\t$a['status'] = 'send-email-failed';\n\t\treturn $a;\n\t}\n\n\t// success\n\t$a['status'] = 'ok';\n\t$a['auth'] = $auth;\n\treturn $a;\n}", "function aCAuth($r)\t{\n\t\tif ($this->authCode && !strcmp($this->authCode,$this->authCode($r)))\t{\n\t\t\treturn true;\n\t\t}\n\t}", "function actiongetVerifyCode()\n\t{\n\t\t$jsonarray= array();\n\t\t\n\t\tif(isset($_POST['phone']))\n\t\t{\n\t\t\t$userObj=new Users();\n\t\t\tif(!is_numeric($_POST['phone'])){\n\t\t\t\t$algoencryptionObj\t=\tnew Algoencryption();\n\t\t\t\t$_POST['phone']\t=\t$algoencryptionObj->decrypt($_POST['phone']);\n\t\t\t}\n\t\t\t$result=$userObj->getVerifyCodeById($_POST['phone'],'-1');\n\t\t\t$jsonarray['status']=$result['status'];\n\t\t\t$jsonarray['message']=$result['message'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$message=$this->msg['ONLY_PHONE_VALIDATE'];\n\t\t\t$jsonarray['status']='false';\n\t\t\t$jsonarray['message']=$message;\n\t\t}\n\t\techo $jsonarray['message'];\n\t}", "function validCode($request_code): bool {\n\t\t\t# Test to See Session Code is 32 character hexadecimal\n\t\t\tif (preg_match(\"/^[0-9a-f]{64}$/i\",$request_code)) return true;\n\t\t\t#error_log(\"Invalid session code: $request_code\");\n\t\t\treturn false;\n\t\t}", "function check_verify($code, $id = ''){\n $verify = new \\Think\\Verify();\n return $verify->check($code, $id);\n}", "public function validation($data)\n {\n \t$this->load->library('encrypt');\n\t\t$user = $this->db->select('email, password, status_register')->where('email', $data['email'])->get('ec_client')->result_array();\n if (count($user) > 0) {\n\t\t\t\t$password_decode = $this->encrypt->decode($user[0]['password']);\n\t\t\t\t\tif ($password_decode == $data['password']) {\n\t\t\t\t\t\tif ($user[0]['status_register'] == 0) {\n return 2;\n }\n return 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn 0; # Usuario o clave de acceso incorrectos\n\t\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn 0; # Usuario o clave de acceso incorrectos\n\t\t\t}\n }", "public function checkgiftcardcode() {\n global $loguser;\n $curr_email = $loguser['email'];\n $code = $_GET['gfcode_value'];\n $getgfcardval = TableRegistry::get('Giftcards')->find()->where(['giftcard_key' => $code])->first();\n if (!empty($getgfcardval)) {\n $recEmail = $getgfcardval->reciptent_email;\n $gfcardId = $getgfcardval->id;\n $gfcardAmt = $getgfcardval->avail_amount;\n if ($gfcardAmt <= 0) {\n echo \"2\";\n die;\n } else if ($recEmail == $curr_email) {\n echo '1' . '*|*' . $gfcardId;\n die;\n } else {\n echo '0';\n die;\n }\n } else {\n echo '0';\n die;\n }\n }", "public function verifyCode(CodeRequest $request )\n\t{\n\t\tif(!is_numeric($request->input('code'))){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\n\t\t$querry = \"SELECT * FROM \". DBTool::rawTable('users') . \" WHERE phone_token = '\" . $request->input('code') . \"' AND phone = '\" . $request->input('phone') . \"'\";\n\t\t$user = DB::select(DB::raw($querry));\n\n\t\t$user = ArrayHelper::fromObject($user);\n\n\t\t//if user enter wrong code\n\t\tif(!isset($user[0]['id']) && !isset($user[0]['phone']) ){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\t\t// SET THE CODE IS VERIFIED\n\t\t$querry = \"UPDATE \". DBTool::rawTable('users') . \" SET verified_phone = 1 WHERE id = '\" . $user[0]['id'] . \"'\";\n\t\t$updated = DB::update(DB::raw($querry));\n\t\t$updated = ArrayHelper::fromObject($updated);\n\n\t\t// Redirection\n\t\t// return $this->lastRecords($user[0]['phone']);\n\t\treturn redirect( '/end/registration/' . $user[0]['phone'] );\n\t}", "function code_checkCodeUser($bdd, $CodeID, $userID)\n\t{\n\t\techo_debug('CODE code_checkCodeUser | codeID='.$CodeID.' userID='.$userID.'<br>');\n\t\ttry\n\t\t{ \n\t\t\t$response = $bdd->prepare('SELECT userID FROM code WHERE id=:ci');\n\t\t\t$response->execute(array(\n\t\t\t\t'ci' => $CodeID\n\t\t\t));\n\t\t}\t\n\t\tcatch (Exception $e)\n\t\t{\n\t\t\tdie('Error : '.$e->getMessage());\n\t\t}\n\t\t\n\t\ttry\n\t\t{\n\t\t\t$nb_rows = $response->rowCount();\n\t\t}\n\t\tcatch(Exception $e)\n\t\t{\n\t\t\t$nb_rows = 0;\n\t\t}\n\t\t\n\t\t$codeUser=0;\n\t\t$check=FALSE;\n\t\tif($nb_rows > 0)\n\t\t{\n\t\t\twhile ($data = $response->fetch())\n\t\t\t{\n\t\t\t\t$codeUser = $data['userID']; \t\n\t\t\t}\n\t\t\tif($codeUser !=0 && $codeUser==$userID)\n\t\t\t{\n\t\t\t\techo_debug('CODE code_checkCodeUser | return TRUE<br>');\n\t\t\t\t$check= TRUE;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\techo_debug('CODE code_checkCodeUser | return FALSE - This code does not belong to the user<br>');\n\t\t\t\t$check=FALSE;\t\t\t\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\techo_debug('CODE code_checkCodeUser | return FALSE Code not found<br>');\n\t\t\t$check=FALSE;\t\t\t\n\t\t}\n\t\t\n\t\treturn $check;\n\t}", "public function codeVerificationAction($header_data,$data){\n if( !isset($data['otp_no'])) {\n Library::logging('alert',\"API : codeVerification : \".ERROR_INPUT.\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_INPUT, null);\n } else {\n try {\n $user_id = $header_data['id'];\n $otp_no = $data['otp_no'];\n $user = Users::findById($user_id);\n \n $group = array();\n $db = Library::getMongo();\n $groups = $db->execute('return db.groups.find( { $and: [ { is_active: 1 }, { group_name: \"Friends\" } ] } ).toArray()');\n \n if($groups['ok'] == 0) {\n Library::logging('error',\"API : codeVerification (get groups) mongodb error: \".$groups['errmsg'].\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_REQUEST, null);\n }\n array_push($group,(string)$groups['retval'][0][_id]);\n if($user->otp == $otp_no) {\n if($user->is_active == 1) {\n // user already exist\n } else {\n $user->is_active = 1;\n $user->username = \"user\";\n $user->context_indicator = \"Available\";\n $user->my_mind_groups = $group;\n $user->about_me_groups = $group;\n $user->my_pictures_groups = $group;\n $user->unique_id = strtolower( uniqid() );\n $user->is_edit = 0;\n $user->is_searchable = 1;\n $user->is_mobile_searchable = 1;\n $user->save();\n }\n Library::output(true, '1', OTP_VERIFIED, null);\n } else {\n Library::logging('alert',OTP_WRONG.\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', OTP_WRONG, null);\n }\n } catch (Exception $e) {\n Library::logging('error',\"API : codeVerification : \".$e.\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_REQUEST, null);\n }\n }\n }", "public function passwordResetCode();", "static function checkMobileVerify($username, $password = null, $code = null)\r\n\t{\r\n\t\t$username = funcs::check_input($username);\r\n\r\n\t\tif($password != null && $code != null)\r\n\t\t{\r\n\t\t\t$password = funcs::check_input($password);\r\n\t\t\t$code = funcs::check_input($code);\r\n\t\t\t$no = DBconnect::retrieve_value(\"SELECT waitver_mobileno\r\n\t\t\t\t\t\t\t\t\t\t\t FROM \".TABLE_MEMBER.\"\r\n\t\t\t\t\t\t\t\t\t\t\t WHERE \".TABLE_MEMBER_USERNAME.\"='\".htmlspecialchars($username,ENT_QUOTES,'UTF-8').\"'\r\n\t\t\t\t\t\t\t\t\t\t\t AND \".TABLE_MEMBER_PASSWORD.\"='\".$password.\"'\r\n\t\t\t\t\t\t\t\t\t\t\t AND \".TABLE_MEMBER_VALIDATION.\"='\".$code.\"' \");\r\n\t\t}\r\n\t\telse\r\n\t\t\t$no = DBconnect::retrieve_value(\"SELECT waitver_mobileno FROM \".TABLE_MEMBER.\" WHERE \".TABLE_MEMBER_USERNAME.\"='\".htmlspecialchars($username,ENT_QUOTES,'UTF-8').\"'\");\r\n\r\n\t\treturn $no;\r\n\t}", "public function actionCheck()\n\t{\n\t\t$arr = array('controller'=>$this->id, 'action'=>$this->action->id,'status' =>'NOK');\n\t\t$headers = AuthSession::getHead();\n\t\t$auth_code = isset($headers['auth_code']) ? $headers['auth_code'] : null;\n\t\tif ( $auth_code == null ) $auth_code = Yii::app()->request->getQuery('auth_code');\n\t\tif ( $auth_code == '(null)' ) $auth_code = null; //DONE FOR IPHONE AND DONT CHANGE THE ORDER\n\t\t$arr['temp_device_auth_code'] = $auth_code;\n\t\tif($auth_code != null){\n\t\t\t$auth_session = AuthSession::model()->findByAttributes(array('auth_code'=>$auth_code));\n\t\t\tif($auth_session != null){\n\t\t\t\t$arr['status'] = 'OK';\n\t\t\t\t$user = Yii::app()->user->model;\n\t\t\t\t$arr['status']='OK';\n\n\t\t\t\t$arr['success']='you have successfully Login';\n\t\t\t\t//\n\t\t\t\tif(isset($_POST['AuthSession']['device_token'])){\n\t\t\t\t\t$auth_session->device_token = $_POST['AuthSession']['device_token'];\n\t\t\t\t\tif($auth_session->saveAttributes(array('device_token'))){\n\t\t\t\t\t\t$arr['auth_session']='Auth Session updated Updated device token';\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\t$err = '';\n\t\t\t\t\t\tforeach( $auth_session->getErrors() as $error){\n\t\t\t\t\t\t\t$err .= implode( \".\",$error);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$arr['error'] = $err;\n\t\t\t\t\t\t//$arr['status'] = 'NOK';\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\t$arr['device_token'] = 'Device token is not updated ';\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$arr['error'] = 'auth_code is not found';\n\t\t\t}\n\n\t\t}\n\t\telse\n\t\t$arr['error'] = 'Auth code not found in the header or query string.';\n\t\t$this->sendJSONResponse($arr);\n\t}", "public function checkAuth();", "public function checkAuth();", "private static function verify() {\r\n\t\t// create code object for the given code we will be verifying\r\n\t\tif (!isset($_SESSION['user'])) {\r\n\t\t\tself::alertMessage('danger', 'Unable to find session user data. Try logging out and logging in again.');\r\n\t\t\tVerificationView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t$userID = $_POST['userID'] = $_SESSION['user']->getUserID();\r\n\t\t$code = new VerificationCode($_POST);\r\n\r\n\t\t// load and validate expected code from database\r\n\t\t$codeInDatabase = VerificationCodesDB::get($userID);\r\n\t\tif (is_null($codeInDatabase)) {\r\n\t\t\tself::alertMessage('danger', 'No active verification code found. Your code may have expired. Click \"Resend Code\" to send a new code to your phone.');\r\n\t\t\tVerificationView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// compare given/expected codes\r\n\t\tif ($code->getCode() !== $codeInDatabase->getCode()) {\r\n\t\t\tself::alertMessage('danger', 'The code you entered is incorrect. Please check your code and try again.');\r\n\t\t\tVerificationView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// verification successful. mark phone number as verified\r\n\t\t$user = UsersDB::getUser($userID);\r\n\t\t$user->setIsPhoneVerified(true);\r\n\t\tUsersDB::edit($user);\r\n\t\t$_SESSION['user'] = $user;\r\n\r\n\t\t// clean up and show dashboard\r\n\t\tVerificationCodesDB::clear($userID);\r\n\t\tDashboardView::show();\r\n\t}", "function users_user_activation($args)\n{\n $code = base64_decode(FormUtil::getPassedValue('code', (isset($args['code']) ? $args['code'] : null), 'GETPOST'));\n $code = explode('#', $code);\n\n if (!isset($code[0]) || !isset($code[1])) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n $uid = $code[0];\n $code = $code[1];\n\n // Get user Regdate\n $regdate = pnUserGetVar('user_regdate', $uid);\n\n // Checking length in case the date has been stripped from its space in the mail.\n if (strlen($code) == 18) {\n if (!strpos($code, ' ')) {\n $code = substr($code, 0, 10) . ' ' . substr($code, -8);\n }\n }\n\n if (DataUtil::hash($regdate, 'md5') == DataUtil::hash($code, 'md5')) {\n $returncode = pnModAPIFunc('Users', 'user', 'activateuser',\n array('uid' => $uid,\n 'regdate' => $regdate));\n\n if (!$returncode) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n LogUtil::registerStatus(__('Done! Account activated.'));\n return pnRedirect(pnModURL('Users', 'user', 'loginscreen'));\n } else {\n return LogUtil::registerError(__('Sorry! You entered an invalid confirmation code. Please correct your entry and try again.'));\n }\n}", "function tokenVerification($type, $matchingId)\r\n{\r\n $tableRecord = & get_instance();\r\n $tableRecord\r\n ->load\r\n ->database();\r\n if ($type == '0')\r\n {\r\n return $tableRecord\r\n ->db\r\n ->get_where('loungeMaster', array(\r\n 'loungeId' => $matchingId,\r\n 'status' => '1'\r\n ));\r\n }\r\n else\r\n {\r\n $tableRecord\r\n ->db\r\n ->order_by('id', 'desc');\r\n return $tableRecord\r\n ->db\r\n ->get_where('loginMaster', array(\r\n 'loungeMasterId' => $matchingId,\r\n 'status' => '1',\r\n 'type' => '3'\r\n ));\r\n }\r\n}", "public function verify(){\n\t\t// getting the username and code from url\n\t\t$code=$_GET['c'];\n\t\t$user=$_GET['u'];\n\t\t// load the regmod model\n\t\t$this->load->model('regmod');\n\t\t// calling the function Vemail that check the valodation code with the username\n\t\t$flag=$this->regmod->Vemail($user,$code);\n\t\t// checking the Vemail the respond\n\t\tif($flag)\n\t\t\t{$data['res']= \"You have successfully verified your email. You may login to Hungry.lk with your username and password\";}\n\t\telse\n\t\t\t{$data['res']= \"Opps An error occurred in our system, try again later\";}\n\t\t$this->load->view(\"register_status_view\",$data);\n\t}", "public function check_pincode(){\n // $area_id = $_REQUEST['area_id'];\n $pincode = $_REQUEST['pincode'];\n $check_pin = $this->User_Model->check_duplication('',$pincode,'tahsil_pincode_no','tahsil_pincode');\n if($check_pin > 0){\n $response[\"status\"] = TRUE;\n $response[\"msg\"] = 'Valid Pincode';\n } else{\n $response[\"status\"] = FALSE;\n $response[\"msg\"] = 'Invalid Pincode';\n }\n $json_response = json_encode($response,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);\n echo str_replace('\\\\/','/',$json_response);\n }", "public function recovery_test( $code=NULL, $language=\"en\"){\n\t\t$user=NULL;\n\t\t$redirect='/'.$language.'/home/recovery/'.$code;\n\t\t$now=now();\n\t\t\n\t\t\t$user = $this->get_by(array(\n\t\t\t\t'code' => $code,\n\t\t\t\t'new_pass_active' => '1',\n\t\t\t\t'expiration >' => $now,\n\t\t\t), TRUE);\n\t\t\t\n\t\t\tif($user){\n\t\t\t\treturn ($user);\n\t\t\t}\n\t\t\treturn false;\n\t\t\t\n\t\t}", "public function checkDetails($param, $type ='send') \n {\n try {\n \n $param['name'] = (isset($param['name'])) ? $param['name'] : \"\";\n $param['phone'] = (isset($param['phone'])) ? $param['phone'] : \"\";\n\n $returnData = $this->sanitarize($param);\n $returnData['status'] = false;\n \n if (!$returnData['name']) {\n $returnData['message'] = 'api.missing_username';\n return $returnData;\n // throw new BadRequesrHttpException('api.missing_username');\n\n }\n\n if (!$returnData['phone']) {\n $returnData['message'] = 'api.missing_phone';\n return $returnData;\n }\n\n $user = $this->doctrine->getRepository('MainBundle:User')->findOneBy(array('name' => $returnData['name']));\n\n if (!$user) {\n $returnData['message'] = 'api.valid_user';\n return $returnData;\n }\n\n $phone = $this->doctrine->getRepository('MainBundle:UserPhone')->checkUserPhone($returnData);\n\n if (!$phone) {\n $returnData['message'] = 'api.valid_phone';\n return $returnData;\n }\n //setting otp value\n if(ValueConstants::VERIFYAPI === $type) {\n $returnData['otp'] = (trim(array_key_exists('otp', $param))) ? $param['otp'] : \"\";\n\n if ( !$returnData['otp'] ) {\n $returnData['message'] = 'api.missing_otp';\n return $returnData;\n } else if (6 !== strlen($returnData['otp'])){\n \n $returnData['message'] = 'api.invalid_otp';\n return $returnData;\n }\n } else {\n $returnData['otp'] = (ValueConstants::USEDSTATUS === $user->getStatus())? $this->generateOtp() : $user->getOtp();\n \n }\n $returnData['status'] = true;\n\n } catch (\\Exception $e) {\n $returnData['errorMessage'] = $e->getMessage();\n }\n return $returnData;\n }", "function rest_authorization_required_code()\n {\n }", "public static function verifyAuth($auth) {\n\t\t$GLOBALS[\"logger\"]->debug(\"in verifyAuth, code \" . $auth);\n\t\t$resultSet = ORM::for_table(self::AUTHCODE_TABLE)->\n\t\t\tselect('code_hash')->\n\t\t\tfind_many();\n\t\t$GLOBALS[\"logger\"]->debug(\"completed query\");\n\t\tforeach ($resultSet as $result) {\n\t\t\t$hash = $result->code_hash;\n\t\t\t$GLOBALS[\"logger\"]->debug(\"Checking hash \" . $hash);\n\t\t\tif (password_verify($auth, $hash)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t$GLOBALS[\"logger\"]->debug(\"No hash matched\");\n\t\treturn false;\n\t\t//$selstmt = \"SELECT CODE_HASH FROM AUTHCODES\";\n\t}", "function verify($email,$code)\n {\n $sql = \"SELECT id\n FROM\n user\n WHERE\n verification = '$code'\n AND\n email='$email'\n \";\n $query = $this->db->query($sql);\n if($query->num_rows()>0)\n {\n $row = $query->row();\n $update['verification'] = 'done';\n $update['status'] = 1;\n $this->db->where('id', $row->id);\n $this->db->update('user', $update);\n return $row->id;\n }\n }", "public function errorcode();", "public function veryfyuser($email,$code){\n\t\t$this->db->where('Status', '0');\n\t\t$this->db->where('Email', $email);\n\t\t$this->db->where('UniqueKey', $code);\n\n\t\t$query=$this->db->get('tbl_userdetails');\n\t\tif($query->num_rows()==1){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "function checkToken($type,$token,$userid){\n\tif(trim($type) == ''\n\t\t|| trim($token) == ''\n\t\t|| trim($userid) == ''\n\t){\n\t\treturn false;\n\t}\n\tif($type == DUDU_DRIVER){\n\t\t$table = API_TABLE_PRE.'driver_token';\n\t\t$conditionUseridColumn = 'did';\n\t}elseif ($type == DUDU_PASSENGER){\n\t\t$table = API_TABLE_PRE.'passenger_token';\n\t\t$conditionUseridColumn = 'pid';\n\t}else{\n\t\treturn false;\n\t}\n\t$sql = 'select token from '.$table.' where '.$conditionUseridColumn.' = '.$userid;\n\t$rs = myDoSqlQuery($sql);\n\t$tokenInfo = pg_fetch_assoc($rs);\n\tif($tokenInfo['token']==$token){\n\t\treturn true;\n\t}else{\n\t\treturn false;\n\t}\n}", "public function errorCode();", "public function errorCode();", "function version_check($version_code){\nif($version_code==1){\n $response = array(\"status\" => \"success\");\n}else{\n $response = array(\"status\" => \"error\");\n}\n return $response;\n}", "function browserCredentials() {\n if(isset($_GET['code'])) return true;\n\n return false;\n}", "public function verify_otp_post(){\n $pdata = file_get_contents(\"php://input\");\n $data = json_decode($pdata,true);\n\n $required_parameter = array('otp','user_id');\n $chk_error = $this->controller->check_required_value($required_parameter, $data);\n if ($chk_error) \n {\n $resp = array('code' => 'MISSING_PARAM', 'message' => 'Missing ' . strtoupper($chk_error['param']));\n @$this->response($resp);\n }\n\n $otp = $data['otp'];\n $user_id = $data['user_id'];\n\n $where = array(\n 'user_id' => $user_id,\n 'otp' => $otp\n ); \n\n $verify = $this->model->getAllwhere('otp_master',$where);\n if(!empty($verify)){\n $update = array('is_active'=> 1);\n $this->model->updateFields('users',$update,array('id'=>$user_id));\n $this->model->delete('otp_master',array('user_id'=>$user_id));\n $resp = array(\n 'rccode' => 1,\n 'message' => 'Otp Verify Successfully', \n );\n }else{\n $resp = array(\n 'rccode' => 2,\n 'message' => 'Please Enter Valid Otp', \n );\n } \n\n $this->response($resp); \n }", "function is_mobile_number_registered($mobile,$active){\n //check for users which are active\n if ($active == true){\n $count = Db::rowCount(\"user\",array(\n \"mobile\" => $mobile,\n \"active\" => \"y\",\n \"verified_otp\" => \"y\"\n ),array(\n \"=\",\"=\",\"=\"\n ));\n\n }else{\n //user active status dont matter\n $count = Db::rowCount(\"user\",array(\n \"mobile\" => $mobile\n ),array(\n \"=\"\n ));\n }\n\n return $count == 1 ? true : false;\n}", "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}", "public function userCheck($param) { \n if (!$this->aaa->has_right('openruth', 500))\n $res->agencyError->_value = 'authentication_error';\n else {\n $targets = $this->config->get_value('ruth', 'ztargets');\n $agencyId = self::strip_agency($param->agencyId->_value);\n if ($tgt = $targets[$agencyId]) {\n $z = new z3950();\n $z->set_target($tgt['host']);\n $z->set_database($tgt['database'].'-borrowercheck');\n $z->set_authentication($tgt['authentication']);\n if ($tgt['proxy']) {\n $z->set_proxy($tgt['proxy']);\n }\n $z->set_syntax('xml');\n $z->set_element('test');\n $rpn = '@attrset 1.2.840.10003.3.1000.105.3 @and @attr 1=1 %s @and @attr 1=4 %s @attr 1=5 %s';\n $z->set_rpn(sprintf($rpn, $agencyId, $param->userId->_value, $param->userPinCode->_value));\n $this->watch->start('zsearch');\n $hits = $z->z3950_search($tgt['timeout']);\n $this->watch->stop('zsearch');\n//var_dump($hits);\n//var_dump($z->get_errno());\n if ($err = $z->get_errno()) {\n self::log_z_error(__FUNCTION__, __LINE__, $agencyId, $err, $z->get_error_string());\n $res->userError->_value = 'cannot reach local system - (' . $err . ')';\n } elseif (empty($hits))\n $res->userError->_value = 'unknown userId';\n else {\n $this->watch->start('zrecord');\n $rec = $z->z3950_record();\n $this->watch->stop('zrecord');\n //print_r($rec);\n $dom = new DomDocument();\n $dom->preserveWhiteSpace = false;\n if ($dom->loadXML($rec)) {\n $chk = &$dom->getElementsByTagName('BorrowerCheck')->item(0);\n $trans = array(\n array('from' => 'BorrowerFound', 'to' => 'userFound', 'bool' => 'y'),\n array('from' => 'PinOk', 'to' => 'userPinCodeOk', 'bool' => 'y'),\n array('from' => 'Blocked', 'to' => 'userBlocked', 'bool' => 'y'),\n array('from' => 'Lost', 'to' => 'userCardLost', 'bool' => 'y'),\n array('from' => 'HasLeft', 'to' => 'userHasLeft', 'bool' => 'y'),\n array('from' => 'Valid', 'to' => 'userValid', 'bool' => 'y'),\n array('from' => 'IsInMunicipal', 'to' => 'userIsInMunicipal', 'bool' => 'y'),\n array('from' => 'ReservationAllowed', 'to' => 'userOrderAllowed', 'bool' => 'y'),\n array('from' => 'BookingAllowed', 'to' => 'userBookingAllowed', 'bool' => 'y'),\n array('from' => 'EmailAddress', 'to' => 'userEmail'),\n array('from' => 'BorrowerCat', 'to' => 'userCategoryCode'),\n array('from' => 'BorrowerCatName', 'to' => 'userCategoryName'),\n array('from' => 'StandardCounter', 'to' => 'agencyCounter'),\n array('from' => 'BirthYear', 'to' => 'userBirthYear'),\n array('from' => 'Sex', 'to' => 'userSex', 'enum' => array('b' => 'male', 'g' => 'female', 'u' => unknown)),\n array('from' => 'userAge', 'to' => 'Age'));\n self::move_tags($chk, $res->userCheck->_value, $trans);\n } else\n $res->userError->_value = 'cannot decode answer';\n }\n } else\n $res->userError->_value = 'unknown agencyId';\n }\n\n $ret->userCheckResponse->_value = $res;\n //var_dump($param); var_dump($res); die();\n return $ret;\n }", "function check_verify($code, $id = 1){\n $verify = new \\Think\\Verify();\n return $verify->check($code, $id);\n}", "function forget_send_code($mobile) {\n\t\t$varifycode = rand('10000000', '99999999');\n\t\t//$code = 1234;\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$mobileNumber = substr($mobile, 1);\n\t\t$msg = \"New Password of Recharge login : \" . $code;\n\t\t$encodedMessage = urlencode($msg);\n\t\t// $route = \"4\";\n\t\t// $authKey = \"109829ANu1kqLdg570b4e25\";\n\t\t// $senderId = \"Recharge\";\n\t\t// $postData = array(\n\t\t// 'authkey' => $authKey,\n\t\t// 'mobiles' => $mobileNumber,\n\t\t// 'message' => $encodedMessage,\n\t\t// 'sender' => $senderId,\n\t\t// 'route' => $route\n\t\t// );\n\t\t//$url=\"http://api.msg91.com/api/sendhttp.php\";\n\t\t$url = \"http://www.kudisms.net/components/com_spc/smsapi.php?username=smerp&password=abhishek&sender=kudisms&recipient='\" . $mobile . \"'&message=\" . $encodedMessage;\n\t\t$ch = curl_init();\n\t\tcurl_setopt_array($ch, array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData, CURLOPT_FOLLOWLOCATION => true));\n\t\t//\n\t\t//\n\t\t// //Ignore SSL certificate verification\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n\t\t//\n\t\t//\n\t\t// //get response\n\t\t$output = curl_exec($ch);\n\t\t//\n\t\t// if (curl_errno($ch)) {\n\t\t// $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n\t\t// echo json_encode($result);\n\t\t// exit();\n\t\t// // // //\n\t\t// }\n\t\tcurl_close($ch);\n\t\treturn $code;\n\t}", "function verify_appota_user($appota_access_token, $appota_userid, $appota_username) {\n $url = sprintf('https://api.appota.com/game/get_user_info?access_token=%s', $appota_access_token);\n $result = call_curl_get($url, null);\n return ($result[\"error_code\"] == 0 and $result[\"data\"][\"username\"] == $appota_username and $result[\"data\"][\"user_id\"]);\n}", "function send_auth_code_at_login($user)\n{\n\t$user_info = get_userdata($user);\n\t\n\t$user_login = $user_info->data->user_login;\n\n\t$user_email = $user_info->data->user_email;\t\n\n\t$user_name = $user_info->data->first_name;\t\n\n\t$user_phone = get_user_meta( $user, 'user_phone', true );\n\t//$user_phone = urldecode($u_phone);\n\n\t$user_fname = get_user_meta( $user, 'first_name', true );\n\n\t$code = get_user_meta( $user, 'has_to_be_activated', true );\n\n\t$subject = 'Your New Authentication Code';\n\n\n\t$message1 = \"<html><body style='background:#f3f3f3;padding:20px 0;'><table border='0' cellpadding='0' cellspacing='0' style='margin:auto; max-width: 520px;width:100%;font-family: Arial;padding:20px;background:#fff;'><tbody>\";\n\t$message1 .=\"<tr><td style='font-size: 16px;'>Hello \".ucfirst($user_fname).\",</td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Welcome to Raise it Fast!</td></tr><tr height=30></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Please use this code to authenticate your account with Raise it Fast. <span style='background: #aaaaaa none repeat scroll 0 0;height: 45px;text-align: center;width: 101px;'>\".$code.\"</span></td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>'If you have any questions or concerns don't hesitate to use our website chat function, call us, or email us by going to our help page at \".site_url('/contact-us/').\" Or, you can simply reply to this email. '</td></tr><tr height=30></tr>\"; \n\t$message1 .=\"<tr><td style='font-size: 16px; margin-top: 20px;'>Thanks for becoming a part of the Raise It Fast community! </td></tr></tbody></table><table border='0' cellpadding='0' cellspacing='0' style='margin:20px auto 0; max-width: 520px;width:100%;'>\"; \n\n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'>1401 Lavaca St #503, Austin, TX 78701</td></tr><tr height=20></tr>\"; \n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'><a href=\".site_url().\" style='text-decoration:none; color: #999999;'>The Raise it Fast Team</a></td></tr>\"; \n\t$message1 .=\"</table></body></html>\";\n\n\twp_mail($user_email, $subject, $message1);\n\n//=========Send Auth Code Via Text message ==================//\n\n\t$account_sid = get_option('twilio_account_sid'); \n\t$auth_token = get_option('twilio_auth_token'); \n //require('lib/twilio-php-latest/Services/Twilio.php');\n\t$client = new Services_Twilio($account_sid, $auth_token); \n //$from = '+12182265630'; \n\t$from = get_option('twilio_phone_no');\n\n\ttry\n\t{\n\t\t$client->account->messages->sendMessage( $from, $user_phone, \"Hello $user_fname, Your Authentication code is $code\");\n\t}\n\tcatch (Exception $e)\n\t{ \n\n\t\techo \"11-\";\n\t}\n}", "public function check_authorization_response(){\n if(!isset($_SESSION))\n session_start();\n\n // no LINE_CRSF is set in session\n if(!isset($_SESSION['LINE_CRSF']))\n throw new Exception('Fail to check CRSF token');\n\n // CRSF token not match\n $state = isset($_GET['state']) ? $_GET['state'] : null;\n // equalty check can be rewrite with hash_equals()\n if($_SESSION['LINE_CRSF'] !== $state)\n throw new Exception('CRSF token not match');\n\n unset($_SESSION['LINE_CRSF']);\n\n // user denies the premissions requested\n // NOTICE:\n // LINE server redirect user who does not have\n // developer role with following error (in GET data)\n // error=access_denied\n // error_description=The+authorization+server+denied+the+request.+This+channel+is+now+developing+status.+User+need+to+have+developer+role\n // To solve this, go to your LINE Login channel then\n // click the Developing label on the top right to proceed\n // publish your channel\n if(isset($_GET['error'])){\n throw new Exception(json_encode(array(\n 'error' => $_GET['error'],\n 'error_description' => $_GET['error_description'],\n )));\n }\n\n $this->authorization_code = $_GET['code'];\n return $this->authorization_code;\n }", "public function verifikasi_password($address, $code) {\n\n $this->db->select('regTime');\n\n $this->db->from('tb_siswa');\n\n $this->db->where('email', $address);\n\n $this->db->limit(1);\n\n $result = $this->db->get();\n\n $row = $result->row();\n\n\n\n if ($result->num_rows() === 1) {\n\n if (md5((string) $row->regTime) === $code) {\n\n $this->session->set_userdata('reset_email', $address);\n\n $this->session->set_userdata('reset_password', '1');\n\n redirect(base_url('login'));\n\n } else {\n\n redirect(base_url('login'));\n }\n\n } else {\n\n redirect(base_url('login'));\n\n }\n\n }", "public function Mobile_check($phone_no)\n\t{\n\t\t$sql = \"SELECT * FROM login_users WHERE phone_no ='\".$phone_no.\"' AND user_type = '4' AND status='Active'\";\n\t\t$user_result = $this->db->query($sql);\n\t\t$ress = $user_result->result();\n\n\t\t$digits = 4;\n\t\t$OTP = str_pad(rand(0, pow(10, $digits)-1), $digits, '0', STR_PAD_LEFT);\n\n\t\tif($user_result->num_rows()>0)\n\t\t{\n\t\t\tforeach ($user_result->result() as $rows)\n\t\t\t{\n\t\t\t\t $user_master_id = $rows->id;\n\t\t\t}\n\n\t\t\t$update_sql = \"UPDATE login_users SET otp = '\".$OTP.\"', updated_at=NOW() WHERE id ='\".$user_master_id.\"'\";\n\t\t\t$update_result = $this->db->query($update_sql);\n\n\t\t\t$message_details = \"Dear Customer your OTP :\".$OTP;\n\t\t\t$this->sendSMS($phone_no,$message_details);\n\t\t\t$response = array(\"status\" => \"success\", \"msg\" => \"Mobile OTP\", \"user_master_id\"=>$user_master_id, \"phone_no\"=>$phone_no, \"otp\"=>$OTP);\n\n\t\t} else {\n\t\t\t $response = array(\"status\" => \"error\", \"msg\" => \"Invalid login\");\n\t\t}\n\n\t\treturn $response;\n\t}", "function verify_telephone()\n\t{\n\t\tlog_message('debug', 'Account/verify_telephone');\n\t\t$data = filter_forwarded_data($this);\n\t\tlog_message('debug', 'Account/verify_telephone:: [1] post='.json_encode($_POST));\n\n\t\tif(!empty($_POST)){\n\t\t\t$result = FALSE;\n\t\t\t$data['msg'] = '';\n\t\t\t$data['hasPosted'] = 'Y';\n\n\t\t\t# a) Is user updating their phone details?\n\t\t\tif(!empty($_POST['telephone'])){\n\t\t\t\t# Add or update phone and send verification code\n\t\t\t\t$response = $this->_api->post('user/telephone', array(\n\t\t\t\t\t'telephone'=>$_POST['telephone'],\n\t\t\t\t\t'provider'=>$_POST['provider__provider'],\n\t\t\t\t\t'isPrimary'=>'Y'\n\t\t\t\t));\n\n\t\t\t\t# Update the user telephone and provider if sucessful\n\t\t\t\tif(!empty($response['result']) && $response['result']=='SUCCESS'){\n\t\t\t\t\t$data['msg'] .= $this->native_session->get('__telephone') != $_POST['telephone']? 'Your phone number has been updated and a': 'A';\n\t\t\t\t\t$data['msg'] .= ' code has been sent for verification';\n\t\t\t\t\t$this->native_session->set('__telephone', $_POST['telephone']);\n\t\t\t\t\t$this->native_session->set('__provider', $response['provider']);\n\t\t\t\t\t$this->native_session->set('__provider_id', $_POST['provider__provider']);\n\t\t\t\t\t$result = TRUE;\n\t\t\t\t\t$data['area'] = 'verify_code_form';\n\t\t\t\t}\n\t\t\t\telse $data['msg'] .= 'ERROR: Your phone number could not be updated or code sent.';\n\t\t\t}\n\n\t\t\t# b) Verify telephone code\n\t\t\telse if(!empty($_POST['usercode'])){\n\t\t\t\t$response = $this->_api->post('account/verify', array(\n\t\t\t\t\t'code'=>$_POST['usercode'],\n\t\t\t\t\t'telephone'=>$this->native_session->get('__telephone'),\n\t\t\t\t\t'baseLink'=>base_url()\n\t\t\t\t));\n\n\t\t\t\tif(!empty($response['verified']) && $response['verified']=='Y'){\n\t\t\t\t\t$this->native_session->set('__telephone_verified', 'Y');\n\t\t\t\t\t$data['msg'] = '20 Points have been added to your Clout Score';\n\t\t\t\t\t$data['area'] = 'verify_code_results';\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$data['msg'] = 'ERROR: Your phone could not be verified.<br>Please try again.';\n\t\t\t\t\t$data['area'] = 'verify_code_form';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$data['area'] = !empty($data['area'])? $data['area']: 'user_phone_details';\n\t\t$this->load->view('account/verify_phone', $data);\n\t}", "public function verify_otp_get($email=null,$otp=null){\n\t\tif(!empty($email) && !empty($otp)){\n\t\t\t$q = $this->db->where('email',$email)->where('verification_code',$otp)->get('users')->result();\n\t\t\tif(count($q)>0){\n\t\t\t\t$this->response(['Correct'], REST_Controller::HTTP_OK);\n\t\t\t}else{\n\t\t\t\t$this->response(['Invaild Email or OTP.'], '500');\n\t\t\t}\n\t\t}else{\n\t\t\t$this->response(['Too few arguments'], '500');\n\t\t}\n\t}", "function password_change_login($email, $password, $verification_code) {\n\t\tglobal $pdo;\n\n\t\t//empty or array check\n\t\tif(empty($email) || is_array($email) || empty($password) || is_array($password) || empty($verification_code) || is_array($verification_code)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t//check if user exists\n\t\t$sql = \"SELECT id FROM user WHERE verification_code = :verification_code AND REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 1 AND TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, code_generation_time)) <= 600\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindParam(\":verification_code\", $verification_code, PDO::PARAM_STR);\n\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t$sth->execute();\n\n\t\tif($sth->rowCount() == 0) {\n\t\t\treturn 2;\n\t\t}\n\n\t\t//check if password meet our requirements\n\t\tif(!password_security_check($password)) {\n\t\t\treturn 3;\n\t\t}\n\n\t\t//hash password\n\t\t$password_hash = password_hash($password, PASSWORD_BCRYPT);\n\t\t//get id\n\t\t$id = $sth->fetch()[\"id\"];\n\n\t\t//change password\n\t\t$sql = \"UPDATE user SET verification_code = NULL, code_generation_time = NULL, password = :password_hash WHERE id = :id\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindParam(\":password_hash\", $password_hash, PDO::PARAM_STR);\n\t\t$sth->bindParam(\":id\", $id, PDO::PARAM_INT);\n\t\t$sth->execute();\n\t\treturn 0;\n\t}", "public function verifyToken($userType,$token,$id,$action){\n $resp = false;\n /*if action is type reset*/\n if($action == 'reset'){\n /*validate user type*/\n if($userType == 'user')\n $sql = \"SELECT token FROM Users WHERE email = :id AND (status = '1' AND validate = '1')\"; //create sentence\n else if($userType == 'teacher')\n $sql = \"SELECT token FROM Teachers WHERE email = :id AND status = '1' AND validate = '1'\"; //create sentence\n }\n /*If action is type validate*/\n else if($action == 'activate'){\n /*validate user type*/\n if($userType == 'user')\n $sql = \"SELECT token FROM Users WHERE email = :id AND status = '1' AND validate = '0'\"; //create sentence\n else if($userType == 'teacher')\n $sql = \"SELECT token FROM Teachers WHERE email = :id AND status = '1' AND validate = '0'\"; //create sentence\n }\n $stmt = $this->connect()->prepare($sql); //prepare sentence\n $stmt->bindParam(':id',$id); //add params\n $stmt->execute(); //execute sentence\n /*If email exists*/\n if($stmt->rowCount() > 0){\n $tokendb = $stmt->fetchColumn(); //Get token from consult\n /*Validate token*/\n if($tokendb == '_token$'.$token)\n $resp = true;\n }\n $this->closeConnection(); //close conection\n return json_encode($resp); // convert to json and return this\n }", "public function update_verify_otp(){\n\n // user user-id from session\n $encodedkey = $this->session->userdata('PariKey_session');\n $user_id='';\n $key=base64_decode($encodedkey);\n $keyarr=explode('|', $key);\n //session key format is $keyarr[0]=PARInaayKEY|$keyarr[1]=email_id|$keyarr[2]=user_id\n\n extract($_POST);\n \n // validation\n if(empty($otp_code)){\n $response=array(\n 'status' => 'validation',\n 'message' => '<b>Warning:</b> OTP Code is required!',\n 'field' => 'otp_code'\n );\n echo json_encode($response);\n die();\n }\n $result = $this->user_model->verify_otp($otp_code,$keyarr[2]);\n\n echo json_encode($result);\n}", "public function CheckActivationCode($code){\n $this->db->where('activation_code',$code);\n $query = $this->db->get('users'); \n if ($query->num_rows() > 0)\n { \n return true;\n }\n else\n { \n return false;\n }\n }", "function check_hash($userid,$hash,$code,$pretest)\n {\n $this->stmt = $this->db->count('activation');\n // set where values\n $this->stmt->where('userid','i',$userid);\n\t\t$this->stmt->where('hash','i',$hash);\n\t\tif((int)$pretest > 0){\n\t\t\t$this->stmt->where('code','i',$code);\n\t\t}\n\t\treturn parent::get();\n }", "public function getTwoStepVerificationCode();", "public function check(string $exam_code)\n {\n $request_data = explode(sprintf(\".%s.\", date(\"d\")), $exam_code);\n\n // the size must be 2: [0] is the user id, [1] the exam_id\n if (sizeof($request_data) == 2) {\n\n $user_id = intval($request_data[0]);\n $exam_id = intval($request_data[1]);\n\n // both user_id and exam_id must be valid integer (> 0)\n if ($exam_id && $user_id) {\n\n // now check if there is an exam for that user\n\n $exam = Exam::where(['user_id' => $user_id, 'id' => $exam_id])->first();\n\n // if there is an exam, the return the result\n if ($exam) {\n\n // if the user finished the exam, then return the result\n if ($exam->started && !is_null($exam->finished_at)) {\n\n $response_data = [\n 'percentage_obtained' => $exam->percentage_obtained,\n 'percentage_required' => $exam->percentage_required,\n 'passed' => $exam->passed,\n 'status' => true\n ];\n\n return response()->json($response_data, 200);\n\n } else {\n\n $response_data = [\n 'status' => false // the exam has not yet started or not yet finished\n ];\n\n return response()->json($response_data, 200);\n }\n\n }\n\n }\n }\n\n return response()->json(null, 404);\n }", "function wp_auth_check($response)\n {\n }", "function verify_mobile_number() {\n\n\t\t//$iAccountNo = safeText('account_no', FALSE, 'get');\n\n\t\t$this->authentication->is_user_logged_in(TRUE, 'user/login');\n\n\t\t$this->mcontents['iAccountNo'] = s('ACCOUNT_NO');\n\n\n\t\t$aWhere = array(\n\t\t\t\t\t\t'status' => $this->aUserStatus['active'],\n\t\t\t\t\t);\n\t\tif( ! $oUser = $this->user_model->getUserBy('account_no', $this->mcontents['iAccountNo'], 'basic', $aWhere) ) {\n\t\t\t/*\n\t\t\tp($this->mcontents['iAccountNo']);\n\t\t\tp($oUser);\n\t\t\texit;\n\t\t\t*/\n\t\t\tsf('error_message', 'You cannot access this section right now');\n\t\t\tredirect('home');\n\t\t}\n\n\n\t\t/* Temporary set up to skip mobile number verification step */\n\t\t\t$bSkipMobileNumberVerification = FALSE;\n\n\t\t\tif($bSkipMobileNumberVerification) {\n\t\t\t\t$this->user_model->skipMobileNumberVerification($oUser->account_no);\n\t\t\t}\n\t\t/* Temporary set up to skip mobile number verification step - End */\n\n\n\n\t\t$bIsAccountAwaitingMobileNumVerification = $this->user_model->isAccountAwaitingMobileNumVerification( $oUser->account_no );\n\t\t//$bIsAccountAwaitingMobileNumVerification = TRUE; // to be removed if not useful\n\n\n\t\tif( ! $oUser ) {\n\n\t\t\tsf('error_message', 'The link you are trying to access does not exist.');\n\t\t\tredirect('home');\n\t\t}\n\t\tif( ! $bIsAccountAwaitingMobileNumVerification ) {\n\n\t\t\t//sf('error_message', 'The link you are trying to access does not exist.');\n\t\t\tredirect('user/manage_mobile_number');\n\t\t}\n\n\n\n\t\tif( isset($_POST) && !empty($_POST) ) {\n\n\t\t\t$this->form_validation->set_rules('verification_code', 'Verification code', 'trim|required');\n\n\t\t\tif ($this->form_validation->run() == TRUE) {\n\n\t\t\t\t$sToken = safeText('verification_code');\n\n\t\t\t\t$aTokenResult = $this->common_model->isValidToken_new($sToken, 'mobile_number_verification', $oUser->account_no);\n\n\t\t\t\t$aTokenStatus = c('token_status');\n\n\t\t\t\tif( $aTokenResult['status'] != $aTokenStatus['valid'] ) {\n\n\t\t\t\t\t//find the reason why this token is not valid\n\t\t\t\t\tif( $aTokenResult['status'] == $aTokenStatus['invalid'] ) {\n\n\t\t\t\t\t\t$iAttempts = 0;\n\t\t\t\t\t\t$iMaxAttempts = 3;\n\n\t\t\t\t\t\tif($iAttempts >= $iMaxAttempts) {\n\n\t\t\t\t\t\t\t$this->user_model->unsetMobileNumVerificationCode($aTokenResult['oToken']);\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t$this->merror['error'][] = 'the code entered is invalid code.';\n\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t} elseif($aTokenResult['status'] == $aTokenStatus['expired']) {\n\n\t\t\t\t\t\t$this->user_model->unsetMobileNumVerificationCode($aTokenResult['oToken']);\n\n\t\t\t\t\t\tsf('error_message', 'The token you entered has expired.');\n\t\t\t\t\t\tredirect('user/verify_mobile_number');\n\t\t\t\t\t}\n\n\n\t\t\t\t} else {\n\n\t\t\t\t\t$this->user_model->unsetMobileNumVerificationCode($aTokenResult['oToken']);\n\n\n\t\t\t\t\t$aUserMobileVerificationStatus = $this->config->item('user_mobile_verification_status');\n\n\t\t\t\t\t// set the mobile number as verified\n\t\t\t\t\t$this->db->set('mobile_verification_status', $aUserMobileVerificationStatus['sms_verified']);\n\t\t\t\t\t$this->db->where('account_no', $oUser->account_no);\n\t\t\t\t\t$this->db->update('users');\n\n\t\t\t\t\tsf('success_message', 'Your mobile number has been verified');\n\n\t\t\t\t\t// do the initial setup routines check to see if the user passes it.\n\t\t\t\t\t$this->user_model->initialSetupRoutines($oUser->account_no);\n\n\t\t\t\t\tredirect('profile/edit');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tloadTemplate('user/verify_mobile_number');\n\t}", "function forget_send_code($mobile){\n\t\t$varifycode = rand('10000000', '99999999');\n\t\t//$code = 1234;\n\t\t $code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t $mobileNumber = substr($mobile, 1);\n\t\t $msg = \"New Password of Recharge login : \" . $code;\n $encodedMessage = urlencode($msg);\n $route = \"4\";\n $authKey = \"109829ANu1kqLdg570b4e25\";\n $senderId = \"Recharge\";\n $postData = array(\n 'authkey' => $authKey,\n 'mobiles' => $mobileNumber,\n 'message' => $encodedMessage,\n 'sender' => $senderId,\n 'route' => $route\n);\n $url=\"http://api.msg91.com/api/sendhttp.php\";\n $ch = curl_init();\ncurl_setopt_array($ch, array(\n CURLOPT_URL => $url,\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_POSTFIELDS => $postData\n ,CURLOPT_FOLLOWLOCATION => true\n));\n// \n// \n// //Ignore SSL certificate verification\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n// \n// \n// //get response\n $output = curl_exec($ch);\n// \n // if (curl_errno($ch)) {\n\t // $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n // echo json_encode($result);\n\t\t\t // exit();\n// // // // \n\t\t // }\n curl_close($ch);\n\t\treturn $code;\n\t}", "public function otpverification()\n\t{\t\n\t\tif($this->session->userdata('VB_USER_ID') <> ''):\n\t\t\tredirect(base_url().'my-profile');\n\t\tendif;\n\t\t$data['error'] \t\t\t\t\t\t= \t'';\n\t\t$data['formError'] \t\t\t\t\t=\t''; \t\n\n\t\tif($this->input->post('verifyotp')):\n\t\t\t\t$userData\t\t=\t$this->common_model->checkOTP(trim($this->session->userdata('VB_REGISTER_MOBILE')),trim($this->input->post('verifyotp')),'users','user_phone_otp');\n\t\t\t\tif($userData <> \"\"): \n\t\t\t\t\tif($userData['status'] == 'I'):\n\t\t\t\t\t\t$param['user_phone_verify']\t=\t'Y';\n\t\t\t\t\t\t$param['user_phone_otp']\t=\t'';\n\t\t\t\t\t\t$param['status']\t\t\t=\t'A';\n\t\t\t\t\t\t$this->common_model->editData('vb_users',$param,'user_id',$userData['user_id']);\n\t\t\t\t\t\t\n\t\t\t\t\t\t$this->session->unset_userdata('VB_REGISTER_MOBILE');\n\t\t\t\t\t\tsetcookie('VB_USER_LOGIN_TOKEN',$loginParam['user_token'],time()+60*60*24*100,'/');\n\t\t\t\t\t\t$this->session->set_userdata(array(\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_LOGGED_IN'\t\t=>\ttrue,\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_ID'\t\t\t=>\t$userData['user_id'],\n\t\t\t\t\t\t\t\t\t\t\t'VB_FULL_NAME'\t\t\t=>\t$userData['full_name'],\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_EMAIL'\t\t\t=>\t$userData['user_email'],\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_MOBILE'\t\t=>\t$userData['mobile_number'],\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_TYPE_ID'\t\t=>\t$userData['usertype_id'],\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_TYPE_NAME'\t\t=>\t$userData['usertype_name'],\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_CURRENT_PATH'\t=>\t$currentPath));\n\t\t\t\t\t\techo \"success\";die;\n\t\t\t\t\telseif($userData['status'] == 'B'):\n\t\t\t\t\t\techo \"blocked\";die;\n\t\t\t\t\telseif($userData['status'] == 'A'):\n\t\t\t\t\t\techo \"active\";die;\n\t\t\t\t\tendif;\n\t\t\t\telse:\n\t\t\t\t\techo \"wrongotp\";die;\n\t\t\t\tendif;\n\t\tendif;\n\t\t\n\t\t$this->layouts->set_title(stripcslashes('OTP Verification | VBloggers'));\n\t\t$this->layouts->set_keyword(stripcslashes('OTP Verification | VBloggers'));\n\t\t$this->layouts->set_description(stripcslashes('OTP Verification | VBloggers'));\n\t\t\n\t\t$this->layouts->login_view('user/otpverification',array(),$data);\n\t}", "public function select_user_current_otp($data)\n {\n //otp entered while forgot password request\n if($data['action']=='forgotpassword')\n {\n foreach($data as $key=>$val) $$key=get_magic_quotes_gpc()?$val:addslashes($val);\n if($email != '')\n {\n $query = new Query;\n $count = $query->select('COUNT(*) as count')->from('core_users')->where(\"email = '$email'\")->andWhere(\"otp_code = '$otp'\")->All();\n if($count[0]['count']>0)\n {\n \n $query = Yii::$app->db;\n $query->createCommand()->update('core_users', ['user_status' => \"2\"], \"email = '$email'\")->execute();\n return true;\n }\n else\n return false;\n \n }\n else if($phone != '')\n {\n $query = new Query;\n $count = $query->select('COUNT(*) as count')->from('core_users')->where(\"phone_number = '$phone'\")->andWhere(\"otp_code = '$otp'\")->All();\n if($count[0]['count']>0)\n {\n $query = Yii::$app->db;\n $query->createCommand()->update('core_users', ['user_status' => \"2\"], \"phone_number = '$phone'\")->execute();\n Yii::$app->user->login(User::findByUserphone($phone));\n Usersessions::insert_user_session();\n return true;\n }\n else\n return false;\n\n }\n return false;\n }\n //otp entered while registration or login.\n else {\n foreach($data as $key=>$val) $$key=get_magic_quotes_gpc()?$val:addslashes($val);\n\n $query = new Query;\n $count = $query->select('COUNT(*) as count')->from('core_users')->where(\"email = '$email'\")->andWhere(\"otp_code = '$otp'\")->All();\n if($count[0]['count']>0)\n {\n $query = Yii::$app->db;\n $query->createCommand()->update('core_users', ['user_status' => \"2\"], \"email = '$email'\")->execute();\n Yii::$app->user->login(User::findByUseremail($email));\n Usersessions::insert_user_session();\n return true;\n }\n else\n {\n return false;\n }\n }\n }", "function validateCredential(){\r\n\r\n\t\t$avsData = array('Street' => '1 Main St', 'City' => 'San Jose', 'PostalCode' => '95131');\r\n\t\t$cardData = array('cardowner' => 'Jane Doe', 'cardtype' => 'Visa', 'pan' => '4012888812348882', 'expire' => '1218', 'cvv' => '123');\r\n\t\t\r\n\t\ttry {\r\n\t\t\t$obj_transaction = new VelocityProcessor( $this->applicationprofileid, $this->merchantprofileid, $this->workflowid, $this->isTestAccount, $this->identitytoken, null);\r\n\t\t\treturn array('status'=>1,'message'=>'Authentication Validated Successfully.');\r\n\t\t\t/* try {\r\n\t\t\t\t$response = $obj_transaction->verify(array(\r\n\t\t\t\t\t\t'amount' => 1.00,\r\n\t\t\t\t\t\t'avsdata' => $avsData,\r\n\t\t\t\t\t\t'carddata' => $cardData,\r\n\t\t\t\t\t\t'entry_mode' => 'Keyed',\r\n\t\t\t\t\t\t'IndustryType' => $this->IndustryType,\r\n\t\t\t\t\t\t'Reference' => 'Ezneterp',\r\n\t\t\t\t\t\t'EmployeeId' => '11'\r\n\t\t\t\t));\r\n\t\t\t\t\r\n\t\t\t\tif (is_array($response) && isset($response['Status']) && $response['Status'] == 'Successful') \r\n\t\t\t\t\treturn array('status'=>1,'message'=>'Authentication Validated Successfully.');\r\n\t\t\t\telse\r\n\t\t\t\t\treturn array('status'=>0,'errors'=>$response);\r\n\t\t\t\t\r\n\t\t\t} catch (Exception $e) {\r\n\t\t\t\treturn array('status'=>0,'errors'=>$e->getMessage());\r\n\t\t\t} */\r\n\t\t\t\r\n\t\t\t\r\n\t\t} catch(Exception $e) {\r\n\t\t\tif(strcmp($e->getMessage(), 'An invalid security token was provided') == 0)\r\n\t\t\t\treturn array('status'=>0,'errors'=>'An invalid security token was provided');\r\n\t\t\telse\r\n\t\t\t\treturn array('status'=>0,'errors'=>$e->getMessage());\r\n\t\t}\r\n\t}", "protected function verifyCode($args) {\n\n if ($args['ent_coupon'] == '' || $args['ent_lat'] == '' || $args['ent_long'] == '')\n return $this->_getStatusMessage(1, $args);\n\n $checkCouponQry = \"select cp.id from coupons cp where cp.coupon_code = '\" . $args['ent_coupon'] . \"' and cp.coupon_type = 1 and cp.user_type = 1 and cp.status = 0 and cp.expiry_date > '\" . date('Y-m-d', time()) . \"'\"; // and cp.city_id in (select ca.City_Id from city_available ca where (3956 * acos( cos( radians('\" . $args['ent_lat'] . \"') ) * cos( radians(ca.City_Lat) ) * cos( radians(ca.City_Long) - radians('\" . $args['ent_long'] . \"') ) + sin( radians('\" . $args['ent_lat'] . \"') ) * sin( radians(ca.City_Lat) ) ) ) <= \" . $this->promoCodeRadius . \") limit 0,1\";\n if (mysql_num_rows(mysql_query($checkCouponQry, $this->db->conn)) > 0) {\n return $this->_getStatusMessage(101, $checkCouponQry);\n } else {\n return $this->_getStatusMessage(100, $checkCouponQry);\n }\n }", "function validate_acctno($acctno,$bankcode){\n global $secret_key;\n\n //$bankcode parameter is the selection on the chat builder\n\n ///check bankcode selection to get real bankcode\n // $get_real_bank_code = get_bank_name($bankcode);\n // $bankcode_dec = json_decode($get_real_bank_code,true);\n // if($bankcode_dec['status'] != 111){\n \n // return json_encode(array( \"status\"=>100, \"msg\"=>\"wrong bank code option entered\" )); \n\n // }else{\n \n // $real_bank_code = $bankcode_dec['bankcode'];\n // }\n ///check bankcode selection to get real bankcode\n\n\n\n\n $count = strlen((string) $acctno);\n\n if(is_numeric($acctno)){\n if($count == 10){\n //return json_encode(array( \"status\"=>111, \"msg\"=>\"valid\" )); \n ///now check if this account number actually exists\n $curl = curl_init();\n\n curl_setopt_array($curl, array(\n CURLOPT_URL => \"https://api.paystack.co/bank/resolve?account_number=\".$acctno.\"&bank_code=\".$bankcode.\"\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 0,\n CURLOPT_FOLLOWLOCATION => true,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => array(\n \"Authorization: Bearer \".$secret_key\n ),\n ));\n\n $response = curl_exec($curl);\n\n curl_close($curl); \n\n //return $response;\n $decode_response = json_decode($response,true);\n \n if($decode_response['status'] == true){\n return json_encode(array( \"status\"=>111, \"msg\"=>$decode_response['data'] ));\n\n }else{\n return json_encode(array( \"status\"=>100, \"msg\"=>$decode_response['message'] ));\n\n }\n\n }else{\n \n return json_encode(array( \"status\"=>102, \"msg\"=>\"account number should have 10 digits, kindly check and try again\" )); \n\n }\n\n \n\n }else{\n return json_encode(array( \"status\"=>100, \"msg\"=>\"Sorry, kindly enter a valid account number\" ));\n }\n\n}", "static function getWaitVerifyMobile($usr){\r\n\t\tif(strlen(trim($usr)) > 0){\r\n\t\t\t$no = funcs::checkMobileVerify($usr);\r\n\t\t\treturn $no;\r\n\t\t}\r\n\t\telse{\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}", "function send_code($mobile_no) {\n\n\t\t$varifycode = rand('1000', '9999');\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$code = 1234;\n\t\t// $mobileNumber = substr($mobile_no, 1);\n\t\t// $msg = \"Recharge Verification Code : \" . $code;\n // $encodedMessage = urlencode($msg);\n // $route = \"4\";\n // $authKey = \"109829ANu1kqLdg570b4e25\";\n // $senderId = \"Recharge\";\n // $postData = array(\n // 'authkey' => $authKey,\n // 'mobiles' => $mobileNumber,\n // 'message' => $encodedMessage,\n // 'sender' => $senderId,\n // 'route' => $route\n// );\n// $url=\"http://api.msg91.com/api/sendhttp.php\";\n // $ch = curl_init();\n// curl_setopt_array($ch, array(\n // CURLOPT_URL => $url,\n // CURLOPT_RETURNTRANSFER => true,\n // CURLOPT_POST => true,\n // CURLOPT_POSTFIELDS => $postData\n // //,CURLOPT_FOLLOWLOCATION => true\n// ));\n// \n// \n// //Ignore SSL certificate verification\n// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n// \n// \n// //get response\n// $output = curl_exec($ch);\n// \n // if (curl_errno($ch)) {\n\t // $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n // echo json_encode($result);\n\t\t\t // exit();\n// // // // \n\t\t // }\n // curl_close($ch);\nreturn $code;\n\t\t//echo $output;\n\t}", "public function vxLoginCheck() {\n\t\t$rt = array();\n\t\t\n\t\t$rt['target'] = 'welcome';\n\t\t$rt['return'] = '';\n\t\t\n\t\t$rt['errors'] = 0;\n\t\t\n\t\t$rt['usr_value'] = '';\n\t\t$rt['usr_email_value'] = '';\n\t\t/* usr_error:\n\t\t0 => no error\n\t\t1 => empty\n\t\t999 => unspecific */\n\t\t$rt['usr_error'] = 0;\n\t\t$rt['usr_error_msg'] = array(1 => '你忘记填写名字了');\n\t\t\n\t\t$rt['usr_password_value'] = '';\n\t\t/* usr_password_error:\n\t\t0 => no error\n\t\t1 => empty\n\t\t2 => mismatch\n\t\t999 => unspecific */\n\t\t$rt['usr_password_error'] = 0;\n\t\t$rt['usr_password_error_msg'] = array(1 => '你忘记填写密码了', 2 => '名字或者密码有错误');\n\n\t\tif (isset($_POST['return'])) {\n\t\t\t$rt['return'] = trim($_POST['return']);\n\t\t}\n\t\t\n\t\tif (isset($_POST['usr'])) {\n\t\t\t$rt['usr_value'] = strtolower(make_single_safe($_POST['usr']));\n\t\t\tif (strlen($rt['usr_value']) == 0) {\n\t\t\t\t$rt['usr_error'] = 1;\n\t\t\t\t$rt['errors']++;\n\t\t\t}\n\t\t} else {\n\t\t\t$rt['usr_error'] = 1;\n\t\t\t$rt['errors']++;\n\t\t}\n\t\t\n\t\tif ($rt['errors'] > 0) {\n\t\t\t$rt['target'] = 'error';\n\t\t\treturn $rt;\n\t\t}\n\t\t\n\t\tif (isset($_POST['usr_password'])) {\n\t\t\t$rt['usr_password_value'] = make_single_safe($_POST['usr_password']);\n\t\t\tif (strlen($rt['usr_password_value']) == 0) {\n\t\t\t\t$rt['usr_password_error'] = 1;\n\t\t\t\t$rt['errors']++;\n\t\t\t}\n\t\t} else {\n\t\t\t$rt['usr_password_error'] = 1;\n\t\t\t$rt['errors']++;\n\t\t}\n\t\t\n\t\tif ($rt['errors'] > 0) {\n\t\t\t$rt['target'] = 'error';\n\t\t\treturn $rt;\n\t\t}\n\t\t\n\t\t$sql = \"SELECT usr_id FROM babel_user WHERE usr_email = '\" . $rt['usr_value'] . \"' AND usr_password = '\" . sha1($rt['usr_password_value']) . \"'\";\n\t\t$rs = mysql_query($sql, $this->db);\n\t\tif (mysql_num_rows($rs) == 1) {\n\t\t\t$rt['usr_email_value'] = $rt['usr_value'];\n\t\t\t$rt['target'] = 'ok';\n\t\t} else {\n\t\t\t$sql = \"SELECT usr_id, usr_email FROM babel_user WHERE usr_nick = '\" . $rt['usr_value'] . \"' AND usr_password = '\" . sha1($rt['usr_password_value']) . \"'\";\n\t\t\t$rs = mysql_query($sql, $this->db);\n\t\t\tif (mysql_num_rows($rs) == 1) {\n\t\t\t\t$O = mysql_fetch_object($rs);\n\t\t\t\t$rt['usr_email_value'] = $O->usr_email;\n\t\t\t\t$rt['target'] = 'ok';\n\t\t\t} else {\n\t\t\t\t$rt['target'] = 'error';\n\t\t\t\t$rt['usr_password_error'] = 2;\n\t\t\t\t$rt['errors']++;\n\t\t\t}\n\t\t}\n\t\tmysql_free_result($rs);\n\t\t\n\t\treturn $rt;\n\t}", "function stub() {\r\n\t$a = array(\r\n\t\t'status' => 'system-error'\r\n\t);\r\n\r\n\t// raw inputs\r\n\t$taint_si = isset($_POST['si']) ? $_POST['si'] : 0;\r\n\t$taint_a = isset($_POST['a']) ? $_POST['a'] : 0;\r\n\t$taint_b = isset($_POST['b']) ? $_POST['b'] : 0;\r\n\r\n\t// validate inputs\r\n\t$si = validateToken($taint_si);\r\n\t$a = validateUname($taint_a);\r\n\t$b = validateUname($taint_b);\r\nLog::write(LOG_WARNING, \"$a,$b,$si\";\r\n\r\n\t// validate parameter set\r\n\tif (!$si || !$a || !$b){\r\n\t\tLog::write(LOG_WARNING, 'attempt with invalid parameter set');\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// get database connection\r\n\t$conn = getConnection();\r\n\tif (!$conn) {\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// get logged-in user\r\n\t$result = getUserByToken($conn, $si);\r\n\tif (!$result) {\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// get data fields\r\n\t$row = pg_fetch_array($result, 0, PGSQL_ASSOC);\r\n\t$username = $row['username'];\r\n\t$access = $row['access'];\r\n\t$auth = $row['auth'];\r\n\t$email = $row['email'];\r\n\r\n\t// verify user authentication state\r\n\tif (!isUserVerified($auth)) {\r\n\t\tLog::write(LOG_NOTICE, \"attempt by non-verified user\");\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// compose output message\r\n\t$message = \"a is $a and b is $b and email is \" . obscureEmail($email);\r\n\r\n\t// success\r\n\t$a['status'] = 'ok';\r\n\t$a['message'] = $message;\r\n\treturn $a;\r\n}", "public function getUserCode(){\n\t\t/* return user code */\n\t\treturn $this->_intUserCode;\n\t}", "function verifyToken() {\n $retVal = array(\"userid\"=>\"\",\"retState\"=>\"\");\n $headerarray = getallheaders();\n $authtoken = $headerarray[\"Authorization\"];\n\n //next we verity in the token table\n $tokenCheck = TokenQuery::create()->findOneByToken($authtoken);\n if($tokenCheck == \"\"){\n echo \"invalid token\";\n $retVal[\"retState\"] = false;\n }else{\n //check token expiration\n if($tokenCheck->getExpires()-time() > -1){\n echo \"token expired\";\n $retVal[\"retState\"] = false;\n }else{\n //lets get userid\n $retVal[\"userid\"] = $tokenCheck->getUserid();\n $retVal[\"retState\"] = true;\n }\n }\n return $retVal;\n}" ]
[ "0.66229653", "0.66124845", "0.6599462", "0.65965307", "0.65910935", "0.6551686", "0.6520834", "0.64820313", "0.6337884", "0.6298369", "0.62243575", "0.622435", "0.620291", "0.61889225", "0.6100215", "0.6006341", "0.59979546", "0.5992259", "0.5990905", "0.59638214", "0.5889765", "0.58876854", "0.5873436", "0.58620036", "0.58605295", "0.582169", "0.5786451", "0.57753783", "0.5775156", "0.57625675", "0.57601124", "0.57505417", "0.57442486", "0.57348573", "0.5731568", "0.571618", "0.5714928", "0.57141715", "0.5687131", "0.56849515", "0.565057", "0.5649545", "0.56490934", "0.5634245", "0.56330335", "0.56320864", "0.56075954", "0.55886275", "0.55886275", "0.5581849", "0.55724114", "0.55693513", "0.5559551", "0.5557365", "0.5535275", "0.5528097", "0.5526167", "0.5515809", "0.55118215", "0.5507947", "0.5505754", "0.54971313", "0.54962337", "0.54962337", "0.5494963", "0.5489471", "0.5489172", "0.5488897", "0.54875696", "0.54862005", "0.54816955", "0.548119", "0.54783195", "0.54753435", "0.5471742", "0.54652584", "0.5455456", "0.54501694", "0.5448167", "0.5446603", "0.5439725", "0.5431298", "0.5430232", "0.54255813", "0.5422493", "0.54219055", "0.54128593", "0.54021776", "0.5395734", "0.5378045", "0.5376537", "0.5370458", "0.5366717", "0.53626865", "0.5358497", "0.5358213", "0.535502", "0.53514993", "0.5341819", "0.53266346" ]
0.7295115
0
/desc:send authcode /input:arg(authcode,email,code_type) /output:email,return(errorcode(1success,0failed))
function send_authcode_email($authcode,$email,$code_type=0) { $this->load->library("mail"); $this->load->model('login/register_model'); $msg_head=$msg_end=$lang=$link=$stuid=''; if($this->_user_id) { $user_info=$this->register_model->get_user_info($this->_user_id); if($user_info['errorcode'] && $user_info['user']->student_id) { $stuid='您的学号是:'.$user_info['user']->student_id.'<br />'; } } switch($code_type) { case Constant::CODE_TYPE_REGISTER: $link="verify";$lang="verify";break; case Constant::CODE_TYPE_CHANGE_PASSWORD: $link="forgot/reset";$lang="reset";break; case Constant::CODE_TYPE_CHANGE_EMAIL: $link="verify";$lang="update_email";break; case Constant::CODE_TYPE_REGISTER_VERIFY_EMAIL: $link="verify";$lang="reg_reverify";break; case Constant::CODE_TYPE_LOGIN_VERIFY_EMAIL: $link="verify";$lang="login_reverify";break; default:break; } if($lang && $link) { //$authcode=site_url().$link."?code=".$authcode; $authcode=login_url().$link."/code/".$authcode; $subject=$this->lang->line('mail_subject_'.$lang); $msg_body=str_replace('{email}',$email,$this->lang->line('mail_body_'.$lang)); $msg_body=str_replace('{stuid}',$stuid,$this->lang->line('mail_body_'.$lang)); $msg_end=$this->lang->line('mail_end_'.$lang); } $msg=$msg_body.'<br /><a href="'.$authcode.'">'.$authcode.'</a><br />'.$msg_end.'<br/>'.$this->lang->line('mail_disclaimer'); $ret = Mail::send($email, $subject, $msg); if($ret['ret']==1) { $errorcode=true; log_message('info_tizi','170101:Email send success',$ret); } else { $errorcode=false; log_message('error_tizi','17010:Email send failed',$ret); } return array('errorcode'=>$errorcode,'send_error'=>implode(',',$ret)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function executeCommandAUTH(&$SMSGW, $argument = null)\n{\n $code = $SMSGW->getAndSaveAuthCode();\n\n if ($code > 9999 && $code < 100000)\n {\n return $SMSGW->sendMessage('Auth code: ' . $code);\n }\n else\n {\n $SMSGW->log(__FUNCTION__, 'Unable to save auth code to db or invalid code - ' . $code);\n return false;\n }\n}", "function generate_authcode_email($email,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER,$check=true)\n\t{\n\t\t$authcode=\"\";\n\t\tif($check) $errorcode=$this->check_authcode_email($email,$code_type,$user_id);\t\n\t\telse $errorcode=array('errorcode'=>false);\n\t\tif(!$errorcode['errorcode'])\n {\t\n $authcode=random_string('unique');\n $data=$this->bind_verify($user_id,$email,\"\",1,$code_type,$authcode,$user_type);\n\t\t\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode,json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_EMAIL);\n\t\t\t\t$this->save_check('email',$email,$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_EMAIL);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n \t\t$insert_id=$this->db->insert_id();\n \t\tif($insert_id>0) $errorcode=true;\n \t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170018:Gen email auth code',array('email'=>$email));\n\t\t\tif(!$errorcode) log_message('error_tizi','17018:Gen email auth code failed',array('email'=>$email));\t\t\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t}\n\t\treturn array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "function check_authcode_email($email,$code_type,$user_id=\"\")\n\t{\n\t\tif($email)\n\t\t{\n\t\t\tif($this->_redis)\n {\n\t\t\t\t$errorcode=$this->check_auth('email',$email);\n }\n else\n {\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"email\",$email);\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" -\".Constant::SEND_AUTHCODE_INTERVAL_EMAIL)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n\t}", "function authenticate_user($email_a, $passcode){\r\n\t//QUERY DATABASE/ACTIVE DIRECTORY TO SEE IF USER IS VALID\r\nif ($email == \"insert valid email b4 testing\") {\r\n\t/*** set a form token ***/\r\n\t$form_token = md5( uniqid('auth', true) );\r\n\t/*** set the session form token ***/\r\n\t$_SESSION['form_token'] = $form_token;\r\n\t$_SESSION['email_a'] = $email_a;\r\n\t$_SESSION['start_timestamp'] = date('Y-m-d HH:mm:s');\r\n\t$code = \"valid\";\r\n}else{\r\n\t$code = \"invalid\";\r\n\t}\r\necho return $code \"We were unable to validate your information, Please try again\";\r\n /*RETURNED TO CALLING CODE */\r\n\t}", "function send_authcode_phone($authcode,$phone,$code_type=0)\n\t{\n\t\t$this->load->library('sms');\n\n\t\t$msg_head=$msg_end=$lang='';\n\t\tswitch($code_type)\n\t\t{\n\t\t\tcase Constant::CODE_TYPE_REGISTER: $lang=\"verify\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PASSWORD: $lang=\"reset\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PHONE: $lang=\"update_phone\";break;\n\t\t\tdefault:break;\n\t\t}\n\n\t\tif($lang)\n\t\t{\n\t\t\t$msg_head=str_replace('{phone}',substr($phone,-4),$this->lang->line('phone_body_'.$lang));\n\t\t\t$msg_end=$this->lang->line('phone_end_'.$lang);\t\t\t\n\t\t}\n\t\t$msg=$msg_head.$authcode.$msg_end;\n\n \t$this->sms->setPhoneNums($phone);\n \t$this->sms->setContent($msg);\n\t\t$sms_error=$this->sms->send();\t\n\t\tif($sms_error['error']==\"Ok\")\n\t\t{\n\t\t\t $errorcode=true;\n\t\t\t log_message('info_tizi','170111:Sms send success',$sms_error);\t\n\t\t}\n\t\telse \n\t\t{\n\t\t\t$errorcode=false;\n\t\t\tif($sms_error['status']==3) $sms_error['error']=$this->lang->line('error_sms_invalid_phone');\n\t\t\telse $sms_error['error']=$this->lang->line('error_sms_normal');\n\t\t\tlog_message('error_tizi','17011:Sms send failed',$sms_error);\n\t\t}\n\t\treturn array('errorcode'=>$errorcode,'error'=>$sms_error['error'],'status'=>$sms_error['status']);\n\t}", "function users_user_activation($args)\n{\n $code = base64_decode(FormUtil::getPassedValue('code', (isset($args['code']) ? $args['code'] : null), 'GETPOST'));\n $code = explode('#', $code);\n\n if (!isset($code[0]) || !isset($code[1])) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n $uid = $code[0];\n $code = $code[1];\n\n // Get user Regdate\n $regdate = pnUserGetVar('user_regdate', $uid);\n\n // Checking length in case the date has been stripped from its space in the mail.\n if (strlen($code) == 18) {\n if (!strpos($code, ' ')) {\n $code = substr($code, 0, 10) . ' ' . substr($code, -8);\n }\n }\n\n if (DataUtil::hash($regdate, 'md5') == DataUtil::hash($code, 'md5')) {\n $returncode = pnModAPIFunc('Users', 'user', 'activateuser',\n array('uid' => $uid,\n 'regdate' => $regdate));\n\n if (!$returncode) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n LogUtil::registerStatus(__('Done! Account activated.'));\n return pnRedirect(pnModURL('Users', 'user', 'loginscreen'));\n } else {\n return LogUtil::registerError(__('Sorry! You entered an invalid confirmation code. Please correct your entry and try again.'));\n }\n}", "private function returnCodeMessage(int $code): string {\n $codes = [\n 211 => 'System status, or system help reply',\n 214 => 'Help message (A response to the HELP command)',\n 220 => '<domain> Service ready',\n 221 => '<domain> Service closing transmission channel',\n 235 => 'Authentication succeeded',\n 250 => 'Requested mail action okay, completed',\n 251 => 'User not local; will forward',\n 252 => 'Cannot verify the user, but it will try to deliver the message anyway',\n 334 => '(Server challenge - the text part contains the Base64-encoded challenge)',\n 354 => 'Start mail input',\n 421 => 'Service not available, closing transmission channel (This may be a reply to any command if the service knows it must shut down)',\n 432 => 'A password transition is needed',\n 450 => 'Requested mail action not taken: mailbox unavailable (e.g., mailbox busy or temporarily blocked for policy reasons)',\n 451 => 'Requested action aborted: local error in processing / IMAP server unavailable',\n 452 => 'Requested action not taken: insufficient system storage',\n 454 => 'Temporary authentication failure',\n 455 => 'Server unable to accommodate parameters',\n 500 => 'Syntax error, command unrecognized (This may include errors such as command line too long) / Authentication Exchange line is too long',\n 501 => 'Syntax error in parameters or arguments / Cannot Base64-decode Client responses / Client initiated Authentication Exchange (only when the SASL mechanism specified that client does not begin the authentication exchange)',\n 502 => 'Command not implemented',\n 503 => 'Bad sequence of commands',\n 504 => 'Command parameter is not implemented / Unrecognized authentication type',\n 521 => 'Server does not accept mail',\n 523 => 'Encryption Needed',\n 530 => 'Authentication required',\n 534 => 'Authentication mechanism is too weak',\n 535 => 'Authentication credentials invalid',\n 538 => 'Encryption required for requested authentication mechanism',\n 550 => 'Requested action not taken: mailbox unavailable (e.g., mailbox not found, no access, or command rejected for policy reasons)',\n 551 => 'User not local; please try <forward-path>',\n 552 => 'Requested mail action aborted: exceeded storage allocation',\n 553 => 'Requested action not taken: mailbox name not allowed',\n 554 => 'Transaction has failed (Or, in the case of a connection-opening response, \"No SMTP service here\") / Message too big for system',\n 556 => 'Domain does not accept mail',\n ];\n return $codes[$code] ?? '';\n }", "function send_auth_code_at_login($user)\n{\n\t$user_info = get_userdata($user);\n\t\n\t$user_login = $user_info->data->user_login;\n\n\t$user_email = $user_info->data->user_email;\t\n\n\t$user_name = $user_info->data->first_name;\t\n\n\t$user_phone = get_user_meta( $user, 'user_phone', true );\n\t//$user_phone = urldecode($u_phone);\n\n\t$user_fname = get_user_meta( $user, 'first_name', true );\n\n\t$code = get_user_meta( $user, 'has_to_be_activated', true );\n\n\t$subject = 'Your New Authentication Code';\n\n\n\t$message1 = \"<html><body style='background:#f3f3f3;padding:20px 0;'><table border='0' cellpadding='0' cellspacing='0' style='margin:auto; max-width: 520px;width:100%;font-family: Arial;padding:20px;background:#fff;'><tbody>\";\n\t$message1 .=\"<tr><td style='font-size: 16px;'>Hello \".ucfirst($user_fname).\",</td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Welcome to Raise it Fast!</td></tr><tr height=30></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Please use this code to authenticate your account with Raise it Fast. <span style='background: #aaaaaa none repeat scroll 0 0;height: 45px;text-align: center;width: 101px;'>\".$code.\"</span></td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>'If you have any questions or concerns don't hesitate to use our website chat function, call us, or email us by going to our help page at \".site_url('/contact-us/').\" Or, you can simply reply to this email. '</td></tr><tr height=30></tr>\"; \n\t$message1 .=\"<tr><td style='font-size: 16px; margin-top: 20px;'>Thanks for becoming a part of the Raise It Fast community! </td></tr></tbody></table><table border='0' cellpadding='0' cellspacing='0' style='margin:20px auto 0; max-width: 520px;width:100%;'>\"; \n\n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'>1401 Lavaca St #503, Austin, TX 78701</td></tr><tr height=20></tr>\"; \n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'><a href=\".site_url().\" style='text-decoration:none; color: #999999;'>The Raise it Fast Team</a></td></tr>\"; \n\t$message1 .=\"</table></body></html>\";\n\n\twp_mail($user_email, $subject, $message1);\n\n//=========Send Auth Code Via Text message ==================//\n\n\t$account_sid = get_option('twilio_account_sid'); \n\t$auth_token = get_option('twilio_auth_token'); \n //require('lib/twilio-php-latest/Services/Twilio.php');\n\t$client = new Services_Twilio($account_sid, $auth_token); \n //$from = '+12182265630'; \n\t$from = get_option('twilio_phone_no');\n\n\ttry\n\t{\n\t\t$client->account->messages->sendMessage( $from, $user_phone, \"Hello $user_fname, Your Authentication code is $code\");\n\t}\n\tcatch (Exception $e)\n\t{ \n\n\t\techo \"11-\";\n\t}\n}", "public function send($email, $code, $emailId);", "function send_code($mobile_no) {\n\n\t\t$varifycode = rand('1000', '9999');\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$code = 1234;\n\t\t// $mobileNumber = substr($mobile_no, 1);\n\t\t// $msg = \"Recharge Verification Code : \" . $code;\n // $encodedMessage = urlencode($msg);\n // $route = \"4\";\n // $authKey = \"109829ANu1kqLdg570b4e25\";\n // $senderId = \"Recharge\";\n // $postData = array(\n // 'authkey' => $authKey,\n // 'mobiles' => $mobileNumber,\n // 'message' => $encodedMessage,\n // 'sender' => $senderId,\n // 'route' => $route\n// );\n// $url=\"http://api.msg91.com/api/sendhttp.php\";\n // $ch = curl_init();\n// curl_setopt_array($ch, array(\n // CURLOPT_URL => $url,\n // CURLOPT_RETURNTRANSFER => true,\n // CURLOPT_POST => true,\n // CURLOPT_POSTFIELDS => $postData\n // //,CURLOPT_FOLLOWLOCATION => true\n// ));\n// \n// \n// //Ignore SSL certificate verification\n// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n// \n// \n// //get response\n// $output = curl_exec($ch);\n// \n // if (curl_errno($ch)) {\n\t // $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n // echo json_encode($result);\n\t\t\t // exit();\n// // // // \n\t\t // }\n // curl_close($ch);\nreturn $code;\n\t\t//echo $output;\n\t}", "public function verify_actcode($member_email, $code){\n\t\t//$newCode = $this->make_activation_code();\n\t\t$mysql = New Mysql();\n\t\treturn($mysql->update_activation_code($member_email, $code));\n\t}", "public function test_auth_code_redemption_with_email() {\n\t\tstatic::$test_auth_code['scope'] = 'profile email';\n\t\t$code = $this->set_auth_code();\n\t\t$response = $this->create_form( 'POST', \n\t\t\t\tarray(\n\t\t\t\t\t'grant_type' => 'authorization_code',\n\t\t\t\t\t'code' => $code,\n\t\t\t\t\t'client_id' => 'https://app.example.com',\n\t\t\t\t\t'redirect_uri' => 'https://app.example.com/redirect',\n\t\t\t\t)\n\t\t);\n\t\t$this->assertEquals( 200, $response->get_status(), 'Response: ' . wp_json_encode( $response ) );\n\t\t$data = $response->get_data();\n\t\t$this->assertArrayNotHasKey( 'access_token', $data );\n\t\t$this->assertEquals( \n\t\t\tarray( \n\t\t\t\t'me' => get_author_posts_url( static::$author_id ),\n\t\t\t\t'profile' => indieauth_get_user( static::$author_id, true )\n\t\t\t), \n\t\t\t$data, \n\t\t\t'Response: ' . wp_json_encode( $data ) \n\t\t);\n\t\t// Reset Just in Case.\n\t\tunset( static::$test_auth_code['scope'] );\n\t}", "function verify_authcode_email($authcode)\n\t{\n\t\t$user_id=$email=$code_type=$user_type=0;\n\t\tif($this->_redis)\n\t\t{\n\t\t\t$data=$this->cache->get($authcode);\t\n\t\t\tif(!empty($data))\n\t\t\t{\n\t\t\t\t$data=json_decode($data);\n\t\t\t\t$user_id=$data->user_id;\n\t\t\t\t$email=$data->email;\n\t\t\t\t$code_type=$data->code_type;\n\t\t\t\t$user_type=$data->user_type;\t\n\t\t\t\t$this->cache->delete($authcode);\n\t\t\t\t$errorcode=true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t\tlog_message('error_tizi','17052:email verify code failed',array('authcode'=>$authcode));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n \t$this->db->select(\"id,user_id,email,code_type,user_type,generate_time\");\n \t$this->db->from($this->_table);\n \t $this->db->where(\"authcode\",$authcode);\n \t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_EMAIL);\n \t$query=$this->db->get();\n \t$total=$query->num_rows();\n \t$gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_EMAIL))>date(\"Y-m-d H:i:s\"))\n \t{\n \t$id=$query->row()->id;\n \t$user_id=$query->row()->user_id;\n \t$email=$query->row()->email;\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\t$user_type=$query->row()->user_type;\n \t$this->db->where('id',$id);\n \t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n \tif($this->db->affected_rows()==1) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n \t}\n \telse\n \t{\n \t\t$errorcode=false;\n \t}\n\t\t}\n return array('user_id'=>$user_id,'email'=>$email,'code_type'=>$code_type,'user_type'=>$user_type,'errorcode'=>$errorcode);\n\t}", "function check_auth_response_code($status) {\n\n if ($status != 'S000') {\n $message = get_ticket_error_message($status);\n return result_error($status,$message);\n }\n return result_success();\n}", "function forget_send_code($mobile){\n\t\t$varifycode = rand('10000000', '99999999');\n\t\t//$code = 1234;\n\t\t $code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t $mobileNumber = substr($mobile, 1);\n\t\t $msg = \"New Password of Recharge login : \" . $code;\n $encodedMessage = urlencode($msg);\n $route = \"4\";\n $authKey = \"109829ANu1kqLdg570b4e25\";\n $senderId = \"Recharge\";\n $postData = array(\n 'authkey' => $authKey,\n 'mobiles' => $mobileNumber,\n 'message' => $encodedMessage,\n 'sender' => $senderId,\n 'route' => $route\n);\n $url=\"http://api.msg91.com/api/sendhttp.php\";\n $ch = curl_init();\ncurl_setopt_array($ch, array(\n CURLOPT_URL => $url,\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_POSTFIELDS => $postData\n ,CURLOPT_FOLLOWLOCATION => true\n));\n// \n// \n// //Ignore SSL certificate verification\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n// \n// \n// //get response\n $output = curl_exec($ch);\n// \n // if (curl_errno($ch)) {\n\t // $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n // echo json_encode($result);\n\t\t\t // exit();\n// // // // \n\t\t // }\n curl_close($ch);\n\t\treturn $code;\n\t}", "public function send(string $code, Authenticatable $user);", "public function activateAccount($code, $email)\n {\n\n // define all the global variables\n global $database, $message, $functions;\n\n // escape the given strings\n $code = $this->secureInput($code);\n $email = $this->secureInput($email);\n\n // start the checks\n if (empty($code) || empty($email)) {\n $message->setError(\"Code/Email fields most not be empty\", Message::Error);\n return false;\n }\n\n // check if email exists\n if (!$functions->emailExist($email)) {\n $message->setError(\"The provided email is not in our database.\", Message::Error);\n return false;\n }\n\n // check if the given code matches the required characters\n if (strlen($code) < 20 || strlen($code) > 20) {\n $message->setError(\"The given code has to be exactly 20 characters long\", Message::Error);\n return false;\n }\n\n // check if account already has been activated\n if ($functions->isUserActivated($email, true)) {\n $message->setError(\"The account is already activated\", Message::Error);\n return false;\n }\n\n $sql = \"SELECT * FROM \" . TBL_USERS . \" WHERE \" . TBL_USERS_EMAIL . \" = '\" . $email . \"' AND \" . TBL_USERS_ACTIVATION_CODE . \" = '\" . $code . \"'\";\n\n // get the sql results\n $result = $database->getQueryResults($sql);\n if ($database->anyError()) {\n return false;\n }\n\n // check if wrong code has been used\n if ($database->getQueryNumRows($result, true) < 1) {\n $message->setError(\"Wrong activation code has been used.\", Message::Error);\n return false;\n }\n\n //update the user account with the needed information\n $sql = \"UPDATE \" . TBL_USERS . \" SET \" . TBL_USERS_ACTIVATED . \" ='1',\" . TBL_USERS_ACTIVATION_CODE . \"='' WHERE \" . TBL_USERS_EMAIL . \" = '\" . $email . \"' AND \" . TBL_USERS_ACTIVATION_CODE . \" = '\" . $code . \"'\";\n\n // get the sql results\n $database->getQueryResults($sql);\n if ($database->anyError()) {\n return false;\n }\n\n $message->setSuccess(\"Your account has been activated successfully !\");\n return true;\n }", "function send_code($mobile_no) {\n\n\t\t$varifycode = rand('1000', '9999');\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$code = 1234;\n\t\t$mobile = \"0\" . $mobile_no;\n\t\t// $mobileNumber = substr($mobile_no, 1);\n\t\t$msg = \"Recharge Verification Code : \" . $code;\n\t\t$encodedMessage = urlencode($msg);\n\t\t// $route = \"4\";\n\t\t// $authKey = \"109829ANu1kqLdg570b4e25\";\n\t\t// $senderId = \"Recharge\";\n\t\t// $postData = array(\n\t\t// 'authkey' => $authKey,\n\t\t// 'mobiles' => $mobileNumber,\n\t\t// 'message' => $encodedMessage,\n\t\t// 'sender' => $senderId,\n\t\t// 'route' => $route\n\t\t// );\n\t\t$url = \"http://www.kudisms.net/components/com_spc/smsapi.php?username=smerp&password=abhishek&sender=kudisms&recipient=$mobile&message=\" . $encodedMessage;\n\t\t// $url=\"http://api.msg91.com/api/sendhttp.php\";\n\t\t$ch = curl_init();\n\t\tcurl_setopt_array($ch, array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,\n\t\t// CURLOPT_POSTFIELDS => $postData\n\t\tCURLOPT_FOLLOWLOCATION => true));\n\t\t//\n\t\t//\n\t\t// //Ignore SSL certificate verification\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n\t\t//\n\t\t//\n\t\t// //get response\n\t\t$output = curl_exec($ch);\n\t\t//\n\t\t// if (curl_errno($ch)) {\n\t\t// $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n\t\t// echo json_encode($result);\n\t\t// exit();\n\t\t// // // //\n\t\t// }\n\t\tcurl_close($ch);\n\t\treturn $code;\n\t\t//echo $output;\n\t}", "function forget_send_code($mobile) {\n\t\t$varifycode = rand('10000000', '99999999');\n\t\t//$code = 1234;\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$mobileNumber = substr($mobile, 1);\n\t\t$msg = \"New Password of Recharge login : \" . $code;\n\t\t$encodedMessage = urlencode($msg);\n\t\t// $route = \"4\";\n\t\t// $authKey = \"109829ANu1kqLdg570b4e25\";\n\t\t// $senderId = \"Recharge\";\n\t\t// $postData = array(\n\t\t// 'authkey' => $authKey,\n\t\t// 'mobiles' => $mobileNumber,\n\t\t// 'message' => $encodedMessage,\n\t\t// 'sender' => $senderId,\n\t\t// 'route' => $route\n\t\t// );\n\t\t//$url=\"http://api.msg91.com/api/sendhttp.php\";\n\t\t$url = \"http://www.kudisms.net/components/com_spc/smsapi.php?username=smerp&password=abhishek&sender=kudisms&recipient='\" . $mobile . \"'&message=\" . $encodedMessage;\n\t\t$ch = curl_init();\n\t\tcurl_setopt_array($ch, array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData, CURLOPT_FOLLOWLOCATION => true));\n\t\t//\n\t\t//\n\t\t// //Ignore SSL certificate verification\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n\t\t//\n\t\t//\n\t\t// //get response\n\t\t$output = curl_exec($ch);\n\t\t//\n\t\t// if (curl_errno($ch)) {\n\t\t// $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n\t\t// echo json_encode($result);\n\t\t// exit();\n\t\t// // // //\n\t\t// }\n\t\tcurl_close($ch);\n\t\treturn $code;\n\t}", "function emailpasswordresetcode($username, $email){\n\t$to=$email;\n\t$errortype = 98;\n\t$errorcode = generateerrorcode($username,$email);\n\t$db=usedb();\n\t//make sure the user provided input is safe\n\t$username=mysqli_real_escape_string($db, $username);\n\t$email=mysqli_real_escape_string($db, $email);\n\t$errorcode=mysqli_real_escape_string($db, $errorcode);\n\t$sql=<<<SQL\n\t\tUPDATE users\n\t\tSET users.PassWord=MD5('$errorcode'), users.ErrorType=$errortype, users.ErrorCode='$errorcode'\n\t\tWHERE (users.UserName='$username' AND users.Email='$email')\nSQL;\n\tmysqli_query($db, $sql);\n\t$rows=mysqli_affected_rows($db);\n\tif(!$rows){\n\t\tmysqli_close($db);\n\t\treturn 0;\n\t}else{//the update was successful so we can try to get the display name and sent the email\n\t\t$sql=<<<SQL\n\t\t\tSELECT users.DisplayName\n\t\t\tFROM users\n\t\t\tWHERE (users.UserName = '$username')\nSQL;\n\t\t$result = mysqli_query($db, $sql);\n\t\t$rows = mysqli_num_rows($result);\n\t\tmysqli_close($db);\n\t\tif(!$rows){\n\t\t\treturn 0;\n\t\t}else{\t//if we have an author with that id\n\t\t\t//get the information in the result\n\t\t\t$assoc = mysqli_fetch_assoc($result);\n\t\t\t$displayname = $assoc['DisplayName'];\n\t\t\t//Send the email\n\t\t\t$subject=\"Collabor8r Password Reset\";\n\t\t\t$helpaddress=emailaddress(\"help\");\n\t\t\t$header=\"From: Collabor8r User Services <$helpaddress>\";\n\t\t\t$text = <<<TEXT\nDear $displayname,\nAs per your request, we have reset your password.\nTemporary Password: $errorcode\nUpon logging in with this password, you will need to change your password to regain access to all of our services.\nThank you for your continued patronage. If you ever have suggestions about our services, please don't hesitate to contact us.\nThe CollaboR8R Team.\nIf you did not request this email, please forward this it to [email protected].\nTEXT;\n\t\t\tmail($to,$subject,$text,$header);\n\t\t\treturn 1;\n\t\t}\n\t}\n\t//if we get past the point, the email didn't get sent so return 0\n\treturn 0;\n}", "function getNewAuthCodeFinal($authDetails)\n{\n $params = array('response_type'=>'code', 'client_id'=> $authDetails['client_id'], 'redirect_uri'=> $authDetails['redirect_uri'], 'state'=> 'xyz');\n header('Location: ' . $authDetails['authorization_code_endpoint'] . '?' . http_build_query($params));\n die();\n}", "public function passwordResetCode();", "function sendActivationEmail($emailid, $activationcode) {\n\t// send activation email\n\t// require ('emailcode.php');\n\t$link = \"http://s336355547.onlinehome.us/peach/service/index.php?method=get&module=activate&emailid=$emailid&activationcode=$activationcode\";\n\t$STR_EMAIL_STRING =\"<br/>Hi,<br/><br/>Please click on below link to activate your account.<br/><br/>$link <br/><br/>Regards <br/>Peach Health <br/>\";\n\tSEND_MAIL($emailid, \"Activation link of peach health\", $STR_EMAIL_STRING, \"[email protected]\");\n}", "public function mailer($email,$code){\r\n $errors = [];\r\n \r\n $query = \"INSERT INTO resetpassword (code, email) VALUES('$code', '$email')\";\r\n $sendEmail = $this->db->query($query);\r\n return $sendEmail;\r\n }", "public static function reissue_verification() {\n $email = $_POST[\"email\"];\n // Fetch whether the email is verified information\n try {\n $request = DB::query(\"SELECT `Verified` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n\n // Check if the email is actually registered\n if ($request) {\n $verified_status = $request[0][\"Verified\"];\n // Determine whether the email is verified\n if ($verified_status == 1) {\n // Check if users has a password\n try {\n $pass_request = DB::query(\"SELECT `Password` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n if ($pass_request) {\n return 3;\n } else {\n return 4;\n }\n } else {\n // Gather required data \n try {\n $username = DB::query(\"SELECT `Username` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email))[0][\"Username\"];\n } catch (PDOException $e) {\n return 1;\n }\n $vercode = sha1(time());\n try {\n DB::query(\"UPDATE `Users` SET Vercode=:ver WHERE Email=:email;\", array(\":ver\" => $vercode, \":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n $to = $email;\n $headers = <<<MESSAGE\nFROM: George || [email protected]\nContent-Type: text/plain;\nMESSAGE;\n $subject = \"Verification code re-issue\";\n $msg = <<<EMAIL\nHi $username,\n\nYou've requested for a new verification code to be issued!\nPlease follow this <a href='https://flatdragons.com/signup.php?user=$username&ver=$vercode'>link</a> to confirm your account with us :)\n\nKind regards,\nGeorge (FlatDragons)\nEMAIL;\n mail($to, $subject, $msg, $headers);\n return 0;\n }\n } else {\n return 2;\n }\n }", "function generate_authcode_phone($phone,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER)\n\t{\n\t\t$authcode=\"\";\n\t\t$errorcode=$this->check_authcode_phone($phone,$code_type);\n if(!$errorcode['errorcode'])\n {\n\t\t\t$authcode=random_string('nozero',6);\n $data=$this->bind_verify($user_id,\"\",$phone,2,$code_type,$authcode,$user_type);\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode.'_'.sha1($phone),json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_PHONE);\n\t\t\t\t$this->save_check('phone',sha1($phone),$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_PHONE);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n\t\t\t\t$insert_id=$this->db->insert_id();\n\t\t\t\tif($insert_id>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170019:Gen phone auth code',array('phone'=>$phone));\n\t\t\tif(!$errorcode) log_message('error_tizi','17019:Gen phone auth code failed',array('phone'=>$phone));\n\t\t}\n else\n {\n $errorcode=false;\n }\n return array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "public static function sendCode(Request $request){\n $rules = [\n 'email' => 'required|email|exists:users,email',\n ];\n $validator = Validator::make(request()->all(),$rules);\n $validation_errors = $validator->errors();\n if($validator->fails()){\n\n result(401,$validation_errors->first(), null);\n }\n else{\n $email = request('email');\n $verify_code = rand(1000,9000);\n User::where('email',request('email'))->update(['status'=>null,'verify_code'=>$verify_code]);\n $data = [\n 'email'=>$email,\n 'code'=>$verify_code\n ];\n if(SendEmailController::mail($data) == true){\n result(200 ,null,null);\n }\n }\n }", "function checkbemail_post(){\n \n $parameter = array('bemail' => $this->post('bemail') , 'bseq' => '', 'act_mode' => 'emailcheck');\n $data = $this->supper_admin->call_procedureRow('proc_checkbemail', $parameter);\n if(!empty($data)){\n $data = $this->send_json($data); \n $this->response($data, 200); // 200 being the HTTP response code\n }\n else{\n $this->response(array('error' => 'User could not be found'), 404);\n }\n\n }", "private function checkingApiCanAuthenticateCode($auth_code)\n {\n return $this->api_request->get(\"user\",\"validate_user_code\",$params=array('code'=>$auth_code)); \n }", "function send_verification_email($user_email, $verification_code)\n{\n\n $to = $user_email;\n $subject = 'Verification Email';\n\n $message = '\n Thanks for subscribing!\n Your veirfication code is:\n ' . $verification_code;\n\n return mail($to, $subject, $message);\n}", "public function verify_code($params) {\n\n $verification_code = $params['verification_code'];\n $code_id = $params['code_id'];\n\n $options = array('body'=> array());\n $options['body']['code']= ['verify'=> $verification_code];\n\n $uri = $code_id.\"/verify\";\n $uri = \"/cpaas/auth/v1/\".$this->client->user_id.\"/codes/\".$uri;\n $url = $this->client->_root.$uri;\n $response = $this->client->_request(\"PUT\", $url, $options);\n\n // check if test response\n if ($this->client->check_if_test($response)) {\n return $response;\n }\n // check if error response\n // if ($this->client->check_if_error($response)) {\n // $response = $this->client->build_error_response($response);\n // return $response;\n // }\n\n if ($response->getStatusCode() == 204) {\n $custom_response = ['verified'=> true, 'message'=> 'Success'];\n } else {\n $custom_response = ['verified'=> false, 'message'=> 'Code invalid or expired'];\n }\n\n return $custom_response;\n }", "public function validationSha($code){\r\n\t\t//variables\r\n\t\t$error = '';\r\n\t\t$user_browser = $_SERVER['HTTP_USER_AGENT']; //navegador\r\n\t\t$ip = $_SERVER['REMOTE_ADDR']; //ip\r\n\t\r\n\t\t$this->where('macro_sha', $code);\r\n\t\tif($salida = $this->getOne('solicitudes_clave')){\r\n\t\t\t\r\n\t\t\tif($salida['navegador'] != $user_browser){\t$error = 'navegador no concide';\t}\r\n\t\t\tif($salida['ip'] != $ip){\t\t\t\t\t$error = 'remote ip no concide';\t}\r\n\t\t\t\r\n\t\t\tif($error != ''){\r\n\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\treturn false;\r\n\t\t\t}else{\r\n\t\t\t\t$nuevo_sha = hash('sha512', $salida['email'].$user_browser.$salida['telefono'].$ip);\r\n\t\t\t\tif($nuevo_sha != $salida['macro_sha']){\r\n\t\t\t\t\t$error = 'Shas no coinciden';\r\n\t\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}else{\r\n\t\t\t\t\t//succes!!\r\n\t\t\t\t\t$_SESSION['email_val'] = $salida['email'];\r\n\t\t\t\t\t$_SESSION['corrector'] = $salida['salt'];\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t}else{\r\n\t\t\t$error = 'no hubo conexion a db';\r\n\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "function requestCode ($domain) {\n $url = 'https://' . $domain . '/oauth/authorize/' .\n '?client_id=' . urlencode(APP_ID);\n redirect($url);\n}", "public function enter_data($name,$email){\n\n\n $status=0;//status is 0 initially\n $code=md5(rand(0,1000));\n \t$query = $this ->conn ->prepare('INSERT INTO androidusers SET name =:name,\n email =:email, status =:status, code=:code');\n \t$query->execute(array('name' => $name, ':email' => $email, 'status'=>$status, 'code'=>$code));\n\n //Send verification link to registered email after clicking the link the confirmed email address after that admin sends password to \n //that email.\n $mail = new PHPMailer;\n $mail->isSMTP();//SMTP-Simple mail transfer protocol(TCP/IP)protocol used in sending and receiving email.\n $mail->Host = 'smtp.mail.yahoo.com';\n $mail->Port = 587;//TLS port number in case of SSL 465.\n $mail->SMTPSecure = 'tls';// TLS- Transport layer security is a cryptographic protocol that provide authentication and data encryptions between the servers\n //e.g client connection to webserver\n $mail->SMTPAuth = true;\n $mail->Username = '';//Admin can replace email alotted to them\n $mail->Password = '';//Password can also be replaced according to the email\n $mail->From = \"[email protected]\";\n $mail->FromName = \"[email protected]\";\n $mail->AddAddress($email);\n $mail->Subject = 'SMART LAB IoT USER LOGIN - EMAIL VERIFICATION';\n \n $mail->msgHTML('<p>Dear '.$name.',<br/><br/><br/> Your verification link is: http://192.168.1.101/android/server/verify.php?name='.$name.'&email='.$email.'&code='.$code.'</p>');\n \n if (!$mail->send()) {\n $error = \"Mailer Error: \" . $mail->ErrorInfo;\n echo '<p id=\"para\">'.$error.'</p>';\n }\n else {\n return true;\n }\n //Ending mail function\n\n\n\n if ($query) {\n \n return true;\n\n } else {\n\n return false;\n\n }\n\n\n\n\n\n\n }", "public function test_auth_code_redemption() {\n\t\t$code = $this->set_auth_code();\n\t\t$response = $this->create_form( 'POST', \n\t\t\t\tarray(\n\t\t\t\t\t'grant_type' => 'authorization_code',\n\t\t\t\t\t'code' => $code,\n\t\t\t\t\t'client_id' => 'https://app.example.com',\n\t\t\t\t\t'redirect_uri' => 'https://app.example.com/redirect',\n\t\t\t\t)\n\t\t);\n\t\t$this->assertEquals( 200, $response->get_status(), 'Response: ' . wp_json_encode( $response ) );\n\t\t$data = $response->get_data();\n\t\t$this->assertArrayNotHasKey( 'access_token', $data );\n\t\t$this->assertEquals( \n\t\t\tarray( \n\t\t\t\t'me' => get_author_posts_url( static::$author_id ),\n\t\t\t), \n\t\t\t$data, \n\t\t\t'Response: ' . wp_json_encode( $data ) \n\t\t);\n\t}", "function deliver($code)\n{ \n\n\techo \"// http://license.mxgraph.com/hosted \\n\";\n\techo $code;\n}", "function verifyemail() {\n\t$a = array(\n\t 'status' => 'system-error'\n\t);\n\n\t// raw inputs\n\t$taint_si = isset($_POST['si']) ? $_POST['si'] : 0;\n\t$taint_tic = isset($_POST['tic']) ? $_POST['tic'] : 0;\n\t$taint_pword = isset($_POST['pword']) ? $_POST['pword'] : 0;\n\n\t// validate inputs\n\t$si = validateToken($taint_si);\n\t$tic = validateTic($taint_tic);\n\t$pword = validatePword($taint_pword);\n\n\t// validate parameter set\n\tif (!$si || !$tic || !$pword) {\n\t\tLog::write(LOG_WARNING, 'attempt with invalid parameter set');\n\t\treturn $a;\n\t}\n\n\t// get db connection\n\t$conn = getConnection();\n\tif (!$conn) {\n\t\treturn $a;\n\t}\n\n\t// read token and user table\n\t$result = getUserByToken($conn, $si);\n\tif (!$result) {\n\t\treturn $a;\n\t}\n\n\t// get fields\n\t$row = pg_fetch_array($result, 0, PGSQL_ASSOC);\n\t$userid = $row['id'];\n\t$hashpassword = $row['hashpassword'];\n\t$auth = $row['auth'];\n\t$hashtic = $row['hashtic'];\n\t$oldemail = $row['email'];\n\n\t// verify user authentication state\n\tif (!isUserEmailPending($auth)) {\n\t \tLog::write(LOG_NOTICE, 'attempt to verify email on user not auth=email-pending');\n\t\treturn $a;\n\t}\n\n\t// verify the password\n\t$boo = verifyPassword($pword, $hashpassword);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid password');\n\t\treturn $a;\n\t}\n\n\t// verify the tic from the email\n\t$boo = verifyTic($tic, $hashtic);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid tic');\n\t\treturn $a;\n\t}\n\n\t// update user record\n\t$auth = DB::$auth_verified;\n\t$name = 'verify-email';\n\t$sql = \"update accounts.user set email=newemail, newemail='', auth=$1, hashtic=null, tmhashtic=null where id = $2\";\n\t$params = array($auth, $userid);\n\t$result = execSql($conn, $name, $sql, $params, true);\n\tif (!$result) {\n\t\treturn false;\n\t}\n\n\t// send security notice\n\t$boo = sendAuthenticationEmail($oldemail, 'changedemail', '');\n\tif (!$boo) {\n\t\t$a['status'] = 'send-email-failed';\n\t\treturn $a;\n\t}\n\n\t// success\n\t$a['status'] = 'ok';\n\t$a['auth'] = $auth;\n\treturn $a;\n}", "function register_resend_email($email) {\n\t\tglobal $pdo;\n\n\t\t//delete old registration attempts\n\t\t$pdo->query(\"DELETE FROM user WHERE verified = 0 AND TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, code_generation_time)) > 600\");\n\n\t\t//empty or array check\n\t\tif(empty($email) || is_array($email)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t//check if email exists and is not verified\n\t\t$sql = \"SELECT name, verification_code FROM user WHERE REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 0\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t$sth->execute();\n\n\t\tif($sth->rowCount() == 0) {\n\t\t\t//check if email exists but is already verified\n\t\t\t$sql = \"SELECT id FROM user WHERE REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 1\";\n\t\t\t$sth2 = $pdo->prepare($sql);\n\t\t\t$sth2->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t\t$sth2->execute();\n\n\t\t\tif($sth2->rowCount() == 0) {\n\t\t\t\treturn 2;\n\t\t\t} else {\n\t\t\t\treturn 3;\n\t\t\t}\n\t\t}\n\n\t\t//get data required for email\n\t\t$name_verification_code = $sth->fetch();\n\t\t$name = $name_verification_code[\"name\"];\n\t\t$verification_code = $name_verification_code[\"verification_code\"];\n\n\t\t$reg_link = \"https://swapitg.com/firstlogin/$verification_code\";\n\t\t$subject = \"Registration\";\n\t\t$mailfile = fopen(__DIR__ . \"/register_mail_template.html\", \"r\") or die(\"Unable to open file!\");\n\t\t$message = strtr(fread($mailfile, filesize(__DIR__ . \"/register_mail_template.html\")), array('$reg_link' => $reg_link, '$name' => htmlspecialchars($name)));\n\t\tfclose($mailfile);\n\t\t$sender_email = \"[email protected]\";\n\t\t$sender_name = \"SwapitG no-reply\";\n\n\t\t//send email\n\t\tif(mail($email, $subject, wordwrap($message, 70, \"\\r\\n\"), \"From: $sender_name<$sender_email>\\r\\nContent-type: text/html; charset=utf-8\", \" -f \" . $sender_email)) {\n\t\t\treturn 0;\n\t\t} else {\n\t\t\treturn 4;\n\t\t}\n\t}", "public function authorize_result()\n\t{\t\n\t\tif(isset($_GET['code']))\n\t\t{\n\t\t\tif($this->oauth->ci->session->userdata('state') !== $_GET['state'])\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('failure', array(\n 'error' => $this->oauth->ci->lang->line('error_xsfr_victim')\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('success', array(\n\t\t\t\t\t\t'token' => $_GET['code'],\n\t\t\t\t\t\t'state' => $_GET['state']\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(isset($_GET['error']))\n\t\t{\n\t\t\treturn $this->oauth->response('failure', array(\n\t\t\t\t\t'error' => $_GET['error_description']\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}", "function auth() {\r\n\t$code = \"\";\r\n\tfor ($i = 0; $i < 8; $i ++) {\r\n\t\t$code .= (rand(0, 1) ? chr(rand(65, 122)) : rand(0, 9));\r\n\t}\r\n\treturn sha1($code);\r\n}", "function verify($email,$code)\n {\n $sql = \"SELECT id\n FROM\n user\n WHERE\n verification = '$code'\n AND\n email='$email'\n \";\n $query = $this->db->query($sql);\n if($query->num_rows()>0)\n {\n $row = $query->row();\n $update['verification'] = 'done';\n $update['status'] = 1;\n $this->db->where('id', $row->id);\n $this->db->update('user', $update);\n return $row->id;\n }\n }", "public function authenticationCallback() \n\t{\n\t\n\t\tif (!isset($_GET['code'])) {\n\t\t\treturn;\n\t\t}\n\n\t\t$store = SBTCredentialStore::getInstance();\n\t\t$settings = new SBTSettings();\n\t\t\n\t\t$endpointName = \"connections\";\n\t\tif (isset($_GET['endpointName'])) {\n\t\t\t$endpointName = $_GET['endpointName'];\n\t\t}\n\n\t\t$parameters = array(\n\t\t\t\t'callback_uri' => $settings->getOAuth2CallbackURL($endpointName),\n\t\t\t\t'code' => $_GET['code'],\n\t\t\t\t'grant_type' => 'authorization_code',\n\t\t\t\t'client_id' => $settings->getClientId($endpointName),\n\t\t\t\t'client_secret' => $settings->getClientSecret($endpointName)\n\t\t);\n\t\t\n\t\t$tokenURL = $settings->getAccessTokenURL($endpointName) . '?' . http_build_query($parameters, null, '&');\n\t\t$client = new Client($tokenURL);\n\t\t$client->setDefaultOption('verify', false);\n\t\t\n\t\t$headers = null;\n\t\t$body = null;\n\t\t$options = array();\n\t\t$response = null;\n\t\t\n\t\ttry {\n\t\t\t$request = $client->createRequest('GET', $tokenURL, $headers, $body, $options);\n\t\t\tif ($settings->forceSSLTrust($endpointName)) {\n\t\t\t\t$request->getCurlOptions()->set(CURLOPT_SSL_VERIFYHOST, false);\n\t\t\t\t$request->getCurlOptions()->set(CURLOPT_SSL_VERIFYPEER, false);\n\t\t\t}\n\t\t\t$response = $request->send();\n\t\t\n\t\t\tforeach ($response->getHeaderLines() as $h) {\n\t\t\t\tif (strpos($h, \"Content-Type\") === 0) header($h, TRUE);\n\t\t\t}\n\t\t\n\t\t\theader(':', true, $response->getStatusCode());\n\t\t\theader('X-PHP-Response-Code: ' . $response->getStatusCode(), true, $response->getStatusCode());\n\t\t\n\t\t\tparse_str($response->getBody(TRUE), $info);\n\t\t\n\t\t\tif (!isset($info['access_token'])) {\n\t\t\t\tdie('Missing access token. Something went wrong - make sure that your client ID and client secret are correct and try again.');\n\t\t\t}\n\t\t\t\n\t\t\t$accessToken = $store->getOAuthAccessToken($endpointName);\n\t\t\tif ($accessToken == null || $accessToken == \"\") {\n\t\t\t\t$store->storeOAuthAccessToken($info['access_token'], $endpointName);\n\t\t\t}\n\t\t\t\n\t\t\theader(\"Location: \" . $settings->getOAuthOrigin($endpointName));\n\t\t\t\n\t\t} catch(Guzzle\\Http\\Exception\\BadResponseException $e) {\n\t\t\t$response = $e->getResponse();\n\t\t\tprint_r($response->getBody(TRUE));\n\t\t}\n\t}", "function HTTPFailWithCode($code,$message)\n{\n\theader(reasonForCode($code));\n\texit($message);\n}", "private function processCurlCommand($code)\n {\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, \"https://connect.stripe.com/oauth/token\");\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_POSTFIELDS, \"client_secret=\" .\\Config::STRIPE_SECRET . \"&code=$code&grant_type=authorization_code\");\n curl_setopt($ch, CURLOPT_POST, 1);\n $headers = array();\n $headers[] = \"Content-Type: application/x-www-form-urlencoded\";\n curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n $result = curl_exec($ch);\n if (curl_errno($ch)) {\n echo 'Error:' . curl_error($ch);\n }\n\n $obj = json_decode($result,true);\n return $obj['stripe_user_id'];\n }", "function error($code) {\n\tswitch ($code) {\n\t\tcase 'EntityExists':\n\t\t\t$str = 'Cannot complete that action because the entity already exists';\n\t\t\tbreak;\n\t\tcase 'EntityDoesNotExist':\n\t\t\t$str = 'Cannot complete that action because that entity does not exist';\n\t\t\tbreak;\n\t\tcase 'InvalidPassword':\n\t\t\t$str = 'The password supplied is not valid';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t$str = $code;\n\t}\n\treturn $str;\n}", "protected function confirmEmailToken( $code ) {\n\t\tglobal $wgConfirmAccountContact, $wgPasswordSender;\n\n\t\t$reqUser = $this->getUser();\n\t\t$out = $this->getOutput();\n\t\t# Confirm if this token is in the pending requests\n\t\t$name = ConfirmAccount::requestNameFromEmailToken( $code );\n\t\tif ( $name !== false ) {\n\t\t\t# Send confirmation email to prospective user\n\t\t\tConfirmAccount::confirmEmail( $name );\n\n\t\t\t$adminsNotify = ConfirmAccount::getAdminsToNotify();\n\t\t\t# Send an email to admin after email has been confirmed\n\t\t\tif ( $adminsNotify->count() || $wgConfirmAccountContact != '' ) {\n\t\t\t\t$title = SpecialPage::getTitleFor( 'ConfirmAccounts' );\n\t\t\t\t$subject = $this->msg(\n\t\t\t\t\t'requestaccount-email-subj-admin' )->inContentLanguage()->escaped();\n\t\t\t\t$body = $this->msg(\n\t\t\t\t\t'requestaccount-email-body-admin', $name )->params(\n\t\t\t\t\t\t$title->getCanonicalURL() )->inContentLanguage()->text();\n\t\t\t\t# Actually send the email...\n\t\t\t\tif ( $wgConfirmAccountContact != '' ) {\n\t\t\t\t\t$source = new MailAddress( $wgPasswordSender, wfMessage( 'emailsender' )->text() );\n\t\t\t\t\t$target = new MailAddress( $wgConfirmAccountContact );\n\t\t\t\t\t$result = UserMailer::send( $target, $source, $subject, $body );\n\t\t\t\t\tif ( !$result->isOK() ) {\n\t\t\t\t\t\twfDebug( \"Could not sent email to admin at $target\\n\" );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t# Send an email to all users with \"confirmaccount-notify\" rights\n\t\t\t\tforeach ( $adminsNotify as $adminNotify ) {\n\t\t\t\t\tif ( $adminNotify->canReceiveEmail() ) {\n\t\t\t\t\t\t$adminNotify->sendMail( $subject, $body );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t$out->addWikiMsg( 'requestaccount-econf' );\n\t\t\t$out->returnToMain();\n\t\t} else {\n\t\t\t# Maybe the user confirmed after account was created...\n\t\t\t$user = User::newFromConfirmationCode( $code, User::READ_LATEST );\n\t\t\tif ( is_object( $user ) ) {\n\t\t\t\t$user->confirmEmail();\n\t\t\t\t$user->saveSettings();\n\t\t\t\t$message = $reqUser->isLoggedIn()\n\t\t\t\t\t? 'confirmemail_loggedin'\n\t\t\t\t\t: 'confirmemail_success';\n\t\t\t\t$out->addWikiMsg( $message );\n\t\t\t\tif ( !$reqUser->isLoggedIn() ) {\n\t\t\t\t\t$title = SpecialPage::getTitleFor( 'Userlogin' );\n\t\t\t\t\t$out->returnToMain( true, $title );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$out->addWikiMsg( 'confirmemail_invalid' );\n\t\t\t}\n\t\t}\n\t}", "function rest_authorization_required_code()\n {\n }", "public function sendResetCode()\n {\n if (is_null($this->container)) {\n //we don't have a container, therefore no mail handler\n return false;\n }\n $code = $this->getResetCode()->getCode();\n\n $mailer = $this->container->mailer;\n\n $mailer->message->setSubject('Password Reset Code Request for ' . getenv('NAME'));\n $mailer->message->setFrom([getenv('APP_EMAIL_ADDRESS') => getenv('NAME')]);\n $mailer->message->setTo([$this->email]);\n\n $arguments = [\n 'home' => getenv('BASE_URL'),\n 'app_name' => getenv('NAME'),\n 'username' => $this->username,\n 'copyright_year' => date('Y'),\n 'reset_code_lifetime' => (int)getenv('RESET_CODE_LIFETIME'),\n 'action_url' => getenv('BASE_URL') . $this->container->router->pathFor('auth.login')\n . '?username=' . $this->username . '&code=' . $code,\n ];\n\n $mailer->htmlTemplate('password_reset.twig', $arguments);\n $mailer->inlineStyle('password_reset.css');\n $mailer->textTemplate('password_reset.txt', $arguments);\n\n return $mailer->send();\n }", "public function send_sms_verification_code()\n\t{\n\t\t$user_id = Input::get('userId');\n\t\t$phone_number = Input::get('phoneNumber');\n\n\t\t// check if a verify record already exists\n\t\t$verify_record = $this->notifyRepo->smsVerificationCodeByUserId($user_id);\n\n\t\t// create the code, save it, send to user\n\t\t$verify_record = $this->notifyRepo->smsSendVerifyCode($user_id, $phone_number, $verify_record);\n\n\t\t$result = Twilio::message('+'.$phone_number, 'EriePaJobs - Your verification code is '.$verify_record->verification_code);\n\t}", "function check_authcode_phone($phone,$code_type,$user_id=\"\")\n {\n\t\tif($phone)\n\t\t{\n\t\t\tif($this->_redis)\n\t\t\t{\n\n\t\t\t\t$errorcode=$this->check_auth('phone',sha1($phone));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"phone\",sha1($phone));//需要通过服务获得加密后的电话号码\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" - \".Constant::SEND_AUTHCODE_INTERVAL_PHONE)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n }", "function error( $code = 100, $debug_message = null, $secret = null, $addtl_data = array() ) {\n\t\tswitch ($code) :\n\t\t\tcase '101' :\n\t\t\t\t$error = array( 'error' => __( 'Invalid License Key', 'jigoshop-software' ), 'code' => '101' );\n\t\t\tbreak;\n\t\t\tcase '102' :\n\t\t\t\t$error = array( 'error' => __( 'Software has been deactivated', 'jigoshop-software' ), 'code' => '102' );\n\t\t\tbreak;\n\t\t\tcase '103' :\n\t\t\t\t$error = array( 'error' => __( 'Exceeded maximum number of activations', 'jigoshop-software' ), 'code' => '103' );\n\t\t\tbreak;\n\t\t\tcase '104' :\n\t\t\t\t$error = array( 'error' => __( 'Invalid Instance ID', 'jigoshop-software' ), 'code' => '104' );\n\t\t\tbreak;\n\t\t\tcase '105' :\n\t\t\t\t$error = array( 'error' => __( 'Purchase has been upgraded', 'jigoshop-software' ), 'code' => '105' );\n\t\t\tbreak;\n\t\t\tcase '106' :\n\t\t\t\t$error = array( 'error' => __( 'License key for different product. Please check the product for this license key, then download and install the correct product.', 'jigoshop-software' ), 'code' => '106' );\n\t\t\tbreak;\n\t\t\tdefault :\n\t\t\t\t$error = array( 'error' => __( 'Invalid Request', 'jigoshop-software' ), 'code' => '100' );\n\t\t\tbreak;\n\t\tendswitch;\n\t\tif ( isset($this->debug) && $this->debug ) {\n\t\t\tif ( !isset( $debug_message ) || !$debug_message) $debug_message = __( 'No debug information available', 'jigoshop-software' );\n\t\t\t$error['additional info'] = $debug_message;\n\t\t}\n\t\tif ( isset( $addtl_data['secret'] ) ) {\n\t\t\t$secret = $addtl_data['secret'];\n\t\t\tunset( $addtl_data['secret'] );\n\t\t}\n\t\tforeach ( $addtl_data as $k => $v ) {\n\t\t\t$error[$k] = $v;\n\t\t}\n\t\t$secret = ( $secret ) ? $secret : 'null';\n\t\t$error['timestamp'] = time();\n\t\tforeach ( $error as $k => $v ) {\n\t\t\tif ( $v === false ) $v = 'false';\n\t\t\tif ( $v === true ) $v = 'true';\n\t\t\t$sigjoined[] = \"$k=$v\";\n\t\t}\n\t\t$sig = implode( '&', $sigjoined );\n\t\t$sig = 'secret=' . $secret . '&' . $sig;\n\t\tif ( !$this->debug ) $sig = md5( $sig );\n\t\t$error['sig'] = $sig;\n\t\t$json = $error;\n\t\theader( 'Cache-Control: no-store' );\n\t\tif ( function_exists( 'header_remove' ) ) {\n\t\t\theader_remove( 'Cache-Control' );\n\t\t\theader_remove( 'Pragma' );\n\t\t\theader_remove( 'Expires' );\n\t\t\theader_remove( 'Last-Modified' );\n\t\t\theader_remove( 'X-Pingback' );\n\t\t\theader_remove( 'X-Powered-By' );\n\t\t\theader_remove( 'Set-Cookie' );\n\t\t} else {\n\t\t\theader( 'Cache-Control: ' );\n\t\t\theader( 'Pragma: ' );\n\t\t\theader( 'Expires: ' );\n\t\t\theader( 'X-Pingback: ' );\n\t\t\theader( 'X-Powered-By: ' );\n\t\t\theader( 'Set-Cookie: ' );\n\t\t}\n\t\theader( 'Content-Type: application/json' );\n\t\tdie( json_encode( $json ) );\n\t\texit;\n\t}", "public function set_auth_code() {\n\t\t$tokens = new Token_User( '_indieauth_code_' );\n\t\t$tokens->set_user( self::$author_id );\n\t\treturn $tokens->set( static::$test_auth_code, 600 );\n\t}", "function response($code, $errMsg='success') {\n\techo json_encode(array('code' => $code, 'errMsg' => $errMsg));\n\texit(0);\n}", "public function confirmTask()\n\t{\n\t\t// Incoming, some versions of the code used 'code' some use 'confirm'\n\t\t$code = Request::getString('confirm', false);\n\t\tif (!$code)\n\t\t{\n\t\t\t$code = Request::getString('code', false);\n\t\t}\n\n\t\t// Get the return value if it was requested\n\t\t$return = Request::getString('return', false);\n\n\t\t// Check if the user is logged in\n\t\tif (User::isGuest())\n\t\t{\n\t\t\t// See if they've provided an email address as well\n\t\t\t// perhaps we can log them in with that and their token\n\t\t\t$email = Request::getString('email', false);\n\n\t\t\tif ($email != false && Plugin::isEnabled('authentication', 'emailtoken'))\n\t\t\t{\n\t\t\t\t// An email was provided\n\t\t\t\t// Get the Users controller\n\t\t\t\trequire_once Component::path('com_login') . '/site/controllers/auth.php';\n\t\t\t\t$authController = new \\Components\\Login\\Site\\Controllers\\Auth();\n\n\t\t\t\t// Return back here while resetting the return to here\n\t\t\t\t$return = base64_encode(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=' . $this->_task . '&confirm=' . $code . '&return=' . $return, false, true));\n\n\t\t\t\t// Set up a request to send to the login method\n\t\t\t\tRequest::setVar('return', $return);\n\t\t\t\tRequest::setVar('authenticator', 'emailtoken');\n\t\t\t\tRequest::setVar('email', $email);\n\t\t\t\tRequest::setVar('task', 'login');\n\t\t\t\tRequest::setVar('option', 'com_login');\n\n\t\t\t\t$authController->login();\n\t\t\t\t// $authController->login() always redirects, should never make it here\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// Didn't provide enough information, warn about it\n\t\t\t\t// and let them log in to confirm their email address\n\t\t\t\t$return = base64_encode(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=' . $this->_task . '&confirm=' . $code . '&return=' . $return, false, true));\n\t\t\t\tApp::redirect(\n\t\t\t\t\tRoute::url('index.php?option=com_users&view=login&return=' . $return, false),\n\t\t\t\t\tLang::txt('Please login in to confirm your email address.'),\n\t\t\t\t\t'warning'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Grab the authenticator cookie, the user is logged in\n\t\t// Continue confirming the email address\n\t\t$cookie = \\Hubzero\\Utility\\Cookie::eat('authenticator');\n\n\t\t// @FIXME The session is overriding the activation code\n\t\t$xprofile = User::oneByActivationToken(-$code);\n\t\t$user = User::getInstance();\n\n\t\tif ($xprofile->get('id') != $user->get('id'))\n\t\t{\n\t\t\t// Redirect to member dashboard if email is already confirmed\n\t\t\tif ($xprofile->get('id') === 0) {\n\t\t\t\tApp::redirect(\"/members/myaccount\", \"Email is already confirmed. No need to do it again!\", \"warning\");\n\t\t\t}\n\n\t\t\t// Profile and logged in user does not match\n\t\t\t$this->setError('login mismatch');\n\n\t\t\t// Build logout/login/confirm redirect flow\n\t\t\t$login_return = base64_encode(Route::url('index.php?option=' . $this->option . '&controller=' . $this->_controller . '&task=' . $this->_task . '&confirm=' . $code));\n\t\t\t$logout_return = base64_encode(Route::url('index.php?option=com_users&view=login&return=' . $login_return));\n\n\t\t\t$redirect = Route::url('index.php?option=com_users&view=login&task=logout&return=' . $logout_return);\n\t\t}\n\n\n\t\t$email_confirmed = $xprofile->get('activation');\n\n\t\tif ($email_confirmed == 1 || $email_confirmed == 3)\n\t\t{\n\t\t\t// The current user is confirmed - check to see if the incoming code is valid at all\n\t\t\tif (\\Components\\Members\\Helpers\\Utility::isActiveCode($code))\n\t\t\t{\n\t\t\t\t$this->setError('login mismatch');\n\n\t\t\t\t// Build logout/login/confirm redirect flow\n\t\t\t\t$login_return = base64_encode(Route::url('index.php?option=' . $this->option . '&controller=' . $this->_controller . '&task=' . $this->_task . '&confirm=' . $code));\n\t\t\t\t$logout_return = base64_encode(Route::url('index.php?option=com_users&view=login&return=' . $login_return));\n\n\t\t\t\t$redirect = Route::url('index.php?option=com_users&view=login&task=logout&return=' . $logout_return);\n\t\t\t}\n\t\t}\n\t\telseif ($email_confirmed < 0 && $email_confirmed == -$code)\n\t\t{\n\t\t\t//var to hold return path\n\t\t\t$return = '';\n\n\t\t\t// get return path\n\t\t\t$cReturn = $this->config->get('ConfirmationReturn');\n\t\t\tif ($cReturn)\n\t\t\t{\n\t\t\t\t$return = $cReturn;\n\t\t\t}\n\n\t\t\t//check to see if we have a return param\n\t\t\t$pReturn = base64_decode(urldecode($xprofile->getParam('return')));\n\t\t\tif ($pReturn)\n\t\t\t{\n\t\t\t\t$return = $pReturn;\n\t\t\t\t$xprofile->setParam('return', '');\n\t\t\t}\n\n\t\t\t// make as confirmed\n\t\t\t$xprofile->set('activation', 1);\n\n\t\t\t// set public setting\n\t\t\t$xprofile->set('access', $this->config->get('privacy', 1));\n\n\t\t\t// update profile\n\t\t\tif (!$xprofile->save())\n\t\t\t{\n\t\t\t\t$this->setError(Lang::txt('COM_MEMBERS_REGISTER_ERROR_CONFIRMING'));\n\t\t\t}\n\n\t\t\t// if the user just changed their email & confirmed\n\t\t\t// reset 'userchangedemail' key\n\t\t\tif (Session::get('userchangedemail', 0) == 1)\n\t\t\t{\n\t\t\t\tSession::set('userchangedemail', 0);\n\t\t\t}\n\n\t\t\tEvent::trigger('onUserAfterConfirmEmail', array($xprofile->toArray()));\n\n\t\t\t// Redirect\n\t\t\tif (empty($return))\n\t\t\t{\n\t\t\t\t$r = $this->config->get('ConfirmationReturn');\n\t\t\t\t$return = ($r) ? $r : Route::url('index.php?option=com_members&task=myaccount');\n\n\t\t\t\t// consume cookie (yum) if available to return to whatever action prompted registration\n\t\t\t\tif (isset($_COOKIE['return']))\n\t\t\t\t{\n\t\t\t\t\t$return = $_COOKIE['return'];\n\t\t\t\t\tsetcookie('return', '', time() - 3600);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tApp::redirect($return, '', 'message', true);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->setError(Lang::txt('COM_MEMBERS_REGISTER_ERROR_INVALID_CONFIRMATION'));\n\t\t}\n\n\t\t// Set the pathway\n\t\t$this->_buildPathway();\n\n\t\t// Set the page title\n\t\t$this->_buildTitle();\n\n\t\t// Instantiate a new view\n\t\t$this->view\n\t\t\t->set('title', Lang::txt('COM_MEMBERS_REGISTER_CONFIRM'))\n\t\t\t->set('login', $xprofile->get('username'))\n\t\t\t->set('email', $xprofile->get('email'))\n\t\t\t->set('code', $code)\n\t\t\t->set('redirect', (isset($return) ? $return : ''))\n\t\t\t->set('sitename', Config::get('sitename'))\n\t\t\t->setErrors($this->getErrors())\n\t\t\t->display();\n\t}", "public function getCode()\n {\n return $this->isSuccessful() ? $this->data[\"AuthCode\"] : parent::getCode();\n }", "public function send_email_para_validacao($email, $code_validacao_email) {\n\t\t\n\t\t$email_md5 = md5($email);\n\t\t\t\t\n\t\t$url_validacao = \"http://localhost/www.invoice.artsulgranitos.com.br/validation.php?c=$code_validacao_email&m=$email_md5\";\n\t\t\n\t\t$headers = \"MIME-Version:1.0\\n\";\n\t\t$headers .= \"Content-type:text/html; charset=UTF-8\\n\";\n\t\t$headers .= \"From:$email\";\n\n\t\t$subject = \"ARTSUL INVOICE-PRO - LINK PARA LOGIN\";\n\t\t\n\t\t$mensagem = \"Olá.\".\"<br>\";\n\t\t$mensagem .= \"<br><br>\";\n\t\t$mensagem .= \"Seu login para o INVOICE-PRO está disponível nos seguinte link:\";\n\t\t$mensagem .= \"<br>\";\n\t\t$mensagem .= $url_validacao;\n\t\t$mensagem .= \"<br>\";\n\t\t$mensagem .= \"Clique no link para cadastrar uma senha e entrar no sistema.\";\n\t\t$mensagem .= \"<br>\";\n\t\t$mensagem .= \"Obrigado!\";\n\t\t$mensagem .= \"Att, Art Sul\";\n\t\t\n\t\t$resMail = null;\n\t\t$resMail = mail($to, $subject, $mensagem, $headers);\n\n\t\t\n\t\tif ($resMail) {\n\t\t\treturn array('transaction' => 1, 'url' => $url_validacao );\t\t\t\n\t\t} else {\n\t\t\treturn array('transaction' => 0, 'url' => $url_validacao );;\n\t\t} \n\t}", "abstract public function checkCode(string $uuid, string $code, int $successFlag = self::NOTHING_ON_SUCCESS);", "public function authenticate()\n\t{\n\t\tif ($data['code'] = $this->input->get('code', false, 'raw'))\n\t\t{\n\t\t\t$data['grant_type'] = 'authorization_code';\n\t\t\t$data['redirect_uri'] = $this->getOption('redirecturi');\n\t\t\t$data['client_id'] = $this->getOption('clientid');\n\t\t\t$data['client_secret'] = $this->getOption('clientsecret');\n\t\t\t$response = $this->http->post($this->getOption('tokenurl'), $data);\n\n\t\t\tif ($response->code >= 200 && $response->code < 400)\n\t\t\t{\n\n\t\t\t\tif ($response->headers['Content-Type'] == 'application/json')\n\t\t\t\t{\n\t\t\t\t\t$token = array_merge(json_decode($response->body, true), array('created' => time()));\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tparse_str($response->body, $token);\n\t\t\t\t\t$token = array_merge($token, array('created' => time()));\n\t\t\t\t}\n\n\t\t\t\t$this->setToken($token);\n\n\t\t\t\treturn $token;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthrow new RuntimeException('Error code ' . $response->code . ' received requesting access token: ' . $response->body . '.');\n\t\t\t}\n\t\t}\n\n\t\tif ($this->getOption('sendheaders'))\n\t\t{\n\t\t\t$this->application->redirect($this->createUrl());\n\t\t}\n\t\treturn false;\n\t}", "function respond($code, $message) {\n header('Content-Type: application/json');\n header(\"X-PHP-Response-Code: $code\", true, $code);\n echo '{\"message\": \"' . $message . '\"}';\n die();\n}", "function stub() {\r\n\t$a = array(\r\n\t\t'status' => 'system-error'\r\n\t);\r\n\r\n\t// raw inputs\r\n\t$taint_si = isset($_POST['si']) ? $_POST['si'] : 0;\r\n\t$taint_a = isset($_POST['a']) ? $_POST['a'] : 0;\r\n\t$taint_b = isset($_POST['b']) ? $_POST['b'] : 0;\r\n\r\n\t// validate inputs\r\n\t$si = validateToken($taint_si);\r\n\t$a = validateUname($taint_a);\r\n\t$b = validateUname($taint_b);\r\nLog::write(LOG_WARNING, \"$a,$b,$si\";\r\n\r\n\t// validate parameter set\r\n\tif (!$si || !$a || !$b){\r\n\t\tLog::write(LOG_WARNING, 'attempt with invalid parameter set');\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// get database connection\r\n\t$conn = getConnection();\r\n\tif (!$conn) {\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// get logged-in user\r\n\t$result = getUserByToken($conn, $si);\r\n\tif (!$result) {\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// get data fields\r\n\t$row = pg_fetch_array($result, 0, PGSQL_ASSOC);\r\n\t$username = $row['username'];\r\n\t$access = $row['access'];\r\n\t$auth = $row['auth'];\r\n\t$email = $row['email'];\r\n\r\n\t// verify user authentication state\r\n\tif (!isUserVerified($auth)) {\r\n\t\tLog::write(LOG_NOTICE, \"attempt by non-verified user\");\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// compose output message\r\n\t$message = \"a is $a and b is $b and email is \" . obscureEmail($email);\r\n\r\n\t// success\r\n\t$a['status'] = 'ok';\r\n\t$a['message'] = $message;\r\n\treturn $a;\r\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}", "function sendPassRecLink(string $email) {\n\n }", "public function prompt($data = [])\n {\n if (isset($_GET['error'])) {\n throw new Exceptions\\ProAuth($_GET['error']);\n } elseif (isset($_GET['code'])) {\n $this->grant('authorization_code', [\n 'code' => $_GET['code'],\n 'redirect_uri' => $this->callback\n ]);\n } else {\n $data['client_id'] = $this->id;\n $data['response_type'] = 'code';\n $data['scope'] = implode(' ', $this->scope);\n $data['redirect_uri'] = $this->callback;\n\n $url = $this->authorizeEndpoint . '?' . http_build_query($data);\n header('Location: ' . $url);\n exit();\n }\n }", "public function errorcode();", "function actiongetVerifyCode()\n\t{\n\t\t$jsonarray= array();\n\t\t\n\t\tif(isset($_POST['phone']))\n\t\t{\n\t\t\t$userObj=new Users();\n\t\t\tif(!is_numeric($_POST['phone'])){\n\t\t\t\t$algoencryptionObj\t=\tnew Algoencryption();\n\t\t\t\t$_POST['phone']\t=\t$algoencryptionObj->decrypt($_POST['phone']);\n\t\t\t}\n\t\t\t$result=$userObj->getVerifyCodeById($_POST['phone'],'-1');\n\t\t\t$jsonarray['status']=$result['status'];\n\t\t\t$jsonarray['message']=$result['message'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$message=$this->msg['ONLY_PHONE_VALIDATE'];\n\t\t\t$jsonarray['status']='false';\n\t\t\t$jsonarray['message']=$message;\n\t\t}\n\t\techo $jsonarray['message'];\n\t}", "function check_reffer_code(){\n\t$reffer_code=$_REQUEST['reffer_code'];\n\tif(!empty($reffer_code)){\n\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\tif(!empty($reffer_records)){\n\t\t\t$user_id=$reffer_records[0]['user_id'];\n\t\t\t$user_reffer_code=$reffer_records[0]['user_refferal_code'];\n\t\t\tif($user_reffer_code==$reffer_code){\n\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Reffer code avalible\", 'reffer_code' => $reffer_code,'user_id'=>$user_id);\n\t\t\t}else{\n\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t}\n\t\t\t\n\t\t}else{\n\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t}\n\t}else{\n\t\t$post = array(\"status\" => \"false\", \"message\" => \"Missing parameter\",'reffer_code'=>$reffer_code);\n\t}\n\techo $this -> json($post);\n}", "public function performActivation($_code, $send_mail = null) {\n $this->errorCode = 0;\n if (!isset($send_mail))\n $send_mail = $this->sendMail;\n $code = LEmailAccountActivation::model()->findByAttributes(array('code' => $_code));\n if (!isset($code)) {\n $this->errorCode = 1;\n Yii::log(\"performActivation: failed to find code record code $_code.\", CLogger::LEVEL_INFO, 'lily');\n return null;\n }\n if (time() > $code->created + $this->activationTimeout) {\n if (!$code->delete())\n throw new CDbException(\"can't delete code\");\n $this->errorCode = 2;\n Yii::log(\"performActivation: activation code $_code expired.\", CLogger::LEVEL_INFO, 'lily');\n return null;\n }\n $account = LAccount::create('email', $code->email, (object) array('password' => $code->password), $code->uid);\n if (!isset($account)) {\n throw new CDbException(\"performActivation: failed to create LAccount record (code $_code).\");\n }\n if (LEmailAccountActivation::model()->deleteAllByAttributes(array('email' => $code->email)) < 1) {\n throw new CDbException(\"performActivation: failed to delete all codes of $code->email.\");\n }\n Yii::log(\"performActivation: new account by code $_code was created (aid $account->aid).\", CLogger::LEVEL_INFO, 'lily');\n if ($send_mail) {\n $result = $this->sendInformationMail($account);\n if (!$result) {\n $this->errorCode = 3;\n }\n }\n return $account;\n }", "public function performRequest($email=null){\r\n\t\tif( $email!=null ){\r\n\t\t\t$this->setLookupEmail($email);\r\n\t\t}\r\n\t\tif( $this->apiKey==\"\" ) throw new Exception('The API Key has not been set. (Method to use: setAPIKey(\"123...\") )');\r\n\t\tif( $this->lookupEmail==\"\" ) throw new Exception('The Email address to lookup has not been set. (Method to use: setLookupEmail(\"[email protected]\") )');\r\n\t\t$plainTextOutput = file_get_contents('http://email-validation-api.com/api/'.$this->outputFormat.'/?key='.$this->apiKey.'&email='.$this->lookupEmail);\r\n\t\treturn $plainTextOutput;\r\n\t}", "function loginFail($type) {\n echo json_encode(['code'=>$type]);\n\n exit();\n}", "public function check_promocode() {\n\t\t\t\t $usertypes = $this->users->checkUserTypeLaabus($this->session->userdata('user_id'));\n\t\t\t\t $agent_id = $usertypes[0]->agent_id;\n\t\t\t\t// print_r($usertypes);\n\t\t\t\tif(empty($agent_id))\n\t\t\t\t{\n\t\t\t\t\t$role_id = 4;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$role_id =44;\n\t\t\t\t}\n\t\t$data = $this->users->check_promocode($_REQUEST['promo_code'],$_REQUEST['amount'],$role_id);\n\t\techo $data;\n\t\texit;\n\t}", "function verifica_email ($email)\r\n{\r\n\t$retorno = true;\r\n\r\n\t/* Aqui estaria el codigo para verificar \r\n\tla direccion de correo */\r\n\r\n\treturn $retorno;\r\n}", "protected function sendCode($code) {\n $to = $this->getAccountNumber();\n try {\n $message = $this->client->account->messages->sendMessage($this->twilioNumber, $to, t($this->messageText, array('!code' => $code)));\n // @todo Consider storing date_sent or date_updated to inform user.\n watchdog('tfa_basic', 'Message !id sent to user !uid on @sent', array(\n '@sent' => $message->date_sent,\n '!id' => $message->sid,\n '!uid' => $this->context['uid'],\n ), WATCHDOG_INFO);\n return TRUE;\n }\n catch (Services_Twilio_RestException $e) {\n // @todo Consider more detailed reporting by mapping Twilio error codes to\n // messages.\n watchdog('tfa_basic', 'Twilio send message error to user !uid @code @link', array(\n '!uid' => $this->context['uid'],\n '@code' => $e->getStatus(),\n '@link' => $e->getInfo(),\n ), WATCHDOG_ERROR);\n return FALSE;\n }\n }", "public function EmailConfirm($code, $id){\n\t\t$restaurantGroup= Sentry::findGroupById(6);\n\t\t$activeUser\t\t= Sentry::findUserById($id);\n\n\t\t// $now\t\t\t= time();\n\t\t// need to create time limition\n\t\tif($activeUser->attemptActivation($code)){\n\t\t\t//activation is success\n\t\t\tLog::info('active the user : '.$id);\n\t\t\tif($activeUser->addGroup($restaurantGroup)){\n\t\t\t\tLog::info('add the user into the restaurant id : '.$id);\n\t\t\t\t$user = Sentry::login($activeUser, false);\n\t\t\t\tLog::info('success to login to the Food Order');\n\t\t\t\treturn Redirect::route('r.description.create');\n\t\t\t}else{\n\t\t\t\tLog::info('fail to add the user into the restaurant');\n\t\t\t}\n\t\t}else{\n\t\t\t//activation is fail\n\t\t\tLog::info('fail to active the user : '.$id);\n\t\t\treturn Response::view('fail to active the user', array(), 404);\n\t\t}\n\t}", "public function emailCode(Request $request,$email_id){\n\n $attempt=LoginAttempt::getCurrentAttempt($request);\n \n $email_channel=new Email; \n\n if(!AuthVerificationManager::has2Verify($attempt)){\n return $this->intended();\n }\n if(!$attempt->canVerify($email_channel)){\n return redirect()->route('user-auth-v');\n }\n\n\n\n\n // If email_id is valid we assume that someone is messing the url and restart the process\n $validator=Validator::make(['email_id'=>$email_id],[\n 'email_id'=>'required|integer|max:250000000'\n ]);\n\n if($validator->fails()){\n return redirect(route('user-auth-v').'/channel/email');\n }\n\n $email=$request->user()->getConfirmedEmailById(intval($email_id));\n $masked_email=$email['masked_email'];\n\n $pageTitle='Email verification';\n return view('laradmin::user.auth_verification.channels.email.code',compact(['pageTitle','email_id','masked_email']));\n\n }", "function requestAccessToken ($code, $server_domain) {\n $url = 'https://' . $server_domain . '/oauth/token/?' .\n 'grant_type=authorization_code'.\n '&client_id='.urlencode(APP_ID).\n '&client_secret='.urlencode(APP_SECRET_CODE).\n '&code='.urlencode($code);\n return executeHTTPRequest($url);\n}", "function email_activation($activationCode,$form)\n\t{\n\t\t$emailaddress = $this->namedFields['email']->getData();\n\t\t$site_address = SITE_ADDRESS;\n $site_address .= (substr(SITE_ADDRESS, -1) == '/') ? '' : '/';\n\t\t$link = $site_address.'sign_up?activate_code='.$activationCode;\n\t\t$body = \"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Transitional//EN\\\" \\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\\"><html xmlns=\\\"http://www.w3.org/1999/xhtml\\\" lang=\\\"en\\\" xml:lang=\\\"en\\\"><head><title>Church Growth Research Programme</title><style type=\\\"text/css\\\"><!-- body { background:#ffffff; margin:0; padding:0; } p { font-family:Arial, Helvetica, sans-serif; font-size:14px; color:#000000; line-height:22px; margin:10px 0px 10px 0px; text-align:left; } h1, h2, h3, h4, h5, h6 { font-family:Arial, Helvetica, sans-serif; } a { color:#2a6307; outline:none; text-decoration:underline; } a:hover { color:#569823; text-decoration:underline; } --> </style></head><body bgcolor=\\\"#fff\\\"><div align=\\\"center\\\"><table width=\\\"600\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\" style=\\\"border:none;\\\"><tbody><tr><td><img width=\\\"600\\\" vspace=\\\"0\\\" hspace=\\\"0\\\" height=\\\"188\\\" border=\\\"0\\\" align=\\\"top\\\" src=\\\"http://www.churchgrowthresearch.org.uk/images/emailheader.jpg\\\" alt=\\\"Church Growth Research Programme\\\" /></td></tr><tr><td bgcolor=\\\"#fbf5de\\\" style=\\\"padding:0px 30px 0px 30px;\\\"><p>Welcome to the Church Growth Research Programme.</p><p>Please click on the link below to activate your account:<p>\".\n\t\t\t\"<p><a href=\\\"$link\\\">$link</a></p><p>Thank you, the Church Growth Reseach Programme website team.</p>\".\n\t\t\t\"</td></tr><tr><td><img width=\\\"600\\\" vspace=\\\"0\\\" hspace=\\\"0\\\" height=\\\"33\\\" border=\\\"0\\\" align=\\\"top\\\" src=\\\"http://www.churchgrowthresearch.org.uk/images/emailfooter.jpg\\\" alt=\\\"Church Growth Research Programme\\\" /></td></tr></tbody></table></div></body></html>\";\n\t\t$from_email_address = $form['email'];\n\t\t$this->send_mail($emailaddress, SITE_NAME, $from_email_address, 'Account Activation', $body, $body_text);\n\n\t}", "public function getAccessTokenFromAuthCode($auth_code,$state) {\n\t\t//Compare state to make sure it is the same. It is your job to retreive the state from your database and compare it\n\t\t//to what was echoed back to you after authorizing.\n\n\t\tif($this->state != $state) return null; //state did not match\n\t\t\n\t\t//array causes Content-Type:multipart/form-data\t\t\n\t\t$post = array(\"grant_type\"=>\"authorization_code\",\"code\"=>$auth_code,'vers'=>$this->app_version,'os'=>$this->os_version,'device'=>$this->device_name,'udid'=>$this->device_id);\n\t\t\n\t\t//str causes Content-Type:application/x-www-form-urlencoded (both work for code exchange)\n\t\t//$post = \"grant_type=authorization_code&code=\".$auth_code;\n\n\n\t\t$ci = curl_init();\n\t\tcurl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);\n\t\tcurl_setopt($ci, CURLOPT_USERPWD, $this->clientID . \":\" . $this->clientSecret);\n\t\tcurl_setopt($ci, CURLOPT_POST, TRUE);\n\t\tcurl_setopt($ci, CURLOPT_POSTFIELDS, $post);\n\t\tcurl_setopt($ci, CURLOPT_URL, $this->token_url);\n\t\t$response = curl_exec($ci);\n\t\tcurl_close ($ci);\n\n\t\t$response = json_decode($response,true);\n\t\treturn $response;\n\t}", "function send_mail() {\n $email=$_GET['email'];\n $pcode=$_GET['pcode'];\n $url = 'http://api.sendcloud.net/apiv2/mail/send';\n $API_USER = 'zhexiaolong_test_YFAWCy';\n $API_KEY = '6U6wJSwJ7Rrc8LiM';\n $vars = json_encode( array(\"to\" => array($email),\n \"sub\" => array(\"%code%\" => Array('123456'))\n)\n);\n\n //您需要登录SendCloud创建API_USER,使用API_USER和API_KEY才可以进行邮件的发送。\n $param = array(\n 'apiUser' => $API_USER,\n 'apiKey' => $API_KEY,\n 'from' => '[email protected]',\n 'fromName' => '软科商城的问候',\n 'xsmtpapi' => $vars,\n 'templateInvokeName' => 'test_template',\n 'subject' => '尊敬的客户,谢谢您注册软科商城',\n 'html' => '您的验证码是'.$pcode.'仅注册有效',\n 'respEmailId' => 'true');\n\n $data = http_build_query($param);\n\n $options = array(\n 'http' => array(\n 'method' => 'POST',\n 'header' => 'Content-Type: application/x-www-form-urlencoded',\n 'content' => $data\n ));\n\n $context = stream_context_create($options);\n $result = file_get_contents($url, false, $context);\n\n return $result;\n }", "public function getTwoStepVerificationCode();", "function sendAccountActivationCode($userData, $code)\n {\n $this->getCountryCode($userData->country_id);\n $template = 'USR002';\n $username = \"$userData->first_name $userData->last_name\";\n $replace = ['[UserName]', '[UserActivationCode]'];\n $with = [$username, $code];\n $to = $this->countryCode . (int) $userData->mobile_no;\n parent::sendSms($to, $replace, $with, $template);\n }", "public function check_register_code($user_login)\n {\n // Wrong Token Message\n $wrong_token = array(\n 'message' => __('Your authentication code is incorrect', 'wordpress-acl')\n );\n\n // Only Check Register Code\n if (isset($_REQUEST['do_action']) and $_REQUEST['do_action'] == \"check_register_code\") {\n\n // Get User Mobile\n $user_mobile = $user_login;\n $code = sanitize_text_field($_REQUEST['code']);\n\n // Check User Code\n $code_query = self::check_user_opt_code($code, 'mobile', $user_mobile);\n if ($code_query != false and self::check_expire_time_user_otp($code_query) === true) {\n // True\n wp_send_json_success(array(\n 'code' => $code\n ), 200);\n } else {\n // False\n wp_send_json_error($wrong_token, 400);\n }\n }\n\n // Check User code in Register\n if (!isset($_REQUEST['code']) || (isset($_REQUEST['code']) and empty($_REQUEST['code']))) {\n wp_send_json_error($wrong_token, 400);\n }\n $code_query = self::check_user_opt_code($_REQUEST['code'], 'mobile', $user_login);\n if ($code_query === false) {\n wp_send_json_error($wrong_token, 400);\n }\n if (self::check_expire_time_user_otp($code_query) === false) {\n wp_send_json_error(array(\n 'message' => __('Your authentication code has expired', 'wordpress-acl')\n ), 400);\n }\n\n // Check Persian first_name and last_name\n if(empty($_REQUEST['first_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خود را وارد نمایید'\n ), 400);\n }\n if(empty($_REQUEST['last_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را وارد نمایید'\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['first_name']) ===false) {\n wp_send_json_error(array(\n 'message' => __('لطفا نام خود را به فارسی وارد کنید', 'wordpress-acl')\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['last_name']) ===false) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را به فارسی تایپ کنید'\n ), 400);\n }\n }", "protected function getAuthorizationCode()\n {\n $code = null;\n if ($this->responseMode === 'query' && isset($_GET['code'])) {\n $code = $_GET['code'];\n } else if ($this->responseMode === 'form_post' && isset($_POST['code'])) {\n $code = $_POST['code'];\n }\n\n return $code;\n }", "public function getUserActivation($email,$code){\n\t\t$emptyModelInstance = Sentry::getUserProvider()->getEmptyUser();\n\n\t\t// Now, you have any methods available that you'd like. Retrieve a new instance, query\n\t\t// against anything. Because our User model implements the right interfaces, it plays nicely\n\t\t// with Sentry.\n\t\t$user = $emptyModelInstance->where('email', '=', $email)->first();\n\n\t\t// Continue on as you were...\n\t\ttry\n\t\t{\n\t\t // Find the user using the user id\n\t\t //$user = Sentry::findUserById(1);\n\n\t\t // Attempt to activate the user\n\t\t if ($user->attemptActivation($code))\n\t\t {\n\t\t return Redirect::to('/')\n\t\t\t\t\t->with('success','You\\' ve logged in successfully!');\n\t\t }\n\t\t else\n\t\t {\n\t\t // User activation failed\n\t\t }\n\t\t}\n\t\tcatch (Cartalyst\\Sentry\\Users\\UserNotFoundException $e)\n\t\t{\n\t\t echo 'User was not found.';\n\t\t}\n\t\tcatch (Cartalyst\\Sentry\\Users\\UserAlreadyActivatedException $e)\n\t\t{\n\t\t echo 'User is already activated.';\n\t\t}\n\t}", "public function get_auth_code( $code ) {\n\t\t$tokens = new Token_User( '_indieauth_code_' );\n\t\treturn $tokens->get( $code );\n\t}", "function register_user($first_name,$last_name,$username,$email,$password)\n{\n $first_name = escape($first_name);\n $last_name = escape($last_name);\n $username = escape($username);\n $email = escape($email);\n $password = escape($password);\n if (email_exists($email)) {\n return false;\n } elseif (username_exists($username)) {\n return false;\n } else {\n $password = md5($password);\n $validation_code = md5($username . microtime());\n $sql = \"INSERT INTO users(first_name, last_name, username, email, password, validation_code, active)\";\n $sql .= \" VALUES('$first_name','$last_name','$username','$email','$password','$validation_code',0)\";\n $result = query($sql);\n\n ///// sending email////////\n $subject = \"Activate Account\";\n $msg = \" Please click the link below to activate your account\n http://localhost/login/activate.php?email=$email&code=$validation_code \n \";\n $headers = \"From: [email protected]\";\n send_email($email, $subject, $msg, $headers);\n\n return true;\n }\n\n}", "public function sendEDM($type, $emaildata) {\n $subject_admin = '';\n $content_admin = '';\n $storename = $emaildata['storename'];\n $fromemail = $emaildata['from'];\n $myto = $emaildata['to'];\n $username = $emaildata['username'];\n $key = 'f894535ddf80bb745fc15e47e42a595e';\n\n if ($type == 1) {\n $auto_otp = $emaildata['otp'];\n\n if ($auto_otp != '') {\n $subject = 'Thank you for registering with ' . $storename . '. Verify your e-mail address';\n $content = \"Hi \" . $username . \",<br /><br />\n\t\t\t\t\t\t\tIn order to activate your \" . $storename . \" account, we need to verify your email address. Please use the authentication code below to log in:<br /><br />\n\t\t\t\t\t\t\t\" . $auto_otp . \"<br /><br />\n\t\t\t\t\t\t\tWishing you a great experience at \" . $storename . \".<br /><br />\n\t\t\t\t\t\t\tBest Regards,<br />\n\t\t\t\t\t\t\tTeam \" . $storename;\n } else {\n $subject = 'Congratulations! You are now registered on ' . $storename;\n $content = \"Hi \" . $username . \",<br /><br />\n\t\t\t\t\t\t\tThank you for verifying your email address. You are now successfully registered on \" . $storename . \" app. Get your palate ready for some delicious food!<br /><br />\n\t\t\t\t\t\t\tBest Regards,<br />\n\t\t\t\t\t\t\tTeam \" . $storename;\n }\n } elseif ($type == 2) {\n $subject = 'Congratulations! You are now registered on ' . $storename;\n $content = \"Hi \" . $username . \",<br /><br />\n\t\t\t\t\t\tThank you for verifying your email address. You are now successfully registered on \" . $storename . \" app. Get your palate ready for some delicious food!<br /><br />\n\t\t\t\t\t\tBest Regards,<br />\n\t\t\t\t\t\tTeam \" . $storename;\n } elseif ($type == 3) {\n $subject = 'Thank you for registering with ' . $storename;\n $content = \"Hi \" . $username . \",<br /><br />\n\t\t\t\t\t\tThank you for your registration request with \" . $storename . \". We will verify the registration and revert within 24 hrs.<br /><br />\n\t\t\t\t\t\tBest Regards,<br />\n\t\t\t\t\t\tTeam \" . $storename;\n\n // email to Admin\n if ($emaildata['is_verified'] == 0) { // if not whitelisted domain\n $name = $emaildata['name'];\n $time = date('Y-m-d H:i:s');\n $mob = $emaildata['phone'];\n $timestamp = strtotime(\"now\");\n $base_user_id = $emaildata['base_user_id'];\n $subject_admin = 'Admin, you have received a registration request';\n $content_admin = 'Hi Admin,<br /><br />\n\t\t\t\t\t\t\t\t\tYou have received a registration request for PuristMeal app. Here are the details: <br /><br />\n\t\t\t\t\t\t\t\t\tUser Name: ' . $name . '<br />\n\t\t\t\t\t\t\t\t\tRegistration Time: ' . $time . '\n\t\t\t\t\t\t\t\t\tUser Email: <b>' . $myto . '</b><br />\n\t\t\t\t\t\t\t\t\tUser Mobile: ' . $mob . '<br /><br /> \n\t\t\t\t\t\t\t\t\tPlease <a href=\"http://52.41.179.72/users/' . $base_user_id . '/1/' . $timestamp . '\">ACCEPT</a> or <a href=\"http://52.41.179.72/users/' . $base_user_id . '/0/' . $timestamp . '\">DECLINE</a> the registration.\n\t\t\t\t\t\t\t\t\t<br /><br />\n\t\t\t\t\t\t\t\t\tBest Regards,<br />\n\t\t\t\t\t\t\t\t\tTeam ' . $storename;\n }\n } elseif ($type == 4) {\n $status = $emaildata['status'];\n if ($status == 1) {\n $subject = 'Congratulations! You are now registered on ' . $storename;\n $content = \"Hi \" . $username . \",<br /><br />\n\t\t\t\t\t\t\tCongratulations! You have got successfully registered on PuristMeal App. Get your palate ready for some delicious food.<br /><br />\n\t\t\t\t\t\t\tJust log in and start ordering.<br /><br />\n\t\t\t\t\t\t\tBest Regards,<br />\n\t\t\t\t\t\t\tTeam \" . $storename;\n } else {\n $subject = 'Sorry! Your registration request was not approved';\n $content = \"Hi \" . $username . \",<br /><br />\n\t\t\t\t\t\t\tOops! It seems like your registration request was not approved. If you have any queries, please contact us at <a href='mailto:[email protected]'>[email protected]</a><br /><br />\n\t\t\t\t\t\t\tBest Regards,<br />\n\t\t\t\t\t\t\tTeam \" . $storename;\n }\n } elseif ($type == 5) {\n $password = $emaildata['password'];\n $subject = $storename . ' App - Reset your password';\n $content = \"Hi \" . $username . \",<br /><br />\n\t\t\t\t\t\tOops! It seems like you have forgotten your password. Don't worry. Just use the activation code below to reset your password:<br /><br />\n\t\t\t\t\t\t\" . $password . \"<br /><br />\n\t\t\t\t\t\tIf you did not submit a password reset request for your account, please ignore this e-mail.<br /><br />\n\t\t\t\t\t\tBest Regards,<br />\n\t\t\t\t\t\tTeam \" . $storename;\n } elseif ($type == 6) {\n $subject = 'Your meal is on the way!';\n $content = \"Hi \" . $username . \",<br /><br />\n\t\t\t\t\t\t Thanks for ordering with \" . $storename . \" app. We are preparing your order now.<br /><br />\";\n if ($emaildata['date_time'] == 1) {\n $content .= \"Your order will be delivered on \" . $emaildata['delivery_date'] . \" between \" . $emaildata['time_slot'] . \"<br /><br />\";\n } elseif ($emaildata['date_time'] == 2) {\n $content .= \"Your order will be delivered between \" . $emaildata['time_slot'] . \"<br /><br />\";\n }\n $content .= \"Best Regards,<br />\n\t\t\t\t\t\t Team \" . $storename;\n } elseif ($type == 7) {\n $password = $emaildata['password'];\n $subject = $storename . ' App - New password';\n $content = \"Hi \" . $username . \",<br /><br />\n\t\t\t\t\t\tA new password was requested from \" . $storename . \"<br /><br />\n\t\t\t\t\t\tYour new password is:\" . $password . \"<br /><br />\n\t\t\t\t\t\tBest Regards,<br />\n\t\t\t\t\t\tTeam \" . $storename;\n }\n\n $curl = curl_init();\n curl_setopt_array($curl, array(\n CURLOPT_RETURNTRANSFER => 1,\n CURLOPT_URL => 'https://api.falconide.com/falconapi/web.send.rest',\n CURLOPT_POST => 1,\n CURLOPT_POSTFIELDS => array(\n 'api_key' => $key,\n 'subject' => $subject,\n 'fromname' => $storename,\n 'from' => $fromemail,\n 'content' => $content,\n 'recipients' => $myto\n )\n ));\n $customerhead = curl_exec($curl);\n\n curl_close($curl);\n\n // if email need to send to Admin\n if ($subject_admin != '' && $content_admin != '') {\n $curl_admin = curl_init();\n curl_setopt_array($curl_admin, array(\n CURLOPT_RETURNTRANSFER => 1,\n CURLOPT_URL => 'https://api.falconide.com/falconapi/web.send.rest',\n CURLOPT_POST => 1,\n CURLOPT_POSTFIELDS => array(\n 'api_key' => $key,\n 'subject' => $subject_admin,\n 'fromname' => $storename,\n 'from' => $fromemail,\n 'content' => $content_admin,\n 'recipients' => $fromemail\n )\n ));\n $adminSendCheck = curl_exec($curl_admin);\n\n curl_close($curl_admin);\n }\n }", "public function authenticate_code($classname, $code){\n $query = \"SELECT classcode FROM classes where classname = $1;\";\n $query_result = pg_prepare($this->con, \"myquery15\", $query);\n $query_result = pg_execute($this->con, \"myquery15\", array($classname));\n $row = pg_fetch_row($query_result);\n if($row[0] == $code){ //Accesscode matched\n echo(\"Access Code matched\");\n return True;\n }\n else{return False;}\n\n\n }", "function authCode($r,$extra='')\t{\n\t\t$l=$this->codeLength;\n\t\tif ($this->conf['authcodeFields'])\t{\n\t\t\t$fieldArr = t3lib_div::trimExplode(',', $this->conf['authcodeFields'], 1);\n\t\t\t$value='';\n\t\t\twhile(list(,$field)=each($fieldArr))\t{\n\t\t\t\t$value.=$r[$field].'|';\n\t\t\t}\n\t\t\t$value.=$extra.'|'.$this->conf['authcodeFields.']['addKey'];\n\t\t\tif ($this->conf['authcodeFields.']['addDate'])\t{\n\t\t\t\t$value.='|'.date($this->conf['authcodeFields.']['addDate']);\n\t\t\t}\n\t\t\t$value.=$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];\n\t\t\treturn substr(md5($value), 0,$l);\n\t\t}\n\t}", "function clientCode(SubjectInterface $subject)\r\n{\r\n // ...\r\n\r\n $subject->request();\r\n\r\n // ...\r\n}", "function browserCredentials() {\n if(isset($_GET['code'])) return true;\n\n return false;\n}", "public function send(){\n\t\t$statusStr = array(\n\t\t\"0\" => \"短信发送成功\",\n\t\t\"-1\" => \"参数不全\",\n\t\t\"-2\" => \"服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!\",\n\t\t\"30\" => \"密码错误\",\n\t\t\"40\" => \"账号不存在\",\n\t\t\"41\" => \"余额不足\",\n\t\t\"42\" => \"帐户已过期\",\n\t\t\"43\" => \"IP地址限制\",\n\t\t\"50\" => \"内容含有敏感词\"\n\t\t);\n\t\t$yzm=rand(100000,999999);\n\t\t/* session('sendtime',time());\n\t\tsession('code',$yzm);\n\t\tsession('phonenum',$phone); */\n \n\t\t$smsapi = \"http://api.smsbao.com/\";\n\t\t$user = \"hyl123456789\"; //短信平台帐号\n\t\t$pass = md5(\"hyl123456\"); //短信平台密码\n\t\t$content=\"【易菜篮】您的验证码为:\" . $yzm . \"。5分钟内输入有效。\";//要发送的短信内容\n\t\t$phone = input('param.phone');//\"*****\";//要发送短信的手机号码\n session('code',$yzm); //验证码存入session\n session('phonenum',$phone); //手机号存入session\n session('sendtime',time()); //发送时间存入session\n\t\t$sendurl = $smsapi.\"sms?u=\".$user.\"&p=\".$pass.\"&m=\".$phone.\"&c=\".urlencode($content);\n\t\t$result =file_get_contents($sendurl);\n\t\t\n\t\t//print_r(session('code'));die;\n\t\t\n\t\t//print_r(session('code'));die;\n\t\t\n\t\tif ($result==0){\n\t\t\t\n\t\t\t$data['status']=1;\n\t\t\t$data['info']=\"验证码发送成功!\";\n\t\t\t$msg=json_encode($data);\n\t\t\techo $msg;\n\t\t\treturn;\n\t\t} else {\n\t\t\t$data['status']=0;\n\t\t\t$data['info']=\"验证码发送失败\";\n\t\t\t$msg=json_encode($data);\n\n\t\t\techo $msg;\n\t\t\treturn;\n\t\t} \n\t\t//echo $statusStr[$result];\n\t}", "function procRequestAnAccount($ar=NULL){\n $p=new XParam($ar,NULL);\n $this->captcha=true;\n $ar['PUBLISH']=2;\n $ar['alias']='user'.uniqid();\n $ar['ldata']=XShell::getLangUser();\n $ar['luser']=XShell::getLangUser();\n $ret=$this->procInsert($ar);\n \n if(!empty($ret) && !empty($ret['oid']) && !empty($this->send_account_request_to_email)) {\n $olduser=$GLOBALS['XUSER'];\n $GLOBALS['XUSER']=new XUser(array(\"UID\"=>'root'));\n setSessionVar(\"UID\",$GLOBALS['XUSER']->_curoid);\n $this->procSendACopyTo(array('oid'=>$ret['oid'], \n\t\t\t\t 'sendinmail' => array($ret['oid']=>true),\n\t\t\t\t 'showdest'=>false,\n\t\t\t\t 'dest_aemails' => $this->send_account_request_to_email,\n\t\t\t\t 'asubject' => 'Account request : '.$p->get('fullnam'),\n\t\t\t\t 'amessage' => 'You have received a new account request',\n\t\t\t\t 'tplentry' => TZR_RETURN_DATA, '_local'=>true), TZR_SENDER_ADDRESS);\n if(!empty($olduser)) {\n\tsetSessionVar(\"UID\",$olduser->uid());\n\t$GLOBALS[\"XUSER\"]=$olduser;\n }\n \n }\n return $r;\n }", "public function codeActivationByEmailAndCode(Request $request)\n {\n\n $recipient = Recipient::where('email', $request->input('email'))->first();\n\n if (!$recipient) {\n return response()->json([\n 'code' => 400,\n 'message' => 'Invalid email address'\n ], 400);\n }\n\n $vCode = $recipient->codes()\n ->select(['codes.id', 'offers.discount'])\n ->join('offers', 'offers.id', '=', 'codes.offer_id')\n ->where('codes.code', $request->input('code'))\n ->whereNull('codes.used_on')\n ->where('offers.expiry', '>=', Carbon::today())\n ->first();\n\n if (!$vCode) {\n return response()->json([\n 'code' => 400,\n 'message' => 'Invalid code.'\n ], 400);\n }\n\n Code::where('id', $vCode->id)\n ->update(['used_on' => Carbon::now()]);\n\n return response()->json([\n 'code' => 200,\n 'message' => 'Successful',\n 'discount' => number_format($vCode->discount, 2)\n ]);\n }", "public function executeSubmit()\n {\n echo \"OK\";\n\n //compare security token\n //$security_code = \"paymentasia\";\n $security_code = \"sayyestomaximtrader\";\n If (md5($_POST[\"orderRef\"] . $_POST[\"successcode\"] . $_POST[\"amount\"] . $security_code) == $_POST[\"token\"]) {\n if ($_POST[\"successcode\"] == \"0\") {\n // Transaction Accepted\n // *** Add the Security Control here, to check the currency, amount with the merchant's order\n // reference from your database, if the order exist then accepted.\n // Update your database for Transaction Accepted and send email or notify your customer .\n echo \"success\";\n } else {\n // Transaction Rejected\n // Update your database for Transaction Rejected\n echo \"rejected\";\n }\n }\n }", "public function testGenerateAddressAuthCode()\n {\n\n }", "#[Pure]\n public function getResponseCode() {}", "#[Pure]\n public function getResponseCode() {}", "public function activationCode();", "private function message($code = NULL){\n $returnResult = false;\n if($code != NULL || $code != ''){\n $message = [\n \"401\" => \"Parameter mismatch\",\n \"402\" => \"Content Not Found\",\n \"403\" => \"Ran into exception\",\n \"200\" => \"Created Successfully\",\n \"201\" => \"Successfully Updated\",\n \"202\" => \"Successfully deleted\",\n \"203\" => \"User not present\",\n \"204\" => \"Group Deleted\",\n \"205\" => \"Group cannot be deleted, user present\"\n ];\n $returnResult = $message[$code];\n }\n return $returnResult;\n }", "function tev_email_encode( $atts, $email ){\r\n\t$atts = extract( shortcode_atts( array('email'=>$email),$atts ));\r\n\t\r\n\tif(function_exists('antispambot')){\r\n\t\treturn '<a href=\"'.antispambot(\"mailto:\".$email).'\">'.antispambot($email).'</a>';\r\n\t\t}\r\n}" ]
[ "0.6587561", "0.65309834", "0.65000844", "0.6454442", "0.6268056", "0.61848456", "0.61538", "0.61411166", "0.6133378", "0.6067421", "0.6039789", "0.60335094", "0.6011027", "0.5980633", "0.59568024", "0.59484214", "0.5912318", "0.58550596", "0.5849572", "0.5830296", "0.582752", "0.58059645", "0.5782001", "0.5772495", "0.57432806", "0.57415277", "0.57296145", "0.57129896", "0.57092375", "0.5708125", "0.56813705", "0.56097704", "0.56055063", "0.56024057", "0.5585037", "0.5569808", "0.5555084", "0.5554566", "0.553059", "0.5508111", "0.5502349", "0.5491311", "0.5481422", "0.5472758", "0.54565257", "0.5454145", "0.54447174", "0.5435354", "0.5417473", "0.54067445", "0.53991765", "0.53809655", "0.53728116", "0.53684056", "0.53605396", "0.53591007", "0.5346079", "0.5342007", "0.5329873", "0.53236455", "0.5323486", "0.5316988", "0.53164154", "0.53109014", "0.5307389", "0.5303017", "0.52963877", "0.52962005", "0.5292526", "0.5290303", "0.5287356", "0.52772975", "0.5273174", "0.52649856", "0.5256432", "0.5251318", "0.5245374", "0.5240516", "0.5238255", "0.52301544", "0.52266365", "0.52193034", "0.5217144", "0.52142173", "0.52119833", "0.5210234", "0.52070624", "0.5198386", "0.51972026", "0.5193339", "0.5188274", "0.51872665", "0.5178194", "0.5174344", "0.5162345", "0.51615715", "0.51615715", "0.51597136", "0.51591885", "0.5159176" ]
0.6484421
3
/desc:send authcode /input:arg(authcode,phone) /output:phone,return(errorcode(1success,0failed))
function send_authcode_phone($authcode,$phone,$code_type=0) { $this->load->library('sms'); $msg_head=$msg_end=$lang=''; switch($code_type) { case Constant::CODE_TYPE_REGISTER: $lang="verify";break; case Constant::CODE_TYPE_CHANGE_PASSWORD: $lang="reset";break; case Constant::CODE_TYPE_CHANGE_PHONE: $lang="update_phone";break; default:break; } if($lang) { $msg_head=str_replace('{phone}',substr($phone,-4),$this->lang->line('phone_body_'.$lang)); $msg_end=$this->lang->line('phone_end_'.$lang); } $msg=$msg_head.$authcode.$msg_end; $this->sms->setPhoneNums($phone); $this->sms->setContent($msg); $sms_error=$this->sms->send(); if($sms_error['error']=="Ok") { $errorcode=true; log_message('info_tizi','170111:Sms send success',$sms_error); } else { $errorcode=false; if($sms_error['status']==3) $sms_error['error']=$this->lang->line('error_sms_invalid_phone'); else $sms_error['error']=$this->lang->line('error_sms_normal'); log_message('error_tizi','17011:Sms send failed',$sms_error); } return array('errorcode'=>$errorcode,'error'=>$sms_error['error'],'status'=>$sms_error['status']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function executeCommandAUTH(&$SMSGW, $argument = null)\n{\n $code = $SMSGW->getAndSaveAuthCode();\n\n if ($code > 9999 && $code < 100000)\n {\n return $SMSGW->sendMessage('Auth code: ' . $code);\n }\n else\n {\n $SMSGW->log(__FUNCTION__, 'Unable to save auth code to db or invalid code - ' . $code);\n return false;\n }\n}", "function send_code($mobile_no) {\n\n\t\t$varifycode = rand('1000', '9999');\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$code = 1234;\n\t\t// $mobileNumber = substr($mobile_no, 1);\n\t\t// $msg = \"Recharge Verification Code : \" . $code;\n // $encodedMessage = urlencode($msg);\n // $route = \"4\";\n // $authKey = \"109829ANu1kqLdg570b4e25\";\n // $senderId = \"Recharge\";\n // $postData = array(\n // 'authkey' => $authKey,\n // 'mobiles' => $mobileNumber,\n // 'message' => $encodedMessage,\n // 'sender' => $senderId,\n // 'route' => $route\n// );\n// $url=\"http://api.msg91.com/api/sendhttp.php\";\n // $ch = curl_init();\n// curl_setopt_array($ch, array(\n // CURLOPT_URL => $url,\n // CURLOPT_RETURNTRANSFER => true,\n // CURLOPT_POST => true,\n // CURLOPT_POSTFIELDS => $postData\n // //,CURLOPT_FOLLOWLOCATION => true\n// ));\n// \n// \n// //Ignore SSL certificate verification\n// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n// \n// \n// //get response\n// $output = curl_exec($ch);\n// \n // if (curl_errno($ch)) {\n\t // $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n // echo json_encode($result);\n\t\t\t // exit();\n// // // // \n\t\t // }\n // curl_close($ch);\nreturn $code;\n\t\t//echo $output;\n\t}", "function send_code($mobile_no) {\n\n\t\t$varifycode = rand('1000', '9999');\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$code = 1234;\n\t\t$mobile = \"0\" . $mobile_no;\n\t\t// $mobileNumber = substr($mobile_no, 1);\n\t\t$msg = \"Recharge Verification Code : \" . $code;\n\t\t$encodedMessage = urlencode($msg);\n\t\t// $route = \"4\";\n\t\t// $authKey = \"109829ANu1kqLdg570b4e25\";\n\t\t// $senderId = \"Recharge\";\n\t\t// $postData = array(\n\t\t// 'authkey' => $authKey,\n\t\t// 'mobiles' => $mobileNumber,\n\t\t// 'message' => $encodedMessage,\n\t\t// 'sender' => $senderId,\n\t\t// 'route' => $route\n\t\t// );\n\t\t$url = \"http://www.kudisms.net/components/com_spc/smsapi.php?username=smerp&password=abhishek&sender=kudisms&recipient=$mobile&message=\" . $encodedMessage;\n\t\t// $url=\"http://api.msg91.com/api/sendhttp.php\";\n\t\t$ch = curl_init();\n\t\tcurl_setopt_array($ch, array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,\n\t\t// CURLOPT_POSTFIELDS => $postData\n\t\tCURLOPT_FOLLOWLOCATION => true));\n\t\t//\n\t\t//\n\t\t// //Ignore SSL certificate verification\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n\t\t//\n\t\t//\n\t\t// //get response\n\t\t$output = curl_exec($ch);\n\t\t//\n\t\t// if (curl_errno($ch)) {\n\t\t// $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n\t\t// echo json_encode($result);\n\t\t// exit();\n\t\t// // // //\n\t\t// }\n\t\tcurl_close($ch);\n\t\treturn $code;\n\t\t//echo $output;\n\t}", "function generate_authcode_phone($phone,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER)\n\t{\n\t\t$authcode=\"\";\n\t\t$errorcode=$this->check_authcode_phone($phone,$code_type);\n if(!$errorcode['errorcode'])\n {\n\t\t\t$authcode=random_string('nozero',6);\n $data=$this->bind_verify($user_id,\"\",$phone,2,$code_type,$authcode,$user_type);\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode.'_'.sha1($phone),json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_PHONE);\n\t\t\t\t$this->save_check('phone',sha1($phone),$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_PHONE);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n\t\t\t\t$insert_id=$this->db->insert_id();\n\t\t\t\tif($insert_id>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170019:Gen phone auth code',array('phone'=>$phone));\n\t\t\tif(!$errorcode) log_message('error_tizi','17019:Gen phone auth code failed',array('phone'=>$phone));\n\t\t}\n else\n {\n $errorcode=false;\n }\n return array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "function forget_send_code($mobile){\n\t\t$varifycode = rand('10000000', '99999999');\n\t\t//$code = 1234;\n\t\t $code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t $mobileNumber = substr($mobile, 1);\n\t\t $msg = \"New Password of Recharge login : \" . $code;\n $encodedMessage = urlencode($msg);\n $route = \"4\";\n $authKey = \"109829ANu1kqLdg570b4e25\";\n $senderId = \"Recharge\";\n $postData = array(\n 'authkey' => $authKey,\n 'mobiles' => $mobileNumber,\n 'message' => $encodedMessage,\n 'sender' => $senderId,\n 'route' => $route\n);\n $url=\"http://api.msg91.com/api/sendhttp.php\";\n $ch = curl_init();\ncurl_setopt_array($ch, array(\n CURLOPT_URL => $url,\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_POSTFIELDS => $postData\n ,CURLOPT_FOLLOWLOCATION => true\n));\n// \n// \n// //Ignore SSL certificate verification\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n// \n// \n// //get response\n $output = curl_exec($ch);\n// \n // if (curl_errno($ch)) {\n\t // $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n // echo json_encode($result);\n\t\t\t // exit();\n// // // // \n\t\t // }\n curl_close($ch);\n\t\treturn $code;\n\t}", "function forget_send_code($mobile) {\n\t\t$varifycode = rand('10000000', '99999999');\n\t\t//$code = 1234;\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$mobileNumber = substr($mobile, 1);\n\t\t$msg = \"New Password of Recharge login : \" . $code;\n\t\t$encodedMessage = urlencode($msg);\n\t\t// $route = \"4\";\n\t\t// $authKey = \"109829ANu1kqLdg570b4e25\";\n\t\t// $senderId = \"Recharge\";\n\t\t// $postData = array(\n\t\t// 'authkey' => $authKey,\n\t\t// 'mobiles' => $mobileNumber,\n\t\t// 'message' => $encodedMessage,\n\t\t// 'sender' => $senderId,\n\t\t// 'route' => $route\n\t\t// );\n\t\t//$url=\"http://api.msg91.com/api/sendhttp.php\";\n\t\t$url = \"http://www.kudisms.net/components/com_spc/smsapi.php?username=smerp&password=abhishek&sender=kudisms&recipient='\" . $mobile . \"'&message=\" . $encodedMessage;\n\t\t$ch = curl_init();\n\t\tcurl_setopt_array($ch, array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData, CURLOPT_FOLLOWLOCATION => true));\n\t\t//\n\t\t//\n\t\t// //Ignore SSL certificate verification\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n\t\t//\n\t\t//\n\t\t// //get response\n\t\t$output = curl_exec($ch);\n\t\t//\n\t\t// if (curl_errno($ch)) {\n\t\t// $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n\t\t// echo json_encode($result);\n\t\t// exit();\n\t\t// // // //\n\t\t// }\n\t\tcurl_close($ch);\n\t\treturn $code;\n\t}", "function check_authcode_phone($phone,$code_type,$user_id=\"\")\n {\n\t\tif($phone)\n\t\t{\n\t\t\tif($this->_redis)\n\t\t\t{\n\n\t\t\t\t$errorcode=$this->check_auth('phone',sha1($phone));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"phone\",sha1($phone));//需要通过服务获得加密后的电话号码\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" - \".Constant::SEND_AUTHCODE_INTERVAL_PHONE)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n }", "function check_auth_response_code($status) {\n\n if ($status != 'S000') {\n $message = get_ticket_error_message($status);\n return result_error($status,$message);\n }\n return result_success();\n}", "public static function sendCode($phone){\n // $c->appkey = getConfig('sms_appkey');\n // $c->secretKey = getConfig('sms_secret');\n // $req = new AlibabaAliqinFcSmsNumSendRequest;\n // $req->setExtend();\n // $req->setSmsType(\"normal\");\n // $req->setSmsFreeSignName(getConfig('sms_FreeSignName'));\n // $code = self::setCode($phone);\n // $req->setSmsParam(\"{\\\"name\\\":\\\"\".$code.\"\\\"}\");\n // $req->setRecNum($phone);\n // $req->setSmsTemplateCode(getConfig('sms_TemplateCode'));\n // $resp = $c->execute($req);\n // if (@$resp->code){\n // return response()->json([\n // 'status' => false,\n // 'errmsg' => $resp->sub_msg\n // ]);\n // }else{\n // return response()->json([\n // 'status' => true,\n // 'message' => '发送成功'\n // ]);\n // }\n\n // 初始化阿里云config\n AliyunConfig::load();\n // 初始化用户Profile实例\n $profile = DefaultProfile::getProfile(\"cn-hangzhou\", getConfig('sms_appkey'), getConfig('sms_secret'));\n DefaultProfile::addEndpoint(\"cn-hangzhou\", \"cn-hangzhou\", \"Dysmsapi\", \"dysmsapi.aliyuncs.com\");\n $acsClient = new DefaultAcsClient($profile);\n // 初始化SendSmsRequest实例用于设置发送短信的参数\n $request = new SendSmsRequest();\n // 必填,设置短信接收号码\n $request->setPhoneNumbers($phone);\n // 必填,设置签名名称\n $request->setSignName(getConfig('sms_FreeSignName'));\n // 必填,设置模板CODE\n $request->setTemplateCode(getConfig('sms_TemplateCode'));\n\n $code = self::setCode($phone);\n $request->setTemplateParam(\"{\\\"code\\\":\\\"\".$code.\"\\\"}\");\n\n $acsResponse = $acsClient->getAcsResponse($request);\n // 默认返回stdClass,通过返回值的Code属性来判断发送成功与否\n if($acsResponse && strtolower($acsResponse->Code) == 'ok')\n {\n return responseJson(true,'发送成功');\n }\n Log::error('【sms-error】'.$phone.':'.$acsResponse->Code);\n return responseJson(false,$acsResponse->Code,'',422);\n }", "public function send(){\n\t\t$statusStr = array(\n\t\t\"0\" => \"短信发送成功\",\n\t\t\"-1\" => \"参数不全\",\n\t\t\"-2\" => \"服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!\",\n\t\t\"30\" => \"密码错误\",\n\t\t\"40\" => \"账号不存在\",\n\t\t\"41\" => \"余额不足\",\n\t\t\"42\" => \"帐户已过期\",\n\t\t\"43\" => \"IP地址限制\",\n\t\t\"50\" => \"内容含有敏感词\"\n\t\t);\n\t\t$yzm=rand(100000,999999);\n\t\t/* session('sendtime',time());\n\t\tsession('code',$yzm);\n\t\tsession('phonenum',$phone); */\n \n\t\t$smsapi = \"http://api.smsbao.com/\";\n\t\t$user = \"hyl123456789\"; //短信平台帐号\n\t\t$pass = md5(\"hyl123456\"); //短信平台密码\n\t\t$content=\"【易菜篮】您的验证码为:\" . $yzm . \"。5分钟内输入有效。\";//要发送的短信内容\n\t\t$phone = input('param.phone');//\"*****\";//要发送短信的手机号码\n session('code',$yzm); //验证码存入session\n session('phonenum',$phone); //手机号存入session\n session('sendtime',time()); //发送时间存入session\n\t\t$sendurl = $smsapi.\"sms?u=\".$user.\"&p=\".$pass.\"&m=\".$phone.\"&c=\".urlencode($content);\n\t\t$result =file_get_contents($sendurl);\n\t\t\n\t\t//print_r(session('code'));die;\n\t\t\n\t\t//print_r(session('code'));die;\n\t\t\n\t\tif ($result==0){\n\t\t\t\n\t\t\t$data['status']=1;\n\t\t\t$data['info']=\"验证码发送成功!\";\n\t\t\t$msg=json_encode($data);\n\t\t\techo $msg;\n\t\t\treturn;\n\t\t} else {\n\t\t\t$data['status']=0;\n\t\t\t$data['info']=\"验证码发送失败\";\n\t\t\t$msg=json_encode($data);\n\n\t\t\techo $msg;\n\t\t\treturn;\n\t\t} \n\t\t//echo $statusStr[$result];\n\t}", "function send_auth_code_at_login($user)\n{\n\t$user_info = get_userdata($user);\n\t\n\t$user_login = $user_info->data->user_login;\n\n\t$user_email = $user_info->data->user_email;\t\n\n\t$user_name = $user_info->data->first_name;\t\n\n\t$user_phone = get_user_meta( $user, 'user_phone', true );\n\t//$user_phone = urldecode($u_phone);\n\n\t$user_fname = get_user_meta( $user, 'first_name', true );\n\n\t$code = get_user_meta( $user, 'has_to_be_activated', true );\n\n\t$subject = 'Your New Authentication Code';\n\n\n\t$message1 = \"<html><body style='background:#f3f3f3;padding:20px 0;'><table border='0' cellpadding='0' cellspacing='0' style='margin:auto; max-width: 520px;width:100%;font-family: Arial;padding:20px;background:#fff;'><tbody>\";\n\t$message1 .=\"<tr><td style='font-size: 16px;'>Hello \".ucfirst($user_fname).\",</td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Welcome to Raise it Fast!</td></tr><tr height=30></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Please use this code to authenticate your account with Raise it Fast. <span style='background: #aaaaaa none repeat scroll 0 0;height: 45px;text-align: center;width: 101px;'>\".$code.\"</span></td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>'If you have any questions or concerns don't hesitate to use our website chat function, call us, or email us by going to our help page at \".site_url('/contact-us/').\" Or, you can simply reply to this email. '</td></tr><tr height=30></tr>\"; \n\t$message1 .=\"<tr><td style='font-size: 16px; margin-top: 20px;'>Thanks for becoming a part of the Raise It Fast community! </td></tr></tbody></table><table border='0' cellpadding='0' cellspacing='0' style='margin:20px auto 0; max-width: 520px;width:100%;'>\"; \n\n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'>1401 Lavaca St #503, Austin, TX 78701</td></tr><tr height=20></tr>\"; \n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'><a href=\".site_url().\" style='text-decoration:none; color: #999999;'>The Raise it Fast Team</a></td></tr>\"; \n\t$message1 .=\"</table></body></html>\";\n\n\twp_mail($user_email, $subject, $message1);\n\n//=========Send Auth Code Via Text message ==================//\n\n\t$account_sid = get_option('twilio_account_sid'); \n\t$auth_token = get_option('twilio_auth_token'); \n //require('lib/twilio-php-latest/Services/Twilio.php');\n\t$client = new Services_Twilio($account_sid, $auth_token); \n //$from = '+12182265630'; \n\t$from = get_option('twilio_phone_no');\n\n\ttry\n\t{\n\t\t$client->account->messages->sendMessage( $from, $user_phone, \"Hello $user_fname, Your Authentication code is $code\");\n\t}\n\tcatch (Exception $e)\n\t{ \n\n\t\techo \"11-\";\n\t}\n}", "function authenticate_user($email_a, $passcode){\r\n\t//QUERY DATABASE/ACTIVE DIRECTORY TO SEE IF USER IS VALID\r\nif ($email == \"insert valid email b4 testing\") {\r\n\t/*** set a form token ***/\r\n\t$form_token = md5( uniqid('auth', true) );\r\n\t/*** set the session form token ***/\r\n\t$_SESSION['form_token'] = $form_token;\r\n\t$_SESSION['email_a'] = $email_a;\r\n\t$_SESSION['start_timestamp'] = date('Y-m-d HH:mm:s');\r\n\t$code = \"valid\";\r\n}else{\r\n\t$code = \"invalid\";\r\n\t}\r\necho return $code \"We were unable to validate your information, Please try again\";\r\n /*RETURNED TO CALLING CODE */\r\n\t}", "function getNewAuthCodeFinal($authDetails)\n{\n $params = array('response_type'=>'code', 'client_id'=> $authDetails['client_id'], 'redirect_uri'=> $authDetails['redirect_uri'], 'state'=> 'xyz');\n header('Location: ' . $authDetails['authorization_code_endpoint'] . '?' . http_build_query($params));\n die();\n}", "function verify_authcode_phone($authcode,$phone,$verify=true)\n\t{\n\t\t$user_id=$code_type=0;\n if($this->_redis)\n {\n $data=$this->cache->get($authcode.'_'.sha1($phone));\n if(!empty($data))\n {\n $data=json_decode($data);\n $user_id=$data->user_id;\n $code_type=$data->code_type;\n\t\t\t\tif($verify) $this->cache->delete($authcode.'_'.sha1($phone));\n $errorcode=true;\n }\n else\n {\n $errorcode=false;\n log_message('error_tizi','17051:phone verify code failed',array('phone'=>$phone));\n }\n }\n else\n\t\t{\n\t\t\t$this->db->select(\"id,user_id,phone,code_type,generate_time\");\n\t\t\t$this->db->from($this->_table);\n\t\t\t$this->db->where(\"authcode\",$authcode);\n\t\t\t//加密手机号码\t\n\t\t\t$e_phone=sha1($phone);\t\n\t\t\n\t\t\t$this->db->where(\"phone\",$e_phone);\n\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_PHONE);\n\t\t\t$query=$this->db->get();\t\n\t\t\t$total=$query->num_rows();\n\t\t\tif($total) $gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_PHONE))>date(\"Y-m-d H:i:s\"))\n\t\t\t{\n\t\t\t\t$id=$query->row()->id;\n\t\t\t\t$user_id=$query->row()->user_id;\n\t\t\t\t//$phone=$query->row()->phone;//电话号码已加密\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\tif($verify)\n\t\t\t\t{\n\t\t\t\t\t$this->db->where('id',$id);\n\t\t\t\t\t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n\t\t\t\t\tif($this->db->affected_rows()==1) $errorcode=true;\n\t else $errorcode=false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$errorcode=true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t}\n\t\t}\n\t\treturn array('user_id'=>$user_id,'phone'=>$phone,'code_type'=>$code_type,'errorcode'=>$errorcode);\n\t}", "function statement($details,$phone){\n\t$ussd_text=\"CON <br/> Enter your PIN\"; \n ussd_proceed($ussd_text); \n}", "public function send_sms_verification_code()\n\t{\n\t\t$user_id = Input::get('userId');\n\t\t$phone_number = Input::get('phoneNumber');\n\n\t\t// check if a verify record already exists\n\t\t$verify_record = $this->notifyRepo->smsVerificationCodeByUserId($user_id);\n\n\t\t// create the code, save it, send to user\n\t\t$verify_record = $this->notifyRepo->smsSendVerifyCode($user_id, $phone_number, $verify_record);\n\n\t\t$result = Twilio::message('+'.$phone_number, 'EriePaJobs - Your verification code is '.$verify_record->verification_code);\n\t}", "private function returnCodeMessage(int $code): string {\n $codes = [\n 211 => 'System status, or system help reply',\n 214 => 'Help message (A response to the HELP command)',\n 220 => '<domain> Service ready',\n 221 => '<domain> Service closing transmission channel',\n 235 => 'Authentication succeeded',\n 250 => 'Requested mail action okay, completed',\n 251 => 'User not local; will forward',\n 252 => 'Cannot verify the user, but it will try to deliver the message anyway',\n 334 => '(Server challenge - the text part contains the Base64-encoded challenge)',\n 354 => 'Start mail input',\n 421 => 'Service not available, closing transmission channel (This may be a reply to any command if the service knows it must shut down)',\n 432 => 'A password transition is needed',\n 450 => 'Requested mail action not taken: mailbox unavailable (e.g., mailbox busy or temporarily blocked for policy reasons)',\n 451 => 'Requested action aborted: local error in processing / IMAP server unavailable',\n 452 => 'Requested action not taken: insufficient system storage',\n 454 => 'Temporary authentication failure',\n 455 => 'Server unable to accommodate parameters',\n 500 => 'Syntax error, command unrecognized (This may include errors such as command line too long) / Authentication Exchange line is too long',\n 501 => 'Syntax error in parameters or arguments / Cannot Base64-decode Client responses / Client initiated Authentication Exchange (only when the SASL mechanism specified that client does not begin the authentication exchange)',\n 502 => 'Command not implemented',\n 503 => 'Bad sequence of commands',\n 504 => 'Command parameter is not implemented / Unrecognized authentication type',\n 521 => 'Server does not accept mail',\n 523 => 'Encryption Needed',\n 530 => 'Authentication required',\n 534 => 'Authentication mechanism is too weak',\n 535 => 'Authentication credentials invalid',\n 538 => 'Encryption required for requested authentication mechanism',\n 550 => 'Requested action not taken: mailbox unavailable (e.g., mailbox not found, no access, or command rejected for policy reasons)',\n 551 => 'User not local; please try <forward-path>',\n 552 => 'Requested mail action aborted: exceeded storage allocation',\n 553 => 'Requested action not taken: mailbox name not allowed',\n 554 => 'Transaction has failed (Or, in the case of a connection-opening response, \"No SMTP service here\") / Message too big for system',\n 556 => 'Domain does not accept mail',\n ];\n return $codes[$code] ?? '';\n }", "function actiongetVerifyCode()\n\t{\n\t\t$jsonarray= array();\n\t\t\n\t\tif(isset($_POST['phone']))\n\t\t{\n\t\t\t$userObj=new Users();\n\t\t\tif(!is_numeric($_POST['phone'])){\n\t\t\t\t$algoencryptionObj\t=\tnew Algoencryption();\n\t\t\t\t$_POST['phone']\t=\t$algoencryptionObj->decrypt($_POST['phone']);\n\t\t\t}\n\t\t\t$result=$userObj->getVerifyCodeById($_POST['phone'],'-1');\n\t\t\t$jsonarray['status']=$result['status'];\n\t\t\t$jsonarray['message']=$result['message'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$message=$this->msg['ONLY_PHONE_VALIDATE'];\n\t\t\t$jsonarray['status']='false';\n\t\t\t$jsonarray['message']=$message;\n\t\t}\n\t\techo $jsonarray['message'];\n\t}", "private function processCurlCommand($code)\n {\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, \"https://connect.stripe.com/oauth/token\");\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_POSTFIELDS, \"client_secret=\" .\\Config::STRIPE_SECRET . \"&code=$code&grant_type=authorization_code\");\n curl_setopt($ch, CURLOPT_POST, 1);\n $headers = array();\n $headers[] = \"Content-Type: application/x-www-form-urlencoded\";\n curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\n $result = curl_exec($ch);\n if (curl_errno($ch)) {\n echo 'Error:' . curl_error($ch);\n }\n\n $obj = json_decode($result,true);\n return $obj['stripe_user_id'];\n }", "public function send(string $code, Authenticatable $user);", "private function checkingApiCanAuthenticateCode($auth_code)\n {\n return $this->api_request->get(\"user\",\"validate_user_code\",$params=array('code'=>$auth_code)); \n }", "public function passwordResetCode();", "function requestCode ($domain) {\n $url = 'https://' . $domain . '/oauth/authorize/' .\n '?client_id=' . urlencode(APP_ID);\n redirect($url);\n}", "public function validationSha($code){\r\n\t\t//variables\r\n\t\t$error = '';\r\n\t\t$user_browser = $_SERVER['HTTP_USER_AGENT']; //navegador\r\n\t\t$ip = $_SERVER['REMOTE_ADDR']; //ip\r\n\t\r\n\t\t$this->where('macro_sha', $code);\r\n\t\tif($salida = $this->getOne('solicitudes_clave')){\r\n\t\t\t\r\n\t\t\tif($salida['navegador'] != $user_browser){\t$error = 'navegador no concide';\t}\r\n\t\t\tif($salida['ip'] != $ip){\t\t\t\t\t$error = 'remote ip no concide';\t}\r\n\t\t\t\r\n\t\t\tif($error != ''){\r\n\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\treturn false;\r\n\t\t\t}else{\r\n\t\t\t\t$nuevo_sha = hash('sha512', $salida['email'].$user_browser.$salida['telefono'].$ip);\r\n\t\t\t\tif($nuevo_sha != $salida['macro_sha']){\r\n\t\t\t\t\t$error = 'Shas no coinciden';\r\n\t\t\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}else{\r\n\t\t\t\t\t//succes!!\r\n\t\t\t\t\t$_SESSION['email_val'] = $salida['email'];\r\n\t\t\t\t\t$_SESSION['corrector'] = $salida['salt'];\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\r\n\t\t}else{\r\n\t\t\t$error = 'no hubo conexion a db';\r\n\t\t\t$this->rewrite_attempt($ip, $error);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "function verify_telephone()\n\t{\n\t\tlog_message('debug', 'Account/verify_telephone');\n\t\t$data = filter_forwarded_data($this);\n\t\tlog_message('debug', 'Account/verify_telephone:: [1] post='.json_encode($_POST));\n\n\t\tif(!empty($_POST)){\n\t\t\t$result = FALSE;\n\t\t\t$data['msg'] = '';\n\t\t\t$data['hasPosted'] = 'Y';\n\n\t\t\t# a) Is user updating their phone details?\n\t\t\tif(!empty($_POST['telephone'])){\n\t\t\t\t# Add or update phone and send verification code\n\t\t\t\t$response = $this->_api->post('user/telephone', array(\n\t\t\t\t\t'telephone'=>$_POST['telephone'],\n\t\t\t\t\t'provider'=>$_POST['provider__provider'],\n\t\t\t\t\t'isPrimary'=>'Y'\n\t\t\t\t));\n\n\t\t\t\t# Update the user telephone and provider if sucessful\n\t\t\t\tif(!empty($response['result']) && $response['result']=='SUCCESS'){\n\t\t\t\t\t$data['msg'] .= $this->native_session->get('__telephone') != $_POST['telephone']? 'Your phone number has been updated and a': 'A';\n\t\t\t\t\t$data['msg'] .= ' code has been sent for verification';\n\t\t\t\t\t$this->native_session->set('__telephone', $_POST['telephone']);\n\t\t\t\t\t$this->native_session->set('__provider', $response['provider']);\n\t\t\t\t\t$this->native_session->set('__provider_id', $_POST['provider__provider']);\n\t\t\t\t\t$result = TRUE;\n\t\t\t\t\t$data['area'] = 'verify_code_form';\n\t\t\t\t}\n\t\t\t\telse $data['msg'] .= 'ERROR: Your phone number could not be updated or code sent.';\n\t\t\t}\n\n\t\t\t# b) Verify telephone code\n\t\t\telse if(!empty($_POST['usercode'])){\n\t\t\t\t$response = $this->_api->post('account/verify', array(\n\t\t\t\t\t'code'=>$_POST['usercode'],\n\t\t\t\t\t'telephone'=>$this->native_session->get('__telephone'),\n\t\t\t\t\t'baseLink'=>base_url()\n\t\t\t\t));\n\n\t\t\t\tif(!empty($response['verified']) && $response['verified']=='Y'){\n\t\t\t\t\t$this->native_session->set('__telephone_verified', 'Y');\n\t\t\t\t\t$data['msg'] = '20 Points have been added to your Clout Score';\n\t\t\t\t\t$data['area'] = 'verify_code_results';\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$data['msg'] = 'ERROR: Your phone could not be verified.<br>Please try again.';\n\t\t\t\t\t$data['area'] = 'verify_code_form';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$data['area'] = !empty($data['area'])? $data['area']: 'user_phone_details';\n\t\t$this->load->view('account/verify_phone', $data);\n\t}", "function rest_authorization_required_code()\n {\n }", "public function test_auth_code_redemption() {\n\t\t$code = $this->set_auth_code();\n\t\t$response = $this->create_form( 'POST', \n\t\t\t\tarray(\n\t\t\t\t\t'grant_type' => 'authorization_code',\n\t\t\t\t\t'code' => $code,\n\t\t\t\t\t'client_id' => 'https://app.example.com',\n\t\t\t\t\t'redirect_uri' => 'https://app.example.com/redirect',\n\t\t\t\t)\n\t\t);\n\t\t$this->assertEquals( 200, $response->get_status(), 'Response: ' . wp_json_encode( $response ) );\n\t\t$data = $response->get_data();\n\t\t$this->assertArrayNotHasKey( 'access_token', $data );\n\t\t$this->assertEquals( \n\t\t\tarray( \n\t\t\t\t'me' => get_author_posts_url( static::$author_id ),\n\t\t\t), \n\t\t\t$data, \n\t\t\t'Response: ' . wp_json_encode( $data ) \n\t\t);\n\t}", "public function check_register_code($user_login)\n {\n // Wrong Token Message\n $wrong_token = array(\n 'message' => __('Your authentication code is incorrect', 'wordpress-acl')\n );\n\n // Only Check Register Code\n if (isset($_REQUEST['do_action']) and $_REQUEST['do_action'] == \"check_register_code\") {\n\n // Get User Mobile\n $user_mobile = $user_login;\n $code = sanitize_text_field($_REQUEST['code']);\n\n // Check User Code\n $code_query = self::check_user_opt_code($code, 'mobile', $user_mobile);\n if ($code_query != false and self::check_expire_time_user_otp($code_query) === true) {\n // True\n wp_send_json_success(array(\n 'code' => $code\n ), 200);\n } else {\n // False\n wp_send_json_error($wrong_token, 400);\n }\n }\n\n // Check User code in Register\n if (!isset($_REQUEST['code']) || (isset($_REQUEST['code']) and empty($_REQUEST['code']))) {\n wp_send_json_error($wrong_token, 400);\n }\n $code_query = self::check_user_opt_code($_REQUEST['code'], 'mobile', $user_login);\n if ($code_query === false) {\n wp_send_json_error($wrong_token, 400);\n }\n if (self::check_expire_time_user_otp($code_query) === false) {\n wp_send_json_error(array(\n 'message' => __('Your authentication code has expired', 'wordpress-acl')\n ), 400);\n }\n\n // Check Persian first_name and last_name\n if(empty($_REQUEST['first_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خود را وارد نمایید'\n ), 400);\n }\n if(empty($_REQUEST['last_name'])) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را وارد نمایید'\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['first_name']) ===false) {\n wp_send_json_error(array(\n 'message' => __('لطفا نام خود را به فارسی وارد کنید', 'wordpress-acl')\n ), 400);\n }\n if (Persian_ACL::check_persian_input($_REQUEST['last_name']) ===false) {\n wp_send_json_error(array(\n 'message' => 'لطفا نام خانوادگی خود را به فارسی تایپ کنید'\n ), 400);\n }\n }", "function auth() {\r\n\t$code = \"\";\r\n\tfor ($i = 0; $i < 8; $i ++) {\r\n\t\t$code .= (rand(0, 1) ? chr(rand(65, 122)) : rand(0, 9));\r\n\t}\r\n\treturn sha1($code);\r\n}", "function send_authcode_email($authcode,$email,$code_type=0)\n\t{\n\t\t$this->load->library(\"mail\");\n\t\t$this->load->model('login/register_model');\n\t\t$msg_head=$msg_end=$lang=$link=$stuid='';\n\n\t\tif($this->_user_id)\n\t\t{\n\t\t\t$user_info=$this->register_model->get_user_info($this->_user_id);\n\t\t\tif($user_info['errorcode'] && $user_info['user']->student_id)\n\t\t\t{\t\t\n\t\t\t\t$stuid='您的学号是:'.$user_info['user']->student_id.'<br />';\n\t\t\t}\n\t\t}\n\n\t\tswitch($code_type)\n\t\t{\n\t\t\tcase Constant::CODE_TYPE_REGISTER: $link=\"verify\";$lang=\"verify\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PASSWORD: $link=\"forgot/reset\";$lang=\"reset\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_EMAIL: $link=\"verify\";$lang=\"update_email\";break;\n\t\t\tcase Constant::CODE_TYPE_REGISTER_VERIFY_EMAIL: $link=\"verify\";$lang=\"reg_reverify\";break;\n\t\t\tcase Constant::CODE_TYPE_LOGIN_VERIFY_EMAIL: $link=\"verify\";$lang=\"login_reverify\";break;\n\t\t\tdefault:break;\n\t\t}\n\n\t\tif($lang && $link)\n\t\t{\t\n\t\t\t//$authcode=site_url().$link.\"?code=\".$authcode;\n\t\t\t$authcode=login_url().$link.\"/code/\".$authcode;\n\t\t\t$subject=$this->lang->line('mail_subject_'.$lang);\n\t\t\t$msg_body=str_replace('{email}',$email,$this->lang->line('mail_body_'.$lang));\n\t\t\t\n\t\t\t$msg_body=str_replace('{stuid}',$stuid,$this->lang->line('mail_body_'.$lang));\n\t\t\t$msg_end=$this->lang->line('mail_end_'.$lang);\t\t\t\n\t\t}\n\t\t$msg=$msg_body.'<br /><a href=\"'.$authcode.'\">'.$authcode.'</a><br />'.$msg_end.'<br/>'.$this->lang->line('mail_disclaimer');\n\n\t\t$ret = Mail::send($email, $subject, $msg);\n\t\tif($ret['ret']==1)\n\t\t{\n\t\t\t$errorcode=true;\n\t\t\tlog_message('info_tizi','170101:Email send success',$ret);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t\tlog_message('error_tizi','17010:Email send failed',$ret);\n\t\t}\n\t\treturn array('errorcode'=>$errorcode,'send_error'=>implode(',',$ret));\n\t}", "public function check_promocode() {\n\t\t\t\t $usertypes = $this->users->checkUserTypeLaabus($this->session->userdata('user_id'));\n\t\t\t\t $agent_id = $usertypes[0]->agent_id;\n\t\t\t\t// print_r($usertypes);\n\t\t\t\tif(empty($agent_id))\n\t\t\t\t{\n\t\t\t\t\t$role_id = 4;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$role_id =44;\n\t\t\t\t}\n\t\t$data = $this->users->check_promocode($_REQUEST['promo_code'],$_REQUEST['amount'],$role_id);\n\t\techo $data;\n\t\texit;\n\t}", "function sms_authcode_in($mobile, $authcode)\n\t{\n\t\t$this->db->where(\"mobile\", $mobile);\n\t\t$this->db->delete('m_sms_authcode');\n\n\t\t$query = array(\n\t\t\t'mobile' \t\t\t\t=> $mobile,\n\t\t\t'authcode' \t\t\t\t=> $authcode\n\t\t);\n\n\t\t$this->db->insert('m_sms_authcode', $query);\n\t}", "function ActivateOTPforMandateActivation($remitaTransRef, $card, $otp, $requestTS) {\n $mandateOTPData = array(\n 'remitaTransRef' => $remitaTransRef,\n 'authParams' => array(\n '0' => Array(\n 'param1' => 'OTP',\n 'value' => $otp),\n '1' => Array(\n 'param2' => 'CARD',\n 'value' => $card)\n )\n );\n //echo json_encode($mandateOTPData);\n $response = callRemitaOTPApi($GLOBALS['OTPMandateSetupValidation'], $mandateOTPData, $requestTS);\n return json_decode(removeJSONP($response), TRUE);\n}", "protected function sendCode($code) {\n $to = $this->getAccountNumber();\n try {\n $message = $this->client->account->messages->sendMessage($this->twilioNumber, $to, t($this->messageText, array('!code' => $code)));\n // @todo Consider storing date_sent or date_updated to inform user.\n watchdog('tfa_basic', 'Message !id sent to user !uid on @sent', array(\n '@sent' => $message->date_sent,\n '!id' => $message->sid,\n '!uid' => $this->context['uid'],\n ), WATCHDOG_INFO);\n return TRUE;\n }\n catch (Services_Twilio_RestException $e) {\n // @todo Consider more detailed reporting by mapping Twilio error codes to\n // messages.\n watchdog('tfa_basic', 'Twilio send message error to user !uid @code @link', array(\n '!uid' => $this->context['uid'],\n '@code' => $e->getStatus(),\n '@link' => $e->getInfo(),\n ), WATCHDOG_ERROR);\n return FALSE;\n }\n }", "function check_reffer_code(){\n\t$reffer_code=$_REQUEST['reffer_code'];\n\tif(!empty($reffer_code)){\n\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\tif(!empty($reffer_records)){\n\t\t\t$user_id=$reffer_records[0]['user_id'];\n\t\t\t$user_reffer_code=$reffer_records[0]['user_refferal_code'];\n\t\t\tif($user_reffer_code==$reffer_code){\n\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Reffer code avalible\", 'reffer_code' => $reffer_code,'user_id'=>$user_id);\n\t\t\t}else{\n\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t}\n\t\t\t\n\t\t}else{\n\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t}\n\t}else{\n\t\t$post = array(\"status\" => \"false\", \"message\" => \"Missing parameter\",'reffer_code'=>$reffer_code);\n\t}\n\techo $this -> json($post);\n}", "function smsSending($mobile, $sign, $args = array(), $templateId = 'SMS_585014') {\n $smssettings = unserialize(variable_get('smssettings'));\n $c = new TopClient;\n $c->format = 'json';\n $c->appkey = $smssettings['appkey'];//$appkey;\n $c->secretKey = $smssettings['secret'];//$secret;\n $req = new AlibabaAliqinFcSmsNumSendRequest;\n $req->setExtend(\"\");\n $req->setSmsType(\"normal\");\n $req->setSmsFreeSignName($sign);\n $param = json_encode($args);\n $req->setSmsParam($param);\n $req->setRecNum($mobile);\n $req->setSmsTemplateCode($templateId);//\n $resp = $c->execute($req);\n return $resp;\n}", "public function authorize_result()\n\t{\t\n\t\tif(isset($_GET['code']))\n\t\t{\n\t\t\tif($this->oauth->ci->session->userdata('state') !== $_GET['state'])\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('failure', array(\n 'error' => $this->oauth->ci->lang->line('error_xsfr_victim')\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn $this->oauth->response('success', array(\n\t\t\t\t\t\t'token' => $_GET['code'],\n\t\t\t\t\t\t'state' => $_GET['state']\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(isset($_GET['error']))\n\t\t{\n\t\t\treturn $this->oauth->response('failure', array(\n\t\t\t\t\t'error' => $_GET['error_description']\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}", "function sendOtp($otp, $mobi){\n \n$ottp = urlencode($otp);\n$msg =\"Welcome to E-MTC: Your verification code is $ottp\";\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n CURLOPT_URL => \"https://www.fast2sms.com/dev/bulk?authorization=123adfdd&sender_id=FSTSMS&message=\".urlencode($msg).\"&language=english&route=p&numbers=\".urlencode($mobi).\"&flash=0\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => array(\n \"cache-control: no-cache\"\n ),\n));\n\n$lol = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n $response['error']=true;\n $response['message']=\"Error in Sending OTP\";\n} else {\n\t$response['error']=false;\n\t$response['message']=\"Success\";\n}\n\nreturn $response;\n\n }", "public function verifyCode(CodeRequest $request )\n\t{\n\t\tif(!is_numeric($request->input('code'))){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\n\t\t$querry = \"SELECT * FROM \". DBTool::rawTable('users') . \" WHERE phone_token = '\" . $request->input('code') . \"' AND phone = '\" . $request->input('phone') . \"'\";\n\t\t$user = DB::select(DB::raw($querry));\n\n\t\t$user = ArrayHelper::fromObject($user);\n\n\t\t//if user enter wrong code\n\t\tif(!isset($user[0]['id']) && !isset($user[0]['phone']) ){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\t\t// SET THE CODE IS VERIFIED\n\t\t$querry = \"UPDATE \". DBTool::rawTable('users') . \" SET verified_phone = 1 WHERE id = '\" . $user[0]['id'] . \"'\";\n\t\t$updated = DB::update(DB::raw($querry));\n\t\t$updated = ArrayHelper::fromObject($updated);\n\n\t\t// Redirection\n\t\t// return $this->lastRecords($user[0]['phone']);\n\t\treturn redirect( '/end/registration/' . $user[0]['phone'] );\n\t}", "public function verify_code($params) {\n\n $verification_code = $params['verification_code'];\n $code_id = $params['code_id'];\n\n $options = array('body'=> array());\n $options['body']['code']= ['verify'=> $verification_code];\n\n $uri = $code_id.\"/verify\";\n $uri = \"/cpaas/auth/v1/\".$this->client->user_id.\"/codes/\".$uri;\n $url = $this->client->_root.$uri;\n $response = $this->client->_request(\"PUT\", $url, $options);\n\n // check if test response\n if ($this->client->check_if_test($response)) {\n return $response;\n }\n // check if error response\n // if ($this->client->check_if_error($response)) {\n // $response = $this->client->build_error_response($response);\n // return $response;\n // }\n\n if ($response->getStatusCode() == 204) {\n $custom_response = ['verified'=> true, 'message'=> 'Success'];\n } else {\n $custom_response = ['verified'=> false, 'message'=> 'Code invalid or expired'];\n }\n\n return $custom_response;\n }", "function mark_otp()\r\n\t{\r\n \r\n\t\t$ip = $_SERVER['REMOTE_ADDR'];\r\n\t\t$markid = $this->MOD->decode($this->input->post('id'));\r\n\t\t$subcode = $this->input->post('ccode');\r\n\t\t$sesid = $this->MOD->decode($this->input->post('session'));\r\n\t$staffid = $this->session->userdata('username');\r\n\t$row= $this->SM->get_staffmobile($staffid);\r\n\t\t\t$mobile = $row->MOBILE ;\r\n\t\t\t\r\n\t\t\t$username = \"dcdcoe\";\r\n\t\t\t$mypassword = \"DCacoe@123\";\r\n\t\t\t$sendername = \"ACOEUD\";\r\n\t\t\t$domain = \"bhashsms.com/api/\";\r\n\t\t\t$type = \"normal\";\r\n\t\t\t$priority=\"ndnd\";\r\n\t\t\t$rndno=rand(100000, 999999);\r\n\t\t\techo $otp = urlencode($rndno);\r\n\t\t\t$method = \"POST\";\r\n\t\t\t$username = urlencode($username);\r\n\t\t\t$password = urlencode($mypassword);\r\n\t\t\t$sendername = urlencode($sendername);\r\n\t\t\t$message = urlencode('This is an OTP for Mark entry '.$otp.' by ACOE(UDs).Dont share this with anyone. ');\r\n\t\t\t$parameters = \"user=\".$username.\"&pass=\".$mypassword.\"&sender=\".$sendername.\"&phone=\".$mobile.\"&text=\".$message.\"&priority=\".$priority.\"&stype=\".$type ;\r\n\t\t\t$apiurl = \"http://\".$domain.\"/sendmsg.php\";\r\n\t\t\t$get_url = $apiurl.\"?\".$parameters;\r\n\t\t\t//echo $get_url;\r\n\t\t\t$ch = curl_init($apiurl);\r\n\t\t\tif($method == \"POST\")\r\n\t\t\t{\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_POST,1);\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_POSTFIELDS,$parameters);\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\t$get_url = $apiurl.\"?\".$parameters;\r\n\t\t\t\techo $get_url;\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_POST,0);\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_URL, $get_url);\r\n\t\t\t}\r\n\r\n\t\t\tcurl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);\r\n\t\t\tcurl_setopt($ch, CURLOPT_HEADER,0);\r\n\t\t\t// DO NOT RETURN HTTP HEADERS\r\n\t\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER,1);\r\n\t\t\t// RETURN THE CONTENTS OF THE CALL\r\n\t\t\t$return_val = curl_exec($ch);\r\n\t\t\t\r\n\t\t\t$this->session->set_userdata('otp', $rndno);\r\n\t\t\t$this->session->unset_userdata('otp');\r\n\t\t\t$data = array(\r\n 'OTP' => $rndno\r\n );\r\n\t\t\t$value = $this->SM->mark_status($staffid);\r\n $this->session->set_userdata($data);\r\n\t\t\tif($return_val==\"\"){echo \"Process Failed, Please check domain, username and password.\";} else {echo $return_val;}\r\n\t\tdate_default_timezone_set('Asia/Kolkata');\r\n\t\t\t$data1 = array(\r\n\t\t\t'MARKID' =>$markid,\r\n\t\t\t'SUBCODE'=>$subcode,\r\n\t\t\t'STAFFID'=>$staffid,\r\n\t\t\t'OTP' => $rndno,\r\n\t\t\t'SESID'=>37,\r\n\t\t\t'USER_IP'=>$ip,\r\n\t\t\t'STATUS' =>1,\r\n\t\t\t'IN_DATE' => date('d-m-Y h:i:sa'),\r\n\t\t);\r\n\t\t\t \r\n\t\t\t//print_r($data1);\r\n\t\t$value = $this->SM->mark_entry($data1);\r\n\t\t\r\n\t\t\t//$query = $this->db->insert('MARKENTRY_OTP', $data1);\r\n\t\t\t// print_r($query);\r\n\t\t\t\t\r\n\t\t//$result = $this->SM->otpstore($data1);\r\n\t\t\t$this->session->set_userdata($data1) ;\r\n\t\t\t$data1=$this->session->set_flashdata('msg', '<div class=\"alert alert-danger text-center\">Note: <strong>OTP</strong> sent to ur registered mobile number and E-Mail address !..............</div>');\r\n\t\t\t//added for sending OTP in email\t\r\n\t\t\t$this->load->library('email');\r\n\t\t\t$staffid = ($this->session->userdata('username'));\r\n $data = array('USERNAME' => $staffid);\r\n\r\n $this->db->select('EMAIL');\r\n $this->db->where($data);\r\n $query = $this->db->get('STAFF_LOGIN');\r\n\t\t $row = $query->row();\r\n\t\t\t$this->email->from('[email protected]', 'ACOEUD');\r\n\t\t\t$this->email->to($row->EMAIL);\r\n\t\t\t$this->email->cc('[email protected]');\r\n\t\t\t//$this->email->bcc('[email protected]');\r\n\t\t\t$this->email->subject('OTP for Mark Entry in SEMS');\r\n\t\t\t$this->email->message('This is an OTP for Mark Entry in SEMS '.$otp.' by ACOE(UDs).Dont share this with anyone. ');\r\n\t\t\t//$this->email->send();\r\n\t\t\t/*\r\n\t\t\tif (!$this->email->send())\r\n\t\t\t{\r\n\t\t\t// Generate error\r\n\t\t\t$data1=$this->session->set_flashdata('msg', '<div class=\"alert alert-danger text-center\">Error: <strong>OTP</strong> is not sent to the E-Mail ID!..............</div>');\r\n\t\t\t} */\r\n\t\t//\tredirect('Load_Controller');\r\n\t\t \t\t\t\t\r\n\t\t}", "function error( $code = 100, $debug_message = null, $secret = null, $addtl_data = array() ) {\n\t\tswitch ($code) :\n\t\t\tcase '101' :\n\t\t\t\t$error = array( 'error' => __( 'Invalid License Key', 'jigoshop-software' ), 'code' => '101' );\n\t\t\tbreak;\n\t\t\tcase '102' :\n\t\t\t\t$error = array( 'error' => __( 'Software has been deactivated', 'jigoshop-software' ), 'code' => '102' );\n\t\t\tbreak;\n\t\t\tcase '103' :\n\t\t\t\t$error = array( 'error' => __( 'Exceeded maximum number of activations', 'jigoshop-software' ), 'code' => '103' );\n\t\t\tbreak;\n\t\t\tcase '104' :\n\t\t\t\t$error = array( 'error' => __( 'Invalid Instance ID', 'jigoshop-software' ), 'code' => '104' );\n\t\t\tbreak;\n\t\t\tcase '105' :\n\t\t\t\t$error = array( 'error' => __( 'Purchase has been upgraded', 'jigoshop-software' ), 'code' => '105' );\n\t\t\tbreak;\n\t\t\tcase '106' :\n\t\t\t\t$error = array( 'error' => __( 'License key for different product. Please check the product for this license key, then download and install the correct product.', 'jigoshop-software' ), 'code' => '106' );\n\t\t\tbreak;\n\t\t\tdefault :\n\t\t\t\t$error = array( 'error' => __( 'Invalid Request', 'jigoshop-software' ), 'code' => '100' );\n\t\t\tbreak;\n\t\tendswitch;\n\t\tif ( isset($this->debug) && $this->debug ) {\n\t\t\tif ( !isset( $debug_message ) || !$debug_message) $debug_message = __( 'No debug information available', 'jigoshop-software' );\n\t\t\t$error['additional info'] = $debug_message;\n\t\t}\n\t\tif ( isset( $addtl_data['secret'] ) ) {\n\t\t\t$secret = $addtl_data['secret'];\n\t\t\tunset( $addtl_data['secret'] );\n\t\t}\n\t\tforeach ( $addtl_data as $k => $v ) {\n\t\t\t$error[$k] = $v;\n\t\t}\n\t\t$secret = ( $secret ) ? $secret : 'null';\n\t\t$error['timestamp'] = time();\n\t\tforeach ( $error as $k => $v ) {\n\t\t\tif ( $v === false ) $v = 'false';\n\t\t\tif ( $v === true ) $v = 'true';\n\t\t\t$sigjoined[] = \"$k=$v\";\n\t\t}\n\t\t$sig = implode( '&', $sigjoined );\n\t\t$sig = 'secret=' . $secret . '&' . $sig;\n\t\tif ( !$this->debug ) $sig = md5( $sig );\n\t\t$error['sig'] = $sig;\n\t\t$json = $error;\n\t\theader( 'Cache-Control: no-store' );\n\t\tif ( function_exists( 'header_remove' ) ) {\n\t\t\theader_remove( 'Cache-Control' );\n\t\t\theader_remove( 'Pragma' );\n\t\t\theader_remove( 'Expires' );\n\t\t\theader_remove( 'Last-Modified' );\n\t\t\theader_remove( 'X-Pingback' );\n\t\t\theader_remove( 'X-Powered-By' );\n\t\t\theader_remove( 'Set-Cookie' );\n\t\t} else {\n\t\t\theader( 'Cache-Control: ' );\n\t\t\theader( 'Pragma: ' );\n\t\t\theader( 'Expires: ' );\n\t\t\theader( 'X-Pingback: ' );\n\t\t\theader( 'X-Powered-By: ' );\n\t\t\theader( 'Set-Cookie: ' );\n\t\t}\n\t\theader( 'Content-Type: application/json' );\n\t\tdie( json_encode( $json ) );\n\t\texit;\n\t}", "public function phoneVerify(Request $req) {\n\n $param = $this->createRand(4);\n $url = \"https://open.ucpaas.com/ol/sms/sendsms\";\n $body_json = array(\n \"sid\" => \"1cea456798e180e58fe1e96e9ef9a1e2\",\n \"token\" => \"2fe296ae9fb014aa261b93652375ad0b\",\n \"appid\" => \"c3f231b11343405bb2a8956b2609205f\",\n \"templateid\" => \"430629\",\n \"param\" => $param,\n \"mobile\" => $req->get('mobile')\n );\n $body = json_encode($body_json);\n $data = $this->getResult($url, $body,'post');\n //return $data;\n $obj = json_decode($data);\n if ($obj->code == \"000000\"){\n return $param;\n }\n return \"0000\";\n }", "function browserCredentials() {\n if(isset($_GET['code'])) return true;\n\n return false;\n}", "function users_user_activation($args)\n{\n $code = base64_decode(FormUtil::getPassedValue('code', (isset($args['code']) ? $args['code'] : null), 'GETPOST'));\n $code = explode('#', $code);\n\n if (!isset($code[0]) || !isset($code[1])) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n $uid = $code[0];\n $code = $code[1];\n\n // Get user Regdate\n $regdate = pnUserGetVar('user_regdate', $uid);\n\n // Checking length in case the date has been stripped from its space in the mail.\n if (strlen($code) == 18) {\n if (!strpos($code, ' ')) {\n $code = substr($code, 0, 10) . ' ' . substr($code, -8);\n }\n }\n\n if (DataUtil::hash($regdate, 'md5') == DataUtil::hash($code, 'md5')) {\n $returncode = pnModAPIFunc('Users', 'user', 'activateuser',\n array('uid' => $uid,\n 'regdate' => $regdate));\n\n if (!$returncode) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n LogUtil::registerStatus(__('Done! Account activated.'));\n return pnRedirect(pnModURL('Users', 'user', 'loginscreen'));\n } else {\n return LogUtil::registerError(__('Sorry! You entered an invalid confirmation code. Please correct your entry and try again.'));\n }\n}", "function eis_device_exec($calldata) {\n\tglobal $eis_conf,$eis_dev_conf,$eis_dev_status;\n\t$callparam=$calldata[\"param\"];\n\tswitch ($calldata[\"cmd\"]) {\n\t\t// put other commands and related code here\n\t\t// case \"mycommand\":\n\t\t\t\t// your command code here\n\t\t\t\t// return success: $returnmsg=array(\"error\"=>null, \"returnpar\"=>yourreturnarray);\n\t\t\t\t// return failure: $returnmsg=array(\"error\"=>yourerror,\"returnpar\"=>array(\"errordata\"=>yourerrormsg));\n\t\t\t\t// break;\n\n\t\tdefault:\n\t\t\t// manage unknown command\n\t\t\t$returnmsg=eis_error_msg(\"system:unknownCommand\",$calldata[\"cmd\"]);\n\t}\n\treturn $returnmsg;\n}", "public function send_verify_code_to_phone(Request $request)\n {\n $phone = $request->input('phone_number');\n $code = $this->generate_verify_code();\n //todo: save verify code to this wxuser\n\n $wxuser_id = session('wechat_user_id');\n $wxuser = WechatUser::find($wxuser_id);\n $wxuser->phone_verify_code = $code;\n $wxuser->save();\n\n return response()->json(['status' => 'success']);\n\n }", "public function authenticate()\n\t{\n\t\tif ($data['code'] = $this->input->get('code', false, 'raw'))\n\t\t{\n\t\t\t$data['grant_type'] = 'authorization_code';\n\t\t\t$data['redirect_uri'] = $this->getOption('redirecturi');\n\t\t\t$data['client_id'] = $this->getOption('clientid');\n\t\t\t$data['client_secret'] = $this->getOption('clientsecret');\n\t\t\t$response = $this->http->post($this->getOption('tokenurl'), $data);\n\n\t\t\tif ($response->code >= 200 && $response->code < 400)\n\t\t\t{\n\n\t\t\t\tif ($response->headers['Content-Type'] == 'application/json')\n\t\t\t\t{\n\t\t\t\t\t$token = array_merge(json_decode($response->body, true), array('created' => time()));\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tparse_str($response->body, $token);\n\t\t\t\t\t$token = array_merge($token, array('created' => time()));\n\t\t\t\t}\n\n\t\t\t\t$this->setToken($token);\n\n\t\t\t\treturn $token;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tthrow new RuntimeException('Error code ' . $response->code . ' received requesting access token: ' . $response->body . '.');\n\t\t\t}\n\t\t}\n\n\t\tif ($this->getOption('sendheaders'))\n\t\t{\n\t\t\t$this->application->redirect($this->createUrl());\n\t\t}\n\t\treturn false;\n\t}", "static function verifyMobile($usr,$code){\r\n\t\t$usr = funcs::check_input($usr);\r\n\t\t$code = funcs::check_input($code);\r\n\r\n\t\t$expired_time = 7*24*60*60;\r\n\t\tif(strlen(trim($usr)) > 0)\r\n\t\t{\r\n\t\t\t$usrId = funcs::getUserid(htmlspecialchars($usr,ENT_QUOTES,'UTF-8'));\r\n\t\t\tif(ctype_digit($usrId) && strlen(trim($code)) > 0)\r\n\t\t\t{\r\n\t\t\t\t$chk = DBConnect::assoc_query_1D(\"SELECT vcode_mobile,waitver_mobileno,vcode_mobile_insert_time FROM \".TABLE_MEMBER.\" WHERE id=\".$usrId);\r\n\t\t\t\tif(strlen(trim($chk['waitver_mobileno'])) > 0 && strlen(trim($chk['vcode_mobile'])) > 0 && $chk['vcode_mobile'] == $code)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(time() <= ((int)$chk['vcode_mobile_insert_time']+$expired_time))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$query = \"UPDATE \".TABLE_MEMBER.\" SET validated='1',mobileno='\".$chk['waitver_mobileno'].\"',waitver_mobileno='' WHERE id=\".$usrId;\r\n\t\t\t\t\t\tDBconnect::execute_q($query);\r\n\t\t\t\t\t\t$_SESSION['MOBILE_VERIFIED'] = 1;\r\n\r\n\t\t\t\t\t\tif(COIN_VERIFY_MOBILE > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$username = funcs::findUserName($usrId);\r\n\t\t\t\t\t\t\t$coinVal = funcs::checkCoin($username);\r\n\r\n\t\t\t\t\t\t\tDBconnect::execute_q(\"UPDATE \".TABLE_MEMBER.\" SET coin=coin+\".COIN_VERIFY_MOBILE.\" WHERE id=\".$usrId);\r\n\t\t\t\t\t\t\t$sqlAddCoinLog = \"INSERT INTO coin_log (member_id, send_to, coin_field, coin, coin_remain, log_date) VALUES ('1','$usrId','Mobile Verify','\".COIN_VERIFY_MOBILE.\"',\".$coinVal.\", NOW())\";\r\n\t\t\t\t\t\t\tDBconnect::execute($sqlAddCoinLog);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\treturn 4;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\treturn 3;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\treturn 2;\r\n\t\t\t}\r\n\t\t\tunset($usrId);\r\n\t\t}\r\n\t}", "function http_response_code($response_code = 0) { \r\n \r\n if($response_code)\r\n Pancake\\vars::$Pancake_request->answerCode = $response_code;\r\n return Pancake\\vars::$Pancake_request->answerCode;\r\n }", "abstract public function checkCode(string $uuid, string $code, int $successFlag = self::NOTHING_ON_SUCCESS);", "function response($code, $errMsg='success') {\n\techo json_encode(array('code' => $code, 'errMsg' => $errMsg));\n\texit(0);\n}", "public function resendCode($phone)\n\t{\t\n\t\t$user = new User();\n\t\t$user->phone = $phone;\n\t\t$user->phone_token = mt_rand(100000, 999999);\n\n\t\t$querry = \"UPDATE \". DBTool::rawTable('users') . \" SET phone_token = '\" . $user->phone_token . \"', verified_phone = 0 WHERE phone = '\" . $phone . \"'\";\n\t\t$updated = DB::update(DB::raw($querry));\n\t\t$updated = ArrayHelper::fromObject($updated);\n\n\t\t// Send Verification Code by SMS\n\t\t// $this->sendVerificationCode($user);\n\n\t\tif(!(NotifyController::SendNotification(\n\t\t\t\t['1' => 'NOFIFY_SMS'],\n\t\t\t\t['phone' => \"$phone\",\n\t\t\t\t'message'=>\"$this->message $user->phone_token\",\n\t\t\t\t'verify' => 1]\n\t\t))){\n\t\t\treturn redirect()->back();\n\t\t}\n\t\t$data = [];\n\t\t\n\t\t// References\n\t\t$data['countries'] = CountryLocalizationHelper::transAll(CountryLocalization::getCountries());\n\t\t$data['genders'] = Gender::trans()->get();\n\t\t$data['phone'] = $phone;\n\t\t// Meta Tags\n\t\tMetaTag::set('title', getMetaTag('title', 'register'));\n\t\tMetaTag::set('description', strip_tags(getMetaTag('description', 'register')));\n\t\tMetaTag::set('keywords', getMetaTag('keywords', 'register'));\n\t\t\n\t\treturn view('auth.register.indexSecond', $data);\n\t}", "function add_otp($mobile,$otp)\n{\n\tglobal $sapiUrl,$sapiVersion,$sapiEncoding;\n\t\n\t$response = Array();\n\t\n\t$url = $sapiUrl.\"?VERSION=\".$sapiVersion.\"&ENCODING=\".$sapiEncoding.\"&METHOD=ADD_OTP&mobile=\".$mobile.\"&otp=\".$otp;\n\t\n\t$data = json_decode(file_get_contents($url),true);\n\t\n\t/* if ($data['RESULT'] == 'SUCCESS')\n\t{\n\t\t\t$response = $data['RESPONSE'];\n\t\t\treturn $response;\n\t\t\t\n\t} \n\telse{\n\t\t return $response;\n\t\t} */\n return $data;\n}", "public function verify_actcode($member_email, $code){\n\t\t//$newCode = $this->make_activation_code();\n\t\t$mysql = New Mysql();\n\t\treturn($mysql->update_activation_code($member_email, $code));\n\t}", "public function getCode()\n {\n return $this->isSuccessful() ? $this->data[\"AuthCode\"] : parent::getCode();\n }", "public function sendOTP_post()\n {\n $phone = $this->input->post('phone');\n $otp = $this->generateRandomString();\n $check = $this->User_model->select_data('*',\"tbl_otp\",array('phone'=>$phone));\n if (empty($check)) {\n $this->User_model->insert_data('tbl_otp',array('phone'=>$phone,'otp'=>$otp,'addedOn'=>date(\"Y-m-d H:i:s\")));\n } else {\n $this->User_model->update_data('tbl_otp',array('otp'=>$otp,'updatedOn'=>date(\"Y-m-d H:i:s\")),array('phone'=>$phone));\n }\n\n\n $msg = array('to'=>$phone,'body'=>\"Your verification code for Kudos is: $otp\");\n // print_r($this->twilioMessage()); die;\n $this->twilioMessage($msg);\n $status = 1;\n $response = array();\n\n if ( $status == 0 ) {\n $response['status'] = 'error';\n $response['message'] = 'This failed';\n } else {\n $response['status'] = 'success';\n $response['message'] = 'OTP sent successfully';\n $response['otp'] = $otp;\n }\n\n //echo json_encode($response);\n $this->set_response($response, REST_Controller::HTTP_OK);\n /* Twilio sms verification End */\n }", "function respond($code, $message) {\n header('Content-Type: application/json');\n header(\"X-PHP-Response-Code: $code\", true, $code);\n echo '{\"message\": \"' . $message . '\"}';\n die();\n}", "public function resend_otp_data_post()\n {\n $response = new StdClass();\n $result = new StdClass();\n $device_id =$this->input->post('device_id');\n $mobile_no =$this->input->post('mobile_no');\n $otpValue=mt_rand(1000, 9999);\n $data1->device_id = $device_id;\n $data1->mobile_no=$mobile_no;\n $data1->otp=$otpValue;\n $res = $this->Supervisor->send_otp($mobile_no,$otpValue);\n if(!empty($mobile_no))\n {\n $res1 = $this->Supervisor->resend_otp($data1);\n\n $data->message = 'success';\n $data->status = '1';\n array_push($result,$data);\n $response->data = $data;\n }\n\n else\n {\n $data->message = 'failed';\n $data->status = '0';\n array_push($result,$data);\n $response->data = $data;\n } \n echo json_output($response);\n }", "function aCAuth($r)\t{\n\t\tif ($this->authCode && !strcmp($this->authCode,$this->authCode($r)))\t{\n\t\t\treturn true;\n\t\t}\n\t}", "public function activate_device_authorization($code)\n {\n // Retrieve the token object from the code\n $token = $this->ion_auth_model->_retrieve_selector_validator_couple($code);\n\n if ($token) {\n // Get device to this selector code\n $query = $this->db->select('id, device_selector, device_code')\n ->where('device_selector', $token->selector)\n ->get('device_authorization');\n\n $device = $query->row();\n\n if ($device) {\n // Check the hash against the validator\n if ($this->ion_auth_model->verify_password($token->validator, $device->device_code)) {\n return $device->id;\n }\n }\n }\n\n return FALSE;\n }", "public function getAccessTokenFromAuthCode($auth_code,$state) {\n\t\t//Compare state to make sure it is the same. It is your job to retreive the state from your database and compare it\n\t\t//to what was echoed back to you after authorizing.\n\n\t\tif($this->state != $state) return null; //state did not match\n\t\t\n\t\t//array causes Content-Type:multipart/form-data\t\t\n\t\t$post = array(\"grant_type\"=>\"authorization_code\",\"code\"=>$auth_code,'vers'=>$this->app_version,'os'=>$this->os_version,'device'=>$this->device_name,'udid'=>$this->device_id);\n\t\t\n\t\t//str causes Content-Type:application/x-www-form-urlencoded (both work for code exchange)\n\t\t//$post = \"grant_type=authorization_code&code=\".$auth_code;\n\n\n\t\t$ci = curl_init();\n\t\tcurl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);\n\t\tcurl_setopt($ci, CURLOPT_USERPWD, $this->clientID . \":\" . $this->clientSecret);\n\t\tcurl_setopt($ci, CURLOPT_POST, TRUE);\n\t\tcurl_setopt($ci, CURLOPT_POSTFIELDS, $post);\n\t\tcurl_setopt($ci, CURLOPT_URL, $this->token_url);\n\t\t$response = curl_exec($ci);\n\t\tcurl_close ($ci);\n\n\t\t$response = json_decode($response,true);\n\t\treturn $response;\n\t}", "function deliver($code)\n{ \n\n\techo \"// http://license.mxgraph.com/hosted \\n\";\n\techo $code;\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}", "public function sendPhoneVerificationNotification();", "public function authenticationCallback() \n\t{\n\t\n\t\tif (!isset($_GET['code'])) {\n\t\t\treturn;\n\t\t}\n\n\t\t$store = SBTCredentialStore::getInstance();\n\t\t$settings = new SBTSettings();\n\t\t\n\t\t$endpointName = \"connections\";\n\t\tif (isset($_GET['endpointName'])) {\n\t\t\t$endpointName = $_GET['endpointName'];\n\t\t}\n\n\t\t$parameters = array(\n\t\t\t\t'callback_uri' => $settings->getOAuth2CallbackURL($endpointName),\n\t\t\t\t'code' => $_GET['code'],\n\t\t\t\t'grant_type' => 'authorization_code',\n\t\t\t\t'client_id' => $settings->getClientId($endpointName),\n\t\t\t\t'client_secret' => $settings->getClientSecret($endpointName)\n\t\t);\n\t\t\n\t\t$tokenURL = $settings->getAccessTokenURL($endpointName) . '?' . http_build_query($parameters, null, '&');\n\t\t$client = new Client($tokenURL);\n\t\t$client->setDefaultOption('verify', false);\n\t\t\n\t\t$headers = null;\n\t\t$body = null;\n\t\t$options = array();\n\t\t$response = null;\n\t\t\n\t\ttry {\n\t\t\t$request = $client->createRequest('GET', $tokenURL, $headers, $body, $options);\n\t\t\tif ($settings->forceSSLTrust($endpointName)) {\n\t\t\t\t$request->getCurlOptions()->set(CURLOPT_SSL_VERIFYHOST, false);\n\t\t\t\t$request->getCurlOptions()->set(CURLOPT_SSL_VERIFYPEER, false);\n\t\t\t}\n\t\t\t$response = $request->send();\n\t\t\n\t\t\tforeach ($response->getHeaderLines() as $h) {\n\t\t\t\tif (strpos($h, \"Content-Type\") === 0) header($h, TRUE);\n\t\t\t}\n\t\t\n\t\t\theader(':', true, $response->getStatusCode());\n\t\t\theader('X-PHP-Response-Code: ' . $response->getStatusCode(), true, $response->getStatusCode());\n\t\t\n\t\t\tparse_str($response->getBody(TRUE), $info);\n\t\t\n\t\t\tif (!isset($info['access_token'])) {\n\t\t\t\tdie('Missing access token. Something went wrong - make sure that your client ID and client secret are correct and try again.');\n\t\t\t}\n\t\t\t\n\t\t\t$accessToken = $store->getOAuthAccessToken($endpointName);\n\t\t\tif ($accessToken == null || $accessToken == \"\") {\n\t\t\t\t$store->storeOAuthAccessToken($info['access_token'], $endpointName);\n\t\t\t}\n\t\t\t\n\t\t\theader(\"Location: \" . $settings->getOAuthOrigin($endpointName));\n\t\t\t\n\t\t} catch(Guzzle\\Http\\Exception\\BadResponseException $e) {\n\t\t\t$response = $e->getResponse();\n\t\t\tprint_r($response->getBody(TRUE));\n\t\t}\n\t}", "public function Execute() {\r\n $barcode = filter_input(INPUT_POST, 'barcode'); //$_POST['barcode'];\r\n $result = array();\r\n $result['verified'] = 'false';\r\n if ($barcode != '') {\r\n $item = $this->FindItemByICPARM($barcode);\r\n if ($item !== null) {\r\n //$result = 'true'; \r\n $result['itemno'] = trim($item->getItemno());\r\n $result['descrip'] = trim($item->getDescrip());\r\n $result['verified'] = 'true';\r\n } else {\r\n $item = $this->FindItemByICUPCPARM($barcode);\r\n if ($item !== null) {\r\n //$result = 'true'; \r\n $result['itemno'] = trim($item->getItemno());\r\n $result['descrip'] = trim($item->getDescrip());\r\n $result['verified'] = 'true';\r\n }\r\n }\r\n }\r\n\r\n return json_encode($result);\r\n }", "function check_reffer_code() {\n\t\t$reffer_code = $_REQUEST['reffer_code'];\n\t\tif (!empty($reffer_code)) {\n\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\t\tif (!empty($reffer_records)) {\n\t\t\t\t$user_id = $reffer_records[0]['user_id'];\n\t\t\t\t$user_reffer_code = $reffer_records[0]['user_refferal_code'];\n\n\t\t\t\t//if($user_reffer_code==$reffer_code){\n\t\t\t\tif (strcmp($user_reffer_code, $reffer_code) == 0) {\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Reffer code avalible\", 'reffer_code' => $reffer_code, 'user_id' => $user_id);\n\t\t\t\t} else {\n\t\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t}\n\t\t} else {\n\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Missing parameter\", 'reffer_code' => $reffer_code);\n\t\t}\n\t\techo $this -> json($post);\n\t}", "function generate_authcode_email($email,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER,$check=true)\n\t{\n\t\t$authcode=\"\";\n\t\tif($check) $errorcode=$this->check_authcode_email($email,$code_type,$user_id);\t\n\t\telse $errorcode=array('errorcode'=>false);\n\t\tif(!$errorcode['errorcode'])\n {\t\n $authcode=random_string('unique');\n $data=$this->bind_verify($user_id,$email,\"\",1,$code_type,$authcode,$user_type);\n\t\t\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode,json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_EMAIL);\n\t\t\t\t$this->save_check('email',$email,$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_EMAIL);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n \t\t$insert_id=$this->db->insert_id();\n \t\tif($insert_id>0) $errorcode=true;\n \t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170018:Gen email auth code',array('email'=>$email));\n\t\t\tif(!$errorcode) log_message('error_tizi','17018:Gen email auth code failed',array('email'=>$email));\t\t\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t}\n\t\treturn array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "function sendAccountActivationCode($userData, $code)\n {\n $this->getCountryCode($userData->country_id);\n $template = 'USR002';\n $username = \"$userData->first_name $userData->last_name\";\n $replace = ['[UserName]', '[UserActivationCode]'];\n $with = [$username, $code];\n $to = $this->countryCode . (int) $userData->mobile_no;\n parent::sendSms($to, $replace, $with, $template);\n }", "public function sendOtp($phone){\n $cc = \"+91\";\n $this->db->select('otp')->from('otp')->where('phone',$phone);\n $q = $this->db->get();\n if($q->num_rows() == 0){\n $otp = rand(1000,9999);\n $data = array(\n 'phone' => $phone,\n 'otp' => $otp\n );\n $this->db->insert('otp',$data);\n }else{\n $res = $q->result();\n $otp = $res[0]->otp;\n }\n \n // if send sms successful\n return 1;\n }", "public function check() : int\n {\n\n /**\n * @return invalid request(1) if a code is empty ,null or undefined,\n * if not continue the next execution\n */\n\n if(!$this->code) return INVALID_REQUEST;\n\n\n /** @var $is_valid check the specified code is equal and valid */\n\n $is_valid = database::getInstance()->has('user',[\n\n \"id\" => (new Users())->get_id(),\n\n \"verification_code\" => $this->code\n\n ]);\n\n /** validation */\n\n if($is_valid) {\n\n /** @var $success if a specified code is valid\n * update the current status of \"isVerify\" attribute of a database\n * to PHONE_NUMBER_VERIFIED(1) and\n * @return the number of affected rows\n */\n\n $success = database::getInstance()->update('user',['isVerify'=>user_type::PHONE_NUMBER_VERIFIED],[\n\n \"id\"=> (new Users())->get_id()\n\n ])->rowCount();\n\n /** if has a affeted rows return valid request(2), invalid request if not */\n\n return $success ? VALID_REQUEST : INVALID_REQUEST;\n\n }\n\n\n /** return invalid request(1) if a code is not equal */\n\n return INVALID_REQUEST;\n\n\n\n }", "public function httpCode($code=null){\n\t\t// FIXME: this doesn't take care to differentiate which codes are\n\t\t// in HTTP/1.0 vs HTTP/1.1; should it?\n\t\t$phrases = array(\n\t\t\t100 => \"Continue\",\n\t\t\t101 => \"Switching Protocols\",\n\n\t\t\t200 => \"OK\",\n\t\t\t201 => \"Created\",\n\t\t\t202 => \"Accepted\",\n\t\t\t203 => \"Non-Authoritative Information\",\n\t\t\t204 => \"No Content\",\n\t\t\t205 => \"Reset Content\",\n\t\t\t206 => \"Partial Content\",\n\n\t\t\t300 => \"Multiple Choices\", // useful for disambiguation?\n\t\t\t301 => \"Moved Permanently\",\n\t\t\t302 => \"Found\",\n\t\t\t303 => \"See Other\",\n\t\t\t304 => \"Not Modified\",\n\t\t\t305 => \"Use Proxy\",\n\t\t\t307 => \"Temporary Redirect\",\n\n\t\t\t400 => \"Bad Request\",\n\t\t\t401 => \"Unauthorized\", // use when auth'ing will make a request valid\n\t\t\t403 => \"Forbidden\", // use when auth'ing won't make a difference\n\t\t\t404 => \"Not Found\",\n\t\t\t405 => \"Method Not Allowed\", // HTTP method, e.g. using GET when only POST is valid\n\t\t\t406 => \"Not Acceptable\",\n\t\t\t407 => \"Proxy Authentication Required\",\n\t\t\t408 => \"Request Timeout\",\n\t\t\t409 => \"Conflict\",\n\t\t\t410 => \"Gone\", // something existed but was intentionally removed\n\t\t\t411 => \"Length Required\",\n\t\t\t412 => \"Precondition Failed\",\n\t\t\t413 => \"Request Entity Too Large\",\n\t\t\t414 => \"Request-URI Too Long\",\n\t\t\t415 => \"Unsupported Media Type\",\n\t\t\t416 => \"Requested Range Not Satisfiable\",\n\t\t\t417 => \"Expectation Failed\",\n\n\t\t\t500 => \"Internal Server Error\",\n\t\t\t501 => \"Not Implemented\",\n\t\t\t502 => \"Bad Gateway\",\n\t\t\t503 => \"Service Unavailable\",\n\t\t\t504 => \"Gateway Timeout\",\n\t\t);\n\n\t\tif(!is_null($code)){\n\t\t\tif(!array_key_exists($code, $phrases)){\n\t\t\t\t$code = 404;\n\t\t\t}\n\t\t\theader(\"HTTP/1.1 $code {$phrases[$code]}\");\n\t\t\t$this->httpResponseCode = $code;\n\t\t}\n\n\t\treturn \"HTTP/1.1 $this->httpResponseCode {$phrases[$this->httpResponseCode]}\";\n\t}", "public function send_cmd($request) {\n\t\t// make or get the socket filehandle\n\t\tif (!$this->init_socket() ) {\n\t\t\ttrigger_error (\"oSRS Error - Unable to establish socket: (\". $this->_socketErrorNum .\") \". $this->_socketErrorMsg, E_USER_WARNING);\n\t\t\tdie();\n\t\t}\n\n\t\t// Authenticate user\n\t\t$auth = $this->authenticate();\n\t\t\n\t\tif (!$auth) {\n\t\t\tif ($this->_socket) $this->close_socket();\n\t\t\ttrigger_error (\"oSRS Error - Authentication Error: \". $auth['error'], E_USER_WARNING);\n\t\t\tdie();\n\t\t}\n\n\t\t$this->send_data($request);\n\t\t$data = $this->read_data();\n \n $num_matches = preg_match('/<item key=\"response_code\">401<\\/item>/', $data, $matches);\n\n if ($num_matches > 0)\n trigger_error(\"oSRS Error - Reseller username or osrs_key is incorrect, please check your config file.\");\n \n\t\treturn $data;\n\t}", "function authCode($r,$extra='')\t{\n\t\t$l=$this->codeLength;\n\t\tif ($this->conf['authcodeFields'])\t{\n\t\t\t$fieldArr = t3lib_div::trimExplode(',', $this->conf['authcodeFields'], 1);\n\t\t\t$value='';\n\t\t\twhile(list(,$field)=each($fieldArr))\t{\n\t\t\t\t$value.=$r[$field].'|';\n\t\t\t}\n\t\t\t$value.=$extra.'|'.$this->conf['authcodeFields.']['addKey'];\n\t\t\tif ($this->conf['authcodeFields.']['addDate'])\t{\n\t\t\t\t$value.='|'.date($this->conf['authcodeFields.']['addDate']);\n\t\t\t}\n\t\t\t$value.=$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];\n\t\t\treturn substr(md5($value), 0,$l);\n\t\t}\n\t}", "function update_user_phone()\n\t{\n\t\tlog_message('debug', 'Account/update_user_phone');\n\t\tcheck_access($this,'__redirect'); #redirect away from this function if user is not logged in\n\n\t\t$data = filter_forwarded_data($this);\n\t\t$result = FALSE;\n\t\t$data['msg'] = '';\n\t\tlog_message('debug', 'Account/update_user_phone:: [1] post='.json_encode($_POST));\n\t\tlog_message('debug', 'Account/update_user_phone:: [2] data='.json_encode($data));\n\t\t# a) The user is updating the telephone number\n\t\tif(!empty($_POST['telephone'])){\n\t\t\t$data['hasPosted'] = 'Y';\n\t\t\t$response = $this->_api->post('user/telephone', array(\n\t\t\t\t\t'telephone'=>$_POST['telephone'],\n\t\t\t\t\t'provider'=>$_POST['provider__provider'],\n\t\t\t\t\t'isPrimary'=>'Y'\n\t\t\t\t));\n\n\t\t\t# Update the user telephone and provider if sucessful\n\t\t\tif(!empty($response['result']) && $response['result']=='SUCCESS'){\n\t\t\t\t$this->native_session->set('__telephone', $_POST['telephone']);\n\t\t\t\t$this->native_session->set('__provider', $response['provider']);\n\t\t\t\t$this->native_session->set('__provider_id', $_POST['provider__provider']);\n\t\t\t\t$data['msg'] = 'Your phone number has been updated and verification code sent.';\n\t\t\t\t$result = TRUE;\n\t\t\t\t$data['area'] = 'verify_code_form';\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$data['msg'] = 'ERROR: Your phone number could not be updated';\n\t\t\t\t$data['area'] = 'user_phone_details';\n\t\t\t}\n\t\t}\n\n\n\t\t# b) Verify telephone code\n\t\telse if(!empty($_POST['usercode'])){\n\t\t\t$data['hasPosted'] = 'Y';\n\t\t\t$response = $this->_api->post('account/verify', array(\n\t\t\t\t'code'=>$_POST['usercode'],\n\t\t\t\t'telephone'=>$this->native_session->get('__telephone'),\n\t\t\t\t'baseLink'=>base_url()\n\t\t\t));\n\n\t\t\tif(!empty($response['verified']) && $response['verified']=='Y'){\n\t\t\t\t$this->native_session->set('__telephone_verified', 'Y');\n\t\t\t\t$data['msg'] = '20 Points have been added to your Clout Score';\n\t\t\t\t$data['area'] = 'verify_code_results';\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$data['msg'] = 'ERROR: Your phone could not be verified.<br>Please try again.';\n\t\t\t\t$data['area'] = 'verify_code_form';\n\t\t\t}\n\t\t}\n\n\n\t\t# c) the user has already verified their phone.\n\t\telse if($this->native_session->get('__telephone_verified') && $this->native_session->get('__telephone_verified') == 'Y'){\n\t\t\t# if this is a user with more privileges to view the network page take them to the network home instead\n\t\t\tif($this->native_session->get('__direct_invitation_count')\n\t\t\t\t&& $this->native_session->get('__direct_invitation_count') >= MINIMUM_INVITE_COUNT\n\t\t\t){\n\t\t\t\t$view = check_access($this,'can_view_invite_tools')? 'network/home': 'account/thank_you';\n\t\t\t}\n\t\t\telse $view = 'network/invite';\n\n\t\t\t# take to appropriate view\n\t\t\tredirect(base_url().$view);\n\t\t}\n\n\n\t\t# c) the user is coming to this page for first time OR they havent verified their phone yet\n\t\telse if(!(!empty($data['edit']) && $data['edit'] == 'Y') && $this->native_session->get('__telephone') && $this->native_session->get('__provider_id')\n\t\t\t&& (!$this->native_session->get('__telephone_verified') || ($this->native_session->get('__telephone_verified') && $this->native_session->get('__telephone_verified') == 'N'))\n\t\t){\n\t\t\t$response = $this->_api->post('user/telephone', array(\n\t\t\t\t\t'telephone'=>$this->native_session->get('__telephone'),\n\t\t\t\t\t'provider'=>$this->native_session->get('__provider_id'),\n\t\t\t\t\t'isPrimary'=>'Y'\n\t\t\t));\n\n\t\t\t# Prepare appropriate message\n\t\t\t$data['msg'] = (!empty($response['result']) && $response['result']=='SUCCESS')? 'A verification message has been sent to your phone. Enter the code here to confirm your phone number.': 'ERROR: A verification message could not be sent to your phone. <br>Click Resend to attempt sending it again, or Edit to change your phone details.';\n\t\t\t$result = TRUE;\n\t\t\t$data['area'] = 'verify_code_form';\n\t\t}\n\n\n\t\t# d) The user has to enter their phone details from scratch\n\t\telse $data['area'] = 'user_phone_details';\n\n\t\t$data = load_page_labels('link_card', $data);\n\t\t$this->load->view('account/verify_phone', $data);\n\t}", "function registerOnEjabberd($mobile_no,$jaxlPassword){\n /*********************register with curl code start*****************************************/\n $ch = curl_init();\n $options = array(\n CURLOPT_URL => \"https://sociabile-test.m.in-app.io:5281/api/register\",\n //CURLOPT_HEADER => true,\n CURLOPT_POST => 1,\n // CURLOPT_HTTPHEADER => $headers,\n CURLOPT_POSTFIELDS => '[\"'.$mobile_no.'\",\"'.JAXL_HOST_NAME.'\",\"'.$jaxlPassword.'\"]',\n CURLOPT_FOLLOWLOCATION => true,\n CURLOPT_RETURNTRANSFER => true\n ); // cURL options\n curl_setopt_array($ch, $options);\n $result = curl_exec($ch);\n curl_close($ch);\n if( strpos($result, \"successfully registered\") !== false || strpos($result, \"already registered\") !== false ){\n return array(\"jaxl_id\"=>$mobile_no.'@'.JAXL_HOST_NAME, \"jaxl_password\"=>$jaxlPassword);\n }else{\n Library::logging('error',\"API : registration : JAXL registration failed with error \".$result.\". \".$mobile_no);\n Library::output(false, '0', JAXL_REG_FAILED, null); \n \n }\n /*********************register with curl code end*****************************************/\n \n require 'components/JAXL3/jaxl.php';\n require 'components/JAXL3/register.php';\n $client = new JAXL(array(\n// 'jid' => JAXL_HOST_NAME,\n 'host' => JAXL_HOST_NAME,\n 'log_level' => JAXL_ERROR,\n \"port\"=>5281\n ));\n\n $client->require_xep(array(\n '0077'\t// InBand Registration\t\n ));\n $form=array( \"username\"=>$mobile_no, \"password\"=>$jaxlPassword );\n $client->add_cb('on_stream_features', function($stanza) {\n $client = $_SESSION[\"client\"];\n $client->xeps['0077']->get_form(JAXL_HOST_NAME);\n return \"wait_for_register_form\";\n });\n\n $client->add_cb('on_disconnect', function() {\n });\n $_SESSION[\"client\"] = $client;\n $_SESSION[\"form\"] = $form;\n // finally start configured xmpp stream\n $client->start();\n $form = $_SESSION[\"form\"];\n unset($_SESSION[\"client\"]);\n unset($_SESSION[\"form\"]);\n if( isset($form['type']) ) {\n if($form['type'] == 'result') { //if registered successfully\n return array(\"jaxl_id\"=>$form[\"username\"].'@'.JAXL_HOST_NAME, \"jaxl_password\"=>$jaxlPassword);\n }else{ //if not registered successfully with an error\n Library::logging('error',\"API : registration : JAXL registration failed with error \".$form['type'].\". \".$mobile_no);\n Library::output(false, '0', JAXL_REG_FAILED, null); \n }\n }else{ //if not registered successfully with unknown error\n Library::logging('error',\"API : registration : JAXL registration failed \".$mobile_no. var_export($form, true));\n Library::output(false, '0', JAXL_REG_FAILED, null);\n }\n }", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = $_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\n\t\t\t// Refferal amount\n\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t//-----------------/////\n\n\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\tif (!empty($records)) {\n\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount = $records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic = $records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) {\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n\t\t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$img = self_img_url . $user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$img = '';\n\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif ($status == '1') {\n\t\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\t\texit();\n\t\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status'] = 1;\n\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data);\n\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\t\t\t\tif (!empty($reffer_records)) {\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\n\t\t\t\t\t\t$data12['reffer_user_id'] = $user11_id;\n\t\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data12);\n\n\t\t\t\t\t}\n\t\t\t\t\t/*\n\t\t\t\t\t if(!empty($reffer_records)){\n\t\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t\t $refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t $user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t $reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t $wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t $frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t $current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t $transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t $wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t $refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t $wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t $wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t if($reffer_code == $reffer_code_database){\n\n\t\t\t\t\t $add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\n\t\t\t\t\t $add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t $data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t $update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\n\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t\t */\n\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'], 'user_id' => $user_id, 'user_wallet' => $wallet_amount, 'user_email' => $user_email, 'login_type' => 1, 'user_reffer_code' => $user_self_reffer, 'profile_pic' => $img, 'user_pin_status' => '2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\", 'user_mobile_no' => $_POST['user_mobile_no'], 'verification_code' => $_POST['user_verification_code']);\n\t\t\techo $this -> json($error);\n\t\t}\n\t}", "public function errorcode();", "public function enter_data($name,$email){\n\n\n $status=0;//status is 0 initially\n $code=md5(rand(0,1000));\n \t$query = $this ->conn ->prepare('INSERT INTO androidusers SET name =:name,\n email =:email, status =:status, code=:code');\n \t$query->execute(array('name' => $name, ':email' => $email, 'status'=>$status, 'code'=>$code));\n\n //Send verification link to registered email after clicking the link the confirmed email address after that admin sends password to \n //that email.\n $mail = new PHPMailer;\n $mail->isSMTP();//SMTP-Simple mail transfer protocol(TCP/IP)protocol used in sending and receiving email.\n $mail->Host = 'smtp.mail.yahoo.com';\n $mail->Port = 587;//TLS port number in case of SSL 465.\n $mail->SMTPSecure = 'tls';// TLS- Transport layer security is a cryptographic protocol that provide authentication and data encryptions between the servers\n //e.g client connection to webserver\n $mail->SMTPAuth = true;\n $mail->Username = '';//Admin can replace email alotted to them\n $mail->Password = '';//Password can also be replaced according to the email\n $mail->From = \"[email protected]\";\n $mail->FromName = \"[email protected]\";\n $mail->AddAddress($email);\n $mail->Subject = 'SMART LAB IoT USER LOGIN - EMAIL VERIFICATION';\n \n $mail->msgHTML('<p>Dear '.$name.',<br/><br/><br/> Your verification link is: http://192.168.1.101/android/server/verify.php?name='.$name.'&email='.$email.'&code='.$code.'</p>');\n \n if (!$mail->send()) {\n $error = \"Mailer Error: \" . $mail->ErrorInfo;\n echo '<p id=\"para\">'.$error.'</p>';\n }\n else {\n return true;\n }\n //Ending mail function\n\n\n\n if ($query) {\n \n return true;\n\n } else {\n\n return false;\n\n }\n\n\n\n\n\n\n }", "public function authenticate($code){\n\t\t$this->client->authenticate($_GET['code']);\n\t\t$_SESSION['token'] = $this->_token = $this->client->getAccessToken();\n\n\t\tif (isset($_SESSION['token'])) {\n\t\t\t$this->client->setAccessToken($_SESSION['token']);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\n\t}", "function HTTPFailWithCode($code,$message)\n{\n\theader(reasonForCode($code));\n\texit($message);\n}", "public function set_auth_code() {\n\t\t$tokens = new Token_User( '_indieauth_code_' );\n\t\t$tokens->set_user( self::$author_id );\n\t\treturn $tokens->set( static::$test_auth_code, 600 );\n\t}", "function onAction_agent_trojan()\n {\n $bAskPasscode = true;\n $code = false;\n\n $this->set('ask_passcode', false);\n\n if (isset($_POST['passcode']))\n {\n $code = $_POST['passcode'];\n }\n else if (isset($_GET['passcode']))\n {\n $code = $_GET['passcode'];\n }\n\n if ($code === PASSCODE_TROJAN)\n {\n $bAskPasscode = false;\n }\n\n if ($bAskPasscode === true)\n {\n // no passcode set or wrong, so must ask user\n $this->m_bRender = true;\n $this->set('ask_passcode', true);\n }\n else\n {\n // do some actions...\n\n // finally... redirect to main page\n $this->redirect('/');\n }\n }", "public function check_pincode(){\n // $area_id = $_REQUEST['area_id'];\n $pincode = $_REQUEST['pincode'];\n $check_pin = $this->User_Model->check_duplication('',$pincode,'tahsil_pincode_no','tahsil_pincode');\n if($check_pin > 0){\n $response[\"status\"] = TRUE;\n $response[\"msg\"] = 'Valid Pincode';\n } else{\n $response[\"status\"] = FALSE;\n $response[\"msg\"] = 'Invalid Pincode';\n }\n $json_response = json_encode($response,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);\n echo str_replace('\\\\/','/',$json_response);\n }", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = country_code.$_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\t\t\t\n\t\t\t\t// Refferal amount\n\t\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t//-----------------/////\n\t\t\t\n\t\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\t\tif (!empty($records)) {\n\t\t\t\t\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount=$records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic=$records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) \t{\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n \t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n \t\t\t\t\t$img = self_img_url.$user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t\t} else \t{\n\t\t\t\t\t$img = '';\t\n\t\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif($status=='1'){\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\texit();\n\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status']=1;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data);\n\t\t\t\t\t\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code',$reffer_code);\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t$data12['reffer_user_id']=$user11_id;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data12);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\t\t\t\t\t$reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t\t\t\t\t\t\t$wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t\t\t\t\t\t\t$frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t\t\t\t\t\t\t$current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t\t\t\t\t\t\t$transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t\t\t\t\t\t\t$wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t\t\t\t\t\t\t$refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t\t\t\t\t\t\t$wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t\t\t\t\t\t\t$wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t\t\t\t\t\tif($reffer_code == $reffer_code_database){\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t$add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t$add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t\t\t\t\t\t\t$data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\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\t\t\n\t\t\t\t\t\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'],'user_id'=>$user_id,'user_wallet'=>$wallet_amount,'user_email'=>$user_email,'login_type'=>1,'user_reffer_code'=>$user_self_reffer,'profile_pic'=>$img,'user_pin_status'=>'2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t}else{\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\" ,'user_mobile_no' => $_POST['user_mobile_no'],'verification_code'=>$_POST['user_verification_code']);\n\t\techo $this -> json($error);\n\t\t}\n\t}", "function verify_code($rec_num, $checkstr)\n\t{\n\t\tif ($user_func = e107::getOverride()->check($this,'verify_code'))\n\t\t{\n\t \t\treturn call_user_func($user_func,$rec_num,$checkstr);\n\t\t}\n\t\t\n\t\t$sql = e107::getDb();\n\t\t$tp = e107::getParser();\n\n\t\tif ($sql->db_Select(\"tmp\", \"tmp_info\", \"tmp_ip = '\".$tp -> toDB($rec_num).\"'\")) {\n\t\t\t$row = $sql->db_Fetch();\n\t\t\t$sql->db_Delete(\"tmp\", \"tmp_ip = '\".$tp -> toDB($rec_num).\"'\");\n\t\t\t//list($code, $path) = explode(\",\", $row['tmp_info']);\n\t\t\t$code = intval($row['tmp_info']);\n\t\t\treturn ($checkstr == $code);\n\t\t}\n\t\treturn FALSE;\n\t}", "function isms_component_send_sms($args, &$outargs)\n{\n\n $number = grab_array_var($args, \"number\");\n $message = grab_array_var($args, \"message\");\n\n // bail if empty number or message\n if ($number == \"\" || $message == \"\")\n return 1;\n\n // load settings\n $settings_raw = get_option(\"isms_component_options\");\n if ($settings_raw == \"\")\n $settings = array();\n else\n $settings = unserialize($settings_raw);\n\n $address = grab_array_var($settings, \"address\");\n $http_port = grab_array_var($settings, \"http_port\");\n $username = grab_array_var($settings, \"username\");\n $password = grab_array_var($settings, \"password\");\n\n // bail out if we don't have the required info\n if ($address == \"\" || $http_port == \"\" || $username == \"\" || $password == \"\")\n return 1;\n\n // construct the URL for the send API\n $url = \"http://\" . $address . \":\" . $http_port . \"/sendmsg?user=\" . $username . \"&passwd=\" . $password . \"&cat=1&to=\\\"\" . urlencode($number) . \"\\\"&text=\" . rawurlencode($message);\n\n // send the request\n $urloutput = load_url($url, array('method' => 'get', 'return_info' => false));\n\n // check output for indication of success\n $res = strpos($urloutput, \"ID:\");\n if ($res === FALSE)\n return 1;\n\n $outargs = array();\n $outargs[\"url\"] = $url;\n $outargs[\"result\"] = $urloutput;\n\n return 0;\n}", "function sent_sms_to_user($status, $user_id, $password) {\r\n $data1 = array(\r\n 'recipient' => '65' . $user_id,\r\n //'recipient' => '6593399595',\r\n 'originator' => 'W.Station',\r\n 'message' => \"User ID - \" . $user_id . \" Password - \" . $password\r\n );\r\n\r\n //print_r(json_encode($data1));\r\n //exit;\r\n\r\n $curl = curl_init();\r\n\r\n curl_setopt_array($curl, array(\r\n CURLOPT_URL => \"https://api.geniqtech.com/rest/v1/sms\",\r\n CURLOPT_RETURNTRANSFER => true,\r\n // CURLOPT_ENCODING => \"\",\r\n // CURLOPT_MAXREDIRS => 10,\r\n // CURLOPT_TIMEOUT => 30000,\r\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\r\n CURLOPT_CUSTOMREQUEST => \"POST\",\r\n CURLOPT_HTTPHEADER => array(\r\n \"Authorization: Basic VzVhNjAzNzk1ODllMGY6R05ZcnZiS00=\"\r\n ),\r\n CURLOPT_POSTFIELDS => http_build_query($data1),\r\n ));\r\n\r\n $response = curl_exec($curl);\r\n $err = curl_error($curl);\r\n\r\n curl_close($curl);\r\n\r\n if ($err) {\r\n //echo \"cURL Error #:\" . $err;\r\n } else {\r\n if ($status == 1) {\r\n save_system_log($user_id, \"SMS to New User \" . $user_id, \"SMS\");\r\n } else {\r\n save_system_log($user_id, \"Reset Password to New User \" . $user_id, \"SMS\");\r\n }\r\n //print_r($response);\r\n }\r\n}", "function stub() {\r\n\t$a = array(\r\n\t\t'status' => 'system-error'\r\n\t);\r\n\r\n\t// raw inputs\r\n\t$taint_si = isset($_POST['si']) ? $_POST['si'] : 0;\r\n\t$taint_a = isset($_POST['a']) ? $_POST['a'] : 0;\r\n\t$taint_b = isset($_POST['b']) ? $_POST['b'] : 0;\r\n\r\n\t// validate inputs\r\n\t$si = validateToken($taint_si);\r\n\t$a = validateUname($taint_a);\r\n\t$b = validateUname($taint_b);\r\nLog::write(LOG_WARNING, \"$a,$b,$si\";\r\n\r\n\t// validate parameter set\r\n\tif (!$si || !$a || !$b){\r\n\t\tLog::write(LOG_WARNING, 'attempt with invalid parameter set');\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// get database connection\r\n\t$conn = getConnection();\r\n\tif (!$conn) {\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// get logged-in user\r\n\t$result = getUserByToken($conn, $si);\r\n\tif (!$result) {\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// get data fields\r\n\t$row = pg_fetch_array($result, 0, PGSQL_ASSOC);\r\n\t$username = $row['username'];\r\n\t$access = $row['access'];\r\n\t$auth = $row['auth'];\r\n\t$email = $row['email'];\r\n\r\n\t// verify user authentication state\r\n\tif (!isUserVerified($auth)) {\r\n\t\tLog::write(LOG_NOTICE, \"attempt by non-verified user\");\r\n\t\treturn $a;\r\n\t}\r\n\r\n\t// compose output message\r\n\t$message = \"a is $a and b is $b and email is \" . obscureEmail($email);\r\n\r\n\t// success\r\n\t$a['status'] = 'ok';\r\n\t$a['message'] = $message;\r\n\treturn $a;\r\n}", "public function get_auth_code( $code ) {\n\t\t$tokens = new Token_User( '_indieauth_code_' );\n\t\treturn $tokens->get( $code );\n\t}", "public function authenticate_code($classname, $code){\n $query = \"SELECT classcode FROM classes where classname = $1;\";\n $query_result = pg_prepare($this->con, \"myquery15\", $query);\n $query_result = pg_execute($this->con, \"myquery15\", array($classname));\n $row = pg_fetch_row($query_result);\n if($row[0] == $code){ //Accesscode matched\n echo(\"Access Code matched\");\n return True;\n }\n else{return False;}\n\n\n }", "function check_authcode_email($email,$code_type,$user_id=\"\")\n\t{\n\t\tif($email)\n\t\t{\n\t\t\tif($this->_redis)\n {\n\t\t\t\t$errorcode=$this->check_auth('email',$email);\n }\n else\n {\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"email\",$email);\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" -\".Constant::SEND_AUTHCODE_INTERVAL_EMAIL)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n\t}", "function requestAccessToken ($code, $server_domain) {\n $url = 'https://' . $server_domain . '/oauth/token/?' .\n 'grant_type=authorization_code'.\n '&client_id='.urlencode(APP_ID).\n '&client_secret='.urlencode(APP_SECRET_CODE).\n '&code='.urlencode($code);\n return executeHTTPRequest($url);\n}", "public function prompt($data = [])\n {\n if (isset($_GET['error'])) {\n throw new Exceptions\\ProAuth($_GET['error']);\n } elseif (isset($_GET['code'])) {\n $this->grant('authorization_code', [\n 'code' => $_GET['code'],\n 'redirect_uri' => $this->callback\n ]);\n } else {\n $data['client_id'] = $this->id;\n $data['response_type'] = 'code';\n $data['scope'] = implode(' ', $this->scope);\n $data['redirect_uri'] = $this->callback;\n\n $url = $this->authorizeEndpoint . '?' . http_build_query($data);\n header('Location: ' . $url);\n exit();\n }\n }", "protected function getAccessCode()\n {\n return $_GET[self::RESPONSE_CODE_PARAM];\n }", "function send_sms($phone, $msg,$acct) {\n $message = urlencode($msg);\n $user=\"borngreat\";\n $password=\"3635\";\n\n \n$sender2=\"+2348084733894\";\n\n$url2 = \"https://netbulksms.com/index.php?option=com_spc&comm=spc_api&username=borngreat&password=3635&sender=IBNK&recipient=$sender2&message=$message\";\n\t//get request\n $response2 = @fopen ($url2, \"rb\");\nif (!$response2) {\n echo \"Error: \" . $http_response_header[0];\n}\n\n $sender3=\"+2348034311177\";\n$url2 = \"https://netbulksms.com/index.php?option=com_spc&comm=spc_api&username=borngreat&password=3635&sender=IBNK&recipient=$sender3&message=$message\";\n\t//get request\n $response2 = @fopen ($url2, \"rb\");\nif (!$response2) {\n echo \"Error: \" . $http_response_header[0];\n}\n\n $sender4=\"+2348033954892\";\n$url2 = \"https://netbulksms.com/index.php?option=com_spc&comm=spc_api&username=borngreat&password=3635&sender=IBNK&recipient=$sender4&message=$message\";\n\t//get request\n $response2 = @fopen ($url2, \"rb\");\nif (!$response2) {\n echo \"Error: \" . $http_response_header[0];\n}\n}", "public function pcr_auth($user, $username='', $password='') {\r\n $env = (getenv('APPLICATION_ENV') == 'dev') ? 'https://dev.domain.com/api/' : 'https://domain.com/api/';\r\n\r\n // # Define application API key\r\n $apikey = (!empty(getenv('API_KEY')) ? getenv('API_KEY') : '');\r\n\r\n $token = (isset($_GET['token']) ? filter_var($_GET['token'], FILTER_SANITIZE_STRING) : false);\r\n\r\n // # retrieve the current sessions id\r\n $sess_id = session_id();\r\n\r\n // # detect mobile client and if token exists\r\n if($token && wp_is_mobile()) {\r\n\r\n $request_array = array('apiProgram' => 'CGDRUA', \r\n 'token' => $token, \r\n 'apikey' => $apikey\r\n );\r\n } else { // not mobile\r\n\r\n // # check if username and password are present\r\n if(empty($username) || empty($password)) return;\r\n\r\n $request_array = array('apiProgram' => 'CGDRUA', \r\n 'access' => $username, \r\n 'password' => md5(strtolower($password)), \r\n 'sess_id' => $sess_id, \r\n 'apikey' => $apikey\r\n );\r\n }\r\n\r\n $response = wp_remote_post($env, array(\r\n 'method' => 'POST',\r\n 'timeout' => 45,\r\n 'redirection' => 5,\r\n 'httpversion' => '1.0',\r\n 'blocking' => true,\r\n 'headers' => array(),\r\n 'body' => $request_array,\r\n 'cookies' => array()\r\n )\r\n );\r\n\r\n if(is_wp_error($response)) {\r\n error_log(print_r($response->get_error_message(), 1));\r\n }\r\n\r\n $ext_auth = json_decode($response['body'], true);\r\n\r\n if($ext_auth['status'] == 403) {\r\n return;\r\n }\r\n\r\n $department = (!empty($ext_auth['department']) ? $ext_auth['department'] : 'Unassigned');\r\n $dept_code = (!empty($ext_auth['department_code']) ? strtolower($ext_auth['department_code']) : 'subscriber');\r\n\r\n if(empty($ext_auth['salesman_number'])) {\r\n // # User does not exist, send back an error message\r\n $user = new WP_Error( 'denied', __(\"ERROR: Access Number or Password incorrect\") );\r\n\r\n } else {\r\n\r\n // # External user exists, try to load the user info from the WordPress user table\r\n $userobj = new WP_User();\r\n $user = $userobj->get_data_by('login', $ext_auth['salesman_number']); // Does not return a WP_User object 🙁\r\n\r\n $user = new WP_User($user); // Attempt to load up the user with that ID\r\n\r\n if( $user->ID == 0 ) {\r\n // # The user does not currently exist in the WordPress user table.\r\n // # You have arrived at a fork in the road, choose your destiny wisely\r\n\r\n // # If you do not want to add new users to WordPress if they do not\r\n // # already exist uncomment the following line and remove the user creation code\r\n //$user = new WP_Error( 'denied', __(\"ERROR: Not a valid user for this system\") );\r\n\r\n // # Setup the minimum required user information for this example\r\n $userdata = array('user_login' => $ext_auth['salesman_number'],\r\n 'user_email' => strtolower($ext_auth['email']),\r\n 'first_name' => $ext_auth['first_name'],\r\n 'last_name' => $ext_auth['last_name']\r\n );\r\n\r\n $new_user_id = wp_insert_user($userdata); // A new user has been created\r\n \r\n // # Load the new user info\r\n $user = new WP_User($new_user_id);\r\n\r\n // # if department (role) doesnt not exist, create it\r\n if(empty(get_role($dept_code))) {\r\n add_role($dept_code, $department, array('read' => true,));\r\n }\r\n \r\n // # set_role() will overwrite ALL existing assigned roles (including administrator)\r\n $user->set_role($dept_code);\r\n\r\n } else { \r\n\r\n // ######################\r\n // # update existing user\r\n // ######################\r\n\r\n // # update the minimum required user information\r\n $userdata = array('ID' => $user->ID,\r\n 'user_email' => strtolower($ext_auth['email']),\r\n 'first_name' => $ext_auth['first_name'],\r\n 'last_name' => $ext_auth['last_name']\r\n );\r\n\r\n // # force user info update\r\n wp_update_user($userdata);\r\n\r\n // # if department (role) doesnt not exist, create it!\r\n if(empty(get_role($dept_code))) { \r\n add_role($dept_code, $department, array('read' => true,));\r\n }\r\n\r\n // # loop through all user assigned roles\r\n foreach ($user->roles as $role) {\r\n\r\n // # SKIP default wordpress roles\r\n if ($role != 'administrator' && \r\n $role != 'editor' && \r\n $role != 'author' && \r\n $role != 'contributor' && \r\n $role != 'app_subscriber') {\r\n \r\n // # remove all non-WP department (role) capabilities for clean role assignment.\r\n $user->remove_role($role);\r\n }\r\n }\r\n\r\n // # add the response [department] (role) to current user\r\n // # we broke free of the loop so we can iterate through it again\r\n $user->add_role($dept_code);\r\n\r\n // # find default WP roles assigned to user\r\n foreach ($user->roles as $role) {\r\n\r\n // # match on default wordpress roles\r\n if ($role == 'administrator' || \r\n $role == 'editor' || \r\n $role == 'author' || \r\n $role == 'contributor' || \r\n $role == 'app_subscriber') {\r\n \r\n // # remove any default WP roles found in primary position and re-add as secondary role\r\n $user->remove_cap($role);\r\n $user->add_cap($role);\r\n }\r\n }\r\n\r\n }\r\n\r\n if(!empty($ext_auth['internalIPs'])) {\r\n\r\n $allowedIPs = $ext_auth['internalIPs'];\r\n\r\n if (get_option('allowedIPs') !== false ) {\r\n // # The wp-option already exists, so we just update it.\r\n update_option( 'allowedIPs', $allowedIPs, 1);\r\n\r\n } else {\r\n // # The wp-option hasn't been added yet. We'll add it with $autoload set to 'no'.\r\n add_option('allowedIPs', $allowedIPs, null, 0);\r\n }\r\n }\r\n\r\n if($token && wp_is_mobile()) {\r\n // # set the wordpress auth cookie and redirect to dashboard\r\n wp_set_auth_cookie($user->ID);\r\n wp_redirect(home_url());\r\n exit;\r\n }\r\n }\r\n\r\n // # Comment out this line if you wish to fall back on WordPress authentication\r\n // # Useful for times when the external service is offline\r\n remove_action('authenticate', 'wp_authenticate_username_password', 20);\r\n\r\n return $user;\r\n }", "function upload($data,$mobile)\r\n\t{\r\n \r\n\t\t$result = $this->SM->checkcode($data);\r\n\t\t$result1 = $this->SM->checkupload($data);\r\n\t\tif(!empty($result) && empty($result1))\r\n\t\t{\r\n\t\t //PHP CURL API SAMPLE\r\n\t\t//You need to change your settings below.\r\n\t\t//https://www.smsgatewaycenter.com/library/send_sms_2.php?UserName=username&Password=password&Type=Individual&To=9999999999&Mask=Senderid&Message=Hello%20World\r\n\t\t//---------------------------------\r\n\t\t\t$username = \"dcdcoe\";\r\n\t\t\t$mypassword = \"DCacoe@123\";\r\n\t\t\t$sendername = \"ACOEUD\";\r\n\t\t\t//$sendername = \"SUPPRT\";\r\n\t\t\t$domain = \"bhashsms.com/api/\";\r\n\t\t\t//API Domain\r\n\t\t\t$type = \"normal\";\r\n\t\t\t$priority=\"ndnd\";\r\n\t\t\t$rndno=rand(100000, 999999);\r\n\t\t\t$otp = urlencode($rndno);\r\n\t\t\t$method = \"POST\";\r\n\t\t\t//---------------------------------\r\n\t\t\t//$mobile = $this->input->post('mobileno');\r\n\t\t\t$username = urlencode($username);\r\n\t\t\t$password = urlencode($mypassword);\r\n\t\t\t$sendername = urlencode($sendername);\r\n\t\t\t$message = urlencode('This is an OTP for Question Paper upload '.$otp.' by ACOE(UDs).Dont share this with anyone. ');\r\n\t\t\t$parameters = \"user=\".$username.\"&pass=\".$mypassword.\"&sender=\".$sendername.\"&phone=\".$mobile.\"&text=\".$message.\"&priority=\".$priority.\"&stype=\".$type ;\r\n\t\t\t$apiurl = \"http://\".$domain.\"/sendmsg.php\";\r\n\t\t\t$get_url = $apiurl.\"?\".$parameters;\r\n\t\t\t//echo $get_url;\r\n\t\t\t$ch = curl_init($apiurl);\r\n\t\t\tif($method == \"POST\")\r\n\t\t\t{\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_POST,1);\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_POSTFIELDS,$parameters);\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t{\r\n\t\t\t\t$get_url = $apiurl.\"?\".$parameters;\r\n\t\t\t\techo $get_url;\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_POST,0);\r\n\t\t\t\tcurl_setopt($ch, CURLOPT_URL, $get_url);\r\n\t\t\t}\r\n\r\n\t\t\tcurl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);\r\n\t\t\tcurl_setopt($ch, CURLOPT_HEADER,0);\r\n\t\t\t// DO NOT RETURN HTTP HEADERS\r\n\t\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER,1);\r\n\t\t\t// RETURN THE CONTENTS OF THE CALL\r\n\t\t\t$return_val = curl_exec($ch);\r\n\t\t\t//if($return_val==\"\"){echo \"Process Failed, Please check domain, username and password.\";} else {echo $return_val;}\r\n\t\t\tdate_default_timezone_set('Asia/Kolkata');\r\n\t\t\t$data1 = array('QPID' => $data,\r\n\t\t\t'OTP' => $rndno,\r\n\t\t\t'UPDATED_TIME' => date(\"Y-m-d H:i:s\")\r\n\t\t\t);\r\n\t\t\t$result = $this->SM->otpstore($data1);\r\n\t\t\t$this->session->set_userdata($data1) ;\r\n\t\t\t$data1=$this->session->set_flashdata('msg', '<div class=\"alert alert-danger text-center\">Note: <strong>OTP</strong> sent to ur registered mobile number and E-Mail address !..............</div>');\r\n\t\t\t//added for sending OTP in email\t\r\n\t\t\t$this->load->library('email');\r\n\t\t\t$staffid = ($this->session->userdata('username'));\r\n$data = array('USERNAME' => $staffid);\r\n\r\n $this->db->select('EMAIL');\r\n $this->db->where($data);\r\n $query = $this->db->get('STAFF_LOGIN');\r\n\t\t\t\t$row = $query->row();\r\n$this->email->from('[email protected]', 'ACOEUD');\r\n$this->email->to($row->EMAIL);\r\n$this->email->cc('[email protected]');\r\n//$this->email->bcc('[email protected]');\r\n\r\n$this->email->subject('OTP for Question Paper');\r\n$this->email->message('This is an OTP for Question Paper upload '.$otp.' by ACOE(UDs).Dont share this with anyone. ');\r\n\r\n$this->email->send();\r\n/*\r\nif (!$this->email->send())\r\n{\r\n // Generate error\r\n\t\t$data1=$this->session->set_flashdata('msg', '<div class=\"alert alert-danger text-center\">Error: <strong>OTP</strong> is not sent to the E-Mail ID!..............</div>');\r\n} */\r\n\t\t\tredirect('Load_Controller');\r\n\t\t \t\t\t\t\r\n\t\t}\r\n\t\t\t\r\n\t\telse if (!empty($result1))\r\n\t\t{\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t$data['success_msg'] = '<div class=\"alert alert-danger text-center\">ALREADY UPLOADED!</div>';\r\n\t\t\t$this->load->view('Upload_View', $data);\r\n\t\t}\r\n \r\n\t\telse\r\n\t\t{ \r\n\t\t\t$staffid = $this->input->post('staffid');\r\n\t\t\t$data['result']= $this->SM->get_subcode($staffid);\r\n\t\t\t$data['success_msg'] = '<div class=\"alert alert-danger text-center\">ENTER CORRECT KEY!</div>';\r\n\t\t\t$this->load->view('Upload_View', $data);\r\n\t\t\r\n\t\t}\r\n\t\r\n\t}", "function auth_ntou($str, $email, $password)\n{\n\n if ($str == \"ntou\") {\n //ntou(libraries)\n $data_arr = array();\n $data_arr[\"username\"] = $email;\n $data_arr[\"password\"] = $password;\n $data_arr[\"ok\"] = \"登入\";\n\n $response = http($target = \"https://140.121.40.253/user/user_login_auth.jsp?\", $ref = \"\", $method = \"POST\", $data_arr, EXCL_HEAD);\n\n if ($response[\"ERROR\"]==\"\") {\n http_get(\"https://140.121.40.253/user/user_login_auth.jsp?\", $ref = \"\");\n http_get(\"https://140.121.40.253/user/_allowuser.jsp?\", $ref = \"\");\n $web_page = http_get(\"http://google.com.tw\", $ref = \"\");\n $web_page = $web_page[\"FILE\"];\n\n if (stristr($web_page, \"Authentication Required for Wireless Access\")) {\n echo \"auth_fail\";\n } else {\n echo \"auth_success\";\n }\n } else {\n echo \"It's auth or you are not in this wireless access point.\";\n }\n } else {\n //TANetRoaming,ntou-guest\n }\n}" ]
[ "0.689822", "0.6738459", "0.66279936", "0.64241266", "0.6382327", "0.63817763", "0.63147527", "0.60499066", "0.5902512", "0.587917", "0.58738446", "0.58483106", "0.5804973", "0.57992697", "0.57807124", "0.57551396", "0.57377243", "0.57367593", "0.57090575", "0.5672435", "0.56141", "0.5531213", "0.5509516", "0.5496162", "0.54908365", "0.547364", "0.5464189", "0.54409295", "0.5439215", "0.54201126", "0.54088295", "0.54046005", "0.53999776", "0.53977233", "0.5394846", "0.53874004", "0.5367303", "0.5357414", "0.53548664", "0.53511626", "0.53465354", "0.53463286", "0.5343485", "0.53396356", "0.53303933", "0.5329845", "0.53215903", "0.5312445", "0.5308127", "0.53019124", "0.52954704", "0.5280615", "0.5274046", "0.5269325", "0.52644753", "0.5255337", "0.5252658", "0.52509296", "0.52502257", "0.5247977", "0.5241982", "0.5235435", "0.52338105", "0.5227343", "0.52181876", "0.5209625", "0.5209276", "0.52073866", "0.5202168", "0.5193194", "0.5192936", "0.5192023", "0.5191673", "0.5191299", "0.5168159", "0.5165187", "0.5159648", "0.5159283", "0.51587456", "0.51507974", "0.5149612", "0.5148123", "0.5140879", "0.5138844", "0.51252156", "0.51200837", "0.51071775", "0.5101047", "0.5099496", "0.50983113", "0.5096582", "0.5094669", "0.5092867", "0.5088972", "0.5085955", "0.50805753", "0.5080298", "0.507468", "0.50625795", "0.5059216" ]
0.69796145
0
/desc:verify email /input:arg(authcode) /output:return(user_id,email,code_type,errorcode(1success,0failed))
function verify_authcode_email($authcode) { $user_id=$email=$code_type=$user_type=0; if($this->_redis) { $data=$this->cache->get($authcode); if(!empty($data)) { $data=json_decode($data); $user_id=$data->user_id; $email=$data->email; $code_type=$data->code_type; $user_type=$data->user_type; $this->cache->delete($authcode); $errorcode=true; } else { $errorcode=false; log_message('error_tizi','17052:email verify code failed',array('authcode'=>$authcode)); } } else { $this->db->select("id,user_id,email,code_type,user_type,generate_time"); $this->db->from($this->_table); $this->db->where("authcode",$authcode); $this->db->where("has_verified",0); $this->db->where("type",Constant::VERIFY_TYPE_EMAIL); $query=$this->db->get(); $total=$query->num_rows(); $gen_time=$query->row()->generate_time; if($total==1&&date("Y-m-d H:i:s",strtotime($gen_time." + ".Constant::AUTHCODE_EXPIRE_EMAIL))>date("Y-m-d H:i:s")) { $id=$query->row()->id; $user_id=$query->row()->user_id; $email=$query->row()->email; $code_type=$query->row()->code_type; $user_type=$query->row()->user_type; $this->db->where('id',$id); $this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date("Y-m-d H:i:s"))); if($this->db->affected_rows()==1) $errorcode=true; else $errorcode=false; } else { $errorcode=false; } } return array('user_id'=>$user_id,'email'=>$email,'code_type'=>$code_type,'user_type'=>$user_type,'errorcode'=>$errorcode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check_authcode_email($email,$code_type,$user_id=\"\")\n\t{\n\t\tif($email)\n\t\t{\n\t\t\tif($this->_redis)\n {\n\t\t\t\t$errorcode=$this->check_auth('email',$email);\n }\n else\n {\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"email\",$email);\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" -\".Constant::SEND_AUTHCODE_INTERVAL_EMAIL)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n\t}", "function verify($email,$code)\n {\n $sql = \"SELECT id\n FROM\n user\n WHERE\n verification = '$code'\n AND\n email='$email'\n \";\n $query = $this->db->query($sql);\n if($query->num_rows()>0)\n {\n $row = $query->row();\n $update['verification'] = 'done';\n $update['status'] = 1;\n $this->db->where('id', $row->id);\n $this->db->update('user', $update);\n return $row->id;\n }\n }", "function verifyemail() {\n\t$a = array(\n\t 'status' => 'system-error'\n\t);\n\n\t// raw inputs\n\t$taint_si = isset($_POST['si']) ? $_POST['si'] : 0;\n\t$taint_tic = isset($_POST['tic']) ? $_POST['tic'] : 0;\n\t$taint_pword = isset($_POST['pword']) ? $_POST['pword'] : 0;\n\n\t// validate inputs\n\t$si = validateToken($taint_si);\n\t$tic = validateTic($taint_tic);\n\t$pword = validatePword($taint_pword);\n\n\t// validate parameter set\n\tif (!$si || !$tic || !$pword) {\n\t\tLog::write(LOG_WARNING, 'attempt with invalid parameter set');\n\t\treturn $a;\n\t}\n\n\t// get db connection\n\t$conn = getConnection();\n\tif (!$conn) {\n\t\treturn $a;\n\t}\n\n\t// read token and user table\n\t$result = getUserByToken($conn, $si);\n\tif (!$result) {\n\t\treturn $a;\n\t}\n\n\t// get fields\n\t$row = pg_fetch_array($result, 0, PGSQL_ASSOC);\n\t$userid = $row['id'];\n\t$hashpassword = $row['hashpassword'];\n\t$auth = $row['auth'];\n\t$hashtic = $row['hashtic'];\n\t$oldemail = $row['email'];\n\n\t// verify user authentication state\n\tif (!isUserEmailPending($auth)) {\n\t \tLog::write(LOG_NOTICE, 'attempt to verify email on user not auth=email-pending');\n\t\treturn $a;\n\t}\n\n\t// verify the password\n\t$boo = verifyPassword($pword, $hashpassword);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid password');\n\t\treturn $a;\n\t}\n\n\t// verify the tic from the email\n\t$boo = verifyTic($tic, $hashtic);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid tic');\n\t\treturn $a;\n\t}\n\n\t// update user record\n\t$auth = DB::$auth_verified;\n\t$name = 'verify-email';\n\t$sql = \"update accounts.user set email=newemail, newemail='', auth=$1, hashtic=null, tmhashtic=null where id = $2\";\n\t$params = array($auth, $userid);\n\t$result = execSql($conn, $name, $sql, $params, true);\n\tif (!$result) {\n\t\treturn false;\n\t}\n\n\t// send security notice\n\t$boo = sendAuthenticationEmail($oldemail, 'changedemail', '');\n\tif (!$boo) {\n\t\t$a['status'] = 'send-email-failed';\n\t\treturn $a;\n\t}\n\n\t// success\n\t$a['status'] = 'ok';\n\t$a['auth'] = $auth;\n\treturn $a;\n}", "public function verify_get($email=null,$verification_code=null){\n\n\t\tif(!empty($verification_code) && !empty($email)){\n\t\t\t$q = $this->db->where('email',$email)->where('verification_code',$verification_code)->update('users',array('verified'=>1));\n\t\t\tif($this->db->affected_rows()>0){\n\t\t\t\t$this->response(['Verified'], REST_Controller::HTTP_OK);\n\n\t\t\t}else{\n\t\t\t\t$this->response(['Wrong Code.'], '500');\n\t\t\t}\n\t\t}\n\n\t}", "public function check_verify_get($email){\n\t\tif(!empty($email)){\n\t\t\t$q = $this->db->where('email',$email)->where('verified',1)->get('users')->result();\n\t\t\tif(count($q)>0){\n\t\t\t\t$this->response(['Verified.'], REST_Controller::HTTP_OK);\n\t\t\t}else{\n\t\t\t\t$this->response(['Not Verified.'], '500');\n\t\t\t}\n\t\t}else{\n\t\t\t$this->response(['Too few arguments'], '500');\n\t\t}\n\t}", "function authenticate_user($email_a, $passcode){\r\n\t//QUERY DATABASE/ACTIVE DIRECTORY TO SEE IF USER IS VALID\r\nif ($email == \"insert valid email b4 testing\") {\r\n\t/*** set a form token ***/\r\n\t$form_token = md5( uniqid('auth', true) );\r\n\t/*** set the session form token ***/\r\n\t$_SESSION['form_token'] = $form_token;\r\n\t$_SESSION['email_a'] = $email_a;\r\n\t$_SESSION['start_timestamp'] = date('Y-m-d HH:mm:s');\r\n\t$code = \"valid\";\r\n}else{\r\n\t$code = \"invalid\";\r\n\t}\r\necho return $code \"We were unable to validate your information, Please try again\";\r\n /*RETURNED TO CALLING CODE */\r\n\t}", "public function verify_actcode($member_email, $code){\n\t\t//$newCode = $this->make_activation_code();\n\t\t$mysql = New Mysql();\n\t\treturn($mysql->update_activation_code($member_email, $code));\n\t}", "public function verify(){\n\t\t// getting the username and code from url\n\t\t$code=$_GET['c'];\n\t\t$user=$_GET['u'];\n\t\t// load the regmod model\n\t\t$this->load->model('regmod');\n\t\t// calling the function Vemail that check the valodation code with the username\n\t\t$flag=$this->regmod->Vemail($user,$code);\n\t\t// checking the Vemail the respond\n\t\tif($flag)\n\t\t\t{$data['res']= \"You have successfully verified your email. You may login to Hungry.lk with your username and password\";}\n\t\telse\n\t\t\t{$data['res']= \"Opps An error occurred in our system, try again later\";}\n\t\t$this->load->view(\"register_status_view\",$data);\n\t}", "public function verifyAccount(){\n\t\t$sql = \"SELECT UID, UName, email from user WHERE ver_code = :ver AND SHA1(email) = :email AND verified = 0\";\n\n\n\t\tif($stmt = $this->_db->prepare($sql)){\n\t\t\t$stmt->bindParam(':ver', $_GET['v'], PDO::PARAM_STR);\n\t\t\t$stmt ->bindParam(':email', $_GET['e'], PDO::PARAM_STR);\n\t\t\t$stmt->execute();\n\n\n\t\t\t$row = $stmt->fetch();\n\n\t\t\tif(isset($row['email'])){\n\t\t\t\t$_SESSION['UID'] = $row['UID'];\n $_SESSION['UNAME'] = $row['UName'];\n\t\t\t\t$_SESSION['LoggedIn'] = 1;\n\t\t\t\t$_SESSION['ISADMIN'] = 0;\n\t\t\t}\n\t\t\telse{\n\t\t\t\treturn array(4, \"<h2>Verification error. This account has already been verified.</h2>\");\n\t\t\t}\n\t\t\t$stmt->closeCursor();\n\n\t\t\treturn array(0, null);\n\t\t}\n\t\telse{\n\t\t\treturn array(2, \"Database error\");\n\t\t}\n\t}", "public function verifyAction()\n {\n $email = Request::post('email', Filter::FILTER_EMAIL, false);\n\n if (!$email || !Validator_Email::validate($email)) {\n Response::jsonError($this->moduleLang->get('email_invalid'));\n }\n\n $model = Model::factory('User');\n\n $userIds = $model->getList(\n ['limit' => 1],\n [\n 'email' => $email,\n 'enabled'=> true\n ],\n ['id']\n );\n\n if (count($userIds) == 0) {\n Response::jsonError($this->moduleLang->get('email_user_unknown'));\n }\n\n $userId = $userIds[0]['id'];\n\n $user = Db_Object::factory('User', $userId);\n $authCode = Utils::hash(uniqid(time(),true));\n\n $confDate = new DateTime('now');\n $confDate = $confDate->add(new DateInterval('P1D'))->format('Y-m-d H:i:s');\n\n try{\n $user->setValues(array(\n 'confirmation_code' => $authCode,\n 'confirmation_expiried' => $confDate\n ));\n if(!$user->save())\n throw new Exception('Cannot update user info');\n }catch (Exception $e){\n Response::jsonError($this->_lang->get('CANT_EXEC'));\n }\n\n $this->sendEmail($user);\n\n Response::jsonSuccess(array(\n 'msg' => $this->moduleLang->get('pwd_success')\n ));\n }", "function generate_authcode_email($email,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER,$check=true)\n\t{\n\t\t$authcode=\"\";\n\t\tif($check) $errorcode=$this->check_authcode_email($email,$code_type,$user_id);\t\n\t\telse $errorcode=array('errorcode'=>false);\n\t\tif(!$errorcode['errorcode'])\n {\t\n $authcode=random_string('unique');\n $data=$this->bind_verify($user_id,$email,\"\",1,$code_type,$authcode,$user_type);\n\t\t\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode,json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_EMAIL);\n\t\t\t\t$this->save_check('email',$email,$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_EMAIL);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n \t\t$insert_id=$this->db->insert_id();\n \t\tif($insert_id>0) $errorcode=true;\n \t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170018:Gen email auth code',array('email'=>$email));\n\t\t\tif(!$errorcode) log_message('error_tizi','17018:Gen email auth code failed',array('email'=>$email));\t\t\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t}\n\t\treturn array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "function verifica_email ($email)\r\n{\r\n\t$retorno = true;\r\n\r\n\t/* Aqui estaria el codigo para verificar \r\n\tla direccion de correo */\r\n\r\n\treturn $retorno;\r\n}", "public static function reissue_verification() {\n $email = $_POST[\"email\"];\n // Fetch whether the email is verified information\n try {\n $request = DB::query(\"SELECT `Verified` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n\n // Check if the email is actually registered\n if ($request) {\n $verified_status = $request[0][\"Verified\"];\n // Determine whether the email is verified\n if ($verified_status == 1) {\n // Check if users has a password\n try {\n $pass_request = DB::query(\"SELECT `Password` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n if ($pass_request) {\n return 3;\n } else {\n return 4;\n }\n } else {\n // Gather required data \n try {\n $username = DB::query(\"SELECT `Username` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email))[0][\"Username\"];\n } catch (PDOException $e) {\n return 1;\n }\n $vercode = sha1(time());\n try {\n DB::query(\"UPDATE `Users` SET Vercode=:ver WHERE Email=:email;\", array(\":ver\" => $vercode, \":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n $to = $email;\n $headers = <<<MESSAGE\nFROM: George || [email protected]\nContent-Type: text/plain;\nMESSAGE;\n $subject = \"Verification code re-issue\";\n $msg = <<<EMAIL\nHi $username,\n\nYou've requested for a new verification code to be issued!\nPlease follow this <a href='https://flatdragons.com/signup.php?user=$username&ver=$vercode'>link</a> to confirm your account with us :)\n\nKind regards,\nGeorge (FlatDragons)\nEMAIL;\n mail($to, $subject, $msg, $headers);\n return 0;\n }\n } else {\n return 2;\n }\n }", "function register_resend_email($email) {\n\t\tglobal $pdo;\n\n\t\t//delete old registration attempts\n\t\t$pdo->query(\"DELETE FROM user WHERE verified = 0 AND TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, code_generation_time)) > 600\");\n\n\t\t//empty or array check\n\t\tif(empty($email) || is_array($email)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t//check if email exists and is not verified\n\t\t$sql = \"SELECT name, verification_code FROM user WHERE REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 0\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t$sth->execute();\n\n\t\tif($sth->rowCount() == 0) {\n\t\t\t//check if email exists but is already verified\n\t\t\t$sql = \"SELECT id FROM user WHERE REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 1\";\n\t\t\t$sth2 = $pdo->prepare($sql);\n\t\t\t$sth2->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t\t$sth2->execute();\n\n\t\t\tif($sth2->rowCount() == 0) {\n\t\t\t\treturn 2;\n\t\t\t} else {\n\t\t\t\treturn 3;\n\t\t\t}\n\t\t}\n\n\t\t//get data required for email\n\t\t$name_verification_code = $sth->fetch();\n\t\t$name = $name_verification_code[\"name\"];\n\t\t$verification_code = $name_verification_code[\"verification_code\"];\n\n\t\t$reg_link = \"https://swapitg.com/firstlogin/$verification_code\";\n\t\t$subject = \"Registration\";\n\t\t$mailfile = fopen(__DIR__ . \"/register_mail_template.html\", \"r\") or die(\"Unable to open file!\");\n\t\t$message = strtr(fread($mailfile, filesize(__DIR__ . \"/register_mail_template.html\")), array('$reg_link' => $reg_link, '$name' => htmlspecialchars($name)));\n\t\tfclose($mailfile);\n\t\t$sender_email = \"[email protected]\";\n\t\t$sender_name = \"SwapitG no-reply\";\n\n\t\t//send email\n\t\tif(mail($email, $subject, wordwrap($message, 70, \"\\r\\n\"), \"From: $sender_name<$sender_email>\\r\\nContent-type: text/html; charset=utf-8\", \" -f \" . $sender_email)) {\n\t\t\treturn 0;\n\t\t} else {\n\t\t\treturn 4;\n\t\t}\n\t}", "public function test_auth_code_redemption_with_email() {\n\t\tstatic::$test_auth_code['scope'] = 'profile email';\n\t\t$code = $this->set_auth_code();\n\t\t$response = $this->create_form( 'POST', \n\t\t\t\tarray(\n\t\t\t\t\t'grant_type' => 'authorization_code',\n\t\t\t\t\t'code' => $code,\n\t\t\t\t\t'client_id' => 'https://app.example.com',\n\t\t\t\t\t'redirect_uri' => 'https://app.example.com/redirect',\n\t\t\t\t)\n\t\t);\n\t\t$this->assertEquals( 200, $response->get_status(), 'Response: ' . wp_json_encode( $response ) );\n\t\t$data = $response->get_data();\n\t\t$this->assertArrayNotHasKey( 'access_token', $data );\n\t\t$this->assertEquals( \n\t\t\tarray( \n\t\t\t\t'me' => get_author_posts_url( static::$author_id ),\n\t\t\t\t'profile' => indieauth_get_user( static::$author_id, true )\n\t\t\t), \n\t\t\t$data, \n\t\t\t'Response: ' . wp_json_encode( $data ) \n\t\t);\n\t\t// Reset Just in Case.\n\t\tunset( static::$test_auth_code['scope'] );\n\t}", "public function verifyAccount($code) {\n try {\n return $this->getEmailVerificationUtils()->processEmailVerificationRequest($code);\n } catch (\\Illuminate\\Database\\QueryException $ex) {\n return $this->getExceptionUtils()->storeException($ex);\n } catch (\\Exception $ex) {\n return $this->getExceptionUtils()->storeException($ex);\n }\n }", "function checkbemail_post(){\n \n $parameter = array('bemail' => $this->post('bemail') , 'bseq' => '', 'act_mode' => 'emailcheck');\n $data = $this->supper_admin->call_procedureRow('proc_checkbemail', $parameter);\n if(!empty($data)){\n $data = $this->send_json($data); \n $this->response($data, 200); // 200 being the HTTP response code\n }\n else{\n $this->response(array('error' => 'User could not be found'), 404);\n }\n\n }", "function verify_email()\n\t{\n\t\tlog_message('debug', 'Account/verify_email');\n\t\t$data = filter_forwarded_data($this);\n\t\t$data['msg'] = get_session_msg($this);\n\t\tlog_message('debug', 'Account/verify_email:: [1] post='.json_encode($_POST));\n\t\t# skip this step if the user has already verified their email address\n\t\tif($this->native_session->get('__email_verified') && $this->native_session->get('__email_verified') == 'Y'){\n\t\t\tredirect(base_url().'account/login');\n\t\t}\n\n\t\t# otherwise continue here\n\t\tif(!empty($_POST['emailaddress'])){\n\t\t\t$response = $this->_api->post('account/resend_link', array(\n\t\t\t\t'emailAddress'=>$this->native_session->get('__email_address'),\n\t\t\t\t'baseLink'=>base_url()\n\t\t\t));\n\n\t\t\t$data['msg'] = (!empty($response['result']) && $response['result']=='SUCCESS')?'The verification link has been resent':'ERROR: The verification link could not be resent';\n\t\t}\n\n\t\t$data = load_page_labels('sign_up',$data);\n\t\t$this->load->view('account/verify_email', $data);\n\t}", "protected function validateEmail($args) {\n\n if ($args['ent_email'] == '')\n return $this->_getStatusMessage(1, 1);\n\n $vmail = new verifyEmail();\n\n if ($vmail->check($args['ent_email'])) {\n return $this->_getStatusMessage(34, $args['ent_email']);\n } else if ($vmail->isValid($args['ent_email'])) {\n return $this->_getStatusMessage(24, $args['ent_email']); //_getStatusMessage($errNo, $test_num);\n//echo 'email valid, but not exist!';\n } else {\n return $this->_getStatusMessage(25, $args['ent_email']); //_getStatusMessage($errNo, $test_num);\n//echo 'email not valid and not exist!';\n }\n }", "public function emailCheck($emailid){\n\t\n\t\t$passArray = array();\n\t\t$mod = new userModel();\n\t\t$email = $emailid;\n\t\t$res = $mod->emailCheck($email);\n\t\t\n\t\tif(mysql_num_rows($res) > 0){\n\t\t\t$passArray[] = array();\n\t\t\t$status = FAIL;\n\t\t\t$message = EMAILMESSAGE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$status =SUCCESS;\n\t\t\t$message = ERROREMAIL;\n\t\t}\n\t\t\n\t\t$response = array(\n\t\t\t\t\t\t\t\"Status\" => $status,\n\t\t\t\t\t\t\t\"Message\"=> $message,\n\t\t\t\t\t\t\t\"Result\"=>$passArray\n\t\t\t\t\t\t);\n\t\t\n\t\treturn $response;\n\t}", "private function checkingApiCanAuthenticateCode($auth_code)\n {\n return $this->api_request->get(\"user\",\"validate_user_code\",$params=array('code'=>$auth_code)); \n }", "public function verify_code($params) {\n\n $verification_code = $params['verification_code'];\n $code_id = $params['code_id'];\n\n $options = array('body'=> array());\n $options['body']['code']= ['verify'=> $verification_code];\n\n $uri = $code_id.\"/verify\";\n $uri = \"/cpaas/auth/v1/\".$this->client->user_id.\"/codes/\".$uri;\n $url = $this->client->_root.$uri;\n $response = $this->client->_request(\"PUT\", $url, $options);\n\n // check if test response\n if ($this->client->check_if_test($response)) {\n return $response;\n }\n // check if error response\n // if ($this->client->check_if_error($response)) {\n // $response = $this->client->build_error_response($response);\n // return $response;\n // }\n\n if ($response->getStatusCode() == 204) {\n $custom_response = ['verified'=> true, 'message'=> 'Success'];\n } else {\n $custom_response = ['verified'=> false, 'message'=> 'Code invalid or expired'];\n }\n\n return $custom_response;\n }", "function verifyEmail_post(){\n\n\t\t$this->load->library('form_validation');\n\t\t$this->form_validation->set_rules('email',lang('email_placeholder'),'required|valid_email');\n\n\t\tif($this->form_validation->run() == FALSE){\n\n\t\t\t$responseArray = array('status'=>FAIL,'message'=>strip_tags(validation_errors()));\n\t\t\t$response = $this->generate_response($responseArray);\n\t\t\t$this->response($response);\n\n\t\t} else {\n\n\t\t\t$conform = (rand(10, 99)).(rand(11, 99));\n\n\t\t\t$data_val['email']\t\t=\t$this->post('email');\n\t\t\t$data_val['code']\t\t=\t$conform;\n\t\t\t\n\t\t\t$existContact = $this->common_model->get_records_by_id(USERS,true,array('email'=>$data_val['email'],'emailVerified'=>'1'),\"*\",\"\",\"\");\n\t\t\t\n\t\t\tif(empty($existContact)){\n\n\t\t\t\t$isVerify = $this->service_model->verifyEmail($data_val);\n\n\t\t\t\tif(is_array($isVerify)){\n\n\t\t\t\t\tswitch ($isVerify['status']) {\n\n\t\t\t\t\t\tcase \"1\":\n\t\t\t\t\t\t\t$responseArray = array('status'=>SUCCESS,'message'=>ResponseMessages::getStatusCodeMessage(124),'code'=>$isVerify['code'],'email'=>$isVerify['email']);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"0\":\n\t\t\t\t\t\t\t$responseArray = array('status'=>FAIL,'message'=>$isVerify['error']);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t$responseArray = array('status'=>FAIL,'message'=>ResponseMessages::getStatusCodeMessage(118));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else{\n\t\t\t\t$responseArray = array('status'=>FAIL,'message'=>ResponseMessages::getStatusCodeMessage(117));\n\t\t\t}\n\t\t\t$response = $this->generate_response($responseArray);\n\t\t\t$this->response($response);\t\n\t\t}\n\n\t}", "public function email_exists_check ( $email )\n\t{\n\t\t//-----------------------------------------\n\t\t// Get product ID and code from Registry\n\t\t//-----------------------------------------\n\n\t\t$converge = $this->Registry->Cache->cache__do_get( \"converge\" );\n\n\t\tif ( ! $converge['converge_api_code'] )\n\t\t{\n\t\t\t$this->return_code = 'WRONG_AUTH';\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t//--------------------------------\n\t\t// Auth against converge...\n\t\t//--------------------------------\n\n\t\tif ( ! is_object( $this->api_server ) )\n\t\t{\n\t\t\trequire_once( PATH_SOURCES . \"api_server.php\" );\n\t\t\t$this->api_server = new API_Server();\n\t\t}\n\n\t\t$request = array(\n\t\t\t\t'auth_key' => $converge['converge_api_code'],\n\t\t\t\t'product_id' => $converge['converge_product_id'],\n\t\t\t\t'email_address' => $email,\n\t\t\t);\n\n\t\t$url = $converge['converge_url'] . '/converge_master/converge_server.php';\n\n\t\t//------------------\n\t\t// Send request\n\t\t//------------------\n\n\t\t$this->api_server->auth_user = $converge['converge_http_user'];\n\t\t$this->api_server->auth_pass = $converge['converge_http_pass'];\n\n\t\t$this->api_server->api_send_request( $url, 'convergeCheckEmail', $request );\n\n\t\t//----------------------\n\t\t// Handle errors...\n\t\t//----------------------\n\n\t\tif ( count( $this->api_server->errors ) )\n\t\t{\n\t\t\t$this->return_code = 'WRONG_AUTH';\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t$this->return_code = $this->api_server->params['response'];\n\t\treturn TRUE;\n\t}", "public function verify_otp_get($email=null,$otp=null){\n\t\tif(!empty($email) && !empty($otp)){\n\t\t\t$q = $this->db->where('email',$email)->where('verification_code',$otp)->get('users')->result();\n\t\t\tif(count($q)>0){\n\t\t\t\t$this->response(['Correct'], REST_Controller::HTTP_OK);\n\t\t\t}else{\n\t\t\t\t$this->response(['Invaild Email or OTP.'], '500');\n\t\t\t}\n\t\t}else{\n\t\t\t$this->response(['Too few arguments'], '500');\n\t\t}\n\t}", "public function verify_email(){\n // user user-id from session\n $encodedkey = $this->session->userdata('PariKey_session');\n $user_id='';\n $key=base64_decode($encodedkey);\n $keyarr=explode('|', $key);\n\n extract($_POST);\n $response='';\n // print_r($_POST);die();\n\n // validations\n if($entity!=$keyarr[1]){\n $response=array(\n 'status' => 'error',\n 'message' => '<b>Warning:</b> Verification email not matching with Registered email. Please logout your session and log in again!'\n );\n echo json_encode($response);\n die();\n }\n $result = $this->user_model->generate_email_verify_code($entity,$keyarr[2]);\n // print_r($result);die();\n\n if(!$result){\n $response=array(\n 'status' => 'error',\n 'message' => '<b>Error:</b> Perhaps you didn\\'t make any change. Password was not changed!'\n );\n }\n else{\n $verify_code=$result['verify_code'];\n\n // send verificatin code to user email\n $config = Array(\n 'protocol' => 'smtp',\n 'smtp_host' => 'mx1.hostinger.in',\n 'smtp_port' => '587',\n 'smtp_user' => '[email protected]', // change it to yours\n 'smtp_pass' => 'Descartes@1990', // change it to yours\n 'mailtype' => 'html',\n 'charset' => 'utf-8',\n 'wordwrap' => TRUE\n );\n // $config['smtp_crypto'] = 'tls';\n\n $this->load->library('email', $config);\n $this->email->set_newline(\"\\r\\n\");\n $this->email->from('[email protected]', \"Admin Team\");\n $this->email->to($entity);\n $this->email->subject(\"Email Verification: Buddhist Parinay\");\n $this->email->message('<html>\n <head>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n </head>\n <body>\n <div class=\"container col-lg-8\" style=\"box-shadow: 0 2px 4px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12)!important;margin:10px; font-family:Candara;\">\n <h2 style=\"text-align:center\">Verify your Email</h3>\n <h3 style=\"font-size:15px;\">Hello '.$entity.',<br></h3>\n <h3 style=\"font-size:15px;\">Welcome to Buddhist Parinay. Please <a href=\"'.base_url().'user/user_profile/verifyEmail/'.$verify_code.'?verify=true&src=getvalidated\">Click here</a> to verify your Email-Id OR Copy-Paste below link :<br>\n <a href=\"'.base_url().'user/user_profile/verifyEmail/'.$verify_code.'?verify=true&src=getvalidated\">'.base_url().'user/user_profile/verifyEmail/'.$verify_code.'?verify=true&src=getvalidated</a>\n </h3><br>\n <h3 style=\"font-size:15px;\">Regards,</h3>\n <h3 style=\"font-size:15px;\">Buddhist Parinay Admin,</h3>\n <div class=\"col-lg-12\">\n <div class=\"col-lg-4\"></div>\n <div class=\"col-lg-4\">\n\n </div>\n </body></html>');\n\n if ($this->email->send()) {\n $response=array(\n 'status' => 'success',\n 'message' => '<b>Success:</b> Verification code has been sent to your Registered Email ID.'\n );\n } \n else{\n print_r($this->email->print_debugger());\n }\n }\n echo json_encode($response);\n die();\n}", "function verify_user_and_update_subscription($user_email, $verification_code, $mysqli)\n{\n $subscribed = 'yes';\n $is_verified = 'yes';\n $response = [\n 'success' => false,\n 'error_message' => '',\n ];\n\n $does_user_exists = does_user_exist($user_email, $mysqli);\n\n if (!$does_user_exists) {\n $response['success'] = false;\n $response['error_message'] = 'user does not exist';\n\n return $response;\n }\n}", "public function verify_email($code) {\n $this->db->select('*');\n $this->db->from('vendors');\n $this->db->join('business_details', 'business_details.business_id = vendors.id');\n $this->db->where('vendors.email_verification_code', $code);\n $query = $this->db->get();\n $query_result = $query->result();\n if (!empty($query_result)) {\n $order_status_update = array(\n 'email_verification_status' => '1'\n );\n\n $this->db->where('email_verification_code', $code);\n $this->db->update('vendors', $order_status_update);\n\n\n $partner_details = array();\n if (count($query_result) == 0) {\n $partner_details = $query_result;\n } else {\n $partner_details = $query_result[0];\n }\n return $partner_details;\n } else {\n return \"not matched\";\n }\n }", "public function veryfyuser($email,$code){\n\t\t$this->db->where('Status', '0');\n\t\t$this->db->where('Email', $email);\n\t\t$this->db->where('UniqueKey', $code);\n\n\t\t$query=$this->db->get('tbl_userdetails');\n\t\tif($query->num_rows()==1){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = $_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\n\t\t\t// Refferal amount\n\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t//-----------------/////\n\n\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\tif (!empty($records)) {\n\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount = $records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic = $records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) {\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n\t\t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$img = self_img_url . $user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$img = '';\n\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif ($status == '1') {\n\t\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\t\texit();\n\t\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status'] = 1;\n\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data);\n\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\t\t\t\tif (!empty($reffer_records)) {\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\n\t\t\t\t\t\t$data12['reffer_user_id'] = $user11_id;\n\t\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data12);\n\n\t\t\t\t\t}\n\t\t\t\t\t/*\n\t\t\t\t\t if(!empty($reffer_records)){\n\t\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t\t $refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t $user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t $reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t $wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t $frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t $current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t $transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t $wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t $refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t $wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t $wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t if($reffer_code == $reffer_code_database){\n\n\t\t\t\t\t $add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\n\t\t\t\t\t $add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t $data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t $update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\n\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t\t */\n\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'], 'user_id' => $user_id, 'user_wallet' => $wallet_amount, 'user_email' => $user_email, 'login_type' => 1, 'user_reffer_code' => $user_self_reffer, 'profile_pic' => $img, 'user_pin_status' => '2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\", 'user_mobile_no' => $_POST['user_mobile_no'], 'verification_code' => $_POST['user_verification_code']);\n\t\t\techo $this -> json($error);\n\t\t}\n\t}", "public function checkActivationUser($email, $code)\n {\n $sql = \"SELECT id FROM `user` WHERE `email` = '$email' and `activationCode`='$code'\";\n $query = $this->db->prepare($sql);\n $query->execute();\n $result = $query->fetchAll();\n $count = sizeof($result);\n if ($count > 0)\n return true;\n else return false;\n }", "function check_verify($code, $id = ''){\n $verify = new \\Think\\Verify();\n return $verify->check($code, $id);\n}", "function send_verification_email($user_email, $verification_code)\n{\n\n $to = $user_email;\n $subject = 'Verification Email';\n\n $message = '\n Thanks for subscribing!\n Your veirfication code is:\n ' . $verification_code;\n\n return mail($to, $subject, $message);\n}", "function users_user_activation($args)\n{\n $code = base64_decode(FormUtil::getPassedValue('code', (isset($args['code']) ? $args['code'] : null), 'GETPOST'));\n $code = explode('#', $code);\n\n if (!isset($code[0]) || !isset($code[1])) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n $uid = $code[0];\n $code = $code[1];\n\n // Get user Regdate\n $regdate = pnUserGetVar('user_regdate', $uid);\n\n // Checking length in case the date has been stripped from its space in the mail.\n if (strlen($code) == 18) {\n if (!strpos($code, ' ')) {\n $code = substr($code, 0, 10) . ' ' . substr($code, -8);\n }\n }\n\n if (DataUtil::hash($regdate, 'md5') == DataUtil::hash($code, 'md5')) {\n $returncode = pnModAPIFunc('Users', 'user', 'activateuser',\n array('uid' => $uid,\n 'regdate' => $regdate));\n\n if (!$returncode) {\n return LogUtil::registerError(__('Error! Could not activate your account. Please contact the site administrator.'));\n }\n LogUtil::registerStatus(__('Done! Account activated.'));\n return pnRedirect(pnModURL('Users', 'user', 'loginscreen'));\n } else {\n return LogUtil::registerError(__('Sorry! You entered an invalid confirmation code. Please correct your entry and try again.'));\n }\n}", "public static function verifyAuth($auth) {\n\t\t$GLOBALS[\"logger\"]->debug(\"in verifyAuth, code \" . $auth);\n\t\t$resultSet = ORM::for_table(self::AUTHCODE_TABLE)->\n\t\t\tselect('code_hash')->\n\t\t\tfind_many();\n\t\t$GLOBALS[\"logger\"]->debug(\"completed query\");\n\t\tforeach ($resultSet as $result) {\n\t\t\t$hash = $result->code_hash;\n\t\t\t$GLOBALS[\"logger\"]->debug(\"Checking hash \" . $hash);\n\t\t\tif (password_verify($auth, $hash)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t$GLOBALS[\"logger\"]->debug(\"No hash matched\");\n\t\treturn false;\n\t\t//$selstmt = \"SELECT CODE_HASH FROM AUTHCODES\";\n\t}", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = country_code.$_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\t\t\t\n\t\t\t\t// Refferal amount\n\t\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t//-----------------/////\n\t\t\t\n\t\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\t\tif (!empty($records)) {\n\t\t\t\t\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount=$records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic=$records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) \t{\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n \t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n \t\t\t\t\t$img = self_img_url.$user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t\t} else \t{\n\t\t\t\t\t$img = '';\t\n\t\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif($status=='1'){\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\texit();\n\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status']=1;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data);\n\t\t\t\t\t\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code',$reffer_code);\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t$data12['reffer_user_id']=$user11_id;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data12);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\t\t\t\t\t$reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t\t\t\t\t\t\t$wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t\t\t\t\t\t\t$frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t\t\t\t\t\t\t$current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t\t\t\t\t\t\t$transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t\t\t\t\t\t\t$wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t\t\t\t\t\t\t$refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t\t\t\t\t\t\t$wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t\t\t\t\t\t\t$wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t\t\t\t\t\tif($reffer_code == $reffer_code_database){\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t$add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t$add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t\t\t\t\t\t\t$data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\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\t\t\n\t\t\t\t\t\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'],'user_id'=>$user_id,'user_wallet'=>$wallet_amount,'user_email'=>$user_email,'login_type'=>1,'user_reffer_code'=>$user_self_reffer,'profile_pic'=>$img,'user_pin_status'=>'2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t}else{\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\" ,'user_mobile_no' => $_POST['user_mobile_no'],'verification_code'=>$_POST['user_verification_code']);\n\t\techo $this -> json($error);\n\t\t}\n\t}", "public function verifyemail($confirmation_code)\n {\n //get data\n $currentUser = $this->currentUser;\n $user = $this->userRepository->confirm($confirmation_code);\n\n //check user already confirm\n if(isset($currentUser->confirmed) ) {\n $data = ['name' => $currentUser->name, 'message' => trans('text.email_alr_confirmed') ];\n }\n //no code \n elseif( ! $confirmation_code) {\n $data = ['message' => trans('text.email_not_confirmed_no_act_code') ];\n }\n //confirm user in db\n elseif($user) {\n $data = ['name' => $user->name, 'message' => trans('text.email_confirmed') ];\n }\n //no user no code\n else { \n $data = ['message' => trans('text.email_not_confirmed_usr_not_found') ];\n }\n //output\n return $this->view\n ->make('auth.verifyemail', $data);\n }", "public static function check_email_verification($verification_code , $data , &$error) \n {\n\n // Check the data exists\n\n if($data) {\n\n // Check whether verification code is empty or not\n\n if($verification_code) {\n\n if ($verification_code != $data->verification_code ) {\n\n $error = tr('verification_code_mismatched');\n\n return FALSE;\n\n }\n\n }\n \n // Check whether verification code expiry \n\n if ($data->verification_code_expiry > time()) {\n\n // Token is valid\n\n $error = NULL;\n\n return true;\n\n } else {\n\n $data->verification_code = Helper::generate_email_code();\n\n $data->verification_code_expiry = Helper::generate_email_expiry();\n\n $data->save();\n\n // If code expired means send mail to that user\n\n $subject = tr('verification_code_title');\n $email_data = $data;\n $page = \"emails.welcome\";\n $email = $data['email'];\n $result = Helper::send_email($page,$subject,$email,$email_data);\n\n $error = tr('verification_code_expired');\n\n return FALSE;\n }\n }\n }", "public static function verify($email)\n\t{\n\n\t\t$key = Config::get('kbox::kickbox_api_key');\n\n\t\t$client = new \\Kickbox\\Client($key);\n\t\t$kickbox = $client->kickbox();\n\t\t$response = $kickbox->verify($email);\n\n\t\treturn $response;\n\n\t}", "public function check_email() {\n\t\t$email = urldecode($_GET['email']);\n\n\t\t$result = $this->Member_Model->check_email_if_exists($email);\n\n\t\tif ($result > 0) {\n\t\t\techo json_encode(false);\n\t\t} else {\n\t\t\techo json_encode(true);\n\t\t}\n\t}", "function emailpasswordresetcode($username, $email){\n\t$to=$email;\n\t$errortype = 98;\n\t$errorcode = generateerrorcode($username,$email);\n\t$db=usedb();\n\t//make sure the user provided input is safe\n\t$username=mysqli_real_escape_string($db, $username);\n\t$email=mysqli_real_escape_string($db, $email);\n\t$errorcode=mysqli_real_escape_string($db, $errorcode);\n\t$sql=<<<SQL\n\t\tUPDATE users\n\t\tSET users.PassWord=MD5('$errorcode'), users.ErrorType=$errortype, users.ErrorCode='$errorcode'\n\t\tWHERE (users.UserName='$username' AND users.Email='$email')\nSQL;\n\tmysqli_query($db, $sql);\n\t$rows=mysqli_affected_rows($db);\n\tif(!$rows){\n\t\tmysqli_close($db);\n\t\treturn 0;\n\t}else{//the update was successful so we can try to get the display name and sent the email\n\t\t$sql=<<<SQL\n\t\t\tSELECT users.DisplayName\n\t\t\tFROM users\n\t\t\tWHERE (users.UserName = '$username')\nSQL;\n\t\t$result = mysqli_query($db, $sql);\n\t\t$rows = mysqli_num_rows($result);\n\t\tmysqli_close($db);\n\t\tif(!$rows){\n\t\t\treturn 0;\n\t\t}else{\t//if we have an author with that id\n\t\t\t//get the information in the result\n\t\t\t$assoc = mysqli_fetch_assoc($result);\n\t\t\t$displayname = $assoc['DisplayName'];\n\t\t\t//Send the email\n\t\t\t$subject=\"Collabor8r Password Reset\";\n\t\t\t$helpaddress=emailaddress(\"help\");\n\t\t\t$header=\"From: Collabor8r User Services <$helpaddress>\";\n\t\t\t$text = <<<TEXT\nDear $displayname,\nAs per your request, we have reset your password.\nTemporary Password: $errorcode\nUpon logging in with this password, you will need to change your password to regain access to all of our services.\nThank you for your continued patronage. If you ever have suggestions about our services, please don't hesitate to contact us.\nThe CollaboR8R Team.\nIf you did not request this email, please forward this it to [email protected].\nTEXT;\n\t\t\tmail($to,$subject,$text,$header);\n\t\t\treturn 1;\n\t\t}\n\t}\n\t//if we get past the point, the email didn't get sent so return 0\n\treturn 0;\n}", "public function accountVerifyConfirmAction()\n {\n // get the view vars\n $errors = $this->view->errors; /* @var Sly_Errors $errors */\n $site = $this->view->site; /* @var BeMaverick_Site $site */\n $validator = $this->view->validator; /* @var BeMaverick_Validator $validator */\n\n // set the input params\n $requiredParams = array(\n 'code',\n );\n\n $input = $this->processInput( $requiredParams, null, $errors );\n\n // check if there were any errors\n if ( $errors->hasErrors() ) {\n return $this->renderPage( 'errors' );\n }\n\n // decode the hash and gets its parts, confirm all good and account is valid\n list( $username, $timestamp, $signature ) = explode( '|', base64_decode( urldecode( $input->code ) ) );\n\n $user = $site->getUserByUsername( $username );\n\n $validator->checkValidUser( $user, $errors );\n $validator->checkValidVerifyAccountCode( $site, $username, $timestamp, $signature, $errors );\n\n if ( $errors->hasErrors() ) {\n return $this->renderPage( 'errors' );\n }\n\n $user->setEmailVerified( true );\n $user->save();\n\n // set the cookie\n BeMaverick_Cookie::updateUserCookie( $user );\n\n return $this->renderPage( 'authAccountVerifyConfirm' );\n }", "function password_change_login($email, $password, $verification_code) {\n\t\tglobal $pdo;\n\n\t\t//empty or array check\n\t\tif(empty($email) || is_array($email) || empty($password) || is_array($password) || empty($verification_code) || is_array($verification_code)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t//check if user exists\n\t\t$sql = \"SELECT id FROM user WHERE verification_code = :verification_code AND REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 1 AND TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, code_generation_time)) <= 600\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindParam(\":verification_code\", $verification_code, PDO::PARAM_STR);\n\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t$sth->execute();\n\n\t\tif($sth->rowCount() == 0) {\n\t\t\treturn 2;\n\t\t}\n\n\t\t//check if password meet our requirements\n\t\tif(!password_security_check($password)) {\n\t\t\treturn 3;\n\t\t}\n\n\t\t//hash password\n\t\t$password_hash = password_hash($password, PASSWORD_BCRYPT);\n\t\t//get id\n\t\t$id = $sth->fetch()[\"id\"];\n\n\t\t//change password\n\t\t$sql = \"UPDATE user SET verification_code = NULL, code_generation_time = NULL, password = :password_hash WHERE id = :id\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindParam(\":password_hash\", $password_hash, PDO::PARAM_STR);\n\t\t$sth->bindParam(\":id\", $id, PDO::PARAM_INT);\n\t\t$sth->execute();\n\t\treturn 0;\n\t}", "public function call_email_api($email)\n {\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, 'https://emailverifierapi.com/v2/?apiKey='.config('app.EMAIL_VERIFIER').'&email='.urlencode($email));\n\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_TIMEOUT, '50');\n\n $content = curl_exec($ch);\n curl_close($ch);\n\n return json_decode($content, TRUE);\n }", "function check_auth_response_code($status) {\n\n if ($status != 'S000') {\n $message = get_ticket_error_message($status);\n return result_error($status,$message);\n }\n return result_success();\n}", "private function verify_email() {\n $array = array();\n $errors = array();\n //Check if email already exists in users table\n try {\n $stmt = $this->conn->prepare(\"SELECT * FROM users WHERE email = :email\");\n\n $stmt->bindParam(':email', $this->email);\n\n $stmt->execute();\n\n $results = array();\n\n while($result = $stmt->fetch(\\PDO::FETCH_ASSOC)) {\n $results[] = $result;\n }\n\n //check result count, if 0 that means email doesnt exist so user can be registered\n if(count($results) == 0) {\n return $array['status'] = \"Success\";\n }\n\n //if count is not 0 that means the email address already exists so user cannot be registered\n $array['status'] = \"Error\";\n $errors[] = \"-Email address already exists\";\n $array['errors'] = $errors;\n return $array;\n\n } catch(\\Exception $e) {\n $array['status'] = \"Error\";\n $errors[] = \"Server Error\";\n $array['errors'] = $errors;\n return $array;\n }\n\n }", "public function activateAccount($code, $email)\n {\n\n // define all the global variables\n global $database, $message, $functions;\n\n // escape the given strings\n $code = $this->secureInput($code);\n $email = $this->secureInput($email);\n\n // start the checks\n if (empty($code) || empty($email)) {\n $message->setError(\"Code/Email fields most not be empty\", Message::Error);\n return false;\n }\n\n // check if email exists\n if (!$functions->emailExist($email)) {\n $message->setError(\"The provided email is not in our database.\", Message::Error);\n return false;\n }\n\n // check if the given code matches the required characters\n if (strlen($code) < 20 || strlen($code) > 20) {\n $message->setError(\"The given code has to be exactly 20 characters long\", Message::Error);\n return false;\n }\n\n // check if account already has been activated\n if ($functions->isUserActivated($email, true)) {\n $message->setError(\"The account is already activated\", Message::Error);\n return false;\n }\n\n $sql = \"SELECT * FROM \" . TBL_USERS . \" WHERE \" . TBL_USERS_EMAIL . \" = '\" . $email . \"' AND \" . TBL_USERS_ACTIVATION_CODE . \" = '\" . $code . \"'\";\n\n // get the sql results\n $result = $database->getQueryResults($sql);\n if ($database->anyError()) {\n return false;\n }\n\n // check if wrong code has been used\n if ($database->getQueryNumRows($result, true) < 1) {\n $message->setError(\"Wrong activation code has been used.\", Message::Error);\n return false;\n }\n\n //update the user account with the needed information\n $sql = \"UPDATE \" . TBL_USERS . \" SET \" . TBL_USERS_ACTIVATED . \" ='1',\" . TBL_USERS_ACTIVATION_CODE . \"='' WHERE \" . TBL_USERS_EMAIL . \" = '\" . $email . \"' AND \" . TBL_USERS_ACTIVATION_CODE . \" = '\" . $code . \"'\";\n\n // get the sql results\n $database->getQueryResults($sql);\n if ($database->anyError()) {\n return false;\n }\n\n $message->setSuccess(\"Your account has been activated successfully !\");\n return true;\n }", "public function verifyEmail($vCode)\n {\n $returnToRoute = array\n (\n 'name' => FALSE,\n 'data' => FALSE,\n );\n\n /**\n * Must return both email and member id because a member may have more than one email address\n */\n $verifiedMemberIDArray = $this->verifyEmailByLinkAndGetMemberIDArray($vCode, 'VerificationDetailsForm');\n\n\t if (!isset($verifiedMemberIDArray['errorNbr']) && !isset($verifiedMemberIDArray['errorMsg']))\n\t {\n\t\t $vCodeCreateTime\t\t=\t(is_numeric($verifiedMemberIDArray['vCodeCreateTime'])\n\t ? (int) $verifiedMemberIDArray['vCodeCreateTime']\n\t : 0);\n\t $verificationDuration\t=\t( (strtotime(\"now\") - $vCodeCreateTime) <= self::POLICY_AllowedVerificationSeconds_Signup\n\t ? TRUE\n\t : FALSE );\n\n\t if($verificationDuration)\n\t {\n\t if (isset($verifiedMemberIDArray) && is_array($verifiedMemberIDArray))\n {\n if ($verifiedMemberIDArray['alreadyVerified'] === 0)\n {\n // Create New Employee Status for this member identifying as verified\n $this->addEmployeeStatus('VerifiedEmail', $verifiedMemberIDArray['memberID']);\n\n $this->updateEmployeeEmail($verifiedMemberIDArray['memberID'], array\n (\n 'verified' => 1,\n 'verified_on' => strtotime('now'),\n ));\n }\n\n $this->addEmployeeEmailStatus($verifiedMemberIDArray['email'], 'Verified');\n }\n\t else\n\t {\n\t Log::info(\"Error #3 - returned value from verifiedMemberIDArray is not an array.\");\n\t $returnToRoute = array\n\t (\n\t 'name' => 'custom-error',\n\t 'data' => array('errorNumber' => 3),\n\t );\n\t }\n\t }\n\t else\n\t {\n\t Log::info(\"Error #22 - verification link has expired.\");\n\t $returnToRoute = array\n\t (\n\t 'name' => 'custom-error',\n\t 'data' => array('errorNumber' => 22),\n\t );\n\t }\n\t }\n\t else\n\t {\n\t\t Log::info(\"Error #\" . $verifiedMemberIDArray['errorNbr'] . \" - \" . $verifiedMemberIDArray['errorMsg'] . \".\");\n $returnToRoute = array\n (\n 'name' => 'custom-error',\n 'data' => array('errorNumber' => $verifiedMemberIDArray['errorNbr']),\n );\n\t }\n\n\n\n if(FALSE != $returnToRoute['name'])\n {\n return Redirect::route($returnToRoute['name'],$returnToRoute['data']);\n }\n else\n {\n // Create Employee Details Form - also force to add name, gender, employee type and zip code and time zone in form\n $viewData = array\n (\n 'vcode' => $vCode,\n 'firstName' => '',\n 'lastName' => '',\n 'gender' => 0,\n 'memberType' => 0,\n 'zipCode' => '',\n 'VerificationDetailsFormMessages' => (isset($VerificationDetailsFormMessages) && $VerificationDetailsFormMessages != '' ?: ''),\n );\n return $this->makeResponseView('application/auth/verified_email_success', $viewData);\n }\n }", "public function check_email() {\n\n\t\t$email = Input::post('email');\n \n\t\tif(is_string($email)) {\n\t\t\t\n\t\t\t$this->_password_reset->_unlocked_me($email);\n\t\t\t$row = $this->_password_reset->_validate_email($email);\n\t\t\t$res = $this->_password_reset->getData($email);\n\t\t\t$_res = $this->_password_reset->_check_if_reg($email);\n\t\t\t$ques = $this->_question->getquestion($res['question_id']);\n\n\t\t\tif($row > 0) {\n\t\t\t\tif($_res > 0) {\n\t\t\t\t\tif($res['status'] != 0) {\n\t\t\t\t\t\t$_arr = array('msg' =>Constant::EMAIL_CONFIRM, 'question' => $ques['security_question']);\n\t\t\t\t\t\techo json_encode($_arr);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$_arr = array('msg' =>Constant::LOCKED);\n\t\t\t\t\t\techo json_encode($_arr);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$_arr = array('msg' =>Constant::NOT_REGISTERED);\n\t\t\t\t\techo json_encode($_arr);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\theader(\"HTTP/1.0 404 Not Found\");\n\t\t\t\texit;\n\t\t\t}\n\n\t\t} else {\n\t\t\theader(\"HTTP/1.0 404 Not Found\");\n\t\t\texit;\n\t\t}\n\t}", "public function emailCode(Request $request,$email_id){\n\n $attempt=LoginAttempt::getCurrentAttempt($request);\n \n $email_channel=new Email; \n\n if(!AuthVerificationManager::has2Verify($attempt)){\n return $this->intended();\n }\n if(!$attempt->canVerify($email_channel)){\n return redirect()->route('user-auth-v');\n }\n\n\n\n\n // If email_id is valid we assume that someone is messing the url and restart the process\n $validator=Validator::make(['email_id'=>$email_id],[\n 'email_id'=>'required|integer|max:250000000'\n ]);\n\n if($validator->fails()){\n return redirect(route('user-auth-v').'/channel/email');\n }\n\n $email=$request->user()->getConfirmedEmailById(intval($email_id));\n $masked_email=$email['masked_email'];\n\n $pageTitle='Email verification';\n return view('laradmin::user.auth_verification.channels.email.code',compact(['pageTitle','email_id','masked_email']));\n\n }", "private function verifyUser($email) {\n $userFound = $this->user->where('email', $email)->first();\n if ($userFound) {\n return $userFound['custID'];\n } else {\n return -1;\n }\n }", "public function getTwoStepVerificationCode();", "public function verify_login($email){\n\t\t//a query to get all login information base on email\n\t\t$sql = \"SELECT * FROM ulogin WHERE customer_email ='$email'\";\n\n\t\t//execute the query\n\t\treturn $this->query($sql);\n\t}", "public function getUserActivation($email,$code){\n\t\t$emptyModelInstance = Sentry::getUserProvider()->getEmptyUser();\n\n\t\t// Now, you have any methods available that you'd like. Retrieve a new instance, query\n\t\t// against anything. Because our User model implements the right interfaces, it plays nicely\n\t\t// with Sentry.\n\t\t$user = $emptyModelInstance->where('email', '=', $email)->first();\n\n\t\t// Continue on as you were...\n\t\ttry\n\t\t{\n\t\t // Find the user using the user id\n\t\t //$user = Sentry::findUserById(1);\n\n\t\t // Attempt to activate the user\n\t\t if ($user->attemptActivation($code))\n\t\t {\n\t\t return Redirect::to('/')\n\t\t\t\t\t->with('success','You\\' ve logged in successfully!');\n\t\t }\n\t\t else\n\t\t {\n\t\t // User activation failed\n\t\t }\n\t\t}\n\t\tcatch (Cartalyst\\Sentry\\Users\\UserNotFoundException $e)\n\t\t{\n\t\t echo 'User was not found.';\n\t\t}\n\t\tcatch (Cartalyst\\Sentry\\Users\\UserAlreadyActivatedException $e)\n\t\t{\n\t\t echo 'User is already activated.';\n\t\t}\n\t}", "function verifyUser($email, $hash){\n\t$conn = connectViaMysql();\n\t$email = mysqli_real_escape_string($conn,$email);\n\t$loginInfo = mysqli_real_escape_string($conn,$hash);\n\n\t$temp = $loginInfo;\n\techo \" <br><br><p>temp = : \". $temp . \"</p>\";\n\t$success = false;\n\ttry{\n\n\t\t$checkQuery = \"SELECT hash FROM users WHERE email='\".$email.\"' AND hash='\".$loginInfo.\"' AND active='0'\";\n\t\t$search = mysqli_query($conn, $checkQuery) or die(mysqli_error($conn)); \n\t\t$match = mysqli_num_rows($search);\n\n\t\tif($match > 0){\n\t\t\t// We have a match, activate the account\n\t\t\t$success = true;\t\n\t\t}else{\n\t\t\t$success = \"Invalid approach, please use the link that has been send to your email.\";// No match -> invalid url or account has already been activated.\n\t\t}\n\t}\n catch(PDOException $e){\n echo 'Error: ' . $e->getMessage();\n }\n\tmysqli_close($conn);\n\treturn $success;\n}", "public static function getUserVerified($email)\n {\n $query=\"select user_id from bimp_user where email='\".$email.\"'\";\n $email= Yii::app()->db->createCommand($query)->queryAll();\n $count=count($email);\n if($count==1){\n $result['userId']=$email[0]['user_id'];\n return $result;\n }else{\n return false;\n }\n \n }", "public function verify_email(Request $request)\n {\n if ($mail_format_vail = $this->mail_format_vail($request, 2)) {\n return $mail_format_vail;\n };\n\n try {\n // 数据库中找到对应的邮箱验证码,删除并返回删除数量(未找到则返回0)\n $count = EmailVerify::query()->where(\n [\n \"email\" => $request->email,\n \"code\" => $request->code,\n ],\n )->delete();\n if ($count == 0) {\n // TODO: code:200, data:null, ps:邮箱验证码错误\n return response(\n [\n \"code\" => 200,\n \"data\" => null,\n ]\n );\n } else {\n // 验证码正确\n if ($register_or_Login = $this->register_or_Login($request)) {\n return $register_or_Login;\n }\n }\n } catch (\\Throwable $th) {\n // TODO: code:201, data:null, ps:邮箱验证异常\n return CustomCatchResponse::catch_response(201, $th);\n }\n }", "public function verifyAccount() {\n\n\t\t//Get Value of UserId from URL\n\t\t$UID = $this->MyJamiaDecrypt($this->input->get('UID'));\n\t\t//Get value of rtext from URL\n\t\t$RText = $this->input->get('rtext');\n\n\t\t$this->load->model('UserModel','UM');\n\n\t\t$data['VerificationResult'] = $this->UM->VerifyEMailAccount($UID, $RText);\n\t\t$data['UID'] = $UID;\n\n\t\t$data['message'] = 'Please set your password';\n\t\t$data['messageType'] = 'I';\n\t\t// \t$VerificationResult == 1 \t=> Passed verification\n\t\t//\t$VerificationResult == -1 \t=>\tAccount already created\n\t\t//\t$VerificationResult == 0 \t=>\tVerification failed\n\n\t\t$this->load->view('/public/SetAccountPassword',$data);\n\t}", "public function send_verification_email($email_addr,$username)\n {\n //build config array using premade gmail account\n $config= array(\n 'protocol'=>'smtp',\n 'smtp_host'=>'ssl://smtp.googlemail.com',\n 'smtp_port'=>465,\n 'smtp_user'=>'HIDDEN',\n 'smtp_pass'=>'HIDDEN',\n 'charset' => 'iso-8859-1',\n 'mailtype' => 'html',\n\n );\n\n $this->CI->load->library('email',$config);\n $this->email->CI =& $this;\n\n $this->CI->email->set_newline(\"\\r\\n\");\n\n if(!$code=$this->CI->user_model->read_code($username))\n {\n return FALSE; // if verification code from db cannot be read return false\n }\n\n //build email template and send code as a-link\n $verify_link=\"<a href=\".site_url().'users/validate_user/'.$code.\">Click Here to Validate Account<a/>\";\n $this->CI->email->from('HIDDEN', 'RH FILES');\n $this->CI->email->to($email_addr);\n $this->CI->email->subject('Account Validation');\n $this->CI->email->message('Thanks for taking the time to create an account. \n Please follow the link to validate your account: '.$verify_link);\n \n return $this->CI->email->send();\n }", "public function verifyEmail($code)\n {\n if($code === $this->isOtpValid()){\n $pdo = static::getDB();\n\n $sql = \"UPDATE users SET is_verified = :is_verified WHERE email = :email\";\n\n $result = $pdo->prepare($sql);\n\n return $result->execute([\n ':email' => $this->email,\n ':is_verified' => 'Y',\n ]);\n }\n return false;\n }", "public function check_email($email){\n $query = $this->db->select('01_email')\n ->where('01_email', $email)\n ->get('register_01');\n if($query->num_rows()>0){\n return 0;\n }else{\n $query = $this->db->where('is_sms', 1)\n ->where('number', $email)\n ->get('verify_otp_12');\n if($query->num_rows()>0){\n return 'sent';\n }else{\n $query = $this->db->where('number', $email)\n ->delete('verify_otp_12');\n $otp = rand(10000, 1000000);\n $data = array(\n 'number' => $email,\n 'otp' => $otp,\n );\n $query = $this->db->insert('verify_otp_12', $data);\n return true;\n }\n }\n }", "public function verifyEmail(VerifyEmailRequest $request)\n {\n $user = $this->userRepo->findUserByEmail($request->email);\n\n if ($user->digit_code !== $request->digit_code) {\n throw new UsersDigitCodeInvalidException();\n } \n \n $digit_code_expired = Carbon::now()->isAfter($user->digit_code_expired_at);\n\n if($digit_code_expired){\n throw new UsersDigitCodeExpiredException();\n }\n\n $user->markEmailAsVerified();\n\n $this->userRepo->updateUser([\n 'digit_code' => null,\n 'digit_code_expired_at' => null\n ],$user->id);\n\n return response()->json(['message'=>\"Votre compte est vérifié avec succès \"],200);\n\n }", "function check_verify($code, $id = 1){\n $verify = new \\Think\\Verify();\n return $verify->check($code, $id);\n}", "function verify_email()\n\t{\n\t\t\n\t\tif($this->uri->segment(3))\n\t\t{\n\t\t\t$verification_key = $this->uri->segment(3);\n\t\t\t\n\t\t\tif($this->register_model->verify_email($verification_key))\n\t\t\t{\n\t\t\t\t$data['message'] = '<h1 align=\"center\"> Thank you for verifying your email address. Click <a href=\"'.base_url().'login\">here</a> to login.</h1>';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$data['message'] = '<h1 align=\"center\"> This link is invalid.</h1>';\n\t\t\t}\n\t\t\t$this->load->view('template/header');\n\t\t\t$this->load->view('email_verification', $data);\n\t\t\t$this->load->view('template/footer');\n\t\t}\n\n\t}", "function activate_user()\n{\n if($_SERVER['REQUEST_METHOD'] == \"GET\"){\n if(isset($_GET['email'])){\n $email=clean($_GET['email']);\n $validation_code=clean($_GET['code']);\n $sql=\"SELECT id FROM users WHERE email='\".escape($_GET['email']).\"' AND validation_code='\".escape($_GET['code']).\"'\";\n $result=query($sql);\n if(row_count($result)==1){\n $sql2=\"UPDATE users SET active=1, validation_code=0 WHERE email='\" .escape($email).\"' AND validation_code='\".escape($validation_code).\"'\";\n $result2=query($sql2);\n set_message(\"<p class='bg-success'>Your account has been activated please login</p>\");\n redirect(\"login.php\");\n }else{\n set_message(\"<p class='bg-danger'>Your account could not be activated</p>\");\n redirect(\"login.php\");\n }\n\n }\n\n\n }\n}", "function send_authcode_email($authcode,$email,$code_type=0)\n\t{\n\t\t$this->load->library(\"mail\");\n\t\t$this->load->model('login/register_model');\n\t\t$msg_head=$msg_end=$lang=$link=$stuid='';\n\n\t\tif($this->_user_id)\n\t\t{\n\t\t\t$user_info=$this->register_model->get_user_info($this->_user_id);\n\t\t\tif($user_info['errorcode'] && $user_info['user']->student_id)\n\t\t\t{\t\t\n\t\t\t\t$stuid='您的学号是:'.$user_info['user']->student_id.'<br />';\n\t\t\t}\n\t\t}\n\n\t\tswitch($code_type)\n\t\t{\n\t\t\tcase Constant::CODE_TYPE_REGISTER: $link=\"verify\";$lang=\"verify\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PASSWORD: $link=\"forgot/reset\";$lang=\"reset\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_EMAIL: $link=\"verify\";$lang=\"update_email\";break;\n\t\t\tcase Constant::CODE_TYPE_REGISTER_VERIFY_EMAIL: $link=\"verify\";$lang=\"reg_reverify\";break;\n\t\t\tcase Constant::CODE_TYPE_LOGIN_VERIFY_EMAIL: $link=\"verify\";$lang=\"login_reverify\";break;\n\t\t\tdefault:break;\n\t\t}\n\n\t\tif($lang && $link)\n\t\t{\t\n\t\t\t//$authcode=site_url().$link.\"?code=\".$authcode;\n\t\t\t$authcode=login_url().$link.\"/code/\".$authcode;\n\t\t\t$subject=$this->lang->line('mail_subject_'.$lang);\n\t\t\t$msg_body=str_replace('{email}',$email,$this->lang->line('mail_body_'.$lang));\n\t\t\t\n\t\t\t$msg_body=str_replace('{stuid}',$stuid,$this->lang->line('mail_body_'.$lang));\n\t\t\t$msg_end=$this->lang->line('mail_end_'.$lang);\t\t\t\n\t\t}\n\t\t$msg=$msg_body.'<br /><a href=\"'.$authcode.'\">'.$authcode.'</a><br />'.$msg_end.'<br/>'.$this->lang->line('mail_disclaimer');\n\n\t\t$ret = Mail::send($email, $subject, $msg);\n\t\tif($ret['ret']==1)\n\t\t{\n\t\t\t$errorcode=true;\n\t\t\tlog_message('info_tizi','170101:Email send success',$ret);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=false;\n\t\t\tlog_message('error_tizi','17010:Email send failed',$ret);\n\t\t}\n\t\treturn array('errorcode'=>$errorcode,'send_error'=>implode(',',$ret));\n\t}", "private static function verify() {\r\n\t\t// create code object for the given code we will be verifying\r\n\t\tif (!isset($_SESSION['user'])) {\r\n\t\t\tself::alertMessage('danger', 'Unable to find session user data. Try logging out and logging in again.');\r\n\t\t\tVerificationView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t$userID = $_POST['userID'] = $_SESSION['user']->getUserID();\r\n\t\t$code = new VerificationCode($_POST);\r\n\r\n\t\t// load and validate expected code from database\r\n\t\t$codeInDatabase = VerificationCodesDB::get($userID);\r\n\t\tif (is_null($codeInDatabase)) {\r\n\t\t\tself::alertMessage('danger', 'No active verification code found. Your code may have expired. Click \"Resend Code\" to send a new code to your phone.');\r\n\t\t\tVerificationView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// compare given/expected codes\r\n\t\tif ($code->getCode() !== $codeInDatabase->getCode()) {\r\n\t\t\tself::alertMessage('danger', 'The code you entered is incorrect. Please check your code and try again.');\r\n\t\t\tVerificationView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// verification successful. mark phone number as verified\r\n\t\t$user = UsersDB::getUser($userID);\r\n\t\t$user->setIsPhoneVerified(true);\r\n\t\tUsersDB::edit($user);\r\n\t\t$_SESSION['user'] = $user;\r\n\r\n\t\t// clean up and show dashboard\r\n\t\tVerificationCodesDB::clear($userID);\r\n\t\tDashboardView::show();\r\n\t}", "function check_email_exist(){\n //TODO syntize the query\n $this->SQL = \"SELECT id,private_name,family_name ,email,password FROM users\"\n . \" WHERE email = '\" . $this->params['email'] . \"';\" ;\n \n \n $this->selecet_query();\n \n \n if ( !empty( $this->results[0]['email'] ) ){\n //found mail - check password\n \n if ($this->results[0]['password'] === $this->params['password']){\n \n $this->success_login();\n \n \n } else {\n // if password incorrect\n $this->results =array( 'results'=>'fail');\n \n }\n \n \n } else {\n //didnt found email \n $this->results =array( 'results'=>'fail');\n \n }\n return $this->results;\n \n }", "function confirm_registration($registration_code)\n {\n /* Check the users table for the activation code */\n $this->db->select('id');\n $this->db->from('users');\n $this->db->where('activation_code',$registration_code);\n $result = $this->db->get();\n if($result->num_rows == 1){\n /* Activate account */\n $data = array(\n 'activated' => 1\n );\n $this->db->where('activation_code',$registration_code);\n $this->db->update('users',$data);\n $user = $result->row_array();\n $email = $this->get_email($user['id']);\n return $email;\n } else {\n return false;\n }\n }", "public function generateEmailVerificationId($email)\n {\n return $this->start()->uri(\"/api/user/verify-email\")\n ->urlParameter(\"email\", $email)\n ->urlParameter(\"sendVerifyEmail\", false)\n ->put()\n ->go();\n }", "protected function validateEmailZip($args) {\n\n if ($args['ent_email'] == '' || $args['ent_user_type'] == '')//$args['zip_code'] == '' || \n return $this->_getStatusMessage(1, 1);\n\n\n if ($args['ent_user_type'] == '1')\n $verifyEmail = $this->_verifyEmail($args['ent_email'], 'mas_id', 'master'); //_verifyEmail($email,$field,$table);\n else\n $verifyEmail = $this->_verifyEmail($args['ent_email'], 'slave_id', 'slave'); //_verifyEmail($email,$field,$table);\n\n if (is_array($verifyEmail))\n $email = array('errFlag' => 1);\n else\n $email = array('errFlag' => 0);\n\n\n// $vmail = new verifyEmail();\n//\n// if ($vmail->check($args['ent_email'])) {\n// $email = $this->_getStatusMessage(34, $args['ent_email']);\n// } else if ($vmail->isValid($args['ent_email'])) {\n// $email = $this->_getStatusMessage(24, $args['ent_email']); //_getStatusMessage($errNo, $test_num);\n// //echo 'email valid, but not exist!';\n// } else {\n// $email = $this->_getStatusMessage(25, $args['ent_email']); //_getStatusMessage($errNo, $test_num);\n// //echo 'email not valid and not exist!';\n// }\n// $selectZipQry = \"select zipcode from zipcodes where zipcode = '\" . $args['zip_code'] . \"'\";\n// $selectZipRes = mysql_query($selectZipQry, $this->db->conn);\n// if (mysql_num_rows($selectZipRes) > 0)\n $zip = array('errFlag' => 0);\n// else\n// $zip = array('errFlag' => 1);\n\n\n if ($email['errFlag'] == 0 && $zip['errFlag'] == 0)\n return $this->_getStatusMessage(47, $verifyEmail);\n else if ($email['errFlag'] == 1 && $zip['errFlag'] == 1)\n return $this->_getStatusMessage(46, $verifyEmail);\n else if ($email['errFlag'] == 0 && $zip['errFlag'] == 1)\n return $this->_getStatusMessage(46, $verifyEmail);\n else if ($email['errFlag'] == 1 && $zip['errFlag'] == 0)\n return $this->_getStatusMessage(2, $verifyEmail);\n }", "public function verify_email(Request $request, $code) {\n $user = User::where('confirmation_code', $code)->first();\n if (count($user) > 0) {\n $data['confirmed'] = 1;\n User::where('id', $user->id)->update($data);\n return redirect('user/home');\n } else {\n return redirect('/');\n }\n }", "function validateEmail($email, $conn) {\n\t\t\t$sql = 'SELECT * FROM persons WHERE email = \\''.$email.'\\'';\n\t\t\t//Prepare sql using conn and returns the statement identifier\n\t\t\t$stid = oci_parse($conn, $sql);\n\t\t\t//Execute a statement returned from oci_parse()\n\t\t\t$res = oci_execute($stid);\n\t\t\t//if error, retrieve the error using the oci_error() function & output an error message\n\t\t\tif (!$res) {\n\t\t\t\t$err = oci_error($stid); \n\t\t\t\techo htmlentities($err['message']);\n\t\t\t}\n\n\t\t\t$results = oci_fetch_array($stid, OCI_ASSOC);\n\n\t\t\t// Free the statement identifier when closing the connection\n\t\t\toci_free_statement($stid);\n\t\t\t\n\t\t\treturn $results;\n\t\t}", "public function check_user_email($email) {\n $this->db->select('`user_id`, `first_name`, `last_name`, `email`, profile_pic, `facebook_id`, `google_id`, `verify_status`');\n $this->db->from('dw_users');\n $this->db->where('email', $email);\n $query = $this->db->get();\n return $query->row();\n }", "public function verifyEmailAction()\n {\n $userId = $this->params()->fromRoute('userId', null);\n $token = $this->params()->fromRoute('token', null);\n\n if ($userId === null || $token === null) {\n return $this->notFoundAction();\n }\n\n $user = $this->getUserMapper()->findById($userId);\n\n if (!$user) {\n return $this->notFoundAction();\n }\n\n if ($this->userRegistrationService->verifyEmail($user, $token)) {\n // email verified\n return $this->redirectToPostVerificationRoute();\n }\n\n // email not verified, probably invalid token\n $vm = new ViewModel();\n $vm->setTemplate('ht-user-registration/user-registration/verify-email-error.phtml');\n\n return $vm;\n\n }", "public function check_email($email)\r\n\t{\r\n\t\t$query=$this->db->query(\"SELECT * FROM users WHERE emailid='\".$email.\"'\");\r\n\tforeach ($query->result() as $row)\r\n\t\t{\r\n\t\t$storeid=$row->storeid;\r\n\t\t}\r\n\t\t$rows=$query->num_rows();\r\n\t\t$result=array('afftected_rows'=>$rows,'storeid'=>$storeid);\r\n\t\treturn $result;\r\n\t}", "public function validateEmailAction(){\n\t\t \n\t\t $isValid = ! User::emailExists($_GET['email'], $_GET['ignore_id'] ?? null);\n\t\t \n\t\t header('Content-Type: application/json');\n\t\t echo json_encode($isValid);\n\t }", "public function validateEmailAction()\n {\n $is_valid = ! User::emailExists($_GET['email'], $_GET['ignore_id']);\n\n header('Content-Type: application/json');\n echo json_encode($is_valid);\n }", "function password_change($email) {\n\t\tglobal $pdo;\n\n\t\t//empty or array check\n\t\tif(empty($email) || is_array($email)) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t//check if user exists\n\t\t$sql = \"SELECT id FROM user WHERE REPLACE(email, \\\".\\\", \\\"\\\") = REPLACE(:email, \\\".\\\", \\\"\\\") AND verified = 1\";\n\t\t$sth = $pdo->prepare($sql);\n\t\t$sth->bindValue(\":email\", mail_simplify($email), PDO::PARAM_STR);\n\t\t$sth->execute();\n\n\t\tif($sth->rowCount() == 0) {\n\t\t\treturn 2;\n\t\t}\n\n\t\t//get the id of the user\n\t\t$id = $sth->fetch()[\"id\"];\n\n\t\t//generate verification code\n\t\t$verification_code = hash(\"sha256\", microtime() . (string)rand() . $email);\n\n\t\t//get data required for email\n\t\t$change_link = \"https://swapitg.com/changepassword/$verification_code\";\n\t\t$subject = \"Change Passsword\";\n\t\t$mailfile = fopen(__DIR__ . \"/change_password_mail_template.html\", \"r\") or die(\"Unable to open file!\");\n\t\t$message = strtr(fread($mailfile, filesize(__DIR__ . \"/change_password_mail_template.html\")), array('$change_link' => $change_link));\n\t\tfclose($mailfile);\n\t\t$sender_email = \"[email protected]\";\n\t\t$sender_name = \"SwapitG no-reply\";\n\n\t\t//send email\n\t\tif(mail($email, $subject, wordwrap($message, 70, \"\\r\\n\"), \"From: $sender_name<$sender_email>\\r\\nContent-type: text/html; charset=utf-8\", \" -f \" . $sender_email)) {\n\t\t\t//set the verification code\n\t\t\t$sql = \"UPDATE user SET verification_code = :verification_code, code_generation_time = CURRENT_TIMESTAMP WHERE id = :id\";\n\t\t\t$sth = $pdo->prepare($sql);\n\t\t\t$sth->bindParam(\":verification_code\", $verification_code, PDO::PARAM_STR);\n\t\t\t$sth->bindParam(\":id\", $id, PDO::PARAM_INT);\n\t\t\t$sth->execute();\n\n\t\t\treturn 0;\n\t\t} else {\n\t\t\treturn 3;\n\t\t}\n\t}", "public function email_verify() {\n $return = array();\n $email = $this->input->post('email');\n $user = new User();\n $user->where(\"email\", $email)->get();\n $return = ($user->exists()) ? FALSE : TRUE;\n echo json_encode($return);\n }", "function find_email($email)\n\t{\n\n\tpassword_recovery();\n\n\n\t}", "function send_auth_code_at_login($user)\n{\n\t$user_info = get_userdata($user);\n\t\n\t$user_login = $user_info->data->user_login;\n\n\t$user_email = $user_info->data->user_email;\t\n\n\t$user_name = $user_info->data->first_name;\t\n\n\t$user_phone = get_user_meta( $user, 'user_phone', true );\n\t//$user_phone = urldecode($u_phone);\n\n\t$user_fname = get_user_meta( $user, 'first_name', true );\n\n\t$code = get_user_meta( $user, 'has_to_be_activated', true );\n\n\t$subject = 'Your New Authentication Code';\n\n\n\t$message1 = \"<html><body style='background:#f3f3f3;padding:20px 0;'><table border='0' cellpadding='0' cellspacing='0' style='margin:auto; max-width: 520px;width:100%;font-family: Arial;padding:20px;background:#fff;'><tbody>\";\n\t$message1 .=\"<tr><td style='font-size: 16px;'>Hello \".ucfirst($user_fname).\",</td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Welcome to Raise it Fast!</td></tr><tr height=30></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>Please use this code to authenticate your account with Raise it Fast. <span style='background: #aaaaaa none repeat scroll 0 0;height: 45px;text-align: center;width: 101px;'>\".$code.\"</span></td></tr><tr height=20></tr>\";\n\t$message1 .=\"<tr><td style='font-size: 16px; line-height: 20px;'>'If you have any questions or concerns don't hesitate to use our website chat function, call us, or email us by going to our help page at \".site_url('/contact-us/').\" Or, you can simply reply to this email. '</td></tr><tr height=30></tr>\"; \n\t$message1 .=\"<tr><td style='font-size: 16px; margin-top: 20px;'>Thanks for becoming a part of the Raise It Fast community! </td></tr></tbody></table><table border='0' cellpadding='0' cellspacing='0' style='margin:20px auto 0; max-width: 520px;width:100%;'>\"; \n\n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'>1401 Lavaca St #503, Austin, TX 78701</td></tr><tr height=20></tr>\"; \n\t$message1 .=\"<tr><td style='color: #999999; font-size: 12px; text-align: center;'><a href=\".site_url().\" style='text-decoration:none; color: #999999;'>The Raise it Fast Team</a></td></tr>\"; \n\t$message1 .=\"</table></body></html>\";\n\n\twp_mail($user_email, $subject, $message1);\n\n//=========Send Auth Code Via Text message ==================//\n\n\t$account_sid = get_option('twilio_account_sid'); \n\t$auth_token = get_option('twilio_auth_token'); \n //require('lib/twilio-php-latest/Services/Twilio.php');\n\t$client = new Services_Twilio($account_sid, $auth_token); \n //$from = '+12182265630'; \n\t$from = get_option('twilio_phone_no');\n\n\ttry\n\t{\n\t\t$client->account->messages->sendMessage( $from, $user_phone, \"Hello $user_fname, Your Authentication code is $code\");\n\t}\n\tcatch (Exception $e)\n\t{ \n\n\t\techo \"11-\";\n\t}\n}", "public function mailer($email,$code){\r\n $errors = [];\r\n \r\n $query = \"INSERT INTO resetpassword (code, email) VALUES('$code', '$email')\";\r\n $sendEmail = $this->db->query($query);\r\n return $sendEmail;\r\n }", "public function signInUserByEmail($sign_data)\r\n {\r\n $result = array();\r\n $result['status'] = CommonDefinition::ERROR_CHECK_FIELD;\r\n $result['info'] = \"Email or password is empty or not valid\";\r\n\r\n $userSet = new UserInfoSet(null, null, trim($sign_data->user_email), trim($sign_data->user_password));\r\n\r\n // check user sign in data\r\n $userUtil = new SysUtility();\r\n\r\n if (! $userUtil->checkFormField($userSet->getEmail(), CommonDefinition::REG_EMAIL_ID)) {\r\n return ($result); // return due to check form item failed\r\n } else if (! $userUtil->checkFormField($userSet->getPassword(), CommonDefinition::REG_PASSWORD_ID)) {\r\n return ($result); // return due to check form item failed\r\n }\r\n\r\n // convert password to md5 hash\r\n $md5PwCode = md5($userSet->getPassword());\r\n // Set back to the user set\r\n $userSet->setPassword($md5PwCode);\r\n\r\n $signModel = new UserModel(SysDefinition::USER_DB_CONFIG);\r\n // Connect to Database\r\n $db_user_conn = $signModel->connect();\r\n\r\n if (! $db_user_conn) {\r\n $result['status'] = CommonDefinition::ERROR_CONN;\r\n $result['info'] = \"Failed to connect to Server!\";\r\n return ($result); // Connect to DB failed return without further handling\r\n }\r\n\r\n // get the user info table name by the received email\r\n $userDbTblName = $signModel->getUserAccountTblNameByEmail($userSet->getEmail());\r\n\r\n if (! is_bool($userDbTblName)) {\r\n // set the user db table name\r\n $signModel->setTableName($userDbTblName);\r\n $queryResult = $signModel->getUserAccountByEmail($userSet->getEmail());\r\n\r\n if (! is_bool($queryResult)) {\r\n if (strcasecmp($queryResult->getPassword(), $userSet->getPassword()) == CommonDefinition::SAME_RESULT) {\r\n // password match and user in active\r\n if (UserDefinition::USER_STATUS_ACTIVE == $queryResult->getUserStatus()) {\r\n $result['status'] = CommonDefinition::SUCCESS;\r\n $result['info'] = \"Your account is signed in successfully!\";\r\n $result['url'] = U('User/index'); // move to user login index page\r\n // Add user info to session\r\n session_start();\r\n $_SESSION['uid'] = $queryResult->getTagId();\r\n $_SESSION['user_name'] = $queryResult->getUserName();\r\n return ($result); // Connect to DB failed return without further handling\r\n }\r\n }\r\n }\r\n }\r\n\r\n $signModel->close();\r\n return ($result);\r\n }", "public function resendRegistrationVerification($email, $applicationId)\n {\n return $this->start()->uri(\"/api/user/verify-registration\")\n ->urlParameter(\"email\", $email)\n ->urlParameter(\"applicationId\", $applicationId)\n ->put()\n ->go();\n }", "function actiongetVerifyCode()\n\t{\n\t\t$jsonarray= array();\n\t\t\n\t\tif(isset($_POST['phone']))\n\t\t{\n\t\t\t$userObj=new Users();\n\t\t\tif(!is_numeric($_POST['phone'])){\n\t\t\t\t$algoencryptionObj\t=\tnew Algoencryption();\n\t\t\t\t$_POST['phone']\t=\t$algoencryptionObj->decrypt($_POST['phone']);\n\t\t\t}\n\t\t\t$result=$userObj->getVerifyCodeById($_POST['phone'],'-1');\n\t\t\t$jsonarray['status']=$result['status'];\n\t\t\t$jsonarray['message']=$result['message'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$message=$this->msg['ONLY_PHONE_VALIDATE'];\n\t\t\t$jsonarray['status']='false';\n\t\t\t$jsonarray['message']=$message;\n\t\t}\n\t\techo $jsonarray['message'];\n\t}", "function my_email_check_function($id, $email)\n{\n # ...do some meaningful check here...\n return true;\n}", "public function enter_data($name,$email){\n\n\n $status=0;//status is 0 initially\n $code=md5(rand(0,1000));\n \t$query = $this ->conn ->prepare('INSERT INTO androidusers SET name =:name,\n email =:email, status =:status, code=:code');\n \t$query->execute(array('name' => $name, ':email' => $email, 'status'=>$status, 'code'=>$code));\n\n //Send verification link to registered email after clicking the link the confirmed email address after that admin sends password to \n //that email.\n $mail = new PHPMailer;\n $mail->isSMTP();//SMTP-Simple mail transfer protocol(TCP/IP)protocol used in sending and receiving email.\n $mail->Host = 'smtp.mail.yahoo.com';\n $mail->Port = 587;//TLS port number in case of SSL 465.\n $mail->SMTPSecure = 'tls';// TLS- Transport layer security is a cryptographic protocol that provide authentication and data encryptions between the servers\n //e.g client connection to webserver\n $mail->SMTPAuth = true;\n $mail->Username = '';//Admin can replace email alotted to them\n $mail->Password = '';//Password can also be replaced according to the email\n $mail->From = \"[email protected]\";\n $mail->FromName = \"[email protected]\";\n $mail->AddAddress($email);\n $mail->Subject = 'SMART LAB IoT USER LOGIN - EMAIL VERIFICATION';\n \n $mail->msgHTML('<p>Dear '.$name.',<br/><br/><br/> Your verification link is: http://192.168.1.101/android/server/verify.php?name='.$name.'&email='.$email.'&code='.$code.'</p>');\n \n if (!$mail->send()) {\n $error = \"Mailer Error: \" . $mail->ErrorInfo;\n echo '<p id=\"para\">'.$error.'</p>';\n }\n else {\n return true;\n }\n //Ending mail function\n\n\n\n if ($query) {\n \n return true;\n\n } else {\n\n return false;\n\n }\n\n\n\n\n\n\n }", "function validateApiInfo($email, $token) {\n\t\t$this->api_token = $token;\n\t\t$this->email_address = $email;\n\t\t$post_data = array ('action' => 'validate', 'headers' => array ('Authorization' => 'Basic ' . base64_encode ( $email . ':' . $token ), 'User-Agent' => 'Putler Connector/' . $this->version ) );\n\t\t$result = $this->makeRequest ( $post_data );\n\t\t\n\t\treturn $result;\n\t}", "public function validateemail(Request $request, Response $response, array $args = []): Response\n {\n $uuid = $args['uuid'];\n $user = User::where([\n ['approvaleuuid', '=', $uuid]\n ])->first();\n if (!is_null($user)) {\n $arguments['email'] = $user->email;\n $user->adminapproved = true;\n $timestamp = Carbon::createFromTimestamp(time() + 15 * 60);\n $user->emailchecklinktimeout = $timestamp;\n $user->save();\n Authentication::sendValidationEmail($user->email, $user->emailchecklink);\n return $this->render($response, 'auth/validatoremail.twig', $arguments);\n }\n return $this->withRedirect($response, $this->getUrlFor($request,\"home\"));\n }", "function emailVerification($conn){\r\n\t\t@extract($_REQUEST);\r\n\t\t$query =\"select email,id,verified_status from user where encryption_key='\".$q.\"'\";\r\n\t\t$result =$conn->query($query);\r\n\t\tif($result->num_rows > 0){\r\n\t\t\twhile($row = $result->fetch_object()) {\r\n\t\t\t\t//session_destroy();\r\n\t\t\t\t$update=\"update user set encryption_key='',verified_status=0 where id='\".$row->id.\"'\";\r\n\t\t\t\t$conn->query($update);\r\n\t\t\t\t$_SESSION['email']=$row->email;\r\n\t\t\t\t$_SESSION['userId']=$row->id;\r\n\t\t\t}\r\n\t\t\theader(\"Location:index.php?page=createPassword\");\r\n\t\t\texit;\r\n\t\t} else {\r\n\t\t\techo \"<h3 style='text-align:center'>This link valid one time only.</h3>\"; \r\n\t\t}\r\n\t}", "public function verifyCode(CodeRequest $request )\n\t{\n\t\tif(!is_numeric($request->input('code'))){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\n\t\t$querry = \"SELECT * FROM \". DBTool::rawTable('users') . \" WHERE phone_token = '\" . $request->input('code') . \"' AND phone = '\" . $request->input('phone') . \"'\";\n\t\t$user = DB::select(DB::raw($querry));\n\n\t\t$user = ArrayHelper::fromObject($user);\n\n\t\t//if user enter wrong code\n\t\tif(!isset($user[0]['id']) && !isset($user[0]['phone']) ){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\t\t// SET THE CODE IS VERIFIED\n\t\t$querry = \"UPDATE \". DBTool::rawTable('users') . \" SET verified_phone = 1 WHERE id = '\" . $user[0]['id'] . \"'\";\n\t\t$updated = DB::update(DB::raw($querry));\n\t\t$updated = ArrayHelper::fromObject($updated);\n\n\t\t// Redirection\n\t\t// return $this->lastRecords($user[0]['phone']);\n\t\treturn redirect( '/end/registration/' . $user[0]['phone'] );\n\t}", "function get_user_id_from_email($email)\n\t{\n\t\t//$this->firephp->log(\"email=\".$email);\n\t\t\n\t\t$this->db->select($this->flexi_auth->db_column('user_acc', 'id'));\t\n\t\t$this->db->where($this->flexi_auth->db_column('user_acc', 'email'),$email);\t\n\t\t$qres=$this->db->get('user_accounts');\n\t\tif ($qres->num_rows() > 0) {\n\t\t\t$row=$qres->row_array();\n\t\t\t//$this->firephp->log($row['uacc_id'].\"for email=\".$email);\n\t\t\treturn $row['uacc_id'];\n\t\t} else {\n\t\t\t$this->firephp->log(\"Could not determine user id from user email\");\n\t\t\treturn NULL;\n\t\t}\n\t}", "public function check() : int\n {\n\n /**\n * @return invalid request(1) if a code is empty ,null or undefined,\n * if not continue the next execution\n */\n\n if(!$this->code) return INVALID_REQUEST;\n\n\n /** @var $is_valid check the specified code is equal and valid */\n\n $is_valid = database::getInstance()->has('user',[\n\n \"id\" => (new Users())->get_id(),\n\n \"verification_code\" => $this->code\n\n ]);\n\n /** validation */\n\n if($is_valid) {\n\n /** @var $success if a specified code is valid\n * update the current status of \"isVerify\" attribute of a database\n * to PHONE_NUMBER_VERIFIED(1) and\n * @return the number of affected rows\n */\n\n $success = database::getInstance()->update('user',['isVerify'=>user_type::PHONE_NUMBER_VERIFIED],[\n\n \"id\"=> (new Users())->get_id()\n\n ])->rowCount();\n\n /** if has a affeted rows return valid request(2), invalid request if not */\n\n return $success ? VALID_REQUEST : INVALID_REQUEST;\n\n }\n\n\n /** return invalid request(1) if a code is not equal */\n\n return INVALID_REQUEST;\n\n\n\n }", "private function SendVerificationEmail($email,$activationcode){\n\t\t$this->load->library('email');\n\t \t$this->email->set_mailtype('html');\n\t\t$this->email->from('[email protected]', 'Biva Publication');\n\t\t$this->email->to($email);\n\n\n\t\t$message='<!DOCTYPE html><html><head></head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head><body>';\n\t\t$message.='<p>Dear Reader,</p>';\n\t\t$message.='<p>Thanks for registaring on Biva Publication! Please <strong><a href=\"'.base_url().'home/validate_email/'.$email.'/'.$activationcode.'\">Click Here To Validate Email</a></strong>to active your account, you will be able to log into Biva Publication and manage your ordees.</p>';\n\t\t$message.='<p>Thank You!</p>';\n\t\t$message.='<p>Biva Publication</p>';\n\t\t$message.='</body></html>';\n\n\n\t\t$this->email->subject('Biva Publication Account Verification');\n\t\t$this->email->message($message);\n\n\t\t$this->email->send() or die(\"Message Not Send\");\n\t}", "public function actionCheck_email() {\n if (isset($_POST['email']) != 0) {\n $output = '0';\n $email = $_POST['email'];\n $course = $_POST['course'];\n // if (preg_match(\"^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$^\", $email)) {\n $modules = Yii::$app->db->createCommand(\"SELECT * FROM assist_participant WHERE email='$email' and course='$course'\")->queryAll();\n if (!empty($modules)) {\n $output = '1';\n }\n // }\n return $output;\n } else {\n return $this->redirect(['dv-registration/index']);\n }\n }", "public function resendEmailVerification($email)\n {\n return $this->start()->uri(\"/api/user/verify-email\")\n ->urlParameter(\"email\", $email)\n ->put()\n ->go();\n }", "public function verify_email(Request $request) {\n $idToken = $request->get('idToken');\n\n /**\n * Validate the ID Token\n */\n $auth0_domain = 'https://' . $this->domain . '/';\n $auth0_settings = array();\n $auth0_settings['authorized_iss'] = [$auth0_domain];\n $auth0_settings['supported_algs'] = [$this->auth0_jwt_signature_alg];\n $auth0_settings['valid_audiences'] = [$this->client_id];\n $auth0_settings['client_secret'] = $this->client_secret;\n $auth0_settings['secret_base64_encoded'] = $this->secret_base64_encoded;\n $jwt_verifier = new JWTVerifier($auth0_settings);\n try {\n $user = $jwt_verifier->verifyAndDecode($idToken);\n }\n catch(\\Exception $e) {\n return $this->failLogin(t('There was a problem resending the verification email, sorry for the inconvenience.'), \n \"Failed to verify and decode the JWT ($idToken) for the verify email page: \" . $e->getMessage());\n }\n\n try {\n $userId = $user->sub;\n $url = \"https://$this->domain/api/users/$userId/send_verification_email\";\n \n $client = \\Drupal::httpClient();\n\n $client->request('POST', $url, array(\n \"headers\" => array(\n \"Authorization\" => \"Bearer $idToken\"\n )\n )\n );\n\n drupal_set_message(t('An Authorization email was sent to your account'));\n }\n catch(\\UnexpectedValueException $e) {\n drupal_set_message(t('Your session has expired.'),'error');\n }\n catch (\\Exception $e) {\n drupal_set_message(t('Sorry, we couldnt send the email'),'error');\n }\n\n return new RedirectResponse('/');\n }", "function emailTaken($email) {\n\t$db = connectDB();\n $sql = <<<SQL\n \tSELECT userID\n \tFROM users\n \tWHERE email = ?\nSQL;\n\n $statement = $db->prepare($sql);\n $statement->bind_param(\"s\", $email);\n $statement->execute();\n $statement->store_result();\n\t$res = $statement->num_rows;\n\n\t$statement->close();\n\t$db->close();\n\n return $res;\n}", "function verify_authcode_phone($authcode,$phone,$verify=true)\n\t{\n\t\t$user_id=$code_type=0;\n if($this->_redis)\n {\n $data=$this->cache->get($authcode.'_'.sha1($phone));\n if(!empty($data))\n {\n $data=json_decode($data);\n $user_id=$data->user_id;\n $code_type=$data->code_type;\n\t\t\t\tif($verify) $this->cache->delete($authcode.'_'.sha1($phone));\n $errorcode=true;\n }\n else\n {\n $errorcode=false;\n log_message('error_tizi','17051:phone verify code failed',array('phone'=>$phone));\n }\n }\n else\n\t\t{\n\t\t\t$this->db->select(\"id,user_id,phone,code_type,generate_time\");\n\t\t\t$this->db->from($this->_table);\n\t\t\t$this->db->where(\"authcode\",$authcode);\n\t\t\t//加密手机号码\t\n\t\t\t$e_phone=sha1($phone);\t\n\t\t\n\t\t\t$this->db->where(\"phone\",$e_phone);\n\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_PHONE);\n\t\t\t$query=$this->db->get();\t\n\t\t\t$total=$query->num_rows();\n\t\t\tif($total) $gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_PHONE))>date(\"Y-m-d H:i:s\"))\n\t\t\t{\n\t\t\t\t$id=$query->row()->id;\n\t\t\t\t$user_id=$query->row()->user_id;\n\t\t\t\t//$phone=$query->row()->phone;//电话号码已加密\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\tif($verify)\n\t\t\t\t{\n\t\t\t\t\t$this->db->where('id',$id);\n\t\t\t\t\t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n\t\t\t\t\tif($this->db->affected_rows()==1) $errorcode=true;\n\t else $errorcode=false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$errorcode=true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t}\n\t\t}\n\t\treturn array('user_id'=>$user_id,'phone'=>$phone,'code_type'=>$code_type,'errorcode'=>$errorcode);\n\t}" ]
[ "0.7357168", "0.72274476", "0.72213393", "0.69830644", "0.69380236", "0.6888172", "0.67501175", "0.6735601", "0.6733808", "0.67028695", "0.66032106", "0.6547012", "0.64602464", "0.6446105", "0.64100087", "0.6404664", "0.63921386", "0.6387383", "0.63602126", "0.6347601", "0.6346381", "0.62714833", "0.62711257", "0.6254057", "0.62463534", "0.62413913", "0.6182826", "0.61683506", "0.61650926", "0.6152499", "0.6151285", "0.612313", "0.61180407", "0.6114974", "0.61120814", "0.6093692", "0.60819614", "0.60750973", "0.6064225", "0.6043378", "0.604332", "0.6036589", "0.6027322", "0.6020244", "0.6017954", "0.60108477", "0.600465", "0.599542", "0.5982485", "0.5972967", "0.59636545", "0.5960658", "0.5957118", "0.5957043", "0.59384483", "0.5933408", "0.5931214", "0.59307885", "0.5916623", "0.5914832", "0.5904086", "0.59015536", "0.5898332", "0.58948225", "0.58939016", "0.5889955", "0.58786684", "0.5876008", "0.5872554", "0.5857084", "0.5849043", "0.58430934", "0.5842667", "0.58387595", "0.58284485", "0.5826152", "0.5815074", "0.58109057", "0.58104885", "0.5808415", "0.5799023", "0.579709", "0.5792972", "0.5789676", "0.57874876", "0.57872874", "0.5780608", "0.5774696", "0.5766793", "0.5761934", "0.5758719", "0.5757171", "0.5754404", "0.5748359", "0.574635", "0.57448107", "0.57214767", "0.5717529", "0.5714054", "0.5711816" ]
0.7359493
0
/desc:verify phone /input:arg(authcode,verify(1verified,2not verified)) /output:return(user_id,phone,code_type,errorcode(1success,0failed))
function verify_authcode_phone($authcode,$phone,$verify=true) { $user_id=$code_type=0; if($this->_redis) { $data=$this->cache->get($authcode.'_'.sha1($phone)); if(!empty($data)) { $data=json_decode($data); $user_id=$data->user_id; $code_type=$data->code_type; if($verify) $this->cache->delete($authcode.'_'.sha1($phone)); $errorcode=true; } else { $errorcode=false; log_message('error_tizi','17051:phone verify code failed',array('phone'=>$phone)); } } else { $this->db->select("id,user_id,phone,code_type,generate_time"); $this->db->from($this->_table); $this->db->where("authcode",$authcode); //加密手机号码 $e_phone=sha1($phone); $this->db->where("phone",$e_phone); $this->db->where("has_verified",0); $this->db->where("type",Constant::VERIFY_TYPE_PHONE); $query=$this->db->get(); $total=$query->num_rows(); if($total) $gen_time=$query->row()->generate_time; if($total==1&&date("Y-m-d H:i:s",strtotime($gen_time." + ".Constant::AUTHCODE_EXPIRE_PHONE))>date("Y-m-d H:i:s")) { $id=$query->row()->id; $user_id=$query->row()->user_id; //$phone=$query->row()->phone;//电话号码已加密 $code_type=$query->row()->code_type; if($verify) { $this->db->where('id',$id); $this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date("Y-m-d H:i:s"))); if($this->db->affected_rows()==1) $errorcode=true; else $errorcode=false; } else { $errorcode=true; } } else { $errorcode=false; } } return array('user_id'=>$user_id,'phone'=>$phone,'code_type'=>$code_type,'errorcode'=>$errorcode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check_authcode_phone($phone,$code_type,$user_id=\"\")\n {\n\t\tif($phone)\n\t\t{\n\t\t\tif($this->_redis)\n\t\t\t{\n\n\t\t\t\t$errorcode=$this->check_auth('phone',sha1($phone));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->select(\"id\");\n\t\t\t\t$this->db->from($this->_table);\n\t\t\t\t$this->db->where(\"phone\",sha1($phone));//需要通过服务获得加密后的电话号码\n\t\t\t\t$this->db->where(\"code_type\",$code_type);\n\t\t\t\t$this->db->where(\"has_verified\",0);\n\t\t\t\t$this->db->where(\"generate_time >\",date(\"Y-m-d H:i:s\",strtotime(date(\"Y-m-d H:i:s\").\" - \".Constant::SEND_AUTHCODE_INTERVAL_PHONE)));\n\t\t\t\t$query=$this->db->get();\n\t\t\t\t$total=$query->num_rows();\n\t\t\t\tif($total>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errorcode=true;\n\t\t}\n\t\treturn array(\"errorcode\"=>$errorcode);\t\n }", "function verify_telephone()\n\t{\n\t\tlog_message('debug', 'Account/verify_telephone');\n\t\t$data = filter_forwarded_data($this);\n\t\tlog_message('debug', 'Account/verify_telephone:: [1] post='.json_encode($_POST));\n\n\t\tif(!empty($_POST)){\n\t\t\t$result = FALSE;\n\t\t\t$data['msg'] = '';\n\t\t\t$data['hasPosted'] = 'Y';\n\n\t\t\t# a) Is user updating their phone details?\n\t\t\tif(!empty($_POST['telephone'])){\n\t\t\t\t# Add or update phone and send verification code\n\t\t\t\t$response = $this->_api->post('user/telephone', array(\n\t\t\t\t\t'telephone'=>$_POST['telephone'],\n\t\t\t\t\t'provider'=>$_POST['provider__provider'],\n\t\t\t\t\t'isPrimary'=>'Y'\n\t\t\t\t));\n\n\t\t\t\t# Update the user telephone and provider if sucessful\n\t\t\t\tif(!empty($response['result']) && $response['result']=='SUCCESS'){\n\t\t\t\t\t$data['msg'] .= $this->native_session->get('__telephone') != $_POST['telephone']? 'Your phone number has been updated and a': 'A';\n\t\t\t\t\t$data['msg'] .= ' code has been sent for verification';\n\t\t\t\t\t$this->native_session->set('__telephone', $_POST['telephone']);\n\t\t\t\t\t$this->native_session->set('__provider', $response['provider']);\n\t\t\t\t\t$this->native_session->set('__provider_id', $_POST['provider__provider']);\n\t\t\t\t\t$result = TRUE;\n\t\t\t\t\t$data['area'] = 'verify_code_form';\n\t\t\t\t}\n\t\t\t\telse $data['msg'] .= 'ERROR: Your phone number could not be updated or code sent.';\n\t\t\t}\n\n\t\t\t# b) Verify telephone code\n\t\t\telse if(!empty($_POST['usercode'])){\n\t\t\t\t$response = $this->_api->post('account/verify', array(\n\t\t\t\t\t'code'=>$_POST['usercode'],\n\t\t\t\t\t'telephone'=>$this->native_session->get('__telephone'),\n\t\t\t\t\t'baseLink'=>base_url()\n\t\t\t\t));\n\n\t\t\t\tif(!empty($response['verified']) && $response['verified']=='Y'){\n\t\t\t\t\t$this->native_session->set('__telephone_verified', 'Y');\n\t\t\t\t\t$data['msg'] = '20 Points have been added to your Clout Score';\n\t\t\t\t\t$data['area'] = 'verify_code_results';\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$data['msg'] = 'ERROR: Your phone could not be verified.<br>Please try again.';\n\t\t\t\t\t$data['area'] = 'verify_code_form';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$data['area'] = !empty($data['area'])? $data['area']: 'user_phone_details';\n\t\t$this->load->view('account/verify_phone', $data);\n\t}", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = $_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\n\t\t\t// Refferal amount\n\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t//-----------------/////\n\n\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\tif (!empty($records)) {\n\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount = $records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic = $records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) {\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n\t\t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$img = self_img_url . $user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$img = '';\n\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif ($status == '1') {\n\t\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\t\texit();\n\t\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status'] = 1;\n\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data);\n\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\t\t\t\tif (!empty($reffer_records)) {\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\n\t\t\t\t\t\t$data12['reffer_user_id'] = $user11_id;\n\t\t\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('user', 'user_id', $user_id, $data12);\n\n\t\t\t\t\t}\n\t\t\t\t\t/*\n\t\t\t\t\t if(!empty($reffer_records)){\n\t\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t\t $refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t $user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t $reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t $wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t $frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t $current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t $transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t $wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t $refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t $wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t $wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t if($reffer_code == $reffer_code_database){\n\n\t\t\t\t\t $add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\n\t\t\t\t\t $add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t $data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t $update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\n\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t\t\t */\n\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'], 'user_id' => $user_id, 'user_wallet' => $wallet_amount, 'user_email' => $user_email, 'login_type' => 1, 'user_reffer_code' => $user_self_reffer, 'profile_pic' => $img, 'user_pin_status' => '2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\", 'user_mobile_no' => $_POST['user_mobile_no'], 'verification_code' => $_POST['user_verification_code']);\n\t\t\techo $this -> json($error);\n\t\t}\n\t}", "function verification() {\n\t\t$reffer_code = $_REQUEST['user_reffer_code'];\n\t\t$code = $_REQUEST['user_verification_code'];\n\t\t$mobile = country_code.$_REQUEST['user_mobile_no'];\n\t\t//$token = $_POST['token'];\n\t\tif (!empty($code)) {\n\t\t\t\n\t\t\t\t// Refferal amount\n\t\t\t\t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t//-----------------/////\n\t\t\t\n\t\t\t\t$records = $this -> conn -> get_table_row_byidvalue('user', 'user_contact_no', $mobile);\n\t\t\t\tif (!empty($records)) {\n\t\t\t\t\n\t\t\t\t$user_id = $records['0']['user_id'];\n\t\t\t\t$token = $records['0']['user_verified_code'];\n\t\t\t\t$status = $records['0']['user_mobile_verify_status'];\n\t\t\t\t$user_email = $records['0']['user_email'];\n\t\t\t\t$user_self_reffer = $records['0']['user_refferal_code'];\n\t\t\t\t$wallet_amount=$records[0]['wallet_amount'];\n\t\t\t\t$user_profile_pic=$records[0]['user_profile_pic'];\n\t\t\t\tif (!empty($user_profile_pic)) \t{\n\t\t\t\t\tif (filter_var($user_profile_pic, FILTER_VALIDATE_URL)) {\n \t\t\t\t\t$img = $user_profile_pic;\n\t\t\t\t\t} else {\n \t\t\t\t\t$img = self_img_url.$user_profile_pic;\n\t\t\t\t\t}\n\t\t\t\t\t} else \t{\n\t\t\t\t\t$img = '';\t\n\t\t\t\t\t}\n\t\t\t\tif ($code != $token) {\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Invalid Varification code');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t} else if ($code == $token) {\n\t\t\t\t\tif($status=='1'){\n\t\t\t\t\t$post = array('status' => 'false', 'message' => 'Already verified');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t\texit();\n\t\t\t\t}\n\t\t\t\t\t$data['user_mobile_verify_status']=1;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data);\n\t\t\t\t\t\n\t\t\t\t\t//check reffer code\n\t\t\t\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code',$reffer_code);\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t$data12['reffer_user_id']=$user11_id;\n\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user_id, $data12);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\tif(!empty($reffer_records)){\n\t\t\t\t * \t$reffer_records = $this -> conn -> get_all_records('reffer_amount');\n\t\t\t\t$refferal_amount = $reffer_records[0]['reffer_amount'];\n\t\t\t\t\t\t\t\t\t\t$user11_id = $reffer_records['0']['user_id'];\n\t\t\t\t\t\t\t\t\t\t$reffer_code_database = $reffer_records['0']['user_refferal_code'];\n\t\t\t\t\t\t\t\t\t\t\t$wallet = $reffer_records['0']['wallet_amount'];\n\t\t\t\t\t\t\t\t\t\t\t$frnd_number = $reffer_records['0']['user_contact_no'];\n\t\t\t\t\t\t\t\t\t\t\t$current_date=date(\"Y-m-d h:i:sa\");\n\t\t\t\t\t\t\t\t\t\t\t$transaction_id= strtotime(\"now\").mt_rand(10000000, 99999999);\n\t\t\t\t\t\t\t\t\t\t\t$wt_type=2; // credit in frnd acconnt\n\t\t\t\t\t\t\t\t\t\t\t$refferamount=$refferal_amount; // reffer amount\n\t\t\t\t\t\t\t\t\t\t\t$wt_category=9; // refferal amount recieved in wallet\n\t\t\t\t\t\t\t\t\t\t\t$wt_desc=\"Refferal amount add in your wallet using by \".substr($mobile,4);\n\t\t\t\t\t\t\t\t\t\tif($reffer_code == $reffer_code_database){\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t$add_reffer_money = $this -> conn -> insertnewrecords('refferal_records','refferal_user_id,refferal_frnd_id,refferal_amount,refferal_date', '\"' . $user_id . '\",\"' . $user11_id . '\",\"' . $refferamount . '\",\"' . $current_date . '\"');\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t$add_money = $this -> conn -> insertnewrecords('wallet_transaction','wt_user_id, wt_datetime,wt_type,wt_amount,wt_category,transaction_id,wt_desc,cashbackrecord_id', '\"' . $user11_id . '\",\"' . $current_date . '\",\"' . $wt_type . '\",\"' . $refferamount . '\",\"' . $wt_category . '\",\"' . $transaction_id . '\",\"' . $wt_desc . '\",\"' . $frnd_number . '\"');\n\t\t\t\t\t\t\t\t\t\t\t$data12['reffer_amount_status']=$wallet+$refferal_amount;\n\t\t\t\t\t\t\t\t\t$update_toekn=$this -> conn -> updatetablebyid('user', 'user_id',$user11_id, $data12);\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\t\t\n\t\t\t\t\t\n\t\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Successfully verified\", \"mobile\" => $_REQUEST['user_mobile_no'],'user_id'=>$user_id,'user_wallet'=>$wallet_amount,'user_email'=>$user_email,'login_type'=>1,'user_reffer_code'=>$user_self_reffer,'profile_pic'=>$img,'user_pin_status'=>'2');\n\t\t\t\t\techo $this -> json($post);\n\t\t\t\t}\n\n\t\t\t}else{\n\t\t\t\t$error = array('status' => \"false\", \"message\" => \"User not Exist\");\n\t\t\t\techo $this -> json($error);\n\t\t\t}\n\t\t} else {\n\t\t\t$error = array('status' => \"false\", \"message\" => \"Please Enter a valid verification code\" ,'user_mobile_no' => $_POST['user_mobile_no'],'verification_code'=>$_POST['user_verification_code']);\n\t\techo $this -> json($error);\n\t\t}\n\t}", "private static function verify() {\r\n\t\t// create code object for the given code we will be verifying\r\n\t\tif (!isset($_SESSION['user'])) {\r\n\t\t\tself::alertMessage('danger', 'Unable to find session user data. Try logging out and logging in again.');\r\n\t\t\tVerificationView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t$userID = $_POST['userID'] = $_SESSION['user']->getUserID();\r\n\t\t$code = new VerificationCode($_POST);\r\n\r\n\t\t// load and validate expected code from database\r\n\t\t$codeInDatabase = VerificationCodesDB::get($userID);\r\n\t\tif (is_null($codeInDatabase)) {\r\n\t\t\tself::alertMessage('danger', 'No active verification code found. Your code may have expired. Click \"Resend Code\" to send a new code to your phone.');\r\n\t\t\tVerificationView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// compare given/expected codes\r\n\t\tif ($code->getCode() !== $codeInDatabase->getCode()) {\r\n\t\t\tself::alertMessage('danger', 'The code you entered is incorrect. Please check your code and try again.');\r\n\t\t\tVerificationView::show();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// verification successful. mark phone number as verified\r\n\t\t$user = UsersDB::getUser($userID);\r\n\t\t$user->setIsPhoneVerified(true);\r\n\t\tUsersDB::edit($user);\r\n\t\t$_SESSION['user'] = $user;\r\n\r\n\t\t// clean up and show dashboard\r\n\t\tVerificationCodesDB::clear($userID);\r\n\t\tDashboardView::show();\r\n\t}", "function actiongetVerifyCode()\n\t{\n\t\t$jsonarray= array();\n\t\t\n\t\tif(isset($_POST['phone']))\n\t\t{\n\t\t\t$userObj=new Users();\n\t\t\tif(!is_numeric($_POST['phone'])){\n\t\t\t\t$algoencryptionObj\t=\tnew Algoencryption();\n\t\t\t\t$_POST['phone']\t=\t$algoencryptionObj->decrypt($_POST['phone']);\n\t\t\t}\n\t\t\t$result=$userObj->getVerifyCodeById($_POST['phone'],'-1');\n\t\t\t$jsonarray['status']=$result['status'];\n\t\t\t$jsonarray['message']=$result['message'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$message=$this->msg['ONLY_PHONE_VALIDATE'];\n\t\t\t$jsonarray['status']='false';\n\t\t\t$jsonarray['message']=$message;\n\t\t}\n\t\techo $jsonarray['message'];\n\t}", "function verifyNumber($phone_number){\n require 'Config.php';\n\n // Initialize CURL:\n $ch = curl_init('http://apilayer.net/api/validate?access_key='.$numverify_access_key.'&number='.$phone_number.'');\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\n // Store the data:\n $json = curl_exec($ch);\n curl_close($ch);\n\n // Decode JSON response:\n $validationResult = json_decode($json, true);\n\n // Access and use your preferred validation result objects\n return $validationResult;\n }", "function verify_mobile_number() {\n\n\t\t//$iAccountNo = safeText('account_no', FALSE, 'get');\n\n\t\t$this->authentication->is_user_logged_in(TRUE, 'user/login');\n\n\t\t$this->mcontents['iAccountNo'] = s('ACCOUNT_NO');\n\n\n\t\t$aWhere = array(\n\t\t\t\t\t\t'status' => $this->aUserStatus['active'],\n\t\t\t\t\t);\n\t\tif( ! $oUser = $this->user_model->getUserBy('account_no', $this->mcontents['iAccountNo'], 'basic', $aWhere) ) {\n\t\t\t/*\n\t\t\tp($this->mcontents['iAccountNo']);\n\t\t\tp($oUser);\n\t\t\texit;\n\t\t\t*/\n\t\t\tsf('error_message', 'You cannot access this section right now');\n\t\t\tredirect('home');\n\t\t}\n\n\n\t\t/* Temporary set up to skip mobile number verification step */\n\t\t\t$bSkipMobileNumberVerification = FALSE;\n\n\t\t\tif($bSkipMobileNumberVerification) {\n\t\t\t\t$this->user_model->skipMobileNumberVerification($oUser->account_no);\n\t\t\t}\n\t\t/* Temporary set up to skip mobile number verification step - End */\n\n\n\n\t\t$bIsAccountAwaitingMobileNumVerification = $this->user_model->isAccountAwaitingMobileNumVerification( $oUser->account_no );\n\t\t//$bIsAccountAwaitingMobileNumVerification = TRUE; // to be removed if not useful\n\n\n\t\tif( ! $oUser ) {\n\n\t\t\tsf('error_message', 'The link you are trying to access does not exist.');\n\t\t\tredirect('home');\n\t\t}\n\t\tif( ! $bIsAccountAwaitingMobileNumVerification ) {\n\n\t\t\t//sf('error_message', 'The link you are trying to access does not exist.');\n\t\t\tredirect('user/manage_mobile_number');\n\t\t}\n\n\n\n\t\tif( isset($_POST) && !empty($_POST) ) {\n\n\t\t\t$this->form_validation->set_rules('verification_code', 'Verification code', 'trim|required');\n\n\t\t\tif ($this->form_validation->run() == TRUE) {\n\n\t\t\t\t$sToken = safeText('verification_code');\n\n\t\t\t\t$aTokenResult = $this->common_model->isValidToken_new($sToken, 'mobile_number_verification', $oUser->account_no);\n\n\t\t\t\t$aTokenStatus = c('token_status');\n\n\t\t\t\tif( $aTokenResult['status'] != $aTokenStatus['valid'] ) {\n\n\t\t\t\t\t//find the reason why this token is not valid\n\t\t\t\t\tif( $aTokenResult['status'] == $aTokenStatus['invalid'] ) {\n\n\t\t\t\t\t\t$iAttempts = 0;\n\t\t\t\t\t\t$iMaxAttempts = 3;\n\n\t\t\t\t\t\tif($iAttempts >= $iMaxAttempts) {\n\n\t\t\t\t\t\t\t$this->user_model->unsetMobileNumVerificationCode($aTokenResult['oToken']);\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t$this->merror['error'][] = 'the code entered is invalid code.';\n\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t} elseif($aTokenResult['status'] == $aTokenStatus['expired']) {\n\n\t\t\t\t\t\t$this->user_model->unsetMobileNumVerificationCode($aTokenResult['oToken']);\n\n\t\t\t\t\t\tsf('error_message', 'The token you entered has expired.');\n\t\t\t\t\t\tredirect('user/verify_mobile_number');\n\t\t\t\t\t}\n\n\n\t\t\t\t} else {\n\n\t\t\t\t\t$this->user_model->unsetMobileNumVerificationCode($aTokenResult['oToken']);\n\n\n\t\t\t\t\t$aUserMobileVerificationStatus = $this->config->item('user_mobile_verification_status');\n\n\t\t\t\t\t// set the mobile number as verified\n\t\t\t\t\t$this->db->set('mobile_verification_status', $aUserMobileVerificationStatus['sms_verified']);\n\t\t\t\t\t$this->db->where('account_no', $oUser->account_no);\n\t\t\t\t\t$this->db->update('users');\n\n\t\t\t\t\tsf('success_message', 'Your mobile number has been verified');\n\n\t\t\t\t\t// do the initial setup routines check to see if the user passes it.\n\t\t\t\t\t$this->user_model->initialSetupRoutines($oUser->account_no);\n\n\t\t\t\t\tredirect('profile/edit');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tloadTemplate('user/verify_mobile_number');\n\t}", "function generate_authcode_phone($phone,$code_type=0,$user_id=\"\",$user_type=Constant::USER_TYPE_TEACHER)\n\t{\n\t\t$authcode=\"\";\n\t\t$errorcode=$this->check_authcode_phone($phone,$code_type);\n if(!$errorcode['errorcode'])\n {\n\t\t\t$authcode=random_string('nozero',6);\n $data=$this->bind_verify($user_id,\"\",$phone,2,$code_type,$authcode,$user_type);\n\t\t\tif($this->_redis)\n {\n $errorcode=$this->cache->save($authcode.'_'.sha1($phone),json_encode($data),Constant::AUTHCODE_REDIS_EXPIRE_PHONE);\n\t\t\t\t$this->save_check('phone',sha1($phone),$authcode,Constant::SEND_REDIS_AUTHCODE_INTERVAL_PHONE);\n }\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->db->insert($this->_table,$data);\n\t\t\t\t$insert_id=$this->db->insert_id();\n\t\t\t\tif($insert_id>0) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n\t\t\t}\n\t\t\tlog_message('trace_tizi','170019:Gen phone auth code',array('phone'=>$phone));\n\t\t\tif(!$errorcode) log_message('error_tizi','17019:Gen phone auth code failed',array('phone'=>$phone));\n\t\t}\n else\n {\n $errorcode=false;\n }\n return array('authcode'=>$authcode,'errorcode'=>$errorcode);\n\t}", "static function verifyMobile($usr,$code){\r\n\t\t$usr = funcs::check_input($usr);\r\n\t\t$code = funcs::check_input($code);\r\n\r\n\t\t$expired_time = 7*24*60*60;\r\n\t\tif(strlen(trim($usr)) > 0)\r\n\t\t{\r\n\t\t\t$usrId = funcs::getUserid(htmlspecialchars($usr,ENT_QUOTES,'UTF-8'));\r\n\t\t\tif(ctype_digit($usrId) && strlen(trim($code)) > 0)\r\n\t\t\t{\r\n\t\t\t\t$chk = DBConnect::assoc_query_1D(\"SELECT vcode_mobile,waitver_mobileno,vcode_mobile_insert_time FROM \".TABLE_MEMBER.\" WHERE id=\".$usrId);\r\n\t\t\t\tif(strlen(trim($chk['waitver_mobileno'])) > 0 && strlen(trim($chk['vcode_mobile'])) > 0 && $chk['vcode_mobile'] == $code)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(time() <= ((int)$chk['vcode_mobile_insert_time']+$expired_time))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$query = \"UPDATE \".TABLE_MEMBER.\" SET validated='1',mobileno='\".$chk['waitver_mobileno'].\"',waitver_mobileno='' WHERE id=\".$usrId;\r\n\t\t\t\t\t\tDBconnect::execute_q($query);\r\n\t\t\t\t\t\t$_SESSION['MOBILE_VERIFIED'] = 1;\r\n\r\n\t\t\t\t\t\tif(COIN_VERIFY_MOBILE > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$username = funcs::findUserName($usrId);\r\n\t\t\t\t\t\t\t$coinVal = funcs::checkCoin($username);\r\n\r\n\t\t\t\t\t\t\tDBconnect::execute_q(\"UPDATE \".TABLE_MEMBER.\" SET coin=coin+\".COIN_VERIFY_MOBILE.\" WHERE id=\".$usrId);\r\n\t\t\t\t\t\t\t$sqlAddCoinLog = \"INSERT INTO coin_log (member_id, send_to, coin_field, coin, coin_remain, log_date) VALUES ('1','$usrId','Mobile Verify','\".COIN_VERIFY_MOBILE.\"',\".$coinVal.\", NOW())\";\r\n\t\t\t\t\t\t\tDBconnect::execute($sqlAddCoinLog);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\treturn 4;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\treturn 3;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\treturn 2;\r\n\t\t\t}\r\n\t\t\tunset($usrId);\r\n\t\t}\r\n\t}", "public function hasVerifiedPhone();", "public function phoneVerify(Request $req) {\n\n $param = $this->createRand(4);\n $url = \"https://open.ucpaas.com/ol/sms/sendsms\";\n $body_json = array(\n \"sid\" => \"1cea456798e180e58fe1e96e9ef9a1e2\",\n \"token\" => \"2fe296ae9fb014aa261b93652375ad0b\",\n \"appid\" => \"c3f231b11343405bb2a8956b2609205f\",\n \"templateid\" => \"430629\",\n \"param\" => $param,\n \"mobile\" => $req->get('mobile')\n );\n $body = json_encode($body_json);\n $data = $this->getResult($url, $body,'post');\n //return $data;\n $obj = json_decode($data);\n if ($obj->code == \"000000\"){\n return $param;\n }\n return \"0000\";\n }", "public function verify_phone_number()\n\t{\n\t\t$user_id = Input::get('userId');\n\t\t$verification_code = Input::get('verificationCode');\n\n\t\tif ($this->notifyRepo->smsVerificationCheck($user_id, $verification_code))\n\t\t{\n\t\t\t$this->notifyRepo->smsSaveVerifiedPhoneNumber($user_id);\n\t\t\t$this->notifyRepo->smsDeleteVerifyRecord($user_id);\n\t\t\t$valid = [\n\t\t\t\t'status' => true,\n\t\t\t\t'message' => 'Your phone number has been verified.'\n\t\t\t];\n\t\t\treturn $valid;\n\t\t}\n\n\t\t$valid = [\n\t\t\t'status' => false,\n\t\t\t'message' => 'The code you entered does not match the code we sent you.'\n\t\t];\n\t\treturn $valid;\n\t}", "public function verifyCode(CodeRequest $request )\n\t{\n\t\tif(!is_numeric($request->input('code'))){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\n\t\t$querry = \"SELECT * FROM \". DBTool::rawTable('users') . \" WHERE phone_token = '\" . $request->input('code') . \"' AND phone = '\" . $request->input('phone') . \"'\";\n\t\t$user = DB::select(DB::raw($querry));\n\n\t\t$user = ArrayHelper::fromObject($user);\n\n\t\t//if user enter wrong code\n\t\tif(!isset($user[0]['id']) && !isset($user[0]['phone']) ){\n\t\t\t$invalidMessage = t(\"You enter invalid code.\");\n\t\t\tflash($invalidMessage)->error();\n\t\t\treturn redirect(\"/register\");\n\t\t}\n\t\t// SET THE CODE IS VERIFIED\n\t\t$querry = \"UPDATE \". DBTool::rawTable('users') . \" SET verified_phone = 1 WHERE id = '\" . $user[0]['id'] . \"'\";\n\t\t$updated = DB::update(DB::raw($querry));\n\t\t$updated = ArrayHelper::fromObject($updated);\n\n\t\t// Redirection\n\t\t// return $this->lastRecords($user[0]['phone']);\n\t\treturn redirect( '/end/registration/' . $user[0]['phone'] );\n\t}", "public function send_verify_code_to_phone(Request $request)\n {\n $phone = $request->input('phone_number');\n $code = $this->generate_verify_code();\n //todo: save verify code to this wxuser\n\n $wxuser_id = session('wechat_user_id');\n $wxuser = WechatUser::find($wxuser_id);\n $wxuser->phone_verify_code = $code;\n $wxuser->save();\n\n return response()->json(['status' => 'success']);\n\n }", "public function check() : int\n {\n\n /**\n * @return invalid request(1) if a code is empty ,null or undefined,\n * if not continue the next execution\n */\n\n if(!$this->code) return INVALID_REQUEST;\n\n\n /** @var $is_valid check the specified code is equal and valid */\n\n $is_valid = database::getInstance()->has('user',[\n\n \"id\" => (new Users())->get_id(),\n\n \"verification_code\" => $this->code\n\n ]);\n\n /** validation */\n\n if($is_valid) {\n\n /** @var $success if a specified code is valid\n * update the current status of \"isVerify\" attribute of a database\n * to PHONE_NUMBER_VERIFIED(1) and\n * @return the number of affected rows\n */\n\n $success = database::getInstance()->update('user',['isVerify'=>user_type::PHONE_NUMBER_VERIFIED],[\n\n \"id\"=> (new Users())->get_id()\n\n ])->rowCount();\n\n /** if has a affeted rows return valid request(2), invalid request if not */\n\n return $success ? VALID_REQUEST : INVALID_REQUEST;\n\n }\n\n\n /** return invalid request(1) if a code is not equal */\n\n return INVALID_REQUEST;\n\n\n\n }", "static function checkMobileVerify($username, $password = null, $code = null)\r\n\t{\r\n\t\t$username = funcs::check_input($username);\r\n\r\n\t\tif($password != null && $code != null)\r\n\t\t{\r\n\t\t\t$password = funcs::check_input($password);\r\n\t\t\t$code = funcs::check_input($code);\r\n\t\t\t$no = DBconnect::retrieve_value(\"SELECT waitver_mobileno\r\n\t\t\t\t\t\t\t\t\t\t\t FROM \".TABLE_MEMBER.\"\r\n\t\t\t\t\t\t\t\t\t\t\t WHERE \".TABLE_MEMBER_USERNAME.\"='\".htmlspecialchars($username,ENT_QUOTES,'UTF-8').\"'\r\n\t\t\t\t\t\t\t\t\t\t\t AND \".TABLE_MEMBER_PASSWORD.\"='\".$password.\"'\r\n\t\t\t\t\t\t\t\t\t\t\t AND \".TABLE_MEMBER_VALIDATION.\"='\".$code.\"' \");\r\n\t\t}\r\n\t\telse\r\n\t\t\t$no = DBconnect::retrieve_value(\"SELECT waitver_mobileno FROM \".TABLE_MEMBER.\" WHERE \".TABLE_MEMBER_USERNAME.\"='\".htmlspecialchars($username,ENT_QUOTES,'UTF-8').\"'\");\r\n\r\n\t\treturn $no;\r\n\t}", "public function send_sms_verification_code()\n\t{\n\t\t$user_id = Input::get('userId');\n\t\t$phone_number = Input::get('phoneNumber');\n\n\t\t// check if a verify record already exists\n\t\t$verify_record = $this->notifyRepo->smsVerificationCodeByUserId($user_id);\n\n\t\t// create the code, save it, send to user\n\t\t$verify_record = $this->notifyRepo->smsSendVerifyCode($user_id, $phone_number, $verify_record);\n\n\t\t$result = Twilio::message('+'.$phone_number, 'EriePaJobs - Your verification code is '.$verify_record->verification_code);\n\t}", "public function sendPhoneVerificationNotification();", "function check_verify($code, $id = ''){\n $verify = new \\Think\\Verify();\n return $verify->check($code, $id);\n}", "function is_phone_stored($phoneNumber){\n $data = array(\"phone\"=>$phoneNumber);\n $status = CallAPI(\"ussd.myfarmnow.com/api/verifyphone\", $data);\n if($status == 1){\n return true;\n }elseif($status == 0){\n return false;\n }\n}", "public function verify(){\n\t\t// getting the username and code from url\n\t\t$code=$_GET['c'];\n\t\t$user=$_GET['u'];\n\t\t// load the regmod model\n\t\t$this->load->model('regmod');\n\t\t// calling the function Vemail that check the valodation code with the username\n\t\t$flag=$this->regmod->Vemail($user,$code);\n\t\t// checking the Vemail the respond\n\t\tif($flag)\n\t\t\t{$data['res']= \"You have successfully verified your email. You may login to Hungry.lk with your username and password\";}\n\t\telse\n\t\t\t{$data['res']= \"Opps An error occurred in our system, try again later\";}\n\t\t$this->load->view(\"register_status_view\",$data);\n\t}", "public function verifyOTP(){\n\t \t\tif($this->session->userdata('otp')==$this->input->post('otp_')){\n\t \t\t\tif($this->verifyThisUser($this->input->post('mobile_no'))){\n\t \t\t\t\tdie(json_encode(array('code'=>1,'msg'=>\"Registered Successfully.\")));\n\t \t\t\t}else{\n\t \t\t\t\tdie(json_encode(array('code'=>23,'msg'=>\"Failed To Verify.\")));\n\t \t\t\t}\n\t \t\t\t\n\t \t\t}else{\n\t \t\t\tdie(json_encode(array('code'=>0,'msg'=>\"Failed to register\")));\n\t \t\t}\n\t \t}", "public function verify()\n {\n $phone = $this->input->get('phone');\n $token = $this->input->get('token');\n\n if ($phone != $this->session->userdata('phone')) {\n $this->session->set_flashdata('message', 'checkin-error');\n redirect('visitor');\n } else {\n $user = $this->m_visitor->get_user('sms_verify', 'phone', $phone);\n if ($user) {\n $token_ = $this->m_visitor->get_user('sms_verify', 'token', $token);\n if ($token_) {\n $data = [\n 'phone' => $phone,\n 'public_space_id' => $this->session->userdata('public_space_id')\n ];\n\n $this->m_visitor->insert('record', $data);\n $this->m_visitor->delete('sms_verify', 'phone', $phone);\n\n $this->session->set_userdata('status', 'in');\n\n $this->session->set_flashdata('message', 'checkin-success');\n redirect('visitor');\n } else {\n $this->session->set_flashdata('message', 'checkin-error');\n redirect('visitor');\n }\n } else {\n $this->session->set_flashdata('message', 'checkin-error');\n redirect('visitor');\n }\n }\n }", "public function verify_get($email=null,$verification_code=null){\n\n\t\tif(!empty($verification_code) && !empty($email)){\n\t\t\t$q = $this->db->where('email',$email)->where('verification_code',$verification_code)->update('users',array('verified'=>1));\n\t\t\tif($this->db->affected_rows()>0){\n\t\t\t\t$this->response(['Verified'], REST_Controller::HTTP_OK);\n\n\t\t\t}else{\n\t\t\t\t$this->response(['Wrong Code.'], '500');\n\t\t\t}\n\t\t}\n\n\t}", "public function markPhoneAsVerified();", "public function verify_code($params) {\n\n $verification_code = $params['verification_code'];\n $code_id = $params['code_id'];\n\n $options = array('body'=> array());\n $options['body']['code']= ['verify'=> $verification_code];\n\n $uri = $code_id.\"/verify\";\n $uri = \"/cpaas/auth/v1/\".$this->client->user_id.\"/codes/\".$uri;\n $url = $this->client->_root.$uri;\n $response = $this->client->_request(\"PUT\", $url, $options);\n\n // check if test response\n if ($this->client->check_if_test($response)) {\n return $response;\n }\n // check if error response\n // if ($this->client->check_if_error($response)) {\n // $response = $this->client->build_error_response($response);\n // return $response;\n // }\n\n if ($response->getStatusCode() == 204) {\n $custom_response = ['verified'=> true, 'message'=> 'Success'];\n } else {\n $custom_response = ['verified'=> false, 'message'=> 'Code invalid or expired'];\n }\n\n return $custom_response;\n }", "public function getTwoStepVerificationCode();", "function check_verify($code, $id = 1){\n $verify = new \\Think\\Verify();\n return $verify->check($code, $id);\n}", "public function verify_otp_get($email=null,$otp=null){\n\t\tif(!empty($email) && !empty($otp)){\n\t\t\t$q = $this->db->where('email',$email)->where('verification_code',$otp)->get('users')->result();\n\t\t\tif(count($q)>0){\n\t\t\t\t$this->response(['Correct'], REST_Controller::HTTP_OK);\n\t\t\t}else{\n\t\t\t\t$this->response(['Invaild Email or OTP.'], '500');\n\t\t\t}\n\t\t}else{\n\t\t\t$this->response(['Too few arguments'], '500');\n\t\t}\n\t}", "public function verifyCode($mobile_number, User $user, $code)\n {\n //Get the latest non-verified mobile verification request for that mobile number\n $mobileVerification = MobileVerification::getLatestVerification($mobile_number, $user);\n\n //If none was found, return false\n if(is_null($mobileVerification))\n {\n return Response::json(['success' => false, 'error' => \"Invalid verification request. Please submit a new one\"], 500);\n }\n\n //If the code is a match, update the verification request timestamp and return true\n $response = $this->smsProvider->checkVerificationCode($code, $mobileVerification);\n if(!key_exists('error', $response))\n {\n $verified_at = Carbon::now();\n $mobileVerification->verified_at = $verified_at;\n $mobileVerification->save();\n\n $user->mobile_number_verified_at = $verified_at;\n $user->save();\n return Response::json($response, 200);\n }\n\n return Response::json($response, 500);\n }", "function verify($email,$code)\n {\n $sql = \"SELECT id\n FROM\n user\n WHERE\n verification = '$code'\n AND\n email='$email'\n \";\n $query = $this->db->query($sql);\n if($query->num_rows()>0)\n {\n $row = $query->row();\n $update['verification'] = 'done';\n $update['status'] = 1;\n $this->db->where('id', $row->id);\n $this->db->update('user', $update);\n return $row->id;\n }\n }", "public function Mobile_check($phone_no)\n\t{\n\t\t$sql = \"SELECT * FROM login_users WHERE phone_no ='\".$phone_no.\"' AND user_type = '4' AND status='Active'\";\n\t\t$user_result = $this->db->query($sql);\n\t\t$ress = $user_result->result();\n\n\t\t$digits = 4;\n\t\t$OTP = str_pad(rand(0, pow(10, $digits)-1), $digits, '0', STR_PAD_LEFT);\n\n\t\tif($user_result->num_rows()>0)\n\t\t{\n\t\t\tforeach ($user_result->result() as $rows)\n\t\t\t{\n\t\t\t\t $user_master_id = $rows->id;\n\t\t\t}\n\n\t\t\t$update_sql = \"UPDATE login_users SET otp = '\".$OTP.\"', updated_at=NOW() WHERE id ='\".$user_master_id.\"'\";\n\t\t\t$update_result = $this->db->query($update_sql);\n\n\t\t\t$message_details = \"Dear Customer your OTP :\".$OTP;\n\t\t\t$this->sendSMS($phone_no,$message_details);\n\t\t\t$response = array(\"status\" => \"success\", \"msg\" => \"Mobile OTP\", \"user_master_id\"=>$user_master_id, \"phone_no\"=>$phone_no, \"otp\"=>$OTP);\n\n\t\t} else {\n\t\t\t $response = array(\"status\" => \"error\", \"msg\" => \"Invalid login\");\n\t\t}\n\n\t\treturn $response;\n\t}", "function update_user_phone()\n\t{\n\t\tlog_message('debug', 'Account/update_user_phone');\n\t\tcheck_access($this,'__redirect'); #redirect away from this function if user is not logged in\n\n\t\t$data = filter_forwarded_data($this);\n\t\t$result = FALSE;\n\t\t$data['msg'] = '';\n\t\tlog_message('debug', 'Account/update_user_phone:: [1] post='.json_encode($_POST));\n\t\tlog_message('debug', 'Account/update_user_phone:: [2] data='.json_encode($data));\n\t\t# a) The user is updating the telephone number\n\t\tif(!empty($_POST['telephone'])){\n\t\t\t$data['hasPosted'] = 'Y';\n\t\t\t$response = $this->_api->post('user/telephone', array(\n\t\t\t\t\t'telephone'=>$_POST['telephone'],\n\t\t\t\t\t'provider'=>$_POST['provider__provider'],\n\t\t\t\t\t'isPrimary'=>'Y'\n\t\t\t\t));\n\n\t\t\t# Update the user telephone and provider if sucessful\n\t\t\tif(!empty($response['result']) && $response['result']=='SUCCESS'){\n\t\t\t\t$this->native_session->set('__telephone', $_POST['telephone']);\n\t\t\t\t$this->native_session->set('__provider', $response['provider']);\n\t\t\t\t$this->native_session->set('__provider_id', $_POST['provider__provider']);\n\t\t\t\t$data['msg'] = 'Your phone number has been updated and verification code sent.';\n\t\t\t\t$result = TRUE;\n\t\t\t\t$data['area'] = 'verify_code_form';\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$data['msg'] = 'ERROR: Your phone number could not be updated';\n\t\t\t\t$data['area'] = 'user_phone_details';\n\t\t\t}\n\t\t}\n\n\n\t\t# b) Verify telephone code\n\t\telse if(!empty($_POST['usercode'])){\n\t\t\t$data['hasPosted'] = 'Y';\n\t\t\t$response = $this->_api->post('account/verify', array(\n\t\t\t\t'code'=>$_POST['usercode'],\n\t\t\t\t'telephone'=>$this->native_session->get('__telephone'),\n\t\t\t\t'baseLink'=>base_url()\n\t\t\t));\n\n\t\t\tif(!empty($response['verified']) && $response['verified']=='Y'){\n\t\t\t\t$this->native_session->set('__telephone_verified', 'Y');\n\t\t\t\t$data['msg'] = '20 Points have been added to your Clout Score';\n\t\t\t\t$data['area'] = 'verify_code_results';\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$data['msg'] = 'ERROR: Your phone could not be verified.<br>Please try again.';\n\t\t\t\t$data['area'] = 'verify_code_form';\n\t\t\t}\n\t\t}\n\n\n\t\t# c) the user has already verified their phone.\n\t\telse if($this->native_session->get('__telephone_verified') && $this->native_session->get('__telephone_verified') == 'Y'){\n\t\t\t# if this is a user with more privileges to view the network page take them to the network home instead\n\t\t\tif($this->native_session->get('__direct_invitation_count')\n\t\t\t\t&& $this->native_session->get('__direct_invitation_count') >= MINIMUM_INVITE_COUNT\n\t\t\t){\n\t\t\t\t$view = check_access($this,'can_view_invite_tools')? 'network/home': 'account/thank_you';\n\t\t\t}\n\t\t\telse $view = 'network/invite';\n\n\t\t\t# take to appropriate view\n\t\t\tredirect(base_url().$view);\n\t\t}\n\n\n\t\t# c) the user is coming to this page for first time OR they havent verified their phone yet\n\t\telse if(!(!empty($data['edit']) && $data['edit'] == 'Y') && $this->native_session->get('__telephone') && $this->native_session->get('__provider_id')\n\t\t\t&& (!$this->native_session->get('__telephone_verified') || ($this->native_session->get('__telephone_verified') && $this->native_session->get('__telephone_verified') == 'N'))\n\t\t){\n\t\t\t$response = $this->_api->post('user/telephone', array(\n\t\t\t\t\t'telephone'=>$this->native_session->get('__telephone'),\n\t\t\t\t\t'provider'=>$this->native_session->get('__provider_id'),\n\t\t\t\t\t'isPrimary'=>'Y'\n\t\t\t));\n\n\t\t\t# Prepare appropriate message\n\t\t\t$data['msg'] = (!empty($response['result']) && $response['result']=='SUCCESS')? 'A verification message has been sent to your phone. Enter the code here to confirm your phone number.': 'ERROR: A verification message could not be sent to your phone. <br>Click Resend to attempt sending it again, or Edit to change your phone details.';\n\t\t\t$result = TRUE;\n\t\t\t$data['area'] = 'verify_code_form';\n\t\t}\n\n\n\t\t# d) The user has to enter their phone details from scratch\n\t\telse $data['area'] = 'user_phone_details';\n\n\t\t$data = load_page_labels('link_card', $data);\n\t\t$this->load->view('account/verify_phone', $data);\n\t}", "public function codeVerification($phone)\n\t{\n\t\t$data = [];\n\n\t\t// References\n\t\t$data['countries'] = CountryLocalizationHelper::transAll(CountryLocalization::getCountries());\n\t\t$data['genders'] = Gender::trans()->get();\n\t\t$data['phone'] = $phone;\n\t\t// Meta Tags\n\t\tMetaTag::set('title', getMetaTag('title', 'register'));\n\t\tMetaTag::set('description', strip_tags(getMetaTag('description', 'register')));\n\t\tMetaTag::set('keywords', getMetaTag('keywords', 'register'));\n\t\t\n\t\treturn view('auth.register.indexSecond', $data);\n\t}", "public function phoneVerify(Request $request, $token)\n {\n $check = $this->verifyToken($token);\n if (!$check->status) {\n return redirect('/')->with('error', $check->message);\n }\n\n $data = $request->all();\n $verify_code = '';\n for ($i = 1; $i <= 6; $i++) {\n $verify_code .= $data['verification_code' . $i];\n }\n\n $stored_verify_code = DB::table('email_phone_verify')\n ->where('token', '=', $token)\n ->value('verify_code');\n if (empty($verify_code) or $verify_code != $stored_verify_code) {\n return redirect()->back()->withInput()->with('error', __('Invalid verification code, please check again.'));\n }\n\n $user_id = DB::table('email_phone_verify')\n ->where('token', '=', $token)\n ->value('user_id');\n\n // Update password\n $user = User::find($user_id);\n $input = [];\n $input['phone_verified_at'] = Carbon::now();\n $user->update($input);\n\n // Delete token\n DB::table('email_phone_verify')->where('token', '=', $token)->delete();\n\n return redirect()->route('home')->with('success', __('Your phone number is successfully verified.'));\n }", "public function verify();", "public function verify_otp_post(){\n $pdata = file_get_contents(\"php://input\");\n $data = json_decode($pdata,true);\n\n $required_parameter = array('otp','user_id');\n $chk_error = $this->controller->check_required_value($required_parameter, $data);\n if ($chk_error) \n {\n $resp = array('code' => 'MISSING_PARAM', 'message' => 'Missing ' . strtoupper($chk_error['param']));\n @$this->response($resp);\n }\n\n $otp = $data['otp'];\n $user_id = $data['user_id'];\n\n $where = array(\n 'user_id' => $user_id,\n 'otp' => $otp\n ); \n\n $verify = $this->model->getAllwhere('otp_master',$where);\n if(!empty($verify)){\n $update = array('is_active'=> 1);\n $this->model->updateFields('users',$update,array('id'=>$user_id));\n $this->model->delete('otp_master',array('user_id'=>$user_id));\n $resp = array(\n 'rccode' => 1,\n 'message' => 'Otp Verify Successfully', \n );\n }else{\n $resp = array(\n 'rccode' => 2,\n 'message' => 'Please Enter Valid Otp', \n );\n } \n\n $this->response($resp); \n }", "function send_authcode_phone($authcode,$phone,$code_type=0)\n\t{\n\t\t$this->load->library('sms');\n\n\t\t$msg_head=$msg_end=$lang='';\n\t\tswitch($code_type)\n\t\t{\n\t\t\tcase Constant::CODE_TYPE_REGISTER: $lang=\"verify\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PASSWORD: $lang=\"reset\";break;\n\t\t\tcase Constant::CODE_TYPE_CHANGE_PHONE: $lang=\"update_phone\";break;\n\t\t\tdefault:break;\n\t\t}\n\n\t\tif($lang)\n\t\t{\n\t\t\t$msg_head=str_replace('{phone}',substr($phone,-4),$this->lang->line('phone_body_'.$lang));\n\t\t\t$msg_end=$this->lang->line('phone_end_'.$lang);\t\t\t\n\t\t}\n\t\t$msg=$msg_head.$authcode.$msg_end;\n\n \t$this->sms->setPhoneNums($phone);\n \t$this->sms->setContent($msg);\n\t\t$sms_error=$this->sms->send();\t\n\t\tif($sms_error['error']==\"Ok\")\n\t\t{\n\t\t\t $errorcode=true;\n\t\t\t log_message('info_tizi','170111:Sms send success',$sms_error);\t\n\t\t}\n\t\telse \n\t\t{\n\t\t\t$errorcode=false;\n\t\t\tif($sms_error['status']==3) $sms_error['error']=$this->lang->line('error_sms_invalid_phone');\n\t\t\telse $sms_error['error']=$this->lang->line('error_sms_normal');\n\t\t\tlog_message('error_tizi','17011:Sms send failed',$sms_error);\n\t\t}\n\t\treturn array('errorcode'=>$errorcode,'error'=>$sms_error['error'],'status'=>$sms_error['status']);\n\t}", "public function reverify(Request $request)\n {\n $data = $request->validate([\n 'verification_code' => 'required|string',\n ]);\n /* Get credentials from .env */\n $token = getenv(\"TWILIO_AUTH_TOKEN\");\n $twilio_sid = getenv(\"TWILIO_SID\");\n $twilio_verify_sid = getenv(\"TWILIO_VERIFY_SID\");\n\n $twilio = new Client($twilio_sid, $token);\n $twilio->verify->v2->services($twilio_verify_sid)\n ->verifications\n ->create(Auth::user()->other_mobile_number, \"sms\");\n\n $twilio = new Client($twilio_sid, $token);\n $verification = $twilio->verify->v2->services($twilio_verify_sid)\n ->verificationChecks\n ->create($data['verification_code'], array('to' => Auth::user()->other_mobile_number));\n\n if ($verification->valid) {\n User::where('other_mobile_number', Auth::user()->other_mobile_number)->update(['phone_number_verification_status' => 1]);\n return response()->json([\n 'message' => 'Successfully verified'\n ], 201);\n }\n return response()->json([\n 'message' => 'verification error'\n ], 201);\n }", "public function verify_mob(Request $request)\n {\n $data = $request->validate([\n 'verification_code' => 'required|string',\n 'other_mobile_number' => 'required|string|unique:users',\n 'user_id' => 'required|numeric'\n ]);\n /* Get credentials from .env */\n $token = getenv(\"TWILIO_AUTH_TOKEN\");\n $twilio_sid = getenv(\"TWILIO_SID\");\n $twilio_verify_sid = getenv(\"TWILIO_VERIFY_SID\");\n $twilio = new Client($twilio_sid, $token);\n $verification = $twilio->verify->v2->services($twilio_verify_sid)\n ->verificationChecks\n ->create($data['verification_code'], array('to' => \"+91\".$data['other_mobile_number']));\n\n if ($verification->valid) {\n User::where('id', $data['user_id'])->update(['other_mobile_number' => $data['other_mobile_number'], 'phone_number_verification_status' => 1]);\n return response()->json([\n 'message' => 'Successfully verified'\n ], 201);\n }\n return response()->json([\n 'message' => 'verification error'\n ], 401);\n }", "public function checkVerificationCode() {\n $request_params = Request::all();\n $validation = Validator::make($request_params, $this->getRulesUtils()->check_verification_code, $this->getRulesUtils()->selectLanguageForMessages('check_verification_code', $request_params['lang']));\n if ($validation->fails()) {\n return $this->getCommonUtils()->jsonErrorResponse($validation->errors()->first());\n }\n $verficationCode = $this->getVerificationModel()->getConfirmationCode($request_params);\n if (empty($verficationCode)) {\n return $this->getCommonUtils()->jsonErrorResponse($this->getMessageUtils()->getMessageData('error', $request_params['lang'])['verification_code_invalid']);\n }\n return $this->validationProcess($request_params, $verficationCode);\n }", "function verify_authcode_email($authcode)\n\t{\n\t\t$user_id=$email=$code_type=$user_type=0;\n\t\tif($this->_redis)\n\t\t{\n\t\t\t$data=$this->cache->get($authcode);\t\n\t\t\tif(!empty($data))\n\t\t\t{\n\t\t\t\t$data=json_decode($data);\n\t\t\t\t$user_id=$data->user_id;\n\t\t\t\t$email=$data->email;\n\t\t\t\t$code_type=$data->code_type;\n\t\t\t\t$user_type=$data->user_type;\t\n\t\t\t\t$this->cache->delete($authcode);\n\t\t\t\t$errorcode=true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$errorcode=false;\n\t\t\t\tlog_message('error_tizi','17052:email verify code failed',array('authcode'=>$authcode));\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n \t$this->db->select(\"id,user_id,email,code_type,user_type,generate_time\");\n \t$this->db->from($this->_table);\n \t $this->db->where(\"authcode\",$authcode);\n \t$this->db->where(\"has_verified\",0);\n\t\t\t$this->db->where(\"type\",Constant::VERIFY_TYPE_EMAIL);\n \t$query=$this->db->get();\n \t$total=$query->num_rows();\n \t$gen_time=$query->row()->generate_time;\n\t\t\tif($total==1&&date(\"Y-m-d H:i:s\",strtotime($gen_time.\" + \".Constant::AUTHCODE_EXPIRE_EMAIL))>date(\"Y-m-d H:i:s\"))\n \t{\n \t$id=$query->row()->id;\n \t$user_id=$query->row()->user_id;\n \t$email=$query->row()->email;\n\t\t\t\t$code_type=$query->row()->code_type;\n\t\t\t\t$user_type=$query->row()->user_type;\n \t$this->db->where('id',$id);\n \t$this->db->update($this->_table,array('has_verified'=>1,'verified_time'=>date(\"Y-m-d H:i:s\")));\n \tif($this->db->affected_rows()==1) $errorcode=true;\n\t\t\t\telse $errorcode=false;\n \t}\n \telse\n \t{\n \t\t$errorcode=false;\n \t}\n\t\t}\n return array('user_id'=>$user_id,'email'=>$email,'code_type'=>$code_type,'user_type'=>$user_type,'errorcode'=>$errorcode);\n\t}", "public function check_verify_get($email){\n\t\tif(!empty($email)){\n\t\t\t$q = $this->db->where('email',$email)->where('verified',1)->get('users')->result();\n\t\t\tif(count($q)>0){\n\t\t\t\t$this->response(['Verified.'], REST_Controller::HTTP_OK);\n\t\t\t}else{\n\t\t\t\t$this->response(['Not Verified.'], '500');\n\t\t\t}\n\t\t}else{\n\t\t\t$this->response(['Too few arguments'], '500');\n\t\t}\n\t}", "public function verify(Request $request)\n {\n // return $request->user()->verification_code . '-' . $request->code;\n if (strval($request->user()->verification_code) !== $request->code) {\n throw CodeProvided::wrong();\n }\n\n if ($request->user()->hasVerifiedPhone()) {\n return redirect($this->redirectPath());\n }\n\n if ($request->user()->markPhoneAsVerified()) {\n event(new Verified($request->user()));\n }\n\n return redirect($this->redirectPath())->with('status', __('Your phone was successfully verified!'));\n }", "public function verifyMobile(Request $request)\n {\n request()->request->set('otp_type', config('mappings.otp_code_type.guest-phone'));\n\n request()->validate([\n 'call_code_id' => 'required|integer|exists:countries,id',\n 'verification_mobile' => [\n 'required',\n new OTPMobileNumberCheck($this->countryObj, $this->userOTPObj, request()->input('call_code_id'))\n ],\n 'verification_code' => 'required|exists:user_otps,code',\n 'otp_type' => [\n 'required',\n new MasterDataTitleExists($this->masterObj, 'otp_code_type')\n ]\n ]);\n\n $country = $this->countryObj->find($request->input('call_code_id'));\n\n $mobileNumber = $country->call_code . $request->input('verification_mobile');\n\n $mobileData = $this->otpHelper->getOTPCode(\n $mobileNumber,\n $request->input('otp_type'),\n $request->input('verification_code')\n );\n\n if ($mobileData->code == $request->input('verification_code'))\n {\n $mobileData->verified = 1;\n\n $mobileData->save();\n\n return response([\n 'status' => __('message.mobile.verified', ['number' => $mobileData->mobile]),\n 'verified' => 1\n ]);\n }\n else\n {\n //TODO check the tries............\n $mobileData->tries = $mobileData->tries + 1;\n\n $mobileData->save();\n\n return response(['status' => trans('message.mobile.wrong_code')]);\n }\n }", "public function getUserByPhone($phone);", "public function verifyOtp($phone,$otp){\n $this->db->select('id')->from('otp')->where('phone',$phone)->where('otp',$otp);\n $q = $this->db->get();\n if($q->num_rows() == 1){\n $res = $q->result();\n $id = $res[0]->id;\n $this->db->where('id',$id)->delete('otp');\n ////\n $this->db->select('id,name')->from('users')->where('phone',$phone);\n $q = $this->db->get();\n if($q->num_rows() == 1){\n // user exists\n $res = $q->result();\n $user_id = $res[0]->id;\n $user_name = $res[0]->name;\n }else{\n // create new user\n $data = array(\n \"phone\" => $phone,\n \"name\" => '',\n );\n $this->db->insert('users',$data);\n $user_id = $this->db->insert_id();\n $user_name = '';\n }\n $api_key = md5(time() . 'suck_my_balls@69006069');\n $key = array(\n 'api_key' => $api_key\n );\n $this->db->where('id',$user_id)->update('users',$key);\n // send user_id,user_name and api_key \n $arr = array(\n 'user_id' => $user_id,\n 'user_name' => $user_name,\n 'api_key' => $api_key\n );\n return $arr;\n }else{\n return 0;\n }\n }", "public function otpverification()\n\t{\t\n\t\tif($this->session->userdata('VB_USER_ID') <> ''):\n\t\t\tredirect(base_url().'my-profile');\n\t\tendif;\n\t\t$data['error'] \t\t\t\t\t\t= \t'';\n\t\t$data['formError'] \t\t\t\t\t=\t''; \t\n\n\t\tif($this->input->post('verifyotp')):\n\t\t\t\t$userData\t\t=\t$this->common_model->checkOTP(trim($this->session->userdata('VB_REGISTER_MOBILE')),trim($this->input->post('verifyotp')),'users','user_phone_otp');\n\t\t\t\tif($userData <> \"\"): \n\t\t\t\t\tif($userData['status'] == 'I'):\n\t\t\t\t\t\t$param['user_phone_verify']\t=\t'Y';\n\t\t\t\t\t\t$param['user_phone_otp']\t=\t'';\n\t\t\t\t\t\t$param['status']\t\t\t=\t'A';\n\t\t\t\t\t\t$this->common_model->editData('vb_users',$param,'user_id',$userData['user_id']);\n\t\t\t\t\t\t\n\t\t\t\t\t\t$this->session->unset_userdata('VB_REGISTER_MOBILE');\n\t\t\t\t\t\tsetcookie('VB_USER_LOGIN_TOKEN',$loginParam['user_token'],time()+60*60*24*100,'/');\n\t\t\t\t\t\t$this->session->set_userdata(array(\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_LOGGED_IN'\t\t=>\ttrue,\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_ID'\t\t\t=>\t$userData['user_id'],\n\t\t\t\t\t\t\t\t\t\t\t'VB_FULL_NAME'\t\t\t=>\t$userData['full_name'],\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_EMAIL'\t\t\t=>\t$userData['user_email'],\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_MOBILE'\t\t=>\t$userData['mobile_number'],\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_TYPE_ID'\t\t=>\t$userData['usertype_id'],\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_TYPE_NAME'\t\t=>\t$userData['usertype_name'],\n\t\t\t\t\t\t\t\t\t\t\t'VB_USER_CURRENT_PATH'\t=>\t$currentPath));\n\t\t\t\t\t\techo \"success\";die;\n\t\t\t\t\telseif($userData['status'] == 'B'):\n\t\t\t\t\t\techo \"blocked\";die;\n\t\t\t\t\telseif($userData['status'] == 'A'):\n\t\t\t\t\t\techo \"active\";die;\n\t\t\t\t\tendif;\n\t\t\t\telse:\n\t\t\t\t\techo \"wrongotp\";die;\n\t\t\t\tendif;\n\t\tendif;\n\t\t\n\t\t$this->layouts->set_title(stripcslashes('OTP Verification | VBloggers'));\n\t\t$this->layouts->set_keyword(stripcslashes('OTP Verification | VBloggers'));\n\t\t$this->layouts->set_description(stripcslashes('OTP Verification | VBloggers'));\n\t\t\n\t\t$this->layouts->login_view('user/otpverification',array(),$data);\n\t}", "public function verify(Request $request)\n {\n $verification = Verification::whereCode($request->sms_code)->first();\n\n if(!$verification) {\n return response()->json([\n 'flash' => 'Wrong verification code'\n ], 422);\n }\n\n $verification->updateVerification();\n\n $user = User::findOrFail($verification->verificable_id);\n $user->status = User::ACTIVATED;\n $user->save();\n\n $token = $user->createToken('API')->accessToken;\n\n return response()->json([\n 'user' => $user,\n 'token' => $token\n ], 201);\n }", "public function verify_actcode($member_email, $code){\n\t\t//$newCode = $this->make_activation_code();\n\t\t$mysql = New Mysql();\n\t\treturn($mysql->update_activation_code($member_email, $code));\n\t}", "function send_code($mobile_no) {\n\n\t\t$varifycode = rand('1000', '9999');\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$code = 1234;\n\t\t$mobile = \"0\" . $mobile_no;\n\t\t// $mobileNumber = substr($mobile_no, 1);\n\t\t$msg = \"Recharge Verification Code : \" . $code;\n\t\t$encodedMessage = urlencode($msg);\n\t\t// $route = \"4\";\n\t\t// $authKey = \"109829ANu1kqLdg570b4e25\";\n\t\t// $senderId = \"Recharge\";\n\t\t// $postData = array(\n\t\t// 'authkey' => $authKey,\n\t\t// 'mobiles' => $mobileNumber,\n\t\t// 'message' => $encodedMessage,\n\t\t// 'sender' => $senderId,\n\t\t// 'route' => $route\n\t\t// );\n\t\t$url = \"http://www.kudisms.net/components/com_spc/smsapi.php?username=smerp&password=abhishek&sender=kudisms&recipient=$mobile&message=\" . $encodedMessage;\n\t\t// $url=\"http://api.msg91.com/api/sendhttp.php\";\n\t\t$ch = curl_init();\n\t\tcurl_setopt_array($ch, array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,\n\t\t// CURLOPT_POSTFIELDS => $postData\n\t\tCURLOPT_FOLLOWLOCATION => true));\n\t\t//\n\t\t//\n\t\t// //Ignore SSL certificate verification\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n\t\t//\n\t\t//\n\t\t// //get response\n\t\t$output = curl_exec($ch);\n\t\t//\n\t\t// if (curl_errno($ch)) {\n\t\t// $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n\t\t// echo json_encode($result);\n\t\t// exit();\n\t\t// // // //\n\t\t// }\n\t\tcurl_close($ch);\n\t\treturn $code;\n\t\t//echo $output;\n\t}", "function check_reffer_code(){\n\t$reffer_code=$_REQUEST['reffer_code'];\n\tif(!empty($reffer_code)){\n\t\t$reffer_records = $this -> conn -> get_table_row_byidvalue('user', 'user_refferal_code', $reffer_code);\n\t\tif(!empty($reffer_records)){\n\t\t\t$user_id=$reffer_records[0]['user_id'];\n\t\t\t$user_reffer_code=$reffer_records[0]['user_refferal_code'];\n\t\t\tif($user_reffer_code==$reffer_code){\n\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Reffer code avalible\", 'reffer_code' => $reffer_code,'user_id'=>$user_id);\n\t\t\t}else{\n\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t\t}\n\t\t\t\n\t\t}else{\n\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid reffer code\");\n\t\t}\n\t}else{\n\t\t$post = array(\"status\" => \"false\", \"message\" => \"Missing parameter\",'reffer_code'=>$reffer_code);\n\t}\n\techo $this -> json($post);\n}", "function verifyemail() {\n\t$a = array(\n\t 'status' => 'system-error'\n\t);\n\n\t// raw inputs\n\t$taint_si = isset($_POST['si']) ? $_POST['si'] : 0;\n\t$taint_tic = isset($_POST['tic']) ? $_POST['tic'] : 0;\n\t$taint_pword = isset($_POST['pword']) ? $_POST['pword'] : 0;\n\n\t// validate inputs\n\t$si = validateToken($taint_si);\n\t$tic = validateTic($taint_tic);\n\t$pword = validatePword($taint_pword);\n\n\t// validate parameter set\n\tif (!$si || !$tic || !$pword) {\n\t\tLog::write(LOG_WARNING, 'attempt with invalid parameter set');\n\t\treturn $a;\n\t}\n\n\t// get db connection\n\t$conn = getConnection();\n\tif (!$conn) {\n\t\treturn $a;\n\t}\n\n\t// read token and user table\n\t$result = getUserByToken($conn, $si);\n\tif (!$result) {\n\t\treturn $a;\n\t}\n\n\t// get fields\n\t$row = pg_fetch_array($result, 0, PGSQL_ASSOC);\n\t$userid = $row['id'];\n\t$hashpassword = $row['hashpassword'];\n\t$auth = $row['auth'];\n\t$hashtic = $row['hashtic'];\n\t$oldemail = $row['email'];\n\n\t// verify user authentication state\n\tif (!isUserEmailPending($auth)) {\n\t \tLog::write(LOG_NOTICE, 'attempt to verify email on user not auth=email-pending');\n\t\treturn $a;\n\t}\n\n\t// verify the password\n\t$boo = verifyPassword($pword, $hashpassword);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid password');\n\t\treturn $a;\n\t}\n\n\t// verify the tic from the email\n\t$boo = verifyTic($tic, $hashtic);\n\tif (!$boo) {\n\t\tLog::write(LOG_NOTICE, 'attempt with invalid tic');\n\t\treturn $a;\n\t}\n\n\t// update user record\n\t$auth = DB::$auth_verified;\n\t$name = 'verify-email';\n\t$sql = \"update accounts.user set email=newemail, newemail='', auth=$1, hashtic=null, tmhashtic=null where id = $2\";\n\t$params = array($auth, $userid);\n\t$result = execSql($conn, $name, $sql, $params, true);\n\tif (!$result) {\n\t\treturn false;\n\t}\n\n\t// send security notice\n\t$boo = sendAuthenticationEmail($oldemail, 'changedemail', '');\n\tif (!$boo) {\n\t\t$a['status'] = 'send-email-failed';\n\t\treturn $a;\n\t}\n\n\t// success\n\t$a['status'] = 'ok';\n\t$a['auth'] = $auth;\n\treturn $a;\n}", "protected function verifyPhoneRequest($token, $phone, $code, $mcc, $app, $device_token, $device_id, $device_type, $time_zone)\n {\n // verify the required parameter 'token' is set\n if ($token === null || (is_array($token) && count($token) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $token when calling '\n );\n }\n // verify the required parameter 'phone' is set\n if ($phone === null || (is_array($phone) && count($phone) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $phone when calling '\n );\n }\n // verify the required parameter 'code' is set\n if ($code === null || (is_array($code) && count($code) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $code when calling '\n );\n }\n // verify the required parameter 'mcc' is set\n if ($mcc === null || (is_array($mcc) && count($mcc) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $mcc when calling '\n );\n }\n // verify the required parameter 'app' is set\n if ($app === null || (is_array($app) && count($app) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $app when calling '\n );\n }\n // verify the required parameter 'device_token' is set\n if ($device_token === null || (is_array($device_token) && count($device_token) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $device_token when calling '\n );\n }\n // verify the required parameter 'device_id' is set\n if ($device_id === null || (is_array($device_id) && count($device_id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $device_id when calling '\n );\n }\n // verify the required parameter 'device_type' is set\n if ($device_type === null || (is_array($device_type) && count($device_type) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $device_type when calling '\n );\n }\n // verify the required parameter 'time_zone' is set\n if ($time_zone === null || (is_array($time_zone) && count($time_zone) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $time_zone when calling '\n );\n }\n\n $resourcePath = '/rapi/verify_phone';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // form params\n if ($token !== null) {\n $formParams['token'] = ObjectSerializer::toFormValue($token);\n }\n // form params\n if ($phone !== null) {\n $formParams['phone'] = ObjectSerializer::toFormValue($phone);\n }\n // form params\n if ($code !== null) {\n $formParams['code'] = ObjectSerializer::toFormValue($code);\n }\n // form params\n if ($mcc !== null) {\n $formParams['mcc'] = ObjectSerializer::toFormValue($mcc);\n }\n // form params\n if ($app !== null) {\n $formParams['app'] = ObjectSerializer::toFormValue($app);\n }\n // form params\n if ($device_token !== null) {\n $formParams['device_token'] = ObjectSerializer::toFormValue($device_token);\n }\n // form params\n if ($device_id !== null) {\n $formParams['device_id'] = ObjectSerializer::toFormValue($device_id);\n }\n // form params\n if ($device_type !== null) {\n $formParams['device_type'] = ObjectSerializer::toFormValue($device_type);\n }\n // form params\n if ($time_zone !== null) {\n $formParams['time_zone'] = ObjectSerializer::toFormValue($time_zone);\n }\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n ['application/x-www-form-urlencoded']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass && $headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\build_query($formParams);\n }\n }\n\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\build_query($queryParams);\n return new Request(\n 'POST',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "function check_auth_response_code($status) {\n\n if ($status != 'S000') {\n $message = get_ticket_error_message($status);\n return result_error($status,$message);\n }\n return result_success();\n}", "function send_code($mobile_no) {\n\n\t\t$varifycode = rand('1000', '9999');\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$code = 1234;\n\t\t// $mobileNumber = substr($mobile_no, 1);\n\t\t// $msg = \"Recharge Verification Code : \" . $code;\n // $encodedMessage = urlencode($msg);\n // $route = \"4\";\n // $authKey = \"109829ANu1kqLdg570b4e25\";\n // $senderId = \"Recharge\";\n // $postData = array(\n // 'authkey' => $authKey,\n // 'mobiles' => $mobileNumber,\n // 'message' => $encodedMessage,\n // 'sender' => $senderId,\n // 'route' => $route\n// );\n// $url=\"http://api.msg91.com/api/sendhttp.php\";\n // $ch = curl_init();\n// curl_setopt_array($ch, array(\n // CURLOPT_URL => $url,\n // CURLOPT_RETURNTRANSFER => true,\n // CURLOPT_POST => true,\n // CURLOPT_POSTFIELDS => $postData\n // //,CURLOPT_FOLLOWLOCATION => true\n// ));\n// \n// \n// //Ignore SSL certificate verification\n// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n// \n// \n// //get response\n// $output = curl_exec($ch);\n// \n // if (curl_errno($ch)) {\n\t // $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n // echo json_encode($result);\n\t\t\t // exit();\n// // // // \n\t\t // }\n // curl_close($ch);\nreturn $code;\n\t\t//echo $output;\n\t}", "#[Route(path: '/verify-mobile-code/{verificationCode}', name: 'employees_verify_mobile_code', methods: ['GET'])]\n public function verifyMobileCodeAction(Request $request, $verificationCode=null) {\n\n $em = $this->getDoctrine()->getManager();\n $userServiceUtil = $this->container->get('user_service_utility');\n //$user = $this->getUser(); //user here is undefined\n\n //testing\n //$code = $userServiceUtil->generateVerificationCode();\n //exit(\"code=\".$code);\n\n if( !$verificationCode ) {\n $verificationCode = $request->query->get('verify-code');\n }\n //exit(\"verificationCode=\".$verificationCode);\n\n //0) find user by the $verificationCode\n $user = $userServiceUtil->getUserByVerificationCode($verificationCode);\n\n if( $user ) {\n //1) get userInfo\n $userInfo = $user->getUserInfo();\n\n //2) use $verificationCode to verify the verification code in userInfo, if equal then change => verified\n $phoneNumberVerified = $userInfo->verifyCode($verificationCode);\n if( $phoneNumberVerified ) {\n $userInfo->setVerified();\n if( $this->siteName == 'crn' ) {\n $user->addRole(\"ROLE_CRN_RECIPIENT\");\n }\n $em->flush();\n $this->addFlash(\n 'notice',\n 'Your mobile phone number has been successfully verified.'\n );\n\n //EventLog: $eventType, $event, $testing\n $eventMsg = 'Mobile phone number '.$phoneNumberVerified.' has been successfully verified by verifyMobileCodeAction';\n $userServiceUtil->setVerificationEventLog('Mobile Phone Verified', $eventMsg);\n \n return $this->redirect($this->generateUrl('main_common_home'));\n } else {\n// $this->addFlash(\n// 'warning',\n// 'Invalid verification code.'\n// );\n if( $userInfo->getPreferredMobilePhoneVerified() ) {\n $resFailed = \"Mobile phone number is already verified\";\n } else {\n $resFailed = \"Verification failed\";\n }\n $this->addFlash(\n 'warning',\n $resFailed\n );\n }\n\n //2) use $verificationCode to verify the verification code in userInfo, if equal then change => verified\n// $userVerificationCode = $userInfo->getMobilePhoneVerifyCode();\n// $phoneNumber = $userInfo->getPreferredMobilePhone();\n// $notExpired = $userInfo->verificationCodeIsNotExpired();\n// if( $notExpired && $phoneNumber && $userVerificationCode && $verificationCode && $userVerificationCode == $verificationCode ) {\n// //OK\n// $userInfo->setMobilePhoneVerifyCode(NULL);\n// $userInfo->setMobilePhoneVerifyCodeDate(NULL);\n// $userInfo->setPreferredMobilePhoneVerified(true);\n//\n// $em->flush();\n//\n// $this->addFlash(\n// 'notice',\n// 'Your mobile phone number has been successfully verified.'\n// );\n//\n// return $this->redirect($this->generateUrl('main_common_home'));\n// } else {\n//// $this->addFlash(\n//// 'warning',\n//// 'Invalid verification code.'\n//// );\n// }\n } else {\n// $this->addFlash(\n// 'warning',\n// 'Invalid verification code.'\n// );\n }\n\n //$phoneNumber = null;\n $mobilePhoneVerified = false;\n\n //testing\n //$user = $em->getRepository(User::class)->find(4689);\n\n if( $user ) {\n //“visit your profile page to restart the verification process” is a link to user's profile page\n //visit your profile page to restart the verification process\n $profileLink = $this->container->get('router')->generate(\n 'employees_showuser',\n array(\n 'id' => $user->getId(),\n ),\n UrlGeneratorInterface::ABSOLUTE_URL\n );\n $profileLink = \"<a data-toggle='tooltip' title='Verification Link' href=\" . $profileLink . \">visit your profile page to restart the verification process</a>\";\n\n $userInfo = $user->getUserInfo();\n if( $userInfo ) {\n $mobilePhoneVerified = $userInfo->getPreferredMobilePhoneVerified();\n //$phoneNumber = $userInfo->getPreferredMobilePhone();\n }\n\n if( !$mobilePhoneVerified ) {\n $mobilePhoneVerified = false;\n }\n\n } else {\n $profileLink = \"visit your profile page to restart the verification process\";\n }\n\n //testing\n //$mobilePhoneVerified = false;\n\n $message = \"The supplied verification code appears to be invalid.\"\n .\" Please type the code in manually or $profileLink.\"\n .\" If you have requested an account, you will be able to verify your mobile phone number once the account is created.\";\n\n return $this->render('AppUserdirectoryBundle/Telephony/verify-mobile-code.html.twig', array(\n 'sitename' => $this->siteName,\n 'title' => \"Mobile Phone Verification\",\n 'mobilePhoneVerified' => $mobilePhoneVerified,\n 'verificationCode' => $verificationCode,\n 'message' => $message\n //'form' => $form->createView(),\n\n ));\n }", "function verify_code($rec_num, $checkstr)\n\t{\n\t\tif ($user_func = e107::getOverride()->check($this,'verify_code'))\n\t\t{\n\t \t\treturn call_user_func($user_func,$rec_num,$checkstr);\n\t\t}\n\t\t\n\t\t$sql = e107::getDb();\n\t\t$tp = e107::getParser();\n\n\t\tif ($sql->db_Select(\"tmp\", \"tmp_info\", \"tmp_ip = '\".$tp -> toDB($rec_num).\"'\")) {\n\t\t\t$row = $sql->db_Fetch();\n\t\t\t$sql->db_Delete(\"tmp\", \"tmp_ip = '\".$tp -> toDB($rec_num).\"'\");\n\t\t\t//list($code, $path) = explode(\",\", $row['tmp_info']);\n\t\t\t$code = intval($row['tmp_info']);\n\t\t\treturn ($checkstr == $code);\n\t\t}\n\t\treturn FALSE;\n\t}", "public function resendCode($phone)\n\t{\t\n\t\t$user = new User();\n\t\t$user->phone = $phone;\n\t\t$user->phone_token = mt_rand(100000, 999999);\n\n\t\t$querry = \"UPDATE \". DBTool::rawTable('users') . \" SET phone_token = '\" . $user->phone_token . \"', verified_phone = 0 WHERE phone = '\" . $phone . \"'\";\n\t\t$updated = DB::update(DB::raw($querry));\n\t\t$updated = ArrayHelper::fromObject($updated);\n\n\t\t// Send Verification Code by SMS\n\t\t// $this->sendVerificationCode($user);\n\n\t\tif(!(NotifyController::SendNotification(\n\t\t\t\t['1' => 'NOFIFY_SMS'],\n\t\t\t\t['phone' => \"$phone\",\n\t\t\t\t'message'=>\"$this->message $user->phone_token\",\n\t\t\t\t'verify' => 1]\n\t\t))){\n\t\t\treturn redirect()->back();\n\t\t}\n\t\t$data = [];\n\t\t\n\t\t// References\n\t\t$data['countries'] = CountryLocalizationHelper::transAll(CountryLocalization::getCountries());\n\t\t$data['genders'] = Gender::trans()->get();\n\t\t$data['phone'] = $phone;\n\t\t// Meta Tags\n\t\tMetaTag::set('title', getMetaTag('title', 'register'));\n\t\tMetaTag::set('description', strip_tags(getMetaTag('description', 'register')));\n\t\tMetaTag::set('keywords', getMetaTag('keywords', 'register'));\n\t\t\n\t\treturn view('auth.register.indexSecond', $data);\n\t}", "public function check_mobile($mobile){\n $query = $this->db->select('01_mobile')\n ->where('01_mobile', $mobile)\n ->get('register_01');\n if($query->num_rows()>0){\n return 0;\n }else{\n $query = $this->db->where('is_sms', 1)\n ->where('number', $mobile)\n ->get('verify_otp_12');\n if($query->num_rows()>0){\n return 'sent';\n }else{\n $query = $this->db->where('number', $mobile)\n ->delete('verify_otp_12');\n $otp = rand(10000, 1000000);\n $data = array(\n 'number' => $mobile,\n 'otp' => $otp,\n );\n $query = $this->db->insert('verify_otp_12', $data);\n return true;\n }\n }\n }", "function validateCredential(){\r\n\r\n\t\t$avsData = array('Street' => '1 Main St', 'City' => 'San Jose', 'PostalCode' => '95131');\r\n\t\t$cardData = array('cardowner' => 'Jane Doe', 'cardtype' => 'Visa', 'pan' => '4012888812348882', 'expire' => '1218', 'cvv' => '123');\r\n\t\t\r\n\t\ttry {\r\n\t\t\t$obj_transaction = new VelocityProcessor( $this->applicationprofileid, $this->merchantprofileid, $this->workflowid, $this->isTestAccount, $this->identitytoken, null);\r\n\t\t\treturn array('status'=>1,'message'=>'Authentication Validated Successfully.');\r\n\t\t\t/* try {\r\n\t\t\t\t$response = $obj_transaction->verify(array(\r\n\t\t\t\t\t\t'amount' => 1.00,\r\n\t\t\t\t\t\t'avsdata' => $avsData,\r\n\t\t\t\t\t\t'carddata' => $cardData,\r\n\t\t\t\t\t\t'entry_mode' => 'Keyed',\r\n\t\t\t\t\t\t'IndustryType' => $this->IndustryType,\r\n\t\t\t\t\t\t'Reference' => 'Ezneterp',\r\n\t\t\t\t\t\t'EmployeeId' => '11'\r\n\t\t\t\t));\r\n\t\t\t\t\r\n\t\t\t\tif (is_array($response) && isset($response['Status']) && $response['Status'] == 'Successful') \r\n\t\t\t\t\treturn array('status'=>1,'message'=>'Authentication Validated Successfully.');\r\n\t\t\t\telse\r\n\t\t\t\t\treturn array('status'=>0,'errors'=>$response);\r\n\t\t\t\t\r\n\t\t\t} catch (Exception $e) {\r\n\t\t\t\treturn array('status'=>0,'errors'=>$e->getMessage());\r\n\t\t\t} */\r\n\t\t\t\r\n\t\t\t\r\n\t\t} catch(Exception $e) {\r\n\t\t\tif(strcmp($e->getMessage(), 'An invalid security token was provided') == 0)\r\n\t\t\t\treturn array('status'=>0,'errors'=>'An invalid security token was provided');\r\n\t\t\telse\r\n\t\t\t\treturn array('status'=>0,'errors'=>$e->getMessage());\r\n\t\t}\r\n\t}", "public function verify(Request $request)\n {\n $v_code = \\Illuminate\\Support\\Facades\\Request::get('code');\n $user = User::where(['verification_code'=> $v_code])->first();\n if($user!=null)\n {\n $user->is_verified = 1;\n $user->save();\n return response(['Success'=>'You are veified now']);\n }\n return response (['Fail'=>'Something Went wrong'],400);\n }", "public function verifyPhone(){\n return view('auth.register_phone');\n }", "function processAuthority($phone1,$phone2,$call) {\r\n\t$perms_contract = $phone1[4]; //move to uppercase\r\n\t//$perms_contract = \"2.1.S\"; //move to uppercase\r\n\t$perms_caller = $phone2[4]; //move to uppercase\r\n\t//$perms_caller = \"3.2.S\"; //move to uppercase\r\n\t$flagged = false;\r\n\t//die();\r\n\t\r\n\tif($perms_contract != \"A\") { // These two lines remove the A level, all the rest are judgable \r\n\t\tif($perms_caller != \"A\") {\r\n\t\tif($perms_caller != \"F\") {\r\n\t\t\t// Zone Leader Catch \r\n\t\t\tif(strlen($perms_contract) < 2 || strlen($perms_caller) < 2) { //Tests for a whole number 1, 2, 3..\r\n\t\t\t\tif(substr($perms_contract,0,1) != substr($perms_caller,0,1)) $flagged = true; // Checks if the (1).1 and (1) match, flags if not\r\n\t\t\t}\r\n\t\t\t// District Catch\r\n\t\t\telseif(strlen($perms_contract) < 4 || strlen($perms_caller) < 4) { // Test for a float 1.2, 3.4..\r\n\t\t\t\tif(substr($perms_contract,0,1) != substr($perms_caller,0,1)) $flagged = true; // Checks if the (1).1 and (1).8 match, flags if not\r\n\t\t\t\telseif($perms_contract == $perms_caller) $flagged = false;\r\n\t\t\t\t//elseif(substr($perms_contract,2,1) != substr($perms_caller,2,1) && substr($perms_contract,2,1) != \"\" || substr($perms_caller,2,1) != \"\") $flagged = true; // Checks if the 1.(1) and 2.(1) match, flags if not\r\n\t\t\t}\r\n\t\t\t// Sister Catch\r\n\t\t\tif(strpos($perms_contract, \"S\") !== false || strpos($perms_caller, \"S\") !== false) { //Tests for S\r\n\t\t\t\tif(strpos($perms_contract, \"S\") !== strpos($perms_caller, \"S\")) { //Tests for one of them not being a sister\r\n\t\t\t\t\tif(substr($perms_contract,0,1) != substr($perms_caller,0,1)) $flagged = true; // Checks if the (1).1 and (1).8 match, flags if not\r\n\t\t\t\t\telseif(($perms_contract + \".S\") == $perms_caller) $flagged = false;\r\n\t\t\t\t\t//elseif(substr($perms_contract,2,1) != substr($perms_caller,2,1) && substr($perms_contract,2,1) != \"\" || substr($perms_caller,2,1) != \"\") $flagged = true; // Checks if the 1.(1) and 2.(1) match, flags if not\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t}\r\n\t}\r\n\t\t// Duration Catch\r\n\tif(strtotime(substr($call[3],11,8)) > strtotime($GLOBALS['maximum_duration'])) $flagged = true;\r\n\t\r\n\t// Time Catch\r\n\tif(strtotime($call[2]) >= strtotime($GLOBALS['maximum_time'])) $flagged = true;\r\n\telseif(strtotime($call[2]) <= strtotime($GLOBALS['minimum_time'])) $flagged = true;\r\n\t\r\n\t// Flagged from Directory\r\n\tif($perms_contract == \"F\" || $perms_caller == \"F\") $flagged = true;\r\n\t//if(!$flagged) echo \"free! <br>\";\r\n\t/** REPORTING ***************/\r\n\tif($GLOBALS['reporting']) {\r\n\t\tif($flagged) addToReport($GLOBALS['report'], array_merge($phone2,$call), \"caller-flagged\",$GLOBALS['iterations']); \r\n\t\telse addToReport($GLOBALS['report'], array_merge($phone2,$call), \"caller-ok\",$GLOBALS['iterations']);\r\n\t}\r\n\t\r\n}", "public function execute(CheckVerificationCodeRequest $request): CheckVerificationCodeResponse\n {\n $verificationId = new VerificationId($request->verificationId());\n $code = new VerificationCode($request->code());\n\n $verification = $this->verificationRepository->ofIdOrFail($verificationId);\n\n try {\n $verification->verify($code);\n } catch (IncorrectVerificationCode $ex) {\n $this->verificationRepository->persist($verification);\n throw $ex;\n }\n\n $this->verificationRepository->persist($verification);\n\n return new CheckVerificationCodeResponse(\n $verification->phoneNumber()->phoneNumber(),\n $verification->verified()->isVerified()\n );\n }", "public function verifyForgotPasswordOtp(Request $request)\n {\n # Validate request data\n $validator = Validator::make($request->all(), [ \n 'mobile' => 'required|numeric',\n 'otp' => 'required|numeric',\n 'country_phone_code' => 'required'\n ]);\n\n # If validator fails return response\n if ($validator->fails()) { \n return response()->json(['message'=> $validator->errors()], 401); \n } \n\n # fetch user of this mobile number\n $user = $this->user\n ->where('mobile', $request->get('mobile'))\n ->where('country_phone_code', $request->get('country_phone_code'))\n ->first(); \n\n if ($user->mobile_otp == $request->get('otp')) {\n # verify success\n return response()->json([\n 'message'=> 'OTP verification success',\n 'code' => $this->successStatus,\n 'data' => [\n 'mobile' => (string)$request->get('mobile'),\n 'country_mobile_code' => (string)$request->get('country_phone_code'),\n ]\n ]); \n } else {\n # verify error\n return response()->json([\n 'message'=> 'Wrong OTP',\n 'code' => $this->failedStatus \n ]); \n }\n }", "function verify_user_and_update_subscription($user_email, $verification_code, $mysqli)\n{\n $subscribed = 'yes';\n $is_verified = 'yes';\n $response = [\n 'success' => false,\n 'error_message' => '',\n ];\n\n $does_user_exists = does_user_exist($user_email, $mysqli);\n\n if (!$does_user_exists) {\n $response['success'] = false;\n $response['error_message'] = 'user does not exist';\n\n return $response;\n }\n}", "public function check_promocode() {\n\t\t\t\t $usertypes = $this->users->checkUserTypeLaabus($this->session->userdata('user_id'));\n\t\t\t\t $agent_id = $usertypes[0]->agent_id;\n\t\t\t\t// print_r($usertypes);\n\t\t\t\tif(empty($agent_id))\n\t\t\t\t{\n\t\t\t\t\t$role_id = 4;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$role_id =44;\n\t\t\t\t}\n\t\t$data = $this->users->check_promocode($_REQUEST['promo_code'],$_REQUEST['amount'],$role_id);\n\t\techo $data;\n\t\texit;\n\t}", "public function phone_check($value='')\n {\n $phone = $this->input->post('phone');\n $output = $this->m_vendorDetail->phone_check($phone);\n if (empty($output)) {\n $output = $this->m_vendorDetail->phone_user($phone);\n }\n\n if (empty($output)) {\n $otp = random_string('numeric','6');\n if ($this->m_vendorDetail->addOtp($this->email,$otp)) {\n if($this->otp_sms($otp))\n {\n $output = '';\n }else{\n $output = 3;\n }\n } else{\n $output = 3;\n }\n }\n\n echo $output;\n }", "public static function phone($err) { \n\t\treturn new VRule(function($val) {\n\t\t\treturn preg_match('/(\\d{10,})/', preg_replace('/\\D/', '', $val)) > 0;\n\t\t}, $err);\n\t}", "public function verifyAccount(){\n\t\t$sql = \"SELECT UID, UName, email from user WHERE ver_code = :ver AND SHA1(email) = :email AND verified = 0\";\n\n\n\t\tif($stmt = $this->_db->prepare($sql)){\n\t\t\t$stmt->bindParam(':ver', $_GET['v'], PDO::PARAM_STR);\n\t\t\t$stmt ->bindParam(':email', $_GET['e'], PDO::PARAM_STR);\n\t\t\t$stmt->execute();\n\n\n\t\t\t$row = $stmt->fetch();\n\n\t\t\tif(isset($row['email'])){\n\t\t\t\t$_SESSION['UID'] = $row['UID'];\n $_SESSION['UNAME'] = $row['UName'];\n\t\t\t\t$_SESSION['LoggedIn'] = 1;\n\t\t\t\t$_SESSION['ISADMIN'] = 0;\n\t\t\t}\n\t\t\telse{\n\t\t\t\treturn array(4, \"<h2>Verification error. This account has already been verified.</h2>\");\n\t\t\t}\n\t\t\t$stmt->closeCursor();\n\n\t\t\treturn array(0, null);\n\t\t}\n\t\telse{\n\t\t\treturn array(2, \"Database error\");\n\t\t}\n\t}", "function twilio_authentication($variables_from_get_number_info, $twil_auth_token) {\n\n $validator = new Services_Twilio_RequestValidator($twil_auth_token);\n\n // The Twilio request URL.\n\n $twiml_app_url = 'https://www.yourwebsite.com/phone_tracking_google_analytics/handle_incoming_call.php?';\n\n // The X-Twilio-Signature header\n $signature = $_SERVER[\"HTTP_X_TWILIO_SIGNATURE\"];\n\n if ($validator->validate($signature, $twiml_app_url, $variables_from_get_number_info)) {\n return true;\n }\n else {\n error_log(__FILE__ . ': ' . __LINE__ . ': Something is fishy. This request not sent from twilio');\n return false;\n }\n }", "function mobile_verify($Phone,$client_transaction_id)\n{\n\n$response = file_get_contents(\"http://www.zipdial.com/z2v/startTransaction.action?customerToken=04f0294522530730a4671c96a8a35cac6c47714d&clientTransactionId=$client_transaction_id&callerid=$Phone&duration=360&countryCode=91&z2vToken=bc4e3f20bd8c7361c7a088b7b570e9d076516dd5\"); \n\t//echo $response;\n\t//echo \"<br>\";\n\t$explod = explode(\",\", $response);\n\t\t\n\t$explod2 = explode('http://www.zipdial.com', $explod[4]);\n\t//echo $explod2[1];\n\t$getImg = substr(trim($explod2[1]), 0, strlen(trim($explod2[1]))-2);\n//echo $getImg1 = substr(trim($explod2[1]), 0, strlen(trim($explod2[1]))-3);\n//echo \"<br>\";\n\t$image = \"http://www.zipdial.com\".$getImg;\n\t$img = trim(str_replace(\"\\/\", \"/\", $image));\n\t$explod31 = explode('transaction_token', $explod[2]);\n\t$explod3 = trim($explod31[1]);\n\t$transactiontoken =\texplode('/', $getImg);\n\t$transaction_token = $transactiontoken[4];\n\tif(strlen($explod2[1])>8)\n\t{\n\t\t$viewable = \"viewed\";\n\t}\n\telse\n\t{\n\t\t$viewable = \"not viewed\";\n\t}\n\t\n\t\t//\techo \"<br>\";\n $insertSql = \"INSERT INTO z2v_transactions ( client_transaction_id , zipdial_no , transaction_token , mobile , verified , created ,viewable ) VALUES ('\".$client_transaction_id.\"' , '\".$zipdial_no.\"' , '\".$transaction_token.\"' , '\".$Phone.\"' , '\".$verified.\"' , Now(), '\".$viewable.\"')\";\n \n$insertQuery = $obj->fun_db_query($insertSql);\n\t\n return $img;\n}", "public function getVerifyList($phone) {\n $sqlQuery = \"SELECT * FROM \" . $this->db_table . \" WHERE phone = $phone\";\n $stmt = $this->conn->prepare($sqlQuery);\n $stmt->execute();\n return $stmt;\n }", "private function checkingApiCanAuthenticateCode($auth_code)\n {\n return $this->api_request->get(\"user\",\"validate_user_code\",$params=array('code'=>$auth_code)); \n }", "function forget_send_code($mobile) {\n\t\t$varifycode = rand('10000000', '99999999');\n\t\t//$code = 1234;\n\t\t$code = str_pad($varifycode, 3, '0', STR_PAD_LEFT);\n\t\t$mobileNumber = substr($mobile, 1);\n\t\t$msg = \"New Password of Recharge login : \" . $code;\n\t\t$encodedMessage = urlencode($msg);\n\t\t// $route = \"4\";\n\t\t// $authKey = \"109829ANu1kqLdg570b4e25\";\n\t\t// $senderId = \"Recharge\";\n\t\t// $postData = array(\n\t\t// 'authkey' => $authKey,\n\t\t// 'mobiles' => $mobileNumber,\n\t\t// 'message' => $encodedMessage,\n\t\t// 'sender' => $senderId,\n\t\t// 'route' => $route\n\t\t// );\n\t\t//$url=\"http://api.msg91.com/api/sendhttp.php\";\n\t\t$url = \"http://www.kudisms.net/components/com_spc/smsapi.php?username=smerp&password=abhishek&sender=kudisms&recipient='\" . $mobile . \"'&message=\" . $encodedMessage;\n\t\t$ch = curl_init();\n\t\tcurl_setopt_array($ch, array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData, CURLOPT_FOLLOWLOCATION => true));\n\t\t//\n\t\t//\n\t\t// //Ignore SSL certificate verification\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n\t\t//\n\t\t//\n\t\t// //get response\n\t\t$output = curl_exec($ch);\n\t\t//\n\t\t// if (curl_errno($ch)) {\n\t\t// $result = array('status' => 'false', 'message' => 'Error in sending OTP, please verify your contact number and try again.');\n\t\t// echo json_encode($result);\n\t\t// exit();\n\t\t// // // //\n\t\t// }\n\t\tcurl_close($ch);\n\t\treturn $code;\n\t}", "public function validatePaymentCodeApi(){\n\t\t$customerID = $this->input->post('customerID');\n\t\t$query = $this->db->get_where('users', ['id' => $customerID]);\n\t\tif($query->num_rows() > 0)\n\t\t{\n\t\t\tforeach($query->result() as $r);\n\t\t\t$data['status'] \t\t= 'true';\n\t\t\t$data['customerName']\t= $r->first_name.' '.$r->last_name;\n\t\t\t$data['customerAddress']\t= nl2br($r->street_address);\n\t\t\t$data['customerAddress']\t.= '<br />Contact No : '.$r->contactno ;\n\t\t\t$data['customerAddress']\t.= ($r->passport_no = '') ?\n\t\t\t\t\t\t\t\t\t\t'<br /> Passport No : '. $r->passport_no :\n\t\t\t\t\t\t\t\t\t\t//'<br /> MyFair Account No : '. $r->national_id;\n\t\t\t\t\t\t\t\t\t\t'<br /> MyFair Account No : '. $r->account_no;\n\t\t\t\t\t\t\t\t\t\t'<br /> Adhaar Card No : '. $r->national_id;\n\t\t\t\t\t\t\t\t\t\t\n\t\t}\n\t\telse{\n\t\t\t$data['status'] \t\t\t= 'false';\n\t\t\t$data['customerName']\t\t= '';\n\t\t\t$data['customerAddress']\t= '';\n\t\t}\n\n\t\techo json_encode($data);\n\t}", "public function verify(SubmitVerificationCode $request)\n {\n $user = $request->user();\n $verified = false;\n if ($request->code === $user->getMobileVerificationCode() && $user->markMobileAsVerified()) {\n event(new MobileVerified($user));\n $verified = true;\n }\n \n if ($verified) {\n return response()->json([\n 'user' => $user,\n 'message' => __('messages.mobile_is_verified'),\n ]);\n }\n \n if($request->expectsJson() ){\n return response()->json([\n 'errors' => [\n 'code' => [\n __('messages.code_is_wrong')\n ]\n ]\n ],Response::HTTP_UNPROCESSABLE_ENTITY);\n }\n return redirect()->route('verification.mobile.notice');\n }", "public function update_verify_otp(){\n\n // user user-id from session\n $encodedkey = $this->session->userdata('PariKey_session');\n $user_id='';\n $key=base64_decode($encodedkey);\n $keyarr=explode('|', $key);\n //session key format is $keyarr[0]=PARInaayKEY|$keyarr[1]=email_id|$keyarr[2]=user_id\n\n extract($_POST);\n \n // validation\n if(empty($otp_code)){\n $response=array(\n 'status' => 'validation',\n 'message' => '<b>Warning:</b> OTP Code is required!',\n 'field' => 'otp_code'\n );\n echo json_encode($response);\n die();\n }\n $result = $this->user_model->verify_otp($otp_code,$keyarr[2]);\n\n echo json_encode($result);\n}", "public static function reissue_verification() {\n $email = $_POST[\"email\"];\n // Fetch whether the email is verified information\n try {\n $request = DB::query(\"SELECT `Verified` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n\n // Check if the email is actually registered\n if ($request) {\n $verified_status = $request[0][\"Verified\"];\n // Determine whether the email is verified\n if ($verified_status == 1) {\n // Check if users has a password\n try {\n $pass_request = DB::query(\"SELECT `Password` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n if ($pass_request) {\n return 3;\n } else {\n return 4;\n }\n } else {\n // Gather required data \n try {\n $username = DB::query(\"SELECT `Username` FROM `Users` WHERE `Email`=:email;\", array(\":email\" => $email))[0][\"Username\"];\n } catch (PDOException $e) {\n return 1;\n }\n $vercode = sha1(time());\n try {\n DB::query(\"UPDATE `Users` SET Vercode=:ver WHERE Email=:email;\", array(\":ver\" => $vercode, \":email\" => $email));\n } catch (PDOException $e) {\n return 1;\n }\n $to = $email;\n $headers = <<<MESSAGE\nFROM: George || [email protected]\nContent-Type: text/plain;\nMESSAGE;\n $subject = \"Verification code re-issue\";\n $msg = <<<EMAIL\nHi $username,\n\nYou've requested for a new verification code to be issued!\nPlease follow this <a href='https://flatdragons.com/signup.php?user=$username&ver=$vercode'>link</a> to confirm your account with us :)\n\nKind regards,\nGeorge (FlatDragons)\nEMAIL;\n mail($to, $subject, $msg, $headers);\n return 0;\n }\n } else {\n return 2;\n }\n }", "function s2s_callback($x_verify, $phonepe_response){\n $salt_key = $this->credentials.salt_key;\n $_sha256 = hash(\"sha256\", \"$phonepe_response$salt_key\");\n $salt_index = $this->credentials.salt_index;\n if($x_verify != \"$_sha256###$salt_index\"){\n\n }\n return base64_decode($phonepe_response);\n }", "function statement($details,$phone){\n\t$ussd_text=\"CON <br/> Enter your PIN\"; \n ussd_proceed($ussd_text); \n}", "public function settings_verify()\n {\n $method = rcube_utils::get_input_value('_method', rcube_utils::INPUT_POST);\n $timestamp = intval(rcube_utils::get_input_value('_timestamp', rcube_utils::INPUT_POST));\n $success = false;\n\n if ($driver = $this->get_driver($method)) {\n $data = @json_decode(rcube_utils::get_input_value('_data', rcube_utils::INPUT_POST), true);\n if (is_array($data)) {\n foreach ($data as $key => $value) {\n if ($value !== '******') {\n $driver->$key = $value;\n }\n }\n }\n\n $success = $driver->verify(rcube_utils::get_input_value('_code', rcube_utils::INPUT_POST), $timestamp);\n $method = $driver->method;\n }\n\n // put session into high-security mode\n if ($success && !empty($_POST['_session'])) {\n $_SESSION['kolab_2fa_secure_mode'] = time();\n }\n\n $this->api->output->command('plugin.verify_response', array(\n 'method' => $method,\n 'success' => $success,\n 'message' => str_replace('$method', $this->gettext($method),\n $this->gettext($success ? 'codeverificationpassed' : 'codeverificationfailed'))\n ));\n\n $this->api->output->send();\n }", "public function requestCode(Request $request)\n {\n $request->validate([\n 'mobile' => 'required|regex:/^639\\d{9}$/|exists:users,mobile',\n ], [\n 'mobile.regex' => 'Invalid mobile number.', \n ]);\n\n $user = User::where('mobile', $request->mobile)->whereHas('roles', function ($query) {\n $query->whereIn('user_role.role_id', [ 4, 5 ]);\n })\n ->firstOrFail();\n\n try {\n if (env('APP_ENV') != 'production') {\n Notification::send(\n $user, \n new TestNotification(\"ucode for {$user->mobile}: {$user->verification_code}\")\n );\n }\n\n Notification::send($user, new UcodeRequest($user->verification_code));\n } catch (\\Exception $e) {\n logger()->error($e);\n }\n\n return response([\n 'message' => 'Verification code sent.', \n ]);\n }", "function authenticate_user($email_a, $passcode){\r\n\t//QUERY DATABASE/ACTIVE DIRECTORY TO SEE IF USER IS VALID\r\nif ($email == \"insert valid email b4 testing\") {\r\n\t/*** set a form token ***/\r\n\t$form_token = md5( uniqid('auth', true) );\r\n\t/*** set the session form token ***/\r\n\t$_SESSION['form_token'] = $form_token;\r\n\t$_SESSION['email_a'] = $email_a;\r\n\t$_SESSION['start_timestamp'] = date('Y-m-d HH:mm:s');\r\n\t$code = \"valid\";\r\n}else{\r\n\t$code = \"invalid\";\r\n\t}\r\necho return $code \"We were unable to validate your information, Please try again\";\r\n /*RETURNED TO CALLING CODE */\r\n\t}", "public function check_pincode(){\n // $area_id = $_REQUEST['area_id'];\n $pincode = $_REQUEST['pincode'];\n $check_pin = $this->User_Model->check_duplication('',$pincode,'tahsil_pincode_no','tahsil_pincode');\n if($check_pin > 0){\n $response[\"status\"] = TRUE;\n $response[\"msg\"] = 'Valid Pincode';\n } else{\n $response[\"status\"] = FALSE;\n $response[\"msg\"] = 'Invalid Pincode';\n }\n $json_response = json_encode($response,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);\n echo str_replace('\\\\/','/',$json_response);\n }", "public function updateVerificationCode($param) {\n $user = $this->_user->where ( StringLiterals::EMAIL, $this->decodeParam ( $param ) )->first ();\n if (count ( $user ) > 0) {\n $user->otp = '123456';\n $user->save ();\n return true;\n } else {\n\n return false;\n }\n }", "private function checkData() {\n if(!isset(\n $_POST['code'],\n $_POST['field']\n )) {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'wrong request'\n ));\n exit;\n }\n\n if($_POST['field']==='email') {\n $field = 'email';\n }\n elseif($_POST['field']==='phone') {\n $field = 'cellphone';\n }\n else {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'wrong field'\n ));\n exit;\n }\n\n $code=trim($_POST['code']);\n\n $user_id=$this->uSes->get_val('user_id');\n if (isset(\n $_SESSION['uAuth']['profile_update_bg']['change'.$field]['code'],\n $_SESSION['uAuth']['profile_update_bg']['change'.$field]['timestamp'],\n $_SESSION['uAuth']['profile_update_bg']['change'.$field]['password'],\n $_SESSION['uAuth']['profile_update_bg']['change'.$field][$field]\n )) {\n if($field==='cellphone'&&!(int)$this->uFunc->getConf('use MAD SMS to send SMS','content',false)) {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'sms send is not supported'\n ));\n exit;\n }\n\n if($_SESSION['uAuth']['profile_update_bg']['change'.$field]['timestamp']<(time()-300)) {//5min\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'code is expired'\n ));\n exit;\n }\n if($_SESSION['uAuth']['profile_update_bg']['change'.$field]['code']!==$code) {\n print json_encode(array(\n 'status'=>'error',\n 'msg'=>'wrong code'\n ));\n exit;\n }\n\n $password=$_SESSION['uAuth']['profile_update_bg']['change'.$field]['password'];\n\n $value=$_SESSION['uAuth']['profile_update_bg']['change'.$field][$field];\n\n $this->updateEmailOrPhone($user_id,$field,$value,$password);\n\n unset($_SESSION['uAuth']['profile_update_bg']['change'.$field]);\n\n return $value;\n }\n\n print json_encode([\n 'status'=>'error',\n 'msg'=>'code is expired'\n ]);\n exit;\n }", "public function vendor_otp_post(){\n $pdata = file_get_contents(\"php://input\");\n $data = json_decode($pdata,true);\n\n $required_parameter = array('otp','user_id');\n $chk_error = $this->controller->check_required_value($required_parameter, $data);\n if ($chk_error) \n {\n $resp = array('code' => 'MISSING_PARAM', 'message' => 'Missing ' . strtoupper($chk_error['param']));\n @$this->response($resp);\n }\n\n $otp = $data['otp'];\n $user_id = $data['user_id'];\n\n $where = array(\n 'user_id' => $user_id,\n 'otp' => $otp\n ); \n\n $verify = $this->model->getAllwhere('otp_master',$where);\n if(!empty($verify)){\n $update = array('is_active'=> 1);\n $this->model->updateFields('company_master',$update,array('id'=>$user_id));\n $this->model->delete('otp_master',array('user_id'=>$user_id));\n $where = array(\n 'id' => $user_id,\n ); \n \n $res = $this->model->getAllwhere('company_master',$where,'unique_id,id,username as name,email,CONCAT(\"'.base_url().'\",\"asset/uploads/\",profile_pic)AS image,is_active,is_verified,phone_no,user_role,app_folder');\n $resp = array('rccode' => 1, 'message' => ' Login SUCCESS', 'vendor' => $res[0],'is_active'=> $res[0]->is_active,'is_verified'=>$res[0]->is_verified,'user_role'=>$res[0]->user_role,);\n // $resp = array(\n // 'rccode' => 1,\n // 'message' => 'Otp Verify Successfully', \n // );\n }else{\n $resp = array(\n 'rccode' => 2,\n 'message' => 'Please Enter Valid Otp', \n );\n } \n\n $this->response($resp); \n }", "public function validation_phone_number($phone_number,$password){\n\t\t\t// $user_details=$this->db->get('users')->result_array();\n\n\t\t\t$this->db->where('phone_number',$phone_number);\n\t\t\t$this->db->where('password',$password);\n\t\t\t$query = $this->db->get('users');\n\t\t\tif($query->num_rows() > 0 ){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t}", "public function validation_phone_number($phone_number,$password){\n\t\t\t// $user_details=$this->db->get('users')->result_array();\n\n\t\t\t$this->db->where('phone_number',$phone_number);\n\t\t\t$this->db->where('password',$password);\n\t\t\t$query = $this->db->get('users');\n\t\t\tif($query->num_rows() > 0 ){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t}", "function verifiedUser($num, $pid, $td_user)\n{\n\t$db_obj = Db::getInstance()->ExecuteS('SELECT * FROM '.pSQL(_DB_PREFIX_.'sociallogin').' as c WHERE c.id_customer='.\" '$num'\".'\n\tAND c.provider_id='.\" '$pid'\".' LIMIT 0,1');\n\t$verified = $db_obj['0']['verified'];\n\tif ($verified == 1 || $td_user == 'yes')\n\t\treturn true;\n\treturn false;\n}", "public function codeVerificationAction($header_data,$data){\n if( !isset($data['otp_no'])) {\n Library::logging('alert',\"API : codeVerification : \".ERROR_INPUT.\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_INPUT, null);\n } else {\n try {\n $user_id = $header_data['id'];\n $otp_no = $data['otp_no'];\n $user = Users::findById($user_id);\n \n $group = array();\n $db = Library::getMongo();\n $groups = $db->execute('return db.groups.find( { $and: [ { is_active: 1 }, { group_name: \"Friends\" } ] } ).toArray()');\n \n if($groups['ok'] == 0) {\n Library::logging('error',\"API : codeVerification (get groups) mongodb error: \".$groups['errmsg'].\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_REQUEST, null);\n }\n array_push($group,(string)$groups['retval'][0][_id]);\n if($user->otp == $otp_no) {\n if($user->is_active == 1) {\n // user already exist\n } else {\n $user->is_active = 1;\n $user->username = \"user\";\n $user->context_indicator = \"Available\";\n $user->my_mind_groups = $group;\n $user->about_me_groups = $group;\n $user->my_pictures_groups = $group;\n $user->unique_id = strtolower( uniqid() );\n $user->is_edit = 0;\n $user->is_searchable = 1;\n $user->is_mobile_searchable = 1;\n $user->save();\n }\n Library::output(true, '1', OTP_VERIFIED, null);\n } else {\n Library::logging('alert',OTP_WRONG.\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', OTP_WRONG, null);\n }\n } catch (Exception $e) {\n Library::logging('error',\"API : codeVerification : \".$e.\" \".\": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_REQUEST, null);\n }\n }\n }", "function verify () {\n// $aop->alipayrsaPublicKey='MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjUzhXrdJ7GDsgJ59fMLlk7hyYrXkkeGwnYD/eO2HBZh39Y9gTfLJ61Yogc7keOn2uAnZY/zBlw3n+T6mb6/5JYFgvXQi8Qzeh6BkBrNnROu+k4PjhmSbORJFoLrrIxDnsYkQ995kYYhpbS0yf2Al++55v4SrD3/YoVBhWPcRg4xI0QD94FLwhCmcCkft/ILRtUxQk2QeVPLSesvMx2mmUK2L2x2hFA8ewRoGmUdG2Fu9YFIxk//16RI+H7KI8LaoXoVDqHobPae9p0ACE7k9G5vs/cYuikSMKu+lnxghte1jNO+CqrvTP4Pes/mW4e7CEMCTAmEnsXLUrQ6FpfKMcQIDAQAB';\n return $this->aop->rsaCheckV1($_POST, NULL, \"RSA2\");\n }", "function is_mobile_number_registered($mobile,$active){\n //check for users which are active\n if ($active == true){\n $count = Db::rowCount(\"user\",array(\n \"mobile\" => $mobile,\n \"active\" => \"y\",\n \"verified_otp\" => \"y\"\n ),array(\n \"=\",\"=\",\"=\"\n ));\n\n }else{\n //user active status dont matter\n $count = Db::rowCount(\"user\",array(\n \"mobile\" => $mobile\n ),array(\n \"=\"\n ));\n }\n\n return $count == 1 ? true : false;\n}", "public function check_mobile_if_validate($mobile = \"\"){\r\n $query = $this->db->get_where('tblUserInformation', array('mobile' => $mobile));\r\n $row = $query->row_array();\r\n if(!empty($row)){\r\n $v = $this->db->get_where('tbl_user_verification', array('fk_userid' => $row['userid'],'verification_type' => 'SMS','verification_status' => 'VERIFIED'));\r\n $vrow = $v->row_array();\r\n if(!empty($vrow)) return true;\r\n else return false;\r\n }else{\r\n return false;\r\n }\r\n\r\n }", "abstract public function verifyRequest(): void;", "abstract public function verifyRequest(): void;", "public function verifyCode(Request $request)\n {\n $credentials = [\n 'email' => $request->email,\n 'code' => $request->code\n ];\n\n $rules = [\n 'email' => 'exists:ustads',\n 'code' => 'required'\n\n ];\n\n $validation = Validator::make($request->only('email', 'code'), $rules);\n\n if ($validation->fails()) {\n\n return response()->json([\n 'error' => ['code' => 302, 'message' => $validation->messages()->first()],\n ], Response::HTTP_OK);\n\n }\n\n $ustad = ustad::select('*')\n ->where('email', '=', $request->email)\n ->where('code', '=', $request->code)\n ->get()->first();\n\n if ($ustad != null) {\n\n return response()->json([\n 'error' => ['code' => Response::HTTP_OK, 'message' => false],\n 'user' => $ustad->first(),\n ], Response::HTTP_OK);\n\n } else {\n return response()->json([\n 'error' => ['code' => 302, 'message' => \"Code is Wrong\"],\n ], Response::HTTP_OK);\n }\n }" ]
[ "0.7081012", "0.7042071", "0.69467556", "0.69088787", "0.6656038", "0.6648316", "0.6640863", "0.66265166", "0.6513513", "0.6507705", "0.6505614", "0.6425127", "0.638509", "0.6370607", "0.6327103", "0.63181174", "0.62563235", "0.62260467", "0.6206373", "0.61765593", "0.6142251", "0.6080398", "0.60555094", "0.60375506", "0.60273576", "0.6026349", "0.60093325", "0.60078883", "0.6002672", "0.6002478", "0.59891206", "0.5987114", "0.5984133", "0.5939937", "0.59399104", "0.59027606", "0.588707", "0.5884866", "0.58812875", "0.5847468", "0.5832634", "0.5807648", "0.5794169", "0.57687676", "0.57625747", "0.57591414", "0.57398134", "0.5710884", "0.5704304", "0.5692062", "0.56907225", "0.56889313", "0.56847507", "0.566367", "0.566337", "0.5659206", "0.5656902", "0.5643649", "0.5627562", "0.5612169", "0.559094", "0.55877984", "0.557736", "0.5573781", "0.5552636", "0.5538019", "0.5533825", "0.5533458", "0.5519414", "0.5516146", "0.5512277", "0.5503143", "0.54955894", "0.5482681", "0.5480702", "0.5480051", "0.54795325", "0.54794043", "0.547883", "0.5474367", "0.5455959", "0.54555255", "0.54448295", "0.54297835", "0.54166955", "0.54117584", "0.54089046", "0.5406323", "0.5402488", "0.539939", "0.53983504", "0.53983504", "0.5396044", "0.5394393", "0.5390819", "0.53906417", "0.53883505", "0.53648496", "0.53648496", "0.53639215" ]
0.7232017
0
Execute the console command.
public function handle() { $permission = $this->argument('name'); $actions = ['index', 'create', 'view', 'edit', 'delete']; foreach ($actions as $action) { $data = ['name' => $permission . '-' . $action]; Permission::firstOrCreate($data); } return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function handle()\n {\n\t\t$this->info('league fetching ..');\n $object = new XmlFeed();\n\t\t$object->fetchLeague($this->argument('sports_id'));\n\t\t$this->info('league saved');\n }", "public function handle()\n {\n //get us the Converter class instance and call the convert() method on it.\n $this->info(\n \\Aregsar\\Converter\\ConverterFacade::convert($this->argument(\"currency\"))\n );\n }", "public function handle()\n {\n $this->locale = $this->argument('locale');\n\n $this->loadGroupLines();\n\n $this->loadNameSpacedLines();\n\n $this->info('Complete');\n }", "public function handle()\n {\n $this->importUser($this->argument('username'));\n $this->call('ldap:show-user', $this->arguments());\n }", "public function handle() {\n $user = User::where('id', $this->argument('userId'))->first();\n $this->info($user->email);\n }", "public function handle()\n {\n $translations = collect(json_decode(file_get_contents('https://raw.githubusercontent.com/getbible/Bibles/master/translations.json')))->flatten();\n switch($this->argument('action')) {\n case 'fetch':\n $this->fetchBibles($translations);\n break;\n case 'convert':\n $this->convertBibles($translations);\n break;\n }\n }", "public function handle()\n {\n try {\n $evalstr = $this->evaluater->evaluate($this->argument('evalString'));\n $this->info($evalstr);\n } catch (ForbiddenSymbolsException $exception) {\n $this->error($exception->getMessage());\n } catch (IncorrectSymbolsException $exception) {\n $this->error($exception->getMessage());\n }\n }", "public function handle()\n {\n\n $settings = Setting::fetch();\n $id = $this->argument('id');\n $this->scrape_game_data($id);\n }", "public function handle()\n {\n // env('CALENDARINDEX_TOKEN', '6f2bd927201ba4b22bb57df08db0c517e51732de')\n $this->getData($this->argument('country'), $this->argument('region'));\n }", "public function handle()\n {\n $email = $this->argument('email');\n $name = $this->argument('name');\n\n $this->info(\"starting to generate users details\");\n\n }", "public function handle()\n {\n\t\t$this->info('Importing translations...');\n\n\t\t$this->manager->importTranslations(true);\n }", "public function handle()\n {\n $user = null;\n\n if ($email = $this->option(\"email\", false)) {\n $user = $this->findByEmail($email);\n }\n\n if ($id = $this->option(\"id\", false)) {\n $user = $this->findById($id);\n }\n\n if (empty($user)) {\n $this->warn(\"User no found\");\n }\n else {\n $this->setRoleToUser($user);\n }\n }", "public function handle()\n {\n $name = ucwords($this->argument('name'));\n $this->call('repository:contract', [ 'name' => $name ]);\n $this->call('repository:class', [ 'name' => $name, '--driver' => $this->option('driver') ]);\n }", "public function handle()\n\t{\n\t\t// Superuser\n\t\tif( ! $this->option('no-superuser'))\n\t\t\t$this->call('setup:superuser');\n\n\t\t// Countries\n\t\tif( ! $this->option('no-countries'))\n\t\t\t$this->call('setup:countries', ['country' => array_filter(explode(',', $this->option('countries')))]);\n\n\t\t// Languages\n\t\tif( ! $this->option('no-languages'))\n\t\t\t$this->call('setup:languages', ['language' => array_filter(explode(',', $this->option('languages')))]);\n\n\t\t// Currencies\n\t\tif( ! $this->option('no-currencies'))\n\t\t\t$this->call('setup:currencies', ['currency' => array_filter(explode(',', $this->option('currencies')))]);\n\n\t\t// Clear cache\n\t\t$this->call('cache:clear');\n\t}", "public function handle()\n\t{\n\t\t$name = $this->argument('name');\n\t\t\n\t\t$this->info(\"Searching eve api for {$name}\");\n\t\t$result = Corporation::searchEVEAPI($name);\n\n\t\t$this->info(\"results\");\n\t\tforeach($result as $corp)\n\t\t{\n\t\t\tprint $corp->name . \" \" . $corp->id . \"\\r\\n\";\n\t\t}\n\t}", "public function handle()\n {\n $user = $this->argument('user');\n $this->info('Display this on the screen, user ' . $user);\n return 0;\n }", "public function handle()\n {\n $this->userVectors->test($this->option('force'));\n }", "public function handle()\n {\n $mapping = $this->formatMappingName((string)$this->argument('mapping'));\n \n $model = $this->option('model') ? $this->formatModelName($this->option('model')) : null;\n \n $this->filesystem->put(\n $this->buildMappingFilePath($mapping),\n $this->buildMapping(\n $this->getDefaultStub(),\n $mapping,\n $model\n )\n );\n \n $this->composer->dumpAutoloads();\n }", "public function handle()\n {\n switch ($this->argument('type')) {\n case 'dns':\n $this->dnscheck->run($this->option('dry-run') ? true : false, $this->argument('domain'));\n break;\n case 'whois':\n $this->whoischeck->run($this->option('dry-run') ? true : false, $this->argument('domain'));\n break;\n }\n }", "public function handle()\n {\n $option = $this->argument('option');\n\n if (! in_array($option, ['expired', 'all'])) {\n return $this->error('Invalid option supplied to command...');\n }\n\n $this->comment('Beginning pruning process...');\n\n $this->comment($this->pruneDatabase($option) . ' deleted from database...');\n\n $this->comment($this->pruneFiles($option) . ' deleted from files...');\n\n $this->info('Nonces pruned successfully!');\n }", "public function handle()\n {\n $subscriptionUpdateService = new SubscriptionUpdateService();\n $subscriptionUpdateService->runUpdates();\n }", "public function handle()\n\t{\n\t\t\n\t\t$source_directory = $this->argument( 'source_directory' );\n\t\t$target_directory = $this->argument( 'target_directory' );\n\t\t$template = (string) $this->option( 'template' );\n\n\t\t$statik = new \\App\\Statik\\Statik;\n\n\t\t$statik->generateHTMLFiles( $this, $source_directory, $target_directory, $template ) && $this->info( \"\\e[1;32mDONE!\" );\n\n\t}", "public function handle()\n {\n if (!$this->argument('file')) {\n $this->info('Please specify file to call.');\n }\n\n $file = $this->argument('file');\n\n if (!$this->fileHandler->exists($file)) {\n $this->info('Wrong path or file not exist.');\n }\n\n $this->executeFile($file);\n }", "public function handle()\n {\n $user = $this->argument('user');\n $this->scanner->setUserName($user);\n $this->scanner->scanUser();\n }", "public function handle()\n {\n if ($this->argument('user')) {\n $userId = $this->argument('user');\n\n $this->info(\"Liquidate affiliate commission for user \" . $userId);\n\n $user = $this->userService->findById($userId);\n\n if ($user) {\n $this->walletService->liquidateUserBalance($user);\n } else {\n $this->error(\"User not found\");\n }\n\n $this->info(\"Done\");\n } else {\n $this->info(\"Liquidate all commissions\");\n\n $this->walletService->liquidateAllUsersBalance();\n\n $this->info(\"Done\");\n }\n }", "public function handle()\n {\n $action = $this->choice('what action do you have on mind', [\n 'add-relation', 'remove-columns', 'column-type', 'rename-column'\n ]);\n switch ($action) {\n case 'add-relation':\n $this->addRelation();\n break;\n\n case 'remove-columns':\n $this->removeColumns();\n break;\n case 'column-type':\n $this->columnType();\n break;\n case 'rename-column':\n $this->renameColumn();\n break;\n default:\n $this->error('Unsupported action requested...');\n }\n $this->info('Command executed successfully');\n }", "public function handle()\n {\n $arguments = $this->arguments();\n $storageDir = $arguments['storageDir'];\n $localStorageDir = $arguments['localStorageDir'];\n $url = $arguments['url'];\n $cmd = sprintf(\"./app/Console/Commands/ShellScripts/screen_shot.sh %s %s %s\", $storageDir, $localStorageDir, $url);\n\n while (true) {\n $result = shell_exec($cmd);\n print_r($result);\n sleep(3);\n }\n }", "public function handle()\n {\n $city = $this->argument('city');\n\n $weatherService = new CurrentWeatherService();\n try {\n $weather = $weatherService->getByCity($city);\n } catch (WeatherException $e) {\n $this->error($e->getMessage());\n return;\n }\n\n $this->info('Weather for city '.$city);\n dump($weather->toArray());\n }", "public function handle()\n {\n $this->getModels($this->argument('model'));\n $this->getLanguages($this->argument('locale'));\n $this->createMultiLanguageRecords();\n }", "public function handle()\n {\n $this->processOptions();\n\n echo json_encode( $this->dateTimeRange ) . \"\\n\";\n\n $this->dispatch( new ProcessNewActionsJob(\n $this->dateTimeRange ,\n str_random( 16 ),\n $this->option('runtime-threshold')\n ) );\n }", "public function handle()\n {\n $fightId = $this->argument('fight_id');\n $metricId = $this->argument('metric_id');\n //$strategyName = 'App\\\\'.$this->argument('metric_name');\n\n $metric = BossMetric::find($metricId);\n if ($metric === null) {\n $this->error(\"Error: no metric with id: $metricId found!\");\n return;\n }\n\n $fight = Fight::find($fightId);\n\n if ($fight === null) {\n $this->error(\"Error: no fight with id: $fightId found!\");\n return;\n }\n\n $strategy = $metric->getStrategy();\n $strategy->setFight($fight);\n $strategy->run();\n }", "public function handle()\n {\n\t\t$this->call('vendor:publish');\n\t\t$this->call('migrate');\n\t\t$this->call('db:seed');\n\t\t$this->call('factotum:storage');\n\t\t$this->call('factotum:storage');\n }", "public function handle()\n {\n $user_id = $this->argument('user') ?? null;\n\n if (is_null($user_id)) {\n $users = User::all();\n\n foreach ($users as $user) {\n $this->showUserBalance($user);\n }\n } else {\n $user = User::find($user_id);\n\n $this->showUserBalance($user);\n }\n }", "public function handle()\n {\n $this->capsuleService->getAll();\n $this->line('Command Worked');\n }", "public function handle()\n {\n $platform_wechat_id = $this->argument('id');\n $customer_id = $this->argument('customer_id');\n $this->info(\"Starting at \".date('Y-m-d H:i:s').\". Running initial for 【{$this->signature}】\");\n $this->getUserInfoList($platform_wechat_id,$customer_id);\n $this->info(\"End at \".date('Y-m-d H:i:s').\". over for 【{$this->signature}】\");\n }", "public function handle()\n {\n $this->publishAssets();\n $this->call('twill:flush-manifest');\n $this->call('view:clear');\n }", "public function handle()\n {\n \n $argument = $this->argument('data');\n \n $this->prepare( $argument );\n \n $this->make();\n \n $this->info( 'migration has been created : '. $this->fileName );\n \n }", "public function handle()\n {\n chdir(resource_path('assets/ts'));\n $path = $this->argument(\"path\");\n if(isset($path))\n {\n Logger::info('execute '.$path);\n Command::executeRaw('tsc', [\"-p\", $path]);\n }else\n Logger::info('execute tsc');\n Command::executeRaw('tsc');\n }", "public function handle()\n {\n $this->info('Starting date change command.');\n\n Word::where('language_id', 1)->update(array('created_at' => '1970-01-01 00:00:01'));\n Word::where('language_id', 2)->update(array('created_at' => '1970-01-01 00:00:01'));\n\n $this->info('Dates have been changed to 1970-01-01 00:00:01');\n }", "public function handle()\n {\n $this->info($this->slugger->encode($this->argument('id')));\n }", "public function handle()\n {\n $this->line(static::$logo);\n $this->line('Neat admin current version:' . Neat::version());\n\n $this->comment('');\n $this->comment('Available commands:');\n\n $this->listAvailableCommands();\n }", "public function handle()\n {\n $this->revisions->updateListFiles();\n }", "public function handle(): void\n {\n // Set argument\n $this->url = $this->argument(self::URL_ARGUMENT);\n\n // Handler takes care of computation\n (new CommandHandler($this))->compute();\n }", "public function handle()\n {\n try\n {\n $filename = $this->argument('filename');\n Excel::import(new ObjectsImport, $filename);\n\n $this->info('Data import is now completed');\n }\n catch(Exception $ex)\n {\n $this->error($ex->getMessage());\n }\n }", "public function handle() {\n $entity = $this->validateEntity($this->argument('entity'));\n $job = new DataProcessingJob($entity, str_random(16));\n $this->dispatch($job);\n }", "public function handle()\n {\n $isProductionMode = 'prod' == $this->argument('mode');\n\n if ($isProductionMode) {\n if (!$this->confirm('Are you sure to run in production mode? Running this command may cause critical issues?')) {\n exit(1);\n }\n }\n\n $this->_recalculate($isProductionMode);\n }", "public function handle()\n {\n if(!$this->verify()) {\n $rank = $this->createRankSuperAdmin();\n $user = $this->createUserSuperAdmin();\n $user->Ranks()->attach($rank);\n $this->line('Felicitaciones');\n } else {\n $this->error('No se puede ejecutar');\n }\n }", "public function handle()\n {\n // Get CLI Input\n $user_id = $this->option(\"uid\");\n\n // User Products\n ( new CommandManager() )->showUserProducts( $user_id );\n }", "public function handle()\n {\n $force = $this->option('force');\n\n if($this->option('without-bulk')){\n $this->withoutBulk = true;\n }\n\n if ($this->generateClass($force)){\n $this->info('Generating permissions for '.$this->modelBaseName.' finished');\n }\n }", "public function handle()\n {\n $tournaments = Tournament::all()->toArray();\n foreach ($tournaments as $tournament) {\n $slug = $this->tournamentRepoObj->generateSlug($tournament['name'].Carbon::createFromFormat('d/m/Y', $tournament['start_date'])->year,'');\n DB::table('tournaments')\n ->where('id', $tournament['id'])\n ->update([\n 'slug' => $slug\n ]);\n }\n $this->info('Script executed.');\n }", "public function handle()\n {\n $userId = $this->argument('user');\n\n /** @var User $user */\n $user = User::findOrFail($userId);\n\n // Get token.\n $info = (new Client())->auth();\n\n // Save to db.\n $user->access_token = $info['access_token'];\n $user->access_secret = $info['access_secret'];\n $user->save();\n\n $this->line(\"Saved access token and secret for user: {$user->email}\");\n }", "public function handle()\n {\n $m = new MemberFromText;\n $m->train();\n $id = $m->predict($this->argument('text'));\n dump(Miembro::find($id)->toArray());\n }", "public function handle()\n {\n $this->generator\n ->setConsole($this)\n ->run();\n }", "public function handle()\n {\n $this->createController();\n $this->createServiceDir();\n\n exit;\n $args = [\n '--provider' => TestProvider::class\n ];\n $className = $this->argument('className');\n if (!$className) {\n $className = 'MethodsList';\n }\n $className = ucwords($className);\n $this->call('vendor:publish', $args);\n $this->info('Display this on the screen ' . $className);\n }", "public function handle()\n {\n $this->createDirectories();\n\n $this->publishTests();\n\n $this->info('Authentication tests generated successfully.');\n }", "public function handle()\n {\n $this->setDbConnection(\n $this->input->getOption('database') ?: config('ghost-database.default_connection')\n );\n\n $native = $this->input->getOption('native-import') ?: config('ghost-database.use_native_importer');\n\n $snapshot = $this->import($native);\n\n $this->info(\"Snapshot `{$snapshot->name}` loaded!\");\n }", "public function handle()\n {\n $exec = $this->argument('exec');\n\n switch ($exec) {\n case 'download' :\n $this->download();\n break;\n\n case 'generate' :\n $this->generate();\n break;\n\n default :\n echo \"Choose 'download' or 'generate' for this command\";\n break;\n }\n }", "public function handle()\n {\n $this->call('ziggy:generate', ['path' => './resources/js/ziggy-admin.js', '--group' => 'admin']);\n $this->call('ziggy:generate', ['path' => './resources/js/ziggy-frontend.js', '--group' => 'frontend']);\n $this->call(TranslationsGenerateCommand::class);\n }", "public function handle()\n {\n $tenantName = $this->argument('tenant');\n\n $tenant = Tenant::where('name', $tenantName)->orWhere('subdomain', $tenantName)->first();\n\n if ($tenant) {\n $tenant->setActive();\n \\Artisan::call('tinker');\n } else {\n $this->error('Error: Tenant not found');\n }\n }", "public function handle()\n {\n try {\n if (!empty($userId = $this->argument('user'))) {\n $user = User::find($userId);\n } else {\n $user = User::inRandomOrder()->first();\n }\n\n if (empty($user)) {\n throw new \\Exception('User not found');\n }\n\n echo JWTAuth::fromUser($user);\n } catch (\\Exception $e) {\n echo $e->getMessage();\n }\n\n }", "public function handle()\n {\n $this->fetchAndSetToken();\n $imagesToDownload = $this->peekImages(WatchedApp::pluck('package_name'));\n $this->fetchImages($imagesToDownload);\n\n if ($this->option('dont-optimize')) {\n return;\n }\n\n $this->runOptimizeCommand();\n }", "public function handle()\n {\n $this->setCryptIVFromUrl($this->argument('url'));\n\n $participant = URLParser::parseByName('santa.index', $this->argument('url'))->participant;\n if($participant) {\n $draw = $participant->draw;\n } else {\n $draw = URLParser::parseByName('organizer.index', $this->argument('url'))->draw;\n }\n\n $this->table(\n ['ID', 'Name', 'Email'],\n $draw->participants()->get(['id', 'name', 'email'])->toArray()\n );\n }", "public function handle()\n {\n // if you are on the local environment\n if (!(app()->isLocal() || app()->runningUnitTests())) {\n $this->error('This command is only available on the local environment.');\n return;\n }\n\n $fqdn = $this->argument('fqdn');\n if ($tenant = Tenant::retrieveBy($fqdn)){\n $tenant->delete($fqdn);\n $this->info(\"Tenant {$fqdn} successfully deleted.\");\n }else {\n $this->error('This fqdn doesn\\'t exist.');\n }\n\n }", "public function handle()\n {\n $user_from = $this->option('from');\n $user_to = $this->option('to');\n $sum = $this->option('sum');\n\n CreateTransaction::dispatch($this->usersRepository->getByID($user_from), $this->usersRepository->getByID($user_to), $sum, true);\n $this->transactionsRepository->getAll()->each(function ($transaction){\n \tExecuteTransaction::dispatch($transaction);\n });\n }", "public function handle()\n {\n $this->warn('Starting Retrieve Data');\n\n PeopleService::retrieveData();\n\n $this->info('Retrieve Data Completed');\n }", "public function handle()\n {\n \n $period = $this->option('period');\n \n switch ($period) {\n\n case 'half_month':\n $this->info('Grabing Half Month Income...');\n $this->halfMonth();\n break;\n\n case 'monthly':\n $this->info('Grabing Monthly Income...');\n $this->monthly();\n break;\n \n default:\n $this->info('Grabing Daily Income...');\n $this->daily();\n break;\n\n }\n\n \n }", "public function handle()\n {\n $countryFiles = $this->getFiles();\n\n foreach ($countryFiles as $fileName) {\n $this->seed($fileName);\n }\n\n $this->info('End.');\n }", "public function fire()\n {\n $entityName = $this->argument('entityName');\n $startEntityId = $this->argument('startEntityId');\n $endEntityId = $this->argument('endEntityId');\n $depth = $this->argument('depth');\n\n $this->fixturePath = $this->option('outputPath');\n\n $this->info(\"Generating fixtures for $entityName in {$this->fixturePath}...\");\n \n $this->generateFixtures($entityName, $startEntityId, $endEntityId, $depth);\n }", "public function handle()\n {\n $check = PublishTraitsService::publishTraits();\n\n if ($check)\n {\n $this->info('All files have been published');\n }\n\n $this->info('Failed to publish');\n }", "public function handle()\n {\n $user = User::where('username', $this->argument('user'))\n ->orWhere('email', $this->argument('user'))\n ->first();\n\n if ($user != null) {\n $user->assign('admin');\n $this->line(\"{$user->email} was successfully made an admin.\");\n } else {\n $this->line(\"No user found where username or email is '{$this->argument('user')}'\");\n }\n }", "public function handle()\n {\n event( 'laraview:compile' );\n $this->checkForSelectedViewGeneration();\n\n app( RegisterBlueprint::class )\n ->console( $this )\n ->generate();\n }", "public function handle()\n {\n $project = Project::with(['team.admins', 'team.members'])->findOrFail($this->option('project-id'));\n $user = User::findOrFail($this->option('user-id'));\n if ($this->option('admin')) {\n $project->team->admins()->syncWithoutDetaching($user);\n } else {\n $project->team->members()->syncWithoutDetaching($user);\n }\n return Command::SUCCESS;\n }", "public function handle() {\n try {\n $this->roomService->loadRoomOccupations();\n Log::notice('untis:occupations executed successfully.');\n $this->line('Loaded room occupations from WebUntis.');\n } catch (Exception $e) {\n Log::error('Error loading room occupations.', ['exception' => $e]);\n $this->error('Error loading room occupations: ' . $e->getMessage());\n }\n }", "public function handle()\n {\n $this->loadIxList();\n $this->loadIxMembersList();\n $this->updateIxInfo();\n $this->updateIxMembersInfo();\n }", "public function handle()\n {\n $this->call('vendor:publish', [\n '--provider' => \"Qoraiche\\MailEclipse\\MailEclipseServiceProvider\",\n ]);\n }", "public function handle()\n\t{\n\t\tif ($this->option('dev')) {\n\t\t\tsystem('php '.base_path('.deploy/deploy-dev.php'));\n\t\t} else {\n\t\t\tsystem('php '.base_path('.deploy/deploy.php'));\n\t\t}\n\t}", "public function handle(Command $command);", "public function handle(Command $command);", "public function handle()\n {\n $date_from = $this->argument('date_from');\n\t\t$date_to = $this->argument('date_to');\n\t\tif(!$date_from) {\n\t\t\t$date_from = Carbon::today()->subDays(5);\n\t\t}\n\t\tif(!$date_to) {\n\t\t\t$date_to = Carbon::yesterday();\n\t\t}\n\t\tStats::computeMembers($this->argument('venue_id'), $date_from, $date_to);\n }", "public function handle()\n {\n switch ($this->argument('type')){\n case 'fih':\n $scrapper = new Scrappers\\FederationScrapper();\n $scrapper->get($this->option('level'));\n print $scrapper->message();\n break;\n }\n }", "public function handle()\n {\n Log::info(\"seed:dash Command is working fine!\");\n $this->info('Dashboard Database seeding completed successfully.');\n }", "public function handle()\n {\n $originalId = $this->argument('original_id');\n\n $status = true;\n if ($this->option('status') === 'false') {\n $status = false;\n }\n\n if ($video = Video::where('original_id', $originalId)->first()) {\n $video->dmca_claim = $status;\n $video->save();\n\n $this->info('Video\\'s dmca_claim set to: ' . json_encode($status));\n return ;\n }\n\n $this->error('No video found with original_id of: ' . $originalId);\n return;\n }", "public function handle()\n {\n $this->call('config:clear');\n\n $this->call('config:update');\n\n $this->info('Configuration cached successfully!');\n }", "public function handle()\n {\n //\n $modelName = $this->argument('model');\n $column = $this->argument('column');\n $this->generateMutation($modelName, $column);\n\n }", "public function handle()\n {\n $filePath = 'public/' . $this->argument('fileName');\n $count = $this->argument('count');\n \n $fileData = array_slice(file($filePath), 0, $count);\n $this->info(implode('', $fileData));\n }", "public function handle()\n {\n $email = $this->argument('email');\n\n Mail::to($email)->send(new SendMailable('Test Mail'));\n\n if (Mail::failures()) {\n $this->info('Email failed to send');\n } else {\n $this->info('Email successfully sent');\n }\n }", "public function handle()\n {\n $this->call('route:trans:clear');\n\n $this->cacheRoutesPerLocale();\n\n $this->info('Routes cached successfully for all locales!');\n }", "public function handle()\n {\n $this->info('Welcome to command for Bantenprov\\WilayahIndonesia package');\n }", "public function handle()\n {\n if($this->hasOption('no_dump') && $this->option('no_dump')){\n $this->composer_dump = false;\n }\n $this->readyDatas();\n $this->datas['startSymbol']='{{';\n $this->datas['endSymbol']='}}';\n $this->create();\n }", "public function handle()\n {\n $repository = new OglasiCrawlerRepository();\n $ads = $repository->getAds();\n $repository->saveAds($ads);\n\n echo 'Ads were successfully retrieved' . PHP_EOL;\n }", "public function handle()\n {\n $this->makeDir($this->basePath . $this->kebabPlural());\n\n $this->exportViews();\n\n $this->info('Resource views generated successfully.');\n }", "public function handle()\n {\n $movies = \\App\\Models\\Movie::whereNull('meta')->take(40)->orderBy('id')->get();\n $movies->each(function($movie){ sleep(1); $movie->getMeta(); });\n return Command::SUCCESS;\n }", "public function handle()\n {\n $this->packageGenerator->setConsole($this)\n ->setPackage($this->argument('package'))\n ->setType('shipping')\n ->setForce($this->option('force'))\n ->generate();\n }", "public function handle()\n {\n $test = $this->argument('test');\n\n $dir = config('speed-test.dir');\n\n $className = ucfirst(\\Str::camel($test));\n\n $namespace = config('speed-test.namespace');\n\n $class = class_entity($className)\n ->namespace($namespace);\n\n $class->method('speed1')\n ->line($this->option('line'))->doc(function ($doc) use ($className) {\n /** @var DocumentorEntity $doc */\n $doc->tagCustom('times', $this->option('times'));\n $doc->description($this->option('description') ?: \"{$className} Speed 1\");\n });\n\n if (! is_dir($dir)) {\n mkdir($dir, 0777, 1);\n }\n\n file_put_contents(\n $dir.'/'.$className.'.php',\n $class->wrap('php')\n );\n\n $this->info('Speed created!');\n\n return 0;\n }", "public function handle()\n {\n $message = $this->GenerateRandomUser($this->argument('count'));\n $this->info($message);\n }", "public function handle()\n {\n $host = Cache::get('executingHost', null);\n $this->info(\"Host: ${host}\");\n\n if ($host === null) {\n $this->info('実行するホストが選択されていません');\n return;\n }\n\n if (Schema::hasTable('companies') && Company::count() !== 0) {\n $this->info('マイグレーションが既に1回以上実行されています');\n return;\n }\n\n $should_execute = $host === $this->argument('executingHost');\n\n if ($should_execute) {\n Artisan::call('migrate:fresh', ['--seed' => true]);\n $this->info('マイグレーションが完了しました');\n\n Cache::forget('executingHost');\n } else {\n $this->info('別ホストにてマイグレーションが行われます');\n }\n }", "public function handle()\n {\n // Configuration...\n $this->callSilent('vendor:publish', ['--tag' => 'model-login-config']);\n\n // Migrations\n $this->callSilent('vendor:publish', ['--tag' => 'model-login-migrations']);\n\n $this->info('Model Login resources published.');\n }", "public function handle()\n {\n if ($this->validation()) {\n $money = $this->argument('money');\n Cache::increment('amount', $money);\n }\n }", "public function handle()\n {\n $this->info('Publishing stuff..');\n\n $this->publishFiles();\n\n $this->info('Setup complete. Enjoy!');\n }", "public function handle()\n {\n $this->publishConfig();\n $this->publishClassStub();\n $this->generateAndStoreKey();\n\n $this->info('Use the details below for your \"Lead delivery options\" in Google Ads.');\n $this->info('Webhook URL: ' . route('GoogleAdsLeadExtensionController@index'));\n $this->info('Key: ' . $this->generated_key);\n }", "public function handle()\n {\n $opts = $this->options();\n $args = $this->arguments();\n #print_r($opts);\n #print_r($args);\n\n # Redundant as argument validation handled by Laravel\n #\n if (!isset($args['destination'])) {\n printf(\"Usage: php artisan %s\\n\", $this->signature);\n exit(1);\n }\n\n # Default to normal message type\n #\n if (!isset($opts['type'])) {\n $opts['type'] = 'normal';\n }\n\n $uac = new UserApiController();\n\n if ($opts['type'] == 'normal') {\n if (!isset($opts['message'])) {\n printf(\"Usage: php artisan %s\\n\\n\", $this->signature);\n printf(\"ERROR: Message must be specified for type 'normal'\\n\");\n exit(1);\n }\n $result = $uac->sendSms(\n $args['destination'],\n $opts['message'],\n $opts['route']\n );\n }\n else if ($opts['type'] == 'otp') {\n $result = $uac->sendVerificationSms(\n $args['destination'],\n '<code>',\n '<name>',\n $opts['route'],\n '<appName>'\n );\n }\n\n if ($result === true) {\n printf(\"INFO: SMS message to %s sent successfully (%s)\\n\",\n $args['destination'], $opts['type']);\n }\n else {\n printf(\"INFO: SMS message to %s failed to send (%s)\\n\", \n $args['destination'], $opts['type']);\n printf(\"ERROR: %s\\n\", $result);\n }\n\n return;\n }" ]
[ "0.6469962", "0.6463639", "0.64271367", "0.635053", "0.63190264", "0.62747604", "0.6261977", "0.6261908", "0.6235821", "0.62248456", "0.62217945", "0.6214421", "0.6193356", "0.61916095", "0.6183878", "0.6177804", "0.61763877", "0.6172579", "0.61497146", "0.6148907", "0.61484164", "0.6146793", "0.6139144", "0.61347336", "0.6131662", "0.61164206", "0.61144686", "0.61109483", "0.61082935", "0.6105106", "0.6103338", "0.6102162", "0.61020017", "0.60962653", "0.6095482", "0.6091584", "0.60885274", "0.6083864", "0.6082142", "0.6077832", "0.60766655", "0.607472", "0.60739267", "0.607275", "0.60699606", "0.6069931", "0.6068753", "0.6067665", "0.6061175", "0.60599935", "0.6059836", "0.605693", "0.60499364", "0.60418284", "0.6039709", "0.6031963", "0.6031549", "0.6027515", "0.60255647", "0.60208166", "0.6018581", "0.60179937", "0.6014668", "0.60145515", "0.60141796", "0.6011772", "0.6008498", "0.6007883", "0.60072047", "0.6006732", "0.60039204", "0.6001778", "0.6000803", "0.59996396", "0.5999325", "0.5992452", "0.5987503", "0.5987503", "0.5987477", "0.5986996", "0.59853584", "0.5983282", "0.59804505", "0.5976757", "0.5976542", "0.5973796", "0.5969228", "0.5968169", "0.59655035", "0.59642595", "0.59635514", "0.59619296", "0.5960217", "0.5955025", "0.5954439", "0.59528315", "0.59513766", "0.5947869", "0.59456027", "0.5945575", "0.5945031" ]
0.0
-1
Specifies the list of events to listen
public function getSubscribedEvents() { return array( 'prePersist', 'preUpdate' ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function listeners($event);", "public function listeners($eventName);", "protected function setSwooleServerListeners()\n {\n foreach ($this->events as $event) {\n $listener = Str::camel(\"on_$event\");\n $callback = method_exists($this, $listener) ? [$this, $listener] : function () use ($event) {\n $this->triggerEvent($event, func_get_args());\n };\n\n $this->getServer()->on($event, $callback);\n }\n }", "protected static function events()\n {\n foreach (self::fetch('app/events', false) as $file) {\n Bus::need($file);\n }\n //\n Event::register();\n }", "protected static function allowedEvents()\n\t{\n\t\treturn array();\n\t}", "protected function setSwooleServerListeners()\n {\n foreach ($this->events as $event) {\n $listener = 'on' . ucfirst($event);\n\n if (method_exists($this, $listener)) {\n $this->server->on($event, [$this, $listener]);\n } else {\n $this->server->on($event, function () use ($event) {\n $event = sprintf('swoole.%s', $event);\n\n $this->container['events']->fire($event, func_get_args());\n });\n }\n }\n }", "public function setEvents(array $events)\n\t{\n\t\t$this->events = $events;\n\t}", "public static function events();", "public function getSubscribedEvents();", "public static function getSubscribedEvents();", "public static function getSubscribedEvents();", "protected function setEvents()\n {\n foreach ($this->preloadList as $preload) {\n include_once XOOPS_ROOT_PATH . '/modules/' . $preload['module'] . '/preloads/' . $preload['file']. '.php';\n $class_name = ucfirst($preload['module'])\n . ($preload['file'] == 'preload' ? '' : ucfirst($preload['file']) )\n . 'Preload';\n if (!class_exists($class_name)) {\n continue;\n }\n $class_methods = get_class_methods($class_name);\n foreach ($class_methods as $method) {\n if (strpos($method, 'event') === 0) {\n $event_name = strtolower(str_replace('event', '', $method));\n $event= array($class_name, $method);\n $this->eventListeners[$event_name][] = $event;\n }\n }\n }\n }", "protected function registerEvents()\n {\n $events = $this->app->make(Dispatcher::class);\n\n foreach ($this->events as $event => $listeners) {\n foreach ($listeners as $listener) {\n $events->listen($event, $listener);\n }\n }\n }", "private static function get_events() {\n\t\treturn array(\n\t\t\t'formidable_send_usage' => 'weekly',\n\t\t);\n\t}", "private function listeners()\n {\n foreach ($this['config']['listeners'] as $eventName => $classService) {\n $this['dispatcher']->addListener($classService::NAME, [new $classService($this), 'dispatch']);\n }\n }", "protected function registerEvents(): void\n {\n $events = $this->app->make(Dispatcher::class);\n\n foreach ($this->events as $event => $listeners) {\n foreach ($listeners as $listener) {\n $events->listen($event, $listener);\n }\n }\n }", "public function enableSocketEvents()\n\t{\n foreach ($this->socketEvents as $ev)\n\t\t{\n event_base_set($ev, Daemon::$process->eventBase);\n event_add($ev, $this->config->ev_timeout->value); // With specified timeout\n }\n }", "public function send_events()\n {\n }", "public static function eventSubscriptions() : iterable;", "protected function registerInputEvents() {\n\t\t$this->getEventLoop()->addEventListener('HANG', function($event) {\n\t\t\t// Update our state\n\t\t\t$this->offHook = (bool)$event['value'];\n\n\t\t\t// Trigger specific events for receiver up and down states\n\t\t\t$eventName = $this->isOffHook() ? 'RECEIVER_UP' : 'RECEIVER_DOWN';\n\t\t\t$this->fireEvents($eventName, $event);\n\t\t});\n\n\t\t$this->getEventLoop()->addEventListener('TRIG', function($event) {\n\t\t\t// Update our state\n\t\t\t$this->dialling = (bool)$event['value'];\n\t\t});\n\n\t\t// Proxy registration for all EventLoop events to pass them back up to our own listeners\n\t\t$this->getEventLoop()->addEventListener(true, function ($event, $type) {\n\t\t\t// Fire event to our own listeners\n\t\t\t$this->fireEvents($type, $event);\n\t\t});\n\t}", "public function listenForEvents()\n {\n Event::listen(DummyEvent::class, DummyListener::class);\n\n event(new DummyEvent);\n }", "public static function getSubscribedEvents() {\n return [];\n }", "public function events()\r\n\t{\r\n\t\treturn array_merge(parent::events(), array(\r\n\t\t\t'onBeginRequest'=>'beginRequest',\r\n 'onEndRequest'=>'endRequest',\r\n\t\t));\r\n\t}", "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 static function getSubscribedEvents()\n {\n return array(\n CollectSettingOptionsEvent::NAME => array('handler', 1000),\n );\n }", "public static function getSubscribedEvents()\n {\n return array(\n CollectSettingOptionsEvent::NAME => array('handler', 1000),\n );\n }", "public function listen();", "public function getEvents();", "public function getEvents();", "public function listen($events, $listener = null): void;", "public static function __events () {\n \n }", "public function setEventListeners(array $eventListeners)\n {\n $this->eventListeners = $eventListeners;\n }", "private static function event()\n {\n $files = ['Event', 'EventListener'];\n $folder = static::$root.'Event'.'/';\n\n self::call($files, $folder);\n\n $files = ['ManyListenersArgumentsException'];\n $folder = static::$root.'Event/Exceptions'.'/';\n\n self::call($files, $folder);\n }", "public static function getSubscribedEvents()\n {\n return array(\n KernelEvents::REQUEST => 'onMatchRequest'\n );\n }", "function getEvents() {\n return [];\n }", "public static function getEvents(): array\n {\n return is_array(static::$events) ? static::$events : [static::$events];\n }", "public function setEvents($events, $format = false)\n {\n $this->_events = $events;\n if ($format !== false)\n $this->_format = $format;\n ksort($this->_events);\n }", "public function listeners(Listeners $listeners = null);", "public static function getSubscribedEvents()\n {\n return array(\n DefaultEvents::default_pre_index => 'onCustomListener',\n DefaultEvents::default_pre_index => 'onCustomListener',\n OtherEvents::other_pre_index => 'onCustomListener',\n OtherEvents::other_pox_index => 'onCustomListener'\n );\n }", "protected function setListeners()\n\t{\n\t\t$this->templates->listenEmitBasic('foreach', array($this, 'tpl_foreach'));\n\t\t$this->templates->listenEmitBasic('not-last', array($this, 'tpl_not_last'));\n\t}", "public function attachEvents();", "public function attachEvents();", "public function getSubscribedEvents()\n {\n return [FeedFacade::FEED_EVENT];\n }", "protected static function allowedEvents()\n\t{\n\t\treturn array(\n\t\t\t\t\t\t'onclick',\n\t\t\t\t\t\t'ondblclick',\n\t\t\t\t\t\t'onmousedown',\n\t\t\t\t\t\t'onmouseup',\n\t\t\t\t\t\t'onmouseover',\n\t\t\t\t\t\t'onmousemove',\n\t\t\t\t\t\t'onmouseout',\n\t\t\t\t\t\t'onkeypress',\n\t\t\t\t\t\t'onkeydown',\n\t\t\t\t\t\t'onkeyup'\n\t\t\t\t\t);\n\t}", "private static function EventList ()\n {\n return array (\n \"a\" => array (),\n \"button\" => array (\n \"onblur\", \"onclick\", \"ondblclick\",\n \"onfocus\", \"onmousedown\", \"onmousemove\",\n \"onmouseout\", \"onmouseover\", \"onmouseup\",\n \"onkeydown\", \"onkeypress\", \"onkeyup\",\n ),\n );\n }", "public static function getSubscribedEvents(): array\n {\n return [\n KernelEvents::REQUEST => ['onKernelRequest', 110],\n KernelEvents::RESPONSE => ['onKernelResponse', 10],\n ];\n }", "public static function getSubscribedEvents()\n {\n echo 'Test';\n }", "public static function getSubscribedEvents()\n {\n return [\n //Step 4:Classname::ConstantName or event name 'kernel.request' => 'functionameyouliketocall' - onKernelRequest()\n KernelEvents::REQUEST => 'onKernelRequest',\n ];\n }", "public static function getSubscribedEvents()\n {\n return array(\n KernelEvents::REQUEST => array('onKernelRequest', 10), // 10 is before Firewall listener.\n );\n }", "public function broadcastOn()\n {\n return ['RecordChanges'];\n }", "public function setEvents(string $events): self\n {\n $this->options['events'] = $events;\n return $this;\n }", "public function setEvents(string $events): self\n {\n $this->options['events'] = $events;\n return $this;\n }", "public static function getSubscribedEvents(): array\n {\n return [\n LoginActionEvent::NAME => [\n ['flashLoginEvent', self::FLASH_MESSAGE_PRIORITY],\n ['afterLogin'],\n ]\n ];\n }", "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 subscribe(): void\n {\n foreach (static::$eventHandlerMap as $eventName => $handler) {\n $this->events->listen($eventName, [$this, $handler]);\n }\n }", "public function setDispatcherEvents()\n\t{\n\t\t$this->dispatcher = (new Dispatcher())->register($this->routes);\n\t}", "public function setEventTypes(?array $eventTypes): void\n {\n $this->eventTypes['value'] = $eventTypes;\n }", "protected function listenForEvents()\n {\n $callback = function ($event) {\n foreach ($this->logWriters as $writer) {\n $writer->log($event);\n }\n };\n\n $this->events->listen(JobProcessing::class, $callback);\n $this->events->listen(JobProcessed::class, $callback);\n $this->events->listen(JobFailed::class, $callback);\n $this->events->listen(JobExceptionOccurred::class, $callback);\n }", "private function registered_events () {\n\n\t\t$triggers = array();\n\n\t\tforeach( get_option( 'nce_triggers' ) as $trigger => $enabled ) {\n\n\t\t\tif( $enabled == \"1\" ) {\n\n\t\t\t\t$triggers[] = $trigger;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn $triggers;\n\n\t}", "public function setEvents(array $events)\n {\n foreach ($events as $event) {\n $event->ensureStopped();\n }\n\n $this->data['events'] = $events;\n }", "public function events()\n {\n return array_merge(parent::events(), array(\n 'onBeginRequest'=>'beginRequest',\n ));\n }", "public function getListeners(): array;", "public function broadcastOn()\n {\n\n return [];\n }", "public function events($e)\n {\n $values = array(\n 'animationfinish',\n 'error',\n 'onmouseover',\n 'onmouseout',\n 'ready',\n 'select'\n );\n\n if (is_array($e)) {\n foreach ($e as $event) {\n if (is_subclass_of($event, 'Khill\\Lavacharts\\Events\\Event')) {\n $this->events[] = $event;\n } else {\n throw $this->invalidConfigValue(\n __FUNCTION__,\n 'Event'\n );\n }\n }\n } else {\n throw $this->invalidConfigValue(\n __FUNCTION__,\n 'array'\n );\n }\n\n return $this;\n }", "public static function getSubscribedEvents(): array\n {\n return [KernelEvents::EXCEPTION => ['onException', 20]];\n }", "public static function getSubscribedEvents() {\n return [\n ScriptEvents::POST_INSTALL_CMD => 'install',\n ScriptEvents::POST_UPDATE_CMD => 'install',\n ];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }", "public function broadcastOn()\n {\n return [];\n }" ]
[ "0.66679925", "0.6616843", "0.6577618", "0.6517733", "0.6479103", "0.64048636", "0.6392826", "0.6364057", "0.62442756", "0.62316775", "0.62316775", "0.61235845", "0.6062544", "0.6035194", "0.60324657", "0.60220236", "0.60212046", "0.6009963", "0.59433967", "0.59387356", "0.5875759", "0.58574474", "0.58371395", "0.5816116", "0.5808802", "0.5808802", "0.58022696", "0.5779911", "0.5779911", "0.5775977", "0.575845", "0.5756007", "0.57549334", "0.574936", "0.57342094", "0.57164717", "0.5705619", "0.5695175", "0.5664418", "0.56432915", "0.5638935", "0.5638935", "0.56321114", "0.5620022", "0.56069654", "0.5600321", "0.5600023", "0.559914", "0.5597303", "0.55928123", "0.5585643", "0.5585643", "0.55779797", "0.5567296", "0.5566602", "0.5552805", "0.5511206", "0.5503865", "0.5496664", "0.5495041", "0.54887164", "0.5475294", "0.54751366", "0.54749393", "0.5461253", "0.54407924", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622", "0.5439622" ]
0.0
-1
Update flexible fields when a value is updated
protected function updateFlexibleFields(ObjectManager $om, AbstractFlexible $flexible, $fields) { $meta = $om->getClassMetadata(get_class($flexible)); $uow = $om->getUnitOfWork(); $now = new \DateTime('now', new \DateTimeZone('UTC')); $changes = array(); foreach ($fields as $field) { $changes[$field]= array(null, $now); } $uow->scheduleExtraUpdate($flexible, $changes); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _updatefields() {}", "public function testUpdateExtraFields(): void { }", "function updateField() {\n DATABASE::INIT_TABLE($this->database, $this->table);\n $fname = $this->urlParam('fname');\n $fvalue = $this->urlParam('fvalue');\n $id = $this->urlParam('id');\n DATABASE::UPDATE($this->table, [$fname], [$fvalue], $id);\n }", "function acf_update_field($field, $specific = array())\n{\n}", "public function testUpdateReplenishmentCustomFields()\n {\n }", "function update($field, $value, $model)\n {\n }", "public function testUpdateFieldsWrongType(): void { }", "public function onUpdateField()\n {\n //TODO Validate input\n\n $post = post();\n\n $flags = FieldManager::makeFlags(\n in_array('enabled', $post['flags']),\n in_array('registerable', $post['flags']),\n in_array('editable', $post['flags']),\n in_array('encrypt', $post['flags'])\n );\n\n $validation = $this->makeValidationArray($post);\n\n $data = $this->makeDataArray($post);\n\n $feedback = FieldManager::updateField(\n $post['name'],\n $post['code'],\n $post['description'],\n $post['type'],\n $validation,\n $flags,\n $data\n );\n\n FieldFeedback::with($feedback, true)->flash();\n\n return Redirect::to(Backend::url('clake/userextended/fields/manage'));\n }", "public function fieldUpdate()\n\t{\n\t\t$fieldUpdate=array();\n\t\tforeach($this->getTable()->result_array() as $row)\n\t\t{\n\t\t\t$fieldUpdate[]=array(\n\t\t\t\t'field'=>$row['Field'],\n\t\t\t\t'max_length'=>preg_match('/varchar/',$row['Type']) ? (preg_replace('/[A-Za-z()]/','',$row['Type'])!=='' ? '\\'maxlength\\'=>'.preg_replace('/[A-Za-z()]/','',$row['Type']).',' : false) : false,\n\t\t\t\t'type'=>preg_match('/text/',$row['Type']) ? 'Area' : 'Field',\n\t\t\t\t'required'=>$row['Null']=='NO' ? true : false,\n\t\t\t\t'input'=>preg_match('/^(password|pass|passwd|passcode)$/i',$row['Field']) ? 'password' : 'text',\n\t\t\t);\n\t\t}\n\t\treturn $fieldUpdate;\n\t}", "function update_field($field)\n {\n }", "function update_field($field)\n {\n }", "function update_field($field)\n {\n }", "function update_field($field)\n {\n }", "public function testUpdateExternalShipmentCustomFields()\n {\n }", "public function testUpdatePackingPlanCustomFields()\n {\n }", "public function update () {\n reset($this->__fields);\n $pk = key($this->__fields);\n $form = $this->getForm();\n $updates = array();\n\n foreach ($form as $k => $v) {\n $updates[] = sprintf('%s = :%s', $k, $k);\n }\n\n $sql = sprintf(\n 'UPDATE %s SET %s WHERE %s = :%s'\n , $this->getTableName()\n , implode(',', $updates)\n , $pk\n , $pk\n );\n\n $stmt = $this->__db->prepare($sql);\n $stmt->bindValue($pk, $this->__get($pk));\n\n foreach ($form as $k => $v) {\n if (is_object($v->getData()) && get_class($v->getData()) == 'DateTime') {\n $stmt->bindValue($k, $v->getData(), $this->__fields[$k]['type']);\n } else {\n $stmt->bindValue($k, $v->getData());\n }\n }\n\n $stmt->execute();\n\n return $this;\n }", "public function testUpdateOrderCustomFields()\n {\n }", "public function compileUpdates($field = '');", "private function updateUpdatedAtField() {\n foreach (static::getFields() as $field_name => $field) {\n if ($field instanceof UpdatedAtField) {\n $this->$field_name = time();\n }\n }\n }", "protected function update() {}", "abstract public function updateData();", "protected function _update()\n {\n \n }", "protected function _update()\n {\n \n }", "function field_acfe_update($field){\n \n if(!acf_maybe_get($field, 'acfe_update'))\n return $field;\n \n unset($field['acfe_update']);\n \n return $field;\n \n }", "protected function setupUpdateOperation()\n {\n $plugin = $this->crud->getEntryWithLocale($this->crud->getCurrentEntryId());\n\n $fields = $plugin->options;\n\n CRUD::addField(['name' => 'fields', 'type' => 'hidden', 'value' => collect($fields)->implode('name', ',')]);\n\n foreach ($fields as $field) {\n CRUD::addField($field);\n }\n }", "function updateDataField($value)\r\n {\r\n if ($this->_datafield!=\"\")\r\n {\r\n if ($this->_datasource!=null)\r\n {\r\n if ($this->_datasource->Dataset!=null)\r\n {\r\n //Checks for the index fields\r\n $keyfields=$this->Name.\"_key\";\r\n $keys=$this->input->$keyfields;\r\n // Checks if the keys were posted\r\n if (is_object($keys))\r\n {\r\n $fname=$this->DataField;\r\n\r\n //Sets to Edit State\r\n $this->_datasource->Dataset->edit();\r\n\r\n\r\n $values=$keys->asStringArray();\r\n\r\n //Sets the key values\r\n reset($values);\r\n while (list($k,$v)=each($values))\r\n {\r\n $this->_datasource->Dataset->fieldset($k,$v);\r\n }\r\n\r\n //Sets the field value\r\n $this->_datasource->Dataset->fieldset($fname,$value);\r\n }\r\n else $this->_datasource->Dataset->fieldset($this->_datafield,$value);\r\n }\r\n }\r\n }\r\n }", "function update_value($value, $post_id, $field)\n {\n }", "function update_value($value, $post_id, $field)\n {\n }", "function update_value($value, $post_id, $field)\n {\n }", "function update_value($value, $post_id, $field)\n {\n }", "function update_value($value, $post_id, $field)\n {\n }", "function update_value($value, $post_id, $field)\n {\n }", "function update_value($value, $post_id, $field)\n {\n }", "function update_value($value, $post_id, $field)\n {\n }", "function update_value($value, $post_id, $field)\n {\n }", "function update_value($value, $post_id, $field)\n {\n }", "function update_value($value, $post_id, $field)\n {\n }", "function update_value($value, $post_id, $field)\n {\n }", "function update_value($value, $post_id, $field)\n {\n }", "function update_value($value, $post_id, $field)\n {\n }", "function acf_update_value($value = \\null, $post_id = 0, $field)\n{\n}", "public function testUpdateVendorComplianceSurveyCustomFields()\n {\n }", "protected function _update()\n\t{\n\t}", "function update_field( $field ) {\n\n\t\t$fieldKey = $field['key'];\n\n\t\tif ( ! isset( $_POST['acfAddressWidget'][ $fieldKey ] ) ) {\n\t\t\t$fieldKey = $field['ID'];\n\t\t}\n\n\t\t$field['address_options'] = json_decode( stripslashes( $_POST['acfAddressWidget'][ $fieldKey ]['address_options'] ) );\n\t\t$field['address_layout'] = json_decode( stripslashes( $_POST['acfAddressWidget'][ $fieldKey ]['address_layout'] ) );\n\n\t\treturn $field;\n\n\t}", "function brag_rest_update_flamingo( $value, $object, $field_name ) {\n \n\tforeach ($value as $field => $data) {\n\t\tupdate_post_meta( $object->ID, $field, $data );\n\t}\n}", "public function createUpdateStruct();", "public function handleEdit(Request $request){\n $this->validate($request, Field::$create_field_validation_rules);\n $data = $request->only('id','field_key','field_value');\n \t\\DB::table('fields')->where('field_id','=',$data['id'])\n \t ->update(['field_key'=>$data['field_key'],'field_value' => $data['field_value']]); \n \t\\Session::flash('message','Field updated successfully.');\n \treturn redirect()->route('viewfields');\n }", "private function internalUpdate()\n {\n $param = array();\n\n // Run before update methods and stop here if the return bool false\n if ($this->runBefore('update') === false)\n return false;\n\n // Define fieldlist array\n $fieldlist = array();\n\n // Build updatefields\n foreach ( $this->data as $fld => $val )\n {\n // Skip datafields not in definition\n if (!$this->isField($fld))\n continue;\n\n $val = $this->checkFieldvalue($fld, $val);\n $type = $val == 'NULL' ? 'raw' : $this->getFieldtype($fld);\n\n $fieldlist[] = $this->alias . '.' . $fld . '={' . $type . ':' . $fld . '}';\n $param[$fld] = $val;\n }\n\n // Create filter\n $filter = ' WHERE ' . $this->alias . '.' . $this->pk . '={' . $this->getFieldtype($this->pk) . ':' . $this->pk . '}';\n\n // Even if the pk value is present in data, we set this param manually to prevent errors\n $param[$this->pk] = $this->data->{$this->pk};\n\n // Build fieldlist\n $fieldlist = implode(', ', $fieldlist);\n\n // Create complete sql string\n $sql = \"UPDATE {db_prefix}{$this->tbl} AS {$this->alias} SET {$fieldlist}{$filter}\";\n\n // Run query\n $this->db->query($sql, $param);\n\n // Run after update event methods\n if ($this->runAfter('update') === false)\n return false;\n }", "public function updated($field)\n {\n $this->validateOnly($field);\n }", "public function updateModifiedFields($event)\n {\n if($this->shouldAddCreatedAndModifiedFields())\n {\n $this->updateFields('update');\n }\n }", "abstract protected function updateModel();", "function update_fields($fields){\n //\n //Get the indexed columns \n //\n //loop through all the columns in this entity \n foreach ($this->entity->columns as $column) {\n //\n //Get the name of the column\n $name= $column->name;\n //\n //if the column is foreign or primary return\n if($column->type==!'primary' || $column->type==!'foreign' ){\n //\n //Test if the column already exist in the fields array\n //first map the columns to get the column names\n $names= array_map(function ($f){return $f->column->name;}, $fields);\n //\n $enn= array_search($name, $names);\n //\n //If the culumn is an indexed column do nothing if false do the following\n if ($enn === false){\n //\n //Test if it is called a name \n if ($name== 'name'){\n //\n array_push($fields, $column);\n }\n //\n //Test if it is called a description \n if ($name== 'description'){\n //\n array_push($fields, $column);\n }\n //\n //Test if it is called a title \n if ($name== 'title'){\n //\n array_push($fields, $column);\n }\n //\n //Test if it is called a id \n if ($name== 'id'){\n //\n array_push($fields, $column);\n }\n }\n }\n }\n //\n //\n return $fields;\n }", "protected abstract function setFields();", "abstract protected function update ();", "public function updated($field)\n {\n // Solo validamos el campo que genera el update\n $validatedData = $this->validateOnly($field, [\n 'usuario' => 'required',\n 'mensaje' => 'required',\n ]);\n }", "function after_validation_on_update() {}", "function update_field( $field ) {\n\t\t\n\t\t// remove sub fields\n\t\tunset($field['sub_fields']);\n\t\t\n\t\t\t\t\n\t\t// return\t\t\n\t\treturn $field;\n\t}", "function _set_editable_fields()\n\t{\n\t\tif (empty($this->fields))\n\t\t{\n\t\t\t// pull the fields dynamically from the database\n\t\t\t$this->db->cache_on();\n\t\t\t$this->fields = $this->db->list_fields($this->primary_table);\n\t\t\t$this->db->cache_off();\n\t\t}\n\t}", "public function db_update() {}", "public function updateEditableFields() {\n\t\t$allowedFields = $this->config()->allowed_field_types;\n\t\tif ($allowedFields) {\n\t\t\t$fieldClasses = singleton('EditableFormField')->getEditableFieldClasses();\n\t\t\tforeach($fieldClasses as $fieldClass => $fieldTitle) {\n\t\t\t\tif (!in_array($fieldClass, $allowedFields)) {\n\t\t\t\t\tConfig::inst()->update($fieldClass, 'hidden', true);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Explicitely allow fields, so subclasses show up\n\t\t\tforeach($allowedFields as $fieldClass) {\n\t\t\t\tConfig::inst()->update($fieldClass, 'hidden', false);\n\t\t\t}\n\t\t}\n\t}", "function formulize_updateDerivedValues($entry, $fid, $frid=\"\") {\n\t$GLOBALS['formulize_forceDerivedValueUpdate'] = true;\n\tgetData($frid, $fid, $entry);\n\tunset($GLOBALS['formulize_forceDerivedValueUpdate']);\n}", "public function update($listOfValue);", "public function Do_update_Example1(){\n\n\t}", "abstract public function update();", "abstract public function update();", "public abstract function update();", "static function updateWith($fields) {\r\n return static::make($fields)->update();\r\n }", "function validate_on_update() {}", "function callbackSetValue($object,$field) {\n \n\n //echo get_class($object);\n switch ($field) {\n case 'name':\n // name does not set dirty flag - its a simple rename..\n $value = $object->get_text();\n if (@$this->$field == $value) {\n return;\n }\n $this->$field = $value;\n //print_r($this->data['TABLES'][$table]['FIELDS']);\n $this->table->database->dirty=true;\n break;\n case 'length':\n case 'default':\n $value = $object->get_text();\n if (@$this->$field == $value) {\n return;\n }\n // echo \"CHANGE?\";\n $this->$field = $value;\n //print_r($this->data['TABLES'][$table]['FIELDS']);\n $this->table->database->dirty=true;\n $this->dirty = true;\n break;\n case 'notnull':\n case 'isIndex':\n case 'sequence':\n case 'unique': \n $value = (int) $object->get_active();\n if (@$this->$field == $value) {\n return;\n }\n //echo \"CHANGE?\";\n $this->$field = $value;\n //print_r($this->data['TABLES'][$table]['FIELDS']);\n $this->table->database->dirty=true;\n $this->table->database->save();\n $this->setVisable();\n $this->dirty = true;\n break;\n default: \n echo \"opps forgot :$field\\n\";\n \n \n }\n //print_r(func_get_args());\n }", "function update_field($selector, $value, $post_id = \\false)\n{\n}", "public function update(array $fields) {\n $changeable = array('name' => 1, 'enabled' => 1, 'description' => 1, 'server' => 1, 'options' => 1, 'read_only' => 1);\n $changed = FALSE;\n foreach ($fields as $field => $value) {\n if (isset($changeable[$field]) && $value !== $this->$field) {\n $this->$field = $value;\n $changed = TRUE;\n }\n }\n\n // If there are no new values, just return 0.\n if (!$changed) {\n return 0;\n }\n\n // Reset the index's internal property cache to correctly incorporate new\n // settings.\n $this->resetCaches();\n\n return $this->save();\n }", "function updateField($table,$field,$value,$id){\n\n global $db;\n\n $sql = \"UPDATE $table SET $field='$value' WHERE id='$id'\";\n //Basic::EventLog(\"Product->updateField: \".$sql);\n $res =& $db->query($sql);\n return $res;\n\n }", "public function testUpdateValuesTooShort(): void { }", "function acf_update_metadata($post_id = 0, $name = '', $value = '', $hidden = \\false)\n{\n}", "protected function setupUpdateOperation()\n {\n CRUD::setValidation(SettingRequest::class);\n\n $readonly = [];\n if (User::min('id') !== backpack_user()->id) {\n $readonly = ['readonly' => 'readonly'];\n }\n\n CRUD::field('key')->type('text')->label('ID key')->attributes($readonly);\n CRUD::field('name')->type('text')->label('Nom');\n CRUD::field('value')->type(CRUD::getCurrentEntry()->type)->label('Contenu');\n }", "function update_single_data(){\n\t\t\t$name = $this->input->post('name');\n\t\t\t$value = $this->input->post('value');\t\t\t\n\t\t\t$pk = $this->input->post('pk');\n\t\t\treturn $this->InteractModal->update_post_meta( $pk, $name, $value );\n\t\t\t\n\t\t\t\n\t\t}", "function do_update(){\n\t\t$input = $_POST['field-'.$this->id_base][$this->number];\n\t\t// remove all slashed from values\n\t\tforeach($input as $var => $value){\n\t\t\tif( is_string($value) ){\n\t\t\t\t$input[$var] = stripslashes($value);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// validate: title should be always there\n\t\tif( empty($input['title']) ){\n\t\t\treturn array('status' => '0', 'error' => __('Title field is required.', JCF_TEXTDOMAIN));\n\t\t}\n\t\t\n\t\t// get values from real class:\n\t\t$instance = $this->update($input, $this->instance);\n\t\t$instance['title'] = strip_tags($instance['title']);\n\t\t$instance['slug'] = strip_tags($input['slug']);\n\t\t$instance['enabled'] = (int)@$input['enabled'];\n\t\t\n\t\t// check for errors\n\t\t// IMPORTANT: experimental function\n\t\tif( !empty($this->field_errors) ){\n\t\t\t$errors = implode('\\n', $this->field_errors);\n\t\t\treturn array('status' => '0', 'error' => $errors);\n\t\t}\n\t\t\n\t\tif( $this->is_new ){\n\t\t\t$this->number = jcf_get_fields_index( $this->id_base );\n\t\t\t$this->id = $this->id_base . '-' . $this->number;\n\t\t}\n\t\t\n\t\t// update fieldset\n\t\t$fieldset = jcf_fieldsets_get( $this->fieldset_id );\n\t\t$fieldset['fields'][$this->id] = $instance['enabled'];\n\t\tjcf_fieldsets_update( $this->fieldset_id, $fieldset );\n\t\t\n\t\t// check slug field\n\t\tif( empty($instance['slug']) ){\n\t\t\t$instance['slug'] = 'field_' . $this->id_base . '__' . $this->number;\n\t\t}\n\t\t\n\t\t// save\n\t\tjcf_field_settings_update($this->id, $instance);\n\t\t\n\t\t// return status\n\t\t$res = array(\n\t\t\t'status' => '1',\n\t\t\t'id' => $this->id,\n\t\t\t'id_base' => $this->id_base,\n\t\t\t'fieldset_id' => $this->fieldset_id,\n\t\t\t'is_new' => $this->is_new,\n\t\t\t'instance' => $instance,\n\t\t);\n\t\treturn $res;\n\t}", "abstract public function mass_update();", "public function afterUpdate()\n {\n //only clean and change custom fields if they have been set\n if (!empty($this->customFields)) {\n $this->deleteAllCustomFields();\n $this->saveCustomFields();\n }\n }", "public function updateField($id_pg, $field, $value, $table=\"pg_view\"){\n\t\t\t//prevede 2 array in ingresso :) \n\t\t\t\n\t\t\t$updateQuery = new Query(); //apro l'oggetto query\n\t\t\t$updateQuery->tables=array($table);\n\t\t\t\n\t\t\t$updateQuery->fields=array($field);\n\t\t\t\n\t\t\t$updateQuery->values=array($value);\n\t\t\t\n\t\t\t$updateQuery->filters=\"id=\".(int)$id_pg;\n\t\t\t\n\t\t\tif($updateQuery->DoUpdate()){\n\t\t\t\t$result = true;\n\t\t\t}else{\n\t\t\t\t$result = false;\n\t\t\t}\n\t\t\t\n\t\t\t$updateQuery->Close();\n\t\t\t\n\t\t\treturn $result;\n\t\t}", "function before_validation_on_update() {}", "protected function handleCustomField()\n {\n // If this field is a custom field we'll assume it has it's child fields\n // under the `fields` key. Then we are gonna modify those child fields'\n // attribute `name`, `label` & `conditional_logics` properties using\n // the parent field. The current implementation will modify those\n // properties in a way so that we can use dot notation to access.\n $customFields = Arr::get($this->field, 'fields');\n\n if ($customFields) {\n $parentAttribute = Arr::get($this->field, 'attributes.name');\n\n $parentConditionalLogics = Arr::get($this->field, 'settings.conditional_logics', []);\n\n $isAddressOrNameField = in_array(Arr::get($this->field, 'element'), ['address', 'input_name']);\n\n $isRepeatField = Arr::get($this->field, 'element') === 'input_repeat' || Arr::get($this->field, 'element') == 'repeater_field';\n\n foreach ($customFields as $index => $customField) {\n // If the current field is in fact `address` || `name` field\n // then we have to only keep the enabled child fields\n // by the user from the form editor settings.\n if ($isAddressOrNameField) {\n if (!Arr::get($customField, 'settings.visible', false)) {\n unset($customFields[$index]);\n continue;\n }\n }\n\n // Depending on whether the parent field is a repeat field or not\n // the modified attribute name of the child field will vary.\n if ($isRepeatField) {\n $modifiedAttribute = $parentAttribute.'['.$index.'].*';\n } else {\n $modifiedAttribute = $parentAttribute.'['.Arr::get($customField, 'attributes.name').']';\n }\n\n $modifiedLabel = $parentAttribute.'['.Arr::get($customField, 'settings.label').']';\n\n $customField['attributes']['name'] = $modifiedAttribute;\n\n $customField['settings']['label'] = $modifiedLabel;\n\n // Now, we'll replace the `conditional_logics` property\n $customField['settings']['conditional_logics'] = $parentConditionalLogics;\n\n // Now that this field's properties are handled we can pass\n // it to the extract field method to extract it's data.\n $this->extractField($customField);\n }\n }\n\n return $this;\n }", "public function update() {\r\n\r\n\t}", "function update_value($post_id, $field, $value)\n\t{\n\t\t// do stuff with value\n\t\t\n\t\t// save value\n\t\tparent::update_value($post_id, $field, $value);\n\t}", "function _refresh_stored_values()\r\n\t{\r\n\t\t// Update stored values\r\n\t\tforeach ($this->fields as $field)\r\n\t\t{\r\n\t\t\t$this->stored->{$field} = $this->{$field};\r\n\t\t}\r\n\r\n\t\t// Check if there is a \"matches\" validation rule\r\n\t\tforeach ($this->validation as $validation)\r\n\t\t{\r\n\t\t\t// If there is, match the field value with the other field value\r\n\t\t\tif (array_key_exists('matches', $validation['rules']))\r\n\t\t\t{\r\n\t\t\t\t$this->{$validation['field']} = $this->stored->{$validation['field']} = $this->{$validation['rules']['matches']};\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public function testUpdate()\n {\n // Test with correct field name\n $this->visit('/cube/1')\n ->type('3', 'x')\n ->type('3', 'y')\n ->type('3', 'z')\n ->type('1', 'value')\n ->press('submit-update')\n ->see('updated successfully');\n\n /*\n * Tests with incorrect fields\n */\n // Field required\n $this->visit('/cube/1')\n ->press('submit-update')\n ->see('is required');\n\n // Field must be integer\n $this->visit('/cube/1')\n ->type('1a', 'x')\n ->press('submit-update')\n ->see('integer');\n\n // Field value very great\n $this->visit('/cube/1')\n ->type('1000000000', 'y')\n ->press('submit-update')\n ->see('greater');\n }", "public function update($data) { \n\n\t\tif ($data['name'] != $this->name) { \n\t\t\t$this->update_name($data['name']); \n\t\t} \n\t\tif ($data['pl_type'] != $this->type) { \n\t\t\t$this->update_type($data['pl_type']); \n\t\t} \n\n\t}", "function updateProductField($id, $field, $value){\r\n $query = \"UPDATE \".TBL_PRODUCTS.\" SET \".$field.\" = :value WHERE product_id = :id\";\r\n\t $stmt = $this->connection->prepare($query);\r\n\t return $stmt->execute(array(\":value\" => $value, ':id' => $id));\r\n }", "public function testUpdate(): void { }", "function test_update_by_field($urabe, $body)\n{\n $values = $body->update_params;\n $column_name = $body->column_name;\n $column_value = $body->column_value;\n if ($body->driver == \"PG\")\n $table_name = $body->schema . \".\" . $body->table_name;\n else\n $table_name = $body->table_name;\n return $urabe->update_by_field($table_name, $values, $column_name, $column_value);\n}", "public function updateMultiple_data()\n {\n \n }", "public function update()\n\t{\n\n\t}", "function modifyDataArrForFormUpdate($inputArr)\t{\n\t\tif (is_array($this->conf[$this->conf['cmdKey'].'.']['evalValues.']))\t{\n\t\t\treset($this->conf[$this->conf['cmdKey'].'.']['evalValues.']);\n\t\t\twhile(list($theField,$theValue)=each($this->conf[$this->conf['cmdKey'].'.']['evalValues.']))\t{\n\t\t\t\t\n\t\t\t\t$listOfCommands = t3lib_div::trimExplode(',',$theValue,1);\n\t\t\t\twhile(list(,$cmd)=each($listOfCommands))\t{\n\t\t\t\t\t$cmdParts = preg_split('/\\[|\\]/',$cmd);\t// Point is to enable parameters after each command enclosed in brackets [..]. These will be in position 1 in the array.\n\t\t\t\t\t$theCmd = trim($cmdParts[0]);\n\t\t\t\t\tswitch($theCmd)\t{\n\t\t\t\t\t\tcase 'twice':\n\t\t\t\t\t\t\tif (isset($inputArr[$theField]))\t{\n\t\t\t\t\t\t\t\tif (!isset($inputArr[$theField.'_again']))\t{\n\t\t\t\t\t\t\t\t\t$inputArr[$theField.'_again'] = $inputArr[$theField];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$this->additionalUpdateFields.=','.$theField.'_again';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'checkArray':\n\t\t\t\t\t\t\t//echo \"<br>$theField : \".$inputArr[$theField];\n\t\t\t\t\t\t\tif ($inputArr[$theField] && !$this->isPreview())\t{\n\t\t\t\t\t\t\t\tfor($a=0;$a<=30;$a++)\t{\n\t\t\t\t\t\t\t\t\tif ($inputArr[$theField] & pow(2,$a))\t{\n\t\t\t\t\t\t\t\t\t\t$alt_theField = $theField.']['.$a;\n\t\t\t\t\t\t\t\t\t\t$inputArr[$alt_theField] = 1;\n\t\t\t\t\t\t\t\t\t\t$this->additionalUpdateFields.=','.$alt_theField;\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//echo ' modifyDataArrForFormUpdate : '.$theField.','.$this->additionalUpdateFields;\n\t\t\t\t\t\tbreak;\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\tif (is_array($this->conf['parseValues.']))\t{\n\t\t\treset($this->conf['parseValues.']);\n\t\t\twhile(list($theField,$theValue)=each($this->conf['parseValues.']))\t{\n\t\t\t\t$listOfCommands = t3lib_div::trimExplode(',',$theValue,1);\n\t\t\t\twhile(list(,$cmd)=each($listOfCommands))\t{\n\t\t\t\t\t$cmdParts = split('\\[|\\]',$cmd);\t// Point is to enable parameters after each command enclosed in brackets [..]. These will be in position 1 in the array.\n\t\t\t\t\t$theCmd = trim($cmdParts[0]);\n\t\t\t\t\tswitch($theCmd)\t{\n\t\t\t\t\t\tcase 'multiple':\n\t\t\t\t\t\t\tif (isset($inputArr[$theField]) && !$this->isPreview())\t{\n\t\t\t\t\t\t\t\t$inputArr[$theField] = explode(',',$inputArr[$theField]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'checkArray':\n\t\t\t\t\t\t\tif ($inputArr[$theField] && !$this->isPreview())\t{\n\t\t\t\t\t\t\t\tfor($a=0;$a<=30;$a++)\t{\n\t\t\t\t\t\t\t\t\tif ($inputArr[$theField] & pow(2,$a))\t{\n\t\t\t\t\t\t\t\t\t\t$alt_theField = $theField.']['.$a;\n\t\t\t\t\t\t\t\t\t\t$inputArr[$alt_theField] = 1;\n\t\t\t\t\t\t\t\t\t\t$this->additionalUpdateFields.=','.$alt_theField;\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$inputArr = $this->userProcess_alt(\n\t\t\t$this->conf['userFunc_updateArray'],\n\t\t\t$this->conf['userFunc_updateArray.'],\n\t\t\t$inputArr\n\t\t);\n\n\t\treturn $inputArr;\n\t}", "public static function fieldsUpdate($reg){\n\t $fields = '';\n\n for($x=1;$x < Model::numFields();$x++){\n $field = Model::fieldName($x);\n ?>\n <tr><td><b><?=ucfirst($field)?></td><td><input type=\"text\" name=\"<?=$field?>\" value=\"<?=$reg[\"$field\"]?>\"></td></tr>\n <?php\n }\n }", "abstract function update();", "public function updateAction() {\n $model = Mage::getModel('inventorypurchasing/purchaseorder_draftpo')\n ->load($this->getRequest()->getParam('id'));\n $field = $this->getRequest()->getParam('field');\n if (!$field) {\n return $this->getResponse()->setBody(json_encode(array('success' => 0)));\n }\n $value = $this->getRequest()->getParam('value');\n $updateData = Mage::helper('vendorsinventory/draftpo')->prepareUpdateData($field, $value);\n try {\n $returnObject = $model->update($updateData);\n $return = $returnObject->getData();\n $return['success'] = 1;\n return $this->getResponse()->setBody(json_encode($return));\n } catch (Exception $ex) {\n return $this->getResponse()->setBody(json_encode(array('success' => 0)));\n }\n }", "public function delegateChangeField(&$primary_key_processed_by_extension, DbalSchema $dbal_schema, $drupal_table_name, $field_name, $field_new_name, array $drupal_field_new_specs, array $keys_new_specs, array $dbal_column_options);", "protected function _update()\n {\n $hash = $this->hasChangedFields() ? $this->getChangedFields()\n : $this->getFields();\n\n $primary = array();\n\n // we should check if tabe has only one primary\n $keys = $this->_db->getPrimary();\n if (is_array($keys)) {\n foreach ($keys as $key) {\n $primary[\"{$key} = ?\"] = $this->_fields[$key];\n }\n }\n\n return $this->_db->update($hash, $primary);\n }", "function update_value( $value, $post_id, $field ) {\n\t\t\n\t\t// bail early if no sub fields\n\t\tif( empty($field['sub_fields']) ) return $value;\n\t\t\n\t\t\n\t\t// vars\n\t\t$new_value = 0;\n\t\t$old_value = (int) acf_get_metadata( $post_id, $field['name'] );\n\t\t\n\t\t\n\t\t// update sub fields\n\t\tif( !empty($value) ) { $i = -1;\n\t\t\t\n\t\t\t// remove acfcloneindex\n\t\t\tif( isset($value['acfcloneindex']) ) {\n\t\t\t\n\t\t\t\tunset($value['acfcloneindex']);\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t// loop through rows\n\t\t\tforeach( $value as $row ) {\t$i++;\n\t\t\t\t\n\t\t\t\t// bail early if no row\n\t\t\t\tif( !is_array($row) ) continue;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t// update row\n\t\t\t\t$this->update_row( $row, $i, $field, $post_id );\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t// append\n\t\t\t\t$new_value++;\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\t// remove old rows\n\t\tif( $old_value > $new_value ) {\n\t\t\t\n\t\t\t// loop\n\t\t\tfor( $i = $new_value; $i < $old_value; $i++ ) {\n\t\t\t\t\n\t\t\t\t$this->delete_row( $i, $field, $post_id );\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\t// save false for empty value\n\t\tif( empty($new_value) ) $new_value = '';\n\t\t\n\t\t\n\t\t// return\n\t\treturn $new_value;\n\t}", "function update_single_field($table,$set_field,$set_value,$where_field,$where_value)\n\t{\n\t\tglobal $db;\n\n\t\t$sql = \"UPDATE $table SET $set_field = '$set_value' WHERE $where_field = '$where_value'\";\n\n\t\tif( !$result = $db->sql_query($sql) )\n\t\t{\n\t\t\tmessage_die(GENERAL_ERROR, 'Could Not Update Garage DB', '', __LINE__, __FILE__, $sql);\n\t\t}\n\t\n\t\treturn;\n\t}" ]
[ "0.80435646", "0.7480888", "0.702666", "0.698054", "0.6813463", "0.67963946", "0.6721599", "0.66869694", "0.6650359", "0.65971", "0.65971", "0.65971", "0.65971", "0.65884465", "0.65811956", "0.6474933", "0.6465617", "0.63198245", "0.6267695", "0.6239532", "0.6220739", "0.62181664", "0.62181664", "0.6202967", "0.61804116", "0.61769104", "0.6159625", "0.6159625", "0.6159625", "0.6159625", "0.6159625", "0.6159625", "0.6159625", "0.6159625", "0.6159625", "0.6159625", "0.6159625", "0.6159625", "0.6159625", "0.6159625", "0.615448", "0.6154409", "0.61198056", "0.6077278", "0.6071073", "0.60550183", "0.6054756", "0.6045295", "0.6040516", "0.6028534", "0.602696", "0.6023291", "0.60032696", "0.5998873", "0.59959286", "0.5990673", "0.5989668", "0.5958504", "0.5956219", "0.5953139", "0.5951308", "0.59366083", "0.592819", "0.5926606", "0.5926606", "0.5920949", "0.5920772", "0.59089816", "0.5908967", "0.5903304", "0.5902", "0.5898911", "0.588474", "0.58722657", "0.58661526", "0.5852609", "0.5846672", "0.58397967", "0.58397007", "0.58394593", "0.5832449", "0.58307326", "0.58301353", "0.5825909", "0.58110386", "0.5810472", "0.5804442", "0.58034635", "0.58016", "0.5795345", "0.5788196", "0.5768255", "0.5753276", "0.5752628", "0.57523894", "0.57521397", "0.5746494", "0.57374007", "0.5737082", "0.57355034" ]
0.6203038
23
Transform the resource into an array.
public function toArray($request) { return ['id'=> $this->id, 'name'=>$this->name, 'lyrics'=>$this->lyrics, 'artists'=>$this->artists, 'duration'=>$this->duration, 'created_at'=>$this->created_at->format('Y-m-d H:i:s'), 'updated_at'=>$this->created_at->format('Y-m-d H:i:s'), ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function toArray(): array\n {\n if (is_null($this->resource)) {\n return [];\n }\n\n return is_array($this->resource)\n ? $this->resource\n : $this->resource->toArray();\n }", "public function toArray(): array\n {\n if (is_null($this->resource)) {\n return [];\n }\n\n return is_array($this->resource)\n ? $this->resource\n : $this->resource->toArray();\n }", "public function asArray() {\n return $this->resource;\n }", "public function transform($resource)\n {\n return [];\n }", "public function toArray()\n {\n if ($this->resource instanceof ArrayableInterface) {\n\n return $this->resource->toArray();\n } else {\n\n return null;\n }\n }", "public function parse($resource)\n {\n return $resource->toArray();\n }", "public function transform($resource)\n {\n return [\n 'id' => $resource['id'],\n 'item' => $resource['item'],\n 'qty' => $resource['qty'],\n\n ];\n }", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "abstract protected function toArray();", "public function getAsArray();", "public function asArray();", "public function asArray();", "public function asArray();", "public function asArray();", "public function asArray();", "public function asArray();", "public function getAsArray()\n\t{\n\t\t\n\t\t$path = $this->get();\n\t\t\n\t\treturn self::toArray($path);\n\t\t\n\t}", "public function transform($resource)\n {\n return [\n\n 'id' => (int) $resource->id,\n\t\t\t'name' => $resource->name,\n\t\t\t'description' => $resource->description,\n 'seat_count' => $resource->seat_count,\n\t\t\t'is_active' => $resource->is_active,\n\t\t\t'status' => $resource->status,\n\t\t\t'created_at' => $resource->created_at->toDateTimeString(),\n\t\t\t'updated_at' => $resource->updated_at->toDateTimeString(),\n\t\t\t\n ];\n }", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray(): array\n {\n return [\n 'users' => HiUserResource::collection($this->resource),\n ];\n }", "public function toArray()\n {\n return $this->transform();\n }", "function toArray() ;", "function toArray() ;", "public function convertItemArray() {}", "public function toArray(): array\n {\n $content = $this->getContent();\n\n if (\\is_array($content)) {\n return $this instanceof Filterable\n ? (array) $this->filterResponse($content)\n : $content;\n }\n\n return [];\n }", "protected function asArray()\n\t{\n\t\treturn \\json_decode($this->response, true);\n\t}", "public function arr() {\n\t\t\treturn \\uri\\generate::to_array($this->object);\n\t\t}", "public function toArray()\n {\n return $this->getContent();\n }", "public function toArray()\n {\n\n }", "public function asArray(): array\n {\n return json_decode($this->result, true);\n }", "public function toArray()\n {\n return $this->cast('array');\n }", "function toArray(){\r\n\t\treturn $this->data;\r\n\t}", "private function arrayify(): array\n {\n return $this->toArray();\n }", "abstract public function toArray();", "abstract public function toArray();", "abstract public function toArray();", "abstract public function toArray();", "abstract public function toArray();", "public function toArray() // untested\n {\n return $this->data;\n }", "public function toArray(){\n $this->buildArray();\n return $this->array;\n }", "public function toArray(): array;", "public function toArray(): array;", "public function toArray(): array;", "public function toArray(): array;", "public function toArray(): array;", "public function toArray(): array;", "public function toArray(): array;" ]
[ "0.7750928", "0.7750928", "0.7715773", "0.75906307", "0.7310379", "0.7138024", "0.7134791", "0.7096877", "0.7096877", "0.70968604", "0.70968604", "0.70968604", "0.70968604", "0.70955557", "0.70955557", "0.70955557", "0.70955557", "0.70955557", "0.70955557", "0.70955557", "0.70955557", "0.70955557", "0.70955557", "0.6959165", "0.69560915", "0.68910366", "0.68910366", "0.68910366", "0.68910366", "0.68910366", "0.68910366", "0.6881386", "0.6868011", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6851924", "0.6790647", "0.674651", "0.674651", "0.67363435", "0.6720337", "0.6712338", "0.67115825", "0.6710179", "0.666141", "0.66587526", "0.6656767", "0.6655622", "0.66545117", "0.6648871", "0.6648871", "0.6648871", "0.6648871", "0.6648871", "0.66377884", "0.6637001", "0.6629", "0.6629", "0.6629", "0.6629", "0.6629", "0.6629", "0.6629" ]
0.0
-1
Convert HTTP request to backend request.
protected function createBackendRequest(Request $request) { $method = $request->getMethod(); $uri = $request->getPathInfo(); $uri .= !is_null($qs = $request->getQueryString()) ? '?'.$qs : ''; $headers = $request->request->all(); if (!$headers) { $headers = null; } $content = $request->getContent(); return $this->getBackendClient()->createRequest($method, $uri, $headers, $content); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract public function convertFromRequest(SimplifiedRequest $request);", "abstract protected function createBackendRequest(Request $request);", "public function toRequest(): Request\n {\n // Create URI\n $uri = new Uri(sprintf($this->uriTemplate, $this->shop));\n\n // Create headers\n $authenticatedRequestHeader = $this->accessTokenTransformer\n ->toAuthenticatedRequestHeader($this->accessToken);\n\n // Create headers\n $headers = array_merge($this->headers, $authenticatedRequestHeader);\n\n // Create request\n return new Request($this->httpMethod, $uri, $headers);\n }", "public function toIlluminateRequest()\n {\n list($get, $post, $cookie, $files, $server, $content)\n = $this->transformIlluminateParameters($this->swooleRequest);\n\n return $this->createIlluminateRequest(\n $get, $post, $cookie, $files, $server, $content\n );\n }", "public function getRequest(): Request\n {\n return BackendModel::getRequest();\n }", "private function mapRequest(ReactRequest $request)\n {\n return new DiactorosRequest(\n $_SERVER,\n $request->getFiles(),\n $request->getUrl(),\n $request->getMethod(),\n $this->getBodyStreamFrom($request),\n $request->getHeaders(),\n $this->getCookiesFrom($request),\n $request->getQuery(),\n $request->getPost(),\n $request->getHttpVersion()\n );\n }", "public function & GetRequest ();", "public function HTTPRequest(){\n\t}", "protected function _getRequest() {\n\t\treturn new Request;\n\t}", "public function request() : ServerRequestInterface;", "public function getRequest(): RequestInterface;", "abstract public function mapRequest($request);", "public function request(): RequestContract;", "protected function _request() {}", "public function get_request()\n {\n $request = new midgardmvc_core_request();\n $request->set_method($this->appserver_context['env']['REQUEST_METHOD']);\n if (isset($this->appserver_context['env']['HTTP_X_HTTP_METHOD_OVERRIDE']))\n {\n $request->set_method($this->appserver_context['env']['HTTP_X_HTTP_METHOD_OVERRIDE']);\n }\n\n // Parse URL into components (Mjolnir doesn't do this for us)\n $url_components = parse_url(\"http://{$this->appserver_context['env']['HTTP_HOST']}{$this->appserver_context['env']['REQUEST_URI']}\");\n\n // Handle GET parameters\n if (!empty($url_components['query']))\n {\n $get_parameters = array();\n parse_str($url_components['query'], $get_parameters);\n $request->set_query($get_parameters);\n }\n\n $request->resolve_node($url_components['path']);\n\n return $request;\n }", "public function getRequest(): Request\n\t{\n\t\t//Get php://input for PUT and DELETE methods\n\t\tparse_str(file_get_contents('php://input'), $_DATA);\n\t\treturn new Request($_SERVER, $_GET + $_POST + $_DATA);\n\t}", "public function createRequest()\n {\n return new ChipVN_Http_Request;\n }", "public function getRequestWrapper();", "public function request(): Request\n {\n if (class_exists('Src\\Http\\Request')) {\n return new Request;\n }\n }", "public static function resolve_http_request()\n {\n }", "abstract public function processRequest();", "abstract public function request();", "public static function createRequest($rawRequest) {\n if(self::isHttpPostRequest($rawRequest)) {\n return new HttpPostRequest($rawRequest);\n }\n // if it is not a post request, create a get request\n else {\n return new HttpGetRequest($rawRequest);\n }\n }", "public function getRequest(): \\GuzzleHttp\\Psr7\\Request\n {\n }", "public abstract function processRequest();", "public function processRequest();", "public function getRequest();", "public function getRequest();", "public function getRequest();", "public function getRequest();", "public function getRequest();", "public function getRequest();", "public function getRequest();", "public function getRequest();", "public function createRequest();", "public function createRequest();", "protected function getRequest() {}", "public function buildRequest()\n {\n if (php_sapi_name() === 'cli') {\n return $this->buildCliRequest();\n } else {\n return $this->buildWebRequest();\n }\n }", "public function request(){\n\t\t$request = file_get_contents('php://input');\n\t\treturn json_decode($request,true);\n\t}", "protected function obtainRequest() {\n return Request::createFromGlobals();\n }", "public function request();", "public static function process_http_request()\n {\n }", "public function getRequest() {}", "public function getRequest() {}", "function request() {\n return new Request;\n }", "protected function apiRequest()\n {\n $request = 'post';\n if ($this->method->isGetRequest()) {\n $request = 'get';\n }\n\n return $this->getTelegram()->{$request}($this->method->apiEndpoint(), $this->method->toArray());\n }", "abstract protected function process(Request $request);", "function request()\n\t{\n\t\treturn phanda()->create(\\Phanda\\Foundation\\Http\\Request::class);\n\t}", "public function request() {\n // The basic flow: build the url, make the request, parse and return the\n // output.\n $url = $this->query_builder->getUrl();\n\n // @todo: does this make sense to be in a separate class? Anyway, this shoudl\n // be somehow refactored because it is hard to replace or overwrite it.\n $curl = curl_init();\n curl_setopt($curl, CURLOPT_URL, $url);\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);\n $response = curl_exec($curl);\n // @todo: very important: check the curl errors here.\n\n return $this->parser->parse($response);\n }", "protected function QuickConvertRequest(Requests\\QuickConvertRequest $request)\n {\n\n $resourcePath = '/conversion/quick';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = \"\";\n $multipart = false;\n \n\n // query params\n if ($request->outPath !== null) {\n $localName = lcfirst('OutPath');\n $localValue = is_bool($request->outPath) ? ($request->outPath ? 'true' : 'false') : $request->outPath;\n if (strpos($resourcePath, '{' . $localName . '}') !== false) {\n $resourcePath = str_replace('{' . $localName . '}', ObjectSerializer::toPathValue($localValue), $resourcePath);\n } else {\n $queryParams[$localName] = ObjectSerializer::toQueryValue($localValue);\n }\n }\n \n \n $resourcePath = $this->_parseURL($resourcePath, $queryParams);\n\n // body params\n $_tempBody = null;\n if (isset($request->settings)) {\n if (is_string($request->settings)) {\n $_tempBody = \"\\\"\" . $request->settings . \"\\\"\"; \n } else {\n $_tempBody = $request->settings;\n }\n }\n\n if ($multipart) {\n $headers= $this->headerSelector->selectHeadersForMultipart(\n ['application/json', 'application/xml']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json', 'application/xml'],\n ['application/json', 'application/xml']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass && $headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = $formParams[\"data\"];\n }\n }\n \n $this->_requestToken();\n\n if ($this->config->getAccessToken() !== null) {\n $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['x-groupdocs-client'] = $this->config->getUserAgent();\n }\n \n $defaultHeaders['x-groupdocs-client-version'] = $this->config->getClientVersion();\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n \n $req = new Request(\n 'POST',\n $this->config->getHost() . $resourcePath,\n $headers,\n $httpBody\n );\n if ($this->config->getDebug()) {\n $this->_writeRequestLog('POST', $this->config->getHost() . $resourcePath, $headers, $httpBody);\n }\n \n return $req;\n }", "public function preProcessRequest(RequestInterface &$request) {}", "protected function buildRequest() {\n\t\t/* @var $request \\TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request */\n\t\t$request = $this->objectManager->get('TYPO3\\\\CMS\\\\Extbase\\\\Mvc\\\\Web\\\\Request');\n\t\t$request->setControllerVendorName($this->vendorName);\n\t\t$request->setControllerExtensionName($this->extensionName);\n\t\t$request->setPluginName($this->pluginName);\n\t\t$request->setControllerName($this->controllerName);\n\t\t$request->setControllerActionName($this->actionName);\n\t\t$request->setFormat($this->formatName);\n\t\t$request->setArguments($this->arguments);\n\t\treturn $request;\n\t}", "protected function obtainPostRequest() {\n /*\n * If the request was sent in JSON format (for example from an mobile app) \n * we will transform it into a format that can be interpreted by PHP\n */ \n $request = Request::createFromGlobals();\n if ($request->headers->get('Content-Type') == 'application/json') {\n $data = json_decode($request->getContent(), true);\n $request->request->replace(is_array($data) ? $data : array());\n }\n return $request->request;\n }", "public function createRequest(): IRequest;", "public function delegate(Request $request)\n {\n $backendRequest = $this->createBackendRequest($request);\n $backendResponse = $backendRequest->send();\n return $this->createResponse($backendResponse);\n }", "public function createServerRequestFromGlobals(): ServerRequestInterface;", "public function createServerRequestFromGlobals(): ServerRequestInterface;", "private function requestProcessor() {\n try {\n\n if (empty($this->uri))\n throw new \\Exception(\"Undefined url\");\n\n $ReqHandle = curl_init($this->uri);\n\n $body = json_encode([]);\n if( sizeof($this->data) > 0 )\n $body = json_encode($this->data);\n\n $returnTransfer = 0;\n if( $this->hasResponseToReturn )\n $returnTransfer = 1;\n\n $isPost = 0;\n if( $this->method != 'GET')\n $isPost = 1;\n\n\n if($isPost == 1){\n curl_setopt($ReqHandle,CURLOPT_POST, $isPost);\n curl_setopt($ReqHandle, CURLOPT_POSTFIELDS, $body);\n }\n \n curl_setopt_array($ReqHandle, [\n CURLOPT_RETURNTRANSFER => $returnTransfer,\n CURLOPT_HTTPHEADER => $this->headersToBeUsed\n ]);\n\n\n $result = curl_exec($ReqHandle);\n\n if(curl_errno($ReqHandle)){\n\n return curl_error($ReqHandle);\n }\n\n if($returnTransfer == 1)\n return json_decode($result);\n\n\n\n } catch (\\Throwable $t) {\n new ErrorTracer($t);\n }\n }", "private function createRequest(): ServerRequest\n {\n return new ServerRequest(\n 'POST',\n 'https://localhost/',\n [\n 'Accept' => '*/*',\n 'content-type' => 'application/json',\n 'User-Agent' => 'GitHub-Hookshot/0000000',\n 'X-GitHub-Delivery' => '00000000-0000-0000-0000-000000000000',\n 'X-GitHub-Event' => 'ping',\n 'X-Hub-Signature' =>\n 'sha1=5563c89a2f4743278567358293adc9a65680725b',\n ],\n '{\"zen\":\"Approachable is better than simple.\",\"hook_id\":202756468,\"sender\":{\"url\":\"https://api.github.com/users/loilo\"}}'\n );\n }", "private function _processRequest()\n\t{\n\t\t// prevent unauthenticated access to API\n\t\t$this->_secureBackend();\n\n\t\t// get the request\n\t\tif (!empty($_REQUEST)) {\n\t\t\t// convert to object for consistency\n\t\t\t$this->request = json_decode(json_encode($_REQUEST));\n\t\t} else {\n\t\t\t// already object\n\t\t\t$this->request = json_decode(file_get_contents('php://input'));\n\t\t}\n\n\t\t//check if an action is sent through\n\t\tif(!isset($this->request->action)){\n\t\t\t//if no action is provided then reply with a 400 error with message\n\t\t\t$this->reply(\"No Action Provided\", 400);\n\t\t\t//kill script\n\t\t\texit();\n\t\t}\n\n\t\t//check if method for the action exists\n\t\tif(!method_exists($this, $this->request->action)){\n\t\t\t//if method doesn't exist, send 400 code and message with reply'\n\t\t\t$this->reply(\"Action method not found\",400);\n\t\t\t//kill script\n\t\t\texit();\n\t\t}\n \n\t\tswitch($this->request->action){\n\t\t\tcase \"hello\":\n\t\t\t\t$this->hello($this->request->data);\n\t\t\t\tbreak;\n\t\t\tcase \"submit_video\":\n\t\t\t\t//error_log(\"formSubmit has been sent through\");\n\t\t\t\t$this->submit_video($this->request, $_FILES);\n\t\t\t\tbreak;\n\t\t\tcase \"remove_video\":\n\t\t\t\t//error_log(\"formSubmit has been sent through\");\n\t\t\t\t$this->remove_video($this->request);\n\t\t\t\tbreak;\n\t\t\tcase \"isSubmitted\":\n\t\t\t\t$this->isSubmitted($this->request);\n\t\t\tdefault:\n\t\t\t\t$this->reply(\"action switch failed\",400);\n\t\t\tbreak;\n\t\t}\n\n\n\n\t}", "public function transformRequest()\n {\n return $arrTransformReq = ['id' => 'CompanyId',\n 'type' => 'Type',\n 'name' => 'Name', 'doing_business_as' => 'DoingBusinessAs',\n 'tax_id' => 'TaxId',\n 'created_at' => 'CreatedAt', 'etag' => 'Etag',\n 'deleted_at' => 'DeletedAt'];\n }", "public static function create()\n {\n $contentType = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : 'text/html';\n return (new Request(\n $_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI'] ,\n $_REQUEST, $contentType\n ))->processBody();\n }", "public function getOriginalRequest() {}", "protected function forwardToReferringRequest() {}", "public function createRequest(Request $request)\n {\n $body = ConnectClient::getInstance()->fulfillment->sendRequest('POST', '/requests', $request);\n return Model::modelize('Request', json_decode($body));\n }", "public static function getHttp()\n : \\stdClass\n {\n return static::$_request;\n }", "public function testToRequest(): void\n {\n $request = new Request([\n 'banana' => 'strawberry',\n ]);\n $this->assertInstanceOf(IllRequest::class, $request->toRequest());\n }", "public function build(HttpRequest $request): Request\n {\n $headers = (new HeaderResourceBuilder())->build($request);\n\n return new Request($request->getMethod(), $request->getUri(), ...$headers);\n }", "protected abstract function handleRequest();", "abstract public function populateRequest(PHPFrame_Request $request);", "public function getRawRequest() {\n\t}", "private function getRequest() {\n return json_decode(request()->getContent(), true);\n }", "public function fromPhpGlobals():MutableRequest;", "protected function buildWebRequest()\n {\n $args = $_REQUEST;\n $params = array();\n\n $route = $_SERVER['REQUEST_URI'];\n $posQuestionMark = strpos($route, '?');\n if ($posQuestionMark !== false) {\n $route = substr($route, 0, $posQuestionMark);\n }\n \n $posIndex = strpos($route, 'index.php');\n if ($posIndex !== false) {\n $route = substr($route, $posIndex + strlen('index.php'));\n }\n \n // Transform the arguments\n foreach ($args as $key => $value) {\n if (is_numeric($value)) {\n // Transform the value into the correct data type\n $value = $value * 1;\n }\n \n $params[$key] = $value;\n }\n\n // Generate the full url and extract the base\n $scheme = $this->getScheme();\n $fullUrl = $scheme . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];\n\n $isSsl = false;\n if ($scheme == 'https') {\n $isSsl = true;\n }\n \n $routePosition = strlen($fullUrl);\n if ($route !== '' && $route !== '/') {\n $routePosition = strpos($fullUrl, $route);\n }\n \n $method = $_SERVER['REQUEST_METHOD'];\n $requestedUrl = $this->getRequestedUrl();\n $base = substr($fullUrl, 0, $routePosition);\n $headers = $this->getHeaders($_SERVER);\n $protocol = $_SERVER['SERVER_PROTOCOL'];\n \n $locale = 'en_US';\n if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {\n $locale = $this->getLocale($_SERVER['HTTP_ACCEPT_LANGUAGE']);\n }\n \n $operatingSystem = $this->getOperatingSystem();\n\n return new WebRequest($method, $requestedUrl, $route, $params, $base, $locale, $operatingSystem, $isSsl, $headers, $protocol);\n }", "function getRequest();", "public function getRequest(): Request\n {\n return Model::getRequest();\n }", "protected function convertWebUrlToTxtRequest($input)\n {\n // verify the required parameter 'input' is set\n if ($input === null || (is_array($input) && count($input) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $input when calling convertWebUrlToTxt'\n );\n }\n\n $resourcePath = '/convert/web/url/to/txt';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // body params\n $_tempBody = null;\n if (isset($input)) {\n $_tempBody = $input;\n }\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json', 'text/json', 'application/xml', 'text/xml']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json', 'text/json', 'application/xml', 'text/xml'],\n ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded']\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n $httpBody = $_tempBody;\n \n if($headers['Content-Type'] === 'application/json') {\n // \\stdClass has no __toString(), so we should encode it manually\n if ($httpBody instanceof \\stdClass) {\n $httpBody = \\GuzzleHttp\\json_encode($httpBody);\n }\n // array has no __toString(), so we should encode it manually\n if(is_array($httpBody)) {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($httpBody));\n }\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValue\n ];\n }\n // for HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n\n } else {\n // for HTTP post (form)\n $httpBody = \\GuzzleHttp\\Psr7\\Query::build($formParams);\n }\n }\n\n // this endpoint requires API key authentication\n $apiKey = $this->config->getApiKeyWithPrefix('Apikey');\n if ($apiKey !== null) {\n $headers['Apikey'] = $apiKey;\n }\n\n $defaultHeaders = [];\n if ($this->config->getUserAgent()) {\n $defaultHeaders['User-Agent'] = $this->config->getUserAgent();\n }\n\n $headers = array_merge(\n $defaultHeaders,\n $headerParams,\n $headers\n );\n\n $query = \\GuzzleHttp\\Psr7\\Query::build($queryParams);\n return new Request(\n 'POST',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function requestBodyConverter($object)\n {\n }", "public function send($request);", "public static function request() {\n\t\tif (!isset(self::$_request)) {\n\t\t\tself::$_request=new \\GO\\Base\\Request();\n\t\t}\n\t\treturn self::$_request;\n\t}", "public function getReferringRequest() {}", "public static function fromRingRequest(array $request)\n {\n $options = [];\n if (isset($request['version'])) {\n $options['protocol_version'] = $request['version'];\n }\n if (!isset($request['http_method'])) {\n throw new \\InvalidArgumentException('No http_method');\n }\n return new Request($request['http_method'], Core::url($request), isset($request['headers']) ? $request['headers'] : [], isset($request['body']) ? Stream::factory($request['body']) : null, $options);\n }", "function rest_do_request($request)\n {\n }", "protected function api_request($query) {\n if (empty($this->server_path)) {\n return;\n }\n \n try {\n if (!($this->request instanceof HTTP_Request2)) {\n \n /**\n * Parse server_path to extract an optional username and\n * password for basic auth.\n */\n $_url = new Net_Url2($this->server_path);\n \n $basic_auth_user = $_url->getUser();\n $basic_auth_pass = $_url->getPassword();\n \n $request = new HTTP_Request2($this->server_path . $query);\n if ($basic_auth_user !== false) {\n if ($basic_auth_pass !== false) {\n $request->setAuth($basic_auth_user, $basic_auth_pass);\n } else {\n $request->setAuth($basic_auth_user);\n }\n }\n \n } else {\n $request = $this->request;\n }\n $response = $request->send(); \n $body = json_decode($response->getBody());\n\n return $body;\n\n } catch (HTTP_Request2_Exception $e) {\n trigger_error($e->getMessage(), E_USER_WARNING);\n }\n }", "public function createHttpRequest()\n {\n /*\n * A patch which will take JSON bodies passed in POST requests and fill them into $_POST array,\n * so they are parsed by create HTTP request method.\n */\n if (!empty($_SERVER['REQUEST_METHOD']) && strtoupper($_SERVER['REQUEST_METHOD']) == 'POST'\n && !empty($_SERVER['CONTENT_TYPE']) && strpos(strtolower($_SERVER['CONTENT_TYPE']), 'application/json') !== false) {\n $body = file_get_contents('php://input');\n try {\n $json = Json::decode($body, Json::FORCE_ARRAY);\n }\n catch (JsonException $e) {\n throw new BadRequestException(\"Parsing of the JSON body failed: \" . $e->getMessage());\n }\n\n if (!is_array($json)) {\n throw new BadRequestException(\"A collection is expected as JSON body. Scalar value was given instead.\");\n }\n\n $_POST = $json;\n }\n\n return parent::createHttpRequest();\n }", "public function request()\n {\n return $this->applyRequestOptions(\n $this->newRequestWithoutOptions()\n );\n }", "function get_request_protocol()\n{\n return Request::GetProtocol();\n}", "protected function _request() {\n\t\treturn $this->_container->request;\n\t}", "abstract function do_api_request();", "public function DispatchRequest ();", "public function processRequest()\n\t\t{\n\t\t\t$request_method = strtolower($_SERVER['REQUEST_METHOD']);\n\t\t\tswitch ($request_method)\n\t\t\t{\n\t\t\t\tcase 'get':\n\t\t\t\t\t$data = $_GET['url'];\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'post':\n\t\t\t\t\t$data = $_GET['url'];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t$request_parts = explode('/', $data);\n\t\t\t$controller = $request_parts[0];\n\t\t\tswitch ($controller)\n\t\t\t{\n\t\t\t\tcase 'ad':\n\t\t\t\t\tprocessAdRequest(substr($data, strlen('ad')+1));\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'category':\n\t\t\t\t\tprocessCategoryRequest(substr($data, strlen('category')+1));\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'user':\n\t\t\t\t\tprocessUserRequest(substr($data, strlen('user')+1));\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\techo \"Invalid Request!\";\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}", "public function &request() : \\Amvisie\\Core\\HttpRequest\n {\n return $this->request;\n }", "public function makeRequest(EventHttpRequest $req, int $type, string $uri): bool {}", "static public function createFromReactRequest(\\React\\Http\\Request $request, $body = '')\n {\n $slimHeads = new Headers();\n foreach($request->getHeaders() as $reactHeadKey => $reactHead) {\n $slimHeads->add($reactHeadKey, $reactHead);\n if($reactHeadKey === 'Host') {\n $host = explode(':', $reactHead);\n if (count($host) === 1) {\n $host[1] = '80';\n }\n }\n }\n\n $slimUri = new Uri('http', $host[0], (int)$host[1], $request->getPath(), $request->getQuery());\n\n $cookies = [];\n $serverParams = $_SERVER;\n $serverParams['SERVER_PROTOCOL'] = 'HTTP/'.$request->getHttpVersion();\n\n $slimBody = self::getBody($body);\n return new Request(\n $request->getMethod(), $slimUri, $slimHeads, $cookies,\n $serverParams, $slimBody\n );\n }", "public function sendRequest(Request $request);", "public function sendRequest(Request $request);", "public function prepareRequest()\n {\n }", "public function getIncomingRequest(): IRequest {\n\t\treturn $this->incomingRequest;\n\t}", "function getRequest()\n {\n if ( !$this->_request )\n {\n if ( method_exists( $this, '_getRequest' ) )\n {\n $object = $this->_getRequest();\n if ( $object instanceof \\Hotlink\\Framework\\Model\\Api\\Request )\n {\n $this->setRequest( $object );\n }\n }\n if ( !$this->_request )\n {\n //$request = Mage::getModel('hotlink_framework/api_request');\n $request = $this->interactionApiRequestFactory->create();\n $this->setRequest( $request );\n }\n }\n return $this->_request;\n }", "private function prepareRequest() {\n foreach ($this->formats as $format) {\n $req = $this->request->addChild('format');\n $format = parse_ini_string($format);\n\n // Destination to save the new encoding.\n $source_info = pathinfo($this->source);\n $prefix = isset($format['file-prefix']) ? $format['file-prefix'] : '';\n unset($format['file-prefix']);\n $format['destination'] = $this->destination . '/' . $source_info['filename'] . '/' . $prefix . $source_info['filename'] . $format['file-suffix'];\n unset($format['file-suffix']);\n\n foreach ($format as $key => $value) {\n $req->addChild($key, $value);\n }\n }\n }" ]
[ "0.6923919", "0.6508892", "0.5988641", "0.5963723", "0.5808577", "0.5795457", "0.5785965", "0.57526016", "0.5750149", "0.57199204", "0.5714393", "0.5711751", "0.5699852", "0.567262", "0.5659152", "0.5656905", "0.5619941", "0.5613398", "0.5556132", "0.5552009", "0.5533105", "0.5526497", "0.55149263", "0.55104136", "0.5501377", "0.5479867", "0.547066", "0.547066", "0.547066", "0.547066", "0.547066", "0.547066", "0.547066", "0.547066", "0.5469073", "0.5469073", "0.5465628", "0.54297006", "0.5412531", "0.53988856", "0.5396842", "0.5396055", "0.53758085", "0.53758085", "0.5372904", "0.53653204", "0.53438586", "0.53373814", "0.533668", "0.5332521", "0.53124744", "0.5298994", "0.528542", "0.5266797", "0.5261415", "0.5258794", "0.5258794", "0.52558595", "0.52447826", "0.5207278", "0.51896226", "0.51872647", "0.5186772", "0.51772857", "0.5172471", "0.51580775", "0.515271", "0.5150601", "0.5148926", "0.5147529", "0.51307416", "0.5119976", "0.51066405", "0.51033616", "0.51011974", "0.5100168", "0.50999624", "0.5094026", "0.50832134", "0.5080444", "0.507632", "0.50623167", "0.5060337", "0.5054351", "0.50429344", "0.503475", "0.5026778", "0.5000895", "0.49978352", "0.49959224", "0.49954045", "0.4992556", "0.49914616", "0.49913818", "0.49843407", "0.49843407", "0.49825844", "0.4979968", "0.49767286", "0.49758893" ]
0.6059352
2
Creates a Symfony framework response from a backend response.
protected function createResponse(GuzzleResponse $response) { return Response::create($response->getBody(), $response->getStatusCode(), $response->getHeaders()->getAll()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function createResponse()\n {\n return new Response;\n }", "public function createResponse()\n {\n return new GuzzleResponse();\n }", "public function createResponse(): ResponseInterface {\n return $this->responseFactory->createResponse()->withHeader('Content-Type', 'application/json');\n }", "protected function createHttpResponse()\n {\n return new Response();\n }", "abstract protected function createResponse(GuzzleResponse $response);", "public function createResponse(): ResponseInterface\n\t\t{\n\t\t\treturn $this->responseFactory->createResponse()->withHeader('Content-Type', 'text/html; charset=utf-8');\n\t\t}", "abstract public function createResponse(AbstractRequestClient $request);", "public function toResponse($request = null): SymfonyResponse\n {\n return (new HttpFoundationFactory())->createResponse($this->response);\n }", "public function toResponse(): Response\n {\n $response = clone RequestContext::getResponse();\n return $response->setException($this->getException())->auto($this->handleBody(), $this->getStatusCode());\n }", "public function response($response)\n {\n\n return new Response($response);\n\n }", "public function createResponse(): IResponse;", "function makeResponse($response)\n {\n $result = current(Util::toArray($response));\n\n $response = new Response([\n 'raw_body' => $result,\n\n ## get response message as array\n 'default_expected' => function($rawBody) use ($result) {\n return $result;\n }\n ]);\n // TODO handle exceptions\n\n /** @var iResponse $response */\n $response = $this->exceptionHandler($response);\n \n\n return $response;\n }", "public static function getCORSSymfonyResponse()\n {\n return new \\Symfony\\Component\\HttpFoundation\\Response('', 200, static::getCORSResponseHeaders());\n }", "public static function response(): Response\n {\n return new Response;\n }", "function response() {\n return new Response;\n }", "public function makeResponse(): ResponseInterface;", "public function exampleAction() {\n //return 'tatata' // erreur : retour non valide car chaîne de caractères retournée. On doit retourner un objet de type réponse\n $res = new Response(\"tatata\"); //on transite par un objet pour pouvoir retourner une châine de caractères.\n $res2 = new Response(\"<h1>tadaaam</h1>\");\n $res3 = new Response($this->getMessage());\n //$res4 = new Response($this->fruits); erreur : on ne peut pas renvoyer au client une structure de données PHP non convertible en string. Si un boléen est facilement convertible, ce n'est pas le cas des tableaux.\n\n return $this->render('test/example.html.twig', array(\n 'fruits' => $this->fruits3\n ));\n }", "public function test_can_create_psr7_response(): void {\n\n\t\t$response = HTTP_Helper::response( array( 'key' => 'test_VALUE' ), 500 );\n\n\t\t$body = json_decode( (string) $response->getBody(), true );\n\n\t\t$this->assertInstanceOf( ResponseInterface::class, $response );\n\t\t$this->assertIsArray( $body );\n\t\t$this->assertArrayHasKey( 'key', $body );\n\t\t$this->assertEquals( 'test_VALUE', $body['key'] );\n\t\t$this->assertEquals( 500, $response->getStatusCode() );\n\t}", "public function prepareResponse();", "protected function _getResponse() {\n\t\treturn new Response;\n\t}", "private function createResponse($request)\n {\n return json_decode($request->getBody()->getContents());\n }", "public function toResponse()\n {\n $base = ['return_code' => is_null($this->fail) ? static::SUCCESS : static::FAIL, 'return_msg' => $this->fail];\n $attributes = array_merge($base, $this->attributes);\n if ($this->sign) {\n $attributes['sign'] = Support\\generate_sign($attributes, $this->app->getKey());\n }\n return new Response(XML::build($attributes));\n }", "final public function getResponse()\n {\n $environment = $this->container->getParameter('kernel.environment');\n switch ($environment) {\n case 'prod':\n $response = $this->createProdEnvironmentResponse();\n break;\n case 'dev':\n $response = $this->createDevEnvironmentResponse();\n break;\n default:\n $response = new Response('no valid response method found for this environment in ClientErrorOutput class. please register one.');\n break;\n }\n return $response;\n }", "private function webhookResponseToFrontendResponse($res) {\n $res = (object) $res;\n if ($res->success == true) {\n $message = self::$order_successful_msg;\n } else {\n $res_error = json_decode($res->message);\n if ($res_error !== null && array_key_exists(\"errors\", $res_error) && count($res_error->errors) > 0 && array_key_exists(\"message\", $res_error->errors[0]) && array_key_exists(\"value\", $res_error->errors[0])) {\n $message = $res_error->errors[0]->message . \": \" . $res_error->errors[0]->value;\n } else {\n $message = self::$order_error_msg;\n }\n }\n return $this->generateResponse($res->success, $message);\n }", "public function toResponse()\n {\n $response = new ApiResponse();\n try {\n $data = $this->data();\n if (empty($data)) {\n $messages = $this->errors();\n } else {\n $messages = $this->messages();\n }\n\n return $response->withParams([\n 'code' => $this->code(),\n 'data' => $data,\n 'message' => $messages,\n ]);\n } catch (Exception $exception) {\n return $this->handleExceptions($response, $exception);\n }\n }", "protected function getCreateResponse()\n\t{\n\t\treturn new Api\\Response\\Create();\t\n\t}", "public function create(): ResponseInterface\n\t{\n\t\t$this->content = [];\n\t}", "public function toResponse()\n {\n $response = new ApiResponse();\n try {\n $this->execute();\n if ($this->code !== 200) {\n $messages = $this->errors();\n } else {\n $messages = $this->messages();\n }\n $response = $response->withParams([\n 'code' => $this->code(),\n 'data' => $this->data(),\n 'message' => $messages,\n ]);\n if ($this->extra->count()) {\n $response = $response->withParams($this->extra->toArray());\n }\n\n return $response;\n } catch (Exception $exception) {\n return $this->handleExceptions($response, $exception);\n }\n }", "final public function getResponse() {\r\n $template = $this->getProvider()->get('PM\\Main\\Web\\Component\\Template\\Json');\r\n $response = $this->getProvider()->get('response');\r\n $response->setTemplate($template);\r\n return $response;\r\n }", "public function as_response() {\n return Net_HTTP::Response($this);\n }", "public function _response($response) {\n\t\treturn $this->_instance($this->_classes['response'], array(\n\t\t\t'body' => $response\n\t\t));\n\t}", "public function create(): Response\n {\n // ToDo: replace with correct response\n return response()->view('livewire-crud::create');\n }", "protected function construct_response()\n {\n $this->feedback['ok'] = $this->ok;\n $this->feedback['code'] = $this->code;\n $this->feedback['resource'] = $this->resource;\n }", "public static function response()\n {\n $container = Container::instance();\n if (!$container->has('response')) {\n $container->register('response', new Response());\n }\n return $container->get('response');\n }", "public function createResponse(Request $request, $content)\n {\n // NOTE: even null values get serialized appropriately\n\n $context = new SerializationContext();\n $context->setAttribute('translatable', true);\n $context->setSerializeNull(true);\n\n $content = $this->serializerService->serialize($content, $request->getRequestFormat('json'), $context);\n\n return new Response(\n $content,\n 200,\n array(\n 'Content-type' => $request->getMimeType($request->getRequestFormat('json')),\n 'Content-length' => strlen($content),\n )\n );\n }", "protected function getResponse(): Response\n {\n return new Response(fopen('data://text/plain,', 'rb'), 200);\n }", "public function getContent(): Response\n {\n return new Response(\n $this->content,\n Response::HTTP_OK\n );\n }", "public function getResponse(): Response\n {\n return response()->json($this->toSlackObjectArray())->setStatusCode(200);\n }", "protected function getResponse($actual)\n {\n if (! $actual instanceof Response) {\n throw new \\InvalidArgumentException('HttpFoundation\\Response required for expected value');\n }\n return $actual;\n }", "public function response()\n {\n return new Response(\n $this->getService('service.token')->sendToken($this->response)\n );\n }", "protected function _response() {}", "private function returnResponse($result): Response\n {\n if ($result instanceof Response) {\n return $result;\n }\n\n if (is_array($result)) {\n $result = json_encode($result);\n }\n\n return new Response(200, [], $result);\n }", "public function getResponse()\n\t{\n\t\t$outGoingResponse = $this->response;\n\t\t$request = $this->request;\n\n\t\t$headers = $outGoingResponse->getHeaders();\n\t\t$status_code = (isset($headers[ODataConstants::HTTPRESPONSE_HEADER_STATUS])) ? $headers[ODataConstants::HTTPRESPONSE_HEADER_STATUS] : 200;\n\t\tunset($headers[ODataConstants::HTTPRESPONSE_HEADER_STATUS]);\n\n\t\t$response = new Response(trim($outGoingResponse->getStream()), $status_code, array_filter($headers));\n\t\t$response->prepare($request->getRequest());\n\n\t\treturn $response;\n\t}", "public function deserializeResponse(string $response): Response;", "protected function makeResponse(mixed $result) : Response\n {\n $result = $this->makeResponseBodyPart($result);\n return $this->router->getResponse()->appendBody($result);\n }", "public function Response($response);", "public function render($handleRequestResponse, $code=200)\n {\n\n header('Content-Type:application/json');\n if(is_object($handleRequestResponse) && method_exists($handleRequestResponse,'toArray')){\n $baseResponse = new BaseResponse($handleRequestResponse->toArray(),$code);\n }\n else{\n $baseResponse = new BaseResponse($handleRequestResponse, $code);\n }\n\n echo json_encode($baseResponse);\n exit;\n }", "public function createAction()\n {\n $data = $this->getRequest()->getBody();\n $model = $this->getBinding()->create($data);\n $responseClass = $this->container->getParameter('response.class');\n $response = new $responseClass($model, 201);\n\n return $response;\n }", "function response($content = '', $status = 200, array $headers = [])\n\t{\n\t\t$factory = app(ResponseFactory::class);\n\n\t\tif (func_num_args() === 0) {\n\t\t\treturn $factory;\n\t\t}\n\n return $factory->make($content, $status, $headers);\n\t}", "public function createResponse($exception)\n {\n if (!$exception instanceof FlattenException) {\n $exception = FlattenException::create($exception);\n }\n\n return new Response($this->decorate($this->getContent($exception), $this->getStylesheet($exception)), $exception->getStatusCode(), $exception->getHeaders());\n }", "protected function createResponse($status = 200, $body = null)\n {\n if (is_string($body)) {\n $body = $this->createResponseBody($body);\n }\n\n $headers = new Headers([ 'Content-Type' => 'text/html; charset=UTF-8' ]);\n $response = new Response($status, $headers, $body);\n return $response;\n }", "abstract protected function writeToResponse(Response $response) : Response;", "abstract protected function writeToResponse(Response $response) : Response;", "abstract public function simplifyResponse($request, $response);", "protected function buildResponse($json)\n {\n //log the http response to the timeline\n $this->dispatch('utilbundle.symfout', new SymfonyEvent($this->get('g4_container')->getManifestId(), $json, get_class($this), $this->getRequest()->getRequestUri(), $this->get('g4_container')->getRequestPairKey(), 200));\n\n return new Response($json);\n }", "public function __invoke(Request $request, ResponseFactory $response): Response\n {\n return $response->json(['svg' => $request->user()->twoFactorQrCodeSvg()]);\n }", "private function respond()\n {\n $this->response->header('Content-Type', 'application/json');\n return $this->response;\n }", "public function foo(): ResponseInterface\n {\n return $this->createResponse('foo');\n }", "function json_response() {\n return app(JsonResponse::class);\n }", "private static function httpResponse(\\Nitric\\Faas\\Response $response): Response\n {\n $triggerResponse = $response->toTriggerResponse();\n\n return new Response(\n Status::OK,\n array(\n \"Content-Type\" => \"application/json\"\n ),\n $triggerResponse->serializeToJsonString()\n );\n }", "private function response() {\n if ($this->responseStatus !== 200) {\n $this->request['format'] = self::DEFAULT_RESPONSE_FORMAT;\n }\n $method = $this->request['format'] . 'Response';\n $this->response = array('status' => $this->responseStatus, 'body' => $this->$method());\n return $this;\n }", "public function getResponse() : Response\n {\n return $this->response;\n }", "protected function buildResponse()\n {\n $response = new Response('', 204);\n\n return $this->addHeaders($response, true );\n }", "public function json($content): ResponseInterface;", "public function toPsrResponse()\n {\n return $this->response;\n }", "private function response ($data) {\n $response = new Response($this->serializer->serialize($data, 'json'));\n $response->headers->set('Content-Type','application/json');\n $response->headers->set('Access-Control-Allow-Headers', 'origin, content-type, accept');\n $response->headers->set('Access-Control-Allow-Origin', '*');\n return $response;\n }", "abstract public function response();", "protected function createResponse($json = NULL) {\n $response = new ResourceResponse();\n if ($json) {\n $response->setContent($json);\n }\n return $response;\n }", "public function buildResponse($embedlyResponse);", "public function getPhpResponse() {\n return \\Lib\\Format::forge($this->_response)->to_php();\n }", "public function response() {\n return json_decode($this->response);\n }", "public function makeResponse(\n int $status = 200,\n array $headers = [],\n $body = null,\n string $version = '1.1',\n ?string $reason = null\n ): ResponseInterface {\n return new Response($status, $headers, $body, $version, $reason);\n }", "public function process(Response $response): Response {\n return $response;\n }", "public function decode($response);", "public function createResponseFromFPM(): ResponseInterface\n {\n return $this->createResponse(200, '');\n }", "public function createResponseWriter();", "function response($content = '', $statusCode = 200)\n {\n return new \\Anonym\\Http\\Response($content, $statusCode);\n }", "public function create() : Response\n {\n if (!$this->request->hasFiles()) {\n /**\n * @todo handle file hash to avoid uploading same files again\n */\n }\n\n return $this->response($this->processFiles());\n }", "public function onResponse(FilterResponseEvent $event)\n {\n if (!$this->isActive($event)) {\n return;\n }\n\n $request = $event->getRequest();\n $response = $event->getResponse();\n $content = $response->getContent();\n\n // convert content to content container\n if (!$content instanceof ResponseContainer) {\n $content = ResponseContainer::createAutoDetect($response);\n }\n\n // override http status code if needed\n $statusCode = $content->getStatusCode();\n if (!empty($statusCode)) {\n $response->setStatusCode($content->getStatusCode());\n }\n\n // set 204 header for empty content\n if ($content->isEmpty() && !$response->isRedirect()) {\n $response->setStatusCode(Response::HTTP_NO_CONTENT);\n $content->setStatusCode(Response::HTTP_NO_CONTENT);\n }\n\n // put statusCode in response and force 200 OK in header?\n if ($request->headers->has('X-Force-Status-Code-200')\n || ($request->getRequestFormat() == self::FORMAT_JSON && $request->query->has('callback'))\n ) {\n $content->setReturnStatusCode(true);\n $response->setStatusCode(Response::HTTP_OK);\n $response->headers->set('X-Status-Code', Response::HTTP_OK);\n }\n\n // serialize content container\n try {\n $context = new SerializationContext();\n $context->setSerializeNull(true);\n $format = $event->getRequest()->getRequestFormat();\n $contentSerialized = $this->serializer->serialize($content->toArray(), $format, $context);\n switch ($format) {\n case self::FORMAT_XML:\n $response->setContent($contentSerialized);\n break;\n default:\n $headers = $response->headers;\n $response = new JsonResponse(null, $response->getStatusCode());\n $response->headers = $headers;\n $response->setContent($contentSerialized);\n break;\n }\n } catch (\\Exception $e) {\n $response = new JsonResponse([\n 'error' => [\n 'code' => 'error.api.middleware',\n 'message' => $e->getMessage()\n ]\n ]);\n }\n\n // force empty output on a no-content response\n if ($content->isEmpty() && $response->isEmpty()) {\n $response->setContent('');\n }\n\n $event->setResponse($response);\n }", "function echoResponse($status_code, $response) {\n $app = \\Slim\\Slim::getInstance();\n // Http response code\n $app->status($status_code);\n\n // setting response content type to json\n $app->contentType('application/json');\n\n echo json_encode($response);\n}", "function echoResponse($status_code, $response) {\n $app = \\Slim\\Slim::getInstance();\n // Http response code\n $app->status($status_code);\n\n // setting response content type to json\n $app->contentType('application/json');\n\n echo json_encode($response);\n}", "function echoResponse($status_code, $response) {\n $app = \\Slim\\Slim::getInstance();\n // Http response code\n $app->status($status_code);\n \n // setting response content type to json\n $app->contentType('application/json');\n \n echo json_encode($response);\n}", "public function bar(): ResponseInterface\n {\n return $this->createResponse('bar')\n ->withHeader(RequestForwarder::RESPONSE_HEADER, 'foo');\n }", "public function getResponse(RequestEntity $request);", "public static function buildInternalServerErrorResponse(): static\n {\n $dto = new static();\n $dto->setCode(Response::HTTP_INTERNAL_SERVER_ERROR);\n $dto->setSuccess(false);\n\n return $dto;\n }", "protected function createResponse($request) {\n // don't send anything if client has fresh data\n if (Request::hasMacro('isFresh') && $request->isFresh()) {\n return response(null)->setNotModified();\n }\n\n $response = null;\n\n $methodName = 'create' . ucfirst($this->desiredResponseFormat($request)) . 'Response';\n if (method_exists($this, $methodName)) {\n $response = $this->{$methodName}();\n }\n\n return $response;\n }", "function echoResponse($status_code, $response) {\n $app = \\Slim\\Slim::getInstance();\n\n $app->status($status_code);\n $app->contentType('application/json');\n\n echo json_encode($response);\n}", "private function createBadRequestResponse(): Response\n {\n return new Response(\n $this->getStatusTextForResponseCode(Response::HTTP_BAD_REQUEST),\n Response::HTTP_BAD_REQUEST\n );\n }", "protected abstract function render(Response $response);", "private function response($data) {\n\t\treturn json_decode($data);\n\t}", "function createResponse ( $from, $action=\"Process Request\", $api_key=null )\n {\n $response = new SyndicationResponse();\n $response->raw = $from;\n\n /// an exception was thrown\n if ( is_subclass_of($from,'Exception') )\n {\n $response->success = false;\n $response->status = $from->getCode();\n $response->format = 'Exception';\n $response->addMessage(array(\n 'errorCode' => $from->getCode(),\n 'errorMessage' => $from->getMessage(),\n 'errorDetail' => \"{$action} Exception\"\n ));\n return $response;\n\n /// we got a response from the server\n } else if ( is_array($from)\n && !empty($from['http'])\n && !empty($from['format']) )\n {\n $status = isset($from['http']['http_code']) ? intval($from['http']['http_code']) : null;\n $response->status = $status;\n /// SUCCESS\n if ( $status>=200 && $status<=299 )\n {\n $response->success = true;\n /// CLIENT SIDE ERROR\n } else if ( $status>=400 && $status<=499 ) {\n /// BAD API KEY\n if ( $status == 401 ) {\n $errorDetail = \"Unauthorized. Check API Key.\";\n /// VALID URL but specific id given does not exist\n } else if ( $status == 404 && !empty($api_key) ) {\n $errorDetail = \"Failed to {$action}. {$api_key} Not Found.\";\n /// Error in the request\n } else {\n $errorDetail = \"Failed to {$action}. Request Error.\";\n }\n $response->success = false;\n $response->addMessage(array(\n 'errorCode' => $status,\n 'errorMessage' => $this->httpStatusMessage($status),\n 'errorDetail' => $errorDetail\n ));\n /// SERVER SIDE ERROR\n } else if ( $status>=500 && $status<=599 ) {\n $response->success = false;\n $response->addMessage(array(\n 'errorCode' => $status,\n 'errorMessage' => $this->httpStatusMessage($status),\n 'errorDetail' => \"Failed to {$action}. Server Error.\"\n ));\n }\n\n if ( $from['format']=='json' )\n {\n /// for any json response\n /// [meta] and [results] expected back from api\n /// [meta][messages] should be consumed if found\n /// [meta][pagination] should be consumed if found\n /// [message] was changed to plural, check for both for now just incase\n\n /// look for meta\n if ( isset($from['meta']) )\n {\n if ( isset($from['meta']['pagination']) )\n {\n $response->addPagination($from['meta']['pagination']);\n }\n if ( isset($from['meta']['messages']) )\n {\n $response->addMessage($from['content']['meta']['messages']);\n }\n if ( isset($from['meta']['message']) )\n {\n $response->addMessage($from['content']['meta']['message']);\n }\n } else if ( isset($from['content']) && isset($from['content']['meta']) ) {\n if ( isset($from['content']['meta']['pagination']) )\n {\n $response->addPagination($from['content']['meta']['pagination']);\n }\n if ( isset($from['content']['meta']['messages']) )\n {\n $response->addMessage($from['content']['meta']['messages']);\n }\n if ( isset($from['content']['meta']['message']) )\n {\n $response->addMessage($from['content']['meta']['message']);\n }\n }\n /// look for results\n if ( isset($from['content']) )\n {\n if ( isset($from['content']['results']) )\n {\n $response->results = (array)$from['content']['results'];\n } else {\n $response->results = (array)$from['content'];\n }\n }\n $response->format = 'json';\n return $response;\n } else if ( $from['format']=='image' ) {\n $response->format = 'image';\n\n /// a single string: base64 encoded image : imagecreatefromstring?\n $response->results = $from['content'];\n return $response;\n /// unknown format\n } else {\n $response->format = $from['format'];\n /// a single string : html : filtered_html?\n $response->results = $from['content'];\n return $response;\n }\n }\n /// we got something weird - can't deal with this\n $response->success = false;\n $status = null;\n if ( is_array($from) && !empty($from['http']) && isset($from['http']['http_status']) )\n {\n $status = $from['http']['http_status'];\n }\n $response->addMessage(array(\n 'errorCode' => $status,\n 'errorMessage' => $this->httpStatusMessage($status),\n 'errorDetail' => \"Unknown response from Server.\"\n ));\n return $response;\n }", "public function Response($response) {\n\t\t\n\t}", "function echoResponse($status_code, $response)\n{\n $app = \\Slim\\Slim::getInstance();\n // Http response code\n $app->status($status_code);\n\n // setting response content type to json\n $app->contentType('application/json');\n\n echo json_encode($response);\n}", "public function getResponse(): ResponseInterface;", "public function getResponse(): ResponseInterface;", "public function createResponse($res, $content = null)\n {\n if (isset($content)) {\n $response = [\n 'errors' => false,\n 'content' => $content,\n ];\n } else {\n $response = [\n 'errors' => false,\n ];\n }\n return $res->withJson($response, 200, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);\n }", "public function getOriginalResponse() : ResponseInterface;", "private function htmlResponse() {\n\n /*\n * In case of error, return json\n */\n if (is_array($this->response) && $this->response['ErrorCode'] === 500) {\n $this->request['content-type'] = self::DEFAULT_RESPONSE_FORMAT;\n return $this->jsonResponse();\n }\n \n /*\n * No collection set => renders home page\n */\n if (!$this->request['collection']) {\n $template = new Template(realpath(dirname(__FILE__)) . '/../templates/home.php', $this);\n }\n /*\n * Identifier set => renders resource page\n */ else if ($this->request['identifier']) {\n $template = new Template(realpath(dirname(__FILE__)) . '/../templates/' . $this->responseDescription['template'] . '/' . $this->request['method'] . 'Resource' . '.php', $this, $this->response, $this->responseDescription);\n }\n /*\n * Renders collection\n */ else {\n $template = new Template(realpath(dirname(__FILE__)) . '/../templates/' . $this->responseDescription['template'] . '/' . $this->request['method'] . 'Collection' . '.php', $this, $this->response, $this->responseDescription);\n }\n\n return $template->render();\n }", "public function get_response_object()\n {\n }", "public function response(): ResponseContract;" ]
[ "0.7036142", "0.6870034", "0.6793093", "0.6659858", "0.6650396", "0.66433126", "0.66349405", "0.6527649", "0.6510318", "0.65088177", "0.64706933", "0.63542026", "0.631651", "0.63139945", "0.6203885", "0.6200207", "0.61149365", "0.60920995", "0.6092079", "0.60885465", "0.6030211", "0.60245967", "0.5994863", "0.59757197", "0.59709847", "0.5968944", "0.5952304", "0.5930169", "0.5895923", "0.5893236", "0.5862992", "0.58439255", "0.5830564", "0.5818129", "0.5809806", "0.580979", "0.5808192", "0.5806317", "0.5806112", "0.5805723", "0.5792821", "0.57910806", "0.57874095", "0.57708025", "0.5769702", "0.57584655", "0.57264566", "0.5692399", "0.5691875", "0.56774", "0.5670425", "0.5670246", "0.5670246", "0.5668199", "0.5660053", "0.5651715", "0.5650203", "0.56499213", "0.564469", "0.5629097", "0.5625118", "0.5616308", "0.56151956", "0.56110585", "0.5606471", "0.5606048", "0.56045824", "0.5602448", "0.55940396", "0.5592007", "0.5590247", "0.55815864", "0.5580632", "0.55792254", "0.5569577", "0.55631185", "0.55559015", "0.5545219", "0.55340236", "0.55328107", "0.55328107", "0.55325246", "0.55301315", "0.5529728", "0.552492", "0.55234957", "0.5521136", "0.55184263", "0.55168885", "0.55129033", "0.55121106", "0.5506706", "0.5505308", "0.54993576", "0.54993576", "0.54774743", "0.5477298", "0.5469902", "0.54635847", "0.5462054" ]
0.60805005
20
Get the fully qualified location of the view.
public function find($name) { if (isset($this->views[$name])) { return $this->views[$name]; } if ($this->hasHintInformation($name = trim($name))) { return $this->views[$name] = $this->findNamespacedView($name); } return $this->views[$name] = $this->findInPaths($name, $this->paths); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function view()\n {\n return $this->entry->getPath();\n }", "public function getViewPath()\n {\n return $this->viewPath;\n }", "public function getViewPath()\n {\n return $this->viewPath;\n }", "public function getViewPath()\n {\n return Kerisy::$app->viewPath . strtolower($this->route->getPrefix());\n }", "public function getViewPath()\n {\n $class = new ReflectionClass($this);\n return dirname($class->getFileName()) . DIRECTORY_SEPARATOR . 'views';\n }", "public function getViewPath(): string;", "public function getViewPath()\n {\n return dirname(__DIR__);\n }", "public function getViewPath()\n {\n if ($this->_viewPath === null) {\n $this->_viewPath = realpath($this->getBasePath() . DIRECTORY_SEPARATOR . 'views');\n }\n return $this->_viewPath;\n }", "public function getViewPath()\n {\n if ($this->viewPath !== null) {\n return Yii::getAlias($this->viewPath);\n }\n\n $class = new \\ReflectionClass($this);\n return dirname($class->getFileName()) . DIRECTORY_SEPARATOR . 'views';\n }", "function getViewPath() {\r\n $view_value = $this->getView();\r\n if(is_array($view_value)) {\r\n $controller_name = array_var($view_value, 0, $this->engine->getDefaultControllerName());\r\n $view_name = array_var($view_value, 1, $this->engine->getDefaultActionName());\r\n } else {\r\n $controller_name = $this->getControllerName();\r\n $view_name = trim($view_value) == '' ? $this->getAction() : $view_value;\r\n } // if\r\n \r\n return $this->engine->getViewPath($view_name, $controller_name);\r\n }", "protected function get_view_uri() {\n\t\treturn self::VIEW_URI;\n\t}", "private function getViewPath() {\n if ($this->module) {\n return MODULE_PATH . $this->module . '/view/';\n } else {\n return PROTECTED_PATH . 'view/';\n }\n }", "public function getCanonicalLocation(): string;", "public function location()\n {\n return $this->resolvedLocation ?: $this->location;\n }", "public function getLocation() {\n\t\tif(isset($this->data['mdid'])) {\n\t\t\treturn $this->data['md_folder'] . $this->data['md_filename'];\n\t\t}\n\t\treturn ;\n\t}", "protected function relativeViewsPath()\n {\n return 'nova-components/views/' . $this->viewsName();\n }", "function get_view_location($view, $viewtype) {\n global $CONFIG;\n\n if (isset($CONFIG->views->locations[$viewtype][$view]))\n return $CONFIG->views->locations[$viewtype][$view];\n\n if (!isset($CONFIG->viewpath))\n return dirname(dirname(dirname(__FILE__))) . \"/views/\";\n else\n return $CONFIG->viewpath;\n\n return false;\n}", "protected function viewsPath()\n {\n return base_path('nova-components/views/' . $this->resourceName());\n }", "public function getPathLocation(): string;", "public function baseRelPath()\n {\n if($this instanceof Layout)\n {\n $class = Application::getApp();\n }\n else\n {\n $class = \\get_class($this);\n }\n $reflector = new \\ReflectionClass($class);\n $parts = \\explode('\\\\', $reflector->getName());\n $parts = \\array_chunk($parts, 3, false);\n return \\strtolower(\\implode('/', $parts[0])) . '/';\n }", "private function _get_view_path()\n\t{\n\t\t//return $this->_ci->load->_ci_view_paths;\n\t\treturn APPPATH.'views/';\n\t}", "public function get_qualifed_view_name()\n {\n return $this->qualifiedViewName;\n }", "protected function _view_path( $file ) {\n\t\tstatic $Path = null;\n\n\t\tif ( null === $Path ) {\n\t\t\t$basedir = dirname( dirname( __FILE__ ) ) . '/';\n\t\t\t$Path = $basedir . 'view/';\n\t\t}\n\n\t\treturn $Path . $file;\n\t}", "public function getViewPath()\n {\n return __DIR__ . '/../Views/';\n }", "public function view()\n {\n return $this->view;\n }", "public function view()\n {\n return $this->view;\n }", "public static function getDefaultViewPath(): string\n {\n return Path::packageCurrent(['resources/views']);\n }", "private static function viewPath($path)\n {\n $instance =& get_instance();\n\n if ($path[0] === '/') {\n // A Views \"Root\" path is wanted.\n $viewPath = APPPATH.\"Views\";\n }\n else {\n $viewPath = $instance->viewsPath();\n }\n\n return realpath($viewPath.$path.'.php');\n }", "public function getPath()\n {\n $controller = str_replace('\\\\', '/', $this->get('controller'));\n\n $path = (empty($controller) ? '' : $controller . '/') . $this->get('name') . '.' . $this->get('engine');\n\n return empty($this->parameters['bundle']) ? $path : '@' . $this->get('bundle') . '/resource/view/' . $path;\n }", "protected function getAdapterLocation()\n {\n $path = realpath($this->rootDir . '/../src/' . str_replace('\\\\', '/', $this->getAdapterNamespace()));\n return $path != false ? $path : null;\n }", "public function showPath()\n {\n return config('maxolex.config.views').'/'.$this->parser->singular().'/'.'show.blade.php';\n }", "public function loadPage()\n {\n $uri = Route::getFacadeRoot()->current()->uri();\n $view = $this->resolvePath($uri);\n\n return $view;\n }", "public function getViewPath()\n {\n if (is_dir(\\Yii::getAlias('@app/views/' . $this->module . '/blocks'))) {\n return '@app/views/' . $this->module . '/blocks';\n }\n\n return parent::getViewPath();\n }", "public static function ViewFolder()\n {\n return dirname(dirname(__DIR__)).DIRECTORY_SEPARATOR.Configuration::getApplicationFolder().DIRECTORY_SEPARATOR.'View';\n }", "protected function view()\n {\n return $this->app['view'];\n }", "public function path()\n {\n if (in_array($this->object->extension(), ['html', 'twig', 'md'])) {\n return $this->object->getViewPath();\n } else {\n return $this->object->getAssetPath();\n }\n }", "public static function location()\n\t{\n\t\tstatic $location;\n\n\t\tif($location === null)\n\t\t{\n\t\t\t$location = Config::get('mako.asset_location');\n\t\t}\n\n\t\treturn $location;\n\t}", "public function getDefaultViewBasePath()\n\t{\n\t\treturn $this->_isAbsolute($this->_defaultViewBasePath)\n\t\t\t? $this->_defaultViewBasePath\n\t\t\t: ($this->getAppPath() . '/' . $this->_defaultViewBasePath);\n\t}", "protected function getViewPath()\n {\n $name = str_replace('\\\\', '/', $this->argument('name'));\n\n return collect(explode('/', $name))\n ->map(function ($part) {\n return Str::camel($part);\n })\n ->implode('/');\n }", "public function getViewFile()\n {\n if ($this->isPhpBlock()) {\n return $this->getFolder() . '/view.php';\n }\n return $this->getFolder() . '/view.html';\n }", "public function get_action_view()\n {\n if (empty($this->uri)) {\n $uri = lcfirst($this->request->controller()) . '/' . $this->request->action();\n $dir = lcfirst($this->request->directory());\n\n if (!empty($dir))\n $uri = $dir . '/' . $uri;\n\n $this->uri = $uri;\n unset($uri, $dir);\n }\n return $this->uri;\n }", "public function getLocation() {\n\t\treturn($this->location);\n\t}", "public function getOrigin()\n\t{\n\t\tif ($this->template)\n\t\t{\n\t\t\t$file = $this->template;\n\n\t\t\tif (strncmp($file, 'string:', 7) === 0)\n\t\t\t{\n\t\t\t\t$file = substr($file, 7);\n\t\t\t\t$line = null;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$line = $this->templateLine;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$file = $this->file;\n\t\t\t$line = $this->line;\n\t\t}\n\n\t\treturn $file.($line ? \" ({$line})\" : '');\n\t}", "public function getLocation()\n\t{\n\t\treturn $this->_location;\n\t}", "function getViewFilePath();", "protected function setViewFile() {\n\t\treturn dirname( __FILE__ ) . '/view/footer.php';\n\t}", "protected function getCurrentAbsolutePath() {\n\t\treturn dirname(SS_ClassLoader::instance()->getManifest()->getItemPath(get_class($this)));\n\t}", "public function fieldView()\n {\n return $this->fieldType->viewPath();\n }", "public function location()\n {\n //\n return view('event.location');\n }", "protected function getViewRoot() {\r\n\t\treturn $this->getParent()->getViewRoot();\r\n\t}", "public function getViewScriptPath()\n {\n return realpath($this->getViewPath() . DIRECTORY_SEPARATOR . 'scripts');\n }", "public function getLocation()\n\t{\n\t\treturn $this->location;\n\t}", "public function getLocation()\n\t{\n\t\treturn $this->location;\n\t}", "public function getLocation()\n\t{\n\t\treturn $this->location;\n\t}", "public function getLocation()\n\t{\n\t\treturn $this->location;\n\t}", "public function getFullViewPath($view)\n {\n\t $viewPaths = ControllerHelper::getViewPaths($this);\n\n\t foreach ($viewPaths as $path) {\n\t\t $path = \\Yii::getAlias($path);\n\t\t $viewPath = $path . DIRECTORY_SEPARATOR . $view . '.' . $this->view->defaultExtension;\n\n\t\t if (file_exists($viewPath)) {\n\t return $viewPath;\n\t }\n\t }\n\n\t return false;\n }", "public function getView() {\n\t\treturn $this -> st_view;\n\t}", "public function path()\n {\n try {\n return ($this->engine->getResolveTemplatePath())($this->name);\n } catch (TemplateNotFound $e) {\n return $e->paths()[0];\n }\n }", "public function getTemplatePath()\n {\n return $this->document->documentURI;\n }", "public function get_location()\n\t{\n\t\treturn $this->location;\n\t}", "public function getLocation()\n {\n return isset($this->location) ? $this->location : null;\n }", "protected function _getBasePath()\n {\n if (null === $this->_actionController) {\n return './views';\n }\n\n $inflector = $this->getInflector();\n $this->_setInflectorTarget($this->getViewBasePathSpec());\n\n $dispatcher = $this->getFrontController()->getDispatcher();\n $request = $this->getRequest();\n\n $parts = [\n 'module' => (($moduleName = $request->getModuleName()) != '') ? $dispatcher->formatModuleName($moduleName) : $moduleName,\n 'controller' => $request->getControllerName(),\n 'action' => $dispatcher->formatActionName($request->getActionName())\n ];\n\n return $inflector->filter($parts);\n }", "public function getBaseViewsDir()\n {\n return $this->paths->getBaseViewsDir();\n }", "public function getViewRootDir()\n {\n $module = BModuleRegistry::i()->currentModule();\n\n return $module ? $module->view_root_dir : $this->_viewRootDir;\n }", "public function &getCurrentView()\n {\n return $this->_view;\n }", "public function getLocation()\n {\n return $this->location;\n }", "public function getLocation()\n {\n return $this->location;\n }", "public function getLocation()\n {\n return $this->location;\n }", "public function getLocation()\n {\n return $this->location;\n }", "public function getLocation()\n {\n return $this->location;\n }", "public function getLocation()\n {\n return $this->location;\n }", "public function getLocation()\n {\n return $this->location;\n }", "public function getLocation()\n {\n return $this->location;\n }", "public function getLocation()\n {\n return $this->location;\n }", "public function getLocation()\n {\n return $this->location;\n }", "public function getLocation()\n {\n return $this->location;\n }", "public function getLocation()\n {\n return $this->location;\n }", "public function getLocation()\n {\n return $this->location;\n }", "public function getLocationbase()\n {\n return $this->locationbase;\n }", "public function dirPath()\n {\n return config('maxolex.config.views').'/'.$this->parser->singular();\n }", "protected function viewsBasePath()\n {\n return base_path('nova-components/views/');\n }", "public function getLocation()\n {\n return $this->get('location');\n }", "public function getScriptPath()\n {\n return $this->layout->getView()->getScriptPath();\n }", "public function getLocation() {\n return $this->location;\n }", "public function getScriptPath()\n {\n return $this->getViewEntity()->getScriptPath();\n }", "public function myFileLocation()\r\n {\r\n $reflection = new ReflectionClass($this);\r\n\r\n return dirname($reflection->getFileName());\r\n }", "public function getView() {\n \t\n \t// Return the current view\n \treturn $this->sView;\n }", "public function getViewRootDir()\n {\n $module = $this->BModuleRegistry->currentModule();\n\n return $module ? $module->view_root_dir : $this->_viewRootDir;\n }", "function get_view_path($path)\n{\n\t\n\t$CI = & get_instance();\n\n\t$appsPath = dirname(dirname(dirname(__FILE__))).'/apps/';\n\n\t$appViewParent = basename(dirname($CI->load->_ci_view_path));\n\n\t$appPath = ($appsPath . $appViewParent);\n\n\treturn '<!-- view: ' . str_replace($appPath, '', $path) . '-->';\n\n}", "public function getLocation()\n\t{\n\t\treturn null;\n\t}", "public function getViewBasePathSpec()\n {\n return $this->_viewBasePathSpec;\n }", "function base_path()\n {\n $paths = getPaths();\n\n return $paths['base'];\n }", "public function getViewScriptPathSpec()\n {\n return $this->_viewScriptPathSpec;\n }", "protected function getPath()\n\t{\n\t\t$path = $this->provider->getPath().'/View';\n\t\t$old_path = $this->provider->getPath().'/views';\n\n\t\tforeach (array($path, $old_path) as $path)\n\t\t{\n\t\t\tif (file_exists($path.'/'.$this->path.'.php'))\n\t\t\t{\n\t\t\t\treturn $path.'/'.$this->path.'.php';\n\t\t\t}\n\t\t}\n\n\t\tthrow new \\Exception('View file not found: '.htmlentities($this->path));\n\t}", "public function GetThemeObjectViewsPath()\n {\n static $sPath;\n\n if (!$sPath) {\n $sPath = '';\n $sThemePath = $this->GetPrivateThemePath();\n if (!empty($sThemePath)) {\n $sPath = $sThemePath.'/objectviews/';\n }\n }\n\n return $sPath;\n }", "protected function getWidgetUri(): string\n {\n $uriBuilder = $this->controllerContext->getUriBuilder();\n\n $argumentsToBeExcludedFromQueryString = [\n '@package',\n '@subpackage',\n '@controller'\n ];\n\n $uriBuilder\n ->reset()\n ->setSection($this->arguments['section'] ?? $this->argumentDefinitions['section']->getDefaultValue())\n ->setCreateAbsoluteUri(true)\n ->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString)\n ->setFormat($this->arguments['format'] ?? $this->argumentDefinitions['format']->getDefaultValue());\n try {\n $uri = $uriBuilder->uriFor($this->arguments['action'] ?? $this->argumentDefinitions['action']->getDefaultValue(), $this->arguments['arguments'] ?? $this->argumentDefinitions['arguments']->getDefaultValue(), '', '', '');\n } catch (\\Exception $exception) {\n throw new ViewHelper\\Exception($exception->getMessage(), $exception->getCode(), $exception);\n }\n return $uri;\n }", "public function getLocation()\r\n {\r\n return $this->location;\r\n }", "public function getViewDir()\n {\n return $this->templateDir;\n }", "public function getLocation() : ?string\n {\n return $this->location;\n }", "public function getPackageLocation(): string;", "public function getLocation() {\n return $this->location;\n }" ]
[ "0.74754924", "0.731299", "0.731299", "0.7310194", "0.7252983", "0.71457577", "0.70997614", "0.7052534", "0.6998455", "0.6991721", "0.69238716", "0.6780578", "0.6703089", "0.66386616", "0.6589892", "0.65583473", "0.65274715", "0.65189034", "0.6448963", "0.6409178", "0.6391837", "0.6390199", "0.6372333", "0.6361706", "0.6341919", "0.6341919", "0.63356465", "0.63052416", "0.6296016", "0.6294257", "0.62927675", "0.6272211", "0.6249332", "0.62473464", "0.6239419", "0.62376386", "0.62321556", "0.62185943", "0.6213076", "0.6192115", "0.6185724", "0.61725867", "0.6151093", "0.6150106", "0.6148123", "0.6147413", "0.6143112", "0.6140498", "0.61362547", "0.6124189", "0.6122736", "0.61140305", "0.61140305", "0.61140305", "0.61140305", "0.61060697", "0.61025447", "0.6092956", "0.6079242", "0.606674", "0.60643214", "0.60640925", "0.6063433", "0.6062465", "0.6044168", "0.6042116", "0.6042116", "0.6042116", "0.6042116", "0.6042116", "0.6042116", "0.6042116", "0.6042116", "0.6042116", "0.6042116", "0.6042116", "0.6042116", "0.6042116", "0.603809", "0.6034428", "0.6033966", "0.60298085", "0.6029435", "0.6026856", "0.60006666", "0.59892476", "0.5982098", "0.5981523", "0.5975344", "0.5973125", "0.59640247", "0.5958674", "0.5949706", "0.5930768", "0.5926372", "0.59234685", "0.5913246", "0.59077793", "0.5905509", "0.5904892", "0.5903848" ]
0.0
-1
Get an array of possible view files.
protected function getPossibleViewFiles($name) { $user_id = Auth::user()->id ?? 0; //var_dump($user_id); return array_map(function ($extension) use ($name, $user_id) { return str_replace('.', '/', $name) . '.' . $extension; $segments = explode(".", $name); if (strstr($extension, 'blade.php') && count($segments) > 1 && $user_id > 0) { //entity_type/user_role/node_type/node_id/viewtype 比如 /waybill/admin/company/1/card //todo 应该获取指定的用户对应的角色和对应的各个节点类型节点编号对应的视图,并且在该方法内通过循环确定正确的视图文件名 $entity_type = $segments[0]; $view_type = $segments[1]; $user_role = 1; $node_type = 10; $node_id = 1; $name = "$entity_type.$user_role.$node_type.$node_id.$view_type"; } $filename = str_replace('.', '/', $name) . '.' . $extension; return $filename; }, $this->extensions); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function availableViews() {\n\tglobal $fmdb, $__FM_CONFIG;\n\t\n\t$array[0][] = __('All Views');\n\t$array[0][] = '0';\n\t\n\t$j = 0;\n\t/** Views */\n\t$result = basicGetList('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'views', 'view_name', 'view_');\n\tif ($fmdb->num_rows) {\n\t\t$results = $fmdb->last_result;\n\t\tfor ($i=0; $i<$fmdb->num_rows; $i++) {\n\t\t\t$array[$j+1][] = $results[$i]->view_name;\n\t\t\t$array[$j+1][] = $results[$i]->view_id;\n\t\t\t$j++;\n\t\t}\n\t}\n\t\n\treturn $array;\n}", "public function getViews(){\n\n if($this->safe($this->views)){\n //extract vlozi obsah z promenne do pohledu\n extract($this->data);\n extract($this->data, EXTR_PREFIX_ALL, \"\");\n require \"Views/\" . $this->views . \".phtml\";\n }\n }", "protected function getViewModuleFiles($view)\n {\n $rootPath = resource_path('views/' . str_replace('.', '/', $view));\n\n return [\n $rootPath . '/index',\n $rootPath . '/show',\n $rootPath . '/create',\n $rootPath . '/edit'\n ];\n }", "protected function getTyposcriptViewPaths(): array\n {\n // default views settings because TSFE is null when creating a new dce\n $viewsPaths = [\n 'layoutRootPaths' => [0 => 'EXT:dce/Resources/Private/Layouts/'],\n 'templateRootPaths' => [0 => 'EXT:dce/Resources/Private/Templates/'],\n 'partialRootPaths' => [0 => 'EXT:dce/Resources/Private/Partials/'],\n ];\n\n $pageUid = (isset($GLOBALS['TSFE'])) ? $GLOBALS['TSFE']->id : 1;\n $typoScriptSettings = $this->typoScriptUtility->getTyposcriptSettingsByPageUid($pageUid);\n if (isset($typoScriptSettings['view'])) {\n $viewsPaths = $typoScriptSettings['view'];\n }\n\n return $viewsPaths;\n }", "protected function getAllViews() {\n $views = array();\n $this->getAllViews0($views);\n return $views;\n }", "function get_views( ) {\r\n\t\t/*\r\n\t\t * Find current view\r\n\t\t */\r\n\t\tif ( $this->detached ) {\r\n\t\t\t$current_view = 'detached';\r\n\t\t} elseif ( $this->attached ) {\r\n\t\t\t$current_view = 'attached';\r\n\t\t} elseif ( $this->is_trash ) {\r\n\t\t\t$current_view = 'trash';\r\n\t\t} elseif ( empty( $_REQUEST['post_mime_type'] ) ) {\r\n\t\t\tif ( isset( $_REQUEST['meta_query'] ) ) {\r\n\t\t\t\t$query = json_decode( stripslashes( $_REQUEST['meta_query'] ), true );\r\n\t\t\t\t$current_view = $query['slug'];\r\n\t\t\t} else {\r\n\t\t\t\t$current_view = 'all';\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t$current_view = $_REQUEST['post_mime_type'];\r\n\t\t}\r\n\r\n\t\t$mla_types = MLAMime::mla_query_view_items( array( 'orderby' => 'menu_order' ), 0, 0 );\r\n\t\tif ( ! is_array( $mla_types ) ) {\r\n\t\t\t$mla_types = array ();\r\n\t\t}\r\n\r\n\t\t/*\r\n\t\t * Filter the list, generate the views\r\n\t\t */\r\n\t\t$view_links = array();\r\n\t\tforeach ( $mla_types as $value ) {\r\n\t\t\tif ( $value->table_view ) {\r\n\t\t\t\tif ( $current_view == $value->specification ) {\r\n\t\t\t\t\t$current_view = $value->slug;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( $link = self::_get_view( $value->slug, $current_view ) ) {\r\n\t\t\t\t\t$view_links[ $value->slug ] = $link;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn $view_links;\r\n\t}", "public function getViews();", "public function provideGetViewScript()\n {\n return [\n 'file does not exist' => [\n 'expected' => '',\n 'script' => '',\n 'filepaths' => '',\n 'paths' => [''],\n ],\n\n 'file does exist' => [\n 'expected' => __FILE__,\n 'script' => '',\n 'filepaths' => __FILE__,\n 'paths' => [''],\n ],\n ];\n }", "public function view(): array\n {\n $file = $this->model;\n\n return [\n 'breadcrumb' => function () use ($file): array {\n return $file->panel()->breadcrumb();\n },\n 'component' => 'k-file-view',\n 'props' => $this->props(),\n 'search' => 'files',\n 'title' => $file->filename(),\n ];\n }", "function fake_views_default_views() {\n $views = array();\n $view_files = file_scan_directory(drupal_get_path('module', \n'my_module') . '/views', '.*\\.views\\.inc\\.php');\n foreach ($view_files as $file => $data) {\n include $file;\n $views[$view->name] = $view;\n\n }\n return $views;\n\n}", "private static function get_views_options() {\n\t\t$views = FrmProDisplay::getAll( array(), 'post_title' );\n\t\t$views_options = array_map( 'self::set_view_options', $views );\n\t\t$views_options = array_reverse( $views_options );\n\n\t\treturn $views_options;\n\t}", "function _sebd7tweaks_API_read_views_from_folder($folder) {\n $views = array();\n // Rather than embedding long code from each views, each one have its own file...\n foreach(drupal_system_listing('/\\.inc$/', $folder, 'name', 0) as $file) {\n include $file->uri;\n $views[$view->name] = $view;\n }\n // Return the generated views array\n return $views;\n}", "protected function getFilesToProcess()\n {\n return array(\n 'custom/modules/Quotes/metadata/detailviewdefs.php',\n );\n }", "public function get_file_list()\n {\n return array(\n 'sources_custom/hooks/systems/addon_registry/idolisr.php',\n 'sources_custom/hooks/modules/members/idolisr.php',\n 'sources_custom/miniblocks/main_stars.php',\n 'sources_custom/miniblocks/side_recent_points.php',\n 'themes/default/templates_custom/POINTS_GIVE.tpl',\n 'themes/default/templates_custom/BLOCK_MAIN_STARS.tpl',\n 'themes/default/templates_custom/BLOCK_SIDE_RECENT_POINTS.tpl',\n );\n }", "public function getAllViews()\n {\n if (!$this->_area || empty($this->_areViewsCollectedInArea[$this->_area])) {\n $this->collectAllViewsFiles($this->_area);\n }\n return $this->_views;\n }", "function dp_selected_view_types() {\n\t$selected_types = get_option('dp_view_types');\n\tif(empty($selected_types))\n\t\treturn array();\n\n\t$supported_types = dp_supported_view_types();\n\tforeach($selected_types as $key => $value)\n\t\t$selected_types[$key] = $supported_types[$key];\n\n\treturn apply_filters('dp_selected_view_types', $selected_types);\n}", "public function GetViewsDir ();", "public function get_file_list()\n {\n return array(\n 'sources_custom/hooks/systems/addon_registry/trickstr.php',\n 'sources_custom/programe/.htaccess',\n 'sources_custom/programe/aiml/.htaccess',\n 'sources_custom/programe/aiml/index.html',\n 'sources_custom/programe/index.html',\n 'sources_custom/hooks/modules/chat_bots/knowledge.txt',\n 'sources_custom/hooks/modules/chat_bots/trickstr.php',\n 'sources_custom/programe/aiml/readme.txt',\n 'sources_custom/programe/aiml/startup.xml',\n 'sources_custom/programe/aiml/std-65percent.aiml',\n 'sources_custom/programe/aiml/std-pickup.aiml',\n 'sources_custom/programe/botloaderfuncs.php',\n 'sources_custom/programe/customtags.php',\n 'sources_custom/programe/db.sql',\n 'sources_custom/programe/graphnew.php',\n 'sources_custom/programe/respond.php',\n 'sources_custom/programe/util.php',\n );\n }", "public function get_file_list()\n {\n return array(\n 'sources_custom/hooks/systems/addon_registry/jestr.php',\n 'sources_custom/forum/cns.php',\n 'lang_custom/EN/jestr.ini',\n 'themes/default/templates_custom/EMOTICON_IMG_CODE_THEMED.tpl',\n 'forum/pages/modules_custom/topicview.php',\n 'sources_custom/hooks/systems/config/jestr_avatar_switch_shown_for.php',\n 'sources_custom/hooks/systems/config/jestr_emoticon_magnet_shown_for.php',\n 'sources_custom/hooks/systems/config/jestr_leet_shown_for.php',\n 'sources_custom/hooks/systems/config/jestr_name_changes.php',\n 'sources_custom/hooks/systems/config/jestr_name_changes_shown_for.php',\n 'sources_custom/hooks/systems/config/jestr_piglatin_shown_for.php',\n 'sources_custom/hooks/systems/config/jestr_string_changes.php',\n 'sources_custom/hooks/systems/config/jestr_string_changes_shown_for.php',\n );\n }", "function get_views() {\n\t\treturn Array(\n\t\t\t'all' => '<A href = \"/\" class = \"current\">All</a>',\n\t\t\t'approved' => '<a href = \"approved\">Approved</a>',\n\t\t\t'cancelled' => '<a href = \"cancelled\">Cancelled</a>'\n\t\t);\n\t}", "protected function getFiles(): array\n {\n return [];\n }", "public function getRouteFiles(): array;", "function getViewFilePath();", "public function get_file_list()\n {\n return array(\n 'sources_custom/hooks/systems/addon_registry/google_search.php',\n 'lang_custom/EN/google_search.ini',\n 'sources_custom/blocks/side_google_search.php',\n 'sources_custom/blocks/main_google_results.php',\n 'themes/default/templates_custom/BLOCK_SIDE_GOOGLE_SEARCH.tpl',\n 'themes/default/templates_custom/BLOCK_MAIN_GOOGLE_SEARCH_RESULTS.tpl',\n 'themes/default/css_custom/google_search.css',\n 'pages/comcode_custom/EN/_google_search.txt',\n );\n }", "function turnitintooltwo_get_view_actions() {\n return array('view');\n}", "public function viewProvider()\n {\n $config = $this->getMartyConfig();\n $templateDir = $config['templateDir'];\n $templates = [];\n $it = new \\RecursiveIteratorIterator(new \\RecursiveDirectoryIterator($templateDir));\n /** @var \\SplFileInfo $file */\n foreach ($it as $file) {\n if ($file->isFile() && $file->getExtension() == 'tpl') {\n $templateName = substr($file->getPathname(), strlen($templateDir) + 1);\n $templateId = str_replace(['/', '.tpl'], ['.', ''], $templateName);\n $templates[$templateId] = [$templateName];\n }\n }\n\n return $templates;\n }", "public function getFiles(): array;", "function _generateFilesList() {\n return array();\n }", "protected function getAllViewsNames() {\n $views = Views::getEnabledViews();\n $options = [];\n foreach ($views as $view) {\n $options[$view->get('id')] = $view->get('label');\n }\n return $options;\n }", "public function getDeviceFiles()\n {\n return [$this->getPreferredDeviceFile()];\n }", "public function browse_files()\n {\n // Scan file directory, render the images.\n if (is_dir($this->file_path)) {\n $files = preg_grep('/^([^.])/', scandir($this->file_path));\n return $files;\n }\n \n }", "public function getOtherFiles(): array;", "public function get_file_list()\n {\n return array(\n 'sources_custom/hooks/systems/addon_registry/wiki_sync.php',\n '_tests/tests/unit_tests/wiki_sync.php',\n 'lang_custom/EN/wiki_sync.ini',\n 'sources_custom/wiki_sync.php',\n 'sources_custom/hooks/systems/config/wiki_alt_changes_link_stub.php',\n 'sources_custom/hooks/systems/config/wiki_enable_git_sync.php',\n 'sources_custom/hooks/systems/config/wiki_enable_wysiwyg.php',\n 'sources_custom/hooks/systems/config/wiki_sync_media_directory.php',\n 'sources_custom/hooks/systems/config/wiki_sync_page_directory.php',\n 'sources_custom/hooks/systems/cron/wiki_sync_git.php',\n 'sources_custom/hooks/systems/notifications/wiki_failed_git_pull.php',\n 'sources_custom/wiki.php',\n 'site/pages/modules_custom/wiki.php',\n 'cms/pages/modules_custom/cms_wiki.php',\n );\n }", "public static function getIndexFiles()\n\t{\n\t\tif (empty(MHTTPD::$config['Server']['index_files'])) {\n\t\t\treturn array();\n\t\t}\n\t\treturn MHTTPD::$config['Server']['index_files'];\n\t}", "public function getFiles(): array\n {\n return [$this->file];\n }", "protected function defineViews()\n {\n return [\n 'index' => 'index',\n 'create' => 'create',\n 'confirm' => 'confirm',\n 'edit' => 'edit',\n 'complete' => 'complete'\n ];\n }", "function getAuthorViewableReviewFiles() {\r\n\t\treturn $this->getData('authorViewableReviewFiles');\r\n\t}", "public function optionList()\n {\n return array(\n 'file:', // The template file to be rendered\n );\n }", "public function getShowTemplates();", "public function getPermissionsFromFiles() : array\n {\n $path = base_path();\n $keys = [];\n $functions = [\n 'userCan',\n ];\n $pattern = // See http://regexr.com/392hu\n \"[^\\w|>]\" . // Must not have an alphanum or _ or > before real method\n \"(\" . implode('|', $functions) . \")\" . // Must start with one of the functions\n \"\\(\" . // Match opening parenthese\n \"[\\'\\\"]\" . // Match \" or '\n \"(\" . // Start a new group to match:\n // \"[a-zA-Z0-9_-]+\". // Must start with group\n \"([^\\1)]+)+\" . // Be followed by one or more items/keys\n \")\" . // Close group\n \"[\\'\\\"]\" . // Closing quote\n \"[\\),]\"; // Close parentheses or new parameter\n\n // Find all PHP + Twig files in the app folder, except for storage\n $finder = new Finder();\n $finder->in($path)->exclude('storage')->name('*.php')->name('*.twig')->files();\n\n /** @var \\Symfony\\Component\\Finder\\SplFileInfo $file */\n foreach ($finder as $file) {\n // Search the current file for the pattern\n if (preg_match_all(\"/$pattern/siU\", $file->getContents(), $matches)) {\n // Get all matches\n foreach ($matches[2] as $key) {\n $keys[] = $key;\n }\n }\n }\n\n // Remove duplicates\n $keys = array_unique($keys);\n\n $base_permissions = array_filter(explode(',', \\File::get(base_path('permissions.txt'))));\n\n return array_map('trim', array_merge($keys, $base_permissions));\n }", "public function getViews()\n {\n return $this->views;\n }", "protected function _scan_files()\n\t{\n\t\t$terms = array();\n\n\t\t$parser = new PHPParser_Parser(new PHPParser_Lexer);\n\n\t\tforeach ($this->_list_files(array('views', 'classes')) as $file)\n\t\t{\n\t\t\t$statements = $parser->parse(file_get_contents($file));\n\n\t\t\t$terms = Arr::merge($terms, $this->_get_terms_from_statements($statements));\n\t\t}\n\n\t\treturn $terms;\n\t}", "function dp_supported_view_types() {\n\t$types = array(\n\t\t'grid-mini' => __('Grid View with Mini Thumbnail', 'dp'),\n\t\t'grid-small' => __('Grid View with Small Thumbnail', 'dp'),\n\t\t'grid-medium' => __('Grid View with Medium Thumbnail', 'dp'),\n\t\t'list-small' => __('List View with Small Thumbnail', 'dp'),\n\t\t'list-medium' => __('List View with Medium Thumbnail', 'dp'),\n\t\t'list-large' => __('List View with Large Thumbnail', 'dp'),\n\t);\n\t\t\t\t\n\treturn apply_filters('dp_supported_view_types', $types);\n}", "public function getFiles()\n {\n $request = $this->getRequest();\n return (array)$request->getFiles();\n }", "public function getAllViews()\n {\n return $this->connection->select(\n $this->grammar->compileGetAllViews(\n $this->parseSearchPath(\n $this->connection->getConfig('search_path') ?: $this->connection->getConfig('schema')\n )\n )\n );\n }", "public function ShowFiles() {\n $i = 0;\n if ($handle = opendir($this->filePath)) {\n while (false !== ($file = readdir($handle))) {\n if (($file != '..') && ($file != '.') && ($file != 'Thumbs.db')) {\n $files[$i] = $file;\n $i++;\n }\n }\n closedir($handle);\n }\n return($files);\n }", "public function getViews()\n {\n\treturn $this->query('select [name] from [views]');\n }", "function views() {\n\t\t$this->view_rename(APP . 'views');\n\t\tprint_r($this->view_rename);\n\t}", "public function getFiles();", "public function getFiles();", "public function getFiles();", "public function getViews()\n {\n global $adminer;\n\n $main_actions = [\n 'add-view' => \\adminer\\lang('Create view'),\n ];\n\n $headers = [\n \\adminer\\lang('View'),\n \\adminer\\lang('Engine'),\n // \\adminer\\lang('Data Length'),\n // \\adminer\\lang('Index Length'),\n // \\adminer\\lang('Data Free'),\n // \\adminer\\lang('Auto Increment'),\n // \\adminer\\lang('Rows'),\n \\adminer\\lang('Comment'),\n ];\n\n // From db.inc.php\n // $table_status = \\adminer\\table_status('', true); // Tables details\n $table_status = \\adminer\\table_status(); // Tables details\n\n $details = [];\n foreach($table_status as $table => $status)\n {\n if(\\adminer\\is_view($status))\n {\n $details[] = [\n 'name' => $adminer->tableName($status),\n 'engine' => \\array_key_exists('Engine', $status) ? $status['Engine'] : '',\n 'comment' => \\array_key_exists('Comment', $status) ? $status['Comment'] : '',\n ];\n }\n }\n\n return \\compact('main_actions', 'headers', 'details');\n }", "protected function get_views()\n {\n }", "protected function get_views()\n {\n }", "protected function get_views()\n {\n }", "protected function get_views()\n {\n }", "public function get_views()\n\t{\n\t\treturn $this->driver_query('view_list');\n\t}", "public function GetViewAllURL();", "public function registerViews()\n {\n $paths = [];\n if (!$this->modules) {\n return $paths;\n }\n\n $modulesCollection = collect($this->modules);\n $activeModules = $modulesCollection->get(self::MODULE_VERSION);\n foreach ($activeModules as $module) {\n \\View::getFinder()->addLocation(base_path(\"App\\\\Modules\\\\\" . self::MODULE_VERSION . \"\\\\{$module}\\\\Resources\\\\Views\"));\n }\n\n }", "public function getFiles ();", "protected function getAllViews()\n {\n return $this->getConnection()->select(\n $this->grammar->compileGetAllViews()\n );\n }", "public function viewAllFiles()\n {\n $totalEnabledFiles = File::where('status', 1)->count();\n $enabledFiles = File::where('status', 1)->latest()->paginate(30, ['*'], 'enabledTable');\n $totaldisabledFiles = File::where('status', 1)->count();\n $disabledFiles = File::where('status', 0)->latest()->paginate(30, ['*'], 'disabledTable');\n return view('admin.file.viewAllFiles', compact('totalEnabledFiles', 'enabledFiles', 'totaldisabledFiles', 'disabledFiles'));\n }", "function get_displayable_file_types() {\n return array( \n 'ada',\n 'adb',\n 'adp',\n 'ads',\n 'ans',\n 'as',\n 'asc',\n 'asm',\n 'asp',\n 'aspx',\n 'atom',\n 'au3',\n 'bas',\n 'bat',\n 'bmax',\n 'bml',\n 'c',\n 'cbl',\n 'cc',\n 'cfm',\n 'cgi',\n 'cls',\n 'cmd',\n 'cob',\n 'cpp',\n 'cs',\n 'css',\n 'csv',\n 'cxx',\n 'd',\n 'dif',\n 'dist',\n 'dtd',\n 'e',\n 'efs',\n 'egg',\n 'egt',\n 'f',\n 'f77',\n 'for',\n 'frm',\n 'frx',\n 'ftn',\n 'ged',\n 'gitattributes',\n 'gitignore',\n 'gm6',\n 'gmd',\n 'gml',\n 'h',\n 'hpp',\n 'hs',\n 'hta',\n 'htaccess',\n 'htm',\n 'html',\n 'hxx',\n 'ici',\n 'ictl',\n 'ihtml',\n 'inc',\n 'inf',\n 'info',\n 'ini',\n 'install',\n 'java',\n 'js',\n 'jsfl',\n 'json',\n 'l',\n 'las',\n 'lasso',\n 'lassoapp',\n 'less',\n 'log',\n 'lua',\n 'm',\n 'm4',\n 'makefile',\n 'manifest',\n 'md',\n 'met',\n 'metalink',\n 'ml',\n 'module',\n 'mrc',\n 'n',\n 'ncf',\n 'nfo',\n 'nut',\n 'p',\n 'pas',\n 'php',\n 'php3',\n 'php4',\n 'php5',\n 'phps',\n 'phtml',\n 'piv',\n 'pl',\n 'pm',\n 'pp',\n 'properties',\n 'ps1',\n 'ps1xml',\n 'psc1',\n 'psd1',\n 'psm1',\n 'py',\n 'pyc',\n 'pyi',\n 'rb',\n 'rdf',\n 'resx',\n 'rss',\n 's',\n 'scm',\n 'scpt',\n 'sh',\n 'shtml',\n 'spin',\n 'sql',\n 'ss',\n 'stk',\n 'svg',\n 'tab',\n 'tcl',\n 'tpl',\n 'txt',\n 'vb',\n 'vbp',\n 'vbs',\n 'xht',\n 'xhtml',\n 'xml',\n 'xsl',\n 'xslt',\n 'xul',\n 'y',\n 'yml'\n );\n }", "public function getFileList(): array\n {\n return [\n app_path('User.php'),\n app_path('Http/Controllers/Auth/RegisterController.php'),\n config_path('auth.php'),\n config_path('services.php'),\n base_path('database/factories/UserFactory.php'),\n ];\n }", "public function getFileTypes() {\r\n return $this->fileTypes;\r\n }", "public function getViewTransformers(): array;", "abstract public function getViewFile($viewName);", "public function getLaravelViewPaths()\r\n {\r\n return $this->laravelViewsPath;\r\n }", "public function getViewModes(){\n return $this->viewModes;\n }", "protected function buildViewReplacements()\n {\n $viewModule = $this->parseViewModule($this->option('view'));\n\n if (empty($viewModule)) {\n $viewModule = $this->parseViewModule($this->ask('witch module\\'s view do you want to injected to the controller?'));\n }\n\n $views = $this->getViewModuleFiles($viewModule);\n\n foreach ($views as $view) {\n if (! file_exists($view.'.blade.php')) {\n if ($this->confirm(\"The {$viewModule} module has some views does not exist. Do you want to generate it?\", true)) {\n $this->call('make:view', ['name' => $viewModule]);\n }\n\n break;\n }\n }\n\n return [\n 'DummyRootView' => $viewModule,\n ];\n }", "protected function getAcceptFileTypes()\n {\n $extensions = $this->getValidator()->getAllowedExtensions();\n if (!$extensions) {\n return [];\n }\n $extentionString = \"\";\n $i = 0;\n foreach ($extensions as $extension) {\n if ($i == 0) {\n $extentionString .= \".{$extension}\";\n } else {\n $extentionString .= \", .{$extension}\";\n }\n $i++;\n }\n return $extentionString;\n }", "public function listAll()\n {\n $files = \\Core\\File\\System::listFiles($this->_getPath(), \\Core\\File\\System::EXCLUDE_DIRS);\n $result = [];\n foreach (array_keys($files) as $file) {\n $result[] = pathinfo($file, PATHINFO_FILENAME);\n }\n return $result;\n }", "function list_files () {\n\t\t$root = $this->get_root();\n\t\t\n\t\treturn $this->_list_files($root);\n\t}", "public function getFiles()\n {\n return isset($this->source['files']) && is_array($this->source['files']) ? $this->source['files'] : [];\n }", "public function listApplicationFiles() {\r\n\t\t$preload = array(\r\n\t\t\t\"config/main.js\"\r\n\t\t);\r\n\t\t\r\n\t\t$return = array();\r\n\t\t$fullPath = $this->applicationPath;\r\n\t\r\n\t\tforeach($preload as $file) {\r\n\t\t\t$return[] = $fullPath.\"/\".$file;\r\n\t\t}\r\n\t\t\r\n\t\t$options = array(\r\n\t\t\t\"fileTypes\" => array(\"js\"),\r\n\t\t\t\"exclude\" => array_merge($preload, array(\r\n\t\t\t\t\"data\", \"messages\", \"compiled.js\"\r\n\t\t\t))\r\n\t\t);\r\n\t\t\r\n\t\t$return = array_merge($return, CFileHelper::findFiles($fullPath,$options));\r\n\t\t\r\n\t\t\r\n\t\treturn $return;\r\n\t}", "public function files()\n {\n return $this->_array[\"files\"];\n }", "public function get_file_list()\n {\n return array(\n 'sources_custom/hooks/systems/addon_registry/mediaelement.php',\n 'data_custom/mediaelement/flashmediaelement.swf',\n 'data_custom/mediaelement/silverlightmediaelement.xap',\n 'themes/default/css_custom/mediaelementplayer.css',\n 'themes/default/images_custom/mediaelement/background.png',\n 'themes/default/images_custom/mediaelement/bigplay.png',\n 'themes/default/images_custom/mediaelement/bigplay_svg.svg',\n 'themes/default/images_custom/mediaelement/controls.png',\n 'themes/default/images_custom/mediaelement/controls_svg.svg',\n 'themes/default/images_custom/mediaelement/jumpforward.png',\n 'themes/default/images_custom/mediaelement/loading.gif',\n 'themes/default/images_custom/mediaelement/skipback.png',\n 'themes/default/javascript_custom/mediaelement-and-player.js',\n 'themes/default/templates_custom/MEDIA_AUDIO_WEBSAFE.tpl',\n 'themes/default/templates_custom/MEDIA_VIDEO_WEBSAFE.tpl',\n );\n }", "public function files()\n {\n if(isset($_GET['img']) || isset($_GET['js']) || isset($_GET['css']) || isset($_GET['pdf'])){\n if(isset($_GET['img'])){\n return $this->filesManager($_GET['img'], false, 'img');\n }\n if(isset($_GET['js'])){\n return $this->filesManager($this->nombreModulo, $_GET['js'], 'js');\n }\n if(isset($_GET['css'])){\n return $this->filesManager($this->nombreModulo, $_GET['css'], 'css');\n }\n if(isset($_GET['pdf'])){\n\n }\n }else{\n exit('Método no disponible');\n\n }\n }", "public function file_extensions_for_case_studies(){\n\t\t$filetype_arr = array();\n\t\t$filetype_arr['ppt'] = \"PowerPoint\";\n\t\t$filetype_arr['pptx'] = \"PowerPoint\";\n\t\t$filetype_arr['pdf'] = \"PDF file\";\n\t\treturn $filetype_arr;\n\t}", "public function getViewsInFolder(string $folderPath): array\n {\n $folderPathFileSystem = $this->getFolderPathOnFileSystem($folderPath);\n\n if (!File::exists($folderPathFileSystem)) {\n return [];\n }\n\n $files = $this->getAllowedViewTemplates($folderPathFileSystem);\n\n if (!count($files)) {\n return [];\n }\n\n $displayNames = array_map([$this, 'viewNameToReadableName'], $files);\n\n return array_combine($displayNames, $files);\n }", "public function getFileTypes()\n {\n return $this->fileTypes;\n }", "function questionnaire_get_view_actions() {\n return array('view', 'view all');\n}", "protected function get_views() {\n\t\t$all = http_build_query(array_merge($_GET, array(\"type\"=>\"all\")));\n\t\t$posters = http_build_query(array_merge($_GET, array(\"type\"=>\"posters\")));\n\t\t$iframes = http_build_query(array_merge($_GET, array(\"type\"=>\"iframes\")));\n\t\t\n\t\t\n\t\t//Stupid solution to mark selected link\n\t\t\n\t\t$selected_all = '';\n\t\t$selected_posters = '';\n\t\t$selected_iframes = '';\n\t\t\n\t\tif (isset ($_GET['type'])) {\n\t\t\tswitch ($_GET['type']) {\n\t\t\t\tcase 'posters':\n\t\t\t\t\t$selected_posters = 'style=\"color: black; font-weight: bold;\"';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'iframes':\n\t\t\t\t\t$selected_iframes = 'style=\"color: black; font-weight: bold;\"';\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$selected_all = 'style=\"color: black; font-weight: bold;\"';\n\t\t\t\t\t$selected_posters = '';\n\t\t\t\t\t$selected_iframes = '';\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t//Build links\n\t\t$status_links = array(\n\t\t\t\"all\" => __(\"<a $selected_all href='?$all'>Všetky</a>\",'page-rotation'),\n\t\t\t\"posters\" => __(\"<a $selected_posters href='?$posters'>Plagáty</a>\",'page-rotation'),\n\t\t\t\"iframes\" => __(\"<a $selected_iframes href='?$iframes'>Iframe</a>\",'page-rotation')\n\t\t);\n\t\treturn $status_links;\n\t}", "public function getFiles() {}", "public function getTemplates()\n {\n $finder = Finder::create()\n ->files()\n ->name('*.sql')\n ->in($this->rootDir.'/../templates')\n ;\n\n $templates = [];\n\n /** @var SplFileInfo $file */\n foreach ($finder as $file) {\n $templates[] = $file->getRelativePathname();\n }\n\n return $templates;\n }", "function get_files($route) {\n\tif (is_dir($route)) {\n\t\t$array_files = array();\n\t\t$files = opendir($route);\n\t\twhile ($file = readdir($files)) {\n\t\t\tif ($file != '.' && $file != '..' && !is_dir($route . '/' . $file)) {\n\t\t\t\t$extention = substr($file, -4);\n\t\t\t\t$file = substr($file, 0, -4);\n\t\t\t\tif ($file != 'index' && $extention == '.php') {\n\t\t\t\t\t$array_files[] = $file;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tclosedir($files);\n\t\treturn $array_files;\n\t} else {\n\t\treturn false;\n\t}\n}", "function customcert_get_view_actions() {\n return array('view', 'view all', 'view report');\n}", "function customcert_get_view_actions() {\n return array('view', 'view all', 'view report');\n}", "public static function getAllMimeTypes():array;", "function getViews() {\n return mysql_query(sprintf('SELECT TABLE_NAME, VIEW_DEFINITION FROM information_schema.views WHERE TABLE_SCHEMA=\\'%s\\'', $this->config[\"database\"]));\n }", "public function getPrintFiles()\n {\n $key = $this->specification->key;\n\n $files = glob(storage_path('prints' . DIRECTORY_SEPARATOR . $key . DIRECTORY_SEPARATOR . '*.docx'));\n $file_names = array_map('basename', $files);\n\n return $file_names;\n }", "final public function get_images() : array {\n Helper::load('files');\n\n return Files::get_files_in_dir($this->route);\n }", "public function getViewPath(): string;", "protected function createViewFiles()\n {\n $folderName = $this->config->get('produce::views_path') . '/' . strtolower($this->singularName);\n $fileNames = array('index', 'show', 'create', 'edit');\n\n if (! $this->folderExists($folderName)) {\n $this->createFolder($folderName);\n }\n\n foreach ($fileNames as $file) {\n $path = $folderName . '/' . $file . '.blade.php';\n $options = array('extends' => strtolower($this->extends));\n $data = $this->prepareData($options, 'view');\n\n if (! $this->filesystem->exists($path)) {\n $this->filesystem->put($path, $data);\n }\n\n }\n }", "public function provideAddViewScriptPath()\n {\n return [\n 'path not in APP_PATH' => [\n 'path' => '/some/path',\n ],\n\n 'path in APP_PATH' => [\n 'path' => APP_PATH . '/some/path',\n ]\n ];\n }", "function aspirelists_get_view_actions() {\n return array('view', 'view all');\n}", "private static function get_paths($view_path){\n\t\tif(substr($view_path, -1) != \"/\") $view_path.=\"/\";\n\t\t$check = strpos($view_path, \"?\");\n\t\tif(strpos($view_path, substr(DEFAULT_DIR, 1))){\n\t\t\tif($check != false) $path = explode(\"/\", substr($view_path, strlen(DEFAULT_DIR)+1, $check-1));\n\t\t\telse $path = explode(\"/\", substr($view_path, strlen(DEFAULT_DIR)+1));\n\t\t}else{\n\t\t\tif($check != false) $path = explode(\"/\", substr($view_path, 1, $check-1));\n\t\t\telse $path = explode(\"/\", substr($view_path, 1));\n\t\t}\n\t\t$path = flexMVC::filter_params($path);\n\t\tflexMVC::$params = $path;\n\t\treturn $path;\n\t}", "public static function available() {\n\t\treturn [\n\t\t\t'url' => [ 'url.php', 'Url_Action' ],\n\t\t\t'error' => [ 'error.php', 'Error_Action' ],\n\t\t\t'nothing' => [ 'nothing.php', 'Nothing_Action' ],\n\t\t\t'random' => [ 'random.php', 'Random_Action' ],\n\t\t\t'pass' => [ 'pass.php', 'Pass_Action' ],\n\t\t];\n\t}", "function files($file = null) {\n\t\tif (empty($file)) {\n\t\t\t$file = APP;\n\t\t} elseif (strpos($file, 'tmp')!==false || strpos($file, 'webroot')!==false || strpos($file, 'plugins')!==false || strpos($file, 'config')!==false || strpos($file, '/cake/')!==false) {\n\t\t\treturn null;\n\t\t}\n\t\tif (!isset($this->files)) {\n\t\t\t$this->files = array();\n\t\t}\n\t\tif (is_file($file)) {\n\t\t\tif ((strpos($file, '.php')===false && strpos($file, '.ctp')===false) || strpos($file, 'cake_up')!==false) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t$this->files[] = $file;\n\t\t} elseif (is_dir($file)) {\n\t\t\t$folder = new Folder($file);\n\t\t\t$contents = $folder->read();\n\t\t\tforeach ( $contents as $i => $_files ) {\n\t\t\t\tforeach ( $_files as $_file ) {\n\t\t\t\t\t$this->files(str_replace(DS.DS, DS, $file . DS . $_file));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $this->files;\n\t}", "public function index()\n {\n\n $this->types->trackFilter();\n\n return view('site::file.index', [\n 'repository' => $this->files,\n 'items' => $this->files->paginate(config('site.per_page.file', 10), ['files.*'])\n ]);\n }" ]
[ "0.68583673", "0.6747502", "0.6722233", "0.6706559", "0.6586508", "0.6569959", "0.6563175", "0.649346", "0.63854706", "0.63686913", "0.63263506", "0.63124937", "0.6309444", "0.6297853", "0.6285851", "0.6274101", "0.6222237", "0.6213446", "0.61889684", "0.61388683", "0.6132831", "0.61046475", "0.60920876", "0.6072598", "0.6049143", "0.6023067", "0.6020619", "0.60047156", "0.5982434", "0.5974242", "0.59587055", "0.5949104", "0.59361464", "0.59321433", "0.59104544", "0.5909137", "0.5888175", "0.5884105", "0.58658713", "0.5854279", "0.5849401", "0.58485633", "0.5836098", "0.5833466", "0.58305687", "0.58100057", "0.5807453", "0.58068025", "0.5800818", "0.5800818", "0.5800818", "0.5798253", "0.5797609", "0.5797609", "0.5797609", "0.5797609", "0.5792697", "0.5766196", "0.5763643", "0.57621235", "0.5761498", "0.57503223", "0.57313776", "0.57266706", "0.5719441", "0.57078433", "0.56954277", "0.56927174", "0.568653", "0.56857336", "0.56851333", "0.5678127", "0.5677881", "0.56753784", "0.5670583", "0.56644124", "0.56637955", "0.56609195", "0.5650019", "0.56430274", "0.5642353", "0.56302285", "0.56280017", "0.5623662", "0.5622605", "0.5619874", "0.5615357", "0.5615357", "0.5614922", "0.56034553", "0.5589266", "0.5588696", "0.55852395", "0.55770737", "0.5570432", "0.5563258", "0.5561678", "0.5551915", "0.5551213", "0.5543484" ]
0.7155296
0
Run the database seeds.
public function run() { Music::create([ 'nombre'=>'The legend of Hourai', 'descripcion'=>'La legenda nunca contada', 'album_id'=>'1', ]); Music::create([ 'nombre'=>'Default', 'descripcion'=>'Musica por defecto', 'album_id'=>'0', ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function run()\n {\n // $this->call(UserTableSeeder::class);\n // $this->call(PostTableSeeder::class);\n // $this->call(TagTableSeeder::class);\n // $this->call(PostTagTableSeeder::class);\n\n /*AB - use faker to populate table see file ModelFactory.php */\n factory(App\\Editeur::class, 40) ->create();\n factory(App\\Auteur::class, 40) ->create();\n factory(App\\Livre::class, 80) ->create();\n\n for ($i = 1; $i < 41; $i++) {\n $number = rand(2, 8);\n for ($j = 1; $j <= $number; $j++) {\n DB::table('auteur_livre')->insert([\n 'livre_id' => rand(1, 40),\n 'auteur_id' => $i\n ]);\n }\n }\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n // Let's truncate our existing records to start from scratch.\n Assignation::truncate();\n\n $faker = \\Faker\\Factory::create();\n \n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 40; $i++) {\n Assignation::create([\n 'ad_id' => $faker->numberBetween(1,20),\n 'buyer_id' => $faker->numberBetween(1,6),\n 'seller_id' => $faker->numberBetween(6,11),\n 'state' => NULL,\n ]);\n }\n\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n \t$faker = Faker::create();\n\n \tfor($i=0; $i<20; $i++) {\n \t\t$post = new Post;\n \t\t$post->title = $faker->sentence();\n \t\t$post->body = $faker->paragraph();\n \t\t$post->category_id = rand(1, 5);\n \t\t$post->save();\n \t}\n\n \t$list = ['General', 'Technology', 'News', 'Internet', 'Mobile'];\n \tforeach($list as $name) {\n \t\t$category = new Category;\n \t\t$category->name = $name;\n \t\t$category->save();\n \t}\n\n \tfor($i=0; $i<20; $i++) {\n \t\t$comment = new Comment;\n \t\t$comment->comment = $faker->paragraph();\n \t\t$comment->post_id = rand(1,20);\n \t\t$comment->save();\n \t}\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n $this->call(RoleTableSeeder::class);\n $this->call(UserTableSeeder::class);\n \n factory('App\\Cat', 5)->create();\n $tags = factory('App\\Tag', 8)->create();\n\n factory(Post::class, 15)->create()->each(function($post) use ($tags){\n $post->comments()->save(factory(Comment::class)->make());\n $post->tags()->attach( $tags->random(mt_rand(1,4))->pluck('id')->toArray() );\n });\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::table('post')->insert(\n [\n 'title' => 'Test Post1',\n 'desc' => str_random(100).\" post1\",\n 'alias' => 'test1',\n 'keywords' => 'test1',\n ]\n );\n DB::table('post')->insert(\n [\n 'title' => 'Test Post2',\n 'desc' => str_random(100).\" post2\",\n 'alias' => 'test2',\n 'keywords' => 'test2',\n ]\n );\n DB::table('post')->insert(\n [\n 'title' => 'Test Post3',\n 'desc' => str_random(100).\" post3\",\n 'alias' => 'test3',\n 'keywords' => 'test3',\n ]\n );\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n \t$faker = Factory::create();\n \t\n \tforeach ($this->departments as $key => $department) {\n \t\tDepartment::create([\n \t\t\t'name' => $department\n \t\t]);\n \t}\n \tforeach ($this->collections as $key => $collection) {\n \t\tCollection::create([\n \t\t\t'name' => $collection\n \t\t]);\n \t}\n \t\n \t\n \tfor ($i=0; $i < 40; $i++) {\n \t\tUser::create([\n \t\t\t'name' \t=>\t$faker->name,\n \t\t\t'email' \t=>\t$faker->email,\n \t\t\t'password' \t=>\tbcrypt('123456'),\n \t\t]);\n \t} \n \t\n \t\n \tforeach ($this->departments as $key => $department) {\n \t\t//echo ($key + 1) . PHP_EOL;\n \t\t\n \t\tfor ($i=0; $i < 10; $i++) { \n \t\t\techo $faker->name . PHP_EOL;\n\n \t\t\tArt::create([\n \t\t\t\t'name'\t\t\t=> $faker->sentence(2),\n \t\t\t\t'img'\t\t\t=> $this->filenames[$i],\n \t\t\t\t'medium'\t\t=> 'canvas',\n \t\t\t\t'department_id'\t=> $key + 1,\n \t\t\t\t'user_id'\t\t=> $this->userIndex,\n \t\t\t\t'dimension'\t\t=> '18.0 x 24.0',\n\t\t\t\t]);\n \t\t\t\t\n \t\t\t\t$this->userIndex ++;\n \t\t}\n \t}\n \t\n \tdd(\"END\");\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // $this->dataCategory();\n factory(App\\Model\\Category::class, 70)->create();\n factory(App\\Model\\Producer::class, rand(5,10))->create();\n factory(App\\Model\\Provider::class, rand(5,10))->create();\n factory(App\\Model\\Product::class, 100)->create();\n factory(App\\Model\\Album::class, 300)->create();\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n\n factory('App\\User', 10 )->create();\n\n $users= \\App\\User::all();\n $users->each(function($user){ factory('App\\Category', 1)->create(['user_id'=>$user->id]); });\n $users->each(function($user){ factory('App\\Tag', 3)->create(['user_id'=>$user->id]); });\n\n\n $users->each(function($user){\n factory('App\\Post', 10)->create([\n 'user_id'=>$user->id,\n 'category_id'=>rand(1,20)\n ]\n );\n });\n\n $posts= \\App\\Post::all();\n $posts->each(function ($post){\n\n $post->tags()->attach(array_unique([rand(1,20),rand(1,20),rand(1,20)]));\n });\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $types = factory(\\App\\Models\\Type::class, 5)->create();\n\n $cities = factory(\\App\\Models\\City::class, 10)->create();\n\n $cities->each(function ($city) {\n $districts = factory(\\App\\Models\\District::class, rand(2, 5))->create([\n 'city_id' => $city->id,\n ]);\n\n $districts->each(function ($district) {\n $properties = factory(\\App\\Models\\Property::class, rand(2, 5))->create([\n 'type_id' => rand(1, 5),\n 'district_id' => $district->id\n ]);\n\n $properties->each(function ($property) {\n $galleries = factory(\\App\\Models\\Gallery::class, rand(3, 10))->create([\n 'property_id' => $property->id\n ]);\n });\n });\n });\n }", "public function run()\n {\n $this->call(UsersTableSeeder::class);\n\n $categories = factory(App\\Models\\Category::class, 10)->create();\n\n $categories->each(function ($category) {\n $category\n ->posts()\n ->saveMany(\n factory(App\\Models\\Post::class, 3)->make()\n );\n });\n }", "public function run()\n {\n $this->call(CategoriesTableSeeder::class);\n\n $users = factory(App\\User::class, 5)->create();\n $recipes = factory(App\\Recipe::class, 30)->create();\n $preparations = factory(App\\Preparation::class, 70)->create();\n $photos = factory(App\\Photo::class, 90)->create();\n $comments = factory(App\\Comment::class, 200)->create();\n $flavours = factory(App\\Flavour::class, 25)->create();\n $flavour_recipe = factory(App\\FlavourRecipe::class, 50)->create();\n $tags = factory(App\\Tag::class, 25)->create();\n $recipe_tag = factory(App\\RecipeTag::class, 50)->create();\n $ingredients = factory(App\\Ingredient::class, 25)->create();\n $ingredient_preparation = factory(App\\IngredientPreparation::class, 300)->create();\n \n \n \n DB::table('users')->insert(['name' => 'SimpleUtilisateur', 'email' => '[email protected]', 'password' => bcrypt('SimpleMotDePasse')]);\n \n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n // Sample::truncate();\n // TestItem::truncate();\n // UOM::truncate();\n Role::truncate();\n User::truncate();\n\n // factory(Role::class, 4)->create();\n Role::create([\n 'name'=> 'Director',\n 'description'=> 'Director type'\n ]);\n\n Role::create([\n 'name'=> 'Admin',\n 'description'=> 'Admin type'\n ]);\n Role::create([\n 'name'=> 'Employee',\n 'description'=> 'Employee type'\n ]);\n Role::create([\n 'name'=> 'Technician',\n 'description'=> 'Technician type'\n ]);\n \n factory(User::class, 20)->create()->each(\n function ($user){\n $roles = \\App\\Role::all()->random(mt_rand(1, 2))->pluck('id');\n $user->roles()->attach($roles);\n }\n );\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n UsersLevel::create([\n 'name' => 'Administrator'\n ]);\n\n UsersLevel::create([\n 'name' => 'User'\n ]);\n\n User::create([\n 'username' => 'admin',\n 'password' => bcrypt('admin123'),\n 'level_id' => 1,\n 'fullname' => \"Super Admin\",\n 'email'=> \"[email protected]\"\n ]);\n\n\n \\App\\CategoryPosts::create([\n 'name' =>'Paket Trip'\n ]);\n\n \\App\\CategoryPosts::create([\n 'name' =>'Destinasi Kuliner'\n ]);\n\n \\App\\CategoryPosts::create([\n 'name' => 'Event'\n ]);\n\n \\App\\CategoryPosts::create([\n 'name' => 'Profil'\n ]);\n }", "public function run()\n {\n DB::table('users')->insert([\n 'name' => 'Admin',\n 'email' => '[email protected]',\n 'avatar' => \"avatar\",\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',\n ]);\n $this->call(CategorySeeder::class);\n // \\App\\Models\\Admin::factory(1)->create();\n \\App\\Models\\User::factory(10)->create();\n // \\App\\Models\\Category::factory(50)->create();\n \\App\\Models\\PetComment::factory(50)->create();\n $pets = \\App\\Models\\Pet::factory(50)->create();\n foreach ($pets as $pet) {\n \\App\\Models\\PetTag::factory(1)->create(['pet_id' => $pet->id]);\n \\App\\Models\\PetPhotoUrl::factory(1)->create(['pet_id' => $pet->id]);\n \\App\\Models\\Order::factory(1)->create(['pet_id' => $pet->id]);\n };\n }", "public function run()\n { \n\n $this->call(RoleSeeder::class);\n \n $this->call(UserSeeder::class);\n\n Storage::deleteDirectory('socials-icon');\n Storage::makeDirectory('socials-icon');\n $socials = Social::factory(7)->create();\n\n Storage::deleteDirectory('countries-flag');\n Storage::deleteDirectory('countries-firm');\n Storage::makeDirectory('countries-flag');\n Storage::makeDirectory('countries-firm');\n $countries = Country::factory(18)->create();\n\n // Se llenan datos de la tabla muchos a muchos - social_country\n foreach ($countries as $country) {\n foreach ($socials as $social) {\n\n $country->socials()->attach($social->id, [\n 'link' => 'https://www.facebook.com/ministeriopalabrayespiritu/'\n ]);\n }\n }\n\n Person::factory(50)->create();\n\n Category::factory(7)->create();\n\n Video::factory(25)->create(); \n\n $this->call(PostSeeder::class);\n\n Storage::deleteDirectory('documents');\n Storage::makeDirectory('documents');\n Document::factory(25)->create();\n\n }", "public function run()\n {\n $faker = Faker::create('id_ID');\n /**\n * Generate fake author data\n */\n for ($i=1; $i<=50; $i++) { \n DB::table('author')->insert([\n 'name' => $faker->name\n ]);\n }\n /**\n * Generate fake publisher data\n */\n for ($i=1; $i<=50; $i++) { \n DB::table('publisher')->insert([\n 'name' => $faker->name\n ]);\n }\n /**\n * Seeding payment method\n */\n DB::table('payment')->insert([\n ['name' => 'Mandiri'],\n ['name' => 'BCA'],\n ['name' => 'BRI'],\n ['name' => 'BNI'],\n ['name' => 'Pos Indonesia'],\n ['name' => 'BTN'],\n ['name' => 'Indomaret'],\n ['name' => 'Alfamart'],\n ['name' => 'OVO'],\n ['name' => 'Cash On Delivery']\n ]);\n }", "public function run()\n {\n DatabaseSeeder::seedLearningStylesProbs();\n DatabaseSeeder::seedCampusProbs();\n DatabaseSeeder::seedGenderProbs();\n DatabaseSeeder::seedTypeStudentProbs();\n DatabaseSeeder::seedTypeProfessorProbs();\n DatabaseSeeder::seedNetworkProbs();\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n // MyList::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 3; $i++) {\n MyList::create([\n 'title' => 'List-'.($i+1),\n 'color' => $faker->sentence,\n 'icon' => $faker->randomDigitNotNull,\n 'index' => $faker->randomDigitNotNull,\n 'user_id' => 1,\n ]);\n }\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n Products::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few products in our database:\n for ($i = 0; $i < 50; $i++) {\n Products::create([\n 'name' => $faker->word,\n 'sku' => $faker->randomNumber(7, false),\n ]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n User::create([\n 'name' => 'Pablo Rosales',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'status' => 1,\n 'role_id' => 1,\n 'movil' => 0\n ]);\n\n User::create([\n 'name' => 'Usuario Movil',\n 'email' => '[email protected]',\n 'password' => bcrypt('secret'),\n 'status' => 1,\n 'role_id' => 3,\n 'movil' => 1\n ]);\n\n Roles::create([\n 'name' => 'Administrador'\n ]);\n Roles::create([\n 'name' => 'Operaciones'\n ]);\n Roles::create([\n 'name' => 'Comercial'\n ]);\n Roles::create([\n 'name' => 'Aseguramiento'\n ]);\n Roles::create([\n 'name' => 'Facturación'\n ]);\n Roles::create([\n 'name' => 'Creditos y Cobros'\n ]);\n\n factory(App\\Customers::class, 100)->create();\n }", "public function run()\n {\n // php artisan db:seed --class=StoreTableSeeder\n\n foreach(range(1,20) as $i){\n $faker = Faker::create();\n Store::create([\n 'name' => $faker->name,\n 'desc' => $faker->text,\n 'tags' => $faker->word,\n 'address' => $faker->address,\n 'longitude' => $faker->longitude($min = -180, $max = 180),\n 'latitude' => $faker->latitude($min = -90, $max = 90),\n 'created_by' => '1'\n ]);\n }\n\n }", "public function run()\n {\n DB::table('users')->insert([\n 'name'=>\"test\",\n 'password' => Hash::make('123'),\n 'email'=>'[email protected]'\n ]);\n DB::table('tags')->insert(['name'=>'tags']);\n $this->call(UserSeed::class);\n $this->call(CategoriesSeed::class);\n $this->call(TopicsSeed::class);\n $this->call(CommentariesSeed::class);\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n echo 'seeding permission...', PHP_EOL;\n $permissions = [\n 'role-list',\n 'role-create',\n 'role-edit',\n 'role-delete',\n 'formation-list',\n 'formation-create',\n 'formation-edit',\n 'formation-delete',\n 'user-list',\n 'user-create',\n 'user-edit',\n 'user-delete'\n ];\n foreach ($permissions as $permission) {\n Permission::create(['name' => $permission]);\n }\n echo 'seeding users...', PHP_EOL;\n\n $user= User::create(\n [\n 'name' => 'Mr. admin',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'remember_token' => null,\n ]\n );\n echo 'Create Roles...', PHP_EOL;\n Role::create(['name' => 'former']);\n Role::create(['name' => 'learner']);\n Role::create(['name' => 'admin']);\n Role::create(['name' => 'manager']);\n Role::create(['name' => 'user']);\n\n echo 'seeding Role User...', PHP_EOL;\n $user->assignRole('admin');\n $role = $user->assignRole('admin');\n $role->givepermissionTo(Permission::all());\n\n \\DB::table('languages')->insert(['name' => 'English', 'code' => 'en']);\n \\DB::table('languages')->insert(['name' => 'Français', 'code' => 'fr']);\n }", "public function run()\n {\n $this->call(UsersTableSeeder::class);\n $this->call(PermissionsSeeder::class);\n $this->call(RolesSeeder::class);\n $this->call(ThemeSeeder::class);\n\n //\n\n DB::table('paypal_info')->insert([\n 'client_id' => '',\n 'client_secret' => '',\n 'currency' => '',\n ]);\n DB::table('contact_us')->insert([\n 'content' => '',\n ]);\n DB::table('setting')->insert([\n 'site_name' => ' ',\n ]);\n DB::table('terms_and_conditions')->insert(['terms_and_condition' => 'text']);\n }", "public function run()\n {\n $this->call([\n UserSeeder::class,\n ]);\n\n User::factory(20)->create();\n Author::factory(20)->create();\n Book::factory(60)->create();\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->call(UserSeeder::class);\n $this->call(RolePermissionSeeder::class);\n $this->call(AppmodeSeeder::class);\n\n // \\App\\Models\\Appmode::factory(3)->create();\n \\App\\Models\\Doctor::factory(100)->create();\n \\App\\Models\\Unit::factory(50)->create();\n \\App\\Models\\Broker::factory(100)->create();\n \\App\\Models\\Patient::factory(100)->create();\n \\App\\Models\\Expence::factory(100)->create();\n \\App\\Models\\Testcategory::factory(100)->create();\n \\App\\Models\\Test::factory(50)->create();\n \\App\\Models\\Parameter::factory(50)->create();\n \\App\\Models\\Sale::factory(50)->create();\n \\App\\Models\\SaleItem::factory(100)->create();\n \\App\\Models\\Goption::factory(1)->create();\n \\App\\Models\\Pararesult::factory(50)->create();\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // DB::table('roles')->insert(\n // [\n // ['name' => 'admin', 'description' => 'Administrator'],\n // ['name' => 'student', 'description' => 'Student'],\n // ['name' => 'lab_tech', 'description' => 'Lab Tech'],\n // ['name' => 'it_staff', 'description' => 'IT Staff Member'],\n // ['name' => 'it_manager', 'description' => 'IT Manager'],\n // ['name' => 'lab_manager', 'description' => 'Lab Manager'],\n // ]\n // );\n\n // DB::table('users')->insert(\n // [\n // 'username' => 'admin', \n // 'password' => Hash::make('password'), \n // 'active' => 1,\n // 'name' => 'Administrator',\n // 'email' => '[email protected]',\n // 'role_id' => \\App\\Role::where('name', 'admin')->first()->id\n // ]\n // );\n\n DB::table('status')->insert([\n // ['name' => 'Active'],\n // ['name' => 'Cancel'],\n // ['name' => 'Disable'],\n // ['name' => 'Open'],\n // ['name' => 'Closed'],\n // ['name' => 'Resolved'],\n ['name' => 'Used'],\n ]);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n factory(User::class)->create([\n 'name' => 'Qwerty',\n 'email' => '[email protected]',\n 'password' => bcrypt('secretpassw'),\n ]);\n\n factory(User::class, 59)->create([\n 'password' => bcrypt('secretpassw'),\n ]);\n\n for ($i = 1; $i < 11; $i++) {\n factory(Category::class)->create([\n 'name' => 'Category ' . $i,\n ]);\n }\n\n for ($i = 1; $i < 101; $i++) {\n factory(Product::class)->create([\n 'name' => 'Product ' . $i,\n ]);\n }\n }", "public function run()\n {\n\n \t// Making main admin role\n \tDB::table('roles')->insert([\n 'name' => 'Admin',\n ]);\n\n // Making main category\n \tDB::table('categories')->insert([\n 'name' => 'Other',\n ]);\n\n \t// Making main admin account for testing\n \tDB::table('users')->insert([\n 'name' \t\t=> 'Admin',\n 'email' \t=> '[email protected]',\n 'password' => bcrypt('12345'),\n 'role_id' => 1,\n 'created_at' => date('Y-m-d H:i:s' ,time()),\n 'updated_at' => date('Y-m-d H:i:s' ,time())\n ]);\n\n \t// Making random users and posts\n factory(App\\User::class, 10)->create();\n factory(App\\Post::class, 35)->create();\n }", "public function run()\n {\n $faker = Faker::create();\n\n \\DB::table('positions')->insert(array (\n 'codigo' => strtoupper($faker->randomLetter).$faker->postcode,\n 'nombre' => 'Chef',\n 'salario' => '15000.00'\n ));\n\n\t\t \\DB::table('positions')->insert(array (\n 'codigo' => strtoupper($faker->randomLetter).$faker->postcode,\n 'nombre' => 'Mesonero',\n 'salario' => '12000.00'\n ));\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $faker = \\Faker\\Factory::create();\n\n foreach (range(1,5) as $index) {\n Lista::create([\n 'name' => $faker->sentence(2),\n 'description' => $faker->sentence(10), \n ]);\n } \n\n foreach (range(1,20) as $index) {\n $n = $faker->sentence(2);\n \tTarea::create([\n \t\t'name' => $n,\n \t\t'description' => $faker->sentence(10),\n 'lista_id' => $faker->numberBetween(1,5),\n 'slug' => Str::slug($n),\n \t\t]);\n } \n }", "public function run()\n {\n $faker = Faker::create('lt_LT');\n\n DB::table('users')->insert([\n 'name' => 'user',\n 'email' => '[email protected]',\n 'password' => Hash::make('123')\n ]);\n DB::table('users')->insert([\n 'name' => 'user2',\n 'email' => '[email protected]',\n 'password' => Hash::make('123')\n ]);\n\n foreach (range(1,100) as $val)\n DB::table('authors')->insert([\n 'name' => $faker->firstName(),\n 'surname' => $faker->lastName(),\n \n ]);\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->call(UsersTableSeeder::class);\n\n // DB::table('users')->insert([\n // 'name' => 'User1',\n // 'email' => '[email protected]',\n // 'password' => bcrypt('password'),\n // ]);\n\n\n $faker = Faker::create();\n \n foreach (range(1,10) as $index){\n DB::table('companies')->insert([\n 'name' => $faker->company(),\n 'email' => $faker->email(10).'@gmail.com',\n 'logo' => $faker->image($dir = '/tmp', $width = 640, $height = 480),\n 'webiste' => $faker->domainName(),\n \n ]);\n }\n \n \n foreach (range(1,10) as $index){\n DB::table('employees')->insert([\n 'first_name' => $faker->firstName(),\n 'last_name' => $faker->lastName(),\n 'company' => $faker->company(),\n 'email' => $faker->str_random(10).'@gmail.com',\n 'phone' => $faker->e164PhoneNumber(),\n \n ]);\n }\n\n\n\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n Flight::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 100; $i++) {\n\n\n Flight::create([\n 'flightNumber' => $faker->randomNumber(5),\n 'depAirport' => $faker->city,\n 'destAirport' => $faker->city,\n 'reservedWeight' => $faker->numberBetween(1000 - 10000),\n 'deptTime' => $faker->dateTime('now'),\n 'arrivalTime' => $faker->dateTime('now'),\n 'reservedVolume' => $faker->numberBetween(1000 - 10000),\n 'airlineName' => $faker->colorName,\n ]);\n }\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->truncteTables([\n 'users',\n 'products'\n ]);\n\n $this->call(UsersSeeder::class);\n $this->call(ProductsSeeder::class);\n\n }", "public function run()\n {\n /**\n * Dummy seeds\n */\n DB::table('metas')->truncate();\n $faker = Faker::create();\n\n for ($i=0; $i < 10; $i++) { \n DB::table('metas')->insert([\n 'id_rel' => $faker->randomNumber(),\n 'titulo' => $faker->sentence,\n 'descricao' => $faker->paragraph,\n 'justificativa' => $faker->paragraph,\n 'valor_inicial' => $faker->numberBetween(0,100),\n 'valor_atual' => $faker->numberBetween(0,100),\n 'valor_final' => $faker->numberBetween(0,10),\n 'regras' => json_encode([$i => [\"values\" => $faker->words(3)]]),\n 'types' => json_encode([$i => [\"values\" => $faker->words(2)]]),\n 'categorias' => json_encode([$i => [\"values\" => $faker->words(4)]]),\n 'tags' => json_encode([$i => [\"values\" => $faker->words(5)]]),\n 'active' => true,\n ]);\n }\n\n\n }", "public function run()\n {\n // $this->call(UserTableSeeder::class);\n\n $faker = Faker::create();\n\n $lessonIds = Lesson::lists('id')->all(); // An array of ID's in that table [1, 2, 3, 4, 5, 7]\n $tagIds = Tag::lists('id')->all();\n\n foreach(range(1, 30) as $index)\n {\n // a real lesson id\n // a real tag id\n DB::table('lesson_tag')->insert([\n 'lesson_id' => $faker->randomElement($lessonIds),\n 'tag_id' => $faker->randomElement($tagIds),\n ]);\n }\n }", "public function run()\n {\n $this->call(CategoriasTableSeeder::class);\n $this->call(UfsTableSeeder::class);\n $this->call(UsersTableSeeder::class);\n $this->call(UserTiposTableSeeder::class);\n factory(App\\User::class, 2)->create();\n/* factory(App\\Models\\Categoria::class, 20)->create();*/\n/* factory(App\\Models\\Anuncio::class, 50)->create();*/\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n Language::truncate();\n Reason::truncate();\n Report::truncate();\n Category::truncate();\n Position::truncate();\n\n $languageQuantity = 10;\n $reasonQuantity = 10;\n $reportQuantity = 10;\n $categoryQuantity = 10;\n $positionQuantity = 10;\n\n factory(Language::class,$languageQuantity)->create();\n factory(Reason::class,$reasonQuantity)->create();\n \n factory(Report::class,$reportQuantity)->create();\n \n factory(Category::class,$categoryQuantity)->create();\n \n factory(Position::class,$positionQuantity)->create();\n\n }", "public function run()\n {\n // \\DB::statement('SET_FOREIGN_KEY_CHECKS=0');\n \\DB::table('users')->truncate();\n \\DB::table('posts')->truncate();\n // \\DB::table('category')->truncate();\n \\DB::table('photos')->truncate();\n \\DB::table('comments')->truncate();\n \\DB::table('comment_replies')->truncate();\n\n \\App\\Models\\User::factory()->times(10)->hasPosts(1)->create();\n \\App\\Models\\Role::factory()->times(10)->create();\n \\App\\Models\\Category::factory()->times(10)->create();\n \\App\\Models\\Comment::factory()->times(10)->hasReplies(1)->create();\n \\App\\Models\\Photo::factory()->times(10)->create();\n\n \n // \\App\\Models\\User::factory(10)->create([\n // 'role_id'=>2,\n // 'is_active'=>1\n // ]);\n\n // factory(App\\Models\\Post::class, 10)->create();\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n $this->call([\n ArticleSeeder::class, \n TagSeeder::class,\n Arttagrel::class\n ]);\n // \\App\\Models\\User::factory(10)->create();\n \\App\\Models\\Article::factory()->count(7)->create();\n \\App\\Models\\Tag::factory()->count(15)->create(); \n \\App\\Models\\Arttagrel::factory()->count(15)->create(); \n }", "public function run()\n {\n $this->call(ArticulosTableSeeder::class);\n /*DB::table('articulos')->insert([\n 'titulo' => str_random(50),\n 'cuerpo' => str_random(200),\n ]);*/\n }", "public function run()\n {\n $this->call(CategoryTableSeeder::class);\n $this->call(ProductTableSeeder::class);\n\n \t\t\n\t\t\tDB::table('users')->insert([\n 'first_name' => 'Ignacio',\n 'last_name' => 'Garcia',\n 'email' => '[email protected]',\n 'password' => bcrypt('123456'),\n 'role' => '1',\n 'avatar' => 'CGnABxNYYn8N23RWlvTTP6C2nRjOLTf8IJcbLqRP.jpeg',\n ]);\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->call(RoleSeeder::class);\n $this->call(UserSeeder::class);\n\n Medicamento::factory(50)->create();\n Reporte::factory(5)->create();\n Cliente::factory(200)->create();\n Asigna_valor::factory(200)->create();\n Carga::factory(200)->create();\n }", "public function run()\n {\n $this->call([\n RoleSeeder::class,\n TicketSeeder::class\n ]);\n\n DB::table('departments')->insert([\n 'abbr' => 'IT',\n 'name' => 'Information Technologies',\n 'created_at' => Carbon::now(),\n 'updated_at' => Carbon::now(),\n ]);\n\n DB::table('users')->insert([\n 'name' => 'admin',\n 'email' => '[email protected]',\n 'email_verified_at' => Carbon::now(),\n 'password' => Hash::make('admin'),\n 'department_id' => 1,\n 'avatar' => 'default.png',\n 'created_at' => Carbon::now(),\n 'updated_at' => Carbon::now(),\n ]);\n\n DB::table('role_user')->insert([\n 'role_id' => 1,\n 'user_id' => 1\n ]);\n }", "public function run()\n {\n \\App\\Models\\Article::factory(20)->create();\n \\App\\Models\\Category::factory(5)->create();\n \\App\\Models\\Comment::factory(40)->create();\n\n \\App\\Models\\User::create([\n \"name\"=>\"Alice\",\n \"email\"=>'[email protected]',\n 'password' => Hash::make('password'),\n ]);\n \\App\\Models\\User::create([\n \"name\"=>\"Bob\",\n \"email\"=>'[email protected]',\n 'password' => Hash::make('password'),\n ]);\n }", "public function run()\n {\n /** \n * Note: You must add these lines to your .env file for this Seeder to work (replace the values, obviously):\n SEEDER_USER_FIRST_NAME = 'Firstname'\n SEEDER_USER_LAST_NAME = 'Lastname'\n\t\tSEEDER_USER_DISPLAY_NAME = 'Firstname Lastname'\n\t\tSEEDER_USER_EMAIL = [email protected]\n SEEDER_USER_PASSWORD = yourpassword\n */\n\t\tDB::table('users')->insert([\n 'user_first_name' => env('SEEDER_USER_FIRST_NAME'),\n 'user_last_name' => env('SEEDER_USER_LAST_NAME'),\n 'user_name' => env('SEEDER_USER_DISPLAY_NAME'),\n\t\t\t'user_email' => env('SEEDER_USER_EMAIL'),\n 'user_status' => 1,\n \t'password' => Hash::make((env('SEEDER_USER_PASSWORD'))),\n 'permission_fk' => 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 }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(App\\User::class,3)->create()->each(\n \tfunction($user)\n \t{\n \t\t$user->questions()\n \t\t->saveMany(\n \t\t\tfactory(App\\Question::class, rand(2,6))->make()\n \t\t)\n ->each(function ($q) {\n $q->answers()->saveMany(factory(App\\Answer::class, rand(1,5))->make());\n })\n \t}\n );\n }\n}", "public function run()\n {\n $faker = Faker::create();\n\n // $this->call(UsersTableSeeder::class);\n\n DB::table('posts')->insert([\n 'id'=>str_random(1),\n 'user_id'=> str_random(1),\n 'title' => $faker->name,\n 'body' => $faker->safeEmail,\n 'created_at' => date('Y-m-d H:i:s'),\n 'updated_at' => date('Y-m-d H:i:s'),\n ]);\n }", "public function run()\n\t{\n\t\tDB::table(self::TABLE_NAME)->delete();\n\n\t\tforeach (seed(self::TABLE_NAME) as $row)\n\t\t\t$records[] = [\n\t\t\t\t'id'\t\t\t\t=> $row->id,\n\t\t\t\t'created_at'\t\t=> $row->created_at ?? Carbon::now(),\n\t\t\t\t'updated_at'\t\t=> $row->updated_at ?? Carbon::now(),\n\n\t\t\t\t'sport_id'\t\t\t=> $row->sport_id,\n\t\t\t\t'gender_id'\t\t\t=> $row->gender_id,\n\t\t\t\t'tournamenttype_id'\t=> $row->tournamenttype_id ?? null,\n\n\t\t\t\t'name'\t\t\t\t=> $row->name,\n\t\t\t\t'external_id'\t\t=> $row->external_id ?? null,\n\t\t\t\t'is_top'\t\t\t=> $row->is_top ?? null,\n\t\t\t\t'logo'\t\t\t\t=> $row->logo ?? null,\n\t\t\t\t'position'\t\t\t=> $row->position ?? null,\n\t\t\t];\n\n\t\tinsert(self::TABLE_NAME, $records ?? []);\n\t}", "public function run()\n\t{\n\t\tDB::table('libros')->truncate();\n\n\t\t$faker = Faker\\Factory::create();\n\n\t\tfor ($i=0; $i < 10; $i++) { \n\t\t\tLibro::create([\n\n\t\t\t\t'titulo'\t\t=> $faker->text(40),\n\t\t\t\t'isbn'\t\t\t=> $faker->numberBetween(100,999),\n\t\t\t\t'precio'\t\t=> $faker->randomFloat(2,3,150),\n\t\t\t\t'publicado'\t\t=> $faker->numberBetween(0,1),\n\t\t\t\t'descripcion'\t=> $faker->text(400),\n\t\t\t\t'autor_id'\t\t=> $faker->numberBetween(1,3),\n\t\t\t\t'categoria_id'\t=> $faker->numberBetween(1,3)\n\n\t\t\t]);\n\t\t}\n\n\t\t// Uncomment the below to run the seeder\n\t\t// DB::table('libros')->insert($libros);\n\t}", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(App\\User::class, 10)->create()->each(function ($user) {\n // Seed the relation with 5 purchases\n // $videos = factory(App\\Video::class, 5)->make();\n // $user->videos()->saveMany($videos);\n // $user->videos()->each(function ($video){\n // \t$video->videometa()->save(factory(App\\VideoMeta::class)->make());\n // \t// :( \n // });\n factory(App\\User::class, 10)->create()->each(function ($user) {\n\t\t\t factory(App\\Video::class, 5)->create(['user_id' => $user->id])->each(function ($video) {\n\t\t\t \tfactory(App\\VideoMeta::class, 1)->create(['video_id' => $video->id]);\n\t\t\t // $video->videometa()->save(factory(App\\VideoMeta::class)->create(['video_id' => $video->id]));\n\t\t\t });\n\t\t\t});\n\n });\n }", "public function run()\n {\n // for($i=1;$i<11;$i++){\n // DB::table('post')->insert(\n // ['title' => 'Title'.$i,\n // 'post' => 'Post'.$i,\n // 'slug' => 'Slug'.$i]\n // );\n // }\n $faker = Faker\\Factory::create();\n \n for($i=1;$i<20;$i++){\n $dname = $faker->name;\n DB::table('post')->insert(\n ['title' => $dname,\n 'post' => $faker->text($maxNbChars = 200),\n 'slug' => str_slug($dname)]\n );\n }\n }", "public function run()\n {\n $this->call([\n CountryTableSeeder::class,\n ProvinceTableSeeder::class,\n TagTableSeeder::class\n ]);\n\n User::factory()->count(10)->create();\n Category::factory()->count(5)->create();\n Product::factory()->count(20)->create();\n Section::factory()->count(5)->create();\n Bundle::factory()->count(20)->create();\n\n $bundles = Bundle::all();\n // populate bundle-product table (morph many-to-many)\n Product::all()->each(function ($product) use ($bundles) {\n $product->bundles()->attach(\n $bundles->random(2)->pluck('id')->toArray(),\n ['default_quantity' => rand(1, 10)]\n );\n });\n // populate bundle-tags table (morph many-to-many)\n Tag::all()->each(function ($tag) use ($bundles) {\n $tag->bundles()->attach(\n $bundles->random(2)->pluck('id')->toArray()\n );\n });\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n Contract::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 50; $i++) {\n Contract::create([\n 'serialnumbers' => $faker->numberBetween($min = 1000000, $max = 2000000),\n 'address' => $faker->address,\n 'landholder' => $faker->lastName,\n 'renter' => $faker->lastName,\n 'price' => $faker->numberBetween($min = 10000, $max = 50000),\n 'rent_start' => $faker->date($format = 'Y-m-d', $max = 'now'),\n 'rent_end' => $faker->date($format = 'Y-m-d', $max = 'now'),\n ]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $faker=Faker\\Factory::create();\n\n for($i=0;$i<100;$i++){\n \tApp\\Blog::create([\n \t\t'title' => $faker->catchPhrase,\n 'description' => $faker->text,\n 'showns' =>true\n \t\t]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0'); // TO PREVENT CHECKS FOR foreien key in seeding\n\n User::truncate();\n Category::truncate();\n Product::truncate();\n Transaction::truncate();\n\n DB::table('category_product')->truncate();\n\n User::flushEventListeners();\n Category::flushEventListeners();\n Product::flushEventListeners();\n Transaction::flushEventListeners();\n\n $usersQuantities = 1000;\n $categoriesQuantities = 30;\n $productsQuantities = 1000;\n $transactionsQuantities = 1000;\n\n factory(User::class, $usersQuantities)->create();\n factory(Category::class, $categoriesQuantities)->create();\n\n factory(Product::class, $productsQuantities)->create()->each(\n function ($product) {\n $categories = Category::all()->random(mt_rand(1, 5))->pluck('id');\n $product->categories()->attach($categories);\n });\n\n factory(Transaction::class, $transactionsQuantities)->create();\n }", "public function run()\n {\n // $this->call(UserSeeder::class);\n $this->call(PermissionsTableSeeder::class);\n $this->call(UsersTableSeeder::class);\n\n $this->call(BusinessTableSeeder::class);\n $this->call(PrinterTableSeeder::class);\n factory(App\\Tag::class,10)->create();\n factory(App\\Category::class,10)->create();\n factory(App\\Subcategory::class,50)->create();\n factory(App\\Provider::class,10)->create();\n factory(App\\Product::class,24)->create()->each(function($product){\n\n $product->images()->saveMany(factory(App\\Image::class, 4)->make());\n\n });\n\n\n factory(App\\Client::class,10)->create();\n }", "public function run()\n {\n Article::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 50; $i++) {\n Article::create([\n 'name' => $faker->sentence,\n 'sku' => $faker->paragraph,\n 'price' => $faker->number,\n ]);\n }\n }", "public function run()\n {\n Storage::deleteDirectory('public/products');\n Storage::makeDirectory('public/products');\n\n $this->call(UserSeeder::class);\n Category::factory(4)->create();\n $this->call(ProductSeeder::class);\n Order::factory(4)->create();\n Order_Detail::factory(4)->create();\n Size::factory(100)->create();\n }", "public function run()\n {\n $this->call(RolSeeder::class);\n\n $this->call(UserSeeder::class);\n Category::factory(4)->create();\n Doctor::factory(25)->create();\n Patient::factory(50)->create();\n Status::factory(3)->create();\n Appointment::factory(100)->create();\n }", "public function run()\n\t{\n\t\t\n\t\tDB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n\t\t$faker = \\Faker\\Factory::create();\n\n\t\tTodolist::truncate();\n\n\t\tforeach(range(1, 50) as $index)\n\t\t{\n\n\t\t\t$user = User::create([\n\t\t\t\t'name' => $faker->name,\n\t\t\t\t'email' => $faker->email,\n\t\t\t\t'password' => 'password',\n\t\t\t\t'confirmation_code' => mt_rand(0, 9),\n\t\t\t\t'confirmation' => rand(0,1) == 1\n\t\t\t]);\n\n\t\t\t$list = Todolist::create([\n\t\t\t\t'name' => $faker->sentence(2),\n\t\t\t\t'description' => $faker->sentence(4),\n\t\t\t]);\n\n\t\t\t// BUILD SOME TASKS FOR EACH LIST ITEM\n\t\t\tforeach(range(1, 10) as $index) \n\t\t\t{\n\t\t\t\t$task = new Task;\n\t\t\t\t$task->name = $faker->sentence(2);\n\t\t\t\t$task->description = $faker->sentence(4);\n\t\t\t\t$list->tasks()->save($task);\n\t\t\t}\n\n\t\t}\n\n\t\tDB::statement('SET FOREIGN_KEY_CHECKS = 1'); \n\n\t}", "public function run()\n {\n Campus::truncate();\n Canteen::truncate();\n Dorm::truncate();\n\n $faker = Faker\\Factory::create();\n $schools = School::all();\n foreach ($schools as $school) {\n \tforeach (range(1, 2) as $index) {\n\t \t$campus = Campus::create([\n\t \t\t'school_id' => $school->id,\n\t \t\t'name' => $faker->word . '校区',\n\t \t\t]);\n\n \t$campus->canteens()->saveMany(factory(Canteen::class, mt_rand(2,3))->make());\n $campus->dorms()->saveMany(factory(Dorm::class, mt_rand(2,3))->make());\n\n }\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::table('users')->insert([\n 'name' => 'admin',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'seq_q'=>'1',\n 'seq_a'=>'admin'\n ]);\n\n // DB::table('bloods')->insert([\n // ['name' => 'A+'],\n // ['name' => 'A-'],\n // ['name' => 'B+'],\n // ['name' => 'B-'],\n // ['name' => 'AB+'],\n // ['name' => 'AB-'],\n // ['name' => 'O+'],\n // ['name' => 'O-'],\n // ]);\n\n \n }", "public function run()\n {\n // $this->call(UserTableSeeder::class);\n \\App\\User::create([\n 'name'=>'PAPE SAMBA NDOUR',\n 'email'=>'[email protected]',\n 'password'=>bcrypt('Admin1122'),\n ]);\n\n $faker = Faker::create();\n\n for ($i = 0; $i < 100 ; $i++)\n {\n $firstName = $faker->firstName;\n $lastName = $faker->lastName;\n $niveau = \\App\\Niveau::inRandomOrder()->first();\n \\App\\Etudiant::create([\n 'prenom'=>$firstName,\n 'nom'=>$lastName,\n 'niveau_id'=>$niveau->id\n ]);\n }\n\n\n }", "public function run()\n {\n //\n DB::table('foods')->delete();\n\n Foods::create(array(\n 'name' => 'Chicken Wing',\n 'author' => 'Bambang',\n 'overview' => 'a deep-fried chicken wing, not in spicy sauce'\n ));\n\n Foods::create(array(\n 'name' => 'Beef ribs',\n 'author' => 'Frank',\n 'overview' => 'Slow baked beef ribs rubbed in spices'\n ));\n\n Foods::create(array(\n 'name' => 'Ice cream',\n 'author' => 'Lou',\n 'overview' => ' A sweetened frozen food typically eaten as a snack or dessert.'\n ));\n\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n News::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 10; $i++) {\n News::create([\n 'title' => $faker->sentence,\n 'summary' => $faker->sentence,\n 'content' => $faker->paragraph,\n 'imagePath' => '/img/exclamation_mark.png'\n ]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(App\\User::class, 3)->create();\n factory(App\\Models\\Category::class, 3)\n ->create()\n ->each(function ($u) {\n $u->courses()->saveMany(factory(App\\Models\\Course::class,3)->make())->each(function ($c){\n $c->exams()->saveMany(factory(\\App\\Models\\Exam::class,3)->make())->each(function ($e){\n $e->questions()->saveMany(factory(\\App\\Models\\Question::class,4)->make())->each(function ($q){\n $q->answers()->saveMany(factory(\\App\\Models\\Answer::class,4)->make())->each(function ($a){\n $a->correctAnswer()->save(factory(\\App\\Models\\Correct_answer::class)->make());\n });\n });\n });\n });\n\n });\n\n }", "public function run()\n {\n \\DB::table('employees')->delete();\n\n $faker = \\Faker\\Factory::create('ja_JP');\n\n $role_id = ['1','2','3'];\n\n for ($i = 0; $i < 10; $i++) {\n \\App\\Models\\Employee::create([\n 'last_name' =>$faker->lastName() ,\n 'first_name' => $faker->firstName(),\n 'mail' => $faker->email(),\n 'password' => Hash::make( \"password.$i\"),\n 'birthday' => $faker->date($format='Y-m-d',$max='now'),\n 'role_id' => $faker->randomElement($role_id)\n ]);\n }\n }", "public function run()\n {\n\n DB::table('clients')->delete();\n DB::table('trips')->delete();\n error_log('empty tables done.');\n\n $random_cities = City::inRandomOrder()->select('ar_name')->limit(5)->get();\n $GLOBALS[\"random_cities\"] = $random_cities->pluck('ar_name')->toArray();\n\n $random_airlines = Airline::inRandomOrder()->select('code')->limit(5)->get();\n $GLOBALS[\"random_airlines\"] = $random_airlines->pluck('code')->toArray();\n\n factory(App\\Client::class, 5)->create();\n error_log('Client seed done.');\n\n\n factory(App\\Trip::class, 50)->create();\n error_log('Trip seed done.');\n\n\n factory(App\\Quicksearch::class, 10)->create();\n error_log('Quicksearch seed done.');\n }", "public function run()\n {\n // Admins\n User::factory()->create([\n 'name' => 'Zaiman Noris',\n 'username' => 'rognales',\n 'email' => '[email protected]',\n 'active' => true,\n ]);\n\n User::factory()->create([\n 'name' => 'Affiq Rashid',\n 'username' => 'affiqr',\n 'email' => '[email protected]',\n 'active' => true,\n ]);\n\n // Only seed test data in non-prod\n if (! app()->isProduction()) {\n Member::factory()->count(1000)->create();\n Staff::factory()->count(1000)->create();\n\n Participant::factory()\n ->addSpouse()\n ->addChildren()\n ->addInfant()\n ->addOthers()\n ->count(500)\n ->hasUploads(2)\n ->create();\n }\n }", "public function run()\n {\n $this->call([\n RoleSeeder::class,\n UserSeeder::class,\n ]);\n\n \\App\\Models\\Category::factory(4)->create();\n \\App\\Models\\View::factory(6)->create();\n \\App\\Models\\Room::factory(8)->create();\n \n $rooms = \\App\\Models\\Room::all();\n // \\App\\Models\\User::all()->each(function ($user) use ($rooms) { \n // $user->rooms()->attach(\n // $rooms->random(rand(1, \\App\\Models\\Room::max('id')))->pluck('id')->toArray()\n // ); \n // });\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n Employee::factory()->create(['email' => '[email protected]']);\n Brand::factory()->count(3)->create();\n $this->call([\n TagSeeder::class,\n AttributeSeeder::class,\n AttributeValueSeeder::class,\n ProductSeeder::class,\n ]);\n }", "public function run()\n {\n $this->call(RolesTableSeeder::class); // crée les rôles\n $this->call(PermissionsTableSeeder::class); // crée les permissions\n\n factory(Employee::class,3)->create();\n factory(Provider::class,1)->create();\n\n $user = User::create([\n 'name'=>'Alioune Bada Ndoye',\n 'email'=>'[email protected]',\n 'phone'=>'773012470',\n 'password'=>bcrypt('123'),\n ]);\n Employee::create([\n 'job'=>'Informaticien',\n 'user_id'=>User::where('email','[email protected]')->first()->id,\n 'point_id'=>Point::find(1)->id,\n ]);\n $user->assignRole('admin');\n }", "public function run()\n {\n // $this->call(UserSeeder::class);\n factory(User::class, 1)\n \t->create(['email' => '[email protected]']);\n\n factory(Category::class, 5)->create();\n }", "public function run()\n {\n //$this->call(UsersTableSeeder::class);\n $this->call(rootSeed::class);\n factory(App\\Models\\Egresado::class,'hombre',15)->create();\n factory(App\\Models\\Egresado::class,'mujer',15)->create();\n factory(App\\Models\\Administrador::class,5)->create();\n factory(App\\Models\\Notificacion::class,'post',10)->create();\n factory(App\\Models\\Notificacion::class,'mensaje',5)->create();\n factory(App\\Models\\Egresado::class,'bajaM',5)->create();\n factory(App\\Models\\Egresado::class,'bajaF',5)->create();\n factory(App\\Models\\Egresado::class,'suscritam',5)->create();\n factory(App\\Models\\Egresado::class,'suscritaf',5)->create();\n }", "public function run()\n {\n \n User::factory(1)->create([\n 'rol'=>'EPS'\n ]);\n Person::factory(10)->create();\n $this->call(EPSSeeder::class);\n $this->call(OfficialSeeder::class);\n $this->call(VVCSeeder::class);\n $this->call(VaccineSeeder::class);\n }", "public function run()\n {\n // $faker=Faker::create();\n // foreach(range(1,100) as $index)\n // {\n // DB::table('products')->insert([\n // 'name' => $faker->name,\n // 'price' => rand(10,100000)/100\n // ]);\n // }\n }", "public function run()\n {\n $this->call([\n LanguagesTableSeeder::class,\n ListingAvailabilitiesTableSeeder::class,\n ListingTypesTableSeeder::class,\n RoomTypesTableSeeder::class,\n AmenitiesTableSeeder::class,\n UsersTableSeeder::class,\n UserLanguagesTableSeeder::class,\n ListingsTableSeeder::class,\n WishlistsTableSeeder::class,\n StaysTableSeeder::class,\n GuestsTableSeeder::class,\n TripsTableSeeder::class,\n ReviewsTableSeeder::class,\n RatingsTableSeeder::class,\n PopularDestinationsTableSeeder::class,\n ImagesTableSeeder::class,\n ]);\n\n // factory(App\\User::class, 5)->states('host')->create();\n // factory(App\\User::class, 10)->states('hostee')->create();\n\n // factory(App\\User::class, 10)->create();\n // factory(App\\Models\\Listing::class, 30)->create();\n }", "public function run()\n {\n Schema::disableForeignKeyConstraints();\n Grade::truncate();\n Schema::enableForeignKeyConstraints();\n\n $faker = \\Faker\\Factory::create();\n\n for ($i = 0; $i < 10; $i++) {\n Grade::create([\n 'letter' => $faker->randomElement(['а', 'б', 'в']),\n 'school_id' => $faker->unique()->numberBetween(1, School::count()),\n 'level' => 1\n ]);\n }\n }", "public function run()\n {\n // $this->call(UserSeeder::class);\n factory(App\\User::class,5)->create();//5 User created\n factory(App\\Model\\Genre::class,5)->create();//5 genres\n factory(App\\Model\\Film::class,6)->create();//6 films\n factory(App\\Model\\Comment::class, 20)->create();// 20 comments\n }", "public function run()\n {\n\n $this->call(UserSeeder::class);\n factory(Empresa::class,10)->create();\n factory(Empleado::class,50)->create();\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n User::create([\n 'name' => 'jose luis',\n 'email' => '[email protected]',\n 'password' => bcrypt('xxxxxx'),\n 'role' => 'admin',\n ]);\n\n Category::create([\n 'name' => 'inpods',\n 'description' => 'auriculares inalambricos que funcionan con blouthue genial'\n ]);\n\n Category::create([\n 'name' => 'other',\n 'description' => 'otra cosa diferente a un inpods'\n ]);\n\n\n /* Create 10 products */\n Product::factory(10)->create();\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(User::class)->create([\n 'email' => '[email protected]',\n 'name' => 'Russell'\n ]);\n\n factory(User::class)->create([\n 'email' => '[email protected]',\n 'name' => 'Bitfumes'\n ]);\n\n factory(User::class)->create([\n 'email' => '[email protected]',\n 'name' => 'Paul'\n ]);\n }", "public function run()\n {\n $user_ids = [1,2,3];\n $faker = app(\\Faker\\Generator::class);\n $posts = factory(\\App\\Post::class)->times(50)->make()->each(function($post) use ($user_ids,$faker){\n $post->user_id = $faker->randomElement($user_ids);\n });\n \\App\\Post::insert($posts->toArray());\n }", "public function run()\n {\n // Vaciar la tabla.\n Favorite::truncate();\n $faker = \\Faker\\Factory::create();\n // Crear artículos ficticios en la tabla\n\n // factory(App\\Models\\User::class, 2)->create()->each(function ($user) {\n // $user->users()->saveMany(factory(App\\Models\\User::class, 25)->make());\n //});\n }", "public function run()\n\t{\n\t\t$this->call(ProductsTableSeeder::class);\n\t\t$this->call(CategoriesTableSeeder::class);\n\t\t$this->call(BrandsTableSeeder::class);\n\t\t$this->call(ColorsTableSeeder::class);\n\n\t\t$products = \\App\\Product::all();\n \t$categories = \\App\\Category::all();\n \t$brands = \\App\\Brand::all();\n \t$colors = \\App\\Color::all();\n\n\t\tforeach ($products as $product) {\n\t\t\t$product->colors()->sync($colors->random(3));\n\n\t\t\t$product->category()->associate($categories->random(1)->first());\n\t\t\t$product->brand()->associate($brands->random(1)->first());\n\n\t\t\t$product->save();\n\t\t}\n\n\t\t// for ($i = 0; $i < count($products); $i++) {\n\t\t// \t$cat = $categories[rand(0,5)];\n\t\t// \t$bra = $brands[rand(0,7)];\n\t\t// \t$cat->products()->save($products[$i]);\n\t\t// \t$bra->products()->save($products[$i]);\n\t\t// }\n\n\t\t// $products = factory(App\\Product::class)->times(20)->create();\n\t\t// $categories = factory(App\\Category::class)->times(6)->create();\n\t\t// $brands = factory(App\\Brand::class)->times(8)->create();\n\t\t// $colors = factory(App\\Color::class)->times(15)->create();\n\t}", "public function run()\n {\n /*$this->call(UsersTableSeeder::class);\n $this->call(GroupsTableSeeder::class);\n $this->call(TopicsTableSeeder::class);\n $this->call(CommentsTableSeeder::class);*/\n DB::table('users')->insert([\n 'name' => 'pkw',\n 'email' => '[email protected]',\n 'password' => bcrypt('secret'),\n 'type' => '1'\n ]);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $faker = Faker::create();\n foreach (range(1,200) as $index) {\n DB::table('users')->insert([\n 'name' => $faker->name,\n 'email' => $faker->email,\n 'phone' => $faker->randomDigitNotNull,\n 'address'=> $faker->streetAddress,\n 'password' => bcrypt('secret'),\n ]);\n }\n }", "public function run()\n {\n $this->call(UsersSeeder::class);\n User::factory(2)->create();\n Company::factory(2)->create();\n\n }", "public function run()\n {\n echo PHP_EOL , 'seeding roles...';\n\n Role::create(\n [\n 'name' => 'Admin',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Principal',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Teacher',\n 'deletable' => false,\n ]\n );\n\n Role::create(\n [\n 'name' => 'Student',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Parents',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Accountant',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Librarian',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Receptionist',\n 'deletable' => false,\n ]\n );\n\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // $this->call(QuestionTableSeed::class);\n\n $this->call([\n QuestionTableSeed::class,\n AlternativeTableSeed::class,\n ScheduleActionTableSeeder::class,\n UserTableSeeder::class,\n CompanyClassificationTableSeed::class,\n ]);\n // DB::table('clients')->insert([\n // 'name' => 'Empresa-02',\n // 'email' => '[email protected]',\n // 'password' => bcrypt('07.052.477/0001-60'),\n // ]);\n }", "public function run()\n {\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 5; $i++) {\n Runner::create([\n 'external_id' => $faker->uuid,\n 'name' => $faker->name,\n 'race_id' =>rand(1,5),\n 'age' => rand(30, 45),\n 'sex' => $faker->randomElement(['male', 'female']),\n 'color' => $faker->randomElement(['#ecbcb4', '#d1a3a4']),\n ]);\n }\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n\n User::factory()->create([\n 'name' => 'Carlos',\n 'email' => '[email protected]',\n 'email_verified_at' => now(),\n 'password' => bcrypt('123456'), // password\n 'remember_token' => Str::random(10),\n ]);\n \n $this->call([PostsTableSeeder::class]);\n $this->call([TagTableSeeder::class]);\n\n }", "public function run()\n {\n $this->call(AlumnoSeeder::class);\n //Alumnos::factory()->count(30)->create();\n //DB::table('alumnos')->insert([\n // 'dni_al' => '13189079',\n // 'nom_al' => 'Jose',\n // 'ape_al' => 'Araujo',\n // 'rep_al' => 'Principal',\n // 'esp_al' => 'Tecnologia',\n // 'lnac_al' => 'Valencia'\n //]);\n }", "public function run()\n {\n Eloquent::unguard();\n\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n\n // $this->call([\n // CountriesTableSeeder::class,\n // ]);\n\n factory(App\\User::class, 100)->create();\n factory(App\\Type::class, 10)->create();\n factory(App\\Item::class, 100)->create();\n factory(App\\Order::class, 1000)->create();\n\n $items = App\\Item::all();\n\n App\\Order::all()->each(function($order) use ($items) {\n\n $n = rand(1, 10);\n\n $order->items()->attach(\n $items->random($n)->pluck('id')->toArray()\n , ['quantity' => $n]);\n\n $order->total = $order->items->sum(function($item) {\n return $item->price * $item->pivot->quantity;\n });\n\n $order->save();\n\n });\n\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n factory(User::class)->create(\n [\n 'email'=>'[email protected]',\n 'name'=>'izzanni',\n \n ]\n );\n factory(User::class)->create(\n [\n 'email'=>'[email protected]',\n 'name'=>'aina',\n\n ]\n );\n factory(User::class)->create(\n [\n 'email'=>'[email protected]',\n 'name'=>'sab',\n\n ]\n );\n }", "public function run()\n {\n\n factory('App\\Models\\Pessoa', 60)->create();\n factory('App\\Models\\Profissional', 10)->create();\n factory('App\\Models\\Paciente', 50)->create();\n $this->call(UsersTableSeeder::class);\n $this->call(ProcedimentoTableSeeder::class);\n // $this->call(PessoaTableSeeder::class);\n // $this->call(ProfissionalTableSeeder::class);\n // $this->call(PacienteTableSeeder::class);\n // $this->call(AgendaProfissionalTableSeeder::class);\n }", "public function run()\n {\n //Acá se define lo que el seeder va a hacer.\n //insert() para insertar datos.\n //Array asociativo. La llave es el nombre de la columna.\n// DB::table('users')->insert([\n// //Para un solo usuario.\n// 'name' => 'Pedrito Perez',\n// 'email' => '[email protected]',\n// 'password' => bcrypt('123456')\n// ]);//Se indica el nombre de la tabla.\n\n //Crea 50 usuarios (sin probar)\n// factory(App\\User::class, 50)->create()->each(function($u) {\n// $u->posts()->save(factory(App\\Post::class)->make());\n// });\n\n factory(App\\User::class, 10)->create(); //Así se ejecuta el model factory creado en ModelFactory.php\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n //nhập liệu mẫu cho bảng users\n DB::table('users')->insert([\n \t['id'=>'1001', 'name'=>'Phan Thị Hiền', 'email'=>'[email protected]', 'password'=>'123456', 'isadmin'=>1],\n \t['id'=>'1002', 'name'=>'Phan Thị Hà', 'email'=>'[email protected]', 'password'=>'111111', 'isadmin'=>0]\n ]);\n\n\n //nhập liệu mẫu cho bảng suppliers\n DB::table('suppliers')->insert([\n \t['name'=>'FPT', 'address'=>'151 Hùng Vương, TP. Đà Nẵng', 'phonenum'=>'0971455395'],\n \t['name'=>'Điện Máy Xanh', 'address'=>'169 Phan Châu Trinh, TP. Đà Nẵng', 'phonenum'=>'0379456011']\n ]);\n\n\n //Bảng phiếu bảo hành\n }", "public function run()\n {\n \t// DB::table('categories')->truncate();\n // factory(App\\Models\\Category::class, 10)->create();\n Schema::disableForeignKeyConstraints();\n Category::truncate();\n $faker = Faker\\Factory::create();\n\n $categories = ['SAMSUNG','NOKIA','APPLE','BLACK BERRY'];\n foreach ($categories as $key => $value) {\n Category::create([\n 'name'=>$value,\n 'description'=> 'This is '.$value,\n 'markup'=> rand(10,100),\n 'category_id'=> null,\n 'UUID' => $faker->uuid,\n ]);\n }\n }" ]
[ "0.8013876", "0.79804534", "0.7976992", "0.79542726", "0.79511505", "0.7949612", "0.794459", "0.7942486", "0.7938189", "0.79368967", "0.79337025", "0.78924936", "0.78811055", "0.78790957", "0.78787595", "0.787547", "0.7871811", "0.78701615", "0.7851422", "0.7850352", "0.7841468", "0.7834583", "0.7827792", "0.7819104", "0.78088796", "0.7802872", "0.7802348", "0.78006834", "0.77989215", "0.7795819", "0.77903426", "0.77884805", "0.77862066", "0.7778816", "0.7777486", "0.7765202", "0.7762492", "0.77623445", "0.77621746", "0.7761383", "0.77606887", "0.77596676", "0.7757001", "0.7753607", "0.7749522", "0.7749292", "0.77466977", "0.7729947", "0.77289546", "0.772796", "0.77167094", "0.7714503", "0.77140456", "0.77132195", "0.771243", "0.77122366", "0.7711113", "0.77109736", "0.7710777", "0.7710086", "0.7705484", "0.770464", "0.7704354", "0.7704061", "0.77027386", "0.77020216", "0.77008796", "0.7698617", "0.76985973", "0.76973504", "0.7696405", "0.7694293", "0.7692694", "0.7691264", "0.7690576", "0.76882726", "0.7687433", "0.7686844", "0.7686498", "0.7685065", "0.7683827", "0.7679184", "0.7678287", "0.76776296", "0.76767945", "0.76726556", "0.76708084", "0.76690495", "0.766872", "0.76686716", "0.7666299", "0.76625943", "0.7662227", "0.76613766", "0.7659881", "0.7656644", "0.76539344", "0.76535016", "0.7652375", "0.7652313", "0.7652022" ]
0.0
-1
Show the form for creating a new resource.
public function create() { $categories=$this->model->getCategories(); $colors=$this->model->getColours(); return view("admin.pages.insertProduct",['categories'=>$categories,'colors'=>$colors]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return $this->showForm('create');\n }", "public function create()\n {\n return view('admin.resources.create');\n }", "public function create(){\n\n return view('resource.create');\n }", "public function create()\n\t{\n\t\treturn $this->showForm('create');\n\t}", "public function create()\n {\n return \"Display a form for creating a new catalogue\";\n }", "public function newAction()\n {\n $entity = new Resource();\n $current = $this->get('security.context')->getToken()->getUser();\n $entity->setMember($current);\n $form = $this->createCreateForm($entity);\n\n return array(\n 'nav_active'=>'admin_resource',\n 'entity' => $entity,\n 'form' => $form->createView(),\n );\n }", "public function create()\n {\n return view ('forms.create');\n }", "public function create ()\n {\n return view('forms.create');\n }", "public function create()\n\t{\n\t\treturn view('faith.form');\n\t}", "public function create(NebulaResource $resource): View\n {\n $this->authorize('create', $resource->model());\n\n return view('nebula::resources.create', [\n 'resource' => $resource,\n ]);\n }", "public function create()\n {\n return view(\"request_form.form\");\n }", "public function create()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.create\")) {\n $view = \"admin.{$this->name}.create\";\n } else {\n $view = 'admin.includes.actions.create';\n }\n\n /* Show the form for creating a new resource. */\n return view($view)\n ->with('name', $this->name);\n }", "public function newAction()\n\t{\n\t\t$this->render( View::make( 'schools/form' , array(\n\t\t\t'title' => 'Ajouter une nouvelle &eacute;cole'\n\t\t) ) );\n\t}", "public function create()\n {\n return view($this->forms . '.create');\n }", "public function create()\n {\n return view('restful.add');\n }", "public function create()\n {\n $resource = (new AclResource())->AclResource;\n\n //dd($resource);\n return view('Admin.acl.role.form', [\n 'resource' => $resource\n ]);\n }", "public function create()\n {\n return view('admin.createform');\n }", "public function create()\n {\n return view('admin.forms.create');\n }", "public function create()\n {\n return view('backend.student.form');\n }", "public function newAction()\n {\n $breadcrumbs = $this->get(\"white_october_breadcrumbs\");\n $breadcrumbs->addItem('Inicio', $this->get('router')->generate('admin.homepage'));\n $breadcrumbs->addItem($this->entityDescription, $this->get(\"router\")->generate(\"admin.$this->entityName.index\"));\n $breadcrumbs->addItem('Nuevo');\n\n $entity = $this->getManager()->create();\n $form = $this->getForm($entity);\n\n return $this->render('AdminBundle:Default:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n 'metadata' => $this->getMetadata()\n ));\n }", "public function create()\n {\n return view('client.form');\n }", "public function create()\n {\n // Nos regresa la vista del formulario\n return view('project.form');\n }", "public function create()\n {\n return view('Form');\n }", "public function newAction(){\n \n $entity = new Resourceperson();\n $form = $this->createAddForm($entity);\n\n \n return $this->render('ABCRspBundle:rsp:add.html.twig',array('entity'=>$entity,'form'=> $form->createView()));\n }", "public function createForm()\n\t{\n\t\treturn view('post.new');\n\t}", "public function create()\n {\n return view('admin.form.create', ['form' => new Form]);\n }", "public function create()\n {\n return view('form');\n }", "public function create()\n {\n return view('form');\n }", "public function create()\n {\n return view('form');\n }", "public function create()\n {\n $title = $this->title;\n $subtitle = \"Adicionar cliente\";\n\n return view('admin.clients.form', compact('title', 'subtitle'));\n }", "public function create()\n {\n return view('backend.schoolboard.addform');\n }", "public function create()\n\t{\n\t\treturn view('info.forms.createInfo');\n\t}", "public function create()\n {\n //\n return view('form');\n }", "public function create()\n {\n return view('rests.create');\n }", "public function create()\n {\n return $this->showForm();\n }", "public function create()\n {\n return $this->showForm();\n }", "public function create()\n {\n return view(\"Add\");\n }", "public function create(){\n return view('form.create');\n }", "public function create()\n {\n // Show the page\n return view('admin.producer.create_edit');\n }", "public function create()\n {\n\n return view('control panel.student.add');\n\n }", "public function newAction() {\n\t\t\n\t\t$this->view->form = $this->getForm ( \"/admin/invoices/process\" );\n\t\t$this->view->title = $this->translator->translate(\"New Invoice\");\n\t\t$this->view->description = $this->translator->translate(\"Create a new invoice using this form.\");\n\t\t$this->view->buttons = array(array(\"url\" => \"#\", \"label\" => $this->translator->translate('Save'), \"params\" => array('css' => null,'id' => 'submit')),\r\n\t\t\t\t\t\t\t array(\"url\" => \"/admin/invoices/list\", \"label\" => $this->translator->translate('List'), \"params\" => array('css' => null)));\n\t\t$this->render ( 'applicantform' );\n\t}", "public function create()\n {\n $data['action'] = 'pengiriman.store';\n return view('pengiriman.form', $data);\n }", "public function create()\n {\n return $this->cView(\"form\");\n }", "public function newAction()\n {\n // Création de l'entité et du formulaire.\n $client = new Client();\n $formulaire = $this->createForm(new ClientType(), $client);\n \n \n \n // Génération de la vue.\n return $this->render('KemistraMainBundle:Client:new.html.twig',\n array('formulaire' => $formulaire->createView()));\n }", "public function create()\n {\n return view(\"dresses.form\");\n }", "public function create()\n\t{\n\t\treturn View::make('new_entry');\n\t}", "public function createAction()\n {\n// $this->view->form = $form;\n }", "public function create()\n {\n return view('bank_account.form', ['mode' => 'create']);\n }", "public function create()\n {\n return view('fish.form');\n }", "public function create()\n {\n return view('users.forms.create');\n }", "public function create()\n {\n $this->setFormFields($this->getCreateFormFields());\n $form = $this->getCreateForm();\n\n return view($this->getViewName('create'), [\n 'crudSlug' => $this->slug,\n 'form' => $form,\n ]);\n }", "public function create()\n\t{\n\t\treturn view('admin.estadoflete.new');\n\t}", "public function create()\n {\n $person = new Person;\n return view('contents.personform')->with(compact('person') );\n }", "public function createAction(){\n \t$this->view->placeholder('title')->set('Create');\n \t$this->_forward('form');\n }", "public function create()\n {\n Gate::authorize('app.products.create');\n\n return view('backend.products.form');\n }", "public function create()\n {\n return view('essentials::create');\n }", "public function create()\n {\n return view('student.add');\n }", "public function create()\n\t{\n\t\treturn view('loisier/create');\n\t}", "public function create()\n {\n return view('url.form');\n }", "public function newAction()\n {\n $entity = new Facture();\n $factureType = new FactureType();\n\t\t$factureType->setUser($this->get('security.context')->getToken()->getUser());\n $form = $this->createForm($factureType, $entity);\n\n return $this->render('chevPensionBundle:Facture:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function newAction()\n {\n $entity = new Chofer();\n $form = $this->createForm(new ChoferType(), $entity, ['user' => $this->getUser()]);\n\n return $this->render('ChoferesBundle:Chofer:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n 'css_active' => 'chofer',\n ));\n }", "public function create()\n\t{\n\t\treturn View::make('crebos.create');\n\t}", "public function create() : View\n {\n $fieldset = $this->menuFieldset();\n\n return $this->view('create', [\n 'title' => trans('addons.Aardwolf::titles.create'),\n 'data' => [],\n 'fieldset' => $fieldset->toPublishArray(),\n 'suggestions' => [],\n 'submitUrl' => route('aardwolf.postCreate')\n ]);\n }", "public function create()\n {\n return view('libro.create');\n }", "public function create()\n {\n return view('libro.create');\n }", "public function newAction()\n {\n $entity = new Species();\n $form = $this->createForm(new SpeciesType(), $entity);\n\n return $this->render('InfectBackendBundle:Species:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function create()\n {\n return view('crud/add'); }", "public function create()\n\t{\n\t\treturn View::make('supplier.create');\n\t}", "public function newAction()\n {\n $entity = new Company();\n $form = $this->createForm(new CompanyType(), $entity);\n\n return $this->render('SiteSavalizeBundle:Company:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function create()\n {\n return view(\"List.form\");\n }", "public function index_onCreateForm()\n\t{\n\t\tparent::create();\n\t\treturn $this->makePartial('create');\n\t}", "public function create()\n {\n //load create form\n return view('products.create');\n }", "public function create()\n {\n return view('article.addform');\n }", "public function create()\n {\n // Mengarahkan ke halaman form\n return view('buku.form');\n }", "public function create()\n\t{\n\t\t// load the create form (app/views/material/create.blade.php)\n\t\t$this->layout->content = View::make('material.create');\n\t}", "public function create()\n {\n return view('saldo.form');\n }", "public function create()\n\t\t{\n\t\t\treturn view('kuesioner.create');\n\t\t}", "public function view_create_questioner_form() {\n \t// show all questioner\n \t// send questioner to form\n \treturn view(\"create_questioner\");\n }", "public function newAction() {\n $entity = new Question();\n $form = $this->createCreateForm($entity);\n\n return $this->render('CdlrcodeBundle:Question:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function create()\n {\n $data['companies'] = Company::select('id', 'name')->where('status', 1)->orderBy('id', 'desc')->get();\n return view('admin.outlet.outlet_form', $data);\n }", "public function create()\n {\n return view('admin.inverty.add');\n }", "public function create()\n {\n return view('Libro.create');\n }", "public function create()\n {\n $title = trans('entry_mode.new');\n return view('layouts.create', compact('title'));\n }", "public function create()\n {\n $breadcrumb='car.create';\n return view('admin.partials.cars.form', compact('breadcrumb'));\n }", "public function create()\n {\n return view(\"familiasPrograma.create\");\n }", "public function create()\n {\n return view('admin.car.create');\n }", "public function create()\n {\n return view('admin.car.create');\n }", "public function create()\n\t{\n\t\treturn View::make('perusahaans.create');\n\t}", "public function create()\n {\n return view(\"create\");\n }", "public function create()\n\t{\n //echo 'show form';\n\t\treturn View::make('gaans.create');\n\t}", "public function create()\n {\n $title = trans('dormitorybed.new');\n $this->generateParams();\n\n return view('layouts.create', compact('title'));\n }", "public function create()\n {\n return view('forming');\n }", "public function formNew() {\n $this->data->options = array(\n 'RJ' => 'Rio de Janeiro',\n 'MG' => 'Minas Gerais',\n 'SP' => 'São Paulo',\n 'ES' => 'Espírito Santo',\n 'BA' => 'Bahia',\n 'RS' => 'Rio Grande do Sul'\n );\n $this->data->action = \"@exemplos/pessoa/save\";\n $this->render();\n }", "public function create()\n {\n \t\n \treturn view('supplies.create');\n\n }", "public function createAction()\n {\n if ($form = $this->processForm()) {\n $this->setPageTitle(sprintf($this->_('New %s...'), $this->getTopic()));\n $this->html[] = $form;\n }\n }", "public function create()\n {\n $page_title = \"Add New\";\n return view($this->path.'create', compact('page_title'));\n }", "public function create()\n {\n // not sure what to do with the form since im\n // using ame partial for both create and edit\n return view('plants.create')->with('plant', new Plant);\n }", "public function create() {\n\t\t$title = 'Create | Show';\n\n\t\treturn view('admin.show.create', compact('title'));\n\t}", "public function create()\n {\n return view('student::students.student.create');\n }", "public function newAction(){\n\t\t$entity = new Reserva();\n\t\t$form = $this->createCreateForm($entity);\n\n\t\treturn $this->render('LIHotelBundle:Reserva:new.html.twig', array(\n\t\t\t'entity' => $entity,\n\t\t\t'form' => $form->createView(),\n\t\t));\n\t}" ]
[ "0.75948673", "0.75948673", "0.75863165", "0.7577412", "0.75727344", "0.7500887", "0.7434847", "0.7433956", "0.73892003", "0.73531085", "0.73364776", "0.73125", "0.7296102", "0.7281891", "0.72741455", "0.72424185", "0.7229325", "0.7226713", "0.7187349", "0.7179176", "0.7174283", "0.7150356", "0.71444064", "0.71442676", "0.713498", "0.71283126", "0.7123691", "0.71158516", "0.71158516", "0.71158516", "0.7112176", "0.7094388", "0.7085711", "0.708025", "0.70800644", "0.70571953", "0.70571953", "0.70556754", "0.70396435", "0.7039549", "0.7036275", "0.703468", "0.70305896", "0.7027638", "0.70265305", "0.70199823", "0.7018007", "0.7004984", "0.7003889", "0.7000935", "0.69973785", "0.6994679", "0.6993764", "0.6989918", "0.6986989", "0.6966502", "0.69656384", "0.69564354", "0.69518244", "0.6951109", "0.6947306", "0.69444615", "0.69423944", "0.6941156", "0.6937871", "0.6937871", "0.6936686", "0.69345254", "0.69318026", "0.692827", "0.69263744", "0.69242257", "0.6918349", "0.6915889", "0.6912884", "0.691146", "0.69103104", "0.69085974", "0.69040126", "0.69014287", "0.69012105", "0.6900397", "0.68951064", "0.6893521", "0.68932164", "0.6891899", "0.6891616", "0.6891616", "0.6889246", "0.68880934", "0.6887128", "0.6884732", "0.68822503", "0.68809193", "0.6875949", "0.68739206", "0.68739134", "0.6870358", "0.6869779", "0.68696856", "0.686877" ]
0.0
-1
Store a newly created resource in storage.
public function store( AddProductRequest $r) { // if($r->has('sendProduct')) { $productAdmin= $r->input('productAdmin'); $priceAdmin= $r->input('priceAdmin'); $categoryAdmin= $r->input('categoryAdmin'); $colorAdmin= $r->input('colorAdmin'); $imageAdmin= $r->file('imageAdmin'); // dd($imageAdmin->getPathname()); $directory_default=$imageAdmin.\public_path(); // tu je smestena dd($directory_default); $fileName = $imageAdmin->getClientOriginalName(); $fileNameNew=time()."_".$fileName; //ime slike $newDir='/images/productsShop/'.$fileNameNew; //dd($newDir); // dd($fileNameNew); //dd($fileName.public_path()); $imageAdmin->move(\public_path()."/images/productsShop/",$fileNameNew); //dd($imageAdmin.\public_path()); //dd($imageAdmin); try{ $photoAdmin = $this->model->insertPhotoAdmin($productAdmin,$priceAdmin,$fileNameNew,$categoryAdmin,$colorAdmin); return redirect()->back()->with('message', 'Product added'); } catch(\Exception $e){ return response(["greska" => $ex->getMessage()], 505); return redirect()->back()->with('message', 'Failed '); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store($data, Resource $resource);", "public function store()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'storeValidations')) {\n $this->request->validate($this->storeValidations());\n }\n\n /* Create a new resource */\n $resource = $this->model::create(Input::all());\n\n /* Redirect to newly created resource page */\n return redirect()\n ->route($this->name . '.edit', $resource->id)\n ->with(\n 'success',\n Lang::has($this->name . '.resource-created') ?\n $this->name . '.resource-created' :\n 'messages.alert.resource-created'\n );\n }", "public function store(CreateStorageRequest $request)\n {\n $this->storage->create($request->all());\n\n return redirect()->route('admin.product.storage.index')\n ->withSuccess(trans('core::core.messages.resource created', ['name' => trans('product::storages.title.storages')]));\n }", "public function createStorage();", "public function store(StoreStorage $request)\n {\n $storage = Storage::create($request->all());\n $request->session()->flash('alert-success', 'Запись успешно добавлена!');\n return redirect()->route('storage.index');\n }", "public function saveShopifyResource() {\n if (is_null($this->getShopifyId())) { // if there is no id...\n $this->createShopifyResource(); // create a new resource\n } else { // if there is an id...\n $this->updateShopifyResource(); // update the resource\n }\n }", "public function store(Request $request, NebulaResource $resource): RedirectResponse\n {\n $this->authorize('create', $resource->model());\n\n $validated = $request->validate($resource->rules(\n $resource->createFields()\n ));\n\n $resource->storeQuery($resource->model(), $validated);\n\n $this->toast(__(':Resource created', [\n 'resource' => $resource->singularName(),\n ]));\n\n return redirect()->back();\n }", "function storeAndNew() {\n $this->store();\n }", "public function store(Request $request)\n {\n $currentUser = JWTAuth::parseToken()->authenticate();\n $validator = Validator::make($request->all(), [\n 'content' => 'required|string',\n 'image_link' => 'sometimes|url',\n ]);\n\n if ($validator->fails()) {\n return APIHandler::response(0, $validator->errors(), [], 400);\n }\n\n $resource = new Resource;\n $resource->user_id = $currentUser['id'];\n $resource->title = $request->get('title');\n $resource->content = $request->get('content');\n $resource->image_link = $request->get('imageLink');\n $resource->video_link = $request->get('videoLink');\n $resource->file_link = $request->get('fileLink');\n $resource->audio_link = $request->get('audioLink');\n $resource->tags = collect($request->get('tags'))->implode('text', ',');\n $resource->is_public = 0;\n $resource->save();\n $data['resource'] = $resource;\n\n if ($request->get('programId')) {\n $this->addToProgram($resource, $request->programId);\n // event(new NewLearningPathResourcePublished($resource, $invitee));\n }\n\n User::find($currentUser['id'])->increment('points', 2);\n\n return APIHandler::response(1, \"New resource has been created\", $data, 201);\n }", "public function store()\n {\n if (!$this->id) { // Insert\n $this->insertObject();\n } else { // Update\n $this->updateObject();\n }\n }", "public function store()\n\t{\n\t\t\n\t\t//\n\t}", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}" ]
[ "0.72865677", "0.7145327", "0.71325725", "0.6640912", "0.66209733", "0.65685713", "0.652643", "0.65095705", "0.64490104", "0.637569", "0.63736665", "0.63657933", "0.63657933", "0.63657933", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437", "0.6342437" ]
0.0
-1
Display the specified resource.
public function show($id) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function show(Resource $resource)\n {\n // not available for now\n }", "public function show(Resource $resource)\n {\n //\n }", "function Display($resource_name, $cache_id = null, $compile_id = null)\n {\n $this->_smarty->display($resource_name, $cache_id, $compile_id);\n }", "private function showResourceable($resourceable)\n {\n save_resource_url();\n\n return $this->view('resources.create_edit')\n ->with('resource', $resourceable)\n ->with('photos', $resourceable->photos)\n ->with('videos', $resourceable->videos)\n ->with('documents', $resourceable->documents);\n }", "function display($resource_name, $cache_id = null, $compile_id = null) {\n\t\t$this->_getResourceInfo($resource_name); // Saves resource info to a Smarty class var for debugging\n\t\t$_t3_fetch_result = $this->fetch($resource_name, tx_smarty_div::getCacheID($cache_id), $compile_id);\n if ($this->debugging) { // Debugging will have been evaluated in fetch\n require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');\n $_t3_fetch_result .= smarty_core_display_debug_console(array(), $this);\n }\n\t\treturn $_t3_fetch_result;\n\t}", "public function show(ResourceSubject $resourceSubject)\n {\n //\n }", "public function show(ResourceManagement $resourcesManagement)\n {\n //\n }", "public function viewEditResources()\n {\n $database = new Database();\n $id = $this->_params['id'];\n\n $resource = $database->getResourceById($id);\n\n $availableResource = new Resource($resource['ResourceID'], $resource['ResourceName'], $resource['Description']\n , $resource['ContactName'] , $resource['ContactEmail'] , $resource['ContactPhone'] ,\n $resource['Link'], $resource['active']);\n $this->_f3->set('Resource', $availableResource);\n\n echo Template::instance()->render('view/include/head.php');\n echo Template::instance()->render('view/include/top-nav.php');\n echo Template::instance()->render('view/edit-resources.php');\n echo Template::instance()->render('view/include/footer.php');\n }", "public function retrieve(Resource $resource);", "public function showResource($resouceable, $id)\n {\n $model_name = str_replace('-', ' ',ucwords($resouceable));\n $model_name = str_replace(' ', '',ucwords($model_name));\n\n $resource_type = 'App\\Models\\\\'.$model_name;\n $model = app($resource_type);\n $model = $model->find($id);\n\n return $this->showResourceable($model);\n }", "public function showAction(Ressource $ressource)\n {\n $deleteForm = $this->createDeleteForm($ressource);\n\n return $this->render('ressource/show.html.twig', array(\n 'ressource' => $ressource,\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function show(Dispenser $dispenser)\n {\n //\n }", "public function show($id)\n {\n $resource = Resource::find($id);\n dd($resource);\n }", "public function displayAction() {\n\t\tif(is_numeric($this->req_id)) {\n\t\t\tAPI::DEBUG(\"[DefaultController::displayAction()] Getting \" . $this->req_id, 1);\n\t\t\t$this->_view->data['info'] = $this->_model->get($this->req_id);\n\t\t\t$this->_view->data['action'] = 'edit';\n\n\t\t} else {\n\t\t\t$this->_view->data['action'] = 'new';\n\t\t}\n\t\t// auto call the hooks for this module/action\n\t\terror_log(\"Should Call: \" . $this->module .\"/\".$this->action.\"/\".\"controller.php\");\n\t\tAPI::callHooks($this->module, $this->action, 'controller', $this);\n\n\t\t$this->addModuleTemplate($this->module, 'display');\n\n\t}", "public function show(NebulaResource $resource, $item): View\n {\n $this->authorize('view', $item);\n\n return view('nebula::resources.show', [\n 'resource' => $resource,\n 'item' => $item,\n ]);\n }", "public function resource(string $resource, string $controller): void\n {\n $base = $this->plural($resource);\n $entity = '/{'.$resource.'}';\n\n $this->app->get($base, $controller.'@index');\n $this->app->post($base, $controller.'@store');\n $this->app->get($base.$entity, $controller.'@show');\n $this->app->patch($base.$entity, $controller.'@update');\n $this->app->delete($base.$entity, $controller.'@destroy');\n }", "public function show($id)\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Get the specified resource */\n $resource = $this->model::findOrFail($id);\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.show\")) {\n $view = \"admin.{$this->name}.show\";\n } else {\n $view = 'admin.includes.actions.show';\n }\n\n /* Displays the specified resource page */\n return view($view)\n ->with('resource', $resource)\n ->with('name', $this->name);\n }", "function displayCustom($resource_name, $cache_id = null, $compile_id = null)\n\t{\n\t return $this->display(DotbAutoLoader::existingCustomOne($resource_name), $cache_id, $compile_id);\n\t}", "public function show($id)\n {\n $currentUser = JWTAuth::parseToken()->authenticate();\n $rules = [\n 'id' => 'required|integer'\n ];\n\n $validator = Validator::make(['id' => $id], $rules);\n if ($validator->fails()) {\n return APIHandler::response(0, $validator->errors(), 400);\n }\n $resource = $this->resourceRepository->fetchResource($id);\n $this->resourceRepository->storeView($id, $currentUser['id']);\n\n $data = [\n 'resource' => $resource,\n 'related_resources' => $this->resourceRepository->getResourcesRelatedTo($resource->id, $resource->mentoring_area_id)\n ];\n\n return APIHandler::response(1, \"Show Resource\", $data);\n }", "public function get(Resource $resource);", "public function showAction()\n {\n $model = $this->_getPhotoModel();\n $photo = $model->fetchEntry($this->getRequest()->getParam('id'));\n\n if (null === $photo) {\n return $this->_forward('notfound', 'error');\n }\n\n $this->view->auth = Zend_Auth::getInstance();\n $this->view->title = $photo->title;\n $this->view->photo = $photo;\n }", "public function show($id)\n {\n //\n $data=Resource::find($id);\n return view('resourceDetails',compact('data'));\n }", "function display() {\n\t\t$view = &$this->getView();\n\t\t$view->display();\n\t}", "public function show(ShowResourceRequest $request, $id)\n {\n // TODO: Implement show() method.\n }", "public function show()\n {\n if ($this->twig !== false) {\n $this->twigDefaultContext();\n if ($this->controller) {\n $this->controller->display($this->data);\n }\n echo $this->twig->render($this->twig_template, $this->data);\n } else {\n $filename = $this->findTemplatePath($this->template);\n require($filename);\n }\n }", "function show( $resource ){\n\n $where = \"reservation_status <> 'Pending' AND id = {$resource}\";\n $reservation = where( 'reservations', $where );\n $reservation = $reservation[0];\n\n return view('admin/reservation/preview_reservation', compact( 'reservation' ));\n}", "public function edit(Resource $resource)\n {\n //\n }", "public function show(rc $rc)\n {\n //\n }", "public function show(Resolucion $resolucion)\n {\n //\n }", "public function show()\n\t{\n\t\t//\n\t}", "public function show()\n\t{\n\t\t//\n\t}", "public function show()\n\t{\n\t\t//\n\t}", "public function showAction(furTexture $furTexture)\n {\n\n return $this->render('furtexture/show.html.twig', array(\n 'furTexture' => $furTexture,\n ));\n }", "public function show(Resena $resena)\n {\n }", "public function action_display()\r\n\t{\r\n\t\t$event = ORM::factory('event', array('id' => $this->request->param('id')));\r\n\t\r\n\t\tif ( ! $event->loaded())\r\n\t\t{\r\n\t\t\tNotices::error('event.view.not_found');\r\n\t\t\t$this->request->redirect(Route::url('event'));\r\n\t\t}\r\n\t\t\r\n\t\t// Can user view this event?\r\n\t\tif ( ! $this->user->can('event_view', array('event' => $event)))\r\n\t\t{\r\n\t\t\t// Error notification\r\n\t\t\tNotices::error('event.view.not_allowed');\r\n\t\t\t$this->request->redirect(Route::url('event'));\r\n\t\t}\r\n\t\t\r\n\t\t// Pass event data to the view class\r\n\t\t$this->view->event_data = $event;\r\n\t\t$this->view->user = $this->user;\r\n\t}", "public function showAction() {\n $docId = $this->getParam('id');\n\n // TODO verify parameter\n\n $document = new Opus_Document($docId);\n\n $this->_helper->layout()->disableLayout();\n\n $this->view->doc = $document;\n $this->view->document = new Application_Util_DocumentAdapter($this->view, $document);\n }", "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function execute()\n {\n // HTTP Request Get\n if ($this->type == \"resource\") {\n $action = $this->getResourceAction();\n switch ($action) {\n case \"show\":\n $this->show();\n break;\n case \"create\":\n $this->create();\n break;\n case \"edit\":\n $this->edit();\n break;\n case \"destroy\":\n $this->destroy();\n break;\n default:\n echo $this->render();\n break;\n }\n } else {\n $action = $this->Request->action;\n switch ($action) {\n case \"show\":\n $this->show();\n break;\n case \"create\":\n $this->create();\n break;\n case \"edit\":\n $this->edit();\n break;\n case \"destroy\":\n $this->destroy();\n break;\n default:\n echo $this->render();\n break;\n }\n }\n }", "public function display()\n {\n echo $this->getDisplay();\n $this->isDisplayed(true);\n }", "public function show(Resident $resident)\n {\n $this->authorize('admin.resident.show', $resident);\n\n // TODO your code goes here\n }", "public function display()\n\t{\n\t\tparent::display();\n\t}", "public function show()\n\t{\n\t\t\n\t}", "public function get_resource();", "function display() {\n\n\t\t// Check authorization, abort if negative\n\t\t$this->isAuthorized() or $this->abortUnauthorized();\n\n\t\t// Get the view\n\t\t$view = $this->getDefaultView();\n\n\t\tif ($view == NULL) {\n\t\t\tthrow new Exception('Display task called, but there is no view assigned to that controller. Check method getDefaultView.');\n\t\t}\n\n\t\t$view->listing = true;\n\n\t\t// Wrap the output of the views depending on the way the stuff should be shown\n\t\t$this->wrapViewAndDisplay($view);\n\n\t}", "public function viewResources()\n {\n $database = new Database();\n\n $resources = $database->getAllActiveResourcesNoLimit();\n\n\n $resourceArray = array();\n $i = 1;\n\n foreach ($resources as $resource) {\n $availableResource = new Resource($resource['ResourceID'], $resource['ResourceName'], $resource['Description']\n , $resource['ContactName'] , $resource['ContactEmail'] , $resource['ContactPhone'] ,\n $resource['Link'], $resource['active']);\n array_push($resourceArray, $availableResource);\n $i += 1;\n }\n $resourceSize = sizeof($resourceArray);\n $this->_f3->set('resourcesByActive', $resourceArray);\n $this->_f3->set('resourcesSize', $resourceSize);\n echo Template::instance()->render('view/include/head.php');\n echo Template::instance()->render('view/include/top-nav.php');\n echo Template::instance()->render('view/resources.php');\n echo Template::instance()->render('view/include/footer.php');\n }", "public function show($id)\n {\n $this->title .= ' show';\n $this->one($id);\n }", "public function display($title = null)\n {\n echo $this->fetch($title);\n }", "public function display(){}", "public function show($id)\n\t{\n\t\t//\n\t\t//\n\t\n\t}", "public function viewAction()\n\t{\n\t\t//get Id param from request\n\t\tif (!$id = $this->_getParam('id')) {\n\t\t\t$this->getFlashMessenger()->addMessage('Product ID was not specified');\n\t\t\t$this->getRedirector()->gotoSimple('list');\n\t\t}\n\n\t\t//fetch requested ProductID from DB\n\t\tif (!$this->_model->fetch($id)) {\n\t\t\t$this->render('not-found');\n\t\t} else {\n\t\t\t$this->view->model = $this->_model;\n\t\t}\n\t}", "public function show($id)\n {\n // Get single person\n $person = Person::findOrFail($id);\n\n // Return single person as a resource\n return '<h1>Person Number '.$id.'</h1><br>'.json_encode(new PersonResource($person));\n }", "public function display() {\n echo $this->render();\n }", "#[TODO] use self object?\n\tprotected function GET(ResourceObject $resource) {\n#[TODO]\t\tif ($resource->getMTime())\n#[TODO]\t\t\t$this->response->headers->set('Last-modified', gmdate('D, d M Y H:i:s ', $resource->getMTime()) . 'GMT');\n#[TODO]\t\tif ($resource->getCTime())\n#[TODO]\t\t\t$this->response->headers->set('Date', gmdate('D, d M Y H:i:s ', $resource->getCTime()) . 'GMT');\n\n\n#[TODO] handle file streams\n\t\t// get ranges\n#\t\t$ranges = WebDAV::getRanges($this->request, $this->response);\n\n\t\t// set the content of the response\n\t\tif ($resource instanceof ResourceDocument) {\n\t\t\t$this->response->content->set($resource->getContents());\n\t\t\t$this->response->content->setType($resource->getMIMEType());\n\t\t\t$this->response->content->encodeOnSubmit(true);\n\t\t}\n\t}", "public function show($id)\n\t{\n\t//\n\t}", "public function show($id)\n\t{\n\t//\n\t}", "public function show($id)\n {\n //\n $this->_show($id);\n }", "function Fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)\n {\n return $this->_smarty->fetch($resource_name, $cache_id, $compile_id, $display);\n }", "public function show()\n\t{\n\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {}", "static public function showCallback(O_Dao_Renderer_Show_Params $params) {\r\n\t\t/* @var $r R_Mdl_Resource */\r\n\t\t$r = $params->record();\r\n\t\t// Setting layout title\r\n\t\t$params->layout()->setTitle($r->getPageTitle());\r\n\r\n?><h1><?=$r->title?></h1><div id=\"resource\"><?\r\n\t\tif($r->getContent()) {\r\n\t\t\t// page has its own content -- show it\r\n\t\t\t$r->getContent()->show($params->layout(), \"content\");\r\n\t\t} else {\r\n\t\t\t// It is a post unit, show all childs\r\n\t\t\tif($r->is_unit == 1) {\r\n\t\t\t\t$r->addQueryAccessChecks($r->getChilds(1))->show($params->layout(), \"content\");\r\n\r\n\t\t\t// It is a folder with several units, show paginator\r\n\t\t\t} elseif($r->show_def == \"last-units\") {\r\n\t\t\t\tlist($type, $perpage) = explode(\":\", $r->show_def_params);\r\n\t\t\t\t/* @var $p O_Dao_Paginator */\r\n\t\t\t\t$p = $r->addQueryAccessChecks($r->getChilds())->test(\"is_unit\", 1)->getPaginator(array($r, \"getPageUrl\"), $perpage);\r\n\t\t\t\t$p->show($params->layout(), $type);\r\n\t\t\t// It is a folder with subfolders, boxes, contents. Show one childs level\r\n\t\t\t} else {\r\n\t\t\t\t$r->addQueryAccessChecks($r->getChilds(1))->show($params->layout(), \"on-parent-page\");\r\n\t\t\t}\r\n\r\n\t\t}\r\n?></div><?\r\n\t}", "public function show($id)\r\n\t{\r\n\t\t//\r\n\r\n\r\n\r\n\t}", "public abstract function display();", "public function show($resourceId, $eventId)\n {\n $routes = $this->routes;\n\n $eventable = $this->getEventableRepository()->model()->findOrFail($resourceId);\n\n if (method_exists($eventable, 'events')) {\n $event = $eventable->events()->find($eventId);\n\n if ($event) {\n $apiObject = $this->event->findApiObject($event->api_id);\n\n return view('events.eventables.show', compact('routes', 'eventable', 'event', 'apiObject'));\n }\n }\n\n abort(404);\n }", "public function show($id)\r\r\n\t{\r\r\n\t\t//\r\r\n\t}", "public function show( $id ) {\n\t\t//\n\t}", "public function show( $id ) {\n\t\t//\n\t}", "abstract public function resource($resource);", "public function show(Response $response)\n {\n //\n }", "public function show()\n {\n return auth()->user()->getResource();\n }", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}" ]
[ "0.8232636", "0.81890994", "0.68296117", "0.64987075", "0.649589", "0.64692974", "0.64633286", "0.63640857", "0.6307513", "0.6281809", "0.621944", "0.61926234", "0.61803305", "0.6173143", "0.61398774", "0.6119022", "0.61085826", "0.6106046", "0.60947937", "0.6078597", "0.6047151", "0.60409963", "0.6021287", "0.5989136", "0.5964405", "0.5962407", "0.59518087", "0.59309924", "0.5921466", "0.5908002", "0.5908002", "0.5908002", "0.59051657", "0.5894554", "0.5871459", "0.5870088", "0.586883", "0.5851384", "0.58168566", "0.58166975", "0.5815869", "0.58056176", "0.5799148", "0.5795126", "0.5791158", "0.57857597", "0.5783371", "0.5761351", "0.57592535", "0.57587147", "0.5746491", "0.57460666", "0.574066", "0.5739448", "0.5739448", "0.57295275", "0.57293373", "0.5729069", "0.57253987", "0.57253987", "0.57253987", "0.57253987", "0.57253987", "0.57253987", "0.57253987", "0.57253987", "0.57253987", "0.57253987", "0.57214445", "0.57149816", "0.5712036", "0.5710076", "0.57073003", "0.5707059", "0.5705454", "0.5705454", "0.5700382", "0.56997055", "0.5693362", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868", "0.5687868" ]
0.0
-1
Show the form for editing the specified resource.
public function edit($id) { // $colors=$this->model->getColours(); $categories=$this->model->getCategories(); $productOne=$this->model->getOneProduct($id); return view("admin.pages.updateProduct",['product'=>$productOne,'colors'=>$colors, 'categories'=>$categories]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function edit($id)\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Get the specified resource */\n $resource = $this->model::findOrFail($id);\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.edit\")) {\n $view = \"admin.{$this->name}.edit\";\n } else {\n $view = 'admin.includes.actions.edit';\n }\n\n /* Displays the edit resource page */\n return view($view)\n ->with('resource', $resource)\n ->with('name', $this->name);\n }", "public function edit(NebulaResource $resource, $item): View\n {\n $this->authorize('update', $item);\n\n return view('nebula::resources.edit', [\n 'resource' => $resource,\n 'item' => $item,\n ]);\n }", "public function edit() {\r\n $id = $this->api->getParam('id');\r\n\r\n if ($id) {\r\n $this->model->id = $id;\r\n $this->checkOwner();\r\n }\r\n $object = $this->model->find_by_id($id);\r\n\r\n $this->api->loadView('contact-form', array('row' => $object));\r\n }", "public function viewEditResources()\n {\n $database = new Database();\n $id = $this->_params['id'];\n\n $resource = $database->getResourceById($id);\n\n $availableResource = new Resource($resource['ResourceID'], $resource['ResourceName'], $resource['Description']\n , $resource['ContactName'] , $resource['ContactEmail'] , $resource['ContactPhone'] ,\n $resource['Link'], $resource['active']);\n $this->_f3->set('Resource', $availableResource);\n\n echo Template::instance()->render('view/include/head.php');\n echo Template::instance()->render('view/include/top-nav.php');\n echo Template::instance()->render('view/edit-resources.php');\n echo Template::instance()->render('view/include/footer.php');\n }", "public function edit()\n {\n return view('hirmvc::edit');\n }", "public function editformAction(){\n\t\t$this->loadLayout();\n $this->renderLayout();\n\t}", "public function edit() {\n $id = $this->parent->urlPathParts[2];\n // pass name and id to view\n $data = $this->parent->getModel(\"fruits\")->select(\"select * from fruit_table where id = :id\", array(\":id\"=>$id));\n $this->getView(\"header\", array(\"pagename\"=>\"about\"));\n $this->getView(\"editForm\", $data);\n $this->getView(\"footer\");\n }", "public function edit($id)\n\t{\n\t\treturn $this->showForm('update', $id);\n\t}", "public function edit($id)\n {\n $model = $this->modelObj;\n $formObj = $model::findOrFail($id);\n $data['formObj'] = $formObj;\n return view($this->veiw_base . '.edit', $data);\n }", "public function createEditForm(Resourceperson $entity){\n \n $form = $this->createForm(new ResourcepersonType(), $entity, array(\n 'action' => $this->generateUrl('rsp_update', array('id' => $entity->getRpId())),\n 'method' => 'PUT',\n ));\n\n $form->add('submit', 'submit', array('label' => 'Update','attr'=> array(\n 'class'=>'btn btn primary'\n )));\n\n return $form;\n }", "private function createEditForm(Resource $entity)\n {\n $form = $this->createForm(new ResourceType(), $entity, array(\n 'action' => $this->generateUrl('social_admin_resource_update', array('id' => $entity->getId())),\n 'method' => 'PUT',\n ));\n\n $form->add('submit', 'submit', array('label' => '保存','attr'=>[\n 'class'=>'btn btn-primary'\n ]));\n\n return $form;\n }", "public function edit($id)\n {\n return $this->showForm('update', $id);\n }", "public function edit($id)\n {\n return $this->showForm('update', $id);\n }", "public function editAction()\n {\n if ($form = $this->processForm()) {\n if ($this->useTabbedForms && method_exists($this, 'getSubject')) {\n $data = $this->getModel()->loadFirst();\n $subject = $this->getSubject($data);\n $this->setPageTitle(sprintf($this->_('Edit %s %s'), $this->getTopic(1), $subject));\n } else {\n $this->setPageTitle(sprintf($this->_('Edit %s'), $this->getTopic(1)));\n }\n $this->html[] = $form;\n }\n }", "public function edit($id)\n {\n $this->data['entity'] = GS_Form::where('id', $id)->firstOrFail();\n return view('admin.pages.forms.edit', $this->data);\n }", "public function edit($id)\n\t{\n\t\t// get the fbf_presenca\n\t\t$fbf_presenca = FbfPresenca::find($id);\n\n\t\t\n\t\t// show the edit form and pass the fbf_presenca\n\t\t$this->layout->content = View::make('fbf_presenca.edit')\n->with('fbf_presenca', $fbf_presenca);\n\t}", "public function edit($id)\n {\n $data = $this->model->find($id);\n\n return view('admin.backends.employee.form.edit',compact('data'));\n }", "public function edit($model, $form);", "function edit() {\n\t\tglobal $tpl;\n\n\t\t$form = $this->initForm();\n\t\t$tpl->setContent($form->getHTML());\n\t}", "public function edit($id)\n\t{\n\t\t$faith = Faith::find($id);\n \n return view('faith.form')->with('faith', $faith);\n\n\t}", "public function edit()\n { \n return view('admin.control.edit');\n }", "public function edit(Form $form)\n {\n //\n }", "public function edit()\n {\n return view('common::edit');\n }", "public function edit($id)\n {\n $resource = (new AclResource())->AclResource;\n $roleResource = AclRole::where('role', $id)->get(['resource'])->toArray();\n $roleResource = Arr::pluck($roleResource, 'resource');\n return view('Admin.acl.role.form', [\n 'role' => $id,\n 'resource' => $resource,\n 'roleResource' => $roleResource,\n ]);\n }", "public function edit()\n {\n return view('admin::edit');\n }", "public function edit()\n {\n return view('admin::edit');\n }", "public function edit()\r\n {\r\n return view('petro::edit');\r\n }", "public function edit($id)\n {\n // show form edit user info\n }", "public function edit()\n {\n return view('escrow::edit');\n }", "public function edit($id)\n {\n $resource = ResourceManagement::find($id);\n\n $users = User::get();\n // Redirect to user list if updating user wasn't existed\n if ($resource == null || $resource->count() == 0) {\n return redirect()->intended('/resource-management');\n }\n\n return view('resources-mgmt/edit', ['resource' => $resource, 'users' => $users]);\n }", "public function edit()\n {\n return view('commonmodule::edit');\n }", "public function editAction()\n\t{\n\t\t$params = $this->data->getParams();\n\t\t$params = $this->valid->clearDataArr($params);\n\t\tif (isset($params['id']))\n\t\t{\n\t\t\t$this->employee->setFlag(true);\n\t\t}\n\t\tif (isset($_POST['submit']))\n\t\t{\n\t\t\t$action = $this->valid->clearDataArr($_POST);\n\t\t\t$this->employee->setDataArray($action);\n\t\t\theader('Location: ' . PATH . 'Employee/index/', true, 303);\n\t\t}\n\t\t$employee = $this->employee->setAction('edit');\n\t\t$this->view->addToReplace($employee);\n\t\t$this->listEmployee();\n\t\t$this->arrayToPrint();\n\t}", "public function edit()\n {\n return view('catalog::edit');\n }", "public function edit()\n {\n return view('catalog::edit');\n }", "public function edit(form $form)\n {\n //\n }", "public function actionEdit($id) { }", "public function edit()\n {\n return view('admincp::edit');\n }", "public function edit()\n {\n return view('scaffold::edit');\n }", "public function edit($id)\n {\n $header = \"Edit\";\n\t\t$data = Penerbit::findOrFail($id);\n\t\treturn view('admin.penerbit.form', compact('data','header'));\n }", "public function edit()\n {\n return view('Person.edit');\n }", "public function edit($id)\n {\n $data = Form::find($id);\n return view('form.edit', compact('data'));\n }", "public function edit($id)\n\t{\n\t\t$career = $this->careers->findById($id);\n\t\treturn View::make('careers._form', array('career' => $career, 'exists' => true));\n\t}", "public function edit(Flight $exercise, FlightResource $resource)\n {\n return $this->viewMake('adm.smartcars.exercise-resources.edit')\n ->with('flight', $exercise)\n ->with('resource', $resource);\n }", "public function edit($id)\n\t{\n\t\t// get the material\n\t\t$material = Material::find($id);\n\n\t\t// show the edit form and pass the material\n\t\t$this->layout->content = View::make('material.edit')\n\t\t\t->with('material', $material);\n\t}", "public function edit($id, Request $request)\n {\n $formObj = $this->modelObj->find($id);\n\n if(!$formObj)\n {\n abort(404);\n } \n\n $data = array();\n $data['formObj'] = $formObj;\n $data['page_title'] = \"Edit \".$this->module;\n $data['buttonText'] = \"Update\";\n\n $data['action_url'] = $this->moduleRouteText.\".update\";\n $data['action_params'] = $formObj->id;\n $data['method'] = \"PUT\"; \n\n return view($this->moduleViewName.'.add', $data);\n }", "public function edit()\n {\n $id = $this->getId();\n return view('panel.user.form', [\n 'user' => $this->userRepository->findById($id),\n 'method' => 'PUT',\n 'routePrefix' => 'profile',\n 'route' => 'profile.update',\n 'parameters' => [$id],\n 'breadcrumbs' => $this->getBreadcrumb('Editar')\n ]);\n }", "public function edit()\r\n {\r\n return view('mpcs::edit');\r\n }", "function edit()\n\t{\n\t\t// hien thi form sua san pham\n\t\t$id = getParameter('id');\n\t\t$product = $this->model->product->find_by_id($id);\n\t\t$this->layout->set('auth_layout');\n\t\t$this->view->load('product/edit', [\n\t\t\t'product' => $product\n\t\t]);\n\t}", "public function edit($id)\n {\n //\n $data = Diskon::find($id);\n\n $form = $this->form;\n $edit = $this->edit;\n $field = $this->field;\n $page = $this->page;\n $id = $id;\n $title = $this->title;\n return view('admin/page/'.$this->page.'/edit',compact('form','edit','data','field','page','id','title'));\n }", "public function edit($id)\n {\n return $this->showForm($id);\n }", "public function edit($id)\n {\n return $this->showForm($id);\n }", "protected function _edit(){\n\t\treturn $this->_editForm();\n\t}", "public function editAction()\n {\n $robot = Robots::findFirst($this->session->get(\"robot-id\"));\n if ($this->request->isGet()) {\n $this->tag->prependTitle(\"Редактировать робота :: \");\n $user = $this->session->get(\"auth-id\");\n if (!$robot) {\n $this->flashSession->error(\n \"Робот не найден\"\n );\n return $this->response->redirect(\"users/usershow/$user->name\");\n }\n\n }\n\n $this->view->form = new RobotForm(\n $robot,\n [\n \"edit\" => true,\n ]\n );\n }", "public function editAction()\n {\n $form = new $this->form();\n\n $request = $this->getRequest();\n $param = $this->params()->fromRoute('id', 0);\n\n $repository = $this->getEm()->getRepository($this->entity);\n $entity = $repository->find($param);\n\n if ($entity) {\n\n $form->setData($entity->toArray());\n\n if ( $request->isPost() ) {\n\n $form->setData($request->getPost());\n\n if ( $form->isValid() ) {\n\n $service = $this->getServiceLocator()->get($this->service);\n $service->update($request->getPost()->toArray());\n\n return $this->redirect()->toRoute($this->route, array('controller' => $this->controller));\n }\n }\n } else {\n return $this->redirect()->toRoute($this->route, array('controller' => $this->controller));\n }\n\n return new ViewModel(array('form' => $form, 'id' => $param));\n\n }", "public function edit($id)\n\t{\n\t\t$SysApplication = \\Javan\\Dynaflow\\Domain\\Model\\SysApplication::find($id);\n\t\t$form = \\FormBuilder::create('Javan\\Dynaflow\\FormBuilder\\SysApplicationForm', [\n \t'method' => 'POST',\n \t'url' => 'sysapplication/update/'.$id,\n \t'model' => $SysApplication,\n \t'data' => [ 'flow_id' => $SysApplication->flow_id]\n \t]);\n\t\treturn View::make('dynaflow::sysapplication.form', compact('form', 'SysApplication'));\n\t}", "public function editAction() {\n\t\t$id = (int) $this->_getParam('id');\n\t\t$modelName = $this->_getParam('model');\n\t\t\n\t\t$model = Marcel_Backoffice_Model::factory($modelName);\n\t\t$item = $model->find($id)->current();\n\t\tif (!$item) {\n\t\t\t$item = $model->createRow();\n\t\t}\n\t\t$form = $item->getForm();\n\t\tif ($this->_request->isPost()) {\n\t\t\t$newId = $form->populate($this->_request->getPost())->save();\n\t\t\tif ($newId) {\n\t\t\t\t$this->_helper->flashMessenger('Saved successfully!');\n\t\t\t\t$this->_helper->redirector('edit', null, null, array('id' => $newId, 'model' => $modelName));\n\t\t\t}\n\t\t}\n\t\t$this->view->form = $form;\n\t\t$this->view->messages = $this->_helper->flashMessenger->getMessages();\n\t}", "public function edit($id)\n {\n return view('models::edit');\n }", "public function edit()\n {\n return view('home::edit');\n }", "public function editAction()\n {\n $id = $this->params()->fromRoute('id');\n $entity = $this->entityManager->find(Entity\\CourtClosing::class, $id);\n if (! $entity) {\n // to do: deal with it\n }\n $form = $this->getForm('update');\n $form->bind($entity);\n if ($this->getRequest()->isPost()) {\n return $this->post();\n }\n\n return new ViewModel(['form' => $form]);\n }", "public function editAction($id)\n {\n $entity = $this->getManager()->find($id);\n\n $breadcrumbs = $this->get(\"white_october_breadcrumbs\");\n $breadcrumbs->addItem('Inicio', $this->get('router')->generate('admin.homepage'));\n $breadcrumbs->addItem($this->entityDescription, $this->get(\"router\")->generate(\"admin.$this->entityName.index\"));\n $breadcrumbs->addItem('Editar');\n\n if (!$entity) {\n throw $this->createNotFoundException('No se ha encontrado el elemento');\n }\n\n $form = $this->getForm($entity);\n\n return $this->render('AdminBundle:Default:edit.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n 'metadata' => $this->getMetadata()\n ));\n }", "public function edit()\n {\n return view('user::edit');\n }", "public function edit()\n {\n return view('user::edit');\n }", "public function edit(Form $form)\n {\n return view('admin.forms.edit', compact('form'));\n }", "public function editAction()\n {\n $form = MediaForm::create($this->get('form.context'), 'media');\n $media = $this->get('media_manager.manager')->findOneById($this->get('request')->get('media_id'));\n \n $form->bind($this->get('request'), $media);\n \n return $this->render('MediaManagerBundle:Admin:form.html.twig', array('form' => $form, 'media' => $media));\n }", "public function editAction($id) {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('CdlrcodeBundle:Question')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Question entity.');\n }\n\n $editForm = $this->createEditForm($entity);\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('CdlrcodeBundle:Question:edit.html.twig', array(\n 'entity' => $entity,\n 'edit_form' => $editForm->createView(),\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function edit($id)\n {\n return view('consultas::edit');\n }", "public function edit(DirectorFormBuilder $form, $id)\n {\n return $form->render($id);\n }", "public function edit()\n {\n return view('dashboard::edit');\n }", "public function edit($id){\n $rfid = Rfid::find($id);\n\n //load form view\n return view('rfids.edit', ['rfid' => $rfid]);\n }", "public function edit($id)\n {\n\n // retrieve provider\n $provider = Provider::findOrFail($id);\n\n // return form with provider\n return view('backend.providers.form')->with('provider', $provider);\n }", "public function edit(Question $question)\n {\n $this->employeePermission('application' , 'edit');\n $question->chooses;\n $action = 'edit';\n return view('admin.setting.question_form', compact('action' , 'question'));\n }", "public function edit() {\n return view('routes::edit');\n }", "public function edit($id)\n {\n $this->data['product'] = Product::find($id);\n $this->data['category'] = Category::arrForSelect();\n $this->data['title'] = \" Update Prouct Details\";\n $this->data['mode'] = \"edit\";\n\n return view('product.form', $this->data);\n }", "public function edit(ClueEnFormBuilder $form, $id): Response\n {\n return $form->render($id);\n }", "public function editAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('BaseBundle:Feriado')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Feriado entity.');\n }\n\n $editForm = $this->createEditForm($entity);\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('BaseBundle:Feriado:edit.html.twig', array(\n 'entity' => $entity,\n 'edit_form' => $editForm->createView(),\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function edit($id)\n {\n return view('cataloguemodule::edit');\n }", "public function edit($articulo_id)\n {\n $titulo = \"Editar\";\n return View(\"articulos.formulario\",compact('titulo','articulo_id'));\n }", "public function edit($id)\n {\n $resources = User::find(session('usuario_id'))->resources;\n $languages = Language::pluck('name', 'id');\n $types = Type::pluck('name', 'id');\n $method = 'PATCH';\n\n $recurso = Resource::find($id);\n $url = \"/resource/$recurso->id\";\n\n return view('resources.resources', compact('resources', 'languages', 'types', 'method', 'url', 'recurso'));\n }", "public function edit(Question $question)\n {\n $edit = TRUE;\n return view('questionForm', ['question' => $question, 'edit' => $edit]);\n }", "public function displayEditForm(Employee $employee){\n return view('employee.displayEditForm',['employee'=>$employee]);\n }", "public function edit()\n {\n return view('website::edit');\n }", "public function edit()\n {\n return view('inventory::edit');\n }", "public function edit()\n {\n return view('initializer::edit');\n }", "public function editAction()\n {\n View::renderTemplate('Profile/edit.html', [\n 'user' => $this->user\n ]);\n }", "public function edit($id)\n {\n return view('backend::edit');\n }", "public function edit($id)\n {\n //dd($id);\n $familiaPrograma= FamiliaPrograma::findOrFail($id);\n return view('familiasPrograma.edit', compact('familiaPrograma'));\n }", "public function edit($id)\n {\n return view('crm::edit');\n }", "public function edit($id)\n {\n return view('crm::edit');\n }", "public function edit($id)\n {\n $user = User::where('id', $id)->first();\n\n\n return view('users.forms.update', compact('user'));\n }", "public function editAction($id)\n\t{\n\t\t$school = School::find( $id );\n\t\t$this->render( View::make( 'schools/form' , array(\n\t\t\t'title' => sprintf( 'Modifier \"%s\"', $school->name ),\n\t\t\t'entity' => $school\n\t\t) ) );\n\t}", "public function edit(Question $question)\n {\n $edit = TRUE;\n return view('questionForm', ['question' => $question, 'edit' => $edit ]);\n }", "public function edit(Person $person) {\n\t\t$viewModel = new PersonFormViewModel();\n\t\treturn view('person.form', $viewModel);\n\t}", "public function edit($id)\n {\n \t$product = Product::find($id);\n \treturn view('admin.products.edit')->with(compact('product')); // formulario de actualizacion de datos del producto\n }", "public function edit_person($person_id){\n \t$person = Person::find($person_id);\n \treturn view('resource_detail._basic_info.edit',compact('person'));\n }", "public function edit($id)\n {\n $professor = $this->repository->find($id);\n return view('admin.professores.edit',compact('professor'));\n }", "public function edit($id)\n {\n $data = Restful::find($id);\n return view('restful.edit', compact('data'));\n }", "public function editAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('MedecinIBundle:Fichepatient')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Fichepatient entity.');\n }\n\n $editForm = $this->createEditForm($entity);\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('MedecinIBundle:Fichepatient:edit.html.twig', array(\n 'entity' => $entity,\n 'edit_form' => $editForm->createView(),\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function edit($id)\n {\n return $this->form->render('mconsole::personal.form', [\n 'item' => $this->person->query()->with('uploads')->findOrFail($id),\n ]);\n }", "public function edit($id)\n\t{\n\t\t // get the project\n $project = Project::find($id);\n\n // show the edit form and pass the project\n return View::make('logicViews.projects.edit')->with('project', $project);\n\t}" ]
[ "0.78550774", "0.7692893", "0.7273195", "0.7242132", "0.7170847", "0.70622855", "0.7053459", "0.6982539", "0.69467914", "0.6945275", "0.6941114", "0.6928077", "0.69019294", "0.68976134", "0.68976134", "0.6877213", "0.68636996", "0.68592185", "0.68566656", "0.6844697", "0.68336326", "0.6811471", "0.68060875", "0.68047357", "0.68018645", "0.6795623", "0.6791791", "0.6791791", "0.6787701", "0.67837197", "0.67791027", "0.677645", "0.6768301", "0.6760122", "0.67458534", "0.67458534", "0.67443407", "0.67425704", "0.6739898", "0.6735328", "0.6725465", "0.6712817", "0.6693891", "0.6692419", "0.6688581", "0.66879624", "0.6687282", "0.6684741", "0.6682786", "0.6668777", "0.6668427", "0.6665287", "0.6665287", "0.66610634", "0.6660843", "0.66589665", "0.66567147", "0.66545695", "0.66527975", "0.6642529", "0.6633056", "0.6630304", "0.6627662", "0.6627662", "0.66192114", "0.6619003", "0.66153085", "0.6614968", "0.6609744", "0.66086483", "0.66060555", "0.6596137", "0.65950733", "0.6594648", "0.65902114", "0.6589043", "0.6587102", "0.65799844", "0.65799403", "0.65799177", "0.657708", "0.65760696", "0.65739626", "0.656931", "0.6567826", "0.65663105", "0.65660435", "0.65615267", "0.6561447", "0.6561447", "0.65576506", "0.655686", "0.6556527", "0.6555543", "0.6555445", "0.65552044", "0.65543956", "0.65543705", "0.6548264", "0.65475875", "0.65447706" ]
0.0
-1
Update the specified resource in storage.
public function update(UpdateProductRequest $re, $id) { // //dd($re); if($re->has('sendProductUpdate')) { $productAdminUpdate= $re->input('productAdminUpdate'); $priceAdminUpdate= $re->input('priceAdminUpdate'); $categoryAdminUpdate= $re->input('categoryAdminUpdate'); $colorAdminUpdate= $re->input('colorAdminUpdate'); $imageAdminUpdate= $re->file('imageAdminUpdate'); // dd($imageAdmin->getPathname()); $directory_default=$imageAdminUpdate.\public_path(); // tu je smestena dd($directory_default); $fileName = $imageAdminUpdate->getClientOriginalName(); $fileNameNew=time()."_".$fileName; //ime slike $newDir='/images/productsShop/'.$fileNameNew; //dd($newDir); // dd($fileNameNew); //dd($fileName.public_path()); $imageAdminUpdate->move(\public_path()."/images/productsShop/",$fileNameNew); //dd($imageAdmin.\public_path()); //dd($imageAdmin); try{ $photoAdminUpdate = $this->model->updatePhotoAdminUpdate($id,$productAdminUpdate,$priceAdminUpdate,$fileNameNew,$categoryAdminUpdate,$colorAdminUpdate); return redirect()->back()->with('message', 'Product updated'); } catch(\Exception $e){ return response(["greska" => $ex->getMessage()], 505); return redirect()->back()->with('message', 'Failed '); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateShopifyResource() {\n $this->saving();\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'PUT',\n 'DATA' => [\n static::getResourceSingularName() => $this->shopifyData\n ]\n ]);\n }", "public function update(Request $request, Resource $resource)\n {\n $request->validate([\n 'name' => 'required',\n 'description' => 'required|string',\n 'file' => 'required|mimes:jpg,jpeg,png,doc,docx,pdf,ppt,txt',\n ]);\n\n $resource->update($request->all());\n\n if ( $request->hasFile('file') ) {\n $resource = 'resource-'.time().'.'.$request->file('file')->extension();\n $request->file->storeAs('resources', $resource,'public');\n $resource->file = $resource;\n }\n\n if ( $resource->save() ) {\n return redirect()->route('admin.resources.index')->with('success', 'Resource updated');\n } else {\n return redirect()->route('admin.resources.index')->with('error', 'Something went wrong');\n }\n }", "public function update(Request $request, Resource $resource)\n {\n //\n }", "public function updateStream($resource);", "public function update(Request $request, Storage $storage)\n {\n $storage->product_id = $request->product_id;\n $storage->amount = $request->amount;\n\n $storage->save();\n\n return redirect()->route('storages.index');\n }", "protected function updateImageResource($fileName, $imageId, $storage)\n {\n //Get image name and storage location for image\n $image = Image::where('id', '=', $imageId)->first();\n\n //Delete old image\n $this->deleteResource($image->name, $image->storage);\n\n //Store the new image\n $image->name = $fileName;\n $image->storage = $storage;\n\n $image->save();\n }", "public function update(Storage $storage, UpdateStorageRequest $request)\n {\n $this->storage->update($storage, $request->all());\n\n return redirect()->route('admin.product.storage.index')\n ->withSuccess(trans('core::core.messages.resource updated', ['name' => trans('product::storages.title.storages')]));\n }", "public function update(StoreStorage $request, Storage $storage)\n {\n $storage->fill($request->all())->save();\n $request->session()->flash('alert-success', 'Запись успешно обновлена!');\n return redirect()->route('storage.index');\n }", "public function update_asset($id, Request $request){\n \t\tif(!Auth::user()){\n\t\t\treturn redirect('/');\n\t\t}\n \t\t$asset = Storage::find($id);\n \t\t$asset->name = $request->name;\n \t\t$asset->quantity = $request->quantity;\n \t\t$asset->category_id = $request->category;\n \t\tif($request->file('image') != null){\n\t\t\t$image = $request->file('image');\n\t\t\t$image_name = time(). \".\" . $image->getClientOriginalExtension();\n\t\t\t$destination = \"images/\";\n\t\t\t$image->move($destination, $image_name);\n\t\t\t$asset->image_url = $destination.$image_name;\n\t\t} \n\t\t$asset->save();\n\t\tsession()->flash('success_message', 'Item Updated successfully');\n\t\treturn redirect(\"/storage\");\n \t}", "public function update(Request $request, Flight $exercise, FlightResource $resource)\n {\n $request->validate([\n 'display_name' => 'required|string|max:100',\n 'file' => 'nullable|file|max:10240|mimes:pdf',\n 'uri' => 'nullable|url|max:255',\n ]);\n\n if ($resource->type === 'file' && $request->file('file')) {\n Storage::drive('public')->delete($resource->resource);\n $resource->resource = $request->file('file')->store('smartcars/exercises/resources', ['disk' => 'public']);\n } elseif ($resource->type === 'uri' && $request->input('uri')) {\n $resource->resource = $request->input('uri');\n }\n\n $resource->save();\n\n return redirect()->route('adm.smartcars.exercises.resources.index', $exercise)\n ->with('success', 'Resource edited successfully.');\n }", "public function update(Request $request, $id)\n {\n $validator = Validator::make($request->all(), [\n 'title' => 'required|string',\n 'content' => 'required|string',\n 'mentoring_area_id' => 'required|integer',\n 'featured_image_uri' => 'string',\n ]);\n\n if ($validator->fails()) {\n return APIHandler::response(0, $validator->errors(), 400);\n }\n \n $resource = Resource::find($id);\n $resource->title = $request->get('title');\n $resource->content = $request->get('content');\n $resource->featured_image_uri = $request->get('featured_image_uri');\n $resource->updated_at = \\Carbon\\Carbon::now();\n $resource->mentoring_area_id = $request->get('mentoring_area_id');\n $resource->save();\n $data['resource'] = $resource;\n return APIHandler::response(1, \"Resource has been updated\");\n }", "protected function updateVideoResource($fileName, $videoId, $storage, $premium=1)\n {\n //Get video name and storage location for video\n $video = Video::where('id', '=', $videoId)->first();\n\n //Check the storage medium\n if($storage == 'vimeo' || $storage == 'youtube')\n {\n $video->name = $fileName;\n $video->storage = $storage;\n $video->premium = $premium;\n $video->save();\n }\n else\n {\n if($video['storage'] == 'local' || $video['storage'] == 's3')\n {\n //Delete old video\n $this->deleteResource($video->name, $video->storage);\n }\n \n //Store the new video\n $video->name = $fileName;\n $video->storage = $storage;\n $video->premium = $premium;\n $video->save();\n }\n }", "public function put($resource, $with=[]){\n return $this->fetch($resource, self::PUT, $with);\n }", "public function update($id, $resource) {\n SCA::$logger->log(\"update resource\");\n return $this->orders_service->update($id, $resource);\n }", "public function update($path);", "public function update($id, $resource)\n {\n SCA::$logger->log(\"Entering update()\");\n //check whether it is an sdo or an xml string.\n if ($resource instanceof SDO_DataObjectImpl) {\n //if the thing received is an sdo convert it to xml\n if ($this->xml_das !== null) {\n $xml = SCA_Helper::sdoToXml($this->xml_das, $resource);\n } else {\n throw new SCA_RuntimeException(\n 'Trying to update a resource with SDO but ' .\n 'no types specified for reference'\n );\n }\n } else {\n $xml = $resource;\n }\n\n $slash_if_needed = ('/' === $this->target_url[strlen($this->target_url)-1])?'':'/';\n\n $handle = curl_init($this->target_url.$slash_if_needed.\"$id\");\n curl_setopt($handle, CURLOPT_HEADER, false);\n curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($handle, CURLOPT_CUSTOMREQUEST, \"PUT\");\n curl_setopt($handle, CURLOPT_POSTFIELDS, $xml);\n\n //replace with Content-Type: atom whatever\n $headers = array(\"User-Agent: SCA\",\n \"Content-Type: text/xml;\",\n \"Accept: text/plain\");\n curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);\n\n $result = curl_exec($handle);\n\n $response_http_code = curl_getinfo($handle, CURLINFO_HTTP_CODE);\n\n curl_close($handle);\n\n $response_exception = $this->buildResponseException($response_http_code, '200');\n\n if ($response_exception != null) {\n throw $response_exception;\n } else {\n //update does not return anything in the body\n return true;\n }\n }", "public function update(Request $request, $id)\n {\n $this->validate($request, [\n 'name' => 'required',\n 'link' => 'required',\n 'description' => 'required'\n ]);\n\n $resource = Resource::find($id);\n $resource->name = $request->name;\n $resource->type_id = $request->type_id;\n $resource->has_cost = ($request->has('has_cost')) ? 1 : 0;\n $resource->language_id = $request->language_id;\n $resource->link = $request->link;\n $resource->description = $request->description;\n $resource->tags = '';\n\n $resource->save();\n //return back()->with('success', 'Recurso actualizado satisfactoriamente');\n return redirect('/resource')->with('success', 'Recurso actualizado satisfactoriamente');\n }", "public function update(Request $request, $id)\n {\n $oldProduct = Product::findOrFail($id);\n $data = $request->all();\n if(isset($data['img'])){\n // $file = $request->file('photo');\n // return $file;\n $imgName = time().'.'.$request->img->extension();\n $data['img'] = $imgName;\n // Storage::putFile('spares', $file);\n $path = $request->img->storeAs('public/uploads', $imgName); //in Storage\n\n //delete old file\n if($oldProduct->img != 'product-default.png'){\n Storage::delete(\"public/uploads/\".$oldProduct->img);\n // return 'deleted';\n }\n \n }else{\n $data['img'] = $oldProduct->img;\n }\n $oldProduct->update($data);\n return redirect()->route('product.index'); \n\n }", "public function update($request, $id) {\n\t\t\t$image = $request['photo'];\n\t\t\tif($image !== null) {\n\t\t\t\t$name = time().'.' . explode('/', explode(':', substr($image, 0, strpos($image, ';')))[1])[1];\n\t\t\t\t\\Image::make($request['photo'])->save(public_path('storage/products/').$name);\n\t\t\t\t$request['photo'] = $name;\n\t\t\t} else {\n\t\t\t\t$currenPhoto = Product::all()->where('id', $id)->first();\n\t\t\t\t$request['photo'] = $currenPhoto->photo;\n\t\t\t}\n return $this->product->update($id, $request);\n\t}", "public function updateStream($path, $resource, Config $config)\n {\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function updateResourceIndex(&$resource) {\n if ($this->connector != null) {\n\n // STEP 1: Update or insert this resource as a node:\n $this->logger->addDebug(\"Updating/Inserting Node into Neo4J database\");\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id} }) SET a.title = {title}, a.version = {version}, a.href = {href}\n return a;\",\n [\n 'id' => $resource->getID(),\n 'version' => $resource->getVersion(),\n 'title' => $resource->getTitle(),\n 'href' => $resource->getLink()\n ]\n );\n\n // Check to see if anything was added\n $records = $result->getRecords();\n if (empty($records)) {\n // Must create this record instead\n $result = $this->connector->run(\"CREATE (n:Resource) SET n += {infos};\",\n [\n \"infos\" => [\n 'id' => $resource->getID(),\n 'version' => $resource->getVersion(),\n 'title' => $resource->getTitle(),\n 'href' => $resource->getLink()\n ]\n ]\n );\n }\n\n // STEP 2: Update or insert the resource's link to holding repository\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id} })-[r:HIRELATION]->()\n return r;\",\n [\n 'id' => $resource->getID(),\n ]\n );\n $records = $result->getRecords();\n if (!empty($records)) {\n // delete the one there so that we can add the correct one (just in case)\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id}})-[r:HIRELATION]->() delete r;\",\n [\n 'id' => $resource->getID()\n ]\n );\n\n }\n\n // If resource has a repository, then add a link\n if ($resource->getRepository() != null && $resource->getRepository()->getID() != null) {\n $this->connector->run(\"MATCH (a:Identity {id: {id1} }) MATCH (b:Resource {id: {id2} }) CREATE (b)-[r:HIRELATION]->(a);\",\n [\n 'id1' => (string) $resource->getRepository()->getID(),\n 'id2' => $resource->getID()\n ]);\n }\n }\n }", "public function update($data) {}", "public function update($data) {}", "public function putStream($resource);", "public function update(Request $request, NebulaResource $resource, $item): RedirectResponse\n {\n $this->authorize('update', $item);\n\n $validated = $request->validate($resource->rules(\n $resource->editFields()\n ));\n\n $resource->updateQuery($item, $validated);\n\n $this->toast(__(':Resource updated', [\n 'resource' => $resource->singularName(),\n ]));\n\n return redirect()->back();\n }", "public function saveShopifyResource() {\n if (is_null($this->getShopifyId())) { // if there is no id...\n $this->createShopifyResource(); // create a new resource\n } else { // if there is an id...\n $this->updateShopifyResource(); // update the resource\n }\n }", "public function update($entity);", "public function update($entity);", "public function setResource($resource);", "public function updateStream($path, $resource, Config $config)\n {\n return $this->upload($path, $resource, $config);\n }", "public function isUpdateResource();", "public function update(Request $request, $id)\n {\n $device = Device::findOrFail($id);\n $device->fill($request->all());\n if ($request->hasFile('icon')) {\n if ($device->hasMedia('icon')) {\n $device->deleteMedia($device->getFirstMedia('icon'));\n }\n $device->addMediaFromRequest('icon')->toMediaCollection('icon');\n }\n $device->save();\n return new DeviceResource($device);\n }", "public function update(Request $request, $id)\n {\n //\n $product = Product::findOrFail($id);\n \n $product->update($request->all());\n \n $file = $request->file('url_image')->move('upload', $request->file('url_image')->getClientOriginalName());\n\n Product::where('id',$id)->update(['url_image'=>$file]);\n \n \\Session::flash('flash_message', 'Edit product successfully.'); \n \n //cũ : return redirect('articles');\n return redirect()->route('products.index');\n }", "public function store($data, Resource $resource);", "public function update(Request $request, $id)\n {\n \n $product = Product::find($id);\n\n\n $product->fill($request->all())->save();\n\n //Verificamos que tenemos una imagen\n if($request->file('photo_1')){\n\n\n //En caso de tenerla la guardamos en la clase Storage en la carpeta public en la carpeta image.\n $path = Storage::disk('public')->put('photo_1',$request->file('photo_1'));\n\n //Actualizamos el Post que acabamos de crear\n $product->fill(['photo_1' => asset($path)])->save();\n\n }\n\n\n return redirect()->route('products.index')->with('info', 'Producto actualizado exitosamente!');\n }", "public function update(Request $request, $id)\n {\n $product = Product::find($id);\n\n if (\\Input::hasFile('image')) {\n $this->imgsave($request, $product);\n }\n\n\n if (!empty($request->input('tags'))) {\n $product->tags()->sync($request->input('tags'));\n } else {\n $product->tags()->detach();\n }\n\n $product->update($request->all());\n\n return redirect()->to('dashboard/product')->with('message', 'update success');\n }", "public function put($resource_path, array $variables = array()) {\n return $this->call($resource_path, $variables, 'PUT');\n }", "public function update($id)\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'updateValidations')) {\n $this->request->validate($this->updateValidations());\n }\n\n /* Get the specified resource */\n $resource = $this->model::findOrFail($id);\n\n /* Update the specified resource */\n $resource->update(Input::all());\n\n /* Redirect back */\n return redirect()->back()\n ->with(\n 'info',\n Lang::has($this->name . '.resource-updated') ?\n $this->name . '.resource-updated' :\n 'messages.alert.resource-updated'\n );\n }", "public function putResponse($request)\n {\n $idSearched = $this->searcher->searchResourceIndex(\n $request, \n $this->db[$request['resource']]\n );\n if ($idSearched) {\n $resource = $this->db[$request['resource']][$idSearched];\n $bodyInput = json_decode($this->standardInput, true);\n $resource = BodyRequest::canApplyBody($bodyInput);\n $resource['id'] = (int)$request['param'];\n foreach($resource as $key => $value) {\n $this->db[$request['resource']][$idSearched][$key] = $value;\n }\n file_put_contents(DB_PATH, json_encode($this->db));\n }\n }", "public function update(Storedataset $request, dataset $dataset){\n $dataset->title = $request->input('title');\n $dataset->caption = $request->input('caption');\n $dataset->file_url = $request->input('file_url');\n $dataset->type = $request->input('type');\n $dataset->status = $request->input('status');\n $dataset->publication_id = $request->input('publication_id');\n\n $dataset->save();\n\n return redirect()->route('datasets.show', ['dataset' => $dataset]);\n }", "public function update(Request $request, $id)\n\n {\n ResourceManagement::findOrFail($id);\n $constraints = [\n 'title' => 'required|max:100',\n 'url'=> 'required|max:191',\n 'content' => 'required'\n ];\n\n $input = [\n 'title' => $request['title'],\n 'url' => $request['url'],\n 'content' => $request['content'],\n 'type' => $request['type'],\n 'level' => $request['level'],\n 'user_id' => $request['user']\n ];\n// $this->validate($input, $constraints);\n ResourceManagement::where('id', $id)\n ->update($input);\n\n return redirect()->intended('/resource-management');\n }", "public function update(Request $request, $id)\n {\n $this->validate($request, [\n 'title' => 'required',\n 'description' => 'required|string',\n 'price' => 'required|numeric',\n 'reference'=>'required'\n ]);\n \n $product = Product::find($id);\n $product->update($request->all());\n \n $im = $request->file('picture');\n \n if (!empty($im)) {\n \n $link = $request->file('picture')->store('images');\n \n \n $product->update([\n 'url_image' => $link,\n ]);\n } \n //dump($request->all());\n return redirect()->route('product.index')->with('message', 'Article modifié avec succès');\n }", "public function update(StoreOrUpdateAsset $request, Asset $asset)\n {\n if (Storage::exists($asset->path) && !Storage::delete($asset->path)) {\n abort(500);\n }\n\n $file = $request->file('file');\n $path = $file->store('assets');\n\n if (!$path) {\n abort(500);\n }\n\n // We wonder if we should delete the old file or not...\n\n $asset->name = $file->getClientOriginalName();\n $asset->size = $file->getSize();\n $asset->type = $file->getMimeType();\n $asset->path = $path;\n\n if ($asset->save()) {\n flash('The asset has been saved.')->success();\n } else {\n abort(500);\n }\n\n return redirect('/admin/assets');\n }", "public function update(FoodRecipeRequest $request, $id)\n {\n $foodRecipe = FoodRecipe::with('ingredients','cookingProcesses')->findOrFail($id);\n if ($request->input('name')!= null)\n $foodRecipe->name = $request->input('name');\n if ($request->input('detail')!= null)\n $foodRecipe->detail = $request->input('detail');\n if($request->file('photo') != null) {\n $old_file = $foodRecipe->photo;\n if($old_file != null){\n $path = public_path().'/storage/'.$old_file;\n File::delete($path);\n }\n $file = $request->file('photo');\n $name = '/foodRecipe/' . Carbon::now()->format(\"dnY-Hisu\") . \".\" . $file->extension();\n $file->storePubliclyAs('public', $name);\n $foodRecipe->photo = $name;\n }\n $foodRecipe->save();\n return new FoodRecipeResource($foodRecipe);\n }", "public function update(StorageTypeRequest $request, $id)\n {\n try {\n $this->service->updateStorageType($request, $id);\n return $this->NoContent();\n } catch (EntityNotFoundException $e) {\n \\Log::error($e->getMessage());\n return $this->NotFound($e->getMessage());\n } catch(\\QueryException $e) {\n \\Log::error($e->getMessage());\n return $this->ServerError();\n } catch(Exception $e) {\n \\Log::error($e->getMessage());\n return $this->ServerError();\n }\n }", "public function update(Request $request, $id)\n {\n //validation\n $this->validate(request(),[\n 'image' => 'image'\n ]);\n\n $slider = HomeSliders::find($id);\n \n $slider->link = request('link');\n\n //get old image to delete if updated\n $oldImage = request('oldImage');\n //get the new image\n $NewImage=$request->file('image');\n\n if($NewImage)\n {\n $filenameToStore= helpers::updatePhoto('image','homeSliders',$request);\n $slider->image=$filenameToStore;\n\n Storage::delete('public/Images/homeSliders/'.$oldImage);\n }\n\n $slider->save();\n\n Alert::success(config('app.name'), trans('messages.Updated Successfully') );\n return redirect()->route('admin.homeSlider',$slider->type);\n }", "public function update(Qstore $request, $id)\n {\n //\n }", "public function update(IEntity $entity);", "protected function performUpdate(): bool\n {\n // Abort if resource does not support update operations\n if (!$this->isUpdatable()) {\n throw new UnsupportedOperation(sprintf('API does not support update operation for %s resources', $this->resourceNameSingular()));\n }\n\n $id = $this->id();\n $prepared = $this->prepareBeforeUpdate($this->toArray());\n\n $payload = [\n $this->resourceNameSingular() => $prepared\n ];\n\n $response = $this\n ->request()\n ->put($this->endpoint($id), $payload);\n\n // Extract and (re)populate resource (if possible)\n // Note: Unlike the \"create\" method, Redmine does NOT\n // appear to send back a full resource when it has been\n // successfully updated.\n $this->fill(\n $this->decodeSingle($response)\n );\n\n return true;\n }", "public function update($request, $id);", "function put($resource, $data = null) {\r\n\t\t\r\n\t\tif(isset($data)) {\r\n\t\t\t$this->request_body = $data;\r\n\t\t}\r\n\r\n\t\t// make the call chief\r\n\t\t$this->exec ( \"PUT\", '/' . $resource );\r\n\r\n\t\t// check the request status\r\n\t\tif($this->status_code != 200){\r\n\t\t\t$this->Logger->error(\r\n\t\t\t\tsprintf(\r\n\t\t\t\t\t'GET Call for resource \\'%s\\' Failed.\r\n\t\t\t\t\tStatus: %d,\r\n\t\t\t\t\tRequest: %s\r\n\t\t\t\t\tAPI Error Message: \r\n\t\t\t\t\t%s',\r\n\t\t\t\t\t$resource,\r\n\t\t\t\t\t$this->status_code,\r\n\t\t\t\t\t$this->request_body_raw,\r\n\t\t\t\t\t$this->response_body\r\n\t\t\t\t)\r\n\t\t\t);\r\n\t\t\tthrow new Exception($this->response_body);\r\n\t\t} else {\r\n\t\t\treturn $this->response_parsed;\r\n\t\t}\r\n\t}", "public function updateEntities($resource)\n {\n $json = [\n 'resource' => $resource,\n ];\n $request = $this->createRequest('PUT', '/entities', ['json' => $json]);\n $response = $this->send($request);\n return $response;\n }", "public function updateStream($path, $resource, Config $config)\n {\n return $this->writeStream($path, $resource, $config);\n }", "public function update(Request $request, $id)\n {\n\n $product = Product::findOrFail($id);\n $product->name = $request['name'];\n $product->price = $request['price'];\n $product->stock = $request['stock'];\n $product->description = $request['description'];\n\n $file = $request->file('image');\n $fileName = $file->getClientOriginalName();\n if($fileName != $product->image){\n $request->file('image')->move('images/',$fileName);\n $product->image = $fileName;\n }\n\n $product->save();\n\n return redirect()->route('products.show',\n $product->id)->with('flash_message',\n 'Article, '. $product->name.' updated');\n }", "protected function handleUpdate()\n {\n $resource = $this->argument('resource');\n $action = $this->option('action');\n $startPage = (int)$this->option('startPage');\n $perPage = (int)$this->option('perPage');\n\n try {\n $harvest = Harvest::where('resource', $resource)->where('action', $action)->firstOrFail();\n } catch (\\Exception $e) {\n $this->info('There is no existing action for updating ' . ucwords($action) . ' ' . ucwords($resource) . '.');\n exit('Nothing was updated.');\n }\n\n $options = [\n 'startPage' => $startPage,\n 'perPage' => $perPage,\n 'lastRun' => $harvest->last_run_at\n ];\n\n // If a lastRun was given use that\n // OR if this has never been run before use 2001-01-01\n if (!empty($this->option('lastRun'))) {\n $options['lastRun'] = new Carbon($this->option('lastRun'));\n } elseif (is_null($options['lastRun'])) {\n $options['lastRun'] = new Carbon('2001-01-01');\n }\n\n $job = new UpdateResourceJob(\n $harvest,\n $options\n );\n\n $message = 'Updating ' . $action . ' ' . $resource . ' ' . $perPage . ' at a time';\n if (isset($lastRun)) {\n $message .= ' with entries updated since ' . $lastRun->format('r');\n }\n $this->info($message);\n $this->dispatch($job);\n }", "abstract public function put($data);", "public function update($id, $data);", "public function update($id, $data);", "public function update($id, $data);", "public function update($id, $data);", "public function update($id, $data);", "public function testUpdateSupplierUsingPUT()\n {\n }", "public function update(Request $request, $id)\n {\n $storageplace = Storageplace::findOrFail($id);\n $storageplace->update($request->only(['storageplace']));\n return $storageplace;\n }", "public function updateRelatedImage(Request $request, $id)\n {\n // Delete display image in Storage\n Validator::make($request->all(), ['photos' => \"required|file|image|mimes:jpg,png,jpeg|max:5000\"])->validate();\n\n\n if ($request->hasFile(\"photos\")) {\n\n $photo = ProductsPhoto::find($id);\n $imageName = $photo->photos;\n $exists = Storage::disk('local')->exists(\"public/product_images/\" . $photo->photos);\n\n //delete old image\n if ($exists) {\n Storage::delete('public/product_images/' . $imageName);\n }\n\n //upload new image\n $ext = $request->file('photos')->getClientOriginalExtension(); //jpg\n\n $request->photos->storeAs(\"public/product_images/\", $imageName);\n\n $arrayToUpdate = array('photos' => $imageName);\n DB::table('products_photos')->where('id', $id)->update($arrayToUpdate);\n\n return redirect()->route(\"adminDisplayRelatedImageForm\", ['id' => $photo->product_id]);\n } else {\n\n $error = \"NO Image was Selected\";\n return $error;\n }\n }", "public function update(Request $request, $id)\n {\n $skill = Skill::findOrFail($id);\n\n $skill->skill = $request->skill;\n\n if ($request->hasFile('image')) {\n \\Cloudder::upload($request->file('image'));\n $c=\\Cloudder::getResult();\n // $image = $request->file('image');\n // $filename = time() . '.' . $image->getClientOriginalExtension();\n // $location = public_path('images/' . $filename);\n // Image::make($image)->save($location);\n\n $skill->image = $c['url'];\n }\n\n $skill->save();\n\n Session::flash('success', 'Successsfully updated your skill!');\n return redirect()->route('skills.index');\n }", "public function updateStream($path, $resource, Config $config = null)\n {\n $contents = stream_get_contents($resource);\n\n return $this->write($path, $contents, $config);\n }", "public abstract function update($object);", "public static function update($id, $file)\n {\n Image::delete($id);\n\n Image::save($file);\n }", "public function update(Request $request, $id)\n {\n $product = Product::find($id);\n $image = $product->image;\n if($request->hasFile('image')){\n $image = $request->file('image')->store('files');\n \\Storage::delete($product->image);\n } \n $product->name = $request->get('name');\n $product->price = $request->get('price');\n $product->description = $request->get('description');\n $product->additional_info = $request->get('additional_info');\n $product->category_id = $request->get('category');\n $product->subcategory_id = $request->get('subcategory');\n $product->image = $image;\n $product->save();\n return redirect()->back();\n }", "public function update(Request $request, $id)\n {\n $sli=Slider::find($id);\n $sli->sort_order=$request->input('sort_order');\n $image = $request->file('slider');\n if($image == ''){\n $image = $sli->slider;\n }else{\n $image = base64_encode(file_get_contents($request->file('slider')));\n }\n $sli->slider = $image;\n $sli->save();\n return redirect()->back();\n }", "public function update(ProductRequest $request, $id)\n {\n $input = Product::find($id);\n $data = $request->all();\n if ($file = $request->file('product_photo')){\n $name = time().$file->getClientOriginalName();\n $file->move('product_image',$name);\n $data['product_photo']=$name;\n// $input->update($data);\n }\n $input->update($data);\n return redirect('admin/products/');\n }", "public function update(Request $request, $id)\n {\n $volume = $this->findVolume($id);\n\n if(count($volume) > 0) {\n $volume->str_volume_name = $request->str_volume_name;\n\n $volume->save();\n }\n\n return response()\n ->json(\n array(\n 'message' => 'Volume is successfully updated.',\n 'volume' => $volume\n ),\n 201\n );\n }", "public function update(Request $request, $id)\n {\n $product = ProductModel::find($id);\n $product->name = $request->name;\n $product->description = $request->description;\n $product->price = $request->price;\n $product->stock = $request->stock;\n\n if($request->image!=null){\n $imageName = time().'.'.$request->image->extension();\n $request->image->move(public_path('images'), $imageName);\n $product->image = \"/images/\".$imageName;\n }\n $product->save();\n return redirect(\"/products/index\")->with('success','Product has been updated');\n }", "public function update()\n {\n $accessory = Accessories::find(request('id'));\n\n if ($accessory == null) {\n return response()->json([\"error\" => \"aksesuaras nerastas\"], 404);\n }\n\n $this->validateData();\n $path = $accessory->src;\n\n if (request()->hasFile('src')) {\n\n if (Storage::disk('public')->exists($accessory->src)) {\n Storage::disk('public')->delete($accessory->src);\n }\n $path = request()->file('src')->store('accessoriesImages', 'public');\n }\n\n $accessory->update(array_merge($this->validateData(), ['src' => $path]));\n\n return response()->json([\"data\" => $accessory], 200);\n }", "public function update(ProductStoreRequest $request,$id)\n {\n $data = $request->validated();\n $product = Product::where('id',$id);\n $product->update($data);\n return response(\"Producto actualizado con éxito\",200);\n }", "public function update($entity)\n {\n \n }", "public function updateStream($path, $resource, Config $config)\n {\n return $this->write($path,stream_get_contents($resource),$config);\n }", "public function update($id, Request $request)\n {\n date_default_timezone_set('Asia/Taipei');\n $data = $request->all();\n $dbData = Product::find($id);\n $myfile = Storage::disk('local');\n if ($request->hasFile('img')) {\n $file = $request->file('img');\n $path = $myfile->putFile('public', $file);\n $data['img'] = $myfile->url($path);\n File::delete(public_path($dbData->img));\n }\n $dbData->update($data);\n\n if ($request->hasFile('imgs')) {\n // $this->fetchDestroyByProdId($id);\n $localS = Storage::disk('local');\n\n $fileS = $request->file('imgs');\n $imgs = [];\n foreach ($fileS as $i) {\n $pathS = $localS->putFile('public', $i);\n $imgs[] = $localS->url($pathS);\n }\n foreach ($imgs as $img) {\n ProductImg::create([\n 'product_id' => $id,\n 'img' => $img\n ]);\n }\n }\n\n return redirect()->route('admin');\n }", "public function update(Request $request, Product $product)\n { $remfile= $product->image;\n if($request->filep){\n $product->image=$request->filep;\n File::delete(storage_path('app/public/products/'.$remfile));\n }else{\n $product->image=$remfile;\n }\n //rmdir(storage_path('app/public/products/'.$remfile));\n $product->name = $request->name;\n $product->description = $request->description;\n $product->price = $request->price;\n $product->save();\n sleep(3);\n toast('Details updated successfully','info');\n return redirect('/products');\n }", "public function update($id, $input);", "public function update(ProductRequest $request,int $id): ProductResource\n {\n $attributes = $request->only('supplier_id', 'name', 'warehouses');\n\n return new ProductResource($this->productRepository->update($id, $attributes)); }", "public function update(Request $request, $id)\n {\n $slider=new Slider;\n $slider=$slider::find($id);\n \n \n if($file =$request->file('slider')){\n if(Storage::delete('public/slider/'.$slider->slider)){\n\n //Get file original name//\n \n$original_name=$file->getClientOriginalName();\n\n //Get just the file name\n$filename=pathinfo($original_name,PATHINFO_FILENAME);\n\n//Create new file name\n$name=$filename.'_'.time().'.'.$file->getClientOriginalExtension();\n\n $destination='public/slider';\n $path=$request->slider->storeAs($destination,$name);\n $slider->slider=$name;\n $slider->save();\n return redirect('Admin/slider');\n\n }\n }\n}", "public function update(Request $request, $id)\n {/* dd($request->all()); */\n $acheivePic = $this->acheiveRepo->find($id);\n $acheive = $request->except('_method', '_token', 'photo', 'ar', 'en');\n $acheiveTrans = $request->only('ar', 'en');\n\n if ($request->hasFile('icon')) {\n // Delete old image first.\n $oldPic = public_path() . '/images/acheives/' . $acheivePic->icon;\n File::delete($oldPic);\n\n // Save the new one.\n $image = $request->file('icon');\n $imageName = $this->upload($image, 'acheives');\n $acheive['icon'] = $imageName;\n }\n\n $this->acheiveRepo->update($id, $acheive, $acheiveTrans);\n\n return redirect('admin-panel/widgets/acheive')->with('updated', 'updated');\n }", "public function update(Request $request, $id)\n {\n $data = $request->all();\n extract($data);\n\n $productVarient = new ProductVariant();\n $productVarient = $productVarient->find($id);\n $productVarient->vendor_id = auth()->user()->id;\n $productVarient->description = $prod_desc;\n $productVarient->price = $price;\n\n if(request()->hasFile('photo')){\n $image = request()->file('photo')->getClientOriginalName();\n $imageNewName = auth()->user()->id.'-'.$image;\n $file = request()->file('photo');\n $file->storeAs('images/product',$imageNewName, ['disk' => 'public']);\n $productVarient->image = $imageNewName;\n }\n \n $productVarient->save();\n\n return back()->withStatus(__('Product successfully updated.'));\n }", "public function update(Request $request, $id)\n {\n //if upload new image, delete old image\n $myfile=$request->old_photo;\n if($request->hasfile('photo'))\n {\n $imageName=time().'.'.$request->photo->extension();\n $name=$request->old_photo;\n\n if(file_exists(public_path($name))){\n unlink(public_path($name));\n $request->photo->move(public_path('backendtemplate/truefalseimg'),$imageName);\n $myfile='backendtemplate/truefalseimg/'.$imageName;\n }\n }\n //Update Data\n $truefalsequestion=TrueFalseQuestion::find($id);\n $truefalsequestion->name=$request->name;\n $truefalsequestion->photo=$myfile;\n $truefalsequestion->answer = $request->answer;\n $truefalsequestion->question_id = $request->question;\n $truefalsequestion->save();\n\n //Redirect\n return redirect()->route('truefalsequestions.index'); \n }", "public function update($id);", "public function update($id);", "private function update()\n {\n $this->data = $this->updateData($this->data, $this->actions);\n $this->actions = [];\n }", "public function put($path, $data = null);", "public function update(Request $request, $id)\n {\n $request->validate([\n 'path_image'=>'image',\n 'status'=>'required|in:0,1'\n ]);\n $slider=Slider::whereId($id)->first();\n if (is_null($slider)){\n return redirect()->route('sliders.index')->with('error','Slider does not exist');\n }\n try {\n if ($request->hasFile('path_image')){\n $file = $request->file('path_image');\n\n $image_path= $file->store('/sliders',[\n 'disk'=>'uploads'\n ]);\n Storage::disk('uploads')->delete($slider->image);\n\n $request->merge([\n 'image'=>$image_path,\n ]);\n }\n\n $slider->update( $request->only(['status','image']));\n return redirect()->route('sliders.index')->with('success','Updated successful');\n }catch (\\Exception $exception){\n return redirect()->route('sliders.index')->with(['error'=>'Something error try again']);\n\n }\n }", "public function update() {\n $this->accessory->update($this->accessory_params());\n\n if ($this->accessory->is_valid()) {\n $this->update_accessory_image($this->accessory);\n redirect('/backend/accessories', ['notice' => 'Successfully updated.']);\n } else {\n redirect(\n '/backend/accessories/edit',\n ['error' => $this->accessory->errors_as_string()],\n ['id' => $this->accessory->id]\n );\n }\n }", "public function update(Entity $entity);", "public function update(Request $request, $id)\n {\n $icon = SliderIcon::find($id);\n $data = $request->all();\n $data['active'] = $request->has('active') ? 1 : 0;\n if ($request->hasFile('img')) {\n if (Storage::disk('public')->exists(str_replace('storage', '', $icon->img))){\n Storage::disk('public')->delete(str_replace('storage', '', $icon->img));\n }\n $image = $request->file('img');\n $fileName = time().'_'.Str::lower(Str::random(5)).'.'.$image->getClientOriginalExtension();\n $path_to = '/upload/images/'.getfolderName();\n $image->storeAs('public'.$path_to, $fileName);\n $data['img'] = 'storage'.$path_to.'/'.$fileName;\n }\n $icon->update($data);\n return redirect()->route('slider_icons.index')->with('success', 'Данные преимущества обнавлены');\n }", "public function update() {\n\t $this->layout = false;\n\t \n\t //set default response\n\t $response = array('status'=>'failed', 'message'=>'HTTP method not allowed');\n\t \n\t //check if HTTP method is PUT\n\t if($this->request->is('put')){\n\t //get data from request object\n\t $data = $this->request->input('json_decode', true);\n\t if (empty($data)) {\n\t $data = $this->request->data;\n\t }\n\t \n\t //check if product ID was provided\n\t if (!empty($data['id'])) {\n\t \n\t //set the product ID to update\n\t $this->Player->id = $data['id'];\n\t if ($this->Player->save($data)) {\n\t $response = array('status'=>'success','message'=>'Product successfully updated');\n\t } else {\n\t $response['message'] = \"Failed to update product\";\n\t }\n\t } else {\n\t $response['message'] = 'Please provide product ID';\n\t }\n\t }\n\t \n\t $this->response->type('application/json');\n\t $this->response->body(json_encode($response));\n\n\t return $this->response->send();\n\t}", "public function update(Request $request, $id)\n {\n //validate incoming request\n $request->validate([\n 'name' => 'string|max:100|nullable',\n 'picture' => 'max:2000|mimes:jpeg,jpg,png,svg|nullable', //max size 2mb,\n 'total' => 'integer|min:0|nullable', //value must be > 0\n 'selling_price' => 'numeric|min:0|nullable',\n 'cost_price' => 'numeric|min:0|nullable',\n 'category_id' => 'integer|nullable'\n ]);\n\n try {\n $product = Auth::user()->store->product()->findorFail($id);\n } catch (ModelNotFoundException $e) {\n return response()->json([\n \"message\" => \"Forbidden\"\n ], 403);\n }\n\n //if category id isnt null\n if ($category_id = $request->category_id) {\n if (!$this->isCategoryIdValid($category_id))\n return response()->json([\n \"message\" => \"Category Id is not valid\"\n ], 422);\n else\n $product->category_id = $request->category_id;\n }\n\n //if uploaded file exist\n if ($picture = $request->file(\"picture\")) {\n //if product already has logo\n if ($product->picture)\n Storage::delete(Product::$PICTURE_PATH . \"/\" . $product->picture);\n\n $picture_path = $picture->store(Product::$PICTURE_PATH);\n //remove folder name from path\n $product->picture = str_replace(Product::$PICTURE_PATH . \"/\", '', $picture_path);\n }\n\n $this->renewProduct($product, $request);\n $product->save();\n return response()->json(new ProductResource($product), 200);\n }", "public function update(Request $request, $id)\n {\n $request->validate([\n 'name' => 'required | min:3 | string',\n 'type' => 'required',\n 'producer' => 'required',\n 'image' => 'image | mimes:png,jpg,jpeg',\n 'price_input' => 'required | numeric | min:0 | max:300000000',\n 'promotion_price' => 'required | numeric | max:300000000',\n 'description' => 'required | string',\n\n ]);\n $product = Product::withTrashed()->findOrfail($id);\n $product->name = $request->name;\n $product->id_type = $request->type;\n $product->id_producer = $request->producer;\n\n $product->amount = $request->amount;\n if (request('image')) {\n $product->image = base64_encode(file_get_contents($request->file('image')->getRealPath()));\n }\n\n $product->price_input = $request->price_input;\n\n if ( $request->promotion_price >= 0 && $request->promotion_price < $product->price_input) {\n $product->promotion_price = $request->promotion_price;\n }else{\n return back()->with('error', '\n Do not enter a negative number');\n }\n $product->new = $request->new;\n\n $product->description = $request->description;\n\n $product->save();\n $product->size()->sync(request('size'));\n\n return redirect()->route('product.index')->with('success', 'Product Updated successfully');\n }", "public function update(Request $request, $id)\n {\n $product = Product::find($id);\n\n $product->name = $request->input('name');\n $product->description = $request->input('description');\n $product->lastPrice = $product->price !== $request->input('price') ? $product->price : NULL;\n $product->price = $request->input('price');\n\n if ($request->hasFile('image')) { \n $currentImg = $product->image;\n if ($currentImg) {\n Storage::delete('/public/' . $currentImg);\n }\n $image = $request->file('image'); \n $path = $image->store('images','public');\n $product->image = $path;\n };\n\n $product->save(); \n\n $product_promotions = $request->input('promotion');\n\n $product->promotions()->sync($product_promotions);\n\n return redirect()->route('admin.modify');\n }", "public static function updateImage($fileName, $imageId, $storage)\n {\n //Get image name and storage location for image\n $image = Image::where('id', '=', $imageId)->first();\n\n //Delete old image\n ResourceHandler::delete($image->name, $image->storage);\n\n //Store the new image\n $image->name = $fileName;\n $image->storage = $storage;\n\n $image->save();\n }", "public function update($request, $id)\n {\n $this->checkExits($id);\n $data = $request->except(['_method','_token','photo']);\n\n if($request->photo)\n {\n try {\n $this->UploadFile($request);\n } catch (\\Exception $e) {\n //if has exception , don't has action\n }\n if ($this->img !== '') {\n $data['img'] = $this->img;\n }\n }\n\n $this->object->update($data);\n\n }", "public function updateProduct($request, $product)\n {\n $product->update($request->except(['_token', '_method', 'image']));\n if ($request->hasFile('image')) {\n $image = $request->file('image');\n $imageName = time() . '.' . $request->file('image')->extension();\n // $img = Image::make('public/foo.jpg');\n\n $image_resize = Image::make($image->getRealPath());\n $image_resize->resize(500, 500);\n $image_resize->save(public_path('images/') . $imageName, 100);\n $product->gallery = $imageName;\n $product->save();\n }\n $product->getTags()->sync($request->input('tags'));\n }" ]
[ "0.7425105", "0.70612276", "0.70558053", "0.6896673", "0.6582159", "0.64491373", "0.6346954", "0.62114537", "0.6145042", "0.6119944", "0.61128503", "0.6099993", "0.6087866", "0.6052593", "0.6018941", "0.60060275", "0.59715486", "0.5946516", "0.59400934", "0.59377414", "0.5890722", "0.5860816", "0.5855127", "0.5855127", "0.58513457", "0.5815068", "0.5806887", "0.57525045", "0.57525045", "0.57337505", "0.5723295", "0.5714311", "0.5694472", "0.5691319", "0.56879413", "0.5669989", "0.56565005", "0.56505877", "0.5646085", "0.5636683", "0.5633498", "0.5633378", "0.5632906", "0.5628826", "0.56196684", "0.5609126", "0.5601397", "0.55944353", "0.5582592", "0.5581908", "0.55813426", "0.5575312", "0.55717176", "0.55661047", "0.55624634", "0.55614686", "0.55608666", "0.55599797", "0.55599797", "0.55599797", "0.55599797", "0.55599797", "0.55573726", "0.5556878", "0.5554201", "0.5553069", "0.55530256", "0.5543788", "0.55435944", "0.55412996", "0.55393505", "0.55368495", "0.5535236", "0.5534954", "0.55237365", "0.5520468", "0.55163723", "0.55125296", "0.5511168", "0.5508345", "0.55072427", "0.5502385", "0.5502337", "0.5501029", "0.54995877", "0.54979175", "0.54949397", "0.54949397", "0.54946727", "0.5494196", "0.54941916", "0.54925025", "0.5491807", "0.5483321", "0.5479606", "0.5479408", "0.5478678", "0.54667485", "0.5463411", "0.5460588", "0.5458525" ]
0.0
-1
Remove the specified resource from storage.
public function destroy($id) { // try{ $this->model->deleteProduct($id); return redirect()->back()->with('message', 'Product has been deleted'); } catch(\Exception $e){ return response(["greska" => $e->getMessage()], 505); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete($resource){\n return $this->fetch($resource, self::DELETE);\n }", "public function destroy(Resource $resource)\n {\n //\n }", "public function removeResource($resourceID)\n\t\t{\n\t\t}", "public function unpublishResource(PersistentResource $resource)\n {\n $client = $this->getClient($this->name, $this->options);\n try {\n $client->delete(Path::fromString($this->getRelativePublicationPathAndFilename($resource)));\n } catch (FileDoesNotExistsException $exception) {\n }\n }", "public function deleteResource(&$resource) {\n\n if ($this->connector != null) {\n $this->logger->addDebug(\"Deleting Resource Node from Neo4J database\");\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id}}) detach delete a;\",\n [\n 'id' => $resource->getID()\n ]\n );\n $this->logger->addDebug(\"Updated neo4j to remove resource\");\n }\n\n }", "public function deleteShopifyResource() {\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'DELETE',\n ]);\n }", "public function deleteResource()\n {\n $database = new Database();\n $id = $this->_params['id'];\n $database->deleteResource($id);\n $this->_f3->reroute('/Admin');\n }", "protected function deleteResource($fileName, $storage)\n {\n if (Storage::disk($storage)->exists($fileName)) \n {\n return Storage::disk($storage)->delete($fileName);\n }\n }", "public function delete()\n {\n persistableCollection::getInstance($this->resourceName)->deleteObject($this);\n }", "public function remove()\n {\n $this->_getBackend()->remove($this->_id);\n }", "public function remove()\n {\n if (! ftruncate($this->fileHandle, 0)) {\n throw new StorageException(\"Could not truncate $this->path\");\n }\n if (! unlink($this->path)) {\n throw new StorageException(\"Could not delete $this->path\");\n }\n }", "public function delete()\n\t{\n\t\t$s3 = AWS::createClient('s3');\n $s3->deleteObject(\n array(\n 'Bucket' => $this->bucket,\n 'Key' => $this->location\n )\n );\n\t\tif($this->local_file && file_exists($this->local_file)) {\n\t\t\tunlink($this->local_file);\n\t\t}\n $this->local_file = null;\n\t}", "public function delete()\n\t{\n\t\tsfCore::db->query(\"DELETE FROM `swoosh_file_storage` WHERE `id`='%i';\", $this->id);\n\t\t$this->fFile->delete();\n\t}", "public function delete(): void\n {\n unlink($this->getPath());\n }", "public function delete()\n {\n if($this->exists())\n unlink($this->getPath());\n }", "public function remove($path);", "function deleteFileFromStorage($path)\n{\n unlink(public_path($path));\n}", "public function delete(): void\n {\n unlink($this->path);\n }", "private function destroyResource(DrydockResource $resource) {\n $blueprint = $resource->getBlueprint();\n $blueprint->destroyResource($resource);\n\n $resource\n ->setStatus(DrydockResourceStatus::STATUS_DESTROYED)\n ->save();\n }", "public static function delete($fileName, $storage)\n {\n if (Storage::disk($storage)->exists($fileName)) \n {\n return Storage::disk($storage)->delete($fileName);\n }\n }", "public function remove() {}", "public function remove() {}", "public function remove();", "public function remove();", "public function remove();", "public function remove();", "function delete_resource($resource_id, $page)\n\t{\n\t\t//get resource data\n\t\t$table = \"resource\";\n\t\t$where = \"resource_id = \".$resource_id;\n\t\t\n\t\t$this->db->where($where);\n\t\t$resource_query = $this->db->get($table);\n\t\t$resource_row = $resource_query->row();\n\t\t$resource_path = $this->resource_path;\n\t\t\n\t\t$image_name = $resource_row->resource_image_name;\n\t\t\n\t\t//delete any other uploaded image\n\t\t$this->file_model->delete_file($resource_path.\"\\\\\".$image_name, $this->resource_path);\n\t\t\n\t\t//delete any other uploaded thumbnail\n\t\t$this->file_model->delete_file($resource_path.\"\\\\thumbnail_\".$image_name, $this->resource_path);\n\t\t\n\t\tif($this->resource_model->delete_resource($resource_id))\n\t\t{\n\t\t\t$this->session->set_userdata('success_message', 'resource has been deleted');\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\t$this->session->set_userdata('error_message', 'resource could not be deleted');\n\t\t}\n\t\tredirect('resource/'.$page);\n\t}", "public function deleteImage(){\n\n\n Storage::delete($this->image);\n }", "public function del(string $resource): bool|string\n {\n $json = false;\n $fs = unserialize($_SESSION['rfe'][$this->getRoot()], ['allowed_classes' => false]);\n if (array_key_exists($resource, $fs)) {\n // if $item has children, delete all children too\n if (array_key_exists('dir', $fs[$resource])) {\n foreach ($fs as $key => $file) {\n if (isset($file['parId']) && $file['parId'] == $resource) {\n unset($fs[$key]);\n }\n }\n }\n unset($fs[$resource]);\n $_SESSION['rfe'][$this->getRoot()] = serialize($fs);\n $json = '[{\"msg\": \"item deleted\"}]';\n }\n return $json;\n }", "public function destroy()\n\t{\n\t\treturn unlink(self::filepath($this->name));\n\t}", "public function destroy($id) {\n $book = Book::find($id);\n // return unlink(storage_path(\"public/featured_images/\".$book->featured_image));\n Storage::delete(\"public/featured_images/\" . $book->featured_image);\n if ($book->delete()) {\n return $book;\n }\n\n }", "public function destroy($id)\n {\n Storageplace::findOrFail($id)->delete();\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 deleteResource(PersistentResource $resource)\n {\n $pathAndFilename = $this->getStoragePathAndFilenameByHash($resource->getSha1());\n if (!file_exists($pathAndFilename)) {\n return true;\n }\n if (unlink($pathAndFilename) === false) {\n return false;\n }\n Files::removeEmptyDirectoriesOnPath(dirname($pathAndFilename));\n return true;\n }", "public function deleteImage(){\n \tStorage::delete($this->image);\n }", "public function destroy()\n {\n $file=public_path(config('larapages.media.folder')).Input::all()['folder'].'/'.Input::all()['file'];\n if (!file_exists($file)) die('File not found '.$file);\n unlink($file);\n }", "public function delete() \r\n {\r\n if($this->exists())\r\n {\r\n unlink($this->fullName());\r\n }\r\n }", "public function destroy($id)\n {\n Myfile::find($id)->delete();\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 static function delete($path){\r\n $currentDir = getcwd();\r\n $storageSubPath = \"/../../\".STORAGE_PATH;\r\n $file = $currentDir . $storageSubPath . '/' . $path;\r\n\r\n unlink($file);\r\n }", "public function destroy(Storage $storage)\n {\n return redirect()->route('storages.index');\n }", "public function remove() {\n //Check if there are thumbs and delete files and db\n foreach ($this->thumbs()->get() as $thumb) {\n $thumb->remove();\n } \n //Delete the attachable itself only if is not default\n if (strpos($this->url, '/defaults/') === false) {\n Storage::disk('public')->delete($this->getPath());\n }\n parent::delete(); //Remove db record\n }", "public function removeFile($uri){\n return Storage::disk('public')->delete($uri);\n }", "public function destroy(Resource $resource)\n {\n if( $resource->delete() ){\n return Response(['status'=>'success','message'=>'Resource deleted']); \n } else {\n return Response(['status'=>'error', 'message'=>'Something went wrong']);\n }\n }", "public function delete($path);", "public function delete($path);", "public function destroy($id)\n { \n File::find($id)->remove();\n \n return redirect()->route('files.index');\n }", "public function destroy($id)\n {\n $supplier = Supplier::find($id);\n $photo = $supplier->photo;\n if ($photo) {\n unlink($photo);\n }\n $supplier->delete();\n }", "public function destroy($id)\n {\n $student = Student::where('id', $id)->first();\n // $path = $student->image;\n unlink($student->image);\n Student::findOrFail($id)->delete();\n return response('Deleted!');\n }", "public function destroy($id)\n {\n $icon = SliderIcon::find($id);\n if (Storage::disk('public')->exists(str_replace('storage', '', $icon->img))){\n Storage::disk('public')->delete(str_replace('storage', '', $icon->img));\n }\n $icon->delete();\n return redirect()->route('slider_icons.index')->with('success', 'Данные преимущества удалёны');\n }", "public function delete($path, $data = null);", "public function destroy($id)\n {\n $items=Items::find($id);\n // delete old file\n if ($items->photo) {\n $str=$items->photo;\n $pos = strpos($str,'/',1);\n $str = substr($str, $pos);\n $oldFile = storage_path('app\\public').$str;\n File::Delete($oldFile); \n }\n $items->delete();\n return redirect()->route('items.index');\n }", "public function destroy($id)\n {\n $carousel = Carousel::find($id);\n $image = $carousel->image;\n\n $basename ='img/carousel/' . basename($image);\n //Delete the file from disk\n if(file_exists($basename)){\n unlink($basename);\n }\n //With softDeletes, this is the way to permanently delete a record\n $carousel->delete();\n Session::flash('success','Product deleted permanently');\n return redirect()->back();\n }", "public function remove()\n {\n $fs = new Filesystem();\n $fs->remove($this->dir());\n }", "public static function destroy(int $resource_id)\n {\n try {\n $image_data = ListingImage::where('id', $resource_id)->first();\n self::delete_image($image_data->name);\n $delete = ListingImage::where('id', $resource_id)->delete();\n\n // activity()\n // ->causedBy(Auth::user()->id)\n // ->performedOn($delete)\n // ->withProperties(['id' => $delete->id])\n // ->log('listing image deleted');\n return response()->json(['status'=> 'ok', 'msg'=> 'Data deleted successfully']);\n } catch (Exception $e) {\n $e->getMessage();\n }\n }", "public function destroy(Storage $storage)\n {\n $this->storage->destroy($storage);\n\n return redirect()->route('admin.product.storage.index')\n ->withSuccess(trans('core::core.messages.resource deleted', ['name' => trans('product::storages.title.storages')]));\n }", "public function del($path){\n\t\treturn $this->remove($path);\n\t}", "public function destroy($id)\n {\n //\n $product = Product::findOrFail($id);\n $product->delete();\n if($product->img != 'product-default.png'){\n Storage::delete(\"public/uploads/\".$product->img);\n // return 'deleted';\n }\n return redirect()->route('product.index'); \n }", "public function removeUpload()\n{\n if ($file = $this->getAbsolutePath()) {\n unlink($file); \n }\n}", "public function destroy($id)\n {\n $image = Images::withTrashed()->find($id);\n\n Storage::disk('uploads')->delete(\"social-media/$image->filename\");\n\n $image->tags()->detach();\n $image->detachMedia(config('constants.media_tags'));\n $image->forceDelete();\n\n return redirect()->back()->with('success', 'The image was successfully deleted');\n }", "public function destroyByResourceId($resource_id)\n {\n// $online_party = $this->onlinetrack->where('resource_id', $resource_id)->get()->first();\n// $online_party->status = \"offline\";\n// $online_party->save();\n// return $online_party;\n return $this->onlinetrack->where('resource_id', $resource_id)->delete();\n }", "public function revoke($resource, $permission = null);", "public function destroy($id)\n {\n $data=Image::find($id);\n $image = $data->img;\n\n\n $filepath= public_path('images/');\n $imagepath = $filepath.$image;\n\n //dd($old_image);\n if (file_exists($imagepath)) {\n @unlink($imagepath);\n }\n\n\n $data->delete();\n\n return redirect()->route('image.index');\n }", "function delete($path);", "public function removeItem(int $id)\n\t{\n\t\t$this->storage->remove($id);\n\t}", "public function destroy(File $file)\n {\n //\n $v = Storage::delete($file->path);\n \n }", "public function destroyResource($resource)\n {\n if (!is_object($resource)) {\n return false;\n }\n\n $resource_type = get_class($resource);\n $resource_id = $resource->getKey();\n\n return Role::where('resource_type', $resource_type)\n ->where('resource_id', $resource_id)\n ->delete();\n }", "public function remove($filePath){\n return Storage::delete($filePath);\n }", "public function remove(): void\n {\n $file = $this->getAbsolutePath();\n if (!is_file($file) || !file_exists($file)) {\n return;\n }\n\n unlink($file);\n }", "public function destroy(Request $request, Storage $storage)\n {\n $storage->delete();\n $request->session()->flash('alert-success', 'Запись успешно удалена!');\n return redirect()->route('storage.index');\n }", "public function remove(Storable $entity): Storable\n {\n $this->getRepository(get_class($entity))->remove($entity);\n $this->detach($entity);\n\n return $entity;\n }", "public function processDeletedResource(EntityResource $resource)\n {\n /** @var AuthorizationRepository $repository */\n $repository = $this->entityManager->getRepository('Edweld\\AclBundle\\Entity\\Authorization');\n\n $repository->removeAuthorizationsForResource($resource);\n }", "function _unlink($resource, $exp_time = null)\n {\n if(file_exists($resource)) {\n return parent::_unlink($resource, $exp_time);\n }\n\n // file wasn't found, so it must be gone.\n return true;\n }", "public function remove($id);", "public function remove($id);", "public function deleted(Storage $storage)\n {\n //\n }", "public function destroy($id)\n {\n $data = Product::findOrFail($id);\n\n if(file_exists('uploads/product/'.$data->image1)){\n unlink('uploads/product/'.$data->image1);\n }\n\n if(file_exists('uploads/product/'.$data->image2)){\n unlink('uploads/product/'.$data->image2);\n }\n\n if(file_exists('uploads/product/'.$data->image3)){\n unlink('uploads/product/'.$data->image3);\n }\n $data->delete();\n }", "public function removeUpload()\n {\n $file = $this->getAbsolutePath();\n if ($file) {\n unlink($file);\n }\n }", "public function resources_delete($resource_id, Request $request) {\n if ($resource_id) {\n $resp = Resources::where('id', '=', $resource_id)->delete();\n if($resp){\n $msg = 'Resource has been deleted successfully.';\n $request->session()->flash('message', $msg);\n }\n }\n //return redirect()->route('admin-factor-list');\n return redirect()->to($_SERVER['HTTP_REFERER']);\n }", "public function delete()\n {\n try\n {\n $thumbnail = $this->getThumbnail();\n if($thumbnail)\n {\n $thumbnail->delete();\n }\n }\n catch(sfException $e){}\n \n // delete current file\n parent::delete();\n }", "function deleteResource($uuid){\n $data = callAPI(\"DELETE\",\"/urest/v1/resource/\".$uuid);\n return $data;\n}", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function remove_resource($idproject){\n\t\t\n\t\t// Load model and try to get project data\n\t\t$this->load->model('Projects_model', 'projects');\n\t\t\n\t\t// Update\n\t\t$this->projects->save_project(array(\"ext\" => \"\", \"vzaar_idvideo\" => \"0\", \"vzaar_processed\" => \"0\"), $idproject);\n\t}", "public function destroy($id){\n $file_data = Slider::findOrFail($id);\n File::delete(public_path('../storage/app/public/sliders/'.$file_data->path));\n $slider = Slider::destroy($id);\n return response()->json(null, 204);\n }", "public function delete()\n\t{\n\t\t@unlink($this->get_filepath());\n\t\t@unlink($this->get_filepath(true));\n\t\tparent::delete();\n\t}", "public function delete($resource_path, array $variables = array()) {\n return $this->call($resource_path, $variables, 'DELETE');\n }", "public function destroy($id)\n {\n //Find Slider With Id\n $slider = Slider::findOrFail($id);\n // Check If The Image Exist\n if(file_exists('uploads/slider/'.$slider->image)){\n\n unlink( 'uploads/slider/'.$slider->image);\n }\n $slider->delete();\n return redirect()->back()->with('success','Slider Successfully Deleted');\n }" ]
[ "0.6672584", "0.6659381", "0.6635911", "0.6632799", "0.6626075", "0.65424126", "0.65416265", "0.64648265", "0.62882507", "0.6175931", "0.6129922", "0.60893893", "0.6054415", "0.60428125", "0.60064924", "0.59337646", "0.5930772", "0.59199584", "0.5919811", "0.5904504", "0.5897263", "0.58962846", "0.58951396", "0.58951396", "0.58951396", "0.58951396", "0.5880124", "0.58690923", "0.5863659", "0.5809161", "0.57735413", "0.5760811", "0.5753559", "0.57492644", "0.5741712", "0.57334286", "0.5726379", "0.57144034", "0.57096", "0.5707689", "0.5705895", "0.5705634", "0.5703902", "0.5696585", "0.5684331", "0.5684331", "0.56780374", "0.5677111", "0.5657287", "0.5648262", "0.5648085", "0.5648012", "0.5640759", "0.5637738", "0.5629985", "0.5619264", "0.56167465", "0.5606877", "0.56021434", "0.5601949", "0.55992156", "0.5598557", "0.55897516", "0.5581397", "0.5566926", "0.5566796", "0.55642897", "0.55641", "0.5556583", "0.5556536", "0.5550097", "0.5543172", "0.55422723", "0.5540013", "0.5540013", "0.55371785", "0.55365825", "0.55300397", "0.552969", "0.55275744", "0.55272335", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.5525997", "0.5525624", "0.5523911", "0.5521122", "0.5517412" ]
0.0
-1
/ private $host = "localhost"; private $user = "mysql"; private $pass = "mysql"; private $dbname = "bwt";
public static function DB() { if (!isset(self::$instance)){ //self::$db = new Model; self::$instance = new self; } return self::$instance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function DB($dbname='MichelinClassroomDB', $host='localhost',$user='root', $password='console')\r\n\t{\r\n\t\t$this->user=$user;\r\n\t\t$this->password=$password;\r\n\t\t$this->host=$host;\r\n\t\t$this->dbname=$dbname;\r\n\t}", "function Database()\n {\n\t\t$config = new Config();\n\n\t\t$this->host = $config->host;\n\t\t$this->user = $config->user;\n\t\t$this->password = $config->password;\n\t\t$this->database = $config->database;\n \t\n\t}", "function __construct(){ //fungsi yang digunakan untuk menginisialisasikan database yang digunakan\n\t\t$this->host=\"localhost\"; // variabel host diisi localhost\n\t\t$this->user=\"root\"; // variabel user diisi root\n\t\t$this->pass=\"\"; // variabel pass diisi kosong\n\t\t$this->database=\"manajemen_skripsi_prpl\"; // variabel diisi database yang digunakan yang ada dalam sever localhost yaitu manajemen_skripsi_prpl\n\t}", "function __construct() {\n $this->data['driver'] = 'mysql';\n $this->data['host'] = \"localhost\";\n $this->data['dbname'] = 'mydb';\n $this->data['username'] = 'root';\n $this->data['password'] = '';\n }", "function __construct() {\n\n $this->dbserver = \"MYSQL5005.Smarterasp.net\";\n $this->username = \"9b0406_fm\";\n $this->password = \"vasusubramaniyam\";\n $this->dbname = \"db_9b0406_fm\";\n }", "function DB($host = 'localhost',$user = 'root',$password = '',$database = 'bbman') // PHP4 class constructor\n\t{\n\t\t$this->host = gethostbyname($host); // change hostname to an ip address\n\t\t$this->user = $user;\n\t\t$this->password = $password;\n\t\t$this->database = $database;\n\t}", "function db($host,$user,$pass) //milsoft\r\n\t\t{\r\n\t\t\t$this->$host = $this->set_host($host);\r\n\t\t\t$this->$user = $this->set_user($user);\r\n\t\t\t$this->$pass = $this->set_pass($pass);\r\n\t\t\t$this->connect();\r\n\t\t}", "function __construct(){\n\t\t\n\t\t\t$this-> host = 'localhost';\n\t\t\t$this -> user = 'root';\n\t\t\t$this -> pass = 'root';\n\t\t\t$this -> db = 'cc409_perros';\n\t\t\n\t\t}", "public function __construct() {\n\t$this->database_server = \" \";\n\t$this->database_name = \" \";\n\t$this->database_user = \" \";\n\t$this->database_password = \" \";\n }", "function database()\n\t{\n\t\t$this->host = DB_HOST;\n\t\t$this->user = DB_USER;\n\t\t$this->password = DB_PASS;\n\t\t$this->database = DB_NAME;\n\t\t\n\t\t$this->connect();\n\t}", "function pdoe_mysql_test_db_credentials() {\n\treturn array( \n\t\t'user' => 'pdoe', \n\t\t'password' => 'moomoo', \n\t\t'host' => 'localhost', \n\t\t'database' => 'pdoe_test'\n\t);\n}", "function __construct()\r\n {\r\n $this->host = \"10.67.254.101\"; \r\n $this->user = \"root\";\r\n $this->passwd = \"root\";\t\t\r\n $this->schema = \"wjdb\";\r\n $this->result = false; \r\n }", "function database( $dbuser, $dbpass, $dbname, $dbhost='localhost' ) {\r\n\t\t \r\n\t\t$this->dbuser = $dbuser;\r\n\t\t$this->dbpass = $dbpass;\r\n\t\t$this->dbname = $dbname;\r\n\t\t$this->dbhost = $dbhost;\r\n\t\terror_reporting(1);\r\n\t\t\r\n\t}", "function setDatabaseConnection($host,$database,$user,$pass);", "function __construct() {\n // We'll just hardcode this in. In a real application situation use\n // an external file\n $this->host = 'localhost';\n $this->username = 'PHPSCRIPT';\n $this->password = '1234';\n $this->dbName = 'cst8257';\n $this->port = 3306; // Default\n //$this->port = 3307; // Custom Port\n }", "function DBConfiguraion()\n\t{\n\t\tglobal $dbhost,$dbmain,$dbuser,$dbpwd;//these variables comes from \"mainconfig.php\" which is in www folder\n\t\t//print\"$dbmain,$dbuser,$dbpwd\";\n\t\t//initialize the database_server\n\t\t$this->database_server = $dbhost;\n\t\t//initialize the database_password \n\t\t$this->database_password = $dbpwd;\n\t\t//initialize the database_user \n\t\t$this->database_user = $dbuser;\n\t\t//initialize the database_name \n\t\t$this->database_name = $dbmain;\n\t}", "public function Database() {\r\n\r\n $this->hostname = \"localhost\";\r\n $this->database = \"skynet\";\r\n $this->user = \"root\";\r\n $this->pass = \"\";\r\n $this->connect();\r\n\r\n }", "function mysql () {\n\t/* public: connection parameters */\n\t\t$this->connect();\n\t}", "function __construct()\n {\n $this->_dbh = new PDO(\"mysql:host=hostname;dbname=your_database_name\", \"username\", \"password\");\n }", "function dbConnect () {\n\t$con = mysql_connect($this -> host, $this -> user, $this -> pass);\n mysql_select_db($this->dbname,$con);\n\t}", "public function __construct() {\n// $this->db['server'] = $args['server'];\n// $this->db['username'] = $args['username'];\n// $this->db['password'] = $args['password'];\n// $this->db['database'] = $args['database'];\n $this->open_connection();\n }", "function Dbase_connect() {\n\tglobal $db, $db_host, $db_user, $db_password;\n\t$db=mysql_connect( $db_host, $db_user, $db_password );\n}", "public function DB($host = \"\", \r\n\t $username = \"\", \r\n\t $password = \"\", \r\n\t $squema = \"\") {\r\n\r\n\t\t$this->host = empty($host) ? \"localhost\" : $host;\r\n\t\t$this->username = empty($username) ? \"root\" : $username;\r\n\t\t$this->password = empty($password) ? \"root\" : $password;\r\n\t\t$this->squema = empty($squema) ? \"test\" : $squema;\r\n\t}", "function __construct( $host = 'localhost', $user = 'root', $pass = '123456', $name = 'teste', $table = 'emails' ) {\n $this->dbhost = $host;\n $this->dbuser = $user;\n $this->dbpass = $pass;\n $this->dbname = $name;\n $this->dbtable = $table;\n }", "function __construct() {\r\n// \t\t$this->connection = mysql_connect($this->host,$this->username,$this->password,$this->dbname);\r\n// echo $this->host + \"zxdgfzxfg\";\r\n// echo \"mysql:host=\".$this->host.\";dbname=\".$this->dbname.\";charset=utf8\";\r\n// \t\t$this->connection = new PDO(\"mysql:host=\".$this->host.\";dbname=\".$this->dbname.\";charset=utf8\", $this->username, $this->password, $this->options);\r\n\t\t$this->connection = mysqli_connect($this->host,$this->username,$this->password,$this->dbname);\r\n\t}", "public function __construct($host, $dbName, $username, $password, $driver = 'mysql', $charset = 'utf8');", "function __construct() {\n $this->db = new PDO('mysql:host='. getenv('IP') . ';dbname=blog', getenv('C9_USER'), ''); \n }", "function getDatabase() {\n//override these params\n\t$host = \"localhost\";\n\t$user = \"sistemasmysql\";\n\t$password = \"17sistemassql06\";\n\t$database_name = \"reservas_disilab\";\n\t\n\t\n\treturn new MySqlDB($host, $user, $password, $database_name);\n}", "public function __construct() {\n\t\t$this->_dbhost\t\t= \"alexandrgmsperso.mysql.db\";\n\t\t$this->_dbname\t\t= \"alexandrgmsperso\";\n\t\t$this->_dbusername\t= \"alexandrgmsperso\";\n\t\t$this->_dbpassword\t= \"Alexandre2007\";\n\t\t$this->startConnection();\n\t}", "private function __construct()\n\t{\n\t $this->DBH = new PDO(\"mysql:host=\".HOSTNAME.\";dbname=\".DBNAME, USERNAME, PASSWORD);\n\t}", "function DB() {\r\n \t\t$this->dbh = new Mysql_db;\r\n\t}", "function db()\n\t{\n\t\tglobal $dbhost, $dbuser, $dbpass, $dbname;\n\t\t$this->db_server_link = @mysql_connect($dbhost, $dbuser, $dbpass);\n\t\tmysql_select_db($dbname, $this->db_server_link) ;\n\t}", "public function __construct(){\n\n $this->conn = new PDO(\"mysql:host=\".$this->host.\";dbname=\".$this->db,$this->user,$this->pass);\n }", "function getDBsettings () {\r\n return array (\r\n 'DBserver' => \"localhost\",\r\n 'DBname' => \"wideworldimporters\",\r\n 'DBport' => 3306,\r\n\r\n 'DBuser' => \"wwi\",\r\n 'DBpass' => ''\r\n );\r\n}", "function __construct()\n {\n parent::__construct(\"mysql:host=127.0.0.1;dbname=sondcatalog\",\"root\",\"\");\n $this->strmysql=\"?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?\";\n }", "public function __construct($_host='localhost',$_dbname='sakila',$_username='root',$_password='')\n\t{\n\t\t\n\t\t$this->host = $_host;\n\t\t$this->dbname = $_dbname;\n\t\t$this->username = $_username;\n\t\t$this->password = $_password;\n\t\t$this->PDO_connect();\n\t}", "public function __construct(){\n\t\t\t$this->dsn = 'mysql:host=localhost;dbname=renova';\n\t\t\t$this->username = 'root';\n\t\t\t$this->password ='';\n\t\t\t$this->connection();\n\n\t\t}", "public function __construct() {\n\n //connecting to the databse using php data objects \n\t$this -> conn = new PDO(\"mysql:host=\".$this -> host.\";dbname=\".$this -> db, $this -> user, $this -> pass);\n\n}", "function sql(){\r\n\t\t$this->conn = mysql_connect($this->hostname, $this->username , $this->password);\r\n\t\tmysql_select_db($this->dbName, $this->conn);\r\n}", "function __construct() {\r\n try {\r\n $db_host = DB_HOST;\r\n $db_name = DB_NAME;\r\n $db_user = DB_USER;\r\n $db_pass = DB_PASS;\r\n $this->db = new PDO(\"mysql:host=$db_host;dbname=$db_name\", $db_user, $db_pass);\r\n } catch (PDOException $e){\r\n echo \"Connection Failed \" . $e->getMessage();\r\n }\r\n }", "private function __construct() {\n $this->config = array(\n // These will all need to be changed to point at your mysql server.\n \"Database\" => array(\n \"Host\" => \"localhost\",\n \"Name\" => \"daeman\",\n \"Username\" => \"daeman\",\n \"Password\" => \"<password>\",\n ),\n );\n }", "function __construct()\n\t{\n\t\t$this->connect = new PDO(\"mysql:servername=localhost;dbname=lab2;charset=utf8\", \"root\", \"\");\n\t}", "function ManejoBD(){\n\t\t$this->BaseDatos = \"instituto\"; # aignar valor a la propiedad $BaseDatos\n\t\t$this->Servidor = \"localhost\"; # aignar valor a la propiedad $Servidor\n\t\t$this->Usuario = \"root\"; # aignar valor a la propiedad $Usuario\n\t\t$this->Clave = \"123456\"; # aignar valor a la propiedad $Clave\n\t}", "function db($dbuser='', $dbpassword='', $dbname='', $dbhost='localhost', $dbmaster=false) {\n\t\t\t$this->dbuser = $dbuser;\n\t\t\t$this->dbpassword = $dbpassword;\n\t\t\t$this->dbname = $dbname;\n\t\t\t$this->dbhost = $dbhost;\n\t\t\t$this->dbmaster = $dbmaster;\n\t\t\tif ( $dbmaster && $dbmaster != $dbhost ) {\n\t\t\t\t$this->dbmaster = $dbmaster;\n\t\t\t} else {\n\t\t\t\t$this->dbmaster = false;\n\t\t\t}\n\t\t}", "public function __construct()\n {\n $this->username = 'dorguz';\n $this->pwd = 'dorguz123';\n $this->db = 'starRatingSystem';\n $this->host = 'localhost';\n\n $this->connectionType = 'mysqli';\n $this->salt = 'takeThisWith@PinchOfSalt';\n\n }", "function mysql_con ($database, $login = '', $password = '', $host = '') {\n\t\t$this->con = false;\n\t\t$this->host = $host;\n\t\t$this->database = $database;\n\t\t$this->login = $login;\n\t\t$this->password = $password;\n\t}", "function __construct () {\n $lines = file('../../dbinfo.txt');\n\t $dbserver = trim($lines[0]);\n\t $uid = trim($lines[1]);\n\t $pw = trim($lines[2]);\n\t $dbname = trim($lines[3]);\n \n //Connect to the mysql server and get back our link_identifier\n $link = mysqli_connect($dbserver, $uid, $pw, $dbname)\n \t\t\tor die('Could not connect: ' . mysqli_error($link));\n $this->link = $link;\n }", "private function __construct()\n {\n $this->conn = new PDO(\"mysql:host={$this->host};\n dbname={$this->name}\", $this->user,$this->pass, $this->opt);\n }", "public function __construct() {\n// $this->dbconn = new PDO($dbURI, $_ENV['USER'], $_ENV['PASS']);\n\n $dbURI = 'mysql:host=' . 'localhost'.';port=3307;dbname=' . 'proj2';\n $this->dbconn = new PDO($dbURI, 'root', '');\n $this->dbconn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n }", "public function __construct(){\n $this->dbh = new PDO('mysql:dbname=test;host=localhost','root','admin');\n\n }", "function connexionDb()\n{\n $confDb = getConfigFile()['DATABASE'];\n\n\n $type = $confDb['type'];\n $host = $confDb['host'];\n $servername = \"$type:host=$host\";\n $username = $confDb['username'];\n $password = $confDb['password'];\n $dbname = $confDb['dbname'];\n\n $db = new PDO(\"$servername;dbname=$dbname\", $username, $password);\n return $db;\n}", "function connectdb() {\n define('host', 'localhost:3306');\n define('user', 'root');\n define('password', 'hydra_1x');\n define('database', 'test');\n $host = host;\n $user = user;\n $password = password;\n $database = database;\n $db = new mysqli(host,user,password,database);\n // // die(DB_DATABASE);\n if (mysqli_connect_error()) {\n die('Connect Error ('.mysqli_connect_errno().') '.mysqli_connect_error());\n }\n}", "public function Database(){\n\t\t$dbhost = 'localhost';\n\t\t$dbuser = 'root';\n\t\t$dbpass = '';\n\t\t$dbname = 'voting';\n\n\t\t$this->conn = mysqli_connect($dbhost, $dbuser, $dbpass,$dbname) or die(\"Connection Error\");\n\t}", "function db_connect ()\n {\n $dbh = new PDO(\"mysql:host=64.59.233.245;dbname=chadd_test\", // chadd_a1\n \"CLASS_EXAMPLE_RO\", \"CS445!@#\");\n\t\t $dbh->setAttribute (PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n\t\n return ($dbh);\n }", "public function __construct()\n {\n $cred = getDbCredentials();\n $dbhost = $cred['dbhost']; \n $dbuser = $cred['dbuser'];\n $dbname = $cred['dbname'];\n $dbpass = $cred['dbpass']; \n $conn = null;\n try{\n $conn = new PDO(\"mysql:host=$dbhost; dbname=$dbname\", $dbuser, $dbpass);\n $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n }catch(PDOException $ex){\n echo \"Connection failed: \".$ex->getMessage();\n }\n \n $this->connection = $conn;\n }", "function accedi_db() {\n include(\"db.conf.php\");\n $db = mysql_connect($db_host, $db_user, $db_pass);\n mysql_select_db($db_name, $db);\n }", "public function __construct() {\n// $this->dbconn = new PDO($dbURI, $_ENV['USER'], $_ENV['PASS']);\n\n $dbURI = 'mysql:host=' . 'localhost'.';port=3307;dbname=' . 'proj2';\n $this->dbconn = new PDO($dbURI, 'root', '');\n $this->dbconn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n }", "public function __construct() {\n// $this->dbconn = new PDO($dbURI, $_ENV['USER'], $_ENV['PASS']);\n\n $dbURI = 'mysql:host=' . 'localhost'.';port=3307;dbname=' . 'proj2';\n $this->dbconn = new PDO($dbURI, 'root', '');\n $this->dbconn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n }", "public function __construct(){\n $this->serverName = serverName;\n $this->userName = userName;\n $this->password = password;\n $this->dbName = dbName;\n $this->tableName = tableName;\n }", "public function __construct() {\n $dsn = \"mysql:host=\".Configuration::DATABASE_HOST.\";dbname=\".Configuration::DATABASE_NAME;\n self::connect($dsn, Configuration::DATABASE_USER, Configuration::DATABASE_PASSWORD);\n }", "public function __construct($dbuser, $dbpassword, $dbname, $dbhost)\n {\n }", "public function __construct()\n {\n $dbhost = 'localhost';\n $dbuser = 'root';\n $dbpass = '';\n $dbname = 'Northwind';\n \n mysql_connect('dbhost', 'dbuser', 'dbpass');\n \n mysql_select_db($dbname);\n }", "function projectDb() {\n $mysql_credentials_project = [\n 'host' => '127.0.0.1',\n 'user' => 'root',\n 'password' => 'Qwertyuiop0987654321',\n 'database' => 'truck',\n ];\n\n //Create database connection\n $dblink = new mysqli($mysql_credentials_project['host'], $mysql_credentials_project['user'], $mysql_credentials_project['password'], $mysql_credentials_project['database']);\n $dblink -> set_charset(\"utf8\");\n\n //Check connection was successful\n if ($dblink->connect_errno) {\n printf(\"Failed to connect to database\");\n exit();\n }\n\n return $dblink;\n}", "private function connect(){\n\t\trequire (__DIR__ . '/../../config.php');\n\t\t$mysqlCFG =$database['mysql'];\n\t\t\n\t\tif(!self::$db){\n\t\t\t$connectionString = \"mysql:host=$mysqlCFG[host];dbname=$mysqlCFG[dbname]\";\n\t\t\ttry{\n\t\t\t\tself::$db = new \\PDO($connectionString, $mysqlCFG['user'], $mysqlCFG['password']);\n\t\t\t\tself::$db->setAttribute( \\PDO::ATTR_ERRMODE, \\PDO::ERRMODE_EXCEPTION);\n\t\t\t}catch(\\PDOException $e){\n\t\t\t\tdie(\"Ocurrio un error al conectar con la base de datos: $e->getMessage()\");\n\t\t\t}\n\t\t}\n\t\t\n\t}", "function __construct() {\n $db_name = 'n8598177';\n $db_username = 'n8598177';\n $db_password = 'Em003080#77';\n $db_host = \"fastapps04.qut.edu.au\";\n\n\n try {\n $pdo = new PDO (\"mysql:host=$db_host;dbname=$db_name\", $db_username, $db_password);\n } catch (PDOException $e) {\n echo $e;\n exit();\n }\n\n // Attaches the PDO to the object\n $this->db = $pdo;\n return $this->db;\n }", "function setDBHost($host,$user,$dbpwd)\n {\n $this->dbhost = $host;\n $this->dbuser = $user;\n $this->dbpwd = $dbpwd;\n }", "function __construct()\n {\n /** Setting parametrs of Database */\n $this->config = array(\n 'host' => 'db', //value overridden in models/DB.php\n 'dbname' => 'local',\n 'username' => 'local',\n 'password' => 'local');\n }", "function __construct(){\n // Make connection to database\n $this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());\n mysql_select_db(DB_NAME, $this->connection) or die(mysql_error());\n \n }", "function getConnection(){\n\t$server = \"localhost\";\n\t$username = getenv(\"BUILDERS_USERNAME\");\n\t$password = getenv(\"BUILDERS_PASSWORD\");\n\t$database = \"BUILDERS_ASSOCIATION\";\n\n\t$connection=new PDO(\"mysql:host=$server;dbname=$database\", $username, $password);\n\t$connection->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);\n\treturn $connection;\n}", "function __construct(){\n $this->db = new PDO('mysql:host=localhost;'.'dbname=inventario2;charset=utf8', 'root', '');\n }", "function __construct(){ // default params\n $this->name='root';\n $this->pass='';\n $this->host='localhost';\n $this->db='comment_db';\n $this->del=0;\n $this->stop=0;\n }", "function config()\r{\r\t\t\r\t$con=mysql_connect('localhost','username','');\t//removed Username & Password for security.\r\t\r\t\r\t \r\tif (!$con){\r\t\tdie('Could not connect: ' . mysql_error());\r\t}\r\r\t//Selecting Database\r\t$db_selected=mysql_select_db('dbname',$con); //removed DBname for security.\r\t\r\t\r\t//returning Connection Object\r\treturn $db_selected;\r}", "function DbInit(&$Host, &$Database, &$User, &$Password)\n\t{\n \t\t$Host = \"localhost\";\t\t// Hostname of our MySQL server.\n \t\t$Database = \"phpmysqlsite\";\t\t// Logical database name on that server.\n \t\t$User = \"phpuser\";\t\t\t// User und Password for database access.\n\t\t$Password = \"phppass\";\n\t}", "public function __construct($dbname,$dbuser,$dbpass,$dbhost){\n \t//or die('No se ha podido conectar: ' . pg_last_error());\n\t\t$mvc_bd_conexion = mysql_connect($dbhost, $dbuser, $dbpass);\n\n\t\tif (!$mvc_bd_conexion) {\n\t\t\tdie('No ha sido posible realizar la conexión con la base de datos: ' . mysql_error());\n\t\t}\n\t\tmysql_select_db($dbname, $mvc_bd_conexion);\n\n\t\tmysql_set_charset('utf8');\n\n\t\t$this->conexion = $mvc_bd_conexion;\n }", "function getDB(){\r\n //return new mysqli(\"localhost\", \"root\", \"root\", \"biketime\");\r\n return new mysqli(\"173.194.225.113\", \"root\", \"helloworld\", \"biketime\");\r\n\r\n}", "function bbconn($host, $port, $dbname, $dbuser, $dbpass, $prefix, $dbtype='mysql') {\n\tif (preg_match('/mysql/i', $dbtype)) {\n\t\tif (!empty($port)) $host = $host .':'. $port;\n\t\tif (!($conn = mysql_connect($host, $dbuser, $dbpass))) {\n\t\t\tseterr('Unable to connect to the source forum\\'s MySQL database.');\n\t\t}\n\t\tdefine('dbtype', 'mysql');\n\t\tdefine('dbpref', $dbname .'.'. $prefix);\n\t\tdefine('dbconn', $conn);\n\t} else if (preg_match('/pgsql/i', $dbtype) || preg_match('/postgres/i', $dbtype)) {\n\t\t$dsn = 'host='. $host .' dbname='. $dbname .' user='. $dbuser .' password='. $dbpass;\n\t\tif (!empty($port)) $dsn .= ' port='. $port;\n\t\tif (!($conn = pg_connect($dsn))) {\n\t\t\tseterr('Unable to connect to the source forum\\'s PostgreSQL database.');\n\t\t}\n\t\tdefine('dbtype', 'pgsql');\n\t\tdefine('dbpref', $prefix);\n\t\tdefine('dbconn', $conn);\n\t} else if (preg_match('/sqlite/i', $dbtype)) {\n\t\tclass db2 { public static $db; }\n\t\t$dsn = 'sqlite:'. $host;\t// NOTE: May need to change this to 'sqlite2:' (for older v2 databases).\n\t\ttry {\n\t\t\tdb2::$db = new PDO($dsn, $dbuser, $dbpass);\n\t\t} catch (PDOException $e) {\n\t\t\tseterr('Unable to connect to the source forum\\'s SQLite database: '. $e->getMessage());\n\t\t}\n\t\tdefine('dbtype', 'sqlite');\n\t\tdefine('dbpref', $prefix);\n\t} else {\n\t\tseterr('Unsupported database type ['. $dbtype .']');\n\t}\n\tpf('... connected to '. $dbtype .' database '. $dbuser .'@'. $dbname);\n}", "public function connect_db() {\n }", "function db_setup()\n\t{\n\t\t$connection=mysql_pconnect(\"localhost\",\"xdf\",\"xdf379\");\n\t\tmysql_select_db(\"xdf\",$connection);\n\t\treturn $connection;\n\t}", "public function __construct()\n {\n $this->host = 'localhost';\n $this->username = 'root';\n $this->pass = '';\n $this->db = 'db_mvc';\n $this->pdo = NULL;\n $this->createConnection();\n }", "function __construct(){\n\t $host = \"localhost\";\n\t $user = \"cs130\";\n\t\t $pw = \"test\";\n\t\t $db = \"CS130\";\n $this->db_connection = mysql_connect($host, $user,$pw);\n mysql_select_db($db, $this->db_connection);\n if(!$this->db_connection)\n {\n $errmsg = mysql_error($this->db_connection);\n print \"Connection failed: $errmsg <br />\";\n exit(1);\n }\n }", "function __construct($host, $name, $login, $psw)\t{\n\t\t// Connection to DB : SERVEUR / LOGIN / PASSWORD / NOM_BDD\n\t\ttry {\n\t\t\t$this->_hDb= new PDO('mysql:host='.$host.';dbname='.$name.';charset=utf8', $login, $psw);\n\t\t}\n\t\tcatch (PDOException $e) {\n\t\t\terror_log(\"PDOException Connection to DB = \" . $e->getMessage());\n\t\t}\n\t}", "public function __construct() {\n\t if($_SERVER['HTTP_HOST']=='127.0.0.1'){\n\t\t//local db\n\t\t$this->host= \"localhost\";\n\t\t$this->user=\"root\";\n\t\t$this->passwd=\"root\";\n\t\t\n\t\t$this->base=\"tvsp\";\n\t\t$this->online=false;\n\t }else{\n\t\t//Hosted db\n\t\t$this->host= \"mysql51-60.perso\";\n\t\t$this->user=\"tvshowpltvsp\";\n\t\t$this->passwd=\"tn5Ij2i7\";\n\t\t\n\t\t$this->base=\"tvshowpltvsp\";\n\t\t$this->online=true;\n\t }\n\t \n\t $this->con= mysql_connect($this->host,$this->user,$this->passwd) or die(\"Connexion\");\n mysql_select_db($this->base,$this->con) or die(\"Sélection de MaBase\");\n }", "function db($localhost,$dbnom,$user,$mdp){\ndefine('HOST_DB',\"mysql:host=$localhost;dbname=$dbnom\");\ndefine('HOST_USER',$user);\ndefine('HOST_PASS',$mdp);\nclass HOST{\n public static $HOST = HOST_DB;\n public static $USER = HOST_USER;\n public static $PASS = HOST_PASS;\n\n};\n\n}", "public function connect()\n {\n $data = $this->app->file->requireFile('config.php');\n extract($data);\n try {\n static::$DB = new PDO('mysql:host=' . $server . ';dbname=' . $dbname , $dbuser , $dbpass);\n\n static::$DB->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE , PDO::FETCH_OBJ);\n static::$DB->setAttribute(PDO::ATTR_ERRMODE , PDO::ERRMODE_EXCEPTION);\n static::$DB->exec('SET NAMES utf8');\n\n }\n catch (PDOException $e){\n die($e->getMessage());\n }\n }", "function __construct()\r\n\t\t{\r\n\t\t\t$connect = mysql_connect(\"localhost\", \"root\", \"\");\r\n\t\t\t$db = mysql_select_db(\"mvc_php\");\r\n\t\t}", "public function __construct(){\r\n $user = 'root';\r\n $password = '';\r\n\r\n try {\r\n $this->DB = new PDO('mysql:dbname=pauseitive;host=127.0.0.1', $user, $password);\r\n $this->DB->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);\r\n }\r\n catch(PDOException $e){\r\n echo('Sam writes: Error establishing Connection!!!!!');\r\n exit();\r\n }\r\n }", "public function __construct($host,$db,$user,$pass){\n $this->_host = $host;\n $this->_db = $db;\n $this->_user = $user;\n $this->_pass = $pass;\n }", "public function __construct()\n {\n $cleardb_url = parse_url(getenv(\"CLEARDB_DATABASE_URL\"));\n $cleardb_server = $cleardb_url[\"host\"];\n $cleardb_username = $cleardb_url[\"user\"];\n $cleardb_password = $cleardb_url[\"pass\"];\n $cleardb_db = substr($cleardb_url[\"path\"], 1);\n\n try {\n $this->connection = new PDO(\"mysql:host=\" . $cleardb_server . \"; dbname=\" . $cleardb_db, $cleardb_username, $cleardb_password);\n $this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n } catch (PDOException $e) {\n echo \"Connection failed: \" . $e->getMessage();\n }\n }", "public function __construct(){\n $dbCredentials = $this->readConfigFile(self::DB_CONFIG_FILE);\n $this->dbHostname=$dbCredentials[\"hostname\"];\n $this->dbName=$dbCredentials[\"dbName\"];\n $this->dbUsername=$dbCredentials[\"dbUsername\"];\n $this->dbPassword=$dbCredentials[\"dbPassword\"];\n }", "function __construct() {\n $this->dsn = 'mysql:dbname=id14818847_usuario_3002;host=localhost';\n $this->user = 'id14818847_wricardo';\n $this->password = 'dw781qaU5N4@f/B]';\n \n try {\n $this->conn = new PDO($this->dsn, $this->user, $this->password);\n } catch (PDOException $e) {\n echo 'Connection failed: ' . $e->getMessage();\n }\n\n }", "function myDBConnect() {\r\n define(\"DB_HOST\", \"localhost\");\r\n define(\"DB_USERNAME\", \"mysqluser\");\r\n define(\"DB_PASSWORD\", \"mysqlpassword\");\r\n define(\"DB\", \"ISGB24\");\r\n\r\n return new PDO(\r\n 'mysql:host=' . DB_HOST . ';dbname=' . DB,\r\n DB_USERNAME,\r\n DB_PASSWORD,\r\n array(\r\n PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,\r\n PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,\r\n PDO::MYSQL_ATTR_INIT_COMMAND => \"SET NAMES 'utf8'\"\r\n )\r\n );\r\n}", "function MySQL() {\n \n }", "function MySQLDB(){\r\n /* Make connection to database */\r\n $this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());\r\n mysql_select_db(DB_NAME, $this->connection) or die(mysql_error());\r\n\t /*\r\n $data = mysql_query(\"SELECT * FROM constants \");\r\n\t $info = mysql_fetch_array($data);\r\n\t foreach ($info as $key => $value){\r\n\t\tif (($key!=\"admin_email\")&&($key!=\"id\"))\r\n\t\tdefine($key, $value);\r\n\t }\r\n\t */\r\n }", "public function __construct($host, $dbname, $username, $password) {\n $this->_host = 'mysql:host=' . $host . ';dbname=' . $dbname . ';';\n $this->_username = $username;\n $this->_password = $password;\n }", "function Base(){\n\t\t$this->db = new Database($this->databaseHost,$this->database,$this->username,$this->password);\t\n\t}", "function __construct() {\n $this->servername ='localhost';\n $this->database ='drempeltoets';\n $this->username ='root';\n $this->password ='';\n\n try{\n $this->conn = new PDO(\"mysql:host=$this->servername;dbname=$this->database\", $this->username, $this->password,);\n\n $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n\n echo\"connected successfully\";\n } catch(PDOException $e) {\n echo \"connection failed\" . $e->getMessage();\n } \n}", "public function mysql_connect(){\n\n\n //hostgator\n $host = getenv('g_host_var');\n $usuario = getenv('g_user_var');\n $senha = getenv('g_pwd_var');\n $database = getenv('g_database_var');\n\n\n $con = mysqli_connect($host, $usuario, $senha, $database);\n\n mysqli_set_charset($con, 'utf8');\n \n if ($con->connect_error) {\n die(\"Connection failed: \" . $con->connect_error);\n }\n\n if(mysqli_connect_errno()){\n echo \"Erro ao tentar se conectar: \".mysqli_connect_error();\n }\n\n return $con;\n }", "function db_parameter(){\n\t$param[\"host\"] = \"localhost\"; // to be changed\n\t$param[\"name\"] = \"wbd3\";\n\t\n\t$param[\"user\"] = \"root\"; // to be changed\n\t$param[\"pass\"] = \"root\"; // to be changed\n\t\n\treturn $param;\n}", "private function connect() {\n $host = $this->dbConfig[$this->selected]['host'];\n $login = $this->dbConfig[$this->selected]['login'];\n $password = $this->dbConfig[$this->selected]['password'];\n $database = $this->dbConfig[$this->selected]['database'];\n try {\n $this->db = new PDO('mysql:host=' . $host . ';dbname=' . $database . ';charset=utf8', $login, $password);\n $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n//\t\t\t$this->db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);\n } catch (PDOException $e) {\n die('Could not connect to DB:' . $e);\n }\n }", "private function __construct($_host = \"\", $_user = \"\", $_pass = \"\", $_default_db = \"\",$_driver=\"\") {\n\t\t$this->connect($_driver,$_host,$_user,$_pass,$_default_db);\n\t\t//register_shutdown_function(array($this, \"close\"));\n\t}", "public function __construct(){\n\t\t$this->db=new mysqli('127.0.0.1','root','','test');\n\n }" ]
[ "0.7497263", "0.7456955", "0.7452766", "0.7375823", "0.73622453", "0.7347748", "0.73273903", "0.73267317", "0.73246735", "0.7303673", "0.7294988", "0.7243647", "0.7232832", "0.7231543", "0.7228978", "0.7219174", "0.7217229", "0.710932", "0.7071614", "0.7025692", "0.702271", "0.7006387", "0.6983025", "0.69787705", "0.6953907", "0.694821", "0.6939236", "0.6936101", "0.6920748", "0.69058573", "0.6901611", "0.68937016", "0.689107", "0.6864637", "0.68575555", "0.684433", "0.6832077", "0.681949", "0.6815823", "0.68076646", "0.6804183", "0.67899215", "0.6777302", "0.67758304", "0.67678285", "0.6754695", "0.67458797", "0.67343116", "0.67258155", "0.6718941", "0.670993", "0.67060226", "0.6701354", "0.67003304", "0.6695719", "0.6691508", "0.6688432", "0.6688432", "0.6687476", "0.66792697", "0.6677026", "0.66739213", "0.66736114", "0.6664198", "0.66612136", "0.66546714", "0.6653316", "0.66522735", "0.6645159", "0.66365945", "0.66276103", "0.6627364", "0.66267556", "0.6626517", "0.6616304", "0.66119856", "0.66091955", "0.6607313", "0.6606205", "0.66012317", "0.6600158", "0.65947413", "0.65943176", "0.6593007", "0.6592377", "0.6588841", "0.65872914", "0.65861124", "0.6580882", "0.6577315", "0.65732014", "0.6566273", "0.6564804", "0.65619755", "0.6558696", "0.65578604", "0.6555908", "0.6553655", "0.6550247", "0.6547744", "0.65465736" ]
0.0
-1
/ PPBKDF2 A Password KDF called Parallel PBKDF2. Written in 2020 Steve "Sc00bz" Thomas (steve at tobtu dot com) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see < Parallel PBKDF2 (PPBKDF2) A computationally hard password KDF work = xorBlocks(pbkdf2(pw, salt, iterations:1024, length:384hashLencost)) key = pbkdf2(pw, work, iterations:1, length) Note each block of output is calculated independently of each other. This can use SIMD and threads to compute faster.
function ppbkdf2($algo, $password, $salt, $cost, $length = 0, $binary = false) { // Hash length and PHP limits // There is no actual limit to cost. When 384*cost is more than 2^32-1, // iterations is doubled and cost is halved until 384*cost is less than 2^32. $hashLen = strlen(hash_pbkdf2($algo, '', '', 1, 0, true)); if ($cost <= 0 || $cost > 0x7fffffff / 384 / $hashLen) { return false; } // Work $len = 384 * $cost * $hashLen; $hash = hash_pbkdf2($algo, $password, $salt, 1024, $len, true); $work = substr($hash, 0, $hashLen); for ($i = $hashLen; $i < $len; $i += $hashLen) { $work = $work ^ substr($hash, $i, $hashLen); } // KDF $key = hash_pbkdf2($algo, $password, $work, 1, $length, true); if (!$binary) { $key = bin2hex($key); } return $key; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output = false)\n{\n $algorithm = strtolower($algorithm);\n if(!in_array($algorithm, hash_algos(), true))\n trigger_error('PBKDF2 ERROR: Invalid hash algorithm.', E_USER_ERROR);\n if($count <= 0 || $key_length <= 0)\n trigger_error('PBKDF2 ERROR: Invalid parameters.', E_USER_ERROR);\n\n if (function_exists(\"hash_pbkdf2\")) {\n // The output length is in NIBBLES (4-bits) if $raw_output is false!\n if (!$raw_output) {\n $key_length = $key_length * 2;\n }\n return hash_pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output);\n }\n\n $hash_length = strlen(hash($algorithm, \"\", true));\n $block_count = ceil($key_length / $hash_length);\n\n $output = \"\";\n for($i = 1; $i <= $block_count; $i++) {\n // $i encoded as 4 bytes, big endian.\n $last = $salt . pack(\"N\", $i);// $i encoded as 4 bytes, big endian.\n // first iteration\n $last = $xorsum = hash_hmac($algorithm, $last, $password, true);\n // perform the other $count - 1 iterations\n for ($j = 1; $j < $count; $j++) {\n $xorsum ^= ($last = hash_hmac($algorithm, $last, $password, true));\n }\n $output .= $xorsum;\n }\n\n if($raw_output)\n return substr($output, 0, $key_length);\n else\n return bin2hex(substr($output, 0, $key_length));\n}", "private function hashModePbkdf2($password)\n {\n $this->cwsDebug->titleH2('Create password hash using PBKDF2');\n $this->cwsDebug->labelValue('Password', $password);\n\n $salt = $this->random(self::PBKDF2_RANDOM_BYTES);\n $this->cwsDebug->labelValue('Salt', $salt);\n\n $algorithm = $this->encode(self::PBKDF2_ALGORITHM);\n $this->cwsDebug->labelValue('Algorithm', self::PBKDF2_ALGORITHM);\n\n $ite = rand(self::PBKDF2_MIN_ITE, self::PBKDF2_MAX_ITE);\n $this->cwsDebug->labelValue('Iterations', $ite);\n $ite = $this->encode(rand(self::PBKDF2_MIN_ITE, self::PBKDF2_MAX_ITE));\n\n $params = $algorithm.self::PBKDF2_SEPARATOR;\n $params .= $ite.self::PBKDF2_SEPARATOR;\n $params .= $salt.self::PBKDF2_SEPARATOR;\n\n $hash = $this->getPbkdf2($algorithm, $password, $salt, $ite, self::PBKDF2_HASH_BYTES, true);\n $this->cwsDebug->labelValue('Hash', $hash);\n $this->cwsDebug->labelValue('Length', strlen($hash));\n\n $finalHash = $params.base64_encode($hash);\n $this->cwsDebug->dump('Encoded hash (length : '.strlen($finalHash).')', $finalHash);\n\n if (strlen($finalHash) == self::PBKDF2_LENGTH) {\n return $finalHash;\n }\n\n $this->error = 'Cannot generate the PBKDF2 password hash...';\n $this->cwsDebug->error($this->error);\n }", "function openssl_pbkdf2(string $password, string $salt, int $key_length, int $iterations, string $digest_algo = 'sha1'): string|false {}", "public static function hash_pbkdf2($password, $salt){\n $algorithm = \"sha256\";\n $count = 1000;\n $key_length = 64;\n $raw_output = false;\n \n if(!in_array($algorithm, hash_algos(), true))\n trigger_error('PBKDF2 ERROR: Invalid hash algorithm.', E_USER_ERROR);\n if($count <= 0 || $key_length <= 0)\n trigger_error('PBKDF2 ERROR: Invalid parameters.', E_USER_ERROR);\n\n if (function_exists(\"hash_pbkdf2\")) {\n // The output length is in NIBBLES (4-bits) if $raw_output is false!\n if (!$raw_output) {\n $key_length = $key_length * 2;\n }\n return hash_pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output);\n }\n\n $hash_length = strlen(hash($algorithm, \"\", true));\n $block_count = ceil($key_length / $hash_length);\n\n $output = \"\";\n for($i = 1; $i <= $block_count; $i++) {\n // $i encoded as 4 bytes, big endian.\n $last = $salt . pack(\"N\", $i);\n // first iteration\n $last = $xorsum = hash_hmac($algorithm, $last, $password, true);\n // perform the other $count - 1 iterations\n for ($j = 1; $j < $count; $j++) {\n $xorsum ^= ($last = hash_hmac($algorithm, $last, $password, true));\n }\n $output .= $xorsum;\n }\n\n if($raw_output)\n return substr($output, 0, $key_length);\n else\n return bin2hex(substr($output, 0, $key_length));\n }", "static function pbkdf2($P, $S, $c = 1000, $dkLen = 32, $Hash = 'sha256', $raw_output = false)\r\n {\r\n if(!in_array($Hash, hash_algos(), true)) return False;\r\n if($c <= 0 || $dkLen <= 0) return False;\r\n\r\n $hLen = strlen(hash($Hash, \"\", true));\r\n $l = ceil($dkLen / $hLen);\r\n\r\n $DK = \"\";\r\n // Block Function\r\n for($i = 1; $i <= $l; $i++) {\r\n // Iteration of the Pseudo-Random-Function (PRF) for each Block\r\n $U_j = $T_i = hash_hmac($Hash, $S . pack(\"N\", $i), $P, true);\r\n for ($j = 1; $j < $c; $j++) {\r\n $T_i ^= ($U_j = hash_hmac($Hash, $U_j, $P, true));\r\n }\r\n // Concat Results\r\n $DK .= $T_i;\r\n }\r\n return ($raw_output?substr($DK, 0, $dkLen):bin2hex(substr($DK, 0, $dkLen)));\r\n }", "private function getPbkdf2($algorithm, $password, $salt, $ite, $key_length, $raw_output = false)\n {\n $algorithm = strtolower(self::decode($algorithm));\n if (!in_array($algorithm, hash_algos(), true)) {\n $this->error = 'Invalid hash algorithm for PBKDF2...';\n $this->cwsDebug->error($this->error);\n\n return;\n }\n\n $ite = self::decode($ite);\n if (!is_numeric($ite) || $ite <= 0 || $key_length <= 0) {\n $this->error = 'Invalid parameters for PBKDF2...';\n $this->cwsDebug->error($this->error);\n\n return;\n }\n\n $hash_length = strlen(hash($algorithm, '', true));\n $block_count = ceil($key_length / $hash_length);\n\n $output = '';\n for ($i = 1; $i <= $block_count; $i++) {\n $last = $salt.pack('N', $i);\n $last = $xorsum = hash_hmac($algorithm, $last, $password, true);\n for ($j = 1; $j < $ite; $j++) {\n $xorsum ^= ($last = hash_hmac($algorithm, $last, $password, true));\n }\n $output .= $xorsum;\n }\n\n if ($raw_output) {\n return substr($output, 0, $key_length);\n } else {\n return bin2hex(substr($output, 0, $key_length));\n }\n }", "public function pwgen()\n\t{\n\t\t// $timetarget = 0.05;\n\t\t// $cost = 8;\n\t\t// do {\n\t\t// \t$cost++;\n\t\t// \t$start = microtime(true);\n\t\t// \tpassword_hash(\"testing\", PASSWORD_BCRYPT, ['cost' => $cost]);\n\t\t// \t$end = microtime(true);\n\t\t// \techo \"{$cost}<br><hr>\";\n\t\t// } while (($end - $start) < $timetarget);\n\t\t// selesai mencari $argon2i$v=19$m=1024,t=2,p=2$czZrU3NmSkwyZWFCZzZqcg$4BCXT3Xjj+nwslQZOa8I2rO760hSmVmzCiSQ/8cfcDs\n\n\t\t$a = password_hash('admin', PASSWORD_ARGON2I);\n\t\techo \"{$a}<br>\";\n\t\t$b = password_verify('superadmin', $a);\n\t\techo \"{$b}\";\n\t\tdie();\n\t}", "function password_krypt($pwd) {\n $options = [\n 'cost' => 12,\n ];\n return password_hash($pwd, PASSWORD_BCRYPT, $options);\n}", "public function setPbkdf2Mode()\n {\n $this->setMode(self::MODE_PBKDF2);\n }", "private function passwordKDF($secret, $salt = NULL)\n {\n //check if salt is set as function argument\n if (is_null($salt))\n {\n $salt = random_bytes(SODIUM_CRYPTO_PWHASH_SALTBYTES);\n }\n else {\n $salt = sodium_hex2bin($salt);\n }\n\n $seed = sodium_crypto_pwhash(\n $this->DIGEST_BYTES,\n $secret, //secret/password\n $salt, //salt\n $this->OPS_LIMIT,\n $this->MEM_LIMIT\n );\n return $seed;\n }", "public function getCryptographicKey(\n string $password,\n string $salt = '',\n int $iterations = 1024,\n int $length = 48\n ): string {\n return hash_pbkdf2(\"sha256\", $password, $salt, $iterations, $length);\n }", "private function checkModePbkdf2($password, $hash)\n {\n $this->cwsDebug->titleH2('Check password hash in PBKDF2 mode');\n $this->cwsDebug->labelValue('Password', $password);\n $this->cwsDebug->dump('Hash', $hash);\n\n $params = explode(self::PBKDF2_SEPARATOR, $hash);\n if (count($params) < self::PBKDF2_SECTIONS) {\n return false;\n }\n\n $algorithm = $params[self::PBKDF2_ALGORITHM_INDEX];\n $salt = $params[self::PBKDF2_SALT_INDEX];\n $ite = $params[self::PBKDF2_ITE_INDEX];\n $hash = base64_decode($params[self::PBKDF2_HASH_INDEX]);\n $this->cwsDebug->labelValue('Decoded hash', $hash);\n\n $checkHash = $this->getPbkdf2($algorithm, $password, $salt, $ite, strlen($hash), true);\n $this->cwsDebug->labelValue('Check hash', $checkHash);\n\n $result = $this->slowEquals($hash, $checkHash);\n $this->cwsDebug->labelValue('Valid?', ($result ? 'YES!' : 'NO...'));\n\n return $result;\n }", "function kpk($a,$b){\n\t\treturn ($a / fpb($a,$b)) * $b;\n\t}", "function getSharedKey($a,$B, $p){\n\t\treturn modpow($B,$a,$p);\n\t}", "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}", "public function SeedDecrypt(\n\t\t\t\t\t$pbData=array(), \t\t\t\t\t// [in] encrypted data\n\t\t\t\t\t$pdwRoundKey=array(), \t\t\t// [in] round keys for decryption\n\t\t\t\t\t&$outData=array()\t\t\t\t\t// [out] data to be encrypted\n\t\t\t\t\t)\n\t{\n\t $L0 = 0x0; $L1 = 0x0; $R0 = 0x0; $R1 = 0x0;\n\t $K=array();\n\t $nCount = 31;\n\n// Set up input values for decryption\n\t $L0 = ($pbData[0]&0x000000ff);\n\t $L0 = ($L0<<8)^($pbData[1]&0x000000ff);\n\t $L0 = ($L0<<8)^($pbData[2]&0x000000ff);\n\t $L0 = ($L0<<8)^($pbData[3]&0x000000ff);\n\n\t $L1 = ($pbData[4]&0x000000ff);\n\t $L1 = ($L1<<8)^($pbData[5]&0x000000ff);\n\t $L1 = ($L1<<8)^($pbData[6]&0x000000ff);\n\t $L1 = ($L1<<8)^($pbData[7]&0x000000ff);\n\n\t $R0 = ($pbData[8]&0x000000ff);\n\t $R0 = ($R0<<8)^($pbData[9]&0x000000ff);\n\t $R0 = ($R0<<8)^($pbData[10]&0x000000ff);\n\t $R0 = ($R0<<8)^($pbData[11]&0x000000ff);\n\n\t $R1 = ($pbData[12]&0x000000ff);\n\t $R1 = ($R1<<8)^($pbData[13]&0x000000ff);\n\t $R1 = ($R1<<8)^($pbData[14]&0x000000ff);\n\t $R1 = ($R1<<8)^($pbData[15]&0x000000ff);\n\n// Reorder for little endian\n\t\tif (!$this->ENDIAN) { $this->EndianChange($L0); $this->EndianChange($L1); $this->EndianChange($R0); $this->EndianChange($R1); }\n\n\t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n \t$this->SeedRound($L0, $L1, $R0, $R1, $K); /* 1 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n \t$this->SeedRound($R0, $R1, $L0, $L1, $K); /* 2 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($L0, $L1, $R0, $R1, $K); /* 3 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($R0, $R1, $L0, $L1, $K); /* 4 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($L0, $L1, $R0, $R1, $K); /* 5 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($R0, $R1, $L0, $L1, $K); /* 6 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($L0, $L1, $R0, $R1, $K); /* 7 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($R0, $R1, $L0, $L1, $K); /* 8 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($L0, $L1, $R0, $R1, $K); /* 9 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($R0, $R1, $L0, $L1, $K); /* 10 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($L0, $L1, $R0, $R1, $K); /* 11 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($R0, $R1, $L0, $L1, $K); /* 12 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($L0, $L1, $R0, $R1, $K); /* 13 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($R0, $R1, $L0, $L1, $K); /* 14 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount--];\n $this->SeedRound($L0, $L1, $R0, $R1, $K); /* 15 */\n\n \t\t$K[1] = $pdwRoundKey[$nCount--];\t\t$K[0] = $pdwRoundKey[$nCount];\n $this->SeedRound($R0, $R1, $L0, $L1, $K); /* 16 */\n\n\t\tif (!$this->ENDIAN) {$this->EndianChange($L0); $this->EndianChange($L1); $this->EndianChange($R0); $this->EndianChange($R1);}\n\n// Copy output values from last round to outData\n\t\tfor ($i=0;$i<16;$i++) $outData[$i] = null;\n \tfor ($i=0; $i<4; $i++)\n \t{\n\t \t$outData[$i] = $this->ConvertByte(($R0>>(8*(3-$i)))&0xff);\n\t \t$outData[4+$i] = $this->ConvertByte(($R1>>(8*(3-$i)))&0xff);\n\t \t$outData[8+$i] = $this->ConvertByte(($L0>>(8*(3-$i)))&0xff);\n\t \t$outData[12+$i] = $this->ConvertByte(($L1>>(8*(3-$i)))&0xff);\n\t }\n \t \treturn $outData;\n\t}", "public function testPKCS8RC2CBC(): void\n {\n\n // EncryptionAlgorithm: id-PBES2\n // EncryptionScheme: rc2CBC\n // PRF: id-hmacWithSHA1\n\n $key = '-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIFFjBIBgkqhkiG9w0BBQ0wOzAeBgkqhkiG9w0BBQwwEQQI/V5Qw9+hKt4CAggA\nAgEQMBkGCCqGSIb3DQMCMA0CAToECPxrtS4U+IIBBIIEyKQyYpJ8tfWXVvitxaPq\n+gtrVVWd/ukjwZ+jQY3g/ZjZNWQPq5XbuoP5F3u5g4V+RoXzAIkdwyiveEv+XssV\nDJVHfNiL6VcdxhFJ1rmt2uq9vFW/x9UHDqAWsnytn46NFRWUqgKzkYWMDqU71IC/\nwyq7UzjTtqdLzaCxkTWYst1o+Iu7VXapFVcscPYyGshLVyZ0x/etc/09LOC4bIpk\n3Qzf+f+adrNxW0mbD3SyDfVadvS8mApsd7bJR320iEKd4CmW0sNAzKkm2ya2aUIi\nHrk3DEgr4rPmpn3BVfZ6pg+yRu+MOxBhl+8yfA+E8kXfe/F7BiMkJQcJTOfLRLfH\nTXipyb4f8oa+gmwwWK0jfCuxoxiOTA1CBCjZoTvdSuFYVTdblysQO3BivvSQgbmD\noHntb7HEoZ6yB49u/LrrowUQNH+XihBcototyLCmC5K+x8N5cZsp+yaLJekDHlQs\nATVMeKCbPjYaS4g48lDyC1VbtNtJc/zN5gOUB0PM80iB02iZegYyeW5+WWzY+Lgu\nlpWLH7PdpqL5KtoH6SJKD6Szl8dKJLYzpHI2esckpp9YsDtX2z/VkUFKTd0PeeNh\nWefX0q8A47NBeBLFEZqmzPrL6IyaPnnPCUsvqk6MEA1DgsmY3DFd8nEYhzJIAwoy\nRw1mCqwL0uukQPqFGByU9YRHyhJd5aAPyF1xSLfUQUJb9xn+wyN57xoamFePPWMi\nUXdESZWX+rjA0ChfEtL9AzXcfO9PBS1p/2JkVxUt/UPfI9SgQn92kLo0LRi/iRLk\nH4zjnkaDy65ZY15bzyK+EvJ+VZ+P24QI7X12f1m+rkssMekHWHf5/SitUpW26ZFe\nM6vXyz3RlXxow+0WcsPob19n/vbgeJQPTfMY0zPS0iCRIggC/liWMEOzP/R1jCYi\nq8TEaUi1Ztx3Gp4Y8Vcf33a/YsxKoUsQlFFtyE6KE3ZEI03E6cMiX21nWULKrk9l\n+8Tq4T1a8I4goVa+e4CYBYwMAY9fdfUJ/p1EnrG6Ynj06a2Zx0IK/dF5w0b/5TeL\nPMyafb4FHkpkyYYFlktQdKIqGjjtmKUr56/7vumVHUyItf5nSuM8lLps8to2MLkE\nMAolD+X4FIGs/1Z5NlUb5AlNVNRY1c7tf+YSXI21PlkBpaRSAvN9/2fmGnxWSvAa\nBEGR0JA4zMPrCSpxrBQpOrZPh/cD9YXNu+N9P4dtf57smCviKTJg8eMl9NYu4vtc\nFygdqPKuhJM2WI5Qdrqjbf4NQ1mngSxXNKrcNmC/m60JPNKHC7dM2ynbN8QyZqEE\nEzSdL0Z3YQGnuwr+4zKHHsNnO4nRJfUowWks4Gvi2HIyy3DBVqqyEPxDDGEpcqs+\n8GNKTGBg1PCVg+I9Xjxio4tBuwLDo6Y8Ef8SphN/0DC9svaQRfEOY3/9WB+fDnrq\nSUSNZNWetkCd247WHwl+JvJDXCuzGJ2+JG5DXuEdCq2EhEVNUWPuotXTPvI+0wsP\nKq23uvzS53ZArQnxlqgwyXQ06jzc+J4AiNtl3uIw8D6LrRyaDsOsKQCEh7qjkqTc\nkhzefbnNRDL5PIJnTfM7vSQ4nUzdAxs/7YzX6GMx1DaCtBANbUVUoIE+3oKdqpGV\n9AmO2phYWCBefw==\n-----END ENCRYPTED PRIVATE KEY-----';\n $pass = 'asdf';\n\n $this->pkcs8tester($key, $pass);\n }", "protected function _computeEncryptionKey($password = '') {}", "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 hash_pword($hashme){\n return password_hash($hashme, PASSWORD_BCRYPT);/* md5(sha1($hashme)) */;\n\n}", "public function testPKCS8AES256CBC(): void\n {\n\n // EncryptionAlgorithm: id-PBES2\n // EncryptionScheme: aes256-CBC-PAD\n // PRF: id-hmacWithSHA256 (default)\n\n $key = '-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIFLTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIIU53ox17kUkCAggA\nMAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBATi8ZER9juR41S2c35WXTQBIIE\n0K98r5dQq/OxbwA2CH0ENs9Jw2qjvW0uGkH8DdO8XvCJohMrIU8FABxw/50Af5Ew\nNq4FJIYz90LjZzlI7kf97TDMZKw2K3AleymwmfMcKer5pZ6jqdxLGXFztdj3Fm/S\nP+NcVjEZFSEH1MNDEPhiPSIUAf1yQcLwKAzHH0JTnZBOFSBbGxTZLYfvD2angVNL\nxTivLYJGdr1cUrAuZQcM3JGQEvCA5qAC7oRhdVgGyJrl8xXY3mVlaXMsW8A+Q7xj\nNyH7lJUFEF3YPMbpWr8zblCQYgGByM++yOfYQXno50AgWdYjPO88pPzKcCe4x6WV\nqKlvqTYZqb1HgZurTd3BS/e6GWRgnRt8W87nuNcyJasud92Z0FhSGwIirlE89gUW\nEinbY8m6+sL9VZZ5+t66TROtpj1Ohj8t3W+01oLDCtdSTGwLuq9XUsEyuYZSqUN9\n0F43U8pOykNbChi1S8vfFdwf7U1R+hgoF0MRNDwh3hRfSS0zPUnCGb6hDZrOZB9C\ne3xbfXiujVlfhRc7r2qbZHAwqNLcccC98oLfbEIUdBXn6M7GfFIwiuNiS48rehp0\ndA9+CiWJBq+7b/lRdcgQJxjwUpxtMXr/812Bky4dDoMDs32cmMghH2sgUvht0imy\nZhA3IvSCAV1wVoQLqUuPXLMskcKsNCTbL9AYEpJm612dm43btXec2vtjCc4ajpCg\nwICLE2V1jwzWw0girrT/IMt8QUd3fkJZkEAbmFHwuZptFnreRCidZjfQqYhWfyqJ\nnGW+cc7G1bGwxt32fC5eu23hBTJERmRlvkhC+v2WKhYXcKyOKQn5/I4eaEZauDn3\nwmg3f4h/PPuQgqv/vspOai9a5HhPRNyeIjXsk3hxHepEgV+kVSU50BpchSSzBuhK\n71F3nOMTyJ/XXxaZrLLtpo3CcXmI0/JuNG7pjDS++Vx/BQFs8xxDfxRs0Um7RlT1\npiGZGDn9zHNpbspHkAeoQmlplbmjtCClojhfBj4HbXTtlYmDgwKHul4YIni6kgCr\nG+WduGXLeyxmH976vvJasD4wyttL2CZTHLR7Elp+yl0xjXMlj/iP4WYozJAmGifq\nxjLWMsZ0gaBtAoOFrvcgOueE7+E+NdbIHzU4u5FTbz0DLCvrsZeKwpOPEsMw0LVG\nT6rNsBzMY3XyBtV1FdXwmuOcWha62Ezr/RRrfvRPRImy/xVVKOrOQ/KbyELkjroh\nUAEPs7s+89Ovc7P30IfS0Xzlhz2aSRflZarOIqu1JtjTYZ0XWLTWoQT2fjZdnMDV\nqFrbTPdXezqTAAzk3rnkkghgamTVQ7Y8D+BIGHIc4+oVT2jxzSjBQC7szmudanGQ\nhfGLyO+vwLg4r1lanzSULtqfwTZMarjYGxLqpQp8cIjJfzvLI3psRDFyuWCdIbEs\ny3VKgoNsa+PmyimGSa7x2cw6ayTx9wlOhPzaBwqMhHxr4qJwS2ohDONeRfnPr34+\noVD7mnCBLB14qiZcpQv+qPGvd/Q/tA5SBNbZhPuWtjqvy7/K+1FQX6xvx1kl7p9W\nl0Q99rwqECl8y+CiKEXdItkCTA/vgxblSt465Mbdic7cbcP6wAMSGmpryrmZomm/\nmKVKf5kPx2aR2W2KAcgw3TJIu1QX7N+l3kFrf9Owtz1a\n-----END ENCRYPTED PRIVATE KEY-----';\n $pass = 'asdf';\n\n $this->pkcs8tester($key, $pass);\n }", "public function testPKCS82DES(): void\n {\n\n // EncryptionAlgorithm: pbeWithSHAAnd2-KeyTripleDES-CBC\n\n $key = '-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIE6jAcBgoqhkiG9w0BDAEEMA4ECGT21lf3Tl4dAgIIAASCBMgJmnyaQktoSk8u\nJyUAaB4ZgGWW22BX1xRA7en0sNj4PhBxj1DEXGKNUBx3k6u6Cd7JUupxGfeag5aw\nfi0bWNgEw7YSITmZKaKO5Ee4shQrEDucaH6KEGYV6YspNys5dD817hmd4Yc31q2e\nIg5k3rIpP72Yy9Si0FXmKDE8/GmCYckdIQVUCGZD9nLugvqEC0adludfMAwzCHUY\n68jeyKiPJGTFSmE0wPD5EaWknn3U0eRcmKwZPtFpWEAEv5GTm1h6Y5q+P2X2Qsia\nNeoa4jjnSEww85zbno/k0KdoRIuSEM8qOHdNuU6XNTCGKxEkgBLkY+vjRjOCi+K4\nfzJSAPxaYATGX+W8EWegz3yhwiFujjDPkO9nfeoyks/saFbP9uT8aesZUn4/rIw0\nKyW7lYW0TUyBxfIXg1DEsKcmSrrb0WrFLN/MnjO8Y1bAY63KgKgpFZk+7H/7eCmD\n2Egj6o2LXTEPkxwYyeR41k64LM5RFF5qs4wS0Gfo1oTc6lSbuZNFHSgsXkb+CXFL\nJZ3CuaYFY5Ldfm+1HsrZ9s3GmNAnog6WABXIcz9aULUyJfLr+oZaQR7TC5KpM5Xy\ndyztlsN43D9UZKdz93zW2V3LxbzbOWTrcd9dB1GwrPvWIy/0/dqFOvpcr9k/4S1T\nAJ6pja4x19EQLj2DUvO7JQEy2Rlam+SI/ARQTc0W0dJ8x7FboHZDxUQCRDih5Qw3\ns/xoGflLUYYtAR5hfgjbWuvG3Told4IYlBn2vvVu7UxXQekUOaZLePqucAP3sTDC\npK7JK+OT223FNU5NieGS4hh+jxZQnLuuyxWQaTCJM9isYPqJYsWT9X+c44ixOgLJ\nunYtg+8Lck3On6wiDUPWTLCGJvjb53NhPSovTjNBW2Q7YszXXjeO5svwwxtKHabx\nvCDsG0zdNdwIgupqynbtcuUhsmIsJKBu5c+9i8P21rNF0DZjOkv8mThRA6YQLce8\nmLTcnpLsvCGNehVEStD6pr+CtGsQEEtH3bPc2ZBrpxtz1EHmrI7H3kX1gjbD7bsT\nXWzaxsId+8pmqnAcMRzU3mRv4Fe+387X2irG4OxR/6cFMk3+yfpKJLSsNh6HAVRX\nxzYwVz2WP7RM0KuLh7auAcI1mHk+0xAvDi7s3ggy3SzLzQq9p+EEFVGVSYuVFLbi\nTtlY6HQ3b1Z6KgntoPj79YuOmri6/8w7nBkKt09faYLUf9wZWHLL9/LjZqoJxPfl\nlX5Ss4+MDV1aG9aJoTT53d8Gn8ApWK+XFToFg2InYZzZqBnKP8DHPG8D2Gh/MZlA\nYt4hPDNLf733zm1zJTWo0TF6+4AwZp7XUKTg+pM1CZJDOTbJlEA+cXY3BxOq10bl\nJPJmV/JFINqSeBLN8V2Ong8Q0Dt4uabSmlOUz19SXpimBrO8ztxaqigMFIKMbLXX\nuIVAoxG7KLPuv44yK3Fjsg6OtwZnrWqea02b1qwFFrIKoqmQ8FNFBMYqcHU2IkSq\ngJqSylfqcre5Y1DOSlcjGa7aP4C8AyB5qOG7LZ/CLAePKqgAHtMd/K40Zgku36Ir\n9OAcUXy/H5PFJIleEyjvLLBE0VWs0TVBXi/FiIqwvAYNOFqXl/gtRcZ0kVex/QeN\nrcONqwmUGJOjrfhUyJA=\n-----END ENCRYPTED PRIVATE KEY-----\n';\n $pass = 'asdf';\n\n $this->pkcs8tester($key, $pass);\n }", "public function testPKCS8RC2(): void\n {\n\n // EncryptionAlgorithm: pbeWithSHAAnd128BitRC2-CBC\n\n $key = '-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIE6jAcBgoqhkiG9w0BDAEFMA4ECAdC2l5rzAQeAgIIAASCBMjuEQDNkvSX6ylp\nWsgQZUSvPdNpdlG084oLmhTV0z4pZeLB0YCyKCM7GMVQ0tsprRW0ky86ulbY3W5Q\n86WNHXYtVIFXEmIjN1syRG5Pq3RZ4Ba6wf36Gc/1713p6GjcPxLZ+JOw1xBEm1rh\n1nI9b43PzbKmczs+6IvRO5b9MjKNkBeNzH9kh4b3zsEW/IFgYaz8zip/zRu4hCSW\nORhnRYFvbI22E84g4/SB1WS34nR/flyZBXT4P87s7bwXEOsXAGnEeVF38znV3awD\nV8rry2e1drRmlhfNhvDroQrkv7O9X2ee91I9gahPKpXtAlGXBgRb8qjVHeI8Ea3K\nTy2zcWnjdE7/jt6pO07+B+FlHNdKySlFdKTHEmJ1x+O5Ui4JaGjI2UML0yGHoYFU\nwGH/1DYJ4+R9d97BYJ/yp9+JAQAjpG7UUt3jFgNx0CAbP7d438l06z2EE87EqIEa\n3Y0ZG1Q5PWE60hPJsvUELdgzcUiKkVCxhOPhwmbSlQpEYXZRBWv0RAJzey6yPMQ+\nL/TkMDpgTNUk9x+n3ehnRuA/tlthxXN/ViDthPO7ovSVCsKsUq6lXotO+3hHLGs0\nu8ZyVKHNEqGso7PfAFsjcJq2C46mQNME4HPOWm5J+TFf/vvwqdYKCiF3arV0hUtW\nx9lyPR2PvZM1ik9jXi6lc5hPegcwmx9/j5yc4/3rQNiwe4dtUpL5JLKAxecKBLgr\natyVnAs69JYaaUT9aKRDzYzCRjo0jIQ9/lgJl2DqVRF9aYnknrVWRIjyKbfKjw7N\nw0yfXlVRw46YuJ72PSHpr7HcfzL1EWzmKcAEPDH/UCpIaoeNTwxeEQSltOM0D0Su\nZzyAQP8sWSXSwdtD5YD7iiUjDN4UMDuIwAEMLN9231/RjvKuLAys0oNRQfHkkiCo\n9rt/VUP8be98UTyKu7Bx7JUEW6VVnYM+Y274MLQk6TcjZyXgbKwhHFJyAjcBAFQp\n5kkYES0kk+57HeBImcB0a5qBor/uAnlsCV690roUlBtkVhBOkTjVi7w/uZsSjIWr\nMBndNHTFqqnkbm8xOOoSH6vS32c1KE8FrGpmkPGc6wziX9Ja/MkuLDXrBIlnP4Yj\naCf0sVMSR1/LoHIGGaGXmTzs0VTR8Z5EyW5uvvCy6dWCWnTKEWmTTS+zqW1RYVBZ\nn/P2ovj2Kl4rhQuSpfOE9xBFWsgPAD6T2FJzfvu0/D3Sw5pI/RT4NnQ77oJSs+jN\nlV33FeceRoJqjcP6YMAiRX4RmkTeD5Hgy0YRLrfQ4PKwAQG82uIj3yqXWveexwb0\nCpm5XxzgCMWGBRvIvM+yByf0SP7fIWYHbzsEWJkN5btF3tMc6i12q7AJ0/UFMQLt\nKNiMg+dLWP18cySU8OysXqPq1JKHDU1NMg2Xf9o2c35eOktLfcO9axS4oAAz4bGN\nhTB8rk+MWnHfSlWvMPMzlJyndXv/WxfojujLogDTOHd4/q4KyoOwJY3H44eeW79u\nsS7pDbjKMl8A15BLMLx01DaOYk7EiHFnGIpY2V2+2Xm7vQu9+8fHSf8whuCRVmBY\nDrhy2HTF1veKrQ6IrIyQicmzTtW6moSnNg69SpuzKTegYyCRsSHDIL3WxMoopVwr\nPu3ed6UvXDfotj3v8rE=\n-----END ENCRYPTED PRIVATE KEY-----';\n $pass = 'asdf';\n\n $this->pkcs8tester($key, $pass);\n }", "protected function getAlgorithm(): int\n {\n return PASSWORD_BCRYPT;\n }", "function generate_hash($password, $cost=11){\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 $size = mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_CFB);\n $salt=substr(base64_encode(sha1(mcrypt_create_iv($size))),0,22);\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 $salt=str_replace(\"+\",\".\",$salt);\n /* Next, create a string that will be passed to crypt, containing all\n * of the settings, separated by dollar signs\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 return crypt($password,$param);\n }", "function blake2bInit($outlen, $key) {\n\t\tif ($outlen === 0 || $outlen > 64) {\n\t\t\tthrow new Exception('Illegal output length, expected 0 < length <= 64');\n\t\t}\n\t\tif (is_array($key) && (count($key) <= 0 || count($key) > 64)) {\n\t\t\tthrow new Exception('Illegal key, expected array with 0 < length <= 64');\n\t\t}\n\n\t\t// state, 'param block'\n\t\t$ctx = array(\n\t\t\t'b' => array_fill(0, 128, 0),\n\t\t\t'h' => array_fill(0, 16, 0),\n\t\t\t't' => 0, // input count\n\t\t\t'c' => 0, // pointer within buffer\n\t\t\t'outlen' => $outlen // output length in bytes\n\t\t);\n\n\t\t// initialize hash state\n\t\tfor ($i = 0; $i < 16; $i++) {\n\t\t\t$ctx['h'][$i] = $this->BLAKE2B_IV32[$i];\n\t\t}\n\t\t\n\t\t$keylen = is_array($key) ? count($key) : 0;\n\t\t$ctx['h'][0] ^= 0x01010000 ^ ($keylen << 8) ^ $outlen;\n\n\t\t// key the hash, if applicable\n\t\tif (is_array($key)) {\n\t\t\t$this->blake2bUpdate($ctx, $key);\n\t\t\t// at the end\n\t\t\t$ctx['c'] = 128;\n\t\t}\n\n\t\treturn $ctx;\n\t}", "function rc4($data, $pwd)\n{\n $cipher = '';\n $key[] = \"\";\n $box[] = \"\";\n $pwd_length = strlen($pwd);\n $data_length = strlen($data);\n for ($i = 0; $i < 256; $i++) {\n $key[$i] = ord($pwd[$i % $pwd_length]);\n $box[$i] = $i;\n }\n for ($j = $i = 0; $i < 256; $i++) {\n $j = ($j + $box[$i] + $key[$i]) % 256;\n $tmp = $box[$i];\n $box[$i] = $box[$j];\n $box[$j] = $tmp;\n }\n for ($a = $j = $i = 0; $i < $data_length; $i++) {\n $a = ($a + 1) % 256;\n $j = ($j + $box[$a]) % 256;\n $tmp = $box[$a];\n $box[$a] = $box[$j];\n $box[$j] = $tmp;\n $k = $box[(($box[$a] + $box[$j]) % 256)];\n $cipher .= chr(ord($data[$i]) ^ $k);\n echo \"code:\" . ord($data[$i]) . \"\\tk:$k\". PHP_EOL;\n }\n return $cipher;\n}", "function break_repeating_key_XOR($args = NULL) {\n\n\n\tif ($args==NULL) {\n\t\treturn false;\n\t}\n\n\t// INIT PARAMETERS\n\t$kl_min = 2;\n\t$kl_max = 10;\n\tif (isset($args['kl_min'])) {\n\t\t$kl_min = $args['kl_min'];\n\t}\n\tif (isset($args['kl_max'])) {\n\t\t$kl_max = $args['kl_max'];\n\t}\n\n\t// Recupero il testo cifrato a seconda che venga passato direttamente\n\t// o sia passato l'url di un file\n\t$cypher = '';\n\tif ($args['file']!=NULL) {\n\t\t$lines = file($args['file'], FILE_IGNORE_NEW_LINES);\n\n\t\tset_time_limit(0);\n\t\tforeach($lines as $line) {\n\t\t\t$cypher .= $line;\n\t\t}\n\t\tset_time_limit(30);\n\t}\n\telse if ($args['string']) {\n\t\t$cypher = $args['string'];\n\t}\n\n\t//echo $cypher.\"<br><br>\";\n\n\t$cypher = $this->base64_to_hex($cypher);\n\t$array_norm_keylegth = array();\n\tfor ($keylength=2; $keylength <= 40; $keylength++) { \n\t\t$sum = 0;\n\t\t$keylength_byte = $keylength*2;\n\t\t//echo $keylength.\"<br>\";\n\t\tfor ($i=0; $i < 4; $i++) { \n\t\t\t$str1 = substr($cypher, ($keylength_byte*2)*$i, $keylength_byte);\n\t\t\t$str2 = substr($cypher, (($keylength_byte*2)*$i)+$keylength_byte, $keylength_byte);\n\t\t\t//echo \"#### \".$str1.\"<br>\";\n\t\t\t//echo \"#### \".$str2.\"<br>\";\n\t\t\t//echo \"#### \".$this->helper->hamming_distance($str1, $str2)/$keylength.\"<br><br>\";\n\t\t\t$sum = $sum + $this->helper->hamming_distance($str1, $str2)/$keylength_byte;\n\t\t}\n\n\t\t//echo \"######## \".$sum.\"<br>\";\n\t\t//echo \"######## \".($sum/4).\"<br>\".\"<br>\";\n\n\t\t//echo \"###################################<br><br>\";\n\t\t\n\t\t$array_norm_keylegth[] = array('norm_keylength' => $sum/4, 'keylength' => $keylength_byte);\n\t\t\n\t}\n\n\tusort($array_norm_keylegth, function($a, $b) {\n\t\t$el1 = $a['norm_keylength'];\n\t\t$el2 = $b['norm_keylength'];\n\n\t\tif ($el1 == $el2) return 0;\n\n\t\treturn ($el1 < $el2) ? -1 : 1;\n\t});\n\n\t//echo \"<pre>\";\n\t//print_r($array_norm_keylegth);\n\t//echo \"</pre>\";\n\n\t$keylength_candidata = $array_norm_keylegth[0]['keylength'];\n\n\t$array_blocchi_testo_keylength = $this->helper->unique_split_to_array($cypher, $keylength_candidata*2);\n\n\t//echo \"<pre>\";\n\t//print_r($array_blocchi_testo_keylength);\n\t//echo \"</pre>\";\n\n\t$array_string = array();\n\tfor ($i=0; $i<(($keylength_candidata*2)); $i += 2) { \n\t\t$partial_string = '';\n\t\tforeach ($array_blocchi_testo_keylength as $string) {\n\t\t\t$partial_string .= substr($string, $i, 2);\n\t\t}\n\t\t$array_string[] = $partial_string;\n\n\t\techo \"<pre>\";\n\t\tprint_r($this->single_byte_xor_cipher($partial_string, \n\t\t\t\t\t\t\t\t\t\t \t 16, \n\t\t\t\t\t\t\t\t\t\t \t array('min'=>0, 'max'=>255),\n\t\t\t\t\t\t\t\t\t\t \t array('total_letter'=>1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t'first_letter'=>0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t'second_letter'=>0)));\n\t\techo \"</pre>\";\n\n\t\techo \"<br>################################################</br>\";\n\t}/**/\n\n\techo \"<pre>\";\n\tprint_r($array_string);\n\techo \"</pre>\";\n\n\t// Controllo le ripetizioni di sottostrighe\n\t/*set_time_limit(0);\n\t$array_text = array();\n\n\t$dim_cypher = strlen($cypher);\n\t$occurences = array();\n\n\tfor ($i = floor($dim_cypher/2); $i>0; $i--) {\n\t\t$offset_sx = 0;\n\t\t$offset_dx = $dim_cypher-$i;\n\t\t$finito = false;\n\t\twhile ((($i <= $offset_sx)||($i<=$offset_dx))\n\t\t\t &&($offset_sx<=$dim_cypher)\n\t\t\t &&($offset_dx>=0)) {\n\n\t\t\t$text = substr($cypher, $offset_sx, $i);\n\n\t\t\t$occurences = $this->helper->strpos_all($cypher, $text);\n\t\t\tif (count($occurences)>1) {\n\t\t\t\t$finito = true;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t$offset_sx++;\n\t\t\t$offset_dx--;\n\t\t}\n\n\t\tif ($finito) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tset_time_limit(30);\n\n\t/*echo $text.\"<br>\";\n\tprint_r($occurences);*/\n\n\n\t// Possibili keylengths e valutazione con distanza di hemming\n\t/*set_time_limit(0);\n\t$distance = $occurences[1] - $occurences[0];\n\t//echo \"<br>distance: \".$distance.\"<br>\";\n\n\t$keylengths = 0;\n\t$array_somme = array();\n\t$smaller_avarage_dist = 0;\n\t$guessed_keylength = 0;\n\tfor ($i=1; $i <= $distance; $i++) { \n\t\t//echo \"<br>#### distance%i: \".($distance%$i).\"<br>\";\n\t\tif (($distance%$i)==0) {\n\t\t\t$keylength = $distance/$i; // sottomultipli $distance\n\n\t\t\tif ($keylength>2) {\n\t\t\t\t//echo \"<br>######## keylengths: \".($keylengths).\"<br>\";\n\t\t\t\t$array_blocchi_testo = $this->helper->unique_split_to_array($cypher, $keylength);\n\t\t\t\t//print_r($array_blocchi_testo);\n\t\t\t\t$d_crypt = 0;\n\t\t\t\t$somma_d_crypt = 0;\n\t\t\t\tfor ($j=0; $j < count($array_blocchi_testo)-1; $j += 2) { \n\t\t\t\t\t$str1 = $array_blocchi_testo[$j];\n\t\t\t\t\t$str2 = $array_blocchi_testo[$j+1];\n\n\t\t\t\t\tif (strlen($str1) == strlen($str2)) {\n\t\t\t\t\t\t$d_crypt = $this->helper->hamming_distance($str1, $str2)/$keylength;\n\t\t\t\t\t}\n\n\t\t\t\t\t$somma_d_crypt = $somma_d_crypt + $d_crypt;\n\n\t\t\t\t}\n\t\t\t\t//echo \"<br>######## j-2\".($j-2).\"<br>\";\n\t\t\t\t$array_somme[] = array(\"avar_norm\"=>$somma_d_crypt/($j-2), \"keylength\"=>$keylength);\n\t\t\t}\n\t\t}\n\n\t}\n\tset_time_limit(30);\n\n\tusort($array_somme, function($a, $b) {\n\t\t$el1 = $a['avar_norm'];\n\t\t$el2 = $b['avar_norm'];\n\n\t\tif ($el1 == $el2) return 0;\n\n\t\treturn ($el1 < $el2) ? -1 : 1;\n\t});\n\n\t$keylength_candidata = $array_somme[0]['keylength'];\n\n\t$array_blocchi_testo_keylength = $this->helper->unique_split_to_array($cypher, $keylength_candidata);\n\n\t/*echo \"<pre>\";\n\tprint_r($array_blocchi_testo_keylength);\n\techo \"</pre>\";*/\n\n\t/*$array_string = array();\n\tfor ($i=0; $i<$keylength_candidata; $i++) { \n\t\t$partial_string = '';\n\t\tforeach ($array_blocchi_testo_keylength as $string) {\n\t\t\t$partial_string .= $string[$i];\n\t\t}\n\t\t$array_string[$i] = $this->base64_to_hex($partial_string);\n\n\t\techo \"<pre>\";\n\t\tprint_r($this->single_byte_xor_cipher($array_string[$i], \n\t\t\t\t\t\t\t\t\t\t \t 16, \n\t\t\t\t\t\t\t\t\t\t \t array('min'=>0, 'max'=>255),\n\t\t\t\t\t\t\t\t\t\t \t array('total_letter'=>1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t'first_letter'=>0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t'second_letter'=>0))[0]);\n\t\techo \"</pre>\";\n\n\t\techo \"<br>################################################</br>\";\n\t}\n\n\t/*echo \"<pre>\";\n\tprint_r($array_string);\n\techo \"</pre>\";*/\n\n}", "public static function getBestCost(): int\n {\n $timeTarget = 0.05; // 50 milliseconds\n $cost = 8;\n\n do {\n $cost++;\n $start = microtime(true);\n password_hash(\"test\", PASSWORD_BCRYPT, [\"cost\" => $cost]);\n $end = microtime(true);\n } while (($end - $start) < $timeTarget);\n\n return $cost;\n }", "protected function passwordBuilder($password, $salt, $iterations) {\n\n $hashSalt = $salt ?? $this->salter();\n $hashIteration = $iterations ? (int)$iterations : self::ITERATIONS;\n $hashPassword = hash(self::ALGORITHM, $password, false);\n $finalPassword = hash_pbkdf2(\n self::ALGORITHM,\n $hashPassword,\n $hashSalt,\n $hashIteration);\n\n return array(\n 'iteration' => $hashIteration,\n 'salt' => $hashSalt,\n 'password' => $finalPassword\n );\n }", "function pkcs5Pad($text, $blocksize)\n{\n $pad = $blocksize - (strlen($text) % $blocksize);\n return ($text . str_repeat(chr($pad), $pad));\n}", "public static function getBestCost()\n {\n $timeTarget = 0.05;\n\n $cost = 8;\n do {\n $cost++;\n $start = microtime(true);\n password_hash(\"test\", PASSWORD_BCRYPT, [\"cost\" => $cost]);\n $end = microtime(true);\n } while (($end - $start) < $timeTarget);\n\n echo \"Best cost for this server is : \" . $cost . \"\\n\";\n }", "public function testPKCS8RC240(): void\n {\n\n // EncryptionAlgorithm: pbeWithSHAAnd40BitRC2-CBC\n\n $key = '-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIE6jAcBgoqhkiG9w0BDAEGMA4ECHzZ2FqUJyiCAgIIAASCBMiKVNJiU/1UCaoq\nV6VSX33gL8CjQqhzDEUlXhHoSYx7IWAJIx7C1DDgeLDfJ//cCMlBPbIOr6knohFQ\nKegbsulIYm2DXUQvEoivh02F4An2RLkP0JSMl5CmYTbiu/nJic2jdin+vaKWhRA8\nKznk5wEuhz4t6Oo4Hp3k3+0sd6YqLbmdcFCiYSXE52WN271VvUXqwz3TosUgOUVH\nYNzlER1xzNBFgcUyrfiyA+t5NaSDfpYncD64zXFz2KgkjcpfPBBMRnQ2I4mperbe\n3uUt8ZFCVeRiROWtx9WQgCVDDWztlrYzfEo/lFtNKjdseiYDj1/1gG6S2x5/S5dP\nLzEndNYiVEB2q9XrocrdKVumr7EqNe7C/AMNxuyfAoU2QV5SRyDDSRa1muYwHBa7\nx2XIThMS2tQLdN9bjJGcT653DKoq0Qwf1uMAOdHuqBLNXOpZw8PG8d3xmVHCyB4u\nrr5E48L2DmD0TwY3YBjfb3KCw/r/CvT1/cWkCpO90aNmSS4JMuOBiFlKaERMvXcw\nFfo0ErZWwlgDN40hQO7xySxI3Paz6/QbxXunVnFQkTclkcQG63K6nWO9fMtgxRaZ\nZGsv/jdWUZ6fBvOvW09zLvF2ZXKhTbfwU47C+2TefvENVz4rTAJcGgtF1wiFv1Lt\n0XT2FeJ6/jVGhk6745cHgOhsxqamOTuQ/y948ViMmR037INHouazD8dWHkjOY45d\nhy0DjRGIiig94/r+b7YZn81QUkk0HddyH4zi18f5Lx+ExiLDKaLqLv57PQ3ZCeBy\nv6Hoq/5tpZWCdXkLIAHx/a7ltiJQlyRUr8QcKPcGfr/qvIcYsUocHZ3iwkhxCnZ9\n77E2f/Owf8VaS3x4g5V6RYNlkhuqVixLq/3QyphykcqDK2g4PnWfq8prGY97jHXN\n+LZdwwV8LJkkoxCG1aehPlvtpGYGS75aeU1iFbqfke+gF2JG4LJZQsl1dAoL8R+X\nZdILuN+182CpwwptK4QmCvSWXk/ZJtYK9e6OtE1keLM4oQW122fxwyVkEnnAR2/f\nQc2U3WLk/UZSuhcHExxreWP4kiN8cYgSpw+k2uk7Xuw2kelu6hv6UzB4EtL8Xy4O\nkK7y6EjCkRJVqQoZ3vVny5408edc7Kh6bz0P5G4LIaCpvrcCYOJv2f57/lr8dMM6\nXcoZ0YIXATdUzKzhXKNFiib7SzBwFRRD+jMwzLnNeUhss8IUVl5LYwD6sOWbhdep\nLtUO2eXa74i6pa7sz1PLLWDZQ64f9fVPX7EEBy2LBVP3iLqLd2x/OHw+s7pTPT0G\nEgRpW0+IYBZGQjGN9s1VXXyhTm3RL03KeYls7aHmmcVqDqvozarqplN/kAhSGPmD\nN99FlSrIfihCEZlXO4iP2LRkJaFy11mU0ZvIMkDJ51fNO8PWypca4Rgi4azMCaiR\nHW/dtSBH2N8St0G80c2gUKXRmmJWFqebUIk4000VrpDcZlg0INC2unY0NwRFDe2a\n55/NR7TO9GdhWYDWsZedRatUFul5DWznncIfrXAD3T32gUR3I9zc62OFVsH2Dve3\noMZUabvnj3g1sQqiRgJyIe5aVZljgXMh0cdWjcUi34vOVBU8yOU921/jSinJWyH7\nGxyNlS3BiKQ22CLvbjc=\n-----END ENCRYPTED PRIVATE KEY-----';\n $pass = 'asdf';\n\n $this->pkcs8tester($key, $pass);\n }", "private function hashModeBcrypt($password)\n {\n $this->cwsDebug->titleH2('Create password hash using BCRYPT');\n $this->cwsDebug->labelValue('Password', $password);\n\n $ite = rand(self::BCRYPT_MIN_ITE, self::BCRYPT_MAX_ITE);\n $this->cwsDebug->labelValue('Iterations', $ite);\n\n $salt = $this->getBlowfishSalt($ite);\n $this->cwsDebug->labelValue('Salt', $salt);\n\n $hash = crypt($password, $salt);\n $this->cwsDebug->labelValue('Hash', $hash);\n $this->cwsDebug->labelValue('Length', strlen($hash));\n\n if (CRYPT_BLOWFISH == 1 && strlen($hash) == self::BCRYPT_LENGTH) {\n return $hash;\n }\n\n $this->error = 'Cannot generate the BCRYPT password hash...';\n $this->cwsDebug->error($this->error);\n }", "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}", "protected function _getEncryptionKeyByUserPassword($password = '') {}", "protected function _generatePrivateKey()\n {\n $rand = $this->_math->rand($this->getGenerator(), $this->getPrime());\n return $rand;\n }", "function svc_encryp( $num, $key ) {\r\n\t$now = (new \\DateTime())->format('YmdHis');\r\n\t$tx0 = $now . substr( '00000000000' . $num, -11 );\r\n\r\n\t//creating array \r\n\t$arr0 = array();\r\n\tfor ( $i = 0; $i < 25 ; $i++ ) {\r\n\t\t$arr0[] = substr( $tx0, $i, 1 );\r\n\t}\r\n\r\n\t//storing consistency\r\n\t$chk = \r\n\t\t$arr0[0]+\r\n\t\t$arr0[1]*2+\r\n\t\t$arr0[2]+\r\n\t\t$arr0[3]+\r\n\t\t$arr0[4]*13+\r\n\t\t$arr0[5]+\r\n\t\t$arr0[6]+\r\n\t\t$arr0[7]+\r\n\t\t$arr0[8]*7+\r\n\t\t$arr0[9]+\r\n\t\t$arr0[10]+\r\n\t\t$arr0[11]+\r\n\t\t$arr0[12]+\r\n\t\t$arr0[13]*45+\r\n\t\t$arr0[14]+\r\n\t\t$arr0[15]+\r\n\t\t$arr0[16]+\r\n\t\t$arr0[17]*11+\r\n\t\t$arr0[18]-\r\n\t\t$arr0[19]-\r\n\t\t$arr0[20]-\r\n\t\t$arr0[21]-\r\n\t\t$arr0[22]-\r\n\t\t$arr0[23]+\r\n\t\t$arr0[24];\r\n\t\r\n\t$chk = $chk * $key;\r\n\r\n\t//concatenating with check for consistency\t\t\r\n\t$tx0 = $tx0 . substr( '000' . $chk, -3 );\r\n\r\n\t//creating new array \r\n\t$arr1 = array();\r\n\tfor ( $i = 0; $i < 28 ; $i++ ) {\r\n\t\t$arr1[] = substr( $tx0, $i, 1 );\r\n\t}\r\n\r\n\t//creating new array and changin positions\r\n\t$arr2 = array();\r\n\t$arr2[] = $arr1[9];\r\n\t$arr2[] = $arr1[0];\r\n\t$arr2[] = $arr1[23];\r\n\t$arr2[] = $arr1[4];\r\n\t$arr2[] = $arr1[17];\r\n\t$arr2[] = $arr1[1];\r\n\t$arr2[] = $arr1[7];\r\n\t$arr2[] = $arr1[14];\r\n\t$arr2[] = $arr1[27];\r\n\t$arr2[] = $arr1[15];\r\n\t$arr2[] = $arr1[19];\r\n\t$arr2[] = $arr1[5];\r\n\t$arr2[] = $arr1[20];\r\n\t$arr2[] = $arr1[16];\r\n\t$arr2[] = $arr1[11];\r\n\t$arr2[] = $arr1[6];\r\n\t$arr2[] = $arr1[12];\r\n\t$arr2[] = $arr1[8];\r\n\t$arr2[] = $arr1[2];\r\n\t$arr2[] = $arr1[13];\r\n\t$arr2[] = $arr1[22];\r\n\t$arr2[] = $arr1[10];\r\n\t$arr2[] = $arr1[26];\r\n\t$arr2[] = $arr1[18];\r\n\t$arr2[] = $arr1[21];\r\n\t$arr2[] = $arr1[3];\r\n\t$arr2[] = $arr1[25];\r\n\t$arr2[] = $arr1[24];\r\n\t\r\n\t//concatenating\r\n\t$tx1 = rand( 1, 9 ); //first character = dummy\r\n\tfor ( $i = 0; $i < 28 ; $i++ ) {\r\n\t\t$tx1 = $tx1 . $arr2[$i];\r\n\t}\r\n\r\n\treturn $tx1;\r\n\t\r\n}", "private static function getCost(){\n\t $timeTarget = 0.2;\n\n\t\t\t$cost = 9;\n\t\t\tdo {\n\t\t\t\t$cost++;\n\t\t\t\t$start = microtime(true);\n\t\t\t\tpassword_hash(\"test\", PASSWORD_DEFAULT, [\"cost\" => $cost]);\n\t\t\t\t$end = microtime(true);\n\t\t\t}while(($end - $start) < $timeTarget);\n\n\t return [\"cost\" => $cost];\n\t }", "abstract public function createSecretKey();", "function Crypt_Rijndael($mode = CRYPT_RIJNDAEL_MODE_CBC)\r\n {\r\n switch ($mode) {\r\n case CRYPT_RIJNDAEL_MODE_ECB:\r\n case CRYPT_RIJNDAEL_MODE_CBC:\r\n $this->mode = $mode;\r\n break;\r\n default:\r\n $this->mode = CRYPT_RIJNDAEL_MODE_CBC;\r\n }\r\n\r\n // according to <http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=19> (section 5.2.1), \r\n // precomputed tables can be used in the mixColumns phase. in that example, they're assigned t0...t3, so\r\n // those are the names we'll use.\r\n $this->t3 = array(\r\n 0x6363A5C6, 0x7C7C84F8, 0x777799EE, 0x7B7B8DF6, 0xF2F20DFF, 0x6B6BBDD6, 0x6F6FB1DE, 0xC5C55491, \r\n 0x30305060, 0x01010302, 0x6767A9CE, 0x2B2B7D56, 0xFEFE19E7, 0xD7D762B5, 0xABABE64D, 0x76769AEC, \r\n 0xCACA458F, 0x82829D1F, 0xC9C94089, 0x7D7D87FA, 0xFAFA15EF, 0x5959EBB2, 0x4747C98E, 0xF0F00BFB, \r\n 0xADADEC41, 0xD4D467B3, 0xA2A2FD5F, 0xAFAFEA45, 0x9C9CBF23, 0xA4A4F753, 0x727296E4, 0xC0C05B9B, \r\n 0xB7B7C275, 0xFDFD1CE1, 0x9393AE3D, 0x26266A4C, 0x36365A6C, 0x3F3F417E, 0xF7F702F5, 0xCCCC4F83, \r\n 0x34345C68, 0xA5A5F451, 0xE5E534D1, 0xF1F108F9, 0x717193E2, 0xD8D873AB, 0x31315362, 0x15153F2A, \r\n 0x04040C08, 0xC7C75295, 0x23236546, 0xC3C35E9D, 0x18182830, 0x9696A137, 0x05050F0A, 0x9A9AB52F, \r\n 0x0707090E, 0x12123624, 0x80809B1B, 0xE2E23DDF, 0xEBEB26CD, 0x2727694E, 0xB2B2CD7F, 0x75759FEA, \r\n 0x09091B12, 0x83839E1D, 0x2C2C7458, 0x1A1A2E34, 0x1B1B2D36, 0x6E6EB2DC, 0x5A5AEEB4, 0xA0A0FB5B, \r\n 0x5252F6A4, 0x3B3B4D76, 0xD6D661B7, 0xB3B3CE7D, 0x29297B52, 0xE3E33EDD, 0x2F2F715E, 0x84849713, \r\n 0x5353F5A6, 0xD1D168B9, 0x00000000, 0xEDED2CC1, 0x20206040, 0xFCFC1FE3, 0xB1B1C879, 0x5B5BEDB6, \r\n 0x6A6ABED4, 0xCBCB468D, 0xBEBED967, 0x39394B72, 0x4A4ADE94, 0x4C4CD498, 0x5858E8B0, 0xCFCF4A85, \r\n 0xD0D06BBB, 0xEFEF2AC5, 0xAAAAE54F, 0xFBFB16ED, 0x4343C586, 0x4D4DD79A, 0x33335566, 0x85859411, \r\n 0x4545CF8A, 0xF9F910E9, 0x02020604, 0x7F7F81FE, 0x5050F0A0, 0x3C3C4478, 0x9F9FBA25, 0xA8A8E34B, \r\n 0x5151F3A2, 0xA3A3FE5D, 0x4040C080, 0x8F8F8A05, 0x9292AD3F, 0x9D9DBC21, 0x38384870, 0xF5F504F1, \r\n 0xBCBCDF63, 0xB6B6C177, 0xDADA75AF, 0x21216342, 0x10103020, 0xFFFF1AE5, 0xF3F30EFD, 0xD2D26DBF, \r\n 0xCDCD4C81, 0x0C0C1418, 0x13133526, 0xECEC2FC3, 0x5F5FE1BE, 0x9797A235, 0x4444CC88, 0x1717392E, \r\n 0xC4C45793, 0xA7A7F255, 0x7E7E82FC, 0x3D3D477A, 0x6464ACC8, 0x5D5DE7BA, 0x19192B32, 0x737395E6, \r\n 0x6060A0C0, 0x81819819, 0x4F4FD19E, 0xDCDC7FA3, 0x22226644, 0x2A2A7E54, 0x9090AB3B, 0x8888830B, \r\n 0x4646CA8C, 0xEEEE29C7, 0xB8B8D36B, 0x14143C28, 0xDEDE79A7, 0x5E5EE2BC, 0x0B0B1D16, 0xDBDB76AD, \r\n 0xE0E03BDB, 0x32325664, 0x3A3A4E74, 0x0A0A1E14, 0x4949DB92, 0x06060A0C, 0x24246C48, 0x5C5CE4B8, \r\n 0xC2C25D9F, 0xD3D36EBD, 0xACACEF43, 0x6262A6C4, 0x9191A839, 0x9595A431, 0xE4E437D3, 0x79798BF2, \r\n 0xE7E732D5, 0xC8C8438B, 0x3737596E, 0x6D6DB7DA, 0x8D8D8C01, 0xD5D564B1, 0x4E4ED29C, 0xA9A9E049, \r\n 0x6C6CB4D8, 0x5656FAAC, 0xF4F407F3, 0xEAEA25CF, 0x6565AFCA, 0x7A7A8EF4, 0xAEAEE947, 0x08081810, \r\n 0xBABAD56F, 0x787888F0, 0x25256F4A, 0x2E2E725C, 0x1C1C2438, 0xA6A6F157, 0xB4B4C773, 0xC6C65197, \r\n 0xE8E823CB, 0xDDDD7CA1, 0x74749CE8, 0x1F1F213E, 0x4B4BDD96, 0xBDBDDC61, 0x8B8B860D, 0x8A8A850F, \r\n 0x707090E0, 0x3E3E427C, 0xB5B5C471, 0x6666AACC, 0x4848D890, 0x03030506, 0xF6F601F7, 0x0E0E121C, \r\n 0x6161A3C2, 0x35355F6A, 0x5757F9AE, 0xB9B9D069, 0x86869117, 0xC1C15899, 0x1D1D273A, 0x9E9EB927, \r\n 0xE1E138D9, 0xF8F813EB, 0x9898B32B, 0x11113322, 0x6969BBD2, 0xD9D970A9, 0x8E8E8907, 0x9494A733, \r\n 0x9B9BB62D, 0x1E1E223C, 0x87879215, 0xE9E920C9, 0xCECE4987, 0x5555FFAA, 0x28287850, 0xDFDF7AA5, \r\n 0x8C8C8F03, 0xA1A1F859, 0x89898009, 0x0D0D171A, 0xBFBFDA65, 0xE6E631D7, 0x4242C684, 0x6868B8D0, \r\n 0x4141C382, 0x9999B029, 0x2D2D775A, 0x0F0F111E, 0xB0B0CB7B, 0x5454FCA8, 0xBBBBD66D, 0x16163A2C\r\n );\r\n\r\n $this->dt3 = array(\r\n 0xF4A75051, 0x4165537E, 0x17A4C31A, 0x275E963A, 0xAB6BCB3B, 0x9D45F11F, 0xFA58ABAC, 0xE303934B, \r\n 0x30FA5520, 0x766DF6AD, 0xCC769188, 0x024C25F5, 0xE5D7FC4F, 0x2ACBD7C5, 0x35448026, 0x62A38FB5, \r\n 0xB15A49DE, 0xBA1B6725, 0xEA0E9845, 0xFEC0E15D, 0x2F7502C3, 0x4CF01281, 0x4697A38D, 0xD3F9C66B, \r\n 0x8F5FE703, 0x929C9515, 0x6D7AEBBF, 0x5259DA95, 0xBE832DD4, 0x7421D358, 0xE0692949, 0xC9C8448E, \r\n 0xC2896A75, 0x8E7978F4, 0x583E6B99, 0xB971DD27, 0xE14FB6BE, 0x88AD17F0, 0x20AC66C9, 0xCE3AB47D, \r\n 0xDF4A1863, 0x1A3182E5, 0x51336097, 0x537F4562, 0x6477E0B1, 0x6BAE84BB, 0x81A01CFE, 0x082B94F9, \r\n 0x48685870, 0x45FD198F, 0xDE6C8794, 0x7BF8B752, 0x73D323AB, 0x4B02E272, 0x1F8F57E3, 0x55AB2A66, \r\n 0xEB2807B2, 0xB5C2032F, 0xC57B9A86, 0x3708A5D3, 0x2887F230, 0xBFA5B223, 0x036ABA02, 0x16825CED, \r\n 0xCF1C2B8A, 0x79B492A7, 0x07F2F0F3, 0x69E2A14E, 0xDAF4CD65, 0x05BED506, 0x34621FD1, 0xA6FE8AC4, \r\n 0x2E539D34, 0xF355A0A2, 0x8AE13205, 0xF6EB75A4, 0x83EC390B, 0x60EFAA40, 0x719F065E, 0x6E1051BD, \r\n 0x218AF93E, 0xDD063D96, 0x3E05AEDD, 0xE6BD464D, 0x548DB591, 0xC45D0571, 0x06D46F04, 0x5015FF60, \r\n 0x98FB2419, 0xBDE997D6, 0x4043CC89, 0xD99E7767, 0xE842BDB0, 0x898B8807, 0x195B38E7, 0xC8EEDB79, \r\n 0x7C0A47A1, 0x420FE97C, 0x841EC9F8, 0x00000000, 0x80868309, 0x2BED4832, 0x1170AC1E, 0x5A724E6C, \r\n 0x0EFFFBFD, 0x8538560F, 0xAED51E3D, 0x2D392736, 0x0FD9640A, 0x5CA62168, 0x5B54D19B, 0x362E3A24, \r\n 0x0A67B10C, 0x57E70F93, 0xEE96D2B4, 0x9B919E1B, 0xC0C54F80, 0xDC20A261, 0x774B695A, 0x121A161C, \r\n 0x93BA0AE2, 0xA02AE5C0, 0x22E0433C, 0x1B171D12, 0x090D0B0E, 0x8BC7ADF2, 0xB6A8B92D, 0x1EA9C814, \r\n 0xF1198557, 0x75074CAF, 0x99DDBBEE, 0x7F60FDA3, 0x01269FF7, 0x72F5BC5C, 0x663BC544, 0xFB7E345B, \r\n 0x4329768B, 0x23C6DCCB, 0xEDFC68B6, 0xE4F163B8, 0x31DCCAD7, 0x63851042, 0x97224013, 0xC6112084, \r\n 0x4A247D85, 0xBB3DF8D2, 0xF93211AE, 0x29A16DC7, 0x9E2F4B1D, 0xB230F3DC, 0x8652EC0D, 0xC1E3D077, \r\n 0xB3166C2B, 0x70B999A9, 0x9448FA11, 0xE9642247, 0xFC8CC4A8, 0xF03F1AA0, 0x7D2CD856, 0x3390EF22, \r\n 0x494EC787, 0x38D1C1D9, 0xCAA2FE8C, 0xD40B3698, 0xF581CFA6, 0x7ADE28A5, 0xB78E26DA, 0xADBFA43F, \r\n 0x3A9DE42C, 0x78920D50, 0x5FCC9B6A, 0x7E466254, 0x8D13C2F6, 0xD8B8E890, 0x39F75E2E, 0xC3AFF582, \r\n 0x5D80BE9F, 0xD0937C69, 0xD52DA96F, 0x2512B3CF, 0xAC993BC8, 0x187DA710, 0x9C636EE8, 0x3BBB7BDB, \r\n 0x267809CD, 0x5918F46E, 0x9AB701EC, 0x4F9AA883, 0x956E65E6, 0xFFE67EAA, 0xBCCF0821, 0x15E8E6EF, \r\n 0xE79BD9BA, 0x6F36CE4A, 0x9F09D4EA, 0xB07CD629, 0xA4B2AF31, 0x3F23312A, 0xA59430C6, 0xA266C035, \r\n 0x4EBC3774, 0x82CAA6FC, 0x90D0B0E0, 0xA7D81533, 0x04984AF1, 0xECDAF741, 0xCD500E7F, 0x91F62F17, \r\n 0x4DD68D76, 0xEFB04D43, 0xAA4D54CC, 0x9604DFE4, 0xD1B5E39E, 0x6A881B4C, 0x2C1FB8C1, 0x65517F46, \r\n 0x5EEA049D, 0x8C355D01, 0x877473FA, 0x0B412EFB, 0x671D5AB3, 0xDBD25292, 0x105633E9, 0xD647136D, \r\n 0xD7618C9A, 0xA10C7A37, 0xF8148E59, 0x133C89EB, 0xA927EECE, 0x61C935B7, 0x1CE5EDE1, 0x47B13C7A, \r\n 0xD2DF599C, 0xF2733F55, 0x14CE7918, 0xC737BF73, 0xF7CDEA53, 0xFDAA5B5F, 0x3D6F14DF, 0x44DB8678, \r\n 0xAFF381CA, 0x68C43EB9, 0x24342C38, 0xA3405FC2, 0x1DC37216, 0xE2250CBC, 0x3C498B28, 0x0D9541FF, \r\n 0xA8017139, 0x0CB3DE08, 0xB4E49CD8, 0x56C19064, 0xCB84617B, 0x32B670D5, 0x6C5C7448, 0xB85742D0\r\n );\r\n\r\n for ($i = 0; $i < 256; $i++) {\r\n $this->t2[$i << 8] = (($this->t3[$i] << 8) & 0xFFFFFF00) | (($this->t3[$i] >> 24) & 0x000000FF);\r\n $this->t1[$i << 16] = (($this->t3[$i] << 16) & 0xFFFF0000) | (($this->t3[$i] >> 16) & 0x0000FFFF);\r\n $this->t0[$i << 24] = (($this->t3[$i] << 24) & 0xFF000000) | (($this->t3[$i] >> 8) & 0x00FFFFFF);\r\n\r\n $this->dt2[$i << 8] = (($this->dt3[$i] << 8) & 0xFFFFFF00) | (($this->dt3[$i] >> 24) & 0x000000FF);\r\n $this->dt1[$i << 16] = (($this->dt3[$i] << 16) & 0xFFFF0000) | (($this->dt3[$i] >> 16) & 0x0000FFFF);\r\n $this->dt0[$i << 24] = (($this->dt3[$i] << 24) & 0xFF000000) | (($this->dt3[$i] >> 8) & 0x00FFFFFF);\r\n }\r\n }", "static function password_hash($password, $algo, $options = array()) {\n/**/ if (!function_exists('crypt') || 0 === PASSWORD_DEFAULT) {\n if ($algo) {\n trigger_error(\"Crypt must be loaded for password_hash to function\", E_USER_WARNING);\n return null;\n }\n/**/ }\n if (!is_string($password)) {\n trigger_error(\"password_hash(): Password must be a string\", E_USER_WARNING);\n return null;\n }\n if (!is_int($algo)) {\n trigger_error(\"password_hash() expects parameter 2 to be long, \" . gettype($algo) . \" given\", E_USER_WARNING);\n return null;\n }\n switch ($algo) {\n case 0:\n case PASSWORD_BCRYPT:\n // Note that this is a C constant, but not exposed to PHP, so we don't define it here.\n $cost = 10;\n if (isset($options['cost'])) {\n $cost = $options['cost'];\n if ($cost < 4 || $cost > 31) {\n trigger_error(sprintf(\"password_hash(): Invalid cost parameter specified: %d\", $cost), E_USER_WARNING);\n return null;\n }\n }\n/**/ if (0 === PASSWORD_DEFAULT) {\n $crypt = __CLASS__ . '::crypt_md5';\n $required_salt_len = 8;\n $hash_format = '$P$' . self::$itoa64[min($cost + 5, 30)];\n break;\n/**/ } else {\n $required_salt_len = 22;\n $hash_format = sprintf(/*<*/$bcrypt_2y ? \"$2y$%02d$\" : \"$2a$%02d$\"/*>*/, $cost);\n break;\n/**/ }\n default:\n trigger_error(sprintf(\"password_hash(): Unknown password hashing algorithm: %s\", $algo), E_USER_WARNING);\n return null;\n }\n if (isset($options['salt'])) {\n switch (gettype($options['salt'])) {\n case 'NULL':\n case 'boolean':\n case 'integer':\n case 'double':\n case 'string':\n $salt = (string) $options['salt'];\n break;\n case 'object':\n if (method_exists($options['salt'], '__tostring')) {\n $salt = (string) $options['salt'];\n break;\n }\n case 'array':\n case 'resource':\n default:\n trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING);\n return null;\n }\n if (strlen($salt) < $required_salt_len) {\n trigger_error(sprintf(\"password_hash(): Provided salt is too short: %d expecting %d\", strlen($salt), $required_salt_len), E_USER_WARNING);\n return null;\n } elseif (0 == preg_match('#^[a-zA-Z0-9./]+$#D', $salt)) {\n $salt = str_replace('+', '.', base64_encode($salt));\n }\n } else {\n $salt = '';\n $raw_length = (int) (.75 * $required_salt_len);\n $raw_length += 4 - $raw_length % 4;\n/**/ if (function_exists('mcrypt_create_iv') && false !== @mcrypt_create_iv(1, MCRYPT_DEV_URANDOM)) {\n $salt = mcrypt_create_iv($raw_length, MCRYPT_DEV_URANDOM);\n/**/ }\n/**/ if (function_exists('openssl_random_pseudo_bytes')) {\n $salt or $salt = openssl_random_pseudo_bytes($raw_length);\n/**/ }\n/**/ if (@file_exists('/dev/urandom') && false !== @file_get_contents('/dev/urandom', false, null, -1, 1)) {\n $salt or $salt = file_get_contents('/dev/urandom', false, null, -1, $raw_length);\n/**/ }\n if (0 < $raw_length -= strlen($salt)) {\n $salt .= str_repeat(' ', $raw_length);\n $i = 0;\n while ($i < $raw_length) {\n $ret = pack('L', mt_rand());\n $salt[$i] = $salt[$i++] ^ $ret[0];\n $salt[$i] = $salt[$i++] ^ $ret[1];\n $salt[$i] = $salt[$i++] ^ $ret[2];\n $salt[$i] = $salt[$i++] ^ $ret[3];\n }\n }\n\n $salt = str_replace('+', '.', base64_encode($salt));\n }\n $salt = substr($salt, 0, $required_salt_len);\n\n $ret = isset($crypt)\n ? call_user_func($crypt, $password, $hash_format . $salt)\n : crypt($password, $hash_format . $salt);\n\n if (!is_string($ret) || strlen($ret) <= 13) {\n return false;\n }\n\n/**/ if (PASSWORD_DEFAULT && !$bcrypt_2y)\n $ret[2] = 'x';\n\n return $ret;\n }", "protected abstract function getSecretKey();", "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}", "function pacrypt ($pw, $pw_db=\"\") {\n\n\tglobal $CONF, $MAGIC;\n\t\n\tif( isset( $CONF['pwcrypt'] ) ) {\n\t\t\n\t\t$crypt\t\t\t\t\t\t= $CONF['pwcrypt'];\n\t\t\n\t} else {\n\t\t\n\t\t$crypt\t\t\t\t\t\t= \"crypt\";\n\t\t\n\t}\n\t\n\t$size\t\t\t\t\t\t\t= strlen( $MAGIC );\n\tif( substr($pw_db, 0, $size) == $MAGIC ) {\n\t\t# md5 crypted password\n\t\t\n\t\t$split_salt \t\t\t\t= preg_split ('/\\$/', $pw_db);\n \tif (isset ($split_salt[2])) { \n \t\t\n \t\t$salt\t\t\t\t\t = $split_salt[2];\n \t}\n \t\n \t$password \t\t\t\t\t= md5crypt( $pw, $salt );\n \n\t} elseif( $pw_db != \"\" ) {\n\t\t\n\t\t$salt \t\t\t\t\t\t= substr( $pw_db, 0, 2);\n\t\t$password \t\t\t\t\t= crypt ($pw, $salt);\n\t\t\n\t} else {\n\t\t\n\t\tif( $crypt == \"md5\" ) {\n\t\t\t\n\t\t\t$password\t\t\t\t= md5crypt( $pw );\n\t\t\t\n\t\t} else {\n\t\t\n\t\t\tsrand((double)microtime()*1000000);\n\t\t\n\t\t\t$s1 \t\t\t\t\t= chr( rand( 1, 255 ) );\n\t\t\t$s2 \t\t\t\t\t= chr( rand( 1, 255 ) );\n\t\t\t$salt \t\t\t\t\t= $s1.$s2;\t\n\t\t\t$password \t\t\t\t= crypt ($pw, $salt);\t\t\n\t\t}\n\t}\n\t\n\treturn $password;\n}", "function gensalt_blowfish($input) {\n # different encoding scheme from the one in encode64() above.\n # We care because the last character in our encoded string will\n # only represent 2 bits. While two known implementations of\n # bcrypt will happily accept and correct a salt string which\n # has the 4 unused bits set to non-zero, we do not want to take\n # chances and we also do not want to waste an additional byte\n # of entropy.\n $itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n\n $output = '$2a$';\n $output .= chr(ord('0') + $this->iteration_count_log2 / 10);\n $output .= chr(ord('0') + $this->iteration_count_log2 % 10);\n $output .= '$';\n\n $i = 0;\n do {\n $c1 = ord($input[$i++]);\n $output .= $itoa64[$c1 >> 2];\n $c1 = ($c1 & 0x03) << 4;\n if ($i >= 16) {\n $output .= $itoa64[$c1];\n break;\n }\n\n $c2 = ord($input[$i++]);\n $c1 |= $c2 >> 4;\n $output .= $itoa64[$c1];\n $c1 = ($c2 & 0x0f) << 2;\n\n $c2 = ord($input[$i++]);\n $c1 |= $c2 >> 6;\n $output .= $itoa64[$c1];\n $output .= $itoa64[$c2 & 0x3f];\n } while (1);\n\n return $output;\n }", "function encriptar_blowfish ($password, $digito = 7) { \n\t$set_salt = './1234567890ABCDEFGHIJKLMNÑOPQRSTUVWXYZabcdefghijklmnñopqrstuvwxyz*#!%&$'; \n\t$salt = sprintf('$2a$%02d$', $digito); \n\tfor($i = 0; $i < 22; $i++) \n\t{ \n\t\t$salt .= $set_salt[mt_rand(0, 63)]; \n\t} \n\n\t $password=password_hash($password, PASSWORD_BCRYPT);\n\n\t\treturn $password;\n\n\t}", "function gensalt_blowfish( $input )\n\t{\n\t\t# different encoding scheme from the one in encode64() above.\n\t\t# We care because the last character in our encoded string will\n\t\t# only represent 2 bits. While two known implementations of\n\t\t# bcrypt will happily accept and correct a salt string which\n\t\t# has the 4 unused bits set to non-zero, we do not want to take\n\t\t# chances and we also do not want to waste an additional byte\n\t\t# of entropy.\n\t\t$itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n\t\t\n\t\t$output = '$2a$';\n\t\t$output .= chr( ord( '0' ) + $this->iteration_count_log2 / 10 );\n\t\t$output .= chr( ord( '0' ) + $this->iteration_count_log2 % 10 );\n\t\t$output .= '$';\n\t\t\n\t\t$i = 0;\n\t\tdo\n\t\t{\n\t\t\t$c1 = ord( $input[ $i ++ ] );\n\t\t\t$output .= $itoa64[ $c1 >> 2 ];\n\t\t\t$c1 = ( $c1 & 0x03 ) << 4;\n\t\t\tif ( $i >= 16 )\n\t\t\t{\n\t\t\t\t$output .= $itoa64[ $c1 ];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\t$c2 = ord( $input[ $i ++ ] );\n\t\t\t$c1 |= $c2 >> 4;\n\t\t\t$output .= $itoa64[ $c1 ];\n\t\t\t$c1 = ( $c2 & 0x0f ) << 2;\n\t\t\t\n\t\t\t$c2 = ord( $input[ $i ++ ] );\n\t\t\t$c1 |= $c2 >> 6;\n\t\t\t$output .= $itoa64[ $c1 ];\n\t\t\t$output .= $itoa64[ $c2 & 0x3f ];\n\t\t}\n\t\twhile ( 1 );\n\t\t\n\t\treturn $output;\n\t}", "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 mysql_aes_key($key)\n{\n $bytes = 16;\n $newKey = \\str_repeat(\\chr(0), $bytes);\n $length = \\strlen($key);\n\n for ($i = 0; $i < $length; $i++) {\n $index = $i % $bytes;\n $newKey[$index] = $newKey[$index] ^ $key[$i];\n }\n\n return $newKey;\n}", "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 initEncryptionKeys(array &$keys, $password)\n {\n /*\n 6.1.5 Initializing the encryption keys\n\n Key(0) <- 305419896\n Key(1) <- 591751049\n Key(2) <- 878082192\n\n loop for i <- 0 to length(password)-1\n update_keys(password(i))\n end loop\n */\n\n $keys = array(0x12345678, 0x23456789, 0x34567890);\n $len = strlen($password);\n\n for ($i = 0; $i < $len; ++$i) {\n self::updateEncryptionKeys($keys, ord($password{$i}));\n }\n }", "function wg_gen_psk() {\n\tglobal $wgg;\n\n\t$psk = exec(\"{$wgg['wg']} genpsk\");\n\n\treturn $psk;\n\t\n}", "function des_createKeys (key) {\r\n //declaring this locally speeds things up a bit\r\n pc2bytes0 = new Array (0,0x4,0x20000000,0x20000004,0x10000,0x10004,0x20010000,0x20010004,0x200,0x204,0x20000200,0x20000204,0x10200,0x10204,0x20010200,0x20010204);\r\n pc2bytes1 = new Array (0,0x1,0x100000,0x100001,0x4000000,0x4000001,0x4100000,0x4100001,0x100,0x101,0x100100,0x100101,0x4000100,0x4000101,0x4100100,0x4100101);\r\n pc2bytes2 = new Array (0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808,0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808);\r\n pc2bytes3 = new Array (0,0x200000,0x8000000,0x8200000,0x2000,0x202000,0x8002000,0x8202000,0x20000,0x220000,0x8020000,0x8220000,0x22000,0x222000,0x8022000,0x8222000);\r\n pc2bytes4 = new Array (0,0x40000,0x10,0x40010,0,0x40000,0x10,0x40010,0x1000,0x41000,0x1010,0x41010,0x1000,0x41000,0x1010,0x41010);\r\n pc2bytes5 = new Array (0,0x400,0x20,0x420,0,0x400,0x20,0x420,0x2000000,0x2000400,0x2000020,0x2000420,0x2000000,0x2000400,0x2000020,0x2000420);\r\n pc2bytes6 = new Array (0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002,0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002);\r\n pc2bytes7 = new Array (0,0x10000,0x800,0x10800,0x20000000,0x20010000,0x20000800,0x20010800,0x20000,0x30000,0x20800,0x30800,0x20020000,0x20030000,0x20020800,0x20030800);\r\n pc2bytes8 = new Array (0,0x40000,0,0x40000,0x2,0x40002,0x2,0x40002,0x2000000,0x2040000,0x2000000,0x2040000,0x2000002,0x2040002,0x2000002,0x2040002);\r\n pc2bytes9 = new Array (0,0x10000000,0x8,0x10000008,0,0x10000000,0x8,0x10000008,0x400,0x10000400,0x408,0x10000408,0x400,0x10000400,0x408,0x10000408);\r\n pc2bytes10 = new Array (0,0x20,0,0x20,0x100000,0x100020,0x100000,0x100020,0x2000,0x2020,0x2000,0x2020,0x102000,0x102020,0x102000,0x102020);\r\n pc2bytes11 = new Array (0,0x1000000,0x200,0x1000200,0x200000,0x1200000,0x200200,0x1200200,0x4000000,0x5000000,0x4000200,0x5000200,0x4200000,0x5200000,0x4200200,0x5200200);\r\n pc2bytes12 = new Array (0,0x1000,0x8000000,0x8001000,0x80000,0x81000,0x8080000,0x8081000,0x10,0x1010,0x8000010,0x8001010,0x80010,0x81010,0x8080010,0x8081010);\r\n pc2bytes13 = new Array (0,0x4,0x100,0x104,0,0x4,0x100,0x104,0x1,0x5,0x101,0x105,0x1,0x5,0x101,0x105);\r\n\r\n //how many iterations (1 for des, 3 for triple des)\r\n var iterations = key.length > 8 ? 3 : 1; //changed by Paul 16/6/2007 to use Triple DES for 9+ byte keys\r\n //stores the return keys\r\n var keys = new Array (32 * iterations);\r\n //now define the left shifts which need to be done\r\n var shifts = new Array (0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0);\r\n //other variables\r\n var lefttemp, righttemp, m=0, n=0, temp;\r\n\r\n for (var j=0; j<iterations; j++) { //either 1 or 3 iterations\r\n left = (key.charCodeAt(m++) << 24) | (key.charCodeAt(m++) << 16) | (key.charCodeAt(m++) << 8) | key.charCodeAt(m++);\r\n right = (key.charCodeAt(m++) << 24) | (key.charCodeAt(m++) << 16) | (key.charCodeAt(m++) << 8) | key.charCodeAt(m++);\r\n\r\n temp = ((left >>> 4) ^ right) & 0x0f0f0f0f; right ^= temp; left ^= (temp << 4);\r\n temp = ((right >>> -16) ^ left) & 0x0000ffff; left ^= temp; right ^= (temp << -16);\r\n temp = ((left >>> 2) ^ right) & 0x33333333; right ^= temp; left ^= (temp << 2);\r\n temp = ((right >>> -16) ^ left) & 0x0000ffff; left ^= temp; right ^= (temp << -16);\r\n temp = ((left >>> 1) ^ right) & 0x55555555; right ^= temp; left ^= (temp << 1);\r\n temp = ((right >>> 8) ^ left) & 0x00ff00ff; left ^= temp; right ^= (temp << 8);\r\n temp = ((left >>> 1) ^ right) & 0x55555555; right ^= temp; left ^= (temp << 1);\r\n\r\n //the right side needs to be shifted and to get the last four bits of the left side\r\n temp = (left << 8) | ((right >>> 20) & 0x000000f0);\r\n //left needs to be put upside down\r\n left = (right << 24) | ((right << 8) & 0xff0000) | ((right >>> 8) & 0xff00) | ((right >>> 24) & 0xf0);\r\n right = temp;\r\n\r\n //now go through and perform these shifts on the left and right keys\r\n for (var i=0; i < shifts.length; i++) {\r\n //shift the keys either one or two bits to the left\r\n if (shifts[i]) {left = (left << 2) | (left >>> 26); right = (right << 2) | (right >>> 26);}\r\n else {left = (left << 1) | (left >>> 27); right = (right << 1) | (right >>> 27);}\r\n left &= -0xf; right &= -0xf;\r\n\r\n //now apply PC-2, in such a way that E is easier when encrypting or decrypting\r\n //this conversion will look like PC-2 except only the last 6 bits of each byte are used\r\n //rather than 48 consecutive bits and the order of lines will be according to \r\n //how the S selection functions will be applied: S2, S4, S6, S8, S1, S3, S5, S7\r\n lefttemp = pc2bytes0[left >>> 28] | pc2bytes1[(left >>> 24) & 0xf]\r\n | pc2bytes2[(left >>> 20) & 0xf] | pc2bytes3[(left >>> 16) & 0xf]\r\n | pc2bytes4[(left >>> 12) & 0xf] | pc2bytes5[(left >>> 8) & 0xf]\r\n | pc2bytes6[(left >>> 4) & 0xf];\r\n righttemp = pc2bytes7[right >>> 28] | pc2bytes8[(right >>> 24) & 0xf]\r\n | pc2bytes9[(right >>> 20) & 0xf] | pc2bytes10[(right >>> 16) & 0xf]\r\n | pc2bytes11[(right >>> 12) & 0xf] | pc2bytes12[(right >>> 8) & 0xf]\r\n | pc2bytes13[(right >>> 4) & 0xf];\r\n temp = ((righttemp >>> 16) ^ lefttemp) & 0x0000ffff; \r\n keys[n++] = lefttemp ^ temp; keys[n++] = righttemp ^ (temp << 16);\r\n }\r\n } //for each iterations\r\n //return the keys we've created\r\n return keys;\r\n}", "function hash_clients_pass($pass){\n\t//Get pepper options\n\t// require_once 'api-config.php';\n\n\t// echo \"<br>SHIT<br> \". getPepper() . \"<br>\";\n\t// $pepper = getPepper() ;\n\n\t$config_options = getConfigOptions();\n\n\t$pepper = $config_options['pepper'];\n\t$cost = $config_options['peppercost'];\n\n\t$hashedPass = password_hash($pass.$pepper, PASSWORD_DEFAULT, $cost);\n\n\treturn $hashedPass;\n}", "protected function generateEncryptionKeyIfNeeded() {}", "public function generateTwoFactorSecret()\n {\n return $this->start()->uri(\"/api/two-factor/secret\")\n ->get()\n ->go();\n }", "function createKey($bits = 1024, $timeout = false, $partial = array())\n {\n if (!defined('CRYPT_RSA_EXPONENT')) {\n // http://en.wikipedia.org/wiki/65537_%28number%29\n define('CRYPT_RSA_EXPONENT', '65537');\n }\n // per <http://cseweb.ucsd.edu/~hovav/dist/survey.pdf#page=5>, this number ought not result in primes smaller\n // than 256 bits. as a consequence if the key you're trying to create is 1024 bits and you've set CRYPT_RSA_SMALLEST_PRIME\n // to 384 bits then you're going to get a 384 bit prime and a 640 bit prime (384 + 1024 % 384). at least if\n // CRYPT_RSA_MODE is set to self::MODE_INTERNAL. if CRYPT_RSA_MODE is set to self::MODE_OPENSSL then\n // CRYPT_RSA_SMALLEST_PRIME is ignored (ie. multi-prime RSA support is more intended as a way to speed up RSA key\n // generation when there's a chance neither gmp nor OpenSSL are installed)\n if (!defined('CRYPT_RSA_SMALLEST_PRIME')) {\n define('CRYPT_RSA_SMALLEST_PRIME', 4096);\n }\n\n // OpenSSL uses 65537 as the exponent and requires RSA keys be 384 bits minimum\n if (CRYPT_RSA_MODE == self::MODE_OPENSSL && $bits >= 384 && CRYPT_RSA_EXPONENT == 65537) {\n $config = array();\n if (isset($this->configFile)) {\n $config['config'] = $this->configFile;\n }\n $rsa = openssl_pkey_new(array('private_key_bits' => $bits) + $config);\n openssl_pkey_export($rsa, $privatekey, null, $config);\n $publickey = openssl_pkey_get_details($rsa);\n $publickey = $publickey['key'];\n\n $privatekey = call_user_func_array(array($this, '_convertPrivateKey'), array_values($this->_parseKey($privatekey, self::PRIVATE_FORMAT_PKCS1)));\n $publickey = call_user_func_array(array($this, '_convertPublicKey'), array_values($this->_parseKey($publickey, self::PUBLIC_FORMAT_PKCS1)));\n\n // clear the buffer of error strings stemming from a minimalistic openssl.cnf\n while (openssl_error_string() !== false) {\n }\n\n return array(\n 'privatekey' => $privatekey,\n 'publickey' => $publickey,\n 'partialkey' => false\n );\n }\n\n static $e;\n if (!isset($e)) {\n $e = new BigInteger(CRYPT_RSA_EXPONENT);\n }\n\n extract($this->_generateMinMax($bits));\n $absoluteMin = $min;\n $temp = $bits >> 1; // divide by two to see how many bits P and Q would be\n if ($temp > CRYPT_RSA_SMALLEST_PRIME) {\n $num_primes = floor($bits / CRYPT_RSA_SMALLEST_PRIME);\n $temp = CRYPT_RSA_SMALLEST_PRIME;\n } else {\n $num_primes = 2;\n }\n extract($this->_generateMinMax($temp + $bits % $temp));\n $finalMax = $max;\n extract($this->_generateMinMax($temp));\n\n $generator = new BigInteger();\n\n $n = $this->one->copy();\n if (!empty($partial)) {\n extract(unserialize($partial));\n } else {\n $exponents = $coefficients = $primes = array();\n $lcm = array(\n 'top' => $this->one->copy(),\n 'bottom' => false\n );\n }\n\n $start = time();\n $i0 = count($primes) + 1;\n\n do {\n for ($i = $i0; $i <= $num_primes; $i++) {\n if ($timeout !== false) {\n $timeout-= time() - $start;\n $start = time();\n if ($timeout <= 0) {\n return array(\n 'privatekey' => '',\n 'publickey' => '',\n 'partialkey' => serialize(array(\n 'primes' => $primes,\n 'coefficients' => $coefficients,\n 'lcm' => $lcm,\n 'exponents' => $exponents\n ))\n );\n }\n }\n\n if ($i == $num_primes) {\n list($min, $temp) = $absoluteMin->divide($n);\n if (!$temp->equals($this->zero)) {\n $min = $min->add($this->one); // ie. ceil()\n }\n $primes[$i] = $generator->randomPrime($min, $finalMax, $timeout);\n } else {\n $primes[$i] = $generator->randomPrime($min, $max, $timeout);\n }\n\n if ($primes[$i] === false) { // if we've reached the timeout\n if (count($primes) > 1) {\n $partialkey = '';\n } else {\n array_pop($primes);\n $partialkey = serialize(array(\n 'primes' => $primes,\n 'coefficients' => $coefficients,\n 'lcm' => $lcm,\n 'exponents' => $exponents\n ));\n }\n\n return array(\n 'privatekey' => '',\n 'publickey' => '',\n 'partialkey' => $partialkey\n );\n }\n\n // the first coefficient is calculated differently from the rest\n // ie. instead of being $primes[1]->modInverse($primes[2]), it's $primes[2]->modInverse($primes[1])\n if ($i > 2) {\n $coefficients[$i] = $n->modInverse($primes[$i]);\n }\n\n $n = $n->multiply($primes[$i]);\n\n $temp = $primes[$i]->subtract($this->one);\n\n // textbook RSA implementations use Euler's totient function instead of the least common multiple.\n // see http://en.wikipedia.org/wiki/Euler%27s_totient_function\n $lcm['top'] = $lcm['top']->multiply($temp);\n $lcm['bottom'] = $lcm['bottom'] === false ? $temp : $lcm['bottom']->gcd($temp);\n\n $exponents[$i] = $e->modInverse($temp);\n }\n\n list($temp) = $lcm['top']->divide($lcm['bottom']);\n $gcd = $temp->gcd($e);\n $i0 = 1;\n } while (!$gcd->equals($this->one));\n\n $d = $e->modInverse($temp);\n\n $coefficients[2] = $primes[2]->modInverse($primes[1]);\n\n // from <http://tools.ietf.org/html/rfc3447#appendix-A.1.2>:\n // RSAPrivateKey ::= SEQUENCE {\n // version Version,\n // modulus INTEGER, -- n\n // publicExponent INTEGER, -- e\n // privateExponent INTEGER, -- d\n // prime1 INTEGER, -- p\n // prime2 INTEGER, -- q\n // exponent1 INTEGER, -- d mod (p-1)\n // exponent2 INTEGER, -- d mod (q-1)\n // coefficient INTEGER, -- (inverse of q) mod p\n // otherPrimeInfos OtherPrimeInfos OPTIONAL\n // }\n\n return array(\n 'privatekey' => $this->_convertPrivateKey($n, $e, $d, $primes, $exponents, $coefficients),\n 'publickey' => $this->_convertPublicKey($n, $e),\n 'partialkey' => false\n );\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}", "function GetCryptedPassword($password)\n{\n\t$string = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\";\n\n\tmt_srand(10000000*(double)microtime());\n\t\n\t$salt = '';\n\tfor ($i = 0; $i < 16; $i++)\n\t\t$salt .= $string[mt_rand(0, strlen($string)-1)];\n\n\t$password = md5($password . $salt) . ':' . $salt;\n\n\treturn $password;\n}", "public function generateSecret($prettyPrinting = FALSE) {\n\t\t$key = $this->getBase32Conversor()->randomBase32String(self::KEY_BYTE_LENGTH);\n\t\tif ($prettyPrinting) {\n\t\t\t$key = chunk_split($key, 4, ' ');\n\t\t}\n\t\treturn $key;\n\t}", "function generate_key()\n{\n $pool = \"qwertzupasdfghkyxcvbnm\";\n $pool .= \"23456789\";\n $pool .= \"WERTZUPLKJHGFDSAYXCVBNM\";\n srand ((double)microtime()*1000000);\n for($index = 0; $index < 10; $index++)\n {\n $akti .= substr($pool,(rand()%(strlen ($pool))), 1);\n }\n return $akti;\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 Kravatte_WBC($block_size, $tweak='', $key)\n \t{\n \t$this->SPLIT_THRESHOLD = 398;\n\tself::k_key($key);\n\tself::reset_state();\n self::Kravatte_split($block_size);\n $this->tweak = $tweak;\n\t}", "protected function encryptPassword($password) \n {\n $passwordHash = password_hash($password, PASSWORD_BCRYPT, array('cost' => 12));\n \n return $passwordHash;\n }", "function pacrypt ($pw, $pw_db=\"\")\n{\n global $CONF;\n $password = \"\";\n \n if ($CONF['encrypt'] == 'md5crypt')\n {\n $split_salt = preg_split ('/\\$/', $pw_db);\n $salt = $split_salt[2];\n $password = md5crypt ($pw, $salt);\n }\n\n if ($CONF['encrypt'] == 'system')\n {\n if (ereg (\"\\$1\\$\", $pw_db))\n {\n $split_salt = preg_split ('/\\$/', $pw_db);\n $salt = $split_salt[2];\n }\n else\n {\n $salt = substr ($pw_db, 0, 2);\n }\n\t $password = crypt ($pw, $salt);\n\n }\n\n if ($CONF['encrypt'] == 'cleartext')\n {\n $password = $pw;\n }\n\n return $password;\n}", "function password_hash($password, $algo, array $options = array()) {\r\n if (!function_exists('crypt')) {\r\n trigger_error(\"Crypt must be loaded for password_hash to function\", E_USER_WARNING);\r\n return null;\r\n }\r\n if (is_null($password) || is_int($password)) {\r\n $password = (string) $password;\r\n }\r\n if (!is_string($password)) {\r\n trigger_error(\"password_hash(): Password must be a string\", E_USER_WARNING);\r\n return null;\r\n }\r\n if (!is_int($algo)) {\r\n trigger_error(\"password_hash() expects parameter 2 to be long, \" . gettype($algo) . \" given\", E_USER_WARNING);\r\n return null;\r\n }\r\n $resultLength = 0;\r\n switch ($algo) {\r\n case PASSWORD_BCRYPT:\r\n $cost = PASSWORD_BCRYPT_DEFAULT_COST;\r\n if (isset($options['cost'])) {\r\n $cost = $options['cost'];\r\n if ($cost < 4 || $cost > 31) {\r\n trigger_error(sprintf(\"password_hash(): Invalid bcrypt cost parameter specified: %d\", $cost), E_USER_WARNING);\r\n return null;\r\n }\r\n }\r\n// The length of salt to generate\r\n $raw_salt_len = 16;\r\n// The length required in the final serialization\r\n $required_salt_len = 22;\r\n $hash_format = sprintf(\"$2y$%02d$\", $cost);\r\n// The expected length of the final crypt() output\r\n $resultLength = 60;\r\n break;\r\n default:\r\n trigger_error(sprintf(\"password_hash(): Unknown password hashing algorithm: %s\", $algo), E_USER_WARNING);\r\n return null;\r\n }\r\n $salt_req_encoding = false;\r\n if (isset($options['salt'])) {\r\n switch (gettype($options['salt'])) {\r\n case 'NULL':\r\n case 'boolean':\r\n case 'integer':\r\n case 'double':\r\n case 'string':\r\n $salt = (string) $options['salt'];\r\n break;\r\n case 'object':\r\n if (method_exists($options['salt'], '__tostring')) {\r\n $salt = (string) $options['salt'];\r\n break;\r\n }\r\n case 'array':\r\n case 'resource':\r\n default:\r\n trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING);\r\n return null;\r\n }\r\n if (_strlen($salt) < $required_salt_len) {\r\n trigger_error(sprintf(\"password_hash(): Provided salt is too short: %d expecting %d\", _strlen($salt), $required_salt_len), E_USER_WARNING);\r\n return null;\r\n } elseif (0 == preg_match('#^[a-zA-Z0-9./]+$#D', $salt)) {\r\n $salt_req_encoding = true;\r\n }\r\n } else {\r\n $buffer = '';\r\n $buffer_valid = false;\r\n if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {\r\n $buffer = mcrypt_create_iv($raw_salt_len, MCRYPT_DEV_URANDOM);\r\n if ($buffer) {\r\n $buffer_valid = true;\r\n }\r\n }\r\n if (!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) {\r\n $buffer = openssl_random_pseudo_bytes($raw_salt_len);\r\n if ($buffer) {\r\n $buffer_valid = true;\r\n }\r\n }\r\n if (!$buffer_valid && @is_readable('/dev/urandom')) {\r\n $file = fopen('/dev/urandom', 'r');\r\n $read = _strlen($buffer);\r\n while ($read < $raw_salt_len) {\r\n $buffer .= fread($file, $raw_salt_len - $read);\r\n $read = _strlen($buffer);\r\n }\r\n fclose($file);\r\n if ($read >= $raw_salt_len) {\r\n $buffer_valid = true;\r\n }\r\n }\r\n if (!$buffer_valid || _strlen($buffer) < $raw_salt_len) {\r\n $buffer_length = _strlen($buffer);\r\n for ($i = 0; $i < $raw_salt_len; $i++) {\r\n if ($i < $buffer_length) {\r\n $buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255));\r\n } else {\r\n $buffer .= chr(mt_rand(0, 255));\r\n }\r\n }\r\n }\r\n $salt = $buffer;\r\n $salt_req_encoding = true;\r\n }\r\n if ($salt_req_encoding) {\r\n// encode string with the Base64 variant used by crypt\r\n $base64_digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\r\n $bcrypt64_digits = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\r\n $base64_string = base64_encode($salt);\r\n $salt = strtr(rtrim($base64_string, '='), $base64_digits, $bcrypt64_digits);\r\n }\r\n $salt = _substr($salt, 0, $required_salt_len);\r\n $hash = $hash_format . $salt;\r\n $ret = crypt($password, $hash);\r\n if (!is_string($ret) || _strlen($ret) != $resultLength) {\r\n return false;\r\n }\r\n return $ret;\r\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}", "function blake2bFinal(&$ctx) {\n\t\t$ctx['t'] += $ctx['c']; // mark last block offset\n\t\twhile ($ctx['c'] < 128) { // fill up with zeros\n\t\t\t$ctx['b'][$ctx['c']++] = 0;\n\t\t}\n\t\t$this->blake2bCompress($ctx, true); // final block flag = 1\n\t\t// little endian convert and store\n\t\t$out = array_fill(0, $ctx['outlen'], 0);\n\t\tfor ($i = 0; $i < $ctx['outlen']; $i++) {\n\t\t\t$out[$i] = ($ctx['h'][$i >> 2] >> (8 * ($i & 3))) & 0xff;\n\t\t}\n\t\treturn $out;\n\t}", "function decryptBlock($privateKey, $msg){\n\treturn bcmod(bcpow($msg, $privateKey->other), $privateKey->N);\n}", "public function getBCyptPassword($password){\n if(empty($password)){\n \t$hashedPassword= FALSE;\n }\n\t\t\telse {\n\t\t\t\t$hashedPassword=crypt($password, $this->_salt);\t\n\t\t\t}\n\t \treturn $hashedPassword;\n }", "function security($password){\n\t\t\t$options = [ 'cost' => 12, ];\n\t\t\t$pwd = password_hash($password, PASSWORD_BCRYPT, $options);\n\t\t\treturn $pwd;\n\t\t}", "function mcrypt_enc_is_block_algorithm($td)\n{\n}", "function genPassword($keyspace = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ')\n {\n $length = 10;\n $str = '';\n $max = mb_strlen($keyspace, '8bit') - 1;\n for ($i = 0; $i < $length; ++$i) {\n $str .= $keyspace[random_int(0, $max)];\n }\n return $str;\n }", "public function getSecretKey();", "function encryptPassword()\n\t{\n\t\t$userPassword = $_POST['userPassword'];\n\n\t $key = pack('H*', \"bcb04b7e103a05afe34763051cef08bc55abe029fdebae5e1d417e2ffb2a00a3\");\n\t $key_size = strlen($key);\n\n\t $plaintext = $userPassword;\n\n\t $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);\n\t $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);\n\n\t $ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $plaintext, MCRYPT_MODE_CBC, $iv);\n\t $ciphertext = $iv . $ciphertext;\n\n\t $userPassword = base64_encode($ciphertext);\n\n\t return $userPassword;\n\t}", "function makeKey($masterID){\n\n\t$key = \"I want to see you so bad :/\";\n\t$keyElement1 = \"\";\n\t$keyElement2 = \"\";\n\t$keyElement3 = \"\";\n\t$hash = \"\";\n\n\t$strSQL = \"SELECT * FROM masteraccount WHERE 1 \n\t\tAND masterID = '\".$masterID.\"' \n\t\t\";\n\t\n\t$objQuery = mysql_query($strSQL);\n\t$objResult = mysql_fetch_array($objQuery);\n\tif($objResult) {\n\t\t$keyElement1 = $objResult[\"masterTextPassword\"];\n\t\t$keyElement2 = $objResult[\"masterGraphicalPassword\"];\n\n\t\t//echo \"element2 : \".$keyElement2.\"<br>\";\n\n\t\t$keyElement3 = $objResult[\"email\"];\n\t\t$cost = 11;\n\t\t$salt = mcrypt_create_iv(22, MCRYPT_DEV_URANDOM);\n\t\t\n\t\t//make key -> Hash(Hash(text)+Hash(graphical))+Hash(email)\n\t\t$keyElement1 = hash(\"sha256\",$keyElement1, false);\n\t\t$keyElement2 = hash(\"sha256\",$keyElement2, false);\n\t\t$key = $keyElement1.$keyElement2 ;\n\n\t\t//echo \"key ele1+2 : \".$key.\"<br>\";\n\n\t\t$key = hash(\"sha256\",$key, false);\n\n\t\t//echo \"hashed key ele1+2 : \".$key.\"<br>\";\n\n\t\t$keyElement3 = hash(\"sha256\",$keyElement3, false);\n\t\t$key = $key.$keyElement3 ;\n\t\t$key = hash(\"sha256\",$key, false);\n\n\t\t//echo \"FinalKey : \".$key.\"<br><br>\";\n\t}\n\treturn $key;\n}", "function pacrypt_install ($pw, $pw_db=\"\", $crypt=\"\") {\n\n\tglobal $CONF, $MAGIC;\n\t\n\tif( $crypt == \"\" ) {\n\t\tif( isset( $CONF['pwcrypt'] ) ) {\n\t\t\t\n\t\t\t$crypt\t\t\t\t\t= $CONF['pwcrypt'];\n\t\t\t\n\t\t} else {\n\t\t\t\n\t\t\t$crypt\t\t\t\t\t= \"crypt\";\n\t\t\t\n\t\t}\n\t}\n\t\n\t$size\t\t\t\t\t\t\t= strlen( $MAGIC );\n\tif( substr($pw_db, 0, $size) == $MAGIC ) {\n\t\t# md5 crypted password\n\t\t\n\t\t$split_salt \t\t\t\t= preg_split ('/\\$/', $pw_db);\n \tif (isset ($split_salt[2])) { \n \t\t\n \t\t$salt\t\t\t\t\t = $split_salt[2];\n \t}\n \t\n \t$password \t\t\t\t\t= md5crypt( $pw, $salt );\n \n\t} elseif( $pw_db != \"\" ) {\n\t\t\n\t\t$salt \t\t\t\t\t\t= substr( $pw_db, 0, 2);\n\t\t$password \t\t\t\t\t= crypt ($pw, $salt);\n\t\t\n\t} else {\n\t\t\n\t\tif( $crypt == \"md5\" ) {\n\t\t\t\n\t\t\t$password\t\t\t\t= md5crypt( $pw );\n\t\t\t\n\t\t} else {\n\t\t\n\t\t\tsrand((double)microtime()*1000000);\n\t\t\n\t\t\t$s1 \t\t\t\t\t= chr( rand( 1, 255 ) );\n\t\t\t$s2 \t\t\t\t\t= chr( rand( 1, 255 ) );\n\t\t\t$salt \t\t\t\t\t= $s1.$s2;\t\n\t\t\t$password \t\t\t\t= crypt ($pw, $salt);\t\t\n\t\t}\n\t}\n\t\n\treturn $password;\n}", "function encrypt($plaintext) {\n $ivsize = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC);\n $keysize = mcrypt_get_key_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC);\n $blocksize = mcrypt_get_block_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC);\n //echo \"IV Size: \" . $ivsize . \"\\n\";\n //echo \"Key Size: \" . $keysize . \"\\n\";\n //echo \"Block Size: \" . $blocksize . \"\\n\";\n\n $masterkey = 'masterKeyOfLength29Characters';\n $td = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');\n\n //$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);\n\t $ivbytes = array(72, 163, 99, 62, 219, 111, 163, 114, 15, 47, 65, 99, 231, 108, 110, 87, 72, 163, 99, 62, 219, 111, 163, 114, 15, 47, 65, 99, 231, 108, 110, 87);\n $iv = implode(array_map(\"chr\", $ivbytes));\n\n\t\t//$key = mhash(MHASH_SHA256, $masterkey);\n\t\t//echo \"Key: \" . base64_encode($key) . \"\\n\";\n\t\t \n mcrypt_generic_init($td, $masterkey, $iv);\n //mcrypt_generic_init($td, substr($key, 0, $keysize), $iv);\n //mcrypt_generic_init($td, $key, $iv);\n $crypttext = mcrypt_generic($td, $plaintext);\n mcrypt_generic_deinit($td);\n return base64_encode($iv.$crypttext);\n //return base64_encode($crypttext);\n}", "public function generateKeyPair(): array\n {\n $res = openssl_pkey_new([\n 'private_key_bits' => 2048,\n 'private_key_type' => OPENSSL_KEYTYPE_RSA,\n ]);\n openssl_pkey_export($res, $privKey);\n return [$privKey, openssl_pkey_get_details($res)['key']];\n }", "public function testEncryptPadding(): void\n {\n $rc2 = new RC2('ecb');\n\n // unlike Crypt_AES / Crypt_Rijndael, when you tell Crypt_RC2 that the key length is 128-bits the key isn't null padded to that length.\n // instead, RC2 key expansion is used to extend it out to that length. this isn't done for AES / Rijndael since that doesn't define any\n // sort of key expansion algorithm.\n\n // admittedly, phpseclib is inconsistent in this regard. RC4 and Blowfish support arbitrary key lengths between a certain range, as well,\n // and they don't have any way to set the key length. but then again, neither do those algorithms have their own key expansion algorithm,\n // whereas RC2 does. and technically, AES / Rijndael (and even Twofish) don't support arbitrary key lengths - they support variable key\n // lengths. so in some ways, i suppose this inconsistency somewhat makes sense, although the fact that Crypt_Twofish doesn't have a\n // setKeyLength() function whereas Crypt_AES / Crypt_Rijndael do not is, itself, an inconsistency.\n\n // but that said, Crypt_RC2 is inconsistent in other ways: if you pass a 128-bit (16-byte) key to it via setKey() the key is not treated\n // as a 128-bit key but rather as a 1024-bit key and is expanded accordingly, not via null padding, but via RC2's key expansion algorithm.\n\n // this behavior is in contrast to mcrypt, which extends keys via null padding to 1024 bits. it is also in contrast to OpenSSL, which\n // extends keys, via null padding, to 128 bits. mcrypt's approach seems preferable as one can simulate 128 bit keys by using RC2's\n // key expansion algorithm to extend the key to 1024 bits and then changing the first byte of the new key with an inverse pitable mapping.\n // in contrast, to my knowledge, there is no technique for expanding a key less than 128 bits to 128 bits, via RC2 key expansion. the only\n // scenario in that regard is null padding.\n\n // simple truncation is insufficient, since, quoting RFC2268, \"the purpose of the key-expansion algorithm [in RC2] is to modify the key buffer\n // so that each bit of the expanded key depends in a complicated way on every bit of the supplied input key\".\n\n // now, to OpenSSL's credit, null padding is internally consistent with OpenSSL. OpenSSL only supports fixed length keys. For rc2, rc4 and\n // bf (blowfish), all keys are 128 bits (or are null padded / truncated accordingly). to use 40-bit or 64-bit keys with RC4 with OpenSSL you\n // don't use the rc4 algorithm - you use the rc4-40 or rc4-64 algorithm. and similarly, it's not aes-cbc that you use - it's either aes-128-cbc\n // or aes-192-cbc or aes-256-cbc. this is in contrast to mcrypt, which (with the exception of RC2) actually supports variable and arbitrary\n // length keys.\n\n // superficially, it seens like Rijndael would be another exception to mcrypt's key length handling, but it in fact is not. the reason being that,\n // with mcrypt, when you specify MCRYPT_RIJNDAEL_128 or MCRYPT_RIJNDAEL_192 or MCRYPT_RIJNDAEL_256 the numbers at the end aren't referring to the\n // key length, but rather, the block length. ie. Rijndael, unlike most block ciphers, doesn't just have a variable (but not arbitrary) key length -\n // it also has a variable block length. AES's block length, however, is not variable, so technically, only MCRYPT_RIJNDAEL_128 is AES.\n\n $rc2->setKey(str_repeat('d', 16), 128);\n\n $rc2->setPreferredEngine('PHP');\n $internal = $rc2->encrypt('d');\n\n $result = pack('H*', 'e3b36057f4821346');\n $this->assertEquals($result, $internal, 'Failed asserting that the internal engine produced the correct result');\n\n $rc2->setPreferredEngine('OpenSSL');\n if ($rc2->getEngine() == 'OpenSSL') {\n $openssl = $rc2->encrypt('d');\n $this->assertEquals($result, $openssl, 'Failed asserting that the OpenSSL engine produced the correct result');\n } else {\n self::markTestSkipped('Unable to initialize OpenSSL engine');\n }\n }", "public function getPrivateKey(PKEncryptionEnabledUserInterface $user);", "protected static function pkcs5Pad ($text, $blocksize) { \n $pad = $blocksize - (strlen($text) % $blocksize); \n return $text . str_repeat(chr($pad), $pad); \n }", "function bwm_hmac($key, $data, $hash = 'md5', $blocksize = 64) {\r\n if (strlen($key)>$blocksize) {\r\n $key = pack('H*', $hash($key));\r\n }\r\n $key = str_pad($key, $blocksize, chr(0));\r\n $ipad = str_repeat(chr(0x36), $blocksize);\r\n $opad = str_repeat(chr(0x5c), $blocksize);\r\n return $hash(($key^$opad) . pack('H*', $hash(($key^$ipad) . $data)));\r\n}", "function blake2b($input, $key, $outlen = 64) {\n\t\t// preprocess inputs\n\t\t$input = $this->normalizeInput($input);\n\t\t// do the math\n\t\t$ctx = $this->blake2bInit($outlen, $key);\n\t\t$this->blake2bUpdate($ctx, $input);\n\t\treturn $this->blake2bFinal($ctx);\n\t}", "private function generate_pass()\n {\n echo password_hash('admin', PASSWORD_BCRYPT);\n }", "public function testPKCS8RC440(): void\n {\n\n // EncryptionAlgorithm: pbeWithSHAAnd40BitRC4\n\n $key = '-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIIE5DAcBgoqhkiG9w0BDAECMA4ECNrUHnZnezluAgIIAASCBMKm0lEML1hIdzcu\npglVZSwG8JyigX3xgHwnN4oAz6HYTNeatkV3xqGP23DP84e9En7mQTRxuQ9Tk8sN\nNoEK2VsjYmrJtsbyTH21M0vPlAvFv/sIgxVYcF7jv58jHhLNnibPtDeMXZDjd4uq\nvdppAGRxIr5z8XZ8ruAlsAB/xzcz1bIK8CwWH9NBOWLDe195/OYoUrgf9h+U2s8e\n1rbq+U/woJZHD7+3RuPmtWTtrneY/NVTiU03OUUleys88eCSqZrQzR0faNxdVzTg\nmhSrtkqwho9xxUFY6KqLOTF4BQufD+ZSNt9LN3EaFdvGcI1QWWDH11ne98oz3GUa\nGCGhaADTOAAOdvXyv+6YRfj1VvtisUeiGjttFmaUHGOmHCCYoyVkbhsRq4QnbbCv\n641ogRbuISBHwr+mzqjwTZXC5Laxsrn5EnCZ309vohq7l+g3M1Y9nzR8hOsiqTFu\n7PPj1jYM8znYkVx/me+xnpB/d3Ot86K6NszbTaWk9cHr4qfkF+pu2kUYQ/26CUBE\ny7DxYmhXnOBRGUTvQebrMoSK8hOaw0uWEQtYp3gLOS1hituL965m2qRbP/ysDP85\nDAorOSbKDEMHYy7UP3xh743FErEOoY83GtugnJgjrTlJ/5NyS1KFr5QUsQD/N/Zw\nbIkjdFT5mjWVaotHzpNc1IigpAPbNpe4J1E1E2nB8YE5ckSEVseUJ+ypgWSvJxmU\nG68YvidODClnBekff8sRDCNN4dekQgnNEMbAWgHRWtMERvXS/9xfJZiqiq+7WvIE\nXvu1Qq5zG3+mESNX9AVLngv5btD2m6QFEqOLG9JKQWp61J3c2lG/kdtWBjsXiWoi\nzvkA4u9ZxUzX3s3T2aHozg9O4+0ti947l7wSIxbxLYA0d1M7cQoeKAuRnpwzfCZ9\ngpQ9VG9acDhU9LCxcZBHfuKROeI7D7wL//MJp/ue26uhOZY7Z0gbFIfjeSPW+HD0\nfRGA849/1aKIsRarKg2YleqsXO04E3J/lpTt1gjy3aGE25Arq6qo+4DRsUIIWeS+\nQwzdDeqy1zs8BIPxa51U/jvbqxCvqXsMw4la0txkSwymMvc6U+QpJgm2KqSDCs8W\n+QYIz4SYlADLgl+MVDGd9IB/PN8AIZ0Lr7QqKKBIrfyegO/gjCkHCdNIh1Q/Bzbf\nrq8AYwbxHnp2Jn2MAzw9s13ncENpZqCDHkhmd89hJc1B4f8rv5KhDsIVb85XQJek\npdpqugcYjxohSBEa9yzp0JDRa97Btir7D4+9HG2NUullFgXvbqKvlKPj+ORUDxJd\nDMGC2Uov1koiVBvvahtmr8eTBNdA48cA7l/c5t8UsGbjrwpqLZLTJ1FHjnVKybuu\nsoPwPAxr3WBE4Ien7WqPj+GTeLWMb9//kpi5grguv3Db6rdH2Y4PT9Fi4UBxd+6N\nLqB1rPkt4AQtQwda1ccixYXIFfWSJ6+XEyp6/wsW05DZAiu3R4o/T9Z59KPGlbf0\naaEAW+FZ9jYa6sDBlMwCN2TEmnBFkytJYe8+B5UxkEAIn3g/Vr9R4t4YDCSE2ugs\nq6YJC1bQ8jHojcWTs47zcefCXhOkKOg3oxzYIQe9Ikdmf70JxIo+bS92O2vrkV0p\nOFLPBrLe4Hw=\n-----END ENCRYPTED PRIVATE KEY-----';\n $pass = 'asdf';\n\n $this->pkcs8tester($key, $pass);\n }", "function generateEncryptedPassword($userinfo) {\r\n if (!class_exists('PasswordHash')) {\r\n require_once JFUSION_PLUGIN_PATH . DS . $this->getJname() . DS . 'PasswordHash.php';\r\n }\r\n $t_hasher = new PasswordHash(8, true);\r\n $check = $t_hasher->CheckPassword($userinfo->password_clear, $userinfo->password);\r\n\r\n if ($check) {\r\n //password is correct and return the phpbb3 password hash\r\n return $userinfo->password;\r\n } else {\r\n //no phpbb3 encryption used and return the phpbb2 password hash\r\n\t\t\t$password_old_format = addslashes($userinfo->password_clear);\r\n\r\n\t\t\tif ($t_hasher->CheckPassword($userinfo->password_clear, md5($this->utf8_to_cp1252($password_old_format)))) {\r\n\t\t\t\t//password is correct\r\n\t\t\t\treturn $userinfo->password;\r\n\t\t\t} elseif ($t_hasher->CheckPassword($userinfo->password_clear, md5($password_old_format))) {\r\n\t\t\t\t//password is correct\r\n\t\t\t\treturn $userinfo->password;\t\t\t\t\r\n\t\t\t} elseif (md5($this->utf8_to_cp1252($password_old_format)) === $userinfo->password) {\r\n\t\t\t\t//password is correct\r\n\t\t\t\treturn $userinfo->password;\t\t\t\t\t\t\t\t\r\n\t\t\t} else {\r\n\t\t\t\t//ah who cares lets just a md5 standar encryption\r\n\t\t\t\t$encrypt_password = md5($password_old_format);\r\n return $encrypt_password;\r\n\t\t\t}\t\t\t\t\r\n\r\n }\r\n }", "function get_password_hash_info()\n {\n return [\n 'algo' => ($GLOBALS['password_hash_info']['algo'] ?? PASSWORD_BCRYPT),\n 'options' => ($GLOBALS['password_hash_info']['options'] ?? ['cost' => 12])\n ];\n }", "protected function getPasswords_Driver_Bcrypt2yService()\n {\n return $this->services['passwords.driver.bcrypt_2y'] = new \\phpbb\\passwords\\driver\\bcrypt_2y(${($_ = isset($this->services['config']) ? $this->services['config'] : $this->getConfigService()) && false ?: '_'}, ${($_ = isset($this->services['passwords.driver_helper']) ? $this->services['passwords.driver_helper'] : $this->getPasswords_DriverHelperService()) && false ?: '_'}, 10);\n }", "public static function keyFromPassword($pwd)\r\n\t{\r\n\t\treturn new KeyFromPassword($pwd, KdbxFile::HASH);\r\n\t}", "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 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 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 pwHash($pword = \"\"){\n\n //currently only returns the password it was given\n \n return $pword;\n\n}", "public function ivGenerator() \n {\n $chars = \"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,#,@,$,%,&,!\";\n $chars = explode(\",\", $chars);\n $ints = array();\n for ($i = 0; $i < 4; $i++) {\n array_push($ints, rand(0, 64));\n }\n $password = array();\n\n //composing the password\n foreach ($ints as $int) {\n $char = $chars[$int * rand(0, 3)];\n if (($int * rand(0, 3)) % 2 == 0) {\n $char = strtoupper($char);\n array_push($password, $int);\n }\n array_push($password, $char);\n }\n\n //convert the password array to string\n $stringpass = '';\n foreach ($password as $char) {\n $stringpass.=$char;\n }\n return $stringpass;\n }", "public function generate_pw(){\n $alphabet = \"abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789\";\n $pass = str_shuffle($alphabet);\n $pass = substr($pass, 0, 8);\n $this->setPassword($pass);\n return $pass; //turn the array into a 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}", "function xoft_decode($cipher_data,$key){\r\n\r\n $m=0;\r\n $all_bin_chars=\"\";\r\n\r\n for($i=0;$i<mb_strlen($cipher_data);$i++){\r\n\t$c=mb_substr($cipher_data,$i,1); // c = ciphertext\r\n\t$decimal_value=base64todec($c); //convert to decimal value\r\n\r\n\t$decimal_value=($decimal_value - $m) / 4; //substract by m where m=0,1,2,or 3 then divide by 4\r\n\r\n\t$four_bit=decbin($decimal_value);\r\n\r\n\twhile(mb_strlen($four_bit)<4){\r\n\t\t$four_bit=\"0\".$four_bit;\r\n\t}\r\n\r\n\t$all_bin_chars=$all_bin_chars.$four_bit;\r\n\t$m++;\r\n\r\n\tif($m>3){\r\n\t\t$m=0;\r\n\t}\r\n }\r\n\r\n $key_length=0;\r\n $plain_data=\"\";\r\n\t\r\n for($j=0;$j<mb_strlen($all_bin_chars);$j=$j+8){\r\n\t$c=mb_substr($all_bin_chars,$j,8);\r\n\t$k=mb_substr($key,$key_length,1);\r\n\t\r\n\t$dec_chars=bindec($c);\r\n\t$dec_chars=$dec_chars - mb_strlen($key);\r\n\t$c=chr($dec_chars);\r\n\t$key_length++;\r\n\t\r\n\tif($key_length>=mb_strlen($key)){\r\n\t\t$key_length=0;\r\n\t}\r\n\t\r\n\t$dec_chars=ord($c)^ord($k);\r\n\t$p=chr($dec_chars);\r\n\t$plain_data=$plain_data.$p;\r\n }\r\n \r\n return $plain_data;\r\n}", "function hkdfForHmacSha256($sharedKey, $message) {\n\t\t $hash = hash_hkdf(self::HASHING_ALGORITHM, $sharedKey, self::HASH_CODE_LENGTH, $message);\n\n\t\t return strtr(base64_encode($hash), '+/', '-_');\n }" ]
[ "0.74503815", "0.7211696", "0.71586984", "0.70948225", "0.6761175", "0.64212", "0.60631734", "0.598255", "0.58243155", "0.58212477", "0.56231505", "0.5556102", "0.53807485", "0.5266688", "0.5222263", "0.51415634", "0.51129895", "0.50296575", "0.49911317", "0.49544737", "0.4936422", "0.49335712", "0.4914704", "0.4910626", "0.48987192", "0.4848317", "0.48477042", "0.4827561", "0.4827153", "0.4799815", "0.47747493", "0.47686213", "0.47628415", "0.4755893", "0.47467712", "0.47430304", "0.4740255", "0.4729985", "0.47291228", "0.47048986", "0.46898246", "0.46496856", "0.46492743", "0.46434036", "0.46412274", "0.4629907", "0.46290615", "0.46100417", "0.45990786", "0.45963794", "0.45935002", "0.45519674", "0.45427564", "0.45394257", "0.45371908", "0.45272765", "0.45250377", "0.45195815", "0.45175475", "0.45134598", "0.4513237", "0.44830605", "0.44827163", "0.44822723", "0.4475426", "0.44584706", "0.44534", "0.4447761", "0.4442947", "0.44350246", "0.44254342", "0.44193596", "0.4414436", "0.44131148", "0.4386041", "0.43836716", "0.43638164", "0.43575326", "0.43561697", "0.4354696", "0.43541327", "0.4351611", "0.43513808", "0.43481952", "0.43470058", "0.43464464", "0.43299878", "0.43263128", "0.4319896", "0.4318419", "0.4316543", "0.43110168", "0.43079996", "0.43038276", "0.4300376", "0.4297905", "0.4284061", "0.4283123", "0.42814237", "0.42798826" ]
0.73477584
1
A basic test example.
public function testProduct() { $this->post('/api/v1/login',['email' => '[email protected]','password' => 12345]) ->get('api/v1/producto') ->seeJson([]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testExample()\n {\n }", "public function test() {\n \t\n\t\tprint_r('hello stef');\n \t\n }", "public function testBasicExample()\n {\n $this->assertTrue(true);\n }", "public function testBasicExample()\n {\n $this->assertEquals(1, 1);\n }", "function test_sample() {\n\n\t\t$this->assertTrue( true );\n\n\t}", "public function testBasicExample()\n {\n $this->visit('/')\n ->see('TROLOLOLO');\n }", "public function testBasicTest()\n {\n\n }", "public function testExample()\n {\n dump(\"testExample\");\n $this->assertTrue(true);\n }", "public function testExample()\n\t{\n\t\t$this->assertTrue(true);\n\t}", "public function testExample()\n {\n //this test is empty as we have not yet decided if we want to use dusk\n\n // $this->get('/')\n // ->click('About')\n // ->seePageIs('/about');\n }", "function testSample() {\n\t\t$this->assertTrue( true );\n\t}", "public function test() {\n\n\t}", "public static function test() {\r\n echo 'this is a test';\r\n }", "public function testExample()\n {\n $this->assertTrue(true);\n \n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n // lets make it risky to destroy the green\n }", "public function testBasicExample()\n\t{\n \t$response = $this->call('GET', '/');\n\t\t$this->assertEquals(200, $response->getStatusCode());\n\t}", "public function testExample()\n {\n $this->visit('ticket')\n ->see('Listado de Tickets')\n ->seeLink('Ver Ticket') \n ->visit('ticket/1')\n ->see('Quod et autem sed')\n ->seeLink('Ver todos los tickets')\n ->click('Ver todos los tickets')\n ->see('Listado de Tickets')\n ->seeLink('Agregar un ticket', 'ticket/crear');\n }", "function test_sample() {\n\t\t$this->assertTrue( true );\n\t}", "public function testBasicExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->visit('/')\n ->assertSee('Login to Airtel Sales Force System');\n });\n }", "public function testBasicExample()\n {\n $this->visit('/')\n ->see('API tester');\n }", "public function testExample()\n {\n $response = $this->get('/api/test/');\n\n $response->assertStatus(200);\n }", "public function testBasicExample()\n\t{\n\t\t$response = $this->call('GET', '/');\n\n\t\t$this->assertEquals(200, $response->getStatusCode());\n\t}", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "public function testBasicExample()\n {\n $this->visit('/')\n ->see('URL Notes');\n }", "public function testBasicTest()\n {\n $response = $this->get('/test');\n\n $response->assertStatus(200);\n\n $response->assertSeeText('小粽子');\n\n }", "function test_sampleme() {\n\t\t// Replace this with some actual testing code.\n\t\t$this->assertTrue( true );\n\t}", "public function testBasic()\n {\n $this->assertEquals(1, 1);\n }", "public function testBasicExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->visit('/admin/news/create')\n ->type('title', '123')\n ->type('text', 'test123')\n ->press('Добавить новость')\n\n ->assertSee('Мало букв в поле Заголовок');\n });\n }", "public function testBasicTest()\n {\n $response = $this->get('/dangthi');\n $response->assertStatus(200);\n }", "public function testBasicExample()\n {\n $this->visit('/')\n ->see('html');\n }", "public function testExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->loginAs(User::find(1))\n ->visitRoute('subscription', ['id' => '1'])\n ->radio('gender', 'L')\n ->type('fullName', 'GHF')\n ->type('birthdate', '04/24/1999')\n ->type('phone', '088177552')\n ->type('address', 'Bandung')\n ->press('Submit');\n });\n }", "public function testExample(): void\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->browse(function ($browser , $second) {\n $browser->visit('/')\n //->assertVueContains('name','sina','@editor');\n ->assertVue('name','sina','@editor');\n // ->pause(3000)\n // ->click('.test');\n // ->assertSee('Register')\n // ->value('#name' , 'sina')\n // ->value('#email' , Str::random(10).'@gmail.com')\n // ->value('#password' , '123456789')\n // ->value('#password-confirm' , '123456789')\n // ->click('button[type=\"submit\"]')\n // ->assertPathIs('/home')\n // ->refresh()\n // ->script('alert(\"ok\")');\n });\n }", "public function testBasicExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->visit('/')\n ->with('.special-text', function ($text) {\n $text->assertSee('title1');\n });\n\n // 確認商品數量\n $browser->click('.check_product')\n ->waitForDialog(5)\n ->assertDialogOpened('商品數量充足')\n ->acceptDialog();\n\n // 設定中斷點\n eval(\\Psy\\sh());\n });\n }", "public function testExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->loginAs(\"[email protected]\")\n ->visit(\"/home\");\n });\n }", "public function testExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->visit('/')\n ->assertSee('React JS examples');\n });\n }", "public function testBasicExample()\n {\n $this->browse(function (Browser $browser) {\n $browser->visit('/')\n ->assertSee('Laravel');\n });\n }", "public function testBasicExample()\n {\n $response = $this->call('GET', '/');\n\n $this->assertResponseOk();\n }", "public function test_example()\n {\n $this->assertTrue(true);\n }", "public function test_example()\n {\n $this->assertTrue(true);\n }", "public function test_example()\n {\n $this->assertTrue(true);\n }", "public function test_example()\n {\n $this->assertTrue(true);\n }", "public function testExample()\n {\n $this->visit('/')\n ->see('WELCOME');\n }" ]
[ "0.7977854", "0.77753335", "0.76435244", "0.7610687", "0.754975", "0.75405073", "0.75393844", "0.74867696", "0.74400353", "0.7432722", "0.7412231", "0.73547494", "0.73383486", "0.7337478", "0.7308627", "0.7305436", "0.72681046", "0.7260569", "0.72460294", "0.7215908", "0.71952444", "0.7174572", "0.71719897", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7171955", "0.7167066", "0.715222", "0.7132968", "0.7123071", "0.7119535", "0.7109628", "0.70886546", "0.70870566", "0.70733815", "0.7068619", "0.7050562", "0.7045842", "0.7031207", "0.7030824", "0.7030337", "0.70302093", "0.70302093", "0.70302093", "0.70302093", "0.70291555" ]
0.0
-1
Transform the resource into an array.
public function toArray($request) { $storeM = Store::find($this->store_id); return [ 'id' => $this->id , 'store_id' => $this->store_id , 'store_name' => $storeM->name , 'user_id' => $this->user_id , 'TM' => $this->TM , 'all_TM' => $this->all_TM , 'created_at' => $this->created_at , ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function toArray(): array\n {\n if (is_null($this->resource)) {\n return [];\n }\n\n return is_array($this->resource)\n ? $this->resource\n : $this->resource->toArray();\n }", "public function toArray(): array\n {\n if (is_null($this->resource)) {\n return [];\n }\n\n return is_array($this->resource)\n ? $this->resource\n : $this->resource->toArray();\n }", "public function asArray() {\n return $this->resource;\n }", "public function transform($resource)\n {\n return [];\n }", "public function toArray()\n {\n if ($this->resource instanceof ArrayableInterface) {\n\n return $this->resource->toArray();\n } else {\n\n return null;\n }\n }", "public function parse($resource)\n {\n return $resource->toArray();\n }", "public function transform($resource)\n {\n return [\n 'id' => $resource['id'],\n 'item' => $resource['item'],\n 'qty' => $resource['qty'],\n\n ];\n }", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "public function toArray() {}", "abstract protected function toArray();", "public function getAsArray();", "public function asArray();", "public function asArray();", "public function asArray();", "public function asArray();", "public function asArray();", "public function asArray();", "public function getAsArray()\n\t{\n\t\t\n\t\t$path = $this->get();\n\t\t\n\t\treturn self::toArray($path);\n\t\t\n\t}", "public function transform($resource)\n {\n return [\n\n 'id' => (int) $resource->id,\n\t\t\t'name' => $resource->name,\n\t\t\t'description' => $resource->description,\n 'seat_count' => $resource->seat_count,\n\t\t\t'is_active' => $resource->is_active,\n\t\t\t'status' => $resource->status,\n\t\t\t'created_at' => $resource->created_at->toDateTimeString(),\n\t\t\t'updated_at' => $resource->updated_at->toDateTimeString(),\n\t\t\t\n ];\n }", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray();", "public function toArray(): array\n {\n return [\n 'users' => HiUserResource::collection($this->resource),\n ];\n }", "public function toArray()\n {\n return $this->transform();\n }", "function toArray() ;", "function toArray() ;", "public function convertItemArray() {}", "public function toArray(): array\n {\n $content = $this->getContent();\n\n if (\\is_array($content)) {\n return $this instanceof Filterable\n ? (array) $this->filterResponse($content)\n : $content;\n }\n\n return [];\n }", "protected function asArray()\n\t{\n\t\treturn \\json_decode($this->response, true);\n\t}", "public function arr() {\n\t\t\treturn \\uri\\generate::to_array($this->object);\n\t\t}", "public function toArray()\n {\n return $this->getContent();\n }", "public function toArray()\n {\n\n }", "public function asArray(): array\n {\n return json_decode($this->result, true);\n }", "public function toArray()\n {\n return $this->cast('array');\n }", "function toArray(){\r\n\t\treturn $this->data;\r\n\t}", "private function arrayify(): array\n {\n return $this->toArray();\n }", "abstract public function toArray();", "abstract public function toArray();", "abstract public function toArray();", "abstract public function toArray();", "abstract public function toArray();", "public function toArray() // untested\n {\n return $this->data;\n }", "public function toArray(){\n $this->buildArray();\n return $this->array;\n }", "public function toArray(): array;", "public function toArray(): array;", "public function toArray(): array;", "public function toArray(): array;", "public function toArray(): array;", "public function toArray(): array;", "public function toArray(): array;" ]
[ "0.7750928", "0.7750928", "0.7715773", "0.75906307", "0.7310379", "0.7138024", "0.7134791", "0.7096877", "0.7096877", "0.70968604", "0.70968604", "0.70968604", "0.70968604", "0.70955557", "0.70955557", "0.70955557", "0.70955557", "0.70955557", "0.70955557", "0.70955557", "0.70955557", "0.70955557", "0.70955557", "0.6959165", "0.69560915", "0.68910366", "0.68910366", "0.68910366", "0.68910366", "0.68910366", "0.68910366", "0.6881386", "0.6868011", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6852651", "0.6851924", "0.6790647", "0.674651", "0.674651", "0.67363435", "0.6720337", "0.6712338", "0.67115825", "0.6710179", "0.666141", "0.66587526", "0.6656767", "0.6655622", "0.66545117", "0.6648871", "0.6648871", "0.6648871", "0.6648871", "0.6648871", "0.66377884", "0.6637001", "0.6629", "0.6629", "0.6629", "0.6629", "0.6629", "0.6629", "0.6629" ]
0.0
-1
Recoger los datos del usuario
public function register(Request $request){ $json = $request->input('json',null); $params = json_decode($json); $params_array = json_decode($json,true); if(!empty($params) && !empty($params_array)){ //Limpiar datos $params_array = array_map('trim',$params_array); //Validar datos $validate = \Validator::make($params_array,[ 'nombre' => 'required', 'documento' => 'required|unique:users',//Comprobar si usuario existe (Duplicado) 'password' => 'required', 'genero' => 'required', 'fecha_nacimiento' => 'required', 'telefono' => 'required', 'eps_id' => 'required', 'rol_id' => 'required' ]); if($validate->fails()){ //la validación ha fallado $data = array( 'status' => 'error', 'code' => 404, 'message' => 'El usuario no se ha creado correctamente', 'errors' => $validate->errors() ); } else{ //validación pasada correctamente //Cifrar contraseña $pwd = hash('sha256',$params->password); //Crear usuario $user = new User(); $user->nombre = $params_array['nombre']; $user->documento = $params_array['documento']; $user->password = $pwd; $user->genero = $params_array['genero']; $user->fecha_nacimiento = $params_array['fecha_nacimiento']; $user->telefono = $params_array['telefono']; $user->eps_id = $params_array['eps_id']; $user->rol_id = $params_array['rol_id']; //Guardar el usuario $user->save(); $data = array( 'status' => 'suceess', 'code' => 200, 'message' => 'El usuario se ha creado correctamente', 'user' => $user ); } } else{ $data = array( 'status' => 'error', 'code' => 404, 'message' => 'Los datos enviados no son correctos', ); } return response()->json($data,$data['code']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function datos_usuario(){\n\t\t$data = json_decode(json_encode($_SESSION['USER']),true);\n\n\t\t$result = $this->_db->query(\"\n\t\tSELECT a.roleid FROM \".DB_PRE.\"role_assignments a, \".DB_PRE.\"context b \n\t\tWHERE a.userid = '$data[id]' AND a.contextid = b.id AND b.instanceid =\".ID_CURSO\n\t\t);\n\n\t\t$rol = 0;\n\t\tif (!$result) {\n\t\t\tprintf(\"Errormessage datos_usuario: %s\\n\", $this->_db->error);\n\t\t}else{\n\t $rol_user = $result->fetch_all(MYSQLI_ASSOC);\n\t if(count($rol_user) > 0){\n\t \t$rol = $rol_user['0']['roleid'];\n\t }\n \t}\n\n\t\t$usuario = array(\n\t\t\t\"id\" => $data['id'],\n\t\t\t\"nombre\" => $data['firstname'],\n\t\t\t\"apellido\" => $data['lastname'],\n\t\t\t\"codigo_estudiante\" => $data['idnumber'],\n\t\t\t\"rol\" => $rol\n\t\t);\n\n\t\t$datos_add = $this->_db->query(\"\n\t\t\tSELECT e.per_aca, b.id_facultad, a.id_programa, e.idnumber as codigo_curso, a.id_genero, a.idnumber\n\t\t\tFROM am_usuario a, am_programa b, \".DB_PRE.\"course e\n\t\t\tWHERE a.id_programa = b.id_programa\n\t\t\tAND e.id = \".ID_CURSO.\"\n\t\t\tAND id_moodle = \".$data['id']\n\t\t\t);\n\n\t\tif (!$datos_add) {\n\t\t\tprintf(\"Errormessage datos_add: %s\\n\", $this->_db->error);\n\t\t}else{\n\t\t\t$row = $datos_add->fetch_all(MYSQLI_ASSOC);\n\t\t\tforeach ($row as $key) {\n\t\t\t\tforeach ($key as $data => $value) {\n\t\t\t\t\t$usuario[$data] = $value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $usuario;\n\t}", "private function usuarios(){\n\t\tif ($_SERVER['REQUEST_METHOD'] != \"GET\") {\n\t\t\t# no se envian los usuarios, se envia un error\n\t\t\t$this->mostrarRespuesta($this->convertirJson($this->devolverError(1)), 405);\n\t\t}//es una petición GET\n\t\t//se realiza la consulta a la bd\n\t\t$query = $this->_conn->query(\n\t\t\t\"SELECT id, nombre, email \n\t\t\t FROM usuario\");\n\t\t//cantidad de usuarios\n\t\t$filas = $query->fetchAll(PDO::FETCH_ASSOC); \n \t$num = count($filas);\n \t//si devolvio un resultado, se envia al cliente\n \tif ($num > 0) { \n\t $respuesta['estado'] = 'correcto'; \n\t $respuesta['usuarios'] = $filas; \n\t $this->mostrarRespuesta($this->convertirJson($respuesta), 200); \n\t } //se envia un error \n\t $this->mostrarRespuesta($this->devolverError(2), 204);\n\t}", "public function cargarUsuario(){\n $query = \"SELECT nombre, apellido, sexo, DATE_FORMAT(fecha_nac, '%d/%m/%Y') AS fecha_nac, correo FROM usuario WHERE codUsuario = \".parent::string($this->getCodUsuario()).\";\";\n $result = mysqli_query(parent::conexion(), $query);\n $arreglo = null;\n\n if(!$result){\n \t\tdie(\"Error\");\n } else{\n while($data = mysqli_fetch_assoc($result)){\n $arreglo[] = $data;\n \t\t }\n }\n\n parent::desconectar();\n return json_encode($arreglo);\n }", "public function UserData(){\n\t\t$this->id = \"\"; \n\t\t$this->nombre =null;\n\t\t$this->cc = null;\n $this->email = null; \n\t\t$this->telefono =null;\n\t\t$this->rol = null;\n\t\t$this->user = null; \n\t\t$this->pass = null;\n \n\t}", "private function consultar_usuario_todos() {\n $sentencia = \"select id,nombrecompleto ,correo,token from usuario u;\";\n $this->respuesta = $this->obj_master_select->consultar_base($sentencia);\n }", "public function actualizarUsuario()\n {\n //quitamos el id del array y lo guardamos a parte\n $datos = $_POST;\n $ciu = isset($datos['CIU']) ? $datos['CIU'] : $this->session->userdata(\"ciu\");\n unset($datos['CIU']);\n\n //miramos si ha enviado imagen de perfil. de ser asi se procesa en otro metodo aparte y se quita del array\n if (isset($datos['img'])) {\n self::actualizarImagenPerfil($datos['img']);\n unset($datos['img']);\n }\n\n echo $this->Usuarios_model->actualizarUsuario($ciu, $datos);\n }", "public function agregarUsuario(){\n \n }", "function getAllUsuarios(){\n\t\t\tDB_DataObject::debugLevel(0);\n\t\t\t$obj = DB_DataObject::Factory('VenUsuario');\n\t\t\t$obj->find();\n\t\t\t$i = 0;\n\t\t\t$data='';\n\t\t\twhile($obj->fetch()){\n\t\t\t\t$data[$i]['idUsuario']=$obj->idUsuario;\n\t\t\t\t$data[$i]['idCargo']=$obj->idCargo;\n\t\t\t\t$nombreCargo=$this->getCargoById($obj->idCargo);\n\t\t\t\t$nombreCargo=utf8_encode($nombreCargo['nombre']);\n\t\t\t\t$data[$i]['cargo']= $nombreCargo;\n\t\t\t\t$data[$i]['nombre']=utf8_encode($obj->nombre);\n\t\t\t\t$data[$i]['apellido']=utf8_encode($obj->apellido);\n\t\t\t\t$data[$i]['email']=$obj->email;\n\t\t\t\t$data[$i]['usuario']=utf8_encode($obj->usuario);\n\t\t\t\t$data[$i]['contrasena']=utf8_encode($obj->contrasena);\n\t\t\t\t$data[$i]['puntos']=$obj->puntos;\n\t\t\t\t$data[$i]['estado']=$obj->estado;\n\t\t\t\t$data[$i]['fechaMod']=$obj->fechaMod;\n\t\t\t\t$data[$i]['fecha']=$obj->fecha;\n\t\t\t\t$i++;\n\t\t\t}\n\t\t\t$obj->free();\n\t\t\t//printVar($data,'getAllUsuarios');\n\t\t\treturn $data;\n\t\t}", "public function updatedUsuario()\n {\n // Notificamos al otro componente el cambio\n $this->emit('cambioUsuario', $this->usuario);\n }", "public function buscarUsuarios(){\n\t\t}", "function modeloUserGetAll (){\n // Genero lo datos para la vista que no muestra la contraseña ni los códigos de estado o plan\n // sino su traducción a texto\n $db = AccesoDatos::getModelo();\n $tusuarios = $db->getUsuarios();\n foreach ($tusuarios as $clave=>$user){\n \n $tabla[$user->id]= ['nombre'=>$user->nombre,\n 'correo'=>$user->correo,\n 'plan'=>PLANES[$user->plan],\n 'estado'=>ESTADOS[$user->estado],\n ];\n }\n return $tabla;\n}", "function altaUsuarioProfesor($datos) {\n\n if (BDConexionSistema::getInstancia()->begin_transaction()) {\n // INSERCION PROFESOR\n //Creo objeto sin enviar ID y enviando todos los datos del formulario\n $Profesor = new Profesor(null, $datos);\n $apellido = mysqli_real_escape_string(BDConexionSistema::getInstancia(), $Profesor->getApellido());\n\n if ($this->chequearEmail($Profesor->getEmail())) {\n $this->query = \"INSERT INTO PROFESOR \"\n . \"VALUES ('{$Profesor->getId()}', '0', '{$Profesor->getNombre()}', '{$apellido}',\"\n . \"'{$Profesor->getEmail()}', '{$Profesor->getCategoria()}', '{$Profesor->getPreferencias()}', '{$Profesor->getIdDepartamento()}')\";\n\n $consulta = BDConexionSistema::getInstancia()->query($this->query);\n } else {\n throw new Exception(\"El email: <b>\" . $Profesor->getEmail() . \"</b> ya corresponde a un profesor en la Base de Datos\");\n }\n\n if (!$consulta) {\n BDConexionSistema::getInstancia()->rollback();\n throw new Exception(\"No se puedo dar de alta el profesor (Error en la Base de Datos).\");\n }\n\n // INSERCION USUARIO\n\n $query = \"INSERT INTO \" . Constantes::BD_USERS . \".usuario \"\n . \"VALUES (null,'{$datos[\"nombreUsuario\"]}','{$datos[\"email\"]}')\";\n $consulta = BDConexionSistema::getInstancia()->query($query);\n if (!$consulta) {\n BDConexionSistema::getInstancia()->rollback();\n //arrojar una excepcion\n //die(BDConexion::getInstancia()->errno);\n throw new Exception(\"No se puedo dar de alta el profesor (Error en la Base de Datos).\");\n }\n\n // recuperamos la id del usuario\n $idUsuario = BDConexionSistema::getInstancia()->insert_id;\n\n // INSERCION USUARIO_ROL\n $query = \"INSERT INTO \" . Constantes::BD_USERS . \".usuario_rol \"\n . \"VALUES ({$idUsuario}, 9)\";\n $consulta = BDConexionSistema::getInstancia()->query($query);\n if (!$consulta) {\n BDConexionSistema::getInstancia()->rollback();\n //arrojar una excepcion\n //die(BDConexion::getInstancia()->errno);\n throw new Exception(\"No se puedo dar de alta el profesor (Error en la Base de Datos).\");\n }\n\n BDConexionSistema::getInstancia()->commit();\n BDConexionSistema::getInstancia()->autocommit(true);\n\n // si no se produjeron excepciones OK insercion, retornamos VERDADERO\n return TRUE;\n } else {\n throw new Exception(\"No se puedo dar de alta el profesor (Error en la Base de Datos).\");\n }\n }", "function fetchUsuario() {\n\n $usuarios = array();\n\n $con = new DB();\n $sql = $con->prepare(\"SELECT * FROM usuario\");\n $result = $con->executeQuery($sql);\n\n foreach ($result as $row) {\n $id = $row['id'];\n $username = $row['username'];\n $password = $row['password'];\n $email = $row['email'];\n $poblacion = $row['poblacion'];\n $idioma = $row['idioma'];\n $telefono = $row['telefono'];\n $url = $row['url'];\n $foto = $row['foto'];\n $textoPresentacion = $row['textoPresentacion'];\n $administrador = $row['esAdministrador'];\n $registrado = $row['esUsuarioRegistrado'];\n $professional = $row['esUsuarioProfesional'];\n $usuario = new Usuario($id, $username, $password, $email, $poblacion, $idioma, $telefono, $url, $foto, $textoPresentacion, $administrador, $registrado, $professional);\n array_push($usuarios, $usuario);\n }\n\n return $usuarios;\n }", "public function buscar_Usuario2($id){\n\t\t$sql = \"select Documento, Nombres, Apellidos, Usuario, Password, Pregunta, Respuesta,\n\t\t\tTipo_Documento,Ciudad, Direccion, Edad,Foto,Telefono,Correo_Electronico,\n\t\t\tGenero,perfiles_Nombre \n\t\t\tfrom usuarios where Documento='$id'\";\n\t\t$registros = $this->bd->consultar($sql);\n\t\tif($reg=mysql_fetch_array($registros)){\n\t\t\t$this->usuario->set_Nid($reg['Documento']);\n\t\t\t$this->usuario->set_Usuario($reg['Usuario']);\n\t\t\t$this->usuario->set_Password($reg['Password']);\n\t\t\t$this->usuario->set_Nombres($reg['Nombres']);\n\t\t\t$this->usuario->set_Apellidos($reg['Apellidos']);\n\t\t\t$this->usuario->set_TipoId($reg['Tipo_Documento']);\n\t\t\t$this->usuario->set_Ciudad($reg['Ciudad']);\n\t\t\t$this->usuario->set_Direccion($reg['Direccion']);\n\t\t\t$this->usuario->set_Email($reg['Correo_Electronico']);\n\t\t\t$this->usuario->set_Pregunta($reg['Pregunta']);\n\t\t\t$this->usuario->set_Respuesta($reg['Respuesta']);\n\t\t\t$this->usuario->set_Celular($reg['Telefono']);\n\t\t\t$this->usuario->set_Edad($reg['Edad']);\n\t\t\t$this->usuario->set_Foto($reg['Foto']);\n\t\t\t$this->usuario->set_Genero($reg['Genero']);\n\t\t\t$this->usuario->set_Perfil($reg['perfiles_Nombre']);\n\n\t\t}\n\t}", "private function usrsave() {\n $id = 0;\n $resultado = 0;\n $pass = '';\n if ($this->UTILITY->validate_email($this->email)) {\n $arrjson = $this->UTILITY->error_wrong_email();\n } else {\n if ($this->id > 0) {\n //se verifica que el email está disponible\n $q = \"SELECT usr_id FROM ass_usuario WHERE usr_email = '\" . $this->email . \"' AND usr_id != $this->id \";\n $con = mysql_query($q, $this->conexion) or die(mysql_error() . \"***ERROR: \" . $q);\n $resultado = mysql_num_rows($con);\n if ($resultado == 0) {\n //actualiza la informacion\n $q = \"SELECT usr_id FROM ass_usuario WHERE usr_id = \" . $this->id;\n $con = mysql_query($q, $this->conexion) or die(mysql_error() . \"***ERROR: \" . $q);\n while ($obj = mysql_fetch_object($con)) {\n $id = $obj->usr_id;\n if (strlen($this->pass) > 2) {\n $pass = $this->UTILITY->make_hash_pass($this->email, $this->pass);\n }\n $table = \"ass_usuario\";\n $arrfieldscomma = array(\n 'usr_nombre' => $this->nombre,\n 'usr_apellido' => $this->apellido,\n 'usr_email' => $this->email,\n 'usr_pass' => $pass,\n 'usr_cargo' => $this->cargo,\n 'usr_identificacion' => $this->identificacion,\n 'usr_celular' => $this->celular,\n 'usr_telefono' => $this->telefono,\n 'usr_habilitado' => $this->habilitado,\n 'usr_contacto' => $this->contacto);\n $arrfieldsnocomma = array('mzt_proveedor_pro_id' => $this->idprov, 'mzt_cliente_cli_id' => $this->idcli, 'usr_dtcreate' => $this->UTILITY->date_now_server());\n $q = $this->UTILITY->make_query_update($table, \"usr_id = '$id'\", $arrfieldscomma, $arrfieldsnocomma);\n mysql_query($q, $this->conexion) or die(mysql_error() . \"***ERROR: \" . $q);\n $arrjson = array('output' => array('valid' => true, 'id' => $id));\n }\n } else {\n $arrjson = $this->UTILITY->error_user_already_exist();\n }\n } else {\n //se verifica que el email está disponible\n $q = \"SELECT usr_id FROM ass_usuario WHERE usr_email = '\" . $this->email . \"'\";\n $con = mysql_query($q, $this->conexion) or die(mysql_error() . \"***ERROR: \" . $q);\n $resultado = mysql_num_rows($con);\n if ($resultado == 0) {\n if (strlen($this->pass) > 2) {\n $pass = $this->UTILITY->make_hash_pass($this->email, $this->pass);\n }\n $this->pass = $pass;\n $q = \"INSERT INTO ass_usuario (usr_dtcreate, mzt_cliente_cli_id, mzt_proveedor_pro_id, usr_habilitado, usr_nombre, usr_apellido, usr_cargo, usr_email, usr_pass, usr_identificacion, usr_celular, usr_telefono, usr_contacto) VALUES (\" . $this->UTILITY->date_now_server() . \", $this->idcli, $this->idprov, '$this->habilitado', '$this->nombre', '$this->apellido', '$this->cargo', '$this->email', '$this->pass', '$this->identificacion', '$this->celular', '$this->telefono', '$this->contacto')\";\n mysql_query($q, $this->conexion) or die(mysql_error() . \"***ERROR: \" . $q);\n $id = mysql_insert_id();\n $arrjson = array('output' => array('valid' => true, 'id' => $id));\n } else {\n $arrjson = $this->UTILITY->error_user_already_exist();\n }\n }\n }\n $this->response = ($arrjson);\n }", "public function login($user, $clave)\n {\n parent::conectar();\n\n \n\n // El metodo salvar sirve para escapar cualquier comillas doble o simple y otros caracteres que pueden vulnerar nuestra consulta SQL\n $user = parent::salvar($user);\n $clave = parent::salvar($clave);\n\n // Si necesitas filtrar las mayusculas y los acentos habilita las lineas 36 y 37 recuerda que en la base de datos debe estar filtrado tambien para una \n \n\t$consulta = 'select id, nombre, cargo from usuarios where email=\"'.$user.'\" and clave= MD5(\"'.$clave.'\")\n\t UNION SELECT codpaci, nombrep, cargo from customers where email =\"'.$user.'\" and clave= MD5(\"'.$clave.'\")';\n\t \n\t \n /*\n Verificamos si el usuario existe, la funcion verificarRegistros\n retorna el número de filas afectadas, en otras palabras si el\n usuario existe retornara 1 de lo contrario retornara 0\n */\n\n $verificar_usuario = parent::verificarRegistros($consulta);\n\n // si la consulta es mayor a 0 el usuario existe\n if($verificar_usuario > 0){\n\n \n\n /*\n Realizamos la misma consulta de la linea 55 pero esta ves transformaremos el resultado en un arreglo,\n ten mucho cuidado con usar el metodo consultaArreglo ya que devuelve un arreglo de la primera fila encontrada\n es decir, como nosotros solo validamos a un usuario no hay problema pero esta funcion no funciona si\n vas a listar a los usuarios, espero que me entiendan xd\n */\n\n $user = parent::consultaArreglo($consulta);\n\n /*\n Bien espero ser un poco claro en esta parte, la variable user\n en la linea 69 pasa a ser un arreglo con los campos consultados en la linea\n 48, entonces para acceder a los datos utilizamos $user[nombre_del_campo] Ok?\n bueno hagamos el ejercicio.\n */\n\n /*\n Inicializamos la sessión | Recuerda con las variables de sesión\n podemos acceder a la informacion desde cualquiera pagina siempre y cuando\n exista una sesión y ademas utilicemos el codigo de la linea 84\n */\n\n session_start();\n\n /*\n Las variables de sesion son muy faciles de usar, es como\n declarar una variable, lo unico diferente es que obligatoria mente\n debes usar $_SESSION[] y .... el nombre de la variable ya no sera asi\n $miVariable sino entre comillas dentro del arreglo de sesion, haber me\n dejo explicar, $_SESSION['miVariable'], recuerda que como declares la variable\n en este archivo asi mismo lo llamaras en los demas.\n */\n\n $_SESSION['id'] = $user['id'];\n $_SESSION['nombre'] = $user['nombre'];\n $_SESSION['cargo'] = $user['cargo'];\n\n /*\n Que porqué almacenamos cargo? es encillo en nuestros proyectos\n pueden existir archivos que solo puede ver un usuario con el cargo de\n administrador y no un usuario estandar, asi que la variable global de\n sesion nos ayudara a verificar el cargo del usuario que ha iniciado sesion\n Ok?\n */\n\n /*\n Recuerda:\n cargo con valor: 1 es: Administrador\n cargo con valor: 2 es: usuario estandar\n puedes agregar cuantos cargos desees, en este ejemplo solo uso 2\n */\n\n // Verificamos que cargo tiene l usuario y asi mismo dar la respuesta a ajax para que redireccione\n if($_SESSION['cargo'] == 1){\n echo 'view/admin/admin.php';\n }else if($_SESSION['cargo'] == 2){\n echo 'view/user/user.php';\n }\n\n\n // u.u finalizamos aqui :v\n\n }else{\n // El usuario y la clave son incorrectos\n echo 'error_3';\n }\n\n\n # Cerramos la conexion\n parent::cerrar();\n }", "public function getdatosUsuarios(){\n\t\t$bd = new bd();\n\t\t$result = $bd->doSingleSelect($this->u_table,\"id = {$this->id}\");\n\t\tif($result){\n\t\t\t$this->datosUsuario($result[\"direccion\"], $result[\"telefono\"], $result[\"descripcion\"], $result[\"estados_id\"], $result[\"facebook\"], $result[\"twitter\"],$result[\"website\"],$result[\"certificado\"],$result[\"id_sede\"]);\n\t\t\t$this->id = $result[\"id\"];\n\t\t}else {\n\t\t\treturn false;\n\t\t}\n\t}", "public function getUsers(){\n $query = \"SELECT * FROM usuario \";\n return self::getInstance()->consulta($query);\n }", "public function saveUsuario(){\n\t\t$conexion = new Database();\n if ($this->codigo){\n $query = sprintf('UPDATE agenda_usuario SET usuario = \"%s\" password = \"%s\" WHERE usuario_id = %d',\n $this->usuario,\n $this->password,\n $this->codigo);\n $rows = $conexion->exec( $query );\n }\n else{\n $query = sprintf('INSERT INTO agenda_usuario ( usuario, password) VALUES (\"%s\", \"%s\")',\n $this->usuario,\n $this->password );\n\t\t\t$rows = $conexion->exec( $query );\n $this->codigo = $conexion->lastInsertId();\n }\n }", "function Usuario($idUsuario = '')\n\t\t{\n\t\t\t$this->id = \"usuario_id\";\n\t\t\t$this->tabla = \"usuario\";\n\t\t\t\n\t\t\t$this->exitoListar = t(\"User list obtained successfully\");\n\t\t\t$this->errorListar = t(\"Error obtaining user list\");\n\t\t\t$this->exitoInsertar = t(\"User created successfully\");\n\t\t\t$this->exitoActualizar = t(\"User updated successfully\");\n\t\t\t$this->errorInsertar = t(\"Error creating user\");\n\t\t\t$this->errorActualizar = t(\"Error updating user\");\t\n\t\t\t\n\t\t\t$this->campos = array(\n\t\t\t\t'usuario_id' => array('tipo'=>'id','nulo'=>true,'msg'=>t('Invalid user ID'),'valor'=>'','lectura'=>false),\n\t\t\t\t'usuario_nombre' => array('tipo'=>'string','nulo'=>true,'msg'=>t('Invalid user name'),'valor'=>'','lectura'=>false),\n\t\t\t\t'usuario_login' => array('tipo'=>'string','nulo'=>false,'msg'=>t('Invalid user login'),'valor'=>null,'lectura'=>false),\n\t\t\t\t'usuario_password' => array('tipo'=>'string','nulo'=>false,'msg'=>t('Invalid password'),'valor'=>null,'lectura'=>false),\n\t\t\t\t'usuario_rol_id' => array('tipo'=>'int','nulo'=>false,'msg'=>t('Invalid Rol'),'valor'=>null,'lectura'=>false),\n\t\t\t\t'usuario_email' => array('tipo'=>'email','nulo'=>true,'msg'=>t('Invalid email'),'valor'=>'','lectura'=>false),\n\t\t\t\t'usuario_apellido1' => array('tipo'=>'string','nulo'=>true,'msg'=>t('Invalid surname1'),'valor'=>'','lectura'=>false),\n\t\t\t\t'usuario_apellido2' => array('tipo'=>'string','nulo'=>true,'msg'=>t('Invalid surname2'),'valor'=>'','lectura'=>false),\n\t\t\t\t'usuario_detalles' => array('tipo'=>'html','nulo'=>true,'msg'=>t('Invalid details'),'valor'=>'','lectura'=>false)\n\t\t\t);\n\n\t\t\t$this->relaciones = array(\n\t\t\t\n\t\t\t\t'rol' => array (\n\t\t\t\t\t'tabla' => 'rol',\n\t\t\t\t\t'relacion' => '1a1',\n\t\t\t\t\t'soloLectura' => true,\n\t\t\t\t\t'clavePrimaria' => 'usuario_rol_id',\n\t\t\t\t\t'claveAjena1' => 'rol_id',\n\t\t\t\t\t'claveAjena2' => '',\n\t\t\t\t\t'campos' => array(\n\t\t\t\t\t\t'rol_id' => array('tipo'=>'id','nulo'=>true,'msg'=>t('Invalid rol id'),'valor'=>'','lectura'=>true),\t\t\t\t\t\n\t\t\t\t\t\t'rol_nombre' => array('tipo'=>'string','nulo'=>true,'msg'=>t('Invalid rol name'),'valor'=>'','lectura'=>true)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t\t\n\t\t\t$this->campos['usuario_id']['valor'] = $idUsuario;\n\t\t}", "public function getUsuarios(){\n\t\t$filasPagina = 7;//registros mostrados por página\n\n\t\tif(isset($_GET['pagina'])){//si le pasamos el valor \"pagina\" de la url (si el usuario da click en la paginación)\n\t\t\t\tif($_GET['pagina']==1){\n\t\t\t\t$pagina=1; \n\t\t\t\theader(\"Location: principal.php?c=controlador&a=muestraUsuarios\");\n\t\t\t\t}else{\n\t\t\t\t\t$pagina=$_GET['pagina'];//índice que indica página actual\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$pagina=1;//índice que indica página actual\n\t\t\t}\n\n\t\t\t$empezarDesde = ($pagina-1) * $filasPagina;\n\n\t\t\t$sql = \" SELECT * FROM usuarios \";\n\n\t\t\t$resultado = $this->db->query($sql);\n\n\t\t\t$resultado->execute(array());\n\n\t\t\t$numFilas = $resultado->rowCount();//número de registos totales de la consulta\n\n\t\t\t//ceil — Redondear fracciones hacia arriba\n\t\t\t$totalPaginas = ceil($numFilas / $filasPagina);//calcula cuántas páginas serán en total para mostrar todos los registros\n\n\t\t\t$resultado->closeCursor();\n\n\t\t//------------------------- Consulta para mostrar los resultados ---------------------------\n\n\t\t\t$sql_limite = \" SELECT * FROM usuarios LIMIT $empezarDesde , $filasPagina \";\n\n\t\t\t$resultado = $this->db->query($sql_limite);//ejecutando la consulta con la conexión establecida\n\n\t\t\twhile($row = $resultado->fetch(PDO::FETCH_ASSOC)){\n\t\t\t\t$this->objeto[] = $row;//llenando array con valores de la consulta\n\t\t\t}\n\n\t\treturn $this->objeto;\n\t}", "public function actualizarusuario($imagenperfil,$datosuser,$id){\n // NOTE: obtener los usuarios en usuarios.json, transformandolos en un array\n $usuarios = $this->buscarUsuarios();\n // NOTE: recorrer array de todos los usuarios y sobreescribir el registro que corresponda al usuario a editar\n if (!empty($usuarios)) {\n // NOTE: vacio el archivo usuarios.json para poder insertar las modificaciones sin duplicar al usuario\n file_put_contents('usuarios.json', '');\n foreach ($usuarios as $usuario) {\n // NOTE: si encuentro al usuario guardo las modificaciones\n if (strtolower($id) == strtolower($usuario['id'])) {\n $usuario['nombre'] = $datosuser['nombre'];\n $usuario['apellido'] = $datosuser['apellido'];\n $usuario['email'] = $datosuser['email'];\n if ($usuario['password'] != $datosuser['password']) {\n $usuario['password'] = password_hash($datosuser['password'],PASSWORD_DEFAULT);\n }\n if ($imagenperfil['imgperfil']['error'] === UPLOAD_ERR_OK) {\n $ext = strtolower(pathinfo($imagenperfil['imgperfil']['name'], PATHINFO_EXTENSION));\n $hasta = '/images/profileImg/'.'perf'.$id.'.'.$ext;\n $usuario['srcImagenperfil'] = $hasta;\n }\n $userjson = json_encode($usuario);\n file_put_contents('usuarios.json', $userjson . PHP_EOL, FILE_APPEND);\n $this->subirImgPerfil($imagenperfil,$id);\n }else {\n // NOTE: si no encuentro al usuario guardo a los demas sin cambios\n $userjson = json_encode($usuario);\n file_put_contents('usuarios.json', $userjson . PHP_EOL, FILE_APPEND);\n }\n }\n }\n // NOTE: volver a convertir a json y guardar archivo usuarios.json\n //$userjson = json_encode($usuarios);\n //file_put_contents('usuarios2.json', $userjson . PHP_EOL, FILE_APPEND);\n //subirImgPerfil($imagenperfil,$id);\n\n\n }", "function findAll() \n {\n $usuarios = array();\n $n=0;\n $sql=\"select u.id,u.nombre,u.paterno,u.materno,u.username,u.fechaAlta,\".\n \" u.estatus,u.idTipoUsuario,tu.descripcion from Usuarios u\".\n \" inner join TipoUsuarios tu on tu.id=u.idTipoUsuario\".\n \" order by u.id\";\n \n $usuariosRs = mysqli_query($this->_connDb, $sql); \n while ($row = mysqli_fetch_array($usuariosRs)) {\n $oUsuario = new Usuario(0);\n $oUsuario->setId($row['id']);\n $oUsuario->setNombre($row['nombre']);\n $oUsuario->setPaterno($row['paterno']);\n $oUsuario->setMaterno($row['materno']);\n $oUsuario->setUsername($row['username']);\n $oUsuario->setFechaAlta($row['fechaAlta']);\n $oUsuario->setEstatus($row['estatus']);\n\n // Creamos el objeto de tipo TipoUsuario\n $oTipoUsuario = new TipoUsuario($row['idTipoUsuario']);\n $oTipoUsuario->setDescripcion($row['descripcion']);\n\n // Inyectamos la dependencia de TipoUsuario\n $oUsuario->setTipoUsuario($oTipoUsuario);\n $usuarios[$n]=$oUsuario;\n $n++; \n }\n return $usuarios;\n }", "public function readUsuarios()\n\t{\n\t\t$sql = 'SELECT IdRol, Nombre, Apellido, Telefono, Email, u.IdEstado, IdUsuario \n FROM usuarios u ORDER BY Apellido';\n\t\t$params = array(null);\n\t\treturn Database::getRows($sql, $params);\n\t}", "public static function getAllUsuario(){\n $v = array();\n\t\t$conexion = new Database();\n $sql = sprintf('SELECT * FROM agenda_usuarios' );\n $rows = $conexion->query( $sql );\n\n foreach( $rows as $row ){\n\t\t\t$u = new Usuario();\n\t\t\t$u->usuario = $row['USUARIO'];\n $u->password = $row['PASSWORD'];\n $u->codigo = $row['USUARIO_ID'];\n\t\t\t$v[] = $u;\n\t\t}\n return $v;\n }", "function usuario($usuario) {\r\n $u = $this->consultar($usuario);\r\n $p = $this->perfil($u[\"perfil\"]);\r\n return(array_merge($u, $p));\r\n }", "function ListaUsuario() {\n\t\n\t\t\t$sql = \"SELECT usu.*, CONCAT_WS(' ', per.primer_nombre, per.primer_apellido) as nombre_completo, usu.nombre_usuario, rol.descripcion FROM usuario usu\n\t\t\t\t\tINNER JOIN rol rol ON rol.id = usu.rol_id\n\t\t\t\t\tINNER JOIN persona per ON per.id = usu.persona_id\";\n\t\t\t$db = new conexion();\n\t\t\t$result = $db->consulta($sql);\n\t\t\t$num = $db->encontradas($result);\n\t\t\t$respuesta->datos = [];\n\t\t\t$respuesta->mensaje = \"\";\n\t\t\t$respuesta->codigo = \"\";\n\t\t\tif ($num != 0) {\n\t\t\t\tfor ($i=0; $i < $num; $i++) {\n\t\t\t\t\t$respuesta->datos[] = mysql_fetch_array($result);\n\t\t\t\t}\n\t\t\t\t$respuesta->mensaje = \"Ok\";\n\t\t\t\t$respuesta->codigo = 1;\n\t\t\t} else {\n\t\t\t\t$respuesta->mensaje = \"No existen registros de roles.\";\n\t\t\t\t$respuesta->codigo = 0;\n\t\t\t}\n\t\t\treturn json_encode($respuesta);\n\t\t}", "function datosFormModificar(){\n\t\t\n\t\t$dni2 = $_POST['dniN'];\n\t\t$password2 = $_POST['passwordN'];\n\t\t$grupo2 = $_POST['grupoN'];\n\t\t$usuario2 = $_POST['usuarioN'];\n\t\t$nombre2 = $_POST['nombreN'];\n\t\t$apellidos2 = $_POST['apellidosN'];\n\t\t$email2 = $_POST['emailN'];\n\t\t$telefono2 = $_POST['telefonoN'];\n\t\t\n\t\t$usuario2 = new usuario($dni2,$password2,$grupo2,$usuario2,$nombre2,$apellidos2,$email2,$telefono2);\n\t\treturn $usuario2;\n\t}", "public function Listar()\n\t{\n\t\ttry\n\t\t{\n\t\t\t$result = array();\n\n\t\t\t$stm = $this->pdo->prepare(\"SELECT usuario.`correo`, `usuario`.`clave`, `rol`.`nomRol`, `datospersonales`.`Documento`\nFROM `usuario`\nLEFT JOIN `rol` ON `rol`.`nomRol` = `usuario`.`nomRol` \nLEFT JOIN `datospersonales` ON `datospersonales`.`Documento` = `usuario`.`Documento`\n WHERE correo is not null \");\n\t\t\t$stm->execute();\n\n\t\t\tforeach($stm->fetchAll(PDO::FETCH_OBJ) as $r)\n\t\t\t{\n\t\t\t\t$usu = new Usuario();\n\n\t\t\t\t$usu->__SET('correo', $r->correo);\n\t\t\t\t$usu->__SET('clave', $r->clave);\n\t\t\t\t$usu->__SET('nomRol', $r->nomRol);\n\t\t\t\t$usu->__SET('Documento', $r->Documento);\n\t\t\t\t\n\t\t\t\t\n\n\t\t\t\t$result[] = $usu;\n\t\t\t}\n\n\t\t\treturn $result;\n\t\t}\n\t\tcatch(Exception $e)\n\t\t{\n\t\t\tdie($e->getMessage());\n\t\t}\n\t}", "function datos_usuario($id_usuario) {\n\t\t$query = \"SELECT colaboradores.*, colaboradores_permisos.*\n\t\tFROM colaboradores, colaboradores_permisos\n\t\tWHERE colaboradores.id_colaborador='$id_usuario'\n\t\tAND colaboradores.id_colaborador=colaboradores_permisos.id_colaborador\n\t\tAND colaboradores.estado=1\";\n\n $connection = mysql_connect($this->HOST, $this->USERNAME, $this->PASSWORD);\n\t\t\n\t\t$SelectedDB = mysql_select_db($this->DBNAME);\n\t\t$result = mysql_query($query); \n\t\t\n\t\t$numrows = mysql_num_rows($result);\n\t\tmysql_close($connection);\n\t\t// COMPROBAMOS QUE HAYA RESULTADOS\n\t\t// SI EL NUMERO DE RESULTADOS ES 0 SIGNIFICA QUE NO HAY REGISTROS CON ESOS DATOS\n\t\tif ($numrows == 0) {\n\t\t\treturn $result;\n\t\t}\n\t\telse {\n\t\t\treturn $result;\n\t\t}\n\t}", "public function actualizaSoloUsuario($dataArray){\n //deleted, created_at y updated_at son comunes, pero estos jamas se actualizaran por acá\n if (array_key_exists('password',$dataArray))\n $dataArray['password'] = bcrypt($dataArray['password']);\n \n $this->model->update($dataArray); //set data only in its PersonaNatural model\n }", "public static function getUsuarios()\n {\n $query = \"SELECT id,nombre,email,usuario,privilegio,fecha_registro FROM users\";\n\n self::getConexion();\n\n $resultado = self::$cnx->prepare($query);\n\n $resultado->execute();\n\n $filas = $resultado->fetchAll();\n\n return $filas;\n }", "public function getUsuario(){\n $sql=\"SELECT id, tipo, tipo_identificacion, numero_identificacion, apellidos, nombres, razon_social, codigo, \n direccion, telefono1, telefono2, celular1, celular2, email1, email2, fecha_nacimiento, profesion, \n actividades, rol, fecha_registro, descripcion FROM ctk_usuario where estado=1\";\n //$sentencia=$this->conexion_db->prepare($sql);\n //$sentencia->execute(array());\n //$resultado=$sentencia->fetchAll(PDO::FETCH_ASSOC);\n //otra opcion \n //$resultado=$this->conexion_db->query($sql)->fetchAll(PDO::FETCH_ASSOC);\n $resultado=$this->conexion_db->query($sql)->fetchAll(PDO::FETCH_OBJ);\n //$sentencia->closeCursor();\n return $resultado;\n $this->conexion_db=null;\n \n //El ejemplo que se encuentra a continuacion realiza la consulta con la libreria mysqli\n /*\n $resultado=$this->conexion_db->query(\"SELECT codigo_ticket, abierto_por, fecha_apertura, fecha_cierre, \n descripcion_evento, tecnico_ctk FROM ctk_ticket WHERE tecnico_ctk='\".$buscar.\"'\");\n $ticket=$resultado->fetch_all(MYSQLI_ASSOC);\n return $ticket;\n */\n }", "public function usrget() {\n $q = \"SELECT * FROM ass_usuario WHERE usr_contacto='no' ORDER BY usr_nombre ASC\";\n if ($this->id > 0) {\n $q = \"SELECT * FROM ass_usuario WHERE usr_contacto='no' AND usr_id = \" . $this->id;\n }\n //if ($this->sdid > 0) {\n // $q = \"SELECT * FROM fir_usuario WHERE fir_sede_sde_id = \" . $this->sdid;\n //}\n //if ($this->euid > 0) {\n // $q = \"SELECT * FROM fir_usuario WHERE fir_empresa_emp_id = \" . $this->euid;\n //}\n $con = mysql_query($q, $this->conexion) or die(mysql_error() . \"***ERROR: \" . $q);\n $resultado = mysql_num_rows($con);\n $arr = array();\n while ($obj = mysql_fetch_object($con)) {\n $arr[] = array(\n 'id' => $obj->usr_id,\n 'idcli' => $obj->mzt_cliente_cli_id,\n 'idprov' => $obj->mzt_proveedor_pro_id,\n 'nombre' => ($obj->usr_nombre),\n 'apellido' => ($obj->usr_apellido),\n 'cargo' => ($obj->usr_cargo),\n 'email' => ($obj->usr_email),\n 'identificacion' => ($obj->usr_identificacion),\n 'celular' => ($obj->usr_celular),\n 'telefono' => ($obj->usr_telefono),\n 'habilitado' => ($obj->usr_habilitado),\n 'dtcreate' => ($obj->usr_dtcreate));\n }\n//PEDIR ARCHIVOS\n $qa = \"SELECT arc_nombre FROM ass_archivos WHERE mzt_usuario_usr_id= \" . $this->id;\n if ($qa != \"\") {\n $cona = mysql_query($qa, $this->conexion) or die(mysql_error() . \"***ERROR: \" . $qa);\n $resultadoa = mysql_num_rows($cona);\n $arra = array();\n while ($obja = mysql_fetch_object($cona)) {\n $arra[] = array(\n 'ref_imagen' => ($obja->arc_nombre));\n }\n }\n if ($resultado > 0) {\n $arrjson = array('output' => array('valid' => true, 'response' => $arr, 'response2' => $arra));\n } else {\n $arrjson = $this->UTILITY->error_no_result();\n }\n $this->response = ($arrjson);\n }", "public function buscarUsuario($idUser){\n\t\t\t\n\t\t\t$this->load->database();\n\t\t\t\n\t\t\t$query = $this->db->query(\"SELECT * FROM user WHERE id_user = $idUser\");\n\t\t\t\n\t\t\t\t $dados = array();\n\t\t\t\t \tforeach($query->result() as $linha)\n\t\t\t\t \t{\n\t\t\t\t \t\t$dados['id_user'] = $linha->id_user;\n\t\t\t\t \t\t$dados['nome'] = $linha->nome;\n\t\t\t\t \t\t$dados['email'] = $linha->email;\n\t\t\t\t \t\t$dados['login'] = $linha->login;\n\t\t\t\t \t\t$dados['perfil'] = $linha->perfil;\n\t\t\t\t }\n\n\t\t\treturn($dados);\n\t\t\t\n\t\t}", "private function consultar_usuario_por_id() {\n\n if (is_numeric($this->referencia_a_buscar)) {\n $id_a_buscar = intval($this->referencia_a_buscar);\n $sentencia = \"select id,nombrecompleto ,correo,token from usuario u where u.id= {$id_a_buscar};\";\n $this->respuesta = $this->obj_master_select->consultar_base($sentencia);\n } else {\n $this->respuesta = null;\n }\n }", "public function loadData(){\r\n\t\t\t $pseudo = addslashes($this -> getPseudo()) ;\r\n\r\n\t\t if(! empty($pseudo)){\r\n\t\t\t$q = \"select * from UserTab where User_pseudo='\".$pseudo.\"'\";\r\n\t\t\t$r = execute($q);\r\n\t\t\twhile( $l = mysql_fetch_assoc($r) ){\r\n\t\t\t\t$this -> setFields($l);//Affectation aux champs de l'objet UserTab \r\n\t\t\t}\r\n\t\t }\r\n\r\n\t }", "private function getUserData()\n { \n $variables = \"\";\n \n $fields = array(\n \"id\" => Auth::user()->id,\n \"name\" => Auth::user()->name,\n \"apellido_paterno\" => Auth::user()->apellido_paterno,\n \"apellido_materno\" => Auth::user()->apellido_materno,\n \"photo\" => Auth::user()->photo,\n \"email\" => Auth::user()->email,\n \"password\" => Auth::user()->password,\n \"status\" => Auth::user()->status,\n \"nomina\" => Auth::user()->nomina,\n \"plaza\" => Auth::user()->plaza,\n \"area\" => Auth::user()->area,\n \"posicion_track\" => Auth::user()->posicion_track,\n \"company\" => Auth::user()->company,\n \"fecha_ingreso\" => Auth::user()->fecha_ingreso,\n \"fecha_baja\" => Auth::user()->fecha_baja,\n \"fecha_reingreso\" => Auth::user()->fecha_reingreso,\n \"tipo_baja\" => Auth::user()->tipo_baja,\n \"motivo\" => Auth::user()->motivo,\n \"remember_token\" => Auth::user()->remenber_token,\n \"created_at\" => Auth::user()->created_at,\n \"updated_at\" => Auth::user()->update_at,\n \"deleted_at\" => Auth::user()->delete_at,\n\n //form\n \"is_admin\" => PortalPersonal::isAdministrator(Auth::user()->id),\n \"is_boss\" => PortalPersonal::isBoss(Auth::user()->id),\n \"short_name\" => explode(\" \",Auth::user()->name)[0],\n \"full_name\" => Auth::user()->name.\" \".Auth::user()->apellido_paterno.\" \".Auth::user()->apellido_materno,\n \"area_actual\" => Auth::user()->getAreaAssociated()->first()->name,\n \"antiguedad\" => date_diff(date_create(Auth::user()->fecha_ingreso), date_create(date('Y-m-d')))->format('%y Años %m Meses %d días'),\n \"anios_trabajando\" => intval(date_diff(date_create(Auth::user()->fecha_ingreso), date_create(date('Y-m-d')))->format('%y'))+1,\n \"picture_name\" => explode(\".\",Auth::user()->photo)[0],\n \"picture_ext\" => explode(\".\",Auth::user()->photo)[1],\n\n \"area_name\" => Auth::user()->getAreaAssociated()->first()->name,\n \"direction_name\" => Auth::user()->getAreaAssociated()->first()->getDirectionAssociated()->first()->name,\n \"track_name\" => Auth::user()->getPositionTrackAssociated()->first()->getTrackAssociated()->first()->name,\n \"position_name\" => Auth::user()->getPositionTrackAssociated()->first()->getPosicionAssociated()->first()->name,\n \"company_name\" => Auth::user()->getCompanyAssociated()->first()->name,\n \"boss_name\" => Auth::user()->getBoss()->first()->getBossAssociated()->first()->name,\n\n \"total_days_available\" => PortalPersonal::getTotalDays(Auth::user()->id) - PortalPersonal::getDaysInRequests(Auth::user()->id),\n \n //Evaluation\n \"capturista_gastos_viaje\" => PortalPersonal::isCapturistaDeGastosDeViaje(Auth::user()->id),\n \"capturista_harvest\" => PortalPersonal::isCapturistaDeHarvest(Auth::user()->id),\n \"capturista_cv\" => PortalPersonal::isCapturistaDeCV(Auth::user()->id),\n );\n\n foreach($fields as $fie => $f){\n $variables.=(\"user.\".$fie.\"='\".$f.\"';\");\n }\n\n return $variables;\n }", "public function DatosUsuarios() {\n $users = Usuarios::join('Perfiles', 'Usuarios.IdPerfil', '=', 'Perfiles.ID')->get();\n $datos = array();\n foreach ($users->toArray() as $user) {\n $groupDes = Grupos::where('ID', '=', $user['IdGrupo']) ->select('Descripcion')->first();\n $user['Grupo'] = $groupDes->Descripcion;\n if (Session::get('idPeril') == 3) {\n $user['Perfil'] = \"{$user['Perfil']}<a href='#' title='Editar Perfil' class='editar' alt='{$user['IdUsuario']}'>\"\n . \"<span style='color:#FACC2E; padding-left:15px' class='glyphicon glyphicon-edit'></span>\"\n . \"</a>\";\n }\n $datos[] = $user;\n }\n\n return $datos = json_encode($datos);\n }", "public function consultarUsuario(){\n //$conexao = $c->conexao();\n\n $sql = \"SELECT c.*, a.permissao FROM tbusuarios c, tbpermissao a where c.idpermissao = a.idpermissao and permissao <> 'SUPER-ADMIN'order by c.nome\";\n $sql = $this->conexao->query($sql);\n\n $dados = array();\n\n while ($row = $sql->fetch_assoc()) {\n $idusuario = $row[\"idusuario\"];\n $nome = $row[\"nome\"];\n $email = $row[\"email\"];\n $dtnascimento = $row[\"dt_nascimento\"];\n $telefone = $row[\"telefone\"];\n $dtnascimento = $row[\"dt_nascimento\"];\n $habilitado = $row[\"habilitado\"];\n $permissao = $row[\"permissao\"]; \n $idpermissao = $row[\"idpermissao\"]; \n\n $dado = array();\n $dado['idusuario'] = $idusuario;\n $dado['nome'] = $nome;\n $dado['email'] = $email;\n $dado['senha'] = $row['senha'];\n $dado['senha_confirma'] = $row['senha_confirma'];\n $dado['idpermissao'] = $idpermissao;\n $dado['permissao'] = $permissao;\n $dado['telefone'] = $telefone;\n $dado['dtnascimento'] = $dtnascimento;\n $dado['habilitado'] = $habilitado; \n $dados[] = $dado;\n }\n\n return $dados;\n\n }", "function adicionaUsuario() {\n $usuarioAtual = array(\n \"usuario\"=>$this->usuario,\n \"senha\"=>$this->senha,\n \"nome\"=>$this->nome,\n \"email\"=>$this->email\n );\n\n $usuarioAtual_str = json_encode($usuarioAtual);\n\n //retira o colchete e coloca a vírgula no arquivo\n $arquivo_str = file_get_contents(\"data/usuarios.json\");\n $arquivo_str_novo = str_replace(\"]\", \",\", $arquivo_str);\n\n //abre o arquivo\n $usuarios = fopen(\"data/usuarios.json\", \"w\"); //sobreescreve\n fwrite($usuarios, $arquivo_str_novo . $usuarioAtual_str . \"]\");\n fclose($usuarios);\n }", "function compruebaLoginUsuario($bd){\n //Hago un filtrado previo por si hay valores indeseables en el array\n $arrayFiltrado=array();\n foreach ($_POST as $k => $v)\n $arrayFiltrado[$k] = filtrado($v);\n\n //Utilizo los objetos DAO para añadir el usuario a la BD\n $daoUsuario = new Usuarios($bd);\n $usuario = new Usuario();\n $usuario->setPassword($arrayFiltrado[\"password\"]);\n $usuario->setUsuario($arrayFiltrado[\"usuario\"]);\n $resultado = $daoUsuario->compruebaCredenciales($usuario);\n //Compruebo si tengo usuario\n if($resultado!=false) {\n $usuario->setPassword(null);\n $usuario->setId($resultado[\"id\"]);\n $usuario->setImagen($resultado[\"imagen\"]);\n return $usuario;\n }\n else\n return false;\n}", "function consultarUserEmpleado(){\n\t\t\n\t\t$usu=$this->objEmpleado->getUsuario();\n\t\t//SELECT ESTADO FROM `cliente` WHERE `usuario`=\"lili\"\n\t\t$objConexion = new ControlConexion();\n\t\t$objConexion->abrirBd($GLOBALS['serv'],$GLOBALS['usua'],$GLOBALS['pass'],$GLOBALS['bdat']);\n\t\t//$comandoSql=\"SELECT cedula, nombre_tmp, tipoCliente, fechaRegistro, imagen_tmp, email_tmp, telefono_tmp, cupoCredito, contrasena FROM CLIENTE WHERE USUARIO='\".$usu.\"' \";\n\t\t$comandoSql=\"SELECT * FROM EMPLEADO WHERE USUARIO='\".$usu.\"' \";\n\t\t\n\t\t$recordSet=$objConexion->ejecutarSelect($comandoSql);\n\n\t\t \n\t\t\n\t\twhile($registro = $recordSet->fetch_array(MYSQLI_ASSOC)){\n\t\t\n\t\t\t$this->objEmpleado->setNombre($registro[\"nombre\"]);\n\t\t\t$this->objEmpleado->setCedula($registro[\"cedula\"]);\n\t\t\t$this->objEmpleado->setFechaIngreso($registro[\"fechaIngreso\"]);\n\t\t\t$this->objEmpleado->setFechaRetiro($registro[\"fechaRetiro\"]);\n\t\t\t$this->objEmpleado->setSalarioBasico($registro[\"salarioBasico\"]);\n\t\t\t$this->objEmpleado->setDeducciones($registro[\"deducciones\"]);\n\t\t\t$this->objEmpleado->setFoto($registro[\"foto\"]);\n\t\t\t$this->objEmpleado->setHojaVida($registro[\"hojaVida\"]);\n\t\t\t$this->objEmpleado->setEmail($registro[\"email\"]);\n\t\t\t$this->objEmpleado->setTelefono($registro[\"telefono\"]);\n\t\t\t$this->objEmpleado->setCelular($registro[\"celular\"]);\n\t\t\t$this->objEmpleado->setEstado($registro[\"estado\"]);\n\t\t\t$this->objEmpleado->setContrasena($registro[\"contrasena\"]);\n\t\t\t$this->objEmpleado->setNombreTmp($registro[\"nombre_tmp\"]);\n\t\t\t$this->objEmpleado->setFotoTmp($registro[\"foto_tmp\"]);\n\t\t\t$this->objEmpleado->setHojaVidaTmp($registro[\"hojaVida_tmp\"]);\n\t\t\t$this->objEmpleado->setEmailTmp($registro[\"email_tmp\"]);\n\t\t\t$this->objEmpleado->setTelefonoTmp($registro[\"telefono_tmp\"]);\n\t\t\t$this->objEmpleado->setCelularTmp($registro[\"celular_tmp\"]);\n\n\t\t\t\n\t\t\t}\t\n\t\t\t\n\t\t\t$objConexion->cerrarBd(); \n\t\t\treturn $this->objEmpleado; \t\t\n\t}", "public function editar_usuario($id_usuario, $nombre, $apellido, $cedula, $telefono, $email, $direccion, $cargo, $usuario, $password1, $password2, $estado, $permisos)\n {\n\n $conectar = parent::conexion();\n parent::set_names();\n require_once(\"Usuarios.php\");\n $usuarios = new Usuarios();\n //verifica si el id_usuario tiene registro asociado a compras\n $usuario_compras = $usuarios->get_usuario_por_id_compras($_POST[\"id_usuario\"]);\n //verifica si el id_usuario tiene registro asociado a ventas\n $usuario_ventas = $usuarios->get_usuario_por_id_ventas($_POST[\"id_usuario\"]);\n //si el id_usuario NO tiene registros asociados en las tablas compras y ventas entonces se puede editar todos los campos de la tabla usuarios\n if (is_array($usuario_compras) == true and count($usuario_compras) == 0 and is_array($usuario_ventas) == true and count($usuario_ventas) == 0) {\n $sql = \"update usuarios set \n nombres=?,\n apellidos=?,\n cedula=?,\n telefono=?,\n correo=?,\n direccion=?,\n cargo=?,\n usuario=?,\n password=?,\n password2=?,\n estado=?\n where \n id_usuario=?\n \";\n $sql = $conectar->prepare($sql);\n $sql->bindValue(1, $_POST[\"nombre\"]);\n $sql->bindValue(2, $_POST[\"apellido\"]);\n $sql->bindValue(3, $_POST[\"cedula\"]);\n $sql->bindValue(4, $_POST[\"telefono\"]);\n $sql->bindValue(5, $_POST[\"email\"]);\n $sql->bindValue(6, $_POST[\"direccion\"]);\n $sql->bindValue(7, $_POST[\"cargo\"]);\n $sql->bindValue(8, $_POST[\"usuario\"]);\n $sql->bindValue(9, $_POST[\"password1\"]);\n $sql->bindValue(10, $_POST[\"password2\"]);\n $sql->bindValue(11, $_POST[\"estado\"]);\n $sql->bindValue(12, $_POST[\"id_usuario\"]);\n $sql->execute();\n //SE ELIMINAN LOS PERMISOS SOLO CUANDO SE ENVIE EL FORMULARIO CON SUBMIT\n //Eliminamos todos los permisos asignados para volverlos a registrar\n $sql_delete = \"delete from usuario_permiso where id_usuario=?\";\n $sql_delete = $conectar->prepare($sql_delete);\n $sql_delete->bindValue(1, $_POST[\"id_usuario\"]);\n $sql_delete->execute();\n //$resultado=$sql_delete->fetchAll();\n //insertamos los permisos\n //almacena todos los checkbox que han sido marcados\n //este es un array tiene un name=permiso[]\n $permisos = $_POST[\"permiso\"];\n // print_r($_POST);\n $num_elementos = 0;\n while ($num_elementos < count($permisos)) {\n $sql_detalle = \"insert into usuario_permiso\n values(null,?,?)\";\n $sql_detalle = $conectar->prepare($sql_detalle);\n $sql_detalle->bindValue(1, $_POST[\"id_usuario\"]);\n $sql_detalle->bindValue(2, $permisos[$num_elementos]);\n $sql_detalle->execute();\n //recorremos los permisos con este contador\n $num_elementos = $num_elementos + 1;\n }\n } else {\n //si el usuario tiene registros asociados en compras y ventas entonces no se edita el nombre, apellido y cedula\n $sql = \"update usuarios set \n telefono=?,\n correo=?,\n direccion=?,\n cargo=?,\n usuario=?,\n password=?,\n password2=?,\n estado=?\n where \n id_usuario=?\n \";\n //echo $sql; exit();\n $sql = $conectar->prepare($sql);\n $sql->bindValue(1, $_POST[\"telefono\"]);\n $sql->bindValue(2, $_POST[\"email\"]);\n $sql->bindValue(3, $_POST[\"direccion\"]);\n $sql->bindValue(4, $_POST[\"cargo\"]);\n $sql->bindValue(5, $_POST[\"usuario\"]);\n $sql->bindValue(6, $_POST[\"password1\"]);\n $sql->bindValue(7, $_POST[\"password2\"]);\n $sql->bindValue(8, $_POST[\"estado\"]);\n $sql->bindValue(9, $_POST[\"id_usuario\"]);\n $sql->execute();\n //SE ELIMINAN LOS PERMISOS SOLO CUANDO SE ENVIE EL FORMULARIO CON SUBMIT\n //Eliminamos todos los permisos asignados para volverlos a registrar\n $sql_delete = \"delete from usuario_permiso where id_usuario=?\";\n $sql_delete = $conectar->prepare($sql_delete);\n $sql_delete->bindValue(1, $_POST[\"id_usuario\"]);\n $sql_delete->execute();\n //$resultado=$sql_delete->fetchAll();\n //insertamos los permisos\n //almacena todos los checkbox que han sido marcados\n //este es un array tiene un name=permiso[]\n if (isset($_POST[\"permiso\"])) {\n $permisos = $_POST[\"permiso\"];\n }\n //print_r($_POST);\n $num_elementos = 0;\n\n while ($num_elementos < count($permisos)) {\n\n $sql_detalle = \"insert into usuario_permiso\n values(null,?,?)\";\n\n $sql_detalle = $conectar->prepare($sql_detalle);\n $sql_detalle->bindValue(1, $_POST[\"id_usuario\"]);\n $sql_detalle->bindValue(2, $permisos[$num_elementos]);\n $sql_detalle->execute();\n\n\n //recorremos los permisos con este contador\n $num_elementos = $num_elementos + 1;\n } //fin while\n\n\n } // fin else\n\n\n }", "public function listarUser() {\n if(IDUSER) {\n $eval = \"SELECT id,nombre,apellidos,email FROM users\";\n $peticion = $this->db->prepare($eval);\n $peticion->execute();\n $resultado = $peticion->fetchAll(PDO::FETCH_OBJ);\n exit(json_encode($resultado));\n } else {\n http_response_code(401);\n exit(json_encode([\"error\" => \"Fallo de autorizacion\"])); \n }\n }", "function actualizarUsuarios($id,$nombre,$apellido,$user,$pass,$rol){\n\t\t$activo = true;\n\t\t$query = \"UPDATE usuarios set nombre = '$nombre', apellido = '$apellido', user = '$user', pass='$pass', rol='$rol' where idUsuario=$id AND activo = $activo\";\n\t\t$link = conectar(); //llama a la funcion conectar de conex.php\n\t\t$result = $link->query($query); //envia el query a la BD\t\t\n\t\t$link->close();\n\t\techo json_encode($result);\n\t}", "function ListaUsuarios() {\n\t//obtiene el id del usuario\n $sql = \"SELECT usuario.id, usuario.nombre_usuario, persona.primer_nombre, persona.primer_apellido, usuario.estado, rol.descripcion FROM usuario INNER JOIN persona ON usuario.persona_id = persona.id INNER JOIN rol ON usuario.rol_id = rol.id WHERE usuario.estado = 'ACTIVO'\";\n\n\t$db = new conexion();\n\t$result = $db->consulta($sql);\n\t$num = $db->encontradas($result);\n\n\t$respuesta->datos = [];\n\t$respuesta->mensaje = \"\";\n\t$respuesta->codigo = \"\";\n\n\tif ($num != 0) {\n\t\tfor ($i=0; $i < $num; $i++) {\n\t\t\t$respuesta->datos[] = mysql_fetch_array($result);\n\t\t}\n\t\t$respuesta->mensaje = \"Usuarios listados\";\n\t\t$respuesta->codigo = 1;\n\t} else {\n\t\t$respuesta->mensaje = \"No existen registros de usuarios !\";\n\t\t$respuesta->codigo = 0;\n\t}\n\treturn json_encode($respuesta);\n}", "public function action_recebeUsuario(){\n\t\t\n\t\tif(isset($_POST) && count($_POST) > 0){\n\t\t\t$usuario = Model_Usuario::forge();\n $usuario->idUsuario = $_POST['idUsuario'];\n\t\t\t$usuario->login = $_POST['login'];\n\t\t\t$usuario->senha = $_POST['senha'];\n\t\t\t$usuario->nome = $_POST['nome'];\n\t\t\t$usuario->email = $_POST['email'];\n\t\t\t\n\t\t\t$app_db = Model_Usuario::find('all');\n\t\t\t\n \n\t}\n }", "public function datosUsuario($direccion, $telefono, $descripcion, $estados_id, $facebook = NULL, $twitter = NULL, $website = NULL, $certificado = 0, $id_sede= 0) {\n\t\t$this->nuevoUsuario ();\n\t\t$this->u_direccion = $direccion;\n\t\t$this->u_telefono = $telefono;\n\t\t$this->u_descripcion = $descripcion;\n\t\t$this->u_estados_id = $estados_id;\n\t\t$this->u_facebook = $facebook;\n\t\t$this->u_twitter = $twitter;\n\t\t$this->u_website = $website;\n\t\t$this->u_certificado = $certificado;\n\t\t$this->u_id_sede = $id_sede; \n\t}", "public function dadosUsuarios()\n\t\t{\n\t\t\t$select = \"\n\t\t\t\tSELECT id, login, pri_nome, ult_nome, email, permissao\n\t\t\t\tFROM usuario\";\n\t\t\t$result = $this->mysqli->query($select);\n\t\t\tself::checaBuscaVazia($result); // Confere se o select retornou algo\n\n\t\t\twhile($row = $result->fetch_assoc()){\t\t\t\t\t\n\t\t\t\tself::defineNomePermissao($row['permissao']);\n\t\t\t\t// Gera conteudo da tabela\n\t\t\t\t$this->usuarios .= \"\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td id='alinhamento'>\".$row['login'].\"</td>\n\t\t\t\t\t<td id='alinhamento'>\".$row['pri_nome'].\"</td>\n\t\t\t\t\t<td id='alinhamento'>\".$row['ult_nome'].\"</td>\n\t\t\t\t\t<td id='alinhamento'>\".$row['email'].\"</td>\n\t\t\t\t\t<td id='alinhamento'>\".$this->nomPermissao.\"</td>\n\t\t\t\t\t<form method='POST' action='interacao_bd/update_permissao.php'?>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<div class='form-group'>\t\t\t\n\t\t\t\t\t\t\t\t<select class='form-control' onchange='submitForm(this.form);' name='alt_perm'>\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<option value=''>Permissão</option>\n\t\t\t\t\t\t\t\t\t<option value='1'>Total</option>\n\t\t\t\t\t\t\t\t\t<option value='2'>Média</option>\n\t\t\t\t\t\t\t\t\t<option value='3'>Mínima</option>\n\t\t\t\t\t\t\t\t\t<option value='4'>Nenhuma</option>\n\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t</div>\t\t\t\t\t\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<input name='id' type=hidden value='\".$row['id'].\"' />\n\t\t\t\t\t</form>\n\t\t\t\t\t<td align='center'><a onclick='deletaUsuario(\".$row['id'].\");' style='cursor: pointer;' class='fas fa-user-times fa-3x'></a></td>\n\t\t\t\t</tr>\";\t\t\t\t\t\t \n\t\t\t}\n\t\t\techo $this->usuarios;\n\t\t}", "private function consultar_usuario_por_nombre() {\n $sentencia = \"select id,nombrecompleto ,correo,token \"\n . \"from usuario u where u.nombrecompleto ilike '%{$this->referencia_a_buscar}%'; \";\n $this->respuesta = $this->obj_master_select->consultar_base($sentencia);\n }", "function getList() {\n $this->db->getCursorParameters(self::TABLA);\n $respuesta = array();\n while ($fila = $this->db->getRow()) {\n $objeto = new Usuario();\n $objeto->set($fila);\n $respuesta[] = $objeto;\n }\n return $respuesta;\n }", "private function ifoCadUser()\n {\n $infoCadUser = new AdmsRead();\n $infoCadUser->fullRead(\"SELECT env_email_conf, adms_niveis_acesso_id, adms_sits_usuario_id FROM adms_cads_usuarios WHERE id =:id LIMIT :limit\", \"id=1&limit=1\");\n $this->IfoCadUser = $infoCadUser->getResultado();\n\n }", "public function getData($id){\n $user = User::findOne($id);\n $this->user_id = $user->id;\n $this->username = $user->username;\n $this->email = $user->email;\n $this->reg_time = $user->created_at;\n $this->update_time = $user->updated_at;\n $this->last_login = $user->last_login;\n }", "public static function recuperartodo(){\r\n\t\t\r\n\t\t\t$consulta = \"SELECT * FROM usuaris;\";\r\n\t\t\t$datos = Database::get()->query($consulta);//ejecutar la consulta\r\n\t\t\t$usuaris = array();\r\n\t\t\r\n\t\t\twhile($usuari = $datos->fetch_object('UsuarioModel'))\r\n\t\t\t\t$usuaris[] = $usuari;\r\n\t\t\t\t$datos->free();\t\t\t//liberar memoria\r\n\t\t\t\treturn $usuaris;\r\n\t\t}", "public function buscarUsuarios(){\n $usuarios = file_get_contents('usuarios.json');\n $arrUsuariosJSON = explode(PHP_EOL,$usuarios);\n $arrUsuarioPHP = [];\n array_pop($arrUsuariosJSON);\n foreach ($arrUsuariosJSON as $key => $usuario) {\n $arrUsuarioPHP[] = json_decode($usuario,true);\n }\n return $arrUsuarioPHP;\n }", "static public function cargarUsuario($legajo, $email, $nombre, $clave, $fotoUno, $fotoDos)\n {\n $lista = self::LeerJSON(PATH_ARCHIVOS . \"/usuarios.json\", \"Usuario\");\n $Usuario = self::BuscaXCriterio($lista, \"legajo\", $legajo);\n\n if ($Usuario != null) {\n echo \"<br>El Usuario ya existe<br>\";\n } else {\n $nomFotoUno = \"fotoUno_\" . $legajo;\n self::cargarImagenPorNombre($fotoUno, $nomFotoUno, PATH_IMAGENES);\n $nomFotoDos = \"fotoDos_\" . $legajo;\n self::cargarImagenPorNombre($fotoDos, $nomFotoDos, PATH_IMAGENES);\n\n $Usuario = new Usuario($legajo, $email, $nombre, $clave, $nomFotoUno, $nomFotoDos);\n array_push($lista, $Usuario);\n self::guardarJSON($lista, PATH_ARCHIVOS . \"/usuarios.json\", \"Usuario\");\n }\n }", "public static function modeloUserGetAll ():array {\n // Genero lo datos para la vista que no muestra la contraseña ni los códigos de estado o plan\n // sino su traducción a texto\n $stmt=self::$db->query(\"select * from Usuarios\");\n $usuarios=[];\n $stmt->setFetchMode(PDO::FETCH_ASSOC);\n while ($cod=$stmt->fetch()) {\n $datosuser= [\n $cod[\"nombre\"],\n $cod[\"email\"],\n PLANES[$cod[\"plan\"]],\n ESTADOS[$cod[\"estados\"]]\n ];\n $usuarios[$cod[\"user\"]]=$datosuser;\n }\n return $usuarios;\n}", "public function recibirdatos() {\n\t\t$passSha1 = sha1($this->input->post('password'));\n\t\t$datos = array(\n\t\t\t'usuario' => $this->input->post('usuario'),\n\t\t\t'password' => $passSha1\n\t\t\t);\n\t\t//Llamamos al modelo, Si la autentificacion es correcta damos paso a la aplicacion y sino devolvemos al login\n\t\tif($this->login_model->obtenerPass($datos) == true){\n\t\t\t//Cargamos la pagina principal\n\t\t\t$this->session->set_userdata('usuario', $datos['usuario']);\n\t\t\t//Llamamos a la clase que realiza los test de caja blanca\n\t\t\t$this->testCajaBlanca($datos);\n\t\t\t$this->mostrarDatosUser();\n\t\t\t$this->session->set_userdata('Token', true);\n\t\t}else{\n\t\t\t$this->load->view('login');\n\t\t}\n\t}", "public function actualizar_Datos_Usuario2(){\n\t\t$sql = \"UPDATE usuarios SET Documento=\".$this->usuario->get_Nid().\",\n\t\t\t\t\t\t\t\t\tNombres='\".$this->usuario->get_Nombres().\"',\n\t\t\t\t\t\t\t\t\tApellidos = '\".$this->usuario->get_Apellidos().\"',\n\t\t\t\t\t\t\t\t\tUsuario = '\".$this->usuario->get_Usuario().\"',\n\t\t\t\t\t\t\t\t\tPregunta = '\".$this->usuario->get_Pregunta().\"',\n\t\t\t\t\t\t\t\t\tRespuesta = '\".$this->usuario->get_Respuesta().\"',\n\t\t\t\t\t\t\t\t\tTipo_Documento = '\".$this->usuario->get_TipoId().\"',\n\t\t\t\t\t\t\t\t\tCiudad = '\".$this->usuario->get_Ciudad().\"',\n\t\t\t\t\t\t\t\t\tDireccion = '\".$this->usuario->get_Direccion().\"',\n\t\t\t\t\t\t\t\t\tEdad = '\".$this->usuario->get_Edad().\"',\n\t\t\t\t\t\t\t\t\tFoto = '\".$this->usuario->get_Foto().\"',\n\t\t\t\t\t\t\t\t\tTelefono = '\".$this->usuario->get_Celular().\"',\n\t\t\t\t\t\t\t\t\tCorreo_Electronico = '\".$this->usuario->get_Email().\"',\n\t\t\t\t\t\t\t\t\tGenero = '\".$this->usuario->get_Genero().\"',\n\t\t\t\t\t\t\t\t\tperfiles_Nombre = '\".$this->usuario->get_Perfil().\"'\n\t\t\t WHERE Documento=\".$this->usuario->get_Nid().\"\";\n\n\n\n\t\t//echo $sql;\n\t\t$salida = 0;\n\t\t$valida = new Validacion_Datos(); // <- Para validar los tipos de datos\n\t\t// Validacion de los minimos\n\t\tif(!(strlen($this->usuario->get_Nid()) > 7))\t\t\t$salida = 2;\n\t\telseif(!(strlen($this->usuario->get_Nombres()) > 1))\t$salida = 3;\n\t\telseif(!(strlen($this->usuario->get_Apellidos()) > 1))\t$salida = 4;\n\t\telseif(!(strlen($this->usuario->get_Usuario()) > 4))\t$salida = 5;\n\t\telseif(!(strlen($this->usuario->get_Pregunta()) > 9))\t$salida = 7;\n\t\telseif(!(strlen($this->usuario->get_Respuesta()) > 1))\t$salida = 8;\n\t\telseif(!(strlen($this->usuario->get_Ciudad()) > 1))\t\t$salida = 10;\n\t\telseif(!(strlen($this->usuario->get_Direccion()) > 2))\t$salida = 11;\n\t\telseif(!(strlen($this->usuario->get_Edad()) > 0))\t\t$salida = 12;\n\t\telseif(!(strlen($this->usuario->get_Foto()) > 2))\t\t$salida = 13;\n\t\telseif(!(strlen($this->usuario->get_Celular()) > 7))\t$salida = 14;\n\t\telseif(!(strlen($this->usuario->get_Email()) > 6))\t\t$salida = 15;\n\t\t// Validacion de los tipos de datos (Numérico,Alfabético,Alfanumérico)\n\t\telseif(!($valida->is_Number($this->usuario->get_Nid())))\t\t\t\t$salida = 18;\n\t\telseif(!($valida->is_Alphanumeric($this->usuario->get_Usuario())))\t\t$salida = 19;\n\t\telseif(!($valida->is_Alphabetic($this->usuario->get_Nombres())))\t\t$salida = 20;\n\t\telseif(!($valida->is_Alphabetic($this->usuario->get_Apellidos())))\t\t$salida = 21;\n\t\telseif(!($valida->is_Alphanumeric($this->usuario->get_Respuesta())))\t$salida = 24;\n\t\telseif(!($valida->is_Alphabetic($this->usuario->get_Ciudad())))\t\t\t$salida = 25;\n\t\telseif(!($valida->is_Number($this->usuario->get_Edad())))\t\t\t\t$salida = 26;\n\t\telseif(!($valida->is_Number($this->usuario->get_Celular())))\t\t\t$salida = 28;\n\n\n\t\t///////////////////////////////////////////////////////////////////////////\n\n\t\t\n\t\telseif($this->bd->insertar($sql))\n\t\t\t$salida = true;\n\t\telse $salida = 31;\n\t\t\n\n\t\treturn $salida;\n\t}", "function recuperarUsuario()\n {\n $_codigo=$this->codigo ; \n $this->dataBaseAccess(); \n $mySelect = 'select Codigo_empresa,Nome,Senha where Codigo = ' . $this->Codigo ;\n $ret = mysqli_query($this->myCon , $mySelect) ;\n $numRows= mysqli_num_rows($ret); \n if($numRows>0)\n {\n $reg = mysqli_fetch_array($ret) ;\n $this->Codigo_empresa=$reg['Codigo_empresa'] ;\n $this->Nome=$reg['Nome'] ;\n $this->Senha=$reg['Senha'] ;\n mysqli_close( $this->myCon );\n $this->records_found=$numRows ;\n return true ; // ja cadastrado \n }else{\n mysqli_close( $this->myCon );\n return false ; \n }\n }", "public function User()\n\t{\n\t\t$datos = $this->Admin_Usuarios->getUsuario($this->input->get('id'));\n\t\tforeach($datos->result() as $res)\n\t\t{\n\t\t\t$data = array(\n\t\t\t\t'id'\t\t\t=> $res->idDatosprofesor,\n\t\t\t\t'nombre' \t\t=> $res->Nombres,\n\t\t\t\t'apellidop'\t\t=> $res->Primerapellido,\n\t\t\t\t'apellidom'\t\t=> $res->Segundoapellido,\n\t\t\t\t'curp' \t\t\t=> $res->Curp,\n\t\t\t\t'rfc' \t\t\t=> $res->RFC,\n\t\t\t\t'sexo' \t\t\t=> $res->Sexo,\n\t\t\t\t'nacimiento' \t=> $res->Fechanacimiento,\n\t\t\t\t'nacionalidad' \t=> $res->Nacionalidad,\n\t\t\t\t'enacimiento' \t=> $res->Estadodenacimiento,\n\t\t\t\t'ecivil' \t\t=> $res->Estadocivil,\n\t\t\t\t'correo' \t\t=> $res->Correo,\n\t\t\t\t'telefonot' \t=> $res->TelefonoTrabajo,\n\t\t\t\t'telefonoc' \t=> $res->TelefonoCasa,\n\t\t\t\t'img' \t\t\t=> $res->foto,\n\t\t\t\t'telefonop' \t=> $res->TelefonoPersonal\n\n\t\t\t);\n\t\t}\n\t\t$data['titulo'] = 'SAPTC | Detalles';\n\t\t$this->load->view('Admin/detallesUsuario', $data);\n\t}", "function actualizarUsuario($arrayData,$arrayPerfil=NULL){\n\t\t/*\n\t\tActualiza los datos del usuario y además ejecuta actualizarPerfilesUsuario()\n\t\tpara actualizar los datos de pertenencia a perfiles, de acuerdo a los checkbox\n\t\tmarcados en el formulario\n\t\t*/\n\t\t$existeUsu=$this->checkUsernameExistsUpdate($arrayData['user_name'],$arrayData['id_usuario']);\n\t\t//$existePass=$this->checkPasswordExistsUpdate($arrayData['user_pass'],$arrayData['id_usuario']);\n\t\t\n\t\tif($existeUsu){\n\t\t\t$this->aErrors[]='El nombre de usuario ya fue utilizado';\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif(!is_null($arrayPerfil)){\n\t\t\t$this->actualizarPerfilesUsuario($arrayPerfil,$arrayData['id_usuario']);\n\t\t}\n\t\t\n\t\n\t\treturn $this->update($arrayData);\n\n\t}", "public function toUser($data){\n\t\t\t$this->email=$data['email'];\n\t\t\t$this->password=$data['password'];\n\t\t\t$this->nombre=$data['nombre'];\n\t\t\t$this->apellido=$data['apellido'];\n\t\t}", "function cadastrarUser(){\n //$this->session->set_tempdata('erro-acesso', 'login e senha n&atilde;o correspondem!', 5);\n\t \n\t\t/*$verificarUser = $this->login->get_verificar_user('sytesraul', '513482am');\n\t\tif($verificarUser != null) :\n\t\t\techo \"USUARIO JA CADASTRADO \".$verificarUser->name_login;\n\t\tendif;*/\n\t //redirect('login/acessoAceito', 'refresh');\n\t \n\t\t$dados['titulo'] = 'Cadastrar Usuário';\n\t\t$dados['h2'] = 'Tela de Cadastro';\n\t\t$this->load->view('login/cadastrar_user_view', $dados);\n\t\t\n\t\t\n\t}", "function user() {\n $user = $this->ion_auth->user()->row();\n //\n //get id\n $data['profic'] = $this->model_portofolio->select_profic_user($user->id)->row();\n $data['user'] = $user;\n if ($this->model_portofolio->select_metadata($user->id, 1)->row() == NULL) {\n $this->model_portofolio->insert_usermeta($user->id, 1);\n $data['profil'] = $this->model_portofolio->select_metadata($user->id, 1)->row();\n } else {\n $data['profil'] = $this->model_portofolio->select_metadata($user->id, 1)->row();\n }\n if ($this->model_portofolio->select_metadata($user->id, 2)->row() == NULL) {\n $this->model_portofolio->insert_usermeta($user->id, 2);\n $data['pengajaran'] = $this->model_portofolio->select_metadata($user->id, 2)->row();\n } else {\n $data['pengajaran'] = $this->model_portofolio->select_metadata($user->id, 2)->row();\n }\n if ($this->model_portofolio->select_metadata($user->id, 3)->row() == NULL) {\n $this->model_portofolio->insert_usermeta($user->id, 3);\n $data['riset'] = $this->model_portofolio->select_metadata($user->id, 3)->row();\n } else {\n $data['riset'] = $this->model_portofolio->select_metadata($user->id, 3)->row();\n }\n if ($this->model_portofolio->select_metadata($user->id, 4)->row() == NULL) {\n $this->model_portofolio->insert_usermeta($user->id, 4);\n $data['publikasi'] = $this->model_portofolio->select_metadata($user->id, 4)->row();\n } else {\n $data['publikasi'] = $this->model_portofolio->select_metadata($user->id, 4)->row();\n }\n if ($this->model_portofolio->select_metadata($user->id, 5)->row() == NULL) {\n $this->model_portofolio->insert_usermeta($user->id, 5);\n $data['pengalaman'] = $this->model_portofolio->select_metadata($user->id, 5)->row();\n } else {\n $data['pengalaman'] = $this->model_portofolio->select_metadata($user->id, 5)->row();\n }\n if ($this->model_portofolio->select_metadata($user->id, 6)->row() == NULL) {\n $this->model_portofolio->insert_usermeta($user->id, 6);\n $data['pendidikan'] = $this->model_portofolio->select_metadata($user->id, 6)->row();\n } else {\n $data['pendidikan'] = $this->model_portofolio->select_metadata($user->id, 6)->row();\n }\n\n //print_r($data['profic']);\n //print_r($data['user']);\n //print_r($data['publikasi']);\n //print_r($data);\n $this->load->view('portofolio/profil', $data);\n }", "function obtenerDatosUsuario($parametros) {\n $sql = \"SELECT nombre, apellidos, email, telefono, dni, administrador, pass FROM usuarios WHERE dni = :dni\";\n\n //Preparamos la consulta\n $consulta_usuario = $this->conexionBBDD->prepare($sql,array());\n\n //Ejecutamos la consulta\n $consulta_usuario->execute($parametros);\n\n //Devolvemos los resultados\n return $consulta_usuario->fetch(PDO::FETCH_NUM);\n }", "public function buscar_Usuario($user){\n\t\t$sql = \"select Documento, Nombres, Apellidos, Usuario, Password, Pregunta, Respuesta,\n\t\t\tTipo_Documento,Ciudad, Direccion, Edad,Foto,Telefono,Correo_Electronico,\n\t\t\tGenero,perfiles_Nombre \n\t\t\tfrom usuarios where Usuario='$user'\";\n\t\t$registros = $this->bd->consultar($sql);\n\t\tif($reg=mysql_fetch_array($registros)){\n\t\t\t$this->usuario->set_Nid($reg['Documento']);\n\t\t\t$this->usuario->set_Usuario($reg['Usuario']);\n\t\t\t$this->usuario->set_Password($reg['Password']);\n\t\t\t$this->usuario->set_Nombres($reg['Nombres']);\n\t\t\t$this->usuario->set_Apellidos($reg['Apellidos']);\n\t\t\t$this->usuario->set_TipoId($reg['Tipo_Documento']);\n\t\t\t$this->usuario->set_Ciudad($reg['Ciudad']);\n\t\t\t$this->usuario->set_Direccion($reg['Direccion']);\n\t\t\t$this->usuario->set_Email($reg['Correo_Electronico']);\n\t\t\t$this->usuario->set_Pregunta($reg['Pregunta']);\n\t\t\t$this->usuario->set_Respuesta($reg['Respuesta']);\n\t\t\t$this->usuario->set_Celular($reg['Telefono']);\n\t\t\t$this->usuario->set_Edad($reg['Edad']);\n\t\t\t$this->usuario->set_Foto($reg['Foto']);\n\t\t\t$this->usuario->set_Genero($reg['Genero']);\n\t\t\t$this->usuario->set_Perfil($reg['perfiles_Nombre']);\n\n\t\t}\n\t}", "function getUsuarios(){\n\t\n\t\treturn conectar()->query( \"SELECT * FROM usuarios\");\n\t}", "public function get_usuarios()\n\t{\n\t\ttry\n\t\t{\n\t\t\t$sql = \"SELECT * FROM usuarios\";\n\n\t\t\t$resultado = $this->db->prepare($sql);\n\n\t\t\tif(!$resultado->execute())\n\t\t\t{\n\t\t\t\techo \"<h1 class='text-danger bg-danger'>Falla en la consulta</h1>\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\twhile($reg = $resultado->fetch(PDO::FETCH_ASSOC))\n\t\t\t\t{\n\t\t\t\t\t$this->usuarios[] = $reg;\n\t\t\t\t}\n\n\t\t\t\treturn $this->usuarios;\n\t\t\t}\n\t\t}\n\t\tcatch(Exception $e)\n\t\t{\n\t\t\tdie(\"Error: {$e->getMessage()}\");\n\t\t}\n\t}", "function getUsuarios()\n{\n\t$con = getDBConnection();\n\t$sql = \"SELECT * FROM usuarios\";\n\t$stmt = $con->prepare($sql);\n\t$stmt->execute();\n\t$usuarios = null;\n\twhile ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {\n\t\t$usuario = new Usuario();\n\t\t$usuario->setID($row['id']);\n\t\t$usuario->set($row['nombre'],$row['apellidos'],$row['user_name'],$row['password'],$row['email']);\n\t\t$usuarios[] = $usuario;\n\t}\n\treturn $usuarios;\n}", "public function getUserAll()\n {\n\n $data = $this->request->data;//recibe la informaciòn que venga por post\n\n $id = $data['id'];\n\n $users = $this->Users->find('all');//trae los datos de la base de datos\n //nombre de la tabla en la base de datos\n\n if($users){\n\n $success = true;//si hay exito al traer los datos\n\n $this->set(compact('success', 'users'));//manda los datos a la vista para mostrar\n }else{\n\n $success = false;\n\n $errors = $users->errors();\n\n $this->set(compact('success', 'errors'));\n }\n }", "public function getUsuario($id,$cedula){\r\n\t$pdo = Database::connect();\r\n//Utilizamos parametros para la consulta:\r\n\t$sql = \"select * from cat_usuarios where ID_US=?\";\r\n\t$consulta = $pdo->prepare($sql);\r\n//Ejecutamos y pasamos los parametros para la consulta:\r\n\t$consulta->execute(array($id));\r\n//Extraemos el registro especifico:\r\n\t$dato = $consulta->fetch(PDO::FETCH_ASSOC);\r\n//Transformamos el registro obtenido a objeto:\r\n\t$usuario=new Usuarios();\r\n\t$usuario->setID_US($dato['ID_US']);\r\n\t$usuario->setCEDULA_US($dato['CEDULA_US']);\r\n\t$usuario->setNOMBRE_US($dato['NOMBRE_US']);\r\n\t$usuario->setAPELLIDO_US($dato['APELLIDO_US']);\r\n\t$usuario->setFECHANAC_US($dato['FECHANAC_US']);\r\n\t$usuario->setCIUDAD_US($dato['CIUDAD_US']);\r\n\t$usuario->setTELEFONO_US($dato['TELEFONO_US']);\r\n\t$usuario->setGENERO_US($dato['GENERO_US']);\r\n\t$usuario->setAPELLIDO_US($dato['APELLIDO_US']);\r\n\t$usuario->setDIRECCION_US($dato['DIRECCION_US']);\r\n\t$usuario->setFECHAREGISTRO_US($dato['FECHAREGISTRO_US']);\r\n\t$usuario->setEMAIL_US($dato['EMAIL_US']);\r\n\r\n\tDatabase::disconnect();\r\n\treturn $usuario;\r\n}", "public function mostrarUsuarios($pag) {\n $this->cantidadMostrar = 10;\n $this->pagina = $pag;\n $this->cantidadTotalRegistros = $this->con->query(\"SELECT * FROM usuarios\");\n $this->redondeoFinal = ceil($this->cantidadTotalRegistros->num_rows/$this->cantidadMostrar);\n \n $this->consultaMostrar = \"SELECT * FROM usuarios ORDER BY idUsuario DESC LIMIT \".(($this->pagina-1)*$this->cantidadMostrar).\",\".$this->cantidadMostrar;\n $this->consulta= $this->con->query($this->consultaMostrar);\n \n //$this->consulta=$this->con->query(\"SELECT * FROM usuarios ORDER BY apellido ASC, nombre ASC\");\n $this->i=1;\n while($this->datos= $this->consulta->fetch_array()) {\n ?>\n <tr>\n <td>\n <b><?php echo $this->i;?></b>\n <img src=\"fotos/<?php echo $this->datos['idUsuario'];?>\" width=\"50px\"> \n </td>\n <td><?php echo $this->datos['apellido'].\", \".$this->datos['nombre'];?></td>\n <td><?php echo $this->datos['usuario'];?></td>\n <td><?php echo $this->datos['dni'];?></td>\n <td><?php echo $this->datos['edad'];?></td>\n <td><?php echo $this->datos['domicilio'].\", \".$this->datos['localidad'].\", \".$this->datos['provincia'].\", \".$this->datos['nacionalidad'];?></td>\n <td><?php echo $this->datos['telefono'];?></td>\n <td><?php echo $this->datos['email'];?></td>\n <td><?php echo $this->datos['sexo'];?></td>\n <td><?php echo $this->datos['privilegio'];?></td>\n <td>\n <div class=\"row\">\n <a class=\"btn btn-success btn-sm\" href=\"formmodificar.php?idUsuario=<?php echo $this->datos['idUsuario'];?>\"><i class=\"material-icons\">create</i></a>\n <a class=\"btn btn-danger btn-sm\" onclick=\"return confirm('¿Desea eliminar este registro?')\" href=\"formeliminar.php?idUsuario=<?php echo $this->datos['idUsuario'];?>\"><i class=\"material-icons\">delete</i></a>\n </div>\n </td>\n </tr> \n <?php \n $this->i++; \n \n }\n ?>\n <tr>\n <td colspan=\"12\" class=\"text-center\">\n <nav>\n <ul class=\"pagination\">\n <li <?php if($this->pagina==1) {echo \"class='disabled'\";} ?> ><a href=\"index.php?pagina=1\"><i class=\"material-icons\">chevron_left</i></a></li>\n <?php \n for($this->j=1; $this->j<= $this->redondeoFinal; $this->j++) {\n ?>\n <li <?php if($this->pagina== $this->j){echo \"class='active'\";} ?>>\n <a class=\"waves-effect\" href=\"index.php?pagina=<?php echo $this->j; ?>\"><?php echo $this->j; ?></a>\n </li>\n <?php\n } \n ?>\n <li <?php if($this->pagina==($this->j-1)) {echo \"class='disabled'\";} ?> >\n <a href=\"index.php?<?php echo $this->j-1 ;?>\"><i class=\"material-icons\">chevron_right</i></a>\n </li> \n </ul>\n </nav>\n </td>\n </tr> \n <?php \n $this->con->close();\n }", "public function datosUsuario($user) {\n $sql = \"SELECT * FROM USUARIOS WHERE USUARIO=\\\"$user\\\"\";\n $resultado = $this->conexion_db->query($sql);\n $datos = $resultado->fetch_all(MYSQLI_ASSOC);\n return $datos;\n }", "private function crearUsuario(){\n \t\t#valida que la solicitud sea mediante un post \n\t if ($_SERVER['REQUEST_METHOD'] != \"POST\") {\n\t \t//envia un error \n\t $this->mostrarRespuesta($this->convertirJson($this->devolverError(1)), 405); \n\t }\n\t //valida que los datos a incorporar no sean vacios \n\t if (isset($this->datosPeticion['nombre'], $this->datosPeticion['email'], $this->datosPeticion['pwd'])){\n\t $nombre = $this->datosPeticion['nombre']; \n\t $pwd = $this->datosPeticion['pwd']; \n\t $email = $this->datosPeticion['email'];\n\n\t //valida la existemcia del usuario mediante el email \n\t if (!$this->existeUsuario($email)){ \n\t $query = $this->_conn->prepare(\n\t \t\"INSERT into usuario (nombre,email,password,fRegistro) \n\t \t VALUES (:nombre, :email, :pwd, NOW())\");\n\t //se le asignan los valores a las variables de la consulta \n\t $query->bindValue(\":nombre\", $nombre); \n\t $query->bindValue(\":email\", $email); \n\t $query->bindValue(\":pwd\", sha1($pwd)); \n\t $query->execute(); \n\t if ($query->rowCount() == 1){ // se inserto bien \n\t $id = $this->_conn->lastInsertId(); \n\t $respuesta['estado'] = 'correcto'; \n\t $respuesta['msg'] = 'usuario creado correctamente'; \n\t $respuesta['usuario']['id'] = $id; \n\t $respuesta['usuario']['nombre'] = $nombre; \n\t $respuesta['usuario']['email'] = $email; \n\t $this->mostrarRespuesta($this->convertirJson($respuesta), 200); \n\t } else //se envia un error de insercion en la bd\n\t $this->mostrarRespuesta($this->convertirJson($this->devolverError(7)), 400); \n\t } else //se envia un error del usuario no existe\n\t $this->mostrarRespuesta($this->convertirJson($this->devolverError(8)), 400); \n\t } else { \n\t $this->mostrarRespuesta($this->convertirJson($this->devolverError(7)), 400); \n\t } \n\t}", "function getUserInfo($id){\n\t\n\t$usr_info = mysql_fetch_object(listAll(\"user\", \"WHERE id = '$id'\"));\n\t$descripcion = getUserData($id, \"2\");\n\t$user_img = getUserData($id, \"1\");\n\t$direccion = getUserData($id, \"3\");\n\t$ciudad = getUserData($id, \"10\");\n\t$cp = getUserData($id, \"4\");\n\t$pais = getUserData($id, \"5\");\n\t$telefono = getUserData($id, \"6\");\n\t$movil =getUserData($id, \"7\");\n\t$exp = getUserData($id, \"14\");\n\t$cam = getUserData($id, \"11\");\n\t$lentes = getUserData($id, \"12\");\n\t$equip = getUserData($id, \"13\");\n\t$cover = getUserData($id, \"16\");\n\t$user_pago = getUserData($id, \"17\");\n $escuelaFotografia = getUserData($id, \"18\");\n $masEducacion = getUserData($id, \"19\");\n $experienciaLaboral = getRecentUserData($id, \"20\");\n $idiomas = getUserData($id, \"22\");\n $habilidades = getUserData($id, \"21\");\n $rut = getUserData($id, \"23\");\n\t\n\tif($usr_info->gender == \"H\"){\n\t\t$gender = \"Hombre\";\n\t}else{\n\t\t$gender = \"Mujer\";\n\t}\n\n\t$paisf = listAll(\"paises\",\"WHERE iso = '$pais->description'\");\n\t$rs_paisf = mysql_fetch_object($paisf);\n\t\n\t$user['id'] = $usr_info->id;\n\t$user['user_type'] = $usr_info->user_type;\n\t$user['email'] = $usr_info->user;\n $user['new_email'] = $usr_info->new_email;\n $user['new_email_code'] = $usr_info->new_email_code;\n\t$user['descripcion'] = $descripcion->description;\n\t$user['user_img']= $user_img->description;\n\t$user[\"name\"] = $usr_info->name;\n\t$user['lastname'] = $usr_info->lastname;\n\t$user['dob']= DateHelper::getLongDate($usr_info->dob);\n $user['user_dob'] = DateHelper::getShortDate($usr_info->dob, 'd/m/Y');\n\t$user['sex']= $gender;\n\t$user['act']= $usr_info->act;\n\t$dob = explode(\"-\",$usr_info->dob);\n\t$user['ano'] = $dob[0];\n\t$user['mes'] = $dob[1];\n\t$user['dia'] = $dob[2];\n\t$user['direccion'] = $direccion->description;\n\t$user['ciudad'] = $ciudad->description;\n\t$user['cp'] = $cp->description;\n\t$user['pais'] = utf8_encode($rs_paisf->nombre);\n\t$user['pais_ab'] = utf8_encode($rs_paisf->iso);\n\t$user['telefono'] = $telefono->description;\n\t$user['movil'] = $movil->description;\n\t$user['exp'] = $exp->description;\n $user['escuela-fotografia'] = $escuelaFotografia->description;\n $user['mas-educacion'] = $masEducacion->description;\n $user['experiencia-laboral'] = json_decode($experienciaLaboral->description);\n $user['idiomas'] = json_decode($idiomas->description);\n $user['habilidades'] = json_decode($habilidades->description);\n $user['rut'] = $rut->description;\n\t$user['cam'] = json_decode($cam->description);\n\t$user['lentes'] = json_decode($lentes->description);\n\t$user['equip'] = json_decode($equip->description);\n\t$user[\"act_code\"] = $usr_info->act_code;\n $user[\"profile_completed\"] = $usr_info->profile_completed;\n $user[\"wizard_completed\"] = $usr_info->wizard_completed;\n $user[\"wizard_contact_creative_completed\"] = $usr_info->wizard_contact_creative_completed;\n\t$user['user_cover'] = $cover->description;\n\t$user['user_pago'] = $user_pago->description;\n\t$user['full_name'] = ucwords($user[\"name\"] . \" \" . $user['lastname']);\n //TODO make it an external function\n //TODO set a default image if file does not exists\n if (file_exists(FConfig::getBasePath().\"/profiles/\".sha1($usr_info->id).\"/profile.jpg\")){\n $user['profile_image_url'] = \"profiles/\".sha1($usr_info->id).\"/profile.jpg\";\n } else {\n if ($user['user_type'] == User::USER_TYPE_PHOTOGRAPHER) {\n $user['profile_image_url'] = \"images/profile_default_photographer.jpg\";\n } else {\n $user['profile_image_url'] = \"images/profile_default_client.jpg\";\n }\n }\n\n if (file_exists(FConfig::getBasePath().\"/profiles/\".sha1($usr_info->id).\"/cover.jpg\")){\n $user['cover_image_url'] = \"profiles/\".sha1($usr_info->id).\"/cover.jpg\";\n } else {\n $user['cover_image_url'] = \"images/cover_default.jpg\";\n }\n\n return $user;\n}", "function obtenerUsuarios(){\n //Variable que almacena la consulta sql\n $sql = \"select login,Alias\n \t\t\tfrom ENTREGA\";\n\t\t//se ejecuta la query\n $resultado = $this->mysqli->query( $sql );\n if ( $resultado->num_rows == 0 ) { return null; }//miramos si el número de filas es 0.\n //Caragamos las tuplas resultado de la consulta en un array\n while($datos = mysqli_fetch_row ($resultado)){\n //Variable que almacena el array de las tuplas resultado de la query\n $miarray[] = $datos;\n }\n return $miarray;\n }", "function actualizarUsuario($parametros) {\n $sql = \"UPDATE usuarios SET nombre=:nombre, apellidos=:apellidos, email=:email, \n pass=:pass, telefono=:telefono, administrador=:administrador WHERE dni=:dni\";\n\n //Preparamos la consulta\n $actualizar_usuario = $this->conexionBBDD->prepare($sql,array());\n\n //Ejecutamos la consulta y actualizamos los datos del usuario\n $actualizar_usuario->execute($parametros);\n }", "function retornaUsuarios()\n{\n $PDO = db_connect();\n $sql = \"SELECT id,nome_completo,RA,semestre, usuario, img \n FROM sistema.users \n order by nome_completo ASC;\";\n $stmt = $PDO->prepare($sql);\n $stmt->execute();\n $users = $stmt->fetchAll(PDO::FETCH_ASSOC);\n $usersKeyName = array();\n foreach ($users as $user) {\n $usersKeyName[trim($user['nome_completo'])] = $user;\n }\n $dadosCodificados = json_encode($usersKeyName);\n $objData = json_decode($dadosCodificados);\n return $objData;\n}", "public function getUsuarios ():array {\n $tuser = [];\n $this->stmt_usuarios->setFetchMode(PDO::FETCH_CLASS, 'Usuario');\n \n if ( $this->stmt_usuarios->execute() ){\n while ( $user0 = $this->stmt_usuarios->fetch()){\n $tuser[]= $user0;\n }\n }\n return $tuser;\n }", "public function consultarUsuario($parametros)\n {\n //echo \"<h1>$correo -- $contrasena</h1>\";\n // header('Location: ../vistas/index.php');\n\n #LLAMO LA CONEXION PARA PODER CONSULTAR A LA BASE DE DATOS\n $modelo = new Conexion_PDO();\n $conexion = $modelo->get_Conexion_Mysql();\n #PREPARO LA SQL PARA VERIFICAR SI EL USUARIO EXISTE Y ESTA ACTIVO\n $sql = \"SELECT priape,segape,nom from datosiniciales\";\n $statement = $conexion->prepare($sql);\n $statement->execute();\n $resultados = $statement->fetch();\n // VERIFICA SI EL RESULTADO ES DIFERENTE DE VACIO QUIERE DECIR QUE EL CORREO SI EXISTE Y ESTA ACTIVO\n if ($resultados != '') {\n\n echo \"<br>- \"$resultados['priape'];\n echo \"<br>- \"$resultados['segape'];\n echo \"<br>- \"$resultados['nom'];\n return 1;\n\n // $_SESSION['identificacion'] = $dato['numeroid'];\n // $_SESSION['nombre'] = $dato['nombre1'];\n // $_SESSION['apellido'] = $dato['apellido1'];\n // header('location:acceso.php');\n\n } else {\n return 2;\n // echo \"Error, verifica tu usuario y contraseña\";\n // header('location:../index.php');\n }\n\n }", "function modificarUsuario($oldUser,$nombre,$apellidos,$usuario,$password,$poblacion,$cp,$horario, $data){\n\n //echo $oldUser . \"id usuario \";\n\n if(isset($nombre) && !empty($nombre))\n\n mysqli_query($this->mysqli,\" UPDATE usuario SET nombre= '\" . $nombre . \"' WHERE id_usuario = '\" .$oldUser .\"'\");\n\n if(isset($apellidos) && !empty($apellidos))\n\n mysqli_query($this->mysqli,\" UPDATE usuario SET apellidos= '\" . $apellidos . \"' WHERE id_usuario = '\" .$oldUser .\"'\");\n\n if(isset($usuario) && !empty($usuario)){\n\n mysqli_query($this->mysqli,\" UPDATE usuario SET usuario= '\" . $usuario . \"' WHERE id_usuario = '\" .$oldUser .\"'\");\n \n }\n\n if(isset($password) && !empty($password)){\n \n $consulta = \"UPDATE usuario SET password ='\" .$password .\"' WHERE id_usuario = '\" .$oldUser .\"'\";\n //echo $consulta .\" \";\n mysqli_query($this->mysqli,$consulta);\n //echo \"entro\".$password;\n }\n if(isset($poblacion) && !empty($poblacion))\n\n mysqli_query($this->mysqli,\" UPDATE usuario SET poblacion= '\" . $poblacion . \"' WHERE id_usuario = '\" .$oldUser .\"'\");\n\n if(isset($cp) && !empty($cp))\n\n mysqli_query($this->mysqli,\" UPDATE usuario SET cp= '\" . $cp . \"' WHERE id_usuario = '\" .$oldUser .\"'\");\n\n if(isset($horario) && !empty($horario))\n\n mysqli_query($this->mysqli,\" UPDATE usuario SET horario= '\" . $horario . \"' WHERE id_usuario = '\" .$oldUser .\"'\");\n\n if(isset($data)){\n\n mysqli_query($this->mysqli,\" UPDATE usuario SET foto= '\" . $data . \"' WHERE id_usuario = '\" .$oldUser .\"'\");\n //echo \"entro\";\n }\n\n printf(\"Filas afectadas por el Update: %d\\n\", $this->mysqli->affected_rows);\n }", "function actualizar(){\n\t\t$rut = $this->input->post('rut');\n\t\t\n\t\t$data = array(\n\t\t\t'nombre' => $this->input->post('nombre'),\n\t\t\t'apellido' => $this->input->post('apellido'),\n\t\t\t'contrasena' => $this->input->post('password'),\n\t\t\t'estado' => 1,\n\t\t\t'modificado' => $this->session->userdata['username'],\n\t\t\t'fechaModificado' => date('Y-m-d H:i:s', time())\n\t\t);\n\t\t\n\t\t# se agrega el cliente en la BD\n\t\t$this->usuarios_model->actualizar($rut,$data);\n\n\t\t#echo json_encode($data);\n\t\t\n\t\t# redirigimos a la siguiente pagina\n\t\tredirect('admin_listar_usuarios');\n\t}", "public function actualizar(){\r\n\t\t\t$user_table = Config::get()->db_user_table;\r\n\t\t\t$consulta = \"UPDATE $user_table\r\n\t\t\t\t\t\t\t SET password='$this->password', \r\n\t\t\t\t\t\t\t \t\tnombre='$this->nombre', \r\n\t\t\t\t\t\t\t \t\temail='$this->email', \r\n\t\t\t\t\t\t\t \t\timagen='$this->imagen',\r\n apellido1='$this->apellido1',\r\n apellido2='$this->apellido2', \r\n fecha_nacimiento='$this->fecha_nacimiento',\r\n direccion='$this->direccion',\r\n cp='$this->cp',\r\n poblacion='$this->poblacion',\r\n telf_movil='$this->telf_movil',\r\n telf_fijo='$this->telf_fijo',\r\n nivel_estudios='$this->nivel_estudios',\r\n nombre_titulacion='$this->nombre_titulacion',\r\n otros='$this->otros',\r\n observaciones='$this->observaciones',\r\n en_activo=$this->en_activo,\r\n razon_social='$this->razon_social',\r\n puesto_trabajo='$this->puesto_trabajo',\r\n regimen=$this->regimen,\r\n activo=$this->activo\r\n\t\t\t\t\t\t\t WHERE dni='$this->dni';\";\r\n\t\t\treturn Database::get()->query($consulta);\r\n\t\t}", "public function actualizarUsuarioModel($data){\n\t\t$stmt = Conexion::conectar()->prepare(\"UPDATE usuarios SET codigo = :codigo, nombre=:nombre, apellidos=:apellidos, email=:email, password=:password, tipo=:tipo WHERE id = :id\");\n\t\t$stmt->bindParam(\":codigo\", $data['codigo']);\n\t\t$stmt->bindParam(\":nombre\", $data['nombre']);\n\t\t$stmt->bindParam(\":apellidos\", $data['apellidos']);\n\t\t$stmt->bindParam(\":email\", $data['email']);\n\t\t$stmt->bindParam(\":password\", $data['password']);\n\t\t$stmt->bindParam(\":tipo\", $data['tipo']);\n\t\t$stmt->bindParam(\":id\", $data['id']);\n\t\tif($stmt->execute())\n\t\t\treturn \"success\";\n\t\telse\n\t\t\treturn \"error\";\n\t\t$stmt->close();\n\n\n\t}", "private function consultar_usuario_por_correo() {\n $sentencia = \"select id,nombrecompleto ,correo,token \"\n . \"from usuario u where u.correo ='{$this->referencia_a_buscar}'; \";\n $this->respuesta = $this->obj_master_select->consultar_base($sentencia);\n }", "public function recepcionUsuario($nombre , $password){\n\t\t\t$result_child = $this->_db->query(\"SELECT * FROM usuario WHERE login_usu = '\".$nombre.\"'\");\n\t\t\t$retorna_child = $result_child->fetch_all(MYSQL_ASSOC);\n\n\t\t\t//mensaje por defecto indicando que no se registro\n\t\t\t//genera mensaje para el sistema\n\t\t\t$outp = array('activo'=> \"0\");\n\n\t\t\t//verifica que exista el usuario\n\t\t\tif (!$result_child) {\n \t\t\treturn \"Falló SELECT usuario: (\" . $this->_db->errno . \") \" . $this->_db->error;\n\t\t\t}else{\n\n\t\t\t\tif (count($retorna_child) > 0) {\n\t\t\t\t\t//print_r(count($retorna_child));\n\t\t\t\t\t//busca su grupo de usuario para asignar un rol \n\t\t\t\t\t$result_master = $this->_db->query(\"SELECT * FROM grupousu WHERE idGrupoUsu = '\".$retorna_child[0]['GrupoUsu_idGrupoUsu'].\"'\");\n\t\t\t\t\t$retorna_master = $result_master->fetch_all(MYSQL_ASSOC);\n\n\t\t\t\t\t//verifique que tenga un grupo de usuario\n\t\t\t\t\tif (!$result_child) {\n\t \t\t\t\treturn \"Falló SELECT grupousu: (\" . $this->_db->errno . \") \" . $this->_db->error;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t//verifica la contrasena\n\t\t\t\t\t\tif (md5($retorna_child[0]['pass_usu']) == $password) {\n\t\t\t\t\t\t\t//genera mensaje para el sistema\n\t\t\t\t\t\t\t$outp[] = array('idUsuario'=> \"\".$retorna_child[0]['idUsuario'].\"\",\n\t\t\t\t\t\t\t\t\t\t\t'nombres_usu'=> \"\".$retorna_child[0]['nombres_usu'].\"\",\n\t\t\t\t\t\t\t\t\t\t\t'apellidos_usu'=> \"\".$retorna_child[0]['apellidos_usu'].\"\",\n\t\t\t\t\t\t\t\t\t\t\t'GrupoUsu_idGrupoUsu'=> \"\".$retorna_master[0]['idGrupoUsu'].\"\",\n\t\t\t\t\t\t\t\t\t\t\t'idGrupoUsu'=> \"\".$retorna_master[0]['idGrupoUsu'].\"\",\n\t\t\t\t\t\t\t\t\t\t\t'activo'=> \"1\",\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn $outp;\n\t\t\t\t\t\t\t$result_child->close();\n\t\t\t\t\t\t\t$result_master->close();\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t//genera mensaje para el sistema\n\t\t\t\t\t\t\t$outp[] = array('activo'=> \"0\"\n\t\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}\n\t\t\t\t\t}\t\t\t\t\n\t\t\t\t}else{\n\t\t\t\t\t//genera mensaje para el sistema\n\t\t\t\t\t$outp[] = array('activo'=> \"0\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\treturn $outp;\n\t\t\t\n\t\t}", "public function getUsuarios()\n {\n\n $sql = \"SELECT * FROM usuario\";\n\n foreach ($this->bd->query($sql) as $res) {\n $this->usuarios[] = $res;\n }\n return $this->usuarios;\n\n }", "function actualizar2($usuario){\n\t\t$conn = $this->conn;\n\t\t$valores = array();\n\t\tforeach($usuario as $key => $data){\n\t\t\tif($data != ''){\n\t\t\t\t$valores[] = $key . \" = '\" . $data .\"'\";\n\t\t\t}\n\t\t}\n\t\t$sql = 'UPDATE usuario ';\n\t\tif(!empty($valores)){\n\t\t\t$sql .= ' set '. implode(', ', $valores);\n\t\t}\n\t\t\n\t\t$usuario_id = $usuario->getUsuario_id();\n\t\t\n\t\t$sql .= ' WHERE usuario_id = \"'.$usuario_id.'\"';\n\t\t//print $sql;\n\t\t$rs = $conn->Execute($sql);\n\t\tif(!$rs){\n\t\t\treturn $conn->ErrorMsg();\n\t\t}\n\t\telse{\n\t\t\t$rs->Close();\n\t\t\treturn \"\";\n \t\t}\n \t}", "public function retrieve_all_users()\n {\n $table_pengajar = $this->db->dbprefix('pengajar');\n $table_siswa = $this->db->dbprefix('siswa');\n $table_login = $this->db->dbprefix('login');\n\n $sql = \"SELECT {$table_login}.username, {$table_pengajar}.nama FROM {$table_pengajar} INNER JOIN {$table_login} ON {$table_pengajar}.id = {$table_login}.pengajar_id\n UNION\n SELECT {$table_login}.username, {$table_siswa}.nama FROM {$table_siswa} INNER JOIN {$table_login} ON {$table_siswa}.id = {$table_login}.siswa_id\";\n\n $result = $this->db->query($sql);\n\n $data = array();\n foreach ($result->result_array() as $r) {\n # selain yang login\n if (is_login() && $r['username'] == get_sess_data('login', 'username')) {\n continue;\n }\n $data[] = addslashes($r['nama']) . ' [' . $r['username'] . ']';\n }\n\n return $data;\n }", "public function usuarios()\n {\n \treturn $this->hasMany(reciclausers::class, 'perfilId', 'id');\n \t// nombre del modelo con el que se relaciona, llave foranea, llave de la tabla.\n }", "public function fetchAllUser() {\n try {\n // Select all users\n $query = \"\n select * \n from tb_user \n \";\n // Create object to connect to MySQL using PDO\n $mysqlPDO = new MySQLPDO();\n // Prepare the query\n $statement = $mysqlPDO->getConnection()->prepare($query);\n // Execute the query without paramters\n $statement->execute();\n // Get affect rows in associative array\n $rows = $statement->fetchAll();\n // Foreach row in array\n foreach ($rows as $row) {\n // Create a User object\n $user = new User($row);\n //Create datatable row\n $tmp_data[] = array(\n $user->getEmail(),\n $user->getUsername(),\n \"********\",\n \"<div style='text-align:center'>\".$user->getAccess().\"</div>\",\n $user->getState() == \"0\" ? '<div style=\"text-align:center\"><i class=\"fas fa-times\" style=\"color:red\"></i></div>' : '<div style=\"text-align:center\"><i class=\"fas fa-check\" style=\"text-align: center; color:green;\"></i></div>',\n \"<div style='text-align:center'><a href='javascript:update(\".json_encode($user).\")' class='btn btn-info'><i class='fas fa-edit'></i></a></div>\",\n \"<div style='text-align:center'><a href='javascript:remove(\".$user->getId().\")' class='btn btn-danger'><i class='far fa-trash-alt'></i></a></div>\"\n );\n }\n // Export into DataTable json format if there's any record in $tmp_data\n if (isset($tmp_data) && count($tmp_data) > 0) {\n $data = array(\n \"data\" => $tmp_data\n );\n } else {\n $data = array(\n \"data\" => array()\n );\n }\n return $data;\n } catch (PDOException $e) {\n die(\"Error message: \" . $e->getMessage());\n }\n }", "public function agregar_usuario_controlador()\n {\n $nombres = strtoupper(mainModel::limpiar_cadena($_POST['usu_nombres_reg']));\n $apellidos = strtoupper(mainModel::limpiar_cadena($_POST['usu_apellidos_reg']));\n $identidad=mainModel::limpiar_cadena($_POST['usu_identidad_reg']);\n $puesto=mainModel::limpiar_cadena($_POST['usu_puesto_reg']);\n $unidad=mainModel::limpiar_cadena($_POST['usu_unidad_reg']);\n $rol = mainModel::limpiar_cadena($_POST['usu_rol_reg']);\n $celular = mainModel::limpiar_cadena($_POST['usu_celular_reg']);\n $usuario = strtolower(mainModel::limpiar_cadena($_POST['usu_usuario_reg']));\n $email=$usuario . '@didadpol.gob.hn' ;\n\n\n /*comprobar campos vacios*/\n if ($nombres == \"\" || $apellidos == \"\" || $usuario == \"\" || $email == \"\" || $rol == \"\" || $identidad == \"\" || $puesto == \"\" || $unidad == \"\") {\n $alerta = [\n \"Alerta\" => \"simple\",\n \"Titulo\" => \"OCURRIÓ UN ERROR INESPERADO\",\n \"Texto\" => \"NO HAS COMPLETADO TODOS LOS CAMPOS QUE SON OBLIGATORIOS\",\n \"Tipo\" => \"error\"\n ];\n echo json_encode($alerta);\n exit();\n }\n\n if (mainModel::verificar_datos(\"[A-ZÁÉÍÓÚáéíóúñÑ ]{3,35}\", $nombres)) {\n $alerta = [\n \"Alerta\" => \"simple\",\n \"Titulo\" => \"OCURRIÓ UN ERROR INESPERADO\",\n \"Texto\" => \"EL CAMPO NOMBRES SOLO DEBE INCLUIR LETRAS Y DEBE TENER UN MÍNIMO DE 3 LETRAS\",\n \"Tipo\" => \"error\"\n ];\n echo json_encode($alerta);\n exit();\n }\n if (mainModel::verificar_datos(\"[A-ZÁÉÍÓÚáéíóúñÑ ]{3,35}\", $apellidos)) {\n $alerta = [\n \"Alerta\" => \"simple\",\n \"Titulo\" => \"OCURRIÓ UN ERROR INESPERADO\",\n \"Texto\" => \"EL CAMPO APELLIDOS SOLO DEBE INCLUIR LETRAS Y DEBE TENER UN MÍNIMO DE 3 LETRAS\",\n \"Tipo\" => \"error\"\n ];\n echo json_encode($alerta);\n exit();\n }\n if ($celular != \"\") {\n if (mainModel::verificar_datos(\"[0-9]{8}\", $celular)) {\n $alerta = [\n \"Alerta\" => \"simple\",\n \"Titulo\" => \"OCURRIÓ UN ERROR INESPERADO\",\n \"Texto\" => \"EL NÚMERO DE CELULAR NO COINCIDE CON EL FORMATO SOLICITADO\",\n \"Tipo\" => \"error\"\n ];\n echo json_encode($alerta);\n exit();\n }\n }\n if (mainModel::verificar_datos(\"[0-9]{13}\", $identidad)) {\n $alerta = [\n \"Alerta\" => \"simple\",\n \"Titulo\" => \"OCURRIÓ UN ERROR INESPERADO\",\n \"Texto\" => \"EL NÚMERO DE IDENTIDAD NO COINCIDE CON EL FORMATO SOLICITADO\",\n \"Tipo\" => \"error\"\n ];\n echo json_encode($alerta);\n exit();\n }\n /*validar DNI*/\n $check_dni = mainModel::ejecutar_consulta_simple(\"SELECT identidad FROM tbl_usuarios WHERE identidad='$identidad'\");\n if ($check_dni->rowCount() > 0) {\n $alerta = [\n \"Alerta\" => \"simple\",\n \"Titulo\" => \"OCURRIÓ UN ERROR INESPERADO\",\n \"Texto\" => \"EL NÚMERO DE IDENTIDAD YA ESTÁ REGISTRADO\",\n \"Tipo\" => \"error\"\n ];\n echo json_encode($alerta);\n exit();\n }\n\n if (mainModel::verificar_datos(\"[a-z]{3,15}\", $usuario)) {\n $alerta = [\n \"Alerta\" => \"simple\",\n \"Titulo\" => \"OCURRIÓ UN ERROR INESPERADO\",\n \"Texto\" => \"EL CAMPO NOMBRE DE USUARIO SOLO DEBE INCLUIR LETRAS Y DEBE TENER UN MÍNIMO DE 5 Y UN MAXIMO DE 15 LETRAS\",\n \"Tipo\" => \"error\"\n ];\n echo json_encode($alerta);\n exit();\n }\n\n /*validar usuario*/\n $check_user = mainModel::ejecutar_consulta_simple(\"SELECT nom_usuario FROM tbl_usuarios WHERE nom_usuario='$usuario'\");\n if ($check_user->rowCount() > 0) {\n $alerta = [\n \"Alerta\" => \"simple\",\n \"Titulo\" => \"OCURRIÓ UN ERROR INESPERADO\",\n \"Texto\" => \"EL USUARIO YA ESTÁ REGISTRADO\",\n \"Tipo\" => \"error\"\n ];\n echo json_encode($alerta);\n exit();\n }\n /*validar email*/\n\n \n $caracteres = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n $pass = \"\";\n for ($i = 0; $i < 8; $i++) {\n $pass .= substr($caracteres, rand(0, 64), 1);\n }\n $message = \"<html><body><p>Hola, \" . $nombres . \" \" . $apellidos;\n $message .= \" Estas son tus credenciales para ingresar al sistema de DIDADPOL\";\n $message .= \"</p><p>Usuario: \" . $usuario;\n $message .= \"</p><p>Correo: \" . $email;\n $message .= \"</p><p>Contraseña: \" . $pass;\n $message .= \"</p><p>Inicie sesión aquí para cambiar la contraseña por defecto \" . SERVERURL . \"login\";\n $message .= \"<p></body></html>\";\n\n $res = mainModel::enviar_correo($message, $nombres, $apellidos, $email);\n if (!$res) {\n $alerta = [\n \"Alerta\" => \"simple\",\n \"Titulo\" => \"OCURRIÓ UN ERROR INESPERADO\",\n \"Texto\" => \"NO SE ENVIÓ CORREO ELECTRÓNICO\",\n \"Tipo\" => \"error\"\n ];\n echo json_encode($alerta);\n exit();\n }\n\n $passcifrado = mainModel::encryption($pass);\n\n $datos_usuario_reg = [\n \"rol\" => $rol,\n \"puesto\"=>$puesto,\n \"unidad\"=>$unidad,\n \"usuario\" => $usuario,\n \"nombres\" => $nombres,\n \"apellidos\" => $apellidos,\n \"dni\"=>$identidad,\n \"clave\" => $passcifrado,\n \"estado\" => \"NUEVO\",\n \"email\" => $email,\n \"celular\" => $celular\n ];\n $agregar_usuario = usuarioModelo::agregar_usuario_modelo($datos_usuario_reg);\n if ($agregar_usuario->rowCount() == 1) {\n $alerta = [\n \"Alerta\" => \"limpiar\",\n \"Titulo\" => \"USUARIO REGISTRADO\",\n \"Texto\" => \"LOS DATOS DEL USUARIO SE HAN REGISTRADO CON ÉXITO\",\n \"Tipo\" => \"success\"\n ];\n } else {\n $alerta = [\n \"Alerta\" => \"simple\",\n \"Titulo\" => \"OCURRIÓ UN ERROR INESPERADO\",\n \"Texto\" => \"NO SE HA PODIDO REGISTRAR EL USUARIO\",\n \"Tipo\" => \"error\"\n ];\n }\n echo json_encode($alerta);\n }", "public function traer_usuarios()\n {\n $usuarios=array();\n $this->db->select('cedula, nombre, email, celular, empresa, razon_social');\n $this->db->from('usuarios');\n $this->db->join('empresas','usuarios.empresa=empresas.id');\n $query=$this->db->get();\n if($query->num_rows()>0)\n {\n foreach ($query->result() as $row)\n {\n $usuarios[$row->cedula]['cedula']=$row->cedula;\n $usuarios[$row->cedula]['nombre']=$row->nombre;\n $usuarios[$row->cedula]['email']=$row->email;\n $usuarios[$row->cedula]['celular']=$row->celular;\n $usuarios[$row->cedula]['empresa']=$row->empresa;\n $usuarios[$row->cedula]['razon_social']=$row->razon_social;\n }\n }\n \n return $usuarios;\n }", "public function update(){\n \n //comprueba que llegue el formulario con los datos\n if(empty($_POST['actualizar']))\n throw new Exception(\"No llegaron los datos\");\n \n //podemos crear un nuevo usuario o recuperar de la bdd,\n //crearé un nuevo usuario porque me ahorro una consulta\n $usuario= new Usuario();\n \n $usuario->id= intval($_POST['id']);\n $usuario->user= $_POST['user'];\n $usuario->pass= $_POST['pass'];\n $usuario->nombre= $_POST['nombre'];\n $usuario->apellidos= $_POST['apellidos'];\n $usuario->email= $_POST['email'];\n $usuario->direccion= $_POST['direccion'];\n $usuario->poblacion= $_POST['poblacion'];\n $usuario->provincia= $_POST['provincia'];\n $usuario->cp= $_POST['cp'];\n \n //intenta realizar la actualización de datos\n if($usuario->actualizar()===false)\n throw new Exception(\"No se pudo actualizar $usuario->user\");\n \n //prepara un mensaje. Es guarda en una variable global perque les variables no es recorden\n // despres d'executar les funcions! I ara no anem a la vista, sino que portem a un altre\n //métode!!\n $GLOBALS['mensaje']= \"Actualización del usuario $usuario->user correcta.\";\n \n //repite la operación de edit, así mantendrá al usuario en la vista de edición\n $this->edit($usuario->id);\n }", "public function findUsers($uo_id)\n {\n $em = $this->getEntityManager(); $users = array();\n try\n {\n $fetch = $em->getConnection()->fetchAll(\n 'SELECT users.id as id, users.username as username, users.date_last_login as date_last_login, '.\n 'users.time_last_login as time_last_login, users.is_active as is_active, users.correo as email, '.\n 'trabajador.nombre_apellidos as nombre_apellidos, trabajador.movil as movil, trabajador.id as trab_id, '.\n 'area.nombre as area, unidad_organizativa.nombre as unidad_organizativa '.\n 'FROM users '.\n 'JOIN trabajador ON (users.trabajador_id = trabajador.id) '.\n 'JOIN area ON (trabajador.area_id = area.id) '.\n 'JOIN unidad_organizativa ON (area.unidad_organizativa_id = unidad_organizativa.id AND unidad_organizativa.id = '. $uo_id .');');\n \n foreach ($fetch as $val)\n {\n $user = $this->find($val['id']);\n $trab = $em->getRepository('NomencladorBundle:Trabajador')->find($val['trab_id']);\n \n $users[] = array(\n 'id' => $val['id'],\n 'username' => $val['username'],\n 'nombre' => $val['nombre_apellidos'],\n 'movil' => ($val['movil']) ? $val['movil'] : 'No se conoce.',\n 'email' => ($val['email']) ? $val['email'] : 'No se conoce.',\n 'cargo' => ($trab->getCargo()) ? $trab->getCargo()->getNombre() : 'No se conoce.',\n 'area' => $trab->getArea()->getNombre(),\n 'last_login' => $val['date_last_login'] .' '. $val['time_last_login'],\n 'is_active' => $val['is_active'],\n 'roles' => $user->getStringRoles()\n );\n }\n return $users;\n }\n catch (\\Exception $e)\n {\n return $e->getMessage();\n } \n }", "public function recoverAllUsers() {\n\t\t$req = \"SELECT * FROM users ORDER BY id_user\";\n\t\t$response = $this->getDb()->fetchAll($req);\n\t\t\n\t\t//Convert Query response to an array of domain objects\n\t\t$users = array();\n\t\tforeach ($response as $row) {\n\t\t\t$userId = $row['id_user'];\n\t\t\t$users[$userId] = $this->buildDomainObject($row);\n\t\t}\n\t\treturn $users;\n\t}", "public function autentificacion($username,$password){\n $userService = new UsuariosServiceImp();\n //objeto de tipo usuario\n $usuario = new Usuarios();\n //llamdo al metodo definido en la capa de servicio\n $usuario = $userService->buscarPorUsernamePassword($username,$password);\n if ( is_object($usuario)){\n /*\n variable de sesion mediante variables locales\n \n $_SESSION['nombre'] = $usuario->getNombre();\n $_SESSION['correo'] = $usuario->getEmail();\n $_SESSION['id'] = $usuario->getId();\n */\n /* variable de sesion mediante un arreglo asociado\n */\n $_SESSION['miSesion'] = array();\n $_SESSION['miSesion']['nombre'] = $usuario->getNombre();\n $_SESSION['miSesion']['correo'] = $usuario->getEmail();\n $_SESSION['miSesion']['id'] = $usuario->getId();\n \n //echo \"<br>El usuario es valido\";\n header(\"location:../view/productos.class.php\");\n }else{\n //echo \"<br>Este usuario no esta registrado en la base de datos\";\n header(\"location:../view/formLogin.html\");\n }\n }", "public function getUsuario($id) {\n $getUsuario = new SqlQuery(); //instancion objeto de la clase para realizar consulta\n (string) $tabla = get_class($this); //obtengo el nombre de la clase para hacer la consulta\n try {\n $this->refControladorPersistencia->get_conexion()->beginTransaction(); //comienza la transacción\n $usuario = $getUsuario->buscarId($id, $tabla);\n $statement = $this->refControladorPersistencia->ejecutarSentencia($usuario); //llamo a la funcion\n $user = $statement->fetchAll(PDO::FETCH_ASSOC);\n $this->refControladorPersistencia->get_conexion()->commit(); //si todo salió bien hace el commit \n } catch (PDOException $excepcionPDO) {\n echo \"<br>Error PDO: \" . $excepcionPDO->getTraceAsString() . '<br>';\n $this->refControladorPersistencia->get_conexion()->rollBack(); //si salio mal hace un rollback\n } catch (Exception $exc) {\n echo $exc->getTraceAsString();\n $this->refControladorPersistencia->get_conexion()->rollBack(); //si hay algún error hace rollback\n }\n return $user;\n }", "private function fillInfo()\n\t{\n\t\t$database = new db_Database();\n\n\t\t$database->query(\"select * from users where id=:id\");\n\t\t$database->bind(\":id\",$this->id);\n\t\t$set=$database->resultset();\n\t\t\n\t\t$this->password=$set[0]['pass'];\n\t\t$this->userName=$set[0]['userName'];\t\t\n\t\t$this->email=$set[0]['email'];\t\t\n\t\t$this->session=$set[0]['session'];\n\t\t$this->avatar=$set[0]['avatar'];\n\t\t\n\t}" ]
[ "0.7129954", "0.7052306", "0.7000962", "0.6958368", "0.68119097", "0.66411966", "0.66149396", "0.6606021", "0.65998924", "0.6591766", "0.65428185", "0.65392315", "0.65370804", "0.653632", "0.6532443", "0.6514418", "0.64949816", "0.64941466", "0.64788216", "0.64495367", "0.644702", "0.64446986", "0.6440562", "0.64336234", "0.6417464", "0.6414835", "0.64009017", "0.6399082", "0.6377646", "0.63708645", "0.636263", "0.6362274", "0.6332644", "0.63100106", "0.6294326", "0.62710243", "0.6270808", "0.6269398", "0.6258907", "0.6257618", "0.62482554", "0.6238507", "0.62379503", "0.62272567", "0.62203777", "0.6219062", "0.62162006", "0.6211139", "0.620687", "0.62055445", "0.61977524", "0.61948186", "0.618224", "0.61802256", "0.6180089", "0.6172404", "0.61664486", "0.6164986", "0.6164682", "0.6164291", "0.61608857", "0.61581814", "0.6153312", "0.6148385", "0.6147587", "0.614473", "0.61391014", "0.6138851", "0.61309135", "0.61269796", "0.6124838", "0.61056495", "0.61051047", "0.610257", "0.60995305", "0.60971594", "0.60942715", "0.6091733", "0.60899234", "0.60866046", "0.6086152", "0.6083518", "0.6076034", "0.60738623", "0.6073329", "0.6071057", "0.607025", "0.6065231", "0.6053753", "0.6039092", "0.6032044", "0.6026513", "0.601591", "0.6011413", "0.6010552", "0.600446", "0.6002598", "0.6001383", "0.5995972", "0.5991665", "0.59912413" ]
0.0
-1
Check if url exists
public function checkURL($url) { $ret = false; $headers = get_headers( 'http://gdata.youtube.com/feeds/api/videos/'. $this->getVideoId($url) ); if (strpos($headers[0], '200')) { $ret = true; } return $ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function url_exist($url)\r\n\t\t{\r\n\t\t\r\n\t\t}", "function url_exists($url){ \r\n $url_data = parse_url($url); // scheme, host, port, path, query\r\n if(!fsockopen($url_data['host'], isset($url_data['port']) ? $url_data['port'] : 80)){\r\n $this->set_message('url_exists', 'The URL you entered is not accessible.');\r\n return FALSE;\r\n } \r\n \r\n return TRUE;\r\n }", "private function urlExist() {\n if (!$this->webhook->url) {\n // throw an exception\n $this->missingEx('url');\n }\n }", "public function exists( $url );", "private function checkIfUrlExists($url) {\n $headers = get_headers($url);\n return ((int) substr($headers[0], 9, 3)) === 200;\n }", "public static function url_exists($url) {\r\n \r\n // Too slow\r\n return true;\r\n \r\n /*\r\n \r\n $ch = curl_init($url);\r\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\r\n $response = curl_exec($ch);\r\n $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\r\n \r\n if ($httpCode == 404) {\r\n return false;\r\n }\r\n \r\n return true;\r\n \r\n $file_headers = @get_headers($url);\r\n if ($file_headers[0] == 'HTTP/1.1 404 Not Found') {\r\n return false;\r\n }\r\n \r\n return true;\r\n */\r\n \r\n }", "public function test_url_exist($url) {\n\n\t\t$headers = @get_headers($url);\n\n\t\tif ($headers === FALSE) {\n\n\t\t\treturn FALSE;\n\t\t} else {\n\n\t\t\treturn TRUE;\n\t\t}\n\t}", "function ajax_action_check_url() {\n\n\t\t$hadError = true;\n\n\t\t$url = isset( $_REQUEST['url'] ) ? $_REQUEST['url'] : '';\n\n\t\tif ( strlen( $url ) > 0 && function_exists( 'get_headers' ) ) {\n\t\t\t\t\n\t\t\t$file_headers = @get_headers( $url );\n\t\t\t$exists = $file_headers && $file_headers[0] != 'HTTP/1.1 404 Not Found';\n\t\t\t$hadError = false;\n\t\t}\n\n\t\techo '{ \"exists\": '. ($exists ? '1' : '0') . ($hadError ? ', \"error\" : 1 ' : '') . ' }';\n\n\t\tdie();\n\t}", "function url_exists($url) {\n $a_url = parse_url($url);\n if (!isset($a_url['port'])) $a_url['port'] = 80;\n $errno = 0;\n $errstr = '';\n $timeout = 5;\n if(isset($a_url['host']) && $a_url['host']!=gethostbyname($a_url['host'])){\n $fid = @fsockopen($a_url['host'], $a_url['port'], $errno, $errstr, $timeout);\n if (!$fid) return false;\n $page = isset($a_url['path']) ?$a_url['path']:'';\n $page .= isset($a_url['query'])?'?'.$a_url['query']:'';\n fputs($fid, 'HEAD '.$page.' HTTP/1.0'.\"\\r\\n\".'Host: '.$a_url['host'].\"\\r\\n\\r\\n\");\n $head = fread($fid, 4096);\n fclose($fid);\n return preg_match('#^HTTP/.*\\s+[200|302]+\\s#i', $head);\n } else {\n return false;\n }\n }", "public function urlExists($url) {\n\t\t$headers = @get_headers($url);\n\t\treturn is_array($headers) ? true : false;\n\t}", "function does_url_exist($url) {\n\t$fd = fopen(\"$url\", \"r\");\n\tif ($fd) {\n\t\tfclose($fd);\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "function url_exists($url) {\n if(@file_get_contents($url,0,NULL,0,1)) {\n return true;\n } else {\n return false;\n }\n}", "private static function urlExists($url){\n $ch = curl_init($url);\n curl_setopt($ch, CURLOPT_NOBODY, true);\n curl_setopt($ch, CURLOPT_HEADER, true);\n curl_setopt($ch, CURLOPT_TIMEOUT, 10); // set time out to 10 seconds\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); //follow redirects\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\n curl_exec($ch);\n\n $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n\n if($code == 200){\n $status = true;\n } else {\n $status = false;\n }\n curl_close($ch);\n\n return $status;\n }", "public function hasUrl()\n {\n return ! empty($this->url);\n }", "static function existeURL($url) {\n $url = @parse_url($url);\n if (!$url)\n return false;\n\n $url = array_map('trim', $url);\n $url['port'] = (!isset($url['port'])) ? 80 : (int) $url['port'];\n\n $path = (isset($url['path'])) ? $url['path'] : '/';\n $path .= (isset($url['query'])) ? \"?$url[query]\" : '';\n\n if (isset($url['host']) && $url['host'] != gethostbyname($url['host'])) {\n\n $fp = fsockopen($url['host'], $url['port'], $errno, $errstr, 30);\n\n if (!$fp)\n return false; //socket not opened\n\n fputs($fp, \"HEAD $path HTTP/1.1\\r\\nHost: $url[host]\\r\\n\\r\\n\"); //socket opened\n $headers = fread($fp, 4096);\n fclose($fp);\n\n if (preg_match('#^HTTP/.*\\s+[(200|301|302)]+\\s#i', $headers)) {//matching header\n return true;\n } else\n return false;\n } // if parse url\n else\n return false;\n }", "public static function urlExists($url)\n {\n $file_headers = @get_headers($url);\n \n if ($file_headers[0] == 'HTTP/1.1 404 Not Found') {\n $exists = false;\n } else {\n $exists = true;\n }\n \n return $exists;\n }", "function url_exists($url){\n\t$url = str_replace(\"http://\", \"\", $url);\n\tif (strstr($url, \"/\")) {\n\t\t$url = explode(\"/\", $url, 2);\n\t\t$url[1] = \"/\".$url[1];\n\t} else {\n\t\t$url = array($url, \"/\");\n\t}\n\n\t$fh = fsockopen($url[0], 80);\n\tif ($fh) {\n\t\tfputs($fh,\"GET \".$url[1].\" HTTP/1.1\\nHost:\".$url[0].\"\\n\\n\");\n\t\tif (fread($fh, 22) == \"HTTP/1.1 404 Not Found\") { return FALSE; }\n\t\telse { return TRUE; }\n\n\t} else { \n\t\t//echo '<p>no fh</p>';\n\t\treturn FALSE;\n\t}\n}", "public function url_exists( $src ) {\n\n\t\t// Make arguments supplied are valid\n\t\tif( !is_string( $src ) ) {\n\t\t\texit( '$src is an invalid argument' );\n\t\t}\n\n\t\t// Isolate path to file from URL\n\t\t$url_parts = parse_url( $src );\n\t\t$path = $url_parts['path'];\n\n\t\t// Check if file exists from reassembled path\n\t\tif( file_exists( $_SERVER['DOCUMENT_ROOT'] . $path ) ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\n\t}", "function url_exists($pageURL){\n\t if ((strpos($pageURL, \"https\")) === false){ $pageURL = \"https://\" . $pageURL;} //pos8etei https an leipei\n\t\t \n\t\t \n\t\t \n\t if (is_array(@get_headers($pageURL)) && ((strpos($pageURL, \"facebook\")) !== false))\t//an to header request itan epituxes kai to page itan kapoio fb page\n\t return true;\n\t else\n\t\t {return true;}\n\t}", "function _bellcom_check_if_file_in_url_exists($file_url) {\n $file_headers = @get_headers($file_url);\n\n if ($file_headers[0] == 'HTTP/1.1 404 Not Found') {\n return FALSE;\n }\n else {\n return TRUE;\n }\n}", "protected function verifyUrlExists($url) \n\t{\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url);\n curl_setopt($ch, CURLOPT_NOBODY, true);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_exec($ch);\n $response = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n curl_close($ch);\n\n return (!empty($response) && $response != 404);\n }", "function checkIfExistingBaseUrl($url)\n {\n $ch = curl_init($url);\n curl_setopt($ch, CURLOPT_NOBODY, true); // set to HEAD request\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // don't output the response\n curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, 1);\n curl_setopt($ch, CURLOPT_TIMEOUT, 400);\n curl_exec($ch);\n $result = curl_getinfo($ch, CURLINFO_HTTP_CODE) == 200;\n curl_close($ch);\n\n return $result;\n }", "public function urlExists($url, $path)\n {\n $filename = '/statamic-test-'.time();\n $tmp = $path . $filename;\n touch($tmp);\n\n $resolvedUrl = URL::assemble($this->getAbsoluteUrl($url), $filename);\n\n $headers = get_headers($resolvedUrl);\n\n unlink($tmp);\n\n return (!$headers || strpos($headers[0], '404')) == false;\n }", "public static function urlImageExists($url){\n if(strpos($url,'http://') === false)\n return false;\n $headers = @get_headers($url);\n if(is_array($headers))\n return strpos($headers[0],'200') !== false;\n }", "function checkExists($url)\n{\n\t$db = new SQLite3(DB_NAME);\n\t$query = \"SELECT * FROM URL WHERE url='$url' LIMIT 1\";\n\t$exec = $db->query($query);\n\t$count = count($exec->fetchArray());\n\tif($count==1)\n\t{\n\t\treturn false;\n\t}\n\telse\n\t\treturn true;\n}", "public function hasRemoteUrl();", "public function is_valid_url()\r\n {\r\n return (!empty($this->url) && PiplApi_Utils::piplapi_is_valid_url($this->url));\r\n }", "public function is_valid_url()\r\n {\r\n return (!empty($this->url) && PiplApi_Utils::piplapi_is_valid_url($this->url));\r\n }", "private static function remoteFileExists($url) {\n\t\t$f = @fopen($url, 'r');\n\t\tif($f) {\n\t\t\tfclose($f);\n\t\t\treturn TRUE;\n\t\t}\n\t\treturn FALSE;\n\t}", "function remoteFileExists($url) {\n $curl = curl_init($url);\n\n //don't fetch the actual page, you only want to check the connection is ok\n curl_setopt($curl, CURLOPT_NOBODY, true);\n\n //do request\n $result = curl_exec($curl);\n\n $ret = false;\n\n //if request did not fail\n if ($result !== false) {\n //if request was ok, check response code\n $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);\n\n if ($statusCode == 200) {\n $ret = true;\n }\n }\n\n curl_close($curl);\n\n return $ret;\n }", "public function hasUrlPath()\n {\n return $this->url_path !== null;\n }", "private function does_file_exist( string $url ): bool {\n\t\t$ch = curl_init( $url );\n\t\tcurl_setopt( $ch, CURLOPT_NOBODY, true );\n\t\tcurl_setopt( $ch, CURLOPT_TIMEOUT_MS, 50 );\n\t\tcurl_exec( $ch );\n\t\t$http_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE );\n\t\tcurl_close( $ch );\n\t\treturn $http_code === 200;\n\t}", "public function is_valid_url()\n {\n return (!empty($this->url) && APIUtil::piplapi_is_valid_url($this->url));\n }", "public function is_valid_url()\r\n {\r\n return (!empty($this->internal_params['url']) &&\r\n piplapi_is_valid_url($this->internal_params['url']));\r\n }", "public function isDynamicUrl();", "static function is_url($url) {\n return ($url && ($info=parse_url($url)) && $info['host']);\n }", "public function hasUrlGenerator(): bool;", "abstract public function longUrlExists($long_url);", "function url_already_exists( $url, $db)\r\n{\r\n\t$query = \"SELECT * FROM articles WHERE urls = '$url'\";\r\n\t$result = mysqli_query($db, $query);\r\n\treturn mysqli_num_rows($result) == 1;\r\n}", "public static function urlExists($url = false)\n {\n if (false !== $url && strlen($url)) {\n return self::where('url', $url)->select('id')->first();\n }\n\n return false;\n }", "function check_url_exists($url, $test_freq_secs)\n{\n $test1 = $GLOBALS['SITE_DB']->query_select('urls_checked', array('url_check_time', 'url_exists'), array('url' => $url), 'ORDER BY url_check_time DESC', 1);\n\n if ((!isset($test1[0])) || ($test1[0]['url_check_time'] < time() - $test_freq_secs)) {\n $test2 = http_download_file($url, 0, false);\n if (($test2 === null) && (($GLOBALS['HTTP_MESSAGE'] == '401') || ($GLOBALS['HTTP_MESSAGE'] == '403') || ($GLOBALS['HTTP_MESSAGE'] == '405') || ($GLOBALS['HTTP_MESSAGE'] == '416') || ($GLOBALS['HTTP_MESSAGE'] == '500') || ($GLOBALS['HTTP_MESSAGE'] == '503') || ($GLOBALS['HTTP_MESSAGE'] == '520'))) {\n $test2 = http_download_file($url, 1, false); // Try without HEAD, sometimes it's not liked\n }\n $exists = (($test2 === null) && ($GLOBALS['HTTP_MESSAGE'] != 401)) ? 0 : 1;\n\n if (isset($test1[0])) {\n $GLOBALS['SITE_DB']->query_delete('urls_checked', array(\n 'url' => $url,\n ));\n }\n\n $GLOBALS['SITE_DB']->query_insert('urls_checked', array(\n 'url' => $url,\n 'url_exists' => $exists,\n 'url_check_time' => time(),\n ));\n } else {\n $exists = $test1[0]['url_exists'];\n }\n\n return ($exists == 1);\n}", "public static function exists($url)\n {\n $handle = curl_init($url);\n if (false === $handle)\n {\n return false;\n }\n\n curl_setopt($handle, CURLOPT_HEADER, false);\n curl_setopt($handle, CURLOPT_FAILONERROR, true);\n curl_setopt($handle, CURLOPT_HTTPHEADER, array(\"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15\") );\n curl_setopt($handle, CURLOPT_NOBODY, true);\n curl_setopt($handle, CURLOPT_RETURNTRANSFER, false);\n $connectable = curl_exec($handle);\n curl_close($handle);\n\n return $connectable;\n }", "function check_url($url){\n\n $data = file_get_contents($url);\n\n if (empty($data)) {\n return \"false\";\n } else {\n return \"true\";\n }\n\n\n \n}", "private static function checkUrl($url)\n {\n if (filter_var($url, FILTER_VALIDATE_URL) !== false) {\n // TODO: check if URL gives 200 response code\n return true;\n }\n\n return false;\n }", "private function checkUrlStatus()\n {\n $request = curl_init($this->url);\n\n curl_setopt($request, CURLOPT_HEADER, true);\n curl_setopt($request, CURLOPT_NOBODY, true);\n curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($request, CURLOPT_TIMEOUT, 10);\n\n curl_exec($request);\n $httpCode = curl_getinfo($request, CURLINFO_HTTP_CODE);\n curl_close($request);\n\n if ($httpCode >= 200 && $httpCode < 400) {\n return true;\n }\n\n return false;\n }", "public function hasUrlHost()\n {\n return $this->url_host !== null;\n }", "public static function checkUrl($url)\r\n {\r\n $ch = curl_init();\r\n curl_setopt($ch, CURLOPT_URL, $url);\r\n curl_setopt($ch, CURLOPT_NOBODY, true); // only make a HEAD request\r\n curl_setopt($ch, CURLOPT_FAILONERROR, true); // fail if response >= 400\r\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\r\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\r\n \r\n if (curl_exec($ch) !== false)\r\n {\r\n return true;\r\n }\r\n else\r\n {\r\n return false;\r\n }\r\n }", "function check_url($url, $post=false) {\r\n $ch = curl_init($url);\r\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\r\n curl_setopt($ch, CURLOPT_TIMEOUT,1);\r\n if ($post) {\r\n curl_setopt($ch, CURLOPT_POST, true);\r\n curl_setopt($ch, CURLOPT_HTTPHEADER, $_SESSION['plex_headers']);\r\n }\r\n /* Get the HTML or whatever is linked in $url. */\r\n $response = curl_exec($ch);\r\n\r\n /* Check for 404 (file not found). */\r\n $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\r\n curl_close($ch);\r\n\r\n /* If the document has loaded successfully without any redirection or error */\r\n if ($httpCode >= 200 && $httpCode < 300) {\r\n write_log(\"Connection is valid: \".$url);\r\n return true;\r\n } else {\r\n write_log(\"Connection failed with error code \".$httpCode.\": \".$url,\"ERROR\");\r\n return false;\r\n }\r\n }", "function is_url_real ($url_to_shorten)\n{\n $test_flag = true;\n\n $ch = curl_init();\n curl_setopt($ch, CURLOPT_URL, $url_to_shorten);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\n $response = curl_exec($ch);\n if( curl_getinfo($ch, CURLINFO_HTTP_CODE) == '404' ||\n FALSE == $response )\n {\n dumper($response);\n $test_flag = false;\n }\n curl_close($ch);\n return $test_flag;\n}", "function remote_file_exists($url)\n\t{\n\t // Make sure php will allow us to do this...\n\t if ( ini_get('allow_url_fopen') )\n\t {\n\t \t$head = '';\n\t \t$url_p = parse_url ($url);\n\t\n\t \tif (isset ($url_p['host']))\n\t \t{\n\t\t\t\t$host = $url_p['host']; \n\t\t\t}\n\t \telse\n\t \t{\n\t \treturn false;\n\t \t}\n\t\n\t \tif (isset ($url_p['path']))\n\t \t{ \n\t\t\t\t$path = $url_p['path']; \n\t\t\t}\n\t \telse\n\t \t{\n\t\t\t \t$path = ''; \n\t\t\t}\n\t\n\t \t$fp = @fsockopen ($host, 80, $errno, $errstr, 20);\n\t \tif (!$fp)\n\t \t{\n\t \t\treturn false;\n\t \t}\n\t \telse\n\t \t{\n\t \t\t$parse = parse_url($url);\n\t \t\t$host = $parse['host'];\n\t\n\t\t\t\t@fputs($fp, 'HEAD '.$url.\" HTTP/1.1\\r\\n\");\n\t \t\t@fputs($fp, 'HOST: '.$host.\"\\r\\n\");\n\t \t\t@fputs($fp, \"Connection: close\\r\\n\\r\\n\");\n\t \t\t$headers = '';\n\t \t\twhile (!@feof ($fp))\n\t \t\t{ \n\t\t\t\t\t$headers .= @fgets ($fp, 128); \n\t\t\t\t}\n\t \t}\n\t \t@fclose ($fp);\n\t\n\t \t$arr_headers = explode(\"\\n\", $headers);\n\t \tif (isset ($arr_headers[0])) \n\t\t\t{\n\t \t\tif(strpos ($arr_headers[0], '200') !== false)\n\t \t\t{ \n\t\t\t\t\treturn true; \n\t\t\t\t}\n\t \t\tif( (strpos ($arr_headers[0], '404') !== false) || (strpos ($arr_headers[0], '509') !== false) || (strpos ($arr_headers[0], '410') !== false))\n\t \t\t{ \n\t\t\t\t\treturn false; \n\t\t\t\t}\n\t \t\tif( (strpos ($arr_headers[0], '301') !== false) || (strpos ($arr_headers[0], '302') !== false))\n\t\t\t\t{\n\t \t\tpreg_match(\"/Location:\\s*(.+)\\r/i\", $headers, $matches);\n\t \t\tif(!isset($matches[1]))\n\t\t\t\t\t{\n\t \t\t\treturn false;\n\t\t\t\t\t}\n\t \t\t$nextloc = $matches[1];\n\t\t\t\t\treturn $this->remote_file_exists($nextloc);\n\t \t\t}\n\t \t}\n\t \t// If we are still here then we got an unexpected header\n\t \treturn false;\n\t }\n\t else\n\t {\n\t \t// Since we aren't allowed to use URL's bomb out\n\t \treturn false;\n\t }\n\t}", "function urlOk ($url) {\r\n return filter_var($url, FILTER_VALIDATE_URL);\r\n }", "function urlOK($url)\n{\n $headers = @get_headers($url);\n if(strpos($headers[0],'200')===false){return false;}else{return true;}\n}", "function linkExists($url) {\n\t$url = dbEscape($url);\n\treturn(dbResultExists(\"SELECT id FROM links WHERE link='$url'\"));\n}", "public function checkIfExternal($url)\n {\n $baseUrlTrimmed = str_replace(['http://', 'https://'], '', $this->baseUrl);\n if (preg_match(\"@http(s)?\\://$baseUrlTrimmed@\", $url)) {\n return false;\n } else {\n return true;\n }\n }", "private function check_url() {\n\t\t$check_url_object = new Router();\n\t\t$this->loader->add_action( 'init', $check_url_object, 'boot' );\n\t}", "function checkURL($url) {\n\t\t\tif(!eregi(\"^http:\\/\\/\", $url)) {return false;}\n\t\t\treturn true;\n\t\t}", "protected function urlExistsInDb($url) \n\t{\n $query = \"SELECT url_shortner FROM \".self::$table.\" WHERE long_url = :long_url LIMIT 1\";\n $stmt = $this->pdo->prepare($query);\n $params = array(\"long_url\" => $url);\n $stmt->execute($params);\n\n $result = $stmt->fetch();\n return (empty($result)) ? false : $result[\"short_url\"];\n }", "private function checkUrl() {\n $career = $this->route('career');\n\n $url = $this->input('url');\n $prefix = trans('module-careerplugin::options.url_prefix');\n $language = $career->language ?? $this->getLanguage();\n\n $fullUrl = ($language->language_code ?? '') . '/' . $prefix . '/' . $url;\n\n $urlModel = Url::findUrl($fullUrl);\n\n if (!$urlModel) {\n return true;\n }\n\n return $career && $urlModel->model_id === $career->id && $urlModel->model === Career::class;\n }", "public static function checkFileExists($file, $url){\n\t\t\n\t\tif(empty($file)) return false;\n\t\tif(!is_file($url.$file)) false;\n\t\treturn true;\n//\t\ttry {\n//\t\t\tfclose(fopen($file, \"r\"));\n//\t\t\treturn true;\n//\t\t} catch (Exception $e) {\n//\t\t\treturn false;\n//\t\t}\n\t}", "protected function urlExist($uri)\n {\n $harvest = Harvest::fromUrl(\n $uri,\n 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.107 Safari/537.36',\n 'en,en-US;q=0.5',\n $this->previousRequest\n );\n\n if (\\is_int($harvest) || 200 !== $harvest->getResponse()->getStatusCode()) {\n return false;\n }\n\n $this->previousRequest = $harvest->getResponse()->getRequest();\n\n return true;\n }", "function isURLExistingInLinkArry($url){\r\n foreach($this->link_arry as $link){\r\n if($link->getURL()==$url){\r\n return true;\r\n }\r\n }\r\n return false;\r\n }", "function xss_check_url( $url )\n\t{\n\t\t$url = trim( urldecode( $url ) );\n\t\t\n\t\tif ( ! preg_match( \"#^https?://(?:[^<>*\\\"]+|[a-z0-9/\\._\\- !]+)$#iU\", $url ) )\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\treturn TRUE;\n\t}", "function existsInDatabase($url) {\n global $conn;\n\n $query = $conn->prepare(\"SELECT * FROM sites WHERE url = :url\");\n\n // avoid sql injections\n $query->bindParam(\":url\", $url);\n $query->execute();\n\n return $query->rowCount() != 0; // returns true if url exists in db\n}", "function &checkUrl( $url )\n {\n $this->dbInit();\n\n $this->Database->array_query( $url_array, \"SELECT url FROM eZLink_Link WHERE url='$url'\" );\n\n return count( $url_array );\n }", "public function hasPublicUrl() {\n return $this->_has(4);\n }", "function url_check($url) { \n $hdrs = @get_headers($url); \n return is_array($hdrs) ? preg_match('/^HTTP\\\\/\\\\d+\\\\.\\\\d+\\\\s+2\\\\d\\\\d\\\\s+.*$/',$hdrs[0]) : false; \n}", "static public function checkExternalUrl($url) {\n\t\treturn t3lib_div::isValidUrl($url);\n\t}", "public function hasHostInfo($url) {\n\t\treturn !strncasecmp($url,'http://',7) || !strncasecmp($url,'https://',8); //same criterias as in CUrlRule\n\t}", "function isSiteAvailable($url){\n\t\t\tif(!filter_var($url, FILTER_VALIDATE_URL)){\n\t\t\t\t//return 'URL provided wasnt valid';\n\t\t\t\treturn 'invalid';\n\t\t\t}\n\t\t\t\n\t\t\t//make the connection with curl\n\t\t\t$cl = curl_init($url);\n\t\t\tcurl_setopt($cl,CURLOPT_CONNECTTIMEOUT,10);\n\t\t\tcurl_setopt($cl,CURLOPT_HEADER,true);\n\t\t\tcurl_setopt($cl,CURLOPT_NOBODY,true);\n\t\t\tcurl_setopt($cl,CURLOPT_RETURNTRANSFER,true);\n\t\t\t\n\t\t\t//get response\n\t\t\t$response = curl_exec($cl);\n\t\t\t\n\t\t\tcurl_close($cl);\n\t\t\t\n\t\t\t//if ($response) return 'Site seems to be up and running!';\n\t\t\tif ($response) return 'success';\n\t\t\t\n\t\t\t//return 'Oops nothing found, the site is either offline or the domain doesn\\'t exist';\n\t\t\treturn 'failed';\n\t\t}", "function wp_http_validate_url($url)\n {\n }", "function is_url_hostname_resolvable($url) {\n\t$urlhostname = parse_url($url, PHP_URL_HOST);\n\tif (empty($urlhostname)) {\n\t\treturn false;\n\t}\n\tputenv(\"RES_OPTIONS=timeout:3 attempts:1\");\n\t$resolvable = ($urlhostname !== gethostbyname($urlhostname));\n\tputenv(\"RES_OPTIONS\");\n\treturn $resolvable;\n}", "function oos_validate_is_url($sUrl) {\n if (strlen($sUrl) == 0) {\n return false;\n }\n\n return preg_match('!^http(s)?://[\\w-]+\\.[\\w-]+(\\S+)?$!i', $sUrl);\n }", "private static function is_url( $url ) \n\t{\n\t\treturn ( ( strpos( $url, 'http://' ) === 0 || strpos( $url, 'https://' ) === 0 || strpos( $url, '//' ) === 0 || strpos( $url, '/' ) === 0 ) && strpos( $url, \"\\n\" ) === false );\n\t}", "function _has_protocol(string $url)\n {\n return preg_match('#^([a-z]+:)?//#i', $url);\n }", "public static function urlExists($url, $follow_redirects = TRUE) {\n $handle = curl_init();\n curl_setopt($handle, CURLOPT_URL, $url);\n curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);\n curl_setopt($handle, CURLOPT_FOLLOWLOCATION, $follow_redirects);\n curl_setopt($handle, CURLOPT_HEADER, 0);\n // Get the HTML or whatever is linked in $redirect_url.\n $response = curl_exec($handle);\n\n // Get status code.\n $http_code = curl_getinfo($handle, CURLINFO_HTTP_CODE);\n $last_location = curl_getinfo($handle, CURLINFO_EFFECTIVE_URL);\n\n $url = ($follow_redirects) ? $last_location : $url;\n\n // Check that http code exists.\n if ($http_code) {\n // Determines first digit of http code.\n $first_digit = substr($http_code, 0, 1);\n // Filters for 2 or 3 as first digit.\n if ($first_digit == 2 || $first_digit == 3) {\n return $url;\n }\n else {\n // Invalid url.\n return FALSE;\n }\n }\n }", "function found_url($url) {\n\t$test = @fopen($url, 'r');\n\tif(!$test) {\n\t\tif($GLOBALS['debug']) echo(\"> Can't open file!: $url\\n\");\n\t\treturn(1);\n\t}\n\t\n\techo($url.\"\\n\");\n}", "abstract public function mustFollowUrl(string $url): bool;", "protected function urlExists(string $field, string $value, $param = null)\n {\n if (!empty($value)) {\n\n $error = false;\n\n if (filter_var($value, FILTER_VALIDATE_URL) !== false) {\n $url = parse_url(strtolower($value));\n\n if (isset($url['host'])) {\n $url = $url['host'];\n }\n\n if (function_exists('checkdnsrr') && function_exists('idn_to_ascii')) {\n if (checkdnsrr(idn_to_ascii($url, 0, INTL_IDNA_VARIANT_UTS46), 'A') === false) {\n $error = true;\n }\n } else {\n if (gethostbyname($url) == $url) {\n $error = true;\n }\n }\n\n if ($error) {\n $this->addError($field, 'urlExists', $param);\n }\n } else {\n $this->addError($field, 'url', $param);\n }\n }\n }", "private function hasUri()\n {\n return null !== $this->uri;\n }", "public function testIfStockManagementHasUrl()\n {\n $this->assertNotNull($this->stock->getUrl());\n }", "function checkForBadLink($url) {\n\t\t$link = getDbConnect();\n\t\t$preparedStatement = $link->prepare(\"select hash from google_safe_browsing where hash = :hash;\");\n\t\t$preparedStatement->execute(array(\":hash\" => md5($url)));\n\t\treturn count($preparedStatement->fetchAll()) == 0;\n\t}", "function website_exists( $site ) {\n\n\t$websites = get_website_data();\n\n\tif ( isset( $websites[ $site ] ) ) {\n\t\treturn true;\n\t}\n\n\treturn false;\n\n}", "public static function isURL($filename) {\n\t\treturn preg_match('!^(https?|ftp)://!', $filename);\n\t}", "function is_valid_url($string) {\n\tif(is_url($string)){\n\t\t$ch = curl_init();\n\t\tcurl_setopt ($ch, CURLOPT_URL, str_replace('https://', 'http://', $string));\n\t\tcurl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);\n\t\tcurl_setopt ($ch, CURLOPT_NOBODY, true);\n\t\tcurl_setopt ($ch, CURLOPT_FAILONERROR, false);\n\t\tcurl_setopt ($ch, CURLOPT_AUTOREFERER, true);\n\t\tcurl_setopt ($ch, CURLOPT_TIMEOUT, 120);\n\t\t$result = @curl_exec($ch);\n\t\tcurl_close($ch);\n\t\treturn ($result!==false) ? true : false;\n\t} else {\n\t\treturn false;\n\t}\n}", "private function isValidUri(): bool\n {\n return true;\n }", "public function isUrl($url)\r\n\t{\r\n\t\tif( empty($url))\r\n\t\t\treturn null;\r\n\r\n\t\t$url = trim($url);\r\n\r\n\t\t$regex = \"/(http|https|ftp|ftps)\\:\\/\\/[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(\\/\\S*)?/\";\r\n\r\n\t\treturn (bool) preg_match($regex,$url);\r\n\t}", "public function exists()\n {\n if (file_exists($this->getDestination()))\n {\n try\n {\n // Do a redirect to the file on filesystem - don't load contents in - that costs memory\n $url = str_replace(sfImagePoolPluginConfiguration::getBaseDir(), sfImagePoolPluginConfiguration::getBaseUrl(), $this->getDestination());\n \n sfContext::getInstance()->getController()->redirect($url, 0, 301);\n \n return $url;\n }\n catch (Exception $e)\n {\n return false;\n }\n }\n else\n {\n return false;\n }\n }", "public function hasUri()\n {\n return $this->uri !== null;\n }", "public static function isUrl($url) {\n return preg_match('|^http(s)?://[a-z0-9-]+(\\.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url);\n }", "function check($value)\r\n\t{\r\n\t\tif (!preg_match(\"~^(https?://[a-zA-Z\\.]+)?/?([a-zA-Z\\.]+/?)+(\\??[^\\?]*)#?[^#]*$~i\", $value))\r\n\t\t{\r\n\t\t\t$this->error('BAD_URL');\r\n\t\t} \r\n\r\n\t}", "function carousel_slider_is_url( $url ) {\n\t\tif ( filter_var( $url, FILTER_VALIDATE_URL ) ) {\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "public static function validUrl($url) {\n if (! $info = parse_url($url)) {\n return false;\n }\n\n if (empty($info['host']) || $info['host'] === 'localhost') {\n return false;\n }\n\n if (empty($info['scheme']) || ! ($info['scheme'] === 'http' || $info['scheme'] === 'https')) {\n return false;\n }\n\n return true;\n }", "protected function is_valid_url($url) {\r\n return true;\r\n }", "public function isValidUrl($url)\n {\n //$name = $this->getName($url);\n //$id = $this->getId($url);\n $data = $this->getData($url);\n if(empty($data['idaccount'])){\n return false;\n }else{\n $this->setId($data['idaccount']);\n $this->setName($data['name']);\n return true;\n }\n }", "protected function validateUrl($value){\n\t\treturn filter_var($value, FILTER_VALIDATE_URL) !== false;\n\t}", "public function check(string $url): bool\n\t{\n\t\t$url = mb_strtolower($url);\n\t\t$urlMd5 = md5(explode('//', $url)[1] ?? $url);\n\t\t$urlParts = parse_url($url);\n\t\t$domain = $urlParts['host'] ?? null;\n\n\t\tif (!$domain)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\n\t\t// check domain in white list\n\t\t$res = UrlCheckerWhitelistTable::getList([\n\t\t\t'filter' => [\n\t\t\t\t'=DOMAIN' => $domain\n\t\t\t],\n\t\t\t'limit' => 1\n\t\t]);\n\t\tif ($res->fetch())\n\t\t{\n\t\t\treturn true;\n\t\t}\n\n\t\t// check exists url\n\t\t$res = UrlCheckerStatusTable::getList([\n\t\t\t'select' => [\n\t\t\t\t'ID', 'STATUS'\n\t\t\t],\n\t\t\t'filter' => [\n\t\t\t\t'=HASH' => $urlMd5\n\t\t\t]\n\t\t]);\n\t\tif ($row = $res->fetch())\n\t\t{\n\t\t\tif ($row['STATUS'])\n\t\t\t{\n\t\t\t\t$this->saveHost($row['ID']);\n\t\t\t}\n\t\t\treturn !$row['STATUS'];\n\t\t}\n\n\t\t// new check\n\t\t$status = $this->getUrlStatus($url);\n\t\t$res = UrlCheckerStatusTable::add([\n\t\t\t'STATUS' => $status,\n\t\t\t'HASH' => $urlMd5,\n\t\t\t'URL' => $url\n\t\t]);\n\t\t// save host if status is bad\n\t\tif ($res->isSuccess() && $status)\n\t\t{\n\t\t\t$this->saveHost($res->getId());\n\t\t}\n\n\t\treturn $status === null;\n\t}", "private static function _url_is_valid($url) {\n // Consulted https://www.w3schools.com/Php/php_form_url_email.asp\n return preg_match(\"/\\b(?:(?:https?|ftp):\\/\\/|www\\.)[-a-z0-9+&@#\\/%?=~_|!:,.;]*[-a-z0-9+&@#\\/%=~_|]/i\", $url);\n }", "public function verifyContainsURL(): bool\n {\n $words = explode(' ', $this->input);\n foreach ($words as $word) {\n if (static::isValidURL($word)) {\n return true;\n }\n }\n \n return false;\n }", "function _mc_is_url( $url ) {\n\n\treturn preg_match( '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url );\n}", "private function isExternalUrl($url)\n {\n return preg_match('/{{.*}}/', $url);\n }" ]
[ "0.8412321", "0.82694304", "0.8186502", "0.81785977", "0.81164354", "0.8105718", "0.7988185", "0.79230607", "0.78769326", "0.78215384", "0.78013206", "0.7749806", "0.77096796", "0.76084083", "0.7569082", "0.7512232", "0.7510689", "0.7453848", "0.74467", "0.73903924", "0.7297648", "0.72926193", "0.7279051", "0.7274605", "0.7246964", "0.72467065", "0.71173644", "0.71173644", "0.7100179", "0.70711285", "0.7054748", "0.70364267", "0.70325303", "0.70101964", "0.6985165", "0.6968022", "0.69663614", "0.69405246", "0.6939826", "0.6899604", "0.68693966", "0.685881", "0.68575215", "0.68490183", "0.68314457", "0.68228763", "0.682271", "0.6814659", "0.6802745", "0.6796613", "0.6793778", "0.6787811", "0.6777638", "0.6774619", "0.6766885", "0.67614603", "0.67343247", "0.67274654", "0.6712288", "0.66834134", "0.6678579", "0.66642725", "0.66344696", "0.6622973", "0.66050804", "0.659718", "0.6593771", "0.65870297", "0.6525279", "0.65126765", "0.6502599", "0.64947677", "0.6479774", "0.64679366", "0.64652795", "0.645733", "0.644282", "0.6437269", "0.64248157", "0.6417741", "0.6411662", "0.64084435", "0.64032197", "0.63902324", "0.6385106", "0.6371808", "0.6368335", "0.6365095", "0.6362869", "0.63623124", "0.63600576", "0.63594913", "0.6358283", "0.63571125", "0.6353978", "0.6353212", "0.6343521", "0.6318479", "0.62959313", "0.62949157" ]
0.6545332
68
Return a specific attribute
private function getAttribute($attribute) { return isset($this->_data->{$attribute}) ? $this->_data->{$attribute} : ''; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getIdentifyingAttribute();", "public function get($attribute);", "public function getAttribute(string $attribute): string;", "public function getAttribute($attribute)\n {\n }", "public function getAttribute($attribute)\r\n\t{\r\n\t\t\r\n\t}", "public function readAttribute($attribute) {}", "public function getAttribute()\n {\n return $this->attribute;\n }", "public function getAttribute()\n {\n return $this->attribute;\n }", "public function __get($attribute)\n {\n if ( isset($this->attributes[$attribute]) ) return $this->attributes[$attribute];\n }", "public function getAttribute(): string\n {\n return $this->attribute;\n }", "function get_attribute($attribute)\n\t{\n\t\t$attribute = $this->db->getAttribute(constant(\"PDO::\".$attribute.\"\"));\n\n\t\treturn $attribute;\n\t}", "public function getAttribute($attribute)\n {\n return $this->{$attribute};\n }", "public function attr($attribute) {\n if (array_key_exists($attribute, $this->attributes)) {\n return $this->attributes[$attribute];\n } else {\n return 'PopShops API Error: Invalid attribute passed to ' . get_class($this) . '->attr: ' . $attribute;\n }\n }", "function get_atribute_by_attribute($attr_name,$attr_value,$exactly,$name_attr)\n {\n return $this->get_attribute_by_attribute($attr_name,$attr_value,$exactly,$name_attr);\n }", "public function __get($attribute)\n {\n return array_get($this->attributes, $attribute);\n }", "public function get_attribute($name)\n {\n }", "public function getAttribute($attribute)\n {\n return $this->attributes[$attribute];\n }", "public function getAttr(): string\r\n {\r\n return $this->attr;\r\n }", "public function __GET($attr){\n\n\t\t return $this->$attr;\n\t\t}", "public function getAttribute($name);", "public function get_attribute($field){\n\t\treturn $this->{$field};\n\t}", "public function get_attribute($key, $defaut = NULL);", "public function get($attributeName);", "abstract protected function getAttributeName($attribute);", "public function getAttrib() {\n return $this->attrib;\n }", "public function __get($attribute) {\n return $this->getAttribute($attribute);\n }", "public function getAttribute(string $name);", "public function attr() {\n\t\treturn utils::attr($this->attr, func_get_args());\n\t}", "public function getAttribute($name) {\n\t\tif (isset ( $this->$name ))\treturn $this->$name;\n\t}", "public function get($attr = null);", "public function read_attribute($attribute)\n\t\t{\n\t\t\tif(!isset($this->matchcode[$attribute]) )\n\t\t\t{\n\t\t\t\terror_log(__FILE__.' name '.$attribute.' not defined in matchcode array');die();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif($this->matchcode[$attribute][1] == 'A' || $this->matchcode[$attribute][1] == 'R')\n\t\t\t\t{\n\t\t\t\t\t$var = $this->matchcode[$attribute][0];\n\t\t\t\t\treturn $this->$var;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\terror_log(__FILE__.' name '.$attribute.' not readable');die();\n\t\t\t\t}\n\t\t\t}\n\t\t}", "public function get($attr) {\n return array_key_exists($attr, $this->_private_attributes) ? $this->_private_attributes[$attr] : null;\n }", "public function getAttribute($attribute) {\n\t\tif (!$this->attributes) {\n\t\t\t$this->attributes = tx_newspaper::selectOneRow(\n\t\t\t\t'*', tx_newspaper::getTable($this), $this->getCondition()\n\t\t\t);\n\t\t\t$this->setUid($this->attributes['uid']);\n\t\t}\n\n \t\tif (!array_key_exists($attribute, $this->attributes)) {\n \tthrow new tx_newspaper_WrongAttributeException($attribute);\n \t\t}\n \t\treturn $this->attributes[$attribute];\n \t}", "public function attribute(string $name) {\n\t\treturn $this->m_attributes[$name] ?? null;\n\t}", "abstract public function getAttribute($key);", "public function getAttribute($key);", "public function __get($name) {\n\t\tif ($this->hasAttribute($name))\n\t\t\treturn $this->_attributes[$name];\n\t\telse\n\t\t\treturn parent::__get($name);\n\t}", "function get_atribute_by_name($name,$name_attr)\n {\n return $this->get_attribute_by_name($name,$name_attr);\n }", "public function __attribute($name)\n {\n return $this->__attributes[$name];\n }", "public function __get($attribute)\r\n\t{\r\n\t\tif (isset($this->{\"_\".$attribute}))\r\n\t\t{\r\n\t\t\treturn $this->{\"_\".$attribute};\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "public function getAttribute($name) {\n\t\tif (property_exists($this, $name))\n\t\t\treturn $this->$name;\n\t\telse if ($this->hasAttribute($name))\n\t\t\treturn $this->_attributes[$name];\n\t}", "public function __get($attr)\n {\n return $this->get($attr);\n }", "public function getAttribute($name)\n\t{\n\t\tif(property_exists($this,$name))\n\t\t\treturn $this->$name;\n\t\telseif(isset($this->_attributes[$name])) {\n\t\t\treturn $this->_attributes[$name];\n\t\t}\n\t}", "public function readAttribute($attribute){\n\t\t#if[compile-time]\n\t\tCoreType::assertString($attribute);\n\t\t#endif\n\t\t$this->_connect();\n\t\treturn $this->$attribute;\n\t}", "public function getAttributeByName($attributeName);", "public function __get($attribute)\n\t{\n\t\tif (isset($this->{\"_\".$attribute}))\n\t\t{\n\t\t\treturn $this->{\"_\".$attribute};\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}", "function getAttribute($Model, $attribute_name) {\n extract($this->settings[$Model->alias]);\n\n return ($Model->{$with}->Attribute->find(\n 'first',\n array(\n 'fields' => array(\n 'Datatype.name',\n 'Datatype.table',\n 'Datatype.validation_proc',\n 'Datatype.format',\n 'Attribute.name',\n 'Attribute.id'\n ),\n 'conditions' => array(\n 'Attribute.name' => $attribute_name,\n ),\n 'recursive' => 0\n )\n )\n );\n }", "public function __get($attribute)\r\n {\r\n if ($attribute == 'tag') {\r\n return $this->attributes[0];\r\n }\r\n return array_key_exists($attribute, $this->attributes) ? $this->attributes[$attribute] : null;\r\n }", "function get_attribute( $key ) {\n\t\treturn isset( $this->attributes[$key] ) ? $this->attributes[$key] : null;\n\t}", "public function getAttribute($attribute) {\n\t\tif (!isset($this->{$attribute})) {\n\t\t\treturn null;\n\t\t}\n\t\treturn $this->{$attribute};\n\t}", "public function getAttribute($attribute) {\n\t\tif (!isset($this->{$attribute})) {\n\t\t\treturn null;\n\t\t}\n\t\treturn $this->{$attribute};\n\t}", "public function getAttribute($attribute) {\n\t\tif (!isset($this->{$attribute})) {\n\t\t\treturn null;\n\t\t}\n\t\treturn $this->{$attribute};\n\t}", "public function getAttribute($attribute) {\n\t\tif (!isset($this->{$attribute})) {\n\t\t\treturn null;\n\t\t}\n\t\treturn $this->{$attribute};\n\t}", "public function __get($atrib){\n\t\treturn $this->$atrib;\n\t}", "public function getAttribute($type)\n {\n return $this->attributes[$type];\n }", "public function getCustomAttributesAttribute()\n {\n return $this->custom_attributes()->get();\n }", "public function get_attribute($key) {\n\t\treturn array_get($this->attributes, $key);\n\t}", "public function getAttribute($name)\n {\n if (in_array($name, static::$fields)) {\n return $this->attributes[$name];\n }\n }", "public function attr($key) {\n\t\treturn isset($this->attributes[$key]) ? $this->attributes[$key] : null;\n\t}", "public function getAttribute($name)\r\n\t{\r\n\t\treturn $this->__get($name);\r\n\t}", "private function getAttributeValue($attribute)\n {\n return array_key_exists($attribute, $this->data) ? $this->data[$attribute] : null;\n }", "public function get($attr) {\n if (!isset($this->attrs[$attr])) {\n return null;\n }\n return $this->attrs[$attr];\n }", "public function __get($name)\n {\n return $this->attributes[$name];\n }", "public function getAttribute($attribute)\n\t{\n\t\tif(isset($this->attributes[$attribute]))\n\t\t\treturn $this->attributes[$attribute];\n\n\t\treturn null;\n\t}", "public function getAttribute($attribute)\n {\n $attributes = $this->xml_value_[0][\"attributes\"];\n return $attributes[$attribute];\n }", "protected function getAttribute($attribute)\n {\n if (isset( $this->customAttributes[$attribute] )) {\n return $this->customAttributes[$attribute];\n }\n\n $key = \"validation.attributes.{$attribute}\";\n\n if (( $line = trans($key) ) !== $key) {\n return $line;\n } else {\n return str_replace('_', ' ', snake_case($attribute));\n }\n }", "public function __get($name)\n\t{\n\t\tif(array_key_exists($name, $this->_attributes))\n\t\t\treturn $this->_attributes[$name];\n\t\telse\n\t\t\treturn parent::__get($name);\n\t}", "public function __get($attr)\n {\n if (isset($this->{$attr})) {\n return $this->{$attr};\n } elseif (method_exists($this, 'get'.camel_case($attr).'Attribute')) {\n $methodName = camel_case('get_'.$attr.'Attribute');\n\n return $this->$methodName();\n }\n }", "public function getSRAttribute($attribute)\n {\n return $this->$attribute;\n }", "function attribute($pid, $attribute, $query = array()) {\n \t\tif ($json = $this->_get('/merchants/'.$pid.'/'.$attribute.'.json', $query)) {\n \t\t\t$obj = $this->_parseApi($json);\n \t\t\treturn ( is_object($obj) && isset($obj->merchant->$attribute) )\n \t ? $obj->merchant->$attribute\n \t : false;\n \t\t} else {\n \t\t\treturn false;\n \t\t}\n \t}", "public function __get($attr)\n\t{\n\t\t$functionName = \"get\".$attr;\n\t\treturn $this->$functionName();\n\t}", "public function attribute($id, $name)\n\t{\n\t\treturn $this->connection()->get(\"element/$id/attribute/$name\");\n\t}", "public function findAttrByName ($strAttrId){}", "public function getAttr(string $key) {\n return (array_key_exists($key, $this->attributes) ? $this->attributes[$key] : null);\n }", "public function getAttribute(): string|null\n {\n return $this->attribute;\n }", "function __get($attributeAskedFor) {\n echo \"Asked for \" . $attributeAskedFor . \"<br>\";\n return $this->$attributeAskedFor;\n }", "public function get($name): Attribute {\n $name = str_replace([\"-\", \" \"], \"_\", strtolower($name));\n if (isset($this->attributes[$name])) {\n return $this->attributes[$name];\n }\n\n return new Attribute($name);\n }", "public function getAttribute($key)\n {\n return $this->attributes[$key];\n }", "public function getAttrMetadata($attr){\n\t\treturn @$this->_atributosMetadata[$attr->attrName];\n\t}", "public function getAttr1(){\r\n\t\treturn $this->attr1;\r\n\t}", "function getAttributes()\n {\n }", "function __get($attribute)\n {\n if(method_exists($this,$attribute)){\n return $this->{$attribute}();\n }\n return $this->model->{$attribute};\n }", "public function getAttribute($attr_name)\n {\n return false === $this->hasAttribute($attr_name) ? null : $this->attributes[$attr_name];\n }", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttributes();", "public function getAttribute()\r\n {\r\n return $this->getElement()->getEntityAttribute();\r\n }", "public function __get($atributo){\n\t\treturn $this->$atributo;\n\t}", "function attribute($text) {\n\t\treturn $this->text($text);\n\t}", "public function getAttribute($name, $inherited = true) {}", "function getAttribute($attribute)\n {\n $this->_attributeDTD->toAttributeInt($attribute);\n }", "public function getValue(string $attr)\n {\n $this->checkAttribute($attr);\n return $this->attributes[$attr];\n }", "function getAttribute($attrib, $tag){\r\n //get attribute from html tag\r\n $re = '/' . preg_quote($attrib) . '=([\\'\"])?((?(1).+?|[^\\s>]+))(?(1)\\1)/is';\r\n if (preg_match($re, $tag, $match)) {\r\n\t return $match[2];\r\n }\r\n return false;\r\n}", "public function getAttribute($attr, $return_if_null = NULL)\r\n\t{\r\n\t\tif ( ! isset($this->attr[$attr]))\r\n\t\t\treturn $return_if_null;\r\n\t\t\r\n\t\tif (isset($this->attr[$attr]) && strtolower($this->attr[$attr]) == 'true')\r\n\t\t\treturn TRUE;\r\n\t\t\r\n\t\treturn (isset($this->attr[$attr]) && strtolower($this->attr[$attr]) != 'false') ? $this->attr[$attr] : FALSE;\r\n\t}" ]
[ "0.7967078", "0.7923695", "0.78670603", "0.7857419", "0.78026295", "0.7565481", "0.7512786", "0.7512786", "0.74653256", "0.7453992", "0.7447422", "0.74411756", "0.7416943", "0.73885655", "0.73750514", "0.7374862", "0.7345002", "0.7329161", "0.7328028", "0.7316482", "0.7300801", "0.72717595", "0.72452444", "0.71995807", "0.7191004", "0.71893483", "0.7185116", "0.7151226", "0.7141414", "0.7122093", "0.7113392", "0.7107649", "0.7094398", "0.70580727", "0.7050304", "0.7016877", "0.69994676", "0.699944", "0.6998572", "0.69630337", "0.6942675", "0.6937239", "0.69369376", "0.6928887", "0.6922942", "0.6906577", "0.6899519", "0.6898934", "0.6882352", "0.6879146", "0.6879146", "0.6879146", "0.6879146", "0.6876354", "0.6875072", "0.68737215", "0.68569434", "0.68386126", "0.6826063", "0.6815933", "0.67919594", "0.6755005", "0.67521787", "0.67445433", "0.6744054", "0.6738097", "0.6737448", "0.6735023", "0.6718217", "0.6712268", "0.6695939", "0.6690755", "0.6688446", "0.6668075", "0.66646427", "0.66551566", "0.6646132", "0.6641335", "0.66324276", "0.66301763", "0.6626944", "0.6597098", "0.6596782", "0.65830964", "0.65830964", "0.65830964", "0.65830964", "0.65830964", "0.65830964", "0.65830964", "0.65830964", "0.65830964", "0.6567228", "0.65658116", "0.6563027", "0.65574044", "0.65570956", "0.65517014", "0.65461713", "0.65451664" ]
0.7141839
28
/ | | Common attributes | Iframe code to embed video
public function embed() { if (empty($this->_videoId)) { return ''; } return '<iframe width="100%" height="'.$height.'" src="//www.youtube.com/embed/'.$this->_videoId.'" frameborder="0" allowfullscreen></iframe>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function neu_custom_iframe_video(){\n\t// get iframe HTML\n\t$iframe = get_field('video');\n\n\n\t// use preg_match to find iframe src\n\tpreg_match('/src=\"(.+?)\"/', $iframe, $matches);\n\t$src = $matches[1];\n\n\n\t// add extra params to iframe src\n\t$params = array(\n\t /*'controls' => 0,*/\n\t 'hd' => 1,\n\t 'autoplay' => 0,\n\t 'rel' \t=> 0,\n\t);\n\n\t$new_src = add_query_arg($params, $src);\n\n\t$iframe = str_replace($src, $new_src, $iframe);\n\n\n\t// add extra attributes to iframe html\n\t$attributes = 'frameborder=\"0\"';\n\n\t$iframe = str_replace('></iframe>', ' ' . $attributes . '></iframe>', $iframe);\n\n\treturn $iframe;\n}", "public function embed_video() {\r\n\t\tglobal $wp_embed;\r\n\t\treturn $wp_embed->run_shortcode( '[embed]'. $this->video .'[/embed]' );\r\n\t}", "public function Iframe () {\r\n\t\t$id = $this->id;\r\n\t\t$cookie_or_not = 'www.youtube.com';\r\n\t\tif($this->iframe_param[\"cookies\"] == 0 || $this->iframe_param[\"cookies\"] == false) {\r\n\t\t\t$cookie_or_not = \"www.youtube-nocookie.com\";\r\n\t\t}\r\n\t\treturn '<iframe style=\"width:'.$this->iframe_param[\"width\"].'; height:'.$this->iframe_param[\"height\"].';\" src=\"https://'.$cookie_or_not.'/embed/'.$id.'?rel='.$this->iframe_param[\"rel\"].'&controls='.$this->iframe_param[\"controls\"].'&showinfo='.$this->iframe_param[\"showinfo\"].'&autoplay='.$this->iframe_param[\"autoplay\"].'&color='.$this->iframe_param[\"color\"].'&start='.$this->iframe_param[\"start\"].'&modestbranding='.$this->iframe_param[\"modestbranding\"].'&fs='.$this->iframe_param[\"fs\"].'&cc_load_policy'.$this->iframe_param[\"cc_load_policy\"].'\" frameborder=\"0\" allowfullscreen></iframe>';\r\n\t}", "function idaho_iframe_func( $atts, $content = '' ) {\n\n\t/** Returnable html string. */\n\t$video = (string) '';\n\n\t/** Convert $atts to $params. Merge with defaults. */\n\t$params = (array) shortcode_atts( array(\n\t\t'url' \t\t=> 'https://www.youtube.com/watch?v=DPBU2SOSC5c',\n\t\t'aspect' \t=> '16by9',\n\t), $atts );\n\n\n\t$video .= sprintf('<iframe src=\"%2$s\" allowfullscreen style=\"width:100%\"></iframe>',\n\t\tesc_attr( $params['aspect'] ),\n\t\tesc_url( $params['url'] )\n\t);\n\n\t/** Strip out new lines to avoid auto <p>s. */\n\treturn $video;\n}", "function the_embed_video( $video_embed_code, $width = 500, $height = 281 ) {\n\techo get_embed_video( $video_embed_code, $width, $height );\n}", "function iframevideoShortcode( $atts, $content = null, $tag = '' ){\n\t$atts = array_change_key_case( (array)$atts, CASE_LOWER );\n\n\t$output = '<div class=\"iframe-video-wrapper\">' . $content . '</div>';\n\treturn $output;\n}", "function pavi_shortcode_video($atts = array()){\n \n return pavi_get_display_video($atts);\n}", "function get_embed_video( $video_embed_code, $width = 500, $height = 281 ) {\n\tif ( strpos( $video_embed_code, 'vimeo' ) !== false ) {\n\t\t$src = get_embed_video_src( $video_embed_code );\n\n\t\treturn \"<iframe src=\\\"$src?color=ffffff&amp;title=0&amp;byline=0&amp;portrait=0\\\" width=\\\"$width\\\" height=\\\"$height\\\" frameborder=\\\"0\\\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>\";\n\t} else {\n\t\treturn $video_embed_code;\n\t}\n}", "function crumble_video($atts, $content = null) {\r\n\t\textract ( shortcode_atts(\r\n\t\t\tarray(\r\n\t\t\t\t'id' => '',\r\n\t\t\t\t'type' => '',\r\n\t\t\t\t'width' => '',\r\n\t\t\t\t'height' => '220'\r\n\t\t\t), $atts ) );\r\n\t\t\r\n\r\n\r\n\r\n\t\t\tif( $type == 'youtube' ) { \r\n\t\t\t\t$code = '<iframe width=\"' . $width . '\" height=\"' .$height . '\" src=\"http://www.youtube.com/embed/'. $id . '\" frameborder=\"0\" allowfullscreen></iframe>';\r\n\t\t\t} \r\n\t\t\t\r\n\t\t\tif( $type == 'vimeo') { \r\n\t\t\t\t$code = '<iframe src=\"http://player.vimeo.com/video/' . $id . '?title=0&amp;byline=0&amp;portrait=0&amp;color=ba0d16\" width=\"' . $width . '\" height=\"' . $height . '\"></iframe>';\r\n\t\t\t} \r\n\t\t\t\r\n\t\t\tif($type == 'dailymotion') { \r\n\t\t\t\t$code = '<iframe width=\"' . $width . '\" height=\"' . $height . '\" src=\"http://www.dailymotion.com/embed/video/'. $id . '?logo=0\"></iframe>';\r\n\t\t\t } \r\n\t\t\t \r\n\t\t$code = '<div class=\"video-frame\">' . $code . '</div>';\r\n\r\n\t\t\t\r\n\t\treturn $code;\r\n\t}", "function quasar_embed_video($url=null){\n\tif(!$url) return;\n\t\n\t$iframe_code = '';\n\t\n\tif(strpos($url, 'youtube') > -1){\n\t\t$iframe_code = str_replace('watch?v=', 'embed/', $url).'?rel=0';\n\t}\n\t\n\tif(strpos($url, 'vimeo') > -1){\n\t\t$iframe_code = str_replace('vimeo.com', 'player.vimeo.com/video', $url);\n\t}\n\t\n\t$return = '\n\t<div class=\"quasar-iframe-container\">\n <iframe src=\"'.$iframe_code.'\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>\n\t</div>\n\t';\n\t\n\treturn $return;\n}", "function add_player_id_to_iframe( $vmhtml, $vmurl, $vmargs ) {\n if( isset( $vmargs['player_id'] ) ) {\n $vmhtml = str_replace( '<iframe', '<iframe id=\"'. $vmargs['player_id'] .'\"', $vmhtml );\n }\n return $vmhtml;\n}", "function wp_embed_handler_video($matches, $attr, $url, $rawattr)\n {\n }", "function modify_vimeo_embed_url( $html ) {\n\t\n\t// GET HTML\n\tpreg_match('/src\\s*=\\s*\"(.+?)\"/', $html, $src);\n\t\n\t// OPTIONS\n\t$params .= '&autoplay=1';\n\t$params .= '&background=1';\n\t$params .= '&api=1';\n\t\n\t// RETURN HTML\n\t$html = '<iframe src=\"' . $src[1] . $params . '\" frameborder=\"0\" allow=\"loop autoplay fullscreen\" allowfullscreen></iframe>';\n\t\n\treturn $html;\n}", "function emc_video() {\r\n\r\n\t// get the URL field\r\n\t$url = get_field( 'url' );\r\n\tif ( empty( $url ) ) {\r\n\t\t_e( '<em>URL field is empty.</em>', 'emc' );\r\n\t\treturn false;\r\n\t}\r\n\r\n\tif ( strpos( $url, 'rackcdn.com' ) ) {\r\n\r\n\t\t// get the URL for the medium featured image, to serve as video poster\r\n\t\t$thumb_id = get_post_thumbnail_id( get_the_ID() );\r\n\t\t$thumb_src = wp_get_attachment_image_src( $thumb_id, 'large' );\r\n\r\n\t\t// assemble our EMC RackSpace HTML5 video embed with Flash fallback\r\n\t\t$shortcode = sprintf( '[video mp4=\"%1$s\" poster=\"%2$s\" width=\"%3$s\" height=\"%4$s\"]',\r\n\t\t\tesc_url( $url ),\r\n\t\t\tesc_attr( $thumb_src[0] ),\r\n\t\t\t'100%',\r\n\t\t\t'auto'\r\n\t\t);\r\n\r\n\t\t$video = do_shortcode( $shortcode );\r\n\r\n\t} else {\r\n\r\n\t\t// we have something other than RackSpace for a video link\r\n\t\t$video = wp_oembed_get( esc_url( get_field( 'url' ) ) );\r\n\r\n\t}\r\n\r\n\t// Determine the duration\r\n\t$duration = ( get_field( 'duration' ) ) ? get_field( 'duration' ) : __( 'Not specified', 'emc' );\r\n\t$duration = sprintf( __( 'Duration: %s', 'emc' ), esc_html( $duration ) );\r\n\r\n\t// Get help text\r\n\t$help = get_page_by_path( 'video-problems-text', OBJECT, 'post' );\r\n\r\n\t// Assemble our final HTML\r\n\t$html = '<div class=\"emc-video\">';\r\n\t$html .= $video;\r\n\t$html .= '<div class=\"emc-toggle-section emc-video-meta\">';\r\n\t$html .= '<span class=\"emc-video-duration\">' . esc_html( $duration ) . '</span>';\r\n\t$html .= '<a class=\"emc-toggle-link\">' . esc_html__( 'Having video problems?', 'emc' ) . '</a>';\r\n\t$html .= '<div class=\"emc-toggle-content\">';\r\n\t$html .= apply_filters( 'the_content', $help->post_content );\r\n\t$html .= '</div><!-- .emc-toggle-content -->';\r\n\t$html .= '</div><!-- .emc-video-meta -->';\r\n\t$html .= '</div><!-- .emc-video -->';\r\n\r\n\techo $html;\r\n\r\n}", "public function embedAction() {\n\n //GET SUBJECT (EITHER VIDEO TYPE OR SITEREVIEW_VIDEO TYPE)\n $this->view->video = $video = Engine_Api::_()->core()->getSubject();\n\n //CHECK THAT EMBEDDING IS ALLOWED OR NOT\n if (!Engine_Api::_()->getApi('settings', 'core')->getSetting('sitereview_video.embeds', 1)) {\n $this->view->error = 1;\n return;\n } else if (isset($video->allow_embed) && !$video->allow_embed) {\n $this->view->error = 2;\n return;\n }\n\n //GET EMBED CODE\n $this->view->embedCode = $video->getEmbedCode();\n }", "function sp_video_youtube_sc( $atts ) {\n\n\textract( shortcode_atts( array(\n\t\t'id' => '',\n\t), $atts ) );\n\n\tglobal $post;\n\n\t$output = '<div class=\"entry-video\">';\n\t$output .= '<iframe width=\"600\" height=\"338\" src=\"http://www.youtube.com/embed/'.$id.'?rel=0\" frameborder=\"0\" allowfullscreen></iframe>';\n\t$output .= '</div>';\n\t\n\treturn $output;\n}", "function video_cck_dailymotion_video($embed, $width, $height, $field, $item, $autoplay) {\n $output = theme('video_cck_dailymotion_flash', $embed, $width, $height, $autoplay);\n return $output;\n}", "function create_embedcode($video_url, $width = 440, $height = 350) {\n\t$actual_file = get_youtube_video($video_url);\n\tif (!$width || !is_numeric($width)) {\n\t\t$width = 440;\n\t}\n\tif (!$height || !is_numeric($height)) {\n\t\t$height = 350;\n\t}\n\treturn '<object width=\"' . $width . '\" height=\"' . $height . '\"><param name=\"movie\" value=\"' . $actual_file . '\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"' . $actual_file . '\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"' . $width . '\" height=\"' . $height . '\"></embed></object>';\n}", "private function youku_video() {\n\t\twp_embed_register_handler( 'embed_handler_youku', '#http://v.youku.com/v_show/id_(.*?).html#i', function($matches, $attr, $url, $rawattr){\n\t\t\t// error_log(print_r($matches, true));error_log(print_r($attr, true));error_log(print_r($url, true));error_log(print_r($rawattr, true));\n\n\t\t\t$src = 'http://player.youku.com/embed/' . $matches[1];\n\n\t\t\tif ( !empty($rawattr['width']) && !empty($rawattr['height']) ) {\n\t\t\t\t$width = (int) $rawattr['width'];\n\t\t\t\t$height = (int) $rawattr['height'];\n\t\t\t} else {\n\t\t\t\tlist( $width, $height ) = wp_expand_dimensions( 622, 350, $attr['width'], $attr['height'] );\n\t\t\t}\n\n\t\t\t$html = '<div class=\"embed-responsive embed-responsive-16by9\"><iframe height=' . esc_attr($height) . ' width=' . esc_attr($width) . ' src=\"' . esc_attr($src) . '\" frameborder=0 allowfullscreen></iframe></div>';\n\n\t\t\treturn apply_filters( 'embed_youku', $html, $matches, $attr, $url, $rawattr);\n\t\t});\n\t}", "function psa_youtube_embed( $id, $iframe_args = array(), $youtube_args = array() ) {\n\t$iframe_defaults = array(\n\t\t'class' => 'video',\n\t\t'width' => 640,\n\t\t'height' => 360,\n\t\t'responsive' => false\n\t);\n\t$iframe_args = wp_parse_args( $iframe_args, $iframe_defaults );\n\textract( $iframe_args, EXTR_SKIP );\n\n\t$youtube_defaults = array(\n\t\t'autoplay' => 1,\n\t\t'rel' => 0,\n\t\t'origin' => get_bloginfo('url')\n\t);\n\t$youtube_args = wp_parse_args( $youtube_args, $youtube_defaults );\n\t$youtube_args = http_build_query( $youtube_args );\n\n\t$dimensions = ( $responsive ) ? '' : 'width=\"' . $width . '\" height=\"' . $height . '\"';\n\n\t// iFrame embed\n\tprintf('<iframe type=\"text/html\" class=\"%s\" %s src=\"https://www.youtube.com/embed/%s?%s\" frameborder=\"0\"></iframe>', $class, $dimensions, $id, $youtube_args );\n}", "function video_cck_dailymotion_embedded_link($video_code) {\n return 'http://www.dailymotion.com/swf/'. $video_code;\n}", "function mars_video_meta() {}", "function mmc_dash_help_widget(){\n\t?>\n\t<iframe width=\"350\" height=\"250\" src=\"https://www.youtube.com/embed/x7R2HcTAyjI\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n\t<?php\n}", "public function embedCode() : string\n {\n switch ($this->platform) {\n case 'soundcloud':\n $response = Http::accept('application/json')\n ->get(\"https://soundcloud.com/oembed?url={$this->url}&maxheight=370&show_comments=false\");\n return $response->json('html');\n break;\n \n case 'youtube':\n $queryString = parse_url($this->url, PHP_URL_QUERY);\n preg_match('/v=([a-z0-9_\\-]+)/i', $queryString, $matches);\n \n return '<iframe id=\"ytplayer\" type=\"text/html\" width=\"640\" height=\"360\"\n src=\"https://www.youtube.com/embed/'.$matches[1].'\"\n frameborder=\"0\" allowfullscreen=true></iframe>';\n break;\n \n default:\n return '<a href=\"'.$this->url.'\" target=\"_blank\">'.$this->url.'</a>';\n break;\n }\n }", "function vcex_video_oembed( $video = '', $classes = '', $params = array() ) {\n\tif ( function_exists( 'wpex_video_oembed' ) ) {\n\t\treturn wpex_video_oembed( $video, $classes, $params );\n\t}\n\treturn wp_oembed_get( $video );\n}", "function YouTube($atts, $content = null) {\r\n\t\t$height = get_option(\"kwheight\");\r\n\t\t$width = get_option(\"kwwidth\");\r\n extract(shortcode_atts(array( \"id\" => '' ), $atts));\r\n\t\treturn '<div id=\"video\"><iframe width=\"'.$width.'\" height=\"'.$height.'\" src=\"http://www.youtube.com/embed/'.$id.'\" frameborder=\"0\" allowfullscreen></iframe></div>';}", "function custom_youtube_oembed( $code ) {\n if( stripos( $code, 'youtube.com' ) !== FALSE && stripos( $code, 'iframe' ) !== FALSE )\n $code = str_replace( '<iframe', '<iframe class=\"content-video\" type=\"text/html\" ', $code );\n\n return $code;\n}", "function wp_embed_handler_googlevideo($matches, $attr, $url, $rawattr)\n {\n }", "function envolve_embed($html, $url, $attr, $post_id) {\n return '<div class=\"video\">' . $html . '</div>';\n}", "function envolve_embed($html, $url, $attr, $post_id) {\n return '<div class=\"video\">' . $html . '</div>';\n}", "function ibio_youtube_embed($code){\n\t//error_log( '[ibio_youtube_embed With ' . $code );\n\tif(strpos($code, 'youtu.be') !== false || strpos($code, 'youtube.com') !== false){\n\t\t$return = preg_replace(\"@src=(['\\\"])?([^'\\\">\\s]*)@\", \"src=$1$2&showinfo=0\", $code);\n\t\t//error_log( '[ibio_youtube_embed return ' . $return );\n\t\treturn $return;\n\t}\n\treturn $code;\n}", "function dm_brightcove_embed_shortcode($atts) {\n\textract(shortcode_atts(array(\n\t\t'width' => 400,\n\t\t'height' => 220,\n\t\t'player_id' => '1083378382001',\n\t\t'player_key' => 'AQ~~,AAAA7SJlvPE~,hKj__M4BL26l6pXW6JlVCmbP5q8je1e_',\n\t\t'video_id' => ''\n\t), $atts));\n\n\tob_start();\n?>\n\t<div class=\"brightcove_video\">\n\t\t<script src=\"http://admin.brightcove.com/js/BrightcoveExperiences.js\"></script>\n\t\t<object id=\"myExperience<?php echo $video_id; ?>\" class=\"BrightcoveExperience\">\n\t\t\t<param name=\"bgcolor\" value=\"#FFFFFF\" />\n\t\t\t<param name=\"width\" value=\"<?php echo $width; ?>\" />\n\t\t\t<param name=\"height\" value=\"<?php echo $height; ?>\" />\n\t\t\t<param name=\"playerID\" value=\"<?php echo $player_id; ?>\" />\n\t\t\t<param name=\"playerKey\" value=\"<?php echo $player_key; ?>\" />\n\t\t\t<param name=\"isVid\" value=\"true\" />\n\t\t\t<param name=\"isUI\" value=\"true\" />\n\t\t\t<param name=\"dynamicStreaming\" value=\"true\" />\n\t\t\t<param name=\"@videoPlayer\" value=\"<?php echo $video_id; ?>\" />\n\t\t</object>\n\t\t<script>\n\t\t\tbrightcove.createExperiences();\n\t\t</script>\n\t</div>\n<?php\n\t$output = ob_get_clean();\n\treturn $output;\n}", "function sp_add_video ($url, $width = 620, $height = 349) {\n\t\n\t$video_url = @parse_url($url);\n\n\tif ( $video_url['host'] == 'www.youtube.com' || $video_url['host'] == 'youtube.com' ) {\n\t\tparse_str( @parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars );\n\t\t$video = $my_array_of_vars['v'] ;\n\t\t$output .='<iframe width=\"'.$width.'\" height=\"'.$height.'\" src=\"http://www.youtube.com/embed/'.$video.'?rel=0\" frameborder=\"0\" allowfullscreen></iframe>';\n\t}\n\telseif( $video_url['host'] == 'www.youtu.be' || $video_url['host'] == 'youtu.be' ){\n\t\t$video = substr(@parse_url($url, PHP_URL_PATH), 1);\n\t\t$output .='<iframe width=\"'.$width.'\" height=\"'.$height.'\" src=\"http://www.youtube.com/embed/'.$video.'?rel=0\" frameborder=\"0\" allowfullscreen></iframe>';\n\t}\n\telseif( $video_url['host'] == 'www.vimeo.com' || $video_url['host'] == 'vimeo.com' ){\n\t\t$video = (int) substr(@parse_url($url, PHP_URL_PATH), 1);\n\t\t$output .='<iframe src=\"http://player.vimeo.com/video/'.$video.'\" width=\"'.$width.'\" height=\"'.$height.'\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';\n\t}\n\telseif( $video_url['host'] == 'www.dailymotion.com' || $video_url['host'] == 'dailymotion.com' ){\n\t\t$video = substr(@parse_url($url, PHP_URL_PATH), 7);\n\t\t$video_id = strtok($video, '_');\n\t\t$output .='<iframe frameborder=\"0\" width=\"'.$width.'\" height=\"'.$height.'\" src=\"http://www.dailymotion.com/embed/video/'.$video_id.'\"></iframe>';\n\t}\n\t\n\treturn $output;\n}", "function get_embed_video_src( $video_embed_code ) {\n\tpreg_match( '/src=\"(.+?)\"/', $video_embed_code, $matches );\n\n\treturn $matches[1];\n}", "function sc_iframe($attr, $content=null){\n\n\t$iframe_src = ( isset( $attr['src'] ) ) ? $attr['src'] : null;\n\t$iframe_height = ( isset( $attr['height'] ) ) ? $attr['height'] : 400;\n\t$iframe_width = ( isset( $attr['width'] ) ) ? $attr['width'] : 550;\n\t$iframe_style = ( isset( $attr['style'] ) ) ? $attr['style'] : null;\n\t$iframe_class = ( isset( $attr['class'] ) ) ? $attr['class'] : null;\n\n\tob_start();\n\t?>\n\n\t<iframe src=\"<?php echo $iframe_src; ?>\" frameborder=\"0\" height=\"<?php echo $iframe_height; ?>\" width=\"<?php echo $iframe_width; ?>\"<?php\n\n\tif ($iframe_style) {\n\t\techo 'style=\"' . $iframe_style . '\" ';\n\t}\n\n\tif ($iframe_class) {\n\t\techo ' class=\"' . $iframe_class . '\" ';\n\t}\n\n\t?>></iframe>\n\n\t<?php\n\t$html = ob_get_clean();\n\n\treturn $html;\n}", "function emvideo_dotsub_video($embed, $width, $height, $field, $item, $node, $autoplay) {\n $output = theme('emvideo_dotsub_flash', $item, $width, $height, $autoplay);\n return $output;\n}", "function bnk_video($postid) {\r\n\r\n\t$video_url = get_post_meta($postid, 'bnk_video_url', true);\r\n\r\n\tif(preg_match('/youtube/', $video_url)) {\r\n\r\n\t\tif(preg_match('/[\\\\?\\\\&]v=([^\\\\?\\\\&]+)/', $video_url, $matches)) {\r\n\t\t\t$output = '<iframe title=\"YouTube video player\" class=\"youtube-player\" type=\"text/html\" width=\"645\" height=\"514\" src=\"http://www.youtube.com/embed/'.$matches[1].'\" frameborder=\"0\" allowFullScreen></iframe>';\r\n\t\t}\r\n\t\telse {\r\n\t\t\t$output = __('Invalid <strong>Youtube</strong> URL.', 'bhinneka');\r\n\t\t}\r\n\r\n\t}\r\n\telseif(preg_match('/vimeo/', $video_url)) {\r\n\r\n\t\tif(preg_match('~^http://(?:www\\.)?vimeo\\.com/(?:clip:)?(\\d+)~', $video_url, $matches))\t{\r\n\t\t\t$output = '<iframe src=\"http://player.vimeo.com/video/'.$matches[1].'\" width=\"645\" height=\"363\" frameborder=\"0\"></iframe>';\r\n\t\t}\r\n\t\telse {\r\n\t\t\t$output = __('Invalid <strong>Vimeo</strong> URL.', 'bhinneka');\r\n\t\t}\r\n\r\n\t}\r\n\telse {\r\n\t\t$output = stripslashes(htmlspecialchars_decode($video_url));\r\n\t}\r\n\techo $output;\r\n}", "function video_cck_tudou_video($embed, $width, $height, $field, $item, $autoplay) {\n $output = theme('video_cck_tudou_flash', $embed, $width, $height, $autoplay);\n return $output;\n}", "function grve_print_media_video( $video_mode, $video_webm, $video_mp4, $video_ogv, $video_embed ) {\n\tglobal $wp_embed;\n\t$video_output = '';\n\n\tif( empty( $video_mode ) && !empty( $video_embed ) ) {\n\t\t$video_output .= '<div class=\"grve-media\">';\n\t\t$video_output .= $wp_embed->run_shortcode( '[embed]' . $video_embed . '[/embed]' );\n\t\t$video_output .= '</div>';\n\t} else {\n\n\t\tif ( !empty( $video_webm ) || !empty( $video_mp4 ) || !empty( $video_ogv ) ) {\n\t\t\t$video_output .= '<div class=\"grve-media\">';\n\t\t\t$video_output .= ' <video controls>';\n\n\t\t\tif ( !empty( $video_webm ) ) {\n\t\t\t\t$video_output .= '<source src=\"' . $video_webm . '\" type=\"video/webm\">';\n\t\t\t}\n\t\t\tif ( !empty( $video_mp4 ) ) {\n\t\t\t\t$video_output .= '<source src=\"' . $video_mp4 . '\" type=\"video/mp4\">';\n\t\t\t}\n\t\t\tif ( !empty( $video_ogv ) ) {\n\t\t\t\t$video_output .= '<source src=\"' . $video_ogv . '\" type=\"video/ogg\">';\n\t\t\t}\n\t\t\t$video_output .=' </video>';\n\t\t\t$video_output .= '</div>';\n\n\t\t}\n\t}\n\n\techo $video_output;\n\n}", "function wp_sm_secure_s3_video( $atts ) {\n\t$atts = shortcode_atts( array(\n\t\t'url' => ''\n\t), $atts, 's3_secure_video' );\n \n $base64_url = base64_encode($atts['url']);\n \n $secure_url = wp_sm_get_secure_s3_url($base64_url);\n\n return do_shortcode(\"[video src=\\\"$secure_url\\\" ]\");\n \n}", "function df_get_video_embed($vurl,$width,$height){\r\n $image_url = parse_url($vurl);\r\n // Test if the link is for youtube\r\n if($image_url['host'] == 'www.youtube.com' || $image_url['host'] == 'youtube.com'){\r\n $array = explode(\"&\", $image_url['query']);\r\n return '<iframe src=\"http://www.youtube.com/embed/' . substr($array[0], 2) . '?wmode=transparent\" frameborder=\"0\" width=\"'.$width.'\" height=\"'.$height.'\" allowfullscreen></iframe>'; // Returns the youtube iframe embed code\r\n // Test if the link is for the shortened youtube share link\r\n } else if($image_url['host'] == 'www.youtu.be' || $image_url['host'] == 'youtu.be'){\r\n $array = ltrim($image_url['path'],'/');\r\n return '<iframe src=\"http://www.youtube.com/embed/' . $array . '?wmode=transparent\" frameborder=\"0\" width=\"'.$width.'\" height=\"'.$height.'\" allowfullscreen></iframe>'; // Returns the youtube iframe embed code\r\n // Test if the link is for vimeo\r\n } else if($image_url['host'] == 'www.vimeo.com' || $image_url['host'] == 'vimeo.com'){\r\n $hash = substr($image_url['path'], 1);\r\n return '<iframe src=\"http://player.vimeo.com/video/' . $hash . '?title=0&byline=0&portrait=0\" width=\"'.$width.'\" height=\"'.$height.'\" frameborder=\"0\" webkitAllowFullScreen allowfullscreen></iframe>'; // Returns the vimeo iframe embed code\r\n }\r\n}", "function sp_video_sc( $atts ) {\n\n\textract( shortcode_atts( array(\n\t\t'mp4' => '',\n\t\t'webm' => '',\n\t\t'ogg' => '',\n\t\t'track' => '',\n\t\t'poster' => '',\n\t\t'aspect_ratio' => '1.7',\n\t\t'preload' => false,\n\t\t'autoplay' => false,\n\t), $atts ) );\n\n\tglobal $post;\n\n\tif ( $mp4 )\n\t\t$mp4 = '<source src=\"' . $mp4 . '\" type=\"video/mp4\" />';\n\n\tif ( $webm )\n\t\t$webm = '<source src=\"' . $webm . '\" type=\"video/webm\" />';\n\n\tif ( $ogg )\n\t\t$ogg = '<source src=\"' . $ogg . '\" type=\"video/ogg\" />';\n\n\tif ( $track)\n\t\t$track = '<track kind=\"subtitles\" src=\"' . $track . '\" srclang=\"en\" label=\"English\">';\n\n\tif ( $poster)\n\t\t$poster = ' poster=\"' . $poster . '\"';\n\n\tif ( $preload )\n\t\t$preload = 'preload=\"' . $preload . '\"';\n\n\tif ( $autoplay )\n\t\t$autoplay = 'autoplay';\n\t\t\n\t$output = \"<video id='video-js-id-$post->ID' class='video-js vjs-default-skin' width='700' height='405' controls {$preload} {$autoplay} {$poster} data-setup='{}' data-aspect-ratio='{$aspect_ratio}'>\n\t\t\t{$mp4}\n\t\t\t{$webm}\n\t\t\t{$ogg}\n\t\t\t{$track}\n\t\t</video>\";\n\treturn $output;\t\n\n}", "function bb_video($arguments = array()) {\n\t\t$content = $this->parseArray(array('[/video]'), array());\n\n\t\t$params['width'] = 570;\n\t\t$params['height'] = 360;\n\t\t$params['iframe'] = true;\n\t\t$previewthumb = '';\n\n\t\t$type = null;\n\t\t$id = null;\n\t\t$matches = array();\n\n\t\t//match type and id\n\t\tif (strstr($content, 'youtube.com') OR strstr($content, 'youtu.be')) {\n\t\t\t$type = 'youtube';\n\t\t\tif (preg_match('#(?:youtube\\.com/watch\\?v=|youtu.be/)([0-9a-zA-Z\\-_]{11})#', $content, $matches) > 0) {\n\t\t\t\t$id = $matches[1];\n\t\t\t}\n\t\t\t$params['src'] = '//www.youtube.com/embed/' . $id . '?autoplay=1';\n\t\t\t$previewthumb = 'https://img.youtube.com/vi/' . $id . '/0.jpg';\n\t\t} elseif (strstr($content, 'vimeo')) {\n\t\t\t$type = 'vimeo';\n\t\t\tif (preg_match('#vimeo\\.com/(?:clip\\:)?(\\d+)#', $content, $matches) > 0) {\n\t\t\t\t$id = $matches[1];\n\t\t\t}\n\t\t\t$params['src'] = '//player.vimeo.com/video/' . $id . '?autoplay=1';\n\n\t\t\t$videodataurl = 'http://vimeo.com/api/v2/video/' . $id . '.php';\n\t\t\t$data = '';\n\t\t\t$downloader = new UrlDownloader;\n\t\t\tif ($downloader->isAvailable()) {\n\t\t\t\t$data = $downloader->file_get_contents($videodataurl);\n\t\t\t}\n\t\t\tif ($data) {\n\t\t\t\t$data = unserialize($data);\n\t\t\t\t$previewthumb = $data[0]['thumbnail_medium'];\n\t\t\t}\n\t\t} elseif (strstr($content, 'dailymotion')) {\n\t\t\t$type = 'dailymotion';\n\t\t\tif (preg_match('#dailymotion\\.com/video/([a-z0-9]+)#', $content, $matches) > 0) {\n\t\t\t\t$id = $matches[1];\n\t\t\t}\n\t\t\t$params['src'] = '//www.dailymotion.com/embed/video/' . $id . '?autoPlay=1';\n\t\t\t$previewthumb = 'http://www.dailymotion.com/thumbnail/video/' . $id;\n\t\t} elseif (strstr($content, 'godtube')) {\n\t\t\t$type = 'godtube';\n\t\t\tif (preg_match('#godtube\\.com/watch/\\?v=([a-zA-Z0-9]+)#', $content, $matches) > 0) {\n\t\t\t\t$id = $matches[1];\n\t\t\t}\n\t\t\t$params['id'] = $id;\n\t\t\t$params['iframe'] = false;\n\n\t\t\t$previewthumb = 'http://www.godtube.com/resource/mediaplayer/' . $id . '.jpg';\n\t\t}\n\n\t\tif (empty($type) OR empty($id)) {\n\t\t\treturn '[video] Niet-ondersteunde video-website (' . htmlspecialchars($content) . ')';\n\t\t}\n\t\treturn $this->video_preview($params, $previewthumb);\n\t}", "public function forgeVideo()\n {\n // Check if we have a video creation array.\n if ($this->provider && isset($this->provider['render']['video'])) {\n // Start iframe tag.\n $video = '<video';\n\n foreach ($this->provider['render']['video'] as $attribute => $val) {\n if (! is_array($val)) {\n $video .= sprintf(' %s=\"%s\"', $attribute, $val);\n }\n }\n // Close start of video tag.\n $video .='>';\n\n // Add inner elements.\n $video .= $this->forgeInnerElements($this->provider['render']['video'], true);\n\n // Wrap video tag.\n $video .= '</video>';\n\n $video .= $this->forgeScript();\n\n return $video;\n }\n }", "function _video($src, $width, $height, $atts = null) {\n // prepare width and height\n if(is_null($atts)) $atts = array();\n $atts['width'] = (int) $width;\n $atts['height'] = (int) $height;\n if(!$atts['width']) $atts['width'] = 320;\n if(!$atts['height']) $atts['height'] = 240;\n\n $posterUrl = '';\n $files = array();\n $isExternal = media_isexternal($src);\n\n if ($isExternal) {\n // take direct source for external files\n list(/*ext*/, $srcMime) = mimetype($src);\n $files[$srcMime] = $src;\n } else {\n // prepare alternative formats\n $extensions = array('webm', 'ogv', 'mp4');\n $files = media_alternativefiles($src, $extensions);\n $poster = media_alternativefiles($src, array('jpg', 'png'));\n if(!empty($poster)) {\n $posterUrl = ml(reset($poster), '', true, '&');\n }\n }\n\n $out = '';\n // open video tag\n $out .= '<video '.buildAttributes($atts).' controls=\"controls\"';\n if($posterUrl) $out .= ' poster=\"'.hsc($posterUrl).'\"';\n $out .= '>'.NL;\n $fallback = '';\n\n // output source for each alternative video format\n foreach($files as $mime => $file) {\n if ($isExternal) {\n $url = $file;\n $linkType = 'externalmedia';\n } else {\n $url = ml($file, '', true, '&');\n $linkType = 'internalmedia';\n }\n $title = $atts['title'] ? $atts['title'] : $this->_xmlEntities(utf8_basename(noNS($file)));\n\n $out .= '<source src=\"'.hsc($url).'\" type=\"'.$mime.'\" />'.NL;\n // alternative content (just a link to the file)\n $fallback .= $this->$linkType($file, $title, null, null, null, $cache = null, $linking = 'linkonly', $return = true);\n }\n\n // finish\n $out .= $fallback;\n $out .= '</video>'.NL;\n return $out;\n }", "public function getEmbedCode();", "public function setVideoOther($attributes = []);", "function getVideoEmebed($url, $config, $width, $height) {\r\n\t\t$uniqueUid = ' rgmi'.$this->getUniqueID().' '; \r\n\t\t$video = '<span class=\"rgmediaimages-player'.$uniqueUid.'\">\r\n <embed src=\"'.t3lib_extMgm::siteRelpath('rgmediaimages').'res/mediaplayer.swf\" width=\"'.$width.'\" height=\"'.$height.'\" allowfullscreen=\"true\" allowscriptaccess=\"always\" flashvars=\"&file='.$url.'&'.$config.'\" />\r\n </span>';\r\n\t\treturn $video;\t\r\n\t}", "function KwYouTube($atts, $content = null) {\r\n\t\t$height = get_option(\"kwheight\");\r\n\t\t$width = get_option(\"kwwidth\");\r\n\t\t$colorborder1 = get_option(\"kwcolorborder1\");\r\n\t\t$colorborder2 = get_option(\"kwcolorborder2\");\r\n extract(shortcode_atts(array( \"id\" => '' ), $atts));\r\n\t\treturn '<div id=\"video\" style=\"paddind:5px;\"><object width=\"'.$width.'\" height=\"'.$height.'\"><param name=\"movie\" value=\"http://www.youtube.com/v/'.$id.'?version=2&color1=0x'.$colorborder1.'&color2=0x'.$colorborder2.'&border=1&fs=1&hl=fr_FR&rel=0&hd=1\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"allowscriptaccess\" value=\"always\" /><param name=\"bgcolor\" value=\"#000000\"><embed type=\"application/x-shockwave-flash\" width=\"'.$width.'\" height=\"'.$height.'\" src=\"http://www.youtube.com/v/'.$id.'?version=2&color1=0x'.$colorborder1.'&color2=0x'.$colorborder2.'&border=1&fs=1&hl=fr_FR&rel=0&hd=1\" bgcolor=\"#000000\" allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed></object></div>';}", "function get_src_from_iframe($videoEmbed) {\n $doc = new DOMDocument();\n $doc->loadHTML($videoEmbed);\n\n $src = $doc->getElementsByTagName('iframe')->item(0)->getAttribute('src');\n return $src;\n}", "public function getFrameVideo(){\n return $this->frameVideo; \n }", "function emvideo_dotsub_embedded_link($video_code) {\n//http://dotsub.com/view/... \n return 'http://dotsub.com/view/'. $video_code;\n}", "function wrap_embed_with_div($html, $url, $attr) {\n\n return '<div class=\"video_wrapper\"><div class=\"video-container\">' . $html . '</div></div>';\n\n}", "function video() {\n echo json_encode(array('element' => '<video controls autoplay> <source src=\"skysignagelight.1564484463.mp4\" type=\"video/mp4\"></video>'));\n exit;\n }", "function cinesport_embed_handler( $matches, $attr, $url ) {\n\t\t$embed_url = esc_url( str_replace( '.com/', '.com/embed/', $url ) );\n\n\t\t$embed = '<div class=\"content-media__video content-media__video--cinesport\"><iframe frameborder=\"0\" allowfullscreen=\"true\" webkitallowfullscreen=\"true\" mozallowfullscreen=\"true\" src=\"' . $embed_url . '#autostart=on;titles=on;nolink=on;\"></iframe></div>';\n\n\t\treturn $embed;\n\t}", "function ts_get_embaded_video($url) {\r\n\t\r\n\tif (strstr($url,'vimeo'))\r\n\t{\r\n\t\tif (preg_match('/(\\d+)/', $url, $matches))\r\n\t\t{\r\n\t\t\treturn '<iframe src=\"http://player.vimeo.com/video/'.$matches[0].'?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';\r\n\t\t}\r\n\t}\r\n\telse if (strstr($url,'youtu'))\r\n\t{\r\n\t\t$pattern = \"#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\\/)[^&\\n]+(?=\\?)|(?<=v=)[^&\\n]+|(?<=youtu.be/)[^&\\n]+#\";\r\n\t\tif (preg_match($pattern, $url, $matches))\r\n\t\t{\r\n\t\t\t\r\n\t\t\treturn '<iframe src=\"http://www.youtube.com/embed/'.$matches[0].'\" frameborder=\"0\" allowfullscreen></iframe>';\r\n\t\t}\r\n\t}\r\n\treturn '';\r\n}", "public function embed( $url, $params = [] ) : string\n {\n try {\n $code = $this->getInfo($url)->code;\n\n // check if theree are any parameters passed along\n if (!empty($params)) {\n\n // looks like there are, now let's only do this for YouTube and Vimeo\n if($this->getInfo($url)->type == 'video' && ($this->isYouTube($url) || $this->isVimeo($url)))\n {\n\n // for videos add autoplay check if the embed gets the code\n\n // create an easy html parser to verify the iframe and add autoplay for video types\n $dom = new DOMDocument;\n\n // set error level so that the html parser doesn't raise exceptions on warnings\n $internalErrors = libxml_use_internal_errors(true);\n\n $dom->loadHTML($code);\n\n // Restore error level\n libxml_use_internal_errors($internalErrors);\n\n // get the iframe\n $frame = $dom->getElementsByTagName('iframe')->item(0);\n\n //get the src from iframe\n $src = $frame->getAttribute('src');\n\n\n // check if url has any other parameters to properly add the parameter\n if (strpos($src,'?') !== false) {\n $src .= \"&\";\n } else {\n $src .= \"?\";\n }\n\n $parameters = '';\n foreach ($params as $k=>$v) {\n if ($parameters !== null) {\n $parameters .= '&';\n }\n $parameters .= \"{$k}={$v}\";\n }\n\n $src .= $parameters;\n\n // set the new src with all the parameters\n $frame->setAttribute('src', $src);\n\n // replace old iframe html with new one\n return htmlspecialchars_decode($dom->saveHTML($frame));\n }\n else\n {\n if (!empty($code)) {\n // Not YouTube or Vimeo, just output the code\n return $code;\n }\n else\n {\n return '';\n }\n }\n }\n else\n {\n if (!empty($code)) {\n // No parameters passed, just output the code\n return $code;\n }\n else\n {\n return '';\n }\n }\n } catch (InvalidUrlException $e)\n {\n // If the URL is invalid (because it's 404ing out or whatever) just return an empty string.\n return '';\n }\n\n }", "public function createVideo();", "function show_one_video($video_id,$width,$height,$skin_media='default.zip'){\n\n\t\t$str_select=\"*\";\n\t\t$arr_where=array($this->_table.'.video_id'=>$video_id);\n\n\t\t$this->db->select($str_select);\n\t\t$this->db->where($arr_where);\n\n\t\t$query=$this->db->get($this->_table);\n\t\t$arr_video=$query->row_array();\n\n\t\t$string_video='';\n\n\t\tif(is_array($arr_video) && !empty($arr_video)){\n\n\t\t\tif(preg_match(\"/youtube.com/\",element('video_file',$arr_video,''))){\n\n\t\t\t\t$string_youtube=\"<iframe width='\".$width.\"' height='\".$height.\"' src='\".element('video_file',$arr_video,'').\"' frameborder='0' allowfullscreen></iframe>\";\n\t\t\t\treturn $string_youtube;\n\t\t\t}\n\n\t\t\t$string_flashvars=\"netstreambasepath=\".base_url();\n\t\t\t$string_flashvars.= \"&amp;playlist.position=none\";\n\t\t\t$string_flashvars.= \"&amp;playlist.size=0\";\n\t\t\t$string_flashvars.= \"&amp;skin=\".base_url().DIR_PUBLIC.\"mediaplayer/skin/\".$skin_media;\n\t\t\t$string_flashvars.= \"&amp;config=\".base_url().DIR_PUBLIC.\"mediaplayer/config/config.xml\";\n\t\t\t$string_flashvars.= \"&amp;title=\".element('video_name',$arr_video,'');\n\t\t\t$string_flashvars.= \"&amp;file=\".base_src_video(element('video_file',$arr_video,''));\n\t\t\tif(element('video_img',$arr_video,'') != \"\")\n\t\t\t\t$string_flashvars.= \"&amp;image=\".base_src_img(element('video_img',$arr_video,''));\n\n\t\t\t$string_video=\"<object width='\".$width.\"' height='\".$height.\"' \";\n\t\t\t$string_video.= \"classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' \";\n\t\t\t$string_video.= \"codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' \";\n\t\t\t$string_video.= \"align='center' style='overflow:hidden'>\";\n\n\t\t\t$string_video.= \"<param name='movie' value='\".base_url().DIR_PUBLIC.\"mediaplayer/player.swf'>\";\n\t\t\t$string_video.= \"<param name='quality' value='high'>\";\n\t\t\t$string_video.= \"<param name='allowscriptaccess' value='always'>\";\n\t\t\t$string_video.= \"<param name='wmode' value='transparent'>\";\n\t\t\t$string_video.= \"<param name='allowfullscreen' value='true'>\";\n\t\t\t$string_video.= \"<param name='flashvars' value='\".$string_flashvars.\"'>\";\n\t\t\t$string_video.= \"<embed width='\".$width.\"' height='\".$height.\"' \";\n\t\t\t$string_video.= \"type='application/x-shockwave-flash' \";\n\t\t\t$string_video.= \"pluginspage='http://www.macromedia.com/go/getflashplayer' \";\n\t\t\t$string_video.= \"align='center' style='overflow:hidden' \";\n\n\t\t\t$string_video.= \"src='\".base_url().DIR_PUBLIC.\"mediaplayer/player.swf' \";\n\t\t\t$string_video.= \"quality='high' \";\n\t\t\t$string_video.= \"allowscriptaccess='always' \";\n\t\t\t$string_video.= \"wmode='transparent' \";\n\t\t\t$string_video.= \"allowfullscreen='true' \";\n\t\t\t$string_video.= \"flashvars='\".$string_flashvars.\"'>\";\n\t\t\t$string_video.= \"</object>\";\n\t\t}\n\t\treturn $string_video;\n\n\t}", "function show_metabox_post_video($post) {\r\n\t\t$id_vimeo = get_post_meta($post->ID, 'id_vimeo', true);\r\n\t\t$id_youtube = get_post_meta($post->ID, 'id_youtube', true);\r\n\t\t$embed_generico = get_post_meta($post->ID, 'embed_generico', true);\r\n\t\twp_nonce_field(__FILE__, '_articulo_videos_nonce');\r\n\t\techo <<< HTML\r\n\r\n\t\t\t<label for=\"id_vimeo\">ID de Vimeo</label>\r\n\t\t\t<input type=\"text\" name=\"id_vimeo\" id=\"id_vimeo\" value=\"$id_vimeo\" class=\"widefat\">\r\n\t\t\t<p class=\"howto\" style=\"font-size:11px; margin: 0.2em 0 1.5em 0;\">https://vimeo.com/<strong>45118430</strong></p>\r\n\r\n\t\t\t<label for=\"id_youtube\">ID de Youtube</label>\r\n\t\t\t<input type=\"text\" name=\"id_youtube\" id=\"id_youtube\" value=\"$id_youtube\" class=\"widefat\">\r\n\t\t\t<p class=\"howto\" style=\"font-size:11px; margin: 0.2em 0 1.5em 0;\">https://www.youtube.com/watch?v=<strong>rT_OmTMwvZI</strong></p>\r\n\r\n\t\t\t<label for='embed_generico'>Embed (otra fuente)</label>\r\n\t\t\t<input type='text' name='embed_generico' id='embed_generico' value='$embed_generico' class='widefat'>\r\n\t\t\t<p class='howto' style='font-size:11px; margin: 0.2em 0 1.5em 0;'>< iframe src='//player...</p>\r\n\r\nHTML;\r\n\t}", "function yoast_add_og_video() {\n if ( get_post_format() == 'video' ) {\n $post = get_post();\n preg_match('/\\[embed(.*)](.*)\\[\\/embed]/', $post->post_content, $video);\n $videoParts = explode('/',$video[2]);\n echo '<meta property=\"og:video\" content=\"' . $video[2] . '\" />', \"\\n\";\n echo '<meta property=\"og:video:secure_url\" content=\"' . str_replace('http://','https://' , $video[2]) . '\" />', \"\\n\";\n echo '<meta property=\"og:video:height\" content=\"1080\" />', \"\\n\";\n echo '<meta property=\"og:video:width\" content=\"1920\" />', \"\\n\";\n //echo '<meta property=\"og:image\" content=\"https://img.youtube.com/vi/'.$videoParts[3].'/maxresdefault.jpg\" />', \"\\n\";\n }\n}", "function flex_video_shortcode($atts, $content = NULL) {\n $a = shortcode_atts( array(\n 'aspect' => ''\n ), $atts );\n $aspect = ($a['aspect'] == 'standard') ? '' : 'widescreen';\n $content = '<div class=\"flexvideo '.$aspect.'\">'.$content.'</div>';\n return $content;\n}", "public static function setup(): void {\n\t\tglobal $wgFileExtensions, $wgMediaHandlers, $wgEmbedVideoDefaultWidth,\n\t\t\t $wgEmbedVideoEnableAudioHandler, $wgEmbedVideoEnableVideoHandler, $wgEmbedVideoAddFileExtensions;\n\n\t\tif ( !isset( $wgEmbedVideoDefaultWidth ) &&\n\t\t\t( isset( $_SERVER['HTTP_X_MOBILE'] ) && $_SERVER['HTTP_X_MOBILE'] === 'true' ) &&\n\t\t\t$_COOKIE['stopMobileRedirect'] !== 1 ) {\n\t\t\t// Set a smaller default width when in mobile view.\n\t\t\t$wgEmbedVideoDefaultWidth = 320;\n\t\t}\n\n\t\t$audioHandler = AudioHandler::class;\n\t\t$videoHandler = VideoHandler::class;\n\n\t\tif ( $wgEmbedVideoEnableAudioHandler ) {\n\t\t\t$wgMediaHandlers['application/ogg']\t\t= $audioHandler;\n\t\t\t$wgMediaHandlers['audio/flac']\t\t\t= $audioHandler;\n\t\t\t$wgMediaHandlers['audio/ogg']\t\t\t= $audioHandler;\n\t\t\t$wgMediaHandlers['audio/mpeg']\t\t\t= $audioHandler;\n\t\t\t$wgMediaHandlers['audio/mp4']\t\t\t= $audioHandler;\n\t\t\t$wgMediaHandlers['audio/wav']\t\t\t= $audioHandler;\n\t\t\t$wgMediaHandlers['audio/webm']\t\t\t= $audioHandler;\n\t\t\t$wgMediaHandlers['audio/x-flac']\t\t= $audioHandler;\n\t\t}\n\n\t\tif ( $wgEmbedVideoEnableVideoHandler ) {\n\t\t\t$wgMediaHandlers['video/mp4']\t\t\t= $videoHandler;\n\t\t\t$wgMediaHandlers['video/ogg']\t\t\t= $videoHandler;\n\t\t\t$wgMediaHandlers['video/quicktime']\t\t= $videoHandler;\n\t\t\t$wgMediaHandlers['video/webm']\t\t\t= $videoHandler;\n\t\t\t$wgMediaHandlers['video/x-matroska']\t= $videoHandler;\n\t\t}\n\n\t\tif ( $wgEmbedVideoAddFileExtensions ) {\n\t\t\t$wgFileExtensions[] = 'flac';\n\t\t\t$wgFileExtensions[] = 'mkv';\n\t\t\t$wgFileExtensions[] = 'mov';\n\t\t\t$wgFileExtensions[] = 'mp3';\n\t\t\t$wgFileExtensions[] = 'mp4';\n\t\t\t$wgFileExtensions[] = 'oga';\n\t\t\t$wgFileExtensions[] = 'ogg';\n\t\t\t$wgFileExtensions[] = 'ogv';\n\t\t\t$wgFileExtensions[] = 'wav';\n\t\t\t$wgFileExtensions[] = 'webm';\n\t\t}\n\t}", "function signage_panes_video_render($subtype, $conf, $panel_args, $context = NULL) {\n $block = new stdClass();\n\n // Set default value of video_playlist in case we have existing\n // video panes.\n if (!isset($conf['video_playlist'])) {\n $conf['video_playlist'] = 0;\n }\n\n // Determine which provider to build for.\n switch ($conf['video_provider']) {\n case 0:\n if ($conf['video_playlist']) {\n // Extract the playlistID from the video embed code.\n preg_match(YOUTUBE_PLAYLIST_REGEX_PATTERN, $conf['video_embed_code'], $matches);\n $vid = $matches[1];\n } else {\n // Extract the videoID from the video embed code.\n preg_match(YOUTUBE_REGEX_PATTERN, $conf['video_embed_code'], $matches);\n $vid = $matches[1];\n }\n\n // Rebuild the URL according to newest standard using admin settings for parameters.\n if ($conf['video_playlist']) {\n $url = '//www.youtube.com/embed?listType=playlist&list=' . $vid . '&';\n } else {\n $url = '//www.youtube.com/embed/' . $vid . '?';\n }\n\n $params = '';\n $params .= 'theme=' . variable_get('signage_panes_video_youtube_theme') . '&';\n $params .= 'autoplay=' . variable_get('signage_panes_video_youtube_autoplay') . '&';\n $params .= 'loop=' . variable_get('signage_panes_video_youtube_loop') . '&';\n $params .= 'vq=' . variable_get('signage_panes_video_youtube_vq') . '&';\n $params .= 'rel=' . variable_get('signage_panes_video_youtube_rel') . '&';\n $params .= 'showinfo=' . variable_get('signage_panes_video_youtube_showinfo') . '&';\n $params .= 'modestbranding=' . variable_get('signage_panes_video_youtube_modestbranding') . '&';\n $params .= 'cc_load_policy=' . variable_get('signage_panes_video_youtube_cc_load_policy') . '&';\n $params .= 'iv_load_policy=' . variable_get('signage_panes_video_youtube_iv_load_policy') . '&';\n $params .= 'controls=' . variable_get('signage_panes_video_youtube_controls') . '&';\n $params .= 'autohide=' . variable_get('signage_panes_video_youtube_autohide');\n\n if (!$conf['video_playlist']) {\n $params .= '&playlist=' . $vid;\n }\n\n // Recreate embed code based on most recent IFrame version of the HTML5 player from YouTube provider.\n $embed_code = 'width=' . variable_get('signage_panes_video_youtube_width') .\n ' height=' . variable_get('signage_panes_video_youtube_height') .\n ' src=' . $url . '' . $params .\n ' frameborder=0 allowfullscreen=false';\n\n break;\n\n case 1:\n // Extract the videoID from the video embed code.\n preg_match(VIMEO_REGEX_PATTERN, $conf['video_embed_code'], $matches);\n $vid = $matches[1];\n\n // Rebuild the URL according to newest standard using admin settings for\n // parameters.\n $url = '//player.vimeo.com/video/' . $vid;\n $params = '';\n $params .= 'autoplay=' . variable_get('signage_panes_video_vimeo_autoplay') . '&';\n $params .= 'loop=' . variable_get('signage_panes_video_vimeo_loop') . '&';\n $params .= 'color=' . variable_get('signage_panes_video_vimeo_color') . '&';\n $params .= 'portrait=' . variable_get('signage_panes_video_vimeo_portrait') . '&';\n $params .= 'title=' . variable_get('signage_panes_video_vimeo_title') . '&';\n $params .= 'byline=' . variable_get('signage_panes_video_vimeo_byline');\n\n // Recreate embed code based on most recent IFrame version of the HTML5\n // player from Vimeo provider.\n $embed_code = 'src=' . $url . '?' . $params .\n ' width=' . variable_get('signage_panes_video_vimeo_width') .\n ' height=' . variable_get('signage_panes_video_vimeo_height') .\n ' frameborder=0 webkitallowfullscreen mozallowfullscreen allowfullscreen';\n\n break;\n }\n\n // Create the block settings.\n $block->title = '';\n $block->content = '\n <div class=\"flexible-container\">\n\t <iframe ' . $embed_code . '></iframe>\n\t</div>\n ';\n\n return $block;\n}", "function lambert_embed_html( $html ) {\n return '<div class=\"responsive-video\">' . $html . '</div>';\n}", "public function description()\n\t{\n\t\t$txt = array();\n\t\t$txt['wiki'] = 'Embeds a video into the Page';\n\t\t$txt['html'] = '<p>Embeds a video into the Page. Accepts either full video URL (YouTube, Vimeo, Kaltura, Blip TV) or a file name or path.</p>\n\t\t\t\t\t\t<p><strong>Youtube URL:</strong> https://www.youtube.com/watch?v=<span class=\"highlight\">FgfGOEpZEOw</span></p>\n\t\t\t\t\t\t<p>Examples:</p>\n\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t<li><code>[[Video(MyVideo.m4v)]]</code></li>\n\t\t\t\t\t\t\t<li><code>[[Video(https://www.youtube.com/watch?v=FgfGOEpZEOw)]]</code></li>\n\t\t\t\t\t\t\t<li><code>[[Video(https://blip.tv/play/hNNNg4uIDAI.x?p=1)]]</code></li>\n\t\t\t\t\t\t\t<li><code>[[Video(https://player.vimeo.com/video/67115692)]]</code></li>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t<p>Size attributes may be given as single numeric values or with units (%, em, px). When an attribute name is given (e.g., width=600, height=338), order does not matter. Attribute values may be quoted but are not required to be. When a name attribute is not give (e.g., 600, 338), the first value will be set as width and the second value as height.</p>\n\t\t\t\t\t\t<p>Examples:</p>\n\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t<li><code>[[Video(MyVideo.m4v, width=\"600\", height=\"338\")]]</code></li>\n\t\t\t\t\t\t\t<li><code>[[Video(https://www.youtube.com/watch?v=FgfGOEpZEOw, width=600px, height=338px)]]</code></li>\n\t\t\t\t\t\t\t<li><code>[[Video(https://blip.tv/play/hNNNg4uIDAI.x?p=1, 640, 380)]]</code> - width 640px, height 380px</li>\n\t\t\t\t\t\t\t<li><code>[[Video(https://player.vimeo.com/video/67115692, 100%)]]</code> - width of 100%</li>\n\t\t\t\t\t\t</ul>';\n\n\t\treturn $txt['html'];\n\t}", "function pavi_the_display_video($args = array()){\n echo pavi_get_display_video($args);\n}", "function fa_video_output( $video, $before = '', $after = '', $with_assets = true, $echo = true ){\t\n\t$width \t\t= $video['width'];\n\t$height \t= fa_player_height( $video['aspect'] , $video['width'] );\n\t$exclude \t= array('width', 'aspect');\n\t\n\t$styles = array(\n\t\t'width: 100%',\n\t\t'height:' . $height . 'px',\n\t\t'max-width:' . $width . 'px' \n\t);\n\t\n\t$el_data = array();\n\tforeach( $video as $k => $v ){\n\t\tif( in_array( $k, $exclude ) ){\n\t\t\tcontinue;\n\t\t}\n\t\t// booleans get converted to 0 or 1\n\t\tif( is_bool( $v ) ){\n\t\t\t$v = (int) $v;\n\t\t}\n\t\t\n\t\t$el_data[] = 'data-' . $k . '=\"' . $v . '\"';\n\t}\n\t\n\t$el_data[] = 'data-ssl=\"' . (int) is_ssl() . '\"';\n\t\n\t$output = $before . '<div class=\"fa-video-player\" style=\"' . implode('; ', $styles) . '\" ' . implode(' ', $el_data) . '><!-- video container --></div>' . $after;\n\tif( $echo ){\n\t\techo $output;\n\t}\n\t\n\tif( $with_assets ){\n\t\tfa_load_style('video-player');\n\t\tfa_load_script('video-player2', array( 'jquery' ) );\n\t\t/**\n\t\t * Video player script action. Allows third party plugins to load\n\t\t * other assets.\n\t\t */\n\t\tdo_action( 'fa_embed_video_script_enqueue' );\t\t\n\t}\n\t\n\treturn $output;\t\n}", "public function getVideoFrame($url, $return='embed',$width='',$height='',$rel=0){\n\t\t$yt_url = parse_url(substr($url, 1, 42));\n\t \n\t if(strpos($yt_url['path'],'embed') == 1){\n\t $id = end(explode('/',$yt_url['path']));\n\t }\n\t //URL is xxxx only\n\t else if(strpos($url,'/')==false){\n\t $id = $url;\n\t }\n\t else{\n\t parse_str($yt_url['query']);\n\t //$id = $v;\n\t $id = end(explode('v=',$yt_url['query']));\n\t }\n\t //Return embed iframe\n\t if($return == 'embed'){\n\t return '<iframe width=\"'.($width?$width:250).'\" height=\"'.($height?$height:157).'\" src=\"http://www.youtube.com/embed/'.$id.'?rel='.$rel.'\" frameborder=\"0\" allowfullscreen></iframe>';\n\t }\n\t else{\n\t return $id;\n\t }\n\t}", "function video($src, string $unsupportedMessage = '', string $attributes = '', array $tracks = [], bool $indexPage = false): string\n {\n if (is_array($src)) {\n return _media('video', $src, $unsupportedMessage, $attributes, $tracks);\n }\n\n $video = '<video';\n\n if (_has_protocol($src)) {\n $video .= ' src=\"' . $src . '\"';\n } elseif ($indexPage === true) {\n $video .= ' src=\"' . site_url($src) . '\"';\n } else {\n $video .= ' src=\"' . slash_item('baseURL') . $src . '\"';\n }\n\n if ($attributes !== '') {\n $video .= ' ' . $attributes;\n }\n\n $video .= \">\\n\";\n\n foreach ($tracks as $track) {\n $video .= _space_indent() . $track . \"\\n\";\n }\n\n if (! empty($unsupportedMessage)) {\n $video .= _space_indent()\n . $unsupportedMessage\n . \"\\n\";\n }\n\n return $video . \"</video>\\n\";\n }", "function initialize () {\n $this->set_openingtag(\"<IFRAME[attributes]>\");\n\t $this->set_closingtag(\"<P>Your browser does not support iframes!</P></IFRAME>\");\n }", "function jma_yt_video_wrap_html($atts, $video_id){\n global $api_code;\n $atts = jmayt_sanitize_array($atts);\n $yt_video = new JMAYtVideo(sanitize_text_field($video_id), $api_code);\n $style = $yt_video->process_display_atts($atts);\n $attributes = array(\n 'id' => $atts['id'],\n 'class' => $atts['class'] . ' jmayt-outer jmayt-single-item clearfix',\n 'style' => $style['display'] . $atts['style']\n );\n echo '<div ';\n foreach($attributes as $name => $attribute){\n echo $name . '=\"' . $attribute . '\" ';\n\n }\n echo '>';\n echo $yt_video->markup();\n echo '</div><!--jmayt-item-wrap-->';\n}", "public function embedCodeById($id, $width = self::EMBED_WIDTH_DEFAULT, $height = self::EMBED_HEIGHT_DEFAULT) {\n if ($id) {\n return \"\n <iframe\n width = '{$width}'\n height = '{$height}'\n src = '//www.youtube.com/embed/{$id}'\n frameborder = '0'\n allowfullscreen>\n </iframe>\n \";\n }\n\n return null;\n }", "function youtubeMeta()\n{\n return array('name' => 'YouTube', 'stable' => 1, 'php' => '5.0', 'capabilities' => array('trailer'));\n}", "function type_url_form_video()\n {\n }", "function wp_filter_oembed_iframe_title_attribute($result, $data, $url)\n {\n }", "public function process() {\n // Add oembed streams to video file types.\n $video = file_type_load('video');\n $video->mimetypes[] = 'video/oembed';\n $video->streams[] = 'oembed';\n file_type_save($video);\n\n // Oembed specific display settings for videos.\n $file_display = new \\stdClass();\n $file_display->api_version = 1;\n $file_display->name = 'video__default__oembed';\n $file_display->weight = -10;\n $file_display->status = TRUE;\n $file_display->settings = array(\n 'width' => '560',\n 'height' => '340',\n 'wmode' => '',\n );\n file_display_save($file_display);\n\n $file_display = new \\stdClass();\n $file_display->api_version = 1;\n $file_display->name = 'video__default__oembed_thumbnail';\n $file_display->weight = -10;\n $file_display->status = TRUE;\n $file_display->settings = array(\n 'width' => '180',\n 'height' => '',\n );\n file_display_save($file_display);\n\n $file_display = new \\stdClass();\n $file_display->api_version = 1;\n $file_display->name = 'video__preview__oembed_thumbnail';\n $file_display->weight = -10;\n $file_display->status = TRUE;\n $file_display->settings = array(\n 'width' => '100',\n 'height' => '75',\n );\n file_display_save($file_display);\n\n $file_display = new \\stdClass();\n $file_display->api_version = 1;\n $file_display->name = 'video__teaser__oembed_thumbnail';\n $file_display->weight = -10;\n $file_display->status = TRUE;\n $file_display->settings = array(\n 'width' => '100',\n 'height' => '75',\n );\n file_display_save($file_display);\n\n }", "function plgContentplug_hwd_vs_videoplayer()\r\n\t{\r\n\t}", "function theme_video_cck_dailymotion_flash($embed, $width, $height, $autoplay) {\n if ($embed) {\n if ($autoplay) {\n $autoplay_value = '&autoStart=1';\n }\n $output .= \" <object type=\\\"application/x-shockwave-flash\\\" height=\\\"$height\\\" width=\\\"$width\\\" data=\\\"http://www.dailymotion.com/swf/$embed\". $autoplay_value .\"\\\" id=\\\"VideoPlayback\\\">\n <param name=\\\"movie\\\" value=\\\"http://www.dailymotion.com/swf/$embed\". $autoplay_value .\"\\\" />\n <param name=\\\"allowScriptAcess\\\" value=\\\"always\\\" />\n <param name=\\\"allowFullScreen\\\" value=\\\"true\\\" />\n <param name=\\\"quality\\\" value=\\\"best\\\" />\n <param name=\\\"bgcolor\\\" value=\\\"#FFFFFF\\\" />\n <param name=\\\"scale\\\" value=\\\"noScale\\\" />\n <param name=\\\"salign\\\" value=\\\"TL\\\" />\n <param name=\\\"FlashVars\\\" value=\\\"playerMode=embedded$autoplay_value\\\" />\n <param name=\\\"wmode\\\" value=\\\"transparent\\\" />\n </object>\\n\";\n }\n return $output;\n}", "function vcex_get_video_embed_url( $video = '' ) {\n\tif ( function_exists( 'wpex_get_video_embed_url' ) ) {\n\t\treturn wpex_get_video_embed_url( $video );\n\t}\n}", "function video_cck_dailymotion_extract($embed = '') {\n // http://www.dailymotion.com/us/cluster/news/featured/video/x3xk8v_primary-smackdown-obama-girl-return_fun\n // http://www.dailymotion.com/barelypolitical/video/x3xk8v_primary-smackdown-obama-girl-return_fun\n // http://www.dailymotion.com/barelypolitical/video/x3xk8v\n // <div><object width=\"420\" height=\"252\"><param name=\"movie\" value=\"http://www.dailymotion.com/swf/x3xk8v\" /></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowScriptAccess\" value=\"always\"></param><embed src=\"http://www.dailymotion.com/swf/x3xk8v\" type=\"application/x-shockwave-flash\" width=\"420\" height=\"252\" allowFullScreen=\"true\" allowScriptAccess=\"always\"></embed></object><br /><b><a href=\"http://www.dailymotion.com/video/x3xk8v_primary-smackdown-obama-girl-return_fun\">Primary Smackdown: Obama Girl Returns</a></b><br /><i>Uploaded by <a href=\"http://www.dailymotion.com/BarelyPolitical\">BarelyPolitical</a></i></div>\n // <div><object width=\"420\" height=\"252\"><param name=\"movie\" value=\"http://www.dailymotion.com/swf/x3xk8v\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowScriptAccess\" value=\"always\"></param><embed src=\"http://www.dailymotion.com/swf/x3xk8v\" type=\"application/x-shockwave-flash\" width=\"420\" height=\"252\" allowFullScreen=\"true\" allowScriptAccess=\"always\"></embed></object><br /><b><a href=\"http://www.dailymotion.com/video/x3xk8v_primary-smackdown-obama-girl-return_fun\">Primary Smackdown: Obama Girl Returns</a></b><br /><i>Uploaded by <a href=\"http://www.dailymotion.com/BarelyPolitical\">BarelyPolitical</a></i></div>\n// if (preg_match('@dailymotion\\.com@i', $embed, $matches)) {\n// if (preg_match('@/([^/_]+)_@i', $embed, $matches)) {\n// return $matches[0];\n// }\n// }\n if (preg_match('@dailymotion\\.com/swf/([^\"\\&]+)@i', $embed, $matches)) {\n return $matches[1];\n }\n if (preg_match('@dailymotion\\.com@i', $embed, $matches)) {\n if (preg_match('@/([^/_]+)_@i', $embed, $matches)) {\n return $matches[1];\n }\n }\n return array();\n}", "function video_embed_filter( $html, $data ) {\n if ( ! is_object( $data ) || empty( $data->type ) )\n return $html;\n\n // Verify that it is a video\n if ( !($data->type == 'video') )\n return $html;\n\n // Calculate aspect ratio\n $ar = $data->width / $data->height;\n\n // Set the aspect ratio modifier\n $ar_mod = ( abs($ar-(4/3)) < abs($ar-(16/9)) ? 'embed-responsive-4by3' : 'embed-responsive-16by9');\n\n // Strip width and height from html\n $html = preg_replace( '/(width|height)=\"\\d*\"\\s/', \"\", $html );\n\n // Return code\n return '<div class=\"video-container '.$ar_mod.'\" data-aspectratio=\"'.number_format($ar, 5, '.').'\">'.$html.'</div>';\n\n}", "function get_src_from_embed($videoEmbed) {\n //$videoEmbed_ = serialize($videoEmbed);\n $doc = new DOMDocument();\n $doc->loadHTML($videoEmbed);\n\n $src = $doc->getElementsByTagName('embed')->item(0)->getAttribute('src');\n return $src;\n}", "function actionEmbed($botId, $video, $botnet = '*'){\n\t\t$files = glob(\"{$this->files}/$botnet/$botId/$video\");\n\t\tif ($files === FALSE || count($files) == 0)\n\t\t\tthrow new ActionException(\"File not found: '$botnet/$botId/$video'\");\n\t\t$file = array_shift($files);\n\t\t$file_url = \"{$this->url}/$file\";\n\t\treturn '<video controls><source src=\"'.htmlentities($file_url).'\" type=\\'video/webm; codecs=\"vp8, vorbis\"\\'/><a href=\"'.htmlentities($file_url).'\" class=\"video-fallback\">Download Video</a></video>';\n\t\t}", "function video_cck_tudou_embedded_link($video_code) {\n return 'http://www.tudou.com/programs/view/'. $video_code;\n}", "public static function videoEmbed( $input, $argv, Parser $parser ) {\n\t\t$video_name = $argv['name'];\n\t\tif ( !$video_name ) {\n\t\t\treturn '';\n\t\t}\n\n\t\t$width = $width_max = 425;\n\t\t$height = $height_max = 350;\n\t\t$validAlign = [ 'LEFT', 'CENTER', 'RIGHT' ];\n\n\t\tif ( !empty( $argv['width'] ) && ( $width_max >= $argv['width'] ) ) {\n\t\t\t$width = $argv['width'];\n\t\t}\n\n\t\tif ( !empty( $argv['height'] ) && ( $height_max >= $argv['height'] ) ) {\n\t\t\t$height = $argv['height'];\n\t\t}\n\n\t\t$align = $argv['align'] ?? 'left';\n\t\t$alignTag = '';\n\n\t\tif ( in_array( strtoupper( $align ), $validAlign ) ) {\n\t\t\t// phan doesn't want to let me suppress the issue about alleged XSS since\n\t\t\t// phan doesn't understand our custom validation logic here.\n\t\t\t// Per discussion with Skizzerz, just make the issue go away with a\n\t\t\t// simple htmlspecialchars() call, it'll have no adverse effects.\n\t\t\t// @todo FIXME: but as per the discussion, this code needs some TLC.\n\t\t\t$alignTag = htmlspecialchars( \" class=\\\"float{$align}\\\" \" );\n\t\t}\n\n\t\t$output = '';\n\t\t$video = Video::newFromName( $video_name, RequestContext::getMain() );\n\t\tif ( $video->exists() ) {\n\t\t\t// If there's such a video, register an internal link\n\t\t\t// so that Special:WhatLinksHere works as intended.\n\t\t\t$parser->getOutput()->addLink( $video->getTitle() );\n\n\t\t\t$video->setWidth( $width );\n\t\t\t$video->setHeight( $height );\n\n\t\t\t$output .= \"<div{$alignTag}>\";\n\t\t\t$output .= $video->getEmbedCode();\n\t\t\t$output .= '</div>';\n\t\t}\n\n\t\treturn $output;\n\t}", "function getMov($url, $width, $height) {\r\n\t\t$url = trim($url);\r\n\t\t$url = str_replace('http://', '', $url);\r\n\t\r\n\t\t$height = $height+16;\r\n $video = '<object classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\" width=\"'.$width.'\" height=\"'.$height.'\" >\r\n <param name=\"src\" value=\"http://'.$url.'\">\r\n <param name=\"autoplay\" value=\"true\">\r\n <param name=\"type\" value=\"video/quicktime\" width=\"'.$width.'\" height=\"'.$height.'\"> \r\n <embed src=\"http://'.$url.'\" width=\"'.$width.'\" height=\"'.$height.'\" autoplay=\"false\" type=\"video/quicktime\" pluginspage=\"http://www.apple.com/quicktime/download/\">\r\n </object>';\r\n return $video;\r\n\t}", "function theme_video_cck_tudou_flash($embed, $width, $height, $autoplay) {\n if ($embed) {\n $output .= \"\n <object width=\\\"$width\\\" height=\\\"$height\\\">\n <param name=\\\"movie\\\" value=\\\"http://www.tudou.com/v/$embed\\\"></param>\n <param name=\\\"allowScriptAccess\\\" value=\\\"always\\\"></param>\n <param name=\\\"wmode\\\" value=\\\"transparent\\\"></param>\n <embed src=\\\"http://www.tudou.com/v/$embed\\\" type=\\\"application/x-shockwave-flash\\\" width=\\\"$width\\\" height=\\\"$height\\\" allowFullScreen=\\\"true\\\" wmode=\\\"transparent\\\" allowScriptAccess=\\\"always\\\"></embed>\n </object>\n \";\n }\n return $output;\n}", "public function __construct() {\n\t\t$widget_ops = array( \n\t\t\t'classname' => 'SMYouTubeVideoiFrame_Widget',\n\t\t\t'description' => 'SM YouTube channel Video iFrame',\n\t\t);\n\t\tparent::__construct( 'SMYouTubeVideoiFrame_Widget', 'SM YouTube Video iFrame', $widget_ops );\n\t}", "public function executeEditVideo(sfWebRequest $request)\n {\n // Shut off Chrome's poorly designed XSS filtering that clobbers perfectly legitimate iframe embed submissions\n // http://code.google.com/p/chromium/issues/detail?id=98787\n $this->getResponse()->setHttpHeader('X-XSS-Protection', '0');\n $this->forward404Unless(aMediaTools::userHasUploadPrivilege());\n $item = null;\n $this->slug = false;\n $this->popularTags = PluginTagTable::getPopulars(null, array('sort_by_popularity' => true), false, 10);\n if (sfConfig::get('app_a_all_tags', true))\n {\n $this->allTags = PluginTagTable::getAllTagNameWithCount();\n }\n else\n {\n $this->allTags = array();\n }\n if ($request->hasParameter('slug'))\n {\n $item = $this->getItem();\n $this->slug = $item->getSlug();\n }\n if ($item)\n {\n $this->forward404Unless($item->userHasPrivilege('edit'));\n }\n $this->item = $item;\n $embed = false;\n $parameters = $request->getParameter('a_media_item');\n \n if ($parameters)\n {\n $files = $request->getFiles('a_media_item');\n \n $this->form = new aMediaVideoForm($item);\n \n if (isset($parameters['embed']))\n {\n // We need to do some prevalidation of the embed code so we can prestuff the\n // file, title, tags and description widgets\n $result = $this->form->classifyEmbed($parameters['embed']);\n if (isset($result['thumbnail']))\n {\n $thumbnail = $result['thumbnail'];\n if ((!isset($parameters['title'])) && (!isset($parameters['tags'])) && (!isset($parameters['description'])) && (!isset($parameters['credit'])))\n {\n $parameters['title'] = $result['serviceInfo']['title'];\n // We want tags to be lower case, and slashes break routes in most server configs. \n $parameters['tags'] = str_replace('/', '-', aString::strtolower($result['serviceInfo']['tags']));\n $parameters['description'] = aHtml::textToHtml($result['serviceInfo']['description']);\n $parameters['credit'] = $result['serviceInfo']['credit'];\n }\n }\n }\n\n // On the first pass with a youtube video we just make the service's thumbnail the\n // default thumbnail. We don't force them to use it. This allows more code reuse\n // (Moving this after the bind is necessary to keep it from being overwritten) \n if (isset($thumbnail))\n {\n $this->convertServiceThumbnailToFileUpload($thumbnail, $parameters);\n }\n \n $this->form->bind($parameters, $files);\n \n do\n {\n // first_pass forces the user to interact with the form\n // at least once. Used when we're coming from a\n // YouTube search and we already technically have a\n // valid form but want the user to think about whether\n // the title is adequate and perhaps add a description,\n // tags, etc.\n if (($this->hasRequestParameter('first_pass')) ||\n (!$this->form->isValid()))\n {\n break;\n }\n $thumbnail = $this->form->getValue('file');\n // The base implementation for saving files gets confused when \n // $file is not set, a situation that our code tolerates as useful \n // because if you're updating a record containing an image you \n // often don't need to submit a new one.\n unset($this->form['file']);\n $object = $this->form->getObject();\n if ($thumbnail)\n {\n $object->preSaveFile($thumbnail->getTempName());\n }\n $this->form->save();\n \n if ($thumbnail)\n {\n $object->saveFile($thumbnail->getTempName());\n }\n \n if (aMediaTools::isSelecting())\n {\n return $this->redirect('aMedia/multipleAdd?id=' . $object->id);\n }\n\n return $this->redirect(\"aMedia/resumeWithPage\");\n } while (false);\n }\n return $this->renderTemplate();\n }", "function accouk_youtube_embed($atts) {\n\n $a = shortcode_atts(array(\n 'id' => null\n\t), $atts);\n\n $yt_id = $a['id'];\n\n // Dumb validation of youtube ID\n if(strlen($yt_id) !== 11) return;\n\n // Output with template\n ob_start();\n include('templates/youtube-video.php');\n $element = ob_get_contents();\n ob_end_clean();\n\n\treturn $element;\n}", "public function hasVideo() {}", "function get_upload_iframe_src($type = \\null, $post_id = \\null, $tab = \\null)\n {\n }", "function pageIframe() {\n\t\tglobal $body_id, $shortcode_tags;\n\t\t\n\t\t// Define this body for CSS\n\t\t$body_id = 'media-upload';\n\t\t\n\t\t// Add CSS for media style\n\t\twp_enqueue_style( 'media' );\n\t\t//wp_enqueue_script('ssm-main', SSM_URL . '/js/ssm-main.js', ('jquery') );\n\t\t\n\t\t// Send to editor ?\n\t\tif ( isset($_GET['shortcode']) ) {\n\t\t\t?>\n\t\t\t<script type=\"text/javascript\">\n\t\t\t/* <![CDATA[ */\n\t\t\tvar win = window.dialogArguments || opener || parent || top;\n\t\t\twin.send_to_editor('<?php echo $_GET['shortcode']; ?>');\n\t\t\t/* ]]> */\n\t\t\t</script>\n\t\t\t<?php\n\t\t\tdie();\n\t\t}\n\t\t\n\t\t// Render list\n\t\twp_iframe( array($this, 'form') );\n\t\tdie();\n\t}", "function embed(string $src, string $type = 'unknown', string $attributes = '', bool $indexPage = false): string\n {\n if (! _has_protocol($src)) {\n $src = $indexPage === true ? site_url($src) : slash_item('baseURL') . $src;\n }\n\n return '<embed src=\"' . $src\n . '\" type=\"' . $type . '\" '\n . $attributes . _solidus() . \">\\n\";\n }", "function signage_panes_video_admin_info($subtype, $conf, $contexts) {\n if (!empty($conf)) {\n $block = new stdClass();\n $block->title = $conf['override_title'] ? $conf['override_title_text'] : '';\n $block->content = t('Showing embedded video from @video_provider provider.', array(\n '@video_provider' => $conf['video_provider'],\n ));\n return $block;\n }\n}", "function get_src_from_param0($videoEmbed) {\n // $videoEmbed_ = serialize($videoEmbed);\n $doc = new DOMDocument();\n $doc->loadHTML($videoEmbed);\n\n $src = $doc->getElementsByTagName('param')->item(0)->getAttribute('value');\n return $src;\n}", "function wp_iframe($content_func, ...$args)\n {\n }", "function wp_underscore_video_template() {\n\t$video_types = wp_get_video_extensions();\n\t?>\n<# var w_rule = '', classes = [],\n\t\tw, h, settings = wp.media.view.settings,\n\t\tisYouTube = isVimeo = false;\n\n\tif ( ! _.isEmpty( data.model.src ) ) {\n\t\tisYouTube = data.model.src.match(/youtube|youtu\\.be/);\n\t\tisVimeo = -1 !== data.model.src.indexOf('vimeo');\n\t}\n\n\tif ( settings.contentWidth && data.model.width >= settings.contentWidth ) {\n\t\tw = settings.contentWidth;\n\t} else {\n\t\tw = data.model.width;\n\t}\n\n\tif ( w !== data.model.width ) {\n\t\th = Math.ceil( ( data.model.height * w ) / data.model.width );\n\t} else {\n\t\th = data.model.height;\n\t}\n\n\tif ( w ) {\n\t\tw_rule = 'width: ' + w + 'px; ';\n\t}\n\n\tif ( isYouTube ) {\n\t\tclasses.push( 'youtube-video' );\n\t}\n\n\tif ( isVimeo ) {\n\t\tclasses.push( 'vimeo-video' );\n\t}\n\n#>\n<div style=\"{{ w_rule }}\" class=\"wp-video\">\n<video controls\n\tclass=\"wp-video-shortcode {{ classes.join( ' ' ) }}\"\n\t<# if ( w ) { #>width=\"{{ w }}\"<# } #>\n\t<# if ( h ) { #>height=\"{{ h }}\"<# } #>\n\t<?php\n\t$props = array(\n\t\t'poster' => '',\n\t\t'preload' => 'metadata',\n\t);\n\tforeach ( $props as $key => $value ) :\n\t\tif ( empty( $value ) ) {\n\t\t\t?>\n\t\t<#\n\t\tif ( ! _.isUndefined( data.model.<?php echo $key; ?> ) && data.model.<?php echo $key; ?> ) {\n\t\t\t#> <?php echo $key; ?>=\"{{ data.model.<?php echo $key; ?> }}\"<#\n\t\t} #>\n\t\t\t<?php\n\t\t} else {\n\t\t\techo $key\n\t\t\t?>\n\t\t\t=\"{{ _.isUndefined( data.model.<?php echo $key; ?> ) ? '<?php echo $value; ?>' : data.model.<?php echo $key; ?> }}\"\n\t\t\t<?php\n\t\t}\n\tendforeach;\n\t?>\n\t<#\n\t<?php\n\tforeach ( array( 'autoplay', 'loop' ) as $attr ) :\n\t\t?>\n\tif ( ! _.isUndefined( data.model.<?php echo $attr; ?> ) && data.model.<?php echo $attr; ?> ) {\n\t\t#> <?php echo $attr; ?><#\n\t}\n\t<?php endforeach ?>#>\n>\n\t<# if ( ! _.isEmpty( data.model.src ) ) {\n\t\tif ( isYouTube ) { #>\n\t\t<source src=\"{{ data.model.src }}\" type=\"video/youtube\" />\n\t\t<# } else if ( isVimeo ) { #>\n\t\t<source src=\"{{ data.model.src }}\" type=\"video/vimeo\" />\n\t\t<# } else { #>\n\t\t<source src=\"{{ data.model.src }}\" type=\"{{ settings.embedMimes[ data.model.src.split('.').pop() ] }}\" />\n\t\t<# }\n\t} #>\n\n\t<?php\n\tforeach ( $video_types as $type ) :\n\t\t?>\n\t<# if ( data.model.<?php echo $type; ?> ) { #>\n\t<source src=\"{{ data.model.<?php echo $type; ?> }}\" type=\"{{ settings.embedMimes[ '<?php echo $type; ?>' ] }}\" />\n\t<# } #>\n\t<?php endforeach; ?>\n\t{{{ data.model.content }}}\n</video>\n</div>\n\t<?php\n}", "function video_cck_dailymotion_preview($embed, $width, $height, $field, $item, $autoplay) {\n $output = theme('video_cck_dailymotion_flash', $embed, $width, $height, $autoplay);\n return $output;\n}" ]
[ "0.7947435", "0.74100304", "0.73970544", "0.7303058", "0.72988105", "0.723098", "0.7149711", "0.71355397", "0.7067044", "0.70485836", "0.69778174", "0.6935423", "0.68400264", "0.6724045", "0.6712874", "0.6683594", "0.6662239", "0.6594677", "0.6587823", "0.658486", "0.65621775", "0.65585864", "0.6557009", "0.6546043", "0.65426946", "0.6528451", "0.652373", "0.6508138", "0.64923966", "0.64923966", "0.647377", "0.64733213", "0.6470075", "0.6462593", "0.64487183", "0.6431584", "0.6411281", "0.64095634", "0.6402335", "0.6397488", "0.63938296", "0.6373536", "0.6353501", "0.63469386", "0.6339981", "0.6334567", "0.6329482", "0.63274884", "0.63141465", "0.63098115", "0.62842077", "0.6283643", "0.6264632", "0.62411326", "0.623686", "0.6227747", "0.6184643", "0.61082834", "0.6107151", "0.61041206", "0.6104043", "0.610085", "0.60942197", "0.60718626", "0.6049251", "0.60476494", "0.6035473", "0.6017261", "0.60110193", "0.6008328", "0.6006707", "0.60031265", "0.59974164", "0.5987953", "0.5985939", "0.59833664", "0.5980596", "0.5963687", "0.5961703", "0.59453404", "0.5941076", "0.5940451", "0.59318364", "0.5931367", "0.59297955", "0.5929355", "0.59218156", "0.5913265", "0.590652", "0.58992314", "0.5897924", "0.5893674", "0.58720046", "0.58662117", "0.58494174", "0.5847537", "0.5835919", "0.58353466", "0.5816789", "0.5812629" ]
0.6903546
12
check if account exists
function checkAccount($name, $username){ $query = "SELECT * FROM users_account WHERE fullname = ? OR username = ?"; $paramType = "ss"; $paramValue = array( $name, $username ); $result = $this->db_handle->runquery($query, $paramType, $paramValue); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function isAccountExist()\n {\n $sessionId = \\Session::getId();\n $account = Account::where('session_id', $sessionId)->first();\n if (!$account) return false;\n\n return true;\n }", "public function checkUserExist($account){\n $query = \"select * from members where account=\\\"$account\\\"\";\n $result = $this->dbh->query($query);\n if($result->rowCount() > 0){\n return true;\n }\n return false;\n }", "function has_account()\n{\n return file_exists(DEFAULT_ACCOUNTFILE);\n}", "private function new_account($username){\n\t\t\t\t\n\t\t$stmt = $this->db->prepare('SELECT * FROM account WHERE username=:username');\n\t\t$stmt->execute(['username'=>$username]);\n\t\t$result = $stmt->fetch();\n\t\t//the if loop checks if the account exists\n\t\tif(is_array($result) && count($result) > 0){\n\t\t\treturn false;//does exists\n\t\t}\n\t\treturn true;//does not exist\n\t}", "public function hasAccount($key);", "public function accountExists($email) {\r\n $this->db = new Db();\r\n \r\n $this->db->scrub($email);\r\n $query = \"SELECT UID FROM MEMBER WHERE EMAIL = '\".$email.\"'\";\r\n $results = $this->db->select($query);\r\n return(sizeof($results)>0);\r\n }", "public function testExists()\n {\n $this->assertFalse($this->insight->accounts->exists(12345));\n $this->insight->accounts->addTrial(12345);\n $this->assertTrue($this->insight->accounts->exists(12345));\n }", "private function checkUserExistence() {\n\t\t\t\t$query = \"select count(email) as count from register where email='$this->email'\";\n\t\t\t\t$resource = returnQueryResult($query);\n\t\t\t\t$result = mysql_fetch_assoc($resource);\n\t\t\t\tif($result['count'] > 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}", "public function validate_account(){ \n\t\tif($this->data['Client']['account_holder'][0] != ''){\n\t\t\treturn true;\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}", "public static function checkAccount () {\n $user_id = session::getUserId();\n if ($user_id) {\n $a = q::select('account')->filter('id =', $user_id)->fetchSingle();\n \n // user may have been deleted\n if (empty($a)) {\n self::killSessionAll($user_id);\n return false;\n } \n \n if ($a['locked'] == 1) {\n self::killSessionAll($user_id);\n return false;\n }\n }\n return true;\n }", "public function existeUser($acc){\n\t\tUtilidades::_log(\"existeUser($acc)\");\n\t\t$db=DB::conectar();\n\t\t$select=$db->prepare('SELECT * FROM user WHERE account=:account');\n\t\t$select->bindValue('account',$acc);\n\t\t$select->execute();\n\t\t$registro=$select->fetch();\n\t\tif(null != registro['id']){\n\t\t\t$usado=False;\n\t\t}else{\n\t\t\t$usado=True;\n\t\t}\t\n\t\treturn $usado;\n\t}", "function isAccountExist($db, $user_email) {\n $TEST_ACCOUNT_EXIST = \"SELECT user_id FROM user WHERE user_email = ?\";\n $accountExist = false; //Par defaut, le compte n'existe pas\n\n if (!is_null($user_email)) {\n $resultats = $db->prepare($TEST_ACCOUNT_EXIST);\n $resultats->execute(array($user_email));\n\n //Le compte existe\n if ($resultats->rowCount() == 1) {\n $accountExist = true;\n }\n $resultats->closeCursor();\n }\n\n return $accountExist;\n}", "function is_user_exists($cellphone,$password)\n {\n\n $query=$this->db->query(\"SELECT * FROM xl_account WHERE cellphone='{$cellphone}' AND password='{$password}' AND register_user=1\");\n\n if ($query->num_rows()>0) {\n #if exist return true\n return TRUE;\n }\n\n return FALSE; \n }", "public function accountIdExists($id){\n try{\n $sql = 'SELECT idaccount FROM accounts WHERE idaccount=:id';\n $query = pdo()->prepare($sql);\n $query->bindValue(':id', $id, PDO::PARAM_INT);\n $query->execute();\n $res = $query->fetch(PDO::FETCH_ASSOC);\n $query->closeCursor();\n if($res){\n return true;\n }\n }\n catch(Exception $e)\n {\n trigger_error('Echec lors de la vérification si le compte(ID) existe : '.$e->getMessage(), E_USER_ERROR);\n }\n return false;\n }", "public function accountExists($username)\n {\n $params = [\n 'user' => $username,\n 'action' => 'list'\n ];\n\n $accountResponse = $this->apiRequest('accountdetail', $params);\n return $accountResponse->status() == 200 && empty($accountResponse->errors());\n }", "function dbUserExists($unm)\n{\n\t$result = false;\n\t$sql = \"SELECT username FROM _account WHERE username = '$unm'\";\n\ttry {\n\t\t$stmt = Database :: prepare ( $sql );\n\t\t$stmt->execute();\n\t\t$count = $stmt -> rowCount();\n\t\tif ($count > 0) {\n\t\t\t$result = true; //Username already taken\n\t\t}\n\t\t$stmt->closeCursor ( ) ;\n\t}\n\tcatch(PDOException $e)\n\t{\n\t\techo $e->getMessage();\n\t}\n\treturn $result;\n}", "protected function hasAccount(): bool\n {\n if (null === $this->hasAccount) {\n $account = $this->accountContext->getAccount();\n if (null !== $account) {\n $this->account = $account;\n $this->hasAccount = true;\n } else {\n $this->hasAccount = false;\n }\n }\n\n return $this->hasAccount;\n }", "private function isAccountValid($account) {\n\t\t// Ensure the prefix is unique (or empty if self-hosted)\n\t\tif ($account->selfHost) return true;\n\t\t$sql = \t<<<EOD\n\t\t\t\tSELECT F_RootID, F_Prefix\n\t\t\t\tFROM T_AccountRoot\n\t\t\t\tWHERE F_Prefix=?\nEOD;\n\t\t$rs = $this->db->Execute($sql, array($account->prefix));\n\t\t\n\t\tswitch ($rs->RecordCount()) {\n\t\t\tcase 0:\n\t\t\t\t// There are no duplicates\n\t\t\t\treturn true;\n\t\t\tcase 1:\n\t\t\t\t// There is a duplicate, but if this is an update it might be the same record\n\t\t\t\treturn ((int)($rs->FetchNextObj()->F_RootID) == (int)($account->id));\n\t\t\tdefault:\n\t\t\t\t// Something is wrong with the database!\n\t\t\t\tthrow new Exception(\"isAccountValid: More than one account was returned with prefix '\".$account->prefix.\"'\");\n\t\t}\n\t}", "function isUserExist($con,$androidId,$username,$email){\n\t$sql = \"SELECT * FROM `access`,`owner` WHERE owner.email = access.email AND owner.android_id = '\".$androidId.\"' AND owner.email='\".$email.\"' AND access.username='\".$username.\"' AND access.enable = 'Y'\";\n\n\t$result = mysqli_query($con,$sql);\n\t$value = @mysqli_num_rows($result);\n\n\tif ($value){\n\t\treturn true;\n\t}else{\n\t\treturn false;\n\t}\n}", "public function userExists() {\n\t\t\n\t\t// DB connection\n\t\t$db = Database::getInstance();\n \t$mysqli = $db->getConnection(); \n\t\t\n //inserts username and password in to users table\n $data =(\"SELECT user_id FROM user WHERE username ='{$this->_username}'\");\n\t\t$result = $mysqli->query($data);\n return(mysqli_num_rows($result) > 0) ? 1 : 0;\n }", "public function user_exists() {\n\t\t$user = $this->search(\"(uid=\".$this->user.\")\");\n\t\treturn $user !== false;\n\t}", "public function setAccountExists($t){\n global $Account_exists;\n $Account_exists = $t;\n }", "public function userExists( $user_name ) { return true;}", "public function account()\n {\n if ($response = $this->request('account')) {\n if (isset($response->success) && $response->success == true) {\n return $response->account;\n }\n }\n return false;\n }", "function userExists( $username ) {\n return true;\n }", "public function hasAccountId()\n {\n return $this->account_id !== null;\n }", "function checkIfUserExists($conn,$data)\n {\n $sql = \"SELECT * FROM tbl_users \n WHERE email='\".$data['email'].\"' AND username='\".$data['username'].\"'\";\n $result = $conn->query($sql);\n return ($result->num_rows>0 ? true : false);\n }", "function randomUser_exists()\t{\n\t\treturn $this->recordNumber(self::RNDUSERSC_NAME) > 0;\n\t}", "function exists ($name)\r\n {\r\n # create encoded_key_string\r\n $encoded_key_string = parent::_encode_key_string(USER_NAME_FIELD_NAME.\"='\".$name.\"'\");\r\n\r\n $record = parent::select_record($encoded_key_string);\r\n if (count($record) > 0)\r\n {\r\n $this->_log->debug(\"user already exists (name=\".$name.\")\");\r\n\r\n return TRUE;\r\n }\r\n else if (strlen($this->get_error_message_str()) == 0)\r\n {\r\n $this->_log->debug(\"user does not exist (name=\".$name.\")\");\r\n\r\n return FALSE;\r\n }\r\n else\r\n return FALSE;\r\n }", "public function hasMultipleAccounts();", "public function loginExists() {\n return (bool) $this->local_account;\n }", "public function check_user_exist($con,$username) {\n $query = \"SELECT * FROM user WHERE username = '$username'\";\n $result = mysqli_query($con, $query);\n $count = mysqli_num_rows($result);\n if ($count > 0) {\n return TRUE;\n }\n else {\n return FALSE;\n }\n }", "private function userExists($username){ return $this->redis->exists($username);\n }", "private function verifyAccount()\n {\n $check = $this->db->query('SELECT users.password, users.id FROM users WHERE username = ?', $this->username)->fetchArray();\n //Check of de user in de database staat.\n if (isset($check['password'])) {\n //Check of de password matched\n if (password_verify($this->password, $check['password'])) {\n echo \"AUTH verify complete\";\n $this->setLoggedinUser($check['id']);\n return true;\n } else {\n return false;\n }\n } else {\n return false;\n }\n }", "function checkExistsUser($email){\n\n\t\t$stmt = $this->conn->prepare(\"SELECT * FROM user Where email=:email\");\n\t\t$stmt->execute(['email'=>$email]);\n\t\t$result = $stmt->fetchAll();\n\t\t$num_rows = count($result);\n\n\t\tif($num_rows > 0){\n\t\t\treturn true;\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}", "public function Exists();", "function userExists($username) {\r\n\t\treturn username_exists($username);\r\n\t}", "function userExists($username, $name, $email) {\n $dbo =& JFactory::getDBO();\n $query = 'SELECT id FROM #__users ' .\n 'WHERE username = ' . $dbo->quote($username) . ' ' .\n 'AND name = ' . $dbo->quote($name) . ' ' .\n 'AND email = ' . $dbo->quote($email);\n \n $dbo->setQuery($query);\n // Checking subscription existence\n if ($user_info = $dbo->loadObjectList()) {\n if (! empty ($user_info)) {\n $user = $user_info[0];\n return $user->id;\n }\n }\n return false;\n }", "static public function tryToDeleteAccount() {\r\n\t\tDB::getInstance()->stopAddingAccountID();\r\n\t\t$Account = DB::getInstance()->exec('DELETE FROM `'.PREFIX.'account` WHERE `deletion_hash`='.DB::getInstance()->escape($_GET['delete']).' LIMIT 1');\r\n\t\tDB::getInstance()->startAddingAccountID();\r\n\r\n\t\tif ($Account) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t}", "public function exists() {\n\t\tglobal $config;\n\t\t\n\t\tif(!empty($this->data['id']))\n\t\t\t$where = 'id = '.$this->data['id'];\n\t\telseif(!empty($this->data['fbid']))\n\t\t\t$where = 'fbid = '.$this->data['fbid'];\n\t\n\t\t$result = $config['database']->query(\"\n\t\t\tSELECT id\n\t\t\tFROM nuusers\n\t\t\tWHERE $where\n\t\t\tLIMIT 1\n\t\t\");\n\t\t\n\t\treturn $result->num_rows;\n\t}", "function exists($user_query){\n\t\t\n\t\t//CALL MEMBER FUNCTION QUERY OF THE CURRENT OBJECT\n\t\t$result = $this->query(\"Select username from users where username='\".$user_query.\"'\");\n\t\t\n\t\t//COUNT RESULTS FROM QUERY\n\t\t$count = mysqli_num_rows($result);\n\n\t\t//IF COUNT HAS COUNTED ONE OR MORE RESULTS, RETURN FALSE BECAUSE EMAIL/USER IS ALREADY REGISTERED!\n\t\tif($count>0){\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private function doesUserExists($name,$log=false){\n\t\treturn ($this->_link->countFieldsLCASE('users',array('name'=>strtolower($name)),$log)>0);\n\t}", "function checkUserExists($username){\n\treturn false;\n}", "public function checkemail() {\n\n if (env(\"NEW_ACCOUNTS\") == \"Disabled\" && env(\"GUEST_SIGNING\") == \"Disabled\") {\n\n $account = Database::table(\"users\")->where(\"email\", input(\"email\"))->first();\n if (!empty($account)){\n response()->json(array(\"exists\" => true));\n }else{\n response()->json(array(\"exists\" => false));\n }\n\n }\n\n }", "function userExists($uid)\r\n {\r\n return $this->UD->userExists($uid);\r\n }", "public function userExists($login){\n $usr = $this->userInfo($login);\n if($usr == null) { // uzivatel neni v DB\n return false;\n }\n else {\n return true;\n }\n }", "public function exist()\n {\n return ( !! ldap_get_name($this->username));\n }", "public function userExists()\r\n {\r\n $sql = \"SELECT COUNT(*) FROM (SELECT * FROM doctors WHERE email = :email) AS subquery\";\r\n\r\n $query = $this->db_connection->prepare($sql);\r\n $query->bindValue(':email', $this->email);\r\n $query->execute();\r\n\r\n while($result_row = $query->fetch() ){\r\n if($result_row[0] == 1) return true;\r\n else return false;\r\n }\r\n\r\n return false; \r\n }", "public function _userexists($input) {\n\n\t\t$prepare \t= $this->db->prepare(\"SELECT * FROM `users` WHERE `username` = ?\");\n\t\t$prepare->execute(array(r::post($input)));\n\t\t$result \t= $prepare->fetch();\n\n\t\tif(!empty($result)) {\n\t\t\treturn true;\n\t\t}\n\t}", "function userExists($email) {\r\n\t\t\tif ($this->getUser($email) != false)\r\n\t\t\t\treturn true;\r\n\t\t\treturn false;\r\n\t\t}", "function usernameExists($username) {\n\n\tglobal $connection;\n\n\t$query = \"SELECT username FROM users WHERE username = '{$username}'\";\n\t$result = mysqli_query($connection, $query);\n\tconfirm($result);\n\n\treturn mysqli_num_rows($result) > 0 ? true : false;\n\n}", "function does_exist($username) \n{\n global $conn; // inorderto use a global variable\n \n $sql = \"SELECT * from Users where (Username = '$username')\";\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 checkIfUserExist($username, $email) {\n $query = getQuery(\"checkIfUserExist.query\", $username, \"\", $email);\n $result = mysql_query($query);\n\n return (mysql_result($result, 0) >= 1);\n}", "private function _isValidAccount( $blz, $account ) {\n return ( TRUE );\n }", "public function checkUsernameExists(){\r\n\t\t\t$objDBConn = DBManager::getInstance();\r\n\t\t\tif($objDBConn->dbConnect()){\r\n\t\t\t\t//echo \"SELECT * from trainer where username='\".$_REQUEST[\"username\"].\"'\";\r\n\t\t\t\t$result = mysql_query(\"SELECT * from trainer where username='\".$_REQUEST[\"username\"].\"' LIMIT 1\");\r\n\t\t\t\t$count= mysql_num_rows($result);\r\n\t\t\t\tif($count==0){\r\n\t\t\t\t\t//Username is available\r\n\t\t\t\t\t$objDBConn->dbClose();\r\n\t\t\t\t\t//return true;\r\n\t\t\t\t\techo $count;\r\n\t\t\t\t}else{\r\n\t\t\t\t\t//Username already taken.\r\n\t\t\t\t\t$objDBConn->dbClose();\r\n\t\t\t\t\t//return false;\r\n\t\t\t\t\techo $count;\r\n\t\t\t\t}\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\t//return false;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}", "public function checkUserAlreadyExists($usn)\n {\n // database connection\n $dbConnectorObject = new DatabaseConnection();\n $dbConnection = $dbConnectorObject->getConnection();\n\n // query to fetch user by usn.\n $fetchByUSNSql = \"SELECT * FROM appuser WHERE USN = '$usn' AND Active = \".Constants::ACTIVE;\n\n // run the query to fetch the user object by usn.\n $objAppuser = $dbConnection->query($fetchByUSNSql);\n\n if($objAppuser->num_rows > 0){\n return true;\n }else{\n return false;\n }\n }", "function name_exist($conn, $username) {\n\t$sql = \"SELECT * FROM Officer WHERE Officer_Username = '$username';\";\n\t$result = mysqli_query($conn, $sql);\n\tif (mysqli_num_rows($result) > 0) {\n\t\treturn True;\n\t} else {\n\t\treturn False;\n\t}\n}", "function user_exists($username){\n\n $sql = \"SELECT Username, Password, Email, Id FROM Users\"; //WHERE\n //Username={$username}\";\n $result = mysqli_query(Db::$conn, $sql);\n //check results return true if >0\n if(mysqli_num_rows($result)>0) {\n while ($row = mysqli_fetch_assoc($result)) {\n $temp_user = $row[\"Username\"];\n $temp_pass = $row[\"Password\"];\n if ($username == $row[\"Username\"]) {\n return true;\n }\n }\n }\n\n return false;\n\n}", "function checkUsernameExists($username) {\n $query = \"SELECT * FROM `customers` WHERE username='\".$username.\"'\";\n $result = Database::selectQuery($query);\n if(count($result) == 1) {\n return true;\n } else {\n return false;\n }\n }", "function userExists($username){\r\n $sql = \"SELECT username FROM users WHERE username = '$username'\";\r\n $count = $this->q()->num_rows;\r\n if ($count > 0 ){ return true; } else{ return false; }\r\n }", "public function checkaccount()\n {\n $this->data['lang'] = $this->language;\n $apiKey = preg_replace('/[^[:alnum:]]/i', '', $this->request->get['apikey']);\n $this->data['onego_jssdk_url'] = OneGoConfig::get('jsSdkURI').'?apikey='.$apiKey;\n $this->template = 'total/onego_status_jssdk.tpl';\n $this->response->setOutput($this->render());\n }", "function doesUserExist($user) {\r\n global $dbaseUserData, $leagueID, $dbase;\r\n\r\n\r\n $query = \"SELECT username from $dbaseUserData where lid='$leagueID' and username=\\\"$user\\\"\";\r\n $result = $dbase->query($query);\r\n\r\n if ($result == FALSE) {\r\n ErrorNotify(\"Query Failed : $query\");\r\n CloseConnection($link);\r\n return TRUE;\r\n }\r\n \r\n // If we get >0 rows, the username already exists.\r\n $numrows = mysql_num_rows($result);\r\n\r\n if ($numrows == 0) {\r\n return FALSE;\r\n }\r\n\r\n return TRUE;\r\n}", "function auth_user_exists($username)\n{\n return dbFetchCell(\"SELECT * FROM `users` WHERE `username` = ?\", array($username));\n}", "public function any_user_exists(){\n $select_query = \"SELECT `id`, `staff_id`, `unit`, `password`, `cpassword` FROM `register_user` \";\n //check if user exists \n $run_select_query = $this->conn->query($select_query);\n if($run_select_query){\n //check if user exists \n if(mysqli_num_rows($run_select_query) > 0){\n //check if \n return true;\n }else{\n return false;\n }\n }\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 is_user_register($cellphone)\n {\n \n $query=$this->db->query(\"SELECT * FROM xl_account WHERE cellphone='{$cellphone}' AND register_user=1\");\n\n if ($query->num_rows()>0) {\n #if exist return true\n return TRUE;\n }\n\n return FALSE; \n }", "private function findAccount() {\n\t\t\tassertArray($this->errorMsgs);\n\t\t\t// find existing email/login\n\t\t\t$result = $this->dbh->query(\"SELECT `affiliateID`, `email`, `password` FROM `affiliates` WHERE `email` = '\".prepDB($this->registrationForm['email']).\"'\");\n\t\t\tif (isset($_REQUEST['affiliateLogin'])) {\n\t\t\t\t// login\n\t\t\t\tif ($this->affiliateID) {\n\t\t\t\t\t// already logged in\n\t\t\t\t\t$this->errorMsgs[] = 'You are already logged in, please log out first';\n\t\t\t\t} elseif ($result->rowCount) {\n\t\t\t\t\t$row = $result->fetchAssoc();\n\t\t\t\t\tif ($row['password'] != $this->registrationForm['password']) {\n\t\t\t\t\t\t// login, incorrect password\n\t\t\t\t\t\t$this->errorMsgs[] = 'Incorrect password for '.$this->registrationForm['email'];\n\t\t\t\t\t\taddErrorField('password');\n\t\t\t\t\t} elseif (!$this->affiliateID) {\n\t\t\t\t\t\t// affiliate id is the logged in flag\n\t\t\t\t\t\t// the only way affiliate id can be set is if user successfully creates a new account or logs in\n\t\t\t\t\t\t$this->affiliateID = $row['affiliateID'];\n\t\t\t\t\t\t// update login count\n\t\t\t\t\t\t$this->dbh->query(\"UPDATE `affiliates` SET `totalLogins` = `totalLogins` + 1 WHERE `affiliateID` = '\".prepDB($this->affiliateID).\"'\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->errorMsgs[] = 'You are already logged in, please log out first';\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// no email found\n\t\t\t\t\t$this->errorMsgs[] = 'Email not found';\n\t\t\t\t}\n\t\t\t} elseif ($this->affiliateID) {\n\t\t\t\t// affiliate changing account info\n\t\t\t\tif ($result->rowCount) {\n\t\t\t\t\t$row = $result->fetchAssoc();\n\t\t\t\t\tif ($row['affiliateID'] != $this->affiliateID) {\n\t\t\t\t\t\t// user entered an existing address/login that belongs to another account\n\t\t\t\t\t\t$this->errorMsgs[] = $this->registrationForm['email'].' has an existing account, please enter a different email address';\n\t\t\t\t\t\taddErrorField('email');\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->errorMsgs[] = 'You are currently using this email address';\n\t\t\t\t\t\taddErrorField('email');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} elseif ($result->rowCount) {\n\t\t\t\t// new account\n\t\t\t\t$row = $result=>fetchAssoc();\n\t\t\t\tif ($row['email'] == prepDB($this->registrationForm['email'])) {\n\t\t\t\t\t$this->errorMsgs[] = $this->registrationForm['email'].' has an existing account, please log in or enter a different email address';\n\t\t\t\t\taddErrorField('email');\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function user_exist($uname)\n {\n $this->removeOldTemps();\n \n $res = $this->query(\"SELECT * FROM `{$this->userTable}` WHERE `{$this->tbFields1['email']}` = '\".$uname.\"'\");\n $res2 = $this->query(\"SELECT * FROM `{$this->userTempTable}` WHERE `{$this->tbTmpFields['email']}` = '\".$uname.\"'\"); \n \n if((!$res && !$res2) || (mysql_num_rows($res) == 0 && mysql_num_rows($res2) == 0)){ // no records \n return false;\n }\n return true; \n }", "function verify_username_availability($userName){\n $exists = false;\n if(get_user($userName)){\n $exists = true;\n }\n return $exists;\n}", "protected function exists() {}", "function isUserExisted($email) {\n $result = mysql_query(\"SELECT email from users WHERE email = '$email'\",$first);\n $no_of_rows = mysql_num_rows($result);\n if ($no_of_rows > 0) {\n // user existed \n return true;\n } else {\n // user not existed\n return false;\n }\n }", "function check_rebrandly_account() {\n $options = get_option('sbrb_settings');\n // If API Key option not set, do nothing\n if( $options['sbrb_api_key'] == '' )\n return;\n\n $url = 'https://api.rebrandly.com/v1/account';\n\n $result = wp_remote_get(\n $url, \n array(\n 'headers' => array(\n 'apikey' => $options['sbrb_api_key']\n )\n )\n );\n\n $response = ( $result['response']['code'] == 200 ) ? true : false;\n\n return $response;\n }", "function is_user_registered($cellphone)\n {\n \n $query=$this->db->query(\"SELECT * FROM xl_account WHERE cellphone='{$cellphone}' AND register_user=0\");\n\n if ($query->num_rows()>0) {\n #if exist return true\n return TRUE;\n }\n\n return FALSE; \n }", "private function isUserExists($email) {\n $stmt = $this->conn->prepare(\"SELECT id FROM app_users WHERE email = ?\");\n $stmt->bind_param(\"s\", $email);\n $stmt->execute();\n $stmt->store_result();\n $num_rows = $stmt->num_rows;\n $stmt->close();\n return $num_rows > 0;\n }", "function UserNameExists($username) {\n\n\t$result = DBRead('usuarios', $params = 'username', $fields = 'username');\n\n\t$query = \"SELECT username FROM usuarios WHERE username = '$username'\";\n\t$result = DBExecute($query);\n\n\tif (mysqli_num_rows($result) <= 0)\n\t\treturn true;\n\telse\n\t\treturn false;\n}", "public function doesUserExist($acr_, $memid, $dev_id) {\n\t\t$acr=strtoupper($acr_);\n\t\t$uid;\n \t$result=mysql_query(\"SELECT uid FROM users WHERE acr='$acr' and memid='$memid'\");\n \tif (mysql_num_rows($result) == 0) {\n \t\treturn FALSE;\n \t}\n \t\n \t$row=mysql_fetch_array($result);\n \t$uid=$row[\"uid\"];\n \t \t\n \t$result=mysql_query(\"SELECT tid FROM $this->tokenTable WHERE uid='$uid' and token='$dev_id'\");\n \tif (mysql_num_rows($result) == 0) {\n \t\treturn FALSE;\n \t}\n \telse return TRUE;\n\t}", "private function IsFreeAccount() {\n $ret = TRUE;\n $curl = curl_init();\n curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);\n curl_setopt($curl, CURLOPT_USERAGENT, DOWNLOAD_STATION_USER_AGENT);\n curl_setopt($curl, CURLOPT_COOKIEFILE, $this->TOUTDEBRID_COOKIE);\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);\n curl_setopt($curl, CURLOPT_URL, $this->TOUTDEBRID_ACCOUNT_URL);\n $AccountRet = curl_exec($curl);\n curl_close($curl);\n preg_match('/Compte:.*<b>(.*)<\\/b>/', $AccountRet, $match);\n if (isset($match[0])) {\n $compare = strtolower($match[0]);\n if (strstr($compare, $this->TOUTDEBRID_PREMIUM_ACCOUNT_KEYWORD)) {\n $ret = FALSE;\n }\n }\n return $ret;\n }", "public static function exists($login);", "function create_account($firstname, $lastname, $email, $password) {\n\t$query = \"SELECT * FROM \" . $GLOBALS['db_name'] . \".users WHERE email = '$email' LIMIT 1\";\n\t$result = $GLOBALS['db_connection'] -> query($query);\n\t\n\tif ($result -> num_rows > 0) {\n\t\treturn \"E-Mail address already registered\";\n\t}\n\t\n\t// create account\n\t$unique_id = uniqid();\n\t$query = \"INSERT INTO \" . $GLOBALS['db_name'] . \".users (firstname, lastname, email, password, user_id) VALUES ('$firstname', '$lastname', '$email', '$password', '$unique_id')\";\n\t\t\n\tif ($GLOBALS['db_connection'] -> query($query) === TRUE) {\n\t\treturn TRUE;\n\t} else {\n\t\tdisplay_sql_error();\n\t}\n}", "function userExists($uid)\n\t{\n\t\t$check = $this->DB->database_select('users', 'uid', array('uid' => $uid));\n\t\treturn ($check == 0) ? false : true;\n\t}", "function user_exists()\n\t{\t\n\t\tif((empty($_SESSION['username'])))\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\t}", "public function isAlreadyExist(){\n \n $query = \"SELECT *\n FROM \" . $this->table . \" \n WHERE email='\".$this->email.\"'\";\n // prepare query statement\n $stmt = $this->conn->prepare($query);\n // execute query\n $stmt->execute();\n if($stmt->rowCount() > 0){\n return true;\n }else{\n return false;\n }\n }", "function username_exists($username)\n {\n global $connection;\n $query = \"select username from users where username = '{$username}'\";\n $result = mysqli_query($connection, $query);\n confirmQuery($result);\n if(mysqli_num_rows($result) > 0)\n {\n return true;\n }\n else\n {\n return false;\n }\n }", "public function hasPwIsExist(){\n return $this->_has(2);\n }", "function doesUserExist($username) {\n global $db;\n\n $query = \"SELECT * FROM user WHERE username=:username\";\n $statement = $db->prepare($query);\n $statement->bindValue(':username', $username); \n $statement->execute();\n $results = $statement->fetchAll();\n $statement->closeCursor();\n return (count($results) > 0);\n}", "public function isUserExisted($email) {\r\n $result = mysqli_query($this->con,\"SELECT email from users WHERE email = '$email'\");\r\n $no_of_rows = mysqli_num_rows($result);\r\n if ($no_of_rows > 0) {\r\n // user existed \r\n return true;\r\n } else {\r\n // user not existed\r\n return false;\r\n }\r\n }", "function usernameExists($username)\r\n{\r\n\tglobal $db,$db_table_prefix;\r\n\r\n \tif(returns_result(\"SELECT Active FROM \".$db_table_prefix.\"Users WHERE Username_Clean = '\".$db->sql_escape(sanitize($username)).\"' LIMIT 1\") > 0)\r\n\t\treturn true;\r\n\telse\r\n\t\treturn false;\r\n}", "function DB_check_if_user_exist($usersPass, $usersEmail){\n\n $connection = DB_get_connection();\n $usersPass = md5($usersPass);\n $query = \"SELECT * FROM `users` WHERE Email='$usersEmail' AND password='$usersPass'\";\n $result = mysqli_query($connection, $query);\n if(mysqli_num_rows($result) === 1)\n return true;\n else return false;\n\n}", "function IfExists($EquipmentId) {\r\n $conn = conn();\r\n $stmt = $conn->prepare(\"SELECT * FROM account WHERE AccountId = '$AccountId' ;\");\r\n $stmt->execute();\r\n $result = $stmt->fetchAll();\r\n if (($result)) {\r\n return 1;\r\n }\r\n return 0;\r\n $conn = NULL;\r\n }", "public function userExists()\n\t{\n\t\tself::authenticate();\n\n\t\t$uname = FormUtil::getPassedValue('user', null);\n\n\t\tif($uname == null) {\n\t\t\treturn self::retError('ERROR: No user name 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\t$return = true;\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 isUsernameAvailable($username){\n \n $con=Connection::createConnection();\n $result = mysql_query(\"SELECT * FROM user WHERE nickname = '$username'\");\n $flagToReturn=false;\n \n if(mysql_num_rows($result) == 1){\n //already exist\n }else{\n $flagToReturn=true;\n }\n NetDebug::trace($flagToReturn);\n Connection::closeConnection($con);\n return $flagToReturn;\n \n }", "function checkUserIdBL() {\n\t $isExisting = false;\n\t // If the user exists\n\t if ( checkUserIdDAL($_POST['userId']) )\n\t {\n\t\t $isExisting = true;\n\t }\n\t return $isExisting;\n }", "function username_exists($username){\n global $connection;\n\n $query = \"SELECT user_name FROM users WHERE user_name = '{$username}'\";\n $result = mysqli_query($connection, $query);\n confirm($result);\n\n //if the username column name already has a value that is given by the user when registering\n if (mysqli_num_rows($result) > 0) {\n return true;\n }else{\n return false;\n }\n}", "private function Check_If_User_Exists($query){\r\n\r\n // Send query into server\r\n $this->_db->get_Row($query);\r\n\r\n // Return result of query\r\n // True - if find\r\n // False - in dont\r\n return ($this->_db->count() > 0 ) ? true : false;\r\n }", "function isUserExist($email)\n\t{\n\t\t$stmt = $this->con->prepare(\"SELECT id FROM users WHERE email = ?\");\n\t\t$stmt->bind_param(\"s\", $email);\n\t\t$stmt->execute();\n\t\t$stmt->store_result();\n\t\treturn $stmt->num_rows > 0;\n\t}", "public function exists() {}", "public function userExists(){\r\n\t\t$bool = false ;\r\n\t\t$pseudo = addslashes($this -> getPseudo()) ;\r\n\t\t$r = execute(\"select count(User_pseudo) as nb from UserTab where User_pseudo='\".$pseudo.\"'\");\t\r\n\t\twhile($l = mysql_fetch_assoc($r)){\r\n\t\t\tif($l['nb'] > 0)\r\n\t\t\t\t$bool = true ;\r\n\t\t}\t\t\r\n\t\r\n\t\treturn $bool ;\r\n\t }", "function isUserExistsByUsername($username) {\n $query = \"select * from user_profile_details WHERE username='{$username}' \";\n $result_set = mysql_query($query);\n\tif(isQuerySuccess($result_set)){\n\t\tif (mysql_num_rows($result_set) > 0) { \n\t\t\treturn true;\n\t\t} else { \n\t\t\treturn false;\n\t\t}\t\n\t} \n}", "public function isRegistered() {\n //1ero. es un registro completo o 2do es un\n //registro incompleto.\n if (is_file(\"/etc/elastix.key\")) { \n if($this->columnExists(\"has_account\")) {\n $result = $this->_DB->getFirstRowQuery(\"select has_account from register;\", true);\n if (is_array($result) && count($result)>0){\n return ($result['has_account']==\"yes\")?\"yes-all\":\"yes-inc\";\n }\n else return \"yes-inc\";\n }\n else {\n //intento crear la columna \n if(!$this->addColumnTableRegister(\"has_account char(3) default 'no'\")) {\n $this->errMsg = \"The column 'has_account' does not exist and could not be created\";\n return \"yes-inc\";\n }\n\n //Actualizo el valor de la columna\n //con la info desde webservice\n $dataWebService = $this->getDataServerRegistration();\n if(!(is_array($dataWebService) && count($dataWebService)>0)) // no se puedo conectar al webservice\n return \"yes-inc\";\n \n if($this->updateHasAccount(1,$dataWebService['has_account']))\n return ($dataWebService['has_account']==\"yes\")?\"yes-all\":\"yes-inc\";\n else return \"yes-inc\";\n }\n }\n else return \"no\";\n }", "public static function user_exists($lookup)\n {\n if (Token::verify($lookup)) {\n $query = Database::generate_query(\"user_lookup_id\", [$lookup]);\n // Else assume a display name\n } else {\n $query = Database::generate_query(\"user_lookup_name\", [$lookup]);\n }\n\n $result = $query->execute();\n $count = $result->count();\n $result->close();\n\n return $count >= 1;\n }" ]
[ "0.79502535", "0.779367", "0.74163085", "0.7391764", "0.71684486", "0.7159462", "0.71255577", "0.7097755", "0.70869243", "0.70120394", "0.7012008", "0.6972208", "0.6968287", "0.69172627", "0.68746346", "0.68355745", "0.6791166", "0.6757868", "0.67085475", "0.6697441", "0.66252637", "0.65967274", "0.65776", "0.6572047", "0.6559624", "0.65362847", "0.6479051", "0.64675146", "0.6467015", "0.6465471", "0.64611036", "0.645205", "0.64515454", "0.6409668", "0.63993764", "0.63976294", "0.63915855", "0.6378384", "0.6370103", "0.6368205", "0.63580453", "0.6357328", "0.6356699", "0.6345634", "0.634035", "0.6336915", "0.6324057", "0.63116044", "0.6298371", "0.62896264", "0.62869805", "0.6285714", "0.6285467", "0.6283551", "0.6283325", "0.62832904", "0.6280333", "0.627877", "0.6277506", "0.6270333", "0.6270236", "0.626598", "0.62568223", "0.6246467", "0.62463915", "0.6234974", "0.6230589", "0.6224948", "0.6216363", "0.62110424", "0.62075114", "0.62068045", "0.6203847", "0.6200948", "0.6195192", "0.6194681", "0.6192696", "0.61912364", "0.6186578", "0.61831343", "0.6177337", "0.6176134", "0.6173718", "0.61714375", "0.6170293", "0.61693203", "0.61675745", "0.61567724", "0.6156513", "0.61560965", "0.6153515", "0.61492974", "0.6146436", "0.6146331", "0.6143981", "0.614328", "0.61279434", "0.6124352", "0.6115513", "0.6107806" ]
0.6193197
76
update users account info
function updateProfile($name, $phone, $email, $username, $userid) { $query = "UPDATE users_account SET fullname = ?,mobileno = ?,email = ?,username WHERE userid = ?"; $paramType = "ssssi"; $paramValue = array( $name, $phone, $email, $username, $userid ); $this->db_handle->update($query, $paramType, $paramValue); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function account_update_info()\n\t{\n\t\t$data = $this->input->post();\n\t\tif ($this->ion_auth->update($this->mUser->id, $data))\n\t\t{\n\t\t\t$messages = $this->ion_auth->messages();\n\t\t\t$this->system_message->set_success($messages);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errors = $this->ion_auth->errors();\n\t\t\t$this->system_message->set_error($errors);\n\t\t}\n\n\t\tredirect('admin/panel/account');\n\t}", "public function updateMyAccountInfo()\n {\n $ajax_data = array();\n $post = $this->request->request->all();\n \n // validate POST parameters\n $result = $this->user_logic->validateAccountInfoPostData($post);\n if (($result['error'] == '') AND ! empty($result['params'])) {\n $user_id = $this->user_session->getUserId();\n $update = $this->user_logic->updateUserInfo($user_id, $result['params']);\n if ($update !== false) {\n $ajax_data['code'] = 0;\n $ajax_data['data'] = $post;\n $ajax_data['message'] = 'Updated Account Information'; \n } else {\n $errors = $this->user_logic->getErrorMessage();\n if (! empty($errors) AND is_array($errors)) {\n $errors = implode(',',$errors);\n } else {\n $errors = 'Failed to update account info due to database error';\n }\n \n $ajax_data['code'] = 1;\n $ajax_data['message'] = $ajax_data['validation_error'][] = $errors;\n }\n } else {\n $ajax_data['code'] = 1;\n $ajax_data['message'] = $ajax_data['validation_error'][] = $result['error']; \n }\n \n $this->ajax_respond($ajax_data);\n }", "public function update_info()\n\t{\n\t\t$this->load->model('admin_user_model', 'admin_users');\n\t\t$updated = $this->admin_users->update_info($this->mUser->id, $this->input->post());\n\n\t\tif ($updated)\n\t\t{\n\t\t\tset_alert('success', 'Successfully updated account info.');\n\t\t\t$this->mUser->full_name = $this->input->post('full_name');\n\t\t\t$this->session->set_userdata('admin_user', $this->mUser);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tset_alert('danger', 'Failed to update info.');\n\t\t}\n\n\t\tredirect('admin/account');\n\t}", "public function update(){\n\t\t\t$record = $this->modelGetrenter_user();\n\t\t\tinclude \"Views/AccountUpdateView.php\";\n\t\t}", "public function update_account() {\n global $dbconfig;\n\n $user_id = $this->params['user_id'];\n $status = isset($this->params['status']) ? $this->params['status'] : BLOCKED;\n $account_dbobj = $this->params['account_dbobj'];\n $user_status = BLOCKED;\n $store_status = PENDING;\n\n if($status === ACTIVATED) {\n $user_status = CREATED;\n $store_status = PENDING;\n }\n\n // update users table\n $user_obj = new User($account_dbobj, $user_id);\n $user_obj->setStatus($status);\n $user_obj->save();\n\n $user = BaseModel::findCachedOne($dbconfig->account->name . \".user?id=$user_id\");\n if(!empty($user['store_id'])){\n $store_id = $user['store_id'];\n // store need to manually launch\n $store_obj = new Store($account_dbobj, $store_id);\n if($store_obj->getId()) {\n $store_obj->setStatus($store_status);\n $store_obj->save();\n if($store_status != ACTIVATED){\n GlobalProductsMapper::deleteProductsInStore($account_dbobj, $store_id);\n }\n }\n }\n }", "public function testUpdateUser()\n {\n }", "private function editAccount()\n {\n try\n {\n global $userquery; \n\n $request = $_REQUEST;\n\n if(!userid())\n throw_error_msg(\"Please login to perform this action\");\n\n //country\n if(!isset($request['country']) || $request['country']==\"\")\n throw_error_msg(\"provide country\");\n\n //sex\n if(!isset($request['sex']) || $request['sex']==\"\")\n throw_error_msg(\"provide sex\");\n\n if(!in_array($request['sex'], array('male','female')))\n throw_error_msg(\"sex must be male/female\");\n\n //dob\n if(!isset($request['dob']) || $request['dob']==\"\")\n throw_error_msg(\"provide dob\");\n\n if(!isset($request['dob']) || $request['dob']==\"\")\n throw_error_msg(\"provide dob\");\n\n $is_valid_date = DateTime::createFromFormat('Y-m-d', $request['dob']);\n\n if(!$is_valid_date)\n throw_error_msg(\"dob must be in Y-m-d like 1990-11-18 format\");\n\n if(!isset($request['category']) || $request['category']==\"\")\n throw_error_msg(\"provide category\");\n\n $request['userid'] = userid();\n $userquery->update_user($request);\n\n if( error() )\n {\n throw_error_msg(error('single')); \n }\n else\n {\n $user_info = format_users($request['userid']);\n \n $data = array('code' => \"204\", 'status' => \"success\", \"msg\" => \"success\", \"data\" => $user_info);\n $this->response($this->json($data)); \n } \n\n }\n catch(Exception $e)\n {\n $this->getExceptionDelete($e->getMessage());\n }\n }", "public function update_account()\n\t{\n\t\t$data = $this->input->post();\n\t\t\n\t\t$success = $this->user_model->safe_update($this->user->id, $data);\n\t\t\n\t\tif ( $success )\n\t\t{\n\t\t\t$this->json['message'] = 'Your account details have been successfully updated.';\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->json['status'] = 'error';\n\t\t\t$this->json['message'] = 'There were errors when attempting update your account.';\n\t\t}\n\t\t\n\t\t$this->json['content'] = $this->update_account_content();\n\t\t\n\t\treturn $this->ajax_response();\n\t}", "public function account_updated(){\n $this->log();\n http_response_code(200);\n ob_end_flush();\n }", "function updateUser() {\n\t\t$rating = $this -> getTaskRating();\n\t\t$sql = \"Update Users set finishedBasic=1, userRating=userRating+\" . $rating . \" where UID= (Select t.UID from Task t WHERE t.TaskId=\" . $this -> data[0]['TaskId'] . \")\";\n\t\t$stmt = $this -> DB -> prepare($sql);\n\t\tif ($stmt -> execute()) {\n\t\t\t$this -> checkforLast();\n\t\t} else {\n\t\t\tinclude_once \"Email.php\";\n\t\t\tnew Email('failed', 'to update user with TaskId=' . $this -> data[0]['TaskId'], $this -> id);\n\t\t}\n\t}", "public function updateUser()\n {\t\t\n\t\t$user = $this->checkToken();\n\t\tif ($user) {\t\n\t\t\t$userModel = UserModel::find($user->id);\n\t\t\t$data = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);\n\t\t\t$userModel->fill($data);\n\t\t\t$userModel->save();\n\t\t\treturn $this->sendResponse('Your details have been successfully updated');\n\t\t}\n\t\treturn $this->sendResponse('You are not authorised to update this account');\n }", "public function update() {\n\t\t$db = Database::getInstance();\n\t\t$stmt = $db->prepare(\"UPDATE users SET mail=?, name=?, password=?, state=? WHERE id = ?\");\n\t\t$stmt->execute(array($this->mail, $this->name, $this->password, $this->state, $this->id));\n\t}", "public function update():void\n {\n $id = $this->id;\n $first_name = $this->first_name;\n $last_name = $this->last_name;\n $image = $this->image;\n $user_type = $this->user_type;\n $address = $this->address;\n\t\t$phone = $this->phone;\n $this->fetch(\n 'UPDATE user\n SET first_name = ?,\n last_name = ?,\n image = ?,\n user_type = ?,\n address=?,\n phone=?\n WHERE id = ?;',\n [$first_name, $last_name,$image, $user_type,$address ,$phone , $id]\n );\n }", "public function updateAccount()\n\t{\n\t\tif (in_array('newsletter', $this->Config->getActiveModules()))\n\t\t{\n\t\t\t$GLOBALS['TL_DCA']['tl_member']['palettes']['default'] = str_replace('newsletter;', 'newsletter,newsalert;', $GLOBALS['TL_DCA']['tl_member']['palettes']['default']);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$GLOBALS['TL_DCA']['tl_member']['palettes']['default'] = str_replace('assignDir;', 'assignDir;{newsletter_legend:hide},newsalert;', $GLOBALS['TL_DCA']['tl_member']['palettes']['default']);\n\t\t}\n\t\t\n\t\t$intUser = $this->Input->get('id');\n\n\t\t// Front end call\n\t\tif (TL_MODE == 'FE')\n\t\t{\n\t\t\t$this->import('FrontendUser', 'User');\n\t\t\t$intUser = $this->User->id;\n\t\t}\n\n\t\t// Edit account\n\t\tif (TL_MODE == 'FE' || $this->Input->get('act') == 'edit')\n\t\t{\n\t\t\t$objUser = $this->Database->prepare(\"SELECT email FROM tl_member WHERE id=?\")\n\t\t\t\t\t\t\t\t\t ->limit(1)\n\t\t\t\t\t\t\t\t\t ->execute($intUser);\n\n\t\t\tif ($objUser->numRows)\n\t\t\t{\n\t\t\t\t// E-mail address has changed\n\t\t\t\tif (!empty($_POST) && $this->Input->post('email', true) != $objUser->email)\n\t\t\t\t{\n\t\t\t\t\t$this->Database->prepare(\"UPDATE tl_news_recipients SET email=? WHERE email=?\")\n\t\t\t\t\t\t\t\t ->execute($this->Input->post('email', true), $objUser->email);\n\n\t\t\t\t\t$objUser->email = $this->Input->post('email', true);\n\t\t\t\t}\n\n\t\t\t\t$objSubscriptions = $this->Database->prepare(\"SELECT pid FROM tl_news_recipients WHERE email=?\")\n\t\t\t\t\t\t\t\t\t\t\t\t ->execute($objUser->email);\n\n\t\t\t\t$strNews = serialize($objSubscriptions->fetchEach('pid'));\n\n\t\t\t\t$this->Database->prepare(\"UPDATE tl_member SET newsalert=? WHERE id=?\")\n\t\t\t\t\t\t\t ->execute($strNews, $intUser);\n\n\t\t\t\t// Update the front end user object\n\t\t\t\tif (TL_MODE == 'FE')\n\t\t\t\t{\n\t\t\t\t\t$this->User->newsalert = $strNews;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Delete account\n\t\telseif ($this->Input->get('act') == 'delete')\n\t\t{\n\t\t\t$objUser = $this->Database->prepare(\"SELECT email FROM tl_member WHERE id=?\")\n\t\t\t\t\t\t\t\t\t ->limit(1)\n\t\t\t\t\t\t\t\t\t ->execute($intUser);\n\n\t\t\tif ($objUser->numRows)\n\t\t\t{\n\t\t\t\t$objSubscriptions = $this->Database->prepare(\"DELETE FROM tl_news_recipients WHERE email=?\")\n\t\t\t\t\t\t\t\t\t\t\t\t ->execute($objUser->email);\n\t\t\t}\n\t\t}\n\t}", "public function updateAccount($val = null) {\r\n $query = 'UPDATE MEMBER SET';\r\n $mod = 0;\r\n foreach ($val as $k => $v) {\r\n if ($k != 'UID') {\r\n if ($mod++ > 0)\r\n $query .= ', ';\r\n $query .= ' ' . $k . ' = \\'' . $v . '\\'';\r\n }\r\n }\r\n $query .= ' WHERE UID = ' . $this->db->scrub($val['UID']);\r\n \r\n $this->db = new Db();\r\n $this->db->select($query);\r\n $val['ISADMIN'] = null;\r\n \r\n // Set the current session up with the new values\r\n $this->assignSession($val); \r\n \r\n // Log it\r\n $log = new Logger();\r\n $log->log('User '.$val['UID'].' updated their profile', $_SERVER['REMOTE_ADDR'], 'INFO');\r\n return(true);\r\n }", "private function updateUser () {\n $sql = \"UPDATE users SET avatar = :avatar,\n biography = :biography,\n birthdate = :birthdate,\n email = :email,\n nickname = :nickname,\n location = :location,\n password = :password,\n activated = :activated,\n phone = :phone,\n username = :username,\n website = :website WHERE id_user = :id_user\";\n $query = $this->bdd->prepare($sql);\n $query->bindParam(':avatar', $this->avatar);\n $query->bindParam(':biography', $this->biography);\n $query->bindParam(':birthdate', $this->birthdate);\n $query->bindParam(':email', $this->email);\n $query->bindParam(':nickname', $this->nickname);\n $query->bindParam(':location', $this->location);\n $query->bindParam(':password', $this->password);\n $query->bindParam(':phone', $this->phone);\n $query->bindParam(':username', $this->username);\n $query->bindParam(':website',$this->website);\n $query->bindParam(':activated',$this->activated);\n $query->bindParam(':id_user',$_SESSION['auth']['id_user']);\n $query->execute();\n }", "public function updateAccount()\n {\n $user = Auth::user();\n\n if(Input::get('edit')) {\n\n $manager = new AccountManager($user, Input::all());\n if ($manager->save()) {\n\n return Redirect::route('home');\n } else {\n return Redirect::back()->withInput()->withErrors($manager->getErrors());\n }\n }\n elseif(Input::get('delete'))\n {\n $user = Auth::user();\n $id =$user->id;\n User::destroy($id);\n return Redirect::route('home')->with('user_deleted', 1);\n }\n }", "public function updateProfile($data) {\n $this->db->query(\"UPDATE \" . DB_PREFIX . \"wkpos_user SET firstname = '\" . $data['firstname'] . \"', lastname = '\" . $data['lastname'] . \"', email = '\" . $data['account_email'] . \"', username = '\" . $data['username'] . \"', salt = '\" . $this->db->escape($salt = token(9)) . \"', password = '\" . $this->db->escape(sha1($salt . sha1($salt . sha1($data['account_npwd'])))) . \"' WHERE user_id = '\" . $this->session->data['user_login_id'] . \"'\");\n }", "function eventUpdateAccount(){\r\n\t\t$userid = util::getData(\"id\");\r\n\t\t$selectedPermissions = util::getData(\"customPermissions\");\r\n\t\t$selectedTables = util::getData(\"selectedTables\");\r\n\t\t$tableAccess = util::getData(\"tableAccess\");\r\n\t\t$accountType = util::getData(\"accountType\");\r\n\r\n\t\t//make sure we can modify this account\r\n\t\tif(!$this->canUpdateUser($userid))\r\n\t\t\treturn $this->setEventResult(false, \"You cannot update this account\");\r\n\r\n\t\t$result = dkpAccountUtil::UpdateSecondaryAccount($this->guild->id, $userid, $selectedPermissions, $selectedTables, $tableAccess, $accountType);\r\n\r\n\t\tif($result != dkpAccountUtil::UPDATE_OK)\r\n\t\t\t$this->setEventResult(false, dkpAccountUtil::GetErrorString($result));\r\n\t\telse\r\n\t\t\t$this->setEventResult(true,\"Account Updated!\");\r\n\t}", "public function updateUser(array $config = []);", "public function updateUser($data) {\n\t\t\n\t}", "public function accountChange(){\n\t\t\n\t\t// If user want to change his informations\n\t\tif(isset($_POST['account_save']))\n\t\t{\n\t\t\trequire 'Database.php';\n\t\t\t\n\t\t\t$order_id = $_REQUEST['order_id'];\n\t\t\tif($order_id!=\"\")\n\t\t\t{\n\t\t\t // Update database with his informations\n\t\t\t$req = $db->prepare(\"UPDATE orders SET lol_server = ?, lol_summoner = ?, lol_account = ?, lol_password = ? WHERE order_id = ?\");\n\t\t\t$req->execute(array($_POST['server'], $_POST['summonername'], $_POST['accountname'], $_POST['accountpassword'], $order_id));\n\t\t\t$_SESSION['account_information'] = 1;\n\t\t\t\n\t\t\t// Update current league, LP\n\t\t\t$update = new Member();\n\t\t\t$update->updateOrderLeague();\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\n\t\t\t// Update database with his informations\n\t\t\t$req = $db->prepare(\"UPDATE orders SET lol_server = ?, lol_summoner = ?, lol_account = ?, lol_password = ? WHERE user_id = ?\");\n\t\t\t$req->execute(array($_POST['server'], $_POST['summonername'], $_POST['accountname'], $_POST['accountpassword'], $_SESSION['id']));\n\t\t\t$_SESSION['account_information'] = 1;\n\t\t\t\n\t\t\t// Update current league, LP\n\t\t\t$update = new Member();\n\t\t\t$update->updateOrderLeague();\n\t\t\t}\necho \"<script>window.location='index.php'</script>\";\n\t\t\t//header('Location: index.php');\n\t\t}\n\n\t}", "public function updateUserinfo()\n\t{\n\t\t$user_array = Session::all();\n\n \t$userID = Session::get('id');\n\t\t$data = $this->request->all();\n\t\t$data['user'] = Auth::user();\n\t\t\t$rules = array(\n \t\t'full_name' => 'required',\n\t\t\t\t'zip_code' => 'required',\n\t\t\t\t'aniversary_date' => 'required',\n\t\t\t\t'phone_number' => 'required',\n\t\t\t\t'dob' => 'required',\n\t\t\t\t'gender' => 'required',\n\t\t\t\t'location_id' => 'required'\t\t\t\t\n\t\t\t);\n\n\t\t\t$message = array(\n\t\t\t\t'required' => 'The :attribute is required', \n\t\t\t);\n\n\t\t\t$validation = Validator::make($data, $rules, $message);\n\n\t\t\tif($validation->fails())\n\t\t\t{\n\t\t\t\treturn Redirect::to('/users/updateinfo')->withErrors($validation);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n \t$arrResponse=Profile::updateProfileWeb($data, $userID);\n \treturn Redirect::to('/users/myaccount')\n\t\t ->with('flash_notice', '');\n\t\t }\n\t}", "public function testUpdateNetworkMerakiAuthUser()\n {\n }", "private function _update() {\n\n $this->db->replace(XCMS_Tables::TABLE_USERS, $this->getArray());\n $this->attributes->save();\n\n }", "public function editAccountAction()\n {\n //Current customer Data.\n $cst = $this->model->getByUserName($_SESSION['userName']);\n if (empty($_POST) === false) {\n //User want to Update his Data.\n if (isset($_POST['update'])) {\n $message = \"\";\n $currentUserName = $cst->getuserName();\n //Check if customer`s new User Name or \n //new Email exists in Data Base.\n if ($currentUserName != $_POST['userName'])\n $message = $this->checkIfExists($_POST['userName'], \"\");\n if (!$message)\n if ($cst->getemail() != $_POST['email'])\n $message = $this->checkIfExists(\"\", $_POST['email']);\n if ($message != \"\")\n $this->regMassage($message);\n //Upadating Customer`s Data.\n else {\n $cst = $this->customerCreate();\n $this->update($cst, $currentUserName);\n $_SESSION['userName'] = $_POST['userName'];\n }\n }\n }\n\n $vars['update'] = \"\";\n $vars['customer'] = $cst;\n $this->view->render('edit profile', $vars);\n }", "function updateUser (){\n\t\t$params = array(\n\t\t\t':idusuarios' => $_SESSION['idusuarios'],\n\t\t\t':nombres' => $_POST['nombres'],\n\t\t\t':apellidos' => $_POST['apellidos'],\n\t\t\t':direccion' => $_POST['direccion'],\n\t\t\t':foto' => $_POST['foto'],\n\t\t\t':email' => $_POST['email'],\n\t\t\t':usuario' => $_POST['usuario'],\n\t\t\t':contrasena' => $_POST['contrasena'],\n\t\t);\n\n\t\t/* Preparamos el query apartir del array $params*/\n\t\t$query ='UPDATE usuarios SET\n\t\t\t\t\tnombres = :nombres,\n\t\t\t\t\tapellidos = :apellidos,\n\t\t\t\t\tdireccion = :direccion,\n\t\t\t\t\tfoto = :foto,\n\t\t\t\t\temail = :email,\n\t\t\t\t\tusuario = :usuario,\n\t\t\t\t\tcontrasena = :contrasena \n\t\t\t\t WHERE idusuarios = :idusuarios;\n\t\t\t\t';\n\n\t\t$result = excuteQuery(\"blogs\", \"\", $query, $params);\n\t\tif ($result > 0){\n\t\t\tunset($_SESSION['idusuarios']);\n\t\t\t$_SESSION['idusuarios'] = NULL;\n\t\t\theader('Location: viewUsers.php?result=true');\n\t\t}else{\n\t\t\theader('Location: editUser.php?result=false');\n\t\t}\n\t}", "public function update()\n { if (is_null($this->id))\n trigger_error(\"User::update(): Attempt to update a User object that does not have its ID property set.\", E_USER_ERROR);\n \n // Update the User\n $conn = new PDO(DB_DSN, DB_USER, DB_PASS);\n $sql = \"UPDATE users SET user_name=:user_name, user_password_hash=:user_password_hash, user_email=:user_email, orcid=:orcid, orcid_code=:orcid_code, orcid_access_token=:orcid_access_token WHERE user_id = :id\";\n $st = $conn->prepare($sql);\n $st->bindValue(\":user_name\", $this->userName, PDO::PARAM_STR);\n $st->bindValue(\":user_password_hash\", $this->userPasswordHash, PDO::PARAM_STR);\n\t$st->bindValue(\":user_email\", $this->userEmail, PDO::PARAM_STR);\n $st->bindValue(\":orcid\", $this->orcid, PDO::PARAM_STR);\n $st->bindValue(\":orcid_code\", $this->orcidCode, PDO::PARAM_STR);\n $st->bindValue(\":orcid_access_token\", $this->orcidAccessToken, PDO::PARAM_STR);\n $st->bindValue(\":id\", $this->id, PDO::PARAM_INT);\n $st->execute();\n $conn = null;\n }", "public function editinformation() \n {\n UserModel::authentication();\n \n //get the session user\n $user = UserModel::user();\n\n UserModel::update_profile();\n }", "public function update()\n\t{\n\t\t$this->user->db_update();\n\t}", "public function api_entry_setprofile() {\n parent::validateParams(array('user'));\n\n $user = $this->Mdl_Users->get($_POST[\"user\"]);\n\n if ($user == null)\n parent::returnWithErr(\"User id is not valid.\");\n\n $arg = $this->safeArray(array('fullname', 'avatar', 'church', 'city', 'province', 'bday', 'mood'), $_POST);\n\n $arg['id'] = $_POST[\"user\"];\n\n if (count($arg) == 1)\n parent::returnWithErr(\"You should pass the profile 1 entry at least to update.\");\n\n $user = $this->Mdl_Users->update($arg);\n\n if ($user == null)\n parent::returnWithErr(\"Profile has not been updated.\");\n\n parent::returnWithoutErr(\"Profile has been updated successfully.\", $user);\n }", "public function apiUpdate()\n {\n // Update only if account key existe and Account status is active\n $apiKey = Mage::getStoreConfig('steerfox_plugins/account/api_key');\n $accountStatus = Mage::getStoreConfig('steerfox_plugins/account/status');\n\n if (!empty($apiKey) && 1 == $accountStatus) {\n $coreHelper = Mage::helper('steerfox_plugins/core_data');\n $steerfoxContainer = $coreHelper->getSteerfoxContainer();\n $steerfoxApi = $steerfoxContainer->get('api');\n $steerfoxApi instanceof SteerfoxApiService;\n $result = $steerfoxApi->updateAccount();\n\n if (!$result) {\n Mage::getSingleton('core/session')->addError('Steerfox update account : Error occurred.');\n }\n\n Mage::app()->getStore()->resetConfig();\n }\n }", "public function update_new_user(){\n\t\t$this->data[\"activationCode\"] = $this->make_activation_code();\n\t\tif( $this->send_email($this->get_activation_msg($this->data[\"activationCode\"])) ){\n\t\t\t$mysql = New Mysql();\n\t\t\treturn( $mysql->update_user($this->data[\"name\"], $this->data[\"lastname\"], $this->data[\"email\"], $this->data[\"password\"], $this->data[\"joinDate\"], $this->data[\"lastAccess\"], $this->data[\"activationCode\"]) );\n\t\t}\t\n\t}", "private function updateUser(){\n\t\t$data['datosUsuario'] = $this->users->get($_REQUEST[\"idusuario\"]);\n\t\t$data['tipoUsuario'] = Seguridad::getTipo(); \n\t\tView::show(\"user/updateForm\", $data);\n\t}", "public function updateUserLinked\t(){\n\t\t\n\t\t}", "public function put()\n {\n $request = new EditRequest();\n\n $account = new User();\n\n $account->update($_SESSION['user'], [\n 'first_name' => $request->first_name,\n 'last_name' => $request->last_name,\n 'password' => $request->password,\n 'email' => $request->email,\n ]);\n\n Redirect::route('account');\n }", "public function update_profile(){\n\t\t\t$data = array(\n\t\t\t\t'name' => $this->input->post('name'),\n\t\t\t\t'zipcode' => $this->input->post('zipcode'),\n\t\t\t\t'email' => $this->input->post('email'),\n\t\t\t\t'username' => $this->input->post('username')\n\t\t\t);\n\n\t\t\t$this->db->where('id', $this->input->post('id'));\n \n return $this->db->update('users', $data);\n\t\t}", "function editUserAccount($update_user_name, $update_pwd, $update_uid, $current_user_name, $current_pwd, $current_uid) {\r\n\t\t\t$editQuery \t\t= \"update user_account set user_name=?, password=?, user_id=? where user_name=? and password=? and user_id=?\";\r\n\t\t\t\r\n\t\t\t$query\t\t\t= $this->pdo->prepare($editQuery);\r\n\t\t\t$editDetails\t= array($update_user_name, $update_pwd, $update_uid, $current_user_name, $current_pwd, $current_uid);\r\n\t\t\t\r\n\t\t\t$query->execute($editDetails);\r\n\t\t\t\r\n\t\t\t$rowUserEdited\t= $query->rowCount();\r\n\t\t\treturn $rowUserEdited;\r\n\t\t}", "public function update()\n\t{\n\t\t// check whether there is user who has logged in\n\t\tif (!Auth::check())\n\t\t\treturn 'fail';\n\n\t\t//get profile model\n\t\t$user = Auth::user();\n\t\t$profile = Profile::find($user->id);\n\t\t$profile->firstname = Input::get('firstname');\n\t\t$profile->lastname = Input::get('lastname');\n\t\t$profile->number = Input::get('number');\n\t\t$profile->country = Input::get('country');\n\t\t$profile->language = Input::get('language');\n\t\t$profile->city = Input::get('city');\n\t\t$profile->location = Input::get('location');\n\t\t$profile->availability = Input::get('availability');\n\t\t$profile->currency = Input::get('currency');\n\t\t$profile->price = Input::get('price');\n\t\t$profile->about = Input::get('about');\n\n\t\t// update profile and user\n\t\tif ($profile->save() && $user->save())\n\t\t\treturn 'success';\n\t}", "public function update($username, Request $request)\n\t{\n// $this->validate($request,[\n// 'email' => 'required|email|unique:users',\n// 'phone' => 'required|unique:users',\n// ]);\n $account_data = $request->except('_token');\n foreach($account_data as $k => $v){\n if($k == 'phone'){\n $v = remove_symbols($v);\n }\n Auth::user()->{$k} = $v;\n }\n if(Auth::user()->save()){\n return redirect()->back()->with('success', Lang::get('account.update_success'));\n }\n return redirect()->back()->withInput($request->except('_token'))->with('error',Lang::get('account.update_error'));\n\t}", "static function updateUser() : string\n {\n return \"UPDATE users\n SET nickname = :nickname, password = :password, type = :type, mail = :mail\n WHERE id = :id;\";\n }", "function updateUser($userId, $image, $password, $email, $phone, $about){\n //TODO Actually implement the function.\n // $dbQuery = \"UPDATE USERS SET \";\n }", "public function update()\n {\n echo uniqid('km-');\n // $data = $this->Users_model->get_all();\n // foreach ($data as $datas) {\n // $d['users_id'] = uniqid('km-');\n // $this->Users_model->update_users($datas->users_email, $d);\n // }\n }", "function update($conn)\n{\n $response[\"loggedIn\"] = getSessionValue(\"user\", \"\") != \"\";\n if (!$response[\"loggedIn\"])\n {\n $response[\"error\"] = \"You must login to edit your user account.\";\n return $response;\n } \n \n // get the logged in user...\n $userID = getSessionValue(\"user\", \"\")[\"userID\"];\n \n // validate input values...\n $userName = getValue(\"userName\", \"\");\n if ($userName == \"\")\n {\n $response[\"error\"] = \"Username is required.\";\n return $response;\n }\n $userFullName = getValue(\"userFullName\", \"\");\n if ($userFullName == \"\")\n {\n $response[\"error\"] = \"User's full name is required.\";\n return $response;\n }\n $userPass = getValue(\"userPass\", \"\");\n if (strlen($userPass) < 8 || strlen($userPass) > 20)\n {\n $response[\"error\"] = \"Password is required and must be at least 8 and no more than 20 characters.\";\n return $response;\n }\n \n // make sure the user exists...\n $stmt = $conn->prepare(\"SELECT USER_ID FROM USER WHERE USER_ID = ?\");\n $stmt->bind_param(\"i\", $userID);\n $stmt->execute();\n if (!$stmt->fetch()) \n {\n $response[\"error\"] = sprintf(\"User %d does not exist.\", $userID);\n return $response;\n }\n $stmt->close();\n\n // hash the password...\n $userPass = password_hash($userPass, PASSWORD_DEFAULT);\n\n // update the user...\n $stmt = $conn->prepare(\"UPDATE USER SET USER_NAME = ?, USER_FULLNAME = ?, USER_PASSWORD = ? WHERE USER_ID = ?\");\n $stmt->bind_param(\"sssi\", $userName, $userFullName, $userPass, $userID);\n $stmt->execute();\n\n // return response...\n $user[\"userID\"] = $userID;\n $user[\"userName\"] = $userName;\n $user[\"userFullName\"] = $userFullName;\n setSessionValue(\"user\", $user);\n $response[\"user\"] = $user;\n\n return $response;\n}", "public function updateinfo(Request $request) {\n $id = Auth::User()->id;\n $username = $request->input('username');\n $email = $request->input('email');\n DB::table('users')->where('id', $id)->update(['username' => $username,'email' => $email, 'rank' => $rank]);\n return redirect('/settings', ['rank' => Auth::User()->rank]);\n }", "function updateUser(){\n\t\t\tif($this->rest->getRequestMethod() != \"PUT\"){\n\t\t\t\t$this->rest->response('',406);\n\t\t\t\texit;\n\t\t\t}\n\t\t\t//Validate the user\n\t\t\t$validUser = $this->validateUser(\"admin\", \"basic\");\n\t\t\tif ($validUser) {\n\t\t\t\tif (isset($_POST['user_name']) && isset($_POST['password']) && isset($_POST['_id'])){\n\t\t\t\t\t$user_id = $_POST['_id'];\n\t\t\t\t\t$array['user_name'] = $_POST['user_name'];\n\t\t\t\t\t$array['password'] = $_POST['password'];\n\t\t\t\t\t$result = $this->model->setUser($array, \"_id='\".$user_id.\"'\");\n\t\t\t\t\tif($result) {\n\t\t\t\t\t\t$response_array['status']='success';\n\t\t\t\t\t\t$response_array['message']='One record updated.';\n\t\t\t\t\t\t$update = $this->model->getUser('*',\"_id = \".\"'\".$user_id.\"'\");\n\t\t\t\t\t\t$response_array['data']=$update;\n\t\t\t\t\t\t$this->rest->response($response_array, 200);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$response_array['status']='fail';\n\t\t\t\t\t\t$response_array['message']='no record updated';\n\t\t\t\t\t\t$response_array['data']='';\n\t\t\t\t\t\t$this->rest->response($response_array, 304);\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\t$this->rest->response('No parameters given',204);\t// If no records \"No Content\" status\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$this->rest->response('Unauthorized Access ',401);\t\n\t\t\t}\n\t\t\t\n\n\t\t}", "protected function update()\n {\n $update = 'UPDATE users SET first_name = :first_name, last_name = :last_name,\n email = :email, password = :password WHERE id = :id';\n $statement = self::$dbc->prepare($update);\n foreach ($this->attributes as $key => $value) {\n $statement->bindValue(\":$key\", $value, PDO::PARAM_STR);\n }\n $statement->execute();\n }", "public function updateProfile() {\n\t\t\n\t\treturn $this->_post(self::URL_USERS_UPDATE_PROFILE, $this->_query);\n\t}", "public function Update( )\n {\n\t\t\t$password = \"\";\n\t\t\tif( $this->password!=\"\" )\n\t\t\t{\n\t\t\t\t$password = $this->password;\n\t\t\t}\n\t\t\t\n $dataArray = array( \"userInfo\" =>array( \"email\"=>$this->email,\n\t\t\t\t\t\t\t\t\t\t\t\t \"username\"=>$this->username,\n \"firstname\"=>$this->firstname,\n \"lastname\"=>$this->lastname,\n \"password\"=>$password,\n \"gender\"=>$this->gender,\n \"yearOfBirth\"=>$this->yearOfBirth,\n \"phone\"=>$this->phone,\n \"mobile\"=>$this->mobile,\n \"addressLine1\"=>$this->addressLine1,\n \"addressLine2\"=>$this->addressLine2,\n \"addressCity\"=>$this->addressCity,\n \"addressState\"=>$this->addressState,\n \"addressCountry\"=>$this->addressCountry,\n \"addressZipCode\"=>$this->addressZipCode,\n \"interests\"=>$this->interests,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"newsletters\"=>intval($this->newsletters)\n )\n );\n\t\t\t//Check if isAdmin exists\n\t\t\tif( isset($this->isAdmin) )\n\t\t\t{\n\t\t\t\t$tempArray = array(\"isAdmin\"=>intval($this->isAdmin));\t\t\t\t\n\t\t\t\t$dataArray = array_merge($dataArray,$tempArray);\n\t\t\t}\n\t\t\t\n\t\t\t//Check if recordStatus exists\n\t\t\tif( isset( $this->recordStatus ) )\n\t\t\t{\n\t\t\t\t$tempArray = array(\"recordStatus\"=>intval($this->recordStatus));\n\t\t\t\t$dataArray = array_merge($dataArray,$tempArray);\n\t\t\t}\n\t\t\t//Check if facebook details are provided for update\n\t\t\tif( isset( $this->facebookDetails ) )\n\t\t\t{\n\t\t\t\t$tempArray = array(\"facebookDetails\"=>$this->facebookDetails);\n\t\t\t\t$dataArray = array_merge($dataArray,$tempArray);\n\t\t\t}\n\t\t\t//Check if twitter details are provided for update\n\t\t\tif( isset( $this->twitterDetails ) )\n\t\t\t{\n\t\t\t\t$tempArray = array(\"twitterDetails\"=>$this->twitterDetails);\n\t\t\t\t$dataArray = array_merge($dataArray,$tempArray);\n\t\t\t}\n\t\t\t\n\t\t\t//Check if isDataAdmin field is set\n\t\t\tif( isset( $this->isDataAdmin ) )\n\t\t\t{\n\t\t\t\t$tempArray = array(\"isDataAdmin\"=> $this->isDataAdmin );\t\t\t\t\n\t\t\t\t$dataArray = array_merge( $dataArray, $tempArray );\n\t\t\t}\n\t\t\t\n $response = ServiceAPIUtils::CallAPIService( $dataArray,\"/User/Update/\".$this->id, \"json\" );\n \n return $response;\n }", "public function update_profile() {\n\t\tloggedOnly();\n\n\t\t// Busca o usuario\n\t\t$user = auth();\n\n\t\t// Pega o email\n\t\t$email = $this->input->post( 'email' ) ? \n\t\t\t\t $this->input->post( 'email' ) :\n\t\t\t\t $user->email;\n\n\t\t// Verifica se o email foi alterado\n\t\tif( $email !== $user->email ) {\n\n\t\t\t// Verifica se o email é unico\n\t\t\tif( $this->User->email( $email ) ) {\n\t\t\t\treturn reject( 'E-mail ja cadastrado no sistema' );\n\t\t\t}\n\t\t\t\n\t\t\t// Seta o email\n\t\t\t$user->email = $email;\n\t\t}\n\n\t\t// Verifica se a senha foi alterada\n\t\tif( $password = $this->input->post( 'password' ) ) {\n\t\t\t$user->setPassword( $password );\n\t\t}\n\n\t\t// seta o nome\n\t\t$user->name = $this->input->post( 'name' ) ? \n\t\t\t\t\t $this->input->post( 'name' ) : \n\t\t\t\t\t $user->name;\n\n\t\t// Verifica se a foto foi alterada\n\t\tif( $base64 = $this->input->post( 'image' ) ) {\n\n\t\t\t// Guarda a imagem\n\t\t\tif( $midia_id = $this->__saveUserImage( $base64 ) ) {\n\t\t\t\t$user->midia_id = $midia_id;\n\t\t\t} else return reject( 'Erro ao salvar a imagem do usuário' );\n\t\t}\n\n\t\t// salvar a alteração\n\t\tif( $user->save() ) {\n\t\t\treturn resolve( $user->authData() );\n\t\t} else return reject( 'Erro ao realizar a ação' );\n\t}", "public function update(){\n $file = fopen(\"update.txt\",\"w\") or die (\"Cannot open file!\");\n foreach($this->accounts as $account){\n $line = $account->id.\" \".$account->balance.\"\\n\";\n fwrite($file,$line);\n }\n fclose($file);\n }", "function change_user_info( $user, $key, $config )\n {\n //Unimplemented\n }", "public function updateUser($request)\n {\n $this->name = $request[\"name\"];\n $this->email = trim($request[\"email\"]);\n $this->enabled = $request[\"enabled\"];\n\n if (array_key_exists(\"password\", $request)) {\n $this->password = $this->passwordHash($request[\"password\"]);\n }\n\n if ($request[\"reset-password\"]) {\n $this->password = $this->passwordHash($this->generatePassword(12));\n }\n\n if (Auth::user()->isAdministrator()) {\n $this->access_level = $request[\"access_level\"];\n $this->group_id = $request[\"group_id\"];\n }\n $this->update();\n }", "public function testUpdateUser()\n {\n $userData = [\n \"name\" => \"User 2\",\n \"email\" => \"[email protected]\",\n \"password\" => \"demo12345123\",\n \"org_id\" => 2\n ];\n $id = 4;\n $this->json('PUT', \"api/user/update/$id\", $userData, ['Accept' => 'application/json'])\n ->assertStatus(200)\n ->assertJsonStructure([\n \"action\",\n \"data\" => [],\n \"status\"\n ]);\n }", "public function updateAccount( array $data )\n\t{\n\t\t$passquery = '';\n\t\tif( !empty($data['password']) )\n\t\t{\n\t\t\t$passquery = 'password = :passwd,';\n\t\t}\n\n\t\t$stmt = $this->connection->prepare('UPDATE \n\t\t\t\t\t\t\t\t\t\t\t\t' . Configure::get('database/prefix') . 'accounts\n\t\t\t\t\t\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t\t\t\t\t\t' . $passquery . '\n\t\t\t\t\t\t\t\t\t\t\t\temail = :email,\n\t\t\t\t\t\t\t\t\t\t\t\temail_hash = :hash\n\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t\tid = :uid');\n\t\t$stmt->bindValue(':uid', $data['id'], PDO::PARAM_INT);\n\t\t$stmt->bindValue(':email', $data['email'], PDO::PARAM_STR);\n\t\t$stmt->bindValue(':hash', $data['hash'], PDO::PARAM_STR);\n\n\t\tif( !empty($data['password']) )\n\t\t{\n\t\t\t$stmt->bindValue(':passwd', $data['password'], PDO::PARAM_STR);\n\t\t}\n\n\t\t$success = $stmt->execute();\n\t\t$affected = $stmt->rowCount();\n\t\t$error = $stmt->errorInfo();\n\t\t$stmt->closeCursor();\n\n\t\treturn array(\n\t\t\t'success' => $success,\n\t\t\t'affected_rows' => $affected,\n\t\t\t'error' => $error\n\t\t);\n\t}", "function updateProfile($data) {\ntry {\n\n if (!$conn = connectDB()) {\n return false;\n }\n\n $userId = $_SESSION[\"userId\"];\n $args = array(\n $data[\"firstName\"], $data[\"lastName\"],\n $data[\"phone\"], $data[\"email\"], $data[\"location\"],\n $userId\n );\n\n $sql = <<<SQL\nUPDATE WebUser\nSET firstName=$1, lastName=$2,\n phonenumber=$3, emailaddress=$4, location=$5\nWHERE userId=$6\nSQL;\n\n $result = executeSQL($conn, $sql, $args);\n\n if (getUpdateCount($result) != 1) {\n /* Update was unsuccessful */\n closeDB($conn);\n return false;\n }\n\n /* Update succeeded */\n closeDB($conn);\n return true;\n\n} catch (Exception $e) {\n error(\"updateProfile\");\n closeDB($conn);\n return false;\n}\n}", "public function update_userdetails($data)\n {\n foreach($data as $key=>$val) $$key=get_magic_quotes_gpc()?$val:addslashes($val);\n $userId = Yii::$app->user->id;\n\n $query = new Query;\n\n $result = $query->createCommand()->update('core_users', ['user_name' => $name,'company_name' => $company_name,'company_address' => $address,'designation' => $designation,'company_email' => $company_email], 'user_id = \"'.$userId.'\"')->execute();\n\n if ($result == 1){\n return \"SUCCESS\";\n }else{\n return \"FAILED\";\n }\n }", "public function updatePoinsUserAction()\n {\n \t$this->pointServices->updatePointUser($this->getUser());\n \t\n \treturn new Response(\"OK\");\n }", "public function updateProfile()\n {\n try {\n $email = Crypt::decryptString(request()->hash);\n $user = Customer::whereEmail($email)->first();\n if ($user) {\n $user->fname = request()->fname;\n $user->lname = request()->lname;\n $user->phone = request()->phone;\n $user->address = request()->address;\n if (request()->image)\n $user->image = $this->uploadBase64Image(request()->image);\n\n $user->save();\n\n $user->access_token = Crypt::encryptString($user->email);\n\n return ['status' => true, 'message' => 'Profile updated successfully.', 'data' => $user];\n }//..... end if() .....//\n\n return ['status' => false, 'message' => 'User details not found!.'];\n } catch (\\Exception $exception) {\n return $exception->getMessage();\n return ['status' => false, 'message' => 'Internal server error occurred, please try later.'];\n }\n }", "function updateProfile(){\n\t\t\t\t$this->__dataDecode();\n\t\t\t\t//pr($this->data);die;\n\t\t\t\t\n\t\t\t\tif(!empty($this->data)){\n\t\t\t\t\t$data['User']['firstname'] = $this->data['User']['firstName'];\n\t\t\t\t\t$data['User']['wieght'] = $this->data['User']['wieght'];\n\t\t\t\t\t$data['User']['school'] = $this->data['User']['school'];\n\t\t\t\t\t$data['User']['id'] = $this->data['User']['playerId'];\n\t\t\t\t\t$data['User']['secToken'] = $this->data['User']['secToken'];\n\t\t\t$details = $this->User->find('first', array('conditions' => array('User.id' => $data['User']['id'],'User.secToken' => $data['User']['secToken'])));//pr($details);die;\n\t\t\t\tif(!empty($details)){\n\t\t\t\t\t\tif($this->User->save($data)){\n\t\t\t\t\t\t\t$response['error']\t\t\t= 0;\n\t\t\t\t\t\t\t$response['response']['result'] \t= 'success';\n\t\t\t\t\t\t\t$response['response']['message']\t= 'Profile updated successfully.';\n\t\t\t\t\t\t\t$this->set('response', $response);\n\t\t\t\t\t\t\techo json_encode($response);\n\t\t\t\t\t\t\tdie();\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$response['error']\t\t\t= 1;\n\t\t\t\t\t\t\t$response['response']['result'] \t= 'failure';\n\t\t\t\t\t\t\t$response['response']['message']\t= 'Profile does not updated successfully.';\n\t\t\t\t\t\t\t$this->set('response', $response);\n\t\t\t\t\t\t\techo json_encode($response);\n\t\t\t\t\t\t\tdie();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\telse\n{\n\t\t\t\t\t\t\t$response['error']\t\t\t= 1;\n\t\t\t\t\t\t\t$response['response']['result'] \t= 'failure';\n\t\t\t\t\t\t\t$response['response']['message']\t= 'UnAuthorized User';\n\t\t\t\t\t\t\t$this->set('response', $response);\n\t\t\t\t\t\t\techo json_encode($response);\n\t\t\t\t\t\t\tdie();\n}\n}\n\t\t\t}", "public function updateAccount($uid, array $data)\n {\n return parent::updateAccount($uid, $data);\n }", "public function manageAccountAction()\n {\n $errors = [];\n $preserved = [];\n if(!empty($_POST)){\n $userValidation = new UserValidation($_POST, ['fullname', 'address', 'contact']);\n $errors = $userValidation->getNamedErrors();\n\n $preserved = $_POST;\n\n if(empty($errors)){\n $user = Auth::getUser();\n $user->update($_POST);\n Extra::setMessageCookie(\"Profile updated successfully.\");\n $this->redirect(\"/manage-account/\");\n }\n }\n View::renderTemplate(\"LoggedUser/manage-account.html\", [\n 'errors' => $errors,\n 'preserved' => $preserved\n ]);\n }", "function updateUser()\r\n {\r\n return $this->UD->user_update($_GET['uid']);\r\n }", "public function user_update($data = array())\n\t{\n\t\tunset($data['user']['u_password']);\n\t\t\n\t\t$this->CI->logger->add('users/user_update', $data);\n\t\t\n\t\t// Update the permission cache table\n\t\t$this->CI->load->model('permissions_model');\n\t\t$this->CI->permissions_model->set_cache($data['u_id']);\n\t}", "public static function update() {\n if ( isset($_POST['nickname']) ) {\n self::setNickname($_POST['nickname']);\n } \n if ( isset($_POST['password'])\n && isset($_POST['password2'])\n && isset($_POST['passwordold'])\n && !empty($_POST['password'])\n && !empty($_POST['password2'])\n && !empty($_POST['passwordold'])\n && $_POST['password'] == $_POST['password2'] ) {\n \n $passwordold = Helper::hash($_POST['passwordold'].self::getEmail());\n \n $result = Database::getUser(self::getEmail(),$passwordold);\n \n if ( $result === false || !is_array($result) ) {\n self::setError('Falsches Passwort!<br>');\n return;\n }\n \n if ( count($result) != 1 ) {\n self::setError('Falsches Passwort!<br>');\n return;\n }\n \n $password = Helper::hash($_POST['password'].self::getEmail());\n $success = Database::setPassword(self::getId(),$passwordold,$password);\n \n self::setError('Passwort ge&auml;ndert!<br>');\n }\n \n }", "public function updateUser( UserDataInf $user )\n {\n \n $userName = $user->getName();\n \n $userId = $this->getUserId( $userName );\n $passwd = Password::passwordHash( $user->getPasswd() );\n \n $sqlUser = <<<SQL\nUPDATE wbfsys_role_user\nSET\n name = '{$userName}', \n inactive = FALSE, \n non_cert_login = TRUE,\n profile = '{$user->getProfile()}',\n level = '{$user->getLevel()}',\n password = '{$passwd}'\nWHERE rowid = {$userId}\n;\nSQL;\n \n $this->db->update( $sqlUser );\n \n $personId = $this->db->select( 'SELECT id_person from wbfsys_role_user where rowid = '.$userId );\n \n \n $sqlPerson = <<<SQL\nUPDATE core_person\nSET\nfirstname = '{$user->getFirstname()}', \nlastname = '{$user->getLastname()}'\nWHERE rowid = {$personId};\nSQL;\n\n $this->db->update( $sqlPerson );\n \n }", "function updateMyProfile($data){\r\n global $pdo;\r\n\t\t$update = $pdo->prepare(\"UPDATE users SET `email`= ? WHERE id= ?\");\r\n $update->execute(array($data['email'], $this->user_id));\r\n\t\t$preparedProfileParam = prepareProfileParams($data);\r\n\t\tupdateProfileParameters($this->user_id,$preparedProfileParam);\r\n\t\t$log = debug_backtrace();\r\n\t\t$this->createActionLog($log);\r\n\t\treturn true;\r\n\t}", "public function userinfo()\n {\n if($user = $this->Session->read('user')){\n if(!empty($this->request->data)){\n //update thong tin\n }\n $this->set('user', $user);\n }else{\n $this->redirect(array('action' => 'login', ''));\n }\n }", "public function update_simple($f3) {\n \n if(!isset($_POST[\"password\"]))\n {\n LoggingUtility::LogActivity(\"Updated his own profile settings\",json_encode($f3->get('POST') ));\n }\n else\n {\n LoggingUtility::LogActivity(\"Updated his own password\");\n }\n\n $user = new User($f3->get('DB'));\n $user->edit($f3->get('POST.id'));\n \n if ($user->isFirstLogin()) {\n $f3->reroute('/');\n } else {\n $f3->reroute('/section/settings.profile');\n }\n }", "public function update()\n {\n $user = Auth::user();\n\n $data = request()->validate([\n 'name' => 'required|string',\n 'email' => 'required|string|email|max:255|unique:users,email,' . $user->id,\n ]);\n\n $user->update($data);\n }", "public function update_put()\n {\n $response = $this->UserM->update_user(\n $this->put('id'),\n $this->put('email'),\n $this->put('nama'),\n $this->put('nohp'),\n $this->put('pekerjaan')\n );\n $this->response($response);\n }", "function updateUserInfo($uid,$username,$email,$pwd){\n //check pwd NULL\n if(checkUserLinkedbyId($uid)){\n throw New Exception($uid.\"is already linked\");\n }\n else{\n global $db_php_path;\n require_once($db_php_path);\n $pwd = MD5($pwd);\n $thesql = \"update user set username='$username',email='$email',passwd='$pwd' where id='$uid';\";\n $result = mysql_query($thesql);\n if(!$result){\n throw new Exception(\"error when updating to link a user\".mysql_error());\n }\n }\n}", "function _update ($params = array()) {\n\t\tif (!$this->STATS_ENABLED) {\n\t\t\treturn false;\n\t\t}\n\t\treturn $this->_update_user_stats ($params[\"user_id\"], (array)$params[\"user_info\"]);\n\t}", "public function update_profile_info() {\n\t\t$data = array(\n\t\t\t'first_name' => html_escape($this->input->post('first_name')),\n\t\t\t'last_name' => html_escape($this->input->post('last_name')),\n\t\t\t'biography' => html_escape($this->input->post('biography')),\n\t\t\t'phone' => html_escape($this->input->post('phone')),\n\t\t\t'social_links' => '{\"twitter\":\"' . html_escape($this->input->post('twitter')) . '\",\"facebook\":\"' . html_escape($this->input->post('facebook')) . '\",\"linkedin\":\"' . html_escape($this->input->post('linkedin')) . '\"}',\n\t\t);\n\t\t$this->session->set_userdata('phone', $this->input->post('phone'));\n\t\t$result = $this->user_model->update_user_info($this->session->userdata('user_id'), $data);\n\n\t\tif ($result) {\n\t\t\t$this->session->set_flashdata('profile_info_update_successful', \"Information updated successfully.\");\n\t\t} else {\n\t\t\t$this->session->set_flashdata('failed_to_update_profile_info', \"Failed to update profile info!! Please contact support.\");\n\t\t}\n\n\t\tredirect(site_url('user/profile/info'), 'refresh');\n\t}", "public function updateAction(Account $account) {\n\n\t\t$this->accountRepository->update($account);\n\t\t$this->partyRepository->update($account->getParty());\n\n\t\t$this->addFlashMessage('The profile has been updated.');\n\n\t\t$referrer = $this->request->getReferringRequest();\n\t\t$this->redirect($referrer->getControllerActionName(), $referrer->getControllerName());\n\t}", "public function update(Request $request, $id)\n {\n $user = User::find($id);\n if ($request['status'] == 1) {\n $user->name \t = $request['name'];\n $user->user_lname \t = $request['lname'];\n $user->user_status \t = 1;\n $user->user_phone \t = $request['phone'];\n $user->email \t = $request['email'];\n if ($request->password != null) {\n $user->password \t = Hash::make($request->password);\n }\n if ($request->file('profile') != null) {\n $imgprofile = $request->file('profile');\n foreach($imgprofile as $key => $item) {\n if ($user->user_img != 'nopic.png') {\n unlink('local/storage/app/userprofile/'.$user->user_img);\n }\n $name = rand().time().'.'.$item->getClientOriginalExtension();\n $item->storeAs('userprofile', $name);\n $user->user_img = $name;\n }\n }\n $user->save();\n\n // Activity Log\n $log = new activitylog();\n $log->log_user_id = Auth::user()->user_id;\n $log->log_description = \"Updated Account\";\n $log->log_url = URL::full();\n $log->log_sitemap_id = 1;\n $log->log_activeon_id = $id;\n $log->save();\n }\n if ($user->save()) {\n return back()->withSuccess('New Account Has Been Saved!');\n } else {\n return back()->withError('Something Wrong. New Account Can Not Saved!');\n }\n }", "private function update_account_content()\n\t{\n\t\t$content = array();\n\t\t$content['user'] = $this->user_model->get($this->user->id);\n\t\t$this->load->model('country_model');\n\t\t$content['country_options'] = $this->country_model->get_country_options();\n\t\t\n\t\t$this->load->model('time_zone_model');\n\t\t$content['time_zone_options'] = $this->time_zone_model->get_time_zone_options();\n\t\t\n\t\t$this->load->model('currency_model');\n\t\t$content['currency_options'] = $this->currency_model->get_currency_options();\n\n\t\treturn $this->load->view('user_account/partials/user_account_edit', $content, TRUE);\n\t}", "public function update(UpdateAccountRequest $request)\n\t{\n\t\t$user = \\Auth::user();\n\t\t$user->name = $request->name;\n $user->email = $request->email;\n\t\t$oldpass = $request->oldpass;\n\t\t$newpass = $request->newpass;\n\t\t$confirmpass = $request->newpass_confirmation;\n\t\tif(!empty($oldpass) || !empty($newpass) || $confirmpass) {\n\t\t\t// Check oldpass is true\n\t\t\tif(Hash::check($oldpass,$user->password)) {\n\t\t\t\t// Check newpass and confirmpass are the same\n\t\t\t\tif($newpass == $confirmpass) {\n\t\t\t\t\t$user->password = Hash::make($newpass);\n\t\t\t\t} else {\n\t\t\t\t\t\\Session::flash('notify-type', 'error');\n\t\t\t\t\t\\Session::flash('message', 'Passwords provided were not the same.');\n\t\t\t\t\treturn redirect()->back();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t\\Session::flash('notify-type', 'error');\n\t\t\t\t\\Session::flash('message', 'The old password provided was incorrect.');\n return redirect()->back();\n\t\t\t}\n\t\t}\n\t\t$result = $user->save();\n\t\tif($result) {\n\t\t\t\\Session::flash('message', $user->name.' was updated successfully.');\n\t\t\treturn redirect('/account');\n\t\t}\n\t}", "public function indexApUpdate(){\n //This will be used to display in the Wizard of available Realms in the Create screens of Vouchers; Permanent Users; and Devices\n $user = $this->Aa->user_for_token($this);\n if(!$user){ //If not a valid user\n return;\n }\n $this->_doApListFor($user,'update'); \n }", "public function update_profile($username,$email,$surname,$finame,$status,$address,$state,$dob){\r\n $update_profile = \"UPDATE student_registration SET username='$username', email='$email', surname='$surname', firstname='$finame', status='$status', address='$address', state='$state', dob='$dob' WHERE email='$email'\";\r\n $update_query = $this->conn->query($update_profile);\r\n if($update_query){\r\n echo \"<script>\r\n alert('Your profile has been updated successfully');\r\n window.location = 'my_profile.php';\r\n </script>\";\r\n }\r\n \r\n }", "function user_edit($user_info)\n {\n }", "function updateUser($data){\r\n global $pdo;\r\n if($data['pwd']!=''){\r\n\t\t$update = $pdo->prepare(\"UPDATE users \r\n SET `first_name`= ?,`email`= ?, `password`= ?, \r\n `username`= ?, `type`= ?, `role`= ? \r\n WHERE id= ?\");\r\n $update->execute(array($data['name'], $data['email'], $this->getPasswordHashOfUser($data['userName'],$data['pwd']), \r\n $data['userName'], $data['userType'], $data['role'], $data['userId']));\r\n\r\n //update the password log\r\n $this->updatePasswordLog($this->getPasswordHashOfUser($data['userName'],$data['pwd']));\r\n\r\n }else{\r\n $update = $pdo->prepare(\"UPDATE users \r\n SET `first_name`= ?,`email`= ?, \r\n `username`= ?, `type`= ?, `role`= ? \r\n WHERE id= ?\");\r\n $update->execute(array($data['name'], $data['email'],$data['userName'], \r\n $data['userType'], $data['role'], $data['userId']));\r\n }\r\n\t\t\t\t\t$log = debug_backtrace();\r\n\t\t\t\t\t$this->createActionLog($log);\r\n\t\t\t\t\treturn true;\r\n\t}", "public function updateprofileAction()\n\t{\n\t\t$this->view->headTitle(\"Update Your Profile\");\n\t\t\n\t\t//if not logged in, user can't edit profile\n\t\tif(!$this->loggedEmail){\n\t\t\t$this->_redirect('/'); \n\t\t\treturn;\n\t\t}\n\t\t\n\t\t$user = new Default_Model_User();\n\t\t$resultRow = $user->getUserByEmail($this->loggedEmail);\n\t\t\n\t\tif($this->getRequest()->isPost()){\n\t\t\t\n\t\t\t$resultRow->email = $this->getRequest()->getPost('email');\n\t\t\t$resultRow->first_name = $this->getRequest()->getPost('first_name');\n\t\t\t$resultRow->last_name = $this->getRequest()->getPost('last_name');\n\t\t\t$resultRow->gender = $this->getRequest()->getPost('gender');\n\t\t\t$resultRow->address = $this->getRequest()->getPost('address');\n\t\t\t\n\t\t\tif(strlen($this->getRequest()->getPost('password'))){\n\t\t\t\t$resultRow->password = $this->getRequest()->getPost('password');\n\t\t\t}\n\t\t\t$resultRow->updated_at = date('Y-m-d H:i:s');\n\t\t\t$resultRow->save();\n\t\t\t\n\t\t} \n\t\t\t\n\t\t$this->view->email = $resultRow->email;\n\t\t$this->view->first_name = $resultRow->first_name;\n\t\t$this->view->last_name = $resultRow->last_name;\n\t\t$this->view->gender = $resultRow->gender;\n\t\t$this->view->address = $resultRow->address;\n\t\t$this->view->handle = $resultRow->handle;\n\t\n\t}", "public function update(){\n\t\t$sql = \"update \".self::$tablename.\" set name=\\\"$this->name\\\",lastname=\\\"$this->lastname\\\",username=\\\"$this->username\\\",email=\\\"$this->email\\\",kind=\\\"$this->kind\\\",status=\\\"$this->status\\\" where id=$this->id\";\n\t\tExecutor::doit($sql);\n\t}", "public function account_update()\n {\n $user = Auth::user();\n \n $input = request()->validate([\n 'name' => 'required|string|max:255',\n 'email' => 'required|string|email|max:255|unique:users,email,' . request()->user()->id,\n 'phone' => 'required|string|max:255|unique:users,phone,' . request()->user()->id,\n 'password' => 'nullable|string|min:6|confirmed',\n 'password_old' => 'nullable|string|min:6',\n 'profile_picture' => 'nullable|image'\n ]);\n // var_dump($input['profile_picture'] );exit;\n if(request()->profile_picture) {\n $input['profile_picture'] = $this->image_upload(request(),'profile_picture');//request()->profile_picture->store('profile_pictures');\n // $input->profile_picture = $picture;\n }\n if (empty($input['password'])) {\n unset($input['password']);\n } else {\n if (Hash::check(request()->password_old, request()->user()->password)) {\n $input['password'] = bcrypt($input['password']);\n }\n }\n request()->user()->update($input);\n\n return back();\n }", "function feuserloginsystem_updateUserStatisticEntry() {\r\n\r\n # Get existing statistic information for the current user and session.\r\n $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(\r\n\t\t\t'uid,feuserid,sessionstart,lastpageview,pagecounter,pagetracking',\r\n\t\t\t'tx_feuserloginsystem_userstatistics',\r\n\t\t\tsprintf('feuserid=\\'%s\\'',addslashes(intval($this->fe_user->user[\"uid\"]))),\r\n\t\t\t'',\r\n\t\t\t'sessionstart DESC',\r\n\t\t\t'1'\r\n \t);\r\n \t$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);\r\n\r\n \t# Existing statistic information could be found.\r\n \tif(is_array($row)) {\r\n\r\n $timeStamp = time();\r\n\r\n # Unserialize page tracking information.\r\n $pagetrackingArray = unserialize($row['pagetracking']);\r\n # Add new page tracking information to the already existing page tracking information.\r\n $pagetrackingArray[] = array('time' => $timeStamp, 'pageID' => intval($this->id));\r\n\r\n\t\t\t#Update commom information for statistics.\r\n\t\t $insertDataArray = array();\r\n\t\t $insertDataArray['lastpageview'] = $timeStamp;\r\n\t\t $insertDataArray['pagecounter'] = intval($row['pagecounter'] + 1);\r\n\t\t $insertDataArray['pagetracking'] = serialize($pagetrackingArray);\r\n\r\n\t\t # Update statistic information in the database.\r\n $GLOBALS['TYPO3_DB']->exec_UPDATEquery(\r\n 'tx_feuserloginsystem_userstatistics',\r\n sprintf('uid=\\'%s\\'',addslashes(intval($row['uid']))),\r\n $insertDataArray\r\n );\r\n\r\n }\r\n\r\n }", "public function update($medAccount);", "function updateUser($nombre, $apellido, $email, $id){\r\n $query=\"UPDATE users SET nombre='$nombre', apellido='$apellido', email='$email' WHERE id='$id';\";\r\n mysqli_query($_SESSION['connection'], $query);\r\n }", "public function update_profile($username, $password, $firstname,$lastname,$email){\n $query = \"UPDATE appuser SET password = $1, firstname = $2, lastname = $3, email=$4 WHERE username = $5;\";\n $query_prep = pg_prepare($this->con, \"my_query44\", $query);\n $query_prep = pg_execute($this->con, \"my_query44\", array($password, $firstname, $lastname, $email, $username));\n $num_rows = pg_affected_rows($query_prep);\n return $num_rows; //Returns 1 if successfully updates\n\n }", "public function update(UserRequest $request)\n {\n\n \t// Validate the request\n \t$request->validated();\n\n\n \t// Update account details\n try {\n\n\t \t$request->user()->fill([\n\t 'name' \t\t=> $request->name,\n\t 'email' \t=> $request->email,\n\t 'timezone' \t=> $request->timezone\n\t ])->save();\n\n return response(['message' => 'Your account settings were successfully updated.'], 200);\n \n } catch (Exception $e) {\n return response(['message' => $e->getMessage()], 500);\n }\n }", "public function changeLoggedUserInfo() {\n try {\n /* Check if for the empty or null id, username and password parameters */\n if (isset($_POST[\"id\"]) && isset($_POST[\"username\"]) && isset($_POST[\"password\"]) && isset($_POST[\"email\"])) {\n // Get the id, username and password parameters from POST request\n $form_data = array(\n ':id' => $_POST[\"id\"],\n ':username' => $_POST[\"username\"],\n ':password' => $_POST[\"password\"],\n ':email' => $_POST[\"email\"]\n );\n // Check for existent data in Database\n $query = \"\n select access\n from tb_user \n where id = ?\n \";\n // Create object to connect to MySQL using PDO\n $mysqlPDO = new MySQLPDO();\n // Prepare the query\n $statement = $mysqlPDO->getConnection()->prepare($query);\n // Execute the query with passed parameter id\n $statement->execute([$form_data[':id']]);\n // Get affect rows in associative array\n $row = $statement->fetch(PDO::FETCH_ASSOC);\n // Check if any affected row\n if ($row) {\n // Create a SQL query to update the existent user with a new username and password for this passed id\n $query = \"\n update tb_user\n set username = :username, \n password = :password, \n email = :email\n where id = :id\n \";\n // Prepare the query\n $statement = $mysqlPDO->getConnection()->prepare($query);\n // Execute the query with passed parameter id, username and password\n $statement->execute($form_data);\n // Check if any affected row\n if ($statement->rowCount()) {\n // Check for open session\n if (isset($_SESSION['views'])) {\n // Update new logged user info into session\n $_SESSION[$_SESSION['views'].'id'] = $form_data[':id'];\n $_SESSION[$_SESSION['views'].'username'] = $form_data[':username'];\n $_SESSION[$_SESSION['views'].'password'] = $form_data[':password'];\n $_SESSION[$_SESSION['views'].'email'] = $form_data[':email'];\n $_SESSION[$_SESSION['views'].'access'] = $row['access'];\n // data[] is a associative array that return json\n $data[] = array('result' => '1');\n } else {\n $data[] = array('result' => 'There is no such session available!');\n }\n } else {\n $data[] = array('result' => 'No operations performed on the database!');\n }\n } else {\n $data[] = array('result' => 'Nvalid user id!');\n }\n } else {\n // Check for missing parameters\n if (!isset($_POST[\"id\"]) && !isset($_POST[\"username\"]) && !isset($_POST[\"password\"]) && !isset($_POST[\"email\"])) {\n $data[] = array('result' => 'All missing parameters for changing the authenticated user data!');\n } elseif (!isset($_POST[\"id\"])) {\n $data[] = array('result' => 'Missing id parameter !!');\n } elseif (!isset($_POST[\"username\"])) {\n $data[] = array('result' => 'Missing username parameter!!');\n } elseif (!isset($_POST[\"password\"])) {\n $data[] = array('result' => 'Missing password parameter!!');\n } else {\n $data[] = array('result' => 'Missing email parameter !!');\n }\n }\n return $data;\n } catch (PDOException $e) {\n die(\"Error message: \" . $e->getMessage());\n }\n }", "public function update(){\n\t\tparent::update(\"UPDATE Users set privacy_setting = \" . $this->privacy_setting . \" where id = \" . $this->id);\n\t}", "function update()\n {\n global $db, $fullname, $email, $Dateofbirth, $Phonenumber, $Occupation, $Address, $gender, $path, $nationality, $user_type;\n\n $id = $_POST['id'];\n $fullname = $_POST['fullname'];\n $Dateofbirth = $_POST['dbirth'];\n $Phonenumber = $_POST['phonenumber'];\n $Occupation = $_POST['occupation'];\n $Address = $_POST['address'];\n $gender = $_POST['mradio'];\n $email = $_POST['email'];\n $$user_type = $_POST['user_type'];\n $path = $_FILES['image'];\n $nationality =$_POST['nationality'];\n $path = mysqli_real_escape_string($db, '../images/uploads/' . $_FILES['image']['name']);\n copy($_FILES['image']['tmp_name'], $path);\n\n mysqli_query($db, \"UPDATE users SET name='$fullname', 'admin','$Occupation','$Address','$Phonenumber', '$Dateofbirth','$gender','$email','$nationality','$path' WHERE id=$id\");\n $_SESSION['message'] = \"Address updated!\";\n header('location: ../members.php');\n \n }", "public function updateAccount(UpdateAccountRequest $request)\n {\n $user = Auth::user();\n $user->password = Hash::make($request->get('password'));\n $user->save();\n\n flashy()->success('密码修改成功, 请重新登陆');\n Auth::logout();\n\n return $this->redirectToRoute('auth.login');\n }", "function editInfo($user) {\n\n if (isset ($_POST ['submit'])) {\n $newUsername = trim(strip_tags($_POST['username']));\n $newFirstName = trim(strip_tags($_POST['firstname']));\n $newLastName = trim(strip_tags($_POST['lastname']));\n $newEmail = trim(strip_tags($_POST['email']));\n\n if(!empty($_POST['username']) AND !empty($_POST['email']) AND !empty($_POST['firstname'] AND !empty($_POST['lastname']))) {\n\n if(strlen($newUsername) <= 100 && strlen($newFirstName) <= 100 && strlen($newLastName) <= 100) {\n\n if (filter_var($newEmail, FILTER_VALIDATE_EMAIL)){\n\n $bdd = dbConnect();\n $reqmail = $bdd->prepare(\"SELECT * FROM user WHERE email = ?\");\n $reqmail->execute(array($newEmail));\n\n if ($reqmail->rowCount() > 0){\n $result = $reqmail->fetch(PDO::FETCH_ASSOC);\n if ($result['username'] == $user) // We can replace its old mail with the same one\n $mailexist = 0;\n else\n $mailexist = 1;\n }\n\n $requsername = $bdd->prepare(\"SELECT * FROM user WHERE username = ?\");\n $requsername->execute(array($newUsername));\n\n if ($requsername->rowCount() > 0){\n $result = $requsername->fetch(PDO::FETCH_ASSOC);\n if ($result['username'] == $user) // We can replace its old username with the same one\n $usernameexist = 0;\n else\n $usernameexist = 1;\n }\n\n if($mailexist == 0) {\n if($usernameexist == 0) {\n try {\n $stmt = $bdd->prepare(\"UPDATE user SET username=:newUsername, first_name=:newFirstName, last_name=:newLastName, email=:newEmail WHERE username=:username\");\n $stmt->execute(array(\n 'newUsername' => $newUsername,\n 'newFirstName' => $newFirstName,\n 'newLastName' => $newLastName,\n 'newEmail' => $newEmail,\n 'username' => $user\n ));\n $_SESSION['username'] = $newUsername;\n }\n catch(PDOException $e) {\n echo $sql . \"<br>\" . $e->getMessage();\n }\n return 0;\n\n } else\n return -3; // Username already used\n } else\n return -2; // Mail already used\n }\n }\n }\n }\n\n return -1;\n\n }", "function updateAccount($accountId, $username, $password, $retypedPassword, $email, $status)\n\t\t{\n // escape the characters that are needed to escaped to avoid sql injection\n $username = mysql_escape_string($username);\n $password = mysql_escape_string($password);\n $retypedPassword = mysql_escape_string($retypedPassword);\n $email = mysql_escape_string($email);\n \n\t\t\t// validate the username\n\t\t\t$usernameError = $this -> validateUsername($accountId, $username);\n\t\t\t\n\t\t\t// validate the password\n\t\t\t$passwordError = $this -> validatePassword($password, $retypedPassword);\n\t\t\t\n\t\t\t// validate the email\n\t\t\t$emailError = $this -> validateEmail($accountId, $email);\n\t\t\t\n\t\t\t// check for errors\n\t\t\tif($usernameError == null && $passwordError == null && $emailError == null)\n\t\t\t{\n\t\t\t\t// if validation has passed, update the account\n\t\t\t\tmysql_query(\"UPDATE argus_accounts SET username = '\".$username.\"', password = '\".$password.\"', email = '\".$email.\"', status = '\".$status.\"' WHERE account_id = '\".$accountId.\"'\") or die(mysql_error());\n\t\t\t\t\n\t\t\t\t// return successful update\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// if validation failed, set the errors\n\t\t\t\t$this -> errors = array(\"username\" => $usernameError, \"password\" => $passwordError, \"email\" => $emailError);\n\t\t\t\t\n\t\t\t\t// return unsuccessful update\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\treturn;\n\t\t}", "public function updatePrivateAccount()\n {\n $dbh = new PDO('mysql:host=' . HOST . ';dbname=' . DBNAME, USER, PASSWORD, array(\n PDO::MYSQL_ATTR_INIT_COMMAND => \"SET NAMES utf8\",\n PDO::ATTR_PERSISTENT => true\n ));\n\n $userisPrivate = $this->getPrivateAccount();\n\n if ($userisPrivate == 0) {\n $userSetPrivateTo = 1;\n } else {\n $userSetPrivateTo = 0;\n }\n\n try {\n $sqlUpdatePrivateAccount = \"UPDATE user SET privateAccount = :update_private_account WHERE id = :id_user\";\n $psUpdatePrivateAccount = $dbh->prepare($sqlUpdatePrivateAccount);\n $psUpdatePrivateAccount->execute(array(':update_private_account' => $userSetPrivateTo, ':id_user' => $this->idUser));\n } catch (PDOException $e) {\n print \"Erreur !: \" . $e->getMessage() . \"<br>\";\n die();\n }\n }", "public function p_profile_edit() {\n $duplicate = DB::instance(DB_NAME)->select_field(\"SELECT email FROM users WHERE email = '\" . $_POST['email'] . \"' AND email != '\" . $this->user->email . \"'\");\n\n //If email already exists \n if($duplicate){ \n \n //Redirect to error page \n Router::redirect('/users/profile/?duplicate=true');\n }\n\n\n // Encrypt the password \n $_POST['password'] = sha1(PASSWORD_SALT.$_POST['password']); \n\n // Create an encrypted token via their email address and a random string\n $_POST['token'] = sha1(TOKEN_SALT.$_POST['email'].Utils::generate_random_string()); \n\n $q = \"UPDATE users\n SET first_name = '\".$_REQUEST['first_name'].\"',\n last_name = '\".$_REQUEST['last_name'].\"',\n email = '\".$_REQUEST['email'].\"'\n WHERE id = '\".$this->user->id.\"'\";\n\n DB::instance(DB_NAME)->query($q);\n Router::redirect(\"/users/profile\");\n\n \n }", "public function updateAccountPost(Request $request) \n {\n // dd($request->all());\n $accountAction = ''; \n $userAction = '';\n $isEamil = false;\n $sendRightEmail = false;\n $isEamil = User::isUserExist($request->get('email')); \n if(!$isEamil) {\n // print \"email not exist\"; \n User::find(Auth::user()->id)->update(['email'=>$request->get('email')]); \n } else {\n print \"Email exist, failed to update <b>x</b><br>\";\n $userAction .= \"Email exist, failed to update. \"; \n }\n\n $sendRightEmail = Account::isSendRightEmailExist($request->get('sendright_email'));\n if(!$sendRightEmail) { \n Account::find(User::getUserAccount())->update(['sendright_email'=>$request->get('sendright_email')]); \n } else {\n print \"Sendright Email exist, failed to update <b>x</b><br>\";\n $userAction .= \"Sendright Email exist, failed to update. \"; \n }\n \n\n $user = User::find(Auth::user()->id)->update(['name'=>$request->get('name')]); \n\n $account = Account::find(User::getUserAccount())->update(['company'=>$request->get('company')]); \n\n\n\n if(!$isEamil) { \n print \"Email successfully update <i class='fa fa-check' aria-hidden='true'></i><br>\"; \n $userAction .= \"Email successfully update\"; \n } \n if(!$sendRightEmail) { \n print \"Sendright Email successfully update <i class='fa fa-check' aria-hidden='true'></i><br>\"; \n $userAction .= \"Sendright Email successfully update\"; \n } \n\n\n if($user === true) {\n print \"Full name successfully updated <i class='fa fa-check' aria-hidden='true'></i> <br>\";\n $userAction .= \"Full name successfully updated\";\n } else {\n print \"Something wrong full name failed updated<span class='glyphicon-class'></span><br>\";\n $userAction .= \"Something wrong full name failed updated\";\n }\n \n if($account === true) {\n print \"Company successfully updated <i class='fa fa-check' aria-hidden='true'></i><br>\"; \n $accountAction .= \"Company successfully updated\"; \n } else {\n print \"Something wrong company failed updated <b>x</b><br>\";\n $accountAction .= \"Something wrong company failed updated\"; \n } \n\n\n\n\n // print \"user action \" . $userAction; \n // print \"user action \" . $accountAction; \n Activity::createActivity(['table_name'=>'users', 'table_id'=>Auth::user()->id, 'action'=>$userAction]);\n Activity::createActivity(['table_name'=>'accounts', 'table_id'=>User::getUserAccount(), 'action'=>$accountAction]); \n // print \"Your account password successfully updated, try logout and log in now!\"; \n }", "function updateProfile()\n\t\t{\n\t \t$pass = \"\";\n\t\t \tif(strlen($this->updProfile['password'])){\n\t\t\t\t$pass=\", password ='\".$this->updProfile['password'].\"'\";\n\t\t \t} \n\t\t \n\t\t\t$query = \"UPDATE tbl_member SET first_name='\".$this->updProfile['firstName'].\"',\n\t\t last_name = '\".$this->updProfile['lastName'].\"',\n\t\t email = '\".$this->updProfile['email'].\"',\n\t\t user_name = '\".$this->updProfile['UserName'].\"'{$pass}\n\t\t WHERE member_id = '\".$this->updProfile['ID'].\"'\";\n\t\t \n\t\t\t$this->Execute($query);\n\t\t \n\t\t\t$query = \"UPDATE tbl_subscriber \n\t\t\tSET mail_street_address ='\".$this->updProfile['streetAddress'].\"',\n\t\t mail_city='\".$this->updProfile['City'].\"',\n\t\t bill_street_address ='\".$this->updProfile['billingAddress'].\"' ,\n\t\t bill_city ='\".$this->updProfile['billCity'].\"',\n\t\t mail_state ='\".$this->updProfile['state'].\"',\n\t\t mail_zip_code ='\".$this->updProfile['zipCode'].\"',\n\t\t bill_state ='\".$this->updProfile['billState'].\"',\n\t\t bill_zip_code ='\".$this->updProfile['billZipCode'].\"',\n\t\t is_address_changed ='\".$this->updProfile['is_address_changed'].\"',\n\t\t secondary_affiliates ='\".$this->updProfile['secondary_afflliates'].\"'\n\t\t \n\t\t WHERE subscriber_id = '\".$this->updProfile['ID'].\"'\";\n\t\t \n\t\t return $this->Execute($query);\n\t\t //return $this->_getPageArray($rs, 'Subscriber');*/\n\t\t}" ]
[ "0.7884176", "0.74927115", "0.74875236", "0.73785305", "0.7355444", "0.7265568", "0.72541094", "0.71562374", "0.71379924", "0.7118838", "0.70697623", "0.70301", "0.702997", "0.70167625", "0.7001047", "0.6990665", "0.693241", "0.69005805", "0.6889815", "0.6877632", "0.6859657", "0.6850531", "0.68335116", "0.68056923", "0.6802537", "0.67897373", "0.6751391", "0.6741608", "0.6733708", "0.6701413", "0.66709906", "0.6668613", "0.66537786", "0.6653371", "0.6634651", "0.6621051", "0.66061693", "0.65813124", "0.6580413", "0.6566943", "0.65626866", "0.6562271", "0.6550948", "0.6549542", "0.6531166", "0.65305126", "0.6530148", "0.6528629", "0.64968383", "0.64959586", "0.6493885", "0.6487418", "0.648604", "0.64847994", "0.64841586", "0.6482675", "0.64816403", "0.6464991", "0.64586633", "0.6456607", "0.64453894", "0.6441184", "0.6436035", "0.64223915", "0.6422381", "0.64100355", "0.6408946", "0.6406951", "0.64040685", "0.64011157", "0.6398035", "0.6396264", "0.63835275", "0.6380442", "0.63715005", "0.63663334", "0.63663155", "0.6358827", "0.6358797", "0.6348654", "0.6326904", "0.6321894", "0.6307731", "0.6300603", "0.6299234", "0.62953997", "0.6295367", "0.6293097", "0.6292129", "0.62906533", "0.62858176", "0.628188", "0.6281073", "0.62795496", "0.627732", "0.62763256", "0.627398", "0.6265322", "0.6261269", "0.6260906" ]
0.66218793
35
function to trigger user account password change
function changePassword($password, $userid){ $query = "UPDATE users_account SET password = ? WHERE userid = ?"; $paramType = "si"; $paramValue = array( $password, $userid ); $this->db_handle->update($query, $paramType, $paramValue); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function changePassword() {}", "function regiomino_user_change_password($account, $password) {\r\n\t//watchdog('pwdaction', '@password', array('@password' => $password));\r\n $edit['pass'] = $password;\r\n user_save($account, $edit);\r\n}", "public function changeUserPassword($uid,$newPassword);", "function user_changed_password($user_id, $new_password) {\n \n }", "function eventUpdatePassword(){\r\n\t\t$userid = util::getData(\"id\");\r\n\t\t$password1 = util::getData(\"password1\");\r\n\t\t$password2 = util::getData(\"password2\");\r\n\r\n\t\tif(!$this->canUpdateUser($userid))\r\n\t\t\treturn $this->setEventResult(false, \"You cannot update this account\");\r\n\r\n\t\t$result = dkpAccountUtil::SetOfficerAccountPassword($this->guild->id, $userid, $password1, $password2);\r\n\r\n\t\tif($result != dkpAccountUtil::UPDATE_OK)\r\n\t\t\t$this->setEventResult(false, dkpAccountUtil::GetErrorString($result));\r\n\t\telse\r\n\t\t\t$this->setEventResult(true,\"Password Changed!\");\r\n\r\n\t}", "function update_password()\n {\n }", "function user_changed_password($user_id, $new_password)\n\t{\n\t}", "public function changePassword(User $user, string $newPassword): void;", "public function change(string $password): void;", "function wp_password_change_notification($user)\n {\n }", "public function post_changePassword() {\n //try to change the password\n $status = AuxUser::changePassword();\n if ($status[0]) {\n //if the password change process worked, redirect to the profile page\n echo '<script>alert(\"Password Changed\");</script>';\n Response::redirect('/profile');\n } else {\n //if not, print the error message\n echo '<script>alert(\"'.$status[1].'\");</script>';\n Response::redirect('/profile');\n }\n }", "public function change_password()\n {\n $currentPassword = $this->input->post('currentPassword');\n $newPassword = $this->input->post('newPassword');\n\n $isPasswordChanged = $this->CustomModel->changePassword(\n $_SESSION['u_id'], $currentPassword, $newPassword\n );\n\n if ($isPasswordChanged) {\n echo 'success';\n }\n }", "public function changeAdminUserPassword() {\n\t\t$data = $this->request->data['User'];\n\n\t\t$this->User->id = $userId = $data['id'];\n\t\tif ($this->User->saveField('password', $data['new_password'])) {\n\t\t\t$isPasswordChanged = ($data['current_password'] !== $data['new_password']) ? true : false;\n\t\t\tif ($isPasswordChanged && ($userId !== $this->Auth->User('id'))) {\n\t\t\t\t$this->__sendPasswordChangedEmail($data);\n\t\t\t}\n\t\t\t$this->Session->setFlash(__('Password changed successfully.'), 'success');\n\t\t} else {\n\t\t\t$this->Session->setFlash(__('Could not change the password due a server problem, try again later.'), 'error');\n\t\t}\n\n\t\t$this->redirect('/admin/users/editAdmin/' . $userId);\n\t}", "function changepassword() \n\t{\n // on the action being rendered\n $this->viewData['navigationPath'] = $this->getNavigationPath('users');\n $this->viewData['hash'] =User::userid();\n // Render the action with template\n $this->renderWithTemplate('users/changepassword', 'AdminPageBaseTemplate');\n }", "public function account_change_password()\n\t{\n\t\t$data = array('password' => $this->input->post('new_password'));\n\t\tif ($this->ion_auth->update($this->mUser->id, $data))\n\t\t{\n\t\t\t$messages = $this->ion_auth->messages();\n\t\t\t$this->system_message->set_success($messages);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$errors = $this->ion_auth->errors();\n\t\t\t$this->system_message->set_error($errors);\n\t\t}\n\n\t\tredirect('admin/panel/account');\n\t}", "public function changePassword($username, $password);", "function changepass_firsttime()\n {\n $userId = $this->userInfo('user_id');\n \n $result = $this->update('user', array('password' => $this->value('password'), 'modified' => date('Y-m-d H:i:s')), \" user_id = \".$userId);\n \n if($result === TRUE)\n {\n //this will prevent user from being logged out automatically. (as it happens in old implementation)\n $_SESSION['password'] = $this->value('password');\n \n //update the patient_history table with \"password change\" action to 'complete'\n $data = array(\n 'patient_id' => $userId,\n 'action_type' => 'first time login',\n 'action' => 'password change', \n 'action_status' => 'complete',\n 'action_time' => date('Y-m-d H:i:s')\n );\n $this->insert('patient_history', $data);\n \n echo \"{success:true, message:'Password updated successfully'}\";\n }\n else\n {\n echo \"{success:false, message:'Password update failure'}\";\n }\n }", "public function Change_user_password() {\n\t\t$this->load->helper('pass');\n\t\t$user = $this->administration->getMyUser($this->user_id);\n\t\t//password\n\t\t$old_pass = $this->input->post('oldPassword');\n\t\t$newPass = $this->input->post('newPassword');\n\t\t$confirmNewPass = $this->input->post('confirmNewPassword');\n\t\tif($newPass == $confirmNewPass) {\n\t\t\t//check if old password is corrent\n\t\t\t$verify = $this->members->validateUser($user->Username,$old_pass);\n\t\t\tif($verify) {\n\t\t\t\t//validate if the password is in the correct format\n\t\t\t\t$valid_new_pass = checkPasswordCharacters($newPass);\n\t\t\t\tif($valid_new_pass) {\n\t\t\t\t\t$change_pass = $this->members->simple_pass_change($user->ID,$newPass);\n\t\t\t\t\tif($change_pass) {\n\t\t\t\t\t\techo '1';\n\t\t\t\t\t}else {\n\t\t\t\t\t\techo '6';\t\n\t\t\t\t\t}\n\t\t\t\t}else {\n\t\t\t\t\techo '7';\t\n\t\t\t\t}\n\t\t\t}else {\n\t\t\t\techo '8';\t\n\t\t\t}\n\t\t}else {\n\t\t\techo '9';\t\n\t\t}\n\t}", "public function account_change_password()\n\t{\n\t\t$user_session = $this->session->all_userdata();\n\t\t$user_id = $user_session['user_id'];\n\t\t\n\t\t// print_r($user_id);\n\t\t// die;\n\n\t\t$new_password = $this->input->post('new_password');\n\t\t$retype_password = $this->input->post('retype_password');\n\n\t\tif ($new_password != $retype_password)\n\t\t{\n\t\t\t$this->system_message->set_error(\"Password Miss Match\");\n\n\t\t}\n\t\telse{\n\t\t\t$data = array('password' => $this->input->post('new_password'));\n\t\t\tif (!empty($new_password) && !empty($retype_password))\n\t\t\t{\n\t\t\t\tif ($this->ion_auth->update($this->mUser->id, $data))\n\t\t\t\t{\n\t\t\t\t\t$this->custom_model->my_update(array('password_show'=>$new_password),array('id' => $user_id),'admin_users');\n\t\t\t\t\techo \"success\"; die;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\techo \"error\"; die;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\techo \"error\"; die;\n\t\t\t}\n\t\t}\n\t\t\n\t}", "public function setPassword($newPassword);", "public function changePassword(PasswordChangeForm $form, User $user);", "function update_paypassword()\n {\n }", "public function change_password()\n\t{\n\t\t$this->load->model('admin_user_model', 'admin_users');\n\t\t$updated = $this->admin_users->change_password($this->mUser->id, $this->input->post('new_password'));\n\n\t\tif ($updated)\n\t\t{\n\t\t\tset_alert('success', 'Successfully changed password.');\n\t\t}\n\t\telse\n\t\t{\n\t\t\tset_alert('danger', 'Failed to changed password.');\n\t\t}\n\n\t\tredirect('admin/account');\n\t}", "function change_password()\n {\n if ($user = $this->authorized(USER))\n {\n $descriptive_names = array(\n 'current_password' => 'Current Password',\n 'new_password' => 'New Password',\n 'new_password_confirm' => 'Confirm Password'\n );\n\n $rules = array(\n 'current_password' => ($user['group_id']==0)?'clean':'required|clean',\n 'new_password' => 'required|clean',\n 'new_password_confirm' => 'required|clean'\n );\n\n $this->loadLibrary('form.class');\n $form = new Form();\n\n $form->dependencies['title'] = \"Change Password\";\n $form->dependencies['form'] = 'application/views/change-password.php';\n $form->dependencies['admin_reset'] = false;\n $form->dependencies['client_id'] = $user['id'];\n $form->form_fields = $_POST;\n $form->descriptive_names = $descriptive_names;\n $form->view_to_load = 'form';\n $form->rules = $rules;\n\n if ($fields = $form->process_form())\n {\n\n $this->loadModel('UserAuthentication');\n\n\n if ($this->UserAuthentication->change_password($user['id'], $fields['current_password'], $fields['new_password'], $fields['new_password_confirm']))\n {\n $this->alert(\"Password Updated\", \"success\");\n $this->redirect(\"portal/home\");\n }\n else\n {\n $this->alert(\"Error: Password Not Updated\", \"error\");\n $this->redirect(\"portal/home\");\n }\n }\n }\n }", "public function changePassword()\n {\n if( ! Session::isLoggedIn() )\n {\n SCMUtility::frontRedirectTo('?page=scmCourseModule&state=Front&action=myAccount');\n return;\n }\n\n $user = User::find(Session::getCurrentUserID());\n\n View::make('templates/front/change-password.php',array());\n }", "public function change_password() {\n\t\treturn view( 'provider.profile.change_password' );\n\t}", "function request_admin_password_change() {\n\t\tif (isset($this->data['User']['forgot_password_email'])) {\n\t\t\t$forgot_password_email = $this->data['User']['forgot_password_email'];\n\t\t\t\n\t\t\t\n\t\t\t// check to make sure the email is a valid email for a user\n\t\t\t$change_password_user = $this->User->find('first', array(\n\t\t\t\t'conditions' => array(\n\t\t\t\t\t'User.email_address' => $forgot_password_email,\n\t\t\t\t\t'User.admin' => true,\n\t\t\t\t),\n\t\t\t\t'contain' => false,\n\t\t\t));\n\t\t\t\n\t\t\tif (empty($change_password_user)) {\n\t\t\t\t$this->Session->setFlash(__('Email does not belong to a valid user', true), 'admin/flashMessage/warning', array(), 'auth');\n\t\t\t} else {\n\t\t\t\t$this->Session->setFlash(__('Check your email to change your password', true), 'admin/flashMessage/success', array(), 'auth');\n\t\t\t\t$this->FotomatterEmail->send_forgot_password_email($this, $change_password_user);\n\t\t\t}\n\t\t}\n\t\t$this->redirect('/admin');\n\t}", "private function __changePassword() {\n\t\t$data = $this->request->data['User'];\n\t\t$this->User->id = $this->Auth->user('id');\n\t\tif ($this->User->saveField('password', $data['new_password'])) {\n\t\t\t$this->Session->setFlash(__('Your password changed successfully.'), 'success');\n\t\t\t$this->redirect($this->referer());\n\t\t} else {\n\t\t\t$this->Session->setFlash(__('Could not change your password due to a server problem, try again later.'), 'error');\n\t\t}\n\t}", "public function change_user_credential() {\n\t\t$result = $this->user_model->update_user_password($this->session->userdata('user_id'), $_POST);\n\n\t\tif ($result['success']) {\n\t\t\t$this->session->set_flashdata('credential_change_successful', \"Password changed successfully.\");\n\t\t} else {\n\t\t\t$this->session->set_flashdata('credential_change_failed', $result['message']);\n\t\t}\n\n\t\tredirect(site_url('user/profile/credential'), 'refresh');\n\t}", "function change_passwd($Username, $old_Password, $new_Password){\n $new_Password = encrypt_pwd($new_Password);\n $SQL = \"UPDATE User SET Password = '$new_Password' WHERE Username='$Username'\";\n mysqli_query($this->db_link, $SQL);\n }", "public function changePasswordAction(){\n $data = $this->getRequestData();\n $user = Object_User::getById($this->getDeviceSession()->getUserId());\n if(isset($data['password']) && isset($data['repeat_password'])){\n if($data['password'] === $data['repeat_password']){\n $user->setPassword($data['password']);\n } else {\n $this->setErrorResponse('password and repeat_password should match!');\n }\n } else {\n $this->setErrorResponse('password and repeat_password is mandatory fields!');\n }\n $this->_helper->json(array('updated' => true));\n }", "public function change_password() {\n\t\tif (!empty($this->request->data)) {\n\t\t\t$this->request->data['User']['id'] = $this->Auth->user('id');\n\t\t\tif ($this->User->changePassword($this->request->data)) {\n\t\t\t\t$this->Session->setFlash(__('Password changed.', true));\n\t\t\t\t$this->redirect('/');\n\t\t\t}\n\t\t}\n\t}", "public function isPasswordChangeEnabled();", "public function changePassword()\n {\n $breadCrumb = $this->userEngine->breadcrumbGenerate('change-password');\n\n return $this->loadPublicView('user.change-password', $breadCrumb['data']);\n }", "public function selfChangePassword()\n\t{\n\t\tif (!$this->userService->changePassword(Input::all()))\n\t\t{\n\t\t\treturn Redirect::route('user-profile', array('tab' => 'account'))->withErrors($this->userService->errors())->withInput();\n\t\t}\n\n\t\tAlert::success('Your password has been successfully changed.')->flash();\n\n\t\treturn Redirect::route('user-profile', array('tab' => 'account'));\n\t}", "function change_pwd_update_register(){\n\t\tglobal $CFG;\n\t\t$old_password = $this->My_addslashes(md5($_POST[\"old_password\"]));\n\t\t \n\t\t$new_password = md5($_POST[\"new_password\"]);\n\t \n\t\tif($this->chkPasswordInAdmin($old_password,$_SESSION['adminid'])){\n\t\t\t\t$UpQuery = \"UPDATE \".$CFG['table']['admin'].\" SET password = '\".$this->filterInput($new_password).\"' WHERE admin_id = \". $this->filterInput($_SESSION['adminid']);\n\t\t\t\t$UpResult = mysql_query($UpQuery) or die($this->mysql_error($UpQuery));\n\t\t\t}\n\t\telse{\t\n\t\t\techo \"Invalid_Old_Pwd\";\t\t\t\n\t\t\texit();\n\t\t\t}\n\t}", "public function password(){\r\n\r\n\t\t\t$user_info = Helper_User::get_user_by_id($this->user_id);\r\n\r\n\t\t\tif($_POST){\r\n\r\n\t\t\t\t$formdata = form_post_data(array(\"old_password\", \"new_password\", \"repeat_new_password\"));\r\n\t\t\t\t\r\n\t\t\t\t$old_password = trim($formdata[\"old_password\"]);\r\n\t\t\t\t$new_password = trim($formdata[\"new_password\"]);\r\n\t\t\t\t$repeat_new_password = trim($formdata[\"repeat_new_password\"]);\r\n\r\n\t\t\t\t$error_flag = false;\r\n\r\n\t\t\t\tif(strlen($old_password) <= 0){\r\n\t\t\t\t\t$error_flag = true;\r\n\t\t\t\t\tTemplate::notify(\"error\", \"Please enter the old password\");\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif(strlen($new_password) > 0 && strlen($repeat_new_password) > 0){\r\n\t\t\t\t\t\t// if both fields are not empty\r\n\r\n\t\t\t\t\t\tif(strlen($new_password) < 6){\r\n\t\t\t\t\t\t\t// the password cannot be less than 6 characters\r\n\t\t\t\t\t\t\t$error_flag = true;\r\n\t\t\t\t\t\t\tTemplate::notify(\"error\", \"Too short password. Password must be at least 6 characters long.\");\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// now compare the two new passwords\r\n\t\t\t\t\t\t\tif(strcmp($new_password, $repeat_new_password) !== 0){\r\n\t\t\t\t\t\t\t\t// both passwords are not same\r\n\t\t\t\t\t\t\t\t$error_flag = true;\r\n\t\t\t\t\t\t\t\tTemplate::notify(\"error\", \"New Passwords do not match. Please try again.\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tTemplate::notify(\"error\", \"Please enter the new password\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(!$error_flag){\r\n\t\t\t\t\t// means there are no any errors\r\n\t\t\t\t\t// get the current user account from the database\r\n\t\t\t\t\t// if the old password matches with the one that the user entered\r\n\t\t\t\t\t// change the password, else throw an error\r\n\r\n\t\t\t\t\t$old_password_hash = Config::hash($old_password);\r\n\r\n\t\t\t\t\tif(strcmp($old_password_hash, trim($user_info->password)) === 0){\r\n\r\n\t\t\t\t\t\t\tif($this->change_password($new_password, $user_info)){\r\n\t\t\t\t\t\t\t\tTemplate::notify(\"success\", \"Password changed successfully\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tredirect(Config::url(\"account\"));\r\n\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tTemplate::notify(\"error\", \"Wrong Old Password. Please try again\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tConfig::set(\"active_link\", \"password\");\r\n\t\t\tConfig::set(\"page_title\", \"Change Account Password\");\r\n\r\n\t\t\t$view_data[\"user_info\"] = $user_info;\r\n\r\n\t\t\tTemplate::setvar(\"page\", \"account/password\");\r\n\t\t\tTemplate::set(\"account/template\", $view_data);\r\n\t\t}", "public function change()\r\n {\r\n// var_dump($this->validate());die;\r\n if ($this->validate()) {\r\n $user = $this->_user; \r\n $user->setPassword($this->newPwd);\r\n $user->removePasswordResetToken();\r\n return $user->save(false);\r\n }\r\n \r\n return false;\r\n }", "Public Function changePassword($NewPassword)\n\t{\n\t\t$this->_db->exec(\"UPDATE bevomedia_user SET Password = md5('$NewPassword') WHERE ID = $this->id\");\n\t}", "public function changeUserPassword($changeUserPassword) {\n $this->load->model('actions_model');\n if (isset($changeUserPassword['adminuser_id'])) {\n $this->db->set('password', $changeUserPassword['new_password']);\n $this->db->where('id', $changeUserPassword['adminuser_id']);\n $this->db->update('users');\n// generate history\n $log_report = array(\n 'action' => 'Updated Password',\n 'table' => 'users',\n 'who_did_it' => $this->session->userdata('objSystemUser')->userid,\n 'on_account' => $this->session->userdata('objSystemUser')->accountid,\n 'when' => date('Y-m-d H:i:s', time()),\n 'to_what' => $changeUserPassword['adminuser_id'],\n );\n $this->actions_model->logOne($log_report);\n return 1;\n } else {\n return False;\n }\n }", "public function change_pass()\n\t{\n\t\t$form = array();\n\n\t\t$form['validation']['params'] = array('password_old', 'password', 'password_confirm');\n\n\t\t$form['submit'] = function ($params) {\n\t\t\treturn $this->_change_pass_submit();\n\n\n\t\t};\n\n\t\t$form['form'] = function () {\n\t\t\tpage_info('title', lang('title_change_pass'));\n\n\t\t\t$this->_display();\n\t\t};\n\n\t\t$this->_form($form);\n\t}", "public function setPassword($newPassword){\n\t}", "function ciniki_users_changePassword($ciniki) {\n //\n // Find all the required and optional arguments\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbQuote');\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs');\n $rc = ciniki_core_prepareArgs($ciniki, 'no', array(\n 'oldpassword'=>array('required'=>'yes', 'blank'=>'no', 'name'=>'Old Password'), \n 'newpassword'=>array('required'=>'yes', 'blank'=>'no', 'name'=>'New Password'), \n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $args = $rc['args'];\n \n if( strlen($args['newpassword']) < 8 ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.users.20', 'msg'=>'New password must be longer than 8 characters.'));\n }\n\n //\n // Check access \n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'users', 'private', 'checkAccess');\n $rc = ciniki_users_checkAccess($ciniki, 0, 'ciniki.users.changePassword', 0);\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n\n //\n // Check old password\n //\n $strsql = \"SELECT id, email FROM ciniki_users \"\n . \"WHERE id = '\" . ciniki_core_dbQuote($ciniki, $ciniki['session']['user']['id']) . \"' \"\n . \"AND password = SHA1('\" . ciniki_core_dbQuote($ciniki, $args['oldpassword']) . \"') \";\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQuery');\n $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.users', 'user');\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n\n //\n // Perform an extra check to make sure only 1 row was found, other return error\n //\n if( $rc['num_rows'] != 1 ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.users.21', 'msg'=>'Invalid old password'));\n }\n\n //\n // Turn off autocommit\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');\n $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.users');\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n\n //\n // Update the password, but only if the old one matches\n //\n $strsql = \"UPDATE ciniki_users SET password = SHA1('\" . ciniki_core_dbQuote($ciniki, $args['newpassword']) . \"'), \"\n . \"last_updated = UTC_TIMESTAMP(), \"\n . \"last_pwd_change = UTC_TIMESTAMP() \"\n . \"WHERE id = '\" . ciniki_core_dbQuote($ciniki, $ciniki['session']['user']['id']) . \"' \"\n . \"AND password = SHA1('\" . ciniki_core_dbQuote($ciniki, $args['oldpassword']) . \"') \";\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbUpdate');\n $rc = ciniki_core_dbUpdate($ciniki, $strsql, 'ciniki.users');\n if( $rc['stat'] != 'ok' ) {\n ciniki_core_dbTransactionRollback($ciniki, 'ciniki.users');\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.users.22', 'msg'=>'Unable to update password.'));\n }\n\n if( $rc['num_affected_rows'] < 1 ) {\n ciniki_core_dbTransactionRollback($ciniki, 'ciniki.users');\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.users.23', 'msg'=>'Unable to change password.'));\n }\n\n $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.users');\n if( $rc['stat'] != 'ok' ) {\n return array('stat'=>'fail', 'err'=>array('code'=>'ciniki.users.24', 'msg'=>'Unable to update password.'));\n }\n\n return array('stat'=>'ok');\n}", "public function setpassword(){\n\t\t$args = $this->getArgs();\n\t\t$out = $this->getModel()->getUserDataByRenewToken(UserController::getRenewTokenHash($args[\"GET\"][\"token\"]));\n\t\tinclude 'gui/template/UserTemplate.php';\n\t}", "function changePassword( $name, $pw ) {\n $d = loadDB();\n \n $found = false;\n foreach ($d['users'] as &$user) {\n if ($name == $user['name'] || $name == $user['email']) {\n $user[\"password\"] = $pw;\n saveDB( $d );\n $found = true;\n break;\n }\n }\n if (!$found)\n return FALSE;\n audit( \"changePassword done\", $name );\n return TRUE;\n }", "public function modifpassword($user,$passwd){\n \n }", "public function user_password_change($id){\n\t\tif($this->facebook_password_completed($this->session->userdata('id'))){\n\t\t\t$data = $this->array_from_post(array('password', 'facebook_signup' ));\n\t\t}\n\t\telse{\n\t\t\t$data = $this->array_from_post(array('password'));\n\t\t}\n\t\t$data['password'] = $this->hash($data['password']);\n\t\t//Saving data and redirecting\n\t\t$this->save($data, $id);\n\t}", "public function testPasswordChange(): void\n {\n // Test strong password - should pass.\n $this->setUpUserPostData(Constants::SAFE_PASSWORD);\n $this->assertIsInt(\\edit_user($this->dummy_user_id));\n\n // Test weak password - should pass as well.\n $this->setUpUserPostData(Constants::PWNED_PASSWORD);\n $this->assertIsInt(\\edit_user($this->dummy_user_id));\n\n // Clean up.\n $this->tearDownUserPostData();\n }", "private function changePassword()\n {\n try\n {\n global $userquery; \n\n $request = $_REQUEST;\n\n if(!userid())\n throw_error_msg(\"Please login to perform this action\");\n\n if(!isset($request['old_pass']) || $request['old_pass']==\"\")\n throw_error_msg(\"provide old_pass\");\n\n //new_pass\n if(!isset($request['new_pass']) || $request['new_pass']==\"\")\n throw_error_msg(\"provide new_pass\");\n\n //c_new_pass\n if(!isset($request['c_new_pass']) || $request['c_new_pass']==\"\")\n throw_error_msg(\"provide c_new_pass\");\n\n if($request['c_new_pass']!=$request['c_new_pass'])\n throw_error_msg(\"new password and confirm password do not match\");\n\n $request['userid'] = userid();\n $userquery->change_password($request);\n\n if( error() )\n {\n throw_error_msg(error('single')); \n }\n else\n {\n $data = array('code' => \"204\", 'status' => \"success\", \"msg\" => \"success\", \"data\" => \"password has been changed successfully\");\n $this->response($this->json($data)); \n } \n\n }\n catch(Exception $e)\n {\n $this->getExceptionDelete($e->getMessage());\n }\n }", "public function DoChangePassword($form)\n\t{\n\t\tif ($form->GetValue('Pw') == $form->GetValue('Pw2'))\n\t\t{\n\t\t\t$this->user->ChangePassword($form->GetValue('OldPw'), $form->GetValue('Pw'));\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->session->AddMessage('info', 'Password didn\\'t match.');\n\t\t}\n\t\t\n\t\t$this->RedirectToController('profile');\n\t}", "public function changePasswordAction()\n {\n $errors = [];\n if(!empty($_POST)){\n $user = Auth::getUser();\n\n $userValidation = new UserValidation($_POST, ['password']);\n $errors = $userValidation->getNamedErrors();\n\n if(empty($errors)){\n if(password_verify($_POST['oldpass'], $user->password)){\n $user->changePassword($_POST['password']);\n Extra::setMessageCookie(\"Password changed successfully.\");\n $this->redirect(\"/manage-account/\");\n }\n $errors['oldpass'] = \"Password you entered is incorrect.\";\n }\n }\n View::renderTemplate(\"LoggedUser/change-password.html\", [\n 'errors' => $errors\n ]);\n }", "public function actionChangePassword()\n {\n $username = $this->prompt(Console::convertEncoding(Yii::t('app', 'Username')) . ':', ['required' => true]);\n $model = $this->findModel($username);\n $model->setPassword($this->prompt(Console::convertEncoding(Yii::t('app', 'New password')) . ':', [\n 'required' => true,\n 'pattern' => '#^.{4,255}$#i',\n 'error' => Console::convertEncoding(Yii::t('app', 'More than {:number} symbols', [':number' => 4])),\n ]));\n $this->log($model->save());\n }", "function allowPasswordChange() {\r\n\t\treturn true;\r\n\t}", "public function sendPasswordChangedEmail(User $user): void;", "public function change_password() {\n $flash = null;\n // if the user has tried logging in\n if(isset($_POST['login'])){\n // try verifying the user\n if($this->User->login($_POST['username'], $_POST['old_pass'])) {\n if($_POST['new_pass']==$_POST['new_pass_verify']){\n $this->User->setPassword($User->getId(), $_POST['new_pass']);\n session_write_close();\n header(\"Location: \".app::site_url(''));\n exit(0);\n } else {\n $flash = \"I'm sorry, but the new passwords did not match.\";\n }\n } else {\n $flash = \"That username and/or password is not valid.\";\n }\n }\n return array('flash' => $flash);\n }", "public function testUpdatePasswordNotGiven(): void { }", "public function setPassword(){\n\t}", "public function changePwd(){\n $uesr_id=$_SESSION['admin_id'];\n\t\t$sql=\"select * from users where id='$uesr_id'\";\n\t\t$query = mysqli_query($this->connrps, $sql);\n\t\twhile ($row = mysqli_fetch_array($query)) {\n\t\t\t$username = $row['username'];\n\t\t\t$password = $row['password'];\n\t\t}\n\t\t$cur_password=base64_encode($_POST['currentPassword']);\n\t\t$new_pwd=base64_encode($_POST['newPassword']);\n\t\t$confirm_pwd=base64_encode($_POST['confirmPassword']);\n\t\tif ($cur_password != $password) {\n\t\t\t$message= \"Current password does not matched.\";\n\t\t\t$_SESSION['error_msg'] = $message;\n\t\t\treturn 0;\n\t\t}else if ($new_pwd != $confirm_pwd) {\n\t\t\t$message= \"Confirm password does not matched\";\n\t\t\t$_SESSION['error_msg'] = $message;\n\t\t\treturn 0;\n\t\t}else {\n\t\t\t$query_updt = \"UPDATE users SET password = '$new_pwd' WHERE id='$uesr_id'\";\n\t\t\t$query_updt = mysqli_query($this->connrps, $query_updt);\n\t\t\t$message= \"New password has been updated successfully\";\n\t\t\t$_SESSION['succ_msg'] = $message;\n\t\t\treturn 1;\n\t\t}\n\t}", "function update_password() {\n\t\t$old_password = $_POST['old_password'];\n\t\t$new_password = $_POST['new_password'];\n\t\tif (!empty($old_password) && !empty($new_password)) {\n\t\t\t$admin_records = $this -> conn -> get_table_row_byidvalue('pg_track_admin', 'admin_password', md5($old_password));\n\t\t\tif (!empty($admin_records)) {\n\t\t\t\t$data['admin_password'] = md5($new_password);\n\t\t\t\t$update_toekn = $this -> conn -> updatetablebyid('pg_track_admin', 'admin_status', 1, $data);\n\t\t\t\t$post = array(\"status\" => \"true\", \"message\" => \"Password changed successfully\");\n\t\t\t} else {\n\t\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Invalid Old Password\");\n\t\t\t}\n\t\t} else {\n\t\t\t$post = array(\"status\" => \"false\", \"message\" => \"Missing parameter\", 'old_password' => $old_password, 'new_password' => $new_password);\n\t\t}\n\t\techo $this -> json($post);\n\t}", "public function changePassword() {\n\t\t//assign public class values to function variable\n\t\t$data = $this->data;\n\t\t$data['common_data'] = $this->common_data;\n\t\t$data['page'] = 'change_password';\n\t\t$data['pageName'] = 'Change Password';\n\t\tif($data['common_data']['user_data']['role'] == INACTIVE_STATUS_ID){\n\t\t\theader(\"Location: \".ROUTE_PROFILE);\n\t\t\tdie();\n\t\t}\n\t\tif($data['common_data']['user_data']['account_type'] == FACEBOOK_ACCOUNT_TYPE){\n\t\t\theader(\"Location: \".ROUTE_ERROR_PAGE);\n\t\t\tdie();\n\t\t}\n\n\t\t$data['tutor_details'] = $this->profile_model->getTutorDetailsById($data['common_data']['user_id']);\n\t\t//Getting all payment details\n\t\t$data['payment_details'] = $this->payment_model->getPaymentDetailsById($data['common_data']['user_id']);\n\t\t$data['tutor_badges'] = $this->user_model->getTutorBadges($data['common_data']['user_id']);\n\t\t$data['badges'] = $this->user_model->getBadges();\n\n\t\t$template['body_content'] = $this->load->view('frontend/profile/change-password', $data, true);\t\n\t\t$this->load->view('frontend/layouts/template', $template, false);\n\t}", "public function actionChangepassword()\n\t{\n\t\t// using the default layout 'protected/views/layouts/main.php'\n\t\t\n\t\t\n\t\t$this->checkUser();\n\t\t\n\t\t$record = SiteUser::model()->findByAttributes(array('id'=> Yii::app()->user->id));\n\t\n\t\tif(isset($_POST['SiteUser']))\n\t\t{\t\n\t\t\tif(trim($_POST['SiteUser']['password']) != '') {\n\t\t\t\t$record->password = $_POST['SiteUser']['password'];\n\t\t\t\t\n\t\t\t} \t\t\n\t\t\tif(trim($_POST['SiteUser']['password']) == trim($_POST['SiteUser']['repeat_password'])) {\n\t\t\t\t$record->repeat_password = $record->password;\n\t\t\t}\t\n\t\t\t\n\t\t\tif($record->validate()) {\n\t\t\t\t$record->repeat_password = $record->password = crypt($record->password);\n\t\t\t\tif($record->save())\n\t\t\t\t\t$this->redirect(array('personal'));\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$record->repeat_password = $record->password = '';\n\t\t\t}\n\n\t\t}\t\n\n\t\t$this->render('changepassword',array('record'=>$record));\n\t}", "function changePass() {\n\t\t$id = $this->AuthExt->User('id');\n\t\tif (!$id && empty($this->data)) {\n\t\t\t$this->Session->setFlash(__('Invalid user', true));\n\t\t\t$this->redirect(array('action' => 'index'));\n\t\t}\n\t\t\n\t\tif (!empty($this->data)) {\n\t\t\t//don't allow hidden variables tweaking get the group and username \n\t\t\t//form the system in case an override occured from the hidden fields\n\t\t\t$this->data['User']['role_id'] = $this->AuthExt->User('role_id');\n\t\t\t$this->data['User']['username'] = $this->AuthExt->User('username');\n\t\t\tif ($this->User->save($this->data)) {\n\t\t\t\t$this->Session->setFlash('The password change has been saved', 'flash_success');\n\t\t\t\t$this->redirect(array('action' => 'index', 'controller' => ''));\n\t\t\t} else {\n\t\t\t\tprint_r($this->data);\n\t\t\t\t$this->data = $this->User->read(null, $id);\n\t\t\t\t$this->data['User']['password'] = null;\n\t\t\t\t$this->data['User']['confirm_passwd'] = null;\n\t\t\t\t$this->Session->setFlash('The password could not be saved. Please, try again.', 'flash_failure');\n\t\t\t}\n\t\t}\n\t\tif (empty($this->data)) {\n\t\t\t$this->data = $this->User->read(null, $id);\n\t\t\t$this->data['User']['password'] = null;\n\t\t}\n\t\t$roles = $this->User->Role->find('list');\n\t\t$this->set(compact('roles'));\n\t}", "function changePassword($data){\r\n if(!empty($this->user_id) || $this->matchPasswordForUsername($data['userName'],$data['code'])){\r\n if(!empty($this->user_id)){\r\n $data['userName'] = $this->user_profile['username'];\r\n }\r\n if($data['newpwd']==$data['newpwdagn']){\r\n\r\n\t\t\t// check if the password is strong\r\n\t\t\tif(!$this->isPasswordStrong($data['newpwd'])){\r\n\t\t\t\t$this->setStdError('weak_password');\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n // if the password is one of last n passwords\r\n if($this->isOneOfLastNPasswords($data['newpwd'])){\r\n $this->setError('Your password is one of last '.$this->app_config['password_no_repeat'].' passwords.');\r\n return false;\r\n }\r\n\r\n global $pdo;\r\n try{\r\n $update=$pdo->prepare(\"UPDATE users SET `password`=?, `status` = 1 WHERE id= ?\");\r\n $userid = $this->getUserIdFromUsername($data['userName']);\r\n $update->execute(array($this->getPasswordHashOfUser($data['userName'],$data['newpwd']), $userid));\r\n //update the password log\r\n if(empty($this->user_id)){\r\n $this->user_id = $userid;\r\n }\r\n $this->updatePasswordLog($this->getPasswordHashOfUser($data['userName'],$data['newpwd']));\r\n\r\n $this->updatePasswordResetQueue($userid);\r\n\t\t\t\t\t$log = debug_backtrace();\r\n\t\t\t\t\t$this->createActionLog($log);\r\n return true;\r\n }\r\n catch(PDOException $e){\r\n $this->setError($e->getMessage());\r\n return false;\r\n }\r\n\r\n }else{\r\n $this->setError(\"Passwords entered do not match. Please check and type again.\");\r\n return false;\r\n }\r\n }\r\n else{\r\n $this->setError(\"Password was not reset.\");\r\n return false;\r\n }\r\n }", "function User_Changepass(){\r\n\t\tif( ($token = Str_filter($_POST['token'])) && ($old_password = Str_filter($_POST['old_password'])) && ($new_password = Str_filter($_POST['new_password'])) ){\r\n\t\t\tif($username = AccessToken_Getter($token)){\r\n\t\t\t\tif($user = Mongodb_Reader(\"todo_users\",array(\"username\" => $username),1)){\t\t\t\t\r\n\t\t\t\t\tif(md5($old_password) == $user['password']){\r\n\t\t\t\t\t\tMongodb_Updater(\"todo_users\",array(\"username\" => $username),array(\"password\" => md5($new_password)));\r\n\t\t\t\t\t\t$res = Return_Error(false,0,\"修改成功\",array(\"username\" => $username));\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\t$res = Return_Error(true,6,\"密码不正确\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$res = Return_Error(true,5,\"该用户不存在\");\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\t$res = Return_Error(true,7,\"token无效或登录超时\");\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\t$res = Return_Error(true,4,\"提交的数据为空\");\r\n\t\t}\r\n\t\techo $res;\r\n\t}", "public function changePassword()\n {\n $this->validateOnly('password', [\n 'password' => 'bail|nullable|required_with:password_confirmation|string|confirmed',\n 'current_password' => 'bail|required',\n ]);\n\n if (!Hash::check($this->current_password, $this->user->password)) {\n $this->addError('current_password', 'Your current password is incorrect.');\n return;\n }\n\n $this->user->password = bcrypt($this->password);\n $this->user->save();\n $this->toast('Password has been changed!', 'success');\n $this->emit('password-updated');\n $this->reset(['password', 'password_confirmation', 'current_password']);\n }", "function changePassword($userData)\n\t\t{\n\t\t\t$old_password = $this->manageContent->getValue_where('user_credentials', '*', 'user_id', $_SESSION['user_id']);\n\t\t\t\n\t\t\tif($old_password[0]['password'] == md5($userData['old_pass']))\n\t\t\t{\n\t\t\t\tif(!empty($userData['new_pass']) && $userData['new_pass'] == $userData['re_pass'])\n\t\t\t\t{\n\t\t\t\t\t$change_password = $this->manageContent->updateValueWhere('user_credentials', 'password', md5($userData['new_pass']), 'user_id', $_SESSION['user_id']);\n\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $change_password;\n\t\t}", "public function userPasswordUpdate() {\n $password = Hash::make($this->request->input(\"new_password\"));\n $updateArray = [\n \"password\" => $password\n ];\n $whereArray = [\n [\"user_id\", '=', $this->request->input(\"user_id\")]\n ];\n $this->usersModel->setTableName(\"cvd_users\");\n $this->usersModel->setInsertUpdateData($updateArray);\n $this->usersModel->setWhere($whereArray);\n $this->usersModel->updateData();\n }", "function force_user_password_change_now() { \n\t\tglobal $wpdb;\n\n\t\t$sql = 'select ID, user_login, user_email from '.$wpdb->users;\n\n\t\t$res = $wpdb->get_results($sql, ARRAY_A);\n\n\t\tif (!$res) return; // this condition would be weird eh? \n\n\t\t$msgs = array();\n\n\t\tforeach ( $res as $u ) { \n\n\t\t\t$rand_psw = wp_hash_password( wp_generate_password(16) );\n\t\t\twp_set_password( $rand_psw, $u['ID'] );\n\t\t\tupdate_user_meta( $u, 'll_force_password_change_now', 1 );\n\n\t\t\t// Generate something random for a key...\n\t\t\t$key = wp_generate_password(20, false);\n\t\t\tdo_action('retrieve_password_key', $u['user_login'], $key);\n\t\t\t// Now insert the new md5 key into the db\n\t\t\t$wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $u['user_login']));\n\n\t\t\t$res = $this->ll_alert_user( $u['user_login'], $u['user_email'], $key );\n\n\t\t\tif ( '' != $res ) \n\t\t\t $msgs[] = $res; \n\t\t}\n\n\t\treturn $msgs; \n\n\t}", "public function changePasswordAction()\n {\n $message = array();\n $message['success'] = \"\";\n $message['verify'] = $this->customerVerify($_SESSION['userName'], $_POST['currentPass']);\n if (!$message['verify']) {\n $message['confirm'] = $this->checkConfirm($_POST['newPass'], $_POST['confirmPass']);\n if (!$message['confirm']) {\n $this->model->chagePass($_SESSION['userName'], password_hash($_POST['newPass'], PASSWORD_DEFAULT));\n $message['success'] = \"Your password has been changed\";\n }\n }\n echo json_encode($message);\n }", "public function change_password()\n\t{\n\t \n\t \n \t\t/* Breadcrumb Setup Start */\n\t\t\n\t\t$link = breadcrumb();\n\t\t\n\t\t$data['breadcrumb'] = $link;\n\t\t\n\t\t/* Breadcrumb Setup End */\n\t\n\t\t$data['page_content']\t=\t$this->load->view('changepwd',$data,true);\n\t\t$this->load->view('page_layout',$data);\n\t}", "function changePassword($userid, $password, $mode = null)\n\t{\n\t\trequire_once $_SERVER['DOCUMENT_ROOT'] . '/Connections/MyDBConnector.php';\n\t\t$pdo = (new MyDBConnector())->getPDO();\n\t\t$sql = \"UPDATE staff_directory SET `pswd` = '\" . password_hash($password, PASSWORD_BCRYPT) . \"' WHERE staffId = \" . $userid;\n\t\t$stmt = $pdo->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));\n\t\t$chk = $stmt->execute();\n\t\tif ($chk) {\n\t\t\treturn 'success';\n\t\t} else {\n\t\t\treturn 'error';\n\t\t}\n\t}", "public function testUserPassword() {\n\t\t// make new User and save it to the database\n\t\t$newPassword = Generate::hash();\n\n\t\t// change the User password\n\t\t$this->visit('/home')\n\t\t\t->click('#user-update-button')\n\t\t\t->seePageIs('/user/update')\n\t\t\t->click('Change Password')\n\t\t\t->seePageIs('/user/password')\n\t\t\t->type($this->password, 'old_password')\n\t\t\t->type($newPassword, 'password')\n\t\t\t->type($newPassword, 'password_confirmation')\n\t\t\t->press('Change Password')\n\t\t\t->seePageIs('/home')\n\t\t\t->see('Your password was changed successfully!')\n\t\t\t->click('Logout')\n\t\t\t->seePageIs('/');\n\n\t\t// test a regular User's login with the new password\n\t\t// TODO: check the database instead of testing the login process\n\t\t$this->visit('/')\n\t\t\t->click('#login-button')\n\t\t\t->seePageIs('/login')\n\t\t\t->type($this->User->email, 'email')\n\t\t\t->type($newPassword, 'password')\n\t\t\t->press('Login')\n\t\t\t->seePageIs('/home')\n\t\t\t->within('#nav', function() {\n\t\t\t\t$this->see('Logout')\n\t\t\t\t\t->dontSee('Login')\n\t\t\t\t\t->dontSee('Admin');\n\t\t\t});\n\t}", "public function actionChangePassword()\n {\n \t$user = UserAdmin::findOne(Yii::$app->request->get('id'));\n \t$model = new ChangeForcePasswordForm($user);\n \tif ($model->load(Yii::$app->request->post()) && $model->applyChanges()) \n \t{\n \t\tYii::$app->getSession()->setFlash('success', \n \t\t\t\"The user password has been changed\"\n \t\t);\n \t\treturn $this->redirect([\"/admin/crud/user-admin/view\", 'id' => $user->id]);\n \t}\n \t\n \t$this->layout = '@app/layouts/layout-popup-sm';\n \treturn $this->render('change-password', ['model' => $model]);\n }", "public function password_change()\n\t{\n\t\t$data['title'] = \"Change Password\";\n\t\t$this->load->view('admin/user/_header');\n\t\t$this->load->view('admin/user/_left_sideber');\n\t\t$this->load->view('admin/user/view_change_password');\n\t\t$this->load->view('admin/user/_footer');\n\t\t\t\n\t}", "public function actionchangePassword() {\n if (isset($_POST['password'])) {\n\n $userid = Yii::app()->user->getState('userid');\n $model = HhUsers::model()->findByPk($userid);\n if ($model->password == md5($_POST['password'])) {\n\n $model->password = md5($_POST['newpassword']);\n if ($model->save()) {\n $this->redirect('index');\n }\n }\n }\n $this->render('changePassword');\n }", "public function user_password_change() {\n $data['title'] = 'Change Password';\n return view('user-dashboard.password-change', $data);\n }", "function Users_user_changeemail()\n{\n if (!pnUserLoggedIn()) {\n return LogUtil::registerPermissionError();\n }\n\n $changepassword = pnModGetVar('Users', 'changeemail', 1);\n if ($changepassword <> 1) {\n return pnRedirect('Users', 'user', 'main');\n }\n\n // Create output object\n $pnRender = & pnRender::getInstance('Users', false, null, true);\n\n // Return the output that has been generated by this function\n return $pnRender->fetch('users_user_changeemail.htm');\n}", "function password_recovery()\n\t{\n\n\n\t}", "function change_password($password){\n\t\tif( isset($_POST[$password]) ){\n\t\t\t$new_password = $_POST[$password];\n\n\t\t\t$result = user::change_password($new_password);\n\t\t}\n\t}", "function procChangePassword() {\n global $session, $form;\n /* Change password attempt */\n $retval = $session->changePassword($_POST['cpuser'], $_POST['newpass1'], $_POST['newpass2']);\n\n /* Account edit successful */\n if ($retval) {\n $_SESSION['pwupdate'] = true;\n header(\"Location: \" . $session->referrer);\n }\n /* Error found with form */ else {\n $_SESSION['value_array'] = $_POST;\n $_SESSION['error_array'] = $form->getErrorArray();\n header(\"Location: \" . $session->referrer);\n }\n }", "function reset_password($user, $new_pass)\n {\n }", "public function run_chg_pass_if()\n\t{\n\t\t$msg='';\n\t\tif(isset($_POST['old_pass']))\n\t\t{\n\t\t\tif(md5($_POST['old_pass'])==$_SESSION['waf_user']['pass'])\n\t\t\t\t{\n\t\t\t\t\tif($_POST['pass']!=$_POST['pass1'])\n\t\t\t\t\t{\n\t\t\t\t\t\t$msg='Passwords not equal! Try again.';\n\t\t\t\t\t}else{\n\t\t\t\t\t$this->change_password($_SESSION['waf_user']['id'],$_POST['pass']);\n\t\t\t\t\t$msg='Password successfully changed';\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t$msg='Old Password wrong! Password not changed';\t\n\t\t\t\t}\n\t\t}\n\t\t$this->error=$msg;\n\t}", "function mysql_auth_change_password($username,$password)\n{\n $encrypted = crypt($password,'$1$' . strgen(8).'$');\n return dbUpdate(array('password' => $encrypted), 'users', '`username` = ?', array($username));\n}", "function forum_password_change($new_password) {\n\t global $vbulletin;\n\n\t // LOG USER OUT\n\t $this->forum_logout();\n\n\t $vb_password = md5(md5($new_password) . $this->forum_user[salt]);\n\t $vb_passworddate = date('Y-m-d', time());\n\n\t $vbulletin->db->query_write(\"UPDATE \" . TABLE_PREFIX . \"user SET password='$vb_password', \n\t\t\t\t\t\t\t\t\tpassworddate='$vb_passworddate' WHERE userid='\".$this->forum_user[userid].\"'\");\n\n\t // RETRIEVE INFORMATION\n\t $this->forum_user_check();\n\n\t // LOG USER BACK IN\n\t $this->forum_login(1);\n\n\t}", "public function &setIsPasswordChangeEnabled($value);", "public function postChangepassword() {\n if ($this->_adminUserRepository->updatePassword ()) {\n return redirect ( 'users/changepassword' )->withSuccess ( trans ( 'user::adminuser.changepassword.success' ) );\n } else {\n return redirect ( 'users/changepassword' )->withErrors ( trans ( 'user::adminuser.changepassword.incorrect' ) );\n }\n }", "public function setPassword($value);", "function changeUserPassword($user_id, $password){\n $md5_password = md5($password);\n sqlQuery(\"UPDATE users SET user_password='$md5_password' WHERE user_id='$user_id'\");\n}", "public function updatePassword(UserInterface $user);", "public function changePassword() {\n $this->form_validation->set_rules('email', 'Email', 'required');\n $this->form_validation->set_rules('password', 'Altes Passwort', 'required');\n $this->form_validation->set_rules('new_password', 'Neues Passwort', 'required');\n\n if ($this->form_validation->run() === FALSE) {\n \t$this->error(400, 'Validation error');\n }\n \n $this->loadUser();\n \n\t\tif (!password_verify(\n\t\t\t$this->input->post('password'),\n\t\t\t$this->user_model->getValue('hashed_password'))) \n\t\t{\n\t\t\t$this->error(404, 'Verification error');\n\t\t}\n\t\t\n\t\t/*\n \tif ($this->user_model->getValue('confirmed') == 0) {\n \t\t$this->error(402, 'Account not confirmed');\n \t}\n \t*/\n \t\n \t$this->user_model->setValue(\n \t\t'hashed_password',\n \t\tpassword_hash($this->input->post('new_password'), PASSWORD_DEFAULT));\n \t\t\n \tif (! $this->user_model->updatePassword()) {\n \t\t$this->error(400, 'Password could not be updated');\n \t}\n \t\n $data['new password'] = 'set';\n $this->response($data);\n }", "function do_change_password($puuid, &$error, $set_force_reset=false) {\n global $_min_passwd_len;\n global $_passwd_numbers;\n global $_passwd_uperlower;\n global $_passwd_chars;\n\n if($puuid === '') {\n $error = \"No PUUID given\";\n return false;\n }\n\n if($_REQUEST['p1'] === $_REQUEST['p2']) {\n $temparr = array();\n $p = $_REQUEST['p1'];\n\n // do strength test here\n if(strlen($p) < $_min_passwd_len) {\n $error = \"Password too short\";\n return false;\n }\n if($_passwd_numbers && !preg_match('/[0-9]/', $p)) {\n $error = \"Password must contain one or more numbers\";\n return false;\n }\n if($_passwd_uperlower && \n \t(!preg_match('/[A-Z]/', $p) || !preg_match('/[a-z]/', $p))) {\n $error = \"Password must contain both upper case and lower case\";\n return false;\n }\n if($_passwd_chars && \n \t(preg_match_all('/[A-Za-z0-9]/', $p, &$temparr) == strlen($p))) {\n $error = \"Password must contain non-alphanumeric characters\";\n return false;\n }\n\n // we got here, so update password\n $s = \"SELECT distinct passwordtype from password_types\";\n $res = pg_query($s);\n if (!$res) {\n $error = \"DB Error\";\n return false;\n }\n $hashes = pg_fetch_all($res);\n pg_free_result($res);\n\n hpcman_log(\"Updating \".count($hashes).\" password hashes for puuid \".$puuid);\n\n if (!pg_query(\"BEGIN\")) {\n $error = \"Could not begin transaction\";\n return false;\n }\n\n foreach($hashes as $hash) {\n $s = \"UPDATE passwords SET password=$1 \n\tWHERE puuid=$2 AND passwordtype=$3\";\n $passwd = hpcman_hash($hash['passwordtype'], $p);\n $result = pg_query_params($s, array($passwd, $puuid, $hash['passwordtype']));\n if (!$result) {\n $error = \"DB Error\";\n return false;\n }\n\n $acount = pg_affected_rows($result);\n\n if ($acount > 1) {\n $error = \"Error: Too many rows\";\n if(!pg_query(\"ROLLBACK\")) {\n $error .= \", rollback failed\";\n }\n return false;\n } else if ($acount < 1) {\n hpcman_log(\"Adding new password hash {$hash['passwordtype']} for $puuid\");\n $sql = \"INSERT INTO passwords (password, puuid, passwordtype) VALUES ($1,$2,$3)\";\n $result = pg_query_params($sql, array($passwd, $puuid, $hash['passwordtype']));\n if (!$result) {\n $error = \"Error: Not enough rows; insert failed\";\n if(!pg_query(\"ROLLBACK\")) {\n $error .= \", rollback failed\";\n }\n return false;\n }\n }\n }\n\n if (!pg_query(\"COMMIT\")) {\n $error = \"DB Error: Commit failed\";\n return false;\n }\n\n if($set_force_reset) {\n $sql = \"UPDATE authenticators SET mustchange='t' \n\tWHERE puuid=$1 AND authid=0\";\n if(!pg_query_params($sql, array($puuid))) {\n\t$error = \"DB Error\";\n return false;\n }\n } else {\n $sql = \"UPDATE authenticators SET mustchange='f'\n WHERE puuid=$1 AND authid=0\";\n if(!pg_query_params($sql, array($puuid))) {\n $error = \"DB Error\";\n return false;\n }\n }\n } else {\n $error = \"Passwords do not match\";\n return false;\n }\n return true;\n}", "public function actionPasswordChange() {\n\n\t\t$userId = User::checkLogged();\n\t\t$user = User::getUserById($userId);\n\t\t$old_password = \"\";\n\t\t$password = \"\";\n\t\t$password_confirmation = \"\";\n\t\t$result = false;\n\n\t\tif (isset($_POST['submit'])) {\n\t\t\t$old_password = $_POST['old_password'];\n\t\t\t$password = $_POST['password'];\n\t\t\t$password_confirmation = $_POST['password_confirmation'];\n\n\t\t\t$errors = array();\n\n\t\t\tif (User::passwordCheck($userId, $old_password)) {\n\t\t\t\tif (Validator::checkPassword($password)) $errors['password'] = Validator::checkPassword($password);\n\t\t\t\tif (Validator::checkPasswordConfirmation($password, $password_confirmation)) $errors['password_confirmation'] =\n\t\t\t\t\tValidator::checkPasswordConfirmation($password, $password_confirmation);\n\t\t\t} else $errors['old_password'] = \"Wrong old password\";\n\n\t\t\tif (empty($errors)) {\n\t\t\t\t$result = User::passwordChange($userId, $password);\n\t\t\t}\n\t\t}\n\t\t$pageTitle = \"Password Change\";\n\t\trequire_once(ROOT . '/views/account/password_change.php');\n\n\t\treturn true;\n\t}", "public function resetPassword();", "function changePassword($selectedRecipient, $user_email, $oldpassword, $password) {\n if ($this->connectToMySql()) {\n //QUERY FOR USER ACCOUNT HERE\n if ($this->authenticateUser($user_email, $oldpassword, FALSE)) {\n //QUI CAMBIA LA PASSWORD\n $this->changeUtenteScuolaPassword($selectedRecipient, $user_email, $oldpassword, $password);\n $this->closeConnection();\n return TRUE;\n } else {\n $msg = '<span class=\"error\">L\\'utente selezionato non ha i permessi di accesso!</span>';\n setcookie(\"message\", $msg);\n $this->closeConnection();\n return FALSE;\n }\n }\n return FALSE;\n }", "public function change() {\n $handle = $_POST['handle'];\n $new_password = $_POST['password'];\n $hashed_password = sha1($new_password);\n $this->db->where('handle', $handle);\n $this->db->update('user', array('password' => $hashed_password));\n echo \"success\";\n }", "public function change_password($data, $user_id) {\r\n\r\n // Start Backend Validation\r\n if (empty($data['old-pwd'])) {\r\n $this->errors['old-pwd'] = 'رجاء لا تترك هذا الحقل فارغا';\r\n }\r\n\r\n if (empty($data['new-pwd'])) {\r\n $this->errors['new-pwd'] = 'رجاء لا تترك هذا الحقل فارغا';\r\n } elseif (strlen($data['new-pwd']) < 8) {\r\n $this->errors['new-pwd'] = 'يجب على كلمة السر أن تتكون من 8 أحرف فأكثر';\r\n }\r\n\r\n if ($data['confirm-pwd'] != $data['new-pwd']) {\r\n $this->errors['confirm-pwd'] = 'كلمتا السر غير متطابقتان';\r\n }\r\n\r\n if (empty($this->errors)) {\r\n // Sanitize Data\r\n $old_pwd = sha1(filter_var($data['old-pwd'], FILTER_SANITIZE_STRING));\r\n $new_pwd = sha1(filter_var($data['new-pwd'], FILTER_SANITIZE_STRING));\r\n\r\n $user = $this->select('users', 'id', $user_id)->fetch_assoc();\r\n\r\n if ($user['password'] === $old_pwd) { // If Passwords Are Mached\r\n $connection = DB::connect();\r\n\r\n // Update The Password\r\n $stmt = \"UPDATE users SET password = '$new_pwd' WHERE id = '$user_id'\";\r\n $result = $connection->query($stmt);\r\n\r\n // Redirect To Profile Page\r\n $profile_url = DB::MAIN_URL . 'profile.php';\r\n header('location: ' . $profile_url);\r\n\r\n } else {\r\n $this->errors['old-pwd'] = 'كلمة السر غير صحيحة';\r\n }\r\n\r\n }\r\n\r\n }", "function can_change_password() {\n return false;\n }", "public function can_change_password() {\n return false;\n }", "static function password_forgot() {\n parent::password_forgot();\n view_var('user', globals('user'));\n }", "function pass_change()\r\n\t{\r\n\t\tglobal $ibforums, $std;\r\n\r\n\t\tif ($ibforums->member['disable_mail'])\r\n\t\t{\r\n\t\t\t$ibforums->lang['no_mail'] = sprintf($ibforums->lang['no_mail'], $ibforums->member['disable_mail_reason']);\r\n\r\n\t\t\t$this->output .= View::make(\"global.warn_window\", ['message' => $ibforums->lang['no_mail']]);\r\n\t\t} else\r\n\t\t{\r\n\t\t\t$this->output .= View::make(\"ucp.pass_change\");\r\n\t\t}\r\n\r\n\t\t$this->page_title = $ibforums->lang['t_welcome'];\r\n\t\t$this->nav = array(\"<a href='\" . $this->base_url . \"act=UserCP&amp;CODE=00'>\" . $ibforums->lang['t_title'] . \"</a>\");\r\n\r\n\t}" ]
[ "0.8312075", "0.8306013", "0.8209947", "0.8002731", "0.79494894", "0.77816314", "0.77121973", "0.76271075", "0.75843954", "0.7537494", "0.74955547", "0.7424394", "0.7373984", "0.736864", "0.7345142", "0.7341299", "0.7318712", "0.7302697", "0.72897345", "0.72659004", "0.72507656", "0.7248523", "0.72316253", "0.7196803", "0.7180626", "0.7146572", "0.71194506", "0.71187943", "0.7112216", "0.7094365", "0.7083999", "0.70751244", "0.7068111", "0.7063762", "0.70579785", "0.7045359", "0.7042788", "0.70417976", "0.704012", "0.7037673", "0.7033228", "0.70243883", "0.70164627", "0.70071137", "0.6999152", "0.69949996", "0.6993236", "0.6986839", "0.6981168", "0.697649", "0.69741565", "0.69721425", "0.695778", "0.69570786", "0.69454175", "0.6942661", "0.6935468", "0.6927554", "0.6925845", "0.6915603", "0.6914086", "0.69103295", "0.6891512", "0.68885696", "0.6888118", "0.68747765", "0.68721855", "0.6862437", "0.6855039", "0.68535876", "0.68472666", "0.6840931", "0.6837674", "0.6835976", "0.6834436", "0.6832198", "0.6817065", "0.6812636", "0.68109393", "0.68105584", "0.6798769", "0.679157", "0.6790974", "0.67899907", "0.67796266", "0.67592615", "0.67582846", "0.6751888", "0.6746391", "0.6745318", "0.6744281", "0.6739305", "0.67366165", "0.6736592", "0.67341393", "0.6729041", "0.6718339", "0.6712386", "0.6703962", "0.67007256" ]
0.67763263
85
function to lock user account
function lockAccount($userid){ $query = "UPDATE users_account SET status ='Locked' WHERE userid = ?"; $paramType = "i"; $paramValue = array( $userid ); $this->db_handle->update($query, $paramType, $paramValue); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lockout($username = \"\") {\n\t\tglobal $wpdb;\n\n\t\t$ip = $this->get_user_ip();;\n\n\t\t$username = sanitize_user($username);\n\n\t\t$user = get_user_by( 'login', $username );\n\n\t\tif ( !$user ) { \n\t\t\t$user = new stdClass();\n\t\t\t$user->ID = 0;\n\t\t}\n\n\t\t$sql = \"insert into \" . $this->lock_table . \" (user_id, lockdown_date, release_date, lockdown_IP) \" .\n\t\t\t \"values ('\" . $user->ID . \"', NOW(), date_add( NOW(), interval \" .\n\t\t\t $this->ll_options['lockout_length'] . \" MINUTE), '\" . $wpdb->escape($ip) . \"')\";\n\n\t\t$wpdb->query($sql);\n\n\t\tif ( 'yes' == $this->ll_options['notify_admins'] )\n\t\t\t$this->ll_notify_admins( $ip, $username );\n\n\t}", "public function lockOrUnlockUser($id, $locked = true);", "public function LockUser($email)\n\t {\n $sql = \"Update user \"\n\t\t\t\t. \" SET islocked = '0'\"\n\t\t\t\t. \" WHERE email = '\"\n\t\t\t\t. $email . \"'\";\n \n return parent::execute($sql);\n\n }", "function Lock($UserID)\n\t{\n\t\tj::SQL(\"UPDATE jfp_xuser SET LockTimeout=? , FailedLoginAttempts=0 WHERE ID=? LIMIT 1\",time()+$this->LockInterval,$UserID);\n\t}", "function lock() {\n if (!authenticated()) {\n header('Location: ' . R . 'auth/?referer=' . $_SERVER['REQUEST_URI']);\n exit();\n }\n}", "public function lockAccount(&$user)\r\n {\r\n $failedLoginCount = $user->getFailedLoginCount();\r\n if($failedLoginCount == $this->initialLockAttempt)\r\n {\r\n $user->setLockDuration(Carbon::now()->addSeconds($this->initialLockDuration));\r\n }\r\n elseif($failedLoginCount > $this->initialLockAttempt)\r\n {\r\n $failedLoginCount -= $this->initialLockAttempt;\r\n if($failedLoginCount%$this->intervalLockAttempt == 0)\r\n {\r\n $lockDuration = $failedLoginCount/$this->intervalLockAttempt * $this->intervalLockDuration;\r\n $lockDuration += $this->initialLockDuration;\r\n $user->setLockDuration(Carbon::now()->addSeconds($lockDuration));\r\n }\r\n }\r\n }", "public function toggleUserLock($userid) {\n\t\t$adminModel = $this->loadModel('admin');\n\t\t$user = $adminModel->getUser($userid);\n\t\tif ($user->user_status == 1) {\n\t\t\t$adminModel->setUserStatus($userid, 2);\n\t\t} elseif ($user->user_status == 2) {\n\t\t\t$adminModel->setUserStatus($userid, 1);\n\t\t}\n\t\theader('Location: '.URL.'admin/users');\n\t}", "public function onAccountLocked($event) {\n EventController::save('User account ' . ($event->user->is_locked ? '' : 'un') . 'locked', 2, 'Account for user with ID: ' . $event->user->user_id . ' has been ' . ($event->user->is_locked ? '' : 'un') . 'locked by user with ID: ' . $event->admin->user_id, __FILE__);\n }", "public static function lockTable(){\n\t\t$statement = App::getDBO()->prepare('LOCK TABLES USERS WRITE');\n\t\t App::getDBO()->query();\n\t}", "function lock()\n{\n}", "public function lock()\r\n {\r\n frameEbbs::_()->getModule('backup')->lock();\r\n }", "function unlockAccount($userid){\n $query = \"UPDATE users_account SET status ='Active' WHERE userid = ?\";\n $paramType = \"i\";\n $paramValue = array(\n $userid\n );\n $this->db_handle->update($query, $paramType, $paramValue);\n }", "public function lock_cp()\n\t{\n\t\tif (ee()->session->userdata('admin_sess') == 0)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tee()->db->set('admin_sess', 0)\n\t\t\t->where('session_id', $this->userdata['session_id'])\n\t\t\t->update('sessions');\n\t}", "function Unlock($UserID)\n\t{\n\t\tj::SQL(\"UPDATE jfp_xuser SET LockTimeout=? , FailedLoginAttempts=0 WHERE ID=? LIMIT 1\",time(),$UserID);\n\t}", "static function unlock_account() {\n $model = \\Auth::$model;\n\n # hash GET param exists\n if ($hash = data('hash')) {\n\n # verificando se ha algum usuário com a hash.\n $user = $model::first(array(\n 'fields' => 'id, hash_unlock_account',\n 'where' => \"hash_unlock_account = '$hash'\"\n ));\n\n if (!empty($user)) {\n $user->hash_unlock_account = '';\n $user->login_attempts = 0;\n\n $user->edit() ?\n flash('Sua conta foi desbloqueada.') :\n flash('Algo ocorreu errado. Tente novamente mais tarte.', 'error');\n }\n }\n\n go('/');\n }", "public function lockToNormal() {}", "public function bloquearUsuario() {\n $valor=1;\n if($this->input->post(\"lock\")==1){\n $valor=0;\n }\n \n $this->db->where('usuario', $this->input->post(\"usuario\"));\n $data_table = array(\n 'status' => $valor,\n 'status_a' => $valor\n );\n $this->db->update('usuarios', $data_table);\n return \"true\";\n }", "public function walletlock()\n\t{\n\t\treturn $this->_get_error($this->connect('walletlock'));\n\t}", "public function lockAction()\r\n {\r\n $timesheet = $this->byId();\r\n \r\n $this->projectService->lockTimesheet($timesheet);\r\n \r\n $this->redirect('timesheet', 'edit', array('clientid'=>$timesheet->clientid, 'projectid'=>$timesheet->projectid, 'id'=>$timesheet->id));\r\n }", "function lockUser($uName) {\n\n Util::throwExceptionIfNullOrBlank($uName, \"User Name\");\n $objUtil = new Util($this->apiKey, $this->secretKey);\n try {\n\t\t $params = null;\n $headerParams = array();\n $queryParams = array();\n $signParams = $this->populateSignParams();\n $metaHeaders = $this->populateMetaHeaderParams();\n $headerParams = array_merge($signParams, $metaHeaders);\n $body = null;\n $body = '{\"app42\":{\"user\":{\"userName\":\"' . $uName . '\"}}}';\n $signParams['body'] = $body;\n $signature = urlencode($objUtil->sign($signParams)); //die();\n $headerParams['signature'] = $signature;\n $contentType = $this->content_type;\n $accept = $this->accept;\n $baseURL = $this->url;\n $baseURL = $baseURL . \"/lock\";\n $response = RestClient::put($baseURL, $params, null, null, $contentType, $accept, $body, $headerParams);\n $userResponseObj = new UserResponseBuilder();\n $userObj = $userResponseObj->buildResponse($response->getResponse());\n } catch (App42Exception $e) {\n throw $e;\n } catch (Exception $e) {\n throw new App42Exception($e);\n }\n return $userObj;\n }", "public function tree_lock() {\n global $db, $uid;\n\n if (($this->lock_user != false) && ($this->lock_user != $uid)) {\n // Baum ist bereits von einem anderen Benutzer gesperrt\n $lock_stamp = false;\n $this->error = \"ERR_ALREADY_LOCKED\";\n return false;\n } else if (($this->lock_user != false) && ($this->lock_user == $uid)) {\n // Eigene Sperre bereits aktiv\n $this->lock_stamp = time();\n $this->lock_expire = time() + 300;\n $result = $db->querynow(\"UPDATE `lock` SET STAMP_UPDATE='\".date('Y-m-d H:i:s', $this->lock_stamp).\"',\n STAMP_EXPIRE='\".date('Y-m-d H:i:s', $this->lock_expire).\"'\n WHERE FK_USER=\".$uid.\" AND IDENT='\".$this->table.$this->root.\"'\");\n if (!$result['str_error']) {\n $this->lock_user = $uid;\n return true;\n } else {\n $this->error = \"ERR_LOCK_FAILED\";\n $this->lock_stamp = 0;\n $this->lock_expire = 0;\n $this->lock_user = false;\n return false;\n }\n } else {\n // Baum nicht gesperrt, Sperre hinzu\n $this->lock_stamp = time();\n $this->lock_expire = time() + 300;\n $result = $db->querynow(\"INSERT INTO `lock` (FK_USER, IDENT, STAMP_UPDATE, STAMP_EXPIRE) VALUES\n (\".$uid.\",'\".$this->table.$this->root.\"', '\".date('Y-m-d H:i:s', $this->lock_stamp).\"', '\".\n date('Y-m-d H:i:s', $this->lock_expire).\"')\");\n if (!$result['str_error']) {\n $this->lock_user = $uid;\n return true;\n } else {\n $this->error = \"ERR_LOCK_FAILED\";\n $this->lock_user = false;\n return false;\n }\n }\n }", "public function set_lock($table_name, $record_id, $user_id);", "function document_locked($table, $id, &$vusername, &$vuserid){\n \t\t\tglobal $database;\n \t\t\t\n\t\t\t$vuserid = 0;\n\t\t\t$vusername = \"\";\n\t\t\t\n\t\t\t$sql = \"SELECT \n\t\t\t\t\t\t\t\tlockedby_user_id, user_name\n\t\t\t\t\t FROM \n\t\t\t\t\t \t\t\t`$table` d, users u\n\t\t\t\t\t WHERE \n\t\t\t\t\t \t\t\td.id=$id AND \n\t\t\t\t\t\t\t d.lockedby_user_id = u.id AND \n\t\t\t\t\t\t\t u.id;\";\t\t\t\t\t\t\t\t \t\t \n\t\t\t$ret = $database->query($sql);\n\t\t\t\n\t\t\tif (!$ret || !$ret->num_rows){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\t$row = $ret->fetch_array();\n\t\t\t\n\t\t\t$vuserid = $row['lockedby_user_id'];\n\t\t\t$vusername = $row['user_name'];\n\t\t\t \n\t\t\treturn true;\n }", "public function lockCheck($postValues) {\n try {\n if (!empty($postValues)) {\n @$password = $postValues->password;\n\n $fields[] = 'iAdminID';\n\n $condition[] = 'iAdminID = \"' . $this->session->userdata('ADMINID') . '\"';\n $condition[] = 'vPassword = \"' . md5($password) . '\"';\n\n $fields = implode(',', $fields);\n $condition = ' WHERE ' . implode(' AND ', $condition);\n\n $qry = 'SELECT ' . $fields . ' FROM ' . $this->tbl . $condition;\n $res = $this->db->query($qry);\n if ($res->num_rows() > 0) {\n $this->session->set_userdata(array('LOCKED' => FALSE));\n return 1;\n } else {\n $fields = $condition = array();\n $fields[] = 'iUserID';\n\n $condition[] = 'iUserID = \"' . $this->session->userdata('ADMINID') . '\"';\n $condition[] = 'vPassword = \"' . md5($password) . '\"';\n\n $fields = implode(',', $fields);\n $condition = ' WHERE ' . implode(' AND ', $condition);\n\n $qry = 'SELECT ' . $fields . ' FROM tbl_user ' . $condition;\n $res = $this->db->query($qry);\n if ($res->num_rows() > 0) {\n $this->session->set_userdata(array('LOCKED' => FALSE));\n return 1;\n }\n } return -1;\n } return 0;\n } catch (Exception $ex) {\n throw new Exception('Login Model : Error in loginCheck function - ' . $ex);\n }\n }", "function block(Request $request)\n {\n DB::table('users')\n ->where('id', $request->id)\n ->update([\n 'active' => '0',\n ]); \n\n AuditTrail::create(['user_id' => Auth::user()->id,\n 'username' => Auth::user()->username,\n 'form_name' => 'Account',\n 'activity' => 'Locked ' . 'Account ' . $request->username, \n ]);\n\n return redirect()->back();\n }", "protected function editLockPermissions() {}", "public function messageLockAction()\n {\n $params=$this->_request->getParams();\n $messageId=$params['messageId'];\n $change_status=$params['status'];\n $usertype=$this->adminLogin->type;\n if($messageId && $change_status=='lock')\n {\n $message=new Ep_Message_Message();\n $status=$message->checkMasterLockstatus($messageId);\n if($status=='unlocked')\n {\n $data['locked_user']=$this->adminLogin->userId;\n $message->updateLockstatus($messageId,$data);\n $this->_redirect(\"/mastermails/master-inbox-ep?submenuId=ML6-SL2\");\n }\n else\n $this->_redirect(\"/mastermails/master-inbox-ep?submenuId=ML6-SL2\");\n }\n elseif($messageId && $change_status=='unlock')\n {\n $message=new Ep_Message_Message();\n $status=$message->checkMasterLockstatus($messageId);\n if($status!='unlocked')\n {\n $data['locked_user']=NULL;\n $message->updateLockstatus($messageId,$data);\n $this->_redirect(\"/mastermails/master-inbox-ep?submenuId=ML6-SL2\");\n }\n else\n $this->_redirect(\"/mastermails/master-inbox-ep?submenuId=ML6-SL2\");\n }\n }", "function lock(Sabre_DAV_Locks_LockInfo $lockInfo);", "public function lock()\n {\n $this->isLocked = true;\n }", "function setCustomerLock($userName,$password,$role,$langpref,$parentid,$orderId)\n\t\t{\n\t\t\t$para = array($userName,$password,$role,$langpref,$parentid,$orderId);\n\t\t\t$return = $this->s->call(\"setCustomerLock\",$para);\n\t\t\t$this->debugfunction();\n\t\t\treturn $return;\n\t\t}", "abstract protected function lock(): void;", "private function sessionBruteForceLock($userId)\n {\n if (empty($userId)) {\n // block all request from this IP\n $userId = 0;\n }\n $userIP = Yii::$app->request->userIP;\n\n $model = UserLoginLockout::find()->where(['ip' => $userIP, 'user_id' => $userId])->one();\n\n if (!$model) {\n $model = new UserLoginLockout();\n $model->user_id = $userId;\n $model->ip = $userIP;\n $model->attempt_count = 0;\n\n if (!$model->save()) {\n throw new InvalidConfigException(\"error while storing the model.\" . var_export($model->getErrors(), true));\n }\n } else {\n // reset the attempt count if lockout time has been passed\n if ((time() - $model->updated_at) > $this->module->loginSessionAttemptLockoutTime) {\n $model->updateAttributes(['attempt_count' => 0]);\n }\n }\n\n $model->updateCounters(['attempt_count' => 1]);\n\n\n if ($model->attempt_count >= $this->module->loginSessionAttemptCount) {\n return $model->updated_at + $this->module->loginSessionAttemptLockoutTime;\n }\n\n $model->touch('updated_at');\n\n\n return false;\n }", "public function screenlock()\n\t{\n\t\tSession::put('lock', '1');\t\t\n\t\treturn View::make(\"admin/screen_lock\",$this->data);\n\t}", "function enableAccount($accountId)\n\t\t{\n\t\t\tmysql_query(\"UPDATE argus_accounts SET status = 'ENABLED' WHERE account_id = '\".$accountId.\"' AND status = 'DISABLED'\") or die(mysql_error());\n\t\t\t\n\t\t\treturn;\n\t\t}", "public function lock(): void;", "private function setAccountLockValue()\n {\n $value = $this->getDataByPath(self::$accountLockAttributeCode);\n\n $valueText = __('Unlocked');\n if ($value !== null) {\n $lockExpires = new \\DateTime($value);\n if ($lockExpires > new \\DateTime()) {\n $valueText = __('Locked');\n }\n }\n\n $this->setCustomAttribute(self::$accountLockAttributeCode, $valueText);\n }", "public function enableLocked()\n\t{\n\t\t$this->_locked = true;\n\t}", "function ForceLogin($UserIDorUsername)\n\t{\n\t\t$UserID=$this->GetUserID($UserIDorUsername);\n\t\tj::$Session->Login($this->Username($UserID),\"\",true);\n\t\tj::SQL(\"UPDATE jfp_xuser SET FailedLoginAttempts=0 , LockTimeout=? , LastLoginTimestamp=? , TemporaryResetPasswordTimeout=? WHERE ID=? LIMIT 1\",time(),time(),time(),$UserID);\n\t\treturn true;\n\t}", "private function lockLink()\n {\n return $this->model->action('link','lock',\n array('job' => 'lock',\n 'id_link' => (int)$_REQUEST['id_link'],\n 'by_id_user' => (int)$this->viewVar['loggedUserId']) ); \n }", "public function lock()\n {\n $this->locked = true;\n }", "public function blockUser($id)\n {\n $this->db->set('status_id', '1');\n $this->db->where('id', $id);\n $this->db->update('temp_user');\n return true;\n }", "public function blockUser($id)\n {\n $this->db->set('status_id', '1');\n $this->db->where('id', $id);\n $this->db->update('inm_user');\n return true;\n }", "public function setLoginAdminTries($username){\n \n $this->con->query(\"UPDATE admin SET lock_count=lock_count+1 WHERE username='\".$username.\"';\");\n }", "public function disable_user() \n {\n $conn = $this->conn;\n $login = $this->login;\n \n $params = array($login);\n $query = \"UPDATE users SET enabled = -1 WHERE login = ?\";\n \n $rs = $conn->Execute($query, $params);\n \n if (!$rs) \n { \n return FALSE;\n }\n \n $infolog = array($login);\n Log_action::log(93, $infolog);\n \n return TRUE;\n }", "function toggle_user($username,$force_disable=false){\n\n\t//Toggle enable status\n\t$my_row=array();\n\t$row =_user_load_user($username);\n\t//var_dump($row);\n\tif ($row['STATUS']==\"1\"){\n\t\t$my_row['ABILITATO']=\"0\";\n\t\t$enab = \"DISABLED\";\n\t}else{\n\t\t$my_row['ABILITATO']=\"1\";\n\t\t$enab = \"ENABLED\";\n\t}\n\tif($force_disable){\n\t\t$my_row['ABILITATO']=\"0\";\n\t\t$enab = \"DISABLED\";\n\t}\n\t$my_row['USERID'] = $row['USERID'];\n\t//var_dump($my_row);\n\t$retval = true;\n\t$table = \"UTENTI\";\n\t$action = ACT_MODIFY;\n\t$keys = array('USERID');\n\t//common_add_message(print_r($row,true),INFO);\n\tif (db_form_updatedb($table, $my_row, $action, $keys)){\n\t\t//common_add_message(\"Privilege $enab\", INFO);\n\t}else{\n\t\t//common_add_message(\"Error during privilege toggling\", ERROR);\n\t\t$retval = false;\n\t}\n\tif($retval){\n\t\tdb_commit();\n\n\t}\n\tif(isAjax()){\n\t\techo json_encode(array(\"sstatus\" => $retval ? \"ok\" : \"ko\", \"return_value\"=>$retval));\n\t\tdb_close();die();\n\t}\n\telse {\n\t\tdb_close();\n\t\treturn $retval;\n\t}\n}", "public function activate_user() {\n global $database;\n $sql = \"UPDATE user SET is_active = 1 WHERE id = \";\n $sql .= $database->escape_value($this->id);\n $database->query($sql);\n }", "function loginUser() {\n $email = htmlspecialchars(trim($_POST['email']), ENT_QUOTES);\n $password = htmlspecialchars(trim($_POST['password']), ENT_QUOTES);\n \n connectDatabase();\n \n $result = queryDatabase(\"SELECT pk\n FROM user\n WHERE email = '$email' AND\n password = '$password' AND\n active = 1\");\n\n if (mysql_num_rows($result) == 1) {\n $row = mysql_fetch_object($result);\n $date = date('Y-m-d');\n \n queryDatabase(\"UPDATE user SET last_login = '$date' WHERE pk = $row->pk\");\n $_SESSION['pk'] = crypt($row->pk, SALT);\n\n header('Location: ' . HOME . 'member.php?feedback=9');\n } else {\n $result = queryDatabase(\"SELECT pk\n FROM user\n WHERE email = '$email' AND\n password = '$password' AND\n active = 0\");\n\n if (mysql_num_rows($result) >= 1)\n header('Location: ' . HOME . 'login.php?feedback=2');\n else\n header('Location: ' . HOME . 'login.php?feedback=1');\n }\n}", "public function modifpassword($user,$passwd){\n \n }", "public function LockArea($area)\n\t\t{\n\t\t\t$area->setAttribute('date_locked',Date('Y-m-d H:i:s',strtotime(\"+{$this->dateLockedWindowMinutes} minutes\")));\n\t\t\t\n\t\t\t$area->setAttribute('identifier',$_COOKIE['CONCRETE5']);\n\t\t\t\n\t\t\t\n\t\t}", "public function releaseLock($user_id) {\n\t\t\tglobal $db;\n\t\t\t$query = \"UPDATE users SET lock_guid='' WHERE id=$user_id\";\n\t\t\t//print \"$query<br>\\n\"; \n\t\t\tif ($db->query($query)) {\n\t\t\t\t$_SESSION['treeline_user_lock_guid']='';\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}", "public function lock(): void {}", "public function lock(): void {}", "public function lock(): void {}", "public function lock(): void {}", "public function lock(): void {}", "public function lock_class_attendance() {\n $course_id =$this->input->post('course_id');\n $class_id =$this->input ->post('class_id');\n $tenant_id = $this->tenant_id;\n $result = $this->classtraineemodel->lock_class_attendance($tenant_id,$course_id,$class_id);\n if($result == TRUE)\n {\n echo $sucess = 1;\n }\n else\n {\n echo $fail =0;\n }\n \n \n }", "public function isAccountNonLocked(){\n return true;\n }", "function suspendUser($username, $email, $recovery){\n\t$con = new mysqli('localhost','heng','@powell135','200ok');\n\tif ($con -> connect_errno){\n \treturn CONNECTION_FAIL;\n\t}\n\t\n\t$query = \"UPDATE jnjn_user SET suspended='1', recovery='$recovery' WHERE username='$username' and email='$email'\";\n\t$con -> query($query);\n\tif($con -> affected_rows == 1)\n\t\treturn SUCCESS;\n\telse\n\t\treturn FAIL;\n}", "private function getLock( & $article )\n {\n // lock the user to edit\n $result = $this->model->action('article','lock',\n array('job' => 'is_locked',\n 'id_article' => (int)$article['id_article'],\n 'by_id_user' => (int)$this->viewVar['loggedUserId']) );\n \n if(($result !== TRUE) && ($result !== FALSE))\n {\n $article['lock'] = TRUE; \n } \n else\n {\n $article['lock'] = FALSE; \n } \n }", "function disableAccount($accountId)\n\t\t{\n\t\t\tmysql_query(\"UPDATE argus_accounts SET status = 'DISABLED' WHERE account_id = '\".$accountId.\"' AND status = 'ENABLED'\") or die(mysql_error());\n\t\t\t\n\t\t\treturn;\n\t\t}", "public function lock() {}", "function lock() {\n global $_Query_lock_depth;\n if ($_Query_lock_depth < 0) {\n Fatal::internalError('Negative lock depth');\n }\n if ($_Query_lock_depth == 0) {\n $row = $this->select1($this->mkSQL('select get_lock(%Q, %N) as locked',\n OBIB_LOCK_NAME, OBIB_LOCK_TIMEOUT));\n if (!isset($row['locked']) or $row['locked'] != 1) {\n Fatal::cantLock();\n }\n }\n $_Query_lock_depth++;\n }", "function cmd_lock($db, $params, $computer) {\n global $glo_dirname;\n\t\tif (!isset($params['lock'])) {\n throw new NuboException(ERROR_MISSING_PARAMETER);\n }\n $mutex = fopen(\"./$glo_dirname/lock\", \"w+\");\n if (!$mutex) {\n throw new NuboException(ERROR_INTERNAL);\n }\n try {\n flock($mutex, LOCK_EX);\n if ($params['lock']) {\n $result = $db->select('SELECT computer_id FROM tbl_computer WHERE lock IS NOT NULL');\n if (reset($result) !== false) {\n $status = 'busy';\n } else {\n $db->execute('UPDATE tbl_computer SET lock=:ltime WHERE computer_id=:id', ['id/int' => $computer, 'ltime/int' => time()]);\n $status = 'locked';\n }\n } else {\n $db->execute('UPDATE tbl_computer SET lock=NULL WHERE computer_id=:id', ['id/int' => $computer]);\n $status = 'unlocked';\n }\n } finally {\n flock($mutex, LOCK_UN);\n fclose($mutex);\n }\n\t\treturn ['status' => $status];\n\t}", "public function lock()\n {\n $this->lock = true;\n }", "private function attemptLogin($user){\n\n }", "function login_form_with_name_lock($id = 0) {\r\n\r\n\t\t$this->set_rules_validation('Lock');\r\n\r\n\t\tif ($this->form_validation->run() == TRUE) {\r\n\r\n\t\t\t$userPassword = md5(md5(\r\n\t\t\t\t\t\t\t\ttrim($this->input->post('inputPassword'))\r\n\t\t\t\t\t\t\t));\r\n\r\n\t\t\tif ($this->check_users_by_id_and_password($id, $userPassword) == 1) {\r\n\r\n\t\t\t\tif ($this->throttle_lib->check_throttle_by_user_id($id) == 1) {\r\n\r\n\t\t\t\t\t$check_ip_address = $this->check_ip_address($id);\r\n\r\n\t\t\t\t\tif ($check_ip_address == 'match') {\r\n\r\n\t\t\t\t\t\t$param = 'update_record';\r\n\r\n\t\t\t\t\t\t$accessTo = $this->get_last_access_from_throttle_by_user_id($id);\r\n\r\n\t\t\t\t\t\t$this->login_process($id, $param, $this->accessName, $accessTo);\r\n\r\n\t\t\t\t\t} elseif ($check_ip_address == 'not-match') {\r\n\r\n\t\t\t\t\t\t$ipAddressSessionData = $this->get_ip_address_from_throttle_by_user_id($id);\r\n\r\n\t\t\t\t\t\t$this->session->set_flashdata('message', '<label class=\"label label-warning\"><i class=\"fa fa-warning\"></i> Warning:</label>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label class=\"label label-warning\">Your account already logged on at the address</label>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label class=\"label label-warning\">' . $ipAddressSessionData . '</label>');\r\n\r\n\t\t\t\t\t\tredirect('signin/attention/user_id/' . $id, 'location');\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// End of match ipAddress\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t$param = 'insert_record';\r\n\r\n\t\t\t\t\t$this->login_process($id, $param, $this->accessName, $this->accessTo);\r\n\r\n\t\t\t\t}\r\n\t\t\t\t// End of check_throttle_by_user_id\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t$this->web_config_lib->alert_error('Error: Login failed, your password was incorrect');\r\n\r\n\t\t\t\tredirect('signin/user_id/' . $id, 'location');\r\n\r\n\t\t\t}\r\n\t\t\t// End of check_users_by_id_and_password\r\n\r\n\t\t} else {\r\n\r\n\t\t\t$usersField = 'name, images';\r\n\r\n\t\t\t$addAttribPage = array(\r\n\t\t\t\t\t\t\t\t'corporation' => $this->web_config_lib->get_corporation(),\r\n\t\t\t\t\t\t\t\t'users' => $this->users_model->get_users_by_id($id, $usersField)\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\r\n\t\t\t$viewData = array_merge($addAttribPage, $this->attribPage, $this->attribThisPage);\r\n\r\n\t\t\t$this->template_lib->webadmin_header_login($viewData);\r\n\t\t\t$this->load->view('webadmin/login/login-wrong-password', $viewData);\r\n\t\t\t//$this->template_lib->footer_front($viewData);\r\n\r\n\t\t}\r\n\t\t// End of form_validation\r\n\r\n\t}", "private function lock() {\n\t\tif (file_exists($this -> lockfile)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn file_put_contents($this -> lockfile, 'I am locked!') !== false;\n\t}", "function modify_user($username, $password, $team, $level, $status, $msj) {\n\n $Fecha = date(\"Y-m-d\");\n\n\n // If $password is blank, make no changes to the current password\n\n if (trim($password == '')) {\n\n $qUpdate = \"UPDATE authuser SET team='$team', level='$level', status='$status',feclave='$Fecha',msj='$msj' WHERE uname='$username'\";\n } else {\n\n $qUpdate = \"UPDATE authuser SET passwd=MD5('$password'), team='$team', level='$level',\n status='$status',feclave='$Fecha',msj='$msj'\n\t\t\t\t\t WHERE uname='$username'\";\n }\n\n\n\n if (trim($level) == \"\") {\n\n return \"blank level\";\n } elseif (($username == \"sa\" AND $status == \"inactive\")) {\n\n return \"sa cannot be inactivated\";\n } elseif (($username == \"admin\" AND $status == \"inactive\")) {\n\n return \"admin cannot be inactivated\";\n } else {\n\n $connection = mysql_connect($this->HOST, $this->USERNAME, $this->PASSWORD);\n\n $SelectedDB = mysql_select_db($this->DBNAME);\n\n $result = mysql_query($qUpdate);\n\n return 1;\n }\n }", "private function refreshLockInformation()\n {\n $result = self::$db->fetchOne(\n 'SELECT lock, locktime FROM jukebox.playlists WHERE playlistid=$1',\n [$this->getID()]\n );\n $this->lock = empty($result['lock']) ? null : MyRadio_User::getInstance($result['lock']);\n $this->locktime = (int) $result['locktime'];\n }", "protected function _lockUser($dns, $type = 'toggle')\n {\n global $config, $ui;\n\n // Filter out entries we are not allowed to modify\n $disallowed = array();\n\n if(!is_array($dns)) {\n $dns = array($dns);\n }\n\n foreach ($dns as $dn) {\n if (!preg_match('/w/', $ui->get_permissions($dn, 'user/password'))) {\n $disallowed[] = $dn;\n }\n }\n if (count($disallowed)) {\n return array('errors' => array(msgPool::permDelete($disallowed)));\n }\n\n // Try to lock/unlock the entries.\n $ldap = $config->get_ldap_link();\n $errors = array();\n foreach ($dns as $dn) {\n $ldap->cat($dn, array('userPassword'));\n if ($ldap->count() == 1) {\n // We can't lock empty passwords.\n $val = $ldap->fetch();\n if (!isset($val['userPassword'])) {\n $errors[] = sprintf(_('Failed to get password method for account \"%s\". It has not been locked!'), $dn);\n continue;\n }\n // Detect the password method and try to lock/unlock.\n $method = passwordMethod::get_method($val['userPassword'][0], $dn);\n if ($method instanceOf passwordMethod) {\n $success = TRUE;\n if ($type == 'toggle') {\n if ($method->is_locked($dn)) {\n $success = $method->unlock_account($dn);\n } else {\n $success = $method->lock_account($dn);\n }\n } elseif ($type == 'lock' && !$method->is_locked($dn)) {\n $success = $method->lock_account($dn);\n } elseif ($type == 'unlock' && $method->is_locked($dn)) {\n $success = $method->unlock_account($dn);\n }\n\n // Check if everything went fine.\n if (!$success) {\n $hn = $method->get_hash_name();\n if (is_array($hn)) {\n $hn = $hn[0];\n }\n $errors[] = sprintf(_('Password method \"%s\" failed locking. Account \"%s\" has not been locked!'), $hn, $dn);\n }\n } else {\n // Can't lock unknown methods.\n $errors[] = sprintf(_('Failed to get password method for account \"%s\". It has not been locked!'), $dn);\n }\n } else {\n $errors[] = sprintf(_('Could not find account \"%s\" in LDAP. It has not been locked!'), $dn);\n }\n }\n if (!empty($errors)) {\n return array('errors' => $errors);\n }\n }", "public function unlock(): void;", "private function setLock($status) {\n $this->status->is_locked = $status;\n $this->status->save();\n }", "function _update_locked () {\n\t\t\n\t\t// How old do locks have to be to get unlocked?\n\t\t$minutes = 10;\n\t\t\n\t\t$time = gmdate(\"Y-m-d H:i:s\", (time() - ($minutes * 60)));\n\t\t\n\t\t$q = $this->db->query(\"UPDATE commentreports\n\t\t\t\t\t\tSET \tlocked = NULL,\n\t\t\t\t\t\t\t\tlockedby = 0\n\t\t\t\t\t\tWHERE\tlocked < '$time'\n\t\t\t\t\t\t\");\n\t\n\t}", "function updateCurrentUserRememberToken($rememberToken = null)\n{\n global $connection;\n $userId = $_SESSION['user_id'];\n $sql = \"UPDATE tbl_users SET remember='$rememberToken' WHERE ID ='$userId'\";\n return mysqli_query($connection, $sql);\n}", "public function isLocked();", "public function isLocked();", "public function isLocked();", "public function setLocked($locked = true) {}", "public function invalidateCurrentLogin();", "public function lockPayments()\n {\n $this -> lock_payments = true;\n $this -> save();\n }", "public function lockAction() {\n $id = $this->getRequest()->getParam('id');\n $mid = $this->getRequest()->getParam('mid');\n $data = $this->model->lockContent($id);\n $this->redirect('materialcontent/index/id/' . $mid);\n }", "function lock($db, $id, $table='activity') {\n if ($id<0) return -1; # ignore 'new' entries.\n $q='UPDATE '.$table.' set editlock=datetime(\\'now\\',\\'+5 minutes\\') WHERE editlock < datetime(\\'now\\') AND id='.$id.';';\n if ($db->exec($q) == 1) return -1;\n\n $q='SELECT editlock from '.$table.' WHERE id='.$id.';';\n $res=$db->query($q);\n if (!$res) return 0; # XXX error\n $r=$res->fetch(PDO::FETCH_ASSOC);\n return $r['editlock'];\n }", "public function isLocked() {}", "function login($username, $password){\n $con = new mysqli('localhost','heng','@powell135','200ok');\n if ($con -> connect_errno){\n \treturn CONNECTION_FAIL;\n\t}\n\n $query = \"SELECT * FROM jnjn_user WHERE username='$username' and password = '$password'\";\n $result = $con -> query($query);\n\n\tif($result->num_rows == 1){\n\t\t$row = mysqli_fetch_array($result);\n\t\tif($row['suspended'])\n\t\t\treturn SUSPENDED;\n\n\t\tsession_start();\n\t\t$_SESSION['jnjn_username'] = $username; // store the general permission into session cookie\n\t\t$_SESSION['gen_per'] = $row['permission'];\n\t\t$date = date('Y-m-d H:i:s');\n\t\t$query = \"update jnjn_user set lastLogin='$date', lastUpdate='$date' where username='$username'\";\n\t\t$con -> query($query);\n\t\t$result -> close();\n\t\treturn SUCCESS;\n\t}else{\n\t\t$result -> close();\n\t\treturn FAIL;\t\n\t}\n}", "Public Function enableUser($ID)\n\t{\n\t\t$this->_db->exec(\"UPDATE bevomedia_user SET enabled = 1 WHERE id = $ID\");\n\t\t\n\t}", "public function adminSuspendUser($id)\n\t{\n\t\t$sql = \"SELECT id,active FROM users WHERE id = '\".$id.\"'\";\n\t\t$res = $this->processSql($sql);\n\t\tif ($res){\n\t\t\t$update = \"UPDATE users SET active = 2 WHERE id = '\".$id.\"'\";\n\t\t\t$result = $this->processSql($update);\n\t\t\tif ($result)\n\t\t\treturn 99;\n\t\t\treturn 1;\n\t\t} else return 2;\n\t}", "public function suspend_user(User $user){\n //If the user is active suspend them if not reinstate them\n if ($user->active == 1) {\n $user->active = 0;\n $user->save();\n session()->flash('status', $user->username . ' was successfully suspended');\n return redirect()->back();\n }\n $user->active = 1;\n $user->save();\n session()->flash('status', $user->username . ' was successfully reinstated');\n return redirect()->back();\n }", "private function unlockByIdUser($data)\n {\n $sql = \"DELETE FROM {$this->config->dbTablePrefix}keyword_lock\n WHERE `by_id_user`={$data['id_user']}\";\n\n $this->model->dba->query($sql); \n }", "public function is_user_disabled() \n {\n $conn = $this->conn;\n $login = $this->login;\n \n $clogin = $conn->GetOne(\"SELECT login FROM users WHERE login = '\".$login.\"' AND expires > '\".gmdate('Y-m-d H:i:s').\"'\");\n \n if ($clogin == '') \n {\n $this->conn->Execute(\"UPDATE users SET enabled=0 WHERE login= '\".$login.\"'\");\n }\n \n $conf = $GLOBALS['CONF'];\n $lockout_duration = intval($conf->get_conf(\"unlock_user_interval\")) * 60; \n \n \n $params = array($login);\n $query = \"SELECT * FROM users WHERE login = ? AND enabled <= 0\";\n \n $rs = $conn->Execute($query, $params); \n \n if (!$rs) \n {\n Av_exception::write_log(Av_exception::DB_ERROR, $conn->ErrorMsg());\n \n return FALSE;\n }\n \n if (!$rs->EOF) \n {\n // User must be unlocked by admin\n if ($lockout_duration == 0 || $rs->fields['enabled'] == 0) \n { \n return TRUE; \n }\n \n //Auto-enable if account lockout duration expires\n if (time() - strtotime($rs->fields['last_logon_try']) >= $lockout_duration) \n {\n $conn->Execute('UPDATE users SET enabled = 1 WHERE login=?', $params);\n \n return FALSE;\n }\n \n return TRUE;\n }\n \n return FALSE;\n }", "protected function lock()\n {\n $this->isStateLocked = true;\n }", "public function setLoginTries($email){\n \n $this->con->query(\"UPDATE user SET lock_count=lock_count+1 WHERE email='\".$email.\"';\");\n }", "public function toggle_enabled_user($conn, $user) \n { \n Ossim_db::check_connection($conn);\n \n $params = array($user);\n $query = \"SELECT enabled FROM users WHERE login = ?\";\n \n $rs = $conn->Execute($query, $params);\n \n if (!$rs) \n { \n return FALSE;\n } \n \n $enabled = ($rs->fields['enabled'] <= 0) ? 1 : 0;\n \n if($enabled == 1) \n {\n $clogin = $conn->GetOne(\"SELECT login FROM users WHERE login = '\".$user.\"' AND expires > '\".gmdate('Y-m-d H:i:s').\"'\");\n \n if ($clogin == '') \n {\n if ($conn->Execute(\"UPDATE users SET expires = '2200-01-01 00:00:00' WHERE login = '\".$user.\"'\") === FALSE) \n { \n return FALSE;\n }\n }\n }\n\n $query = \"UPDATE users SET enabled = $enabled WHERE login = ?\";\n $rs = $conn->Execute($query, $params);\n \n if (!$rs) \n { \n return FALSE;\n }\n \n return TRUE; \n }", "private function lockKeyword($data)\n {\n $result = $this->isKeywordLocked($data);\n // False = the key isnt locked\n // True = the key is locked by the logged user\n // if not locked by the logged user, $result\n // contains the id of the user which locks\n if(($result !== FALSE) && ($result !== TRUE))\n {\n return $result;\n }\n \n if($result == FALSE)\n {\n $sql = \"REPLACE INTO {$this->config->dbTablePrefix}keyword_lock\n (`id_key`,`lock_time`,`by_id_user`)\n VALUES\n ({$data['id_key']},NOW(),{$data['by_id_user']})\";\n\n $this->model->dba->query($sql); \n }\n return TRUE;\n }", "function suspendUsers($getSelectedUser, $addedOn, $username)\n{\n require('../core/db2.php');\n\n $sql = \"UPDATE users SET \n registration_status = 'Pending',\n approved_by = '$username',\n approved_on = '$addedOn'\n WHERE username = '$getSelectedUser'\";\n if ($con->query($sql) === true) {\n echo \"\";\n } else {\n // echo \"Error: \" . $sql . \"<br>\" . $con->error;\n echo \"Error\";\n }\n}", "public function enableAccount($userId) {\n User::where('id', $userId)->update([\n 'disabled' => false\n ]);\n\n return response()->json([\n 'title' => 'Succes!',\n 'message' => 'Contul a fost activat!'\n ]);\n }", "public function disableAccount($userId) {\n\n if (Auth::user()->id == $userId) {\n return response()->json([\n 'title' => 'Ooops.',\n 'message' => 'Nu îți poți dezactiva contul tău.',\n ], 422);\n }\n\n User::where('id', $userId)->update([\n 'disabled' => true\n ]);\n\n return response()->json([\n 'title' => 'Succes!',\n 'message' => 'Contul a fost dezactivat!'\n ]);\n }", "public static function setLocked()\n {\n self::$locked = true;\n }", "public function suspendUser($username)\n {\n $conn = new DBConnect();\n $dbObj = $conn->getDBConnect();\n $this->DAO = new SecurityDAO($dbObj);\n return $this->DAO->suspendUser($username);\n }", "function setLocked($l) {\n\t\t$this->set(\"locked\",$l);\n\t}", "public function writeunlock() {}" ]
[ "0.699564", "0.6948573", "0.6936408", "0.6891661", "0.6808437", "0.67276627", "0.67084074", "0.6677602", "0.6629723", "0.6624969", "0.66050994", "0.653671", "0.6534801", "0.6527167", "0.6525149", "0.65177596", "0.6380179", "0.63343114", "0.6333951", "0.6330517", "0.62679476", "0.6232842", "0.621158", "0.6192814", "0.6186889", "0.617649", "0.61536145", "0.61374795", "0.61002123", "0.6093927", "0.60686934", "0.6046852", "0.6019818", "0.6006244", "0.5995959", "0.5994498", "0.59927183", "0.59763616", "0.5974126", "0.59709", "0.596428", "0.5954417", "0.5942111", "0.594086", "0.5928784", "0.589596", "0.5894772", "0.5890937", "0.58892584", "0.58842325", "0.58830035", "0.58830035", "0.58830035", "0.58830035", "0.58830035", "0.58800775", "0.58780575", "0.58590627", "0.5849383", "0.584704", "0.5837908", "0.58239555", "0.5820553", "0.5792289", "0.57807547", "0.5776751", "0.57747346", "0.5761956", "0.575656", "0.5750046", "0.57351077", "0.5734852", "0.5733937", "0.57331216", "0.5732001", "0.5732001", "0.5732001", "0.57254165", "0.57165736", "0.5714712", "0.5712018", "0.5704848", "0.5696133", "0.5691277", "0.5687293", "0.56828296", "0.5678394", "0.56743056", "0.5672908", "0.5671802", "0.5657861", "0.56534606", "0.5645303", "0.56391335", "0.56304044", "0.56287783", "0.56224096", "0.56222045", "0.5622086", "0.56217027" ]
0.77444375
0
function to unlock(reactivate) user account
function unlockAccount($userid){ $query = "UPDATE users_account SET status ='Active' WHERE userid = ?"; $paramType = "i"; $paramValue = array( $userid ); $this->db_handle->update($query, $paramType, $paramValue); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static function unlock_account() {\n $model = \\Auth::$model;\n\n # hash GET param exists\n if ($hash = data('hash')) {\n\n # verificando se ha algum usuário com a hash.\n $user = $model::first(array(\n 'fields' => 'id, hash_unlock_account',\n 'where' => \"hash_unlock_account = '$hash'\"\n ));\n\n if (!empty($user)) {\n $user->hash_unlock_account = '';\n $user->login_attempts = 0;\n\n $user->edit() ?\n flash('Sua conta foi desbloqueada.') :\n flash('Algo ocorreu errado. Tente novamente mais tarte.', 'error');\n }\n }\n\n go('/');\n }", "public function unlock(): void;", "public function unlock()\r\n {\r\n frameEbbs::_()->getModule('backup')->unlock();\r\n }", "private function userUnblock()\n\t{\n\t\t// Make sure the payment is complete\n\t\tif($this->state != 'C') return;\n\t\t\n\t\t// Make sure the subscription is enabled\n\t\tif(!$this->enabled) return;\n\t\t\n\t\t// Paid and enabled subscription; enable the user if he's not already enabled\n\t\t$user = JFactory::getUser($this->user_id);\n\t\tif($user->block) {\n\t\t\t// Check the confirmfree component parameter and subscription level's price\n\t\t\t// If it's a free subscription do not activate the user.\n\t\t\tif(!class_exists('AkeebasubsHelperCparams')) {\n\t\t\t\trequire_once JPATH_ADMINISTRATOR.'/components/com_akeebasubs/helpers/cparams.php';\n\t\t\t}\n\t\t\t$confirmfree = AkeebasubsHelperCparams::getParam('confirmfree', 0);\n\t\t\tif($confirmfree) {\n\t\t\t\t$level = FOFModel::getTmpInstance('Levels', 'AkeebasubsModel')\n\t\t\t\t\t->getItem($this->akeebasubs_level_id);\n\t\t\t\tif($level->price < 0.01) {\n\t\t\t\t\t// Do not activate free subscription\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t$updates = array(\n\t\t\t\t'block'\t\t\t=> 0,\n\t\t\t\t'activation'\t=> ''\n\t\t\t);\n\t\t\t$user->bind($updates);\n\t\t\t$user->save($updates);\n\t\t}\n\t}", "public function deactivate($username);", "public function unlock() {\n }", "public static function email_unlock_account() {\n\n if ($u = static::check_record_existence()) {\n\n # definindo conta como não confirmada.\n $u->hash_unlock_account = \\Security::random(32);\n if (!$u->edit())\n flash('Algo ocorreu errado. Tente novamente mais tarde.', 'error');\n\n $m = auth_model();\n if ($m::first(array('where' => 'id = \\'' . $u->id . '\\''))->emailUnlockAccount())\n flash('Email com as instruções para Desbloqueamento de conta enviado para ' . $u->email . '.');\n else\n flash('Algo ocorreu errado. Tente novamente mais tarde.', 'error');\n }\n\n go_paginate();\n }", "public function unlock(): void {}", "public function unlock(): void {}", "public function unlock(): void {}", "public function unlock(): void {}", "public function unlock(): void {}", "function deactivateUser()\n {\n // Sets the value of activated to no\n $int = 0;\n\n $mysqli = $this->conn;\n\n /* Prepared statement, stage 1: prepare */\n if (!($stmt = $mysqli->prepare(\"UPDATE User SET\n \t\t\tactiveUser = ?\n \t\t\t\tWHERE ID = ?\"))\n ) {\n echo \"Prepare failed: (\" . $mysqli->errno . \") \" . $mysqli->error;\n }\n\n /* Prepared statement, stage 2: bind and execute */\n\n if (!($stmt->bind_param(\"ii\",\n $int,\n $this->id))\n ) {\n echo \"Binding parameters failed: (\" . $stmt->errno . \") \" . $stmt->error;\n }\n\n if (!$stmt->execute()) {\n echo \"Execute failed: (\" . $stmt->errno . \") \" . $stmt->error;\n }\n\n }", "function lockout($username = \"\") {\n\t\tglobal $wpdb;\n\n\t\t$ip = $this->get_user_ip();;\n\n\t\t$username = sanitize_user($username);\n\n\t\t$user = get_user_by( 'login', $username );\n\n\t\tif ( !$user ) { \n\t\t\t$user = new stdClass();\n\t\t\t$user->ID = 0;\n\t\t}\n\n\t\t$sql = \"insert into \" . $this->lock_table . \" (user_id, lockdown_date, release_date, lockdown_IP) \" .\n\t\t\t \"values ('\" . $user->ID . \"', NOW(), date_add( NOW(), interval \" .\n\t\t\t $this->ll_options['lockout_length'] . \" MINUTE), '\" . $wpdb->escape($ip) . \"')\";\n\n\t\t$wpdb->query($sql);\n\n\t\tif ( 'yes' == $this->ll_options['notify_admins'] )\n\t\t\t$this->ll_notify_admins( $ip, $username );\n\n\t}", "protected function unlock($user)\n {\n $newPass = bin2hex(random_bytes(6));\n $this->users->unlock(['id' => $user->getId(), 'pass' => $this->password->hash($newPass)]);\n $this->mail->send($this->mail->unlock($user, $newPass));\n }", "protected function switchUserBack() {\n if ($this->isUserSwitched) {\n $this->accountSwitcher->switchBack();\n $this->isUserSwitched = FALSE;\n }\n }", "private function deactivate_user($id) {\n\t\t//Update user table\n\t\t$query = \"UPDATE users SET deactivated='1' WHERE id='$id'\";\n\t\t$update_database = mysqli_query($this->con, $query);\n\t\t//Insert into User History for Documentation\n\t\t$employee_id = $this->check_employee_id($id);\n\t\t$query = \"INSERT INTO user_history (employee_id, access_prior, access_after, updated_by, note) VALUES ('$employee_id','0', '0', 'System', 'Account Deactivated due to 180 days of No Access.')\";\n\t\t$insert_database = mysqli_query($this->con, $query);\n\t}", "function Unlock($UserID)\n\t{\n\t\tj::SQL(\"UPDATE jfp_xuser SET LockTimeout=? , FailedLoginAttempts=0 WHERE ID=? LIMIT 1\",time(),$UserID);\n\t}", "function desactivar_authuser($id)\n\t{\n\t\t$query = \"UPDATE authuser set status=0 WHERE id = $id'\";\n\t\t$result=mysql_query($query);\n\t\treturn $result;\n\t}", "public function disable()\n {\n $user = User::where('idPerson', '=', \\Auth::user()->idPerson)->first();\n $user->status = 2;\n $user->confirmation_code = NULL;\n $user->save();\n return Redirect::to('logout');\n }", "function deactivate($uID=\"\") {\n if(!$uID) {\n echo \"Need uID to deactivate!! - error dump from User_class.php\";\n exit;\n }\n $SQL = \"UPDATE User \".\n \"SET Active = '0' \".\n \"WHERE ID = $uID\";\n mysqli_query($this->db_link, $SQL);\n\n }", "public function deactivateaccount() {\n\n // Fetch the request data in JSON format and convert it into object\n $request_data = $this->request->input('json_decode');\n switch (true) {\n // When request is not made using POST method\n case!$this->request->isPost() :\n $success = false;\n $status = BAD_REQUEST;\n $message = 'Wrong request method.';\n break;\n // Request is valid and phone no and name are present\n case!empty($request_data) && !empty($request_data->phone_no) && !empty($request_data->user_token) && !empty($request_data->reason_type) && !empty($request_data->password): // && !empty($request_data->other_reason) && !empty($request_data->email_opt_out):\n // Check if phone no exists\n $data = $this->User->findUser($request_data->phone_no);\n\n // Check if record exists\n if (count($data) != 0) {\n // Check uuid entered is valid\n if ($data[0]['User']['verified'] === false) {\n $success = false;\n $status = UNAUTHORISED;\n $message = 'User not verified';\n } elseif ($request_data->user_token != $data[0]['User']['user_token']) { // User Token is not valid\n $success = false;\n $status = UNAUTHORISED;\n $message = 'User Token is invalid';\n } elseif (md5($request_data->password) != $data[0]['User']['password']) { // User password is matching or not.\n $success = false;\n $status = UNAUTHORISED;\n $message = 'Password did not match';\n } else {\n\n $dataArray = array();\n $dataArray['User']['_id'] = $data[0]['User']['_id'];\n $dataArray['User']['reason_type'] = $request_data->reason_type;\n $dataArray['User']['is_active'] = 'no';\n $dataArray['User']['other_reason'] = !empty($request_data->other_reason) ? trim($request_data->other_reason) : '';\n $flag = $this->User->save($dataArray);\n\n if ($flag) {\n // send email to user's email address..\n if (!empty($request_data->email_opt_out) && $request_data->email_opt_out == 'yes') {\n App::uses('CakeEmail', 'Network/Email');\n $Email = new CakeEmail('default');\n $Email->from(array(SUPPORT_SENDER_EMAIL => SUPPORT_SENDER_EMAIL_NAME));\n $Email->to(strtolower(trim($data[0]['User']['email'])));\n $Email->subject('Clickin | Account Deactivation');\n $Email->emailFormat('html');\n $messageEmail = '';\n $messageEmail .= \"Hi \" . trim($data[0]['User']['name']) . ',<br><br> You have deactivated clickin account. You can reactivate your account\n by signing in again.<br><br>Regards,<br>Clickin\\' Team';\n $Email->send($messageEmail);\n }\n\n $success = true;\n $status = SUCCESS;\n $message = 'Your account has been deactivated.';\n } else {\n $success = false;\n $status = ERROR;\n $message = 'There was a problem in processing your request';\n }\n }\n }\n // Return false if record not found\n else {\n $success = false;\n $status = UNAUTHORISED;\n $message = 'Phone no. not registered.';\n }\n break;\n // User Token blank in request\n case!empty($request_data) && empty($request_data->user_token):\n $success = false;\n $status = BAD_REQUEST;\n $message = 'User Token cannot be blank.';\n break;\n // Phone no. blank in request\n case!empty($request_data) && empty($request_data->phone_no):\n $success = false;\n $status = BAD_REQUEST;\n $message = 'Phone no. cannot be blank.';\n break;\n // Reason type blank in request\n case!empty($request_data) && empty($request_data->reason_type):\n $success = false;\n $status = BAD_REQUEST;\n $message = 'Reason type cannot be blank.';\n break;\n // Password blank in request\n case!empty($request_data) && empty($request_data->password):\n $success = false;\n $status = BAD_REQUEST;\n $message = 'Password cannot be blank.';\n break;\n // Parameters not found in request\n case empty($request_data):\n $success = false;\n $status = BAD_REQUEST;\n $message = 'Request cannot be empty.';\n break;\n }\n\n $out = array(\n \"success\" => $success,\n \"message\" => $message\n );\n\n return new CakeResponse(array('status' => $status, 'body' => json_encode($out), 'type' => 'json'));\n }", "public function deactivate($id)\n {\n $user = User::find($id);\n $user->user_status=\"Inactive\";\n $user->save();\n return redirect()->route('userdisp');\n }", "public function suspend_user(User $user){\n //If the user is active suspend them if not reinstate them\n if ($user->active == 1) {\n $user->active = 0;\n $user->save();\n session()->flash('status', $user->username . ' was successfully suspended');\n return redirect()->back();\n }\n $user->active = 1;\n $user->save();\n session()->flash('status', $user->username . ' was successfully reinstated');\n return redirect()->back();\n }", "public function unlockAction()\r\n {\r\n $timesheet = $this->byId();\r\n $this->projectService->unlockTimesheet($timesheet);\r\n $this->redirect('timesheet', 'edit', array('clientid'=>$timesheet->clientid, 'projectid'=>$timesheet->projectid, 'id'=>$timesheet->id));\r\n }", "function _deactivate_user() {\n\t\t$sql=\"SELECT GROUP_CONCAT(id_user) as id FROM \".TABLE_PREFIX.\"user WHERE DATEDIFF(current_date(),last_login) = \".$this->_input['day'].\" AND id_admin <> 1 \";\n\t\t$ids= getsingleindexrow($sql);\n\t\tif($this->_input['day'] && $this->_input[\"flag\"] == 1){\n\t\t if($ids['id']!=\"\"){\n\t\t\t $arr['user_status']=0;\n\t\t\t $this->obj_user->update_this(\"user\",$arr,\"id_user IN (\".$ids['id'].\")\");\n\t\t\t $this->obj_user->update_this(\"meme\",$arr,\"id_user IN (\".$ids['id'].\")\");\n\t\t\t $this->obj_user->update_this(\"reply\",$arr,\"id_user IN (\".$ids['id'].\")\");\n\t\t\t $this->obj_user->update_this(\"caption\",$arr,\"id_user IN (\".$ids['id'].\")\");\n\t\t\t print \"Succesfully Done\";\n\t\t }else{\n\t\t\t print \"No user found\";\n\t\t\t exit;\n\t\t }\n\t\t }else{\n\t\t if($ids['id']!=\"\"){\n\t\t\t $arr=explode(\",\", $ids['id']);\n\t\t\t for($x=0;$x<count($arr);$x++){\n\t\t\t $del=$this->unlink_files($arr[$x]);\n\t\t\t }\n\t\t\t $this->obj_user->deleteuser($ids['id']);\n\t\t }\n\t\t}\n\t}", "public function adminUnsuspendUser($id)\n\t{\n\t\t$sql = \"SELECT id,active FROM users WHERE id = '\".$id.\"'\";\n\t\t$res = $this->processSql($sql);\n\t\tif ($res){\n\t\t\t$update = \"UPDATE users SET active = 1 WHERE id = '\".$id.\"'\";\n\t\t\t$result = $this->processSql($update);\n\t\t\tif ($result)\n\t\t\treturn 99;\n\t\t\treturn 1;\n\t\t} else return 2;\n\t}", "function deactivate_acct($selector, $connection){\n $query = \"UPDATE basicusers SET Status = 'Inactive' WHERE email = '$selector'\";\n $result = $connection->query($query);\n if(!$result){\n die($connection->error);\n return false;\n }\n else{\n return true;\n }\n}", "public function toggleUserLock($userid) {\n\t\t$adminModel = $this->loadModel('admin');\n\t\t$user = $adminModel->getUser($userid);\n\t\tif ($user->user_status == 1) {\n\t\t\t$adminModel->setUserStatus($userid, 2);\n\t\t} elseif ($user->user_status == 2) {\n\t\t\t$adminModel->setUserStatus($userid, 1);\n\t\t}\n\t\theader('Location: '.URL.'admin/users');\n\t}", "function deactivateUser($userid)\n {\n $data= array(\n 'status' => 0\n );\n $this->db->where('id', $userid);\n $this->db->update('user', $data);\n }", "public function closeUser()\n {\n $this->isUser = false;\n }", "function RecoveryToReactivateUser(&$UserProfile,&$nUser) {\n\t\t$SQLStrQuery=\"SELECT * FROM Password AS PASS JOIN Usuario AS U ON PASS.UID=U.UID WHERE (PASS.ACTIVO='0' AND PASS.REGISTRADO='1')\";\n\t\tSQLQuery($ResponsePointer,$nUser,$SQLStrQuery,true); // Realiza la consulta en la base de datos globales\n\t\tConvertPointerToArray($ResponsePointer,$UserProfile,$nUser,20); // Convertir la consulta en un arreglo de datos\n\t}", "function userLogOut() {\n try {\n delete_key();\n return 1;\n } catch (Exception $ex) {\n return 0;\n }\n }", "private function unlock() {\n\t\tif (file_exists($this -> lockfile)) {\n\t\t\tunlink($this -> lockfile);\n\t\t}\n\t}", "public function releaseLock($user_id) {\n\t\t\tglobal $db;\n\t\t\t$query = \"UPDATE users SET lock_guid='' WHERE id=$user_id\";\n\t\t\t//print \"$query<br>\\n\"; \n\t\t\tif ($db->query($query)) {\n\t\t\t\t$_SESSION['treeline_user_lock_guid']='';\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}", "function urt_deactivate() {\n remove_role( 'urt_secretary' );\n}", "public function deactivateAccountAction( $header_data ){\n try{\n $user = Users::findById( $header_data[\"id\"] );\n $user->is_active = 0;\n if( $user->save() ){\n Library::output(true, '0', USER_DEACTIVATED, null);\n }else{\n foreach ($user->getMessages() as $message) {\n $errors[] = $message->getMessage();\n }\n Library::logging('error',\"API : deactivateAccount : \".$errors.\" user_id : \".$header_data['id']);\n Library::output(false, '0', $errors, null);\n }\n } catch (Exception $e) {\n Library::logging('error',\"API : deactivateAccount, error message : \".$e->getMessage(). \": user_id : \".$header_data['id']);\n Library::output(false, '0', ERROR_REQUEST, null);\n }\n }", "public function invalidateCurrentLogin();", "function activateUser() {\n if (isset($_GET['account'])) {\n $account = htmlspecialchars($_GET['account'], ENT_QUOTES);\n \n connectDatabase();\n \n $result = queryDatabase(\"SELECT email\n FROM user\n WHERE active = 0\");\n\n if (mysql_num_rows($result) > 0){\n while ($row = mysql_fetch_object($result)) {\n if ($account == crypt($row->email, SALT)) {\n queryDatabase(\"UPDATE user SET active = 1\n WHERE email = '$row->email'\");\n \n echo '<div class=\"good\">Activation successful - Login using EMAIL/USER ID and PASSWORD</div>';\n \n break;\n }\n }\n }\n }\n}", "function disableAccount($accountId)\n\t\t{\n\t\t\tmysql_query(\"UPDATE argus_accounts SET status = 'DISABLED' WHERE account_id = '\".$accountId.\"' AND status = 'ENABLED'\") or die(mysql_error());\n\t\t\t\n\t\t\treturn;\n\t\t}", "public function unblockAccount() {\n\t\tif(check($this->_userid)) {\n\t\t\t$result = $this->db->query(\"UPDATE \"._TBL_MI_.\" SET \"._CLMN_BLOCCODE_.\" = ? WHERE \"._CLMN_MEMBID_.\" = ?\", array(0, $this->_userid));\n\t\t\tif(!$result) return;\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tif(check($this->_username)) {\n\t\t\t$result = $this->db->query(\"UPDATE \"._TBL_MI_.\" SET \"._CLMN_BLOCCODE_.\" = ? WHERE \"._CLMN_USERNM_.\" = ?\", array(0, $this->_username));\n\t\t\tif(!$result) return;\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tif(check($this->_email)) {\n\t\t\t$result = $this->db->query(\"UPDATE \"._TBL_MI_.\" SET \"._CLMN_BLOCCODE_.\" = ? WHERE \"._CLMN_EMAIL_.\" = ?\", array(0, $this->_email));\n\t\t\tif(!$result) return;\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\treturn;\n\t}", "function wp_revoke_user($id)\n {\n }", "public function deactivate(): void;", "public function reactivateUser($userId)\n {\n return $this->start()->uri(\"/api/user\")\n ->urlSegment($userId)\n ->urlParameter(\"reactivate\", true)\n ->put()\n ->go();\n }", "public function deactivate($id)\n {\n /* find user */\n $user = User::find($id);\n\n /* revoke user from oauth */\n $client = Client::where('user_id', $user->id);\n $client_update = array('revoked' => true);\n $client->update($client_update);\n\n Mail::to($user->email)\n ->send(new UserDeactivated($user));\n\n /* trash user */\n $user->delete();\n\n return response()->json(['success' => 'OK']);\n\n }", "public function register_deactivation();", "function unblock(Request $request)\n {\n DB::table('users')\n ->where('id', $request->id)\n ->update([\n 'active' => '1',\n ]);\n\n //insert into auditrail\n AuditTrail::create(['user_id' => Auth::user()->id,\n 'username' => Auth::user()->username,\n 'form_name' => 'Account',\n 'activity' => 'Unlocked ' . 'Account ' . $request->username, \n ]);\n\n return redirect()->back();\n }", "function disable_user($email) {\n // Build the query\n $query = \"UPDATE UserAccount SET enabled=0 WHERE email = ?\";\n // Execute the query\n $result = $this->db->query($query, $email);\n // Check if the row was affected\n if ($this->db->affected_rows() == 1) {\n $message = \"Success: account disabled.\";\n } else {\n $message = \"Error: failed to disable account.\";\n }\n // Return the result message\n return $message;\n }", "public function deactivate();", "static function momentDisconect()\r\n {\r\n $user = self::getCurrentUser();\r\n\r\n if ($user !== NULL)\r\n {\r\n $user->setOffline(1);\r\n self::updateUser($user);\r\n }\r\n }", "function unlockUser($uName) {\n\n Util::throwExceptionIfNullOrBlank($uName, \"User Name\");\n $objUtil = new Util($this->apiKey, $this->secretKey);\n\n try {\n\t\t $params = null;\n $headerParams = array();\n $queryParams = array();\n $signParams = $this->populateSignParams();\n $metaHeaders = $this->populateMetaHeaderParams();\n $headerParams = array_merge($signParams, $metaHeaders);\n $body = null;\n $body = '{\"app42\":{\"user\":{\"userName\":\"' . $uName . '\"}}}';\n\n $signParams['body'] = $body;\n $signature = urlencode($objUtil->sign($signParams)); //die();\n $headerParams['signature'] = $signature;\n $contentType = $this->content_type;\n $accept = $this->accept;\n $baseURL = $this->url;\n $baseURL = $baseURL . \"/unlock\";\n $response = RestClient::put($baseURL, $params, null, null, $contentType, $accept, $body, $headerParams);\n $userResponseObj = new UserResponseBuilder();\n $userObj = $userResponseObj->buildResponse($response->getResponse());\n } catch (App42Exception $e) {\n throw $e;\n } catch (Exception $e) {\n throw new App42Exception($e);\n }\n return $userObj;\n }", "public function Logoff();", "function suspendUser($username, $email, $recovery){\n\t$con = new mysqli('localhost','heng','@powell135','200ok');\n\tif ($con -> connect_errno){\n \treturn CONNECTION_FAIL;\n\t}\n\t\n\t$query = \"UPDATE jnjn_user SET suspended='1', recovery='$recovery' WHERE username='$username' and email='$email'\";\n\t$con -> query($query);\n\tif($con -> affected_rows == 1)\n\t\treturn SUCCESS;\n\telse\n\t\treturn FAIL;\n}", "function RecoveryInactiveUser(&$UserProfile,&$nUser) {\n\t\t$SQLStrQuery=\"SELECT * FROM Password AS PASS JOIN Usuario AS U ON PASS.UID=U.UID WHERE (PASS.REGISTRADO='0')\";\n\t\tSQLQuery($ResponsePointer,$nUser,$SQLStrQuery,true); // Realiza la consulta en la base de datos globales\n\t\tConvertPointerToArray($ResponsePointer,$UserProfile,$nUser,20); // Convertir la consulta en un arreglo de datos\n\t}", "public function reActivate()\n {\n $response = $this->response();\n $config = [\n ['field' => 'userid', 'label' => '', 'rules' => 'trim|required|integer'],\n ['field' => 'activationemail', 'label' => '', 'rules' => 'trim|required|min_length[4]|max_length[100]|valid_email']\n ];\n $this->form_validation->set_rules($config);\n if ($this->form_validation->run() === false) {\n $response[\"errors\"] = $this->form_validation->error_array();\n $this->output->set_output(json_encode($response));\n return false;\n }\n $userID = $this->input->post('userid');\n $email = $this->input->post('activationemail');\n if ($this->oauth_web->reActivate($userID, $email) === true) {\n $response[\"status\"] = true;\n $response[\"msg\"] = $this->lang->line(\"reActivate_ok\");\n }\n $this->output->set_output(json_encode($response));\n }", "public function unlockTeam()\n\t\t{\n\t\t\t$lockedteam = array();\n\t\t\t$lockedteam['id'] = $this->team->id;\n\t\t\t$lockedteam['teamvalue'] = ($this->players[0]->playervalue)+($this->team->RR)*($this->team->RRcost)+($this->team->FF)*10000+($this->team->A_Coach)*10000+($this->team->CheerLeader)*10000+($this->team->Apoth)*50000;\n\t\t\t$lockedteam['locked'] = 0;\n\t\t\t$table = $this->getTable('Teams','BloodBowlTable');\n\t\t\treturn $table->updTeam($lockedteam);\n\t\t\t//return true;\n\t\t}", "function unlock() {\r\n\t\t$query=new query($this, \"unlock tables\");\r\n\t\t$result=$query->result;\r\n\t\treturn $result;\r\n\t}", "public function unsuspendUser($username)\n {\n $conn = new DBConnect();\n $dbObj = $conn->getDBConnect();\n $this->DAO = new SecurityDAO($dbObj);\n return $this->DAO->unsuspendUser($username);\n }", "public function unimpersonateUser()\n {\n $realId = $this->session->remove('__realId');\n if ($realId !== null) {\n $this->user->identity->remove();\n $this->session->set($this->user->idParam, $realId);\n $identity = User::findOne($realId);\n $this->user->setIdentity($identity);\n $this->restoreBackedUpToken();\n }\n }", "private function unlockByIdUser($data)\n {\n $sql = \"DELETE FROM {$this->config->dbTablePrefix}keyword_lock\n WHERE `by_id_user`={$data['id_user']}\";\n\n $this->model->dba->query($sql); \n }", "public function lockOrUnlockUser($id, $locked = true);", "public function reactivate(UserModel $user)\n {\n // call data access service to reactivate user\n $conn = DatabaseAccess::connect();\n $service = new SuspendUserDataAccessService($conn);\n\n // return true if reactivation successful\n return $service->reactivate($user);\n }", "public function unlock(string $name): void;", "public function disable_user() \n {\n $conn = $this->conn;\n $login = $this->login;\n \n $params = array($login);\n $query = \"UPDATE users SET enabled = -1 WHERE login = ?\";\n \n $rs = $conn->Execute($query, $params);\n \n if (!$rs) \n { \n return FALSE;\n }\n \n $infolog = array($login);\n Log_action::log(93, $infolog);\n \n return TRUE;\n }", "public static function es_deactivation() {\n\t}", "function lockAccount($userid){\n $query = \"UPDATE users_account SET status ='Locked' WHERE userid = ?\";\n $paramType = \"i\";\n $paramValue = array(\n $userid\n );\n $this->db_handle->update($query, $paramType, $paramValue);\n }", "public function deactivate_user($u,$i)\n \t{\n\t//Retrieve userinfo from userid supplied\n\t$userinfo = verify_id('user', $u, 1, 1);\t\n\t//If they are awaiting activation\n\tif ($userinfo['usergroupid'] == NOACTIVATION_USERGROUP)\n\t{\n\t\t// check valid activation id\n\t\t$user = $this->db->query_first(\"\n\t\t\tSELECT activationid, usergroupid, emailchange\n\t\t\tFROM \".TABLE_PREFIX.\"useractivation\n\t\t\tWHERE activationid = '\" . $this->db->escape_string($i) . \"'\n\t\t\t\tAND userid = $userinfo[userid]\n\t\t\t\tAND type = 0\n\t\t\");\n\t\tif (!$user OR $i != $user['activationid'])\n\t\t{\n\t\t// give link to resend activation email\n\t\treturn \"Invalid activation ID or user ID. Click <a href='register.php?do=requestemail&u=$u'>here</a> to request a new activation email.\";\n\t\t}\n\t\t// delete activationid\n\t\t$this->db->query_write(\"DELETE FROM \".TABLE_PREFIX.\"useractivation WHERE userid=$userinfo[userid] AND type=0\");\n\t\t//If we dont have a usergroup for the user, assign to whatever has been set in config as registered usergroup\n\t\tif (empty($user['usergroupid']))\n\t\t{\n\t\t\t$user['usergroupid'] = REGISTERED_USERGROUP; // sanity check\n\t\t}\n\t\t//Get the username for user\n\t\t$getusername = $this->db->query_first(\"\n\t\t\tSELECT username\n\t\t\tFROM \".TABLE_PREFIX.\"user\n\t\t\tWHERE userid = '\" . $this->db->escape_string($u) . \"'\");\n\t\t//Remove totally!\n\t\t$this->delete_user($getusername['username']);\n\t\t//Reset userid so we dont confuse the script\n\t\t$this->vbulletin->userinfo['userid'] = 0;\t\n\t\t//Return false which means success!\n\t\treturn false;\n\t\t\n\t}\n\telse\n\t\treturn \"This account has already been activated. Click <a href='login.php'>here</a> to login.\";\n\t\t\n\t}", "public function unlogin() {\n\t\t\tif ($user = $this->authorisator->getUser()) {\n\t\t\t\t/* @var $user ILoginUserDigest */\n\t\t\t\t$user->dao()->merge($user->setLoginKey(null));\n\t\t\t\t$this->authorisator->dropUser();\n\t\t\t}\n\t\t\t\n\t\t\tif ($this->session->isStarted()) {\n\t\t\t\t$this->session->assign($this->getLoginKeyParamName(), null);\n\t\t\t}\n\t\t}", "public function unlinkAccount()\n {\n }", "protected function unlock_session() {\n \\core\\session\\manager::write_close();\n ignore_user_abort(true);\n }", "public function activate_user() {\n global $database;\n $sql = \"UPDATE user SET is_active = 1 WHERE id = \";\n $sql .= $database->escape_value($this->id);\n $database->query($sql);\n }", "public static function deactivate(){\n }", "public static function deactivate(){\n }", "abstract public function deactivate();", "public function unconfirmed_account() {\n \n // Check if the current user is admin and if session exists\n $this->check_session();\n \n if ( $this->user_status == 1 ) {\n \n redirect('/user/app/dashboard');\n \n }\n \n // Show unconfirmed account page\n $this->load->view('user/unconfirmed-account');\n \n }", "private function deactivateUser($conn){\n\t\t\t$postdata = file_get_contents(\"php://input\");\n\t\t\t$request = json_decode($postdata);\n\t\t\t$user_id = $request->user_id; \n\t\t\tif($user_id > 0){\n\t\t\t\t$query = 'Update users set user_status = 1 WHERE user_id = '.$user_id;\t\t\t\n\t\t\t\t$sql = $conn->query($query); \n\t\t\t\t$query2 = 'SELECT playlist_id FROM playlist where user_id = '.$user_id;\n\t\t\t\t$sql2 = $conn->query($query2);\n\t\t\t\tif($sql2->num_rows > 0){\n\t\t\t\t\t$result = $sql2->fetch_assoc();\n\t\t\t\t\t$query3 = 'Update playlist set playlist_status = 1 WHERE playlist_id = '.$result['playlist_id'];\t\t\t\n\t\t\t\t\t$sql3 = $conn->query($query3);\n\t\t\t\t\t$query4 = 'Update rel_playlist_tracks set rel_playlist_tracks_status = 1 WHERE playlist_id = '.$result['playlist_id'];\n\t\t\t\t\t$sql4 = $conn->query($query4); \n\t\t\t\t\t$this->response('',200);\t\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t$this->response('',204);\n\t\t\t\t\n\t\t\t}else\n\t\t\t\t$this->response('',204); \n\t\t}", "public function logoff();", "public function unsuspendAccount($username)\n {\n $params = [\n 'user' => $username,\n 'action' => 'unsp'\n ];\n return $this->apiRequest('account', $params);\n }", "function db_killAuthUser($userid)\n{\n $userid = db_esc($userid);\n db_run(\"DELETE FROM \".TBL_AUTH.\" WHERE userid='$userid'\");\n}", "public function unlockCommand() {\n\t\tif (@is_file((PATH_typo3conf . 'LOCK_BACKEND'))) {\n\t\t\tunlink(PATH_typo3conf . 'LOCK_BACKEND');\n\t\t\tif (@is_file((PATH_typo3conf . 'LOCK_BACKEND'))) {\n\t\t\t\t$message = 'ERROR: Could not remove lock file \\'typo3conf/LOCK_BACKEND\\'!';\n\t\t\t\t$this->outputLine($message);\n\t\t\t\t$this->logger->error($message);\n\t\t\t\t$this->quit(1);\n\t\t\t} else {\n\t\t\t\t$message = 'Removed lock file \\'typo3conf/LOCK_BACKEND\\'';\n\t\t\t\t$this->outputLine($message);\n\t\t\t\t$this->logger->info($message);\n\t\t\t}\n\t\t} else {\n\t\t\t$message = 'No lock file \\'typo3conf/LOCK_BACKEND\\' was found, hence no lock could be removed.';\n\t\t\t$this->outputLine($message);\n\t\t\t$this->logger->info($message);\n\t\t\t$this->quit(1);\n\t\t}\n\t}", "public static function deactivate() {\n\n }", "public function disableTwoFactorAuth()\n {\n if (! Authy::isEnabled($this->theUser)) {\n return redirect()->route('profile')\n ->withErrors(trans('app.2fa_not_enabled_for_this_user'));\n }\n\n Authy::delete($this->theUser);\n\n $this->theUser->save();\n\n event(new TwoFactorDisabled);\n\n return redirect()->route('profile')\n ->withSuccess(trans('app.2fa_disabled'));\n }", "public function logoff() {}", "function terminateUser($uid, $rid, $ban = false){\nglobal $time, $AragornCache;\n\tif ($ban && isset($AragornCache)) {\n\t\t$AragornCache->delVal(\"chat-room-\".$rid.\":users-\".$uid);\n\t}\n\telseif (isset($AragornCache)) {\n\t\t$cachedVal = $AragornCache->getVal(\"chat-room-\".$rid.\":users-\".$uid);\n\t\tif ($cachedVal !== false && $cachedVal['odesel'] != 1) {\n\t\t\t$cachedVal['odesel'] = 1;\n\t\t\t$cachedVal['timestamp'] = $time;\n\t\t\t$AragornCache->replaceVal(\"chat-room-\".$rid.\":users-\".$uid, $cachedVal, 120);\n\t\t}\n\t}\n\tmysql_query (\"UPDATE 3_chat_users SET odesel = '1', timestamp = '$time' WHERE uid = $uid AND rid = $rid AND odesel='0'\");\n\treturn mysql_affected_rows();\n}", "public function logoff() {}", "public function logoff() {}", "public static function deactivate() {\n\t}", "public function adminSuspendUser($id)\n\t{\n\t\t$sql = \"SELECT id,active FROM users WHERE id = '\".$id.\"'\";\n\t\t$res = $this->processSql($sql);\n\t\tif ($res){\n\t\t\t$update = \"UPDATE users SET active = 2 WHERE id = '\".$id.\"'\";\n\t\t\t$result = $this->processSql($update);\n\t\t\tif ($result)\n\t\t\treturn 99;\n\t\t\treturn 1;\n\t\t} else return 2;\n\t}", "function deactivate() {\n \n $this->reset_caches();\n $this->ext->update_option( 'livefyre_deactivated', 'Deactivated: ' . time() );\n\n }", "public function wpmu_activate_user() {\n\t\tglobal $wpdb;\n\n\t\t// Clean up all activated signups\n\t\t$wpdb->delete( $wpdb->signups, [ 'active' => 1 ] );\n\t}", "function closeUser($mid, $mlogin)\r\n\t\t{\r\n\t\t\tglobal $PDO;\r\n\t\t\t$param = array(\r\n\t\t\t\t'champs'=>'id',\r\n\t\t\t\t'conditions'=> 'id='.$mid.' AND login=\"'.$mlogin.'\"'\r\n\t\t\t\t);\r\n\r\n\t\t\ttry{\r\n\t\t\t\tif($this->trouver($param)){\r\n\t\t\t\t\t$req = $PDO->prepare(\"UPDATE users SET activated = 0 WHERE login='\".$mlogin.\"'\");\r\n\t\t\t\t\t$_SESSION['Auth']=null;\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t\telse{ return false; }\r\n\t\t\t}\r\n\t\t\tcatch (PDOException $e){\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}", "public function desactivar($id){\n $user = User::find($id);\n $user->activo = 0;\n $user->update();\n $usuario = \\Auth::user()->name;\n DB::select('call logs(\"'.$usuario.'\", \"Desactivó usuario\", \"Administrador\")');\n return redirect()->route('listar')\n ->with(['message'=>'Se le acabo la tonteria juajuajua']);\n }", "public function switchUserBack();", "public function closeUser ()\n\t{\n\t\t$this->_username = null;\n\t}", "function cfdb7_on_deactivate() {\n global $wp_roles;\n foreach( array_keys( $wp_roles->roles ) as $role ) {\n $wp_roles->remove_cap( $role, 'cfdb7workflow_access' );\n }\n}", "public function toggle_enabled_user($conn, $user) \n { \n Ossim_db::check_connection($conn);\n \n $params = array($user);\n $query = \"SELECT enabled FROM users WHERE login = ?\";\n \n $rs = $conn->Execute($query, $params);\n \n if (!$rs) \n { \n return FALSE;\n } \n \n $enabled = ($rs->fields['enabled'] <= 0) ? 1 : 0;\n \n if($enabled == 1) \n {\n $clogin = $conn->GetOne(\"SELECT login FROM users WHERE login = '\".$user.\"' AND expires > '\".gmdate('Y-m-d H:i:s').\"'\");\n \n if ($clogin == '') \n {\n if ($conn->Execute(\"UPDATE users SET expires = '2200-01-01 00:00:00' WHERE login = '\".$user.\"'\") === FALSE) \n { \n return FALSE;\n }\n }\n }\n\n $query = \"UPDATE users SET enabled = $enabled WHERE login = ?\";\n $rs = $conn->Execute($query, $params);\n \n if (!$rs) \n { \n return FALSE;\n }\n \n return TRUE; \n }", "public function interruptLogin();", "public function LockUser($email)\n\t {\n $sql = \"Update user \"\n\t\t\t\t. \" SET islocked = '0'\"\n\t\t\t\t. \" WHERE email = '\"\n\t\t\t\t. $email . \"'\";\n \n return parent::execute($sql);\n\n }", "public function resetPassword();", "public function deactivate() {\n\n }" ]
[ "0.7728947", "0.6833659", "0.6818787", "0.67574424", "0.6682874", "0.6681313", "0.6660578", "0.66593945", "0.66593945", "0.66593945", "0.66593945", "0.66593945", "0.663565", "0.65629786", "0.6530485", "0.64594066", "0.64483666", "0.6439482", "0.64256066", "0.633211", "0.63257265", "0.6308293", "0.62939745", "0.62913656", "0.626525", "0.62294143", "0.6211633", "0.620426", "0.6198763", "0.6186268", "0.61537844", "0.6152457", "0.61424243", "0.6132493", "0.61270016", "0.6067168", "0.60509944", "0.60298103", "0.6021796", "0.6020377", "0.60171115", "0.6015078", "0.60012156", "0.6000155", "0.5995163", "0.5994642", "0.5991986", "0.5971462", "0.59713954", "0.5966243", "0.5965323", "0.5949207", "0.59469295", "0.59426147", "0.59335583", "0.5930815", "0.59266496", "0.5912688", "0.5911", "0.59075904", "0.5906822", "0.5906233", "0.5898167", "0.58953595", "0.5884643", "0.5883108", "0.5878311", "0.587759", "0.587679", "0.5863272", "0.5862894", "0.5844244", "0.5844244", "0.58332044", "0.5829446", "0.58158994", "0.58158064", "0.58028656", "0.57926226", "0.57839346", "0.5780777", "0.57715225", "0.5765358", "0.5764927", "0.57640344", "0.576378", "0.5762142", "0.57605046", "0.5757901", "0.57572824", "0.57529783", "0.57490647", "0.57482326", "0.57468575", "0.5746262", "0.5741584", "0.5733742", "0.5725836", "0.5723133", "0.57190573" ]
0.73606616
1
get user by id
function getUserById($user_id) { $query = "SELECT * FROM users_account WHERE userid = ?"; $paramType = "i"; $paramValue = array( $user_id ); $result = $this->db_handle->runQuery($query, $paramType, $paramValue); return $result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getUser($id);", "private function getUserById($id) {\n\t\t$em = $this->getDoctrine()->getManager()->getRepository('AppBundle\\Entity\\User');\n\n\t\t$user = $em->findOneById($id);\t\n\t\t\n\t\treturn $user;\n\t}", "public static function getUserById($id)\n\t{\n\t\t$user = self::where('ID',$id)->first();\n\t\treturn $user;\n\t}", "public static function get_user($user_id);", "public function getOne($id)\n {\n return $this->user->find($id);\n }", "public function getUser($id = null);", "public function getUserById($id) {\n\t\t\n\t}", "public function get($id) {\n $sql =<<<SQL\nSELECT * from $this->tableName\nwhere idUser=?\nSQL;\n\n $pdo = $this->pdo();\n $statement = $pdo->prepare($sql);\n\n $statement->execute(array($id));\n if($statement->rowCount() === 0) {\n return null;\n }\n\n return new User($statement->fetch(PDO::FETCH_ASSOC));\n }", "public function getUserById($id){\n $query = $this->db->get_where('user', array('k_id_user' => $id));\n return $query->row();\n }", "public function getById($id) {\n\n $sql = \"SELECT * FROM user WHERE id = {$id}\";\n\n return $this->query($sql);\n }", "public function get_user($id) {\n $this->db->where('id', $id);\n $query = $this->db->get('users');\n \n return $query->row();\n }", "public function getUser($id)\r\n {\r\n $userRepository = $this->entityManager->getRepository(User::class);\r\n $user = $userRepository->find($id);\r\n\r\n return $user;\r\n }", "public function userbyid($id)\n {\n $sql=\"SELECT * FROM users where id='$id'\";\n\t $result = $this->db->query($sql);\n\t return $result->row();\n \n }", "public function getUser($id) {\n return $this->getEntityManager()\n ->getRepository('Alt68\\Entities\\User')\n ->findOneBy(array(\n 'id' => $id));\n }", "public function findById($id){\n $user = $this->DB->query(\"SELECT u.* FROM user u WHERE u.id = $id\")->fetch(PDO::FETCH_ASSOC);\n return $user;\n }", "public function getUser($id)\n {\n return $this->userRepository->getUser($id);\n }", "public function getUserById($id)\n {\n\t $result = $this->getUserDbTable()->select()\n \t\t\t\t\t\t\t\t\t ->where('user_id = ?', (int)$id, 'INT')\n \t\t\t\t\t\t\t\t\t ->query()->fetch();\n \tif($result) return $result;\n }", "public function get($id = null)\n {\n return $id === null ? $this['user'] : $this->getUserRepository()->find($id);\n }", "function findUser($id) {\n\n $conn = \\Database\\Connection::connect();\n\n try {\n $sql = \"SELECT * FROM user WHERE _user_Id = ?;\";\n $q = $conn->prepare($sql);\n $q->execute(array($id));\n $user = $q->fetchObject('\\App\\User');\n }\n catch(\\PDOException $e)\n {\n echo $sql . \"<br>\" . $e->getMessage();\n }\n\n \\Database\\Connection::disconnect();\n\n return $user;\n }", "public static function findUser($id)\r\n {\r\n $app = \\Slim\\Slim::getInstance();\r\n $user = User::find($id);\r\n if(!$user){\r\n $app->halt('404',json_encode(\"Use not found.\"));\r\n }\r\n return $user;\r\n }", "public function getUser($id)\n {\n return $this->dbService->getById($id, $this->userClass);\n }", "public function getById(string $id): User;", "public function getById($id)\n {\n $this->logger->info(__CLASS__.\":\".__FUNCTION__);\n return $this->em->getRepository('AppBundle:User')->find($id);\n }", "public function getUser( $id)\n\t{\n\t\n\t\t$user=$this->collection->findOne(array('_id'=> new MongoId($id)));\n\n\t\treturn $user;\n\t}", "public function user($id)\n {\n return $this->where('user_id', $id);\n }", "public function actionGet($id) {\n\t\treturn $this->txget ( $id, \"app\\models\\User\" );\n\t}", "public function getById($id) {\r\n $query = $this->db->limit(1)\r\n ->get_where(USERS, array('id' => $id));\r\n return $query->row();\r\n }", "public function user_get_by_id($id)\n {\n $query = \"SELECT *\n \t FROM \" . $this->db_table_prefix . \"users\n \t WHERE id = $id\";\n \n $result = $this->commonDatabaseAction($query);\n \n// if (mysql_num_rows($result) > 0)\n if ($this->rowCount > 0)\n {\n// return mysql_fetch_assoc($result);\n return $this->sqlAssoc;\n }\n else\n {\n return null;\n }\n }", "public function get_user($id) {\r\n $conn = $this->conn();\r\n $sql = \"SELECT * FROM register WHERE id = ?\";\r\n $stmt = $conn->prepare($sql);\r\n $stmt->execute([$id]);\r\n $user = $stmt->fetch();\r\n $result = $stmt->rowCount();\r\n\r\n if($result > 0 ){\r\n \r\n return $user;\r\n }\r\n\r\n \r\n }", "public function get($id) {\n $sql =<<<SQL\nSELECT * from clue_user\nwhere id=?\nSQL;\n\n $pdo = $this->pdo();\n $statement = $pdo->prepare($sql);\n\n $statement->execute(array($id));\n if($statement->rowCount() === 0) {\n return null;\n }\n\n return new User($statement->fetch(\\PDO::FETCH_ASSOC));\n }", "public function getUser($id) {\n\n $database = new Database();\n\n $query = 'SELECT * FROM user WHERE id=:id';\n\n return $database->prepareQuery($query, 'id', $id, TRUE);\n }", "public function getUserById($id)\n {\n return $this->repository->getUserById($id);\n }", "public function getUser($id){\n $user = Api::get($this->getSlug());\n \n if($user){\n return $user;\n }\n\n return 'error';\n\n }", "public function findUserById($id)\n {\n return $this->userDao->findUserById($id);\n }", "public static function getByID($id) {\r\n // Create a new user object\r\n $user = new User();\r\n // Get the data from the database for the user by ID\r\n $user->get([\"id\" => $id, \"LIMIT\" => 1]);\r\n // return the user object\r\n return $user;\r\n }", "public function getUserById($id){\n // Query for the user.\n $this->db->query('SELECT * FROM users WHERE id = :id');\n // Bind the values.\n $this->db->bind(':id', $id);\n // Return the row. \n $row = $this->db->single();\n\n return $row;\n }", "public function getById(int $id): User;", "abstract public function fetchUserById($id);", "public function getOne($id)\n\t\t{\n\t\t\treturn usersDao::instance()->getOne($id);\n\t\t}", "function user($id){\n\n $sql = \"SELECT * FROM users WHERE id=$id\";\n return fetch($sql);\n }", "public function getUser($id) {\n foreach ($this->_users as $user) {\n if ($user->id == $id) return $user;\n }\n return false;\n }", "public function show($id)\n {\n return user::find($id);\n }", "public function getUserById($id){\n $this->db->query('SELECT * FROM users WHERE us_id = :id');\n // Bind values\n $this->db->bind(':id', $id);\n $row = $this->db->single();\n return $row;\n\n }", "protected function getUser($id)\n {\n $sql = new Sql($this->dbAdapter);\n $select = $sql->select('tbluser');\n $select->where(array('id = ?'=> $id));\n \n $stmt = $sql->prepareStatementForSqlObject($select);\n $result = $stmt->execute();\n \n $user = new User();\n $user->exchangeArray($result->current());\n return $user;\n }", "public function get_user( $id ) {\n $u = $this->call( 'userGet', [\n 'userId' => $id ] );\n\n return $u ? $u->user : false;\n }", "public static function getUserById($id)\n {\n $db = init_db();\n\n $req = $db->prepare(\"SELECT * FROM user WHERE id = ?\");\n $req->execute(array($id));\n\n $db = null;\n return $req->fetch();\n }", "public function getUserWithId($id){\r\n\r\n\t\t$sql = \"Select * from users where id = ?\";\r\n\t\t$query = $this->db->prepare($sql);\r\n\t\t$query->execute([$id]);\r\n\r\n\t\t$postOwner = $query->fetch(PDO::FETCH_OBJ);\r\n\t\treturn $postOwner;\r\n\t}", "public static function getById($id)\n {\n $query = \"SELECT * FROM User WHERE id=:id\"; \n $sql = new MysqlListaPdo();\n $sql->connect();\n $wynik = $sql->query_obj($query, array('id'=> $id), 'User'); \n if(count($wynik) == 2)\n return $wynik[0];\n else\n return false;\n }", "public static function getUserObjectFromId($id){\n $pdo = static::getDB();\n\n $sql = \"select * from users where user_id = :id\";\n\n $result = $pdo->prepare($sql);\n \n $result->execute([$id]);\n\n $user_array = $result->fetch(); \n\n if($user_array){\n if($user_array['USER_ROLE'] == Trader::ROLE_TRADER){\n return static::getTraderObjectFromEmail($user_array['EMAIL']);\n }\n return new User($user_array);\n }\n return false;\n }", "function get_user_by_id($id) {\r\n\t\t$query = $this->db->query('SELECT user_fname, user_lname, user_email\r\n\t\t\t\t\t\t\t\t\tFROM user\r\n\t\t\t\t\t\t\t\t\tWHERE user_id = '.$id.'');\r\n\t\treturn $query->result();\r\n\t}", "public function getUserIdWithUsername($id);", "public function get(int $id): User\n {\n return $this->model->findOrFail($id);\n }", "static function GetWithId(int $id)\n\t{\n\t\t$arr = [\n\t\t\t':id' => $id\n\t\t];\n\n\t\t$sql = 'SELECT * FROM user_info WHERE rf_user_id = :id LIMIT 1';\n\n\t\treturn Db::Query($sql,$arr)->FetchObj();\n\t}", "public function getUserByID($id)\n {\n return $this->db->get_where('inm_user', array('id' => $id));\n }", "public static function getUserById($id)\n {\n\n if ($id) {\n\n $db = Db::getConnection();\n $sql = \"SELECT * FROM user WHERE id = :id\";\n\n $result = $db->prepare($sql);\n $result->bindParam(':id', $id, PDO::PARAM_INT);\n // Get assoc array mode\n $result->setFetchMode(PDO::FETCH_ASSOC);\n $result->execute();\n\n return $result->fetch();\n }\n }", "function get_user($id)\n {\n return $this->db->get_where('users',array('id'=>$id))->row_array();\n }", "function get_user($id)\n {\n return $this->db->get_where('users',array('id'=>$id))->row_array();\n }", "function get_user($id)\n {\n return $this->db->get_where('users',array('id'=>$id))->row_array();\n }", "public function getUser($id)\n {\n if (!$id) {\n throw new \\InvalidArgumentException($this->lang['invalid_id']);\n }\n $user = $this->userdao->findUserByID($id);\n //$responseData = $this->createGetUserLinks($user);\n return $user;\n }", "public function getById($id)\n {\n return $this->appUser->find($id);\n }", "public function getById(int $id): ?User;", "function getUser($user, $id) {\n return $user->readByID($id);\n}", "public function user_by_id($id) {\n $this->db->where('id_user', $id);\n $consulta = $this->db->get('user');\n $resultado = $consulta->row_array();\n return $resultado;\n }", "function user_get()\n {\n $id = $this->get('id');\n if ($id == '') {\n $user = $this->db->get('auth_user')->result();\n } else {\n $this->db->where('id', $id);\n $user = $this->db->get('auth_user')->result();\n }\n $this->response($user, 200);\n }", "public function get($id) {\n $user = User::find($id);\n if (!$user) {\n return Base::apiErrorResponse(\"User does not exist!\");\n } else {\n return Base::apiSuccessResponse(\"\", $user);\n } \n }", "public function getUserById($id)\n {\n return $this->getManagement()->users->get($id);\n }", "public static function user($id = 0)\n\t{\n\t\t// Get the user by id\n\t\tif ($id)\n\t\t\treturn User::model()->active->findbyPk($id);\n\t\telse\n\t\t{\n\t\t\t// Return false if user is guest\n\t\t\tif (Yii::ap()->user->isGuest)\n\t\t\t\treturn false;\n\t\t\telse\n\t\t\t\treturn User::model()->active->findbyPk(Yii::app()->user->id);\n\t\t}\n\t}", "public function getById($id) {\n $this->db->select('*');\n $this->db->from('user');\n $this->db->where('id', $id);\n\n return $this->db->get()->first_row();\n }", "public function findUserById($id)\n {\n $sql = \"SELECT rowid, * FROM USER WHERE rowid=?\";\n $row = $this->getDb()->fetchAssoc($sql, array($id));\n if ($row){\n return $this->buildDomainObject($row);\n }else{\n throw new UsernameNotFoundException('User not found.');\n }\n }", "public function show($id)\n {\n return User::where('id', $id)->first();\n }", "public function show($id)\n {\n return User::find($id);\n }", "public function show($id)\n {\n return User::find($id);\n }", "public function show($id)\n {\n return User::find($id);\n }", "public function show($id)\n {\n return User::find($id);\n }", "public function show($id)\n {\n return User::find($id);\n }", "public function show($id)\n {\n return User::find($id);\n }", "public function show($id)\n {\n return User::find($id);\n }", "public function user_get($id=0)\n\t{\n\n\t\t\t$data=$this->um->getData('users',$id);\n\t\t\tif (!empty($data)) {\n\t\t\t\t\n\t\t\t$this->response($data,RestController::HTTP_OK);\n\t\t\t}\n\t\t\telse{\n\t\t\t\t$this->response(['status'=>false,'message'=>'no data found'],RestController::HTTP_NOT_FOUND);\n\t\t\t}\n\t}", "public function getUserByID($id)\n {\n return $this->db->get_where('temp_user', array('id' => $id));\n }", "public function get($id = null) {\n\n\t\t// get database\n\t\t$db = $this->app->database;\n\n\t\t// check if user id exists\n\t\tif (!is_null($id) && !in_array($id, $this->_queried_users) && !$db->queryResult('SELECT id FROM #__users WHERE id = '.$db->escape($id))) {\n\t\t\treturn null;\n\t\t}\n\n\t\t$this->_queried_users[$id] = $id;\n\n\t\t// get user\n\t\t$user = $this->_call(array('JFactory', 'getUser'), array($id));\n\n\t\t// add super administrator var to user\n\t\t$user->superadmin = $this->isJoomlaSuperAdmin($user);\n\n\t\treturn $user;\n\t}", "public static function getUser(int $id)\n {\n $sql = \"SELECT * FROM `user` WHERE id = :id\";\n\n $db = new DB();\n $connectionDB = $db->getConnection();\n $result = $connectionDB->prepare($sql);\n $result->bindParam(\":id\", $id, PDO::PARAM_INT);\n $result->execute();\n $result->setFetchMode(PDO::FETCH_ASSOC);\n $result = $result->fetch();\n\n $user = null;\n if ($result) {\n $user = new User(\n $result['login'],\n $result['password'],\n $result['first_name'],\n $result['second_name'],\n $result['sex'],\n $result['date_of_birth']\n );\n\n $user->id = $id;\n $user->role = $result['role'];\n $user->created_at = $result['created_at'];\n $user->updated_at = $result['updated_at'];\n }\n return $user;\n }", "public function getItem( int $id ) {\n\t\treturn User::where( 'id', $id )->first();\n\t}", "public function getOneRest($id)\n {\n $user = $this\n ->createQueryBuilder('u')\n ->andWhere('u.id = :id')\n ->setParameters(array('id' => $id))\n ->getQuery()\n ->getOneOrNullResult()\n ;\n\n return $user;\n }", "public function getUserById($id)\n\t{\n\t\t$sql = 'SELECT * FROM admins WHERE id=:id';\n\t\t$query = $this->db->prepare($sql);\n\t\t$query->execute([':id' => $id]);\n\t\treturn $query->fetch(PDO::FETCH_OBJ);\n\t}", "public function show($id)\n\t{\n\t\treturn User::find($id);\n\t}", "public static function getUserById($id)\r\n {\r\n // Connect to DB\r\n $db = Db::getConnection();\r\n\r\n // Test \r\n $sql = 'SELECT * FROM user WHERE id = :id';\r\n\r\n // Receiving and returning results. A prepared query is used\r\n $result = $db->prepare($sql);\r\n $result->bindParam(':id', $id, PDO::PARAM_INT);\r\n\r\n // We indicate that we want to get data in the form of an array\r\n $result->setFetchMode(PDO::FETCH_ASSOC);\r\n $result->execute();\r\n\r\n return $result->fetch();\r\n }", "public static function get($id){\n $result = mysqli_query(Connection::getConnection(), \"Select * from users where id = '{$id}'\");\n if(mysqli_num_rows($result) == 1) {\n $user = mysqli_fetch_assoc($result);\n return new User(\n $user['id'],\n $user['name'],\n $user['email'],\n $user['type'],\n $user['patchImage']);\n }\n return false;\n }", "public function findUserById($id)\n {\n $em = $this->getEntityManager();\n return $em->createQuery(\n '\n SELECT u\n FROM ProjectAppBundle:User u\n WHERE u.id = :id\n '\n )\n ->setParameter('id', $id)\n ->getSingleResult();\n }", "public function findByID($id)\n {\n $i = $this->getInstance(); \n\n $result = $i->getSoapClient()\n ->setWsdl($i->getConfig('webservice.user.wsdl'))\n ->setLocation($i->getConfig('webservice.user.endpoint'))\n ->GetUser(array(\n 'UserId'=>array(\n 'Id'=>intval($id),\n 'Source'=>'Desire2Learn'\n )\n ));\n \n if ( $result instanceof stdClass && isset($result->User) && $result->User instanceof stdClass )\n {\n $User = new D2LWS_User_Model($result->User);\n return $User;\n }\n else\n {\n throw new D2LWS_User_Exception_NotFound('OrgDefinedId=' . $id);\n }\n }", "public function getUserById($id)\n {\n $connection = Db::getConnection();\n\n $userData = $connection->fetchAssoc(\n \"SELECT id, email, create_date\n FROM {$this->tableName}\n WHERE id = ?\", \n [$id]\n );\n\n return $this->initializeObject($userData);\n }", "function get_user( $user_id ){\n\t$app = \\Jolt\\Jolt::getInstance();\n\treturn $app->store('db')->findOne('user', array( '_id'=>$user_id ));\n}", "public function getUserById($id) {\n $response = $this->client->request('GET', 'user/' . $id);\n \n return $response;\n }", "public function getOneById($id)\n {\n $request = new Llv_Services_User_Request_User();\n $request->id = $id;\n $message = $this->_service->getOneById($this->getHeaderMessage(), $request);\n if ($message->success) {\n return $message->user;\n }\n return null;\n }", "public function getUserFromId(int $id) {\n \n // Call getUserById method in userDataService and set to variable\n $user = $this->getUserById($id);\n \n // Return the user information array\n return $user;\n }", "function get_user_by_id($user_id) {\n\t\t$this->db->where('id', $user_id);\n\n\t\t$query = $this->db->get($this->table_name);\n\t\tif ($query->num_rows() == 1) {\n\t\t\treturn $query->row();\n\t\t}\n\n\t\treturn NULL;\n\t}", "public static function findById($id) {\n try {\n $db = Database::getInstance();\n $sql = \"SELECT * FROM `User` WHERE username = :username\";\n $stmt = $db->prepare($sql);\n $stmt->execute([\"username\" => $id]);\n \n if ($stmt->rowCount() === 0)\n return null;\n \n return new User($stmt->fetch(PDO::FETCH_ASSOC));\n } catch (PDOException $e) {\n exitError(500, \"Internal error.\");\n }\n }", "public function findOne($id)\n {\n return $this->findItem('users',$id);\n }", "public function show($id)\n {\n return \\App\\User::find($id);\n }", "public function find_user_by_id($id = \"\"){\n\n if (empty($id))\n return false;\n\n $arr = [\n \"s\", [$id]\n ];\n\n $sql = \"SELECT * FROM users where id=? LIMIT 1;\";\n\n $result = $this->db->prepare_statement_query($sql, $arr);\n\n if ($result->num_rows > 0){\n\n return $result;\n\n }\n\n return false;\n }", "public function show($id)\n {\n $user =User::findOrFail($id);\n return $user;\n }", "public function getUser(int $id): User\n {\n $user = new User(1, 'Alberto', '[email protected]');\n return $user;\n }" ]
[ "0.8660723", "0.85768", "0.8517957", "0.8405645", "0.8374372", "0.8355505", "0.83284163", "0.83204186", "0.82987565", "0.82902765", "0.8268308", "0.8257888", "0.8238321", "0.8221167", "0.82054377", "0.8173569", "0.81547225", "0.8153795", "0.8148725", "0.81314933", "0.811817", "0.8091156", "0.80798507", "0.8068218", "0.80637634", "0.8059235", "0.8056818", "0.8046709", "0.8032453", "0.80311155", "0.8027134", "0.80233806", "0.8022391", "0.80134743", "0.80093634", "0.80047977", "0.8000632", "0.79858947", "0.7985713", "0.79842293", "0.7961485", "0.7954842", "0.7944126", "0.7933333", "0.791524", "0.79124564", "0.79016185", "0.7896474", "0.7894793", "0.7882141", "0.78816825", "0.78726196", "0.7863508", "0.7863465", "0.7847627", "0.7838124", "0.7838124", "0.7838124", "0.78378636", "0.7836139", "0.7831806", "0.7823105", "0.7822617", "0.7814491", "0.7809237", "0.7799463", "0.7786768", "0.7783605", "0.7778392", "0.7774756", "0.77689433", "0.77689433", "0.77689433", "0.77689433", "0.77689433", "0.77689433", "0.77689433", "0.7767079", "0.77641976", "0.776366", "0.7762719", "0.77512383", "0.775115", "0.774872", "0.7747995", "0.77442783", "0.7731538", "0.7730603", "0.77239126", "0.7704586", "0.7701639", "0.7697204", "0.7680085", "0.7675877", "0.76726896", "0.7669343", "0.76605886", "0.76573616", "0.76556027", "0.7654195", "0.7653744" ]
0.0
-1
return the image path
public function saveImage(Request $request){ preg_match_all('/^[a-zA-Z]+/',$request->path(), $result); // take the table name $path = implode('',$result[0]); // array to string if ($request->file('image') !== null){ $path = $request->file('image')->store($path); //dump($path); return $path; }else { return (implode('',$result[0]).'/default.jpg');// save the default image with table name } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getImagePath () {\n return luxbum::getImage($this->dir, $this->file);\n }", "public function getImagePath(){\r\n\t\t\treturn $this->imagePath;\r\n\t\t}", "public function path()\n {\n return $this->image->path;\n }", "public function imagePath(){\n return $this->upload_directory.DS.$this->filename;\n }", "public function getImagePath()\n {\n return $this->imagepath;\n }", "public function getImgPath()\n {\n return $this->imgPath;\n }", "protected function getImagePath()\n {\n return Yii::getAlias('@data/image.jpg');\n }", "public function get_image_path($image)\n{\n\treturn \"data/\". $image. \".jpg\";\n}", "public function getImagePath()\n {\n return $this->getImagesFolder() . '/' . $this->getRootImagePath();\n }", "public function getRootImagePath()\n {\n return \"{$this->filename}\";\n }", "protected function _getPhotoPath()\n {\n if($this->photo_dir){\n return str_replace(\"\\\\\", \"/\", str_replace(\"webroot\\img\\\\\",\"\", str_replace(\"webroot/img/\",\"\",$this->photo_dir)));\n }\n }", "public function getImagePathAttribute()\n {\n return public_path($this->imageDirectory);\n }", "function getPhotoPath()\n\t{\n\t\treturn file_exists(\"img/portrait/user$this->id.jpg\") ? \"/img/portrait/user$this->id.jpg\" : \"/img/unavailable.jpg\";\n\t}", "public function getImagePathAttribute()\n {\n $defaultFileStorage= Config::get('filesystems.default');\n $imagefolderUrl= Config::get('filesystems.disks.' . $defaultFileStorage . '.folderUrl') ;\n return $imagefolderUrl . '/' . $this->image;\n }", "public function get_pic_path()\n {\n if(!$this->img_path || !file_exists($this->img_path)) {\n return Config::$NO_PRES_PIC_PATH;\n }\n else {\n return $this->img_path;\n }\n }", "public function getGeneratedImagePath()\r\n {\r\n return $this->image_path;\r\n }", "public function getPath(Image $image);", "public function imageFile()\n {\n $file = substr($this->path(), strrpos($this->path(), '/') + 1);\n return storage_path() . '/app/public/' . $file;\n }", "public function getImageAvatarPath() {\n return self::UPLOAD_FOLDER . $this->img_avatar;\n }", "function ImageFile()\n\t{\treturn $this->imagedir . (int)$this->id . \".jpg\";\n\t}", "function tp_get_img_dir() {\n\t$file = new ElggFile();\n\t$file->setFilename('image/');\n\treturn $file->getFilenameOnFilestore();\n}", "private function getImageSourcePath()\r\n {\r\n // check if relative\r\n if(substr($this->_imagesource, 0, 2) == \"..\" || $this->_imagesource{0} == \".\")\r\n {\r\n return dirname($_SERVER['SCRIPT_FILENAME']) . '/' . $this->_imagesource;\r\n }\r\n else\r\n {\r\n return $this->_imagesource;\r\n }\r\n }", "function imagePath($img, $config) {\n return \"http://\" . $_SERVER[\"HTTP_HOST\"] . $config['global']['path'] . \"assets/rubrics/\" . $img;\n }", "public function path()\n {\n return \"/storage/{$this->picture}\";\n }", "public static function getDestination()\n {\n return public_path() . '/img/profile_photos/';\n }", "public function getMainImagePath() {\n $mainImage = $this->getMainImage();\n if ($mainImage != null) {\n return $mainImage->path;\n }\n else {\n return \"\";\n }\n }", "abstract public function get_thumbnail_source_path();", "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 }", "protected function getImageBasePath()\n\t{\n\t\treturn rtrim($this->config->get('folder', public_path('images')), '/');\n\t}", "public function getImageFile() \n {\n return isset($this->imagen) ? Yii::$app->basePath . '/web/img/producto/'. $this->imagen : null;\n }", "public function imageUrl()\n\t{\n\t\treturn \"/storage/$this->image\";\n\t}", "function getImageDir () {\n return $this->dir;\n }", "public function getPhoto() {\n return DATADIR . 'alumni/' . $this->shortName . '.jpg';\n }", "public function getImagePathAttribute()\n {\n return url('storage/'.$this->image);\n }", "static public function getImageRootPath() {\n\t\treturn Page::$base_images_path;\n\t}", "function GetImgFullPath($img = NULL, $spr = NULL, $lang_id = NULL )\n {\n if ( empty($spr) ) $spr = $this->spr;\n //if ( empty($lang_id) ) $lang_id = $this->lang_id;\n if ( empty($img) ) $img = $this->img;\n\n $ret = Spr_Img_Path.$spr;\n if(!empty($lang_id)){\n $ret .= '/'.$lang_id;\n }\n $ret .= '/'.$img;\n return $ret;\n }", "public function getCategoryImagePathAttribute()\n {\n return public_path($this->imageDirectory);\n }", "public function mainImageURL()\n {\n if ($this->image) {\n $imageLocation = $this->image->location;\n } else {\n // If the image cannot be displayed, show a generic image.\n $imageLocation = 'generic/generic1.jpg';\n }\n\n return Storage::url($imageLocation);\n }", "protected function getUploadRootDirImg() {\n // guardar los archivos cargados\n return __DIR__ . '/../../../../web/uploads/portafolios/' . $this->getId() . '/img';\n }", "public function getImage() : string\n {\n return $this->image;\n }", "public function getWebPath()\n {\n return null === $this->image\n ? null\n : $this->getUploadImageDir() . '/' . $this->image;\n }", "public function getImage() {\n if ($this->item_image == null) {\n return Yii::app()->request->baseUrl . \"/images/box/default.jpg\";\n } else {\n return Yii::app()->request->baseUrl . \"/images/box/\" . $this->item_image;\n }\n }", "public function getPhoto() : string {\n $hash = crc32($this->name);\n $filename = self::PHOTO_DIRECTORY . $hash . '.png';\n\n if (file_exists($filename))\n return '/images/photos/' . $hash . '.png';\n\n return '/images/no-photo.png';\n }", "public function getImagePathAttribute()\n {\n return Storage::disk('public')->url($this->image);\n }", "public function getImagePathAttribute()\n {\n return asset('public/uploads/supply_images/'.$this->image);\n }", "public static function getImagePath($plot);", "public function getImageCachePath()\n {\n return $this->getSettingArray()[\"image_cache_path\"];\n }", "public function get_image_url()\n {\n }", "protected function _getFullImagePath($_imagePath)\n {\n $fullPath = APPLICATION_PATH\n . DIRECTORY_SEPARATOR\n . '..'\n . DIRECTORY_SEPARATOR\n . 'public'\n . DIRECTORY_SEPARATOR;\n\n return realpath($fullPath . $_imagePath);\n }", "public function getWebPath()\n {\n return null === $this->image ? null : $this->getUploadDir().'/'.$this->image;\n }", "protected function imageName() {}", "public function getImagePathAttribute()\r\n {\r\n return asset('uploads/profile/' . $this->image);\r\n }", "function ImageSRC()\n\t{\treturn $this->imagelocation . (int)$this->id . \".jpg\";\n\t}", "function getFilePath($sImage) {\n\tglobal $oS3Object, $sOutputDir, $sOption, $iWidth, $iHeight, $sExt, $sDestFile;\n\t$sLocalPath = substr($sImage, strpos($sImage, 'file/pic/'));\n\t$aFile = pathinfo($sImage);\n\t$sExt = $aFile['extension'];\n\t$sDestPath = $sOutputDir. $sDestFile;\n\t$sResourcePath = 'tmp'. PHPFOX_DS. md5($sImage). '.'. $sExt;\n\tif (strpos($sImage, 'amazon')) {\n\t\tif (!file_exists($sResourcePath)) {\n\t\t\t$oS3Object->getObject(Phpfox::getParam('core.amazon_bucket'), $sLocalPath, $sResourcePath);\t\n\t\t}\n\t\t$sResourcePath = $sTmpImage;\n\t} elseif (is_numeric(strpos($sImage, Phpfox::getParam('core.path')))) {\n\t\t$sResourcePath = PHPFOX_DIR. $sLocalPath;\n\t} else {\n\t\tif (!file_exists($sResourcePath)) {\n\t\t\tgrabImage($sImage, $sResourcePath);\n\t\t}\n\t}\n\n\treturn array($sResourcePath, $sDestPath);\t\n}", "public function getImage() {\n return Mage::helper('landingpage/image')->getImageUrl($this->getData('image'));\n }", "public function getImagePublicBasePath()\n {\n return $this->getSettingArray()[\"image_public_base_path\"];\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 }", "function getImagePathInfo() \n { \n return $this->_imagePathInfo; \n }", "function GetImgPath($img = NULL, $spr = NULL, $lang_id = NULL )\n {\n if ( empty($spr) ) $spr = $this->spr;\n //if ( empty($lang_id) ) $lang_id = $this->lang_id;\n if ( empty($img) ) $img = $this->img;\n\n $ret = Spr_Img_Path_Small.$spr;\n if(!empty($lang_id)){\n $ret .= '/'.$lang_id;\n }\n $ret .= '/'.$img;\n return $ret;\n }", "protected function resolveImagePath($image)\n\t{\n\t\treturn $this->getOriginalPath(true).$image->getPath();\n\t}", "public function getWebPath()\n {\n// ... $webPath being the full image URL, to be used in templates\n\n return $webPath;\n }", "public function getImagesFolder()\n {\n return defined(static::class . '::IMAGES') ? static::IMAGES : 'images';\n }", "public function profilePicPath()\n {\n \treturn $this->defaultProfilePicPath;\n }", "public function getUploadDir(){\n return dirname(_FILE_). \"/img/\";\n }", "public function getPath(){\n\t \treturn $this->dirname.'/'.$this->filename.'.'.$this->extension;\n\t }", "public function getBasePathAttribute() {\n return public_path('images/uploads/'.$this->id.'/');\n }", "protected function getImageUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return $this->getUploadRootDir().\"pictures/\";\n }", "public function getUploadImageDir()\n {\n return 'uploads/images';\n }", "public function getSavePath() {\n return $this->__imageSavePath;\n }", "public function getSrcPath()\n {\n return $this->getSettingArray()[\"src_path\"];\n }", "public function getPictureFilePathWeb()\n {\n return null === $this->picturePath ? null : $this->getUploadDir() . '/' . $this->picturePath;\n }", "public function img_path($rel_path='')\n\t{\n\t\treturn $this->add_path($rel_path);\n\t}", "protected function _getProfilePicturePath()\n {\n if ($this->_properties['profile_picture_dir'] && $this->getOriginal('profile_picture')) {\n return '../files/users/profile_picture/' . $this->_properties['profile_picture_dir'] . '/square_' . $this->getOriginal('profile_picture'); \n }\n return 'default-profile_picture.png';\n }", "public static function imagePath($image)\n\t{\n\t\tstatic $image_path=null;\n\t\tif (!isset($image_path)) $image_path = self::templateImagePath ();\n\n\t\t$parts = explode('/', $image_path);\n\t\t$image_parts = explode('/', $image);\n\n\t\t// remove common parts\n\t\twhile(isset($parts[0]) && $parts[0] === $image_parts[0])\n\t\t{\n\t\t\tarray_shift($parts);\n\t\t\tarray_shift($image_parts);\n\t\t}\n\t\t// add .. for different parts, except last image part\n\t\t$url = implode('/', array_merge(array_fill(0, count($parts)-1, '..'), $image_parts));\n\n\t\t//error_log(__METHOD__.\"('$image') image_path=$image_path returning $url\");\n\t\treturn $url;\n\t}", "public function getImageFile()\n {\n return $this->imageFile;\n }", "public function getImageFile()\n {\n return $this->imageFile;\n }", "public function getImageFile()\n {\n return $this->imageFile;\n }", "public function getImageFile()\n {\n return $this->imageFile;\n }", "public function getFullPath()\n {\n return sfAssetsLibraryTools::getMediaDir(true) . $this->getRelativePath();\n }", "public function thumbnailPath() {\n return $this->baseDir() . '/tn-' . $this->fileName();\n }", "function get_static_image_path($file = NULL)\n {\n return get_static_asset($file, 'images/'); \n }", "public function getThumbnailPath()\n {\n return $this->getThumbnailsFolder() . '/' . $this->getRootThumbnailPath();\n }", "public function getPath(){\n $ext = $this->getExt();\n $filename = $this->id.'.'.$ext;\n return str_replace( $filename, '', $this->filename ); \n }", "protected function getUploadDir()\n {\n return 'images';\n }", "public function url()\n\t{\n\t\t$this->buildImage();\n\t\treturn $this->buildCachedFileNameUrl;\n\t}", "public function getImage();", "public function getImage();", "public function getImage();", "public function getImage();", "public function get_thumb_relative_path(){\n\t\treturn $this->dir . '/' . $this->get_thumb_name();\n\t}", "public function getImageAttribute()\n {\n if (isset($this->attributes['image'])) {\n return \"/uploads/{$this->attributes['image']}\";\n }\n return null;\n }", "public function path() {\n return $this->filepath();\n }", "public function getWebPath()\n {\n $webPath = 'uploads/images/' . $this->uploadPath . '/' . $this->imageName;\n\n return $webPath;\n }", "public function getImageFile()\n {\n $link = $this->link;\n return empty( $this->owner->$link ) ? null : \\Yii::getAlias(\n '@storage/' . $this->directory . '/' . $this->owner->$link\n );\n }", "public function getImage()\n {\n return $this->get('image');\n }", "private function getPath()\n {\n // Should we use \"magick\" or \"convert\" command?\n // It seems they do the same. But which is best supported? Which is mostly available (whitelisted)?\n // Should we perhaps try both?\n // For now, we just go with \"convert\"\n\n if (!empty(getenv('IMAGEMAGICK_PATH'))) {\n return getenv('IMAGEMAGICK_PATH');\n } else {\n return 'convert';\n }\n }", "private function picture_src(){\n foreach (self::PICTURE_EXTENSIONS as $extension){\n $file = UPLOADS.$this->get_name_sanitized().'.'.$extension;\n if(file_exists($file)){\n return $file;\n }\n }\n return false;\n }", "public function getImageURL() {\n\n return $this->image_url;\n }", "public function getImage() {}", "static public function getImageURL() {\n\t\treturn self::$image_url;\n\t}", "function display_image($picture) {\n return \"uploads\" . DS . $picture;\n}" ]
[ "0.84208506", "0.8233903", "0.8196182", "0.8169768", "0.81438994", "0.80555916", "0.8048422", "0.7955272", "0.7757954", "0.7711666", "0.7711479", "0.7690967", "0.76587427", "0.76066184", "0.76061934", "0.7590499", "0.7559635", "0.75256515", "0.7517796", "0.7490722", "0.7398958", "0.7363552", "0.7341133", "0.7233998", "0.7189925", "0.71657807", "0.71590936", "0.7156124", "0.7146472", "0.714436", "0.7134748", "0.7127097", "0.7099881", "0.7079345", "0.7074491", "0.70602226", "0.70601946", "0.7057444", "0.70444727", "0.70238113", "0.7009375", "0.6990633", "0.69821596", "0.69738364", "0.69530606", "0.69478536", "0.6938021", "0.6935872", "0.68939143", "0.68914104", "0.68897915", "0.68704766", "0.6868429", "0.6861823", "0.68396205", "0.6822104", "0.6810532", "0.68101627", "0.6809726", "0.680782", "0.68054724", "0.68032974", "0.6790783", "0.6787209", "0.6771363", "0.6751309", "0.67484206", "0.67459774", "0.67401254", "0.67396945", "0.67353857", "0.67296433", "0.67271817", "0.67199147", "0.67150974", "0.67150974", "0.67150974", "0.67150974", "0.6714335", "0.67101455", "0.6694509", "0.6687482", "0.66857636", "0.66819286", "0.66744256", "0.66600454", "0.66600454", "0.66600454", "0.66600454", "0.66549385", "0.665463", "0.6650788", "0.66496056", "0.66482794", "0.664306", "0.6642618", "0.66387796", "0.6638745", "0.6630593", "0.6626463", "0.6618757" ]
0.0
-1
See if a Rets Rabbit search exists.
public function exists($id = 0) { $search = craft()->retsRabbit_searches->getById($id); return !is_null($search); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isSearchFilterExists(): bool;", "private function isSearch() {\n\t\tif (!is_null($this->search))\n\t\t\treturn true;\n\t\treturn false;\n\t}", "function is_search()\n {\n }", "public static function searchQueriesExist(){\n \n if (empty($_GET['lookfor']))\n return false;\n \n if ($_GET['lookfor'] === 'qa')\n $arr = ['query', 'fromuser', 'touser', 'timeanswered'];\n else $arr = ['username', 'realname'];\n \n foreach($arr as $curr)\n if (isset($_GET[$curr]) and trim($_GET[$curr]))\n return true;\n \n return false;\n }", "public function is_search()\n {\n }", "private function IsSearchBot()\n {\n // Of course, this is not perfect, but it at least catches the major\n // search engines that index most often.\n $keywords = array(\n 'bot',\n 'spider',\n 'spyder',\n 'crawlwer',\n 'walker',\n 'search',\n 'yahoo',\n 'holmes',\n 'htdig',\n 'archive',\n 'tineye',\n 'yacy',\n 'yeti',\n );\n\n $agent = strtolower($_SERVER['HTTP_USER_AGENT']);\n\n foreach ($keywords as $keyword) {\n if (strpos($agent, $keyword) !== false)\n return true;\n }\n\n return false;\n }", "private function barcode_exists($barcode){\n $search = '{\"schemas\": [\"urn:ietf:params:scim:api:messages:2.0:SearchRequest\"], '.\n '\"filter\": \"External_ID eq \\\"'.$barcode.'\\\"\"}';\n $this->search_patron($search);\n return ($this->search[\"totalResults\"] == 0) ? FALSE : TRUE;\n }", "public static function searchable()\n {\n return ! empty(static::$search);\n }", "public function contains_searchResult($searchResult, $request)\n {\n $test = $this->contains_($searchResult,$request);\n if(!$test)\n {\n return true;\n }\n else\n {\n //echo \"else <br/>\";\n //check the result is already record\n if($this->eager)\n {\n foreach ($this->searchResultsDB as $result)\n {\n // echo \"<br/> a\";\n if(strpos(strtolower($result->links) ,strtolower($searchResult->links)) !== false)\n {\n // echo \"return 1\";\n return true;\n }\n //echo \"yes\";\n\n }\n }\n else\n {\n foreach ($this->searchResults as $result)\n {\n // echo \"<br/> a\";\n if(strpos(strtolower($result->links) ,strtolower($searchResult->links)) !== false)\n {\n // echo \"return 1\";\n return true;\n }\n //echo \"yes\";\n\n }\n }\n }\n // echo \"rien\";\n\n return false;\n }", "public function hitExists($search_id, $url) {\n\t\t$hits = $this->get_all_using_params(array('SearchID' => $search_id, 'URL' => $url));\n\t\treturn (is_array($hits) && count($hits) > 0) ;\n\t}", "public function exists() {}", "function is_search_has_results() {\n\treturn 0 != $GLOBALS['wp_query']->found_posts;\n}", "public function hasEnableSearch()\n {\n return $this->enable_search !== null;\n }", "protected function _isSearch()\n {\n\n return in_array($this->_getFullActionName(), self::PRODUCTSEARCHITEM_HANDLES);\n }", "public function exists();", "public function exists();", "public function exists();", "public function HasSearchResults(): bool\n {\n return $this->getSearchApplyer()->getHasResults();\n }", "public function query_exists($key) {\n\t\t\treturn \\uri\\query::exists($this->object, $key);\n\t\t}", "function radius_sql_exists($name)\n{\n $exists = false;\n global $environments;\n \n if(!array_key_exists($name, $environments)) return $exists;\n\n $id = $environments[$name]['_id'] . \"@miiicasa.com\";\n\n $dbconn = pg_connect(\"host=localhost port=5432 dbname=radius user=postgres\");\n $result = pg_query_params($dbconn, 'SELECT * FROM radcheck WHERE username = $1', array($id));\n if(pg_num_rows($result) > 0) $exists = true;\n \n pg_close($dbconn);\n\n return $exists;\n}", "function shIsSearchEngine()\n{\n\tstatic $isSearchEngine = null;\n\n\t//return true;\n\tif (!is_null($isSearchEngine))\n\t{\n\t\treturn $isSearchEngine;\n\t}\n\telse\n\t{\n\t\t$isSearchEngine = false;\n\t\t$useragent = empty($_SERVER['HTTP_USER_AGENT']) ? '' : strtolower($_SERVER['HTTP_USER_AGENT']);\n\t\tif (!empty($useragent))\n\t\t{\n\t\t\t$remoteConfig = Sh404sefHelperUpdates::getRemoteConfig($forced = false);\n\t\t\t$remotes = empty($remoteConfig->config['searchenginesagents']) ? array() : $remoteConfig->config['searchenginesagents'];\n\t\t\t$agents = array_unique(array_merge(Sh404sefFactory::getPConfig()->searchEnginesAgents, $remotes));\n\t\t\tforeach ($agents as $agent)\n\t\t\t{\n\t\t\t\tif (strpos($useragent, strtolower($agent)) !== false)\n\t\t\t\t{\n\t\t\t\t\t$isSearchEngine = true;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $isSearchEngine;\n\t}\n}", "protected function exists() {}", "function is_pm_search()\n{\n\tglobal $db;\n\n\t// Check if the search-module is active\n\t$sql = 'SELECT module_enabled FROM ' . MODULES_TABLE . '\n\t\tWHERE module_basename = \"pm\"\n\t\tAND module_mode = \"search\"';\n\t$result = $db->sql_query($sql);\n\t$pm_search_enabled = (int) $db->sql_fetchfield('module_enabled');\n\t$db->sql_freeresult($result);\n\n\treturn($pm_search_enabled);\n}", "public function exists()\r\n {\r\n }", "protected function isSearchEngineAvailable()\n {\n $settings = \\Administration::getSettings();\n return empty($settings->settings['info_fts_down']);\n }", "public function exists()\n {\n }", "public function exists()\n {\n }", "public function hasResults()\n {\n return $this->matches && $this->matches->exists();\n }", "public function isCatalogSearch()\n {\n $pathInfo = $this->_getRequest()->getPathInfo();\n if (stripos($pathInfo, '/catalogsearch/result') !== false) {\n return true;\n }\n return false;\n }", "public function has($key)\n {\n return $this->harvester->has($key);\n }", "public function exists(): bool\n {\n return $this->getElasticsearchClient()->indices()->exists([\n 'index' => static::getIndexName(),\n ]);\n }", "function search() {}", "public function search($search_id)\n\t{\n\t\tif(isset($this->cart[$search_id]))\n\t\t{\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 search()\n\t{}", "function search()\n\t{}", "public function Exists();", "private static function isSearchPage()\n {\n if (is_multisite() && (defined('SUBDOMAIN_INSTALL') && SUBDOMAIN_INSTALL === false)) {\n if (trim(strtok($_SERVER[\"REQUEST_URI\"], '?'), \"/\") == trim(get_blog_details()->path, \"/\") && is_search()) {\n return true;\n }\n }\n\n if (is_search()) {\n return true;\n }\n\n return false;\n }", "function exists()\n {\n return false;\n }", "function mEXISTS(){\n try {\n $_type = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$EXISTS;\n $_channel = Erfurt_Sparql_Parser_Sparql11_Update_Tokenizer11::$DEFAULT_TOKEN_CHANNEL;\n // Tokenizer11.g:54:3: ( 'exists' ) \n // Tokenizer11.g:55:3: 'exists' \n {\n $this->matchString(\"exists\"); \n\n\n }\n\n $this->state->type = $_type;\n $this->state->channel = $_channel;\n }\n catch(Exception $e){\n throw $e;\n }\n }", "public function exists(){\n\t\treturn ($this->count() > 0);\n\t}", "public function exists(): bool;", "public function exists(): bool;", "public function exists(): bool;", "abstract public function exists();", "abstract public function exists();", "public function IsSearchResults(): bool\n {\n return $this->HasSearchFilter();\n }", "function exists(){\n\t\t$sql = 'SELECT barcode FROM barcodes\n\t\t\t\tWHERE barcode = \"'.$this->code.'\"';\n\t\t$this->DB->query($sql);\n\t\tif(!$this->DB->isEmpty())\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->error = 'The barcode <strong>'.$this->code.'</strong> was not properly pre-registered. Please put this wristband aside, and distribute a new one.';\n\t\t\treturn false;\n\t\t}\n\t}", "protected function _needsSearch( array $params ) {\n\t\t\t$Controller = $this->_Collection->getController();\n\t\t\treturn !empty( $Controller->request->data );\n\t\t}", "public function search($searchTerm)\n {\n// if (!array_key_exists($feed, $this->_feeds)) {\n// throw new Zend_Tool_Project_Exception(sprintf(\n// 'Unknown feed \"%s\"',\n// $feed\n// ));\n// }\n\n// $feed = Zend_Feed_Reader::import($this->_feeds[$feed]);\n// $title = $desc = $link = '';\n// foreach ($feed as $entry) {\n// $title = $entry->getTitle();\n// $desc = $entry->getDescription();\n// $link = $entry->getLink();\n// break;\n// }\n\n\n\n //$content = sprintf(\"%s\\n%s\\n\\n%s\\n\", $title, strip_tags($desc), $link);\n\n $response = $this->_registry->getResponse();\n $response->appendContent(\"Hello '$searchTerm'\");\n return true;\n }", "public function exists($key)\n {\n return !empty($this->cache->get($key, 'bladerunner'));\n }", "function tc_is_no_results() {\r\n global $wp_query;\r\n return ( is_search() && 0 == $wp_query -> post_count ) ? true : false;\r\n }", "private function canSearch(array $config = [])\n {\n \tif (isset($config['global_search']) && isset($config['global_search']['search_objects']) === true)\n \t{\n \t\tif (is_array($config['global_search']['search_objects']) && count($config['global_search']['search_objects'] == 0))\n \t\t{\n \t\t\treturn true;\n \t\t}\n \t}\n \treturn false;\n }", "public function isSearchPage();", "function exists_query($query, array $params = array()) {\n\treturn (count_query($query, $params) > 0);\n}", "public function exists()\n {\n // for us its the same\n return $this->isHit();\n }", "public function exists()\n {\n return false;\n }", "public function eventExists()\n {\n return $this->getTalk()->getSpeaker()->exists();\n }", "public function search();", "public function search();", "protected function getElasticsearchTypeExists(SearchApiIndex $index) {\n $params = $this->getIndexParam($index, TRUE);\n try {\n return $this->elasticsearchClient->indices()->existsType($params);\n }\n catch (Exception $e) {\n drupal_set_message($e->getMessage(), 'error');\n return FALSE;\n }\n }", "public function is_searchable()\r\n {\r\n // to search by.\r\n return !empty($this->address_md5) || $this->is_valid_email();\r\n }", "private function isClerkSearchEnabled()\n {\n return $this->scopeConfig->isSetFlag(Config::XML_PATH_SEARCH_ENABLED, ScopeInterface::SCOPE_STORE);\n }", "function exists($item_kit_id)\n\t{\n\t\t// echo $item_kit_id;\n\t\t$query = $this->db->where(\"category\", \"tickets\")\n\t\t\t\t->where('item_kit_id',$item_kit_id)\n\t\t\t\t->get(\"item_kits\");\n\n\t\treturn ($query->num_rows() == 1);\n\t}", "function isQueryFromSearchEngine() {\n\t\t$bFromSearchEngine = false;\n\t\tif(!isset($_SERVER['HTTP_REFERER'])) {\n\t\t\treturn false;\n\t\t}\n\t\t$referer = $_SERVER['HTTP_REFERER'];\n\t\t$parsed = parse_url($referer, PHP_URL_QUERY);\n\t\tparse_str($parsed, $query);\n\t\tswitch(true) {\n\t\t\tcase strpos($referer, 'yahoo') !== false && isset($query['p']):\n\t\t\t\t$keyword = $query['p'];\n\t\t\t\tbreak;\n\n\t\t\tcase strpos($referer, 'bing') !== false && isset($query['q']):\n\t\t\t\t$keyword = $query['q'];\n\t\t\t\tbreak;\n\n\t\t\tcase strpos($referer, 'google') !== false && isset($query['q']):\n\t\t\t\t$keyword = $query['q'];\n\t\t\t\tbreak;\n\n\t\t\tcase strpos($referer, 'aol') !== false && isset($query['query']):\n\t\t\t\t$keyword = $query['query'];\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\t$keyword = '';\n\t\t\t\tbreak;\n\t\t}\n\t\t$this->_searchEngineQuery = $keyword;\n\t\treturn $keyword !== '';\n\t}", "public function searchFor($text)\n {\n return true;\n }", "public function hasResults();", "public function search(){\r\n\t\t//Test if the POST parameters exist. If they don't present the user with the\r\n\t\t//search controls/form\r\n\t\tif(!isset($_POST[\"search\"])){\r\n\t\t\t$this->template->display('search.html.php');\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\t//Get the recipe from the database\r\n\t\t$recipes = Recipe::search($_POST[\"search\"]);\r\n\t\t//If successful and the count is equal to one (as desired)\r\n\t\t//set the recipe object in the template to be displayed\r\n\t\t$this->template->recipes = $recipes;\r\n\t\r\n\t\t$this->template->display('results.html.php');\r\n\t}", "public function exists(): bool\n {\n return ! empty($this->awb);\n }", "public function getIsSearchable()\n {\n return (!is_null($this->searchDialog) && $this->searchMemberExpression != '');\n }", "public function isHasResults();", "public function search(){}", "public function exists($key){\n\n //get exists\n if($this->client->exists($key)){\n return true;\n }\n return false;\n }", "public function exists()\n {\n return $this->count() > 0;\n }", "public function contains_searchResult_social($searchResult, $request,$socials)\n {\n $terms = explode(\" \",$request);\n $test = false;\n //print_r($terms);\n\n //check if the header/title of the result contains the keywords of the search query\n\n foreach ($socials as $social) {\n if (strpos(strtolower($searchResult->links), strtolower($social)) !== false) {\n $test = true;\n break;\n }\n }//*/\n if($test)\n {\n foreach ($terms as $term)\n {\n if($test)\n {\n if(strpos(strtolower($searchResult->title) ,strtolower($term)) !== false)\n {\n $test = true;\n }\n else\n {\n $test = false;\n }\n }\n }\n if(!$test)\n {\n //check if the link of the result contains the keywords of the search query\n $test = true;\n foreach ($terms as $term)\n {\n if($test)\n {\n\n if(strpos(strtolower($searchResult->link) ,strtolower($term)) !== false)\n {\n $test = true;\n }\n else\n {\n $test = false;\n }\n }\n }\n if(!$test)\n {\n //check if the body of the result contains the keywords of the search query\n $test = true;\n foreach ($terms as $term)\n {\n if($test)\n {\n // echo strtolower($searchResult->preview);\n if(strpos(strtolower($searchResult->preview) ,strtolower($term)) !== false)\n {\n\n // echo \"<br/>\";\n }\n else\n {\n $test = false;\n }\n }\n }\n }\n }\n }\n if(!$test)\n {\n return true;\n }\n else\n {\n //echo \"else <br/>\";\n //check the result is already record\n foreach ($this->searchResults as $result)\n {\n // echo \"<br/> a\";\n if(strpos(strtolower($result->links) ,strtolower($searchResult->links)) !== false)\n {\n return true;\n }\n //echo \"yes\";\n\n }\n }\n // echo \"rien\";\n\n return false;\n }", "private function searchMustEnd(): bool\n {\n return in_array($this->search->fresh()->status, [\n Search::STATUS_FINISHED,\n Search::STATUS_FAILED,\n Search::STATUS_PAUSED\n ]);\n }", "public function has($name);", "public function has($name);", "public function has($name);", "public function has($name);", "public function has($name);", "public function has($name);", "public function has($name);", "public function has($name);", "public function exists($name);", "public function exists($name);", "public function exists($name);", "public function exists($name);", "public function exists($name);", "public function exists($name);", "public function check_item_exists($params)\n {\n $this->db->select(\"1\");\n $this->db->from('m_komoku');\n $this->db->where('del_flg', '0');\n $this->db->where('komoku_id', $params['komoku_id']);\n $this->db->where('kubun', $params['kubun']);\n \n $query = $this->db->get();\n if ($query->num_rows() > 0) {\n return TRUE;\n } else {\n return FALSE;\n }\n }", "public function exists( $url );", "public function has(string $name): bool;", "public function has(string $name): bool;", "public function has(string $name): bool;", "public function has(string $name): bool;", "public function has(string $name): bool;", "protected function isSearchable(): bool\n {\n return $this->get('searchable') ?? false;\n }", "public function hasItem($key)\n\t{\n\t\t$this->checkKeyName($key);\n\n\t\t$item = new Item($this->redisClient, $key);\n\n\t\treturn $item->isHit();\n\t}", "function search($expression) {\n $this->set_error('search is not implemented');\n return false;\n }", "public function runExists() {\r\n $db = static::getDB();\r\n $stmt = $db->query(\r\n \"SELECT * FROM runboard \"\r\n . \"WHERE fromStore='$this->fromStore' \"\r\n . \"AND toStore='$this->toStore' \"\r\n . \"AND category='$this->category' \"\r\n . \"AND item='$this->item' \"\r\n );\r\n $results = $stmt->fetchAll(PDO::FETCH_ASSOC);\r\n \r\n return $results;\r\n }" ]
[ "0.59660745", "0.5927011", "0.5827908", "0.57014567", "0.5696672", "0.5666628", "0.5648116", "0.56401366", "0.5629795", "0.5580266", "0.5553644", "0.5541919", "0.55297583", "0.54535544", "0.54331195", "0.54331195", "0.54331195", "0.54329264", "0.54238576", "0.5401853", "0.5387957", "0.53773504", "0.53637433", "0.5358896", "0.534569", "0.53294444", "0.53289956", "0.53269905", "0.5318783", "0.53112495", "0.52621967", "0.52606297", "0.5260562", "0.52595025", "0.52595025", "0.5244474", "0.52424777", "0.5240856", "0.521461", "0.5213152", "0.52123624", "0.52123624", "0.52123624", "0.5190266", "0.5190266", "0.51861894", "0.5182388", "0.51791644", "0.5160325", "0.5134828", "0.5096634", "0.50915813", "0.50863665", "0.507941", "0.5074632", "0.5066668", "0.5062718", "0.50525874", "0.50525874", "0.5045005", "0.5043123", "0.50420415", "0.5034412", "0.5032768", "0.5028881", "0.5026534", "0.50227875", "0.5017498", "0.500114", "0.49956545", "0.4993981", "0.4986797", "0.498446", "0.49785417", "0.49613193", "0.4953876", "0.4953876", "0.4953876", "0.4953876", "0.4953876", "0.4953876", "0.4953876", "0.4953876", "0.49486658", "0.49486658", "0.49486658", "0.49486658", "0.49486658", "0.49486658", "0.4946882", "0.4942839", "0.49359435", "0.49359435", "0.49359435", "0.49359435", "0.49359435", "0.49348402", "0.49314612", "0.49303293", "0.4929399" ]
0.65967464
0
/ Function definition Add interface to LAS_API
function las_add_interface($name, $url, $msgtype='json', $rettype='json') { global $LAS_API; if ( $name && $url && $msgtype ) { $entry = new stdClass; $entry->url = $url; $entry->msgtype = $msgtype; $entry->rettype = $rettype; $LAS_API[$name] = $entry; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function las_get_interface($name = null) {\n\tglobal $LAS_CFG, $LAS_API;\n\n\t$las_api = $LAS_CFG->wwwroot . '/api';\n\t$report_api = $LAS_CFG->wwwroot . '/report';\n\t\n\tlas_add_interface(\n\t\t'GetAPIs',\n\t\t$las_api . '/GetAPIs',\n\t\tLAS_API_MSGTYPE_JSON,\n\t\tLAS_API_MSGTYPE_JSON\n\t);\n\t\n\tlas_add_interface(\n\t\t'UploadFile',\n\t\t$las_api . '/UploadFile',\n\t\tLAS_API_MSGTYPE_FILE,\n\t\tLAS_API_MSGTYPE_JSON\n\t);\n\t\n\tlas_add_interface(\n\t\t'GetResult',\n\t\t$las_api . '/GetResult',\n\t\tLAS_API_MSGTYPE_JSON,\n\t\tLAS_API_MSGTYPE_JSON\n\t);\n\t\n\tlas_add_interface(\n\t\t'GetReportUrl',\n\t\t$report_api . '/GetReportUrl',\n\t\tLAS_API_MSGTYPE_JSON,\n\t\tLAS_API_MSGTYPE_JSON\n\t);\n\t\n\t$GLOBALS['LAS_API'] = $LAS_API;\n\t\t\n\tif ( !empty($name) ) {\n\t\tif ( array_key_exists($name, $LAS_API) ) {\n\t\t\treturn $LAS_API[$name]->url;\n\t\t}\n\t}\n\telse {\n\t\treturn json_encode($LAS_API);\n\t}\n}", "abstract protected function interface();", "function apiai()\n {\n $this->name = \"apiai\";\n $this->title = \"API.AI\";\n $this->module_category = \"<#LANG_SECTION_OBJECTS#>\";\n $this->api_endpoint = \"https://api.dialogflow.com/v1/\";\n $this->api_version = \"20170712\";\n $this->checkInstalled();\n }", "public function setApi(ApiInterface $api);", "function add($iface)\n {\n $this->_add_edit($iface, 'add');\n }", "public function library()\n\t{\n\t\n\t}", "function onibus_endpoint_init() {\n\n\t$namespace = API_VERSAO;\n\n register_rest_route( $namespace, '/onibus/get-info-geral/',\n\n\t array(\n\t 'methods' \t=> 'GET',\n\t 'callback' \t=> 'get_informacoes_gerais_onibus',\n\t 'permission_callback' => function () {\n\t \treturn is_user_logged_in();\n\t }\n\t )\n\n );\n register_rest_route( $namespace, '/onibus/set-info-geral/',\n\n\t array(\n\t 'methods' \t=> 'POST',\n\t 'callback' \t=> 'set_informacoes_gerais_onibus',\n\t 'permission_callback' => function () {\n\t \treturn is_user_logged_in();\n\t }\n\t )\n\n );\n register_rest_route( $namespace, '/onibus/',\n\n\t array(\n\t 'methods' \t=> 'GET',\n\t 'callback' \t=> 'get_all_onibus',\n\t 'permission_callback' => function () {\n\t \treturn is_user_logged_in();\n\t }\n\t )\n\n );\n register_rest_route( $namespace, '/onibus/(?P<id>\\d+)',\n\n\t array(\n\t 'methods' \t=> 'GET',\n\t 'callback' \t=> 'get_onibus_by_id',\n\t 'permission_callback' => function () {\n\t \treturn is_user_logged_in();\n\t }\n\t )\n\n );\n register_rest_route( $namespace, '/onibus/create/',\n\n\t array(\n\t\t\t'methods' => 'POST',\n\t\t\t'callback' => 'adicionar_onibus',\n\t\t\t'permission_callback' => function () {\n\t\t\t \treturn is_user_logged_in();\n\t\t\t}\n\t\t)\n\n );\n register_rest_route( $namespace, '/onibus/update/',\n\n\t array(\n\t\t\t'methods' => 'POST',\n\t\t\t'callback' => 'editar_onibus',\n\t\t\t'permission_callback' => function () {\n\t\t\t \treturn is_user_logged_in();\n\t\t\t}\n\t\t)\n\n );\n register_rest_route( $namespace, '/onibus/delete/',\n\n\t array(\n\t\t\t'methods' => 'POST',\n\t\t\t'callback' => 'deletar_onibus',\n\t\t\t'permission_callback' => function () {\n\t\t\t \treturn is_user_logged_in();\n\t\t\t}\n\t\t)\n\n );\n\n}", "public function api_call() {\n\n }", "public function register( \\FutoIn\\AsyncSteps $as, $ifacever, $impl );", "public static function node_interface()\n {\n }", "public function apiList();", "public function extractApi();", "public function getInterface();", "public function readyForInterface() {}", "public function setApi(IApi $api);", "public function createInvokableScriptsApi(): InvokableScriptsApi;", "function rest_api_init()\n {\n }", "public function custom_api() {\n\n\t\t$this->register_new_route( 'cases', '_user', WP_REST_Server::READABLE, array( $this, 'read' ) );\n\n\t\t$this->register_new_route( 'cases', '', WP_REST_Server::EDITABLE, array( $this, 'update' ) );\n\n\t\t$this->register_new_route( 'cases', '', WP_REST_Server::DELETABLE, array( $this, 'delete' ) );\n\n\t\t$this->register_new_route( 'cases', '_user', WP_REST_Server::CREATABLE, array( $this, 'create' ) );\n\t}", "public function init() {\n parent::init();\n if (!is_object($this->api)) {\n $class = $this->api;\n $this->api = new $class;\n }\n $this->loadPlugins();\n }", "function apiVersion() {}", "private function _init_api_library($base_name)\n\t{\n\t\t// Generate the name of the class\n\t\t$class_name = $base_name.API_LIBRARY_SUFFIX;\n\n\t\t// Check if the implementing library exists\n\t\tif ( ! file($class_name.'.php'))\n\t\t{\n\t\t\tthrow new Exception('File not found',$class_name.'.php');\n\t\t}\n\n\t\t// Include the implementing API library file\n\t\trequire_once $class_name.'.php';\n\n\t\t// Temporary instance for type checking\n\t\t$temp_api_object = new $class_name($this);\n\n\t\t// Check if the implementing library is an instance of Api_Object\n\t\t// NOTE: All API libraries *MUST* be subclasses of Api_Object\n\t\tif ( ! $temp_api_object instanceof Api_Object)\n\t\t\tthrow new Exception('Invalid Api library', $class_name, 'Api_Object');\n\n\t\t// Discard the old copy\n\t\tunset($this->temp_api_object);\n\n\t\t// Instaniate a fresh copy of the API library\n\t\t$this->api_object = new $class_name($this);\n\n\t\t//print_r(get_class_methods($this->api_object));exit;\n\n\t}", "private function setup_api() {\n\t\trequire_once 'includes/class-themeisle-ob-rest-server.php';\n\t\tif ( ! class_exists( 'Themeisle_OB_Rest_Server' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$api = new Themeisle_OB_Rest_Server();\n\t\t$api->init();\n\t\trequire_once 'includes/importers/helpers/trait-themeisle-ob.php';\n\t}", "protected function createInterface()\n {\n $classNameService = $this->argument('name');\n\n\n $this->call('make:service_interface', [\n 'name' => \"{$classNameService}Interface\",\n ]);\n }", "public function __construct()\n {\n $CSO = new Api_Resources_CSO();\n $CSO->authenticate('timojong', 'FG4d%!k3hU');\n $this->addResource('CSO', $CSO);\n\n $OpenOnderwijs = new Api_Resources_OpenOnderwijs();\n $this->addResource('OpenOnderwijs', $OpenOnderwijs);\n }", "public function __construct() {\n if (!$this->api) {\n $this->api = new Wrapper();\n }\n }", "public function create()/*# : CreateInterface */;", "public function __construct(){\n $this->api = new Concierge();\n }", "public function getApi();", "public function getApi();", "public function getApi();", "public function register();", "public function register();", "public function register();", "public function register();", "public function register();", "public function register();", "public function register();", "public function register();", "public function processApi();", "function addInterface($interface)\n {\n if (is_string($interface)) {\n $this->interfaces[] = $this->normalizeInterface($interface);\n } else if (is_array($interface)) {\n foreach ($interface as $item) {\n if(!is_string($item)){\n $this->throwInterfaceException();\n }\n $this->addInterface($item);\n }\n } else {\n $this->throwInterfaceException();\n }\n return $this;\n }", "public function registerEngine($api,$data)\n\t{\n\t\t$result=false;\n\t\t$ts=array();\n\t\tif($data->item && $api!='')\n\t\t{\n\t\t\t$ts=array();\n\t\t\t\t$ts[$api]=array();\n\t\t\t\tfor($i=0;$i<count($data->item);$i++)\n\t\t\t\t{\n\t\t\t\t\t$ob=$data->item[$i];\n\t\t\t\t\t$identifier=(String)$ob->identifier;\n\t\t\t\t\t$ts[$api][$identifier]=array();\n\t\t\t\t\t$ts[$api][$identifier]['keys']=array();\n\t\t\t\t\t$ts[$api][$identifier]['access']=(String)$ob['access'];\n\t\t\t\t\tif($ob->environment && count($ob->environment->item)>=0)\n\t\t\t\t\t{\n\t\t\t\t\t\t$ts[$api][$identifier]['environment']=array();\n\t\t\t\t\t\tfor($j=0;$j<count($ob->environment->item);$j++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$ts[$api][$identifier]['environment'][]=(String)$ob->environment->item[$j]['value'];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($identifier && trim($identifier)!=''){\n\t\t\t\t\t\t\tif(isset($ob->params))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(isset($ob->params->item) && count($ob->params->item)>=0){\n\t\t\t\t\t\t\t\t\tfor($j=0;$j<count($ob->params->item);$j++)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$ob_p=$ob->params->item[$j];\n\t\t\t\t\t\t\t\t\t\tif(!isset($ob_p[\"name\"]) || !isset($ob_p[\"type\"])){\n\t\t\t\t\t\t\t\t\t\t\t$this->setError(\"Not inited:\".$api.\";wrong protocol declaration\");\n\t\t\t\t\t\t\t\t\t\t\treturn API_INVALIDE_PROTOCOL;\n\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t$ts[$api][$identifier]['keys'][]=array('name'=>(String)$ob_p['name'],'type'=>(String)$ob_p['type'],\"important\"=>(isset($ob_p->important))?(bool)$ob_p->important:0);\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}else{\n\t\t\t\t\t\t\t\t$this->setError(\"Not inited:\".$api.\";wrong protocol declaration\");\n\t\t\t\t\t\t\t\treturn API_INVALIDE_PROTOCOL;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$this->setError(\"Not inited:\".$api.\";wrong protocol declaration\");\n\t\t\t\t\t\t\treturn API_INVALIDE_PROTOCOL;\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->setError(\"Not inited:\".$api.\";wrong protocol declaration\");\n\t\t\t\t\t\treturn API_INVALIDE_PROTOCOL;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else\n\t\t\t{\n\t\t\t\t$this->setError(\"Not inited:\".$api.\";wrong protocol declaration\");\n\t\t\t\treturn API_WRONG_PARAMS;\n\t\t\t}\n\t\t$this->engines=$ts;\n\t\treturn $result;\n\t}", "protected function changeBaseApi() {\n $domain = $this->language.'.'.$this->engine_supported[$this->engine];\n $this->base_api = sprintf('http://%s/w/api.php?format=json&rawcontinue=1&', $domain);\n }", "public function addInterfaces(array $interfaces): void;", "public function __construct($config){\n $this->api = new LeadBIAPI($config);\n }", "public function __construct($config){\n $this->api = new LeadBIAPI($config);\n }", "public function getApiBase();", "public function __construct(){\n $this->__classname = get_class($this); \n $this->_methods['default'] = $this->__classname.\"Init\";\n $this->registerMethodAlias(\"createUrl\", array(\"Vimerito\", \"createUrl\"));\n $this->registerMethodAlias(\"loadJsLibrary\", array(\"VLayout\", \"registerUserJavaScriptLibraries\"));\n }", "public function addInterface(string $interface, string $class): void\n {\n $this->callables[$interface] = function () use ($class) {\n return $this->getObject($class);\n };\n }", "#[Pure]\nfunction http_support($feature = null) {}", "private function _init_api_library($base_name)\n\t{\n\t\t// Generate the name of the class\n\t\t$class_name = $base_name.API_LIBRARY_SUFFIX;\n\n\t\t// Check if the implementing library exists\n\t\tif ( ! Kohana::find_file('libraries/api',\n\t\t\tKohana::config('config.extension_prefix').$class_name))\n\t\t{\n\t\t\tthrow new Kohana_Exception('libraries.api_library_not_found',\n\t\t\t\tKohana::config('config.extension_prefix').$class_name.'.php', $class_name);\n\t\t}\n\n\t\t// Include the implementing API library file\n\t\trequire_once Kohana::find_file('libraries/api', Kohana::config('config.extension_prefix').$class_name);\n\n\t\t// Temporary instance for type checking\n\t\t$temp_api_object = new $class_name($this);\n\n\t\t// Check if the implementing library is an instance of Api_Object_Core\n\t\t// NOTE: All API libraries *MUST* be subclasses of Api_Object_Core\n\t\tif ( ! $temp_api_object instanceof Api_Object_Core)\n\t\t\tthrow new Kohana_Exception('libraries.invalid_api_library', $class_name, 'Api_Object_Core');\n\n\t\t// Discard the old copy\n\t\tunset($this->temp_api_object);\n\n\t\t// Instaniate a fresh copy of the API library\n\t\t$this->api_object = new $class_name($this);\n\t}", "public function getInterfaces() {}", "private function public_hooks()\n\t{\n\t}", "public function __construct()\n {\n $this->commandInterface = APICommandInterface::class;\n parent::__construct();\n }", "public function createSchema(): OpenApi\n {\n }", "public function set_api( $name, $value ) {\n\t\t$this->api[ $name ] = $value;\n\t}", "function initRequestInfo($sapi='') { \n\n}", "protected static function register() {}", "abstract public function register();", "abstract public function register();", "abstract public function register();", "public function register(): void;", "public function name(): string\n {\n return 'interface';\n }", "function runkit_method_add($classname, $methodname, $args, $code, $flags = RUNKIT_ACC_PUBLIC)\n{\n}", "protected function add() {\n\t}", "function permly_api($api_key=''){\n\t\t$this->api_key = $api_key;\n\t\t$this->url = $this->api_server_protocol.\"://\".$this->api_server.\"/?remote_service=rs_external_api&key=1&interface=eai_permly&version=\".$this->api_version;\n\t}", "public function hook() {\n\t\t// the WPML API is not included by default\n\t\trequire_once ICL_PLUGIN_PATH . '/inc/wpml-api.php';\n\n\t\t$this->hook_actions();\n\t\t$this->hook_filters();\n\t}", "private function _setApiCallbacks($apiMethodPrefix)\n {\n $apiMethodPrefix = KwWebApiCore::checkApiMethodPrefix($apiMethodPrefix);\n\n $help = array();\n $help['params'] = array();\n $help['example'] = array();\n $help['return'] = 'String version';\n $help['description'] = 'Return the version of MIDAS';\n $this->helpContent[$apiMethodPrefix.'version'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'version'] = array(&$this, 'version');\n\n $help = array();\n $help['params'] = array();\n $help['example'] = array();\n $help['return'] = 'MIDAS info';\n $help['description'] = 'Get information about this MIDAS instance';\n $this->helpContent[$apiMethodPrefix.'info'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'info'] = array(&$this, 'info');\n\n $help = array();\n $help['params'] = array();\n $help['params']['appname'] = 'Application Name';\n $help['params']['email'] = 'E-mail of the user';\n $help['params']['password'] = '(Optional) Password of the user';\n $help['params']['apikey'] = '(Optional) Key of the user';\n $help['example'] = array();\n $help['example']['?method=midas.login&appname=test&[email protected]&password=YourPass'] = 'Authenticate using password';\n $help['example']['?method=midas.login&appname=test&[email protected]&apikey=YourKey'] = 'Authenticate using key';\n $help['return'] = 'Token';\n $help['description'] = 'Authenticate an user';\n $this->helpContent[$apiMethodPrefix.'login'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'login'] = array(&$this, 'login');\n\n $help = array();\n $help['params'] = array();\n $help['params']['id'] = 'Element Id';\n $help['params']['type'] = 'Element Type: bitstream='.MIDAS_RESOURCE_BITSTREAM.', item='.MIDAS_RESOURCE_ITEM.', revision='.MIDAS_RESOURCE_REVISION.', folder='.MIDAS_RESOURCE_FOLDER.', community='.MIDAS_RESOURCE_COMMUNITY;\n $help['example'] = array();\n $help['return'] = 'Universal identifier';\n $help['description'] = 'Get uuid';\n $this->helpContent[$apiMethodPrefix.'uuid.get'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'uuid.get'] = array(&$this, 'uuidGet');\n\n $help = array();\n $help['params'] = array();\n $help['params']['uuid'] = 'Universal identifier';\n $help['example'] = array();\n $help['return'] = 'Universal identifier (Dao)';\n $help['description'] = 'Get Universal identifier (contain resource id and type)';\n $this->helpContent[$apiMethodPrefix.'resource.get'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'resource.get'] = array(&$this, 'resourceGet');\n\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = '(Optional) Authentification token';\n $help['params']['search'] = 'Search Query';\n $help['params']['order'] = '(Optional) name or date or view. Default view';\n $help['example'] = array();\n $help['return'] = 'Array of resource)';\n $help['description'] = 'Global search';\n $this->helpContent[$apiMethodPrefix.'resource.search'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'resource.search'] = array(&$this, 'resourcesSearch');\n\n $help = array();\n $help['params'] = array();\n $help['params']['uuid'] = 'Unique identifier of the resource';\n $help['example'] = array();\n $help['return'] = 'Array of resource';\n $help['description'] = 'Return the path to the root';\n $this->helpContent[$apiMethodPrefix.'path.to.root'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'path.to.root'] = array(&$this, 'pathToRoot');\n\n $help = array();\n $help['params'] = array();\n $help['params']['uuid'] = 'Unique identifier of the resource';\n $help['example'] = array();\n $help['return'] = 'Array of resource';\n $help['description'] = 'Return the path from the root';\n $this->helpContent[$apiMethodPrefix.'path.from.root'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'path.from.root'] = array(&$this, 'pathFromRoot');\n\n /* ----- Upload ------*/\n $help = array();\n $help['params'] = array();\n $help['example'] = array();\n $help['return'] = 'Token';\n $help['description'] = 'Generate an upload token';\n $this->helpContent[$apiMethodPrefix.'upload.generatetoken'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'upload.generatetoken'] = array(&$this, 'uploadApiGenerateToken');\n\n $help = array();\n $help['params'] = array();\n $help['example'] = array();\n $help['return'] = '';\n $help['description'] = 'Get offset';\n $this->helpContent[$apiMethodPrefix.'upload.getoffset'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'upload.getoffset'] = array(&$this, 'uploadApiGetOffset');\n\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = 'Authentification token';\n $help['params']['mode'] = '(Optional) stream or multipart. Default: stream';\n $help['params']['folder_id'] = 'If set, will create a new item in the folder';\n $help['params']['item_id'] = 'If set, will create a new revision in the item';\n $help['params']['revision'] = 'If set, will create a new add files to a revision';\n $help['example'] = array();\n $help['return'] = 'Item information';\n $help['description'] = 'Upload a file (using put or post method)';\n $this->helpContent[$apiMethodPrefix.'upload.file'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'upload.file'] = array(&$this, 'uploadFile');\n\n /* ----- Community ------*/\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = '(Optional) Authentification token';\n $help['example'] = array();\n $help['return'] = 'List of communities';\n $help['description'] = 'Get the list of all communities visible to the given user';\n $this->helpContent[$apiMethodPrefix.'community.list'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'community.list'] = array(&$this, 'communityList');\n\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = 'Authentification token';\n $help['params']['name'] = '';\n $help['params']['description'] = '(Optional) Default \\'\\'';\n $help['params']['privacy'] = '(Optional) Default \\'Public\\'. '.MIDAS_COMMUNITY_PRIVATE.'= Private, '.MIDAS_COMMUNITY_PUBLIC.'= Public';\n $help['params']['canjoin'] = '(Optional) Default \\'Everyone\\'. '.MIDAS_COMMUNITY_INVITATION_ONLY.'= Invitation, '.MIDAS_COMMUNITY_CAN_JOIN.'= Everyone';\n $help['params']['uuid'] = '(Optional) Unique identifier. If set, will edit the community';\n $help['example'] = array();\n $help['return'] = 'Community Information';\n $help['description'] = 'Create or update a community';\n $this->helpContent[$apiMethodPrefix.'community.create'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'community.create'] = array(&$this, 'communityCreate');\n\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = '(Optional) Authentification token';\n $help['params']['id'] = 'Id of the community';\n $help['example'] = array();\n $help['return'] = 'Community Information';\n $help['description'] = 'Get a community';\n $this->helpContent[$apiMethodPrefix.'community.get'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'community.get'] = array(&$this, 'communityGet');\n\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = 'Authentification token';\n $help['params']['id'] = 'Id of the community';\n $help['example'] = array();\n $help['return'] = '';\n $help['description'] = 'Delete a community';\n $this->helpContent[$apiMethodPrefix.'community.delete'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'community.delete'] = array(&$this, 'communityDelete');\n\n /* ----- Folder ------*/\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = 'Authentification token';\n $help['params']['name'] = '';\n $help['params']['description'] = '';\n $help['params']['parentid'] = '(Optional during update) Id of the parent folder ';\n $help['params']['uuid'] = '(Optional) Unique identifier. If set, will edit the folder';\n $help['example'] = array();\n $help['return'] = 'Folder information';\n $help['description'] = 'Create or edit a folder';\n $this->helpContent[$apiMethodPrefix.'folder.create'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'folder.create'] = array(&$this, 'folderCreate');\n\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = 'Authentification token';\n $help['params']['id'] = 'Id of the folder';\n $help['example'] = array();\n $help['return'] = '';\n $help['description'] = 'Delete a folder';\n $this->helpContent[$apiMethodPrefix.'folder.delete'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'folder.delete'] = array(&$this, 'folderDelete');\n\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = '(Optional) Authentification token';\n $help['params']['id'] = 'Id of the folder';\n $help['example'] = array();\n $help['return'] = 'Folder Information';\n $help['description'] = 'Get a folder';\n $this->helpContent[$apiMethodPrefix.'folder.get'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'folder.get'] = array(&$this, 'folderGet');\n\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = '(Optional) Authentification token';\n $help['params']['id'] = 'Id of the folder';\n $help['example'] = array();\n $help['return'] = 'List of children';\n $help['description'] = 'Get all of the immediate children of a folder';\n $this->helpContent[$apiMethodPrefix.'folder.children'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'folder.children'] = array(&$this, 'folderChildren');\n\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = '(Optional) Authentification token';\n $help['params']['id'] = 'Id of the folder';\n $help['example'] = array();\n $help['return'] = 'File';\n $help['description'] = 'Download a folder';\n $this->helpContent[$apiMethodPrefix.'folder.download'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'folder.download'] = array(&$this, 'folderDownload');\n\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = '(Optional) Authentification token';\n $help['params']['id'] = 'Id of the folder';\n $help['example'] = array();\n $help['return'] = 'Array of Items and Folders';\n $help['description'] = 'Get folder content';\n $this->helpContent[$apiMethodPrefix.'folder.content'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'folder.content'] = array(&$this, 'folderContent');\n\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = '(Optional) Authentification token';\n $help['params']['id'] = 'Id of the folder';\n $help['example'] = array();\n $help['return'] = 'Array of Folders';\n $help['description'] = 'Get folder tree';\n $this->helpContent[$apiMethodPrefix.'folder.tree'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'folder.tree'] = array(&$this, 'folderTree');\n\n /** ----- User -------------*/\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = '(Optional) Authentification token';\n $help['example'] = array();\n $help['return'] = 'List of Folders';\n $help['description'] = 'Get the list of top level folders belonging to a given user';\n $this->helpContent[$apiMethodPrefix.'user.folders'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'user.folders'] = array(&$this, 'userFolders');\n\n $help = array();\n $help['params'] = array();\n $help['params']['email'] = 'The user\\'s email';\n $help['params']['password'] = 'The user\\'s password';\n $help['example'] = array();\n $help['return'] = 'The user\\'s default API key';\n $help['description'] = 'Gets the user\\'s default API key. Only call this the first time a new password is used';\n $this->helpContent[$apiMethodPrefix.'user.apikey.default'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'user.apikey.default'] = array(&$this, 'userApikeyDefault');\n\n /** ------ ITEM --- */\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = '(Optional) Authentification token';\n $help['params']['id'] = 'Id of the item';\n $help['example'] = array();\n $help['return'] = 'Item Information';\n $help['description'] = 'Get an item information (contains its revisions information)';\n $this->helpContent[$apiMethodPrefix.'item.get'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'item.get'] = array(&$this, 'itemGet');\n\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = '(Optional) Authentification token';\n $help['params']['id'] = 'Id of the item';\n $help['params']['revision'] = '(Optional) If not set, will download last revision';\n $help['example'] = array();\n $help['return'] = 'File';\n $help['description'] = 'Download an item';\n $this->helpContent[$apiMethodPrefix.'item.download'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'item.download'] = array(&$this, 'itemDownload');\n\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = 'Authentification token';\n $help['params']['id'] = 'Id of the item';\n $help['example'] = array();\n $help['return'] = '';\n $help['description'] = 'Delete an item (an its bitstream)';\n $this->helpContent[$apiMethodPrefix.'item.delete'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'item.delete'] = array(&$this, 'itemDelete');\n\n $help = array();\n $help['params'] = array();\n $help['params']['token'] = 'Authentification token';\n $help['params']['id'] = 'Id of the item';\n $help['params']['revision'] = '(Optional) Revision of the item';\n $help['example'] = array();\n $help['return'] = '';\n $help['description'] = 'Get metadata';\n $this->helpContent[$apiMethodPrefix.'item.getmetadata'] = $help;\n $this->apicallbacks[$apiMethodPrefix.'item.getmetadata'] = array(&$this, 'itemGetMetadata');\n\n // Extend web API to other modules via CALLBACK_API_METHODS\n $additionalMethods = Zend_Registry::get('notifier')->callback('CALLBACK_API_METHODS', array());\n foreach($additionalMethods as $module => $methods)\n {\n foreach($methods as $method)\n {\n $this->helpContent[$apiMethodPrefix.strtolower($module).'.'.$method['name']] = $method['help'];\n $this->apicallbacks[$apiMethodPrefix.strtolower($module).'.'.$method['name']] = array($method['callbackObject'], $method['callbackFunction']);\n }\n }\n }", "public function me():ResponseInterface;", "function api_app_modify_function() {\n\n}", "abstract protected function getService();", "function AddMethod($server){\n\n $server->register('expose',\n array('data' => 'xsd:string'),\n array('return' => 'tns:exposeObject'),\n 'urn:idu', // namespace\n '', // soapaction\n '', // style\n '', // use\n 'Copyright by Hector Orlando Crispens');\n return;\n\n }", "function _registerFunction($name, $doc, $response = 'xsd:int') {\n if (defined('NUSOAP')) {\n // WSDL generation\n $function = new ReflectionFunction($name);\n $parameters = $function->getParameters();\n \n $usedParameters = array();\n foreach ($parameters as $parameter) {\n \t$usedParameters[] = $parameter->getName();\n }\n \n $soapParameters = $GLOBALS['soapParameters'];\n \n $parameters = array();\n $paramsDoc = '<pre>';\n\n foreach ($usedParameters as $usedParameter) {\n $parameters[$usedParameter] = $soapParameters[$usedParameter][0];\n $paramsDoc .= str_pad($usedParameter, 20).$soapParameters[$usedParameter][1].'<br/>';\n }\n \n $paramsDoc .= '</pre>';\n \n $GLOBALS['server']->register(\n $name,\n $parameters,\n array($name.'Response' => $response),\n $GLOBALS['uri'],\n $GLOBALS['uri'].'#'.$name,\n 'rpc',\n 'encoded',\n \"$doc $paramsDoc\"\n );\n } else {\n $GLOBALS['server']->addFunction($name);\n }\n}", "public function __construct()\n\t{\t\t\n\t\terror_reporting(E_ALL);\n\t\t$this->api = new ApiDirect('data');\n\t}", "function __construct($_PARAMS)\n\t\t{\n\t\t\tparent::__construct($_PARAMS);\n\t\t\t$this->load_api();\n\t\t\t\n\t\t}", "public function createProtocol()\n {\n }", "public function __construct()\n {\n global $API_AUTHORIZATIONS;\n\n //Construct generic API handler\n parent::__construct();\n\n //Define authorizations for current API module\n $this->AUTH = $API_AUTHORIZATIONS[self::MODULE];\n }", "public function __construct($interface, $prefix = '') {\n parent::__construct($interface, $prefix);\n }", "public function __construct($interface, $prefix = '') {\n parent::__construct($interface, $prefix);\n }", "public function register() {}", "abstract public function service();", "public function init();", "public function init();", "public function init();", "public function init();", "public function init();", "public function init();", "public function init();", "public function init();", "public function init();", "public function init();", "public function init();", "public function init();", "public function init();", "public function __construct()\n\t{\n\t\t$this->api = new ApiDirect('fio');\n\n\t}", "public function hook();", "public function Init() : void;", "function rest_api_loaded()\n {\n }", "abstract function do_api_request();", "public function setApi($api);", "public abstract function getApiObjectClass();" ]
[ "0.6499728", "0.62105834", "0.60508", "0.5871631", "0.5857463", "0.57444525", "0.5723107", "0.5674913", "0.56539774", "0.555263", "0.5550741", "0.55499077", "0.5504947", "0.54936004", "0.5485003", "0.5468451", "0.5464812", "0.5438502", "0.54377526", "0.54197794", "0.5410646", "0.5398144", "0.5346281", "0.5339376", "0.5338785", "0.5333747", "0.5316531", "0.5283537", "0.5283537", "0.5283537", "0.5283076", "0.5283076", "0.5283076", "0.5283076", "0.5283076", "0.5283076", "0.5283076", "0.5283076", "0.5262687", "0.5251654", "0.5245854", "0.5241989", "0.5220888", "0.521683", "0.521683", "0.5206585", "0.520587", "0.5203021", "0.5196119", "0.5193753", "0.51906663", "0.51809293", "0.5176384", "0.51545846", "0.5153847", "0.5151895", "0.51420265", "0.5140553", "0.5140553", "0.5140553", "0.51337314", "0.5117727", "0.5117055", "0.5115262", "0.51115733", "0.51036036", "0.51009697", "0.5099072", "0.5098432", "0.50946575", "0.50943965", "0.509427", "0.5090376", "0.5089941", "0.5084133", "0.50829405", "0.50828415", "0.50828415", "0.5065761", "0.5064233", "0.50599563", "0.50599563", "0.50599563", "0.50599563", "0.50599563", "0.50599563", "0.50599563", "0.50599563", "0.50599563", "0.50599563", "0.50599563", "0.50599563", "0.50599563", "0.50396025", "0.50365347", "0.5034635", "0.50322074", "0.5030228", "0.5021523", "0.50209874" ]
0.7473338
0
Get interface from LAS_API
function las_get_interface($name = null) { global $LAS_CFG, $LAS_API; $las_api = $LAS_CFG->wwwroot . '/api'; $report_api = $LAS_CFG->wwwroot . '/report'; las_add_interface( 'GetAPIs', $las_api . '/GetAPIs', LAS_API_MSGTYPE_JSON, LAS_API_MSGTYPE_JSON ); las_add_interface( 'UploadFile', $las_api . '/UploadFile', LAS_API_MSGTYPE_FILE, LAS_API_MSGTYPE_JSON ); las_add_interface( 'GetResult', $las_api . '/GetResult', LAS_API_MSGTYPE_JSON, LAS_API_MSGTYPE_JSON ); las_add_interface( 'GetReportUrl', $report_api . '/GetReportUrl', LAS_API_MSGTYPE_JSON, LAS_API_MSGTYPE_JSON ); $GLOBALS['LAS_API'] = $LAS_API; if ( !empty($name) ) { if ( array_key_exists($name, $LAS_API) ) { return $LAS_API[$name]->url; } } else { return json_encode($LAS_API); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getInterface();", "public function getInterface()\n {\n return $this->interface;\n }", "public function getApi();", "public function getApi();", "public function getApi();", "function las_add_interface($name, $url, $msgtype='json', $rettype='json') {\n\tglobal $LAS_API;\n\n\tif ( $name && $url && $msgtype ) {\n\t\t$entry = new stdClass;\n\n\t\t$entry->url = $url;\n\t\t$entry->msgtype = $msgtype;\n\t\t$entry->rettype = $rettype;\n\n\t\t$LAS_API[$name] = $entry;\n\t}\n}", "function get_application_interface($id)\n{\n global $airavataclient;\n $applicationInterface = null;\n\n try\n {\n $applicationInterface = $airavataclient->getApplicationInterface($id);\n }\n catch (InvalidRequestException $ire)\n {\n print_error_message('<p>There was a problem getting the application interface.\n Please try again later or submit a bug report using the link in the Help menu.</p>' .\n '<p>InvalidRequestException: ' . $ire->getMessage(). '</p>');\n }\n catch (AiravataClientException $ace)\n {\n print_error_message('<p>There was a problem getting the application interface.\n Please try again later or submit a bug report using the link in the Help menu.</p>' .\n '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>');\n }\n catch (AiravataSystemException $ase)\n {\n print_error_message('<p>There was a problem getting the application interface.\n Please try again later or submit a bug report using the link in the Help menu.</p>' .\n '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>');\n }\n\n return $applicationInterface;\n}", "static public function getInterfaces();", "public function getInterfaces() {}", "public function getIface() {\n \n return $this->iface;\n \n }", "public function getApi()\r\n {\r\n return Mage::getSingleton('firstdatae4/api_nvp');\r\n }", "public function getLibraryInterface(): string\n {\n return <<<C\n typedef struct {\n const char* content;\n uint32_t len;\n } tc_string_data_t;\n\n typedef struct {\n } tc_string_handle_t;\n \n typedef void (*tc_response_handler_t)(\n uint32_t request_id,\n tc_string_data_t params_json,\n uint32_t response_type,\n bool finished);\n\n tc_string_data_t tc_read_string(const tc_string_handle_t* string);\n void tc_destroy_string(const tc_string_handle_t* string);\n \n tc_string_handle_t* tc_create_context(tc_string_data_t config);\n void tc_destroy_context(uint32_t context);\n\n void tc_request(\n uint32_t context,\n tc_string_data_t function_name,\n tc_string_data_t function_params_json,\n uint32_t request_id,\n tc_response_handler_t response_handler);\n C;\n }", "public function getApi()\n {\n return Mage::getSingleton('paystation/api_nvp');\n }", "public function getInterfaceCode();", "public function getApiBase();", "public static function getUserAPI();", "public function extractApi();", "public function getInterfaceText();", "public function getInterfaceUri()\n {\n if (static::$isDebug == 1) {\n return 'http://test.show.wepiao.com/api/';\n } elseif(static::$isDebug == 2) {\n return 'http://web.show.wepiao.com/api/';\n }elseif(static::$isDebug == 3) {\n return 'http://www.wepiao.com/api/';\n }\n }", "public function getUserInterface() {\r\n\t\treturn $this->interface;\r\n\t}", "public function get_interface_boot_protocol($interface_obj)\r\n\t{\r\n\t}", "public function getAPI()\n {\n return $this->api;\n }", "public function getHeaderTargetAPI()\r\n\t{\r\n\t\treturn $this->headers[SONIC_HEADER__TARGET_API];\r\n\t}", "public function getApiService();", "public abstract function getApiObjectClass();", "public function getInterface()\n {\n return $this->predis;\n }", "private function requestBridgeInfo() {\n $conn = new ApiConnection;\n $result = $conn->sendGetCmd(\"config\");\n return $result;\n }", "public static function api() {\n return Injector::inst()->get(self::APIServiceName);\n }", "function apiai()\n {\n $this->name = \"apiai\";\n $this->title = \"API.AI\";\n $this->module_category = \"<#LANG_SECTION_OBJECTS#>\";\n $this->api_endpoint = \"https://api.dialogflow.com/v1/\";\n $this->api_version = \"20170712\";\n $this->checkInstalled();\n }", "public function setApi(ApiInterface $api);", "function get_interface_addr($if) {\n\tglobal $config;\n\n\t$ifdescr = convert_friendly_interface_to_friendly_descr($if);\n\n\t/* find out interface name */\n\tif ($ifdescr == \"wan\")\n\t\t$if = get_real_wan_interface();\n\telse\n\t\t$if = $config['interfaces'][$ifdescr];\n\n\treturn $if;\n\n}", "public function getApiCode();", "function H_API() {\n\treturn H_API\\Endpoints::get_instance();\n}", "public function name(): string\n {\n return 'interface';\n }", "public function getApi() {\n return $this->_api;\n }", "public function getInterfaceId()\n {\n return $this->interfaceId;\n }", "public function getInterface() {\n\t\t\treturn $this->implements;\t\n\t\t}", "function get_api_info() {\n $response = $this->api_query(array('mode' => 'api_info'));\n\n if ($response['error']) {\n return false;\n }\n return ($response['data']);\n }", "public function requestApi()\n {\n if (!app()->bound('json-api.inbound')) {\n return null;\n }\n\n return app('json-api.inbound');\n }", "public function getApi() {\n return $this->api;\n }", "private function getInterface() {\n return App::make(WeatherInterface::class);\n }", "public function getOapiVersion()\n {\n\n //the base uri for api requests\n $_queryBuilder = Configuration::$BASEURI;\n \n //prepare query string for API call\n $_queryBuilder = $_queryBuilder.'/oapi/';\n\n //validate and preprocess url\n $_queryUrl = APIHelper::cleanUrl($_queryBuilder);\n\n //prepare headers\n $_headers = array (\n 'user-agent' => 'APIMATIC 2.0'\n );\n\n //call on-before Http callback\n $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl);\n if ($this->getHttpCallBack() != null) {\n $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest);\n }\n\n //and invoke the API call request to fetch the response\n $response = Request::get($_queryUrl, $_headers);\n\n $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body);\n $_httpContext = new HttpContext($_httpRequest, $_httpResponse);\n\n //call on-after Http callback\n if ($this->getHttpCallBack() != null) {\n $this->getHttpCallBack()->callOnAfterRequest($_httpContext);\n }\n\n //Error handling using HTTP status codes\n if (($response->code < 200) || ($response->code > 208)) {\n throw new APIException('Default Response.', $_httpContext);\n }\n\n //handle errors defined at the API level\n $this->validateResponse($_httpResponse, $_httpContext);\n }", "public static function getServiceId(): string\n {\n return RequestInterface::class;\n }", "public function getProtocol() : string;", "public function getType(): string\n {\n return Client::QUERY_API;\n }", "function otomoto_api()\n{\n $api = '329:20db09f3e99a6fba22abdf2c756fe70b';\n return $api;\n}", "protected function getApi()\n {\n return $this->_modelApi;\n }", "public function getApiEndpoint();", "function getOwnInterfaces();", "function I4Web_LMS() {\n return I4Web_LMS::instance();\n}", "public function tampilSapi()\n {\n return $this->db->get('tb_sapi');\n }", "public function getProtocol(): string;", "function initRequestInfo($sapi='') { \n\n}", "public function getContentInterface():string;", "public function call() : GetStatusInterface;", "protected function _getBridge() {}", "public function getServiceInfo() {}", "function returnBuildInterfaceParam() {\n $param = array();\n $param['name'] = 'msg_docman_access';\n $param['func'] = 'docman_access_request';\n $param['action'] = '/plugins/docman/sendmessage.php';\n $param['index'] = 'docman_no_perm';\n return $param;\n }", "public function init()\n {\n try {\n $id = $this->getIdOrName();\n $client = KongClient::getInstance();\n $res = $client->getService($id);\n dd($res);\n } catch (\\Exception $e) {\n dump($e->getMessage());\n }\n }", "public function connectingInterface($data)\n\t{\n\t\t$divisionID = 0;\n\t\t\n\t\textract($data);\n\t\t$data = array(\n\t\t\t'xName'=>$xName,\n\t\t\t'xKey'=>'',\n\t\t\t'xUnicKey'=> ( isset($xUnicKey) ) ? $xUnicKey : '',\n\t\t\t'xParentID'=>$xParentID,\n\t\t\t'xEnabled'=>1,\n\t\t\t'xPriority'=>0,\n\t\t\t'xTemplate'=>( isset($xTemplate) ) ? $xTemplate : '',\n\t\t\t'xLinkDivisionUKey'=> ( isset($xLinkDivisionUKey) ) ? $xLinkDivisionUKey : ''\n\t\t);\n\t\t$divisionID = $this->saveDivision($data);\n\n\t\tif ( empty($xLinkDivisionUKey) )\n\t\t{\n\t\t\t$data = array(\n\t\t\t\t'moduleID'=>$moduleID,\n\t\t\t\t'interface'=>$interface,\n\t\t\t\t'divisionID'=>$divisionID\n\t\t\t);\n\t\t\t$this->setDivisionInterface($data);\n\t\t}\n\n\t\t$data = array(\n\t\t\t'id'=>$xName,\n\t\t\t'lang_id'=>1,\n\t\t\t'value'=>$local_value,\n\t\t\t'group'=>$local_group,\n\t\t\t'subgroup'=>'gen',\n\t\t);\n\t\t$this->saveLocal($data);\n\t\t\n\t\treturn $divisionID;\n\t}", "public function readyForInterface() {}", "function getInterfaces(){\r\n //$this->__requireRole(ROLE_TUTOR);\r\n $res = $this->Setting->find('all', array('conditions'=>'id='.MANAGEMENT_INTERFACE.' OR id='.PLAYER_INTERFACE.' OR id='.OPENVPN_INTERFACE));\r\n $int = (!empty($res))? Set::combine($res, '{n}.Setting.id', '{n}.Setting.value'): false;\r\n $interfaces = ($int)? array('management'=>$int[MANAGEMENT_INTERFACE], 'player'=>$int[PLAYER_INTERFACE], 'openvpn'=>$int[OPENVPN_INTERFACE]) : array('management'=>'eth4', 'player'=>'eth1', 'openvpn'=>'eth0');\r\n return $interfaces;\r\n }", "public function getApi()\n\t{\n\t\t// On first call to Api Login to filmweb.pl\n\t\tif ( ! $this->app['api']->getTotalCalls() ) {\n\t\t\t$this->app['logger']->info( self::getTitle() ); // Introduce itself! :)\n\t\t\t$this->app['api']->call( 'login', array( login::NICKNAME => $this->login, login::PASSWORD => $this->pass ) );\n\t\t}\n\n\t\treturn $this->app['api'];\n\t}", "function apiVersion() {}", "public function getResponse(): ResponseInterface;", "public function getResponse(): ResponseInterface;", "public function me():ResponseInterface;", "public function getName()\n {\n return Language::_('Ispapi.name', true);\n }", "public function getControlledSPS(): EngineInterface;", "public function getAPI(Request $request)\n {\n }", "public function getInstance($interface)\n {\n return null;\n }", "public function apiList();", "abstract protected function interface();", "public function get_api( $name ) {\n\t\tswitch ( $name ) {\n\t\t\tcase 'username':\n\t\t\t\tif ( defined( 'EDGENET_PROD_USERNAME' ) ) {\n\t\t\t\t\treturn EDGENET_PROD_USERNAME;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'secret':\n\t\t\t\tif ( defined( 'EDGENET_PROD_SECRET' ) ) {\n\t\t\t\t\treturn EDGENET_PROD_SECRET;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'data_owner':\n\t\t\t\tif ( defined( 'EDGENET_DATA_OWNER' ) ) {\n\t\t\t\t\treturn EDGENET_DATA_OWNER;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'recipient':\n\t\t\t\tif ( defined( 'EDGENET_RECIPIENT' ) ) {\n\t\t\t\t\treturn EDGENET_RECIPIENT;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'requirement_set':\n\t\t\t\tif ( defined( 'EDGENET_REQUIREMENT_SET' ) ) {\n\t\t\t\t\treturn EDGENET_REQUIREMENT_SET;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'taxonomy_id':\n\t\t\t\tif ( defined( 'EDGENET_TAXONOMY_ID' ) ) {\n\t\t\t\t\treturn EDGENET_TAXONOMY_ID;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( isset( $this->api[ $name ] ) ) {\n\t\t\treturn $this->api[ $name ];\n\t\t}\n\n\t\treturn null;\n\t}", "function afficherInterface2()\r\n {\r\n echo \"<h1>code pour MonInterface2 SURCHARGE ENFANT</h1>\";\r\n }", "function getCellNetwork($if)\n {\n \t$arlines = array();\t\t//Store result of ifconfig command\n \texec('ifconfig '.escapeshellarg($if).' '.'2>&1 ', $arlines);\t//execute ifconfig\n \tdebug('(cell_controller.inc|getCellNetwork()) admin client api command: ifconfig '.escapeshellarg($if).' '.'2>&1 '); \t//DEBUG\n \tdebug('(cell_controller.inc|getCellNetwork()) admin client api command output: $arlines', $arlines); \t\t\t\t\t//DEBUG\n \t\n \t//convert array into single line of text\n \t$str='';\n \tforeach($arlines as $line)\n \t{\n \t\t$str=$str.$line;\n \t}\n \t\n \t//run regex on string and find: IP, Gateway, Subnet\n \t$regex=array();\n \tpreg_match(\"/^([A-z]*\\d)\\s+Link\\s+encap:([A-z-]*)\\s.*\\sinet addr:([0-9.]+)\\s*P-t-P:([0-9.]+)\\s*Mask:([0-9.]+)/ims\", $str, $regex);\n \t\n \t$interface = array();\n \tif( !empty($regex) ){\n \t\t$interface['name'] = $regex[1];\n \t\t$interface['type'] = $regex[2];\n \t\t$interface['ip'] = $regex[3];\n \t\t$interface['broadcast'] = $regex[4];\n \t\t$interface['mask'] = $regex[5];\n \t}\n \tdebug('(cell_controller.inc|getCellNetwork()) $interface array '.$interface); \t\t\t\t//DEBUG\n \t\n \treturn $interface;\n }", "public function proxyToInterface()\n {\n if (!$this->interface) {\n $this->interface = new CallInterface(\n $this->client, $this->pathParams['authId']);\n }\n\n return $this->interface;\n }", "public function get_resource();", "public function get_rest_api_instance() {\n\t\treturn $this->rest_api;\n\t}", "function getApiMethod()\n {\n }", "function getApn()\n {\n \t$sh_args = 'getcellapn'; //admin client command for getting cellular apn\n \t$sh_out = atsexec(escapeshellcmd($sh_args));\t//socket call\n \tdebug('cell_controller.inc|getApn(): admin client api command \"getcellapn\" output: $sh_out', $sh_out); \t//DEBUG\n \tdebug('dbconfig_controller.inc|getDbconfigData: '.$sh_args.' (admin client)', $sh_out); \t//DEBUG\n \t\n \tif($sh_out != 'phpcmd: fail' && $sh_out != 'phpcmd: invalid command')\n \t{\n \t\tdebug('(cell_controller.inc|getApn()) getcellapn command completed.'); \t//DEBUG\n \t\treturn $sh_out;\n \t}\n \telse\n \t{\n \t\tdebug('(cell_controller.inc|getApn()) getcellapn command failed.'); \t//DEBUG\n \t\t//return 'Failed to detect apn';\n \t\treturn false;\n \t}\n }", "function rest_get_server()\n {\n }", "public function requestFromApi() \n {\n $clientApi = new \\GuzzleHttp\\Client([\n \"base_uri\" => \"https://services.mysublime.net/st4ts/data/get/type/\",\n \"timeout\" => 4.0]);\n \n try { \n $response = $clientApi->request(\"GET\", $this->_urlEndPoint);\n if ($response->getStatusCode() == \"200\") {\n $body = $response->getBody();\n $this->_jsonRequestedArr = json_decode($body); \n }\n else { \n $this->_error .= \"Bad status code: . \" . $response->getStatusCode(); \n }\n }\n catch (Exception $exc) {\n $this->_error .= $exc->getMessage();\n }\n\n }", "public function silo_info()\n\t{\n\t\tif( isset( $this->api ) ) {\n\t\t\treturn array('name' => self::SILO_NAME, 'icon' => URL::get_from_filesystem(__FILE__) . '/icon.png');\n\t\t}\n\t\telse {\n\t\t\treturn array();\n\t\t}\n\t}", "private function show_interface()\n {\n $width = $this->width;\n $height = $this->height;\n $source = $this->source;\n\n if (is_file($this->interface_file)) {\n require_once($this->interface_file);\n } else {\n trigger_error($this->errors[\"interface_missing\"] . ($this->interface_file), E_USER_ERROR);\n }\n }", "protected function request()\n\t{\n\t\treturn Phpfox::getLib('request');\t\n\t}", "public function getInterfaces($extension = null, $version = null);", "public function getRequest(): RequestInterface;", "public static function node_interface()\n {\n }", "public function get_iri()\n {\n }", "function getSoftwareLink();", "public function get_device_interfaces_tpl()\n {\n $this->db->from('interfaces__tpl');\n $query = $this->db->get();\n return $query->result_array();\n }", "private function get_api() {\n\n\t\tif ( is_object( $this->api ) ) {\n\t\t\treturn $this->api;\n\t\t}\n\n\t\t// Load KISS Metrics API wrapper class\n\t\trequire_once( $GLOBALS['wc_kissmetrics']->get_plugin_path() . '/includes/class-wc-kissmetrics-api.php' );\n\n\t\t// Init KM API\n\t\treturn $this->api = new WC_KISSmetrics_API( $this->api_key, $this->api_options );\n\t}", "public function get_lookup(/* ... */)\n {\n throw new \\RuntimeException('Method not implemented');\n }", "public function getComponentInterface()\n {\n return 'Nerrad\\\\WPCLI\\\\EE\\\\interfaces\\\\ComponentHas' . $this->type . 'Interface';\n }", "public static function get_api ()\n\t{\n\t\tif (self::$api === NULL)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tself::$api = new Mollie_API_Client;\n\t\t\t\tself::$api->setApiKey(MODULE_PAYMENT_MOLLIE_API_KEY);\n\n\t\t\t\tif (defined(\"PROJECT_VERSION\"))\n\t\t\t\t{\n\t\t\t\t\tself::$api->addVersionString(PROJECT_VERSION);\n\t\t\t\t}\n\n\t\t\t\tself::$api->addVersionString(\"MollieosCommerce/\" . self::VERSION);\n\t\t\t}\n\t\t\tcatch (Mollie_API_Exception $e)\n\t\t\t{\n\t\t\t\t// Without a connection to Mollie we cannot proceed with anything.\n\t\t\t\tdie($e->getMessage());\n\t\t\t}\n\t\t}\n\n\t\treturn self::$api;\n\t}", "public function getInterfaces() {\n\t\t$vnstatInterfaces = [];\n\n\t\tforeach($this->vnstatData['interfaces'] as $interface) {\n\t\t if ($this->vnstatJsonVersion == 1) {\n\t\t\tarray_push($vnstatInterfaces, $interface['id']);\n\t\t } else {\n\t\t\tarray_push($vnstatInterfaces, $interface['name']);\n\t\t }\n\t\t}\n\n\t\treturn $vnstatInterfaces;\n\t}", "protected function LoadInterface($interface)\r\n\t{\r\n\t\t$strBuilder = new StringBuilder();\r\n\t\t$template = file($interface);\r\n\r\n\t\tforeach ($template as $line) \r\n\t\t{\r\n\t\t\t$strBuilder->Append($line);\r\n\t\t}\r\n\t\t\r\n\t\t$return = $strBuilder->toString();\r\n\t\t\r\n\t\tunset($strBuilder);\r\n\t\tunset($template);\r\n\t\t\r\n\t\treturn $return;\r\n\t}", "public function getProtocolName() : string;", "public function getFromRequest(ServerRequestInterface $request);" ]
[ "0.7175563", "0.62512624", "0.6231569", "0.6231569", "0.6231569", "0.5970218", "0.5890664", "0.5888556", "0.5847565", "0.58154094", "0.5804445", "0.5797872", "0.5750256", "0.57447606", "0.5722948", "0.56863195", "0.5651915", "0.5639321", "0.56219655", "0.56097263", "0.5604869", "0.56030786", "0.5554486", "0.5550464", "0.55252457", "0.55103046", "0.5502532", "0.5447041", "0.54456", "0.544229", "0.54356694", "0.54313153", "0.54307574", "0.5404444", "0.54020023", "0.53917354", "0.53879267", "0.5385662", "0.53678244", "0.534683", "0.5316291", "0.5292977", "0.5285494", "0.5283661", "0.52573335", "0.52529216", "0.52280515", "0.52150863", "0.5212051", "0.51957923", "0.51885945", "0.5153888", "0.5145125", "0.51131976", "0.51022595", "0.50943357", "0.5084911", "0.50813955", "0.50778615", "0.5074234", "0.50737476", "0.5060353", "0.5051747", "0.50438434", "0.50404906", "0.50404906", "0.50294834", "0.5022157", "0.50196165", "0.5017843", "0.5017723", "0.50153863", "0.5012814", "0.5011413", "0.499756", "0.49966127", "0.49965855", "0.49860218", "0.49821076", "0.4980374", "0.4973209", "0.4970872", "0.49658445", "0.4964118", "0.49581733", "0.495045", "0.49437076", "0.49375045", "0.49359825", "0.49353066", "0.49285808", "0.49278542", "0.4917249", "0.49121958", "0.49073148", "0.49067503", "0.49030086", "0.48994663", "0.4897841", "0.48825887" ]
0.7418081
0
Send message to Message Queue server
function sendMessageToQueue($messageObj){ global $LAS_CFG; $daemon_host = $LAS_CFG->las_daemon_server['host']; $daemon_port = $LAS_CFG->las_daemon_server['port']; $daemon_url = 'tcp://'.$daemon_host.':'.$daemon_port; $client_timeout = $LAS_CFG->las_daemon_server['timeout']; $exchange_name = $LAS_CFG->message_server['taskQueue']; $new_routing_key = $exchange_name . $messageObj->routing_key; $messageObj->routing_key = $new_routing_key; // Convert JSON message to String $message = json_encode($messageObj); $server = new LasManager($daemon_url); return $server->clientSendMessage($message, $client_timeout); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function send_message ($message)\t\t\t\t\n\t{\n\t\t$con = new Stomp('tcp://'.ACTIVEMQ_SERVER.':61613');\n\t\t$con->connect();\n\t\t$con->send(\"/queue/s3backup\", $message);\n\t\n\t}", "public function send($message);", "public function send($message);", "public function send($message);", "public function send($message);", "public function sendMessage($queueId, $message, $options = null);", "public function send_msg($message)\r\n\t{\r\n\t\t$this->server->send_msg($this->channel, $message);\r\n\t}", "private function send_msg() {\r\n }", "public function send($message)\n {\n }", "public function send(){\n\t\t\n\t\t$database = new Database();\n\t\t$query = $database->selectOne('message_queues', array('id',\n\t\t\t\t\t\t\t\t\t 'is_executed','executed_at','message','cellphone'), \n\t\t\t\t\t\t\t\t\t ' is_executed=0 ');\n\t\t$exec = $database->query($query);\n\t\tif ($exec) {\n\t\t\t$record = $database->fetchArray($exec);\n\t\t\t$response = $this->sendMessage($database, $record);\n\n\t\t\treturn json_encode(array('status' => $response['status'], 'message' => $response['message']));\n\t\t}\n\n\t}", "public function queue() {\n\t\t$this->prepareMessage();\n\t\t$this->queueRepository->add($this->toArray());\n\t}", "public static function sendMessage($message) {\n $context = new \\ZMQContext();\n $socket = $context->getSocket(\\ZMQ::SOCKET_PUSH, 'my pusher');\n $socket->connect(\"tcp://localhost:5555\");\n $socket->send($message);\n }", "public abstract function send(Hermes_Message_Data $message);", "private function sendMessage()\n {\n try\n {\n $request = $_POST;\n\n $uid = userid();\n\n if (!$uid)\n throw_error_msg( lang(\"you_not_logged_in\") ) ;\n\n if( !isset($request['username']) || $request['username']==\"\" )\n throw_error_msg(\"username not provided\");\n\n if( !isset($request['subject']) || $request['subject']==\"\" )\n throw_error_msg(\"subject not provided\");\n\n if( !isset($request['content']) || $request['content']==\"\" )\n throw_error_msg(\"content not provided\");\n\n $array['is_pm'] = true;\n $array['from'] = $uid;\n $array['to'] = $request['username'];\n $array['subj'] = mysql_clean($request['subject']);\n $array['content'] = mysql_clean($request['content']);\n\n global $cbpm;\n $rs = $cbpm->send_pm($array);\n\n if( error() )\n {\n throw_error_msg(error('single')); \n }\n\n if( msg() )\n {\n $data = array('code' => \"200\", 'status' => \"success\", \"msg\" => \"message sent successfully\", \"data\" => array());\n $this->response($this->json($data));\n } \n }\n catch(Exception $e)\n {\n $this->getExceptionDelete($e->getMessage());\n } \n\n }", "public function sendMessage()\n {\n $userId = auth()->user()->id;\n\n // Save the message\n Message::create([\n 'room_id' => $this->roomId,\n 'user_id' => $userId,\n 'message' => $this->message,\n ]);\n\n // Remove the value of the message after saving\n $this->message = \"\";\n\n // Prompt the server that we sent a message\n $this->dispatchBrowserEvent('chat-send-message', [\n 'room_id' => $this->roomId,\n 'user_id' => $userId,\n ]);\n }", "function send_message_to_queue($queue_url, $message_body, $region, $queue_name)\n {\n $sqs_client = new Aws\\Sqs\\SqsClient([\n 'version' => 'latest',\n 'region' => \"$region\"\n ]);\n\n try\n {\n $sqs_client->sendMessage([\n 'QueueUrl' => \"$queue_url\",\n 'MessageBody' => \"$message_body\"\n ]);\n }\n catch(\\Aws\\Sqs\\Exception\\SqsException $sqs_exception)\n {\n echo \"Failed to send message to queue: $queue_name, \" . $sqs_exception->getMessage() . \"\\n\";\n exit(1);\n }\n }", "public function send();", "public function send();", "public function send();", "public function send();", "public function send();", "public function send();", "public function send();", "public function send();", "public function send();", "public function send();", "public function send();", "public function send() {}", "public function send() {}", "public function send() {}", "public function send() {}", "public function send() {}", "public function publish($message, AbstractQueue $queue) \n {\n $queue->addMessage($message);\n }", "public abstract function sendMessage();", "function ts3client_requestSendServerTextMsg($serverConnectionHandlerID, $message) {}", "private function send(): void\n {\n $data = [\n 'code' => $this->status,\n 'message' => $this->message,\n 'datetime' => Carbon::now()\n ];\n\n $config = config(\"tebot.$this->channelConfig\");\n\n $data['title'] = $this->title . ' ' . $config['name'];\n\n if (!empty($this->detail)) $data['detail'] = json_encode($this->detail);\n\n Http::withHeaders(['x-api-key' => $config['key']])->post($config['url'] . '/api/message', $data);\n }", "function sendChannelMessage($message)\n\t{\n\t\t$this->sendMessage($this->channel, $message);\n\t}", "public function sendMessage($msgdata)\n\t{\n\t\ttry {\n\t\t\t$this->channel->queue_declare(MQ::MAILQUEUE, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n\t\t\t$this->channel->queue_declare(MQ::SMSQUEUE, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n\t\t\t$this->channel->queue_declare(MQ::CONTACTCACHEINITIATE, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n\t\t\t$this->channel->queue_declare(MQ::INVALIDATECACHE, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n\t\t\t$this->channel->queue_declare(MQ::AGENT_NOTIFICATIONSQUEUE, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n\t\t\t$this->channel->queue_declare(MQ::BUFFER_INSTANT_NOTIFICATION_QUEUE, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n\t\t\t$this->channel->queue_declare(MQ::DELETE_RETRIEVE_QUEUE, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n\t\t\t$this->channel->queue_declare(MQ::UPDATE_SEEN_QUEUE, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n\t\t\t$this->channel->queue_declare(MQ::UPDATE_FEATURED_PROFILE_QUEUE, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n\n\t\t\t$this->channel->queue_declare(MQ::CHAT_MESSAGE, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n\n\t\t\t$this->channel->queue_declare(MQ::DUPLICATE_LOG_QUEUE, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n\t\t\t$this->channel->queue_declare(MQ::PROFILE_CACHE_Q_DELETE, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n $this->channel->queue_declare(MQ::VIEW_LOG, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n\t\t\t$this->channel->queue_declare(MQ::SCREENING_QUEUE, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n\t\t\t$this->channel->queue_declare(MQ::LOGGING_QUEUE, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n $this->channel->queue_declare(MQ::DISC_HISTORY_QUEUE, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE);\n\n $this->channel->queue_declare(MQ::SCRIPT_PROFILER_Q, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE); \n\t\t\t$this->channel->queue_declare(MQ::WRITE_MSG_queueRightNow);\n\t\t\t$this->channel->exchange_declare(MQ::WRITE_MSG_exchangeRightNow, 'direct');\n\t\t\t$this->channel->queue_bind(MQ::WRITE_MSG_queueRightNow, MQ::WRITE_MSG_exchangeRightNow);\n\t\t\t$this->channel->queue_declare(MQ::WRITE_MSG_queueDelayed5min, MQ::PASSIVE, MQ::DURABLE, MQ::EXCLUSIVE, MQ::AUTO_DELETE, true, \n\t\t\t\t\tarray(\n\t\t\t\t\t\t\"x-dead-letter-exchange\" => array(\"S\", MQ::WRITE_MSG_exchangeRightNow),\n\t\t\t\t\t\t\"x-message-ttl\" => array(\"I\", MQ::DELAY_WRITEMSG*1000))\n\t\t\t\t\t);\n\t\t\t$this->channel->exchange_declare(MQ::WRITE_MSG_exchangeDelayed5min, 'direct');\n\t\t\t$this->channel->queue_bind(MQ::WRITE_MSG_queueDelayed5min, MQ::WRITE_MSG_exchangeDelayed5min);\n\n\t\t} catch (Exception $exception) {\n\t\t\t$str = \"\\nRabbitMQ Error in producer, Unable to\" . \" declare queues : \" . $exception->getMessage() . \"\\tLine:\" . __LINE__;\n\t\t\tRabbitmqHelper::sendAlert($str, \"default\");\n\t\t\treturn;\n\t\t}\n\t\t$data = json_encode($msgdata);\n\t\t$msg = new AMQPMessage($data, array('delivery_mode' => MQ::DELIVERYMODE));\n\t\t$process = $msgdata['process'];\n\t\ttry {\n\t\t\tswitch ($process) {\n\t\t\t\tcase \"MAIL\":\n\t\t\t\t\t$this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::MAILQUEUE, MQ::MANDATORY, MQ::IMMEDIATE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"SMS\":\n\t\t\t\t\t$this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::SMSQUEUE, MQ::MANDATORY, MQ::IMMEDIATE);\n\t\t\t\t\tbreak;\n\t\t\t\t\t$this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::SMSQUEUE, MQ::MANDATORY, MQ::IMMEDIATE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"GCM\":\n\t\t\t\t\t$this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::GCMQUEUE, MQ::MANDATORY, MQ::IMMEDIATE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"AGENT_NOTIFICATIONS\":\n\t\t\t\t\t$this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::AGENT_NOTIFICATIONSQUEUE, MQ::MANDATORY, MQ::IMMEDIATE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"CACHE\":\n\t\t\t\t\t$data = $msgdata['data'];\n\t\t\t\t\t$msg = new AMQPMessage($data, array('delivery_mode' => MQ::DELIVERYMODE));\n\t\t\t\t\t$this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::CONTACTCACHEINITIATE, MQ::MANDATORY, MQ::IMMEDIATE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"INVALIDATE\":\n\t\t\t\t\t$data = $msgdata['data'];\n\t\t\t\t\t$msg = new AMQPMessage($data, array('delivery_mode' => MQ::DELIVERYMODE));\n\t\t\t\t\t$this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::INVALIDATECACHE, MQ::MANDATORY, MQ::IMMEDIATE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"BUFFER_INSTANT_NOTIFICATIONS\" :\n\t\t\t\t\t$this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::BUFFER_INSTANT_NOTIFICATION_QUEUE, MQ::MANDATORY, MQ::IMMEDIATE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"DELETE_RETRIEVE\":\n\t\t\t\t\t$this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::DELETE_RETRIEVE_QUEUE, MQ::MANDATORY, MQ::IMMEDIATE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"CHATROSTERS\":\n\t\t\t\t\tif (JsConstants::$jsChatFlag >= 1) {\n\t\t\t\t\t\t$data = $msgdata['data'];\n\t\t\t\t\t\t$msg = new AMQPMessage(json_encode($data), array('delivery_mode' => MQ::DELIVERYMODE));\n\t\t\t\t\t\t$this->channel->basic_publish($msg, MQ::CHATEXCHANGE, \"roster\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"UPDATE_SEEN\":\n\t\t\t\t\t$this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::UPDATE_SEEN_QUEUE, MQ::MANDATORY, MQ::IMMEDIATE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"UPDATE_FEATURED_PROFILE\":\n\t\t\t\t\t$this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::UPDATE_FEATURED_PROFILE_QUEUE, MQ::MANDATORY, MQ::IMMEDIATE);\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase \"USERCREATION\":\n\t\t\t\t\tif (JsConstants::$jsChatFlag >= 1) {\n\t\t\t\t\t\t$data = $msgdata['data'];\n\t\t\t\t\t\t$msg = new AMQPMessage($data, array('delivery_mode' => MQ::DELIVERYMODE));\n\t\t\t\t\t\t$this->channel->basic_publish($msg, MQ::CHATEXCHANGE, \"profile_created\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"USERLOGIN\":\n\t\t\t\t\tif (JsConstants::$jsChatFlag >= 1) {\n\t\t\t\t\t\t$data = $msgdata['data'];\n\t\t\t\t\t\t$msg = new AMQPMessage($data, array('delivery_mode' => MQ::DELIVERYMODE));\n\t\t\t\t\t\t$this->channel->basic_publish($msg, MQ::CHATEXCHANGE, \"profile_created\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"DUPLICATE_LOG\":\n\t\t\t\t\t $this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::DUPLICATE_LOG_QUEUE,MQ::MANDATORY,MQ::IMMEDIATE);\n\t\t\t\t\t break;\n\t\t\t\tcase \"USER_DELETE\":\n\t\t\t\t\tif (JsConstants::$jsChatFlag >= 1) {\n\t\t\t\t\t\t$data = $msgdata['data'];\n\t\t\t\t\t\t$msg = new AMQPMessage($data, array('delivery_mode' => MQ::DELIVERYMODE));\n\t\t\t\t\t\t$this->channel->basic_publish($msg, MQ::CHATEXCHANGE, \"profile_deleted\");\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\t\t\t\t\n\t\t\t\tcase \"CHATMESSAGE\":\n\t\t\t\t\t$this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::CHAT_MESSAGE, MQ::MANDATORY, MQ::IMMEDIATE);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ROSTERCREATION\":\n\t\t\t\t\t$data = $msgdata['data'];\n\t\t\t\t\t$msg = new AMQPMessage($data, array('delivery_mode' => MQ::DELIVERYMODE));\n\t\t\t\t\t$this->channel->basic_publish($msg, MQ::CHATEXCHANGE,\"roster_created\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"DUPLICATE_LOG\":\n $this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::DUPLICATE_LOG_QUEUE,MQ::MANDATORY,MQ::IMMEDIATE);\n break;\n\n\t\t\t\tcase MQ::PROCESS_PROFILE_CACHE_DELETE:\n $this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::PROFILE_CACHE_Q_DELETE,MQ::MANDATORY,MQ::IMMEDIATE);\n\t\t\t\t\tbreak;\n case \"ViewLogQueue\":\n $this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::VIEW_LOG,MQ::MANDATORY,MQ::IMMEDIATE);\n break;\n case MQ::SCREENING_Q_EOI:\n \t$this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::SCREENING_QUEUE, MQ::MANDATORY, MQ::IMMEDIATE);\n \tbreak;\n\t\t\t\tcase MQ::WRITE_MSG_Q:\n\t\t\t\t\t$this->channel->basic_publish($msg, MQ::WRITE_MSG_exchangeDelayed5min);\n\t\t\t\t\tbreak;\n case 'LOGGING_TRACKING':\n \t$this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::LOGGING_QUEUE, MQ::MANDATORY, MQ::IMMEDIATE);\n \tbreak;\n\n case 'DISCOUNT_HISTORY':\n $this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::DISC_HISTORY_QUEUE, MQ::MANDATORY, MQ::IMMEDIATE);\n break;\n case MQ::SCRIPT_PROFILER_PROCESS:\n $this->channel->basic_publish($msg, MQ::EXCHANGE, MQ::SCRIPT_PROFILER_Q,MQ::MANDATORY,MQ::IMMEDIATE);\n break;\n\n\t\t\t}\n\t\t} catch (Exception $exception) {\n\t\t\t$str = \"\\nRabbitMQ Error in producer, Unable to publish message : \" . $exception->getMessage() . \"\\tLine:\" . __LINE__;\n\t\t\tRabbitmqHelper::sendAlert($str, \"default\");\n\t\t\treturn;\n\t\t}\n\t}", "abstract public function send($message, $msisdn);", "public function doSend(IMessage $Message);", "public function send($message, $to_phone);", "public function message(string $msg, array $params = []): void\r\n {\r\n $sendMessage = new AMQPMessage($msg, $params);\r\n $this->channel->basic_publish($sendMessage, '', $this->queue);\r\n }", "public function send(mixed $message): void;", "public function send()\n {\n }", "abstract function send();", "public function send(Message $message, Connection $connection);", "abstract function doSend();", "public function send($destination, Message $message);", "function send()\n {\n try{\n $client = new Client();\n $response = $client->request('POST', $this->base_url_SendSMS, [\n 'form_params' => [\n 'Userid' => $this->username,\n 'pwd' => $this->password,\n 'APIKEY' => $this->apikey,\n 'MSG' => $this->msgtext,\n 'FROM' => $this->from,\n 'To' => $this->to,\n ]\n ]);\n\n echo $response->getStatusCode(); // 200\n $response->getReasonPhrase(); // OK\n $response->getProtocolVersion(); // 1.1\n }\n catch(\\GuzzleHttp\\Exception\\ClientException $e){\n echo $e->getMessage();\n }\n catch(ErrorException $e){\n echo $e->getMessage();\n }\n }", "function publish_message($msg, $topic, $server, $port, $keepalive) {\n\t\t\t$client = new Mosquitto\\Client();\n\t\t\t$client->onConnect('connect');\n\t\t\t$client->onDisconnect('disconnect');\n\t\t\t$client->onPublish('publish');\n\t\t\t$client->connect($server, $port, $keepalive);\n\t\n\t\t\ttry {\n\t\t\t\t$client->loop();\n \t\t\t\t$mid = $client->publish($topic, $msg);\n\t\t\t\t\n\t\t\t\t}catch(Mosquitto\\Exception $e){\n\t\t\t\t\t\techo 'Exception'; \n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t $client->disconnect();\n\t\t unset($client);\t\t\t\t\t \n\t\t}", "public function send(Message $message)\n {\n $client = $this->getHttpClient();\n\n $url = $this->api_endpoint . $this->token;\n\n $client->post($url, array('json' => $this->buildMessage($message)));\n }", "public function send(WorkItem $message);", "protected function send() {}", "public function send()\n {\n if (!isset($this->message))\n {\n return FALSE;\n }\n\n $this->sqs_client->sendMessage([\n 'MessageGroupId'\t\t\t=> '1',\n 'MessageDeduplicationId'\t=> mt_rand(),\n 'QueueUrl' \t\t\t\t=> SQS_VIDEO_URL,\n 'MessageBody' \t\t\t\t=> json_encode($this->message)\n ]);\n\n return TRUE;\n }", "public function sendMessage(ShortMessageContract $message);", "public function sendMessage(){\n\n\n }", "public function send($message)\n {\n $this->stream_wrapper->clear();\n Util::encode($message, $this->stream_wrapper);\n $this->stream->write(pack('N', strlen($this->stream_wrapper->data)));\n $this->stream->write($this->stream_wrapper->data);\n $this->stream->flush();\n }", "public function send()\n {\n }", "public function send()\n {\n }", "public function send()\n {\n }", "function esms_services_send_message($message, $number, $type) {\n return esms_send_message($message, $number, $type);\n}", "public function send_queue()\n\t{\n\t\t$sql = 'SELECT *\n\t\t\t\tFROM ' . SQL_PREFIX . 'notify\n\t\t\t\tORDER BY notify_time';\n\t\t$result = Fsb::$db->query($sql, 'notify_');\n\t\tif ($row = Fsb::$db->row($result))\n\t\t{\n\t\t\t// Suppression des elements directement, afin d'eviter un double envoie\n\t\t\t$sql = 'DELETE FROM ' . SQL_PREFIX . 'notify';\n\t\t\tFsb::$db->query($sql);\n\t\t\tFsb::$db->destroy_cache('notify_');\n\n\t\t\t// Envoie du message\n\t\t\tdo\n\t\t\t{\n\t\t\t\t$this->method = (isset($this->ext[$row['notify_method']])) ? $row['notify_method'] : NOTIFY_MAIL;\n\t\t\t\t$this->subject = $row['notify_subject'];\n\t\t\t\t$this->body = $row['notify_body'];\n\t\t\t\t$this->bcc = explode(\"\\n\", $row['notify_bcc']);\n\t\t\t\t$return = $this->send(false);\n\t\t\t\t$this->reset();\n\n\t\t\t\t// En cas d'echec du message on le reinsere dans la base de donnee\n\t\t\t\tif (!$return && $row['notify_try'] < Notify::MAX_TRY)\n\t\t\t\t{\n\t\t\t\t\t$row['notify_try']++;\n\t\t\t\t\tunset($row['notify_id']);\n\t\t\t\t\tforeach ($row AS $k => $v)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (is_numeric($k))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tunset($row[$k]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tFsb::$db->insert('notify', $row, 'INSERT', true);\n\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile ($row = Fsb::$db->row($result));\n\t\t\tFsb::$db->query_multi_insert();\n\t\t}\n\t\tFsb::$db->free($result);\n\t}", "public function send() {\r\n\t\t\t$this->sent = true;\r\n\t\t}", "public function send($message, $toUser)\r\n {\r\n echo \"站内短消息形式发送:{$message} 给 {$toUser}\\n\";\r\n }", "function send($to,$subject,$text) {\n try{\n $conn = new AMQPConnection($this->rabbitMQConf['host'], \n $this->rabbitMQConf['port'],\n $this->rabbitMQConf['user'],\n $this->rabbitMQConf['pass']);\n\n $channel = $conn->channel();\n\n $channel->access_request($this->rabbitMQConf['virtualHost'], false, false, true, true);\n\n $mailData = array(\"to\"=>$to,\n \"subject\"=>$subject,\n \"text\"=>$text);\n\n $mailDataToJson = json_encode($mailData);\n \n $msg = new AMQPMessage($mailDataToJson, array('content_type' => 'text/plain'));\n $channel->basic_publish($msg, $this->queueConf['exchange']);\n\n $channel->close();\n $conn->close();\n \n return true;\n }\n catch(Exception $e) {\n echo \"Something went wrong \".$e->getMessage();\n }\n\n }", "function msgsrv_send ($target, $cmd, $content, $link) {}", "function send ($destination, $msg, $properties = null)\n {\n if ( $msg instanceOf StompFrame )\n {\n $msg->headers['destination'] = $destination;\n $this->writeFrame($msg);\n } else\n {\n $headers = array();\n if ( isset($properties) )\n {\n foreach ( $properties as $name => $value )\n {\n $headers[$name] = $value;\n }\n }\n $headers['destination'] = $destination;\n $this->writeFrame(new StompFrame('SEND', $headers, $msg));\n }\n }", "public function writeMessage ()\n {\n $authObject = new Authenticate();\n $authObject->validateWriteMessage($_GET[\"controller\"]);\n \n $body = $_POST[\"body\"];\n $subject = $_POST[\"subject\"];\n \n $sentto = $_POST[\"sentto\"];\n \n $this->createUser();\n \n if (($this->_objUser->messageSend($body, $subject, $sentto)) == false) {\n $this->setCustomMessage(\"ErrorMessage\", \"Problem in sending message\");\n } else {\n $this->setCustomMessage(\"SuccessMessage\", \"Message sent successfully\");\n }\n }", "public function sendMessage()\n {\n\n try {\n parent::send($this->_message);\n } catch (\\Exception $e) {\n throw new \\Magento\\Framework\\Exception\\MailException(new \\Magento\\Framework\\Phrase($e->getMessage()), $e);\n }\n }", "public function sendMessage(BotMessage $message): void;", "function send($mobile, $message);", "function sendMessageToClient( $MsgSock, $Message ) {\n\t$Size = strlen( $Message );\n\n\tif ( socket_write( $MsgSock, $Message, $Size ) < $Size )\n\t\tob_flush();\n\n\tif ( $GLOBALS[ 'FLAG_DEBUG' ] ) {\n\t\tprint( $GLOBALS[ 'PREFIX_DEBUG' ] . $Message );\n\t}\n\n\treturn;\n}", "function ts3client_requestSendChannelTextMsg($serverConnectionHandlerID, $message, $targetChannelID) {}", "public function sendAction()\n {\n $id = (int) $this->_request->getParam('id', 0);\n $userDto = $this->getDaoUser()->fetchOneWithAvatar('user.id',$id);\n \n if($this->_request->isPost())\n { \n $result = $this->getBusiness()->sendMessage($userDto, $this->_request->getPost('text'));\n \n $url = Qsoft_Helper_Url::generate($this->_request->getControllerName());\n $backLink = '<a href=\"' . $url . '\">' . $this->view->translate('Back to list') . '</a>';\n \n if($result['status'] === true) {\n $this->noticeMessage('Sent message successfully. %s', $backLink);\n } else {\n $this->noticeMessage('Cannot send message, check support user %s', $backLink); \n }\n } \n \n if ($id != 0 AND !$userDto) {\n $this->_redirect($this->_request->getControllerName());\n }\n \n $this->view->item = $userDto; \n }", "protected function send($msg, ConnectionInterface $to){\n if(is_array($msg)){\n $msg = json_encode($msg);\n }\n $to->send($msg);\n }", "function SendMessage($message, $object, $id, $from_public = false);", "public function send($message, $async = true);", "public function send(int $debotHandle, string $message): void\n {\n $this->tonClient->request(\n 'debot.send',\n [\n 'debot_handle' => $debotHandle,\n 'message' => $message,\n ]\n )->wait();\n }", "private function send_message($msg)\n\t{\n\t\t\tforeach ($this->clients as $changed_socket) {\n\t\t\t\t\t@socket_write($changed_socket, $msg, strlen($msg));\n\t\t\t}\n\t\t\treturn true;\n\t}", "public function send($message, Zend_Queue $queue=null)\n {\n if ($queue === null) {\n $queue = $this->_queue;\n }\n\n if (!$this->isExists($queue->getName())) {\n require_once 'Zend/Queue/Exception.php';\n throw new Zend_Queue_Exception('Queue does not exist:' . $queue->getName());\n }\n\n $message = (string) $message;\n $data = array(\n 'message_id' => md5(uniqid(rand(), true)),\n 'handle' => null,\n 'body' => $message,\n 'md5' => md5($message),\n );\n\n $result = $this->_pheanstalk->putInTube($queue->getName(), $message);\n if ($result === false) {\n require_once 'Zend/Queue/Exception.php';\n throw new Zend_Queue_Exception('failed to insert message into queue:' . $queue->getName());\n }\n\n $options = array(\n 'queue' => $queue,\n 'data' => $data,\n );\n\n $classname = $queue->getMessageClass();\n if (!class_exists($classname)) {\n require_once 'Zend/Loader.php';\n Zend_Loader::loadClass($classname);\n }\n return new $classname($options);\n }", "function send_message_to_player( $socket, $data ) {\r\n\tif($socket->process == true) {\r\n\t\t$obj = json_decode( $data );\r\n\t\t$user_id = $obj->user_id;\r\n\t\t$message = $obj->message;\r\n\t\t\r\n\t\t$player = id_to_player( $user_id, false );\r\n\t\tif( isset($player) ) {\r\n\t\t\t$player->write( 'message`' . $message );\r\n\t\t}\r\n\t\t$socket->write('{\"status\":\"ok\"}');\r\n\t}\r\n}", "public function sendMessage($user_id, $message)\n {\n $this->_Database->query(\"INSERT INTO chat (chat_id, user_id, message, time_posted) VALUES ('', :user_id, :message, CURRENT_TIMESTAMP)\", array(':user_id' => $user_id, ':message' => $message));\n }", "public function send($message, $callback);", "public function actionSendMessage() {\n\n // get data, sent by client\n $data = Yii::app()->request->getPost('chat', array());\n\n // try to store message\n $model = new Chat();\n $result = $model->storeMessage($data);\n\n // prepare return array, set status\n $response = array(\n 'status' => (bool)$result\n );\n\n // encode return array\n echo json_encode($response);\n\n // force app to end\n Yii::app()->end();\n\t}", "function send_sms()\n\t{\n\t\t$config['functions']['send_sms'] = array('function' => 'Xmlrpc.rpc_send_sms');\n\t\t$this->xmlrpcs->initialize($config);\n\t\t$this->xmlrpcs->serve();\n\t}", "public function sendEmail()\n {\n SendEmailMessage::dispatch($this->address, $this->messageString);\n }", "public function handleSendMessage() {\n\t\t$json = file_get_contents(\"php://input\"); //vytánutí všech dat z POST požadavku - data ve formátu JSON\n\t\t$data = Json::decode($json); //prijata zprava dekodovana z JSONu\n\t\t$user = $this->getPresenter()->getUser();\n\t\t$addMessage = $this->addMessage($data, $user);\n\t\tif (!empty($addMessage)) {\n\t\t\t$this->sendRefreshResponse($data->lastid);\n\t\t}\n\t}", "public function actionSingle() {\n// $conn = $amqp->Connection();\n// $channel = $amqp->Channel($conn);\n// $amqp->Exchange($conn, $channel);\n// $amqp->Queue($channel);\n }", "public function send() {\n return $this->getAdapter()->send($this->getMessage());\n }", "public function index()\n {\n// $sms= $AT->sms();\n// $sms->send([\n// 'to' => '0704522671',\n// 'message' => 'It worked'\n//\n// ]);\n\n $smsJob = (new SendSmsJob())->delay(Carbon::now()->addSeconds(3));\n dispatch($smsJob);\n\n echo 'message sent';\n\n }", "private function sendRequest( string $message ) : void\n {\n if( !socket_sendto($this->socket, $message, strlen($message), 0, $this->host, $this->port ) )\n {\n throw new Exceptions\\SocketException( $this->socketLastError() );\n }\n }", "public function sendMessage($message)\n\t{\n\t\tglobal $log;\n\n\t\tif (!empty($this->channel)) {\n\t\t\t$log->print(date('H:i:s', time()));\n\t\t\t$log->println(' > ' . $message, COLOR_BOT_MESSAGE);\n\t\t\t$this->send('PRIVMSG #' . $this->channel . ' : ' . $message);\n\t\t} else\n\t\t\techo '[ERROR] No channel were joined' . PHP_EOL;\n\t}", "private function sendMessage() {\n\t\t$valid = true;\n\t\t\n\t\techo $recipients = $this->_requestParam('recipients');exit;\n\t\t$subjecttext = $this->_requestParam('subject');\n\t\t$bodytext = $this->_requestParam('message');\n\t\t$sendtime = $this->_requestParam('sendtime');\n\t\t$timezone = $this->_requestParam('timezone');\n\t\t\n\t\t// Cleanup send time\n\t\tif ($sendtime) {\n\t\t\t$tparts = str_split($sendtime, 2);\n\t\t\t$sendtime = $tparts[0].$tparts[1] . '-' . $tparts[2] . '-' . $tparts[3] . ' ' . $tparts[4] . ':' . $tparts[5] . ':00';\n\t\t}\n\t\t\n\t\t// Not using this at the moment, so don't want anyone to access it\n\t\t//$folder = $this->_request->getParam('id');\n\t\t//$loadby = $this->_request->getParam('field');\n\t\t$folder = false;\n\t\t$loadby = false;\n\t\t\n\t\t// Folder is optional (at the moment...)\n\t\tif ($folder) {\n\t\t $folder = new Application_Model_Folder($this->apiuser, $folder, $loadby);\n\t\t \n\t\t if ($folder->isValid()) {\n\t\t // Get subscribers in this folder\n \t\t\t$subscribers = $folder->getSubscribers();\n \t\t\t\n \t\t\t// TODO: Come up with a better way to pull phone #'s out of a folder's subscriber list\n \t\t\tforeach ($subscribers as $subscriber) {\n \t\t\t $recipients[] = $subscriber['phonenumber'];\n \t\t\t}\n\t\t } else {\n\t\t $valid = false;\n\t\t\t\t$this->setError($folder->getError(), 500);\n\t\t }\n\t\t}\n\t\t\n\t\t// Validate and send\n\t\tif ($valid) {\n \t\tif ($recipients) {\n \t\t\tif ($bodytext) {\n \t\t\t\t$message = new Application_Model_Message($this->apiuser);\n \t\t\t\t$bodytext = urldecode($bodytext);\n \t\t\t\t$subjecttext = urldecode($subjecttext);\n \t\t\t\t\n \t\t\t\t// Build the message with a subject if there is one.\n \t\t\t\t$msg = $subjecttext ? $subjecttext.': '.$bodytext : $bodytext;\n \t\t\t\t\n \t\t\t\t// Queue it up for delivery\n \t\t\t\t$return = $message->queue($msg, $recipients, $sendtime, $timezone);\n \t\t\t\t\n \t\t\t\tif ($return) {\n \t\t\t\t\t$this->setOutputParam('status', true);\n \t\t\t\t\t$this->setOutputParam('message', 'Message successfully sent.');\n \t\t\t\t} else {\n \t\t\t\t\t$this->setError($message->getError(), 500);\n \t\t\t\t}\n \t\t\t} else {\n \t\t\t\t$this->setError('Message is required.', 500);\n \t\t\t}\n \t\t} else {\n \t\t\t$this->setError('At least one recipient is required.', 500);\n \t\t}\n\t\t}\n\t}", "function sendUserMessage($user, $message)\n\t{\n\t\t$this->sendMessage($user, $message);\n\t}", "public function send()\n\t{\n\t\t$message = $this->message ?: ucwords($this->getSystemUser()).' ran the ['.$this->task.'] task.';\n\n\t\t$payload = ['text' => $message, 'channel' => $this->channel];\n\n Request::post(\"https://{$this->team}.slack.com/services/hooks/incoming-webhook?token={$this->token}\")->sendsJson()->body($payload)->send();\n\t}", "public function sentSms()\n {\n if ($this->shouldDisableApiCall()) {\n return;\n }\n\n $apiKey = $this->config->getApiKey();\n $accountId = $this->config->getAccountId();\n\n $data = $this->thinqMessage->getMessage();\n\n $authorization = base64_encode($apiKey);\n $url = \"https://api.thinq.com/account/{$accountId}/product/origination/sms/send\";\n\n $ch = curl_init($url);\n curl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\n curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_HTTPHEADER, array(\n \"Authorization: Basic {$authorization}\",\n 'Content-Type: application/json',\n 'Content-Length: ' . strlen(json_encode($data)))\n );\n\n $result = curl_exec($ch);\n\n $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n curl_close($ch);\n\n if($httpcode >= 400) {\n throw new Exception($result);\n }\n }", "public function sendMessage($message) {\n\t\t$this->sendCommand(\"PRIVMSG \".$this->config['destinationChannel'].\" :\".$message);\n\t}", "function onMessage(Ratchet\\ConnectionInterface $from, $msg)\r\n {\r\n \r\n \r\n\r\n $message = json_decode($msg);\r\n \r\n $message->resourceId = $from->resourceId;\r\n\r\n if ($message->type == 'yourId'){\r\n $from->send(json_encode($message));\r\n } else {\r\n foreach($this->clients as $client){\r\n if ($from !== $client){\r\n $client->send(json_encode($message));\r\n }\r\n }\r\n }\r\n }", "public function send()\n {\n fwrite($this->rStream, $this->sText);\n }", "Public Function Sendenvelope($jobId, $envelope)\n {\n \t\n \t$this->jobId = $jobId;\n \t\n \t$DatabaseObj = Zend_Registry::get('Instance/DatabaseObj');\n \t\t\n \t$UpdateArray = array(\n \t\t\t'envelope' => $envelope,\t\t\t\t\t\t \t\t\t\n \t\t);\n \t\t\n \t\t$DatabaseObj->update('bevomedia_queue', $UpdateArray, \"jobId = '{$jobId}'\");\n \t\t\n \t\n }" ]
[ "0.765517", "0.7229767", "0.7229767", "0.7229767", "0.7229767", "0.71146226", "0.70541126", "0.69842416", "0.69728214", "0.67216265", "0.65892786", "0.65770423", "0.6534626", "0.65290236", "0.64492756", "0.64386046", "0.643076", "0.643076", "0.643076", "0.643076", "0.643076", "0.643076", "0.643076", "0.643076", "0.643076", "0.643076", "0.643076", "0.642654", "0.642654", "0.642654", "0.642654", "0.642654", "0.6395838", "0.63778055", "0.6372875", "0.63625795", "0.6315741", "0.6275882", "0.62700176", "0.62599623", "0.6259953", "0.6247137", "0.6229682", "0.62172747", "0.6191018", "0.61739576", "0.61660135", "0.615687", "0.6154977", "0.6138764", "0.6105881", "0.61038625", "0.60988504", "0.60864466", "0.60817635", "0.6065149", "0.6064995", "0.606083", "0.606083", "0.606083", "0.6054252", "0.6049984", "0.6032229", "0.60040706", "0.59744805", "0.595403", "0.5948325", "0.59469795", "0.5946584", "0.594556", "0.59408456", "0.59363604", "0.5907708", "0.5902821", "0.5902427", "0.5899454", "0.5899218", "0.58786595", "0.5871251", "0.5859086", "0.585455", "0.584296", "0.58367026", "0.5835227", "0.58280337", "0.58274984", "0.5826371", "0.5816721", "0.5806577", "0.5798873", "0.57836", "0.57755375", "0.57618576", "0.5757468", "0.57558674", "0.5748287", "0.57428855", "0.57366556", "0.5732955", "0.57319725" ]
0.6961422
9
Success message with links to notices.
public static function make(string $noticeId): string { $message = <<<'EX' ⚡ --- ExceptionLive is installed! ----------------------------------------------- Good news: You're one deploy away from seeing all of your exceptions in ExceptionLive. For now, we've generated a test exception for you: https://exception.live/report/%s If you ever need help: - Check out the documentation: https://github.com/exception-live/docs - Email: [email protected] ⚡ --- End -------------------------------------------------------------------- EX; return sprintf($message, $noticeId); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function license_success_message() {\n\t\t$message = __( 'Your Block Lab license was successfully activated!', 'block-lab' );\n\t\treturn sprintf( '<div class=\"notice notice-success\"><p>%s</p></div>', esc_html( $message ) );\n\t}", "public function notice_success( $itens = '' ) {\n\t\t$class = 'notice notice-success is-dismissible';\n\t\t$message = __( 'Sync completed successfully.', 'elemarjr' );\n\t\treturn sprintf( '<div class=\"%1$s\"><p>%2$s</p>%3$s</div>', esc_attr( $class ), esc_html( $message ), wp_kses_post( $itens ) );\n\t}", "public function show_success_message() {\n\t\tif ( $this->have_settings_been_saved() ) {\n\t\t\techo '<p class=\"wpseo-message\"><span class=\"dashicons dashicons-yes\"></span>',\n\t\t\t\tesc_html__( 'Settings saved.', 'wordpress-seo' ),\n\t\t\t\t'</p>';\n\t\t}\n\t}", "function displaySuccessMessage($index,$params = array()) {\n\t\tglobal $lang;\n\t\n\t\treturn '<div class=\"alert alert-success\">'.getLang('form_success_'.$index,$params).'</div>';\n\t}", "function formSuccess() {\n\n // Template\n $this->r->text['back_url'] = suxFunct::getPreviousURL();\n $this->r->title .= \" | {$this->r->gtext['success']}\";\n\n $this->tpl->display('success.tpl');\n\n }", "protected function add_comment_success_message(){\r\n\t\treturn 'Thank you for <a href=\"#comments\" class=\"scroll\">commenting</a>.';\r\n\t}", "public function actionSuccess()\n {\n return $this->render('success');\n }", "public function get_success_message() {\r\n\t\treturn '';\r\n\t}", "protected function saySuccess($message)\n {\n $this->say(\"<notice> $message </notice>\");\n }", "function ufclas_matlab_admin_notice_success(){\n\t$message = ufclas_matlab_get_success();\n\t?>\n <div class=\"notice notice-success\">\n <p><?php echo __( 'Import successful. View the imported page: ', 'ufclas-matlab' ) . $message; ?> </p>\n </div>\n <?php\n\t\n}", "public static function success($message)\n {\n return '<div class=\"alert alert-success\">' . $message . '</div>';\n }", "public function successMsg(){\n if(defined('PLUGIN_OPTIONS'))\n return $this->moduleSuccessMsg();\n return browser\\msg::pageNotFound();\n }", "public function addSuccessMessage($message) {\n\t\t$message = '<i class=\"fa fa-check\"></i> ' . $message;\n\t\t$this->addMessage($message, 'success');\n\t}", "public function successMessage() { return $this->successMessage; }", "function success() {\n echo \"<br />\";\n \n echo \"Thank you for contacting us. We will be in touch with you very soon.\";\n \n echo \"<br />\";\n \n \n \n }", "public function printSuccessMessage()\n {\n printf('Successfully checked %d lines in %d files :)'. PHP_EOL, $this->lines, $this->files);\n }", "function printSessionSuccessMessage(){\n\t\tif (!empty($_SESSION[\"successMessage\"])) {\n\t\t\techo(\"<div class=\\\"alert alert-success alert-dismissible fade show text-center\\\" role=\\\"alert\\\">\" \n\t\t\t\t. $_SESSION[\"successMessage\"] \n\t\t\t\t. \"<button type=\\\"button\\\" class=\\\"close\\\" data-dismiss=\\\"alert\\\">&times;</span></button></div>\");\n\t\t}\n\t}", "public static function alertSuccess($msg) {\n\t\t\techo \"<div class=\\\"alert success\\\">\n\t\t\t\t<p>\n\t\t\t\t\t<strong>\".$msg.\"</strong>\n\t\t\t\t</p>\n\t\t\t</div>\";\n\t\t}", "public function SuccessContent()\n {\n if ($object = $this->NewObject()) {\n $message = $this->Data()->SuccessMessage;\n return $this->editingMessageWithKeywords($object, $message);\n }\n }", "function success($msg) {\n if ($msg) {\n echo \" <div class=\\\"success\\\">\" . $msg . \"</div>\\n\";\n } else {\n echo \" <div class=\\\"success\\\">\" . _('Something has been successfully performed. What exactly, however, will remain a mystery.') . \"</div>\\n\";\n }\n}", "function showSuccess($feedback)\n{\n showFeedback(new AlertMessage(AlertMessage::STYLE_SUCCESS, $feedback));\n}", "protected function report_comment_success_message(){\r\n\t\treturn 'The comment has been reported.';\r\n\t}", "public function showNotice() {\n\t\t// Translators: 1 - The plugin name (\"AIOSEO).\n\t\t$string1 = sprintf( __( '%1$s V3->V4 Migration In Progress', 'all-in-one-seo-pack' ), AIOSEO_PLUGIN_SHORT_NAME );\n\t\t// Translators: 1 - The plugin name (\"All in One SEO\").\n\t\t$string2 = sprintf( __( '%1$s is currently upgrading your database and migrating your SEO data in the background.', 'all-in-one-seo-pack' ), AIOSEO_PLUGIN_NAME );\n\t\t$string3 = __( 'This notice will automatically disappear as soon as the migration has completed. Meanwhile, everything should continue to work as expected.', 'all-in-one-seo-pack' );\n\t\t?>\n\t\t<div class=\"notice notice-info aioseo-migration\">\n\t\t\t<p><strong><?php echo esc_html( $string1 ); ?></strong></p>\n\t\t\t<p><?php echo esc_html( $string2 ); ?></p>\n\t\t\t<p><?php echo esc_html( $string3 ); ?></p>\n\t\t</div>\n\t\t<style>\n\t\t</style>\n\t\t<?php\n\t}", "public function success($message)\n {\n }", "private static function success(string $message): void\n {\n echo \"\\033[42m\\033[30m\" . $message . \"\\033[0m\" . PHP_EOL;\n }", "public function success($message)\n {\n $this->message($message, 'success');\n }", "public function success($message)\n {\n return $this->render($message, 'success');\n }", "public function success($message)\n {\n $flash = $this->flashtype['success'];\n $flash['message'] = $message;\n $this->add($flash);\n }", "protected function outputSuccessMessage(string $message)\n {\n $this->outputLine(\"<fg=green>$message</>\");\n }", "public function success( $message ) {\n\n \\WP_CLI::success( $message );\n }", "function render_success_message( $form, $args ) {\n $success_message = $form['display']['success_message'];\n $success_message = apply_filters( 'af/form/success_message', $success_message, $form, $args );\n $success_message = apply_filters( 'af/form/success_message/id=' . $form['post_id'], $success_message, $form, $args );\n $success_message = apply_filters( 'af/form/success_message/key=' . $form['key'], $success_message, $form, $args );\n\n $success_message = af_resolve_merge_tags( $success_message );\n \n echo '<div class=\"af-success\" aria-live=\"assertive\" role=\"alert\">';\n \n echo $success_message;\n \n echo '</div>';\n }", "function put_success(string $message)\n{\n echo \"<aside class=\\\"notice success\\\">${message}</aside>\";\n}", "public static function successAlert($message, $options) {\n\t\t\n\t\t$he2_alerts = Session::readSession('he2_alerts');\n\t\t\n\t\tif(empty($he2_alerts))\n\t\t\t$he2_alerts = array();\t\t\n\t\t\n\t\t$he2_alerts[] = '<div class=\"alert alert-success\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>' . $message . '</div>';\n\t\t\n\t\tSession::writeSession('he2_alerts', $he2_alerts );\n\t}", "public function generateSuccess($message) {\n\t\t\techo \"\n\t\t\t\t<div class='alert alert-success' role='alert'>\n\t\t\t\t\t{$message}\n\t\t\t\t</div>\n\t\t\t\";\n\t\t}", "public static function activation_notice() {\n\t\tif ( false === get_transient( 'sgdg_activation_notice' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\techo '<div class=\"notice notice-info is-dismissible\"><p>';\n\t\t$help_link = 'https://napoveda.skaut.cz/dobryweb/' .\n\t\t\tsubstr( get_locale(), 0, 2 ) .\n\t\t\t'-skaut-google-drive-gallery';\n\t\tprintf(\n\t\t\t/* translators: 1: Start of a link to the settings 2: End of the link to the settings 3: Start of a help link 4: End of the help link */\n\t\t\tesc_html__(\n\t\t\t\t// phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong\n\t\t\t\t'Google Drive gallery needs to be %1$sconfigured%2$s before it can be used. See the %3$sdocumentation%4$s for more information.',\n\t\t\t\t'skaut-google-drive-gallery'\n\t\t\t),\n\t\t\t'<a href=\"' . esc_url( admin_url( 'admin.php?page=sgdg_basic' ) ) . '\">',\n\t\t\t'</a>',\n\t\t\t'<a href=\"' . esc_url( $help_link ) . '\" target=\"_blank\">',\n\t\t\t'</a>'\n\t\t);\n\t\techo '</p></div>';\n\t\tdelete_transient( 'sgdg_activation_notice' );\n\t}", "public function actionSuccess()\n\t{\n\t\t// using the default layout 'protected/views/layouts/main.php'\n\t\t\t\t\n\t\t$email = Yii::app()->request->getParam('email');\n\t\t$this->render('success', array('email'=>$email,'is_found'=>true));\n\t}", "public static function success($text)\n {\n \\Yii::$app->getSession()->addFlash('alerts', new Alert($text, 'success'));\n }", "public function success() {\n return array(\n '#type' => 'markup',\n '#markup' => '<h1>Congratulations</h1><p>You just completed a purchase.</p>',\n );\n }", "public function success()\n {\n return Session::getFlash('raven:success');\n }", "public function successAction()\r\n {\r\n View::renderTemplate('Signup/success.html');\r\n }", "function success()\n {\n $cur = common_current_user();\n $url = common_local_url('subscriptions', array('nickname' => $cur->nickname));\n common_redirect($url, 303);\n }", "public function success(string $message)\n {\n $this->message('success', $message);\n }", "public function successAction()\n {\n View::renderTemplate('Signup/success.html');\n }", "public function parallax_one_welcome_admin_notice() {\n\t\t?>\n\t\t\t<div class=\"updated notice is-dismissible\">\n\t\t\t\t<p><?php echo sprintf( esc_html__( 'Welcome! Thank you for choosing Parallax One! To fully take advantage of the best our theme can offer please make sure you visit our %swelcome page%s.', 'parallax-one' ), '<a href=\"' . esc_url( admin_url( 'themes.php?page=parallax-one-welcome' ) ) . '\">', '</a>' ); ?></p>\n\t\t\t\t<p><a href=\"<?php echo esc_url( admin_url( 'themes.php?page=parallax-one-welcome' ) ); ?>\" class=\"button\" style=\"text-decoration: none;\"><?php _e( 'Get started with Parallax One', 'parallax-one' ); ?></a></p>\n\t\t\t</div>\n\t\t<?php\n\t}", "function successAlert($msgText)\n\t{\n\t\t$msgSuccess = \"<div class='alert alert-success alert-dismissible fade show'>\n\t\t\t\t\t\t<button type='button' class='close' data-dismiss='alert'>&times;</button>\n\t\t\t\t\t\t\" . $msgText . \"\n\t\t\t\t\t\t</div>\";\n\t\treturn $msgSuccess;\n\t}", "public static function success($text = null)\n {\n self::message($text, 'success');\n }", "function admin_notices() {\n\t\t$status = $this->get_license_status();\n\n\t\tif ( $status === false || $status !== 'valid' ) {\n\t\t\t$msg = __( 'Please %1$sactivate your license%2$s key to enable updates for %3$s.', $this->text_domain );\n\t\t\t$msg = sprintf( $msg, '<a href=\"' . admin_url( 'admin.php?page=' . $this->get_settings_page_slug() ) . '\">', '</a>', '<strong>' . $this->product_name . '</strong>' );\n\t\t\t?>\n\t\t\t<div class=\"notice notice-error\">\n\t\t\t\t<p><?php echo $msg; ?></p>\n\t\t\t</div>\n\t\t<?php\n\t\t}\n\n\t\tif ( isset( $_GET['sl_activation'] ) && ! empty( $_GET['message'] ) ) {\n\n\t\t\tswitch( $_GET['sl_activation'] ) {\n\n\t\t\t\tcase 'false':\n\t\t\t\t\t$message = urldecode( $_GET['message'] );\n\t\t\t\t\t?>\n\t\t\t\t\t<div class=\"error\">\n\t\t\t\t\t\t<p><?php echo $message; ?></p>\n\t\t\t\t\t</div>\n\t\t\t\t\t<?php\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'true':\n\t\t\t\tdefault:\n\t\t\t\t\t// Developers can put a custom success message here for when activation is successful if they way.\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\t\t}\n\t}", "function displaySuccessMsg() {\n\tif(isset($_SESSION['success'])) {\n\t\t// Set up row in accordance with Bootstrap grid\n\t\t/*echo '<div class=\"container\"><div class=\"row\"><div class=\"col-md-12\">';*/\n\t\techo '<div class=\"row\"><div class=\"col-md-12\">';\n\t\tforeach ($_SESSION['success'] as $success) {\n\t\t\techo '<p class=\"success\">',$success,'</p>';\n\t\t}\n\t\t/*echo '</div></div></div>';*/\n\t\techo '</div></div>';\n\t\t// Unset errors for page refresh\n\t\tunset ($_SESSION['success']);\n\t}\n}", "function feedbackAvaliador() {\n echo '<p class=\"feedback success\"><b>Revisor adicionado com sucesso.</b></p>';\n }", "public static function success($message = '') {\n self::writeLine($message, SELF::CLI_COLOR_GREEN, self::CLI_TYPE_SUCCESS);\n }", "public function callbackSuccess()\n {\n $this->AddOutput(\"<p><i>Välkommen till Allt Om Landskapsfotografering! Ditt användare id är: \" . $this->acronym . \" </i></p>\");\n $this->redirectTo();\n }", "public function success($message, $title = null, $options = []) {\n $this->add('success', $message, $title, $options);\n }", "public static function success($message, $attributes = array())\n\t{\n\t\treturn static::show(Labels::SUCCESS, $message, $attributes);\n\t}", "public function EditingSuccessContent()\n {\n if ($object = $this->editObject) {\n $message = $this->Data()->EditingSuccessMessage;\n return $this->editingMessageWithKeywords($object, $message);\n }\n }", "public function feedback_notice() {\n\t\tif ( ! $this->is_feedback_notice_active() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$username = get_user_meta( get_current_user_id(), 'first_name', true );\n\t\t?>\n\t\t<div id=\"wpba-notice-feedback\" class=\"notice notice-info is-dismissible\">\n\t\t\t<p>\n\t\t\t\t<?php printf( __( \"Hey%s! We're just a small plugin, and we need your help! You've been using the <em>Advanced Bulk Actions</em> plugin for some time now, and we were wondering whether you had any suggestions for bulk actions to add. We'd really appreciate it if you could send us you're feedback!\", 'wpba' ), ( $username ? ( ' ' . $username ) : '' ) ); ?>\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t<a href=\"https://wordpress.org/support/plugin/bulk-actions#new-post\" title=\"<?php esc_attr_e( 'Send us your feedback!', 'wpba' ); ?>\" class=\"button button-secondary\" target=\"_blank\"><?php _e( 'Send us your feedback!', 'wpba' ); ?></a> <?php _e( '(opens in a new tab)', 'wpba' ); ?> <?php printf( __( 'or %s.', 'wpba' ), '<a href=\"#\" class=\"hide\">' . __( 'hide this message forever', 'wpba' ) . '</a>' ); ?>\n\t\t\t</p>\n\t\t</div>\n\t\t<?php\n\t}", "public static function success( $message ){\n return self::add( new Loco_error_Success($message) );\n }", "public function admin_notices()\n {\n if (isset($_GET['wpstg_licensing']) && !empty($_GET['message'])) {\n\n $message = urldecode($_GET['message']);\n\n switch ($_GET['wpstg_licensing']) {\n case 'false':\n ?>\n <div class=\"wpstg-error\" style=\"font-weight:500;\">\n <p><?php _e('WP Staging - Can not activate license key! ', 'wp-staging');\n echo $message; ?></p>\n </div>\n <?php\n break;\n\n case 'true':\n default:\n // Put a custom success message here for when activation is successful if they way.\n ?>\n <!--\t\t\t\t<div class=\"success\">\n <p><?php echo $message; ?></p>\n </div>-->\n <?php\n break;\n }\n }\n }", "protected function confirm_add()\n\t{\n\t\t$msg = 'Successfully added project ' . $this->fields['Title'] . '.';\n\t\treturn '<font color=\"green\">' . $msg . '</font><br>';\n\n\t}", "public function success($message = null, $newlines = 1, $level = Shell::NORMAL) {\n\t\t$this->out('<success>' . $message . '</success>', $newlines, $level);\n\t}", "function custom_success( $msg, $success ) {\n\n\t\tif ( $success == 'mycred_transfer_done' ) {\n\t\t\t$msg = __( 'Points transferred successfully', 'twodayssss' );\n\t\t}\n\n\t\treturn $msg;\n\t}", "public function add_notice() {\n\t\tif ( current_user_can( 'activate_plugins' ) ) {\n\t\t\techo sprintf(\n\t\t\t\t'<div id=\"message\" class=\"error\"><p>%s</p></div>',\n\t\t\t\timplode( '<br>', $this->notices )\n\t\t\t);\n\t\t}\n\t}", "public function getSuccessMessageText()\r\n {\r\n return $this->scopeConfig->getValue(\r\n self::XML_PATH_SUCCESS_MESSAGE_TEXT,\r\n ScopeInterface::SCOPE_STORE\r\n );\r\n }", "function sample_admin_notice__success() {\n ?>\n <div class=\"notice notice-success is-dismissible\">\n <p><?php _e( 'RAR Example Plugin Installed!', 'sample-text-domain' ); ?></p>\n </div>\n <?php\n}", "public function renderNotifyMessage() {\n if (Yii::app()->user->hasFlash('beFormAction')) {\n echo '<div class=\"alert alert-success\" role=\"alert\">\n\t\t\t\t<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>'\n . Yii::app()->user->getFlash('beFormAction') .\n '</div>';\n }\n\n if (Yii::app()->user->hasFlash('beFormError')) {\n echo '<div class=\"alert alert-danger\" role=\"alert\">\n\t\t\t\t<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>'\n . Yii::app()->user->getFlash('beFormError') .\n '</div>';\n }\n }", "public static function admin_notice() {\r\n\t\techo '<div class=\"error\">';\r\n\t\techo '<p>' . esc_html( __( 'Your server does not support communication with servers over HTTPS.', 'inf-member' ) ) . '</p>';\r\n\t\techo '</div>';\r\n\t}", "function showPageNotice()\n {\n // TRANS: Page notice. %s is a trustroot name.\n $this->element('p',null,sprintf(_m('%s has asked to verify your identity. Click Continue to verify your identity and login without creating a new password.'),$this->trust_root));\n }", "protected function delete_comment_success_message(){\r\n\t\treturn 'Comment deleted.';\r\n\t}", "public static function success(string $msg): string\n {\n $msg = 'Success: ' . $msg;\n $space = self::tabSpaces($msg);\n $out = static::colorize(str_pad(' ', $space), Color::FG_WHITE, Color::AT_BOLD, Color::BG_GREEN) . PHP_EOL;\n $out .= static::colorize(' ' . $msg . ' ', Color::FG_WHITE, Color::AT_BOLD, Color::BG_GREEN) . PHP_EOL;\n $out .= static::colorize(str_pad(' ', $space), Color::FG_WHITE, Color::AT_BOLD, Color::BG_GREEN) . PHP_EOL;\n\n return $out;\n }", "protected function log_success( string $message ) {\n\n\t\tif ( class_exists( 'WP_CLI' ) ) {\n\t\t\t\\WP_CLI::success( $message );\n\t\t}\n\n\t}", "public function strSucces($strMessage_I)\n {\n return \"<div> <strong>Success!</strong></br> $strMessage_I </div>\";\n }", "public function successAction()\n\t{\n\t\t$this->_redirect('checkout/onepage/success', array('_secure'=>true));\n\t}", "public static function success()\n {\n static::returnCode(static::CODE_SUCCESS);\n }", "public static function modificationSuccessMessage($message = null) {\n\n self::customContentMessage(\n \"Modification succesful\",\n ($message ? $message : null) ?? \"The modifications have been saved succesfully.\",\n \"info\"\n );\n\n }", "function mme_success_notice(){\n\t$msg = \"Email Id saved successfully\";\n\t?>\n\t <div class=\"updated\" style=\"margin:5px 2px 2px\">\n <p><?php _e( $msg, 'my-text-domain' ); ?></p>\n </div>\n\t<?\n\n}", "public function showSuccessMessage(HeaderService $header)\n {\n return $this->render('contact/success.html.twig', [\n 'header' => $header\n ]);\n }", "public function seeSuccessHeader($message)\n {\n $messages = [\n 'error' => [],\n 'success' => [$message],\n 'notice' => []\n ];\n\n $this->haveHttpHeader('Bluz-Notify', json_encode($messages));\n }", "protected function markAsSuccess()\n {\n $this->view->success = true;\n }", "public function callbackSuccess()\n {\n $this->AddOutput(\"<p><i>Form was submitted and the callback method returned true.</i></p>\"); \n $this->redirectTo();\n }", "protected function showNotice(){\n $notices = array(\n 'succesSyncMatch'=>array(\n 'state' => \"success\", \n 'str' => __('The match data has been synchronized.', 'eventus')\n ), \n 'warningSyncMatch'=>array(\n 'state' => \"warning\", \n 'str' => __('The match data was synchronized well, despite some errors. For more information, see ', 'eventus') . ' <a href=\"admin.php?page=eventus_logs\">' . __('the logs', 'eventus') .'</a>.'\n ),\n 'succesDelMatch'=>array(\n 'state' => \"success\", \n 'str' => __('The matches have been deleted.', 'eventus')\n ), \n 'succesUpMatch'=>array(\n 'state' => \"success\", \n 'str' => __('The matches have been updated.', 'eventus')\n ), \n 'succesUpHoursMatch'=>array(\n 'state' => \"success\", \n 'str' => __('The appointment times have been updated.', 'eventus')\n ), \n 'warningUpHoursMatch'=>array(\n 'state' => \"warning\", \n 'str' => __('The appointment times have been updated, despite some errors. For more information, see ', 'eventus') . ' <a href=\"admin.php?page=eventus_logs\">' . __('the logs', 'eventus') .'</a>'\n ), \n 'succesUpTeam'=>array(\n 'state' => \"success\", \n 'str' => __('The team has been well updated.', 'eventus')\n ), \n 'succesNewTeam'=>array(\n 'state' => \"success\", \n 'str' => __('The team has been added well.', 'eventus')\n ), \n 'errorUpTeam'=>array(\n 'state' => \"error\", \n 'str' => __('The team could not be modified. Some fields are missing.', 'eventus')\n ), \n 'errorNewTeam'=>array(\n 'state' => \"error\", \n 'str' => __('The team could not be added. Some fields are missing.', 'eventus')\n ), \n 'succesDelTeam'=>array(\n 'state' => \"success\", \n 'str' => __('The team has been removed.', 'eventus')\n ), \n 'succesDelTeams'=>array(\n 'state' => \"success\", \n 'str' => __('The teams have been deleted.', 'eventus')\n ), \n 'succesUpClub'=>array(\n 'state' => \"success\", \n 'str' => __('The club has been updated.', 'eventus')\n ),\n 'succesNewClub'=>array(\n 'state' => \"success\", \n 'str' => __('The club has been well added.', 'eventus')\n ), \n 'errorUpClub'=>array(\n 'state' => \"error\", \n 'str' => __('The club could not be modified. Some fields are missing.', 'eventus')\n ), \n 'errorNewClub'=>array(\n 'state' => \"error\", \n 'str' => __('The club could not be added. Some fields are missing.', 'eventus')\n ), \n 'succesDelClub'=>array(\n 'state' => \"success\", \n 'str' => __('The club has been deleted.', 'eventus')\n ), \n 'succesDelLog'=>array(\n 'state' => \"success\", \n 'str' => __('The logs have been deleted.', 'eventus')\n ), \n 'succesReset'=>array(\n 'state' => \"success\", \n 'str' => __('The plugin has been reset.', 'eventus')\n ), \n 'succesUpSet'=>array(\n 'state' => \"success\", \n 'str' => __('The parameters have been updated.', 'eventus')\n ),\n 'noMapApiKey'=>array(\n 'state' => \"error\", \n 'str' => __('Please specify your Google Map API key in', 'eventus') . ' <a href=\"admin.php?page=eventus_admin\">' . __('the parameters', 'eventus') .'</a>.'\n ),\n 'succesMultiIcs'=>array(\n 'state' => \"success\", \n 'str' => __('The calendars have been updated.', 'eventus')\n ),\n 'succesOneIcs'=>array(\n 'state' => \"success\", \n 'str' => __('The calendar has been updated.', 'eventus')\n ),\n 'succesDelIcs'=>array(\n 'state' => \"success\", \n 'str' => __('The calendars have been deleted.', 'eventus')\n ),\n 'errorSeeker'=>array(\n 'state' => \"error\", \n 'str' => __('Please select a club.', 'eventus')\n ),\n 'succesSeeked'=>array(\n 'state' => \"success\", \n 'str' => __('The teams have been added well.', 'eventus')\n ),\n );\n if (array_key_exists('message', $_GET) && $_GET['message'] && $notices[$_GET['message']]) {\n return '<div class=\"notice notice-'.$notices[$_GET['message']]['state'].' is-dismissible\"><p><strong>'.$notices[$_GET['message']]['str'].'</strong></p></div>'; \n }\n return;\n }", "public function winespace_welcome_admin_notice() {\n\t\t?>\n\t\t\t<div class=\"updated notice is-dismissible\">\n\t\t\t\t<p><?php echo sprintf( esc_html__( 'Thanks for choosing winespace! You can read hints and tips on how get the most out of your new theme on the %swelcome screen%s.', 'winespace' ), '<a href=\"' . esc_url( admin_url( 'themes.php?page=winespace-welcome' ) ) . '\">', '</a>' ); ?></p>\n\t\t\t\t<p><a href=\"<?php echo esc_url( admin_url( 'themes.php?page=winespace-welcome' ) ); ?>\" class=\"button\" style=\"text-decoration: none;\"><?php _e( 'Get started with winespace', 'winespace' ); ?></a></p>\n\t\t\t</div>\n\t\t<?php\n\t}", "public function render_notice() {\n\t\t$theme = wp_get_theme();\n\t\t$slug = $theme->__get( 'stylesheet' );\n\t\t$name = $theme->__get( 'Name' );\n\t\t$url = admin_url( 'themes.php?page=' . $slug . '-welcome' );\n\t\t$notice = apply_filters( 'ti_about_welcome_notice_filter', ( '<p>' . sprintf( 'Welcome! Thank you for choosing %1$s! To fully take advantage of the best our theme can offer please make sure you visit our %2$swelcome page%3$s.', $name, '<a href=\"' . esc_url( admin_url( 'themes.php?page=' . $slug . '-welcome' ) ) . '\">', '</a>' ) . '</p><p><a href=\"' . esc_url( $url ) . '\" class=\"button\" style=\"text-decoration: none;\">' . sprintf( 'Get started with %s', $name ) . '</a></p>' ) );\n\n\t\techo wp_kses_post( $notice );\n\t}", "private function _success($info){\n $confirm = array(\n 'class' => 'alert-success',\n 'head' => '成功!',\n 'body' => $info\n );\n $this->assign('confirmInfo',$confirm);\n }", "protected function success(string $message)\n {\n if (FLOW_SAPITYPE === 'CLI') {\n echo \"\\033[32m\" . $message . \"\\033[0m\" . PHP_EOL;\n }\n }", "function setSuccessMessage($appointmentData)\n\t{\n\t\t$stylistName = $appointmentData[0]['stylistName'];\n\t\t$serviceName = $appointmentData[0]['serviceName'];\n\t\t$appointmentDate = date('l F j',strtotime($appointmentData[0]['appointmentDate']));\n\t\t$startTime = date('g:i a', strtotime($appointmentData[0]['startTime']));\n\t\t$this->email = $appointmentData[0]['email'];\n\t\t\n\t\t$this->message = JText::sprintf('COM_SALONBOOK_EMAIL_BODY_SUCCESS', $serviceName, $stylistName, $appointmentDate, $startTime);\n\t\t$this->mailer->setBody($this->message);\t\t\n\t}", "public function notice()\n {\n }", "public function successMsg($str_message,$jump_url=\"\"){\r\n\t\t$this->success($str_message,$jump_url);\r\n\t\texit;\r\n\t}", "public static function show_message() {\n\n $message = \"\";\n if (Session::has('success_message')) {\n $message = '\n \t\t\t<div class=\"alert alert-success class_alert_message\">\n\t\t\t ' .\n Session::get(\"success_message\")\n . '\n\t\t\t \n\t\t\t\t</div>\n \t';\n }\n\n if (Session::has('error_message')) {\n $message = '\n \t\t\t<div class=\"alert alert-danger class_alert_message\">\n\t\t\t ' .\n Session::get(\"error_message\")\n . '\n\t\t\t \n\t\t\t\t</div>\n \t';\n }\n\n\n return $message;\n }", "protected function success() {\r\n $this->redirect();\r\n }", "function outputStatusMessage($message, $status) {\n\t\techo '<div class=\"alert alert-'.$status.'\">'.$message.'</div>';\n\t}", "public function welcome_apply_message() {\n global $OUTPUT;\n\n $a = new \\stdClass();\n $a->uploadpage = get_string('tabutemplatepage3', 'mod_surveypro');\n $a->savepage = get_string('tabutemplatepage2', 'mod_surveypro');\n $message = get_string('welcome_utemplateapply', 'mod_surveypro', $a);\n echo $OUTPUT->notification($message, 'notifymessage');\n }", "public static function success($message)\n {\n return new self($message, ['class' => 'alert alert-success']);\n }", "public function success($message, $dismissible = false): PendingNotice\n {\n return $this->add($message, 'success', $dismissible);\n }", "protected function setSuccessfulEditMessage()\n\t{\n\t\t$message = str_replace( array(\"%succeed%\", \"%total%\"), array( \"<strong>\".$this->nUpdated.\"</strong>\", \"<strong>\".$this->nSelected.\"</strong>\" ), \"%succeed% out of %total% records updated successfully.\");\n\t\t$this->setMessage( $message );\n\t\t\n\t\tif( $this->nUpdated != $this->nSelected ) {\n\t\t\t$message = str_replace( \"%failed%\", \"<strong>\".($this->nSelected - $this->nUpdated).\"</strong>\" , \"%failed% records failed.\");\n\t\t\t$this->setMessage( $message );\n\t\t}\n\t}", "public function activation_admin_notice() {\n\t\t\t\tglobal $pagenow;\n\n\t\t\t\tif( is_admin() && ('themes.php' == $pagenow) && (isset($_GET['activated'])) ) { ?>\n\t\t\t\t\t<div class=\"notice notice-success is-dismissible\">\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\tprintf( '%1$s %2$s %3$s <a href=\"%4$s\">%5$s</a> %6$s', esc_html__( 'Welcome! Thank you for choosing', 'vmagazine-lite' ), esc_html($this->theme_name), esc_html__( 'Please make sure you visit our', 'vmagazine-lite' ), esc_url( admin_url( 'themes.php?page=vmagazine-lite-welcome' ) ), esc_html__( 'Welcome Page', 'vmagazine-lite' ), esc_html__( 'to get started with Swing.', 'vmagazine-lite' ) );\n\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<p><a class=\"button\" href=\"<?php echo esc_url(admin_url( 'themes.php?page=vmagazine-lite-welcome' )) ?>\"><?php esc_html_e( 'Lets Get Started', 'vmagazine-lite' ); ?></a></p>\n\t\t\t\t\t</div>\n\t\t\t\t\t<?php\n\t\t\t\t}\n\t\t\t}", "public function show_message() {\n\t\tif ( ! $this->is_activated || ! $this->purchase_code ) {\n\t\t\t$url = esc_url( 'admin.php?page=lievo-activation' );\n\t\t\t$link = sprintf( '<a href=\"%s\">%s</a>', $url, 'Product Activation' );\n\t\t\techo sprintf( ' To receive automatic updates a license activation is required. Please visit %s to activate your copy of LivIcons Evolution.', $link );\n\t\t}\n\t}", "public function success() {\n\t}", "function getSuccessMessage()\r\n {\r\n if(isset($_SESSION['success_message']))\r\n {\r\n /**\r\n * This is for storing the session array\r\n * @var array\r\n */\r\n $success_message_array = $_SESSION['success_message'];\r\n\r\n /**\r\n * This is for creating the error message\r\n * @var string\r\n */\r\n $response = \"<table>\";\r\n\r\n foreach ($success_message_array as $array_key\t=>\t$array_value)\r\n {\r\n $response .= \"<tr><td class='success_message'>\".$array_value.\"</td></tr><tr><td class='success_message_seperator'></td></tr>\";\r\n }\r\n\r\n $response .= \"</table>\";\r\n\r\n unset ($_SESSION['success_message']);\r\n\r\n return $response;\r\n }\r\n }", "public static function setSuccess($message)\n {\n self::put(\"success\", $message);\n }", "public static function updatedSuccess(string $message = null): string\n {\n if ($message) {\n return __($message);\n }\n return __('Record updated successfully!');\n }", "public function form_success()\n {\n \tif ($this->session->has_userdata('success_message')) \n \t{\n \t\t# code...\n \t\t$this->data = array_merge($this->data, array(\n \t\t\t'msg'\t\t=> $this->session->userdata('success_message')['msg'],\n \t\t\t'msg2'\t\t=> $this->session->userdata('success_message')['msg2'],\n \t\t\t're_link'\t=> $this->session->userdata('success_message')['re_link'],\n \t\t\t'msg3'\t\t=> $this->session->userdata('success_message')['msg3'],\n \t\t\t're_link2'\t=> $this->session->userdata('success_message')['re_link2'] \n\t\t\t));\n\n \t\tif ($this->session->userdata('success_message')['type'] == 'participants') \n \t\t{\n \t\t\t# code...\n \t\t\t$this->data['output'] = $this->Model_return->return_participants($this->session->userdata('success_message')['id']);\n \t\t}\n \t\telseif ($this->session->userdata('success_message')['type'] == 'event') \n \t\t{\n \t\t\t# code...\n \t\t\t$this->data['output'] = $this->Model_return->return_event($this->session->userdata('success_message')['id']);\n \t\t}\n \t\telse\n \t\t{\n \t\t\t$this->data['output'] = NULL;\n \t\t}\n \t\t$this->render($this->set_views->form_success());\n \t}\n \telse\n \t{\n \t\tredirect('/Form');\n \t}\n }", "protected function printOkBoxMessage($message){\n ?>\n <div class=\"alert alert-success\">\n <strong>OK! </strong> <?php echo $message ?>\n </div>\n <?php \n }" ]
[ "0.75259745", "0.7432046", "0.7427186", "0.73961884", "0.7361995", "0.73310107", "0.7174746", "0.7160757", "0.7140715", "0.69768286", "0.6965433", "0.6925982", "0.6924342", "0.6915881", "0.6888714", "0.68815714", "0.6854168", "0.6850474", "0.6828856", "0.68172807", "0.6783794", "0.67827225", "0.6761571", "0.67584693", "0.67567176", "0.6750665", "0.6746847", "0.6708352", "0.67031014", "0.6693325", "0.6687134", "0.6682566", "0.6663016", "0.6656483", "0.6654067", "0.66508", "0.66307485", "0.66216856", "0.6614116", "0.6613228", "0.65831614", "0.65785056", "0.6550032", "0.65385693", "0.6531128", "0.6520324", "0.650798", "0.64980584", "0.64901966", "0.6489293", "0.64725655", "0.6465029", "0.6459965", "0.64562094", "0.6449488", "0.64329195", "0.64275366", "0.6426822", "0.6426236", "0.64165694", "0.64163196", "0.6414678", "0.64122474", "0.63745695", "0.63427955", "0.63404286", "0.6322911", "0.6320788", "0.63110054", "0.62907547", "0.6285298", "0.6282815", "0.6281986", "0.62712896", "0.62678635", "0.6267404", "0.62668705", "0.62541777", "0.6237576", "0.6231083", "0.6217839", "0.621724", "0.62117267", "0.62077165", "0.6207391", "0.6206958", "0.6200524", "0.61996", "0.6197476", "0.61929166", "0.6190576", "0.6182992", "0.6172677", "0.6171776", "0.61674976", "0.6163089", "0.61572415", "0.61496574", "0.6146989", "0.614532", "0.6144634" ]
0.0
-1
Complete semifinished result URL as two section strings and system params array. First section as base section with scheme, domain and base path, second section as application requested path and query string and third section as system params like `localization` or `media_version`. Those params could be inserted between first two sections as system params in result URL by router behaviour and default values. Or it could be inserted into domain part in more extended routers. Example: Input (`\MvcCore\Route::$reverse`): `[ "en"=> "/productslist//"`, "de"=> "/produktliste//"`, ]` Input ($params): `array( "name"=> "coolproductname", "color"=> "red", "variant"=> ["L", "XL"], "localization"=> "enUS", "media_version"=> "mobile", );` Output: `[ "/application/base/bath", "/productslist/coolproductname/blue?variant[]=L&amp;variant[]=XL", ["media_version" => "m", "localization" => "enUS"] ]`
protected abstract function urlByRouteSections (\MvcCore\IRoute $route, array & $params = [], $urlParamRouteName = NULL);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function urlByRoutePrefixSystemParams ($urlBaseSection, $urlPathWithQuerySection, array $systemParams = [], $urlPathWithQueryIsHome = NULL) {\n\t\t// complete prefixes section from system params\n\t\t$urlPrefixesSection = trim(implode('/', array_values($systemParams)), '/');\n\t\t$urlPrefixesSectionHasValue = $urlPrefixesSection !== '';\n\n\t\tif ($urlPrefixesSectionHasValue) {\n\t\t\t$urlPrefixesSection = '/' . $urlPrefixesSection;\n\n\t\t\t// finalizing possible trailing slash after prefix if any prefix\n\t\t\tif ($this->trailingSlashBehaviour === \\MvcCore\\IRouter::TRAILING_SLASH_REMOVE) {\n\t\t\t\tif ($urlPathWithQueryIsHome === NULL)\n\t\t\t\t\t$urlPathWithQueryIsHome = $this->urlIsHomePath($urlPathWithQuerySection);\n\t\t\t\tif ($urlPathWithQueryIsHome)\n\t\t\t\t\t$urlPathWithQuerySection = ltrim($urlPathWithQuerySection, '/');\t\n\t\t\t}\n\t\t}\n\n\t\treturn $urlBaseSection . $urlPrefixesSection . $urlPathWithQuerySection;\n\t}", "public function _assembleUrl(array $params){\n\n $params = array_merge($params, $this->_linkRouter['defaultParams']);\n $router = Zend_Controller_Front::getInstance()->getRouter();\n $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();\n $url = $router->assemble($params, $this->_linkRouter['name'], true);\n //@TODO check if there is any problem concatanating _baseUrl and $url\n // using apache alias, concatanation makes duplicates. but using virtualhosts with subdomains, no problem.\n //$url = $baseUrl . $url;\n return $url;\n }", "public function composeUri($params)\n {\n $ret = '';\n $first = true;\n\n foreach ($params as $param => $values) {\n if (!$first) {\n $ret .= $this->seperators['param'];\n }\n $first = false;\n $internal = $param;\n if ($external = $this->translateKeyOutput($param)) {\n $param = $external;\n }\n $ret .= $param . $this->seperators['key_value'];\n $firstValue = true;\n foreach ($values as $value) {\n if ($external = $this->translateValueOutput($internal, $value)) {\n $value = $external;\n }\n if (!$firstValue) {\n $ret .= $this->seperators['value'];\n } else {\n $firstValue = false;\n }\n $ret .= urlencode($value);\n }\n }\n\n return $ret;\n }", "function getUrlSegments(&$queryParameters) {\n\t\t$langTag = (!empty($queryParameters['lang'])) ? $queryParameters['lang'] : KenedoPlatform::p()->getLanguageTag();\n\n\t\t// Now we take the actual controller and see if it does anything specific (if not, we do it the customview way - means we check for a menu item)\n\t\t$customControllerClass = self::getControllerClass($queryParameters['option'], '', $queryParameters['viewname']);\n\t\tif (self::controllerExists($customControllerClass)) {\n\t\t\t$controller = self::getController($customControllerClass);\n\t\t\t// We make a copy of the query parameters, because in case that controller doesn't do anything specific\n\t\t\t$testQueryParams = $queryParameters;\n\t\t\t$testSegments = $controller->getUrlSegments($testQueryParams);\n\t\t\t$diffValues = array_diff($testQueryParams, $queryParameters);\n\t\t\t$diffKeys = array_diff_key($testQueryParams, $queryParameters);\n\t\t\t// If it does, then use it, otherwise the custom view controller deals with all that\n\t\t\tif (count($testSegments) || count($diffValues) || count($diffKeys)) {\n\t\t\t\t$queryParameters = $testQueryParams;\n\t\t\t\treturn $testSegments;\n\t\t\t}\n\t\t}\n\n\t\t$id = KenedoRouterHelper::getItemIdByLink('index.php?option=com_configbox&view=customview&viewname='.$queryParameters['viewname'], $langTag);\n\t\tif ($id) {\n\t\t\t$queryParameters['Itemid'] = $id;\n\t\t\tunset($queryParameters['view'], $queryParameters['viewname']);\n\t\t\treturn array();\n\t\t}\n\t\telse {\n\t\t\tunset($queryParameters['view']);\n\t\t\treturn array('customview');\n\t\t}\n\n\t}", "public function createUrl ($params)\n {\n if (array_key_exists($this->languageParam, $params)) {\n $lang = $params[$this->languageParam];\n\n if ((\n ($lang !== Yii::$app->sourceLanguage &&\n ArrayHelper::getValue(Yii::$app->getSiteLangs()->getLanguages()->code, $lang) !== Yii::$app->sourceLanguage) ||\n $this->displaySourceLanguage\n ) &&\n !empty($lang)\n ) {\n // Не добавлять алиас к главной странице\n if (Yii::$app->getSiteMenu()->getHomeLink() == $params[0]) {\n $params[0] = $lang;\n } else {\n $params[0] = $lang . '/' . ltrim($params[0], '/');\n }\n }\n unset($params[$this->languageParam]);\n } else {\n if (Yii::$app->language !== Yii::$app->sourceLanguage || $this->displaySourceLanguage) {\n // Не добавлять алиас к главной странице\n if (Yii::$app->getSiteMenu()->getHomeLink() == $params[0]) {\n $params[0] = Yii::$app->getSiteLangs()->getCurrent()->code;\n } else {\n $params[0] = Yii::$app->getSiteLangs()->getCurrent()->code . '/' . ltrim($params[0], '/');\n }\n }\n }\n\n //return parent::createUrl($params);\n // From Yii\n $params = (array) $params;\n $anchor = isset($params['#']) ? '#' . $params['#'] : '';\n unset($params['#'], $params[$this->routeParam]);\n\n $route = trim($params[0], '/');\n unset($params[0]);\n\n $baseUrl = $this->showScriptName && !$this->enablePrettyUrl ? $this->getScriptUrl() : $this->getBaseUrl();\n\n if ($this->enablePrettyUrl) {\n /* @var $rule UrlRule */\n foreach ($this->rules as $rule) {\n if (($url = $rule->createUrl($this, $route, $params)) !== false) {\n $url = str_replace('%2F', '/', $url);\n if (strpos($url, '://') !== false) {\n if ($baseUrl !== '' && ($pos = strpos($url, '/', 8)) !== false) {\n return substr($url, 0, $pos) . $baseUrl . substr($url, $pos);\n } else {\n return $url . $baseUrl . $anchor;\n }\n } else {\n return \"$baseUrl/{$url}{$anchor}\";\n }\n }\n }\n\n if ($this->suffix !== null) {\n $route .= $this->suffix;\n }\n if (!empty($params) && ($query = http_build_query($params)) !== '') {\n $route .= '?' . $query;\n }\n\n return \"$baseUrl/{$route}{$anchor}\";\n } else {\n $url = \"$baseUrl?{$this->routeParam}=\" . urlencode($route);\n $url = str_replace('%2F', '/', $url);\n if (!empty($params) && ($query = http_build_query($params)) !== '') {\n $url .= '&' . $query;\n }\n\n return $url . $anchor;\n }\n }", "public function assemble(array $params = array(), array $options = array()) {\n\t\tif (! isset ( $options ['name'] )) {\n\t\t\tthrow new Exception\\InvalidArgumentException ( 'Missing \"name\" option' );\n\t\t}\n\t\t\n\t\t$names = explode ( '/', $options ['name'], 2 );\n\t\t$route = $this->routes->get ( $names [0] );\n\t\t\n\t\tif (! $route) {\n\t\t\tthrow new Exception\\RuntimeException ( sprintf ( 'Route with name \"%s\" not found', $names [0] ) );\n\t\t}\n\t\t\n\t\tif (isset ( $names [1] )) {\n\t\t\t$options ['name'] = $names [1];\n\t\t} else {\n\t\t\tunset ( $options ['name'] );\n\t\t}\n\t\t\n\t\tif (isset ( $options ['only_return_path'] ) && $options ['only_return_path']) {\n\t\t\treturn $this->baseUrl . $route->assemble ( array_merge ( $this->defaultParams, $params ), $options );\n\t\t}\n\t\t\n\t\tif (! isset ( $options ['uri'] )) {\n\t\t\t$uri = new HttpUri ();\n\t\t\t\n\t\t\tif (isset ( $options ['force_canonical'] ) && $options ['force_canonical']) {\n\t\t\t\tif ($this->requestUri === null) {\n\t\t\t\t\tthrow new Exception\\RuntimeException ( 'Request URI has not been set' );\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$uri->setScheme ( $this->requestUri->getScheme () )->setHost ( $this->requestUri->getHost () )->setPort ( $this->requestUri->getPort () );\n\t\t\t}\n\t\t\t\n\t\t\t$options ['uri'] = $uri;\n\t\t} else {\n\t\t\t$uri = $options ['uri'];\n\t\t}\n\t\t\n\t\t$path = $this->baseUrl . $route->assemble ( array_merge ( $this->defaultParams, $params ), $options );\n\t\t\n\t\tif (isset ( $options ['query'] )) {\n\t\t\t$uri->setQuery ( $options ['query'] );\n\t\t}\n\t\t\n\t\tif (isset ( $options ['fragment'] )) {\n\t\t\t$uri->setFragment ( $options ['fragment'] );\n\t\t}\n\t\t\n\t\tif ((isset ( $options ['force_canonical'] ) && $options ['force_canonical']) || $uri->getHost () !== null || $uri->getScheme () !== null) {\n\t\t\tif (($uri->getHost () === null || $uri->getScheme () === null) && $this->requestUri === null) {\n\t\t\t\tthrow new Exception\\RuntimeException ( 'Request URI has not been set' );\n\t\t\t}\n\t\t\t\n\t\t\tif ($uri->getHost () === null) {\n\t\t\t\t$uri->setHost ( $this->requestUri->getHost () );\n\t\t\t}\n\t\t\t\n\t\t\tif ($uri->getScheme () === null) {\n\t\t\t\t$uri->setScheme ( $this->requestUri->getScheme () );\n\t\t\t}\n\t\t\t\n\t\t\treturn $uri->setPath ( $path )->normalize ()->toString ();\n\t\t} elseif (! $uri->isAbsolute () && $uri->isValidRelative ()) {\n\t\t\treturn $uri->setPath ( $path )->normalize ()->toString ();\n\t\t}\n\t\t\n\t\treturn $path;\n\t}", "public static function parseUrl()\n {\n $route = trim($_SERVER['QUERY_STRING'], '/');\n $params = explode('/', $route);\n $params = array_slice($params, 2);\n\n return [$route, $params];\n }", "public function splitUrl() {\n if (isset($_GET['url'])) {\n\n // split URL\n $url = trim($_GET['url'], '/');\n $url = filter_var($url, FILTER_SANITIZE_STRING);\n $url = explode('/', $url);\n\n // parse custom urls\n $url = $this->parseRoutes($url);\n\n if ($this->app->language->enabled) {\n // set lang key\n $this->lang_key = isset($url[0]) ? $url[0] : null;\n // set controller\n $this->url_controller = isset($url[1]) ? $url[1] : null;\n // and action\n $this->url_action = isset($url[2]) ? $url[2] : null;\n\n // store URL parts\n $this->url_parts = array_values($url);\n\n // remove controller and action from URL parts\n unset($url[0], $url[1], $url[2]);\n } else {\n // set controller\n $this->url_controller = isset($url[0]) ? $url[0] : null;\n // and action\n $this->url_action = isset($url[1]) ? $url[1] : null;\n\n // store URL parts\n $this->url_parts = array_values($url);\n\n // remove controller and action from URL parts\n unset($url[0], $url[1]);\n }\n\n // store action params\n $this->action_params = array_values($url);\n\n }\n }", "function VehicleManagerParseRoute($segments)\n{\n $db = JFactory::getDBO();\n $vars = array();\n \n $count = count($segments);\n $vars['option'] = 'com_vehiclemanager';\n\n $JSite = new JSite();\n $menu = $JSite->getMenu();\n if( !is_numeric($segments[0] ) ){ \n array_unshift($segments, \"0\" );\n }\n\n $menu->setActive($segments[0]);\n $vars['Itemid'] = $segments[0];\n \n if ((@$segments[1] == \"alone_category\" || @$segments[1] == \"showCategory\") && isset($segments[2]))\n {\n $vars['task'] = \"alone_category\";\n $vars['catid'] = @$segments[2];\n /*\n $sql_query = \"SELECT id FROM #__vehiclemanager_main_categories WHERE name='\".$segments[2].\"'\";\n $db->setQuery($sql_query);\n $row = null;\n $row = $db->loadObject();\n $vars['catid'] = $row->id;\n * */\n\n if (isset($segments[4]))\n {\n $viewtype = explode(':', $segments[3]);\n if ($viewtype[0] == \"viewtype\")\n {\n $vars['viewtype'] = (int) $viewtype[1];\n }\n }\n\n if (isset($segments[3]) && !isset($vars['viewtype']))\n {\n $vars['start'] = $segments[3];\n } else\n {\n unset($vars['start']);\n }\n\n if (isset($segments[4]) && !isset($vars['viewtype']))\n {\n $vars['limitstart'] = $segments[4];\n } else\n {\n unset($vars['limistart']);\n }\n\n if (isset($segments[5]))\n {\n $viewtype = explode(':', $segments[5]);\n if ($viewtype[0] == \"viewtype\")\n {\n $vars['viewtype'] = (int) $viewtype[1];\n }\n }\n } elseif (@$segments[1] == \"all_categories\"){\n \n $vars['task'] = 'all_categories';\n $vars['lang'] = 'en';\n \n } \n elseif (@$segments[1] == \"all_vehicle\") {\n $vars['task'] = @$segments[1];\n if(isset($segments[2])) $vars['limitstart'] = $segments[2];\n }\n elseif (@$segments[1] == \"my_vehicles\") {\n $vars['task'] = @$segments[1];\n if(isset($segments[2])) $vars['limitstart'] = $segments[2];\n }\n elseif (@$segments[1] == \"view_vehicle\" && isset($segments[4]))\n {\n $vars['task'] = \"view_vehicle\";\n $vars['id'] = (int) $segments[4];\n /* $vars['name'] = $segments[3]; Comment 13.05.13\n\n $sql_query = \"SELECT id FROM #__vehiclemanager_main_categories WHERE name='\" . $segments[3] . \"'\";\n $db->setQuery($sql_query);\n $row = null;\n $row = $db->loadObject(); \n $vars['catid'] = $row->id;*/\n $vars['catid'] = (int) $segments[2];\n } elseif (@$segments[1] == \"Search\")\n {\n $vars['task'] = \"search\";\n if (isset($segments[4]))\n {\n $vars['searchtext'] = $segments[4];\n }\n \n if (isset($segments[5]))\n {\n $vars['searchtype'] = $segments[5];\n }\n if (isset($segments[2]))\n {\n $vars['start'] = $segments[2];\n } else\n {\n unset($vars['start']);\n }\n if (isset($segments[3]))\n {\n $vars['limitstart'] = $segments[3];\n } else\n {\n unset($vars['limistart']);\n }\n } elseif (@$segments[1] == \"show_search_vehicle\")\n {\n $vars['task'] = \"show_search_vehicle\";\n if (isset($segments[4]))\n {\n $vars['searchtext'] = $segments[4];\n }\n if (isset($segments[5]))\n {\n $vars['searchtype'] = $segments[5];\n }\n if (isset($segments[2]))\n {\n $vars['start'] = $segments[2];\n } else\n {\n unset($vars['start']);\n }\n if (isset($segments[3]))\n {\n $vars['limitstart'] = $segments[3];\n } else\n {\n unset($vars['limistart']);\n }\n } elseif (@$segments[1] == \"search\" || @$segments[1] == \"search_vehicle\")\n {\n $vars['task'] = @$segments[1];\n if (isset($segments[4]))\n {\n $vars['searchtext'] = $segments[4];\n }\n if (isset($segments[5]))\n {\n $vars['searchtype'] = $segments[5];\n }\n if (isset($segments[2]))\n {\n $vars['start'] = $segments[2];\n } else\n {\n unset($vars['start']);\n }\n if (isset($segments[3]))\n {\n $vars['limitstart'] = $segments[3];\n } else\n {\n unset($vars['limistart']);\n }\n } elseif (@$segments[1] == \"show_rss_categories\")\n {\n $vars['task'] = \"show_rss_categories\";\n } elseif (@$segments[1] == \"buy_now\")\n {\n $vars['task'] = \"new_url\";\n if (isset($segments[2]))\n {\n $vars['id'] = $segments[2];\n }\n } elseif (@$segments[1] == \"buy_now_for_vm\")\n {\n $vars['task'] = \"new_url_for_vm\";\n if (isset($segments[2]))\n {\n $vars['id'] = $segments[2];\n }\n } elseif (@$segments[1] == \"view_user_vehicles\")\n {\n $vars['task'] = \"view_user_vehicles\";\n $vars['limit'] = isset($segments[3]) ? $segments[3] : null;\n $vars['limitstart'] = isset($segments[4]) ? $segments[4] : null;\n if (isset($segments[2]))\n {\n $vars['name'] = $segments[2];\n }\n } elseif (@$segments[1] == \"owner_vehicles\")\n {\n $vars['task'] = \"owner_vehicles\";\n if (isset($segments[2]))\n {\n $vars['name'] = $segments[2];\n }\n } \n ///////////\n elseif (@$segments[1] == \"show_my_cars\")\n {\n $vars['task'] = \"show_my_cars\";\n $vars['limit'] = isset($segments[3]) ? $segments[3] : null;\n $vars['limitstart'] = isset($segments[4]) ? $segments[4] : null;\n if (isset($segments[2]))\n {\n $vars['name'] = str_replace(\":\",\" \", $segments[2]);\n }\n }\n //////////////////// \n \n elseif (@$segments[1] == \"lend_history\")\n {\n $vars['task'] = \"lend_history\";\n $vars['name'] = $segments[2];\n $vars['user'] = $segments[3];\n } elseif (@$segments[1] == \"lend_requests\")\n {\n $vars['task'] = \"lend_requests\";\n if (isset($segments[2]))\n {\n $vars['start'] = $segments[2];\n } else\n {\n unset($vars['start']);\n }\n if (isset($segments[3]))\n {\n $vars['limitstart'] = $segments[3];\n } else\n {\n unset($vars['limistart']);\n }\n } elseif (@$segments[1] == \"mdownload\")\n {\n $vars['task'] = \"mdownload\";\n if (isset($segments[2]))\n {\n $vars['id'] = $segments[2];\n }\n } elseif (@$segments[1] == \"edit_vehicle\")\n {\n $vars['task'] = \"edit_vehicle\";\n if (isset($segments[2]))\n $vars['id'] = $segments[2];\n $vars['Itemid'] = $segments[0];\n \n } else\n {\n $vars['task'] = @$segments[1];\n }\n return $vars;\n}", "public function FormatParametersForUrl($params) {\n return http_build_query($params, NULL, '&');\n }", "function SimulationParseRoute($segments)\n{\n\t$vars = array();\n\n\t//Get the active menu item.\n\t$app\t= JFactory::getApplication();\n\t$menu\t= $app->getMenu();\n\t$item\t= $menu->getActive();\n\t$params = JComponentHelper::getParams('com_content');\n\t$advanced = $params->get('sef_advanced_link', 0);\n\t$db = JFactory::getDBO();\n\n\t// Count route segments\n\t$count = count($segments);\n\n\t// Standard routing for articles. If we don't pick up an Itemid then we get the view from the segments\n\t// the first segment is the view and the last segment is the id of the article or category.\n\t//if (!isset($item)) {\n\t\t$vars['view']\t= $segments[0];\n\t\t$vars['layout']\t= $segments[1];\n\t\tif($count==1){\n\t\t\t$vars['id'] = 1;\n\t\t}else{\n\t\t$vars['id']\t\t= $segments[2];\n\t\t}\n\n\t\treturn $vars;\n\t//}\n\n\t// if there is only one segment, then it points to either an article or a category\n\t// we test it first to see if it is a category. If the id and alias match a category\n\t// then we assume it is a category. If they don't we assume it is an article\n\tif ($count == 1) {\n\t\t// we check to see if an alias is given. If not, we assume it is an article\n\t\tif (strpos($segments[0], ':') === false) {\n\t\t\t$vars['layout'] = 'prop';\n\t\t\t$vars['id'] = (int) $segments[0];\n\t\t\treturn $vars;\n\t\t}\n\n\t\t//list($id, $alias) = explode(':', $segments[0], 2);\n\n\t}\n\n\treturn $vars;\n}", "function buildStringFromParsed(array $parts, $params = array())\n {\n if ($params instanceof \\Traversable)\n $params = \\Poirot\\Std\\cast($params)->toArray();\n \n if (!is_array($params))\n throw new \\InvalidArgumentException(sprintf(\n 'Parameters must be an array or Traversable; given: (%s).'\n , \\Poirot\\Std\\flatten($params)\n ));\n \n \n // regard to recursive function call\n $isOptional = false;\n $args = func_get_args();\n if ($args && isset($args[2]))\n $isOptional = $args[2];\n\n # Check For Presented Values in Optional Segment\n // consider this \"/[@:username{{\\w+}}][-:userid{{\\w+}}]\"\n // if username not presented as params injected then first part include @ as literal\n // not rendered.\n // optional part only render when all parameter is present\n if ($isOptional) {\n foreach ($parts as $parsed) {\n if (!isset($parsed['_parameter_']))\n continue;\n\n ## need parameter\n $neededParameterName = $parsed['_parameter_'];\n if (!(isset($params[$neededParameterName]) && $params[$neededParameterName] !== '') )\n return '';\n }\n }\n\n \n $return = '';\n // [0 => ['_literal_' => 'localhost'], 1=>['_optional' => ..] ..]\n foreach ($parts as $parsed) {\n $definition_name = key($parsed);\n $definition_value = $parsed[$definition_name];\n // $parsed can also have extra parsed data options\n // _parameter_ String(3) => tld \\\n // tld String(4) => .com\n switch ($definition_name)\n {\n case '_literal_':\n $return .= $definition_value;\n break;\n\n case '_parameter_':\n if (!isset($params[$definition_value])) {\n if ($isOptional) return '';\n\n throw new \\InvalidArgumentException(sprintf(\n 'Missing parameter (%s).'\n , $definition_value\n ));\n }\n\n $return .= $params[$definition_value];\n break;\n\n case '_optional_':\n $optionalPart = buildStringFromParsed($definition_value, $params, true);\n if ($optionalPart !== '')\n $return .= $optionalPart;\n\n break;\n }\n }\n\n return $return;\n }", "function get_segments($ignore_custom_routes=NULL) {\n $psuedo_url = str_replace('://', '', BASE_URL);\n $psuedo_url = rtrim($psuedo_url, '/');\n $bits = explode('/', $psuedo_url);\n $num_bits = count($bits);\n\n if ($num_bits>1) {\n $num_segments_to_ditch = $num_bits-1;\n } else {\n $num_segments_to_ditch = 0;\n }\n\n $assumed_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? \"https\" : \"http\") . \"://\" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];\n\n if (!isset($ignore_custom_routes)) {\n $assumed_url = attempt_add_custom_routes($assumed_url);\n }\n\n $data['assumed_url'] = $assumed_url;\n\n $assumed_url = str_replace('://', '', $assumed_url);\n $assumed_url = rtrim($assumed_url, '/');\n\n $segments = explode('/', $assumed_url);\n\n for ($i=0; $i < $num_segments_to_ditch; $i++) { \n unset($segments[$i]);\n }\n\n $data['segments'] = array_values($segments); \n return $data;\n}", "function caNavUrl($po_request, $ps_module_path, $ps_controller, $ps_action, $pa_other_params=null, $pa_options=null) {\n\n\t\tif(caUseCleanUrls()) {\n\t\t\t$vs_url = $po_request->getBaseUrlPath();\n\t\t} else {\n\t\t\t$vs_url = $po_request->getBaseUrlPath().'/'.$po_request->getScriptName();\n\t\t}\n\t\tif ($ps_module_path == '*') { $ps_module_path = $po_request->getModulePath(); }\n\t\tif ($ps_controller == '*') { $ps_controller = $po_request->getController(); }\n\t\tif ($ps_action == '*') { \n\t\t\t$ps_action = $po_request->getAction(); \n\t\t\tif ($vs_action_extra = $po_request->getActionExtra()) { \n\t\t\t\t$ps_action .= \"/{$vs_action_extra}\";\n\t\t\t}\n\t\t}\n\t\t\n\t\tif ($ps_module_path) {\n\t\t\t$vs_url .= '/'.$ps_module_path;\n\t\t}\n\t\tif ($ps_controller) {\n\t\t\t$vs_url .= \"/\".$ps_controller;\n\t\t}\n\t\tif ($ps_action) {\n\t\t\t$vs_url .= \"/\".$ps_action;\n\t\t}\n\t\t\n\t\tif (is_array($pa_other_params) && sizeof($pa_other_params)) {\n\t\t\t$vn_i = 0;\n\t\t\t\n\t\t\tif (caIsAssociativeArray($pa_other_params)) {\n\t\t\t\tforeach($pa_other_params as $vs_name => $vs_value) {\n\t\t\t\t\tif (in_array($vs_name, array('module', 'controller', 'action'))) { continue; }\n\t\t\t\t\tif (is_array($vs_value)) { // is the value is array we need to serialize is... just treat it as a list of values which *should* be what it is.\n\t\t\t\t\t\t$vs_value = join(\";\", $vs_value);\n\t\t\t\t\t}\n\t\t\t\t\t$vs_url .= '/'.$vs_name.\"/\".(caGetOption('dontURLEncodeParameters', $pa_options, false) ? $vs_value : urlencode($vs_value));\n\t\t\t\t\n\t\t\t\t\t$vn_i++;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$vs_url .= \"/\".join(\"/\", $pa_other_params);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (caGetOption('absolute', $pa_options, false)) {\n\t\t\t$o_config = Configuration::load();\n\t\t\t$vs_url = $o_config->get('site_host').$vs_url;\n\t\t}\n\t\t\n\t\treturn $vs_url;\n\t}", "public function index() {\n\t\tif ($this->config->get('config_seo_url')) {\n\t\t\t$this->url->addRewrite($this);\n\t\t}\n\n\t\t// Decode URL\n\t\tif (isset($this->request->get['_route_'])) {\n\t\t\t$parts = explode('/', $this->request->get['_route_']);\n\n\t\t\t// remove any empty arrays from trailing\n\t\t\tif (utf8_strlen(end($parts)) == 0) {\n\t\t\t\tarray_pop($parts);\n\t\t\t}\n\n\t\t\tforeach ($parts as $part) {\n\t\t\t\t$query = $this->db->query(\"SELECT * FROM \" . DB_PREFIX . \"url_alias WHERE keyword = '\" . $this->db->escape($part) . \"'\");\n\n\t\t\t\tif ($query->num_rows) {\n\t\t\t\t\t$url = explode('=', $query->row['query']);\n\n\t\t\t\t\tif ($url[0] == 'product_id') {\n\t\t\t\t\t\t$this->request->get['product_id'] = $url[1];\n\t\t\t\t\t}\n\n\t\t\t\t\tif ($url[0] == 'category_id') {\n\t\t\t\t\t\tif (!isset($this->request->get['path'])) {\n\t\t\t\t\t\t\t$this->request->get['path'] = $url[1];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$this->request->get['path'] .= '_' . $url[1];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif ($url[0] == 'manufacturer_id') {\n\t\t\t\t\t\t$this->request->get['manufacturer_id'] = $url[1];\n\t\t\t\t\t}\n\n\t\t\t\t\tif ($url[0] == 'information_id') {\n\t\t\t\t\t\t$this->request->get['information_id'] = $url[1];\n\t\t\t\t\t}\n\n\t\t\t\t\tif ($query->row['query'] && $url[0] != 'information_id' && $url[0] != 'manufacturer_id' && $url[0] != 'category_id' && $url[0] != 'product_id') {\n\t\t\t\t\t\t$this->request->get['route'] = $query->row['query'];\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$this->request->get['route'] = 'error/not_found';\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!isset($this->request->get['route'])) {\n\t\t\t\tif (isset($this->request->get['product_id'])) {\n\t\t\t\t\t$this->request->get['route'] = 'product/product';\n\t\t\t\t} elseif (isset($this->request->get['path'])) {\n\t\t\t\t\t$this->request->get['route'] = 'product/category';\n\t\t\t\t} elseif (isset($this->request->get['manufacturer_id'])) {\n\t\t\t\t\t$this->request->get['route'] = 'product/manufacturer/info';\n\t\t\t\t} elseif (isset($this->request->get['information_id'])) {\n\t\t\t\t\t$this->request->get['route'] = 'information/information';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private function _url($par = array()) {\n\t\t$get = $_GET;\n\t\t\n\t\tforeach ((array) $par AS $key => $val) { //overide value\n\t\t\tif ($key == 'path') //if path, encode\n\t\t\t\t$get['path'] = \\Crypt::encrypt($val);\n\t\t\telse\n\t\t\t\t$get[$key] = $val;\n\t\t}\n\t\t\n\t\t$url = '//';\n\t\t\n\t\t$url .= $this->_sanitize(g($_SERVER, 'HTTP_HOST').'/'.strtok(g($_SERVER, 'REQUEST_URI'), '?'));\n\t\t\n\t\treturn $url.'?'.http_build_query($get);\n\t}", "public function getEndpointParams(){\n\t\t#Explode current endpoint into parts\n\t\t$currentEndpointParts = explode(\"/\", $this->endpointURL);\n\t\t#Iterate\n\t\tforeach ($this->availableEndpoints as $endpointItem) {\n\t\t\t#Explode the possible endpoint match\n\t\t\t$itemParts = explode(\"/\", $endpointItem);\n\t\t\t#Check if count parts match, skip otherwise\n\t\t\tif(count($currentEndpointParts) != count($itemParts)) continue;\n\t\t\t#Prepare parts match flag\n\t\t\t$partsMatched = true;\n\t\t\t#Prepare resulting associative array\n\t\t\t$returnArray = [];\n\t\t\t#Check for each part\n\t\t\tforeach ($itemParts as $partIDX => $partTag) {\n\t\t\t\t#Flag to check if part is argument\n\t\t\t\t$partIsArg = preg_match(\"/^{[a-zA-Z0-9_-]+}$/\", $partTag);\n\t\t\t\t#Update flag\n\t\t\t\t$partsMatched = $partsMatched && ($partIsArg ? 1 : ($partTag == $currentEndpointParts[$partIDX]));\n\t\t\t\t#Skip next checks if didn't matched\n\t\t\t\tif(!$partsMatched) break;\n\t\t\t\t#Insert into result\n\t\t\t\t$returnArray[str_replace([\"{\",\"}\"], \"\", $partTag)] = $currentEndpointParts[$partIDX];\n\t\t\t}\n\t\t\t#If matched return item data (an associative array with the named endpoint parts being the keys and the requested endpoint parts being the values)\n\t\t\tif($partsMatched) return $returnArray;\n\t\t}\n\t\t#Fallback return empty\n\t\treturn [];\n\t}", "public function Url (\\MvcCore\\IRequest $request, array $params = [], array $defaultUrlParams = [], $queryStringParamsSepatator = '&', $splitUrl = FALSE);", "function qa_path($request, $params = null, $rooturl = null, $neaturls = null, $anchor = null)\n{\n\tif (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }\n\n\tif (!isset($neaturls)) {\n\t\trequire_once QA_INCLUDE_DIR . 'app/options.php';\n\t\t$neaturls = qa_opt('neat_urls');\n\t}\n\n\tif (!isset($rooturl))\n\t\t$rooturl = qa_path_to_root();\n\n\t$url = $rooturl . ((empty($rooturl) || (substr($rooturl, -1) == '/')) ? '' : '/');\n\t$paramsextra = '';\n\n\t$requestparts = explode('/', $request);\n\t$pathmap = qa_get_request_map();\n\n\tif (isset($pathmap[$requestparts[0]])) {\n\t\t$newpart = $pathmap[$requestparts[0]];\n\n\t\tif (strlen($newpart))\n\t\t\t$requestparts[0] = $newpart;\n\t\telseif (count($requestparts) == 1)\n\t\t\tarray_shift($requestparts);\n\t}\n\n\tforeach ($requestparts as $index => $requestpart) {\n\t\t$requestparts[$index] = urlencode($requestpart);\n\t}\n\t$requestpath = implode('/', $requestparts);\n\n\tswitch ($neaturls) {\n\t\tcase QA_URL_FORMAT_INDEX:\n\t\t\tif (!empty($request))\n\t\t\t\t$url .= 'index.php/' . $requestpath;\n\t\t\tbreak;\n\n\t\tcase QA_URL_FORMAT_NEAT:\n\t\t\t$url .= $requestpath;\n\t\t\tbreak;\n\n\t\tcase QA_URL_FORMAT_PARAM:\n\t\t\tif (!empty($request))\n\t\t\t\t$paramsextra = '?qa=' . $requestpath;\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\t$url .= 'index.php';\n\n\t\tcase QA_URL_FORMAT_PARAMS:\n\t\t\tif (!empty($request)) {\n\t\t\t\tforeach ($requestparts as $partindex => $requestpart)\n\t\t\t\t\t$paramsextra .= (strlen($paramsextra) ? '&' : '?') . 'qa' . ($partindex ? ('_' . $partindex) : '') . '=' . $requestpart;\n\t\t\t}\n\t\t\tbreak;\n\t}\n\n\tif (isset($params))\n\t\tforeach ($params as $key => $value)\n\t\t\t$paramsextra .= (strlen($paramsextra) ? '&' : '?') . urlencode($key) . '=' . urlencode((string)$value);\n\n\treturn $url . $paramsextra . (empty($anchor) ? '' : '#' . urlencode($anchor));\n}", "public function testUrlArray(): void\n {\n $expected = [\n 'controller' => 'Bookmarks',\n 'action' => 'view',\n 'plugin' => false,\n 'prefix' => false,\n ];\n $this->assertSame($expected, urlArray('Bookmarks::view'));\n\n $expected = [\n 'controller' => 'Bookmarks',\n 'action' => 'view',\n 'prefix' => 'Admin',\n 'plugin' => false,\n ];\n $this->assertSame($expected, urlArray('Admin/Bookmarks::view'));\n\n $expected = [\n 'controller' => 'Articles',\n 'action' => 'view',\n 'plugin' => 'Vendor/Cms',\n 'prefix' => 'Management/Admin',\n 3,\n '?' => ['query' => 'string'],\n ];\n $params = [3, '?' => ['query' => 'string']];\n $this->assertSame($expected, urlArray('Vendor/Cms.Management/Admin/Articles::view', $params));\n }", "public function resolveParams(&$segments)\n {\n \n $this->params = $segments; \n \n }", "private function generate_url($params) {\n $s = ($_SERVER['HTTPS'] == 'on') ? 's' : '';\n $protocol = $this->strleft(strtolower($_SERVER['SERVER_PROTOCOL']), '/') . $s;\n $port = (($_SERVER['SERVER_PORT'] == '80' && $_SERVER['HTTPS'] != 'on') ||\n ($_SERVER['SERVER_PORT'] == '443' && $_SERVER['HTTPS'] == 'on')) ? \n '' : (':' .$_SERVER['SERVER_PORT']);\n $path = $this->strleft($_SERVER['REQUEST_URI'], '?');\n $parsed_params = '';\n $delm = '?';\n foreach (array_reverse($params) as $key => $val) {\n if (!empty($val)) {\n $parsed_key = $key[0] == '_' ? $key : '_' . $key;\n $parsed_params .= $delm . urlencode($parsed_key) . '=' . urlencode($val);\n $delm = '&';\n }\n }\n $cfg = rcmail::get_instance()->config->all();\n if ( $cfg['cas_webmail_server_name'] ) {\n $serverName = $cfg['cas_webmail_server_name'];\n } else {\n $serverName=$_SERVER['SERVER_NAME'];\n }\n return $protocol . '://' . $serverName . $port . $path . $parsed_params;\n }", "function string2params($params_string)\n{\n\n\tif (is_string($params_string))\n\t{\n\t\t$params\t\t= array();\n\t\tif (strpos($params_string , '/') !== false )\n\t\t{\n\t\t\t$raw_params = explode('/', $params_string);\n\n\t\t\tif (($c = count($raw_params)) % 2 == 0)\n\t\t\t{\n\t\t\t\t$i\t= 0;\n\t\t\t\tforeach ($raw_params as $param )\t// Step in twos\n\t\t\t\t{\n\t\t\t\t\tif ($i % 2 == 0)\n\t\t\t\t\t\t$params [$raw_params[$i]] = $raw_params[$i + 1];\t\t// Do the magic\n\t\t\t\t\t$i++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (strpos($params_string, '=') !== false )\n\t\t{\n\t\t\t$params_q\t= explode('&' , $params_string);\n\t\t\t\n\t\t\tforeach ($params_q as $this_q)\n\t\t\t{\n\t\t\t\tif (strpos($this_q, '='))\n\t\t\t\t{\n\t\t\t\t\tlist($key, $value)\t= explode('=', $this_q, 2);\n\t\t\t\t\t$params[$key]\t= $value;\n\t\t\t\t}\t\t\n\t\t\t}\n//\t\t\t// Join the two\n//\t\t\t$params\t\t= array_merge($params, $params_q);\n\t\t}\n\t\treturn $params;\n\t}\n}", "public function extractParameters()\n {\n $request = $this->container->get('request_stack')->getCurrentRequest();\n\n if (preg_match(self::$routePattern, $request->get('_route'), $routeMatches)) {\n $searchEngine = $this->container->get('search.engine');\n\n $this->routePrefix = reset($routeMatches);\n $this->originalRouteParameterCount = (int)end($routeMatches);\n\n $activeModules = $searchEngine->getActiveModules();\n\n $dateFormatString = $this->container->get('languagehandler')->getDateFormat();\n $dateFormat = preg_replace(\"/[^\\w]/\", '-', $dateFormatString);\n\n for ($i = 0; $i < $this->originalRouteParameterCount; $i++) {\n $rawInput = strtolower($request->get(\"a{$i}\"));\n $parameterInformation = Utility::convertStringToArray($rawInput);\n\n if (!$this->hasKeywords() && $rawKeyword = $searchEngine->convertFromKeywordFormat($rawInput)) {\n $parameterInformation = Utility::convertStringToArray($rawKeyword);\n foreach ($parameterInformation as $parameter) {\n $this->addKeyword($parameter);\n }\n continue;\n }\n\n if (!$this->hasWheres() && $rawWhere = $searchEngine->convertFromWhereFormat($rawInput)) {\n $parameterInformation = Utility::convertStringToArray($rawWhere);\n foreach ($parameterInformation as $parameter) {\n $this->addWhere($parameter);\n }\n continue;\n }\n\n if (!$this->hasModules() && $modules = array_intersect($activeModules, $parameterInformation)) {\n foreach ($modules as $key => $value) {\n $this->addModule($key);\n }\n continue;\n }\n\n if (!$this->hasStartDate() && $date = \\DateTime::createFromFormat($dateFormat, $rawInput)) {\n $this->setStartDate($date);\n continue;\n }\n\n if (!$this->hasEndDate() && $date = \\DateTime::createFromFormat($dateFormat, $rawInput)) {\n $this->setEndDate($date);\n continue;\n }\n\n if (($elasticType = $searchEngine->getFriendlyUrlType($parameterInformation)) && (!$this->hasCategories() || !$this->hasLocations())) {\n switch ($elasticType) {\n case CategoryConfiguration::$elasticType:\n if (!$this->hasCategories()) {\n $categories = $searchEngine->categoryFriendlyURLSearch($parameterInformation);\n $this->setCategories($categories);\n !$this->hasModules() and array_map(function($category) {\n $this->addModule($category->getModule());\n }, $categories);\n }\n break;\n case LocationConfiguration::$elasticType:\n if (!$this->hasLocations()) {\n $this->setLocations($searchEngine->locationFriendlyURLSearch($parameterInformation));\n }\n break;\n }\n\n continue;\n }\n\n if (self::$exception) {\n throw new NotFoundHttpException();\n }\n }\n }\n\n foreach ($request->query->all() as $key => $value) {\n $this->queryParameters[$key] = Utility::convertStringToArray($value, '-');\n }\n }", "private function BuildRoute($urlparams)\n\t{\n\t\tforeach ($this->routes as $route) {\n\n\t\t\tif (!$route->Valid($urlparams))\n\t\t\t\tcontinue;\n\n\t\t\t$path = $route->Build($urlparams);\n\t\t\t$usedparams = $route->GetUsedParameters();\n\n\t\t\treturn array($path, $usedparams);\n\t\t}\n\n\t\treturn array(null, array());\n\t}", "private function mergeQueryParams( $url, $params )\n\t{\n\t\t$urlparts = parse_url( $url );\n\n\t\tif ( ! isset( $urlparts['query'] ) ) {\n\t\t\t$urlparts['query'] = '';\n\t\t}\n\n\t\tif ( ! is_array( $params ) ) {\n\t\t\tparse_str( $params, $params );\n\t\t}\n\n\t\tif ( $urlparts['query'] != '' ) {\n\t\t\t$parts = array_merge( parse_str( $qparts ) , $params );\n\t\t} else {\n\t\t\t$parts = $params;\n\t\t}\n\t\t$urlparts['query'] = http_build_query( $parts, '', '&' );\n\t\treturn ( $urlparts['query'] != '' ) ? $url .'?'. $urlparts['query'] : $url;\n\t}", "public function createUrl($params)\n {\n $params = (array)$params;\n\n if (array_key_exists($this->languageParam, $params)) {\n $lang = $params[$this->languageParam];\n\n if (\n (($lang !== Yii::$app->sourceLanguage && ArrayHelper::getValue($this->aliases, $lang) !== Yii::$app->sourceLanguage)\n || $this->displaySourceLanguage) && !empty($lang)\n ) {\n $params[0] = $lang . '/' . ltrim($params[0], '/');\n }\n\n unset($params[$this->languageParam]);\n } else {\n if (Yii::$app->language !== Yii::$app->sourceLanguage || $this->displaySourceLanguage) {\n $params[0] = Yii::$app->language . '/' . ltrim($params[0], '/');\n }\n }\n\n return parent::createUrl($params);\n }", "public function buildUrl(array $params) {\n $params = array_merge(\n $this->getParamsForRequest(),\n $params\n );\n\t\tif (!isset($params['format']))\n\t\t\t$params['format'] = 'php_serial';\n return $this->rest_url . '?' . $this->signParams($params);\n }", "protected function parseParameters($params) {\n $uri = \"\";\n if (array_key_exists(\"days\", $params)) {\n $uri .= '&days=' . $params['days'];\n }\n\n if (array_key_exists(\"results\", $params)) {\n $uri .= '&results=' . $params['results'];\n }\n\n if (array_key_exists(\"min\", $params)) {\n $uri .= '&min=' . $params['min'];\n }\n\n if (array_key_exists(\"max\", $params)) {\n $uri .= '&max=' . $params['max'];\n }\n\n if (array_key_exists(\"metadata\", $params)) {\n if ($params['metadata'] == true || $params['metadata'] == false) {\n $uri .= '&metadata=' . $params['metadata'];\n }\n }\n\n if (array_key_exists(\"round\", $params)) {\n $uri .= '&round=' . $params['round'];\n }\n\n if(array_key_exists(\"start\", $params)) {\n $uri .= '&start=' . $params['start'];\n }\n\n if (array_key_exists(\"end\", $params)) {\n $uri .= '&end=' . $params['end'];\n }\n\n if (array_key_exists(\"timezone\", $params)) {\n $uri .= '&timezone=' . $params['timezone'];\n }\n\n if (array_key_exists(\"location\", $params)) {\n $uri .= '&location=' . $params['location'];\n }\n\n if (array_key_exists(\"median\", $params)) {\n $uri .= '&median=' . $params['median'];\n }\n\n\n\n return $uri;\n }", "private function _getUrlParamsForFormAction() {\n\n $param = $this->params()->fromRoute('param');\n $param2 = $this->params()->fromRoute('param2');\n $value = $this->params()->fromRoute('value', 0);\n $value2 = $this->params()->fromRoute('value2', 0);\n\n $params = array(\n 'productId' => 0,\n 'categoryId' => 0,\n 'parentId' => 0\n );\n\n// $productId = $categoryId = null;\n// if ($param == \"product\") {\n// $productId = $value;\n// $categoryId = $value2;\n// } else if ($param == \"category\") {\n// $productId = $value2;\n// $categoryId = $value;\n// }\n\n switch ($param) {\n case 'product':\n $params['productId'] = $value;\n $params['categoryId'] = $value2;\n break;\n case 'category':\n $params['productId'] = $value2;\n $params['categoryId'] = $value;\n break;\n case 'parent':\n $params['parentId'] = $value;\n break;\n default:\n break;\n }\n\n return $params;\n }", "function SimulationBuildRoute(&$query)\n{\n\t$segments\t= array();\n\n\t// get a menu item based on Itemid or currently active\n\t$app\t\t= JFactory::getApplication();\n\t$menu\t\t= $app->getMenu();\n\t$params\t\t= JComponentHelper::getParams('com_workshop');\n\t$advanced\t= $params->get('sef_advanced_link', 0);\n\n\t// we need a menu item. Either the one specified in the query, or the current active one if none specified\n\tif (empty($query['Itemid'])) {\n\t\t$menuItem = $menu->getActive();\n\t\t$menuItemGiven = false;\n\t}\n\telse {\n\t\t$menuItem = $menu->getItem($query['Itemid']);\n\t\t$menuItemGiven = true;\n\t}\n\n\tif (isset($query['layout']) && isset($query['id'])) {\n\t\t$view = $query['layout'];\n\t\t$id = $query['id'];\n\t}\n\telse {\n\t\t// we need to have a view in the query or it is an invalid URL\n\t\treturn $segments;\n\t}\n\n\tif (!$view == '')\n\t{\n\t\t\t$segments[] = 'RealEstateProperties';\n\t\t\t$segments[] = $view;\n\t\t\t$segments[] = $id;\n\t\t\tunset($query['layout']);\n\t\t\tunset($query['id']);\n\t}\n\treturn $segments;\n}", "function addUrlParameters(array $parameters) {\n $this->CI = $this->CI ?: get_instance();\n $this->parameterSegment = $this->CI->config->item('parm_segment');\n $this->routerSegments = $segments = $this->CI->uri->router->segments;\n $firstKey = null;\n foreach($parameters as $key => $value) {\n $firstKey = $firstKey ?: $key;\n $segments[] = $key;\n $segments[] = $value;\n }\n $this->CI->uri->router->segments = $segments;\n if (!\\RightNow\\Utils\\Url::getParameter($firstKey)) {\n $this->CI->config->set_item('parm_segment', $this->parameterSegment - 1);\n }\n }", "function addQuery($url, $params)\n{\n if (is_array($params)){\n if (count($params) > 0){\n $url .= '?';\n foreach ($params as $key => $value):\n $url .= $key . '=' . $value . '&';\n endforeach;\n $url = substr($url, 0, -1);\n }\n } \n return $url;\n}", "function current_request_with_params($params) {\n\t\t$all_params = $_GET;\n\t\tforeach ($params as $key => $value) {\n\t\t\t$all_params[$key] = $value;\n\t\t}\n\t\t$request = $_SERVER['REQUEST_URI'];\n\t\t$query = $_SERVER['QUERY_STRING'];\n\t\tif (strlen($query)) {\n\t\t\t$request = str_replace( $query, \"\", $request);\n\t\t}\n\t\t$sep = \"\";\n\t\tforeach ($all_params as $key => $value) {\n\t\t\t$request = $request . $sep;\n\t\t\t$sep = '&';\n\t\t\t$request = $request . $key . \"=\" . $value;\n\t\t}\n\n\t\treturn $request;\n\t}", "public function getUrl($params)\n {\n $path = $this->path;\n\n foreach ($params as $k => $v) {\n $path = str_replace(\":$k\", $v, $path);\n }\n\n return $path == null || $path == '' ? '/' : '/' . $path;\n }", "public function createUrl($params)\n {\n $params = (array)$params;\n $language = ArrayHelper::remove($params, 'lang', static::$currentLanguage);\n \n return $this->baseUrl . ($language ? \"/$language\" : null) .\n preg_replace('~' . $this->baseUrl . '~', null, parent::createUrl($params), 1);\n }", "private function processQueryString()\n {\n // store the query string local, so we don't alter it.\n $queryString = trim($this->request->getPathInfo(), '/');\n\n // split into chunks\n $chunks = (array) explode('/', $queryString);\n\n $hasMultiLanguages = $this->getContainer()->getParameter('site.multilanguage');\n\n // single language\n if (!$hasMultiLanguages) {\n // set language id\n $language = $this->get('fork.settings')->get('Core', 'default_language', SITE_DEFAULT_LANGUAGE);\n } else {\n // multiple languages\n // default value\n $mustRedirect = false;\n\n // get possible languages\n $possibleLanguages = (array) Language::getActiveLanguages();\n $redirectLanguages = (array) Language::getRedirectLanguages();\n\n // the language is present in the URL\n if (isset($chunks[0]) && in_array($chunks[0], $possibleLanguages)) {\n // define language\n $language = (string) $chunks[0];\n\n // try to set a cookie with the language\n try {\n // set cookie\n CommonCookie::set('frontend_language', $language);\n } catch (\\SpoonCookieException $e) {\n // settings cookies isn't allowed, because this isn't a real problem we ignore the exception\n }\n\n // set sessions\n \\SpoonSession::set('frontend_language', $language);\n\n // remove the language part\n array_shift($chunks);\n } elseif (CommonCookie::exists('frontend_language') &&\n in_array(CommonCookie::get('frontend_language'), $redirectLanguages)\n ) {\n // set languageId\n $language = (string) CommonCookie::get('frontend_language');\n\n // redirect is needed\n $mustRedirect = true;\n } else {\n // default browser language\n // set languageId & abbreviation\n $language = Language::getBrowserLanguage();\n\n // try to set a cookie with the language\n try {\n // set cookie\n CommonCookie::set('frontend_language', $language);\n } catch (\\SpoonCookieException $e) {\n // settings cookies isn't allowed, because this isn't a real problem we ignore the exception\n }\n\n // redirect is needed\n $mustRedirect = true;\n }\n\n // redirect is required\n if ($mustRedirect) {\n // build URL\n // trim the first / from the query string to prevent double slashes\n $url = rtrim('/' . $language . '/' . trim($this->getQueryString(), '/'), '/');\n // when we are just adding the language to the domain, it's a temporary redirect because\n // Safari keeps the 301 in cache, so the cookie to switch language doesn't work any more\n $redirectCode = ($url == '/' . $language ? 302 : 301);\n\n // set header & redirect\n throw new RedirectException(\n 'Redirect',\n new RedirectResponse($url, $redirectCode)\n );\n }\n }\n\n // define the language\n defined('FRONTEND_LANGUAGE') || define('FRONTEND_LANGUAGE', $language);\n defined('LANGUAGE') || define('LANGUAGE', $language);\n\n // sets the locale file\n Language::setLocale($language);\n\n // list of pageIds & their full URL\n $keys = Navigation::getKeys();\n\n // rebuild our URL, but without the language parameter. (it's tripped earlier)\n $url = implode('/', $chunks);\n $startURL = $url;\n\n // loop until we find the URL in the list of pages\n while (!in_array($url, $keys)) {\n // remove the last chunk\n array_pop($chunks);\n\n // redefine the URL\n $url = implode('/', $chunks);\n }\n\n // remove language from query string\n if ($hasMultiLanguages) {\n $queryString = trim(mb_substr($queryString, mb_strlen($language)), '/');\n }\n\n // if it's the homepage AND parameters were given (not allowed!)\n if ($url == '' && $queryString != '') {\n // get 404 URL\n $url = Navigation::getURL(404);\n\n // remove language\n if ($hasMultiLanguages) {\n $url = str_replace('/' . $language, '', $url);\n }\n }\n\n // set pages\n $url = trim($url, '/');\n\n // currently not in the homepage\n if ($url != '') {\n // explode in pages\n $pages = explode('/', $url);\n\n // reset pages\n $this->setPages($pages);\n\n // reset parameters\n $this->setParameters(array());\n }\n\n // set parameters\n $parameters = trim(mb_substr($startURL, mb_strlen($url)), '/');\n\n // has at least one parameter\n if ($parameters != '') {\n // parameters will be separated by /\n $parameters = explode('/', $parameters);\n\n // set parameters\n $this->setParameters($parameters);\n }\n\n // pageId, parentId & depth\n $pageId = Navigation::getPageId(implode('/', $this->getPages()));\n $pageInfo = Navigation::getPageInfo($pageId);\n\n // invalid page, or parameters but no extra\n if ($pageInfo === false || (!empty($parameters) && !$pageInfo['has_extra'])) {\n // get 404 URL\n $url = Navigation::getURL(404);\n\n // remove language\n if ($hasMultiLanguages) {\n $url = str_replace('/' . $language, '', $url);\n }\n\n // remove the first slash\n $url = trim($url, '/');\n\n // currently not in the homepage\n if ($url != '') {\n // explode in pages\n $pages = explode('/', $url);\n\n // reset pages\n $this->setPages($pages);\n\n // reset parameters\n $this->setParameters(array());\n }\n }\n\n // is this an internal redirect?\n if (isset($pageInfo['redirect_page_id']) && $pageInfo['redirect_page_id'] != '') {\n // get url for item\n $newPageURL = Navigation::getURL((int) $pageInfo['redirect_page_id']);\n $errorURL = Navigation::getURL(404);\n\n // not an error?\n if ($newPageURL != $errorURL) {\n // redirect\n throw new RedirectException(\n 'Redirect',\n new RedirectResponse(\n $newPageURL,\n $pageInfo['redirect_code']\n )\n );\n }\n }\n\n // is this an external redirect?\n if (isset($pageInfo['redirect_url']) && $pageInfo['redirect_url'] != '') {\n // redirect\n throw new RedirectException(\n 'Redirect',\n new RedirectResponse(\n $pageInfo['redirect_url'],\n $pageInfo['redirect_code']\n )\n );\n }\n }", "public static function buildUrl($params)\n {\n /** @var HttpRequestInterface $request */\n $request = self::fetchComponent(HttpRequestInterface::class);\n if ($request) {\n $data = isset($params['data']) ? $params['data'] : [];\n $query = $request->getQueryArray();\n foreach ($data as $key => $value) {\n $query[$key] = $value;\n }\n return $request->getPath() . '?' . http_build_query($query);\n }\n return \"\";\n }", "abstract protected function buildSpecificRequestUri();", "private function merge_query_params( $url, $params )\n\t{\n\t\t$urlparts = InputFilter::parse_url( $url );\n\n\t\tif ( ! isset( $urlparts['query'] ) ) {\n\t\t\t$urlparts['query'] = '';\n\t\t}\n\n\t\tif ( ! is_array( $params ) ) {\n\t\t\tparse_str( $params, $params );\n\t\t}\n\n\t\t$urlparts['query'] = http_build_query( array_merge( Utils::get_params( $urlparts['query'] ), $params ), '', '&' );\n\n\t\treturn InputFilter::glue_url( $urlparts );\n\t}", "public function index() {\n\t\tif ($this->config->get('config_seo_url')) {\n\t\t\t$this->url->addRewrite($this);\n\t\t}\n\n\t\t// Decode URL\n\t\tif (!isset($this->request->get['_route_'])) {\n\t\t\t$this->validateNoRoute();\n\t\t} else {\n\t\t\t$parts = explode('/', $this->request->get['_route_']);\n\n\t\t\t// remove any empty arrays from trailing\n\t\t\tif (utf8_strlen(end($parts)) == 0) {\n\t\t\t\tarray_pop($parts);\n\t\t\t}\n\n\t\t\tforeach ($parts as $part) {\n\n\t\t\t\t$query = $this->db->query(\"SELECT * FROM \" . DB_PREFIX . \"seo_url WHERE keyword = '\" . $this->db->escape($part) . \"' AND store_id = '\" . (int)$this->config->get('config_store_id') . \"'\");\n\t\t\t\tif ($query->num_rows) {\n\n\t\t\t\t\t$url = explode('=', $query->row['query']);\n\n\t\t\t\t\tif ($url[0] == 'product_id') {\n\t\t\t\t\t\t$this->request->get['product_id'] = $url[1];\n\t\t\t\t\t}\n\n\t\t\t\t\tif ($url[0] == 'category_id') {\n\t\t\t\t\t\tif (!isset($this->request->get['path'])) {\n\t\t\t\t\t\t\t$this->request->get['path'] = $url[1];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$this->request->get['path'] .= '_' . $url[1];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n if ($url[0] == 'collection_item_id') {\n $this->request->get['collection_item_id'] = $url[1];\n }\n\n if ($url[0] == 'collection_id') {\n $this->request->get['collection_id'] = $url[1];\n }\n\n\t\t\t\t\tif ($url[0] == 'manufacturer_id') {\n\t\t\t\t\t\t$this->request->get['manufacturer_id'] = $url[1];\n\t\t\t\t\t}\n\n if ($url[0] == 'inspiration_id') {\n $this->request->get['inspiration_id'] = $url[1];\n }\n\n\t\t\t\t\tif ($url[0] == 'information_id') {\n\t\t\t\t\t\t$this->request->get['information_id'] = $url[1];\n\t\t\t\t\t}\n\n\t\t\t\t\tif ($query->row['query'] && $url[0] != 'information_id' && $url[0] != 'manufacturer_id' && $url[0] != 'category_id' && $url[0] != 'product_id' && $url[0] != 'collection_id' && $url[0] != 'collection_item_id' && $url[0] != 'inspiration_id') {\n\t\t\t\t\t\t$this->request->get['route'] = $query->row['query'];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (isset($this->request->get['route']) && isset($this->request->get['manufacturer_id']) && $this->request->get['route'] == 'product/collection') {\n $this->request->get['brand_id'] = $this->request->get['manufacturer_id'];\n unset($this->request->get['manufacturer_id']);\n }\n\n\t\t\t\t} else {\n\t\t\t\t\t$this->request->get['route'] = 'extension/tltblog/tltblog_seo';\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!isset($this->request->get['route'])) {\n\t\t\t\tif (isset($this->request->get['product_id'])) {\n\t\t\t\t\t$this->request->get['route'] = 'product/product';\n\t\t\t\t} elseif (isset($this->request->get['path'])) {\n\t\t\t\t\t$this->request->get['route'] = 'product/category';\n\t\t\t\t} elseif (isset($this->request->get['manufacturer_id'])) {\n if(isset($this->request->get['collection_id'])){\n $this->request->get['route'] = 'product/manufacturer/infoCollection';\n }else{\n $this->request->get['route'] = 'product/manufacturer/info';\n }\n\t\t\t\t\t//$this->request->get['route'] = 'product/manufacturer/info';\n\t\t\t\t} elseif (isset($this->request->get['information_id'])) {\n\t\t\t\t\t$this->request->get['route'] = 'information/information';\n\t\t\t\t} elseif (isset($this->request->get['inspiration_id'])) {\n $this->request->get['route'] = 'product/inspiration/info';\n }\n\t\t\t}\n\n if(isset($this->request->get['route']) && $this->request->get['route'] == 'product/manufacturer/infoCollection' && empty($this->request->get['collection_id']) && !empty($this->request->get['collection_item_id'])){\n $collection_item_id = $this->request->get['collection_item_id'];\n $query = $this->db->query(\"SELECT `collection_id` FROM \" . DB_PREFIX . \"collection_item_to_category WHERE `collection_item_id` = $collection_item_id\");\n if($query->num_rows){\n $this->request->get['collection_id'] = $query->row['collection_id'];\n }\n }\n\n\t\t\t$this->validate();\n\t\t}\n\t}", "function url_for($url, $opts = array()) {\n // global $ActionController;\n // vde($opts);\n $routes = &ActionController::$routes;\n \n $params = null;\n $used_params = array();\n \n if (!empty($opts['anchor'])) {\n $anchor = $opts['anchor'];\n unset($opts['anchor']);\n } else\n $anchor = null;\n \n if (is_bool(strpos($url, '/')) && is_bool(strpos($url, 'www.'))) {\n \n # Complete the given $url.\n $url = parse_url_token($url);\n \n if (!empty($opts['compare_current_uri'])) {\n list($url_ctrl, $url_act) = explode('#', $url);\n if ($url_ctrl == Request::$controller && $url_act == Request::$action)\n return Request::$url;\n else\n unset($url_ctrl, $url_act, $opts['compare_current_uri']);\n }\n \n list($ctrl, $act) = explode('#', $url);\n \n if (array_key_exists($url, $routes)) {\n # $root isn't an array, there may be more like it.\n if (!is_array($routes[$url]))\n $route = $routes[$url];\n else\n $route = $routes[$url][0];\n \n /**\n * Replacing variables in route for $opts\n */\n # First check if url requires variables, and if they're in $opts\n # This is simmilar to 'Parse variables' in ActionController::routing()\n if (is_int(strpos($route, '$'))) {\n preg_match_all('/\\$([\\w]+)/', $route, $vars);\n $vars = $vars[1];\n \n foreach ($vars as $var) {\n \n \n // # If url requires parameters and they're not in options,\n // # return (or throw an exception).\n // if (!isset($opts[$var])) // Missing parameter for route.\n // die('Missing parameter for route.');\n if (!isset($opts[$var])) // Missing parameter for route.\n $opts[$var] = false;\n else {\n # If requirement isn't met, return (or throw an exception).\n if (isset($routes[$url]['requirements'][$var])) {\n $req = $routes[$url]['requirements'][$var];\n if (!preg_match('~^'.$req.'$~', $opts[$var]))\n die('Requirement not met for route parameter.'); // Requirement not met for route parameter.\n }\n }\n $used_params[] = $var;\n \n $bl = $opts[$var] === false ? '(?:\\/)?' : null;\n $route = preg_replace('~'.$bl.'\\$'.addslashes($var).'~', $opts[$var], $route);\n }\n }\n \n } else {\n\n foreach ($routes as $k => $route) {\n if (!is_int($k))\n continue;\n elseif (is_array($route))\n $r = $route[0];\n else\n $r = $route;\n \n preg_match_all('/\\$([\\w]+)/', $r, $vars);\n $vars = $vars[1];\n \n /* Find the matching route by checking the route's parameters.\n * All the route's parameters must be set in $opts and must\n * match requirement (if exists), otherwise the route is discarted.\n */\n foreach ($vars as $var) {\n $route_opts = $opts;\n $used_params = array();\n // vd($opts, 1);\n\n // vd($var, 2);\n if ($var == 'controller' || $var == 'action') {\n # We wont't need controller or action anymore.\n $used_params[] = $var;\n continue;\n } elseif ($var == 'format') {\n # We might need format later.\n continue;\n } \n \n // # Check if $$ctrl->$var exists to use it in params only if no options were given.\n if (!isset($route_opts[$var])) {\n // global ${$ctrl};\n // if (empty($opts) && isset(${$ctrl}->$var)) {\n // $route_opts[$var] = ${$ctrl}->$var;\n \n // } else\n $route_opts[$var] = false;\n }\n // vde($vars);\n if (isset($route['requirements'][$var]) && !preg_match('~^'.$route['requirements'][$var].'$~', $route_opts[$var]))\n continue 2;\n // vd($var);\n $used_params[] = $var;\n $bl = $route_opts[$var] === false ? '(?:\\/)?' : null;\n $r = preg_replace('~'.$bl.'\\$'.addslashes($var).'~', $route_opts[$var], $r);\n break;\n }\n // vd($r);\n $opts = array_merge($opts, $route_opts);\n \n # Replace $controller, $action and .$format in $r.\n if (is_int(strpos($r, '$controller')))\n $r = str_replace('$controller', $ctrl, $r);\n \n if (is_int(strpos($r, '$action'))) {\n # If action is 'index', we don't need to show so in the url.\n if ($act == 'index') {\n $r = str_replace(array('/$action', '$action'), '', $r);\n } else\n $r = str_replace('$action', $act, $r);\n }\n \n if (strstr($r, '.$format')) {\n # If format is in route, we won't need it later.\n $used_params[] = 'format';\n \n if (empty($opts['format']) || $opts['format'] == 'html')\n $opts['format'] = null;\n \n $r = str_replace('.$format', $opts['format'], $r);\n }\n \n $found = true;\n break;\n }\n if (!isset($found))\n die('Unable to find route for redirection');\n \n $route = $r;\n }\n \n $route = '/'.$route;\n \n } else\n $route = $url;\n // if (isset($opts['id']) && $opts['id'] == 22) {\n // $used_params;\n // }\n // vd($used_params);\n $opts_left = array_diff(array_keys($opts), $used_params);\n \n if($opts_left) {\n foreach($opts_left as $param)\n $params[] = $param.'='.u($opts[$param]);\n $params = '?' . implode('&', $params);\n }\n $anchor && $route .= '#'.$anchor;\n return $route.$params;\n}", "public function uri(array $params = NULL)\n\t{\n\t\tif ( ! isset($params['directory']))\n\t\t{\n\t\t\t// Add the current directory\n\t\t\t$params['directory'] = $this->directory;\n\t\t}\n\n\t\tif ( ! isset($params['controller']))\n\t\t{\n\t\t\t// Add the current controller\n\t\t\t$params['controller'] = $this->controller;\n\t\t}\n\n\t\tif ( ! isset($params['action']))\n\t\t{\n\t\t\t// Add the current action\n\t\t\t$params['action'] = $this->action;\n\t\t}\n\n\t\t// Add the current parameters\n\t\t$params += $this->_params;\n\n\t\treturn $this->route->uri($params);\n\t}", "private function createUrlByUrlParameters(\n Result $result,\n array $urlParameters\n ): array {\n foreach ($this->routesDictionary as $field => $route) {\n if (\n !isset($urlParameters[$field]) ||\n (\n is_array($urlParameters[$field]) &&\n count($urlParameters[$field]) !== 1\n )\n ) {\n continue;\n }\n\n $value = is_array($urlParameters[$field])\n ? reset($urlParameters[$field])\n : $urlParameters[$field];\n\n if (!$result\n ->getAggregation($field)\n ->getAllElements()[$value] instanceof Counter) {\n continue;\n }\n\n unset($urlParameters[$field]);\n $path = $this\n ->router\n ->getRouteCollection()\n ->get($route)\n ->getPath();\n preg_match_all(\n '~\\{(.+?)\\}~',\n $path,\n $matches\n );\n\n return [\n 'route' => urldecode($this\n ->router\n ->generate(\n $route,\n array_merge(\n array_intersect_key(\n $result\n ->getAggregation($field)\n ->getAllElements()[$value]\n ->getValues(),\n array_flip($matches[1])\n ),\n $urlParameters\n ),\n UrlGeneratorInterface::ABSOLUTE_URL\n )),\n 'url_parameters' => $urlParameters,\n 'template_path' => $path,\n 'field' => $field,\n ];\n }\n\n return [\n 'route' => urldecode($this\n ->router\n ->generate(\n $this->routesDictionary['main'],\n $urlParameters,\n UrlGeneratorInterface::ABSOLUTE_URL\n )),\n 'url_parameters' => $urlParameters,\n 'template_path' => urldecode($this\n ->router\n ->generate(\n $this->routesDictionary['main'],\n [],\n UrlGeneratorInterface::ABSOLUTE_URL\n )\n ),\n 'field' => false,\n ];\n }", "public function getUrl($params)\n {\n $path = $this->path;\n foreach ($params as $key => $value) {\n $path = str_replace(\":$key\", $value, $path);\n }\n return $path;\n }", "public function url(array $params = array(), $protocol = null)\n\t{\n\t\treturn\n\t\t\t// relative protocol?\n\t\t\t($protocol === null ? '//' : $protocol.'://').\n\t\t\t// url_base is set?\n\t\t\t($this->url_base ? $this->url_base : \\app\\CFS::config('ibidem/base')['url_base']).\n\t\t\t// append the uri\n\t\t\t'/'.$this->path;\t\t\n\t}", "function smarty_function_zurl($params, &$smarty) {\n $urlParams = array();\n $name = null;\n $reset = false;\n $encode = true;\n\n // Capture the module\n if (isset($params['module'])) {\n $urlParams['module'] = $params['module'];\n unset($params['module']);\n }\n\n // Capture the controller\n if (isset($params['controller'])) {\n $urlParams['controller'] = $params['controller'];\n unset($params['controller']);\n }\n\n // Capture the action\n if (isset($params['action'])) {\n $urlParams['action'] = $params['action'];\n unset($params['action']);\n }\n \n \n\n // Capture if a route name is specified\n if (isset($params['zend_url_name'])) {\n print_r ($params['zend_url_name']);\n $name = $params['zend_url_name'];\n unset($params['zend_url_name']);\n }\n\n // Capture if resetting the route is specified\n// if (isset($params['zend_url_reset'])) {\n// $reset = $params['zend_url_reset'] == \"true\"\n// ? true\n// : false;\n// unset($params['zend_url_reset']);\n// }\n $reset = true;\n\n // Capture if encoding parameters is specified\n if (isset($params['zend_url_encode'])) {\n $encode = $params['zend_url_encode'] == \"false\"\n ? false\n : true;\n unset($params['zend_url_encode']);\n }\n\n // Grab rest of the params and add them to urlParams\n foreach ( $params as $key => $val ) {\n $urlParams[ $key ] = $val;\n unset( $params[ $key ] );\n }\n\n // Assemble the url and pass it back\n\n return Zend_Controller_Front::getInstance()\n ->getRouter()->assemble(\n $urlParams,\n $name,\n $reset,\n $encode );\n}", "function buildSearchDetail(array $params = array()) {\n return url(\"tim-kiem\") . (count($params) > 0 ? '?' . http_build_query($params) : '');\n }", "protected function prepare($params) {\r\n\t\tif (isset($params['_args_'])) {\r\n\t\t\t$params = array_merge_recursive(Router::getArgs($params['_args_']), $params);\r\n\t\t\tunset($params['_args_']);\r\n\t\t}\r\n\t\treturn $params + array('url' => array());\r\n\t}", "private function splitUrl()\n {\n if (isset($_GET['apps'])) {\n\n $url = rtrim($_GET['apps'], '/');\n $url = filter_var($url, FILTER_SANITIZE_URL);\n $url = explode('/', $url);\n \n $this->url_controller = (isset($url[0]) ? $url[0] : null);\n $this->url_action = (isset($url[1]) ? $url[1] : null);\n $this->url_parameter_1 = (isset($url[2]) ? $url[2] : null);\n $this->url_parameter_2 = (isset($url[3]) ? $url[3] : null);\n $this->url_parameter_3 = (isset($url[4]) ? $url[4] : null);\n\t\t\t\n\n // for debugging. uncomment this if you have problems with the URL\t\t\t\n\t\t\t/*\n\t\t\t echo '<br/><br/><br/><br/><br/><br/><br/><br/>';\n echo 'Controller: ' . $this->url_controller . '<br />';\n echo 'Action: ' . $this->url_action . '<br />';\n echo 'Parameter 1: ' . $this->url_parameter_1 . '<br />';\n echo 'Parameter 2: ' . $this->url_parameter_2 . '<br />';\n echo 'Parameter 3: ' . $this->url_parameter_3 . '<br />';\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t*/\n }\n\t\telse\n\t\t{\n\t\t\tif (empty($_GET))\n\t\t\t{\n\t\t\t\t$this->url_controller = '';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$this->url_controller = '404';\n\t\t\t}\n\t\t}\n\t\t\n }", "private function parseParams() : array\n {\n $querySting = (parse_url($_SERVER['QUERY_STRING']))['path'];\n parse_str($querySting, $params);\n return $params;\n }", "private function getParamsUrlFormat() {\n $urlParams = \"\";\n\n if ($this->getMethod() == 'GET') {\n $urlParams .= ($this->getPaging()) ? \n \"?_paging=1\" : \n \"\";\n $urlParams .= ($this->getPaging()) ? \n \"&_return_as_object=1\" : \n \"\";\n $urlParams .= ($this->getPaging()) ? \n \"&_max_results=\" . $this->getMaxResults() : \n \"\";\n }\n\n if ($this->getMethod() == 'POST') {\n $function = $this->getFuction();\n $urlParams .= (isset($function) and $function != \"\") ?\n \"?_function=\" . $this->getFuction() :\n \"\";\n }\n\n return $urlParams;\n }", "function generate(array $params) {\n $route = $this->_route;\n\n if ($controller = $params['controller'] and substr($controller, -10) == 'Controller') {\n $params['controller'] = underscore(substr($controller, 0, -10));\n }\n\n if (!$params['action']) {\n $params['action'] = 'index';\n }\n\n # Expand object parameters\n foreach ($params as $key => $value) {\n if (is_object($value)) {\n if (method_exists($value, 'to_param')) {\n $params[$key] = $value->to_param;\n } else {\n throw new TypeError($value, \"Missing to_param() method in class '%s'\");\n }\n }\n }\n\n # Remove fixed parameters, abort if they don't match this route\n foreach ($this->_fixed as $key => $value) {\n if ($params[$key] != $value) {\n return;\n } else {\n unset($params[$key]);\n }\n }\n\n # Check for required parameters\n foreach ($this->_required as $key) {\n if (!isset($params[$key])) {\n return;\n }\n }\n\n # Check for format specifications\n foreach ($this->_formats as $key => $format) {\n if ($value = $params[$key] and !preg_match($format, $value)) {\n return;\n }\n }\n\n # Apply default values\n foreach ($this->_defaults as $key => $value) {\n if (!isset($params[$key]) and isset($this->_params[$key])) {\n $params[$key] = $value;\n }\n }\n\n # Replace all route symbols\n $add = false;\n foreach (array_reverse($this->_params) as $key => $symbol) {\n $value = $params[$key];\n unset($params[$key]);\n\n if ($add or (!is_null($value) and $value !== '' and $value != $this->_defaults[$key])) {\n $route = str_replace($symbol, $value, $route);\n $add = true;\n }\n }\n\n # Add remaining parameters to query string\n if ($params) {\n $query = array();\n\n foreach ($params as $key => $value) {\n if (!is_null($value) and (!array_key_exists($key, $this->_defaults) or $value != $this->_defaults[$key])) {\n if (is_numeric($key)) {\n $query[] = urlencode($value);\n } elseif (is_array($value)) {\n $query[] = strtr(http_build_query(array($key => $value)), array(\n '%5B' => '[', '%5D' => ']'\n ));\n } else {\n $query[] = strtr(urlencode($key), array(\n '%5B' => '[', '%5D' => ']'\n )).'='.urlencode($value);\n }\n }\n }\n\n if ($query) {\n $route .= '?'.implode('&', $query);\n }\n }\n\n return preg_replace('#/?[:*][a-z_]+!?#', '', $route);\n }", "function buildQueryString($params, $parent=\"\")\n{\n\t$query = \"\";\n\n\tforeach ($params as $key => $value)\n\t{\n\t\tif (!empty($query))\n\t\t$query .= '&';\n\n\t\tif (!empty($parent))\n\t\t$key = \"{$parent}[{$key}]\";\n\n\t\tif (!is_array($value))\n\t\t{\n\t\t\t$query .= \"$key=\".rawurlencode($value);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$query .= buildQueryString($value, $key);\n\t\t}\n\t}\n\n\treturn $query;\n}", "function url($array = false, $keep=false, $validate = true, $SiteUrlOnEmptyParamSet = false, $getAliases = true) {\n if(is_string($array) && !is_numeric($array) && strtolower(substr($array, 0, 4)) == 'www.') return 'http://'.$array;\n\n $pass = array();\n if($array == false) $array = array();\n if(!is_array($array)) $array = array('id' => $array);\n if($keep === true) {\n $keep = $_GET->keys();\n }\n elseif($keep !== false && !is_array($keep)) $keep = array($keep);\n if(!is_array($keep)) $keep = array();\n foreach($_REQUEST as $g => $v) {\n if(!in_array($g, $keep)) continue;\n elseif(is_array($v)) {\n foreach($v as $a => $b) {\n if(!empty($b)) $pass[$g][$a] = $b;\n }\n }\n else $pass[$g] = $v;\n }\n $parts = array_merge($pass,$array);\n $validParts = array();\n foreach($parts as $key => $val) {\n if($key == '#') continue;\n if(!$validate || ($_REQUEST->validate($key, $val) || $_GET->validate($key, $val))) {\n $validParts[$key] = $val;\n }\n }\n $url = '';\n //FIXME: Config\n // Short-URL\n if(true && isset($validParts['id'])) {\n global $Controller;\n if(is_numeric($validParts['id']) && $getAliases) {\n if($obj = $Controller->get($validParts['id'], OVERRIDE))\n if($alias = $obj->alias) $validParts['id'] = $alias;\n } elseif(is_object($validParts['id'])) {\n if($alias = $validParts['id']->alias) $validParts['id'] = $alias;\n else $validParts['id'] = $validParts['id']->ID;\n }\n $url = '/'.($validParts['id'] != 'frontpage'?$validParts['id']:'');\n unset($validParts['id']);\n }\n $query = http_build_query($validParts,'','&amp;');\n if(!empty($query)) $url .= '?'.$query;\n if(isset($array['#'])) $url.='#'.$array['#'];\n if((!empty($url) || $SiteUrlOnEmptyParamSet) && $SiteUrlOnEmptyParamSet != -1) {\n global $SITE;\n $url = $SITE->URL.$url;\n }\n return $url;\n}", "private function explodeUri(): void\n {\n if (!isset($this->uri)) {\n return;\n }\n\n $path = $this->removePrefix($this->uri);\n $split = explode('?', $path);\n $this->segments = explode('/', rtrim(ltrim($split[0], '/'), '/'));\n\n if (isset($split[1])) {\n $list = explode('&', $split[1]);\n\n foreach ($list as $elem) {\n $pair = explode('=', $elem);\n\n if (isset($pair[1])) {\n $this->params[$pair[0]]\n = \\miniworx\\Application\\Utils\\Sanitation::sanitizeUrl(\n $pair[1]\n );\n }\n }\n }\n }", "public function assemble(\n array $params = array(),\n array $options = array()\n ) {\n if (!$params) {\n return $this->prefix;\n }\n\n $url = parent::assemble($params, $options);\n $urlPrefix = $this->prefix . $this->paramDelimiter\n . $this->defaults['module'];\n $urlSuffix = substr($url, strlen($urlPrefix));\n $url = $this->prefix . $urlSuffix;\n\n return $url;\n }", "public function prepareLinks($params) {\n\t\t\n\t\t$defaultParams = array(\n\t\t\t'text' => '',\n\t\t\t'queryString' => '',\n\t\t\t'separator' => '?',\n\t\t\t'type' => 'HTML'\n\t\t);\n\t\t\n\t\t$params = array_merge($defaultParams, $params);\n\t\t\n\t\t// nothing to substitute => return\n\t\tif (!$params['queryString']) {\n\t\t\treturn $params['text'];\n\t\t}\n\t\t\n\t\t// search in HTML or in text?\n\t\tswitch(strtolower($params['type'])) {\n\t\t\t\n\t\t\tcase 'text':\n\t\t\t\tpreg_match_all('/(https?:\\/\\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w \\.-]*)*\\/?/i', $params['text'], $match);\n\t\t\t\t$tagFragments = $match[0];\n\t\t\t\t$links = $match[0];\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tdefault:\n\t\t\tcase 'html':\n\t\t\t\tpreg_match_all('/\\<a.*href\\=[\\'\"\\s]?([^\\'\"\\s]+)/i', $params['text'], $match);\n\t\t\t\t$tagFragments = $match[0];\n\t\t\t\t$links = $match[1];\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t}\n\t\n\t\t$extendedFragments = array();\n\t\t\n\t\t// extend links\n\t\tforeach ($tagFragments as $key => $tagFragment) {\n\t\t\t\n\t\t\tif (strstr($links[$key], '?')) {\n\t\t\t\t$separator = '&';\n\t\t\t} else {\n\t\t\t\t$separator = $params['separator'];\n\t\t\t}\n\t\t\t\n\t\t\t$extendedFragments[$key] = str_ireplace($links[$key], $links[$key] . $separator . $params['queryString'], $tagFragment);\n\t\t}\n\t\t\n\t\t$text = $params['text'];\n\t\tforeach ($tagFragments as $key => $tagFragment) {\n\t\t\t$text = str_ireplace($tagFragment, $extendedFragments[$key], $text);\n\t\t}\n\t\t\n\t\treturn $text;\n\t\t\n\t}", "public function createUrl($params)\n {\n $params = array_merge(['lang'=> $this->currLang],(array)$params);\n $lang = $params['lang'];\n if ($this->enablePrettyUrl)\n unset($params['lang']);\n $url = parent::createUrl($params);\n return $this->enablePrettyUrl ? '/'.$lang . ($url === '/' ? '' : $url ) : $url;\n }", "function getUrl($endpoint_id, $user_params) \n {\n global $endpoints_master;\n\n // validate the endpoint id is valid\n if (!array_key_exists($endpoint_id, $endpoints_master))\n shared::ex(EX_INVALID_ENDPOINT_ID . ': ' . $endpoint_id);\n\n // get the endpoint definition including url and list of valid parameters\n $endpoint = \n $endpoints_master[$endpoint_id];\n\n // are all the parameters passed in legit? bad ones will gunk up the api\n $invalid_params = \n array_diff(\n shared::map_to_member($user_params, 'name'), // names of user-provided parameters\n shared::map_to_member($endpoint['params'], 'name')); // names of valid parameters for this endpoint\n \n // if we found any, throw exception\n if (count($invalid_params) > 0)\n shared::ex(EX_INVALID_PARAMETER_SUPPLIED);\n\n // verified params have the necessary defaults added and all required params\n $verified_user_params =\n $this->check_requireds_and_add_defaults($endpoint, $user_params);\n\n // add any required auto-parameters (api key, api secret)\n $final_params = \n array_merge(\n $verified_user_params\n , auto_param($endpoint, 'requires_api_secret', KEY_API_SECRET, API_SECRET)\n , auto_param($endpoint, 'requires_api_key', KEY_API_KEY, API_KEY)\n , auto_param($endpoint, 'requires_access_token', KEY_ACCESS_TOKEN, ACCESS_TOKEN));\n\n\n // convert our format to the format required for http_build_query \n // e.g.\n // [ ('name'=>'limit','val'=>30), ('name' => 'forum', 'val'='disqus') ]\n // becomes \n // [ ('limit' => 30), ('forum'=>'disqus') ]\n $transformed_params = \n array_map(\n function($val) { return array($val['name'] => $val['val']); }\n , $final_params);\n\n\n // map each transformed parameter record to a url-encoded key=value string\n // e.g.\n // [ ('limit' => 30), ('forum'=>'disqus') ]\n // becomes\n // [ \"limit=30\", \"forum=disqus\" ]\n $mapped = \n array_map(\n function($v){ return http_build_query($v); }\n , $transformed_params);\n\n\n // implode the various key=value strings into key=value&key2=value2&...\n $qry_str = \n implode('&', $mapped);\n\n\n // combine the endpoint url and the query string into full abc/def.ghi?param1=val1&param2=val2 string\n // the hostname and root of the url will be added elsewhere\n return $endpoint['url'] . '?' . $qry_str;\n }", "public function url(array $params = NULL, $protocol = NULL)\n\t{\n\t\t// Create a URI with the current route and convert it to a URL\n\t\treturn URL::site($this->uri($params), $protocol);\n\t}", "protected function addToCurrentUrl($arrParams)\r\n\t{\r\n\t\t$strUrl = $this->Environment->request;\r\n\t\t\r\n\t\tforeach($arrParams as $arrParam)\r\n\t\t{\r\n\t\t\t$strUrl .= (strpos($strUrl, '?') !== false) ? '&' : '?';\t\r\n\t\t\t$strUrl .= $arrParam[0] . '=' . $arrParam[1];\r\n\t\t}\r\n\t\t\r\n\t\treturn $strUrl;\r\n\t}", "function url($route,$params=array(),$ampersand='&')\n{\n\tif (Yii::app() instanceof CConsoleApplication)\n\t{\n\t\treturn Yii::app()->params['host'].Yii::app()->getUrlManager()->createUrl($route,$params,$ampersand);\n\t}\n\telse\t\n\t\treturn Yii::app()->createUrl($route,$params,$ampersand);\n}", "public static function routePathProvider(): array\n {\n return [\n // Controller + action\n [\n 'Bookmarks::view',\n [\n 'controller' => 'Bookmarks',\n 'action' => 'view',\n ],\n ],\n // Prefix controller\n [\n 'Admin/Bookmarks::view',\n [\n 'controller' => 'Bookmarks',\n 'action' => 'view',\n 'prefix' => 'Admin',\n ],\n ],\n // Nested prefixes\n [\n 'LongPrefix/BackEnd/Bookmarks::view',\n [\n 'controller' => 'Bookmarks',\n 'action' => 'view',\n 'prefix' => 'LongPrefix/BackEnd',\n ],\n ],\n // Plugins\n [\n 'Cms.Articles::edit',\n [\n 'controller' => 'Articles',\n 'action' => 'edit',\n 'plugin' => 'Cms',\n ],\n ],\n // Vendor plugins & nested prefix\n [\n 'Vendor/Cms.Management/Admin/Articles::view',\n [\n 'controller' => 'Articles',\n 'action' => 'view',\n 'plugin' => 'Vendor/Cms',\n 'prefix' => 'Management/Admin',\n ],\n ],\n\n // Passed parameters\n [\n 'Bookmarks::view/1/',\n [\n 'controller' => 'Bookmarks',\n 'action' => 'view',\n '1',\n ],\n ],\n [\n 'Bookmarks::view/1',\n [\n 'controller' => 'Bookmarks',\n 'action' => 'view',\n '1',\n ],\n ],\n [\n 'Cms.Articles::edit/2023/03/5th',\n [\n 'controller' => 'Articles',\n 'action' => 'edit',\n 'plugin' => 'Cms',\n '2023',\n '03',\n '5th',\n ],\n ],\n [\n 'Bookmarks::view/organization=cakephp/repository=debug_kit',\n [\n 'controller' => 'Bookmarks',\n 'action' => 'view',\n 'organization' => 'cakephp',\n 'repository' => 'debug_kit',],\n ],\n [\n 'Bookmarks::view/organization=cakephp/bake',\n [\n 'controller' => 'Bookmarks',\n 'action' => 'view',\n 'organization' => 'cakephp',\n 'bake',\n ],\n ],\n [\n 'Bookmarks::view/organization=\"cakephp=test\"',\n [\n 'controller' => 'Bookmarks',\n 'action' => 'view',\n 'organization' => 'cakephp=test',\n ],\n ],\n [\n \"Bookmarks::view/test='repo=debug_kit'\",\n [\n 'controller' => 'Bookmarks',\n 'action' => 'view',\n 'test' => 'repo=debug_kit',\n ],\n ],\n [\n 'Bookmarks::view/organization=\"cakephp=test\"/test=\\'repo=debug_kit\\'',\n [\n 'controller' => 'Bookmarks',\n 'action' => 'view',\n 'organization' => 'cakephp=test',\n 'test' => 'repo=debug_kit',\n ],\n ],\n [\n \"Bookmarks::view/organization='cakephp='\",\n [\n 'controller' => 'Bookmarks',\n 'action' => 'view',\n 'organization' => 'cakephp=',\n ],\n ],\n [\n \"Bookmarks::view/organization='cakephp'\",\n [\n 'controller' => 'Bookmarks',\n 'action' => 'view',\n 'organization' => 'cakephp',\n ],\n ],\n [\n \"Bookmarks::view/organization='[email protected]~1!#$%^&*()'\",\n [\n 'controller' => 'Bookmarks',\n 'action' => 'view',\n 'organization' => '[email protected]~1!#$%^&*()',\n ],\n ],\n ];\n }", "public function fullUrlFor(array $params, Smarty_Internal_Template $template): string\n {\n return $this->routeParser->fullUrlFor($this->uri, $params['name'], $params['data'] ?? [], $params['queryParams'] ?? []);\n }", "protected function initReverseParams (& $reverse, & $reverseSectionsInfo, & $constraints, & $match = NULL) {\n\t\t$result = [];\n\t\t$completeMatch = $match !== NULL;\n\t\t$reverseIndex = 0;\n\t\t$matchIndex = 0;\n\t\t$sectionIndex = 0;\n\t\t$section = $reverseSectionsInfo[$sectionIndex];\n\t\t$reverseLength = mb_strlen($reverse);\n\t\t$greedyCaught = FALSE;\n\t\t$matchOpenPos = -1;\n\t\t$matchClosePos = -1;\n\t\t$this->lastPatternParam = '';\n\t\twhile ($reverseIndex < $reverseLength) {\n\t\t\t$reverseOpenPos = mb_strpos($reverse, '<', $reverseIndex);\n\t\t\t$reverseClosePos = FALSE;\n\t\t\tif ($reverseOpenPos !== FALSE) {\n\t\t\t\t$reverseClosePos = mb_strpos($reverse, '>', $reverseOpenPos);\n\t\t\t\tif ($completeMatch) {\n\t\t\t\t\t$matchOpenPos = mb_strpos($match, '<', $matchIndex);\n\t\t\t\t\t$matchClosePos = mb_strpos($match, '>', $matchOpenPos) + 1;\n\t\t\t\t}}\n\t\t\tif ($reverseClosePos === FALSE) break;// no other param caught\n\t\t\t// check if param belongs to current section\n\t\t\t// and if not, move to next (or next...) section\n\t\t\t$reverseClosePos += 1;\n\t\t\tif ($reverseClosePos > $section->end) {\n\t\t\t\t$reverseSectionsInfoCountMinusOne = count($reverseSectionsInfo) - 1;\n\t\t\t\twhile ($sectionIndex < $reverseSectionsInfoCountMinusOne) {\n\t\t\t\t\t$nextSection = $reverseSectionsInfo[$sectionIndex + 1];\n\t\t\t\t\tif ($reverseClosePos > $nextSection->end) {\n\t\t\t\t\t\t$sectionIndex += 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$sectionIndex += 1;\n\t\t\t\t\t\t$section = $reverseSectionsInfo[$sectionIndex];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}}}\n\t\t\t// complete param section length and param name\n\t\t\t$paramLength = $reverseClosePos - $reverseOpenPos;\n\t\t\t$paramName = mb_substr($reverse, $reverseOpenPos + 1, $paramLength - 2);\n\t\t\tlist ($greedyFlag, $sectionIsLast) = $this->initReverseParamsGetGreedyInfo(\n\t\t\t\t$reverseSectionsInfo, $constraints,\n\t\t\t\t$paramName, $sectionIndex, $greedyCaught\n\t\t\t);\n\t\t\tif ($greedyFlag && $sectionIsLast) {\n\t\t\t\t$lastSectionChar = mb_substr(\n\t\t\t\t\t$reverse, $reverseClosePos, $reverseSectionsInfo[$sectionIndex]->end - $reverseClosePos\n\t\t\t\t);\n\t\t\t\tif ($lastSectionChar == '/') {\n\t\t\t\t\t$lastSectionChar = '';\n\t\t\t\t\t$reverseSectionsInfo[$sectionIndex]->end -= 1;\n\t\t\t\t}\n\t\t\t\tif ($lastSectionChar === '')\n\t\t\t\t\t$this->lastPatternParam = $paramName;\n\t\t\t}\n\t\t\t$result[$paramName] = (object) [\n\t\t\t\t'name'\t\t\t=> $paramName,\n\t\t\t\t'greedy'\t\t=> $greedyFlag,\n\t\t\t\t'sectionIndex'\t=> $sectionIndex,\n\t\t\t\t\t'length'\t\t=> $paramLength,\n\t\t\t\t'reverseStart'\t=> $reverseOpenPos,\n\t\t\t\t'reverseEnd'\t=> $reverseClosePos,\n\t\t\t\t'matchStart'\t=> $matchOpenPos,\n\t\t\t\t'matchEnd'\t\t=> $matchClosePos,\n\t\t\t];\n\t\t\t$reverseIndex = $reverseClosePos;\n\t\t\t$matchIndex = $matchClosePos;\n\t\t}\n\t\treturn $result;\n\t}", "private function parseRoutes()\n {\n // Turn the segment array into a URI string\n $uri = implode('/', $this->uri->getSegments());\n // Is there a literal match? If so we're done\n if (isset($this->routes[$uri])) {\n return $this->setRequest(explode('/', $this->routes[$uri]));\n }\n\n // Loop through the route array looking for wild-cards\n foreach ($this->routes as $key => $val) {\n // Convert wild-cards to RegEx\n $key = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $key));\n // Does the RegEx match?\n if (preg_match('#^'.$key.'$#', $uri)) {\n // Do we have a back-reference?\n if (strpos($val, '$') !== false && strpos($key, '(') !== false) {\n $val = preg_replace('#^'.$key.'$#', $val, $uri);\n }\n\n return $this->setRequest(explode('/', $val));\n }\n }\n\n // If we got this far it means we didn't encounter a\n // matching route so we'll set the site default route\n $this->setRequest($this->uri->getSegments());\n }", "public function parseRequest ($request)\n {\n echo '<br><br><br><pre style=\"text-align: center; font-weight: bold; font-size: large;\">===^ BeeUrlManager ^===</pre>';\n\n //return parent::parseRequest($request);\n\n // From Yii\n if ($this->enablePrettyUrl) {\n $pathInfo = $request->getPathInfo();\n\n /* @var $rule UrlRule */\n foreach ($this->rules as $rule) {\n if (($result = $rule->parseRequest($this, $request)) !== FALSE) {\n return $result;\n }\n }\n\n if ($this->enableStrictParsing) {\n return FALSE;\n }\n\n Yii::trace('No matching URL rules. Using default URL parsing logic.', __METHOD__);\n\n $suffix = (string)$this->suffix;\n if ($suffix !== '' && $pathInfo !== '') {\n $n = strlen($this->suffix);\n if (substr_compare($pathInfo, $this->suffix, -$n, $n) === 0) {\n $pathInfo = substr($pathInfo, 0, -$n);\n if ($pathInfo === '') {\n // suffix alone is not allowed\n return FALSE;\n }\n } else {\n // suffix doesn't match\n return FALSE;\n }\n }\n\n return [$pathInfo, []];\n } else {\n Yii::trace('Pretty URL not enabled. Using default URL parsing logic.', __METHOD__);\n $route = $request->getQueryParam($this->routeParam, '');\n if (is_array($route)) {\n $route = '';\n }\n\n return [(string) $route, []];\n }\n\n // Парсинг УРЛ\n //if ($this->enablePrettyUrl) {\n // $pathInfo = $request->getPathInfo();\n // $language = explode('/', $pathInfo)[0];\n // //$locale = ArrayHelper::getValue(self::$allLanguages->getLanguagesStructure()->aliases, $language, $language);\n //\n // if (in_array($request, self::$allLanguages->getLanguagesStructure()->aliases)) {\n // $request->setPathInfo(substr_replace($pathInfo, '', 0, (strlen($language) + 1)));\n // }\n //\n // //return [$pathInfo, []];\n //} else {\n // $params = $request->getQueryParams();\n // $route = isset($params[$this->routeParam]) ? $params[$this->routeParam] : '';\n // if (is_array($route)) {\n // $route = '';\n // }\n // $language = explode('/', $route)[0];\n // //$locale = ArrayHelper::getValue(self::$allLanguages->getLanguagesStructure()->aliases, $language, $language);\n //\n // if (in_array($language, self::$allLanguages->getLanguagesStructure()->languages)) {\n // $route = substr_replace($route, '', 0, (strlen($language) + 1));\n // $params[$this->routeParam] = $route;\n // $request->setQueryParams($params);\n // }\n // //return [(string) $route, []];\n //}\n }", "public function replaceUrl($params = array())\n {\n $url = $this->request->getSchemeAndHttpHost().$this->request->getBaseUrl().$this->request->getPathInfo();\n $array = $this->request->query->all();\n unset($array[$this->getControllerName().'/'.$this->getActionName()]);\n $params = array_merge($array, $params);\n if (!empty($params)) {\n $url = $url.'?'.http_build_query($params);\n }\n return $url;\n }", "protected function prepareURL() {\n $request = trim($_SERVER['REQUEST_URI'], '/');\n if( !empty($request)) {\n $url = explode('/', $request); // split the request into an array of controller, action, parameters\n \n // is controller is given, then set that name as controller\n // if this is empty, then make homeController as default controller\n $this->controller = isset($url[0]) ? $url[0].'Controller' : 'accountController';\n \n // action to be performed\n // it is specified after the controller name in the url\n // \n $this->action = isset($url[1]) ? $url[1]: 'index';\n \n unset($url[0], $url[1]); // delete this values from the url so that we can have parameters only\n \n // now add the parameters passed, to the prams array\n $this->prams = !empty($url) ? array_values($url) : [];\n }\n }", "function build_url_params ($url_params, $params = '')\n{\n\tforeach ($url_params as $k=>$v)\n\t{\n\t\t$params .= (strlen($params) ? '&' : '?') . $k . '=' . urlencode($v);\n\t}\n\t\n\treturn $params;\n}", "private function buildParams($params) \n {\n if ($params['action']) {\n $action = $params['action'];\n\n unset($params['action']);\n\n return http_build_query(\n [ 'action' => $action, 'request' => $params ]\n );\n } \n\n return http_build_query($params);\n }", "function processUriParams() {\n\t\t$params = array();\n\t\t$uriParams = explode('/', trim($this->_uri, '/'));\n\t\t$count = count($uriParams);\n\t\tif($count > 0) {\n\t\t\tfor($i = 0; $i < $count; $i++) {\n\t\t\t\t$val = isset($uriParams[($i + 1)]) ? $uriParams[($i + 1)] : null;\n\t\t\t\t$params[$uriParams[$i]] = urldecode(is_numeric($val) ? (int) $val : $val);\n\t\t\t}\n\t\t\t$this->_uriParams = $params;\n\t\t}\n\t}", "public function getQueryUrl(\n string $endpoint,\n ?array $parameters,\n ?array $metadata = null\n )\n {\n // Form basic URI\n $baseUrl = array();\n $baseUrl['baseUrl'] = Config::get('elvis.api_endpoint_uri');\n $baseUrl['endpoint'] = $endpoint;\n\n // Add filename to Zip download\n if ($endpoint === 'zip') {\n $baseUrl['zipFilename'] = '/' . $parameters['filename'];\n unset($parameters['filename']);\n\n // Remove services, since zip download is at the root\n $baseUrl['baseUrl'] = str_replace('services/', '', $baseUrl['baseUrl']);\n }\n\n // Move assetId for checkout and undocheckout\n if ($endpoint === 'checkout' || $endpoint === 'undocheckout') {\n $baseUrl[$endpoint] = '/' . $parameters['assetId'];\n\n // Set parameters to null, since nothing else left\n $parameters = null;\n }\n\n // Cast the selected facets in to the correct form.\n if (!empty($parameters['facetSelection'])) {\n $facetSelection = $this->rekeyFacetSelection($parameters['facetSelection']);\n\n // Remove the original facet selection\n unset($parameters['facetSelection']);\n\n // Add the facet selection terms to the parameters array.\n $parameters = array_merge($parameters, $facetSelection);\n }\n\n // Form query parameter\n $queryParameters = $this->formQueryParameters($parameters, $metadata);\n\n // Combine base url and query parameters\n $combinedUrl = array_merge($baseUrl, $queryParameters);\n\n // Form complete URI by imploding the array\n $uri = implode('', $combinedUrl);\n\n return $uri;\n }", "function parse($url) {\r\n\t\tif ($url && ('/' != $url[0])) {\r\n\t\t\tif (!defined('SERVER_IIS')) {\r\n\t\t\t\t$url = '/' . $url;\r\n\t\t\t}\r\n\t\t}\r\n\t\t$out = array();\r\n\t\t$r = null;\r\n\t\t$default_route = array('/:controller/:action/* (default)',\r\n\t\t\t\t\t\t\t\t'/^(?:\\/(?:([a-zA-Z0-9_\\\\-\\\\.\\\\;\\\\:]+)(?:\\\\/([a-zA-Z0-9_\\\\-\\\\.\\\\;\\\\:]+)(?:[\\\\/\\\\?](.*))?)?))[\\\\/]*$/',\r\n\t\t\t\t\t\t\t\tarray('controller', 'action'), array());\r\n\r\n\t\tif (defined('CAKE_ADMIN') && $this->__admin != null) {\r\n\t\t\t$this->routes[]=$this->__admin;\r\n\t\t\t$this->__admin =null;\r\n\t\t}\r\n\t\t$this->connect('/bare/:controller/:action/*', array('bare' => '1'));\r\n\t\t$this->connect('/ajax/:controller/:action/*', array('bare' => '1'));\r\n\r\n\t\tif (defined('WEBSERVICES') && WEBSERVICES == 'on') {\r\n\t\t\t$this->connect('/rest/:controller/:action/*', array('webservices' => 'Rest'));\r\n\t\t\t$this->connect('/rss/:controller/:action/*', array('webservices' => 'Rss'));\r\n\t\t\t$this->connect('/soap/:controller/:action/*', array('webservices' => 'Soap'));\r\n\t\t\t$this->connect('/xml/:controller/:action/*', array('webservices' => 'Xml'));\r\n\t\t\t$this->connect('/xmlrpc/:controller/:action/*', array('webservices' => 'XmlRpc'));\r\n\t\t}\r\n\t\t$this->routes[] = $default_route;\r\n\r\n\t\tif (strpos($url, '?') !== false) {\r\n\t\t\t$url = substr($url, 0, strpos($url, '?'));\r\n\t\t}\r\n\r\n\t\tforeach($this->routes as $route) {\r\n\t\t\tlist($route, $regexp, $names, $defaults) = $route;\r\n\r\n\t\t\tif (preg_match($regexp, $url, $r)) {\r\n\t\t\t\t// remove the first element, which is the url\r\n\t\t\t\tarray_shift ($r);\r\n\t\t\t\t// hack, pre-fill the default route names\r\n\t\t\t\tforeach($names as $name) {\r\n\t\t\t\t\t$out[$name] = null;\r\n\t\t\t\t}\r\n\t\t\t\t$ii=0;\r\n\r\n\t\t\t\tif (is_array($defaults)) {\r\n\t\t\t\t\tforeach($defaults as $name => $value) {\r\n\t\t\t\t\t\tif (preg_match('#[a-zA-Z_\\-]#i', $name)) {\r\n\t\t\t\t\t\t\t$out[$name] = $value;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t$out['pass'][] = $value;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tforeach($r as $found) {\r\n\t\t\t\t\t// if $found is a named url element (i.e. ':action')\r\n\t\t\t\t\tif (isset($names[$ii])) {\r\n\t\t\t\t\t\t$out[$names[$ii]] = $found;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// unnamed elements go in as 'pass'\r\n\t\t\t\t\t\t$found = explode('/', $found);\r\n\t\t\t\t\t\t$pass = array();\r\n\t\t\t\t\t\tforeach($found as $key => $value) {\r\n\t\t\t\t\t\t\tif ($value == \"0\") {\r\n\t\t\t\t\t\t\t\t$pass[$key] = $value;\r\n\t\t\t\t\t\t\t} elseif ($value) {\r\n\t\t\t\t\t\t\t\t$pass[$key] = $value;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t$out['pass'] = $pass;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$ii++;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $out;\r\n\t}", "public function initialize(){ \n $protocol = 'http';\n $host = 'localhost';\n $path = '';\n $url = '';\n \n if (isset($_SERVER['HTTP_HOST'])) {\n $protocol = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';\n $host = $_SERVER['HTTP_HOST'];\n $path = str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);\n $url = $protocol.'://'.$host.$path;\n }\n \n $url = trim($url, '/');\n\n $request = $_SERVER[\"REQUEST_URI\"];\n $request = trim($request, '/'); \n $request = explode('?', $request); \n \n // Remove the folder segments from the uri if the application is warking in a subfolder.\n $parts = explode('/', $url);\n $this->segments = explode('/', $request[0]);\n foreach($this->segments as $key => $segment){\n if(in_array($segment, $parts)){\n unset($this->segments[$key]);\n }\n else{\n $this->segments[$key] = $this->sanitize($segment);\n }\n }\n // Re-index the segments\n $this->segments = array_values($this->segments);\n \n $this->url = $protocol.'://'.$host.'/'.$_SERVER[\"REQUEST_URI\"];\n \n return $this->url;\n }", "function cot_url_custom($name, $params = '', $tail = '', $htmlspecialchars_bypass = false)\n{\n\tglobal $cfg, $cot_urltrans, $sys;\n\t// Preprocess arguments\n\tif (is_string($params))\n\t{\n\t\t$params = cot_parse_str($params);\n\t}\n\t$area = empty($cot_urltrans[$name]) ? '*' : $name;\n\t// Find first matching rule\n\t$url = $cot_urltrans['*'][0]['trans']; // default rule\n\t$rule = array();\n\tif (!empty($cot_urltrans[$area]))\n\t{\n\t\tforeach($cot_urltrans[$area] as $rule)\n\t\t{\n\t\t\t$matched = true;\n\t\t\tforeach($rule['params'] as $key => $val)\n\t\t\t{\n\t\t\t\tif (empty($params[$key])\n\t\t\t\t\t|| (is_array($val) && !in_array($params[$key], $val))\n\t\t\t\t\t|| ($val != '*' && $params[$key] != $val))\n\t\t\t\t{\n\t\t\t\t\t$matched = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ($matched)\n\t\t\t{\n\t\t\t\t$url = $rule['trans'];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t// Some special substitutions\n\t$spec['_area'] = $name;\n\t$spec['_host'] = $sys['host'];\n\t$spec['_rhost'] = $_SERVER['HTTP_HOST'];\n\t$spec['_path'] = COT_SITE_URI;\n\t// Transform the data into URL\n\tif (preg_match_all('#\\{(.+?)\\}#', $url, $matches, PREG_SET_ORDER))\n\t{\n\t\tforeach($matches as $m)\n\t\t{\n\t\t\tif ($p = mb_strpos($m[1], '('))\n\t\t\t{\n\t\t\t\t// Callback\n\t\t\t\t$func = mb_substr($m[1], 0, $p);\n\t\t\t\t$url = str_replace($m[0], $func($params, $spec), $url);\n\t\t\t}\n\t\t\telseif (mb_strpos($m[1], '!$') === 0)\n\t\t\t{\n\t\t\t\t// Unset\n\t\t\t\t$var = mb_substr($m[1], 2);\n\t\t\t\t$url = str_replace($m[0], '', $url);\n\t\t\t\tunset($params[$var]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// Substitute\n\t\t\t\t$var = mb_substr($m[1], 1);\n\t\t\t\tif (isset($spec[$var]))\n\t\t\t\t{\n\t\t\t\t\t$url = str_replace($m[0], urlencode($spec[$var]), $url);\n\t\t\t\t}\n\t\t\t\telseif (isset($params[$var]))\n\t\t\t\t{\n\t\t\t\t\t$url = str_replace($m[0], urlencode($params[$var]), $url);\n\t\t\t\t\tunset($params[$var]);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$url = str_replace($m[0], urlencode($GLOBALS[$var]), $url);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Append query string if needed\n\tif (!empty($params))\n\t{\n\t\t$sep = $htmlspecialchars_bypass ? '&' : '&amp;';\n\t\t$sep_len = mb_strlen($sep);\n\t\t$qs = mb_strpos($url, '?') !== false ? $sep : '?';\n\t\tforeach($params as $key => $val)\n\t\t{\n\t\t\t// Exclude static parameters that are not used in format,\n\t\t\t// they should be passed by rewrite rule (htaccess)\n\t\t\tif ($rule['params'][$key] != $val)\n\t\t\t{\n\t\t\t\t$qs .= $key .'='.urlencode($val).$sep;\n\t\t\t}\n\t\t}\n\t\t$qs = mb_substr($qs, 0, -$sep_len);\n\t\t$url .= $qs;\n\t}\n\t// Almost done\n\t$url .= $tail;\n\t$url = str_replace('&amp;amp;', '&amp;', $url);\n\treturn $url;\n}", "public function getListRoutes()\r\n {\r\n $result = array();\r\n \r\n if (count( $this->routes ))\r\n {\r\n foreach ( $this->routes as $act )\r\n {\r\n \r\n $route_str = '';\r\n if (isset( $this->default_params['url_prefix'] ) && ! empty( $this->default_params['url_prefix'] ))\r\n {\r\n $route_str = $this->default_params['url_prefix'];\r\n }\r\n \r\n if (is_array( $act['type'] ))\r\n {\r\n $route_str = implode( '|', $act['type'] ) . ' ' . $route_str;\r\n }\r\n else\r\n {\r\n $route_str = $act['type'] . ' ' . $route_str;\r\n }\r\n $route_str .= $act['route'];\r\n \r\n if (isset( $act['params']['ajax'] ) && (bool) ($act['params']['ajax']))\r\n {\r\n $route_str .= ' [ajax]';\r\n }\r\n \r\n $action_str = '';\r\n if (isset( $act['params']['namespace'] ) && ! empty( $act['params']['namespace'] ))\r\n {\r\n $action_str = (string) $act['params']['namespace'];\r\n }\r\n else\r\n {\r\n if (isset( $this->default_params['namespace'] ) && ! empty( $this->default_params['namespace'] ))\r\n {\r\n $action_str = $this->default_params['namespace'];\r\n }\r\n }\r\n $action_str .= '\\\\';\r\n \r\n if (isset( $act['params']['controller'] ))\r\n {\r\n $action_str .= (string) $act['params']['controller'];\r\n }\r\n else\r\n {\r\n if (isset( $this->default_params['controller'] ) && ! empty( $this->default_params['controller'] ))\r\n {\r\n $action_str .= $this->default_params['controller'];\r\n }\r\n }\r\n $action_str .= '->' . (string) $act['params']['action'];\r\n \r\n $kbps = $this->default_params['kbps'];\r\n if( isset( $act['params']['kbps'] ) ){\r\n \t$kbps = $act['params']['kbps'];\r\n }\r\n $ttl = $this->default_params['ttl'];\r\n if( isset( $act['params']['ttl'] ) ){\r\n \t$ttl = $act['params']['ttl'];\r\n }\r\n \r\n $route = new \\stdclass();\r\n $route->pattern = $route_str;\r\n $route->handler = $action_str;\r\n $route->ttl = $ttl;\r\n $route->kbps = $kbps;\r\n $result[] = $route;\r\n }\r\n }\r\n \r\n return $result;\r\n }", "private function setQueryStrings()\n {\n $params = explode('?', $this->url);\n $queries = array();\n\n if (count($params) > 1) {\n $params = end($params);\n $relations = explode('&', $params);\n\n $queries = array();\n\n foreach ($relations as $relation) {\n $camps = explode('=', $relation);\n $queries[ $camps[0] ] = $camps[1];\n }\n }\n\n $this->querystrings = $queries;\n }", "function build_url($base_url, $params) {\r\n $url = $base_url;\r\n if (!empty($params)) {\r\n $url .= '?' . implode('&', $params);\r\n }\r\n return $url;\r\n }", "public function myurl($params = false, $remove = array(), $add = array()) {\n\t\t$url = array();\n\t\tif ($params) {\n\n\t\t\tif (isset($params['group']) && !in_array('group', $remove)) {\n\t\t\t\t$url['group'] = $this->slug($params['group']);\n\t\t\t}\n\t\t\tif (in_array('group', $remove)) {\n\t\t\t\tunset($url['group']);\n\t\t\t}\n\t\t\tif (array_key_exists('group', $add)) {\n\t\t\t\t$url['group'] = $this->slug($add['group']);\n\t\t\t\tunset($add['group']);\n\t\t\t}\n\n\t\t\tif (isset($params['subgroup']) && !in_array('subgroup', $remove)) {\n\t\t\t\t$url['subgroup'] = $this->slug($params['subgroup']);\n\t\t\t}\n\t\t\tif (in_array('subgroup', $remove)) {\n\t\t\t\tunset($url['subgroup']);\n\t\t\t}\n\t\t\tif (array_key_exists('subgroup', $add)) {\n\t\t\t\t$url['subgroup'] = $this->slug($add['subgroup']);\n\t\t\t\tunset($add['subgroup']);\n\t\t\t}\n\n\t\t\tif (isset($params['category']) && !in_array('category', $remove)) {\n\t\t\t\t$url['category'] = $this->slug($params['category']);\n\t\t\t}\n\t\t\tif (in_array('category', $remove)) {\n\t\t\t\tunset($url['category']);\n\t\t\t}\n\t\t\tif (array_key_exists('category', $add)) {\n\t\t\t\t$url['category'] = $this->slug($add['category']);\n\t\t\t\tunset($add['category']);\n\t\t\t}\n\n\t\t\tif (isset($params['subcategory']) && !in_array('subcategory', $remove)) {\n\t\t\t\t$url['subcategory'] = $this->slug($params['subcategory']);\n\t\t\t}\n\t\t\tif (in_array('subcategory', $remove)) {\n\t\t\t\tunset($url['subcategory']);\n\t\t\t}\n\t\t\tif (array_key_exists('subcategory', $add)) {\n\t\t\t\t$url['subcategory'] = $this->slug($add['subcategory']);\n\t\t\t\tunset($add['subcategory']);\n\t\t\t}\n\n\t\t\tif (isset($params['brand']) && !in_array('brand', $remove)) {\n\t\t\t\t$url['brand'] = $this->slug($params['brand']);\n\t\t\t}\n\t\t\tif (in_array('brand', $remove)) {\n\t\t\t\tunset($url['brand']);\n\t\t\t}\n\t\t\tif (array_key_exists('brand', $add)) {\n\t\t\t\t$url['brand'] = $this->slug($add['brand']);\n\t\t\t\tunset($add['brand']);\n\t\t\t}\n\n\t\t\tif (isset($params['collection']) && !in_array('collection', $remove)) {\n\t\t\t\t$url['collection'] = $this->slug($params['collection']);\n\t\t\t}\n\t\t\tif (in_array('collection', $remove)) {\n\t\t\t\tunset($url['collection']);\n\t\t\t}\n\t\t\tif (array_key_exists('collection', $add)) {\n\t\t\t\t$url['collection'] = $this->slug($add['collection']);\n\t\t\t\tunset($add['collection']);\n\t\t\t} \n\n\t\t\t$url = $url+$add;\n\n\t\t}\n\t\t\n\t\treturn $url;\n\t\t\n\t}", "function http_build_url($url = null, $parts = null, $flags = null, ?array &$new_url = null) {}", "public function getUrl($route = '', $params = []);", "public function url( $service, $params = array( )) {\n\n\t\tif ( is_string( $params )) {\n\t\t\t$params = array(\n\t\t\t\tself::url => $params\n\t\t\t);\n\t\t}\n\n\t\t$config = $this->_service( $service );\n\t\t$mapped = array( );\n\n\t\tif ( isset( $config['map'])) {\n\t\t\tforeach ( $config['map'] as $generic => $specific ) {\n\t\t\t\tif ( isset( $params[ $generic ])) {\n\t\t\t\t\t$mapped[ $specific ] = $params[ $generic ];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $config['url'] . '?' . http_build_query( $mapped );\n\t}", "function restoreUrlParameters() {\n $this->CI->config->set_item('parm_segment', $this->parameterSegment);\n $this->CI->uri->router->segments = $this->routerSegments;\n }", "public function addQueryParams($params) {}", "public static function queryParam($params='') {\n\t\t$url =''; // Added because PHP giving silent error of undefined variable\n\t\tforeach ($params as $key => $value) {\n\t\t\t$url .='&'.$key.'='.urlencode($value);\n\t\t}\n\t\treturn $url;\n\t}", "public static function reverseToArray($params)\n {\n $url = [];\n if ($params instanceof ServerRequest) {\n $url = $params->query;\n $params = $params->params;\n } elseif (isset($params['url'])) {\n $url = $params['url'];\n }\n $pass = isset($params['pass']) ? $params['pass'] : [];\n\n unset(\n $params['pass'],\n $params['paging'],\n $params['models'],\n $params['url'],\n $url['url'],\n $params['autoRender'],\n $params['bare'],\n $params['requested'],\n $params['return'],\n $params['_Token'],\n $params['_matchedRoute'],\n $params['_name']\n );\n $params = array_merge($params, $pass);\n if (!empty($url)) {\n $params['?'] = $url;\n }\n\n return $params;\n }", "public function createUrl($manager, $route, $params)\n {\n if ($this->mode === self::PARSING_ONLY) {\n return false;\n }\n\n $tr = [];\n\n // match the route part first\n if ($route !== $this->route) {\n if ($this->_routeRule !== null && preg_match($this->_routeRule, $route, $matches)) {\n foreach ($this->_routeParams as $name => $token) {\n if (isset($this->defaults[$name]) && strcmp($this->defaults[$name], $matches[$name]) === 0) {\n $tr[$token] = '';\n } else {\n $tr[$token] = $matches[$name];\n }\n }\n } else {\n return false;\n }\n }\n\n // match default params\n // if a default param is not in the route pattern, its value must also be matched\n foreach ($this->defaults as $name => $value) {\n if (isset($this->_routeParams[$name])) {\n continue;\n }\n if (!isset($params[$name])) {\n return false;\n } elseif (strcmp($params[$name], $value) === 0) { // strcmp will do string conversion automatically\n unset($params[$name]);\n if (isset($this->_paramRules[$name])) {\n $tr[\"<$name>\"] = '';\n }\n } elseif (!isset($this->_paramRules[$name])) {\n return false;\n }\n }\n\n // match params in the pattern\n foreach ($this->_paramRules as $name => $rule) {\n if (isset($params[$name]) && !is_array($params[$name]) && ($rule === '' || preg_match($rule, $params[$name]))) {\n $tr[\"<$name>\"] = $this->encodeParams ? urlencode($params[$name]) : $params[$name];\n unset($params[$name]);\n } elseif (!isset($this->defaults[$name]) || isset($params[$name])) {\n return false;\n }\n }\n\n $url = trim(strtr($this->_template, $tr), '/');\n if ($this->host !== null) {\n $pos = strpos($url, '/', 8);\n if ($pos !== false) {\n $url = substr($url, 0, $pos) . preg_replace('#/+#', '/', substr($url, $pos));\n }\n } elseif (strpos($url, '//') !== false) {\n $url = preg_replace('#/+#', '/', $url);\n }\n\n if ($url !== '') {\n $url .= ($this->suffix === null ? $manager->suffix : $this->suffix);\n }\n\n if (!empty($params) && ($query = http_build_query($params)) !== '') {\n $url .= '?' . $query;\n }\n\n return $url;\n }", "function _parse_routes()\n {\n // Do we even have any custom routing to deal with?\n // There is a default scaffolding trigger, so we'll look just for 1\n if (count($this->routes) == 1)\n {\n $this->_set_request($this->uri->segments);\n return;\n }\n\n // Turn the segment array into a URI string\n $uri = implode('/', $this->uri->segments);\n\n // Is there a literal match? If so we're done\n if (isset($this->routes[$uri]))\n {\n $this->_set_request(explode('/', $this->routes[$uri]));\n return;\n }\n\n //Art\n $i = $this->_search_by_key($this->routes, self::MAIN, $uri);\n if ($i !== FALSE)\n {\n $this->_set_request(explode('/', $this->routes[$i][self::ROUTE]));\n return;\n }\n\n // Loop through the route array looking for wild-cards\n foreach ($this->routes as $key => $val)\n {\n if(is_int($key))\n {\n $key = $val[self::MAIN];\n $val = $val[self::ROUTE];\n }\n // Convert wild-cards to RegEx\n $key = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $key));\n\n // Does the RegEx match?\n if (preg_match('#^'.$key.'$#', $uri))\n {\n // Do we have a back-reference?\n if (strpos($val, '$') !== FALSE AND strpos($key, '(') !== FALSE)\n {\n $val = preg_replace('#^'.$key.'$#', $val, $uri);\n }\n $this->_set_request(explode('/', $val));\n return;\n }\n }\n\n // If we got this far it means we didn't encounter a\n // matching route so we'll set the site default route\n $this->_set_request($this->uri->segments);\n }", "function parseGetParams()\n {\n $this->parameters = array();\n\n $uriParts = explode('?', $this->userURI);\n $itemCount = count($uriParts);\n if ($itemCount == 0)\n {\n return;\n }\n\n //remove last item if it's empty\n if (isset($uriParts[$itemCount - 1]) && $uriParts[$itemCount - 1] == '')\n {\n array_pop($uriParts);\n }\n \n //remove first item if it's empty\n if (isset($uriParts[0]) && $uriParts[0] == '')\n {\n array_shift($uriParts);\n }\n\n //if has no valid item then return\n if (count($uriParts) == 0)\n {\n return;\n }\n writeLog(print_r($uriParts, true));\n \n foreach($uriParts as $inputData)\n {\n $data = html_entity_decode($inputData);\n $pair = explode('=', $data);\n\n if (count($pair)>1)\n {\n $this->parameters[$pair[0]] = $pair[1];\n }\n }\n \n writeLog(\"params = \".print_r($this->parameters, true));\n }", "private function makeDataFromUrl(){\n if (empty($_GET)){\n Route::$controller='home';\n return true;\n }\n $routs= explode('/',strip_tags($_GET['route']));\n $result=array();\n foreach ($routs as $k=>$v){\n switch ($k){\n case 0:\n $result['controller']=$v;\n $result['method']='index';\n Route::$controller=$v;\n Route::$method='index';\n break;\n default: $result['data'][]=$v;\n }\n }\n if (!empty($result['data']))\n Route::$data=$result['data'];\n return true;\n }", "static function CreateRequestURI(&$object, $url,$host,$lang_count,$language) {\n //--if site have not a one language\n if ($lang_count!=1) {\n $pos=strpos($_SERVER[\"REQUEST_URI\"],\"/\".$language.\"/\");\n if ($pos!==false) {\n $request_uri=substr($_SERVER[\"REQUEST_URI\"],($pos+1), strlen($_SERVER[\"REQUEST_URI\"]));\n } else {\n \tif ($object->Kernel->Settings)\n \t\t$settings=$object->Kernel->Settings;\n \telseif ($object->Page->Kernel->Settings)\n \t\t$settings=$object->Page->Kernel->Settings;\n $request_uri=substr($_SERVER[\"REQUEST_URI\"],(strlen($settings->GetItem('MODULE', 'RelativeURL'))+1), strlen($_SERVER[\"REQUEST_URI\"]));\n }\n } else { //-- else (one language)\n $seek=strlen($url)-strlen($host);\n $request_uri=substr($_SERVER[\"REQUEST_URI\"],$seek, strlen($_SERVER[\"REQUEST_URI\"]));\n }\n\n if (substr($request_uri,0,1)==\"/\") $request_uri=substr($request_uri,1, strlen($request_uri));\n if(substr($request_uri,strlen($request_uri)-1,1)==\"/\") {\n $request_uri.=\"?\";\n }\n if (strpos($request_uri,\"?\")===false) {\n $request_uri.=\"?\";\n } else {\n $darray=explode(\"/\",$_SERVER[\"PHP_SELF\"]);\n\n }\n //list($PageURI,$QueryString)=split(\"[?]\",$request_uri);\n list($PageURI,$QueryString)=preg_split(\"/[?]/\",$request_uri);\n return array($PageURI,$QueryString,$request_uri);\n }", "public function parseRequest($request)\n {\n if ($this->enablePrettyUrl) {\n $pathInfo = $request->getPathInfo();\n $language = explode('/', $pathInfo)[0];\n \n if (array_key_exists($language, $this->languages)) {\n $request->setPathInfo(substr_replace($pathInfo, '', 0, (strlen($language) + 1)));\n } else {\n $language = ArrayHelper::map($this->languages, 'is_main', 'code')[1];\n }\n \n $locale = ArrayHelper::getValue($this->aliases, $language, $language);\n Yii::$app->language = $locale;\n static::$currentLanguage = $language;\n \n \\common\\services\\I18NService::localizedRoutes();\n// Yii::$app->services->i18n->localizedRoutes();\n } else {\n $params = $request->getQueryParams();\n $route = isset($params[$this->routeParam]) ? $params[$this->routeParam] : '';\n if (is_array($route)) {\n $route = '';\n }\n $language = explode('/', $route)[0];\n $locale = ArrayHelper::getValue($this->aliases, $language, $language);\n if (array_key_exists($language, $this->languages)) {\n $route = substr_replace($route, '', 0, (strlen($language) + 1));\n $params[$this->routeParam] = $route;\n $request->setQueryParams($params);\n Yii::$app->language = $locale;\n static::$currentLanguage = $language;\n }\n }\n \n return parent::parseRequest($request);\n }", "protected function to($url = '', $argsOrParams = [], $params = [])\n {\n if ($this->passThroughParams) {\n if (false !== strpos($url, '%s')) {\n $real = &$params;\n } else {\n $real = &$argsOrParams;\n }\n foreach ($this->passThroughParams as $param) {\n if (!isset($real[$param]) && $this->req->getQuery($param)) {\n $real[$param] = $this->req->getQuery($param);\n }\n }\n }\n\n return parent::to($url, $argsOrParams, $params);\n }", "public function run(array $params)\n {\n $sortByHandler = array_key_exists('h', $params);\n $host = $params['host'] ?? null;\n\n // Set HTTP_HOST\n if ($host) {\n $request = Services::request();\n $_SERVER = $request->getServer();\n $_SERVER['HTTP_HOST'] = $host;\n $request->setGlobal('server', $_SERVER);\n }\n\n $collection = Services::routes()->loadRoutes();\n\n // Reset HTTP_HOST\n if ($host) {\n unset($_SERVER['HTTP_HOST']);\n }\n\n $methods = [\n 'get',\n 'head',\n 'post',\n 'patch',\n 'put',\n 'delete',\n 'options',\n 'trace',\n 'connect',\n 'cli',\n ];\n\n $tbody = [];\n $uriGenerator = new SampleURIGenerator();\n $filterCollector = new FilterCollector();\n\n $definedRouteCollector = new DefinedRouteCollector($collection);\n\n foreach ($definedRouteCollector->collect() as $route) {\n $sampleUri = $uriGenerator->get($route['route']);\n $filters = $filterCollector->get($route['method'], $sampleUri);\n\n $routeName = ($route['route'] === $route['name']) ? '»' : $route['name'];\n\n $tbody[] = [\n strtoupper($route['method']),\n $route['route'],\n $routeName,\n $route['handler'],\n implode(' ', array_map('class_basename', $filters['before'])),\n implode(' ', array_map('class_basename', $filters['after'])),\n ];\n }\n\n if ($collection->shouldAutoRoute()) {\n $autoRoutesImproved = config(Feature::class)->autoRoutesImproved ?? false;\n\n if ($autoRoutesImproved) {\n $autoRouteCollector = new AutoRouteCollectorImproved(\n $collection->getDefaultNamespace(),\n $collection->getDefaultController(),\n $collection->getDefaultMethod(),\n $methods,\n $collection->getRegisteredControllers('*')\n );\n\n $autoRoutes = $autoRouteCollector->get();\n\n // Check for Module Routes.\n if ($routingConfig = config(Routing::class)) {\n foreach ($routingConfig->moduleRoutes as $uri => $namespace) {\n $autoRouteCollector = new AutoRouteCollectorImproved(\n $namespace,\n $collection->getDefaultController(),\n $collection->getDefaultMethod(),\n $methods,\n $collection->getRegisteredControllers('*'),\n $uri\n );\n\n $autoRoutes = [...$autoRoutes, ...$autoRouteCollector->get()];\n }\n }\n } else {\n $autoRouteCollector = new AutoRouteCollector(\n $collection->getDefaultNamespace(),\n $collection->getDefaultController(),\n $collection->getDefaultMethod()\n );\n\n $autoRoutes = $autoRouteCollector->get();\n\n foreach ($autoRoutes as &$routes) {\n // There is no `auto` method, but it is intentional not to get route filters.\n $filters = $filterCollector->get('auto', $uriGenerator->get($routes[1]));\n\n $routes[] = implode(' ', array_map('class_basename', $filters['before']));\n $routes[] = implode(' ', array_map('class_basename', $filters['after']));\n }\n }\n\n $tbody = [...$tbody, ...$autoRoutes];\n }\n\n $thead = [\n 'Method',\n 'Route',\n 'Name',\n $sortByHandler ? 'Handler ↓' : 'Handler',\n 'Before Filters',\n 'After Filters',\n ];\n\n // Sort by Handler.\n if ($sortByHandler) {\n usort($tbody, static fn ($handler1, $handler2) => strcmp($handler1[3], $handler2[3]));\n }\n\n if ($host) {\n CLI::write('Host: ' . $host);\n }\n\n CLI::table($tbody, $thead);\n }", "public static function site($segments = NULL, $base = NULL)\n {\n if(is_a('\\ForceField\\Network\\Url', $base)) { /* Do nothing */ }\n else if(is_string($base))\n $url = new Url($base);\n else if($base)\n throw new \\Exception('Argument two is expected to be a string or Url instance.');\n\n $url = Url::current();\n\n $result = implode('/', func_get_args());\n $a = explode('/', $result);\n $result = [];\n\n foreach ($a as $seg) {\n if ($seg) // Skip double slashes\n $result[] = urlencode($seg);\n }\n\n // Set path\n $url->path(implode('/', $result));\n\n return $url;\n }", "private function getUrlByParams($params = [])\n {\n return is_array($params) && !empty($params) ? route('traveler.mypage.index', $params) : self::$url;\n }", "function url($format, $args = null)\n {\n $d = array \n (\n '%route' => server('location.route'),\n '%url' => server('location.url'),\n '%base' => dirname(server('script.name')),\n '%scheme' => server('location.scheme'),\n '%domain' => server('location.domain'),\n '%auto' => server('router.force') ? 'index.php' : \"\",\n '%path' => ltrim(rtrim(server('router.haystack'), '/'), '/'),\n '%query' => rtrim(server('query.string'), '&')\n );\n\n $format = str_ireplace(array_keys($d), array_values($d), $format);\n $format = str_replace('://', $s = '{$s}', $format);\n $format = vsprintf($format, is_array($args) ? $args : array_slice(func_get_args(), 1));\n $format = preg_replace('/\\/+/', '/', $format);\n\n return rtrim(str_replace($s, '://', $format), '/');\n }", "function getFullCacheUrl($url, $params) {\n\n //Sorting query params by key (acts by reference)\n ksort($params);\n\n //Transforming the query array to query string\n $queryString = http_build_query($params);\n\n $fullUrl = \"{$url}?{$queryString}\";\n\n return $fullUrl;\n\n}" ]
[ "0.59822166", "0.5686179", "0.5507244", "0.53819686", "0.5380631", "0.53669024", "0.531435", "0.5249101", "0.52304393", "0.52137184", "0.5196802", "0.51910526", "0.5170278", "0.516561", "0.5165282", "0.51595217", "0.5144615", "0.5127107", "0.5120047", "0.5114621", "0.5096322", "0.5080443", "0.50663245", "0.505466", "0.50478643", "0.5037205", "0.5033332", "0.5032941", "0.50221425", "0.5019853", "0.50088733", "0.500066", "0.49634042", "0.4959319", "0.49452448", "0.49420995", "0.49374056", "0.49176767", "0.49154884", "0.49006075", "0.49001855", "0.4896444", "0.4888594", "0.4886287", "0.48859632", "0.48769853", "0.48702165", "0.48568428", "0.48550686", "0.48549932", "0.4844443", "0.48434302", "0.48405215", "0.48401448", "0.48374194", "0.48354942", "0.48348838", "0.48278785", "0.4811282", "0.48104566", "0.48104402", "0.48021632", "0.47957915", "0.4787418", "0.47858578", "0.4781835", "0.47771502", "0.4777012", "0.47746348", "0.47745603", "0.4772585", "0.47707558", "0.47668415", "0.47612387", "0.4757066", "0.47532764", "0.4747048", "0.47340098", "0.47337583", "0.47323066", "0.47291014", "0.4726342", "0.47221312", "0.47220522", "0.4719254", "0.47147486", "0.4709938", "0.47079134", "0.46991894", "0.46961358", "0.46924204", "0.46887454", "0.4683569", "0.46763578", "0.46760657", "0.46760607", "0.4674655", "0.46740648", "0.46672642", "0.46648398" ]
0.52286905
9
Get `TRUE` if path with query string target homepage `/` (or `/index.php` request script name)
protected function urlIsHomePath ($pathWithQueryString) { $questionMarkPos = mb_strpos($pathWithQueryString, '?'); $pathWithoutQueryString = $questionMarkPos !== FALSE ? mb_substr($pathWithQueryString, 0, $questionMarkPos) : $pathWithQueryString; return trim($pathWithoutQueryString, '/') === '' || $pathWithoutQueryString == $this->request->GetScriptName(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getIsHomePage()\n {\n return $this->getUrl('') == $this->getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true));\n }", "public function getIsHomePage()\n {\n return $this->getUrl('') == $this->getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true));\n }", "public function isHomePage() {\n return $this->uri === $this->kirby->options['home'];\n }", "function shIsCurrentPageHome()\n{\n\t$currentPage = Sh404sefHelperUrl::sortUrl(\n\t\tShlSystem_Strings::pr('/(&|\\?)lang=[a-zA-Z]{2,3}/iu', '', empty($_SERVER['QUERY_STRING']) ? '' : $_SERVER['QUERY_STRING'])); // V 1.2.4.t\n\t$currentPage = JString::ltrim(str_replace('index.php', '', $currentPage), '/');\n\t$currentPage = JString::ltrim($currentPage, '?');\n\t$shHomePage = ShlSystem_Strings::pr('/(&|\\?)lang=[a-zA-Z]{2,3}/iu', '', Sh404sefFactory::getPageInfo()->homeLink);\n\t$shHomePage = JString::ltrim(str_replace('index.php', '', $shHomePage), '/');\n\t$shHomePage = JString::ltrim($shHomePage, '?');\n\treturn $currentPage == $shHomePage;\n}", "private function getRequestPath() {\n\t\t// only parse $path once in a request lifetime\n\t\tstatic $path;\n\n\t\tif (isset($path)) {\n\t\t\treturn $path;\n\t\t}\n\n\t\tif (isset($_SERVER['REQUEST_URI'])) {\n\t\t\t// extract the path from REQUEST_URI\n\t\t\t$request_path = strtok($_SERVER['REQUEST_URI'], '?');\n\t\t\t$base_path_len = strlen(rtrim(dirname($_SERVER['SCRIPT_NAME']), '\\/'));\n\n\t\t\t// unescape and strip $base_path prefix, leaving $path without a leading slash\n\t\t\t$path = substr(urldecode($request_path), $base_path_len + 1);\n\n\t\t\t// $request_path is \"/\" on root page and $path is FALSE in this case\n\t\t\tif ($path === FALSE) {\n\t\t\t\t$path = '';\n\t\t\t}\n\n\t\t\t// if the path equals the script filename, either because 'index.php' was\n\t\t\t// explicitly provided in the URL, or because the server added it to\n\t\t\t// $_SERVER['REQUEST_URI'] even when it wasn't provided in the URL (some\n\t\t\t// versions of Microsoft IIS do this), the front page should be served\n\t\t\tif ($path == basename($_SERVER['PHP_SELF'])) {\n\t\t\t\t$path = '';\n\t\t\t}\n\t\t}\n\n\t\treturn $path;\n\t}", "protected function isIndex() \n {\n $redirect = ltrim($_SERVER['REDIRECT_URL'], '/');\n \n return $redirect === '';\n }", "function isCurrent() {\r\n if ($this->_link == $_SERVER['PHP_SELF']) {\r\n return true;\r\n }\r\n elseif ($this->_link == str_replace('index.php', '', $_SERVER['PHP_SELF'])) {\r\n return true;\r\n }\r\n elseif ($this->_link == $_SERVER['REQUEST_URI']) {\r\n return true;\r\n }\r\n return false;\r\n }", "function pageIsFrontend() {\n\t$path = basename(htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES));\n\t$file = basename($path,\".php\");\n\treturn $file == 'index';\n}", "private function isRoot()\n {\n if (isset($_SERVER['SERVER_SOFTWARE']) && preg_match('/(Development Server)/i', $_SERVER['SERVER_SOFTWARE']) && ($_SERVER['REQUEST_URI'] === '/'))\n {\n return true;\n }\n else if(($_SERVER['REQUEST_URI'] === '/') || count(slashExploder($_SERVER['REQUEST_URI'])) === 1)\n {\n return true;\n }\n\n return false;\n }", "public function is_home();", "function me() {\n\n if (!empty($_SERVER['REQUEST_URI'])) {\n return $_SERVER['REQUEST_URI'];\n\n } else if (!empty($_SERVER['PHP_SELF'])) {\n if (!empty($_SERVER['QUERY_STRING'])) {\n return $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'];\n }\n return $_SERVER['PHP_SELF'];\n\n } else if (!empty($_SERVER['SCRIPT_NAME'])) {\n if (!empty($_SERVER['QUERY_STRING'])) {\n return $_SERVER['SCRIPT_NAME'] .'?'. $_SERVER['QUERY_STRING'];\n }\n return $_SERVER['SCRIPT_NAME'];\n\n } else if (!empty($_SERVER['URL'])) { // May help IIS (not well tested)\n if (!empty($_SERVER['QUERY_STRING'])) {\n return $_SERVER['URL'] .'?'. $_SERVER['QUERY_STRING'];\n }\n return $_SERVER['URL'];\n\n } else {\n // notify('Warning: Could not find any of these web server variables: $REQUEST_URI, $PHP_SELF, $SCRIPT_NAME or $URL');\n return false;\n }\n}", "function GetCurrentPagePath()\r\n{\r\n\t$sPHPSelf = $_SERVER['QUERY_STRING']; \r\n\t$sCurrentPagePath = StripQEquals($sPHPSelf);\r\n\treturn $sCurrentPagePath;\r\n}", "public function isStartingURL($value=null) {\r\n\t\tif (isset($value)) { $this->is_starting_point = $value ? true : false; }\r\n\t\treturn $this->is_starting_point;\r\n\t}", "public function isHomePage()\n\t{\n\t\treturn $this->home_page;\n\t}", "function shIsHomepage($string)\n{\n\n\tstatic $pages = array();\n\tstatic $home = '';\n\n\tif (!isset($pages[$string]))\n\t{\n\t\t$pageInfo = &Sh404sefFactory::getPageInfo();\n\t\tif (empty($home) && !empty($pageInfo->homeLink))\n\t\t{\n\t\t\t$home = Sh404sefHelperUrl::sortUrl(shCleanUpPag($pageInfo->homeLink));\n\t\t}\n\n\t\t$shTempString = JString::rtrim(str_replace($pageInfo->getDefaultFrontLiveSite(), '', $string), '/');\n\t\t$pages[$string] = Sh404sefHelperUrl::sortUrl(shCleanUpPag($shTempString)) == $home; // version t added sorting\n\t}\n\treturn $pages[$string];\n}", "function is_home()\n{\n $CI =& get_instance();\n return (!$CI->uri->segment(1))? TRUE: FALSE;\n}", "private function what_page() {\n $query = (isset($_REQUEST['qa']) && $_SERVER['REQUEST_METHOD'] == \"GET\") ? $_REQUEST['qa'] : FALSE;\n if (!$query)\n return false;\n\n return $query;\n }", "private static function find_request_path() {\n $path = explode('/', trim($_SERVER['SCRIPT_NAME'], '/'));\n $uri = explode('/', trim($_SERVER['REQUEST_URI'], '/'));\n\n foreach ($path as $key => $val) {\n if (isset($uri[$key])) {\n if ($val == $uri[$key]) {\n unset($uri[$key]);\n } else {\n break;\n }\n } else {\n break;\n }\n }\n\n if (empty($uri[0])) {\n $uri[0] = '__DEFAULT_PAGE__';\n } else {\n //$uri[0] = str_replace(\".php\", \"\", $uri[0]);\n if (($pos = strpos($uri[0], \"?\")) !== FALSE) {\n $uri[0] = substr($uri[0], 0, $pos);\n }\n $uri[0] .= \".php\";\n }\n return $uri;\n }", "function current_url_starts_with( $start )\n{\n\t$start = current_base_url_path() . $start;\n\n\treturn\tstarts_with( trim( $_SERVER['REQUEST_URI'], ' /' ), $start ) ||\n\t\t\tstarts_with( ltrim( $_SERVER['REQUEST_URI'], ' /' ), $start );\n}", "function condition() {\n\t\treturn ! empty( $_GET['page'] ) && $this->args['page_slug'] === $_GET['page']; // Input var okay.\n\t}", "function condition() {\n\t\treturn ! empty( $_GET['page'] ) && $this->page_slug === $_GET['page']; // Input var okay.\n\t}", "public function getIsHomepage()\n {\n return $this->isHomepage;\n }", "function nav_is($url)\n{\n $current = URL::makeAbsolute(URL::getCurrentWithQueryString());\n\n return $url === $current || Str::startsWith($current, $url . '/');\n}", "function current_url()\r\n{\r\n if (!isset($_SERVER['REQUEST_URI'])) {\r\n return '/';\r\n }\r\n\t$pathIndex = dirname($_SERVER['SCRIPT_NAME']);\r\n\r\n\t// SubDirectoryRouter: remove $pathIndex from $_SERVER['REQUEST_URI']\r\n\t$path = str_replace($pathIndex, '', $_SERVER['REQUEST_URI']);\r\n\t$path = $_SERVER['REQUEST_URI'];\r\n\tif (strstr($path, '?')) {\r\n\t\t$path = substr($path, 0, strpos($path, '?'));\r\n\t}\r\n\t\r\n\treturn $path;\r\n}", "public function is_home_static_page() {\n return ( is_front_page() && 'page' == get_option( 'show_on_front' ) && is_page( get_option( 'page_on_front' ) ) );\n }", "private function isHome(): bool\n {\n if (! $this->context->get('is_entry')) {\n return false;\n }\n\n if (! $this->context->get('page')) {\n return false;\n }\n\n return $this->context->get('parent') === null;\n }", "function front_end_home () {\n $request_url = parse_url($_SERVER['HTTP_REFERER']);\n return str_replace($request_url['path'], '', $_SERVER['HTTP_REFERER']);\n}", "public function is_home()\n {\n }", "protected function is_current_route() {\n\t\tforeach ( array_keys( $this->query_vars ) as $query_var ) {\n\t\t\tif ( get_query_var( $query_var, self::FALSE_HASH ) === self::FALSE_HASH ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}", "public static function get_url_path()\n {\n \t//----------------------------------------------------\n \t// If $_SERVER['REDIRECT_URL'] is set\n \t//----------------------------------------------------\n \tif (isset($_SERVER['REDIRECT_URL'])) {\n \t\treturn $_SERVER['REDIRECT_URL'];\n \t}\n \t//----------------------------------------------------\n \t// If $_SERVER['PATH_INFO'] is set\n \t//----------------------------------------------------\n \telse if (isset($_SERVER['PATH_INFO'])) {\n \t\treturn $_SERVER['PATH_INFO'];\n \t}\n \t//----------------------------------------------------\n \t// If $_SERVER['REQUEST_URI'] is set\n \t//----------------------------------------------------\n \telse if (isset($_SERVER['REQUEST_URI'])) {\n \t\t$qs_start = strpos($_SERVER['REQUEST_URI'], '?');\n \t\tif ($qs_start === false) {\n \t\t\treturn $_SERVER['REQUEST_URI'];\n \t\t}\n \t\telse {\n \t\t\treturn substr($_SERVER['REQUEST_URI'], 0, $qs_start);\n \t\t}\n \t}\n\n \treturn false;\n }", "private function getUriFromRequest()\n\t{\n\t\tif (!isset($_SERVER['REQUEST_URI']) OR !isset($_SERVER['SCRIPT_NAME']))\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\t$_tempUri = $_SERVER['REQUEST_URI'];\n\t\tif (strpos($_tempUri, $_SERVER['SCRIPT_NAME']) === 0)\n\t\t{\n\t\t\t$_tempUri = substr($_tempUri, strlen($_SERVER['SCRIPT_NAME']) + 1);\n\t\t}\n\t\t\n\t\tif ($_tempUri == '/' OR empty($_tempUri))\n\t\t{\n\t\t\treturn '/';\n\t\t}\n\t\t\n\t\treturn $_tempUri;\n\t}", "private static function isSearchPage()\n {\n if (is_multisite() && (defined('SUBDOMAIN_INSTALL') && SUBDOMAIN_INSTALL === false)) {\n if (trim(strtok($_SERVER[\"REQUEST_URI\"], '?'), \"/\") == trim(get_blog_details()->path, \"/\") && is_search()) {\n return true;\n }\n }\n\n if (is_search()) {\n return true;\n }\n\n return false;\n }", "public static function get_url_path()\n {\n //----------------------------------------------------\n // If $_SERVER['REDIRECT_URL'] is set\n //----------------------------------------------------\n if (isset($_SERVER['REDIRECT_URL'])) {\n return $_SERVER['REDIRECT_URL'];\n }\n //----------------------------------------------------\n // If $_SERVER['PATH_INFO'] is set\n //----------------------------------------------------\n else if (isset($_SERVER['PATH_INFO'])) {\n return $_SERVER['PATH_INFO'];\n }\n //----------------------------------------------------\n // If $_SERVER['REQUEST_URI'] is set\n //----------------------------------------------------\n else if (isset($_SERVER['REQUEST_URI'])) {\n $qs_start = strpos($_SERVER['REQUEST_URI'], '?');\n if ($qs_start === false) {\n return $_SERVER['REQUEST_URI'];\n }\n else {\n return substr($_SERVER['REQUEST_URI'], 0, $qs_start);\n }\n }\n\n return false;\n }", "function getPage(){\n $current_location = \"index\";\n if($url_part = array_pop(explode(\"/\", $_SERVER[\"REQUEST_URI\"]))){\n $url_part = array_slice(explode(\".php\", $url_part),0,1);\n if(!empty($url_part)){\n return $url_part[0];\n }\n }\n return $current_location;\n}", "public static function getRequestPath()\n {\n if (empty($_SERVER['REQUEST_URI'])) {\n return false;\n }\n\n $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);\n\n return empty($path) ? $path : urldecode($path);\n }", "protected function _checkHomepageRedirects($uri)\n\t{\n\t\tif (self::$requestParsed || !$this->_canRedirectFromNonSef($uri))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// check if we already did all the redirections we can\n\t\t$pageInfo = Sh404sefFactory::getPageInfo();\n\n\t\t// basic data\n\t\t$sefConfig = Sh404sefFactory::getConfig();\n\t\t$path = $uri->getPath();\n\t\t$url = $this->getFullUrl($uri);\n\t\t$vars = $uri->getQuery(true);\n\n\t\t// 0 - check forced homepage, in case of index.html splash page (!!!)\n\t\tif (!empty($sefConfig->shForcedHomePage)\n\t\t\t&& ($sefConfig->shForcedHomePage == $pageInfo->originalUri\n\t\t\t\t|| $sefConfig->shForcedHomePage . '?sh404sef_splash=1' == $pageInfo->originalUri)\n\t\t)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\t// 1 - check index.php on home page\n\t\t$indexString = str_replace($pageInfo->getDefaultFrontLiveSite(), '', $pageInfo->currentSefUrl);\n\t\t$indexString = explode('?', $indexString);\n\t\t$indexString = JString::substr($indexString[0], -9);\n\t\t// IIS sometimes adds index.php to uri, even if user did not request it.\n\t\t$IIS = !empty($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false;\n\n\t\tif (sh404SEF_REDIRECT_IF_INDEX_PHP && !$IIS && (empty($path) || $path == 'index.php') && empty($vars)\n\t\t\t&& $indexString == 'index.php'\n\t\t)\n\t\t{\n\t\t\t// redirect to home page\n\t\t\t$targetUrl = $pageInfo->getDefaultFrontLiveSite();\n\t\t\tShlSystem_Log::debug('sh404sef', 'Redirecting home page request with index.php to home page: ' . $targetUrl);\n\t\t\tshRedirect($targetUrl);\n\t\t}\n\n\t\t// 2 - Home page, some query vars, but we don't have an option var, ie dunno what component to go to\n\t\t// just drop the index.php\n\t\tif (empty($path) && !empty($vars) && empty($vars['option']) && empty($vars['lang'])\n\t\t\t&& $indexString == 'index.php'\n\t\t)\n\t\t{\n\t\t\t$query = $uri->getQuery();\n\t\t\t$targetUrl = $uri->base() . (empty($query) ? '' : '?' . $query);\n\t\t\tShlSystem_Log::debug('sh404sef',\n\t\t\t\t'Redirecting home page request with index.php and query vars to home page: ' . $targetUrl);\n\t\t\tshRedirect($targetUrl);\n\t\t}\n\n\t\t// 3 - request for home page with a language element\n\t\tif (empty($path) && !empty($vars) && empty($vars['option']) && !empty($vars['lang'])\n\t\t\t&& $indexString == 'index.php'\n\t\t)\n\t\t{\n\t\t\t$query = $uri->getQuery();\n\t\t\t$targetUrl = $uri->base() . (empty($query) ? '' : '?' . $query);\n\t\t\tShlSystem_Log::debug('sh404sef',\n\t\t\t\t'Redirecting home page request to non-default language home page: ' . $targetUrl);\n\t\t\tshRedirect($targetUrl);\n\t\t}\n\n\t\t// 4 - Still home page, ie empty path, but some query vars, lookup db to find it\n\t\tif (empty($path) && !empty($vars) && !empty($vars['option']))\n\t\t{\n\t\t\t// need an url model\n\t\t\t$urlModel = ShlMvcModel_Base::getInstance('Sefurls', 'Sh404sefModel');\n\t\t\t// rebuild the non-sef url requested\n\t\t\t$nonSefUrl = 'index.php' . $uri->toString(array(\n\t\t\t\t\t'query'\n\t\t\t\t));\n\t\t\t$sefUrl = '';\n\t\t\t// try to get it from our url store\n\t\t\t$urlType = shGetSefURLFromCacheOrDB($nonSefUrl, $sefUrl);\n\t\t\tif ($urlType == sh404SEF_URLTYPE_AUTO || $urlType == sh404SEF_URLTYPE_CUSTOM)\n\t\t\t{\n\t\t\t\t// found a match in database\n\t\t\t\t$sefUrl = $uri->base() . ltrim($sefConfig->shRewriteStrings[$sefConfig->shRewriteMode], '/') . $sefUrl;\n\t\t\t\tShlSystem_Log::debug('sh404sef', 'redirecting non-sef to existing SEF : ' . $sefUrl);\n\t\t\t\tshRedirect($sefUrl);\n\t\t\t}\n\n\t\t\t// 5 - no success yet, we'll try SEF-y the non-sef url\n\t\t\tif ($sefConfig->shRedirectNonSefToSef && !empty($nonSefUrl)\n\t\t\t\t&& (empty($pageInfo->isMultilingual)\n\t\t\t\t\t|| (($pageInfo->isMultilingual !== false)\n\t\t\t\t\t\t&& Sh404sefHelperLanguage::getDefaultLanguageTag()\n\t\t\t\t\t\t== $pageInfo->currentLanguageTag))\n\t\t\t)\n\t\t\t{\n\t\t\t\t$sefUrl = JRoute::_($nonSefUrl, $xhtml = false);\n\t\t\t\t$s = str_replace(JURI::base(true), '', $sefUrl);\n\t\t\t\tif (!empty($s) && $s != '/')\n\t\t\t\t{\n\t\t\t\t\t$sefUrl = $uri->toString(array(\n\t\t\t\t\t\t\t'scheme',\n\t\t\t\t\t\t\t'host',\n\t\t\t\t\t\t\t'port'\n\t\t\t\t\t\t)) . $sefUrl;\n\t\t\t\t\tif (!shIsHomepage($sefUrl) && strpos($sefUrl, 'option=com') === false && $sefUrl != $url)\n\t\t\t\t\t{\n\t\t\t\t\t\tShlSystem_Log::debug('sh404sef',\n\t\t\t\t\t\t\t'Homepage redirect to newly created SEF : ' . $sefUrl . ' from ' . $url);\n\t\t\t\t\t\tshRedirect($sefUrl);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function is_options_save_page()\n{\n $self = $_SERVER['PHP_SELF'];\n $request = $_SERVER['REQUEST_URI'];\n\n return stripos($self, 'options.php') !== false || stripos($request, 'options.php') !== false;\n}", "private function _getContentURI(){\r\n $uri = substr($_SERVER['REQUEST_URI'], strlen(WEBROOT));\r\n if (strstr($uri, '?')) $uri = substr($uri, 0, strpos($uri, '?'));\r\n $uri = str_replace('index.php', '', $uri);\r\n $uri = trim($uri, '/');\r\n\r\n if($uri == ''){\r\n $uri = 'index';\r\n }\r\n\r\n return $uri;\r\n }", "function get_active_page() {\n $basename = basename( $_SERVER['PHP_SELF'], \".php\" );\n\n if ( $basename == 'index') {\n $basename = 'home';\n }\n\n return $basename;\n}", "public function getParameterIsRedirect() {\n $params_is_redirect_page = false;\n if (isset($_SERVER['REQUEST_URI'])) {\n $uri = $_SERVER['REQUEST_URI'];\n if (strpos($uri, IS_REDIRECT_PAGE) != false) {\n $params_is_redirect_page = true;\n }\n }\n return $params_is_redirect_page;\n }", "function request_uri() {\n\n if (isset($_SERVER[\"REQUEST_URI\"])) {\n $uri = $_SERVER[\"REQUEST_URI\"];\n }\n else {\n $uri = $_SERVER[\"PHP_SELF\"] .\"?\". $_SERVER[\"argv\"][0];\n }\n\n return check_url($uri);\n}", "public function canHandleCurrentUrl() {}", "function tc_is_home() {\r\n \r\n //get info whether the front page is a list of last posts or a page\r\n return ( (is_home() && ( 'posts' == get_option( 'show_on_front' ) || 'nothing' == get_option( 'show_on_front' ) ) ) || is_front_page() ) ? true : false;\r\n }", "static public function isWebDocument() {\n return isset($_SERVER[\"HTTP_HOST\"]);\n }", "function thisActiveHomepage()\r\n\t{\r\n\t\r\n\t\tglobal $_REQUEST;\r\n\t\t$page = $_REQUEST['page_id'];\r\n\t\t\t\t\r\n\t\tif($page == \"\"){\r\n\t\t\t$page = $this->activeHomepage();\r\n\t\t}\r\n\t\tif($page == $this->activeHomepage())\r\n\t\t{\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 for_home_page() {\n\t\t$front_page_id = \\get_option( 'page_on_front' );\n\t\tif ( \\get_option( 'show_on_front' ) === 'page' && $front_page_id !== 0 ) {\n\t\t\t$indexable = $this->repository->find_by_id_and_type( $front_page_id, 'post' );\n\n\t\t\tif ( ! $indexable ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn $this->build_meta( $this->context_memoizer->get( $indexable, 'Static_Home_Page' ) );\n\t\t}\n\n\t\t$indexable = $this->repository->find_for_home_page();\n\n\t\tif ( ! $indexable ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn $this->build_meta( $this->context_memoizer->get( $indexable, 'Home_Page' ) );\n\t}", "public static function url($url = NULL)\n\t{\n\t\t// Check if we are on the front-page\n\t\tif($_SERVER['REQUEST_URI'] == '/')\n\t\t{\n\t\t\t$current = 'http://' . $_SERVER['HTTP_HOST'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$current = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];\n\t\t}\n\n\t\tif(url($url) == $current || $url == NULL && substr(trim($_SERVER['ORIG_PATH_INFO'], '/'), -10) == '/index.php')\n\t\t{\n\t\t\treturn 'active';\n\t\t}\n\n\t\t\n\t\treturn false;\n\t}", "function canHandleCurrentUrl() ;", "function current_url()\n{\n if (empty($_SERVER['QUERY_STRING'])) {\n $query_string = '';\n } else {\n $query_string = '?' . $_SERVER['QUERY_STRING'];\n }\n\n return $_SERVER['PHP_SELF'] . $query_string;\n}", "static function inPath () {\n return strrpos(\n self::instance()->current_uri, \n self::instance()->path, \n -strlen(self::instance()->current_uri)\n ) !== false;\n }", "public function\n\tGetRequestPath():\n\t?String {\n\n\t\tif(array_key_exists('REQUEST_URI',$_SERVER)) {\n\t\t\t$Path = rtrim(explode('?',$_SERVER['REQUEST_URI'])[0],'/');\n\n\t\t\tif($Path) return $Path;\n\t\t\telse return '/index';\n\t\t}\n\n\t\treturn NULL;\n\t}", "function isQueryFromSearchEngine() {\n\t\t$bFromSearchEngine = false;\n\t\tif(!isset($_SERVER['HTTP_REFERER'])) {\n\t\t\treturn false;\n\t\t}\n\t\t$referer = $_SERVER['HTTP_REFERER'];\n\t\t$parsed = parse_url($referer, PHP_URL_QUERY);\n\t\tparse_str($parsed, $query);\n\t\tswitch(true) {\n\t\t\tcase strpos($referer, 'yahoo') !== false && isset($query['p']):\n\t\t\t\t$keyword = $query['p'];\n\t\t\t\tbreak;\n\n\t\t\tcase strpos($referer, 'bing') !== false && isset($query['q']):\n\t\t\t\t$keyword = $query['q'];\n\t\t\t\tbreak;\n\n\t\t\tcase strpos($referer, 'google') !== false && isset($query['q']):\n\t\t\t\t$keyword = $query['q'];\n\t\t\t\tbreak;\n\n\t\t\tcase strpos($referer, 'aol') !== false && isset($query['query']):\n\t\t\t\t$keyword = $query['query'];\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\t$keyword = '';\n\t\t\t\tbreak;\n\t\t}\n\t\t$this->_searchEngineQuery = $keyword;\n\t\treturn $keyword !== '';\n\t}", "public static function isFrontEnd()\n {\n return parse_url(Url::to('@web'))['path'] !== '/admin';\n }", "public static function goToHome(){\n $protocol = stripos($_SERVER['SERVER_PROTOCOL'],'https') === true ? 'https://' : 'http://';\n $host = $_SERVER['HTTP_HOST'];\n $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\\\');\n header(\"Location: $protocol$host$uri\");\n \n die();\n }", "protected static function ajaxPage () {\n\t\treturn strpos( basename( $_SERVER['SCRIPT_NAME'] ), 'ajax_' ) === 0 ? TRUE : FALSE;\n\t}", "function get_home_front_page_url() {\r\n\r\n\t$front_page_ID = get_option( 'page_on_front' );\r\n\t$front_page_template = get_post_meta( $front_page_ID, '_wp_page_template', true );\r\n\tif ( $front_page_template === 'template-home.php' ) { // If front page uses Home template\r\n\t\treturn get_permalink( $front_page_ID ); // retrun url of front page\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n\r\n}", "function on_page($page,$partial_match = false) {\n if(!is_array($page)) {\n $page = array($page);\n }\n $current_page = substr($_SERVER['SCRIPT_FILENAME'],\n strpos($_SERVER['SCRIPT_FILENAME'], PMDROOT) + strlen(PMDROOT)\n );\n foreach($page AS $name) {\n if($partial_match) {\n if(strstr($current_page,$name)) {\n return true;\n }\n } elseif(ltrim($name,'/') == ltrim($current_page,'/')) {\n return true;\n }\n }\n return false;\n}", "public function hasDefaultIndexDirectoryPath();", "function wmfStaticParsePath( $uri ) {\n\tglobal $wgScriptPath;\n\n\t// Strip query parameters\n\t$uriPath = parse_url( $uri, PHP_URL_PATH );\n\n\t$urlPrefix = $wgScriptPath;\n\n\tif ( strpos( $uriPath, $urlPrefix ) !== 0 ) {\n\t\t// Prefix not found.\n\t\treturn false;\n\t}\n\n\t// Strip the prefix\n\treturn substr( $uriPath, strlen( $urlPrefix ) );\n}", "public function isTargetRedirect()\n {\n if (('/' === substr($this->target, 0, 1)) ||\n ('http' === substr($this->target, 0, 4))) {\n return true;\n }\n return false;\n }", "function startedIndexPhp() {return true; }", "public function getUrlString() {\n $urlRequest = Mage::app()->getFrontController()->getRequest();\n $requestUri = $urlRequest->getServer('REQUEST_URI');\n if (strpos($requestUri, 'index.php') !== FALSE) {\n if (is_null($urlRequest->getServer('ORIG_PATH_INFO'))) {\n return ltrim($urlRequest->getServer('PATH_INFO'), '/');\n } else {\n return ltrim($urlRequest->getServer('ORIG_PATH_INFO'), '/');\n }\n } else {\n return ltrim($requestUri, '/');\n }\n }", "private function _detect_uri() {\n if (!isset($_SERVER['REQUEST_URI']) OR !isset($_SERVER['SCRIPT_NAME'])) {\n return '';\n }\n\n $uri = $_SERVER['REQUEST_URI'];\n if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) {\n $uri = substr($uri, strlen($_SERVER['SCRIPT_NAME']));\n } elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) {\n $uri = substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME'])));\n }\n\n // This section ensures that even on servers that require the URI to be in the query string (Nginx) a correct\n // URI is found, and also fixes the QUERY_STRING server var and $_GET array.\n if (strncmp($uri, '?/', 2) === 0) {\n $uri = substr($uri, 2);\n }\n $parts = preg_split('#\\?#i', $uri, 2);\n $uri = $parts[0];\n if (isset($parts[1])) {\n $_SERVER['QUERY_STRING'] = $parts[1];\n parse_str($_SERVER['QUERY_STRING'], $_GET);\n } else {\n $_SERVER['QUERY_STRING'] = '';\n $_GET = array();\n }\n\n if ($uri == '/' || empty($uri)) {\n return '/';\n }\n\n $uri = parse_url($uri, PHP_URL_PATH);\n\n // Do some final cleaning of the URI and return it\n return str_replace(array('//', '../'), '/', trim($uri, '/'));\n }", "private function check_for_url_access($path,$query,$menu_slug){\n if(strpos('?'.$query .' ',$menu_slug. ' ') !== FALSE || strpos($path, '/' .$menu_slug) !== FALSE || strpos($path.'?'.$query .' ',$menu_slug. ' ') !== FALSE || strpos($query,$menu_slug) !== FALSE){\n return true;\n }\n return false;\n }", "public function shouldCheckHttpHost()\n {\n return !Director::is_cli() && isset($_SERVER['HTTP_HOST']);\n }", "public function anyRedirect()\n {\n return !empty($_GET['redirect']);\n }", "function isRHULApp() {\n\n\tif (isset($_GET['RHUL_App'])) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n\n}", "function tc_is_home_empty() {\r\n //check if the users has choosen the \"no posts or page\" option for home page\r\n return ( (is_home() || is_front_page() ) && 'nothing' == get_option( 'show_on_front' ) ) ? true : false;\r\n }", "static public function isSelected($url)\n {\n $server_url = parse_url($_SERVER['PHP_SELF']);\n $check_url = parse_url($url);\n\n /* Try to match the item's path against the current script\n filename as well as other possible URLs to this script. */\n return isset($check_url['path']) &&\n (($check_url['path'] == $server_url['path']) ||\n ($check_url['path'] . 'index.php' == $server_url['path']) ||\n ($check_url['path'] . '/index.php' == $server_url['path']));\n }", "function is_current_url($url)\n{\n $request = Zend_Controller_Front::getInstance()->getRequest();\n $currentUrl = $request->getRequestUri();\n $baseUrl = $request->getBaseUrl();\n\n // Strip out the protocol, host, base URL, and rightmost slash before\n // comparing the URL to the current one\n $stripOut = array(WEB_DIR, @$_SERVER['HTTP_HOST'], $baseUrl);\n $currentUrl = rtrim(str_replace($stripOut, '', $currentUrl), '/');\n $url = rtrim(str_replace($stripOut, '', $url), '/');\n\n if (strlen($url) == 0) {\n return (strlen($currentUrl) == 0);\n }\n return ($url == $currentUrl) or (strpos($currentUrl, $url) === 0);\n}", "static function RequestURI ()\n\t\t{\n\t\t\tif (php_sapi_name() === \"cli\")\n\t\t\t\treturn NULL;\n\t\t\treturn isset ($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';\n\t\t}", "public function homeUrl(string $path = '', string $scheme = null): string;", "function current_path() {\n\t$test = $_GET['q'];\n\techo '$test';\n}", "function on_page($path, $type = \"name\")\n {\n switch ($type) {\n case \"url\":\n $result = ($path == request()->is($path));\n break;\n\n default:\n $result = ($path == request()->route()->getName());\n }\n\n return $result;\n }", "function get_requested_url() {\n\n $requested_url = $_SERVER['REQUEST_URI'];\n $requested_url = str_replace(get_homeurl(), '', $requested_url);\n //$requested_url = ltrim($requested_url, get_homeurl());\n $requested_url = ltrim($requested_url, '/');\n $requested_url = rtrim($requested_url, '.php');\n $requested_url = rtrim($requested_url, '/');\n\n return $requested_url;\n}", "private function redirectIfNoSegments()\n {\n if (empty(ee()->uri->segments)) {\n $member_home_url = ee()->session->getMember()->getCPHomepageURL();\n\n if ($member_home_url->path != 'homepage') {\n // Preserve updater result status messages\n if (ee('Request')->get('update')) {\n $member_home_url->setQueryStringVariable(\n 'update',\n ee('Request')->get('update')\n );\n }\n\n ee()->session->benjaminButtonFlashdata();\n\n ee()->functions->redirect($member_home_url);\n }\n }\n }", "private function not_page_reload() {\n\n\t\tif ( isset( $_SERVER['HTTP_REFERER'] ) ) {\n\n\t\t\t// return portion before query string\n\t\t\t$request_uri = str_replace( strstr( $_SERVER['REQUEST_URI'], '?' ), '', $_SERVER['REQUEST_URI'] );\n\n\t\t\tif ( stripos( $_SERVER['HTTP_REFERER'], $request_uri ) === false )\n\t\t\t\treturn true;\n\t\t}\n\n\t\treturn true;\n\t}", "function home_url($taal = null)\n{\n if (IS_MEERTALIG) :\n return pll_home_url($taal);\n else :\n return get_site_url();\n endif;\n}", "public function getHomePage() : string {\n return $this->configVars['site']['home-page'];\n }", "function check_if_nf_is_required() {\n if ( $GLOBALS['pagenow'] == 'wp-login.php' || is_admin() ) {\n return true;\n }\n\n if ( preg_match('/klagebrev\\/(.*)$/', $_SERVER['REQUEST_URI'], $m) > 0 ) {\n if ( isset($m[1]) && strlen($m[1]) ) {\n return true;\n }\n }\n return false;\n}", "public function isPathDefined()\n {\n if (isset($this->path)) {\n // Make sure there's no forward slashes in the front (beginning) of the path string\n return ltrim($this->path, \"/\");\n }\n return false;\n }", "private function _relativeUrlBypass($originalPath)\n\t{\n\t\t$method = JFactory::getApplication()->input->getMethod();\n\t\tif ($method != 'POST')\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t$bits = explode('/', $originalPath);\n\t\tif (empty($bits))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\t$lastBit = array_pop($bits);\n\t\tif ($lastBit != 'index.php')\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public function getHome() {\n\t\tif (! defined('__HOME__')) {\n\t\t\tdefine('__HOME__', 'index.php?Action=view');\n\t\t}\t\n\t\treturn __HOME__;\n\t}", "private function getURL(){\n if(!empty($_SERVER['REQUEST_URI'])){\n return trim($_SERVER['REQUEST_URI'],'/');\n }\n }", "protected function determineRequestedPagePath()\r\n\t{\r\n\t\t$pagePath=$this->getRequest()->getServiceParameter();\r\n\t\tif(empty($pagePath))\r\n\t\t\t$pagePath=$this->getDefaultPage();\r\n\t\treturn $pagePath;\r\n\t}", "function get_current_url( $no_query_params = false ) {\r\n\t\t\t$server_name_method = UM()->options()->get( 'current_url_method' );\r\n\t\t\t$server_name_method = ! empty( $server_name_method ) ? $server_name_method : 'SERVER_NAME';\r\n\r\n\t\t\t$um_port_forwarding_url = UM()->options()->get( 'um_port_forwarding_url' );\r\n\t\t\t$um_port_forwarding_url = ! empty( $um_port_forwarding_url ) ? $um_port_forwarding_url : '';\r\n\r\n\t\t\t$page_url \t= '';\r\n\t\t\tif ( is_multisite() ) {\r\n\t\t\t\t$blog_id \t= get_current_blog_id();\r\n\t\t\t\t$siteurl \t= get_site_url( $blog_id );\r\n\r\n\t\t\t\t$network_permalink_structure = UM()->options()->get( 'network_permalink_structure' );\r\n\r\n\t\t\t\tif( $network_permalink_structure == \"sub-directory\" ){\r\n\t\t\t\t\t$page_url .= \"//\";\r\n\t\t\t\t\t$page_url .= $_SERVER[ $server_name_method ];\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$page_url .= $siteurl;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( $um_port_forwarding_url == 1 && isset( $_SERVER[\"SERVER_PORT\"] ) ) {\r\n\t\t\t\t\t$page_url .= \":\".$_SERVER[\"SERVER_PORT\"].$_SERVER[\"REQUEST_URI\"];\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$page_url .= $_SERVER[\"REQUEST_URI\"];\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\t\t\t\tif ( !isset( $_SERVER['SERVER_NAME'] ) )\r\n\t\t\t\t\treturn '';\r\n\r\n\t\t\t\t$page_url .= \"//\";\r\n\r\n\t\t\t\tif ( $um_port_forwarding_url == 1 && isset( $_SERVER[\"SERVER_PORT\"] ) ) {\r\n\t\t\t\t\t$page_url .= $_SERVER[ $server_name_method ].\":\".$_SERVER[\"SERVER_PORT\"].$_SERVER[\"REQUEST_URI\"];\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$page_url .= $_SERVER[ $server_name_method ].$_SERVER[\"REQUEST_URI\"];\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( $no_query_params == true ) {\r\n\t\t\t\t$page_url = strtok( $page_url, '?' );\r\n\t\t\t}\r\n\r\n\t\t\t/**\r\n\t\t\t * UM hook\r\n\t\t\t *\r\n\t\t\t * @type filter\r\n\t\t\t * @title um_get_current_page_url\r\n\t\t\t * @description Change current page URL\r\n\t\t\t * @input_vars\r\n\t\t\t * [{\"var\":\"$page_url\",\"type\":\"string\",\"desc\":\"Page URL\"}]\r\n\t\t\t * @change_log\r\n\t\t\t * [\"Since: 2.0\"]\r\n\t\t\t * @usage\r\n\t\t\t * <?php add_filter( 'um_get_current_page_url', 'function_name', 10, 1 ); ?>\r\n\t\t\t * @example\r\n\t\t\t * <?php\r\n\t\t\t * add_filter( 'um_get_current_page_url', 'my_get_current_page_url', 10, 1 );\r\n\t\t\t * function my_get_current_page_url( $page_url ) {\r\n\t\t\t * // your code here\r\n\t\t\t * return $page_url;\r\n\t\t\t * }\r\n\t\t\t * ?>\r\n\t\t\t */\r\n\t\t\treturn apply_filters( 'um_get_current_page_url', set_url_scheme( $page_url ) );\r\n\t\t}", "private function goHomeIfNotPost()\n {\n if($_SERVER[\"REQUEST_METHOD\"] != \"POST\") {\n // Unauthorized GET request\n header(\"Location: /Cinema\");\n exit();\n }\n }", "private function autoRedirectToFirstpage()\n {\n if($this->urlQueryStringName === NULL)\n {\n self::$registry->error->reportError('The Url Query String for Pagination is not defined yet, You can do it by using initURLQueryStringName() method.', __LINE__, __METHOD__, true);\n return 0;\n }\n \n if(false !== ($pageQueryStringNamePosition = array_search($this->urlQueryStringName, $this->URLQueryString)))\n {\n if(!isset($this->URLQueryString[++$pageQueryStringNamePosition]) or !is_numeric($this->URLQueryString[$pageQueryStringNamePosition]) or ($this->URLQueryString[$pageQueryStringNamePosition] <= 0))\n {\n $this->URLQueryString[$pageQueryStringNamePosition] = 1;\n $finalQueryString = implode('/', $this->URLQueryString);\n self::$registry->request->go(null, null, $finalQueryString);\n }\n }\n return; \n }", "function get_home_path()\n {\n }", "public function getHomepage()\n {\n if (array_key_exists(\"homepage\", $this->_propDict)) {\n return $this->_propDict[\"homepage\"];\n } else {\n return null;\n }\n }", "function get_current_uri(){\n\n global $shortcut;\n //get the current URI\n $current_uri = $shortcut->clean_uri($_SERVER['REQUEST_URI']);\n\n //if the URI is blank then we're on index.html\n if ($current_uri == '/' || $current_uri == '') {\n $current_uri = 'index.html';\n }\n\n //strip slashes out of the URI\n $current_uri = str_replace('/', '', $current_uri);\n return $current_uri;\n }", "private static function getURI()\n {\n $uri = $_SERVER['REQUEST_URI']; // get URI\n\n $uri = str_replace('../', '', $uri); // security reasons\n\n if (substr($uri, strlen($uri)-1,1)=='/') // strip ending '/'\n $uri = substr($uri, 0, strlen($uri)-1);\n\n if ($uri=='') // if it's index page\n $uri = '/index';\n\n return $uri;\n }", "function route_match() {\n global $route;\n global $html;\n global $config;\n global $matched_route;\n\n $url = explode('index.php', $_SERVER['REQUEST_URI']);\n $url = @str_replace('.', '', substr($url[1], 1));\n if(strpos($url, '?') !== false) {\n $url = explode('?', $url);\n $url = $url[0];\n }\n\n if(!$url) {\n $matched_route = 'ROOT';\n require_once __DIR__ . '/app/' . $route['ROOT'];\n return true;\n }\n\n if(substr($url, -1) == '/') {\n $url = substr($url, 0, -1);\n }\n\n // Check for simple route match\n if(array_key_exists($url, $route)) {\n $matched_route = $url;\n require_once __DIR__ . '/app/' . $route[$url];\n return true;\n }\n\n // Check for regex\n foreach($route as $r => $page) {\n $matches = array();\n\n if(preg_match('#' . $r . '$#', $url, $matches)) {\n array_shift($matches);\n\n $_GET['custom_arguments'] = $matches;\n\n $matched_route = $r;\n require_once __DIR__ . '/app/' . $page;\n return true;\n }\n }\n\n return false;\n}", "function include_query_string() {\n\t// Check the URI for a question mark.\n\t$position = strpos($_SERVER['REQUEST_URI'], '?');\n\n\t// When the mark is found, get the query string and parse it into the _GET array.\n\tif ($position !== false) {\n\t\t$query_string = substr($_SERVER['REQUEST_URI'], $position + 1);\n\t\tparse_str($query_string, $_GET);\n\t}\n}", "private function _getRoute()\n {\n $route = str_replace($this->_registry->rootPath, '', $_SERVER['REQUEST_URI']);\n $routeParts = explode('/', $route);\n if ($routeParts[0]=='public') {\n $this->_registry->route = false;\n return true;\n }\n if (!empty($routeParts)) {\n $this->controller = $routeParts[0];\n if (!empty($routeParts[1])) {\n $this->action = strtolower($routeParts[1]);\n }\n }\n if (empty($this->controller)) {\n $this->controller = 'index';\n }\n if (empty($this->action)) {\n $this->action = 'index';\n }\n $this->_registry->route = $routeParts;\n // split to arguments;\n unset($routeParts[0], $routeParts[1]);\n if (empty($routeParts)) {\n $routeParts = array();\n }\n $arguments = array();\n foreach ($routeParts as $part) {\n $arguments[] = $part;\n }\n $this->_registry->args = $arguments;\n \n return true;\n }", "public static function detect_uri()\n\t{\n\t\tif ( ! empty($_SERVER['PATH_INFO']))\n\t\t{\n\t\t\t// PATH_INFO does not contain the docroot or index\n\t\t\t$uri = $_SERVER['PATH_INFO'];\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// REQUEST_URI and PHP_SELF include the docroot and index\n\n\t\t\tif (isset($_SERVER['REQUEST_URI']))\n\t\t\t{\n\t\t\t\t// REQUEST_URI includes the query string, remove it\n\t\t\t\t$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);\n\n\t\t\t\t// Decode the request URI\n\t\t\t\t$uri = rawurldecode($uri);\n\t\t\t}\n\t\t\telseif (isset($_SERVER['PHP_SELF']))\n\t\t\t{\n\t\t\t\t$uri = $_SERVER['PHP_SELF'];\n\t\t\t}\n\t\t\telseif (isset($_SERVER['REDIRECT_URL']))\n\t\t\t{\n\t\t\t\t$uri = $_SERVER['REDIRECT_URL'];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// If you ever see this error, please report an issue at http://dev.kohanaphp.com/projects/kohana3/issues\n\t\t\t\t// along with any relevant information about your web server setup. Thanks!\n\t\t\t\tthrow new Kohana_Exception('Unable to detect the URI using PATH_INFO, REQUEST_URI, PHP_SELF or REDIRECT_URL');\n\t\t\t}\n\n\t\t\t// Get the path from the base URL, including the index file\n\t\t\t$base_url = parse_url(Kohana::$base_url, PHP_URL_PATH);\n\n\t\t\tif (strpos($uri, $base_url) === 0)\n\t\t\t{\n\t\t\t\t// Remove the base URL from the URI\n\t\t\t\t$uri = (string) substr($uri, strlen($base_url));\n\t\t\t}\n\n\t\t\tif (Kohana::$index_file AND strpos($uri, Kohana::$index_file) === 0)\n\t\t\t{\n\t\t\t\t// Remove the index file from the URI\n\t\t\t\t$uri = (string) substr($uri, strlen(Kohana::$index_file));\n\t\t\t}\n\t\t}\n\n\t\treturn $uri;\n\t}", "public function getActivePageSlug()\n {\n $url = wp_parse_url( $this->getServerVar( 'REQUEST_URI' ) );\n\n if ( ! isset( $url['path'] ) ) return false;\n\n $url = explode( '/', untrailingslashit( $url['path'] ) );\n $offset = count( $url ) - 1;\n\n $url_offset = isset( $url[ $offset ] ) ? $url[ $offset ] : '';\n return sanitize_key( $url_offset );\n }", "function getRequestUri(){\n\tif (isset($_SERVER['REQUEST_URI'])) {\n\t\t$uri = $_SERVER['REQUEST_URI'];\n\t} else {\n\t\tif (isset($_SERVER['argv'])) {\n\t\t\t $uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['argv'][0];\n\t\t} else {\n\t\t\t$uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'];\n\t\t}\n\t}\n\treturn $uri;\n}", "function home_url($path = '', $scheme = \\null)\n {\n }", "public static function current($qs = NO) {\n\t\treturn ($qs === YES) ? Router::$complete_uri : Router::$current_uri;\n\t}" ]
[ "0.71505463", "0.71505463", "0.6697872", "0.66574013", "0.6594174", "0.6338522", "0.61764175", "0.6166108", "0.6161302", "0.6158105", "0.6083697", "0.60542035", "0.6033753", "0.60319906", "0.6017848", "0.59655505", "0.59545064", "0.59489495", "0.59120226", "0.5898876", "0.5855243", "0.58463126", "0.5817406", "0.5814637", "0.5791077", "0.57497066", "0.57340306", "0.57304597", "0.57242614", "0.57232255", "0.57184297", "0.57005805", "0.5682089", "0.56732845", "0.56646323", "0.5661524", "0.56163806", "0.5583952", "0.5577048", "0.5569894", "0.5568653", "0.55483305", "0.55429083", "0.55167675", "0.5513213", "0.54800457", "0.5478906", "0.54640794", "0.54578024", "0.5427246", "0.5425472", "0.5420042", "0.5414528", "0.54124427", "0.54025596", "0.53820217", "0.5367933", "0.5356918", "0.53565407", "0.53565013", "0.5348568", "0.53445745", "0.53409964", "0.5339583", "0.53393865", "0.53229296", "0.53129923", "0.5311607", "0.53092456", "0.53071946", "0.53052497", "0.53046954", "0.5278432", "0.52738523", "0.52672076", "0.52648485", "0.5260052", "0.5250794", "0.5247213", "0.5240454", "0.52344674", "0.52312845", "0.5229637", "0.52174056", "0.52165824", "0.5215213", "0.5215064", "0.5208333", "0.5199146", "0.51860964", "0.5181584", "0.51767635", "0.5170527", "0.51677006", "0.5164353", "0.5149871", "0.51356494", "0.5132462", "0.5130728", "0.5130344" ]
0.7101664
2
Complete final URL, simply concatenate strings from three given sources: `$urlBaseSection` Begin URL part containing http, domain and base path like: ` `$urlPathWithQuerySection` Subject url part with application path and possible query string: `/some/path?with=query` `$systemParams` Array to implode it's values into string with system params like media site version or localization: `['media_version' => 'm', 'localization' => 'enUS']` Example output: `
protected function urlByRoutePrefixSystemParams ($urlBaseSection, $urlPathWithQuerySection, array $systemParams = [], $urlPathWithQueryIsHome = NULL) { // complete prefixes section from system params $urlPrefixesSection = trim(implode('/', array_values($systemParams)), '/'); $urlPrefixesSectionHasValue = $urlPrefixesSection !== ''; if ($urlPrefixesSectionHasValue) { $urlPrefixesSection = '/' . $urlPrefixesSection; // finalizing possible trailing slash after prefix if any prefix if ($this->trailingSlashBehaviour === \MvcCore\IRouter::TRAILING_SLASH_REMOVE) { if ($urlPathWithQueryIsHome === NULL) $urlPathWithQueryIsHome = $this->urlIsHomePath($urlPathWithQuerySection); if ($urlPathWithQueryIsHome) $urlPathWithQuerySection = ltrim($urlPathWithQuerySection, '/'); } } return $urlBaseSection . $urlPrefixesSection . $urlPathWithQuerySection; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function toString(): string\n\t{\n\t\t$url = $this->base();\n\t\t$slash = true;\n\n\t\tif (empty($url) === true) {\n\t\t\t$url = '/';\n\t\t\t$slash = false;\n\t\t}\n\n\t\t$path = $this->path->toString($slash) . $this->params->toString(true);\n\n\t\tif ($this->slash && $slash === true) {\n\t\t\t$path .= '/';\n\t\t}\n\n\t\t$url .= $path;\n\t\t$url .= $this->query->toString(true);\n\n\t\tif (empty($this->fragment) === false) {\n\t\t\t$url .= '#' . $this->fragment;\n\t\t}\n\n\t\treturn $url;\n\t}", "function build_url($base_url, $params) {\r\n $url = $base_url;\r\n if (!empty($params)) {\r\n $url .= '?' . implode('&', $params);\r\n }\r\n return $url;\r\n }", "function url_build(string $base, string $params = ''): string\n{\n if ($params) {\n $params = ((false === strpos($base, '?')) ? '?' : '&') . $params;\n }\n return \\get_site_url() . '/' . $base . $params;\n}", "static public function http_build_str(array $url_components, $relative = TRUE)\n {\n $url = '';\n\n if ( ! $relative)\n {\n if (($scheme = arr::get($url_components, 'scheme')) != NULL)\n {\n $url .= $scheme.'://';\n }\n\n if (($host = arr::get($url_components, 'host')) != NULL)\n {\n $url .= $host;\n }\n }\n\n if (($path = arr::get($url_components, 'path')) != NULL)\n {\n $url .= $path;\n }\n\n if (($query = arr::get($url_components, 'query')) != NULL)\n {\n $url .= '?'.$query;\n }\n\n if (($fragment = arr::get($url_components, 'fragment')) != NULL)\n {\n $url .= '#'.$fragment;\n }\n\n return $url;\n }", "function elgg_http_build_url(array $parts) {\n\t// build only what's given to us.\n\t$scheme = isset($parts['scheme']) ? \"{$parts['scheme']}://\" : '';\n\t$host = isset($parts['host']) ? \"{$parts['host']}\" : '';\n\t$port = isset($parts['port']) ? \":{$parts['port']}\" : '';\n\t$path = isset($parts['path']) ? \"{$parts['path']}\" : '';\n\t$query = isset($parts['query']) ? \"?{$parts['query']}\" : '';\n\n\t$string = $scheme . $host . $port . $path . $query;\n\n\treturn $string;\n}", "private function _combineUrl()\n {\n $args = func_get_args();\n $url = '';\n foreach ($args as $arg) {\n if (!is_string($arg)) {\n continue;\n }\n if ($arg[strlen($arg) - 1] !== '/') {\n $arg .= '/';\n }\n $url .= $arg;\n }\n\n return $url;\n }", "private function build_url($endpoint, array $query = array())\n {\n $url = $this->base_url.$endpoint;\n\n if (!empty($query)) {\n $url .= '?'.http_build_query($query);\n }\n\n return $url;\n }", "function build_url($base,$url) {\n $base_parts=url_parts($base);\n\n # https://code.google.com/p/add-mvc-framework/issues/detail?id=81\n if (preg_match('/^javascript\\:/',$url)) {\n return $url;\n }\n\n if ($url[0]==='/') {\n return rtrim($base_parts['protocol_domain'],'/').$url;\n }\n if ($url[0]==='?') {\n if (!$base_parts['pathname'])\n $base_parts['pathname']='/';\n return $base_parts['protocol_domain'].$base_parts['pathname'].$url;\n }\n if ($url[0]==='#') {\n\n }\n if (preg_match('/^https?\\:\\/+/',$url)) {\n return $url;\n }\n\n return rtrim($base_parts['protocol_domain'],\"/\").$base_parts['path'].$url;\n}", "private function _buildUri(): string {\n return !empty($this->query) ? $this->uri.'?'.http_build_query($this->query) : $this->uri;\n }", "public static function buildUrl($params)\n {\n /** @var HttpRequestInterface $request */\n $request = self::fetchComponent(HttpRequestInterface::class);\n if ($request) {\n $data = isset($params['data']) ? $params['data'] : [];\n $query = $request->getQueryArray();\n foreach ($data as $key => $value) {\n $query[$key] = $value;\n }\n return $request->getPath() . '?' . http_build_query($query);\n }\n return \"\";\n }", "function http_build_url($url = null, $parts = null, $flags = null, ?array &$new_url = null) {}", "public function url()\r\n {\r\n return $this->get_base_url() . http_build_query($this->get_query_params());\r\n }", "protected function generateString()\n\t{\n\t\t// start with the scheme\n\t\t$url = $this->scheme . '://';\n\t\t\n\t\t// user and password\n\t\tif( !empty( $this->user ) )\n\t\t{\n\t\t\t$url .= $this->user;\n\t\t\tif( !empty( $this->pass ) ) $url .= ':'.$this->pass.'@';\n\t\t\telse $url .= '@';\n\t\t}\n\t\t\n\t\t// add the host and path\n\t\t$url .= $this->host . '/';\n\t\t$url .= $this->path;\n\t\t\n\t\t// add the URL-encoded parameters\n\t\tif( !empty( $this->params ) )\n\t\t{\n\t\t\t$url .= '?';\n\t\t\tforeach( $this->params as $f => $v ) $url .= $f . '=' . urlencode( $v ) . '&';\n\t\t\t$url = rtrim( $url, '&' );\n\t\t}\n\t\t\n\t\t// add the anchor if any\n\t\tif( !empty( $this->anchor ) ) $url .= '#' . $this->anchor;\n\t\t\n\t\t$this->url = $url;\n\t\t$this->modified = false;\n\t\treturn $url;\n\t}", "public function getFullUrl(){\n return 'http://'. $_SERVER['HTTP_HOST'] .'/'. implode('/', self::$_request_vars);\n }", "function _http_build_url($parts) { \n return implode(\"\", array(\n isset($parts['scheme']) ? $parts['scheme'] . '://' : '',\n isset($parts['user']) ? $parts['user'] : '',\n isset($parts['pass']) ? ':' . $parts['pass'] : '',\n (isset($parts['user']) || isset($parts['pass'])) ? \"@\" : '',\n isset($parts['host']) ? $parts['host'] : '',\n isset($parts['port']) ? ':' . intval($parts['port']) : '',\n isset($parts['path']) ? $parts['path'] : '',\n isset($parts['query']) ? '?' . $parts['query'] : '',\n isset($parts['fragment']) ? '#' . $parts['fragment'] : ''\n ));\n}", "public function url()\n {\n if (empty($this->parameters)) {\n return $this->url;\n }\n $total = array();\n foreach ($this->parameters as $k => $v) {\n if (is_array($v)) {\n foreach ($v as $va) {\n $total[] = HttpClient::urlencodeRFC3986($k).\"[]=\".HttpClient::urlencodeRFC3986($va);\n }\n } else {\n $total[] = HttpClient::urlencodeRFC3986($k).\"=\".HttpClient::urlencodeRFC3986($v);\n }\n }\n $out = implode(\"&\", $total);\n\n return $this->url.'?'.$out;\n }", "function buildUrl($section = null, string $action = null, string $id = null, string $csrfToken = null): string\n{\n global $config, $site;\n\n if (! is_array($section)) {\n $array['section'] = $section;\n $array['action'] = $action;\n $array['id'] = $id;\n $array['csrftoken'] = $csrfToken;\n $section = $array;\n }\n\n $queryStr = \"\";\n foreach ($section as $key => $value) {\n if ($value !== null) {\n if ($key === 'section' && strpos($value, 'admin') === 0) {\n $value = str_replace('admin', $config['admin_section_name'], $value);\n\n if ($value === $config['admin_section_name']) {\n // no page specified\n $value .= \":users\";\n }\n }\n $queryStr .= \"$key=$value&\";\n }\n }\n\n if (\n (! isset($section['csrfToken']) || $section['csrfToken'] === null) &&\n $config[\"use_url_rewrite\"]\n ) {\n $queryStr = str_replace(\"&\", \"\", $queryStr);\n $queryStr = str_replace([\"section=\", \"action=\", \"id=\"], \"/\", $queryStr);\n $queryStr = ltrim($queryStr, \"/\");\n } else {\n if ($queryStr !== \"\") {\n $queryStr = \"?\" . rtrim($queryStr, \"&\");\n }\n $queryStr = \"index.php\" . $queryStr;\n }\n\n return $site['directory'] . $queryStr;\n}", "protected function _build_url() {\n\n $params = array_filter([\n 'name' => $this->_names,\n 'country_id' => $this->_country_id,\n 'language_id' => $this->_language_id,\n ], function($v) {\n if (!is_array($v)) {\n return strlen(trim($v)) > 0;\n } else {\n return $v;\n }\n });\n //Only pass apikey if there is one set\n if ($api_key = $this->get_api_key()) {\n $params['apikey'] = trim($api_key);\n }\n\n return self::BASE . '?' . http_build_query($params);\n }", "private function buildQueryString(){\n if(count($this->querystrings) == 0){\n return \"\";\n }\n else{\n $querystring = \"?\";\n\n foreach($this->querystrings as $index => $value){\n if($index > 0){\n $querystring .= \"&\";\n }\n $querystring .= $value;\n }\n\n return $querystring;\n }\n }", "abstract protected function buildSpecificRequestUri();", "private function _buildUrl() {\n $url = OPENDIGI_API_ENDPOINT;\n $url .= '?Vcollection=' . implode('+', $this->_collections);\n if ($this->_languages)\n $url .= '&Vlanguages=' . implode('+', $this->_languages);\n if ($this->_subjectIds)\n $url .= '&Vsubjectids=' . implode('+', $this->_subjectIds);\n\n return $url;\n }", "protected function getUrl($section, array $uriParams = [])\n {\n return parent::getUrl(sprintf(\"api.%s/%s\", $section, $this->apiKey), $uriParams);\n }", "private function getParamsUrlFormat() {\n $urlParams = \"\";\n\n if ($this->getMethod() == 'GET') {\n $urlParams .= ($this->getPaging()) ? \n \"?_paging=1\" : \n \"\";\n $urlParams .= ($this->getPaging()) ? \n \"&_return_as_object=1\" : \n \"\";\n $urlParams .= ($this->getPaging()) ? \n \"&_max_results=\" . $this->getMaxResults() : \n \"\";\n }\n\n if ($this->getMethod() == 'POST') {\n $function = $this->getFuction();\n $urlParams .= (isset($function) and $function != \"\") ?\n \"?_function=\" . $this->getFuction() :\n \"\";\n }\n\n return $urlParams;\n }", "function buildUrl($parts=array()){\r\n\t$uparts=array();\r\n\tforeach($parts as $key=>$val){\r\n\t\tif(preg_match('/^(PHPSESSID|GUID|debug|error|username|password|add_result|domain_href|add_id|add_table|edit_result|edit_id|edit_table|)$/i',$key)){continue;}\r\n\t\tif(preg_match('/^\\_(login|pwe|try|formfields|action|view|formname|enctype|fields|csuid|csoot)$/i',$key)){continue;}\r\n\t\tif(!is_string($val) && !isNum($val)){continue;}\r\n\t\tif(!strlen(trim($val))){continue;}\r\n\t\tif($val=='Array'){continue;}\r\n\t\tarray_push($uparts,\"$key=\" . encodeURL($val));\r\n \t}\r\n $url=implode('&',$uparts);\r\n return $url;\r\n\t}", "public function buildUrlQueryString( $url = null, array $paramsToUpdate = array(), $anchor = null )\n {\n $url = ( $url === null ) ? OW_URL_HOME . $this->getRequestUri() : trim($url);\n\n $requestUrlArray = parse_url($url);\n\n $currentParams = array();\n\n if ( isset($requestUrlArray['query']) )\n {\n parse_str($requestUrlArray['query'], $currentParams);\n }\n\n $currentParams = array_merge($currentParams, $paramsToUpdate);\n\n $scheme = empty($requestUrlArray[\"scheme\"]) ? \"\" : $requestUrlArray[\"scheme\"] . \":\";\n $host = empty($requestUrlArray[\"host\"]) ? \"\" : \"//\" . $requestUrlArray[\"host\"];\n $port = empty($requestUrlArray[\"port\"]) ? \"\" : \":\" . (int) $requestUrlArray[\"port\"];\n $path = empty($requestUrlArray[\"path\"]) ? \"\" : $requestUrlArray[\"path\"];\n $queryString = empty($currentParams) ? \"\" : \"?\" . http_build_query($currentParams);\n $anchor = ($anchor === null) ? \"\" : \"#\" . trim($anchor);\n\n return $scheme . $host . $port . $path . $queryString . $anchor;\n }", "private function generate_url($params) {\n $s = ($_SERVER['HTTPS'] == 'on') ? 's' : '';\n $protocol = $this->strleft(strtolower($_SERVER['SERVER_PROTOCOL']), '/') . $s;\n $port = (($_SERVER['SERVER_PORT'] == '80' && $_SERVER['HTTPS'] != 'on') ||\n ($_SERVER['SERVER_PORT'] == '443' && $_SERVER['HTTPS'] == 'on')) ? \n '' : (':' .$_SERVER['SERVER_PORT']);\n $path = $this->strleft($_SERVER['REQUEST_URI'], '?');\n $parsed_params = '';\n $delm = '?';\n foreach (array_reverse($params) as $key => $val) {\n if (!empty($val)) {\n $parsed_key = $key[0] == '_' ? $key : '_' . $key;\n $parsed_params .= $delm . urlencode($parsed_key) . '=' . urlencode($val);\n $delm = '&';\n }\n }\n $cfg = rcmail::get_instance()->config->all();\n if ( $cfg['cas_webmail_server_name'] ) {\n $serverName = $cfg['cas_webmail_server_name'];\n } else {\n $serverName=$_SERVER['SERVER_NAME'];\n }\n return $protocol . '://' . $serverName . $port . $path . $parsed_params;\n }", "protected function addToCurrentUrl($arrParams)\r\n\t{\r\n\t\t$strUrl = $this->Environment->request;\r\n\t\t\r\n\t\tforeach($arrParams as $arrParam)\r\n\t\t{\r\n\t\t\t$strUrl .= (strpos($strUrl, '?') !== false) ? '&' : '?';\t\r\n\t\t\t$strUrl .= $arrParam[0] . '=' . $arrParam[1];\r\n\t\t}\r\n\t\t\r\n\t\treturn $strUrl;\r\n\t}", "public function formatLink(Url $url) {\n $query = $url->getQuery();\n $url->setQuery(array());\n\n // extract path to separate params and remove actions\n $parts = explode(self::REWRITE_PARAM_TO_ACTION_DELIMITER, $url->getPath());\n\n foreach ($parts as $part) {\n\n // only extract \"normal\" parameters, avoid actions\n if (strpos($part, '-action') === false) {\n\n $paths = explode('/', strip_tags($part));\n array_shift($paths);\n\n // create key => value pairs from the current request\n $x = 0;\n while ($x <= (count($paths) - 1)) {\n\n if (isset($paths[$x + 1])) {\n $url->setQueryParameter($paths[$x], $paths[$x + 1]);\n }\n\n // increment by 2, because the next offset is the key!\n $x = $x + 2;\n }\n }\n }\n\n // reset the path to not have duplicate path due to generic param generation\n $url->setPath(null);\n\n // merge query now to overwrite values already contained in the url\n $url->mergeQuery($query);\n\n $resultUrl = $this->getFormattedBaseUrl($url);\n\n $path = $url->getPath();\n if (!empty($path)) {\n $resultUrl .= $path;\n }\n\n $query = $url->getQuery();\n if (count($query) > 0) {\n foreach ($query as $name => $value) {\n // allow empty params that are action definitions to not\n // exclude actions with no params!\n if (!empty($value) || (empty($value) && strpos($name, '-action') !== false)) {\n if (strpos($name, '-action') === false) {\n $resultUrl .= '/' . $name . '/' . $value;\n } else {\n // action blocks must be separated with group indicator\n // to be able to parse the parameters\n $resultUrl .= self::REWRITE_PARAM_TO_ACTION_DELIMITER . $name . '/' . $value;\n }\n }\n }\n }\n\n // add fc actions\n $actions = $this->getActionsUrlRepresentation(true);\n if (!empty($actions)) {\n $resultUrl .= self::REWRITE_PARAM_TO_ACTION_DELIMITER . $actions;\n }\n\n return $resultUrl;\n }", "protected function prepareUrl()\n {\n $address = rtrim($this->config['url'], '/');\n\n if (substr_compare($address, static::API_PATH, -strlen(static::API_PATH)) !== 0) {\n $address .= static::API_PATH;\n }\n\n return $address;\n }", "public function composeUri($params)\n {\n $ret = '';\n $first = true;\n\n foreach ($params as $param => $values) {\n if (!$first) {\n $ret .= $this->seperators['param'];\n }\n $first = false;\n $internal = $param;\n if ($external = $this->translateKeyOutput($param)) {\n $param = $external;\n }\n $ret .= $param . $this->seperators['key_value'];\n $firstValue = true;\n foreach ($values as $value) {\n if ($external = $this->translateValueOutput($internal, $value)) {\n $value = $external;\n }\n if (!$firstValue) {\n $ret .= $this->seperators['value'];\n } else {\n $firstValue = false;\n }\n $ret .= urlencode($value);\n }\n }\n\n return $ret;\n }", "function build_url(array $parts) {\n return (isset($parts['scheme']) ? \"{$parts['scheme']}:\" : '') . \n ((isset($parts['user']) || isset($parts['host'])) ? '//' : '') . \n (isset($parts['user']) ? \"{$parts['user']}\" : '') . \n (isset($parts['pass']) ? \":{$parts['pass']}\" : '') . \n (isset($parts['user']) ? '@' : '') . \n (isset($parts['host']) ? \"{$parts['host']}\" : '') . \n (isset($parts['port']) ? \":{$parts['port']}\" : '') . \n (isset($parts['path']) ? \"{$parts['path']}\" : '') . \n (isset($parts['query']) ? \"?{$parts['query']}\" : '') . \n (isset($parts['fragment']) ? \"#{$parts['fragment']}\" : '');\n}", "function build_url($parts)\n{\n return ( isset($parts['scheme']) ? \"{$parts['scheme']}:\" : '' ) .\n ( ( isset($parts['user']) || isset($parts['host']) ) ? '//' : '' ) .\n ( isset($parts['user']) ? \"{$parts['user']}\" : '' ) .\n ( isset($parts['pass']) ? \":{$parts['pass']}\" : '' ) .\n ( isset($parts['user']) ? '@' : '' ) .\n ( isset($parts['host']) ? \"{$parts['host']}\" : '' ) .\n ( isset($parts['port']) ? \":{$parts['port']}\" : '' ) .\n ( isset($parts['path']) ? \"{$parts['path']}\" : '' ) .\n ( isset($parts['query']) ? \"?{$parts['query']}\" : '' ) .\n ( isset($parts['fragment']) ? \"#{$parts['fragment']}\" : '' );\n}", "public function _assembleUrl(array $params){\n\n $params = array_merge($params, $this->_linkRouter['defaultParams']);\n $router = Zend_Controller_Front::getInstance()->getRouter();\n $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();\n $url = $router->assemble($params, $this->_linkRouter['name'], true);\n //@TODO check if there is any problem concatanating _baseUrl and $url\n // using apache alias, concatanation makes duplicates. but using virtualhosts with subdomains, no problem.\n //$url = $baseUrl . $url;\n return $url;\n }", "protected function buildUrl(string $url, array $params = []): string\n {\n $params = http_build_query($this->mergeParams($params));\n\n return $this->baseUrl($url) . ($params ? '?' . $params : '');\n }", "protected function _getUrl() {\n\t\t\t$this->_url =\timplode('/', array(\n\t\t\t\t$this->_baseUrlSegment,\n\t\t\t\t$this->_apiSegment,\n\t\t\t\timplode('_', array(\n\t\t\t\t\t$this->_type,\n\t\t\t\t\t$this->_language,\n\t\t\t\t\t$this->_locale,\n\t\t\t\t)),\n\t\t\t\t$this->_apiVersionSegment,\n\t\t\t\t$this->controller,\n\t\t\t\t$this->function\t\n\t\t\t));\n\n\t\t\tempty($this->_getFields) ?: $this->_url .= '?' . http_build_query($this->_getFields);\n\t\t}", "function CreateUrl($module, $section = '', $category = '', $item = '', $comment = '', $page = '') {\n $url = MODULE.$module;\n if (!empty($section)) {\n $url = $url.SECTION.$section;\n if (!empty($category)) {\n $url = $url.CATEGORY.$category;\n if (!empty($item)) {\n $url = $url.ITEM.$item;\n if (!empty($comment)) {\n $url = $url.COMMENT.$comment;\n if (!empty($page)) {\n $url = $url.PAGE.$comment;\n }\n }\n }\n }\n }\n return $url;\n}", "public function buildURI($params, $apiEntry)\n {\n $separator = \"/\";\n $host = Kohana::config('webserviceclient.socorro_hostname');\n $apiData = array(\n $host,\n $apiEntry,\n \"signatures\"\n );\n\n foreach ($params as $key => $value) {\n $apiData[] = $key;\n $apiData[] = rawurlencode($value);\n }\n\n $apiData[] = ''; // Trick to have the closing '/'\n\n return implode($separator, $apiData);\n }", "private function _url($par = array()) {\n\t\t$get = $_GET;\n\t\t\n\t\tforeach ((array) $par AS $key => $val) { //overide value\n\t\t\tif ($key == 'path') //if path, encode\n\t\t\t\t$get['path'] = \\Crypt::encrypt($val);\n\t\t\telse\n\t\t\t\t$get[$key] = $val;\n\t\t}\n\t\t\n\t\t$url = '//';\n\t\t\n\t\t$url .= $this->_sanitize(g($_SERVER, 'HTTP_HOST').'/'.strtok(g($_SERVER, 'REQUEST_URI'), '?'));\n\t\t\n\t\treturn $url.'?'.http_build_query($get);\n\t}", "function addQuery($url, $params)\n{\n if (is_array($params)){\n if (count($params) > 0){\n $url .= '?';\n foreach ($params as $key => $value):\n $url .= $key . '=' . $value . '&';\n endforeach;\n $url = substr($url, 0, -1);\n }\n } \n return $url;\n}", "function build_url_params ($url_params, $params = '')\n{\n\tforeach ($url_params as $k=>$v)\n\t{\n\t\t$params .= (strlen($params) ? '&' : '?') . $k . '=' . urlencode($v);\n\t}\n\t\n\treturn $params;\n}", "protected function getBaseRequestUrl($segments = null)\n {\n if (is_array($segments)) {\n $segments = implode('/', $segments);\n }\n\n $baseUrl = env('MZCAPI_BASEURL');\n\n return $baseUrl . '/' . $segments;\n }", "protected function buildBaseString($url, $method, $values) {\n\t\t$uri = strtok($url, '?');\n\t\t$baseString = $method . '&' . str_replace(['%7E', '+'], ['~', ' '], rawurlencode($uri)) . '&';\n\t\t$signValues = $values;\n\t\t$parts = parse_url($url);\n\t\tif (isset($parts['query'])) {\n\t\t\tparse_str($parts['query'], $query);\n\t\t\tforeach ($query as $parameter => $value) {\n\t\t\t\t$signValues[$parameter] = $value;\n\t\t\t}\n\t\t}\n\t\tksort($signValues);\n\t\t$baseString .= str_replace(['%7E', '+'], ['~', ' '], rawurlencode(http_build_query($signValues)));\n\t\treturn $baseString;\n\t}", "public static function buildUrl($parameters) {\n\t \n\t $url='';\n\t \n\t // set the base url\n\t if(isset($parameters['baseUrl'])) {\n\t $url .= $parameters['baseUrl'];\n\t unset($parameters['baseUrl']);\n\t } else {\n\t $url .= self::getBaseUrl();\n\t }\n\t \n\t // set the kiosk\n\t if(isset($parameters['kiosk'])) {\n\t $kiosk = $parameters['kiosk'];\n\t unset($parameters['kiosk']);\n\t } else {\n\t $kiosk = self::getKiosk();\n\t }\n\t if(!empty($kiosk)) {\n\t $url .= '/'.$kiosk;\n\t }\n\t \n\t // set the scope\n\t if(isset($parameters['scope'])) {\n\t $url .= '/'.$parameters['scope'];\n\t unset($parameters['scope']);\n\t } else {\n\t $url .= '/'.self::getScope();\n\t }\n\t \n\t if(isset($parameters['action'])) {\n\t $url .= '/'. $parameters['action'].'.do';\n\t unset($parameters['action']);\n\t } else {\n\t $url .= '/'. self::getAction().'.do';\n\t }\n\t \n\t if(count($parameters)) {\n\t $url .= '?'.http_build_query($parameters);\n\t }\n\t \n\t return $url;\n\t}", "function getURL(string $location, array $param = []){\n $base_url = getBaseURL();\n $path = !empty($param) || $location !== \"index\" ? \"{$location}.php\" : \"\";\n if(!empty($param)){\n $query_params = http_build_query($param);\n $path .= \"?{$query_params}\";\n // var_dump($query_params);\n // exit();\n }\n return \"{$base_url}/{$path}\";\n}", "private function getPreparedUrlString()\n {\n $urlstring = $this->url->getRawUrl();\n\n // Remove schem if its set\n\n $urlstring = preg_replace('/^([a-z]+:\\/\\/)/i', '', $urlstring);\n\n // Remove double slashes\n\n $urlstring = preg_replace('/(\\/\\/)/i', '/', $urlstring);\n\n // Remove everything before the fist slash and the the slash too.\n\n $slashpos = strpos($urlstring, '/');\n\n if ($slashpos !== false) {\n $urlstring = substr($urlstring, $slashpos +1);\n }\n\n // Check if the last sign a slash to\n\n if (substr($urlstring, -1) == '/') {\n $urlstring = substr($urlstring, 0, strlen($urlstring) -1);\n }\n\n return $urlstring;\n }", "function qa_path($request, $params = null, $rooturl = null, $neaturls = null, $anchor = null)\n{\n\tif (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }\n\n\tif (!isset($neaturls)) {\n\t\trequire_once QA_INCLUDE_DIR . 'app/options.php';\n\t\t$neaturls = qa_opt('neat_urls');\n\t}\n\n\tif (!isset($rooturl))\n\t\t$rooturl = qa_path_to_root();\n\n\t$url = $rooturl . ((empty($rooturl) || (substr($rooturl, -1) == '/')) ? '' : '/');\n\t$paramsextra = '';\n\n\t$requestparts = explode('/', $request);\n\t$pathmap = qa_get_request_map();\n\n\tif (isset($pathmap[$requestparts[0]])) {\n\t\t$newpart = $pathmap[$requestparts[0]];\n\n\t\tif (strlen($newpart))\n\t\t\t$requestparts[0] = $newpart;\n\t\telseif (count($requestparts) == 1)\n\t\t\tarray_shift($requestparts);\n\t}\n\n\tforeach ($requestparts as $index => $requestpart) {\n\t\t$requestparts[$index] = urlencode($requestpart);\n\t}\n\t$requestpath = implode('/', $requestparts);\n\n\tswitch ($neaturls) {\n\t\tcase QA_URL_FORMAT_INDEX:\n\t\t\tif (!empty($request))\n\t\t\t\t$url .= 'index.php/' . $requestpath;\n\t\t\tbreak;\n\n\t\tcase QA_URL_FORMAT_NEAT:\n\t\t\t$url .= $requestpath;\n\t\t\tbreak;\n\n\t\tcase QA_URL_FORMAT_PARAM:\n\t\t\tif (!empty($request))\n\t\t\t\t$paramsextra = '?qa=' . $requestpath;\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\t$url .= 'index.php';\n\n\t\tcase QA_URL_FORMAT_PARAMS:\n\t\t\tif (!empty($request)) {\n\t\t\t\tforeach ($requestparts as $partindex => $requestpart)\n\t\t\t\t\t$paramsextra .= (strlen($paramsextra) ? '&' : '?') . 'qa' . ($partindex ? ('_' . $partindex) : '') . '=' . $requestpart;\n\t\t\t}\n\t\t\tbreak;\n\t}\n\n\tif (isset($params))\n\t\tforeach ($params as $key => $value)\n\t\t\t$paramsextra .= (strlen($paramsextra) ? '&' : '?') . urlencode($key) . '=' . urlencode((string)$value);\n\n\treturn $url . $paramsextra . (empty($anchor) ? '' : '#' . urlencode($anchor));\n}", "function buildQueryString($params, $parent=\"\")\n{\n\t$query = \"\";\n\n\tforeach ($params as $key => $value)\n\t{\n\t\tif (!empty($query))\n\t\t$query .= '&';\n\n\t\tif (!empty($parent))\n\t\t$key = \"{$parent}[{$key}]\";\n\n\t\tif (!is_array($value))\n\t\t{\n\t\t\t$query .= \"$key=\".rawurlencode($value);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$query .= buildQueryString($value, $key);\n\t\t}\n\t}\n\n\treturn $query;\n}", "function appendQueryString($url, $qs) {\n $parsed = parse_url($url);\n\n // Add trailing slash to original URL if only a root URL is given\n // eg. www.example.com --> www.example.com/\n if ($parsed['path'] == NULL) {\n $url = $url . '/';\n }\n\n // Add the query string separator\n if ($parsed['query'] == NULL) {\n $url = $url . '?';\n } else {\n $url = $url . '&';\n }\n\n return $url . $qs;\n}", "function url_query_append( $url, $vars=array()){\n\t\t\n\t\t//vars\n\t\t$url = parse_url($url);\n\t\t$query_vars = array();\n\t\tparse_str(@$url['query'], $query_vars);\n\t\t$query_vars = array_merge($query_vars, $vars);\n\t\t//build and return new string\n\t\treturn \"{$url['scheme']}://{$url['host']}{$url['path']}\"\n\t\t\t. \"?\" . http_build_query($query_vars);\n\t}", "protected function composeExecURL()\n {\n $exec_url = self::BASE_URI . \"?key=\" . $this->key . \"&url=\" . urlencode($this->url);\n\n if(!empty($this->options)) {\n foreach($this->options as $key => $value) {\n $exec_url .= \"&\" . $key . \"=\" . $value;\n }\n }\n\n $this->exec_url = $exec_url;\n }", "private function base_uri( $localizable = TRUE ) {\r\n\t\treturn implode ( '/', array (\r\n\t\t\t\t$this->host,\r\n\t\t\t\tself::API_VERSION \r\n\t\t) );\r\n\t}", "function mergeQueryString($options, $prepend = \"?\")\n{\n // Parse querystring into array\n $query = [];\n parse_str($_SERVER[\"QUERY_STRING\"], $query);\n\n // Merge query string with new options\n $query = array_merge($query, $options);\n\n // Build and return the modified querystring as url\n return $prepend . http_build_query($query);\n}", "private function buildUrl(string $url): string\n { $this->states['url'] = $url;\n if (empty($this->states['query'])) {\n $url .= '?' . $this->states['query'];\n }\n\n // add further url parameters wird & (if params alsready exists) or ? (if new params are to be added)\n if (preg_match('/\\?/', $url)) {\n $url .= '&' . $this->getUrlRequests();\n } else {\n $url .= '?' . $this->getUrlRequests();\n }\n\n // add action\n if (false === strpos($url, 'action=') && false === strpos($url, '?')) {\n $url .= '?action=' . $this->states['action'];\n } elseif (false === strpos($url, 'action=')) {\n $url .= '&action=' . $this->states['action'];\n }\n\n // add protocol\n if (false === strpos($url, 'http')) {\n $url = $this->params->get('url') . $url;\n }\n // add protocol\n if (false === strpos($url, 'http')) {\n $url = 'https://' . $url;\n }\n\n // further settings\n if (false !== strpos($url, 'action=parse') || false !== strpos($url, 'action=query')) {\n if (false === strpos($url, 'formatversion=2') && 0 < strpos($url, 'formatversion=')) {\n $url = preg_replace('`formatversion=([0-9]*)`i', 'formatversion=2', $url);\n } elseif (false === strpos($url, 'formatversion=2')) {\n $url .= '&formatversion=2';\n }\n }\n\n // encode url properly an return\n $url = html_entity_decode($url);\n return $url;\n }", "#[Pure]\nfunction http_build_str(array $query, $prefix = null, $arg_separator = null) {}", "function buildRESTAPIUrl($SiteURL, $APILink, $ObjectType, $ObjectIdentifier){\n\t\t//TODO: add ability to remove double slashes\n\t\t$url = $SiteURL . $APILink . \"/\" . $ObjectIdentifier . $ObjectType;\n\t\treturn $url;\n\t}", "public function getSectionURL() {\n $sectionUrl = $this->url . '/' . $this->protoVersion . '/';\n $section = $this->getSection();\n if (!empty($section)) {\n $sectionUrl .= $section;\n }\n return $sectionUrl;\n }", "public function assemble(\n array $params = array(),\n array $options = array()\n ) {\n if (!$params) {\n return $this->prefix;\n }\n\n $url = parent::assemble($params, $options);\n $urlPrefix = $this->prefix . $this->paramDelimiter\n . $this->defaults['module'];\n $urlSuffix = substr($url, strlen($urlPrefix));\n $url = $this->prefix . $urlSuffix;\n\n return $url;\n }", "protected function build_url(array $url_parts)\n {\n // remove unnecessary folder separators\n $url = preg_replace('/\\/+/', '/', $url_parts['path']);\n\n // add the URL params\n $url_params = [];\n if (isset($url_parts['query'])) {\n parse_str($url_parts['query'], $url_params);\n $query_string = http_build_query($url_params);\n $url = $url . '?' . $query_string;\n }\n\n if (isset($url_parts['host'])) {\n $scheme = isset($url_parts['scheme']) ? $url_parts['scheme'] . '://' : '';\n $url = $scheme . $url_parts['host'] . '/' . ltrim($url, '/');\n }\n\n return $url;\n }", "public function buildQueryString();", "public static function fullUrl() {\n\t\t\t$s = empty($_SERVER['HTTPS']) ? '' : ($_SERVER['HTTPS'] == 'on') ? 's' : '';\n\t\t\t$protocol = substr(strtolower($_SERVER['SERVER_PROTOCOL']), 0, strpos(strtolower($_SERVER['SERVER_PROTOCOL']), '/')) . $s;\n\t\t\t$port = ($_SERVER['SERVER_PORT'] == '80') ? '' : (\":\".$_SERVER['SERVER_PORT']);\n\t\t\treturn $protocol . \"://\" . $_SERVER['HTTP_HOST'] . $port . $_SERVER['REQUEST_URI'];\n\t\t}", "public function build() {\n return implode('&', $this->uriParams);\n }", "private function buildUrlFromBase($url)\n {\n if (!empty($this->parameters)) {\n $url .= stripos($url, '?') !== false ? '&' : '?';\n $url .= http_build_query((array) $this->parameters, '', '&');\n }\n\n $this->parameters = null;\n\n return $url;\n }", "protected static function makeBaseURL(...$base_url_components): string { // phpcs:ignore\n return self::makePath(...$base_url_components) . '/';\n }", "public function getRequestUri() {\n\t\t$final = '';\n\t\tif($this->path) {\n\t\t\t$final .= $this->path;\n\t\t}\n\t\tif($this->query) {\n\t\t\t$final .= '?' . $this->query;\n\t\t}\n\t\treturn $final;\n\t}", "function build_url ($path, $url_params = array(), $xhtml = true, $full_http_path = false)\n{\n\tglobal $phpframe_build_url_hooks;\n\n // Call build_url hooks to modify path/url params\n\tforeach ($phpframe_build_url_hooks as $callback)\n\t{\n\t\teval($callback.'($path, $url_params, $xhtml, $full_http_path);');\n\t}\n\t\n\t// Set root path if path is not absolute already\n\tif (!preg_match('#^(https?\\://)#si', $path))\n\t{\n\t\t// Include root path to file, relative to top-level web directory? \n\t\tif (!preg_match('#^/#', $path))\n\t\t{\n\t\t\t$path = (is_string($full_http_path) ? '/' : PHPFRAME_ROOT_PATH) . $path;\n\t\t}\n\t\t\n\t\t// Include http://?\n\t\tif ($full_http_path)\n\t\t{\n\t\t\t$path = ($full_http_path === true ? PHPFRAME_ROOT_URL : $full_http_path) . $path;\n\t\t}\n\t}\n\t\n\t// Add URL parameters\n\t$path .= build_url_params($url_params);\n\t\n\t// If it's XHTML, htmlspecialchar it\n\t// This is in case URLs have quotes in them which can break <a> tags\n\tif ($xhtml)\n\t{\n\t\t$path = htmlspecialchars($path);\n\t}\n\t\n\treturn $path;\n}", "function formatCurrentUrl() ;", "public function url() {\n if (empty($this->parameters)) {\n return $this->url;\n }\n\n return $this->url . '?' . http_build_query($this->parameters);\n }", "public function buildUrl(array $params) {\n $params = array_merge(\n $this->getParamsForRequest(),\n $params\n );\n\t\tif (!isset($params['format']))\n\t\t\t$params['format'] = 'php_serial';\n return $this->rest_url . '?' . $this->signParams($params);\n }", "protected function buildRequestUri()\n {\n $requestParameters = array();\n\n // add entity\n if (!empty($this->defaultOptions['entity'])) {\n $tmp = array_keys($this->defaultOptions['entity']);\n $key = array_pop($tmp);\n $requestParameters[] = 'entity=' . $this->defaultOptions['entity'][$key];\n }\n\n // add media type\n if (!empty($this->defaultOptions['mediaType'])) {\n $requestParameters[] = 'media=' . $this->defaultOptions['mediaType'];\n }\n\n // add attribute\n if (!empty($this->defaultOptions['attribute'])) {\n $requestParameters[] = 'attribute=' . $this->defaultOptions['attribute'];\n }\n\n // add language\n if (!empty($this->defaultOptions['language'])) {\n $requestParameters[] = 'lang=' . $this->defaultOptions['language'];\n }\n\n // add limit\n if ($this->defaultOptions['limit'] <> 100) {\n $requestParameters[] = 'limit=' . $this->defaultOptions['limit'];\n }\n\n // add country\n if ($this->defaultOptions['country'] != 'us') {\n $requestParameters[] = 'country=' . $this->defaultOptions['country'];\n }\n\n // add callback\n if (!empty($this->defaultOptions['callback'])) {\n $requestParameters[] = 'callback=' . $this->defaultOptions['callback'];\n }\n\n // add version\n if ($this->defaultOptions['version'] <> 2) {\n $requestParameters[] = 'version=' . $this->defaultOptions['version'];\n }\n\n // add explicity\n if ($this->defaultOptions['explicit'] != 'yes') {\n $requestParameters[] = 'explicit=' . $this->defaultOptions['explicit'];\n }\n\n return implode('&', $requestParameters);\n }", "public function create_query_url($path, $params = array()) {\r\n // For consistency with other libraries, accept just a UID for\r\n // /resource/$uid queries\r\n if(preg_match(\"/^[a-z0-9]{4}-[a-z0-9]{4}$/\", $path)) {\r\n $path = \"/resource/\" . $path . \".json?\" . \"$\" . \"limit=\" . $this->limit . \r\n \"&$\" . \"offset=\" . $this->offset;\r\n }\r\n // The full URL for this resource is the root + the path\r\n $full_url = $this->root_url . $path;\r\n // Build up our array of parameters\r\n $parameters = array();\r\n foreach($params as $key => $value) {\r\n array_push($parameters, urlencode($key) . \"=\" . urlencode($value));\r\n }\r\n if(count($parameters) > 0) {\r\n $full_url .= \"?\" . implode(\"&\", $parameters);\r\n }\r\n return $full_url;\r\n }", "function base_url($param = []) {\n\n\n $base_url = 'https://rplsmpku.000webhostapp.com/';\n $result = (!$param) ? $base_url : $base_url . $param;\n\n return $result;\n}", "public function getURL($append = ''){\n\t\treturn $this->url.ltrim($append, '/');\n\t}", "function site_url($url='',$full=false)\n{\n\t$params = $_REQUEST['CFSystem'];\n\t$uri = (!empty($_SERVER['HTTPS'])) ? \"https://\".$_SERVER['SERVER_NAME']: \"http://\".$_SERVER['SERVER_NAME'];\n\t$uri .= rtrim(isset($_REQUEST['CFSystem']['baseurl']) ? $_REQUEST['CFSystem']['baseurl'] : '','/');\n\tif(empty($url))\n\t{\n\t\tif(!$full)\n\t\t{\n\t\t\treturn '/'.trim($params['baseurl'],'/');\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn $uri.'/'.trim($params['baseurl'],'/');\n\t\t}\n\t}\n\telse\n\t{\n\t\t$arr = explode('/',$url);\n\t\t$out = '';\n\t\tif($_REQUEST['CFSystem']['url_friendly']==0)\n\t\t{\n\t\t\t$str_out = 'index.php?';\n\t\t\tfor($i=0;$i<count($arr);$i++)\n\t\t\t{\n\t\t\t\tif($i==0)\n\t\t\t\t$str_out.='cfo='.$arr[$i].'&';\n\t\t\t\telseif($i==1)\n\t\t\t\tif($i==0)\n\t\t\t\t$str_out.='cfu='.$arr[$i].'&';\n\t\t\t\telse\n\t\t\t\t$str_out.='cfparams_'.$i.'='.$arr[$i].'&';\n\t\t\t}\n\t\t\t$out = trim($str_out,'&');\n\t\t}\n\t\telseif($_REQUEST['CFSystem']['url_friendly']==1)\n\t\t{\n\t\t\t$out = $url;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$out = 'index.php/'.$url;\n\t\t}\n\t\tif(!$full)\n\t\t{\n\t\t\treturn $out;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn $uri.'/'.trim($out,'/');\n\t\t\t#return $uri.str_replace('//','/','/'.basename($_REQUEST['CFSystem']['baseurl']).'/'.trim($out,'/'));\n\t\t}\n\t}\n}", "public function FormatParametersForUrl($params) {\n return http_build_query($params, NULL, '&');\n }", "function _build_url() {\n\t\t// Add transaction ID for better detecting double requests in AUTH server\n\t\tif($GLOBALS['config']['application']['tid'] == '') $GLOBALS['config']['application']['tid'] = rand(0, 10000);\n\n\t\t$url = $this->url.'&action='.$this->action.'&tid='.$GLOBALS['config']['application']['tid'];\n\t\t\n\t\treturn $url;\n\t}", "public function full($query = false)\n {\n $uri = $_SERVER['REQUEST_URI'];\n\n if ($query === false)\n $uri = strtok($uri, '?');\n\n $url = sprintf(\n \"%s://%s%s\",\n isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http',\n $_SERVER['SERVER_NAME'],\n $uri\n );\n\n return rtrim($url, '/');\n }", "private function generateURL()\n\t{\n\t\t// Is there's a query string, strip it from the URI\n\t\t$sURI\t= ($iPos = strpos($_SERVER['REQUEST_URI'], '?')) ?\n\t\t\t\t\tsubstr($_SERVER['REQUEST_URI'], 0, $iPos) :\n\t\t\t\t\t$_SERVER['REQUEST_URI'];\n\n\t\t// Is there's a ampersand string, strip it from the URI\n\t\t$sURI\t= ($i = strpos($sURI, '&')) ?\n\t\t\t\t\tsubstr($sURI, 0, $i) :\n\t\t\t\t\t$sURI;\n\n\t\t// Is there's a hash string, strip it from the URI\n\t\t$sURI\t= ($i = strpos($sURI, '#')) ?\n\t\t\t\t\tsubstr($sURI, 0, $i) :\n\t\t\t\t\t$sURI;\n\n\t\t// If we're on page 1\n\t\tif($this->iPage == 1)\n\t\t{\n\t\t\t$this->sURL\t\t= $sURI;\n\t\t}\n\t\t// Else we need to pull off the current page\n\t\telse\n\t\t{\n\t\t\t// Split the URI by / after trimming them off the front and end\n\t\t\t$aURI\t= explode('/', trim($sURI, '/'));\n\n\t\t\t// If the last part doesn't match the current page\n\t\t\t$iPage\t= array_pop($aURI);\n\t\t\tif($iPage != $this->iPage) {\n\t\t\t\ttrigger_error(__METHOD__ . ' Error: Invalid page passed. ' . $iPage . ' / ' . $this->iPage, E_USER_ERROR);\n\t\t\t}\n\n\t\t\t// If there is no other parts\n\t\t\tif(count($aURI) == 0) {\n\t\t\t\t$this->sURL = '/';\n\t\t\t} else {\n\t\t\t\t$this->sURL = '/' . implode('/', $aURI) . '/';\n\t\t\t}\n\t\t}\n\n\t\t// Set the query string\n\t\t$this->sQuery\t= ($iPos) ? substr($_SERVER['REQUEST_URI'], $iPos) : '';\n\t}", "protected function buildAddress(array $parts): string\n {\n $url = $scheme = '';\n\n if (isset($parts['scheme'])) {\n $scheme = $parts['scheme'];\n $url .= $scheme . ':';\n }\n\n if (isset($parts['host'])) {\n $url .= '//';\n if (isset($parts['user'])) {\n $url .= $parts['user'];\n if (isset($parts['pass'])) {\n $url .= ':' . $parts['pass'];\n }\n $url .= '@';\n }\n\n $url .= $parts['host'];\n\n // Only include the port if it is not the default port of the scheme\n if (isset($parts['port'])\n && !(('http' == $scheme && 80 == $parts['port']) || ('https' == $scheme && 443 == $parts['port']))\n ) {\n $url .= ':' . $parts['port'];\n }\n }\n\n // Add the path component if present\n if (isset($parts['path']) && (0 !== strlen(strval($parts['path'])))) {\n // Always ensure that the path begins with '/' if set and something is before the path\n if ($url && strval($parts['path'])[0] != '/' && '/' != substr($url, -1)) {\n $url .= '/';\n }\n $url .= $parts['path'];\n }\n\n // Add the query string if present\n if (isset($parts['query'])) {\n $url .= '?' . $parts['query'];\n }\n\n // Ensure that # is only added to the url if fragment contains anything.\n if (isset($parts['fragment'])) {\n $url .= '#' . $parts['fragment'];\n }\n\n return $url;\n }", "public function getUrl()\n {\n return trim(implode('/', $this->path), '/').$this->getParams();\n }", "private function buildBaseUrl()\n {\n return $this->scheme() . $this->host;\n }", "private function buildSigningBase(): string {\r\n $parameterString = http_build_query($this->clientParams);\r\n return \"$this->httpMethod&\" . urlencode($this->host . $this->endpoint) . \"&\" . urlencode($parameterString);\r\n }", "public function url(array $params = array(), $protocol = null)\n\t{\n\t\treturn\n\t\t\t// relative protocol?\n\t\t\t($protocol === null ? '//' : $protocol.'://').\n\t\t\t// url_base is set?\n\t\t\t($this->url_base ? $this->url_base : \\app\\CFS::config('ibidem/base')['url_base']).\n\t\t\t// append the uri\n\t\t\t'/'.$this->path;\t\t\n\t}", "protected function buildQueryString()\n {\n $parameters = $this->_queryParameters;\n $parameters['USER'] = $this->_username;\n $parameters['PWD'] = $this->_password;\n $parameters['SIGNATURE'] = $this->_signature;\n $parameters['VERSION'] = self::VERSION;\n $parameters['METHOD'] = $this::METHOD;\n return http_build_query($parameters);\n }", "public static function baseString($method, $url) {\n \n $method = strtoupper(trim($method));\n if(($method != \"GET\")&&($method != \"POST\")) {\n $method = \"GET\";\n }\n \n if(!is_object($url)) {\n return false;\n }\n \n $base = \"\";\n $noQuery = array_shift(explode('?',$url->toString()));\n $query = $url->getQuery();\n \n /* percent encode the method and URL */\n \n $args = array_map(\n 'littlemdesign_web_http_URL::percentEncode',\n array(\n $method,\n $noQuery\n )\n );\n \n $base = implode('&', $args);\n \n /*\n * The spec says to sort on key and then on value for keys, but\n * in most cases we should not have duplicate keys in requests,\n * so we just sort based on the key. \n * \n */\n\n uksort($query, 'strcmp');\n\n $paramString = \"\";\n foreach($query as $k => $v) {\n \n /* percent encode the paramters (including OAuth parameters) */\n \n $k = littlemdesign_web_http_URL::percentEncode($k);\n $v = littlemdesign_web_http_URL::percentEncode($v);\n \n $paramString .= \"$k=$v&\";\n }\n \n $paramString = trim($paramString, \"&\");\n \n /* percent encode the entire parameters string */\n \n $paramString = littlemdesign_web_http_URL::percentEncode($paramString);\n \n /* \n * ok, we now have everything for a complete base string\n * suitable for signing.\n * \n */\n \n $base .= \"&$paramString\";\n \n /* all done */\n \n return $base;\n }", "public static function buildUrl($basePath, $path, $params)\n {\n return $basePath . $path . \"?\" . static::joinQuery($params);\n }", "private function makeUrl($appendUrl) {\n \n return $this->bitreserveUrl . $appendUrl;\n }", "protected function composeUrl($url, array $params = [])\n\t{\n\t\tif (strpos($url, '?') === false) {\n\t\t\t$url .= '?';\n\t\t} else {\n\t\t\t$url .= '&';\n\t\t}\n\t\t$url .= http_build_query($params, '', '&', PHP_QUERY_RFC3986);\n\t\treturn $url;\n\t}", "public function formatCurrentUrl() {}", "public function formatCurrentUrl() {}", "public function formatCurrentUrl() {}", "public function formatCurrentUrl() {}", "public function formatCurrentUrl() {}", "public function formatCurrentUrl() {}", "function _fetch_uri_string()\n\t{\n\t\tif (strtoupper($this->config->item('uri_protocol')) == 'AUTO')\n\t\t{\n\t\t\t// If the URL has a question mark then it's simplest to just\n\t\t\t// build the URI string from the zero index of the $_GET array.\n\t\t\t// This avoids having to deal with $_SERVER variables, which\n\t\t\t// can be unreliable in some environments\n\t\t\tif (is_array($_GET) && count($_GET) == 1 && trim(key($_GET), '/') != '')\n\t\t\t{\n\t\t\t\t$this->uri_string = key($_GET);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Is there a PATH_INFO variable?\n\t\t\t// Note: some servers seem to have trouble with getenv() so we'll test it two ways\n\t\t\t$path = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO');\n\t\t\tif (trim($path, '/') != '' && $path != \"/\".SELF)\n\t\t\t{\n\t\t\t\t$this->uri_string = $path;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// No PATH_INFO?... What about QUERY_STRING?\n\t\t\t$path = (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING');\n\t\t\tif (trim($path, '/') != '')\n\t\t\t{\n\t\t\t\t$this->uri_string = $path;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// No QUERY_STRING?... Maybe the ORIG_PATH_INFO variable exists?\n\t\t\t$path = (isset($_SERVER['ORIG_PATH_INFO'])) ? $_SERVER['ORIG_PATH_INFO'] : @getenv('ORIG_PATH_INFO');\n\t\t\tif (trim($path, '/') != '' && $path != \"/\".SELF)\n\t\t\t{\n\t\t\t\t// remove path and script information so we have good URI data\n\t\t\t\t$this->uri_string = str_replace($_SERVER['SCRIPT_NAME'], '', $path);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// We've exhausted all our options...\n\t\t\t$this->uri_string = '';\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$uri = strtoupper($this->config->item('uri_protocol'));\n\n\t\t\tif ($uri == 'REQUEST_URI')\n\t\t\t{\n\t\t\t\t$this->uri_string = $this->_parse_request_uri();\n\t\t\t\treturn;\n\t\t\t}\n\n elseif($uri == 'PATH_INFO'){\n if(@getenv($uri)){\n $this->uri_string = (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri);\n }else{\n $this->uri_string = $this->_parse_pathinfo_uri();\n }\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$this->uri_string = (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri);\n\t\t}\n\n\t\t// If the URI contains only a slash we'll kill it\n\t\tif ($this->uri_string == '/')\n\t\t{\n\t\t\t$this->uri_string = '';\n\t\t}\n\t}", "private function _create_query_string( $url, $query ) {\n\t\t$query_string = '';\n\n\t\tforeach ( $query as $var => $value ) {\n\n\t\t\tif( $var ) {\n\n\t\t\t\t// check, if required vars have a value\n\t\t\t\tif( $var[0] == '*' && $value === null ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// only add to query if there is a value\n\t\t\t\tif( $value !== null && $value !== '' ) {\n\t\t\t\t\t$query_string .= '&' . ltrim( $var, '*' ) . '=' . urlencode( $value );\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\treturn $url . ltrim( $query_string, '&' );\n\t}", "function addURLQuery($query){\n\t\t$query = \"?\".$query.\"&\";\n\t\tforeach($_GET as $k=>$v){\n\t\t\t$query .= \"$k=$v\".\"&\";\n\t\t}\n\t\t$query = substr($query, 0, -1);//chop last ampersand off\n\t\t$curl = preg_replace('/\\?.*/', '', curPageURL()); //get current URL and remove the query string\n\t\treturn $curl.$query;\n\t}", "protected function calculateBaseString($url, $method, array $parameters)\n {\n\t// redefine\n\t$url = (string) $url;\n\t$parameters = (array) $parameters;\n\n\t// init var\n\t$pairs = array();\n\t$chunks = array();\n\n\t// sort parameters by key\n\tuksort($parameters, 'strcmp');\n\n\t// loop parameters\n\tforeach ($parameters as $key => $value) {\n\t // sort by value\n\t if(is_array($value)) $parameters[$key] = natsort($value);\n\t}\n\n\t// process queries\n\tforeach ($parameters as $key => $value) {\n\t // only add if not already in the url\n\t if (substr_count($url, $key . '=' . $value) == 0) {\n\t\t$chunks[] = self::urlencode_rfc3986($key) . '%3D' .\n\t\t\t self::urlencode_rfc3986($value);\n\t }\n\t}\n\n\t// buils base\n\t$base = $method . '&';\n\t$base .= urlencode($url);\n\t$base .= (substr_count($url, '?')) ? '%26' : '&';\n\t$base .= implode('%26', $chunks);\n\t$base = str_replace('%3F', '&', $base);\n\n\t// return\n\treturn $base;\n }", "protected function _buildQueryString($params = array()) {\n if (!is_array($params)) {\n $params = array();\n }\n return count($params) ? http_build_query($params) : \"\";\n }", "function getURL($url, $prams)\n {\n return $url . '?' . http_build_query($prams);\n }", "private function generateUrl(string $append): string\n {\n return $this->baseUrl . '/services/data/' . $this->clientConfig->getVersion() . '/' . $append;\n }" ]
[ "0.6093951", "0.6050948", "0.59143114", "0.57995987", "0.566326", "0.5639802", "0.56183654", "0.56003124", "0.55905324", "0.5583229", "0.55726826", "0.5559579", "0.55568993", "0.55234265", "0.5523188", "0.5499795", "0.5465034", "0.54419494", "0.5425271", "0.5397729", "0.53547597", "0.53538585", "0.5339727", "0.53184974", "0.53011507", "0.52954", "0.52858114", "0.52715707", "0.5271007", "0.5268378", "0.5258858", "0.5256325", "0.5252781", "0.52436996", "0.5232581", "0.5227992", "0.5202368", "0.5198814", "0.5188755", "0.51825476", "0.5182288", "0.51810896", "0.5174741", "0.51736116", "0.5167895", "0.5160033", "0.51588976", "0.5152831", "0.5141682", "0.5132073", "0.51126564", "0.51103365", "0.5099686", "0.5097766", "0.5093854", "0.5093496", "0.5092058", "0.50770676", "0.50737804", "0.5067038", "0.50632054", "0.5059556", "0.50587094", "0.5051609", "0.5051155", "0.50441664", "0.50402373", "0.5038845", "0.50370693", "0.50368005", "0.5033965", "0.5029956", "0.5026291", "0.50218225", "0.5021786", "0.50188047", "0.50154674", "0.50071603", "0.5006908", "0.4997526", "0.4995151", "0.49875435", "0.49742332", "0.49731335", "0.49649385", "0.49647182", "0.49585295", "0.4954962", "0.4954962", "0.4954962", "0.4954962", "0.4954962", "0.4954962", "0.49534336", "0.49449846", "0.49420354", "0.49378106", "0.49348453", "0.4930386", "0.49286467" ]
0.6669317
0
array that holds image object should be only one object
public function __construct($thumb_id, $file_ref){ $this->thumb_id = $thumb_id; $this->file_ref = $file_ref; $this->images = $this->get_related_images(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getImageArray();", "function getImages() \t{\n \t\treturn $this->images_array;\n \t}", "public function colectImages(&$arr) {\r\n\r\n $len = count($arr);\r\n $arrImg = [];\r\n\r\n for ($i = 0; $i < $len; $i++) {\r\n\r\n if ($arr[$i]['note'] !== false && $arr[$i]['note'] !== 'false' && $arr[$i]['note'] !== null) {\r\n $arrImg[] = $arr[$i];\r\n unset($arr[$i]);\r\n }\r\n }\r\n if (count($arrImg) > 0) {\r\n return $arrImg;\r\n }\r\n return null;\r\n }", "public function Images() {\n\t\treturn new ArrayList(array_filter([$this->Image()]));\n\t}", "private function setImgArray($data)\n {\n //====================================================================//\n // Safety Check\n if (!is_array($data) && !is_a($data, \"ArrayObject\")) {\n return false;\n }\n //====================================================================//\n // Load Object Images List for Whole Product\n $this->imagesCache = Image::getImages(SLM::getDefaultLangId(), $this->object->id);\n\n //====================================================================//\n // UPDATE IMAGES LIST\n //====================================================================//\n\n $this->imgPosition = 0;\n $visibleImageIds = array();\n //====================================================================//\n // Given List Is Not Empty\n foreach ($data as $inValue) {\n //====================================================================//\n // Check Image Array is here\n if (!isset($inValue[\"image\"]) || empty($inValue[\"image\"])) {\n continue;\n }\n $this->imgPosition++;\n //====================================================================//\n // Search For Image In Current List\n $psImage = $this->searchImage($inValue[\"image\"][\"md5\"]);\n if (false == $psImage) {\n //====================================================================//\n // If Not found, Add this object to list\n $psImage = $this->addImageToProduct(\n $inValue[\"image\"],\n $this->getImagePosition($inValue),\n $this->getImageCoverFlag($inValue)\n );\n }\n //====================================================================//\n // Safety Check\n if (!($psImage instanceof Image)) {\n continue;\n }\n //====================================================================//\n // Update Image Position in List\n $this->updateImagePosition($psImage, $inValue);\n $this->updateImageCoverFlag($psImage, $inValue);\n //====================================================================//\n // Update Image Object in Database\n $this->updateImage($psImage);\n //====================================================================//\n // Add Ps Image Id to Visible\n if ($this->getImageVisibleFlag($inValue)) {\n $visibleImageIds[] = $psImage->id;\n }\n }\n\n //====================================================================//\n // Update Combination Images List\n $this->updateAttributeImages($visibleImageIds);\n\n //====================================================================//\n // If Current Image List Is Empty => Clear Remaining Local Images\n $this->cleanImages($this->imagesCache);\n\n //====================================================================//\n // Generate Images Thumbnail\n $this->updateImgThumbnail();\n\n //====================================================================//\n // Flush Images Infos Cache\n $this->flushImageCache();\n\n return true;\n }", "public function getImages() {\r\n\t\treturn $this->images === NULL ? array() : $this->images;\r\n\t}", "public function Images()\n {\n $pngLeftTop = $this->objFromFixture('Image', 'pngLeftTop');\n $pngLeftTop->VerticalSliceTopLeftColor = 'ff0000';\n $pngLeftTop->VerticalSliceBottomRightColor = '00ff00';\n $pngLeftTop->HorizontalSliceTopLeftColor = 'ff0000';\n $pngLeftTop->HorizontalSliceBottomRightColor = 'ffff00';\n\n $pngRightTop = $this->objFromFixture('Image', 'pngRightTop');\n $pngRightTop->VerticalSliceTopLeftColor = 'ffff00';\n $pngRightTop->VerticalSliceBottomRightColor = '0000ff';\n $pngRightTop->HorizontalSliceTopLeftColor = 'ff0000';\n $pngRightTop->HorizontalSliceBottomRightColor = 'ffff00';\n\n $pngRightBottom = $this->objFromFixture('Image', 'pngRightBottom');\n $pngRightBottom->VerticalSliceTopLeftColor = 'ffff00';\n $pngRightBottom->VerticalSliceBottomRightColor = '0000ff';\n $pngRightBottom->HorizontalSliceTopLeftColor = '00ff00';\n $pngRightBottom->HorizontalSliceBottomRightColor = '0000ff';\n\n $pngLeftBottom = $this->objFromFixture('Image', 'pngLeftBottom');\n $pngLeftBottom->VerticalSliceTopLeftColor = 'ff0000';\n $pngLeftBottom->VerticalSliceBottomRightColor = '00ff00';\n $pngLeftBottom->HorizontalSliceTopLeftColor = '00ff00';\n $pngLeftBottom->HorizontalSliceBottomRightColor = '0000ff';\n\n return array($pngLeftTop, $pngRightTop, $pngRightBottom, $pngLeftBottom);\n }", "private function setImgArray(array $data): bool\n {\n //====================================================================//\n // Load Object Images List for Whole Product\n $this->imagesCache = Image::getImages(\n SLM::getDefaultLangId(),\n (int) $this->object->id,\n null,\n Shop::getContextShopID(true)\n );\n\n //====================================================================//\n // UPDATE IMAGES LIST\n //====================================================================//\n\n $this->imgPosition = 0;\n $visibleImageIds = array();\n //====================================================================//\n // Given List Is Not Empty\n /** @var array|ArrayObject $value */\n foreach ($data as $value) {\n $value = ($value instanceof ArrayObject) ? $value->getArrayCopy() : $value;\n //====================================================================//\n // Check Image Array is here\n if (!isset($value[\"image\"]) || empty($value[\"image\"])) {\n continue;\n }\n $inImage = ($value[\"image\"] instanceof ArrayObject) ? $value[\"image\"]->getArrayCopy() : $value[\"image\"];\n $this->imgPosition++;\n //====================================================================//\n // Search For Image In Current List\n $psImage = $this->searchImage($value[\"image\"][\"md5\"]);\n if (false == $psImage) {\n //====================================================================//\n // If Not found, Add this object to list\n $psImage = $this->addImageToProduct(\n $inImage,\n (int) $this->getImagePosition($value),\n (bool) $this->getImageCoverFlag($value)\n );\n }\n //====================================================================//\n // Safety Check\n if (!($psImage instanceof Image)) {\n continue;\n }\n //====================================================================//\n // Update Image Position in List\n $this->updateImagePosition($psImage, $value);\n $this->updateImageCoverFlag($psImage, $value);\n //====================================================================//\n // Update Image Object in Database\n $this->updateImage($psImage);\n //====================================================================//\n // Add Ps Image Id to Visible\n if ($this->isImageVisible($value)) {\n $visibleImageIds[] = $psImage->id;\n }\n }\n\n //====================================================================//\n // Update Combination Images List\n $this->updateAttributeImages($visibleImageIds);\n\n //====================================================================//\n // If Current Image List Is Empty => Clear Remaining Local Images\n $this->cleanImages($this->imagesCache);\n\n //====================================================================//\n // Generate Images Thumbnail\n $this->updateImgThumbnail();\n\n //====================================================================//\n // Flush Images Infos Cache\n $this->flushImageCache();\n\n return true;\n }", "function get_images() \t{\n \t\treturn $this->getImages();\n \t}", "private function getImagesInfoArray()\n {\n //====================================================================//\n // Get Images Infos From Cache\n if (!is_null($this->imagesCache)) {\n return $this->imagesCache;\n }\n //====================================================================//\n // Load Complete Product Images List\n $productImages = Image::getImages(\n SLM::getDefaultLangId(),\n $this->object->id,\n null\n );\n //====================================================================//\n // Images List is Empty\n if (!count($productImages)) {\n return $this->imagesCache;\n }\n //====================================================================//\n // Create Images List\n foreach ($productImages as $imgArray) {\n //====================================================================//\n // Add Image t o Cache\n $this->imagesCache[] = $this->buildInfo($imgArray[\"id_image\"]);\n }\n\n return $this->imagesCache;\n }", "public function getImages()\r\n {\r\n if (!isset($this->_images)) {\r\n $this->_images = [];\r\n for ($i=1; $i<=6; $i++) {\r\n if ($data = $this->getData('image' . $i)) {\r\n $image = $this->imageRepository->getById($data);\r\n if ($image->isActive()) {\r\n $this->_images[] = $image->getUrl();\r\n }\r\n }\r\n }\r\n }\r\n return $this->_images;\r\n }", "public function getImages(){\n return $this->images;\n }", "private function getImagesInfoArray(): array\n {\n //====================================================================//\n // Get Images Infos From Cache\n if (!is_null($this->imagesCache)) {\n return $this->imagesCache;\n }\n //====================================================================//\n // Load Complete Product Images List\n $productImages = Image::getImages(\n SLM::getDefaultLangId(),\n (int) $this->object->id,\n null,\n Shop::getContextShopID(true)\n );\n //====================================================================//\n // Images List is Empty\n $this->imagesCache = array();\n if (!count($productImages)) {\n return $this->imagesCache;\n }\n //====================================================================//\n // Create Images List\n foreach ($productImages as $imgArray) {\n //====================================================================//\n // Add Image t o Cache\n $this->imagesCache[] = $this->buildInfo($imgArray[\"id_image\"]);\n }\n\n return $this->imagesCache;\n }", "public function get_images()\r\n\t\t{\r\n\t\t\t$images = $this->obj->result;\r\n\t\t\treturn $images;\r\n\t\t}", "private function getThumbnailsArray(): array {\n $connection = new Connection();\n $link = $connection->connect();\n $result = $link->query(\"SELECT filename, id FROM image WHERE id <> '1' AND id <> '2' ORDER BY RAND() LIMIT \" . $this->rowsCount * 2);\n $thumbnails = array();\n while ($record = $result->fetch()){\n $thumbnails[] = $record;\n }\n $connection = null;\n return $thumbnails;\n }", "public function getImageData() {\n return array(\n array(\n json_encode(array(\n array(\n 'size' => 54249,\n 'publicKey' => '20033e31f182661dafa332b423ecce5f',\n 'imageIdentifier' => '9c966f89db794417d474a87793ea4af8',\n 'extension' => 'jpg',\n 'mime' => 'image/jpeg',\n 'added' => 1328530242,\n 'updated' => 1328530242,\n 'width' => 480,\n 'height' => 360,\n 'checksum' => '9c966f89db794417d474a87793ea4af8',\n ),\n array(\n 'size' => 152972,\n 'publicKey' => '20033e31f182661dafa332b423ecce5f',\n 'imageIdentifier' => '9adc6809eae536f98b9559cb1f1aeed3',\n 'extension' => 'jpg',\n 'mime' => 'image/jpeg',\n 'added' => 1328514845,\n 'updated' => 1328514845,\n 'width' => 800,\n 'height' => 600,\n 'checksum' => '9adc6809eae536f98b9559cb1f1aeed3',\n )\n ))\n )\n );\n }", "function getTeaserImages() \t{\n \t\treturn $this->teaserImagesArray;\n \t}", "public function get_images(){\n\t\treturn $this->images;\n\t}", "function get_object_images($obj_type, $obj_id, $image_sizes = array(), $order = 'ASC')\n{\n $rows = db_get_list_by_query('SELECT * FROM object_images WHERE obj_type = \"' . \n strtok($obj_type, \" \") . '\" AND obj_id = ' . (int)$obj_id . \n ' ORDER by `order` ' . strtok($order, \" \"));\n if (!$rows)\n return;\n\n\n $images = array();\n foreach ($rows as $id => $row) {\n $images[$id] = get_images($row['img_id'], $image_sizes);\n $images[$id]['id'] = $row['id'];\n }\n\n $images = add_prev_next($images);\n return $images;\n}", "function get_first_object_image($obj_type, $obj_id, $image_sizes = array())\n{\n $query = 'SELECT * FROM object_images WHERE obj_type = \"' . strtok($obj_type, \" \") .\n '\" AND obj_id = ' . (int)$obj_id;\n $row = db()->query( $query);\n if (!$row)\n return;\n \n $image = get_images($row[0]['img_id'], $image_sizes);\n $image['id'] = $row[0]['id'];\n\n return $image;\n}", "public function getImages(): ?array\n {\n return $this->images;\n }", "private function getImgRecepiesStack()\n {\n $imgRecepiesStack = [\n Image::RR_SINGLE => [],\n Image::RR_MULTI => [],\n ];\n \n if (isset($this->imageResizeRecepies)) {\n $imgRecepiesStack[Image::RR_SINGLE] = $this->imageResizeRecepies;\n }\n \n if (isset($this->multiImageResizeRecepies)) {\n $imgRecepiesStack[Image::RR_MULTI] = $this->multiImageResizeRecepies;\n }\n \n return $imgRecepiesStack;\n }", "function miu_get_images($post_id=null)\r\n{\r\n global $post;\r\n if ($post_id == null)\r\n {\r\n $post_id = $post->ID;\r\n }\r\n\r\n $value = get_post_meta($post_id, 'miu_images', true);\r\n $images = unserialize($value);\r\n $result = array();\r\n if (!empty($images))\r\n {\r\n foreach ($images as $image)\r\n {\r\n $result[] = $image;\r\n }\r\n }\r\n return $result;\r\n}", "public function firstParty()\n {\n $images = [];\n\n foreach ((new Finder())->in($this->path)->directories()->sortByName() as $directory) {\n /* @var $directory \\Symfony\\Component\\Finder\\SplFileInfo */\n $images[] = new Image($this->getImageName($directory, $this->name), $directory->getRealPath());\n }\n\n return $images;\n }", "public function getImages() : array\n\t{\n\t\treturn $this->images_list;\n\t}", "function getImageSize() \n { \n return array($this->_width,$this->_height); \n }", "public function image();", "public function image();", "protected function imageProcess($value) {\n if (static::isArrayNumeric($value)) {\n $output = array();\n foreach ($value as $item) {\n $output[] = $this->imageProcess($item);\n }\n return $output;\n }\n return array(\n 'id' => $value['fid'],\n 'self' => file_create_url($value['uri']),\n 'filemime' => $value['filemime'],\n 'filesize' => $value['filesize'],\n 'width' => $value['width'],\n 'height' => $value['height'],\n 'styles' => $value['image_styles'],\n );\n }", "public function exchangeArray($data){\n $this->id \t= (isset($data['id'])) ? $data['id'] : null;\n $this->svg1 \t\t= (isset($data['svg1'])) ? $data['svg1'] : null;\n $this->image1 \t= (isset($data['image1'])) ? $data['image1'] : null;\n $this->svg2 \t\t= (isset($data['svg2'])) ? $data['svg2'] : null;\n $this->image2 \t= (isset($data['image2'])) ? $data['image2'] : null;\n $this->svg3 \t\t= (isset($data['svg3'])) ? $data['svg3'] : null;\n $this->image3 \t= (isset($data['image3'])) ? $data['image3'] : null;\n }", "function getPhotos($inputArr) {\n\n $ro = new GetPhotosRO();\n $album = $inputArr[\"name\"];\n $ro->albumName = $album;\n\n $picPath = \"Pics/$album/*.[jJ][pP][gG]\";\n $files = glob($picPath);\n $numfiles = count($files);\t\n\n for ($i=0; $i < $numfiles; $i++)\n {\n $photoUrl = $files[$i];\n $info = basename($photoUrl);\n $onePhoto = new PhotoInfo($photoUrl, $info);\n array_push($ro->photos, $onePhoto);\n }\n\n error_log(print_r($ro, TRUE));\n\n return $ro;\n}", "public function getImages()\r\n {\r\n return $this->images;\r\n }", "function get_image() {\n $sql = \"SELECT * FROM photos\";\n $res = $this->mysqli->query($sql);\n $data = array();\n while ($row = $res->fetch_array(MYSQLI_ASSOC)) {\n $data[] = $row;\n }\n return $data;\n }", "public function getImages() {\n\t\treturn($this->images);\n\t}", "private function get_object_array($array){\n \n }", "function get_single_image($pid) {\n $sql = \"SELECT * FROM photos WHERE album_id='$pid'\";\n $res = $this->mysqli->query($sql);\n $data = array();\n while ($row = $res->fetch_array(MYSQLI_ASSOC)) {\n $data[] = $row;\n }\n return $data;\n }", "function getpexelsimages($arr_data)\n{\n require_once INCLUDES_DIR .'/api.php';\n $class = new RFI\\API\\API();\n $arr_pexels = json_decode($class->pexels($arr_data));\n $arr_pex=[];\n if (isset($arr_pexels->photos) && !empty($arr_pexels->photos)) {\n foreach ($arr_pexels->photos as $data) {\n $arr_pex[] = array(\n 'imageurl' => $data->src->large2x,\n 'imageurlsmall' => $data->src->medium,\n 'username' => $data->photographer,\n 'landing' => $data->url,\n 'userimage' => 'https://cdn.pixabay.com/photo/2017/07/18/23/23/user-2517433_960_720.png',\n 'credit' => 'pexels', \n 'userlink' => $data->photographer_url \n );\n }\n }\n return $arr_pex;\n}", "protected function getGetImgResourceHookObjects() {}", "function GetImages(){\n\t\t$this->MediaType = 'image/jpeg';\n\t\t$this->SetFileName();\n\t\treturn $this->get();\n\t}", "function getImageByImageId() {\n if($this->image_id == '') return;\n\n $sql = \"SELECT * FROM \".$this->tableImages().\" WHERE image_id = \".$this->image_id;\n return $this->db->query($sql)->row_array();\n\t}", "public function getImage();", "public function getImage();", "public function getImage();", "public function getImage();", "function get_images_at_begining($image_array){\n $images = array();\n if(count($image_array) > 7 ){\n for($i=0;$i<7;$i++){\n $images[$i] = $image_array[$i];\n }\n return $images;\n }\n else{\n return $image_array;\n }\n }", "public function getImage()\n{\nreturn $this->image;\n}", "public function setImagesets()\n {\n $this->_imagesets = [];\n try {\n $pnmain = $this->_qobject->getPNMainTable();\n $type = $this->_image->getImageParams('type');\n if ($type == 'rgb') {\n $model = $this->_image->getImageParams('R_model');\n } else {\n $model = $this->_image->getImageParams('in_model');\n }\n\n if (!$model || $model == null) {\n return $this->mylogger->logMessage(\"Model for the parameter 'run_id' is not defined.\", $this, 'warning',\n false);\n }\n $runs = $pnmain->{$model}()\n ->where('found', 'y')\n ->distinct('run_id')\n ->pluck('run_id')\n ->toArray();\n\n if (!$runs || $runs == null || empty($runs)) {\n return $this->mylogger->logMessage(\"No results.\", $this, 'warning', false);\n }\n\n// $old_base_file_names = array_column($this->_oldresults, 'OutImage');\n\n foreach ($runs as $run_id) {\n $run_id = ($run_id == null || !$run_id) ? \"-1\" : $run_id;\n\n $base_file_name = $this->pngName($this->_qobject->getIdPNMain(),\n $this->_image->getImageParams('name_out'), $run_id);\n\n $full_file_name = MyFunctions::pathslash($this->_getOutDir()) . $base_file_name;\n\n $outimages = $this->_setOutimages($full_file_name);\n if (empty($outimages)) {\n continue;\n }\n\n $metadata = [\n 'type' => $type,\n 'run_id' => $run_id,\n 'OutImage' => $base_file_name,\n \"rgb_cube\" => ($type == 'rgb') ? $this->getRGBcubeName($this->_qobject->getIdPNMain(),\n $this->_image->getImageParams('name_out'),\n $run_id) : null,\n \"out_images\" => $outimages,\n ];\n\n\n// if (in_array($base_file_name, $old_base_file_names)) {\n// continue;\n// }\n\n $rgb_components = $this->_getRGBComponents($pnmain, $run_id);\n\n if ($rgb_components) {\n $this->_imagesets[$run_id] = array_merge($metadata, $rgb_components);\n } else {\n $this->mylogger->logMessage(\"Missing fits image(s).\", $this, 'warning', false);\n }\n }\n } catch (\\Exception $e) {\n $this->_imagesets = [];\n return $this->mylogger->logMessage(\"Problem with setting imagesets: \" . $e . \".\", $this, 'warning', false);\n }\n if (empty($this->_imagesets)) {\n return false;\n }\n return true;\n\n }", "private function _imageModelCreateData()\n {\n return [\n 'designBlockModel' => [\n 'marginTop' => 10,\n ],\n 'designImageSliderModel' => [\n 'arrowDesignTextModel' => [\n 'size' => 10\n ],\n 'hasAutoPlay' => true,\n 'playSpeed' => 10,\n ],\n 'designImageZoomModel' => [\n 'designBlockModel' => [\n 'marginTop' => 20\n ],\n 'effect' => 0,\n ],\n 'designImageSimpleModel' => [\n 'containerDesignBlockModel' => [\n 'marginTop' => 20\n ],\n 'imageDesignBlockModel' => [\n 'marginTop' => 30\n ],\n 'alignment' => 1\n ],\n 'type' => 1,\n 'viewAutoCropType' => 1,\n 'viewCropX' => 30,\n 'viewCropY' => 40,\n 'thumbAutoCropType' => 1,\n 'thumbCropX' => 20,\n 'thumbCropY' => 30,\n 'useAlbums' => true,\n ];\n }", "public function images()\n {\n // Fetch all properties existing in the database\n $image = Image::all();\n\n // return list of properties;\n return $image;\n\n }", "public function getImages()\n {\n return $this->images;\n }", "public function getImages()\n {\n return $this->images;\n }", "public function getImages()\n {\n return $this->images;\n }", "public function getImages()\n {\n return $this->images;\n }", "public function getImages()\n {\n return $this->images;\n }", "public function getImages()\n {\n return $this->images;\n }", "public function images()\n {\n return $this->morphMany(Image::class, 'imagetable');\n }", "public function images()\n {\n return $this->morphMany(Image::class, 'imagetable');\n }", "public function getItemImages(): array\n {\n $images = array();\n\n if ($this->getSavedVariable('itempic')) {\n // Save main item image\n $images['itempic'] = $this->getSavedVariable('itempic');\n }\n\n for ($i = 2; $i < 7; $i++) {\n $picture = 'itempic' . $i;\n if (empty($images['itempic'])) {\n $picIndex = 'itempic';\n } else {\n $picIndex = $picture;\n }\n\n if ($this->getSavedVariable($picture)) {\n $images[$picIndex] = $this->getSavedVariable($picture);\n }\n }\n\n return $images;\n }", "public function getImageData($object)\n {\n // $data = [];\n // if (isset($object->Gallery)) {\n // foreach ($object->Gallery->Groups[0]->Elements as $imageScope) {\n // $data[] = [\n // 'fullsize' => $imageScope->Original,\n // 'thumb' => $imageScope->Preview,\n // ];\n // }\n // } else {\n // foreach ($object as $node) {\n // $data[] = [\n // 'fullsize' => $node->getElementsByTagName('img')[0]->getAttribute('src'),\n // 'thumb' => '',\n // ];\n // }\n // }\n // return $data;\n }", "public function getDataImages() : ArrayCollection\n {\n $criteria = Criteria::create();\n $criteria->where(Criteria::expr()->eq('type', DatumTypeEnum::TYPE_SIGN))\n ->orWhere(Criteria::expr()->eq('type', DatumTypeEnum::TYPE_IMAGE))\n ->orderBy(['position' => Criteria::ASC]);\n\n return $this->data->matching($criteria);\n }", "private function _imageModelExpectData()\n {\n return [\n 'type' => 1,\n 'viewAutoCropType' => 1,\n 'viewCropX' => 30,\n 'viewCropY' => 40,\n 'thumbAutoCropType' => 1,\n 'thumbCropX' => 20,\n 'thumbCropY' => 30,\n 'useAlbums' => true,\n ];\n }", "public function getImages()\n {\n $res=array();\n $this->objTable = new Model($this->getLangAndID['lang'].'_slide_image');\n $select = array('id','title','description','slide_id','src_link','order_by','avatar');\n $this->objTable->where('slide_id',$this->id);\n $this->objTable->where('idw',$this->idw);\n $data = $this->objTable->get(null,null,$select);\n \n return $data; \n }", "public function images()\n {\n return $this->morphToMany(Image::class, 'model', 'model_has_images', 'model_id', 'image_id');\n }", "function Utilities_Image(){\n\t\t// $this->$imageAsset = $img;\t\t\n\t}", "public function getPictures() : ?array\n {\n return $this->get('pictures', 'products');\n }", "private function makeImageList()\n\t{\n\t\t$images_dir = self::$locator->banner_images_dir($this->trip, $this->slug);\n\t\t$trip = $this->trip;\n\t\t$slug = $this->slug;\n\t\t/// This is a hack so that unit testing does not have to setup Locator\n\t\t/// for every test.\n\t\tif (! is_dir($images_dir)) {\n\t\t\treturn [];\n\t\t}\n\t\t$list = scandir($images_dir);\n\t\t$x = [];\n\t\tforeach ($list as $ent) {\n\t\t\tif (($ent != \".\") && ($ent != \"..\") && (substr($ent, 0, 1) != \".\")) {\n\t\t\t\t$tmp = new \\stdClass();\n\t\t\t\t$tmp->url = self::$locator->url_banner_image($trip, $slug, $ent);\n\t\t\t\t$tmp->path = self::$locator->banner_image_filepath($trip, $slug, $ent);\n\t\t\t\t$x[] = $tmp;\n\t\t\t}\n\t\t}\n\t\t$this->images_list = $x;\n\t}", "private function makeObjects($array) {\n\t\t$ret = array();\n\t\tforeach ($array as $k => $v) {\n\t\t\tif (is_array($v)) {\n\t\t\t\t$ret[$k] = $this->makeObjects($v);\n\t\t\t} else {\n\t\t\t\treturn new UploadedFile($array);\n\t\t\t}\n\t\t}\n\t\treturn $ret;\n\t}", "public function getOriginalInstance()\n {\n return $this->imageObj;\n }", "public function getMainImgData() {\n $images = $this->getImages();\n if (empty($images)) {\n return null;\n }\n\n foreach($images as $img) {\n if ($img['main']) {\n return $img;\n }\n }\n\n return array_shift($images);\n }", "public function getImg(){\n return $this->img;\n }", "public function images()\n {\n return $this->morphToMany('App\\Models\\Image', 'imageable');\n }", "public function images()\n {\n return $this->morphMany(Image::class, 'model');\n }", "private function getImagem($img) {\n \n $imagem = [];\n \n foreach ($img as $imagens) {\n foreach ($imagens as $tag) {\n $imagem[] = $tag->getAttribute('src');\n }\n }\n return $imagem;\n }", "public function toArray()\n {\n $arr = array();\n if ($this->getImType() !== null)\n $arr['type'] = $this->getImType();\n\n if ($this->isPreferred() !== null)\n $arr['preferred'] = $this->isPreferred();\n\n if ($this->getImUri() !== null)\n $arr['imUri'] = $this->getImUri();\n\n return $arr;\n }", "public function additional_images() {\n\t\t$image_list = array();\n\t\t\n\t\tif (is_single () || is_page ()) {\n\t\t\t$fb_image1 = get_post_meta ( get_the_ID(), 'essb_post_og_image1', true );\n\t\t\t$fb_image2 = get_post_meta ( get_the_ID(), 'essb_post_og_image2', true );\n\t\t\t$fb_image3 = get_post_meta ( get_the_ID(), 'essb_post_og_image3', true );\n\t\t\t$fb_image4 = get_post_meta ( get_the_ID(), 'essb_post_og_image4', true );\n\t\t\t\n\t\t\tif (!empty($fb_image1) && is_string($fb_image1)) {\n\t\t\t\t$image_list[] = $fb_image1;\n\t\t\t}\n\n\t\t\tif (!empty($fb_image2) && is_string($fb_image2)) {\n\t\t\t\t$image_list[] = $fb_image2;\n\t\t\t}\n\t\t\t\n\t\t\tif (!empty($fb_image3) && is_string($fb_image3)) {\n\t\t\t\t$image_list[] = $fb_image3;\n\t\t\t}\n\t\t\t\t\n\t\t\tif (!empty($fb_image4) && is_string($fb_image4)) {\n\t\t\t\t$image_list[] = $fb_image4;\n\t\t\t}\n\t\t\t\t\n\t\t}\n\t\t\n\t\treturn $image_list;\n\t}", "public function getArrayCopy() \n {\n return get_object_vars($this->album);\n }", "public static function toArray($object, $group = NULL)\n\t{\n\t\tif ($object === null) {\n\t\t\treturn null;\n\t\t}\n\t\tif (!isset(self::$groups[$group])) {\n\t\t\tthrow new \\InvalidArgumentException('Group \\'' . $group . '\\' not supported for ' . 'CC15\\\\Entity\\\\Image' . '.');\n\t\t} else {\n\t\t\t$id = self::$groups[$group];\n\t\t}\n\n\t\tif (!($object instanceof Image)) {\n\t\t\tthrow new \\InvalidArgumentException('You have to pass object of class CC15\\Entity\\Image.');\n\t\t}\n\n\t\t$output = array();\n\n\t\tif (($id & 1) > 0) {\n\t\t\t$output['url'] = $object->url;\n\t\t}\n\t\tif (($id & 2) > 0 && isset($object->url)) {\n\t\t\t$output['url'] = $object->url;\n\t\t}\n\n\t\tif (($id & 1) > 0) {\n\t\t\t$output['fileId'] = $object->fileId;\n\t\t}\n\t\tif (($id & 2) > 0 && isset($object->fileId)) {\n\t\t\t$output['fileId'] = (string)$object->fileId;\n\t\t}\n\n\t\treturn $output;\n\t}", "function getpixabayimages($arr_data)\n{\n require_once INCLUDES_DIR .'/api.php';\n $class = new RFI\\API\\API();\n $arr_pixabay = json_decode($class->pixabay($arr_data));\n \n $arr_pixa=[];\n if (isset($arr_pixabay->hits) && !empty($arr_pixabay->hits)) {\n foreach ($arr_pixabay->hits as $data) {\n $arr_pixa[] = array(\n 'imageurl' => $data->largeImageURL,\n 'imageurlsmall' => $data->webformatURL,\n 'username' => $data->user,\n 'landing' => $data->pageURL,\n 'userimage'=> $data->userImageURL,\n 'credit' => 'pixabay',\n 'userlink' => 'https://pixabay.com/users/'.$data->user.'-'.$data->user_id\n );\n }\n }\n return $arr_pixa;\n}", "public function reset() {\r\n\t\t$this->images = array();\r\n\t}", "public function ShowAirlineAction()\n {\n $em = $this->getDoctrine()->getManager();\n $Airline=$em->getRepository('MyAppEspritBundle:Airlinecompany')->findAll();\n $imgs=array();\n foreach ($Airline as $key => $entity)\n {\n if($entity->getPicture() == null)\n {\n $imgs[$key] = \"iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAMAAAACDyzWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAP9QTFRF8vLy2dnZ5ubm/Pz81tbW4ODg3t7e29vbsLCw5+fn0tLS7Ozs+fn539/fz8/PsrKy/f39/v7+u7u79fX1ra2tysrKyMjIw8PD6enpy8vLs7OzsbGx+/v7xMTEzs7O7+/v3Nzcrq6u6+vrtLS0uLi4rKysxsbGycnJurq6+vr64uLiwsLCzc3Ntra219fX9PT01NTU4eHh7u7utbW1vr6++Pj45eXl4+Pj0NDQwcHBubm5x8fHvb299/f38/Pz1dXV8fHxwMDA6Ojo9vb20dHR3d3dvLy82traxcXFr6+v2NjYt7e35OTkv7+/09PT7e3t6urq8PDwq6urzMzM////kkQrbAAAIOdJREFUeNrsnWlD2soChrNgpWyC1IqCQLV6lOJS64JV61672O1O/v9vuaxhJgyQPZnM+344xypkfTJPZslEMRAkwig4BAgARAAgggBABAAiCABEACCCAEAEACIIAEQAIIIAQAQAIggARAAgggBABAAiCABEACCCAEAEACIIAESSAuBTOo9jhLhOsbO+6a0EbOyv6DiOiLuUry5OvSq4dvnzFkcScROteuPHPSA0jLhJKbNU8acSAg0jLvR7cnHtVy24dvkeGkZ8169tAKFhJAj9OgAQGkYc5OHk7trwF0CjtgMNI/ZyXz0qGX4DCA0jfuvXIYDQMOKvfp0C2NMw+o4R3/TrGEBoGJmj36PqvbNvOC3RoGFkhn7vfj0YwQIIDSO+6dcVgIbRrELDiB/6dQkgNIxwcn138mCEAyA0jEykspQpGWEBaBiL0DDC6Hfptbtvui3JoGHEs369AAgNI5716wnAnoYXcOwRw7ipau6/7KUUg4aRrn4vTspGNABCw4gn/XoGsKvhNDQM/UYIIDQsdU4vrspGtABCwxJnc71TNKIGsKfhjzgX0G90AELD0G+0AELD0G+0AELD0uUgfebPgvwquY6hYZn0u/r10IgXgNAw9BstgNAw9BsxgF0Nr0HDiU9udfnQiCeA0LAEyW7Vi0ZcAYSGk6/f6ou/C/S7xDr+RKBh6Dc6AKFh6DdaAKHhxEZNn/u/0CBKK2g4idnb2P1iiAGgsQcNQ79RAggNQ78RAwgNQ7/RAtjV8GdoOCEJsjQJEBJoOCF5Dkq/AQMIDUO/0QJo7H2DhqHfCAGEhoVP4CdQEfwCQgJVWPA1ycAVufdtFxqGfqMDEBqGfiMGEBoWMiENawpFj92aPDQsWMKabSAkMKBh0fQb1uyjYZVM0DD0GymAQTeoIwLqN1QAoWFhEuobKcOsHEDDQuj37c9bI5kAQsPQb7QA9kb2QMPQb4QAQsPQb7QAQsMxzu3PtzUj6QD2nm9p4VzHMa/Sr8JfaRRdZNAw9BspgNAw9BstgAE+Zoq4Sz79FM2KoxqlAg3HKfrKfsOQC0BoGPqNFkBoGPqNGEDjDzQst36jBhAajkGU9zs1Q1YAoeHo9VttRnwBRHwA/nxqi6XhB2VzerLlU+hXLACF0vDtmVonc1JXz4R5ACtq/cYCQGE0/KX1SGzm8eOtCHv0Mb0Yg4sgBgciG38NF/8eEUd51Gox3yWdfDo2AKAQGta1DnGcdr4c532Kg35jA2DMNbzpAr9+nuJbJYmFfmMEYFfD9ZhqWEkR12kv7EG/YgAYVw0XW8RTCtk41qd2N2JzYcSoySCOGn44Il7zHDsPt9LPMRJMjA5MdituGs62iffUj2O1TzHSb9wAjJ2Gz4g/OYvRPsVJv7EDMF4aLuWJX1ksxmWnztNqzOp4Mbs/CeqVZG5aKoh/UeOxU8X6VtwqRbHrt8zFRcOviZ9ZLEG/YgAYFw3/a/sKIHkV/S7FTr8xBTAWGs51iM+5h35FAbCr4eWINVxS/eaPtKMdIXO4vJozAKAoGtaI/+lE2SL9Uj2I55mO6+DJaDX8pR0AgOQmsj2KqX7jDKCRW41Ow7VHEkiievwirvqNNYBRaviZBJRoukTO0gfxPctxfn4hKg2/JoElgl7YYmd90wCAbjV8mJQbwOHAhNBHSR9+XY31k3oxf4IrAg3XMiTAPIbcFRFr/QoAYAQafiaB5ibMEWcx168IAIauYY0EnOfweoXLVxexf1BegIeof4Sp4QYJPAth7ctZNRX/syvCU/wharhcDx5AEs71JIB+RQEwPA3vPZIwokG/YgHY1XA1jGKjmCLhpBL8rWz1RowzK8pEOmFouNQkYSXgntlSZqliAEDRNHweGn+kHeisaKLoVygADeMgYA2/kBDT/gP9igZgwBo+I+HmL/QrGoCBajhs/oKqCz+c3F0bADAwDadfksIfIUG8Ovn10lHJAICiadjHZ9Ad9cr5PUOfYPoVEcBANLx3QKJJxt9dEU2/QgLY07DPA4uVDIkq7XsfhXlfFUy/ggLos4ZreRJljvx6WrN0VL0X8GSKCKCfGr4+L5CIox77cTk9/Lp7MABgZBrWG5tnC47zdETikILqcLsrm4dJ0K/AABqbjIaV5zaRLI/nNeH1KzKAtIb3nomMqZvMXd+dPBgAMCoNH2aIpMkPrFtZypQMABiFhgtdDZ8WiLR5JbZ+RQewr+HiEZE490LrV3gAexrOyMwfqZ+JrN8EAGjcv/u8JjGAy+80wU+g6ABWVraqb2XF77/1pZUiAIw0z4R83f4gJ3+rb3YJ+QcAI01vKucNOTW8/OZDSI94AsCpKfVPhYwa7ur3bVCjWgGg7ejD0yGdhjfe7a6ZTYEAMHIAZdPwQL8AMD4Akv8k0vBIvwAwRgBKpGGmtAeAsQFQFg2zFxoAjA+AUmj4v62ltwQAxhNACTQ8UcoDwFgBmHQNT15gADBeAE4oKknhNbgDwJgBmGANb7x7P1m6A8DYAZhUDfMvLAAYPwCZhtok6xcAxhTABGqYq18AGFsAk6bhq+2LKX8BgPEEMFEa7ur3kgBAsQBMkIan6hcAxhrApGh4un4BYLwBTISGV7bSlwQAiglgAjT8bZZ+AWDsARRdw7P1CwDjD6DQGp6nXwAoAIBdDb/5kFD9AkAhABRVwyfbdzY+BQDjD2AkGv6dSqVeLXT/43L2rpVP8/ULAAUBkH6MMeg8/lio/LO8reP09u+CmvFfvwBQGADD0fDjq2xu+rbuHS/89le/AFAcAIPX8OKmjXf05v406/7pFwAKBGCwGk7d237tm76pzlnYzvef9ktrACgMgIFpuPPi8A1tOS3ji34BYKwAzMx9v0vz8/6P377f+FVczBFZyh75oF8AGCsAF218/qaqnZ75Oa3+7023UzT/ufGsXwAoHIDG3/VOsfbKt9Iv62WG8MZvjn5/OdwEACgWgMbpxVXZqPjyZq92S/e29SWNrRKv7Kd3CABMNoB9DRsVH/g7KHvf/tNFL/oFgEICaFTWH4ueXxJc2PRnDxqP7vULAMUEsKfh27o3/lIzW51r5c1NbVDzPtvcPNyb+dnnoX6/7xAAKAeAPQ17e8NXa2rlY+/Px4OO9eP11MKMfhKt3dPv/goBgNIAaFSWdt03Shca/IUWjz/OaGbM5P9MqbR8eXSnXwAoLoDG6b7rvuEjfmGmLMxtYKw/cd8rU7us7hAAKBeAxoLbvuEDXrdvTXu02W93PnFHePvzba4JAGUD8Kz3qisXGl7k9LzVzh3UadoLbAmaTz8ZRmkBAEoG4Gt3Q7Tyk9WPvZbDKnU7P0awtvJzcEd5DgClA9DFEK3WxHJKFRd9y/WzoqnfkdHvAaB8AA7eOOnldB+mXI5i+Gfqd5QXACgfgM403LT6t/jRfVvik66v7DMNOgsAUD4AnWj4wFr/uL7xNJhhf4etUJeaAFBCAG1r+Mba/vLHU3/erze/7q0F6g8AKCGANjXcsbQ/l1pe8Fv72ev7fbKUqbUMAJQQQFsabt9aSqumF/4u05/6fb8/LKXqYRsAygigDQ1rljWrXvi72z4Zed3SMXIPAKUEcK6GVbYCvHfjTb/fxmMULGZ/BoBSAjhHwx12ygP9xgf9jh4s2fNyGwgAEwPgTA1n2fqH6ot+RxZmR2kpAFBSAGdo+Nlze52p3/fvvs1pX8wDQEkBnKrhOnuf1vKi3y3OyOcmK+EOAJQVwCkaZmvAf3zU7zCvmRX8BYDSAsjV8COjyOu6n/odNjJ+YRSfAoDSAsjTMFMDKab81e+wMabmsh4CABMH4ISGj5gmQNfjXy62r2YNtGY2TgWAEgNo1fAx/bUv7vW7MfMDf+i1HAJAmQFkNXzk9vbMrn55N5oqAJQaQFrDzBwclSD0O8g5vZ5bACg3gGMNP9J3gHv1QPQ7qAkzkx0dAUC5ATQ1/OK5CfptdcvWtBuLbopaAJhYAIcavvZaAF68+Wrzk3QRWGsDQNkB7Gs4RX/nPCj9Dh9TotfVBIDSA9jT8AFdKtUD0+/gLpAubY8BIAAkZGMpM66EaI75+7D91cnHF6jtK3YAIAAkzeu7k4fRV5y+4mHts339Dkbd0G2BCwAQAJJNo3RUHY5VUYLU72Sv8z8ACABJbyR+ZajhhUD1O3jyhHZwHQBKD+BN/6MDDRcLgep3UA2hHz1ZBIDSAzicDKur4Xu71dKhfpfW/3PTaE2PTL0HgNIDaA6E6Wr4yYl+33wlrvKD2sIvAFB6AMdPTF7frb8NVr8DB9cc3gQCwCQD+Eh9/mH5zWqw+u2HngDkAABKDiC9yE27s2h9eLPs4anhM4ctgQAwyQDSI2Hy9mbRWtt9t+qBP6YhpgIAJQeQbhdODfqGVwPUby8dapW3AFByAKmjU6rPeG7YJ/1a6j3GKQCUHMDcJAwzNbz7ZtUrfwz0bQAoNYBtajS+Qg3RWg1IvxOPoDwCQKkB7DCVYGqk9HJA+rVWg1MAUGoA6QcytenPDfunX+uYQBUASg0g3S92bhkpvRqEfvsjEKmVPgFAqQFcZJsB2QeWlmf806+GwDwABIDDvLLWOGgNL/ukX2ux+xEASg3g00wbmtT5p99eUgAQAHJObpP33PCyz/oFgADQroJNDfupXygYANqshJgarjp/57V9AFEJkRtAukLKnxVmdft/y/7yh2YYADi3IZquh7xd8rkIpBuinwGg1ADSA6I3J/887BDx+SaQHoOIrji5AWzTB4pTCd71vRUagxEA4JSxeXuT+v1A9cP5p2HqoRAMx5IdwEPq83WefgPoCqFeyoQBqbIDSM9cf8DVr++dwfWZ2geAcgF4NqVNjvNKOb80TM9H+BcASg4g3SZXmT0c0C8N03PlfwSAkgP4m/p82bTtu901fqu0HxpuTLM+AJQQQEJNlFHqTNWvj6NSMTUHAJxWHr2a+1CcDxrG5EQAcFq3RO81wRvvPq/N/IJXDdNvJj4DgNIDSBdItTr5uv1h3jc8apieJ/8HAJQeQPqWzFDXbY078PJ4HN0Igyl6ASDTFL1ZnaNfHzRcoTbQ3vsKAWCyARyf34P0S8cmRq41zBS45wAQAJpv7sitLh86eFWhSw3TDd9GBgACwNEs0ZtbhS6JubZtlNxp+IvTRhgAmHgAmwP9DnqFHcxT7kbDdBXEVj8cAEw+gO29gX77eWg7wMm5hulmb7tvJQGACQeQvM5ujV/h5uRVDY41zBSAWQIAAWAvF2lqgMqpkyLQqYbpO0BbAxEAYPIBXNmq0oMC7XWPudMwg5JCACAA7PX9vl9jzFhy+MpW+7NWdug2QLvvSweAyQbwavuCfUzI7ktUXWj4L70W+7UdAJhcAFe20pcTlQP7ZZMzDR+U3K0EACYWwG9d/U42jxi60/em29Jwh35P63j0NQCUF8CBfgcj85nS6bBN/Ncww7i9gVgAMMkAjvQ7bAtkvlkhxG8NnzMr2CQAUHIAx/oddIecersNnKdh9gaw1gGAkgN4sn3H/oJddlF1TuAsDd8wLTB2e4EBYFIBXPlE63eQf+xqb4iPGn7cYxb+pQ0ApQbQot8hJGwhtfeb+KbhzjVbvB4RACgzgBP6HeSZuU0zTjPEJw13yux25QkAlBhAnn4nH5jslYFuLMzRcIYt/2yPggGAiQTw2/ef0x48an9hv1/7QXzQ8BF7/2dc1wGgxABO0S/3NtAoNolnDf+wLvOIAEBpAZyu32FrXdGyCI141PDHkmWJTwQASgvgznT9jp4PsfJy++hFw/Vj6za9EAAoLYAn27/mnu28dSE1Dxr+cWpdmos+PgCYEADn6XeYl4nFHGfcaXhnc2JRWQIAZQVwvn6HqUwsp3jedsFNp3pjXdCfNgCUFUA7+uU3B/abThx7WD00yicXbAtg1hV/ADABAK7sf9+xf8ZfOMt6eOWEmef+U8alzFLF4/0fAEwEgDvf91ecnPJ8ibO00482HySv5x/MVhxKw+cEAEoKoAP9jgRa4y2veLxo46ubOvWV8tVQw8UnAgDlBNCZfkf9t4f8Re5VmjPKwfrza0u/20jD10cEAMoJoFP9jvqFX09d7KH2zBmq9aieKTxz9zWcrRMAKCeAv7ZPXJ73xdqMRZfKf7SFhYXnVErt/u8sWy5O/2z56r2nVzsAQFEBPHOnX1PDt/7sQflo19OrHQCgqAAuuNSvmac9H7Z/wdH0HQAwQQB+c61fs1ZxX/K4+dmOs+k7AGBiANQvPeh3PJzU0+Erm1OwrbnXMAAUEkDl/dUK8SMHrm8FD5+dTt8BABMDYD79XCc+5eaPmw2//eF8+g4AmBAA9ZX9xhPxL0cV3dlWF7OpyaWs7b5bBYAyAKi836lpxNfU8w5MfNgquJm+AwAmBMCP6UXDZ/76A/w+/ivOX3np9jzjbvoOAJgMAPW1/UauSYLJwdntDAhLiqbOGfPnQsMAUCgAu/q9bdVJcGmn8mfZsrV9sHz8eiFla7WONQwAYwNgZmFu2u++PZIwkkmlUq96a8x3f3A0j4xTDQPA2AA4N2vv330jsc/a53cbADCJAF6mP60QEeJIwwBQFADvPPf9hhYnGgaAYgAohn5daBgACgHgZXprhYgU2xoGgCIAeLF9RQSLXQ0DwPgDKJZ+HWoYAMYeQOH060jDADDuAAqoXycaBoDxBrCr3w0ibGxoGADGGsC3VUH1O9bwVwAoLoAC69euhgFgfAEUW782NQwAYwug8Po1Nbz9FQCKB+DM05YcDQPAeALocFCTuBoGgLEEMDH6nVueA8BIU0y8fudpeAEARpp64vU7Z6/OAGCkOfA2nFN8DR8DwEjzIoN+Z1xa7T0AGGmupdDv9L17NgBgtGnKod9p5XsZAEac07rTEXSCa7i69V9yGmESAKBxPBbUbpL1y9Pwbx0ARp+/bUn0O6Hho5wBAGOQ244k+rVoeLFoAMBYRD8rEG8vOxBQw6nbJJy6ZABoGOXlz88peaIuHKUPDAAYm2iTr39Oeg6XV08BYDxiefOuJCl21jcBYBzycHJ3bciYsyRoWHwA76tHJUPOdDWcA4AR6/f30r0hbRKgYcEBlFa/idGw2ABKrN+kaFhkAEtH1XtD+hQLQmtYYACv704ewJ/oGhYXQOg3ERoWFUDol9Xw1iYAhH6hYVkArCxloN9kaFhEAEs3SxqIm9BwXUgNCwgg9JskDYsHIPSbKA0LB+BNFfqdpeEsAAwypxdXZXA2Iy+iaVgsACvr0G/CNCwUgNBv8jQsEIDQr10NVw8AoP/ZXO8UAVfiNCwMgKnqGchKoIYFARD6dZhzUTQsBoDQb2I1LASAB2noN6kaFgDA3OryIXhypeEfABD6hYbFBhD6TbaGYw4g9OtVw+kfANB9slt16DfZGg4YQGZaxZSqOWvM+1E9t7FobfSzQv1SjcfhVentMf9Bwli1Zr41eSlrKOaqLSdcoQ9j0gHsJdPwS78A0B6AhDynVQA4jt274nn6BYB2AVQOl3+tAEAz9m5J1PS5zUUDwHkAGsW35qsdACDJ2/je3sbuFwMA+gWgoVxsXwHA0W2gDf1+quuGYwBjWNtTY3JBKORy+ApvWQHMaM2J6z9Xaand5DV2I3LZtTcrqtqqcKvMSvc7zYrOA3DWhuiVpqpWcuOf2Qp5Q2v2NkXL0hDnep9r8Y9QWcv3N51frc9pvYXl5gKo9JfS1Br6vG1mtnPKoeleuN3F5RtcALu14b6GleGnKvo0APWsNjgWepIA7J6ALPuCPWVsJFLQzJ1V1JWt9OWQ2om5x3V19AUGQK3366ZlffTZzxbGR7kx/LllLlQrjDdFNY/IaHvVnJG33MJnM+MrizM/emt0s6HPUjCz2nzZcsDy5jZXeNuZyU6atpwaNnflJhXc+39fw0p5uO2FLBfAXH68Uc1cogDUmbPYYr2cKo/O3bd379fGv2YPgZ4anyD6yOmZ4WL5AOZN9rvUZa03o+UMuynDM9EYXx7lArPp1FZwttEY40pSqekAWldbsdxYVKwbZPlCSrcA2DC3MqNzAexrOM+2R1gBzPI2KiEAGvRZbFrvDAv64HCebN9xDvPEqWWBSY1wmlIC0p+mfu7vvFLgLLAb6nQXmG9Y+Ov+mSUwy9vICQD1Ard9arzj1naDnPULKZ0FMMXuAQfAkYapQ24BcGLbWwkFUONXjvW2qV9unbkwBUDzc1NO+JTkuSAMTrjC/YYyWXZP3OA1bQGo8VfLXWvF4O6NavCXM6jn8QAcapj3hz6AuQJ3j5MH4PisqwX6+OdH+i3wmyyog19gABzduU054RmqdKAWrdLnifpMnjl/1Bd6p0MfFzkFbuP6+OOpzHQAM5Mf0pg9pL6sMReEysDB386pAJLL9U8r1HJZAM1rq5By0GYhIICN8V7nqOO0+O7OlEOF805w+mgxRy7HXZ9K3ROlKM5NkRcMw/xDd5V5+stN6gvMuTQ3rDnejeaUfaYuNCuA1NYXqKWM+aPKe5W++2jRW8DcA47/0LuYpwDYKl6aGp4AsDA+6KmQ3skeDYAadWzMC/18531m/GmF4wCmR5PbgMUHUKOvbfpGh/qGavm9SpHArLc50fwzrZjWZjRE07unco7RxJdT4y8o/IJOZ7dzCoBd/ZgatgJYphashdQ+GCKAufExaHIO/7cloquBAagRzqIJdcwtv2fOPrNelQegEjiAhAegTnNm2ATQIJfpQaO0FUCFB6CaGACpYk+dPPwn24/jQ54KDUDFMYDEXwAb9gDMcQFU3AE4qg1bAdQSDGBBzVA3KBMArnxKX6oG/fuyOkw5AgAVpwBqrgHs/qE13NPWjC8rvgI4rA3bApAkA0A6DGj9m5ud7z/X+qfC5LXB79EMFMBGiACO69JN3c4NpN8A9jUsKYApBsDeETh588taDeB2AwULoN50BiCn98Q+gFQ7dyEbBYA9DatTAWTLi4QBSB9vJT/Qr7W3rt8alwsBQKrnP0PCBJBuzs5kIwCwq+EugRICOO7a0LOmfkfniO1l0PSwACznC5bm/6ABZDsdUkoEAJJXuxvHsgFYMLu3c4NzfrL9i65usb29llvBoADMpib7n4IG0Ciz3V7DW8FQAdT09vqGJAAW1P7AN3N1ucEN18r+9x22vt+afmYDAjDL7QANHMCJ0S3l8AE0jGezbzjhAFpak4a1ja5+j1KWjyiZqQOCggCQO8LLbi149j7PAdDQ2YutP4gqbACVUaO0tRYcVqIBMDdqfP5lGbM5GOJWmBimFRyA445hRQkZwG4hqFqL0dAB7NWGv0kHYGWk3+5Vzxm1ruf5leYgACyMi1rnAGpeFDwY9pphB1GFD+BoiJYVwEQrON/X7/7KxDkyNyvFGxIZAIC5aecvJAANnbrx0qMBcNA3LBWA3UP7a/tk8kxr4x/znG9G0hWXotvH/QOQ6nQsTFl6aAD2NSwXgKPa73QAcxEDOL4LKLNdJL4DyDzyFA2APQ2vyQTgY0+/swE0IgaQ3yShUDeNvgGo2QCw7OdwLN4IrMtPG3sVWQDMvznh32zFCMDyNAC5S20EDSB/PKDhH4DkhXx64W1gKnEA6iv7HaqKyxNNhuoWnlIJ0X0GMGM5S/xHmhRmbPx4YG15CoDTH8tUx0egxauEtCwAFsasKzQbTgHMskeO7gs+T1+Nt8S8AJtJA/D2/WVNHXdAlacMmtY4LdHjzzaNis8A0uO0+wBSnbVMC3V23HBsfoR5cod6PLdMpgKYN49AbtQSU6B3oLt0piGgOd51+hJwDCB95LKW0TBfloaN0t2D3uKNHUkCgPn0E+/JxuFHMpO/zs0bXugJQH2aacetkZkGO/KZs40VSxWfv3MMgFn+MI2pe8h72jjnAkDLbrIPJf0dNkpb+2eSA2BXvw1jxrPbGve3ZlK+A8jDyRxhrzc0rT8NC/OHBm+EI5WWLQB1/iO406+HyQ3t35x4AdCYeDA9dUc/N2y9uxUfQOX9Ts2wHH22IdpafBTKEz0owz/4BKDG2ZJ+JUQZJmcFcIIwy8wIdPVl+mOZk0xYpnZge0g4taIB9k4BzLAAWwDMFcy+4Yk78AQA+DG9yA5G6B12bdZomIzlqdRxz23Z98EIhTK3sttiH1fsXweFyWEskyMtevdPDkbDtCw1mKy1PLbMIZLXXQFYNve3P7WHdW6YnLpGazj4OdvCnJxooN/hegdno6BNPH6VG48NzWgTNyDDgQrdo+/XcKzRnFNqmSnoxo+nZBWzAlAw+89MeHizYw07eLtLnN0VR41DbCoTVejhSIXxNUit1fy8UwAz5iFs6YbBm55NaZoazofwgsjwXtMw0q85IiarTZkXzyh37726f+RODta7L/N75jpleKvHL8b4t5u5Gds4WKKduc10pdJdSkXhtuEY5e4f2e3KKRr7eTeZewjv97+2vK4kdgCO9StGeJMWpYKfsjFE+c3aefLpOKxyKXF75FcaUfAXEwBDLC9CKmc/7+wZoqVhafhohTFlbVwANL7sbuwlBkDR9GveBzYL5iMtlXCmQNdGifwdaiFJS0nMngR1gHrRDRkTSrkRPIBhleWI/3CEcOoCB/A8reJMipoQ5KUIvweI0BoOFkDoNwEa/rYnLIDQLzQcIYDF+lYW5w8ajgrAL8sbOZy8ZGj4c3AaDgxA6BcajhBA6BcajhLAw+VV6DdpGg6mOz8QAM/SBzhj0HBUAEK/0HCUAEK/ydXwe/817DuA0C80HCGAxc76Js4TNBwVgIdXH05xkpKu4VpsAYR+ZdDwmq8a9hFA6BcajhLA8tUF9AsNRwagVr3BmZFHw/vH8QKw+Aj9QsPRAQj9QsNRAgj9yqjhFV807AOApcxSBecDGo4KwPLJxTVOBjQcFYDQr9wabkQLIPQLDUcJ4MPJHfQLDUcG4H31qIRTAA03ogEQ+kX6WfCiYfcAQr+IDxp2DSD0i/ihYZcAlo6q9zjuyFjD1cUwAXy4+/WAg474oGFXAEK/iF8adgEg9Itwk3ejYecAXt+dQL+IXxp2DGBlKQP9Ir5p2CGApaOl1zjOyHQNp5tBAgj9Ij5r2BGA0C/it4adAHhT1XB8ERsafgoCwNOLqzIOLuKzhm0DCP0iQWjYLoDQLxKIhu0BCP0iDnNrU8O2ANxc7xRxSJEgNGwHQOgXCUzD8wGEfhHXGr6seQYQ+kWC1LCCo4REGQCIAEAEACIIAEQAIIIAQAQAIggARAAgggBABAAiCABEACCCAEAEACIIAEQAIIIAQAQAIggARAAgggBABAAiiK38X4ABAJQhP9nQvpVSAAAAAElFTkSuQmCC\";\n }\n else\n {\n $imgs[$key] = base64_encode(stream_get_contents($entity->getPicture()));\n }\n\n\n }\n\n return $this->render(\"MyAppEspritBundle:Ween/AirlineCompany:Showairlinecompany.html.twig\",array(\"airlines\"=>$Airline,\"images\"=>$imgs));\n\n }", "public function mainImage()\n {\n return $this->images()->where('main_img', '=', '1');\n }", "protected function createImageObject(array $imageIds, $size = 'thumbnail')\n {\n $image=array();\n foreach ($imageIds as $image_id) {\n $image_url=$this->getImageUrl((int)$image_id, $size);\n if ($image_url) {\n\n $image[]=(object)array(\n 'id'=>(int)$image_id,\n 'url'=>$image_url,\n 'alt'=>$this->getImageMeta((int)$image_id),\n 'title'=>$this->getImageTitle((int)$image_id)\n );\n }\n }\n return $image;\n }", "public function headshots()\n {\n $compositeKey = [\n 'ezt_user_id' => $this->ezt_user_id,\n 'image_type' => 2\n ];\n\n return Image::where($compositeKey)->get();\n }", "protected function getGetImgResourceHookObjects()\n {\n if (!isset($this->getImgResourceHookObjects)) {\n $this->getImgResourceHookObjects = [];\n if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getImgResource'])) {\n foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getImgResource'] as $classData) {\n $hookObject = GeneralUtility::getUserObj($classData);\n if (!$hookObject instanceof ContentObjectGetImageResourceHookInterface) {\n throw new \\UnexpectedValueException('$hookObject must implement interface ' . ContentObjectGetImageResourceHookInterface::class, 1218636383);\n }\n $this->getImgResourceHookObjects[] = $hookObject;\n }\n }\n }\n return $this->getImgResourceHookObjects;\n }", "function make_image_slide_data($image_id) {\n return array(\n 'type' => 'image',\n 'id' => absint($image_id)\n );\n }", "private function initImagesArrayKeys()\n {\n $this->_imagesArrayKeys = $this->imageTypeProcessor->getImageTypes();\n return $this;\n }", "public function images()\n {\n return $this->morphMany('App\\Models\\Image', 'imageable');\n }", "function _putimages() {\n parent::_putimages();\n $this->_putformxobjects();\n }", "public function getImage() {}", "private function __prepareRowImages($current_row) {\n \n // extract files from the DB\n $query = $this->__getQueryImage($current_row->id);\n $result = $query->execute();\n $current_row->images = array();\n foreach ($result as $row) {\n \n // check for empty pic string\n if (empty($row->picture)) {\n $current_row->profile_picture_id = 0;\n $current_row->images = array();\n $current_row->image_title = '';\n continue;\n }\n \n // picno 1 is profile pic\n // the rest are field images\n if ($row->picno == 1) {\n $current_row->profile_picture_id = $row->id;\n }\n else {\n $current_row->images[] = $row->id;\n }\n }\n\n }", "public function getImages() {\n if (empty($this->_images) && $this->getImgs()) {\n $images = json_decode($this->getImgs(), true);\n uasort($images, function($a, $b) {\n if (!isset($a['ordering'])) {\n $a['ordering'] = 0;\n }\n\n if (!isset($b['ordering'])) {\n $b['ordering'] = 0;\n }\n\n if ($a['ordering'] == @$b['ordering']) {\n return 0;\n }\n return ($a['ordering'] < $b['ordering']) ? -1 : 1;\n });\n $this->_images = $images;\n }\n\n return $this->_images;\n }", "public function providerBuildImage()\n {\n\n return [\n [\n ['action' => 'scale_and_crop', 'width' => 40, 'height' => '25%'],\n ['action' => 'scale_and_crop', 'width' => 40, 'height' => 125],\n ],\n [\n ['action' => 'scale', 'width' => 40],\n ['action' => 'scale', 'width' => 40],\n ],\n [\n ['action' => 'scale', 'width' => '50%'],\n ['action' => 'scale', 'width' => 250],\n ],\n [\n ['action' => 'crop', 'height' => '50%', 'yoffset' => 20],\n ['action' => 'crop', 'height' => 250, 'yoffset' => 20],\n ],\n [\n ['action' => 'crop', 'height' => 20, 'yoffset' => 'bottom'],\n ['action' => 'crop', 'height' => 20, 'yoffset' => 480],\n ],\n [\n ['action' => 'crop', 'width' => '50%', 'xoffset' => 'center'],\n ['action' => 'crop', 'width' => '250', 'xoffset' => 125],\n ],\n [\n ['action' => 'crop', 'width' => '20', 'xoffset' => 'left'],\n ['action' => 'crop', 'width' => '20', 'xoffset' => 0],\n ],\n ];\n }", "public function images() {\n return $this->morphMany(Image::class, 'imageable');\n }", "public function images()\n {\n return $this->morphMany('App\\Image', 'imageable');\n }", "public function images()\n {\n return $this->morphMany('App\\Image', 'imageable');\n }", "public function images()\n {\n return $this->morphMany('App\\Image', 'imageable');\n }", "public function toDocument() {\r\n $array = parent::toDocument();\r\n $array[self::FIELD_IMAGE_REF] = $this->imageRef;\r\n return $array;\r\n }", "public function getAllImageByUserID($userID){\n try{\n $object=array();\n\n if($stmt=$this->DataBaseCon->prepare(\"SELECT ImageDataSet.ImgID,ImageDataSet.ImgPathWithPrimalUrl,ImageDataSet.ImgPathWithResizeUrl,ImageDataSet.ImgPathWithIconUrl, ImageDataSet.ImgDate, EventDataSet.Longitude, EventDataSet.Latitude,LocationDataSet.Address FROM EventDataSet, ImageDataSet,LocationDataSet WHERE EventDataSet.ImgID = ImageDataSet.ImgID AND EventDataSet.EventID=LocationDataSet.EventID AND ImageDataSet.userID=?\")){\n $stmt->bind_param('s',$userID);\n $stmt->execute();\n $stmt->bind_result($ImgID,$ImgPathWithPrimalUrl,$ImgPathWithResizeUrl,$ImgPathWithIconUrl,$ImgDate,$Longitude,$Latitude,$Address);\n while ($stmt->fetch())\n {\n $array =array('imgID'=>$ImgID, 'imgPathWithPrimalUrl'=>$ImgPathWithPrimalUrl, 'imgPathWithResizeUrl'=>$ImgPathWithResizeUrl,'imgPathWithIconUrl'=>$ImgPathWithIconUrl,'imgDate'=>$ImgDate,'Longitude'=>$Longitude,'Latitude'=>$Latitude,'Address'=>$Address);\n array_push($object,$array);\n }\n $stmt -> close();\n if(count($object)>0){\n return $object;\n }\n else{\n return false;\n }\n }\n else{\n return false;\n }\n\n }catch(Expection $e){\n return false;\n }\n\n\n\n }", "public function getPicturesInSlider(): PictureCollection;", "public function images()\n {\n return $this->morphToMany('App\\Images', 'imageable');\n }", "public function toArray()\n {\n return array_merge($this->wrappedObject->toArray(), [\n 'avatar' => $this->avatar(),\n ]);\n }" ]
[ "0.75568104", "0.6810632", "0.66469777", "0.66224015", "0.6386128", "0.62774396", "0.6252395", "0.6199608", "0.6102984", "0.6038838", "0.6037552", "0.59988153", "0.599877", "0.5986335", "0.59856915", "0.5982722", "0.59802794", "0.5938882", "0.5915553", "0.5891282", "0.58797663", "0.5852401", "0.5846995", "0.5840467", "0.58301705", "0.58185077", "0.5784694", "0.5784694", "0.57686585", "0.5727994", "0.5725343", "0.57189435", "0.57042146", "0.5699573", "0.5694768", "0.56819135", "0.5674129", "0.56699353", "0.5667561", "0.5666895", "0.56492215", "0.56492215", "0.56492215", "0.56492215", "0.5641768", "0.5632085", "0.5615941", "0.56112397", "0.5592452", "0.5584604", "0.5584604", "0.5584604", "0.5584604", "0.5584604", "0.5584604", "0.5584514", "0.5584514", "0.557426", "0.55723274", "0.55574083", "0.55542785", "0.55485976", "0.5542631", "0.5533107", "0.5530168", "0.5524166", "0.5519988", "0.5517673", "0.55167884", "0.55163044", "0.55162776", "0.5513837", "0.5513689", "0.5506365", "0.55029535", "0.5495048", "0.5494926", "0.5491823", "0.5490337", "0.5481085", "0.5467483", "0.5459996", "0.54492176", "0.5441337", "0.54400164", "0.5437024", "0.5431558", "0.54314554", "0.5427753", "0.5422196", "0.54179513", "0.5401014", "0.53910506", "0.53838754", "0.53838754", "0.53838754", "0.5380571", "0.5380371", "0.53749937", "0.53744256", "0.53680164" ]
0.0
-1
protected $with = ['classes'];
public function subjects() { return $this->hasMany(Subject::class); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function myClasses(){\n return $this->hasMany('App\\Teacher_classes', 'teacher_id', 'id');\n }", "public function class()\n {\n return $this->belongsTo('App\\Classe', 'class_id');\n }", "public function classes() {\n return $this->hasManyThrough('aClass', 'Department')->orderBy('name');\n }", "public function classes()\n {\n return $this->hasMany(UserClass::class, \"subject_id\");\n }", "public function classes(){\n return $this->belongsToMany('App\\Classes', 'professorclasses', 'UserId', 'ClassId' );\n }", "public function class()\n {\n return $this->belongsTo('App\\ERP\\SItemClass');\n }", "public function classSec(){\n \treturn $this->belongsTo('App\\ClassSec','class_id');\n }", "public function class()\n {\n return $this->belongsTo(userOwnedClass::class, 'classId');\n }", "public function courses() {\n return $this->belongsToMany('C2Y\\Course', 'classes_courses', 'class_id', 'course_id');\n }", "public function with($classes)\r\n {\r\n throw new Exception('This method is not yet implemented');\r\n \r\n return $this;\r\n }", "public function lessons(){\n return $this->belongsToMany(Lesson::class,'classes_lessons','class','lesson');\n }", "public function Grade_Classes(){\n return $this->hasMany( 'App\\Models\\Classroom', 'grade_id');\n }", "public function class()\n {\n return $this->belongsTo(EventClass::class);\n }", "public function students()\n {\n return $this->belongsToMany(\n 'App\\Student',\n 'students_classes',\n 'class_id',\n 'student_id'\n );\n }", "public function model()\n {\n return Classes::class;\n }", "public function with(): array\n {\n return $this->with;\n }", "function classe()\n {\n return $this->belongsTo(Classe::class, 'classe_id');\n }", "public function studentClass()\n {\n return $this->hasMany(StudentClass::class)->where('session_id',active_session()->id);\n }", "public function with($relations)\n {\n }", "public function yeastClass()\n {\n return $this->belongsTo('App\\YeastClass', 'classId');\n }", "public function classes(string $classes): self\n {\n return $this->withMeta(['classes'=>$classes]);\n }", "public function googleClassroom()\n {\n return $this->belongsTo('App\\Models\\GoogleClassroom','class_id');\n }", "public function make(array $with = array()) {\n return $this->model->with($with);\n }", "public function make(array $with = array())\n\t{\n\t return $this->model->with($with);\n\t}", "public function model()\n {\n return CollegeHasAttribute::class;\n }", "public function all($with = []);", "public function class_subject()\n {\n return $this->belongsTo('App\\ClassSubject');\n }", "public function members(){\n return $this->belongsToMany(User::class,'classes_users','class','user');\n }", "public function all()\n {\n return $this->classes;\n }", "public function types()\n {\n return $this->belongsTo(Type::class);\n }", "public function categories(){\n return $this->belongsTo('App\\Category');\n }", "public function classStudents(){\n return $this->hasManyThrough( 'App\\Classstudents', 'App\\Professorclasses','UserId', 'ProfessorClassId');\n }", "public function questions(){\n return $this->hasMany(App\\Question::class);\n}", "public function with(array $with) {\n $this->with = $with;\n\n return $this;\n }", "public function make(array $with = array())\n {\n return $this->model->with($with);\n }", "public function all(){\n return $this;\n }", "public function getClasses(): Collection\n {\n return $this->classes;\n }", "public function users(){\n return $this->belongsTo(User::class);\n }", "public function actividades(){\n return $this->hasMany('App\\Actividad');\n }", "public function school_class(): BelongsTo\n {\n return $this->belongsTo(SchoolClass::class);\n }", "public function users()\n {\n return $this->belongsToMany('C2Y\\User', 'classes_users', 'class_id', 'user_id')\n \t->withPivot('role');\n }", "public function classification()\n {\n return $this->belongsTo('App\\Models\\Lists\\PopulationClass', 'class_id');\n }", "public function response(){\n return $this->hasMany(App\\Response::class);\n}", "public function class_tutors()\n {\n return $this->hasMany(ClassTutor::class, 'tutor_id', 'id');\n }", "public function categories()\n {\n return $this->belongsTo(Category::class);\n }", "public function Clubs(){\n return $this->belongsto('App\\club');\n }", "public function categories(){\n\n return $this->belongsTo('App\\Http\\Models\\Category');\n\n }", "public function users(){\n \n return $this->hasMany('App\\User');\n\n }", "public function fresh($with = []);", "public function users()\n {\n return $this->belongsTo('p4\\User');\n }", "public function categories()\n {\n \treturn $this->hasMany('App\\Category');\n }", "public function all(array $with = [])\n\t{\n\t\treturn $this->make($with);\n\t}", "public function getClasses();", "public function getClasses();", "public function getClasses();", "public function mockupCategories()\n {\n return $this->hasMany('App\\MockupCategory');\n }", "public function drivers()\n {\n return $this->belongsToMany('App\\Driver');\n }", "public function all(array $with = []) {\n return $this->_model->with($with)->get();\n }", "public function visitClass()\n {\n return $this->belongsTo('App\\VisitClass');\n }", "public function getHasMany()\n {\n return $this->hasMany;\n }", "public function cl_class_letters()\n {\n return $this->hasMany(ClClassLetter::class);\n }", "public function getClasses() {\n return $this->classes;\n }", "public function categories()\n {\n return $this->belongsTo(Categories::class);\n }", "public function types() {\n return $this->belongsToMany('App\\Type');\n }", "public function cat(){\n return $this->belongsTo(Cat::class);\n }", "public function classes(): array\n {\n return $this->classes;\n }", "public function with($relations);", "public function categories()\n {\n \treturn $this->belongsTo( 'App\\Category', 'category_id');\n }", "public function categorias(){\n \n return $this->belongsTo(Categoria::class,'idCategoria');\n }", "public function classes($classes)\r\n\t{\r\n\t\t$this->classes = (string) $classes;\r\n\r\n\t\treturn $this;\r\n\t}", "public function categories(){\n return $this->belongsToMany(category::class);\n }", "public function categoriesSon()\n {\n return $this->hasMany(self::class);\n }", "public function cl_class_numbres()\n {\n return $this->hasMany(ClClassNumber::class);\n }", "public function users()\n {\n return $this->belongsTo('App\\User');\n }", "public function getClasses() {\n\t\treturn $this->classes;\n\t}", "public function beers()\n {\n return $this->hasMany('App\\Beer');\n }", "public function user(){\n\n //class midwife belongs to class user\n \n return $this->belongsTo(User::class);\n}", "public function with( $relations );", "public function categories() {\n return $this->belongsTo(\"Category\", \"category_id\", \"id\");\n }", "public function getClasses()\n\t{\n\t\treturn $this->classes;\n\t}", "private function eloqent($class)\n {\n return app($class);\n }", "public function with($relations){\n return $this->model->with($relations);\n }", "public function with() {\n\t\treturn [\n\t\t\t'navigation' => $this->navigation()\n\t\t];\n\t}", "public function estudiantes(){\n return $this->hasMany('App\\Estudiante');\n }", "public function modules() \n {\n return $this->belongsTo(\"Modules\\Module\\Entities\\Modules\",\"module_id\",\"id\");\n \n }", "public function getClasses(): array\n {\n return $this->classes;\n }", "public function types()\n {\n return $this->belongsToMany(Type::class);\n }", "public function users()\n {\n return $this->belongsTo(User::class);\n }", "public function users()\n {\n return $this->belongsTo(User::class);\n }", "public function users()\n {\n return $this->belongsTo(User::class);\n }", "public function users()\n {\n return $this->belongsTo(User::class);\n }", "public function users()\n {\n return $this->belongsTo(User::class);\n }", "public function users()\n {\n return $this->belongsTo(User::class);\n }", "public function roles(){\n return $this->belongsToMany('App\\Role');\n }", "public function clase()\n {\n return $this->belongsTo(Grupo::class);\n }", "public function serviceTypes()\n {\n return $this->belongsTo(ServiceTypes::class);\n }", "public function all($with)\n {\n return $this->model->with($with)->get();\n }", "public function getPropertyRelatedClasses(): array;", "public function shows()\n {\n return $this->hasMany('App\\Show');\n }", "public function tackledTopics(){\n return $this->hasMany(Topic::class,'class');\n }", "public function coches(){\n return $this->hasMany(Coche::class);\n }" ]
[ "0.66706526", "0.6609155", "0.6416624", "0.6416107", "0.6388686", "0.6338504", "0.6297976", "0.603177", "0.5972203", "0.5956292", "0.594186", "0.59185946", "0.5911151", "0.58807945", "0.58692765", "0.58625865", "0.58344805", "0.5809084", "0.5803938", "0.57938755", "0.57275605", "0.5725173", "0.56752735", "0.5656601", "0.5631891", "0.5623466", "0.56176597", "0.55958563", "0.5575911", "0.5561249", "0.5503294", "0.54957324", "0.5472019", "0.5470653", "0.54621786", "0.54603934", "0.54545116", "0.54504114", "0.5437608", "0.54264295", "0.54165715", "0.5404255", "0.54022855", "0.53876126", "0.53666437", "0.5362969", "0.5362075", "0.53439695", "0.5341603", "0.5339394", "0.5335438", "0.5335035", "0.5325934", "0.5325934", "0.5325934", "0.5325491", "0.5324861", "0.53198594", "0.53096914", "0.5299274", "0.5298686", "0.5295067", "0.52918303", "0.52864635", "0.52796334", "0.5273383", "0.5270396", "0.52645594", "0.52637404", "0.5254821", "0.5248045", "0.5226284", "0.52217776", "0.5218777", "0.52168244", "0.52137107", "0.52124697", "0.52121556", "0.5197801", "0.5192913", "0.5188745", "0.51869446", "0.5183052", "0.5181254", "0.518045", "0.5175401", "0.51706105", "0.51688886", "0.51688886", "0.51688886", "0.51688886", "0.51688886", "0.51688886", "0.5157041", "0.51564753", "0.5155458", "0.5154878", "0.51425636", "0.51395386", "0.5136183", "0.51355714" ]
0.0
-1
solution 1 this algorithm solves the problem with Time Complexity O(N^2)
function getSubseqMaxSum( $arr ) { //firstly we determine the number of the elements $N = count($arr) - 1; $sumMax = -999; $iMax = -1; $jMax = -1; //for i = 0 to N execute for($i = 0; $i <= $N; $i++) { $sum = 0; for($j = $i;$j <= $N; $j++) { $sum = $sum + $arr[ $j ]; if($sum > $sumMax) { $sumMax = $sum; $iMax = $i; $jMax = $j; } } } return array("sumMax"=>$sumMax, "i"=>$iMax, "j"=>$jMax); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function solution(array $A) {\n $result = $started = 0;\n foreach ($A as $d) {\n if ($d === 0) {\n $started++;\n } else if ($d === 1 and $started > 0) {\n $result += $started;\n }\n }\n if ($result > (int) 1E9) {\n return -1;\n }\n return $result;\n}", "function solution($A) {\n $return = 0;\n \n $N = count($A);\n $left = [];\n $right = [];\n \n for ($i=0; $i<$N; $i++) {\n $left[] = $A[$i] + $i;\n $right[] = -($A[$i] - $i);\n }\n \n sort($left);\n sort($right);\n \n for($i=0; $i<$N-1; $i++) {\n $val = $left[$i];\n $pos = binary_search($val, $right);\n $return += $N - $pos - 1;\n }\n \n return $return;\n}", "function solution($A) {\r\n // time complexity O(n), array may be empty, elements are distinct integers in range [1...(N+1)]\r\n \r\n // calculate triangular number for N+1, then subtract the sum of the array\r\n \r\n // 100% first time!\r\n \r\n function triangular($n){\r\n return $n*($n + 1)/2;\r\n }\r\n \r\n $n = count($A);\r\n\r\n $plusOneSum = triangular($n+1);\r\n \r\n $sum = 0;\r\n \r\n for ($i = 0; $i <= $n - 1; $i++){\r\n $sum += $A[$i];\r\n }\r\n \r\n echo \"$plusOneSum $sum<br>\";\r\n \r\n return $plusOneSum - $sum;\r\n \r\n}", "function solution($N, $A)\n{\n // Initial array which length is N for saving final result\n $result_arr = array_fill(0, $N, 0);\n \n // Solution:\n // what we did is using $current_big_val to save current biggest value in result array\n // we empty result array when $A[$i] === $N1 which is max counter\n // when empty result array we will add $current_big_val to $addition_val\n // so we only need to record those steps which after final max counter\n // and add $addition_val to each element\n\n // e.g $N = 5, $A = [3, 4, 4, 6, 1, 4, 4]\n // So $N1 = 6 and the original steps should look like below\n // (0, 0, 1, 0, 0) $A[0] !== $N1\n // (0, 0, 1, 1, 0) $A[1] !== $N1\n // (0, 0, 1, 2, 0) $A[2] !== $N1\n // (2, 2, 2, 2, 2) $A[3] === $N1, max counter\n // (3, 2, 2, 2, 2) $A[4] !== $N1\n // (3, 2, 2, 3, 2) $A[5] !== $N1\n // (3, 2, 2, 4, 2) $A[6] !== $N1\n\n // Our steps will be like this\n // (0, 0, 1, 0, 0) $A[0] !== $N1, $current_big_val = 1, $addition_val = 0\n // (0, 0, 1, 1, 0) $A[1] !== $N1, $current_big_val = 1, $addition_val = 0\n // (0, 0, 1, 2, 0) $A[2] !== $N1, $current_big_val = 2, $addition_val = 0\n // (0, 0, 0, 0, 0) $A[3] === $N1, max counter so empty array, $current_big_val = 0, $addition_val = 2\n // (1, 0, 0, 0, 0) $A[4] !== $N1\n // (1, 0, 0, 1, 0) $A[5] !== $N1\n // (1, 0, 0, 2, 0) $A[6] !== $N1\n // add $addition_val which is 2 to each element\n // (3, 2, 2, 4, 2)\n \n $len = count($A);\n $N1 = $N + 1;\n $current_big_val = 0;\n $addition_val = 0;\n \n for ($i = 0; $i < $len; $i++) {\n if ($A[$i] === $N1) {\n $result_arr = array();\n $addition_val += $current_big_val;\n $current_big_val = 0;\n } else {\n if (!isset($result_arr[$A[$i] - 1])) {\n $result_arr[$A[$i] - 1] = 0;\n }\n \n $result_arr[$A[$i] - 1] ++;\n \n if ($current_big_val < $result_arr[$A[$i] - 1]) {\n $current_big_val = $result_arr[$A[$i] - 1];\n }\n }\n }\n \n for ($i=0; $i<$N; $i++) {\n $result_arr[$i] = !isset($result_arr[$i]) ? $addition_val : $result_arr[$i] + $addition_val;\n }\n \n return $result_arr;\n}", "function solution($S, $P, $Q){\r\n $A = $C = $G = $T = 0;\r\n $results = array();\r\n $quantaties = array();\r\n $quantaties[-1]=\"0000\"; \r\n if ((strlen($S) < 1) || (strlen($S) > 100000))\r\n return 0;\r\n if ((count($P) < 1) || (count($P) > 50000))\r\n return 0;\r\n if ((count($Q) < 1) || (count($Q) > 50000))\r\n return 0;\r\n for ($i = 0; $i < strlen($S); $i++) {\r\n switch (substr($S, $i, 1)) {\r\n case 'A':\r\n $A++; \r\n break;\r\n case 'C':\r\n $C++;\r\n break;\r\n case 'G':\r\n $G++;\r\n break;\r\n case 'T':\r\n $T++;\r\n break;\r\n }\r\n $quantaties[$i]=$A.\"|\".$C.\"|\".$G.\"|\".$T; \r\n } \r\n// print_r($quantaties);\r\n $right=$left=array();\r\n for ($i = 0; $i < count($P); $i++) {\r\n $right=explode(\"|\", $quantaties[$Q[$i]]); print_r($right);\r\n $left=explode(\"|\", $quantaties[$P[$i]-1]); print_r($left);\r\n if (($right[0]-$left[0])!=0) $results[$i]=1;\r\n elseif (($right[1]-$left[1])!=0) $results[$i]=2;\r\n elseif (($right[2]-$left[2])!=0) $results[$i]=3;\r\n else $results[$i]=4;\r\n }\r\n return $results;\r\n}", "function solution($A)\n{\n $pairs = $zeros = 0;\n\n foreach ($A as $k => $v) {\n $zeros += ($v === 0);\n\n if ($v===1) {\n $pairs += $zeros;\n }\n\n if ($pairs>1000000000) {\n $pairs = -1;\n break;\n }\n }\n\n return $pairs;\n}", "function solution($N, $A) {\n $m = count($A);\n\n // init counters\n $C = array();\n for ($i = 0; $i < $N; $i++) {\n $C[$i] = 0;\n }\n\n $max = 0;\n $minC = 0; // maximized helper value\n foreach ($A as $ai) {\n if ($ai <= $N) {\n /*\n * increase operation\n */\n // even the value\n if($C[$ai - 1] < $minC) {\n $C[$ai - 1] = $minC;\n }\n // actual increase\n $C[$ai - 1] ++;\n // calculate max\n if ($max < $C[$ai - 1]) {\n $max = $C[$ai - 1];\n }\n } elseif ($ai == $N + 1) {\n // do not actual increase to speed up operations\n $minC = $max;\n }\n }\n // even the values\n foreach($C as &$ci) {\n if($ci < $minC) {\n $ci = $minC;\n }\n }\n return $C;\n}", "function solution(array $a) {\n $count = count($a);\n\n $sums = [0 => $a[0]];\n $sums_r = [];\n $sums_r[$count-1] = $a[$count-1];\n\n for ($i=1; $i<count($a); $i++) {\n $sums[$i] = $sums[$i-1] + $a[$i];\n $sums_r[$count-$i-1] = $sums_r[$count-$i] + $a[$count-$i-1];\n }\n $diffs = [];\n\n for ($i=1; $i<$count; $i++) {\n $diffs[] = abs($sums[$i-1] - $sums_r[$i]);\n }\n\n return min($diffs);\n}", "function getSubseqSum( $arr ) {\n\n $N = count($arr) - 1;\n\n $bestSum = 0;\n\n $posBest = -1;\n\n for($i = 0; $i <= $N; $i++) {\n\n for($j = $N; $j >= $i; $j--) {\n\n $partialSum = 0;\n\n for($k = $i; $k <= $j; $k++) {\n\n $partialSum += $arr[ $k ]; \n }\n\n if($partialSum > $bestSum) {\n\n $bestSum = $partialSum;\n } \n } \n }\n\n return $bestSum;\n}", "function SumSize($a) {\n\n $n = count($a); // ??????????? ??????? ? ????????? (???? ?????? ?????? 3 ??. ????? ??????????? ????? ?? 2 ??????!!!)\n\n for ($i3 = 1; $i3 < $n; $i3++) {\n // ????????????? ??????? ?? ????????\n for ($i2 = $i3 - 1; $i2 < $n; $i2++) {\n for ($i = 0; $i <= 1; $i++) {\n if ($a[$i2]['X'] < $a[$i2]['Y']) {\n $a1 = $a[$i2]['X'];\n $a[$i2]['X'] = $a[$i2]['Y'];\n $a[$i2]['Y'] = $a1;\n };\n if (($i == 0) and ($a[$i2]['Y'] < $a[$i2]['Z'])) {\n $a1 = $a[$i2]['Y'];\n $a[$i2]['Y'] = $a[$i2]['Z'];\n $a[$i2]['Z'] = $a1;\n }\n }\n $a[$i2]['Sum'] = $a[$i2]['X'] + $a[$i2]['Y'] + $a[$i2]['Z']; // ????? ??????\n }\n\n // ????????????? ????? ?? ???????????\n for ($i2 = $i3; $i2 < $n; $i2++)\n for ($i = $i3; $i < $n; $i++)\n if ($a[$i - 1]['Sum'] > $a[$i]['Sum']) {\n $a2 = $a[$i];\n $a[$i] = $a[$i - 1];\n $a[$i - 1] = $a2;\n }\n\n // ????????? ????? ????????? ???? ????? ????????? ??????\n if ($a[$i3 - 1]['X'] > $a[$i3]['X']) {\n $a[$i3]['X'] = $a[$i3 - 1]['X'];\n }\n if ($a[$i3 - 1]['Y'] > $a[$i3]['Y']) {\n $a[$i3]['Y'] = $a[$i3 - 1]['Y'];\n }\n $a[$i3]['Z'] = $a[$i3]['Z'] + $a[$i3 - 1]['Z'];\n $a[$i3]['Sum'] = $a[$i3]['X'] + $a[$i3]['Y'] + $a[$i3]['Z']; // ????? ??????\n }\n\n //?????????\n //echo '<br>( '.Round($a[$n-1]['X'],2).' '.Round($a[$n-1]['Y'],2).' '.Round($a[$n-1]['Z'],2).' )';\n\n return (array('length' => Round($a[$n - 1]['X'], 2), 'width' => Round($a[$n - 1]['Y'], 2), 'height' => Round($a[$n - 1]['Z'], 2)));\n }", "function solution($input)\n {\n $result = 1;\n\n $divisors_desc = array();\n $divisors_asc = array();\n $divisor_limit = $input;\n\n for($i = 2; $i < $divisor_limit; $i++){\n if($input % $i == 0){\n $divisor_limit = $input/$i;\n $divisors_desc[] = $divisor_limit;\n $divisors_asc[] = $i;\n }\n }\n //complexity O(n)\n \n $divisors = array_merge($divisors_desc,array_reverse($divisors_asc));\n print_r($divisors);\n\n //if no divisors exist, the number itself is prime\n if(count($divisors)==0){\n $result = $input;\n }\n\n //finding prime number in divisors list\n //starting from highest\n for($d = 0; $d < count($divisors); $d++)\n {\n $isPrime = true;\n $divisor_limit = $divisors[$d];\n\n //if any divisor is found, number is not prime\n for($x = 2; $x<$divisor_limit;$x++)\n {\n if($divisors[$d] % $x == 0){\n $isPrime = false;\n print_r($divisors[$d]. \"is not prime\\n divisor \". $x. \"\\n\");\n break;\n }\n }\n\n if($isPrime){\n $result = $divisors[$d];\n break;\n }\n }\n\n $solution = array();\n $solution['complexity'] = \"O(n2)\";\n $solution['result'] = $result;\n\n return $solution;\n }", "function solution($A) {\n // write your code in PHP7.0\n $idxes = [];\n $C = [];\n $L = count($A);\n $mid = floor($L/2);\n\n foreach ($A as $k=>$v) {\n if (!isset($C[$v])) {\n $idxes[$v] = [];\n $C[$v] = 0;\n }\n\n $C[$v] += 1;\n array_push($idxes[$v], $k);\n\n if ($C[$v] > $mid) {\n $rIdx = $v;\n }\n }\n\n // No leader\n if (!isset($rIdx)) {\n return 0;\n }\n \n $leaderIndexes = $idxes[$rIdx];\n // print_r($leaderIndexes);\n $leaderTotal = count($leaderIndexes);\n $eCount = 0;\n for ($i = 0; $i < $leaderTotal; $i++) {\n $leaderIndex = $leaderIndexes[$i];\n $taCount = $leaderIndex + 1;\n \n $taMid = floor($taCount / 2);\n // $i + 1 is the count of leaders so far\n if ($i+1 > $taMid){\n $tbCount = $L - $taCount;\n $leftLeaders = $leaderTotal - ($i + 1); \n // print \"\\$i: $i, \\$leaderIndex: $leaderIndex, \\$taCount: $taCount, \\$tbCount: $tbCount, \\$leftLeaders: $leftLeaders \\r\\n\";\n if ($leftLeaders > floor($tbCount / 2)) {\n $eCount++;\n }\n\n // borrow from left for list like [4, 4, 2, 5, 3, 4, 4, 4];\n if ($i + 1 > floor(($taCount + 1) / 2) && $i+1 < $leaderTotal && $leaderIndexes[$i+1] != $leaderIndexes[$i] + 1 && $leftLeaders > floor(($tbCount - 1) / 2)) {\n $eCount++;\n }\n } \n }\n\n return $eCount;\n}", "function getSumSeq( $arr ) {\n\n $N = count($arr) - 1;\n \n $sum = array();\n\n $sum[ 0 ] = $arr[ 0 ];\n\n for($i = 1; $i <= $N; $i++) {\n\n $sum[ $i ] = $arr[ $i ] + $sum[ $i - 1 ]; \n } \n\n $bestSum = 0;\n\n $best = array();\n\n $best[ 0 ] = $sum[ 0 ];\n\n $min = $sum[ 0 ];\n \n for($i = 1; $i <= $N; $i++) {\n\n $best[ $i ] = $sum[ $i ] - $min;\n\n if($sum[ $i ] < $min) {\n\n $min = $sum[ $i ];\n } \n\n if($bestSum < $best[ $i ]) {\n\n $bestSum = $best[ $i ]; \n $pos = $i;\n }\n } \n\n return array(\"bestsum\"=>$bestSum, \n \"pos\"=>$pos);\n}", "function solution($N, $A) {\n $counters = array_fill(1, $N, 0);\n $currentMax = 0;\n foreach ($A as $v) {\n if ($v >= 1 && $v <= $N) {\n $counters[$v] += 1;\n if ($counters[$v] > $currentMax) {\n $currentMax = $counters[$v];\n }\n }\n else if ($v === ($N + 1)) {\n $counters = array_fill(1, $N, $currentMax);\n }\n }\n return array_values($counters);\n}", "function searchI1($a, $n, $x)\n{\n \n $last = $a[$n - 1];\n // создаем гарантию что х содержится в списке\n $a[$n - 1] = $x;\n $i = 0;\n while($a[$i] != $x)\n {\n $i++;\n }\n $a[$n - 1] = $last;\n if ($i < ($n - 1) || $a[$n - 1] == $x)\n {\n return $i;\n }\n return -1;\n}", "public function task5()\n {\n function solution($A, $K) {\n $N = count($A);\n\n for ($i = 0; $i < $N - 1; $i++) {\n if ($A[$i] + 1 < $A[$i + 1]) {\n return false;\n }\n }\n\n if ($A[0] != 1 && $A[$N - 1] != $K) {\n return false;\n }\n\n return true;\n }\n\n $A = [2,3]; $K = 2;\n// $A = [1,2,3]; $K = 2;\n// $A = [1,1,3]; $K = 2;\n\n dd($A, $K, solution($A, $K));\n }", "function sockMerchant($n, $ar)\n{\n\n $result = 0;\n $auxiliar = [];\n\n for($i=0 ; $i<sizeof($ar); $i++){\n if(in_array($i, $auxiliar)) continue;\n\n for($j=1; $j<sizeof($ar) ; $j++) {\n if($i == $j) continue;\n\n if (in_array($j, $auxiliar)) continue;\n\n if ($ar[$i] == $ar[$j]) {\n array_push($auxiliar, $i, $j);\n $result++;\n break;\n }\n }\n }\n return $result;\n}", "function minimumBribes($q)\n{\n $stepsCount = 0;\n $bribesCounts = [];\n $arrayLength = sizeOf($q)-1;\n $swapCntPerRound = 0;\n for ($i = 0; $i < $arrayLength; $i++) {\n if ($q[$i] > $q[$i+1]) {\n if (!isset($bribesCounts[$q[$i]])) {\n $bribesCounts[$q[$i]] = 0;\n }\n\n $bribesCounts[$q[$i]]++;\n\n if ($bribesCounts[$q[$i]] > 2) {\n //echo 'Too chaotic', PHP_EOL;\n return \"Too chaotic\";\n }\n\n $stepsCount++;\n $swapCntPerRound++;\n list($q[$i+1], $q[$i]) = [$q[$i], $q[$i+1]];\n }\n\n if ($i == $arrayLength-1 && $swapCntPerRound > 0) {\n $i = -1;\n $swapCntPerRound = 0;\n }\n }\n\n //echo array_sum($bribesCounts), PHP_EOL;\n return array_sum($bribesCounts);\n}", "function solution($A) {\n // write your code in PHP7.0\n \n asort($A);\n $miss = 0;\n \n $size = count($A);\n for ($i=1; $i <= $size; $i++) { \n if (in_array($i, $A)) {\n \n } else {\n $miss = $i;\n break;\n }\n }\n \n return $miss;\n}", "function arrayManipulation($number, $queries) {\n\n $array=[];\n for ($index = 0; $index < count($queries); $index++)\n {\n $array[$queries[$index][0]-1]=0;\n $array[$queries[$index][1]]=0;\n }\n for ($index = 0; $index < count($queries); $index++)\n {\n $a= $queries[$index][0];\n $b= $queries[$index][1];\n $k= $queries[$index][2];\n $array[$a-1] += $k;\n $array[$b] -= $k;\n }\n\n $sum=0;\n $max=0;\n for ($index = 0; $index < $number; $index++)\n {\n @$sum += $array[$index];\n if ($sum > $max)\n $max = $sum;\n }\n return $max;\n}", "function euler009(int $sum): int\n{\n for ($a = 1; $a <= $sum - (2 * $a + 3); $a++) {\n for ($b = $a + 1; $b <= $sum - ($b + 1); $b++) {\n $c = $sum - ($a + $b);\n if ($a ** 2 + $b ** 2 == $c ** 2) {\n // The problem statement guarantees that this will be reached\n return $a * $b * $c;\n }\n }\n }\n}", "function Fannkuch($n){\n $check = 0;\n $perm = array();\n $perm1 = array();\n $count = array();\n $maxPerm = array();\n $maxFlipsCount = 0;\n $m = $n - 1;\n\n for ($i=0; $i<$n; $i++) $perm1[$i] = $i;\n $r = $n;\n\n while (TRUE) {\n // write-out the first 30 permutations \n if ($check < 30){\n for($i=0; $i<$n; $i++) echo $perm1[$i]+1; \n echo \"\\n\";\n $check++;\n }\n\n while ($r != 1){ $count[$r-1] = $r; $r--; } \n if (! ($perm1[0]==0 || $perm1[$m] == $m)){ \n for($i=0; $i<$n; $i++) $perm[$i] = $perm1[$i]; \n $flipsCount = 0;\n\n while ( !(($k=$perm[0]) == 0) ) {\n $k2 = ($k+1) >> 1;\n for($i=0; $i<$k2; $i++) {\n $temp = $perm[$i]; $perm[$i] = $perm[$k-$i]; $perm[$k-$i] = $temp;\n }\n $flipsCount++;\n }\n\n if ($flipsCount > $maxFlipsCount) {\n $maxFlipsCount = $flipsCount;\n for($i=0; $i<$n; $i++) $maxPerm[$i] = $perm1[$i];\n }\n } \n\n while (TRUE) { \n if ($r == $n) return $maxFlipsCount;\n $perm0 = $perm1[0];\n $i = 0;\n while ($i < $r) {\n $j = $i + 1;\n $perm1[$i] = $perm1[$j];\n $i = $j;\n }\n $perm1[$r] = $perm0;\n\n $count[$r] = $count[$r] - 1;\n if ($count[$r] > 0) break;\n $r++;\n }\n }\n}", "function uniquePaths($m, $n) {\n// 定义二维数组\n $pathNum = array();\n\n// dp[m][n] = dp[m-1][n] + dp[m][n-1]\n\n// 定义初始值\n for ($i = 0;$i < $m;$i++){\n $pathNum[$i][0] = 1;\n }\n for ($i = 0;$i < $n;$i++){\n $pathNum[0][$i] = 1;\n }\n\n for ($i = 1;$i < $m;$i++){\n for ($v = 1;$v < $n;$v++){\n $pathNum[$i][$v] = $pathNum[$i - 1][$v] + $pathNum[$i][$v - 1];\n }\n }\n\n return $pathNum[$m - 1][$n - 1];\n}", "function getSumV2($list)\r\n{\r\n $cache = [];\r\n for ($i=0; $i<count($list); $i++) {\r\n array_push($cache, 0);\r\n }\r\n\r\n $cache[0] = max($cache[0], $list[0]);\r\n $cache[1] = max($cache[0], $list[1]);\r\n\r\n for ($i=2; $i<count($list); $i++) {\r\n $cache[$i] = max(($list[$i] + $cache[$i-2]), $cache[$i-1]);\r\n }\r\n return $cache[$i-1];\r\n}", "function solution($arr, $int) {\n //\n}", "public function getSolution(){\n\t\t$bulbs = array_fill(0, 100, false);\n\t\t\n\t\t//main logic\n\t\tfor ($i=1; $i < sizeof($bulbs); $i++) { \n\t\t\tfor ($j=0; $j < sizeof($bulbs); $j+=$i) { \n\t\t\t\t$bulbs[$j] = !$bulbs[$j];\t\n\t\t\t}\n\t\t}\n\n\t\t//array filter is used to filter only true values from the array.\n\t\treturn count(array_filter($bulbs));\n\t}", "function euler_solution_003($product)\n{\n $answer = 1;\n $point = 3;\n $divisor = $product;\n\n while ( 0 == ( $divisor % 2 ) ) {\n $answer = 2;\n $divisor = ( $divisor / 2 );\n }\n\n while ($divisor != 1) {\n while (0 == ($divisor % $point)) {\n $answer = $point;\n $divisor = ($divisor / $point);\n }\n $point += 2;\n }\n return $answer;\n}", "function getSum($list)\r\n{\r\n $sum = 0;\r\n for ($i=2; $i<count($list); $i++) {\r\n for ($k=0; $k<$i; $k++) {\r\n $tSum = 0;\r\n for ($j=$k; $j<count($list); $j+=$i) {\r\n $tSum += $list[$j];\r\n }\r\n if ($tSum > $sum) $sum = $tSum;\r\n }\r\n }\r\n\r\n return $sum;\r\n}", "function getResultPart1($input) {\n if ($input < 0) {\n return 0;\n }\n \n //2D matrix (not scalable to 3D, would need other changes as well)\n $total_dimensions = 2;\n $total_edges = 2 ** $total_dimensions;\n \n //get the dimension of the matrix \n //(this way our input number will be on the outer edge)\n $dimension = ceil(sqrt($input));\n \n //the dimensions of the square will always be odd (so make sure dimension is odd)\n if ($dimension % 2 == 0) {\n ++$dimension;\n }\n \n //steps to the outer ring (where the input number will be)\n $steps_to_outer_ring = floor($dimension / $total_dimensions);\n \n //steps from outer ring corner to midpoint (same as steps to outer ring)\n $steps_outer_corner_to_midpoint = $steps_to_outer_ring;\n \n //highest value in the matrix (will be located at one of the corners)\n $highest_value = $dimension ** $total_dimensions;\n \n //initialize our steps to the value to get to the outer ring\n $total_steps = $steps_to_outer_ring;\n \n //we need to figure out which side our number is on, \n //then compute the steps travelled along the outer edge\n for ($edge = 1; $edge <= $total_edges; ++$edge) {\n //compute the lowest number on each side to find where our input number is located\n //NOTE: give each side its own corner, makes computing easier (thus the minus 1)\n $side_lowest_value = $highest_value - (($dimension - 1) * $edge);\n \n //see if we have find the side our number is on\n if ($side_lowest_value <= $input) {\n //we found the side, compute the midpoint \n $side_midpoint_value = $side_lowest_value + $steps_outer_corner_to_midpoint;\n \n //add the distance travelled along the outer edge to the total steps\n $total_steps += abs($input - $side_midpoint_value);\n break;\n }\n }\n print(\"Input: $input, Required Steps: $total_steps\\n\");\n return $total_steps;\n}", "function multiply($num)\r\n{\r\n $possible_solution = array();\r\n $ps_counter = 0;\r\n \r\n $data = array();\r\n $data_counter = 0;\r\n for($i1 = 1;$i1<=10;$i1++)\r\n {\r\n for($i2 = 1;$i2<=10;$i2++)\r\n {\r\n if(($i2 * $i1) == $num)\r\n {\r\n \r\n $data[$data_counter] = array($i1 , $i2);\r\n $data_counter++;\r\n \r\n }\r\n }\r\n }\r\n return $data;\r\n}", "public function similarity($id_lbb_aktif = 3) // $id_lbb_aktif adalah lbb yang sedang dilihat dan dicari nilai kemiripan terhapat lbb lain\n {\n $tabel_tf_idf_balik = $this->tabel_tf_idf_balik();\n $rata_term = $this->rata_term();\n $similarity = [];\n\n\n foreach ($tabel_tf_idf_balik as $id_lbb => $row){\n $sim_atas = 0;\n $bawah1 = 0;\n $bawah2 = 0;\n $sim_bawah = 0;\n\n if ($id_lbb == $id_lbb_aktif){ // $id_lbb_aktif adalah LBB yang dicari kemiripannya dengan LBB lain\n continue;\n }\n\n foreach ($row as $term_aktivitas => $tf_idf){\n//\n if ($tf_idf == 0 || $tabel_tf_idf_balik[$id_lbb_aktif][$term_aktivitas] == 0){\n continue;\n }\n\n $sim_atas = $sim_atas + (($tf_idf-$rata_term[$term_aktivitas])*($tabel_tf_idf_balik[$id_lbb_aktif][$term_aktivitas]-$rata_term[$term_aktivitas]));\n $bawah1 = $bawah1 + (pow($tf_idf-$rata_term[$term_aktivitas],2));\n $bawah2 = $bawah2 + (pow($tabel_tf_idf_balik[$id_lbb_aktif][$term_aktivitas]-$rata_term[$term_aktivitas], 2));\n $sim_bawah = sqrt($bawah1)*sqrt($bawah2);\n }\n////\n if ($sim_bawah == 0){ //similarity bawah bernilai 0 terjadi karena tidak ada bisa dicari nilai kemiripan lbb aktif dengan lbb n lainnya\n continue;\n }\n\n $similarity [$id_lbb] = $sim_atas / $sim_bawah;\n }\n// arsort($similarity);\n return $similarity;\n }", "function array_method($a){\n\t$tmpArray = array_fill(0,count($a),0);\n\n\tforeach($a as $v) {\n\t\t$tmpArray[$v-1] ++;\n\t\tif($tmpArray[$v-1] >1) {\n\t\t\treturn $v;\n\t\t}\n\t}\n}", "function sapXep($arr){\n for ($i = 0; $i < count($arr) - 1; $i ++){\n // Tim vi tri min\n $min = $i;\n for ($j = $i +1; $j < count($arr); $j ++){\n if ($arr[$j] < $arr[$min]){\n $min = $j;\n }\n }\n //sau khi co vi tri nho nhat thi doi vi tri voi $i\n $temp = $arr[$i];\n $arr[$i] = $arr[$min];\n $arr[$min] = $temp;\n\n }\n return $arr;\n}", "function raw_method2($nums, $k) {\n $start = recordStart();\n $result = [];\n\n $max_left[0] = $nums[0];\n $max_right[count($nums) - 1] = $nums[count($nums) - 1];\n\n // Separate max start from left and max start from right\n for ($i = 0; $i < count($nums); $i++) {\n // Collect max start from left\n $max_left[$i] = ($i % $k == 0) ? $nums[$i] : max($max_left[$i - 1], $nums[$i]);\n\n // Collect max start from right\n $j = count($nums) - $i - 1;\n $max_right[$j] = ($j % $k == 0) ? $nums[$j] : max(isset($max_right[$j + 1]) ? $max_right[$j + 1] : $max_right[$j], $nums[$j]);\n }\n\n // Merge and compare\n for ($i = 0; $i + $k <= count($nums); $i++) {\n $result[] = max($max_right[$i], $max_left[$i + $k - 1]);\n }\n\n\n $end = recordEnd($start);\n\n return ['result raw_method2' => $result, 'input' => $nums, 'slide' => $k, 'total exe time (microsecond)' => $end];\n}", "function getMaxSumSubSequence($arr, $li, $ls) {\n\n if($li == $ls) return $arr[ $li ];\n\n $middle = intval(($li+$ls)/2);\n\n\n $bestL = getMaxSumSubSequence($arr, $li, $middle);\n $bestR = getMaxSumSubSequence($arr, $middle+1,$ls);\n\n $maxSuf = -9999; \n $maxPre = -9999;\n\n $suf = 0;\n for($i = $middle;$i >= $li; $i--) {\n\n $suf += $arr[$i]; \n\n if($suf > $maxSuf) {\n $maxSuf = $suf;\n } \n } \n\n $pre = 0;\n for($j = $middle+1;$j <= $ls; $j++) {\n\n $pre += $arr[$j];\n\n if($pre > $maxPre) {\n $maxPre = $pre;\n }\n } \n\n\n return max($bestL, max($bestR, ($maxSuf + $maxPre) )); \n}", "function searchV3Recur($array, $start, $end, $value) { \n if ($start > $end) {\n return;\n }\n // get mid index.\n $mid = floor(($start + $end) / 2);\n // if 1st left < mid value:\n // left is ordered normally\n // determine which side to search\n // if value >= 1st left && value < mid\n // search left side\n // else \n // search right side\n // else\n // right is ordered normally\n // determine which side to search\n // if value >= mid+1 && value <= end\n // search right side\n // else\n // search left side\n if ($array[$mid] == $value) {\n return $mid;\n } elseif ($array[$start] < $array[$mid]) {\n // left is ordered normally\n if ($value >= $array[$start] && $value < $array[$mid]) {\n // search left side\n return searchV3Recur($array, $start, $mid-1, $value);\n } else {\n // search right side\n return searchV3Recur($array, $mid+1, $end, $value);\n }\n } elseif ($array[mid] < $array[$end]) {\n // right is ordered normally\n if ($value > $array[$mid] && $value <= $array[$end]) {\n // search right side\n return searchV3Recur($array, $mid+1, $end, $value);\n } else {\n // search left side\n return searchV3Recur($array, $start, $mid-1, $value);\n }\n } elseif ($array[$start] == $array[$mid]) {\n // left half is all repeats\n if ($array[$mid] !== $array[$right]) {\n // search right\n return searchV3Recur($array, $mid+1, $end, $value);\n } else {\n // we have to search both halves\n $result = searchV3Recur($array, $start, $mid-1, $value);\n if (empty($result)) {\n return searchV3Recur($array, $mid+1, $end, $value);\n } else {\n return $result;\n }\n }\n }\n return;\n}", "function edDisRecursive($str1, $str2){\n $distanceMatrix=[[0]];\n // Filling the first row of the matrix.\n // If this is the first row then we're transforming empty string to str1.\n // In this case the number of transformations equals to size of str1 substring.\n for ($i = 1; $i <= strlen($str1); $i++){\n $distanceMatrix[0][$i]=$i; \n if($i<= strlen($str2)){\n array_push($distanceMatrix,[]);\n $distanceMatrix[$i][0]=$i; \n }\n }\n // Filling the first column of the matrix.\n // If this is the first column then we're transforming empty string to str2.\n // In this case the number of transformations equals to size of str2 substring.\n for ($i = strlen($str1); $i <= strlen($str2); $i++){\n array_push($distanceMatrix,[]);\n $distanceMatrix[$i][0]=$i; \n }\n for ($j = 1; $j <= strlen($str1); $j++){\n for ($i = 1; $i <= strlen($str2); $i++){\n if($str1[$j-1] == $str2[$i-1]) $distanceMatrix[$i][$j] = $distanceMatrix[$i-1][$j-1];\n else $distanceMatrix[$i][$j]= $this->min($distanceMatrix[$i-1][$j-1],$distanceMatrix[$i][$j-1],$distanceMatrix[$i-1][$j])+1;\n }\n }\n return $distanceMatrix[strlen($str2)][strlen($str1)];\n }", "public static function sum_of_3_ints()\n {\n $arr= array();\n $count =0;\n echo \"enter the size of array:\\n\";\n $number = Utility::takingnuminput();\n for($x =0; $x< $number ;$x++)\n {\n echo \"enter the number:\\n\";\n $num = Utility::takingnuminput();\n $arr[$x]=$num;\n }\n for($i=0;$i< count($arr); $i++)\n {\n for($j =$i+1;$j< count($arr) ; $j++)\n {\n for($k =$j+1; $k< count($arr) ; $k++)\n {\n if(($arr[$i] + $arr[$j] + $arr[$k]) == 0)\n {\n ++$count;\n echo \"the sum of 3 which is equal to zero : \".$arr[$i].\"+\".$arr[$j].\"+\".$arr[$k].\" =0 \\n\";\n }\n\n }\n }\n }\n echo \"the number of triplets found is $count \\n\";\n\n\n }", "function getNextValues($array, $value, $int, $first, $tense){\n if($tense==\"Preterito\"){//in the preterite tense\n\n $value = 'hube';\n $array = array_reverse($array);\n \n $index = array_search($value, $array);\n \n $array = array_reverse($array);\n $index = sizeof($array)- $index;\n $index--;\n $conj = array();\n \n for($i=$int+5;$i>5;$i--){\n array_push($conj, $array[$index - $i]);\n }\n \n return $conj;\n }\n \n \n if($first==2){\n $array = array_reverse($array);\n \n $index = array_search($value, $array);\n \n $array = array_reverse($array);\n $index = sizeof($array)- $index;\n $index--;\n }else{\n $index = array_search($value, $array);\n }\n $conj = array();\n for($i=1;$i<=$int;$i++){\n array_push($conj, $array[$index + $i]);\n }\n return $conj;\n}", "function sumate2(array $n,int $r) {\r\n if ($r < 0) {\r\n return 0;\r\n } else {\r\n print($n[$r]);\r\n print \"<br> \";\r\n return ($n[$r]) + sumate2($n, $r-1);\r\n }\r\n}", "function findPartition($arr , $count)\r\n{\r\n \r\necho\"<h1>INPUT ARRAY</h1>\";\r\nfor($i=0; $i<$count;$i++){\r\n echo \"<span>{$arr[$i]} </span>\";\r\n}\r\necho\"<br><br>\";\r\n \r\n$sum = 0;\r\n$i = $j = 0;\r\n// echo \"<pre>\";\r\n\r\n// // print_r($arr);\r\n\r\n// echo \"</pre>\";\r\n// Calculate sum of all elements\r\n// for ($i = 0; $i < $count; $i++){\r\n $sum = Array_sum($arr);\r\n echo \"<span><b>TOTAL ARRAY SUM</b>: \",$sum,\"</span><br>\";\r\n// }\r\n\r\nif ($sum % 2 != 0)\r\n{\r\n \r\n return 0;\r\n}\r\n$part = array(array());\r\n \r\n//echo $count . \"<br>\";\r\n// initialize top row as true\r\nfor ($i = 0; $i <= $count; $i++)\r\n $part[0][$i] = 1;\r\n\r\n// initialize leftmost column,\r\n// except part[0][0], as 0\r\nfor ($i = 1; $i <= $sum / 2; $i++)\r\n $part[$i][0] = 0;\r\n\r\n// Fill the partition table in bottom up manner\r\nfor ($i = 1; $i <= $sum / 2; $i++) {\r\n for ($j = 1; $j <= $count; $j++) {\r\n $part[$i][$j] = $part[$i][$j - 1];\r\n // echo \"i : \".$i . \"<br>\";\r\n // echo \"j : \".$j . \"<br>\";\r\n // echo \"part : \" .$part[$i][$j] .\"<br>\";\r\n \r\n if ($i >= $arr[$j - 1]){\r\n $part[$i][$j] = $part[$i][$j] || $part[$i - $arr[$j - 1]][$j - 1];\r\n if($part[$i][$j] == 0 && $part[$i - $arr[$j - 1]][$j - 1] == 0)\r\n {\r\n $part[$i][$j] = 0;\r\n }\r\n }\r\n }\r\n}\r\n\r\n // uncomment this part to print table\r\n// for ($i = 0; $i <= $sum/2; $i++)\r\n// {\r\n// for ($j = 0; $j <= $count; $j++){\r\n// echo $part[$i][$j];\r\n\r\n// }\r\n// echo \"<br>\";\r\n\r\n// } \r\necho \"<h1>OUTPUT TABLE</h1>\";\r\n\r\n// print_r($part);\r\n?>\r\n<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n <meta charset=\"UTF-8\">\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n <title>Document</title>\r\n <script>\r\n var i=0,j=0,k=0;\r\n \r\n function print_array(){\r\n var element = document.getElementsByClassName(\"hidden\");\r\n //var str1 = document.getElementsByClassName(\"st1\");\r\n console.log(element);\r\n element[0].classList.remove(\"hidden\");\r\n \r\n \r\n // var array_element = document.createTextNode(ary[i][j]);\r\n // parent.appendChild(array_element);\r\n // j++;\r\n // if(j == (ary[i].length))\r\n // {\r\n // j = 0;\r\n // i++;\r\n // counter++;\r\n // }\r\n // if(counter == ary.length)\r\n // {\r\n // $('button').prop(\"disabled\",\"true\");\r\n \r\n // }\r\n }\r\n</script>\r\n</head>\r\n<body>\r\n<script>\r\nfunction finalize(){\r\n var element = document.getElementsByClassName(\"hidden\");\r\n var count=element.length;\r\n for(var i = 0 ; i < count ; i++){\r\n element[0].classList.remove(\"hidden\");\r\n }\r\n }\r\n</script>\r\n <button id = 'show' onclick = \"print_array()\" >Next Iterations</button>\r\n <button id = 'show' onclick = \"finalize()\" >Finalize</button><br>\r\n</body>\r\n\r\n\r\n\r\n</html>\r\n<?php\r\necho \"</pre>\";\r\necho \"<table>\";\r\nfor ($i = 0; $i <= $sum / 2; $i++) {\r\n echo \"<tr >\";\r\n for ($j = 1; $j <= $count; $j++) {\r\n echo \"<td class = 'hidden'>{$part[$i][$j]}</td>\";\r\n }\r\n echo \"</tr>\";\r\n\r\n \r\n}\r\necho \"</table>\";\r\n\r\nreturn $part[$sum / 2][$count];\r\n}", "public static function distinctTriplets($n)\n {\n $arr = array();\n echo \"enter the elements \\n\";\n\n //enter the elements to array\n for ($i = 0; $i < $n; $i++) {\n $arr[$i] = Utility::readInt();\n }\n $totalDistinct = 0;\n\n for ($i = 0; $i < sizeof($arr); $i++) {\n for ($j = $i + 1; $j < sizeof($arr); $j++) {\n for ($k = $j + 1; $k < sizeof($arr); $k++) {\n\n //sum of three values of arry is equal to 0\n if (($arr[$i] + $arr[$j] + $arr[$k]) == 0) {\n echo $arr[$i] . \" \", $arr[$j] . \" \" . $arr[$k] . \" \";\n $totalDistinct++;\n }\n }\n }\n }\n echo \"\\n total distinct triplets are \" . $totalDistinct . \"\\n\";\n }", "public static function inferensi($nilaiIPK, $nilaiPenghasilan, $nilaiJarak, $nilaiTanggungan, $nilaiRumah, $nilaiMotor, $nilaiMobil, $nilaiListrik, $nilaiAir) {\n\n echo \"Rule yang digunakan : \\n\";\n $x = 0;\n $kondisi = [];\n\n for ($ip = 0; $ip < count($nilaiIPK); $ip++) {\n for ($pn = 0; $pn < count($nilaiPenghasilan); $pn++) {\n for ($jr = 0; $jr < count($nilaiJarak); $jr++) {\n for ($tg = 0; $tg < count($nilaiTanggungan); $tg++) {\n for ($rm = 0; $rm < count($nilaiRumah); $rm++) {\n for ($mt = 0; $mt < count($nilaiMotor); $mt++) {\n for ($mb = 0; $mb < count($nilaiMobil); $mb++) {\n for ($ls = 0; $ls < count($nilaiListrik); $ls++) {\n for ($ai = 0; $ai < count($nilaiAir); $ai++) {\n if (($nilaiIPK[$ip] > 0) && ($nilaiPenghasilan[$pn] > 0) && ($nilaiJarak[$jr] > 0) && ($nilaiTanggungan[$tg] > 0) && ($nilaiRumah[$rm] > 0) && ($nilaiMotor[$mt] > 0) && ($nilaiMobil[$mb] > 0) && ($nilaiListrik[$ls] > 0) && ($nilaiAir[$ai] > 0)) {\n $alpha[$x] = min($nilaiIPK[$ip], $nilaiPenghasilan[$pn], $nilaiJarak[$jr], $nilaiTanggungan[$tg], $nilaiRumah[$rm], $nilaiMotor[$mt], $nilaiMobil[$mb], $nilaiListrik[$ls], $nilaiAir[$ai]);\n if ($ip == 2 && $jr == 2 && $pn == 1 && $tg == 2 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 2 && $pn == 1 && $tg == 1 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 2 && $pn == 0 && $tg == 2 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 2 && $pn == 0 && $tg == 1 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 1 && $pn == 1 && $tg == 2 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 1 && $pn == 1 && $tg == 1 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 1 && $pn == 0 && $tg == 2 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 1 && $pn == 0 && $tg == 1 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 0 && $pn == 1 && $tg == 2 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 0 && $pn == 1 && $tg == 1 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 0 && $pn == 0 && $tg == 2 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 0 && $pn == 0 && $tg == 1 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else {\n $z[$x] = self::z_tidakDapat($alpha, $x);\n $kondisi[$x] = \"tidak dapat\";\n }\n echo \"IF IPK = {$nilaiIPK[$ip]} AND Penghasilan = {$nilaiPenghasilan[$pn]} AND Jarak = {$nilaiJarak[$jr]} AND Tanggungan = {$nilaiTanggungan[$tg]} AND Rumah = {$nilaiRumah[$rm]} AND Motor = {$nilaiMotor[$mt]} AND Mobil = {$nilaiMobil[$mb]} AND Listrik = {$nilaiListrik[$ls]} AND Air = {$nilaiAir[$ai]} THEN a_predikat = {$alpha[$x]} z = {$z[$x]} kondisi = {$kondisi[$x]} \\n\";\n $x++;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n self::defuzzifikasi($alpha, $z);\n }", "function findSubsquare($inputs) {\n for ($i = count($inputs); $i > 0; $i --) {\n $ans = findSubsquareOfSize($inputs, $i);\n if ($ans) return $ans;\n }\n}", "function solve_two(string $input) : string\n{\n\n $seats = array_map('str_split', xplode_input($input));\n $limit = 5;\n while(true) {\n [$seats, $hasChanged, $occupied] = walk_matrix($seats, $limit, 'visible_neighbors');\n if (!$hasChanged) {\n return sprintf(\"Occupied seats: %d\\n\", $occupied);\n }\n }\n}", "public function task3()\n {\n function solution($N) {\n $count = strlen($N);\n\n if ($count > 1) {\n $number = '1';\n for ($i = 1; $i < $count; $i++) {\n $number .= '0';\n }\n\n return intval($number);\n }\n\n return 0;\n }\n\n $N = 125123;\n// $N = 10;\n// $N = 2;\n\n dd($N, solution($N));\n }", "function checkRecursive($x, $n, $curr_num = 1,$curr_sum = 0)\n{\n // Initialize number of ways to express\n // x as n-th powers of different natural\n // numbers\n $results = 0;\n \n // Calling power of 'i' raised to 'n'\n $p = power($curr_num, $n);\n $p + $curr_sum;\n while ($p + $curr_sum < $x)\n {\n // Recursively check all greater values of i\n $results += checkRecursive($x, $n, $curr_num+1,$p+$curr_sum);\n $curr_num++;\n $p = power($curr_num, $n);\n }\n \n // If sum of powers is equal to x\n // then increase the value of result.\n echo $p + $curr_sum;\n echo \"\\n\";\n if ($p + $curr_sum == $x)\n $results++;\n \n // Return the final result\n return $results;\n}", "function absoluteValuesSumMinimization($a) {\n $all_sum = [];\n for($i = 0; $i < count($a); $i++){\n $sum = 0;\n for($j = 0; $j < count($a); $j++){\n $sum += abs($a[$j] - $a[$i]);\n }\n $all_sum[$a[$i]] = $sum;\n }\n return array_search(min($all_sum), $all_sum);\n}", "function create_puzzle($array_words,$array_table,$PUZ_L,$PUZ_W){\r\n\t$rev_sort = array();\t\r\n\t$output_array = array();\r\n\t$fill_array = array();\r\n\tglobal $g_var;\r\n\t$flag_max_limit = 0;\r\n\t$badwordarray = array();\r\n\t$flag = 0;\r\n\t$array_words_row = count($array_words);\r\n\t\r\n\tif(($array_words_row > $PUZ_L) || ($array_words_row > $PUZ_W))\r\n\t{\r\n\t\techo \"Word list elements are more than length or breadth set.\\n\";\r\n\t\treturn $array_table;\r\n\t}\r\n\t\r\n\tfor($i=1; $i<=$array_words_row; $i++)\r\n\t{\r\n\t\t\tsrand((double)microtime()*1000000);\r\n\t\t\t$random = (rand(1,8));\r\n\t\t\t$rev_sort[$i] = $random;\r\n\t\t\r\n\t}\r\n\trsort($rev_sort);\r\n\tfor($i=1; $i<=$array_words_row; $i++)\r\n\t{\r\n\t\t$j=0;\r\n\t\tif($flag_max_limit == 1)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tif(($rnum) == 1)\r\n\t\t\t{\r\n\t\t\t\tfor($badword=$i;$badword<=$array_words_row;$badword++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$badwordarray[$j] = $array_words[$badword];\r\n\t\t\t\t\t$j++;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfor($y = $t; $y<=$array_words_row;$y++)\r\n\t\t\t{\r\n\t\t\t\tsrand((double)microtime()*1000000);\r\n\t\t\t\t$random = (rand(1,($rnum-1)));\r\n\t\t\t\t$rev_sort[$y-1] = $random;\r\n\t\t\t\t\r\n\t\t\t\t$i = $t;\r\n\t\t\t}\r\n\t\t\trsort($rev_sort);\r\n\t\t\t$flag_max_limit = 0;\r\n\t\t}\r\n\t\t$t = $i;\r\n\t\t$array_words_col = count($array_words[$i]);\r\n\t\tif(($array_words_col > $PUZ_L) || ($array_words_col > $PUZ_W))\r\n\t\t{\t\r\n\t\t\techo \"One of the word list elements are more than length or breadth set.\\n\";\r\n\t\t\treturn $array_table;\r\n\t\t}\r\n\t\t$rnum = $rev_sort[$i-1];\r\n\r\n\t\tswitch($rnum)\r\n\t\t{\r\n\t\t\tcase 1:\t/* Display word From top to bottom on any column*/\r\n\t\t\t\t$var = 1;\r\n\t\t\t\t$start_1 = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\t$i--;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($var >=20 && $start_1 <=$PUZ_W)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$random_num = $start_1;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$start_1 = $start_1 + 1;\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$random_num = generate_random_number(1,$PUZ_W,0);//get random num\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num + $PUZ_W;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var ++;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$fill_random = $random_num;\r\n\t\t\t\t$count = 1;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$count][$random_num] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count + 1;\r\n\t\t\t\t\t$fill_array[$fill_random] = 1;\r\n\t\t\t\t\t$fill_random = $fill_random + $PUZ_W;\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase 2: /*Display word from bottom to top on any column*/\r\n\t\t\t\t$var = 1;\r\n\t\t\t\t$start_1 = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$i--;\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($var >=20 && $start_1 <=$PUZ_W)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$random_num = $start_1;\r\n\t\t\t\t\t\t$start_1 = $start_1 + 1;\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$random_num = generate_random_number(1,$PUZ_W,0);//get random num\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$random_num = $random_num + ($PUZ_L * ($PUZ_W-1));\r\n\t\t\t\t\t\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num - $PUZ_W;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var ++;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$count = $PUZ_L;\r\n\t\t\t\t$width = $PUZ_W - 1;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$count][$random_num] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count - 1;\r\n\t\t\t\t\t$fill_array[$rand + ($PUZ_L * ($width))] = 1;\r\n\t\t\t\t\t$width = $width - 1;\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 3:\t/* Display word from right to left on any row */\r\n\t\t\t$var = 1;\r\n\t\t\t$start_1 = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\t$i--;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($var >=20 && $start_1 <=$PUZ_W)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$random_num = $start_1;\r\n\t\t\t\t\t\t$start_1 = $start_1 + 1;\r\n\t\t\t\t\t\t\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$random_num = generate_random_number(1,$PUZ_W,0);//get random num\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$random_num = $random_num * $PUZ_W;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num - 1;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var++;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$count = $PUZ_W;\r\n\t\t\t\t$width = $rand * $PUZ_W;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$random_num][$count] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count - 1;\r\n\t\t\t\t\t$fill_array[$width] = 1;\r\n\t\t\t\t\t$width = $width - 1;\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase 4:\t/* Display word from left to right on any row */\r\n\t\t\t\t$var = 1;\r\n\t\t\t\t$start_1 = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\t$i--;\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($var >=20 && $start_1 <=$PUZ_W)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$random_num = $start_1;\r\n\t\t\t\t\t\t$start_1 = $start_1 + 1;\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$random_num = generate_random_number(1,$PUZ_W,0);//get random num\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$random_num = (($random_num - 1 ) * $PUZ_W) + 1;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num + 1;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var = $var + 1;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$count = 1;\r\n\t\t\t\t$width = (($rand - 1 ) * $PUZ_W) + 1;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$random_num][$count] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count + 1;\r\n\t\t\t\t\t$fill_array[$width] = 1;\r\n\t\t\t\t\t$width = $width + 1;\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase 5:\t/* Display word from top to bottom diagonally [left to right] */\r\n\t\t\t\t$var = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$random_num = generate_random_number(1,($PUZ_L - ($array_words_col - 1)),0);//get random num\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$random_num = (($random_num - 1 ) * $PUZ_W) + 1;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num + $PUZ_W + 1;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var ++;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$count = 1;\r\n\t\t\t\t$width = (($rand - 1 ) * $PUZ_W) + 1;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$random_num][$count] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count + 1;\r\n\t\t\t\t\t$random_num = $random_num + 1;\r\n\t\t\t\t\t$fill_array[$width] = 1;\r\n\t\t\t\t\t$width = $width + $PUZ_W + 1;\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\r\n\r\n\t\t\tcase 6:\t/* Display word from top to bottom diagonally [right to left] */\r\n\t\t\t\t$var = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$random_num = generate_random_number(1,($PUZ_L - ($array_words_col-1)),0);//get random num\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$random_num = $random_num * $PUZ_W;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num + $PUZ_W - 1;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var ++;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$count = $PUZ_W;\r\n\t\t\t\t$width = $rand * $PUZ_W;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$random_num][$count] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count - 1;\r\n\t\t\t\t\t$random_num = $random_num + 1;\r\n\t\t\t\t\t$fill_array[$width] = 1;\r\n\t\t\t\t\t$width = $width + $PUZ_W - 1;\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 7:\t/*Display word from bottom to top diagonally [left to right]*/\r\n\t\t\t\t$var = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$random_num = generate_random_number($array_words_col,$PUZ_L,0);//get random num\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$random_num = (($random_num - 1 ) * $PUZ_W) + 1;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num - ($PUZ_W - 1);\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var ++;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$count = 1;\r\n\t\t\t\t$width = (($rand - 1 ) * $PUZ_W) + 1;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$random_num][$count] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count + 1;\r\n\t\t\t\t\t$random_num = $random_num - 1;\r\n\t\t\t\t\t$fill_array[$width] = 1;\r\n\t\t\t\t\t$width = $width - ($PUZ_W - 1);\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 8:\t/* Display word from bottom to top diagonally [right to left] */\r\n\t\t\t\t$var = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$random_num = generate_random_number($array_words_col,$PUZ_L,0);//get random num\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$random_num = $random_num * $PUZ_W;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num - ($PUZ_W + 1);\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var ++;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$count = $PUZ_W;\r\n\t\t\t\t$width = $random_num * $PUZ_W;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$random_num][$count] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count - 1;\r\n\t\t\t\t\t$random_num = $random_num - 1;\r\n\t\t\t\t\t$fill_array[$width] = 1;\r\n\t\t\t\t\t$width = $width - ($PUZ_W + 1);\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t// $\r\n\treturn array($array_table,$badwordarray);;\r\n}", "function CountSumOfDepthIncreases($data): int{\n $countSumOfDepthIncreases=0;\n for ($i = 3; $i < count($data); $i++){\n if(($data[$i-3]+$data[$i-2]+$data[$i-1])<($data[$i-2]+$data[$i-1]+$data[$i])){\n $countSumOfDepthIncreases++;\n }\n }\n return $countSumOfDepthIncreases;\n}", "function nBy3NumberV3($arr) {\n if (empty($arr)) {\n return;\n }\n $limit = ceil(sizeof($arr)/3);\n // create temp array of 3-1 size\n $temp[] = new ElementCount();\n $temp[] = new ElementCount();\n \n // loop through array to populate temp array\n for ($i=0; $i < sizeof($arr); $i++) {\n // if arr[i] already present in either elecount, increment count\n for ($j=0; $j < sizeof($temp); $j++) { \n if ($arr[$i] == $temp[$j]->element) {\n $temp[$j]->count++;\n break;\n }\n }\n // arr[i] not present in temp array\n if ($j == sizeof($temp)) {\n // if there's empty position, put this element in the position and set\n // count to 1\n for ($k=0; $k < sizeof($temp); $k++) { \n if (is_null($temp[$k]->element)) {\n $temp[$k]->element = $arr[$i];\n $temp[$k]->count++;\n break;\n }\n }\n // all positions are filled, decrement all counts by 1\n if ($k == sizeof($temp)) {\n for ($m=0; $m < sizeof($temp); $m++) { \n $temp[$m]->count--;\n if ($temp[$m]->count == 0) {\n $temp[$m]->element = NULL;\n }\n }\n }\n }\n }\n\n // step 3, find the actual count of the elements in temp array\n $result = [];\n for ($i=0; $i < sizeof($temp); $i++) { \n $count = 0;\n for ($j=0; $j < sizeof($arr); $j++) { \n if ($arr[$j] == $temp[$i]->element) {\n $count++;\n }\n if ($count >= $limit) {\n $result[] = $arr[$j];\n break;\n }\n } \n }\n return $result;\n}", "function duplication2(Array $array) {\n if (empty($array)) {\n return FALSE;\n }\n foreach ($array as $key => $val) {\n if ($key != $val) {\n // not in 0 ~ n-1\n if (!isset($array[ $val ])) {\n return FALSE;\n }\n if ($val == $array[ $val ]) {\n return $val;\n } else {\n $tmp = $array[ $val ];\n $array[ $val ] = $val;\n $array[ $key ] = $tmp;\n }\n }\n }\n\n return 'no duplicate numbers.';\n}", "public function getMutualFriends($user_to_check)\n{\n\t//then function start which get all it profile user friend array \n\t//then second start which get the those user friend array which visit\n\t//then it compare if same find mutual freind increase or decrease according to condition\n\n $mutualFriends = 0;\n $user_array = $this->user['friend_array'];//all login friends store in user_array \n $user_array_explode = explode(\",\",$user_array);\n\n $query = mysqli_query($this->con,\"SELECT friend_array FROM users WHERE username='$user_to_check'\");\n $row = mysqli_fetch_array($query);\n\n $user_to_check_array = $row['friend_array'];\n\n $user_to_check_array_explode = explode(\",\", $user_to_check_array);\n\n foreach($user_array_explode as $i)\n {\n\t\t \tforeach ($user_to_check_array_explode as $j)\n\t\t{\n\t\t\t\t if($i == $j && $i != \"\"){\n\t\t\t\t \t$mutualFriends++;\n\t\t\t\t }\n\n} \n\n }\n return $mutualFriends;\n\n\n\n}", "function findIt(array $seq){\n//make an associative array for each entry but..\n//if the key exists, then increase the count of that array by one\n\n//for each thing, see if a key exists\n//if it does then add to it,\n//else make a new key\n $keyArray = Array();\n\n for($i=0; $i<count($seq); $i++){\n \n if(array_key_exists($seq[$i], $keyArray)){\n $keyArray[$seq[$i]] += 1;\n }\n else{\n $keyArray[$seq[$i]] = 1;\n }\n }\n\n// return $keyArray;\n\n foreach($keyArray as $entry => $value){\n\n if($value % 2 != 0){\n return $entry;\n\n }\n }\n\n}", "function dicho($tab = NULL, $find = NULL)\n{\n $a = 0;\n $z = sizeof($tab);\n $r = 0;\n while(sizeof($tab) > 1 && $r != 1 && $z - $a >= 1)\n {\n $mid = ($a + $z) / 2;\n if ($tab[$mid] == $find)\n {\n $r = 1;\n }\n else\n if($tab[$mid] > $find)\n $z = $mid;\n else\n $a = $mid;\n }\n if (sizeof($tab) == 1 && $tab[$a] == $find)\n {\n $r = 1;\n }\n return $r;\n}", "function MatrixChainOrder($p, $n) \n{\n\n// $m[][] = array($n, $n); \n $m = tableInit($m,$n,$n);\n printTable($m,$n,$n);\n\n /* m[i, j] = Minimum number of scalar \n\n multiplications needed to compute the \n\n matrix A[i]A[i+1]...A[j] = A[i..j] where \n\n dimension of A[i] is p[i-1] x p[i] */\n\n \n\n // cost is zero when multiplying one matrix. \n\n for ($i = 1; $i < $n; $i++) \n\n $m[$i][$i] = 0; \n\n \n \n // L is chain length. \n\n for ($L = 2; $L < $n; $L++) \n\n { \n\n for ($i = 1; $i < $n - $L + 1; $i++) \n\n { \n\n $j = $i + $L - 1; \n\n if($j == $n) \n\n continue; \n\n $m[$i][$j] = PHP_INT_MAX; \n\n for ($k = $i; $k <= $j - 1; $k++) \n\n { \n\n // q = cost/scalar multiplications \n\n $q = $m[$i][$k] + $m[$k + 1][$j] + \n\n $p[$i - 1] * $p[$k] * $p[$j]; \n\n if ($q < $m[$i][$j]) \n\n $m[$i][$j] = $q; \n\n } \n\n } \n\n } \n\n \n\n return $m[1][$n-1]; \n}", "function jc1($n)\n{\n\t$sum=1;\n\tfor($i=1;$i<=$n;$i++)\n\t{\n\t\t$sum=$sum*$i;\n\t}\n\techo $sum;\n}", "function check_for_word($letters_hashmap,$word){\n /// found letters\n $found_letters=0;\n ///visited cordinates\n $visited=[];\n //iterate in the word letters searching for them on the hash table\n $words_count=strlen($word);\n ///\n $stop=false;\n ///start from first letter \n $the_temp_letter=$word[0];\n \n while($found_letters<$words_count && !$stop){\n//serch for the letter on the hash table\n $the_letter=$the_temp_letter;\n \n \n\n if(array_key_exists($the_letter,$letters_hashmap)\n && count(array_diff(str_split($letters_hashmap[$the_letter],2),$visited))>=1\n ){\n \n //the letter is found on the hsah table\n //let us get how many times\n ///the last number was making error in the last letter to add to hash table\n $cordenates=$letters_hashmap[$the_letter];\n $cordenates = str_replace(' ', '', $cordenates);\n \n \n \n \n\n \n ///lets iterate throw the cordenates and check if it's available\n\n \n for($j=0;$j<strlen($cordenates);$j+=2){\n ///assign the first cordinates to start the search\n \n \n \n \n if($found_letters==0 && !in_array($cordenates[$j].$cordenates[$j+1],$visited)){\n $x_cord=$cordenates[$j];\n $y_cord=$cordenates[$j+1];\n array_push($visited,$x_cord.$y_cord);\n $found_letters++;\n $the_temp_letter=$word[$found_letters];\n break;\n \n\n }\n\n\n \n ///we are not on the first letter so we need compare the second letter cord with our cords\n else{\n \n $nexX=$cordenates[$j];\n $newY=$cordenates[$j+1];\n\n\n \n \n\n\n if(($x_cord-$newY+$y_cord-$nexX)<=1 && !in_array($j.$j+1,$visited)){\n \n\n ///the new position\n $x_cord=$cordenates[$j];\n $y_cord=$cordenates[$j+1];\n array_push($visited,$x_cord.$y_cord);\n\n \n \n $found_letters++;\n ///if we reached the last letter and found it then we should stop the loop\n if($found_letters==$words_count){\n \n $stop= true;\n \n break;\n \n }\n \n \n $the_temp_letter=$word[$found_letters];\n \n break;\n \n \n \n\n\n }else{\n\n if($j==strlen($cordenates)-1){\n $found_letters--;\n\n $the_temp_letter=$word[$found_letters];\n //\n \n array_push($visited,$cordenates[$j].$cordenates[$j+1]);\n $stop=true;\n break;\n }\n \n \n $the_temp_letter=$word[$found_letters];\n //array_push($visited,$cordenates[$j].$cordenates[$j+1]);\n \n // break;\n\n \n\n \n \n\n }\n }\n\n\n }\n \n \n }\n //so the letter is not found on the matrix so the word cant be formated\n else{\n $stop= true;\n \n \n }\n \n\n }\n \n //return $found_letters;\n if($found_letters==$words_count){\n return $found_letters;\n }else{\n return false;\n }\n\n}", "function updatePossibleSquares($possibleSquares, $possibleSquares2){\n for($i=0;$i<count($possibleSquares);$i++){\n list($r1, $c1, $r2, $c2) = $possibleSquares[$i];\n for($j=0;$j<count($possibleSquares2);$j++){\n list($pr1, $pc1, $pr2, $pc2) = $possibleSquares2[$j];\n if((($c1 < $pc2 && $pc2 <= $c2) || ($c1 <= $pc1 && $pc1 < $c2) || ($pc1 <= $c1 && $c2 <= $pc2))\n && (($r1 <= $pr2 && $pr2 <= $r2 + 1) || ($r1 <= $pr1 && $pr1 <= $r2 + 1) || ($pr1 <= $r1 + 1 && $r2 <= $pr2 + 1))\n ){\n $column1 = $c1;\n $column2 = $c2;\n if($c2>$pc2){\n $column2 = $pc2;\n }\n if($c1<$pc1){\n $column1 = $pc1;\n }\n // l'area del quadrato nuovo > di quella vecchia\n if(($pr2-$r1+1)*($column2-$column1+1) > ($r2-$r1+1)*($c2-$c1+1)){\n // aggiornamento possibleSquares\n $possibleSquares[$i] = array($r1, $column1, $pr2, $column2);\n }\n }\n }\n }\n return $possibleSquares;\n}", "function nBy3NumberV2($arr) {\n if (empty($arr)) {\n return;\n }\n mergeSort($arr, 0, sizeof($arr)-1);\n $limit = ceil(sizeof($arr) / 3);\n $count = 1;\n for ($i=1; $i < sizeof($arr); $i++) { \n if ($arr[$i] == $arr[$i-1]) {\n $count++;\n } else {\n $count = 1;\n }\n if ($count >= $limit) {\n return $arr[$i];\n }\n }\n return;\n}", "function Motvalide($chaine ) {\n\n$lettres=array('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');\n$lettresM=array('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');\n$v=CompterNombreElement($lettres);\n$t=false;\n$nbr=CompteNombreCaractere($chaine);\nif ($nbr>20) {\n\t$t=false;\n}\n else {\n for ($i=0; $i <$nbr; $i++) \n { \n \t for ($j=0; $j <$v ; $j++) \n \t { \n \t if ($chaine[$i]==$lettres[$j] or $chaine[$i]==$lettresM[$j]) \n\t \t {\n\t \t\t $t=true;\n\t \t\t break;\n\t \t }\t \n\t \t if ($j==$v-1) {\n\t \t \t$t=false;\n\t \t \tbreak;\n\t \t }\n\n \t }\n \t if ($t==false) \n\t \t {\n\t \t break;\n \t } \n }\t\n }\n \nreturn $t;\n}", "function ttt($n){\n $s = [];\n $sum = 0;\n $ln = 0;\n $rn = 0;\n $fa = 0;\n $f = \"\";\n for($i=1;$i<$n;$i++){\n if ($i > 1) {\n $r = $l;\n }\n $l = $i*$i;\n if ($i == 1){\n $f = \"-\";\n $sum += $l;\n }else{\n $f = $i % 2 == 0 ? \"-\" : \"+\";\n if ($i % 2 == 0){\n $sum += $l+$r;\n }else{\n $sum += $l-$r;\n }\n }\n $s[] = \"($i*$i) $f\";\n \n \n \n }\n echo implode($s,\"*\").\"=\".$sum;\n return $sum;\n}", "function cheepestCost($n, $m){\n\t\t\t\treturn cost($n,$m);\n\t\t\t}", "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 gl_dijagonala_sve_jedinice($matrica)\n{\n\t// echo ( napravi_tabelu( $matrica ) );\n\t/*\t\n\tif($matrica[$r][$r] != 1)\n\t{\n\t\t$x = $matrica[$r][$r];\n\t\t// print_r($matrica[$r][$r]); echo \", \";\n\t\t// exit();\n\t\t\n\t\tfor($k = 0; $k < count($matrica) + 1; $k++)\n\t\t{\n\t\t\tif($matrica[$r][$k] != 0)\n\t\t\t{\n\t\t\t\t$matrica[$r][$k] = $matrica[$r][$k] / $x;\n\t\t\t}\n\t\t}\n\t}*/\n\t\n\t\n\tfor($r = 0; $r < count($matrica); $r++)\n\t{\n\t\tif($matrica[$r][$r] != 1)\n\t\t{\n\t\t\t$x = $matrica[$r][$r];\n\t\t\t// print_r($matrica[$r][$r]); echo \", \";\n\t\t\t// exit();\n\n\t\t\t// podela citavog reda matrice sa vrednoscu njegove glavne idjagonale\n\t\t\tfor($k = 0; $k < count($matrica) + 1; $k++)\n\t\t\t{\n\t\t\t\tif($matrica[$r][$k] != 0)\n\t\t\t\t{\n\t\t\t\t\t$matrica[$r][$k] = $matrica[$r][$k] / $x;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn $matrica;\n}", "function fu_determinization(&$states, &$rules, &$f_states, $i_state, $alphabet)\n{\n\tfu_eps($states, $rules, $f_states); // odstranim epsilon prechody\n\t\n\t$states_new = array($i_state); // stavy pro algoritmus obsahujici zezacaktu pouze pocatecni\n\t$rules_det = array(); // nove pravidla\n\t$states_det = array(); // nove stavy\n\t$f_states_det = array(); // nove finalni stavy\n\t\n\t$meta = array(); // pole pro ukladani stavu ze kterych jsou slozene nove vznikle stavy\n\t\n\tdo\n\t{\n\t\t$c_state = array_pop($states_new); // aktualni stav\n\t\t\n\t\tarray_push($states_det,$c_state); // pridam do stavu\n\t\t\n\t\tforeach($alphabet as $a) // pro kazdy znak z abecedy\n\t\t{\n\t\t\t$combined_states = array(); // stavy ze kterych vznikne novy stav\n\t\t\t$combined_state; // promenna pro novy stav\n\t\t\t\n\t\t\tif(array_key_exists($c_state,$meta)) // kontrola klice, zda stav neni nove vznikly mezistav\n\t\t\t{\n\t\t\t\tforeach($meta[$c_state] as $next_state)\n\t\t\t\t{\n\t\t\t\t\tforeach($rules as $rule)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif($next_state == $rule->from && $a == $rule->symbol)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tadd_state($combined_states,$rule->to);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse // pokud se jedna o puvodni stav\n\t\t\t{\n\t\t\t\tforeach($rules as $rule)\n\t\t\t\t\t{\n\t\t\t\t\t\tif($c_state == $rule->from && $a == $rule->symbol)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tadd_state($combined_states,$rule->to);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(count($combined_states)) // pokud byl nalezen alespon jeden stav\n\t\t\t{\n\t\t\t\t$first = true;\n\t\t\t\t$new_rule = new rule();\n\t\t\t\tasort($combined_states); // serazeni stavu, pro lexikograficke spojeni\n\t\t\t\t\n\t\t\t\tforeach ($combined_states as $c_s) // jednotlive stavy spojim a pridam \"_\"\n\t\t\t\t{\n\t\t\t\t\tif($first)\n\t\t\t\t\t{\n\t\t\t\t\t\t$combined_state = $c_s;\n\t\t\t\t\t\t$first = false;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$combined_state .= \"_\";\n\t\t\t\t\t$combined_state .= $c_s;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$new_rule->from = $c_state;\n\t\t\t\t$new_rule->symbol = $a;\n\t\t\t\t$new_rule->to = $combined_state;\n\t\t\t\t\n\t\t\t\tadd_rule($rules_det,$new_rule); // pridani noveho pravidla obsahujici nove vznikly stav\n\t\t\t}\n\t\t\t\n\t\t\tif($combined_state) // pri existenci stavu\n\t\t\t{\n\t\t\t\t$found = false;\n\t\t\t\t\n\t\t\t\tforeach($states_det as $state_det) // kontrola zda-li jiz neexistuje\n\t\t\t\t{\n\t\t\t\t\tif($state_det == $combined_state)\n\t\t\t\t\t{\n\t\t\t\t\t\t$found = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(!$found && count($combined_states)) // pokud se jedna o nove vznikly mezistav\n\t\t\t\t{\n\t\t\t\t\tadd_state($states_new,$combined_state); // pridam jej\n\t\t\t\t\t$meta[$combined_state] = $combined_states; // do pole ulozim stavy ze kterych vznikl a samotny stav pouziji jako klic\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tforeach($f_states as $f_state) // pridani finalniho stavu\n\t\t{\n\t\t\tif(array_key_exists($c_state,$meta)) // v pripade noveho mezistavu\n\t\t\t{\n\t\t\t\tforeach($meta[$c_state] as $next_state) // kontrola vsech stavu ze kterych vznikl\n\t\t\t\t{\n\t\t\t\t\tif($next_state == $f_state)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tadd_state($f_states_det,$c_state);\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telseif($c_state == $f_state)\n\t\t\t{\n\t\t\t\tadd_state($f_states_det,$c_state);\n\t\t\t}\n\t\t}\n\t\t\n\t}while(count($states_new));\n\t\n\t// prepsani starych stavu\n\t\n\t$states = $states_det;\n\t$f_states = $f_states_det;\n\t$rules = $rules_det;\n}", "function findNeighboorKeys($size, $y, $x)\n {\n $result = [];\n if ($y - 1 >= 0) {\n array_push($result, [$y - 1, $x]);\n if ($x == $y) array_push($result, [$y - 1, $x - 1]);\n }\n\n if ($y + 1 < $size) {\n array_push($result, [$y + 1, $x]);\n if ($x == $y) array_push($result, [$y + 1, $x + 1]);\n }\n if ($x - 1 >= 0) array_push($result, [$y, $x - 1]);\n if ($x + 1 < $size) array_push($result, [$y, $x + 1]);\n return $result;\n }", "function sum_numbers($array, $target)\n{\n$count = count($array) - 2;\n$result=[];\nfor ($i = 0; $i < $count; $i++) {\n if ($array[$i] + $array[$i+1] + $array[$i+2] == $target) {\n array_push($result, \"{$array[$i]} + {$array[$i+1]} + {$array[$i+2]} = $target\");\n }\n}\nreturn $result;\n}", "function findCondorcet($filename) {\n\t\t$data = json_decode(file_get_contents($filename));\n\t\t$cands = $data[0];\n\t\tnatsort($cands); \n\n\t\t$pairs = array();\n\t\tforeach ($cands as $c) {\n\t\t\t\t$new_cands = $cands;\n\t\t\t\tunset($new_cands[array_search($c,$new_cands)]);\n\t\t\t\tforeach ($new_cands as $nc) {\n\t\t\t\t\t\t$pairs[$c][$nc] = 0;\n\t\t\t\t}\n\t\t}\n\n\t\tforeach ($data as $ballot) {\n\t\t\t\tforeach ($cands as $cand1) {\n\t\t\t\t\t\tforeach ($cands as $cand2) {\n\t\t\t\t\t\t\t\tif ($cand1 != $cand2) {\n\t\t\t\t\t\t\t\t\t\t$cand1rank = array_search($cand1,$ballot);\n\t\t\t\t\t\t\t\t\t\t$cand2rank = array_search($cand2,$ballot);\n\t\t\t\t\t\t\t\t\t\tif ($cand1rank < $cand2rank) {\n\t\t\t\t\t\t\t\t\t\t\t\t$pairs[$cand1][$cand2] += 1;\n\t\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}\n\t\t\t\t}\n\t\t}\n\n\t\t$tallies = array();\n\t\tforeach ($cands as $c1) {\n\t\t\t\tforeach ($cands as $c2) {\n\t\t\t\t\t\tif ($c1 != $c2) {\n\t\t\t\t\t\t\t\tif ($pairs[$c1][$c2] > $pairs[$c2][$c1]) {\n\t\t\t\t\t\t\t\t\t\t$tallies[$c1]['beat'][] = $c2;\n\t\t\t\t\t\t\t\t\t\t$tallies[$c2]['lost_to'][] = $c1;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ($pairs[$c1][$c2] < $pairs[$c2][$c1]) {\n\t\t\t\t\t\t\t\t\t\t//\tprint \"$c2 beats $c1\\n\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ($pairs[$c1][$c2] == $pairs[$c2][$c1]) {\n\t\t\t\t\t\t\t\t\t\t$tallies[$c2]['tied'][] = $c1;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\n\t\tksort($tallies);\n\n\t\t//print_r($tallies);\n\n\t\t$has_condorcet = 0;\n\t\tforeach ($cands as $cand) {\n\t\t\t\tif (!isset($tallies[$cand]['lost_to']) && !isset($tallies[$cand]['tied'])) {\n\t\t\t\t\t\tprint \"$cand is Condorcet Winner in $filename\\n\";\n\t\t\t\t\t\t$has_condorcet = 1;\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t$approval_winners = findApproval($filename);\n\t\t\t\t\t\tif (1 == count($approval_winners)) {\n\t\t\t\t\t\tprint $approval_winners[0].\" is Approval Winner\\n\";\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tprint \"Approval Winners:\";\n\t\t\t\t\t\t\t\tprint_r($approval_winners);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tprint \"\\n\\n\";\n\t\t\t\t\t\t */\n\t\t\t\t}\n\t\t}\n\n\t\tif (!$has_condorcet) {\n\t\t\t\t//print \"NO Condorcet Winner in $filename\\n\";\n\t\t}\n}", "function splitItemsForFormNoZeroQ($items) {\r\n /*\r\n sort by denumire first\r\n */\r\n foreach ($items as $catalog_denumire => $produse) {\r\n $sort_flag = 1;\r\n while ($sort_flag == 1) {\r\n $sort_flag = 0;\r\n for ($i = 1; $i < count($produse); $i++) {\r\n if (($items[$catalog_denumire][$i-1]['denumire'] . $items[$catalog_denumire][$i-1]['pret']) > ($items[$catalog_denumire][$i]['denumire'] . $items[$catalog_denumire][$i]['pret'])) {\r\n $sort_flag = 1;\r\n $x = $items[$catalog_denumire][$i];\r\n $items[$catalog_denumire][$i] = $items[$catalog_denumire][$i-1];\r\n $items[$catalog_denumire][$i-1] = $x;\r\n }\r\n }\r\n } \r\n }\r\n //end\r\n $list = array();\r\n foreach($items as $catalog_denumire => $produse) {\r\n $categorii_grupare_colectiva = getCategoriiGrupareOrder($catalog_denumire, 'comuna', 'importanta');\r\n foreach($produse as $produs) {\r\n if ($produs['cantitate'] != 0) {\r\n if (in_array($produs['categorie_denumire'], $categorii_grupare_colectiva)) {\r\n $list[$catalog_denumire]['comuna'][$produs['um']][] = $produs; \r\n }\r\n else {\r\n $list[$catalog_denumire]['separata'][$produs['categorie_denumire']][$produs['um']][] = $produs; \r\n }\r\n }\r\n }\r\n }\r\n return $list;\r\n }", "function get_table_kriteria($list_kriteria){\n require('connection.php');\n $arr_crit = array();\n for ($i=0; $i < sizeof($list_kriteria); $i++) { \n for ($j=0; $j < sizeof($list_kriteria); $j++) { \n $sql2 = \"SELECT k.nama_kriteria as kriteria_1, k2.nama_kriteria as kriteria_2, kb.bobot FROM kriteria_bobot kb INNER JOIN kriteria k on kb.kriteria_1 = k.idKriteria INNER JOIN kriteria k2 on kb.kriteria_2 = k2.idKriteria\";\n $result2 = $conn->query($sql2);\n if ($result2->num_rows > 0) {\t\t\n while ($obj = $result2->fetch_assoc()) {\n if($obj['kriteria_1'].'-'.$obj['kriteria_2'] == $list_kriteria[$i].'-'.$list_kriteria[$j]){ \n $arr_crit[$i][$j] = $obj['bobot']; \n }\n else if($obj['kriteria_1'].'-'.$obj['kriteria_2'] == $list_kriteria[$j].'-'.$list_kriteria[$i] ){\n $hasil = 1/$obj['bobot']; \n $arr_crit[$i][$j] = $hasil; \n } \n }\n }\n }\n }\n \n return $arr_crit;\n}", "function times_rotated_circular_array($array,$x){\r\n\t// pivot wud be less than next and previous\r\n\t// 4 cases to handle \r\n\t// case 1: if a[start]< a [end] return start\r\n\t// case 2 : if mid < previous and mid < next return mid\r\n\t// case 3 : if mid < last,do not search in this delete segment move to left segement\r\n\t// case 4 : if mid > last,search in right segment\r\n\r\n\r\n\t$start=0;\r\n\t$end=count($array)-1;\r\n\r\n\twhile($start<=$end){\r\n\t\t\r\n\t\t\r\n\t\t$mid=ceil(($start+$end)/2);\r\necho \"mid=\".$mid.\"\\n\";\r\n\t\tif($array[$start]<=$array[$end]){\r\n\t\t\treturn $start;\r\n\t\t}\r\n\t\t$len=count($array);\r\n\r\n\t\t$next=($mid+1)%$len;\r\n\t\t$prev=($mid+$len-1)%$len;\r\n\t\r\n\t\tif($array[$mid]<=$array[$next] && $array[$mid]<=$array[$prev]){\r\n\t\t\treturn $mid;\r\n\t\t}else if($array[$mid]<$array[$end])\r\n\t\t\t$end=$mid-1;\r\n\t\telse if($array[$mid]>$array[$start])\r\n\t\t\t$start=$mid+1;\r\n\t\t\r\n\t}\r\n\r\n\techo \"no of time=\".$mid;\r\n}", "function promedio_general($vector){ \n $promedio=0;\n foreach ($vector as $key => $value) {\n foreach ($value as $c => $n) {\n $promedio=$promedio+$n;\n }\n }\n return ($promedio/10);\n }", "abstract public function solve();", "public function run()\n {\n $data = [\n \t1 => [2 => ['nilai' => 450000], 8 => ['nilai' => 65000000], 11 => ['nilai' => 5], 17 => ['nilai' => 10000000], 22 => ['nilai' => 10], ], \n\t\t\t2 => [2 => ['nilai' => 400000], 8 => ['nilai' => 65000000], 11 => ['nilai' => 6], 17 => ['nilai' => 10000000], 22 => ['nilai' => 10], ], \n\t\t\t3 => [2 => ['nilai' => 700000], 8 => ['nilai' => 70000000], 11 => ['nilai' => 7], 17 => ['nilai' => 10000000], 22 => ['nilai' => 10], ], \n\t\t\t4 => [2 => ['nilai' => 650000], 8 => ['nilai' => 80000000], 12 => ['nilai' => 10], 18 => ['nilai' => 20000000], 23 => ['nilai' => 20], ], \n\t\t\t5 => [2 => ['nilai' => 500000], 8 => ['nilai' => 80000000], 12 => ['nilai' => 10], 17 => ['nilai' => 10000000], 23 => ['nilai' => 20], ], \n\t\t\t6 => [2 => ['nilai' => 400000], 8 => ['nilai' => 80000000], 13 => ['nilai' => 15], 17 => ['nilai' => 10000000], 22 => ['nilai' => 10], ], \n\t\t\t7 => [2 => ['nilai' => 500000], 9 => ['nilai' => 100000000], 13 => ['nilai' => 20], 17 => ['nilai' => 10000000], 24 => ['nilai' => 25], ], \n\t\t\t8 => [2 => ['nilai' => 500000], 8 => ['nilai' => 95000000], 13 => ['nilai' => 20], 18 => ['nilai' => 20000000], 22 => ['nilai' => 10], ], \n\t\t\t9 => [2 => ['nilai' => 400000], 8 => ['nilai' => 65000000], 12 => ['nilai' => 10], 18 => ['nilai' => 20000000], 22 => ['nilai' => 10], ], \n\t\t\t10 => [2 => ['nilai' => 550000], 8 => ['nilai' => 80000000], 11 => ['nilai' => 5], 17 => ['nilai' => 15000000], 23 => ['nilai' => 15], ], \n\t\t\t11 => [2 => ['nilai' => 450000], 8 => ['nilai' => 90000000], 11 => ['nilai' => 5], 18 => ['nilai' => 20000000], 22 => ['nilai' => 10], ], \n\t\t\t12 => [3 => ['nilai' => 750000], 8 => ['nilai' => 95000000], 11 => ['nilai' => 5], 18 => ['nilai' => 20000000], 23 => ['nilai' => 20], ], \n\t\t\t13 => [2 => ['nilai' => 400000], 7 => ['nilai' => 10000000], 11 => ['nilai' => 7], 17 => ['nilai' => 10000000], 23 => ['nilai' => 15], ], \n\t\t\t14 => [2 => ['nilai' => 400000], 8 => ['nilai' => 65000000], 11 => ['nilai' => 8], 18 => ['nilai' => 20000000], 23 => ['nilai' => 15], ], \n\t\t\t15 => [2 => ['nilai' => 600000], 8 => ['nilai' => 75000000], 11 => ['nilai' => 9], 17 => ['nilai' => 15000000], 23 => ['nilai' => 15], ], \n\t\t\t16 => [2 => ['nilai' => 500000], 8 => ['nilai' => 68000000], 13 => ['nilai' => 15], 17 => ['nilai' => 15000000], 22 => ['nilai' => 10], ], \n\t\t\t17 => [2 => ['nilai' => 400000], 8 => ['nilai' => 80000000], 13 => ['nilai' => 15], 17 => ['nilai' => 15000000], 22 => ['nilai' => 10], ], \n\t\t\t18 => [2 => ['nilai' => 400000], 6 => ['nilai' => 9500000], 12 => ['nilai' => 10], 17 => ['nilai' => 15000000], 22 => ['nilai' => 10], ], \n\t\t\t19 => [2 => ['nilai' => 400000], 8 => ['nilai' => 70000000], 12 => ['nilai' => 10], 18 => ['nilai' => 20000000], 22 => ['nilai' => 10], ], \n\t\t\t20 => [3 => ['nilai' => 750000], 8 => ['nilai' => 80000000], 12 => ['nilai' => 10], 18 => ['nilai' => 20000000], 23 => ['nilai' => 15], ], \n\t\t\t21 => [3 => ['nilai' => 750000], 8 => ['nilai' => 90000000], 12 => ['nilai' => 10], 17 => ['nilai' => 10000000], 23 => ['nilai' => 15], ], \n\t\t\t22 => [2 => ['nilai' => 450000], 8 => ['nilai' => 95000000], 12 => ['nilai' => 10], 18 => ['nilai' => 20000000], 23 => ['nilai' => 20], ], \n\t\t\t23 => [2 => ['nilai' => 400000], 7 => ['nilai' => 10000000], 12 => ['nilai' => 10], 18 => ['nilai' => 20000000], 23 => ['nilai' => 20], ], \n\t\t\t24 => [2 => ['nilai' => 500000], 7 => ['nilai' => 10000000], 13 => ['nilai' => 15], 17 => ['nilai' => 15000000], 23 => ['nilai' => 20], ], \n\t\t\t25 => [2 => ['nilai' => 400000], 8 => ['nilai' => 65000000], 13 => ['nilai' => 15], 17 => ['nilai' => 15000000], 23 => ['nilai' => 15], ], \n\t\t\t26 => [2 => ['nilai' => 400000], 8 => ['nilai' => 75000000], 13 => ['nilai' => 20], 17 => ['nilai' => 15000000], 23 => ['nilai' => 15], ], \n\t\t\t27 => [2 => ['nilai' => 500000], 7 => ['nilai' => 10000000], 13 => ['nilai' => 20], 17 => ['nilai' => 15000000], 22 => ['nilai' => 10], ], \n\t\t\t28 => [2 => ['nilai' => 600000], 8 => ['nilai' => 80000000], 13 => ['nilai' => 15], 18 => ['nilai' => 20000000], 23 => ['nilai' => 15], ], \n\t\t\t29 => [2 => ['nilai' => 400000], 8 => ['nilai' => 95000000], 13 => ['nilai' => 15], 18 => ['nilai' => 20000000], 23 => ['nilai' => 15], ], \n\t\t\t30 => [2 => ['nilai' => 450000], 8 => ['nilai' => 65000000], 12 => ['nilai' => 10], 17 => ['nilai' => 10000000], 22 => ['nilai' => 10], ], \n\t\t\t31 => [2 => ['nilai' => 450000], 8 => ['nilai' => 80000000], 13 => ['nilai' => 15], 18 => ['nilai' => 20000000], 23 => ['nilai' => 15], ], \n\t\t\t32 => [2 => ['nilai' => 400000], 8 => ['nilai' => 90000000], 13 => ['nilai' => 15], 17 => ['nilai' => 15000000], 23 => ['nilai' => 15], ], \n\t\t\t33 => [2 => ['nilai' => 400000], 8 => ['nilai' => 75000000], 12 => ['nilai' => 10], 17 => ['nilai' => 15000000], 23 => ['nilai' => 20], ], \n\t\t\t34 => [2 => ['nilai' => 400000], 8 => ['nilai' => 68000000], 13 => ['nilai' => 15], 18 => ['nilai' => 20000000], 23 => ['nilai' => 20], ], \n\t\t\t35 => [2 => ['nilai' => 450000], 8 => ['nilai' => 80000000], 12 => ['nilai' => 12], 17 => ['nilai' => 15000000], 23 => ['nilai' => 15], ], \n\t\t\t36 => [3 => ['nilai' => 750000], 9 => ['nilai' => 100000000], 12 => ['nilai' => 10], 17 => ['nilai' => 15000000], 23 => ['nilai' => 15], ], \n\t\t\t37 => [3 => ['nilai' => 750000], 8 => ['nilai' => 65000000], 12 => ['nilai' => 10], 17 => ['nilai' => 15000000], 22 => ['nilai' => 10], ], \n\t\t\t38 => [3 => ['nilai' => 750000], 8 => ['nilai' => 75000000], 12 => ['nilai' => 10], 17 => ['nilai' => 15000000], 23 => ['nilai' => 15], ], \n\t\t\t39 => [1 => ['nilai' => 350000], 8 => ['nilai' => 68000000], 12 => ['nilai' => 10], 18 => ['nilai' => 20000000], 23 => ['nilai' => 15], ], \n\t\t\t40 => [1 => ['nilai' => 250000], 8 => ['nilai' => 80000000], 13 => ['nilai' => 20], 18 => ['nilai' => 20000000], 22 => ['nilai' => 10], ], \n\t\t\t41 => [2 => ['nilai' => 650000], 8 => ['nilai' => 95000000], 13 => ['nilai' => 20], 18 => ['nilai' => 20000000], 22 => ['nilai' => 10], ], \n\t\t\t42 => [3 => ['nilai' => 850000], 8 => ['nilai' => 65000000], 13 => ['nilai' => 20], 17 => ['nilai' => 15000000], 23 => ['nilai' => 15], ], \n\t\t\t43 => [2 => ['nilai' => 400000], 8 => ['nilai' => 80000000], 11 => ['nilai' => 5], 17 => ['nilai' => 15000000], 23 => ['nilai' => 15], ], \n ];\n\n for ($i=1; $i < 44; $i++) { \n \t$p = Produk::findOrFail($i);\n \t$p->ranges()->attach($data[$i]);\n }\n }", "function findLargestPalindromeProduct($maxComponent){\n $largest = [0,0]; //this will store our working largest palindrome products\n for($i = 0; $i < $maxComponent; $i++){ //try every possible first number\n for($j = 0; $j < $maxComponent; $j++){ //try every possible 2nd number\n if(checkPalindrome($j*$i)){ //if the product is a palindrome\n if($largest[0]*$largest[1] < $i*$j){ //if the product is larger than our previous best\n $largest = [$i, $j]; //then update the working largest copy\n }\n }\n }\n }\n return($largest); //return the array containing the 2 numbers used to create the largest palindrome\n}", "function combinationUtil($words, $n, $r, $index, $data, $i) { \n global $answers;\n global $dbhandle;\n global $lengths;\n global $result;\n // Current cobination \n // is ready, print it \n if ($index == $r) { \n $currentWord = \"\";\n for ($j = 0; $j < $r; $j++) {\n $currentWord = $currentWord . $data[$j];\n }\n\n $statement = $dbhandle->prepare(\"SELECT * FROM racks WHERE rack=?\");\n $statement->execute([$currentWord]);\n $subrack = $statement->fetchAll(PDO::FETCH_ASSOC);\n\n if($subrack && !in_array($currentWord, $result)) {\n $statement = $dbhandle->prepare(\"SELECT * FROM racks WHERE rack=?\");\n $statement->execute([$currentWord]);\n $subrack = $statement->fetchAll(PDO::FETCH_ASSOC);\n array_push($answers, explode(\"@@\", $subrack[0]['words'])[0]);\n array_push($lengths, array((int)$subrack[0]['length']));\n }\n return; \n } \n \n // When no more elements are \n // there to put in data[] \n if ($i >= $n) \n return; \n \n // current is included, put \n // next at next location \n $data[$index] = $words[$i]; \n combinationUtil($words, $n, $r, $index + 1, $data, $i + 1); \n \n // current is excluded, replace \n // it with next (Note that i+1 \n // is passed, but index is not changed) \n combinationUtil($words, $n, $r, $index, $data, $i + 1); \n }", "public function solve()\n {\n $this->usedInBox = range(0, 2);\n foreach ($this->usedInBox as $indexA) {\n $this->usedInBox[$indexA] = range(0, 2);\n\n foreach ($this->usedInBox[$indexA] as $indexB => $bogus) {\n $this->usedInBox[$indexA][$indexB] = range(0, 8);\n\n foreach ($this->usedInBox[$indexA][$indexB] as $indexC => $c) {\n $this->usedInBox[$indexA][$indexB][$indexC] = false;\n }\n }\n }\n\n $this->usedInRow = range(0, 8);\n foreach ($this->usedInRow as $indexA) {\n $this->usedInRow[$indexA] = range(0, 8);\n\n foreach ($this->usedInRow[$indexA] as $indexB) {\n $this->usedInRow[$indexA][$indexB] = false;\n }\n }\n\n $this->usedInColumn = range(0, 8);\n foreach ($this->usedInColumn as $indexA) {\n $this->usedInColumn[$indexA] = range(0, 8);\n\n foreach ($this->usedInColumn[$indexA] as $indexB) {\n $this->usedInColumn[$indexA][$indexB] = false;\n }\n }\n\n for ($y = 0; $y < 9; $y++) {\n for ($x = 0; $x < 9; $x++) {\n if ($this->sudoku[$y][$x] === 0) {\n continue;\n }\n\n $value = $this->sudoku[$y][$x] - 1;\n\n $this->usedInRow[$y][$value] = true;\n $this->usedInColumn[$x][$value] = true;\n $this->usedInBox[floor($y / 3)][floor($x / 3)][$value] = true;\n }\n }\n\n return $this->runSolve(0);\n }", "function f_obj($individu){\n\t\t$cluster = count($individu); //menghitung jumlah cluster berdasarkan individu\n\t\t$target = 10;\n\t\t$hasil = 0;\n\t\tfor ($i=0; $i < $cluster; $i++) { \n\t\t\t$hasil += $individu[$i];\n\t\t}\n\n\t\t$evaluasi = abs($hasil - $target);\n\t\treturn $evaluasi; //nilai fitness masih 0-10\n\t}", "public function position($array) {\n $k=0;\n $array2=array();\n foreach($array as $key=>$value){\n foreach($value as $key1=>$value1){\n foreach($value1 as $key2=>$value2){\n $array2[$k]=$value2;\n $k=$k+1;\n }\n } \n } \n $count=count($array2);\n for($n=1;$n<$count-4;$n=$n+2) {\n if($array2[$n]=='F') {\n if($array2[$n+2]=='F') {\n if($array2[$n+4]=='F') {\n if(($n+4)==($count-1)) {\n $temp_name=$array2[0];\n $temp_gender=$array2[1];\n $array2[0]=$array2[$n+1];\n $array2[1]=$array2[$n+2];\n $array2[$n+1]=$temp_name;\n $array2[$n+2]=$temp_gender;\n }\n else {\n $temp_name=$array2[$count1-1];\n $temp_gender=$array2[$count1];\n $array2[$count1-1]=$array2[$n+1];\n $array2[$count1]=$array2[$n+2];\n $array2[$n+1]=$temp_name;\n $array2[$n+2]=$temp_gender;\n }\n }\n else {\n if(($n+2)==($count-2)) {\n $temp_name=$array2[$n+1];\n $temp_gender=$array2[$n+2]; \n $array2[$n+1]=$array2[$count-2];\n $array2[$n+2]=$array2[$count-1];\n $array2[$count-2]=$temp_name;\n $array2[$count-1]=$temp_gender;\n }\n else {\n if($array[$n+6]=='F') {\n $temp_name=$array2[$n+7];\n $temp_gender=$array2[$n+8];\n $array[$n+7]=$array[$count-2];\n $array[$n+8]=$array[$count-1];\n }\n }\n }\n }\n }\n }//printing the details in tabular format\n echo \"<table border=2px>\";\n for($k=0;$k<$count;$k++) {\n if($k%2==0 || $k==0){\n echo \"<td>\" . $array2[$k] . \"</td>\";\n }\n }\n echo \"</table>\";\n}", "public function GetMaxSumWithoutAdjacent($input) {\n\t\t$length = count($input);\n\t\t$sumEvens = $sumOdds = 0;\n\t\t\n\t\tfor ($i=0 ; $i < $length; $i = $i+2) { \n\t\t\t$sumEvens += $input[$i];\n\t\t\tisset($input[$i+1]) && $sumOdds += $input[$i+1];\n\t\t}\n\n\t\techo $sumEvens > $sumOdds ? $sumEvens : $sumOdds;\n\t}", "function getResultPart2($input) {\n //special case for 1, since 1x1 matrix won't have a higher value than 1\n $input_for_dimension = $input === 1 ? $input + 1 : $input;\n \n //get the dimension of the matrix \n //(this way our input number will be on the outer edge)\n $dimension = ceil(sqrt($input_for_dimension));\n \n //the dimensions of the square will always be odd (so make sure dimension is odd)\n if ($dimension % 2 == 0) {\n ++$dimension;\n }\n //the value we should start the center of the matrix at\n $center_value = 1;\n $spiralMatrix = new SpiralMatrix($dimension, $center_value, Direction::RIGHT, Direction::COUNTER_CLOCKWISE);\n \n $result = $spiralMatrix->getFirstLargerValueThan($input);\n print(\"First Larger Value than $input: $result\\n\");\n return $result;\n}", "public function run()\n {\n\n\n $C1 = [\"2\" => 1, \"3\" => 1,\n \"4\" => 1, \"5\" => 1, \"7\" => 1, \"8\" => 1,\n \"6\" => 1, \"10\" => 1, \n \"11\" => 1, \"12\" => 1, \n \"17\" => 1, \"13\" => 1, \n \"15\" => 1 ,\"14\" => 1, \"16\" => 1];\n\n\n $sdeC = [ \"1\" => 3, \"5\" => 3, \"6\" => 2, \n \"10\" => 5, \"11\" => 4, \n \"12\" => 2, \"17\" => 1, \n \"13\" => 1, \"15\" => 1] ;\n\n $seconde_A1 = [ \"1\" => 4, \"5\" => 3, \"6\" => 3, \n \"10\" => 3, \"11\" => 2,\n \"12\" => 2, \n \"17\" => 1, \"13\" => 1, \n \"15\" => 1] ;\t\n\n\n $seconde_A2 = [\"1\" => 4, \"5\" => 3, \"6\" => 3, \n \"10\" => 3, \"11\" => 2, \"7\" => 3, \"8\" => 3,\n \"12\" => 2, \n \"17\" => 1, \"13\" => 1, \n \"15\" => 1 ,\"14\" => 1] ;\n \n\n\n $prD = [ \"1\" => 3, \"5\" => 2, \"6\" => 2, \n \"10\" => 4, \"11\" => 4, \"12\" => 4, \n \"17\" => 1, \"13\" => 1, \n \"15\" => 1, \"9\" => 2] ;\n\n $prC = [\"1\" => 3, \"5\" => 2, \"9\" => 2, \"6\" => 2, \n \"10\" => 5, \"11\" => 5, \"12\" => 2, \n \"17\" => 1, \"13\" => 1, \n \"15\" => 1] ;\n\n\n\n $premiere_A1 = [\"1\" =>4, \"5\" => 4, \"9\" => 3, \"6\" => 3, \n \"7\" => 3, \"8\" => 3, \"10\" => 2, \n \"11\" => 1, \"12\" => 1, \n \"17\" => 1, \"13\" => 1, \n \"15\" => 1, \"14\" => 1] ;\n\n \n\n $premiere_A2 = [\"1\" => 4, \"5\" => 4, \"9\" => 3, \"6\" => 3, \n \"7\" => 1, \"8\" => 1, \"10\" => 3, \n \"11\" => 2, \"12\" => 1, \n \"17\" => 1, \"13\" => 1, \n \"15\" => 1, \"14\" => 1] ;\n\n\n $tleA1 = [\"1\" => 4, \"5\" => 4, \"9\" => 5, \"6\" => 3, \n \"7\" => 3, \"8\" => 3, \"10\" => 2, \n \"12\" => 2, \n \"17\" => 1, \"13\" => 1, \n \"15\" => 1, \"14\" => 1] ;\n\n\n $tleA2 = [\"1\" => 4, \"5\" => 4 , \"9\" => 5 , \"6\" => 3, \n \"7\" => 3, \"8\" => 3, \"10\" => 2, \n \"12\" => 2, \n \"17\" => 1, \"13\" => 1, \n \"15\" => 1, \"14\" => 1] ;\n\n\n\n $tleC = [\"1\" =>3, \"5\" => 1, \"9\" => 2, \"6\" => 2, \n \"10\" => 5, \"11\" => 5, \"12\" => 2, \n \"17\" => 1, \"13\" => 1, \n \"15\" => 1, \"14\" => 1] ;\n\n\n $tleD = [\"1\" => 3, \"5\" => 1, \"9\" => 2, \"6\" => 2, \n \"10\" => 4, \"11\" => 4, \"12\" => 4, \n \"17\" => 1, \"13\" => 1, \n \"15\" => 1, \"14\" => 1] ;\n\n\n $classes_cycle_1 = [\n \"6ème\" => $C1, \"5ème\" => $C1, \"4ème\" => $C1, \"3ème\" => $C1,\n ]; \n\n\n foreach ($classes_cycle_1 as $cls => $coeff) {\n foreach ($coeff as $key => $value) {\n CourseCoefficient::create([\n 'cycle_classe' => $cls,\n 'course_child_id' => $key,\n 'serie' => '-',\n 'coefficient' => $value\n ]);\n }\n }\n\n\n $classes_cycle_2 = [\n \"sda1\" => ['cycle_classe' => '2ndeA', 'serie' => 'A1', 'coef_courses' => $seconde_A1],\n \"sda2\" => ['cycle_classe' => '2ndeA', 'serie' => 'A2', 'coef_courses' => $seconde_A2],\n \"sdc\" => ['cycle_classe' => '2ndeC', 'serie' => 'C', 'coef_courses' => $sdeC],\n \"prea1\" => ['cycle_classe' => '1èreA', 'serie' => 'A1', 'coef_courses' => $premiere_A1],\n \"prea2\" => ['cycle_classe' => '1èreA', 'serie' => 'A2', 'coef_courses' => $premiere_A2],\n \"prec\" => ['cycle_classe' => '1èreC', 'serie' => 'C', 'coef_courses' => $prC],\n \"pred\" => ['cycle_classe' => '1èreD', 'serie' => 'D', 'coef_courses' => $prD],\n \"tlea1\" => ['cycle_classe' => 'TleA', 'serie' => 'A1', 'coef_courses' => $tleA1],\n \"tlea2\" => ['cycle_classe' => 'TleA', 'serie' => 'A2', 'coef_courses' => $tleA2],\n \"tlec\" => ['cycle_classe' => 'TleC', 'serie' => 'C', 'coef_courses' => $tleC],\n \"tled\" => ['cycle_classe' => 'TleD', 'serie' => 'D', 'coef_courses' => $tleD]\n ]; \n\n\n\n foreach ($classes_cycle_2 as $item) {\n\n foreach ($item['coef_courses'] as $key => $value) {\n CourseCoefficient::create([ \n 'cycle_classe' => $item['cycle_classe'], \n 'serie' => $item['serie'],\n 'course_child_id' => $key,\n 'coefficient' => $value\n ]);\n }\n }\n\n }", "function equalStacks($h1, $h2, $h3) {\n $sum1 = array_sum($h1);\n $sum2 = array_sum($h2);\n $sum3 = array_sum($h3);\n\n while (($sum1 != $sum2 || $sum2 != $sum3) && (count($h1) != count($h2) || count($h2) != count($h3))) {\n\n $min_value = min($sum1, $sum2, $sum3);\n\n if ($sum1 > $min_value) {\n $sum1 -= array_shift($h1);\n }\n if ($sum2 > $min_value) {\n $sum2 -= array_shift($h2);\n }\n if ($sum3 > $min_value) {\n $sum3 -= array_shift($h3);\n }\n }\n\n return $sum1;\n}", "function sumOfMinAbsDifferences($arr, $n) \r\n\t{ \r\n\t\t \r\n\t\t// sort the given array \r\n\t\tsort($arr); \r\n\t\tsort( $arr,$n); \r\n\t\t \r\n\t\t// initialize sum \r\n\t\t$sum = 0; \r\n\t\t \r\n\t\t// min absolute difference for \r\n\t\t// the 1st array element \r\n\t\t$sum += abs($arr[0] - $arr[1]); \r\n\t\t \r\n\t\t// min absolute difference for \r\n\t\t// the last array element \r\n\t\t$sum += abs($arr[$n - 1] - $arr[$n - 2]); \r\n\t\t \r\n\t\t// find min absolute difference \r\n\t\t// for rest of the array elements \r\n\t\t// and add them to sum \r\n\t\tfor ($i = 1; $i < $n - 1; $i++) \r\n\t\t\t$sum += min(abs($arr[$i] - $arr[$i - 1]), \r\n\t\t\t\t\t abs($arr[$i] - $arr[$i + 1])); \r\n\t\t\t \r\n\t\t// required sum \r\n\t\treturn $sum; \r\n\t}", "function string_compare_DP($str1, $str2) {\n $MATCH = 0;\n $INSERT = 1;\n $DELETE = 2;\n\n // init DP table, with Cell object inserted into each cell\n $temp = array_fill(0, strlen($str2)+1, 0);\n $compareTable = array_fill(0, strlen($str1)+1, $temp);\n \n for ($i=0; $i < strlen($str1)+1; $i++) { \n for ($j=0; $j < strlen($str2)+1; $j++) { \n // if 1st string is empty, the only option is to insert all char\n // of 2nd string\n if ($i == 0) {\n $compareTable[$i][$j] = $j;\n } elseif ($j == 0) { // if 2nd string is empty, the only option is to remove all char from 1st string\n $compareTable[$i][$j] = $i;\n } elseif ($str1[$i-1] == $str2[$j-1]) {\n $compareTable[$i][$j] = $compareTable[$i-1][$j-1];\n } else {\n $compareTable[$i][$j] = 1 + min($compareTable[$i-1][$j-1], $compareTable[$i-1][$j], $compareTable[$i][$j-1]);\n }\n }\n }\n print2DArray($compareTable);\n // return cost\n return $compareTable[strlen($str1)][strlen($str2)];\n}", "function hasTwoSum($array, $t)\n{\n $j = 0;\n $k = count($array) - 1;\n\n while ($j <= $k) {\n if ($array[$j] + $array[$k] == $t) {\n return true;\n } elseif ($array[$j] + $array[$k] < $t) {\n $j++;\n } else {\n $k--;\n }\n }\n\n return false;\n}", "function RecursiveLinerSearch($a, $n, $x, $i)\n{\n if($i > $n)\n {\n return \"not found\"; // -1 is not-found\n }\n elseif ($i <= $n && $a[$i] == $x)\n {\n return $i;\n }\n elseif ($i <= $n && $a[$i] != $x)\n {\n return RecursiveLinerSearch($a, $n, $x, $i + 1);\n }\n return 0;\n}", "function math_sequence($arr)\n{\n if (count($arr) == 0) {\n return [[]];\n }\n $result = [];\n foreach ($arr as $key => $pair) {\n $select_point = array_shift($pair);\n\n $rest_arr = array_except($arr, $key);\n $rest_arr = empty($pair) ? $rest_arr : array_merge($rest_arr, [$pair]);\n\n $sub_sequences = math_sequence($rest_arr);\n foreach ($sub_sequences as $sub) {\n array_unshift($sub, $select_point);\n $result[] = $sub;\n }\n }\n return $result;\n}", "function permutator_generate($tops){\r\n\t$max=1;\r\n\t$cas=array();\r\n\tforeach ($tops as $top) {$max=$max*$top;array_push($cas,0);}\r\n\t\r\n\t$res=array();\r\n\t\r\n\tarray_push($res,$cas);\r\n\t\r\n\tfor ($i=0;$i<$max-1;$i++){\r\n\t\t$cas[0]++;\r\n\t\tpermutator_overflow($cas,$tops);\r\n\t\tarray_push($res,$cas);\r\n\t\t\r\n\t}\r\n\t\r\n\treturn $res;\r\n\t\r\n}", "public static function factor(array &$A, array &$pivot) {\n $N = count($A);\n $M = count($A[0]);\n\n $minMN = min($M, $N);\n\n for ($j = 0; $j < $minMN; $j++)\n {\n // find pivot in column j and test for singularity.\n\n $jp = $j;\n\n $t = abs($A[$j][$j]);\n for ($i = $j + 1; $i < $M; $i++)\n {\n $ab = abs($A[$i][$j]);\n if ($ab > $t)\n {\n $jp = $i;\n $t = $ab;\n }\n }\n\n $pivot[$j] = $jp;\n\n // jp now has the index of maximum element \n // of column j, below the diagonal\n\n if ($A[$jp][$j] == 0)\n return 1; // factorization failed because of zero pivot\n\n\n if ($jp != $j)\n {\n // swap rows j and jp\n $tA = $A[$j];\n $A[$j] = $A[$jp];\n $A[$jp] = $tA;\n }\n\n if ($j < $M - 1) // compute elements j+1:M of jth column\n {\n // note A(j,j), was A(jp,p) previously which was\n // guarranteed not to be zero (Label #1)\n //\n $recp = 1.0 / $A[$j][$j];\n\n for ($k = $j + 1; $k < $M; $k++)\n $A[$k][$j] *= $recp;\n }\n\n\n if ($j < $minMN - 1)\n {\n // rank-1 update to trailing submatrix: E = E - x*y;\n //\n // E is the region A(j+1:M, j+1:N)\n // x is the column vector A(j+1:M,j)\n // y is row vector A(j,j+1:N)\n\n\n for ($ii = $j + 1; $ii < $M; $ii++)\n {\n $Aii = &$A[$ii];\n $Aj = $A[$j];\n $AiiJ = $Aii[$j];\n for ($jj = $j + 1; $jj < $N; $jj++)\n $Aii[$jj] -= $AiiJ * $Aj[$jj];\n\n }\n }\n }\n\n return 0;\n }", "function perimeter($n) {\n $sum = 8;\n $a = 4; \n $b = 4;\n if($n > 1){\n for($i = 0; $i < $n - 1; $i++){\n $c = $a + $b;\n $sum += $c;\n $a = $b;\n $b = $c;\n }\n }\n return $sum;\n}", "function prims_mst($distance_table){\n //TODO use sets or something similar to sets for this\n $u = array();\n $v = array_keys($distance_table);\n\n $new_edges = array();\n $all_vertexes = array_keys($distance_table);\n\n $a = array_pop($v);\n array_push($u,$a);\n\n //Keep looping until we've got all the edges\n $i = 0; //Loop protector to prevent infinite loops\n $max_ittr = count($all_vertexes)+4;\n while(!contains_all_verticies($u,$all_vertexes) && $i < $max_ittr){\n\n //Now go through all the edges in $v find it's closest neighbour in $u\n //Find the miinmum of those and put that vertex in $v\n $min_v = INF;\n $min_i = 0;\n $min_j = 0;\n foreach($v as $v1){\n $mins = find_min_vertex($v1,$u,$distance_table);\n if($mins[1] < $min_v){\n $min_v = $mins[1];\n $min_i = $mins[0];\n $min_j = $v1;\n }\n }\n //add the edge to the edges and the vertex to $u\n array_push($u,$min_j);\n array_push($new_edges,array($min_j,$min_i));\n\n $v = array_delete($v,$min_j);\n\n\n\n $i++;\n }\n\n return $new_edges;\n}", "function hourglassSum($arr) {\n\n for($i = 1; $i < 5; $i++)\n {\n for($j = 1; $j<5;$j++)\n {\n $temp = $arr[$i][$j] + $arr[$i-1][$j-1] + $arr[$i-1][$j] + $arr[$i-1][$j+1] +\n $arr[$i+1][$j-1] + $arr[$i+1][$j] + $arr[$i+1][$j+1];\n\n if(!isset($max) || $temp > $max)\n {\n $max = $temp;\n }\n }\n }\n return $max;\n}", "function solve_one(string $input) : string\n{\n\n $seats = array_map('str_split', xplode_input($input));\n $limit = 4;\n while(true) {\n [$seats, $hasChanged, $occupied] = walk_matrix($seats, $limit, 'occupied_neighbors');\n if (!$hasChanged) {\n return sprintf(\"Occupied seats: %d\\n\", $occupied);\n }\n }\n}", "function gaus_jordan_metoda_eliminacije_pokusaj_2($niz_cvorovi, $tacke_x) // $matrica, \n{\n\t// ------------------------------------- Priprema matrice -----------------------------------//\n\n\t// FORMIRANJE MATRICE NA OSNOVU CVOROVA\n\t// $niz_cvorovi = niz_cvorovi($cvorovi);\n // $niz_tacke = niz_tacke($tacke_x);\n $niz_tacke = $tacke_x;\n // sortirani cvorovi po x vrednosti u rastucem poretku radi formiranja intervala\n $niz_cvorovi = sortiranje_cvorova_po_intervalu($niz_cvorovi);\n\n $niz_intervali = niz_intervali($niz_cvorovi);\n // var_dump($niz_intervali);\n $matrica = formiranje_matrice($niz_cvorovi, $niz_intervali);\n\n // -----------------------------------------------------------------------------------------//\n\n\n\t//---------------------------------- RESAVANJE SISTEMA JEDNACINA(matrice) ------------------//\n\n\t$matrica = sort_gl_dijagonala($matrica);\n\t// echo ( napravi_tabelu( $matrica ) );\n\t// exit();\n\n\t// echo ( napravi_tabelu( zaokruzi_koeficijente_za_prikaz ($matrica) ) );\n\t// exit();\n\n\t$matrica = gauss_nuliranje_matrice($matrica);\n\n\t$matrica = jordan_nuliranje_matrice($matrica);\n\n\n\t// -----------------------------------------------------------------------------------------//\n\n\n\t//------------------------ Formiranje konacnih formula za odgovarajuce intervale -----------//\n\n\t$niz_koeficijenata_sa_vrednostima = niz_koeficijenata_sa_vrednostima($matrica);\n\t$abc_grupe = abc_grupe($niz_koeficijenata_sa_vrednostima);\n\t// var_dump($abc_grupe);\n\t// var_dump($niz_koeficijenata_sa_vrednostima);\n\t$formule = formiraj_string_formula_sa_intervalima($niz_koeficijenata_sa_vrednostima);\n\n\t// ispisi formule\n\tfor($form = 1; $form <= count($formule); $form++)\n\t{\n\t\t$formula_str = $formule[$form];\n\t\t$interval_levi = $niz_intervali[$form - 1][0];\n\t\t$interval_desni = $niz_intervali[$form - 1][1];\n\t\techo \"Interval {$form}. je [{$interval_levi}, {$interval_desni}], a formula: {$formula_str} \" . \"<br>\";\n\t}\n\techo \"<br>\";\n\t// -----------------------------------------------------------------------------------------//\n\n\n\t// ------------------------------------Interpolacija----------------------------------------//\n\t$niz_interpoliranih_tacaka = array();\n\tif(!empty($niz_tacke))\n\t{\n\t\tfor($x = 0; $x < count($niz_tacke); $x++)\n\t\t{\n\t\t\t// kriva\n\t\t\t$kr = u_kom_intervalu_je_input($niz_intervali, $niz_tacke[$x]) + 1; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\t\t\t// Pn(x)\t=\t\t\t x * x * An + x * Bn + Cn \n\t\t\t$vrednost_y = ( $niz_tacke[$x] * $niz_tacke[$x] * $abc_grupe[$kr][0] ) + ( $niz_tacke[$x] * $abc_grupe[$kr][1] ) + $abc_grupe[$kr][2];\n\t\t\t$niz_interpoliranih_tacaka[] = array($niz_tacke[$x], $vrednost_y);\n\n\t\t\t// $prvi = $niz_intervali[$u_kom_intervalu_je_input][0];\n\t\t\t// $drugi = $niz_intervali[$u_kom_intervalu_je_input][1];\n\t\t\t// $t = $niz_tacke[$x];\n\t\t\t// echo \"{$x}. tacka - {$t} - je u intervalu: {$prvi}, {$drugi}\" . \"<br>\";\n\t\t}\n\t}\n\n\t// -----------------------------------------------------------------------------------------//\n\n\treturn array($matrica, $niz_interpoliranih_tacaka);\n\t\n}", "function MaximalSquare($matrix,$rows,$cols){\n $sum =array();\n\n //set the first column of sum matrix\n for($i=0;$i< $rows;$i++){\n $sum[$i][0]= $matrix[$i][0];\n }\n //set the first row of sum matrix\n for($j=0;$j < $cols;$j++){\n $sum[0][$j] = $matrix[0][$j];\n }\n\n for($i=1;$i<$rows;$i++){\n for($j=1;$j<$cols;$j++){\n if($matrix[$i][$j] == 1){\n $sum[$i][$j]= minimum($sum[$i][$j-1],$sum[$i-1][$j],$sum[$i-1][$j-1])+1;\n }else{\n $sum[$i][$j]=0;\n }\n }\n }\n\n $max_of_sum =$sum[0][0];\n $max_i = 0;\n $max_j = 0;\n\n for($i=0;$i<$rows;$i++){\n for($j=0;$j<$cols;$j++){\n if($max_of_sum < $sum[$i][$j]){\n $max_of_sum=$sum[$i][$j];\n $max_i = $i;\n $max_j = $j;\n }\n }\n }\n $square_matrix = array();\n for($i=$max_i;$i > ($max_i -$max_of_sum);$i--){\n for($j=$max_j;$j > ($max_j - $max_of_sum);$j--){\n $square_matrix[$i][$j] = $matrix[$i][$j];\n }\n }\n\n return $square_matrix;\n}", "public function summation($query){\n $result = array();\n $validation = 0;\n $info = explode(\"\\n\",$query);\n $nCases = (integer)$info[0];\n if (1 <= $nCases && is_int($nCases)){\n $acum = 0;\n $nuevaCadena = $info;\n (string)$nuevaCadena[0]=\" \";\n for ($i=0,$index=0,$newIndex=0; $index < $nCases; $index++) { \n if ($newIndex <= 1000) {\n if ($index == 0) {\n $aux = explode(\" \",$nuevaCadena[1]);\n $nQuerys = (integer)$aux[1];\n $newIndex = 2 + $nQuerys;\n }else{\n if ($nuevaCadena[$newIndex]) {\n $aux = explode(\" \",$nuevaCadena[$newIndex]);\n $nQuerys = (integer)$aux[1];\n $sizeMatrix = (integer)$aux[0];\n $newIndex += $nQuerys+1;\n }\n }\n }else {\n return \"La cantidad de querys no puede ser mayor a 1000\"; \n }\n }\n if (sizeof($info) != $newIndex) {\n return \"La cantidad de querys no coincide con el formato ingresado\";\n }\n \n $nuevaCadena = $info;\n (string)$nuevaCadena[0] = \" \";\n for ($index = 0; $index < sizeof($nuevaCadena); $index++) {\n if ($index == 0) {\n $aux = explode(\" \",$nuevaCadena[1]);\n $nQuerys = (integer)$aux[1];\n $sizeMatrix = (integer)$aux[0];\n }\n $verif = explode(\" \",$nuevaCadena[$index]);\n if (!intval((integer)$verif[0])) {\n $validation = $this->validateQuery($nuevaCadena[$index],$sizeMatrix);\n if ($validation == -1) {\n return \"error en validation\";\n }\n }else{\n $aux = explode(\" \",$nuevaCadena[$index]);\n $nQuerys = (integer)$aux[1];\n $sizeMatrix = (integer)$aux[0];\n if ($sizeMatrix>100 || $sizeMatrix<1) {\n\n return \"Tamano de matriz invalido\".(string)$aux[0];\n }\n $this->initMatrix($sizeMatrix);\n }\n }\n return $this->result;\n\n\n }\n return \"Error en formato de la entrada\";\n\n }", "public function generator($a){\n $countr = 0;\n while($countr < 70)//random spread 50 holes on the wall\n {\n $random = range(0, 49);\n shuffle($random);\n $x = $random[0];\n $y = $random[1];\n if($x != 0&&$x != 49&&$y != 0&&$y != 49){\n $a[$y][$x] = 0;\n $countr++; \n }\n }\n \n $statistic = []; \n for($i = 0;$i <= 49;$i ++)\n {\n for($j = 0;$j <= 49;$j ++)\n {\n if($a[$i][$j] == 0){\n $cell = [$i,$j];\n $statistic[] = $cell;\n }\n }\n }\n \n for($i = 0;$i < count($statistic);$i ++)//make a holes spread like 'cross' pattern from 4 direction, which reach end or another road stop push down the wall\n {\n $tcell = $statistic[$i];\n $curri = $tcell[0];\n $currj = $tcell[1];\n \n //dig to up\n $curri--;\n while($curri >= 0){\n if($a[$curri][$currj] == 0)\n break;\n if($a[$curri][$currj - 1] == 0 || $a[$curri][$currj + 1] == 0){//left or right,\n $a[$curri][$currj] = 0;\n break;\n }\n $a[$curri][$currj] = 0;\n $curri--;\n }\n \n $curri = $tcell[0];\n $currj = $tcell[1];\n \n //dig to down\n $curri++;\n while($curri <= 49){\n if($a[$curri][$currj] == 0)\n break;\n if($a[$curri][$currj - 1] == 0 || $a[$curri][$currj + 1] == 0){\n $a[$curri][$currj] = 0;\n break;\n }\n $a[$curri][$currj] = 0; \n $curri++;\n }\n \n $curri = $tcell[0];\n $currj = $tcell[1];\n \n //dig to left\n $currj--;\n while($currj >= 0){\n if($a[$curri][$currj] == 0)\n break;\n if($a[$curri - 1][$currj] == 0 || $a[$curri + 1][$currj] == 0){\n $a[$curri][$currj] = 0;\n break;\n }\n $a[$curri][$currj] = 0; \n $currj--;\n }\n \n $curri = $tcell[0];\n $currj = $tcell[1];\n \n //dig to right\n $currj++;\n while($currj <= 49){\n if($a[$curri][$currj] == 0)\n break;\n if($a[$curri - 1][$currj] == 0 || $a[$curri + 1][$currj] == 0){\n $a[$curri][$currj] = 0;\n break;\n }\n $a[$curri][$currj] = 0;\n $currj++;\n }\n }\n return $a;\n }", "function meanFinder1(array $numbers)\n{\n $sum = 0;\n if($numbers == null || count($numbers) < 1) {\n return \"Invalid input. Please use an array that includes integer values\";\n }\n\n // Time complexity: N\n for ($i=0; $i<count($numbers); $i++) {\n $sum += $numbers[$i];\n }\n\n // Time complexity 1\n $mean = $sum / count($numbers);\n return $mean;\n}" ]
[ "0.6655046", "0.6574615", "0.6466907", "0.6448415", "0.6409319", "0.6371445", "0.6246942", "0.60129553", "0.5971421", "0.594417", "0.59158975", "0.5874815", "0.58338666", "0.5820739", "0.58071846", "0.57875353", "0.5775552", "0.5754062", "0.5573826", "0.55677235", "0.5510685", "0.5509479", "0.5499614", "0.5490391", "0.5433592", "0.54300946", "0.5419438", "0.5383595", "0.53737944", "0.5365186", "0.5359621", "0.5354724", "0.532195", "0.5308921", "0.53067917", "0.5300298", "0.5298816", "0.5269776", "0.5244944", "0.5229534", "0.5214155", "0.51815754", "0.5178319", "0.5169841", "0.5157885", "0.51492405", "0.5146806", "0.5143514", "0.5130211", "0.51294684", "0.51185995", "0.5099794", "0.50915104", "0.5088886", "0.5086062", "0.50733656", "0.50702554", "0.50139844", "0.50014025", "0.49993524", "0.49992633", "0.49840438", "0.4935911", "0.49306467", "0.49261937", "0.4906294", "0.4895984", "0.48950306", "0.4878577", "0.48782414", "0.4875842", "0.4863627", "0.4862188", "0.4860354", "0.4859629", "0.4854514", "0.48505813", "0.48443726", "0.48366857", "0.48361108", "0.48344192", "0.4826619", "0.48234925", "0.48228568", "0.4822785", "0.48223823", "0.4820974", "0.48199493", "0.4816865", "0.4813733", "0.48124945", "0.48123577", "0.48032027", "0.48022178", "0.4801201", "0.47963572", "0.47946006", "0.4791003", "0.47893742", "0.478901" ]
0.5141598
48
end function print_r( getMaxSumSubseq( $arr2 ) ); solution 3 this algorithm solves the problem using Divide et Impera and time complexity N log N and it's more efficient. using bestMax = max(bestL, max(bestR, maxSuf + maxPref)) array(2,11,4,13,5,2);
function getMaxSumSubSequence($arr, $li, $ls) { if($li == $ls) return $arr[ $li ]; $middle = intval(($li+$ls)/2); $bestL = getMaxSumSubSequence($arr, $li, $middle); $bestR = getMaxSumSubSequence($arr, $middle+1,$ls); $maxSuf = -9999; $maxPre = -9999; $suf = 0; for($i = $middle;$i >= $li; $i--) { $suf += $arr[$i]; if($suf > $maxSuf) { $maxSuf = $suf; } } $pre = 0; for($j = $middle+1;$j <= $ls; $j++) { $pre += $arr[$j]; if($pre > $maxPre) { $maxPre = $pre; } } return max($bestL, max($bestR, ($maxSuf + $maxPre) )); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSubseqMaxSum( $arr ) {\n\n //firstly we determine the number of the elements\n $N = count($arr) - 1;\n\n $sumMax = -999;\n\n $iMax = -1; $jMax = -1; \n\n //for i = 0 to N execute\n for($i = 0; $i <= $N; $i++) {\n\n $sum = 0;\n\n for($j = $i;$j <= $N; $j++) {\n\n $sum = $sum + $arr[ $j ]; \n\n if($sum > $sumMax) {\n\n $sumMax = $sum;\n $iMax = $i;\n $jMax = $j;\n }\n\n }\n\n } \n\n return array(\"sumMax\"=>$sumMax, \n \"i\"=>$iMax,\n \"j\"=>$jMax);\n}", "function getSubseqSum( $arr ) {\n\n $N = count($arr) - 1;\n\n $bestSum = 0;\n\n $posBest = -1;\n\n for($i = 0; $i <= $N; $i++) {\n\n for($j = $N; $j >= $i; $j--) {\n\n $partialSum = 0;\n\n for($k = $i; $k <= $j; $k++) {\n\n $partialSum += $arr[ $k ]; \n }\n\n if($partialSum > $bestSum) {\n\n $bestSum = $partialSum;\n } \n } \n }\n\n return $bestSum;\n}", "function getSumSeq( $arr ) {\n\n $N = count($arr) - 1;\n \n $sum = array();\n\n $sum[ 0 ] = $arr[ 0 ];\n\n for($i = 1; $i <= $N; $i++) {\n\n $sum[ $i ] = $arr[ $i ] + $sum[ $i - 1 ]; \n } \n\n $bestSum = 0;\n\n $best = array();\n\n $best[ 0 ] = $sum[ 0 ];\n\n $min = $sum[ 0 ];\n \n for($i = 1; $i <= $N; $i++) {\n\n $best[ $i ] = $sum[ $i ] - $min;\n\n if($sum[ $i ] < $min) {\n\n $min = $sum[ $i ];\n } \n\n if($bestSum < $best[ $i ]) {\n\n $bestSum = $best[ $i ]; \n $pos = $i;\n }\n } \n\n return array(\"bestsum\"=>$bestSum, \n \"pos\"=>$pos);\n}", "function solution($N, $A)\n{\n // Initial array which length is N for saving final result\n $result_arr = array_fill(0, $N, 0);\n \n // Solution:\n // what we did is using $current_big_val to save current biggest value in result array\n // we empty result array when $A[$i] === $N1 which is max counter\n // when empty result array we will add $current_big_val to $addition_val\n // so we only need to record those steps which after final max counter\n // and add $addition_val to each element\n\n // e.g $N = 5, $A = [3, 4, 4, 6, 1, 4, 4]\n // So $N1 = 6 and the original steps should look like below\n // (0, 0, 1, 0, 0) $A[0] !== $N1\n // (0, 0, 1, 1, 0) $A[1] !== $N1\n // (0, 0, 1, 2, 0) $A[2] !== $N1\n // (2, 2, 2, 2, 2) $A[3] === $N1, max counter\n // (3, 2, 2, 2, 2) $A[4] !== $N1\n // (3, 2, 2, 3, 2) $A[5] !== $N1\n // (3, 2, 2, 4, 2) $A[6] !== $N1\n\n // Our steps will be like this\n // (0, 0, 1, 0, 0) $A[0] !== $N1, $current_big_val = 1, $addition_val = 0\n // (0, 0, 1, 1, 0) $A[1] !== $N1, $current_big_val = 1, $addition_val = 0\n // (0, 0, 1, 2, 0) $A[2] !== $N1, $current_big_val = 2, $addition_val = 0\n // (0, 0, 0, 0, 0) $A[3] === $N1, max counter so empty array, $current_big_val = 0, $addition_val = 2\n // (1, 0, 0, 0, 0) $A[4] !== $N1\n // (1, 0, 0, 1, 0) $A[5] !== $N1\n // (1, 0, 0, 2, 0) $A[6] !== $N1\n // add $addition_val which is 2 to each element\n // (3, 2, 2, 4, 2)\n \n $len = count($A);\n $N1 = $N + 1;\n $current_big_val = 0;\n $addition_val = 0;\n \n for ($i = 0; $i < $len; $i++) {\n if ($A[$i] === $N1) {\n $result_arr = array();\n $addition_val += $current_big_val;\n $current_big_val = 0;\n } else {\n if (!isset($result_arr[$A[$i] - 1])) {\n $result_arr[$A[$i] - 1] = 0;\n }\n \n $result_arr[$A[$i] - 1] ++;\n \n if ($current_big_val < $result_arr[$A[$i] - 1]) {\n $current_big_val = $result_arr[$A[$i] - 1];\n }\n }\n }\n \n for ($i=0; $i<$N; $i++) {\n $result_arr[$i] = !isset($result_arr[$i]) ? $addition_val : $result_arr[$i] + $addition_val;\n }\n \n return $result_arr;\n}", "function getSumV2($list)\r\n{\r\n $cache = [];\r\n for ($i=0; $i<count($list); $i++) {\r\n array_push($cache, 0);\r\n }\r\n\r\n $cache[0] = max($cache[0], $list[0]);\r\n $cache[1] = max($cache[0], $list[1]);\r\n\r\n for ($i=2; $i<count($list); $i++) {\r\n $cache[$i] = max(($list[$i] + $cache[$i-2]), $cache[$i-1]);\r\n }\r\n return $cache[$i-1];\r\n}", "function miniMaxSum($arr) {\n\t$sum = [];\n\n\tfor($i = 0; $i < 5; $i++)\n\t{\n\t\t$tempArray = $arr;\n\t\tunset($tempArray[$i]);\n\t\t$sum[] = array_sum($tempArray);\n\t}\n\tprint min($sum).\" \".max($sum);\n}", "function findMax($arr, $n) \n{ \n\t$mi = 0; \n\tfor ($i = 0; $i < $n; ++$i) \n\t\tif ($arr[$i] > $arr[$mi]) \n\t\t\t\t$mi = $i; \n\treturn $mi; \n}", "function miniMaxSum($arr) {\n // Write your code here\n sort($arr);\n $total = array_sum($arr);\n $newsum = []; \n for ($i = 0; $i < count($arr); $i++) {\n $newsum[] = $total-$arr[$i];\n }\n $min = min($newsum);\n $max = max($newsum);\n \n echo $min.' '.$max;\n\n}", "function solution($N, $A) {\n $m = count($A);\n\n // init counters\n $C = array();\n for ($i = 0; $i < $N; $i++) {\n $C[$i] = 0;\n }\n\n $max = 0;\n $minC = 0; // maximized helper value\n foreach ($A as $ai) {\n if ($ai <= $N) {\n /*\n * increase operation\n */\n // even the value\n if($C[$ai - 1] < $minC) {\n $C[$ai - 1] = $minC;\n }\n // actual increase\n $C[$ai - 1] ++;\n // calculate max\n if ($max < $C[$ai - 1]) {\n $max = $C[$ai - 1];\n }\n } elseif ($ai == $N + 1) {\n // do not actual increase to speed up operations\n $minC = $max;\n }\n }\n // even the values\n foreach($C as &$ci) {\n if($ci < $minC) {\n $ci = $minC;\n }\n }\n return $C;\n}", "function solution($N, $A) {\n $counters = array_fill(1, $N, 0);\n $currentMax = 0;\n foreach ($A as $v) {\n if ($v >= 1 && $v <= $N) {\n $counters[$v] += 1;\n if ($counters[$v] > $currentMax) {\n $currentMax = $counters[$v];\n }\n }\n else if ($v === ($N + 1)) {\n $counters = array_fill(1, $N, $currentMax);\n }\n }\n return array_values($counters);\n}", "function miniMaxSum($arr) {\n $allSums = [];\n for ($i = 0; $i < count($arr); $i++) {\n $tmpArray = $arr;\n unset($tmpArray[$i]);\n $allSums[] = array_sum($tmpArray);\n }\n\n print min($allSums) . ' ' . max($allSums);\n}", "function arr_max($int_arr){\r\n\t\t\t\r\n\t\t\t$max = $int_arr[0];\t\t\r\n\t\t\t\r\n\t\t\tfor ($i=0; $i < count($int_arr); $i++){\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tif ( $int_arr[$i] > $max ) {\t\t\t\t\t\r\n\t\t\t\t\t$max = $int_arr[$i];\r\n\t\t\t\r\n\t\t\t\t}//end if\r\n\t\t\t\r\n\t\t\t}//end for\r\n\t\t\r\n\t\t\treturn $max;\r\n\t\t\t\r\n\t\t}", "function MaximalSquare($matrix,$rows,$cols){\n $sum =array();\n\n //set the first column of sum matrix\n for($i=0;$i< $rows;$i++){\n $sum[$i][0]= $matrix[$i][0];\n }\n //set the first row of sum matrix\n for($j=0;$j < $cols;$j++){\n $sum[0][$j] = $matrix[0][$j];\n }\n\n for($i=1;$i<$rows;$i++){\n for($j=1;$j<$cols;$j++){\n if($matrix[$i][$j] == 1){\n $sum[$i][$j]= minimum($sum[$i][$j-1],$sum[$i-1][$j],$sum[$i-1][$j-1])+1;\n }else{\n $sum[$i][$j]=0;\n }\n }\n }\n\n $max_of_sum =$sum[0][0];\n $max_i = 0;\n $max_j = 0;\n\n for($i=0;$i<$rows;$i++){\n for($j=0;$j<$cols;$j++){\n if($max_of_sum < $sum[$i][$j]){\n $max_of_sum=$sum[$i][$j];\n $max_i = $i;\n $max_j = $j;\n }\n }\n }\n $square_matrix = array();\n for($i=$max_i;$i > ($max_i -$max_of_sum);$i--){\n for($j=$max_j;$j > ($max_j - $max_of_sum);$j--){\n $square_matrix[$i][$j] = $matrix[$i][$j];\n }\n }\n\n return $square_matrix;\n}", "function raw_method2($nums, $k) {\n $start = recordStart();\n $result = [];\n\n $max_left[0] = $nums[0];\n $max_right[count($nums) - 1] = $nums[count($nums) - 1];\n\n // Separate max start from left and max start from right\n for ($i = 0; $i < count($nums); $i++) {\n // Collect max start from left\n $max_left[$i] = ($i % $k == 0) ? $nums[$i] : max($max_left[$i - 1], $nums[$i]);\n\n // Collect max start from right\n $j = count($nums) - $i - 1;\n $max_right[$j] = ($j % $k == 0) ? $nums[$j] : max(isset($max_right[$j + 1]) ? $max_right[$j + 1] : $max_right[$j], $nums[$j]);\n }\n\n // Merge and compare\n for ($i = 0; $i + $k <= count($nums); $i++) {\n $result[] = max($max_right[$i], $max_left[$i + $k - 1]);\n }\n\n\n $end = recordEnd($start);\n\n return ['result raw_method2' => $result, 'input' => $nums, 'slide' => $k, 'total exe time (microsecond)' => $end];\n}", "function solution($A) {\n // write your code in PHP7.0\n $idxes = [];\n $C = [];\n $L = count($A);\n $mid = floor($L/2);\n\n foreach ($A as $k=>$v) {\n if (!isset($C[$v])) {\n $idxes[$v] = [];\n $C[$v] = 0;\n }\n\n $C[$v] += 1;\n array_push($idxes[$v], $k);\n\n if ($C[$v] > $mid) {\n $rIdx = $v;\n }\n }\n\n // No leader\n if (!isset($rIdx)) {\n return 0;\n }\n \n $leaderIndexes = $idxes[$rIdx];\n // print_r($leaderIndexes);\n $leaderTotal = count($leaderIndexes);\n $eCount = 0;\n for ($i = 0; $i < $leaderTotal; $i++) {\n $leaderIndex = $leaderIndexes[$i];\n $taCount = $leaderIndex + 1;\n \n $taMid = floor($taCount / 2);\n // $i + 1 is the count of leaders so far\n if ($i+1 > $taMid){\n $tbCount = $L - $taCount;\n $leftLeaders = $leaderTotal - ($i + 1); \n // print \"\\$i: $i, \\$leaderIndex: $leaderIndex, \\$taCount: $taCount, \\$tbCount: $tbCount, \\$leftLeaders: $leftLeaders \\r\\n\";\n if ($leftLeaders > floor($tbCount / 2)) {\n $eCount++;\n }\n\n // borrow from left for list like [4, 4, 2, 5, 3, 4, 4, 4];\n if ($i + 1 > floor(($taCount + 1) / 2) && $i+1 < $leaderTotal && $leaderIndexes[$i+1] != $leaderIndexes[$i] + 1 && $leftLeaders > floor(($tbCount - 1) / 2)) {\n $eCount++;\n }\n } \n }\n\n return $eCount;\n}", "function findHighestSem($rq, $seq)\n\t{\n\t\tif(array_key_exists(0, $rq))\n\t\t{\n\t\t\tforeach($rq as $co)\n\t\t\t{\n\t\t\t\tif(!is_null($co))\n\t\t\t\t\t$ret[] = findSemester($co, $seq);\n\t\t\t}\n\t\t\treturn max($ret);\n\t\t}\n\t\telse\n\t\t\treturn count($seq)-1;\n\t}", "function solution($S, $P, $Q){\r\n $A = $C = $G = $T = 0;\r\n $results = array();\r\n $quantaties = array();\r\n $quantaties[-1]=\"0000\"; \r\n if ((strlen($S) < 1) || (strlen($S) > 100000))\r\n return 0;\r\n if ((count($P) < 1) || (count($P) > 50000))\r\n return 0;\r\n if ((count($Q) < 1) || (count($Q) > 50000))\r\n return 0;\r\n for ($i = 0; $i < strlen($S); $i++) {\r\n switch (substr($S, $i, 1)) {\r\n case 'A':\r\n $A++; \r\n break;\r\n case 'C':\r\n $C++;\r\n break;\r\n case 'G':\r\n $G++;\r\n break;\r\n case 'T':\r\n $T++;\r\n break;\r\n }\r\n $quantaties[$i]=$A.\"|\".$C.\"|\".$G.\"|\".$T; \r\n } \r\n// print_r($quantaties);\r\n $right=$left=array();\r\n for ($i = 0; $i < count($P); $i++) {\r\n $right=explode(\"|\", $quantaties[$Q[$i]]); print_r($right);\r\n $left=explode(\"|\", $quantaties[$P[$i]-1]); print_r($left);\r\n if (($right[0]-$left[0])!=0) $results[$i]=1;\r\n elseif (($right[1]-$left[1])!=0) $results[$i]=2;\r\n elseif (($right[2]-$left[2])!=0) $results[$i]=3;\r\n else $results[$i]=4;\r\n }\r\n return $results;\r\n}", "function solution($A) {\n $return = 0;\n \n $N = count($A);\n $left = [];\n $right = [];\n \n for ($i=0; $i<$N; $i++) {\n $left[] = $A[$i] + $i;\n $right[] = -($A[$i] - $i);\n }\n \n sort($left);\n sort($right);\n \n for($i=0; $i<$N-1; $i++) {\n $val = $left[$i];\n $pos = binary_search($val, $right);\n $return += $N - $pos - 1;\n }\n \n return $return;\n}", "function miniMaxSum(array $arr)\n{\n $sum = array_sum($arr);\n printf(\"%d %d\", $sum - max($arr), $sum - min($arr));\n}", "function find_max_index($arr) \n {\n $max = $arr[0]; \n for ($i = 1, $len = count($arr); $i < $len; $i++) {\n\n $max = ($arr[$i] > $max) ? $arr[$i] : $max;\n } \n return $max;\n }", "function findLargestPalindromeProduct($maxComponent){\n $largest = [0,0]; //this will store our working largest palindrome products\n for($i = 0; $i < $maxComponent; $i++){ //try every possible first number\n for($j = 0; $j < $maxComponent; $j++){ //try every possible 2nd number\n if(checkPalindrome($j*$i)){ //if the product is a palindrome\n if($largest[0]*$largest[1] < $i*$j){ //if the product is larger than our previous best\n $largest = [$i, $j]; //then update the working largest copy\n }\n }\n }\n }\n return($largest); //return the array containing the 2 numbers used to create the largest palindrome\n}", "function SumSize($a) {\n\n $n = count($a); // ??????????? ??????? ? ????????? (???? ?????? ?????? 3 ??. ????? ??????????? ????? ?? 2 ??????!!!)\n\n for ($i3 = 1; $i3 < $n; $i3++) {\n // ????????????? ??????? ?? ????????\n for ($i2 = $i3 - 1; $i2 < $n; $i2++) {\n for ($i = 0; $i <= 1; $i++) {\n if ($a[$i2]['X'] < $a[$i2]['Y']) {\n $a1 = $a[$i2]['X'];\n $a[$i2]['X'] = $a[$i2]['Y'];\n $a[$i2]['Y'] = $a1;\n };\n if (($i == 0) and ($a[$i2]['Y'] < $a[$i2]['Z'])) {\n $a1 = $a[$i2]['Y'];\n $a[$i2]['Y'] = $a[$i2]['Z'];\n $a[$i2]['Z'] = $a1;\n }\n }\n $a[$i2]['Sum'] = $a[$i2]['X'] + $a[$i2]['Y'] + $a[$i2]['Z']; // ????? ??????\n }\n\n // ????????????? ????? ?? ???????????\n for ($i2 = $i3; $i2 < $n; $i2++)\n for ($i = $i3; $i < $n; $i++)\n if ($a[$i - 1]['Sum'] > $a[$i]['Sum']) {\n $a2 = $a[$i];\n $a[$i] = $a[$i - 1];\n $a[$i - 1] = $a2;\n }\n\n // ????????? ????? ????????? ???? ????? ????????? ??????\n if ($a[$i3 - 1]['X'] > $a[$i3]['X']) {\n $a[$i3]['X'] = $a[$i3 - 1]['X'];\n }\n if ($a[$i3 - 1]['Y'] > $a[$i3]['Y']) {\n $a[$i3]['Y'] = $a[$i3 - 1]['Y'];\n }\n $a[$i3]['Z'] = $a[$i3]['Z'] + $a[$i3 - 1]['Z'];\n $a[$i3]['Sum'] = $a[$i3]['X'] + $a[$i3]['Y'] + $a[$i3]['Z']; // ????? ??????\n }\n\n //?????????\n //echo '<br>( '.Round($a[$n-1]['X'],2).' '.Round($a[$n-1]['Y'],2).' '.Round($a[$n-1]['Z'],2).' )';\n\n return (array('length' => Round($a[$n - 1]['X'], 2), 'width' => Round($a[$n - 1]['Y'], 2), 'height' => Round($a[$n - 1]['Z'], 2)));\n }", "function arrayManipulation($number, $queries) {\n\n $array=[];\n for ($index = 0; $index < count($queries); $index++)\n {\n $array[$queries[$index][0]-1]=0;\n $array[$queries[$index][1]]=0;\n }\n for ($index = 0; $index < count($queries); $index++)\n {\n $a= $queries[$index][0];\n $b= $queries[$index][1];\n $k= $queries[$index][2];\n $array[$a-1] += $k;\n $array[$b] -= $k;\n }\n\n $sum=0;\n $max=0;\n for ($index = 0; $index < $number; $index++)\n {\n @$sum += $array[$index];\n if ($sum > $max)\n $max = $sum;\n }\n return $max;\n}", "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 euler009(int $sum): int\n{\n for ($a = 1; $a <= $sum - (2 * $a + 3); $a++) {\n for ($b = $a + 1; $b <= $sum - ($b + 1); $b++) {\n $c = $sum - ($a + $b);\n if ($a ** 2 + $b ** 2 == $c ** 2) {\n // The problem statement guarantees that this will be reached\n return $a * $b * $c;\n }\n }\n }\n}", "function bestTimeToBuyAndSellStock($arr) {\n $len = count($arr);\n $minPrice = 999;\n $maxPro = 0;\n for ($i=0; $i<$len; $i++) {\n $minPrice = min($minPrice, $arr[$i]);\n $maxPro = max($maxPro, $arr[$i] - $minPrice);\n }\n return $maxPro;\n}", "static function maxint() {\n /* assumes largest integer is of form 2^n - 1 */\n $to_test = pow(2, 16);\n while (1) {\n $last = $to_test;\n $to_test = 2 * $to_test;\n if (($to_test < $last) || (!is_int($to_test))) {\n return($last + ($last - 1));\n }\n }\n }", "function solution(array $a) {\n $count = count($a);\n\n $sums = [0 => $a[0]];\n $sums_r = [];\n $sums_r[$count-1] = $a[$count-1];\n\n for ($i=1; $i<count($a); $i++) {\n $sums[$i] = $sums[$i-1] + $a[$i];\n $sums_r[$count-$i-1] = $sums_r[$count-$i] + $a[$count-$i-1];\n }\n $diffs = [];\n\n for ($i=1; $i<$count; $i++) {\n $diffs[] = abs($sums[$i-1] - $sums_r[$i]);\n }\n\n return min($diffs);\n}", "function minimumBribes($q)\n{\n $stepsCount = 0;\n $bribesCounts = [];\n $arrayLength = sizeOf($q)-1;\n $swapCntPerRound = 0;\n for ($i = 0; $i < $arrayLength; $i++) {\n if ($q[$i] > $q[$i+1]) {\n if (!isset($bribesCounts[$q[$i]])) {\n $bribesCounts[$q[$i]] = 0;\n }\n\n $bribesCounts[$q[$i]]++;\n\n if ($bribesCounts[$q[$i]] > 2) {\n //echo 'Too chaotic', PHP_EOL;\n return \"Too chaotic\";\n }\n\n $stepsCount++;\n $swapCntPerRound++;\n list($q[$i+1], $q[$i]) = [$q[$i], $q[$i+1]];\n }\n\n if ($i == $arrayLength-1 && $swapCntPerRound > 0) {\n $i = -1;\n $swapCntPerRound = 0;\n }\n }\n\n //echo array_sum($bribesCounts), PHP_EOL;\n return array_sum($bribesCounts);\n}", "function solution(array $A) {\n $result = $started = 0;\n foreach ($A as $d) {\n if ($d === 0) {\n $started++;\n } else if ($d === 1 and $started > 0) {\n $result += $started;\n }\n }\n if ($result > (int) 1E9) {\n return -1;\n }\n return $result;\n}", "function getMax($key, $array) {\r\n // Declare $maxValue\r\n $cardMax = 0;\r\n $maxValue = 0;\r\n /* Loop through the array, starting at the given\r\n index and ending at the last element in the\r\n array.*/\r\n for ($i = $key; $i > -1; $i--) {\r\n /* it will add the probability score for each index\r\n included in the loop*/\r\n $cardMax = $array[$i][3];\r\n $maxValue = $maxValue + $cardMax;\r\n }\r\n // and returns the max value for the key\r\n return $maxValue;\r\n }", "function getMaximumOutfits($outfits, $money) {\r\n // keep a queue of the currently selected outfits, track the longest queue\r\n $queue = [];\r\n $result = 0;\r\n $spent = 0;\r\n $length = 0;\r\n for ($i = 0; $i < count($outfits); $i++) {\r\n // add this outfit to the queue..\r\n $pick = $outfits[$i];\r\n $queue[] = $pick;\r\n $spent += $pick;\r\n $length++;\r\n\r\n // then leave stuff from the start of the queue until we're ok with $$$\r\n while ($spent > $money) {\r\n $leave = array_shift($queue);\r\n $spent -= $leave;\r\n $length--;\r\n }\r\n $result = max($result, $length);\r\n }\r\n\r\n return $result;\r\n}", "function solution($N) {\n $binStr = decbin($N);\n $binStr = preg_replace(['/^0+/', '/0+$/'], '',$binStr);\n $zeros = explode('1', $binStr);\n $zeros = array_map(function ($zero) {\n return strlen($zero);\n }, $zeros);\n return max($zeros);\n}", "function findSubsquare($inputs) {\n for ($i = count($inputs); $i > 0; $i --) {\n $ans = findSubsquareOfSize($inputs, $i);\n if ($ans) return $ans;\n }\n}", "function maxValLimit ($arr, $limit) {\n /* if no such value, or $arr is not an array, return -1 */\n if (is_array ($arr)) {\n sort ($arr); \n for ($i = count ($arr) - 1; $i >= 0; $i--) {\n if ($arr[$i] <= $limit) {\n return ($arr[$i]);\n break;\n }\n }\n }\n return (-1);\n}", "function maxDistToClosest($seats) {\n// foreach ($seats as $index => $seat) {\n// if ($seat == 1) {\n// $one[$idx] = $index;\n// $len[] = ($index - $one[$idx - 1]) / 2;\n// $start = $index;\n// $idx++;\n// }\n// }\n// return $start;\n// if (($seats[0] ^ $seats[count($seats) - 1] == 1) && (max($len) == $len[0]\n// || max($len) == $len[count($len) - 1])) {\n// return max(count($seats) - $start - 1, $start);\n// }\n// return floor(max($len));\n }", "function hourglassSum($arr) {\n\n for($i = 1; $i < 5; $i++)\n {\n for($j = 1; $j<5;$j++)\n {\n $temp = $arr[$i][$j] + $arr[$i-1][$j-1] + $arr[$i-1][$j] + $arr[$i-1][$j+1] +\n $arr[$i+1][$j-1] + $arr[$i+1][$j] + $arr[$i+1][$j+1];\n\n if(!isset($max) || $temp > $max)\n {\n $max = $temp;\n }\n }\n }\n return $max;\n}", "public function task5()\n {\n function solution($A, $K) {\n $N = count($A);\n\n for ($i = 0; $i < $N - 1; $i++) {\n if ($A[$i] + 1 < $A[$i + 1]) {\n return false;\n }\n }\n\n if ($A[0] != 1 && $A[$N - 1] != $K) {\n return false;\n }\n\n return true;\n }\n\n $A = [2,3]; $K = 2;\n// $A = [1,2,3]; $K = 2;\n// $A = [1,1,3]; $K = 2;\n\n dd($A, $K, solution($A, $K));\n }", "function getSum($list)\r\n{\r\n $sum = 0;\r\n for ($i=2; $i<count($list); $i++) {\r\n for ($k=0; $k<$i; $k++) {\r\n $tSum = 0;\r\n for ($j=$k; $j<count($list); $j+=$i) {\r\n $tSum += $list[$j];\r\n }\r\n if ($tSum > $sum) $sum = $tSum;\r\n }\r\n }\r\n\r\n return $sum;\r\n}", "function exibeAtualMax(){\n $nmin= (($this->atual * $this->numpage) - $this->numpage)+1;\n return $nmax= ($this->numpage + $nmin)-1;\n }", "public function test_githubIssue_2() : void\n {\n $obj = SubsetSum::create(44.6, array(22.4, 16.2, 10, 6));\n $obj->setPrecision(1);\n\n $this->assertNotEmpty($obj->getSum());\n $this->assertSame(array(6.0, 16.2, 22.4), $obj->getShortestMatch());\n }", "function largestFib($n){\n\t$memo = array();\n\treturn function($n) use ($memo){\n\t if(isset($memo[$n])){\n\t \treturn $memo[$n];\n\t } else {\n\t \treturn $memo[$n] = ($n > 1? largestFib($n-1) + largestFib($n-2) : $n);\n\t }\n\t};\n}", "function solution($A) {\r\n // time complexity O(n), array may be empty, elements are distinct integers in range [1...(N+1)]\r\n \r\n // calculate triangular number for N+1, then subtract the sum of the array\r\n \r\n // 100% first time!\r\n \r\n function triangular($n){\r\n return $n*($n + 1)/2;\r\n }\r\n \r\n $n = count($A);\r\n\r\n $plusOneSum = triangular($n+1);\r\n \r\n $sum = 0;\r\n \r\n for ($i = 0; $i <= $n - 1; $i++){\r\n $sum += $A[$i];\r\n }\r\n \r\n echo \"$plusOneSum $sum<br>\";\r\n \r\n return $plusOneSum - $sum;\r\n \r\n}", "function maximumToys($prices, $k)\n{\n sort($prices);\n $quantity = 0;\n foreach ($prices as $price) {\n $k -= $price;\n if ($k <= 0) {\n break;\n }\n\n $quantity++;\n }\n\n return $quantity;\n}", "function pancakeSort(&$arr, $n) \n{ \n\t// Start from the complete \n\t// array and one by one \n\t// reduce current size \n\t// by one \n\tfor ($curr_size = $n; $curr_size > 1; --$curr_size) \n\t{ \n\t\t// Find index of the \n\t\t// maximum element in \n\t\t// arr[0..curr_size-1] \n\t\t$mi = findMax($arr, $curr_size); \n\n\t\t// Move the maximum \n\t\t// element to end of \n\t\t// current array if \n\t\t// it's not already \n\t\t// at the end \n\t\tif ($mi != $curr_size-1) \n\t\t{ \n\t\t\t// To move at the end, \n\t\t\t// first move maximum \n\t\t\t// number to beginning \n\t\t\tflip($arr, $mi); \n\n\t\t\t// Now move the maximum \n\t\t\t// number to end by \n\t\t\t// reversing current array \n\t\t\tflip($arr, $curr_size-1); \n\t\t} \n\t} \n}", "function findPartition($arr , $count)\r\n{\r\n \r\necho\"<h1>INPUT ARRAY</h1>\";\r\nfor($i=0; $i<$count;$i++){\r\n echo \"<span>{$arr[$i]} </span>\";\r\n}\r\necho\"<br><br>\";\r\n \r\n$sum = 0;\r\n$i = $j = 0;\r\n// echo \"<pre>\";\r\n\r\n// // print_r($arr);\r\n\r\n// echo \"</pre>\";\r\n// Calculate sum of all elements\r\n// for ($i = 0; $i < $count; $i++){\r\n $sum = Array_sum($arr);\r\n echo \"<span><b>TOTAL ARRAY SUM</b>: \",$sum,\"</span><br>\";\r\n// }\r\n\r\nif ($sum % 2 != 0)\r\n{\r\n \r\n return 0;\r\n}\r\n$part = array(array());\r\n \r\n//echo $count . \"<br>\";\r\n// initialize top row as true\r\nfor ($i = 0; $i <= $count; $i++)\r\n $part[0][$i] = 1;\r\n\r\n// initialize leftmost column,\r\n// except part[0][0], as 0\r\nfor ($i = 1; $i <= $sum / 2; $i++)\r\n $part[$i][0] = 0;\r\n\r\n// Fill the partition table in bottom up manner\r\nfor ($i = 1; $i <= $sum / 2; $i++) {\r\n for ($j = 1; $j <= $count; $j++) {\r\n $part[$i][$j] = $part[$i][$j - 1];\r\n // echo \"i : \".$i . \"<br>\";\r\n // echo \"j : \".$j . \"<br>\";\r\n // echo \"part : \" .$part[$i][$j] .\"<br>\";\r\n \r\n if ($i >= $arr[$j - 1]){\r\n $part[$i][$j] = $part[$i][$j] || $part[$i - $arr[$j - 1]][$j - 1];\r\n if($part[$i][$j] == 0 && $part[$i - $arr[$j - 1]][$j - 1] == 0)\r\n {\r\n $part[$i][$j] = 0;\r\n }\r\n }\r\n }\r\n}\r\n\r\n // uncomment this part to print table\r\n// for ($i = 0; $i <= $sum/2; $i++)\r\n// {\r\n// for ($j = 0; $j <= $count; $j++){\r\n// echo $part[$i][$j];\r\n\r\n// }\r\n// echo \"<br>\";\r\n\r\n// } \r\necho \"<h1>OUTPUT TABLE</h1>\";\r\n\r\n// print_r($part);\r\n?>\r\n<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n <meta charset=\"UTF-8\">\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n <title>Document</title>\r\n <script>\r\n var i=0,j=0,k=0;\r\n \r\n function print_array(){\r\n var element = document.getElementsByClassName(\"hidden\");\r\n //var str1 = document.getElementsByClassName(\"st1\");\r\n console.log(element);\r\n element[0].classList.remove(\"hidden\");\r\n \r\n \r\n // var array_element = document.createTextNode(ary[i][j]);\r\n // parent.appendChild(array_element);\r\n // j++;\r\n // if(j == (ary[i].length))\r\n // {\r\n // j = 0;\r\n // i++;\r\n // counter++;\r\n // }\r\n // if(counter == ary.length)\r\n // {\r\n // $('button').prop(\"disabled\",\"true\");\r\n \r\n // }\r\n }\r\n</script>\r\n</head>\r\n<body>\r\n<script>\r\nfunction finalize(){\r\n var element = document.getElementsByClassName(\"hidden\");\r\n var count=element.length;\r\n for(var i = 0 ; i < count ; i++){\r\n element[0].classList.remove(\"hidden\");\r\n }\r\n }\r\n</script>\r\n <button id = 'show' onclick = \"print_array()\" >Next Iterations</button>\r\n <button id = 'show' onclick = \"finalize()\" >Finalize</button><br>\r\n</body>\r\n\r\n\r\n\r\n</html>\r\n<?php\r\necho \"</pre>\";\r\necho \"<table>\";\r\nfor ($i = 0; $i <= $sum / 2; $i++) {\r\n echo \"<tr >\";\r\n for ($j = 1; $j <= $count; $j++) {\r\n echo \"<td class = 'hidden'>{$part[$i][$j]}</td>\";\r\n }\r\n echo \"</tr>\";\r\n\r\n \r\n}\r\necho \"</table>\";\r\n\r\nreturn $part[$sum / 2][$count];\r\n}", "function getMaxArray ($array){\r\n // Get the max for each value and put those in an array\r\n for ($i = 0; $i < 10; $i++) {\r\n $maxArr[$i]= getMax($i, $array);\r\n }\r\n return $maxArr;\r\n}", "function code_solver($ivvallist) {\r\n\r\n// unpack the ivs\r\n$FL= $ivvallist[0];\r\n$L= $ivvallist[1];\r\n$df= $ivvallist[2];\r\n\r\n// run the solution code\r\n$Ltot= 2*$L +$df;\r\n$W= 10;\r\n\t\r\n$s1= 0.1;\r\n$a1= sqrt($L*$L -$s1*$s1);\r\n$d1= $Ltot -2*$a1;\r\n$T1= (1/$s1)*($W*$a1/2 +$FL*$a1);\r\n$k1= $T1/($d1-$df);\r\n\t\r\n$s2= 0.2;\r\n$a2= sqrt($L*$L -$s2*$s2);\r\n$d2= $Ltot -2*$a2;\r\n$T2= (1/$s2)*($W*$a2/2 +$FL*$a2);\r\n$k2= $T2/($d2-$df);\r\n\r\n$T3= $k1*($d2-$df);\r\n$FLmax= (1/$a2)*($T3*$s2 -$W*$a2/2);\r\n\r\n// pack the results\t\r\n$avvallist[0]= $k1;\t\t// av11\r\n$avvallist[1]= $k2;\t\t// av21\r\n$avvallist[2]= $FLmax;\t// av31\r\n\r\n// return to caller\r\nreturn $avvallist;\r\n}", "function find_movement_limits ($threshold_num, $threshold_mult, $array_size, $accumulator) {\n for ($i = 0; $i < $array_size; $i++) {\n sort($accumulator[$i], SORT_NUMERIC);\n $shortest = array_slice($accumulator[$i], 0, $threshold_num);\n $shortest_avg = array_sum($shortest)/count($shortest);\n // filter array based on upper limit\n $upper_limits[$i] = $shortest_avg*$threshold_mult;\n }\n return $upper_limits;\n}", "function Fannkuch($n){\n $check = 0;\n $perm = array();\n $perm1 = array();\n $count = array();\n $maxPerm = array();\n $maxFlipsCount = 0;\n $m = $n - 1;\n\n for ($i=0; $i<$n; $i++) $perm1[$i] = $i;\n $r = $n;\n\n while (TRUE) {\n // write-out the first 30 permutations \n if ($check < 30){\n for($i=0; $i<$n; $i++) echo $perm1[$i]+1; \n echo \"\\n\";\n $check++;\n }\n\n while ($r != 1){ $count[$r-1] = $r; $r--; } \n if (! ($perm1[0]==0 || $perm1[$m] == $m)){ \n for($i=0; $i<$n; $i++) $perm[$i] = $perm1[$i]; \n $flipsCount = 0;\n\n while ( !(($k=$perm[0]) == 0) ) {\n $k2 = ($k+1) >> 1;\n for($i=0; $i<$k2; $i++) {\n $temp = $perm[$i]; $perm[$i] = $perm[$k-$i]; $perm[$k-$i] = $temp;\n }\n $flipsCount++;\n }\n\n if ($flipsCount > $maxFlipsCount) {\n $maxFlipsCount = $flipsCount;\n for($i=0; $i<$n; $i++) $maxPerm[$i] = $perm1[$i];\n }\n } \n\n while (TRUE) { \n if ($r == $n) return $maxFlipsCount;\n $perm0 = $perm1[0];\n $i = 0;\n while ($i < $r) {\n $j = $i + 1;\n $perm1[$i] = $perm1[$j];\n $i = $j;\n }\n $perm1[$r] = $perm0;\n\n $count[$r] = $count[$r] - 1;\n if ($count[$r] > 0) break;\n $r++;\n }\n }\n}", "public function GetMaxSumWithoutAdjacent($input) {\n\t\t$length = count($input);\n\t\t$sumEvens = $sumOdds = 0;\n\t\t\n\t\tfor ($i=0 ; $i < $length; $i = $i+2) { \n\t\t\t$sumEvens += $input[$i];\n\t\t\tisset($input[$i+1]) && $sumOdds += $input[$i+1];\n\t\t}\n\n\t\techo $sumEvens > $sumOdds ? $sumEvens : $sumOdds;\n\t}", "function absoluteValuesSumMinimization($a) {\n $all_sum = [];\n for($i = 0; $i < count($a); $i++){\n $sum = 0;\n for($j = 0; $j < count($a); $j++){\n $sum += abs($a[$j] - $a[$i]);\n }\n $all_sum[$a[$i]] = $sum;\n }\n return array_search(min($all_sum), $all_sum);\n}", "function maxFibonacciValue($n){\n $fib = array(1, 2);\n for ($i=2; $i < $n; $i++) {\n $next = $fib[$i - 1] + $fib[$i - 2];\n if($next > $n){ break; }\n else{ array_push($fib, $next); }\n }\n return $fib;\n }", "abstract public function maxMax(): int;", "function recursif_count_load ($ind, $table, $load)\n{\n\t\t$maxload=$load;\n\t\t$current_start = $table[$ind][0];\n\t\t$current_end = $table[$ind][1];\n\t\t\n\t\tfor ($k=$ind+1; $k<=count($table); $k++){\n\t\t\tif ($table[$k][0]<= $current_end){\t\t\t\t\n\t\t\t\t$load = recursif_count_load ($k, $table, $load+1);\n\t\t\t\tif ($load > $maxload) $maxload=$load;\t\t\t\n\t\t\t}else{\n\t\t\t\tbreak;\t\t\t\n\t\t\t}\t\t\n\t\t}\n\t\tif ($k<count($table)) $load = recursif_count_load ($k, $table, $load);\n\t\tif ($load > $maxload) $maxload=$load;\n\t\treturn $maxload;\t\t\n}", "public function highest($arr)\n {\n $max = array_shift($arr);\n\n foreach ($arr as $key => $val) {\n if ($val > $max) {\n $max = $val;\n }\n }\n\n return $max;\n }", "function maxRouteVal($tri_graph)\n{\n\t$maxVal = 0;\n\tfor($i = 0; $i < count($tri_graph);++$i)\n\t{\n\t\t$row = $tri_graph[$i];\n\n\t\tfor($j = 0; $j < count($row);++$j)\n\t\t{\n\t\t\t$currVal = $row[$j]->sendValue();\n\t\t\tif($currVal > $maxVal)\n\t\t\t\t$maxVal = $currVal;\t\t\t\n\t\t}\n\n\t}\n\n\treturn $maxVal;\n\n}", "function maxscoreobtenidonocdmxedomex($idreg,$link,&$part) {\n $score=0;\n $consulta = \"select * from bdlt_participacion where id_registro=\".$idreg.\" and Estado not in('Mexico City','Estado de Mexico') order by score desc LIMIT 1;\";\n $ip= ($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 0;\n $date= date(\"Y-m-d H:i:s\");\n $comple='IP:['.$ip.'] Fecha['.$date.'] ejecucion:['.$consulta.']';\n writelog($comple);\n if ($resultado = mysqli_query($link, $consulta)) {\n while ($fila = mysqli_fetch_row($resultado)) {\n $part=$fila[0];\n $score=$fila[3];\n }\n /* liberar el conjunto de resultados */\n mysqli_free_result($resultado);\n }\n return $score;\n}", "protected function getMax() {\n\n\t\t$max = 0;\n\n\t\tif (!empty($this->tagsArray)) {\n\n\t\t\t$preAmount = 0;\n\n\t\t\tforeach ($this->tagsArray as $key => $value) {\n\n\t\t\t\t$currentAmount = $value['amount'];\n\t\t\t\tif ($currentAmount > $preAmount) {\n\t\t\t\t\t$max = $currentAmount;\n\t\t\t\t\t$preAmount = $currentAmount;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $max;\n\t}", "function maxscore_noun($id, $vibhakthi_number, $host, $uname, $pass, $dbname){\n\n\t/*\tCreate Connection \t*/\n\t$conn = new mysqli ($host,$uname,$pass,$dbname);\n\n\t$score = 0;\n\n\t$sql = $conn->query(\"SELECT \".$vibhakthi_number.\" from vibhakthi\".$id.\" WHERE no = 1\");\n\t$result = $sql->fetch_assoc();\n\t$noun1 = $result[$vibhakthi_number];\n\n\t$sql = $conn->query(\"SELECT \".$vibhakthi_number.\" from vibhakthi\".$id.\" WHERE no = 2\");\n\t$result = $sql->fetch_assoc();\n\t$noun2 = $result[$vibhakthi_number];\n\n\t$noun1 = explode(\" \", $noun1);\n\t$size1 = sizeof($noun1) - 1;\n\t$noun2 = explode(\" \", $noun2);\n\t$size2 = sizeof($noun2) - 1;\n\n\tif ($size1 > $size2){\n\t\tfor ($i=0; $i<$size1; $i++){\n\t\t\t$score += $GLOBALS['incr_noun'];\n\t\t}\n\t}\n\telse{\n\t\tfor ($i=0; $i<$size2; $i++){\n\t\t\t$score += $GLOBALS['incr_noun'];\n\t\t}\n\t}\n\n\t$conn->close();\n\n\treturn $score;\n}", "public function firstTask(array $arr){\n\n if ((!is_array($arr))|(count($arr)===0)){return false;}\n $max = $arr[0];\n foreach ($arr as $val){\n if ($max<$val){\n $max=$val;\n }\n }\n return $max;\n }", "function multiply(string $a, string $b): string {\n if($a == 0 || $b == 0) return \"0\";\n $a = ltrim($a, \"0\");\n $b = ltrim($b, \"0\");\n $top_matrix = str_split($a);\n $right_matrix = str_split($b);\n $WIDTH = strlen($a);\n $HEIGHT = strlen($b);\n $matrix = [];\n for($i = 0; $i < sizeof($top_matrix); $i++){\n $tmp =[];\n for($j = 0; $j < sizeof($right_matrix); $j++){\n $mul = intval($top_matrix[$i]) * intval($right_matrix[$j]);\n ($mul < 10) ? array_push($tmp,\"0\" . strval($mul)) : array_push($tmp, strval($mul));\n }\n array_push($matrix, $tmp);\n }\n\n $sums = [];\n $tmp = [];\n $entered = false;\n\n for($i = 0; $i <= $WIDTH + $HEIGHT - 2; $i++){\n $sum = 0;\n if($tmp != []) $sum = array_sum($tmp);\n $tmp = [];\n for($j = 0; $j <= $i; $j++){\n $entered = true;\n $x = $i - $j;\n if($x < $HEIGHT && $j < $WIDTH){\n $sum += (int)$matrix[$j][$x][0];\n array_push($tmp, (int)$matrix[$j][$x][1]);\n }\n \n }\n array_push($sums, $sum);\n }\n array_push($sums, array_sum($tmp));\n \n $result = [];\n $remainder = 0;\n $sums = array_reverse($sums);\n for($i = 0; $i < sizeof($sums); $i++){\n $current_value = $sums[$i] + $remainder;\n $remainder = 0;\n if($current_value > 9){\n $val = $current_value.\"\";\n $sums[$i] = (int)substr($val, -1);\n $remainder = (int)substr($val, 0, -1);\n }else{\n $sums[$i] = $current_value;\n }\n }\n $sums = array_reverse($sums);\n\n return ltrim(implode(\"\", $sums), \"0\");\n}", "public function sumNumbersB()\n {\n $suma = 0;\n $multiplos = [3, 5, 7];\n for($i = 1; $i<=1000; $i++)\n {\n foreach ($multiplos as $j)\n {\n if($i%$j !== 0)\n continue 2;\n }\n\n $suma = $suma + $i;\n\n }\n return $suma;\n }", "function findNumberOfPlaces($seq, $sem)//sequence and semester\n\t{\n\t\t$ret = 0;\n\t\tfor($b = 0; $b<count($seq[$sem]); $b++)\n\t\t{\n\t\t\tif(is_null($seq[$sem][$b]))\n\t\t\t\t$ret += 1;\n\t\t}\n\t\treturn $ret;\n\t}", "public static function maxCount($array, $max, $message = '');", "function max_from_right($values) {\n return array_reverse(max_from_left(array_reverse($values)));\n}", "protected function max_value() {\n $max = 0;\n foreach ($this->data_collections as $data_collection) {\n foreach ($data_collection->get_items() as $item) {\n if ($max < $item->get_value()) {\n $max = $item->get_value();\n }\n }\n }\n return $max;\n }", "protected function _getMax()\n {\n $max = 0;\n if (!empty($this->_tagsArray)) {\n $p_size = 0;\n foreach ($this->_tagsArray as $cKey => $cVal) {\n $c_size = $cVal['size'];\n if ($c_size > $p_size) {\n $max = $c_size;\n $p_size = $c_size;\n }\n }\n }\n return $max;\n }", "function getIndexOfWarmestDay($arr)\n{\n $result;\n $maxElRow = [];\n $indexMax = 0;\n if (count($arr) === 0) {\n return null;\n }\n foreach ($arr as $index => $row) {\n foreach ($row as $value) {\n $maxElement = max($row);\n } $maxElRow[] = $maxElement;\n } var_dump($maxElRow);\n $result = max($maxElRow);\n $indexMax = array_search($result, $maxElRow);\n return $indexMax;\n}", "function solution($arr, $int) {\n //\n}", "function get_highest($array, $key)\n {\n $n[$key] = -99999999999;\n foreach ($array as $value) {\n if ($value[$key] >= $n[$key]) {\n $n = $value;\n }\n }\n\n return $n;\n }", "function getEquilibriums($arr) {\n $output = array();\n\n # the sum of both the low & high number groups are set to 0, at the start of the outer loop\n for($i = 0; $i < count($arr); $i++) {\n $low = 0;\n $high = 0;\n echo \"\\n\\n** Loop #$i **\\n\";\n\n # Starting at the zero index of the array, this loop adds the sum of elements at lower indices\n for($x = 0; $x < $i; $x++) {\n $low += $arr[$x];\n echo \"low: $x\\n\";\n }\n\n # Starting at the last index of the array, this loop adds the sum of elements at higher indices\n for($y = count($arr) - 1; $y > $i; $y--) {\n $high += $arr[$y];\n echo \"high: $y\\n\";\n }\n\n # Checks if the sum of the high numbers is equal to the sum of the low numbers. If the sums are equal - the current index is confirmed as an equilibrium index.\n if($high === $low) {\n array_push($output,$i);\n }\n }\n\n # Prints message if no equilibrium indices are found\n if(count($output) == 0) {\n echo \"\\nNo equilibrium indices found\";\n return;\n }\n return $output;\n}", "function array_max($array)\n{\n if (empty($array)) {\n return null;\n }\n\n if (is_array($array)) {\n $max = $array[0];\n $tail = array_slice($array, 1);\n } else {\n $max = $array->current();\n $array->next();\n $tail = $array;\n }\n\n return array_reduce(\n $tail,\n function ($max, $value) {\n if ($value > $max) {\n return $value;\n } else {\n return $max;\n }\n },\n $max\n );\n}", "function sumate2(array $n,int $r) {\r\n if ($r < 0) {\r\n return 0;\r\n } else {\r\n print($n[$r]);\r\n print \"<br> \";\r\n return ($n[$r]) + sumate2($n, $r-1);\r\n }\r\n}", "public function maxIterations() {\n\t\treturn 1;\n\t}", "public function getMax();", "function leastBricks($wall=[]) { \r\n foreach ($wall as $key => $value) {\r\n for ($i = 0; $i < count($value) - 1; $i++) {\r\n\t\t//the maximum coincidence of the sums of bricks, means the maximum total boundary line\r\n $arr[] = array_sum(array_slice($value, 0, $i + 1));\r\n }\r\n }\r\n\t//the difference of all horizontal lines of bricks and the maximum coincident line will give an our solutuion\r\n return count($wall) - max(array_count_values($arr));\r\n}", "function getLastEdgeMaxRange($side1, $side2)\r\n{\r\n \r\n if ((!is_int($side1) || !is_int($side2)) || ($side1 <= 0 || $side2 <= 0)) {\r\n return \"Invalid sides, sides must be integer greater than 0, Try Again\";\r\n }\r\n\r\n // Get max length of triangle egd\r\n $result = $side1 + $side2 - 1;\r\n\r\n return $result;\r\n}", "function findMaxInArray($array){\n $max = $array[0];\n $key =0;\n for ($x = 0; $x < count($array); $x++){\n if ($max < $array[$x]){\n $max = $array[$x];\n $key = $x;\n };\n }\n return ['max'=>$max, 'key'=>$key];\n}", "static function countIn($value,$array,$max=null){\n\t\t$count = 0;\n\t\tforeach($array as $v){\n\t\t\tif($v == $value){\n\t\t\t\t$count++;\n\t\t\t\tif($max && $count == $max){\n\t\t\t\t\treturn $max;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $count;\n\t}", "function getMaxHours($start_year, $end_year, $start_month, $end_month, $start_day, $end_day, $start_hour, $end_hour){\n\t\t//Declaring arrays\n\t\t$HOURS_IN_DAY = 24;\n\t\t$hourly_array = accessData($start_year, $end_year, $start_month, $end_month, $start_day, $end_day, $start_hour, $end_hour);\n\t\t$all_hours_array = array();\n\t\t$max_array = array();\n\t\t\n\t\t//Initializing the array that will hold every single count for each hour. \n\t\tfor($i = 0; $i < $HOURS_IN_DAY; $i++){\n\t\t\t$all_hours_array[$i] = array();\n\t\t}\n\t\t\n\t\t//This creates an associative array, with all the results for a specific hour stored in an array contained within the associative array.\n\t\t//A value indicates how many people triggered the sensor for that specific time period (year, month, day, hour).\n\t\tforeach($hourly_array as $year => $temp1){\n\t\t\tforeach($hourly_array[$year] as $month => $temp2){\n\t\t\t\tforeach($hourly_array[$year][$month] as $day => $temp3){\n\t\t\t\t\tforeach($hourly_array[$year][$month][$day] as $hour => $value){\n\t\t\t\t\t\tarray_push($all_hours_array[$hour], $value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//This will sort each array for each hour value in ascending order, then it will set the maximum array value for that hour\n\t\t//by grabbing the first value for each array from $all_hours_array.\n\t\tfor($i = 0; $i < $HOURS_IN_DAY; $i++){\n\t\t\trsort($all_hours_array[$i]);\n\t\t\t$max_array[$i] = $all_hours_array[$i][0];\n\t\t}\n\t\t\n\t\t//Any values that are still null will be set to 0.\n\t\tfor($i = 0; $i < $HOURS_IN_DAY; $i++){\n\t\t\tif($max_array[$i] == NULL)\n\t\t\t\t$max_array[$i] = 0;\n\t\t}\n\t\t\n\t\treturn $max_array;\n\t}", "private function largestSeriesProduct($span): int\n {\n $products = [];\n for ($start = 0; $start <= $this->sequenceLength - $span; $start++) {\n $products[] = $this->multiplyStringSection(substr($this->digitSequence, $start, $span));\n }\n return max($products);\n }", "function totalfactura($array) {\n\n // Aca le colocamos el parametro $array a esta funcion para que recopile los datos de las funciones anteriores por eso si queremos que se recopilen este nuevo nuevo parametro debe llamarse igual que los parametros de las funciones para que se recopilen\n// como necesitamos la informacion anterior para hacer las operaciones, simplemente para no repetir de nuevo todo, llamamos a las demas funciones que hemos hecho\n\n// Llamamos las funciones dentro de nuevas variables para definirlas, esto para en $solucion nos viene bien\n\n $subtotal = subtotal($array); // Ahora como hemos actualizado y ahora la funcion tiene un nuevo parametro $array, por lo cual es importante que siempre pongamos los parametros que necesitemos// ejm: Si subtotal son 100euros\n // Asi llamamos a una funcion, por su nombre y () , dentro de () irian los parametros, si los hay se ponen, si no, pues no.\n $irpf = irpf($subtotal); // $irpf); Aqui no hemos llamado al parametro porque ya lo hemos definido en su funcion respectivamente // 100euros - 10(irpf/porcentaje)\n // como vemos la funcion irpf tiene como parametro la funcion subtotal, por lo cual como anteriormente ya la definimos en esta nueva funcion, entonces podemos colocarlo\n $iva = iva($subtotal);// $iva); // 100euros + 20(iva/porcentaje)\n\n $solucion = $subtotal - $irpf + $iva;\n\n return $solucion;\n\n }", "public function fourthTask(array $arr, $value){\n\n if (count($arr) === 0) return false;\n $low = 0;\n $high = count($arr) - 1;\n\n while ($low <= $high) {\n\n // compute middle index\n $mid = floor(($low + $high) / 2);\n\n // element found at mid\n if($arr[$mid] == $value) {\n return $mid;\n }\n\n if ($value < $arr[$mid]) {\n // search the left side of the array\n $high = $mid -1;\n }\n else {\n // search the right side of the array\n $low = $mid + 1;\n }\n }\n\n // If we reach here element value doesnt exist\n return -1;\n\n }", "function getSequenceSum($i, $j, $k) {\n $tmp = 0;\n for ($i; $i < $j; $i++) {\n $tmp += $i;\n }\n for ($k; $k < $j; $k++) {\n $tmp += $k;\n }\n return $tmp + $j;\n}", "function getTotalX($a, $b) {\n\n sort($a);\n sort($b);\n\n $minInA = $a[0];\n $maxInB = $b[count($b) - 1];\n $sizeA = count($a);\n $sizeB = count($b);\n\n $i = 1;\n $numbersBetween = 0;\n $factor = $minInA * $i;\n\n while ($factor <= $maxInB) {\n $allFactors = true;\n $divideAll = true;\n\n for ($j = 1; $j < $sizeA; $j++) {\n if ($factor % $a[$j] != 0) {\n $allFactors = false;\n break;\n }\n }\n\n for ($j = 0; $j < $sizeB; $j++) {\n if ($b[$j] % $factor != 0) {\n $divideAll = false;\n break;\n }\n }\n\n $numbersBetween += ($allFactors && $divideAll ? 1 : 0);\n $factor = $minInA * (++$i);\n }\n\n return $numbersBetween;\n\n}", "function getMaximumPoints()\n\t{\n\t\t$points = array();\n\t\tforeach ($this->answers as $answer)\n\t\t{\n\t\t\tif ($answer->getPoints() > 0)\n\t\t\t{\n\t\t\t\tarray_push($points, $answer->getPoints());\n\t\t\t}\n\t\t}\n\t\trsort($points, SORT_NUMERIC);\n\t\t$maxpoints = 0;\n\t\tfor ($counter = 0; $counter < $this->getCorrectAnswers(); $counter++)\n\t\t{\n\t\t\t$maxpoints += $points[$counter];\n\t\t}\n\t\treturn $maxpoints;\n\t}", "function sumOfMinAbsDifferences($arr, $n) \r\n\t{ \r\n\t\t \r\n\t\t// sort the given array \r\n\t\tsort($arr); \r\n\t\tsort( $arr,$n); \r\n\t\t \r\n\t\t// initialize sum \r\n\t\t$sum = 0; \r\n\t\t \r\n\t\t// min absolute difference for \r\n\t\t// the 1st array element \r\n\t\t$sum += abs($arr[0] - $arr[1]); \r\n\t\t \r\n\t\t// min absolute difference for \r\n\t\t// the last array element \r\n\t\t$sum += abs($arr[$n - 1] - $arr[$n - 2]); \r\n\t\t \r\n\t\t// find min absolute difference \r\n\t\t// for rest of the array elements \r\n\t\t// and add them to sum \r\n\t\tfor ($i = 1; $i < $n - 1; $i++) \r\n\t\t\t$sum += min(abs($arr[$i] - $arr[$i - 1]), \r\n\t\t\t\t\t abs($arr[$i] - $arr[$i + 1])); \r\n\t\t\t \r\n\t\t// required sum \r\n\t\treturn $sum; \r\n\t}", "public function getSolution(){\n\t\t$bulbs = array_fill(0, 100, false);\n\t\t\n\t\t//main logic\n\t\tfor ($i=1; $i < sizeof($bulbs); $i++) { \n\t\t\tfor ($j=0; $j < sizeof($bulbs); $j+=$i) { \n\t\t\t\t$bulbs[$j] = !$bulbs[$j];\t\n\t\t\t}\n\t\t}\n\n\t\t//array filter is used to filter only true values from the array.\n\t\treturn count(array_filter($bulbs));\n\t}", "public function GetMaxCount ();", "function solution($input)\n {\n $result = 1;\n\n $divisors_desc = array();\n $divisors_asc = array();\n $divisor_limit = $input;\n\n for($i = 2; $i < $divisor_limit; $i++){\n if($input % $i == 0){\n $divisor_limit = $input/$i;\n $divisors_desc[] = $divisor_limit;\n $divisors_asc[] = $i;\n }\n }\n //complexity O(n)\n \n $divisors = array_merge($divisors_desc,array_reverse($divisors_asc));\n print_r($divisors);\n\n //if no divisors exist, the number itself is prime\n if(count($divisors)==0){\n $result = $input;\n }\n\n //finding prime number in divisors list\n //starting from highest\n for($d = 0; $d < count($divisors); $d++)\n {\n $isPrime = true;\n $divisor_limit = $divisors[$d];\n\n //if any divisor is found, number is not prime\n for($x = 2; $x<$divisor_limit;$x++)\n {\n if($divisors[$d] % $x == 0){\n $isPrime = false;\n print_r($divisors[$d]. \"is not prime\\n divisor \". $x. \"\\n\");\n break;\n }\n }\n\n if($isPrime){\n $result = $divisors[$d];\n break;\n }\n }\n\n $solution = array();\n $solution['complexity'] = \"O(n2)\";\n $solution['result'] = $result;\n\n return $solution;\n }", "function get_Q($S,$R,$v=0.5)\n {\n //-- mencari nilai S_plus,S_min,R_plus dan R_min\n $S_plus=max($S);\n $S_min=min($S);\n $R_plus=max($R);\n $R_min=min($R);\n $Q=array();\n foreach($R as $i=>$r){\n $Q[$i]=$v*(($S[$i]-$S_min)/($S_plus-$S_min))+(1-$v)*(($R[$i]-$R_min)/($R_plus-$R_min));\n }\n return $Q;\n }", "function maxscoreobtenido($idreg,$link,&$part) {\n $score=0;\n $consulta = \"select * from bdlt_participacion where id_registro=\".$idreg.\" order by score desc LIMIT 1;\";\n $ip= ($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 0;\n $date= date(\"Y-m-d H:i:s\");\n $comple='IP:['.$ip.'] Fecha['.$date.'] ejecucion:['.$consulta.']';\n writelog($comple);\n if ($resultado = mysqli_query($link, $consulta)) {\n while ($fila = mysqli_fetch_row($resultado)) {\n $part=$fila[0];\n $score=$fila[3];\n }\n /* liberar el conjunto de resultados */\n mysqli_free_result($resultado);\n }\n return $score;\n}", "function HaarMaxPower($data) //input HaarPower result in frames\n {\n\t$max = $data[0]; //принимаем первый фрейм как минимальный\n\t$frames = count($data);\n\tforeach($data as $frame => $subvalue)\n\t foreach($subvalue as $order => $value)\n\t\tif ($max[$order] < $value) $max[$order] = $value;\n\treturn $max;\n }", "function calcCorrectAnswer($array)\n{\n\t$isZero = true;\n\tforeach ($array as $i){\n\t\tif($i > 0) $isZero = false;\n\t}\n\tif ($isZero) return 0;\n\n\treturn array_keys($array, max($array))[0] + 1;\n}", "function Count_Max_Reattempts($schedule, $origin_id=null)\n{\n\tstatic $recursion_level;\n\tif (empty($origin_id))\n\t{\n\t\t$max_level = 0;\n\t\t$reatt_count = 0;\n\t\tfor($x = 0; $x < count($schedule); $x++)\n\t\t{\n\t\t\t$e = $schedule[$x];\n\t\t\t$recursion_level = 1;\n\t\t\tif ($e->origin_id !== NULL && $e->origin_id > 0)\n\t\t\t{\n\t\t\t\t$reatt_count = max($reatt_count, Count_Max_Reattempts($schedule, $e->origin_id));\n\t\t\t\t$recursion_level--;\n\t\t\t\tif($recursion_level > $max_level) $max_level = $recursion_level;\n\t\t\t}\n\t\t}\n\t\t//return $reatt_count;\n\t\treturn $max_level;\n\t}\n\telse\n\t{\n\t\t$recursion_level++;\n\t\tfor($i = 0; $i < count($schedule); $i++)\n\t\t{\n\t\t\t$e = $schedule[$i];\n\t\t\tif ($e->transaction_register_id === $origin_id)\n\t\t\t{\n\t\t\t\tif ($e->origin_id === NULL) return 0;\n\t\t\t\telse return (Count_Max_Reattempts($schedule, $e->origin_id) + 1);\n\t\t\t}\n\t\t}\n\t}\n}", "function test()\r\n {\r\n\t\techo $this->maxCoins([3,1,5,8]).PHP_EOL;\r\n\t\techo $this->maxCoins([9,76,64,21,97,60]).PHP_EOL;\t\t\r\n }", "function languagelesson_calc_page_maxscore($pageid) {\n global $DB;\n if (!$pageid) {\n error('The pageid is empty!');\n break;\n } else {\n $page = $DB->get_record('languagelesson_pages', array('id'=>$pageid));\n if ($page->qtype == LL_SHORTANSWER) {\n // Find the answer with the highest score and use that for $maxscore.\n $scores = $DB->get_fieldset_select('languagelesson_answers', 'score', 'pageid = ?', array($pageid));\n rsort($scores, SORT_NUMERIC);\n $maxscore = $scores[0];\n } else if ($page->qtype == LL_MULTICHOICE && $page->qoption == 0) {\n // Find the answer with the highest score and use that for $maxscore.\n if ($scores = $DB->get_fieldset_select('languagelesson_answers', 'score', 'pageid = ?', array($pageid))) {\n rsort($scores, SORT_NUMERIC);\n $maxscore = $scores[0];\n } else {\n // If there are no answer records, change it to a Description type question and set maxscore to 0.\n $page->qtype == 1;\n $DB->update_record('languagelesson_pages', $page);\n $maxscore = 0;\n }\n } else if ($page->qtype == LL_BRANCHTABLE) {\n $maxscore = (int)0;\n } else if ($page->qtype == LL_DESCRIPTION) {\n $maxscore = (int)0;\n } else if ($page->qtype == LL_ENDOFBRANCH) {\n $maxscore = (int)0;\n } else {\n $scores = array();\n $scores = $DB->get_fieldset_select(\"languagelesson_answers\", 'score', 'pageid = ?', array($pageid));\n $maxscore = 0;\n foreach ($scores as $value) {\n $maxscore += $value;\n }\n \n }\n return $maxscore;\n }\n}", "public function getMaxBaths();", "public function sumMaxScoreOfReport($dateStart, $dateEnd);" ]
[ "0.8007989", "0.79851335", "0.6944018", "0.637297", "0.59953517", "0.5988412", "0.59877753", "0.5943928", "0.57496715", "0.5673573", "0.5635653", "0.56223387", "0.55939406", "0.55181825", "0.54633176", "0.54430175", "0.5437487", "0.5400719", "0.53926146", "0.5384839", "0.52953124", "0.528738", "0.5243287", "0.5224656", "0.5216112", "0.5205185", "0.52043056", "0.5197134", "0.5186883", "0.51513755", "0.5142678", "0.51294714", "0.5050246", "0.5034845", "0.50248486", "0.5023823", "0.5004147", "0.4964465", "0.49503174", "0.49449375", "0.49350068", "0.48824126", "0.48648313", "0.48442096", "0.4836235", "0.48318082", "0.48176983", "0.47946995", "0.47944018", "0.47457916", "0.4729167", "0.4712703", "0.47125515", "0.47029293", "0.47019902", "0.46971992", "0.46963084", "0.4667407", "0.46636996", "0.46495503", "0.46416354", "0.46380672", "0.46335977", "0.4624306", "0.46231338", "0.46191284", "0.46158275", "0.461038", "0.4603839", "0.46016783", "0.4583463", "0.4580036", "0.45711538", "0.4564307", "0.45636255", "0.4533876", "0.45307273", "0.45181853", "0.45119637", "0.45084777", "0.45069516", "0.44881797", "0.44810683", "0.44781655", "0.4473973", "0.44739503", "0.44731236", "0.44702646", "0.44690934", "0.44688135", "0.44627658", "0.44572663", "0.44469833", "0.44396058", "0.44322246", "0.4431839", "0.44310728", "0.44285086", "0.44275147", "0.4424892" ]
0.7979368
2
echo getMaxSumSubSequence($arr, 0, 5); The following algorithm solves the problem with time complexity O(N^3) and it's not so efficient because it computes partial sums many times.
function getSubseqSum( $arr ) { $N = count($arr) - 1; $bestSum = 0; $posBest = -1; for($i = 0; $i <= $N; $i++) { for($j = $N; $j >= $i; $j--) { $partialSum = 0; for($k = $i; $k <= $j; $k++) { $partialSum += $arr[ $k ]; } if($partialSum > $bestSum) { $bestSum = $partialSum; } } } return $bestSum; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSubseqMaxSum( $arr ) {\n\n //firstly we determine the number of the elements\n $N = count($arr) - 1;\n\n $sumMax = -999;\n\n $iMax = -1; $jMax = -1; \n\n //for i = 0 to N execute\n for($i = 0; $i <= $N; $i++) {\n\n $sum = 0;\n\n for($j = $i;$j <= $N; $j++) {\n\n $sum = $sum + $arr[ $j ]; \n\n if($sum > $sumMax) {\n\n $sumMax = $sum;\n $iMax = $i;\n $jMax = $j;\n }\n\n }\n\n } \n\n return array(\"sumMax\"=>$sumMax, \n \"i\"=>$iMax,\n \"j\"=>$jMax);\n}", "function getMaxSumSubSequence($arr, $li, $ls) {\n\n if($li == $ls) return $arr[ $li ];\n\n $middle = intval(($li+$ls)/2);\n\n\n $bestL = getMaxSumSubSequence($arr, $li, $middle);\n $bestR = getMaxSumSubSequence($arr, $middle+1,$ls);\n\n $maxSuf = -9999; \n $maxPre = -9999;\n\n $suf = 0;\n for($i = $middle;$i >= $li; $i--) {\n\n $suf += $arr[$i]; \n\n if($suf > $maxSuf) {\n $maxSuf = $suf;\n } \n } \n\n $pre = 0;\n for($j = $middle+1;$j <= $ls; $j++) {\n\n $pre += $arr[$j];\n\n if($pre > $maxPre) {\n $maxPre = $pre;\n }\n } \n\n\n return max($bestL, max($bestR, ($maxSuf + $maxPre) )); \n}", "function getSumSeq( $arr ) {\n\n $N = count($arr) - 1;\n \n $sum = array();\n\n $sum[ 0 ] = $arr[ 0 ];\n\n for($i = 1; $i <= $N; $i++) {\n\n $sum[ $i ] = $arr[ $i ] + $sum[ $i - 1 ]; \n } \n\n $bestSum = 0;\n\n $best = array();\n\n $best[ 0 ] = $sum[ 0 ];\n\n $min = $sum[ 0 ];\n \n for($i = 1; $i <= $N; $i++) {\n\n $best[ $i ] = $sum[ $i ] - $min;\n\n if($sum[ $i ] < $min) {\n\n $min = $sum[ $i ];\n } \n\n if($bestSum < $best[ $i ]) {\n\n $bestSum = $best[ $i ]; \n $pos = $i;\n }\n } \n\n return array(\"bestsum\"=>$bestSum, \n \"pos\"=>$pos);\n}", "function miniMaxSum($arr) {\n\t$sum = [];\n\n\tfor($i = 0; $i < 5; $i++)\n\t{\n\t\t$tempArray = $arr;\n\t\tunset($tempArray[$i]);\n\t\t$sum[] = array_sum($tempArray);\n\t}\n\tprint min($sum).\" \".max($sum);\n}", "function miniMaxSum($arr) {\n $allSums = [];\n for ($i = 0; $i < count($arr); $i++) {\n $tmpArray = $arr;\n unset($tmpArray[$i]);\n $allSums[] = array_sum($tmpArray);\n }\n\n print min($allSums) . ' ' . max($allSums);\n}", "function miniMaxSum($arr) {\n // Write your code here\n sort($arr);\n $total = array_sum($arr);\n $newsum = []; \n for ($i = 0; $i < count($arr); $i++) {\n $newsum[] = $total-$arr[$i];\n }\n $min = min($newsum);\n $max = max($newsum);\n \n echo $min.' '.$max;\n\n}", "function solution($N, $A)\n{\n // Initial array which length is N for saving final result\n $result_arr = array_fill(0, $N, 0);\n \n // Solution:\n // what we did is using $current_big_val to save current biggest value in result array\n // we empty result array when $A[$i] === $N1 which is max counter\n // when empty result array we will add $current_big_val to $addition_val\n // so we only need to record those steps which after final max counter\n // and add $addition_val to each element\n\n // e.g $N = 5, $A = [3, 4, 4, 6, 1, 4, 4]\n // So $N1 = 6 and the original steps should look like below\n // (0, 0, 1, 0, 0) $A[0] !== $N1\n // (0, 0, 1, 1, 0) $A[1] !== $N1\n // (0, 0, 1, 2, 0) $A[2] !== $N1\n // (2, 2, 2, 2, 2) $A[3] === $N1, max counter\n // (3, 2, 2, 2, 2) $A[4] !== $N1\n // (3, 2, 2, 3, 2) $A[5] !== $N1\n // (3, 2, 2, 4, 2) $A[6] !== $N1\n\n // Our steps will be like this\n // (0, 0, 1, 0, 0) $A[0] !== $N1, $current_big_val = 1, $addition_val = 0\n // (0, 0, 1, 1, 0) $A[1] !== $N1, $current_big_val = 1, $addition_val = 0\n // (0, 0, 1, 2, 0) $A[2] !== $N1, $current_big_val = 2, $addition_val = 0\n // (0, 0, 0, 0, 0) $A[3] === $N1, max counter so empty array, $current_big_val = 0, $addition_val = 2\n // (1, 0, 0, 0, 0) $A[4] !== $N1\n // (1, 0, 0, 1, 0) $A[5] !== $N1\n // (1, 0, 0, 2, 0) $A[6] !== $N1\n // add $addition_val which is 2 to each element\n // (3, 2, 2, 4, 2)\n \n $len = count($A);\n $N1 = $N + 1;\n $current_big_val = 0;\n $addition_val = 0;\n \n for ($i = 0; $i < $len; $i++) {\n if ($A[$i] === $N1) {\n $result_arr = array();\n $addition_val += $current_big_val;\n $current_big_val = 0;\n } else {\n if (!isset($result_arr[$A[$i] - 1])) {\n $result_arr[$A[$i] - 1] = 0;\n }\n \n $result_arr[$A[$i] - 1] ++;\n \n if ($current_big_val < $result_arr[$A[$i] - 1]) {\n $current_big_val = $result_arr[$A[$i] - 1];\n }\n }\n }\n \n for ($i=0; $i<$N; $i++) {\n $result_arr[$i] = !isset($result_arr[$i]) ? $addition_val : $result_arr[$i] + $addition_val;\n }\n \n return $result_arr;\n}", "function getSumV2($list)\r\n{\r\n $cache = [];\r\n for ($i=0; $i<count($list); $i++) {\r\n array_push($cache, 0);\r\n }\r\n\r\n $cache[0] = max($cache[0], $list[0]);\r\n $cache[1] = max($cache[0], $list[1]);\r\n\r\n for ($i=2; $i<count($list); $i++) {\r\n $cache[$i] = max(($list[$i] + $cache[$i-2]), $cache[$i-1]);\r\n }\r\n return $cache[$i-1];\r\n}", "function miniMaxSum(array $arr)\n{\n $sum = array_sum($arr);\n printf(\"%d %d\", $sum - max($arr), $sum - min($arr));\n}", "function solution(array $a) {\n $count = count($a);\n\n $sums = [0 => $a[0]];\n $sums_r = [];\n $sums_r[$count-1] = $a[$count-1];\n\n for ($i=1; $i<count($a); $i++) {\n $sums[$i] = $sums[$i-1] + $a[$i];\n $sums_r[$count-$i-1] = $sums_r[$count-$i] + $a[$count-$i-1];\n }\n $diffs = [];\n\n for ($i=1; $i<$count; $i++) {\n $diffs[] = abs($sums[$i-1] - $sums_r[$i]);\n }\n\n return min($diffs);\n}", "function solution($N, $A) {\n $counters = array_fill(1, $N, 0);\n $currentMax = 0;\n foreach ($A as $v) {\n if ($v >= 1 && $v <= $N) {\n $counters[$v] += 1;\n if ($counters[$v] > $currentMax) {\n $currentMax = $counters[$v];\n }\n }\n else if ($v === ($N + 1)) {\n $counters = array_fill(1, $N, $currentMax);\n }\n }\n return array_values($counters);\n}", "function solution($N, $A) {\n $m = count($A);\n\n // init counters\n $C = array();\n for ($i = 0; $i < $N; $i++) {\n $C[$i] = 0;\n }\n\n $max = 0;\n $minC = 0; // maximized helper value\n foreach ($A as $ai) {\n if ($ai <= $N) {\n /*\n * increase operation\n */\n // even the value\n if($C[$ai - 1] < $minC) {\n $C[$ai - 1] = $minC;\n }\n // actual increase\n $C[$ai - 1] ++;\n // calculate max\n if ($max < $C[$ai - 1]) {\n $max = $C[$ai - 1];\n }\n } elseif ($ai == $N + 1) {\n // do not actual increase to speed up operations\n $minC = $max;\n }\n }\n // even the values\n foreach($C as &$ci) {\n if($ci < $minC) {\n $ci = $minC;\n }\n }\n return $C;\n}", "function solution(array $A) {\n $result = $started = 0;\n foreach ($A as $d) {\n if ($d === 0) {\n $started++;\n } else if ($d === 1 and $started > 0) {\n $result += $started;\n }\n }\n if ($result > (int) 1E9) {\n return -1;\n }\n return $result;\n}", "function solution($A) {\r\n // time complexity O(n), array may be empty, elements are distinct integers in range [1...(N+1)]\r\n \r\n // calculate triangular number for N+1, then subtract the sum of the array\r\n \r\n // 100% first time!\r\n \r\n function triangular($n){\r\n return $n*($n + 1)/2;\r\n }\r\n \r\n $n = count($A);\r\n\r\n $plusOneSum = triangular($n+1);\r\n \r\n $sum = 0;\r\n \r\n for ($i = 0; $i <= $n - 1; $i++){\r\n $sum += $A[$i];\r\n }\r\n \r\n echo \"$plusOneSum $sum<br>\";\r\n \r\n return $plusOneSum - $sum;\r\n \r\n}", "function getSum($list)\r\n{\r\n $sum = 0;\r\n for ($i=2; $i<count($list); $i++) {\r\n for ($k=0; $k<$i; $k++) {\r\n $tSum = 0;\r\n for ($j=$k; $j<count($list); $j+=$i) {\r\n $tSum += $list[$j];\r\n }\r\n if ($tSum > $sum) $sum = $tSum;\r\n }\r\n }\r\n\r\n return $sum;\r\n}", "function solution($A) {\n $return = 0;\n \n $N = count($A);\n $left = [];\n $right = [];\n \n for ($i=0; $i<$N; $i++) {\n $left[] = $A[$i] + $i;\n $right[] = -($A[$i] - $i);\n }\n \n sort($left);\n sort($right);\n \n for($i=0; $i<$N-1; $i++) {\n $val = $left[$i];\n $pos = binary_search($val, $right);\n $return += $N - $pos - 1;\n }\n \n return $return;\n}", "function findMax($arr, $n) \n{ \n\t$mi = 0; \n\tfor ($i = 0; $i < $n; ++$i) \n\t\tif ($arr[$i] > $arr[$mi]) \n\t\t\t\t$mi = $i; \n\treturn $mi; \n}", "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 solution($N) {\n $binStr = decbin($N);\n $binStr = preg_replace(['/^0+/', '/0+$/'], '',$binStr);\n $zeros = explode('1', $binStr);\n $zeros = array_map(function ($zero) {\n return strlen($zero);\n }, $zeros);\n return max($zeros);\n}", "function hourglassSum($arr) {\n\n for($i = 1; $i < 5; $i++)\n {\n for($j = 1; $j<5;$j++)\n {\n $temp = $arr[$i][$j] + $arr[$i-1][$j-1] + $arr[$i-1][$j] + $arr[$i-1][$j+1] +\n $arr[$i+1][$j-1] + $arr[$i+1][$j] + $arr[$i+1][$j+1];\n\n if(!isset($max) || $temp > $max)\n {\n $max = $temp;\n }\n }\n }\n return $max;\n}", "function euler009(int $sum): int\n{\n for ($a = 1; $a <= $sum - (2 * $a + 3); $a++) {\n for ($b = $a + 1; $b <= $sum - ($b + 1); $b++) {\n $c = $sum - ($a + $b);\n if ($a ** 2 + $b ** 2 == $c ** 2) {\n // The problem statement guarantees that this will be reached\n return $a * $b * $c;\n }\n }\n }\n}", "function MaximalSquare($matrix,$rows,$cols){\n $sum =array();\n\n //set the first column of sum matrix\n for($i=0;$i< $rows;$i++){\n $sum[$i][0]= $matrix[$i][0];\n }\n //set the first row of sum matrix\n for($j=0;$j < $cols;$j++){\n $sum[0][$j] = $matrix[0][$j];\n }\n\n for($i=1;$i<$rows;$i++){\n for($j=1;$j<$cols;$j++){\n if($matrix[$i][$j] == 1){\n $sum[$i][$j]= minimum($sum[$i][$j-1],$sum[$i-1][$j],$sum[$i-1][$j-1])+1;\n }else{\n $sum[$i][$j]=0;\n }\n }\n }\n\n $max_of_sum =$sum[0][0];\n $max_i = 0;\n $max_j = 0;\n\n for($i=0;$i<$rows;$i++){\n for($j=0;$j<$cols;$j++){\n if($max_of_sum < $sum[$i][$j]){\n $max_of_sum=$sum[$i][$j];\n $max_i = $i;\n $max_j = $j;\n }\n }\n }\n $square_matrix = array();\n for($i=$max_i;$i > ($max_i -$max_of_sum);$i--){\n for($j=$max_j;$j > ($max_j - $max_of_sum);$j--){\n $square_matrix[$i][$j] = $matrix[$i][$j];\n }\n }\n\n return $square_matrix;\n}", "function arrayManipulation($number, $queries) {\n\n $array=[];\n for ($index = 0; $index < count($queries); $index++)\n {\n $array[$queries[$index][0]-1]=0;\n $array[$queries[$index][1]]=0;\n }\n for ($index = 0; $index < count($queries); $index++)\n {\n $a= $queries[$index][0];\n $b= $queries[$index][1];\n $k= $queries[$index][2];\n $array[$a-1] += $k;\n $array[$b] -= $k;\n }\n\n $sum=0;\n $max=0;\n for ($index = 0; $index < $number; $index++)\n {\n @$sum += $array[$index];\n if ($sum > $max)\n $max = $sum;\n }\n return $max;\n}", "function sum_of_3_and_5() {\n\n /*\n * Algorithmic solution\n * count of multiples of 3 = 1000 / 3 = 333;\n * count of multiples of 5 = 1000 / 5 = 199;\n *\n * sum of multiplies of 3\n * 1 * 3 + 2 * 3 + ... + 333 * 3 = 3 * (1 + ... + 333) = 3 * 333 * (333 + 1) / 2\n * sum of multiplies of 5\n * 1 * 5 + 2 * 5 + ... + 199 * 5 = 5 * (1 + ... + 199) = 5 * 199 * (199 + 1) / 2\n *\n * sum = 166833 + 99500 = 266333\n *\n */\n\n $sum = 0;\n for($i = 3; $i < 1000; $i += 3) {\n $sum += $i;\n }\n\n for($i = 5; $i < 1000; $i += 5) {\n $sum += $i;\n }\n\n return $sum; // 266333\n}", "function findSubsquare($inputs) {\n for ($i = count($inputs); $i > 0; $i --) {\n $ans = findSubsquareOfSize($inputs, $i);\n if ($ans) return $ans;\n }\n}", "function minimumBribes($q)\n{\n $stepsCount = 0;\n $bribesCounts = [];\n $arrayLength = sizeOf($q)-1;\n $swapCntPerRound = 0;\n for ($i = 0; $i < $arrayLength; $i++) {\n if ($q[$i] > $q[$i+1]) {\n if (!isset($bribesCounts[$q[$i]])) {\n $bribesCounts[$q[$i]] = 0;\n }\n\n $bribesCounts[$q[$i]]++;\n\n if ($bribesCounts[$q[$i]] > 2) {\n //echo 'Too chaotic', PHP_EOL;\n return \"Too chaotic\";\n }\n\n $stepsCount++;\n $swapCntPerRound++;\n list($q[$i+1], $q[$i]) = [$q[$i], $q[$i+1]];\n }\n\n if ($i == $arrayLength-1 && $swapCntPerRound > 0) {\n $i = -1;\n $swapCntPerRound = 0;\n }\n }\n\n //echo array_sum($bribesCounts), PHP_EOL;\n return array_sum($bribesCounts);\n}", "public function GetMaxSumWithoutAdjacent($input) {\n\t\t$length = count($input);\n\t\t$sumEvens = $sumOdds = 0;\n\t\t\n\t\tfor ($i=0 ; $i < $length; $i = $i+2) { \n\t\t\t$sumEvens += $input[$i];\n\t\t\tisset($input[$i+1]) && $sumOdds += $input[$i+1];\n\t\t}\n\n\t\techo $sumEvens > $sumOdds ? $sumEvens : $sumOdds;\n\t}", "function getSequenceSum($i, $j, $k) {\n $tmp = 0;\n for ($i; $i < $j; $i++) {\n $tmp += $i;\n }\n for ($k; $k < $j; $k++) {\n $tmp += $k;\n }\n return $tmp + $j;\n}", "function SumSize($a) {\n\n $n = count($a); // ??????????? ??????? ? ????????? (???? ?????? ?????? 3 ??. ????? ??????????? ????? ?? 2 ??????!!!)\n\n for ($i3 = 1; $i3 < $n; $i3++) {\n // ????????????? ??????? ?? ????????\n for ($i2 = $i3 - 1; $i2 < $n; $i2++) {\n for ($i = 0; $i <= 1; $i++) {\n if ($a[$i2]['X'] < $a[$i2]['Y']) {\n $a1 = $a[$i2]['X'];\n $a[$i2]['X'] = $a[$i2]['Y'];\n $a[$i2]['Y'] = $a1;\n };\n if (($i == 0) and ($a[$i2]['Y'] < $a[$i2]['Z'])) {\n $a1 = $a[$i2]['Y'];\n $a[$i2]['Y'] = $a[$i2]['Z'];\n $a[$i2]['Z'] = $a1;\n }\n }\n $a[$i2]['Sum'] = $a[$i2]['X'] + $a[$i2]['Y'] + $a[$i2]['Z']; // ????? ??????\n }\n\n // ????????????? ????? ?? ???????????\n for ($i2 = $i3; $i2 < $n; $i2++)\n for ($i = $i3; $i < $n; $i++)\n if ($a[$i - 1]['Sum'] > $a[$i]['Sum']) {\n $a2 = $a[$i];\n $a[$i] = $a[$i - 1];\n $a[$i - 1] = $a2;\n }\n\n // ????????? ????? ????????? ???? ????? ????????? ??????\n if ($a[$i3 - 1]['X'] > $a[$i3]['X']) {\n $a[$i3]['X'] = $a[$i3 - 1]['X'];\n }\n if ($a[$i3 - 1]['Y'] > $a[$i3]['Y']) {\n $a[$i3]['Y'] = $a[$i3 - 1]['Y'];\n }\n $a[$i3]['Z'] = $a[$i3]['Z'] + $a[$i3 - 1]['Z'];\n $a[$i3]['Sum'] = $a[$i3]['X'] + $a[$i3]['Y'] + $a[$i3]['Z']; // ????? ??????\n }\n\n //?????????\n //echo '<br>( '.Round($a[$n-1]['X'],2).' '.Round($a[$n-1]['Y'],2).' '.Round($a[$n-1]['Z'],2).' )';\n\n return (array('length' => Round($a[$n - 1]['X'], 2), 'width' => Round($a[$n - 1]['Y'], 2), 'height' => Round($a[$n - 1]['Z'], 2)));\n }", "function solution($A) {\n // write your code in PHP7.0\n $idxes = [];\n $C = [];\n $L = count($A);\n $mid = floor($L/2);\n\n foreach ($A as $k=>$v) {\n if (!isset($C[$v])) {\n $idxes[$v] = [];\n $C[$v] = 0;\n }\n\n $C[$v] += 1;\n array_push($idxes[$v], $k);\n\n if ($C[$v] > $mid) {\n $rIdx = $v;\n }\n }\n\n // No leader\n if (!isset($rIdx)) {\n return 0;\n }\n \n $leaderIndexes = $idxes[$rIdx];\n // print_r($leaderIndexes);\n $leaderTotal = count($leaderIndexes);\n $eCount = 0;\n for ($i = 0; $i < $leaderTotal; $i++) {\n $leaderIndex = $leaderIndexes[$i];\n $taCount = $leaderIndex + 1;\n \n $taMid = floor($taCount / 2);\n // $i + 1 is the count of leaders so far\n if ($i+1 > $taMid){\n $tbCount = $L - $taCount;\n $leftLeaders = $leaderTotal - ($i + 1); \n // print \"\\$i: $i, \\$leaderIndex: $leaderIndex, \\$taCount: $taCount, \\$tbCount: $tbCount, \\$leftLeaders: $leftLeaders \\r\\n\";\n if ($leftLeaders > floor($tbCount / 2)) {\n $eCount++;\n }\n\n // borrow from left for list like [4, 4, 2, 5, 3, 4, 4, 4];\n if ($i + 1 > floor(($taCount + 1) / 2) && $i+1 < $leaderTotal && $leaderIndexes[$i+1] != $leaderIndexes[$i] + 1 && $leftLeaders > floor(($tbCount - 1) / 2)) {\n $eCount++;\n }\n } \n }\n\n return $eCount;\n}", "function absoluteValuesSumMinimization($a) {\n $all_sum = [];\n for($i = 0; $i < count($a); $i++){\n $sum = 0;\n for($j = 0; $j < count($a); $j++){\n $sum += abs($a[$j] - $a[$i]);\n }\n $all_sum[$a[$i]] = $sum;\n }\n return array_search(min($all_sum), $all_sum);\n}", "function hasTwoSum($array, $t)\n{\n $j = 0;\n $k = count($array) - 1;\n\n while ($j <= $k) {\n if ($array[$j] + $array[$k] == $t) {\n return true;\n } elseif ($array[$j] + $array[$k] < $t) {\n $j++;\n } else {\n $k--;\n }\n }\n\n return false;\n}", "function getEquilibriums($arr) {\n $output = array();\n\n # the sum of both the low & high number groups are set to 0, at the start of the outer loop\n for($i = 0; $i < count($arr); $i++) {\n $low = 0;\n $high = 0;\n echo \"\\n\\n** Loop #$i **\\n\";\n\n # Starting at the zero index of the array, this loop adds the sum of elements at lower indices\n for($x = 0; $x < $i; $x++) {\n $low += $arr[$x];\n echo \"low: $x\\n\";\n }\n\n # Starting at the last index of the array, this loop adds the sum of elements at higher indices\n for($y = count($arr) - 1; $y > $i; $y--) {\n $high += $arr[$y];\n echo \"high: $y\\n\";\n }\n\n # Checks if the sum of the high numbers is equal to the sum of the low numbers. If the sums are equal - the current index is confirmed as an equilibrium index.\n if($high === $low) {\n array_push($output,$i);\n }\n }\n\n # Prints message if no equilibrium indices are found\n if(count($output) == 0) {\n echo \"\\nNo equilibrium indices found\";\n return;\n }\n return $output;\n}", "static function getMultiples(int ...$numbers) : int\n {\n $numbers = array_values($numbers);\n asort($numbers);\n\n $last = $numbers[count($numbers) - 1];\n $multiples = 0;\n\n for ($i = 5; $i <= $last; $i += 5) {\n if (in_array($i, $numbers)) {\n $multiples++;\n }\n }\n\n return $multiples;\n }", "function math_combination($arr, $num)\n{\n if ($num == 0) {\n return [[]];\n }\n $cnt = count($arr);\n $result = [];\n for ($i = 0; $i < $cnt; $i++) {\n $subs = math_combination(array_slice($arr, $i + 1), $num - 1);\n foreach ($subs as $s) {\n $result[] = array_merge([$arr[$i]], $s);\n }\n }\n return $result;\n}", "function largestFib($n){\n\t$memo = array();\n\treturn function($n) use ($memo){\n\t if(isset($memo[$n])){\n\t \treturn $memo[$n];\n\t } else {\n\t \treturn $memo[$n] = ($n > 1? largestFib($n-1) + largestFib($n-2) : $n);\n\t }\n\t};\n}", "function hasKSumRecursive($array, $t, $k)\n{\n foreach ($array as $number) {\n if ($k > 3) {\n if (hasKSumRecursive($array, $t - $number, $k - 1)) {\n return true;\n }\n } elseif (hasTwoSum($array, $t - $number)) {\n return true;\n }\n }\n\n return false;\n}", "function getAbsSum($arr)\n{\n $total = 0;\n forEach($arr as $i)\n $total += abs($i);\n return $total;\n}", "function rekSumArray(array $array): int\n {\n if(count($array) >= 1)\n {\n return array_shift($array) + rekSumArray($array);\n }\n return 0;\n }", "function find_max_index($arr) \n {\n $max = $arr[0]; \n for ($i = 1, $len = count($arr); $i < $len; $i++) {\n\n $max = ($arr[$i] > $max) ? $arr[$i] : $max;\n } \n return $max;\n }", "function twoDSum($arr)\n{\n $sum = 0;\n foreach ($arr as $ele) {\n $sum = $sum + array_sum($ele);\n }\n return $sum;\n}", "public function sumNumbersB()\n {\n $suma = 0;\n $multiplos = [3, 5, 7];\n for($i = 1; $i<=1000; $i++)\n {\n foreach ($multiplos as $j)\n {\n if($i%$j !== 0)\n continue 2;\n }\n\n $suma = $suma + $i;\n\n }\n return $suma;\n }", "function arraySum($arr){\n $len = count($arr);\n $sum = 0;\n for ($i = 0; $i < $len; $i++){\n $sum += $arr[$i];\n }\n return $sum;\n}", "function evenFibonacciNumbers($n){\n $sum = 0;\n $seq[] = maxFibonacciValue($n);\n foreach($seq[0] as $value){\n if($value % 2 == 0){ $sum += $value; }\n }\n return $sum;\n }", "function solution($A)\n{\n $pairs = $zeros = 0;\n\n foreach ($A as $k => $v) {\n $zeros += ($v === 0);\n\n if ($v===1) {\n $pairs += $zeros;\n }\n\n if ($pairs>1000000000) {\n $pairs = -1;\n break;\n }\n }\n\n return $pairs;\n}", "function raw_method2($nums, $k) {\n $start = recordStart();\n $result = [];\n\n $max_left[0] = $nums[0];\n $max_right[count($nums) - 1] = $nums[count($nums) - 1];\n\n // Separate max start from left and max start from right\n for ($i = 0; $i < count($nums); $i++) {\n // Collect max start from left\n $max_left[$i] = ($i % $k == 0) ? $nums[$i] : max($max_left[$i - 1], $nums[$i]);\n\n // Collect max start from right\n $j = count($nums) - $i - 1;\n $max_right[$j] = ($j % $k == 0) ? $nums[$j] : max(isset($max_right[$j + 1]) ? $max_right[$j + 1] : $max_right[$j], $nums[$j]);\n }\n\n // Merge and compare\n for ($i = 0; $i + $k <= count($nums); $i++) {\n $result[] = max($max_right[$i], $max_left[$i + $k - 1]);\n }\n\n\n $end = recordEnd($start);\n\n return ['result raw_method2' => $result, 'input' => $nums, 'slide' => $k, 'total exe time (microsecond)' => $end];\n}", "function sumate2(array $n,int $r) {\r\n if ($r < 0) {\r\n return 0;\r\n } else {\r\n print($n[$r]);\r\n print \"<br> \";\r\n return ($n[$r]) + sumate2($n, $r-1);\r\n }\r\n}", "function iterSumArray(array $array): int\n {\n $total = 0;\n while ($array)\n {\n $total += array_pop($array);\n }\n\n return $total;\n }", "function indexMinSum($arr, $n)\n{\n\t// Initialization of the\n\t// min value\n\t$min = $arr[0];\n\t$index = 0;\n\n\t// Find minimum element in\n\t// the array\n\tfor ($i = 1; $i < $n; $i++)\n\t{\n\t\tif ($arr[$i] < $min)\n\t\t{\n\n\t\t\t// store the index of the\n\t\t\t// current minimum element\n\t\t\t$min = $arr[$i];\n\t\t\t$index = $i;\n\t\t}\n\t}\n\n\t// return the index of min\n\t// element 1-based index\n\treturn ($index + 1);\n}", "function getMaximumOutfits($outfits, $money) {\r\n // keep a queue of the currently selected outfits, track the longest queue\r\n $queue = [];\r\n $result = 0;\r\n $spent = 0;\r\n $length = 0;\r\n for ($i = 0; $i < count($outfits); $i++) {\r\n // add this outfit to the queue..\r\n $pick = $outfits[$i];\r\n $queue[] = $pick;\r\n $spent += $pick;\r\n $length++;\r\n\r\n // then leave stuff from the start of the queue until we're ok with $$$\r\n while ($spent > $money) {\r\n $leave = array_shift($queue);\r\n $spent -= $leave;\r\n $length--;\r\n }\r\n $result = max($result, $length);\r\n }\r\n\r\n return $result;\r\n}", "static function maxint() {\n /* assumes largest integer is of form 2^n - 1 */\n $to_test = pow(2, 16);\n while (1) {\n $last = $to_test;\n $to_test = 2 * $to_test;\n if (($to_test < $last) || (!is_int($to_test))) {\n return($last + ($last - 1));\n }\n }\n }", "function calcCorrectAnswer($array)\n{\n\t$isZero = true;\n\tforeach ($array as $i){\n\t\tif($i > 0) $isZero = false;\n\t}\n\tif ($isZero) return 0;\n\n\treturn array_keys($array, max($array))[0] + 1;\n}", "function sumOfMinAbsDifferences($arr, $n) \r\n\t{ \r\n\t\t \r\n\t\t// sort the given array \r\n\t\tsort($arr); \r\n\t\tsort( $arr,$n); \r\n\t\t \r\n\t\t// initialize sum \r\n\t\t$sum = 0; \r\n\t\t \r\n\t\t// min absolute difference for \r\n\t\t// the 1st array element \r\n\t\t$sum += abs($arr[0] - $arr[1]); \r\n\t\t \r\n\t\t// min absolute difference for \r\n\t\t// the last array element \r\n\t\t$sum += abs($arr[$n - 1] - $arr[$n - 2]); \r\n\t\t \r\n\t\t// find min absolute difference \r\n\t\t// for rest of the array elements \r\n\t\t// and add them to sum \r\n\t\tfor ($i = 1; $i < $n - 1; $i++) \r\n\t\t\t$sum += min(abs($arr[$i] - $arr[$i - 1]), \r\n\t\t\t\t\t abs($arr[$i] - $arr[$i + 1])); \r\n\t\t\t \r\n\t\t// required sum \r\n\t\treturn $sum; \r\n\t}", "function getMax($key, $array) {\r\n // Declare $maxValue\r\n $cardMax = 0;\r\n $maxValue = 0;\r\n /* Loop through the array, starting at the given\r\n index and ending at the last element in the\r\n array.*/\r\n for ($i = $key; $i > -1; $i--) {\r\n /* it will add the probability score for each index\r\n included in the loop*/\r\n $cardMax = $array[$i][3];\r\n $maxValue = $maxValue + $cardMax;\r\n }\r\n // and returns the max value for the key\r\n return $maxValue;\r\n }", "function maxFibonacciValue($n){\n $fib = array(1, 2);\n for ($i=2; $i < $n; $i++) {\n $next = $fib[$i - 1] + $fib[$i - 2];\n if($next > $n){ break; }\n else{ array_push($fib, $next); }\n }\n return $fib;\n }", "function find_movement_limits ($threshold_num, $threshold_mult, $array_size, $accumulator) {\n for ($i = 0; $i < $array_size; $i++) {\n sort($accumulator[$i], SORT_NUMERIC);\n $shortest = array_slice($accumulator[$i], 0, $threshold_num);\n $shortest_avg = array_sum($shortest)/count($shortest);\n // filter array based on upper limit\n $upper_limits[$i] = $shortest_avg*$threshold_mult;\n }\n return $upper_limits;\n}", "function arr_max($int_arr){\r\n\t\t\t\r\n\t\t\t$max = $int_arr[0];\t\t\r\n\t\t\t\r\n\t\t\tfor ($i=0; $i < count($int_arr); $i++){\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tif ( $int_arr[$i] > $max ) {\t\t\t\t\t\r\n\t\t\t\t\t$max = $int_arr[$i];\r\n\t\t\t\r\n\t\t\t\t}//end if\r\n\t\t\t\r\n\t\t\t}//end for\r\n\t\t\r\n\t\t\treturn $max;\r\n\t\t\t\r\n\t\t}", "function maximumToys($prices, $k)\n{\n sort($prices);\n $quantity = 0;\n foreach ($prices as $price) {\n $k -= $price;\n if ($k <= 0) {\n break;\n }\n\n $quantity++;\n }\n\n return $quantity;\n}", "function arraySum($arr)\n{\n $sum = 0;\n foreach($arr as $tempnum){\n $sum += $tempnum;\n }\n return $sum;\n}", "function array_max($array)\n{\n if (empty($array)) {\n return null;\n }\n\n if (is_array($array)) {\n $max = $array[0];\n $tail = array_slice($array, 1);\n } else {\n $max = $array->current();\n $array->next();\n $tail = $array;\n }\n\n return array_reduce(\n $tail,\n function ($max, $value) {\n if ($value > $max) {\n return $value;\n } else {\n return $max;\n }\n },\n $max\n );\n}", "function checkRecursive($x, $n, $curr_num = 1,$curr_sum = 0)\n{\n // Initialize number of ways to express\n // x as n-th powers of different natural\n // numbers\n $results = 0;\n \n // Calling power of 'i' raised to 'n'\n $p = power($curr_num, $n);\n $p + $curr_sum;\n while ($p + $curr_sum < $x)\n {\n // Recursively check all greater values of i\n $results += checkRecursive($x, $n, $curr_num+1,$p+$curr_sum);\n $curr_num++;\n $p = power($curr_num, $n);\n }\n \n // If sum of powers is equal to x\n // then increase the value of result.\n echo $p + $curr_sum;\n echo \"\\n\";\n if ($p + $curr_sum == $x)\n $results++;\n \n // Return the final result\n return $results;\n}", "public function task5()\n {\n function solution($A, $K) {\n $N = count($A);\n\n for ($i = 0; $i < $N - 1; $i++) {\n if ($A[$i] + 1 < $A[$i + 1]) {\n return false;\n }\n }\n\n if ($A[0] != 1 && $A[$N - 1] != $K) {\n return false;\n }\n\n return true;\n }\n\n $A = [2,3]; $K = 2;\n// $A = [1,2,3]; $K = 2;\n// $A = [1,1,3]; $K = 2;\n\n dd($A, $K, solution($A, $K));\n }", "function getMaxArray ($array){\r\n // Get the max for each value and put those in an array\r\n for ($i = 0; $i < 10; $i++) {\r\n $maxArr[$i]= getMax($i, $array);\r\n }\r\n return $maxArr;\r\n}", "function CountSumOfDepthIncreases($data): int{\n $countSumOfDepthIncreases=0;\n for ($i = 3; $i < count($data); $i++){\n if(($data[$i-3]+$data[$i-2]+$data[$i-1])<($data[$i-2]+$data[$i-1]+$data[$i])){\n $countSumOfDepthIncreases++;\n }\n }\n return $countSumOfDepthIncreases;\n}", "function summation($n) {\r\n $sum = 0;\r\n\r\n for ($i = $n; $i >= 1; $i--) {\r\n $sum += $i;\r\n }\r\n\r\n return $sum;\r\n}", "function sum_numbers($array, $target)\n{\n$count = count($array) - 2;\n$result=[];\nfor ($i = 0; $i < $count; $i++) {\n if ($array[$i] + $array[$i+1] + $array[$i+2] == $target) {\n array_push($result, \"{$array[$i]} + {$array[$i+1]} + {$array[$i+2]} = $target\");\n }\n}\nreturn $result;\n}", "function maxDistToClosest($seats) {\n// foreach ($seats as $index => $seat) {\n// if ($seat == 1) {\n// $one[$idx] = $index;\n// $len[] = ($index - $one[$idx - 1]) / 2;\n// $start = $index;\n// $idx++;\n// }\n// }\n// return $start;\n// if (($seats[0] ^ $seats[count($seats) - 1] == 1) && (max($len) == $len[0]\n// || max($len) == $len[count($len) - 1])) {\n// return max(count($seats) - $start - 1, $start);\n// }\n// return floor(max($len));\n }", "function solution($arr, $int) {\n //\n}", "function sum($array)\n{\n return array_reduce($array, function($acc, $x) { return $acc + $x; });\n}", "function almostIncreasingSequence($sequence) {\n $orig=$sequence;\n $flag=false;\n \n for ($i=0;$i<count($orig);$i++) {\n unset($sequence[$i]);\n $tempSort = $sequence;\n sort($tempSort);\n \n $comp = array_map(\"comp\",$sequence,$tempSort);\n if (!in_array(false, $comp) && $sequence == array_unique($sequence)) {\n $flag=true;\n }\n $sequence=$orig;\n }\n return $flag;\n}", "function getNextValues($array, $value, $int, $first, $tense){\n if($tense==\"Preterito\"){//in the preterite tense\n\n $value = 'hube';\n $array = array_reverse($array);\n \n $index = array_search($value, $array);\n \n $array = array_reverse($array);\n $index = sizeof($array)- $index;\n $index--;\n $conj = array();\n \n for($i=$int+5;$i>5;$i--){\n array_push($conj, $array[$index - $i]);\n }\n \n return $conj;\n }\n \n \n if($first==2){\n $array = array_reverse($array);\n \n $index = array_search($value, $array);\n \n $array = array_reverse($array);\n $index = sizeof($array)- $index;\n $index--;\n }else{\n $index = array_search($value, $array);\n }\n $conj = array();\n for($i=1;$i<=$int;$i++){\n array_push($conj, $array[$index + $i]);\n }\n return $conj;\n}", "function bestTimeToBuyAndSellStock($arr) {\n $len = count($arr);\n $minPrice = 999;\n $maxPro = 0;\n for ($i=0; $i<$len; $i++) {\n $minPrice = min($minPrice, $arr[$i]);\n $maxPro = max($maxPro, $arr[$i] - $minPrice);\n }\n return $maxPro;\n}", "function sum($n) {\n $sumOfAll = 0;\n for ($i = 1; $i <= $n; $i++) {\n $list = str_split($i); \n foreach ($list as $digit) {\n $sumOfAll += $digit;\n }\n }\n return $sumOfAll.PHP_EOL;\n}", "static function countIn($value,$array,$max=null){\n\t\t$count = 0;\n\t\tforeach($array as $v){\n\t\t\tif($v == $value){\n\t\t\t\t$count++;\n\t\t\t\tif($max && $count == $max){\n\t\t\t\t\treturn $max;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $count;\n\t}", "function nBy3NumberV2($arr) {\n if (empty($arr)) {\n return;\n }\n mergeSort($arr, 0, sizeof($arr)-1);\n $limit = ceil(sizeof($arr) / 3);\n $count = 1;\n for ($i=1; $i < sizeof($arr); $i++) { \n if ($arr[$i] == $arr[$i-1]) {\n $count++;\n } else {\n $count = 1;\n }\n if ($count >= $limit) {\n return $arr[$i];\n }\n }\n return;\n}", "function sum($arrayOfNumbers)\n{\n $add = 0;\n foreach ($arrayOfNumbers as $number) {\n\n $add += $number;\n }\n return $add;\n}", "function findHighestSem($rq, $seq)\n\t{\n\t\tif(array_key_exists(0, $rq))\n\t\t{\n\t\t\tforeach($rq as $co)\n\t\t\t{\n\t\t\t\tif(!is_null($co))\n\t\t\t\t\t$ret[] = findSemester($co, $seq);\n\t\t\t}\n\t\t\treturn max($ret);\n\t\t}\n\t\telse\n\t\t\treturn count($seq)-1;\n\t}", "function solution($S, $P, $Q){\r\n $A = $C = $G = $T = 0;\r\n $results = array();\r\n $quantaties = array();\r\n $quantaties[-1]=\"0000\"; \r\n if ((strlen($S) < 1) || (strlen($S) > 100000))\r\n return 0;\r\n if ((count($P) < 1) || (count($P) > 50000))\r\n return 0;\r\n if ((count($Q) < 1) || (count($Q) > 50000))\r\n return 0;\r\n for ($i = 0; $i < strlen($S); $i++) {\r\n switch (substr($S, $i, 1)) {\r\n case 'A':\r\n $A++; \r\n break;\r\n case 'C':\r\n $C++;\r\n break;\r\n case 'G':\r\n $G++;\r\n break;\r\n case 'T':\r\n $T++;\r\n break;\r\n }\r\n $quantaties[$i]=$A.\"|\".$C.\"|\".$G.\"|\".$T; \r\n } \r\n// print_r($quantaties);\r\n $right=$left=array();\r\n for ($i = 0; $i < count($P); $i++) {\r\n $right=explode(\"|\", $quantaties[$Q[$i]]); print_r($right);\r\n $left=explode(\"|\", $quantaties[$P[$i]-1]); print_r($left);\r\n if (($right[0]-$left[0])!=0) $results[$i]=1;\r\n elseif (($right[1]-$left[1])!=0) $results[$i]=2;\r\n elseif (($right[2]-$left[2])!=0) $results[$i]=3;\r\n else $results[$i]=4;\r\n }\r\n return $results;\r\n}", "function findMaxInArray($array){\n $max = $array[0];\n $key =0;\n for ($x = 0; $x < count($array); $x++){\n if ($max < $array[$x]){\n $max = $array[$x];\n $key = $x;\n };\n }\n return ['max'=>$max, 'key'=>$key];\n}", "function Fannkuch($n){\n $check = 0;\n $perm = array();\n $perm1 = array();\n $count = array();\n $maxPerm = array();\n $maxFlipsCount = 0;\n $m = $n - 1;\n\n for ($i=0; $i<$n; $i++) $perm1[$i] = $i;\n $r = $n;\n\n while (TRUE) {\n // write-out the first 30 permutations \n if ($check < 30){\n for($i=0; $i<$n; $i++) echo $perm1[$i]+1; \n echo \"\\n\";\n $check++;\n }\n\n while ($r != 1){ $count[$r-1] = $r; $r--; } \n if (! ($perm1[0]==0 || $perm1[$m] == $m)){ \n for($i=0; $i<$n; $i++) $perm[$i] = $perm1[$i]; \n $flipsCount = 0;\n\n while ( !(($k=$perm[0]) == 0) ) {\n $k2 = ($k+1) >> 1;\n for($i=0; $i<$k2; $i++) {\n $temp = $perm[$i]; $perm[$i] = $perm[$k-$i]; $perm[$k-$i] = $temp;\n }\n $flipsCount++;\n }\n\n if ($flipsCount > $maxFlipsCount) {\n $maxFlipsCount = $flipsCount;\n for($i=0; $i<$n; $i++) $maxPerm[$i] = $perm1[$i];\n }\n } \n\n while (TRUE) { \n if ($r == $n) return $maxFlipsCount;\n $perm0 = $perm1[0];\n $i = 0;\n while ($i < $r) {\n $j = $i + 1;\n $perm1[$i] = $perm1[$j];\n $i = $j;\n }\n $perm1[$r] = $perm0;\n\n $count[$r] = $count[$r] - 1;\n if ($count[$r] > 0) break;\n $r++;\n }\n }\n}", "function twoSum(array $nums, int $target): array\n{\n foreach ($nums as $key => $val) {\n unset($nums[$key]);\n $nextKey = array_search(($target - $val), $nums);\n if ($nextKey) {\n return [$key, $nextKey];\n }\n }\n return [];\n}", "function rangeRek(int $min, int $max, $array = null): int\n {\n if($array === null)\n {\n $array = range($min, $max);\n }\n\n if(count($array) >= 1)\n {\n return array_shift($array) + rangeRek($min, $max, $array);\n }\n return 0;\n }", "function calculateRemainingAmmount($n){\n global $P, $N, $c, $r;\n $REM = (pow((1 + $r), $n) * $P) - ((pow((1+$r), $n)-1) / $r) * $c;\n return round($REM, 2);\n}", "function getSum($n){\n \n $range =500;\n for($i=0;$i<$n;$i++){\n echo $range--.\" \";\n }\n}", "public function fourthTask(array $arr, $value){\n\n if (count($arr) === 0) return false;\n $low = 0;\n $high = count($arr) - 1;\n\n while ($low <= $high) {\n\n // compute middle index\n $mid = floor(($low + $high) / 2);\n\n // element found at mid\n if($arr[$mid] == $value) {\n return $mid;\n }\n\n if ($value < $arr[$mid]) {\n // search the left side of the array\n $high = $mid -1;\n }\n else {\n // search the right side of the array\n $low = $mid + 1;\n }\n }\n\n // If we reach here element value doesnt exist\n return -1;\n\n }", "function permutator_generate($tops){\r\n\t$max=1;\r\n\t$cas=array();\r\n\tforeach ($tops as $top) {$max=$max*$top;array_push($cas,0);}\r\n\t\r\n\t$res=array();\r\n\t\r\n\tarray_push($res,$cas);\r\n\t\r\n\tfor ($i=0;$i<$max-1;$i++){\r\n\t\t$cas[0]++;\r\n\t\tpermutator_overflow($cas,$tops);\r\n\t\tarray_push($res,$cas);\r\n\t\t\r\n\t}\r\n\t\r\n\treturn $res;\r\n\t\r\n}", "function math_sequence($arr)\n{\n if (count($arr) == 0) {\n return [[]];\n }\n $result = [];\n foreach ($arr as $key => $pair) {\n $select_point = array_shift($pair);\n\n $rest_arr = array_except($arr, $key);\n $rest_arr = empty($pair) ? $rest_arr : array_merge($rest_arr, [$pair]);\n\n $sub_sequences = math_sequence($rest_arr);\n foreach ($sub_sequences as $sub) {\n array_unshift($sub, $select_point);\n $result[] = $sub;\n }\n }\n return $result;\n}", "function sockMerchant($n, $ar)\n{\n\n $result = 0;\n $auxiliar = [];\n\n for($i=0 ; $i<sizeof($ar); $i++){\n if(in_array($i, $auxiliar)) continue;\n\n for($j=1; $j<sizeof($ar) ; $j++) {\n if($i == $j) continue;\n\n if (in_array($j, $auxiliar)) continue;\n\n if ($ar[$i] == $ar[$j]) {\n array_push($auxiliar, $i, $j);\n $result++;\n break;\n }\n }\n }\n return $result;\n}", "function solution($A) {\n // write your code in PHP7.0\n \n asort($A);\n $miss = 0;\n \n $size = count($A);\n for ($i=1; $i <= $size; $i++) { \n if (in_array($i, $A)) {\n \n } else {\n $miss = $i;\n break;\n }\n }\n \n return $miss;\n}", "function max_from_right($values) {\n return array_reverse(max_from_left(array_reverse($values)));\n}", "function pancakeSort(&$arr, $n) \n{ \n\t// Start from the complete \n\t// array and one by one \n\t// reduce current size \n\t// by one \n\tfor ($curr_size = $n; $curr_size > 1; --$curr_size) \n\t{ \n\t\t// Find index of the \n\t\t// maximum element in \n\t\t// arr[0..curr_size-1] \n\t\t$mi = findMax($arr, $curr_size); \n\n\t\t// Move the maximum \n\t\t// element to end of \n\t\t// current array if \n\t\t// it's not already \n\t\t// at the end \n\t\tif ($mi != $curr_size-1) \n\t\t{ \n\t\t\t// To move at the end, \n\t\t\t// first move maximum \n\t\t\t// number to beginning \n\t\t\tflip($arr, $mi); \n\n\t\t\t// Now move the maximum \n\t\t\t// number to end by \n\t\t\t// reversing current array \n\t\t\tflip($arr, $curr_size-1); \n\t\t} \n\t} \n}", "function minimumTime($x) {\n rsort($x);\n $output = 0;\n for($i = 0; $i < count($x)-1; ++$i) {\n output += $x[$i] - $x[$i+1]; \n }\n return $output;\n}", "function largest($array )\n{\n $larger = 0;\n foreach ($array as $x)\n {\n $larger = ($x > $larger) ? $x : $larger;\n }\n return $larger;\n}", "function maxValLimit ($arr, $limit) {\n /* if no such value, or $arr is not an array, return -1 */\n if (is_array ($arr)) {\n sort ($arr); \n for ($i = count ($arr) - 1; $i >= 0; $i--) {\n if ($arr[$i] <= $limit) {\n return ($arr[$i]);\n break;\n }\n }\n }\n return (-1);\n}", "function getTotalX($a, $b) {\n\n sort($a);\n sort($b);\n\n $minInA = $a[0];\n $maxInB = $b[count($b) - 1];\n $sizeA = count($a);\n $sizeB = count($b);\n\n $i = 1;\n $numbersBetween = 0;\n $factor = $minInA * $i;\n\n while ($factor <= $maxInB) {\n $allFactors = true;\n $divideAll = true;\n\n for ($j = 1; $j < $sizeA; $j++) {\n if ($factor % $a[$j] != 0) {\n $allFactors = false;\n break;\n }\n }\n\n for ($j = 0; $j < $sizeB; $j++) {\n if ($b[$j] % $factor != 0) {\n $divideAll = false;\n break;\n }\n }\n\n $numbersBetween += ($allFactors && $divideAll ? 1 : 0);\n $factor = $minInA * (++$i);\n }\n\n return $numbersBetween;\n\n}", "function leastBricks($wall=[]) { \r\n foreach ($wall as $key => $value) {\r\n for ($i = 0; $i < count($value) - 1; $i++) {\r\n\t\t//the maximum coincidence of the sums of bricks, means the maximum total boundary line\r\n $arr[] = array_sum(array_slice($value, 0, $i + 1));\r\n }\r\n }\r\n\t//the difference of all horizontal lines of bricks and the maximum coincident line will give an our solutuion\r\n return count($wall) - max(array_count_values($arr));\r\n}", "function findIt(array $seq): int\n{\n foreach ($seq as $number) {\n $arrNumeros = array_keys($seq, $number);\n if (count($arrNumeros) % 2 === 1) {\n return $number;\n }\n }\n}", "function recursiveSum(string $numbers) : string\n {\n if (strlen($numbers) <= 2)\n {\n return $numbers;\n }\n $output = '';\n for ($i = 0, $j = strlen($numbers) - 1; $i < $j; $i++, $j--)\n {\n $output .= (int) $numbers[$i] + (int) $numbers[$j];\n }\n if (strlen($numbers) % 2 == 1)\n {\n $middle = (int) (strlen($numbers) / 2);\n $output .= $numbers[$middle];\n }\n if (isset($_POST['debug']) && strtolower($_POST['debug']) == 'true')\n {\n echo $output;\n echo '<br />';\n }\n recursiveSum($output);\n }", "function findLargestPalindromeProduct($maxComponent){\n $largest = [0,0]; //this will store our working largest palindrome products\n for($i = 0; $i < $maxComponent; $i++){ //try every possible first number\n for($j = 0; $j < $maxComponent; $j++){ //try every possible 2nd number\n if(checkPalindrome($j*$i)){ //if the product is a palindrome\n if($largest[0]*$largest[1] < $i*$j){ //if the product is larger than our previous best\n $largest = [$i, $j]; //then update the working largest copy\n }\n }\n }\n }\n return($largest); //return the array containing the 2 numbers used to create the largest palindrome\n}", "public static function sum_of_3_ints()\n {\n $arr= array();\n $count =0;\n echo \"enter the size of array:\\n\";\n $number = Utility::takingnuminput();\n for($x =0; $x< $number ;$x++)\n {\n echo \"enter the number:\\n\";\n $num = Utility::takingnuminput();\n $arr[$x]=$num;\n }\n for($i=0;$i< count($arr); $i++)\n {\n for($j =$i+1;$j< count($arr) ; $j++)\n {\n for($k =$j+1; $k< count($arr) ; $k++)\n {\n if(($arr[$i] + $arr[$j] + $arr[$k]) == 0)\n {\n ++$count;\n echo \"the sum of 3 which is equal to zero : \".$arr[$i].\"+\".$arr[$j].\"+\".$arr[$k].\" =0 \\n\";\n }\n\n }\n }\n }\n echo \"the number of triplets found is $count \\n\";\n\n\n }" ]
[ "0.8041444", "0.77919126", "0.73802394", "0.7115275", "0.6726554", "0.65194285", "0.6506421", "0.6403983", "0.64031935", "0.62988573", "0.6288922", "0.6204386", "0.6123467", "0.61165744", "0.6093035", "0.60909206", "0.60499895", "0.60432196", "0.590041", "0.5755475", "0.5734296", "0.56906873", "0.5687612", "0.56859016", "0.562443", "0.56191325", "0.55714816", "0.5566385", "0.55499816", "0.54908085", "0.54853565", "0.5426", "0.53822434", "0.5380798", "0.53647864", "0.5342453", "0.53305304", "0.53074783", "0.52982646", "0.52649647", "0.52453303", "0.52426106", "0.52377766", "0.52240473", "0.5202376", "0.5197263", "0.51799756", "0.5171188", "0.51557267", "0.5148585", "0.51368713", "0.5075486", "0.5059204", "0.5055436", "0.5052676", "0.50506985", "0.5047876", "0.50468343", "0.50417954", "0.50186205", "0.5018259", "0.5006442", "0.499705", "0.49200746", "0.49134988", "0.49093422", "0.49066252", "0.49048826", "0.49030465", "0.48981157", "0.48951992", "0.48925292", "0.48913762", "0.48692286", "0.48320046", "0.48218465", "0.48134017", "0.4803535", "0.4802829", "0.4798377", "0.4793544", "0.47861132", "0.4773254", "0.47712144", "0.47706115", "0.47700435", "0.47641993", "0.47599766", "0.473314", "0.47275424", "0.47138706", "0.4713116", "0.47112447", "0.47034252", "0.4701315", "0.46852362", "0.46734568", "0.4672616", "0.4672179", "0.46620202" ]
0.8347308
0
This algorithm solve the problem with linear O(N) time complexity using Dynamic Programming best[i] = sum[i] min(sum[j1])
function getSumSeq( $arr ) { $N = count($arr) - 1; $sum = array(); $sum[ 0 ] = $arr[ 0 ]; for($i = 1; $i <= $N; $i++) { $sum[ $i ] = $arr[ $i ] + $sum[ $i - 1 ]; } $bestSum = 0; $best = array(); $best[ 0 ] = $sum[ 0 ]; $min = $sum[ 0 ]; for($i = 1; $i <= $N; $i++) { $best[ $i ] = $sum[ $i ] - $min; if($sum[ $i ] < $min) { $min = $sum[ $i ]; } if($bestSum < $best[ $i ]) { $bestSum = $best[ $i ]; $pos = $i; } } return array("bestsum"=>$bestSum, "pos"=>$pos); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSubseqSum( $arr ) {\n\n $N = count($arr) - 1;\n\n $bestSum = 0;\n\n $posBest = -1;\n\n for($i = 0; $i <= $N; $i++) {\n\n for($j = $N; $j >= $i; $j--) {\n\n $partialSum = 0;\n\n for($k = $i; $k <= $j; $k++) {\n\n $partialSum += $arr[ $k ]; \n }\n\n if($partialSum > $bestSum) {\n\n $bestSum = $partialSum;\n } \n } \n }\n\n return $bestSum;\n}", "function absoluteValuesSumMinimization($a) {\n $all_sum = [];\n for($i = 0; $i < count($a); $i++){\n $sum = 0;\n for($j = 0; $j < count($a); $j++){\n $sum += abs($a[$j] - $a[$i]);\n }\n $all_sum[$a[$i]] = $sum;\n }\n return array_search(min($all_sum), $all_sum);\n}", "function miniMaxSum($arr) {\n $allSums = [];\n for ($i = 0; $i < count($arr); $i++) {\n $tmpArray = $arr;\n unset($tmpArray[$i]);\n $allSums[] = array_sum($tmpArray);\n }\n\n print min($allSums) . ' ' . max($allSums);\n}", "function miniMaxSum($arr) {\n\t$sum = [];\n\n\tfor($i = 0; $i < 5; $i++)\n\t{\n\t\t$tempArray = $arr;\n\t\tunset($tempArray[$i]);\n\t\t$sum[] = array_sum($tempArray);\n\t}\n\tprint min($sum).\" \".max($sum);\n}", "function miniMaxSum($arr) {\n // Write your code here\n sort($arr);\n $total = array_sum($arr);\n $newsum = []; \n for ($i = 0; $i < count($arr); $i++) {\n $newsum[] = $total-$arr[$i];\n }\n $min = min($newsum);\n $max = max($newsum);\n \n echo $min.' '.$max;\n\n}", "function solution($N, $A)\n{\n // Initial array which length is N for saving final result\n $result_arr = array_fill(0, $N, 0);\n \n // Solution:\n // what we did is using $current_big_val to save current biggest value in result array\n // we empty result array when $A[$i] === $N1 which is max counter\n // when empty result array we will add $current_big_val to $addition_val\n // so we only need to record those steps which after final max counter\n // and add $addition_val to each element\n\n // e.g $N = 5, $A = [3, 4, 4, 6, 1, 4, 4]\n // So $N1 = 6 and the original steps should look like below\n // (0, 0, 1, 0, 0) $A[0] !== $N1\n // (0, 0, 1, 1, 0) $A[1] !== $N1\n // (0, 0, 1, 2, 0) $A[2] !== $N1\n // (2, 2, 2, 2, 2) $A[3] === $N1, max counter\n // (3, 2, 2, 2, 2) $A[4] !== $N1\n // (3, 2, 2, 3, 2) $A[5] !== $N1\n // (3, 2, 2, 4, 2) $A[6] !== $N1\n\n // Our steps will be like this\n // (0, 0, 1, 0, 0) $A[0] !== $N1, $current_big_val = 1, $addition_val = 0\n // (0, 0, 1, 1, 0) $A[1] !== $N1, $current_big_val = 1, $addition_val = 0\n // (0, 0, 1, 2, 0) $A[2] !== $N1, $current_big_val = 2, $addition_val = 0\n // (0, 0, 0, 0, 0) $A[3] === $N1, max counter so empty array, $current_big_val = 0, $addition_val = 2\n // (1, 0, 0, 0, 0) $A[4] !== $N1\n // (1, 0, 0, 1, 0) $A[5] !== $N1\n // (1, 0, 0, 2, 0) $A[6] !== $N1\n // add $addition_val which is 2 to each element\n // (3, 2, 2, 4, 2)\n \n $len = count($A);\n $N1 = $N + 1;\n $current_big_val = 0;\n $addition_val = 0;\n \n for ($i = 0; $i < $len; $i++) {\n if ($A[$i] === $N1) {\n $result_arr = array();\n $addition_val += $current_big_val;\n $current_big_val = 0;\n } else {\n if (!isset($result_arr[$A[$i] - 1])) {\n $result_arr[$A[$i] - 1] = 0;\n }\n \n $result_arr[$A[$i] - 1] ++;\n \n if ($current_big_val < $result_arr[$A[$i] - 1]) {\n $current_big_val = $result_arr[$A[$i] - 1];\n }\n }\n }\n \n for ($i=0; $i<$N; $i++) {\n $result_arr[$i] = !isset($result_arr[$i]) ? $addition_val : $result_arr[$i] + $addition_val;\n }\n \n return $result_arr;\n}", "function SumSize($a) {\n\n $n = count($a); // ??????????? ??????? ? ????????? (???? ?????? ?????? 3 ??. ????? ??????????? ????? ?? 2 ??????!!!)\n\n for ($i3 = 1; $i3 < $n; $i3++) {\n // ????????????? ??????? ?? ????????\n for ($i2 = $i3 - 1; $i2 < $n; $i2++) {\n for ($i = 0; $i <= 1; $i++) {\n if ($a[$i2]['X'] < $a[$i2]['Y']) {\n $a1 = $a[$i2]['X'];\n $a[$i2]['X'] = $a[$i2]['Y'];\n $a[$i2]['Y'] = $a1;\n };\n if (($i == 0) and ($a[$i2]['Y'] < $a[$i2]['Z'])) {\n $a1 = $a[$i2]['Y'];\n $a[$i2]['Y'] = $a[$i2]['Z'];\n $a[$i2]['Z'] = $a1;\n }\n }\n $a[$i2]['Sum'] = $a[$i2]['X'] + $a[$i2]['Y'] + $a[$i2]['Z']; // ????? ??????\n }\n\n // ????????????? ????? ?? ???????????\n for ($i2 = $i3; $i2 < $n; $i2++)\n for ($i = $i3; $i < $n; $i++)\n if ($a[$i - 1]['Sum'] > $a[$i]['Sum']) {\n $a2 = $a[$i];\n $a[$i] = $a[$i - 1];\n $a[$i - 1] = $a2;\n }\n\n // ????????? ????? ????????? ???? ????? ????????? ??????\n if ($a[$i3 - 1]['X'] > $a[$i3]['X']) {\n $a[$i3]['X'] = $a[$i3 - 1]['X'];\n }\n if ($a[$i3 - 1]['Y'] > $a[$i3]['Y']) {\n $a[$i3]['Y'] = $a[$i3 - 1]['Y'];\n }\n $a[$i3]['Z'] = $a[$i3]['Z'] + $a[$i3 - 1]['Z'];\n $a[$i3]['Sum'] = $a[$i3]['X'] + $a[$i3]['Y'] + $a[$i3]['Z']; // ????? ??????\n }\n\n //?????????\n //echo '<br>( '.Round($a[$n-1]['X'],2).' '.Round($a[$n-1]['Y'],2).' '.Round($a[$n-1]['Z'],2).' )';\n\n return (array('length' => Round($a[$n - 1]['X'], 2), 'width' => Round($a[$n - 1]['Y'], 2), 'height' => Round($a[$n - 1]['Z'], 2)));\n }", "function getSubseqMaxSum( $arr ) {\n\n //firstly we determine the number of the elements\n $N = count($arr) - 1;\n\n $sumMax = -999;\n\n $iMax = -1; $jMax = -1; \n\n //for i = 0 to N execute\n for($i = 0; $i <= $N; $i++) {\n\n $sum = 0;\n\n for($j = $i;$j <= $N; $j++) {\n\n $sum = $sum + $arr[ $j ]; \n\n if($sum > $sumMax) {\n\n $sumMax = $sum;\n $iMax = $i;\n $jMax = $j;\n }\n\n }\n\n } \n\n return array(\"sumMax\"=>$sumMax, \n \"i\"=>$iMax,\n \"j\"=>$jMax);\n}", "function indexMinSum($arr, $n)\n{\n\t// Initialization of the\n\t// min value\n\t$min = $arr[0];\n\t$index = 0;\n\n\t// Find minimum element in\n\t// the array\n\tfor ($i = 1; $i < $n; $i++)\n\t{\n\t\tif ($arr[$i] < $min)\n\t\t{\n\n\t\t\t// store the index of the\n\t\t\t// current minimum element\n\t\t\t$min = $arr[$i];\n\t\t\t$index = $i;\n\t\t}\n\t}\n\n\t// return the index of min\n\t// element 1-based index\n\treturn ($index + 1);\n}", "function solution($N, $A) {\n $m = count($A);\n\n // init counters\n $C = array();\n for ($i = 0; $i < $N; $i++) {\n $C[$i] = 0;\n }\n\n $max = 0;\n $minC = 0; // maximized helper value\n foreach ($A as $ai) {\n if ($ai <= $N) {\n /*\n * increase operation\n */\n // even the value\n if($C[$ai - 1] < $minC) {\n $C[$ai - 1] = $minC;\n }\n // actual increase\n $C[$ai - 1] ++;\n // calculate max\n if ($max < $C[$ai - 1]) {\n $max = $C[$ai - 1];\n }\n } elseif ($ai == $N + 1) {\n // do not actual increase to speed up operations\n $minC = $max;\n }\n }\n // even the values\n foreach($C as &$ci) {\n if($ci < $minC) {\n $ci = $minC;\n }\n }\n return $C;\n}", "function getSumV2($list)\r\n{\r\n $cache = [];\r\n for ($i=0; $i<count($list); $i++) {\r\n array_push($cache, 0);\r\n }\r\n\r\n $cache[0] = max($cache[0], $list[0]);\r\n $cache[1] = max($cache[0], $list[1]);\r\n\r\n for ($i=2; $i<count($list); $i++) {\r\n $cache[$i] = max(($list[$i] + $cache[$i-2]), $cache[$i-1]);\r\n }\r\n return $cache[$i-1];\r\n}", "function solution(array $a) {\n $count = count($a);\n\n $sums = [0 => $a[0]];\n $sums_r = [];\n $sums_r[$count-1] = $a[$count-1];\n\n for ($i=1; $i<count($a); $i++) {\n $sums[$i] = $sums[$i-1] + $a[$i];\n $sums_r[$count-$i-1] = $sums_r[$count-$i] + $a[$count-$i-1];\n }\n $diffs = [];\n\n for ($i=1; $i<$count; $i++) {\n $diffs[] = abs($sums[$i-1] - $sums_r[$i]);\n }\n\n return min($diffs);\n}", "function solution($A) {\n $return = 0;\n \n $N = count($A);\n $left = [];\n $right = [];\n \n for ($i=0; $i<$N; $i++) {\n $left[] = $A[$i] + $i;\n $right[] = -($A[$i] - $i);\n }\n \n sort($left);\n sort($right);\n \n for($i=0; $i<$N-1; $i++) {\n $val = $left[$i];\n $pos = binary_search($val, $right);\n $return += $N - $pos - 1;\n }\n \n return $return;\n}", "function sapXep($arr){\n for ($i = 0; $i < count($arr) - 1; $i ++){\n // Tim vi tri min\n $min = $i;\n for ($j = $i +1; $j < count($arr); $j ++){\n if ($arr[$j] < $arr[$min]){\n $min = $j;\n }\n }\n //sau khi co vi tri nho nhat thi doi vi tri voi $i\n $temp = $arr[$i];\n $arr[$i] = $arr[$min];\n $arr[$min] = $temp;\n\n }\n return $arr;\n}", "function minimumBribes($q)\n{\n $stepsCount = 0;\n $bribesCounts = [];\n $arrayLength = sizeOf($q)-1;\n $swapCntPerRound = 0;\n for ($i = 0; $i < $arrayLength; $i++) {\n if ($q[$i] > $q[$i+1]) {\n if (!isset($bribesCounts[$q[$i]])) {\n $bribesCounts[$q[$i]] = 0;\n }\n\n $bribesCounts[$q[$i]]++;\n\n if ($bribesCounts[$q[$i]] > 2) {\n //echo 'Too chaotic', PHP_EOL;\n return \"Too chaotic\";\n }\n\n $stepsCount++;\n $swapCntPerRound++;\n list($q[$i+1], $q[$i]) = [$q[$i], $q[$i+1]];\n }\n\n if ($i == $arrayLength-1 && $swapCntPerRound > 0) {\n $i = -1;\n $swapCntPerRound = 0;\n }\n }\n\n //echo array_sum($bribesCounts), PHP_EOL;\n return array_sum($bribesCounts);\n}", "function solution(array $A) {\n $result = $started = 0;\n foreach ($A as $d) {\n if ($d === 0) {\n $started++;\n } else if ($d === 1 and $started > 0) {\n $result += $started;\n }\n }\n if ($result > (int) 1E9) {\n return -1;\n }\n return $result;\n}", "function bestTimeToBuyAndSellStock($arr) {\n $len = count($arr);\n $minPrice = 999;\n $maxPro = 0;\n for ($i=0; $i<$len; $i++) {\n $minPrice = min($minPrice, $arr[$i]);\n $maxPro = max($maxPro, $arr[$i] - $minPrice);\n }\n return $maxPro;\n}", "function miniMaxSum(array $arr)\n{\n $sum = array_sum($arr);\n printf(\"%d %d\", $sum - max($arr), $sum - min($arr));\n}", "function MaximalSquare($matrix,$rows,$cols){\n $sum =array();\n\n //set the first column of sum matrix\n for($i=0;$i< $rows;$i++){\n $sum[$i][0]= $matrix[$i][0];\n }\n //set the first row of sum matrix\n for($j=0;$j < $cols;$j++){\n $sum[0][$j] = $matrix[0][$j];\n }\n\n for($i=1;$i<$rows;$i++){\n for($j=1;$j<$cols;$j++){\n if($matrix[$i][$j] == 1){\n $sum[$i][$j]= minimum($sum[$i][$j-1],$sum[$i-1][$j],$sum[$i-1][$j-1])+1;\n }else{\n $sum[$i][$j]=0;\n }\n }\n }\n\n $max_of_sum =$sum[0][0];\n $max_i = 0;\n $max_j = 0;\n\n for($i=0;$i<$rows;$i++){\n for($j=0;$j<$cols;$j++){\n if($max_of_sum < $sum[$i][$j]){\n $max_of_sum=$sum[$i][$j];\n $max_i = $i;\n $max_j = $j;\n }\n }\n }\n $square_matrix = array();\n for($i=$max_i;$i > ($max_i -$max_of_sum);$i--){\n for($j=$max_j;$j > ($max_j - $max_of_sum);$j--){\n $square_matrix[$i][$j] = $matrix[$i][$j];\n }\n }\n\n return $square_matrix;\n}", "public function optimize();", "public function optimize();", "function getMaxSumSubSequence($arr, $li, $ls) {\n\n if($li == $ls) return $arr[ $li ];\n\n $middle = intval(($li+$ls)/2);\n\n\n $bestL = getMaxSumSubSequence($arr, $li, $middle);\n $bestR = getMaxSumSubSequence($arr, $middle+1,$ls);\n\n $maxSuf = -9999; \n $maxPre = -9999;\n\n $suf = 0;\n for($i = $middle;$i >= $li; $i--) {\n\n $suf += $arr[$i]; \n\n if($suf > $maxSuf) {\n $maxSuf = $suf;\n } \n } \n\n $pre = 0;\n for($j = $middle+1;$j <= $ls; $j++) {\n\n $pre += $arr[$j];\n\n if($pre > $maxPre) {\n $maxPre = $pre;\n }\n } \n\n\n return max($bestL, max($bestR, ($maxSuf + $maxPre) )); \n}", "private function _optimize() {}", "function hourglassSum($arr) {\n\n for($i = 1; $i < 5; $i++)\n {\n for($j = 1; $j<5;$j++)\n {\n $temp = $arr[$i][$j] + $arr[$i-1][$j-1] + $arr[$i-1][$j] + $arr[$i-1][$j+1] +\n $arr[$i+1][$j-1] + $arr[$i+1][$j] + $arr[$i+1][$j+1];\n\n if(!isset($max) || $temp > $max)\n {\n $max = $temp;\n }\n }\n }\n return $max;\n}", "function solution($S, $P, $Q){\r\n $A = $C = $G = $T = 0;\r\n $results = array();\r\n $quantaties = array();\r\n $quantaties[-1]=\"0000\"; \r\n if ((strlen($S) < 1) || (strlen($S) > 100000))\r\n return 0;\r\n if ((count($P) < 1) || (count($P) > 50000))\r\n return 0;\r\n if ((count($Q) < 1) || (count($Q) > 50000))\r\n return 0;\r\n for ($i = 0; $i < strlen($S); $i++) {\r\n switch (substr($S, $i, 1)) {\r\n case 'A':\r\n $A++; \r\n break;\r\n case 'C':\r\n $C++;\r\n break;\r\n case 'G':\r\n $G++;\r\n break;\r\n case 'T':\r\n $T++;\r\n break;\r\n }\r\n $quantaties[$i]=$A.\"|\".$C.\"|\".$G.\"|\".$T; \r\n } \r\n// print_r($quantaties);\r\n $right=$left=array();\r\n for ($i = 0; $i < count($P); $i++) {\r\n $right=explode(\"|\", $quantaties[$Q[$i]]); print_r($right);\r\n $left=explode(\"|\", $quantaties[$P[$i]-1]); print_r($left);\r\n if (($right[0]-$left[0])!=0) $results[$i]=1;\r\n elseif (($right[1]-$left[1])!=0) $results[$i]=2;\r\n elseif (($right[2]-$left[2])!=0) $results[$i]=3;\r\n else $results[$i]=4;\r\n }\r\n return $results;\r\n}", "function leastBricks($wall=[]) { \r\n foreach ($wall as $key => $value) {\r\n for ($i = 0; $i < count($value) - 1; $i++) {\r\n\t\t//the maximum coincidence of the sums of bricks, means the maximum total boundary line\r\n $arr[] = array_sum(array_slice($value, 0, $i + 1));\r\n }\r\n }\r\n\t//the difference of all horizontal lines of bricks and the maximum coincident line will give an our solutuion\r\n return count($wall) - max(array_count_values($arr));\r\n}", "function euler009(int $sum): int\n{\n for ($a = 1; $a <= $sum - (2 * $a + 3); $a++) {\n for ($b = $a + 1; $b <= $sum - ($b + 1); $b++) {\n $c = $sum - ($a + $b);\n if ($a ** 2 + $b ** 2 == $c ** 2) {\n // The problem statement guarantees that this will be reached\n return $a * $b * $c;\n }\n }\n }\n}", "function find_min($nums)\n{\n $smallest = $nums[0];\n for ($i = 1; $i < count($nums); $i++) {\n if ($nums[$i] < $smallest) {\n $smallest = $nums[$i];\n }\n }\n return $smallest;\n}", "function getSum($list)\r\n{\r\n $sum = 0;\r\n for ($i=2; $i<count($list); $i++) {\r\n for ($k=0; $k<$i; $k++) {\r\n $tSum = 0;\r\n for ($j=$k; $j<count($list); $j+=$i) {\r\n $tSum += $list[$j];\r\n }\r\n if ($tSum > $sum) $sum = $tSum;\r\n }\r\n }\r\n\r\n return $sum;\r\n}", "function solution($A) {\r\n // time complexity O(n), array may be empty, elements are distinct integers in range [1...(N+1)]\r\n \r\n // calculate triangular number for N+1, then subtract the sum of the array\r\n \r\n // 100% first time!\r\n \r\n function triangular($n){\r\n return $n*($n + 1)/2;\r\n }\r\n \r\n $n = count($A);\r\n\r\n $plusOneSum = triangular($n+1);\r\n \r\n $sum = 0;\r\n \r\n for ($i = 0; $i <= $n - 1; $i++){\r\n $sum += $A[$i];\r\n }\r\n \r\n echo \"$plusOneSum $sum<br>\";\r\n \r\n return $plusOneSum - $sum;\r\n \r\n}", "public function task5()\n {\n function solution($A, $K) {\n $N = count($A);\n\n for ($i = 0; $i < $N - 1; $i++) {\n if ($A[$i] + 1 < $A[$i + 1]) {\n return false;\n }\n }\n\n if ($A[0] != 1 && $A[$N - 1] != $K) {\n return false;\n }\n\n return true;\n }\n\n $A = [2,3]; $K = 2;\n// $A = [1,2,3]; $K = 2;\n// $A = [1,1,3]; $K = 2;\n\n dd($A, $K, solution($A, $K));\n }", "function cheepestCost($n, $m){\n\t\t\t\treturn cost($n,$m);\n\t\t\t}", "protected function dijkstraVertices ($from)\n\t{\n\t\t//init\n\t\t$profitSum = array(); // vertexId => length\n\t\t$prevVertices = array(); // i => vertexId\n\t\t$vertices = $this->getVerticesIds(); // i => vertexId\n\t\t$verticesProfitTmp = $this->vertices->toArray(); // vertexId => profit\n\t\t$verticesProfit = array();\n\t\tforeach ($verticesProfitTmp as $key => $item){\n\t\t\t$verticesProfit[$key] = $item;\n\t\t}\n\t\t$prevVertices[$from] = null;\n\t\t$profitSum[$from] = 0;\n\n\t\t// alg\n\t\twhile(count($vertices) > 0){ // while some vertices remain\n\t\t\t$minValue = null;\n\t\t\t$minKey = null;\n\t\t\tforeach($vertices as $i => $vertexKey){ // pop the one with lowest profit\n\t\t\t\tif (isset($profitSum[$vertexKey])){\n\t\t\t\t\tif($minValue === null || $profitSum[$vertexKey] < $minValue){\n\t\t\t\t\t\t$minValue = $profitSum[$vertexKey];\n\t\t\t\t\t\t$minKey = $i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif($minValue === null || $minKey === null){ //or pop random\n\t\t\t\treset($vertices);\n\t\t\t\tlist($minKey, $minValue) = each($vertices);\n\t\t\t}\n\t\t\t$u = $vertices[$minKey];\n\t\t\tunset($vertices[$minKey]);\n\n\t\t\tif (isset($profitSum[$u])){\n\t\t\t\t$neighbours = array();\n\t\t\t\tforeach($this->edges[$u] as $key => $distance){ // get profits of neighbours\n\t\t\t\t\t$profit = $verticesProfit[$key];\n\t\t\t\t\t$neighbours[$key] = $profit == 0 ? 0.01 : 1000-log($profit);\n\t\t\t\t}\n\t\t\t\tforeach($neighbours as $neighbourId => $neighbourDistance){\n\t\t\t\t\t$potentialLength = $profitSum[$u] + $neighbourDistance;\n\t\t\t\t\tif(!isset($profitSum[$neighbourId]) || $potentialLength < $profitSum[$neighbourId]){ // check better route\n\t\t\t\t\t\t$profitSum[$neighbourId] = $potentialLength;\n\t\t\t\t\t\t$prevVertices[$neighbourId] = $u;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $prevVertices;\n\t}", "private function findRecommendation(){\n $placeModel = new Place();\n $places = $placeModel->getAllCategorized();\n $bestScore = PHP_INT_MAX;\n $idBest = 0;\n\n foreach($places as $place){\n $currScore = 0;\n $currScore += abs($place->heritage - $this->score['heritage'] );\n $currScore += abs($place->relax - $this->score['relax'] );\n $currScore += abs($place->sightseeing - $this->score['sightseeing']);\n $currScore += abs($place->weather - $this->score['weather']) ;\n $currScore += abs($place->populated - $this->score['populated'] );\n\n if($currScore < $bestScore){\n $bestScore = $currScore;\n $idBest = $place->id_plc;\n }\n\n }\n\n return $idBest;\n }", "public function findMinPrice() : array {\n $minPriceFlight = null;\n foreach (range(0, $this->flexibility) as $index) {\n $fromDate = $this->incrementDate($this->startingDate, $index);\n $returnDate = $this->incrementDate($fromDate, $this->duration);\n foreach ($this->destinations as $destination) {\n $searchMinPrice = $this->flightFinder->getLowestPrice($this->startingAirport, $destination, $fromDate, $returnDate);\n $this->flights[] = compact('searchMinPrice', 'destination', 'fromDate', 'returnDate');\n if ($this->isPriceLower($minPriceFlight, $searchMinPrice)) {\n $minPriceFlight = compact('searchMinPrice', 'destination', 'fromDate', 'returnDate');\n }\n }\n }\n\n return $minPriceFlight;\n }", "function raw_method2($nums, $k) {\n $start = recordStart();\n $result = [];\n\n $max_left[0] = $nums[0];\n $max_right[count($nums) - 1] = $nums[count($nums) - 1];\n\n // Separate max start from left and max start from right\n for ($i = 0; $i < count($nums); $i++) {\n // Collect max start from left\n $max_left[$i] = ($i % $k == 0) ? $nums[$i] : max($max_left[$i - 1], $nums[$i]);\n\n // Collect max start from right\n $j = count($nums) - $i - 1;\n $max_right[$j] = ($j % $k == 0) ? $nums[$j] : max(isset($max_right[$j + 1]) ? $max_right[$j + 1] : $max_right[$j], $nums[$j]);\n }\n\n // Merge and compare\n for ($i = 0; $i + $k <= count($nums); $i++) {\n $result[] = max($max_right[$i], $max_left[$i + $k - 1]);\n }\n\n\n $end = recordEnd($start);\n\n return ['result raw_method2' => $result, 'input' => $nums, 'slide' => $k, 'total exe time (microsecond)' => $end];\n}", "function findPartition($arr , $count)\r\n{\r\n \r\necho\"<h1>INPUT ARRAY</h1>\";\r\nfor($i=0; $i<$count;$i++){\r\n echo \"<span>{$arr[$i]} </span>\";\r\n}\r\necho\"<br><br>\";\r\n \r\n$sum = 0;\r\n$i = $j = 0;\r\n// echo \"<pre>\";\r\n\r\n// // print_r($arr);\r\n\r\n// echo \"</pre>\";\r\n// Calculate sum of all elements\r\n// for ($i = 0; $i < $count; $i++){\r\n $sum = Array_sum($arr);\r\n echo \"<span><b>TOTAL ARRAY SUM</b>: \",$sum,\"</span><br>\";\r\n// }\r\n\r\nif ($sum % 2 != 0)\r\n{\r\n \r\n return 0;\r\n}\r\n$part = array(array());\r\n \r\n//echo $count . \"<br>\";\r\n// initialize top row as true\r\nfor ($i = 0; $i <= $count; $i++)\r\n $part[0][$i] = 1;\r\n\r\n// initialize leftmost column,\r\n// except part[0][0], as 0\r\nfor ($i = 1; $i <= $sum / 2; $i++)\r\n $part[$i][0] = 0;\r\n\r\n// Fill the partition table in bottom up manner\r\nfor ($i = 1; $i <= $sum / 2; $i++) {\r\n for ($j = 1; $j <= $count; $j++) {\r\n $part[$i][$j] = $part[$i][$j - 1];\r\n // echo \"i : \".$i . \"<br>\";\r\n // echo \"j : \".$j . \"<br>\";\r\n // echo \"part : \" .$part[$i][$j] .\"<br>\";\r\n \r\n if ($i >= $arr[$j - 1]){\r\n $part[$i][$j] = $part[$i][$j] || $part[$i - $arr[$j - 1]][$j - 1];\r\n if($part[$i][$j] == 0 && $part[$i - $arr[$j - 1]][$j - 1] == 0)\r\n {\r\n $part[$i][$j] = 0;\r\n }\r\n }\r\n }\r\n}\r\n\r\n // uncomment this part to print table\r\n// for ($i = 0; $i <= $sum/2; $i++)\r\n// {\r\n// for ($j = 0; $j <= $count; $j++){\r\n// echo $part[$i][$j];\r\n\r\n// }\r\n// echo \"<br>\";\r\n\r\n// } \r\necho \"<h1>OUTPUT TABLE</h1>\";\r\n\r\n// print_r($part);\r\n?>\r\n<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n <meta charset=\"UTF-8\">\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n <title>Document</title>\r\n <script>\r\n var i=0,j=0,k=0;\r\n \r\n function print_array(){\r\n var element = document.getElementsByClassName(\"hidden\");\r\n //var str1 = document.getElementsByClassName(\"st1\");\r\n console.log(element);\r\n element[0].classList.remove(\"hidden\");\r\n \r\n \r\n // var array_element = document.createTextNode(ary[i][j]);\r\n // parent.appendChild(array_element);\r\n // j++;\r\n // if(j == (ary[i].length))\r\n // {\r\n // j = 0;\r\n // i++;\r\n // counter++;\r\n // }\r\n // if(counter == ary.length)\r\n // {\r\n // $('button').prop(\"disabled\",\"true\");\r\n \r\n // }\r\n }\r\n</script>\r\n</head>\r\n<body>\r\n<script>\r\nfunction finalize(){\r\n var element = document.getElementsByClassName(\"hidden\");\r\n var count=element.length;\r\n for(var i = 0 ; i < count ; i++){\r\n element[0].classList.remove(\"hidden\");\r\n }\r\n }\r\n</script>\r\n <button id = 'show' onclick = \"print_array()\" >Next Iterations</button>\r\n <button id = 'show' onclick = \"finalize()\" >Finalize</button><br>\r\n</body>\r\n\r\n\r\n\r\n</html>\r\n<?php\r\necho \"</pre>\";\r\necho \"<table>\";\r\nfor ($i = 0; $i <= $sum / 2; $i++) {\r\n echo \"<tr >\";\r\n for ($j = 1; $j <= $count; $j++) {\r\n echo \"<td class = 'hidden'>{$part[$i][$j]}</td>\";\r\n }\r\n echo \"</tr>\";\r\n\r\n \r\n}\r\necho \"</table>\";\r\n\r\nreturn $part[$sum / 2][$count];\r\n}", "function algorithmic_cost()\r\n{\r\n return ['cost' => 10];\r\n}", "function prims_mst($distance_table){\n //TODO use sets or something similar to sets for this\n $u = array();\n $v = array_keys($distance_table);\n\n $new_edges = array();\n $all_vertexes = array_keys($distance_table);\n\n $a = array_pop($v);\n array_push($u,$a);\n\n //Keep looping until we've got all the edges\n $i = 0; //Loop protector to prevent infinite loops\n $max_ittr = count($all_vertexes)+4;\n while(!contains_all_verticies($u,$all_vertexes) && $i < $max_ittr){\n\n //Now go through all the edges in $v find it's closest neighbour in $u\n //Find the miinmum of those and put that vertex in $v\n $min_v = INF;\n $min_i = 0;\n $min_j = 0;\n foreach($v as $v1){\n $mins = find_min_vertex($v1,$u,$distance_table);\n if($mins[1] < $min_v){\n $min_v = $mins[1];\n $min_i = $mins[0];\n $min_j = $v1;\n }\n }\n //add the edge to the edges and the vertex to $u\n array_push($u,$min_j);\n array_push($new_edges,array($min_j,$min_i));\n\n $v = array_delete($v,$min_j);\n\n\n\n $i++;\n }\n\n return $new_edges;\n}", "function find_min_vertex($v1,$vertices,$distance_table){\n $min = INF;\n $min_i = 0;\n\n foreach($vertices as $v2){\n $d = distance_lookup($v1,$v2,$distance_table);\n if($d < $min){\n $min = $d;\n $min_i = $v2;\n }\n }\n return array($min_i,$min);\n\n}", "public function prevision ($value){\n\n for ($i = 0; $i < count($value); $i++){\n for ($j = 0; $j < count($value[0]); $j++){\n $input[$i][$j] = ($value[$i][$j] - $this->min) / ($this->max - $this->min);\n }\n }\n\n $result = 0;\n $net = array();\n $netOut = 0;\n\n $p = -1;\n for ($i = 0; $i < count($input); $i++) {\n for ($h = 0; $h < $this->hiddenNeurons; $h++) {\n for ($j = 0; $j < count($input[0]); $j++) {\n $p++;\n $net[$h] = $this->gBest[$p] * $input[$i][$j];\n }\n }\n for ($g = 0; $g < count($net); $g++) {\n $p++;\n $net[$g] += $this->gBest[$p];\n $net[$g] = $this->sigmoid($net[$g]);\n }\n for ($y = 0; $y < count($net); $y++) {\n $p++;\n $netOut = $this->gBest[$p] * $net[$y];\n }\n $netOut += $this->gBest[$p + 1];\n\n $result = round($this->denormalize($netOut),3);\n\n $netOut = 0;\n $p = -1;\n\n for ($j = 0; $j < count($net); $j++){\n $net[$j] = 0;\n }\n }\n\n // echo $s;\n\n return $result;\n }", "function findMimInBigArray($array){\n $minBig = $array[0];\n $minInAll = [];\n $i = 0;\n $key = 0;\n for ($x = 0; $x < count($array); $x++){\n $minBig = findMimInArray($array[$x])['min'];\n $minInAll[$i] = $minBig;\n $i++;\n }\n $minBig = findMimInArray($minInAll)['min'];\n return ['min'=>$minBig];\n}", "function solution($A) {\n // write your code in PHP7.0\n $idxes = [];\n $C = [];\n $L = count($A);\n $mid = floor($L/2);\n\n foreach ($A as $k=>$v) {\n if (!isset($C[$v])) {\n $idxes[$v] = [];\n $C[$v] = 0;\n }\n\n $C[$v] += 1;\n array_push($idxes[$v], $k);\n\n if ($C[$v] > $mid) {\n $rIdx = $v;\n }\n }\n\n // No leader\n if (!isset($rIdx)) {\n return 0;\n }\n \n $leaderIndexes = $idxes[$rIdx];\n // print_r($leaderIndexes);\n $leaderTotal = count($leaderIndexes);\n $eCount = 0;\n for ($i = 0; $i < $leaderTotal; $i++) {\n $leaderIndex = $leaderIndexes[$i];\n $taCount = $leaderIndex + 1;\n \n $taMid = floor($taCount / 2);\n // $i + 1 is the count of leaders so far\n if ($i+1 > $taMid){\n $tbCount = $L - $taCount;\n $leftLeaders = $leaderTotal - ($i + 1); \n // print \"\\$i: $i, \\$leaderIndex: $leaderIndex, \\$taCount: $taCount, \\$tbCount: $tbCount, \\$leftLeaders: $leftLeaders \\r\\n\";\n if ($leftLeaders > floor($tbCount / 2)) {\n $eCount++;\n }\n\n // borrow from left for list like [4, 4, 2, 5, 3, 4, 4, 4];\n if ($i + 1 > floor(($taCount + 1) / 2) && $i+1 < $leaderTotal && $leaderIndexes[$i+1] != $leaderIndexes[$i] + 1 && $leftLeaders > floor(($tbCount - 1) / 2)) {\n $eCount++;\n }\n } \n }\n\n return $eCount;\n}", "function arrayManipulation($number, $queries) {\n\n $array=[];\n for ($index = 0; $index < count($queries); $index++)\n {\n $array[$queries[$index][0]-1]=0;\n $array[$queries[$index][1]]=0;\n }\n for ($index = 0; $index < count($queries); $index++)\n {\n $a= $queries[$index][0];\n $b= $queries[$index][1];\n $k= $queries[$index][2];\n $array[$a-1] += $k;\n $array[$b] -= $k;\n }\n\n $sum=0;\n $max=0;\n for ($index = 0; $index < $number; $index++)\n {\n @$sum += $array[$index];\n if ($sum > $max)\n $max = $sum;\n }\n return $max;\n}", "public function twoSum($nums, $sum, $index) {\n $map = array();\n $alreadyUsed = array();\n $length = count($nums);\n $retArray = array();\n for($i=0; $i<$length; ++$i) {\n if($i == $index)\n continue;\n if(array_key_exists($sum-$nums[$i], $map) && !array_key_exists($nums[$i], $alreadyUsed)) {\n array_push($retArray, array($i, $map[$sum-$nums[$i]]));\n $alreadyUsed[$nums[$i]] = true;\n $alreadyUsed[$sum-$nums[$i]] = true;\n }\n $map[$nums[$i]] = $i;\n }\n return $retArray;\n }", "function solution($N, $A) {\n $counters = array_fill(1, $N, 0);\n $currentMax = 0;\n foreach ($A as $v) {\n if ($v >= 1 && $v <= $N) {\n $counters[$v] += 1;\n if ($counters[$v] > $currentMax) {\n $currentMax = $counters[$v];\n }\n }\n else if ($v === ($N + 1)) {\n $counters = array_fill(1, $N, $currentMax);\n }\n }\n return array_values($counters);\n}", "function WeightedMatrix($con,$user_id,$filteredSimilarity)\n{\n// print_r($score_array);\n// die;\n\n $not_rated_product = [];\n $query1 = \"Select place.place_id from place WHERE place.place_id NOT IN (Select place.place_id from place join place_user on place_user.place_id = place.place_id WHERE user_id = {$user_id})\";\n $result1 = mysqli_query($con, $query1);\n\n while ($not_rated_place_id = mysqli_fetch_assoc($result1)) {\n $not_rated_product[] = $not_rated_place_id;\n\n }\n \n// print_r($not_rated_product);\n// die;\n\n $not_rated_product_map = [];\n $recommended_places = [];\n\n for ($i = 0; $i < sizeof($not_rated_product); $i++) {\n $id = $not_rated_product[$i]['place_id'];\n $query_rate = \"Select user_id,rating,place_id from place_user WHERE place_id = '$id' AND user_id != '$user_id'\";\n // echo $query_rate;\n // die;\n $result = mysqli_query($con, $query_rate);\n\n // echo \"</br>\";\n // print_r($result);\n // die;\n // echo \"Rating by other user\";\n $rate_from_user = array();\n\n while ($rating = mysqli_fetch_assoc($result)) {\n $rate_from_user[] = $rating;\n }\n\n \n \n // echo \" </br> rating is </br>\";\n // foreach($rate_from_user as $rate => $lol){\n // print_r($lol['rating']);\n // echo \"</br>\";\n // }\n \n // echo \"</br> score array is </br>\";\n // print_r($score_array);\n \n \n \n \n\n\n /// MAtching the user id from rate_from_user and score array\n\n $sum_sim_mul_rate = 0;\n $sim_mul_rate = 0;\n $sum_sim = 0;\n \n \n\n for ($k = 0; $k < sizeof($rate_from_user); $k++) {\n for ($j = 0; $j < sizeof($filteredSimilarity); $j++) {\n if ($rate_from_user[$k]['user_id'] == $filteredSimilarity[$j][0]) {\n \n \n $sum_sim = $sum_sim + $filteredSimilarity[$j][1];\n $sim_mul_rate = $rate_from_user[$k]['rating'] * $filteredSimilarity[$j][1];\n $sum_sim_mul_rate = $sum_sim_mul_rate + $sim_mul_rate;\n\n\n }\n // echo $sum_sim_mul_rate;\n \n }\n }\n ;\n \n if ($sum_sim == 0) {\n $sum_sim = 0.01;\n }\n $ratio = $sum_sim_mul_rate / $sum_sim;\n //$recommended_places[] = array($id,$ratio);\n $recommended_places[$id] = $ratio;\n\n\n }\n \n\n\n// echo \"</br> The recommened place are => </br>\";\n// echo json_encode($recommended_places) ;\n\n //print_r(arsort($recommended_places));\n\n// echo \"THe sorted\";\n\n\n// for($i = 0; $i < sizeof($recommended_places); $i++){\n// //$rec_pro_id[] = $recommended_places[$i][0];\n// $rec_pro_id[] = $recommended_places[$i][0];\n//\n// }\n\n //\n arsort($recommended_places);\n\n //--------------------------------------------------------------\n // This is the recommended place with their score\n // echo \"<pre>\";\n // print_r($recommended_places);\n // die;\n\n\n $rec_pro_id = [];\n // $count = 0;\n foreach ($recommended_places as $key => $value) {\n if ($value != 0) {\n $rec_pro_id[] = $key;\n // $count++;\n \n }\n // if ($count == 5) {\n // break;\n // }\n\n }\n //echo \"The id are \";\n //$arr=array();\n\n\n foreach ( $rec_pro_id as $abc){\n //print_r($abc);\n $arr[$i]=$abc;\n //array_push($arr,$abc);\n }\n // print_r($rec_pro_id);\n $arr=array_values($rec_pro_id);\n // print_r($arr);\n // die;\n\n return $rec_pro_id;\n\n\n\n}", "function getPriceMin($game_id, $round_number, $product_number, $region_number, $channel_number){\r\n\t\t\t$prices=new Model_DbTable_Decisions_Mk_Prices();\r\n\t\t\t$min=0;\r\n\t\t\t$min_counter=0;\r\n\t\t\t$companies=$this->getCompaniesInGame($game_id);\r\n\t\t\tforeach ($companies as $company) {\r\n\t\t\t\t$result=$prices->getDecision($game_id, $company['id'], $round_number);\r\n\t\t\t\t$result_product=$result['product_'.$product_number];\r\n\t\t\t\t$result_channel=$result_product['channel_'.$channel_number];\r\n\t\t\t\t$result_region=$result_channel['region_'.$region_number];\r\n\t\t\t\t$price=$result_region;\r\n\t\t\t\tif($min_counter==0){\r\n\t\t\t\t\t$min=$price;\r\n\t\t\t\t\t$min_counter++;\r\n\t\t\t\t}\r\n\t\t\t\tif($price<$min){\r\n\t\t\t\t\t$min=$price;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn $min;\r\n\t\t}", "public function createResult()\n {\n $totalCostCheapestPathFromTo = array();\n $cheapestPathFromTo = array();\n $vertexSet = array_values($this->graph->getVertices());\n\n $nVertices = count($vertexSet);\n\n //Total cost from i to i is 0\n for ($i = 0; $i < $nVertices; ++$i) {\n\n $totalCostCheapestPathFromTo[$i][$i] = 0;\n }\n\n // Calculating shortestPath(i,j,k+1) = min(shortestPath(i,j,k),shortestPath(i,k+1,k) + shortestPath(k+1,j,k))\n for ($k = 0; $k < $nVertices; ++$k) {\n\n for ($i = 0; $i < $nVertices; ++$i) {\n\n $this->updateInfo($vertexSet, $totalCostCheapestPathFromTo, $cheapestPathFromTo, $i, $k);\n\n for ($j = 0; $j < $nVertices; ++$j) {\n\n $this->updateInfo($vertexSet, $totalCostCheapestPathFromTo, $cheapestPathFromTo, $i, $k);\n $this->updateInfo($vertexSet, $totalCostCheapestPathFromTo, $cheapestPathFromTo, $i, $j);\n $this->updateInfo($vertexSet, $totalCostCheapestPathFromTo, $cheapestPathFromTo, $k, $j);\n\n // If we find that the path from (i, k) + (k, j) is shorter than the path (i, j), the new path is\n // calculated.\n if ($totalCostCheapestPathFromTo[$i][$k] + $totalCostCheapestPathFromTo[$k][$j] < $totalCostCheapestPathFromTo[$i][$j]) {\n\n $totalCostCheapestPathFromTo[$i][$j] = $totalCostCheapestPathFromTo[$i][$k] + $totalCostCheapestPathFromTo[$k][$j];\n\n // Testing if we are not repeating a vertex' path over itself before merging the paths\n if ($vertexSet[$i]->getId() != $vertexSet[$k]->getId() || $vertexSet[$k]->getId() != $vertexSet[$j]->getId()) {\n\n $cheapestPathFromTo[$vertexSet[$i]->getId()][$vertexSet[$j]->getId()] = array_merge($cheapestPathFromTo[$vertexSet[$i]->getId()][$vertexSet[$k]->getId()],\n $cheapestPathFromTo[$vertexSet[$k]->getId()][$vertexSet[$j]->getId()]);\n }\n\n }\n\n }\n\n }\n\n if($totalCostCheapestPathFromTo[$k][$k] < 0) {\n\n throw new UnexpectedValueException('Floyd-Warshall not supported for negative cycles');\n }\n }\n\n return new FloydWarshallResult($cheapestPathFromTo, $this->graph);\n }", "function minimum ($tab)\r\n{\r\n $min = $tab[0]; // ASTUCE: INITIALISER LA VALEUR AU PREMIER ELEMENT\r\n foreach($tab as $current) \r\n {\r\n if ($current < $min) {\r\n $min = $current; // ON MET A JOUR LA VALEUR MINIMALE\r\n }\r\n }\r\n return $min; // IL FAUT ATTENDRE LA FIN DE LA BOUCLE\r\n}", "function floydWarshall(array $graph): array\n{\n $dist = $graph;\n\n $size = count($dist);\n\n for ($k = 0; $k < $size; $k++) {\n for ($i = 0; $i < $size; $i++) {\n for ($j = 0; $j < $size; $j++) {\n $dist[$i][$j] = min($dist[$i][$j], $dist[$i][$k] + $dist[$k][$j]);\n }\n }\n }\n return $dist;\n}", "protected function compute(): void\n {\n $election = $this->getElection();\n $score = [];\n\n foreach (array_keys($election->getCandidatesList()) as $oneCandidateKey) {\n $score[$oneCandidateKey] = 0;\n }\n\n foreach ($election->getVotesManager()->getVotesValidUnderConstraintGenerator() as $oneVote) {\n $CandidatesRanked = 0;\n $oneRanking = $oneVote->getContextualRankingWithCandidateKeys($election);\n\n foreach ($oneRanking as $oneRank) {\n $rankScore = 0.0;\n foreach ($oneRank as $oneCandidateInRank) {\n $rankScore += $this->getScoreByCandidateRanking($CandidatesRanked++, $election);\n }\n\n foreach ($oneRank as $oneCandidateInRank) {\n $score[$oneCandidateInRank] += ($rankScore / \\count($oneRank)) * $oneVote->getWeight($election);\n }\n }\n }\n\n array_walk($score, static fn (float &$sc): float => $sc = round($sc, self::DECIMAL_PRECISION));\n ksort($score, \\SORT_NATURAL);\n arsort($score, \\SORT_NUMERIC);\n\n $rank = 0;\n $lastScore = null;\n $result = [];\n foreach ($score as $candidateKey => $candidateScore) {\n if ($candidateScore === $lastScore) {\n $result[$rank][] = $candidateKey;\n } else {\n $result[++$rank] = [$candidateKey];\n $lastScore = $candidateScore;\n }\n }\n\n $this->Stats = $score;\n $this->Result = $this->createResult($result);\n }", "function equalStacks($h1, $h2, $h3) {\n $sum1 = array_sum($h1);\n $sum2 = array_sum($h2);\n $sum3 = array_sum($h3);\n\n while (($sum1 != $sum2 || $sum2 != $sum3) && (count($h1) != count($h2) || count($h2) != count($h3))) {\n\n $min_value = min($sum1, $sum2, $sum3);\n\n if ($sum1 > $min_value) {\n $sum1 -= array_shift($h1);\n }\n if ($sum2 > $min_value) {\n $sum2 -= array_shift($h2);\n }\n if ($sum3 > $min_value) {\n $sum3 -= array_shift($h3);\n }\n }\n\n return $sum1;\n}", "function getMinHours($start_year, $end_year, $start_month, $end_month, $start_day, $end_day, $start_hour, $end_hour){\n\t\t//Declaring arrays\n\t\t$HOURS_IN_DAY = 24;\n\t\t$hourly_array = accessData($start_year, $end_year, $start_month, $end_month, $start_day, $end_day, $start_hour, $end_hour);\n\t\t$all_hours_array = array();\n\t\t$min_array = array();\n\t\t\n\t\t//Initializing the array that will hold every single count for each hour. \n\t\tfor($i = 0; $i < $HOURS_IN_DAY; $i++){\n\t\t\t$all_hours_array[$i] = array();\n\t\t}\n\t\t\n\t\t//This creates an associative array, with all the results for a specific hour stored in an array contained within the associative array.\n\t\t//A value indicates how many people triggered the sensor for that specific time period (year, month, day, hour).\n\t\tforeach($hourly_array as $year => $temp1){\n\t\t\tforeach($hourly_array[$year] as $month => $temp2){\n\t\t\t\tforeach($hourly_array[$year][$month] as $day => $temp3){\n\t\t\t\t\tforeach($hourly_array[$year][$month][$day] as $hour => $value){\n\t\t\t\t\t\tarray_push($all_hours_array[$hour], $value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//This will sort each array for each hour value in descending order, then it will set the minimum array value for that hour\n\t\t//by grabbing the first value for each array from $all_hours_array.\n\t\tfor($i = 0; $i < $HOURS_IN_DAY; $i++){\n\t\t\tsort($all_hours_array[$i]);\n\t\t\t$min_array[$i] = $all_hours_array[$i][0];\n\t\t}\n\t\t\n\t\t//Any values that are still null will be set to 0. \n\t\tfor($i = 0; $i < $HOURS_IN_DAY; $i++){\n\t\t\tif($min_array[$i] == NULL)\n\t\t\t\t$min_array[$i] = 0;\n\t\t}\n\t\t\n\t\treturn $min_array;\n\t}", "function get_lowest($array, $key)\n {\n $n[$key] = 99999999999;\n foreach ($array as $value) {\n if ($value[$key] <= $n[$key]) {\n $n = $value;\n }\n }\n\n return $n;\n }", "public function solve() : int\n {\n $valueArray = $this->formArrayForFactorialCalculation('isInSolution');\n return $this->factorial(array_sum($valueArray));\n }", "function updatePossibleSquares($possibleSquares, $possibleSquares2){\n for($i=0;$i<count($possibleSquares);$i++){\n list($r1, $c1, $r2, $c2) = $possibleSquares[$i];\n for($j=0;$j<count($possibleSquares2);$j++){\n list($pr1, $pc1, $pr2, $pc2) = $possibleSquares2[$j];\n if((($c1 < $pc2 && $pc2 <= $c2) || ($c1 <= $pc1 && $pc1 < $c2) || ($pc1 <= $c1 && $c2 <= $pc2))\n && (($r1 <= $pr2 && $pr2 <= $r2 + 1) || ($r1 <= $pr1 && $pr1 <= $r2 + 1) || ($pr1 <= $r1 + 1 && $r2 <= $pr2 + 1))\n ){\n $column1 = $c1;\n $column2 = $c2;\n if($c2>$pc2){\n $column2 = $pc2;\n }\n if($c1<$pc1){\n $column1 = $pc1;\n }\n // l'area del quadrato nuovo > di quella vecchia\n if(($pr2-$r1+1)*($column2-$column1+1) > ($r2-$r1+1)*($c2-$c1+1)){\n // aggiornamento possibleSquares\n $possibleSquares[$i] = array($r1, $column1, $pr2, $column2);\n }\n }\n }\n }\n return $possibleSquares;\n}", "function solution($A)\n{\n $pairs = $zeros = 0;\n\n foreach ($A as $k => $v) {\n $zeros += ($v === 0);\n\n if ($v===1) {\n $pairs += $zeros;\n }\n\n if ($pairs>1000000000) {\n $pairs = -1;\n break;\n }\n }\n\n return $pairs;\n}", "private function EvaluateOne($DISTANCES, $GT, &$BestThreshold, &$BestFP, &$BestFN)\n {\n # Flatten and sort distances vector\n $FVKEYS = array_keys($DISTANCES);\n $FlatDists = array();\n foreach ($DISTANCES as $k => $v)\n foreach ($v as $kk => $vv)\n $FlatDists[$k . \",\" . $kk] = $vv;\n asort($FlatDists);\n \n # Start from the top\n $BestThreshold = 0;\n $BestFP = 0;\n $FP = [];\n $BestFN = $FN = count($GT);\n $step = 0.01;\n $eps = 0.00001;\n $found = [];\n foreach($GT as $file) $found[$file] = false;\n \n for ($i=0; $i<1; $i+=$step)\n {\n foreach($FlatDists as $pair => $dist)\n {\n list($left, $right) = explode(\",\", $pair);\n if (($dist < $i || abs($dist-$i) < $eps) && $dist > $i-$step)\n {\n if (in_array($left, $GT) && !$found[$left]) { $found[$left] = true; $FN--; }\n if (in_array($right, $GT) && !$found[$right]) { $found[$right] = true; $FN--; }\n if (!in_array($left, $GT) && !in_array($left, $FP))\n $FP[] = $left;\n if (!in_array($right, $GT) && !in_array($right, $FP))\n $FP[] = $right;\n }\n else if ($dist > $i-$step)\n break;\n }\n //print \"Threshold $i FP \".count($FP).\" FN $FN\\n\";\n $quality = $FN + count($FP);\n $best = $BestFP + $BestFN;\n if ($quality < $best || $i == 0)\n {\n $BestFP = count($FP);\n $BestFN = $FN;\n $BestThreshold = $i;\n }\n }\n }", "function solution($arr, $int) {\n //\n}", "function minimumSwaps($arr) {\n \n\n $size = count($arr);\n $counter = 0;\n\n for ($i=0; $i < count($arr); $i++) { \n echo $arr[$i] . \" \";\n }\n\n print(\"\\n\");\n\n for ($i=0; $i < $size; $i++) { \n # code...\n if (($i+1) != $arr[$i]){\n /*$key = array_search(($i+1), $arr);\n $tmp = $arr[$i];\n $arr[$i] = ($i+1);\n $arr[$key] = $tmp;\n $counter ++;*/\n\n $value = $arr[$i];\n $tmp = $arr[$value-1];\n $arr[$value-1] = $value;\n //$tmp = $arr[($i+1)];\n $arr[$i] = $tmp;\n $counter++;\n \n\n }\n }\n\n echo $counter . \"\\n\";\n for ($i=0; $i < count($arr); $i++) { \n echo $arr[$i] . \" \";\n }\n \n \n\n}", "function SumSizeOneGoods($xi, $yi, $zi, $qty) {\n // ????????????? ????? ?? ???????????\n $ar = array($xi, $yi, $zi);\n sort($ar);\n //print_r($ar);\n\n if ($qty <= 1) {\n return (array('X' => $ar[0], 'Y' => $ar[1], 'Z' => $ar[2]));\n }\n\n $x1 = 0;\n $y1 = 0;\n $z1 = 0;\n $l = 0;\n\n $max1 = floor(Sqrt($qty));\n\n for ($y = 1; $y <= $max1; $y++) {\n $i = ceil($qty / $y);\n $max2 = floor(Sqrt($i));\n\n for ($z = 1; $z <= $max2; $z++) {\n $x = ceil($i / $z);\n\n $l2 = $x * $ar[0] + $y * $ar[1] + $z * $ar[2];\n if (($l == 0) or ($l2 < $l)) {\n $l = $l2;\n $x1 = $x;\n $y1 = $y;\n $z1 = $z;\n }\n }\n }\n\n // ?????????? ??????? ?? ????????\n //echo '<br>?????????? ??????? ?? ????????: x1=', $x1,' , y1=', $y1,' , z1=', $z1;\n // ???????? ???????? ??????\n //echo '<br>???????? ???????? ??????: x1=', $x1*$ar[0],' , y1=', $y1*$ar[1],' , z1=', $z1*$ar[2];\n\n return (array('X' => $x1 * $ar[0], 'Y' => $y1 * $ar[1], 'Z' => $z1 * $ar[2]));\n }", "public function sum_possibilitis() {\n // initialize by adding the empty set\n $UnblockedNums=$this->getUnblockedNums();\n $allcombinations=$this->getallcombinations($UnblockedNums);\n\n $sums = array();\n foreach ($allcombinations as $result){\n array_push($sums,array_sum($result));\n }\n return array_unique($sums);\n }", "function solveMeFirst($a,$b){\n return $a+$b;\n}", "function string_compare_DP($str1, $str2) {\n $MATCH = 0;\n $INSERT = 1;\n $DELETE = 2;\n\n // init DP table, with Cell object inserted into each cell\n $temp = array_fill(0, strlen($str2)+1, 0);\n $compareTable = array_fill(0, strlen($str1)+1, $temp);\n \n for ($i=0; $i < strlen($str1)+1; $i++) { \n for ($j=0; $j < strlen($str2)+1; $j++) { \n // if 1st string is empty, the only option is to insert all char\n // of 2nd string\n if ($i == 0) {\n $compareTable[$i][$j] = $j;\n } elseif ($j == 0) { // if 2nd string is empty, the only option is to remove all char from 1st string\n $compareTable[$i][$j] = $i;\n } elseif ($str1[$i-1] == $str2[$j-1]) {\n $compareTable[$i][$j] = $compareTable[$i-1][$j-1];\n } else {\n $compareTable[$i][$j] = 1 + min($compareTable[$i-1][$j-1], $compareTable[$i-1][$j], $compareTable[$i][$j-1]);\n }\n }\n }\n print2DArray($compareTable);\n // return cost\n return $compareTable[strlen($str1)][strlen($str2)];\n}", "public function getSolusiIdeal()\n\t{\n\t\t$this->aMax = $this->aMin = array();\n\t\t$this->getNilaiTopKriteria();\n\t\t$this->getNilaiTopAlternatif();\n\t\t$this->getMatriksNormalisasiTerbobot();\n\t\t//melakukan iterasi utk setiap kriteria\n\t\tforeach($this->kriteria as $id_kriteria => $a_kriteria) {\n\t\t $this->aMax[$id_kriteria] = 0;\n\t\t $this->aMin[$id_kriteria] = 100;\n\t\t //melakukan iterasi utk setiap alternatif\n\t\t foreach($this->alternatif as $id_alternatif => $nilai){\n\t\t if($this->aMax[$id_kriteria] < $this->matriksNormalisasiTerbobotY[$id_alternatif][$id_kriteria]){\n\t\t $this->aMax[$id_kriteria] = $this->matriksNormalisasiTerbobotY[$id_alternatif][$id_kriteria];\n\t\t }\n\t\t if($this->aMin[$id_kriteria] > $this->matriksNormalisasiTerbobotY[$id_alternatif][$id_kriteria]){\n\t\t $this->aMin[$id_kriteria] = $this->matriksNormalisasiTerbobotY[$id_alternatif][$id_kriteria];\n\t\t }\n\t\t }\n\t\t} \n\t}", "function findMax($arr, $n) \n{ \n\t$mi = 0; \n\tfor ($i = 0; $i < $n; ++$i) \n\t\tif ($arr[$i] > $arr[$mi]) \n\t\t\t\t$mi = $i; \n\treturn $mi; \n}", "function solution($input)\n {\n $result = 1;\n\n $divisors_desc = array();\n $divisors_asc = array();\n $divisor_limit = $input;\n\n for($i = 2; $i < $divisor_limit; $i++){\n if($input % $i == 0){\n $divisor_limit = $input/$i;\n $divisors_desc[] = $divisor_limit;\n $divisors_asc[] = $i;\n }\n }\n //complexity O(n)\n \n $divisors = array_merge($divisors_desc,array_reverse($divisors_asc));\n print_r($divisors);\n\n //if no divisors exist, the number itself is prime\n if(count($divisors)==0){\n $result = $input;\n }\n\n //finding prime number in divisors list\n //starting from highest\n for($d = 0; $d < count($divisors); $d++)\n {\n $isPrime = true;\n $divisor_limit = $divisors[$d];\n\n //if any divisor is found, number is not prime\n for($x = 2; $x<$divisor_limit;$x++)\n {\n if($divisors[$d] % $x == 0){\n $isPrime = false;\n print_r($divisors[$d]. \"is not prime\\n divisor \". $x. \"\\n\");\n break;\n }\n }\n\n if($isPrime){\n $result = $divisors[$d];\n break;\n }\n }\n\n $solution = array();\n $solution['complexity'] = \"O(n2)\";\n $solution['result'] = $result;\n\n return $solution;\n }", "public function findArrayMininum($servicesArr)\n {\n $counter = 1;\n $minIndex = [];\n foreach ($servicesArr as $value) {\n if ($counter == 1) {\n $minimum = $value['rate'];\n $minIndex = $value;\n $counter = 0;\n } else {\n if ($value['rate'] < $minimum) {\n $minimum = $value['rate'];\n $minIndex = $value;\n }\n }\n }\n return $minIndex;\n }", "private function evolve() {\n\t\t$this->sortByFitness();\n\n\t\t//Get the best individuals and keep them in the parents array\n\t\t$parents = array_slice($this->_population, 0, round($this->RETAIN / 100 * $this->POPULATION_SIZE));\n\n\t\t//Introduce random elements \n\t\tfor ($i = 0; $i < ($this->POPULATION_SIZE * $this->RANDOM_SELECTION / 100); $i++) {\n\t\t\t$parents[] = $this->randomIndividual();\n\t\t}\n\n\t\t//Introduce random mutations\n\t\t$parents = $this->mutate($parents);\n\n\t\t//Fill the rest of the array with childen\n\t\twhile(count($parents) < $this->POPULATION_SIZE) {\n\t\t\t$father = $this->randomInt(count($parents) - 1);\n\t\t\t$mother = $this->randomInt(count($parents) - 1);\n\t\t\tif ($father != $mother) {\n\t\t\t\t$father = $parents[$father];\n\t\t\t\t$mother = $parents[$mother];\n\t\t\t\t$parents[] = $this->reproduce($father, $mother);\n\t\t\t}\n\t\t}\n\n\t\t//Use this as the new population\n\t\t$this->_population = $parents;\n\t}", "static public function DijkstraAlgorithmByArray($first, $finish) {\n $link_db = Piwidict::getDatabaseConnection();\n\n if ($first == $finish) return array(0,array($first));\n\n $vertex_arr = PWRelatedWords::getAllRelatedWords(); // list of unvisited vertexes generated from list of vertexes having an edge\n if (!in_array($first, $vertex_arr))\n return array(0,NULL); // search vertexes is not connected with any edge\n\n $infinity = 1000000;\n foreach ($vertex_arr as $v)\n $unvisited[$v] = $infinity;\n $unvisited[$first] = 0;\n\n $edge_table = PWRelatedWords::getTableName(); // table of related words (words and distance between them)\n\n $prev_arr = array(); // list of next-to-last for path from first to last vertexes\n $prev_arr[$first] = NULL;\n\n $prev=$first;\n $path_len = 0;\n// $dist_arr = array(); // <key>,<value>: list of distances <value> from $first to <key>\n// $dist_arr[$first] =0;\n\n $success = 0; // the condition of finding the shortest path in the given vertex ($finish)\n\n//print \"<PRE>\";\n$count=0;\n//print $first;\n//return;\n while (!$success && sizeof($unvisited) && $path_len<$infinity) { // until all vertixes will not be visited\n// && $count<10\nprint \"<p>\".$count.\": \".sizeof($unvisited);\n//.\".-----------------------------</p>\";\n//print_r($finish_arr);\n//print_r($len_arr);\n $query = \"SELECT * FROM $edge_table WHERE lemma_id1='$prev' or lemma_id2='$prev'\"; // search nearest vertexes to $prev (НЕТ необходимости сортировать, так как неважно в какой последовательности ставятся метки)\n $res_neib = $link_db -> query_e($query,\"Query failed in file <b>\".__FILE__.\"</b>, string <b>\".__LINE__.\"</b>\");\n\n while ($row_neib = $res_neib->fetch_object()) {\n if ($row_neib->lemma_id1 == $prev)\n $last = $row_neib->lemma_id2; // $last - nearest vertexes to $prev and last vertex for next paths\n else \n $last = $row_neib->lemma_id1;\n $new_path_len = $path_len + $row_neib->weight; // path length from $prev to $last (neighbour of $prev via semantic relations)\n\n// if (!isset($dist_arr[$last]) || $dist_arr[$last]>$new_path_len) { // this is new path from $first to $last OR \n if (isset($unvisited[$last]) && $unvisited[$last]>$new_path_len) { // this is new path from $first to $last OR \n // already (one) path from $first to $last does exist, but the new path is shorter\n// $dist_arr[$last] =\n $unvisited[$last] = $new_path_len;\n $prev_arr[$last] = $prev;\n }\n }\n $count++;\n\n $path_len = min(array_values($unvisited)); // choose minimal distance of path from first to any unvisited vertex \n $prev = array_search($path_len, $unvisited); // choose unvisited vertex with minimal distance\n\nprint \" = \".$path_len;\n\n unset($unvisited[$prev]); // mark this vertes as visited, delete it from unvisited list\n\n if ($prev == $finish) { // the shortest path in $finish are found!!\n $success=1; \n continue; \n }\n\n }\nprint \"<p>$count iterations\";\n\n if ($success) { // \n $path = array($finish);\n $prev = $prev_arr[$finish];\n\n while ($prev != NULL) {\n array_unshift($path,$prev);\n $prev = $prev_arr[$prev];\n }\n\n return array($path_len, $path); \n } else return array(NULL,NULL); // any path from $first to $finish are not found\n }", "public function solve()\n {\n $this->usedInBox = range(0, 2);\n foreach ($this->usedInBox as $indexA) {\n $this->usedInBox[$indexA] = range(0, 2);\n\n foreach ($this->usedInBox[$indexA] as $indexB => $bogus) {\n $this->usedInBox[$indexA][$indexB] = range(0, 8);\n\n foreach ($this->usedInBox[$indexA][$indexB] as $indexC => $c) {\n $this->usedInBox[$indexA][$indexB][$indexC] = false;\n }\n }\n }\n\n $this->usedInRow = range(0, 8);\n foreach ($this->usedInRow as $indexA) {\n $this->usedInRow[$indexA] = range(0, 8);\n\n foreach ($this->usedInRow[$indexA] as $indexB) {\n $this->usedInRow[$indexA][$indexB] = false;\n }\n }\n\n $this->usedInColumn = range(0, 8);\n foreach ($this->usedInColumn as $indexA) {\n $this->usedInColumn[$indexA] = range(0, 8);\n\n foreach ($this->usedInColumn[$indexA] as $indexB) {\n $this->usedInColumn[$indexA][$indexB] = false;\n }\n }\n\n for ($y = 0; $y < 9; $y++) {\n for ($x = 0; $x < 9; $x++) {\n if ($this->sudoku[$y][$x] === 0) {\n continue;\n }\n\n $value = $this->sudoku[$y][$x] - 1;\n\n $this->usedInRow[$y][$value] = true;\n $this->usedInColumn[$x][$value] = true;\n $this->usedInBox[floor($y / 3)][floor($x / 3)][$value] = true;\n }\n }\n\n return $this->runSolve(0);\n }", "public function getBestValue($valueA, $valueB);", "public static function minimum($parameters=null) {}", "public function determine_best()\n\t{\n\t\t// Loop all methods and their runtimes\n\t\tforeach ($this->_methods as $method)\n\t\t{\n\t\t\t// Set best count to zero\n\t\t\t$this->best[$method->name] = 0;\n\n\t\t\t// Loop runtimes to see when was best\n\t\t\tforeach ($this->runtimes[$method->name] as $runs => $time)\n\t\t\t{\n\t\t\t\tif ($time === $this->fastest[$runs])\n\t\t\t\t{\n\t\t\t\t\t$this->best[$method->name]++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Check to see which method has highest count\n\t\t$max = array_keys($this->best, max($this->best));\n\t\t$this->best_method = $max[0];\n\n\t\t// Return this for chainability\n\t\treturn $this;\n\t}", "function checkRecursive($x, $n, $curr_num = 1,$curr_sum = 0)\n{\n // Initialize number of ways to express\n // x as n-th powers of different natural\n // numbers\n $results = 0;\n \n // Calling power of 'i' raised to 'n'\n $p = power($curr_num, $n);\n $p + $curr_sum;\n while ($p + $curr_sum < $x)\n {\n // Recursively check all greater values of i\n $results += checkRecursive($x, $n, $curr_num+1,$p+$curr_sum);\n $curr_num++;\n $p = power($curr_num, $n);\n }\n \n // If sum of powers is equal to x\n // then increase the value of result.\n echo $p + $curr_sum;\n echo \"\\n\";\n if ($p + $curr_sum == $x)\n $results++;\n \n // Return the final result\n return $results;\n}", "function findLargestPalindromeProduct($maxComponent){\n $largest = [0,0]; //this will store our working largest palindrome products\n for($i = 0; $i < $maxComponent; $i++){ //try every possible first number\n for($j = 0; $j < $maxComponent; $j++){ //try every possible 2nd number\n if(checkPalindrome($j*$i)){ //if the product is a palindrome\n if($largest[0]*$largest[1] < $i*$j){ //if the product is larger than our previous best\n $largest = [$i, $j]; //then update the working largest copy\n }\n }\n }\n }\n return($largest); //return the array containing the 2 numbers used to create the largest palindrome\n}", "function twoSum(array $nums, int $target): array\n{\n foreach ($nums as $key => $val) {\n unset($nums[$key]);\n $nextKey = array_search(($target - $val), $nums);\n if ($nextKey) {\n return [$key, $nextKey];\n }\n }\n return [];\n}", "function MatrixChainOrder($p, $n) \n{\n\n// $m[][] = array($n, $n); \n $m = tableInit($m,$n,$n);\n printTable($m,$n,$n);\n\n /* m[i, j] = Minimum number of scalar \n\n multiplications needed to compute the \n\n matrix A[i]A[i+1]...A[j] = A[i..j] where \n\n dimension of A[i] is p[i-1] x p[i] */\n\n \n\n // cost is zero when multiplying one matrix. \n\n for ($i = 1; $i < $n; $i++) \n\n $m[$i][$i] = 0; \n\n \n \n // L is chain length. \n\n for ($L = 2; $L < $n; $L++) \n\n { \n\n for ($i = 1; $i < $n - $L + 1; $i++) \n\n { \n\n $j = $i + $L - 1; \n\n if($j == $n) \n\n continue; \n\n $m[$i][$j] = PHP_INT_MAX; \n\n for ($k = $i; $k <= $j - 1; $k++) \n\n { \n\n // q = cost/scalar multiplications \n\n $q = $m[$i][$k] + $m[$k + 1][$j] + \n\n $p[$i - 1] * $p[$k] * $p[$j]; \n\n if ($q < $m[$i][$j]) \n\n $m[$i][$j] = $q; \n\n } \n\n } \n\n } \n\n \n\n return $m[1][$n-1]; \n}", "public function optimize() {}", "function get_best_sales_info($a) {\n\n $op = new product();\n \n for( $i = 0; $i < BEST_SALES; $i++ ) {\n $op->get_best_sale($a[$i], $i);\n }\n \n return $op;\n \n}", "function sumOfMinAbsDifferences($arr, $n) \r\n\t{ \r\n\t\t \r\n\t\t// sort the given array \r\n\t\tsort($arr); \r\n\t\tsort( $arr,$n); \r\n\t\t \r\n\t\t// initialize sum \r\n\t\t$sum = 0; \r\n\t\t \r\n\t\t// min absolute difference for \r\n\t\t// the 1st array element \r\n\t\t$sum += abs($arr[0] - $arr[1]); \r\n\t\t \r\n\t\t// min absolute difference for \r\n\t\t// the last array element \r\n\t\t$sum += abs($arr[$n - 1] - $arr[$n - 2]); \r\n\t\t \r\n\t\t// find min absolute difference \r\n\t\t// for rest of the array elements \r\n\t\t// and add them to sum \r\n\t\tfor ($i = 1; $i < $n - 1; $i++) \r\n\t\t\t$sum += min(abs($arr[$i] - $arr[$i - 1]), \r\n\t\t\t\t\t abs($arr[$i] - $arr[$i + 1])); \r\n\t\t\t \r\n\t\t// required sum \r\n\t\treturn $sum; \r\n\t}", "function getSequenceSum($i, $j, $k) {\n $tmp = 0;\n for ($i; $i < $j; $i++) {\n $tmp += $i;\n }\n for ($k; $k < $j; $k++) {\n $tmp += $k;\n }\n return $tmp + $j;\n}", "public static function minimum($parameters = null);", "function find_closest($arr, $l, $h, $x, $k){\n $mid = find_loc($arr, $l, $h, $x);\n echo $arr[$mid] . ' ';\n $l = $mid - 1;\n $h = $mid + 1;\n $total = 1;\n while($total < $k && $l >= 0 && $h < count($arr)){\n if($x - $arr[$l] < $arr[$h] - $x){\n echo $arr[$l] . ' ';\n $l--;\n }else{\n echo $arr[$h] . ' ';\n $h++;\n }\n $total++;\n }\n while($total < $k && $l >= 0){\n echo $arr[$l] . ' ';\n $l--;\n $total++;\n }\n while($total < $k && $h < count($arr)){\n echo $arr[$h] . ' ';\n $h++;\n $total++;\n }\n}", "function getOptimum() { return $this->readOptimum(); }", "function findMimInArray($array){\n $min = $array[0];\n $key = 0;\n for ($x = 0; $x < count($array); $x++){\n if ($min > $array[$x]){\n $min = $array[$x];\n $key = $x;\n };\n }\n return ['min'=>$min, 'key'=>$key];\n}", "public static function inferensi($nilaiIPK, $nilaiPenghasilan, $nilaiJarak, $nilaiTanggungan, $nilaiRumah, $nilaiMotor, $nilaiMobil, $nilaiListrik, $nilaiAir) {\n\n echo \"Rule yang digunakan : \\n\";\n $x = 0;\n $kondisi = [];\n\n for ($ip = 0; $ip < count($nilaiIPK); $ip++) {\n for ($pn = 0; $pn < count($nilaiPenghasilan); $pn++) {\n for ($jr = 0; $jr < count($nilaiJarak); $jr++) {\n for ($tg = 0; $tg < count($nilaiTanggungan); $tg++) {\n for ($rm = 0; $rm < count($nilaiRumah); $rm++) {\n for ($mt = 0; $mt < count($nilaiMotor); $mt++) {\n for ($mb = 0; $mb < count($nilaiMobil); $mb++) {\n for ($ls = 0; $ls < count($nilaiListrik); $ls++) {\n for ($ai = 0; $ai < count($nilaiAir); $ai++) {\n if (($nilaiIPK[$ip] > 0) && ($nilaiPenghasilan[$pn] > 0) && ($nilaiJarak[$jr] > 0) && ($nilaiTanggungan[$tg] > 0) && ($nilaiRumah[$rm] > 0) && ($nilaiMotor[$mt] > 0) && ($nilaiMobil[$mb] > 0) && ($nilaiListrik[$ls] > 0) && ($nilaiAir[$ai] > 0)) {\n $alpha[$x] = min($nilaiIPK[$ip], $nilaiPenghasilan[$pn], $nilaiJarak[$jr], $nilaiTanggungan[$tg], $nilaiRumah[$rm], $nilaiMotor[$mt], $nilaiMobil[$mb], $nilaiListrik[$ls], $nilaiAir[$ai]);\n if ($ip == 2 && $jr == 2 && $pn == 1 && $tg == 2 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 2 && $pn == 1 && $tg == 1 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 2 && $pn == 0 && $tg == 2 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 2 && $pn == 0 && $tg == 1 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 1 && $pn == 1 && $tg == 2 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 1 && $pn == 1 && $tg == 1 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 1 && $pn == 0 && $tg == 2 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 1 && $pn == 0 && $tg == 1 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 0 && $pn == 1 && $tg == 2 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 0 && $pn == 1 && $tg == 1 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 0 && $pn == 0 && $tg == 2 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else if ($ip == 2 && $jr == 0 && $pn == 0 && $tg == 1 && $ai == 0 && $rm == 0 && $mt == 0 && $mb == 0 && $ls == 0) {\n $z[$x] = self::z_dapat($alpha, $x);\n $kondisi[$x] = \"dapat\";\n } else {\n $z[$x] = self::z_tidakDapat($alpha, $x);\n $kondisi[$x] = \"tidak dapat\";\n }\n echo \"IF IPK = {$nilaiIPK[$ip]} AND Penghasilan = {$nilaiPenghasilan[$pn]} AND Jarak = {$nilaiJarak[$jr]} AND Tanggungan = {$nilaiTanggungan[$tg]} AND Rumah = {$nilaiRumah[$rm]} AND Motor = {$nilaiMotor[$mt]} AND Mobil = {$nilaiMobil[$mb]} AND Listrik = {$nilaiListrik[$ls]} AND Air = {$nilaiAir[$ai]} THEN a_predikat = {$alpha[$x]} z = {$z[$x]} kondisi = {$kondisi[$x]} \\n\";\n $x++;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n self::defuzzifikasi($alpha, $z);\n }", "function code_solver($ivvallist) {\r\n\r\n// unpack the ivs\r\n$FL= $ivvallist[0];\r\n$L= $ivvallist[1];\r\n$df= $ivvallist[2];\r\n\r\n// run the solution code\r\n$Ltot= 2*$L +$df;\r\n$W= 10;\r\n\t\r\n$s1= 0.1;\r\n$a1= sqrt($L*$L -$s1*$s1);\r\n$d1= $Ltot -2*$a1;\r\n$T1= (1/$s1)*($W*$a1/2 +$FL*$a1);\r\n$k1= $T1/($d1-$df);\r\n\t\r\n$s2= 0.2;\r\n$a2= sqrt($L*$L -$s2*$s2);\r\n$d2= $Ltot -2*$a2;\r\n$T2= (1/$s2)*($W*$a2/2 +$FL*$a2);\r\n$k2= $T2/($d2-$df);\r\n\r\n$T3= $k1*($d2-$df);\r\n$FLmax= (1/$a2)*($T3*$s2 -$W*$a2/2);\r\n\r\n// pack the results\t\r\n$avvallist[0]= $k1;\t\t// av11\r\n$avvallist[1]= $k2;\t\t// av21\r\n$avvallist[2]= $FLmax;\t// av31\r\n\r\n// return to caller\r\nreturn $avvallist;\r\n}", "public function run()\n {\n //\n $commercialCompreheniveCost = [\n [\n 'commercial_class_id'=>1,\n 'sum_insured_from_value'=>0,\n 'sum_insured_to_value'=>3000000, \n 'rate'=>4.50\n ],\n [\n 'commercial_class_id'=>1,\n 'sum_insured_from_value'=>3000001,\n 'sum_insured_to_value'=>0, \n 'rate'=>4.25\n ],\n [\n 'commercial_class_id'=>2,\n 'sum_insured_from_value'=>0,\n 'sum_insured_to_value'=>3000000, \n 'rate'=>5.75\n ],\n [\n 'commercial_class_id'=>2,\n 'sum_insured_from_value'=>3000001,\n 'sum_insured_to_value'=>7000000, \n 'rate'=>5.25\n ],\n [\n 'commercial_class_id'=>2,\n 'sum_insured_from_value'=>7000001,\n 'sum_insured_to_value'=>0, \n 'rate'=>4.25\n ],\n [\n 'commercial_class_id'=>3,\n 'sum_insured_from_value'=>0,\n 'sum_insured_to_value'=>3000000, \n 'rate'=>3\n ],\n [\n 'commercial_class_id'=>3,\n 'sum_insured_from_value'=>3000001,\n 'sum_insured_to_value'=>0, \n 'rate'=>2.5\n ],\n [\n 'commercial_class_id'=>4,\n 'sum_insured_from_value'=>0,\n 'sum_insured_to_value'=>2000000, \n 'rate'=>7.5\n ],\n [\n 'commercial_class_id'=>4,\n 'sum_insured_from_value'=>2000001,\n 'sum_insured_to_value'=>0, \n 'rate'=>6\n ],\n [\n 'commercial_class_id'=>5,\n 'sum_insured_from_value'=>600000,\n 'sum_insured_to_value'=>0, \n 'rate'=>4\n ],\n [\n 'commercial_class_id'=>6,\n 'sum_insured_from_value'=>600000,\n 'sum_insured_to_value'=>0, \n 'rate'=>4\n ],\n [\n 'commercial_class_id'=>7,\n 'sum_insured_from_value'=>600000,\n 'sum_insured_to_value'=>0, \n 'rate'=>4\n ],\n [\n 'commercial_class_id'=>8,\n 'sum_insured_from_value'=>600000,\n 'sum_insured_to_value'=>0, \n 'rate'=>12.5\n ],\n ];\n \n foreach($commercialCompreheniveCost as $key => $value){\n\n CommercialComprehensiveCost::create($value);\n\n }\n }", "function twoSumV2_hashtable($nums, $target) {\n $deltaArr = [];\n //store previous values in an associated array\n for ($i=0; $i<count($nums); $i++) {\n $delta = $target - $nums[$i];\n if (isset ($deltaArr[$delta])) {\n return [$deltaArr[$delta], $i];\n }\n else {\n $deltaArr[$nums[$i]] = $i;\n }\n }\n \n return [-1, -1];\n }", "public function getJarakSolusiIdeal()\n\t{\n\t\t$this->dPlus = $this->dMin = array();\n\t\t$this->getMatriksNormalisasiTerbobot();\n\t\t$this->getSolusiIdeal();\n\t\t//melakukan iterasi utk setiap alternatif\n\t\tforeach($this->matriksNormalisasiTerbobotY as $id_alternatif => $nilai){\n\t\t $this->dPlus[$id_alternatif] = 0;\n\t\t $this->dMin[$id_alternatif] = 0;\n\t\t //melakukan iterasi utk setiap kriteria\n\t\t foreach($nilai as $id_kriteria => $y){\n\t\t $this->dPlus[$id_alternatif] += pow($y-$this->aMax[$id_kriteria],2);\n\t\t $this->dMin[$id_alternatif] += pow($y-$this->aMin[$id_kriteria],2);\n\t\t }\n\t\t $this->dPlus[$id_alternatif] = sqrt($this->dPlus[$id_alternatif]);\n\t\t $this->dMin[$id_alternatif] = sqrt($this->dMin[$id_alternatif]);\n\t\t}\n\t}", "function _fourD_analysis_calculate_project_goal_weight( $nid, $uid=0, $goals, $project ) {\n// fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight('.$nid.'); <br>----------------------------<br>' );\n// fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight('.$nid.'); $goals: '.print_r($goals, true) );\n //fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight('.$nid.'); $project: '.print_r($project, true) );\n \n if( !count($goals) || !$project ){\n return 0.0;\n }\n \n $weight = 0;\n $indirectParents = array();\n if( isset($project['project_goal']) ){\n foreach( $goals as $gid=>$g ){\n\n $goal = fourD_analysis_goal_entry_get($gid, $uid);\n// fourD_analysis_debug('----- _fourD_analysis_calculate_project_goal_weight; : Goal: '.$project['project_goal'][$gid]['title'].'; Info: '.print_r($goal, true) );\n\n if($goal && isset($goal['goal_weight']) ){\n if( isset($project['project_goal'][$gid]['rating']) ){\n \n// fourD_analysis_debug('+++++ _fourD_analysis_calculate_project_goal_weight; : Goal: '.$project['project_goal'][$gid]['title'].'; Info: '.print_r($project['project_goal'][$gid], true) );\n\n\n /* Direct parent and top-level are G1*W1 */\n if( _fourD_analysis_is_goal_applicable_to_project_input($nid, $g) ){\n $weight += ( $goal['goal_weight']*$project['project_goal'][$gid]['rating'] );\n// fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight; INPUT: Goal: '.$project['project_goal'][$gid]['title'].'; nid: '. $gid.'; W'.$gid.' = '.$goal['goal_weight'].'; G'.$gid.' = '.$project['project_goal'][$gid]['rating'].'; W'.$gid.'*G'.$gid.' = '.( $goal['goal_weight']*$project['project_goal'][$gid]['rating'] ). '; Cumlative: '.$weight );\n\n //fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight('.$nid.'); INPUT: Goal: '.print_r($project['project_goal'][$gid], true) );\n }\n /* Indirect parents are simply (*W6*W7) - Note: not (G6*W6+G7*W7) */\n// elseif( _fourD_analysis_is_goal_applicable_to_project($nid, $g) ){\n// $indirectParents[$gid] = $goal['goal_weight'];\n// fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight; APPLICABLE: Goal: '.$project['project_goal'][$gid]['title'].'; nid: '. $gid.'; W'.$gid.' = '.$goal['goal_weight'].'; G'.$gid.' = '.$project['project_goal'][$gid]['rating'].'; W'.$gid.'*G'.$gid.' = '.( $goal['goal_weight']*$project['project_goal'][$gid]['rating'] ). '; Cumlative: '.$weight );\n// }\n \n /* ALL parents are simply (*W6*W7) - Note: not (G6*W6+G7*W7) */\n if( _fourD_analysis_is_goal_parent_to_project($nid, $g) ){\n $indirectParents[$gid] = $goal['goal_weight'];\n// fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight; PARENT: Goal: '.$project['project_goal'][$gid]['title'].'; nid: '. $gid.'; W'.$gid.' = '.$goal['goal_weight'].'; G'.$gid.' = '.$project['project_goal'][$gid]['rating'].'; W'.$gid.'*G'.$gid.' = '.( $goal['goal_weight']*$project['project_goal'][$gid]['rating'] ). '; Cumlative: '.$weight );\n //fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight('.$nid.'); PARENT: Goal: '.print_r($project['project_goal'][$gid], true) );\n }\n \n \n// fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight; nid: '. $gid.'; W'.$gid.' = '.$goal['goal_weight'].'; G'.$gid.' = '.$project['project_goal'][$gid]['rating'].'; W'.$gid.'*G'.$gid.' = '.( $goal['goal_weight']*$project['project_goal'][$gid]['rating'] ). '; Cumlative: '.$weight );\n }\n\n else{\n /* ALL parents are simply (*W6*W7) - Note: not (G6*W6+G7*W7) */\n if( _fourD_analysis_is_goal_parent_to_project($nid, $g) ){\n $indirectParents[$gid] = $goal['goal_weight'];\n// fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight; PARENT: Goal: '.$project['project_goal'][$gid]['title'].'; nid: '. $gid.'; W'.$gid.' = '.$goal['goal_weight'].'; G'.$gid.' = '.$project['project_goal'][$gid]['rating'].'; W'.$gid.'*G'.$gid.' = '.( $goal['goal_weight']*$project['project_goal'][$gid]['rating'] ). '; Cumlative: '.$weight );\n //fourD_analysis_debug('_fourD_analysis_calculate_project_goal_weight('.$nid.'); PARENT: Goal: '.print_r($g, true) );\n }\n }\n }\n\n\n }\n\n /* Finally, factor in any indirect parents */\n foreach($indirectParents as $nid=>$w){\n $weight = ($weight*$w);\n }\n }\n \n return $weight;\n}", "abstract public function minMin(): int;", "private function findBestPrice(array $requestedItems, $data) {\n $restaurantId = (integer)$data[0];\n $price = (float)$data[1];\n $items = $this->cleanData(array_slice($data, 2));\n /** @var Menu $menu */\n $menu = $this->getMenu($restaurantId);\n $this->addEntryToMenu($menu, $items, $price);\n $comboPrice = $this->getPriceForRequestedItems($requestedItems, $menu);\n if ($comboPrice != static::$NOTFULFILLABLERESULT && $comboPrice < $this->bestPrice) {\n $this->bestPrice = $comboPrice;\n $this->bestRestaurant = $restaurantId;\n }\n }", "function getResultPart1($input) {\n if ($input < 0) {\n return 0;\n }\n \n //2D matrix (not scalable to 3D, would need other changes as well)\n $total_dimensions = 2;\n $total_edges = 2 ** $total_dimensions;\n \n //get the dimension of the matrix \n //(this way our input number will be on the outer edge)\n $dimension = ceil(sqrt($input));\n \n //the dimensions of the square will always be odd (so make sure dimension is odd)\n if ($dimension % 2 == 0) {\n ++$dimension;\n }\n \n //steps to the outer ring (where the input number will be)\n $steps_to_outer_ring = floor($dimension / $total_dimensions);\n \n //steps from outer ring corner to midpoint (same as steps to outer ring)\n $steps_outer_corner_to_midpoint = $steps_to_outer_ring;\n \n //highest value in the matrix (will be located at one of the corners)\n $highest_value = $dimension ** $total_dimensions;\n \n //initialize our steps to the value to get to the outer ring\n $total_steps = $steps_to_outer_ring;\n \n //we need to figure out which side our number is on, \n //then compute the steps travelled along the outer edge\n for ($edge = 1; $edge <= $total_edges; ++$edge) {\n //compute the lowest number on each side to find where our input number is located\n //NOTE: give each side its own corner, makes computing easier (thus the minus 1)\n $side_lowest_value = $highest_value - (($dimension - 1) * $edge);\n \n //see if we have find the side our number is on\n if ($side_lowest_value <= $input) {\n //we found the side, compute the midpoint \n $side_midpoint_value = $side_lowest_value + $steps_outer_corner_to_midpoint;\n \n //add the distance travelled along the outer edge to the total steps\n $total_steps += abs($input - $side_midpoint_value);\n break;\n }\n }\n print(\"Input: $input, Required Steps: $total_steps\\n\");\n return $total_steps;\n}", "abstract public function solve();", "public function getSmallestPeakIndex()\n {\n $PeaksNoIdx = array_values($this->arrayPeaks);\n if (!empty($PeaksNoIdx)) {\n $LfltSmallestY = $PeaksNoIdx[0];\n $lReturnIdx = 0;\n for ($i = 1; $i < $this->ListLength; $i++) {\n if ($PeaksNoIdx[$i] < $LfltSmallestY) {\n $LfltSmallestY < $PeaksNoIdx[$i];\n $lReturnIdx = $i;\n }\n }\n return $lReturnIdx;\n }\n \n }", "function multiply($num)\r\n{\r\n $possible_solution = array();\r\n $ps_counter = 0;\r\n \r\n $data = array();\r\n $data_counter = 0;\r\n for($i1 = 1;$i1<=10;$i1++)\r\n {\r\n for($i2 = 1;$i2<=10;$i2++)\r\n {\r\n if(($i2 * $i1) == $num)\r\n {\r\n \r\n $data[$data_counter] = array($i1 , $i2);\r\n $data_counter++;\r\n \r\n }\r\n }\r\n }\r\n return $data;\r\n}", "function create_puzzle($array_words,$array_table,$PUZ_L,$PUZ_W){\r\n\t$rev_sort = array();\t\r\n\t$output_array = array();\r\n\t$fill_array = array();\r\n\tglobal $g_var;\r\n\t$flag_max_limit = 0;\r\n\t$badwordarray = array();\r\n\t$flag = 0;\r\n\t$array_words_row = count($array_words);\r\n\t\r\n\tif(($array_words_row > $PUZ_L) || ($array_words_row > $PUZ_W))\r\n\t{\r\n\t\techo \"Word list elements are more than length or breadth set.\\n\";\r\n\t\treturn $array_table;\r\n\t}\r\n\t\r\n\tfor($i=1; $i<=$array_words_row; $i++)\r\n\t{\r\n\t\t\tsrand((double)microtime()*1000000);\r\n\t\t\t$random = (rand(1,8));\r\n\t\t\t$rev_sort[$i] = $random;\r\n\t\t\r\n\t}\r\n\trsort($rev_sort);\r\n\tfor($i=1; $i<=$array_words_row; $i++)\r\n\t{\r\n\t\t$j=0;\r\n\t\tif($flag_max_limit == 1)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tif(($rnum) == 1)\r\n\t\t\t{\r\n\t\t\t\tfor($badword=$i;$badword<=$array_words_row;$badword++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$badwordarray[$j] = $array_words[$badword];\r\n\t\t\t\t\t$j++;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfor($y = $t; $y<=$array_words_row;$y++)\r\n\t\t\t{\r\n\t\t\t\tsrand((double)microtime()*1000000);\r\n\t\t\t\t$random = (rand(1,($rnum-1)));\r\n\t\t\t\t$rev_sort[$y-1] = $random;\r\n\t\t\t\t\r\n\t\t\t\t$i = $t;\r\n\t\t\t}\r\n\t\t\trsort($rev_sort);\r\n\t\t\t$flag_max_limit = 0;\r\n\t\t}\r\n\t\t$t = $i;\r\n\t\t$array_words_col = count($array_words[$i]);\r\n\t\tif(($array_words_col > $PUZ_L) || ($array_words_col > $PUZ_W))\r\n\t\t{\t\r\n\t\t\techo \"One of the word list elements are more than length or breadth set.\\n\";\r\n\t\t\treturn $array_table;\r\n\t\t}\r\n\t\t$rnum = $rev_sort[$i-1];\r\n\r\n\t\tswitch($rnum)\r\n\t\t{\r\n\t\t\tcase 1:\t/* Display word From top to bottom on any column*/\r\n\t\t\t\t$var = 1;\r\n\t\t\t\t$start_1 = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\t$i--;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($var >=20 && $start_1 <=$PUZ_W)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$random_num = $start_1;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$start_1 = $start_1 + 1;\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$random_num = generate_random_number(1,$PUZ_W,0);//get random num\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num + $PUZ_W;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var ++;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$fill_random = $random_num;\r\n\t\t\t\t$count = 1;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$count][$random_num] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count + 1;\r\n\t\t\t\t\t$fill_array[$fill_random] = 1;\r\n\t\t\t\t\t$fill_random = $fill_random + $PUZ_W;\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase 2: /*Display word from bottom to top on any column*/\r\n\t\t\t\t$var = 1;\r\n\t\t\t\t$start_1 = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$i--;\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($var >=20 && $start_1 <=$PUZ_W)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$random_num = $start_1;\r\n\t\t\t\t\t\t$start_1 = $start_1 + 1;\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$random_num = generate_random_number(1,$PUZ_W,0);//get random num\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$random_num = $random_num + ($PUZ_L * ($PUZ_W-1));\r\n\t\t\t\t\t\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num - $PUZ_W;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var ++;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$count = $PUZ_L;\r\n\t\t\t\t$width = $PUZ_W - 1;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$count][$random_num] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count - 1;\r\n\t\t\t\t\t$fill_array[$rand + ($PUZ_L * ($width))] = 1;\r\n\t\t\t\t\t$width = $width - 1;\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 3:\t/* Display word from right to left on any row */\r\n\t\t\t$var = 1;\r\n\t\t\t$start_1 = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\t$i--;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($var >=20 && $start_1 <=$PUZ_W)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$random_num = $start_1;\r\n\t\t\t\t\t\t$start_1 = $start_1 + 1;\r\n\t\t\t\t\t\t\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$random_num = generate_random_number(1,$PUZ_W,0);//get random num\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$random_num = $random_num * $PUZ_W;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num - 1;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var++;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$count = $PUZ_W;\r\n\t\t\t\t$width = $rand * $PUZ_W;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$random_num][$count] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count - 1;\r\n\t\t\t\t\t$fill_array[$width] = 1;\r\n\t\t\t\t\t$width = $width - 1;\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase 4:\t/* Display word from left to right on any row */\r\n\t\t\t\t$var = 1;\r\n\t\t\t\t$start_1 = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\t$i--;\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($var >=20 && $start_1 <=$PUZ_W)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$random_num = $start_1;\r\n\t\t\t\t\t\t$start_1 = $start_1 + 1;\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$random_num = generate_random_number(1,$PUZ_W,0);//get random num\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$random_num = (($random_num - 1 ) * $PUZ_W) + 1;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num + 1;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var = $var + 1;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$count = 1;\r\n\t\t\t\t$width = (($rand - 1 ) * $PUZ_W) + 1;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$random_num][$count] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count + 1;\r\n\t\t\t\t\t$fill_array[$width] = 1;\r\n\t\t\t\t\t$width = $width + 1;\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\t\t\t\r\n\t\t\tcase 5:\t/* Display word from top to bottom diagonally [left to right] */\r\n\t\t\t\t$var = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$random_num = generate_random_number(1,($PUZ_L - ($array_words_col - 1)),0);//get random num\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$random_num = (($random_num - 1 ) * $PUZ_W) + 1;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num + $PUZ_W + 1;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var ++;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$count = 1;\r\n\t\t\t\t$width = (($rand - 1 ) * $PUZ_W) + 1;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$random_num][$count] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count + 1;\r\n\t\t\t\t\t$random_num = $random_num + 1;\r\n\t\t\t\t\t$fill_array[$width] = 1;\r\n\t\t\t\t\t$width = $width + $PUZ_W + 1;\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\r\n\r\n\t\t\tcase 6:\t/* Display word from top to bottom diagonally [right to left] */\r\n\t\t\t\t$var = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$random_num = generate_random_number(1,($PUZ_L - ($array_words_col-1)),0);//get random num\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$random_num = $random_num * $PUZ_W;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num + $PUZ_W - 1;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var ++;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$count = $PUZ_W;\r\n\t\t\t\t$width = $rand * $PUZ_W;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$random_num][$count] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count - 1;\r\n\t\t\t\t\t$random_num = $random_num + 1;\r\n\t\t\t\t\t$fill_array[$width] = 1;\r\n\t\t\t\t\t$width = $width + $PUZ_W - 1;\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 7:\t/*Display word from bottom to top diagonally [left to right]*/\r\n\t\t\t\t$var = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$random_num = generate_random_number($array_words_col,$PUZ_L,0);//get random num\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$random_num = (($random_num - 1 ) * $PUZ_W) + 1;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num - ($PUZ_W - 1);\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var ++;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$count = 1;\r\n\t\t\t\t$width = (($rand - 1 ) * $PUZ_W) + 1;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$random_num][$count] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count + 1;\r\n\t\t\t\t\t$random_num = $random_num - 1;\r\n\t\t\t\t\t$fill_array[$width] = 1;\r\n\t\t\t\t\t$width = $width - ($PUZ_W - 1);\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 8:\t/* Display word from bottom to top diagonally [right to left] */\r\n\t\t\t\t$var = 1;\r\n\t\t\t\twhile(1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif($var >= 30)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$flag_max_limit = 1;\r\n\t\t\t\t\t\tbreak 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$random_num = generate_random_number($array_words_col,$PUZ_L,0);//get random num\r\n\t\t\t\t\t$rand = $random_num;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$random_num = $random_num * $PUZ_W;\r\n\t\t\t\t\t\r\n\t\t\t\t\t$flag =0;\r\n\t\t\t\t\tfor($j=0; $j<$array_words_col;$j++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif($fill_array[$random_num] == NULL)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$random_num = $random_num - ($PUZ_W + 1);\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$var ++;\r\n\t\t\t\t\t\t\t$flag = 1;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif($flag ==0 )\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\t$random_num = $rand;\r\n\t\t\t\t$count = $PUZ_W;\r\n\t\t\t\t$width = $random_num * $PUZ_W;\r\n\t\t\t\tfor($r=0 ; $r<$array_words_col; $r++)\r\n\t\t\t\t{\r\n\t\t\t\t\t$array_table[$random_num][$count] = $array_words[$i][$r];\r\n\t\t\t\t\t$count = $count - 1;\r\n\t\t\t\t\t$random_num = $random_num - 1;\r\n\t\t\t\t\t$fill_array[$width] = 1;\r\n\t\t\t\t\t$width = $width - ($PUZ_W + 1);\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t// $\r\n\treturn array($array_table,$badwordarray);;\r\n}" ]
[ "0.6152062", "0.56653184", "0.5628356", "0.56030554", "0.5586677", "0.55404663", "0.54934293", "0.5446083", "0.5429773", "0.54093146", "0.5397866", "0.53958863", "0.536665", "0.53467995", "0.52943546", "0.52510643", "0.5216274", "0.5210172", "0.5135657", "0.51047444", "0.51047444", "0.50892097", "0.5020945", "0.5005293", "0.49964345", "0.4978493", "0.4977216", "0.49615595", "0.49143422", "0.49109608", "0.48837286", "0.48744035", "0.48589364", "0.48048773", "0.47941825", "0.47785288", "0.47638628", "0.47567266", "0.47112003", "0.4699428", "0.46799973", "0.46654895", "0.46610275", "0.4650304", "0.46460688", "0.46332398", "0.4630409", "0.46146044", "0.4609714", "0.45856372", "0.45743695", "0.45706633", "0.4550407", "0.4513901", "0.45117474", "0.4508831", "0.4508607", "0.44968998", "0.44935563", "0.44872537", "0.44728857", "0.44634432", "0.4458921", "0.44583017", "0.44581914", "0.44462597", "0.44319588", "0.44259012", "0.4421444", "0.43982422", "0.43934593", "0.4386244", "0.43844494", "0.4379405", "0.4362172", "0.43494105", "0.4349332", "0.43465644", "0.43464017", "0.43434572", "0.43389794", "0.4333546", "0.43314618", "0.4330353", "0.43302065", "0.43235323", "0.43167204", "0.43129277", "0.43098688", "0.4309001", "0.42927453", "0.4288468", "0.428609", "0.4277691", "0.42516154", "0.42501742", "0.42462283", "0.4240683", "0.4240557", "0.42294767" ]
0.6439385
0
/ | Main Methods |
protected function setUp() { parent::setUp(); $this->blog = new Blog; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function main(){\n\t\t\t\n\t\t}", "public function main()\r\n {\r\n \r\n }", "public function main()\n\t{\n\t}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main() {}", "public function main()\n {\n\n }", "public function main();", "public abstract function Main();", "public function main()\n {\n return null;\n }", "public function getMain();", "public function getMain();", "public function helper()\n\t{\n\t\n\t}", "public function \tc_main(){ return \"\"; }", "function main()\r\n {\r\n $this->setOutput();\r\n }", "private function _i() {\n }", "public function core();", "public function demo();", "public function demo();", "abstract protected function main(array $arguments);", "function run()\r\n {\r\n }", "public function library()\n\t{\n\t\n\t}", "function initialize() ;", "protected function main()\n /**/\n {\n parent::run();\n }", "function main()\n{\n runGetFeature();\n runListFeatures();\n runRecordRoute();\n runRouteChat();\n}", "private function j() {\n }", "public static function main(){\n //do nothing\n }", "public function example();", "public static function run() {\n\t}", "function jzApi_main($argv) {\n\t\t$ret = array();\n\t\t\n\t\t//$ret[] = E(\"Playlists\", null, \"playlists\");\n\t\t//$ret[] = E(\"Charts & Random\", null, \"random\");\n\t\t$ret[] = E(\"Genres\", null, \"nodes\");\n\t\t\n\t\treturn $ret;\n\t}", "public function setMain(): void;", "static function main() {\n\t\t$suite = new PHPUnit_Framework_TestSuite( __CLASS__);\n \t\tPHPUnit_TextUI_TestRunner::run( $suite);\n \t}", "static function main() {\n\t\t$suite = new PHPUnit_Framework_TestSuite( __CLASS__);\n \t\tPHPUnit_TextUI_TestRunner::run( $suite);\n \t}", "static function main() {\n\t\t$suite = new PHPUnit_Framework_TestSuite( __CLASS__);\n \t\tPHPUnit_TextUI_TestRunner::run( $suite);\n \t}", "static function main() {\n\t\t$suite = new PHPUnit_Framework_TestSuite( __CLASS__);\n \t\tPHPUnit_TextUI_TestRunner::run( $suite);\n \t}", "static function main() {\n\t\t$suite = new PHPUnit_Framework_TestSuite( __CLASS__);\n \t\tPHPUnit_TextUI_TestRunner::run( $suite);\n \t}", "static function main() {\n\t\t$suite = new PHPUnit_Framework_TestSuite( __CLASS__);\n \t\tPHPUnit_TextUI_TestRunner::run( $suite);\n \t}", "function run();", "function run();", "final function whatIsGood() {\n echo \"Running is good <br>\";\n }", "abstract public function run() ;", "private function setup()\r\n\t{ }", "abstract protected function _run();", "abstract protected function _run();", "public function monarch()\n {\n }", "public function oops () {\n }", "static function main()\n {\n self::primeAnagrams(self::prime1000());\n }", "function process() ;", "public function nadar()\n {\n }", "public function work()\n {\n }", "function main() {\n\t\t$suite = new PHPUnit_Framework_TestSuite(__CLASS__);\n\t\t$result = PHPUnit_TextUI_TestRunner::run($suite);\n\t}", "public function usage() {}" ]
[ "0.7967887", "0.79450196", "0.7944685", "0.776339", "0.776339", "0.776339", "0.776339", "0.776339", "0.776339", "0.776339", "0.776339", "0.776339", "0.776339", "0.776339", "0.776339", "0.776339", "0.776339", "0.776339", "0.776339", "0.776339", "0.776339", "0.776339", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.77632904", "0.75708604", "0.7552248", "0.7421549", "0.67772996", "0.67487377", "0.67487377", "0.66071725", "0.65955824", "0.6478404", "0.6452018", "0.64203835", "0.64085996", "0.64085996", "0.6300727", "0.62803984", "0.62684834", "0.6259567", "0.62490404", "0.62313896", "0.6227982", "0.62243825", "0.6205579", "0.61697316", "0.6150349", "0.6109454", "0.6058272", "0.6058272", "0.6058272", "0.6058272", "0.6058272", "0.6058272", "0.6046345", "0.6046345", "0.60461706", "0.6037926", "0.6029341", "0.6011856", "0.6011856", "0.5988436", "0.59876126", "0.59493965", "0.5944293", "0.59430486", "0.5933049", "0.59262735", "0.5922051" ]
0.0
-1
/ | Tests |
public function it_can_be_instantiated() { $blog = Blog::instance(); static::assertInstanceOf(Blog::class, $blog); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function testBasicTest()\n {\n\n }", "public function testExample()\n {\n }", "public function testGetExpert()\n {\n }", "function test_sample() {\n\n\t\t$this->assertTrue( true );\n\n\t}", "public function testGetAll() {\n }", "public function preTest() {}", "function test(){\r\n //placeholder for future test functions\r\n }", "public function test() {\n\n\t}", "public function testSomething()\n {\n }", "public function run_tests()\n {\n }", "function test_sample() {\n\t\t$this->assertTrue( true );\n\t}", "public function testGetPatrimonio()\n {\n }", "public function testSpecial(): void {\n\t}", "public static function get_tests()\n {\n }", "public function testGetSnippet()\n {\n\n }", "public function appTests()\n {\n }", "protected function test9() {\n\n }", "function testSample() {\n\t\t$this->assertTrue( true );\n\t}", "private static function test()\n {\n $files = ['TestCase'];\n $folder = static::$root.'Testing'.'/';\n\n self::call($files, $folder);\n }", "public function testGetTemplate()\n {\n\n }", "public function testGetUnitDetails()\n {\n }", "function test0()\n {\n $this->assertTrue(true);\n }", "public function testGetContador()\n {\n }", "public function test_method()\n\t{\n\n\t}", "public static function main() \n {\n require_once \"PHPUnit/TextUI/TestRunner.php\";\n\n $suite = new PHPUnit_Framework_TestSuite(\"Zend_Filter_Word_UnderscoreToPathSeparatorTest\");\n $result = PHPUnit_TextUI_TestRunner::run($suite);\n }", "public function testGetSurvey0()\n {\n }", "public function testGetSurvey0()\n {\n }", "public function testGetExpedicao()\n {\n }", "public function testRuns()\n {\n $this->assertTrue(true);\n }", "public function testGetSuperfunds()\n {\n }", "public function testGetSuperfund()\n {\n }", "public function testExample()\n {\n dump(\"testExample\");\n $this->assertTrue(true);\n }", "public function testGetGlobalTemplate()\n {\n\n }", "public function testGetChamado()\n {\n }", "public function preTesting() {}", "public function testIndex()\n {\n\n\n\n\n\n }", "public function testGetTasks()\n {\n\n }", "public function testGetTasks()\n {\n }", "function setUp()\n {\n }", "public function testBasicTest()\r\n {\r\n $this->assertTrue(true);\r\n }", "public function getTests();", "public function testExample()\n {\n $this->assertTrue(true);\n \n }", "public function test()\n {\n }", "public function test()\n {\n }", "public function notATestCase() {}", "public function test_empty()\n {\n\n }", "public function testInit()\n {\n\n }", "public function testFindFiles()\n {\n\n }", "public function testGetFolders()\n {\n\n }", "public function testBasicTest()\n {\n $this->assertTrue(true);\n }", "public function testBasicTest()\n {\n $this->assertTrue(true);\n }", "public function testBasicTest()\n {\n $this->assertTrue(true);\n }", "public function testBasicTest()\n {\n $this->assertTrue(true);\n }", "public function testBasicTest()\n {\n $this->assertTrue(true);\n }", "public function testBasicTest()\n {\n $this->assertTrue(true);\n }", "public function testBasicTest()\n {\n $this->assertTrue(true);\n }", "public function testBasicTest()\n {\n $this->assertTrue(true);\n }", "public function testBasicTest()\n {\n $this->assertTrue(true);\n }", "public function testGetSurveyQuestions0()\n {\n }", "public function testGetSurveyQuestions0()\n {\n }", "public function test_example()\n {\n $this->assertTrue(true);\n }", "public function test_example()\n {\n $this->assertTrue(true);\n }", "public function test_example()\n {\n $this->assertTrue(true);\n }", "public function test_example()\n {\n $this->assertTrue(true);\n }", "public function testGetSurveys0()\n {\n }", "public function testGetSurveys0()\n {\n }", "public function testGetPackingPlanFiles()\n {\n }", "public function testGetItemSubCategoryFiles()\n {\n }", "function main() {\n\t\t$suite = new PHPUnit_Framework_TestSuite(__CLASS__);\n\t\t$result = PHPUnit_TextUI_TestRunner::run($suite);\n\t}", "public function testNothing()\n {\n }", "function setUp() {\n }", "public function _TestMultipleFiles()\n {\n\n }", "public function testGetSite()\n {\n }", "public function testBasicExample()\n {\n $this->assertTrue(true);\n }", "public function testAddTemplate()\n {\n\n }", "public function testBasicTest()\n {\n $response = $this->get('/test');\n\n $response->assertStatus(200);\n\n $response->assertSeeText('小粽子');\n\n }", "public function testGetOrderFiles()\n {\n }", "public function testGetSubTasks()\n {\n }", "public function testBasicTest()\n {\n $response = $this->get('tasks');\n $response->assertStatus(200);\n\n\n }", "public function testGetUsers()\n {\n }", "public function testExample()\n\t{\n\t\t$this->assertTrue(true);\n\t}", "public static function main() \n {\n require_once \"PHPUnit/TextUI/TestRunner.php\";\n\n $suite = new PHPUnit_Framework_TestSuite(\"Zend_Filter_Word_UnderscoreToSeparatorTest\");\n $result = PHPUnit_TextUI_TestRunner::run($suite);\n }", "public function testAddFile()\n {\n\n }", "public function testMain()\n {\n echo \"\\n >----------- Test Main : ---------> \\n\";\n// $this->getRandomNumber();\n// $this->getLoggedUserMail();\n// $this->saveVerificationCode();\n// $this->verification();\n// $this->checkEmailVerification();\n// $this->checkSendCode();\n }", "public function testGetAuthorizationDivision()\n {\n }", "public function test()\n {\n $this->executeScenario();\n }", "public function testBasicTest()\n {\n// $response = $this->get('/');\n//\n// $response->assertStatus(200);\n $response = $this->get('/');\n\n $response->assertStatus(200);\n $response->assertSee('Laravel Homestead 2');\n\n }", "public function testFight()\n {\n }", "function test_sampleme() {\n\t\t// Replace this with some actual testing code.\n\t\t$this->assertTrue( true );\n\t}", "public function testGetFile()\n {\n\n }", "public function test_welcome()\n {\n $this->assertTrue(true);\n }", "public function testFindTemplates()\n {\n\n }", "public function testGetAuthorizationDivisionsHome()\n {\n }", "public function testExample()\n {\n $this->assertTrue(true);\n }", "static function main() {\n\t\t$suite = new PHPUnit_Framework_TestSuite( __CLASS__);\n \t\tPHPUnit_TextUI_TestRunner::run( $suite);\n \t}", "static function main() {\n\t\t$suite = new PHPUnit_Framework_TestSuite( __CLASS__);\n \t\tPHPUnit_TextUI_TestRunner::run( $suite);\n \t}", "static function main() {\n\t\t$suite = new PHPUnit_Framework_TestSuite( __CLASS__);\n \t\tPHPUnit_TextUI_TestRunner::run( $suite);\n \t}", "static function main() {\n\t\t$suite = new PHPUnit_Framework_TestSuite( __CLASS__);\n \t\tPHPUnit_TextUI_TestRunner::run( $suite);\n \t}", "static function main() {\n\t\t$suite = new PHPUnit_Framework_TestSuite( __CLASS__);\n \t\tPHPUnit_TextUI_TestRunner::run( $suite);\n \t}", "static function main() {\n\t\t$suite = new PHPUnit_Framework_TestSuite( __CLASS__);\n \t\tPHPUnit_TextUI_TestRunner::run( $suite);\n \t}", "public function testAddSnippet()\n {\n\n }" ]
[ "0.74613214", "0.7154873", "0.70369124", "0.69628215", "0.6951414", "0.69477105", "0.69418055", "0.69417113", "0.69271964", "0.6899723", "0.68542415", "0.6852062", "0.68330353", "0.6831723", "0.68160737", "0.68042785", "0.67973584", "0.6788511", "0.6785745", "0.6782197", "0.6778697", "0.67607355", "0.6754955", "0.67467237", "0.67276376", "0.672061", "0.672061", "0.6714614", "0.66940874", "0.66933453", "0.66836584", "0.6679505", "0.6667969", "0.6662524", "0.6634354", "0.6632686", "0.66190374", "0.66149306", "0.6606199", "0.66035056", "0.6598714", "0.65906215", "0.6588061", "0.6588061", "0.6586436", "0.6571223", "0.65693915", "0.65654504", "0.65640295", "0.6551827", "0.6551827", "0.6551827", "0.6551827", "0.6551827", "0.6551827", "0.6551827", "0.6551827", "0.6551827", "0.6550983", "0.6550983", "0.6547234", "0.6547234", "0.6547234", "0.6547234", "0.6547215", "0.6547215", "0.65433663", "0.6535738", "0.6532178", "0.65317994", "0.652924", "0.6529052", "0.65246356", "0.6515377", "0.65137976", "0.6513039", "0.65091646", "0.6489263", "0.64869213", "0.6485212", "0.64821476", "0.64798075", "0.6477279", "0.64769375", "0.6475512", "0.646983", "0.6468439", "0.646723", "0.64647955", "0.646404", "0.6463764", "0.6451172", "0.6450619", "0.64493966", "0.6446719", "0.6446719", "0.6446719", "0.6446719", "0.6446719", "0.6446719", "0.6444472" ]
0.0
-1
Devolvemos las franquicias que pertenecen a esta categoria.
public function index($tipo) { //Contador de franquicias que devuelve a la vista como paramtro cuando se busca en //franquicias en la global por ejemplo si de Alimentación si pinchamos en Alimentacion devuelve de fruterias,congelados, etc.. $resultados = 0; //Array de collect subcategorias con franquicias en cada una de ellas //$franquiciasSub = array(); $franquiciasSubDestacadas = new Collection(); $franquiciasSubResto = new Collection(); //Lista final de franquicias para pasar a la vista. //$franquicias = array(); $idCategoria = Categoria::where('nombre', 'like', $tipo)->get(); //extraemos las id de las subcategorias para la categoria dada $idSubcategorias = subcategoria::where('categoria_id', '=', $idCategoria[0]->id )->get(); //Vamos añadiendo objectos subcategorias con franquicias dentro a un nuevo array creado para pasarlo a la vista posteriormente foreach($idSubcategorias as $subcategoria) { $resto = franquicias_no_destacadas::where("subcategoria_id", "=",$subcategoria->id)->get(); $destacadas = destacadas_subcategoria::where("subcategoria_id", "=",$subcategoria->id) ->orderBy(DB::raw('RAND()'))->get(); $franquiciasSubResto = $franquiciasSubResto->merge($resto); $franquiciasSubDestacadas = $franquiciasSubDestacadas->merge($destacadas); } $resultados = count($franquiciasSubDestacadas)+ count($franquiciasSubResto); //Igualamos la categoria a la devuelta por la select por si tiene acentos y la formateamos para pasarla a la vista. $categoria = strtolower((str_replace('-',' ',$idCategoria[0]->nombre))); return view ('dinamica_subcategorias',compact('franquiciasSubDestacadas','franquiciasSubResto','resultados','categoria')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCategorias(){\r\n $conector = new Conector();\r\n $banco = new BancoCategoria();\r\n return $banco->getCategorias($conector->getConexao());\r\n }", "public function HM_CategoCuentas()\n {\n }", "public function verCategoria(){\n\t\t\t$array[] = array(\"id\"=>\"A00-B99\",\"name\"=>\"Ciertas enfermedades infecciosas y parasitarias\");\n\t\t\t$array[] = array(\"id\"=>\"C00-D48\",\"name\"=>\"Neoplasias\");\n\t\t\t$array[] = array(\"id\"=>\"D50-D89\",\"name\"=>\"Enfermedades de la sangre y de los órganos hematopoyéticos y otros trastornos que afectan el mecanismo de la inmunidad\");\n\t\t\t$array[] = array(\"id\"=>\"E00-E90\",\"name\"=>\"Enfermedades endocrinas, nutricionales y metabólicas\");\n\t\t\t$array[] = array(\"id\"=>\"F00-F99\",\"name\"=>\"Trastornos mentales y del comportamiento\");\n\t\t\t$array[] = array(\"id\"=>\"G00-G99\",\"name\"=>\"Enfermedades del sistema nervioso\");\n\t\t\t$array[] = array(\"id\"=>\"H00-H59\",\"name\"=>\"Enfermedades del ojo y sus anexos\");\n\t\t\t$array[] = array(\"id\"=>\"H60-H95\",\"name\"=>\"Enfermedades del oído y de la apófisis mastoides\");\n\t\t\t$array[] = array(\"id\"=>\"I00-I99\",\"name\"=>\"Enfermedades del sistema circulatorio\");\n\t\t\treturn $array;\n\t\t\t/*\n\t\t\t$array=array(\n\t\t\t\t'CATEGORIA_ID'=>$categoria_id\n\t\t\t\t);\n\n\t\t\t$consult= oci_parse($conn,\"BEGIN Ips$_sndCitas.Ver_subcie10 END \");\n\t\t\t// $consult= oci_parse($conn,\"SELECT * FROM SUBCATEGORIA_CIE10\");\n\t\t\toci_execute($consult);\n\t\t\t*/\n\t\t}", "public function listarFilosofia(){\n \n //percorrer estantes pelas categorias para eliminar a categ desnecessaria\n foreach ($this->estante as $this->) {\n // code...\n \n if ($this->getCategoria() == \"FILOSOFIA\"){\n echo \"<h2> LIVROS DE FILOSOFIA </h2>\";\n echo \"\";\n //listar todos os livros:\n foreach ($this->livros as $livro){\n $livro->mostrarDados(); \n }\n } else {\n echo \"NENHUM LIVRO DE FILOSOFIA\";\n }\n \n } \n }", "protected function fijarAtributos(){\n \n return array(\"cod_categoria\",\"nombre\");\n \n }", "public function categoriaInactivos(){\n if($this->nolaboral->V21_M >= 1)\n {\n return 1;\n }\n if($this->nolaboral->V8_M == 1 && $this->nolaboral->V9_M == 1 && $this->nolaboral->V10_M == 1)\n {\n return 2;\n }\n if($this->caracteristicas->CH10 == 1 && $this->PP01E == 2)\n {\n return 3;\n }\n if($this->PP01E == 2)\n {\n return 4;\n }\n if($this->caracteristicas->CH06 < 6)\n {\n return 5;\n }\n if($this->discapacidad())\n {\n return 6;\n }\n\n}", "public function getCategoryFaqsMatrix()\n {\n $matrix = [];\n\n $query = sprintf(\n '\n SELECT\n fcr.category_id AS id_cat,\n fd.id AS id\n FROM\n %sfaqdata fd\n INNER JOIN\n %sfaqcategoryrelations fcr\n ON\n fd.id = fcr.record_id\n AND\n fd.lang = fcr.category_lang\n ORDER BY\n fcr.category_id, fd.id',\n Database::getTablePrefix(),\n Database::getTablePrefix()\n );\n $result = $this->config->getDb()->query($query);\n\n if ($this->config->getDb()->numRows($result) > 0) {\n while ($row = $this->config->getDb()->fetchObject($result)) {\n $matrix[$row->id_cat][$row->id] = true;\n }\n }\n\n return $matrix;\n }", "public function getCategoryFieds() {\n\t\t$result = $fields = array();\n\t\n\t\t$query = $this->db->query('DESCRIBE '. DB_PREFIX . 'category_description');\n\t\t$result = $query->rows;\n\t\t\n\t\tforeach ($result as $row) {\n\t\t\tif ($row['Field'] == 'product_id' || $row['Field'] == 'language_id') { continue; }\n\t\t\t$field = $row['Field'];\n\t\t\t$fields[$field] = $field;\n\t\t}\n\t\treturn $fields;\n\t}", "public function cargarcategoria()\n {\n \treturn Cont_Categoria::whereRaw(\" jerarquia ~ '*{1}' \")\n \t\t\t\t\t\t\t->orderBy('jerarquia', 'asc')\n \t\t\t\t\t\t\t->get();\n \t;\t\n }", "public function get_categories() {\n\t\treturn [ 'kodeforest' ];\n\t}", "public function get_categories() {\n\t\treturn [ 'kodeforest' ];\n\t}", "public function categorias()\n {\n //$categorias = Categoria::get();\n $categorias = Categoria::with(['atractivos','fotos'])->get();\n //$categorias = $categorias->load('cat_atractivos','cat_fotos');\n //$atractivos = Atractivo::all();\n $response = Response::json($categorias,200);\n //return [\"results\" =>[$response]];\n return $response;\n //return Response::json(['results' => $atractivos],200);\n }", "public function getCategorizedTables() {}", "public function filterSpecificCategories($array){\n\n $newArray = [];\n\n foreach($array as $key => $value){\n $cat = trim(strtolower(strstr($value->getArticleID()->getCategory(), ' ')));\n if($cat == \"world news\" || $cat == \"football\"/* ||$cat == \"fashion\" || $cat == \"technology\"*/){\n //test fashion whs technology $numb raus? film und politics guuut 0.8\n $newArray[$key] = $value;\n }\n\n /* if($cat == \"sport\"|| $cat == \"football\" || $cat == \"culture\" || $cat == \"art and design\"){\n $newArray[$key] = $value;\n }*/\n\n /*if( $cat == \"sport\" || $cat == \"uk news\" || $cat == \"opinion\" || $cat == \"society\" || $cat == \"business\" ||\n $cat == \"politics\" || $cat == \"world news\" || $cat == \"life and style\" || $cat == \"environment\" || $cat == \"technology\"\n ||$cat == \"television & radio\" || $cat == \"culture\" || $cat == \"art and design\" || $cat == \"film\" || $cat == \"books\"\n ||$cat == \"us news\" || $cat == \"football\" || $cat == \"fashion\" || $cat == \"travel\" || $cat == \"science\"/*){ //20 categories\n $newArray[$key] = $value;\n }*/\n\n /* if( $cat == \"us news\" || $cat == \"technology\" || $cat == \"science\" || $cat == \"sport\" || $cat == \"opinion\" ||\n $cat == \"world news\" || $cat == \"football\" || $cat == \"politics\" || $cat == \"fashion\" || $cat == \"television & radio\"\n ||$cat == \"culture\" || $cat == \"environment\" || $cat == \"art and design\" || $cat == \"life and style\" || $cat == \"travel\"/*\n || $cat == \"books\" || $cat == \"uk news\" || $cat == \"business\" || $cat == \"film\" || $cat == \"society\"){ //20 categories\n $newArray[$key] = $value;\n }\n */\n\n }\n\n\n return $newArray;\n }", "public function facturar()\n {\n $detalle[0][\"cantidad\"] = 2;\n $detalle[0][\"unidadMedida\"] = \"UND\";\n $detalle[0][\"codigoProducto\"] = \"001-2011\";\n $detalle[0][\"descripcionProducto\"] = \"Prontuario Tributario\";\n $detalle[0][\"precioUnitario\"] = \"150\";\n $detalle[0][\"montoBruto\"] = \"300\";\n $detalle[0][\"montoDescuento\"] = \"0\";\n $detalle[0][\"importeNetoGravado\"] = \"336\";\n $detalle[0][\"detalleImpuestosIva\"] = \"36\";\n $detalle[0][\"importeExento\"] = \"0\";\n $detalle[0][\"otrosImpuestos\"] = \"0\";\n $detalle[0][\"importeOtrosImpuestos\"] = \"0\";\n $detalle[0][\"importeTotalOperacion\"] = \"336\";\n $detalle[0][\"tipoProducto\"] = \"S\";// B= BIEN, S= SERVICIO\n //-------------------------------------------------------------------------------------------------------\n $detalle[0][\"personalizado_01\"] = \"N/A\";\n $detalle[0][\"personalizado_02\"] = \"N/A\";\n $detalle[0][\"personalizado_03\"] = \"N/A\";\n $detalle[0][\"personalizado_04\"] = \"N/A\";\n $detalle[0][\"personalizado_05\"] = \"N/A\";\n $detalle[0][\"personalizado_06\"] = \"N/A\";\n //--------------------------------------- DETALLE DEL SEGUNDO PRODUCTO ----------------------------------\n $detalle[1][\"cantidad\"] = 1;\n $detalle[1][\"unidadMedida\"] = \"UND\";\n $detalle[1][\"codigoProducto\"] = \"002-2011\";\n $detalle[1][\"descripcionProducto\"] = \"Membresia 6 Meses \";\n $detalle[1][\"precioUnitario\"] = \"1750\";\n $detalle[1][\"montoBruto\"] = \"1750\";\n $detalle[1][\"montoDescuento\"] = \"0\";\n $detalle[1][\"importeNetoGravado\"] = \"1960\";\n $detalle[1][\"detalleImpuestosIva\"] = \"210\";\n $detalle[1][\"importeExento\"] = \"0\";\n $detalle[1][\"otrosImpuestos\"] = \"0\";\n $detalle[1][\"importeOtrosImpuestos\"] = \"0\";\n $detalle[1][\"importeTotalOperacion\"] = \"1960\";\n $detalle[1][\"tipoProducto\"] = \"B\";// B= BIEN, S= SERVICIO\n //-------------------------------------------------------------------------------------------------------\n $detalle[1][\"personalizado_01\"] = \"N/A\";\n $detalle[1][\"personalizado_02\"] = \"N/A\";\n $detalle[1][\"personalizado_03\"] = \"N/A\";\n $detalle[1][\"personalizado_04\"] = \"N/A\";\n $detalle[1][\"personalizado_05\"] = \"N/A\";\n $detalle[1][\"personalizado_06\"] = \"N/A\";\n\n try {\n\n $client = new SoapClient(\"https://www.ingface.net/listener/ingface?wsdl\", array(\"exceptions\" => 1));\n $resultado = $client->registrarDte(array(\"dte\" => array(\"usuario\" => \"GPAUTOS\",\n \"clave\" => \"A3C73DA00A0C49722CACA5AD7B80C6CDD41D8CD98F00B204E9800998ECF8427E\",\n \"validador\" => false,\n \"dte\" => array\n (\n \"codigoEstablecimiento\" => \"2\",\n \"idDispositivo\" => \"001\",\n \"serieAutorizada\" => \"FAC\",\n \"numeroResolucion\" => \"301620181114163\",\n \"fechaResolucion\" => \"2018-11-14\",\n \"tipoDocumento\" => \"FACE\",\n \"serieDocumento\" => \"63\",\n\n \"estadoDocumento\" => \"ACTIVO\",\n \"numeroDocumento\" => \"3\",\n \"fechaDocumento\" => \"2018-11-14\",\n \"codigoMoneda\" => \"GTQ\",\n \"tipoCambio\" => \"1\",\n \"nitComprador\" => str_replace(\"-\", \"\", \"5503407-1\"),\n \"nombreComercialComprador\" => \"CONSUMIDOR FELIZ\",\n \"direccionComercialComprador\" => \"CIUDAD\",\n \"telefonoComprador\" => \"22082208\",\n \"correoComprador\" => \"[email protected]\",\n \"regimen2989\" => false,\n \"departamentoComprador\" => \"N/A\",\n \"municipioComprador\" => \"N/A\",\n\n \"importeBruto\" => 200,\n \"importeDescuento\" => 0,\n \"importeTotalExento\" => 0,\n \"importeOtrosImpuestos\" => 0,\n \"importeNetoGravado\" => 224,\n \"detalleImpuestosIva\" => 24,\n \"montoTotalOperacion\" => 224,\n \"descripcionOtroImpuesto\" => \"N/A\",\n\n \"observaciones\" => \"N/A\",\n \"nitVendedor\" => str_replace(\"-\", \"\", \"136771-4\"),\n \"departamentoVendedor\" => \"GUATEMALA\",\n \"municipioVendedor\" => \"GUATEMALA\",\n \"direccionComercialVendedor\" => \"CIUDAD REFORMA\",\n \"NombreComercialRazonSocialVendedor\" => \"NOMBRE DELA EMPRESA, S.A\",\n \"nombreCompletoVendedor\" => \"NOMBRE DELA EMPRESA, S.A\",\n \"regimenISR\" => \"1\",\n\n \"personalizado_01\" => \"N/A\",\n \"personalizado_02\" => \"N/A\",\n \"personalizado_03\" => \"N/A\",\n \"personalizado_04\" => \"N/A\",\n \"personalizado_05\" => \"N/A\",\n \"personalizado_06\" => \"N/A\",\n \"personalizado_07\" => \"N/A\",\n \"personalizado_08\" => \"N/A\",\n \"personalizado_09\" => \"N/A\",\n \"personalizado_10\" => \"N/A\",\n \"personalizado_11\" => \"N/A\",\n \"personalizado_12\" => \"N/A\",\n \"personalizado_13\" => \"N/A\",\n \"personalizado_14\" => \"N/A\",\n \"personalizado_15\" => \"N/A\",\n \"personalizado_16\" => \"N/A\",\n \"personalizado_17\" => \"N/A\",\n \"personalizado_18\" => \"N/A\",\n \"personalizado_19\" => \"N/A\",\n \"personalizado_20\" => \"N/A\",\n\n \"detalleDte\" => $detalle\n )\n )\n )\n );\n\n if ($resultado->return->valido) {\n echo \"DTE: \" . $resultado->return->numeroDte . \"</br>\";\n echo \"CAE: \" . $resultado->return->cae . \"</br>\";\n } else {\n echo \"ERROR: \" . $resultado->return->descripcion;\n }\n } catch (SoapFault $E) {\n $objResponse->addAlert($E->faultstring);\n }\n }", "private function categoriesGet()\n {\n//var_dump(__METHOD__, __LINE__, array_keys($this->confMap));\n//var_dump(__METHOD__, __LINE__, array_keys( $this->confMap[ 'configuration.' ][ 'categories.' ][ 'colours.' ][ 'points.' ]));\n // RETURN : method is called twice at least\n if ( $this->arrCategories != null )\n {\n return $this->arrCategories;\n }\n // RETURN : method is called twice at least\n // Local array for category labels\n $catLabels = null;\n // Local array for category icons\n $catIcons = null;\n // #54548, 131221, dwildt, 2+\n // Local array for category label css classes\n $catCss = null;\n\n switch ( true )\n {\n case( $this->pObj->typoscriptVersion <= 4005004 ):\n // Get the field name of the field with the category label\n $fieldForLabel = $this->confMap[ 'configuration.' ][ 'categories.' ][ 'fields.' ][ 'category' ];\n // Get the field name of the field with the category icon\n $fieldForIcon = $this->confMap[ 'configuration.' ][ 'categories.' ][ 'fields.' ][ 'categoryIcon' ];\n break;\n case( $this->pObj->typoscriptVersion <= 4005007 ):\n default:\n // Get the field name of the field with the category label\n $fieldForLabel = $this->confMap[ 'configuration.' ][ 'categories.' ][ 'fields.' ][ 'marker.' ][ 'categoryTitle' ];\n // #54548, 131221, dwildt, 4+\n // Get the field name of the field with the category label class for a marker category\n $fieldForCssMarker = $this->confMap[ 'configuration.' ][ 'categories.' ][ 'fields.' ][ 'marker.' ][ 'categoryCssMarker' ];\n // Get the field name of the field with the category label class for a path category\n $fieldForCssPath = $this->confMap[ 'configuration.' ][ 'categories.' ][ 'fields.' ][ 'marker.' ][ 'categoryCssPath' ];\n // Get the field name of the field with the category icon\n $fieldForIcon = $this->confMap[ 'configuration.' ][ 'categories.' ][ 'fields.' ][ 'marker.' ][ 'categoryIcon' ];\n break;\n }\n // #47631, #i0007, dwildt, 10+\n // Get categories from the rows\n $categoryLabels = array();\n\n // FOREACH row\n foreach ( $this->pObj->rows as $row )\n {\n // RETURN : field for category label is missing\n // 130530, dwildt\n switch ( true )\n {\n case(!$fieldForLabel ):\n // DRS\n if ( $this->pObj->b_drs_warn )\n {\n $prompt = 'table.field with the category is empty';\n t3lib_div :: devLog( '[WARN/BROWSERMAPS] ' . $prompt, $this->pObj->extKey, 2 );\n $prompt = 'Please use the TypoScript Constant Editor and maintain map.marker.field.category ';\n t3lib_div :: devLog( '[HELP/BROWSERMAPS] ' . $prompt, $this->pObj->extKey, 1 );\n }\n // DRS\n //var_dump(__METHOD__, __LINE__, $fieldForLabel);\n $this->arrCategories = array();\n return $this->arrCategories;\n // #47602, 130911, dwildt, 1+\n case(!array_key_exists( $fieldForLabel, $row ) ):\n // DRS\n if ( $this->pObj->b_drs_warn )\n {\n $prompt = 'current rows doesn\\'t contain the field \"' . $fieldForLabel . '\"';\n t3lib_div :: devLog( '[WARN/BROWSERMAPS] ' . $prompt, $this->pObj->extKey, 2 );\n }\n // DRS\n //var_dump(__METHOD__, __LINE__, $fieldForLabel, array_keys($row), $this->categoriesGetWoLatLon( $row ) );\n // #i0196, 151022, dwildt, 6+\n if ( $this->categoriesGetWoLatLon( $row ) )\n {\n $this->arrCategories = array();\n return $this->arrCategories;\n }\n $row[ $fieldForLabel ] = '';\n break;\n // #i0196, 151022, dwildt, 6+/2-\n //$this->arrCategories = array();\n //return $this->arrCategories;\n // #i0076, 140721, dwildt, +\n case($this->categoriesGetWoLatLon( $row ) ):\n continue 2;\n default:\n // follow the workflow\n }\n // RETURN : field for category label is missing\n // 4.1.7, dwildt, 1-\n //$categoryLabels = array_merge( $categoryLabels, explode( $this->catDevider, $row[ $fieldForLabel ] ) );\n // 4.1.7, dwildt, 10+\n//var_dump( __METHOD__, __LINE__, $this->catDevider, $fieldForLabel, $row[ $fieldForLabel ]);\n//die();\n $catLabelsOfCurrRow = explode( $this->catDevider, $row[ $fieldForLabel ] );\n foreach ( $catLabelsOfCurrRow as $labelKey => $labelValue )\n {\n // #47602, 130911, dwildt, 4+\n if ( empty( $labelValue ) )\n {\n $labelValue = $this->pObj->pi_getLL( 'phrase_noMapCat' );\n // #i0062, 140714, 1+\n $this->arrWoCategories[ 'rows' ][] = $row[ $this->pObj->arrLocalTable[ 'uid' ] ];\n }\n $categoryLabels[] = $labelValue;\n if ( isset( $row[ $fieldForIcon ] ) )\n {\n $catIconsOfCurrRow = explode( $this->catDevider, $row[ $fieldForIcon ] );\n $categoryIcons[ $labelValue ] = $catIconsOfCurrRow[ $labelKey ];\n }\n // #54548, 131221, dwildt, 13+\n switch ( true )\n {\n case( isset( $row[ $fieldForCssMarker ] ) ):\n $catCssOfCurrRow = explode( $this->catDevider, $row[ $fieldForCssMarker ] );\n $categoryCss[ $labelValue ] = $catCssOfCurrRow[ $labelKey ];\n break;\n case( isset( $row[ $fieldForCssPath ] ) ):\n $catCssOfCurrRow = explode( $this->catDevider, $row[ $fieldForCssPath ] );\n $categoryCss[ $labelValue ] = $catCssOfCurrRow[ $labelKey ];\n break;\n default;\n break;\n }\n }\n // 4.1.7, dwildt, 10+\n }\n // FOREACH row\n // Get categories from the rows\n // #i0120, 150101, dwildt: 4+\n if ( $this->categoriesEmpty( $categoryLabels ) )\n {\n return false;\n }\n // Remove non unique category labels\n $categoryLabels = array_unique( $categoryLabels );\n//var_dump (__METHOD__, __LINE__, $categoryLabels);\n//var_dump(__METHOD__, __LINE__);\n // Order the category labels\n $orderBy = $this->confMap[ 'configuration.' ][ 'categories.' ][ 'orderBy' ];\n switch ( $orderBy )\n {\n case( 'SORT_REGULAR' ):\n sort( $categoryLabels, SORT_REGULAR );\n break;\n case( 'SORT_NUMERIC' ):\n sort( $categoryLabels, SORT_NUMERIC );\n break;\n case( 'SORT_STRING' ):\n sort( $categoryLabels, SORT_STRING );\n break;\n case( 'SORT_LOCALE_STRING' ):\n sort( $categoryLabels, SORT_LOCALE_STRING );\n break;\n default:\n if ( $this->pObj->b_drs_warn )\n {\n $prompt = 'configuration.categories.orderBy has an unproper value: \"' . $orderBy . '\"';\n t3lib_div :: devLog( '[ERROR/BROWSERMAPS] ' . $prompt, $this->pObj->extKey, 3 );\n $prompt = 'categories will ordered by SORT_REGULAR!';\n t3lib_div :: devLog( '[WARN/BROWSERMAPS] ' . $prompt, $this->pObj->extKey, 2 );\n }\n sort( $categoryLabels, SORT_REGULAR );\n break;\n }\n // Order the category labels\n // Set the keys: keys should correspond with keys of the item colours\n $maxItem = count( $categoryLabels );\n $counter = 0;\n//var_dump(__METHOD__, __LINE__);\n//var_dump(__METHOD__, __LINE__, array_keys($this->confMap));\n foreach ( array_keys( $this->confMap[ 'configuration.' ][ 'categories.' ][ 'colours.' ][ 'points.' ] ) as $catKey )\n {\n if ( substr( $catKey, -1 ) == '.' )\n {\n continue;\n }\n $catLabels[ $catKey ] = $categoryLabels[ $counter ];\n if ( isset( $row[ $fieldForIcon ] ) )\n {\n $catIcons[ $catKey ] = $categoryIcons[ $categoryLabels[ $counter ] ];\n }\n\n // #i0062, 140714, 4+\n if ( $catLabels[ $catKey ] == $this->pObj->pi_getLL( 'phrase_noMapCat' ) )\n {\n $this->arrWoCategories[ 'iconKey' ] = $catKey;\n }\n // #54548, 131221, dwildt, 9+\n switch ( true )\n {\n case( isset( $row[ $fieldForCssMarker ] ) ):\n case( isset( $row[ $fieldForCssPath ] ) ):\n $catCss[ $catKey ] = $categoryCss[ $categoryLabels[ $counter ] ];\n break;\n default;\n break;\n }\n $counter++;\n if ( $counter >= $maxItem )\n {\n break;\n }\n }\n // Set the keys: keys should correspond with keys of the item colours\n\n $this->arrCategories[ 'labels' ] = $catLabels;\n if ( isset( $row[ $fieldForIcon ] ) )\n {\n $this->arrCategories[ 'icons' ] = $catIcons;\n }\n // #54548, 131221, dwildt, 8+\n if ( !empty( $catCss ) )\n {\n $this->arrCategories[ 'cssClass' ] = $catCss;\n }\n//var_dump(__METHOD__, __LINE__);\n\n return $this->arrCategories;\n }", "function read_Categories() {\n\n\t\tglobal $myCategories;\n\t\tglobal $gesamt;\n\t\t\n\t\t$i = 0;\n\t\t\n\t\tforeach ($myCategories as $catInfo):\n\t\t\n\t\t$test=$myCategories->category[$i]['typ'];\n\t\t\n\t\tarray_push($gesamt, $test);\n\t\t\n\t\t$i++;\n\t\tendforeach;\t\n\t\t\n\t}", "function cata_getfamilys($maxDepth = 0) {\n\tinclude_once DIMS_APP_PATH.'modules/catalogue/include/class_catalogue.php';\n\n\t$dims = dims::getInstance();\n\n\t$mods = $dims->getModuleByType('catalogue');\n\t$catalogue_moduleid = $mods[0]['instanceid'];\n\t$_SESSION['catalogue']['moduleid'] = $catalogue_moduleid;\n\n\t$oCatalogue = new catalogue();\n\t$oCatalogue->open($catalogue_moduleid);\n\t$oCatalogue->loadParams();\n\n\tif (!$oCatalogue->getParams('cata_visible_not_connected') && !$_SESSION['dims']['connected']) {\n\t\treturn array();\n\t}\n\n\t$cache = false;\n\t$cached = false;\n\t$timeCache = '';\n\t$apcKey = '_FAMS_'.md5($_SERVER['HTTP_HOST']);\n\tif (isset($_SESSION['catalogue']['global_filter'])) {\n\t\t$apcKey .= '_GF_'.$_SESSION['catalogue']['global_filter']['filter_id'];\n\t}\n\n\tif (APC_EXTENSION_LOADED) {\n\t\t$timeCache = apc_fetch($apcKey.'_TIME', $cached);\n\t}\n\n\tif (!$cached || (time() - $timeCache) > APC_CACHE_TIME) {\n\t\tinclude_once DIMS_APP_PATH.\"/modules/catalogue/include/class_famille.php\";\n\t\tinclude_once DIMS_APP_PATH.\"/modules/catalogue/include/class_article_famille.php\";\n\t\tinclude_once DIMS_APP_PATH.\"/modules/catalogue/include/class_article.php\";\n\n\t\tinclude_once DIMS_APP_PATH.\"/modules/catalogue/include/class_param.php\";\n\t\t$defLang = cata_param::getDefaultLang();\n\n\t\t$db = $dims->getDb();\n\n\n\t\t$familys = array();\n\n\t\t// liste des familles qui ont des articles\n\t\t$a_families = array();\n\t\t$sql = 'SELECT DISTINCT af.`id_famille` FROM `'.cata_article_famille::TABLE_NAME.'` AS af';\n\n\t\t// si un marché est en cours, on regarde si il est restrictif\n\t\tif (isset($_SESSION['catalogue']['market'])) {\n\t\t\t$market = cata_market::getByCode($_SESSION['catalogue']['market']['code']);\n\t\t\tif ($market->hasRestrictions()) {\n\t\t\t\t$sql .= ' WHERE af.`id_article` IN ('.implode(',', $market->getRestrictions()).')';\n\t\t\t}\n\t\t}\n\n\t\t// Si un filtre global est activé, on limite la vue des familles\n\t\tif (isset($_SESSION['catalogue']['global_filter'])) {\n\t\t\t$sql .= '\n\t\t\t\tINNER JOIN \t`'.article::TABLE_NAME.'` AS a\n\t\t\t\tON \t\t\ta.`id` = af.`id_article`\n\t\t\t\tAND \t\ta.`fields'.$_SESSION['catalogue']['global_filter']['filter_id'].'` = '.$_SESSION['catalogue']['global_filter']['filter_value'].'\n\t\t\t\tAND \t\ta.`published` = '.article::ARTICLE_PUBLISHED.'\n\t\t\t\tAND \t\ta.`status` = \"'.article::STATUS_OK.'\"\n\t\t\t\tAND \t\ta.`putarif_0` > 0';\n\t\t}\n\n\t\t$rs = $db->query($sql);\n\t\twhile ($row = $db->fetchrow($rs)) {\n\t\t\t$a_families[$row['id_famille']] = 1;\n\t\t}\n\n\t\t$select = \"\n\t\t\tSELECT f.*, a.urlrewrite AS urlrewrite_article\n\t\t\tFROM \".cata_famille::TABLE_NAME.\" f\n\t\t\tLEFT JOIN \tdims_mod_wce_article a\n\t\t\tON \t\t\ta.id = f.id_article_wce\n\t\t\tWHERE f.id_lang = $defLang \";\n\t\tif ($maxDepth > 0) {\n\t\t\t$select .= \" AND f.depth <= $maxDepth\";\n\t\t}\n\t\t$select .= \" ORDER BY f.depth ASC, f.position\";\n\n\t\t$rewriting=array();\n\t\t$rewritingid=array();\n\t\t$_SESSION['urlrewrite'] = array();\n\n\t\t$result = $db->query($select);\n\t\twhile ($fields = $db->fetchrow($result)) {\n\t\t\t// construction du heading rewriting\n\t\t\tif (isset($rewriting[$fields['id_parent']])) {\n\t\t\t\t$fields['urlrewrite'] = $rewriting[$fields['id_parent']].'/'.$fields['urlrewrite'];\n\t\t\t\t$rewritingid[$fields['id']] = $fields['id'];\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$rewritingid[$fields['id']] = $fields['id'];\n\t\t\t}\n\t\t\t$rewriting[$fields['id']] = $fields['urlrewrite'];\n\t\t\t$_SESSION['urlrewrite'][$fields['urlrewrite']] = $rewritingid[$fields['id']];\n\t\t\t$fields['urlrewrite'].=\".html\";\n\n\t\t\t$familys['list'][$fields['id']] = $fields;\n\t\t\t$familys['tree'][$fields['id_parent']][] = $fields['id'];\n\n\t\t\t$parents = explode(';',$familys['list'][$fields['id']]['parents']);\n\n\t\t\tif (isset($parents[0])) unset($parents[0]);\n\n\t\t\t$parents[] = $fields['id'];\n\n\t\t\t$familys['list'][$fields['id']]['nav'] = implode('-',$parents);\n\n\t\t\t// maj de la couleur de la famille\n\t\t\tif ($fields['color'] == '' && isset($familys['list'][$fields['id_parent']]) && $familys['list'][$fields['id_parent']]['color'] != '') {\n\t\t\t\t$familys['list'][$fields['id']]['color'] = $familys['list'][$fields['id_parent']]['color'];\n\t\t\t\t$familys['list'][$fields['id']]['color2'] = $familys['list'][$fields['id_parent']]['color2'];\n\t\t\t\t$familys['list'][$fields['id']]['color3'] = $familys['list'][$fields['id_parent']]['color3'];\n\t\t\t\t$familys['list'][$fields['id']]['color4'] = $familys['list'][$fields['id_parent']]['color4'];\n\t\t\t}\n\t\t}\n\n\t\t// nettoyage le l'arbre avec la suppression des familles\n\t\t// qui n'appartiennent pas a l'adherent\n\t\tif (isset($familys['list'])) {\n\t\t\tforeach ($familys['list'] as $famId => $fam) {\n\t\t\t\tcata_cleanFamilys($familys, $famId, $a_families);\n\t\t\t}\n\t\t}\n\n\n\t\t$_SESSION['catalogue']['familys'] = $familys;\n\n\t\tif (APC_EXTENSION_LOADED) {\n\t\t\tapc_store($apcKey, $familys);\n\t\t\tapc_store($apcKey.'_REWRITE', $_SESSION['urlrewrite']);\n\t\t\tapc_store($apcKey.'_TIME', time());\n\t\t}\n\t}\n\telse {\n\t\t$familys = apc_fetch($apcKey);\n\t\t$_SESSION['urlrewrite'] = apc_fetch($apcKey.'_REWRITE');\n\n\t\t// On remet les familles en session si elles y sont pas encore\n\t\tif (!isset($_SESSION['catalogue']['familys'])) {\n\t\t\t$_SESSION['catalogue']['familys'] = $familys;\n\t\t}\n\t}\n\n\treturn $familys;\n}", "function get_all_category(){\n\t\t$sql = \"SELECT *\n\t\t\t\tFROM evs_database.evs_set_form_attitude\";\n $query = $this->db->query($sql);\n\t\treturn $query;\n\n\t}", "public function listFaqs()\n {\n $category = DB::table(\"faq_categories\")->get()->each(function ($value) {\n $faqs =DB::table('pages')->where([self::FAQ_CAT_ID => $value->id, \"type\" => \"faqs\"])->orderBy(self::ORDER_ID, 'asc')->get();\n foreach ($faqs as $val) {\n $val->descriptions = $val->description;\n }\n\n $value->faqs =$faqs ;\n });\n return [self::STATUS => true, \"data\" => $category];\n }", "function getCategories() {\r\n\t\t$categories = $this->find('all');\r\n\t\t$result = array();\r\n\t\tforeach ($categories as $category) {\r\n\t\t\t$result[$category['NbCategory']['id']] = array(\r\n\t\t\t\t'probability' => $category['NbCategory']['probability'],\r\n\t\t\t\t'word_count' => $category['NbCategory']['word_count']\r\n\t\t\t);\r\n\t\t}\r\n\t\treturn $result;\r\n\t}", "public function getCategorias(){\n\t\t$sql = \"SELECT * FROM tipo_producto ORDER BY nombre_tipo_prod\";\n\t\t$params = array(null);\n\t\treturn Database::getRows($sql, $params);\n\t}", "public function categoriaOcupacional()\n {\n if ($this->PP05A==1 && $this->PP05D==1){\n return 1;\n }\n if ($this->PP05A==1 && ($this->PP05D==2 || $this->PP05D==3)){\n return 2;\n }\n if ($this->PP05A==3){\n return 3;\n }\n if ($this->PP05A==2 && $this->PP05B==2 && $this->PP05B1==3){\n return 4;\n }\n // #Ns./Nr.\n // (me parece que es si no se completa: pp05a=null)\n }", "function categories($prefix_subcategories = true)\n{\n $temp = [];\n $temp['01-00'] = 'Arts';\n $temp['01-01'] = 'Design';\n $temp['01-02'] = 'Fashion & Beauty';\n $temp['01-03'] = 'Food';\n $temp['01-04'] = 'Books';\n $temp['01-05'] = 'Performing Arts';\n $temp['01-06'] = 'Visual Arts';\n\n $temp['02-00'] = 'Business';\n $temp['02-02'] = 'Careers';\n $temp['02-03'] = 'Investing';\n $temp['02-04'] = 'Management';\n $temp['02-06'] = 'Entrepreneurship';\n $temp['02-07'] = 'Marketing';\n $temp['02-08'] = 'Non-Profit';\n\n $temp['03-00'] = 'Comedy';\n $temp['03-01'] = 'Comedy Interviews';\n $temp['03-02'] = 'Improv';\n $temp['03-03'] = 'Stand-Up';\n\n $temp['04-00'] = 'Education';\n $temp['04-04'] = 'Language Learning';\n $temp['04-05'] = 'Courses';\n $temp['04-06'] = 'How To';\n $temp['04-07'] = 'Self-Improvement';\n\n $temp['20-00'] = 'Fiction';\n $temp['20-01'] = 'Comedy Fiction';\n $temp['20-02'] = 'Drama';\n $temp['20-03'] = 'Science Fiction';\n\n $temp['06-00'] = 'Government';\n\n $temp['30-00'] = 'History';\n\n $temp['07-00'] = 'Health & Fitness';\n $temp['07-01'] = 'Alternative Health';\n $temp['07-02'] = 'Fitness';\n // $temp['07-03'] = 'Self-Help';\n $temp['07-04'] = 'Sexuality';\n $temp['07-05'] = 'Medicine';\n $temp['07-06'] = 'Mental Health';\n $temp['07-07'] = 'Nutrition';\n\n $temp['08-00'] = 'Kids & Family';\n $temp['08-01'] = 'Education for Kids';\n $temp['08-02'] = 'Parenting';\n $temp['08-03'] = 'Pets & Animals';\n $temp['08-04'] = 'Stories for Kids';\n\n $temp['40-00'] = 'Leisure';\n $temp['40-01'] = 'Animation & Manga';\n $temp['40-02'] = 'Automotive';\n $temp['40-03'] = 'Aviation';\n $temp['40-04'] = 'Crafts';\n $temp['40-05'] = 'Games';\n $temp['40-06'] = 'Hobbies';\n $temp['40-07'] = 'Home & Garden';\n $temp['40-08'] = 'Video Games';\n\n $temp['09-00'] = 'Music';\n $temp['09-01'] = 'Music Commentary';\n $temp['09-02'] = 'Music History';\n $temp['09-03'] = 'Music Interviews';\n\n $temp['10-00'] = 'News';\n $temp['10-01'] = 'Business News';\n $temp['10-02'] = 'Daily News';\n $temp['10-03'] = 'Entertainment News';\n $temp['10-04'] = 'News Commentary';\n $temp['10-05'] = 'Politics';\n $temp['10-06'] = 'Sports News';\n $temp['10-07'] = 'Tech News';\n\n $temp['11-00'] = 'Religion & Spirituality';\n $temp['11-01'] = 'Buddhism';\n $temp['11-02'] = 'Christianity';\n $temp['11-03'] = 'Hinduism';\n $temp['11-04'] = 'Islam';\n $temp['11-05'] = 'Judaism';\n $temp['11-06'] = 'Religion';\n $temp['11-07'] = 'Spirituality';\n\n $temp['12-00'] = 'Science';\n $temp['12-01'] = 'Medicine';\n $temp['12-02'] = 'Natural Sciences';\n $temp['12-03'] = 'Social Sciences';\n $temp['12-04'] = 'Astronomy';\n $temp['12-05'] = 'Chemistry';\n $temp['12-06'] = 'Earth Sciences';\n $temp['12-07'] = 'Life Sciences';\n $temp['12-08'] = 'Mathematics';\n $temp['12-09'] = 'Nature';\n $temp['12-10'] = 'Physics';\n\n $temp['13-00'] = 'Society & Culture';\n // $temp['13-01'] = 'History';\n $temp['13-02'] = 'Personal Journals';\n $temp['13-03'] = 'Philosophy';\n $temp['13-04'] = 'Places & Travel';\n $temp['13-05'] = 'Relationships';\n $temp['13-06'] = 'Documentary';\n\n $temp['14-00'] = 'Sports';\n $temp['14-05'] = 'Baseball';\n $temp['14-06'] = 'Basketball';\n $temp['14-07'] = 'Cricket';\n $temp['14-08'] = 'Fantasy Sports';\n $temp['14-09'] = 'Football';\n $temp['14-10'] = 'Golf';\n $temp['14-11'] = 'Hockey';\n $temp['14-12'] = 'Rugby';\n $temp['14-13'] = 'Running';\n $temp['14-14'] = 'Soccer';\n $temp['14-15'] = 'Swimming';\n $temp['14-16'] = 'Tennis';\n $temp['14-17'] = 'Volleyball';\n $temp['14-18'] = 'Wilderness';\n $temp['14-19'] = 'Wrestling';\n\n $temp['15-00'] = 'Technology';\n\n $temp['50-00'] = 'True Crime';\n\n $temp['16-00'] = 'TV & Film';\n $temp['16-01'] = 'After Shows';\n $temp['16-02'] = 'Film History';\n $temp['16-03'] = 'Film Interviews';\n $temp['16-04'] = 'Film Reviews';\n $temp['16-05'] = 'TV Reviews';\n\n if ($prefix_subcategories) {\n foreach ($temp as $key => $val) {\n $parts = explode('-', $key);\n $cat = $parts[0];\n $subcat = $parts[1];\n\n if ($subcat != '00') {\n $temp[$key] = $temp[$cat.'-00'].' > '.$val;\n }\n }\n }\n\n return $temp;\n}", "public function getFanPageCategories()\n {\n return DB::table('promotions')\n ->join('fan_pages', 'promotions.fan_page_id', '=', 'fan_pages.id')\n ->leftJoin('category_translations', 'fan_pages.category', '=', 'category_translations.en')\n ->whereNull('deleted_at')\n ->where(function ($query) {\n $query->where('end_date', '>', Carbon::now())->orWhereNull('end_date'); // where active promotion\n })\n ->select(DB::raw(\n 'fan_pages.category as en, \n IFNULL(category_translations.es, fan_pages.category) as es, \n count(1) as count'\n ))\n // ->where('status', '<>', 1)\n ->groupBy('fan_pages.category', 'category_translations.es')\n ->orderByRaw('IFNULL(category_translations.es, fan_pages.category)')\n ->get();\n }", "public static function getAll()\n\t{\n\t\t$categories = self::find()->asArray()->all(); // Добавить проверку если в prize is_limit = 0 and amount = 0\n\t\tforeach ($categories as $k => $category) {\n\t\t\t$categories[$k]['icon'] = self::getIconName($category['name']);\n\t\t}\n\t\treturn $categories;\n\t}", "function featureak_FCategories($args) {\n $xDBArr = unserialize(get_option('featureak_Values'));\n if($xDBArr[0][4]!=\"4\") {\n $xFinal = $args;\n }else {\n $xFinal='';\n }\n\n $xDBArr = unserialize(get_option('featureak_Values'));\n for($i=0;$i<$xDBArr[0][0];$i++) {\n\n $xCatLink = get_category_link($xDBArr[1][$i]);\n $xCatName = get_cat_name( $xDBArr[1][$i] );\n $xCatExists = false;\n foreach((get_the_category()) as $category) {\n if($xCatName==$category->cat_name) {\n $xCatExists = true;\n break;\n }\n }\n if($xCatExists==true) {\n $xCatStyle =' style=\"background:#'.$xDBArr[0][3].';border:1px solid #'.$xDBArr[0][2].';'.$xDBArr[0][5].'color:##'.$xDBArr[0][1].'\" ';\n $xFinal .='<a href=\"'.$xCatLink.'\" '.$xCatStyle.' title=\"'.$xCatName.'\">'.$xCatName.'</a>';\n }\n }\n\n\n return $xFinal;\n}", "public function get_categoria() {\n $conectar=parent::conexion();\n parent::set_names();\n $sql=\"SELECT * FROM tm_categoria WHERE est=1\";\n $sql=$conectar->prepare($sql);\n $sql->execute();\n // IMPORTANTE AGREGARLE EL PDO::FETCH_ASSOC PARA QUE HAGA BIEN LA CONSULTA\n return $resultado=$sql->fetchAll(PDO::FETCH_ASSOC);\n\n }", "public function categorias($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)){$page = 1;} \n \n $categorias = $woocommerce->get('products/categories', 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.categoriasFranqueado=\".$franquia);\n //----------------------------------------------------------\n\n return view('franqueado.categoria', \n array(\n 'franquia' => $franquia, \n 'categorias' => $categorias,\n 'page' => $page,\n 'totalPages' => $totalPages,\n 'linkPaginate' => 'franqueados/'.$franquia->id.'/categorias/',\n ));\n\n }else{\n return view('errors.403');\n }\n //---------------------------------------------------------------------------------------------------\n\n\n \n }\n else{\n return view('errors.403');\n }\n }", "public function get_categories()\n {\n return ['general'];\n }", "public function get_categories()\n {\n return ['general'];\n }", "function get_dataset_definitions_category($form) {\n global $CFG, $DB;\n $datasetdefs = array();\n $lnamemax = 30;\n if (!empty($form->category)) {\n $sql = \"SELECT i.*,d.*\n FROM {question_datasets} d,\n {question_dataset_definitions} i\n WHERE i.id = d.datasetdefinition\n AND i.category = ?\n ;\n \";\n if ($records = $DB->get_records_sql($sql, array($form->category))) {\n foreach ($records as $r) {\n if ( !isset ($datasetdefs[\"$r->name\"])) $datasetdefs[\"$r->name\"] = $r->itemcount;\n }\n }\n }\n return $datasetdefs ;\n }", "public function filterRoughCategories($array){\n\n $newArray = [];\n\n foreach($array as $key => $value){\n $cat = explode(\" \",$value->getArticleID()->getCategory())[0];\n if($cat == \"football\" ||$cat == \"world\" ||$cat == \"sport\" || $cat == \"uk-news\" ||$cat == \"fashion\"){ //5 categories\n $newArray[$key] = $value;\n }\n\n /*if($cat == \"uk-news\" ||$cat == \"world\" ||$cat == \"sport\" || $cat == \"football\" ||$cat == \"opinion\" ||\n $cat == \"culture\" || $cat == \"fashion\" ||$cat == \"business\" ||$cat == \"lifeandstyle\" || $cat == \"environment\"\n || $cat == \"technology\" || $cat == \"travel\"){ //12 categories\n $newArray[$key] = $value;\n }*/\n }\n return $newArray;\n }", "function femaleCategories(){\n\n $female_products= Product::where(\"sub_section\", \"female\")->get();\n\n $female_product_categories= $female_products->map(function($product){\n return $product->category;\n });\n\n $female_product_categories= $female_product_categories->unique();\n\n return response()->json($female_product_categories);\n\n\n }", "public function getCategoriesAndParents() {\n\t\t$cats = array();\n\t\tif ($this->categories) {\n\t\t\t$configuration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['camaliga']);\n\t\t\t$catMode = intval($configuration[\"categoryMode\"]);\n\t\t\t$lang = intval($GLOBALS['TSFE']->config['config']['sys_language_uid']);\n\t\t\t// Step 1: select all categories of the current language\n\t\t\t$categoriesUtility = \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::makeInstance('\\quizpalme\\Camaliga\\Utility\\AllCategories');\n\t\t\t$all_cats = $categoriesUtility->getCategoriesarrayComplete();\n\t\t\t// Step 2: aktuelle orig_uid herausfinden\n\t\t\t$orig_uid = intval($this->getUid());\t// ist immer die original uid (nicht vom übersetzten Element!)\n\t\t\tif ($lang > 0 && $catMode == 0) {\n\t\t\t\t$res4 = $GLOBALS['TYPO3_DB']->exec_SELECTquery(\n\t\t\t\t\t\t'uid',\n\t\t\t\t\t\t'tx_camaliga_domain_model_content',\n\t\t\t\t\t\t'deleted=0 AND hidden=0 AND sys_language_uid=' . $lang . ' AND t3_origuid=' . $orig_uid);\n\t\t\t\tif ($GLOBALS['TYPO3_DB']->sql_num_rows($res4) > 0) {\n\t\t\t\t\twhile($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res4))\n\t\t\t\t\t\tif ($row['uid']) {\n\t\t\t\t\t\t\t$orig_uid = intval($row['uid']);\t// uid of the translated element\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$GLOBALS['TYPO3_DB']->sql_free_result($res4);\n\t\t\t}\n\t\t\t// Step 3: get the mm-categories of the current element (from the original or translated element)\n\t\t\t$res4 = $GLOBALS['TYPO3_DB']->exec_SELECTquery(\n\t\t\t\t'uid_local',\n\t\t\t\t'sys_category_record_mm',\n\t\t\t\t\"tablenames='tx_camaliga_domain_model_content' AND uid_foreign=\" . $orig_uid);\n\t\t\tif ($GLOBALS['TYPO3_DB']->sql_num_rows($res4) > 0) {\n\t\t\t\twhile($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res4)){\n\t\t\t\t\t$uid = $row['uid_local'];\n\t\t\t\t\tif (!isset($all_cats[$uid]['parent'])) continue;\n\t\t\t\t\t$parent = (int) $all_cats[$uid]['parent'];\n\t\t\t\t\t//if (!$all_cats[$parent]['title'])\tcontinue;\n\t\t\t\t\tif (!isset($cats[$parent])) {\n\t\t\t\t\t\t$cats[$parent] = array();\n\t\t\t\t\t\t$cats[$parent]['childs'] = array();\n\t\t\t\t\t\t$cats[$parent]['title'] = $all_cats[$parent]['title'];\n\t\t\t\t\t}\n\t\t\t\t\tif ($all_cats[$uid]['title'])\n\t\t\t\t\t\t$cats[$parent]['childs'][$uid] = $all_cats[$uid]['title'];\n\t\t\t\t}\n\t\t\t}\n\t\t\t$GLOBALS['TYPO3_DB']->sql_free_result($res4);\n\t\t}\n\t\treturn $cats;\n\t}", "public function getStrategys()\n {\n return [\n\n ];\n }", "public function allCategoriesAllCountry() {\n $allnews = array();\n // $data = Newsdata::where('created_at', '<=', Carbon::now()->subDays(5)->toDateTimeString ())->get(); //Older than today\n // $data = Newsdata::where('created_at', '>=', Carbon::now()->subDays(2)->toDateTimeString ())->get(); //Younger than today\n // return $data;\n \n array_push($allnews, Newsdata::inRandomOrder()->get() );\n array_push($allnews, Business::inRandomOrder()->get() );\n array_push($allnews, Entertainment::inRandomOrder()->get() );\n array_push($allnews, Health::inRandomOrder()->get() );\n array_push($allnews, Science::inRandomOrder()->get() );\n array_push($allnews, Sport::inRandomOrder()->get() );\n array_push($allnews, Technology::inRandomOrder()->get() );\n\n $news = array();\n $news = $this->sortNewsIntoSingleArray($allnews);\n return $news;\n }", "public function get_categories() {\n return array ( 'general' );\n }", "function qode_tours_get_tours_categories_vc() {\n\n\t\treturn array_flip(qode_tours_get_tours_categories());\n\t}", "function get_fakultas(){\n\t}", "public function get_category_permastruct()\n {\n }", "public function readCategoria(){\n $sql='SELECT idCategoria, nomCategoria, descripcion, foto from categoria WHERE estado = 1 AND estadoEliminacion = 1';\n $params=array(null);\n return Database::getRows($sql, $params);\n }", "public function taxonomieen()\n\t{\n\t\t// bepaalde waarden worden opgeslagen\n\t\t// verwerkt de taxonomieen tot bv \"categorie\"\n\t\t// @TODO meervoud van taxonomieen dient nog correct ingesteld te worden in posttypes.php en die hier uitgedraaid te worden via\n\t\t// https://developer.wordpress.org/reference/functions/get_taxonomy_labels/\n\n\t\tif (!$this->taxonomieen || $this->is_categorie) return;\n\n\n\t\t$tl_str = $this->art->post_type . '-taxlijst';\n\t\t//niet iedere keer opnieuw doen.\n\t\tif (!array_key_exists($tl_str, $GLOBALS)) {\n\t\t\t$this->maak_taxlijst();\n\t\t}\n\n\n\t\t$terms = wp_get_post_terms($this->art->ID, $GLOBALS[$tl_str]);\n\n\t\t$overslaan = array('Geen categorie', 'Uncategorized');\n\n\t\t$print_ar = array();\n\n\t\tif (count($terms)) :\n\n\t\t\tforeach ($terms as $term) :\n\n\t\t\t\tif (in_array($term->name, $overslaan)) continue;\n\n\t\t\t\tif (array_key_exists($term->taxonomy, $print_ar)) {\n\t\t\t\t\t$print_ar[$term->taxonomy][] = $term->name;\n\t\t\t\t} else {\n\t\t\t\t\t$print_ar[$term->taxonomy] = array($term->name);\n\t\t\t\t}\n\n\t\t\tendforeach;\n\n\t\t\t///\n\n\t\t\tif (count($print_ar)) {\n\n\t\t\t\t$teller = 0;\n\n\t\t\t\tforeach ($print_ar as $tax_naam => $tax_waarden) :\n\n\t\t\t\t\tif ($tax_naam === 'category') $tax_naam = 'categorie';\n\n\t\t\t\t\t//als geen datum, dan eerste tax waarde geen streepje links.\n\n\t\t\t\t\t$str = \"- \";\n\n\t\t\t\t\tif ($this->geen_datum && $teller < 1) {\n\t\t\t\t\t\t$str = \"\";\n\t\t\t\t\t\t$teller++;\n\t\t\t\t\t}\n\n\t\t\t\t\techo \"<span class='tax tekst-zwart'> $str\" . strtolower(implode(', ', $tax_waarden)) . \"</span>\";\n\n\n\t\t\t\tendforeach; //iedere print_ar\n\t\t\t}\n\t\tendif; //als count terms\n\n\n\t}", "public function get_categories() {\n\t\treturn [ 'general' ];\n\t}", "public function get_categories() {\n\t\treturn [ 'general' ];\n\t}", "public function get_categories() {\n\t\treturn [ 'general' ];\n\t}", "public function categorias()\n {\n return $this->belongsToMany(Categoria::class, 'medicamentos_categorias', 'medicamentos_id', 'categorias_id');\n }", "public function get_categories()\n {\n return ['careerfy'];\n }", "public function get_categories()\n {\n return ['careerfy'];\n }", "public static function categories() {\n\t\t// can take a long time\n\t\tset_time_limit(0);\n\n\t\t// select all uncategorized monuments\n\t\t$monuments = ORM::factory('monument')->where('id_category','is',null)->or_where('id_category','=',12)->find_all();\n\t\t$i = 0;\n\t\tforeach($monuments as $monument) {\n\n\t\t\t$category = $monument->extractCategory();\n\n\t\t\t// save the extracted category to the database\n\t\t\t$monument->id_category = $category;\n\t\t\t$monument->category_extracted = 1;\n\t\t\tif($category > 0) {\n\t\t\t\t$i++;\n\t\t\t\t$monument->save();\n\t\t\t}\n\t\t}\n\n\t\treturn $i;\n\t}", "protected function fijarTabla(){\n \n return \"categorias\";\n \n }", "public function categoria()\n {\n\n $categoria = Categoria::all();\n $inmueble = Inmueble::all();\n // return $categoria;\n // return $inmueble;\n return view('reporte.categoria', compact('categoria', 'inmueble'));\n }", "function faq_build_get_categories() { //retrieve all categories\n\tglobal $wpdb;\n\t$res = $wpdb->get_results(\"SELECT * FROM \".FAQBUILDDBCATEGORY.\" ORDER BY name ASC;\",ARRAY_A);\n\t$categories = array();\n\tif(is_array($res)) {\n\t\tforeach($res as $row) {\n\t\t\t$c = new FAQ_Build_Category();\n\t\t\tif($c->fromArray($row))\n\t\t\t\t$categories[] = $c;\n\t\t\telse\n\t\t\t\tunset($c);\n\t\t}\n\t}\n\treturn $categories;\n}", "public function getParentCategories()\n {\n return [\n 1 => [\n 'ru' => 'Готовые наборы для аэрографии',\n 'uk' => 'Готові набори для аерографії',\n 'en' => 'Ready-made airbrush kits',\n ],\n 2 => [\n 'ru' => 'Дополнительное оборудование и аксессуары для аэрографии',\n 'uk' => 'Додаткове обладнання та аксесуари для аерографії',\n 'en' => 'Additional equipment and accessories for airbrushing'\n ],\n 3 => [\n 'ru' => 'Аэрографы и компрессоры Fengda',\n 'uk' => 'Аерографи і компресори Fengda',\n 'en' => 'Fengda Airbrushes and Compressors',\n ],\n 4 => [\n 'ru' => 'Товары для аэрографии на ногтях (nail art)',\n 'uk' => 'Товари для аерографії на нігтях (nail art)',\n 'en' => 'Goods for airbrushing on nails (nail art)',\n ],\n 6 => [\n 'ru' => 'Товары для аэрографии визажистов, гримеров и др.',\n 'uk' => 'Товари для аерографії візажистів, гримерів і ін.',\n 'en' => 'Goods for aerography of make-up artists, make-up artists, etc.',\n ],\n 5 => [\n 'ru' => 'Товары для аэрографии на кондитерских изделиях',\n 'uk' => 'Товари для аерографії на кондитерських виробах',\n 'en' => 'Goods for airbrushing confectionery products',\n ],\n 7 => [\n 'ru' => 'Краски для аэрографии Createx и Wicked Colors',\n 'uk' => 'Фарби для аерографії Createx і Wicked Colors',\n 'en' => 'Paints for airbrushing Createx and Wicked Colors',\n 'not_active' => true\n ],\n 8 => [\n 'ru' => 'Краски для аэрографии Auto Air Colors',\n 'uk' => 'Фарби для аерографії Auto Air Colors',\n 'en' => 'Paints for airbrushing Auto Air Colors',\n 'not_active' => true\n ],\n 9 => [\n 'ru' => 'Аэрографы и запчасти H&S/Hansa',\n 'uk' => 'Аерографи і запчастини H&S/Hansa',\n 'en' => 'Airbrushes and spare parts H&S/Hansa',\n ]\n ];\n }", "function ObtenerCategorias(){\n\n\t\tinclude_once(\"../Entidades/Categorias.php\");\n\t\t$OBJCategorias = new Categorias;\n\t\t$categorias\t= $OBJCategorias -> ObtenerCategoriasconSeccion();\n\n\t\t$privilegios = $_SESSION['privilegios'];\n\n\t\tinclude_once(\"../ModuloAdministrador/vistas/FormularioCategorias.php\");\n\t\t$OBJFormCategorias = new FormularioCategorias;\n\t\t$OBJFormCategorias -> MostrarFormularioCategorias($categorias,$privilegios);\n\n\n\t}", "public function categories(Request $request)\n {\n $faqs = FrequentlyAskedQuestion::where('categories', 'like', '%'.$request->input('query').'%')->take(20)->latest()->get();\n $categories = array();\n $transformedCategories = array();\n\n $faqs->each(function($item, $key) use ($request, &$categories) {\n foreach ($item->categories as $category) {\n if (str_contains($category, $request->input('query')) && !in_array($category, $categories)) {\n array_push($categories, $category);\n }\n }\n });\n\n foreach ($categories as $category) {\n array_push($transformedCategories, [\n 'text' => $category,\n 'value' => $category\n ]);\n }\n\n return $transformedCategories;\n }", "public function getCategories()\n {\n $categories = array();\n $collection = Mage::getModel('faq/category')->getCollection();\n $collection->getSelect()->order('position ASC');\n foreach ($collection as $category) {\n if ($category->getIsActive() && $category->isVisible()) {\n $categories[$category->getId()] = $category;\n }\n }\n return $categories;\n }", "function afficherCategories()\n\t{\n\t\t$sql=\"SElECT * From categorie\";\n\t\t$db = config::getConnexion();\n\t\ttry\n\t\t{\n\t\t$liste=$db->query($sql);\n\t\treturn $liste;\n\t\t}\n catch (Exception $e)\n {\n die('Erreur: '.$e->getMessage());\n }\t\n\t}", "public function run()\n {\n $categories = [\"legendize\",\"legendized\",\"legendizes\",\"legendizing\",\"legendries\",\"legendry\",\"legends\",\"leger\",\"legerdemain\",\"legerdemainist\",\"legerdemainists\",\"legerdemains\",\"legering\",\"legerings\",\"legerities\",\"legerity\",\"legers\",\"leges\",\"legge\",\"legged\",\"legger\",\"leggers\",\"legges\",\"leggie\",\"leggier\",\"leggiero\",\"leggies\",\"leggiest\",\"leggin\",\"legginess\",\"legginesses\",\"legging\",\"legginged\",\"leggings\",\"leggins\",\"leggism\",\"leggisms\",\"leggy\",\"leghorn\",\"leghorns\",\"legibilities\",\"legibility\",\"legible\",\"legibleness\",\"legiblenesses\",\"legibly\",\"legion\",\"legionaries\",\"legionary\",\"legioned\",\"legionella\",\"legionellae\",\"legionellas\",\"legionnaire\",\"legionnaires\",\"legions\",\"legislate\",\"legislated\",\"legislates\",\"legislating\",\"legislation\",\"legislations\",\"legislative\",\"legislatively\",\"legislatives\",\"legislator\",\"legislatorial\",\"legislators\",\"legislatorship\",\"legislatorships\",\"legislatress\",\"legislatresses\",\"legislature\",\"legislatures\",\"legist\",\"legists\",\"legit\",\"legitim\",\"legitimacies\",\"legitimacy\",\"legitimate\",\"legitimated\",\"legitimately\",\"legitimateness\",\"legitimates\",\"legitimating\",\"legitimation\",\"legitimations\",\"legitimatise\",\"legitimatised\",\"legitimatises\",\"legitimatising\",\"legitimatize\",\"legitimatized\",\"legitimatizes\",\"legitimatizing\",\"legitimator\",\"legitimators\",\"legitimisation\",\"legitimisations\",\"legitimise\",\"legitimised\",\"legitimiser\",\"legitimisers\",\"legitimises\",\"legitimising\",\"legitimism\",\"legitimisms\",\"legitimist\",\"legitimistic\",\"legitimists\",\"legitimization\",\"legitimizations\",\"legitimize\",\"legitimized\",\"legitimizer\",\"legitimizers\",\"legitimizes\",\"legitimizing\",\"legitims\",\"legits\",\"leglan\",\"leglans\",\"leglen\",\"leglens\",\"legless\",\"leglessness\",\"leglessnesses\",\"leglet\",\"leglets\",\"leglike\",\"leglin\",\"leglins\",\"legman\",\"legmen\",\"legong\",\"legongs\",\"legroom\",\"legrooms\",\"legs\",\"legside\",\"legsides\",\"leguaan\",\"leguaans\",\"leguan\",\"leguans\",\"legume\",\"legumes\",\"legumin\",\"leguminous\",\"legumins\",\"legwarmer\",\"legwarmers\",\"legwear\",\"legwears\",\"legwork\",\"legworks\",\"lehaim\",\"lehaims\",\"lehayim\",\"lehayims\",\"lehr\",\"lehrjahre\",\"lehrs\",\"lehua\",\"lehuas\",\"lei\",\"leidger\",\"leidgers\",\"leiger\",\"leigers\",\"leiomyoma\",\"leiomyomas\",\"leiomyomata\",\"leiotrichies\",\"leiotrichous\",\"leiotrichy\",\"leipoa\",\"leipoas\",\"leir\",\"leired\",\"leiring\",\"leirs\",\"leis\",\"leish\",\"leisher\",\"leishest\",\"leishmania\",\"leishmaniae\",\"leishmanial\",\"leishmanias\",\"leishmaniases\",\"leishmaniasis\",\"leishmanioses\",\"leishmaniosis\",\"leisler\",\"leislers\",\"leister\",\"leistered\",\"leistering\",\"leisters\",\"leisurable\",\"leisurably\",\"leisure\",\"leisured\",\"leisureliness\",\"leisurelinesses\",\"leisurely\",\"leisures\",\"leisuring\",\"leitmotif\",\"leitmotifs\",\"leitmotiv\",\"leitmotivs\",\"lek\",\"leke\",\"lekgotla\",\"lekgotlas\",\"lekked\",\"lekker\",\"lekking\",\"lekkings\",\"leks\",\"leku\",\"lekvar\",\"lekvars\",\"lekythi\",\"lekythoi\",\"lekythos\",\"lekythus\",\"leman\",\"lemans\",\"leme\",\"lemed\"];\n for ($i=0; $i < count($categories); $i++) {\n Category::create([\n 'name' => $categories[$i],\n ]);\n }\n }", "public function find_faves(){\n\t\t$query = \n\t\t\t\"select essays.title, essays.eid, essays.ca, categories.name as 'category' from essays\n\t\t\tleft join categories on categories.cid = essays.cid\n\t\t\tleft join faves on faves.eid = essays.eid\n\t\t\twhere faves.uid = \".$this->session->userdata(\"auth\").\n\t\t\t\" order by category\";\n\t\treturn $this->do_query_essay_list($query);\n\t}", "public function getCategorias() {\n $categorias=$this->db->query('SELECT * FROM categorias ORDER BY id DESC;');\n return $categorias;\n }", "public function getAll(){\n\n \t$categorias = $this->db->query(\"SELECT * FROM categorias ORDER BY id_categoria DESC\");\n\n \treturn $categorias;\n }", "public function findCategories();", "function get_category_weight_all(){\n\t\t$sql = \"SELECT * \n\t\t\t\tFROM evs_database.evs_set_form_attitude\n\t\t\t\tLEFT JOIN evs_database.evs_category\n\t\t\t\tON sft_ctg_id = ctg_id\n\t\t\t\tLEFT JOIN evs_database.evs_identification\n\t\t\t\tON ctw_ctg_id = idf_ctg_id\n\t\t\t\twhere sft_pos_id = ?\n\t\t\t\tgroup by ctg_category_detail_en\n\t\t\t\torder by sft_id ASC\";\n $query = $this->db->query($sql, array($this->sft_pos_id));\n\t\treturn $query;\n\n\t}", "public function get_categories() {\n\t\treturn [ 'happyden' ];\n\t}", "function ciniki_recipes_web_categories($ciniki, $settings, $tnid) {\n\n $strsql = \"SELECT DISTINCT category AS name \"\n . \"FROM ciniki_recipes \"\n . \"WHERE ciniki_recipes.tnid = '\" . ciniki_core_dbQuote($ciniki, $tnid) . \"' \"\n . \"AND (ciniki_recipes.webflags&0x01) = 1 \"\n . \"AND category <> '' \"\n . \"ORDER BY category \"\n . \"\";\n \n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryTree');\n $rc = ciniki_core_dbHashQueryTree($ciniki, $strsql, 'ciniki.recipes', array(\n array('container'=>'categories', 'fname'=>'name', 'name'=>'category',\n 'fields'=>array('name')),\n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n if( !isset($rc['categories']) ) {\n return array('stat'=>'ok');\n }\n $categories = $rc['categories'];\n\n //\n // Load highlight images\n //\n foreach($categories as $cnum => $cat) {\n //\n // Look for the highlight image, or the most recently added image\n //\n $strsql = \"SELECT ciniki_recipes.primary_image_id, ciniki_images.image \"\n . \"FROM ciniki_recipes, ciniki_images \"\n . \"WHERE ciniki_recipes.tnid = '\" . ciniki_core_dbQuote($ciniki, $tnid) . \"' \"\n . \"AND category = '\" . ciniki_core_dbQuote($ciniki, $cat['category']['name']) . \"' \"\n . \"AND ciniki_recipes.primary_image_id = ciniki_images.id \"\n . \"AND (ciniki_recipes.webflags&0x01) = 1 \"\n . \"ORDER BY (ciniki_recipes.webflags&0x10) DESC, \"\n . \"ciniki_recipes.date_added DESC \"\n . \"LIMIT 1\";\n $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.recipes', 'image');\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n if( isset($rc['image']) ) {\n $categories[$cnum]['category']['image_id'] = $rc['image']['primary_image_id'];\n } else {\n $categories[$cnum]['category']['image_id'] = 0;\n }\n }\n\n return array('stat'=>'ok', 'categories'=>$categories); \n}", "public function run()\n {\n DB::table('categorias')->delete();\n $categoria1 = [\n \t'Ferreterías',\n \t'Droguerías',\n \t'Casas de Cambio',\n \t'Restaurantes',\n \t'Agencias de Viaje',\n \t'Moteles',\n \t'Floristerías',\n \t'Inmobiliarias',\n \t'Disfraces',\n \t'Librerías',\n \t'Teléfonos',\n \t'Papelerías',\n \t'Cades, Supercades y Rapicades',\n \t'Peluquerías',\n \t'Tiendas Naturistas',\n \t'Restaurante a Domicilio',\n \t'Centro de belleza y estética',\n \t'Supermercados',\n \t'Ópticas',\n \t'Vidrios',\n \t'Productos Químicos',\n \t'Repuestos para motocicletas',\n \t'Fundaciones',\n \t'Materiales eléctricos',\n \t'Panaderías',\n \t'Bicicletas',\n \t'Agencias de publicidad',\n \t'Instrumentos musicales',\n \t'Pastelería',\n \t'Maderas',\n \t'Constructoras',\n \t'Llantas',\n \t'Dotaciones para empresas',\n \t'Comidas rápidas',\n \t'Viveros',\n \t'Asaderos',\n \t'Artículos ortopédicos',\n \t'Artículos para adultos',\n \t'Reciclajes',\n \t'Estampados',\n \t'Radiodifusoras',\n \t'Farmacias',\n ];\n\n $categoria2 = [\n \t'Plásticos',\n \t'Telas',\n \t'Repuestos automotrices',\n \t'Confecciones',\n \t'Uniformes',\n \t'Aire acondicionado',\n ];\n\n $categoria3 = [\n \t'Hoteles',\n \t'Transporte terrestre de pasajeros',\n \t'Fondo de pensiones y cesantías',\n \t'Clínicas veterinarias',\n \t'Taxis',\n \t'Agencias de empleo',\n \t'Laboratorio Clínico',\n \t'Notarías',\n \t'Salones para recepciones',\n \t'Clínicas',\n \t'Escuelas de fútbol',\n \t'Iglesias y parroquias católicas',\n \t'Iglesias',\n \t'Centros de rehabilitación',\n \t'Empleos temporales',\n \t'Ecografías',\n \t'Abogados',\n \t'Terminales de transporte terrestre',\n \t'Cooperativas',\n \t'Salud ocupacional',\n \t'Laboratorios farmacéuticos',\n \t'Mariachis',\n \t'Clínicas odontológicas',\n \t'Alquiler de lavadoras',\n \t'Alquiler de ropa',\n \t'Transporte puerta a puerta',\n \t'Centros médicos',\n \t'Spa',\n \t'Hospitales',\n \t'Trasteos',\n \t'Estaciones',\n \t'Transporte terrestre de carga',\n \t'Transporte especial de pasajeros',\n \t'Hogares geriátricos',\n \t'Comisarías de familia',\n \t'Cajas de compensación familiar',\n \t'Iglesias cristianas',\n \t'Guarderías infantiles',\n \t'Servicios de formación',\n ];\n\n $categoria4 = [\n \t\t'Bancos',\n ];\n\n $categoria5 = [\n \t'Otros',\n ];\n\n foreach ($categoria1 as $key => $value) {\n \t$categoria = new Categoria();\n \t$categoria->name = $value;\n \t$categoria->actividades_id = 1;\n \t$categoria->save();\n };\n foreach ($categoria2 as $key => $value) {\n \t$categoria = new Categoria();\n \t$categoria->name = $value;\n \t$categoria->actividades_id = 2;\n \t$categoria->save();\n };\n\n foreach ($categoria3 as $key => $value) {\n \t$categoria = new Categoria();\n \t$categoria->name = $value;\n \t$categoria->actividades_id = 3;\n \t$categoria->save();\n };\n\n foreach ($categoria4 as $key => $value) {\n \t$categoria = new Categoria();\n \t$categoria->name = $value;\n \t$categoria->actividades_id = 4;\n \t$categoria->save();\n };\n\n foreach ($categoria5 as $key => $value) {\n \t$categoria = new Categoria();\n \t$categoria->name = $value;\n \t$categoria->actividades_id = 5;\n \t$categoria->save();\n };\n\n\n\n\n }", "public function getCategoryDataFront()\n {\n // Get Categorys\n $categories = CategoryWiseSpecification::orderBy('updated_at', 'desc')->Where('deactivate', 0)->take(4)->get();\n\n foreach($categories as $categoryWiseResource)\n {\n $files = explode(\",\", $categoryWiseResource['file']);\n $categoryWiseResource['attachments'] = Attachment::WhereIn('id', $files)->get();\n }\n \n // Return collection of Categorys as a resource\n return CategoryWiseSpecificationResouerce::collection($categories);\n }", "public function get_tipo_cat()\n { \n \n \n $this->db->select(\"distinct(cve_tipo_categoria), nom_tipo_cat\");\n\n $this->db->order_by('nom_tipo_cat','asc');\n $query = $this->db->get('ccategoria');\n \n $data_cat=0;\n $data_cat = array();\n foreach ($query->result_array() as $row)\n {\n \n $data_cat[$row['cve_tipo_categoria']] = $row['nom_tipo_cat']; \n }\n $query->free_result();\n\n return $data_cat; \n\n }", "function issuu_document_categories() {\n return array(\n '000000' => 'Unknown',\n '001000' => 'Auto & Vehicles',\n '002000' => 'Business & Marketing',\n '003000' => 'Creative',\n '004000' => 'Film & Music',\n '005000' => 'Fun & Entertainment',\n '006000' => 'Hobby & Home',\n '007000' => 'Knowledge & Resources',\n '008000' => 'Nature & Animals',\n '009000' => 'News & Politics',\n '010000' => 'Nonprofits & Activism',\n '011000' => 'Religon & Philosophy',\n '012000' => 'Sports',\n '013000' => 'Technology & Internet',\n '014000' => 'Travel & Events',\n '015000' => 'Weird & Bizarre',\n '016000' => 'Other'\n );\n}", "public function get_categories()\n\t{\n\t\treturn array('general');\n\t}", "function getAllCategories()\n {\n // Get list of categories using solr\n $metadataDao = MidasLoader::loadModel('Metadata')->getMetadata(MIDAS_METADATA_TEXT, \"mrbextrator\", \"category\");\n $enabledDao = MidasLoader::loadModel('Metadata')->getMetadata(MIDAS_METADATA_TEXT, \"mrbextrator\", \"slicerdatastore\");\n $terms = array(); \n if($metadataDao)\n {\n $db = Zend_Registry::get('dbAdapter');\n $results = $db->query(\"SELECT value, itemrevision_id FROM metadatavalue WHERE metadata_id='\".$metadataDao->getKey().\"' order by value ASC\")\n ->fetchAll();\n foreach($results as $result)\n {\n $arrayTerms = explode(\" --- \", $result['value']);\n foreach($arrayTerms as $term)\n { \n if(strpos($term, \"zzz\") === false) continue;\n $tmpResults = $db->query(\"SELECT value FROM metadatavalue WHERE itemrevision_id='\".$result['itemrevision_id'].\"' AND metadata_id='\".$enabledDao->getKey().\"' order by value ASC\")\n ->fetchAll();\n if(empty($tmpResults))continue;\n $term = trim(str_replace('zzz', '', $term));\n if(!isset($terms[$term]))\n {\n $terms[$term] = 0;\n }\n $terms[$term]++;\n }\n } \n }\n ksort($terms);\n return $terms;\n }", "function obtenerCategoriaProg()\n {\n //crea el objetoFunSeguridad que contiene todos los metodos del sistema de seguridad\n $this->objFunSeguridad = $this->create('sis_seguridad/MODSubsistema');\n $objParam = new CTParametro($aPostData['p'], null, $aPostFiles);\n $objParam->addParametro('codigo', 'pre_verificar_categoria');\n $objFunc = new MODSubsistema($objParam);\n $this->res = $objFunc->obtenerVariableGlobal($this->objParam);\n\n return $this->res->getDatos();\n }", "public function totalCategoria()\n {\n return $this->totalCentral() + $this->totalSeccional();\n }", "public function get_categories() {\n\t\treturn array( 'general' );\n\t}", "public function getAllFranchises(){\n $query = \"SELECT * FROM franchises ORDER BY name\";\n $result = $this->connection->query($query);\n $result = $result->fetchAll(PDO::FETCH_ASSOC);\n $franchises = [];\n foreach($result as $data){\n $franchises[] = new Franchise($data);\n }\n return $franchises;\n }", "public function categorias(){\n $categorias = Categoria::all();\n return response()->json($categorias);\n }", "public function consultarCategoria(){\n //$conexao = $c->conexao();\n\n $sql = \"SELECT * from tbcategorias order by idcategoria; \";\n $sql = $this->conexao->query($sql);\n\n $dados = array();\n\n while ($row = $sql->fetch_assoc()) { \n $dado = array();\n $dado['idcategoria'] = $row[\"idcategoria\"];\n $dado['nome'] = $row[\"nome\"];\n $dado['habilitado'] = $row[\"habilitado\"];\n $dados[] = $dado;\n }\n\n return $dados;\n\n \n }", "function getCategories() {\n\t\treturn $this->enumerateBySymbolic(CATEGORY_SYMBOLIC, 0, 0);\n\t}", "public function ActualizarCategorias()\n\t{\n\n\t\tself::SetNames();\n\t\tif(empty($_POST[\"codcategoria\"]) or empty($_POST[\"nomcategoria\"]))\n\t\t{\n\t\t\techo \"1\";\n\t\t\texit;\n\t\t}\n\t\t$sql = \" select nomcategoria from categorias where codcategoria != ? and nomcategoria = ? \";\n\t\t$stmt = $this->dbh->prepare($sql);\n\t\t$stmt->execute( array($_POST[\"codcategoria\"], $_POST[\"nomcategoria\"]) );\n\t\t$num = $stmt->rowCount();\n\t\tif($num == 0)\n\t\t{\n\t\t\t$sql = \" update categorias set \"\n\t\t\t.\" nomcategoria = ? \"\n\t\t\t.\" where \"\n\t\t\t.\" codcategoria = ?;\n\t\t\t\";\n\t\t\t$stmt = $this->dbh->prepare($sql);\n\t\t\t$stmt->bindParam(1, $nomcategoria);\n\t\t\t$stmt->bindParam(2, $codcategoria);\n\n\t\t\t$codcategoria = strip_tags(strtoupper($_POST[\"codcategoria\"]));\n\t\t\t$nomcategoria = strip_tags(strtoupper($_POST[\"nomcategoria\"]));\n\t\t\t$stmt->execute();\n\n\t\t\techo \"<div class='alert alert-info'>\";\n\t\t\techo \"<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>\";\n\t\t\techo \"<span class='fa fa-check-square-o'></span> LA CATEGORIA DE PRODUCTO FUE ACTUALIZADA EXITOSAMENTE\";\n\t\t\techo \"</div>\";\t\t\n\t\t\texit;\n\t\t}\n\t\telse\n\t\t{\n\t\t\techo \"2\";\n\t\t\texit;\n\t\t}\n\t}", "function cunsultas()\n {\n \t $data['categoria']=categoria::get();\n \t\t$data['unidad']=unidad::get();\n\n \t\treturn $data;\n }", "function getImagensCategoria($limite, $categoria){\n #De modo que: Selecione N marcações (numero de marcacoes = $limit)\n #As marcações serão referentes as categorias ou subcategorias selecionadas (categorias = $categorias, subcategorias = $subcategorias)\n\n $this->db->select('*');\n $this->db->from('Tbdimagem');\n $this->db->join('imagem_categoria', 'Tbdimagem.idImagem = imagem_categoria.idImagem');\n $this->db->where('imagem_categoria.idCategoria', $categoria);\n $this->db->order_by('rand()');\n $this->db->limit($limite);\n\n $query = $this->db->get();\n\n return $query->result_array();\n }", "function getExistingFuncCats(){\r\n$result=mysql_query(\"SELECT functionalCategoryDescription, functionalCategoryID FROM functionalCategory\") \r\n\tor die('Query failed: ' . mysql_error());\r\nwhile($funccat = mysql_fetch_array($result, MYSQL_NUM)){\r\n\t$funcCats[$funccat[0]] = $funccat[1];\r\n}\r\n\t$funcCats['None'] = -1;\r\n\t$funcCats['Any'] = -2;\r\nmysql_free_result($result);\r\nreturn $funcCats;\r\n}", "static function get_all_available_categories()\n {\n //moduli primari\n $modules_root = new Dir(DS.ModuleUtils::get_modules_path());\n\n $all_folders = $modules_root->listFolders();\n\n $result = array();\n\n foreach ($all_folders as $cat)\n {\n if ($cat->isDir())\n {\n $result[] = $cat->getName();\n }\n }\n\n //aggiungo la categoria framework se non è presente.\n if (!ArrayUtils::has_value($result, ModuleUtils::FRAMEWORK_CATEGORY_NAME))\n $result[] = ModuleUtils::FRAMEWORK_CATEGORY_NAME;\n //ok\n\n return $result;\n }", "public function get_all_academic_article_category()\n {\n echo $this->academic_article_model->get_all_academic_article_category();\n }", "function get_categories_from_post(){\n\t\t\n\t\t$categorias_bbdd=$this->get_categories(0,true);\n\t\t\n\t\t//Se inicia $this->num a 0 por que va a servir de indice para \n\t\t//la lista $this->categorias\n\t\t$this->num=0;\t\t\n\t\t$this->serv_cat_list=\"\";\n\t\t//con esta lista cogemos los checkbox que esten señalados en el formulario\n\t\t\n\t\t$this->get_checkbox_categories($categorias_bbdd,'services');\n\t\t\n\t\treturn 0;\n\t}", "public function categorie()\n {\n $data[\"categories\"]=$this->categories->list();\n $this->template_admin->displayad('categories' , $data);\n }", "function categoria($productos) {\r\n $opciones = array(); \r\n foreach($productos->producto as $producto) {\r\n $opciones[] = $producto->categoria;\r\n }\r\n //eliminar los duplicados para mostrar el select con las opciones\r\n $opciones = array_unique($opciones);\r\n\r\n //crear las opciones del select sin repetidos\r\n for ($i=0; $i < count($opciones); $i++) { \r\n echo \"<option value='\" . $opciones[$i] . \"'>\" . ucwords($opciones[$i]) . \"</option>\";\r\n }\r\n }", "function affichercategories(){\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}", "public function categories()\n {\n $new = $this->postterms->filter(function($term)\n {\n return $term->termtaxonomy->taxonomy == 'category';\n });\n\n return $new->map(function($term)\n {\n return $term->termtaxonomy->term; \n });\n }", "function buscar_categorias($id){\t\n\t\t$this->asignar_valores();\n\t\t$sql=\"SELECT * FROM subxcat, subcategoria WHERE categoria_rel='$id' AND subcategoria_rel=id_sub ORDER BY prioridad_sub\";\n\t\t$buscar=mysql_query($sql) or die(mysql_error());\n\t\tunset($this->listado2);\n\t\twhile ($resultado = mysql_fetch_array($buscar)){\n\t\t\t$this->mensaje=\"si\";\n\t\t\t$this->listado2[] = $resultado;\n\t\t}\n\t}", "public function getCategories();", "public function getCategories();", "public function getCategories(){\n\t\t$query = \"SELECT * FROM final_categoria\";\n\t\treturn $this->con->action($query);\n\t}", "public static function getCategoria($categorias, $fechaRefCat, $fnac){\n\t\tforeach($categorias as $cat){\n\t\t if ($cat['edadMax'] != null){\n\t\t\t\tif (Helpers::getEdad($fnac, $fechaRefCat) <= $cat['edadMax']){\n\t\t\t\t return $cat;\n\t\t\t }\n\t\t } else return $cat;\n\t\t}\n\t\treturn null;\n\t}", "public function getImagenesIndexCategorias(){\n foreach($this->indexContent as $content){\n //echo \"--------------------- Imagenes --------------<br>\";\n $vectorImagenes = array();\n $dom = new DOMDocument();\n $dom->loadHTML(\"$content\");\n $xpath = new DOMXPath($dom);\n $tag = \"div\";\n $class = \"home-category-box\";\n $consulta = \"//\".$tag.\"[@class='\".$class.\"']\";\n $resultados = $xpath->query($consulta);\n if ($resultados->length > 0){\n $contador = 0;\n foreach($resultados as $imagenes){\n if ($contador == 0){\n $todasImagenes = $imagenes->getElementsByTagName(\"img\");\n if ($todasImagenes->length > 0){\n foreach($todasImagenes as $imagen){\n $urlImagen = $imagen->getAttribute(\"src\");\n //echo \"url imagen categorias padre: \".$urlImagen.\"<br>\";\n array_push($vectorImagenes,$urlImagen);\n }\n }\n }\n $contador++;\n }\n }\n //echo \"--------------------- Fin Imagenes --------------<br>\";\n }\n return $vectorImagenes;\n }", "public function getCategoriesGroup() {\n\t\t$imageTypes = $this->getImagesTypes();\n\t\t$categories = $this->getCollection()\n\t\t\t\t->addFieldToFilter('status',1);\n\t\t$arrayOptions = array();\n\t\t$i = 1;\n\t\tforeach($imageTypes as $key => $imageType)\n\t\t{\n\t\t\tif($key == 'uncategorized')\n\t\t\t{\n\t\t\t\t$arrayOptions[0] = 'Uncategorized';\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$arrayValue = array();\n\t\t\tforeach($categories as $category)\n\t\t\t{\n\t\t\t\tif($category->getImageTypes() == $key)\n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\t$arrayValue[] = array('value'=>$category->getId(),'label'=>$category->getTitle());\n\t\t\t\t}\n\t\t\t}\n\t\t\t$arrayOptions[$i]['value'] = $arrayValue;\n\t\t\t$arrayOptions[$i]['label'] = $imageType;\n\t\t\t$i++;\n\t\t}\n\t\treturn $arrayOptions;\n\t}", "public function run()\n {\n $faker = Factory::create();\n $categories = []; // prepare array kosong\n\n // Prepare data dummy syukur\n for ($i=1; $i<=5; $i++) {\n $categories = [\n [\n 'name' => 'Ceritakan diri kamu.',\n 'description' => $faker->text,\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 'name' => 'Bagaimana orang lain kamu?',\n 'description' => $faker->text,\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 'name' => 'Bagaimana teman-temanmu memandang Kamu?',\n 'description' => $faker->text,\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 'name' => 'Bagaimana mahasiswa lain memandang Kamu?',\n 'description' => $faker->text,\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 'name' => 'Bagaimana dosen memandang Kamu?',\n 'description' => $faker->text,\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 'name' => 'Perkenalkan anggota keluargamu dan seberapa dekat dengan anggota keluargamu?',\n 'description' => $faker->text,\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 }\n\n // Insert data dummy ke db\n MyStoryCategory::insert($categories);\n }", "function afficherCategories2(){\n\t\t$sql=\"SElECT nom From categorie\";\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 run()\n {\n $categories = [\n ['name' => 'cash_sale_without_check', 'name_ua' => 'Готівковий продаж без чеку', 'type' => 1, 'account_id' => 1],\n ['name' => 'sale_with_goods_delivery', 'name_ua' => 'Продаж з відправленням товару', 'type' => 1, 'account_id' => 1],\n ['name' => 'online_sale', 'name_ua' => 'Продаж онлайн', 'type' => 1, 'account_id' => 1],\n ['name' => 'withdrawal_non_cash_account', 'name_ua' => 'Зняття коштів з безготівкового рахунку', 'type' => 1, 'account_id' => 1],\n ['name' => 'ecquiring_sale', 'name_ua' => 'Продаж по еквайрингу', 'type' => 1, 'account_id' => 2],\n ['name' => 'other_noncash_addition', 'name_ua' => 'Інші поповнення безготівкового рахунку', 'type' => 1, 'account_id' => 2],\n ['name' => 'withdrawal_cash_account', 'name_ua' => 'Поповнення рахунку з готівкового', 'type' => 1, 'account_id' => 2],\n ['name' => 'goods_return', 'name_ua' => 'Повернення товару', 'type' => 0, 'account_id' => 1],\n ['name' => 'goods_purchase', 'name_ua' => 'Закупка нового товару', 'type' => 0, 'account_id' => 1],\n ['name' => 'other_cash_expenses', 'name_ua' => 'Інші витрати', 'type' => 0, 'account_id' => 1],\n ['name' => 'bank_services', 'name_ua' => 'Послуги банку', 'type' => 0, 'account_id' => 2],\n ['name' => 'other_noncash_expenses', 'name_ua' =>'Інші витрати', 'type' => 0, 'account_id' => 2],\n ];\n\n foreach($categories as $category){\n DB::table('categories')->insert($category);\n }\n }" ]
[ "0.5882453", "0.5854695", "0.58492804", "0.5798894", "0.576304", "0.56880164", "0.56803846", "0.56634134", "0.5612725", "0.56107444", "0.56107444", "0.558962", "0.55874664", "0.5564493", "0.5561148", "0.5552837", "0.5534987", "0.5451437", "0.54492", "0.5437908", "0.54344505", "0.5406936", "0.5389481", "0.53828603", "0.53713226", "0.53682315", "0.5359961", "0.53542626", "0.5352301", "0.5345959", "0.5345959", "0.53443575", "0.53424025", "0.53305537", "0.5309674", "0.5291364", "0.5286367", "0.5263549", "0.52633333", "0.52611387", "0.52534187", "0.5239406", "0.5235357", "0.5234013", "0.5234013", "0.5234013", "0.5232787", "0.5226872", "0.5226872", "0.5218606", "0.5217366", "0.5214428", "0.52091867", "0.52081186", "0.51951873", "0.51919985", "0.5188656", "0.5188372", "0.51761395", "0.51725864", "0.51704663", "0.5169345", "0.51654613", "0.51642036", "0.5159614", "0.5154212", "0.51516837", "0.5150645", "0.5150207", "0.5149967", "0.51445955", "0.5134695", "0.51320195", "0.5129116", "0.51215565", "0.51145786", "0.5089054", "0.50876296", "0.5084402", "0.50804436", "0.5080324", "0.5078963", "0.50761884", "0.5073782", "0.5067723", "0.5067625", "0.50637716", "0.50601995", "0.50548595", "0.50532705", "0.5045543", "0.5041244", "0.5041244", "0.5039076", "0.5036704", "0.5033345", "0.5030957", "0.5030488", "0.5029224", "0.5026652" ]
0.54461807
19
Store a newly created resource in storage.
public function store(Request $request) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store($data, Resource $resource);", "public function store()\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'storeValidations')) {\n $this->request->validate($this->storeValidations());\n }\n\n /* Create a new resource */\n $resource = $this->model::create(Input::all());\n\n /* Redirect to newly created resource page */\n return redirect()\n ->route($this->name . '.edit', $resource->id)\n ->with(\n 'success',\n Lang::has($this->name . '.resource-created') ?\n $this->name . '.resource-created' :\n 'messages.alert.resource-created'\n );\n }", "public function store(CreateStorageRequest $request)\n {\n $this->storage->create($request->all());\n\n return redirect()->route('admin.product.storage.index')\n ->withSuccess(trans('core::core.messages.resource created', ['name' => trans('product::storages.title.storages')]));\n }", "public function createStorage();", "public function store(StoreStorage $request)\n {\n $storage = Storage::create($request->all());\n $request->session()->flash('alert-success', 'Запись успешно добавлена!');\n return redirect()->route('storage.index');\n }", "public function saveShopifyResource() {\n if (is_null($this->getShopifyId())) { // if there is no id...\n $this->createShopifyResource(); // create a new resource\n } else { // if there is an id...\n $this->updateShopifyResource(); // update the resource\n }\n }", "public function store(Request $request, NebulaResource $resource): RedirectResponse\n {\n $this->authorize('create', $resource->model());\n\n $validated = $request->validate($resource->rules(\n $resource->createFields()\n ));\n\n $resource->storeQuery($resource->model(), $validated);\n\n $this->toast(__(':Resource created', [\n 'resource' => $resource->singularName(),\n ]));\n\n return redirect()->back();\n }", "function storeAndNew() {\n $this->store();\n }", "public function store(Request $request)\n {\n $currentUser = JWTAuth::parseToken()->authenticate();\n $validator = Validator::make($request->all(), [\n 'content' => 'required|string',\n 'image_link' => 'sometimes|url',\n ]);\n\n if ($validator->fails()) {\n return APIHandler::response(0, $validator->errors(), [], 400);\n }\n\n $resource = new Resource;\n $resource->user_id = $currentUser['id'];\n $resource->title = $request->get('title');\n $resource->content = $request->get('content');\n $resource->image_link = $request->get('imageLink');\n $resource->video_link = $request->get('videoLink');\n $resource->file_link = $request->get('fileLink');\n $resource->audio_link = $request->get('audioLink');\n $resource->tags = collect($request->get('tags'))->implode('text', ',');\n $resource->is_public = 0;\n $resource->save();\n $data['resource'] = $resource;\n\n if ($request->get('programId')) {\n $this->addToProgram($resource, $request->programId);\n // event(new NewLearningPathResourcePublished($resource, $invitee));\n }\n\n User::find($currentUser['id'])->increment('points', 2);\n\n return APIHandler::response(1, \"New resource has been created\", $data, 201);\n }", "public function store()\n {\n if (!$this->id) { // Insert\n $this->insertObject();\n } else { // Update\n $this->updateObject();\n }\n }", "public function store()\n\t{\n\t\t\n\t\t//\n\t}", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}", "public function store()\n\t{\n\t\t//\n\t}" ]
[ "0.72875285", "0.71454394", "0.71323526", "0.6639812", "0.6620611", "0.6568348", "0.6526527", "0.6509403", "0.64499927", "0.6375791", "0.63739914", "0.6365971", "0.6365971", "0.6365971", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667", "0.6342667" ]
0.0
-1
Display the specified resource.
public function show($id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function show(Resource $resource)\n {\n // not available for now\n }", "public function show(Resource $resource)\n {\n //\n }", "function Display($resource_name, $cache_id = null, $compile_id = null)\n {\n $this->_smarty->display($resource_name, $cache_id, $compile_id);\n }", "private function showResourceable($resourceable)\n {\n save_resource_url();\n\n return $this->view('resources.create_edit')\n ->with('resource', $resourceable)\n ->with('photos', $resourceable->photos)\n ->with('videos', $resourceable->videos)\n ->with('documents', $resourceable->documents);\n }", "function display($resource_name, $cache_id = null, $compile_id = null) {\n\t\t$this->_getResourceInfo($resource_name); // Saves resource info to a Smarty class var for debugging\n\t\t$_t3_fetch_result = $this->fetch($resource_name, tx_smarty_div::getCacheID($cache_id), $compile_id);\n if ($this->debugging) { // Debugging will have been evaluated in fetch\n require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');\n $_t3_fetch_result .= smarty_core_display_debug_console(array(), $this);\n }\n\t\treturn $_t3_fetch_result;\n\t}", "public function show(ResourceSubject $resourceSubject)\n {\n //\n }", "public function show(ResourceManagement $resourcesManagement)\n {\n //\n }", "public function viewEditResources()\n {\n $database = new Database();\n $id = $this->_params['id'];\n\n $resource = $database->getResourceById($id);\n\n $availableResource = new Resource($resource['ResourceID'], $resource['ResourceName'], $resource['Description']\n , $resource['ContactName'] , $resource['ContactEmail'] , $resource['ContactPhone'] ,\n $resource['Link'], $resource['active']);\n $this->_f3->set('Resource', $availableResource);\n\n echo Template::instance()->render('view/include/head.php');\n echo Template::instance()->render('view/include/top-nav.php');\n echo Template::instance()->render('view/edit-resources.php');\n echo Template::instance()->render('view/include/footer.php');\n }", "public function retrieve(Resource $resource);", "public function showResource($resouceable, $id)\n {\n $model_name = str_replace('-', ' ',ucwords($resouceable));\n $model_name = str_replace(' ', '',ucwords($model_name));\n\n $resource_type = 'App\\Models\\\\'.$model_name;\n $model = app($resource_type);\n $model = $model->find($id);\n\n return $this->showResourceable($model);\n }", "public function showAction(Ressource $ressource)\n {\n $deleteForm = $this->createDeleteForm($ressource);\n\n return $this->render('ressource/show.html.twig', array(\n 'ressource' => $ressource,\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function show(Dispenser $dispenser)\n {\n //\n }", "public function show($id)\n {\n $resource = Resource::find($id);\n dd($resource);\n }", "public function displayAction() {\n\t\tif(is_numeric($this->req_id)) {\n\t\t\tAPI::DEBUG(\"[DefaultController::displayAction()] Getting \" . $this->req_id, 1);\n\t\t\t$this->_view->data['info'] = $this->_model->get($this->req_id);\n\t\t\t$this->_view->data['action'] = 'edit';\n\n\t\t} else {\n\t\t\t$this->_view->data['action'] = 'new';\n\t\t}\n\t\t// auto call the hooks for this module/action\n\t\terror_log(\"Should Call: \" . $this->module .\"/\".$this->action.\"/\".\"controller.php\");\n\t\tAPI::callHooks($this->module, $this->action, 'controller', $this);\n\n\t\t$this->addModuleTemplate($this->module, 'display');\n\n\t}", "public function show(NebulaResource $resource, $item): View\n {\n $this->authorize('view', $item);\n\n return view('nebula::resources.show', [\n 'resource' => $resource,\n 'item' => $item,\n ]);\n }", "public function resource(string $resource, string $controller): void\n {\n $base = $this->plural($resource);\n $entity = '/{'.$resource.'}';\n\n $this->app->get($base, $controller.'@index');\n $this->app->post($base, $controller.'@store');\n $this->app->get($base.$entity, $controller.'@show');\n $this->app->patch($base.$entity, $controller.'@update');\n $this->app->delete($base.$entity, $controller.'@destroy');\n }", "function displayCustom($resource_name, $cache_id = null, $compile_id = null)\n\t{\n\t return $this->display(DotbAutoLoader::existingCustomOne($resource_name), $cache_id, $compile_id);\n\t}", "public function show($id)\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Get the specified resource */\n $resource = $this->model::findOrFail($id);\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.show\")) {\n $view = \"admin.{$this->name}.show\";\n } else {\n $view = 'admin.includes.actions.show';\n }\n\n /* Displays the specified resource page */\n return view($view)\n ->with('resource', $resource)\n ->with('name', $this->name);\n }", "public function show($id)\n {\n $currentUser = JWTAuth::parseToken()->authenticate();\n $rules = [\n 'id' => 'required|integer'\n ];\n\n $validator = Validator::make(['id' => $id], $rules);\n if ($validator->fails()) {\n return APIHandler::response(0, $validator->errors(), 400);\n }\n $resource = $this->resourceRepository->fetchResource($id);\n $this->resourceRepository->storeView($id, $currentUser['id']);\n\n $data = [\n 'resource' => $resource,\n 'related_resources' => $this->resourceRepository->getResourcesRelatedTo($resource->id, $resource->mentoring_area_id)\n ];\n\n return APIHandler::response(1, \"Show Resource\", $data);\n }", "public function get(Resource $resource);", "public function showAction()\n {\n $model = $this->_getPhotoModel();\n $photo = $model->fetchEntry($this->getRequest()->getParam('id'));\n\n if (null === $photo) {\n return $this->_forward('notfound', 'error');\n }\n\n $this->view->auth = Zend_Auth::getInstance();\n $this->view->title = $photo->title;\n $this->view->photo = $photo;\n }", "public function show($id)\n {\n //\n $data=Resource::find($id);\n return view('resourceDetails',compact('data'));\n }", "function display() {\n\t\t$view = &$this->getView();\n\t\t$view->display();\n\t}", "public function show(ShowResourceRequest $request, $id)\n {\n // TODO: Implement show() method.\n }", "function show( $resource ){\n\n $where = \"reservation_status <> 'Pending' AND id = {$resource}\";\n $reservation = where( 'reservations', $where );\n $reservation = $reservation[0];\n\n return view('admin/reservation/preview_reservation', compact( 'reservation' ));\n}", "public function show()\n {\n if ($this->twig !== false) {\n $this->twigDefaultContext();\n if ($this->controller) {\n $this->controller->display($this->data);\n }\n echo $this->twig->render($this->twig_template, $this->data);\n } else {\n $filename = $this->findTemplatePath($this->template);\n require($filename);\n }\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function show(rc $rc)\n {\n //\n }", "public function show(Resolucion $resolucion)\n {\n //\n }", "public function showAction(furTexture $furTexture)\n {\n\n return $this->render('furtexture/show.html.twig', array(\n 'furTexture' => $furTexture,\n ));\n }", "public function show()\n\t{\n\t\t//\n\t}", "public function show()\n\t{\n\t\t//\n\t}", "public function show()\n\t{\n\t\t//\n\t}", "public function show(Resena $resena)\n {\n }", "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function showAction() {\n $docId = $this->getParam('id');\n\n // TODO verify parameter\n\n $document = new Opus_Document($docId);\n\n $this->_helper->layout()->disableLayout();\n\n $this->view->doc = $document;\n $this->view->document = new Application_Util_DocumentAdapter($this->view, $document);\n }", "public function action_display()\r\n\t{\r\n\t\t$event = ORM::factory('event', array('id' => $this->request->param('id')));\r\n\t\r\n\t\tif ( ! $event->loaded())\r\n\t\t{\r\n\t\t\tNotices::error('event.view.not_found');\r\n\t\t\t$this->request->redirect(Route::url('event'));\r\n\t\t}\r\n\t\t\r\n\t\t// Can user view this event?\r\n\t\tif ( ! $this->user->can('event_view', array('event' => $event)))\r\n\t\t{\r\n\t\t\t// Error notification\r\n\t\t\tNotices::error('event.view.not_allowed');\r\n\t\t\t$this->request->redirect(Route::url('event'));\r\n\t\t}\r\n\t\t\r\n\t\t// Pass event data to the view class\r\n\t\t$this->view->event_data = $event;\r\n\t\t$this->view->user = $this->user;\r\n\t}", "public function execute()\n {\n // HTTP Request Get\n if ($this->type == \"resource\") {\n $action = $this->getResourceAction();\n switch ($action) {\n case \"show\":\n $this->show();\n break;\n case \"create\":\n $this->create();\n break;\n case \"edit\":\n $this->edit();\n break;\n case \"destroy\":\n $this->destroy();\n break;\n default:\n echo $this->render();\n break;\n }\n } else {\n $action = $this->Request->action;\n switch ($action) {\n case \"show\":\n $this->show();\n break;\n case \"create\":\n $this->create();\n break;\n case \"edit\":\n $this->edit();\n break;\n case \"destroy\":\n $this->destroy();\n break;\n default:\n echo $this->render();\n break;\n }\n }\n }", "public function show(Resident $resident)\n {\n $this->authorize('admin.resident.show', $resident);\n\n // TODO your code goes here\n }", "public function display()\n {\n echo $this->getDisplay();\n $this->isDisplayed(true);\n }", "public function display()\n\t{\n\t\tparent::display();\n\t}", "public function get_resource();", "public function show()\n\t{\n\t\t\n\t}", "function display() {\n\n\t\t// Check authorization, abort if negative\n\t\t$this->isAuthorized() or $this->abortUnauthorized();\n\n\t\t// Get the view\n\t\t$view = $this->getDefaultView();\n\n\t\tif ($view == NULL) {\n\t\t\tthrow new Exception('Display task called, but there is no view assigned to that controller. Check method getDefaultView.');\n\t\t}\n\n\t\t$view->listing = true;\n\n\t\t// Wrap the output of the views depending on the way the stuff should be shown\n\t\t$this->wrapViewAndDisplay($view);\n\n\t}", "public function viewResources()\n {\n $database = new Database();\n\n $resources = $database->getAllActiveResourcesNoLimit();\n\n\n $resourceArray = array();\n $i = 1;\n\n foreach ($resources as $resource) {\n $availableResource = new Resource($resource['ResourceID'], $resource['ResourceName'], $resource['Description']\n , $resource['ContactName'] , $resource['ContactEmail'] , $resource['ContactPhone'] ,\n $resource['Link'], $resource['active']);\n array_push($resourceArray, $availableResource);\n $i += 1;\n }\n $resourceSize = sizeof($resourceArray);\n $this->_f3->set('resourcesByActive', $resourceArray);\n $this->_f3->set('resourcesSize', $resourceSize);\n echo Template::instance()->render('view/include/head.php');\n echo Template::instance()->render('view/include/top-nav.php');\n echo Template::instance()->render('view/resources.php');\n echo Template::instance()->render('view/include/footer.php');\n }", "public function show($id)\n {\n $this->title .= ' show';\n $this->one($id);\n }", "public function display($title = null)\n {\n echo $this->fetch($title);\n }", "public function display(){}", "public function show($id)\n\t{\n\t\t//\n\t\t//\n\t\n\t}", "public function viewAction()\n\t{\n\t\t//get Id param from request\n\t\tif (!$id = $this->_getParam('id')) {\n\t\t\t$this->getFlashMessenger()->addMessage('Product ID was not specified');\n\t\t\t$this->getRedirector()->gotoSimple('list');\n\t\t}\n\n\t\t//fetch requested ProductID from DB\n\t\tif (!$this->_model->fetch($id)) {\n\t\t\t$this->render('not-found');\n\t\t} else {\n\t\t\t$this->view->model = $this->_model;\n\t\t}\n\t}", "public function show($id)\n {\n // Get single person\n $person = Person::findOrFail($id);\n\n // Return single person as a resource\n return '<h1>Person Number '.$id.'</h1><br>'.json_encode(new PersonResource($person));\n }", "#[TODO] use self object?\n\tprotected function GET(ResourceObject $resource) {\n#[TODO]\t\tif ($resource->getMTime())\n#[TODO]\t\t\t$this->response->headers->set('Last-modified', gmdate('D, d M Y H:i:s ', $resource->getMTime()) . 'GMT');\n#[TODO]\t\tif ($resource->getCTime())\n#[TODO]\t\t\t$this->response->headers->set('Date', gmdate('D, d M Y H:i:s ', $resource->getCTime()) . 'GMT');\n\n\n#[TODO] handle file streams\n\t\t// get ranges\n#\t\t$ranges = WebDAV::getRanges($this->request, $this->response);\n\n\t\t// set the content of the response\n\t\tif ($resource instanceof ResourceDocument) {\n\t\t\t$this->response->content->set($resource->getContents());\n\t\t\t$this->response->content->setType($resource->getMIMEType());\n\t\t\t$this->response->content->encodeOnSubmit(true);\n\t\t}\n\t}", "public function display() {\n echo $this->render();\n }", "public function show($id)\n\t{\n\t//\n\t}", "public function show($id)\n\t{\n\t//\n\t}", "function Fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)\n {\n return $this->_smarty->fetch($resource_name, $cache_id, $compile_id, $display);\n }", "public function show($id)\n {\n //\n $this->_show($id);\n }", "public function show()\n\t{\n\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {\n\t\t//\n\t}", "public function show($id) {}", "static public function showCallback(O_Dao_Renderer_Show_Params $params) {\r\n\t\t/* @var $r R_Mdl_Resource */\r\n\t\t$r = $params->record();\r\n\t\t// Setting layout title\r\n\t\t$params->layout()->setTitle($r->getPageTitle());\r\n\r\n?><h1><?=$r->title?></h1><div id=\"resource\"><?\r\n\t\tif($r->getContent()) {\r\n\t\t\t// page has its own content -- show it\r\n\t\t\t$r->getContent()->show($params->layout(), \"content\");\r\n\t\t} else {\r\n\t\t\t// It is a post unit, show all childs\r\n\t\t\tif($r->is_unit == 1) {\r\n\t\t\t\t$r->addQueryAccessChecks($r->getChilds(1))->show($params->layout(), \"content\");\r\n\r\n\t\t\t// It is a folder with several units, show paginator\r\n\t\t\t} elseif($r->show_def == \"last-units\") {\r\n\t\t\t\tlist($type, $perpage) = explode(\":\", $r->show_def_params);\r\n\t\t\t\t/* @var $p O_Dao_Paginator */\r\n\t\t\t\t$p = $r->addQueryAccessChecks($r->getChilds())->test(\"is_unit\", 1)->getPaginator(array($r, \"getPageUrl\"), $perpage);\r\n\t\t\t\t$p->show($params->layout(), $type);\r\n\t\t\t// It is a folder with subfolders, boxes, contents. Show one childs level\r\n\t\t\t} else {\r\n\t\t\t\t$r->addQueryAccessChecks($r->getChilds(1))->show($params->layout(), \"on-parent-page\");\r\n\t\t\t}\r\n\r\n\t\t}\r\n?></div><?\r\n\t}", "public function show($id)\r\n\t{\r\n\t\t//\r\n\r\n\r\n\r\n\t}", "public function show($resourceId, $eventId)\n {\n $routes = $this->routes;\n\n $eventable = $this->getEventableRepository()->model()->findOrFail($resourceId);\n\n if (method_exists($eventable, 'events')) {\n $event = $eventable->events()->find($eventId);\n\n if ($event) {\n $apiObject = $this->event->findApiObject($event->api_id);\n\n return view('events.eventables.show', compact('routes', 'eventable', 'event', 'apiObject'));\n }\n }\n\n abort(404);\n }", "public abstract function display();", "abstract public function resource($resource);", "public function show($id)\r\r\n\t{\r\r\n\t\t//\r\r\n\t}", "public function show( $id ) {\n\t\t//\n\t}", "public function show( $id ) {\n\t\t//\n\t}", "public function show(Response $response)\n {\n //\n }", "public function show()\n {\n return auth()->user()->getResource();\n }", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}", "public function show($id)\n\t{\n\t\t//\n\t}" ]
[ "0.8233718", "0.8190437", "0.6828712", "0.64986944", "0.6495974", "0.6469629", "0.6462615", "0.6363665", "0.6311607", "0.62817234", "0.6218966", "0.6189695", "0.61804265", "0.6171014", "0.61371076", "0.61207956", "0.61067593", "0.6105954", "0.6094066", "0.6082806", "0.6045245", "0.60389996", "0.6016584", "0.598783", "0.5961788", "0.59606946", "0.5954321", "0.59295714", "0.59182066", "0.5904556", "0.59036547", "0.59036547", "0.59036547", "0.5891874", "0.58688277", "0.5868107", "0.58676815", "0.5851883", "0.58144855", "0.58124036", "0.58112013", "0.5803467", "0.58012545", "0.5791527", "0.57901084", "0.5781528", "0.5779676", "0.5757105", "0.5756208", "0.57561266", "0.57453394", "0.57435393", "0.57422745", "0.5736634", "0.5736634", "0.5730559", "0.57259274", "0.5724891", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5722562", "0.5718969", "0.5713412", "0.57091093", "0.5706405", "0.57057405", "0.5704541", "0.5704152", "0.57026845", "0.57026845", "0.56981397", "0.5693083", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962", "0.5684962" ]
0.0
-1
Show the form for editing the specified resource.
public function edit($id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function edit(Resource $resource)\n {\n return view('admin.resources.edit', compact('resource'));\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function edit($id)\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n /* Get the specified resource */\n $resource = $this->model::findOrFail($id);\n\n /* Sets the view */\n if (view()->exists(\"admin.{$this->name}.edit\")) {\n $view = \"admin.{$this->name}.edit\";\n } else {\n $view = 'admin.includes.actions.edit';\n }\n\n /* Displays the edit resource page */\n return view($view)\n ->with('resource', $resource)\n ->with('name', $this->name);\n }", "public function edit(NebulaResource $resource, $item): View\n {\n $this->authorize('update', $item);\n\n return view('nebula::resources.edit', [\n 'resource' => $resource,\n 'item' => $item,\n ]);\n }", "public function edit() {\r\n $id = $this->api->getParam('id');\r\n\r\n if ($id) {\r\n $this->model->id = $id;\r\n $this->checkOwner();\r\n }\r\n $object = $this->model->find_by_id($id);\r\n\r\n $this->api->loadView('contact-form', array('row' => $object));\r\n }", "public function viewEditResources()\n {\n $database = new Database();\n $id = $this->_params['id'];\n\n $resource = $database->getResourceById($id);\n\n $availableResource = new Resource($resource['ResourceID'], $resource['ResourceName'], $resource['Description']\n , $resource['ContactName'] , $resource['ContactEmail'] , $resource['ContactPhone'] ,\n $resource['Link'], $resource['active']);\n $this->_f3->set('Resource', $availableResource);\n\n echo Template::instance()->render('view/include/head.php');\n echo Template::instance()->render('view/include/top-nav.php');\n echo Template::instance()->render('view/edit-resources.php');\n echo Template::instance()->render('view/include/footer.php');\n }", "public function edit()\n {\n return view('hirmvc::edit');\n }", "public function editformAction(){\n\t\t$this->loadLayout();\n $this->renderLayout();\n\t}", "public function edit() {\n $id = $this->parent->urlPathParts[2];\n // pass name and id to view\n $data = $this->parent->getModel(\"fruits\")->select(\"select * from fruit_table where id = :id\", array(\":id\"=>$id));\n $this->getView(\"header\", array(\"pagename\"=>\"about\"));\n $this->getView(\"editForm\", $data);\n $this->getView(\"footer\");\n }", "public function edit($id)\n\t{\n\t\treturn $this->showForm('update', $id);\n\t}", "public function edit($id)\n {\n $model = $this->modelObj;\n $formObj = $model::findOrFail($id);\n $data['formObj'] = $formObj;\n return view($this->veiw_base . '.edit', $data);\n }", "public function createEditForm(Resourceperson $entity){\n \n $form = $this->createForm(new ResourcepersonType(), $entity, array(\n 'action' => $this->generateUrl('rsp_update', array('id' => $entity->getRpId())),\n 'method' => 'PUT',\n ));\n\n $form->add('submit', 'submit', array('label' => 'Update','attr'=> array(\n 'class'=>'btn btn primary'\n )));\n\n return $form;\n }", "private function createEditForm(Resource $entity)\n {\n $form = $this->createForm(new ResourceType(), $entity, array(\n 'action' => $this->generateUrl('social_admin_resource_update', array('id' => $entity->getId())),\n 'method' => 'PUT',\n ));\n\n $form->add('submit', 'submit', array('label' => '保存','attr'=>[\n 'class'=>'btn btn-primary'\n ]));\n\n return $form;\n }", "public function edit($id)\n {\n return $this->showForm('update', $id);\n }", "public function edit($id)\n {\n return $this->showForm('update', $id);\n }", "public function editAction()\n {\n if ($form = $this->processForm()) {\n if ($this->useTabbedForms && method_exists($this, 'getSubject')) {\n $data = $this->getModel()->loadFirst();\n $subject = $this->getSubject($data);\n $this->setPageTitle(sprintf($this->_('Edit %s %s'), $this->getTopic(1), $subject));\n } else {\n $this->setPageTitle(sprintf($this->_('Edit %s'), $this->getTopic(1)));\n }\n $this->html[] = $form;\n }\n }", "public function edit($id)\n {\n $this->data['entity'] = GS_Form::where('id', $id)->firstOrFail();\n return view('admin.pages.forms.edit', $this->data);\n }", "public function edit($id)\n\t{\n\t\t// get the fbf_presenca\n\t\t$fbf_presenca = FbfPresenca::find($id);\n\n\t\t\n\t\t// show the edit form and pass the fbf_presenca\n\t\t$this->layout->content = View::make('fbf_presenca.edit')\n->with('fbf_presenca', $fbf_presenca);\n\t}", "public function edit($id)\n {\n $data = $this->model->find($id);\n\n return view('admin.backends.employee.form.edit',compact('data'));\n }", "public function edit($model, $form);", "function edit() {\n\t\tglobal $tpl;\n\n\t\t$form = $this->initForm();\n\t\t$tpl->setContent($form->getHTML());\n\t}", "public function edit($id)\n\t{\n\t\t$faith = Faith::find($id);\n \n return view('faith.form')->with('faith', $faith);\n\n\t}", "public function edit()\n { \n return view('admin.control.edit');\n }", "public function edit(Form $form)\n {\n //\n }", "public function edit()\n {\n return view('common::edit');\n }", "public function edit($id)\n {\n $resource = (new AclResource())->AclResource;\n $roleResource = AclRole::where('role', $id)->get(['resource'])->toArray();\n $roleResource = Arr::pluck($roleResource, 'resource');\n return view('Admin.acl.role.form', [\n 'role' => $id,\n 'resource' => $resource,\n 'roleResource' => $roleResource,\n ]);\n }", "public function edit()\n {\n return view('admin::edit');\n }", "public function edit()\n {\n return view('admin::edit');\n }", "public function edit()\r\n {\r\n return view('petro::edit');\r\n }", "public function edit($id)\n {\n // show form edit user info\n }", "public function edit()\n {\n return view('escrow::edit');\n }", "public function edit($id)\n {\n $resource = ResourceManagement::find($id);\n\n $users = User::get();\n // Redirect to user list if updating user wasn't existed\n if ($resource == null || $resource->count() == 0) {\n return redirect()->intended('/resource-management');\n }\n\n return view('resources-mgmt/edit', ['resource' => $resource, 'users' => $users]);\n }", "public function edit()\n {\n return view('commonmodule::edit');\n }", "public function editAction()\n\t{\n\t\t$params = $this->data->getParams();\n\t\t$params = $this->valid->clearDataArr($params);\n\t\tif (isset($params['id']))\n\t\t{\n\t\t\t$this->employee->setFlag(true);\n\t\t}\n\t\tif (isset($_POST['submit']))\n\t\t{\n\t\t\t$action = $this->valid->clearDataArr($_POST);\n\t\t\t$this->employee->setDataArray($action);\n\t\t\theader('Location: ' . PATH . 'Employee/index/', true, 303);\n\t\t}\n\t\t$employee = $this->employee->setAction('edit');\n\t\t$this->view->addToReplace($employee);\n\t\t$this->listEmployee();\n\t\t$this->arrayToPrint();\n\t}", "public function edit()\n {\n return view('catalog::edit');\n }", "public function edit()\n {\n return view('catalog::edit');\n }", "public function edit(form $form)\n {\n //\n }", "public function actionEdit($id) { }", "public function edit()\n {\n return view('admincp::edit');\n }", "public function edit()\n {\n return view('scaffold::edit');\n }", "public function edit($id)\n {\n $header = \"Edit\";\n\t\t$data = Penerbit::findOrFail($id);\n\t\treturn view('admin.penerbit.form', compact('data','header'));\n }", "public function edit()\n {\n return view('Person.edit');\n }", "public function edit($id)\n {\n $data = Form::find($id);\n return view('form.edit', compact('data'));\n }", "public function edit($id)\n\t{\n\t\t$career = $this->careers->findById($id);\n\t\treturn View::make('careers._form', array('career' => $career, 'exists' => true));\n\t}", "public function edit(Flight $exercise, FlightResource $resource)\n {\n return $this->viewMake('adm.smartcars.exercise-resources.edit')\n ->with('flight', $exercise)\n ->with('resource', $resource);\n }", "public function edit($id)\n\t{\n\t\t// get the material\n\t\t$material = Material::find($id);\n\n\t\t// show the edit form and pass the material\n\t\t$this->layout->content = View::make('material.edit')\n\t\t\t->with('material', $material);\n\t}", "public function edit($id, Request $request)\n {\n $formObj = $this->modelObj->find($id);\n\n if(!$formObj)\n {\n abort(404);\n } \n\n $data = array();\n $data['formObj'] = $formObj;\n $data['page_title'] = \"Edit \".$this->module;\n $data['buttonText'] = \"Update\";\n\n $data['action_url'] = $this->moduleRouteText.\".update\";\n $data['action_params'] = $formObj->id;\n $data['method'] = \"PUT\"; \n\n return view($this->moduleViewName.'.add', $data);\n }", "public function edit()\n {\n $id = $this->getId();\n return view('panel.user.form', [\n 'user' => $this->userRepository->findById($id),\n 'method' => 'PUT',\n 'routePrefix' => 'profile',\n 'route' => 'profile.update',\n 'parameters' => [$id],\n 'breadcrumbs' => $this->getBreadcrumb('Editar')\n ]);\n }", "public function edit()\r\n {\r\n return view('mpcs::edit');\r\n }", "function edit()\n\t{\n\t\t// hien thi form sua san pham\n\t\t$id = getParameter('id');\n\t\t$product = $this->model->product->find_by_id($id);\n\t\t$this->layout->set('auth_layout');\n\t\t$this->view->load('product/edit', [\n\t\t\t'product' => $product\n\t\t]);\n\t}", "public function edit($id)\n {\n //\n $data = Diskon::find($id);\n\n $form = $this->form;\n $edit = $this->edit;\n $field = $this->field;\n $page = $this->page;\n $id = $id;\n $title = $this->title;\n return view('admin/page/'.$this->page.'/edit',compact('form','edit','data','field','page','id','title'));\n }", "public function edit($id)\n {\n return $this->showForm($id);\n }", "public function edit($id)\n {\n return $this->showForm($id);\n }", "protected function _edit(){\n\t\treturn $this->_editForm();\n\t}", "public function editAction()\n {\n $robot = Robots::findFirst($this->session->get(\"robot-id\"));\n if ($this->request->isGet()) {\n $this->tag->prependTitle(\"Редактировать робота :: \");\n $user = $this->session->get(\"auth-id\");\n if (!$robot) {\n $this->flashSession->error(\n \"Робот не найден\"\n );\n return $this->response->redirect(\"users/usershow/$user->name\");\n }\n\n }\n\n $this->view->form = new RobotForm(\n $robot,\n [\n \"edit\" => true,\n ]\n );\n }", "public function editAction()\n {\n $form = new $this->form();\n\n $request = $this->getRequest();\n $param = $this->params()->fromRoute('id', 0);\n\n $repository = $this->getEm()->getRepository($this->entity);\n $entity = $repository->find($param);\n\n if ($entity) {\n\n $form->setData($entity->toArray());\n\n if ( $request->isPost() ) {\n\n $form->setData($request->getPost());\n\n if ( $form->isValid() ) {\n\n $service = $this->getServiceLocator()->get($this->service);\n $service->update($request->getPost()->toArray());\n\n return $this->redirect()->toRoute($this->route, array('controller' => $this->controller));\n }\n }\n } else {\n return $this->redirect()->toRoute($this->route, array('controller' => $this->controller));\n }\n\n return new ViewModel(array('form' => $form, 'id' => $param));\n\n }", "public function edit($id)\n\t{\n\t\t$SysApplication = \\Javan\\Dynaflow\\Domain\\Model\\SysApplication::find($id);\n\t\t$form = \\FormBuilder::create('Javan\\Dynaflow\\FormBuilder\\SysApplicationForm', [\n \t'method' => 'POST',\n \t'url' => 'sysapplication/update/'.$id,\n \t'model' => $SysApplication,\n \t'data' => [ 'flow_id' => $SysApplication->flow_id]\n \t]);\n\t\treturn View::make('dynaflow::sysapplication.form', compact('form', 'SysApplication'));\n\t}", "public function editAction() {\n\t\t$id = (int) $this->_getParam('id');\n\t\t$modelName = $this->_getParam('model');\n\t\t\n\t\t$model = Marcel_Backoffice_Model::factory($modelName);\n\t\t$item = $model->find($id)->current();\n\t\tif (!$item) {\n\t\t\t$item = $model->createRow();\n\t\t}\n\t\t$form = $item->getForm();\n\t\tif ($this->_request->isPost()) {\n\t\t\t$newId = $form->populate($this->_request->getPost())->save();\n\t\t\tif ($newId) {\n\t\t\t\t$this->_helper->flashMessenger('Saved successfully!');\n\t\t\t\t$this->_helper->redirector('edit', null, null, array('id' => $newId, 'model' => $modelName));\n\t\t\t}\n\t\t}\n\t\t$this->view->form = $form;\n\t\t$this->view->messages = $this->_helper->flashMessenger->getMessages();\n\t}", "public function edit($id)\n {\n return view('models::edit');\n }", "public function edit()\n {\n return view('home::edit');\n }", "public function editAction()\n {\n $id = $this->params()->fromRoute('id');\n $entity = $this->entityManager->find(Entity\\CourtClosing::class, $id);\n if (! $entity) {\n // to do: deal with it\n }\n $form = $this->getForm('update');\n $form->bind($entity);\n if ($this->getRequest()->isPost()) {\n return $this->post();\n }\n\n return new ViewModel(['form' => $form]);\n }", "public function editAction($id)\n {\n $entity = $this->getManager()->find($id);\n\n $breadcrumbs = $this->get(\"white_october_breadcrumbs\");\n $breadcrumbs->addItem('Inicio', $this->get('router')->generate('admin.homepage'));\n $breadcrumbs->addItem($this->entityDescription, $this->get(\"router\")->generate(\"admin.$this->entityName.index\"));\n $breadcrumbs->addItem('Editar');\n\n if (!$entity) {\n throw $this->createNotFoundException('No se ha encontrado el elemento');\n }\n\n $form = $this->getForm($entity);\n\n return $this->render('AdminBundle:Default:edit.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n 'metadata' => $this->getMetadata()\n ));\n }", "public function edit()\n {\n return view('user::edit');\n }", "public function edit()\n {\n return view('user::edit');\n }", "public function edit(Form $form)\n {\n return view('admin.forms.edit', compact('form'));\n }", "public function editAction()\n {\n $form = MediaForm::create($this->get('form.context'), 'media');\n $media = $this->get('media_manager.manager')->findOneById($this->get('request')->get('media_id'));\n \n $form->bind($this->get('request'), $media);\n \n return $this->render('MediaManagerBundle:Admin:form.html.twig', array('form' => $form, 'media' => $media));\n }", "public function editAction($id) {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('CdlrcodeBundle:Question')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Question entity.');\n }\n\n $editForm = $this->createEditForm($entity);\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('CdlrcodeBundle:Question:edit.html.twig', array(\n 'entity' => $entity,\n 'edit_form' => $editForm->createView(),\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function edit($id)\n {\n return view('consultas::edit');\n }", "public function edit(DirectorFormBuilder $form, $id)\n {\n return $form->render($id);\n }", "public function edit()\n {\n return view('dashboard::edit');\n }", "public function edit($id){\n $rfid = Rfid::find($id);\n\n //load form view\n return view('rfids.edit', ['rfid' => $rfid]);\n }", "public function edit($id)\n {\n\n // retrieve provider\n $provider = Provider::findOrFail($id);\n\n // return form with provider\n return view('backend.providers.form')->with('provider', $provider);\n }", "public function edit(Question $question)\n {\n $this->employeePermission('application' , 'edit');\n $question->chooses;\n $action = 'edit';\n return view('admin.setting.question_form', compact('action' , 'question'));\n }", "public function edit() {\n return view('routes::edit');\n }", "public function edit($id)\n {\n $this->data['product'] = Product::find($id);\n $this->data['category'] = Category::arrForSelect();\n $this->data['title'] = \" Update Prouct Details\";\n $this->data['mode'] = \"edit\";\n\n return view('product.form', $this->data);\n }", "public function edit(ClueEnFormBuilder $form, $id): Response\n {\n return $form->render($id);\n }", "public function editAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('BaseBundle:Feriado')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Feriado entity.');\n }\n\n $editForm = $this->createEditForm($entity);\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('BaseBundle:Feriado:edit.html.twig', array(\n 'entity' => $entity,\n 'edit_form' => $editForm->createView(),\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function edit($id)\n {\n return view('cataloguemodule::edit');\n }", "public function edit($articulo_id)\n {\n $titulo = \"Editar\";\n return View(\"articulos.formulario\",compact('titulo','articulo_id'));\n }", "public function edit($id)\n {\n $resources = User::find(session('usuario_id'))->resources;\n $languages = Language::pluck('name', 'id');\n $types = Type::pluck('name', 'id');\n $method = 'PATCH';\n\n $recurso = Resource::find($id);\n $url = \"/resource/$recurso->id\";\n\n return view('resources.resources', compact('resources', 'languages', 'types', 'method', 'url', 'recurso'));\n }", "public function edit(Question $question)\n {\n $edit = TRUE;\n return view('questionForm', ['question' => $question, 'edit' => $edit]);\n }", "public function displayEditForm(Employee $employee){\n return view('employee.displayEditForm',['employee'=>$employee]);\n }", "public function edit()\n {\n return view('website::edit');\n }", "public function edit()\n {\n return view('inventory::edit');\n }", "public function edit()\n {\n return view('initializer::edit');\n }", "public function editAction()\n {\n View::renderTemplate('Profile/edit.html', [\n 'user' => $this->user\n ]);\n }", "public function edit($id)\n {\n return view('backend::edit');\n }", "public function edit($id)\n {\n //dd($id);\n $familiaPrograma= FamiliaPrograma::findOrFail($id);\n return view('familiasPrograma.edit', compact('familiaPrograma'));\n }", "public function edit($id)\n {\n return view('crm::edit');\n }", "public function edit($id)\n {\n return view('crm::edit');\n }", "public function edit($id)\n {\n $user = User::where('id', $id)->first();\n\n\n return view('users.forms.update', compact('user'));\n }", "public function editAction($id)\n\t{\n\t\t$school = School::find( $id );\n\t\t$this->render( View::make( 'schools/form' , array(\n\t\t\t'title' => sprintf( 'Modifier \"%s\"', $school->name ),\n\t\t\t'entity' => $school\n\t\t) ) );\n\t}", "public function edit(Question $question)\n {\n $edit = TRUE;\n return view('questionForm', ['question' => $question, 'edit' => $edit ]);\n }", "public function edit(Person $person) {\n\t\t$viewModel = new PersonFormViewModel();\n\t\treturn view('person.form', $viewModel);\n\t}", "public function edit($id)\n {\n \t$product = Product::find($id);\n \treturn view('admin.products.edit')->with(compact('product')); // formulario de actualizacion de datos del producto\n }", "public function edit_person($person_id){\n \t$person = Person::find($person_id);\n \treturn view('resource_detail._basic_info.edit',compact('person'));\n }", "public function edit($id)\n {\n $professor = $this->repository->find($id);\n return view('admin.professores.edit',compact('professor'));\n }", "public function edit($id)\n {\n $data = Restful::find($id);\n return view('restful.edit', compact('data'));\n }", "public function editAction($id)\n {\n $em = $this->getDoctrine()->getManager();\n\n $entity = $em->getRepository('MedecinIBundle:Fichepatient')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find Fichepatient entity.');\n }\n\n $editForm = $this->createEditForm($entity);\n $deleteForm = $this->createDeleteForm($id);\n\n return $this->render('MedecinIBundle:Fichepatient:edit.html.twig', array(\n 'entity' => $entity,\n 'edit_form' => $editForm->createView(),\n 'delete_form' => $deleteForm->createView(),\n ));\n }", "public function edit($id)\n {\n return $this->form->render('mconsole::personal.form', [\n 'item' => $this->person->query()->with('uploads')->findOrFail($id),\n ]);\n }", "public function edit($id)\n\t{\n\t\t // get the project\n $project = Project::find($id);\n\n // show the edit form and pass the project\n return View::make('logicViews.projects.edit')->with('project', $project);\n\t}" ]
[ "0.78550774", "0.7692893", "0.7273195", "0.7242132", "0.7170847", "0.70622855", "0.7053459", "0.6982539", "0.69467914", "0.6945275", "0.6941114", "0.6928077", "0.69019294", "0.68976134", "0.68976134", "0.6877213", "0.68636996", "0.68592185", "0.68566656", "0.6844697", "0.68336326", "0.6811471", "0.68060875", "0.68047357", "0.68018645", "0.6795623", "0.6791791", "0.6791791", "0.6787701", "0.67837197", "0.67791027", "0.677645", "0.6768301", "0.6760122", "0.67458534", "0.67458534", "0.67443407", "0.67425704", "0.6739898", "0.6735328", "0.6725465", "0.6712817", "0.6693891", "0.6692419", "0.6688581", "0.66879624", "0.6687282", "0.6684741", "0.6682786", "0.6668777", "0.6668427", "0.6665287", "0.6665287", "0.66610634", "0.6660843", "0.66589665", "0.66567147", "0.66545695", "0.66527975", "0.6642529", "0.6633056", "0.6630304", "0.6627662", "0.6627662", "0.66192114", "0.6619003", "0.66153085", "0.6614968", "0.6609744", "0.66086483", "0.66060555", "0.6596137", "0.65950733", "0.6594648", "0.65902114", "0.6589043", "0.6587102", "0.65799844", "0.65799403", "0.65799177", "0.657708", "0.65760696", "0.65739626", "0.656931", "0.6567826", "0.65663105", "0.65660435", "0.65615267", "0.6561447", "0.6561447", "0.65576506", "0.655686", "0.6556527", "0.6555543", "0.6555445", "0.65552044", "0.65543956", "0.65543705", "0.6548264", "0.65475875", "0.65447706" ]
0.0
-1
Update the specified resource in storage.
public function update($id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateShopifyResource() {\n $this->saving();\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'PUT',\n 'DATA' => [\n static::getResourceSingularName() => $this->shopifyData\n ]\n ]);\n }", "public function update(Request $request, Resource $resource)\n {\n $request->validate([\n 'name' => 'required',\n 'description' => 'required|string',\n 'file' => 'required|mimes:jpg,jpeg,png,doc,docx,pdf,ppt,txt',\n ]);\n\n $resource->update($request->all());\n\n if ( $request->hasFile('file') ) {\n $resource = 'resource-'.time().'.'.$request->file('file')->extension();\n $request->file->storeAs('resources', $resource,'public');\n $resource->file = $resource;\n }\n\n if ( $resource->save() ) {\n return redirect()->route('admin.resources.index')->with('success', 'Resource updated');\n } else {\n return redirect()->route('admin.resources.index')->with('error', 'Something went wrong');\n }\n }", "public function update(Request $request, Resource $resource)\n {\n //\n }", "public function updateStream($resource);", "public function update(Request $request, Storage $storage)\n {\n $storage->product_id = $request->product_id;\n $storage->amount = $request->amount;\n\n $storage->save();\n\n return redirect()->route('storages.index');\n }", "protected function updateImageResource($fileName, $imageId, $storage)\n {\n //Get image name and storage location for image\n $image = Image::where('id', '=', $imageId)->first();\n\n //Delete old image\n $this->deleteResource($image->name, $image->storage);\n\n //Store the new image\n $image->name = $fileName;\n $image->storage = $storage;\n\n $image->save();\n }", "public function update(Storage $storage, UpdateStorageRequest $request)\n {\n $this->storage->update($storage, $request->all());\n\n return redirect()->route('admin.product.storage.index')\n ->withSuccess(trans('core::core.messages.resource updated', ['name' => trans('product::storages.title.storages')]));\n }", "public function update(StoreStorage $request, Storage $storage)\n {\n $storage->fill($request->all())->save();\n $request->session()->flash('alert-success', 'Запись успешно обновлена!');\n return redirect()->route('storage.index');\n }", "public function update_asset($id, Request $request){\n \t\tif(!Auth::user()){\n\t\t\treturn redirect('/');\n\t\t}\n \t\t$asset = Storage::find($id);\n \t\t$asset->name = $request->name;\n \t\t$asset->quantity = $request->quantity;\n \t\t$asset->category_id = $request->category;\n \t\tif($request->file('image') != null){\n\t\t\t$image = $request->file('image');\n\t\t\t$image_name = time(). \".\" . $image->getClientOriginalExtension();\n\t\t\t$destination = \"images/\";\n\t\t\t$image->move($destination, $image_name);\n\t\t\t$asset->image_url = $destination.$image_name;\n\t\t} \n\t\t$asset->save();\n\t\tsession()->flash('success_message', 'Item Updated successfully');\n\t\treturn redirect(\"/storage\");\n \t}", "public function update(Request $request, Flight $exercise, FlightResource $resource)\n {\n $request->validate([\n 'display_name' => 'required|string|max:100',\n 'file' => 'nullable|file|max:10240|mimes:pdf',\n 'uri' => 'nullable|url|max:255',\n ]);\n\n if ($resource->type === 'file' && $request->file('file')) {\n Storage::drive('public')->delete($resource->resource);\n $resource->resource = $request->file('file')->store('smartcars/exercises/resources', ['disk' => 'public']);\n } elseif ($resource->type === 'uri' && $request->input('uri')) {\n $resource->resource = $request->input('uri');\n }\n\n $resource->save();\n\n return redirect()->route('adm.smartcars.exercises.resources.index', $exercise)\n ->with('success', 'Resource edited successfully.');\n }", "public function update(Request $request, $id)\n {\n $validator = Validator::make($request->all(), [\n 'title' => 'required|string',\n 'content' => 'required|string',\n 'mentoring_area_id' => 'required|integer',\n 'featured_image_uri' => 'string',\n ]);\n\n if ($validator->fails()) {\n return APIHandler::response(0, $validator->errors(), 400);\n }\n \n $resource = Resource::find($id);\n $resource->title = $request->get('title');\n $resource->content = $request->get('content');\n $resource->featured_image_uri = $request->get('featured_image_uri');\n $resource->updated_at = \\Carbon\\Carbon::now();\n $resource->mentoring_area_id = $request->get('mentoring_area_id');\n $resource->save();\n $data['resource'] = $resource;\n return APIHandler::response(1, \"Resource has been updated\");\n }", "protected function updateVideoResource($fileName, $videoId, $storage, $premium=1)\n {\n //Get video name and storage location for video\n $video = Video::where('id', '=', $videoId)->first();\n\n //Check the storage medium\n if($storage == 'vimeo' || $storage == 'youtube')\n {\n $video->name = $fileName;\n $video->storage = $storage;\n $video->premium = $premium;\n $video->save();\n }\n else\n {\n if($video['storage'] == 'local' || $video['storage'] == 's3')\n {\n //Delete old video\n $this->deleteResource($video->name, $video->storage);\n }\n \n //Store the new video\n $video->name = $fileName;\n $video->storage = $storage;\n $video->premium = $premium;\n $video->save();\n }\n }", "public function put($resource, $with=[]){\n return $this->fetch($resource, self::PUT, $with);\n }", "public function update($id, $resource) {\n SCA::$logger->log(\"update resource\");\n return $this->orders_service->update($id, $resource);\n }", "public function update($path);", "public function update($id, $resource)\n {\n SCA::$logger->log(\"Entering update()\");\n //check whether it is an sdo or an xml string.\n if ($resource instanceof SDO_DataObjectImpl) {\n //if the thing received is an sdo convert it to xml\n if ($this->xml_das !== null) {\n $xml = SCA_Helper::sdoToXml($this->xml_das, $resource);\n } else {\n throw new SCA_RuntimeException(\n 'Trying to update a resource with SDO but ' .\n 'no types specified for reference'\n );\n }\n } else {\n $xml = $resource;\n }\n\n $slash_if_needed = ('/' === $this->target_url[strlen($this->target_url)-1])?'':'/';\n\n $handle = curl_init($this->target_url.$slash_if_needed.\"$id\");\n curl_setopt($handle, CURLOPT_HEADER, false);\n curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($handle, CURLOPT_CUSTOMREQUEST, \"PUT\");\n curl_setopt($handle, CURLOPT_POSTFIELDS, $xml);\n\n //replace with Content-Type: atom whatever\n $headers = array(\"User-Agent: SCA\",\n \"Content-Type: text/xml;\",\n \"Accept: text/plain\");\n curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);\n\n $result = curl_exec($handle);\n\n $response_http_code = curl_getinfo($handle, CURLINFO_HTTP_CODE);\n\n curl_close($handle);\n\n $response_exception = $this->buildResponseException($response_http_code, '200');\n\n if ($response_exception != null) {\n throw $response_exception;\n } else {\n //update does not return anything in the body\n return true;\n }\n }", "public function update(Request $request, $id)\n {\n $this->validate($request, [\n 'name' => 'required',\n 'link' => 'required',\n 'description' => 'required'\n ]);\n\n $resource = Resource::find($id);\n $resource->name = $request->name;\n $resource->type_id = $request->type_id;\n $resource->has_cost = ($request->has('has_cost')) ? 1 : 0;\n $resource->language_id = $request->language_id;\n $resource->link = $request->link;\n $resource->description = $request->description;\n $resource->tags = '';\n\n $resource->save();\n //return back()->with('success', 'Recurso actualizado satisfactoriamente');\n return redirect('/resource')->with('success', 'Recurso actualizado satisfactoriamente');\n }", "public function update(Request $request, $id)\n {\n $oldProduct = Product::findOrFail($id);\n $data = $request->all();\n if(isset($data['img'])){\n // $file = $request->file('photo');\n // return $file;\n $imgName = time().'.'.$request->img->extension();\n $data['img'] = $imgName;\n // Storage::putFile('spares', $file);\n $path = $request->img->storeAs('public/uploads', $imgName); //in Storage\n\n //delete old file\n if($oldProduct->img != 'product-default.png'){\n Storage::delete(\"public/uploads/\".$oldProduct->img);\n // return 'deleted';\n }\n \n }else{\n $data['img'] = $oldProduct->img;\n }\n $oldProduct->update($data);\n return redirect()->route('product.index'); \n\n }", "public function update($request, $id) {\n\t\t\t$image = $request['photo'];\n\t\t\tif($image !== null) {\n\t\t\t\t$name = time().'.' . explode('/', explode(':', substr($image, 0, strpos($image, ';')))[1])[1];\n\t\t\t\t\\Image::make($request['photo'])->save(public_path('storage/products/').$name);\n\t\t\t\t$request['photo'] = $name;\n\t\t\t} else {\n\t\t\t\t$currenPhoto = Product::all()->where('id', $id)->first();\n\t\t\t\t$request['photo'] = $currenPhoto->photo;\n\t\t\t}\n return $this->product->update($id, $request);\n\t}", "public function updateStream($path, $resource, Config $config)\n {\n }", "public function edit(Resource $resource)\n {\n //\n }", "public function updateResourceIndex(&$resource) {\n if ($this->connector != null) {\n\n // STEP 1: Update or insert this resource as a node:\n $this->logger->addDebug(\"Updating/Inserting Node into Neo4J database\");\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id} }) SET a.title = {title}, a.version = {version}, a.href = {href}\n return a;\",\n [\n 'id' => $resource->getID(),\n 'version' => $resource->getVersion(),\n 'title' => $resource->getTitle(),\n 'href' => $resource->getLink()\n ]\n );\n\n // Check to see if anything was added\n $records = $result->getRecords();\n if (empty($records)) {\n // Must create this record instead\n $result = $this->connector->run(\"CREATE (n:Resource) SET n += {infos};\",\n [\n \"infos\" => [\n 'id' => $resource->getID(),\n 'version' => $resource->getVersion(),\n 'title' => $resource->getTitle(),\n 'href' => $resource->getLink()\n ]\n ]\n );\n }\n\n // STEP 2: Update or insert the resource's link to holding repository\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id} })-[r:HIRELATION]->()\n return r;\",\n [\n 'id' => $resource->getID(),\n ]\n );\n $records = $result->getRecords();\n if (!empty($records)) {\n // delete the one there so that we can add the correct one (just in case)\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id}})-[r:HIRELATION]->() delete r;\",\n [\n 'id' => $resource->getID()\n ]\n );\n\n }\n\n // If resource has a repository, then add a link\n if ($resource->getRepository() != null && $resource->getRepository()->getID() != null) {\n $this->connector->run(\"MATCH (a:Identity {id: {id1} }) MATCH (b:Resource {id: {id2} }) CREATE (b)-[r:HIRELATION]->(a);\",\n [\n 'id1' => (string) $resource->getRepository()->getID(),\n 'id2' => $resource->getID()\n ]);\n }\n }\n }", "public function update($data) {}", "public function update($data) {}", "public function putStream($resource);", "public function update(Request $request, NebulaResource $resource, $item): RedirectResponse\n {\n $this->authorize('update', $item);\n\n $validated = $request->validate($resource->rules(\n $resource->editFields()\n ));\n\n $resource->updateQuery($item, $validated);\n\n $this->toast(__(':Resource updated', [\n 'resource' => $resource->singularName(),\n ]));\n\n return redirect()->back();\n }", "public function saveShopifyResource() {\n if (is_null($this->getShopifyId())) { // if there is no id...\n $this->createShopifyResource(); // create a new resource\n } else { // if there is an id...\n $this->updateShopifyResource(); // update the resource\n }\n }", "public function update($entity);", "public function update($entity);", "public function setResource($resource);", "public function updateStream($path, $resource, Config $config)\n {\n return $this->upload($path, $resource, $config);\n }", "public function isUpdateResource();", "public function update(Request $request, $id)\n {\n $device = Device::findOrFail($id);\n $device->fill($request->all());\n if ($request->hasFile('icon')) {\n if ($device->hasMedia('icon')) {\n $device->deleteMedia($device->getFirstMedia('icon'));\n }\n $device->addMediaFromRequest('icon')->toMediaCollection('icon');\n }\n $device->save();\n return new DeviceResource($device);\n }", "public function update(Request $request, $id)\n {\n //\n $product = Product::findOrFail($id);\n \n $product->update($request->all());\n \n $file = $request->file('url_image')->move('upload', $request->file('url_image')->getClientOriginalName());\n\n Product::where('id',$id)->update(['url_image'=>$file]);\n \n \\Session::flash('flash_message', 'Edit product successfully.'); \n \n //cũ : return redirect('articles');\n return redirect()->route('products.index');\n }", "public function store($data, Resource $resource);", "public function update(Request $request, $id)\n {\n \n $product = Product::find($id);\n\n\n $product->fill($request->all())->save();\n\n //Verificamos que tenemos una imagen\n if($request->file('photo_1')){\n\n\n //En caso de tenerla la guardamos en la clase Storage en la carpeta public en la carpeta image.\n $path = Storage::disk('public')->put('photo_1',$request->file('photo_1'));\n\n //Actualizamos el Post que acabamos de crear\n $product->fill(['photo_1' => asset($path)])->save();\n\n }\n\n\n return redirect()->route('products.index')->with('info', 'Producto actualizado exitosamente!');\n }", "public function update(Request $request, $id)\n {\n $product = Product::find($id);\n\n if (\\Input::hasFile('image')) {\n $this->imgsave($request, $product);\n }\n\n\n if (!empty($request->input('tags'))) {\n $product->tags()->sync($request->input('tags'));\n } else {\n $product->tags()->detach();\n }\n\n $product->update($request->all());\n\n return redirect()->to('dashboard/product')->with('message', 'update success');\n }", "public function put($resource_path, array $variables = array()) {\n return $this->call($resource_path, $variables, 'PUT');\n }", "public function update($id)\n {\n /* Check if logged in user is authorized to make this request */\n $this->authorizeAction();\n\n if (method_exists($this, 'updateValidations')) {\n $this->request->validate($this->updateValidations());\n }\n\n /* Get the specified resource */\n $resource = $this->model::findOrFail($id);\n\n /* Update the specified resource */\n $resource->update(Input::all());\n\n /* Redirect back */\n return redirect()->back()\n ->with(\n 'info',\n Lang::has($this->name . '.resource-updated') ?\n $this->name . '.resource-updated' :\n 'messages.alert.resource-updated'\n );\n }", "public function putResponse($request)\n {\n $idSearched = $this->searcher->searchResourceIndex(\n $request, \n $this->db[$request['resource']]\n );\n if ($idSearched) {\n $resource = $this->db[$request['resource']][$idSearched];\n $bodyInput = json_decode($this->standardInput, true);\n $resource = BodyRequest::canApplyBody($bodyInput);\n $resource['id'] = (int)$request['param'];\n foreach($resource as $key => $value) {\n $this->db[$request['resource']][$idSearched][$key] = $value;\n }\n file_put_contents(DB_PATH, json_encode($this->db));\n }\n }", "public function update(Storedataset $request, dataset $dataset){\n $dataset->title = $request->input('title');\n $dataset->caption = $request->input('caption');\n $dataset->file_url = $request->input('file_url');\n $dataset->type = $request->input('type');\n $dataset->status = $request->input('status');\n $dataset->publication_id = $request->input('publication_id');\n\n $dataset->save();\n\n return redirect()->route('datasets.show', ['dataset' => $dataset]);\n }", "public function update(Request $request, $id)\n\n {\n ResourceManagement::findOrFail($id);\n $constraints = [\n 'title' => 'required|max:100',\n 'url'=> 'required|max:191',\n 'content' => 'required'\n ];\n\n $input = [\n 'title' => $request['title'],\n 'url' => $request['url'],\n 'content' => $request['content'],\n 'type' => $request['type'],\n 'level' => $request['level'],\n 'user_id' => $request['user']\n ];\n// $this->validate($input, $constraints);\n ResourceManagement::where('id', $id)\n ->update($input);\n\n return redirect()->intended('/resource-management');\n }", "public function update(Request $request, $id)\n {\n $this->validate($request, [\n 'title' => 'required',\n 'description' => 'required|string',\n 'price' => 'required|numeric',\n 'reference'=>'required'\n ]);\n \n $product = Product::find($id);\n $product->update($request->all());\n \n $im = $request->file('picture');\n \n if (!empty($im)) {\n \n $link = $request->file('picture')->store('images');\n \n \n $product->update([\n 'url_image' => $link,\n ]);\n } \n //dump($request->all());\n return redirect()->route('product.index')->with('message', 'Article modifié avec succès');\n }", "public function update(StoreOrUpdateAsset $request, Asset $asset)\n {\n if (Storage::exists($asset->path) && !Storage::delete($asset->path)) {\n abort(500);\n }\n\n $file = $request->file('file');\n $path = $file->store('assets');\n\n if (!$path) {\n abort(500);\n }\n\n // We wonder if we should delete the old file or not...\n\n $asset->name = $file->getClientOriginalName();\n $asset->size = $file->getSize();\n $asset->type = $file->getMimeType();\n $asset->path = $path;\n\n if ($asset->save()) {\n flash('The asset has been saved.')->success();\n } else {\n abort(500);\n }\n\n return redirect('/admin/assets');\n }", "public function update(FoodRecipeRequest $request, $id)\n {\n $foodRecipe = FoodRecipe::with('ingredients','cookingProcesses')->findOrFail($id);\n if ($request->input('name')!= null)\n $foodRecipe->name = $request->input('name');\n if ($request->input('detail')!= null)\n $foodRecipe->detail = $request->input('detail');\n if($request->file('photo') != null) {\n $old_file = $foodRecipe->photo;\n if($old_file != null){\n $path = public_path().'/storage/'.$old_file;\n File::delete($path);\n }\n $file = $request->file('photo');\n $name = '/foodRecipe/' . Carbon::now()->format(\"dnY-Hisu\") . \".\" . $file->extension();\n $file->storePubliclyAs('public', $name);\n $foodRecipe->photo = $name;\n }\n $foodRecipe->save();\n return new FoodRecipeResource($foodRecipe);\n }", "public function update(StorageTypeRequest $request, $id)\n {\n try {\n $this->service->updateStorageType($request, $id);\n return $this->NoContent();\n } catch (EntityNotFoundException $e) {\n \\Log::error($e->getMessage());\n return $this->NotFound($e->getMessage());\n } catch(\\QueryException $e) {\n \\Log::error($e->getMessage());\n return $this->ServerError();\n } catch(Exception $e) {\n \\Log::error($e->getMessage());\n return $this->ServerError();\n }\n }", "public function update(Request $request, $id)\n {\n //validation\n $this->validate(request(),[\n 'image' => 'image'\n ]);\n\n $slider = HomeSliders::find($id);\n \n $slider->link = request('link');\n\n //get old image to delete if updated\n $oldImage = request('oldImage');\n //get the new image\n $NewImage=$request->file('image');\n\n if($NewImage)\n {\n $filenameToStore= helpers::updatePhoto('image','homeSliders',$request);\n $slider->image=$filenameToStore;\n\n Storage::delete('public/Images/homeSliders/'.$oldImage);\n }\n\n $slider->save();\n\n Alert::success(config('app.name'), trans('messages.Updated Successfully') );\n return redirect()->route('admin.homeSlider',$slider->type);\n }", "public function update(Qstore $request, $id)\n {\n //\n }", "public function update(IEntity $entity);", "protected function performUpdate(): bool\n {\n // Abort if resource does not support update operations\n if (!$this->isUpdatable()) {\n throw new UnsupportedOperation(sprintf('API does not support update operation for %s resources', $this->resourceNameSingular()));\n }\n\n $id = $this->id();\n $prepared = $this->prepareBeforeUpdate($this->toArray());\n\n $payload = [\n $this->resourceNameSingular() => $prepared\n ];\n\n $response = $this\n ->request()\n ->put($this->endpoint($id), $payload);\n\n // Extract and (re)populate resource (if possible)\n // Note: Unlike the \"create\" method, Redmine does NOT\n // appear to send back a full resource when it has been\n // successfully updated.\n $this->fill(\n $this->decodeSingle($response)\n );\n\n return true;\n }", "public function update($request, $id);", "function put($resource, $data = null) {\r\n\t\t\r\n\t\tif(isset($data)) {\r\n\t\t\t$this->request_body = $data;\r\n\t\t}\r\n\r\n\t\t// make the call chief\r\n\t\t$this->exec ( \"PUT\", '/' . $resource );\r\n\r\n\t\t// check the request status\r\n\t\tif($this->status_code != 200){\r\n\t\t\t$this->Logger->error(\r\n\t\t\t\tsprintf(\r\n\t\t\t\t\t'GET Call for resource \\'%s\\' Failed.\r\n\t\t\t\t\tStatus: %d,\r\n\t\t\t\t\tRequest: %s\r\n\t\t\t\t\tAPI Error Message: \r\n\t\t\t\t\t%s',\r\n\t\t\t\t\t$resource,\r\n\t\t\t\t\t$this->status_code,\r\n\t\t\t\t\t$this->request_body_raw,\r\n\t\t\t\t\t$this->response_body\r\n\t\t\t\t)\r\n\t\t\t);\r\n\t\t\tthrow new Exception($this->response_body);\r\n\t\t} else {\r\n\t\t\treturn $this->response_parsed;\r\n\t\t}\r\n\t}", "public function updateEntities($resource)\n {\n $json = [\n 'resource' => $resource,\n ];\n $request = $this->createRequest('PUT', '/entities', ['json' => $json]);\n $response = $this->send($request);\n return $response;\n }", "public function updateStream($path, $resource, Config $config)\n {\n return $this->writeStream($path, $resource, $config);\n }", "public function update(Request $request, $id)\n {\n\n $product = Product::findOrFail($id);\n $product->name = $request['name'];\n $product->price = $request['price'];\n $product->stock = $request['stock'];\n $product->description = $request['description'];\n\n $file = $request->file('image');\n $fileName = $file->getClientOriginalName();\n if($fileName != $product->image){\n $request->file('image')->move('images/',$fileName);\n $product->image = $fileName;\n }\n\n $product->save();\n\n return redirect()->route('products.show',\n $product->id)->with('flash_message',\n 'Article, '. $product->name.' updated');\n }", "protected function handleUpdate()\n {\n $resource = $this->argument('resource');\n $action = $this->option('action');\n $startPage = (int)$this->option('startPage');\n $perPage = (int)$this->option('perPage');\n\n try {\n $harvest = Harvest::where('resource', $resource)->where('action', $action)->firstOrFail();\n } catch (\\Exception $e) {\n $this->info('There is no existing action for updating ' . ucwords($action) . ' ' . ucwords($resource) . '.');\n exit('Nothing was updated.');\n }\n\n $options = [\n 'startPage' => $startPage,\n 'perPage' => $perPage,\n 'lastRun' => $harvest->last_run_at\n ];\n\n // If a lastRun was given use that\n // OR if this has never been run before use 2001-01-01\n if (!empty($this->option('lastRun'))) {\n $options['lastRun'] = new Carbon($this->option('lastRun'));\n } elseif (is_null($options['lastRun'])) {\n $options['lastRun'] = new Carbon('2001-01-01');\n }\n\n $job = new UpdateResourceJob(\n $harvest,\n $options\n );\n\n $message = 'Updating ' . $action . ' ' . $resource . ' ' . $perPage . ' at a time';\n if (isset($lastRun)) {\n $message .= ' with entries updated since ' . $lastRun->format('r');\n }\n $this->info($message);\n $this->dispatch($job);\n }", "abstract public function put($data);", "public function update($id, $data);", "public function update($id, $data);", "public function update($id, $data);", "public function update($id, $data);", "public function update($id, $data);", "public function testUpdateSupplierUsingPUT()\n {\n }", "public function update(Request $request, $id)\n {\n $storageplace = Storageplace::findOrFail($id);\n $storageplace->update($request->only(['storageplace']));\n return $storageplace;\n }", "public function updateRelatedImage(Request $request, $id)\n {\n // Delete display image in Storage\n Validator::make($request->all(), ['photos' => \"required|file|image|mimes:jpg,png,jpeg|max:5000\"])->validate();\n\n\n if ($request->hasFile(\"photos\")) {\n\n $photo = ProductsPhoto::find($id);\n $imageName = $photo->photos;\n $exists = Storage::disk('local')->exists(\"public/product_images/\" . $photo->photos);\n\n //delete old image\n if ($exists) {\n Storage::delete('public/product_images/' . $imageName);\n }\n\n //upload new image\n $ext = $request->file('photos')->getClientOriginalExtension(); //jpg\n\n $request->photos->storeAs(\"public/product_images/\", $imageName);\n\n $arrayToUpdate = array('photos' => $imageName);\n DB::table('products_photos')->where('id', $id)->update($arrayToUpdate);\n\n return redirect()->route(\"adminDisplayRelatedImageForm\", ['id' => $photo->product_id]);\n } else {\n\n $error = \"NO Image was Selected\";\n return $error;\n }\n }", "public function update(Request $request, $id)\n {\n $skill = Skill::findOrFail($id);\n\n $skill->skill = $request->skill;\n\n if ($request->hasFile('image')) {\n \\Cloudder::upload($request->file('image'));\n $c=\\Cloudder::getResult();\n // $image = $request->file('image');\n // $filename = time() . '.' . $image->getClientOriginalExtension();\n // $location = public_path('images/' . $filename);\n // Image::make($image)->save($location);\n\n $skill->image = $c['url'];\n }\n\n $skill->save();\n\n Session::flash('success', 'Successsfully updated your skill!');\n return redirect()->route('skills.index');\n }", "public function updateStream($path, $resource, Config $config = null)\n {\n $contents = stream_get_contents($resource);\n\n return $this->write($path, $contents, $config);\n }", "public abstract function update($object);", "public static function update($id, $file)\n {\n Image::delete($id);\n\n Image::save($file);\n }", "public function update(Request $request, $id)\n {\n $product = Product::find($id);\n $image = $product->image;\n if($request->hasFile('image')){\n $image = $request->file('image')->store('files');\n \\Storage::delete($product->image);\n } \n $product->name = $request->get('name');\n $product->price = $request->get('price');\n $product->description = $request->get('description');\n $product->additional_info = $request->get('additional_info');\n $product->category_id = $request->get('category');\n $product->subcategory_id = $request->get('subcategory');\n $product->image = $image;\n $product->save();\n return redirect()->back();\n }", "public function update(Request $request, $id)\n {\n $sli=Slider::find($id);\n $sli->sort_order=$request->input('sort_order');\n $image = $request->file('slider');\n if($image == ''){\n $image = $sli->slider;\n }else{\n $image = base64_encode(file_get_contents($request->file('slider')));\n }\n $sli->slider = $image;\n $sli->save();\n return redirect()->back();\n }", "public function update(ProductRequest $request, $id)\n {\n $input = Product::find($id);\n $data = $request->all();\n if ($file = $request->file('product_photo')){\n $name = time().$file->getClientOriginalName();\n $file->move('product_image',$name);\n $data['product_photo']=$name;\n// $input->update($data);\n }\n $input->update($data);\n return redirect('admin/products/');\n }", "public function update(Request $request, $id)\n {\n $volume = $this->findVolume($id);\n\n if(count($volume) > 0) {\n $volume->str_volume_name = $request->str_volume_name;\n\n $volume->save();\n }\n\n return response()\n ->json(\n array(\n 'message' => 'Volume is successfully updated.',\n 'volume' => $volume\n ),\n 201\n );\n }", "public function update(Request $request, $id)\n {\n $product = ProductModel::find($id);\n $product->name = $request->name;\n $product->description = $request->description;\n $product->price = $request->price;\n $product->stock = $request->stock;\n\n if($request->image!=null){\n $imageName = time().'.'.$request->image->extension();\n $request->image->move(public_path('images'), $imageName);\n $product->image = \"/images/\".$imageName;\n }\n $product->save();\n return redirect(\"/products/index\")->with('success','Product has been updated');\n }", "public function update()\n {\n $accessory = Accessories::find(request('id'));\n\n if ($accessory == null) {\n return response()->json([\"error\" => \"aksesuaras nerastas\"], 404);\n }\n\n $this->validateData();\n $path = $accessory->src;\n\n if (request()->hasFile('src')) {\n\n if (Storage::disk('public')->exists($accessory->src)) {\n Storage::disk('public')->delete($accessory->src);\n }\n $path = request()->file('src')->store('accessoriesImages', 'public');\n }\n\n $accessory->update(array_merge($this->validateData(), ['src' => $path]));\n\n return response()->json([\"data\" => $accessory], 200);\n }", "public function update(ProductStoreRequest $request,$id)\n {\n $data = $request->validated();\n $product = Product::where('id',$id);\n $product->update($data);\n return response(\"Producto actualizado con éxito\",200);\n }", "public function update($entity)\n {\n \n }", "public function updateStream($path, $resource, Config $config)\n {\n return $this->write($path,stream_get_contents($resource),$config);\n }", "public function update($id, Request $request)\n {\n date_default_timezone_set('Asia/Taipei');\n $data = $request->all();\n $dbData = Product::find($id);\n $myfile = Storage::disk('local');\n if ($request->hasFile('img')) {\n $file = $request->file('img');\n $path = $myfile->putFile('public', $file);\n $data['img'] = $myfile->url($path);\n File::delete(public_path($dbData->img));\n }\n $dbData->update($data);\n\n if ($request->hasFile('imgs')) {\n // $this->fetchDestroyByProdId($id);\n $localS = Storage::disk('local');\n\n $fileS = $request->file('imgs');\n $imgs = [];\n foreach ($fileS as $i) {\n $pathS = $localS->putFile('public', $i);\n $imgs[] = $localS->url($pathS);\n }\n foreach ($imgs as $img) {\n ProductImg::create([\n 'product_id' => $id,\n 'img' => $img\n ]);\n }\n }\n\n return redirect()->route('admin');\n }", "public function update(Request $request, Product $product)\n { $remfile= $product->image;\n if($request->filep){\n $product->image=$request->filep;\n File::delete(storage_path('app/public/products/'.$remfile));\n }else{\n $product->image=$remfile;\n }\n //rmdir(storage_path('app/public/products/'.$remfile));\n $product->name = $request->name;\n $product->description = $request->description;\n $product->price = $request->price;\n $product->save();\n sleep(3);\n toast('Details updated successfully','info');\n return redirect('/products');\n }", "public function update($id, $input);", "public function update(ProductRequest $request,int $id): ProductResource\n {\n $attributes = $request->only('supplier_id', 'name', 'warehouses');\n\n return new ProductResource($this->productRepository->update($id, $attributes)); }", "public function update(Request $request, $id)\n {\n $slider=new Slider;\n $slider=$slider::find($id);\n \n \n if($file =$request->file('slider')){\n if(Storage::delete('public/slider/'.$slider->slider)){\n\n //Get file original name//\n \n$original_name=$file->getClientOriginalName();\n\n //Get just the file name\n$filename=pathinfo($original_name,PATHINFO_FILENAME);\n\n//Create new file name\n$name=$filename.'_'.time().'.'.$file->getClientOriginalExtension();\n\n $destination='public/slider';\n $path=$request->slider->storeAs($destination,$name);\n $slider->slider=$name;\n $slider->save();\n return redirect('Admin/slider');\n\n }\n }\n}", "public function update(Request $request, $id)\n {/* dd($request->all()); */\n $acheivePic = $this->acheiveRepo->find($id);\n $acheive = $request->except('_method', '_token', 'photo', 'ar', 'en');\n $acheiveTrans = $request->only('ar', 'en');\n\n if ($request->hasFile('icon')) {\n // Delete old image first.\n $oldPic = public_path() . '/images/acheives/' . $acheivePic->icon;\n File::delete($oldPic);\n\n // Save the new one.\n $image = $request->file('icon');\n $imageName = $this->upload($image, 'acheives');\n $acheive['icon'] = $imageName;\n }\n\n $this->acheiveRepo->update($id, $acheive, $acheiveTrans);\n\n return redirect('admin-panel/widgets/acheive')->with('updated', 'updated');\n }", "public function update(Request $request, $id)\n {\n $data = $request->all();\n extract($data);\n\n $productVarient = new ProductVariant();\n $productVarient = $productVarient->find($id);\n $productVarient->vendor_id = auth()->user()->id;\n $productVarient->description = $prod_desc;\n $productVarient->price = $price;\n\n if(request()->hasFile('photo')){\n $image = request()->file('photo')->getClientOriginalName();\n $imageNewName = auth()->user()->id.'-'.$image;\n $file = request()->file('photo');\n $file->storeAs('images/product',$imageNewName, ['disk' => 'public']);\n $productVarient->image = $imageNewName;\n }\n \n $productVarient->save();\n\n return back()->withStatus(__('Product successfully updated.'));\n }", "public function update(Request $request, $id)\n {\n //if upload new image, delete old image\n $myfile=$request->old_photo;\n if($request->hasfile('photo'))\n {\n $imageName=time().'.'.$request->photo->extension();\n $name=$request->old_photo;\n\n if(file_exists(public_path($name))){\n unlink(public_path($name));\n $request->photo->move(public_path('backendtemplate/truefalseimg'),$imageName);\n $myfile='backendtemplate/truefalseimg/'.$imageName;\n }\n }\n //Update Data\n $truefalsequestion=TrueFalseQuestion::find($id);\n $truefalsequestion->name=$request->name;\n $truefalsequestion->photo=$myfile;\n $truefalsequestion->answer = $request->answer;\n $truefalsequestion->question_id = $request->question;\n $truefalsequestion->save();\n\n //Redirect\n return redirect()->route('truefalsequestions.index'); \n }", "public function update($id);", "public function update($id);", "private function update()\n {\n $this->data = $this->updateData($this->data, $this->actions);\n $this->actions = [];\n }", "public function put($path, $data = null);", "public function update(Request $request, $id)\n {\n $request->validate([\n 'path_image'=>'image',\n 'status'=>'required|in:0,1'\n ]);\n $slider=Slider::whereId($id)->first();\n if (is_null($slider)){\n return redirect()->route('sliders.index')->with('error','Slider does not exist');\n }\n try {\n if ($request->hasFile('path_image')){\n $file = $request->file('path_image');\n\n $image_path= $file->store('/sliders',[\n 'disk'=>'uploads'\n ]);\n Storage::disk('uploads')->delete($slider->image);\n\n $request->merge([\n 'image'=>$image_path,\n ]);\n }\n\n $slider->update( $request->only(['status','image']));\n return redirect()->route('sliders.index')->with('success','Updated successful');\n }catch (\\Exception $exception){\n return redirect()->route('sliders.index')->with(['error'=>'Something error try again']);\n\n }\n }", "public function update() {\n $this->accessory->update($this->accessory_params());\n\n if ($this->accessory->is_valid()) {\n $this->update_accessory_image($this->accessory);\n redirect('/backend/accessories', ['notice' => 'Successfully updated.']);\n } else {\n redirect(\n '/backend/accessories/edit',\n ['error' => $this->accessory->errors_as_string()],\n ['id' => $this->accessory->id]\n );\n }\n }", "public function update(Entity $entity);", "public function update(Request $request, $id)\n {\n $icon = SliderIcon::find($id);\n $data = $request->all();\n $data['active'] = $request->has('active') ? 1 : 0;\n if ($request->hasFile('img')) {\n if (Storage::disk('public')->exists(str_replace('storage', '', $icon->img))){\n Storage::disk('public')->delete(str_replace('storage', '', $icon->img));\n }\n $image = $request->file('img');\n $fileName = time().'_'.Str::lower(Str::random(5)).'.'.$image->getClientOriginalExtension();\n $path_to = '/upload/images/'.getfolderName();\n $image->storeAs('public'.$path_to, $fileName);\n $data['img'] = 'storage'.$path_to.'/'.$fileName;\n }\n $icon->update($data);\n return redirect()->route('slider_icons.index')->with('success', 'Данные преимущества обнавлены');\n }", "public function update() {\n\t $this->layout = false;\n\t \n\t //set default response\n\t $response = array('status'=>'failed', 'message'=>'HTTP method not allowed');\n\t \n\t //check if HTTP method is PUT\n\t if($this->request->is('put')){\n\t //get data from request object\n\t $data = $this->request->input('json_decode', true);\n\t if (empty($data)) {\n\t $data = $this->request->data;\n\t }\n\t \n\t //check if product ID was provided\n\t if (!empty($data['id'])) {\n\t \n\t //set the product ID to update\n\t $this->Player->id = $data['id'];\n\t if ($this->Player->save($data)) {\n\t $response = array('status'=>'success','message'=>'Product successfully updated');\n\t } else {\n\t $response['message'] = \"Failed to update product\";\n\t }\n\t } else {\n\t $response['message'] = 'Please provide product ID';\n\t }\n\t }\n\t \n\t $this->response->type('application/json');\n\t $this->response->body(json_encode($response));\n\n\t return $this->response->send();\n\t}", "public function update(Request $request, $id)\n {\n //validate incoming request\n $request->validate([\n 'name' => 'string|max:100|nullable',\n 'picture' => 'max:2000|mimes:jpeg,jpg,png,svg|nullable', //max size 2mb,\n 'total' => 'integer|min:0|nullable', //value must be > 0\n 'selling_price' => 'numeric|min:0|nullable',\n 'cost_price' => 'numeric|min:0|nullable',\n 'category_id' => 'integer|nullable'\n ]);\n\n try {\n $product = Auth::user()->store->product()->findorFail($id);\n } catch (ModelNotFoundException $e) {\n return response()->json([\n \"message\" => \"Forbidden\"\n ], 403);\n }\n\n //if category id isnt null\n if ($category_id = $request->category_id) {\n if (!$this->isCategoryIdValid($category_id))\n return response()->json([\n \"message\" => \"Category Id is not valid\"\n ], 422);\n else\n $product->category_id = $request->category_id;\n }\n\n //if uploaded file exist\n if ($picture = $request->file(\"picture\")) {\n //if product already has logo\n if ($product->picture)\n Storage::delete(Product::$PICTURE_PATH . \"/\" . $product->picture);\n\n $picture_path = $picture->store(Product::$PICTURE_PATH);\n //remove folder name from path\n $product->picture = str_replace(Product::$PICTURE_PATH . \"/\", '', $picture_path);\n }\n\n $this->renewProduct($product, $request);\n $product->save();\n return response()->json(new ProductResource($product), 200);\n }", "public function update(Request $request, $id)\n {\n $request->validate([\n 'name' => 'required | min:3 | string',\n 'type' => 'required',\n 'producer' => 'required',\n 'image' => 'image | mimes:png,jpg,jpeg',\n 'price_input' => 'required | numeric | min:0 | max:300000000',\n 'promotion_price' => 'required | numeric | max:300000000',\n 'description' => 'required | string',\n\n ]);\n $product = Product::withTrashed()->findOrfail($id);\n $product->name = $request->name;\n $product->id_type = $request->type;\n $product->id_producer = $request->producer;\n\n $product->amount = $request->amount;\n if (request('image')) {\n $product->image = base64_encode(file_get_contents($request->file('image')->getRealPath()));\n }\n\n $product->price_input = $request->price_input;\n\n if ( $request->promotion_price >= 0 && $request->promotion_price < $product->price_input) {\n $product->promotion_price = $request->promotion_price;\n }else{\n return back()->with('error', '\n Do not enter a negative number');\n }\n $product->new = $request->new;\n\n $product->description = $request->description;\n\n $product->save();\n $product->size()->sync(request('size'));\n\n return redirect()->route('product.index')->with('success', 'Product Updated successfully');\n }", "public function update(Request $request, $id)\n {\n $product = Product::find($id);\n\n $product->name = $request->input('name');\n $product->description = $request->input('description');\n $product->lastPrice = $product->price !== $request->input('price') ? $product->price : NULL;\n $product->price = $request->input('price');\n\n if ($request->hasFile('image')) { \n $currentImg = $product->image;\n if ($currentImg) {\n Storage::delete('/public/' . $currentImg);\n }\n $image = $request->file('image'); \n $path = $image->store('images','public');\n $product->image = $path;\n };\n\n $product->save(); \n\n $product_promotions = $request->input('promotion');\n\n $product->promotions()->sync($product_promotions);\n\n return redirect()->route('admin.modify');\n }", "public static function updateImage($fileName, $imageId, $storage)\n {\n //Get image name and storage location for image\n $image = Image::where('id', '=', $imageId)->first();\n\n //Delete old image\n ResourceHandler::delete($image->name, $image->storage);\n\n //Store the new image\n $image->name = $fileName;\n $image->storage = $storage;\n\n $image->save();\n }", "public function update($request, $id)\n {\n $this->checkExits($id);\n $data = $request->except(['_method','_token','photo']);\n\n if($request->photo)\n {\n try {\n $this->UploadFile($request);\n } catch (\\Exception $e) {\n //if has exception , don't has action\n }\n if ($this->img !== '') {\n $data['img'] = $this->img;\n }\n }\n\n $this->object->update($data);\n\n }", "public function updateProduct($request, $product)\n {\n $product->update($request->except(['_token', '_method', 'image']));\n if ($request->hasFile('image')) {\n $image = $request->file('image');\n $imageName = time() . '.' . $request->file('image')->extension();\n // $img = Image::make('public/foo.jpg');\n\n $image_resize = Image::make($image->getRealPath());\n $image_resize->resize(500, 500);\n $image_resize->save(public_path('images/') . $imageName, 100);\n $product->gallery = $imageName;\n $product->save();\n }\n $product->getTags()->sync($request->input('tags'));\n }" ]
[ "0.7425105", "0.70612276", "0.70558053", "0.6896673", "0.6582159", "0.64491373", "0.6346954", "0.62114537", "0.6145042", "0.6119944", "0.61128503", "0.6099993", "0.6087866", "0.6052593", "0.6018941", "0.60060275", "0.59715486", "0.5946516", "0.59400934", "0.59377414", "0.5890722", "0.5860816", "0.5855127", "0.5855127", "0.58513457", "0.5815068", "0.5806887", "0.57525045", "0.57525045", "0.57337505", "0.5723295", "0.5714311", "0.5694472", "0.5691319", "0.56879413", "0.5669989", "0.56565005", "0.56505877", "0.5646085", "0.5636683", "0.5633498", "0.5633378", "0.5632906", "0.5628826", "0.56196684", "0.5609126", "0.5601397", "0.55944353", "0.5582592", "0.5581908", "0.55813426", "0.5575312", "0.55717176", "0.55661047", "0.55624634", "0.55614686", "0.55608666", "0.55599797", "0.55599797", "0.55599797", "0.55599797", "0.55599797", "0.55573726", "0.5556878", "0.5554201", "0.5553069", "0.55530256", "0.5543788", "0.55435944", "0.55412996", "0.55393505", "0.55368495", "0.5535236", "0.5534954", "0.55237365", "0.5520468", "0.55163723", "0.55125296", "0.5511168", "0.5508345", "0.55072427", "0.5502385", "0.5502337", "0.5501029", "0.54995877", "0.54979175", "0.54949397", "0.54949397", "0.54946727", "0.5494196", "0.54941916", "0.54925025", "0.5491807", "0.5483321", "0.5479606", "0.5479408", "0.5478678", "0.54667485", "0.5463411", "0.5460588", "0.5458525" ]
0.0
-1
Remove the specified resource from storage.
public function destroy($id) { // }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete($resource){\n return $this->fetch($resource, self::DELETE);\n }", "public function destroy(Resource $resource)\n {\n //\n }", "public function removeResource($resourceID)\n\t\t{\n\t\t}", "public function unpublishResource(PersistentResource $resource)\n {\n $client = $this->getClient($this->name, $this->options);\n try {\n $client->delete(Path::fromString($this->getRelativePublicationPathAndFilename($resource)));\n } catch (FileDoesNotExistsException $exception) {\n }\n }", "public function deleteResource(&$resource) {\n\n if ($this->connector != null) {\n $this->logger->addDebug(\"Deleting Resource Node from Neo4J database\");\n $result = $this->connector->run(\"MATCH (a:Resource {id: {id}}) detach delete a;\",\n [\n 'id' => $resource->getID()\n ]\n );\n $this->logger->addDebug(\"Updated neo4j to remove resource\");\n }\n\n }", "public function deleteShopifyResource() {\n $this->getShopifyApi()->call([\n 'URL' => API::PREFIX . $this->getApiPathSingleResource(),\n 'METHOD' => 'DELETE',\n ]);\n }", "public function deleteResource()\n {\n $database = new Database();\n $id = $this->_params['id'];\n $database->deleteResource($id);\n $this->_f3->reroute('/Admin');\n }", "protected function deleteResource($fileName, $storage)\n {\n if (Storage::disk($storage)->exists($fileName)) \n {\n return Storage::disk($storage)->delete($fileName);\n }\n }", "public function delete()\n {\n persistableCollection::getInstance($this->resourceName)->deleteObject($this);\n }", "public function remove()\n {\n $this->_getBackend()->remove($this->_id);\n }", "public function remove()\n {\n if (! ftruncate($this->fileHandle, 0)) {\n throw new StorageException(\"Could not truncate $this->path\");\n }\n if (! unlink($this->path)) {\n throw new StorageException(\"Could not delete $this->path\");\n }\n }", "public function delete()\n\t{\n\t\t$s3 = AWS::createClient('s3');\n $s3->deleteObject(\n array(\n 'Bucket' => $this->bucket,\n 'Key' => $this->location\n )\n );\n\t\tif($this->local_file && file_exists($this->local_file)) {\n\t\t\tunlink($this->local_file);\n\t\t}\n $this->local_file = null;\n\t}", "public function delete()\n\t{\n\t\tsfCore::db->query(\"DELETE FROM `swoosh_file_storage` WHERE `id`='%i';\", $this->id);\n\t\t$this->fFile->delete();\n\t}", "public function delete(): void\n {\n unlink($this->getPath());\n }", "public function delete()\n {\n if($this->exists())\n unlink($this->getPath());\n }", "public function remove($path);", "function deleteFileFromStorage($path)\n{\n unlink(public_path($path));\n}", "public function delete(): void\n {\n unlink($this->path);\n }", "private function destroyResource(DrydockResource $resource) {\n $blueprint = $resource->getBlueprint();\n $blueprint->destroyResource($resource);\n\n $resource\n ->setStatus(DrydockResourceStatus::STATUS_DESTROYED)\n ->save();\n }", "public static function delete($fileName, $storage)\n {\n if (Storage::disk($storage)->exists($fileName)) \n {\n return Storage::disk($storage)->delete($fileName);\n }\n }", "public function remove() {}", "public function remove() {}", "public function remove();", "public function remove();", "public function remove();", "public function remove();", "function delete_resource($resource_id, $page)\n\t{\n\t\t//get resource data\n\t\t$table = \"resource\";\n\t\t$where = \"resource_id = \".$resource_id;\n\t\t\n\t\t$this->db->where($where);\n\t\t$resource_query = $this->db->get($table);\n\t\t$resource_row = $resource_query->row();\n\t\t$resource_path = $this->resource_path;\n\t\t\n\t\t$image_name = $resource_row->resource_image_name;\n\t\t\n\t\t//delete any other uploaded image\n\t\t$this->file_model->delete_file($resource_path.\"\\\\\".$image_name, $this->resource_path);\n\t\t\n\t\t//delete any other uploaded thumbnail\n\t\t$this->file_model->delete_file($resource_path.\"\\\\thumbnail_\".$image_name, $this->resource_path);\n\t\t\n\t\tif($this->resource_model->delete_resource($resource_id))\n\t\t{\n\t\t\t$this->session->set_userdata('success_message', 'resource has been deleted');\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\t$this->session->set_userdata('error_message', 'resource could not be deleted');\n\t\t}\n\t\tredirect('resource/'.$page);\n\t}", "public function deleteImage(){\n\n\n Storage::delete($this->image);\n }", "public function del(string $resource): bool|string\n {\n $json = false;\n $fs = unserialize($_SESSION['rfe'][$this->getRoot()], ['allowed_classes' => false]);\n if (array_key_exists($resource, $fs)) {\n // if $item has children, delete all children too\n if (array_key_exists('dir', $fs[$resource])) {\n foreach ($fs as $key => $file) {\n if (isset($file['parId']) && $file['parId'] == $resource) {\n unset($fs[$key]);\n }\n }\n }\n unset($fs[$resource]);\n $_SESSION['rfe'][$this->getRoot()] = serialize($fs);\n $json = '[{\"msg\": \"item deleted\"}]';\n }\n return $json;\n }", "public function destroy()\n\t{\n\t\treturn unlink(self::filepath($this->name));\n\t}", "public function destroy($id) {\n $book = Book::find($id);\n // return unlink(storage_path(\"public/featured_images/\".$book->featured_image));\n Storage::delete(\"public/featured_images/\" . $book->featured_image);\n if ($book->delete()) {\n return $book;\n }\n\n }", "public function destroy($id)\n {\n Storageplace::findOrFail($id)->delete();\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 deleteResource(PersistentResource $resource)\n {\n $pathAndFilename = $this->getStoragePathAndFilenameByHash($resource->getSha1());\n if (!file_exists($pathAndFilename)) {\n return true;\n }\n if (unlink($pathAndFilename) === false) {\n return false;\n }\n Files::removeEmptyDirectoriesOnPath(dirname($pathAndFilename));\n return true;\n }", "public function deleteImage(){\n \tStorage::delete($this->image);\n }", "public function destroy()\n {\n $file=public_path(config('larapages.media.folder')).Input::all()['folder'].'/'.Input::all()['file'];\n if (!file_exists($file)) die('File not found '.$file);\n unlink($file);\n }", "public function delete() \r\n {\r\n if($this->exists())\r\n {\r\n unlink($this->fullName());\r\n }\r\n }", "public function destroy($id)\n {\n Myfile::find($id)->delete();\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 static function delete($path){\r\n $currentDir = getcwd();\r\n $storageSubPath = \"/../../\".STORAGE_PATH;\r\n $file = $currentDir . $storageSubPath . '/' . $path;\r\n\r\n unlink($file);\r\n }", "public function destroy(Storage $storage)\n {\n return redirect()->route('storages.index');\n }", "public function remove() {\n //Check if there are thumbs and delete files and db\n foreach ($this->thumbs()->get() as $thumb) {\n $thumb->remove();\n } \n //Delete the attachable itself only if is not default\n if (strpos($this->url, '/defaults/') === false) {\n Storage::disk('public')->delete($this->getPath());\n }\n parent::delete(); //Remove db record\n }", "public function removeFile($uri){\n return Storage::disk('public')->delete($uri);\n }", "public function destroy(Resource $resource)\n {\n if( $resource->delete() ){\n return Response(['status'=>'success','message'=>'Resource deleted']); \n } else {\n return Response(['status'=>'error', 'message'=>'Something went wrong']);\n }\n }", "public function delete($path);", "public function delete($path);", "public function destroy($id)\n { \n File::find($id)->remove();\n \n return redirect()->route('files.index');\n }", "public function destroy($id)\n {\n $supplier = Supplier::find($id);\n $photo = $supplier->photo;\n if ($photo) {\n unlink($photo);\n }\n $supplier->delete();\n }", "public function destroy($id)\n {\n $student = Student::where('id', $id)->first();\n // $path = $student->image;\n unlink($student->image);\n Student::findOrFail($id)->delete();\n return response('Deleted!');\n }", "public function destroy($id)\n {\n $icon = SliderIcon::find($id);\n if (Storage::disk('public')->exists(str_replace('storage', '', $icon->img))){\n Storage::disk('public')->delete(str_replace('storage', '', $icon->img));\n }\n $icon->delete();\n return redirect()->route('slider_icons.index')->with('success', 'Данные преимущества удалёны');\n }", "public function delete($path, $data = null);", "public function destroy($id)\n {\n $items=Items::find($id);\n // delete old file\n if ($items->photo) {\n $str=$items->photo;\n $pos = strpos($str,'/',1);\n $str = substr($str, $pos);\n $oldFile = storage_path('app\\public').$str;\n File::Delete($oldFile); \n }\n $items->delete();\n return redirect()->route('items.index');\n }", "public function destroy($id)\n {\n $carousel = Carousel::find($id);\n $image = $carousel->image;\n\n $basename ='img/carousel/' . basename($image);\n //Delete the file from disk\n if(file_exists($basename)){\n unlink($basename);\n }\n //With softDeletes, this is the way to permanently delete a record\n $carousel->delete();\n Session::flash('success','Product deleted permanently');\n return redirect()->back();\n }", "public function remove()\n {\n $fs = new Filesystem();\n $fs->remove($this->dir());\n }", "public static function destroy(int $resource_id)\n {\n try {\n $image_data = ListingImage::where('id', $resource_id)->first();\n self::delete_image($image_data->name);\n $delete = ListingImage::where('id', $resource_id)->delete();\n\n // activity()\n // ->causedBy(Auth::user()->id)\n // ->performedOn($delete)\n // ->withProperties(['id' => $delete->id])\n // ->log('listing image deleted');\n return response()->json(['status'=> 'ok', 'msg'=> 'Data deleted successfully']);\n } catch (Exception $e) {\n $e->getMessage();\n }\n }", "public function destroy(Storage $storage)\n {\n $this->storage->destroy($storage);\n\n return redirect()->route('admin.product.storage.index')\n ->withSuccess(trans('core::core.messages.resource deleted', ['name' => trans('product::storages.title.storages')]));\n }", "public function del($path){\n\t\treturn $this->remove($path);\n\t}", "public function destroy($id)\n {\n //\n $product = Product::findOrFail($id);\n $product->delete();\n if($product->img != 'product-default.png'){\n Storage::delete(\"public/uploads/\".$product->img);\n // return 'deleted';\n }\n return redirect()->route('product.index'); \n }", "public function removeUpload()\n{\n if ($file = $this->getAbsolutePath()) {\n unlink($file); \n }\n}", "public function destroy($id)\n {\n $image = Images::withTrashed()->find($id);\n\n Storage::disk('uploads')->delete(\"social-media/$image->filename\");\n\n $image->tags()->detach();\n $image->detachMedia(config('constants.media_tags'));\n $image->forceDelete();\n\n return redirect()->back()->with('success', 'The image was successfully deleted');\n }", "public function destroyByResourceId($resource_id)\n {\n// $online_party = $this->onlinetrack->where('resource_id', $resource_id)->get()->first();\n// $online_party->status = \"offline\";\n// $online_party->save();\n// return $online_party;\n return $this->onlinetrack->where('resource_id', $resource_id)->delete();\n }", "public function revoke($resource, $permission = null);", "public function destroy($id)\n {\n $data=Image::find($id);\n $image = $data->img;\n\n\n $filepath= public_path('images/');\n $imagepath = $filepath.$image;\n\n //dd($old_image);\n if (file_exists($imagepath)) {\n @unlink($imagepath);\n }\n\n\n $data->delete();\n\n return redirect()->route('image.index');\n }", "function delete($path);", "public function removeItem(int $id)\n\t{\n\t\t$this->storage->remove($id);\n\t}", "public function destroy(File $file)\n {\n //\n $v = Storage::delete($file->path);\n \n }", "public function destroyResource($resource)\n {\n if (!is_object($resource)) {\n return false;\n }\n\n $resource_type = get_class($resource);\n $resource_id = $resource->getKey();\n\n return Role::where('resource_type', $resource_type)\n ->where('resource_id', $resource_id)\n ->delete();\n }", "public function remove($filePath){\n return Storage::delete($filePath);\n }", "public function remove(): void\n {\n $file = $this->getAbsolutePath();\n if (!is_file($file) || !file_exists($file)) {\n return;\n }\n\n unlink($file);\n }", "public function destroy(Request $request, Storage $storage)\n {\n $storage->delete();\n $request->session()->flash('alert-success', 'Запись успешно удалена!');\n return redirect()->route('storage.index');\n }", "public function remove(Storable $entity): Storable\n {\n $this->getRepository(get_class($entity))->remove($entity);\n $this->detach($entity);\n\n return $entity;\n }", "public function processDeletedResource(EntityResource $resource)\n {\n /** @var AuthorizationRepository $repository */\n $repository = $this->entityManager->getRepository('Edweld\\AclBundle\\Entity\\Authorization');\n\n $repository->removeAuthorizationsForResource($resource);\n }", "function _unlink($resource, $exp_time = null)\n {\n if(file_exists($resource)) {\n return parent::_unlink($resource, $exp_time);\n }\n\n // file wasn't found, so it must be gone.\n return true;\n }", "public function remove($id);", "public function remove($id);", "public function deleted(Storage $storage)\n {\n //\n }", "public function destroy($id)\n {\n $data = Product::findOrFail($id);\n\n if(file_exists('uploads/product/'.$data->image1)){\n unlink('uploads/product/'.$data->image1);\n }\n\n if(file_exists('uploads/product/'.$data->image2)){\n unlink('uploads/product/'.$data->image2);\n }\n\n if(file_exists('uploads/product/'.$data->image3)){\n unlink('uploads/product/'.$data->image3);\n }\n $data->delete();\n }", "public function removeUpload()\n {\n $file = $this->getAbsolutePath();\n if ($file) {\n unlink($file);\n }\n }", "public function resources_delete($resource_id, Request $request) {\n if ($resource_id) {\n $resp = Resources::where('id', '=', $resource_id)->delete();\n if($resp){\n $msg = 'Resource has been deleted successfully.';\n $request->session()->flash('message', $msg);\n }\n }\n //return redirect()->route('admin-factor-list');\n return redirect()->to($_SERVER['HTTP_REFERER']);\n }", "public function delete()\n {\n try\n {\n $thumbnail = $this->getThumbnail();\n if($thumbnail)\n {\n $thumbnail->delete();\n }\n }\n catch(sfException $e){}\n \n // delete current file\n parent::delete();\n }", "function deleteResource($uuid){\n $data = callAPI(\"DELETE\",\"/urest/v1/resource/\".$uuid);\n return $data;\n}", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function delete();", "public function remove_resource($idproject){\n\t\t\n\t\t// Load model and try to get project data\n\t\t$this->load->model('Projects_model', 'projects');\n\t\t\n\t\t// Update\n\t\t$this->projects->save_project(array(\"ext\" => \"\", \"vzaar_idvideo\" => \"0\", \"vzaar_processed\" => \"0\"), $idproject);\n\t}", "public function destroy($id){\n $file_data = Slider::findOrFail($id);\n File::delete(public_path('../storage/app/public/sliders/'.$file_data->path));\n $slider = Slider::destroy($id);\n return response()->json(null, 204);\n }", "public function delete()\n\t{\n\t\t@unlink($this->get_filepath());\n\t\t@unlink($this->get_filepath(true));\n\t\tparent::delete();\n\t}", "public function delete($resource_path, array $variables = array()) {\n return $this->call($resource_path, $variables, 'DELETE');\n }", "public function destroy($id)\n {\n //Find Slider With Id\n $slider = Slider::findOrFail($id);\n // Check If The Image Exist\n if(file_exists('uploads/slider/'.$slider->image)){\n\n unlink( 'uploads/slider/'.$slider->image);\n }\n $slider->delete();\n return redirect()->back()->with('success','Slider Successfully Deleted');\n }" ]
[ "0.6672584", "0.6659381", "0.6635911", "0.6632799", "0.6626075", "0.65424126", "0.65416265", "0.64648265", "0.62882507", "0.6175931", "0.6129922", "0.60893893", "0.6054415", "0.60428125", "0.60064924", "0.59337646", "0.5930772", "0.59199584", "0.5919811", "0.5904504", "0.5897263", "0.58962846", "0.58951396", "0.58951396", "0.58951396", "0.58951396", "0.5880124", "0.58690923", "0.5863659", "0.5809161", "0.57735413", "0.5760811", "0.5753559", "0.57492644", "0.5741712", "0.57334286", "0.5726379", "0.57144034", "0.57096", "0.5707689", "0.5705895", "0.5705634", "0.5703902", "0.5696585", "0.5684331", "0.5684331", "0.56780374", "0.5677111", "0.5657287", "0.5648262", "0.5648085", "0.5648012", "0.5640759", "0.5637738", "0.5629985", "0.5619264", "0.56167465", "0.5606877", "0.56021434", "0.5601949", "0.55992156", "0.5598557", "0.55897516", "0.5581397", "0.5566926", "0.5566796", "0.55642897", "0.55641", "0.5556583", "0.5556536", "0.5550097", "0.5543172", "0.55422723", "0.5540013", "0.5540013", "0.55371785", "0.55365825", "0.55300397", "0.552969", "0.55275744", "0.55272335", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.55271083", "0.5525997", "0.5525624", "0.5523911", "0.5521122", "0.5517412" ]
0.0
-1
Obtain Paystack payment information
public function handleGatewayCallback() { $paymentDetails = Paystack::getPaymentData(); //dd($paymentDetails); //dd($paymentDetails['data']['metadata']['Amount']); // dd($paymentDetails['data']['customer']['email']); // Now you have the payment details, // you can store the authorization_code in your db to allow for recurrent subscriptions // you can then redirect or do whatever you want $amount=$paymentDetails['data']['metadata']['Amount']; $satus=$paymentDetails['data']['status']; $reference=$paymentDetails['data']['reference']; $gateway_response=$paymentDetails['data']['gateway_response']; $useremail=$paymentDetails['data']['customer']['email']; $check=$paymentDetails['data']['metadata']['fod']; //dd($check); if($check!=="food"){ $number=$paymentDetails['data']['metadata']['phone']; $email=$useremail; $name=$paymentDetails['data']['metadata']['name']; $rand=rand(100,9999); $getid2=Tickets::where('email', $useremail)->first(); $getid12=User_tickets::where('user_id', $getid2->user_id)->first(); DB::table('user_tickets') ->where('user_id', $getid2->user_id) ->update([ 'amount' =>$amount, 'payment_status' => $satus ]); DB::table('tickets') ->where('user_id', $getid2->user_id) ->update([ 'ticket_id' => $getid12->id ]); // $rand=rand(100,9999); $qrCode=\QrCode::size(500) ->format('png') ->generate($number.'_'.$rand, public_path('qrcode/'.$rand.'_qrcode.png')); $img =public_path().'/qrcode/'.$rand.'_qrcode.png'; //dd($img); // $message = "hello '.$name.' '.$email.' '.$number.' your pick up token is '.$qrCode.' "; //send token via email $data = array('orderID'=>$getid2->user_id,'images'=>$img,'number'=>$number,'ran'=>$rand, 'email' => $email,'fname' => $name,'app_name' => config('app.name'), 'from' => '[email protected]', 'from_name' => 'afrochella'); Mail::send( 'mails.member_token', $data, function($message) use ($data) { $message->to( $data['email'] )->from( $data['from'], $data['fname'] )->subject( 'Welcome!' ); }); }else { $order_id=$paymentDetails['data']['metadata']['order_id']; $number=$paymentDetails['data']['metadata']['phone']; $email=$useremail; $name=$paymentDetails['data']['metadata']['name']; $rand=rand(100,9999); DB::table('foods') ->where('order_id', $order_id) ->update([ 'amount' =>$amount, 'payment_status' => $satus ]); // $rand=rand(100,9999); $qrCode=\QrCode::size(500) ->format('png') ->generate($number.'_'.$rand, public_path('qrcode/'.$rand.'_qrcode.png')); $img =public_path().'/qrcode/'.$rand.'_qrcode.png'; //dd($img); // $message = "hello $name.''.$email.' '.$number.' your pick up token is '.$qrCode.' "; //send token via email $data = array('orderID'=>$order_id,'images'=>$img,'number'=>$number,'ran'=>$rand, 'email' => $email,'fname' => $name,'app_name' => config('app.name'), 'from' => '[email protected]', 'from_name' => 'afrochella'); Mail::send( 'mails.member_token', $data, function($message) use ($data) { $message->to( $data['email'] )->from( $data['from'], $data['fname'] )->subject( 'Welcome!' ); }); } return view('pages.tickets.qrCode')->with('ran',$rand); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function getPaymentInfo()\n {\n $baseUrl = 'http://embeddables.eastus2.cloudapp.azure.com/payment/';\n\n return json_decode(\n file_get_contents(\n $baseUrl . 'payment.json'\n )\n );\n }", "public function getInfoPayment()\n {\n $response = $this->client->request($this->methods['post'],'sandbox', [\n 'json' => [\n 'MERCHANT_TRANS_ID' => $this->merchant_trans_id,\n 'SIGN_TIME' => $this->generateSignTime(),\n 'SIGN_STRING' => md5($this->SECRET_KEY. $this->merchant_trans_id. $this->sign_time)\n ]\n ]);\n\n return json_decode($response->getBody());\n }", "public function getPaymentDetails()\n {\n $ret = $this->response['result']['payment_details'];\n $ret['id'] = $this->getTxnId();\n return $ret;\n }", "public function get_info()\n\t\t{\n\t\t\treturn array(\n\t\t\t\t'name'=>'SecureTrading Xpay',\n\t\t\t\t'description'=>'SecureTrading payment method with payment page hosted on your server.'\n\t\t\t);\n\t\t}", "function payment() {\n\t\t$url = 'https://www.instawallet.org/api/v1/w/' . $wallet_id . '/payment';\n\t\t$json = file_get_contents($url);\n\t\treturn json_decode($json);\n\t}", "public function paymentInfo($id){\n $client = new Client();\n try{\n $paymentInfo = $client->request('GET', \"https://api.sandbox.paypal.com/v1/payments/payment/\" . $id , [\n 'headers' => [\n 'Authorization' => 'Bearer ' . $this->accessKey,\n 'Content-Type' => 'application/json',\n ]\n \n ]);\n }\n catch(\\Exception $ex) {\n $error = json_encode($ex->getMessage());\n return($error);\n }\n $this->parsePaymentBody($paymentInfo);\n return $this->paymentBody;\n }", "function furik_shortcode_payment_info($atts) {\n\t$s = \"\";\n\t$order_ref = \"unknown\";\n\n\tif ($_REQUEST['furik_order_ref'] && furik_order_sign($_REQUEST['furik_order_ref']) == $_REQUEST['furik_check']) {\n\t\t$order_ref = $_REQUEST['furik_order_ref'];\n\t\t$transaction = furik_get_transaction($order_ref);\n\t\t$s .= __('SimplePay reference id', 'furik') . ': ' . $transaction->vendor_ref . \"<br />\";\n\t}\n\n\t$s .= __('Order reference', 'furik') . ': ' . $order_ref . '<br />';\n\t$s .= __('Date', 'furik') . ': ' . date(\"Y-m-d H:i:s\");\n\treturn $s;\n}", "public function getPaymentDescription();", "public function getPayInfo($params)\n {\n }", "public function getPaymentRequest(): string;", "public function get_pay($params) {\n }", "function pay_fields() {\n\t\t// define(APPKEY ,\"2Wozy2aksie1puXUBpWD8oZxiD1DfQuEaiC7KcRATv1Ino3mdopKaPGQQ7TtkNySuAmCaDCrw4xhPY5qKTBl7Fzm0RgR3c0WaVYIXZARsxzHV2x7iwPPzOz94dnwPWSn\"); //paysign key\n\t\t// define(SIGNTYPE, \"sha1\"); //method\n\t\t// define(PARTNERKEY,\"8934e7d15453e97507ef794cf7b0519d\");//通加密串\n\t\t// define(APPSERCERT, \"09cb46090e586c724d52f7ec9e60c9f8\");\n\t\treturn array (\n\t\t\t\t'APPID' => array (\n\t\t\t\t\t\t'title' => 'APPID:',\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'value' => '',\n\t\t\t\t\t\t'tip' => '微信公众号身份的唯一标识。审核通过后,在微信发送的邮件中查看' \n\t\t\t\t),\n\t\t\t\t'MCHID' => array (\n\t\t\t\t\t\t'title' => 'MCHID:',\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'value' => '',\n\t\t\t\t\t\t'tip' => '受理商ID,身份标识' \n\t\t\t\t),\n\t\t\t\t'KEY' => array (\n\t\t\t\t\t\t'title' => 'KEY:',\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'value' => '',\n\t\t\t\t\t\t'tip' => '商户支付密钥Key。审核通过后,在微信发送的邮件中查看' \n\t\t\t\t),\n\t\t\t\t'APPSECRET' => array (\n\t\t\t\t\t\t'title' => 'APPSECRET:',\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'value' => '',\n\t\t\t\t\t\t'tip' => 'JSAPI接口中获取openid,审核后在公众平台开启开发模式后可查看' \n\t\t\t\t),\n\t\t\t\t'NOTIFY_URL' => array (\n\t\t\t\t\t\t'title' => 'NOTIFY_URL:',\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'value' => '',\n\t\t\t\t\t\t'tip' => '异步通知url,商户根据实际开发过程设定' \n\t\t\t\t),\n\t\t\t\t'JS_API_CALL_URL' => array (\n\t\t\t\t\t\t'title' => 'JS_API_CALL_URL:',\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'value' => '',\n\t\t\t\t\t\t'tip' => '获取access_token过程中的跳转uri,通过跳转将code传入jsapi支付页面' \n\t\t\t\t),\n\t\t\t\t'WEIXIN_PAY_UNIT' => array (\n\t\t\t\t\t\t'title' => 'WEIXIN_PAY_UNIT:',\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'value' => '',\n\t\t\t\t\t\t'tip' => '微信支付单位,100为元 ,10为角,1为分' \n\t\t\t\t),\n\t\t\t\t'SUCCESS_URL' => array (\n\t\t\t\t\t\t'title' => 'SUCCESS_URL:',\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'value' => '',\n\t\t\t\t\t\t'tip' => '支付成功跳转页面' \n\t\t\t\t),\n\t\t);\n\t}", "function onPaymentInfo() {\n\t\tif (empty($this->_info)) {\n\t\t\t$this->_info = array(\n\t\t\t\t'code'\t\t=> 'jahanpay',\t\t\t\t\t\t\t// Code to separate payment plugin\n\t\t\t\t'name'\t\t=> JText::_('Jahanpay'),\t\t\t\t\t// Name to display of payment method\n\t\t\t\t'image'\t\t=> $this->params->get('payment_image'),\t// Image to display of payment method\n\t\t\t\t'use_cc'\t=> 0,\t\t\t\t\t\t\t\t\t// Use credit card or not?\n\t\t\t);\n\t\t}\n\n\t\treturn $this->_info;\n\t}", "function public_payment_info() {\n if (!$this->request->isAsyncCall()) {\n $this->response->badRequest();\n } // if\n if ($this->active_invoice->isNew()) {\n $this->response->notFound();\n } // if\n\n }", "function spgateway_credit_MetaData() {\n return array(\n 'DisplayName' => 'spgateway - 信用卡',\n 'APIVersion' => '1.1', // Use API Version 1.1\n 'DisableLocalCredtCardInput' => false,\n 'TokenisedStorage' => false,\n );\n}", "public function get_pay()\n {\n// $core->toPay();\n $pay = new \\Wxpay\\Weixinpay();\n $order = array(\n 'body' => 'test',\n 'total_fee' => 1,\n 'out_trade_no' => strval(time()),\n 'product_id' => 1\n );\n $pay->pay($order);\n\n }", "public function processPayment();", "public function getMicroPaymentPayabale()\r\n {\r\n /**\r\n * if\r\n */\r\n }", "public function getPayment()\n {\n return $this->payment;\n }", "public function getPayment()\n {\n return $this->payment;\n }", "public function getPayment()\n {\n return $this->payment;\n }", "public function getPayerInfo()\n {\n return $this->payer_info;\n }", "function take_payment_details()\r\n\t\t{\r\n\t\t\tglobal $ecom_siteid,$db,$ecom_hostname,$Settings_arr,$ecom_themeid,$default_layout,\r\n\t\t\t\t\t$Captions_arr,$inlineSiteComponents,$sitesel_curr,$default_Currency_arr,$ecom_testing,\r\n\t\t\t\t\t$ecom_themename,$components,$ecom_common_settings,$vImage,$alert,$protectedUrl;\r\n\t\t\t$customer_id \t\t\t\t\t\t= get_session_var(\"ecom_login_customer\"); // get the id of current customer from session\r\n\t\t\t\r\n if($_REQUEST['pret']==1) // case if coming back from PAYPAL with token.\r\n {\r\n if($_REQUEST['token'])\r\n {\r\n $address = GetShippingDetails($_REQUEST['token']);\r\n $ack = strtoupper($address[\"ACK\"]);\r\n if($ack == \"SUCCESS\" ) // case if address details obtained correctly\r\n {\r\n $_REQUEST['payer_id'] = $address['PAYERID'];\r\n $_REQUEST['rt'] = 5;\r\n }\r\n else // case if address not obtained from paypay .. so show the error msg in cart\r\n {\r\n $msg = 4;\r\n echo \"<form method='post' action='http://$ecom_hostname/mypayonaccountpayment.html' id='cart_invalid_form' name='cart_invalid_form'><input type='hidden' name='rt' value='\".$msg.\"' size='1'/><div style='position:absolute; left:0;top:0;padding:5px;background-color:#CC0000;color:#FFFFFF;font-size:12px;font-weight:bold'>Loading...</div></form><script type='text/javascript'>document.cart_invalid_form.submit();</script>\";\r\n exit;\r\n }\r\n } \r\n }\r\n // Get the zip code for current customer\r\n\t\t\t$sql_cust = \"SELECT customer_postcode \r\n\t\t\t\t\t\t\t\tFROM \r\n\t\t\t\t\t\t\t\t\tcustomers \r\n\t\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\t\tcustomer_id = $customer_id \r\n\t\t\t\t\t\t\t\t\tAND sites_site_id = $ecom_siteid \r\n\t\t\t\t\t\t\t\tLIMIT \r\n\t\t\t\t\t\t\t\t\t1\";\r\n\t\t\t$ret_cust = $db->query($sql_cust);\r\n\t\t\tif ($db->num_rows($ret_cust))\r\n\t\t\t{\r\n\t\t\t\t$row_cust \t\t\t\t\t= $db->fetch_array($ret_cust);\r\n\t\t\t\t$cust_zipcode\t\t\t\t= stripslashes($row_cust['customer_postcode']);\r\n\t\t\t}\t\r\n\t\t\t$Captions_arr['PAYONACC'] \t= getCaptions('PAYONACC'); // Getting the captions to be used in this page\r\n\t\t\t$sess_id\t\t\t\t\t\t\t\t= session_id();\r\n\t\t\t\r\n\t\t\tif($protectedUrl)\r\n\t\t\t\t$http = url_protected('index.php?req=payonaccountdetails&action_purpose=payment',1);\r\n\t\t\telse \t\r\n\t\t\t\t$http = url_link('payonaccountpayment.html',1);\t\r\n\t\t\t\r\n\t\t\t// Get the details from payonaccount_cartvalues for current site in current session \r\n\t\t\t$pay_cart = payonaccount_CartDetails($sess_id);\t\t\t\t\t\t\t\r\n\t\t\tif($_REQUEST['rt']==1) // This is to handle the case of returning to this page by clicking the back button in browser\r\n\t\t\t\t$alert = 'PAYON_ERROR_OCCURED';\t\t\t\r\n\t\t\telseif($_REQUEST['rt']==2) // case of image verification failed\r\n\t\t\t\t$alert = 'PAYON_IMAGE_VERIFICATION_FAILED';\r\n elseif($_REQUEST['rt']==3) // case of image verification failed\r\n $alert = 'PAYON_IMAGE_VERIFICATION_FAILED';\r\n\t\t\telseif($_REQUEST['rt']==4) // case if paypal address verification failed\r\n $alert = 'PAYON_PAYPAL_EXP_NO_ADDRESS_RET';\r\n elseif($_REQUEST['rt']==5) // case if paypal address verification successfull need to click pay to make the payment \r\n $alert = 'PAYON_PAYPAL_EXP_ADDRESS_DON';\r\n\t\t\t$sql_comp \t\t\t= \"SELECT customer_title,customer_fname,customer_mname,customer_surname,customer_email_7503,\r\n\t\t\t\t\t\t\t\t\t\tcustomer_payonaccount_status,customer_payonaccount_maxlimit,customer_payonaccount_usedlimit,\r\n\t\t\t\t\t\t\t\t\t\t(customer_payonaccount_maxlimit - customer_payonaccount_usedlimit) as remaining,\r\n\t\t\t\t\t\t\t\t\t\tcustomer_payonaccount_billcycle_day,customer_payonaccount_rejectreason,customer_payonaccount_laststatementdate,\r\n\t\t\t\t\t\t\t\t\t\tcustomer_payonaccount_billcycle_day \r\n\t\t\t\t\t\t\t\t\tFROM \r\n\t\t\t\t\t\t\t\t\t\tcustomers \r\n\t\t\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\t\t\tcustomer_id = $customer_id \r\n\t\t\t\t\t\t\t\t\t\tAND sites_site_id = $ecom_siteid \r\n\t\t\t\t\t\t\t\t\tLIMIT \r\n\t\t\t\t\t\t\t\t\t\t1\";\r\n\t\t\t$ret_cust = $db->query($sql_comp);\r\n\t\t\tif ($db->num_rows($ret_cust)==0)\r\n\t\t\t{\t\r\n\t\t\t\techo \"Sorry!! Invalid input\";\r\n\t\t\t\texit;\r\n\t\t\t}\t\r\n\t\t\t$row_cust \t\t= $db->fetch_array($ret_cust);\r\n\t\t\t// Getting the previous outstanding details from orders_payonaccount_details \r\n\t\t\t$sql_payonaccount = \"SELECT pay_id,pay_date,pay_amount \r\n\t\t\t\t\t\t\t\t\t\t\t\tFROM \r\n\t\t\t\t\t\t\t\t\t\t\t\t\torder_payonaccount_details \r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\t\t\t\t\t\tcustomers_customer_id = $customer_id \r\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND pay_transaction_type ='O' \r\n\t\t\t\t\t\t\t\t\t\t\t\tORDER BY \r\n\t\t\t\t\t\t\t\t\t\t\t\t\tpay_id DESC \r\n\t\t\t\t\t\t\t\t\t\t\t\tLIMIT \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t1\";\r\n\t\t\t$ret_payonaccount = $db->query($sql_payonaccount);\r\n\t\t\tif ($db->num_rows($ret_payonaccount))\r\n\t\t\t{\r\n\t\t\t\t$row_payonaccount \t= $db->fetch_array($ret_payonaccount);\r\n\t\t\t\t$prev_balance\t\t\t\t= $row_payonaccount['pay_amount'];\r\n\t\t\t\t$prev_id\t\t\t\t\t\t= $row_payonaccount['pay_id'];\r\n\t\t\t\t$prev_date\t\t\t\t\t= $row_payonaccount['pay_date'];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t$prev_balance\t\t\t\t= 0;\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t$prev_id\t\t\t\t\t\t= 0;\r\n\t\t\t}\t\r\n\t\t\t\r\n\t\t\t$paying_amt \t\t= ($_REQUEST['pay_amt'])?$_REQUEST['pay_amt']:$pay_cart['pay_amount'];\r\n\t\t\t$additional_det\t= ($_REQUEST['pay_additional_details'])?$_REQUEST['pay_additional_details']:$pay_cart['pay_additional_details'];\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t // Check whether google checkout is required\r\n\t\t\t$sql_google = \"SELECT a.paymethod_id,a.paymethod_name,a.paymethod_key,\r\n\t\t\t\t\t\t\t\t\t\t a.paymethod_takecarddetails,a.payment_minvalue,\r\n\t\t\t\t\t\t\t\t\t\t b.payment_method_sites_caption \r\n\t\t\t\t\t\t\t\t\tFROM \r\n\t\t\t\t\t\t\t\t\t\tpayment_methods a,\r\n\t\t\t\t\t\t\t\t\t\tpayment_methods_forsites b \r\n\t\t\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\t\t\ta.paymethod_id=b.payment_methods_paymethod_id \r\n\t\t\t\t\t\t\t\t\t\tAND a.paymethod_showinpayoncredit=1 \r\n\t\t\t\t\t\t\t\t\t\tAND sites_site_id = $ecom_siteid \r\n\t\t\t\t\t\t\t\t\t\tAND b.payment_method_sites_active = 1 \r\n\t\t\t\t\t\t\t\t\t\tAND paymethod_key='GOOGLE_CHECKOUT' \r\n\t\t\t\t\t\t\t\t\tLIMIT \r\n\t\t\t\t\t\t\t\t\t\t1\";\r\n\t\t\t$ret_google = $db->query($sql_google);\r\n\t\t\tif($db->num_rows($ret_google))\r\n\t\t\t{\r\n\t\t\t\t$google_exists = true;\r\n\t\t\t}\r\n\t\t\telse \t\r\n\t\t\t\t$google_exists = false;\r\n\t\t\t// Check whether google checkout is set for current site\r\n\t\t\tif($ecom_common_settings['paymethodKey']['GOOGLE_CHECKOUT']['paymethod_key'] == \"GOOGLE_CHECKOUT\")\r\n\t\t\t{\r\n\t\t\t\t$google_prev_req \t\t= $ecom_common_settings['paymethodKey']['GOOGLE_CHECKOUT']['payment_method_preview_req'];\r\n\t\t\t\t$google_recommended\t\t= $ecom_common_settings['paymethodKey']['GOOGLE_CHECKOUT']['payment_method_google_recommended'];\r\n\t\t\t\tif($google_recommended ==0) // case if google checkout is set to work in the way google recommend\r\n\t\t\t\t\t$more_pay_condition = \" AND paymethod_key<>'GOOGLE_CHECKOUT' \";\r\n\t\t\t\telse\r\n\t\t\t\t\t$more_pay_condition = '';\r\n\t\t\t}\r\n\t\t\t$sql_paymethods = \"SELECT a.paymethod_id,a.paymethod_name,a.paymethod_key,\r\n a.paymethod_takecarddetails,a.payment_minvalue,a.paymethod_ssl_imagelink,\r\n b.payment_method_sites_caption \r\n FROM \r\n payment_methods a,\r\n payment_methods_forsites b \r\n WHERE \r\n a.paymethod_id=b.payment_methods_paymethod_id \r\n AND a.paymethod_showinpayoncredit = 1 \r\n AND b.payment_method_sites_active = 1 \r\n $more_pay_condition \r\n AND b.sites_site_id=$ecom_siteid \r\n AND a.paymethod_key<>'PAYPAL_EXPRESS'\";\r\n\t\t\t$ret_paymethods = $db->query($sql_paymethods);\r\n\t\t\t$totpaycnt = $totpaymethodcnt = $db->num_rows($ret_paymethods);\t\t\t\r\n\t\t\tif ($totpaycnt==0)\r\n\t\t\t{\r\n\t\t\t\t$paytype_moreadd_condition = \" AND a.paytype_code <> 'credit_card'\";\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\t$paytype_moreadd_condition = '';\r\n\t\t\t$cc_exists \t\t\t= 0;\r\n\t\t\t$cc_seq_req \t\t= check_Paymethod_SSL_Req_Status('payonaccount');\r\n\t\t\t$sql_paytypes \t= \"SELECT a.paytype_code,b.paytype_forsites_id,a.paytype_id,a.paytype_name,b.images_image_id,\r\n\t\t\t\t\t\t\t\tb.paytype_caption \r\n\t\t\t\t\t\t\t\t\t\tFROM \r\n\t\t\t\t\t\t\t\t\t\t\tpayment_types a, payment_types_forsites b \r\n\t\t\t\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\t\t\t\tb.sites_site_id = $ecom_siteid \r\n\t\t\t\t\t\t\t\t\t\t\tAND paytype_forsites_active=1 \r\n\t\t\t\t\t\t\t\t\t\t\tAND paytype_forsites_userdisabled=0 \r\n\t\t\t\t\t\t\t\t\t\t\tAND a.paytype_id=b.paytype_id \r\n\t\t\t\t\t\t\t\t\t\t\tAND a.paytype_showinpayoncredit=1 \r\n\t\t\t\t\t\t\t\t\t\t\t$paytype_moreadd_condition \r\n\t\t\t\t\t\t\t\t\t\tORDER BY \r\n\t\t\t\t\t\t\t\t\t\t\ta.paytype_order\";\r\n\t\t\t$ret_paytypes = $db->query($sql_paytypes);\r\n\t\t\t$paytypes_cnt = $db->num_rows($ret_paytypes);\t\r\n\t\t\tif($paytypes_cnt==1 && $totpaymethodcnt>=1)\r\n\t\t\t\t$card_req = 1;\r\n\t\t\telse\r\n\t\t\t\t$card_req = '';\t\t\t\r\n\t\t?>\r\n\t\t<script type=\"text/javascript\">\r\n\t\t/* Function to be triggered when selecting the credit card type*/\r\nfunction sel_credit_card_payonaccount(obj)\r\n{\r\n\tif (obj.value!='')\r\n\t{\r\n\t\tobjarr = obj.value.split('_');\r\n\t\tif(objarr.length==4) /* if the value splitted to exactly 4 elements*/\r\n\t\t{\r\n\t\t\tvar key \t\t\t= objarr[0];\r\n\t\t\tvar issuereq \t= objarr[1];\r\n\t\t\tvar seccount \t= objarr[2];\r\n\t\t\tvar cc_count \t= objarr[3];\r\n\t\t\tif (issuereq==1)\r\n\t\t\t{\r\n\t\t\t\tdocument.frm_payonaccount_payment.checkoutpay_issuenumber.className = 'inputissue_normal';\r\n\t\t\t\tdocument.frm_payonaccount_payment.checkoutpay_issuenumber.disabled\t= false;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tdocument.frm_payonaccount_payment.checkoutpay_issuenumber.className = 'inputissue_disabled';\t\r\n\t\t\t\tdocument.frm_payonaccount_payment.checkoutpay_issuenumber.disabled\t= true;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\nfunction handle_paytypeselect_payonaccount(obj)\r\n{\r\n\tvar curpaytype = paytype_arr[obj.value];\r\n\tvar ptypecnts = <?php echo $totpaycnt?>;\r\n\tif (curpaytype=='credit_card')\r\n\t{\r\n\t\tif(document.getElementById('payonaccount_paymethod_tr'))\r\n\t\t\tdocument.getElementById('payonaccount_paymethod_tr').style.display = '';\t\r\n\t\tif(document.getElementById('payonaccount_cheque_tr'))\r\n\t\t\tdocument.getElementById('payonaccount_cheque_tr').style.display = 'none';\t\r\n\t\tif(document.getElementById('payonaccount_self_tr'))\r\n\t\t\tdocument.getElementById('payonaccount_self_tr').style.display = 'none';\r\n\t\tif(document.getElementById('paymentmethod_req'))\r\n\t\t\tdocument.getElementById('paymentmethod_req').value = 1;\r\n\t\tif (document.getElementById('payonaccount_paymethod'))\r\n\t\t{\r\n\t\t\tvar lens = document.getElementById('payonaccount_paymethod').length;\t\r\n\t\t\tif(lens==undefined && ptypecnts==1)\r\n\t\t\t{\r\n\t\t\t\tvar curval\t = document.getElementById('payonaccount_paymethod').value;\r\n\t\t\t\tcur_arr \t\t= curval.split('_');\r\n\t\t\t\tif ((cur_arr[0]=='SELF' || cur_arr[0]=='PROTX') && cur_arr.length<=2)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(document.getElementById('payonaccount_cheque_tr'))\r\n\t\t\t\t\t\tdocument.getElementById('payonaccount_cheque_tr').style.display = 'none';\r\n\t\t\t\t\tif(document.getElementById('payonaccount_self_tr'))\r\n\t\t\t\t\t\tdocument.getElementById('payonaccount_self_tr').style.display \t= '';\t\t\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif(document.getElementById('payonaccount_self_tr'))\r\n\t\t\t\t\t\tdocument.getElementById('payonaccount_self_tr').style.display \t= 'none';\r\n\t\t\t\t}\t\r\n\t\t\t}\t\r\n\t\t}\t\r\n\t}\r\n\telse if(curpaytype=='cheque')\r\n\t{\r\n\t\tif(document.getElementById('payonaccount_paymethod_tr'))\r\n\t\t\tdocument.getElementById('payonaccount_paymethod_tr').style.display = 'none';\t\t\r\n\t\tif(document.getElementById('payonaccount_cheque_tr'))\r\n\t\t\tdocument.getElementById('payonaccount_cheque_tr').style.display = '';\t\r\n\t\tif(document.getElementById('payonaccount_self_tr'))\r\n\t\t\tdocument.getElementById('payonaccount_self_tr').style.display = 'none';\t\r\n\t\tif(document.getElementById('paymentmethod_req'))\r\n\t\t\tdocument.getElementById('paymentmethod_req').value = '';\r\n\t}\r\n\telse if(curpaytype=='invoice')\r\n\t{\r\n\t\tif(document.getElementById('payonaccount_paymethod_tr'))\r\n\t\t\tdocument.getElementById('payonaccount_paymethod_tr').style.display = 'none';\t\t\r\n\t\tif(document.getElementById('payonaccount_cheque_tr'))\r\n\t\t\tdocument.getElementById('payonaccount_cheque_tr').style.display = 'none';\r\n\t\tif(document.getElementById('payonaccount_self_tr'))\r\n\t\t\tdocument.getElementById('payonaccount_self_tr').style.display = 'none';\r\n\t\tif(document.getElementById('paymentmethod_req'))\r\n\t\t\tdocument.getElementById('paymentmethod_req').value = '';\r\n\t}\r\n\telse if(curpaytype=='pay_on_phone')\r\n\t{\r\n\t\tif(document.getElementById('payonaccount_paymethod_tr'))\r\n\t\t\tdocument.getElementById('payonaccount_paymethod_tr').style.display = 'none';\t\t\r\n\t\tif(document.getElementById('payonaccount_cheque_tr'))\r\n\t\t\tdocument.getElementById('payonaccount_cheque_tr').style.display = 'none';\r\n\t\tif(document.getElementById('payonaccount_self_tr'))\r\n\t\t\tdocument.getElementById('payonaccount_self_tr').style.display = 'none';\r\n\t\tif(document.getElementById('paymentmethod_req'))\r\n\t\t\tdocument.getElementById('paymentmethod_req').value = '';\r\n\t}\r\n\telse \r\n\t{\r\n\t\tcur_arr = obj.value.split('_');\r\n\t\tif ((cur_arr[0]=='SELF' || cur_arr[0]=='PROTX') && cur_arr.length<=2)\r\n\t\t{\r\n\t\t\tif(document.getElementById('payonaccount_cheque_tr'))\r\n\t\t\t\tdocument.getElementById('payonaccount_cheque_tr').style.display = 'none';\r\n\t\t\tif(document.getElementById('payonaccount_self_tr'))\r\n\t\t\t\tdocument.getElementById('payonaccount_self_tr').style.display \t= '';\t\t\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(document.getElementById('payonaccount_self_tr'))\r\n\t\t\t\tdocument.getElementById('payonaccount_self_tr').style.display \t= 'none';\r\n\t\t}\t\r\n\t}\r\n}\r\n</script>\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t<div class=\"treemenu\"><a href=\"<? url_link('');?>\"><?=$Captions_arr['COMMON']['TREE_MENU_HOME_LINK'];?></a> >> <?=\"Pay on Account Payment\"?></div>\r\n\t\t\r\n\t\t\t<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"3\" class=\"emailfriendtable\">\r\n\t\t\t<form method=\"post\" action=\"<?php echo $http?>\" name='frm_payonaccount_payment' id=\"frm_payonaccount_payment\" class=\"frm_cls\" onsubmit=\"return validate_payonaccount(this)\">\r\n\t\t\t<input type=\"hidden\" name=\"paymentmethod_req\" id=\"paymentmethod_req\" value=\"<?php echo $card_req?>\" />\r\n\t\t\t<input type=\"hidden\" name=\"payonaccount_unique_key\" id=\"payonaccount_unique_key\" value=\"<?php echo uniqid('')?>\" />\r\n\t\t\t<input type=\"hidden\" name=\"save_payondetails\" id=\"save_payondetails\" value=\"\" />\r\n\t\t\t<input type=\"hidden\" name=\"nrm\" id=\"nrm\" value=\"1\" />\r\n\t\t\t<input type=\"hidden\" name=\"action_purpose\" id=\"action_purpose\" value=\"buy\" />\r\n\t\t\t<input type=\"hidden\" name=\"checkout_zipcode\" id=\"checkout_zipcode\" value=\"<?php echo $cust_zipcode?>\" />\r\n\t\t\t<?php \r\n\t\t\tif($alert){ \r\n\t\t\t?>\r\n\t\t\t<tr>\r\n\t\t\t\t<td colspan=\"4\" class=\"errormsg\" align=\"center\">\r\n\t\t\t\t<?php \r\n\t\t\t\t\t\tif($Captions_arr['PAYONACC'][$alert])\r\n\t\t\t\t\t\t\techo $Captions_arr['PAYONACC'][$alert];\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t \t\techo $alert;\r\n\t\t\t\t?>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t<?php } ?>\r\n <tr>\r\n <td colspan=\"4\" class=\"emailfriendtextheader\"><?=$Captions_arr['EMAIL_A_FRIEND']['EMAIL_FRIEND_HEADER_TEXT']?> </td>\r\n </tr>\r\n <tr>\r\n <td width=\"33%\" align=\"left\" class=\"regiconent\"><?php echo $Captions_arr['PAYONACC']['CURRENTACC_BALANCE']?> </td>\r\n <td width=\"22%\" align=\"left\" class=\"regiconent\">:<?php echo print_price($row_cust['customer_payonaccount_usedlimit'])?> </td>\r\n <td width=\"27%\" align=\"left\" class=\"regiconent\"><?php echo $Captions_arr['PAYONACC']['CREDIT_LIMIT']?></td>\r\n <td width=\"18%\" align=\"left\" class=\"regiconent\">:<?php echo print_price($row_cust['customer_payonaccount_maxlimit'])?> </td>\r\n </tr>\r\n <tr>\r\n <td align=\"left\" class=\"regiconent\"><?php echo $Captions_arr['PAYONACC']['LAST_STATE_BALANCE']?> </td>\r\n <td align=\"left\" class=\"regiconent\">:<?php echo print_price($prev_balance)?> </td>\r\n <td align=\"left\" class=\"regiconent\"><?php echo $Captions_arr['PAYONACC']['CREDIT_REMAINING']?> </td>\r\n <td align=\"left\" class=\"regiconent\">: <?php echo print_price(($row_cust['customer_payonaccount_maxlimit']-$row_cust['customer_payonaccount_usedlimit']))?></td>\r\n </tr>\r\n <tr>\r\n <td align=\"left\" class=\"regiconent\">&nbsp;</td>\r\n <td align=\"left\" class=\"regiconent\">&nbsp;</td>\r\n <td align=\"left\" class=\"regiconent\">&nbsp;</td>\r\n <td align=\"left\" class=\"regiconent\">&nbsp;</td>\r\n </tr>\r\n <tr>\r\n <td align=\"left\" class=\"regiconent\"><?php echo $Captions_arr['PAYONACC']['AMT_BEING_PAID']?> </td>\r\n <td align=\"left\" class=\"regiconent\">: <?php echo get_selected_currency_symbol()?><?php echo $paying_amt?> <input name=\"pay_amt\" id=\"pay_amt\" type=\"hidden\" size=\"10\" value=\"<?php echo $paying_amt?>\" /></td>\r\n <td align=\"left\" class=\"regiconent\">&nbsp;</td>\r\n <td align=\"left\" class=\"regiconent\">&nbsp;</td>\r\n </tr>\r\n <?php\r\n \tif($additional_det!='')\r\n\t{\r\n ?>\r\n\t\t<tr>\r\n\t\t<td align=\"left\" class=\"regiconent\" valign=\"top\"><?php echo $Captions_arr['PAYONACC']['ADDITIONAL_DETAILS']?> </td>\r\n\t\t<td align=\"left\" class=\"regiconent\">: <?php echo nl2br($additional_det)?> <input name=\"pay_additional_details\" id=\"pay_additional_details\" type=\"hidden\" value=\"<?php echo $additional_det?>\" /></td>\r\n\t\t<td align=\"left\" class=\"regiconent\">&nbsp;</td>\r\n\t\t<td align=\"left\" class=\"regiconent\">&nbsp;</td>\r\n\t </tr>\r\n <?php\r\n }\r\n ?>\r\n <tr>\r\n <td colspan=\"4\" align=\"center\" class=\"regiconent\">&nbsp;</td>\r\n </tr>\r\n\t <? if($Settings_arr['imageverification_req_payonaccount'] and $_REQUEST['pret']!=1)\r\n\t \t {\r\n\t ?>\r\n <tr>\r\n <td colspan=\"4\" align=\"center\" class=\"emailfriendtextnormal\"><img src=\"<?php url_verification_image('includes/vimg.php?size=4&pass_vname=payonaccountpayment_Vimg')?>\" border=\"0\" alt=\"Image Verification\"/>&nbsp;\t</td>\r\n </tr>\r\n <tr>\r\n <td colspan=\"6\" align=\"center\" class=\"emailfriendtextnormal\"><?=$Captions_arr['PAYONACC']['PAYON_VERIFICATION_CODE']?>&nbsp;<span class=\"redtext\">*</span><span class=\"emailfriendtext\">\r\n\t <?php \r\n\t\t// showing the textbox to enter the image verification code\r\n\t\t$vImage->showCodBox(1,'payonaccountpayment_Vimg','class=\"inputA_imgver\"'); \r\n\t?>\r\n\t</span> </td>\r\n </tr>\r\n <? }?>\r\n <?php\r\n \tif($google_exists && $Captions_arr['PAYONACC'] ['PAYON_PAYMENT_MULTIPLE_MSG'] && google_recommended==0 && $totpaymethodcnt>1 && $_REQUEST['pret']!=1)\r\n\t{\t\r\n ?>\r\n <tr>\r\n \t<td colspan=\"4\" align=\"left\" class=\"google_header_text\"><?php echo $Captions_arr['PAYONACC'] ['PAYON_PAYMENT_MULTIPLE_MSG']?>\r\n \t</td>\r\n </tr>\r\n <?php\r\n }\r\n ?> \r\n <tr>\r\n <td colspan=\"4\">\r\n <table width=\"100%\" cellpadding=\"1\" cellspacing=\"1\" border=\"0\">\r\n <?php\r\nif($_REQUEST['pret']!=1)\r\n{\r\n?>\r\n \r\n <tr>\r\n <td colspan=\"2\">\r\n\t\t\t<?php\r\n\t\t\t\tif ($db->num_rows($ret_paytypes))\r\n\t\t\t\t{\r\n\t\t\t\t\tif($db->num_rows($ret_paytypes)==1 && $totpaymethodcnt<=1)// Check whether there are more than 1 payment type. If no then dont show the payment option to user, just use hidden field\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\techo '<script type=\"text/javascript\">\r\n\t\t\t\t\t\t\tpaytype_arr = new Array();\t\t\r\n\t\t\t\t\t\t\t\t</script>';\r\n\t\t\t\t\t\t$row_paytypes = $db->fetch_array($ret_paytypes);\r\n\t\t\t\t\t\techo '<script type=\"text/javascript\">';\r\n\t\t\t\t\t\techo \"paytype_arr[\".$row_paytypes['paytype_id'].\"] = '\".$row_paytypes['paytype_code'].\"';\";\r\n\t\t\t\t\t\techo '</script>';\r\n\t\t\t\t\t\tif($row_paytypes['paytype_code']=='credit_card')\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t//if($row_paytypes['paytype_id']==$row_cartdet['paytype_id'])\r\n\t\t\t\t\t\t\t\t$cc_exists = true;\r\n\t\t\t\t\t\t}\t\r\n\t\t\t\t\t\t$single_curtype = $row_paytypes['paytype_code'];\r\n\t\t\t\t\t?>\r\n\t\t\t\t\t\t<input type=\"hidden\" name=\"payonaccount_paytype\" id=\"payonaccount_paytype\" value=\"<?php echo $row_paytypes['paytype_id']?>\" />\r\n\t\t\t\t\t<?php\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\r\n\t\t\t\t\t\t\t$pay_maxcnt = 2;\r\n\t\t\t\t\t\t\t$pay_cnt\t= 0;\r\n\t\t\t\t\t?>\r\n\t\t\t\t\t\t\t <div class=\"shoppaymentdiv\">\r\n\t\t\t\t\t\t\t\t<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n\t\t\t\t\t\t\t\t <tr>\r\n\t\t\t\t\t\t\t\t\t<td colspan=\"<?php echo $pay_maxcnt?>\" class=\"cart_payment_header\"><?php echo $Captions_arr['PAYONACC']['PAYON_SEL_PAYTYPE']?></td>\r\n\t\t\t\t\t\t\t\t </tr>\r\n\t\t\t\t\t\t\t\t <tr>\r\n\t\t\t\t\t\t\t\t <?php\r\n\t\t\t\t\t\t\t\t\techo '<script type=\"text/javascript\">\r\n\t\t\t\t\t\t\t\t\t\t\tpaytype_arr = new Array();\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t</script>';\r\n\t\t\t\t\t\t\t\t\twhile ($row_paytypes = $db->fetch_array($ret_paytypes))\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tif($row_paytypes['paytype_code']=='credit_card')\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\tif($row_paytypes['paytype_id']==$row_cartdet['paytype_id'])\r\n\t\t\t\t\t\t\t\t\t\t\t\t$cc_exists = true;\r\n\t\t\t\t\t\t\t\t\t\t\tif (($protectedUrl==true and $cc_seq_req==false) or ($protectedUrl==false and $cc_seq_req==true))\r\n\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t$paytype_onclick = \"handle_form_submit(document.frm_payonaccount_payment,'','')\";\t\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t\t\t$paytype_onclick = 'handle_paytypeselect_payonaccount(this)';\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t}\t\r\n\t\t\t\t\t\t\t\t\t\telse // if pay type is not credit card.\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\tif ($protectedUrl==true)\r\n\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t$paytype_onclick = \"handle_form_submit(document.frm_payonaccount_payment,'','')\";\t\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t\t\t$paytype_onclick = 'handle_paytypeselect_payonaccount(this)';\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\techo '<script type=\"text/javascript\">';\r\n\t\t\t\t\t\t\t\t\t\techo \"paytype_arr[\".$row_paytypes['paytype_id'].\"] = '\".$row_paytypes['paytype_code'].\"';\";\r\n\t\t\t\t\t\t\t\t\t\techo '</script>';\r\n\t\t\t\t\t\t\t\t ?>\r\n\t\t\t\t\t\t\t\t\t\t<td width=\"25%\" align=\"left\" class=\"emailfriendtextnormal\">\r\n\t\t\t\t\t\t\t\t\t\t<?php\r\n\t\t\t\t\t\t\t\t\t\t\t// image to shown for payment types\r\n\t\t\t\t\t\t\t\t\t\t\t$pass_type = 'image_thumbpath';\r\n\t\t\t\t\t\t\t\t\t\t\t// Calling the function to get the image to be shown\r\n\t\t\t\t\t\t\t\t\t\t\t$img_arr = get_imagelist('paytype',$row_paytypes['paytype_forsites_id'],$pass_type,0,0,1);\r\n\t\t\t\t\t\t\t\t\t\t\tif(count($img_arr))\r\n\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\tshow_image(url_root_image($img_arr[0][$pass_type],1),$row_paytypes['paytype_name'],$row_paytypes['paytype_name']);\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t?>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<img src=\"<?php url_site_image('cash.gif')?>\" alt=\"Payment Type\"/>\r\n\t\t\t\t\t\t\t\t\t\t\t<?php\t\r\n\t\t\t\t\t\t\t\t\t\t\t}\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t?>\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t<input class=\"shoppingcart_radio\" type=\"radio\" name=\"payonaccount_paytype\" id=\"payonaccount_paytype\" value=\"<?php echo $row_paytypes['paytype_id']?>\" onclick=\"<?php echo $paytype_onclick?>\" <?php echo ($_REQUEST['payonaccount_paytype']==$row_paytypes['paytype_id'])?'checked=\"checked\"':''?> /><?php echo stripslashes($row_paytypes['paytype_caption'])?>\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t<?php\r\n\t\t\t\t\t\t\t\t\t\t$pay_cnt++;\r\n\t\t\t\t\t\t\t\t\t\tif ($pay_cnt>=$pay_maxcnt)\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\techo \"</tr><tr>\";\r\n\t\t\t\t\t\t\t\t\t\t\t$pay_cnt = 0;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tif ($pay_cnt<$pay_maxcnt)\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\techo \"<td colspan=\".($pay_maxcnt-$pay_cnt).\">&nbsp;</td>\";\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t?>\t\r\n\t\t\t\t\t\t\t\t </tr>\r\n\t\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t<?php\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t?>\t\t</td>\r\n </tr>\r\n \t<?php \r\n\t$self_disp = 'none';\r\n\tif($_REQUEST['payonaccount_paytype'])\r\n\t{\r\n\t\t// get the paytype code for current paytype\r\n\t\t$sql_pcode = \"SELECT paytype_code \r\n\t\t\t\t\t\t\t\tFROM \r\n\t\t\t\t\t\t\t\t\tpayment_types \r\n\t\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\t\tpaytype_id = \".$_REQUEST['payonaccount_paytype'].\" \r\n\t\t\t\t\t\t\t\tLIMIT \r\n\t\t\t\t\t\t\t\t\t1\";\r\n\t\t$ret_pcode = $db->query($sql_pcode);\r\n\t\tif ($db->num_rows($ret_pcode))\r\n\t\t{\r\n\t\t\t$row_pcode \t= $db->fetch_array($ret_pcode);\r\n\t\t\t$sel_ptype \t= $row_pcode['paytype_code'];\r\n\t\t}\r\n\t}\r\n\tif($sel_ptype=='credit_card' or $single_curtype=='credit_card')\r\n\t\t$paymethoddisp_none = '';\r\n\telse\r\n\t\t$paymethoddisp_none = 'none';\r\n\tif($sel_ptype=='cheque')\r\n\t\t$chequedisp_none = '';\r\n\telse\r\n\t\t$chequedisp_none = 'none';\t\r\n\t$sql_paymethods = \"SELECT a.paymethod_id,a.paymethod_name,a.paymethod_key,\r\n a.paymethod_takecarddetails,a.payment_minvalue,a.paymethod_secured_req,a.paymethod_ssl_imagelink,\r\n b.payment_method_sites_caption \r\n FROM \r\n payment_methods a,\r\n payment_methods_forsites b \r\n WHERE \r\n b.sites_site_id = $ecom_siteid \r\n AND paymethod_showinpayoncredit =1 \r\n AND b.payment_method_sites_active = 1 \r\n $more_pay_condition \r\n AND a.paymethod_id=b.payment_methods_paymethod_id \r\n AND a.paymethod_key<>'PAYPAL_EXPRESS'\";\r\n\t$ret_paymethods = $db->query($sql_paymethods);\r\n\tif ($db->num_rows($ret_paymethods))\r\n\t{\r\n\t\tif ($db->num_rows($ret_paymethods)==1)\r\n\t\t{\r\n\t\t\t$row_paymethods = $db->fetch_array($ret_paymethods);\r\n\t\t\tif ($row_paymethods['paymethod_key']=='SELF' or $row_paymethods['paymethod_key']=='PROTX')\r\n\t\t\t{\r\n\t\t\t\tif($paytypes_cnt==1 or $sel_ptype =='credit_card')\r\n\t\t\t\t\t$self_disp = '';\r\n\t\t\t}\t\r\n\t\t\t?>\r\n\t\t\t<input type=\"hidden\" name=\"payonaccount_paymethod\" id=\"payonaccount_paymethod\" value=\"<?php echo $row_paymethods['paymethod_key'].'_'.$row_paymethods['paymethod_id']?>\" />\r\n\t\t\t<?php\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t/*if($db->num_rows($ret_paytypes)==1 and $cc_exists == true)\r\n\t\t\t\t$disp = '';\r\n\t\t\telse\r\n\t\t\t\t$disp = 'none';\r\n\t\t\t*/\t\t\r\n\t\t\t?>\r\n\t\t\t<tr id=\"payonaccount_paymethod_tr\" style=\"display:<?php echo $paymethoddisp_none?>\">\r\n\t\t\t\t<td colspan=\"2\" align=\"left\" valign=\"middle\">\r\n\t\t\t\t<div class=\"shoppayment_type_div\">\r\n\t\t\t\t\t<?php\r\n\t\t\t\t\t\t$pay_maxcnt = 2;\r\n\t\t\t\t\t\t$pay_cnt\t= 0;\r\n\t\t\t\t\t?>\r\n\t\t\t\t\t<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n\t\t\t\t\t <tr>\r\n\t\t\t\t\t\t<td colspan=\"<?php echo $pay_maxcnt?>\" class=\"cart_payment_header\"><?php echo $Captions_arr['PAYONACC']['PAYON_SEL_PAYGATEWAY']?></td>\r\n\t\t\t\t\t </tr>\r\n\t\t\t\t\t <tr>\r\n\t\t\t\t\t <?php\r\n\t\t\t\t\t\twhile ($row_paymethods = $db->fetch_array($ret_paymethods))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$caption = ($row_paymethods['payment_method_sites_caption'])?$row_paymethods['payment_method_sites_caption']:$row_paymethods['paymethod_name'];\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif($row_paymethods['paymethod_secured_req']==1 and $protectedUrl==true) // if secured is required for current pay method and currently in secured. so no reload is required\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t$on_paymethod_click = 'handle_paytypeselect_payonaccount(this)';\r\n\t\t\t\t\t\t\t}\t\r\n\t\t\t\t\t\t\telseif ($row_paymethods['paymethod_secured_req']==1 and $protectedUrl==false) // case if secured is required and current not is secured. so reload is required\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t$on_paymethod_click = \"handle_form_submit(document.frm_payonaccount_payment,'','')\";\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telseif ($row_paymethods['paymethod_secured_req']==0 and $protectedUrl==false) // case if secured is required and current not is secured. so reload is required\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t$on_paymethod_click = 'handle_paytypeselect_payonaccount(this)';\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telseif ($row_paymethods['paymethod_secured_req']==0 and $protectedUrl==true) // case if secured is not required and current is secured. so reload is required\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t$on_paymethod_click = \"handle_form_submit(document.frm_payonaccount_payment,'','')\";\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t$on_paymethod_click = 'handle_paytypeselect_payonaccount(this)';\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t$curname = $row_paymethods['paymethod_key'].'_'.$row_paymethods['paymethod_id'];\r\n\t\t\t\t\t\t\tif($curname==$_REQUEST['payonaccount_paymethod'])\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif (($row_paymethods['paymethod_key']=='SELF' or $row_paymethods['paymethod_key']=='PROTX') and $sel_ptype=='credit_card')\r\n\t\t\t\t\t\t\t\t\t$self_disp = '';\r\n\t\t\t\t\t\t\t\tif($sel_ptype=='credit_card')\t\r\n\t\t\t\t\t\t\t\t\t$sel = 'checked=\"checked\"';\r\n\t\t\t\t\t\t\t}\t\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t$sel = '';\r\n\t\t\t\t\t\t\t$img_path=\"./images/\".$ecom_hostname.\"/site_images/payment_methods_images/\".$row_paymethods['paymethod_ssl_imagelink'];\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t if(file_exists($img_path))\r\n\t\t\t\t\t\t\t\t$caption = '<img src=\"'.$img_path.'\" border=\"0\" alt=\"'.$caption.'\" />';\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t ?>\r\n\t\t\t\t\t\t\t<td width=\"25%\" align=\"left\" class=\"emailfriendtextnormal\">\r\n\t\t\t\t\t\t\t<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td align=\"left\" valign=\"top\" width=\"2%\">\r\n\t\t\t\t\t\t\t\t<input class=\"shoppingcart_radio\" type=\"radio\" name=\"payonaccount_paymethod\" id=\"payonaccount_paymethod\" value=\"<?php echo $row_paymethods['paymethod_key'].'_'.$row_paymethods['paymethod_id']?>\" <?php echo $sel ?> onclick=\"<?php echo $on_paymethod_click?>\" />\r\n\t\t\t\t\t\t\t\t<td align=\"left\">\r\n\t\t\t\t\t\t\t\t<?php echo stripslashes($caption)?>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t<?php\r\n\t\t\t\t\t\t\t$pay_cnt++;\r\n\t\t\t\t\t\t\tif ($pay_cnt>=$pay_maxcnt)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\techo \"</tr><tr>\";\r\n\t\t\t\t\t\t\t\t$pay_cnt = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif ($pay_cnt<$pay_maxcnt)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\techo \"<td colspan=\".($pay_maxcnt-$pay_cnt).\">&nbsp;</td>\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t?>\t\r\n\t\t\t\t\t </tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</div>\t\t\t\t</td>\r\n\t\t\t</tr>\t\r\n\t\t\t<?php\r\n\t\t}\r\n\t}\r\n\tif($paytypes_cnt==1 && $totpaymethodcnt==0 && $single_curtype=='cheque')\r\n\t{\r\n\t\t$chequedisp_none = '';\r\n\t}\t\r\n\t?>\r\n\t<tr id=\"payonaccount_cheque_tr\" style=\"display:<?php echo $chequedisp_none?>\">\r\n\t<td colspan=\"2\" align=\"left\" valign=\"middle\">\t\r\n\t\t<table width=\"100%\" cellpadding=\"1\" cellspacing=\"1\" border=\"0\">\r\n\t\t<tr>\r\n\t\t\t<td colspan=\"2\" align=\"left\" class=\"shoppingcartheader\"><?php echo $Captions_arr['PAYONACC']['PAY_ON_CHEQUE_DETAILS']?></td>\r\n\t\t</tr>\r\n\t\t<?php\r\n\t\t\t// Get the list of credit card static fields to be shown in the checkout out page in required order\r\n\t\t\t$sql_checkout = \"SELECT field_det_id,field_key,field_name,field_req,field_error_msg \r\n\t\t\t\t\t\t\t\tFROM \r\n\t\t\t\t\t\t\t\t\tgeneral_settings_site_checkoutfields \r\n\t\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\t\tsites_site_id = $ecom_siteid \r\n\t\t\t\t\t\t\t\t\tAND field_hidden=0 \r\n\t\t\t\t\t\t\t\t\tAND field_type='CHEQUE' \r\n\t\t\t\t\t\t\t\tORDER BY \r\n\t\t\t\t\t\t\t\t\tfield_order\";\r\n\t\t\t$ret_checkout = $db->query($sql_checkout);\r\n\t\t\tif($db->num_rows($ret_checkout))\r\n\t\t\t{\t\t\t\t\t\t\r\n\t\t\t\twhile($row_checkout = $db->fetch_array($ret_checkout))\r\n\t\t\t\t{\t\t\t\r\n\t\t\t\t\t// Section to handle the case of required fields\r\n\t\t\t\t\tif($row_checkout['field_req']==1)\r\n\t\t\t\t\t{\r\n\r\n\t\t\t\t\t\t$chkoutadd_Req[]\t\t= \"'\".$row_checkout['field_key'].\"'\";\r\n\t\t\t\t\t\t$chkoutadd_Req_Desc[]\t= \"'\".$row_checkout['field_error_msg'].\"'\"; \r\n\t\t\t\t\t}\t\t\t\r\n\t\t?>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td align=\"left\" width=\"50%\" class=\"emailfriendtextnormal\" valign=\"top\">\r\n\t\t\t\t\t<?php echo stripslashes($row_checkout['field_name']); if($row_checkout['field_req']==1) { echo '&nbsp;<span class=\"redtext\">*</span>';}?>\t\t\t\t\t</td>\r\n\t\t\t\t\t<td align=\"left\" width=\"50%\" class=\"emailfriendtextnormal\" valign=\"top\">\r\n\t\t\t\t\t<?php\r\n\t\t\t\t\t\techo get_Field($row_checkout['field_key'],$saved_checkoutvals,$cartData);\r\n\t\t\t\t\t?>\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t<?php\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t?>\r\n\t\t\t</table>\t\t</td>\r\n\t </tr>\t\r\n\t<tr id=\"payonaccount_self_tr\" style=\"display:<?php echo $self_disp?>\">\r\n\t\t<td colspan=\"2\" align=\"left\" valign=\"middle\">\t\r\n\t\t<table width=\"100%\" cellpadding=\"1\" cellspacing=\"1\" border=\"0\">\r\n\t\t<tr>\r\n\t\t\t<td colspan=\"2\" align=\"left\" class=\"shoppingcartheader\"><?php echo $Captions_arr['PAYONACC']['PAYON_CREDIT_CARD_DETAILS']?></td>\r\n\t\t</tr>\r\n\t\t<?php\r\n\t\t\t$cur_form = 'frm_payonaccount_payment';\r\n\t\t\t// Get the list of credit card static fields to be shown in the checkout out page in required order\r\n\t\t\t$sql_checkout = \"SELECT field_det_id,field_key,field_name,field_req,field_error_msg \r\n\t\t\t\t\t\t\t\tFROM \r\n\t\t\t\t\t\t\t\t\tgeneral_settings_site_checkoutfields \r\n\t\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\t\tsites_site_id = $ecom_siteid \r\n\t\t\t\t\t\t\t\t\tAND field_hidden=0 \r\n\t\t\t\t\t\t\t\t\tAND field_type='CARD' \r\n\t\t\t\t\t\t\t\tORDER BY \r\n\t\t\t\t\t\t\t\t\tfield_order\";\r\n\t\t\t$ret_checkout = $db->query($sql_checkout);\r\n\t\t\tif($db->num_rows($ret_checkout))\r\n\t\t\t{\t\t\t\t\t\t\r\n\t\t\t\twhile($row_checkout = $db->fetch_array($ret_checkout))\r\n\t\t\t\t{\t\t\t\r\n\t\t\t\t\t// Section to handle the case of required fields\r\n\t\t\t\t\tif($row_checkout['field_req']==1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif($row_checkout['field_key']=='checkoutpay_expirydate' or $row_checkout['field_key']=='checkoutpay_issuedate')\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$chkoutcc_Req[]\t\t\t= \"'\".$row_checkout['field_key'].\"_month'\";\r\n\t\t\t\t\t\t\t$chkoutcc_Req_Desc[]\t= \"'\".$row_checkout['field_error_msg'].\"'\";\r\n\t\t\t\t\t\t\t$chkoutcc_Req[]\t\t\t= \"'\".$row_checkout['field_key'].\"_year'\";\r\n\t\t\t\t\t\t\t$chkoutcc_Req_Desc[]\t= \"'\".$row_checkout['field_error_msg'].\"'\"; \r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t$chkoutcc_Req[]\t\t\t= \"'\".$row_checkout['field_key'].\"'\";\r\n\t\t\t\t\t\t\t$chkoutcc_Req_Desc[]\t= \"'\".$row_checkout['field_error_msg'].\"'\"; \r\n\t\t\t\t\t\t}\t\r\n\t\t\t\t\t}\t\t\t\r\n\t\t?>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td align=\"left\" width=\"50%\" class=\"emailfriendtextnormal\">\r\n\t\t\t\t\t<?php echo stripslashes($row_checkout['field_name']); if($row_checkout['field_req']==1) { echo '&nbsp;<span class=\"redtext\">*</span>';}?>\t\t\t\t\t</td>\r\n\t\t\t\t\t<td align=\"left\" width=\"50%\" class=\"emailfriendtextnormal\">\r\n\t\t\t\t\t<?php\r\n\t\t\t\t\t\techo get_Field($row_checkout['field_key'],$saved_checkoutvals,$cartData,$cur_form);\r\n\t\t\t\t\t?>\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t<?php\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t?> \r\n\t\t</table>\t</td>\r\n\t</tr>\r\n\t<?php\r\n $google_displayed = false;\r\n\tif(!($google_exists && $google_recommended ==0) or $paytypes_cnt>0)\r\n\t{\r\n\t?>\t\r\n\t\t<tr>\r\n\t\t<td colspan=\"4\" align=\"right\" class=\"emailfriendtext\"><input name=\"payonaccount_payment_Submit\" type=\"submit\" class=\"buttongray\" id=\"payonaccount_payment_Submit\" value=\"<?=\"Make Payment\"?>\"/></td>\r\n\t\t</tr>\r\n\t<?php\r\n\t}\r\n }\r\n if($ecom_common_settings['paymethodKey']['PAYPAL_EXPRESS']['paymethod_key'] == \"PAYPAL_EXPRESS\" and $_REQUEST['pret']!=1) // case if paypal express is active in current website\r\n {\r\n ?>\r\n <tr>\r\n <td colspan=\"2\">\r\n <table width='100%' cellpadding='0' cellspacing='0' border='0' class=\"shoppingcarttable\">\r\n <?php\r\n if($totpaycnt>0 or $google_displayed==true)\r\n {\r\n ?>\r\n <tr>\r\n <td align=\"right\" valign=\"middle\" class=\"google_or\" colspan=\"2\">\r\n <img src=\"<?php echo url_site_image('gateway_or.gif')?>\" alt=\"Or\" border=\"0\" />\r\n </td>\r\n </tr> \r\n <?php\r\n }\r\n ?>\r\n <tr>\r\n <td align=\"left\" valign=\"top\" class=\"google_td\" width=\"60%\"><?php echo stripslashes($Captions_arr['CART']['CART_PAYPAL_HELP_MSG']);?></td>\r\n <td align=\"right\" valign=\"middle\" class=\"google_td\">\r\n <input type='hidden' name='for_paypal' id='for_paypal' value='0'/>\r\n <input type='button' name='submit_express' style=\"background:url('https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif'); width:145px;height:42px;cursor:pointer\" border='0' align='top' alt='PayPal' onclick=\"validate_payonaccount_paypal(document.frm_payonaccount_payment)\"/>\r\n </td>\r\n </tr>\r\n </table>\r\n </td>\r\n </tr>\r\n <?php\r\n }\r\n elseif($_REQUEST['pret']==1) // case if returned from paypal so creating input types to hold the payment type and payment method ids\r\n {\r\n ?>\r\n <tr>\r\n <td colspan=\"2\">\r\n <table width='100%' cellpadding='0' cellspacing='0' border='0'>\r\n <tr>\r\n <td colspan=\"2\" align=\"right\" class=\"gift_mid_table_td\">\r\n <input type='hidden' name='payonaccount_paytype' id = 'payonaccount_paytype' value='<?php echo $ecom_common_settings['paytypeCode']['credit_card']['paytype_id']?>'/>\r\n <input type='hidden' name='payonaccount_paymethod' id = 'payonaccount_paymethod' value='PAYPAL_EXPRESS_<?php echo $ecom_common_settings['paymethodKey']['PAYPAL_EXPRESS']['paymethod_id']?>'/>\r\n <input type='hidden' name='override_paymethod' id = 'override_paymethod' value='1'/>\r\n <input type='hidden' name='token' id = 'token' value='<?php echo $_REQUEST['token']?>'/>\r\n <input type='hidden' name='payer_id' id = 'payer_id' value='<?php echo $_REQUEST['payer_id']?>'/>\r\n <input type='hidden' name='for_paypal' id='for_paypal' value='0'/>\r\n <input name=\"buypayonaccountpayment_Submit\" type=\"button\" class=\"buttongray\" id=\"buypayonaccountpayment_Submit\" value=\"<?=$Captions_arr['PAYONACC']['PAYON_PAY']?>\" onclick=\"validate_payonaccount(document.frm_payonaccount_payment)\" /></td>\r\n </tr>\r\n </table>\r\n </td>\r\n </tr>\r\n \r\n <?php\r\n }\r\n\t?>\r\n\t\t\t</form>\r\n\t<?php\r\n\t\t \t// Check whether the google checkout button is to be displayed\r\n\t\tif($google_exists && $google_recommended ==0 && $_REQUEST['pret']!=1)\r\n\t\t{\r\n\t\t\t$row_google = $db->fetch_array($ret_google);\r\n\t?>\r\n\t<tr>\r\n\t<td colspan=\"2\">\r\n\t\t<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"shoppingcarttable\">\r\n\t\t<?php \r\n\t\tif($paytypes_cnt>0)\r\n\t\t{\r\n $google_displayed = true;\r\n\t\t?>\t\r\n\t\t<tr>\r\n\t\t\t<td align=\"right\" valign=\"middle\" class=\"google_or\">\r\n\t\t\t <img src=\"<?php echo url_site_image('gateway_or.gif')?>\" alt=\"Or\" border=\"0\" />\r\n\t\t\t</td>\r\n\t\t</tr>\t\r\n\t\t<?php\r\n\t\t}\r\n\t\t?>\t\r\n\t\t<tr>\r\n\t\t\t<td colspan=\"6\" align=\"right\" valign=\"middle\" class=\"google_td\">\r\n\t\t\t<?php\r\n\t\t\t\t$display_option = 'ALL';\r\n\t\t\t\t// Get the details of current customer to pass to google checkout\r\n\t\t\t\t$pass_type \t= 'payonaccount';\r\n\t\t\t\t$cust_details \t= stripslashes($row_cust['customer_title']).stripslashes($row_cust['customer_fname']).' '.stripslashes($row_cust['customer_surname']).' - '.stripslashes($row_cust['customer_email_7503']).' - '.$ecom_hostname;\r\n\t\t\t\t$cartData[\"totals\"][\"bonus_price\"] = $paying_amt;\r\n\t\t\t\trequire_once('includes/google_library/googlecart.php');\r\n\t\t\t\trequire_once('includes/google_library/googleitem.php');\r\n\t\t\t\trequire_once('includes/google_library/googleshipping.php');\r\n\t\t\t\trequire_once('includes/google_library/googletax.php');\r\n\t\t\t\tinclude(\"includes/google_checkout.php\");\r\n\t\t\t?>\t\r\n\t\t\t</td>\r\n\t\t</tr>\t\r\n\t\t</table>\r\n\t</td>\r\n\t</tr>\r\n\t<?php\r\n\t\t\t}\r\n\t?>\t\r\n\t</table>\t</td>\r\n\t</tr>\r\n</table>\r\n\r\n\t\t<script type=\"text/javascript\">\r\n\t\tfunction validate_payonaccount(frm)\r\n\t\t{\r\n if(document.getElementById('for_paypal').value!=1)\r\n {\r\n\t\t<?php\r\n\t\t\tif(count($chkoutadd_Req))\r\n\t\t\t{\r\n\t\t\t?>\r\n\t\t\t\treqadd_arr \t\t\t= new Array(<?php echo implode(\",\",$chkoutadd_Req)?>);\r\n\t\t\t\treqadd_arr_str\t\t= new Array(<?php echo implode(\",\",$chkoutadd_Req_Desc)?>);\r\n\t\t\t<?php\r\n\t\t\t}\r\n\t\t\tif(count($chkoutcc_Req))\r\n\t\t\t{\r\n\t\t\t?>\r\n\t\t\t\treqcc_arr \t\t\t= new Array(<?php echo implode(\",\",$chkoutcc_Req)?>);\r\n\t\t\t\treqcc_arr_str\t\t= new Array(<?php echo implode(\",\",$chkoutcc_Req_Desc)?>);\r\n\t\t\t<?php\r\n\t\t\t}\r\n\t\t\t?>\r\n\t\t\tfieldRequired\t\t= new Array();\r\n\t\t\tfieldDescription\t= new Array();\r\n\t\t\tvar i=0;\r\n\t\t\t<?php\r\n\t\t\tif($Settings_arr['imageverification_req_payonaccount'])\r\n\t\t\t{\r\n\t\t\t?>\r\n\t\t\tfieldRequired[i] \t\t= 'payonaccountpayment_Vimg';\r\n\t\t\tfieldDescription[i]\t = 'Image Verification Code';\r\n\t\t\ti++;\r\n\t\t\t<?php\r\n\t\t\t}\r\n\t\t\tif (count($chkoutadd_Req))\r\n\t\t\t{\r\n\t\t\t?>\r\n\t\t\tif(document.getElementById('payonaccount_cheque_tr').style.display=='') /* do the following only if checque is selected */\r\n\t\t\t{\r\n\t\t\t\tfor(j=0;j<reqadd_arr.length;j++)\r\n\t\t\t\t{\r\n\t\t\t\t\tfieldRequired[i] \t= reqadd_arr[j];\r\n\t\t\t\t\tfieldDescription[i] = reqadd_arr_str[j];\r\n\t\t\t\t\ti++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t<?php\r\n\t\t\t}\r\n\t\t\tif (count($chkoutcc_Req))\r\n\t\t\t{\r\n\t\t\t?>\r\n\t\t\tif(document.getElementById('payonaccount_self_tr').style.display=='') /* do the following only if protx or self is selected */\r\n\t\t\t{\r\n\t\t\t\tfor(j=0;j<reqcc_arr.length;j++)\r\n\t\t\t\t{\r\n\t\t\t\t\tfieldRequired[i] \t= reqcc_arr[j];\r\n\t\t\t\t\tfieldDescription[i] = reqcc_arr_str[j];\r\n\t\t\t\t\ti++;\r\n\t\t\t\t}\r\n\t\t\t}\t\r\n\t\t\t<?php\r\n\t\t\t}\t\r\n\t\t\tif (count($chkout_Email))\r\n\t\t\t{\r\n\t\t\t$chkout_Email_Str \t\t= implode(\",\",$chkout_Email);\r\n\t\t\techo \"fieldEmail \t\t= Array(\".$chkout_Email_Str.\");\";\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\techo \"fieldEmail \t\t= Array();\";\r\n\t\t\t// Password checking\r\n\t\t\tif (count($chkout_Confirm))\r\n\t\t\t{\r\n\t\t\t$chkout_Confirm_Str \t= implode(\",\",$chkout_Confirm);\r\n\t\t\t$chkout_Confirmdesc_Str\t= implode(\",\",$chkout_Confirmdesc);\r\n\t\t\techo \"fieldConfirm \t\t= Array(\".$chkout_Confirm_Str.\");\";\r\n\t\t\techo \"fieldConfirmDesc \t= Array(\".$chkout_Req_Desc_Str.\");\";\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\techo \"fieldConfirm \t\t= Array();\";\r\n\t\t\techo \"fieldConfirmDesc \t= Array();\";\r\n\t\t\t}\t\r\n\t\t\tif (count($chkout_Numeric))\r\n\t\t\t{\r\n\t\t\t\t$chkout_Numeric_Str \t\t= implode(\",\",$chkout_Numeric);\r\n\t\t\t\techo \"fieldNumeric \t\t\t= Array(\".$chkout_Numeric_Str.\");\";\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\techo \"fieldNumeric \t\t\t= Array();\";\r\n\t\t\t?>\r\n\t\t\tif(Validate_Form_Objects(frm,fieldRequired,fieldDescription,fieldEmail,fieldConfirm,fieldConfirmDesc,fieldNumeric))\r\n\t\t\t{\r\n\t\t\t/* Check whether atleast one payment type is selected */\r\n\t\t\tvar atleastpay = false;\r\n\t\t\tfor(k=0;k<frm.elements.length;k++)\r\n\t\t\t{\r\n\t\t\t\tif(frm.elements[k].name=='payonaccount_paytype')\r\n\t\t\t\t{\r\n\t\t\t\t\tif(frm.elements[k].type=='hidden')\r\n\t\t\t\t\t\tatleastpay = true; /* Done to handle the case of only one payment type */\r\n\t\t\t\t\telse if(frm.elements[k].checked==true)\r\n\t\t\t\t\t\tatleastpay = true;\t\r\n\t\t\t\t}\t\r\n\t\t\t}\t\r\n\t\t\tif(atleastpay==false)\r\n\t\t\t{\r\n\t\t\t\talert('Please select payment type');\r\n\t\t\t\treturn false;\t\r\n\t\t\t}\r\n\t\t\tif (document.getElementById('paymentmethod_req').value==1)\r\n\t\t\t{\r\n\t\t\t\tvar atleast = false;\r\n\t\t\t\tfor(k=0;k<frm.elements.length;k++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(frm.elements[k].name=='payonaccount_paymethod')\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(frm.elements[k].type=='hidden')\r\n\t\t\t\t\t\t\tatleast = true; /* Done to handle the case of only one payment method */\r\n\t\t\t\t\t\telse if(frm.elements[k].checked==true)\r\n\t\t\t\t\t\t\tatleast = true;\t\r\n\t\t\t\t\t}\t\r\n\t\t\t\t}\t\r\n\t\t\t\tif(atleast ==false)\r\n\t\t\t\t{\r\n\t\t\t\t\talert('Please select a payment method');\r\n\t\t\t\t\treturn false;\t\r\n\t\t\t\t}\t\r\n\t\t\t}\t\r\n\t\t\telse\r\n\t\t\t{\r\n if(document.getElementById('override_paymethod'))\r\n {\r\n if(document.getElementById('override_paymethod').value!=1)\r\n {\r\n if (document.getElementById('payonaccount_paymethod'))\r\n document.getElementById('payonaccount_paymethod').value = 0; \r\n }\r\n }\r\n else\r\n {\r\n if (document.getElementById('payonaccount_paymethod'))\r\n\t\t\t\t\tdocument.getElementById('payonaccount_paymethod').value = 0;\r\n }\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t/* Handling the case of credit card related sections*/\r\n\t\t\tif(frm.checkoutpay_cardtype)\r\n\t\t\t{\r\n\t\t\t\tif(frm.checkoutpay_cardtype.value)\r\n\t\t\t\t{\r\n\t\t\t\t\tobjarr = frm.checkoutpay_cardtype.value.split('_');\r\n\t\t\t\t\tif(objarr.length==4) /* if the value splitted to exactly 4 elements*/\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar key \t\t= objarr[0];\r\n\t\t\t\t\t\tvar issuereq \t= objarr[1];\r\n\t\t\t\t\t\tvar seccount \t= objarr[2];\r\n\t\t\t\t\t\tvar cc_count \t= objarr[3];\r\n\t\t\t\t\t\tif (isNaN(frm.checkoutpay_cardnumber.value))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\talert('Credit card number should be numeric');\r\n\t\t\t\t\t\t\tfrm.checkoutpay_cardnumber.focus();\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (frm.checkoutpay_cardnumber.value.length>cc_count)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\talert('Credit card number should not contain more than '+cc_count+' digits');\r\n\t\t\t\t\t\t\tfrm.checkoutpay_cardnumber.focus();\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (frm.checkoutpay_securitycode.value.length>seccount)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\talert('Security Code should not contain more than '+seccount+' digits');\r\n\t\t\t\t\t\t\tfrm.checkoutpay_securitycode.focus();\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\t\t\t\r\n\t\t\t/* If reached here then everything is valid \r\n\t\t\t\tchange the action of the form to the desired value\r\n\t\t\t*/\r\n\t\t\t\tif(document.getElementById('save_payondetails'))\r\n\t\t\t\t\tdocument.getElementById('save_payondetails').value \t= 1;\r\n if(document.getElementById('payonaccount_payment_Submit'))\r\n\t\t\t\tshow_wait_button(document.getElementById('payonaccount_payment_Submit'),'Please wait...');\r\n\t\t\t\t/*frm.action = 'payonaccount_payment_submit.php?bsessid=<?php //echo base64_encode($ecom_hostname)?>';*/\r\n\t\t\t\tfrm.action = 'payonaccount_payment_submit.php';\r\n\t\t\t\tfrm.submit();\r\n\t\t\t\treturn true;\r\n\t\t\t}\t\r\n\t\t\telse\r\n\t\t\treturn false;\r\n }\r\n else\r\n {\r\n if(document.getElementById('save_payondetails'))\r\n document.getElementById('save_payondetails').value = 1;\r\n show_wait_button(document.getElementById('payonaccount_payment_Submit'),'Please wait...');\r\n /*frm.action = 'payonaccount_payment_submit.php?bsessid=<?php //echo base64_encode($ecom_hostname)?>';*/\r\n frm.action = 'payonaccount_payment_submit.php';\r\n frm.submit();\r\n return true;\r\n }\r\n\t\t}\r\n function validate_payonaccount_paypal(frm)\r\n {\r\n if(document.getElementById('for_paypal'))\r\n document.getElementById('for_paypal').value = 1;\r\n validate_payonaccount(frm);\r\n }\r\n\t\t</script>\t\r\n\t\t<?php\t\r\n\t\t}", "public function get_payment_details($order)\n {\n $raw_response = wp_safe_remote_get(\n $this->endpoint . '/charges/' . $order->get_order_key(),\n array(\n 'method' => 'GET',\n 'timeout' => 30,\n 'user-agent' => 'WooCommerce/' . WC()->version,\n 'headers' => array(\n 'Content-Type' => 'application/json;',\n 'Authorization' => 'Bearer ' . $this->gateway->get_option('api_token')\n ),\n 'httpversion' => '1.1',\n )\n );\n\n WC_Gateway_Orangepay::log('Orangepay - get_payment_details() response: ' . wc_print_r($raw_response, true));\n\n if (isset($raw_response['body']) && ($response = json_decode($raw_response['body'], true))) {\n if (isset($response['data'])) {\n $data = $response['data'];\n if (isset($data['charge'])) {\n return $data['charge'];\n }\n }\n }\n\n return null;\n }", "private function getPayment() {\r\n\r\n\t\t\t$refreshed_token = new Token($this->id, $this->secret, null);\r\n\r\n\t\t\t// Get bill id from URI\r\n\t\t\t$sections = explode(\"/\", $_SERVER['REQUEST_URI']);\r\n\t\t\t$bill_id = $sections[1];\r\n\r\n\t\t\t$payments = $this->user->getPayments($bill_id);\r\n\r\n\t\t\tif($payments) {\r\n\r\n\t\t\t\techo json_encode([\r\n\t\t\t\t\t'code' => 200,\r\n\t\t\t\t\t'message' => 'OK',\r\n\t\t\t\t\t'payments' => $payments,\r\n\t\t\t\t\t'token' => $refreshed_token->getTokenString()\r\n\t\t\t\t]);\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\techo json_encode([\r\n\t\t\t\t\t'code' => 404,\r\n\t\t\t\t\t'message' => 'Not found',\r\n\t\t\t\t\t'payments' => '',\r\n\t\t\t\t\t'token' => $refreshed_token->getTokenString()\r\n\t\t\t\t]);\r\n\r\n\t\t\t}\r\n\r\n\t\t}", "public function payment_fields() {\n\n\t\t$this->log( 'Show Payment fields on the checkout page' );\n\n\t\t$referer = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : \"\";\n\n\t\t$this->log( 'Received GET data from [' . $referer. ']:' );\n\t\t$this->log( print_r($_GET, true ) );\n\n\t\t$this->log( 'Received POST data from [' . $referer. ']:' );\n\t\t$this->log( print_r($_POST, true ) );\n\n\t\tif ( $this->description ) {\n\t\t\techo wpautop( wp_kses_post( $this->description ) );\n\t\t}\n\t}", "public function payinfo(){\n \n \n \n $page_name = 'payment_info';\n \n //build view page for payment \n $page_content = $this->load->view($this->folder_name.'/'.$page_name,'',true);\n $this->page->build($page_content, $this->folder_name, $page_name, $this->page_title );\n }", "abstract public function getPaymentMethod();", "public function getPage() {\n return $this->render('payment_info.phtml');\n }", "public function getPaymentName()\n {\n return 'paypal';\n }", "protected function getPayment()\n {\n return $this->getOrder()->getPayment();\n }", "function testingPayment(){\n\t\treturn $this->getTestingPayment();\n\t}", "public function handleGatewayCallback()\n {\n $paymentDetails = Paystack::getPaymentData();\n\n dd($paymentDetails);\n // Now you have the payment details,\n // you can store the authorization_code in your db to allow for recurrent subscriptions\n // you can then redirect or do whatever you want\n }", "private function getPayum()\n {\n return $this->get('payum');\n }", "public function getPayment() {\n return $this->request(\n \"GET\",\n \"/shops/{$this->shop_id}/receipts/{$this->receipt_id}/payments\",\n \"Payment\"\n )\n ->first();\n }", "public function getPayPalResponse(){\r\n\t\t\r\n\t}", "public function getPaymentInfo($cart)\n {\n /** Do not show Billmate Checkout as payment option in store */\n return false;\n }", "public function getPaymentRequest()\n {\n return $this->payment_request;\n }", "public function pay();", "abstract public function getPaymentConfig($payment);", "public function getPaymentInformation($paymentType = null)\n {\n $paymentInformation = $this->_getField(self::$PAYMENT_INFORMATION);\n if(is_array($paymentInformation))\n {\n if($paymentType != null)\n {\n $paymentType = strtoupper($paymentType);\n foreach($paymentInformation AS $singlePaymentInformation)\n {\n if($singlePaymentInformation['paymentType'] == $paymentType)\n {\n return $singlePaymentInformation;\n }\n }\n return Array();\n }\n else\n {\n return $paymentInformation;\n }\n }\n else\n {\n return Array();\n }\n }", "abstract protected function handlePayment();", "public static function metaPayment($post = null)\n {\n $v = get_post_meta($post->ID, 'payment_methods', true);\n print_r($v);\n }", "public function getInfoPaymentByOrder($order_id)\n {\n $order = $this->_getOrder($order_id);\n $payment = $order->getPayment();\n $info_payments = [];\n $fields = [\n [\"field\" => \"cardholderName\", \"title\" => \"Card Holder Name: %1\"],\n [\"field\" => \"trunc_card\", \"title\" => \"Card Number: %1\"],\n [\"field\" => \"payment_method\", \"title\" => \"Payment Method: %1\"],\n [\"field\" => \"expiration_date\", \"title\" => \"Expiration Date: %1\"],\n [\"field\" => \"installments\", \"title\" => \"Installments: %1\"],\n [\"field\" => \"statement_descriptor\", \"title\" => \"Statement Descriptor: %1\"],\n [\"field\" => \"payment_id\", \"title\" => \"Payment id (Mercado Pago): %1\"],\n [\"field\" => \"status\", \"title\" => \"Payment Status: %1\"],\n [\"field\" => \"status_detail\", \"title\" => \"Payment Detail: %1\"],\n [\"field\" => \"activation_uri\", \"title\" => \"Generate Ticket\"],\n [\"field\" => \"payment_id_detail\", \"title\" => \"Mercado Pago Payment Id: %1\"],\n [\"field\" => \"id\", \"title\" => \"Collection Id: %1\"],\n ];\n\n foreach ($fields as $field) {\n if ($payment->getAdditionalInformation($field['field']) != \"\") {\n $text = __($field['title'], $payment->getAdditionalInformation($field['field']));\n $info_payments[$field['field']] = [\n \"text\" => $text,\n \"value\" => $payment->getAdditionalInformation($field['field'])\n ];\n }\n }\n\n if ($payment->getAdditionalInformation('payer_identification_type') != \"\") {\n $text = __($payment->getAdditionalInformation('payer_identification_type'));\n $info_payments[$payment->getAdditionalInformation('payer_identification_type')] = [\n \"text\" => $text . ': ' . $payment->getAdditionalInformation('payer_identification_number')\n ];\n }\n\n return $info_payments;\n }", "public function payment(){\n\n\t}", "public function paymentNotify()\n {\n $response = $this->client->request($this->methods['post'], 'pay' , [\n 'json' => [\n 'AGR_TRANS_ID' => $this->agr_trans_id,\n 'VENDOR_TRANS_ID' => $this->vendor_trans_id,\n 'STATUS' => $this->status,\n 'SIGN_TIME' => $this->generateSignTime(),\n 'SIGN_STRING' => md5($this->SECRET_KEY. $this->agr_trans_id. $this->vendor_trans_id. $this->status. $this->sign_time)\n ]\n ]);\n\n return json_decode($response->getBody());\n }", "function get_gateway_data( ){\n\t\t\n\t\t$authorize_login_id \t\t= \t\tget_option( 'ec_option_authorize_login_id' );\n\t\t$authorize_trans_key \t\t= \t\tget_option( 'ec_option_authorize_trans_key' );\n\t\t$authorize_test_mode \t\t= \t\tget_option( 'ec_option_authorize_test_mode' );\n\t\t$authorize_currency_code \t= \t\tget_option( 'ec_option_authorize_currency_code' );\n\t\t\n\t\t$transaction_type = \"AUTH_CAPTURE\";\n\t\t$expiration_date = $this->credit_card->expiration_month . '/' . $this->credit_card->get_expiration_year( 4 );\n\t\t\n\t\t/*\n\t\t$line_items = \"\";\n\t\tfor( $i=0; $i<count($this->cart->cart); $i++ ){\n\t\t\t\n\t\t\tif( $i != 0)\n\t\t\t\t$line_items .= \"&\";\n\t\t\t\t\n\t\t\t$line_items .= \t$this->cart->cart[$i]->product_id . \"<|>\" . \n\t\t\t\t\t\t\t$this->cart->cart[$i]->title . \"<|><|>\" . \n\t\t\t\t\t\t\t$this->cart->cart[$i]->quantity . \"<|>\" . \n\t\t\t\t\t\t\t$this->cart->cart[$i]->unit_price . \"<|>\" . \n\t\t\t\t\t\t\t$this->cart->cart[$i]->is_taxable; \t\n\t\t}\n\t\t*/\n\t\t\n\t\t$authorize_values = array(\n\t\t \"x_login\"\t\t\t\t\t\t\t=> $authorize_login_id,\n\t\t \"x_test_request\" \t\t\t\t\t=> $authorize_test_mode,\n\t\t \"x_tran_key\"\t\t\t\t\t\t=> $authorize_trans_key,\n\t\t \"x_type\"\t\t\t\t\t\t\t=> $transaction_type,\n\t\t \"x_amount\"\t\t\t\t\t\t=> $this->order_totals->grand_total,\n\t\t \"x_card_num\"\t\t\t\t\t\t=> $this->credit_card->card_number,\n\t\t \"x_exp_date\"\t\t\t\t\t\t=> $expiration_date,\n\t\t \"x_card_code\"\t\t\t\t\t\t=> $this->credit_card->security_code,\n\t\t \"x_invoice_num\"\t\t\t\t\t=> $this->order_id,\n\t\t \"x_relay_response\"\t\t\t\t=> \"FALSE\",\n\t\t \"x_delim_data\"\t\t\t\t\t=> \"TRUE\",\n\t\t \"x_version\"\t\t\t\t\t\t=> \"3.1\",\n\t\t \"x_delim_char\"\t\t\t\t\t=> \",\",\n\t\t \"x_method\"\t\t\t\t\t\t=> \"CC\",\n\t\t \"x_tax\"\t\t\t\t\t\t\t=> $this->order_totals->tax_total,\n\t\t \"x_duty\"\t\t\t\t\t\t\t=> $this->order_totals->duty_total,\n\t\t \"x_freight\"\t\t\t\t\t\t=> $this->order_totals->shipping_total,\n\t\t \"x_first_name\"\t\t\t\t\t=> $this->user->billing->first_name,\n\t\t \"x_last_name\"\t\t\t\t\t\t=> $this->user->billing->last_name,\n\t\t \"x_address\"\t\t\t\t\t\t=> $this->user->billing->address_line_1,\n\t\t \"x_city\"\t\t\t\t\t\t\t=> $this->user->billing->city,\n\t\t \"x_state\"\t\t\t\t\t\t\t=> $this->user->billing->state,\n\t\t \"x_zip\"\t\t\t\t\t\t\t=> $this->user->billing->zip,\n\t\t \"x_country\"\t\t\t\t\t\t=> $this->user->billing->country,\n\t\t \"x_phone\"\t\t\t\t\t\t\t=> $this->user->billing->phone,\n\t\t \"x_email\"\t\t\t\t\t\t\t=> $this->user->email,\n\t\t \"x_cust_id\"\t\t\t\t\t\t=> $this->user->user_id,\n\t\t \"x_customer_ip\"\t\t\t\t\t=> $_SERVER['REMOTE_ADDR'],\n\t\t \"x_ship_to_first_name\"\t\t\t=> $this->user->shipping->first_name,\n\t\t \"x_ship_to_last_name\"\t\t\t\t=> $this->user->shipping->last_name,\n\t\t \"x_ship_to_address\"\t\t\t\t=> $this->user->shipping->address_line_1,\n\t\t \"x_ship_to_city\"\t\t\t\t\t=> $this->user->shipping->city,\n\t\t \"x_ship_to_state\"\t\t\t\t\t=> $this->user->shipping->state,\n\t\t \"x_ship_to_zip\"\t\t\t\t\t=> $this->user->shipping->zip,\n\t\t \"x_ship_to_country\"\t\t\t\t=> $this->user->shipping->country,\n\t\t \"x_ship_to_phone\"\t\t\t\t\t=> $this->user->shipping->phone//,\n\t\t // \"x_line_item\"\t\t\t\t\t\t=> $line_items\n\t\t);\n\t\t\n\t\treturn $authorize_values;\n\t}", "public function payment_fields() {\n \n\t\t\n \n\t\t}", "public function joinPaymentInfo();", "public function actionPaynow()\n\t{ \n\t // Duration is for subscription\n\t\t$duration = Yii::app()->request->getParam(\"duration\", \"0\");\n\t\t// subscription or pre-authorization\n\t\t$type = Yii::app()->request->getParam(\"type\", \"0\");\n\t\t \n\t\tif( isset($_SESSION['invoice_id']) )\n\t\t{\n\t\t \n\t\t$invoiceModel = new Invoices;\n\t $payment\t\t= $invoiceModel->getInvoicePayment( $_SESSION['invoice_id'] );\n\t\t// Sandbox\n\t\tGoCardless::$environment = 'sandbox';\n\t\t\n\t\t// Config vars\n\t\t$account_details = array(\n\t\t 'app_id' => 'HXC009A5B8B2AX6A0C6HY4950B0JXM1Y8HEGZB9Q6CD51TDG1RR34BTG6N6H1PVK',\n\t\t 'app_secret' => 'V7MTFFF67K4SEH0AWWTHEEXWRKK7JQ4MJ0QWTZ3EP0YMG65XG9S1TCA77R2PMDYC',\n\t\t 'merchant_id' => '07N2GAPV0D',\n\t\t 'access_token' => '0T6JYNA5B1S6H2DWWA6SJ43CBTG7QVMSZR79Z1ENTWZWK59Z8616H5GWBHDDTX02'\n\t\t);\n\t\t\n\t\t// Fail nicely if no account details set\n\t\tif ( ! $account_details['app_id'] && ! $account_details['app_secret']) {\n\t\t echo '<p>First sign up to <a href=\"http://gocardless.com\">GoCardless</a> and\n\t\tcopy your sandbox API credentials from the \\'Developer\\' tab into the top of\n\t\tthis script.</p>';\n\t\t exit();\n\t\t}\n\t\t\n\t\t// Initialize GoCardless\n\t\tGoCardless::set_account_details($account_details);\n\t\t\n\t\tif (isset($_GET['resource_id']) && isset($_GET['resource_type'])) {\n\t\t // Get vars found so let's try confirming payment\n\t\t\n\t\t $confirm_params = array(\n\t\t\t'resource_id' => $_GET['resource_id'],\n\t\t\t'resource_type' => $_GET['resource_type'],\n\t\t\t'resource_uri' => $_GET['resource_uri'],\n\t\t\t'signature' => $_GET['signature']\n\t\t );\n\t\t \n\t\t // State is optional\n\t\t if (isset($_GET['state'])) {\n\t\t\t$confirm_params['state'] = $_GET['state'];\n\t\t }\n\t\t\n\t\t $confirmed_resource = GoCardless::confirm_resource($confirm_params);\n\t \n\t\t if( isset($confirmed_resource->id)) { // Successfull\n\t\t \n\t\t\t$invoiceId = $_SESSION['invoice_id']; \n\t\t \n\t\t\t// Set to paid\n\t\t $invoiceModel->updateGocardlessPayment( $confirmed_resource, $_SESSION['invoice_id']); \n\t\t\t$this->sendInvoice( $invoiceId );\n \t\t\t$this->render(\"paynow\");\n\t\t\t unset($_SESSION['invoice_id']);\n\t\t }\n\t\t else {\n\t\t \t$this->redirect(array(\"invoice/index/\".$_SESSION['invoice_id']));\n\t\t \t\n\t\t }exit;\n\t\t}\n\t\t\n /*************** *****************\n\t\t Payments Arrays \n\t\t *********************************/\t\n\t\t\t// Onetime Payment\n\t\t\tif($duration == 0) \n\t\t\t{\n\t\t\t\t$payment_details = array(\n\t\t\t\t 'amount' => $payment[0]['payment_amount'],\n\t\t\t\t 'name' => 'Invoice Payment'\n\t\t\t\t \n\t\t\t\t);\n\t\t\t\t\n\t\t\t $payment_url = GoCardless::new_bill_url($payment_details);\n\t\t\t}\n\t\t\t//Need a subscription\n\t\t\telseif($duration > 0 && $type == 'subscription') \n\t\t\t{\n\t\t\t\t$payment_details = array(\n\t\t\t\t 'amount' => $payment[0]['payment_amount'],\n\t\t\t\t 'interval_length' => $duration, \n\t\t\t\t 'interval_unit' => 'month',\n\t\t\t\t 'name' => 'Monthly Subscription',\n\t\t\t\t);\n\t\t\t\t$payment_url = GoCardless::new_subscription_url($payment_details);\n\t\t\t}\n\t\t\t//Need a Pre Authorization\n\t\t\telseif($duration > 0 && $type == 'authorization') \n\t\t\t{\n\t\t\t\t# - Amount Taken from Customer\n\t\t\t\t$authorization_amount = Yii::app()->request->getParam('amount','0');\n\t\t\t\tif($authorization_amount >= $payment[0]['payment_amount'])\n\t\t\t\t\t$amount = $authorization_amount;\n\t\t\t\telse\n\t\t\t\t\t$amount = $payment[0]['payment_amount'];\n\t\t\t\t\t\n\t\t\t\t$payment_details = array(\n\t\t\t\t 'max_amount' => $amount,\n\t\t\t\t 'interval_length' => $duration, \n\t\t\t\t 'interval_unit' => 'month',\n\t\t\t\t 'name' => 'Pre-Authorization',\n\t\t\t\t);\n\t\t\t\t$payment_url = GoCardless::new_pre_authorization_url($payment_details);\n\t\t\t}\t\n\t\t\t\t# - Redirecting it to Payment Gateway - GoCardless\n\t\t\t\t$this->redirect( $payment_url );\n\t\t}\n\t\t\n\t}", "public function getPaymentMethod()\n {\n \n //Fill POST fields array\n $ipPostFields = [\n 'InvoiceAmount' => session()->get('total_price'),\n 'CurrencyIso' => 'KWD'\n ];\n \n //Call endpoint\n $paymentMethods = $this->initiatePayment($this->apiURL, $this->apiKey, $ipPostFields);\n \n \n return view('site.payment.checkout', compact('paymentMethods')); // redirect to the pay method in the service classe with the paymentmedthod id\n \n \n }", "public function payment(){\n\t\t$_POST['reference'] = date('NWHis');\n\t\techo json_encode($this->pagseguro->doPayment($_POST));\n\t}", "public function processPayment() {\n\n\t\t//create the GTPayConnector instance\n\t\t$gtpayConnector = new GTPayConnector();\n\n\t\t//create the VpcConfig instance\n\t\t$vpcConfig = new VpcConfig();\n\n\t\t//get the vpc xml object\n\t\t$vpcXMLConf = \"\";\n\t\t$vpcXMLConf = $vpcConfig->loadVpcConfig();\n\n\t\t// confirm that the configurations of vpc were loaded;\n\t\tif($vpcXMLConf == null) {\n\n\t\t\t//go to the error interface\n\t\t\t$data['error_msg'] = \"Could not Load the Virtual Payment client Details\";\n\t\t\t$data['page_titile'] = \"xxOnline shoe | error\";\n\t\t\t$data['responseData'] = \"\";\n\n\t\t\t$this->load->view(\"error-page\", $data);\n\t\t\t$this->load->view(\"partials/footer\");\n\t\t\treturn;\n\t\t}\n\n\t\t//get the vpc details\n\t\t$vpcUrl = $vpcConfig->getVpcURL($vpcXMLConf);\n\t\t$vpcSalt = $vpcConfig->getVpvSalt($vpcXMLConf);\n\t\t$vpcSaltType = $vpcConfig->getVpcSaltType($vpcXMLConf);\n\t\t$marchantcode = $vpcConfig->getCustomerCode($vpcXMLConf);\n\n\t\t//the transaction log\n\t\t$transactionLog = array();\n\n\t\t// set the salt\n\t\t$gtpayConnector->setSalt($vpcSalt);\n\n\t\t//remove the data that you dont need to send to the payment client\n\t\tunset($_POST['shoeimage']);\n\t\tunset($_POST['submit']);\n\t\t// add the customer code to the post data\n\t\t$_POST['gtp_CustomerCode'] = $marchantcode;\n\n\t\t//sort the post data before encrypting\n\t\tksort($_POST);\n\n\t\t//add the Virtual Payment Client post data to the transaction data\n\t\tforeach ($_POST as $key => $value) {\n\t\t\t\n\t\t\tif(strlen($value) > 0) {\n\t\t\t\t$gtpayConnector->addTransactionFields($key, $value);\n\n\t\t\t\t// add the post data to the transactionLog\n\t\t\t\t$transactionLog[$key] = $value;\n\t\t\t}\n\t\t}\n\t\t//get the date and time when the payment request is made\n\t\t$date = new DateTime();\n\t\t$date->setTimeZone(new DateTimeZone('UTC'));\n\t\t$transactionDate = $date->format('Y-m-d\\TH-i-s\\Z');\n\n\t\t//add the date of the transaction\n\t\t$transactionLog[\"transactDate\"] = $transactionDate;\n\n\t\t//log the trasaction on your database\n\t\t$this->transactions->logTransaction($transactionLog);\n\n\t\t// set the salt type\n\t\t$gtpayConnector->setSaltType($vpcSaltType);\n\n\t\t// make oneway hash of the Transaction and add it to the digital order\n\t\t$transactionHash = $gtpayConnector->hashAllTransactionData();\n\n\t\t$gtpayConnector->addTransactionFields(\"gtp_TransDate\", $transactionDate);\n\t\t$gtpayConnector->addTransactionFields(\"gtp_SecureHash\", $transactionHash);\n\t\t$gtpayConnector->addTransactionFields(\"gtp_SecureHashType\", $vpcSaltType);\n\n\t\t//obtain the redirection url\n\t\t$vpcUrl = $gtpayConnector->getDigitalOrderURL($vpcUrl);\n\n\t\t// send the payment request\n\t\theader(\"Location: \".$vpcUrl);\n\t}", "public function get_woo_pal_details() {\n\n\t\t$environment = $this->wc_gateway()->get_option( 'environment', 'live' );\n\n\t\t$api_prefix = '';\n\n\t\tif ( 'live' !== $environment ) {\n\t\t\t$api_prefix = 'sandbox_';\n\t\t}\n\n\t\t$this->setup_api_vars( $this->key, $environment, $this->wc_gateway()->get_option( $api_prefix . 'api_username' ), $this->wc_gateway()->get_option( $api_prefix . 'api_password' ), $this->wc_gateway()->get_option( $api_prefix . 'api_signature' ) );\n\n\t\t$this->add_parameter( 'METHOD', 'GetPalDetails' );\n\t\t$this->add_credentials_param( $this->api_username, $this->api_password, $this->api_signature, 124 );\n\t\t$request = new stdClass();\n\t\t$request->path = '';\n\t\t$request->method = 'POST';\n\t\t$request->body = $this->to_string();\n\n\t\treturn $this->perform_request( $request );\n\n\t}", "function regiomino_cart_paymentinfo() {\r\n\tglobal $base_url;\r\n/* \t$force_referer[] = 'checkout/shipping';\r\n\t$force_referer[] = 'checkout/payment';\r\n\t$force_referer[] = 'checkout/verify';\r\n\t$referer = str_replace($base_url . '/', \"\", $_SERVER['HTTP_REFERER']);\r\n\r\n\tif($referer != $force_referer[0] && $referer != $force_referer[1] && $referer != $force_referer[2]) {\r\n\t\tdrupal_set_message(t('Please follow the steps of the checkout process one after another'), 'warning');\r\n\t\tdrupal_goto('checkout/address');\r\n\t} */\r\n\t\r\n\t\r\n\t $coopprofile = node_load(3524);\r\n\t\t//var_dump($coopprofile->field_region);\r\n\t\r\n\tglobal $user;\r\n\tif ($user->uid) {\r\n\t\t$loggedin = TRUE;\r\n\t\t$cart_id = $user->uid;\r\n\t}\r\n\telse {\r\n\t\t$loggedin = FALSE;\r\n\t\t$cart_id = session_id();\r\n\t}\r\n\t//Load cart\r\n\t$empty = regiomino_cart_empty_cart($cart_id);\r\n\t//Set message if cart is empty\r\n\tif($empty) {\r\n\t\tdrupal_goto('cart');\r\n\t}\r\n\t\r\n\t//Make sure user logs in or registers before continuing to checkout\r\n\tif(!$loggedin) drupal_goto('user', array('query' => drupal_get_destination()));\r\n\t\r\n\t$content = drupal_get_form('regiomino_cart_paymentinfo_form');\t\r\n\treturn\ttheme('regiomino_cart_theme_payment', array(\r\n\t\t\t\t\t\t'vars' => array(\r\n\t\t\t\t\t\t\t'form' => $content,\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t));\r\n}", "public function getPaymentDate();", "public function getInfoMerchant()\n {\n\n $response = $this->client->request($this->methods['post'], 'payment_gateway_api/get_vendor', [\n 'json' => [\n 'VENDOR_ID' => $this->vendor_id,\n 'SIGN_TIME' => $this->generateSignTime(),\n 'SIGN_STRING' => md5($this->SECRET_KEY. $this->vendor_id. $this->sign_time)\n ]\n ]);\n\n return json_decode($response->getBody());\n }", "function print_result()\n{\n global $pxpay;\n \n $enc_hex = $_REQUEST[\"result\"];\n #getResponse method in PxPay object returns PxPayResponse object\n #which encapsulates all the response data\n $rsp = $pxpay->getResponse($enc_hex);\n \n \n # the following are the fields available in the PxPayResponse object\n $Success = $rsp->getSuccess(); # =1 when request succeeds\n $AmountSettlement = $rsp->getAmountSettlement();\n $AuthCode = $rsp->getAuthCode(); # from bank\n $CardName = $rsp->getCardName(); # e.g. \"Visa\"\n $CardNumber = $rsp->getCardNumber(); # Truncated card number\n $DateExpiry = $rsp->getDateExpiry(); # in mmyy format\n $DpsBillingId = $rsp->getDpsBillingId();\n $BillingId \t = $rsp->getBillingId();\n $CardHolderName = $rsp->getCardHolderName();\n $DpsTxnRef\t = $rsp->getDpsTxnRef();\n $TxnType = $rsp->getTxnType();\n $TxnData1 = $rsp->getTxnData1();\n $TxnData2 = $rsp->getTxnData2();\n $TxnData3 = $rsp->getTxnData3();\n $CurrencySettlement= $rsp->getCurrencySettlement();\n $ClientInfo = $rsp->getClientInfo(); # The IP address of the user who submitted the transaction\n $TxnId = $rsp->getTxnId();\n $CurrencyInput = $rsp->getCurrencyInput();\n $EmailAddress = $rsp->getEmailAddress();\n $MerchantReference = $rsp->getMerchantReference();\n $ResponseText\t\t = $rsp->getResponseText();\n $TxnMac = $rsp->getTxnMac(); # An indication as to the uniqueness of a card used in relation to others\n $RecurringMode = $rsp->getRecurringMode();\n \n \n if ($rsp->getSuccess() == \"1\")\n {\n $result = \"The transaction was approved.\";\n \n\t\t# Sending invoices/updating order status within database etc.\n \n if (!isProcessed($TxnId))\n {\n \n \n }\n \n }\n else\n {\n $result = \"The transaction was declined.\";\n }\n print <<<HTMLEOF\n <html>\n <head>\n <title>Payment Express PxPay transaction result</title>\n </head>\n <body>\n <h1>Payment Express PxPay transaction result</h1>\n <p>$result</p>\n <table border=1>\n\t<tr><th>Name</th>\t\t\t\t<th>Value</th> </tr>\n\t<tr><td>Success</td>\t\t\t<td>$Success</td></tr>\n\t<tr><td>TxnType</td>\t\t\t<td>$TxnType</td></tr>\n\t<tr><td>CurrencyInput</td>\t\t<td>$CurrencyInput</td></tr>\n\t<tr><td>MerchantReference</td>\t<td>$MerchantReference</td></tr>\n\t<tr><td>TxnData1</td>\t\t\t<td>$TxnData1</td></tr>\n\t<tr><td>TxnData2</td>\t\t\t<td>$TxnData2</td></tr>\n\t<tr><td>TxnData3</td>\t\t\t<td>$TxnData3</td></tr>\n\t<tr><td>AuthCode</td>\t\t\t<td>$AuthCode</td></tr>\n\t<tr><td>CardName</td>\t\t\t<td>$CardName</td></tr>\n\t<tr><td>CardHolderName</td>\t\t<td>$CardHolderName</td></tr>\n\t<tr><td>CardNumber</td>\t\t\t<td>$CardNumber</td></tr>\n\t<tr><td>DateExpiry</td>\t\t\t<td>$DateExpiry</td></tr>\n\t<tr><td>ClientInfo</td>\t\t\t<td>$ClientInfo</td></tr>\n\t<tr><td>TxnId</td>\t\t\t\t<td>$TxnId</td></tr>\n\t<tr><td>EmailAddress</td>\t\t<td>$EmailAddress</td></tr>\n\t<tr><td>DpsTxnRef</td>\t\t\t<td>$DpsTxnRef</td></tr>\n\t<tr><td>BillingId</td>\t\t\t<td>$BillingId</td></tr>\n\t<tr><td>DpsBillingId</td>\t\t<td>$DpsBillingId</td></tr>\n\t<tr><td>AmountSettlement</td>\t<td>$AmountSettlement</td></tr>\n\t<tr><td>CurrencySettlement</td>\t<td>$CurrencySettlement</td></tr>\n\t<tr><td>TxnMac</td>\t\t\t\t<td>$TxnMac</td></tr>\n <tr><td>ResponseText</td>\t\t<td>$ResponseText</td></tr>\n <tr><td>RecurringMode</td>\t\t<td>$RecurringMode</td></tr>\n </table>\n </body>\n </html>\nHTMLEOF;\n}", "public function getBilling();", "function get_payment_status()\n {\n return $this->platnosci_post_vars['payment_status'];\n }", "public function payment_fields() {\n\t\t$message = $this->get_sandbox_form_message( $this->get_transaction_address( 'country' ) );\n\t\twc_get_template(\n\t\t\t'sandbox-checkout-alert.php',\n\t\t\tarray(\n\t\t\t\t'is_sandbox_mode' => $this->is_sandbox_mode,\n\t\t\t\t'message' => $message,\n\t\t\t),\n\t\t\t'woocommerce/ebanx/',\n\t\t\tWC_EBANX::get_templates_path()\n\t\t);\n\n\t\t$description = $this->get_description();\n\t\tif ( isset( $description ) ) {\n\t\t\techo wp_kses_post( wpautop( wptexturize( $description ) ) );\n\t\t}\n\n\t\twc_get_template(\n\t\t\t'tef/payment-form.php',\n\t\t\tarray(\n\t\t\t\t'title' => $this->title,\n\t\t\t\t'description' => $this->description,\n\t\t\t\t'id' => $this->id,\n\t\t\t),\n\t\t\t'woocommerce/ebanx/',\n\t\t\tWC_EBANX::get_templates_path()\n\t\t);\n\n\t\tparent::checkout_rate_conversion( WC_EBANX_Constants::CURRENCY_CODE_BRL );\n\t}", "public function payment_details(){\n\t\t\t\n\t\t\t$this->input->post(NULL, TRUE); // returns all POST items with XSS filter\n\t\t\t\n\t\t\t//escaping the post values\n\t\t\t$pid = html_escape($this->input->post('id'));\n\t\t\t$id = preg_replace('#[^0-9]#i', '', $pid); // filter everything but numbers\n\t\t\t\n\t\t\t$detail = $this->db->select('*')->from('payments')->where('id',$id)->get()->row();\n\t\t\t\n\t\t\tif($detail){\n\n\t\t\t\t\t$data['id'] = $detail->id;\n\t\t\t\t\t\n\t\t\t\t\t$data['headerTitle'] = $detail->reference;\t\t\t\n\n\t\t\t\t\t$data['total_amount'] = $detail->total_amount;\n\t\t\t\t\t$data['payment_method'] = $detail->payment_method;\n\t\t\t\t\t$data['customer_email'] = $detail->customer_email;\n\t\t\t\t\t\n\t\t\t\t\t$user_array = $this->Users->get_user($detail->customer_email);\n\t\t\t\t\t\n\t\t\t\t\t$fullname = '';\n\t\t\t\t\tif($user_array){\n\t\t\t\t\t\tforeach($user_array as $user){\n\t\t\t\t\t\t\t$fullname = $user->first_name.' '.$user->last_name;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$data['customer'] = $fullname;\n\t\t\t\t\t$data['payment_date'] = date(\"l, F j, Y g:i a\", strtotime($detail->payment_date));\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t$data['model'] = 'payments';\n\t\t\t\t\t$data['success'] = true;\n\t\t\t\t\t\n\t\t\t}else {\n\t\t\t\t$data['success'] = false;\n\t\t\t}\n\t\t\t\n\t\t\techo json_encode($data);\n\t\t\t\n\t\t}", "public function getPaymentAdditionalInfo(Varien_Object $payment, $key=null)\n {\n $info = $payment->getAdditionalInformation();\n\n if (!is_array($info)) {\n return null;\n }\n\n if (!$key) {\n return $info;\n }\n\n if (!isset($info[$key])) {\n return null;\n }\n\n return $info[$key];\n }", "protected function getPaymentModel()\n {\n return Mage::getModel('paynow/payment');\n }", "public function action_payments() {\n $package = Model::factory('package');\n $postvalue = $errors = array();\n $postvalue = $this->request->post();\n $payment_gateway_id= isset($postvalue['payment_gateway_type'])?$postvalue['payment_gateway_type']:0;\n \n $payment_settings = $package->get_payment_details($payment_gateway_id);\n $paypal_payment_settings=$package->get_paypal_payment_details();\n //echo \"<pre>\"; print_r($payment_settings); exit;\n $this->template->meta_description = CLOUD_SITENAME . \" | Payments \";\n $this->template->meta_keywords = CLOUD_SITENAME . \" | Payments \";\n $this->template->title = CLOUD_SITENAME . \" | \" . __('Payments');\n $this->template->page_title = __('Payments');\n \n if (class_exists('Paymentgateway')) { \n $payment_gateway_list = Paymentgateway::payment_auth_credentials_view();\n \n } else {\n trigger_error(\"Unable to load class: Paymentgateway\", E_USER_WARNING);\n }\n \n $form_top_fields= isset($payment_gateway_list[1])?$payment_gateway_list[1]:[];\n $form_fields= isset($payment_gateway_list[2])?$payment_gateway_list[2]:[];\n $form_live_fields= isset($payment_gateway_list[3])?$payment_gateway_list[3]:[];\n $form_bottom_fields= isset($payment_gateway_list[4])?$payment_gateway_list[4]:[];\n\n $this->template->content = View::factory(\"admin/package_plan/payments\")\n ->bind('payment_settings', $payment_settings)\n ->bind('paypal_payment_settings',$paypal_payment_settings)\n ->bind('form_top_fields', $form_top_fields)\n ->bind('form_fields', $form_fields)\n ->bind('form_live_fields', $form_live_fields)\n ->bind('form_bottom_fields', $form_bottom_fields)\n ->bind('payment_gateway_list',$payment_gateway_list[0])\n ->bind('postvalue', $postvalue)\n ->bind('errors', $errors);\n }", "public function callbackhostedpaymentAction()\n {\n $boError = false;\n $formVariables = array();\n $model = Mage::getModel('paymentsensegateway/direct');\n $szOrderID = $this->getRequest()->getPost('OrderID');\n $checkout = Mage::getSingleton('checkout/type_onepage');\n $session = Mage::getSingleton('checkout/session');\n $szPaymentProcessorResponse = '';\n $order = Mage::getModel('sales/order');\n $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());\n $nVersion = Mage::getModel('paymentsensegateway/direct')->getVersion();\n $boCartIsEmpty = false;\n \n try\n {\n $hmHashMethod = $model->getConfigData('hashmethod');\n $szPassword = $model->getConfigData('password');\n $szPreSharedKey = $model->getConfigData('presharedkey');\n \n $formVariables['HashDigest'] = $this->getRequest()->getPost('HashDigest');\n $formVariables['MerchantID'] = $this->getRequest()->getPost('MerchantID');\n $formVariables['StatusCode'] = $this->getRequest()->getPost('StatusCode');\n $formVariables['Message'] = $this->getRequest()->getPost('Message');\n $formVariables['PreviousStatusCode'] = $this->getRequest()->getPost('PreviousStatusCode');\n $formVariables['PreviousMessage'] = $this->getRequest()->getPost('PreviousMessage');\n $formVariables['CrossReference'] = $this->getRequest()->getPost('CrossReference');\n $formVariables['Amount'] = $this->getRequest()->getPost('Amount');\n $formVariables['CurrencyCode'] = $this->getRequest()->getPost('CurrencyCode');\n $formVariables['OrderID'] = $this->getRequest()->getPost('OrderID');\n $formVariables['TransactionType'] = $this->getRequest()->getPost('TransactionType');\n $formVariables['TransactionDateTime'] = $this->getRequest()->getPost('TransactionDateTime');\n $formVariables['OrderDescription'] = $this->getRequest()->getPost('OrderDescription');\n $formVariables['CustomerName'] = $this->getRequest()->getPost('CustomerName');\n $formVariables['Address1'] = $this->getRequest()->getPost('Address1');\n $formVariables['Address2'] = $this->getRequest()->getPost('Address2');\n $formVariables['Address3'] = $this->getRequest()->getPost('Address3');\n $formVariables['Address4'] = $this->getRequest()->getPost('Address4');\n $formVariables['City'] = $this->getRequest()->getPost('City');\n $formVariables['State'] = $this->getRequest()->getPost('State');\n $formVariables['PostCode'] = $this->getRequest()->getPost('PostCode');\n $formVariables['CountryCode'] = $this->getRequest()->getPost('CountryCode');\n \n if(!PYS_PaymentFormHelper::compareHostedPaymentFormHashDigest($formVariables, $szPassword, $hmHashMethod, $szPreSharedKey))\n {\n $boError = true;\n $szNotificationMessage = \"The payment was rejected for a SECURITY reason: the incoming payment data was tampered with.\";\n Mage::log(\"The Hosted Payment Form transaction couldn't be completed for the following reason: [\".$szNotificationMessage. \"]. Form variables: \".print_r($formVariables, 1));\n }\n else\n {\n $paymentsenseOrderId = Mage::getSingleton('checkout/session')->getPaymentsensegatewayOrderId();\n $szOrderStatus = $order->getStatus();\n $szStatusCode = $this->getRequest()->getPost('StatusCode');\n $szMessage = $this->getRequest()->getPost('Message');\n $szPreviousStatusCode = $this->getRequest()->getPost('PreviousStatusCode');\n $szPreviousMessage = $this->getRequest()->getPost('PreviousMessage');\n $szOrderID = $this->getRequest()->getPost('OrderID');\n \n if($szOrderStatus != 'pys_paid' &&\n $szOrderStatus != 'pys_preauth')\n {\n $checkout->saveOrderAfterRedirectedPaymentAction(true,\n $this->getRequest()->getPost('StatusCode'),\n $this->getRequest()->getPost('Message'),\n $this->getRequest()->getPost('PreviousStatusCode'),\n $this->getRequest()->getPost('PreviousMessage'),\n $this->getRequest()->getPost('OrderID'),\n $this->getRequest()->getPost('CrossReference'));\n }\n else \n {\n // cart is empty\n $boCartIsEmpty = true;\n $szPaymentProcessorResponse = null;\n \n // chek the StatusCode as the customer might have just clicked the BACK button and re-submitted the card details\n // which can cause a charge back to the merchant\n $this->_fixBackButtonBug($szOrderID, $szStatusCode, $szMessage, $szPreviousStatusCode, $szPreviousMessage);\n }\n }\n }\n catch (Exception $exc)\n {\n $boError = true;\n $szNotificationMessage = Paymentsense_Paymentsensegateway_Model_Common_GlobalErrors::ERROR_183;\n Mage::logException($exc);\n }\n \n $szPaymentProcessorResponse = $session->getPaymentprocessorresponse();\n if($boError)\n {\n if($szPaymentProcessorResponse != null &&\n $szPaymentProcessorResponse != '')\n {\n $szNotificationMessage = $szNotificationMessage.'<br/>'.$szPaymentProcessorResponse;\n }\n \n $model->setPaymentAdditionalInformation($order->getPayment(), $this->getRequest()->getPost('CrossReference'));\n //$order->getPayment()->setTransactionId($this->getRequest()->getPost('CrossReference'));\n \n if($nVersion >= 1410)\n {\n if($order)\n {\n $orderState = 'pending_payment';\n $orderStatus = 'pys_failed_hosted_payment';\n $order->setCustomerNote(Mage::helper('paymentsensegateway')->__('Hosted Payment Failed'));\n $order->setState($orderState, $orderStatus, $szPaymentProcessorResponse, false);\n $order->save();\n }\n }\n if($nVersion == 1324 || $nVersion == 1330)\n {\n Mage::getSingleton('checkout/session')->addError($szNotificationMessage);\n }\n else \n {\n Mage::getSingleton('core/session')->addError($szNotificationMessage);\n }\n $order->save();\n \n $this->_clearSessionVariables();\n $this->_redirect('checkout/onepage/failure');\n }\n else\n {\n // set the quote as inactive after back from paypal\n Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();\n\n if($boCartIsEmpty == false)\n {\n // send confirmation email to customer\n if($order->getId())\n {\n $order->sendNewOrderEmail();\n }\n \n if($nVersion >= 1410)\n {\n // TODO : no need to remove stock item as the system will do it in 1.6 version\n if($nVersion < 1600)\n {\n $model->subtractOrderedItemsFromStock($order);\n }\n $this->_updateInvoices($order, $szPaymentProcessorResponse);\n }\n \n if($nVersion != 1324 && $nVersion != 1330)\n {\n if($szPaymentProcessorResponse != '')\n {\n Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);\n }\n }\n }\n \n $this->_redirect('checkout/onepage/success', array('_secure' => true));\n }\n }", "public function submitPayment()\n {\n return array('error'=>0, 'transactionReference'=>'');\n \n }", "public function getCheckout()\n\t{\n\t\tMage::log(\" --- Snap* Hosted Payments API : getCheckout --- \");\n\t\treturn Mage::getSingleton('checkout/session');\n\t}", "public function bluepay_capture_payment($params)\n\t{\n\t\t$this->_api_method = 'CAPTURE';\n\t\t$this->_request = $this->_build_request($params);\t\t\t\n\t\treturn $this->_handle_query();\n\t}", "public function getPaymentName()\n {\n return 'Pagosonline';\n }", "public function calculatePayment()\n {\n }", "public function getPaymentDetail($data) {\n\t\t// provide the EziDebit API endpoint\n\t\t$soapclient = new SoapClient($this->nonPci);\n\n\t\t$params = [\n\t\t\t\t'DigitalKey' => $this->digitalKey,\n\t\t\t\t'PaymentReference' => $data['paymentReference']\n\t\t];\n\n\t\treturn $response = $soapclient->getPaymentDetail($params);\n\t}", "public function getPaymentAction()\n\t{\n\t\t$this->_ajaxValidation();\n\t\t$response['content']=$this->_getPaymentHtml();\n\t\t$this->getResponse()->setBody(json_encode($response));\n\t}", "public function createPayment()\n\t{\n\n\t}", "public function getFields()\n {\n $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();\n $order = Mage::getModel('sales/order')->load($orderId);\n\n $fields = array();\n\n $fields['VK_SERVICE'] = '1012';\n $fields['VK_VERSION'] = '008';\n $fields['VK_SND_ID'] = substr(Mage::getStoreConfig('payment/' . $this->_code . '/vk_snd_id'),0,15);\n $fields['VK_STAMP'] = substr($order->getIncrementId(),0,20);\n $fields['VK_AMOUNT'] = number_format($order->getTotalDue(), 2, '.', '');\n $fields['VK_CURR'] = $order->getOrderCurrencyCode();\n $fields['VK_REF'] = '';\n $fields['VK_MSG'] = __('Order number') . ' ' . $order->getIncrementId();\n\t\t$fields['VK_ENCODING'] = 'UTF-8';\n\n $fields = $this->modifyData($fields);\n\n $fields['VK_RETURN'] = $this->getReturnUrl();\n\t\t$fields['VK_CANCEL'] = $this->getReturnUrl();\n\t\t$fields['VK_DATETIME'] = Mage::getModel('core/date')->date(DATE_ISO8601); //'Y-m-d\\TH:i:sO'\n\n $fields['VK_MAC'] = $this->signData($this->prepareData($fields));\n\n switch ( Mage::app()->getLocale()->getLocaleCode() ) {\n case 'et_EE':\n $language = 'EST';\n break;\n case 'lt_LT':\n $language = 'LIT';\n break;\n case 'lv_LV':\n $language = 'LAT';\n break;\n case 'ru_RU':\n $language = 'RUS';\n break;\n default:\n $language = 'ENG';\n break;\n }\n\n $fields['VK_LANG'] = $language;\n\n return $fields;\n }", "public function getPaymentType(){\n return $this->payment_type;\n }", "protected function getPaymentTransactionStructure()\n {\n return [\n 'amount' => $this->transformAmount($this->amount, $this->currency),\n 'currency' => $this->currency,\n 'bank_code' => $this->bank_code,\n 'return_success_url' => $this->return_success_url,\n 'return_failure_url' => $this->return_failure_url,\n 'customer_email' => $this->customer_email,\n 'customer_phone' => $this->customer_phone,\n 'payment_type' => $this->payment_type,\n 'document_id' => $this->document_id,\n 'billing_address' => $this->getBillingAddressParamsStructure(),\n 'shipping_address' => $this->getShippingAddressParamsStructure()\n ];\n }", "public function fields() {\n $ID = $this->order['id'];\n $BUYCODE = $this->order['code'];\n $url = (mswSSL() == 'yes' ? str_replace('http://', 'https://', BASE_HREF) : BASE_HREF);\n $order = $this->getsale($ID, $BUYCODE);\n $params = $this->params();\n $timestamp = time();\n $name = $this->firstLastName($order->name);\n $country = $this->country($_POST['country']);\n $amount = $this->saletotal($order);\n $arr = array(\n 'x_login' => $params['login-id'],\n 'x_amount' => $amount,\n 'x_description' => $this->stripchars($this->lang[2]),\n 'x_invoice_num' => $ID,\n 'x_fp_sequence' => $ID,\n 'x_fp_timestamp' => $timestamp,\n 'x_fp_hash' => mmGateway::submissionhash($timestamp, $params, $ID, $amount),\n 'x_test_request' => ($this->settings->paymode == 'live' ? 'false' : 'true'),\n 'x_show_form' => 'PAYMENT_FORM',\n 'x_type' => 'AUTH_CAPTURE',\n 'x_first_name' => $this->stripchars($name['first-name']),\n 'x_last_name' => $this->stripchars($name['last-name']),\n 'x_address' => $this->stripchars($_POST['address1'] . ($_POST['address2'] ? ', ' . $_POST['address2'] : '')),\n 'x_email' => $this->stripchars($order->email),\n 'x_city' => $this->stripchars($_POST['city']),\n 'x_state' => $this->stripchars($_POST['county']),\n 'x_zip' => $this->stripchars($_POST['postcode']),\n 'x_country' => $this->stripchars($country->name),\n 'x_ship_to_first_name' => $this->stripchars($name['first-name']),\n 'x_ship_to_last_name' => $this->stripchars($name['last-name']),\n 'x_ship_to_address' => $this->stripchars($_POST['address1'] . ($_POST['address2'] ? ', ' . $_POST['address2'] : '')),\n 'x_ship_to_city' => $this->stripchars($_POST['city']),\n 'x_ship_to_state' => $this->stripchars($_POST['county']),\n 'x_ship_to_zip' => $this->stripchars($_POST['postcode']),\n 'x_ship_to_country' => $this->stripchars($country->name),\n 'x_relay_response' => 'false',\n 'x_cancel_url' => $url . $this->seo->url('cancel', array(), 'yes'),\n 'x_receipt_method' => 'POST',\n 'x_receipt_link_text' => $this->stripchars(str_replace('{store}', $this->settings->website, $this->lang[5])),\n 'x_receipt_link_url' => $url . 'index.php?gw=' . $ID . '-' . $BUYCODE\n );\n // Only include currency code for live server..\n // Seems to throw errors for test server..\n // If this throws (99) errors on live, uncomment..\n if ($this->settings->paymode == 'live') {\n $arr['x_currency_code'] = (in_array($this->settings->currency, array(\n 'USD',\n 'GBP',\n 'CAD',\n 'EUR'\n )) ? $this->settings->currency : 'USD');\n }\n return $arr;\n }", "function payment_fields() {\n?>\n\t\t<?php if ($this->tran_mode=='sandbox') : ?><p><?php _e('TEST MODE/SANDBOX ENABLED', WC_Authorize_SIM::TEXT_DOMAIN); ?></p><?php endif; ?>\n\t\t<?php if ($this->description) : ?><p><?php echo wpautop(wptexturize($this->description)); ?></p><?php endif; ?>\n<?php\n\n\t}", "public function payment_fields() {\n\t\t$message = $this->get_sandbox_form_message( $this->get_transaction_address( 'country' ) );\n\t\twc_get_template(\n\t\t\t'sandbox-checkout-alert.php',\n\t\t\tarray(\n\t\t\t\t'is_sandbox_mode' => $this->is_sandbox_mode,\n\t\t\t\t'message' => $message,\n\t\t\t),\n\t\t\t'woocommerce/ebanx/',\n\t\t\tWC_EBANX::get_templates_path()\n\t\t);\n\n\t\t$description = $this->get_description();\n\t\tif ( isset( $description ) ) {\n\t\t\techo wp_kses_post( wpautop( wptexturize( $description ) ) );\n\t\t}\n\n\t\twc_get_template(\n\t\t\t'debit-card/payment-form.php',\n\t\t\tarray(\n\t\t\t\t'cart_total' => $this->get_order_total(),\n\t\t\t\t'id' => $this->id,\n\t\t\t),\n\t\t\t'woocommerce/ebanx/',\n\t\t\tWC_EBANX::get_templates_path()\n\t\t);\n\n\t\tparent::checkout_rate_conversion( WC_EBANX_Constants::CURRENCY_CODE_MXN );\n\n\t\twc_get_template(\n\t\t\t'bacen-international-alert.php',\n\t\t\tarray(\n\t\t\t\t'is_international' => $this->is_international(),\n\t\t\t),\n\t\t\t'woocommerce/ebanx/',\n\t\t\tWC_EBANX::get_templates_path()\n\t\t);\n\t}", "public function getProviderCreditDetails($requestParameters = array());", "public function getIPNTransactionDetails(TPkgShopPaymentIPNRequest $oRequest);", "private function getPaymentId()\n {\n return Session::get('mall.payment.id');\n }", "public function getinfo() { \n return $this->bitcoin->getinfo();\n }", "function paystack_config()\n{\n return array(\n 'FriendlyName' => array(\n 'Type' => 'System',\n 'Value' => 'Paystack (Debit/Credit Cards)'\n ),\n 'whmcsurl' => array(\n 'FriendlyName' => 'Whmcs Url',\n 'Type' => 'text',\n 'Value' => 'Website Url'\n ),\n 'sitename' => array(\n 'FriendlyName' => 'Site Name',\n 'Type' => 'text',\n 'Value' => 'Website Name'\n ),\n 'gatewayLogs' => array(\n 'FriendlyName' => 'Gateway logs',\n 'Type' => 'yesno',\n 'Description' => 'Tick to enable gateway logs',\n 'Default' => '0'\n ),\n 'testMode' => array(\n 'FriendlyName' => 'Test Mode',\n 'Type' => 'yesno',\n 'Description' => 'Tick to enable test mode',\n 'Default' => '0'\n ),\n 'liveSecretKey' => array(\n 'FriendlyName' => 'Live Secret Key',\n 'Type' => 'text',\n 'Size' => '32',\n 'Default' => 'sk_live_xxx'\n ),\n 'livePublicKey' => array(\n 'FriendlyName' => 'Live Public Key',\n 'Type' => 'text',\n 'Size' => '32',\n 'Default' => 'pk_live_xxx'\n ),\n 'testSecretKey' => array(\n 'FriendlyName' => 'Test Secrect Key',\n 'Type' => 'text',\n 'Size' => '32',\n 'Default' => 'sk_test_xxx'\n ),\n 'testPublicKey' => array(\n 'FriendlyName' => 'Test Public Key',\n 'Type' => 'text',\n 'Size' => '32',\n 'Default' => 'pk_test_xxx'\n ),\n 'whmcsuser' => array(\n 'FriendlyName' => 'WHMCS Username',\n 'Type' => 'text',\n 'Size' => '25',\n 'Default' => '',\n 'Description' => 'Enter your WHMCS API Username here',\n ),\n 'senderemail' => array(\n 'FriendlyName' => 'Sender Email',\n 'Type' => 'text',\n 'Value' => 'Sender Email'\n )\n );\n}", "public function getPaymentResponse()\r\n {\r\n $reason_text = $this->request_data['Message'];\r\n $order_status = '';\r\n $transaction_id = $this->request_data['CrossReference'] ;\r\n switch ($this->request_data['StatusCode']) {\r\n case self::TRX_RESULT_CODE_SUCCESS:\r\n $order_status = self::CSCART_ORDER_STATUS_PROCESSED;\r\n break;\r\n case self::TRX_RESULT_CODE_DUPLICATE:\r\n if (self::TRX_RESULT_CODE_SUCCESS === $this->request_data['PreviousStatusCode']) {\r\n if (array_key_exists('PreviousMessage', $this->request_data)) {\r\n $reason_text = $this->request_data['PreviousMessage'];\r\n }\r\n $order_status = self::CSCART_ORDER_STATUS_PROCESSED;\r\n } else {\r\n $order_status = self::CSCART_ORDER_STATUS_FAILED;\r\n }\r\n break;\r\n case self::TRX_RESULT_CODE_REFERRED:\r\n case self::TRX_RESULT_CODE_DECLINED:\r\n case self::TRX_RESULT_CODE_FAILED:\r\n $order_status = self::CSCART_ORDER_STATUS_FAILED;\r\n break;\r\n }\r\n\r\n return [\r\n 'reason_text' => $reason_text,\r\n 'order_status' => $order_status,\r\n 'transaction_id' => $transaction_id\r\n ];\r\n }", "public function getPaymentDetails($accountID)\n {\n return $this->db->order_by('order_id', 'desc')->where('ID_ACCOUNT',$accountID)->where('charge_type','Principal')->where('status IS NULL')->get(\"payment_details\")->result_array();\n }", "function _get_payment_address()\n\t{\n\t\treturn trim(ecommerce_test_mode()?get_option('ipn_test'):get_option('ipn'));\n\t}", "public function after_payment_method_details() {\n\n\t\t$key = isset( $_GET['order'] ) ? $_GET['order'] : '';\n\n\t\t$order = llms_get_order_by_key( $key );\n\t\tif ( ! $order ) {\n\t\t\treturn;\n\t\t} elseif ( 'paypal' !== $order->get( 'payment_gateway' ) ) {\n\t\t\tif ( ! isset( $_GET['confirm-switch'] ) || 'paypal' !== $_GET['confirm-switch'] ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t$req = new LLMS_PayPal_Request( $this );\n\t\t$r = $req->get_express_checkout_details( $_GET['token'] );\n\n\t\techo '<input name=\"llms_paypal_token\" type=\"hidden\" value=\"' . $_GET['token'] . '\">';\n\t\techo '<input name=\"llms_paypal_payer_id\" type=\"hidden\" value=\"' . $_GET['PayerID'] . '\">';\n\n\t\tif ( isset( $r['EMAIL'] ) ) {\n\t\t\techo '<div class=\"\"><span class=\"llms-label\">' . __( 'PayPal Email:', 'lifterlms-paypal' ) . '</span> ' . $r['EMAIL'] . '</div>';\n\t\t}\n\n\t}", "private function parsePaymentBody($paymentResponse){\n $this->paymentBody = json_decode($paymentResponse->getBody()->getContents());\n \n $this->paypal_id = $this->paymentBody->id;\n //get the paypal process links from the response\n foreach ($this->paymentBody->links as $link){\n //this is the link for the payer top approve the payment\n if ($link->rel == \"approval_url\"){\n $this->approval_url = $link->href;\n }\n if ($link->rel == \"execute\"){\n $this->execute_url = $link->href;\n }\n if ($link->rel == \"self\"){\n $this->self_url = $link->href;\n }\n\n }\n if (isset($this->paymentBody->payer->payer_info->payer_id)){\n $this->payer_id = $this->paymentBody->payer->payer_info->payer_id;\n }\n \n }", "private function add_transaction_info($post)\n {\n global $woocommerce;\n $orderId = $post['x_invoice_num'];\n $order = new WC_Order($orderId);\n $message = __('Server Paysto payment system return data in post: ', 'woocommerce') .\n print_r($post, true);\n $order->add_order_note($message);\n return;\n }", "public function getPaymentHash()\n {\n return $this->payment_hash;\n }", "function get_payment_status()\n {\n return $this->paypal_post_vars['payment_status'];\n }", "public function getBillingAgreementDetails($requestParameters = array());", "public function test()\n\n {\n\n// $balance = $pm->getBalance();\n\n dd(env('PM_PAYMENT_URL'));\n\n// if($balance['status'] == 'success')\n\n// {\n\n// return $balance['USD'];\n\n// }\n\n\n\n }", "public function payment_fields() {\n echo '<p><strong>Pay securely using your credit card</strong> <img src=\"' . plugins_url() . '/woocommerce-pay-fabric/images/visa.svg\" alt=\"Visa\" class=\"card-img\" width=\"32\"> <img src=\"' . plugins_url() . '/woocommerce-pay-fabric/images/mastercard.svg\" alt=\"Mastercard\" class=\"card-img\" width=\"32\"> <img src=\"' . plugins_url() . '/woocommerce-pay-fabric/images/discover.svg\" alt=\"Discover\" class=\"card-img\" width=\"32\"> <img src=\"' . plugins_url() . '/woocommerce-pay-fabric/images/amex.svg\" alt=\"Amex\" class=\"card-img\" width=\"32\"></p>';\n // Trying render payment form\n // Call orginal payment the Woocommerce\n $this->form();\n }", "public function whmcs_capture_payment($params = array()) {\n\t\t$params['action'] = 'CapturePayment';\n\t\t// return Whmcs_base::send_request($params);\n $load = new Whmcs_base();\n return $load->send_request($params);\n\t}", "public function getStatusPayment()\r\n {\r\n return $this->statusPayment;\r\n }", "public function getWechatPay()\n {\n return $this->get(self::wechat_pay);\n }", "public function payment_fields() {\n\t\t$description = $this->get_description();\n\n\t\tif ( 'yes' == $this->sandbox ) {\n\t\t\t$description .= ' ' . sprintf( __( 'TEST MODE ENABLED. Use a test card: %s', 'woocommerce' ), '<a href=\"https://www.simplify.com/commerce/docs/tutorial/index#testing\">https://www.simplify.com/commerce/docs/tutorial/index#testing</a>' );\n\t\t}\n\n\t\tif ( $description ) {\n\t\t\techo wpautop( wptexturize( trim( $description ) ) );\n\t\t}\n\t}", "public function pay(): JsonResponse;" ]
[ "0.7720097", "0.7406579", "0.7180323", "0.6895206", "0.68616605", "0.6849942", "0.6826235", "0.6810686", "0.67703545", "0.67139083", "0.6651937", "0.6604245", "0.6531639", "0.64967364", "0.64831966", "0.64774376", "0.6443647", "0.6422266", "0.6381054", "0.6381054", "0.6381054", "0.63133913", "0.63000846", "0.6277871", "0.6265799", "0.6258825", "0.62542695", "0.62417364", "0.61825275", "0.61785316", "0.61708146", "0.6145392", "0.61263233", "0.61214983", "0.61068684", "0.61039644", "0.60951054", "0.60875815", "0.608193", "0.6081564", "0.60789126", "0.60589135", "0.6014647", "0.59975016", "0.59967387", "0.59957576", "0.5984788", "0.59845835", "0.598297", "0.5972603", "0.5964432", "0.59490955", "0.59376836", "0.59362644", "0.59265345", "0.5926096", "0.592316", "0.5922408", "0.5887275", "0.58861166", "0.5885484", "0.58650607", "0.5864321", "0.5855501", "0.5850309", "0.58431816", "0.5840565", "0.5838724", "0.5827952", "0.58077455", "0.5807031", "0.5799056", "0.57939285", "0.57917434", "0.5781739", "0.5770231", "0.5768132", "0.57660717", "0.57637644", "0.5760271", "0.57574606", "0.57567924", "0.57527566", "0.5749376", "0.5747579", "0.5742554", "0.573343", "0.5725349", "0.57227445", "0.5722727", "0.57161194", "0.5714166", "0.57107216", "0.56975734", "0.56968457", "0.5693679", "0.56882113", "0.5682549", "0.5681317", "0.5676378", "0.56754416" ]
0.0
-1
Get all combat units attached to this formation
function get_by_formation($formation_id) { return $this->db->query('SELECT * FROM combatunits WHERE formation_id='.$formation_id)->result(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function unitsCombo()\n\t{\n\t\treturn Unit::all();\n\t}", "public function getUnits()\n {\n return $this->hasMany(Unit::className(), ['patient_ar_gl_acc_id' => 'account_id']);\n }", "public static function retrieveAllUnits() {\n return R::getAll('SELECT * FROM unit');\n }", "public static function all() {\n $units = array();\n $rows = DB::query('SELECT * FROM Unit ORDER BY name_singular ASC');\n \n foreach ($rows as $row) {\n $units[] = self::create_unit($row);\n }\n \n return $units;\n }", "protected function getAllUnits()\n {\n if (null === $this->_all_units) {\n $all = array_merge(\n $this->getLengthUnits(),\n $this->getWeightUnits()\n );\n $this->_all_units = [];\n foreach ($all as $unit) {\n $this->_all_units[$unit['attribute_id']] = $unit;\n }\n }\n\n return $this->_all_units;\n }", "public function all_units()\n\t{\n\t\t$this->db->where('units_status = 1');\n\t\t$query = $this->db->get('units');\n\t\t\n\t\treturn $query;\n\t}", "public function getUnitats()\n {\n return $this->unitats;\n }", "public function getMeasureUnitList()\n {\n if ( $this->measureunits->count() )\n return $this->measureunits->pluck('name', 'id')->toArray();\n\n return MeasureUnit::pluck('name', 'id')->toArray();\n }", "public function get_units()\n\t{\n\t\t$ol = new object_list(array(\n\t\t\t\"class_id\" => CL_UNIT,\n\t\t\t\"status\" => object::STAT_ACTIVE,\n\t\t));\n\t\treturn $ol;\n\t}", "function getAll() {\r\n\t\t$cond = new Criteria();\r\n\t\t$alls = MeasureUnitPeer::doSelect($cond);\r\n\t\treturn $alls;\r\n }", "public function getUnits(){\n\n\t\t $this->db->where('delete_status',0);\n\t $query=$this->db->get('unit'); \n\t return $query->result();\n\n\t}", "public function get_weapons() {\n return $this->get_items_by_type(static::$WEAPONS);\n }", "public function all_child_units()\n\t{\n\t\t$this->db->where('units_status = 1 AND units_parent > 0');\n\t\t$this->db->order_by('units_name', 'ASC');\n\t\t$query = $this->db->get('units');\n\t\t\n\t\treturn $query;\n\t}", "public function query()\n {\n return MeasurementsUnits::query()->select(['id', 'name','abbreviation']);\n }", "public function availableSpells()\n {\n return $this->possibleSpells;\n }", "public function get_units($units_id)\n\t{\n\t\t//retrieve all users\n\t\t$this->db->from('units');\n\t\t$this->db->select('*');\n\t\t$this->db->where('units_id = '.$units_id);\n\t\t$query = $this->db->get();\n\t\t\n\t\treturn $query;\n\t}", "public function findUnitsForCondo(Condominium $condo)\n {\n return $this->createQueryBuilder('unit')\n ->join('unit.condominium', 'condo')\n ->where('condo = :condo')\n ->setParameter('condo', $condo);\n }", "public function findAllUnitForUnitType(UnitType $unitType)\n {\n return $this->createQueryBuilder('unit')\n ->join('unit.type', 'type')\n ->where('type = :type')\n ->setParameter('type', $unitType);\n }", "public function load_units() {\n\n\t\t// Get our current master list of units.\n\t\t$master_units = $this->get_cahnrs_units();\n\n\t\t// Get our current list of top level units.\n\t\t$current_units = get_terms( $this->cahnrs_units, array( 'hide_empty' => false ) );\n\t\t$current_units = wp_list_pluck( $current_units, 'name' );\n\n\t\tforeach ( $master_units as $unit => $child_units ) {\n\n\t\t\t$parent_id = false;\n\n\t\t\t// If the parent unit is not a term yet, insert it.\n\t\t\tif ( ! in_array( $unit, $current_units ) ) {\n\t\t\t\t$new_term = wp_insert_term( $unit, $this->cahnrs_units, array( 'parent' => 0 ) );\n\t\t\t\t$parent_id = $new_term['term_id'];\n\t\t\t}\n\n\t\t\t// Loop through the parent's children to check term existence.\n\t\t\tforeach( $child_units as $child_unit ) {\n\t\t\t\tif ( ! in_array( $child_unit, $current_units ) ) {\n\t\t\t\t\tif ( ! $parent_id ) {\n\t\t\t\t\t\t$parent = get_term_by( 'name', $unit, $this->cahnrs_units );\n\t\t\t\t\t\tif ( isset( $parent->id ) ) {\n\t\t\t\t\t\t\t$parent_id = $parent->id;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$parent_id = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\twp_insert_term( $child_unit, $this->cahnrs_units, array( 'parent' => $parent_id ) );\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t}", "public function get_cahnrs_units() {\n\n\t\t$units = array();\n\n\t\t$response = wp_remote_get( 'http://api.wpdev.cahnrs.wsu.edu/?service=units' );\n\t\tif ( ! is_wp_error( $response ) ) {\n\t\t\t$body = wp_remote_retrieve_body( $response );\n\t\t\tif ( ! is_wp_error( $body ) ) {\n\t\t\t\t$units = json_decode( $body );\n\t\t\t}\n\t\t}\n\n\t\treturn $units;\n\n\t}", "public function loadAll() {\n $gerimu_masyvas = [];\n\n foreach ($this->db->getRows($this->table_name) as $gerimas) {\n $gerimu_masyvas[] = new \\App\\Item\\Gerimas($gerimas);\n }\n\n return $gerimu_masyvas;\n }", "public function getDAOCombat()\n\t{\n\t\treturn $this->_dao;\n\t}", "public function damage()\n {\n if (!$this->damage) {\n $this->damage = array(\n 'resistant' => array(),\n 'immunity' => array()\n );\n foreach (monsterToDamage::select('dtype', 'damage')->where('mid', '=', $this->id)->get() as $r) {\n if ($r->dtype == 'immunities') {\n $this->damage['immunity'][] = $r->damage;\n } else {\n $this->damage['resistant'][] = $r->damage;\n }\n };\n }\n return $this->damage;\n }", "private function loadTransportUnits(): array\n {\n //====================================================================//\n // Already Loaded\n if (isset($this->units)) {\n return $this->units;\n }\n //====================================================================//\n // Check Shipment Units Count\n if (empty($this->object->getCountTransportUnits())) {\n return $this->units = array();\n }\n //====================================================================//\n // Load Units Paginated List from API\n $listResponse = $this\n ->getUnitsVisitor((string) $this->getObjectIdentifier())\n ->listWithPagination(null, 250, 2000)\n ;\n /** @var API\\TransportUnit[] $units */\n $units = $listResponse->isSuccess() ? $listResponse->getResults() : array();\n\n return $this->units = $units;\n }", "protected function getFighters()\n {\n return $this->championship->teams;\n }", "public function getEntityManagers()\n {\n // TODO: Implement getEntityManagers() method.\n }", "function get_all_unidades_medida()\n {\n $this->db->order_by('id_unidade_medida', 'desc');\n return $this->db->get('unidades_medida')->result_array();\n }", "function getFighterList() {\n $fighterList = $this->find('all', array(\n 'order' => 'Fighters.level DESC'\n ));\n $fighterListArray = $fighterList->toArray();\n return $fighterListArray;\n }", "public function getCombatCount()\n {\n return $this->count(self::COMBAT);\n }", "public function getManagers()\n {\n return [$this->entityManager];\n }", "public function actionGetunits() {\r\n $out = [];\r\n if (isset($_POST['depdrop_parents'])) {\r\n $parents = $_POST['depdrop_parents'];\r\n if ($parents != null) {\r\n $branch_id = $parents[0];\r\n $list = \\app\\models\\Unit::find()->andWhere(['branch_id' => $branch_id])->asArray()->all();\r\n $selected = null;\r\n foreach ($list as $i => $value) {\r\n $out[] = ['id' => $value['unit_id'], 'name' => $value['unit_description']];\r\n if ($i == 0) {\r\n $selected = $value['unit_id'];\r\n }\r\n }\r\n echo Json::encode(['output' => $out, 'selected' => '']);\r\n return;\r\n }\r\n }\r\n echo Json::encode(['output' => '', 'selected' => '']);\r\n }", "public function findAll()\n {\n /**\n * @var SummonerEntity $summoner\n */\n $cache = $this->entityManager->getConfiguration()->getCache();\n $cachePlugin = new CachePlugin($this->entityManager->getConfiguration());\n $cacheKeyList = $cachePlugin->getCacheKeys($this::CACHE_SUMMONER);\n\n $summonerList = null;\n foreach ($cacheKeyList as $cacheKey) {\n if ($cache->exists($cacheKey)) {\n $summoner = $cache->get($cacheKey);\n $summonerList[] = $summoner;\n }\n }\n\n return $summonerList;\n }", "Public function get_all(){\n\n return self::MISSIONS;\n }", "public function sGetUnit($id)\n {\n static $cache = [];\n if (isset($cache[$id])) {\n return $cache[$id];\n }\n $unit = $this->db->fetchRow('\n SELECT unit, description FROM s_core_units WHERE id=?\n ', [$id]);\n\n if (!empty($unit) && !Shopware()->Shop()->get('skipbackend')) {\n $sql = \"SELECT objectdata\n FROM s_core_translations\n WHERE objecttype='config_units'\n AND objectlanguage=\" . Shopware()->Shop()->getId();\n $translation = $this->db->fetchOne($sql);\n if (!empty($translation)) {\n $translation = unserialize($translation, ['allowed_classes' => false]);\n }\n if (!empty($translation[$id])) {\n $unit = array_merge($unit, $translation[$id]);\n }\n }\n\n return $cache[$id] = $unit;\n }", "public function meters()\n {\n return $this->hasMany('App\\ElectricMeter', 'ROOM_ID')->where('REG_FLAG',1);\n }", "public function get_all_summons_details_list()\n\t{\n\t\t\n\t\t$sql=\"select summons_category.category_name,summons_details.id as id,summons_details.summons_title,summons_details.summons_section from summons_category,summons_details where summons_category.id=summons_details.summons_category_id order by summons_category.category_name asc\";\n\t\t$query=$this->db->query($sql);\n\t\t//print_r($query->result_object());die();\n\t\treturn $query->result_object();\n\t}", "public function query()\n {\n $query = Unit::select(['id','code','name']);\n\n return $this->applyScopes($query);\n }", "public function getEnemy() {\n if($this->combatantAID == CD()->id) {\n return $this->combatantB;\n } else {\n return $this->combatantA;\n }\n }", "public function findAllUnitsForCondominium(Condominium $condo)\n {\n $qb = $this->createQueryBuilder('unit')\n ->join('unit.condominium', 'condo')\n ->where('condo = :condo')\n ->setParameter('condo', $condo);\n\n return $qb;\n }", "function get_all_units($a, &$error_message) {\r\n\r\n $query = \"SELECT unit_name, unit_id FROM di_units\";\r\n $result = pg_query($a, $query);\r\n if (!$result) {\r\n\t$error_message .= ( \"ERROR when selecting info about units...\" . pg_last_error() . \"\\r\\n\");\r\n\treturn false;\r\n }\r\n while ($unit_info = pg_fetch_row($result)) {\r\n\t$unit_array[strtolower($unit_info[0])] = $unit_info[1];\r\n }\r\n\r\n return $unit_array;\r\n}", "public function alllandunits()\n\t{\n\t\treturn Datatables::of(LandUnits::with('created_language')->where('language_id',1)->orderBy('id', 'DESC')->get())->make(true);\n\t}", "public function getMedicaments(){\n\t\t$req = \"select * from medicament order by MED_NOMCOMMERCIAL\";\n\t\t$rs = PdoGsb::$monPdo->query($req);\n\t\t$ligne = $rs->fetchAll();\n\t\treturn $ligne;\n\t}", "public function unidades()\n {\n return $this->em->createQuery('\n SELECT\n e.id, e.codigo, e.nome, e.mensagemImpressao\n FROM\n Novosga\\Model\\Unidade e\n WHERE\n e.status = 1\n ORDER BY\n e.nome ASC\n ')->getResult();\n }", "public function getUnidades()\n {\n return $this->unidades;\n }", "function get_all_medidor()\n {\n $this->db->order_by('id_med', 'desc');\n return $this->db->get('medidor')->result_array();\n }", "public function getMedicamentos()\n {\n return $this->hasMany(Medicamento::className(), ['id' => 'id_medicamento'])->viaTable('receita_medicamento', ['id_receita' => 'id']);\n }", "public function getUnitTypeDao()\n\t{\n\t\treturn $this->dao;\n\t}", "public function listar()\n {\n return $this->request('GET', 'unidadesmedida');\n }", "private function getMClist()\n {\n return DB::table('absence')->join('teacher', 'absence.short_name', '=', 'teacher.short_name')\n ->get();\n// return Teacher::whereIn('short_name',Absence::where('date','=',new DateTime('today'))->lists('short_name'))->has('absence')->get();\n }", "public function getMedicos()\n {\n return $this->hasMany(Medicos::className(), ['id_especialidade' => 'id']);\n }", "public static function getAll() {\r\n $results = db_select('{md_megamenus}', 'mmn')\r\n ->fields('mmn')\r\n ->execute()\r\n ->fetchAll(PDO::FETCH_CLASS, 'MDMegaMenu');\r\n\r\n if (!count($results)) {\r\n return array();\r\n }\r\n\r\n # Run object initialize\r\n foreach ($results as &$menu) {\r\n if ($menu instanceof stdClass)\r\n $menu = _megamenu_recast('MDMegaMenu', $menu);\r\n\r\n $menu->initialize();\r\n }\r\n\r\n # Return list menus\r\n return $results;\r\n }", "function getTypeUnits() {\n\tglobal $db;\n\t\n\t$output = $db->query(\"\tSELECT \ttypes.name AS `type_name`,\n\t\t \t\t\t\t\t\t\ttypes.type_id,\n\t\t\t\t\t\t\t\t\tunits.name AS `unit_name`,\n\t\t\t\t\t\t\t\t\tunits.unit_id\n\t\t\t\t\t\t\t\t\tFROM type_units, types, units\n\t\t\t\t\t\t\t\t\tWHERE types.type_id = type_units.type_id\n\t\t\t\t\t\t\t\t\tAND units.unit_id = type_units.unit_id\");\n\t\n\tif($db->numOfRows) {\n\t\treturn $output;\n\t}\n\t\n\treturn false;\n}", "public function unit(){\n\n $unit = MedicalSupply::where('medSupName', '=', Input::get('mName'))\n ->where('brand', '=', Input::get('mBrand'))\n ->where('supType', '=', 'm')\n ->get();\n\n return Response::json($unit);\n }", "public function getUnitPhysicExams()\n {\n return $this->hasMany(UnitPhysicExam::className(), ['exam_id' => 'exam_id']);\n }", "public function getAllCurationModerators()\n {\n // get all users that are admin\n $userModel = MidasLoader::loadModel('User');\n $adminDaos = $userModel->findBy('admin', '1');\n\n $moderators = array();\n foreach ($adminDaos as $admin) {\n $moderators[$admin->getUserId()] = $admin;\n }\n\n // combine with all admins with those that are moderators\n $curationModeratorDaos = $this->getAll();\n foreach ($curationModeratorDaos as $curationModerator) {\n $moderatorUser = $curationModerator->getUser();\n $moderators[$moderatorUser->getUserId()] = $moderatorUser;\n }\n\n return $moderators;\n }", "public function getWeaponStats() {\n if(!$this->isPublic()) {\n return;\n }\n \n if(empty($this->weaponStats)) {\n foreach($this->xmlData->stats->weapons->children() as $classData) {\n $this->weaponStats[(string) $classData['key']] = new DoDSWeapon($classData);\n }\n }\n\n return $this->weaponStats;\n }", "public function fetchAllAdmin()\n {\n $stmt = $this->connection->pdo\n ->prepare(Finder::getSql(\"SELECT * FROM app_rooms\"));\n $stmt->execute();\n\n while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {\n yield Rooms::arrayToEntity($row, new Rooms());\n }\n }", "public function listadoUnidadmedida(){\n \n\t\t$data= $this->Model_maestras->BuscarUmedida();\n\t\n\t\techo($data); \n\t \n\n\t}", "public function getManufacturersForDropdown() {\n $manufacturers = $this->orderby('name','ASC')->get();\n $manufacturers_for_dropdown = [];\n foreach($manufacturers as $manufacturer) {\n $manufacturers_for_dropdown[$manufacturer->id] = $manufacturer->name;\n }\n return $manufacturers_for_dropdown;\n }", "public function getGuilds()\n {\n return $this->get(self::_GUILDS);\n }", "public function SearchCombatItems() {\n\t\t\t// Declare Classes\n\t\t\t$RepItem\t\t\t= new RepItem();\n\t\t\t$ModItem\t\t\t= new ModItem();\n\t\t\t// Intialize variables\n\t\t\t$return\t\t\t\t= '<br />(no Combat Items found)';\n\t\t\t// Get first 20 entries\n\t\t\t$result\t\t\t\t= $RepItem->getAllCombatItems(20);\n\t\t\t// If there are entries\n\t\t\tif ($result) {\n\t\t\t\t// Get Field names\n\t\t\t\t$RepQuestion\t= new RepQuestion();\n\t\t\t\t$fields\t\t\t= $RepQuestion->getAllFields();\n\t\t\t\t// Separate returned data an paging info\n\t\t\t\t$rows\t\t\t= $result[0];\n\t\t\t\t$paging_info\t= $result[1];\n\t\t\t\t// Model Result\n\t\t\t\t$return\t\t\t= $ModItem->listCombatItems($rows, $fields, 'i.id', 'ASC');\n\t\t\t\t// Define Pager info\n\t\t\t\t$pager\t\t\t= Pager::pagerOptions($paging_info, 'items', 'partialCombatResult');\n\t\t\t}\n\t\t\t// Define sub menu selection\n\t\t\t$GLOBALS['menu']['items']['opt2_css'] = 'details_item_on';\n\t\t\t// Prepare info to be displayed\n\t\t\tView::set('pager', $pager);\n\t\t\tView::set('return', $return);\n\t\t\t// render view\n\t\t\tView::render('usersSearch');\n \t\t}", "public function getHero() {\n if($this->combatantAID == CD()->id) {\n return $this->combatantA;\n } else {\n return $this->combatantB;\n }\n }", "public static function getEnchantments(array $enchants) : array{\n\t\t$instances = [];\n\t\tforeach($enchants as $enchantName => $level){\n\t\t\t$enchantment = CustomEnchants::getEnchantmentByName($enchantName);\n\t\t\tif($enchantment === null){\n\t\t\t\t$list = (new \\ReflectionClass(Enchantment::class))->getConstants();\n\t\t\t\tforeach($list as $enchant => $enchantId){\n\t\t\t\t\tif(mb_strtolower(str_replace(\"_\", \"\", $enchantName)) === mb_strtolower(str_replace(\" \", \"\", $enchant))){\n\t\t\t\t\t\t$enchantment = CustomEnchants::getEnchantment($enchantId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif($enchantment === null){\n\t\t\t\t\tcontinue; //Invalid\n\t\t\t\t}\n\t\t\t}\n\t\t\t$instance = new EnchantmentInstance($enchantment, (int) $level);\n\t\t\t$instances[] = $instance;\n\t\t}\n\t\treturn $instances;\n\t}", "public function getMedicos()\r\n {\r\n return $this->hasMany(Medico::className(), ['id_medico' => 'medico_id'])->viaTable('medico_horario_atencion', ['horario_atencion_id' => 'id_horarioAtencion']);\r\n }", "public static function all() {\n return array_keys(static::$genders);\n }", "function get_all_modelo_medidor()\n {\n $modelo_medidor = $this->db->query(\"\n SELECT\n *\n FROM\n `modelo_medidor`\n WHERE\n 1 = 1\n \")->result_array();\n\n return $modelo_medidor;\n }", "public function getMaterials()\n {\n return $this->materials;\n }", "public function getMaterials()\n {\n return $this->materials;\n }", "public function getUnit()\n {\n return $this->hasOne(Unit::className(), ['unit_id' => 'unit_id']);\n }", "public static function __setUnits($units){\r\n self::$_units[] = $units;\r\n return $units;\r\n }", "public function getUnit();", "public function getAll(){\n\t\t$tabDemandes = [];\n\t\t$q = $this->pdo->query(\"SELECT * FROM demande\");\n\t\twhile ($donnee = $q->fetch(PDO::FETCH_ASSOC)) {\n\t\t\t$tabDemandes[] = new Demande($donnee);\n\t\t}\n\t\treturn $tabDemandes;\n\t}", "public static function all() {\n\t\t$material_helper = new Material();\n\t\treturn $material_helper->get_all();\n\t}", "public function unitsAvailable()\n {\n return $this->getProvider()::unitsAvailable();\n }", "public function unitget()\r\n {\r\n $response = Unit::get();\r\n if(!$response){ \r\n return response()->json(['msg' => 'could not find unit'], 204);\r\n }else{\r\n return response()->json($response, 200);\r\n }\r\n }", "function getUnitList($type) {\n global $userUnitList;\n $data = array();\n foreach($userUnitList[$type] as $name) {\n array_push($data, array(\n 'name' => $name,\n 'img' => \"/imgs/{$name}.gif\"\n ));\n }\n return $data;\n }", "public function abilities()\n {\n if (!$this->abilities) {\n $this->abilities = array();\n foreach (monsterToAbility::select('ability', 'description')->where('mid', '=', $this->id)->get() as $m) {\n $this->abilities[$m->ability] = $m->description;\n }\n }\n return $this->abilities;\n }", "function getUnits(){\n $sql = \"SELECT * FROM units\";\n return runQuery($sql);\n}", "public function mMantenimientos()\n {\n return $this->hasMany('App\\Models\\MMantenimiento', 'subequipo_id', 'id');\n }", "public function getList()\r\n {\r\n // Le résultat sera un tableau d'instances de Sponsor.\r\n\r\n\t$entrainements = array();\r\n\r\n $q = $this->_db->query(\"SELECT id, jour, heure_debut as heureDebut, heure_fin as heureFin, lieu FROM entrainement\");\r\n //$q->execute();\r\n\r\n while ($donnees = $q->fetch(PDO::FETCH_ASSOC))\r\n {\r\n $entrainements[] = new BoEntrainement($donnees);\r\n }\r\n\r\n return $entrainements;\r\n }", "public function getUnitOfWork()\n {\n return $this->unit;\n }", "public function getAvailableUnits(): array\n { \n return array_keys($this->converterType->dataTable);\n }", "public function load()\n {\n $db = db::obtain();\n $data = $db->fetch_array_pdo('SELECT * FROM '.db::real_tablename('champions'), []);\n $r = [];\n foreach ($data as $k => $v) {\n $hero = new hero();\n $hero->set_array($v);\n $r[$hero->get('key')] = $hero;\n }\n\n return $r;\n }", "public function getUnits() : string\r\n {\r\n return $this->strUnits;\r\n }", "public function listSpells($spellsObject,$character, $pdo)\n\t\t {\t\t\t\n\t\t\tif(count((array)$spellsObject) > 0)// If there are any spells\n\t\t\t{\n\t\t\t\techo '<h2 class=\"tal_header zauber\" slide=\\'spells\\'>Zaubersprüche</h2>';\n\t\t\t\t$spellsRack = self::importSpells(); // importiere all existing spells\n\t\t\t\t$group_id = self::group_id($pdo);\n\t\t\t\t$attributes = self::importStats();\n\t\t\t//Spell-Loop\n\t\t\t\t\t\n\t\t\t\tforeach($spellsObject as $mySpellName => $mySkillLevel)\n\t\t\t\t{\n\n\t\t\t\t\techo \"<li name='\",$spellsRack[$mySpellName]['Name'],\"' class=\\\"talent\\\" slide='spells'>\";\t\n\t\t\t\t\techo '<form class=\"roll\">\n\t\t\t\t\t\t<button class=\"talentRoll\" type=\"button\" title=\"',$spellsRack[$mySpellName]['Name'],'\">',$spellsRack[$mySpellName]['Name'],' </button>\n\t\t\t\t\t\t<input title=\"+ erleichtert&#10; - erschwert\" type=\"number\" value=\"0\" class=\"difficulty\" name=\"difficulty\"></input> \n\t\t\t\t\t\t\n\t\t\t\t\t\t<input type=\"hidden\" name=\"talentName\" value=\"',$spellsRack[$mySpellName]['Name'],'\"></input>\n\t\t\t\t\t\t<input type=\"hidden\" name=\"group_id\" value=\"',$group_id,'\"></input>\n\t\t\t\t\t\t<input type=\"hidden\" name=\"character\" value=\"',$character,'\"></input>\n\t\t\t\t\t\t<input type=\"hidden\" name=\"talentPoints\" value=\"',$mySkillLevel,'\"></input>\t\t\n\n\t\t\t\t\t\t<input type=\"hidden\" class=\"GM_mode\" name=\"gmMode\" value=\"0\"></input>\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<input type=\"hidden\" name=\"roll_task\" value=\"_spell\"></input>\n\t\t\t\t\t\t<input type=\"hidden\" name=\"probe1\" value=\"',$attributes[$spellsRack[$mySpellName]['Probe1']],'\"></input>\n\t\t\t\t\t\t<input type=\"hidden\" name=\"probe2\" value=\"',$attributes[$spellsRack[$mySpellName]['Probe2']],'\"></input>\n\t\t\t\t\t\t<input type=\"hidden\" name=\"probe3\" value=\"',$attributes[$spellsRack[$mySpellName]['Probe3']],'\"></input>';\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Beschreibung\n\t\t\t\t\t\techo '<div class=\"infobox\"><i class=\"fas fa-info\"></i>\n\t\t\t\t\t\t\t<div class=\"infoboxInner\">\n\t\t\t\t\t\t\t<h2>',$spellsRack[$mySpellName]['Name'],'</h2>\n\t\t\t\t\t\t\t<p class=\"title\">Beschreibung</p><p class=\"text\">',$spellsRack[$mySpellName]['Beschreibung'],'</p>\n\t\t\t\t\t\t\t<p class=\"title\">Vorbereitung</p><p class=\"text\">',$spellsRack[$mySpellName]['Dauer'],'</p>\n\t\t\t\t\t\t\t<p class=\"title\">Kosten</p><p class=\"text\">',$spellsRack[$mySpellName]['Kosten'],'</p>\n\t\t\t\t\t\t\t<p class=\"title\">Ziel</p><p class=\"text\">',$spellsRack[$mySpellName]['Ziel'],'</p>\n\t\t\t\t\t\t\t<p class=\"title\">Zauberdauer</p><p class=\"text\">',$spellsRack[$mySpellName]['Zeit'],'</p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div></form>';\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Skill Level\n\t\t\t\t\t\techo '<div class=\"currentSkillLevel\"><span class=\"talentShort\">TaW</span> ',$mySkillLevel,'</div>';\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Aktuelle Werte\n\t\t\t\t\t\techo '<div class=\"attributeBox\">\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t<div class=\"attribute1 attr_',$spellsRack[$mySpellName]['Probe1'],'\">',$spellsRack[$mySpellName]['Probe1'],'</div>\n\t\t\t\t\t\t\t<div class=\"attribute2\">',$attributes[$spellsRack[$mySpellName]['Probe1']],'</div>\n\t\t\t\t\t\t\t<span class=\"vline\">|</span>\n\t\t\t\t\t\t\t<div class=\"attribute1 attr_',$spellsRack[$mySpellName]['Probe2'],'\">',$spellsRack[$mySpellName]['Probe2'],'</div>\n\t\t\t\t\t\t\t<div class=\"attribute2\">',$attributes[$spellsRack[$mySpellName]['Probe2']],'</div>\n\t\t\t\t\t\t\t<span class=\"vline\">|</span>\n\t\t\t\t\t\t\t<div class=\"attribute1 attr_',$spellsRack[$mySpellName]['Probe3'],'\">',$spellsRack[$mySpellName]['Probe3'],'</div>\n\t\t\t\t\t\t\t<div class=\"attribute2\">',$attributes[$spellsRack[$mySpellName]['Probe3']],'</div>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t</div>';\n\t\t\t\t\techo \"</li>\";\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t }", "public function getMedicos()\n {\n return $this->hasMany(Profile::className(), ['id' => 'id_medico'])->viaTable('medico_especialidade', ['id_especialidade' => 'id']);\n }", "public function getUnidadMedida() {\n $o_DMantenimientoGeneral = new DMantenimientoGeneral();\n $resultado = $o_DMantenimientoGeneral->getUnidadMedida();\n foreach ($resultado as $key => $value) {\n array_push($resultado[$key], \"../../../../fastmedical_front/imagen/icono/editar.png ^ Editar\");\n array_push($resultado[$key], \"../../../../fastmedical_front/imagen/icono/i_nomailappt.png ^ Eliminar\");\n }\n return $resultado;\n }", "public function getGenders() {\n\t\treturn empty( $this->container['genders'] ) ? null : $this->container['genders'];\n\t}", "public function getMedics()\n {\n $search['q'] = request('q');\n $search['clinic'] = request('clinic');\n \n \n $medics = $this->medicRepo->findAllWithoutPaginate($search);\n\n \n \n return $medics;\n \n }", "public function readEquippedWeapons() {\r\n include('connect.php');\r\n\r\n $query = \"SELECT *\r\n FROM EquippedWeapons\r\n WHERE CharWeapon_id = ?\";\r\n $myquery = $db->prepare($query);\r\n $myquery->bindValue(1, $this->charStats->Char_id);\r\n $myquery->execute();\r\n while ($result = $myquery->fetchObject()) {\r\n $this->equippedWeapons[] = new EquippedWeapon($result->EquippedWeapon_id, $result->WeaponName, $result->DamageType, $result->DamageAmount, $result->WeaponNotes);\r\n }\r\n }", "public function getCharacteristic(): array\n {\n $groups = $options = [];\n foreach ($this->getOptions()\n ->with('lang')\n ->all() as $option) {\n /**\n * @var TaxOption $option\n */\n $options[ $option[ 'tax_group_id' ] ][] = $option;\n }\n foreach (TaxGroup::find()\n ->where(['is_menu'=>true])\n ->andWhere([ 'id' => array_keys($options) ])\n ->with('lang')\n ->all() as $group) {\n /**\n * @var TaxGroup $group\n */\n if (!empty($options[ $group->id ])) {\n $group->customOptions = $options[ $group->id ];\n $groups[] = $group;\n }\n }\n return $groups;\n }", "public function findAll()\n {\n return $this->getPersistenceUnitAssembler()->getPersistenceUnitOverviewData();\n }", "public function getWorlds() {\n\t\t$html = \"\";\n\t\tforeach($this -> worlds as $world) {\n\t\t\t$html .= $world -> getTableContent();\n\t\t}\n\t\treturn $html;\n\t}", "public function findAllAdmin() {\n\t\t\t$result = $this->createQuery()->execute();\n\t\t\treturn $result;\n\t\t}", "public function measureunitsGet()\n // used by: public function getMeasureunitsAttribute()\n { \n $list = $this->productmeasureunits;\n\n // Would be better a hasmanythrou relation...\n // but, how to attach the right value of conversion_rate?\n $units = $list->map(function ($item, $key) {\n $unit = $item->measureunit;\n $unit->conversion_rate = $item->conversion_rate;\n return $unit;\n });\n\n // Not sure if Product (default or stock) Measure Unit is in database, so remove (if present) and add\n $extra_units = $units->reject(function ($value, $key) {\n return $value->id == $this->measure_unit_id;\n });\n\n // Deault unit first\n return $extra_units->prepend( $this->measureunit ); // ->pluck('name', 'id')->toArray();\n }", "public function getCharacterEquipment() {\n return $this->characterEquipment;\n }", "public function getTblDiems()\n {\n return $this->hasMany(TblDiem::className(), ['mahocphan' => 'mahocphan']);\n }", "public function getAdmins()\n\t{\n\t\t$query = <<<QUERY\nSELECT\n\t*\nFROM\n\tplayer\nWHERE\n\trole LIKE '%admin%'\nQUERY;\n\n\t\treturn $this->database->query( $query, 'Get admins from player table' );\n\t}", "public function getMFLFacilities() {\n return $this->hasMany(MFLFacility::className(), ['district_id' => 'id']);\n }", "public function findAvaliableUnitsForCondominium(Condominium $condo, $unit)\n {\n $clientUnit = $this\n ->getEntityManager()\n ->getRepository('CondoBundle:clientUnit')\n ->getUnitNotNullFromClient();\n\n $qb = $this->createQueryBuilder('unit');\n $qb->join('unit.condominium', 'condo')\n ->where('condo = :condo')\n ->andWhere(\n $qb\n ->expr()\n ->notIn(\n 'unit.id',\n $clientUnit->getDQL()\n )\n )\n ->orWhere('unit = :unit')\n ->setParameter('condo', $condo)\n ->setParameter('unit', $unit)\n ->setParameter('now', new Datetime());\n\n return $qb;\n }" ]
[ "0.6339565", "0.61949414", "0.611038", "0.6086017", "0.5991607", "0.5954808", "0.5640394", "0.56348264", "0.54640234", "0.543047", "0.536129", "0.51922613", "0.5111714", "0.5052967", "0.5006957", "0.4981392", "0.4971673", "0.49438918", "0.49270824", "0.48697177", "0.485338", "0.4837105", "0.48225635", "0.48006424", "0.47983882", "0.4778174", "0.47766766", "0.4766686", "0.4759811", "0.47500402", "0.47453046", "0.47427914", "0.4730358", "0.47172433", "0.4714905", "0.47065398", "0.47061583", "0.46797937", "0.46538347", "0.46379608", "0.46364415", "0.46308637", "0.4627881", "0.46277913", "0.46231556", "0.46150577", "0.46138644", "0.4607029", "0.45923305", "0.45820242", "0.45579734", "0.4545893", "0.45334685", "0.45139664", "0.44991112", "0.44898146", "0.44865352", "0.44787195", "0.44777596", "0.44747907", "0.44687757", "0.44658256", "0.44612688", "0.4455904", "0.4454267", "0.44495335", "0.44377053", "0.44377053", "0.4433584", "0.4427367", "0.442434", "0.44212207", "0.440755", "0.4403989", "0.44031313", "0.43997183", "0.43943796", "0.43841544", "0.43830648", "0.43801916", "0.43753156", "0.43748423", "0.4374464", "0.4371807", "0.4370143", "0.4365303", "0.43649575", "0.43588257", "0.43572465", "0.43560138", "0.43550733", "0.43470177", "0.43416923", "0.43294582", "0.4327391", "0.43269008", "0.43255097", "0.432537", "0.43219224", "0.43216655" ]
0.5316667
11
Converts any embeditem shortcode into its current state representation
protected function convertShortcodeNodes(&$component) { $page = $this->getPage(); if (isset($component['identifier']) && strpos($component['identifier'], 'embeddeditem') && isset($component['content'])) { $dataAttrs = isset($component['data']['data_attributes']) ? $component['data']['data_attributes'] : []; foreach ($component['content'] as $name => $props) { $shortcodeParams = isset($dataAttrs[$name]) ? $dataAttrs[$name] : null; if (isset($props['attrs'])) { $shortcodeParams = json_decode($props['attrs'], true); } $shortCode = $page->shortcodeFor($props['source'], $shortcodeParams); if ($shortCode) { try { $props['content'] = ShortcodeParser::get_active()->parse($shortCode); } catch (Exception $e) { $props['content'] = Director::isDev() ? "Failed parsing shortcode" : ""; } } $component['content'][$name] = $props; } } if (isset($component['data']['data_attributes'])) { foreach ($component['data']['data_attributes'] as $attr => $vals) { if (isset($vals['data-imageid']) && $vals['data-imageid'] > 0) { // lookup the file and grant $file = File::get()->byID($vals['data-imageid']); if ($file && $file->canView()) { $file->grantFile(); } } } } if (isset($component['containers'])) { foreach ($component['containers'] as $name => $items) { $newItems = []; foreach ($component['containers'][$name] as $subComponent) { $newItems[] = $this->convertShortcodeNodes($subComponent); } $component['containers'][$name] = $newItems; } } return $component; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function shortcode_menu($item_output, $item) \n{\n \n if (!empty($item->title)) \n {\n $output = do_shortcode($item->title);\n\n //echo $item->title;\n \n if ($output != $item->title) $item_output = $output;\n }\n \n return $item_output;\n}", "function _filter_do_shortcode_context()\n {\n }", "public function render($atts, $content = null) {\n $default_atts = array(\n 'playlist_type' => 'sound-cloud',\n 'playlist_url' => '',\n 'playlist_skin' => '',\n 'playlist_id' => '',\n 'playlist_color' => ''\n );\n\n $params = shortcode_atts($default_atts, $atts);\n $playlist_type = $params['playlist_type'];\n $playlist_id = $params['playlist_id'];\n $playlist_color = $params['playlist_color'];\n $playlist_skin = $params['playlist_skin'];\n $playlist_url = $params['playlist_url'];\n\n if ($playlist_type == \"sound-cloud\") {\n $playlist_id_url = \"https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/playlists/\";\n if ($playlist_id !== '') {\n $playlist_id_url .= $playlist_id;\n }\n if ($playlist_color !== '') {\n $playlist_color = substr($playlist_color, 1);\n $playlist_id_url .= \"&amp;color=\".$playlist_color;\n }\n\n $params['playlist_id_url'] = $playlist_id_url;\n }\n\n\n if ($playlist_type == \"spotify\") {\n if ($playlist_skin == \"light\"){\n $playlist_url .= \"&theme=white\";\n $params['playlist_url'] = $playlist_url;\n }\n }\n\n if ($playlist_type == \"bandcamp\") {\n $playlist_id_url = \"https://bandcamp.com/EmbeddedPlayer/album=\";\n if ($playlist_id !== '') {\n $playlist_id_url .= $playlist_id;\n }\n if ($playlist_skin == \"light\"){\n $playlist_id_url .= \"/bgcol=ffffff\";\n }\n else {\n $playlist_id_url .= \"/bgcol=333333\";\n }\n\n $playlist_id_url .= \"/size=large\";\n\n if ($playlist_color !== '') {\n $playlist_color = substr($playlist_color, 1);\n $playlist_id_url .= \"/linkcol=\".$playlist_color;\n }\n\n $params['playlist_id_url'] = $playlist_id_url.\"/artwork=small/transparent=true/\";\n }\n\n return mixtape_qodef_get_shortcode_module_template_part('templates/'.$playlist_type.'-playlist-template', 'audio-playlist', '', $params);\n }", "public function column_shortcode($item)\n {\n /*\n * the below string sets up the jQuery write back to the post by\n * exposing the available shortcode related items. The tags would be done\n * in the same fashion\n *\n * One challenge is to only add this code to the media modal and not to the\n * admin list area.\n *\n */\n\n //$shortcodeString = '<input id=\"puawpShortcode-'.$item['audio_file_ids'][0].\n //'\" type=\"text\" style=\"display:none;\" value=\"'.$item['shortcode'].'\"><a href=\"#\" id=\"puawpShortcodeInsert-'.$item['audio_file_ids'][0].\n //'\">Insert Pop Up Archive player</a>';\n\n $htmlShortcodeString = \"<strong>Audio File Count = \".$item['audio_files_count'].'</strong><br/>';\n for ($i=0; $i<$item['audio_files_count'];$i++) {\n $htmlShortcodeString .=$item['audio_file_data'][$i]['audio_file_shortcode'].'<br/>';\n }\n return $htmlShortcodeString;\n }", "function rbge_repo_embed_item( $atts ){\n \n\t$post_id = get_the_ID();\n//\t$longitude = get_post_meta($post_id, 'geo_longitude', true);\n//\t$latitude = get_post_meta($post_id, 'geo_latitude', true);\n\n // fetch the data from the repo\n \n // use a cached version of the data\n \n $uri = rbge_repo_get_uri_for_atts($atts);\n if(!$uri) return \"[You must set an id, barcode or accession to embed from the repository]\";\n $data = '';\n \n if(rbge_repo_embed_get_data($uri, $data)){\n \n // OK - we have data (from whereever) now let us render it!\n include_once(plugin_dir_path( __FILE__ ) . 'templates.php');\n return render_repo_item($data); //. '<pre>'. print_r($data, true) . '</pre>';\n \n }else{\n return \"<strong>Error: $data</strong>\";\n }\n \n\n}", "function handleShortcode ( $atts, $content = null )\n\t{\n\t\t$return = $this->core->comment_begin;\n\t\t$result = '';\n\t\t$error = '';\n\t\t$locale = $this->core->getOption( 'locale', 'shortcode' );\n\t\t$attrs = shortcode_atts( array ('asin' => '', 'locale' => $locale, 'linktype' => 'text', 'wishlist' => '', 'picsize' => 'small', 'col' => 1, 'sort_order'=>'LastUpdated' ), $atts );\n\n\t\t$locale = $attrs['locale'];\n\n\t\t// Get the associate ID\n\t\t$associatedid = $this->core->getOption( 'associated_id', 'general' );\n\t\tif ( $this->core->associate_table['US'] == $associatedid ) {\n\t\t\t$associatedid = $this->core->getAssociateId( $locale );\n\t\t}\n\n\t\t$sort_order_table = array ('DateAdded', 'LastUpdated', 'Price', 'Priority' );\n\t\tif (!(in_array($attrs['sort_order'],$sort_order_table))) {\n\t\t\t$attrs['sort_order'] ='LastUpdated';\n\t\t}\n\t\t/**\n\t\t * Set up Endpoint\n\t\t */\n\t\t$this->core->amazon_endpoint = $this->core->amazon_endpoint_table[$locale];\n\n\t\tif ( $attrs['wishlist'] ) {\n\t\t\t$this->core->wishlist_sort_order = $attrs['sort_order'];\n\t\t\t$list_result = $this->core->getListResults( $attrs['wishlist'] );\n\t\t\tif ( $list_result['Lists']['Request']['Errors'] ) {\n\t\t\t\t$error = 'WishList ' . $attrs['wishlist'] . ' doesn\\'t exists';\n\t\t\t\t$attrs['asin'] = null;\n\t\t\t}\n\t\t}\n\n\t\tif ( isset( $list_result['Error'] ) ) {\n\t\t\t$error = $this->core->getHttpError( $list_result['Error'] );\n\t\t\t$attrs['asin'] = null;\n\t\t}\n\n\t\t// If a random item is wanted, fill $attrs['asin'] with an ASIN from the wishlist\n\t\tif ( 'random' == strtolower( $attrs['asin'] ) ) {\n\t\t\t$Item_keys = $this->core->getItemKeys( $list_result['Lists']['List']['ListItem'] );\n\t\t\tforeach ( $Item_keys as $value ) {\n\t\t\t\t$Item = $list_result['Lists']['List']['ListItem'][$value];\n\t\t\t}\n\t\t\tif (!isset($Item['UniversalListItem'])) {\n\t\t\t\t$attrs['asin'] = $Item['Item']['ASIN'];\n\t\t\t} else {\n\t\t\t\t$attr['asin']='UniversalListItem';\n\t\t\t}\n\t\t}\n\n\t\tif ( 'all' == strtolower( $attrs['asin'] ) ) {\n\t\t\t$return .= '<table style=\" border: none; align: left\">';\n\n\t\t\tfor ($x=0; $x<=count ( $list_result['Lists']['List']['ListItem'])-1; $x+=$attrs['col'] ) {\n\t\t\t\t$return .= '<tr>';\n\t\t\t\tfor ($i=1; $i<=$attrs['col']; $i++) {\n\t\t\t\t\t$item=$list_result['Lists']['List']['ListItem'][$x+$i-1];\n\t\t\t\t\tif (!isset($item['UniversalListItem'])) {\n\t\t\t\t\t\t$attrs['asin'] = $item['Item']['ASIN'];\n\t\t\t\t\t\tlist ( $oneresult, $error ) = $this->shortcodeAsin( $attrs, $content, $associatedid, false );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$oneresult = $this->shortcodeUniversalListItem($attrs,$item, $content, false);\n\t\t\t\t\t}\n\t\t\t\t\t$return .= '<td>'.$oneresult .'</td>';\n\t\t\t\t}\n\t\t\t\t$return .= '</tr>';\n\t\t\t}\n\t\t\t$return .= '</table>';\n\t\t\t$attrs['asin'] = null;\n\t\t}\n\n\t\tif ( $attrs['asin'] != 'UniversalListItem') {\n\t\t\tlist ( $result, $error ) = $this->shortcodeAsin( $attrs, $content, $associatedid );\n\t\t} else {\n\t\t\t$result = $this->shortcodeUniversalListItem($attrs,$Item, $content, false);\n\t\t}\n\n\t\tif ( $error ) {\n\t\t\t$return .= $error;\n\t\t} else {\n\t\t\t$return .= $result;\n\t\t}\n\t\t$return .= $this->core->comment_end;\n\t\treturn ($return);\n\t}", "public abstract function do_shortcode( $atts, $content, $tag );", "public function start_el( $item_output, $item ) {\n\t\t\t// if it isn't our custom object\n\t\t\tif ( $item->object != 'gs_sim' ) {\n\n\t\t\t\t// check the legacy hack\n\t\t\t\tif ( $item->post_title == 'FULL HTML OUTPUT' ) {\n\n\t\t\t\t\t// then just process as we used to\n\t\t\t\t\t$item_output = do_shortcode( $item->url );\n\t\t\t\t} else {\n\t\t\t\t\t$item_output = do_shortcode( $item_output );\n\t\t\t\t}\n\n\t\t\t\t// if it is our object\n\t\t\t} else {\n\t\t\t\t// just process it\n\t\t\t\t$item_output = do_shortcode( $item->description );\n\t\t\t}\n\n\t\t\treturn $item_output;\n\t\t}", "function bandcamp_embed($atts) {\n extract(shortcode_atts(array(\n 'albumid' => '',\n 'trackid' => '',\n 'id' => '',\n 'link' => '',\n 'title' => '',\n ), $atts));\n\n // Is it a track?\n if (! $trackid) {\n $trackid = get_post_custom_values('trackid')[0];\n }\n if ($trackid) {\n $albumid = $trackid;\n $type = 'track';\n } else {\n $type = 'album';\n }\n\n // Try to get id from alternate attribute\n if (! $albumid) {\n $albumid = $id;\n }\n\n // Try to get values from custom fields\n if (! $albumid) {\n $albumid = get_post_custom_values('albumid')[0];\n }\n if (! $link) {\n $link = get_post_custom_values('albumlink')[0];\n }\n if (! $title) {\n $title = get_post_custom_values('albumalt')[0];\n }\n\n ob_start();\n require('parts/embed.php');\n return ob_get_clean();\n}", "function shortcode_tours( $atts ) {\n\t\textract( shortcode_atts( array(\n\t\t\t'title' => '',\n\t\t\t'type' => 'latest',\n\t\t\t'style' => 'style1',\n\t\t\t'count' => 10,\n\t\t\t'count_per_row' => 3,\n\t\t\t'city' => '',\n\t\t\t'country' => '',\n\t\t\t'tour_type' => '',\n\t\t\t'post_ids' => '',\n\t\t\t'slide' => 'true',\n\t\t\t'before_list' => '',\n\t\t\t'after_list' => '',\n\t\t\t'before_item' => '',\n\t\t\t'after_item' => '',\n\t\t\t'show_badge' => '',\n\t\t\t'animation_type' => '',\n\t\t\t'animation_duration' => '',\n\t\t\t'animation_delay' => '',\n\t\t\t'item_width' => '270',\n\t\t\t'item_margin' => '30',\n\t\t), $atts) );\n\t\tif ( $slide == 'no' || $slide == 'false' ) { $slide = 'false'; }\n\t\tif ( $type == 'hot' && empty( $show_badge ) ) $show_badge = true;\n\t\tif ( $show_badge == 'no' || $show_badge == 'false' ) { $show_badge = false; }\n\t\t$styles = array( 'style1', 'style2', 'style3' );\n\t\t$types = array( 'latest', 'featured', 'popular', 'hot', 'selected' );\n\t\tif ( ! in_array( $style, $styles ) ) $style = 'style1';\n\t\tif ( ! in_array( $type, $types ) ) $type = 'latest';\n\t\t$post_ids = explode( ',', $post_ids );\n\t\t$count = is_numeric( $count )?$count:10;\n\t\t$count_per_row = is_numeric( $count_per_row )?$count_per_row:3;\n\t\t$tour_type = ( ! empty( $tour_type ) ) ? explode( ',', $tour_type ) : array();\n\t\t$item_width = is_numeric( $item_width ) ? $item_width : 270;\n\t\t$item_margin = is_numeric( $item_margin ) ? $item_margin : 270;\n\n\t\t$def_before_list = '';\n\t\t$def_after_list = '';\n\t\t$def_before_item = '';\n\t\t$def_after_item = '';\n\t\tif ( $slide == 'false' ) {\n\t\t\t$def_before_list = '<div class=\"tour-packages row add-clearfix image-box listing-' . esc_attr( $style ) . '\">';\n\t\t\t$def_after_list = '</div>';\n\t\t\tif ( ( 2 == $count_per_row ) ) {\n\t\t\t\t$def_before_list = '<div class=\"tour-packages row add-clearfix image-box listing-' . esc_attr( $style ) . '\">';\n\t\t\t\t$def_before_item = \"<div class='col-sm-6'>\";\n\t\t\t\t$def_after_item = \"</div>\";\n\t\t\t} elseif ( 3 == $count_per_row ) {\n\t\t\t\t$def_before_list = '<div class=\"tour-packages row add-clearfix image-box listing-' . esc_attr( $style ) . '\">';\n\t\t\t\t$def_before_item = '<div class=\"col-sm-6 col-md-4\">';\n\t\t\t\t$def_after_item = \"</div>\";\n\t\t\t} else {\n\t\t\t\t$def_before_list = '<div class=\"tour-packages row add-clearfix image-box listing-' . esc_attr( $style ) . '\">';\n\t\t\t\t$def_before_item = \"<div class='col-sm-6 col-sms-6 col-md-3'>\";\n\t\t\t\t$def_after_item = \"</div>\";\n\t\t\t}\n\t\t\t$def_after_item = '</div>';\n\t\t} else {\n\t\t\t$def_before_list = '<div class=\"block image-carousel style2 flexslider\" data-animation=\"slide\" data-item-width=\"' . esc_attr( $item_width ) . '\" data-item-margin=\"' . esc_attr( $item_margin ) . '\"><ul class=\"slides tour-packages image-box listing-' . esc_attr( $style ) . '\">';\n\t\t\t$def_after_list = '</ul></div>';\n\t\t\t$def_before_item = '<li>';\n\t\t\t$def_after_item = '</li>';\n\t\t}\n\n\t\tif ( empty( $before_list ) ) $before_list = $def_before_list;\n\t\tif ( empty( $after_list ) ) $after_list = $def_after_list;\n\t\tif ( empty( $before_item ) ) $before_item = $def_before_item;\n\t\tif ( empty( $after_item ) ) $after_item = $def_after_item;\n\n\t\t$tours = array();\n\t\tif ( $type == 'selected' ) {\n\t\t\t$tours = trav_tour_get_tours_from_id( $post_ids );\n\t\t} elseif ( $type == 'hot' ) {\n\t\t\t$tours = trav_tour_get_hot_tours( $count, $country, $city, $tour_type );\n\t\t} else {\n\t\t\t$tours = trav_tour_get_special_tours( $type, $count, array(), $country, $city, $tour_type );\n\t\t}\n\n\t\tob_start();\n\t\tif ( ! empty( $title ) ) { echo '<h2>' . esc_html( $title ) . '</h2>'; }\n\t\techo ( $before_list );\n\t\t$i = 0;\n\t\tforeach ( $tours as $tour ) {\n\t\t\t$animation = '';\n\t\t\tif ( ! empty( $animation_type ) ) { $animation .= ' class=\"animated\" data-animation-type=\"' . esc_attr( $animation_type ) . '\" data-animation-duration=\"' . esc_attr( $animation_duration ) . '\" data-animation-delay=\"' . esc_attr( $animation_delay * $i ) . '\" '; }\n\t\t\ttrav_tour_get_tour_list_sigle( $tour->ID, $style, $before_item, $after_item, $show_badge, $animation );\n\t\t\t$i++;\n\t\t}\n\t\techo ( $after_list );\n\n\t\t$output = ob_get_contents();\n\t\tob_end_clean();\n\t\treturn $output;\n\t}", "public function custom_list_item_shortcode( $atts, $content ) {\n\t\tglobal $fsn_custom_lists;\n\t\t$list_id = $atts['list_id'];\n\t\t$parent_shortcode = $fsn_custom_lists[$list_id]['parent'];\n\t\t\n\t\t//if running AJAX, get action being run\n\t\t$ajax_action = false;\n\t\tif (defined('DOING_AJAX') && DOING_AJAX) {\n\t\t\tif (!empty($_POST['action'])) {\n\t\t\t\t$ajax_action = sanitize_text_field($_POST['action']);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif ( is_admin() && (!defined('DOING_AJAX') || !DOING_AJAX || (!empty($ajax_action) && $ajax_action == 'load_template') || (!empty($ajax_action) && $ajax_action == $parent_shortcode .'_modal')) ) {\n\t\t\t$uniqueID = uniqid();\n\t\t\t$output = '';\n\t\t\t$output .= '<div class=\"custom-list-item collapse-active\">';\t\t\t\t\t\n\t\t\t\t$output .= '<div class=\"custom-list-item-details\">';\n\t\t\t\t\tforeach($fsn_custom_lists[$list_id]['params'] as $param) {\n\t\t\t\t\t\tif (!empty($param['param_name'])) {\n\t\t\t\t\t\t\t$param_name = $param['param_name'];\n\t\t\t\t\t\t\tif (array_key_exists($param_name, $atts)) {\n\t\t\t\t\t\t\t\t$param_value = stripslashes($atts[$param_name]);\n\t\t\t\t\t\t\t\tif (!empty($param['encode_base64'])) {\n\t\t\t\t\t\t\t\t\t$param_value = wp_strip_all_tags($param_value);\n\t\t\t\t\t\t\t\t\t$param_value = htmlentities(base64_decode($param_value));\n\t\t\t\t\t\t\t\t} else if (!empty($param['encode_url'])) {\n\t\t\t\t\t\t\t\t\t$param_value = wp_strip_all_tags($param_value);\n\t\t\t\t\t\t\t\t\t$param_value = urldecode($param_value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//decode custom entities\n\t\t\t\t\t\t\t\t$param_value = FusionCore::decode_custom_entities($param_value);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t$param_value = '';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$param_value = '';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$param['nested'] = true;\n\t\t\t\t\t\t$param['param_name'] = $param['param_name']. '-paramid'. $uniqueID;\n\t\t\t\t\t\t//check for dependency\n\t\t\t\t\t\t$dependency = !empty($param['dependency']) ? true : false;\n\t\t\t\t\t\tif ($dependency === true) {\n\t\t\t\t\t\t\t$depends_on_field = $param['dependency']['param_name']. '-paramid'. $uniqueID;\n\t\t\t\t\t\t\t$depends_on_not_empty = !empty($param['dependency']['not_empty']) ? $param['dependency']['not_empty'] : false;\n\t\t\t\t\t\t\tif (!empty($param['dependency']['value']) && is_array($param['dependency']['value'])) {\n\t\t\t\t\t\t\t\t$depends_on_value = json_encode($param['dependency']['value']);\n\t\t\t\t\t\t\t} else if (!empty($param['dependency']['value'])) {\n\t\t\t\t\t\t\t\t$depends_on_value = $param['dependency']['value'];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t$depends_on_value = '';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$dependency_callback = !empty($param['dependency']['callback']) ? $param['dependency']['callback'] : '';\n\t\t\t\t\t\t\t$dependency_string = ' data-dependency-param=\"'. esc_attr($depends_on_field) .'\"'. ($depends_on_not_empty === true ? ' data-dependency-not-empty=\"true\"' : '') . (!empty($depends_on_value) ? ' data-dependency-value=\"'. esc_attr($depends_on_value) .'\"' : '') . (!empty($dependency_callback) ? ' data-dependency-callback=\"'. esc_attr($dependency_callback) .'\"' : '');\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$output .= '<div class=\"form-group'. ( !empty($param['class']) ? ' '. esc_attr($param['class']) : '' ) .'\"'. ( $dependency === true ? $dependency_string : '' ) .'>';\n\t\t\t\t\t\t\t$output .= FusionCore::get_input_field($param, $param_value);\n\t\t\t\t\t\t$output .= '</div>';\n\t\t\t\t\t}\n\t\t \t\t$output .= '<a href=\"#\" class=\"collapse-custom-list-item\">'. __('expand', 'fusion') .'</a>';\n\t\t \t\t$output .= '<a href=\"#\" class=\"remove-custom-list-item\">'. __('remove', 'fusion') .'</a>';\n\t \t\t$output .= '</div>';\n\t\t\t$output .= '</div>';\n\t\t} else {\n\t\t\t$output = '';\n\t\t\t$callback_function = 'fsn_get_'. sanitize_text_field($list_id) .'_list_item';\n\t\t\t$output .= call_user_func($callback_function, $atts, $content);\n\t\t}\n\t\t\n\t\treturn $output;\n\t}", "function wp_ajax_parse_embed()\n {\n }", "function inline_play_handler( $atts, $content = null ) {\n\t\t\t\n\t\t\tif ( !$this->external_call && (is_home() || is_archive()) && $this->theSettings['player_onblog'] == \"false\" ) { \n\t\t\t\treturn; \n\t\t\t}\n\t\t\t$id = $this->Player_ID;\t\t\t\n\t\t\textract(shortcode_atts(array( // Defaults\n\t\t\t\t'bold' => 'y',\n\t\t\t\t'play' => 'Play',\n\t\t\t\t'track' => '',\n\t\t\t\t'caption' => '',\n\t\t\t\t'flip' => 'l',\n\t\t\t\t'title' => '#USE#',\n\t\t\t\t'stop' => 'Stop',\n\t\t\t\t'ind' => 'y',\n\t\t\t\t'autoplay' => $this->theSettings['auto_play'],\n\t\t\t\t'loop' => 'false',\n\t\t\t\t'vol' => $this->theSettings['initial_vol'],\n\t\t\t\t'flow' => 'n'\n\t\t\t), $atts));\n\t\t\t\t\t\n\t\t\tif ( $track == \"\" ) { // Auto increment \n\t\t\t\tif ( !$this->has_fields || $this->external_call ) { return; }\n\t\t\t\t$track = ++$this->single_autocount;\n\t\t\t\t$arb = \"\";\n\t\t\t} \n\t\t\telseif ( is_numeric($track) ) { // Has a track number\n\t\t\t\tif ( !$this->has_fields || $this->external_call ) { return; }\n\t\t\t\t$arb = \"\";\n\t\t\t} \n\t\t\telse { // Has arbitrary file/uri\t\t\t\t\n\t\t\t\tif ( !$this->string_pushto_playlist( $track, $caption, \"1\" ) ) { return; }\n\t\t\t\t$track = $this->InlinePlaylist['count'];\t\t\t\t\t\n\t\t\t\t$arb = \"arb\";\n\t\t\t}\n\t\t\t\n\t\t\t$divO = \"\";\n\t\t\t$divC = \"\";\n\t\t\tif ( $flow == \"n\" || $this->external_call ) {\n\t\t\t\t$divO = \"<div style=\\\"font-size:14px; line-height:22px !important; margin:0 !important;\\\">\";\n\t\t\t\t$divC = \"</div>\";\n\t\t\t}\n\t\t\t\n\t\t\t$playername = ( $arb != \"\" ) ? \"foxInline\" : $this->has_fields;\n\t\t\t\n\t\t\t// Set font weight\n\t\t\t$b = ( $bold == \"false\" || $bold == \"0\" || $bold == \"n\" ) ? \" style=\\\"font-weight:500;\\\"\" : \" style=\\\"font-weight:700;\\\"\";\n\t\t\t\n\t\t\t// Set spacer between elements depending on play/stop/title\n\t\t\tif ( $play != \"\" && $title != \"\" ){\t\n\t\t\t\t$spacer = \"&nbsp;\"; \n\t\t\t} else {\n\t\t\t\t$spacer = \"\";\n\t\t\t\tif ( $play == \"\" && $stop != \"\" ) { $stop = \" \" . $stop; }\n\t\t\t}\n\t\t\t// Prep title\n\t\t\t$customtitle = ( $title == \"#USE#\" ) ? \"\" : $title;\n\t\t\t\n\t\t\t// Make id'd span elements\n\t\t\t$openWrap = $divO . \"<span id=\\\"playpause_wrap_mp3j_\" . $id . \"\\\" class=\\\"wrap_inline_mp3j\\\"\" . $b . \">\";\n\t\t\t//$pos = \"<span class=\\\"bars_mp3j\\\"><span class=\\\"load_mp3j\\\" id=\\\"load_mp3j_\" . $id . \"\\\" style=\\\"background:\" . $this->Colours['loadbar_colour'] . \";\\\"></span><span class=\\\"posbar_mp3j\\\" id=\\\"posbar_mp3j_\" . $id. \"\\\"></span></span>\";\n\t\t\t$pos = \"<span class=\\\"bars_mp3j\\\"><span class=\\\"load_mp3j\\\" id=\\\"load_mp3j_\" . $id . \"\\\"></span><span class=\\\"posbar_mp3j\\\" id=\\\"posbar_mp3j_\" . $id. \"\\\"></span></span>\";\n\t\t\t//$play_h = \"<span class=\\\"textbutton_mp3j\\\" id=\\\"playpause_mp3j_\" . $id . \"\\\" style=\\\"color:\" . $this->Colours['list_current_colour'] . \";\\\">\" . $play . \"</span>\";\n\t\t\t$play_h = \"<span class=\\\"textbutton_mp3j\\\" id=\\\"playpause_mp3j_\" . $id . \"\\\">\" . $play . \"</span>\";\n\t\t\t$title_h = ( $title == \"#USE#\" || $title != \"\" ) ? \"<span class=\\\"T_mp3j\\\" id=\\\"T_mp3j_\" . $id . \"\\\">\" . $customtitle . \"</span>\" : \"\";\n\t\t\t$closeWrap = ( $ind != \"y\" ) ? \"<span style=\\\"display:none;\\\" id=\\\"indi_mp3j_\" . $id . \"\\\"></span></span>\" . $divC : \"<span class=\\\"indi_mp3j\\\" id=\\\"indi_mp3j_\" . $id . \"\\\"></span></span>\" . $divC;\n\t\t\t\n\t\t\t// SHOULD THIS GO SOMEWHERE IN SPAN FORMAT??\n\t\t\t$vol_h = \"<div class=\\\"vol_mp3j\\\" id=\\\"vol_mp3j_\" . $id . \"\\\"></div>\";\n\t\t\t\n\t\t\t// Assemble them\t\t\n\t\t\t$html = ( $flip != \"l\" ) ? $openWrap . $pos . $title_h . $spacer . $play_h . $closeWrap : $openWrap . $pos . $play_h . $spacer . $title_h . $closeWrap;\n\t\t\t\n\t\t\t// Add title to js footer string if needed \n\t\t\tif ( $title_h != \"\" && $title == \"#USE#\" ) {\n\t\t\t\t$this->Footerjs .= \"jQuery(\\\"#T_mp3j_\" . $id . \"\\\").append(\" . $playername . \"[\" . ($track-1) . \"].name);\\n\";\n\t\t\t\t//$this->Footerjs .= \"jQuery(\\\"#T_mp3j_\" . $id . \"\\\").append('<span style=\\\"font-size:.7em;\\\"> - '+\" . $playername . \"[\" . ($track-1) . \"].artist+'</span>');\\n\";\n\t\t\t\t$this->Footerjs .= \"if (\" . $playername . \"[\" . ($track-1) . \"].artist !==''){ jQuery(\\\"#T_mp3j_\" . $id . \"\\\").append('<span style=\\\"font-size:.75em;\\\"> - '+\" . $playername . \"[\" . ($track-1) . \"].artist+'</span>'); }\\n\";\n\t\t\t}\n\t\t\t// Add info to js info array\n\t\t\t$autoplay = ( $autoplay == \"true\" || $autoplay == \"y\" || $autoplay == \"1\" ) ? \"true\" : \"false\";\n\t\t\t$loop = ( $loop != \"false\" ) ? \"true\" : \"false\";\n\t\t\t$this->jsInfo[] = \"\\n { list:\" . $playername . \", type:'single', tr:\" . ($track-1) . \", lstate:'', loop:\" . $loop . \", play_txt:'\" . $play . \"', pause_txt:'\" . $stop . \"', pp_title:'', autoplay:\" . $autoplay . \", has_ul:0, transport:'playpause', status:'basic', download:false, vol:\" . $vol . \", height:'' }\";\n\t\t\t\n\t\t\t$this->write_jp_div();\n\t\t\t$this->Player_ID++;\n\t\t\treturn $html;\n\t\t}", "function evd_restore_all_shortcodes() {\n global $shortcode_tags;\n global $temp_shortcode_tags;\n if(!empty($temp_shortcode_tags)) {\n $shortcode_tags = $temp_shortcode_tags;\n }\n}", "function accouk_youtube_embed($atts) {\n\n $a = shortcode_atts(array(\n 'id' => null\n\t), $atts);\n\n $yt_id = $a['id'];\n\n // Dumb validation of youtube ID\n if(strlen($yt_id) !== 11) return;\n\n // Output with template\n ob_start();\n include('templates/youtube-video.php');\n $element = ob_get_contents();\n ob_end_clean();\n\n\treturn $element;\n}", "public function processShortcode($atts) {\n\t\t\n\t\textract(shortcode_atts(array(\n \t\t'request' => 'blank'\n\t\t), $atts));\n\t\t\n\t\t$content = self::processRequest($request);\n\t\t\n\t\treturn \"<!--BEGIN: onxshop_start --><div class='onxshop_wordpress'>{$content}</div><!-- END: onxshop_end -->\";\n \n\t}", "function epfl_card_process_shortcode($atts = [], $content = '', $tag = '') {\n\n // if supported delegate the rendering to the theme\n if (!has_action(\"epfl_card_action\"))\n {\n return Utils::render_user_msg('You must activate the epfl theme');\n }\n\n // sanitize parameters\n foreach($atts as $key => $value) {\n if (strpos($key, 'content') !== false)\n {\n $atts[$key] = wp_kses_post($value);\n } else {\n $atts[$key] = sanitize_text_field($value);\n }\n }\n\n if (array_key_exists('gray_wrapper', $atts) && $atts['gray_wrapper'] === 'true') {\n $atts['gray_wrapper'] = true;\n } else {\n $atts['gray_wrapper'] = false;\n }\n\n ob_start();\n\n try {\n\n do_action(\"epfl_card_action\", $atts);\n\n return ob_get_contents();\n\n } finally {\n\n ob_end_clean();\n }\n\n}", "function wpestate_shortcodes(){\n wpestate_register_shortcodes();\n wpestate_tiny_short_codes_register();\n add_filter('widget_text', 'do_shortcode');\n}", "function sp_audio_sc( $atts ) {\n\n\textract( shortcode_atts( array(\n\t\t'mp3' => '',\n\t\t'ogg' => '',\n\t\t'width' => '',\n\t\t'height' => '',\n\t\t'preload' => false,\n\t\t'autoplay' => false,\n\t), $atts ) );\n\n\tglobal $post;\n\n\tif ( $mp3 )\n\t\t$mp3 = '<source src=\"' . $mp3 . '\" type=\"audio/mp3\" />';\n\n\tif ( $ogg )\n\t\t$ogg = '<source src=\"' . $ogg . '\" type=\"audio/ogg\" />';\n\n\tif ( $preload )\n\t\t$preload = 'preload=\"' . $preload . '\"';\n\n\tif ( $autoplay )\n\t\t$autoplay = 'autoplay';\n\n\t$output = \"<audio id='AudioPlayerV1-id-$post->ID' class='AudioPlayerV1' width='100%' height='29' controls {$preload} {$autoplay} data-fallback='\" . SP_BASE_URL . \"js/audioplayerv1.swf'>\n\t\t\t\t\t{$mp3}\n\t\t\t\t\t{$ogg}\n\t\t\t\t</audio>\";\n\n\treturn $output;\n\n}", "private function process_raw_shortcode()\n\t{\n\t // GENERAL DETAILS\n\t $this->length \t= strlen($this->raw);\n\t $this->end\t= $this->start + $this->length;\n\n\t // KEY & VALUE\n\t $key_val_pair \t= explode('::', $this->raw);\n\n\t // check to see if both key and value have been given\n\t if (sizeof($key_val_pair) > 1)\n\t {\n\t\t $this->key = $key_val_pair[0];\n\t\t $this->value = $key_val_pair[1];\t\n\t }else{\n\t\t $http = strpos($this->raw, 'http');\n\n\t\t if($http === false){\n\t\t\t $this->key = 'internal';\n\t\t }else{\n\t\t\t $this->key = 'external';\n\t\t }\n\t\t $this->value = $this->raw;\n\t }\n\t}", "function kw_youtube_short( $atts, $content = null )\r\n{\r\n\r\n extract( shortcode_atts( array(\r\n 'id' => '',\r\n ), $atts ) );\r\n\t \r\n\t$id = trim($id);\r\n\t$kw_spaces = get_option(\"kw_spaces\");\r\n\t$kw_spaces = stripslashes($kw_spaces);\r\n\t$kw_width = get_option(\"kw_width\");\r\n\t$kw_width = stripslashes($kw_width);\r\n\t$kw_height = get_option(\"kw_height\");\r\n\t$kw_height = stripslashes($kw_height);\r\n\t$kw_bgcolor = get_option(\"kw_bgcolor\");\r\n\t$kw_bgcolor = stripslashes($kw_bgcolor);\r\n\t$kw_api = get_option(\"kw_api\");\r\n\t$kw_api = stripslashes($kw_api);\r\n \r\nreturn ''.$kw_spaces.'<object width=\"'.$kw_width.'\" height=\"'.$kw_height.'\"><param name=\"movie\" value=\"http://www.youtube.com/v/'.$id.''.$kw_api.'\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"allowscriptaccess\" value=\"always\" /><param name=\"bgcolor\" value=\"'.$kw_bgcolor.'\"><embed type=\"application/x-shockwave-flash\" width=\"'.$kw_width.'\" height=\"'.$kw_height.'\" src=\"http://www.youtube.com/v/'.$id.''.$kw_api.'\" bgcolor=\"'.$kw_bgcolor.'\" allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed></object>'.$kw_spaces.'';\r\n}", "function sm_shortcode( $atts ) {\n\t$a = shortcode_atts( array(\n\t\t'post-id' => get_the_ID() ,\n\t\t'key' => '',\n\t\t'single' => false,\n ), $atts );\t\n \n return get_post_meta( $a[\"post-id\"], $a[\"key\"], $a[\"post-id\"] ) ;\n\n}", "function couponxl_slider_func( $atts, $content ){\n\t\textract( shortcode_atts( array(\n\t\t\t'icon' => '',\n\t\t\t'title' => '',\n\t\t\t'small_title' => '',\n\t\t\t'items' => '',\n\t\t\t'blogs_orderby' => 'date',\n\t\t\t'blogs_order' => 'DESC'\n\t\t), $atts ) );\n\t\tob_start();\n\t\t$items = explode( \",\", $items );\n\n\t\tinclude( locate_template( 'includes/featured-slider.php' ) );\n\t\t$content = ob_get_contents();\n\t\tob_end_clean();\n\n\t\treturn $content;\n\t}", "function mp3_func( $atts ) {\n $a = shortcode_atts( array(\n 0 => 'http://missing'\n ), $atts );\n\n\t$mp3url = str_replace(\"www.dropbox\", \"dl.dropbox\", str_replace(\"?dl=0\", \"?\", $a[0]));\n return \"<audio controls style='width: 100%'><source src='{$mp3url}' type='audio/mpeg'>Your browser does not support the audio element.</audio>\";\n}", "function unescape_invalid_shortcodes($content)\n {\n }", "function foliamaptool_shortcodes($atts='') {\r\n\t\tglobal $id;\r\n\r\n\t\tif (is_feed())\r\n\t\t\treturn;\r\n\r\n\t\t$map = get_post_meta($id, '_mapp_map', true);\r\n\t\t$pois = get_post_meta($id, '_mapp_pois', true);\r\n\r\n\t\t$result = $this->map($map, $pois, false);\r\n\r\n\t\treturn $result;\r\n\t}", "function envolve_embed($html, $url, $attr, $post_id) {\n return '<div class=\"video\">' . $html . '</div>';\n}", "function envolve_embed($html, $url, $attr, $post_id) {\n return '<div class=\"video\">' . $html . '</div>';\n}", "function shortcodeAsin ( $attrs, $content, $associatedid, $single=true )\n\t{\n\t\t$error = '';\n\t\t$item_result = $this->core->getItemLookup( $attrs['asin'], $associatedid ) ;\n\t\tif ( isset( $item_result['Error'] ) ) {\n\t\t\t$return = '';\n\t\t\t$error = $this->core->getHttpError( $item_result['Error'] );\n\t\t} else {\n\t\t\tif ( isset( $item_result['Items']['Request']['Errors'] ) ) {\n\t\t\t\t$return = '';\n\t\t\t\t$error = 'Item with ASIN ' . $attrs['asin'] . ' doesn\\'t exist';\n\t\t\t} else {\n\t\t\t\t$pos = strpos( $item_result['Items']['Item']['DetailPageURL'], $attrs['asin'] );\n\n\t\t\t\t$myurl = substr( $item_result['Items']['Item']['DetailPageURL'], 0, $pos + strlen( $attrs['asin'] ) );\n\t\t\t\t// If a wishlist is given, make sure when somebody clicks on the link, Amazon knows the List owner.\n\t\t\t\tif ( $attrs['wishlist'] ) {\n\t\t\t\t\t$myurl .= '/ref=wl_it_dp';\n\t\t\t\t\t$query['ie'] = 'UTF8';\n\t\t\t\t\t$query['colid'] = $attrs['wishlist'];\n\t\t\t\t}\n\t\t\t\t$query['tag'] = $associatedid;\n\t\t\t\t$myurl .= '?' . $this->core->BuildQuery( $query );\n\n\t\t\t\t// If no content is given we use the Title from Amazon.\n\t\t\t\t$content = ($content) ? $content : $item_result['Items']['Item']['ItemAttributes']['Title'];\n\n\t\t\t\tswitch ( $attrs['linktype'] ) {\n\t\t\t\t\tcase 'text' :\n\t\t\t\t\t\t$return = '<a title=\"' . $content . '\" href=\"' . $myurl . '\">' . $content . '</a>';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'pic' :\n\t\t\t\t\t\t$imginfo = $this->core->getImageInfo( $attrs['picsize'], $item_result );\n\t\t\t\t\t\t$return = '<div class=\"wp-caption alignleft\"><a title=\"' . $content . '\" href=\"' . $myurl . '\"><img width=\"' . $imginfo['w'] . '\" height=\"' . $imginfo['h'] . '\" src=\"' . $imginfo['url'] . '\" alt=\"' . $content . '\"/></a></div>';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'pic-text' :\n\t\t\t\t\t\t$imginfo = $this->core->getImageInfo( $attrs['picsize'], $item_result );\n\t\t\t\t\t\tif ($single){\n\t\t\t\t\t\t\t$return = '<table style=\" border: none; cellpadding: 2px; align: left\"><tr><td><a title=\"' . $content . '\" href=\"' . $myurl . '\"><img class=\"alignleft\" width=\"' . $imginfo['w'] . '\" height=\"' . $imginfo['h'] . '\" src=\"' . $imginfo['url'] . '\" alt=\"' . $content . '\"/></a></td><td><a title=\"' . $content . '\" href=\"' . $myurl . '\">' . $content . '</a></td></tr></table>';\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$return = '<a title=\"' . $content . '\" href=\"' . $myurl . '\"><img class=\"alignleft\" width=\"' . $imginfo['w'] . '\" height=\"' . $imginfo['h'] . '\" src=\"' . $imginfo['url'] . '\" alt=\"' . $content . '\"/></a><a title=\"' . $content . '\" href=\"' . $myurl . '\">' . $content . '</a>';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault :\n\t\t\t\t\t\t$return = '<a title=\"' . $content . '\" href=\"' . $myurl . '\">' . $content . '</a>';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn array ($return, $error );\n\t}", "function dm_sidebar_nav_item_shortcode($atts, $content = null) {\n\textract(shortcode_atts(array(\n\t\t'url' => '',\n\t), $atts));\n\n\tif (!$content) return '';\n\n\tob_start();\n?>\n\t<li>\n\t\t<a href=\"<?php echo $url; ?>\">\n\t\t\t<?php echo $content; ?>\n\t\t</a>\n\t</li>\n<?php\n\t$output = ob_get_clean();\n\treturn $output;\n}", "function shortcode_promo_box( $atts, $content = null ) {\n\t\t$variables = array( 'class' => '', 'img_id' => '', 'img_src' => '', 'img_alt' => 'promobox-image', 'img_height' => '', 'img_width' => '', 'content_section_width' => '', 'img_section_width' => '', 'type' => 'type1', 'animation_type' => '', 'animation_duration' => '', 'animation_delay' => '', 'img_class' => '' );\n\t\textract( shortcode_atts( $variables, $atts ) );\n\t\t$class = empty( $class )?'':( ' ' . $class );\n\t\t$class = 'promo-box' . $class;\n\t\tif ( ! empty( $img_id ) ) {\n\t\t\t$img_info = wp_get_attachment_image_src( $img_id, 'full' );\n\t\t\t$img_src = $img_info[0];\n\t\t\tif ( empty( $img_alt ) ) $img_alt = get_post_meta( $img_id,'_wp_attachment_image_alt', true );\n\t\t}\n\t\tif ( empty( $img_alt ) ) $img_alt = 'author-image';\n\n\t\t$img_width = ( ! empty( $img_width ) && is_numeric( $img_width ) )?(' width=\"' . esc_attr( $img_width ) . '\"'):'';\n\t\t$img_height = ( ! empty( $img_height ) && is_numeric( $img_height ) )?(' height=\"' . esc_attr( $img_height ) . '\"'):'';\n\t\tif ( ! is_numeric( $content_section_width ) ) $content_section_width = 8;\n\t\tif ( ! is_numeric( $img_section_width ) ) $img_section_width = 12 - $content_section_width;\n\n\t\t$result = '';\n\n\t\t$result .= '<div class=\"' . esc_attr( $class ) . '\"><div class=\"container\">';\n\t\t$result .= '<div class=\"content-section description' . ( ( $type == 'type2' )?'':' pull-right' ) . ' col-sm-' . esc_attr( $content_section_width ) . '\">';\n\t\t$result .= '<div class=\"table-wrapper hidden-table-sm\">';\n\t\t$result .= do_shortcode( $content );\n\t\t$result .= '</div></div>';\n\n\t\tif ( ! empty( $img_src ) ) {\n\t\t\t$result .= '<div class=\"image-container' . ( ( $type == 'type2' )?' pull-right':'' ) . ' col-sm-' . esc_attr( $img_section_width . ' ' . $img_class ) . '\">';\n\t\t\t$animation = '';\n\t\t\tif ( ! empty( $animation_type ) ) { $animation .= ' class=\"animated\" data-animation-type=\"' . esc_attr( $animation_type ) . '\" data-animation-duration=\"' . esc_attr( $animation_duration ) . '\" data-animation-delay=\"' . esc_attr( $animation_delay ) . '\" '; }\n\t\t\t$result .= '<img src=\"' . esc_url( $img_src ) . '\" alt=\"' . esc_attr( $img_alt ) . '\"' . $img_width . $img_height . $animation . ' /></div>';\n\t\t}\n\n\t\t$result .= '</div></div>';\n\n\t\treturn $result;\n\t}", "function trebi_shortcode_handler($atts, $content=null, $code=\"\") {\n\t\t\t\n\t\t\t$ifstart = '<iframe src=\"https://portali.3bmeteo.com/3bm_meteo.php?';\n\t\t\t$ifend = '</iframe>';\n\t\t\t\n\t\t\tswitch ($code) {\n/* BLOCCO A (A1, A2, A3) */\n/* <iframe src=\"http://portali.3bmeteo.com/3bm_meteo.php?loc=6&tm=xssmall&c1=ffffff&b1=93c1db&b2=3a8ebd\" width=\"200\" height=\"220\" frameborder=\"0\"></iframe> */\n\t\t\t\tcase 'trebi-a1':\n\t\t\t\t\textract( shortcode_atts( array( \n\t\t\t\t\t 'loc' => '6', \n\t\t\t\t\t 'tm' => 'xssmall',\n\t\t\t\t\t 'c1' => 'ffffff', \n\t\t\t\t\t 'b1' => '93c1db',\n\t\t\t\t\t 'b2' => '3a8ebd',\n\t\t\t\t\t), $atts ) );\n\t\t\t\t\t$wloc=trebi_getUrlLoc((int)$loc);\n\t\t\t\t\treturn $ifstart.'loc='.$loc.'&tm='.$tm.'&c1='.$c1.'&b1='.$b1.'&b2='.$b2.'\" width=\"200\" height=\"175\" frameborder=\"0\">'.$ifend.$wloc;\n\t\t\t\t\tbreak;\n/* <iframe src=\"http://portali.3bmeteo.com/3bm_meteo.php?loc=6&tm=lsmall&new=1&c1=999999&c2=ffffff&b1=93c1db&b2=f0f0f0&b3=2a7fae\" width=\"195\" height=\"340\" frameborder=\"0\"></iframe> */\n\t\t\t\tcase 'trebi-a2':\n\t\t\t\t\textract( shortcode_atts( array(\n\t\t\t\t\t 'loc' => '6', \n\t\t\t\t\t 'tm' => 'lsmall',\n\t\t\t\t\t 'new' => '1',\n\t\t\t\t\t 'c1' => '999999', \n\t\t\t\t\t 'c2' => 'ffffff', \n\t\t\t\t\t 'b1' => '93c1db',\n\t\t\t\t\t 'b2' => 'f0f0f0', \n\t\t\t\t\t 'b3' => '2a7fae',\n\t\t\t\t\t), $atts ) );\n\t\t\t\t\t$wloc=trebi_getUrlLoc($loc);\n\t\t\t\t\treturn $ifstart.'loc='.$loc.'&tm='.$tm.'&new='.$new.'&c1='.$c1.'&c2='.$c2.'&b1='.$b1.'&b2='.$b2.'&b3='.$b3.'\" width=\"185\" height=\"330\" frameborder=\"0\">'.$ifend.$wloc;\n\t\t\t\t\tbreak;\n/* <iframe src=\"http://portali.3bmeteo.com/3bm_meteo.php?loc=6&tm=lbigor&new=1&c1=ffffff&c2=888888&b1=93c1db&b2=3a8ebd&b3=f0f0f0\" width=\"455\" height=\"195\" frameborder=\"0\"></iframe> */\n\t\t\t\tcase 'trebi-a3':\n\t\t\t\t\textract( shortcode_atts( array( \n\t\t\t\t\t 'loc' => '6', \n\t\t\t\t\t 'tm' => 'lbigor',\n\t\t\t\t\t 'new' => '1',\n\t\t\t\t\t 'c1' => 'ffffff', \n\t\t\t\t\t 'c2' => '888888',\n\t\t\t\t\t 'b1' => '93c1db',\n\t\t\t\t\t 'b2' => '3a8ebd', \n\t\t\t\t\t 'b3' => 'f0f0f0',\n\t\t\t\t\t), $atts ) );\n\t\t\t\t\t$wloc=trebi_getUrlLoc($loc);\n\t\t\t\t\treturn $ifstart.'loc='.$loc.'&tm='.$tm.'&new='.$new.'&c1='.$c1.'&c2='.$c2.'&b1='.$b1.'&b2='.$b2.'&b3='.$b3.'\" width=\"455\" height=\"195\" frameborder=\"0\">'.$ifend.$wloc;\n\t\t\t\t\tbreak;\n/* Blocco B (B1, B2) */\n/* <iframe src=\"http://portali.3bmeteo.com/3bm_meteo.php?loc=6&tm=treale&c1=ffffff&b1=93c1db&b2=3a8ebd\" width=\"195\" height=\"202\" frameborder=\"0\"></iframe>*/\n\t\t\t\tcase 'trebi-b1':\n\t\t\t\t\textract( shortcode_atts( array( \n\t\t\t\t\t 'loc' => '6', \n\t\t\t\t\t 'tm' => 'treale',\n\t\t\t\t\t 'c1' => 'ffffff', \n\t\t\t\t\t 'b1' => '93c1db',\n\t\t\t\t\t 'b2' => '3a8ebd',\n\t\t\t\t\t), $atts ) );\n\t\t\t\t\t$wloc=trebi_getUrlLoc($loc);\n\t\t\t\t\treturn $ifstart.'loc='.$loc.'&tm='.$tm.'&c1='.$c1.'&b1='.$b1.'&b2='.$b2.'\" width=\"195\" height=\"165\" frameborder=\"0\">'.$ifend.$wloc;\n\t\t\t\t\tbreak;\n/* <iframe src=\"http://portali.3bmeteo.com/3bm_meteo.php?loc=6&p=1&tm=ssmall&new=1&c1=ffffff&c2=aaaaaa&b1=93c1db&b2=3a8ebd&b3=f0f0f0\" width=\"245\" height=\"405\" frameborder=\"0\"></iframe> */\n\t\t\t\tcase 'trebi-b2':\n\t\t\t\t\textract( shortcode_atts( array( \n\t\t\t\t\t 'loc' => '6', \n\t\t\t\t\t 'p' => '1',\n\t\t\t\t\t 'tm' => 'ssmall',\n\t\t\t\t\t 'new' => '1',\n\t\t\t\t\t 'c1' => 'ffffff', \n\t\t\t\t\t 'c2' => 'aaaaaa',\n\t\t\t\t\t 'b1' => '93c1db',\n\t\t\t\t\t 'b2' => '3a8ebd', \n\t\t\t\t\t 'b3' => 'f0f0f0',\t\t\t\t\t \n\t\t\t\t\t), $atts ) );\n\t\t\t\t\t$wloc=trebi_getUrlLoc($loc);\n\t\t\t\t\treturn $ifstart.'loc='.$loc.'&p='.$p.'&tm='.$tm.'&new='.$new.'&c1='.$c1.'&c2='.$c2.'&b1='.$b1.'&b2='.$b2.'&b3='.$b3.'\" width=\"245\" height=\"380\" frameborder=\"0\">'.$ifend.$wloc;\n\t\t\t\t\tbreak;\n/* BLOCCO C (C1, C2) */\n/* <iframe src=\"http://portali.3bmeteo.com/3bm_meteo.php?loc=6&tm=lbig&new=1&c1=777777&c2=FFFFFF&c3=93C1DB&b1=93C1DB&b2=3A8EBD\" width=\"460\" height=\"405\" frameborder=\"0\"></iframe>*/\n\t\t\t\tcase 'trebi-c1':\n\t\t\t\t\textract( shortcode_atts( array( \n\t\t\t\t\t 'loc' => '6', \n\t\t\t\t\t 'tm' => 'lbig',\n\t\t\t\t\t 'new' => '1',\n\t\t\t\t\t 'c1' => '777777', \n\t\t\t\t\t 'c2' => 'FFFFFF',\n\t\t\t\t\t 'c3' => '93C1DB', \n\t\t\t\t\t 'b1' => '93C1DB',\n\t\t\t\t\t 'b2' => '3A8EBD',\n\t\t\t\t\t), $atts ) );\n\t\t\t\t\t$wloc=trebi_getUrlLoc($loc);\n\t\t\t\t\treturn $ifstart.'loc='.$loc.'&tm='.$tm.'&new='.$new.'&c1='.$c1.'&c2='.$c2.'&c3='.$c3.'&b1='.$b1.'&b2='.$b2.'\" width=\"460\" height=\"380\" frameborder=\"0\">'.$ifend.$wloc;\n\t\t\t\t\tbreak;\n/* <iframe src=\"http://portali.3bmeteo.com/3bm_meteo.php?loc=6&tm=oraxora&c1=FFFFFF&c2=777777&c3=93C1DB&b1=93C1DB&b2=3A8EBD\" width=\"455\" height=\"505\" frameborder=\"0\"></iframe>*/\n\t\t\t\tcase 'trebi-c2':\n\t\t\t\t\textract( shortcode_atts( array( \n\t\t\t\t\t 'loc' => '6', \n\t\t\t\t\t 'tm' => 'oraxora',\n\t\t\t\t\t 'c1' => 'FFFFFF', \n\t\t\t\t\t 'c2' => '777777',\n\t\t\t\t\t 'c3' => '93C1DB',\n\t\t\t\t\t 'b1' => '93C1DB',\n\t\t\t\t\t 'b2' => '3A8EBD',\n\t\t\t\t\t), $atts ) );\n\t\t\t\t\t$wloc=trebi_getUrlLoc($loc);\n\t\t\t\t\treturn $ifstart.'loc='.$loc.'&tm='.$tm.'&c1='.$c1.'&c2='.$c2.'&c3='.$c3.'&b1='.$b1.'&b2='.$b2.'\" width=\"455\" height=\"500\" frameborder=\"0\">'.$ifend.$wloc;\n\t\t\t\t\tbreak;\n/* BLOCCO D (D1, D2) */\n/* <iframe src=\"http://portali.3bmeteo.com/3bm_meteo.php?idreg=1&new=1&tm=msmall&c1=ffffff&b1=93c1db&b2=3a8ebd\" width=\"190\" height=\"310\" frameborder=\"0\"></iframe> */\t\n\t\t\t\tcase 'trebi-d1':\n\t\t\t\t\textract( shortcode_atts( array( \n\t\t\t\t\t 'idreg' => '1',\n\t\t\t\t\t 'new' => '1',\n\t\t\t\t\t 'tm' => 'msmall',\n\t\t\t\t\t 'c1' => 'ffffff', \n\t\t\t\t\t 'b1' => '93c1db',\n\t\t\t\t\t 'b2' => '3a8ebd',\n\t\t\t\t\t), $atts ) );\n\t\t\t\t\t$wloc=trebi_getUrlRegione($idreg);\n\t\t\t\t\treturn $ifstart.'idreg='.$idreg.'&tm='.$tm.'&new='.$new.'&c1='.$c1.'&b1='.$b1.'&b2='.$b2.'\" width=\"190\" height=\"300\" frameborder=\"0\">'.$ifend.$wloc;\n\t\t\t\t\tbreak;\n/* <iframe src=\"http://www.3bmeteo.com/3bm_meteo.php?idreg=1&tm=msmacro&c1=FFFFFF&c2=555555&c3=93C1DB&b1=93C1DB&b2=3A8EBD\" width=\"660\" height=\"542\" frameborder=\"0\"></iframe> */\n\t\t\t\tcase 'trebi-d2':\n\t\t\t\t\textract( shortcode_atts( array( \n\t\t\t\t\t 'idreg' => '1',\n\t\t\t\t\t 'tm' => 'msmacro',\n\t\t\t\t\t 'c1' => 'FFFFFF', \n\t\t\t\t\t 'c2' => '555555',\n\t\t\t\t\t 'c3' => '93C1DB',\n\t\t\t\t\t 'b1' => '93C1DB',\n\t\t\t\t\t 'b2' => '3A8EBD',\n\t\t\t\t\t), $atts ) );\n\t\t\t\t\t$wloc=trebi_getUrlRegione($idreg);\n\t\t\t\t\treturn $ifstart.'idreg='.$idreg.'&tm='.$tm.'&c1='.$c1.'&c2='.$c2.'&c3='.$c3.'&b1='.$b1.'&b2='.$b2.'\" width=\"660\" height=\"515\" frameborder=\"0\">'.$ifend.$wloc;\n\t\t\t\t\tbreak;\n/* BLOCCO E (E1, E2) */\n/* <iframe src=\"http://www.3bmeteo.com/3bm_meteo.php?loc=6&tm=lsmari&c1=ffffff&b1=93c1db&b2=3a8ebd\" width=\"190\" height=\"260\" frameborder=\"0\"></iframe> */\n\t\t\t\tcase 'trebi-e1':\n\t\t\t\t\textract( shortcode_atts( array( \n\t\t\t\t\t 'loc' => '6', \n\t\t\t\t\t 'tm' => 'lsmari',\n\t\t\t\t\t 'c1' => 'ffffff', \n\t\t\t\t\t 'b1' => '93c1db',\n\t\t\t\t\t 'b2' => '3a8ebd',\n\t\t\t\t\t), $atts ) );\n\t\t\t\t\t$wloc=trebi_getUrlLoc($loc);\n\t\t\t\t\treturn $ifstart.'loc='.$loc.'&tm='.$tm.'&c1='.$c1.'&b1='.$b1.'&b2='.$b2.'\" width=\"190\" height=\"260\" frameborder=\"0\">'.$ifend.$wloc;\n\t\t\t\t\tbreak;\n/* <iframe src=\"http://www.3bmeteo.com/3bm_meteo.php?loc=6&tm=lmari&c1=FFFFFF&c3=93C1DB&b1=93C1DB&b2=3A8EBD\" width=\"460\" height=\"390\" frameborder=\"0\"></iframe> */\n\t\t\t\tcase 'trebi-e2':\n\t\t\t\t\textract( shortcode_atts( array(\n\t\t\t\t\t 'loc' => '6', \n\t\t\t\t\t 'tm' => 'lmari',\n\t\t\t\t\t 'c1' => 'FFFFFF', \n\t\t\t\t\t 'b1' => '93C1DB',\n\t\t\t\t\t 'b2' => '3A8EBD',\n\t\t\t\t\t 'c3' => '93C1DB',\n\t\t\t\t\t), $atts ) );\n\t\t\t\t\t$wloc=trebi_getUrlLoc($loc);\n\t\t\t\t\treturn $ifstart.'loc='.$loc.'&tm='.$tm.'&c1='.$c1.'&c3='.$c3.'&b1='.$b1.'&b2='.$b2.'\" width=\"460\" height=\"380\" frameborder=\"0\">'.$ifend.$wloc;\n\t\t\t\t\tbreak;\n/* BLOCCO F (F1, F2) */\n/* <iframe src=\"http://www.3bmeteo.com/3bm_meteo.php?idreg=1&tm=mmari&c1=FFFFFF&c2=555555&c3=93C1DB&b1=93C1DB&b2=3A8EBD\" width=\"650\" height=\"515\" frameborder=\"0\"></iframe> */\n\t\t\t\tcase 'trebi-f1':\n\t\t\t\t\textract( shortcode_atts( array( \n\t\t\t\t\t 'idreg' => '1', \n\t\t\t\t\t 'tm' => 'mmari',\n\t\t\t\t\t 'c1' => 'FFFFFF',\n\t\t\t\t\t 'c2' => '555555',\n\t\t\t\t\t 'c3' => '93C1DB', \n\t\t\t\t\t 'b1' => '93C1DB',\n\t\t\t\t\t 'b2' => '3A8EBD',\n\t\t\t\t\t), $atts ) );\n\t\t\t\t\t$wloc=trebi_getUrlRegione($idreg);\n\t\t\t\t\treturn $ifstart.'idreg='.$idreg.'&tm='.$tm.'&c1='.$c1.'&c2='.$c2.'&b1='.$b1.'&b2='.$b2.'&c3='.$c3.'\" width=\"650\" height=\"515\" frameborder=\"0\">'.$ifend.$wloc;\n/* BLOCCO G (G1, G2) */\n/* <iframe src=\"http://www.3bmeteo.com/3bm_meteo.php?loc=6&tm=lsneve&c1=ffffff&b1=93c1db&b2=3a8ebd\" width=\"190\" height=\"235\" frameborder=\"0\"></iframe> */\t\n\t\t\t\tcase 'trebi-g1':\n\t\t\t\t\textract( shortcode_atts( array( \n\t\t\t\t\t 'loc' => '6', \n\t\t\t\t\t 'tm' => 'lsneve',\n\t\t\t\t\t 'c1' => 'ffffff', \n\t\t\t\t\t 'b1' => '93c1db',\n\t\t\t\t\t 'b2' => '3a8ebd',\n\t\t\t\t\t), $atts ) );\n\t\t\t\t\t$wloc=trebi_getUrlLoc($loc);\n\t\t\t\t\treturn $ifstart.'loc='.$loc.'&tm='.$tm.'&c1='.$c1.'&b1='.$b1.'&b2='.$b2.'\" width=\"210\" height=\"240\" frameborder=\"0\">'.$ifend.$wloc;\n\t\t\t\t\tbreak;\n/* <iframe src=\"http://www.3bmeteo.com/3bm_meteo.php?loc=6&tm=lneve&c1=FFFFFF&c3=93C1DB&b1=93C1DB&b2=3A8EBD\" width=\"490\" height=\"425\" frameborder=\"0\"></iframe> */\n\t\t\t\tcase 'trebi-g2':\n\t\t\t\t\textract( shortcode_atts( array( \n\t\t\t\t\t 'loc' => '6', \n\t\t\t\t\t 'tm' => 'lneve',\n\t\t\t\t\t 'c1' => 'FFFFFF', \n\t\t\t\t\t 'c3' => '93C1DB', \n\t\t\t\t\t 'b1' => '93C1DB',\n\t\t\t\t\t 'b2' => '3A8EBD',\n\t\t\t\t\t), $atts ) );\n\t\t\t\t\t$wloc=trebi_getUrlLoc($loc);\n\t\t\t\t\treturn $ifstart.'loc='.$loc.'&tm='.$tm.'&c1='.$c1.'&c3='.$c3.'&b1='.$b1.'&b2='.$b2.'\" width=\"490\" height=\"420\" frameborder=\"0\">'.$ifend.$wloc;\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}", "public function getEmbedCode();", "public function setup_item( $item ) {\n\t\t\tif ( !is_object( $item ) )\n\t\t\t\treturn $item;\n\n\t\t\t// only if it is our object\n\t\t\tif ( $item->object == 'gs_sim' ) {\n\n\t\t\t\t// setup our label\n\t\t\t\t$item->type_label = __( 'Shortcode', IFLANG );\n\n\t\t\t\tif ( $item->post_content != '' ) {\n\t\t\t\t\t$item->description = $item->post_content;\n\t\t\t\t} else {\n\n\t\t\t\t\t// set up the description from the transient\n\t\t\t\t\t$item->description = get_transient( 'gs_sim_description_hack_' . $item->object_id );\n\n\t\t\t\t\t// discard the transient\n\t\t\t\t\tdelete_transient( 'gs_sim_description_hack_' . $item->object_id );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $item;\n\t\t}", "function shortcode_template( $atts, $content = null ) {\r\n\t\t\tglobal $mpc_ma_options;\r\n\t\t\tif ( ! defined( 'MPC_MASSIVE_FULL' ) || ( defined( 'MPC_MASSIVE_FULL' ) && $mpc_ma_options[ 'single_js_css' ] !== '1' ) ) {\r\n\t\t\t\t$this->enqueue_shortcode_scripts();\r\n\t\t\t}\r\n\r\n\t\t\t$atts = shortcode_atts( array(\r\n\t\t\t\t'class' => '',\r\n\t\t\t\t'preset' => '',\r\n\t\t\t\t'content_preset' => '',\r\n\t\t\t\t'style' => 'horizontal',\r\n\t\t\t\t'space' => '',\r\n\t\t\t\t'fullwidth' => '',\r\n\r\n\t\t\t\t'padding_css' => '',\r\n\t\t\t\t'margin_css' => '',\r\n\t\t\t\t'border_css' => '',\r\n\r\n\t\t\t\t'icon_type' => 'icon',\r\n\t\t\t\t'icon' => '',\r\n\t\t\t\t'icon_character' => '',\r\n\t\t\t\t'icon_image' => '',\r\n\t\t\t\t'icon_image_size' => 'thumbnail',\r\n\t\t\t\t'icon_preset' => '',\r\n\t\t\t\t'icon_color' => '#333333',\r\n\t\t\t\t'icon_size' => '',\r\n\r\n\t\t\t\t'icon_margin_css' => '',\r\n\t\t\t\t'icon_animation' => 'none',\r\n\r\n\t\t\t\t'background_type' => 'color',\r\n\t\t\t\t'background_color' => '',\r\n\t\t\t\t'background_image' => '',\r\n\t\t\t\t'background_image_size' => 'large',\r\n\t\t\t\t'background_repeat' => 'no-repeat',\r\n\t\t\t\t'background_size' => 'initial',\r\n\t\t\t\t'background_position' => 'middle-center',\r\n\t\t\t\t'background_gradient' => '#83bae3||#80e0d4||0;100||180||linear',\r\n\r\n\t\t\t\t'animation_in_type' => 'none',\r\n\t\t\t\t'animation_in_duration' => '300',\r\n\t\t\t\t'animation_in_delay' => '0',\r\n\t\t\t\t'animation_in_offset' => '100',\r\n\r\n\t\t\t\t'animation_loop_type' => 'none',\r\n\t\t\t\t'animation_loop_duration' => '1000',\r\n\t\t\t\t'animation_loop_delay' => '1000',\r\n\t\t\t\t'animation_loop_hover' => '',\r\n\t\t\t), $atts );\r\n\r\n\t\t\t$styles = $this->shortcode_styles( $atts );\r\n\t\t\t$css_id = $styles[ 'id' ];\r\n\r\n\t\t\t$icon = MPC_Parser::icon( $atts );\r\n\t\t\t$animation = MPC_Parser::animation( $atts );\r\n\r\n\t\t\t$classes = $animation != '' ? ' mpc-animation' : '';\r\n\t\t\t$classes .= $atts[ 'fullwidth' ] != '' ? ' mpc-fullwidth' : '';\r\n\t\t\t$classes .= $atts[ 'style' ] == 'horizontal' ? ' mpc-style--horizontal' : ' mpc-style--vertical';\r\n\t\t\t$classes .= ' ' . esc_attr( $atts[ 'class' ] );\r\n\r\n\t\t\t$separator_classes = $icon[ 'class' ] == '' && $icon[ 'content' ] == '' ? ' mpc-empty' : '';\r\n\r\n\t\t\tglobal $mpc_button_separator;\r\n\t\t\t$mpc_button_separator = '<span class=\"mpc-button-separator-wrap\"><span class=\"mpc-button-separator-box\"><span class=\"mpc-button-separator ' . $icon[ 'class' ] . $separator_classes . '\">' . $icon[ 'content' ] . '</span></span></span>';\r\n\r\n\t\t\t$return = '<div id=\"' . $css_id . '\" class=\"mpc-button-set mpc-init' . $classes . '\"' . $animation . ( $atts[ 'icon_animation' ] != 'none' ? ' data-animation=\"' . esc_attr( $atts[ 'icon_animation' ] ) . '\"' : '' ) . '>';\r\n\t\t\t\t$return .= do_shortcode( $content );\r\n\t\t\t$return .= '</div>';\r\n\r\n\t\t\t$mpc_button_separator = null;\r\n\r\n\t\t\tglobal $mpc_frontend;\r\n\t\t\tif ( $mpc_frontend ) {\r\n\t\t\t\t$return .= '<style>' . $styles[ 'css' ] . '</style>';\r\n\t\t\t}\r\n\r\n\t\t\treturn $return;\r\n\t\t}", "function mr_megaresult_shortcode_handler( $attrs, $content=null) {\n return \"look, a shortcode!\";\n}", "function video_cck_tudou_preview($embed, $width, $height, $field, $item, $autoplay) {\n $output = theme('video_cck_tudou_flash', $embed, $width, $height, $autoplay);\n return $output;\n}", "function emvideo_dotsub_preview($embed, $width, $height, $field, $item, $node, $autoplay) {\n $output = theme('emvideo_dotsub_flash', $item, $width, $height, $autoplay);\n return $output;\n}", "function shortcodeHandler($atts, $content = null) {\r\n\t\textract( shortcode_atts( array(\r\n\t\t\t 'vid' => '0'\r\n\t\t\t,'vtitle' => ''\r\n\t\t\t,'vinline' => 'false'\r\n\t\t\t), $atts ) );\r\n\t\t$vinline = (strtolower($vinline) == 'true');\r\n\t\treturn $this->_getLinkTag($vid, $vtitle, $vinline);\r\n\t}", "function dm_brightcove_embed_shortcode($atts) {\n\textract(shortcode_atts(array(\n\t\t'width' => 400,\n\t\t'height' => 220,\n\t\t'player_id' => '1083378382001',\n\t\t'player_key' => 'AQ~~,AAAA7SJlvPE~,hKj__M4BL26l6pXW6JlVCmbP5q8je1e_',\n\t\t'video_id' => ''\n\t), $atts));\n\n\tob_start();\n?>\n\t<div class=\"brightcove_video\">\n\t\t<script src=\"http://admin.brightcove.com/js/BrightcoveExperiences.js\"></script>\n\t\t<object id=\"myExperience<?php echo $video_id; ?>\" class=\"BrightcoveExperience\">\n\t\t\t<param name=\"bgcolor\" value=\"#FFFFFF\" />\n\t\t\t<param name=\"width\" value=\"<?php echo $width; ?>\" />\n\t\t\t<param name=\"height\" value=\"<?php echo $height; ?>\" />\n\t\t\t<param name=\"playerID\" value=\"<?php echo $player_id; ?>\" />\n\t\t\t<param name=\"playerKey\" value=\"<?php echo $player_key; ?>\" />\n\t\t\t<param name=\"isVid\" value=\"true\" />\n\t\t\t<param name=\"isUI\" value=\"true\" />\n\t\t\t<param name=\"dynamicStreaming\" value=\"true\" />\n\t\t\t<param name=\"@videoPlayer\" value=\"<?php echo $video_id; ?>\" />\n\t\t</object>\n\t\t<script>\n\t\t\tbrightcove.createExperiences();\n\t\t</script>\n\t</div>\n<?php\n\t$output = ob_get_clean();\n\treturn $output;\n}", "function pt_shortcode( $atts )\n\t\t{\n\t\t\treturn $this->pt_show_blc_front();\n\t\t}", "function apply_shortcodes($content, $ignore_html = \\false)\n {\n }", "public static function parse_shortcode($attributes, $content, $parser, $shortcode): string;", "public function convert_shortcodes( $content ) {\n\t\t// Override Jetpack shortcodes\n\t\tadd_shortcode( 'youtube', function( $atts ) {\n\t\t\treturn $this->hugo_shortcode( 'youtube', jetpack_get_youtube_id( $atts[0] ) );\n\t\t} );\n\n\t\tadd_shortcode( 'vimeo', function( $atts ) {\n\t\t\t$id = isset( $atts['id'] ) ? $atts['id'] : jetpack_shortcode_get_vimeo_id( $atts );\n\t\t\treturn $this->hugo_shortcode( 'vimeo', $id );\n\t\t} );\n\n\t\t// Use `<blockquote>` which then gets coverted to `> Lorem ipsum` by Markdownify\n\t\tadd_shortcode( 'quote', function( $atts ) {\n\t\t\t$id = isset( $atts['id'] ) ? $atts['id'] : $this->id;\n\t\t\t$pullquote = get_post_meta( $id, 'quote', true );\n\t\t\tif ( empty( $pullquote ) ) {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t\treturn '<blockquote>' . esc_html( $pullquote ) . '</blockquote>';\n\t\t} );\n\n\t\tadd_shortcode( 'caption', function( $atts, $content ) {\n\t\t\t$args = $this->parse_hugo_figure_args( $content );\n\t\t\treturn $this->hugo_figure( $args );\n\t\t} );\n\n\t\tadd_shortcode( 'googlemaps', function( $atts ) {\n\t\t\t$url = urldecode( $atts[0] );\n\t\t\t$url = preg_replace( '/&w=\\d+&h=\\d+]/', ']', $url );\n\t\t\treturn '{{< iframe src=\"' . $url . '\" width=\"100%\" height=\"250px\" >}}';\n\t\t} );\n\n\t\t$content = do_shortcode( $content );\n\t\treturn $content;\n\t}", "function render_block_core_shortcode($attributes, $content)\n {\n }", "function acf_shortcode($atts)\n{\n}", "function shortcode_map() {\r\n\t\t\tif ( ! function_exists( 'vc_map' ) ) {\r\n\t\t\t\treturn '';\r\n\t\t\t}\r\n\r\n\t\t\t$base = array(\r\n\t\t\t\tarray(\r\n\t\t\t\t\t'type' => 'mpc_preset',\r\n\t\t\t\t\t'heading' => __( 'Style Preset', 'mpc' ),\r\n\t\t\t\t\t'param_name' => 'preset',\r\n\t\t\t\t\t'tooltip' => MPC_Helper::style_presets_desc(),\r\n\t\t\t\t\t'value' => '',\r\n\t\t\t\t\t'shortcode' => $this->shortcode,\r\n\t\t\t\t\t'wide_modal' => true,\r\n\t\t\t\t\t'description' => __( 'Choose preset or create new one.', 'mpc' ),\r\n\t\t\t\t),\r\n\t\t\t\tarray(\r\n\t\t\t\t\t'type' => 'mpc_content',\r\n\t\t\t\t\t'heading' => __( 'Content Preset', 'mpc' ),\r\n\t\t\t\t\t'param_name' => 'content_preset',\r\n\t\t\t\t\t'tooltip' => MPC_Helper::content_presets_desc(),\r\n\t\t\t\t\t'value' => '',\r\n\t\t\t\t\t'shortcode' => $this->shortcode,\r\n\t\t\t\t\t'extended' => true,\r\n\t\t\t\t\t'description' => __( 'Choose preset or create new one.', 'mpc' ),\r\n\t\t\t\t),\r\n\t\t\t\tarray(\r\n\t\t\t\t\t'type' => 'dropdown',\r\n\t\t\t\t\t'heading' => __( 'Style', 'mpc' ),\r\n\t\t\t\t\t'param_name' => 'style',\r\n\t\t\t\t\t'admin_label' => true,\r\n\t\t\t\t\t'tooltip' => __( 'Select buttons set style:<br><b>Horizontal</b>: horizontal buttons side by side;<br><b>Vertical</b>: vertical buttons one under the other.', 'mpc' ),\r\n\t\t\t\t\t'value' => array(\r\n\t\t\t\t\t\t__( 'Horizontal', 'mpc' ) => 'horizontal',\r\n\t\t\t\t\t\t__( 'Vertical', 'mpc' ) => 'vertical',\r\n\t\t\t\t\t),\r\n\t\t\t\t\t'std' => 'horizontal',\r\n\t\t\t\t\t'edit_field_class' => 'vc_col-sm-4 vc_column mpc-advanced-field',\r\n\t\t\t\t),\r\n\t\t\t\tarray(\r\n\t\t\t\t\t'type' => 'mpc_text',\r\n\t\t\t\t\t'heading' => __( 'Separator Space', 'mpc' ),\r\n\t\t\t\t\t'param_name' => 'space',\r\n\t\t\t\t\t'tooltip' => __( 'Define separator space between buttons. Adds additional space on sides of separator to prevent it from overlapping button content.', 'mpc' ),\r\n\t\t\t\t\t'value' => '',\r\n\t\t\t\t\t'addon' => array(\r\n\t\t\t\t\t\t'icon' => 'dashicons dashicons-leftright',\r\n\t\t\t\t\t\t'align' => 'prepend',\r\n\t\t\t\t\t),\r\n\t\t\t\t\t'label' => 'px',\r\n\t\t\t\t\t'validate' => true,\r\n\t\t\t\t\t'edit_field_class' => 'vc_col-sm-4 vc_column mpc-advanced-field',\r\n\t\t\t\t),\r\n\t\t\t\tarray(\r\n\t\t\t\t\t'type' => 'checkbox',\r\n\t\t\t\t\t'heading' => __( 'Full Width', 'mpc' ),\r\n\t\t\t\t\t'param_name' => 'fullwidth',\r\n\t\t\t\t\t'tooltip' => __( 'Check to stretch buttons to 100% width of their container.', 'mpc' ),\r\n\t\t\t\t\t'value' => array( __( 'Enable', 'mpc' ) => 'true' ),\r\n\t\t\t\t\t'std' => '',\r\n\t\t\t\t\t'edit_field_class' => 'vc_col-sm-4 vc_column mpc-advanced-field',\r\n\t\t\t\t),\r\n\t\t\t);\r\n\r\n\t\t\t$icon_animation = array(\r\n\t\t\t\tarray(\r\n\t\t\t\t\t'type' => 'mpc_animation',\r\n\t\t\t\t\t'heading' => __( 'Animation Effect', 'mpc' ),\r\n\t\t\t\t\t'param_name' => 'icon_animation',\r\n\t\t\t\t\t'tooltip' => __( 'Choose one of the animation types. You can apply the animation to the preview box on the right with the <b>Refresh</b> button.', 'mpc' ),\r\n\t\t\t\t\t'value' => MPC_Snippets::$animations_loop_list,\r\n\t\t\t\t\t'std' => 'none',\r\n\t\t\t\t\t'group' => __( 'Separator', 'mpc' ),\r\n\t\t\t\t\t'edit_field_class' => 'vc_col-sm-12 vc_column mpc-advanced-field',\r\n\t\t\t\t),\r\n\t\t\t);\r\n\r\n\t\t\t$margin = MPC_Snippets::vc_margin();\r\n\t\t\t$animation = MPC_Snippets::vc_animation();\r\n\t\t\t$class = MPC_Snippets::vc_class();\r\n\r\n\t\t\t$background = MPC_Snippets::vc_background( array( 'group' => __( 'Separator', 'mpc' ) ) );\r\n\t\t\t$border = MPC_Snippets::vc_border( array( 'group' => __( 'Separator', 'mpc' ) ) );\r\n\t\t\t$padding = MPC_Snippets::vc_padding( array( 'group' => __( 'Separator', 'mpc' ) ) );\r\n\t\t\t$icon_margin = MPC_Snippets::vc_margin( array( 'prefix' => 'icon', 'group' => __( 'Separator', 'mpc' ) ) );\r\n\t\t\t$icon = MPC_Snippets::vc_icon( array( 'group' => __( 'Separator', 'mpc' ) ) );\r\n\r\n\t\t\t$params = array_merge( $base, $margin, $icon, $icon_animation, $background, $border, $padding, $icon_margin, $animation, $class );\r\n\r\n\t\t\treturn array(\r\n\t\t\t\t'name' => __( 'Buttons Set', 'mpc' ),\r\n\t\t\t\t'description' => __( 'Buttons with separator', 'mpc' ),\r\n\t\t\t\t'base' => 'mpc_button_set',\r\n\t\t\t\t'class' => '',\r\n\t\t\t\t'icon' => 'mpc-shicon-buttons-set',\r\n\t\t\t\t'category' => __( 'MPC', 'mpc' ),\r\n\t\t\t\t'as_parent' => array( 'only' => 'mpc_button, mpc_lightbox' ),\r\n\t\t\t\t'content_element' => true,\r\n\t\t\t\t\"js_view\" => 'VcColumnView',\r\n\t\t\t\t'params' => $params,\r\n\t\t\t);\r\n\t\t}", "function do_shortcode($content, $ignore_html = \\false)\n {\n }", "public function wppcShortcode($atts)\n\t\t\t{\n\t\t\t\t// Shortcode default atributes\n\t\t\t\t$atts = shortcode_atts(array('id' => 1), $atts);\n\n\t\t\t\tglobal $wpdb;\n\t\t\t\t$contest = $wpdb->get_row('SELECT * FROM '.WPPC_TABLE_ALL_CONTESTS.' WHERE id='.$atts['id']);\n\t\t\t\t$contestWinners = unserialize($contest->contest_winners);\n\t\t\t\t?>\n\n\t\t\t\t<div id=\"wppc-contest\">\n\t\t\t\t\t<div id=\"wppc-main\">\n\t\t\t\t\t\t<div id=\"contest-tabs\" style=\"display: inline;\">\n\t\t\t\t\t\t\t<ul id=\"contest-nav\" style=\"margin-bottom: 20px; margin-top: 20px;\">\n\t\t\t\t\t\t\t\t<?php if ($contest->contest_about != ''): ?><li style=\"display: inline; margin-right: 2rem;\" <?php if ($contest->start_date > date('Y-m-d h:m:s', time())): ?>class=\"ui-state-default ui-corner-top ui-tabs-active ui-state-active\"<?php endif; ?>><a href=\"#contest-about\">About</a></li><?php endif; ?>\n\t\t\t\t\t\t\t\t<?php if ($contest->start_date <= date('Y-m-d h:m:s', time())): ?><li style=\"display: inline; margin-right: 2rem;\" class=\"ui-state-default ui-corner-top ui-tabs-active ui-state-active\"><a href=\"#contest-photo-gallery\">Photo Gallery</a></li><?php endif; ?>\n\t\t\t\t\t\t\t\t<?php if ($contestWinners['text'] != ''): ?><li style=\"display: inline; margin-right: 2rem;\"><a href=\"#contest-winners\">Winners</a></li><?php endif; ?>\n\t\t\t\t\t\t\t\t<?php if ($contest->contest_rules != ''): ?><li style=\"display: inline; margin-right: 2rem;\"><a href=\"#contest-rules\">Rules</a></li><?php endif; ?>\n\t\t\t\t\t\t\t\t<?php if ($contest->contest_prizes != ''): ?><li style=\"display: inline; margin-right: 2rem;\"><a href=\"#contest-prizes\">Prizes</a></li><?php endif; ?>\n\t\t\t\t\t\t\t\t<?php if ($contest->start_date <= date('Y-m-d h:m:s', time()) && date('Y-m-d h:m:s', time()) <= date('Y-m-d', strtotime('+1 day' , strtotime($contest->end_registration)))): ?><li style=\"display: inline; margin-right: 2rem;\"><a href=\"#contest-entry-form\">Entry form</a></li><?php endif; ?>\n\t\t\t\t\t\t\t\t<?php if ($contest->contest_contact != ''): ?><li style=\"display: inline; margin-right: 2rem;\"><a href=\"#contest-contact\">Contact</a></li><?php endif; ?>\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<!-- Contest about -->\n\t\t\t\t\t\t\t<?php if ($contest->contest_about != ''): ?>\n\t\t\t\t\t\t\t\t<div id=\"contest-about\">';\n\t\t\t\t\t\t\t\t\t<?php echo $this->formatContent($contest->contest_about); ?>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<?php endif; ?>\n\n\t\t\t\t\t\t\t<!-- Contest photo gallery -->\n\t\t\t\t\t\t\t<?php if ($contest->start_date <= date('Y-m-d h:m:s', time())): ?>\n\t\t\t\t\t\t\t\t<div id=\"contest-photo-gallery\">\n\t\t\t\t\t\t\t\t\t<?php echo $contest->contest_photo_gallery; ?>\n\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t$totalDays = (strtotime($contest->end_registration) - strtotime($contest->start_date)) / (60*60*24);\n\t\t\t\t\t\t\t\t\t\t$weeks = $totalDays % 7 != 0 ? $totalDays / 7 + 1 : $totalDays / 7;\n\t\t\t\t\t\t\t\t\t?>\n\n\t\t\t\t\t\t\t\t\t<!-- Contest filters -->\n\t\t\t\t\t\t\t\t\t<div id=\"wppc-filters\" class=\"row\" style=\"margin-top:20px; margin-bottom: 20px;\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"col-md-3\">\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" value=\"<?php echo $contest->id ?>\" />\n\t\t\t\t\t\t\t\t\t\t\t<select name=\"wppc-weeks\" id=\"wppc-weeks\" class=\"form-control wppc-select-filter\">\n\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"week-all\">All weeks</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t\tfor ($week = 1; $week <= $weeks; $week ++)\n\t\t\t\t\t\t\t\t\t\t\t\t\techo '<option value=\"week-'.$week.'\">Week '.$week.'</option>';\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</select>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<div class=\"col-md-3 col-md-offset-1\">\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" value=\"<?php echo $contest->id ?>\" />\n\t\t\t\t\t\t\t\t\t\t\t<select name=\"wppc-points\" id=\"wppc-points\" class=\"form-control wppc-select-filter\">\n\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"point-all\">All points</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"point-0\">0 points</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"point-1\">1 point</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"point-2\">2 points</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"point-3\">3 points</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"point-4\">4 points</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"point-5\">5 points</option>\n\t\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<?php if ($contest->photos_mobile_allowed > 0): ?>\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"col-md-3 col-md-offset-1\">\n\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" value=\"<?php echo $contest->id ?>\" />\n\t\t\t\t\t\t\t\t\t\t\t\t<button type=\"button\" value=\"mobile-only\" class=\"btn btn-primary\" id=\"wppc-button-filter\">Mobile only</button>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<?php endif; ?>\n\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t<!-- Contest photos -->\n\t\t\t\t\t\t\t\t\t<div id=\"wppc-photos\">\n\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t$wpDir = wp_upload_dir();\n\t\t\t\t\t\t\t\t\t\t\t$contestDir = $wpDir['baseurl'].'/wppc-photos/wppc-photos-'.$contest->id.'/';\n\n\t\t\t\t\t\t\t\t\t\t\t// Get all photos for this contest\n\t\t\t\t\t\t\t\t\t\t\t$contestPhotos = $wpdb->get_results('SELECT * FROM '.WPPC_TABLE_CONTESTS_ENTRIES.' WHERE contest_id='.$contest->id.' AND visible=1');\n\n\t\t\t\t\t\t\t\t\t\t\t// Shuffle photos\n\t\t\t\t\t\t\t\t\t\t\tshuffle($contestPhotos);\n\n\t\t\t\t\t\t\t\t\t\t\t// Get points\n\t\t\t\t\t\t\t\t\t\t\t$contestPoints = array($contest->first_point, $contest->second_point, $contest->third_point, $contest->forth_point, $contest->fifth_point);\n\n\t\t\t\t\t\t\t\t\t\t\t$this->displayContestPhotos($contestPhotos, $contest->contest_name, $contest->end_vote, $contestDir, $contestPoints, get_permalink(get_the_id()), $contest->contest_social_description, $this->photosPerPage);\n\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<?php endif; ?> \n\n\t\t\t\t\t\t\t<!-- Contest winners -->\n\t\t\t\t\t\t\t<?php if ($contestWinners['text'] != ''): ?>\n\t\t\t\t\t\t\t\t<div id=\"contest-winners\">\n\t\t\t\t\t\t\t\t\t<?php echo $contestWinners['text'] ?>\n\t\t\t\t\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t\t\t\t\t<h2>First prize</h2>\n\t\t\t\t\t\t\t\t\t\t<?php $firstWinner = $wpdb->get_row(\"SELECT * FROM WPPC_TABLE_CONTESTS_ENTRIES WHERE contest_id='\".$atts['id'].\"' AND photo_id=\".$contestWinners['first-winner'], ARRAY_A); ?>\n\t\t\t\t\t\t\t\t\t\t<a class=\"group1\" href=\"<?php echo $contestDir ?>medium/<?php echo $firstWinner['competitor_photo'] ?>\" title=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"<?php echo $contestDir ?>medium/<?php echo $firstWinner['competitor_photo'] ?>\" alt=\"<?php echo $firstWinner['photo_name'] ?>\" />\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"no-padding-left col-md-6\">\n\t\t\t\t\t\t\t\t\t\t\t<h2>Second prize</h2>\n\t\t\t\t\t\t\t\t\t\t\t<?php $secondWinner = $wpdb->get_row(\"SELECT * FROM WPPC_TABLE_CONTESTS_ENTRIES WHERE contest_id='\".$atts['id'].\"' AND photo_id=\".$contestWinners['second-winner'], ARRAY_A); ?>\n\t\t\t\t\t\t\t\t\t\t\t<a class=\"group1\" href=\"<?php echo $contestDir ?>medium/<?php echo $secondWinner['competitor_photo'] ?>\" title=\"\" style=\"background-image: url('<?php echo $contestDir ?>medium/<?php echo $secondWinner['competitor_photo'] ?>'); position: relative; float: left; width: 100%; height: 300px; background-position: 50% 50%; background-repeat: no-repeat; background-size: cover;\">\n\t\t\t\t\t\t\t\t\t\t\t\t<!-- <img src=\"<?php echo $contestDir ?>medium/<?php echo $secondWinner['competitor_photo'] ?>\" alt=\"<?php echo $secondWinner['photo_name'] ?>\" /> -->\n\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<div class=\"no-padding-right col-md-6\">\n\t\t\t\t\t\t\t\t\t\t\t<h2>Third prize</h2>\n\t\t\t\t\t\t\t\t\t\t\t<?php $thirdWinner = $wpdb->get_row(\"SELECT * FROM WPPC_TABLE_CONTESTS_ENTRIES WHERE contest_id='\".$atts['id'].\"' AND photo_id=\".$contestWinners['third-winner'], ARRAY_A); ?>\n\t\t\t\t\t\t\t\t\t\t\t<a class=\"group1\" href=\"<?php echo $contestDir ?>medium/<?php echo $thirdWinner['competitor_photo'] ?>\" title=\"\" style=\"background-image: url('<?php echo $contestDir ?>medium/<?php echo $thirdWinner['competitor_photo'] ?>'); position: relative; float: left; width: 100%; height: 300px; background-position: 50% 50%; background-repeat: no-repeat; background-size: cover;\">\n\t\t\t\t\t\t\t\t\t\t\t\t<!-- <img src=\"<?php echo $contestDir ?>medium/<?php echo $thirdWinner['competitor_photo'] ?>\" alt=\"<?php echo $thirdWinner['photo_name'] ?>\" /> -->\n\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t\t\t\t\t<h2>Our favorites</h2>\n\t\t\t\t\t\t\t\t\t\t<?php foreach ($contestWinners['our-favorites'] as $photoID): ?>\n\t\t\t\t\t\t\t\t\t\t\t<?php $photo = $wpdb->get_row(\"SELECT * FROM WPPC_TABLE_CONTESTS_ENTRIES WHERE contest_id='\".$atts['id'].\"' AND photo_id=\".$photoID, ARRAY_A); ?>\n\t\t\t\t\t\t\t\t\t\t\t<div class=\"col-md-3\">\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"group1\" href=\"<?php echo $contestDir ?>medium/<?php echo $photo['competitor_photo'] ?>\" title=\"\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img src=\"<?php echo $contestDir ?>thumbs/<?php echo $photo['competitor_photo'] ?>\" alt=\"<?php echo $photo['photo_name'] ?>\" />\n\t\t\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<?php endforeach; ?>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<?php endif; ?>\n\n\t\t\t\t\t\t\t<!-- Contest rules -->\n\t\t\t\t\t\t\t<?php if ($contest->contest_rules != ''): ?>\n\t\t\t\t\t\t\t\t<div id=\"contest-rules\">\n\t\t\t\t\t\t\t\t\t<div id=\"rules-tabs\">\n\t\t\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t\t\t<li style=\"display: inline; margin-right: 2rem;\"><a href=\"#en-rules\"><img style=\"max-width: 30px;\" src=\"<?php echo WPPC_URI.'img/flags/uk-flag.png' ?>\" /></a></li>\n\t\t\t\t\t\t\t\t\t\t\t<li style=\"display: inline; margin-right: 2rem;\"><a href=\"#ro-rules\"><img style=\"max-width: 30px;\" src=\"<?php echo WPPC_URI.'img/flags/ro-flag.png' ?>\" /></a></li>\n\t\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t\t\t<?php $rules = unserialize($contest->contest_rules); ?>\n\t\t\t\t\t\t\t\t\t\t<div id=\"en-rules\"><?php echo $rules['en'] ?></div>\n\t\t\t\t\t\t\t\t\t\t<div id=\"ro-rules\"><?php echo $rules['ro'] ?></div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<?php endif; ?>\n\n\t\t\t\t\t\t\t<!-- Contest prizes -->\n\t\t\t\t\t\t\t<?php if ($contest->contest_prizes != ''): ?>\n\t\t\t\t\t\t\t\t<div id=\"contest-prizes\">\n\t\t\t\t\t\t\t\t\t<?php echo $this->formatContent($contest->contest_prizes); ?>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<?php endif; ?>\n\n\t\t\t\t\t\t\t<!-- Contest entry form -->\n\t\t\t\t\t\t\t<?php if ($contest->start_date <= date('Y-m-d h:m:s', time()) && date('Y-m-d h:m:s', time()) <= date('Y-m-d', strtotime('+1 day' , strtotime($contest->end_registration)))): ?>\n\t\t\t\t\t\t\t\t<div id=\"contest-entry-form\">\n\t\t\t\t\t\t\t\t\t<?php $this->setEntryForm($contest->id, $contest->contest_entry_form); ?>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<?php endif; ?>\n\n\t\t\t\t\t\t\t<!-- Contest contact -->\n\t\t\t\t\t\t\t<?php if ($contest->contest_contact != ''): ?>\n\t\t\t\t\t\t\t\t<div id=\"contest-contact\">\n\t\t\t\t\t\t\t\t\t<?php echo $contest->contest_contact; ?>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<?php endif; ?>\n\t\t\t\t\t\t</div> <!-- end contest-tabs -->\n\t\t\t\t\t</div> <!-- end wppc-main -->\n\n\t\t\t\t\t<div id=\"wppc-sidebar\">\n\t\t\t\t\t\t<?php /* Follow us */ setFollowUs(); ?>\n\t\t\t\t\t\t<br/><br/>\n\t\t\t\t\t\t<?php echo $contest->contest_sidebar ?>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<?php\n\t\t\t}", "function video_cck_dailymotion_preview($embed, $width, $height, $field, $item, $autoplay) {\n $output = theme('video_cck_dailymotion_flash', $embed, $width, $height, $autoplay);\n return $output;\n}", "function add_shortcode( $atts, $content = null, $name = null ) {\n\n\t\tif ( ! $this->validate_shortcode( $atts, $content, $name ) ) {\n\t\t\treturn '';\n\t\t}\n\n\t\t$options = $this->set_options( $atts );\n\n\t\tob_start();\n\t\t\n\t\t?><div id=\"<?php echo esc_attr($options['selector']); ?>\" class=\"<?php echo esc_attr($options['classes']); ?>\" <?php do_action(\"oxygen_vsb_component_attr\", $options, $this->options['tag']); ?>><iframe scrolling=\"no\" frameborder=\"no\" src=\"https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/<?php echo $options[\"soundcloud_track_id\"]; ?>&amp;color=<?php echo urlencode($options[\"soundcloud_color\"]); ?>&amp;auto_play=<?php echo urlencode($options[\"soundcloud_auto_play\"]); ?>&amp;hide_related=<?php echo urlencode($options[\"soundcloud_hide_related\"]); ?>&amp;show_comments=<?php echo urlencode($options[\"soundcloud_show_comments\"]); ?>&amp;show_user=true&amp;show_reposts=false&amp;show_teaser=true&amp;visual=true\"></iframe></div><?php\n\n\t\treturn ob_get_clean();\n\t}", "public function convertItem($item);", "function code_block_shortcode_init($atts, $content = null) {\n $stripped_content = remove_empty_p_tags($content);\n $return_string = '<pre>'.$stripped_content.'</pre>';\n return $return_string;\n}", "public static function shortcode( $atts ) {\n\t\t$atts = parent::get_attributes( $atts );\n\n\t\t$recipe = WPRM_Template_Shortcodes::get_recipe( $atts['id'] );\n\t\t$output = '';\n\n\t\treturn apply_filters( parent::get_hook(), $output, $atts, $recipe );\n\t}", "function inline_play_graphic( $atts, $content = null ) {\n\t\t\t\n\t\t\tif ( !$this->external_call && (is_home() || is_archive()) && $this->theSettings['player_onblog'] == \"false\" ) { \n\t\t\t\treturn; \n\t\t\t}\n\t\t\t$id = $this->Player_ID;\t\t\t\n\t\t\textract(shortcode_atts(array( // Defaults\n\t\t\t\t'bold' => 'y',\n\t\t\t\t'track' => '',\n\t\t\t\t'caption' => '',\n\t\t\t\t'flip' => 'r',\n\t\t\t\t'title' => '#USE#',\n\t\t\t\t'ind' => 'y',\n\t\t\t\t'autoplay' => $this->theSettings['auto_play'],\n\t\t\t\t'loop' => 'false',\n\t\t\t\t'vol' => $this->theSettings['initial_vol'],\n\t\t\t\t'flow' => 'n'\n\t\t\t), $atts));\n\t\t\t\t\t\n\t\t\tif ( $track == \"\" ) { // Auto increment \n\t\t\t\tif ( !$this->has_fields || $this->external_call ) { return; }\n\t\t\t\t$track = ++$this->single_autocount;\n\t\t\t\t$arb = \"\";\n\t\t\t}\n\t\t\telseif ( is_numeric($track) ) { // Has a track number\n\t\t\t\tif ( !$this->has_fields || $this->external_call ) { return; }\n\t\t\t\t$arb = \"\";\n\t\t\t}\n\t\t\telse { // Has arbitrary file/uri\t\t\t\t\n\t\t\t\tif ( !$this->string_pushto_playlist( $track, $caption, \"1\" ) ) { return; }\n\t\t\t\t$track = $this->InlinePlaylist['count'];\t\t\t\t\t\n\t\t\t\t$arb = \"arb\";\n\t\t\t}\n\t\t\t\n\t\t\t$divO = \"\";\n\t\t\t$divC = \"\";\n\t\t\tif ( $flow == \"n\" || $this->external_call ) {\n\t\t\t\t$divO = \"<div style=\\\"font-size:14px; line-height:22px !important; margin:0 !important;\\\">\";\n\t\t\t\t$divC = \"</div>\";\n\t\t\t}\n\t\t\t\n\t\t\t$playername = ( $arb != \"\" ) ? \"foxInline\" : $this->has_fields;\n\t\t\t\n\t\t\t// Set font weight\n\t\t\t$b = ( $bold == \"false\" || $bold == \"N\" || $bold == \"n\" ) ? \" style=\\\"font-weight:500;\\\"\" : \" style=\\\"font-weight:700;\\\"\";\n\t\t\t// Prep title\n\t\t\t$customtitle = ( $title == \"#USE#\" ) ? \"\" : $title;\n\t\t\t// tell js it's graphics buttons\n\t\t\t$play = \"#USE_G#\";\n\t\t\t\n\t\t\t// Make id'd span elements\n\t\t\t$openWrap = $divO . \"<span id=\\\"playpause_wrap_mp3j_\" . $id . \"\\\" class=\\\"wrap_inline_mp3j\\\"\" . $b . \">\";\n\t\t\t$pos = \"<span class=\\\"bars_mp3j\\\"><span class=\\\"loadB_mp3j\\\" id=\\\"load_mp3j_\" . $id . \"\\\"></span><span class=\\\"posbarB_mp3j\\\" id=\\\"posbar_mp3j_\" . $id . \"\\\"></span></span>\";\n\t\t\t$play_h = \"<span class=\\\"buttons_mp3j\\\" id=\\\"playpause_mp3j_\" . $id . \"\\\">&nbsp;</span>\";\n\t\t\t$spacer = \"\";\n\t\t\t$title_h = ( $title == \"#USE#\" || $title != \"\" ) ? \"<span class=\\\"T_mp3j\\\" id=\\\"T_mp3j_\" . $id . \"\\\">\" . $customtitle . \"</span>\" : \"\";\n\t\t\t$indi_h = ( $ind != \"y\" ) ? \"<span style=\\\"display:none;\\\" id=\\\"indi_mp3j_\" . $id . \"\\\"></span>\" : \"<span class=\\\"indi_mp3j\\\" id=\\\"indi_mp3j_\" . $id . \"\\\"></span>\";\n\t\t\t\n\t\t\t// TODO: SHOULD THIS GO SOMEWHERE IN SPAN FORMAT??\n\t\t\t$vol_h = \"<div class=\\\"vol_mp3j\\\" id=\\\"vol_mp3j_\" . $id . \"\\\"></div>\";\n\n\t\t\t// Assemble them\t\t\n\t\t\t$html = ( $flip == \"r\" ) ? $openWrap . \"<span class=\\\"group_wrap\\\">\" . $pos . $title_h . $indi_h . \"</span>\" . $play_h . \"</span>\" . $divC : $openWrap . $play_h . \"&nbsp;<span class=\\\"group_wrap\\\">\" . $pos . $title_h . $indi_h . \"</span></span>\" . $divC;\n\t\t\t\n\t\t\t// Add title to js footer string if needed \n\t\t\tif ( $title_h != \"\" && $title == \"#USE#\" ) {\n\t\t\t\t$this->Footerjs .= \"jQuery(\\\"#T_mp3j_\" . $id . \"\\\").append(\" . $playername . \"[\" . ($track-1) . \"].name);\\n\";\n\t\t\t\t//$this->Footerjs .= \"jQuery(\\\"#T_mp3j_\" . $id . \"\\\").append('<span style=\\\"font-size:.7em;\\\"> - '+\" . $playername . \"[\" . ($track-1) . \"].artist+'</span>');\\n\";\n\t\t\t\t$this->Footerjs .= \"if (\" . $playername . \"[\" . ($track-1) . \"].artist !==''){ jQuery(\\\"#T_mp3j_\" . $id . \"\\\").append('<span style=\\\"font-size:.75em;\\\"> - '+\" . $playername . \"[\" . ($track-1) . \"].artist+'</span>'); }\\n\";\n\t\t\t}\n\t\t\t// Add info to js info array\n\t\t\t//$autoplay = ( $autoplay != \"false\" ) ? \"true\" : \"false\";\n\t\t\t$autoplay = ( $autoplay == \"true\" || $autoplay == \"y\" || $autoplay == \"1\" ) ? \"true\" : \"false\";\n\t\t\t$loop = ( $loop != \"false\" ) ? \"true\" : \"false\";\n\t\t\t$this->jsInfo[] = \"\\n { list:\" . $playername . \", type:'single', tr:\" . ($track-1) . \", lstate:'', loop:\" . $loop . \", play_txt:'\" . $play . \"', pause_txt:'\" . $stop . \"', pp_title:'', autoplay:\" . $autoplay . \", has_ul:0, transport:'playpause', status:'basic', download:false, vol:\" . $vol . \", height:'' }\";\n\t\t\t\n\t\t\t$this->write_jp_div();\n\t\t\t$this->Player_ID++;\n\t\t\treturn $html;\n\t\t}", "function tz_one_third( $atts, $content = null ) {\n return '<div class=\"one_third\">' . do_shortcode($content) . '</div>';\n}", "function raw($args){\n\n $default_args = array();\n\n if(isset($args['get_params'])){return $default_args;}\n\n $args = shortcode_atts($default_args, $args);\n $args = $this -> handle_true_false($args);\n\n $this -> prepare_data();\n\n ob_start();\n\n\n echo \"<h2>RAW OUTPUT</h2>\";\n echo \"<pre>\";\n\n print_r($this -> product);\n\n echo \"</pre>\";\n\n $output = ob_get_clean ();\n\n\n return $output;\n\n\n }", "function emvideo_dotsub_video($embed, $width, $height, $field, $item, $node, $autoplay) {\n $output = theme('emvideo_dotsub_flash', $item, $width, $height, $autoplay);\n return $output;\n}", "public function on_shortcode ($atts, $content = '')\n {\n // NOTE: this function keeps the shortcode tags around because\n // we still need them in case we have to save the post.\n //\n // BUG: wpautop Works only if the shortcode tag and\n // attributes are on one line.\n\n // error_log (\"on_shortcode () ==> enter\");\n\n $this->page_has_shortcode = true;\n\n if (!$this->post_id) {\n // relevanssi uses get_the_content () instead of\n // the_content () and thus does not exercise the\n // 'the_content' filter stack\n return $content;\n }\n\n $atts = shortcode_atts (\n array (\n 'xml' => '',\n 'xslt' => '',\n 'params' => '',\n 'stringparams' => '',\n ),\n $atts\n );\n $xml = urljoin (get_opt ('xmlroot'), $atts['xml']);\n $xslt = urljoin (get_opt ('xsltroot'), $atts['xslt']);\n $params = wp_parse_args ($atts['params']);\n $stringparams = wp_parse_args ($atts['stringparams']);\n $xsltproc = get_opt ('xsltproc');\n\n $xml_file_time = intval (filemtime ($xml));\n $xslt_file_time = intval (filemtime ($xslt));\n\n if (!$xml_file_time) {\n return \"XML file $xml not found.\";\n }\n if (!$xslt_file_time) {\n return \"XSLT file $xslt not found.\";\n }\n\n // phpinfo ();\n // passthru ('/usr/bin/xsltproc --help');\n // passthru ('/vol/local/bin/tidy -help');\n\n // do a transform if any of page, xml, or xsl changed\n $do_transform = $this->cache_time < max ($this->modified_time, $xml_file_time, $xslt_file_time);\n // do a transform if http query param cap_xsl == 'reload'\n $do_transform = $do_transform || (get_query_var ('cap_xsl', '') == 'reload');\n $this->is_stale |= $do_transform;\n\n // do a revision only if page or xml changed\n $this->do_revision |= $this->cache_time < max ($this->modified_time, $xml_file_time);\n\n // Keep track of the XML files that make up this page.\n if (!in_array ($xml, $this->xmlfiles)) {\n $this->xmlfiles[] = $xml;\n }\n\n if (!$this->do_xsl || !$do_transform) {\n // Cached copy of this XSL is current. Return the cached copy. The\n // shortcode is already stripped, so we must add it again, so that\n // we can protect our content from the dreaded wp_autop.\n\n // error_log ('on_shortcode () ==> exit cached');\n return $this->wrap_in_shortcode ($content, $atts);\n }\n\n // The cached copy is out of date. Run the XSLT processor. Then add the\n // shortcodes back so we can save them into the db.\n\n $retval = 666;\n $cmdline = array ();\n $cmdline[] = $xsltproc;\n foreach ($params as $key => $value) {\n $key = escapeshellarg ($key);\n $value = escapeshellarg ($value);\n $cmdline[] = \"--param $key $value\";\n }\n foreach ($stringparams as $key => $value) {\n $key = escapeshellarg ($key);\n $value = escapeshellarg ($value);\n $cmdline[] = \"--stringparam $key $value\";\n }\n $cmdline[] = escapeshellarg ($xslt);\n $cmdline[] = escapeshellarg ($xml);\n // '| /vol/local/bin/tidy -qni -xml -utf8 -wrap 80'\n\n // redirect stderr to stdout to keep server error logs small\n // (seems to be a problem at uni-koeln.de)\n $cmdline[] = '2>/dev/null';\n\n $cmdline = join (' ', $cmdline);\n\n $output = array ();\n exec ($cmdline, $output, $retval);\n if (strncmp ($output[0], '<?xml ', 6) == 0) {\n array_shift ($output);\n }\n array_unshift ($output, '<div class=\"xsl-output\">');\n $output[] = '</div>';\n $content = join (\"\\n\", $output);\n\n // A hook to let other plugins know that we just transformed a file.\n // Used by the metadata extraction plugin to keep metadata up-to-date.\n do_action ('cap_xsl_transformed', $this->post_id, $xml, $xslt, $params, $stringparams);\n\n // error_log ('on_shortcode () ==> exit transformed');\n\n return $this->wrap_in_shortcode ($content, $atts);\n }", "function demolistposts_handler() {\n $demolph_output = demolistposts_function();\n //send back text to replace shortcode in post\n return $demolph_output;\n}", "function audio_shortcode( $atts ) {\n\t\tglobal $ap_playerID;\n\t\tglobal $post;\n\t\tif ( ! is_array( $atts ) ) {\n\t\t\treturn '<!-- Audio shortcode passed invalid attributes -->';\n\t\t}\n\n\t\tif ( ! isset( $atts[0] ) ) {\n\t\t\tif ( isset( $atts['src'] ) ) {\n\t\t\t\t$atts[0] = $atts['src'];\n\t\t\t\tunset( $atts['src'] );\n\t\t\t} else {\n\t\t\t\treturn '<!-- Audio shortcode source not set -->';\n\t\t\t}\n\t\t}\n\n\t\t// add the special .js\n\t\twp_enqueue_script(\n\t\t\t'audio-shortcode',\n\t\t\tplugins_url( 'js/audio-shortcode.js', __FILE__ ),\n\t\t\tarray( 'jquery' ),\n\t\t\t'1.1',\n\t\t\ttrue);\n\n\t\t// alert the infinite scroll renderer that it should try to load the script\n\t\tself::$add_script = true;\n\t\t$atts[0] = strip_tags( join( ' ', $atts ) );\n\t\t$src = ltrim( $atts[0], '=' );\n\t\t$ap_options = apply_filters(\n\t\t\t'audio_player_default_colors',\n\t\t\tarray(\n\t\t\t\t\"bg\" => \"0xF8F8F8\",\n\t\t\t\t\"leftbg\" => \"0xEEEEEE\",\n\t\t\t\t\"lefticon\" => \"0x666666\",\n\t\t\t\t\"rightbg\" => \"0xCCCCCC\",\n\t\t\t\t\"rightbghover\" => \"0x999999\",\n\t\t\t\t\"righticon\" => \"0x666666\",\n\t\t\t\t\"righticonhover\" => \"0xFFFFFF\",\n\t\t\t\t\"text\" => \"0x666666\",\n\t\t\t\t\"slider\" => \"0x666666\",\n\t\t\t\t\"track\" => \"0xFFFFFF\",\n\t\t\t\t\"border\" => \"0x666666\",\n\t\t\t\t\"loader\" => \"0x9FFFB8\"\n\t\t\t) );\n\n\t\tif ( ! isset( $ap_playerID ) ) {\n\t\t\t$ap_playerID = 1;\n\t\t} else {\n\t\t\t$ap_playerID++;\n\t\t}\n\n\t\tif ( ! isset( $load_audio_script ) ) {\n\t\t\t$load_audio_script = true;\n\t\t}\n\n\t\t// prep the audio files\n\t\t$src = trim( $src, ' \"' );\n\t\t$options = array();\n\t\t$data = preg_split( \"/\\|/\", $src );\n\t\t$sound_file = $data[0];\n\t\t$sound_files = explode( ',', $sound_file );\n\n\t\tif ( is_ssl() ) {\n\t\t\tfor ( $i = 0; $i < count( $sound_files ); $i++ ) {\n\t\t\t\t$sound_files[ $i ] = preg_replace( '#^http://([^.]+).files.wordpress.com/#', 'https://$1.files.wordpress.com/', $sound_files[ $i ] );\n\t\t\t}\n\t\t}\n\n\t\t$sound_files = array_map( 'trim', $sound_files );\n\t\t$sound_files = array_map( array( $this, 'rawurlencode_spaces' ), $sound_files );\n\t\t$sound_files = array_map( 'esc_url_raw', $sound_files ); // Ensure each is a valid URL\n\t\t$num_files = count( $sound_files );\n\t\t$sound_types = array(\n\t\t\t'mp3' => 'mpeg',\n\t\t\t'wav' => 'wav',\n\t\t\t'ogg' => 'ogg',\n\t\t\t'oga' => 'ogg',\n\t\t\t'm4a' => 'mp4',\n\t\t\t'aac' => 'mp4',\n\t\t\t'webm' => 'webm'\n\t\t);\n\n\t\tfor ( $i = 1; $i < count( $data ); $i++ ) {\n\t\t\t$pair = explode( \"=\", $data[$i] );\n\t\t\tif ( strtolower( $pair[0] ) != 'autostart' ) {\n\t\t\t\t$options[$pair[0]] = $pair[1];\n\t\t\t}\n\t\t}\n\n\t\t// Merge runtime options to default colour options\n\t\t// (runtime options overwrite default options)\n\t\tforeach ( $ap_options as $key => $default ) {\n\t\t\tif ( isset( $options[$key] ) ) {\n\t\t\t\tif ( preg_match( '/^(0x)?[a-f0-9]{6}$/i', $default ) && !preg_match( '/^(0x)?[a-f0-9]{6}$/i', $options[$key] ) ) {\n\t\t\t\t\t// Default is a hex color, but input is not\n\t\t\t\t\t$options[$key] = $default;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$options[$key] = $default;\n\t\t\t}\n\t\t}\n\t\t$options['soundFile'] = join( ',', $sound_files ); // Rebuild the option with our now sanitized data\n\t\t$flash_vars = array();\n\t\tforeach ( $options as $key => $value ) {\n\t\t\t$flash_vars[] = rawurlencode( $key ) . '=' . rawurlencode( $value );\n\t\t}\n\t\t$flash_vars = implode( '&amp;', $flash_vars );\n\t\t$flash_vars = esc_attr( $flash_vars );\n\n\t\t// extract some of the options to insert into the markup\n\t\tif ( isset( $options['bgcolor'] ) && preg_match( '/^(0x)?[a-f0-9]{6}$/i', $options['bgcolor'] ) ) {\n\t\t\t$bgcolor = preg_replace( '/^(0x)?/', '#', $options['bgcolor'] );\n\t\t\t$bgcolor = esc_attr( $bgcolor );\n\t\t} else {\n\t\t\t$bgcolor = '#FFFFFF';\n\t\t}\n\n\t\tif ( isset( $options['width'] ) ) {\n\t\t\t$width = intval( $options['width'] );\n\t\t} else {\n\t\t\t$width = 290;\n\t\t}\n\n\t\t$loop = '';\n\t\t$script_loop = 'false';\n\t\tif ( isset( $options['loop'] ) && 'yes' == $options['loop'] ) {\n\t\t\t$script_loop = 'true';\n\t\t\tif ( 1 == $num_files ) {\n\t\t\t\t$loop = 'loop';\n\t\t\t}\n\t\t}\n\n\t\t$volume = 0.6;\n\t\tif ( isset( $options['initialvolume'] ) &&\n\t\t\t\t0.0 < floatval( $options['initialvolume'] ) &&\n\t\t\t\t100.0 >= floatval( $options['initialvolume'] ) ) {\n\n\t\t\t$volume = floatval( $options['initialvolume'] )/100.0;\n\t\t}\n\n\t\t$file_artists = array_pad( array(), $num_files, '' );\n\t\tif ( isset( $options['artists'] ) ) {\n\t\t\t$artists = preg_split( '/,/', $options['artists'] );\n\t\t\tforeach ( $artists as $i => $artist ) {\n\t\t\t\t$file_artists[$i] = esc_html( $artist ) . ' - ';\n\t\t\t}\n\t\t}\n\n\t\t// generate default titles\n\t\t$file_titles = array();\n\t\tfor ( $i = 0; $i < $num_files; $i++ ) {\n\t\t\t$file_titles[] = 'Track #' . ($i+1);\n\t\t}\n\n\t\t// replace with real titles if they exist\n\t\tif ( isset( $options['titles'] ) ) {\n\t\t\t$titles = preg_split( '/,/', $options['titles'] );\n\t\t\tforeach ( $titles as $i => $title ) {\n\t\t\t\t$file_titles[$i] = esc_html( $title );\n\t\t\t}\n\t\t}\n\n\t\t// fallback for the fallback, just a download link\n\t\t$not_supported = '';\n\t\tforeach ( $sound_files as $sfile ) {\n\t\t\t$not_supported .= sprintf(\n\t\t\t\t__( 'Download: <a href=\"%s\">%s</a><br />', 'jetpack' ),\n\t\t\t\tesc_url( $sfile ),\n\t\t\t\tesc_html( basename( $sfile ) ) );\n\t\t}\n\n\t\t// HTML5 audio tag\n\t\t$html5_audio = '';\n\t\t$all_mp3 = true;\n\t\t$add_audio = true;\n\t\t$num_good = 0;\n\t\t$to_remove = array();\n\t\tforeach ( $sound_files as $i => $sfile ) {\n\t\t\t$file_extension = pathinfo( $sfile, PATHINFO_EXTENSION );\n\t\t\tif ( ! preg_match( '/^(mp3|wav|ogg|oga|m4a|aac|webm)$/i', $file_extension ) ) {\n\t\t\t\t$html5_audio .= '<!-- Audio shortcode unsupported audio format -->';\n\t\t\t\tif ( 1 == $num_files ) {\n\t\t\t\t\t$html5_audio .= $not_supported;\n\t\t\t\t}\n\n\t\t\t\t$to_remove[] = $i; // make a note of the bad files\n\t\t\t\t$all_mp3 = false;\n\t\t\t\tcontinue;\n\t\t\t} elseif ( ! preg_match( '/^mp3$/i', $file_extension ) ) {\n\t\t\t\t$all_mp3 = false;\n\t\t\t}\n\n\t\t\tif ( 0 == $i ) { // only need one player\n\t\t\t\t$html5_audio .= <<<AUDIO\n\t\t\t\t<span id=\"wp-as-{$post->ID}_{$ap_playerID}-container\">\n\t\t\t\t\t<audio id='wp-as-{$post->ID}_{$ap_playerID}' controls preload='none' $loop style='background-color:$bgcolor;width:{$width}px;'>\n\t\t\t\t\t\t<span id=\"wp-as-{$post->ID}_{$ap_playerID}-nope\">$not_supported</span>\n\t\t\t\t\t</audio>\n\t\t\t\t</span>\n\t\t\t\t<br />\nAUDIO;\n\t\t\t}\n\t\t\t$num_good++;\n\t\t}\n\n\t\t// player controls, if needed\n\t\tif ( 1 < $num_files ) {\n\t\t\t$html5_audio .= <<<CONTROLS\n\t\t\t\t<span id='wp-as-{$post->ID}_{$ap_playerID}-controls' style='display:none;'>\n\t\t\t\t\t<a id='wp-as-{$post->ID}_{$ap_playerID}-prev'\n\t\t\t\t\t\thref='javascript:audioshortcode.prev_track( \"{$post->ID}_{$ap_playerID}\" );'\n\t\t\t\t\t\tstyle='font-size:1.5em;'>&laquo;</a>\n\t\t\t\t\t|\n\t\t\t\t\t<a id='wp-as-{$post->ID}_{$ap_playerID}-next'\n\t\t\t\t\t\thref='javascript:audioshortcode.next_track( \"{$post->ID}_{$ap_playerID}\", true, $script_loop );'\n\t\t\t\t\t\tstyle='font-size:1.5em;'>&raquo;</a>\n\t\t\t\t</span>\nCONTROLS;\n\t\t}\n\t\t$html5_audio .= \"<span id='wp-as-{$post->ID}_{$ap_playerID}-playing'></span>\";\n\n\t\tif ( is_ssl() )\n\t\t\t$protocol = 'https';\n\t\telse\n\t\t\t$protocol = 'http';\n\n\t\t$swfurl = apply_filters(\n\t\t\t'jetpack_static_url',\n\t\t\t\"$protocol://en.wordpress.com/wp-content/plugins/audio-player/player.swf\" );\n\n\t\t// all the fancy javascript is causing Google Reader to break, just include flash in GReader\n\t\t// override html5 audio code w/ just not supported code\n\t\tif ( is_feed() ) {\n\t\t\t$html5_audio = $not_supported;\n\t\t}\n\n\t\tif ( $all_mp3 ) {\n\t\t\t// process regular flash player, inserting HTML5 tags into object as fallback\n\t\t\t$audio_tags = <<<FLASH\n\t\t\t\t<object id='wp-as-{$post->ID}_{$ap_playerID}-flash' type='application/x-shockwave-flash' data='$swfurl' width='$width' height='24'>\n\t\t\t\t\t<param name='movie' value='$swfurl' />\n\t\t\t\t\t<param name='FlashVars' value='{$flash_vars}' />\n\t\t\t\t\t<param name='quality' value='high' />\n\t\t\t\t\t<param name='menu' value='false' />\n\t\t\t\t\t<param name='bgcolor' value='$bgcolor' />\n\t\t\t\t\t<param name='wmode' value='opaque' />\n\t\t\t\t\t$html5_audio\n\t\t\t\t</object>\nFLASH;\n\t\t} else { // just HTML5 for non-mp3 versions\n\t\t\t$audio_tags = $html5_audio;\n\t\t}\n\n\t\t// strip out all the bad files before it reaches .js\n\t\tforeach ( $to_remove as $i ) {\n\t\t\tarray_splice( $sound_files, $i, 1 );\n\t\t\tarray_splice( $file_artists, $i, 1 );\n\t\t\tarray_splice( $file_titles, $i, 1 );\n\t\t}\n\n\t\t// mashup the artist/titles for the script\n\t\t$script_titles = array();\n\t\tfor ( $i = 0; $i < $num_files; $i++ ) {\n\t\t\t$script_titles[] = $file_artists[$i] . $file_titles[$i];\n\n\t\t}\n\n\t\t// javacript to control audio\n\t\t$script_files = json_encode( $sound_files );\n\t\t$script_titles = json_encode( $script_titles );\n\t\t$script = <<<SCRIPT\n\t\t\t<script type='text/javascript'>\n\t\t\t//<![CDATA[\n\t\t\t(function() {\n\t\t\t\tvar prep = function() {\n\t\t\t\t\tif ( 'undefined' === typeof window.audioshortcode ) { return; }\n\t\t\t\t\taudioshortcode.prep(\n\t\t\t\t\t\t'{$post->ID}_{$ap_playerID}',\n\t\t\t\t\t\t$script_files,\n\t\t\t\t\t\t$script_titles,\n\t\t\t\t\t\t$volume,\n\t\t\t\t\t\t$script_loop\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t\tif ( 'undefined' === typeof jQuery ) {\n\t\t\t\t\tif ( document.addEventListener ) {\n\t\t\t\t\t\twindow.addEventListener( 'load', prep, false );\n\t\t\t\t\t} else if ( document.attachEvent ) {\n\t\t\t\t\t\twindow.attachEvent( 'onload', prep );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tjQuery(document).on( 'ready as-script-load', prep );\n\t\t\t\t}\n\t\t\t})();\n\t\t\t//]]>\n\t\t\t</script>\nSCRIPT;\n\n\t\t// add the special javascript, if needed\n\t\tif ( 0 < $num_good && ! is_feed() ) {\n\t\t\t$audio_tags .= $script;\n\t\t}\n\n\t\treturn \"<span style='text-align:left;display:block;'><p>$audio_tags</p></span>\";\n\t}", "function sp_video_youtube_sc( $atts ) {\n\n\textract( shortcode_atts( array(\n\t\t'id' => '',\n\t), $atts ) );\n\n\tglobal $post;\n\n\t$output = '<div class=\"entry-video\">';\n\t$output .= '<iframe width=\"600\" height=\"338\" src=\"http://www.youtube.com/embed/'.$id.'?rel=0\" frameborder=\"0\" allowfullscreen></iframe>';\n\t$output .= '</div>';\n\t\n\treturn $output;\n}", "function podigee_player( $atts ) {\n\n\t// Attributes\n\t$atts = shortcode_atts(\n\t\tarray(\n\t\t\t'url' => '',\n\t\t),\n\t\t$atts\n\t);\n\n\treturn '<script class=\"podigee-podcast-player\" src=\"https://cdn.podigee.com/podcast-player/javascripts/podigee-podcast-player.js\" data-configuration=\"' . $atts['url'] . '/embed?context=external\"></script>';\n\n}", "function echotheme_flexslider_shortcode($atts)\n{\n\tob_start();\n\tget_template_part('part', 'flexslider-gallery');\n\treturn ob_get_clean();\n}", "function crumble_list_shortcode($atts, $content = null) {\r\n\textract( shortcode_atts( \r\n\t\tarray( \r\n\t\t\t\"style\" => '1',\r\n\t\t\t\"underline\" => '1' \r\n\t\t), $atts));\r\n\t\r\n\t$code = '';\r\n\t$list_type = '';\r\n\t\r\n\tswitch ($style) {\r\n\t case 1:\r\n\t\t\t$list_type = 'unordered';\r\n\t\t\tbreak;\r\n\t case 2:\r\n\t \t\t$list_type = 'ordered';\r\n\t\t\tbreak;\r\n\r\n\t case 3:\r\n\t \t\t$list_type = 'square';\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t case 4:\r\n\t \t\t$list_type = 'circle';\r\n\t\t\tbreak;\r\n\r\n\t case 5:\r\n\t \t\t$list_type = 'bullets';\r\n\t\t\tbreak;\r\n\t\t\t\r\n\t case 6:\r\n\t \t\t$list_type = 'arrow';\r\n\t\t\tbreak;\r\n\r\n\t case 7:\r\n\t \t\t$list_type = 'arrow2';\r\n\t\t\tbreak;\r\n\t\t\r\n\t}\r\n\t\r\n\tif( $underline == \"1\" ) {\r\n\t\t$code = '<ul class=\"list '.$list_type.' underline\">' . do_shortcode ( $content ) . '</ul>';\r\n\t} else {\r\n\t\t$code = '<ul class=\"list '.$list_type.'\">' . do_shortcode ( $content ) . '</ul>';\r\n\t}\r\n\t\r\n\treturn $code;\r\n\t\r\n}", "function processCodes($Item, $Vars){\n\t\t$Item = preg_replace(\"/[[](.*)[]]/eiU\", \"\\$this->Code('$0',\\$Vars)\", $Item );\n\t\treturn $Item; // Return our formated item.\n\t}", "public function shortcode($atts) {\n global $wpdb;\n if (isset($atts['slug'])) {\n $q=$wpdb->prepare(\n \"SELECT id \".\n \"FROM {$wpdb->prefix}h5p_contents \".\n \"WHERE slug=%s\",\n $atts['slug']\n );\n $row=$wpdb->get_row($q,ARRAY_A);\n\n if ($wpdb->last_error) {\n return sprintf(__('Database error: %s.', $this->plugin_slug), $wpdb->last_error);\n }\n\n if (!isset($row['id'])) {\n return sprintf(__('Cannot find H5P content with slug: %s.', $this->plugin_slug), $atts['slug']);\n }\n\n $atts['id']=$row['id'];\n }\n\n $id = isset($atts['id']) ? intval($atts['id']) : NULL;\n $content = $this->get_content($id);\n if (is_string($content)) {\n // Return error message if the user has the correct cap\n return current_user_can('edit_h5p_contents') ? $content : NULL;\n }\n\n // Log view\n new H5P_Event('content', 'shortcode',\n $content['id'],\n $content['title'],\n $content['library']['name'],\n $content['library']['majorVersion'] . '.' . $content['library']['minorVersion']);\n\n return $this->add_assets($content);\n }", "function video_cck_tudou_video($embed, $width, $height, $field, $item, $autoplay) {\n $output = theme('video_cck_tudou_flash', $embed, $width, $height, $autoplay);\n return $output;\n}", "function feed_formatter_web_format_feed_item($variables) {\r\n $feed_item = $variables['#feed_item'];\r\n \r\n $allowed = array('a', 'em', 'strong', 'cite', 'blockquote', 'code', 'ul', 'ol', 'li', 'dl', 'dt', 'dd', 'img');\r\n\r\n $element = array(\r\n 'feed_item_fields' => $variables['#content'],\r\n );\r\n return theme('feed_item_web_formatter', array('element' => $element));\r\n}", "function jetpack_shortcode_instagram( $atts ) {\n\tglobal $wp_embed;\n\n\tif ( empty( $atts['url'] ) ) {\n\t\treturn '';\n\t}\n\n\treturn $wp_embed->shortcode( $atts, $atts['url'] );\n}", "function vc_testimonial_structure( $atts, $content ) {\n\t$vc_tm_shortcode = shortcode_atts(\n\t\tarray(\n\t\t\t'cname' => '',\n\t\t\t'cdesignation' => '',\n\t\t\t'cimage' => 'cimage',\n\t\t\t'bcolor' => '',\n\t\t\t'ctitle' => '',\n\t\t\t'cdesignationc' => '',\n\t\t\t'cborder' => '',\n\t\t), \n\t$atts );\n\n\t// Shortcode Structure\n\t$client_img_as = explode(',',$vc_tm_shortcode['cimage']);\n\t$return = '<div class=\"tm_body\" style=\"background: '.$vc_tm_shortcode[\"bcolor\"].';\">';\n\t$return\t.=\t'<div class=\"tm_des\">'; \n\t\t\t\t\tforeach( $client_img_as as $client_img ){\n\t\t\t\t\t$tm_client_image = wp_get_attachment_image_src( $client_img, 'client_image' );\n\t\t\t\t\t$return .='<img class=\"tm_client_img\" src=\"'.$tm_client_image[0].'\" alt=\"'.$atts['title'].'\">';\n\t\t\t\t\t$tm_client_image++;\n\t\t\t\t}\n\t$return .=\t\t'<div class=\"tm_content\" style=\"border-color: '.$vc_tm_shortcode[\"cborder\"].';\">';\n\t$return .=\t\t\t'<h3 style=\"color: '.$vc_tm_shortcode[\"ctitle\"].';\">'.$vc_tm_shortcode[\"cname\"].'</h3>';\n\t$return .=\t\t\t'<p style=\"color: '.$vc_tm_shortcode[\"cdesignationc\"].';\">'.$vc_tm_shortcode[\"cdesignation\"].'</p>';\n\t$return .=\t\t'</div>';\n\t$return .=\t'</div>';\n\t$return .= '</div>';\n\treturn $return;\n}", "function vslider_short_code($atts) {\r\n\tob_start();\r\n extract(shortcode_atts(array(\r\n\t\t\"name\" => ''\r\n\t), $atts));\r\n\tvslider($name);\r\n\t$output = ob_get_clean();\r\n\treturn $output;\r\n}", "function htheme_instagram_shortcode( $atts ) {\r\n\r\n\t\t#SETUP CONTENT CLASS\r\n\t\t$htheme_data = $this->htheme_content->htheme_get_instagram($atts);\r\n\r\n\t\t#RETURN DATA/HTML\r\n\t\treturn $htheme_data;\r\n\r\n\t}", "function sb_slideshow_shortcode_meta() {\n\tglobal $post;\n\techo sb_slideshow_embed_input( $post->ID );\n}", "function unique_entry_mood_shortcode( $attr ) {\r\n\r\n\t$attr = shortcode_atts( array( 'before' => '', 'after' => '' ), $attr );\r\n\r\n\t$mood = get_post_meta( get_the_ID(), 'mood', true );\r\n\r\n\tif ( !empty( $mood ) )\r\n\t\t$mood = $attr['before'] . convert_smilies( $mood ) . $attr['after'];\r\n\r\n\treturn $mood;\r\n}", "function htheme_launch_shortcode( $atts ) {\r\n\r\n\t\t#SETUP CONTENT CLASS\r\n\t\t$htheme_data = $this->htheme_content->htheme_get_content_launch($atts);\r\n\r\n\t\t#RETURN DATA/HTML\r\n\t\treturn $htheme_data;\r\n\r\n\t}", "function tz_toggle( $atts, $content = null ) {\n\t\n extract(shortcode_atts(array(\n\t\t'title' \t => 'Title goes here',\n\t\t'state'\t\t => 'open'\n ), $atts));\n\n\t$out = '';\n\t\n\t$out .= \"<div data-id='\".$state.\"' class=\\\"toggle\\\"><h4>\".$title.\"</h4><div class=\\\"toggle-inner\\\">\".do_shortcode($content).\"</div></div>\";\n\t\n return $out;\n\t\n}", "function audio_logger_shortcode($atts = [], $content = null){\n\n ob_start();\n\n\n require_once(plugin_dir_path(__FILE__) . '/audio-logger-scripts.php');\n\n $output = ob_get_clean();\n $run_shortcodes = do_shortcode($output);\n return $run_shortcodes;\n}", "public static function transformVideoFilterEmbed(string $shortcode) {\n preg_match_all('#\\bhttps?://[^,\\s()<>]+(?:\\([\\w\\d]+\\)|([^,[:punct:]\\s]|/))#', $shortcode, $url_match);\n $video_url = $url_match[0][0];\n preg_match_all('/title:\"(.*)\"/', $shortcode, $title_match);\n $video_title = $title_match;\n $video_media = Media::create([\n 'name' => ($video_title) ? $video_title : $video_url,\n 'bundle' => 'utexas_video_external',\n 'uid' => '1',\n 'langcode' => Language::LANGCODE_NOT_SPECIFIED,\n 'status' => '1',\n 'field_media_oembed_video' => [\n 'value' => $video_url,\n ],\n ]);\n $video_media->save();\n $uuid = ($video_media) ? $video_media->uuid() : NULL;\n if ($uuid) {\n $markup = '<drupal-media data-align=\"center\" data-entity-type=\"media\" data-entity-uuid=\"' . $uuid . '\"></drupal-media>';\n return $markup;\n }\n return;\n }", "function button_shortcode($atts, $content = NULL) {\n $a = shortcode_atts( array(\n 'class' => ''\n ), $atts );\n $content = '<span class=\"button '.$class.'\">'.$content.'</span>';\n return $content;\n}", "function htheme_lookbooks_shortcode( $atts ) {\r\n\r\n\t\t#SETUP CONTENT CLASS\r\n\t\t$htheme_data = $this->htheme_content->htheme_get_lookbooks($atts);\r\n\r\n\t\t#RETURN DATA/HTML\r\n\t\treturn $htheme_data;\r\n\r\n\t}", "function wpbooklist_carousel_shortcode_function($atts){\n global $wpdb;\n extract(shortcode_atts(array(\n 'table' => $wpdb->prefix.\"wpbooklist_jre_saved_book_log\",\n 'coverwidth' => '103',\n 'coverheight' => '170',\n 'speed' => '5000',\n 'titlecount' => '3',\n 'transition' => 'rotateleft',\n 'action' => 'colorbox'\n ), $atts));\n\n if(isset($atts['table'])){\n $table = $atts['table'];\n }\n\n if(isset($atts['speed'])){\n $speed = ($atts['speed']*1000);\n }\n\n if(isset($atts['titlecount'])){\n $titlecount = $atts['titlecount'];\n }\n\n if(isset($atts['transition'])){\n $transition = $atts['transition'];\n }\n\n if(isset($atts['coverwidth'])){\n $coverwidth = $atts['coverwidth'];\n }\n\n if(isset($atts['coverheight'])){\n $coverheight = $atts['coverheight'];\n }\n\n if(isset($atts['action'])){\n $coverheight = $atts['action'];\n }\n\n\n $atts_array = array(\n 'table' => $table,\n 'speed' => $speed,\n 'titlecount' => $titlecount,\n 'transition' => $transition,\n 'coverheight' => $coverheight,\n 'coverwidth' => $coverwidth,\n 'action' => $action\n );\n\n\n ob_start();\n include_once( CAROUSEL_ROOT_INCLUDES_UI . 'class-frontend-carousel-ui.php');\n $carousel = new WPBookList_Carousel_UI($atts_array);\n echo $carousel->html_output;\n return ob_get_clean();\n}", "function dt_sc_pricing_table_type2_item($attrs, $content = null) {\n\t\t\n\t\textract ( shortcode_atts ( array (\n\t\t\t'number' => '',\n\t\t\t'month' => '',\n\t\t\t'plan' => '',\n\t\t\t'currency' => '',\n\t\t\t'price' => '',\n\t\t\t'highlight' => '', #VC\n\t\t\t'link' =>'' #VC\n\t\t), $attrs ) );\n\n\t\t$selected = ( strtolower($highlight) == \"yes\" ) ? 'selected' : '';\n\n\t\t$out = \"<div class='dt-sc-pr-tb-col type2 $selected'>\";\n\t\t\t$out .= '<div class=\"dt-sc-tb-header\">';\n\t\t\t\t$out .= '<div class=\"dt-sc-tb-title\">';\n\t\t\t\t\t$out .= \"<h5> <span>{$number}</span>{$month}<br>{$plan}</h5>\";\n\t\t\t\t$out .= '</div>';\n\t\t\t\t$out .= '<div class=\"dt-sc-price\">';\n\t\t\t\t\t$out .= \"<h6> <sup>{$currency}</sup>{$price}</h6>\";\n\t\t\t\t$out .= '</div>';\n\t\t\t$out .= '</div>';\n\n\t\t\t$content = DTCoreShortcodesDefination::dtShortcodeHelper ( $content );\n\t\t\t$content = str_replace ( '<ul>', '<ul class=\"dt-sc-tb-content\">', $content );\n\t\t\t$content = str_replace ( '<ol>', '<ul class=\"dt-sc-tb-content\">', $content );\n\t\t\t$content = str_replace ( '</ol>', '</ul>', $content );\n\n\t\t\t$out .= $content;\n\n\t\t\t$link = ( '||' === $link ) ? '' : $link;\n\t\t\t//parse link by vc\t\t\t\t\t\n\t\t\t$link = vc_build_link( $link );\n\t\t\t$a_href = $link['url'];\n\t\t\t$a_title = $link['title'];\n\t\t\t$a_target = !empty($link['target']) ? $link['target'] : '_self';\n\t\t\t\n\t\t\tif( !empty($a_href) ):\n\t\t\t\t$out .= '<div class=\"dt-sc-buy-now\">';\n\t\t\t\t\t$out .= \"<a class='dt-sc-button' target='{$a_target}' href='\".esc_url($a_href).\"'>{$a_title}</a>\";\n\t\t\t\t$out .= '</div>';\t\t\t\n\t\t\tendif;\n\t\t$out .= '</div>';\n\n\t\treturn $out;\n\t}", "function do_videos_listing ($atts,$content) {\n\t\t\n\t\textract( shortcode_atts( array(\n\t\t\t\t\t\t\t\t\t/* USELESS */\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t$atts));\n\t\tob_start();\t\t\t\t\n\n\t\t$args = array(\n\t\t\t'posts_per_page'=> -1,\n\t\t\t'post_type'=>'bf_videos_manager',\n\t\t\t);\n\t\t$query = new WP_Query($args);\n\t\t$all_videos = $query->posts;\n\n\t\tob_start();\n\t\t\n\t\t// print_r ($all_videos);\n\t\tforeach ($all_videos as $video_single) {\n\n $bf_video_tag = get_post_meta($video_single->ID,'bf_videos_manager_tag', true);\n $bf_video_link = get_post_meta($video_single->ID,'bf_videos_manager_video_link', true);\n $video_img = get_the_post_thumbnail($video_single->ID);\n $permalink = get_permalink($video_single->ID);\n\n ?>\n <div class=\"textwidget text\">\n <?php\n /* DEBUG */\n // print_r($video_single);\n ?>\n <?php \n\n /* echo (''.$video_img.''); */\n\n ?>\n \n \n <p class=\"video-excerpt\"><?php \n\n\n echo do_shortcode('<code>'.$bf_video_link.' '.$bf_video_main_tag.'</code>');\n \n \n ?></p>\n \n\n\n <?php \n\n $bf_video_tag = get_the_term_list($video_single->ID, 'bf_videos_manager_tag', 'Tag(s) : ', ', ', '' );\n $bf_video_cat = get_the_term_list($video_single->ID, 'bf_videos_manager_cat', 'Categorie(s) : ', ', ', '' );\n\n\n /* AUTHORS */\n if ( !empty( $bf_video_tag)) {\n echo (''.$bf_video_tag.'');\n echo ('<br>');\n } \n\n /* FLAVORS */\n if ( !empty( $bf_video_cat)) {\n echo (''.$bf_video_cat.'');\n echo ('<br>');\n }\n ?>\n\t\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t\n\t\t\t\t <?php\n\t\t\t\t /* SEP */\n print('<br/><br/>');\n\t\t\t\t ?>\n\t\t\t\t</div>\n\t\t\t\t<!-- separator -->\n\t\t\t\t<div class=\"clear-div\"></div>\n\t\t\t\n\n\t\t\t\n\t\t<?php\n\n\t\t}//EFL\n\t\t\n\t\t\t$output_string = ob_get_contents();\n\t\t\twp_reset_query();\n\t\t\tob_end_clean();\t\t\t\n\t\t\treturn $output_string;\n\n\t\t}", "function htheme_blog_shortcode( $atts ) {\r\n\r\n\t\t#SETUP CONTENT CLASS\r\n\t\t$htheme_data = $this->htheme_content->htheme_get_content_blog_split($atts);\r\n\r\n\t\t#RETURN DATA/HTML\r\n\t\treturn $htheme_data;\r\n\r\n\t}", "function addYouTube($atts, $content = null)\n{\n extract(shortcode_atts(array(\"id\" => ''), $atts));\n return '<p style=\"text-align:center\"> \\\n <a href=\"http://www.youtube.com/v/' . $id . '\"> \\\n <img src=\"http://img.youtube.com/vi/' . $id . '/0.jpg\" width=\"400\" height=\"300\" class=\"aligncenter\" /> \\\n <span>Watch the video</span></a></p>';\n}", "function pm_team_shortcode( $atts, $content = null) {\n\textract(shortcode_atts(array(\n\t\t'member_name'\t => '',\n\t\t'designation'\t => '',\n\t\t'member_image'\t => '',\n\t\t'member_desc'\t => '',\n\t\t'image_alt'\t => '',\n\t\t'team_fb' => '',\n\t\t'team_tr' => '',\n\t\t'team_gp' => '',\n\t\t'team_ld' => '',\n\t\t'team_sk' => '',\n\t\t'class'\t => '',\n\t), $atts));\n\n\t$result = '';\n\n\tob_start(); \n\n\t// Assigning a master css class and hooking into KC\n\t$master_class = apply_filters( 'kc-el-class', $atts );\n\t$master_class[] = 'pm-team';\n\n\t// Retrieving user define classes\n\t$classes = array( 'mob-bgrid-whole group' );\n\t(!empty($class)) ? $classes[] = $class : ''; ?>\n\n\t<div class=\"<?php echo esc_attr( implode( ' ', $master_class ) ); ?>\">\n\t\t<div id=\"team-wrapper\" class=\"<?php echo esc_attr( implode( ' ', $classes ) ); ?>\">\n\t\t\t<div class=\"bgrid member\">\n\t\t\t\t<div class=\"member-header\">\n\t\t\t\t\t<div class=\"member-pic\">\n\t\t\t\t\t\t<img src=\"<?php echo esc_url( $member_image ); ?>\" alt=\"<?php if( !empty( $image_alt ) ): echo esc_html( $image_alt ); else: echo esc_html( $member_name ); endif; ?>\"/> \t \t\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"member-name\">\n\t\t\t\t\t\t<h3> <?php echo esc_html( $member_name ); ?> </h3>\n\t\t\t\t\t\t<span> <?php echo esc_html( $designation ); ?> </span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\t\t\t\t\t\t\t\n\t\t\t\t<div><?php echo esc_html( $member_desc ); ?></div> \n\t\t\t\t<ul class=\"member-social\">\n\t\t\t\t\t<?php \n\t\t\t\t\tif( ! empty( $team_fb ) ) : ?>\n\t\t\t\t\t<li><a href=\"<?php echo esc_url( $team_fb ); ?>\"><i class=\"fa fa-facebook\"></i></a></li>\n\t\t\t\t\t<?php endif; //End fb\n\t\t\t\t\tif( ! empty( $team_tr ) ) : ?>\t\n\t\t\t\t\t<li><a href=\"<?php echo esc_url( $team_tr ); ?>\"><i class=\"fa fa-twitter\"></i></a></li>\n\t\t\t\t\t<?php endif; //End tr\n\n\t\t\t\t\tif( ! empty( $team_gp ) ) : ?>\t\n\t\t\t\t\t<li><a href=\"<?php echo esc_url( $team_gp ); ?>\"><i class=\"fa fa-google-plus\"></i></a></li>\n\t\t\t\t\t<?php endif; //End tr\n\n\t\t\t\t\tif( ! empty( $team_ld ) ) : ?>\t\n\t\t\t\t\t<li><a href=\"<?php echo esc_url( $team_ld ); ?>\"><i class=\"fa fa-linkedin\"></i></a></li>\n\t\t\t\t\t<?php endif; //End tr\n\n\t\t\t\t\tif( ! empty( $team_sk ) ) : ?>\t\n\t\t\t\t\t<li><a href=\"<?php echo esc_url( $team_sk ); ?>\"><i class=\"fa fa-skype\"></i></a></li>\n\t\t\t\t<?php endif; ?>\t\n\t\t\t</ul>\n\t\t</div> <!-- /member -->\n\t</div> <!-- /team-wrapper -->\n</div> <!-- /pm-team -->\n\t<?php \n\t$result .= ob_get_clean();\n\treturn $result;\n\n}", "function myformatTinyMCE( $in ) {\n $in['wordpress_adv_hidden'] = FALSE;\n return $in;\n}", "public static function block($atts, $content) {\n $result = '';\n foreach (self::$_currentWidgets as $widget) {\n self::$_currentWidget = $widget;\n $result .= do_shortcode($content);\n self::$_currentWidget = null;\n }\n if ($result === '') {\n return $content;\n } else {\n return $result;\n }\n }", "function video_cck_dailymotion_video($embed, $width, $height, $field, $item, $autoplay) {\n $output = theme('video_cck_dailymotion_flash', $embed, $width, $height, $autoplay);\n return $output;\n}", "protected function _build_inline_data( $item ) {\r\n\t\t$inline_data = \"\\r\\n\" . '<div class=\"hidden\" id=\"inline_' . $item->ID . \"\\\">\\r\\n\";\r\n\t\t$inline_data .= '\t<div class=\"item_thumbnail\">' . self::_build_item_thumbnail( $item ) . \"</div>\\r\\n\";\r\n\t\t$inline_data .= '\t<div class=\"post_title\">' . esc_attr( $item->post_title ) . \"</div>\\r\\n\";\r\n\t\t$inline_data .= '\t<div class=\"post_name\">' . esc_attr( $item->post_name ) . \"</div>\\r\\n\";\r\n\t\t$inline_data .= '\t<div class=\"post_excerpt\">' . esc_attr( $item->post_excerpt ) . \"</div>\\r\\n\";\r\n\t\t$inline_data .= '\t<div class=\"post_content\">' . esc_attr( $item->post_content ) . \"</div>\\r\\n\";\r\n\r\n\t\tif ( !empty( $item->mla_wp_attachment_metadata ) ) {\r\n\t\t\t$inline_data .= '\t<div class=\"image_alt\">';\r\n\r\n\t\t\tif ( isset( $item->mla_wp_attachment_image_alt ) ) {\r\n\t\t\t\tif ( is_array( $item->mla_wp_attachment_image_alt ) ) {\r\n\t\t\t\t\t$inline_data .= esc_attr( $item->mla_wp_attachment_image_alt[0] );\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$inline_data .= esc_attr( $item->mla_wp_attachment_image_alt );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t$inline_data .= \"</div>\\r\\n\";\r\n\t\t}\r\n\r\n\t\t$date = $item->post_date;\r\n\t\t$inline_data .= '\t<div class=\"jj\">' . esc_attr( mysql2date( 'd', $date, false ) ) . \"</div>\\r\\n\";\r\n\t\t$inline_data .= '\t<div class=\"mm\">' . esc_attr( mysql2date( 'm', $date, false ) ) . \"</div>\\r\\n\";\r\n\t\t$inline_data .= '\t<div class=\"aa\">' . esc_attr( mysql2date( 'Y', $date, false ) ) . \"</div>\\r\\n\";\r\n\t\t$inline_data .= '\t<div class=\"hh\">' . esc_attr( mysql2date( 'H', $date, false ) ) . \"</div>\\r\\n\";\r\n\t\t$inline_data .= '\t<div class=\"mn\">' . esc_attr( mysql2date( 'i', $date, false ) ) . \"</div>\\r\\n\";\r\n\t\t$inline_data .= '\t<div class=\"ss\">' . esc_attr( mysql2date( 's', $date, false ) ) . \"</div>\\r\\n\";\r\n\r\n\t\t$inline_data .= '\t<div class=\"post_parent\">' . $item->post_parent . \"</div>\\r\\n\";\r\n\r\n\t\tif ( $item->post_parent ) {\r\n\t\t\tif ( isset( $item->parent_title ) ) {\r\n\t\t\t\t$parent_title = $item->parent_title;\r\n\t\t\t} else {\r\n\t\t\t\t$parent_title = __( '(no title)', 'media-library-assistant' );\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t$parent_title = '';\r\n\t\t}\r\n\r\n\t\t$inline_data .= '\t<div class=\"post_parent_title\">' . $parent_title . \"</div>\\r\\n\";\r\n\t\t$inline_data .= '\t<div class=\"menu_order\">' . $item->menu_order . \"</div>\\r\\n\";\r\n\t\t$inline_data .= '\t<div class=\"post_author\">' . $item->post_author . \"</div>\\r\\n\";\r\n\r\n\t\t$custom_fields = MLACore::mla_custom_field_support( 'quick_edit' );\r\n\t\t$custom_fields = array_merge( $custom_fields, MLACore::mla_custom_field_support( 'bulk_edit' ) );\r\n\t\tforeach ( $custom_fields as $slug => $details ) {\r\n\t\t\tif ( 'meta:' == substr( $details['name'], 0, 5 ) ) {\r\n\t\t\t\t$meta_key = substr( $details['name'], 5 );\r\n\r\n\t\t\t\tif ( !empty( $item->mla_wp_attachment_metadata ) ) {\r\n\t\t\t\t\t$value = MLAData::mla_find_array_element( $meta_key, $item->mla_wp_attachment_metadata, 'array' );\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$value = '';\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\t$value = get_metadata( 'post', $item->ID, $details['name'], true );\r\n\t\t\t}\r\n\r\n\t\t\tif ( is_array( $value ) ) {\r\n\t\t\t\tif ( 'array' == $details['option'] ) {\r\n\t\t\t\t\t$value = implode( ',', $value );\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// '(Array)' indicates an existing array value in the field, which we preserve\r\n\t\t\t\t\t$value = '(Array)';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t$inline_data .= '\t<div class=\"' . $slug . '\">' . esc_html( $value ) . \"</div>\\r\\n\";\r\n\t\t}\r\n\r\n\t\t$taxonomies = get_object_taxonomies( 'attachment', 'objects' );\r\n\r\n\t\tforeach ( $taxonomies as $tax_name => $tax_object ) {\r\n\t\t\tif ( $tax_object->show_ui && MLACore::mla_taxonomy_support( $tax_name, 'quick-edit' ) ) {\r\n\t\t\t\t$terms = get_object_term_cache( $item->ID, $tax_name );\r\n\t\t\t\tif ( false === $terms ) {\r\n\t\t\t\t\t$terms = wp_get_object_terms( $item->ID, $tax_name );\r\n\t\t\t\t\twp_cache_add( $item->ID, $terms, $tax_name . '_relationships' );\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( is_wp_error( $terms ) || empty( $terms ) ) {\r\n\t\t\t\t\t$terms = array();\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$ids = array();\r\n\t\t\t\tif ( $tax_object->hierarchical || MLACore::mla_taxonomy_support( $tax_name, 'flat-checklist' ) ) {\r\n\t\t\t\t\tforeach( $terms as $term ) {\r\n\t\t\t\t\t\t$ids[] = $term->term_id;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t$inline_class = MLACore::mla_taxonomy_support( $tax_name, 'checked-on-top' ) ? 'mla_category checked_on_top' : 'mla_category';\r\n\t\t\t\t\t$inline_data .= '\t<div class=\"' . $inline_class . '\" id=\"' . $tax_name . '_' . $item->ID . '\">'\r\n\t\t\t\t\t\t. implode( ',', $ids ) . \"</div>\\r\\n\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\tforeach( $terms as $term ) {\r\n\t\t\t\t\t\t$ids[] = $term->name;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t$inline_data .= '\t<div class=\"mla_tags\" id=\"'.$tax_name.'_'.$item->ID. '\">'\r\n\t\t\t\t\t\t. esc_attr( implode( ', ', $ids ) ) . \"</div>\\r\\n\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t$inline_data = apply_filters( 'mla_list_table_build_inline_data', $inline_data, $item );\r\n\r\n\t\t$inline_data .= \"</div>\\r\\n\";\r\n\r\n\t\treturn $inline_data;\r\n\t}", "function htheme_blog_carousel_shortcode( $atts ) {\r\n\r\n\t\t#SETUP CONTENT CLASS\r\n\t\t$htheme_data = $this->htheme_content->htheme_get_content_blog_carousel($atts);\r\n\r\n\t\t#RETURN DATA/HTML\r\n\t\treturn $htheme_data;\r\n\r\n\t}", "function shortcode_imageframe( $atts, $content = null ) {\n\t\t$variables = array( 'src'=>'', 'link'=>'#', 'alt'=>'imageframe-image', 'title'=>'', 'hover' => '', 'class' => '', 'width' => '', 'height' => '', 'label' => '', 'label_content' => '', 'position' => '', 'animation_type'=>'', 'animation_duration'=>'', 'animation_delay'=>'' ); // hover values = (hover-effect|hover-effect yellow|opacity)\n\t\textract( shortcode_atts( $variables, $atts ) );\n\t\t$class = empty( $class )?'':( ' class=\"' . esc_attr( $class ) . '\"' );\n\t\t$a_class = ( empty( $hover ) || ( $hover == 'opacity' ) )?'':( ' class=\"' . esc_attr( $hover ) . '\"' );\n\t\t$label = empty( $label )?'':( '<h3 class=\"caption-title\">' . esc_html( $label ) . '</h3>' );\n\t\t$label_content = empty( $label_content )?'':( '<span>' . esc_html( $label_content ) . '</span>' );\n\t\t$label_content = $label . $label_content;\n\t\t$width = empty( $width )?'':( ' width=\"' . esc_attr( $width ) . '\"' );\n\t\t$height = empty( $height )?'':( ' height=\"' . esc_attr( $height ) . '\"' );\n\t\t$img_class = '';\n\t\t$figure_class = ( $position != 'middle' )?'':( ' class=\"middle-block\"' );\n\t\t$alt = empty( $alt )?'':' alt=\"' . esc_attr( $alt ) . '\"';\n\t\t$animation = '';\n\t\tif ( ! empty( $animation_type ) ) {\n\t\t\t$img_class = ( $position != 'middle' )?' class=\"animated\"':( ' class=\"middle-item animated\"' );\n\t\t\t$animation .= ' data-animation-type=\"' . $animation_type . '\" data-animation-duration=\"' . $animation_duration . '\" data-animation-delay=\"' . $animation_delay . '\" ';\n\t\t} else {\n\t\t\t$img_class = ( $position != 'middle' )?'':( ' class=\"middle-item\"' );\n\t\t}\n\n\t\t$result = '';\n\t\t$result .= '<figure' . $figure_class . '>';\n\t\tif ( $link != \"no\" ) $result .= '<a href=\"' . esc_url( $link ) . '\" title=\"' . esc_attr( $title ) . '\"' . $a_class . '>';\n\t\t$result .= '<img src=\"' . esc_url( $src ) . '\"' . $alt . $width . $height . $img_class . $animation . ' />';\n\t\t$result .= do_shortcode( $content );\n\t\tif ( $hover == 'opacity' ) $result .= '<span class=\"opacity-wrapper\"></span>';\n\t\tif ( $link != \"no\" ) $result .= '</a>';\n\t\tif ( ! empty( $label_content ) ) $result .= '<figcaption>' . $label_content . '</figcaption>';\n\t\t$result .= '</figure>';\n\t\treturn $result;\n\t}", "function saju_jukebox_shortcode_jukebox( $atts ) {\n\n\tsaju_jukebox_enqueue_scripts();\n\n\twp_localize_script( 'saju-js', 'saju_js_options', array(\n\t\t'api_url' => admin_url( 'admin-ajax.php?action=wl_sparql&slug=' ),\n\t\t'event_url' => get_option( SAJU_JUKEBOX_SETTINGS_FIELD_EVENT_URL ),\n\t\t'dataset_url' => get_option( SAJU_JUKEBOX_SETTINGS_FIELD_DATASET_URL )\n\t) );\n\n\t// Get the HTML fragment from the file.\n\treturn file_get_contents( dirname( __FILE__ ) . '/html/jukebox.html' );\n\n}", "function shortcode_playlist($atts)\n\t\t{\n\n\t\t\t$atts = shortcode_atts(\n\t\t\t\tarray(\n\t\t\t\t\t'name' => '',\n\t\t\t\t\t'videos' => '',\n\t\t\t\t), $atts, 'videowhisper_playlist');\n\n\n\t\t\tif (!$atts['name'] && !$atts['videos']) return 'No playlist or video list specified!';\n\n\t\t\tif ($atts['name'])\n\t\t\t{\n\t\t\t\t$args=array(\n\t\t\t\t\t'post_type' => 'video',\n\t\t\t\t\t'post_status' => 'publish',\n\t\t\t\t\t'posts_per_page' => 100,\n\t\t\t\t\t'order' => 'DESC',\n\t\t\t\t\t'orderby' => 'post_date',\n\t\t\t\t\t'playlist' =>$atts['name']\n\t\t\t\t);\n\n\t\t\t\t$postslist = get_posts( $args );\n\n\t\t\t\tif (count($postslist)>0)\n\t\t\t\t\tforeach ($postslist as $item)\n\t\t\t\t\t{\n\t\t\t\t\t\t$listCode .= ($listCode?\",\\r\\n\":'');\n\t\t\t\t\t\t$listCode .= '{title:\"'.$item->post_title.'\", ';\n\n\t\t\t\t\t\t$poster = VWvideoShare::path2url(get_post_meta($item->ID, 'video-thumbnail', true));\n\t\t\t\t\t\t$listCode .= 'poster:\"'.$poster.'\", ';\n\n\t\t\t\t\t\t$source = VWvideoShare::path2url(VWvideoShare::videoPath($item->ID));\n\t\t\t\t\t\t$listCode .= 'src: [\"'.$source.'\"] ';\n\t\t\t\t\t\t$listCode .= '}';\n\t\t\t\t\t}\n\t\t\t}\n\n\t\t\twp_enqueue_style( 'video-js', plugin_dir_url(__FILE__) .'video-js/video-js.min.css');\n\t\t\twp_enqueue_script('video-js', plugin_dir_url(__FILE__) .'video-js/video.js');\n\t\t\twp_enqueue_script('video-js4', plugin_dir_url(__FILE__) .'video-js/4/videojs-playlists.min.js', array( 'video-js'));\n\n\n\t\t\t$htmlCode = <<<EOCODE\n<div class=\"video-holder centered\">\n <video id=\"video\" class=\"video-js vjs-default-skin vjs-big-play-centered\" controls preload=\"none\" width=\"960\" height=\"540\" data-setup='' poster=\"\">\n </video>\n <div class=\"playlist-components\">\n <div class=\"playlist\">\n <ul></ul>\n </div>\n <div class=\"button-holder\">\n <a id=\"prev\" title=\"Previous video\" href=\"#\">Previous</a>\n <a id=\"next\" title=\"Next video\" href=\"#\">Next</a>\n </div>\n </div>\n </div>\n<style>\n.video-holder {\n background: #1b1b1b;\n padding: 10px;\n}\n\n.centered {\n margin-left: auto;\n margin-right: auto;\n width: auto;\n background: #333;\n}\n\n.playlist-components {\n height: 540px;\n}\n\n.video-js, .playlist-components {\n display: inline-block;\n vertical-align: top;\n margin-left: auto;\n}\n.button-holder {\n padding: 10px;\n height: 36px;\n}\n\n.playlist {\n height: 490px;\n width: 350px;\n overflow-y: auto;\n color: #c0c0c0;\n display: block;\n margin: 0;\n padding: 1px 0 0 0;\n position: relative;\n background: -moz-linear-gradient(top,#000 0,#212121 19%,#212121 100%);\n background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#000),color-stop(19%,#212121),color-stop(100%,#212121));\n background: -o-linear-gradient(top,#000 0,#212121 19%,#212121 100%);\n background: -ms-linear-gradient(top,#000 0,#212121 19%,#212121 100%);\n background: linear-gradient(to bottom,#000 0,#212121 19%,#212121 100%);\n box-shadow: 0 1px 1px #1a1a1a inset,0px 1px 1px #454545;\n border: 1px solid #1a1a18;\n}\n#next {\n float: right;\n}\n#prev {\n float: left;\n}\n\n#prev, #next {\n cursor: pointer;\n}\n\n.playlist ul {\n padding: 0;\n margin: 0;\n list-style: none;\n}\n\n.playlist ul li {\n padding: 10px;\n border-bottom: 1px solid #000;\n cursor: pointer;\n}\n.playlist ul li.active {\n background-color: #4f4f4f;\n border-color: #4f4f4f;\n color: #FFF;\n}\n.playlist ul li:hover {\n border-color: #353535;\n background: #353535;\n}\n\n\n.playlist .poster, .playlist .title {\n display: inline-block;\n vertical-align: middle;\n}\n .playlist .number{\n padding-right: 10px;\n}\n.playlist .poster img {\n width: 64px;\n}\n.playlist .title {\n padding-left: 10px;\n}\n</style>\n<script>\nvar \\$j = jQuery.noConflict();\n\\$j(document).ready(function()\n{\n\n var videos = [\n $listCode\n ];\n \n var videowhisperPlaylist = {\n init : function(){\n this.els = {};\n this.cacheElements();\n this.initVideo();\n this.createListOfVideos();\n this.bindEvents();\n this.overwriteConsole();\n },\n overwriteConsole : function(){\n },\n log : function(string){\n },\n cacheElements : function(){\n this.els.playlist = \\$j('div.playlist > ul');\n this.els.next = \\$j('#next');\n this.els.prev = \\$j('#prev');\n this.els.log = \\$j('div.panels > pre');\n },\n initVideo : function(){\n this.player = videojs('video');\n this.player.playList(videos);\n },\n createListOfVideos : function(){\n var html = '';\n for (var i = 0, len = this.player.pl.videos.length; i < len; i++){\n html += '<li data-videoplaylist=\"'+ i +'\">'+\n '<span class=\"number\">' + (i + 1) + '</span>'+\n '<span class=\"poster\"><img src=\"'+ videos[i].poster +'\"></span>' +\n '<span class=\"title\">'+ videos[i].title +'</span>' +\n '</li>';\n }\n this.els.playlist.empty().html(html);\n this.updateActiveVideo();\n },\n updateActiveVideo : function(){\n var activeIndex = this.player.pl.current;\n\n this.els.playlist.find('li').removeClass('active');\n this.els.playlist.find('li[data-videoplaylist=\"' + activeIndex +'\"]').addClass('active');\n },\n bindEvents : function(){\n var self = this;\n this.els.playlist.find('li').on('click', \\$j.proxy(this.selectVideo,this));\n this.els.next.on('click', \\$j.proxy(this.nextOrPrev,this));\n this.els.prev.on('click', \\$j.proxy(this.nextOrPrev,this));\n \n this.player.on('next', function(e){\n self.updateActiveVideo.apply(self);\n });\n \n this.player.on('prev', function(e){\n self.updateActiveVideo.apply(self);\n });\n \n this.player.on('lastVideoEnded', function(e){\n\n });\n },\n \n nextOrPrev : function(e){\n var clicked = \\$j(e.target);\n this.player[clicked.attr('id')]();\n },\n \n selectVideo : function(e){\n var clicked = e.target.nodeName === 'LI' ? \\$j(e.target) : \\$j(e.target).closest('li');\n\n if (!clicked.hasClass('active')){\n var videoIndex = clicked.data('videoplaylist');\n this.player.playList(videoIndex);\n this.updateActiveVideo();\n }\n }\n };\n\n videowhisperPlaylist.init();\n \n});\n</script>\nEOCODE;\n\n\n\t\t\treturn $htmlCode;\n\n\t\t}", "function bdpp_render_post_creative_1( $atts, $content = null ) {\n\n\t// Shortcode Parameters\n\t$atts = shortcode_atts(array(\n\t\t'post_type'\t\t\t\t=> BDPP_POST_TYPE,\n\t\t'taxonomy'\t\t\t\t=> BDPP_CAT,\n\t\t'cat_taxonomy'\t\t\t=> '',\n\t\t'type'\t\t\t\t\t=> '',\n\t\t'limit' \t\t\t\t=> 9,\n\t\t'grid' \t\t\t\t\t=> 3,\n\t\t'show_author' \t\t\t=> 'true',\n\t\t'show_comments'\t\t\t=> 'true',\n\t\t'show_category' \t\t=> 'true',\n\t\t'show_date' \t\t\t=> 'true',\n\t\t'link_behaviour'\t\t=> 'self',\n\t\t'sharing'\t\t\t\t=> '',\n\t\t'media_size' \t\t\t=> 'full',\n\t\t'lazyload'\t\t\t\t=> 'true',\n\t\t'order'\t\t\t\t\t=> 'DESC',\n\t\t'orderby'\t\t\t\t=> 'date',\n\t\t'category' \t\t\t\t=> array(),\n\t\t'exclude_cat'\t\t\t=> array(),\n\t\t'category_operator'\t\t=> 'IN',\n\t\t'include_cat_child'\t\t=> 'true',\n\t\t'posts'\t\t\t\t\t=> array(),\n\t\t'hide_post'\t\t\t\t=> array(),\n\t\t'author' \t\t\t\t=> array(),\n\t\t'exclude_author'\t\t=> array(),\n\t\t'sticky_posts'\t\t\t=> 'false',\n\t\t'query_offset'\t\t\t=> '',\n\t\t'css_class'\t\t\t\t=> '',\n\t\t'slider_screen'\t\t\t=> 640,\n\t\t'custom_param_1'\t\t=> '',\t// Custom Param Passed Just for Developer\n\t\t'custom_param_2'\t\t=> '',\n\t\t), $atts, 'bdp_post_ctv1');\n\n\t$sharing_designs\t\t\t\t= bdpp_sharing_designs();\n\t$allowed_post_types\t\t\t\t= ( $atts['type'] == 'trending' ) ? bdpp_get_option( 'trend_post_types', array() ) : bdpp_get_option( 'post_types', array() );\n\t$atts['shortcode']\t\t\t\t= 'bdp_post_ctv1';\n\t$atts['limit'] \t\t\t\t\t= bdpp_clean_number( $atts['limit'], 9, 'number' );\n\t$atts['grid']\t\t\t\t\t= bdpp_clean_number( $atts['grid'], 3 );\n\t$atts['grid']\t\t\t\t\t= ( $atts['grid'] <= 12 ) ? $atts['grid'] : 3;\n\t$atts['post_type']\t\t\t\t= !empty( $atts['post_type'] )\t\t\t\t? explode( ',', $atts['post_type'] )\t: array( BDPP_POST_TYPE );\n\t$atts['cat_taxonomy']\t\t\t= !empty( $atts['cat_taxonomy'] )\t\t\t? $atts['cat_taxonomy'] \t\t\t\t: $atts['taxonomy'];\n\t$atts['show_author'] \t\t\t= ($atts['show_author'] == 'false')\t\t\t? false\t\t\t\t\t\t\t\t\t: true;\n\t$atts['show_comments'] \t\t\t= ( $atts['show_comments'] == 'false' ) \t? false\t\t\t\t\t\t\t\t\t: true;\n\t$atts['show_date'] \t\t\t\t= ( $atts['show_date'] == 'false' ) \t\t? false\t \t\t\t\t\t\t\t\t: true;\n\t$atts['show_category'] \t\t\t= ( $atts['show_category'] == 'false' ) \t? false \t\t\t\t\t\t\t\t: true;\n\t$atts['lazyload']\t\t\t\t= ( $atts['lazyload'] == 'false' ) \t\t\t? false\t\t\t\t\t\t\t\t\t: true;\n\t$atts['link_behaviour']\t\t\t= ( $atts['link_behaviour'] == 'new' )\t\t? '_blank'\t\t\t\t\t\t\t\t: '_self';\n\t$atts['order'] \t\t\t\t\t= ( strtolower($atts['order']) == 'asc' ) \t? 'ASC' \t\t\t\t\t\t\t\t: 'DESC';\n\t$atts['orderby'] \t\t\t\t= !empty( $atts['orderby'] )\t\t\t\t? $atts['orderby'] \t\t\t\t\t\t: 'date';\n\t$atts['category'] \t\t\t\t= !empty( $atts['category'] )\t\t\t\t? explode(',', $atts['category']) \t\t: array();\n\t$atts['exclude_cat']\t\t\t= !empty( $atts['exclude_cat'] )\t\t\t? explode(',', $atts['exclude_cat'])\t: array();\n\t$atts['include_cat_child']\t\t= ( $atts['include_cat_child'] == 'false' )\t? false \t\t\t\t\t\t\t\t: true;\n\t$atts['posts']\t\t\t\t\t= !empty( $atts['posts'] )\t\t\t\t\t? explode(',', $atts['posts']) \t\t\t: array();\n\t$atts['hide_post']\t\t\t\t= !empty( $atts['hide_post'] )\t\t\t\t? explode(',', $atts['hide_post']) \t\t: array();\n\t$atts['author']\t\t\t\t\t= !empty( $atts['author'] )\t\t\t\t\t? explode(',', $atts['author']) \t\t: array();\n\t$atts['exclude_author']\t\t\t= !empty( $atts['exclude_author'] )\t\t\t? explode(',', $atts['exclude_author']) : array();\n\t$atts['sticky_posts'] \t\t\t= ($atts['sticky_posts'] == 'false')\t\t? true\t\t\t\t\t\t\t\t\t: false;\n\t$atts['query_offset']\t\t\t= !empty( $atts['query_offset'] )\t\t\t? $atts['query_offset'] \t\t\t\t: null;\t\n\t$atts['sharing'] \t\t\t\t= ( $atts['sharing'] && (array_key_exists(trim($atts['sharing']), $sharing_designs)) ) ? trim( $atts['sharing'] ) : false;\n\t$atts['slider_screen']\t\t\t= bdpp_clean_number( $atts['slider_screen'], 640 );\n\t$atts['css_class']\t\t\t\t= bdpp_sanitize_html_classes( $atts['css_class'] );\n\t$atts['unique'] \t\t\t\t= bdpp_get_unique();\n\t$atts['thumb_html']\t\t\t\t= '';\n\n\textract( $atts );\n\n\t// Taking some globals\n\tglobal $post;\n\n\t// Enqueue required scripts\n\tif( $sharing ) {\n\t\twp_enqueue_script( 'tooltipster' );\n\t}\n\twp_enqueue_script( 'jquery-owl-carousel' );\n\twp_enqueue_script( 'bdpp-public-script' );\n\tbdpp_enqueue_script();\n\n\t// Taking some variables\n\t$count \t\t\t= 0;\n\t$post_type_arr\t= array();\n\t$prefix \t\t= BDPP_META_PREFIX;\n\n\t// Processing post types\n\tif( !empty( $post_type ) ) {\n\t\tforeach ($post_type as $post_key => $post_val) {\n\t\t\t\n\t\t\t$post_val = bdpp_clean( $post_val );\n\t\t\t\n\t\t\tif( in_array( $post_val, $allowed_post_types ) ) {\n\t\t\t\t$post_type_arr[] = $post_val;\n\t\t\t}\n\t\t}\n\t\t$post_type_arr\t\t= array_unique( $post_type_arr );\n\t\t$atts['post_type']\t= $post_type_arr;\n\t}\n\n\t// WP Query Parameters\n\t$args = array(\n\t\t'post_type' \t\t=> $post_type_arr,\n\t\t'post_status' \t\t\t=> array('publish'),\n\t\t'order' \t\t=> $order,\n\t\t'orderby' \t\t=> $orderby,\n\t\t'posts_per_page' \t\t=> $limit,\n\t\t'post__in'\t\t \t\t=> $posts,\n\t\t'post__not_in'\t \t\t=> $hide_post,\n\t\t'author__in' \t=> $author,\n\t\t'author__not_in' \t\t=> $exclude_author,\t\t\n\t\t'offset'\t\t\t\t=> $query_offset,\n\t\t'no_found_rows'\t\t\t=> true,\n\t\t'ignore_sticky_posts'\t=> $sticky_posts,\n\t);\n\n // Category Parameter\n\tif( $category ) {\n\n\t\t$args['tax_query'] = array(\n\t\t\t\t\t\t\t\tarray( \n\t\t\t\t\t\t\t\t\t'taxonomy' \t\t\t=> $taxonomy,\n\t\t\t\t\t\t\t\t\t'terms' \t\t\t=> $category,\n\t\t\t\t\t\t\t\t\t'operator'\t\t\t=> $category_operator,\n\t\t\t\t\t\t\t\t\t'include_children'\t=> $include_cat_child,\n\t\t\t\t\t\t\t\t\t'field' \t\t\t=> ( isset($category[0]) && is_numeric($category[0]) ) ? 'term_id' : 'slug',\n\t\t\t\t\t\t\t\t));\n\n\t} else if( $exclude_cat ) {\n\t\t\n\t\t$args['tax_query'] = array(\n\t\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t\t'taxonomy' \t\t\t=> $taxonomy,\n\t\t\t\t\t\t\t\t\t\t'terms' \t\t\t=> $exclude_cat,\n\t\t\t\t\t\t\t\t\t\t'operator'\t\t\t=> 'NOT IN',\n\t\t\t\t\t\t\t\t\t\t'include_children'\t=> $include_cat_child,\n\t\t\t\t\t\t\t\t\t\t'field' \t\t\t=> ( isset($exclude_cat[0]) && is_numeric($exclude_cat[0]) ) ? 'term_id' : 'slug',\n\t\t\t\t\t\t\t\t\t));\n\t}\n\n\t// For featured post\n\tif( $type == 'featured' ) {\n\n\t\t$args['meta_query'] = array(\n\t\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t\t'key'\t=> $prefix.'feat_post',\n\t\t\t\t\t\t\t\t\t\t'value'\t=> 1,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t);\n\n\t} else if( $type == 'trending' ) {\n\n\t\t$args['orderby'] \t= ( $orderby == 'post_views' ) ? 'meta_value_num' : $orderby;\n\t\t$args['meta_query'] = array(\n\t\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t\t'key'\t\t=> $prefix.'post_views',\n\t\t\t\t\t\t\t\t\t\t'value'\t\t=> 0,\n\t\t\t\t\t\t\t\t\t\t'compare' \t=> '>',\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t);\n\t}\n\n\t$args = apply_filters( 'bdpp_post_ctv1_query_args', $args, $atts );\n\t$args = apply_filters( 'bdpp_posts_query_args', $args, $atts );\n\n\t// WP Query\n\t$query \t\t\t\t\t= new WP_Query( $args );\n\t$atts['max_num_pages'] \t= $query->max_num_pages;\n\n\tob_start();\n\n\t// If post is there\n\tif ( $query->have_posts() ) {\n\n\t\t\tbdpp_get_template( 'misc/creative-1/loop-start.php', $atts );\n\n\t\t\twhile ( $query->have_posts() ) : $query->the_post();\n\n\t\t\t\t$count++;\n\t\t\t\t$atts['count'] \t\t= $count;\n\t\t\t\t$atts['format']\t\t= bdpp_get_post_format();\n\t\t\t\t$atts['feat_img'] \t= bdpp_get_post_feat_image( $post->ID, $media_size, true );\n\t\t\t\t$atts['post_link'] \t= bdpp_get_post_link( $post->ID );\n\t\t\t\t$atts['cate_name'] \t= bdpp_get_post_terms( $post->ID, $cat_taxonomy );\n\n\t\t\t\t$atts['wrp_cls']\t= \"bdpp-col-nr-{$grid} bdpp-columns bdpp-post-{$atts['format']} bdpp-post-{$post->ID}\";\n\t\t\t\t$atts['wrp_cls']\t.= empty( $atts['feat_img'] )\t? ' bdpp-no-thumb'\t: '';\n\t\t\t\t$atts['wrp_cls']\t.=\t( is_sticky( $post->ID ) )\t? ' bdpp-sticky'\t: '';\n\n\t // Include Dsign File\n\t\t\t\tbdpp_get_template( \"misc/creative-1/creative-1.php\", $atts );\n\n\t\t\t\t// Creating Thumb HTML\n\t\t\t\tif( $atts['feat_img'] ) {\n\t\t\t\t\t$thumb_active\t= ( $count == 1 ) ? 'bdpp-post-ctv1-thumb-active' : '';\n\t\t\t\t\t$lazy_style\t\t= ( ! $lazyload ) ? 'style=\"background-image:url('.$atts['feat_img'].');\"' : '';\n\t\t\t\t\t\n\t\t\t\t\tif( $count == 1 ) {\n\t\t\t\t\t\t$atts['thumb_html'] .= '<div class=\"bdpp-post-ctv1-thumb bdpp-post-ctv1-thumb-'.$count .' '. $thumb_active.'\" style=\"background-image:url('.$atts['feat_img'].');\"></div>';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$atts['thumb_html'] .= '<div class=\"bdpp-post-ctv1-thumb bdpp-post-ctv1-thumb-'.$count .' '. $thumb_active.'\" '.$lazy_style.'></div>';\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tendwhile;\n\n\t\t\tbdpp_get_template( 'misc/creative-1/loop-end.php', $atts );\n\n\t} // end of have_post()\n\n\twp_reset_postdata(); // Reset WP Query\n\n\t$content .= ob_get_clean();\n\treturn $content;\n}", "function thrive_bp_embed_oembed_html( $html, $url, $attr, $rawattr ) {\n $html = '<div class=\"embed-wrapper\">' . str_replace( array('422', '563'), '278', $html ) . '</div>';\n return $html;\n}", "function shortcode_posts( $atts ) {\n\t\textract( shortcode_atts( array(\n\t\t\t'title' => '',\n\t\t\t'type' => 'latest',\n\t\t\t'style' => 'style1',\n\t\t\t'count' => 10,\n\t\t\t'count_per_row' => 4,\n\t\t\t'post_ids' => '',\n\t\t\t'slide' => 'true',\n\t\t\t'before_list' => '',\n\t\t\t'after_list' => '',\n\t\t\t'before_item' => '',\n\t\t\t'after_item' => '',\n\t\t\t'animation_type' => '',\n\t\t\t'animation_duration' => '',\n\t\t\t'animation_delay' => '',\n\t\t), $atts) );\n\n\t\tif ( $slide == 'no' || $slide == 'false' ) { $slide = 'false'; }\n\t\t$styles = array( 'style1', 'style2', 'style3', 'style4' );\n\t\t$types = array( 'latest', 'popular', 'selected' );\n\t\tif ( ! in_array( $style, $styles ) ) $style = 'style1';\n\t\tif ( ! in_array( $type, $types ) ) $type = 'latest';\n\t\t$post_ids = explode( ',', $post_ids );\n\t\t$count = is_numeric( $count )?$count:10;\n\t\t$count_per_row = is_numeric( $count_per_row )?$count_per_row:4;\n\n\t\t$def_before_list = '';\n\t\t$def_after_list = '';\n\t\t$def_before_item = '';\n\t\t$def_after_item = '';\n\n\t\tif ( $style == 'style3' ) {\n\t\t\t$def_before_list = '<div>';\n\t\t\t$def_after_list = '</div>';\n\t\t} else {\n\t\t\tif ( $slide == 'false' ) {\n\t\t\t\t$def_before_list = '<div class=\"row image-box style10\">';\n\t\t\t\t$def_after_list = '</div>';\n\t\t\t\tif ( ( 2 == $count_per_row ) ) {\n\t\t\t\t\t$def_before_list = '<div class=\"row image-box style10\">';\n\t\t\t\t\t$def_before_item = \"<div class='col-sm-6'>\";\n\t\t\t\t\t$def_after_item = \"</div>\";\n\t\t\t\t} elseif ( 3 == $count_per_row ) {\n\t\t\t\t\t$def_before_list = '<div class=\"row image-box style10\">';\n\t\t\t\t\t$def_before_item = \"<div class='col-sm-4'>\";\n\t\t\t\t\t$def_after_item = \"</div>\";\n\t\t\t\t} else {\n\t\t\t\t\t$def_before_list = '<div class=\"row image-box style10\">';\n\t\t\t\t\t$def_before_item = \"<div class='col-sm-6 col-sms-6 col-md-3'>\";\n\t\t\t\t\t$def_after_item = \"</div>\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$def_before_list = '<div class=\"block image-carousel style2\" data-animation=\"slide\" data-item-width=\"370\" data-item-margin=\"30\"><ul class=\"slides image-box style10 listing-' . esc_attr( $style ) . '\">';\n\t\t\t\t$def_after_list = '</ul></div>';\n\t\t\t\t$def_before_item = '<li>';\n\t\t\t\t$def_after_item = '</li>';\n\t\t\t}\n\t\t}\n\t\tif ( empty( $before_list ) ) $before_list = $def_before_list;\n\t\tif ( empty( $after_list ) ) $after_list = $def_after_list;\n\t\tif ( empty( $before_item ) ) $before_item = $def_before_item;\n\t\tif ( empty( $after_item ) ) $after_item = $def_after_item;\n\n\t\t$posts = array();\n\t\tif ( $type == 'selected' ) {\n\t\t\tif ( is_array( $post_ids ) ) {\n\t\t\t\tforeach( $post_ids as $post_id ) {\n\t\t\t\t\t$post = get_post( $post_id );\n\t\t\t\t\tif ( ! empty( $post ) && ! is_wp_error( $post ) ) {\n\t\t\t\t\t\t$posts[] = $post;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} elseif ( $type == 'latest' ) {\n\t\t\t$args = array(\n\t\t\t\t'posts_per_page' => $count,\n\t\t\t\t'orderby' => 'post_date',\n\t\t\t\t'order' => 'DESC',\n\t\t\t\t'suppress_filters' => 0,\n\t\t\t\t'post_status' => 'publish',\n\t\t\t);\n\t\t\t$posts = get_posts( $args );\n\t\t} elseif ( $type == 'popular' ) {\n\t\t\t$posts = get_posts('posts_per_page=' . $count . '&meta_key=trav_count_post_views&orderby=meta_value_num&order=DESC&suppress_filters=0&post_status=publish');\n\t\t}\n\n\t\tob_start();\n\t\tif ( ! empty( $title ) ) { echo '<h2>' . esc_html( $title ) . '</h2>'; }\n\t\techo ( $before_list );\n\t\t$i = 0;\n\t\tforeach ( $posts as $post ) {\n\t\t\t$animation = '';\n\t\t\tif ( ! empty( $animation_type ) ) { $animation .= ' class=\"animated\" data-animation-type=\"' . esc_attr( $animation_type ) . '\" data-animation-duration=\"' . esc_attr( $animation_duration ) . '\" data-animation-delay=\"' . esc_attr( $animation_delay * $i ) . '\" '; }\n\t\t\ttrav_get_post_list_sigle( $post->ID, $style, $before_item, $after_item, $animation );\n\t\t\t$i++;\n\t\t}\n\t\techo ( $after_list );\n\n\t\t$output = ob_get_contents();\n\t\tob_end_clean();\n\t\treturn $output;\n\t}", "public function get_markup () {\r\n\t\t$data = $this->properties_to_array();\r\n\r\n\t\t// Do shortcode\r\n\t\tforeach($data['accordion'] as $index=>$accordion) {\r\n\t\t\t$accordion['content'] = $this->_do_shortcode($accordion['content']);\r\n\t\t\t$data['accordion'][$index] = $accordion;\r\n\t\t}\r\n\r\n\t\t$data['preset'] = isset($data['preset']) ? $data['preset'] : 'default';\r\n\r\n\t\t$data['wrapper_id'] = str_replace('uaccordion-object-', 'wrapper-', $data['element_id']);\r\n\r\n\t\t$markup = upfront_get_template('uaccordion', $data, dirname(dirname(__FILE__)) . '/tpl/uaccordion.html');\r\n\r\n\t\t// upfront_add_element_style('uaccordion_style', array('css/uaccordion.css', dirname(__FILE__)));\r\n\t\tupfront_add_element_script('uaccordion_script', array('js/uaccordion-front.js', dirname(__FILE__)));\r\n\t\treturn $markup;\r\n\t}", "function mattu_portfolio_register_shortcodes() {\n\tadd_shortcode('portfolio_items', 'mattu_portfolio_items_shortcode' );\n}" ]
[ "0.58701247", "0.558858", "0.55556846", "0.5519841", "0.5514991", "0.54809016", "0.542927", "0.54198325", "0.540887", "0.5349261", "0.5314765", "0.5311587", "0.52698344", "0.52514625", "0.5248058", "0.52216387", "0.5218389", "0.5214565", "0.51846534", "0.5174611", "0.51448315", "0.51387393", "0.51038444", "0.5068577", "0.5065159", "0.5052684", "0.50506496", "0.50506496", "0.50425255", "0.5037094", "0.5033243", "0.50272727", "0.50195736", "0.5018607", "0.50185126", "0.5017928", "0.5016262", "0.50134563", "0.5003999", "0.49957982", "0.4988919", "0.49857095", "0.49836436", "0.4979928", "0.49797037", "0.49731323", "0.4972775", "0.4970195", "0.49484852", "0.49467695", "0.49442267", "0.49380356", "0.49368182", "0.49357575", "0.49348727", "0.49344096", "0.4933459", "0.4931207", "0.4931154", "0.49309844", "0.49243298", "0.49240372", "0.49217102", "0.4900225", "0.48930675", "0.488963", "0.48876458", "0.48836607", "0.48808342", "0.48793095", "0.4871537", "0.48708326", "0.48671046", "0.48635396", "0.48561075", "0.4854847", "0.48506936", "0.48445624", "0.4843577", "0.4841924", "0.48405892", "0.48370278", "0.48235133", "0.48216474", "0.48204386", "0.4814142", "0.48135474", "0.48120594", "0.4803602", "0.48024443", "0.48008", "0.4800392", "0.47952235", "0.47888547", "0.4788265", "0.47881746", "0.4782566", "0.4782083", "0.47816545", "0.47763786" ]
0.5173348
20
Are we in edit mode?
public function getEditMode() { $page = $this->getPage(); if (!$page->canEdit()) { $this->endEditing(); return false; } $stage = Versioned::get_stage(); if ($stage != Versioned::DRAFT) { return false; } // one-off preview that does _not_ stop edit mode if ($this->getRequest()->getVar('preview')) { return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isEditOnlyMode();", "public function isSwitchToEditEnabled();", "public static function getEditMode(): bool\n\t{\n\t\treturn self::$editMode;\n\t}", "public function isEditable() {}", "protected function canEdit() {}", "private function isEditMode(){\n\t\tif(isset($this->AddRecordInsertData) and count($this->AddRecordInsertData) > 0 )\n\t\t\treturn true;\n\t\treturn false;\n\t}", "public function canEdit()\n {\n return true;\n }", "public function isEditable();", "public function isEditable();", "public function can_edit() {\n return true;\n }", "static function has_edit_screen(): bool { return true; }", "function canEdit() {\n\t\t\treturn true;\n\t\t}", "public function canEdit()\n {\n return $this->is_locked == 0;\n }", "public function enabledInEditMode()\n\t{\n\t\treturn false;\n\t}", "public function is_editing() {\n\n\t\tif ( 'edit' !== Param::get( 'action' ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn Param::get( 'redirection', false, FILTER_VALIDATE_INT );\n\t}", "public function isEditable()\n\t{\n\t\tif (($this->getName() === 'publicid') || ($this->getName() === 'posturl')) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public function isEditAction() {}", "public function getEditMode()\n {\n return $this->_editMode;\n }", "public function is_editable() {\n\t\treturn false;\n\t}", "public function canBeEdited() {}", "public function isEditFormShown() {}", "protected function is_edit_page() {\n\t\treturn false;\n\t}", "public function isFrontendEditingActive() {}", "public function isEditable()\n {\n return $this->_editable;\n }", "public function canBeEdited()\n {\n return false;\n }", "protected function isFrontendEditActive() {}", "protected function isFrontendEditActive() {}", "public function canEdit() {\n\t\treturn $this->_perms->checkModuleItem ( $this->_tbl_module, 'edit' );\n\t}", "function field_edit($name)\r\n {\r\n if (right::superuser()) return (true);\r\n \r\n $rightArray = right::get_field($name);\r\n $userRight = right::get(\"rights\");\r\n\r\n if ($rightArray[edit]) return($userRight & $rightArray[edit]);\r\n else return(false); // default no edit\r\n }", "public function isEditable($id)\n\t{\n\t\t// TODO: Implement isEditable() method.\n\t}", "public function isEditor()\n {\n $int;\n foreach ( $this->u_r_id as $int )\n {\n if($int==2)\n return true;\n }\n return false;\n }", "public function editable()\n {\n if ($this->getMode() == \"only_external\") {\n return false;\n }\n if ($this->hasScript()) {\n // can't edit calculated fields\n return false;\n }\n if (!isset($this->data[\"editable\"])) {\n return true;\n }\n return (true == $this->data[\"editable\"]);\n }", "public function isEditable($operation = OperationTypes::OP_UPDATE, $ignore_op = FALSE);", "public function is_edit_page() {\n\t\t\tglobal $current_screen;\n\n\t\t\treturn in_array( $current_screen->id, (array) $this->_meta_box['pages'] );\n\t\t}", "function isEditable(Eloquent $model);", "abstract function allowEditAction();", "public function edit()\n\t{\n\t\t//\n\t}", "public function isEditable()\n\t{\n\t\tif(Auth::check())\n\t\t{\n\t\t\tif(Auth::user()->id == $this->author_id)\n\t\t\t{\n\t\t\t\tif ($this->created_at->diffInMinutes(Carbon::now()) < 30)\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(Auth::user()->hasRole(['moderator', 'administrator', 'super user'])) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "public function setEditOnlyMode($value);", "public function isEditor(){\n\t\tif($_SESSION['waf_user']['editor']==1)return true;\n\t\telse return false;\n\t}", "function inspiry_is_edit_property() {\n\t\tif ( isset( $_GET['edit_property'] ) && ! empty( $_GET['edit_property'] ) ) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "public function canEdit()\n {\n if(!Auth::check())\n {\n return false;\n }\n //If the user is active/logged in, return true so that we can display user's specific objects\n if(Auth::user()->id===$this->user_id)\n {\n return true;\n }\n //By default\n return false;\n }", "function eman_post_editable( $post )\n{\n\tif ( is_numeric($post) ) $post = get_post($post);\n\tif ( ! is_object($post) ) return false;\n\n\t// Settings area always editable\n\tif ( emanager_post::is_settings($post) ) return true;\n\n\t$status = emanager_post::status($post, 'slug');\n\n\t// If no status yet or is in draft or revise, it is editable\n\tif ( 'draft' == $status || 'revise' == $status ) return true;\n\n\treturn false;\n}", "public function canBeEdited()\n {\n return true; ///< Every client sees only it's own information\n }", "private function isEditor() : bool\n {\n return $this->role('editor');\n }", "function canEdit() {\r\n\t\tif($this->owner->ID == Member::currentUserID())\r\n\t\t\treturn true;\r\n\r\n\t\t$member = Member::currentUser();\r\n\t\tif($member)\r\n\t\t\treturn $member->isAdmin();\r\n\r\n\t\treturn false;\r\n\t}", "public function user_can_edit() {\n if (has_capability('mod/swipe:manage', $this->context)) {\n return true;\n }\n }", "public function edit()\n\t{\n\t\t\n\t}", "public function edit($id)\n\t{\n\t\treturn false;\n\t}", "public function edit() {\r\n\t\treturn $this->_edit(false);\r\n\t}", "function rich_edit_exists()\n {\n }", "public function can_edit() {\n\t\t$can_edit = false;\n\t\t\n\t\t// is the user the owner of the package and the package is in edit mode?\n\t\tif ( ($this->get_user_id() == get_current_user_id()) && ($this->status == 1) ) {\n\t\t\t$can_edit = true;\n\t\t} else {\n\t\t\t// is the user an admin (has the right to edit all packages)\n\t\t\tif ( current_user_can( 'pvm_edit_other_packages' ) ) {\n\t\t\t\t$can_edit = true;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $can_edit;\n\t}", "public function edit( )\r\n {\r\n //\r\n }", "function canEdit() {\r\n\t\t$user\t=& JFactory::getUser();\r\n\r\n\t\tif (!JAccess::check($user->id, 'core.admin', 'root.1')) {\r\n\t\t\t\t$permission = FlexicontentHelperPerm::getPerm();\r\n\t\t\t\t$id = $this->getState($this->getName().'.id');\r\n\t\t\t\tif ($id) {\r\n\t\t\t\t\t$rights \t= FlexicontentHelperPerm::checkAllItemAccess($uid, 'item', $id);\r\n\t\t\t\t\t$canEdit \t= in_array('flexicontent.editall', $rights) || $permission->CanEdit;\r\n\t\t\t\t\t$canEditOwn\t= (in_array('flexicontent.editown', $rights) && ($item->created_by == $user->id));\r\n\t\t\t\t\tif ($canEdit || $canEditOwn) return true;\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "protected function isCurrentPageContentModelEditable() {\n\t\t$contentHandler = $this->getContentHandler();\n\n\t\treturn $contentHandler->supportsDirectEditing()\n\t\t\t&& $contentHandler->supportsDirectApiEditing();\n\t}", "public function isEditorial()\n {\n return $this->getData('isEditorial', false) === true;\n }", "public function edit() {\n\t\t\t\n\t\t}", "public function isEditable() {\n\t\tif ($this->isVariable()) {\n\t\t\t$editables = $this->parent->editables();\n\t\t\tif (empty($editables)) {\n\t\t\t\treturn $this->isValueEditable;\n\t\t\t}\n\t\t\treturn ((in_array($this->parsedVarName, $editables) !== false) && $this->isValueEditable);\n\t\t}\n\t\treturn false;\n\t}", "public function in_edit_display_mode($mode = null) {\n if (!$submission = $this->submission_settings) {\n return false;\n }\n if (empty($submission['display'])) {\n return false;\n }\n if (!$mode) {\n return true;\n }\n return ($submission['display'] == $mode);\n }", "public function isEditable()\n {\n // Need to be able to save the DataObject if this is being called during PublishTargetJob.\n if ($this->owner->getIsPublishJobRunning()) {\n return true;\n }\n\n // Need to be able to save the DataObject if this is being called during UnPublishTargetJob.\n if ($this->owner->getIsUnPublishJobRunning()) {\n return true;\n }\n\n if ($this->owner->config()->get('allow_embargoed_editing')) {\n return true;\n }\n\n if ($this->owner->getIsPublishScheduled()) {\n return false;\n }\n\n $embargoRecordIsEditable = $this->owner->invokeWithExtensions('embargoRecordIsEditable');\n if (in_array(false, $embargoRecordIsEditable)) {\n return false;\n }\n\n return true;\n }", "function show_edit()\n\t{\n\t\treturn '';\n\t}", "abstract protected function renderEdit();", "protected function allowEdit($data = array(), $key = 'a_id')\n\t{\n\t\treturn true;\n\t}", "protected function allowEdit($data = array(), $key = 'id')\n {\n return true;\n }", "protected function canEdit(Model $model)\n {\n return true;\n }", "protected function isPageEditable()\n {\n if ($this->getBackendUser()->isAdmin()) {\n return true;\n }\n return !$this->pageinfo['editlock'] && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::PAGE_EDIT);\n }", "public function getCanEditAttribute()\n {\n // Are you the owner if the note?\n return Auth::id() == $this->user_id;\n }", "public function canEdit()\n\t{\n\t\tif ( $this->deleteOrMoveQueued() === TRUE )\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\t\t\n\t\tif( static::restrictionCheck( 'edit' ) )\n\t\t{\n\t\t\treturn TRUE;\n\t\t}\n\n\t\tif( isset( static::$ownerTypes['member'] ) and static::$ownerTypes['member'] !== NULL )\n\t\t{\n\t\t\t$column\t= static::$ownerTypes['member'];\n\n\t\t\tif( $this->$column and $this->$column == \\IPS\\Member::loggedIn()->member_id )\n\t\t\t{\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t}\n\n\t\tif( isset( static::$ownerTypes['group'] ) and static::$ownerTypes['group'] !== NULL )\n\t\t{\n\t\t\t$column\t= static::$ownerTypes['group']['ids'];\n\t\t\n\t\t\t$value = $this->$column;\n\t\t\tif( count( array_intersect( explode( \",\", $value ), \\IPS\\Member::loggedIn()->groups ) ) )\n\t\t\t{\n\t\t\t\treturn TRUE;\n\t\t\t}\n\t\t}\n\n\t\treturn FALSE;\n\t}", "public function isValidEditingStatus()\n {\n return ($this->ID == 0 || $this->Status == self::STATUS_NEW || $this->Status == self::STATUS_FAILED);\n }", "function fa_is_theme_edit_preview(){\n\tif( fa_is_preview() ){\n\t\tif( isset( $_GET['action'] ) && 'theme_edit' == $_GET['action'] ){\n\t\t\treturn true;\n\t\t}\n\t}\t\n\treturn false;\n}", "function EditOwnSettings()\n\t{\n\t\tif ($this->Admin()) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn $this->editownsettings;\n\t}", "public function getEdit()\n\t{\n\t}", "function is_elementor_editor() {\n\t\treturn is_admin() && ( isset( $_GET['action'] ) && sanitize_text_field( $_GET['action'] ) === 'elementor' );\n\t}", "public function is_allowed_to_edit_content_object()\n {\n return $this->is_allowed(WeblcmsRights::EDIT_RIGHT, $this->publication) &&\n $this->publication->get_allow_collaboration();\n }", "public function isEditable(User $u){\n\t\t\tif( $u->id == $this->user->id){\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}", "public function getUserCanEditAttribute()\n {\n return AccessControl::check($this, 'edit_post', false);\n }", "function is_edit_page( $new_edit = null ) {\n\tglobal $pagenow;\n\tif ( !is_admin() ) return false;\n\tif ( $new_edit == \"edit\" )\n\t\treturn in_array( $pagenow, array( 'post.php', ) );\n\telseif ($new_edit == \"new\")\n\t\treturn in_array( $pagenow, array( 'post-new.php' ) );\n\telse\n\t\treturn in_array( $pagenow, array( 'post.php', 'post-new.php' ) );\n}", "public function adminViewFileEdits()\r\n\t{\r\n\t\treturn false;\r\n\t}", "public function getEditInput();", "public function checkEnableColumnEdit()\n\t{\n\t\treturn false;\n\t}", "public function canEdit()\n {\n if (!$this->site) {\n return false;\n }\n\n if (!$this->current_user) {\n return false;\n }\n\n if ($this->site->userIsVerified($this->current_user)) {\n return true;\n }\n\n return false;\n }", "public function MetaEditable() {\n\t\t\treturn true;\n\t\t}", "public function Edit()\n\t{\n\t\t\n\t}", "public function isEditor()\n {\n return $this->role()->where('id', $this->roles['EDITOR'])->exists();\n }", "public function edit()\n {\n \n }", "public function isEditor(): bool\n {\n return $this->getClaimSafe(SharedClaimsInterface::CLAIM_USER_ROLE) === self::$userRoleEditor;\n }", "public function edit() {\n }", "public function getIsUserEditable()\n\t{\n\t\treturn $this->is_user_editable;\n\t}", "public function edit()\r\n {\r\n //\r\n }", "public function edit()\r\n {\r\n //\r\n }", "public function canEdit($member = null) {\n return false;\n }", "public function canEdit($member = null) {\n\t\treturn false;\n\t}", "protected function is_course_editor() {\n if (!$this->getSession()->getPage()->findLink(get_string('turneditingoff')) &&\n !$this->getSession()->getPage()->findLink(get_string('turneditingon'))) {\n return false;\n }\n\n return true;\n }", "function is_edit_page($new_edit = null)\n{\n global $pagenow;\n //make sure we are on the backend\n if (!is_admin()) return false;\n\n\n if ($new_edit == \"edit\")\n return in_array($pagenow, array('post.php',));\n elseif ($new_edit == \"new\") //check for new post page\n return in_array($pagenow, array('post-new.php'));\n else //check for either new or edit\n return in_array($pagenow, array('post.php', 'post-new.php'));\n}", "public function canEditCaption()\n {\n return in_array('edit_caption', $this->actions);\n }", "function canEditPage(Page $page) {\n return ($this->isAdmin() || ($this->id == $page->getCreatorId()));\n }", "public function edit()\n {\n \n }", "public function edit()\n {\n \n }", "public function edit()\n {\n \n }", "private function is_editor() {\n\t\tif ( is_user_logged_in() ) {\n\t\t\t// A global admin can edit content or change options anywhere.\n\t\t\tif ( is_super_admin() ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t$user = wp_get_current_user();\n\n\t\t\t// On the WSUWP Platform, a network admin can edit content or change options\n\t\t\t// anywhere on an individual network and may not have a role assigned.\n\t\t\tif ( function_exists( 'wsuwp_is_network_admin' ) ) {\n\t\t\t\tif ( wsuwp_is_network_admin( $user->user_login ) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Authors and above have (at least) the ability to publish content or delete\n\t\t\t// published content at some level.\n\t\t\t$allowed_roles = array( 'editor', 'administrator', 'author' );\n\t\t\tif ( array_intersect( $allowed_roles, $user->roles ) ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}" ]
[ "0.90717554", "0.86034536", "0.8497553", "0.81918395", "0.81680906", "0.8126412", "0.8073284", "0.8066822", "0.8066822", "0.7998006", "0.798625", "0.7966577", "0.7944133", "0.7889652", "0.78798366", "0.7799832", "0.779833", "0.7762823", "0.77104485", "0.7613159", "0.75540346", "0.7509573", "0.74644405", "0.7448828", "0.74403125", "0.73583335", "0.73583335", "0.7308773", "0.72886175", "0.7277327", "0.72535384", "0.72506756", "0.7172636", "0.71044314", "0.70938766", "0.7080559", "0.7042078", "0.7039013", "0.70369774", "0.70158976", "0.6994521", "0.69868344", "0.6968431", "0.69594604", "0.6949423", "0.69249165", "0.6907451", "0.6891572", "0.687244", "0.6868933", "0.6831443", "0.6819972", "0.6795536", "0.67878747", "0.67797524", "0.6764803", "0.6763957", "0.6750442", "0.6749061", "0.67414975", "0.67343533", "0.6729929", "0.67235786", "0.67137456", "0.67058176", "0.6680199", "0.66753787", "0.6650747", "0.664359", "0.66306216", "0.66132927", "0.66073376", "0.66042596", "0.6599754", "0.65935975", "0.6582574", "0.6581789", "0.6581102", "0.6575465", "0.6569931", "0.6569261", "0.65635055", "0.6535672", "0.65230757", "0.65216804", "0.65092784", "0.65091616", "0.6508479", "0.6498629", "0.6498629", "0.6498234", "0.6491904", "0.648811", "0.6486875", "0.6484352", "0.6481878", "0.64786047", "0.64786047", "0.64786047", "0.6473751" ]
0.7790308
17
Load url helper for use later.(base_url()).
public function index() { redirect(base_url("index.php")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function __construct() {\n parent::__construct();\n $this->load->helper('url'); \n }", "public function __construct()\r\n {\r\n helper([\"url\"]);\r\n }", "public function __construct() {\n parent::__construct();\n $this->load->helper('url');\n }", "public function __construct() {\n parent::__construct();\n\n $this->load->helper('url');\n }", "public function __construct()\n {\n parent::__construct();\n $this->load->helper('url');\n }", "public function __construct(){\n\t\tparent::__construct();\n\n\t\t$this->load->helper('url');\n\n\t}", "function __construct()\n\t{\n\t\tparent::__construct();\n\t\t$this->load->helper('path', 'url');\n\t}", "public function __construct()\n\t{\n\t\t# code...\n parent::__construct();\n $this->load->helper('url');\n\t}", "public function __construct()\n\t{\n\t\t parent::__construct();\n\t\t $this->load->helper('url');\n\t\t \n\t }", "function base_url(){\n $url = BASE_URL;\n return $url;\n }", "function base_url(){\n return BASE_URL;\n }", "function base_url()\n{\n return APP::getBaseUrl();\n}", "public function base_url()\n\t{\n\t\treturn URL::base();\n\t}", "function __construct() {\n parent::__construct();\n $this->load->helper(array('form', 'url'));\n }", "public function __construct()\n {\n parent::__construct();\n $this->load->helper(array('form', 'url'));\n }", "function __construct()\n {\n parent::__construct();\n\t\t$this->load->helper(array('form', 'url'));\n\n }", "public function __construct() {\r\n parent::__construct();\r\n \r\n $this->load->helper(array('form', 'url'));\r\n \r\n }", "function base_url($url = '') {\n return Url::make($url);\n}", "function lang_base_url()\n\t{\n\t\t$ci =& get_instance();\n\t\treturn $ci->lang_base_url;\n\t}", "function lang_base_url()\n\t{\n\t\t$ci =& get_instance();\n\t\treturn $ci->lang_base_url;\n\t}", "function active_url($slash = TRUE)\n{\n\t$CI =& get_instance();\n\tif($slash == TRUE)\n\t{\n\t\treturn $CI->config->slash_item('base_url').variable($CI->config->slash_item('url_parts'));\n\t}\n\telse\n\t{\n\t\treturn $CI->config->slash_item('base_url').variable($CI->config->slash_item('url_parts'));\n\t}\n}", "public function base_url(){\n return $this->plugin_url() . 'base/';\n }", "function __construct() {\n parent::__construct();\n $this->load->helper('url');\n $this->load->helper('api');\n }", "public function __construct()\n\t{\n\t\tparent::__construct();\n\t\t$this->load->helper(array('form', 'url'));\n\t}", "public static function url()\n {\n return base_url(static::action());\n }", "function get_base_url() {\n return $this->base_url;\n }", "protected function initiateUrl()\n\t{\n\t\t// base url\n\t\tif($this->app->config->has('app.url'))\n\t\t\t$this->setBase($this->app->config->get('app.url'));\n\n\t\t// asset url\n\t\tif($this->app->config->has('asset.url'))\n\t\t\t$this->setAsset($this->app->config->get('asset.url'));\n\t}", "function __construct() {\n\n parent::__construct();\n $this->load->helper('url');\n// echo \"hello\";\n// $this->load->view('home');\n }", "function __construct()\r\n {\r\n parent::__construct();\r\n $this->load->helper('form');\r\n $this->load->helper('url');\r\n }", "function _load_helpers()\r\n\t{\r\n\t\t// Load inflector helper for singular and plural functions\r\n\t\t$this->load->helper('inflector');\r\n\r\n\t\t// Load security helper for prepping functions\r\n\t\t$this->load->helper('security');\r\n\t}", "function theme_url($uri)\n{\n \n\t$CI =& get_instance();\n\treturn $CI->config->base_url($uri);\n}", "private static function base_url($path=NULL)\n {\n\t\tglobal $url;\n $fullurl=$url.$path;\n return $fullurl;\n\t}", "function base_url() {\r\necho \"<base href=\" . get_site_url() . \">\";\r\n}", "function bu($url=null) \n{\n static $baseUrl;\n if ($baseUrl===null)\n $baseUrl=Yii::app()->getRequest()->getBaseUrl();\n return $url===null ? $baseUrl : $baseUrl.'/'.ltrim($url,'/');\n}", "static protected function get_base_url(){\r\n return plugins_url(null, __FILE__);\r\n }", "function base_url($uri=null){\n\t$base_url = 'http://localhost/KoperasiSimpanPinjam/';\n\tif($uri == null){\n\t\treturn $base_url;\n\t}else{\n\t\treturn $base_url.$uri;\n\t}\n}", "function bu($url=null)\n{\n static $baseUrl;\n if ($baseUrl===null)\n $baseUrl=Yii::app()->getRequest()->getBaseUrl();\n return $url===null ? $baseUrl : $baseUrl.'/'.ltrim($url,'/');\n}", "protected function initCurrentUrl() {}", "protected function initCurrentUrl() {}", "public function loadHelpers()\n {\n require_once __DIR__.'/helpers.php';\n }", "function bu($url=null)\n{\n static $baseUrl;\n if ($baseUrl===null)\n $baseUrl=Yii::app()->getRequest()->getBaseUrl();\n return $url===null ? $baseUrl : $baseUrl.'/'.ltrim($url,'/');\n}", "function __construct()\n\t{\n\t\tparent::__construct();\n\t\t$this->load->helper('url');\t//helper para poder usar el comando base_url()\n\t\t$this->load->helper('security');\t//helper para implementar xss_clean y no permitir codigo en inputs\n\t}", "function user_url(User $user, $controller=null, $action=null, $params='', $includeDomain=false, $module=null)\r\n{\r\n if ($module == null) {\r\n $module = $user->getDefaultModule();\r\n }\r\n\n if ($module == null) {\n \t$module = 'default';\n }\r\n return build_url($controller, $action, $params, $includeDomain, $module);\r\n}", "function base_url() {\n return Micro::get(Config::class)->get('app.base_url');\n }", "function page_url($slash = TRUE)\n{\n\t$CI =& get_instance();\n\t$CI->load->library('fs_navigation');\n\t\n\tif($slash == TRUE)\n\t{\n\t\treturn $CI->config->slash_item('base_url').variable($CI->config->unslash_item('url_parts')).$CI->fs_navigation->current('path').'/';\n\t}\n\telse\n\t{\n\t\treturn $CI->config->slash_item('base_url').variable($CI->config->unslash_item('url_parts')).$CI->fs_navigation->current('path');\n\t}\n}", "public function init()\n {\n \tdefined('BASE_URL')\t|| define('BASE_URL', Zend_Controller_Front::getInstance()->getBaseUrl());\n }", "public function init()\n {\n \tdefined('BASE_URL')\t|| define('BASE_URL', Zend_Controller_Front::getInstance()->getBaseUrl());\n }", "public function UrlBase(){\n\t\treturn URL_APP;\n\t}", "public function baseUrl()\n {\n return \\yii\\helpers\\Url::base(true);\n }", "function bu($url='')\n{\n static $baseUrl;\n $baseUrl=Yii::app()->request->baseUrl;\n $baseUrl .= $baseUrl.'/'.ltrim($url,'/');\n if(param('root_control'))\n {\n $baseUrl = \"/\" . param('root_control') . $baseUrl;\n }\n return $baseUrl; \n}", "protected function determineBaseUrl() {}", "protected function get_url()\n {\n return $this->base_url + $this->api_version; \n }", "public function utils_url(){\n return $this->plugin_url() . 'utils/';\n }", "private function loadLib() {\r\n $this->load->library( 'javascript' );\r\n\r\n $this->load->helper( 'url' );\r\n $this->load->helper( 'html' );\r\n }", "private function getUrl() {\r\n if(!$this->markActive)\r\n return '';\r\n $mid = Yii::$app->controller->module->id == Yii::$app->id ? '' : Yii::$app->controller->module->id;\r\n $cid = Yii::$app->controller->id;\r\n $aid = Yii::$app->controller->action->id;\r\n $id = isset($_GET['slug']) ? $_GET['slug'] : (isset($_GET['id']) ? $_GET['id'] : '');\r\n $rubric = isset($_GET['rubric']) ? $_GET['rubric'] : '';\r\n $tag = isset($_GET['tag']) ? $_GET['tag'] : '';\r\n return ($mid ? $mid. '/' : '') . \r\n $cid . '/' . \r\n ($aid == 'index' \r\n ? ($rubric \r\n ? 'rubric/' . $rubric . ($tag \r\n ? '/tag/' . $tag \r\n : '') \r\n : 'index') \r\n : ($aid == 'view' ? $id : $aid)\r\n );\r\n }", "function asset_url($uri = null)\n{\n $CI =& get_instance();\n\n $cdn = $CI->config->item('asset_url');\n if (!empty($cdn))\n return $cdn . $uri;\n\n return $CI->config->base_url($uri);\n}", "private function get_base_url() : string {\n return plugin_dir_url( dirname( __FILE__, 2 ) );\n }", "public function init()\n {\n $this->view->baseUrl = $this->_request->getBaseUrl();\n }", "private static function loadUrl(){\n\n $uri = $_SERVER['REQUEST_URI'];\n\n if (ENCRYPTURL == '1')\n $uri = CR::decrypt($uri);\n\n BASEDIR == '/' || $uri = str_replace(BASEDIR,'', $uri);\n $uri = explode('/', $uri);\n\n array_walk($uri, function(&$item){\n strpos($item, '?') == false ||\n $item = substr($item, 0, strpos($item, '?'));\n });\n\n return $uri;\n }", "protected static function generate_base_url()\n\t{\n\t\t$base_url = parent::generate_base_url();\n\t\treturn str_replace('htdocs/novius-os/', '', $base_url);\n\t}", "public function getUrl($alias, $replacebase = TRUE, $addajax = FALSE)\r\n {\r\n\r\n $results = $this->model->getUrlByAlias($alias);\r\n\r\n //add the ajax keyword\r\n if ($addajax !== FALSE) {\r\n $ajax = '/ajax';\r\n } else {\r\n $ajax = '';\r\n }\r\n\r\n if (strpos($results[0]->href, '{base}') !== FALSE) {\r\n\r\n //add ajax keyword after {base}\r\n $spliturl = explode('{base}', $results[0]->href);\r\n $ajaxurl = $ajax . $spliturl[1];\r\n $baseurl = '{base}' . $ajaxurl;\r\n\r\n //replace the {base} paceholder\r\n if ($replacebase == TRUE) {\r\n $url = str_replace('{base}', Url::base(), $baseurl);\r\n } else {\r\n $url = str_replace('{base}', '', $baseurl);\r\n }\r\n } else {\r\n print_r($menu_items);exit;\r\n $url = $ajax . $results[0]->href;\r\n }\r\n\r\n return $url;\r\n }", "public function __construct()\n {\n $this->base_url = url('/').'/';\n }", "function __construct() {\n parent::__construct();\n $this->load->Model(\"Admin_model\");\n $this->load->helper(\"url\");\n }", "public function get_url();", "protected static function baseurl($path=NULL)\n {\n\t\t$res=self::base_url($path);\n\t\treturn $res;\n }", "function base_url($url = NULL){\n\t\tif ($url != NULL)\n\t\t{\n\t\t\t$baseurl = 'http://localhost/pkl/'.$url;\n\t\t}\n\t\telse\t\n\t\t{\n\t\t\t$baseurl = 'http://localhost/pkl/';\n\t\t}\n\t\t\n\t\treturn $baseurl;\n\t}", "protected function _initControllerHelpers()\n\t{\n\t\tZend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/Helper', 'Tourchhelper');\t\n\t}", "function Dosage_Controller()\n {\n parent::__construct();\n $this -> view_data['base_url'] = base_url();\n }", "protected function urlBase()\n {\n return \"/bibs/{$this->bib->mms_id}/representations/{$this->representation_id}\";\n }", "public function url()\n\t{\n\t\t\n\t\t$lang = Config::get('app.locale');\n\t\t$route_prefix = ($lang == \"ar\" ? \"ar/\" : \"\");\t\t\n\t\treturn Url::to($route_prefix .'page/' .$this->link);\n\t}", "function __construct() {\n\t\tparent::__construct();\n\t\t$this->load->helper('welcome');\n\t}", "function __construct(){\n\t\tparent::__construct();\n\t\t$this->load->helper(\"url\");\n\t\t$this->load->database();\n\t}", "function url($page='') {\n return $this->base_url . $page;\n }", "public function getBaseUrl() {}", "protected function renderCurrentUrl() {}", "protected function renderCurrentUrl() {}", "public function __construct() {\n parent::__construct();\n $this->load->library(\"session\");\n $this->load->helper('url');\n }", "protected function registerHelpers() {\r\n $this->service\r\n ->sharedData()\r\n ->set('appHelper', array(\r\n 'absotuleUri' => $this->request->server()->exists('HTTPS') ? \"https://{$this->request->server()->get('SERVER_NAME')}/{$this->request->uri()}\" : \"http://{$this->request->server()->get('SERVER_NAME')}/{$this->request->uri()}\",\r\n ));\r\n }", "public function url() {\n if ($this->no_results)\n return false;\n\n $config = Config::current();\n\n return url(\"view/\".$this->url, ExtendController::current());\n }", "public function get_url()\n {\n }", "protected function setUp()\r\n {\n Zend_Controller_Front::getInstance()->getRouter()->addDefaultRoutes();\r\n $this->_helper = new Zym_View_Helper_SimpleUrl();\n }", "function get_base_url()\n{\n $url = explode('/',$_SERVER['REQUEST_URI']);\n $segmentOne = isset($url[0]) ? $url[0] : '';\n $segmentTwo = isset($url[1]) ? $url[1] : '';\n $url = 'http://localhost/' . ($segmentOne ? $segmentOne . '/' : '') . ($segmentTwo ? $segmentTwo : '') . '/';\n return $url;\n}", "abstract public function getControllerUrl();", "function asset_url(){\n return base_url().'assets/';\n}", "public function get_core_url() {\n\t\t\treturn trailingslashit( $this->settings['base_url'] );\n\t\t}", "function get_base_url($protocol=true)\n{\n return Request::GetBaseUrl($protocol);\n}", "public function getBaseUrl() {\r\n\t\treturn home_url();\r\n\t}", "protected function _Load_Helpers() {\r\n $dir = untrailingslashit( plugin_dir_path(__FILE__ ) );\r\n // Recurssively load the directory\r\n $this->_Recusive_Load_Dir($dir.'/helpers');\r\n // Fire the shortcode init action\r\n do_action('vcff_supports_helper_init',$this);\r\n }", "private function urlWrapper() {\n return $this->baseURL;\n }", "public function loadForm()\n {\n $this->load->library(array('form_validation'));\n $this->load->helper(array('form', \"url\"));\n }", "public static function get_baseurl()\n {\n }", "static function base()\n {\n return trim(App::router()->getBase(), '/');\n }", "protected function urlBase()\n {\n return sprintf('/users/%s', rawurlencode($this->id));\n }", "public function init() {\n include(\"Url.php\");\n }", "public function __construct() {\r\n parent::__construct();\r\n// $this->load->helper('url');\r\n //$this->load-model('dbconnect');\r\n }", "public function getBaseUrl();", "public function getBaseUrl();", "public function getBaseUrl();", "public function getBaseUrl();", "public function getBaseUrl();", "function _initActionHelpers(){\n Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers', 'My_Action_Helper');\n }" ]
[ "0.7130748", "0.7029656", "0.69483984", "0.69199526", "0.68676734", "0.68498653", "0.6832008", "0.6800604", "0.6687828", "0.65610117", "0.65453994", "0.65253687", "0.65214115", "0.6465156", "0.6364982", "0.63411045", "0.63374484", "0.6304357", "0.62724274", "0.62724274", "0.6250239", "0.62469476", "0.62308884", "0.61981004", "0.61962533", "0.6117078", "0.60890365", "0.60602444", "0.6053993", "0.6050659", "0.6021926", "0.59959084", "0.5994463", "0.5970124", "0.5929698", "0.5888517", "0.58637655", "0.58291817", "0.58291817", "0.5820966", "0.5805675", "0.5779879", "0.5779222", "0.5768939", "0.57422996", "0.57289773", "0.57289773", "0.57272094", "0.57171303", "0.5712442", "0.5694933", "0.56927484", "0.5688639", "0.5682788", "0.5680582", "0.5657156", "0.5639264", "0.56205827", "0.56190914", "0.5616734", "0.5613916", "0.56121624", "0.5607443", "0.56050515", "0.55930215", "0.559092", "0.55891466", "0.55845857", "0.5581557", "0.5578765", "0.5574934", "0.55646837", "0.5562944", "0.555669", "0.5551263", "0.5551263", "0.55477", "0.55472285", "0.55381453", "0.5530697", "0.5527446", "0.55170566", "0.5510984", "0.55010545", "0.5500052", "0.54942834", "0.5487373", "0.5485265", "0.5484796", "0.5482423", "0.54789954", "0.54674774", "0.5463629", "0.5462978", "0.5461156", "0.54540163", "0.54540163", "0.54540163", "0.54540163", "0.54540163", "0.5447342" ]
0.0
-1
Returns the default table name to use for a model class.
private static function tableName($className) { return strtolower(Util::getSimpleClassName($className)) ; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getDefaultTableName(): string\n {\n return \\implode('_', \\array_map(function ($element) {\n return Str::plural($element);\n }, \\array_merge(\n \\is_null($this->getModelGroup()) ? [] : \\explode('_', $this->getModelGroup()),\n ['pivot'],\n \\explode('_', $this->modelName),\n )));\n }", "private static function get_table_name() {\n\n $class = get_called_class();\n\n return strtolower($class);\n\n }", "public function table() {\n\t\treturn static::$table ?: strtolower(Str::plural(class_basename($this)));\n\t}", "public static function getTableName()\n {\n return Str::snake(Str::pluralStudly(class_basename(get_called_class())));\n }", "public function getTableName(){\r\n\t\treturn strtolower(get_class($this));\r\n\t}", "public static function getTableName()\n\t{\n\t\t//called from users, keyword self:: returns model\n\t\t// return self::$table;\n\t\t//called from users, keyword static:: returns users\n\t\treturn static::$table;\n\t}", "public function getTableSingular()\n {\n if (($table = Str::snake(class_basename($this))) == 'model' && $this->table) {\n $table = Str::singular($this->table);\n }\n\n return $table;\n }", "public static function getTableName()\n {\n return _DB_PREFIX_ . self::$definition['table'];\n }", "public static function get_table_name()\n {\n return self::TABLE_NAME;\n }", "public function get_table_name(){\n return $this->table_name();\n }", "public function getTable()\n\t{\n\t\tif (isset($this->table)) return $this->table;\n\n\t\treturn $this->table = str_replace('\\\\', '', snake_case(str_plural(class_basename($this))));\n\t}", "public static function tablename() {\n return self::TABLE;\n }", "public static function getTableName()\n {\n $type = static::getType();\n return $type::getTableName();\n }", "public function getTable()\n {\n if (! isset($this->table)) {\n return str_replace('\\\\', '', Str::snake(Str::plural(class_basename($this))));\n }\n\n return $this->table;\n }", "protected function getTableName(): string {\n return self::TABLE_NAME;\n }", "public function getTable()\n\t{\n\t\treturn empty($this->table) ? $this->table = Db_Inflector::pluralize($this->getSingular()) : $this->table;\n\t}", "public function getTable()\n {\n if (isset($this->table)) {\n return $this->table;\n }\n\n return str_replace('\\\\', '', Str::snake(Str::plural(class_basename($this))));\n }", "protected function getTableName () {\n $class = explode('\\\\', get_class($this));\n\n return strtolower(end($class));\n }", "public static function getTableName()\n {\n return self::getDatabaseName() . '.' . self::NAME;\n }", "public static function getTableName(){\n\t\treturn self::$table_name;\n\t}", "public function getTable() {\n if ( isset( $this->table ) ) {\n return $this->table;\n }\n\n $table = str_replace( '\\\\', '', snake_case( str_plural( class_basename( $this ) ) ) );\n\n return $this->getConnection()->db->prefix . $table ;\n }", "public function getTableName() {\n\t\t$table = strtolower(get_called_class());\n\t\tif ($table == 'person')\n\t\t\treturn 'people';\n\t\tswitch (substr($table, -1)) {\n\t\t\tcase 'y': return substr($table, 0, -1) . 'ies';\n\t\t\tcase 's': return $table . 'es';\n\t\t}\n\t\treturn $table . 's';\n\t}", "public function getTable()\n {\n if (isset($this->table)) {\n return $this->table;\n }\n return str_replace('\\\\', '', Str::snake(Str::singular(class_basename($this))));\n }", "public function get_table_name()\n {\n return $this->prefix . $this->table;\n }", "public function getTableName(): string\n {\n return $this->getEntityDao()->getTableName();\n }", "public static function getTableName()\n {\n return self::getConfig()->get('scheme/tableName');\n }", "protected function table () : string {\n return $this->guessName();\n }", "public function getTable()\n {\n if (! isset($this->table)) {\n return str_replace(\n '\\\\',\n '',\n Str::snake(Str::plural(class_basename(self::class)))\n );\n }\n\n return $this->table;\n }", "private function _table() {\n if ($this->table == NULL) {\n $this->load->helper('inflector');\n $class = preg_replace('#((_m|_model)$|$(m_))?#', '', strtolower(get_class($this)));\n $this->table = plural(strtolower($class));\n }\n return $this->table;\n }", "function get_table_name()\n {\n global $table_prefix;\n global $wpdb;\n $prefix = $table_prefix;\n if ($wpdb != null && $wpdb->prefix != null) {\n $prefix = $wpdb->prefix;\n }\n return apply_filters('ngg_datamapper_table_name', $prefix . $this->_object_name, $this->_object_name);\n }", "public function className()\n {\n $name = Str::plural($this->model);\n\n return \"Create{$name}Table\";\n }", "function table_name() {\n\t\tif ($this->table) {\n\t\t\treturn $this->table;\n\t\t} else {\n\t\t\treturn $this->_get_type();\n\t\t}\n\n\t}", "public function getTableName()\n {\n return $this->__get(\"table_name\");\n }", "public function get_table_name() {\n return $this->table_name;\n }", "private function getTableName()\n {\n $class = get_class($this);\n\n $mem = new Cache();\n if ($tableName = $mem->get($class . '-table-name')) {\n return $tableName;\n }\n\n $break = explode('\\\\', $class);\n $ObjectName = end($break);\n $className = strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $ObjectName));\n $tableName = Inflect::pluralize($className);\n\n $mem->add($class . '-table-name', $tableName, 1440);\n\n return $tableName;\n }", "public function _tablename() {\n if (isset($this->_table) && !isNull($this->_table)) {\n return $this->_table;\n } else {\n return camel_case_to_underscore(get_class($this));\n }\n }", "public static function getTableName() {\n return self::$tableName;\n }", "function get_table_name() {\n\n\t\tglobal $wpdb;\n\n\t\treturn $wpdb->prefix . $this->table_name;\n\t}", "public function getTableName() : string\n {\n if ($this->tableName !== null) {\n return $this->tableName;\n }\n\n return $this->reflectionClass->getShortName();\n }", "public static function getTable() : string {\n\t\t$namespacedClassParts = explode(\"\\\\\", get_called_class());\n\t\t$table = array_pop($namespacedClassParts);\n\t\t$table = preg_replace(\"/([a-z0-9])([A-Z0-9])/\", '$1_$2', $table);\n\t\t$table = strtolower($table);\n\t\treturn $table;\n\t}", "private static function getTableName() {\n return get_called_class();\n }", "public static function getTableName()\n {\n return ((new self)->getTable());\n }", "public function getTableName()\n {\n return $this->table_name;\n }", "public function getTableName()\n {\n return $this->table_name;\n }", "public function getTableName()\n {\n return $this->table_name;\n }", "public static function getTableName()\n {\n return static::getConfig()[self::CONFIG_TABLE_NAME];\n }", "public function getTableName()\n\t{\n\t\treturn $this->getPrefix().$this->tableName;\n\t}", "public function getTableName(): string\n {\n return $this->tableNames[0];\n }", "public function getTableName() {\n\t\treturn $this -> _name;\n\t}", "public function tableName()\n\t{\n\t\treturn '{{'.$this->getTableName().'}}';\n\t}", "public function getTableName()\n {\n if ($this->tableName) {\n return $this->tableName;\n }\n\n return $this->namingStrategy->classToTableName($this->name);\n }", "public static function getTableName($class = null)\n {\n $class = $class ?: get_called_class();\n\n return Inflector::tableize($class);\n }", "public function table_name()\n\t{\n\t\treturn $this->table_name;\n\t}", "protected function getTableName()\n {\n return $this->database->getPrefix() . $this->table;\n }", "public static function getTableName()\n\t{\n\t\treturn 'b_documentgenerator_template_provider';\n\t}", "public function getTableName(){\n\t\t $table = get_class($this);\n\t\treturn strtolower(substr($table, strripos($table, \"\\\\\")+1));\n\t}", "private function getTableName($model){\n\n if(property_exists($model, 'tablename')){\n return \\Larubel\\Libs\\Helpers\\Helper::getValueFromClassProperty($model, 'tablename');\n }\n\n // if given class has no propery name 'tablename' \n // then generate a generic table name adding 's' at end with model \n return strtolower(\\Larubel\\Libs\\Helpers\\Helper::splitStringLast($model, '\\\\')) . 's';\n }", "protected static function get_table_name() {\n return null;\n }", "public function getTableName( )\n {\n return $this->table_name;\n }", "function get_table_name () {\r\n\t\treturn $this->wpdb->prefix . $this->_table_name;\r\n\t}", "protected static function _get_table_name($class_name) {\r\n $specified_table_name = self::_get_static_property($class_name, '_table');\r\n if (is_null($specified_table_name)) {\r\n return self::_class_name_to_table_name($class_name);\r\n }\r\n return $specified_table_name;\r\n }", "public function getTableName()\n {\n return $this->table_name;\n }", "public static function getTableName() {\n return str_replace(\"-\", '_', self::getFolderName()) . 's';\n }", "public function getTableName() {\n return $this->mapping['table'];\n }", "private static function getTableName() {\n global $wpdb;\n return $wpdb->prefix . self::$NOTIFICATION_TABLE_NAME;\n }", "public function getTableName()\n {\n return $this->tableName;\n }", "public function getTableName()\n {\n return $this->tableName;\n }", "public function getTableName()\n {\n return $this->tableName;\n }", "public function getTableName()\n {\n return $this->tableName;\n }", "function getTableName()\r\n\t{\r\n\t\tif ( $this->table == null ) return (null );\r\n\t\treturn( $this->table->table_name());\r\n\t}", "public function getTableName(){\n\t\treturn $this->_table;\n\t}", "public static function getTableName()\n\t{\n\t\treturn 'b_im_last_search';\n\t}", "public function getTableName()\n {\n return $this->_name;\n }", "public function getTableName()\n {\n return $this->_name;\n }", "public function getTableName()\n {\n return $this->_name;\n }", "public function getTableName()\r\n {\r\n return $this->tableName;\r\n }", "public function getTableName() {\n\t\t$dbName = empty($this->_dbName) ? '' : ($this->_dbName . '.');\n\t\t$tableName = $dbName . $this->_tableName;\n\t\treturn ($tableName);\n\t}", "public function getMainTableName()\n {\n return $this->main_table_name;\n }", "public function getTableName();", "public function getTableName();", "public function getTableName()\n {\n return $this->tableName;\n }", "public function getTableName() {\n\t\treturn $this->tableName;\n\t}", "public function getTableName() {\n\t\treturn $this->tableName;\n\t}", "public static function getTableName()\n {\n return 'Bindings';\n }", "public function getTableName()\n\t{\n\t\treturn $this->tableName;\n\t}", "public static function getTableClassName()\n\t{\n\t\treturn DocumentSessionTable::class;\n\t}", "public function getTableName(){\n\t\treturn $this->tableName;\n\t}", "public function getTableName() {\n if (isset($this->table)) {\n return $this->table;\n } else return $this->name;\n }", "public function getTableName() ;", "public function getTableNameForClass(string $class): string\n {\n $table = DataObject::getSchema()->tableName($class);\n\n // Fallback to class name if no table name is specified\n return $table ?: $class;\n }", "public static function table_name() {\n $table_name = strtolower(get_called_class());\n\n if (!in_array($table_name, ApplicationSql::tablenames()))\n throw new TableNotFoundException(\"Veritabanında böyle bir tablo mevcut değil\", $table_name);\n\n return $table_name;\n }", "function getTableName(): string;", "protected function table(): string\n {\n return $this->tableName;\n }", "public function getTableName()\n {\n return $this->_tableName;\n }", "public static function getTableName()\n {\n return 'Books';\n }", "function getTableName() {\n return $this->tableName;\n }", "public function getTable(): string\n {\n return $this->prefix . $this->table;\n }", "public function getTableName() {\n return $this->table;\n }", "public function getTableName(){\n return $this->tableName;\n }", "public function table() \n {\n return $this->model->table?? '';\n }", "private static function getFullyQualifiedTableName() {\n $database_name = static::getDatabaseName();\n $table_name = static::getTableName();\n return static::genFullyQualifiedTableName($database_name, $table_name);\n }" ]
[ "0.83081025", "0.80639595", "0.7891343", "0.7824138", "0.7780653", "0.77632016", "0.7735491", "0.7594263", "0.75616866", "0.75223917", "0.7514863", "0.7512523", "0.7486616", "0.7485304", "0.746534", "0.7460153", "0.7458463", "0.7439198", "0.743416", "0.74321383", "0.7396428", "0.7389135", "0.7387497", "0.73826253", "0.7375777", "0.73747", "0.73616457", "0.735301", "0.7340137", "0.73390406", "0.7312432", "0.7303944", "0.7303501", "0.72973657", "0.72931695", "0.7292207", "0.72678393", "0.7267168", "0.7267007", "0.7249192", "0.7231116", "0.722954", "0.7216215", "0.7216215", "0.7216215", "0.72154355", "0.72089356", "0.7185712", "0.7176611", "0.7154594", "0.715368", "0.714272", "0.71361876", "0.71195924", "0.71189153", "0.7117494", "0.7110777", "0.71084213", "0.708766", "0.7085716", "0.70659673", "0.7060322", "0.70542836", "0.704561", "0.70446575", "0.7037127", "0.7037127", "0.7037127", "0.7037127", "0.702789", "0.70132613", "0.7007781", "0.7006968", "0.7006968", "0.7006968", "0.70064473", "0.69976324", "0.6997084", "0.6994335", "0.6994335", "0.69939846", "0.6988746", "0.6988746", "0.69819164", "0.6979149", "0.69773936", "0.6974849", "0.6950193", "0.69452596", "0.6939809", "0.6924398", "0.69231284", "0.6922256", "0.69198", "0.6916232", "0.691267", "0.6902723", "0.69015294", "0.6896122", "0.68894583", "0.68760234" ]
0.0
-1
Tells whether a Relation is a one or many to one relation.
private static function isXToOne(Relation $rel) { return $rel instanceof OneToOne || $rel instanceof ManyToOne ; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isRelation()\n {\n return $this instanceof Relation;\n }", "public function canAutoJoin()\n {\n return ($this instanceof SingleRelation);\n }", "public function isRelated();", "public static function isRelation($type)\n {\n return in_array($type, ['ref-one', 'ref-many', 'oneToMany', 'manyToOne', 'manyToMany', 'optionSet']);\n }", "protected function isOneRelation($query)\n {\n $relations = [\n BelongsTo::class, HasOne::class, MorphOne::class, MorphTo::class,\n HasOneThrough::class,\n ];\n\n foreach ($relations as $relation) {\n if ($query instanceof $relation) {\n return true;\n }\n }\n\n return false;\n }", "public function hasRelationOne($fieldName) {\n\t\t$configuration = $this->getConfiguration($fieldName);\n\t\treturn $this->hasRelation($fieldName) && $configuration['maxitems'] == 1;\n\t}", "public function hasRelationship() {\n return $this->_has(1);\n }", "protected function returnSingleAssociation($relation)\n {\n $classes = collect([\n \\Illuminate\\Database\\Eloquent\\Relations\\BelongsTo::class,\n \\Illuminate\\Database\\Eloquent\\Relations\\HasOne::class,\n \\Illuminate\\Database\\Eloquent\\Relations\\MorphTo::class,\n \\Illuminate\\Database\\Eloquent\\Relations\\MorphOne::class,\n ]);\n\n $relation = $classes->first(function ($class) use ($relation) {\n return is_a($relation, $class);\n });\n\n return $relation ? true : false;\n }", "public function isRel() {\n return substr($this->model, -3) == \"Rel\";\n }", "public function isRelationship($name);", "public function hasRelations()\r\n {\r\n return !empty($this->relations);\r\n }", "public function isRelationshipData();", "public function isHasOne($key)\n {\n if (false === $this->isRelationship($key)) {\n return false;\n }\n return $this->getMetadata()->getRelationship($key)->isOne();\n }", "public function hasOne()\n {\n if ($this->relationship === null)\n {\n $this->relationship = DataModel_Relationship::HAS_ONE;\n return $this;\n }\n else\n {\n \treturn $this->relationship & DataModel_Relationship::HAS_ONE;\n }\n }", "public function hasRelationOneToOne($fieldName) {\n\t\t$result = FALSE;\n\n\t\t$foreignField = $this->getForeignField($fieldName);\n\t\tif (!empty($foreignField)) {\n\n\t\t\t// Load TCA service of foreign field.\n\t\t\t$foreignTable = $this->getForeignTable($fieldName);\n\t\t\t$tcaForeignFieldService = \\TYPO3\\CMS\\Vidi\\Tca\\TcaServiceFactory::getFieldService($foreignTable);\n\t\t\t$result = $this->hasRelationOne($fieldName) && $tcaForeignFieldService->hasRelationOne($foreignField);\n\t\t}\n\t\treturn $result;\n\t}", "private function _has_one($request)\n {\n $relation = $this->_relationships[$request];\n $this->_database->join($relation['foreign_table'], $relation['foreign_table'].'.'.$relation['foreign_key'].' = '.$this->table.'.'.$relation['local_key'], 'left');\n return TRUE;\n }", "protected function isMorphRelation($relation)\n {\n $isMorph = false;\n if ($relation !== null && $relation !== '') {\n $relationParts = explode('.', $relation);\n $firstRelation = array_shift($relationParts);\n $model = $this->query->getModel();\n $isMorph = method_exists($model, $firstRelation) && $model->$firstRelation() instanceof MorphTo;\n }\n\n return $isMorph;\n }", "public function hasOne(Entity|string $entityRelation, string $foreignKey = ''): HasOne|false\n {\n try {\n $entityRelation = $this->getEntity($entityRelation);\n $primaryKey = $entityRelation->getPrimaryKey();\n $preForeignKey = strtolower((new ReflectionClass($entityRelation))->getShortName());\n $foreignKey = $foreignKey ?: $preForeignKey . '_' . $primaryKey;\n $relation = new HasOne($this, $entityRelation, $foreignKey);\n $name = debug_backtrace()[1]['function'] ?? $entityRelation->getManager()->getTable();\n return $this->relations[$name] = $relation;\n } catch (Exception $ex) {\n return false;\n }\n }", "public function isOne()\n {\n return $this->isOne;\n }", "private function determineRelationType() {\n if($this->local_columns[0]->isPrimaryKey() && $this->referenced_columns[0]->isPrimaryKey()) {\n //will either be a one-one relation or a many-many join table\n\n if($this->getLocalTable()->getPrimaryKey() !== null && count(\n $this->getLocalTable()->getPrimaryKey()->getColumns()\n ) > 1\n ) {\n //if local table has more than one PK it's modt likely a join table.\n $type = self::MANY_TO_ONE;\n } elseif($this->getReferencedTable()->getPrimaryKey() !== null && 1 < $num_ref_column = count(\n $this->getReferencedTable()->getPrimaryKey()->getColumns()\n )\n ) {\n //if referencing a table with dual PK, it's most likely a m2m join table that has more to load.\n if($num_ref_column === 2) {\n $type = self::MANY_TO_MANY;\n //go back and find the other relation\n //need to iterate to find the one that's not this.\n foreach($this->getReferencedTable()->getRelations() as $relation) {\n if ($relation->getReferencedColumns() != $this->local_columns) {\n $this->target_relation = $relation;\n break;\n }\n }\n\n //if target relation isn't found, there must be a special case, so just roll back to one-to-many\n //or if target relation has a dual primary key, can't base it being a join table on it anymore.\n if($this->target_relation === null || count(\n $this->target_relation->getReferencedTable()->getPrimaryKey()->getColumns()\n ) > 1\n )\n $type = self::ONE_TO_MANY;\n\n } else {\n //if not 2 PKS it is not reliable enough to assume what's going on.\n $type = self::RELATION_UNKNOWN;\n }\n } else {\n //Otherwise o2o\n $type = self::ONE_TO_ONE;\n }\n\n } elseif($this->is_reverse_relation) {\n $type = self::ONE_TO_MANY;\n } else {\n $type = self::MANY_TO_ONE;\n }\n\n\n return $type;\n }", "public function hasRelations()\n {\n return 0 !== count($this->relations);\n }", "protected function hasCascadeRelationDefined() {\n\n if ( ! is_array($this->relationships) || empty($this->relationships) ) {\n\n return false;\n }\n\n return true;\n }", "protected function isRelationTable($table)\n\t{\n\t\t$pk=$table->primaryKey;\n\t\treturn (count($pk) === 2 // we want 2 columns\n\t\t\t&& isset($table->foreignKeys[$pk[0]]) // pk column 1 is also a foreign key\n\t\t\t&& isset($table->foreignKeys[$pk[1]]) // pk column 2 is also a foriegn key\n\t\t\t&& $table->foreignKeys[$pk[0]][0] !== $table->foreignKeys[$pk[1]][0]); // and the foreign keys point different tables\n\t}", "public function hasRelation($name)\n\t{\n\t\treturn isset($this->relations[$name]);\n\t}", "public function has_or_relation()\n {\n }", "public function hasRelation(string $relation): bool\n {\n return (bool) $this->getRelatedQueryFor($relation);\n }", "public function bidirectional_relation_exists() {\n $this->db->query(\"SELECT * FROM user_relation WHERE (`from` = ? AND `to` = ?) OR (`from` = ? AND `to` = ?)\",\n array(\n $this->from,\n $this->to,\n $this->to,\n $this->from,\n ));\n\n if($this->db->count() > 0) {\n return $this->db->results()[0]->status;\n } else {\n return false;\n }\n }", "public function hasRelation($relation)\n {\n if (!$this->relations) {\n return false;\n }\n\n if (is_array($this->relations) && isset($this->relations[$relation])) {\n return true;\n } elseif (is_object($this->relations) && property_exists($this->relations, $relation)) {\n return true;\n }\n $relations = array_values($this->relations)[0];\n\n return isset($relations->{$relation});\n }", "protected function isOneToOneRelation(Model $parentEntity)\n {\n $relation = $parentEntity->{$this->getRelation()}();\n\n return $relation instanceof HasOne || $relation instanceof MorphOne || $relation instanceof BelongsTo || $relation instanceof HasOneThrough;\n }", "public function getRelationType()\n {\n return $this->relation_type;\n }", "protected function isRelationship($object) {\n\t\treturn ($object instanceof Relationship);\n\t}", "public static function isRelationshipToOne(Property $property)\n {\n return $property instanceof Property\\Relationship\\ToOne;\n }", "protected function frontEndDetermineRelationType($relationName)\n {\n if (!isset(self::$_front_end_determine_relation_type[$relationName])) {\n $hasOne = Config::inst()->get($this->recordBeingEdited->ClassName, \"has_one\");\n if (isset($hasOne[$relationName])) {\n self::$_front_end_determine_relation_type[$relationName] = \"has_one\";\n } else {\n $hasMany = Config::inst()->get($this->recordBeingEdited->ClassName, \"has_many\");\n if (isset($hasMany[$relationName])) {\n self::$_front_end_determine_relation_type[$relationName] = \"has_many\";\n } else {\n $manyMany = Config::inst()->get($this->recordBeingEdited->ClassName, \"many_many\");\n if (isset($manyMany[$relationName])) {\n self::$_front_end_determine_relation_type[$relationName] = \"many_many\";\n } else {\n $belongsManyMany = Config::inst()->get($this->recordBeingEdited->ClassName, \"belongs_many_many\");\n if (isset($belongsManyMany[$relationName])) {\n self::$_front_end_determine_relation_type[$relationName] = \"belongs_many_many\";\n } else {\n user_error(\"type could not be found\", E_USER_NOTICE);\n }\n }\n }\n }\n }\n return self::$_front_end_determine_relation_type[$relationName];\n }", "private function _identifyRelation($relation) {\n\n foreach($this->_tableRelations as $type => $tableRelations) {\n foreach($tableRelations as $tableRelation) {\n if($relation == $tableRelation['model']) {\n switch($type) {\n case 'oneToOne':\n break;\n case 'oneToMany':\n break;\n case 'manyToMany':\n return [\n 'table' => $tableRelation['through'],\n 'keys' => $tableRelation['keys']\n ];\n break;\n }\n }\n }\n }\n\n return false;\n }", "public function getRelationType()\n {\n return $this->relationType;\n }", "public function getRelationType()\n {\n return $this->relationType;\n }", "public function relationable() {\n return $this->morphTo();\n }", "public function isInRelation($relation);", "public function is_relation_key( $meta_key = null ) {\n\t\t\treturn isset( $this->_active_relations[ $meta_key ] );\n\t\t}", "public function isAddToRelationship();", "public function hasRelation($fieldName) {\n\t\treturn NULL !== $this->getForeignTable($fieldName);\n\t}", "public function hasRelation(string $key)\n {\n // If the key already exists in the relationships array, it just means the\n // relationship has already been loaded, so we'll just return it out of\n // here because there is no need to query within the relations twice.\n if ($this->relationLoaded($key)) {\n return true;\n }\n\n // If the \"attribute\" exists as a method on the model, we will just assume\n // it is a relationship and will load and return results from the query\n // and hydrate the relationship's value on the \"relationships\" array.\n if (method_exists($this, $key)) {\n //Uses PHP built in function to determine whether the returned object is a laravel relation\n return is_a($this->$key(), \"Illuminate\\Database\\Eloquent\\Relations\\Relation\");\n }\n\n return false;\n }", "final public function isRelationTable():bool\n {\n return $this->isType('table');\n }", "public function isUserInRelation($relation, Authenticatable $user = null);", "private function relationExist($model, $relationName)\n {\n return array_key_exists($relationName, $model->getRelations());\n }", "public function getAloneAttribute()\n\t{\n\t\treturn $this -> members() -> count() == 1;\n\t}", "private function askRelations()\n {\n foreach ($this->generator->relations as $relation) {\n //Ask\n $choice = $this->ask(\"Is the relation between `\".$relation['table'].\"(\".$relation['local_id'].\")`\"\n .\"and `\".$relation['foreign_table'].\"(\".$relation['foreign_id'].\")`\"\n .\"1:One to Many? or 2:One to One? or 3:None\", '1');\n\n if ($choice != '3') {\n $choice == '2' ? $this->generator->oneToOne[] = $relation : $this->generator->oneToMany[] = $relation;\n }\n }\n }", "public static function isOneOrMany(array $array) {\n return (count($array) === 0)\n ? false\n : array_keys($array) !== range(0, count($array) - 1);\n }", "public static function isRelationship(Property $property)\n {\n return $property instanceof Property\\Relationship;\n }", "public function hasRelation(string $key)\n {\n return array_key_exists($key, $this->relations);\n }", "public function isReadRelationship();", "public function hasRelationManyToOne($fieldName) {\n\t\t$result = FALSE;\n\n\t\t$foreignField = $this->getForeignField($fieldName);\n\t\tif (!empty($foreignField)) {\n\n\t\t\t// Load TCA service of foreign field..\n\t\t\t$foreignTable = $this->getForeignTable($fieldName);\n\t\t\t$tcaForeignFieldService = \\TYPO3\\CMS\\Vidi\\Tca\\TcaServiceFactory::getFieldService($foreignTable);\n\t\t\t$result = $this->hasRelationMany($fieldName) && $tcaForeignFieldService->hasRelationOne($foreignField);\n\t\t}\n\t\treturn $result;\n\t}", "function isSingleValuedAssociation($fieldName);", "public function isRelationship($key)\n {\n return $this->getMetadata()->hasRelationship($key);\n }", "public function hasAny()\n {\n return $this->model->first() ? true : false;\n }", "public function hasAssociations()\n {\n return ($this->pairs->count() || $this->articulations->count() ||\n $this->refits->count() || $this->morphologys->count()) ? true : false;\n }", "public function isARelation($propertyName)\n {\n return array_key_exists($propertyName, $this->_relations);\n }", "protected function isMorphTo()\n {\n\n\n // if (isset($this->parentEntity->system->relationsMorphs[$this->getColumnName()])) {\n // return $this->parentEntity->system->relationsMorphs[$this->getColumnName()];\n // }\n\n /**\n * Old Verifica pelo Atributo\n */\n // if ($this->className==\\Population\\Models\\Market\\Abouts\\Info::class\n // && $this->entity->code['name']!=='id'&& $this->entity->code['name']!=='text'\n // ) {\n if ($searchForeachKey = ArraySearcher::arraySearchByAttribute(\n $this->entity->code['name'],\n // $this->parentEntity->system->tables,\n $this->parentEntity->system->relations,\n 'foreignKey'\n )\n ) {\n $isMorph = false;\n $found = [];\n foreach ($searchForeachKey as $valorFound) {\n if (in_array($this->parentEntity->system->relations[$valorFound]['type'], ['MorphMany', 'MorphTo'])) {\n $isMorph = true;\n $found[] = $this->parentEntity->system->relations[$valorFound];\n }\n }\n // dd($found);\n if ($isMorph) {\n return $found[count($found)-1];\n }\n }\n // dd(\n // $this->className,\n // $this->entity->code,\n // $this->renderDatabaseData\n // );\n // }\n\n if (strpos($this->getColumnName(), 'able') !== false) {\n Log::channel('sitec-support')->warning(\n 'Problema no morph para coluna '.$this->getColumnName()\n );\n // dd(\n // $this->getColumnName(),\n // 'debug1'\n // );\n }\n \n return false;\n }", "public function hasRelation($relationName)\r\n {\r\n return $this->findRelationByName($relationName) !== false;\r\n }", "public function one_to_one()\n {\n }", "protected function hasRelation(Model $model, string $relationName)\n {\n // If the key already exists in the relationships array, it just means the\n // relationship has already been loaded, so we'll just return it out of\n // here because there is no need to query within the relations twice.\n if ($model->relationLoaded($relationName)) {\n return true;\n }\n\n // If the \"attribute\" exists as a method on the model, we will just assume\n // it is a relationship and will load and return results from the query\n // and hydrate the relationship's value on the \"relationships\" array.\n if (method_exists($model, $relationName)) {\n return is_a($model->$relationName(), Relation::class);\n }\n\n return false;\n }", "public function shouldGenerateHasOneMethods(SchemaRelationship $hasOne) {\n\t\tif (!$this->shouldGenerateForTable($hasOne->getRefTable())) {\n\t\t\treturn false;\n\t\t}\n\t\t$table = $hasOne->getLocalTable();\n\t\t$dbName = $table->getDatabase()->getDatabaseName();\n\t\t$tableName = $table->getTableName();\n\t\t$option = $this->getConfigValue('generate_has_one_methods', $dbName, $tableName);\n\t\tif (is_array($option)) {\n\t\t\t// yes, but only for databases in the array.\n\t\t\t$refDbName = $hasOne->getRefTable()->getDatabase()->getDatabaseName();\n\t\t\tif (in_array($refDbName, $option)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} else if ($option == 'all') {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public function isRelationPopulated($name)\n {\n return array_key_exists($name, $this->_related);\n }", "public function hasMorphologys()\n {\n return ($this->morphologys->count()) ? true : false;\n }", "public function isRelatedTo($modelClass, $type = null)\n {\n return count($this->getRelationsTo($modelClass, $type)) > 0;\n }", "public function get_relations_types() {\n\n\t\t\treturn array(\n\t\t\t\t'one_to_one' => __( 'One to one', 'jet-engine' ),\n\t\t\t\t'one_to_many' => __( 'One to many', 'jet-engine' ),\n\t\t\t\t'many_to_many' => __( 'Many to many', 'jet-engine' ),\n\t\t\t);\n\n\t\t}", "public function getRelationTypeId()\n {\n return $this->relation_type_id;\n }", "protected function relationHasIncrementingId()\n {\n return $this->related->getIncrementing() &&\n $this->related->getKeyType() === 'int';\n }", "function has_one($field, $options = null) {\n\t\t$this->associations[$field] = &new HasOneAssociation($this, $field, $options);\n\n\t\treturn true;\n\t}", "public function createRelation($relation = array()) {\n $insert = $this->db->insert($this->relation, $relation);\n return $insert?true:false;\n }", "public function hasMultipleFK()\n {\n return (count($this->getForeignKeys()) > 1);\n }", "public function hasRelationMany($fieldName) {\n\t\t$configuration = $this->getConfiguration($fieldName);\n\t\treturn $this->hasRelation($fieldName) && $configuration['maxitems'] > 1;\n\t}", "public function hasRelation($model, $foreignKey, $localKey);", "public function hasRelationOneToMany($fieldName) {\n\t\t$result = FALSE;\n\n\t\t$foreignField = $this->getForeignField($fieldName);\n\t\tif (!empty($foreignField)) {\n\n\t\t\t// Load TCA service of foreign field..\n\t\t\t$foreignTable = $this->getForeignTable($fieldName);\n\t\t\t$tcaForeignFieldService = \\TYPO3\\CMS\\Vidi\\Tca\\TcaServiceFactory::getFieldService($foreignTable);\n\t\t\t$result = $this->hasRelationOne($fieldName) && $tcaForeignFieldService->hasRelationMany($foreignField);\n\t\t}\n\t\treturn $result;\n\t}", "public function retrieveRelation(RelationEntityInterface $relationEntity): string|false\n {\n foreach ($this->getRelations() as $name => $relation) {\n if ($relation === $relationEntity) {\n return $name;\n }\n }\n return false;\n }", "private function getHasOneClass($obj, $relation_name, $flip = false) {\n\t\t$has_one = $obj->has_one();\n\t\t$has_one = $flip ? array_flip($has_one) : $has_one;\n\t\t$rtn = '';\n\t\tforeach ($has_one as $k=>$v) {\n\t\t\tif($k == $relation_name) {\n\t\t\t\t$rtn = $v;\n\t\t\t\tbreak;\n\t\t\t} \t\n\t\t}\n\t\treturn $rtn;\n\t}", "private static function isRelated($column) {\n $isRelated = false;\n $idSuffix = '_id';\n $pos = strrpos($column, $idSuffix);\n if ($pos !== false && strlen($column) - strlen($idSuffix) === $pos\n ) {\n $isRelated = true;\n }\n return $isRelated;\n }", "public function getRelation()\r\n {\r\n return $this->relation;\r\n }", "function _save_relation($object)\r\n\t{\r\n\t\tif ( ! empty($object->model) && ! empty($this->id) && ! empty($object->id))\r\n\t\t{\r\n\t\t\t// Determine relationship table name\r\n\t\t\t$relationship_table = $this->_get_relationship_table($object->prefix, $object->table, $object->model);\r\n\r\n\t\t\t$data = array($this->model . '_id' => $this->id, $object->model . '_id' => $object->id);\r\n\r\n\t\t\t// Check if relation already exists\r\n\t\t\t$query = $this->db->get_where($relationship_table, $data, NULL, NULL);\r\n\r\n\t\t\tif ($query->num_rows() == 0)\r\n\t\t\t{\r\n\t\t\t\t// If this object has a \"has many\" relationship with the other object\r\n\t\t\t\tif (in_array($object->model, $this->has_many))\r\n\t\t\t\t{\r\n\t\t\t\t\t// If the other object has a \"has one\" relationship with this object\r\n\t\t\t\t\tif (in_array($this->model, $object->has_one))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// And it has an existing relation\r\n\t\t\t\t\t\t$query = $this->db->get_where($relationship_table, array($object->model . '_id' => $object->id), 1, 0);\r\n\r\n\t\t\t\t\t\tif ($query->num_rows() > 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Find and update the other objects existing relation to relate with this object\r\n\t\t\t\t\t\t\t$this->db->where($object->model . '_id', $object->id);\r\n\t\t\t\t\t\t\t$this->db->update($relationship_table, $data);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Add the relation since one doesn't exist\r\n\t\t\t\t\t\t\t$this->db->insert($relationship_table, $data);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\treturn TRUE;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (in_array($this->model, $object->has_many))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// We can add the relation since this specific relation doesn't exist, and a \"has many\" to \"has many\" relationship exists between the objects\r\n\t\t\t\t\t\t$this->db->insert($relationship_table, $data);\r\n\r\n\t\t\t\t\t\treturn TRUE;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// If this object has a \"has one\" relationship with the other object\r\n\t\t\t\telse if (in_array($object->model, $this->has_one))\r\n\t\t\t\t{\r\n\t\t\t\t\t// And it has an existing relation\r\n\t\t\t\t\t$query = $this->db->get_where($relationship_table, array($this->model . '_id' => $this->id), 1, 0);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tif ($query->num_rows() > 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Find and update the other objects existing relation to relate with this object\r\n\t\t\t\t\t\t$this->db->where($this->model . '_id', $this->id);\r\n\t\t\t\t\t\t$this->db->update($relationship_table, $data);\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// Add the relation since one doesn't exist\r\n\t\t\t\t\t\t$this->db->insert($relationship_table, $data);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn TRUE;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Relationship already exists\r\n\t\t\t\treturn TRUE;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn FALSE;\r\n\t}", "public function isModifyRelationship();", "public function assignmentIsRelationship($fieldSlug);", "public function get_relationship() {\r\n $field = $this->get_field_override();\r\n if ($field && isset($field->relationship)) {\r\n switch ($field->relationship) {\r\n case 'one-to-one':\r\n return RELATIONSHIP_ONE_TO_ONE;\r\n case 'one-to-many':\r\n return RELATIONSHIP_ONE_TO_MANY;\r\n case 'many-to-many':\r\n return RELATIONSHIP_MANY_TO_MANY;\r\n }\r\n }\r\n\r\n // Otherwise, infer it from the property on the other side of the connection.\r\n $other_property = $this->get_other_property();\r\n if ($other_property === null)\r\n throw new Exception($this->parent->name . '->' . $this->name . ' does not have a reciprocal reference on ' . $link->other->name . '.');\r\n\r\n if ($this->type == 'list' && $other_property->type == 'list') {\r\n return RELATIONSHIP_MANY_TO_MANY;\r\n }\r\n else if ($this->type == 'list') {\r\n return RELATIONSHIP_ONE_TO_MANY;\r\n }\r\n\r\n return RELATIONSHIP_ONE_TO_ONE;\r\n }", "public function hasReferencedEntityType() {\n return $this->_has(12);\n }", "private static function getsRelationsHasOne(array $relationMap) : ? array {\n $relations = static::relations();\n\n foreach ($relations as $key => $value) {\n if ($value['has'] == 'one') {\n $relationMap[$key] = $value;\n\n $classNamespace = '\\\\' . $value['model'];\n //$childRelations = $classNamespace::relations();\n\n\n\n }\n }\n var_dump($relationMap);die;\n return $relationMap;\n }", "public static function isRelationExists($carerId, $clientId, $relationStatus, $missionStatus = Mission::ACTIVE) {\n\n $sql = \"SELECT mc.id_mission FROM tbl_mission_carers mc \n INNER JOIN tbl_mission m ON m.id = mc.id_mission\n INNER JOIN tbl_booking b ON b.id = m.id_booking\n WHERE mc.status = $relationStatus \n AND mc.id_applying_carer = $carerId \n AND m.status = $missionStatus \n AND b.id_client = $clientId\";\n\n\n $row = Yii::app()->db->createCommand($sql)->queryRow();\n\n if ($row) {\n return true;\n } else {\n return false;\n }\n }", "public function isConcept()\n {\n return ($this->slug == \"concept\");\n }", "public function isReadRelatedResource();", "public function isReplaceRelationship();", "public function getRelation()\n {\n return $this->relation;\n }", "public function get_type() {\n\t\tif( $this->is_many_to_many() ) {\n\t\t\treturn 'many-to-many';\n\t\t} elseif( $this->is_one_to_many() ) {\n\t\t\treturn 'one-to-many';\n\t\t} else {\n\t\t\treturn 'one-to-one';\n\t\t}\n\t}", "protected function relationship() {\n \n $this->message(__METHOD__);\n\n $t = $this->peek();\n if ($t != EPL_T_HAS && $t != EPL_T_COMPOSED_OF) {\n $this->syntax_error(\"'has' or 'composed_of' is expected\");\n return false;\n }\n $this->next();\n\n // fix bug 179: allow date type keywords to be class names\n $this->_lexer->toggleDataTypeTokens();\n\n // get type\n $type = epFieldMap::DT_HAS;\n if ($t == EPL_T_COMPOSED_OF) {\n $type = epFieldMap::DT_COMPOSED_OF;\n }\n\n // create a relationship field map\n $this->map['type'] = $type;\n $this->map['params'] = array();\n\n // one?\n $this->map['params']['is_many'] = false;\n if ($this->peek() == EPL_T_ONE) {\n $this->next();\n } \n // many?\n else if ($this->peek() == EPL_T_MANY) {\n $this->next();\n $this->map['params']['is_many'] = true;\n }\n\n // class\n $this->map['params']['class'] = false;\n if ($this->peek() == EPL_T_IDENTIFIER) {\n $this->next();\n $this->map['params']['class'] = $this->t->value;\n } else {\n $this->syntax_error(\"Class name is expected\");\n return false;\n }\n \n // toggle data types back\n $this->_lexer->toggleDataTypeTokens();\n\n // inverse\n $this->map['params']['inverse'] = false;\n if ($this->peek() == EPL_T_INVERSE) {\n \n // consume inverse\n $this->next();\n \n // get inverse parameters\n $params = $this->params();\n if (!$params || count($params) != 1) {\n $this->syntax_error(\"Invalid parameters for inverse\");\n return false;\n }\n $this->map['params']['inverse'] = $params[0];\n }\n\n return true;\n }", "public function single()\n {\n return count($this->queries) === 1;\n }", "public function isForeignKey()\n {\n return (count($this->getForeignKeys()) > 0);\n }", "public function isSingleResource($contact);", "public function isRecord() {\n return count($this->primaryKeys) === 1;\n }", "protected function default_type() {\n\t\t$src_multiple = false;\n\t\t$trg_multiple = false;\n\t\tforeach($this->joins as $trg_entity => $arr1) {\n\t\t\tforeach($arr1 as $src_entity => $arr2) {\n\t\t\t\t// Check trg cardinality :\n\t\t\t\tif ( ! $trg_multiple) {\n\t\t\t\t\t$fields\t= array_keys($arr2);\n\t\t\t\t\t$pk\t\t= glue::entity($trg_entity)->pk();\n\t\t\t\t\tif (count($pk) !== count($fields) || count(array_diff($fields, $pk)) !== 0)\n\t\t\t\t\t\t$trg_multiple = true;\n\t\t\t\t}\n\t\t\t\n\t\t\t\t// Check src cardinality :\n\t\t\t\tif ( ! $src_multiple) {\n\t\t\t\t\t$fields\t= array_values($arr2);\n\t\t\t\t\t$pk\t\t= glue::entity($src_entity)->pk();\n\t\t\t\t\tif (count($pk) !== count($fields) || count(array_diff($fields, $pk)) !== 0)\n\t\t\t\t\t\t$src_multiple = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Compute relationship type :\n\t\tif ($src_multiple) {\n\t\t\tif ($trg_multiple)\n\t\t\t\t$type = self::MANY_TO_MANY;\n\t\t\telse\n\t\t\t\t$type = self::MANY_TO_ONE;\n\t\t}\n\t\telse {\n\t\t\tif ($trg_multiple)\n\t\t\t\t$type = self::ONE_TO_MANY;\n\t\t\telse\n\t\t\t\t$type = self::ONE_TO_ONE;\n\t\t}\n\n\t\treturn $type;\n\t}", "protected function shouldShowRelationFor(string $column): bool\n {\n return false;\n }", "public function hasParent() {\n\t\treturn $this->parent()->count() == 1;\n\t}", "protected function _hasRelationGateway($name) {\r\n \treturn isset($this->_dependenciesMap[$name]['relationGatewayClass']);\r\n }", "public function isSelf()\n {\n return $this->auth->isAssociate() && $this->auth->info('id') == $this->associate->getId();\n }" ]
[ "0.74016815", "0.68106323", "0.680415", "0.66039115", "0.6597948", "0.65817165", "0.65535295", "0.6481432", "0.63150096", "0.63116264", "0.6306999", "0.61576355", "0.6132554", "0.61204356", "0.6109598", "0.6106486", "0.6071716", "0.60665417", "0.605936", "0.6057006", "0.6056121", "0.60450053", "0.60208744", "0.599395", "0.59739006", "0.59726703", "0.59629494", "0.5876674", "0.57966435", "0.5783346", "0.57659364", "0.5743757", "0.57432276", "0.57428914", "0.5739971", "0.5739971", "0.57370263", "0.57264364", "0.5725929", "0.5715034", "0.56834304", "0.56687456", "0.56675726", "0.5656152", "0.56485903", "0.5623671", "0.56236535", "0.5609953", "0.56085193", "0.55591685", "0.5540522", "0.5525061", "0.55144906", "0.5475911", "0.54629517", "0.5455905", "0.54412943", "0.5439992", "0.5425789", "0.54206514", "0.5418706", "0.5410354", "0.53951776", "0.538512", "0.53730947", "0.5370458", "0.53684527", "0.53665924", "0.535382", "0.52952075", "0.52883255", "0.5259769", "0.52539855", "0.524303", "0.52223957", "0.5219879", "0.5217828", "0.52152485", "0.5214909", "0.5189028", "0.51852506", "0.518417", "0.5182734", "0.5177399", "0.5169257", "0.516559", "0.5161964", "0.5155186", "0.5136354", "0.51356065", "0.51318485", "0.5129262", "0.5128731", "0.5107614", "0.5102225", "0.5101183", "0.50987995", "0.5096851", "0.50955015", "0.5071018" ]
0.68577045
1
Creates a new Printer instance.
public function __construct(/*private readonly */DefaultPrinter $printer) { $this->printer = $printer; // .. }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getPrinter();", "public static function USBPrint($printerIp)\n {\n// $printer = new Printer($connector);\n $connector = new NetworkPrintConnector($printerIp, 9100);\n $printer = new Printer($connector);\n return $printer;\n }", "public function __construct(string $printer) {\n parent::__construct();\n $this->printer = $printer;\n }", "protected function create_pdf_object() {\n\n // Default orientation is Landescape.\n $orientation = 'L';\n\n if ($this->get_instance()->height > $this->get_instance()->width) {\n $orientation = 'P';\n }\n\n // Remove commas to avoid a bug in TCPDF where a string containing a commas will result in two strings.\n $keywords = get_string('keywords', 'simplecertificate') . ',' . format_string($this->get_instance()->coursename, true);\n $keywords = str_replace(\",\", \" \", $keywords); // Replace commas with spaces.\n $keywords = str_replace(\" \", \" \", $keywords); // Replace two spaces with one.\n\n $pdf = new pdf($orientation, 'mm', array($this->get_instance()->width, $this->get_instance()->height), true, 'UTF-8');\n $pdf->SetTitle($this->get_instance()->name);\n $pdf->SetSubject($this->get_instance()->name . ' - ' . $this->get_instance()->coursename);\n $pdf->SetKeywords($keywords);\n $pdf->setPrintHeader(false);\n $pdf->setPrintFooter(false);\n $pdf->SetAutoPageBreak(false, 0);\n $pdf->setFontSubsetting(true);\n $pdf->SetMargins(0, 0, 0, true);\n\n return $pdf;\n }", "public function setPrinter(Printer $printer = null);", "public function get_print_instance() {\n\n\t\treturn $this->print;\n\t}", "function printer_create_dc($printer_handle)\n{\n}", "public function store(CreatePrinterAPIRequest $request)\n {\n $input = $request->all();\n\n $printer = $this->printerRepository->create($input);\n\n return $this->sendResponse($printer->toArray(), 'Printer saved successfully');\n }", "public function _construct()\n {\n $this->_init('orderprint/orderprint', 'orderprint_id');\n }", "public function actionCreate_printers()\n {\n $model = new Printers();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['/printers/view', 'id' => $model->id_printer]);\n } else {\n return $this->render('/printers/create', [\n 'model' => $model,\n ]);\n }\n }", "public function actionCreate_printers()\n {\n $model = new Printers();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['/printers/view', 'id' => $model->id_printer]);\n } else {\n return $this->render('/printers/create', [\n 'model' => $model,\n ]);\n }\n }", "public static function setPrinter($printer)\n {\n //buscar os dados referente a impressora na base de dados\n //estabelecer qual interface usar (CUPS, REDE, QZ, FILE, etc.)\n //estabelecer qual template usar:\n // Zebra ZPL2,\n // Zebra/Eltron ELP2,\n // Argox PPLA/PPLB,\n // Intermec IPL,\n // DataMax DPL, etc.)\n //carrega classe de acesso a base de dados\n $dbase = new DBase();\n //carrega impressoras\n self::$printer = $dbase->getPrinter($printer);\n \n }", "public static function print(){\r\n \t$printerName = env('PRINTER', 'HP_DeskJet_5820_series');\r\n\r\n \t//sample file\r\n \t$fileName = 'Voucher-4-1.pdf';\r\n \t$filePath = storage_path('app/public/print/' . $fileName);\r\n \t\r\n \t$response = self::runShellCommand('lpr -P ' . $printerName . ' ' . $filePath);\r\n\r\n \treturn $response;\r\n }", "private function generate()\n\t{\n\t\t$printer = require_once __DIR__ . '/Printer.php';\n\t\t$orders = $this->get_waiting_orders();\n\t\t\n\t\t$printer->setup($this);\n\n\t\t/*foreach ($orders as $order) {\n\t\t\t$printer->add($order);\n\t\t}*/\n\n\t\t$printer->output();\n\t}", "public function getPrinter()\n {\n return $this -> printer;\n }", "public function create() {\n $this->createPersonHeader();\n $this->createRecipientHeader();\n $this->createBody();\n $this->createText();\n $this->createFooter();\n }", "public function __construct(DeletePrinterResponder $responder)\n {\n $this->responder = $responder;\n }", "public function getPrinter()\n {\n return $this->printer;\n }", "public static function create(string $data=null): Phpdf {\n if (!$data) {\n $data = pdfStub();\n }\n $file = static::createTempFile();\n fwrite($file, $data);\n return new self($file);\n }", "public function create(array $options = array())\n {\n $pdf = $this->reflClass->newInstanceArgs($this->getConstructorOptions($options));\n\n foreach ($options as $option => $arguments) {\n if (is_callable(array($pdf, 'set' . $option))) {\n if (!is_array($arguments)) {\n if (null === $arguments) {\n $arguments = array();\n } else {\n $arguments = array($arguments);\n }\n }\n\n call_user_func_array(array($pdf, 'set' . $option), $arguments);\n }\n }\n\n return $pdf;\n }", "public function create()\n {\n echo 'create a apple pie'.PHP_EOL;\n }", "public function __construct($ticket, $printer, $driver = null)\n {\n $this->ticket = $ticket;\n $this->printer = $printer;\n $this->driver = $driver;\n }", "function connect($ip_address, $port)\n {\n //$this->connector = new FilePrintConnector(\"/dev/usb/lp0\");\n //$this->connector = new WindowsPrintConnector(\"smb://192.168.0.6/POS-80\");\n //$this->connector = new CupsPrintConnector(\"POS-80\");\n //$this->printer = new Printer($this->connector);\n /* Close printer */\n\n /*$this->connector = new FilePrintConnector(\"php://stdout\");\n $this->printer = new Printer($this->connector);\n */\n\n try {\n //$this->connector = new CupsPrintConnector(\"POS-80C\");\n $this->connector = new WindowsPrintConnector(\"POSS-80\");\n \n /* Print a \"Hello world\" receipt\" */\n $this->printer = new Printer($this->connector);\n //$this->printer -> text(\"TE AMO MCUHO MI VIDA..!\\n\");\n //$this->printer -> cut();\n \n /* Close printer */\n //$this->printer -> close();\n } catch (Exception $e) {\n echo \"Couldn't print to this printer: \" . $e -> getMessage() . \"\\n\";\n }\n }", "private function createApiMock(array $responses = [], $settings = null): PdfPrinter\n {\n $mock = new MockHandler(array_map(function ($item) {\n return $item->get();\n }, $responses));\n $handler = HandlerStack::create($mock);\n\n $pdfPrinter = new PdfPrinter($settings === null ? $this->pdfPrinterSettings : $settings, new Client(['handler' => $handler]));\n\n return $pdfPrinter;\n }", "public static function getTerminal()\n {\n return new Terminal(\n self::getRepository(),\n self::getCart(),\n self::getCartTotal()\n );\n }", "public function __construct()\n {\n parent::__construct('P', 'mm', $this->paperFormat);\n\n $this->incrementY = 6;\n $this->SetMargins(0, 0);\n\n $this->SetFont('Times', '', 14);\n $this->SetAutoPageBreak(false);\n $this->AddPage();\n }", "public function model()\r\n {\r\n return 'App\\Printer';\r\n }", "public function createPrint(\n $username,\n $title,\n $description,\n $fileOriginalName,\n $fileByteSize,\n $fileMimeType\n ): ThreeDPrint;", "public function pc()\n {\n return new Mac();\n }", "public function create() {\n\t \n }", "public static function create() {}", "public static function create() {}", "public static function create() {}", "public static function createInstance()\n {\n return new GridPrintEventManager('ISerializable');\n }", "public function Create() {\n parent::Create();\n\n\t\t\t$this->RegisterPropertyString(\"Password\", \"\");\n\n\t\t\t$this->RegisterPropertyString(\n\t\t\t\t'RadioStations', '[{\"position\":1,\"station\":\"NDR2 Niedersachsen\",\"station_url\":\"http://172.27.2.205:9981/stream/channel/800c150e9a6b16078a4a3b3b5aee0672\"},\n\t\t\t\t{\"position\":2,\"station\":\"MDR Jump\",\"station_url\":\"http://172.27.2.205:9981/stream/channel/0888328132708be0905731457bba8ae0\"},\n\t\t\t\t{\"position\":3,\"station\":\"Inselradio Mallorca\",\"station_url\":\"http://172.27.2.205:9981/stream/channel/14f799071150331b9a7994ca8c61f8c7\"}]'\n );\n\n $this->RegisterPropertyBoolean(\"HideVolume\",false);\n $this->RegisterPropertyBoolean(\"HideTitle\",false);\n $this->RegisterPropertyBoolean(\"HideTimeElapsed\",false);\n\n\t\t\t$this->RegisterTimer(\"KeepAliveTimer\", 1000, 'MPDP_KeepAlive($_IPS[\\'TARGET\\']);');\n\t\t}", "public function create() {\n\t\tupdate_option( 'woocommerce_calc_taxes', 'yes' );\n\t\tupdate_option( 'woocommerce_prices_include_tax', 'yes' );\n\n\t\t// Create tax rates.\n\t\t$this->tax_rate_ids[] = $this->create_tax_rate( '25' );\n\t\t$this->tax_rate_ids[] = $this->create_tax_rate( '12' );\n\t\t$this->tax_rate_ids[] = $this->create_tax_rate( '6' );\n\t\t$this->product = ( new Krokedil_Simple_Product() )->create();\n\t}", "public function printToTerminal()\n {\n echo \"Report title: {$this->getTitle()}\\n\";\n echo \"Report generated at: {$this->getGenerationTimeStamp()}\\n\";\n echo \"Report description: {$this->getReportDescription()}\\n\";\n echo \"Report parameters:\\n{$this->getParameterString()}\\n\\n\";\n echo \"Report result:\\n{$this->getReportResultString()}\\n\";\n }", "public function create()\n {\n //return view('layouts.print orders.');\n }", "public function store(Request $request)\n {\n $request->validate([\n 'name' => \"required\",\n 'description' => \"required\",\n ]);\n\n printers::create($request->only([\n 'name',\n 'description'\n ]));\n\n return back()->withSuccess(\"Printer Added Successfully\");\n }", "public function create()\n {}", "function wcpdf_get_pdf_maker( $html, $settings = array() ) {\n\tif ( ! class_exists( '\\\\WPO\\\\WC\\\\PDF_Invoices\\\\PDF_Maker' ) ) {\n\t\tinclude_once( WPO_WCPDF()->plugin_path() . '/includes/class-wcpdf-pdf-maker.php' );\n\t}\n\t$class = apply_filters( 'wpo_wcpdf_pdf_maker', '\\\\WPO\\\\WC\\\\PDF_Invoices\\\\PDF_Maker' );\n\treturn new $class( $html, $settings );\n}", "public function setPrinter(TSPLPrinter $printer = null)\n {\n $this -> printer = $printer;\n }", "public function create()\n\t {\n\t //\n\t }", "public function new()\n\t{\n\t\t//\n\t}", "public function new()\n\t{\n\t\t//\n\t}", "public function create() {\n\t\t\t//\n\t\t}", "public static function createInstance()\n {\n return new TabPage('ISerializable', 'ISerializable');\n }", "public function show(JasaPrint $JasaPrint): JasaPrintResource\n {\n return new JasaPrintResource($JasaPrint);\n }", "public function create(){}", "public function create()\n {\n //TODO\n }", "public static function create() {\n\t\treturn new self();\n\t}", "public function create()\n {\n $output = new \\Symfony\\Component\\Console\\Output\\ConsoleOutput();\n $output->writeln(\"<info>Controller Create</info>\");\n }", "function GetPrinterName() { return 'natbib'; }", "public function main(){\n $pdf = new PDF();\n $pdf->AliasNbPages();\n $pdf->AddPage();\n $pdf->SetFont('Times','',12);\n for($i=1;$i<=40;$i++){\n $pdf->Cell(0,10,'Printing line number '.$i,0,1);\n }\n\n // First page\n $html = 'You can now<np> easily print text mixing different styles: <b>bold</b>, <i>italic</i>,\n <u>underlined</u>, or <b><i><u>all at once</u></i></b>!<br><br>You can also insert links on\n text, such as <a href=\"http://www.fpdf.org\">www.fpdf.org</a>, or on an image: click on the logo.';\n\n $pdf->AddPage();\n $pdf->SetFont('Arial','',20);\n // $pdf->Write(5,\"To find out what's new in this tutorial, click \");\n // $pdf->SetFont('','U');\n // $link = $pdf->AddLink();\n // $pdf->Write(5,'here',$link);\n // $pdf->SetFont('');\n // // Second page\n // $pdf->AddPage();\n // $pdf->SetLink($link);\n // $pdf->Image('logo.png',10,12,30,0,'','http://www.fpdf.org');\n $pdf->SetLeftMargin(15);\n $pdf->SetFontSize(14);\n $pdf->WriteHTML($html);\n\n $pdf->Output();\n\n }", "public function print(Printer $printer): string\n {\n return $this->withLocale($this->locale, function () use ($printer) {\n Container::getInstance()->call([$this, 'build']);\n\n return $printer->print($this->view, $this->buildViewData());\n });\n\n }", "public function createInstance($processor);", "public function create() {\r\n }", "public function createInstance($data)\n {\n $data['paper_id'] = $this->id;\n return PaperInstance::create($data);\n }", "public function createPage()\n {\n $this->currentPage++;\n $this->currentIndex++;\n $this->resetProps();\n /* Create page */\n if ($this->landscape) {\n // A4 format in Landscape orientation\n $this->pdf->begin_page_ext(0, 0, \"width=a4.height height=a4.width\");\n } else {\n // A4 format in Portrait orientation3.\n $this->pdf->begin_page_ext(0, 0, \"width=a4.width height=a4.height\");\n }\n empty($this->createPageTrigger) || call_user_func_array($this->createPageTrigger, $this->createPageTriggerArgs);\n }", "public function create()\n {\n //\n return 'This is where my charge log form will go.';\n }", "public function create() {}", "public function __construct(NodeTraverser $traverser = null, BracketingPrinter $printer = null)\n {\n $this->traverser = $traverser ?: new NodeTraverser;\n $this->printer = $printer ?: new BracketingPrinter;\n }", "public function create()\n\t\t{\n\t\t\t//\n\t\t}", "public function create()\n\t\t{\n\t\t\t//\n\t\t}", "public function create()\r\n\t{\r\n\t\t//\r\n\t}", "function AutoPrintToPrinter() {\n $printer = \"Microsoft Print to PDF\";\n $script = \"var pp = getPrintParams();\";\n //if ($dialog)\n // $script .= \"pp.interactive = pp.constants.interactionLevel.full;\";\n //else\n $script .= \"pp.interactive = pp.constants.interactionLevel.automatic;\";\n $printer = str_replace('\\\\', '\\\\\\\\', $printer);\n //$script .= \"pp.interactive = pp.constants.interactionLevel.full;\";\n $script .= \"pp.printerName = '$printer'\";\n $script .= \"print(pp);\";\n $this->IncludeJS($script);\n }", "public static function create(): StringBuffer\n {\n return new self();\n }", "public function createDiagnosticPdf() {\n\n $pdf = new DiagnosticPDF($this);\n\n $pdf->AliasNbPages();\n $pdf->AddPage();\n $pdf->SetFont('Times','',12);\n\n // Add a title for the section\n $pdf->Cell(60,15,utf8_decode('Server summary'),0,0,'L');\n $pdf->Ln(15);\n // Add php version\n $pdf->addPHPVersion();\n // Add server software\n $pdf->addServerApi();\n // Add addEcommerceInfo and plugin info\n $pdf->addEcommerceInfo();\n // Add merchant info\n $pdf->addMerchantInfo();\n //Add extension info\n $pdf->addExtensionsInfo();\n $pdf->addLogs();\n\n //Some tricks for FPDF to work with joomla.\n ob_start(); //needed to prevent the error(FPDF error: Some data has already been output, can't send PDF file)\n $pdf->Output();\n die(); //needed to break process render of joomla and download the file pdf correctly\n }", "public function create() {\n\t\t//\n\t}", "public function create() {\n\t\t//\n\t}", "public function create() {\n\t\t//\n\t}", "public function create() {\n\t\t//\n\t}", "public function create() {\n\t\t//\n\t}", "public function create() {\n\t\t//\n\t}", "public function create() {\n\t\t//\n\t}", "public function create() {\n\t\t//\n\t}", "public function create() {\n\t\t//\n\t}", "public function create() {\n\t\t//\n\t}", "public function create() {\n\t\t//\n\t}", "public function create() {\n\t\t//\n\t}", "public static function factory()\n\t\t{\n\t\t\t// crea la nuova istanza della classe Mail e la ritorna\n\t\t\treturn new Mailer();\n\t\t}", "public function create() {\n $class_name = $this->getOption('className');\n return new $class_name();\n }", "public static function create($text = '')\n {\n return new static($text);\n }", "public function create()\n\t{\n\t\t\n\t\t//\n\t}", "public static function create()\n\t\t{\n\t\t\treturn new self();\n\t\t}", "abstract protected function handlePrinterData(string $info, string $default_printer): Printer;", "public function create() {\n\n\t\t\n\t}", "public function create() {\n \n }", "public function create() {\n \n }", "public function create() {\n }", "public function create() {\n }", "public function PPPClient()\n {\n return new PPPClient($this->talker);\n }", "public function __construct()\n\t{\n\t\t//Get PHPExcel library files\n\t\trequire_once(MW_CONST_STR_DIR_INSTALL.'libraries/phpexcel/classes/PHPExcel.php');\n\n\t\t// create new CSV document\n\t\tglobal $CMD;\n\n\t\t$this->Obj_Doc = new PHPExcel();\n\t\t$this->Obj_Doc->setActiveSheetIndex(0);\n\t\t$this->Obj_Doc->getActiveSheet()->getDefaultStyle()->getFont()->setName('Tahoma');\n\n\t\treturn;\n\t}", "public function create();", "public function create();", "public function create();", "public function create();", "public function create();", "public function create();", "public function create();" ]
[ "0.62952435", "0.6098094", "0.5961678", "0.5875306", "0.58268577", "0.575805", "0.5686378", "0.5568351", "0.55188984", "0.54504544", "0.54504544", "0.53146243", "0.52919644", "0.5236908", "0.5216187", "0.5202395", "0.51797396", "0.5149941", "0.50577265", "0.49893075", "0.49870047", "0.4966197", "0.49465126", "0.4901149", "0.4883797", "0.4878345", "0.486224", "0.48390007", "0.4830686", "0.48228243", "0.48135108", "0.48135108", "0.48135108", "0.48022762", "0.47780007", "0.47640616", "0.4755555", "0.47443467", "0.47295195", "0.47210225", "0.47163272", "0.47115532", "0.47108498", "0.47035256", "0.47035256", "0.47016412", "0.46879402", "0.4686703", "0.46774057", "0.46713376", "0.46659818", "0.46654037", "0.46605048", "0.46597165", "0.4648665", "0.46485007", "0.46415225", "0.46372938", "0.46355447", "0.46325433", "0.46291032", "0.46287605", "0.46227488", "0.46227488", "0.4622258", "0.4622085", "0.461999", "0.46179476", "0.46169275", "0.46169275", "0.46169275", "0.46169275", "0.46169275", "0.46169275", "0.46169275", "0.46169275", "0.46169275", "0.46169275", "0.46169275", "0.46169275", "0.46100518", "0.46035188", "0.46020627", "0.45993605", "0.45978191", "0.45898294", "0.45853862", "0.45841032", "0.45841032", "0.45821634", "0.45821634", "0.45752022", "0.45646283", "0.45628107", "0.45628107", "0.45628107", "0.45628107", "0.45628107", "0.45628107", "0.45628107" ]
0.62267506
1
Calls the original method, but reports any errors to the reporter.
public function __call(/*string */$name, array $arguments)/*: mixed*/ { $name = backport_type_check('string', $name); try { return $this->printer->$name(...$arguments); } catch (\Exception $throwable) { } catch (\Error $throwable) { } catch (Throwable $throwable) { } if (isset($throwable)) { $this->printer->report($throwable); } exit(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function report()\n {\n $this->logException();\n }", "function invoke($method) {\r\n set_error_handler('simpleTestErrorHandler');\r\n parent::invoke($method);\r\n $queue = &SimpleErrorQueue::instance();\r\n while (list($severity, $message, $file, $line, $globals) = $queue->extract()) {\r\n $test_case = &$this->getTestCase();\r\n $test_case->error($severity, $message, $file, $line, $globals);\r\n }\r\n restore_error_handler();\r\n }", "public function report()\n {\n // TODO: Implement report() method.\n }", "public function report()\n {\n }", "private function restoreErrorReporting()\n {\n error_reporting($this->originalErrorReporting);\n }", "public function reportAction() {\n parent::reportAction();\n }", "public function report()\n {\n Log::error($this); // ok\n\n return null;\n }", "function __reset_error() {\n\n $this->__set_error();\n\n}", "function __call($methodName, $args)\n {\n return $this->_redirect('/parking/error');\n $this->render();\n }", "public function resetErrors() {}", "public function error()\n {\n $this->appendLog(\n 'error',\n \\func_get_args(),\n $this->internal->getErrorCaller()\n );\n }", "public function testRespondsToParentCall() {\n\t\terror_reporting(($backup = error_reporting()) & ~E_USER_DEPRECATED);\n\n\t\t$this->assertTrue(Locale::respondsTo('invokeMethod'));\n\t\t$this->assertFalse(Locale::respondsTo('fooBarBaz'));\n\n\t\terror_reporting($backup);\n\t}", "public function report()\n {\n \\Log::debug('Query failure');\n }", "protected static function initializeBasicErrorReporting() {}", "public function reportProblemLogAndExit(){\nself::encodeAndOutputMessage($this->message);\n$this->logMessage(self::$normalErrorLog);\nexit;\n}", "protected function executeActionWithErrorHandling() {\n \n }", "protected function errorAction() {}", "public function report(\\Throwable $e): void\n {\n parent::report($e instanceof ApiException ? $e->toReport() : $e);\n }", "function reset_errors()\n {\n }", "public abstract function onFail();", "public function failed()\n {\n // Do nothing\n }", "public function beforeOutputError() {\n }", "function &act() {\n trigger_error($this->error, $this->severity);\n $null = null;\n return $null;\n }", "public function error()\n\t{\n\t}", "public function report (Exception $exception) {\n parent::report ($exception);\n }", "abstract public function error();", "private function __clone()\n {\n // @codeCoverageIgnoreStart\n throw new BadMethodCallException();\n // @codeCoverageIgnoreEnd\n }", "private function __clone()\n {\n // @codeCoverageIgnoreStart\n throw new BadMethodCallException();\n // @codeCoverageIgnoreEnd\n }", "public function testRuleAppliesTwiceToClassWithNotImportedDependencies()\n {\n $rule = $this->getRule();\n $rule->setReport($this->getReportMock(2));\n $rule->apply($this->getMethod());\n }", "protected function tearDown(): void\n {\n // ensure error_reporting is set back to correct value\n error_reporting($this->currentErrorReporting);\n }", "public function markAsFailed();", "public function validate(): void\n {\n $errors = $this->getErrors();\n $this->throwExceptionIfErrors($errors);\n }", "function __call($methodName, $args)\n {\n return $this->_redirect($this->_baseUrl . '/mobile/error/notfound');\n }", "public function report()\n {\n if (null === $this->auth) {\n throw new Exception('Impossible to call method if not logged');\n }\n\n $params = array_merge($this->auth, func_get_args());\n\n return $this->internalCall('report', 'report', $params);\n }", "public function report()\n {\n Log::debug('Exotel Sms Exception');\n }", "public function triggerError() {\n $this->_errors = true;\n }", "public function report(Exception $e) : void\n {\n parent::report($e);\n }", "public function error() {\n // The tests cover errors, so there will be plenty to sift through\n // $msg = func_get_arg(0);\n // $err = 'API ERROR: ' . $msg . PHP_EOL;\n\n // $objs = func_get_args();\n // array_splice($objs, 0, 1);\n\n // ob_start();\n // foreach($objs as $obj) {\n // var_dump($obj);\n // }\n // $strings = ob_get_clean();\n\n // file_put_contents('tests.log', [$err, $strings], FILE_APPEND);\n }", "private function error_report($msg){\n die($msg);\n }", "protected function _report()\n {\n // report summary\n $done = $this->_info['done'];\n $plan = $this->_info['plan'];\n $time = $this->_info['time'];\n \n $this->_log(\"$done/$plan tests, $time seconds\");\n \n $tmp = array();\n $show = array('fail', 'todo', 'skip', 'pass');\n foreach ($show as $type) {\n $count = count($this->_info[$type]);\n $tmp[] = \"$count $type\";\n }\n $this->_log(implode(', ', $tmp));\n }", "function dummyErrorFunc() { }", "public function report(Exception $e)\n {\n parent::report($e);\n }", "public function report(Exception $e)\n {\n parent::report($e);\n }", "public function report(Exception $e)\n {\n parent::report($e);\n }", "public function report(Exception $e)\n {\n parent::report($e);\n }", "public function report(Exception $e)\n {\n parent::report($e);\n }", "public function report(Exception $e)\n {\n parent::report($e);\n }", "public function report(Exception $e)\n {\n parent::report($e);\n }", "public function report(Exception $e)\n {\n parent::report($e);\n }", "public function report(Exception $e)\n {\n parent::report($e);\n }", "public function report(Exception $e)\n {\n parent::report($e);\n }", "protected function renderAsError() {}", "protected function restoreErrorReporting() {\n error_reporting(~E_NOTICE);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "public function report(Throwable $exception)\n {\n parent::report($exception);\n }", "protected function Run_Failure() {\n\t\tif (!empty($this->failure)) \n\t\t{\n\t\t\tcall_user_func_array($this->failure['function'], $this->failure['parameters']);\n\t\t}\n\t}", "function __construct(){\n\t\t$this->resetErrorList();\n\t}", "public function runBare()\n {\n $e = null;\n ha::resetCount();\n\n try {\n parent::runBare();\n } catch (\\Exception $e) { }\n\n $this->addToAssertionCount(ha::getCount());\n\n if ($e !== null) {\n throw $e;\n }\n }", "public function protectedMethod()\n {\n $this->getInitialContext()->getSystemLogger()->info(\n sprintf('%s has successfully been invoked', __METHOD__)\n );\n }", "public function asIssue()\n\t{\n\t\t$this->severity = 'error';\n\t\t$this->cannotClose();\n\t\treturn $this;\n\t}", "function __construct()\n {\n error_reporting(0);\n }", "public function perform() {\n $config = $this->config('system.logging');\n $display = $config->get('error_level');\n\n if ($display != 'hide') {\n return $this->fail(NULL, [\n 'issues' => [\n 'errors_display' => [\n '@issue_title' => 'Errors are displayed!',\n ],\n ],\n ]);\n }\n\n return $this->success();\n }", "public function failed();", "function SimpleErrorTrappingInvoker(&$invoker) {\r\n $this->SimpleInvokerDecorator($invoker);\r\n }", "public function report(Throwable $exception): void\n {\n parent::report($exception);\n }", "public function report(Exception $e)\n {\n Log::error($e);\n\n parent::report($e);\n }", "function broken() { }", "public function runFailed();", "public function diagnose() {}", "public function __construct() {\n parent::__construct(new ReportProblemInfo());\n }", "public function runSilently()\n {\n $this->verbose = false;\n\n return $this->run(null);\n }", "public function report(Exception $exception)\r\n {\r\n parent::report($exception);\r\n }", "private function _handleError($result, $method)\n {\n if ($this->errorCode() != '00000')\n throw new \\Exception(\"Error: \" . implode(',', $this->errorInfo()));\n \n if ($result === false) \n {\n echo $this->errorInfo();\n $error = $method . \" did not execute properly\";\n throw new \\Exception($error);\n }\n }", "public function report(Exception $exception)\n {\n parent::report($exception);\n }", "public function report(Exception $exception)\n {\n parent::report($exception);\n }", "public function report(Exception $exception)\n {\n parent::report($exception);\n }", "public function report(Exception $exception)\n {\n parent::report($exception);\n }", "public function report(Exception $exception)\n {\n parent::report($exception);\n }", "public function report(Exception $exception)\n {\n parent::report($exception);\n }", "public function report(Exception $exception)\n {\n parent::report($exception);\n }", "public function report(Exception $exception)\n {\n parent::report($exception);\n }", "public function report(Exception $exception)\n {\n parent::report($exception);\n }", "public function report(Exception $exception)\n {\n parent::report($exception);\n }" ]
[ "0.6064449", "0.6047144", "0.5817738", "0.5807725", "0.55490655", "0.5491397", "0.5409428", "0.53674114", "0.53574836", "0.5356493", "0.53558916", "0.53325206", "0.53306293", "0.5315821", "0.5284208", "0.52838075", "0.52406096", "0.51441914", "0.5103054", "0.50586087", "0.50578046", "0.5044246", "0.5043559", "0.50409114", "0.50168043", "0.50128037", "0.50011325", "0.50011325", "0.4986931", "0.49815083", "0.49730083", "0.4969094", "0.49684766", "0.49345237", "0.49206644", "0.49187738", "0.49182284", "0.49004915", "0.48922774", "0.48903468", "0.48871642", "0.4882428", "0.4882428", "0.4882428", "0.4882428", "0.4882428", "0.4882428", "0.4882428", "0.4882428", "0.4882428", "0.4882428", "0.48716658", "0.48606974", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.48392305", "0.4830094", "0.48277184", "0.48232055", "0.48196226", "0.4819027", "0.48102182", "0.4800013", "0.47986794", "0.47984704", "0.47959545", "0.47801214", "0.47702107", "0.47676247", "0.4749131", "0.4748781", "0.47470433", "0.4741298", "0.47400224", "0.47394347", "0.47394347", "0.47394347", "0.47394347", "0.47394347", "0.47394347", "0.47394347", "0.47394347", "0.47394347", "0.47394347" ]
0.0
-1
Run the database seeds.
public function run() { // DB::table('users')->insert([ [ 'name' => 'user', 'email' => '[email protected]', 'password' => Hash::make('12345678'), 'remember_token' => Str::random(10), 'created_at' => time(), 'updated_at' => time(), ], [ 'name' => 'user2', 'email' => '[email protected]', 'password' => Hash::make('12345678'), 'remember_token' => Str::random(10), 'created_at' => time(), 'updated_at' => time(), ], [ 'name' => 'user3', 'email' => '[email protected]', 'password' => Hash::make('12345678'), 'remember_token' => Str::random(10), 'created_at' => time(), 'updated_at' => time(), ], [ 'name' => 'user4', 'email' => '[email protected]', 'password' => Hash::make('12345678'), 'remember_token' => Str::random(10), 'created_at' => time(), 'updated_at' => time(), ], [ 'name' => 'user5', 'email' => '[email protected]', 'password' => Hash::make('12345678'), 'remember_token' => Str::random(10), 'created_at' => time(), 'updated_at' => time(), ], [ 'name' => 'user6', 'email' => '[email protected]', 'password' => Hash::make('12345678'), 'remember_token' => Str::random(10), 'created_at' => time(), 'updated_at' => time(), ], [ 'name' => 'user7', 'email' => '[email protected]', 'password' => Hash::make('12345678'), 'remember_token' => Str::random(10), 'created_at' => time(), 'updated_at' => time(), ], [ 'name' => 'user8', 'email' => '[email protected]', 'password' => Hash::make('12345678'), 'remember_token' => Str::random(10), 'created_at' => time(), 'updated_at' => time(), ], [ 'name' => 'user9', 'email' => '[email protected]', 'password' => Hash::make('12345678'), 'remember_token' => Str::random(10), 'created_at' => time(), 'updated_at' => time(), ], ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function run()\n {\n // $this->call(UserTableSeeder::class);\n // $this->call(PostTableSeeder::class);\n // $this->call(TagTableSeeder::class);\n // $this->call(PostTagTableSeeder::class);\n\n /*AB - use faker to populate table see file ModelFactory.php */\n factory(App\\Editeur::class, 40) ->create();\n factory(App\\Auteur::class, 40) ->create();\n factory(App\\Livre::class, 80) ->create();\n\n for ($i = 1; $i < 41; $i++) {\n $number = rand(2, 8);\n for ($j = 1; $j <= $number; $j++) {\n DB::table('auteur_livre')->insert([\n 'livre_id' => rand(1, 40),\n 'auteur_id' => $i\n ]);\n }\n }\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n // Let's truncate our existing records to start from scratch.\n Assignation::truncate();\n\n $faker = \\Faker\\Factory::create();\n \n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 40; $i++) {\n Assignation::create([\n 'ad_id' => $faker->numberBetween(1,20),\n 'buyer_id' => $faker->numberBetween(1,6),\n 'seller_id' => $faker->numberBetween(6,11),\n 'state' => NULL,\n ]);\n }\n\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n \t$faker = Faker::create();\n\n \tfor($i=0; $i<20; $i++) {\n \t\t$post = new Post;\n \t\t$post->title = $faker->sentence();\n \t\t$post->body = $faker->paragraph();\n \t\t$post->category_id = rand(1, 5);\n \t\t$post->save();\n \t}\n\n \t$list = ['General', 'Technology', 'News', 'Internet', 'Mobile'];\n \tforeach($list as $name) {\n \t\t$category = new Category;\n \t\t$category->name = $name;\n \t\t$category->save();\n \t}\n\n \tfor($i=0; $i<20; $i++) {\n \t\t$comment = new Comment;\n \t\t$comment->comment = $faker->paragraph();\n \t\t$comment->post_id = rand(1,20);\n \t\t$comment->save();\n \t}\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n $this->call(RoleTableSeeder::class);\n $this->call(UserTableSeeder::class);\n \n factory('App\\Cat', 5)->create();\n $tags = factory('App\\Tag', 8)->create();\n\n factory(Post::class, 15)->create()->each(function($post) use ($tags){\n $post->comments()->save(factory(Comment::class)->make());\n $post->tags()->attach( $tags->random(mt_rand(1,4))->pluck('id')->toArray() );\n });\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::table('post')->insert(\n [\n 'title' => 'Test Post1',\n 'desc' => str_random(100).\" post1\",\n 'alias' => 'test1',\n 'keywords' => 'test1',\n ]\n );\n DB::table('post')->insert(\n [\n 'title' => 'Test Post2',\n 'desc' => str_random(100).\" post2\",\n 'alias' => 'test2',\n 'keywords' => 'test2',\n ]\n );\n DB::table('post')->insert(\n [\n 'title' => 'Test Post3',\n 'desc' => str_random(100).\" post3\",\n 'alias' => 'test3',\n 'keywords' => 'test3',\n ]\n );\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n \t$faker = Factory::create();\n \t\n \tforeach ($this->departments as $key => $department) {\n \t\tDepartment::create([\n \t\t\t'name' => $department\n \t\t]);\n \t}\n \tforeach ($this->collections as $key => $collection) {\n \t\tCollection::create([\n \t\t\t'name' => $collection\n \t\t]);\n \t}\n \t\n \t\n \tfor ($i=0; $i < 40; $i++) {\n \t\tUser::create([\n \t\t\t'name' \t=>\t$faker->name,\n \t\t\t'email' \t=>\t$faker->email,\n \t\t\t'password' \t=>\tbcrypt('123456'),\n \t\t]);\n \t} \n \t\n \t\n \tforeach ($this->departments as $key => $department) {\n \t\t//echo ($key + 1) . PHP_EOL;\n \t\t\n \t\tfor ($i=0; $i < 10; $i++) { \n \t\t\techo $faker->name . PHP_EOL;\n\n \t\t\tArt::create([\n \t\t\t\t'name'\t\t\t=> $faker->sentence(2),\n \t\t\t\t'img'\t\t\t=> $this->filenames[$i],\n \t\t\t\t'medium'\t\t=> 'canvas',\n \t\t\t\t'department_id'\t=> $key + 1,\n \t\t\t\t'user_id'\t\t=> $this->userIndex,\n \t\t\t\t'dimension'\t\t=> '18.0 x 24.0',\n\t\t\t\t]);\n \t\t\t\t\n \t\t\t\t$this->userIndex ++;\n \t\t}\n \t}\n \t\n \tdd(\"END\");\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // $this->dataCategory();\n factory(App\\Model\\Category::class, 70)->create();\n factory(App\\Model\\Producer::class, rand(5,10))->create();\n factory(App\\Model\\Provider::class, rand(5,10))->create();\n factory(App\\Model\\Product::class, 100)->create();\n factory(App\\Model\\Album::class, 300)->create();\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n\n factory('App\\User', 10 )->create();\n\n $users= \\App\\User::all();\n $users->each(function($user){ factory('App\\Category', 1)->create(['user_id'=>$user->id]); });\n $users->each(function($user){ factory('App\\Tag', 3)->create(['user_id'=>$user->id]); });\n\n\n $users->each(function($user){\n factory('App\\Post', 10)->create([\n 'user_id'=>$user->id,\n 'category_id'=>rand(1,20)\n ]\n );\n });\n\n $posts= \\App\\Post::all();\n $posts->each(function ($post){\n\n $post->tags()->attach(array_unique([rand(1,20),rand(1,20),rand(1,20)]));\n });\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $types = factory(\\App\\Models\\Type::class, 5)->create();\n\n $cities = factory(\\App\\Models\\City::class, 10)->create();\n\n $cities->each(function ($city) {\n $districts = factory(\\App\\Models\\District::class, rand(2, 5))->create([\n 'city_id' => $city->id,\n ]);\n\n $districts->each(function ($district) {\n $properties = factory(\\App\\Models\\Property::class, rand(2, 5))->create([\n 'type_id' => rand(1, 5),\n 'district_id' => $district->id\n ]);\n\n $properties->each(function ($property) {\n $galleries = factory(\\App\\Models\\Gallery::class, rand(3, 10))->create([\n 'property_id' => $property->id\n ]);\n });\n });\n });\n }", "public function run()\n {\n $this->call(UsersTableSeeder::class);\n\n $categories = factory(App\\Models\\Category::class, 10)->create();\n\n $categories->each(function ($category) {\n $category\n ->posts()\n ->saveMany(\n factory(App\\Models\\Post::class, 3)->make()\n );\n });\n }", "public function run()\n {\n $this->call(CategoriesTableSeeder::class);\n\n $users = factory(App\\User::class, 5)->create();\n $recipes = factory(App\\Recipe::class, 30)->create();\n $preparations = factory(App\\Preparation::class, 70)->create();\n $photos = factory(App\\Photo::class, 90)->create();\n $comments = factory(App\\Comment::class, 200)->create();\n $flavours = factory(App\\Flavour::class, 25)->create();\n $flavour_recipe = factory(App\\FlavourRecipe::class, 50)->create();\n $tags = factory(App\\Tag::class, 25)->create();\n $recipe_tag = factory(App\\RecipeTag::class, 50)->create();\n $ingredients = factory(App\\Ingredient::class, 25)->create();\n $ingredient_preparation = factory(App\\IngredientPreparation::class, 300)->create();\n \n \n \n DB::table('users')->insert(['name' => 'SimpleUtilisateur', 'email' => '[email protected]', 'password' => bcrypt('SimpleMotDePasse')]);\n \n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n // Sample::truncate();\n // TestItem::truncate();\n // UOM::truncate();\n Role::truncate();\n User::truncate();\n\n // factory(Role::class, 4)->create();\n Role::create([\n 'name'=> 'Director',\n 'description'=> 'Director type'\n ]);\n\n Role::create([\n 'name'=> 'Admin',\n 'description'=> 'Admin type'\n ]);\n Role::create([\n 'name'=> 'Employee',\n 'description'=> 'Employee type'\n ]);\n Role::create([\n 'name'=> 'Technician',\n 'description'=> 'Technician type'\n ]);\n \n factory(User::class, 20)->create()->each(\n function ($user){\n $roles = \\App\\Role::all()->random(mt_rand(1, 2))->pluck('id');\n $user->roles()->attach($roles);\n }\n );\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n UsersLevel::create([\n 'name' => 'Administrator'\n ]);\n\n UsersLevel::create([\n 'name' => 'User'\n ]);\n\n User::create([\n 'username' => 'admin',\n 'password' => bcrypt('admin123'),\n 'level_id' => 1,\n 'fullname' => \"Super Admin\",\n 'email'=> \"[email protected]\"\n ]);\n\n\n \\App\\CategoryPosts::create([\n 'name' =>'Paket Trip'\n ]);\n\n \\App\\CategoryPosts::create([\n 'name' =>'Destinasi Kuliner'\n ]);\n\n \\App\\CategoryPosts::create([\n 'name' => 'Event'\n ]);\n\n \\App\\CategoryPosts::create([\n 'name' => 'Profil'\n ]);\n }", "public function run()\n {\n DB::table('users')->insert([\n 'name' => 'Admin',\n 'email' => '[email protected]',\n 'avatar' => \"avatar\",\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',\n ]);\n $this->call(CategorySeeder::class);\n // \\App\\Models\\Admin::factory(1)->create();\n \\App\\Models\\User::factory(10)->create();\n // \\App\\Models\\Category::factory(50)->create();\n \\App\\Models\\PetComment::factory(50)->create();\n $pets = \\App\\Models\\Pet::factory(50)->create();\n foreach ($pets as $pet) {\n \\App\\Models\\PetTag::factory(1)->create(['pet_id' => $pet->id]);\n \\App\\Models\\PetPhotoUrl::factory(1)->create(['pet_id' => $pet->id]);\n \\App\\Models\\Order::factory(1)->create(['pet_id' => $pet->id]);\n };\n }", "public function run()\n { \n\n $this->call(RoleSeeder::class);\n \n $this->call(UserSeeder::class);\n\n Storage::deleteDirectory('socials-icon');\n Storage::makeDirectory('socials-icon');\n $socials = Social::factory(7)->create();\n\n Storage::deleteDirectory('countries-flag');\n Storage::deleteDirectory('countries-firm');\n Storage::makeDirectory('countries-flag');\n Storage::makeDirectory('countries-firm');\n $countries = Country::factory(18)->create();\n\n // Se llenan datos de la tabla muchos a muchos - social_country\n foreach ($countries as $country) {\n foreach ($socials as $social) {\n\n $country->socials()->attach($social->id, [\n 'link' => 'https://www.facebook.com/ministeriopalabrayespiritu/'\n ]);\n }\n }\n\n Person::factory(50)->create();\n\n Category::factory(7)->create();\n\n Video::factory(25)->create(); \n\n $this->call(PostSeeder::class);\n\n Storage::deleteDirectory('documents');\n Storage::makeDirectory('documents');\n Document::factory(25)->create();\n\n }", "public function run()\n {\n $faker = Faker::create('id_ID');\n /**\n * Generate fake author data\n */\n for ($i=1; $i<=50; $i++) { \n DB::table('author')->insert([\n 'name' => $faker->name\n ]);\n }\n /**\n * Generate fake publisher data\n */\n for ($i=1; $i<=50; $i++) { \n DB::table('publisher')->insert([\n 'name' => $faker->name\n ]);\n }\n /**\n * Seeding payment method\n */\n DB::table('payment')->insert([\n ['name' => 'Mandiri'],\n ['name' => 'BCA'],\n ['name' => 'BRI'],\n ['name' => 'BNI'],\n ['name' => 'Pos Indonesia'],\n ['name' => 'BTN'],\n ['name' => 'Indomaret'],\n ['name' => 'Alfamart'],\n ['name' => 'OVO'],\n ['name' => 'Cash On Delivery']\n ]);\n }", "public function run()\n {\n DatabaseSeeder::seedLearningStylesProbs();\n DatabaseSeeder::seedCampusProbs();\n DatabaseSeeder::seedGenderProbs();\n DatabaseSeeder::seedTypeStudentProbs();\n DatabaseSeeder::seedTypeProfessorProbs();\n DatabaseSeeder::seedNetworkProbs();\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n // MyList::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 3; $i++) {\n MyList::create([\n 'title' => 'List-'.($i+1),\n 'color' => $faker->sentence,\n 'icon' => $faker->randomDigitNotNull,\n 'index' => $faker->randomDigitNotNull,\n 'user_id' => 1,\n ]);\n }\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n Products::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few products in our database:\n for ($i = 0; $i < 50; $i++) {\n Products::create([\n 'name' => $faker->word,\n 'sku' => $faker->randomNumber(7, false),\n ]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n User::create([\n 'name' => 'Pablo Rosales',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'status' => 1,\n 'role_id' => 1,\n 'movil' => 0\n ]);\n\n User::create([\n 'name' => 'Usuario Movil',\n 'email' => '[email protected]',\n 'password' => bcrypt('secret'),\n 'status' => 1,\n 'role_id' => 3,\n 'movil' => 1\n ]);\n\n Roles::create([\n 'name' => 'Administrador'\n ]);\n Roles::create([\n 'name' => 'Operaciones'\n ]);\n Roles::create([\n 'name' => 'Comercial'\n ]);\n Roles::create([\n 'name' => 'Aseguramiento'\n ]);\n Roles::create([\n 'name' => 'Facturación'\n ]);\n Roles::create([\n 'name' => 'Creditos y Cobros'\n ]);\n\n factory(App\\Customers::class, 100)->create();\n }", "public function run()\n {\n // php artisan db:seed --class=StoreTableSeeder\n\n foreach(range(1,20) as $i){\n $faker = Faker::create();\n Store::create([\n 'name' => $faker->name,\n 'desc' => $faker->text,\n 'tags' => $faker->word,\n 'address' => $faker->address,\n 'longitude' => $faker->longitude($min = -180, $max = 180),\n 'latitude' => $faker->latitude($min = -90, $max = 90),\n 'created_by' => '1'\n ]);\n }\n\n }", "public function run()\n {\n DB::table('users')->insert([\n 'name'=>\"test\",\n 'password' => Hash::make('123'),\n 'email'=>'[email protected]'\n ]);\n DB::table('tags')->insert(['name'=>'tags']);\n $this->call(UserSeed::class);\n $this->call(CategoriesSeed::class);\n $this->call(TopicsSeed::class);\n $this->call(CommentariesSeed::class);\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n echo 'seeding permission...', PHP_EOL;\n $permissions = [\n 'role-list',\n 'role-create',\n 'role-edit',\n 'role-delete',\n 'formation-list',\n 'formation-create',\n 'formation-edit',\n 'formation-delete',\n 'user-list',\n 'user-create',\n 'user-edit',\n 'user-delete'\n ];\n foreach ($permissions as $permission) {\n Permission::create(['name' => $permission]);\n }\n echo 'seeding users...', PHP_EOL;\n\n $user= User::create(\n [\n 'name' => 'Mr. admin',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'remember_token' => null,\n ]\n );\n echo 'Create Roles...', PHP_EOL;\n Role::create(['name' => 'former']);\n Role::create(['name' => 'learner']);\n Role::create(['name' => 'admin']);\n Role::create(['name' => 'manager']);\n Role::create(['name' => 'user']);\n\n echo 'seeding Role User...', PHP_EOL;\n $user->assignRole('admin');\n $role = $user->assignRole('admin');\n $role->givepermissionTo(Permission::all());\n\n \\DB::table('languages')->insert(['name' => 'English', 'code' => 'en']);\n \\DB::table('languages')->insert(['name' => 'Français', 'code' => 'fr']);\n }", "public function run()\n {\n $this->call(UsersTableSeeder::class);\n $this->call(PermissionsSeeder::class);\n $this->call(RolesSeeder::class);\n $this->call(ThemeSeeder::class);\n\n //\n\n DB::table('paypal_info')->insert([\n 'client_id' => '',\n 'client_secret' => '',\n 'currency' => '',\n ]);\n DB::table('contact_us')->insert([\n 'content' => '',\n ]);\n DB::table('setting')->insert([\n 'site_name' => ' ',\n ]);\n DB::table('terms_and_conditions')->insert(['terms_and_condition' => 'text']);\n }", "public function run()\n {\n $this->call([\n UserSeeder::class,\n ]);\n\n User::factory(20)->create();\n Author::factory(20)->create();\n Book::factory(60)->create();\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->call(UserSeeder::class);\n $this->call(RolePermissionSeeder::class);\n $this->call(AppmodeSeeder::class);\n\n // \\App\\Models\\Appmode::factory(3)->create();\n \\App\\Models\\Doctor::factory(100)->create();\n \\App\\Models\\Unit::factory(50)->create();\n \\App\\Models\\Broker::factory(100)->create();\n \\App\\Models\\Patient::factory(100)->create();\n \\App\\Models\\Expence::factory(100)->create();\n \\App\\Models\\Testcategory::factory(100)->create();\n \\App\\Models\\Test::factory(50)->create();\n \\App\\Models\\Parameter::factory(50)->create();\n \\App\\Models\\Sale::factory(50)->create();\n \\App\\Models\\SaleItem::factory(100)->create();\n \\App\\Models\\Goption::factory(1)->create();\n \\App\\Models\\Pararesult::factory(50)->create();\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // DB::table('roles')->insert(\n // [\n // ['name' => 'admin', 'description' => 'Administrator'],\n // ['name' => 'student', 'description' => 'Student'],\n // ['name' => 'lab_tech', 'description' => 'Lab Tech'],\n // ['name' => 'it_staff', 'description' => 'IT Staff Member'],\n // ['name' => 'it_manager', 'description' => 'IT Manager'],\n // ['name' => 'lab_manager', 'description' => 'Lab Manager'],\n // ]\n // );\n\n // DB::table('users')->insert(\n // [\n // 'username' => 'admin', \n // 'password' => Hash::make('password'), \n // 'active' => 1,\n // 'name' => 'Administrator',\n // 'email' => '[email protected]',\n // 'role_id' => \\App\\Role::where('name', 'admin')->first()->id\n // ]\n // );\n\n DB::table('status')->insert([\n // ['name' => 'Active'],\n // ['name' => 'Cancel'],\n // ['name' => 'Disable'],\n // ['name' => 'Open'],\n // ['name' => 'Closed'],\n // ['name' => 'Resolved'],\n ['name' => 'Used'],\n ]);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n factory(User::class)->create([\n 'name' => 'Qwerty',\n 'email' => '[email protected]',\n 'password' => bcrypt('secretpassw'),\n ]);\n\n factory(User::class, 59)->create([\n 'password' => bcrypt('secretpassw'),\n ]);\n\n for ($i = 1; $i < 11; $i++) {\n factory(Category::class)->create([\n 'name' => 'Category ' . $i,\n ]);\n }\n\n for ($i = 1; $i < 101; $i++) {\n factory(Product::class)->create([\n 'name' => 'Product ' . $i,\n ]);\n }\n }", "public function run()\n {\n\n \t// Making main admin role\n \tDB::table('roles')->insert([\n 'name' => 'Admin',\n ]);\n\n // Making main category\n \tDB::table('categories')->insert([\n 'name' => 'Other',\n ]);\n\n \t// Making main admin account for testing\n \tDB::table('users')->insert([\n 'name' \t\t=> 'Admin',\n 'email' \t=> '[email protected]',\n 'password' => bcrypt('12345'),\n 'role_id' => 1,\n 'created_at' => date('Y-m-d H:i:s' ,time()),\n 'updated_at' => date('Y-m-d H:i:s' ,time())\n ]);\n\n \t// Making random users and posts\n factory(App\\User::class, 10)->create();\n factory(App\\Post::class, 35)->create();\n }", "public function run()\n {\n $faker = Faker::create();\n\n \\DB::table('positions')->insert(array (\n 'codigo' => strtoupper($faker->randomLetter).$faker->postcode,\n 'nombre' => 'Chef',\n 'salario' => '15000.00'\n ));\n\n\t\t \\DB::table('positions')->insert(array (\n 'codigo' => strtoupper($faker->randomLetter).$faker->postcode,\n 'nombre' => 'Mesonero',\n 'salario' => '12000.00'\n ));\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $faker = \\Faker\\Factory::create();\n\n foreach (range(1,5) as $index) {\n Lista::create([\n 'name' => $faker->sentence(2),\n 'description' => $faker->sentence(10), \n ]);\n } \n\n foreach (range(1,20) as $index) {\n $n = $faker->sentence(2);\n \tTarea::create([\n \t\t'name' => $n,\n \t\t'description' => $faker->sentence(10),\n 'lista_id' => $faker->numberBetween(1,5),\n 'slug' => Str::slug($n),\n \t\t]);\n } \n }", "public function run()\n {\n $faker = Faker::create('lt_LT');\n\n DB::table('users')->insert([\n 'name' => 'user',\n 'email' => '[email protected]',\n 'password' => Hash::make('123')\n ]);\n DB::table('users')->insert([\n 'name' => 'user2',\n 'email' => '[email protected]',\n 'password' => Hash::make('123')\n ]);\n\n foreach (range(1,100) as $val)\n DB::table('authors')->insert([\n 'name' => $faker->firstName(),\n 'surname' => $faker->lastName(),\n \n ]);\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->call(UsersTableSeeder::class);\n\n // DB::table('users')->insert([\n // 'name' => 'User1',\n // 'email' => '[email protected]',\n // 'password' => bcrypt('password'),\n // ]);\n\n\n $faker = Faker::create();\n \n foreach (range(1,10) as $index){\n DB::table('companies')->insert([\n 'name' => $faker->company(),\n 'email' => $faker->email(10).'@gmail.com',\n 'logo' => $faker->image($dir = '/tmp', $width = 640, $height = 480),\n 'webiste' => $faker->domainName(),\n \n ]);\n }\n \n \n foreach (range(1,10) as $index){\n DB::table('employees')->insert([\n 'first_name' => $faker->firstName(),\n 'last_name' => $faker->lastName(),\n 'company' => $faker->company(),\n 'email' => $faker->str_random(10).'@gmail.com',\n 'phone' => $faker->e164PhoneNumber(),\n \n ]);\n }\n\n\n\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n Flight::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 100; $i++) {\n\n\n Flight::create([\n 'flightNumber' => $faker->randomNumber(5),\n 'depAirport' => $faker->city,\n 'destAirport' => $faker->city,\n 'reservedWeight' => $faker->numberBetween(1000 - 10000),\n 'deptTime' => $faker->dateTime('now'),\n 'arrivalTime' => $faker->dateTime('now'),\n 'reservedVolume' => $faker->numberBetween(1000 - 10000),\n 'airlineName' => $faker->colorName,\n ]);\n }\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->truncteTables([\n 'users',\n 'products'\n ]);\n\n $this->call(UsersSeeder::class);\n $this->call(ProductsSeeder::class);\n\n }", "public function run()\n {\n /**\n * Dummy seeds\n */\n DB::table('metas')->truncate();\n $faker = Faker::create();\n\n for ($i=0; $i < 10; $i++) { \n DB::table('metas')->insert([\n 'id_rel' => $faker->randomNumber(),\n 'titulo' => $faker->sentence,\n 'descricao' => $faker->paragraph,\n 'justificativa' => $faker->paragraph,\n 'valor_inicial' => $faker->numberBetween(0,100),\n 'valor_atual' => $faker->numberBetween(0,100),\n 'valor_final' => $faker->numberBetween(0,10),\n 'regras' => json_encode([$i => [\"values\" => $faker->words(3)]]),\n 'types' => json_encode([$i => [\"values\" => $faker->words(2)]]),\n 'categorias' => json_encode([$i => [\"values\" => $faker->words(4)]]),\n 'tags' => json_encode([$i => [\"values\" => $faker->words(5)]]),\n 'active' => true,\n ]);\n }\n\n\n }", "public function run()\n {\n // $this->call(UserTableSeeder::class);\n\n $faker = Faker::create();\n\n $lessonIds = Lesson::lists('id')->all(); // An array of ID's in that table [1, 2, 3, 4, 5, 7]\n $tagIds = Tag::lists('id')->all();\n\n foreach(range(1, 30) as $index)\n {\n // a real lesson id\n // a real tag id\n DB::table('lesson_tag')->insert([\n 'lesson_id' => $faker->randomElement($lessonIds),\n 'tag_id' => $faker->randomElement($tagIds),\n ]);\n }\n }", "public function run()\n {\n $this->call(CategoriasTableSeeder::class);\n $this->call(UfsTableSeeder::class);\n $this->call(UsersTableSeeder::class);\n $this->call(UserTiposTableSeeder::class);\n factory(App\\User::class, 2)->create();\n/* factory(App\\Models\\Categoria::class, 20)->create();*/\n/* factory(App\\Models\\Anuncio::class, 50)->create();*/\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n Language::truncate();\n Reason::truncate();\n Report::truncate();\n Category::truncate();\n Position::truncate();\n\n $languageQuantity = 10;\n $reasonQuantity = 10;\n $reportQuantity = 10;\n $categoryQuantity = 10;\n $positionQuantity = 10;\n\n factory(Language::class,$languageQuantity)->create();\n factory(Reason::class,$reasonQuantity)->create();\n \n factory(Report::class,$reportQuantity)->create();\n \n factory(Category::class,$categoryQuantity)->create();\n \n factory(Position::class,$positionQuantity)->create();\n\n }", "public function run()\n {\n // \\DB::statement('SET_FOREIGN_KEY_CHECKS=0');\n \\DB::table('users')->truncate();\n \\DB::table('posts')->truncate();\n // \\DB::table('category')->truncate();\n \\DB::table('photos')->truncate();\n \\DB::table('comments')->truncate();\n \\DB::table('comment_replies')->truncate();\n\n \\App\\Models\\User::factory()->times(10)->hasPosts(1)->create();\n \\App\\Models\\Role::factory()->times(10)->create();\n \\App\\Models\\Category::factory()->times(10)->create();\n \\App\\Models\\Comment::factory()->times(10)->hasReplies(1)->create();\n \\App\\Models\\Photo::factory()->times(10)->create();\n\n \n // \\App\\Models\\User::factory(10)->create([\n // 'role_id'=>2,\n // 'is_active'=>1\n // ]);\n\n // factory(App\\Models\\Post::class, 10)->create();\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n $this->call([\n ArticleSeeder::class, \n TagSeeder::class,\n Arttagrel::class\n ]);\n // \\App\\Models\\User::factory(10)->create();\n \\App\\Models\\Article::factory()->count(7)->create();\n \\App\\Models\\Tag::factory()->count(15)->create(); \n \\App\\Models\\Arttagrel::factory()->count(15)->create(); \n }", "public function run()\n {\n $this->call(ArticulosTableSeeder::class);\n /*DB::table('articulos')->insert([\n 'titulo' => str_random(50),\n 'cuerpo' => str_random(200),\n ]);*/\n }", "public function run()\n {\n $this->call(CategoryTableSeeder::class);\n $this->call(ProductTableSeeder::class);\n\n \t\t\n\t\t\tDB::table('users')->insert([\n 'first_name' => 'Ignacio',\n 'last_name' => 'Garcia',\n 'email' => '[email protected]',\n 'password' => bcrypt('123456'),\n 'role' => '1',\n 'avatar' => 'CGnABxNYYn8N23RWlvTTP6C2nRjOLTf8IJcbLqRP.jpeg',\n ]);\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->call(RoleSeeder::class);\n $this->call(UserSeeder::class);\n\n Medicamento::factory(50)->create();\n Reporte::factory(5)->create();\n Cliente::factory(200)->create();\n Asigna_valor::factory(200)->create();\n Carga::factory(200)->create();\n }", "public function run()\n {\n $this->call([\n RoleSeeder::class,\n TicketSeeder::class\n ]);\n\n DB::table('departments')->insert([\n 'abbr' => 'IT',\n 'name' => 'Information Technologies',\n 'created_at' => Carbon::now(),\n 'updated_at' => Carbon::now(),\n ]);\n\n DB::table('users')->insert([\n 'name' => 'admin',\n 'email' => '[email protected]',\n 'email_verified_at' => Carbon::now(),\n 'password' => Hash::make('admin'),\n 'department_id' => 1,\n 'avatar' => 'default.png',\n 'created_at' => Carbon::now(),\n 'updated_at' => Carbon::now(),\n ]);\n\n DB::table('role_user')->insert([\n 'role_id' => 1,\n 'user_id' => 1\n ]);\n }", "public function run()\n {\n \\App\\Models\\Article::factory(20)->create();\n \\App\\Models\\Category::factory(5)->create();\n \\App\\Models\\Comment::factory(40)->create();\n\n \\App\\Models\\User::create([\n \"name\"=>\"Alice\",\n \"email\"=>'[email protected]',\n 'password' => Hash::make('password'),\n ]);\n \\App\\Models\\User::create([\n \"name\"=>\"Bob\",\n \"email\"=>'[email protected]',\n 'password' => Hash::make('password'),\n ]);\n }", "public function run()\n {\n /** \n * Note: You must add these lines to your .env file for this Seeder to work (replace the values, obviously):\n SEEDER_USER_FIRST_NAME = 'Firstname'\n SEEDER_USER_LAST_NAME = 'Lastname'\n\t\tSEEDER_USER_DISPLAY_NAME = 'Firstname Lastname'\n\t\tSEEDER_USER_EMAIL = [email protected]\n SEEDER_USER_PASSWORD = yourpassword\n */\n\t\tDB::table('users')->insert([\n 'user_first_name' => env('SEEDER_USER_FIRST_NAME'),\n 'user_last_name' => env('SEEDER_USER_LAST_NAME'),\n 'user_name' => env('SEEDER_USER_DISPLAY_NAME'),\n\t\t\t'user_email' => env('SEEDER_USER_EMAIL'),\n 'user_status' => 1,\n \t'password' => Hash::make((env('SEEDER_USER_PASSWORD'))),\n 'permission_fk' => 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 }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(App\\User::class,3)->create()->each(\n \tfunction($user)\n \t{\n \t\t$user->questions()\n \t\t->saveMany(\n \t\t\tfactory(App\\Question::class, rand(2,6))->make()\n \t\t)\n ->each(function ($q) {\n $q->answers()->saveMany(factory(App\\Answer::class, rand(1,5))->make());\n })\n \t}\n );\n }\n}", "public function run()\n {\n $faker = Faker::create();\n\n // $this->call(UsersTableSeeder::class);\n\n DB::table('posts')->insert([\n 'id'=>str_random(1),\n 'user_id'=> str_random(1),\n 'title' => $faker->name,\n 'body' => $faker->safeEmail,\n 'created_at' => date('Y-m-d H:i:s'),\n 'updated_at' => date('Y-m-d H:i:s'),\n ]);\n }", "public function run()\n\t{\n\t\tDB::table(self::TABLE_NAME)->delete();\n\n\t\tforeach (seed(self::TABLE_NAME) as $row)\n\t\t\t$records[] = [\n\t\t\t\t'id'\t\t\t\t=> $row->id,\n\t\t\t\t'created_at'\t\t=> $row->created_at ?? Carbon::now(),\n\t\t\t\t'updated_at'\t\t=> $row->updated_at ?? Carbon::now(),\n\n\t\t\t\t'sport_id'\t\t\t=> $row->sport_id,\n\t\t\t\t'gender_id'\t\t\t=> $row->gender_id,\n\t\t\t\t'tournamenttype_id'\t=> $row->tournamenttype_id ?? null,\n\n\t\t\t\t'name'\t\t\t\t=> $row->name,\n\t\t\t\t'external_id'\t\t=> $row->external_id ?? null,\n\t\t\t\t'is_top'\t\t\t=> $row->is_top ?? null,\n\t\t\t\t'logo'\t\t\t\t=> $row->logo ?? null,\n\t\t\t\t'position'\t\t\t=> $row->position ?? null,\n\t\t\t];\n\n\t\tinsert(self::TABLE_NAME, $records ?? []);\n\t}", "public function run()\n\t{\n\t\tDB::table('libros')->truncate();\n\n\t\t$faker = Faker\\Factory::create();\n\n\t\tfor ($i=0; $i < 10; $i++) { \n\t\t\tLibro::create([\n\n\t\t\t\t'titulo'\t\t=> $faker->text(40),\n\t\t\t\t'isbn'\t\t\t=> $faker->numberBetween(100,999),\n\t\t\t\t'precio'\t\t=> $faker->randomFloat(2,3,150),\n\t\t\t\t'publicado'\t\t=> $faker->numberBetween(0,1),\n\t\t\t\t'descripcion'\t=> $faker->text(400),\n\t\t\t\t'autor_id'\t\t=> $faker->numberBetween(1,3),\n\t\t\t\t'categoria_id'\t=> $faker->numberBetween(1,3)\n\n\t\t\t]);\n\t\t}\n\n\t\t// Uncomment the below to run the seeder\n\t\t// DB::table('libros')->insert($libros);\n\t}", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(App\\User::class, 10)->create()->each(function ($user) {\n // Seed the relation with 5 purchases\n // $videos = factory(App\\Video::class, 5)->make();\n // $user->videos()->saveMany($videos);\n // $user->videos()->each(function ($video){\n // \t$video->videometa()->save(factory(App\\VideoMeta::class)->make());\n // \t// :( \n // });\n factory(App\\User::class, 10)->create()->each(function ($user) {\n\t\t\t factory(App\\Video::class, 5)->create(['user_id' => $user->id])->each(function ($video) {\n\t\t\t \tfactory(App\\VideoMeta::class, 1)->create(['video_id' => $video->id]);\n\t\t\t // $video->videometa()->save(factory(App\\VideoMeta::class)->create(['video_id' => $video->id]));\n\t\t\t });\n\t\t\t});\n\n });\n }", "public function run()\n {\n // for($i=1;$i<11;$i++){\n // DB::table('post')->insert(\n // ['title' => 'Title'.$i,\n // 'post' => 'Post'.$i,\n // 'slug' => 'Slug'.$i]\n // );\n // }\n $faker = Faker\\Factory::create();\n \n for($i=1;$i<20;$i++){\n $dname = $faker->name;\n DB::table('post')->insert(\n ['title' => $dname,\n 'post' => $faker->text($maxNbChars = 200),\n 'slug' => str_slug($dname)]\n );\n }\n }", "public function run()\n {\n $this->call([\n CountryTableSeeder::class,\n ProvinceTableSeeder::class,\n TagTableSeeder::class\n ]);\n\n User::factory()->count(10)->create();\n Category::factory()->count(5)->create();\n Product::factory()->count(20)->create();\n Section::factory()->count(5)->create();\n Bundle::factory()->count(20)->create();\n\n $bundles = Bundle::all();\n // populate bundle-product table (morph many-to-many)\n Product::all()->each(function ($product) use ($bundles) {\n $product->bundles()->attach(\n $bundles->random(2)->pluck('id')->toArray(),\n ['default_quantity' => rand(1, 10)]\n );\n });\n // populate bundle-tags table (morph many-to-many)\n Tag::all()->each(function ($tag) use ($bundles) {\n $tag->bundles()->attach(\n $bundles->random(2)->pluck('id')->toArray()\n );\n });\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n Contract::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 50; $i++) {\n Contract::create([\n 'serialnumbers' => $faker->numberBetween($min = 1000000, $max = 2000000),\n 'address' => $faker->address,\n 'landholder' => $faker->lastName,\n 'renter' => $faker->lastName,\n 'price' => $faker->numberBetween($min = 10000, $max = 50000),\n 'rent_start' => $faker->date($format = 'Y-m-d', $max = 'now'),\n 'rent_end' => $faker->date($format = 'Y-m-d', $max = 'now'),\n ]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $faker=Faker\\Factory::create();\n\n for($i=0;$i<100;$i++){\n \tApp\\Blog::create([\n \t\t'title' => $faker->catchPhrase,\n 'description' => $faker->text,\n 'showns' =>true\n \t\t]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0'); // TO PREVENT CHECKS FOR foreien key in seeding\n\n User::truncate();\n Category::truncate();\n Product::truncate();\n Transaction::truncate();\n\n DB::table('category_product')->truncate();\n\n User::flushEventListeners();\n Category::flushEventListeners();\n Product::flushEventListeners();\n Transaction::flushEventListeners();\n\n $usersQuantities = 1000;\n $categoriesQuantities = 30;\n $productsQuantities = 1000;\n $transactionsQuantities = 1000;\n\n factory(User::class, $usersQuantities)->create();\n factory(Category::class, $categoriesQuantities)->create();\n\n factory(Product::class, $productsQuantities)->create()->each(\n function ($product) {\n $categories = Category::all()->random(mt_rand(1, 5))->pluck('id');\n $product->categories()->attach($categories);\n });\n\n factory(Transaction::class, $transactionsQuantities)->create();\n }", "public function run()\n {\n // $this->call(UserSeeder::class);\n $this->call(PermissionsTableSeeder::class);\n $this->call(UsersTableSeeder::class);\n\n $this->call(BusinessTableSeeder::class);\n $this->call(PrinterTableSeeder::class);\n factory(App\\Tag::class,10)->create();\n factory(App\\Category::class,10)->create();\n factory(App\\Subcategory::class,50)->create();\n factory(App\\Provider::class,10)->create();\n factory(App\\Product::class,24)->create()->each(function($product){\n\n $product->images()->saveMany(factory(App\\Image::class, 4)->make());\n\n });\n\n\n factory(App\\Client::class,10)->create();\n }", "public function run()\n {\n Article::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 50; $i++) {\n Article::create([\n 'name' => $faker->sentence,\n 'sku' => $faker->paragraph,\n 'price' => $faker->number,\n ]);\n }\n }", "public function run()\n {\n Storage::deleteDirectory('public/products');\n Storage::makeDirectory('public/products');\n\n $this->call(UserSeeder::class);\n Category::factory(4)->create();\n $this->call(ProductSeeder::class);\n Order::factory(4)->create();\n Order_Detail::factory(4)->create();\n Size::factory(100)->create();\n }", "public function run()\n {\n $this->call(RolSeeder::class);\n\n $this->call(UserSeeder::class);\n Category::factory(4)->create();\n Doctor::factory(25)->create();\n Patient::factory(50)->create();\n Status::factory(3)->create();\n Appointment::factory(100)->create();\n }", "public function run()\n\t{\n\t\t\n\t\tDB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n\t\t$faker = \\Faker\\Factory::create();\n\n\t\tTodolist::truncate();\n\n\t\tforeach(range(1, 50) as $index)\n\t\t{\n\n\t\t\t$user = User::create([\n\t\t\t\t'name' => $faker->name,\n\t\t\t\t'email' => $faker->email,\n\t\t\t\t'password' => 'password',\n\t\t\t\t'confirmation_code' => mt_rand(0, 9),\n\t\t\t\t'confirmation' => rand(0,1) == 1\n\t\t\t]);\n\n\t\t\t$list = Todolist::create([\n\t\t\t\t'name' => $faker->sentence(2),\n\t\t\t\t'description' => $faker->sentence(4),\n\t\t\t]);\n\n\t\t\t// BUILD SOME TASKS FOR EACH LIST ITEM\n\t\t\tforeach(range(1, 10) as $index) \n\t\t\t{\n\t\t\t\t$task = new Task;\n\t\t\t\t$task->name = $faker->sentence(2);\n\t\t\t\t$task->description = $faker->sentence(4);\n\t\t\t\t$list->tasks()->save($task);\n\t\t\t}\n\n\t\t}\n\n\t\tDB::statement('SET FOREIGN_KEY_CHECKS = 1'); \n\n\t}", "public function run()\n {\n Campus::truncate();\n Canteen::truncate();\n Dorm::truncate();\n\n $faker = Faker\\Factory::create();\n $schools = School::all();\n foreach ($schools as $school) {\n \tforeach (range(1, 2) as $index) {\n\t \t$campus = Campus::create([\n\t \t\t'school_id' => $school->id,\n\t \t\t'name' => $faker->word . '校区',\n\t \t\t]);\n\n \t$campus->canteens()->saveMany(factory(Canteen::class, mt_rand(2,3))->make());\n $campus->dorms()->saveMany(factory(Dorm::class, mt_rand(2,3))->make());\n\n }\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::table('users')->insert([\n 'name' => 'admin',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'seq_q'=>'1',\n 'seq_a'=>'admin'\n ]);\n\n // DB::table('bloods')->insert([\n // ['name' => 'A+'],\n // ['name' => 'A-'],\n // ['name' => 'B+'],\n // ['name' => 'B-'],\n // ['name' => 'AB+'],\n // ['name' => 'AB-'],\n // ['name' => 'O+'],\n // ['name' => 'O-'],\n // ]);\n\n \n }", "public function run()\n {\n // $this->call(UserTableSeeder::class);\n \\App\\User::create([\n 'name'=>'PAPE SAMBA NDOUR',\n 'email'=>'[email protected]',\n 'password'=>bcrypt('Admin1122'),\n ]);\n\n $faker = Faker::create();\n\n for ($i = 0; $i < 100 ; $i++)\n {\n $firstName = $faker->firstName;\n $lastName = $faker->lastName;\n $niveau = \\App\\Niveau::inRandomOrder()->first();\n \\App\\Etudiant::create([\n 'prenom'=>$firstName,\n 'nom'=>$lastName,\n 'niveau_id'=>$niveau->id\n ]);\n }\n\n\n }", "public function run()\n {\n //\n DB::table('foods')->delete();\n\n Foods::create(array(\n 'name' => 'Chicken Wing',\n 'author' => 'Bambang',\n 'overview' => 'a deep-fried chicken wing, not in spicy sauce'\n ));\n\n Foods::create(array(\n 'name' => 'Beef ribs',\n 'author' => 'Frank',\n 'overview' => 'Slow baked beef ribs rubbed in spices'\n ));\n\n Foods::create(array(\n 'name' => 'Ice cream',\n 'author' => 'Lou',\n 'overview' => ' A sweetened frozen food typically eaten as a snack or dessert.'\n ));\n\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n News::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 10; $i++) {\n News::create([\n 'title' => $faker->sentence,\n 'summary' => $faker->sentence,\n 'content' => $faker->paragraph,\n 'imagePath' => '/img/exclamation_mark.png'\n ]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(App\\User::class, 3)->create();\n factory(App\\Models\\Category::class, 3)\n ->create()\n ->each(function ($u) {\n $u->courses()->saveMany(factory(App\\Models\\Course::class,3)->make())->each(function ($c){\n $c->exams()->saveMany(factory(\\App\\Models\\Exam::class,3)->make())->each(function ($e){\n $e->questions()->saveMany(factory(\\App\\Models\\Question::class,4)->make())->each(function ($q){\n $q->answers()->saveMany(factory(\\App\\Models\\Answer::class,4)->make())->each(function ($a){\n $a->correctAnswer()->save(factory(\\App\\Models\\Correct_answer::class)->make());\n });\n });\n });\n });\n\n });\n\n }", "public function run()\n {\n \\DB::table('employees')->delete();\n\n $faker = \\Faker\\Factory::create('ja_JP');\n\n $role_id = ['1','2','3'];\n\n for ($i = 0; $i < 10; $i++) {\n \\App\\Models\\Employee::create([\n 'last_name' =>$faker->lastName() ,\n 'first_name' => $faker->firstName(),\n 'mail' => $faker->email(),\n 'password' => Hash::make( \"password.$i\"),\n 'birthday' => $faker->date($format='Y-m-d',$max='now'),\n 'role_id' => $faker->randomElement($role_id)\n ]);\n }\n }", "public function run()\n {\n\n DB::table('clients')->delete();\n DB::table('trips')->delete();\n error_log('empty tables done.');\n\n $random_cities = City::inRandomOrder()->select('ar_name')->limit(5)->get();\n $GLOBALS[\"random_cities\"] = $random_cities->pluck('ar_name')->toArray();\n\n $random_airlines = Airline::inRandomOrder()->select('code')->limit(5)->get();\n $GLOBALS[\"random_airlines\"] = $random_airlines->pluck('code')->toArray();\n\n factory(App\\Client::class, 5)->create();\n error_log('Client seed done.');\n\n\n factory(App\\Trip::class, 50)->create();\n error_log('Trip seed done.');\n\n\n factory(App\\Quicksearch::class, 10)->create();\n error_log('Quicksearch seed done.');\n }", "public function run()\n {\n // Admins\n User::factory()->create([\n 'name' => 'Zaiman Noris',\n 'username' => 'rognales',\n 'email' => '[email protected]',\n 'active' => true,\n ]);\n\n User::factory()->create([\n 'name' => 'Affiq Rashid',\n 'username' => 'affiqr',\n 'email' => '[email protected]',\n 'active' => true,\n ]);\n\n // Only seed test data in non-prod\n if (! app()->isProduction()) {\n Member::factory()->count(1000)->create();\n Staff::factory()->count(1000)->create();\n\n Participant::factory()\n ->addSpouse()\n ->addChildren()\n ->addInfant()\n ->addOthers()\n ->count(500)\n ->hasUploads(2)\n ->create();\n }\n }", "public function run()\n {\n $this->call([\n RoleSeeder::class,\n UserSeeder::class,\n ]);\n\n \\App\\Models\\Category::factory(4)->create();\n \\App\\Models\\View::factory(6)->create();\n \\App\\Models\\Room::factory(8)->create();\n \n $rooms = \\App\\Models\\Room::all();\n // \\App\\Models\\User::all()->each(function ($user) use ($rooms) { \n // $user->rooms()->attach(\n // $rooms->random(rand(1, \\App\\Models\\Room::max('id')))->pluck('id')->toArray()\n // ); \n // });\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n Employee::factory()->create(['email' => '[email protected]']);\n Brand::factory()->count(3)->create();\n $this->call([\n TagSeeder::class,\n AttributeSeeder::class,\n AttributeValueSeeder::class,\n ProductSeeder::class,\n ]);\n }", "public function run()\n {\n $this->call(RolesTableSeeder::class); // crée les rôles\n $this->call(PermissionsTableSeeder::class); // crée les permissions\n\n factory(Employee::class,3)->create();\n factory(Provider::class,1)->create();\n\n $user = User::create([\n 'name'=>'Alioune Bada Ndoye',\n 'email'=>'[email protected]',\n 'phone'=>'773012470',\n 'password'=>bcrypt('123'),\n ]);\n Employee::create([\n 'job'=>'Informaticien',\n 'user_id'=>User::where('email','[email protected]')->first()->id,\n 'point_id'=>Point::find(1)->id,\n ]);\n $user->assignRole('admin');\n }", "public function run()\n {\n // $this->call(UserSeeder::class);\n factory(User::class, 1)\n \t->create(['email' => '[email protected]']);\n\n factory(Category::class, 5)->create();\n }", "public function run()\n {\n //$this->call(UsersTableSeeder::class);\n $this->call(rootSeed::class);\n factory(App\\Models\\Egresado::class,'hombre',15)->create();\n factory(App\\Models\\Egresado::class,'mujer',15)->create();\n factory(App\\Models\\Administrador::class,5)->create();\n factory(App\\Models\\Notificacion::class,'post',10)->create();\n factory(App\\Models\\Notificacion::class,'mensaje',5)->create();\n factory(App\\Models\\Egresado::class,'bajaM',5)->create();\n factory(App\\Models\\Egresado::class,'bajaF',5)->create();\n factory(App\\Models\\Egresado::class,'suscritam',5)->create();\n factory(App\\Models\\Egresado::class,'suscritaf',5)->create();\n }", "public function run()\n {\n \n User::factory(1)->create([\n 'rol'=>'EPS'\n ]);\n Person::factory(10)->create();\n $this->call(EPSSeeder::class);\n $this->call(OfficialSeeder::class);\n $this->call(VVCSeeder::class);\n $this->call(VaccineSeeder::class);\n }", "public function run()\n {\n // $faker=Faker::create();\n // foreach(range(1,100) as $index)\n // {\n // DB::table('products')->insert([\n // 'name' => $faker->name,\n // 'price' => rand(10,100000)/100\n // ]);\n // }\n }", "public function run()\n {\n $this->call([\n LanguagesTableSeeder::class,\n ListingAvailabilitiesTableSeeder::class,\n ListingTypesTableSeeder::class,\n RoomTypesTableSeeder::class,\n AmenitiesTableSeeder::class,\n UsersTableSeeder::class,\n UserLanguagesTableSeeder::class,\n ListingsTableSeeder::class,\n WishlistsTableSeeder::class,\n StaysTableSeeder::class,\n GuestsTableSeeder::class,\n TripsTableSeeder::class,\n ReviewsTableSeeder::class,\n RatingsTableSeeder::class,\n PopularDestinationsTableSeeder::class,\n ImagesTableSeeder::class,\n ]);\n\n // factory(App\\User::class, 5)->states('host')->create();\n // factory(App\\User::class, 10)->states('hostee')->create();\n\n // factory(App\\User::class, 10)->create();\n // factory(App\\Models\\Listing::class, 30)->create();\n }", "public function run()\n {\n Schema::disableForeignKeyConstraints();\n Grade::truncate();\n Schema::enableForeignKeyConstraints();\n\n $faker = \\Faker\\Factory::create();\n\n for ($i = 0; $i < 10; $i++) {\n Grade::create([\n 'letter' => $faker->randomElement(['а', 'б', 'в']),\n 'school_id' => $faker->unique()->numberBetween(1, School::count()),\n 'level' => 1\n ]);\n }\n }", "public function run()\n {\n // $this->call(UserSeeder::class);\n factory(App\\User::class,5)->create();//5 User created\n factory(App\\Model\\Genre::class,5)->create();//5 genres\n factory(App\\Model\\Film::class,6)->create();//6 films\n factory(App\\Model\\Comment::class, 20)->create();// 20 comments\n }", "public function run()\n {\n\n $this->call(UserSeeder::class);\n factory(Empresa::class,10)->create();\n factory(Empleado::class,50)->create();\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n User::create([\n 'name' => 'jose luis',\n 'email' => '[email protected]',\n 'password' => bcrypt('xxxxxx'),\n 'role' => 'admin',\n ]);\n\n Category::create([\n 'name' => 'inpods',\n 'description' => 'auriculares inalambricos que funcionan con blouthue genial'\n ]);\n\n Category::create([\n 'name' => 'other',\n 'description' => 'otra cosa diferente a un inpods'\n ]);\n\n\n /* Create 10 products */\n Product::factory(10)->create();\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(User::class)->create([\n 'email' => '[email protected]',\n 'name' => 'Russell'\n ]);\n\n factory(User::class)->create([\n 'email' => '[email protected]',\n 'name' => 'Bitfumes'\n ]);\n\n factory(User::class)->create([\n 'email' => '[email protected]',\n 'name' => 'Paul'\n ]);\n }", "public function run()\n {\n $user_ids = [1,2,3];\n $faker = app(\\Faker\\Generator::class);\n $posts = factory(\\App\\Post::class)->times(50)->make()->each(function($post) use ($user_ids,$faker){\n $post->user_id = $faker->randomElement($user_ids);\n });\n \\App\\Post::insert($posts->toArray());\n }", "public function run()\n {\n // Vaciar la tabla.\n Favorite::truncate();\n $faker = \\Faker\\Factory::create();\n // Crear artículos ficticios en la tabla\n\n // factory(App\\Models\\User::class, 2)->create()->each(function ($user) {\n // $user->users()->saveMany(factory(App\\Models\\User::class, 25)->make());\n //});\n }", "public function run()\n\t{\n\t\t$this->call(ProductsTableSeeder::class);\n\t\t$this->call(CategoriesTableSeeder::class);\n\t\t$this->call(BrandsTableSeeder::class);\n\t\t$this->call(ColorsTableSeeder::class);\n\n\t\t$products = \\App\\Product::all();\n \t$categories = \\App\\Category::all();\n \t$brands = \\App\\Brand::all();\n \t$colors = \\App\\Color::all();\n\n\t\tforeach ($products as $product) {\n\t\t\t$product->colors()->sync($colors->random(3));\n\n\t\t\t$product->category()->associate($categories->random(1)->first());\n\t\t\t$product->brand()->associate($brands->random(1)->first());\n\n\t\t\t$product->save();\n\t\t}\n\n\t\t// for ($i = 0; $i < count($products); $i++) {\n\t\t// \t$cat = $categories[rand(0,5)];\n\t\t// \t$bra = $brands[rand(0,7)];\n\t\t// \t$cat->products()->save($products[$i]);\n\t\t// \t$bra->products()->save($products[$i]);\n\t\t// }\n\n\t\t// $products = factory(App\\Product::class)->times(20)->create();\n\t\t// $categories = factory(App\\Category::class)->times(6)->create();\n\t\t// $brands = factory(App\\Brand::class)->times(8)->create();\n\t\t// $colors = factory(App\\Color::class)->times(15)->create();\n\t}", "public function run()\n {\n /*$this->call(UsersTableSeeder::class);\n $this->call(GroupsTableSeeder::class);\n $this->call(TopicsTableSeeder::class);\n $this->call(CommentsTableSeeder::class);*/\n DB::table('users')->insert([\n 'name' => 'pkw',\n 'email' => '[email protected]',\n 'password' => bcrypt('secret'),\n 'type' => '1'\n ]);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $faker = Faker::create();\n foreach (range(1,200) as $index) {\n DB::table('users')->insert([\n 'name' => $faker->name,\n 'email' => $faker->email,\n 'phone' => $faker->randomDigitNotNull,\n 'address'=> $faker->streetAddress,\n 'password' => bcrypt('secret'),\n ]);\n }\n }", "public function run()\n {\n $this->call(UsersSeeder::class);\n User::factory(2)->create();\n Company::factory(2)->create();\n\n }", "public function run()\n {\n echo PHP_EOL , 'seeding roles...';\n\n Role::create(\n [\n 'name' => 'Admin',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Principal',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Teacher',\n 'deletable' => false,\n ]\n );\n\n Role::create(\n [\n 'name' => 'Student',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Parents',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Accountant',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Librarian',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Receptionist',\n 'deletable' => false,\n ]\n );\n\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // $this->call(QuestionTableSeed::class);\n\n $this->call([\n QuestionTableSeed::class,\n AlternativeTableSeed::class,\n ScheduleActionTableSeeder::class,\n UserTableSeeder::class,\n CompanyClassificationTableSeed::class,\n ]);\n // DB::table('clients')->insert([\n // 'name' => 'Empresa-02',\n // 'email' => '[email protected]',\n // 'password' => bcrypt('07.052.477/0001-60'),\n // ]);\n }", "public function run()\n {\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 5; $i++) {\n Runner::create([\n 'external_id' => $faker->uuid,\n 'name' => $faker->name,\n 'race_id' =>rand(1,5),\n 'age' => rand(30, 45),\n 'sex' => $faker->randomElement(['male', 'female']),\n 'color' => $faker->randomElement(['#ecbcb4', '#d1a3a4']),\n ]);\n }\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n\n User::factory()->create([\n 'name' => 'Carlos',\n 'email' => '[email protected]',\n 'email_verified_at' => now(),\n 'password' => bcrypt('123456'), // password\n 'remember_token' => Str::random(10),\n ]);\n \n $this->call([PostsTableSeeder::class]);\n $this->call([TagTableSeeder::class]);\n\n }", "public function run()\n {\n $this->call(AlumnoSeeder::class);\n //Alumnos::factory()->count(30)->create();\n //DB::table('alumnos')->insert([\n // 'dni_al' => '13189079',\n // 'nom_al' => 'Jose',\n // 'ape_al' => 'Araujo',\n // 'rep_al' => 'Principal',\n // 'esp_al' => 'Tecnologia',\n // 'lnac_al' => 'Valencia'\n //]);\n }", "public function run()\n {\n Eloquent::unguard();\n\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n\n // $this->call([\n // CountriesTableSeeder::class,\n // ]);\n\n factory(App\\User::class, 100)->create();\n factory(App\\Type::class, 10)->create();\n factory(App\\Item::class, 100)->create();\n factory(App\\Order::class, 1000)->create();\n\n $items = App\\Item::all();\n\n App\\Order::all()->each(function($order) use ($items) {\n\n $n = rand(1, 10);\n\n $order->items()->attach(\n $items->random($n)->pluck('id')->toArray()\n , ['quantity' => $n]);\n\n $order->total = $order->items->sum(function($item) {\n return $item->price * $item->pivot->quantity;\n });\n\n $order->save();\n\n });\n\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n factory(User::class)->create(\n [\n 'email'=>'[email protected]',\n 'name'=>'izzanni',\n \n ]\n );\n factory(User::class)->create(\n [\n 'email'=>'[email protected]',\n 'name'=>'aina',\n\n ]\n );\n factory(User::class)->create(\n [\n 'email'=>'[email protected]',\n 'name'=>'sab',\n\n ]\n );\n }", "public function run()\n {\n\n factory('App\\Models\\Pessoa', 60)->create();\n factory('App\\Models\\Profissional', 10)->create();\n factory('App\\Models\\Paciente', 50)->create();\n $this->call(UsersTableSeeder::class);\n $this->call(ProcedimentoTableSeeder::class);\n // $this->call(PessoaTableSeeder::class);\n // $this->call(ProfissionalTableSeeder::class);\n // $this->call(PacienteTableSeeder::class);\n // $this->call(AgendaProfissionalTableSeeder::class);\n }", "public function run()\n {\n //Acá se define lo que el seeder va a hacer.\n //insert() para insertar datos.\n //Array asociativo. La llave es el nombre de la columna.\n// DB::table('users')->insert([\n// //Para un solo usuario.\n// 'name' => 'Pedrito Perez',\n// 'email' => '[email protected]',\n// 'password' => bcrypt('123456')\n// ]);//Se indica el nombre de la tabla.\n\n //Crea 50 usuarios (sin probar)\n// factory(App\\User::class, 50)->create()->each(function($u) {\n// $u->posts()->save(factory(App\\Post::class)->make());\n// });\n\n factory(App\\User::class, 10)->create(); //Así se ejecuta el model factory creado en ModelFactory.php\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n //nhập liệu mẫu cho bảng users\n DB::table('users')->insert([\n \t['id'=>'1001', 'name'=>'Phan Thị Hiền', 'email'=>'[email protected]', 'password'=>'123456', 'isadmin'=>1],\n \t['id'=>'1002', 'name'=>'Phan Thị Hà', 'email'=>'[email protected]', 'password'=>'111111', 'isadmin'=>0]\n ]);\n\n\n //nhập liệu mẫu cho bảng suppliers\n DB::table('suppliers')->insert([\n \t['name'=>'FPT', 'address'=>'151 Hùng Vương, TP. Đà Nẵng', 'phonenum'=>'0971455395'],\n \t['name'=>'Điện Máy Xanh', 'address'=>'169 Phan Châu Trinh, TP. Đà Nẵng', 'phonenum'=>'0379456011']\n ]);\n\n\n //Bảng phiếu bảo hành\n }", "public function run()\n {\n \t// DB::table('categories')->truncate();\n // factory(App\\Models\\Category::class, 10)->create();\n Schema::disableForeignKeyConstraints();\n Category::truncate();\n $faker = Faker\\Factory::create();\n\n $categories = ['SAMSUNG','NOKIA','APPLE','BLACK BERRY'];\n foreach ($categories as $key => $value) {\n Category::create([\n 'name'=>$value,\n 'description'=> 'This is '.$value,\n 'markup'=> rand(10,100),\n 'category_id'=> null,\n 'UUID' => $faker->uuid,\n ]);\n }\n }" ]
[ "0.8013876", "0.79804534", "0.7976992", "0.79542726", "0.79511505", "0.7949612", "0.794459", "0.7942486", "0.7938189", "0.79368967", "0.79337025", "0.78924936", "0.78811055", "0.78790957", "0.78787595", "0.787547", "0.7871811", "0.78701615", "0.7851422", "0.7850352", "0.7841468", "0.7834583", "0.7827792", "0.7819104", "0.78088796", "0.7802872", "0.7802348", "0.78006834", "0.77989215", "0.7795819", "0.77903426", "0.77884805", "0.77862066", "0.7778816", "0.7777486", "0.7765202", "0.7762492", "0.77623445", "0.77621746", "0.7761383", "0.77606887", "0.77596676", "0.7757001", "0.7753607", "0.7749522", "0.7749292", "0.77466977", "0.7729947", "0.77289546", "0.772796", "0.77167094", "0.7714503", "0.77140456", "0.77132195", "0.771243", "0.77122366", "0.7711113", "0.77109736", "0.7710777", "0.7710086", "0.7705484", "0.770464", "0.7704354", "0.7704061", "0.77027386", "0.77020216", "0.77008796", "0.7698617", "0.76985973", "0.76973504", "0.7696405", "0.7694293", "0.7692694", "0.7691264", "0.7690576", "0.76882726", "0.7687433", "0.7686844", "0.7686498", "0.7685065", "0.7683827", "0.7679184", "0.7678287", "0.76776296", "0.76767945", "0.76726556", "0.76708084", "0.76690495", "0.766872", "0.76686716", "0.7666299", "0.76625943", "0.7662227", "0.76613766", "0.7659881", "0.7656644", "0.76539344", "0.76535016", "0.7652375", "0.7652313", "0.7652022" ]
0.0
-1
Directory that users are allowed to place images for importing.
public function getDirectory(): ReadInterface { $path = $this->getDirectoryRelativePath(); return $this->filesystem->getDirectoryReadByPath( $this->filesystem->getDirectoryRead(DirectoryList::ROOT)->getAbsolutePath($path) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function getUploadDir()\n {\n return 'images';\n }", "protected function getUploadRootDirImg() {\n // guardar los archivos cargados\n return __DIR__ . '/../../../../web/uploads/portafolios/' . $this->getId() . '/img';\n }", "public function getImagesFolder()\n {\n return defined(static::class . '::IMAGES') ? static::IMAGES : 'images';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/user/images';\n }", "public function getUploadImageDir()\n {\n return 'uploads/images';\n }", "protected function getUploadDir()\r\n {\r\n // when displaying uploaded doc/image in the view.\r\n return 'uploads/images';\r\n }", "protected function getImageUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return $this->getUploadRootDir().\"pictures/\";\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/users';\n }", "protected function getUploadDir()\n {\n return 'uploads/images';\n }", "public function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'web/images';\n }", "public function getPhotoUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'upload/admin/user';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/warranty_images';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'pictures';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/ads/images';\n }", "public function getDirectory()\n {\n return mfConfig::get('mf_sites_dir').\"/\".$this->getSiteName().\"/\".$this->getApplication().\"/view/pictures/\".$this->get('lang');\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/user';\n }", "protected function getUploadDir() {\n // when displaying uploaded doc/image in the view.\n return 'uploads/contact/contactlist/images';\n }", "protected function getUploadRootDir()\n {\n \t// guardar los archivos cargados\n \treturn 'uploads/registros/';\n }", "protected function getUploadRootDir()\n {\n // documents should be saved\n return __DIR__.'/../../../uploads/user/';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/images/agancy';\n }", "public function get_files_directory() {\n return '../data/files/' . hash_secure($this->name);\n }", "private function set_directory(){\n if(!is_dir($this->img_dir)) mkdir($this->img_dir);\n if(!is_dir($this->thumb_dir)) mkdir($this->thumb_dir);\n }", "public function getUploadDir(){\n return dirname(_FILE_). \"/img/\";\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/documents/images/profile';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/photos';\n }", "protected function destinationUploadDir()\n {\n return public_path(env('UPLOAD_DIR_GALLERY', 'media/images/galleries'));\n }", "abstract public function directoryLocation();", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'images/about_us';\n }", "public function getImageDirectoryAttribute()\n {\n return 'images/data/trait-categories';\n }", "private function uploadFolder()\n {\n return \"instagram/{$this->InstagramUserID}\";\n }", "public function getUploadDir()\n {\n return 'uploads/images';\n }", "public function getUploadDir()\n\t{\n\t\treturn 'uploads/ressources';\n\t}", "protected function getUploadRootDir()\n {\n \t// guardar los archivos cargados\n \treturn 'uploads/registros/labels';\n }", "public function getFileBaseDir()\n {\n return Mage::getBaseDir('media').DS.'invitationstatus'.DS.'file';\n }", "public function profilePhotoDirectory(): string\n {\n return config('filament-jet.profile_photo_directory', 'profile-photos');\n }", "protected function getUploadDir() {\n // when displaying uploaded doc/image in the view.\n return 'uploads';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads';\n }", "public static function allowExtrasDir()\n\t{\n\t\treturn MHTTPD::$config['Admin']['allow_extras_dir'];\n\t}", "public function baseDir()\n {\n return 'uploads/photos/';\n }", "protected function getUploadDir()\n {\n \t// when displaying uploaded doc/image in the view.\n \treturn 'uploads/imagen';\n }", "function uploads_dir() {\n\tglobal $root;\n\treturn $root.Media::instance()->path;\n}", "function tp_get_img_dir() {\n\t$file = new ElggFile();\n\t$file->setFilename('image/');\n\treturn $file->getFilenameOnFilestore();\n}", "protected function getUploadDir(): string\n {\n // when displaying uploaded doc/image in the view.\n return 'image_room_directory';\n }", "static public function getImageRootPath() {\n\t\treturn Page::$base_images_path;\n\t}", "public function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads';\n }", "public function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads';\n }", "protected function getUploadDir() {\n // when displaying uploaded doc/image in the view.\n return 'uploads/';\n }", "protected function getUploadDir()\n {\n // al mostrar el documento/imagen cargada en la vista.\n return 'usuarios/fotos_perfil';\n }", "protected function getUploadDir()\n\t{\n\t\t// get rid of the __DIR__ so it doesn't screw when displaying uploaded doc/image\n\t\t// in the view.\n\t\treturn 'uploads/mybudget';\n\t}", "public function directory();", "public function getUploadDir()\n {\n return 'uploads/img';\n }", "public function getUploadDir()\n {\n return 'uploads/img';\n }", "public function getUploadDir() {\n \treturn 'uploads/img';\n }", "public function getUploadDir()\n {\n // image profile should be saved\n return __DIR__.'/../../../../web/uploads/evento/'.$this->id;\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/devis';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return '/uploads/users/'.$this->getId().'/';\n }", "public function testImagesDirBase(): void\n {\n $this->expectException(\\Magento\\Framework\\Exception\\LocalizedException::class);\n $this->expectExceptionMessage('Images file directory is outside required directory');\n\n $this->_model->setData(\n Import::FIELD_NAME_VALIDATION_STRATEGY,\n ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_SKIP_ERRORS\n );\n $this->_model->setEntity('catalog_product');\n $this->_model->setData(Import::FIELD_NAME_IMG_FILE_DIR, '../_files');\n $this->_model->importSource();\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/models';\n }", "protected static function publicFilesDirectoryFallback() {\n return PathResolver::siteDirectory() . '/files';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/guide';\n }", "public function isDirectoryCopyAllowed() {}", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'archivos';\n }", "public function getFileDirectory();", "public function getImageDirectoryAttribute()\n {\n return 'images/data/event';\n }", "protected function action_getUserMainDir() {}", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/documents/w2share';\n }", "public function getFileBaseDir()\n {\n return Mage::getBaseDir('media').DS.'family'.DS.'file';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/documents';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/documents';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/documents';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/documents';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/documents';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/documents';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/documents';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/documents';\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/articles';\n }", "protected function getUploadRootDir()\n {\n //$racine = sudo chmod ;\n return __DIR__.'/../../../web/ressources/uploads/'.$this->getUploadDir();\n }", "public function getPhotoUploadRootDir()\n {\n // documents should be saved\n return __DIR__ . '/../../../web/' . $this->getPhotoUploadDir();\n }", "protected function getImageBasePath()\n\t{\n\t\treturn rtrim($this->config->get('folder', public_path('images')), '/');\n\t}", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/lots';\n }", "function getImageDir () {\n return $this->dir;\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return static::UPLOAD_DIRECTORY;\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'upload/documents';\n }", "private function images()\n {\n return File::allFiles(public_path('img/gallery'));\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/products';\n }", "function check_dir() \n\t{\n @chmod($this->path_to_assets,0777);\n $this->createDir(ABSPATH.\"wp-includes/\".$this->books_dir);\n $this->createDir(ABSPATH.\"wp-includes/\".$this->images_dir);\n\t\t /// echo $this->plugin_path.$this->images_dir.\" \\n\";\n\t\t //echo $this->path_to_assets.\" \\n\";\n }", "protected function getUploadDir(): string\n {\n return 'uploads/img';\n }", "protected function getUploadRootDir()\n {\n // documents should be saved\n return __DIR__.'/../../../../../web/'.$this->getUploadDir();\n }", "protected function getUploadDir()\n {\n return 'uploads';\n }", "function mkImageDir()\r\n {\r\n $buff = wp_upload_dir(); \r\n if (trim($this->config->get('imgPath')) != (str_replace(get_bloginfo('wpurl'), '', $buff['baseurl']) . '/')) {\r\n $this->uploadMediaOn = false;\r\n }\r\n \r\n if (!file_exists($this->rootPath . $this->config->get('imgPath'))) mkdir($this->rootPath . $this->config->get('imgPath'), 0777);\r\n \r\n if ($this->uploadMediaOn and get_option('uploads_use_yearmonth_folders')) {\r\n $this->imageDir = date('Y') . '/';\r\n $imageDirPath = $this->rootPath . $this->config->get('imgPath') . $this->imageDir;\r\n if (!file_exists($this->imageDir)) mkdir($this->imageDir, 0777);\r\n \r\n $this->imageDir = $this->imageDir . date('m') . '/';\r\n if (!file_exists($this->imageDir)) mkdir($this->imageDir, 0777);\r\n }\r\n return true;\r\n }", "protected function getUploadRootDir()\n {\n // documents should be saved\n return __DIR__.'/../../../../web/'.$this->getUploadDir();\n }", "protected function getUploadDir()\n {\n // al mostrar el documento/imagen cargada en la vista.\n return 'bundles/jygrevestimientos/images/materiales';\n }", "function checkImgPath()\n {\n if (is_dir($this->getPath() . '/img/')) {\n $this->setImgPath($this->getPath() . '/img/');\n return true;\n } elseif (is_dir($GLOBALS['cfg']['ThemePath'] . '/original/img/')) {\n $this->setImgPath($GLOBALS['cfg']['ThemePath'] . '/original/img/');\n return true;\n } else {\n trigger_error(\n sprintf($GLOBALS['strThemeNoValidImgPath'], $this->getName()),\n E_USER_ERROR);\n return false;\n }\n }", "public function getFilesDirectoryPath();", "public function getUploadDir()\n {\n return 'uploads/img/category';\n }", "protected function getUploadFotoDir() {\n return 'uploads/produtos/produto/';\n }", "public function baseDir() {\n return 'src/public/FlyerPhotos/photos';\n }", "public static function getDestination()\n {\n return public_path() . '/img/profile_photos/';\n }", "protected function getUploadDir()\n {\n // al mostrar el documento/imagen cargada en la vista.\n return 'uploads/images/equipo';\n }", "protected function getUploadRootDir()\n {\n return __DIR__ . '/../../../../web/' . self::UPLOAD_ROOT;\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'documents';\n }" ]
[ "0.649574", "0.6274508", "0.626752", "0.62422156", "0.6142182", "0.61290085", "0.6107396", "0.61045575", "0.609239", "0.60852534", "0.6082692", "0.6077527", "0.60754645", "0.6074158", "0.6015895", "0.60075384", "0.5997599", "0.5986119", "0.5979913", "0.5978961", "0.5947457", "0.5900975", "0.58989346", "0.5897072", "0.5882433", "0.5879497", "0.585771", "0.58558863", "0.584622", "0.5837698", "0.58368397", "0.58352715", "0.58293796", "0.5818704", "0.58162177", "0.5815031", "0.5801408", "0.580135", "0.5793976", "0.57913095", "0.5788557", "0.5756905", "0.5755962", "0.5753052", "0.57482994", "0.57482994", "0.57440346", "0.5731572", "0.5727713", "0.5722325", "0.571706", "0.571706", "0.5710745", "0.5701441", "0.5686356", "0.56790453", "0.56489915", "0.5642658", "0.5622311", "0.5619814", "0.5617491", "0.56167847", "0.56139815", "0.5604085", "0.5592968", "0.5588161", "0.5586221", "0.55853266", "0.55853266", "0.55853266", "0.55853266", "0.55853266", "0.55853266", "0.55853266", "0.55853266", "0.55839264", "0.55748415", "0.5574549", "0.5571343", "0.5570661", "0.5568148", "0.5566059", "0.5563354", "0.554589", "0.55235934", "0.5508368", "0.5504952", "0.54987335", "0.54970753", "0.5494044", "0.549135", "0.5475655", "0.5474906", "0.5469466", "0.5458414", "0.5457367", "0.54327685", "0.5432705", "0.5423718", "0.5413664", "0.54102534" ]
0.0
-1
The directory's path relative to Magento root.
public function getDirectoryRelativePath(): string { return $this->config->getValue('general/file/import_images_base_dir'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dirPath() {return (\"../../../../\"); }", "function dirPath () { return (\"../../\"); }", "function dirPath() { return (\"../\"); }", "public function getSystemDirectoryPath() {\n return Mage::getBaseDir('var') . '/smartling/localization_files';\n }", "public function getDir() {\n return Yii::getAlias('@static').'/'.$this->module.'/'. $this->parent_id .'/';\n }", "public function getFileBaseDir()\n {\n return Mage::getBaseDir('media').DS.'invitationstatus'.DS.'file';\n }", "public static function getWorkingDir()\n {\n return Mage::getBaseDir('var') . DS . 'storelocator' . DS;\n }", "public function getFileBaseDir()\n {\n return Mage::getBaseDir('media').DS.'family'.DS.'file';\n }", "protected function getPath () {\n\tglobal $Config;\n\treturn $Config->get('dir_root').'/'.$this->dir.'/'.$this->name;\n }", "public static function get_directory() : string {\r\n\t\treturn Core::get_app_path( self::$directory );\r\n\t}", "public function getModuleDir()\n {\n return dirname(Mage::getModuleDir('etc', 'Ts_Phpids')) . DS;\n }", "protected function getPath()\n {\n if (is_null($this->_filePath)) {\n $this->_filePath = str_replace('//', '/', Mage::getBaseDir() .\n $this->getSitemapPath());\n }\n return $this->_filePath;\n }", "function get_dir_path() {\n\n\t\treturn $this->dir_path;\n\n\t}", "public static function getFilesFolderPath() {\n return self::isProductionEnv() ? \"/var/www/html/\".self::$DESIGNS_RELATIVE_PATH : \"../../\".self::$DESIGNS_RELATIVE_PATH;\n }", "public function get_core_dir() {\n\t\t\treturn trailingslashit( $this->settings['base_dir'] );\n\t\t}", "public function getRootDir(){\n\t\treturn str_replace(realpath($_SERVER['DOCUMENT_ROOT']), \"\", realpath(dirname(__DIR__ . \"/../core.php\")));\n\t}", "public function path() {\n\t\t\treturn rtrim($this->application->configuration([ \"packagemanager\", \"directory\" ]), \"/\") . \"/\" . $this->package_directory;\n\t\t}", "public function rootPath()\n {\n return public_path() . $this->helper->ds();\n }", "public function getBasePath()\n {\n return dirname(__DIR__);\n }", "public function getBasePath()\n {\n return dirname(__DIR__);\n }", "protected function getProcessDirectoryPath() {\r\n $processDirName = str_replace(' ', '_', $this->getProcessName());\r\n $dateDirName = Mage::getModel('core/date')->date('Y-m-d');\r\n $this->relativeProcessUrl = \r\n 'var/lycenok/' . $dateDirName . '/' . $processDirName;\r\n $extensionDir = \r\n Mage::getBaseDir('var') . DIRECTORY_SEPARATOR . 'lycenok';\r\n $dirPath = $extensionDir . DIRECTORY_SEPARATOR . $dateDirName \r\n . DIRECTORY_SEPARATOR . $processDirName;\r\n return $dirPath; \r\n}", "protected function getUploadRootDir() {\n // guardar los archivos cargados\n return __DIR__ . '/../../../../web/uploads/portafolios/' . $this->getId();\n }", "protected function getUploadDir()\n {\n return __DIR__ . '/../../../../web' . $this->getFilesPath();\n }", "abstract public function getRelativeDataDir();", "public static function getModulePath()\n {\n return dirname(__DIR__);\n }", "private function getPath()\r\n\t{\r\n\t\treturn WORDWEBPRESS_INCLUDE . \r\n\t\t\t\tWordwebpress::getInstance()->configuration()->get_cfn_value('core_path') .\r\n\t\t\t\tDIRECTORY_SEPARATOR .\r\n\t\t\t\t'Wordwebpress' .\r\n\t\t\t\tDIRECTORY_SEPARATOR .\r\n\t\t\t\t'Admin' .\r\n\t\t\t\tDIRECTORY_SEPARATOR .\r\n\t\t\t\t'Html' .\r\n\t\t\t\tDIRECTORY_SEPARATOR;\r\n\t}", "protected function getUploadRootDir()\n {\n return __DIR__ . '/../../../../web/' . self::UPLOAD_ROOT;\n }", "public function getUploadDir()\n {\n return 'import/fichier/licencies';\n }", "public function getDirectory()\n {\n return mfConfig::get('mf_sites_dir').\"/\".$this->getSiteName().\"/\".$this->getApplication().\"/view/pictures/\".$this->get('lang');\n }", "private function getDir() {\n return sprintf(\"%s/%s/\", app_path(), config('newportal.portlets.namespace'));\n }", "public function getDirectory()\n {\n return $this->_path['dirname'];\n }", "public function dir() {\n\t\treturn dirname($this->_path) . '/';\n\t}", "public function getBasePath()\n {\n return __DIR__ . '/..';\n }", "private function _getSourceFileSystemPath()\n\t{\n\t\treturn rtrim($this->getSettings()->path, '/').'/';\n\t}", "public function getLibDir()\n {\n return Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . DS . 'hycube' . DS . 'geoip';\n }", "public function get_directory_path()\n {\n return $this->directory_path;\n }", "public static function get_directory(): string {\n return Simply_Static\\Options::instance()->get('local_dir') ?: '';\n }", "public function diruri() {\n if(isset($this->cache['diruri'])) return $this->cache['diruri'];\n return $this->cache['diruri'] = ltrim($this->parent()->diruri() . '/' . $this->dirname(), '/');\n }", "public function getUploadDir()\n\t{\n\t\treturn 'uploads/ressources';\n\t}", "protected function getFilesystemPath()\n {\n return dirname($this->path);\n }", "protected function getUploadDir()\n\t{\n\t\t// get rid of the __DIR__ so it doesn't screw when displaying uploaded doc/image\n\t\t// in the view.\n\t\treturn 'uploads/mybudget';\n\t}", "protected static function packagePath(): string\n {\n return dirname(dirname(__DIR__));\n }", "public function getRootDir()\n {\n return __DIR__;\n }", "public function getBasePath()\n {\n return dirname($this->file);\n }", "public function get_full_relative_path(){\n\t\treturn $this->dir . '/' . $this->get_full_name();\n\t}", "private function getPathToRootDir()\n {\n return '%kernel.project_dir%';\n }", "public function getUpgradesPath()\n {\n return Mage::getBaseDir('code')\n . DS\n . $this->_getData('codePool')\n . DS\n . uc_words($this->getId(), DS)\n . DS\n . 'upgrades';\n }", "public function getBaseDir()\n {\n return $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA)->getAbsolutePath(self::MEDIA_PATH);\n\n }", "public function getBaseRootDir()\n {\n return $this->paths->getBaseRootDir();\n }", "public function getRelativeDataDir()\n\t{\n\t\treturn 'ash';\n\t}", "public function getBaseDir();", "public function getWebroot() {\n return Yii::getAlias('@static') .DIRECTORY_SEPARATOR. 'web' .DIRECTORY_SEPARATOR.$this->module.DIRECTORY_SEPARATOR. $this->parent_id .DIRECTORY_SEPARATOR;\n }", "public function getRootDir();", "protected function getUploadRootDir() {\r\n return __DIR__ . '/../../../../web/' . $this->getUploadDir()\r\n\r\n ;\r\n }", "protected function rootPath()\n {\n return Pi::path('upload') . '/' . $this->getModule();\n }", "protected function getRootDir()\n {\n return $this->appConfig->getRootDir();\n }", "public static function get_media_base_dir_path() {\n return self::make_path('cm_root_upload');\n }", "protected function getUploadRootDir()\n {\n return __DIR__ . '/../../../../web/' . $this->getUploadDir();\n }", "public function getAppBaseDirName(){\n return $this->getSite()->getParent()->getAppDir(true);\n }", "public function getPath()\n {\n return $this->directory->getRealPath();\n }", "private function getUploadRootDir()\n {\n return __DIR__ . \"/../../../../web\" . $this->getUploadDir();\n }", "public function getPath()\n {\n return __DIR__ . '/settings';\n }", "public function getPath(): string\n {\n return $this->directory->getPath();\n }", "function parcelcheckout_getRootPath()\n\t{\n\t\t$sRootPath = dirname(dirname(dirname(__FILE__)));\n\n\t\tif(strpos($sRootPath, '\\\\') !== false)\n\t\t{\n\t\t\t$sRootPath .= '\\\\';\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$sRootPath .= '/';\n\t\t}\n\n\t\treturn $sRootPath;\n\t}", "public function getAbsoluteDirname(){\n\t \treturn Yii::getPathOfAlias('webroot').'/'.$this->dirname;\n\t }", "abstract public function directoryLocation();", "public function getPhotoUploadRootDir()\n {\n // documents should be saved\n return __DIR__ . '/../../../web/' . $this->getPhotoUploadDir();\n }", "protected function getUploadDir()\n {\n // when displaying uploaded doc/image in the view.\n return 'uploads/products';\n }", "public function get_root_path()\n\t{\n\t\treturn $this->ext_root_path;\n\t}", "public function getPath()\n {\n return str_replace(\n ['/', '\\\\'],\n Storage::GetSeparator(),\n Storage::GetPath() . '/' . $this->dirname . '/' . $this->basename\n );\n }", "function uploads_dir() {\n\tglobal $root;\n\treturn $root.Media::instance()->path;\n}", "public function getPath(){\n\t \treturn $this->dirname.'/'.$this->filename.'.'.$this->extension;\n\t }", "final function getDirectory () { return $this->xml_dir->path; }", "public function getUploadRootDir() {\n return __DIR__ . '/../../../../web/' . $this->getUploadDir();\n }", "public function GetRealPath()\n {\n return PATH_CMS_CUSTOMER_DATA.'/'.$this->GetRealFileName();\n }", "public function getBaseDir()\n {\n return $this->filesystem\n ->getDirectoryRead(DirectoryList::MEDIA)\n ->getAbsolutePath(self::MEDIA_PATH);\n }", "protected function getUploadRootDir() {\n return __DIR__ . '/../../../../web/' . $this->getUploadDir();\n }", "public function get_base_dir()\r\n\t\t{\r\n\t\t\treturn str_replace( \"/\", DIRECTORY_SEPARATOR, __DIR__ . \"/../../\" . self::HOME_DIR );\r\n\t\t}", "public function getFileRootPath(): string\n {\n return str_replace(\n ':',\n '.',\n $this->getDatasetSubmission()->getDataset()->getUdi()\n ) . DIRECTORY_SEPARATOR;\n }", "protected function getUploadRootDir()\r\n\t{\r\n\t\treturn __DIR__.'/../../../../web/'.$this->getUploadDir();\r\n\t}", "public function getInstallDirectory() {\n if ($this->isInstalled() && ($relative_path = \\Drupal::service('extension.list.theme')->getPath($this->name))) {\n // The return value of\n // \\Drupal::service('extension.list.theme')->getPath() is always relative\n // to the site, so prepend DRUPAL_ROOT.\n return DRUPAL_ROOT . '/' . dirname($relative_path);\n }\n else {\n // When installing a new theme, prepend the requested root directory.\n return $this->root . '/' . $this->getRootDirectoryRelativePath();\n }\n }", "public function getRelativePath(){\n\t\treturn 'Less';\n\t}", "public static function module_path() {\n return static::config()->get('module_path') ?: realpath(__DIR__ . '/../');\n }", "public function base_dir(){\n return $this->plugin_dir() . 'base/';\n }", "protected function getBasePath()\n {\n return getcwd();\n }", "public function getViewPath()\n {\n return dirname(__DIR__);\n }", "public function get_module_path()\n\t{\n\t\tif (is_subclass_of($this, 'CmsModuleBase'))\n\t\t{\n\t\t\treturn cms_join_path(ROOT_DIR, 'modules' , $this->get_name());\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn dirname(__FILE__);\n\t\t}\n\t}", "public function getLocalPath()\r\n\t{\r\n\t\t$accountNumber = $this->getAccountNumber();\r\n\r\n\t\t$file_dir = AntConfig::getInstance()->data_path.\"/$accountNumber/userfiles\";\r\n\t\t$file_dir2 = AntConfig::getInstance()->data_path.\"/$accountNumber/userfiles\";\r\n\t\t\r\n\t\tif ($this->owner_id!=null)\r\n\t\t{\r\n\t\t\t$file_dir .= \"/\".$this->owner_id;\r\n\t\t\t$file_dir2 .= \"/\".$this->owner_id;\r\n\t\t}\r\n\r\n\t\tif (!file_exists($file_dir.\"/\".$this->name_lcl))\r\n\t\t{\r\n\t\t\tif (file_exists($file_dir2.\"/\".$this->name_lcl))\r\n\t\t\t\t$file_dir = $file_dir2;\r\n\t\t}\r\n\r\n\t\t$file_dir .= \"/\".$this->name_lcl;\r\n\r\n\t\treturn $file_dir;\r\n\t}", "public function getAbsoluteDir()\n {\n return $this->getMachine()->getHome() . '/' . $this->getDir() . '/';\n }", "protected function getResourceDir(): string\n {\n $dirParts = [\n AutoloaderInterface::MODULES_PATHNAME,\n $this->getModuleContext(),\n 'res'\n ];\n\n return implode(DIRECTORY_SEPARATOR, $dirParts);\n }", "function getWebsiteRootPath()\n {\n // Check that the absolute path to the current directory is accessible\n // (some webhosts denies access this way)\n if ( file_exists (FCPATH) ) {\n return FCPATH;\n } else {\n // Fake relative path by using subdirectory\n return 'js/../';\n }\n }", "protected function getPackageRootPath(): string\n {\n return getcwd() . '/';\n }", "public function getPath()\n {\n return $this->_folder . DIRECTORY_SEPARATOR . $this->_name;\n }", "protected function getBasePath()\n {\n return $this->vfs()->url();\n }", "public function getProjectDirectory(): string\n {\n return realpath(__DIR__ . '/../../project/sylius');\n }", "private function getUploadRootDir(){\n \treturn __DIR__.'/../../../../web/'.$this->getUploadDir();\n }", "public function get_files_directory() {\n return '../data/files/' . hash_secure($this->name);\n }", "protected function getRedirectsDir(): string\n {\n return Craft::getAlias('@webroot') . '/../redirects/';\n }", "protected function getUploadRootDir()\r\n {\r\n // documents should be saved\r\n return __DIR__.'/../../../../web/'.$this->getUploadDir();\r\n }", "public function getUploadRootDir()\n {\n // documents should be saved\n return __DIR__.'/../../../web/'.$this->getUploadDir().\"/\".$this->getHash();\n }" ]
[ "0.7859769", "0.78360724", "0.780368", "0.75862926", "0.7585584", "0.7483402", "0.7382295", "0.7363991", "0.7294507", "0.7288443", "0.72712487", "0.7257862", "0.72456384", "0.71722764", "0.71362966", "0.71315885", "0.7119225", "0.7109731", "0.709021", "0.709021", "0.70663756", "0.70650506", "0.705088", "0.7047859", "0.7046037", "0.7033377", "0.7031714", "0.7020976", "0.6985424", "0.6966054", "0.695664", "0.6941503", "0.6915012", "0.6906794", "0.69031227", "0.6903003", "0.689158", "0.68909967", "0.6872873", "0.686049", "0.68570113", "0.6853879", "0.68454784", "0.6843608", "0.68429863", "0.68423516", "0.6837017", "0.68354106", "0.68312776", "0.68273985", "0.6813094", "0.6807987", "0.680174", "0.67890596", "0.6788931", "0.67825514", "0.67821807", "0.67810994", "0.67768145", "0.6775592", "0.6773259", "0.67730725", "0.67711335", "0.6768389", "0.67680645", "0.6764476", "0.6754294", "0.67506695", "0.6750527", "0.67464346", "0.6743904", "0.6738117", "0.673769", "0.67353743", "0.67262655", "0.6723536", "0.6714681", "0.6712326", "0.67121905", "0.67121285", "0.67085946", "0.67081934", "0.67079926", "0.67069423", "0.6702848", "0.6689137", "0.66865087", "0.66853434", "0.6684017", "0.66826844", "0.66778064", "0.66735417", "0.6672947", "0.66723394", "0.6669377", "0.665883", "0.6658217", "0.6656781", "0.6655674", "0.6650422" ]
0.7299077
8
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 validation rules that apply to the request.
public function rules() { return [ 'nombres'=>'required | max:100 |regex:/^([ a-zA-ZñÑáéíóúÁÉÍÓÚ_-])+((\s*)+([ a-zA-ZñÑáéíóúÁÉÍÓÚ_-]*)*)+$/', 'carnet'=>'required | max:100', 'apellidos'=>'required | max:100 | regex:/^([ a-zA-ZñÑáéíóúÁÉÍÓÚ_-])+((\s*)+([ a-zA-ZñÑáéíóúÁÉÍÓÚ_-]*)*)+$/', 'sexo'=>'required' , 'correo'=>'required', 'carrera'=>'required', 'curriculum'=>'mimes:pdf| max:10000', 'partida'=>'mimes:pdf| max:10000' ]; }
{ "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 }", "protected function getValidationRules()\n {\n $class = $this->model;\n\n return $class::$rules;\n }", "public function rules()\n {\n $data = $this->request->all();\n $rules['username'] = 'required|email';\n $rules['password'] = 'required'; \n\n return $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 }", "protected function get_validation_rules()\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 }", "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 defineValidationRules()\n {\n return [];\n }", "public function rules(Request $request)\n {\n return Qc::$rules;\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.8342703", "0.80143493", "0.7937251", "0.79264987", "0.79233825", "0.79048395", "0.78603816", "0.7790699", "0.77842164", "0.77628785", "0.7737272", "0.7733618", "0.7710535", "0.7691693", "0.76849866", "0.7683038", "0.7683038", "0.7683038", "0.7683038", "0.7683038", "0.7683038", "0.7675849", "0.76724476", "0.76665044", "0.7657698", "0.7641827", "0.7630892", "0.76293766", "0.7617708", "0.76102096", "0.7607475", "0.7602442", "0.7598732", "0.7597544", "0.75924", "0.75915384", "0.7588146", "0.7581354", "0.7555758", "0.755526", "0.7551423", "0.7546329", "0.7541439", "0.75366044", "0.75363225", "0.7530296", "0.7517988", "0.75155175", "0.7508439", "0.75069886", "0.7505724", "0.749979", "0.7495976", "0.74949056", "0.7492888", "0.7491117", "0.74901396", "0.7489651", "0.7486808", "0.7486108", "0.7479687", "0.7478561", "0.7469412", "0.74635684", "0.74619836", "0.7461325", "0.74591017", "0.7455279", "0.745352", "0.7453257", "0.7449877", "0.74486", "0.7441391", "0.7440429", "0.7435489", "0.7435326", "0.74341524", "0.7430354", "0.7429103", "0.7423808", "0.741936", "0.74152505", "0.7414828", "0.741382", "0.74126065", "0.74105227", "0.740555", "0.7404385", "0.74040926", "0.74015605", "0.73905706", "0.73837525", "0.73732615", "0.7371123", "0.7369176", "0.73619753", "0.73554605", "0.73448825", "0.7344659", "0.73427117", "0.73357755" ]
0.0
-1
Handle the product "created" event.
public function created(Seller $seller) { $transaction = new Transaction(); $transaction->amount = 0; $transaction->seller_id = $seller->id; $transaction->save(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function notifyProductCreated(ProductCreatedEvent $event) : void\n {\n // prepare Product data to use it in email template\n // us some Mailer to send Email notification\n }", "public function created(Product $product)\n {\n $loggerService = new ProductLoggerService($product);\n $loggerService->productCreated();\n }", "public function created(Product $product): void\n {\n Artisan::queue('product:update-category-products-count');\n }", "public function created(Product $producto)\n {\n\n // Notification::route('slack', env('SLACK_HOOK'))\n // ->notify(new NewSaleNotification());\n //auth()->user()->notify(new NewSaleNotification());\n //Notification::send(User::first(), new NewSaleNotification());\n\n //Notification::route('slack', env('SLACK_NOTIFICATION_WEBHOOK'))\n // ->notify(new NewSaleNotification);\n // \\Log::info('asdasdasdasdasd');\n }", "public function create(Product $product)\n {\n \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}", "public function productsCreate(Request $request)\n {\n try {\n\n \\Log::info('Data incoming from Shopify ProductsCreate Webhook');\n //retrieving json data\n $content = json_decode($request->getContent(), true);\n\n app(ProductService::class)->queueProductsCreateConversionTriggers($content);\n\n return response('', 202);\n } catch (\\Exception $e) {\n \\Log::error(sprintf('Could not process data from Shopify ProductsCreate webhook => %s', $e->getMessage()));\n\n return response('Error occurred', 500);\n }\n\n }", "public function create() {\n\t\t$product = Product::create([\n\t\t\t'title' => '',\n\t\t]);\n\n\t\tif ($product) {\n\t\t\treturn redirect()->route('products.edit', $product->id);\n\t\t}\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 run()\n {\n //\n \tProduct::create(array(\n \t\t'collection_id' => 1,\n \t\t'categories_id' => 1,\n \t\t'name' => \"iphone\",\n \t\t'description' => 'test',\n \t\t'image' => '',\n \t\t'detail' => ''\n \t));\n }", "public function create()\n {\n // Not needed cause this is coming from the item listing\n }", "function create() {\r\n\t\tglobal $ufoSession;\r\n\t\tglobal $ufoDb;\r\n\t\t$link = $ufoDb->getLink();\r\n\t\t$this->uid = $ufoSession->userId();\r\n\r\n\t\t// insert\r\n\t\t$query = \"INSERT INTO ufo_product (uid, name, description) VALUES ($this->uid, '$this->name', '$this->description')\";\r\n\t\t$result = pg_query($query) or die(\"Query failed : \" . pg_last_error());\r\n\t\t/* Get the auto increment Id of the last insert. */\r\n\t\t$this->oid = $ufoDb->insert_id(\"ufo_product_seq\");\r\n\t\t$this->initialized = True;\r\n\t}", "public function created(ProductImage $productImage)\n {\n CompressImg::dispatch($productImage->path);//压缩图片\n }", "public function product_detail() {\n\t\t// double tracking as there could be multiple buy buttons on the page.\n\t\tif ( $this->has_tracked_detail ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$this->has_tracked_detail = true;\n\n\t\t// If page reload, then return\n\t\tif ( monsterinsights_is_page_reload() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$product_id = get_the_ID();\n\n\t\t// Output view product details EE\n\t\t$js = $this->enhanced_ecommerce_add_product( $product_id );\n\n\t\t// Output setAction for EC funnel\n\t\t$js .= $this->get_funnel_js( 'viewed_product' );\n\n\t\t// Add JS to output queue\n\t\t$this->enqueue_js( 'event', $js );\n\n\t\t// Send view product event\n\t\t$properties = array(\n\t\t\t'eventCategory' => 'Products',\n\t\t\t'eventLabel' => esc_js( get_the_title() ),\n\t\t\t'nonInteraction' => true,\n\t\t);\n\n\t\t$this->js_record_event( 'Viewed Product', $properties );\n\t}", "public function createProduct($data);", "public function onCreated()\n {\n parent::onCreated();\n\n }", "public function onCreated()\n {\n parent::onCreated();\n\n }", "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 create()\n {\n //\n $vendor = Vendor::all();\n $category = Category::all();\n return view('admin.superadmin.products.product_create', compact('category', 'vendor'));\n }", "public function store(CreateProductRequest $request)\n {\n $product = $this->productRepository->saveRecord($request);\n\n $details = [];\n $details['product_id'] = $product->id;\n $details['description'] = $request->description;\n $details['price'] = $request->price;\n ProductDetails::create($details);\n\n $slot = [];\n $slot['product_id'] = $product->id;\n $slot['title'] = 'Slot 1';\n $done = Slot::create($slot);\n\n $slotBooking = [];\n $slotBooking['slot_id'] = $done->id;\n $slotBooking['user_id'] = Auth::id();\n $slotBooking['status'] = 1;\n SlotBookings::create($slotBooking);\n\n Flash::success($this->BreadCrumbName . ' saved successfully.');\n if (isset($request->continue)) {\n $redirect_to = redirect(route('admin.products.create'));\n } elseif (isset($request->translation)) {\n $redirect_to = redirect(route('admin.products.edit', $product->id));\n } else {\n $redirect_to = redirect(route('admin.products.index'));\n }\n return $redirect_to->with([\n 'title' => $this->BreadCrumbName\n ]);\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 store(CreateProductRequest $request)\n {\n $input = $request->all();\n\n $provider = Provider::find($input[\"provider_id\"]);\n\n $product = Product::create([\n \"code\" => Product::generateUniqueCode(implode(\" \", $input[\"title\"]) , $provider->sku_suffix ),\n \"provider_id\" => $provider->id,\n\t\t\t'publish_id'\t=> $input[\"publish_id\"],\n\t\t\t'publish_at'\t=> $input[\"publish_date\"],\n ]);\n\n if (!$product) {\n return Redirect::back()->withErrors([\"El producto no pudo ser creado\"]);\n }\n\n foreach ($this->languages as $language) {\n $product->updateTranslationByIso($language->iso6391,[\n 'title' => $input[\"title\"][$language->iso6391],\n 'description' => $input[\"description\"][$language->iso6391],\n 'slug' => Product::generateUniqueSlug($input[\"title\"][$language->iso6391])\n ]);\n }\n\n updateMYSQLTimestamp();\n\n return Redirect::route('admin::products.edit',$product->id)->with('status', \"El producto fue correctamente creado\");\n }", "public function createproductActionPost(): object\n {\n // Connects to db\n $this->app->db->connect();\n\n if (hasKeyPost(\"doCreate\")) {\n $name = getPost(\"name\");\n\n // Executes SQL statement\n $this->admin->createProduct($name);\n\n // Retrieves id\n $id = $this->app->db->lastInsertId();\n }\n\n // Redirects\n return $this->app->response->redirect(\"admin/editproduct?id=$id\");\n }", "public function productChanged(Varien_Event_Observer $observer) {\n try {\n $product = $observer->getEvent()->getProduct();\n $product_id = $product->getId();\n Mage::getModel('tagalys_core/queue')->blindlyAddProduct($product_id);\n } catch (Exception $e) {\n Mage::log(\"Exception on productChanged: \" . $e->getMessage(), null, \"tagalys.log\");\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 handleOrderCreated(OrderCreatedEvent $event) {\n $order = $event->order;\n $user = $order->user;\n if( null != $user ) {\n $user->notify(new OrderStatusNotification($order, 'created'));\n }\n }", "protected function onSave() {\n // Assign the detail data to an instance variable for ease of use.\n $this->wcData = $this->getDetailData();\n\n if (!$this->wcData || !$this->getSaverData()->getPostId() ||\n $this->getSaverData()->getWpPostData()['post_type'] !== 'product') {\n return;\n }\n\n // Make sure everything is valid before saving them.\n $this->wcData->validateData();\n\n try {\n // Create the product\n $this->product = $this->createProduct();\n\n } catch (StopSavingException $e) {\n // Stop saving if there was an error creating the product.\n Informer::addError(_wpcc('Product could not be saved.') . ' ' . $e->getMessage())\n ->setException($e)\n ->addAsLog();\n\n return;\n }\n\n // Prepare the product below.\n // NOTE: Save all the data existing in $this->wcData. Handle things considering if this is a recrawl and/or\n // first page.\n\n // Set the product gallery\n $this->setProductGallery();\n\n // Do the things that should be done just in the first page\n $productClass = get_class($this->product->getProduct());\n switch ($productClass) {\n case WC_Product_Simple::class:\n $this->prepareSimpleProduct();\n break;\n\n case WC_Product_External::class:\n $this->prepareExternalProduct();\n break;\n\n default:\n // Stop saving otherwise.\n throw new StopSavingException(sprintf('%1$s cannot be saved', $productClass));\n }\n\n // Save the product\n $this->product->save();\n }", "public function testProductCreation()\n {\n $response = $this->json('POST', '/api/v1/products', ['name' => 'Sally','sku'=>'Test']);\n\n $response->assertStatus(201)->assertJson(['code' => 201]);\n }", "public function create()\n {\n return view('admin/catalog/productTag/create');\n }", "public function created(Component $component): void\n {\n Component::unsetEventDispatcher();\n $this->componentService->calculateComponentCost($component);\n $this->componentService->calculateVendorSummaryData($component);\n }", "public function create()\n {\n return view('admin.products.create_product');\n }", "public function created(Item $item)\n {\n //\n }", "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}", "public function created()\n\t{\n\t\t$parent = $this->projectService->getProject($this->projectid);\n\t\tif ($parent) {\n\t\t\t$this->versioningService->createVersion($parent, 'featureupdate');\n\t\t}\n\t\t$this->versioningService->createVersion($this);\n\t}", "public function actionCreate()\n {\n $postData = Yii::$app->request->post();\n \n $model = new Product();\n\n if ($model->load($postData) && $model->save()) {\n return $this->redirect(['update', 'id' => $model->id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "public function created()\n\t{\n\t\tif (!$this->ismilestone) {\n\t\t\t$this->createDefaultMilestone();\n\t\t}\n\n\t\t$this->versioningService->createVersion($this);\n\t}", "public function run()\n {\n foreach ($this->getProducts() as $product) {\n App\\Product::create($product);\n }\n }", "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 create()\n {\n $category = Category::where('status', 1)->orderBy('position', 'ASC')->get();\n\n $productId = $this->GetProductId();\n\n return view('admin.productAdd')->with(['category' => $category, 'product_id' => $productId]);\n }", "private function createProducts()\n {\n $chicken = $this->newProduct(self::PRODUCT_CHICKEN_EAN, self::PRODUCT_CHICKEN_NAME);\n $turkey = $this->newProduct(self::PRODUCT_TURKEY_EAN, self::PRODUCT_TURKEY_NAME);\n \n try\n {\n $isChickenCreated = $this->productDao->create($chicken);\n $isTurkeyCreated = $this->productDao->create($turkey);\n\n echo self::PRODUCT_CHICKEN_NAME . ' created ' . \n (($isChickenCreated) ? '' : 'un') .\n 'successfuly!' . PHP_EOL;\n\n echo self::PRODUCT_TURKEY_NAME . ' created ' . \n (($isTurkeyCreated) ? '' : 'un') . \n 'successfuly!' . PHP_EOL; \n }\n catch (Exception $e)\n {\n echo $e->getMessage();\n }\n \n }", "public function create()\n {\n// dd(\"create\");\n return view('admin/product/product-create');\n }", "public function postCreate(Request $request)\n {\n\t\t$this->validate($request, [\n\t\t\t'name' => 'required|min:2',\n\t\t\t'description' => 'required|max:50',\n\t\t\t'image_link' => 'url',\n\t\t\t'image' => 'mimes:jpeg,bmp,png|max:2000kb',\n\t\t]);\n\t\t\n\t\t\n\t\t$product = new \\marketplaceniaja\\Product();\n\t\t$product->name = $request->name;\n\t\t$product->state_id = $request->state_id;\n\t\t$product->type_id = $request->type_id;\n\t\t\n\t\t$product->image_link = $request->image_link;\n\t\t$product->description = $request->description;\n\t\t$product->auth_id = $request->user_id;\n\t\t\n\t\t# If an image was selected...\n\t\tif($request->image) {\n\t\t\t$product->image = $request->image;\n\t\t}\n\t\t# If there were no image selected\n\t\t# default to an empty string\n\t\telse {\n\t\t\t$product->image = '';\n\t\t}\t\t\n\t\t\n\t\t$product->save();\n\t\t\n\t\t\\Session::flash('message', 'Your product has been added');\n\t\t\n\t\treturn redirect('/products');\n }", "public function createProduct() {\n $publishedCategories = Category::where('publicationStatus', 1)->get();\n $publishedManufacturers = Manufacturer::where('publicationStatus', 1)->get();\n return view('admin.product.createProduct', ['publishedCategories' => $publishedCategories, 'publishedManufacturers' => $publishedManufacturers]);\n }", "public function create()\n {\n $categories = Category::all();\n $tags = Tag::all();\n return view('admin.products.createProduct')->with([\n 'categories' => $categories,\n 'tags' => $tags\n ]);\n }", "public function afterCreate(\\stdClass $data, Entity $entity) { }", "public function create()\n {\n return view(\"admin.product.create\");\n }", "public function new(ProductPost $request)\n {\n $new_product = $request->validated();\n $product_quantity = $new_product['quantity'];\n unset($new_product['quantity']);\n $new_product['colors'] = explode(\",\", $new_product['colors']);\n if (in_array('sizes', $new_product)){\n $new_product['sizes'] = $new_product['sizes'];\n }\n\n $product = Product::create($new_product);\n if ($request->hasFile('thumbnail')){\n $thumbnail = $request->thumbnail->store(\"public\");\n ProductImage::create([\n \"product_id\" => $product->id,\n \"name\" => explode(\"/\", $thumbnail)[1],\n \"fullpath\" => $thumbnail\n ]);\n OptimizeImage::dispatch($request->thumbnail);\n }\n\n if ($request->hasFile('images')){\n $images = $request->images;\n foreach ($images as $imageFile){\n $image = $imageFile->store(\"public\");\n ProductImage::create([\n \"product_id\" => $product->id,\n \"name\" => explode(\"/\", $image)[1],\n \"fullpath\" => $image\n ]);\n OptimizeImage::dispatch($imageFile);\n }\n }\n\n $store_product = [\n 'price' => $product->price,\n 'quantity' => $product_quantity,\n 'store_id' => Auth::guard('store')->user()->id,\n 'product_id' => $product->id,\n ];\n\n if (!empty($product->colors)){\n $store_product['color'] = $product->colors[0];\n }\n\n if (!empty($product->sizes)){\n $store_product['size'] = $product->sizes[0];\n }\n\n $product = StoreProduct::create($store_product);\n //$product->images = $product->images;\n return response()->json([\"success\" => true, \"message\" => \"Product added successfully\", \"product\" => $product, \"title\" => \"Add Product\"]);\n }", "public function create()\n\t{\n\t\treturn view('admin.products.create');\n\t}", "public function actionCreate()\n {\n $model = new Product();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['view', 'id' => $model->id]);\n }\n\n return $this->render('create', [\n 'model' => $model,\n ]);\n }", "private function createInitialProducts()\n {\n $this->product = $this->createProduct();\n $this->product2 = $this->createProduct();\n\n $this->category = $this->createCategory();\n $this->product->addCategory($this->category);\n $this->product2->addCategory($this->category);\n }", "public function actionCreate()\n {\n $model = new Product();\n\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n return $this->redirect(['index']);\n }\n\n return $this->render('create', [\n 'model' => $model,\n 'langs' => $this->getLangs(),\n ]);\n }", "public function create()\n {\n Gate::authorize('haveaccess');\n\n return inertia('Product/Create');\n }", "public function onProductAlter(ProductEvent $event) {\n /** @var \\Drupal\\commerce_product\\Entity\\ProductInterface $product */\n $product = $event->getProduct();\n\n\n }", "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 create()\n {\n return view('store::admin.products.create');\n }", "public function created(Cart $cart)\n {\n //\n }", "public function create()\n {\n return view('Backend.pages.product.createproduct');\n }", "public function can_create_a_product()\n {\n //Given\n $faker = Factory::create();\n\n //When\n $response = $this->actingAs($this->create('User', [], false), 'api')->json('POST', '/api/products', [\n 'name' => $name = $faker->company,\n 'slug' => str_slug($name),\n 'price' => $price = random_int(10, 100)\n ]);\n // post request create product\n\n //Then\n // product exists\n $response->assertJsonStructure([\n 'id','name','slug','price','created_at'\n ])\n ->assertJson([\n 'name' => $name,\n 'slug' => str_slug($name),\n 'price' => $price\n ])\n ->assertStatus(201);\n\n $this->assertDatabaseHas('products', [\n 'name' => $name,\n 'slug' => str_slug($name),\n 'price' => $price\n ]);\n }", "public function productAddOrUpdate(Varien_Event_Observer $observer)\n {\n try \n {\n $helper = Mage::helper('increasingly_analytics');\n\n if ($helper->isEnabled())\n {\n $productId = $observer->getEvent()->getProduct()->getId();\n $product = Mage::getModel('catalog/product')->load($productId);\n\n $productFormatHelper = Mage::helper('increasingly_analytics/ProductFormatter'); \n \n $formattedProductInfo = $productFormatHelper->formatProductInfo($product);\n $helper->increasinglyApi($formattedProductInfo,'product_add_or_update','track',$helper->getApiToken(),$helper->getApiSecret());\n }\n\n }\n catch(Exception $e)\n {\n Mage::log(\"Product Add or Update tracking - \" . $e->getMessage(), null, 'Increasingly_Analytics.log');\n }\n }", "public function create()\n {\n return view('vanilo::product.create', [\n 'product' => app(Product::class),\n 'states' => ProductStateProxy::choices()\n ]);\n }", "public function afterCreate($product)\n {\n $this->indexer->refreshFlat($product);\n }", "public function create()\n {\n return view('admin/dash_products_create');\n }", "public function create()\n {\n return view('website.backend.product.create');\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 created(Order $order)\n\t{\n\t\t//\n\t}", "public function created(Order $order)\n\t{\n\t\t//\n\t}", "public function create()\n { \n $product = Product::create([\n 'name' => request('product_name'),\n 'phone_id' => request('phone_model'),\n 'price' => request('price'),\n 'stock' => request('stock'),\n 'image' => request('image')\n ]);\n $take_id =$product->id;\n $take_data = Product::find($take_id);\n $tookPhone = request('category');\n $take_data->categories()->sync($tookPhone); \n return \"done\";\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 }", "public function create($request) {\n\n\t\t$image = $request['photo'];\n\t\tif($image !== null) {\n\t\t\t$name = time().'.' . explode('/', explode(':', substr($image, 0, strpos($image, ';')))[1])[1];\n\t\t\t\\Image::make($request['photo'])->save(public_path('storage/products/').$name);\n\t\t\t$request['photo'] = $name;\n\t\t} else {\n\t\t\t$request['photo'] = \"product-empty.png\";\n\t\t}\n\t\t$request['user_id'] = auth()->user()->id;\n\t\treturn $this->product->create($request);\n\t}", "public function actionCreate()\n {\n $model = new Products();\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 create()\n {\n $units = ProductUnit::orderBy('name')->get();\n $bundles = ProductBundle::orderBy('name')->get();\n\n $warning_days = !empty(old('warning_days')) ? old('warning_days') : 3 ;\n\n return view('admin.product.create',compact('units','bundles', 'warning_days'));\n\n }", "public function postNew()\n {\n $sku = request()->json('sku');\n $client_id = auth()->user()->current_client_id;\n $warehouse_id = auth()->user()->current_warehouse_id;\n\n //first check to make sure this is not a duplicate\n $products = $this->getCheckDuplicate($sku, $client_id, $warehouse_id);\n if( count($products) > 0 )\n {\n $error_message = array('errorMsg' => 'The product with sku of ' . $sku . ' already exists for this warehouse and client.');\n return response()->json($error_message);\n }\n\n //create new item\n $product_id = $this->saveItem();\n\n return response()->json(['id' => $product_id]);\n }", "public function create() {\n /**\n * This controller is used to create a new product \n */\n return view('product.create');\n }", "public function create()\n {\n $title = 'create product';\n $purchases = Purchase::query();\n return view('admin.products.create',compact(\n 'title'\n ));\n }", "function create_new_campaign_product($prod_info){\n\t\t\n\t$post = array(\n\t\t'post_author' => $prod_info['uid'],\n\t\t'post_content' => $prod_info['body'],\n\t\t'post_status' => \"publish\",\n\t\t'post_title' => $prod_info['title'],\n\t\t'post_parent' => '',\n\t\t'post_type' => \"product\",\n\t\t\n );\n\t\n\t/* Create post */\n $post_id = wp_insert_post( $post, TRUE );\n if($post_id){\n\t\t/* \n\t\t$attach_id = get_post_meta($product->parent_id, \"_thumbnail_id\", true);\n\t\tadd_post_meta($post_id, '_thumbnail_id', $attach_id);\n\t\t*/\n\t\t\n\t\t$upload_dir = wp_upload_dir();\t\t\n\t\t$filename = $upload_dir['url'].'/'.$prod_info['full_image_name'];\n\t\t\n\t\tif(!empty($prod_info['full_image_name'])){\n\t\t\tadd_post_meta($post_id, 'full_image_name', $filename, TRUE); \n\t\t}\n\t\t\n\t\t$parent_post_id = $post_id;\t\t\n\t\t$filename = $upload_dir['url'].'/'.$prod_info['image_name'];\n\t\t\t\t\n\t\t$filetype = @wp_check_filetype( basename( $filename ), null );\n\t\t$wp_upload_dir = wp_upload_dir();\n\t\t$attachment = array(\n\t\t\t'guid' => $wp_upload_dir['url'] . '/' . basename( $filename ), \n\t\t\t'post_mime_type' => $filetype['type'],\n\t\t\t'post_title' => preg_replace( '/\\.[^.]+$/', '', basename( $filename ) ),\n\t\t\t'post_content' => '',\n\t\t\t'post_status' => 'inherit'\n\t\t);\n\t\t$attach_id = @wp_insert_attachment( $attachment, $filename, $parent_post_id );\n\t\t@set_post_thumbnail( $parent_post_id, $attach_id ); \n\t\t\n\t\tadd_post_meta($post_id, '_thumbnail_id', $attach_id);\n\t\t\n\t\t/* \n\t\twp_set_post_categories( $post_ID, $post_categories, $append );\n\t\twp_set_post_terms( $post_id, $terms, $taxonomy, $append ); \n\t\t*/\n\t\t\n\t\twp_set_object_terms( $post_id, 'campaign-product', 'TCampaign' ); \n\t\twp_set_object_terms( $post_id, $prod_info['tags'], 'product_tag' ); \n\t\t\n }\n\t\n \n update_post_meta( $post_id, '_visibility', 'visible' );\n update_post_meta( $post_id, '_stock_status', 'instock');\n update_post_meta( $post_id, 'total_sales', '0');\n update_post_meta( $post_id, '_downloadable', 'no');\n update_post_meta( $post_id, '_virtual', 'yes');\n update_post_meta( $post_id, '_regular_price', $prod_info['unit_price'] );\n update_post_meta( $post_id, '_sale_price', $prod_info['unit_price'] );\n update_post_meta( $post_id, '_purchase_note', \"\" );\n update_post_meta( $post_id, '_featured', \"no\" );\n update_post_meta( $post_id, '_weight', \"\" );\n update_post_meta( $post_id, '_length', \"\" );\n update_post_meta( $post_id, '_width', \"\" );\n update_post_meta( $post_id, '_height', \"\" );\n update_post_meta( $post_id, '_sku', $prod_info['sku']);\n update_post_meta( $post_id, '_product_attributes', array());\n update_post_meta( $post_id, '_sale_price_dates_from', \"\" );\n update_post_meta( $post_id, '_sale_price_dates_to', \"\" );\n update_post_meta( $post_id, '_price', $prod_info['unit_price'] );\n update_post_meta( $post_id, '_sold_individually', \"\" );\n update_post_meta( $post_id, '_manage_stock', \"no\" );\n update_post_meta( $post_id, '_backorders', \"no\" );\n update_post_meta( $post_id, '_stock', \"\" );\n update_post_meta( $post_id, 'campaign_until', date(\"d M Y\",time() + ($prod_info['camp_length'] * 60*60*24)));\n\t\t\n update_post_meta( $post_id, 'unit_price', $prod_info['unit_price']);\n update_post_meta( $post_id, 'unit_profit', $prod_info['unit_profit']);\n update_post_meta( $post_id, 'total_profit', $prod_info['total_profit']);\n update_post_meta( $post_id, 'sales_goal', $prod_info['sales_goal']);\n\n /* file paths will be stored in an array keyed off md5(file path) */\n /* $downdloadArray =array('name'=>\"Test\", 'file' => $uploadDIR['baseurl'].\"/video/\".$video); */\n\t\n /* $file_path =md5($uploadDIR['baseurl'].\"/video/\".$video); */\n\n /* $_file_paths[ $file_path ] = $downdloadArray; \n update_post_meta( $post_id, '_downloadable_files ', $_file_paths);\n update_post_meta( $post_id, '_download_limit', '');\n update_post_meta( $post_id, '_download_expiry', '');\n update_post_meta( $post_id, '_download_type', '');\n update_post_meta( $post_id, '_product_image_gallery', '');\n\t\n\t*/\n\t\n\treturn $post_id;\n}", "public function creating(Product $product)\n {\n $product->user_id = auth()->id();\n }", "public function create() {\n $categories = $this->categoryRepo->listCategories('name', 'asc');\n $channels = $this->channelRepo->listChannels('name', 'asc');\n\n $arrWarehouses = (new WarehouseRepository(new Warehouse))->listWarehouses('name', 'asc');\n $warehouses_on = !empty(env('ALLOW_WAREHOUSES')) ? true : false;\n\n\n return view('admin.products.create', [\n 'warehouses_on' => $warehouses_on,\n 'warehouses' => $arrWarehouses,\n 'categories' => $categories,\n 'channels' => $channels,\n 'brands' => $this->brandRepo->listBrands(['*'], 'name', 'asc'),\n 'default_weight' => env('SHOP_WEIGHT'),\n 'weight_units' => (new Product())->MASS_UNIT,\n 'product' => new Product\n ]);\n }", "public function store(ProductCreateRequest $request) : RedirectResponse\n {\n $product = Product::create($request->only('name', 'art', 'status', 'data'));\n $this->dispatch(new SendProductCreatedJob($product));\n\n return redirect()->route('products.index')\n ->with('success', 'Product created successfully.');\n }", "public function hookActionDispatcherBefore()\n {\n AlternativeDescription::addToProductDefinition();\n }", "public function create()\r\n {\r\n// return view('admin.product.create');\r\n }", "public function create()\n {\n return view('admin.product.add-product');\n }", "protected function created()\n {\n $this->response = $this->response->withStatus(201);\n $this->jsonBody($this->payload->getOutput());\n }", "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 create()\n {\n return view('inventory.createProduct');\n }", "public function store(ProductCreateRequest $request)\n {\n\n $product = Product::create($request->all());\n try {\n $product->sale_price = ($request->sale_price == null) ? $request->price : $request->sale_price;\n $product->save();\n return (new ProductResource($product))->additional([\n 'errors' => null,\n ])->response()->setStatusCode(201);\n } catch (Exception $e) {\n Log::info(\"fails in create a new product\" . json_encode($e));\n if (env('APP_ENV') == 'development') {\n return (new ProductResource(null))->additional([\n 'errors' => [\"fail\" => [\"fails in create a new product\" . json_encode($e)]],\n ])->response()->setStatusCode(500);\n } else if (env('APP_ENV') == 'production') {\n return (new ProductResource(null))->additional([\n 'errors' => [\"fail\" => [\"fails in create a new product\"]],\n ])->response()->setStatusCode(500);\n }\n }\n }", "public function store() { \n\t\t$name = $this->post('name');\n\t\t$price = $this->post('price'); \n\t\t$description = $this->post('description'); \n\n\t\tif ($name && $description && $price) {\n\t\t\t$this->product->name = $name;\n\t\t\t$this->product->price = $price;\n\t\t\t$this->product->is_deleted = false;\n\t\t\t$this->product->description = $description;\n\t\t\t$this->product->created_at = date(\"Y-m-d h:i:s\");\n\t\t\t$this->product->updated_at = date(\"Y-m-d h:i:s\");\n\n\t\t\t$create = $this->product->addProduct($this->product);\n\t\t\tif ($create) { \n\t\t\t\t$data = [ \"message\" => \"product has been created!\"];\n\t\t\t\t$statusCode = 201; \n\t\t\t}\n\t\t\telse {\n\t\t\t\t$data = [ \"message\" => \"product cannot create\"];\n\t\t\t\t$statusCode = 500; \n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t$data = [ \"message\" => \"required missinng fields\"];\n\t\t\t$statusCode = 400; \n\t\t}\n\t\treturn $this->response($data, $statusCode);\n\t}", "public function create()\n {\n $statusProducts = StatusProduct::all();\n $categoryProducts = CategoryProduct::all();\n return view('adminlte::products.create', compact('statusProducts','categoryProducts'));\n }", "public function actionCreate()\n {\n /* @var $modelProduct \\common\\models\\Product */\n\n $modelProduct = Product::findOne(Yii::$app->session->get('tempId'));\n\n if(!isset($modelProduct)):\n Yii::$app->session->remove('tempModel');\n Yii::$app->session->remove('tempId');\n endif;\n\n if (isset($modelProduct) && $modelProduct->load(Yii::$app->request->post())):\n if($modelProduct->updateObject($modelProduct)):\n return $this->redirect(['view', 'id' => $modelProduct->id]);\n endif;\n endif;\n\n if(Yii::$app->session->get('tempModel') != 'Product'):\n\n $modelProduct = new Product();\n $modelProduct = $modelProduct->createObject();\n endif;\n\n return $this->render('create', [\n 'modelProduct' => $modelProduct,\n ]);\n }", "public function run()\n {\n Product::create([\n 'name' => 'Mangue',\n 'slug' => 'mangue',\n 'details' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet.',\n 'price' => 5,\n 'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet. Nam feugiat magna magna, a ullamcorper turpis dapibus at. Phasellus justo massa, varius ut hendrerit non, molestie non sapien. Donec et libero quam. Morbi iaculis augue sit amet hendrerit pulvinar. Suspendisse mattis orci orci, eu scelerisque elit ornare at.',\n 'category_id' => Category::all()->random()->id\n\n ]);\n\n Product::create([\n 'name' => 'Banane',\n 'slug' => 'banane',\n 'details' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet.',\n 'price' => 2,\n 'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet. Nam feugiat magna magna, a ullamcorper turpis dapibus at. Phasellus justo massa, varius ut hendrerit non, molestie non sapien. Donec et libero quam. Morbi iaculis augue sit amet hendrerit pulvinar. Suspendisse mattis orci orci, eu scelerisque elit ornare at.',\n 'category_id' => Category::all()->random()->id\n\n ]);\n\n Product::create([\n 'name' => 'Pomme',\n 'slug' => 'pomme',\n 'details' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet.',\n 'price' => 2,\n 'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet. Nam feugiat magna magna, a ullamcorper turpis dapibus at. Phasellus justo massa, varius ut hendrerit non, molestie non sapien. Donec et libero quam. Morbi iaculis augue sit amet hendrerit pulvinar. Suspendisse mattis orci orci, eu scelerisque elit ornare at.',\n 'category_id' => Category::all()->random()->id\n\n ]);\n\n Product::create([\n 'name' => 'Ananas',\n 'slug' => 'ananas',\n 'details' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet.',\n 'price' => 6,\n 'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet. Nam feugiat magna magna, a ullamcorper turpis dapibus at. Phasellus justo massa, varius ut hendrerit non, molestie non sapien. Donec et libero quam. Morbi iaculis augue sit amet hendrerit pulvinar. Suspendisse mattis orci orci, eu scelerisque elit ornare at.',\n 'category_id' => Category::all()->random()->id\n\n ]);\n\n Product::create([\n 'name' => 'Melon',\n 'slug' => 'melon',\n 'details' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet.',\n 'price' => 3,\n 'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet. Nam feugiat magna magna, a ullamcorper turpis dapibus at. Phasellus justo massa, varius ut hendrerit non, molestie non sapien. Donec et libero quam. Morbi iaculis augue sit amet hendrerit pulvinar. Suspendisse mattis orci orci, eu scelerisque elit ornare at.',\n 'category_id' => Category::all()->random()->id\n\n ]);\n\n Product::create([\n 'name' => 'Pasteque',\n 'slug' => 'pasteque',\n 'details' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet.',\n 'price' => 7,\n 'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet. Nam feugiat magna magna, a ullamcorper turpis dapibus at. Phasellus justo massa, varius ut hendrerit non, molestie non sapien. Donec et libero quam. Morbi iaculis augue sit amet hendrerit pulvinar. Suspendisse mattis orci orci, eu scelerisque elit ornare at.',\n 'category_id' => Category::all()->random()->id\n\n ]);\n\n Product::create([\n 'name' => 'Raisin',\n 'slug' => 'raisin',\n 'details' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet.',\n 'price' => 4,\n 'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet. Nam feugiat magna magna, a ullamcorper turpis dapibus at. Phasellus justo massa, varius ut hendrerit non, molestie non sapien. Donec et libero quam. Morbi iaculis augue sit amet hendrerit pulvinar. Suspendisse mattis orci orci, eu scelerisque elit ornare at.',\n 'category_id' => Category::all()->random()->id\n\n ]);\n\n Product::create([\n 'name' => 'Citron',\n 'slug' => 'citron',\n 'details' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet.',\n 'price' => 2,\n 'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet. Nam feugiat magna magna, a ullamcorper turpis dapibus at. Phasellus justo massa, varius ut hendrerit non, molestie non sapien. Donec et libero quam. Morbi iaculis augue sit amet hendrerit pulvinar. Suspendisse mattis orci orci, eu scelerisque elit ornare at.',\n 'category_id' => Category::all()->random()->id\n\n ]);\n\n Product::create([\n 'name' => 'Orange',\n 'slug' => 'orange',\n 'details' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet.',\n 'price' => 1,\n 'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dolor felis, tincidunt quis urna in, blandit ultricies dui. Phasellus vulputate nisi id ex pellentesque imperdiet. Nam feugiat magna magna, a ullamcorper turpis dapibus at. Phasellus justo massa, varius ut hendrerit non, molestie non sapien. Donec et libero quam. Morbi iaculis augue sit amet hendrerit pulvinar. Suspendisse mattis orci orci, eu scelerisque elit ornare at.',\n 'category_id' => Category::all()->random()->id\n\n ]);\n }", "public function post_post() {\n\t\t$title = strip_tags( $this->post( 'title' ) );\n\t\t$desc = strip_tags( $this->post( 'desc' ) );\n\t\t$price = strip_tags( $this->post( 'price' ) );\n\t\t$tags = strip_tags( $this->post( 'tags' ) );\n\t\t$image = strip_tags( $this->post( 'image' ) );\n\n\t\t// Validate the post data\n\t\tif ( ! empty( $title ) && ! empty( $desc ) && ! empty( $price ) && ! empty( $tags ) && ! empty( $image ) ) {\n\t\t\t// Insert product data\n\t\t\t$productData = array(\n\t\t\t\t'title' => $title,\n\t\t\t\t'desc' => $desc,\n\t\t\t\t'price' => $price,\n\t\t\t\t'tags' => $tags,\n\t\t\t\t'image' => $image\n\t\t\t);\n\t\t\t$insert = $this->product->insert( $productData );\n\n\t\t\t// Check if the product data is inserted\n\t\t\tif ( $insert ) {\n\t\t\t\t// Set the response and exit\n\t\t\t\t$this->response( array(\n\t\t\t\t\t'status' => true,\n\t\t\t\t\t'message' => 'The product has been added successfully.',\n\t\t\t\t\t'data' => $insert\n\t\t\t\t), REST_Controller::HTTP_OK );\n\t\t\t} else {\n\t\t\t\t// Set the response and exit\n\t\t\t\t$this->response( \"Some problems occurred, please try again.\", REST_Controller::HTTP_BAD_REQUEST );\n\t\t\t}\n\t\t} else {\n\t\t\t// Set the response and exit\n\t\t\t$this->response( \"Provide complete product info to add.\", REST_Controller::HTTP_BAD_REQUEST );\n\t\t}\n\t}", "public function create()\n\t{\n\t\t\n\t\treturn view('product.create');\n\t}", "public function store(ProductCreateRequest $request)\n {\n $request->store();\n\n return create_response();\n }", "public function onTemplateProductDetail(TemplateEvent $event)\r\n {\r\n /** @var Product $Product */\r\n $product = $event->getParameter('Product');\r\n\r\n\r\n if(!empty($product['target_sell']) && !empty($product['point_offer']) && !empty($product['days']) && $product['isFlag_special_offer'] == 0) {\r\n $numBuyers = $this->configRepository->getRemainBuyers($product);\r\n $dateCreate = $numBuyers['updateDate'];\r\n $getNumBuyers = $numBuyers['remainBuyer'];\r\n $specailOfferDay = $product['days'];\r\n $from_time = date_create(date('Y-m-d H:i:s'));\r\n $to_time = date_create($specailOfferDay->format('Y-m-d H:i:s'));\r\n $dateRemain = date_diff($from_time, $to_time)->format('%R%a days %H:%I:%S');\r\n $parameters = $event->getParameters();\r\n $parameters['ProductSpecialOfferRemainDays'] = $specailOfferDay->format('Y-m-d H:i:s');//date_diff($from_time, $to_time)->format('%a days %Hh %Imin %Sss');\r\n $parameters['ProductSpecialOfferRemainBuyer'] = $getNumBuyers;\r\n $event->setParameters($parameters);\r\n\r\n if($product['flagSpecialOffer'] != true) {\r\n if(strpos($dateRemain, '+') !== false) {\r\n if($product['target_sell'] > $getNumBuyers ) {\r\n if($product['target_sell'] == $getNumBuyers) {\r\n $this->configRepository->getUpdateCustomerPoint($numBuyers);\r\n }\r\n $event->addSnippet('@ProductSpecialOffer/default/ProductSpecialOffer.twig');\r\n }\r\n }\r\n }\r\n }\r\n }", "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 catalogProductSaveAfterEvent($observer) {\n if (Mage::registry('INVENTORY_SUPPLIER_CREATE_PRODUCT'))\n return;\n Mage::register('INVENTORY_SUPPLIER_CREATE_PRODUCT', true);\n\n $product = $observer->getProduct();\n $productId = $product->getId();\n\n if (in_array($product->getTypeId(), array('configurable', 'bundle', 'grouped')))\n return;\n if (Mage::getModel('admin/session')->getData('inventory_catalog_product_duplicate')) {\n $currentProductId = Mage::getModel('admin/session')->getData('inventory_catalog_product_duplicate');\n $supplierProducts = Mage::getModel('inventorypurchasing/supplier_product')->getCollection()\n ->addFieldToFilter('product_id', $currentProductId);\n foreach ($supplierProducts as $supplierProduct) {\n\n $newSupplierProduct = Mage::getModel('inventorypurchasing/supplier_product');\n $newSupplierProduct->setData('product_id', $productId)\n ->setData('supplier_id', $supplierProduct->getSupplierId())\n ->setData('cost', $supplierProduct->getCost())\n ->setData('discount', $supplierProduct->getDiscount())\n ->setData('tax', $supplierProduct->getTax())\n ->setData('supplier_sku', $supplierProduct->getSupplierSku())\n ->save();\n }\n Mage::getModel('admin/session')->setData('inventory_catalog_product_duplicate', false);\n }\n\n $post = Mage::app()->getRequest()->getPost();\n $isInStock = 0;\n\n if (isset($post['product']['stock_data']['is_in_stock']))\n $isInStock = $post['product']['stock_data']['is_in_stock'];\n if (isset($post['simple_product']))\n if (isset($post['simple_product']['stock_data']['is_in_stock']))\n $isInStock = $post['simple_product']['stock_data']['is_in_stock'];\n if (isset($post['inventory_select_supplier'])) {\n $suppliers = $post['inventory_select_supplier'];\n try {\n foreach ($suppliers as $supplier) {\n $warehouseProductModel = Mage::getModel('inventorypurchasing/supplier_product');\n $warehouseProductModel->setSupplierId($supplier['supplier_id'])\n ->setProductId($productId)\n ->setCost($supplier['cost'])\n ->setDiscount($supplier['discount'])\n ->setTax($supplier['tax'])\n ->setSupplierSku($supplier['supplier_sku'])\n ->save();\n }\n } catch (Exception $e) {\n Mage::log($e->getMessage(), null, 'inventory_management.log');\n }\n }\n }", "public function create()\n {\t\n //\n\t\treturn view('products.create');\n }", "function on_creation() {\n $this->init();\n }", "function createProduct($parent = null);", "public function create()\n {\n return view('inventory_products.create');\n }", "public function create() {\n\t\tif ( Auth::user()->user_role != 1 ) {\n\t\t\treturn redirect( '/' );\n\t\t}\n\t\t$data = array();\n\t\t$data['category'] = Category::where( 'category_id', '!=', '16' )->get();\n\t\t$data['title'] = 'Add New Product';\n\n\t\treturn view( 'product.create', $data );\n\t}", "public function run()\n {\n $products = [\n \t[\n\t \t'name' => 'Business Cards',\n\t \t'description' => 'this is a business card',\n\t \t\n \t],\n \t[\n \t\t'name' => 'Marketing Collaterals',\n \t\t'description' => 'this is a marketing collaterals',\n \t\t\n \t],\n \t[\n \t\t'name' => 'Office Forums',\n \t\t'description' => 'This is an office forums',\n \t\t\n \t],\n ];\n\n foreach($products as $product){\n \tProduct::create([\n \t\t'name' => $product['name'],\n \t\t'description' => $product['description'],\n \t]);\n }\n }" ]
[ "0.76553744", "0.7185743", "0.6743361", "0.66305625", "0.6271156", "0.6192757", "0.6118819", "0.604169", "0.60283846", "0.60106784", "0.5954505", "0.59446913", "0.5916624", "0.5909948", "0.5907699", "0.59069127", "0.59069127", "0.59068996", "0.5906755", "0.5878996", "0.5853469", "0.58474046", "0.583495", "0.58178735", "0.58059645", "0.5804403", "0.5803042", "0.57885396", "0.5787339", "0.578697", "0.5783818", "0.5780947", "0.5780153", "0.5776454", "0.5770262", "0.5764699", "0.5750718", "0.57334924", "0.573137", "0.57300854", "0.5724825", "0.5713734", "0.5713318", "0.5712755", "0.5706288", "0.5704472", "0.56992626", "0.5693577", "0.56929094", "0.568914", "0.568554", "0.568327", "0.5676451", "0.56763655", "0.5670014", "0.56630695", "0.5658678", "0.56515884", "0.563333", "0.56299424", "0.5628551", "0.5627393", "0.56208396", "0.56186223", "0.56167835", "0.56167835", "0.5602748", "0.5601273", "0.55990803", "0.5592318", "0.5584284", "0.5584042", "0.5583995", "0.55812603", "0.5575442", "0.5574062", "0.5570164", "0.556961", "0.5565133", "0.55650395", "0.5564165", "0.55640596", "0.5554605", "0.55505127", "0.5549017", "0.55470127", "0.5545444", "0.554512", "0.55425745", "0.5542272", "0.5541607", "0.5540077", "0.5532324", "0.5531575", "0.55214536", "0.55144185", "0.55133325", "0.55070263", "0.5504041", "0.550042", "0.54953146" ]
0.0
-1
Handle the product "updated" event.
public function updated(Seller $seller) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function product_update_post()\n\t\t\t\t{\n\t\t\t\t}", "public function updated(Product $product): void\n {\n event(new OnProductUpdateEvent($product));\n }", "public function updated(Product $producto)\n {\n\n }", "public function logUpdate(Varien_Event_Observer $observer)\r\n{\r\n// Retrieve the product being updated from the event observer\r\n$product = $observer->getEvent()->getProduct();\r\n// Write a new line to var/log/product-updates.log\r\n$name = $product->getName();\r\n$sku = $product->getSku();\r\nMage::log(\"{$name} {$sku} updated success\", null, 'product-update.log');\r\n}", "public function updated(Product $product)\n {\n $loggerService = new ProductLoggerService($product);\n $loggerService->productUpdated();\n }", "public function update(){\n $this->product->id = $_POST['id'];\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\n\n // update the product\n if($this->product->update()){\n header(\"Refresh:2\");\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 updated.\";\n echo \"</div>\";\n }\n\n // if unable to update 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 update product.\";\n echo \"</div>\";\n }\n }", "public function updateProduct(Product $product);", "public function getUpdateProductData();", "public function updated(ProductImage $productImage)\n {\n }", "public function testUpdateProductUsingPOST()\n {\n }", "public function updated(Product $product)\n {\n if ($product->forceReindex) {\n return;\n }\n\n $product->load('property_values', 'variants.product_property_values', 'variants.property_values');\n\n $productEntry = new ProductEntry($product);\n if ($product->inventory_management_method === 'single' || $product->variants->count() > 0) {\n $this->index->update(ProductEntry::INDEX, $product->id, $productEntry);\n } else {\n $this->index->delete(ProductEntry::INDEX, $product->id, $productEntry);\n }\n\n if ($product->inventory_management_method === 'single') {\n $this->handleInventoryManagementMethodChange($product);\n $this->index->update(\n VariantEntry::INDEX,\n $this->ghostId($product),\n $this->ghostVariant($product, $productEntry)\n );\n } else {\n $this->index->delete(VariantEntry::INDEX, $this->ghostId($product));\n\n foreach ($product->variants as $variant) {\n $this->index->update(VariantEntry::INDEX, $variant->id, new VariantEntry($variant));\n }\n }\n }", "public function productChanged(Varien_Event_Observer $observer) {\n try {\n $product = $observer->getEvent()->getProduct();\n $product_id = $product->getId();\n Mage::getModel('tagalys_core/queue')->blindlyAddProduct($product_id);\n } catch (Exception $e) {\n Mage::log(\"Exception on productChanged: \" . $e->getMessage(), null, \"tagalys.log\");\n }\n }", "public function onProductAlter(ProductEvent $event) {\n /** @var \\Drupal\\commerce_product\\Entity\\ProductInterface $product */\n $product = $event->getProduct();\n\n\n }", "public function hookActionProductUpdate($params)\r\n {\r\n $id_product = (int) Tools::getValue('id_product');\r\n\r\n $sleed_item1 = Tools::getValue('sleed_item1');\r\n $sleed_item2 = Tools::getValue('sleed_item2');\r\n $sleed_item3 = Tools::getValue('sleed_item3');\r\n\r\n $query = \"UPDATE `\" . _DB_PREFIX_ . \"product_lang` SET custom_field_1='$sleed_item1',custom_field_2='$sleed_item2',custom_field_3='$sleed_item3' WHERE id_product='$id_product'\"; //end of the query\r\n Db::getInstance()->Execute($query);\r\n }", "public function update()\n\t{\n\t\t$option = JRequest::getVar('option');\n\t\t$post = JRequest::get('post');\n\t\t$Itemid = JRequest::getVar('Itemid');\n\t\t$redhelper = new redhelper;\n\t\t$Itemid = $redhelper->getCartItemid();\n\t\t$model = $this->getModel('cart');\n\n\t\t// Call update method of model to update product info of cart\n\t\t$model->update($post);\n\t\t$this->_carthelper->cartFinalCalculation();\n\t\t$this->_carthelper->carttodb();\n\t\t$link = JRoute::_('index.php?option=' . $option . '&view=cart&Itemid=' . $Itemid, false);\n\t\t$this->setRedirect($link);\n\t}", "public function bcpCatalogProductViewUpdate($observer)\n\t{\n\t\t$responseData = $observer->getEvent()->getResponseData();\n\t\t$simpleProduct = $observer->getEvent()->getProduct();\n\t\t$parentProduct = $observer->getEvent()->getParentProduct();\n\t\t$pageData = $observer->getEvent()->getPageData();\n\t\tMage::getModel('bcp/updater')->loadUpdateData($responseData, $simpleProduct, $parentProduct, $pageData);\n\t}", "public function update_product() {\n\t\t$values=array(\"product_name\"=>$_POST['product_name'],\"description\"=>$_POST['description']);\t\t\t\t\n\t\t$where =array(\"id\"=>$_POST['product_id']);\n\t\tif($this->update(\"products\",$values,$where)) {\t\t\t\n\t\t\techo true;\n\t\t}\n\t\telse\n\t\t\techo 'Error while updating';\n\t}", "public function update() {\n\t $this->layout = false;\n\t \n\t //set default response\n\t $response = array('status'=>'failed', 'message'=>'HTTP method not allowed');\n\t \n\t //check if HTTP method is PUT\n\t if($this->request->is('put')){\n\t //get data from request object\n\t $data = $this->request->input('json_decode', true);\n\t if (empty($data)) {\n\t $data = $this->request->data;\n\t }\n\t \n\t //check if product ID was provided\n\t if (!empty($data['id'])) {\n\t \n\t //set the product ID to update\n\t $this->Player->id = $data['id'];\n\t if ($this->Player->save($data)) {\n\t $response = array('status'=>'success','message'=>'Product successfully updated');\n\t } else {\n\t $response['message'] = \"Failed to update product\";\n\t }\n\t } else {\n\t $response['message'] = 'Please provide product ID';\n\t }\n\t }\n\t \n\t $this->response->type('application/json');\n\t $this->response->body(json_encode($response));\n\n\t return $this->response->send();\n\t}", "public function actionProductupdate()\n\t{\n\t\tif($_POST)\n\t\t{\t\n\t\t\ttry\n\t\t\t{\n\t\t\t\t\n\t\t\t\t$product=$_POST;\n\t\t\t\t$path='productupdate/'.$product['merchant_id'].'/update.log';\n\t\t\t\t$walmartConfig=[];\n\t\t\t $walmartConfig = Data::sqlRecords(\"SELECT `consumer_id`,`secret_key`,`consumer_channel_type_id` FROM `walmart_configuration` WHERE merchant_id='\".$product['merchant_id'].\"'\",'one','select');\n\t\t\t $merchant_id = $product['merchant_id'];\n\t\t\t if(is_array($walmartConfig) && count($walmartConfig)>0)\n\t\t\t {\n\t\t\t \tData::createLog(\"walmart_configuration available: \".PHP_EOL,$path);\n\t\t\t //$walmartHelper = new Walmartapi($walmartConfig['consumer_id'],$walmartConfig['secret_key'],$walmartConfig['consumer_channel_type_id']);\n\t\t\t // define(\"MERCHANT_ID\", $merchant_id);\n\t\t\t if(isset($product['type']) && $product['type']==\"price\")\n\t\t\t {\n\t\t\t \t//update custom price on walmart\n\t\t\t \t/*$updatePrice = Data::getCustomPrice($product['price'],$merchant_id);\n\t\t\t \tif($updatePrice)\n\t\t\t \t\t$product['price']=$updatePrice;*/\n\n\t\t\t \t$product['price'] = WalmartRepricing::getProductPrice($product['price'], $product['type'], $product['id'], $merchant_id);\n\t\t\t \t\n\t\t\t \t//change price log\n\t\t\t \t//$path='productupdate/price/'.$merchant_id.'/'.Data::getKey($product['sku']).'.log';\n\t\t\t \t//Data::createLog(\"price data: \".json_encode($product).PHP_EOL,$path);\n\t\t\t \t$shopDetails = Data::getWalmartShopDetails(MERCHANT_ID);\n\t\t\t $product['currency'] = isset($shopDetails['currency'])?$shopDetails['currency']:'USD';\n\n\t\t\t //define(\"CURRENCY\", $currency);\n\t\t\t //$walmartHelper->updatePriceOnWalmart($product,\"webhook\");\n\t\t\t }\n\t\t\t elseif(isset($product['type']) && $product['type']==\"inventory\")\n\t\t\t {\n\t\t\t \t//change price log\n\t\t\t \t//$path='productupdate/inventory/'.$merchant_id.'/'.Data::getKey($product['sku']).'.log';\n\t\t\t \t//Data::createLog(\"inventory data: \".json_encode($product).PHP_EOL,$path);\n\t\t\t \t//$walmartHelper->updateInventoryOnWalmart($product,\"webhook\");\n\n\t\t\t }\n\t\t\t //save product update log\n\t\t\t $productExist=Data::sqlRecords(\"SELECT id FROM walmart_price_inventory_log WHERE merchant_id='\".$product['merchant_id'].\"' and sku='\".addslashes($product['sku']).\"' LIMIT 0,1\",'one','select');\n\t\t\t if(is_array($productExist) && count($productExist)>0)\n\t\t\t {\n\n\t\t\t \t$query=\"UPDATE walmart_price_inventory_log SET type='\".$product['type'].\"',data='\".addslashes(json_encode($product)).\"' WHERE merchant_id='\".$product['merchant_id'].\"' and sku='\".addslashes($product['sku']).\"'\";\n\t\t\t \tData::createLog(\"product update data: \".$query.PHP_EOL,$path);\n\t\t\t \t//echo \"<br>\".\"update\".$query;\n\t\t\t \tData::sqlRecords($query,null,'update');\n\t\t\t }\n\t\t\t else\n\t\t\t {\n\t\t\t \t$sku = addslashes($product['sku']);\n\t\t\t \t$query=\"INSERT INTO `walmart_price_inventory_log`(`merchant_id`,`type`,`data`,`sku`) VALUES('{$product['merchant_id']}','{$product['type']}','\".addslashes(json_encode($product)).\"','{$sku}')\";\n\t\t\t \t//echo \"<br>\".\"insert\".$query;\n\t\t\t \tData::createLog(\"product insert data: \".$query.PHP_EOL,$path);\n\t\t\t \tData::sqlRecords($query,null,'insert');\n\t\t\t }\n\t\t\t }\n\t\t\t}\n\t\t\tcatch(Exception $e)\n\t\t\t{\n\t\t\t\tData::createLog(\"productupdate error \".json_decode($_POST),'productupdate/exception.log','a',true);\n\t\t\t}\n\t }\n\t else\n\t\t{\n\t\t\tData::createLog(\"product update error\");\n\t\t}\n\t}", "public function testUpdate()\n\t{\n\t\t// Update just updates the given fields, let's the rest unchanged.\n\t\t// Use Replace to replace all fields.\n\t\t$updateProduct = [\n\t\t\t'description' => 'This is a product description.',\n\t\t\t'price' => 1150.00\n\t\t];\n\n\t\t$service = $this->getService();\n\n\t\t// Update product\n\t\t$this->mockResponseFromFile('products.update.success');\n\t\t$response = $service->update()->pin('AD8CCDD5F9')->area('work')->spn('MBA11')->product($updateProduct)->execute();\n\t\t$this->assertIsArray($response);\n\t\t$this->assertArrayHasKey('kind', $response);\n\t\t$this->assertArrayHasKey('link', $response);\n\t}", "public function update_post()\n {\n\t\t$product_id = $this->post('product_id');\n\t\t$name = $this->post('name');\n $sku = $this->post('sku');\n $category = $this->post('category');\n $price = $this->post('price');\n\n\n\t\t$productData = array(\n 'name' => $name,\n 'sku' => $sku,\n 'category' => $category,\n 'price' => $price, \n );\n\t\n\t\t$this->db->where('id', $product_id);\n\t\t$this->db->update('products', $productData);\n\t\t$this->response([\n\t\t\t'status' => true,\n\t\t\t'message' => \"Update product details successfully\",\n\t\t], Restserver\\Libraries\\REST_Controller_Definitions::HTTP_CREATED); // CREATED (201) being the HTTP response code\n\t\texit;\n\t}", "public function updateProduct()\n {\n \t$quote=$this->getQuote();\n \tif($quote)\n \t{\n \t\t$detailproduct=$this->getProduct();\n \t\t$quoteproduct=$quote->getProduct();\n \t\tif(\n\t\t\t\t$quote->getPrice()!=$this->getPrice() or\n\t\t\t\t$quote->getDiscrate()!=$this->getDiscrate() or\n\t\t\t\t$quote->getDiscamt()!=$this->getDiscamt() or\n\t\t\t\t$quote->getProductId()!=$this->getProductId()\n\t\t\t)\n\t\t\t{\n\t\t\t\t$quote->setPrice($this->getPrice());\n\t\t\t\t$quote->setDiscrate($this->getDiscrate());\n\t\t\t\t$quote->setDiscamt($this->getDiscamt());\n\t\t\t\t$quote->setProductId($this->getProductId());\n\t\t\t\t$quote->calc(); //auto save\n\t\t\t\t$detailproduct->calcSalePrices();\n\t\t\t\t\n\t\t\t\t//if product changed, calc old product\n\t\t\t\tif($quoteproduct->getId()!=$detailproduct->getId())\n\t\t\t\t\t$quoteproduct->calcSalePrices();\n\t\t\t}\n \t}\n \telse\n \t{\n\t\t\t//if none, see if product quote by vendor with similar pricing exists. \n\t\t\t$quote=Fetcher::fetchOne(\"Quote\",array('total'=>$this->getUnittotal(),'vendor_id'=>SettingsTable::fetch(\"me_vendor_id\"),'product_id'=>$this->getProductId()));\n\n\t\t\t//if it doesn't exist, create it, and product->calc()\n\t\t\tif(!$quote)\n\t\t\t{\n\t\t\t\tQuoteTable::createOne(array(\n\t\t\t\t\t'date'=>$this->getInvoice()->getDate(),\n\t\t\t\t\t'price'=>$this->getPrice(),\n\t\t\t\t\t'discrate'=>$this->getDiscrate(),\n\t\t\t\t\t'discamt'=>$this->getDiscamt(),\n\t\t\t\t\t'vendor_id'=>SettingsTable::fetch(\"me_vendor_id\"),\n\t\t\t\t\t'product_id'=>$this->getProductId(),\n\t\t\t\t\t'ref_class'=>\"Invoicedetail\",\n\t\t\t\t\t'ref_id'=>$this->getId(),\n\t\t\t\t\t'mine'=>1,\n\t\t\t\t\t));\n\t\t\t\t$this->getProduct()->calcSalePrices();\n\t\t\t}\n \t}\n }", "public function products_updated_callback($request)\n {\n global $wpdb;\n\n /**\n * Check days set and use default if not.\n */\n $days = 30;\n if (isset($request['days'])) {\n $days = intval($request['days']);\n }\n\n /**\n * Check hours set and use default if not.\n */\n $hours = 0;\n if (isset($request['hours'])) {\n $hours = intval($request['hours']);\n }\n\n // How many days back?\n $time = strtotime('- '.$days.' days');\n\n // if have hours, subtract\n if ($hours) {\n $time = $time - (60 * 60 * $hours);\n }\n\n // format 'from date'\n $from = date('Y-m-d H:i:s', $time);\n\n // limit/offset\n $limit = 200000;\n $offset = 0;\n\n if (isset($request['limit'])) {\n $limit = intval($request['limit']);\n }\n\n if (isset($request['offset'])) {\n $offset = intval($request['offset']);\n }\n\n /**\n * Get products where the date modified is greater than x days ago.\n */\n $products = $wpdb->get_results($wpdb->prepare(\n \"\n\t\t\t\tSELECT \n\t\t\t\t\tid,\n\t\t\t\t\tUNIX_TIMESTAMP(CONVERT_TZ(post_modified_gmt, '+00:00', @@session.time_zone)) as last_updated\n\t\t\t\tFROM $wpdb->posts\n\t\t\t\tWHERE post_type = 'product' \n\t\t\t\t\tAND post_modified > %s\n\t\t\t\t\tAND post_status != 'trash'\n\t\t\t\tLIMIT %d, %d\n\t\t\t\",\n array(\n $from,\n $offset,\n $limit,\n )\n ));\n\n /**\n * Prepare response.\n */\n $data = array(\n 'products' => $products,\n );\n\n /**\n * Response.\n */\n $response = rest_ensure_response($data);\n $response->set_status(200);\n\n return $response;\n }", "public function checkoutCartUpdateItemComplete(Varien_Event_Observer $observer)\n {\n $this->_lastUpdatedItem = $observer->getItem();\n }", "public function productAddOrUpdate(Varien_Event_Observer $observer)\n {\n try \n {\n $helper = Mage::helper('increasingly_analytics');\n\n if ($helper->isEnabled())\n {\n $productId = $observer->getEvent()->getProduct()->getId();\n $product = Mage::getModel('catalog/product')->load($productId);\n\n $productFormatHelper = Mage::helper('increasingly_analytics/ProductFormatter'); \n \n $formattedProductInfo = $productFormatHelper->formatProductInfo($product);\n $helper->increasinglyApi($formattedProductInfo,'product_add_or_update','track',$helper->getApiToken(),$helper->getApiSecret());\n }\n\n }\n catch(Exception $e)\n {\n Mage::log(\"Product Add or Update tracking - \" . $e->getMessage(), null, 'Increasingly_Analytics.log');\n }\n }", "public function after_update() {}", "protected function afterUpdating()\n {\n }", "public function afterUpdate($product)\n {\n $this->indexer->refreshFlat($product);\n\n $this->refreshInventoryIndices($product);\n\n $this->refreshPriceIndices($product);\n\n $this->refreshElasticSearchIndices($product);\n }", "public function hookActionProductUpdate($params)\n {\n $config = Tools::jsonDecode(Configuration::get('KB_PUSH_NOTIFICATION'), true);\n \n if (!empty($config) && isset($config['module_config']['enable'])) {\n $module_config = $config['module_config'];\n if (!empty($params) && isset($params['id_product'])) {\n $product = $params['product'];\n $id_product = $params['id_product'];\n $subscribed_products = DB::getInstance()->executeS(\n 'SELECT sm.*,s.reg_id as id_reg FROM ' . _DB_PREFIX_ . 'kb_web_push_product_subscriber_mapping sm INNER JOIN '._DB_PREFIX_.'kb_web_push_subscribers s on (s.id_subscriber=sm.id_subscriber AND s.id_shop='.(int)$this->context->shop->id.') '\n . ' where sm.id_shop='.(int)$this->context->shop->id.' AND sm.id_product=' . (int) $id_product\n );\n $stock_reg_ids = array();\n $price_reg_ids = array();\n $fcm_setting = Tools::jsonDecode(Configuration::get('KB_PUSH_FCM_SERVER_SETTING'), true);\n if (!empty($fcm_setting)) {\n $fcm_server_key = $fcm_setting['server_key'];\n $headers = array(\n 'Authorization:key=' . $fcm_server_key,\n 'Content-Type:application/json'\n );\n if (!empty($subscribed_products)) {\n foreach ($subscribed_products as $sub_product) {\n $id_lang = $sub_product['id_lang'];\n $id_shop = $sub_product['id_shop'];\n $product_list = new Product($id_product, $id_lang, $id_shop);\n \n $id_customer = Db::getInstance()->getValue('SELECT id_customer FROM ' . _DB_PREFIX_ . 'guest where id_guest=' . (int) $sub_product['id_guest']);\n $id_product_attribute = $sub_product['id_product_attribute'];\n $priceDisplay = Product::getTaxCalculationMethod($id_customer);\n $productPrice = Product::getPriceStatic($id_product, false, $id_product_attribute, 6);\n if (!$priceDisplay || $priceDisplay == 2) {\n $productPrice = Product::getPriceStatic($id_product, true, $id_product_attribute, 6);\n }\n $subscriber_usr = KbPushSubscribers::getSubscriberRegIDs($sub_product['id_guest'], $id_shop);\n if ($module_config['enable_product_stock_alert']) {\n if (($sub_product['subscribe_type'] == 'stock') && ($sub_product['is_sent'] == 0)) {\n $stock_quantity = StockAvailable::getQuantityAvailableByProduct($id_product, $id_product_attribute, $id_shop);\n if ($stock_quantity > 0) {\n $reg_id = $sub_product['id_reg'];\n// if (!empty($subscriber_usr)) {\n// $reg_id = $subscriber_usr[count($subscriber_usr)-1]['reg_id'];\n// }\n// d($reg_id);\n $kbProduct = new KbPushProductSubscribers($sub_product['id_mapping']);\n $kbProduct->is_sent = 1;\n $kbProduct->sent_at = date('Y-m-d H:i:s');\n $kbProduct->update();\n $id_template = KbPushTemplates::getNotificationTemplateIDByType(self::KBPN_BACK_IN_STOCK_ALERT);\n if (!empty($id_template)) {\n $fields = array();\n $productURL = $this->context->link->getProductLink($id_product);\n $fields = $this->getNotificationPushData($id_template, $id_lang, $id_shop, $productURL);\n if (!empty($fields) && !empty($reg_id)) {\n $message = '';\n if (isset($fields['data']['body'])) {\n $message = $fields['data']['body'];\n $message = str_replace('{{kb_item_name}}', $product_list->name, $message);\n $message = str_replace('{{kb_item_current_price}}', Tools::displayPrice($productPrice), $message);\n $fields['data']['body'] = $message;\n }\n $fields['to'] = $reg_id;\n $fields[\"data\"][\"base_url\"] = $this->getBaseUrl();\n $fields[\"data\"][\"click_url\"] = $this->context->link->getModuleLink($this->name, 'serviceworker', array('action' => 'updateClickPush'), (bool) Configuration::get('PS_SSL_ENABLED'));\n $is_sent = 1;\n $kbTemplate = new KbPushTemplates($id_template, false, $id_shop);\n if (!empty($kbTemplate) && !empty($kbTemplate->id)) {\n $push_id = $this->savePushNotification($kbTemplate, $is_sent, array($reg_id));\n if (!empty($push_id)) {\n $fields[\"data\"][\"push_id\"] = $push_id;\n $result = $this->sendPushRequestToFCM($headers, $fields);\n }\n }\n }\n }\n }\n }\n }\n if ($module_config['enable_product_price_alert']) {\n if (($sub_product['subscribe_type'] == 'price') && ($sub_product['is_sent'] == 0)) {\n if ($productPrice < $sub_product['product_price']) {\n $reg_id = $sub_product['id_reg'];\n //d($reg_id);\n// d($subscriber_usr);\n// if (!empty($subscriber_usr)) {\n// $reg_id = $subscriber_usr[count($subscriber_usr)-1]['reg_id'];\n// }\n $kbProduct = new KbPushProductSubscribers($sub_product['id_mapping']);\n $kbProduct->product_price = $productPrice;\n $kbProduct->is_sent = 0;\n $kbProduct->sent_at = date('Y-m-d H:i:s');\n $kbProduct->update();\n $id_template = KbPushTemplates::getNotificationTemplateIDByType(self::KBPN_PRICE_ALERT);\n if (!empty($id_template)) {\n $fields = array();\n $productURL = $this->context->link->getProductLink($id_product);\n $fields = $this->getNotificationPushData($id_template, $id_lang, $id_shop, $productURL);\n if (!empty($fields) && !empty($reg_id)) {\n $message = '';\n if (isset($fields['data']['body'])) {\n $message = $fields['data']['body'];\n $message = str_replace('{{kb_item_name}}', $product_list->name, $message);\n $message = str_replace('{{kb_item_current_price}}', Tools::displayPrice($productPrice), $message);\n $message = str_replace('{{kb_item_old_price}}', Tools::displayPrice($sub_product['product_price']), $message);\n $fields['data']['body'] = $message;\n }\n $fields['to'] = $reg_id;\n $fields[\"data\"][\"base_url\"] = $this->getBaseUrl();\n $fields[\"data\"][\"click_url\"] = $this->context->link->getModuleLink($this->name, 'serviceworker', array('action' => 'updateClickPush'), (bool) Configuration::get('PS_SSL_ENABLED'));\n $is_sent = 1;\n $kbTemplate = new KbPushTemplates($id_template, false, $id_shop);\n $push_id = $this->savePushNotification($kbTemplate, $is_sent, array($reg_id));\n if (!empty($push_id)) {\n $fields[\"data\"][\"push_id\"] = $push_id;\n $result = $this->sendPushRequestToFCM($headers, $fields);\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return true;\n }", "public function onUpdated(Step $step): void\n {\n }", "public function products_updated_route()\n {\n register_rest_route($this->namespace, '/products/updated/', array(\n 'methods' => WP_REST_Server::READABLE,\n 'callback' => array($this, 'products_updated_callback'),\n 'permission_callback' => array($this, 'get_items_permissions_check'),\n ));\n }", "public function onPostInstall(Event $event): void\n {\n $this->onPostUpdate($event);\n }", "public function postFlush(PostFlushEventArgs $postFlushEventArgs)\n {\n if (!empty($this->products_to_update))\n {\n $em = $postFlushEventArgs->getEntityManager();\n\n // Update proucts\n foreach ($this->products_to_update as $key => $product)\n {\n // Check if list is empty\n if (empty($this->products_to_update))\n break;\n\n // Update product to fire off the event listeners\n if ($product instanceof Product)\n {\n $status_override = $product->getStatusOverride();\n\n if (!($status_override instanceof Status) || (($status_override instanceof Status) && $status_override->getId() != 3))\n {\n $product->setDateModified(new \\DateTime());\n $em->persist($product);\n }\n }\n\n unset($this->products_to_update[$key]);\n }\n\n $em->flush();\n }\n }", "public function updateItems($products)\n {\n }", "public function update_field() {\n\n\t\t//init controller data\n\t\t$this->extensions->hk_InitData($this, __FUNCTION__);\n\n\t\tif (!$this->user->canModify('listing_grid/product')) {\n\t\t\t$error = new AError('');\n\t\t\treturn $error->toJSONResponse('NO_PERMISSIONS_402',\n\t\t\t\tarray( 'error_text' => sprintf($this->language->get('error_permission_modify'), 'listing_grid/product'),\n\t\t\t\t\t'reset_value' => true\n\t\t\t\t));\n\t\t}\n\n\t\t$this->loadLanguage('catalog/product');\n\n\t\t$this->loadModel('catalog/product');\n\t\tif (isset($this->request->get['id'])) {\n\t\t\t//request sent from edit form. ID in url\n\t\t\tforeach ($this->request->post as $key => $value) {\n\t\t\t\t$err = $this->_validateField($key, $value);\n\t\t\t\tif (!empty($err)) {\n\t\t\t\t\t$error = new AError('');\n\t\t\t\t\treturn $error->toJSONResponse('VALIDATION_ERROR_406', array( 'error_text' => $err ));\n\t\t\t\t}\n if($key=='date_available'){\n $value = dateDisplay2ISO($value);\n }\n $data = array( $key => $value );\n\t\t\t\t$this->model_catalog_product->updateProduct($this->request->get['id'], $data);\n\t\t\t\t$this->model_catalog_product->updateProductLinks($this->request->get['id'], $data);\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\n\t\t//request sent from jGrid. ID is key of array\n\t\t$fields = array( 'product_id', 'product_description', /* 'model',*//* 'price',*//* 'call_to_order', *//* 'quantity',*/ 'status' );\n\t\tforeach ($fields as $f) {\n\t\t\tif (isset($this->request->post[ $f ]))\n\t\t\t\tforeach ($this->request->post[ $f ] as $k => $v) {\n\t\t\t\t\t$err = $this->_validateField($f, $v);\n\t\t\t\t\tif (!empty($err)) {\n\t\t\t\t\t\t$error = new AError('');\n\t\t\t\t\t\treturn $error->toJSONResponse('VALIDATION_ERROR_406', array( 'error_text' => $err ));\n\t\t\t\t\t}\n\t\t\t\t\t$this->model_catalog_product->updateProduct($k, array( $f => $v ));\n\t\t\t\t}\n\t\t}\n\n\t\t//update controller data\n\t\t$this->extensions->hk_UpdateData($this, __FUNCTION__);\n\t}", "public function onUpdate();", "public function onUpdate();", "public function onUpdate();", "protected function _update()\n {\n \n }", "protected function _update()\n {\n \n }", "protected function update() {}", "public function update(Request $request, AplexAdminProductMeta $aplexAdminProductMeta)\n {\n //\n }", "public function afterUpdateAttributes(Varien_Event_Observer $observer)\n {\n $eventName = $observer->getEvent()->getName();\n\n switch ($eventName) {\n case \"catalog_product_attribute_update_after\":\n $productIds = $observer->getEvent()->getProductIds();\n break;\n\n case \"catalog_product_stock_item_mass_change\":\n case \"catalog_product_to_website_change\":\n $productIds = $observer->getEvent()->getProducts();\n break;\n\n default:\n $productIds = array();\n break;\n }\n\n if (! empty($productIds)) {\n Mage::getResourceModel('ddg_automation/catalog')->setUnProcessed($productIds);\n }\n }", "protected function saveUpdateProducts()\r\n\t{\r\n\t\tif (count($this->newProducts) > 0) {\r\n\t\t\t// inserir as novas\r\n\t\t\tforeach ($this->newProducts as $product) {\r\n\t\t\t\t$result = $this->client->catalogProductUpdate($this->sessionid, $product->sku, $product);\r\n\t\t\t\t$this->log->addInfo('updated', array(\"sku\" => $product->sku, \"result\" => $result));\r\n\t\t\t}\r\n\t\t}\r\n\t\t$this->newProducts = array();\r\n\t}", "public function update(ProductUpdateRequest $request, Product $product)\n {\n // TODO de update zorgt ervoor dat er een nieuwe prijs in wordt gezet (dus niet de oude waarde)\n\n $product ->name = $request->name; \n $product->description = $request->description; \n $product->category_id = $request->category_id; \n $product->save(); \n\n if($product->latest_price->price != $request->price) \n\n $price = new Price(); \n $price->price = $request->price; \n $price->effdate = Carbon::now(); \n $price->product_id = $product->id; \n $price->save(); \n\n return redirect()->route('products.index')->with('status', 'Product succesvol Geupdate!'); \n\n }", "protected function afterUpdate()\n {\n }", "protected function afterUpdate()\n {\n }", "public function can_update_a_product()\n {\n $product = $this->create('Product');\n\n $response = $this->actingAs($this->create('User', [], false), 'api')->json('PUT', \"api/products/$product->id\", [\n 'name' => $product->name.'_updated',\n 'slug' => str_slug($product->slug.'_updated'),\n 'price' => $product->price+10\n ]);\n\n $response->assertStatus(200)\n ->assertExactJson([\n 'id' => $product->id,\n 'name' => $product->name.'_updated',\n 'slug' => str_slug($product->slug.'_updated'),\n 'price' => $product->price+10,\n 'created_at' => (string)$product->created_at\n ]);\n\n $this->assertDatabaseHas('products', [\n 'id' => $product->id,\n 'name' => $product->name.'_updated',\n 'slug' => str_slug($product->slug.'_updated'),\n 'price' => $product->price+10,\n 'created_at' => (string)$product->created_at,\n 'updated_at' => (string)$product->updated_at,\n ]);\n }", "public function updated(Component $component): void\n {\n Component::unsetEventDispatcher();\n if (($component->price * $component->quantity) !== $component->cost) {\n $this->componentService->calculateComponentCost($component);\n }\n\n $this->componentService->calculateVendorSummaryData($component);\n }", "public function updateProduct(request $request)\n { \n $data = $request->all();\n if(!empty($data['store_id']))\n {\n $storeId = $data['store_id'];\n $item = (object)$data;\n $checkProduct = StoreProduct::where(['product_id' => $item->id,'store_id' => $storeId])->first();\n\n $productData = [\n \"product_id\" => $item->id,\n \"store_id\" => $storeId,\n \"title\" => $item->title,\n \"vendor\" => $item->vendor,\n \"product_type\" => $item->product_type,\n \"handle\" => $item->handle,\n \"tags\" => $item->tags,\n \"published_scope\" => $item->published_scope,\n ];\n if($checkProduct) \n {\n StoreProduct::where(['product_id'=>$item->id])->update($productData);\n $storeProductsId = $checkProduct->id;\n }\n else\n {\n $responseModel = StoreProduct::create($productData);\n $storeProductsId = $responseModel->id;\n } \n \n /*\n * Update product images\n */ \n foreach ($item->variants as $items) \n { \n $items = (object)$items;\n\n $poductVariantData = [ \n \"store_products_id\" => $storeProductsId,\n \"store_id\" => $storeId,\n \"variant_id\" => $items->id,\n \"product_id\" => $items->product_id,\n \"title\" => $items->title,\n \"price\" => $items->price,\n \"compare_at_price\" => $items->compare_at_price,\n \"sku\" => $items->sku,\n \"position\" => $items->position,\n \"fulfillment_service\" => $items->fulfillment_service,\n \"inventory_management\"=> $items->inventory_management,\n \"inventory_quantity\" => $items->inventory_quantity,\n \"option1\" => $items->option1,\n \"option2\" => $items->option2,\n \"option3\" => $items->option3,\n \"image_id\" => $items->image_id,\n ];\n\n $checkVariant = StoreProductVariants::where(['product_id' => $item->id,'variant_id' => $items->id])->first();\n\n if($checkProduct) \n {\n StoreProductVariants::where(['variant_id'=>$items->id])->update($poductVariantData);\n }\n else\n {\n StoreProductVariants::create($poductVariantData);\n } \n }\n\n /*\n * Update product images\n */ \n foreach ($item->images as $itemimg) \n { \n $itemimg = (object)$itemimg;\n $post_data_image = [\n \"store_products_id\" => $storeProductsId,\n \"store_id\" => $storeId,\n \"image_id\" => $itemimg->id,\n \"product_id\" => $itemimg->product_id,\n \"src\" => $itemimg->src,\n \"alt\" => $itemimg->alt,\n \"position\" => $itemimg->position,\n ];\n\n $checkVariant = StoreProductImages::where(['product_id' => $item->id,'image_id' => $items->id])->first();\n\n if($checkProduct) \n {\n StoreProductImages::where(['image_id'=>$items->id])->update($post_data_image);\n }\n else\n {\n StoreProductImages::create($post_data_image);\n } \n }\n return response()->json(['status' =>true, 'message' =>'Data import','data' =>\"got product\"]); \n }\n else\n {\n return response()->json(['status' =>true, 'message' =>'Data not found','data'=>[]]);\n }\n }", "public function update(): void\n {\n $this->updateQuality();\n $this->updateSellIn();\n $this->expiresAfterSale();\n }", "public function update() {\r\n }", "protected function _update()\n\t{\n\t}", "public function products_update($param = null)\r\n {\r\n if (isset($_POST[\"pro_id\"]) && !empty($_POST[\"pro_id\"])) {\r\n $action = $_POST[\"pro_id\"];\r\n\r\n $update = Product::find($action)->update([\r\n 'pro_title' => $_POST[\"pro_title\"],\r\n 'pro_subtitle1' => $_POST[\"pro_subtitle1\"],\r\n 'pro_subtitle2' => $_POST[\"pro_subtitle2\"],\r\n 'pro_img_url_recto' => $_POST[\"pro_img_url_recto\"],\r\n 'pro_img_url_verso' => $_POST[\"pro_img_url_verso\"],\r\n 'pro_descr' => $_POST[\"pro_descr\"],\r\n 'pro_price_euro' => $_POST[\"pro_price_euro\"],\r\n ]);\r\n\r\n echo $update;\r\n\r\n } else {\r\n echo json_encode([\"error\" => \"ERROR\"]);\r\n }\r\n }", "protected function onUpdated()\n {\n return true;\n }", "public function update()\n {\n }", "public function productUpdated($productId, $slug = '', $type = 'all')\n {\n switch ($type) {\n case 'all':\n self::$cache->delete('Product.' . $productId . '.' . language);\n self::$cache->delete('Product.Slug.' . $slug . '.' . language);\n self::$cache->delete('Product.' . $productId . '.Images' . '.' . language);\n self::$cache->delete('Product.' . $productId . '.Url' . '.' . language);\n self::$cache->delete('Product.' . $productId . '.Attributes' . '.' . language);\n self::$cache->delete('Product.' . $productId . '.Combos' . '.' . language);\n self::$cache->delete('Product.' . $productId . '.Pricing' . '.' . language);\n self::$cache->delete('Product.' . $productId . '.Measurements' . '.' . language);\n self::$cache->delete('Product.' . $productId . '.Reviews' . '.' . language);\n self::$cache->delete('Product.' . $productId . '.Devices' . '.' . language);\n self::$cache->delete('Product.' . $productId . '.categories' . '.' . language);\n $categories = DB::query('select category_id from product_categories where product_id =%i', $productId);\n foreach ($categories as $category) {\n self::$cache->delete('Category.' . $category['category_id'] . '.ProductIds' . '.' . language);\n }\n break;\n case 'category':\n $categories = DB::query('select category_id from product_categories where product_id =%i', $productId);\n foreach ($categories as $category) {\n self::$cache->delete('Category.' . $category['category_id'] . '.ProductIds' . '.' . language);\n }\n break;\n case 'shop':\n $shops = DB::query('select shop_id from product_shop where product_id =%i', $productId);\n foreach ($shops as $shop) {\n self::$cache->delete('shop_class.' . $shop['shop_id'] . '.listShopProducts' . '.' . language);\n }\n break;\n case 'content':\n self::$cache->delete('Product.' . $productId . '.' . language);\n break;\n case 'images':\n self::$cache->delete('Product.' . $productId . '.Images' . '.' . language);\n break;\n case 'price':\n self::$cache->delete('Product.' . $productId . '.Pricing' . '.' . language);\n break;\n case 'measurements':\n self::$cache->delete('Product.' . $productId . '.Measurements' . '.' . language);\n break;\n case 'url':\n self::$cache->delete('Product.' . $productId . '.Url' . '.' . language);\n break;\n case 'combo':\n self::$cache->delete('Product.' . $productId . '.Combos' . '.' . language);\n break;\n case 'comboDeleted':\n self::$cache->delete('Product.' . $productId . '.Combos' . '.' . language);\n break;\n case 'attributes':\n self::$cache->delete('Product.' . $productId . '.Attributes' . '.' . language);\n break;\n case 'reviews':\n self::$cache->delete('Product.' . $productId . '.Reviews' . '.' . language);\n break;\n case 'child':\n self::$cache->delete('Product.' . $productId . '.Devices' . '.' . language);\n break;\n }\n DB::update('product', [['updated_at' => Carbon::now()->format('Y-m-d H:i:s')]], 'id=%i', $productId);\n }", "protected function afterUpdate() {\n\t}", "function after_update() {}", "public function actionProductUpdate1()\n\t{\t\n\t\t\n\t\t$data = $_POST;\n\t\t$connection = Yii::$app->getDb();\n\t\tif(isset($data['id'])){\n\t\t\ttry{\n\n\t\t\t\t$id = $data['id'];\n\t\t\t\t$productData = $data['data'];\n\t\t\t\t$logFIle = 'product/update/'.$id;\n\t\t\t\tData::createLog('getting walmart config : ',$logFIle,'a');\n\t\t\t\t$walmartConfig = Data::sqlRecords(\"SELECT `consumer_id`,`secret_key`,`consumer_channel_type_id` FROM `walmart_configuration` WHERE merchant_id='\".$data['merchant_id'].\"'\",'one','select');\n\n\t\t\t\t$walmartApi = new Walmartapi($walmartConfig['consumer_id'],$walmartConfig['secret_key']);\n\t\t\t\tData::createLog('create product on walmart : ',$logFIle,'a');\n\n\t\t\t\t$preparedData = $walmartApi->createProductOnWalmart([$id],$walmartApi,$data['merchant_id'],$connection,true);\n\t\t\t\t//Data::createLog('response:'.print_r($preparedData,true),$logFIle,'a');\n\t\t\t\tData::createLog('got prepared data : ',$logFIle,'a');\n\t\t\t\tforeach ($productData as $key => $pro_val) \n\t\t\t\t{\n\t\t\t\t\tforeach($pro_val as $index=>$val){\n\t\t\t\t\t\tswitch($index){\n\t\t\t\t\t\t\tcase 'name':\n\t\t\t\t\t\t\t\t\t$preparedData['Product']['productName'] = '<![CDATA[' . $val . ']]>';\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'description':\n\t\t\t\t\t\t\t\t\t$preparedData['Product']['longDescription'] = '<![CDATA[' . $val . ']]>';\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'shelfDescription':\n\t\t\t\t\t\t\t\t\t$preparedData['Product']['shelfDescription'] = '<![CDATA[' . $val . ']]>';\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'main_image':\n\t\t\t\t\t\t\t\t\t$preparedData['Product']['mainImage'] = [\n\t\t\t\t\t\t 'mainImageUrl' => $val,\n\t\t\t\t\t\t 'altText' => isset($pro_val['shelfDescription'])?$pro_val['shelfDescription']:$pro_val['sku'],\n\t\t\t\t\t\t ];\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'default':\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t \t\t\n\t\t\t\t}\n\n\t\t\t\t$dir = Yii::getAlias('@webroot').'/frontend/modules/walmart/filestorage/product/update/';\n\t\t\t\t$filePath = $dir.$data['merchant_id'].'.php';\n\t\t\t\tif(file_exists($filePath)){\n\n\t\t\t\t\t$storedData = require $filePath;\n\t\t\t\t\tunset($preparedData['MPItemFeed']['_value'][0]);\n\t\t\t\t\t$feedItems = $preparedData['MPItemFeed']['_value'];\n\t\t\t\t\t$storedItems = $storedData['MPItemFeed']['_value'];\n\t\t\t\t\t$feedItems = array_merge($storedItems,$feedItems);\n\t\t\t\t\t$preparedData['MPItemFeed']['_value'] = $feedItems;\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!file_exists($dir)) {\n\t\t mkdir($dir, 0775, true);\n\n\t\t }\n\t\t Data::createLog('saving data : ',$logFIle,'a');\n\t\t\t\tfile_put_contents($filePath, '<?php return $arr = ' . var_export($preparedData, true) . ';');\n\t\t Data::createLog('Result : '.json_encode($preparedData),$logFIle,'a');\n\t\t }\n\t\t catch(Exception $e){\n\t\t \tData::createLog('Exception : '.$e->getMessage(),$logFIle,'a');\n\t\t }\n\t }\n\t}", "public function update_products($prod_id){\n\t\t$where = array('prod_id' => $prod_id );\n \t\t$data['prod_details'] =$this->Product_model->view_prod($where);\n\t\t$data['category'] = $this->get_category();\n\t\tview_loader($data,'seller/update_products');\n\t}", "public function updated(Item $item)\n {\n event(new ItemUpdated($item));\n }", "public static function product_offer_updated($id, $job)\n {\n $izberg_product = Mage::getModel('izberg/product')->getCollection()->addFieldToFilter('izberg_product_id', $id)->getFirstItem();\n\n $izberg = Mage::helper(\"izberg\")->getIzberg(array(\"force_admin\" => true));\n $xml = $izberg->get(\"product\", $id, null, 'Accept: application/xml');\n\n $job->addMessage(\"We start to updated product \" . $izberg_product->getId() . \"/\" . $izberg_product->getName() . \" from a webhook\");\n\n $merchant_id = (int) $xml->best_offer->merchant->id;\n $merchant = Mage::getModel('izberg/merchant')->getCollection()->addFieldToFilter(\"izberg_merchant_id\", (int) $xml->best_offer->merchant->id)->getFirstItem();\n\n $createdMerchant = false;\n\n if ($merchant_id == 0) {\n Mage::helper(\"izberg\")->log(\"From product_offer_updated we did not find merchant_id, issue with XML returned by the server?\",2);\n\t \t return;\n }\n\n // If the merchant does not exists we create it, then ignore webhook\n if(!$merchant->getId()) {\n $merchant = $izberg->get(\"merchant\", (int) $xml->best_offer->merchant->id);\n Mage::helper(\"izberg\")->manageMerchantsFromAPIResponse(array($merchant));\n $merchant = Mage::getModel('izberg/merchant')->getCollection()->addFieldToFilter(\"izberg_merchant_id\", (int) $xml->best_offer->merchant->id)->getFirstItem();\n $merchant->setToImport(false);\n $merchant->save();\n $createdMerchant = true;\n $job->addMessage(\"We just created merchant\");\n return;\n }\n\n $izberg_product_new = $izberg_product->isObjectNew();\n\n $izberg_product->addData(array(\n \"izberg_product_id\" => (int) $xml->id,\n \"izberg_merchant_id\" => (int) $merchant->getId(),\n \"izberg_category_id\" => (int) $xml->category,\n \"slug\" => (string) $xml->slug,\n \"name\" => (string) $xml->name,\n \"description\" => (string) $xml->description,\n \"price\" => (float) $xml->best_offer->price,\n \"price_with_vat\" => (float) $xml->best_offer->price_with_vat,\n \"price_without_vat\" => (float) $xml->best_offer->price_without_vat,\n // \"gender\" => (string) $xml->gender,\n \"brand\" => (string) $xml->brand->name,\n \"status\" => (string) $xml->best_offer->status,\n \"free_shipping\" => (bool) $xml->best_offer->free_shipping,\n \"shipping_estimation\" => (string) $xml->best_offer->shipping_estimation,\n \"in_stock\" => (bool) $xml->best_offer->in_stock,\n \"stock\" => (int) $xml->best_offer->stock,\n \"created_at\" => time(),\n \"created_from_json\" => $xml->asXML()\n ));\n $izberg_product->save();\n\n\t // Finishing by import product if we already imported it\n if (!$izberg_product_new && $izberg_product->getImportedAt()) {\n $izberg_product->importInMagentoDb();\n $job->addMessage(\"Product successfully created/updated\");\n } else {\n $job->addMessage(\"Product webhook ignored\");\n }\n\n $job->addMessage(\"Webhook successfuly treated\");\n }", "public function update(Request $request, product $product)\n {\n //\n }", "public function update(Request $request, product $product)\n {\n //\n }", "public function update(Request $request, product $product)\n {\n //\n }", "public function update(Request $request, Product $product)\n {\n // TODO update function\n }", "public function update(Request $request, Product $product) //Actualizar\n {\n //\n }", "public function update(Request $request, Product $product)\n {\n //\n }", "public function update()\r\n {\r\n //\r\n }", "public function update(ProductRequest $request, Product $product)\n {\n $unit = unit::find($request->unit_id);\n $product->name=$request->name;\n $product->stock_alert=$request->stock_alert * $unit->value;\n $product->category_id=$request->category_id;\n $product->type_id=$request->type_id;\n $product->brand_id=$request->brand_id;\n $product->unit_id=$request->unit_id;\n $product->description=$request->description;\n $product->warrenty_id=$request->warrenty_id;\n $product->tax=$request->tax;\n $product->tax_type_id=$request->tax_type_id;\n $product->warrenty_id=$request->warrenty_id;\n \n $product->is_fixed_price = $request->is_fixed_price;\n $product->price_per_unit= $this->calPricePerUnit($request->price,$request->unit_id);\n $product->save();\n \n $this->onlineSync('Product','update',$product->id);\n return redirect(route('products.index'))->withSuccess([\"Product Updated\"]);\n }", "public function UpdateProductInfo($product_id,$updateQunatity)\n\t{\n\t\t$user_id\t= $this->session->userdata('user_id');\n\t\t\n\t\t$data=array('updated_date'\t\t\t=> date(\"Y-m-d H:i:s\"),\n\t\t\t\t\t'quantity'\t\t\t\t=>\t$updateQunatity\n\t\t\t\t\t\t);\n\t\t$this->db->where('user_id', $user_id);\n\t\t$this->db->where('product_id', $product_id);\n\t\t$this->db->where('status', 1);\n\t\t$this->db->update('vefinder_order_temp', $data);\t\t\t\n\t\tif($this->db->affected_Rows())\n\t\t{\n\t\t\treturn true;\n\t\t}\t\t\n\t\telse\n\t\t{\n\t\t\treturn false;\t\t\n\t\t} \n \n }", "public function _update()\n\t {\n\t \t$this->notifyObservers(__FUNCTION__);\n\t }", "public function update()\r\n {\r\n \r\n }", "protected function _postUpdate()\n\t{\n\t}", "public function productquantity() {\n\n $this->checkPlugin();\n\n if ($_SERVER['REQUEST_METHOD'] === 'PUT') {\n //update products\n $requestjson = file_get_contents('php://input');\n $requestjson = json_decode($requestjson, true);\n\n if (!empty($requestjson) && count($requestjson) > 0) {\n $this->updateProductsQuantity($requestjson);\n } else {\n $this->response->setOutput(json_encode(array('success' => false)));\n }\n } else {\n $json['success'] = false;\n $json['error'] = \"Invalid request method, use PUT method.\";\n $this->sendResponse($json);\n }\n }", "protected function onUpdate(): Update\r\n {\r\n }", "public static function postUpdate(Event $event){\n $io = $event->getIO();\n $io->write(\"postUpdate event triggered.\");\n }", "public function update()\n {\n //\n }", "public function update()\n {\n //\n }", "public function update()\n {\n }", "public function update()\n {\n }", "public function update()\n {\n }", "public function update()\n {\n }", "public function update()\n {\n }", "public function update()\n {\n }", "public function update()\n {\n }", "public function update()\n {\n }", "public function update()\n {\n }", "public function update()\n {\n }", "public function update()\n {\n }", "public function update()\n {\n }", "function updateTest()\n {\n $this->cD->updateElement(new Product(1, \"Trang\"));\n }", "protected function performUpdate() {}", "public function update(storeProductUpdate $request, $id)\n {\n $product_update = $request->validated();\n $product = StoreProduct::find($id);\n $product->fill($product_update);\n $product->save();\n\n return response()->json([\"success\" => true, \"message\" => \"Product updated successfully\", \"product\" => $product]);\n }", "public function handleOrderUpdated(OrderChangedEvent $event) {\n $order = $event->order;\n $user = $order->user;\n if( null != $user ) {\n $user->notify(new OrderStatusNotification($order, 'updated'));\n }\n }", "public function setUpdated(): void\n {\n $this->originalData = $this->itemReflection->dehydrate($this->item);\n }", "public function updated(Order $order)\n {\n foreach (OrderProduct::where('order_id',$order->id)->get() as $orderProduct) {\n $product = Product::find($orderProduct->product_id);\n $cardController = new GlobalCardController();\n $product->count = $cardController->countProduct($orderProduct->product_id);\n $product->save();\n }\n }", "public function afterUpdate(&$id, \\stdClass $data, Entity $entity) { }", "public function update() {\n parent::update();\n }", "public function update(Request $request, Product $product)\n {\n }" ]
[ "0.757021", "0.72963434", "0.6792905", "0.6771126", "0.67581177", "0.6548295", "0.6505954", "0.6452342", "0.64054716", "0.6401304", "0.63919085", "0.6344084", "0.63221747", "0.6315688", "0.62788844", "0.62533593", "0.62493336", "0.6187151", "0.61824864", "0.61650133", "0.6159184", "0.6134442", "0.6125612", "0.61170775", "0.608651", "0.6063656", "0.60534304", "0.6050447", "0.6012181", "0.6008101", "0.6007566", "0.59972996", "0.59970903", "0.59886414", "0.5973866", "0.5922499", "0.5922499", "0.5922499", "0.5918856", "0.5918856", "0.59116316", "0.59094167", "0.5909395", "0.5908026", "0.590596", "0.59034526", "0.59034526", "0.5901636", "0.58980143", "0.5896104", "0.58719116", "0.58687264", "0.58682996", "0.5865322", "0.5861435", "0.58599997", "0.5858951", "0.5849548", "0.58316153", "0.58294255", "0.5822311", "0.5821785", "0.5803358", "0.579012", "0.579012", "0.579012", "0.5785614", "0.5774315", "0.5771076", "0.5759922", "0.5755803", "0.575159", "0.57512224", "0.5748462", "0.5746494", "0.57377404", "0.5732857", "0.5724519", "0.5724205", "0.5724205", "0.5719887", "0.5719887", "0.5719887", "0.5719887", "0.5719887", "0.5719887", "0.5719887", "0.5719887", "0.5719887", "0.5719887", "0.5719887", "0.5719887", "0.57198393", "0.57193804", "0.57069206", "0.57061243", "0.5705093", "0.57047623", "0.5703238", "0.5699445", "0.56957144" ]
0.0
-1
Handle the product "deleted" event.
public function deleted(Seller $seller) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function productDelete(Varien_Event_Observer $observer)\n {\n try \n {\n $helper = Mage::helper('increasingly_analytics');\n\n if ($helper->isEnabled()){\n $productId = $observer->getEvent()->getProduct()->getId();\n\n $productData = array('product_id' => $productId);\n $helper->deleteBundleOnProductDeleteFromCart($productId);\n $helper->increasinglyApi($productData,'product_delete','track',$helper->getApiToken(),$helper->getApiSecret());\n }\n\n }\n catch(Exception $e)\n {\n Mage::log(\"Product delete tracking - \" . $e->getMessage(), null, 'Increasingly_Analytics.log');\n }\n }", "public function deleted(Product $producto)\n {\n //\n }", "public function deleted(Product $product)\n {\n $loggerService = new ProductLoggerService($product);\n $loggerService->productDeleted();\n\n if($product->img){\n $product::withoutEvents(function () use($product){\n $product->img = '';\n return $product->update();\n });\n }\n }", "public function deleted($product)\n {\n Storage::deleteDirectory('product/' . $product->id);\n }", "public function product_delete()\n\t\t\t\t{\n\t\t\t\t}", "public static function onAfterDelete(Main\\Event $event)\n\t{\n\t\t$reservationId = (int)$event->getParameter('id')['ID'];\n\t\tif ($reservationId > 0)\n\t\t{\n\t\t\tself::deleteProductReservationMap($reservationId);\n\t\t}\n\t}", "public function deleting($event)\n {\n if ($event instanceof MaterialRelease) {\n if ($event->result) {\n $event->result->delete();\n }\n }\n\n $event->products()->sync([]);\n }", "public function onDelete(): void\n {\n if ($this->globals->getUpdated() !== (int) $_GET['id']) {\n $this->_entity->delete($_GET['id']);\n $this->globals->setUpdated($_GET['id']);\n $this->globals->unsetAlert();\n }\n }", "public function delete()\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', $compareProducts)?$this->View()->getSession('compare', $compareProducts):array();\n\n if (in_array($product_id, $compareProducts)) {\n // unseting product from compare session\n $key = array_search($product_id, $compareProducts);\n unset($compareProducts[$key]);\n }\n\n $this->View()->setSession('compare', $compareProducts);\n\n if ($request['XHR']) {\n die(json_encode([\n 'success' => true,\n 'message' => $this->View()->translating('compare_item_deleted'),\n 'count' => count($compareProducts),\n ]));\n }\n\n Router::redirect('compare');\n }", "public function actionDeleteProduct()\n {\n $order = Order::model()->findByPk(Yii::app()->request->getPost('order_id'));\n\n if (!$order)\n $this->error404(Yii::t('CartModule.admin', 'ORDER_NOT_FOUND'));\n\n if ($order->is_deleted)\n throw new CHttpException(404, Yii::t('CartModule.admin', 'ORDER_ISDELETED'));\n\n $order->deleteProduct(Yii::app()->request->getPost('id'));\n }", "public function delete(){\n $this->product->id = $_GET['delete_id'];\n\n // delete the product\n if($this->product->delete()){\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 \"Object was deleted.\";\n echo \"</div>\";\n }\n\n // if unable to delete the product\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 delete object.\";\n echo \"</div>\";\n }\n }", "public function delete()\n {\n $this->isAuthenticated();\n $this->authToken->isRequestLimitExceeded();\n $this->authToken->logRequest(1);\n\n //get the id from the user\n $data = $_POST;\n //set the id\n $this->product->id = array_values($data)[0];\n\n if ($this->product->delete()) {\n // set response code - 200 ok\n http_response_code(200);\n echo json_encode(array(\"message\" => \"Product was deleted.\"));\n }\n\n // if unable to update the product\n else {\n\n // set response code - 503 service unavailable\n http_response_code(503);\n echo json_encode(array(\"message\" => \"Unable to delete.\"));\n }\n }", "public function onDelete() : void\n {\n parent::onDelete();\n $this->setRef('from__company_id__to__table__companies__columns__id', null, 'products');\n }", "public function handleDelete()\n {\n Craft::$app->getDb()->createCommand()\n ->delete(Table::REVISIONS, ['id' => $this->owner->revisionId])\n ->execute();\n }", "public function handleDeleted(Deleted $event): void\n {\n $entity = $event->entity();\n\n $this->scheduleRemovingOldDocuments($entity);\n\n $this->elasticsearchManager->commit();\n }", "protected function handleDoDelete() {\n\t\t\tif ($this->verifyRequest('DELETE') && $this->verifyParams()) {\n\t\t\t\tif ($this->blnAuthenticated) {\n\t\t\t\t\tif ($intEventId = str_replace('.' . $this->strFormat, '', $this->objUrl->getSegment(3))) {\n\t\t\t\t\t\t$objUserEvent = $this->initModel();\n\t\t\t\t\t\tif ($objUserEvent->loadById($intEventId) && $objUserEvent->count()) {\n\t\t\t\t\t\t\tif ($objUserEvent->current()->get('userid') == AppRegistry::get('UserLogin')->getUserId()) {\n\t\t\t\t\t\t\t\tif ($objUserEvent->destroy()) {\n\t\t\t\t\t\t\t\t\tCoreAlert::alert('The event was deleted successfully.');\n\t\t\t\t\t\t\t\t\t$this->blnSuccess = true;\n\t\t\t\t\t\t\t\t\t$this->intStatusCode = 200;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ttrigger_error(AppLanguage::translate('There was an error deleting the event'));\n\t\t\t\t\t\t\t\t\t$this->error(400);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttrigger_error(AppLanguage::translate('Invalid event permissions'));\n\t\t\t\t\t\t\t\t$this->error(401);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttrigger_error(AppLanguage::translate('There was an error loading the event data'));\n\t\t\t\t\t\t\t$this->error(400);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttrigger_error(AppLanguage::translate('Missing event ID'));\n\t\t\t\t\t\t$this->error(401);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttrigger_error(AppLanguage::translate('Missing or invalid authentication'));\n\t\t\t\t\t$this->error(401);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$this->error(400);\n\t\t\t}\n\t\t}", "public function deleted(Product $product): void\n {\n Artisan::queue('product:update-category-products-count');\n }", "public function delete($event): void;", "private function deleteProduct()\n {\n echo PHP_EOL;\n \n try\n {\n $productToDelete = $this->productDao->getByEan(self::PRODUCT_TURKEY_EAN);\n $resultOfDelete = $this->productDao->delete($productToDelete); \n\n echo 'Product with id: ' . $productToDelete->id . ' was deleted ' .\n (($resultOfDelete) ? '' : 'un') .\n 'successfuly!' . PHP_EOL; \n }\n catch (Exception $e)\n {\n echo $e->getMessage();\n }\n }", "function dokan_delete_product_handler() {\n if ( isset( $_GET['action'] ) && $_GET['action'] == 'dokan-delete-product' ) {\n $product_id = isset( $_GET['product_id'] ) ? intval( $_GET['product_id'] ) : 0;\n\n if ( !$product_id ) {\n wp_redirect( add_query_arg( array( 'message' => 'error' ), get_permalink() ) );\n return;\n }\n\n if ( !wp_verify_nonce( $_GET['_wpnonce'], 'dokan-delete-product' ) ) {\n wp_redirect( add_query_arg( array( 'message' => 'error' ), get_permalink() ) );\n return;\n }\n\n if ( !dokan_is_product_author( $product_id ) ) {\n wp_redirect( add_query_arg( array( 'message' => 'error' ), get_permalink() ) );\n return;\n }\n\n wp_delete_post( $product_id );\n wp_redirect( add_query_arg( array( 'message' => 'product_deleted' ), get_permalink() ) );\n exit;\n }\n}", "public function forceDeleted(Product $producto)\n {\n //\n }", "public function onBeforeDelete();", "public function deleted() {\n // TODO Implement this\n }", "public function deleteProduct(Product $product);", "public function delete_product() {\n\t\t$values=array(\"rstatus\"=>\"C\");\n\t\t$rowIndex = $_POST['row_index'];\n\t\t$where =array(\"id\"=>$_POST['product_id']);\n\t\tif($this->update(\"products\",$values,$where)) {\t\t\t\n\t\t\techo '{\"masterItemsList\":{\"updateFlag\":\"void\",\"rowIndex\":'.$rowIndex.'}}';\n\t\t}\n\t\telse\n\t\t\techo 'Error while deleting';\n\t}", "protected function _postDelete() {}", "protected function onDeleted()\n {\n return true;\n }", "protected function _postDelete() {}", "public function delete() {\n if (!$this->customer->isLogged()) {\n die();\n }\n $product_id = $this->request->post['product_id'];\n $this->load->model('catalog/product');\n\n $this->model_catalog_product->deleteProduct($product_id);\n\n echo \"ok\";\n exit();\n\n }", "public function delete_product(){\r\n\t\tif ($this->checkLogin('A') == ''){\r\n\t\t\tredirect('admin');\r\n\t\t}else {\r\n\t\t\t$product_id = $this->uri->segment(4,0);\r\n\t\t\t$condition = array('id' => $product_id);\r\n\t\t\t$old_product_details = $this->product_model->get_all_details(PRODUCT,array('id'=>$product_id));\r\n\t\t\t$this->update_old_list_values($product_id,array(),$old_product_details);\r\n\t\t\t$this->update_user_product_count($old_product_details);\r\n\t\t\t$this->product_model->commonDelete(PRODUCT,$condition);\r\n\t\t\t$this->setErrorMessage('success','Product deleted successfully');\r\n\t\t\tredirect('admin/product/display_product_list');\r\n\t\t}\r\n\t}", "public function deleted(Order $order)\n {\n foreach (OrderProduct::where('order_id',$order->id)->get() as $orderProduct) {\n $product = Product::find($orderProduct->product_id);\n $cardController = new GlobalCardController();\n $product->count = $cardController->countProduct($orderProduct->product_id);\n $product->save();\n }\n }", "protected function afterDelete()\r\n {\r\n }", "public function destroy(Product $product) //Eliminar\n {\n //\n }", "protected function afterDelete()\n {\n }", "public function deleted(PurchaseReceipt $purchaseReceipt)\n {\n //\n }", "public function hookActionProductDelete($params)\n {\n $id_product = isset($params['product'])\n && $params['product'] instanceof Product ? $params['product']->id : null;\n \n if ($id_product) {\n $this->deleteProductTax($id_product);\n }\n }", "public function delete()\n\t{\n\t\t$product_id = $this->input->post('product_id');\n\t\t$vendor_id = $this->session->userdata('vendor_id');\n\n\t\t$thumb_image = get_product($product_id, 'thumb_image'); //get thumb_image\n\t\t$images = unserialize(get_product($product_id, 'images')); //get multiple images\n\n\t\t$deleted = $this->products->delete($product_id);\n\n\t\tif ($deleted)\n\t\t{\n\t\t\t//thumb image//\n\t\t\t$copy_thumb = str_replace('products', 'products/deleted', $thumb_image); //replace path\n\t\t\tcopy($thumb_image, $copy_thumb); //copy image\n\t\t\tunlink($thumb_image);\n\n\t\t\tforeach ($images as $image) //multiple images//\n\t\t\t{\n\t\t\t\t$copy_image = str_replace('products', 'products/deleted', $image); //replace path\n\t\t\t\tcopy($image, $copy_image); //copy image\n\t\t\t\tunlink($image);\n\t\t\t}\n\n\t\t\t$this->vendors->update_total_product($vendor_id, 'total_products - 1');\n\t\t\techo 'true';\n\t\t}\n\t\telse\n\t\t{\n\t\t\techo 'false';\n\t\t}\n\t}", "public function actionDeleteProduct()\n\t{\n\t\t$model = OrderProduct::model()->findByPk($_POST['product_id']);\n\t\tif($model)\n\t\t\t$model->delete();\n\t}", "public function processDelete(): void \n {\n if ($this->delete()) { // The tag is deleted in the database storage.\n auth()->user()->logActivity($this, 'Tags', 'Has deleted an issue tag with the name ' . $this->name);\n flash(\"The ticket tag with the name <strong>{$this->name}</strong> has been deleted in the application.\")->info()->important();\n }\n }", "public function deleted(Order $order)\n\t{\n\t\t//\n\t}", "public function deleted(Order $order)\n\t{\n\t\t//\n\t}", "public function afterDelete(&$id, Entity $entity) { }", "public function onAfterDelete();", "public function deleted(ProductImage $productImage)\n {\n DeleteImages::dispatch($productImage->path);\n }", "public function delete()\n\t{\n\t\t$this->plugin->setResponse('in delete');\n\t}", "public static function onAfterDelete(ORM\\Event $event): void\n\t{\n\t\tModel\\Price::clearSettings();\n\t}", "public function onAfterDelete() {\r\n\t\tparent::onAfterDelete();\r\n\t\t$this->zlog('Delete');\r\n\t}", "public function deleteProduct(Request $request)\n {\n $product = Product::find($request->id);\n if($product->delete()){\n Session::flash('message', 'Producto eliminado correctamente!!');\n return Redirect::to('products');\n }\n }", "protected function _afterDeleteCommit()\n {\n parent::_afterDeleteCommit();\n\n /** @var \\Mage_Index_Model_Indexer $indexer */\n $indexer = Mage::getSingleton('index/indexer');\n\n $indexer->processEntityAction($this, self::ENTITY, Mage_Index_Model_Event::TYPE_DELETE);\n }", "protected function _afterDeleteCommit()\n {\n parent::_afterDeleteCommit();\n\n /** @var \\Mage_Index_Model_Indexer $indexer */\n $indexer = Mage::getSingleton('index/indexer');\n\n $indexer->processEntityAction($this, $this::ENTITY, Mage_Index_Model_Event::TYPE_DELETE);\n }", "protected function _delete()\n {\n $photoTable = Engine_Api::_()->getItemTable('socialstore_product_photo');\n $photoSelect = $photoTable->select()->where('album_id = ?', $this->getIdentity());\n foreach( $photoTable->fetchAll($photoSelect) as $productPhoto ) {\n $productPhoto->delete();\n }\n\n parent::_delete();\n }", "protected function _postDelete()\n\t{\n\t\t//register events\n\t\t\\Base\\Event::trigger('user.delete',$this->id);\n\t\t//end events\n\t}", "public static function deleted($event) {\n\n\t\t$account = $event->getSubject();\n\n\t}", "function shophead_deleted($item_id = \"\")\n {\n $id = base64_decode($item_id);\n $productitem_data = $this->ProductItem->find('first', array('conditions' => array('ProductItem.id' => $id)));\n if (!empty($productitem_data)) {\n $new_business_data = $productitem_data['ProductItem']['id'];\n if ($this->ProductItem->delete($new_business_data)) {\n $this->Session->write('flash', array(DELETE_RECORD, 'success'));\n $this->redirect(array('controller' => 'ProductItems', 'action' => 'index'));\n } else {\n $this->Session->write('flash', array(FAILURE_MSG, 'failure'));\n $this->redirect(array('controller' => 'ProductItems', 'action' => 'index'));\n }\n } else {\n $this->redirect(array('controller' => 'ProductItems', 'action' => 'index'));\n }\n }", "public function deleted(Installment $installment)\n {\n //\n }", "public function deleted(Order $order)\n {\n //\n }", "public function deleted(Order $order)\n {\n //\n }", "public function delete()\n\t{\n\t\t$res = $this->getDB()->delete('quotes',['quote_id'=>$this->getId()]);\n\n\t\t// Check to see if the query ran properly.\n\t\tif(!$res)\n\t\t{\n\t\t\tthrow new Exception('The product was not deleted from the quote/order.');\n\t\t}\n\t}", "function handleDeleteProgramItem(EventContext $context)\n {\n ProgramItem::deleteProgramItem(fmGetVar(\"program_item_id\"));\n $context->addActionMessage(\"Deleted 1 \" . ProgramItem::getObjectClassDisplayName(fmGetVar(\"program_item_class\")));\n $context->setForward(dirname(__FILE__) . \"/program_item_selector.php\");\n }", "function deleteProduct()\n\t{\n\t\t$id=(int)$_GET['prodid'];\n\t\t\n\t\t$sql='delete from products_table where product_id ='.$id;\n\t\t\n\t\t$obj=new Bin_Query();\n\t\t\n\t\tif($obj->updateQuery($sql))\n\t\t{\t\n\t\t\treturn '<div class=\"success_msgbox\">Product Deleted Successfully</div>';\t\n\t\t}\t\n\t}", "public function _postDelete()\n\t{\n\t\t$this->notifyObservers(__FUNCTION__);\n\t}", "public function deleteProductAction()\n {\n $id = $_GET['id'];\n $productManager = new ProductManager();\n $productManager->deleteProduct($id);\n header('Location: index.php?section=admin&page=adminproducts');\n }", "public function hook_before_delete($id) {\n\t //Your code here\n\n\t }", "public function hook_before_delete($id) {\n\t //Your code here\n\n\t }", "public function hook_before_delete($id) {\n\t //Your code here\n\n\t }", "public static function deleteProduct() {\n $result = array();\n $deleted = lC_Products_Admin::delete($_GET['pid'], $_GET['categories']);\n if ($deleted) {\n $result['rpcStatus'] = RPC_STATUS_SUCCESS;\n }\n\n echo json_encode($result);\n }", "public function collectDeleteProduct($id)\r\n {\r\n $products = $this->ProductsLogic->deleteProduct($id);\r\n include 'view/delete.php';\r\n\r\n }", "public function onBeforeDelete() {\r\n\t\tparent::onBeforeDelete();\r\n\t}", "public function deleteAction()\n {\n \t$id = (int) $this->params()->fromRoute('id', 0);\n \tif (!$id) {\n \t\treturn $this->redirect()->toRoute('order');\n \t}\n \t// Retrieve the current user\n \t$current_user = Functions::getUser($this);\n \t \n \t// Retrieve the allowed routes\n \t$allowedRoutes = Functions::getAllowedRoutes($this);\n\n \t// Retrieve the user's instance\n \t$instance_id = Functions::getInstanceId($this);\n \t\n \t// Retrieve the order product row\n \t$orderProduct = $this->getOrderProductTable()->get($id);\n \t \n \t// Retrieve the order\n \t$order = $this->getOrderTable()->get($orderProduct->order_id);\n\n \t// Retrieve the product\n \t$product = $this->getProductTable()->get($orderProduct->product_id);\n \t \n \t// Retrieve the user validation from the post\n \t$request = $this->getRequest();\n \tif ($request->isPost()) {\n \t\t$del = $request->getPost('del', 'No');\n \n\t\t\t// And delete the entity from the database in the \"yes\" case\n \t\tif ($del == $this->getServiceLocator()->get('translator')->translate('Yes')) {\n \t\t\t$id = (int) $request->getPost('id');\n \t\t\t$this->getOrderProductTable()->delete($id);\n \t\t}\n \n \t\t// Redirect to the index\n \t\treturn $this->redirect()->toRoute('orderProduct/index', array('id' => $order->id));\n \t}\n \n \treturn array(\n \t\t'current_user' => $current_user,\n \t\t'allowedRoutes' => $allowedRoutes,\n \t\t'title' => 'Order',\n \t\t'id' => $id,\n \t\t'order' => $order,\n \t\t'product' => $product\n \t);\n }", "public function destroy()\n {\n if(!auth()->user()->isAdmin()){\n return Redirect('/');\n }\n\n // Get product\n $product = Product::find(request()->id);\n\n // Set product 'deleted'\n $product->delete();\n \n // Return to the page with a message\n Session::flash('msg', 'Product verwijderd');\n return back();\n }", "function delete($product)\n {\n if (array_key_exists($product->id, $this->items)) {\n $storeProductDelete = $this->items[$product->id];\n //giam tien\n $this->totalPrice -= $storeProductDelete['price'];\n //giam so luong\n $this->totalQuantity -= $storeProductDelete['quantity'];\n // xoa phan tu o vi tri $product->id\n unset($this->items[$product->id]);\n }\n }", "public function delete()\n {\n if ($_SERVER['REQUEST_METHOD'] === 'POST') {\n $id = $_POST['id'];\n $pictureManager = new PictureManager();\n $pictureManager->delete($id);\n $productManager = new ProductManager();\n $productManager->delete($id);\n header('location: /adminProduct/list');\n }\n }", "function handleDeleteRelatedPerson(EventContext $context)\n {\n $program_item = $this->storeProgramItem();\n $program_item->removeRelatedPersonById(fmGetVar(\"related_person_id\"));\n RelatedPerson::deleteRelatedPerson(fmGetVar(\"related_person_id\"));\n $context->addActionMessage(\"Deleted 1 Related Person.\");\n $context->setForward(dirname(__FILE__) . \"/program_item_editor.php\");\n }", "public function deleted(EntryInterface $entry)\n {\n //$this->dispatch(new DeleteStream($entry));\n\n parent::deleted($entry);\n }", "protected function _postDelete()\n\t{\n\t}", "public function deleted(Dispatch $dispatch)\n {\n //\n }", "public function hook_before_delete($id) {\n\n }", "static public function ctrDeleteProduct(){\n\n\t\t\t\t\n\n\t\t\tif(isset($_GET[\"idProducto\"])){\n\n\t\t\t\t\t$tabla =\"productos\";\n\t\t\t\t\t$datos = $_GET[\"idProducto\"];\n\n\t\t\t\t\tif($_GET[\"imagen\"] != \"\" && $_GET[\"imagen\"] != \"views/img/products/default/productos.png\"){\n\n\t\t\t\t\t\tunlink($_GET[\"imagen\"]);\n\t\t\t\t\t\trmdir('views/img/products'.$_GET[\"codigo\"]);\n\n\t\t\t\t\t}\n\n\t\t\t\t\t$respuesta = ModelProducts::mdlDeleteProduct($tabla, $datos);\n\n\t\t\t\t\tif($respuesta == \"ok\"){\n\n\t\t\t\t\t\techo'<script>\n\n\t\t\t\t\t\tswal({\n\t\t\t\t\t\t\ttype: \"success\",\n\t\t\t\t\t\t\ttitle: \"El producto ha sido borrado correctamente\",\n\t\t\t\t\t\t\tshowConfirmButton: true,\n\t\t\t\t\t\t\tconfirmButtonText: \"Cerrar\"\n\t\t\t\t\t\t\t}).then(function(result){\n\t\t\t\t\t\t\t\t\t\tif (result.value) {\n\n\t\t\t\t\t\t\t\t\t\twindow.location = \"productos\";\n\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t</script>';\n\n\t\t\t\t\t}\t\n\t\t\t}\t\t\n\t\t}", "public function deleted(Order $Order)\n {\n //code...\n }", "function OnAfterDeleteItem(){\n }", "function onDelete()\n\t{\n\t\treturn $this->getLookupTable()->deleteKey($this->getValue());\n\t}", "public function onBeforeDelete() {\n // Delete all items attached to this order\n foreach($this->Items() as $item) {\n $item->delete();\n }\n\n parent::onBeforeDelete();\n }", "public function hook_after_delete($id) {\n\t //Your code here\n\n\t }", "public function hook_after_delete($id) {\n\t //Your code here\n\n\t }", "public function hook_after_delete($id) {\n\t //Your code here\n\n\t }", "public function deleted(Item $item)\n {\n //\n }", "public function deleted(Item $item)\n {\n //\n }", "protected function entityDelete(){\n // TODO: deal with errors\n // delete from api\n $deleted = $this->resourceService()->delete($this->getId());\n }", "function OnBeforeDeleteItem(){\n }", "public function delete(RegistrationPostDeletedEvent $event): void\n {\n }", "public function postDelete()\n\t{\n\t\t$id = '';\n\t\tif (Request::has('pwp_ids')) {\n\t\t\t$id = Request::input('pwp_ids');\n\t\t} elseif (Request::has('id')) {\n\t\t\t$id = Request::input('id');\n\t\t}\n\n\t\tif (is_numeric($id) || is_array($id)) {\n\t\t\tPwpProduct::destroy($id);\n\t\t\tSession::flash('success', 'The pwp product has been deleted successfully');\n\t\t\treturn new JsonResponse(['success' => 'TRUE']);\n\t\t}\n\t\tSession::flash('error', 'The pwp product has not been deleted. Please correct the errors');\n\t\treturn new JsonResponse(['error' => ['Invalid data posting']], 422);\n\t}", "public function products_delete($param = null)\r\n {\r\n if (isset($_POST[\"pro_id\"]) && !empty($_POST[\"pro_id\"])) {\r\n $action = $_POST[\"pro_id\"];\r\n $delete = Product::find($action)->delete();\r\n $total = Product::count();\r\n echo json_encode([\"total\" => $total, \"isDeleted\" => $delete]);\r\n\r\n } else {\r\n echo json_encode([\"error\" => \"ERROR\"]);\r\n }\r\n }", "public function deleteProductv($id)\n {\n $products=Productvariation::where('variation_id',$id)\n ->update(['deleted'=>1]);\n \n return response()->json(['success'=>'Record has been deleted!']);\n \n }", "public function preDelete($event)\n {\n $chainItem = new ChainItem();\n $chainItem->updateVarnish($this->id);\n $chainItem->free(true);\n }", "public function _event_before_delete() {\n\t\tstatic::$_delete['roles'] = $this->roles;\n\t}", "function delete($id) {\n\t\t$delete = new Product();\n\t\t# load the page with the id from the url\n\t\t$delete->load($id);\n\t\t# send and update query that does a soft delete\n\t\t$delete->delete();\n\t\t# go back to the shop page\n\t\tURL::redirect('/shop');\n\t}", "public function onAfterDelete() {\n\t\tparent::onAfterDelete();\n\n\t\tif($this->isPublished()) {\n\t\t\t$this->doUnpublish();\n\t\t}\n\t}", "public function hook_after_delete($id) {\n\n }", "public function delete_product()\n {\n\t $product_id = (int)$this->uri->segment(4);\n\t //dump($product_id);\n\t \n\t $query = $this->Product_model->delete_product($product_id);\n\t if($query){\n\t\t \n\t\t redirect('admin/Dashboard/product');\n\t\t \n\t } else {\n\t\t\t \n\t\t echo 'error';\n\t\t\t \n\t }\t \n\t \n }", "protected function _deleteEvent($eventId)\n {\n }", "public function beforeDelete(&$id, Entity $entity) { }" ]
[ "0.7335102", "0.7067108", "0.70120865", "0.69779956", "0.693579", "0.6791323", "0.67251253", "0.6722548", "0.6670478", "0.6650355", "0.6602119", "0.65973645", "0.65728694", "0.6553173", "0.65527487", "0.6530389", "0.64949846", "0.64717406", "0.64289016", "0.640731", "0.6369654", "0.6353786", "0.6334821", "0.6320985", "0.628083", "0.62682414", "0.6267909", "0.62670225", "0.6266333", "0.62607014", "0.6246419", "0.62416995", "0.6226986", "0.62254685", "0.6213109", "0.6211984", "0.62108636", "0.6184161", "0.61831754", "0.6167545", "0.6167545", "0.61464447", "0.61291856", "0.6128032", "0.6119818", "0.6119214", "0.6118833", "0.61004835", "0.6094156", "0.6089692", "0.60788447", "0.6073787", "0.6071447", "0.6061721", "0.6052473", "0.60491335", "0.60491335", "0.60488075", "0.6046082", "0.6038094", "0.603274", "0.60202754", "0.600726", "0.600726", "0.600726", "0.6006768", "0.6002401", "0.60022867", "0.59985167", "0.59978795", "0.5995599", "0.5987318", "0.59815794", "0.59812826", "0.5979302", "0.5976638", "0.5975018", "0.59723526", "0.59655875", "0.59536093", "0.5934687", "0.59317505", "0.5928047", "0.5928047", "0.5928047", "0.59250146", "0.59250146", "0.5912282", "0.5907386", "0.59073496", "0.590632", "0.5902958", "0.59009236", "0.58918023", "0.58896136", "0.5880597", "0.5878847", "0.5870388", "0.58691984", "0.58663076", "0.5860476" ]
0.0
-1
Handle the product "restored" event.
public function restored(Seller $seller) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function restored(Product $producto)\n {\n //\n }", "protected function onRestored()\n {\n return true;\n }", "public function restored(PurchaseReceipt $purchaseReceipt)\n {\n //\n }", "public function restored(ProductImage $productImage)\n {\n //\n }", "public function restored(Installment $installment)\n {\n //\n }", "public function restored(Stock $stock)\n {\n //\n }", "public function onrestoreCallback($intID, $strTable, $arrData, $intVersion);", "public function restored(Auditable $model)\n {\n Auditor::execute($model->setAuditEvent('restored'));\n\n // Once the model is restored, we need to put everything back\n // as before, in case a legitimate update event is fired\n static::$restoring = false;\n }", "public function restored(SaleService $saleService)\n {\n //\n }", "public function restored(Order $order)\n\t{\n\t\t//\n\t}", "public function restored(Order $order)\n\t{\n\t\t//\n\t}", "public function after_restore($restore) {\n global $DB;\n\n $data = $this->get_decoded_data();\n if ($newitem = \\restore_dbops::get_backup_ids_record($restore->get_restoreid(), 'course_module', $data->dateitem)) {\n $data->dateitem = $newitem->newitemid;\n try {\n $DB->set_field('customcert_elements', 'data', $this->save_unique_data($data), array('id' => $this->get_id()));\n } catch (\\dml_exception $e) {\n unset($e);\n }\n }\n }", "public function restored(Brand $brand)\n {\n //\n }", "function restore()\n {\n }", "public function restored(Post $post)\n {\n $post->recordActivity('restored');\n }", "public function restored(Order $Order)\n {\n //code...\n }", "public function after_restore(){\n \tglobal $DB;\n \t\n \t\n \t$pagemenuid = $this->get_activityid();\n\n \tif ($modulelinks = $DB->get_records('pagemenu_links', array('pagemenuid' => $pagemenuid))){\n \t\tforeach($modulelinks as $ml){\n \t\t\t\n \t\t\t$ml->previd = $this->get_mappingid('pagemenu_links', $ml->previd);\n \t\t\t$ml->nextid = $this->get_mappingid('pagemenu_links', $ml->nextid);\n\n\t\t\t\tif ($ml->type == 'module'){\n\t \t\t\tif ($link = $DB->get_record('pagemenu_link_data', array('linkid' => $ml->id))){\n\t \t\t\t\t$link->value = $this->get_mappingid('course_module', $link->value);\n\t \t\t\t\t$DB->update_record('pagemenu_link_data', $link);\n\t \t\t\t} else {\n\t\t\t\t\t\t$this->get_logger()->process(\"Failed to restore dependency for pagemenu link '$ml->name'. \", backup::LOG_ERROR); \t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$DB->update_record('pagemenu_links', $ml);\n \t\t}\n \t} \t \t\n }", "public function restore()\n {\n //\n }", "public function restore()\n {\n }", "public function restored(Order $order)\n {\n //\n }", "public function restored(Order $order)\n {\n //\n }", "public function restored(Order $order)\n {\n //\n }", "public function restored(TradeCancel $tradeCancel)\n {\n //\n }", "public function restoring(Order $Order)\n {\n //code...\n }", "public function restore(): void\n\t{\n\t\t$this->processor->restore();\n\t}", "public function undoRestore ()\n {\n if (file_exists ( $this->_previewFilename ))\n {\n unlink($this->_previewFilename);\n }\n }", "public function restored(Job $job)\n {\n //\n }", "public function restore() {}", "public function restored(Document $document)\n {\n //\n }", "public function restored(Subscription $subscription)\n {\n //\n }", "public function afterRestore() : bool\n\t{\n\t\treturn true;\n\t}", "public function updraft_ajaxrestore() {\n\t\t$this->prepare_restore();\n\t\tdie();\n\t}", "public function restored(Exchange $exchange)\n {\n //\n }", "public function afterRestoreResponse($data)\n {\n }", "public function after_restore() {\n global $DB;\n\n // Get the blockid.\n $blockid = $this->get_blockid();\n\n // Extract block configdata and update it to point to the new activities\n if ($configdata = $DB->get_field('block_instances', 'configdata', array('id' => $blockid))) {\n\n $config = unserialize(base64_decode($configdata));\n $update = false;\n $types = array('collectpresentations', 'collectworkshops', 'collectsponsoreds',\n 'conference', 'workshops', 'reception', 'publish',\n 'registerdelegates', 'registerpresenters');\n foreach ($types as $type) {\n if ($this->after_restore_fix_cmid($config, $type)) {\n $update = true;\n }\n }\n\n // cache number of sections in this course\n $numsections = self::get_numesctions($this->get_courseid());\n\n $types = array('review', 'revise');\n foreach ($types as $type) {\n if ($this->after_restore_fix_sectionnum($config, $type, $numsections)) {\n $update = true;\n }\n }\n\n if ($update) {\n $configdata = base64_encode(serialize($config));\n $DB->set_field('block_instances', 'configdata', $configdata, array('id' => $blockid));\n }\n }\n }", "public function restoring($model)\n\t{\n\t}", "public function restored(Transaction $transaction)\n {\n //\n }", "public function restored(Transaction $transaction)\n {\n //\n }", "public function restored(Transaction $transaction)\n {\n //\n }", "public function restored(Transaction $transaction)\n {\n //\n }", "protected function after_restore_course() {\n // Add tool_carcastc related files, no need to maching itemname with itemid.\n $this->add_related_files('tool_carcastc', 'rowfile', 'itemid');\n }", "public function restoring(Auditable $model)\n {\n // When restoring a model, an updated event is also fired.\n // By keeping track of the main event that took place,\n // we avoid creating a second audit with wrong values\n static::$restoring = true;\n }", "public function beforeRestore() : bool\n\t{\n\t\treturn true;\n\t}", "public function restored(Item $item)\n {\n //\n }", "public function restored(Item $item)\n {\n //\n }", "public function restore()\n {\n if ($basketData = $this->session->get(self::BASKET_CART_SESSION_KEY)) {\n static::$cart = unserialize($basketData);\n }\n }", "public function restored(Region $region)\n {\n //\n }", "public function restored(ShopBlog $shopBlog)\n {\n //\n }", "public function restore(User $user, Product $product)\n {\n //\n }", "public function restored(Remission $remission)\n {\n //\n }", "public function handle_exit_recovery_mode()\n {\n }", "public function restore(User $user, Event $event)\n {\n //\n }", "public function restore(User $user, Event $event)\n {\n //\n }", "public function restore();", "protected function performRestore(Model $entity): void\n {\n $entity->restore();\n }", "public function restored(Ticket $ticket)\n {\n //\n }", "public function restored(TechnicalVendorSchedule $technical_vendor_schedule)\n {\n //\n }", "public function restored(Article $article)\n {\n //\n }", "protected static function restore() {}", "public function restored(InstallationTasking $InstallationTasking)\n {\n //\n }", "public function restoreOriginalService(): void;", "public function restored($artistAlias)\n {\n parent::restored($artistAlias);\n\n Log::Info(\"Restored artist alias\", ['artist alias' => $artistAlias->id, 'artist' => $artistAlias->artist->id]);\n }", "public function restored(Post $post)\n {\n //\n }", "public function restored(Post $post)\n {\n //\n }", "public function restored(Historia $historia)\n {\n //\n }", "public function restored(Media $media)\n {\n //\n }", "public function restored(Apartment $apartment)\n {\n //\n }", "public function handleTransactionRollback(TransactionRolledBack $event)\n {\n Log::debug('rollback');\n }", "public function restore(Product $product)\n {\n $this->products->restore($product);\n return redirect()->route(env('APP_BACKEND_PREFIX').'.products.index')->withFlashSuccess('产品恢复成功');\n }", "public function restore_cart() {\n\t\t// delete current cart\n\t\tWC()->cart->empty_cart( true );\n\n\t\t// update user meta with saved persistent\n\t\t$saved_cart = get_user_meta( $this->userId, '_ebanx_persistent_cart', true );\n\n\t\t// then reload cart\n\t\tWC()->session->set( 'cart', $saved_cart );\n\t\tWC()->cart->get_cart_from_session();\n\t}", "public function restored(Expense $expense)\n {\n //\n }", "public function restorethisitem()\n {\n $id_item = $this->request->getParameter(\"id\");\n $this->item->restoreItem($id_item);\n $this->message->extendedCardRestored();\n }", "public function testRestoreState()\n {\n $load = new Load(new Memento());\n $load->pickup();\n $load->enroute();\n $load->deliver();\n\n // Check the last state of the load\n $this->assertSame(State::STATE_DELIVER, $load->getCurrentState());\n\n // Undo the previous state of the load\n $load->undo();\n $this->assertSame(State::STATE_ENTOUTE, $load->getCurrentState());\n\n // Restore the first state of the load\n $load->restore(0);\n $this->assertSame(State::STATE_PICKUP, $load->getCurrentState());\n }", "public function restored(Vehicle $vehicle)\n {\n //\n }", "public function restored(Investor $investor)\n {\n //\n }", "protected function postFixtureRestore()\n {\n }", "public function restored(Role $role)\n {\n }", "function post_restoreItem() {\n\n if ((isset($this->input['_no_history']) && $this->input['_no_history'])\n || (!static::$logs_for_item_1\n && !static::$logs_for_item_2)) {\n return;\n }\n\n if ($this->useDeletedToLockIfDynamic()\n && $this->isDynamic()) {\n $item1 = $this->getConnexityItem(static::$itemtype_1, static::$items_id_1);\n $item2 = $this->getConnexityItem(static::$itemtype_2, static::$items_id_2);\n\n if (($item1 !== false)\n && ($item2 !== false)) {\n if ($item1->dohistory\n && static::$logs_for_item_1) {\n $changes[0] = '0';\n $changes[1] = '';\n $changes[2] = addslashes($this->getHistoryNameForItem1($item2, 'unlock'));\n\n Log::history($item1->getID(), $item1->getType(), $changes, $item2->getType(),\n static::$log_history_1_unlock);\n }\n\n if ($item2->dohistory\n && static::$logs_for_item_2) {\n $changes[0] = '0';\n $changes[1] = '';\n $changes[2] = addslashes($this->getHistoryNameForItem2($item1, 'unlock'));\n Log::history($item2->getID(), $item2->getType(), $changes, $item1->getType(),\n static::$log_history_2_unlock);\n }\n }\n\n }\n }", "public function restoreAction() {\n\t\t$request = reqBup::get('post');\n\t\t$response = new responseBup();\n\t\t$filename = $request['filename'];\n\t\t$model = $this->getModel();\n\t\t\n\t\t$result = $model->restore($filename);\n\n\t\tif (false === $result) {\n $errors = array_merge($model->getDatabase()->getErrors(), $model->getFilesystem()->getErrors());\n if (empty($errors)) {\n $errors = langBup::_('Unable to restore from ' . $filename);\n }\n\t\t\t$response->addError($errors);\n\t\t}\n\t\telse {\n\t\t\t$response->addData($result);\n\t\t\t$response->addMessage(langBup::_('Done!'));\n\t\t}\n\n $response->addData(array('result' => $result));\n return $response->ajaxExec();\n\t}", "public function restore($product, RestoreProductRequest $request)\n {\n if (!$this->productRepository->restoreById($product)) abort(500);\n\n return response('', 200);\n }", "public function restore(int $id)\n {\n //\n }", "public function restored(TraHangNhaCungCap $traHangNhaCungCap)\n {\n //\n }", "function realstate_call_after_uninstall() {\n // for example you might want to drop/remove a table or modify some values\n // In this case we'll remove the table we created to store Example attributes\n $conn = getConnection() ;\n $conn->autocommit(false);\n try {\n $conn->osc_dbExec(\"DELETE FROM %st_plugin_category WHERE s_plugin_name = 'realstate_plugin'\", DB_TABLE_PREFIX);\n $conn->osc_dbExec('DROP TABLE %st_item_house_attr', DB_TABLE_PREFIX);\n $conn->osc_dbExec('DROP TABLE %st_item_house_description_attr', DB_TABLE_PREFIX);\n $conn->osc_dbExec('DROP TABLE %st_item_house_property_type_attr', DB_TABLE_PREFIX);\n $conn->commit();\n } catch (Exception $e) {\n $conn->rollback();\n echo $e->getMessage();\n }\n $conn->autocommit(true);\n}", "public function restored(Partner $partner)\n {\n //\n }", "public function restored(Dispatch $dispatch)\n {\n //\n }", "public function restored(CustomerInquiry $customerInquiry)\n {\n }", "public function restore() {\n self::restoreAll($this->chapterID);\n }", "public function restored(History $history)\n {\n //\n }", "public function restored(Carousel $carousel)\n {\n //\n }", "public function test_restore() {\n global $DB;\n\n $startcount = $DB->count_records('course_modules');\n\n // Delete the course module.\n course_delete_module($this->quiz->cmid);\n\n // Try restoring.\n $recyclebin = new \\tool_recyclebin\\course_bin($this->course->id);\n foreach ($recyclebin->get_items() as $item) {\n $recyclebin->restore_item($item);\n }\n\n // Check that it was restored and removed from the recycle bin.\n $this->assertEquals($startcount, $DB->count_records('course_modules'));\n $this->assertEquals(0, count($recyclebin->get_items()));\n }", "public function restored(ReservationPayment $ReservationPayment)\n {\n //\n }", "public function restored(Menu $menu)\n {\n //\n }", "public function restored(Storage $storage)\n {\n //\n }", "public function restored(RideShareTransaction $rideShareTransaction)\n {\n //\n }", "public function restored(Service $Service)\n {\n //code...\n }", "public function restored(Lote $lote)\n {\n //\n }", "public function restoreAction() {\r\n\t\t$request = reqEbbs::get('post');\r\n\t\t$response = new responseEbbs();\r\n\t\t$filename = $request['filename'];\r\n\t\t$model = $this->getModel();\r\n\r\n // This block for pro-version module 'scrambler'\r\n $needKeyToDecryptDB = dispatcherEbbs::applyFilters('checkIsNeedSecretKeyToEncryptedDB', false, $filename, $request);\r\n if($needKeyToDecryptDB){\r\n $response->addData(array('need' => 'secretKey'));\r\n return $response->ajaxExec();\r\n }\r\n\r\n\t\t$result = $model->restore($filename);\r\n\r\n\t\tif (false === $result) {\r\n $errors = array_merge($model->getDatabase()->getErrors(), $model->getFilesystem()->getErrors());\r\n if (empty($errors)) {\r\n $errors = __('Unable to restore from ' . $filename, EBBS_LANG_CODE);\r\n }\r\n\t\t\t$response->addError($errors);\r\n\t\t}\r\n elseif(is_array($result) && array_key_exists('error', $result)) {\r\n $response->addError($result['error']);\r\n }\r\n elseif(is_array($result) && !empty($result)) {\r\n $content = __('Unable to restore backup files. Check folder or files writing permissions. Try to set 766 permissions to the:', EBBS_LANG_CODE) . ' <br>'. implode('<br>', $result);\r\n $response->addError($content);\r\n }\r\n\t\telse {\r\n\t\t\t$response->addData($result);\r\n\t\t\t$response->addMessage(__('Done!', EBBS_LANG_CODE));\r\n\t\t}\r\n\r\n $response->addData(array('result' => $result));\r\n return $response->ajaxExec();\r\n\t}", "function dynamik_restore_skin()\n{\n\tglobal $skin_message;\n\t$skin_name = $_GET['skinname'];\n\n\tdynamik_skin_options_restore( $skin_name );\n\tdynamik_write_files( $css = true, $ez = true, $custom = false );\n\n\t$skin_message = '<div class=\"notice-box\" style=\"margin:0 0 15px;\"><strong>' . __( 'Dynamik Skin Restored From Snapshot', 'dynamik' ) . '</strong></div>';\n}", "public function restored(MenuItem $menuItem)\n {\n //\n }", "public function restored(Project $project)\n {\n //\n }" ]
[ "0.658101", "0.65215385", "0.64965594", "0.6352464", "0.6332657", "0.61661994", "0.61608434", "0.60924774", "0.6031409", "0.6019611", "0.6019611", "0.60031486", "0.60009795", "0.59737563", "0.59667754", "0.59374636", "0.59350294", "0.59184474", "0.5917748", "0.59089535", "0.59089535", "0.59089535", "0.5862148", "0.58567977", "0.58284986", "0.58053833", "0.57917976", "0.57906985", "0.5785903", "0.577268", "0.57664573", "0.5745057", "0.5737439", "0.57357794", "0.57342005", "0.573337", "0.5712799", "0.5712799", "0.5712799", "0.5712799", "0.57107717", "0.56895936", "0.5639274", "0.5637336", "0.5637336", "0.5636671", "0.562431", "0.56243026", "0.5621806", "0.5613097", "0.5599302", "0.5596453", "0.5596453", "0.55888355", "0.5584165", "0.5574344", "0.55707", "0.5564114", "0.55426025", "0.55397755", "0.5534844", "0.55316824", "0.5524171", "0.5524171", "0.5464574", "0.54638934", "0.5453836", "0.5453152", "0.5443424", "0.54399854", "0.54395247", "0.5435799", "0.54296255", "0.5420581", "0.53980327", "0.53888535", "0.5381738", "0.5359272", "0.5352641", "0.535171", "0.53459483", "0.53457963", "0.5339943", "0.53379107", "0.53355134", "0.5317341", "0.53115475", "0.5302819", "0.5295885", "0.5295804", "0.52950424", "0.5284185", "0.5283461", "0.52805686", "0.52775604", "0.5276574", "0.5274171", "0.5262636", "0.5262019", "0.5261481" ]
0.55779475
55
Handle the product "force deleted" event.
public function forceDeleted(Seller $seller) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function forceDeleted(Product $producto)\n {\n //\n }", "public function onBeforeDelete();", "public function productDelete(Varien_Event_Observer $observer)\n {\n try \n {\n $helper = Mage::helper('increasingly_analytics');\n\n if ($helper->isEnabled()){\n $productId = $observer->getEvent()->getProduct()->getId();\n\n $productData = array('product_id' => $productId);\n $helper->deleteBundleOnProductDeleteFromCart($productId);\n $helper->increasinglyApi($productData,'product_delete','track',$helper->getApiToken(),$helper->getApiSecret());\n }\n\n }\n catch(Exception $e)\n {\n Mage::log(\"Product delete tracking - \" . $e->getMessage(), null, 'Increasingly_Analytics.log');\n }\n }", "public function product_delete()\n\t\t\t\t{\n\t\t\t\t}", "public function onBeforeDelete() {\r\n\t\tparent::onBeforeDelete();\r\n\t}", "protected function _preDelete() {}", "protected function afterDelete()\r\n {\r\n }", "public function deleted(Product $product)\n {\n $loggerService = new ProductLoggerService($product);\n $loggerService->productDeleted();\n\n if($product->img){\n $product::withoutEvents(function () use($product){\n $product->img = '';\n return $product->update();\n });\n }\n }", "public function onAfterDelete() {\n\t\tif (!$this->owner->ID || self::get_disabled() || self::version_exist($this->owner))\n\t\t\treturn;\n\t\t$this->onAfterDeleteCleaning();\n\t}", "protected function afterDelete()\n {\n }", "public function handleDelete()\n {\n Craft::$app->getDb()->createCommand()\n ->delete(Table::REVISIONS, ['id' => $this->owner->revisionId])\n ->execute();\n }", "protected function _postDelete() {}", "public function deleted(Product $producto)\n {\n //\n }", "protected function _postDelete() {}", "public function onDelete() : void\n {\n parent::onDelete();\n $this->setRef('from__company_id__to__table__companies__columns__id', null, 'products');\n }", "protected function onDeleted()\n {\n return true;\n }", "public function onBeforeDelete()\n {\n parent::onBeforeDelete();\n \n $proxied = $this->getProxiedObject();\n \n // Core SS types are decorated so we know we can call this\n $isCoreType = in_array($proxied->getField('ClassName'), $this->acService->ssCoreTypes());\n if($isCoreType && $proxied->canDeleteOnBlockDelete()) {\n $proxied->delete();\n }\n }", "public static function onAfterDelete(Main\\Event $event)\n\t{\n\t\t$reservationId = (int)$event->getParameter('id')['ID'];\n\t\tif ($reservationId > 0)\n\t\t{\n\t\t\tself::deleteProductReservationMap($reservationId);\n\t\t}\n\t}", "public function onAfterDelete();", "public function pre_delete()\r\n\t{\r\n\t\tparent::pre_delete();\r\n\t\t$Change = App::make('Change');\r\n\t\t$Change::where('fmodel', 'GalleryItem')\r\n\t\t\t ->where('fid', $this->id)\r\n\t\t\t ->delete();\r\n\t\t\t \r\n\t\t// Thumbs\r\n\t\t/*if($this->file) {\r\n\t\t\t# Should really check if these are used anywhere else, but no easy way to do that in other modules yet so just leaving them for now\r\n\t\t\t\r\n\t\t\t// Name\r\n\t\t\t$name = basename(public_path().$this->file);\r\n\t\t\t\r\n\t\t\t// Thumbs\r\n\t\t\t$thumbs = Config::get('galleries::thumbs');\r\n\t\t\tforeach($thumbs as $k => $v) {\r\n\t\t\t\tif(file_exists(public_path().$v['path'].$name)) unlink(public_path().$v['path'].$name);\r\n\t\t\t}\r\n\t\t}*/\r\n\t}", "public function onBeforeDelete() {\n // Delete all items attached to this order\n foreach($this->Items() as $item) {\n $item->delete();\n }\n\n parent::onBeforeDelete();\n }", "public function onDelete(): void\n {\n if ($this->globals->getUpdated() !== (int) $_GET['id']) {\n $this->_entity->delete($_GET['id']);\n $this->globals->setUpdated($_GET['id']);\n $this->globals->unsetAlert();\n }\n }", "public function preDelete() { }", "protected function beforeDelete()\n {\n }", "public function forceDeleted(ProductImage $productImage)\n {\n //\n }", "public function deleting($event)\n {\n if ($event instanceof MaterialRelease) {\n if ($event->result) {\n $event->result->delete();\n }\n }\n\n $event->products()->sync([]);\n }", "function dokan_delete_product_handler() {\n if ( isset( $_GET['action'] ) && $_GET['action'] == 'dokan-delete-product' ) {\n $product_id = isset( $_GET['product_id'] ) ? intval( $_GET['product_id'] ) : 0;\n\n if ( !$product_id ) {\n wp_redirect( add_query_arg( array( 'message' => 'error' ), get_permalink() ) );\n return;\n }\n\n if ( !wp_verify_nonce( $_GET['_wpnonce'], 'dokan-delete-product' ) ) {\n wp_redirect( add_query_arg( array( 'message' => 'error' ), get_permalink() ) );\n return;\n }\n\n if ( !dokan_is_product_author( $product_id ) ) {\n wp_redirect( add_query_arg( array( 'message' => 'error' ), get_permalink() ) );\n return;\n }\n\n wp_delete_post( $product_id );\n wp_redirect( add_query_arg( array( 'message' => 'product_deleted' ), get_permalink() ) );\n exit;\n }\n}", "public function deleted($product)\n {\n Storage::deleteDirectory('product/' . $product->id);\n }", "function before_delete() {}", "protected function preDeleteHook($object) { }", "public function delete()\n {\n $this->isAuthenticated();\n $this->authToken->isRequestLimitExceeded();\n $this->authToken->logRequest(1);\n\n //get the id from the user\n $data = $_POST;\n //set the id\n $this->product->id = array_values($data)[0];\n\n if ($this->product->delete()) {\n // set response code - 200 ok\n http_response_code(200);\n echo json_encode(array(\"message\" => \"Product was deleted.\"));\n }\n\n // if unable to update the product\n else {\n\n // set response code - 503 service unavailable\n http_response_code(503);\n echo json_encode(array(\"message\" => \"Unable to delete.\"));\n }\n }", "public function hook_before_delete($id) {\n\n }", "function OnBeforeDeleteItem(){\n }", "protected function onDeleting()\n {\n return true;\n }", "public function forceDeleted(Document $document)\n {\n //\n }", "protected function _predelete() {\n }", "public function hook_before_delete($id) {\n\t //Your code here\n\n\t }", "public function hook_before_delete($id) {\n\t //Your code here\n\n\t }", "public function hook_before_delete($id) {\n\t //Your code here\n\n\t }", "public function actionDeleteProduct()\n {\n $order = Order::model()->findByPk(Yii::app()->request->getPost('order_id'));\n\n if (!$order)\n $this->error404(Yii::t('CartModule.admin', 'ORDER_NOT_FOUND'));\n\n if ($order->is_deleted)\n throw new CHttpException(404, Yii::t('CartModule.admin', 'ORDER_ISDELETED'));\n\n $order->deleteProduct(Yii::app()->request->getPost('id'));\n }", "public function forceDeleted(Installment $installment)\n {\n //\n }", "public function onAfterDelete() {\r\n\t\tparent::onAfterDelete();\r\n\t\t$this->zlog('Delete');\r\n\t}", "public function forceDelete()\n {\n //\n }", "public function delete()\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', $compareProducts)?$this->View()->getSession('compare', $compareProducts):array();\n\n if (in_array($product_id, $compareProducts)) {\n // unseting product from compare session\n $key = array_search($product_id, $compareProducts);\n unset($compareProducts[$key]);\n }\n\n $this->View()->setSession('compare', $compareProducts);\n\n if ($request['XHR']) {\n die(json_encode([\n 'success' => true,\n 'message' => $this->View()->translating('compare_item_deleted'),\n 'count' => count($compareProducts),\n ]));\n }\n\n Router::redirect('compare');\n }", "protected function _postDelete()\n\t{\n\t}", "public function after_delete() {}", "public function onBeforeDelete(&$oid)\n\t{\n\t\t$joins = array(\n\t\t\tarray(\n\t\t\t\t'label' => 'version',\n\t\t\t\t'name' => '#__ars_releases',\n\t\t\t\t'idfield' => 'id',\n\t\t\t\t'idalias' => 'rel_id',\n\t\t\t\t'joinfield' => 'category_id'\n\t\t\t)\n\t\t);\n\n\t\t$this->canDelete($oid, $joins);\n\t}", "public static function onAfterDelete(ORM\\Event $event): void\n\t{\n\t\tModel\\Price::clearSettings();\n\t}", "public function preDelete($event)\n {\n $chainItem = new ChainItem();\n $chainItem->updateVarnish($this->id);\n $chainItem->free(true);\n }", "public function delete(){\n $this->product->id = $_GET['delete_id'];\n\n // delete the product\n if($this->product->delete()){\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 \"Object was deleted.\";\n echo \"</div>\";\n }\n\n // if unable to delete the product\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 delete object.\";\n echo \"</div>\";\n }\n }", "public function forceDeleted(SaleService $saleService)\n {\n //\n }", "public function deleted() {\n // TODO Implement this\n }", "private function deleteProduct()\n {\n echo PHP_EOL;\n \n try\n {\n $productToDelete = $this->productDao->getByEan(self::PRODUCT_TURKEY_EAN);\n $resultOfDelete = $this->productDao->delete($productToDelete); \n\n echo 'Product with id: ' . $productToDelete->id . ' was deleted ' .\n (($resultOfDelete) ? '' : 'un') .\n 'successfuly!' . PHP_EOL; \n }\n catch (Exception $e)\n {\n echo $e->getMessage();\n }\n }", "public function deleted(Product $product): void\n {\n Artisan::queue('product:update-category-products-count');\n }", "function OnAfterDeleteItem(){\n }", "public function beforeDelete()\n {\n $fileService = $this->getCustomizationService();\n $fileService->delete($this);\n return parent::beforeDelete();\n }", "public function delete($event): void;", "protected function postDeleteHook($object) { }", "public function forceDelete();", "public function hook_before_delete($id)\n\t{\n\t\t//Your code here\n\n\t}", "public function hook_after_delete($id) {\n\n }", "protected function _afterDeleteCommit()\n {\n parent::_afterDeleteCommit();\n\n /** @var \\Mage_Index_Model_Indexer $indexer */\n $indexer = Mage::getSingleton('index/indexer');\n\n $indexer->processEntityAction($this, self::ENTITY, Mage_Index_Model_Event::TYPE_DELETE);\n }", "public function _event_before_delete() {\n\t\tstatic::$_delete['roles'] = $this->roles;\n\t}", "public function beforeDelete(&$id, Entity $entity) { }", "public function _postDelete()\n\t{\n\t\t$this->notifyObservers(__FUNCTION__);\n\t}", "protected function _afterDeleteCommit()\n {\n parent::_afterDeleteCommit();\n\n /** @var \\Mage_Index_Model_Indexer $indexer */\n $indexer = Mage::getSingleton('index/indexer');\n\n $indexer->processEntityAction($this, $this::ENTITY, Mage_Index_Model_Event::TYPE_DELETE);\n }", "protected function _postDelete()\n\t{\n\t\t//register events\n\t\t\\Base\\Event::trigger('user.delete',$this->id);\n\t\t//end events\n\t}", "public function beforeDelete(): void\n {\n switch ($this->deletionType) {\n case self::DELETION_TYPE_1:\n $this->deletionType1();\n break;\n case self::DELETION_TYPE_0:\n default:\n $this->deletionType0();\n break;\n }\n }", "public function forceDeleted(Order $order)\n {\n //\n }", "public function forceDeleted(Order $order)\n {\n //\n }", "public function forceDeleted(Order $order)\n {\n //\n }", "public function forceDeleted(Article $article)\n {\n //\n }", "public function hookActionProductDelete($params)\n {\n $id_product = isset($params['product'])\n && $params['product'] instanceof Product ? $params['product']->id : null;\n \n if ($id_product) {\n $this->deleteProductTax($id_product);\n }\n }", "function after_delete() {}", "public function forceDeleted(Post $post)\n {\n }", "function preDelete()\n {\n }", "public function hook_after_delete($id) {\n\t //Your code here\n\n\t }", "public function hook_after_delete($id) {\n\t //Your code here\n\n\t }", "public function hook_after_delete($id) {\n\t //Your code here\n\n\t }", "protected function preDelete() {\n\t\treturn true;\n\t}", "public function forceDeleted(Order $order)\n\t{\n\t\t//\n\t}", "public function forceDeleted(Order $order)\n\t{\n\t\t//\n\t}", "public function forceDeleted(Dispatch $dispatch)\n {\n //\n }", "protected function _delete()\n {\n $photoTable = Engine_Api::_()->getItemTable('socialstore_product_photo');\n $photoSelect = $photoTable->select()->where('album_id = ?', $this->getIdentity());\n foreach( $photoTable->fetchAll($photoSelect) as $productPhoto ) {\n $productPhoto->delete();\n }\n\n parent::_delete();\n }", "public function delete()\n\t{\n\t\t$this->plugin->setResponse('in delete');\n\t}", "public function onAfterDelete() {\n\t\tparent::onAfterDelete();\n\n\t\tif($this->isPublished()) {\n\t\t\t$this->doUnpublish();\n\t\t}\n\t}", "public function forceDeleted(Stock $stock)\n {\n //\n }", "public function afterDelete(&$id, Entity $entity) { }", "function OnDeleteItem(){\n if (! $this->error) {\n $data = array($this->key_field => $this->item_id);\n if (strlen($this->host_library_ID)) {\n $this->library_ID = $this->host_library_ID;\n }\n\n if ($this->disabled_delete) {\n $this->OnAfterError();\n $this->AfterSubmitRedirect(\"?\".($this->Package!=\"\" ? \"package=\".$this->Package.\"&\" : \"\").\"page=\" . $this->listHandler . \"&\" . $this->library_ID . \"_start=\" . $this->start . \"&\" . $this->library_ID . \"_order_by=\" . $this->order_by . \"&library=\" . $this->library_ID . \"&\" . $this->library_ID . \"_parent_id=\" . $this->parent_id . \"&MESSAGE[]=LIBRARY_DISABLED_DELETE\" . \"&\" . $this->restore);\n }\n $errors = $this->HasChildNodes(array($this->item_id));\n if (! strlen($errors)) {\n $this->OnBeforeDeleteItem();\n $this->Storage->Delete($data);\n $this->DeleteNotOrdinaryFields();\n $this->OnAfterDeleteItem();\n $this->AfterSubmitRedirect(\"?\".($this->Package!=\"\" ? \"package=\".$this->Package.\"&\" : \"\").\"page=\" . $this->listHandler . \"&\" . $this->library_ID . \"_start=\" . $this->start . \"&\" . $this->library_ID . \"_order_by=\" . $this->order_by . \"&library=\" . $this->library_ID . \"&\" . $this->library_ID . \"_parent_id=\" . $this->parent_id . \"&MESSAGE=MSG_ITEM_DELETED\" . \"&\" . $this->restore);\n }\n else {\n $this->OnAfterError();\n $this->AfterSubmitRedirect(\"?\".($this->Package!=\"\" ? \"package=\".$this->Package.\"&\" : \"\").\"page=\" . $this->listHandler . \"&\" . $this->library_ID . \"_start=\" . $this->start . \"&\" . $this->library_ID . \"_order_by=\" . $this->order_by . \"&library=\" . $this->library_ID . \"&\" . $this->library_ID . \"_parent_id=\" . $this->parent_id . \"\" . $errors . \"\" . \"&\" . $this->restore);\n }\n }\n }", "public function deleted(Order $order)\n {\n foreach (OrderProduct::where('order_id',$order->id)->get() as $orderProduct) {\n $product = Product::find($orderProduct->product_id);\n $cardController = new GlobalCardController();\n $product->count = $cardController->countProduct($orderProduct->product_id);\n $product->save();\n }\n }", "public function forceDeleted(Brand $brand)\n {\n //\n }", "public function forceDeleted(Post $post)\n {\n //\n }", "public function forceDeleted(Post $post)\n {\n //\n }", "protected function MetaAfterDelete() {\n\t\t}", "protected function handleDoDelete() {\n\t\t\tif ($this->verifyRequest('DELETE') && $this->verifyParams()) {\n\t\t\t\tif ($this->blnAuthenticated) {\n\t\t\t\t\tif ($intEventId = str_replace('.' . $this->strFormat, '', $this->objUrl->getSegment(3))) {\n\t\t\t\t\t\t$objUserEvent = $this->initModel();\n\t\t\t\t\t\tif ($objUserEvent->loadById($intEventId) && $objUserEvent->count()) {\n\t\t\t\t\t\t\tif ($objUserEvent->current()->get('userid') == AppRegistry::get('UserLogin')->getUserId()) {\n\t\t\t\t\t\t\t\tif ($objUserEvent->destroy()) {\n\t\t\t\t\t\t\t\t\tCoreAlert::alert('The event was deleted successfully.');\n\t\t\t\t\t\t\t\t\t$this->blnSuccess = true;\n\t\t\t\t\t\t\t\t\t$this->intStatusCode = 200;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ttrigger_error(AppLanguage::translate('There was an error deleting the event'));\n\t\t\t\t\t\t\t\t\t$this->error(400);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttrigger_error(AppLanguage::translate('Invalid event permissions'));\n\t\t\t\t\t\t\t\t$this->error(401);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttrigger_error(AppLanguage::translate('There was an error loading the event data'));\n\t\t\t\t\t\t\t$this->error(400);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttrigger_error(AppLanguage::translate('Missing event ID'));\n\t\t\t\t\t\t$this->error(401);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttrigger_error(AppLanguage::translate('Missing or invalid authentication'));\n\t\t\t\t\t$this->error(401);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$this->error(400);\n\t\t\t}\n\t\t}", "public function delete_product() {\n\t\t$values=array(\"rstatus\"=>\"C\");\n\t\t$rowIndex = $_POST['row_index'];\n\t\t$where =array(\"id\"=>$_POST['product_id']);\n\t\tif($this->update(\"products\",$values,$where)) {\t\t\t\n\t\t\techo '{\"masterItemsList\":{\"updateFlag\":\"void\",\"rowIndex\":'.$rowIndex.'}}';\n\t\t}\n\t\telse\n\t\t\techo 'Error while deleting';\n\t}", "public function delete()\n\t{\n\t\t$res = $this->getDB()->delete('quotes',['quote_id'=>$this->getId()]);\n\n\t\t// Check to see if the query ran properly.\n\t\tif(!$res)\n\t\t{\n\t\t\tthrow new Exception('The product was not deleted from the quote/order.');\n\t\t}\n\t}", "public function forceDeleted(PurchaseReceipt $purchaseReceipt)\n {\n //\n }", "public function onDelete(){\n return false;\n }", "public function processDelete(): void \n {\n if ($this->delete()) { // The tag is deleted in the database storage.\n auth()->user()->logActivity($this, 'Tags', 'Has deleted an issue tag with the name ' . $this->name);\n flash(\"The ticket tag with the name <strong>{$this->name}</strong> has been deleted in the application.\")->info()->important();\n }\n }", "public function forceDeleted(Food $food)\n {\n //\n }" ]
[ "0.7240171", "0.7073542", "0.6912405", "0.6848888", "0.68262094", "0.6740949", "0.67384857", "0.6731796", "0.6709827", "0.6706043", "0.6703373", "0.66893554", "0.6689212", "0.66892064", "0.66864073", "0.66362995", "0.6604372", "0.65910536", "0.65802634", "0.6575309", "0.6574492", "0.6553032", "0.6548605", "0.65460616", "0.65305316", "0.6503933", "0.6480859", "0.6479849", "0.64731836", "0.6431909", "0.64308715", "0.64268655", "0.64258075", "0.6424462", "0.6411504", "0.6397727", "0.6365789", "0.6365789", "0.6365789", "0.63621217", "0.63348", "0.6329078", "0.6326622", "0.6313217", "0.6305289", "0.63005996", "0.628534", "0.6272497", "0.6259605", "0.6254548", "0.62323004", "0.6222611", "0.62177825", "0.62102926", "0.6189129", "0.61783564", "0.61746234", "0.6171253", "0.616212", "0.6159716", "0.6157618", "0.61520046", "0.6151111", "0.6142597", "0.61410356", "0.61380607", "0.6134771", "0.61284924", "0.6127094", "0.6127094", "0.6127094", "0.6120858", "0.61195666", "0.61149323", "0.6110822", "0.6107381", "0.61071825", "0.61071825", "0.61071825", "0.61054367", "0.6102417", "0.6102417", "0.61006314", "0.6098603", "0.6097809", "0.60961694", "0.6094491", "0.60938424", "0.6092102", "0.60902715", "0.60882354", "0.6084948", "0.6084948", "0.6074634", "0.60690165", "0.60652125", "0.60649997", "0.6056545", "0.6055647", "0.60525703", "0.6043693" ]
0.0
-1
/ replace placeholders in message with values from content array
public function formate($message, array $content) { foreach ($content as $placeholder => $value) { $replacement['{' . $placeholder . '}'] = (string) $value; } return \strtr($message, $replacement); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function makeReplacements(&$message, $token, $replacement) {\n foreach($message as $key => &$value){\n $value = nl2br($value);\n }\n $message['subject'] = str_replace($token, $replacement, $message['subject']);\n $message['body'] = str_replace($token, $replacement, $message['body']);\n }", "public static function replacePlaceholders($message, array $context = array ())\n {\n if (is_array($message) || (false === strpos($message, '{')))\n {\n return $message;\n }\n\n $replacements = array();\n\n // build the replacement array with braces around the context keys\n foreach ($context as $key => $value)\n {\n $replacements['{' . $key . '}'] = LoggerManager::getAsString($value);\n }\n\n // replace placeholders and return the message\n return strtr($message, $replacements);\n }", "public function replace(array $messages, string $domain = 'messages');", "function parse_msg(string $message,array $replacements)\n{\n //If the replacements are not an array ~ return the message\n if(!is_array($replacements))\n { return $message; }\n\n //Otherwise, loop through the replacements and replace them in the message provided\n foreach ($replacements as $key => $value) \n {\n $value = (isset($value) && !empty($value)) ? $value : '[Not set]';\n // replace the $key with the value\n $replace_str = '['.(string)$key.']';;# The string to be replaced\n $message = str_replace($replace_str,$value,$message);\n }\n\n return $message;\n}", "protected function replaceMessagePlaceholdersWithContextData(& $message, array $context)\n {\n $replace = array();\n foreach ($context as $key => $value) {\n if (is_scalar($value) || (is_object($value) && method_exists($value, \"__toString\") ) ) {\n if (is_bool($value) || is_null($value) || is_integer($value) || is_float($value) ) {\n $value = var_export($value, true);\n }\n else {\n $value = strval($value);\n }\n\n $replace[\"{\" . $key . \"}\"] = $value;\n }\n }\n\n $message = strtr($message, $replace);\n }", "public function replaceArrays($message, $array) : string{\n \tforeach($array as $key => $value){\n \t\t$message = str_replace(\"{\" . strtoupper($key) . \"}\", $value, $message);\n \t}\n \treturn $message;\n }", "public function the_replacers($content) {\n \n // Get replacers\n $replacers = md_the_component_variable('content_replacer');\n\n // Get placeholders\n preg_match_all(\"/{[^}]*}/\", $content, $placeholders);\n\n // Verify if placeholders exists\n if ( $placeholders[0] ) {\n\n foreach ( $placeholders[0] as $placeholder ) {\n\n $found = explode(' ', str_replace(array('{', '}'), array('', ''), $placeholder));\n\n if ( $found[0] ) {\n\n if ( isset($replacers[$found[0]]) ) {\n\n $args = array(\n 'start' => 1,\n 'content' => $content\n );\n\n if ( count($found) > 1 ) {\n\n for( $f = 1; $f < count($found); $f++ ) {\n\n parse_str(str_replace('\"', \"\", $found[$f]), $a);\n\n $key = array_keys($a);\n \n if ( isset($a[$key[0]]) ) {\n\n $args[$key[0]] = $a[$key[0]];\n\n }\n\n }\n\n }\n\n $content = $replacers[$found[0]]($args);\n\n } else if ( isset($replacers[str_replace('|', '', $found[0])]) ) {\n\n $args = array(\n 'end' => 1,\n 'content' => $content\n );\n\n $content = $replacers[str_replace('|', '', $found[0])]($args);\n\n }\n\n }\n\n }\n\n }\n\n return $content;\n\n }", "private function replaceVars($message)\r\n {\r\n $arrData = array();\r\n $arrData = $this->forceCamelCase($this->paymentStatus);\r\n $arrData = array_merge($this->forceCamelCase($this->getArray),$arrData);\r\n $arrData['amount'] = number_format(($this->paymentStatus['amount']/100),2,',','.'); // Convert cents into whole amount\r\n \r\n foreach ($arrData as $key=>$val)\r\n {\r\n $arrData[\"#\".$key.\"#\"] = $val; // Append matching value\r\n unset($arrData[$key]);\r\n }\r\n \r\n $message = str_ireplace(array_keys($arrData),array_values($arrData),$message);\r\n \r\n return $message;\r\n }", "private function msg_replace($msg) {\n\n\t\t$find = array();\n\t\t$replace = array();\n\t\tforeach($this->msg_replace as $replace_string=>$find_strings) {\n\t\t\t$find = array_merge($find, $find_strings);\n\t\t\tforeach($find_strings as $string) {\n\t\t\t\t$replace[] = $replace_string;\n\t\t\t}\n\t\t};\n\n\t\t$msg = str_replace($find, $replace, $msg);\n\n\t\treturn $msg;\n\n\t}", "function getEmailMessage($message_text,$hashvalues)\n{\n\tpreg_match_all('/((#\\w+\\b#))/i', $message_text, $matches);\n\tfor ($i = 0; $i < count($matches[1]); $i++)\n\t{\n\t$key = $matches[1][$i];\n\t$value = $matches[2][$i];\n\t$$key = $value;\n\t$message_text=str_replace($key,$hashvalues[$i],$message_text);\n\t}\n\treturn $message_text;\n}", "function setMailContent($data, $content)\n{\n\t$result=$content;\n\tif($data['0']!='')\n\t\t$result = str_replace('{fname}', $data['0'], $result);\n\tif($data['1']!='')\n\t\t$result = str_replace('{username}', $data['1'], $result);\n\tif($data['2']!='')\n\t\t$result = str_replace('{password}', $data['2'], $result);\n\t//echo $result;\t\n\treturn $result;\n}", "function replace_occurrence($string, $values)\n{\n $occurrences = $values->map(function ($message, $key) {\n return [\n 'key' => \":$key\",\n 'message' => $message,\n ];\n });\n\n return str_ireplace(\n $occurrences->pluck('key')->toArray(), $occurrences->pluck('message')->toArray(), $string\n );\n}", "function frame_email_body($message_id, $content_vars, $replace_vals)\n\t{\n\t\t$param_array = func_get_args();\n\t\t\n\t\t$GLOBALS['logger_obj']->debug('<br>METHOD email::frame_email_body() - PARAMETER LIST : ', $param_array);\n\t\t\n\t\tif(count($content_vars) == count($replace_vals))\n\t\t{\t\t\t\n\t\t\t$result = $this->fetch_flds(\"emails\",\"emails_subject,emails_body,emails_format\",\"emails_id = $message_id\");\n\t\t\t\n\t\t\t$records=mysql_fetch_row($result[0]);\n\t\t\t\n\t\t\t$this->email_subject = $records[0];\n\t\t\t\n\t\t\t$this->email_type = $records[2];\n\t\t\t\n\t\t\t//echo $records[1];\n\t\t\t\n\t\t\t$this->email_message = $records[1];\n\t\t\t\n\t\t\tfor($i = 0; $i < count($content_vars); $i++)\n\t\t\t{\n\t\t\t\n\t\t\t\t$this->email_subject = str_replace($content_vars[$i],$replace_vals[$i],$this->email_subject);\n\n\t\t\t\t$this->email_message = str_replace($content_vars[$i],$replace_vals[$i],$this->email_message);\n\t\t\t\t\n\t\t\t}\n\t\t\t$this->email_log_message = $this->email_message;\n\t\t\t//Comment on 27-04-2007\n\t\t\t/*\n\t\t\tif($GLOBALS['site_config']['use_pearmail'] != 1)\n\t\t\t$this->email_message = chunk_split(base64_encode($this->email_message));\n\t\t\t//echo $this->email_message;\n\t\t\t*/\n\t\t\t$GLOBALS['logger_obj']->debug('<br>METHOD email::frame_email_body() - RETURN VALUE : ', $this->email_log_message);\n\t\t}\n\t\t/*else{\t\n\t\techo \"not func\";\t\n\t\t}*/\n\n\t}", "function ourExternalTpl($array, $content)\n {\n $content = str_replace(array(\"{TITLE}\", \"{PROJECT}\", \"{VERSION}\"), array($array['title'], $array['system']['title_project'], $array['system']['version_cms']), $content);\n foreach ($array['lang'] as $key => $value) {\n $content = str_replace(\n '{' . strtoupper($key) . '}',\n $value,\n $content\n );\n }\n echo $content;\n }", "function textblock_template_replace(&$textblock, $replace)\n{\n foreach ($replace as $key => $value) {\n $textblock['title'] = str_replace(\"%$key%\", $value, $textblock['title']);\n $textblock['text'] = str_replace(\"%$key%\", $value, $textblock['text']);\n }\n}", "function ourInsideTpl($array, $content)\n {\n if (!isset($_COOKIE['char'])) { $array['char']['name'] = 'не выбран';} \n $content = str_replace(array(\"{TITLE}\", \"{USERNAME}\", \"{PROJECT}\", \"{VERSION}\", \"{CHAR}\"), array($array['title'], $array['username'], $array['system']['title_project'], $array['system']['version_cms'], $array['char']['name']), $content);\n foreach ($array['lang'] as $key => $value) {\n $content = str_replace(\n '{' . strtoupper($key) . '}',\n $value,\n $content\n );\n }\n echo $content;\n }", "public function contentStrReplace() {}", "function getMessage($msg, $params=NULL){\r\n\tfor($i=0;$i<count($params);$i++)\r\n\t\t$msg = str_replace('%'.($i+1), $params[$i], $msg);\r\n\treturn $msg;\r\n}", "private function interpolate($message, array $context = array())\n {\n // build a replacement array with braces around the context keys\n $replace = array();\n foreach ($context as $key => $val) {\n // check that the value can be casted to string\n if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {\n $replace['{' . $key . '}'] = $val;\n }\n }\n\n // interpolate replacement values into the message and return\n return strtr($message, $replace);\n }", "public function replace(array $messages, string $domain = 'messages'): void;", "function setPlaceholders($placeholders, $tpl) {\r\n $keys = array();\r\n $values = array();\r\n\r\n foreach ($placeholders as $key => $value) {\r\n $keys[] = '[+' . $key . '+]';\r\n $values[] = $value;\r\n }\r\n\r\n return str_replace($keys, $values, $tpl);\r\n }", "function translate_replace($params){\n $string = array_shift($params);\n foreach ($params as $value){\n $replace[] = $value;\n }\n return XT::translate_replace($string, $replace);\n}", "function ReplaceContent( $data, $template_html )\n{\n foreach ( $data as $row )\n {\n //replace fields with values in template\n $content = $template_html;\n foreach($row as $field => $value)\n {\n $content = str_replace(\"@@$field@@\", $value, $content);\n\n }\n\n print $content;\n }\n}", "protected function interpolate($message, array $context = array()) {\n // build a replacement array with braces around the context\n // keys\n $replace = array();\n foreach ($context as $key => $val) {\n $replace['{' . $key . '}'] = $val;\n }\n \n // interpolate replacement values into the message and return\n return strtr($message, $replace);\n }", "function get_fallback_value(&$campaign_content=\"\",&$text_message=\"\",$arrPersonalizeReplace=array()){\n\t$string\t\t=\t\t$campaign_content;\n\t$CI =\t\t& get_instance();\n\t\n\t//$pattren=\"/\\{([a-zA-Z0-9_-])*,([a-zA-Z0-9_-])*\\}/\";\n\t$pattren=\"/\\{([a-zA-Z0-9_-])*,([^\\/])*\\}/\";\n\tpreg_match_all($pattren,$string,$regs);\n\tforeach($regs[0] as $value){\n\t\t$fallback_value=$value;\n\t\t$value=trim($value,'}');\n\t\t$expl_value=explode(\",\",$value,2);\n\t\t$sql = 'SELECT name,value FROM `red_email_personalization` where value like \\'%'.$expl_value[0].'%\\'';\n\t\t$query = $CI->db->query($sql);\n\t\t\n\t\tif ($query->num_rows() >0){\n\t\t\t$result_array=$query->result_array();\t#Fetch resut\n\t\t\tforeach($result_array as $row){\n\t\t\t\t#Create an array of the required personalisation token and default value from CAMPAIGN\n\t\t\t\t$arrPersonalizeReplace[$row['name']] = $expl_value[1];\n\t\t\t\t$fallback_search_arr[]=$fallback_value;\n\t\t\t\t$fallback_replace_arr[]=$row['value'];\n\t\t\t}\n\t\t}\n\t}\n\t\n\t//$campaign_content=str_replace($fallback_search_arr, $fallback_replace_arr, $string);\n\t//$text_message=str_replace($fallback_search_arr, $fallback_replace_arr, $text_message);\n\treturn $arrPersonalizeReplace;\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 }", "private function interpolate($message, array $context): string\n {\n $message = (string) $message;\n if (strpos($message, '{') === false) {\n return $message;\n }\n\n $replacements = [];\n foreach ($context as $key => $val) {\n if ($val === null || is_scalar($val) || (is_object($val) && method_exists($val, '__toString'))) {\n $replacements[\"{{$key}}\"] = $val;\n } elseif ($val instanceof DateTimeInterface) {\n $replacements[\"{{$key}}\"] = $val->format(DateTime::RFC3339);\n } elseif (is_object($val)) {\n $replacements[\"{{$key}}\"] = '[object ' . get_class($val) . ']';\n } else {\n $replacements[\"{{$key}}\"] = '[' . gettype($val) . ']';\n }\n\n if (! isset($replacements[\"{{$key}}\"])) {\n continue;\n }\n\n $replacements[\"{{$key}}\"] = '<comment>' . $replacements[\"{{$key}}\"] . '</comment>';\n }\n\n return strtr($message, $replacements);\n }", "public function replaceTags($message, $data) {\n return str_replace(array_keys($data), array_values($data), $message);\n }", "function msg_val($msg, $args='')\r\n{\r\n global $cf_debug;\r\n\r\n if (!is_array($args)) {\r\n $rs = str_replace(\"%1\", $args, $msg);\r\n }\r\n else {\r\n $rs = $msg;\r\n\r\n if (preg_match_all(\"%\\<[$]([a-z][a-z\\d\\_]*)\\>%i\", $rs, $matcharr)) { // text parms\r\n $matcharr_done = array();\r\n foreach ($matcharr[1] as $attrib) {\r\n if (!in_array($attrib, $matcharr_done)) {\r\n $matcharr_done[] = $attrib;\r\n $value = isset($args[$attrib]) ? $args[$attrib] : '';\r\n //if ($cf_debug) echo (\"msg_val: <$\".$attrib.\"> -> $value\\n\");\r\n $rs = str_replace('<$'.$attrib.'>', $value, $rs);\r\n }\r\n }\r\n }\r\n else if (preg_match_all(\"/[%]([\\d]+)/\", $rs, $matcharr)) { // position-indexed parms\r\n $matcharr_done = array();\r\n foreach ($matcharr[1] as $match) {\r\n $attrib = intval($match - 1);\r\n if (!in_array($attrib, $matcharr_done)) {\r\n $matcharr_done[] = $attrib;\r\n $value = isset($args[$attrib]) ? $args[$attrib] : '';\r\n //if ($cf_debug) echo (\"msg_val: %$attrib -> $value\\n\");\r\n $rs = str_replace(\"%\".$attrib, $value, $rs);\r\n }\r\n }\r\n }\r\n }\r\n return $rs;\r\n}", "function dc_campaign_emails_rules_action_mail_token_replace($message, $settings, RulesState $state, RulesPlugin $element) {\n $message_body = $message;\n\n $datetime = new DateTime();\n $datetime->setTimestamp($state->variables['transaction_time']);\n $new_body = token_replace($message_body, array(\n 'redhen_donation' => $state->variables['redhen_donation']->value(),\n 'transaction_time' => $datetime,\n 'commerce_transaction' => $state->variables['commerce_transaction']->value(),\n ));\n $subtoken = array(\n 'subtoken' => $new_body,\n );\n return $subtoken;\n}", "protected function replaceFieldsInContent(string $content, array $fields): string\n {\n foreach ($fields as $key => $field) {\n ! is_array($field) || $field = implode(', ', $field);\n $content = preg_replace('/\\['.$key.'\\]/', $field, $content);\n }\n\n return $content;\n }", "function transform_text ($text, $settings) {\n foreach ($settings as $key => $value) {\n $text = str_replace(\"{{ $key }}\", $value, $text);\n }\n return $text;\n }", "function replacevars($arrSubstitutes)\n {\n foreach($arrSubstitutes as $var=>$value)\n {\n $this->template = str_replace('<!--['.strtoupper($var).']-->',$value,$this->template);\n }\n \n }", "private function prepare_message()\r\n\t{\r\n\t\t$message = \"\";\r\n\t\tforeach($this->post as $key => $value){\r\n\t\t\t$key = strtoupper($key);\r\n\t\t\t$message.= \"<b>{$key}</b>: {$value} <br>\";\r\n\t\t}\r\n\t\treturn $this->html($message);\r\n\t}", "private function compositeKakaoMessageWithReplacements($message, $replacements): string\n {\n $string = preg_replace('/(\\#\\{[^\\}]+\\})/', '?', $message, -1, $count);\n if (count($replacements) !== $count) {\n throw CouldNotSendNotification::templateMessageFormatUnmatched();\n }\n\n return Str::replaceArray('?', $replacements, $string);\n }", "function webpinas_glf_email_sc($message_with_sc, $data){\n$search = array(\n '[webpinas_venue_address]',\n '[webpinas_suburb]', \n '[webpinas_post_code]', \n '[webpinas_booking_date]', \n '[webpinas_contact_name]', \n '[webpinas_contact_email]',\n '[webpinas_contact_phone]',\n '[webpinas_ip_address]'\n );\n$replace = array(\n $data['venue_address'], // value for [webpinas_venue_address]\n $data['suburb'], // value for [webpinas_suburb]\n $data['post_code'], // value for [webpinas_post_code]\n $data['booking_date'], // value for [webpinas_booking_date]\n $data['contact_name'], // value for [webpinas_contact_name]\n $data['contact_email'], // value for [webpinas_contact_email]\n $data['contact_phone'], // value for [webpinas_contact_phone]\n get_client_ip(), // value for [webpinas_ip_address]\n );\n return $replaced_message = str_replace ( $search, $replace , $message_with_sc );\n}", "function setMailContentAgent($data, $content)\n{\n\t$result=$content;\n\tif($data['0']!='')\n\t\t$result = str_replace('{fname}', $data['0'], $result);\n\tif($data['1']!='')\n\t\t$result = str_replace('{companyname}', $data['1'], $result);\n\tif($data['2']!='')\n\t\t$result = str_replace('{siteurl}', $data['2'], $result);\n\tif($data['3']!='')\n\t\t$result = str_replace('{username}', $data['3'], $result);\n\tif($data['4']!='')\n\t\t$result = str_replace('{password}', $data['4'], $result);\n\t\n\t//echo $result;\t\n\treturn $result;\n}", "protected function interpolate($message, array $context = array())\n {\n // build a replacement array with braces around the context keys\n $replace = array();\n foreach ($context as $key => $val) {\n $replace['{' . $key . '}'] = $val;\n }\n\n // interpolate replacement values into the message and return\n return strtr($message, $replace);\n }", "abstract public function replace($translations);", "function GetMailContentReplace($mail_content, $language_id = 0, $mail_content_default = \"mail_content_default_select\") {\n\n\tif ($language_id) {\n\t\t$lang_path = LangPathById($language_id);\n\t}\n\n\t$lang_content = GetMailContent($mail_content, $lang_path);\n\t$default_content = GetMailContent($mail_content_default, $lang_path);\n\n\t$translit['[site_name]'] = $default_content[\"site_name\"];\n\n\tforeach ($lang_content as $line_name=>$line) {\n\t\t$lang_content[$line_name] = strtr($line, $translit);\n\t}\n\n\treturn array_merge($lang_content, $default_content);\n}", "function _notifications_content_test_format_message($message) {\n $rows = array();\n foreach ($message as $key => $value) {\n $rows[] = array($key, is_array($value) ? _notifications_content_test_format_message($value) : '<pre>' . check_plain($value) . '</pre>');\n }\n return theme('table', array(), $rows);\n}", "function maplesyrupweb_email_filter($args)\n{\n\n // call the email template function\n\t$template = maplesyrupweb_email_template();\n\n //replace \"[message]\" in line 70 with the message coming into the function and the template\n $args['message'] = str_replace(\"[message]\",$args['message'],$template);\n \n\n\tadd_filter('wp_mail_content_type','maplesyrupweb_content_filter');\n\n\treturn $args;\n}", "function cmfcString_replaceVariables($replacements,$text) {\n\t\tforeach ($replacements as $needle=>$replacement) {\n\t\t\t$text=str_replace($needle,$replacement,$text);\n\t\t}\n\t\treturn $text;\n\t}", "protected function doReplacements( array $array ) {\n\t\t$args = [\n\t\t\t$this[ Argument::NAMES ][ Name::SINGULAR_NAME_UC ],\n\t\t\t$this[ Argument::NAMES ][ Name::SINGULAR_NAME_LC ],\n\t\t\t$this[ Argument::NAMES ][ Name::PLURAL_NAME_UC ],\n\t\t\t$this[ Argument::NAMES ][ Name::PLURAL_NAME_LC ],\n\t\t];\n\n\t\tforeach ( $array as $key => $string ) {\n\t\t\t$array[ $key ] = sprintf( $string, ...$args );\n\t\t}\n\n\t\treturn $array;\n\t}", "function replace($template,$_DICTIONARY){\n\t\tforeach ($_DICTIONARY as $clave=>$valor) {\n\t\t\t$template = str_replace('#'.$clave.'#', $valor, $template);\n\t\t}\t\t\n\t\treturn $template;\n\t}", "public function interpolate($message, array $context = array())\n {\n // build a replacement array with braces around the context keys\n $replace = array();\n foreach ($context as $key => $val) {\n // check that the value can be cast to string\n if ($val !=null && !is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {\n $replace['{' . $key . '}'] = $val;\n } elseif ($val instanceof DateTimeInterface) {\n $replace['{' . $key . '}'] = $val->format(DateTime::RFC3339);\n } elseif (is_object($val)) {\n $replace['{' . $key . '}'] = '[object ' . get_class($val) . ']';\n } else {\n $replace['{' . $key . '}'] = '[' . gettype($val) . ']';\n }\n }\n\n // interpolate replacement values into the message and return\n return strtr($message, $replace);\n }", "protected function replace_template_description(array $record, array $replace_datas): array {\r\n\t\t$pattern = '/\\[##([a-z_]+)##\\]/';\r\n\t\t$record['description'] = preg_replace_callback($pattern, function ($matchs) use ($replace_datas) {\r\n\t\t\treturn $replace_datas[$matchs[1]] ?? $matchs[0];\r\n\t\t}, $record['description']);\r\n\t\treturn $record;\r\n\t}", "public function format(array $message);", "public function interpolate(string $message, array $context = []) : string\n {\n $replacements = [];\n\n foreach ($context as $key => $val) {\n if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {\n $replacements['{' . $key . '}'] = $val;\n }\n }\n\n return strtr($message, $replacements);\n }", "protected static function placeholderFormat($string, array $args) {\n // Transform arguments before inserting them.\n foreach ($args as $key => $value) {\n switch ($key[0]) {\n case '@':\n // Escape if the value is not an object from a class that implements\n // \\Drupal\\Component\\Render\\MarkupInterface, for example strings will\n // be escaped.\n // Strings that are safe within HTML fragments, but not within other\n // contexts, may still be an instance of\n // \\Drupal\\Component\\Render\\MarkupInterface, so this placeholder type\n // must not be used within HTML attributes, JavaScript, or CSS.\n $args[$key] = static::placeholderEscape($value);\n break;\n\n case ':':\n // Strip URL protocols that can be XSS vectors.\n $value = UrlHelper::stripDangerousProtocols($value);\n // Escape unconditionally, without checking whether the value is an\n // instance of \\Drupal\\Component\\Render\\MarkupInterface. This forces\n // characters that are unsafe for use in an \"href\" HTML attribute to\n // be encoded. If a caller wants to pass a value that is extracted\n // from HTML and therefore is already HTML encoded, it must invoke\n // \\Drupal\\Component\\Render\\OutputStrategyInterface::renderFromHtml()\n // on it prior to passing it in as a placeholder value of this type.\n // @todo Add some advice and stronger warnings.\n // https://www.drupal.org/node/2569041.\n $args[$key] = Html::escape($value);\n break;\n\n case '%':\n // Similarly to @, escape non-safe values. Also, add wrapping markup\n // in order to render as a placeholder. Not for use within attributes,\n // per the warning above about\n // \\Drupal\\Component\\Render\\MarkupInterface and also due to the\n // wrapping markup.\n $args[$key] = '<em class=\"placeholder\">' . static::placeholderEscape($value) . '</em>';\n break;\n\n default:\n // Deprecate support for random variables that won't be replaced.\n if (ctype_alpha($key[0]) && strpos($string, $key) === FALSE) {\n @trigger_error(sprintf('Support for keys without a placeholder prefix is deprecated in Drupal 9.1.0 and will be removed in Drupal 10.0.0. Invalid placeholder (%s) with string: \"%s\"', $key, $string), E_USER_DEPRECATED);\n }\n else {\n trigger_error(sprintf('Invalid placeholder (%s) with string: \"%s\"', $key, $string), E_USER_WARNING);\n }\n // No replacement possible therefore we can discard the argument.\n unset($args[$key]);\n break;\n }\n }\n\n return strtr($string, $args);\n }", "protected function applyTemplate()\n {\n $message = Intl\\GetText::_d('Flikore.Validator', $this->message);\n foreach ($this->values as $key => $value)\n {\n $message = str_replace(\"%$key%\", Intl\\GetText::_d('Flikore.Validator', $value), $message);\n }\n return $message;\n }", "private function interpolate(ReportMessage $message)\n {\n $metadata = $message->getMetadata();\n $ruleClass = get_class($message->rule);\n $mess = $this->configuration[$ruleClass];\n\n foreach ($metadata as $key => $value) {\n $mess = str_replace('{' . $key . '}', $value, $mess);\n }\n\n return $mess;\n }", "protected function processReplacements($template, $placeholders) {\n\n\t\t// sort by reverse length to prevent placeholder collision\n\t\tusort($placeholders, function ($a, $b) {\n\t\t\treturn mb_strlen($a) < mb_strlen($b);\n\t\t});\n\n\t\tforeach ($placeholders as $placeholder) {\n\n\t\t\t$replacement = $this->getReplacementValue($placeholder);\n\n\t\t\t$template = str_replace(':' . $placeholder, $replacement, $template);\n\t\t}\n\n\t\treturn $template;\n\t}", "public function arraySubstitute($content, $needle, $replace) {\n\t\ttry {\n\t\t\tforeach ($content as $haystack) {\t\t\t\t\n\t\t\t\tif (!is_array($haystack)) { // If it's not an array, sanitize it\n\t\t\t\t\t$newContent[] = str_replace($needle, $replace, $haystack);\n\t\t\t\t} else { // it IS an array, so recurse\n\t\t\t\t\t$newContent[] = self::arraySubstitute($haystack, \n\t\t\t\t\t\t$needle, $replace);\n\t\t\t\t} //<-- end if -->\n\t\t\t} //<-- end foreach -->\t\t\n\t\t\t\n\t\t\treturn $newContent;\n\t\t} catch (Exception $e) { \n\t\t\tthrow new Exception($e->getMessage().' from '.$this->className.'->'.\n\t\t\t\t__FUNCTION__.'() line '.__LINE__\n\t\t\t);\n\t\t} //<-- end try -->\n\t}", "function str_replace_array($search, array $replace, $subject)\n\t{\n\t\tforeach ($replace as $value)\n\t\t{\n\t\t\t$subject = preg_replace('/'.$search.'/', $value, $subject, 1);\n\t\t}\n\n\t\treturn $subject;\n\t}", "public function replace(array $data);", "function find_replace($request) {\r\n\r\n $content = $request['content'];\r\n $keywords = $request['keywords'];\r\n\r\n foreach ($keywords as $keyword) {\r\n $content = str_replace($keyword['find'], $keyword['replace'], $content);\r\n }\r\n\r\n return $content;\r\n}", "function replaceShortCode( $text, $array){\n\t$shortCodes = array( '%fname%', '%lname%', '%address%', '%address2%', '%city%', '%state%', '%zip%', '%pnumber%', \n\t\t\t\t\t\t '%pnumbertype%', '%snumber%', '%snumberType%', '%email%', '%job%', '%cover%', '%resume%', '%siteName%' );\n\t$variables = array( $array->fname, $array->lname, $array->address, $array->address2, $array->city, $array->state, $array->zip, $array->pnumber, \n\t\t\t\t\t\t $array->pnumbertype, $array->snumber, $array->snumberType, $array->email, $array->job, $array->cover, $array->resume, get_option( 'blogname' ) );\n\t\n\t$newText = str_replace( $shortCodes, $variables, $text );\n\t\n\treturn $newText;\n}", "function tplArrayReplace($input, array $replaceKeys, $replaceValues = null)\n {\n if (is_null($replaceValues)) {\n $replaceValues = get($replaceKeys);\n $replaceKeys = array_keys($replaceKeys);\n }\n $cb = function ($payload) use ($replaceValues) {\n return get($replaceValues, $payload['replaceKey'], '');\n };\n\n return tpl($input, $replaceKeys, $cb);\n }", "function replaceVariables($replacements,$text) {\n\t\tforeach ($replacements as $needle=>$replacement) {\n\t\t\t$text=str_replace($needle,$replacement,$text);\n\t\t}\n\t\treturn $text;\n\t}", "public function replace($items);", "function ReplaceContentOneRow( $row, $template_html )\n{\n //replace fields with values in template\n $content = $template_html;\n foreach($row as $field => $value)\n {\n $content = str_replace(\"@@$field@@\", $value, $content);\n }\n\n return $content;\n}", "function ReplaceContentOneRow( $row, $template_html )\n{\n //replace fields with values in template\n $content = $template_html;\n foreach($row as $field => $value)\n {\n $content = str_replace(\"@@$field@@\", $value, $content);\n }\n\n return $content;\n}", "public static function replaceTagContent(EventData_IEM_ADDON_DYNAMICCONTENTTAGS_REPLACETAGCONTENT $data) {\n require_once (SENDSTUDIO_API_DIRECTORY . '/subscribers.php');\n $subsrciberApi = new Subscribers_API();\n $subscriberInfo = $data->info;\n\n foreach ($subscriberInfo as $subscriberInfoEntry) {\n $tagObject = new Addons_dynamiccontenttags();\n $subscriberList = $subsrciberApi->GetAllListsForEmailAddress($subscriberInfoEntry['emailaddress'], $data->lists);\n if (is_array($subscriberList)) {\n foreach($subscriberList as $listKey => $listVal) {\n $subscriberList[$listKey] = $listVal['listid'];\n }\n } else {\n $subscriberList = array($subscriberList);\n }\n\n // preload the array key value and customfield id\n $preloadCustomFieldLoc = array();\n if (is_array($subscriberInfoEntry['CustomFields'])) {\n foreach($subscriberInfoEntry['CustomFields'] as $customFieldKey => $customFieldVal) {\n $preloadCustomFieldLoc[$customFieldVal['fieldid']] = $customFieldKey;\n }\n }\n\n $tagObject->loadTagsByList($subscriberList);\n if ($tagObject->getTagObjectsSize()) {\n $tagsTobeReplaced = array();\n $tagsContentTobeReplaced = array();\n $permanentRulesMatches = array(\n 'email'=>'emailaddress',\n 'format'=>'format',\n 'confirmation'=>'confirmed',\n 'subscribe'=>'subscribedate',\n );\n foreach($tagObject->tags as $tagEntry) {\n $tagEntry->loadBlocks();\n $blocks = $tagEntry->getBlocks();\n $defaultBlock = null;\n foreach($blocks as $blockEntry) {\n $rulesPassed = true;\n $decodedRules = $blockEntry->getDecodedRules();\n foreach ($decodedRules->Rules[0]->rules as $ruleEntry) {\n $continue = false;\n $tempRuleValues = trim(strtolower($ruleEntry->rules->ruleValues));\n $tempActualValues = (isset ($permanentRulesMatches[$ruleEntry->rules->ruleName]) && isset ($subscriberInfoEntry[$permanentRulesMatches[$ruleEntry->rules->ruleName]]))?trim(strtolower($subscriberInfoEntry[$permanentRulesMatches[$ruleEntry->rules->ruleName]])):'';\n switch ($ruleEntry->rules->ruleName) {\n case 'email':\n case 'format':\n case 'confirmation':\n $continue = true;\n break;\n case 'status':\n $tempActualValues = array();\n $tempIndex = '';\n switch ($tempRuleValues) {\n case 'a':\n $tempIndex = 'notboth';\n break;\n case 'b':\n $tempIndex = 'bounced';\n break;\n case 'u':\n $tempIndex = 'unsubscribed';\n break;\n }\n\n switch ($ruleEntry->rules->ruleOperator) {\n case 'equalto':\n if (isset($subscriberInfoEntry[$tempIndex]) && $subscriberInfoEntry[$tempIndex] == 0) {\n $rulesPassed = false;\n } elseif (!(isset($subscriberInfoEntry[$tempIndex])) && !($subscriberInfoEntry['bounced'] == 0 && $subscriberInfoEntry['unsubscribed'] == 0) ) {\n $rulesPassed = false;\n }\n break;\n case 'notequalto':\n if (isset($subscriberInfoEntry[$tempIndex]) && !($subscriberInfoEntry[$tempIndex] == 0)) {\n $rulesPassed = false;\n } elseif (!(isset($subscriberInfoEntry[$tempIndex])) && ($subscriberInfoEntry['bounced'] == 0 && $subscriberInfoEntry['unsubscribed'] == 0) ) {\n $rulesPassed = false;\n }\n break;\n\n }\n break;\n case 'subscribe':\n // date conversion\n $tempActualValues = strtotime(date('Y-m-d', $tempActualValues));\n $tempRuleValues = split('/', $tempRuleValues);\n $tempRuleValues = strtotime(implode('-', array_reverse($tempRuleValues)));\n $continue = true;\n break;\n case 'campaign':\n switch ($ruleEntry->rules->ruleOperator) {\n case 'equalto':\n if (!$subsrciberApi->IsSubscriberHasOpenedNewsletters($subscriberInfoEntry['emailaddress'], $tempRuleValues)) {\n $rulesPassed = false;\n }\n break;\n case 'notequalto':\n if ($subsrciberApi->IsSubscriberHasOpenedNewsletters($subscriberInfoEntry['emailaddress'], $tempRuleValues)) {\n $rulesPassed = false;\n }\n break;\n\n }\n break;\n default:\n $continue = true;\n }\n if ($continue) {\n if ((int)$ruleEntry->rules->ruleName) {\n $tempActualValues = (isset ($preloadCustomFieldLoc[$ruleEntry->rules->ruleName]) && isset ($subscriberInfoEntry['CustomFields'][$preloadCustomFieldLoc[$ruleEntry->rules->ruleName]]['data']))?trim(strtolower($subscriberInfoEntry['CustomFields'][$preloadCustomFieldLoc[$ruleEntry->rules->ruleName]]['data'])):'';\n if ($ruleEntry->rules->ruleType == 'date') {\n $tempActualValues = split('/', $tempActualValues);\n $tempActualValues = strtotime(implode('-', array_reverse($tempActualValues)));\n $tempRuleValues = split('/', $tempRuleValues);\n $tempRuleValues = strtotime(implode('-', array_reverse($tempRuleValues)));\n }\n\n\n }\n switch ($ruleEntry->rules->ruleType) {\n case 'text':\n case 'textarea':\n case 'dropdown':\n case 'number':\n case 'radiobutton':\n case 'date':\n switch ($ruleEntry->rules->ruleOperator) {\n case 'equalto':\n if (!($tempActualValues == $tempRuleValues)) {\n $rulesPassed = false;\n }\n break;\n case 'notequalto':\n if ($tempActualValues == $tempRuleValues) {\n $rulesPassed = false;\n }\n break;\n case 'like':\n if (!(strstr($tempActualValues, $tempRuleValues))) {\n $rulesPassed = false;\n }\n break;\n case 'notlike':\n if (strstr($tempActualValues, $tempRuleValues)) {\n $rulesPassed = false;\n }\n break;\n case 'greaterthan':\n if ($tempActualValues <= $tempRuleValues) {\n $rulesPassed = false;\n }\n break;\n case 'lessthan':\n if ($tempActualValues >= $tempRuleValues) {\n $rulesPassed = false;\n }\n break;\n default:\n $rulesPassed = false;\n }\n break;\n case 'checkbox':\n $tempActualValues = unserialize($tempActualValues);\n $tempRuleValues = explode(', ', $tempRuleValues);\n $tempRuleValues = (is_array($tempRuleValues)) ? $tempRuleValues : array() ;\n $tempActualValues = (is_array($tempActualValues)) ? $tempActualValues : array() ;\n switch ($ruleEntry->rules->ruleOperator) {\n case 'equalto':\n if (sizeof(array_intersect($tempActualValues, $tempRuleValues)) != sizeof($tempRuleValues)) {\n $rulesPassed = false;\n }\n break;\n case 'notequalto':\n if (sizeof(array_intersect($tempActualValues, $tempRuleValues)) == sizeof($tempRuleValues)) {\n $rulesPassed = false;\n }\n break;\n default:\n $rulesPassed = false;\n }\n break;\n default:\n $rulesPassed = false;\n }\n }\n }\n if ($blockEntry->isActivated()) {\n $defaultBlock = $decodedRules;\n }\n if ($rulesPassed) {\n $data->contentTobeReplaced[$subscriberInfoEntry['subscriberid']]['tagsTobeReplaced'][] = '%%[' . trim($tagEntry->getName()) . ']%%';\n $data->contentTobeReplaced[$subscriberInfoEntry['subscriberid']]['tagsContentTobeReplaced'][] = $decodedRules->Content;\n break; // only get the first matched\n }\n }\n if (!$rulesPassed) {\n $data->contentTobeReplaced[$subscriberInfoEntry['subscriberid']]['tagsTobeReplaced'][] = '%%[' . trim($tagEntry->getName()) . ']%%';\n $data->contentTobeReplaced[$subscriberInfoEntry['subscriberid']]['tagsContentTobeReplaced'][] = $defaultBlock->Content;\n }\n }\n }\n }\n }", "public function substituteMarkerArray($content, array $markContentArray, $wrap = '', $uppercase = false, $deleteUnused = false)\n {\n GeneralUtility::logDeprecatedFunction();\n return $this->templateService->substituteMarkerArray($content, $markContentArray, $wrap, $uppercase, $deleteUnused);\n }", "function replaceMailMarkers($content, $recipRow, $markers) {\n\t\t$rowFieldsArray = t3lib_div::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail']['defaultRecipFields']);\n\t\tif ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail']['addRecipFields']) {\n\t\t\t$rowFieldsArray = array_merge($rowFieldsArray, t3lib_div::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail']['addRecipFields']));\n\t\t}\n\n\t\tforeach ($rowFieldsArray as $substField) {\n\t\t\t$subst = $GLOBALS['LANG']->csConvObj->conv($recipRow[$substField], $GLOBALS['LANG']->charSet, $this->charset);\n\t\t\t$markers['###USER_' . $substField . '###'] = $subst;\n\t\t}\n\t\t\n\t\t\t// uppercase fields with uppercased values\n\t\t$uppercaseFieldsArray = array('name', 'firstname');\n\t\tforeach ($uppercaseFieldsArray as $substField) {\n\t\t\t$subst = $GLOBALS['LANG']->csConvObj->conv($recipRow[$substField], $GLOBALS['LANG']->charSet, $this->charset);\n\t\t\t$markers['###USER_' . strtoupper($substField) . '###'] = strtoupper($subst);\n\t\t}\n\n\t\t\t// Hook allows to manipulate the markers to add salutation etc.\n\t\tif (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/direct_mail']['res/scripts/class.dmailer.php']['mailMarkersHook'])) {\n\t\t\t$mailMarkersHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/direct_mail']['res/scripts/class.dmailer.php']['mailMarkersHook'];\n\t\t\tif (is_array($mailMarkersHook)) {\n\t\t\t\t$hookParameters = array(\n\t\t\t\t\t'row' => &$recipRow,\n\t\t\t\t\t'markers' => &$markers,\n\t\t\t\t);\n\t\t\t\t$hookReference = &$this;\n\t\t\t\tforeach ($mailMarkersHook as $hookFunction)\t{\n\t\t\t\t\tt3lib_div::callUserFunction($hookFunction, $hookParameters, $hookReference);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (t3lib_div::compat_version('4.2.0')) {\n\t\t\t//function exists in 4.2.x\n\t\t\treturn t3lib_parsehtml::substituteMarkerArray($content, $markers);\n\t\t} else {\n\t\t\treturn tx_directmail_static::substituteMarkerArray($content, $markers);\n\t\t}\n\t}", "private function replaceGlobalVars($content)\n\t{\n\t\t// The formatted code without dot prefix\n\t\t$pattern = '/\\{\\{([^\\.].*?)\\}\\}/';\n\t\t$callback = function($match) {\n\t\t\t$var_name = $match[1];\n\t\t\treturn isset($this->data[$var_name]) ? $this->data[$var_name] : null;\n\t\t};\n\t\treturn preg_replace_callback($pattern, $callback, $content);\n\t}", "abstract protected function placeholders(): array;", "public\n function metabolize( $content )\n {\n $args = func_get_args();\n list($continue, $this->injection_post) = $this->get_injection_post($args);\n if ( ! $continue ) {\n return $content;\n }\n if ( ! $this->injection_author_can(EnzymesCapabilities::inject) ) {\n return $content;\n }\n if ( ! $this->there_is_an_injection($content, $matches) ) {\n return $content;\n }\n $this->new_content = '';\n do {\n $before = $this->value($matches, 'before');\n $could_be_sequence = $this->value($matches, 'could_be_sequence');\n $after = $this->value($matches, 'after');\n $escaped_injection = '{' == substr($before, -1); // \"{{[ .. ]}\"\n if ( $escaped_injection ) {\n $result = '{[' . $could_be_sequence . ']}'; // do not unescape now, version 2 will do it later...\n } else {\n $result = $this->process($could_be_sequence);\n }\n $this->new_content .= $before . $result;\n } while ($this->there_is_an_injection($after, $matches));\n $result = $this->new_content . $after;\n\n return $result;\n }", "public static function interpolate( $message, $context = array(), $row = null ) {\n\t\tif ( ! is_array( $context ) ) {\n\t\t\treturn $message;\n\t\t}\n\n\t\t/**\n\t\t * Filters the context used to create the message from the message template.\n\t\t * Can be used to modify the variables sent to the message template.\n\t\t *\n\t\t * @example Example that modifies the parameters sent to the message template.\n\t\t *\n\t\t * This example will change the post type from \"post\" or \"page\" or similar to \"my own page type\".\n\t\t *\n\t\t * ```php\n\t\t * add_filter(\n\t\t * 'simple_history/logger/interpolate/context',\n\t\t * function ( $context, $message, $row ) {\n\t\t *\n\t\t * if ( empty( $row ) ) {\n\t\t * return $context;\n\t\t * }\n\t\t *\n\t\t * if ( $row->logger == 'SimplePostLogger' && $row->context_message_key == 'post_updated' ) {\n\t\t * $context['post_type'] = 'my own page type';\n\t\t * }\n\t\t *\n\t\t * return $context;\n\t\t * },\n\t\t * 10,\n\t\t * 3\n\t\t * );\n\t\t * ```\n\t\t *\n\t\t * @since 2.2.4\n\t\t *\n\t\t * @param array $context\n\t\t * @param string $message\n\t\t * @param object $row The row. Not supported by all loggers.\n\t\t */\n\t\t$context = apply_filters(\n\t\t\t'simple_history/logger/interpolate/context',\n\t\t\t$context,\n\t\t\t$message,\n\t\t\t$row\n\t\t);\n\n\t\t// Build a replacement array with braces around the context keys\n\t\t$replace = array();\n\t\tforeach ( $context as $key => $val ) {\n\t\t\t// key ok\n\n\t\t\tif ( ! is_string( $val ) && ! is_numeric( $val ) ) {\n\t\t\t\t// not a value we can replace\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$replace[ '{' . $key . '}' ] = $val;\n\t\t}\n\n\t\t// Interpolate replacement values into the message and return\n\t\treturn strtr( $message, $replace );\n\t}", "public function replacePlaceholders($translation, $placeholders = null)\n {\n if (is_array($placeholders) && count($placeholders)) {\n try {\n // TODO (?) : keep an internal cache of the MessageFormatter objects (key = locale.translation)\n $fmt = new MessageFormatter($this->locale, $translation);\n } catch (IntlException $e) {\n $fmt = null;\n } finally {\n // for php 7.x the original exception message is \"Constructor failed\"\n // for php 5.6 the constructor returns null, see this wont fix bug https://bugs.php.net/bug.php?id=58631\n // make it a bit more understandable\n if (is_null($fmt)) {\n throw new Exception(\n \"Unable to instantiate a MessageFormatter. Check locale and string syntax.\",\n 0,\n isset($e) ? $e : null\n );\n }\n }\n \n $translation = $fmt->format($placeholders);\n if ($translation === false) {\n throw new Exception($fmt->getErrorMessage(), $fmt->getErrorCode());\n }\n }\n return $translation;\n }", "protected function replaceWithCallback($pattern, $content, $replacement) {\n $matched = '';\n $replaced = '';\n\n /*\n * Instead of just passing the $replacement callback, we'll wrap another\n * callback around it to also allow us to catch the match & replacement\n * value.\n */\n $callback = function($match) use ($replacement, &$replaced, &$matched) {\n $matched = $match;\n $replaced = call_user_func($replacement, $match);\n return $replaced;\n };\n $content = preg_replace_callback($pattern, $callback, $content, 1, $count);\n\n return array($content, $replaced, $matched);\n }", "function formatSubstitutions($container) {\n\t\t//\t\tdebug($container);\n\t\t$Substitute = array();\n\t\tforeach ($container['contents'] as $groupId => $group ) {\n\t\t\t$AuditionREF = array();\n\t\t\tforeach ($group['Auditions'] as $idref) {\n\t\t\t\t$AuditionREF[] = array('idref'=> \"snappi-audition-\".$idref);\n\t\t\t}\n\t\t\t$Label = $group['Label'];\n\t\t\t$Type = $group['Type'];\n\t\t\t$id = \"snappi-{$Type}-{$groupId}\";\n\t\t\t$Substitute[] = compact('id', 'Label', 'AuditionREF');\n\t\t}\n\t\t//\t\treturn compact('Substitute');\n\t\treturn array('Substitution'=>$Substitute);\n\t}", "public function placeholders( $settings ) {\n\t\t// Replace if string\n\t\tif ( \\is_string( $settings ) ) {\n\t\t\treturn \n\t\t\t\\strtr( $settings, static::$replacements );\n\t\t\n\t\t// Keep going if an array\n\t\t} elseif ( \\is_array( $settings ) ) {\n\t\t\tforeach ( $settings as $k => $v ) {\n\t\t\t\t$settings[$k] = \n\t\t\t\t\t$this->placeholders( $v );\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Everything else as-is\n\t\treturn $settings;\n\t}", "private static function replaceParameters(string &$text, array $parameters) : string\n {\n foreach ($parameters as $parameter) {\n $text = preg_replace(\"/%s/\", $parameter, $text, 1);\n }\n\n return $text;\n }", "public function t($message,$replacements=array()) {\n if(!isset($LANG)) {\n if(file_exists($this->langdir.'/'.$this->lang.'.php')) {\n require $this->langdir.'/'.$this->lang.'.php';\n }\n }\n if(isset($LANG[$message])) {\n return str_ireplace(\n array_keys($replacements),\n array_values($replacements),\n $LANG[$message]\n );\n }\n return str_ireplace(\n array_keys($replacements),\n array_values($replacements),\n $message\n );\n }", "public function replaceLabels() {\n $keys = array_keys($this->labels());\n $values = array_values($this->labels());\n\n foreach ($this->errors as $k => $error) {\n $this->errors[$k] = str_ireplace($keys, $values, $error);\n }\n }", "private function formatContent($content){\n $hashtags = $this->extractHashTags($content);\n $direction = \"/org/afpa/CAKEPHP/Twiffer/tweets/index/\";\n foreach($hashtags[0] as $key => $hashtag){\n $replace = '<a href=\"'.$direction.$hashtags[1][$key].'\">'.$hashtag.'</a>';\n $content = str_replace($hashtag, $replace, $content);\n }\n return $content;\n }", "public function substitute( array $substitute );", "public function replaceValues($matches) {\n\n $values = [];\n $original = $matches[0];\n $fid = $matches[1];\n $width = $matches[2]; // Options: 'full', 'half', 'medium', 'original'\n $border = $matches[3]; // Options: 'true', 'false'\n $position = !empty($matches[5]) ? $matches[5] : ''; // Options: 'right', 'left',\n $treatment = !empty($matches[7]) ? $matches[7] : ''; // Options: 'none', 'contained'\n\n if (!empty($width) && ($width == 'full' || $width == 'original' || $width == 'medium')) {\n $style = 'wide';\n }\n else { // 'half'\n $style = 'narrow';\n }\n\n $media_helper = \\Drupal::service('lullabot_migrate_media.media');\n\n $file_attributes = $this->metadata;\n // Find or create the matching media entity.\n if ($media_entity = $media_helper->createMedia($fid, $file_attributes, 'D7')) {\n $values = [\n 'style' => $style,\n 'data_caption' => $media_entity->field_file_image_caption_text->value,\n ];\n if (!empty($position) && ($position == 'right' || $position == 'left')) {\n $values['data_align'] = $position;\n }\n }\n\n // $attributes will be empty if no matching media entity was found.\n if (!empty($media_entity) && !empty($values)) {\n return $media_helper->createMediaEmbedText($media_entity, $values);\n }\n else {\n return $original;\n }\n }", "public static function emailContentConstruct($mail_subject,$mail_message,$mail_params,$data)\n {\n \t\n\t\t$mail_params_explode = explode(\",\",$mail_params);\n\t\t\t\n\t\tif(!empty($data))\n\t\t{\n\t\t\tif(!empty($mail_params_explode))\n\t\t\t{\n\t\t\t\tforeach ($mail_params_explode as $key => $value) \n\t\t\t\t{\n\t\t\t\t\t$mail_message = str_replace($mail_params_explode[$key],$data[$key], $mail_message); \n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tforeach ($data as $key => $value) \n\t\t\t\t{\n\t\t\t\t\t$mail_message = str_replace(\"##\".$key.\"##\",$data[$key], $mail_message); \t\t\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\n\t $data['mail_subject'] = $mail_subject;\n\t\t$data['mail_message'] = $mail_message;\n\t\treturn $data;\n\t}", "public function quoteInto($text, $data){ $count = substr_count($text, '?');\n if (! $count) {\n // no replacements needed\n return $text;\n }\n \n // only one replacement?\n if ($count == 1) {\n $data = $this->quote($data);\n $text = str_replace('?', $data, $text);\n return $text;\n }\n \n // more than one replacement; force values to be an array, then make \n // sure we have enough values to replace all the placeholders.\n settype($data, 'array');\n if (count($data) < $count) {\n // more placeholders than values\n throw $this->_exception('ERR_NOT_ENOUGH_VALUES', array(\n 'text' => $text,\n 'data' => $data,\n ));\n }\n \n // replace each placeholder with a quoted value\n $offset = 0;\n foreach ($data as $val) {\n // find the next placeholder\n $pos = strpos($text, '?', $offset);\n if ($pos === false) {\n // no more placeholders, exit the data loop\n break;\n }\n \n // replace this question mark with a quoted value\n $val = $this->quote($val);\n $text = substr_replace($text, $val, $pos, 1);\n \n // update the offset to move us past the quoted value\n $offset = $pos + strlen($val);\n }\n \n return $text;\n }", "private function handleCustomStringColumns(string $contentName, array $content)\n {\n //\n // Copy balloon dialogue to a name field, just for simplicity\n //\n if ($contentName == 'Balloon') {\n foreach (Language::LANGUAGES as $lang) {\n $content[\"Name_{$lang}\"] = $content[\"Dialogue_{$lang}\"] ?? '';\n }\n }\n\n //\n // Build NameCombined fields\n //\n foreach (Language::LANGUAGES as $lang) {\n $content[\"NameCombined_{$lang}\"] = $content[\"Name_{$lang}\"] ?? '';\n\n // append on female names\n if ($contentName == 'Title') {\n $content[\"NameCombined_{$lang}\"] .= \" \" . ($content[\"NameFemale_{$lang}\"] ?? '');\n }\n\n $content[\"NameCombined_{$lang}\"] = trim($content[\"NameCombined_{$lang}\"]);\n }\n\n //\n // Build NameLocale fields\n //\n $content['NameLocale'] = '';\n foreach (Language::LANGUAGES as $lang) {\n $content['NameLocale'] .= ' ' . ($content[\"NameCombined_{$lang}\"] ?? '');\n }\n\n $content['NameLocale'] = trim($content['NameLocale']);\n\n return $content;\n }", "private static function replaceCustom(string $content)\n {\n foreach (self::$templates as $template) {\n $content = $template($content);\n }\n\n return $content;\n }", "function ReplaceContent( $data, $template_html )\n{\n $returnval = \"\";\n foreach ($data as $row) {\n //replace fields with values in template\n $content = $template_html;\n\n //custom klasse voor de top van de profile die zorgt dat settingsfunctie enkel op het eigen profiel zichtbaar zijn\n if (IsMe()) {\n $row['settings'] = 'visible';\n }\n\n foreach ($row as $field => $value) {\n\n //dateformat\n if ($field == 'gra_uploaddate') {\n $new_date = new DateTime($value);\n $value = $new_date->format('F d, Y');\n }\n\n $content = str_replace(\"@@$field@@\", $value, $content);\n }\n $returnval .= $content;\n }\n return $returnval;\n}", "public function replaceValues($contents)\n {\n return str_replace(\n array_keys($this->values),\n array_values($this->values),\n $contents\n );\n }", "protected static function handle_vars($content) {\n\t\treturn preg_replace('/{\\- VAR ([a-z_]+)\\: (.*?) \\-}/', '<?php \\$$1 = $2; ?>', $content);\n\t}", "function _notifications_content_test_format_template($parts) {\n $rows = array();\n $header = array('msgkey' => t('Key'), 'type' => t('Template'), 'method' => t('Method'), 'message' => t('Text'), 'language' => t('Language'), 'format' => t('Format'));\n foreach ($parts as $key => $value) {\n $row = array();\n foreach (array_keys($header) as $field) {\n $row[] = isset($value->$field) ? check_plain($value->$field) : '';\n }\n $rows[] = $row;\n }\n return theme('table', array('header' => $header, 'rows' =>$rows));\n}", "public static function getReplaces($contents)\n { \n $return = [];\n foreach ($contents as $value) {\n $return[$value->id] = $value->content;\n }\n return $return;\n }", "public function arraySubstituteBr(&$content, $needle, $replace) {\t\n\t\ttry {\n\t\t\tforeach ($content as &$haystack) {\n\t\t\t\tif (!is_array($haystack)) { // If it's not an array, sanitize it\n\t\t\t\t\t$haystack = str_replace($needle, $replace, $haystack);\n\t\t\t\t} else { // it IS an array, so recurse\n\t\t\t\t\tself::arraySubstituteBr($haystack, $needle, $replace);\n\t\t\t\t} //<-- end if -->\n\t\t\t} //<-- end foreach -->\t\n\t\t} catch (Exception $e) { \n\t\t\tthrow new Exception($e->getMessage().' from '.$this->className.'->'.\n\t\t\t\t__FUNCTION__.'() line '.__LINE__\n\t\t\t);\n\t\t} //<-- end try -->\n\t}", "protected function recursivelyReplaceIntPlaceholdersInContent() {}", "private function generateMessage($message, array $context): String\n {\n foreach ($context as $key => $value) {\n if (stripos($message, $key) !== false) {\n $message = str_replace(\"{\" . $key . \"}\", $value, $message);\n }\n }\n return $message;\n }", "function fetchTemplate(string $content, string $user, string $usr_email, string $template): string{\n $chnd = fopen($template, \"r\");\n $rawContent = fread($chnd, filesize($template));\n fclose($chnd);\n $replacer = [\n \"%content%\" => $content,\n \"%user%\" => $user,\n \"%email%\" => $usr_email,\n \"%tms%\" => date(\"Y-M-d H:m:i\")\n ];\n foreach($replacer as $needle => $val)\n $rawContent = str_replace($needle, $val, $rawContent);\n return $rawContent;\n}", "protected function replaceParameters(string $stub, array $parameters): string\n\t{\n\t\treturn str_replace(\n\t\t\t['DummyParameters', 'DummyParameter', '{{ parameters }}', '{{ parameter }}', '{{parameters}}', '{{parameter}}'],\n\t\t\timplode(', ', $parameters),\n\t\t\t$stub\n\t\t);\n\t}", "protected function replacePlaceholdersFromStack($placeholderStack = array())\r\n {\r\n $stringReplaced = null;\r\n if (!empty($placeholderStack)) {\r\n\r\n foreach ($placeholderStack as $placeholder) {\r\n $placeholderObject = null;\r\n $placeholderClassPrefixes = self::getPlaceholderClassPrefixes();\r\n\r\n $placeholderObject = null;\r\n\r\n foreach($placeholderClassPrefixes as $classPrefix){\r\n $className = $classPrefix . $placeholder['placeholderClass'];\r\n if(Tool::classExists($className)){\r\n $placeholderObject = new $className();\r\n break;\r\n }\r\n }\r\n\r\n if (is_null($stringReplaced)) {\r\n $stringReplaced = $placeholder['contentString'];\r\n }\r\n\r\n if ($placeholderObject instanceof Placeholder\\AbstractPlaceholder) {\r\n\r\n //setting values from placeholder stack to placeholder objects\r\n foreach (array_keys($placeholder) as $key) {\r\n if ($key == 'placeholderClass') {\r\n continue;\r\n }\r\n $placeholderObject->{'set' . ucfirst($key)}($placeholder[$key]);\r\n }\r\n $placeholderObject->setLocale();\r\n\r\n $replaceWith = $placeholderObject->getReplacement();\r\n if (!isset($replaceWith)) {\r\n $replaceWith = $placeholderObject->getEmptyValue();\r\n }\r\n $stringReplaced = str_replace($placeholderObject->getPlaceholderString(), $replaceWith, $stringReplaced);\r\n } else {\r\n \\Logger::warn('Ignoring Placeholder \"' . $placeholder['placeholderClass'] . '\" -> Class not Found or not an instance of Pimcore_Placeholder_Abstract!');\r\n }\r\n }\r\n }\r\n return $stringReplaced;\r\n }", "public function handler_the_content( $content )\n\t\t{\n\t\t\t/**\n\t\t\t * Add additional special characters to translate\n\t\t\t *\n\t\t\t * @since 1.0.0\n\t\t\t * @param array $this->translate\n\t\t\t * @return array\n\t\t\t */\n\t\t\t$this->translate = apply_filters( 'avia_special_characters_translations', $this->translate );\n\n\t\t\t$search = array_keys( $this->translate );\n\t\t\t$replace = array_values( $this->translate );\n\n\t\t\t$new_content = str_replace( $search, $replace, $content );\n\n\t\t\treturn $new_content;\n\t\t}", "public function placeholderArgs() {\r\n $url = Url::fromUri('internal:/examples/menu-example/placeholder-argument/3343/display');\r\n $link = Link::fromTextAndUrl($this->t('examples/menu-example/placeholder-argument/3343/display'), $url)->toString();\r\n return [\r\n '#markup' => $this->t('Demonstrate placeholders by visiting @link', ['@link' => $link]),\r\n ];\r\n }", "protected function replaceWithString($pattern, $content, $replacement) {\n /*\n * This preg_match is really only meant to capture $match, which we can\n * then also use to deduce the replacement value. We can't just assume\n * $replacement as replacement value, because it may be a back-reference\n * (e.g. \\\\1)\n */\n if(!preg_match($pattern, $content, $match)) {\n return array($content, '', '');\n }\n\n $untouched = strlen($content) - strlen($match[0]);\n $content = preg_replace($pattern, $replacement, $content, 1, $count);\n $replaced = (string) substr($content, 0, strlen($content) - $untouched);\n\n return array($content, $replaced, $match[0]);\n }", "protected function replacePlaceholders($strQuery, $arPlaceholders)\n {\n $arVariablePositions = array();\n $this->arTmpVariablePositions = array();\n $this->arTmpPlaceholders = $arPlaceholders;\n $strQuery = preg_replace_callback(\n '/@\\\\$%_PLACEHOLDER_[0-9]+_%\\\\$@/',\n array($this, 'replacePlaceholdersCb'),\n $strQuery\n );\n return array($strQuery, $this->arTmpVariablePositions);\n }", "public function prepareUserMessage(String $value);" ]
[ "0.68687326", "0.67710483", "0.6470346", "0.6353506", "0.63520706", "0.6323045", "0.6194089", "0.618991", "0.6100591", "0.60618514", "0.59654427", "0.59377706", "0.5934986", "0.5905428", "0.58528835", "0.5832218", "0.58300316", "0.58032006", "0.579664", "0.57896924", "0.57749116", "0.57374835", "0.5690359", "0.56773055", "0.5670512", "0.56427443", "0.56425273", "0.56396645", "0.56264734", "0.5598589", "0.55818313", "0.55753684", "0.55662274", "0.55302346", "0.55196786", "0.5514298", "0.5460386", "0.54370534", "0.5432689", "0.54273224", "0.54223824", "0.54035145", "0.54031205", "0.5394816", "0.5390115", "0.538398", "0.5379852", "0.5334106", "0.5325563", "0.53143454", "0.53113043", "0.5306697", "0.53045696", "0.5293563", "0.5284852", "0.527619", "0.5274003", "0.5271584", "0.5258613", "0.5255474", "0.5216335", "0.5204852", "0.5204852", "0.5199184", "0.5194907", "0.51853716", "0.51837575", "0.5181842", "0.5176206", "0.51759255", "0.51742405", "0.5167366", "0.51636666", "0.5152627", "0.5147643", "0.5145312", "0.51446843", "0.51384705", "0.5135455", "0.512604", "0.51242137", "0.51219034", "0.5119272", "0.51175517", "0.5106591", "0.51058483", "0.51042914", "0.5102116", "0.509902", "0.5074708", "0.50712967", "0.50530577", "0.5043546", "0.5038708", "0.50372666", "0.503476", "0.5029836", "0.5028733", "0.50093424", "0.50009394" ]
0.75160474
0
Run the database seeds.
public function run() { foreach ($this->getAgencies() as $orgao) { Agency::firstOrCreate($orgao); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function run()\n {\n // $this->call(UserTableSeeder::class);\n // $this->call(PostTableSeeder::class);\n // $this->call(TagTableSeeder::class);\n // $this->call(PostTagTableSeeder::class);\n\n /*AB - use faker to populate table see file ModelFactory.php */\n factory(App\\Editeur::class, 40) ->create();\n factory(App\\Auteur::class, 40) ->create();\n factory(App\\Livre::class, 80) ->create();\n\n for ($i = 1; $i < 41; $i++) {\n $number = rand(2, 8);\n for ($j = 1; $j <= $number; $j++) {\n DB::table('auteur_livre')->insert([\n 'livre_id' => rand(1, 40),\n 'auteur_id' => $i\n ]);\n }\n }\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n // Let's truncate our existing records to start from scratch.\n Assignation::truncate();\n\n $faker = \\Faker\\Factory::create();\n \n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 40; $i++) {\n Assignation::create([\n 'ad_id' => $faker->numberBetween(1,20),\n 'buyer_id' => $faker->numberBetween(1,6),\n 'seller_id' => $faker->numberBetween(6,11),\n 'state' => NULL,\n ]);\n }\n\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n \t$faker = Faker::create();\n\n \tfor($i=0; $i<20; $i++) {\n \t\t$post = new Post;\n \t\t$post->title = $faker->sentence();\n \t\t$post->body = $faker->paragraph();\n \t\t$post->category_id = rand(1, 5);\n \t\t$post->save();\n \t}\n\n \t$list = ['General', 'Technology', 'News', 'Internet', 'Mobile'];\n \tforeach($list as $name) {\n \t\t$category = new Category;\n \t\t$category->name = $name;\n \t\t$category->save();\n \t}\n\n \tfor($i=0; $i<20; $i++) {\n \t\t$comment = new Comment;\n \t\t$comment->comment = $faker->paragraph();\n \t\t$comment->post_id = rand(1,20);\n \t\t$comment->save();\n \t}\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n $this->call(RoleTableSeeder::class);\n $this->call(UserTableSeeder::class);\n \n factory('App\\Cat', 5)->create();\n $tags = factory('App\\Tag', 8)->create();\n\n factory(Post::class, 15)->create()->each(function($post) use ($tags){\n $post->comments()->save(factory(Comment::class)->make());\n $post->tags()->attach( $tags->random(mt_rand(1,4))->pluck('id')->toArray() );\n });\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::table('post')->insert(\n [\n 'title' => 'Test Post1',\n 'desc' => str_random(100).\" post1\",\n 'alias' => 'test1',\n 'keywords' => 'test1',\n ]\n );\n DB::table('post')->insert(\n [\n 'title' => 'Test Post2',\n 'desc' => str_random(100).\" post2\",\n 'alias' => 'test2',\n 'keywords' => 'test2',\n ]\n );\n DB::table('post')->insert(\n [\n 'title' => 'Test Post3',\n 'desc' => str_random(100).\" post3\",\n 'alias' => 'test3',\n 'keywords' => 'test3',\n ]\n );\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n \t$faker = Factory::create();\n \t\n \tforeach ($this->departments as $key => $department) {\n \t\tDepartment::create([\n \t\t\t'name' => $department\n \t\t]);\n \t}\n \tforeach ($this->collections as $key => $collection) {\n \t\tCollection::create([\n \t\t\t'name' => $collection\n \t\t]);\n \t}\n \t\n \t\n \tfor ($i=0; $i < 40; $i++) {\n \t\tUser::create([\n \t\t\t'name' \t=>\t$faker->name,\n \t\t\t'email' \t=>\t$faker->email,\n \t\t\t'password' \t=>\tbcrypt('123456'),\n \t\t]);\n \t} \n \t\n \t\n \tforeach ($this->departments as $key => $department) {\n \t\t//echo ($key + 1) . PHP_EOL;\n \t\t\n \t\tfor ($i=0; $i < 10; $i++) { \n \t\t\techo $faker->name . PHP_EOL;\n\n \t\t\tArt::create([\n \t\t\t\t'name'\t\t\t=> $faker->sentence(2),\n \t\t\t\t'img'\t\t\t=> $this->filenames[$i],\n \t\t\t\t'medium'\t\t=> 'canvas',\n \t\t\t\t'department_id'\t=> $key + 1,\n \t\t\t\t'user_id'\t\t=> $this->userIndex,\n \t\t\t\t'dimension'\t\t=> '18.0 x 24.0',\n\t\t\t\t]);\n \t\t\t\t\n \t\t\t\t$this->userIndex ++;\n \t\t}\n \t}\n \t\n \tdd(\"END\");\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // $this->dataCategory();\n factory(App\\Model\\Category::class, 70)->create();\n factory(App\\Model\\Producer::class, rand(5,10))->create();\n factory(App\\Model\\Provider::class, rand(5,10))->create();\n factory(App\\Model\\Product::class, 100)->create();\n factory(App\\Model\\Album::class, 300)->create();\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n\n factory('App\\User', 10 )->create();\n\n $users= \\App\\User::all();\n $users->each(function($user){ factory('App\\Category', 1)->create(['user_id'=>$user->id]); });\n $users->each(function($user){ factory('App\\Tag', 3)->create(['user_id'=>$user->id]); });\n\n\n $users->each(function($user){\n factory('App\\Post', 10)->create([\n 'user_id'=>$user->id,\n 'category_id'=>rand(1,20)\n ]\n );\n });\n\n $posts= \\App\\Post::all();\n $posts->each(function ($post){\n\n $post->tags()->attach(array_unique([rand(1,20),rand(1,20),rand(1,20)]));\n });\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $types = factory(\\App\\Models\\Type::class, 5)->create();\n\n $cities = factory(\\App\\Models\\City::class, 10)->create();\n\n $cities->each(function ($city) {\n $districts = factory(\\App\\Models\\District::class, rand(2, 5))->create([\n 'city_id' => $city->id,\n ]);\n\n $districts->each(function ($district) {\n $properties = factory(\\App\\Models\\Property::class, rand(2, 5))->create([\n 'type_id' => rand(1, 5),\n 'district_id' => $district->id\n ]);\n\n $properties->each(function ($property) {\n $galleries = factory(\\App\\Models\\Gallery::class, rand(3, 10))->create([\n 'property_id' => $property->id\n ]);\n });\n });\n });\n }", "public function run()\n {\n $this->call(UsersTableSeeder::class);\n\n $categories = factory(App\\Models\\Category::class, 10)->create();\n\n $categories->each(function ($category) {\n $category\n ->posts()\n ->saveMany(\n factory(App\\Models\\Post::class, 3)->make()\n );\n });\n }", "public function run()\n {\n $this->call(CategoriesTableSeeder::class);\n\n $users = factory(App\\User::class, 5)->create();\n $recipes = factory(App\\Recipe::class, 30)->create();\n $preparations = factory(App\\Preparation::class, 70)->create();\n $photos = factory(App\\Photo::class, 90)->create();\n $comments = factory(App\\Comment::class, 200)->create();\n $flavours = factory(App\\Flavour::class, 25)->create();\n $flavour_recipe = factory(App\\FlavourRecipe::class, 50)->create();\n $tags = factory(App\\Tag::class, 25)->create();\n $recipe_tag = factory(App\\RecipeTag::class, 50)->create();\n $ingredients = factory(App\\Ingredient::class, 25)->create();\n $ingredient_preparation = factory(App\\IngredientPreparation::class, 300)->create();\n \n \n \n DB::table('users')->insert(['name' => 'SimpleUtilisateur', 'email' => '[email protected]', 'password' => bcrypt('SimpleMotDePasse')]);\n \n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n // Sample::truncate();\n // TestItem::truncate();\n // UOM::truncate();\n Role::truncate();\n User::truncate();\n\n // factory(Role::class, 4)->create();\n Role::create([\n 'name'=> 'Director',\n 'description'=> 'Director type'\n ]);\n\n Role::create([\n 'name'=> 'Admin',\n 'description'=> 'Admin type'\n ]);\n Role::create([\n 'name'=> 'Employee',\n 'description'=> 'Employee type'\n ]);\n Role::create([\n 'name'=> 'Technician',\n 'description'=> 'Technician type'\n ]);\n \n factory(User::class, 20)->create()->each(\n function ($user){\n $roles = \\App\\Role::all()->random(mt_rand(1, 2))->pluck('id');\n $user->roles()->attach($roles);\n }\n );\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n UsersLevel::create([\n 'name' => 'Administrator'\n ]);\n\n UsersLevel::create([\n 'name' => 'User'\n ]);\n\n User::create([\n 'username' => 'admin',\n 'password' => bcrypt('admin123'),\n 'level_id' => 1,\n 'fullname' => \"Super Admin\",\n 'email'=> \"[email protected]\"\n ]);\n\n\n \\App\\CategoryPosts::create([\n 'name' =>'Paket Trip'\n ]);\n\n \\App\\CategoryPosts::create([\n 'name' =>'Destinasi Kuliner'\n ]);\n\n \\App\\CategoryPosts::create([\n 'name' => 'Event'\n ]);\n\n \\App\\CategoryPosts::create([\n 'name' => 'Profil'\n ]);\n }", "public function run()\n {\n DB::table('users')->insert([\n 'name' => 'Admin',\n 'email' => '[email protected]',\n 'avatar' => \"avatar\",\n 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',\n ]);\n $this->call(CategorySeeder::class);\n // \\App\\Models\\Admin::factory(1)->create();\n \\App\\Models\\User::factory(10)->create();\n // \\App\\Models\\Category::factory(50)->create();\n \\App\\Models\\PetComment::factory(50)->create();\n $pets = \\App\\Models\\Pet::factory(50)->create();\n foreach ($pets as $pet) {\n \\App\\Models\\PetTag::factory(1)->create(['pet_id' => $pet->id]);\n \\App\\Models\\PetPhotoUrl::factory(1)->create(['pet_id' => $pet->id]);\n \\App\\Models\\Order::factory(1)->create(['pet_id' => $pet->id]);\n };\n }", "public function run()\n { \n\n $this->call(RoleSeeder::class);\n \n $this->call(UserSeeder::class);\n\n Storage::deleteDirectory('socials-icon');\n Storage::makeDirectory('socials-icon');\n $socials = Social::factory(7)->create();\n\n Storage::deleteDirectory('countries-flag');\n Storage::deleteDirectory('countries-firm');\n Storage::makeDirectory('countries-flag');\n Storage::makeDirectory('countries-firm');\n $countries = Country::factory(18)->create();\n\n // Se llenan datos de la tabla muchos a muchos - social_country\n foreach ($countries as $country) {\n foreach ($socials as $social) {\n\n $country->socials()->attach($social->id, [\n 'link' => 'https://www.facebook.com/ministeriopalabrayespiritu/'\n ]);\n }\n }\n\n Person::factory(50)->create();\n\n Category::factory(7)->create();\n\n Video::factory(25)->create(); \n\n $this->call(PostSeeder::class);\n\n Storage::deleteDirectory('documents');\n Storage::makeDirectory('documents');\n Document::factory(25)->create();\n\n }", "public function run()\n {\n $faker = Faker::create('id_ID');\n /**\n * Generate fake author data\n */\n for ($i=1; $i<=50; $i++) { \n DB::table('author')->insert([\n 'name' => $faker->name\n ]);\n }\n /**\n * Generate fake publisher data\n */\n for ($i=1; $i<=50; $i++) { \n DB::table('publisher')->insert([\n 'name' => $faker->name\n ]);\n }\n /**\n * Seeding payment method\n */\n DB::table('payment')->insert([\n ['name' => 'Mandiri'],\n ['name' => 'BCA'],\n ['name' => 'BRI'],\n ['name' => 'BNI'],\n ['name' => 'Pos Indonesia'],\n ['name' => 'BTN'],\n ['name' => 'Indomaret'],\n ['name' => 'Alfamart'],\n ['name' => 'OVO'],\n ['name' => 'Cash On Delivery']\n ]);\n }", "public function run()\n {\n DatabaseSeeder::seedLearningStylesProbs();\n DatabaseSeeder::seedCampusProbs();\n DatabaseSeeder::seedGenderProbs();\n DatabaseSeeder::seedTypeStudentProbs();\n DatabaseSeeder::seedTypeProfessorProbs();\n DatabaseSeeder::seedNetworkProbs();\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n // MyList::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 3; $i++) {\n MyList::create([\n 'title' => 'List-'.($i+1),\n 'color' => $faker->sentence,\n 'icon' => $faker->randomDigitNotNull,\n 'index' => $faker->randomDigitNotNull,\n 'user_id' => 1,\n ]);\n }\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n Products::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few products in our database:\n for ($i = 0; $i < 50; $i++) {\n Products::create([\n 'name' => $faker->word,\n 'sku' => $faker->randomNumber(7, false),\n ]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n User::create([\n 'name' => 'Pablo Rosales',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'status' => 1,\n 'role_id' => 1,\n 'movil' => 0\n ]);\n\n User::create([\n 'name' => 'Usuario Movil',\n 'email' => '[email protected]',\n 'password' => bcrypt('secret'),\n 'status' => 1,\n 'role_id' => 3,\n 'movil' => 1\n ]);\n\n Roles::create([\n 'name' => 'Administrador'\n ]);\n Roles::create([\n 'name' => 'Operaciones'\n ]);\n Roles::create([\n 'name' => 'Comercial'\n ]);\n Roles::create([\n 'name' => 'Aseguramiento'\n ]);\n Roles::create([\n 'name' => 'Facturación'\n ]);\n Roles::create([\n 'name' => 'Creditos y Cobros'\n ]);\n\n factory(App\\Customers::class, 100)->create();\n }", "public function run()\n {\n // php artisan db:seed --class=StoreTableSeeder\n\n foreach(range(1,20) as $i){\n $faker = Faker::create();\n Store::create([\n 'name' => $faker->name,\n 'desc' => $faker->text,\n 'tags' => $faker->word,\n 'address' => $faker->address,\n 'longitude' => $faker->longitude($min = -180, $max = 180),\n 'latitude' => $faker->latitude($min = -90, $max = 90),\n 'created_by' => '1'\n ]);\n }\n\n }", "public function run()\n {\n DB::table('users')->insert([\n 'name'=>\"test\",\n 'password' => Hash::make('123'),\n 'email'=>'[email protected]'\n ]);\n DB::table('tags')->insert(['name'=>'tags']);\n $this->call(UserSeed::class);\n $this->call(CategoriesSeed::class);\n $this->call(TopicsSeed::class);\n $this->call(CommentariesSeed::class);\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n echo 'seeding permission...', PHP_EOL;\n $permissions = [\n 'role-list',\n 'role-create',\n 'role-edit',\n 'role-delete',\n 'formation-list',\n 'formation-create',\n 'formation-edit',\n 'formation-delete',\n 'user-list',\n 'user-create',\n 'user-edit',\n 'user-delete'\n ];\n foreach ($permissions as $permission) {\n Permission::create(['name' => $permission]);\n }\n echo 'seeding users...', PHP_EOL;\n\n $user= User::create(\n [\n 'name' => 'Mr. admin',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'remember_token' => null,\n ]\n );\n echo 'Create Roles...', PHP_EOL;\n Role::create(['name' => 'former']);\n Role::create(['name' => 'learner']);\n Role::create(['name' => 'admin']);\n Role::create(['name' => 'manager']);\n Role::create(['name' => 'user']);\n\n echo 'seeding Role User...', PHP_EOL;\n $user->assignRole('admin');\n $role = $user->assignRole('admin');\n $role->givepermissionTo(Permission::all());\n\n \\DB::table('languages')->insert(['name' => 'English', 'code' => 'en']);\n \\DB::table('languages')->insert(['name' => 'Français', 'code' => 'fr']);\n }", "public function run()\n {\n $this->call(UsersTableSeeder::class);\n $this->call(PermissionsSeeder::class);\n $this->call(RolesSeeder::class);\n $this->call(ThemeSeeder::class);\n\n //\n\n DB::table('paypal_info')->insert([\n 'client_id' => '',\n 'client_secret' => '',\n 'currency' => '',\n ]);\n DB::table('contact_us')->insert([\n 'content' => '',\n ]);\n DB::table('setting')->insert([\n 'site_name' => ' ',\n ]);\n DB::table('terms_and_conditions')->insert(['terms_and_condition' => 'text']);\n }", "public function run()\n {\n $this->call([\n UserSeeder::class,\n ]);\n\n User::factory(20)->create();\n Author::factory(20)->create();\n Book::factory(60)->create();\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->call(UserSeeder::class);\n $this->call(RolePermissionSeeder::class);\n $this->call(AppmodeSeeder::class);\n\n // \\App\\Models\\Appmode::factory(3)->create();\n \\App\\Models\\Doctor::factory(100)->create();\n \\App\\Models\\Unit::factory(50)->create();\n \\App\\Models\\Broker::factory(100)->create();\n \\App\\Models\\Patient::factory(100)->create();\n \\App\\Models\\Expence::factory(100)->create();\n \\App\\Models\\Testcategory::factory(100)->create();\n \\App\\Models\\Test::factory(50)->create();\n \\App\\Models\\Parameter::factory(50)->create();\n \\App\\Models\\Sale::factory(50)->create();\n \\App\\Models\\SaleItem::factory(100)->create();\n \\App\\Models\\Goption::factory(1)->create();\n \\App\\Models\\Pararesult::factory(50)->create();\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // DB::table('roles')->insert(\n // [\n // ['name' => 'admin', 'description' => 'Administrator'],\n // ['name' => 'student', 'description' => 'Student'],\n // ['name' => 'lab_tech', 'description' => 'Lab Tech'],\n // ['name' => 'it_staff', 'description' => 'IT Staff Member'],\n // ['name' => 'it_manager', 'description' => 'IT Manager'],\n // ['name' => 'lab_manager', 'description' => 'Lab Manager'],\n // ]\n // );\n\n // DB::table('users')->insert(\n // [\n // 'username' => 'admin', \n // 'password' => Hash::make('password'), \n // 'active' => 1,\n // 'name' => 'Administrator',\n // 'email' => '[email protected]',\n // 'role_id' => \\App\\Role::where('name', 'admin')->first()->id\n // ]\n // );\n\n DB::table('status')->insert([\n // ['name' => 'Active'],\n // ['name' => 'Cancel'],\n // ['name' => 'Disable'],\n // ['name' => 'Open'],\n // ['name' => 'Closed'],\n // ['name' => 'Resolved'],\n ['name' => 'Used'],\n ]);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n factory(User::class)->create([\n 'name' => 'Qwerty',\n 'email' => '[email protected]',\n 'password' => bcrypt('secretpassw'),\n ]);\n\n factory(User::class, 59)->create([\n 'password' => bcrypt('secretpassw'),\n ]);\n\n for ($i = 1; $i < 11; $i++) {\n factory(Category::class)->create([\n 'name' => 'Category ' . $i,\n ]);\n }\n\n for ($i = 1; $i < 101; $i++) {\n factory(Product::class)->create([\n 'name' => 'Product ' . $i,\n ]);\n }\n }", "public function run()\n {\n\n \t// Making main admin role\n \tDB::table('roles')->insert([\n 'name' => 'Admin',\n ]);\n\n // Making main category\n \tDB::table('categories')->insert([\n 'name' => 'Other',\n ]);\n\n \t// Making main admin account for testing\n \tDB::table('users')->insert([\n 'name' \t\t=> 'Admin',\n 'email' \t=> '[email protected]',\n 'password' => bcrypt('12345'),\n 'role_id' => 1,\n 'created_at' => date('Y-m-d H:i:s' ,time()),\n 'updated_at' => date('Y-m-d H:i:s' ,time())\n ]);\n\n \t// Making random users and posts\n factory(App\\User::class, 10)->create();\n factory(App\\Post::class, 35)->create();\n }", "public function run()\n {\n $faker = Faker::create();\n\n \\DB::table('positions')->insert(array (\n 'codigo' => strtoupper($faker->randomLetter).$faker->postcode,\n 'nombre' => 'Chef',\n 'salario' => '15000.00'\n ));\n\n\t\t \\DB::table('positions')->insert(array (\n 'codigo' => strtoupper($faker->randomLetter).$faker->postcode,\n 'nombre' => 'Mesonero',\n 'salario' => '12000.00'\n ));\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $faker = \\Faker\\Factory::create();\n\n foreach (range(1,5) as $index) {\n Lista::create([\n 'name' => $faker->sentence(2),\n 'description' => $faker->sentence(10), \n ]);\n } \n\n foreach (range(1,20) as $index) {\n $n = $faker->sentence(2);\n \tTarea::create([\n \t\t'name' => $n,\n \t\t'description' => $faker->sentence(10),\n 'lista_id' => $faker->numberBetween(1,5),\n 'slug' => Str::slug($n),\n \t\t]);\n } \n }", "public function run()\n {\n $faker = Faker::create('lt_LT');\n\n DB::table('users')->insert([\n 'name' => 'user',\n 'email' => '[email protected]',\n 'password' => Hash::make('123')\n ]);\n DB::table('users')->insert([\n 'name' => 'user2',\n 'email' => '[email protected]',\n 'password' => Hash::make('123')\n ]);\n\n foreach (range(1,100) as $val)\n DB::table('authors')->insert([\n 'name' => $faker->firstName(),\n 'surname' => $faker->lastName(),\n \n ]);\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->call(UsersTableSeeder::class);\n\n // DB::table('users')->insert([\n // 'name' => 'User1',\n // 'email' => '[email protected]',\n // 'password' => bcrypt('password'),\n // ]);\n\n\n $faker = Faker::create();\n \n foreach (range(1,10) as $index){\n DB::table('companies')->insert([\n 'name' => $faker->company(),\n 'email' => $faker->email(10).'@gmail.com',\n 'logo' => $faker->image($dir = '/tmp', $width = 640, $height = 480),\n 'webiste' => $faker->domainName(),\n \n ]);\n }\n \n \n foreach (range(1,10) as $index){\n DB::table('employees')->insert([\n 'first_name' => $faker->firstName(),\n 'last_name' => $faker->lastName(),\n 'company' => $faker->company(),\n 'email' => $faker->str_random(10).'@gmail.com',\n 'phone' => $faker->e164PhoneNumber(),\n \n ]);\n }\n\n\n\n }", "public function run()\n {\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n Flight::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 100; $i++) {\n\n\n Flight::create([\n 'flightNumber' => $faker->randomNumber(5),\n 'depAirport' => $faker->city,\n 'destAirport' => $faker->city,\n 'reservedWeight' => $faker->numberBetween(1000 - 10000),\n 'deptTime' => $faker->dateTime('now'),\n 'arrivalTime' => $faker->dateTime('now'),\n 'reservedVolume' => $faker->numberBetween(1000 - 10000),\n 'airlineName' => $faker->colorName,\n ]);\n }\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->truncteTables([\n 'users',\n 'products'\n ]);\n\n $this->call(UsersSeeder::class);\n $this->call(ProductsSeeder::class);\n\n }", "public function run()\n {\n /**\n * Dummy seeds\n */\n DB::table('metas')->truncate();\n $faker = Faker::create();\n\n for ($i=0; $i < 10; $i++) { \n DB::table('metas')->insert([\n 'id_rel' => $faker->randomNumber(),\n 'titulo' => $faker->sentence,\n 'descricao' => $faker->paragraph,\n 'justificativa' => $faker->paragraph,\n 'valor_inicial' => $faker->numberBetween(0,100),\n 'valor_atual' => $faker->numberBetween(0,100),\n 'valor_final' => $faker->numberBetween(0,10),\n 'regras' => json_encode([$i => [\"values\" => $faker->words(3)]]),\n 'types' => json_encode([$i => [\"values\" => $faker->words(2)]]),\n 'categorias' => json_encode([$i => [\"values\" => $faker->words(4)]]),\n 'tags' => json_encode([$i => [\"values\" => $faker->words(5)]]),\n 'active' => true,\n ]);\n }\n\n\n }", "public function run()\n {\n // $this->call(UserTableSeeder::class);\n\n $faker = Faker::create();\n\n $lessonIds = Lesson::lists('id')->all(); // An array of ID's in that table [1, 2, 3, 4, 5, 7]\n $tagIds = Tag::lists('id')->all();\n\n foreach(range(1, 30) as $index)\n {\n // a real lesson id\n // a real tag id\n DB::table('lesson_tag')->insert([\n 'lesson_id' => $faker->randomElement($lessonIds),\n 'tag_id' => $faker->randomElement($tagIds),\n ]);\n }\n }", "public function run()\n {\n $this->call(CategoriasTableSeeder::class);\n $this->call(UfsTableSeeder::class);\n $this->call(UsersTableSeeder::class);\n $this->call(UserTiposTableSeeder::class);\n factory(App\\User::class, 2)->create();\n/* factory(App\\Models\\Categoria::class, 20)->create();*/\n/* factory(App\\Models\\Anuncio::class, 50)->create();*/\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n Language::truncate();\n Reason::truncate();\n Report::truncate();\n Category::truncate();\n Position::truncate();\n\n $languageQuantity = 10;\n $reasonQuantity = 10;\n $reportQuantity = 10;\n $categoryQuantity = 10;\n $positionQuantity = 10;\n\n factory(Language::class,$languageQuantity)->create();\n factory(Reason::class,$reasonQuantity)->create();\n \n factory(Report::class,$reportQuantity)->create();\n \n factory(Category::class,$categoryQuantity)->create();\n \n factory(Position::class,$positionQuantity)->create();\n\n }", "public function run()\n {\n // \\DB::statement('SET_FOREIGN_KEY_CHECKS=0');\n \\DB::table('users')->truncate();\n \\DB::table('posts')->truncate();\n // \\DB::table('category')->truncate();\n \\DB::table('photos')->truncate();\n \\DB::table('comments')->truncate();\n \\DB::table('comment_replies')->truncate();\n\n \\App\\Models\\User::factory()->times(10)->hasPosts(1)->create();\n \\App\\Models\\Role::factory()->times(10)->create();\n \\App\\Models\\Category::factory()->times(10)->create();\n \\App\\Models\\Comment::factory()->times(10)->hasReplies(1)->create();\n \\App\\Models\\Photo::factory()->times(10)->create();\n\n \n // \\App\\Models\\User::factory(10)->create([\n // 'role_id'=>2,\n // 'is_active'=>1\n // ]);\n\n // factory(App\\Models\\Post::class, 10)->create();\n // $this->call(UsersTableSeeder::class);\n }", "public function run()\n {\n $this->call([\n ArticleSeeder::class, \n TagSeeder::class,\n Arttagrel::class\n ]);\n // \\App\\Models\\User::factory(10)->create();\n \\App\\Models\\Article::factory()->count(7)->create();\n \\App\\Models\\Tag::factory()->count(15)->create(); \n \\App\\Models\\Arttagrel::factory()->count(15)->create(); \n }", "public function run()\n {\n $this->call(ArticulosTableSeeder::class);\n /*DB::table('articulos')->insert([\n 'titulo' => str_random(50),\n 'cuerpo' => str_random(200),\n ]);*/\n }", "public function run()\n {\n $this->call(CategoryTableSeeder::class);\n $this->call(ProductTableSeeder::class);\n\n \t\t\n\t\t\tDB::table('users')->insert([\n 'first_name' => 'Ignacio',\n 'last_name' => 'Garcia',\n 'email' => '[email protected]',\n 'password' => bcrypt('123456'),\n 'role' => '1',\n 'avatar' => 'CGnABxNYYn8N23RWlvTTP6C2nRjOLTf8IJcbLqRP.jpeg',\n ]);\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n $this->call(RoleSeeder::class);\n $this->call(UserSeeder::class);\n\n Medicamento::factory(50)->create();\n Reporte::factory(5)->create();\n Cliente::factory(200)->create();\n Asigna_valor::factory(200)->create();\n Carga::factory(200)->create();\n }", "public function run()\n {\n $this->call([\n RoleSeeder::class,\n TicketSeeder::class\n ]);\n\n DB::table('departments')->insert([\n 'abbr' => 'IT',\n 'name' => 'Information Technologies',\n 'created_at' => Carbon::now(),\n 'updated_at' => Carbon::now(),\n ]);\n\n DB::table('users')->insert([\n 'name' => 'admin',\n 'email' => '[email protected]',\n 'email_verified_at' => Carbon::now(),\n 'password' => Hash::make('admin'),\n 'department_id' => 1,\n 'avatar' => 'default.png',\n 'created_at' => Carbon::now(),\n 'updated_at' => Carbon::now(),\n ]);\n\n DB::table('role_user')->insert([\n 'role_id' => 1,\n 'user_id' => 1\n ]);\n }", "public function run()\n {\n \\App\\Models\\Article::factory(20)->create();\n \\App\\Models\\Category::factory(5)->create();\n \\App\\Models\\Comment::factory(40)->create();\n\n \\App\\Models\\User::create([\n \"name\"=>\"Alice\",\n \"email\"=>'[email protected]',\n 'password' => Hash::make('password'),\n ]);\n \\App\\Models\\User::create([\n \"name\"=>\"Bob\",\n \"email\"=>'[email protected]',\n 'password' => Hash::make('password'),\n ]);\n }", "public function run()\n {\n /** \n * Note: You must add these lines to your .env file for this Seeder to work (replace the values, obviously):\n SEEDER_USER_FIRST_NAME = 'Firstname'\n SEEDER_USER_LAST_NAME = 'Lastname'\n\t\tSEEDER_USER_DISPLAY_NAME = 'Firstname Lastname'\n\t\tSEEDER_USER_EMAIL = [email protected]\n SEEDER_USER_PASSWORD = yourpassword\n */\n\t\tDB::table('users')->insert([\n 'user_first_name' => env('SEEDER_USER_FIRST_NAME'),\n 'user_last_name' => env('SEEDER_USER_LAST_NAME'),\n 'user_name' => env('SEEDER_USER_DISPLAY_NAME'),\n\t\t\t'user_email' => env('SEEDER_USER_EMAIL'),\n 'user_status' => 1,\n \t'password' => Hash::make((env('SEEDER_USER_PASSWORD'))),\n 'permission_fk' => 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 }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(App\\User::class,3)->create()->each(\n \tfunction($user)\n \t{\n \t\t$user->questions()\n \t\t->saveMany(\n \t\t\tfactory(App\\Question::class, rand(2,6))->make()\n \t\t)\n ->each(function ($q) {\n $q->answers()->saveMany(factory(App\\Answer::class, rand(1,5))->make());\n })\n \t}\n );\n }\n}", "public function run()\n {\n $faker = Faker::create();\n\n // $this->call(UsersTableSeeder::class);\n\n DB::table('posts')->insert([\n 'id'=>str_random(1),\n 'user_id'=> str_random(1),\n 'title' => $faker->name,\n 'body' => $faker->safeEmail,\n 'created_at' => date('Y-m-d H:i:s'),\n 'updated_at' => date('Y-m-d H:i:s'),\n ]);\n }", "public function run()\n\t{\n\t\tDB::table(self::TABLE_NAME)->delete();\n\n\t\tforeach (seed(self::TABLE_NAME) as $row)\n\t\t\t$records[] = [\n\t\t\t\t'id'\t\t\t\t=> $row->id,\n\t\t\t\t'created_at'\t\t=> $row->created_at ?? Carbon::now(),\n\t\t\t\t'updated_at'\t\t=> $row->updated_at ?? Carbon::now(),\n\n\t\t\t\t'sport_id'\t\t\t=> $row->sport_id,\n\t\t\t\t'gender_id'\t\t\t=> $row->gender_id,\n\t\t\t\t'tournamenttype_id'\t=> $row->tournamenttype_id ?? null,\n\n\t\t\t\t'name'\t\t\t\t=> $row->name,\n\t\t\t\t'external_id'\t\t=> $row->external_id ?? null,\n\t\t\t\t'is_top'\t\t\t=> $row->is_top ?? null,\n\t\t\t\t'logo'\t\t\t\t=> $row->logo ?? null,\n\t\t\t\t'position'\t\t\t=> $row->position ?? null,\n\t\t\t];\n\n\t\tinsert(self::TABLE_NAME, $records ?? []);\n\t}", "public function run()\n\t{\n\t\tDB::table('libros')->truncate();\n\n\t\t$faker = Faker\\Factory::create();\n\n\t\tfor ($i=0; $i < 10; $i++) { \n\t\t\tLibro::create([\n\n\t\t\t\t'titulo'\t\t=> $faker->text(40),\n\t\t\t\t'isbn'\t\t\t=> $faker->numberBetween(100,999),\n\t\t\t\t'precio'\t\t=> $faker->randomFloat(2,3,150),\n\t\t\t\t'publicado'\t\t=> $faker->numberBetween(0,1),\n\t\t\t\t'descripcion'\t=> $faker->text(400),\n\t\t\t\t'autor_id'\t\t=> $faker->numberBetween(1,3),\n\t\t\t\t'categoria_id'\t=> $faker->numberBetween(1,3)\n\n\t\t\t]);\n\t\t}\n\n\t\t// Uncomment the below to run the seeder\n\t\t// DB::table('libros')->insert($libros);\n\t}", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(App\\User::class, 10)->create()->each(function ($user) {\n // Seed the relation with 5 purchases\n // $videos = factory(App\\Video::class, 5)->make();\n // $user->videos()->saveMany($videos);\n // $user->videos()->each(function ($video){\n // \t$video->videometa()->save(factory(App\\VideoMeta::class)->make());\n // \t// :( \n // });\n factory(App\\User::class, 10)->create()->each(function ($user) {\n\t\t\t factory(App\\Video::class, 5)->create(['user_id' => $user->id])->each(function ($video) {\n\t\t\t \tfactory(App\\VideoMeta::class, 1)->create(['video_id' => $video->id]);\n\t\t\t // $video->videometa()->save(factory(App\\VideoMeta::class)->create(['video_id' => $video->id]));\n\t\t\t });\n\t\t\t});\n\n });\n }", "public function run()\n {\n // for($i=1;$i<11;$i++){\n // DB::table('post')->insert(\n // ['title' => 'Title'.$i,\n // 'post' => 'Post'.$i,\n // 'slug' => 'Slug'.$i]\n // );\n // }\n $faker = Faker\\Factory::create();\n \n for($i=1;$i<20;$i++){\n $dname = $faker->name;\n DB::table('post')->insert(\n ['title' => $dname,\n 'post' => $faker->text($maxNbChars = 200),\n 'slug' => str_slug($dname)]\n );\n }\n }", "public function run()\n {\n $this->call([\n CountryTableSeeder::class,\n ProvinceTableSeeder::class,\n TagTableSeeder::class\n ]);\n\n User::factory()->count(10)->create();\n Category::factory()->count(5)->create();\n Product::factory()->count(20)->create();\n Section::factory()->count(5)->create();\n Bundle::factory()->count(20)->create();\n\n $bundles = Bundle::all();\n // populate bundle-product table (morph many-to-many)\n Product::all()->each(function ($product) use ($bundles) {\n $product->bundles()->attach(\n $bundles->random(2)->pluck('id')->toArray(),\n ['default_quantity' => rand(1, 10)]\n );\n });\n // populate bundle-tags table (morph many-to-many)\n Tag::all()->each(function ($tag) use ($bundles) {\n $tag->bundles()->attach(\n $bundles->random(2)->pluck('id')->toArray()\n );\n });\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n Contract::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 50; $i++) {\n Contract::create([\n 'serialnumbers' => $faker->numberBetween($min = 1000000, $max = 2000000),\n 'address' => $faker->address,\n 'landholder' => $faker->lastName,\n 'renter' => $faker->lastName,\n 'price' => $faker->numberBetween($min = 10000, $max = 50000),\n 'rent_start' => $faker->date($format = 'Y-m-d', $max = 'now'),\n 'rent_end' => $faker->date($format = 'Y-m-d', $max = 'now'),\n ]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $faker=Faker\\Factory::create();\n\n for($i=0;$i<100;$i++){\n \tApp\\Blog::create([\n \t\t'title' => $faker->catchPhrase,\n 'description' => $faker->text,\n 'showns' =>true\n \t\t]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::statement('SET FOREIGN_KEY_CHECKS = 0'); // TO PREVENT CHECKS FOR foreien key in seeding\n\n User::truncate();\n Category::truncate();\n Product::truncate();\n Transaction::truncate();\n\n DB::table('category_product')->truncate();\n\n User::flushEventListeners();\n Category::flushEventListeners();\n Product::flushEventListeners();\n Transaction::flushEventListeners();\n\n $usersQuantities = 1000;\n $categoriesQuantities = 30;\n $productsQuantities = 1000;\n $transactionsQuantities = 1000;\n\n factory(User::class, $usersQuantities)->create();\n factory(Category::class, $categoriesQuantities)->create();\n\n factory(Product::class, $productsQuantities)->create()->each(\n function ($product) {\n $categories = Category::all()->random(mt_rand(1, 5))->pluck('id');\n $product->categories()->attach($categories);\n });\n\n factory(Transaction::class, $transactionsQuantities)->create();\n }", "public function run()\n {\n // $this->call(UserSeeder::class);\n $this->call(PermissionsTableSeeder::class);\n $this->call(UsersTableSeeder::class);\n\n $this->call(BusinessTableSeeder::class);\n $this->call(PrinterTableSeeder::class);\n factory(App\\Tag::class,10)->create();\n factory(App\\Category::class,10)->create();\n factory(App\\Subcategory::class,50)->create();\n factory(App\\Provider::class,10)->create();\n factory(App\\Product::class,24)->create()->each(function($product){\n\n $product->images()->saveMany(factory(App\\Image::class, 4)->make());\n\n });\n\n\n factory(App\\Client::class,10)->create();\n }", "public function run()\n {\n Article::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 50; $i++) {\n Article::create([\n 'name' => $faker->sentence,\n 'sku' => $faker->paragraph,\n 'price' => $faker->number,\n ]);\n }\n }", "public function run()\n {\n Storage::deleteDirectory('public/products');\n Storage::makeDirectory('public/products');\n\n $this->call(UserSeeder::class);\n Category::factory(4)->create();\n $this->call(ProductSeeder::class);\n Order::factory(4)->create();\n Order_Detail::factory(4)->create();\n Size::factory(100)->create();\n }", "public function run()\n {\n $this->call(RolSeeder::class);\n\n $this->call(UserSeeder::class);\n Category::factory(4)->create();\n Doctor::factory(25)->create();\n Patient::factory(50)->create();\n Status::factory(3)->create();\n Appointment::factory(100)->create();\n }", "public function run()\n\t{\n\t\t\n\t\tDB::statement('SET FOREIGN_KEY_CHECKS = 0');\n\n\t\t$faker = \\Faker\\Factory::create();\n\n\t\tTodolist::truncate();\n\n\t\tforeach(range(1, 50) as $index)\n\t\t{\n\n\t\t\t$user = User::create([\n\t\t\t\t'name' => $faker->name,\n\t\t\t\t'email' => $faker->email,\n\t\t\t\t'password' => 'password',\n\t\t\t\t'confirmation_code' => mt_rand(0, 9),\n\t\t\t\t'confirmation' => rand(0,1) == 1\n\t\t\t]);\n\n\t\t\t$list = Todolist::create([\n\t\t\t\t'name' => $faker->sentence(2),\n\t\t\t\t'description' => $faker->sentence(4),\n\t\t\t]);\n\n\t\t\t// BUILD SOME TASKS FOR EACH LIST ITEM\n\t\t\tforeach(range(1, 10) as $index) \n\t\t\t{\n\t\t\t\t$task = new Task;\n\t\t\t\t$task->name = $faker->sentence(2);\n\t\t\t\t$task->description = $faker->sentence(4);\n\t\t\t\t$list->tasks()->save($task);\n\t\t\t}\n\n\t\t}\n\n\t\tDB::statement('SET FOREIGN_KEY_CHECKS = 1'); \n\n\t}", "public function run()\n {\n Campus::truncate();\n Canteen::truncate();\n Dorm::truncate();\n\n $faker = Faker\\Factory::create();\n $schools = School::all();\n foreach ($schools as $school) {\n \tforeach (range(1, 2) as $index) {\n\t \t$campus = Campus::create([\n\t \t\t'school_id' => $school->id,\n\t \t\t'name' => $faker->word . '校区',\n\t \t\t]);\n\n \t$campus->canteens()->saveMany(factory(Canteen::class, mt_rand(2,3))->make());\n $campus->dorms()->saveMany(factory(Dorm::class, mt_rand(2,3))->make());\n\n }\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n DB::table('users')->insert([\n 'name' => 'admin',\n 'email' => '[email protected]',\n 'password' => bcrypt('admin'),\n 'seq_q'=>'1',\n 'seq_a'=>'admin'\n ]);\n\n // DB::table('bloods')->insert([\n // ['name' => 'A+'],\n // ['name' => 'A-'],\n // ['name' => 'B+'],\n // ['name' => 'B-'],\n // ['name' => 'AB+'],\n // ['name' => 'AB-'],\n // ['name' => 'O+'],\n // ['name' => 'O-'],\n // ]);\n\n \n }", "public function run()\n {\n // $this->call(UserTableSeeder::class);\n \\App\\User::create([\n 'name'=>'PAPE SAMBA NDOUR',\n 'email'=>'[email protected]',\n 'password'=>bcrypt('Admin1122'),\n ]);\n\n $faker = Faker::create();\n\n for ($i = 0; $i < 100 ; $i++)\n {\n $firstName = $faker->firstName;\n $lastName = $faker->lastName;\n $niveau = \\App\\Niveau::inRandomOrder()->first();\n \\App\\Etudiant::create([\n 'prenom'=>$firstName,\n 'nom'=>$lastName,\n 'niveau_id'=>$niveau->id\n ]);\n }\n\n\n }", "public function run()\n {\n //\n DB::table('foods')->delete();\n\n Foods::create(array(\n 'name' => 'Chicken Wing',\n 'author' => 'Bambang',\n 'overview' => 'a deep-fried chicken wing, not in spicy sauce'\n ));\n\n Foods::create(array(\n 'name' => 'Beef ribs',\n 'author' => 'Frank',\n 'overview' => 'Slow baked beef ribs rubbed in spices'\n ));\n\n Foods::create(array(\n 'name' => 'Ice cream',\n 'author' => 'Lou',\n 'overview' => ' A sweetened frozen food typically eaten as a snack or dessert.'\n ));\n\n }", "public function run()\n {\n // Let's truncate our existing records to start from scratch.\n News::truncate();\n\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 10; $i++) {\n News::create([\n 'title' => $faker->sentence,\n 'summary' => $faker->sentence,\n 'content' => $faker->paragraph,\n 'imagePath' => '/img/exclamation_mark.png'\n ]);\n }\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(App\\User::class, 3)->create();\n factory(App\\Models\\Category::class, 3)\n ->create()\n ->each(function ($u) {\n $u->courses()->saveMany(factory(App\\Models\\Course::class,3)->make())->each(function ($c){\n $c->exams()->saveMany(factory(\\App\\Models\\Exam::class,3)->make())->each(function ($e){\n $e->questions()->saveMany(factory(\\App\\Models\\Question::class,4)->make())->each(function ($q){\n $q->answers()->saveMany(factory(\\App\\Models\\Answer::class,4)->make())->each(function ($a){\n $a->correctAnswer()->save(factory(\\App\\Models\\Correct_answer::class)->make());\n });\n });\n });\n });\n\n });\n\n }", "public function run()\n {\n \\DB::table('employees')->delete();\n\n $faker = \\Faker\\Factory::create('ja_JP');\n\n $role_id = ['1','2','3'];\n\n for ($i = 0; $i < 10; $i++) {\n \\App\\Models\\Employee::create([\n 'last_name' =>$faker->lastName() ,\n 'first_name' => $faker->firstName(),\n 'mail' => $faker->email(),\n 'password' => Hash::make( \"password.$i\"),\n 'birthday' => $faker->date($format='Y-m-d',$max='now'),\n 'role_id' => $faker->randomElement($role_id)\n ]);\n }\n }", "public function run()\n {\n\n DB::table('clients')->delete();\n DB::table('trips')->delete();\n error_log('empty tables done.');\n\n $random_cities = City::inRandomOrder()->select('ar_name')->limit(5)->get();\n $GLOBALS[\"random_cities\"] = $random_cities->pluck('ar_name')->toArray();\n\n $random_airlines = Airline::inRandomOrder()->select('code')->limit(5)->get();\n $GLOBALS[\"random_airlines\"] = $random_airlines->pluck('code')->toArray();\n\n factory(App\\Client::class, 5)->create();\n error_log('Client seed done.');\n\n\n factory(App\\Trip::class, 50)->create();\n error_log('Trip seed done.');\n\n\n factory(App\\Quicksearch::class, 10)->create();\n error_log('Quicksearch seed done.');\n }", "public function run()\n {\n // Admins\n User::factory()->create([\n 'name' => 'Zaiman Noris',\n 'username' => 'rognales',\n 'email' => '[email protected]',\n 'active' => true,\n ]);\n\n User::factory()->create([\n 'name' => 'Affiq Rashid',\n 'username' => 'affiqr',\n 'email' => '[email protected]',\n 'active' => true,\n ]);\n\n // Only seed test data in non-prod\n if (! app()->isProduction()) {\n Member::factory()->count(1000)->create();\n Staff::factory()->count(1000)->create();\n\n Participant::factory()\n ->addSpouse()\n ->addChildren()\n ->addInfant()\n ->addOthers()\n ->count(500)\n ->hasUploads(2)\n ->create();\n }\n }", "public function run()\n {\n $this->call([\n RoleSeeder::class,\n UserSeeder::class,\n ]);\n\n \\App\\Models\\Category::factory(4)->create();\n \\App\\Models\\View::factory(6)->create();\n \\App\\Models\\Room::factory(8)->create();\n \n $rooms = \\App\\Models\\Room::all();\n // \\App\\Models\\User::all()->each(function ($user) use ($rooms) { \n // $user->rooms()->attach(\n // $rooms->random(rand(1, \\App\\Models\\Room::max('id')))->pluck('id')->toArray()\n // ); \n // });\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n Employee::factory()->create(['email' => '[email protected]']);\n Brand::factory()->count(3)->create();\n $this->call([\n TagSeeder::class,\n AttributeSeeder::class,\n AttributeValueSeeder::class,\n ProductSeeder::class,\n ]);\n }", "public function run()\n {\n $this->call(RolesTableSeeder::class); // crée les rôles\n $this->call(PermissionsTableSeeder::class); // crée les permissions\n\n factory(Employee::class,3)->create();\n factory(Provider::class,1)->create();\n\n $user = User::create([\n 'name'=>'Alioune Bada Ndoye',\n 'email'=>'[email protected]',\n 'phone'=>'773012470',\n 'password'=>bcrypt('123'),\n ]);\n Employee::create([\n 'job'=>'Informaticien',\n 'user_id'=>User::where('email','[email protected]')->first()->id,\n 'point_id'=>Point::find(1)->id,\n ]);\n $user->assignRole('admin');\n }", "public function run()\n {\n // $this->call(UserSeeder::class);\n factory(User::class, 1)\n \t->create(['email' => '[email protected]']);\n\n factory(Category::class, 5)->create();\n }", "public function run()\n {\n //$this->call(UsersTableSeeder::class);\n $this->call(rootSeed::class);\n factory(App\\Models\\Egresado::class,'hombre',15)->create();\n factory(App\\Models\\Egresado::class,'mujer',15)->create();\n factory(App\\Models\\Administrador::class,5)->create();\n factory(App\\Models\\Notificacion::class,'post',10)->create();\n factory(App\\Models\\Notificacion::class,'mensaje',5)->create();\n factory(App\\Models\\Egresado::class,'bajaM',5)->create();\n factory(App\\Models\\Egresado::class,'bajaF',5)->create();\n factory(App\\Models\\Egresado::class,'suscritam',5)->create();\n factory(App\\Models\\Egresado::class,'suscritaf',5)->create();\n }", "public function run()\n {\n \n User::factory(1)->create([\n 'rol'=>'EPS'\n ]);\n Person::factory(10)->create();\n $this->call(EPSSeeder::class);\n $this->call(OfficialSeeder::class);\n $this->call(VVCSeeder::class);\n $this->call(VaccineSeeder::class);\n }", "public function run()\n {\n // $faker=Faker::create();\n // foreach(range(1,100) as $index)\n // {\n // DB::table('products')->insert([\n // 'name' => $faker->name,\n // 'price' => rand(10,100000)/100\n // ]);\n // }\n }", "public function run()\n {\n $this->call([\n LanguagesTableSeeder::class,\n ListingAvailabilitiesTableSeeder::class,\n ListingTypesTableSeeder::class,\n RoomTypesTableSeeder::class,\n AmenitiesTableSeeder::class,\n UsersTableSeeder::class,\n UserLanguagesTableSeeder::class,\n ListingsTableSeeder::class,\n WishlistsTableSeeder::class,\n StaysTableSeeder::class,\n GuestsTableSeeder::class,\n TripsTableSeeder::class,\n ReviewsTableSeeder::class,\n RatingsTableSeeder::class,\n PopularDestinationsTableSeeder::class,\n ImagesTableSeeder::class,\n ]);\n\n // factory(App\\User::class, 5)->states('host')->create();\n // factory(App\\User::class, 10)->states('hostee')->create();\n\n // factory(App\\User::class, 10)->create();\n // factory(App\\Models\\Listing::class, 30)->create();\n }", "public function run()\n {\n Schema::disableForeignKeyConstraints();\n Grade::truncate();\n Schema::enableForeignKeyConstraints();\n\n $faker = \\Faker\\Factory::create();\n\n for ($i = 0; $i < 10; $i++) {\n Grade::create([\n 'letter' => $faker->randomElement(['а', 'б', 'в']),\n 'school_id' => $faker->unique()->numberBetween(1, School::count()),\n 'level' => 1\n ]);\n }\n }", "public function run()\n {\n // $this->call(UserSeeder::class);\n factory(App\\User::class,5)->create();//5 User created\n factory(App\\Model\\Genre::class,5)->create();//5 genres\n factory(App\\Model\\Film::class,6)->create();//6 films\n factory(App\\Model\\Comment::class, 20)->create();// 20 comments\n }", "public function run()\n {\n\n $this->call(UserSeeder::class);\n factory(Empresa::class,10)->create();\n factory(Empleado::class,50)->create();\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n User::create([\n 'name' => 'jose luis',\n 'email' => '[email protected]',\n 'password' => bcrypt('xxxxxx'),\n 'role' => 'admin',\n ]);\n\n Category::create([\n 'name' => 'inpods',\n 'description' => 'auriculares inalambricos que funcionan con blouthue genial'\n ]);\n\n Category::create([\n 'name' => 'other',\n 'description' => 'otra cosa diferente a un inpods'\n ]);\n\n\n /* Create 10 products */\n Product::factory(10)->create();\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n factory(User::class)->create([\n 'email' => '[email protected]',\n 'name' => 'Russell'\n ]);\n\n factory(User::class)->create([\n 'email' => '[email protected]',\n 'name' => 'Bitfumes'\n ]);\n\n factory(User::class)->create([\n 'email' => '[email protected]',\n 'name' => 'Paul'\n ]);\n }", "public function run()\n {\n $user_ids = [1,2,3];\n $faker = app(\\Faker\\Generator::class);\n $posts = factory(\\App\\Post::class)->times(50)->make()->each(function($post) use ($user_ids,$faker){\n $post->user_id = $faker->randomElement($user_ids);\n });\n \\App\\Post::insert($posts->toArray());\n }", "public function run()\n {\n // Vaciar la tabla.\n Favorite::truncate();\n $faker = \\Faker\\Factory::create();\n // Crear artículos ficticios en la tabla\n\n // factory(App\\Models\\User::class, 2)->create()->each(function ($user) {\n // $user->users()->saveMany(factory(App\\Models\\User::class, 25)->make());\n //});\n }", "public function run()\n\t{\n\t\t$this->call(ProductsTableSeeder::class);\n\t\t$this->call(CategoriesTableSeeder::class);\n\t\t$this->call(BrandsTableSeeder::class);\n\t\t$this->call(ColorsTableSeeder::class);\n\n\t\t$products = \\App\\Product::all();\n \t$categories = \\App\\Category::all();\n \t$brands = \\App\\Brand::all();\n \t$colors = \\App\\Color::all();\n\n\t\tforeach ($products as $product) {\n\t\t\t$product->colors()->sync($colors->random(3));\n\n\t\t\t$product->category()->associate($categories->random(1)->first());\n\t\t\t$product->brand()->associate($brands->random(1)->first());\n\n\t\t\t$product->save();\n\t\t}\n\n\t\t// for ($i = 0; $i < count($products); $i++) {\n\t\t// \t$cat = $categories[rand(0,5)];\n\t\t// \t$bra = $brands[rand(0,7)];\n\t\t// \t$cat->products()->save($products[$i]);\n\t\t// \t$bra->products()->save($products[$i]);\n\t\t// }\n\n\t\t// $products = factory(App\\Product::class)->times(20)->create();\n\t\t// $categories = factory(App\\Category::class)->times(6)->create();\n\t\t// $brands = factory(App\\Brand::class)->times(8)->create();\n\t\t// $colors = factory(App\\Color::class)->times(15)->create();\n\t}", "public function run()\n {\n /*$this->call(UsersTableSeeder::class);\n $this->call(GroupsTableSeeder::class);\n $this->call(TopicsTableSeeder::class);\n $this->call(CommentsTableSeeder::class);*/\n DB::table('users')->insert([\n 'name' => 'pkw',\n 'email' => '[email protected]',\n 'password' => bcrypt('secret'),\n 'type' => '1'\n ]);\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n $faker = Faker::create();\n foreach (range(1,200) as $index) {\n DB::table('users')->insert([\n 'name' => $faker->name,\n 'email' => $faker->email,\n 'phone' => $faker->randomDigitNotNull,\n 'address'=> $faker->streetAddress,\n 'password' => bcrypt('secret'),\n ]);\n }\n }", "public function run()\n {\n $this->call(UsersSeeder::class);\n User::factory(2)->create();\n Company::factory(2)->create();\n\n }", "public function run()\n {\n echo PHP_EOL , 'seeding roles...';\n\n Role::create(\n [\n 'name' => 'Admin',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Principal',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Teacher',\n 'deletable' => false,\n ]\n );\n\n Role::create(\n [\n 'name' => 'Student',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Parents',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Accountant',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Librarian',\n 'deletable' => false,\n ]\n );\n Role::create(\n [\n 'name' => 'Receptionist',\n 'deletable' => false,\n ]\n );\n\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n // $this->call(QuestionTableSeed::class);\n\n $this->call([\n QuestionTableSeed::class,\n AlternativeTableSeed::class,\n ScheduleActionTableSeeder::class,\n UserTableSeeder::class,\n CompanyClassificationTableSeed::class,\n ]);\n // DB::table('clients')->insert([\n // 'name' => 'Empresa-02',\n // 'email' => '[email protected]',\n // 'password' => bcrypt('07.052.477/0001-60'),\n // ]);\n }", "public function run()\n {\n $faker = \\Faker\\Factory::create();\n\n // And now, let's create a few articles in our database:\n for ($i = 0; $i < 5; $i++) {\n Runner::create([\n 'external_id' => $faker->uuid,\n 'name' => $faker->name,\n 'race_id' =>rand(1,5),\n 'age' => rand(30, 45),\n 'sex' => $faker->randomElement(['male', 'female']),\n 'color' => $faker->randomElement(['#ecbcb4', '#d1a3a4']),\n ]);\n }\n }", "public function run()\n {\n // \\App\\Models\\User::factory(10)->create();\n\n User::factory()->create([\n 'name' => 'Carlos',\n 'email' => '[email protected]',\n 'email_verified_at' => now(),\n 'password' => bcrypt('123456'), // password\n 'remember_token' => Str::random(10),\n ]);\n \n $this->call([PostsTableSeeder::class]);\n $this->call([TagTableSeeder::class]);\n\n }", "public function run()\n {\n $this->call(AlumnoSeeder::class);\n //Alumnos::factory()->count(30)->create();\n //DB::table('alumnos')->insert([\n // 'dni_al' => '13189079',\n // 'nom_al' => 'Jose',\n // 'ape_al' => 'Araujo',\n // 'rep_al' => 'Principal',\n // 'esp_al' => 'Tecnologia',\n // 'lnac_al' => 'Valencia'\n //]);\n }", "public function run()\n {\n Eloquent::unguard();\n\n DB::statement('SET FOREIGN_KEY_CHECKS=0;');\n\n // $this->call([\n // CountriesTableSeeder::class,\n // ]);\n\n factory(App\\User::class, 100)->create();\n factory(App\\Type::class, 10)->create();\n factory(App\\Item::class, 100)->create();\n factory(App\\Order::class, 1000)->create();\n\n $items = App\\Item::all();\n\n App\\Order::all()->each(function($order) use ($items) {\n\n $n = rand(1, 10);\n\n $order->items()->attach(\n $items->random($n)->pluck('id')->toArray()\n , ['quantity' => $n]);\n\n $order->total = $order->items->sum(function($item) {\n return $item->price * $item->pivot->quantity;\n });\n\n $order->save();\n\n });\n\n DB::statement('SET FOREIGN_KEY_CHECKS=1;');\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n\n factory(User::class)->create(\n [\n 'email'=>'[email protected]',\n 'name'=>'izzanni',\n \n ]\n );\n factory(User::class)->create(\n [\n 'email'=>'[email protected]',\n 'name'=>'aina',\n\n ]\n );\n factory(User::class)->create(\n [\n 'email'=>'[email protected]',\n 'name'=>'sab',\n\n ]\n );\n }", "public function run()\n {\n\n factory('App\\Models\\Pessoa', 60)->create();\n factory('App\\Models\\Profissional', 10)->create();\n factory('App\\Models\\Paciente', 50)->create();\n $this->call(UsersTableSeeder::class);\n $this->call(ProcedimentoTableSeeder::class);\n // $this->call(PessoaTableSeeder::class);\n // $this->call(ProfissionalTableSeeder::class);\n // $this->call(PacienteTableSeeder::class);\n // $this->call(AgendaProfissionalTableSeeder::class);\n }", "public function run()\n {\n //Acá se define lo que el seeder va a hacer.\n //insert() para insertar datos.\n //Array asociativo. La llave es el nombre de la columna.\n// DB::table('users')->insert([\n// //Para un solo usuario.\n// 'name' => 'Pedrito Perez',\n// 'email' => '[email protected]',\n// 'password' => bcrypt('123456')\n// ]);//Se indica el nombre de la tabla.\n\n //Crea 50 usuarios (sin probar)\n// factory(App\\User::class, 50)->create()->each(function($u) {\n// $u->posts()->save(factory(App\\Post::class)->make());\n// });\n\n factory(App\\User::class, 10)->create(); //Así se ejecuta el model factory creado en ModelFactory.php\n\n }", "public function run()\n {\n // $this->call(UsersTableSeeder::class);\n //nhập liệu mẫu cho bảng users\n DB::table('users')->insert([\n \t['id'=>'1001', 'name'=>'Phan Thị Hiền', 'email'=>'[email protected]', 'password'=>'123456', 'isadmin'=>1],\n \t['id'=>'1002', 'name'=>'Phan Thị Hà', 'email'=>'[email protected]', 'password'=>'111111', 'isadmin'=>0]\n ]);\n\n\n //nhập liệu mẫu cho bảng suppliers\n DB::table('suppliers')->insert([\n \t['name'=>'FPT', 'address'=>'151 Hùng Vương, TP. Đà Nẵng', 'phonenum'=>'0971455395'],\n \t['name'=>'Điện Máy Xanh', 'address'=>'169 Phan Châu Trinh, TP. Đà Nẵng', 'phonenum'=>'0379456011']\n ]);\n\n\n //Bảng phiếu bảo hành\n }", "public function run()\n {\n \t// DB::table('categories')->truncate();\n // factory(App\\Models\\Category::class, 10)->create();\n Schema::disableForeignKeyConstraints();\n Category::truncate();\n $faker = Faker\\Factory::create();\n\n $categories = ['SAMSUNG','NOKIA','APPLE','BLACK BERRY'];\n foreach ($categories as $key => $value) {\n Category::create([\n 'name'=>$value,\n 'description'=> 'This is '.$value,\n 'markup'=> rand(10,100),\n 'category_id'=> null,\n 'UUID' => $faker->uuid,\n ]);\n }\n }" ]
[ "0.8013876", "0.79804534", "0.7976992", "0.79542726", "0.79511505", "0.7949612", "0.794459", "0.7942486", "0.7938189", "0.79368967", "0.79337025", "0.78924936", "0.78811055", "0.78790957", "0.78787595", "0.787547", "0.7871811", "0.78701615", "0.7851422", "0.7850352", "0.7841468", "0.7834583", "0.7827792", "0.7819104", "0.78088796", "0.7802872", "0.7802348", "0.78006834", "0.77989215", "0.7795819", "0.77903426", "0.77884805", "0.77862066", "0.7778816", "0.7777486", "0.7765202", "0.7762492", "0.77623445", "0.77621746", "0.7761383", "0.77606887", "0.77596676", "0.7757001", "0.7753607", "0.7749522", "0.7749292", "0.77466977", "0.7729947", "0.77289546", "0.772796", "0.77167094", "0.7714503", "0.77140456", "0.77132195", "0.771243", "0.77122366", "0.7711113", "0.77109736", "0.7710777", "0.7710086", "0.7705484", "0.770464", "0.7704354", "0.7704061", "0.77027386", "0.77020216", "0.77008796", "0.7698617", "0.76985973", "0.76973504", "0.7696405", "0.7694293", "0.7692694", "0.7691264", "0.7690576", "0.76882726", "0.7687433", "0.7686844", "0.7686498", "0.7685065", "0.7683827", "0.7679184", "0.7678287", "0.76776296", "0.76767945", "0.76726556", "0.76708084", "0.76690495", "0.766872", "0.76686716", "0.7666299", "0.76625943", "0.7662227", "0.76613766", "0.7659881", "0.7656644", "0.76539344", "0.76535016", "0.7652375", "0.7652313", "0.7652022" ]
0.0
-1
/ WELCOME TO KOSTLAB X CODEIGNITER FRAMEWORK Framework inidibuat untuk memudahkan development chatbot LINE
public function __construct() { parent::__construct(); //Codeigniter : Write Less Do More $this->load->model(array('Dbs')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function chatbot()\n {\n // no code needed.\n }", "public function execute() {\n \n $message = $this->getMessage(); // Get Message object\n\n $chat_id = $message->getChat()->getId(); // Get the current Chat ID\n $nama = $message->getFrom()->getFirstName() .' '. $message->getFrom()->getLastName();\n \n $text = \"<b>Hai $nama</b>. Berikut ini list perintah yang dapat digunakan di bot Ilkom 2017 Reborn ini.\\n\\n\";\n \n $text .= \"<b>Bot Command</b>\\n\";\n $text .= \"/start = Memulai Bot\\n\";\n $text .= \"/help = Menampilkan daftar perintah.\\n\";\n $text .= \"/about = Tentang Bot ini.\\n\\n\";\n \n $text .= \"<b>Akademik dan Informasi</b>\\n\";\n $text .= \"/jadwal = Perintah untuk menampilkan Jadwal. Klik untuk lebih lanjut.\\n\";\n $text .= \"/info = Perintah menampilkan informasi umum.\\n\";\n $text .= \"/addinfo = Perintah untuk menambahkan informasi kepada yang lain.\\n\";\n $text .= \"/beasiswa = Perintah untuk menampilkan info beasiswa.\\n\";\n $text .= \"/addbeasiswa = Perintah untuk menambahkan informasi beasiswa kepada yang lain.\\n\\n\";\n \n $text .= \"<b>Fitur</b>\\n\";\n $text .= \"/kbbi = Mencari definisi kata dari KBBI.\\n\";\n $text .= \"/github = Fitur pencarian di github.\\n\";\n $text .= \"/buku = Menacari buku seputar IT\\n\";\n $text .= \"/translate atau /tr = Terjemahan bahasa\\n\";\n $text .= \"/stack = Mencari postingan dari Stackoverflow\\n\\n\";\n \n $text .= \"<b>Lainnya</b>\\n\";\n $text .= \"/pesan = Mengirim kritik dan saran ke Bot, bisa juga digunakan untuk request fitur misalnya.\\n\";\n \n Request::sendChatAction([\n \n 'chat_id'=> $chat_id,\n 'action' => 'typing'\n ]);\n \n $kirimpesan = [\n 'chat_id' => $chat_id,\n 'parse_mode' => 'HTML',\n 'text' => $text\n ];\n \n return Request::sendMessage($kirimpesan);\n }", "public static function welcomeMessage() : void\n {\n if (!file_exists(__DIR__ . '/../../.env.php')) {\n echo \"Heya, we think you are new. Let us spin up the frame work for you!..\";\n $request = self::requestInput('Do you want to continue?', ['(Y)es', '(N)o']);\n if ($request == 'yes' || $request == 'y') {\n $start = new \\Framework\\Commands\\Start\\Start;\n $start->start();\n exit();\n }\n echo \"=====================================\\n\";\n }\n echo \"Welcome to the command environment. Choose what you want to do, you have the following options: \\n\";\n foreach (self::$options as $option) {\n echo \"- $option \\n\";\n }\n }", "public function sendWelcomeMsg()\n\t{\n\t}", "function create_response($text, $message)\r\n{\r\n global $usernamebot;\r\n \r\n // inisiasi variable hasil yang mana merupakan hasil olahan pesan\r\n $hasil = ''; \r\n \r\n $chatid = $message[\"chat\"][\"id\"]; // variable penampung id chat\r\n \r\n\r\n // variable penampung username nya user\r\n isset($message[\"from\"][\"username\"])\r\n ? $chatuser = $message[\"from\"][\"username\"]\r\n : $chatuser = '';\r\n \r\n\r\n // variable penampung nama user\r\n\r\n isset($message[\"from\"][\"last_name\"]) \r\n ? $namakedua = $message[\"from\"][\"last_name\"] \r\n : $namakedua = ''; \r\n\r\n $namauser = $message[\"from\"][\"first_name\"]. ' ' .$namakedua;\r\n\r\n $pecah = explode(' ', $text); \r\n\t\r\n // identifikasi perintah (yakni kata pertama, atau array pertamanya)\r\n switch ($pecah[0]) {\r\n \r\n case '/start':\r\n if(str_word_count($text)<=1){\r\n $_SESSION['namauser']=$namauser;\r\n\r\n $hasil = \"Hai 💁 `{$_SESSION['namauser']}` .. Selamat datang di `Sistem Informasi Jadwal Laboratorium FASILKOM-TI` Universitas Sumatera Utara! \\n\\n\";\r\n $hasil .= '💁🏼 Aku adalah *bot SisLabTI* ver.`'.myVERSI.\"`\\n\";\r\n $hasil .= \"🎓 yang dibuat oleh :\\n\";\r\n $hasil .= \" _Indana Fariza Hidayat 161402082_\\n\";\r\n $hasil .= \" _Gistya Fakhrani 161402094_\\n\";\r\n $hasil .= \" _Rina Ayu Wulan Sari 161402097_\\n \";\r\n $hasil .= \" _Sinta Anjelina 161402100_\\n\";\r\n $hasil .= \" _Dea Amanda 161402118_\\n⌛️\".lastUPDATE.\"\\n\\n\";\r\n $hasil .= \"‼️ Notes ‼️ \\n `Bot hanya mengerti bahasa instruksi yang disediakan` 🔻 \\n `Jika` instruksi sudah sesuai namun `bot sedang lambat & tidak merespons`. `Ketikkan instruksi ulang` 🔻\\n\\n\";\r\n\r\n $hasil .= \"Silahkan _login_ terlebih dahulu. ketik: /login\\n\";\r\n $_SESSION['step']= \"/login\";\r\n } else {\r\n $hasil= '⛔️ *ERROR:* _Tidak ada instruksi tersebut . Panggil bot sesuai instruksi!_';\r\n $hasil .= \"\\n\".'ingat /start ya ! 😅'; \r\n }\r\n break;\r\n\r\n // balasan default jika pesan tidak di definisikan\r\n default:\r\n\t\t\t//if(isset($_SESSION['chatid'])){\r\n\t\t\t\tif(isset($_SESSION['step'])){\r\n\t\t\t\t\tswitch($_SESSION['step']){\r\n case '/login':\r\n var_dump($text);\r\n $hasil = start($text);\r\n break;\r\n case 'level_user':\r\n $hasil = level_user($text);\r\n // return $hasil;\r\n break;\r\n case 'menupraktikan':\r\n $hasil = menupraktikan($text);\r\n $_SESSION['chat_id'] = $chatid;\r\n break;\r\n case 'menuaslab':\r\n $hasil = menuaslab($text);\r\n $_SESSION['chat_id'] = $chatid;\r\n break;\r\n case 'nim':\r\n //tampung dulu nimnya ke SESSION\r\n var_dump($text);\r\n $_SESSION['nim'] = $text;\r\n var_dump($_SESSION['nim']);\r\n $hasil = login($text);\r\n $_SESSION['chat_id'] = $chatid;\r\n break;\r\n case 'password':\r\n var_dump($text);\r\n $_SESSION['password'] = $text; \r\n $hasil = password($text);\r\n $_SESSION['chat_id'] = $chatid; \r\n break;\r\n case 'term': \r\n $_SESSION['semester'] = $text;\r\n $hasil = term($text);\r\n $_SESSION['chat_id']=$chatid;\r\n break;\r\n case 'matakuliah':\r\n $_SESSION['id_matkul']= $text;\r\n $hasil = matakuliah($text);\r\n $_SESSION['chat_id']=$chatid;\r\n break;\r\n case 'hari':\r\n $_SESSION['hari'] = $text;\r\n $hasil = hari($text);\r\n $_SESSION['chat_id'] = $chatid;\r\n break;\r\n case 'waktu':\r\n $_SESSION['waktu'] = $text;\r\n $hasil = waktu($text);\r\n $_SESSION['chat_id'] = $chatid;\r\n break;\r\n case 'ruangan':\r\n $_SESSION['ruangan'] = $text;\r\n $hasil = ruangan($text);\r\n $_SESSION['chat_id'] = $chatid;\r\n break;\r\n case 'kom':\r\n $_SESSION['kom'] = $text;\r\n $hasil = kom($text);\r\n $_SESSION['chat_id'] = $chatid;\r\n break;\r\n\r\n case 'menu': \r\n $hasil = menu($_SESSION['nama_aslab']);\r\n break;\r\n\r\n case 'gantihari':\r\n $_SESSION['hariganti'] = $text;\r\n $hasil = gantihari($text);\r\n $_SESSION['chat_id'] = $chatid;\r\n break;\r\n case 'gantiwaktu':\r\n $_SESSION['waktuganti'] = $text;\r\n $hasil = gantiwaktu($text);\r\n $_SESSION['chat_id'] = $chatid;\r\n break;\r\n case 'gantiruangan':\r\n $_SESSION['ruanganganti'] = $text;\r\n $hasil = gantiruangan($text);\r\n $_SESSION['chat_id'] = $chatid;\r\n break;\r\n case 'update':\r\n $text = strtolower($text);\r\n $_SESSION['chat_id'] = $chatid;\r\n if($text == 'ya'){\r\n $hasil .=upselesai();\r\n return $hasil;\r\n }\r\n elseif ($text== 'tidak') {\r\n # code...\r\n var_dump($_SESSION['nama_aslab']);\r\n $hasil = \"🅾️ Anda tidak jadi mengubah jadwal.\\n\\n\";\r\n $_SESSION['step']='menuaslab';\r\n $hasil .= menu($_SESSION['nama_aslab']);\r\n \r\n }\r\n else {\r\n $hasil = \"Masukkan sesuai perintah (ya/tidak)\\n\";\r\n $_SESSION['step'] ='update';\r\n break; \r\n }\r\n break;\r\n\r\n case 'upselesai':\r\n $hasil .= upselesai();\r\n break;\r\n\r\n\r\n \r\n\t\t\t\t\t\tcase 'verifikasi':\r\n $text = strtolower($text);\r\n $_SESSION['chat_id'] = $chatid;\r\n\t\t\t\t\t\t\tif($text == 'ya'){\r\n $hasil .=selesai();\r\n return $hasil;\r\n\t\t\t\t\t\t\t}\r\n elseif ($text== 'tidak') {\r\n # code...\r\n $hasil = \"Silahkan ulangi dengan perintah /tambah\";\r\n $_SESSION['step']='menuaslab';\r\n }\r\n else {\r\n $hasil = \"Masukkan sesuai perintah (ya/tidak)\\n\";\r\n $_SESSION['step'] ='verifikasi';\r\n break; \r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 'selesai':\r\n\t\t\t\t\t\t\t// simpan ke database\r\n $hasil=selesai();\r\n\t\t\t\t\t\t\t//return $hasil;\r\n\t\t\t\t\t\t\t//session_destroy();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t} else {\r\n\t\t\t\t $hasil = \"😥 Instruksi tidak tersedia jika `anda belum memanggil Bot`.\\n Panggil bot dengan `/start` ya! 😅\";\r\n\t\t\t\t}\r\n\t\t\t//}\r\n break;\r\n\t\t\t\r\n }\r\n\t\r\n\tprint_r($_SESSION);\r\n\r\n return $hasil;\r\n}", "public function user_conversation_fun(){\n require_once REALTEO_PLUGIN_DIR . '/includes/user_conversation.php';\n }", "function sendMenu1($chat,$text,$messenger=''){\r\n $keyboard = [\t['/w1 Я студент', '/w2 Я преподаватель']];\r\n//\t\t ['/h Помощь', '/start Сброс']];\r\nglobal $BASE_KEYBOARD;\r\n$keyboard[]=$BASE_KEYBOARD;\r\n\tsendMenu0($chat,$text,$messenger,$keyboard);\r\n}", "function callBackUpdate($_TELEGRAM, $th, $tc){\n // YOUR BOT CODE GOES HERE\n if ($_TELEGRAM['text'] == \"/start\")\n {\n send($_TELEGRAM['cid'], \"Hi! Welcome on MTgBot Example!\\nThis message was sent by Thread #$th.\\nThe Thread #$th sent $tc messages.\");\n }\n\n}", "static function welcome()\n\t{\n\t\techo 'wellcome to our project';\n\t}", "public function execute() {\n \n $message = $this->getMessage(); // Get Message object\n\n $chat_id = $message->getChat()->getId(); // Get the current Chat ID\n $nama = $message->getFrom()->getFirstName() .' '. $message->getFrom()->getLastName();\n\t$host = trim($message->getText(true));\n\n\tif($host === '') {\n\t\t$host = \"ilkom2017bot.herokuapp.com\";\n\t}\n \n $start = microtime(true);\n \t$fp = fsockopen($host, 80, $errorCode, $errorCode, 5);\n \t$end = microtime(true);\n \t\tif($fp === false){\n \t\t$hasil = \"Koneksi gagal\";\n \t\t}\n \tfclose($fp);\n \t$diff = $end - $start;\n\t$hasil = $diff * 1000 . \" ms\";\n\t\n\t$text = \"Hasil: $hasil\";\n\t\n Request::sendChatAction([\n \n 'chat_id'=> $chat_id,\n 'action' => 'typing'\n ]);\n \n $kirimpesan = [\n 'chat_id' => $chat_id,\n 'parse_mode' => 'HTML',\n 'text' => $text\n ];\n \n return Request::sendMessage($kirimpesan);\n }", "public function chat()\n {\n $errors = [];\n $formValid = false;\n $params = [\n // dans la vue, les clés deviennent des variables\n 'formValid' => $formValid,\n 'errors' => $errors,\n ];\n\n // Affichage du chat seulement si connecté\n if(!empty($this->getUser())){\n $this->show('chat/chat', $params);\n }\n else{{\n $this->showNotFound(); // sinon page 404\n }}\n\n }", "public function run()\n {\n Chat::create([\n 'iq' => \"Halo\",\n 'ia' => \"hai!\",\n 'eq' => \"Hello\",\n 'ea' => \"Hi!\",\n 'jq' => \"はじめまして。\",\n 'ja' => \"はじめまして。\",\n 'image' => \"default.jpg\",\n 'voice' => \"default.ogg\",\n ]);\n }", "public function welcomeMessage()\n {\n $this->info('');\n $this->info('Welcome to Nigels Coffee Shop Robot Controller Simulator!');\n }", "public function execute(): ServerResponse\n {\n $message = $this->getMessage(); // Get Message object\n\n $chat_id = $message->getChat()->getId(); // Get the current Chat ID\n\n $text = 'Para obtener información mas especifica: '. $this->getUsage();\n\n $plataforma = trim($this->getMessage()->getText(true));\n \n\n if ($plataforma !== '') {\n $text = $this->getPlatformData(strtoupper($plataforma));\n }\n\n $keyboards[] = new Keyboard(\n ['text' => 'Prestashop'],\n ['texto'=>'WordPress']\n );\n\n $inline_keyboard = new InlineKeyboard([\n ['text' => 'WordPress', 'switch_inline_query_current_chat' => '/integracion WordPress'],\n ['text' => 'Prestashop', 'switch_inline_query_current_chat' => '/integracion Prestashop'],\n ]);\n\n return $this->replyToChat('Inline Keyboard', [\n 'reply_markup' => $inline_keyboard,\n ]);\n\n \n $data = [\n 'chat_id' => $chat_id,\n 'text' => $text,\n ];\n\n /* shuffle($keyboards);\n $keyboard = end($keyboards)\n ->setResizeKeyboard(true)\n ->setOneTimeKeyboard(true)\n ->setSelective(false);\n\n return $this->replyToChat('Seleccione una Opción!', [\n 'reply_markup' => $keyboard,\n ]);*/\n return $this->replyToChat('Seleccione una Opción', [\n 'reply_markup' => $inline_keyboard,\n ]);\n // return Request::sendMessage($data);\n }", "function METHOD_hello()\n {\n $this->sendTerminal('This is a Hello World :)');\n\n }", "public function sayHello(){\n return \"Hello World!\"; // baru mengembalikan nilai\n }", "private function callBot(): string\n {\n $owner_id = null;\n $user_id = $this->info['user_id'];\n $username = $this->info['user_username'];\n $first_name = $this->info['user_first_name'];\n\n switch ( true ) {\n // Help file\n case preg_match( '/\\b(' . $this->lang['command']['help'] . ')\\b/iu', $this->info['msg_text'] ):\n $path = $_SERVER['DOCUMENT_ROOT'] . $this->lang['respond']['help_file'];\n $tmpl = file_get_contents( $path, true );\n $karma_plus = $this->lang['command']['karma_plus'][0];\n $lies = $this->lang['command']['lies'][0];\n $find = [ \n '{{ url }}', '{{ bot_name }}', '{{ chat_name }}',\n '{{ ask_bio }}', '{{ save_bio }}', '{{ karma }}',\n '{{ add_sticker }}', '{{ add_set }}', '{{ my_stickers }}',\n '{{ all_stickers }}','{{ karma_plus }}','{{ karma_minus }}', \n '{{ lies }}', '{{ not_liar }}',\n ];\n $replace = [ \n 'url' => 'github.com/junkym0nk3y/TS-telegram-bot/',\n 'bot_name' => $this->bot['first_name'], \n 'chat_name' => $this->info['chat_title'],\n 'ask_bio' => $this->lang['command']['ask_bio'],\n 'save_bio' => $this->lang['command']['save_bio'], \n 'karma' => $this->lang['command']['karma'],\n 'add_sticker' => $this->lang['command']['add_sticker'],\n 'add_set' => $this->lang['command']['add_set'],\n 'my_stickers' => $this->lang['command']['my_stickers'],\n 'all_stickers' => $this->lang['command']['all_stickers'],\n 'karma_plus' => $karma_plus,\n 'karma_minus' => $this->lang['command']['karma_minus'][0],\n 'lies' => $lies,\n 'not_liar' => $this->lang['command']['not_liar'],\n ];\n return str_replace( $find, $replace, $tmpl );\n case preg_match( '/\\b(' . $this->lang['command']['karma'] . ')\\b/iu', $this->info['msg_text'] ):\n return $this->userKarma( $user_id, $username ); // Karma\n case preg_match( '/\\b(' . $this->lang['command']['ask_bio'] . ')\\b/iu', $this->info['msg_text'] ):\n return $this->userBio( $user_id, $username ); // Bio \n case preg_match( '/\\b(' . $this->lang['command']['add_set'] . ')\\b/iu', $this->info['msg_text'] ):\n $file = $_SERVER['DOCUMENT_ROOT'] . '/style/sticker_logo.png';\n $slugify = $this->slugifySet( $this->lang['command']['add_set'] );\n if ( mb_strlen($slugify[0]) < 4 ) {\n return $this->lang['respond']['sticker']['change_setname'];\n } else\n return $this->newStickerSet( $file, $slugify ); // Add new stickerset\n case preg_match( '/\\b(' . $this->lang['command']['add_sticker2'] . ')\\b/iu', $this->info['msg_text'] ):\n case preg_match( '/\\b(' . $this->lang['command']['add_sticker'] . ')\\b/iu', $this->info['msg_text'] ):\n return $this->lang['respond']['sticker']['noreply']; // Add new sticker \n case preg_match( '/\\b(' . $this->lang['command']['my_stickers'] . ')\\b/iu', $this->info['msg_text'] ):\n $owner_id = $user_id;\n case preg_match( '/\\b(' . $this->lang['command']['all_stickers'] . ')\\b/iu', $this->info['msg_text'] ):\n $sticker_list = $this->db->getStickerSets( $owner_id );\n if ( $sticker_list != 'no stickers' ){\n $list = '';\n foreach ( $sticker_list as $set ) {\n $find = [ '{{ url }}', '{{ title }}', '{{ total }}', '{{ owner }}', '{{ owner_id }}' ];\n $replace = [\n 'url' => 't.me/addstickers/' . $set['set_url'] . '_by_' . $this->bot['username'],\n 'title' => $set['set_title'], \n 'total' => $set['stickers'],\n 'owner' => $set['owner'],\n 'owner_id' => $set['owner_id'],\n ];\n $list .= str_replace( $find, $replace, $this->lang['respond']['sticker']['row'] );\n }\n return $this->lang['respond']['sticker']['find_sets'] . $list; // List of stickersets\n } else\n return $this->lang['respond']['sticker']['not_found']; \n case preg_match('/(\\w+) (==|===|!==|!=) (\\w+)/u', $this->info['msg_text'], $output_array);\n $random = mt_rand( 0, count($this->lang['dialog']['true_or_false']) -1 );\n return $this->lang['dialog']['true_or_false'][$random]; // True or false game\n case preg_match( '/\\b(' . $this->lang['command']['tanos'] . ')\\b/iu', $this->info['msg_text'] ):\n if ( !$this->is_admin )\n return $this->lang['respond']['not_admin'];\n\n $wait_for_collect = 60;\n $passed = $this->daysPassed( $this->db->botAddDate() );\n $days = $passed[0] . ' ' . $passed[1];\n $pattern = '/[^a-zа-яёй0-9\\@\\(\\)\\?\\,\\s\\-\\–\\.\\_\\!]/iu';\n $max_users = 70;\n $i = $to_kick = 0;\n $not_exist_users = [];\n $tmpl = $this->lang['respond']['tanos']['list'] . PHP_EOL;\n\n if ( $passed[0] <= $wait_for_collect ) {\n $find = [ '{{ days }}', '{{ wait_for_collect }}' ];\n $replace = compact( 'days', 'wait_for_collect' );\n return str_replace( $find, $replace, $this->lang['respond']['tanos']['wait_for_it'] );\n }\n\n $list = $this->db->getUsers( true, strtotime('-120 day') ); //('-1 day') );//\n\n if( $list == 'no users' )\n return $this->lang['respond']['tanos']['no_users'];\n\n $length = count( $list );\n\n foreach ( $list as $user_id => $username ) {\n $i++;\n $status = $this->tg->getStatus( $this->info['chat_id'], $user_id );\n\n switch ($status) {\n case 'administrator':\n break;\n case 'left':\n case 'kicked':\n case 'Bad Request: USER_ID_INVALID':\n $not_exist_users[] = $user_id;\n break;\n default:\n $to_kick++;\n $find = [ '{{ user_id }}', '{{ username }}' ];\n $replace = ['user_id' => $user_id, 'username' => preg_replace( $pattern, '', $username ) ];\n if ( $to_kick > 1 )\n $tmpl .= ', ';\n\n $tmpl .= str_replace( $find, $replace, $this->lang['respond']['tanos']['row'] );\n break; \n }\n \n if ( $to_kick == $max_users || $i == $length ){\n $this->db_post->kickUsers( $not_exist_users );\n \n if ( $to_kick == 0 )\n return $i . ' мёртвых душ было удалено';\n \n return $tmpl.$this->lang['respond']['tanos']['ask'];\n }\n }\n\n return 'всё пошло по пизде';\n // Bot dialogs\n case preg_match( '/\\b(' . $this->lang['dialog']['ask_1'] . ')\\b/iu', $this->info['msg_text'] ):\n return $this->lang['dialog']['answer_1'];\n case preg_match( '/\\b(' . $this->lang['dialog']['ask_2'] . ')\\b/iu', $this->info['msg_text'] ):\n return $this->lang['dialog']['answer_2'];\n case preg_match( '/\\b(' . $this->lang['dialog']['ask_3'] . ')\\b/iu', $this->info['msg_text'] ):\n case preg_match( '/\\b(' . $this->lang['dialog']['ask_4'] . ')\\b/iu', $this->info['msg_text'] ):\n return $this->lang['dialog']['answer_3_4'];\n case preg_match( '/\\b(' . $this->lang['command']['ping'] . ')\\b/iu', $this->info['msg_text'] ):\n $passed = $this->daysPassed( $this->db->botAddDate() );\n $days = $passed[0] . ' ' . $passed[1];\n $bot_name = $this->bot['first_name'];\n $help = $this->lang['command']['help'];\n $find = [ '{{ username }}', '{{ days }}', '{{ bot_name }}', '{{ help }}' ];\n $replace = compact( 'username', 'days', 'bot_name', 'help' );\n $find = [ '{{ user_id }}', '{{ username }}', '{{ days }}', '{{ bot_name }}', '{{ help }}' ];\n $replace = compact( 'user_id', 'username', 'days', 'bot_name', 'help' );\n return str_replace( $find, $replace, $this->lang['respond']['hello'] );\n default:\n exit('ok');\n }\n }", "public function execute()\n {\n $message = $this->getMessage(); // Get Message object\n\n $chat_id = $message->getChat()->getId(); // Get the current Chat ID\n $from_id = $message->getFrom()->getId();\n $nama = $message->getFrom()->getFirstName().' '.$message->getFrom()->getLastName();\n $id = trim($message->getText(true));\n \n Request::sendChatAction([\n 'chat_id' => $chat_id,\n 'action' => 'typing'\n ]);\n \n // $auth = $pdo->query(\"select is_ban from user where teleid = '$chat_id'\")->fetchColumn();\n \n // if($auth == 1){\n \n // $text = \"Maaf anda tidak memiliki akses\";\n // $kirimpesan = [\n // 'chat_id' => $chat_id,\n // 'text' => $text\n // ];\n \n // return Request::sendMessage($kirimpesan);\n // } \n \n if($id === ''){\n \n<<<<<<< HEAD\n $data = file_get_contents('http://ilkomunnes.000webhostapp.com/api/info/all/APIKEY');\n=======\n $data = file_get_contents('http://ilkomunnes.000webhostapp.com/api/info/all/{APIKEY}');\n>>>>>>> Update db, jadwal, etc\n $decdata = json_decode($data, true);\n \n $koneksi = $decdata['koneksi'];\n $status = $decdata['status'];\n $info = $decdata['data'];\n \n if($koneksi == true){\n \n if($status == 'Success'){\n \n $text = \"Hai $nama. Berikut ini adalah info-info yang ada\\n\\n\";\n $i = 1;\n foreach ($info as $datainfo) :\n $text .= \"<b>$i. \" . $datainfo['judul'] . \"\\n</b>\";\n $text .= \"Pada \" . $datainfo['date'] . \" WIB\\n\";\n $text .= \"Selengkapnya ketik : <b>/info \".$datainfo['id'].\"</b>\\n\\n\";\n $i++;\n endforeach;\n $text .= \"\\n\\nTambah info dengan perintah /addinfo\";\n \n $kirimpesan = [\n 'chat_id' => $chat_id,\n 'parse_mode' => 'HTML',\n 'text' => $text\n ];\n \n return Request::sendMessage($kirimpesan); \n \n \n }\n \n if($status == 'NotFound'){\n \n $text = \"Hai $nama. Tidak ada info untuk saat ini.\";\n $text .= \"\\n\\nTambah info dengan perintah /addinfo\";\n \n $kirimpesan = [\n 'chat_id' => $chat_id,\n 'parse_mode' => 'HTML',\n 'text' => $text\n ];\n \n return Request::sendMessage($kirimpesan); \n }\n }\n \n if($koneksi == false){\n \n $text = \"Hai $nama. Terjadi kesalahan dalam <b>pengambilan data</b>. Silahkan coba beberapa saat lagi.\";\n $text .= \"\\n\\nTambah info dengan perintah /addinfo\";\n \n $kirimpesan = [\n 'chat_id' => $chat_id,\n 'parse_mode' => 'HTML',\n 'text' => $text\n ];\n \n return Request::sendMessage($kirimpesan);\n }\n \n }\n \n else {\n \n<<<<<<< HEAD\n $data = file_get_contents('http://ilkomunnes.000webhostapp.com/api/info/'.$id.'/APIKEY');\n=======\n $data = file_get_contents('http://ilkomunnes.000webhostapp.com/api/info/'.$id.'/{APIKEY}');\n>>>>>>> Update db, jadwal, etc\n $decdata = json_decode($data, true);\n \n $koneksi = $decdata['koneksi'];\n $status = $decdata['status'];\n $info = $decdata['data'][0];\n \n if($koneksi == true){\n \n if($status == 'Success'){\n \n $text .= \"<b>\" . $info['judul'] . \"\\n</b>\";\n $text .= \"Pada \" . $info['date'] . \" WIB\\n\\n\";\n $text .= $info['pesan'].\"\\n\\n\";\n $text .= \"Diposting oleh : \" . $info['dari'];\n \n $kirimpesan = [\n 'chat_id' => $chat_id,\n 'parse_mode' => 'HTML',\n 'text' => $text\n ];\n \n return Request::sendMessage($kirimpesan); \n \n \n }\n \n if($status == 'NotFound'){\n \n $text = \"Hai $nama. Info tidak ditemukan. Pastikan menggunakan perintah dibawah ini\\n\\n\";\n $text .= $this->getUsage();\n \n $kirimpesan = [\n 'chat_id' => $chat_id,\n 'parse_mode' => 'HTML',\n 'text' => $text\n ];\n \n return Request::sendMessage($kirimpesan); \n }\n }\n \n if($koneksi == false){\n \n $text = \"Hai $nama. Terjadi kesalahan dalam <b>pengambilan data</b>. Silahkan coba beberapa saat lagi.\";\n \n $kirimpesan = [\n 'chat_id' => $chat_id,\n 'parse_mode' => 'HTML',\n 'text' => $text\n ];\n \n return Request::sendMessage($kirimpesan);\n }\n }\n\n \n }", "function conversation()\n {\n $data['scripts'] = array('jquery', 'bootstrap', 'lte', 'datepicker','cssMessagerie','tinyMCE' );\n\n // Creation du bandeau\n $data['titre'] = array(\"Messagerie\", \"fas fa-envelope\");\n \n // si la session est null c'est que l'utilisateur n'est pas connecté donc retour à la page de login\n if($_SESSION['dataUser'] == null)\n {\n redirect($this->dir_login);\n }\n else\n {\n //Permet de récupérer l'id de l'utilisateur de session\n $data['userId']=$_SESSION['dataUser'][0]->user_id;\n //Permet de créer les boutons dans le menu en header\n $data['boutons'] = array(\n array(\"Rafraichir\", \"fas fa-sync\", $this->dir_controlleur, null),\n array(\"Déconnexion\", \"fas fa-sign-out-alt\", $this->dir_login, null),\n array(\"Retour\", \"fa fa-arrow-left\", $this->dir_retour, null),\n );\n }\n\n //permet de savoir si une conversation est en cours\n $data['ActiveConv'] = true;\n\n //Permet de trier tous les utilisateurs à qui on a parler du plus récent au plus ancien\n $data['profils_envoyeur'] = $this->m_messagerie->get_id_profil_envoyeur($data['userId']);\n $x = 0;\n foreach ( $data['profils_envoyeur'] as $value) \n {\n $data['last_message'][$x] = $this->m_messagerie->get_last_message_profil($data['userId'],$data['profils_envoyeur'][$x]->message_id_envoyeur);\n $data['profils_envoyeur_name'][$x] = $this->m_messagerie->get_name_user($data['profils_envoyeur'][$x]->message_id_envoyeur);\n $x = $x + 1;\n }\n\n //on récupère l'id de la personne qui recoit\n $data['personne'] = $this->input->post('id_personne');\n\n \n if($data['personne'] == NULL )\n {\n $data['personne'] = $_SESSION['personne'];\n } else{\n $_SESSION['personne'] = $data['personne'];\n }\n \n //permet de récupérer tout les messages entre deux personnes et de les ajouter dans un tableau\n $data['conv'] = $this->m_messagerie->get_message_profil_envoyeur($data['userId'],$data['personne']);\n\n //Permet de récupérer les noms prénoms des deux utilisateurs\n $data['conv_name'] = $this->m_messagerie->get_name_user($data['userId']) ;\n $data['conv_name'] = $data['conv_name']->user_nom . \" \" . $data['conv_name']->user_prenom;\n if($data['conv'][0]->message_id_receveur == $data['userId'])\n {\n $data['conv_name1'] = $this->m_messagerie->get_name_user($data['conv'][0]->message_id_envoyeur);\n $data['conv_name1'] = $data['conv_name1']->user_nom . \" \" . $data['conv_name1']->user_prenom;\n } else\n {\n $data['conv_name1'] = $this->m_messagerie->get_name_user($data['conv'][0]->message_id_receveur);\n $data['conv_name1'] = $data['conv_name1']->user_nom . \" \" . $data['conv_name1']->user_prenom;\n }\n\n \n \n // On charge les differents modules neccessaires a l'affichage d'une page\n //$this->load->view('template/header_html_base', $data);\n $this->load->view('template/header_scripts', $data); \n $this->load->view('template/bandeau', $data);\n $this->load->view('template/footer_scripts', $data);\n $this->load->view('template/footer_html_base');\n $this->load->view('messagerie/editeur',$data);\n }", "public function talk();", "public function responseMsg()\n {\n\n include('ctr_user.php');\n function register($input, $openID){\n if(!$input){\n return -1;\n }else{\n $regData = explode(\"+\",$input);\n if (count($regData) <= 1){\n return 0;\n }else{\n $name = $regData[0];\n $id = $regData[1];\n $content = array(\n 'userID' => $id,\n 'ecardID' => $id,\n 'name' => $name,\n 'descri' => '',\n 'regTime' => time(),\n 'status' => 1);\n addNewUser($openID, $content);\n $fb = fopen('../database/debug.txt',\"a\");\n fputs($fb,date(\"m/d H:i:s\").\" Wechat $id|$name|$openID|$input <br>\");\n fclose($fb);\n return 1;\n }\n }\n }\n function transText($keyword, $fromUsername){\n // 不知道是否能调用同级函数中的include\n if($keyword==\"功能\" || $keyword==\"菜单\" || $keyword==\"m\" ){\n $transContent = array(\n 'type' => 'text',\n 'str' => \"请回复以下数字办理考研自习室业务:\\n 1.绑定帐号\\n 2.选座\\n 3.座位排队\\n 4.关注官方微博\\n(ฅ• . •ฅ)[测试消息,认真你就输辣]\\n警察蜀黍,就是他做的系统\\n zhangpeng96.com\"\n );\n // 以数组的形式返回数据的内容和类型,注意转义符需要用双引号\n }else if(strlen($keyword) < 2){\n\n $uid = getUserID($fromUsername);\n switch($keyword){\n case 1:\n $transContent = array(\n 'type' => 'text',\n 'str' => \"首次关注,请绑定信息。\\n发送 姓名+学号(如“张鹏+20140349”)绑定帐号。\"\n );\n break;\n case 2:\n $transContent = array(\n 'type' => 'text',\n 'str' => \"戳开链接:http://tikumm.duapp.com/select.php?uid=$uid\"\n );\n break;\n case 3:\n $transContent = array(\n 'type' => 'text',\n 'str' => \"戳开链接:http://tikumm.duapp.com/queue.php?uid=$uid\"\n );\n break; \n case 4:\n $transContent = array(\n 'type' => 'text',\n 'str' => \"戳开链接:http://weibo.com/u/5231945858\"\n );\n break;\n }\n }else{ \n switch(register($keyword, $fromUsername)){\n case 0:\n $transContent = array(\n 'type' => 'text',\n 'str' => '输入错误'\n );\n break;\n case 1:\n $transContent = array(\n 'type' => 'text',\n 'str' => '成功绑定!'\n ); \n break;\n }\n }\n return $transContent; \n }\n\n\n $postStr = $GLOBALS[\"HTTP_RAW_POST_DATA\"];\n //extract post data\n if (!empty($postStr)){\n /* libxml_disable_entity_loader is to prevent XML eXternal Entity Injection,\n the best way is to check the validity of xml by yourself */\n libxml_disable_entity_loader(true);\n $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);\n $fromUsername = $postObj->FromUserName;\n $toUsername = $postObj->ToUserName;\n $keyword = trim($postObj->Content);\n $textTpl = \"<xml>\n <ToUserName><![CDATA[%s]]></ToUserName>\n <FromUserName><![CDATA[%s]]></FromUserName>\n <CreateTime>%s</CreateTime>\n <MsgType><![CDATA[%s]]></MsgType>\n <Content><![CDATA[%s]]></Content>\n <FuncFlag>0</FuncFlag>\n </xml>\"; \n \n if(!empty( $keyword ))\n {\n $strData = transText($keyword, $fromUsername);\n $msgType = $strData['type'];\n $contentStr = $strData['str'];\n $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);\n echo $resultStr;\n }else{\n echo \"Input something...\";\n }\n\n }else {\n echo \"\";\n exit;\n }\n }", "function fechar_janela_conversa_chat(){\n\n// seta usuario de chat de sessao\n$_SESSION[CONFIG_MD5_IDUSUARIO_CHAT] = null;\n\n}", "function sendHeader() {\n\n\t\t$this->console_text('###############################################################################');\n\t\t$this->console_text(' XASECO2 v' . XASECO2_VERSION . ' running on {1}:{2}', $this->server->ip, $this->server->port);\n\t\t$this->console_text(' Name : {1} - {2}', stripColors($this->server->name, false), $this->server->serverlogin);\n\t\tif ($this->server->isrelay)\n\t\t\t$this->console_text(' Relays : {1} - {2}', stripColors($this->server->relaymaster['NickName'], false), $this->server->relaymaster['Login']);\n\t\t$this->console_text(' Game : {1} - {2} - {3}', $this->server->game,\n\t\t $this->server->packmask, $this->server->gameinfo->getMode());\n\t\t$this->console_text(' Version: {1} / {2}', $this->server->version, $this->server->build);\n\t\t$this->console_text(' Author : Xymph');\n\t\t$this->console_text('###############################################################################');\n\n\t\t// format the text of the message\n\t\t$startup_msg = formatText($this->getChatMessage('STARTUP'),\n\t\t XASECO2_VERSION,\n\t\t $this->server->ip, $this->server->port);\n\t\t// show startup message\n\t\t$this->client->query('ChatSendServerMessage', $this->formatColors($startup_msg));\n\t}", "public function botman()\n {\n $botman = app('botman');\n\n $botman->middleware->received(ApiAi::create(config('services.dialogflow.key'))->listenForAction());\n\n $botman->hears('{something}', __CLASS__ . '@telegram');\n\n $botman->listen();\n }", "public function run()\n {\n //系统参数\n $config = new Config();\n $config->name = \"易讯通\";\n $config->logo = \"logo.jpg\";\n $config->domain = \"http://push.4255.cn\";\n $config->assetsDomain = \"http://assets.4255.cn\";\n $config->tel = \"023-68089477\";\n $config->fax = \"023-68692402\";\n $config->email = \"[email protected]\";\n $config->qq = \"93894949\";\n $config->addres = \"重庆市九龙坡区奥体路1号\";\n\n $config->weixinToken = \"weiliwang\";\n $config->weixinAppID = \"wxbef7f5997ec1bc35\";\n $config->wexinAppSecret = \"295e036d992441a119f5976562a07347\";\n $config->wexinAES = \"lmQ9GJCK5CP0iMhrPCrWFZjOKYy5CgWIpVUOYn0TooR\";\n $config->payMchId = \"1314598001\";\n $config->payNotifyUrl = \"http://push.4255.cn/notice/wxpay\";\n $config->payKey = \"LKOP0987HYDRFS543AXCDE342WSKI87H\";\n\n $config->save();\n\n $enterprise = new Enterprise();\n $enterprise->name = \"重庆易游通科技有限公司\";\n $enterprise->shortName = \"易游通\";\n $enterprise->linkMan = \"吴红\";\n $enterprise->mobile = \"13983087661\";\n $enterprise->tel = \"023-68089455\";\n $enterprise->fax = \"023-68692402\";\n $enterprise->qq = \"93894949\";\n $enterprise->email = \"[email protected]\";\n $enterprise->addres = \"重庆市九龙坡区奥体路1号\";\n $enterprise->save();\n\n\n //用户\n $user = new User();\n $user->name = \"管理员\";\n $user->email = \"[email protected]\";\n $user->password = bcrypt('wuhong');\n $user->save();\n }", "public function responseMsg()\n {\n $postStr = $GLOBALS[\"HTTP_RAW_POST_DATA\"];\n $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);\n $fromUsername = $postObj->FromUserName;\n $toUsername = $postObj->ToUserName;\n $keyword = trim($postObj->Content);\n $time = time();\n $dbname = \"zhongwei\";\n $host = \"58.215.187.8\";\n $user = \"zhongwei\";\n $pass = \"623610577\";\n \n \n //如果是新关注用户\n if($postObj->Event == 'subscribe'){\n //send_back(MENU);\n $con = mysql_connect(\"$host\",\"$user\",\"$pass\");\n if (!$con)\n {\n die('Could not connect: ' . mysql_error());\n }\n mysql_select_db(\"$dbname\", $con);\n $result = mysql_query(\"SELECT s.*,sf.* FROM uchome_space s LEFT JOIN uchome_spacefield sf ON s.uid=sf.uid WHERE s.wxkey='\".$toUsername.\"' \");\n mysql_query(\"SET NAMES 'utf8'\");\n if($row = mysql_fetch_array($result)){\n \n \n \n $v5 = mysql_query(\"SELECT a.*,m.* FROM uchome_appset a LEFT JOIN uchome_menuset m ON a.num=m.menusetid WHERE a.uid='$row[uid]' and a.appstatus='1'\");\n while($v52= mysql_fetch_array($v5)){\n $a[] = \"$v52[num]\";\n $b[] = \"$v52[subject]\";\n\n }\n \n \n $msgType = \"news\";\n if($row[name]){\n $name=$row[name];\n }else{\n $name=$row[username];\n }\n $appurl = \"http://v5.home3d.cn/home/capi/space.php?do=app&uid=$row[uid]\";\n $app = file_get_contents($appurl,0,null,null);\n $app_output = json_decode($app);\n $count=$app_output->data->count;\n $zhong2 = mysql_query(\"SELECT * FROM uchome_weixinmenutop WHERE uid='$row[uid]' and type='image'\");\n $wei2 = mysql_fetch_array($zhong2);\n if($wei2){\n $name=$wei2[name];\n if($wei2['recommendlink']){\n $url = \"$wei2[recommendlink]\"; \n }else{\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=home&uid=\".$row[uid];\n }\n $pic = \"http://v5.home3d.cn/home/\".$wei2[imageurl];\n $articles[] = makeArticleItem($name, $name, $pic, $url);\n $result1 = mysql_query(\"SELECT * FROM uchome_weixinmenutop WHERE uid='$row[uid]' and type='frist' \");\n $result2 = mysql_query(\"SELECT * FROM uchome_weixinmenutop WHERE uid='$row[uid]' and type='second' \");\n mysql_query(\"SET NAMES 'utf8'\");\n if($weixin = mysql_fetch_array($result1)){\n $wei=explode(\".\",$weixin['number']);\n $url1 = \"http://v5.home3d.cn/home/capi/space.php?do=$wei[0]&uid=$row[uid]&id=$wei[1]\";\n $app = file_get_contents($url1,0,null,null);\n $app_output = json_decode($app);\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&id=\".$wei[1].\"&wxkey=\".$fromUsername.\"&uid=$row[uid]&idtype=\".$wei[0].\"id&type=\".$wei[0].\"&moblieclicknum=$row[moblieclicknum]\";\n if($wei[0]==\"introduce\"){\n $subject=$app_output->data->introduce->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->introduce->image1url;\n }elseif($wei[0]==\"product\"){\n $subject=$app_output->data->product->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->product->image1url;\n }elseif($wei[0]==\"industry\"){\n $subject=$app_output->data->industry->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->industry->image1url;\n }elseif($wei[0]==\"cases\"){\n $subject=$app_output->data->cases->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->cases->image1url;\n }elseif($wei[0]==\"job\"){\n $subject=$app_output->data->job->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->job->image1url;\n }elseif($wei[0]==\"development\"){\n $subject=$app_output->data->development->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->development->image1url;\n }elseif($wei[0]==\"branch\"){\n $subject=$app_output->data->branch->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->branch->image1url;\n }elseif($wei[0]==\"goods\"){\n $subject=$app_output->data->goods->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->goods->image1url;\n }\n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n }\n \n if($weixin = mysql_fetch_array($result2)){\n $wei=explode(\".\",$weixin['number']);\n $url1 = \"http://v5.home3d.cn/home/capi/space.php?do=$wei[0]&uid=$row[uid]&id=$wei[1]\";\n $app = file_get_contents($url1,0,null,null);\n $app_output = json_decode($app);\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&wxkey=\".$fromUsername.\"&id=\".$wei[1].\"&uid=$row[uid]&idtype=\".$wei[0].\"id&type=\".$wei[0].\"&moblieclicknum=$row[moblieclicknum]\";\n if($wei[0]==\"introduce\"){\n $subject=$app_output->data->introduce->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->introduce->image1url;\n }elseif($wei[0]==\"product\"){\n $subject=$app_output->data->product->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->product->image1url;\n }elseif($wei[0]==\"industry\"){\n $subject=$app_output->data->industry->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->industry->image1url;\n }elseif($wei[0]==\"cases\"){\n $subject=$app_output->data->cases->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->cases->image1url;\n }elseif($wei[0]==\"job\"){\n $subject=$app_output->data->job->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->job->image1url;\n }elseif($wei[0]==\"development\"){\n $subject=$app_output->data->development->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->development->image1url;\n }elseif($wei[0]==\"branch\"){\n $subject=$app_output->data->branch->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->branch->image1url;\n }elseif($wei[0]==\"goods\"){\n $subject=$app_output->data->goods->subject;\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->goods->image1url;\n }\n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n \n }\n }else{\n $appurl = \"http://v5.home3d.cn/home/capi/space.php?do=app&uid=$row[uid]\";\n $app = file_get_contents($appurl,0,null,null);\n $app_output = json_decode($app);\n $count=$app_output->data->count;\n $zhong2 = mysql_query(\"SELECT * FROM uchome_recommend WHERE uid='$row[uid]'\");\n $wei2 = mysql_fetch_array($zhong2);\n $name=$wei2[subject];\n if($wei2['recommendlink']){\n $url = \"$wei2[recommendlink]\"; \n }else{\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=home&uid=\".$row[uid];\n }\n $pic = \"http://v5.home3d.cn/home/\".$wei2['imageurl'];\n $articles[] = makeArticleItem($name, $name, $pic, $url);\n for($i=0;$i<$count;$i++){\n $url = \"http://v5.home3d.cn/home/wx/wx.php?uid=$row[uid]&do=feed&num=rand()&wxkey=\".$fromUsername.\"&uid=\".$row[uid].\"&idtype=\".$app_output->data->app[$i]->english;\n if($app_output->data->app[$i]->newname){\n $subject=$app_output->data->app[$i]->newname;\n }else{\n $subject=$app_output->data->app[$i]->subject;\n }\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->app[$i]->image1url;\n\n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n } \n \n if($app_output->data->highapp){\n $url = \"http://v5.home3d.cn/home/wx/wx.php?uid=$row[uid]&do=feed&num=rand()&wxkey=\".$fromUsername.\"&uid=\".$row[uid].\"&idtype=\".$app_output->data->highapp[0]->english;\n if($app_output->data->highapp[0]->newname){\n $subject=$app_output->data->highapp[0]->newname;\n }else{\n $subject=$app_output->data->highapp[0]->subject;\n }\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->highapp[0]->image1url;\n\n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n }\n }\n $resultStr = makeArticles($fromUsername, $toUsername, $time, $msgType, $name,$articles); \n echo $resultStr;\n include_once( 'weibo/config.php' );\n require_once '../common.php';\n require_once 'wx_common.php';\n include_once( CONNECT_ROOT.'/saetv2.ex.class.php' );\n require_once CONNECT_ROOT.\"/common/jtee.inc.php\";\n require_once CONNECT_ROOT.\"/common/siteUserRegister.class.php\";\n require_once('Weixin.class.php');\n $rst = mysql_query(\"SELECT * FROM uchome_wxkey WHERE wxkey='$fromUsername'\");\n $row1 = mysql_fetch_array($rst);\n $rst1 = mysql_query(\"SELECT * FROM uchome_space WHERE wxkey='$fromUsername'\");\n $row2 = mysql_fetch_array($rst1);\n if($row1||$row2){\n loaducenter();\n //showmessage(\"$row[uid]\");\n //include_once(S_ROOT.'./source/function_cp.php');\n //updateuserstat('hot');\n if($row1){\n $user = uc_get_user($row1['uid'], 1); \n uc_user_synlogin($row1['uid']); \n }\n if($row2){\n $user = uc_get_user($row2['uid'], 1); \n uc_user_synlogin($row2['uid']); \n } \n \n $auth = setSession($user[0],$user[1]);\n $weixinuid=$row['uid'];\n $m_auth=rawurlencode($auth);\n $friendurl = \"http://v5.home3d.cn/home/capi/cp.php?ac=friend&op=add&uid=$weixinuid&gid=0&addsubmit=true&note=微信用户关注&m_auth=$m_auth\";\n $friend = file_get_contents($friendurl,0,null,null);\n $friend_output = json_decode($friend);\n \n \n }else{\n //include_once(S_ROOT.'./source/function_cp.php');\n //updateuserstat('hot');\n $nextuid=$row['uid'];\n $d = get_obj_by_xiaoquid($nextuid);\n $info = $d->getNewWXUser(); \n $fakeid=$info['id'];\n $query = mysql_query(\"SELECT * FROM uchome_space WHERE fakeid='$fakeid'\");\n $value = mysql_fetch_array($query);\n if($value){\n loaducenter();\n //include_once(S_ROOT.'./source/function_cp.php');\n //updateuserstat('hot'); \n $user = uc_get_user($value['uid'], 1); \n uc_user_synlogin($value['uid']);\n $auth = setSession($user[0],$user[1]);\n $weixinuid=$row['uid'];\n $m_auth=rawurlencode($auth);\n $friendurl = \"http://v5.home3d.cn/home/capi/cp.php?ac=friend&op=add&uid=$weixinuid&gid=0&addsubmit=true&note=微信用户关注&m_auth=$m_auth\";\n $friend = file_get_contents($friendurl,0,null,null);\n $friend_output = json_decode($friend);\n inserttable(\"wxkey\",array('wxkey'=>$fromUsername,'fakeid'=>$fakeid,'uid'=>$value['uid']));\n\n }else{\n $username =$fromUsername;\n $name = $fromUsername;\n $password = \"weixin\";\n $email = isemail($_REQUEST['email']) ? $_REQUEST['email'] : $username.\"@v5.com.cn\";\n $data = array();\n require_once CONNECT_ROOT.\"/common/siteUserRegister.class.php\";\n $regClass = new siteUserRegister();\n $uid = $regClass->reg($username, $email, $password);\n \n $nextuid=$row['uid'];\n $d = get_obj_by_xiaoquid($nextuid);\n $info = $d->getNewWXUser(); \n $setarr = array(\n 'name' => $info['nick_name'],\n 'fakeid'=>$info['id'],\n 'namestatus' => '1',\n 'wxkey' => $fromUsername,\n 'fatheruid'=>$nextuid\n );\n updatetable('space', $setarr, array('uid'=>$uid ));\n loaducenter();\n $user = uc_get_user($uid, 1); \n uc_user_synlogin($uid);\n $weixinuid=$row['uid'];\n $auth = setSession($user[0],$user[1]);\n $friendurl = \"http://v5.home3d.cn/home/capi/cp.php?ac=friend&op=add&uid=$row[uid]&gid=0&addsubmit=true&note=微信用户关注&m_auth=$m_auth\";\n $friend = file_get_contents($friendurl,0,null,null);\n $friend_output = json_decode($friend);\n }\n }\n \n\n \n \n }else{\n $contentStr.=\"未填写微信id\";\n $msgType = \"text\";\n $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);\n echo $resultStr;\n }\n }\n\n //extract post data\n if (!empty($postStr)){\n \n $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);\n $fromUsername = $postObj->FromUserName;\n $toUsername = $postObj->ToUserName;\n $keyword = trim($postObj->Content);\n $time = time();\n $eventkey=$postObj->EventKey;\n\n //判断是否已经有帐号\n $textTpl = \"<xml>\n <ToUserName><![CDATA[%s]]></ToUserName>\n <FromUserName><![CDATA[%s]]></FromUserName>\n <CreateTime>%s</CreateTime>\n <MsgType><![CDATA[%s]]></MsgType>\n <Content><![CDATA[%s]]></Content>\n <FuncFlag>0</FuncFlag>\n </xml>\"; \n\n $con = mysql_connect(\"$host\",\"$user\",\"$pass\");\n if (!$con)\n {\n die('Could not connect: ' . mysql_error());\n }\n mysql_select_db(\"$dbname\", $con);\n $result = mysql_query(\"SELECT s.*,sf.* FROM uchome_space s LEFT JOIN uchome_spacefield sf ON s.uid=sf.uid WHERE s.wxkey='\".$toUsername.\"' \");\n mysql_query(\"SET NAMES 'utf8'\");\n if($row = mysql_fetch_array($result)){\n if($eventkey){\n $msgType = \"news\";\n $wei=explode(\".\",$eventkey);\n if($wei[0]==\"introduce\"){\n if($wei[1]=='0'){\n $zhong2 = mysql_query(\"SELECT * FROM uchome_recommend WHERE uid='$row[uid]'\");\n $wei2 = mysql_fetch_array($zhong2);\n $name=$wei2[subject];\n if($wei2['recommendlink']){\n $url = \"$wei2[recommendlink]\"; \n }else{\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=home&uid=\".$row[uid];\n }\n $pic = \"http://v5.home3d.cn/home/\".$wei2[imageurl];\n $articles[] = makeArticleItem($name, $name, $pic, $url);\n $table=\"uchome_introduce\";\n $query = mysql_query(\"SELECT * FROM \".$table.\" WHERE uid=$row[uid] limit 0,3\");\n while($value = mysql_fetch_array($query)){\n $subject=$value['subject'];\n $pic =\"http://v5.home3d.cn/home/\".$value['image1url'];\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&id=$value[introduceid]&uid=$row[uid]&viewuid=$row[uid]&wxkey=\".$fromUsername.\"&idtype=introduceid&type=introduce&moblieclicknum=$row[moblieclicknum]\"; \n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n }\n }else{\n $url1 = \"http://v5.home3d.cn/home/capi/space.php?do=$wei[0]&uid=$row[uid]&id=$wei[1]\";\n $app = file_get_contents($url1,0,null,null);\n $app_output = json_decode($app);\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&id=\".$wei[1].\"&uid=$row[uid]&viewuid=$row[uid]&wxkey=\".$fromUsername.\"&idtype=\".$wei[0].\"id&type=\".$wei[0].\"&moblieclicknum=$row[moblieclicknum]\";\n $subject=$app_output->data->introduce->subject;\n $message1=$app_output->data->introduce->message1;\n //$message1=strtolower($message1);\n preg_match_all(\"<img src=\\\"(.*)\\\">\",$message1,$matches);\n $message2=strip_tags($message1);\n $message2 = str_replace(\"&nbsp;\",\"\",$message2);\n $arr = explode(\"。\",$message2);\n $arr1 = explode(\".\",$arr[0]);\n $message2 =$arr1[0].\"...\";\n /* $pic = $matches[1][0];*/\n /* if($app_output->data->introduce->pic){\n $pic =\"http://v5.home3d.cn/home/attachment/\".$app_output->data->introduce->pic;\n $pic = str_replace(\"http://v5.home3d.cn/home/http://v5.home3d.cn/home/attachment/\",\"http://v5.home3d.cn/home/attachment/\",$pic);\n $pic = str_replace(\"http://v5.home3d.cn/home/attachment/http://v5.home3d.cn/home/\",\"http://v5.home3d.cn/home/\",$pic);\n $pic = str_replace(\"http://v5.home3d.cn/home/attachment/attachment/\",\"http://v5.home3d.cn/home/attachment/\",$pic);\n }else{\n $pic=\"\";\n }*/\n $pic=\"http://v5.home3d.cn/home/\".$app_output->data->introduce->imageurl;\n $pic = str_replace(\" \",\"%20\",$pic);\n $articles[] = makeArticleItem($subject, $message2, $pic, $url); \n }\n $resultStr = makeArticles($fromUsername, $toUsername, $time, $msgType, $name,$articles); \n echo $resultStr;\n }elseif($wei[0]==\"branch\"){\n if($wei[1]=='0'){\n $zhong2 = mysql_query(\"SELECT * FROM uchome_recommend WHERE uid='$row[uid]'\");\n $wei2 = mysql_fetch_array($zhong2);\n $name=$wei2[subject];\n if($wei2['recommendlink']){\n $url = \"$wei2[recommendlink]\"; \n }else{\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=home&uid=\".$row[uid];\n }\n $pic = \"http://v5.home3d.cn/home/\".$wei2[imageurl];\n $articles[] = makeArticleItem($name, $name, $pic, $url);\n $table=\"uchome_branch\";\n $query = mysql_query(\"SELECT * FROM \".$table.\" WHERE uid=$row[uid] limit 0,3\");\n while($value = mysql_fetch_array($query)){\n $subject=$value['subject'];\n $pic =\"http://v5.home3d.cn/home/\".$value['image1url'];\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&viewuid=$row[uid]&id=$value[branchid]&uid=$row[uid]&wxkey=\".$fromUsername.\"&idtype=branchid&type=branch&moblieclicknum=$row[moblieclicknum]\"; \n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n }\n }else{\n $url1 = \"http://v5.home3d.cn/home/capi/space.php?do=branch&uid=$row[uid]&id=$wei[1]\";\n $app = file_get_contents($url1,0,null,null);\n $app_output = json_decode($app);\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&id=\".$wei[1].\"&wxkey=\".$fromUsername.\"&uid=$row[uid]&viewuid=$row[uid]&idtype=branchid&type=branch&moblieclicknum=$row[moblieclicknum]\";\n $subject=$app_output->data->branch->subject;\n $message1=$app_output->data->branch->message1;\n preg_match_all(\"<img src=\\\"(.*)\\\">\",$message1,$matches);\n $message2=strip_tags($message1);\n $message2 = str_replace(\"&nbsp;\",\"\",$message2);\n $arr = explode(\"。\",$message2);\n $arr1 = explode(\".\",$arr[0]);\n $message2 =$arr1[0].\"...\";\n //$pic = $matches[1][0];\n /*if($app_output->data->branch->pic){\n $pic =\"http://v5.home3d.cn/home/\".$app_output->data->branch->pic;\n $pic = str_replace(\"http://v5.home3d.cn/home/http://v5.home3d.cn/home/\",\"http://v5.home3d.cn/home/\",$pic);\n }else{\n $pic=\"\";\n }*/\n $pic =\"http://v5.home3d.cn/home/\".$app_output->data->branch->imageurl;\n $pic = str_replace(\" \",\"%20\",$pic);\n /* if($app_output->data->branch->pic){\n $pic =\"http://v5.home3d.cn/home/\".$app_output->data->branch->pic;\n }else{\n $pic=\"\";\n }*/\n $articles[] = makeArticleItem($subject, $message2, $pic, $url); \n }\n $resultStr = makeArticles($fromUsername, $toUsername, $time, $msgType, $name,$articles); \n echo $resultStr;\n } elseif($wei[0]==\"industry\"){\n if($wei[1]=='0'){\n $zhong2 = mysql_query(\"SELECT * FROM uchome_recommend WHERE uid='$row[uid]'\");\n $wei2 = mysql_fetch_array($zhong2);\n $name=$wei2[subject];\n if($wei2['recommendlink']){\n $url = \"$wei2[recommendlink]\"; \n }else{\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=home&uid=\".$row[uid];\n }\n $pic = \"http://v5.home3d.cn/home/\".$wei2[imageurl];\n $articles[] = makeArticleItem($name, $name, $pic, $url);\n $table=\"uchome_industry\";\n $query = mysql_query(\"SELECT * FROM \".$table.\" WHERE uid=$row[uid] limit 0,3\");\n while($value = mysql_fetch_array($query)){\n $subject=$value['subject'];\n $pic =\"http://v5.home3d.cn/home/\".$value['image1url'];\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&viewuid=$row[uid]&id=$value[industryid]&uid=$row[uid]&wxkey=\".$fromUsername.\"&idtype=industryid&type=industry&moblieclicknum=$row[moblieclicknum]\"; \n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n }\n }else{\n $url1 = \"http://v5.home3d.cn/home/capi/space.php?do=industry&wxkey=\".$fromUsername.\"&uid=$row[uid]&id=$wei[1]\";\n $app = file_get_contents($url1,0,null,null);\n $app_output = json_decode($app);\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&id=\".$wei[1].\"&uid=$row[uid]&viewuid=$row[uid]&idtype=industryid&type=industry&moblieclicknum=$row[moblieclicknum]\";\n $subject=$app_output->data->industry->subject;\n $message1=$app_output->data->industry->message1;\n $message1=strtolower($message1);\n preg_match_all(\"<img src=\\\"(.*)\\\">\",$message1,$matches);\n $message2=strip_tags($message1);\n $message2 = str_replace(\"&nbsp;\",\"\",$message2);\n $arr = explode(\"。\",$message2);\n $arr1 = explode(\".\",$arr[0]);\n $message2 =$arr1[0].\"...\";\n //$pic = $matches[1][0];\n /* if($app_output->data->industry->pic){\n $pic =\"http://v5.home3d.cn/home/\".$app_output->data->industry->pic;\n $pic = str_replace(\"http://v5.home3d.cn/home/http://v5.home3d.cn/home/\",\"http://v5.home3d.cn/home/\",$pic);\n }else{\n $pic=\"\";\n }*/\n $pic =\"http://v5.home3d.cn/home/\".$app_output->data->industry->imageurl;\n $pic = str_replace(\" \",\"%20\",$pic);\n /* if($app_output->data->industry->pic){\n $pic =\"http://v5.home3d.cn/home/\".$app_output->data->industry->pic;\n }else{\n $pic=\"\";\n }*/\n $articles[] = makeArticleItem($subject, $message2, $pic, $url);\n } \n $resultStr = makeArticles($fromUsername, $toUsername, $time, $msgType, $name,$articles); \n echo $resultStr;\n } elseif($wei[0]==\"job\"){\n if($wei[1]=='0'){\n $zhong2 = mysql_query(\"SELECT * FROM uchome_recommend WHERE uid='$row[uid]'\");\n $wei2 = mysql_fetch_array($zhong2);\n $name=$wei2[subject];\n if($wei2['recommendlink']){\n $url = \"$wei2[recommendlink]\"; \n }else{\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=home&uid=\".$row[uid];\n }\n $pic = \"http://v5.home3d.cn/home/\".$wei2[imageurl];\n $articles[] = makeArticleItem($name, $name, $pic, $url);\n $table=\"uchome_job\";\n $query = mysql_query(\"SELECT * FROM \".$table.\" WHERE uid=$row[uid] limit 0,3\");\n while($value = mysql_fetch_array($query)){\n $subject=$value['subject'];\n $pic =\"http://v5.home3d.cn/home/\".$value['image1url'];\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&viewuid=$row[uid]&id=$value[jobid]&uid=$row[uid]&wxkey=\".$fromUsername.\"&idtype=jobid&type=job&moblieclicknum=$row[moblieclicknum]\"; \n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n }\n }else{\n $url1 = \"http://v5.home3d.cn/home/capi/space.php?do=job&uid=$row[uid]&id=$wei[1]\";\n $app = file_get_contents($url1,0,null,null);\n $app_output = json_decode($app);\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&viewuid=$row[uid]&id=\".$wei[1].\"&wxkey=\".$fromUsername.\"&uid=$row[uid]&idtype=jobid&type=job&moblieclicknum=$row[moblieclicknum]\";\n $subject=$app_output->data->job->subject;\n $message1=$app_output->data->industry->message1;\n $message1=strtolower($message1);\n $message2=strip_tags($message1);\n $message2 = str_replace(\"&nbsp;\",\"\",$message2);\n $arr = explode(\"。\",$message2);\n $arr1 = explode(\".\",$arr[0]);\n $message2 =$arr1[0].\"...\";\n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n }\n $resultStr = makeArticles($fromUsername, $toUsername, $time, $msgType, $name,$articles); \n echo $resultStr;\n } elseif($wei[0]==\"product\"){\n if($wei[1]=='0'){\n $zhong2 = mysql_query(\"SELECT * FROM uchome_recommend WHERE uid='$row[uid]'\");\n $wei2 = mysql_fetch_array($zhong2);\n $name=$wei2[subject];\n if($wei2['recommendlink']){\n $url = \"$wei2[recommendlink]\"; \n }else{\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=home&uid=\".$row[uid];\n }\n $pic = \"http://v5.home3d.cn/home/\".$wei2[imageurl];\n $articles[] = makeArticleItem($name, $name, $pic, $url);\n $table=\"uchome_product\";\n $query = mysql_query(\"SELECT * FROM \".$table.\" WHERE uid=$row[uid] limit 0,3\");\n while($value = mysql_fetch_array($query)){\n $subject=$value['subject'];\n $pic =\"http://v5.home3d.cn/home/\".$value['image1url'];\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&viewuid=$row[uid]&id=$value[productid]&uid=$row[uid]&wxkey=\".$fromUsername.\"&idtype=productid&type=product&moblieclicknum=$row[moblieclicknum]\"; \n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n }\n }else{\n $url1 = \"http://v5.home3d.cn/home/capi/space.php?do=product&uid=$row[uid]&id=$wei[1]\";\n $app = file_get_contents($url1,0,null,null);\n $app_output = json_decode($app);\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&viewuid=$row[uid]&id=\".$wei[1].\"&wxkey=\".$fromUsername.\"&uid=$row[uid]&idtype=productid&type=product&moblieclicknum=$row[moblieclicknum]\";\n $subject=$app_output->data->product->subject;\n $message1=$app_output->data->product->message1;\n preg_match_all(\"<src=\\\"(.*)\\\">\",$message1,$matches);\n $message2=strip_tags($message1);\n $message2 = str_replace(\"&nbsp;\",\"\",$message2);\n $arr = explode(\"。\",$message2);\n $arr1 = explode(\".\",$arr[0]);\n $message2 =$arr1[0].\"...\";\n //$pic = $matches[1][0];\n /*if($app_output->data->product->pic){\n $pic =\"http://v5.home3d.cn/home/\".$app_output->data->product->pic;\n $pic = str_replace(\"http://v5.home3d.cn/home/http://v5.home3d.cn/home/\",\"http://v5.home3d.cn/home/\",$pic);\n }else{\n $pic=\"\";\n }*/\n $pic =\"http://v5.home3d.cn/home/\".$app_output->data->product->imageurl;\n $pic = str_replace(\" \",\"%20\",$pic);\n $articles[] = makeArticleItem($subject, $message2, $pic, $url); \n }\n $resultStr = makeArticles($fromUsername, $toUsername, $time, $msgType, $name,$articles); \n echo $resultStr;\n }elseif($wei[0]==\"development\"){\n if($wei[1]=='0'){\n $zhong2 = mysql_query(\"SELECT * FROM uchome_recommend WHERE uid='$row[uid]'\");\n $wei2 = mysql_fetch_array($zhong2);\n $name=$wei2[subject];\n if($wei2['recommendlink']){\n $url = \"$wei2[recommendlink]\"; \n }else{\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=home&uid=\".$row[uid];\n }\n $pic = \"http://v5.home3d.cn/home/\".$wei2[imageurl];\n $articles[] = makeArticleItem($name, $name, $pic, $url);\n $table=\"uchome_development\";\n $query = mysql_query(\"SELECT * FROM \".$table.\" WHERE uid=$row[uid] limit 0,3\");\n while($value = mysql_fetch_array($query)){\n $subject=$value['subject'];\n $pic =\"http://v5.home3d.cn/home/\".$value['image1url'];\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&viewuid=$row[uid]&id=$value[developmentid]&uid=$row[uid]&wxkey=\".$fromUsername.\"&idtype=developmentid&type=development&moblieclicknum=$row[moblieclicknum]\"; \n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n }\n }else{\n $url1 = \"http://v5.home3d.cn/home/capi/space.php?do=development&uid=$row[uid]&id=$wei[1]\";\n $app = file_get_contents($url1,0,null,null);\n $app_output = json_decode($app);\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&viewuid=$row[uid]&id=\".$wei[1].\"&wxkey=\".$fromUsername.\"&uid=$row[uid]&idtype=developmentid&type=development&moblieclicknum=$row[moblieclicknum]\";\n $message1=$app_output->data->development->message1;\n preg_match_all(\"<img src=\\\"(.*)\\\">\",$message1,$matches);\n $message2=strip_tags($message1);\n $message2 = str_replace(\"&nbsp;\",\"\",$message2);\n $arr = explode(\"。\",$message2);\n $arr1 = explode(\".\",$arr[0]);\n $message2 =$arr1[0].\"...\";\n //$pic = $matches[1][0];\n /*if($app_output->data->development->pic){\n $pic =\"http://v5.home3d.cn/home/\".$app_output->data->development->pic;\n $pic = str_replace(\"http://v5.home3d.cn/home/http://v5.home3d.cn/home/\",\"http://v5.home3d.cn/home/\",$pic);\n }else{\n $pic=\"\";\n }*/\n $pic =\"http://v5.home3d.cn/home/\".$app_output->data->development->imageurl;\n $pic = str_replace(\" \",\"%20\",$pic);\n $subject=$app_output->data->development->subject;\n $articles[] = makeArticleItem($subject, $message2, $pic, $url); \n }\n $resultStr = makeArticles($fromUsername, $toUsername, $time, $msgType, $name,$articles); \n echo $resultStr;\n }elseif($wei[0]==\"goods\"){\n if($wei[1]=='0'){\n $zhong2 = mysql_query(\"SELECT * FROM uchome_recommend WHERE uid='$row[uid]'\");\n $wei2 = mysql_fetch_array($zhong2);\n $name=$wei2[subject];\n if($wei2['recommendlink']){\n $url = \"$wei2[recommendlink]\"; \n }else{\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=home&uid=\".$row[uid];\n }\n $pic = \"http://v5.home3d.cn/home/\".$wei2[imageurl];\n $articles[] = makeArticleItem($name, $name, $pic, $url);\n $table=\"uchome_goods\";\n $query = mysql_query(\"SELECT * FROM \".$table.\" WHERE uid=$row[uid] limit 0,3\");\n while($value = mysql_fetch_array($query)){\n $subject=$value['subject'];\n $pic =\"http://v5.home3d.cn/home/\".$value['image1url'];\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&viewuid=$row[uid]&id=$value[goodsid]&uid=$row[uid]&wxkey=\".$fromUsername.\"&idtype=goodsid&type=goods&moblieclicknum=$row[moblieclicknum]\"; \n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n }\n }else{\n $url1 = \"http://v5.home3d.cn/home/capi/space.php?do=goods&uid=$row[uid]&id=$wei[1]\";\n $app = file_get_contents($url1,0,null,null);\n $app_output = json_decode($app);\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&viewuid=$row[uid]&id=\".$wei[1].\"&wxkey=\".$fromUsername.\"&uid=$row[uid]&idtype=goodsid&type=goods&moblieclicknum=$row[moblieclicknum]\";\n $subject=$app_output->data->goods->subject;\n $message1=$app_output->data->goods->message1;\n preg_match_all(\"<img src=\\\"(.*)\\\">\",$message1,$matches);\n $message2=strip_tags($message1);\n $message2 = str_replace(\"&nbsp;\",\"\",$message2);\n $arr = explode(\"。\",$message2);\n $arr1 = explode(\".\",$arr[0]);\n $message2 =$arr1[0].\"...\";\n /*$pic = $matches[1][0];*/\n /* if($app_output->data->goods->pic){\n $pic =\"http://v5.home3d.cn/home/\".$app_output->data->goods->pic;\n $pic = str_replace(\"http://v5.home3d.cn/home/http://v5.home3d.cn/home/\",\"http://v5.home3d.cn/home/\",$pic);\n }else{\n $pic=\"\";\n }*/\n $pic =\"http://v5.home3d.cn/home/\".$app_output->data->goods->imageurl;\n $pic = str_replace(\" \",\"%20\",$pic);\n /*if($app_output->data->goods->pic){\n $pic =\"http://v5.home3d.cn/home/\".$app_output->data->goods->pic;\n }else{\n $pic=\"\";\n }*/\n $articles[] = makeArticleItem($subject, $message2, $pic, $url); \n }\n $resultStr = makeArticles($fromUsername, $toUsername, $time, $msgType, $name,$articles); \n echo $resultStr;\n } elseif($wei[0]==\"cases\"){\n if($wei[1]=='0'){\n $zhong2 = mysql_query(\"SELECT * FROM uchome_recommend WHERE uid='$row[uid]'\");\n $wei2 = mysql_fetch_array($zhong2);\n $name=$wei2[subject];\n if($wei2['recommendlink']){\n $url = \"$wei2[recommendlink]\"; \n }else{\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=home&uid=\".$row[uid];\n }\n $pic = \"http://v5.home3d.cn/home/\".$wei2[imageurl];\n $articles[] = makeArticleItem($name, $name, $pic, $url);\n $table=\"uchome_cases\";\n $query = mysql_query(\"SELECT * FROM \".$table.\" WHERE uid=$row[uid] limit 0,3\");\n while($value = mysql_fetch_array($query)){\n $subject=$value['subject'];\n $pic =\"http://v5.home3d.cn/home/\".$value['image1url'];\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&viewuid=$row[uid]&id=$value[casesid]&uid=$row[uid]&wxkey=\".$fromUsername.\"&idtype=casesid&type=cases&moblieclicknum=$row[moblieclicknum]\"; \n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n }\n }else{\n $url1 = \"http://v5.home3d.cn/home/capi/space.php?do=cases&uid=$row[uid]&id=$wei[1]\";\n $app = file_get_contents($url1,0,null,null);\n $app_output = json_decode($app);\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&viewuid=$row[uid]&id=\".$wei[1].\"&wxkey=\".$fromUsername.\"&uid=$row[uid]&idtype=casesid&type=cases&moblieclicknum=$row[moblieclicknum]\";\n $subject=$app_output->data->cases->subject;\n $message1=$app_output->data->cases->message1;\n preg_match_all(\"<img src=\\\"(.*)\\\">\",$message1,$matches);\n $message2=strip_tags($message1);\n $message2 = str_replace(\"&nbsp;\",\"\",$message2);\n $arr = explode(\"。\",$message2);\n $arr1 = explode(\".\",$arr[0]);\n $message2 =$arr1[0].\"...\";\n /* $pic = $matches[1][0];*/\n /*if($app_output->data->cases->pic){\n $pic =\"http://v5.home3d.cn/home/\".$app_output->data->cases->pic;\n $pic = str_replace(\"http://v5.home3d.cn/home/http://v5.home3d.cn/home/\",\"http://v5.home3d.cn/home/\",$pic);\n }else{\n $pic=\"\";\n }*/\n $pic =\"http://v5.home3d.cn/home/\".$app_output->data->cases->imageurl;\n\n $pic = str_replace(\" \",\"%20\",$pic); \n $articles[] = makeArticleItem($subject, $message2, $pic, $url); \n }\n $resultStr = makeArticles($fromUsername, $toUsername, $time, $msgType, $name,$articles); \n echo $resultStr;\n } \n \n \n\n \n }\n \n }else{\n $contentStr.=\"$toUsername\";\n $msgType = \"text\";\n $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);\n echo $resultStr;\n }\n \n \n if(!empty( $keyword ))\n { \n \n if ($keyword=='Hello2BizUser'){ \n \n $contentStr.=\"过期的通知方式\";\n \n \n \n \n \n \n \n \n $msgType = \"text\";\n \n $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);\n echo $resultStr;\n \n }elseif($keyword==\"绑定\"){\n $msgType = \"news\";\n $url = \"http://v5.home3d.cn/home/wx/wx.php?uid=$row[uid]&do=bind&num=rand()&wxkey=\".$fromUsername.\"&uid=\".$row[uid].\"\";\n $subject=\"输入帐号密码与微信进行绑定\";\n $pic = \"\";\n $articles[] = makeArticleItem($subject, $subject, $pic, $url);\n $resultStr = makeArticles($fromUsername, $toUsername, $time, $msgType, $name,$articles); \n echo $resultStr;\n }elseif($keyword==\"z\"){\n $msgType = \"text\";\n $contentStr.=\"$fromUsername\";\n $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);\n echo $resultStr;\n }elseif($keyword==\"w\"){\n $msgType = \"text\";\n $contentStr.=\"$toUsername\";\n $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);\n echo $resultStr;\n }else{\n $zhong = mysql_query(\"SELECT a.*,m.* FROM uchome_appset a LEFT JOIN uchome_menuset m ON a.num=m.menusetid WHERE a.uid='$row[uid]'and a.num='$keyword'\");\n $wei = mysql_fetch_array($zhong);\n \n $result = mysql_query(\"SELECT s.*,sf.* FROM uchome_space s LEFT JOIN uchome_spacefield sf ON s.uid=sf.uid WHERE s.wxkey='\".$toUsername.\"' \");\n $row = mysql_fetch_array($result);\n $msgType = \"news\";\n if($row[name]){\n $name=$row[name];\n }else{\n $name=$row[username];\n }\n $appurl = \"http://v5.home3d.cn/home/capi/space.php?do=app&uid=$row[uid]\";\n $app = file_get_contents($appurl,0,null,null);\n $app_output = json_decode($app);\n $count=$app_output->data->count;\n $zhong2 = mysql_query(\"SELECT * FROM uchome_recommend WHERE uid='$row[uid]'\");\n $wei2 = mysql_fetch_array($zhong2);\n $name=$wei2[subject];\n if($wei2['recommendlink']){\n $url = \"$wei2[recommendlink]\"; \n }else{\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=home&uid=\".$row[uid];\n }\n $pic = \"http://v5.home3d.cn/home/\".$wei2[imageurl];\n $articles[] = makeArticleItem($name, $name, $pic, $url);\n if($count>7){\n $count='7';\n $more='1';\n }\n for($i=0;$i<$count;$i++){ \n \n //$url = \"http://v5.home3d.cn/home/wx/wx.php?uid=$row[uid]&do=feed&num=rand()&wxkey=\".$fromUsername.\"&uid=\".$row[uid].\"&idtype=\".$app_output->data->app[$i]->english;\n $menusetcount=$app_output->data->app[$i]->count;\n if($menusetcount=='1'){\n $idtype=$app_output->data->app[$i]->english;\n $idtypeid=$idtype.\"id\";\n $table=\"uchome_\".$idtype;\n $query = mysql_query(\"SELECT * FROM \".$table.\" WHERE uid=$row[uid]\");\n $value = mysql_fetch_array($query);\n $id=$value[\"$idtypeid\"];\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&viewuid=$row[uid]&id=$id&uid=$row[uid]&wxkey=\".$fromUsername.\"&idtype=$idtypeid&type=$idtype&moblieclicknum=$row[moblieclicknum]\"; \n }else{\n $url = \"http://v5.home3d.cn/home/wx/wx.php?uid=$row[uid]&do=feed&num=rand()&wxkey=\".$fromUsername.\"&uid=\".$row[uid].\"&idtype=\".$app_output->data->app[$i]->english; \n }\n /* if($menusetcount=='1'){\n $url = \"http://v5.home3d.cn/home/wx/wx.php?uid=$row[uid]&do=feed&num=rand()&wxkey=\".$fromUsername.\"&uid=\".$row[uid].\"&idtype=\".$app_output->data->app[$i]->english;\n }else{\n $id=$app_output->data->app[$i]->id;\n $idtype=$app_output->data->app[$i]->english;\n $idtypeid=$idtype.\"id\";\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&id=$id&uid=$row[uid]&idtype=$idtypeid&type=$idtype&moblieclicknum=$row[moblieclicknum]\"; \n }*/\n if($app_output->data->app[$i]->newname){\n $subject=$app_output->data->app[$i]->newname;\n }else{\n $subject=$app_output->data->app[$i]->subject;\n }\n \n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->app[$i]->image1url;\n\n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n } \n \n if($app_output->data->highapp){\n $menusetcount=$app_output->data->highapp[$i]->count;\n if($menusetcount=='1'){\n $idtype=$app_output->data->highapp[$i]->english;\n $idtypeid=$idtype.\"id\";\n $table=\"uchome_\".$idtype;\n $query = mysql_query(\"SELECT * FROM \".$table.\" WHERE uid=$row[uid]\");\n $value = mysql_fetch_array($query);\n $id=$value[\"$idtypeid\"];\n $url = \"http://v5.home3d.cn/home/wx/wx.php?do=detail&viewuid=$row[uid]&id=$id&uid=$row[uid]&wxkey=\".$fromUsername.\"&idtype=$idtypeid&type=$idtype&moblieclicknum=$row[moblieclicknum]\"; \n }else{\n $url = \"http://v5.home3d.cn/home/wx/wx.php?uid=$row[uid]&do=feed&num=rand()&wxkey=\".$fromUsername.\"&uid=\".$row[uid].\"&idtype=\".$app_output->data->highapp[0]->english;\n }\n \n if($app_output->data->highapp[0]->newname){\n $subject=$app_output->data->highapp[0]->newname;\n }else{\n $subject=$app_output->data->highapp[0]->subject;\n }\n $pic = \"http://v5.home3d.cn/home/\".$app_output->data->highapp[0]->image1url;\n\n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n }\n if(!empty($more)){\n $subject=\"更多\";\n $url=\"http://v5.home3d.cn/home/wx/wx.php?uid=$row[uid]&do=home&num=rand()&wxkey=\".$fromUsername;\n $pic=\"http://v5.home3d.cn/home/./upload/menuset/small/menuset1379386329communicate.jpg\";\n $articles[] = makeArticleItem($subject, $subject, $pic, $url); \n } \n \n \n \n \n \n \n \n $resultStr = makeArticles($fromUsername, $toUsername, $time, $msgType, $name,$articles); \n echo $resultStr;\n }\n }else{\n echo \"Input something...\";\n }\n\n }else {\n echo \"\";\n exit;\n }\n }", "private function _hello()\n {\n // if _we_ join, don't greet ourself, just jump out via return\n if ($this->_data->nick == $this->_irc->_nick)\n return;\n \n $greetings = array(\n 'Mirëdita' => 'Albanian friends',\n 'Ahalan' => 'Arabic',\n 'Parev' => 'Armenian',\n 'Zdravei' => 'Bulgarian',\n 'Nei Ho' => 'Chinese',\n 'Dobrý den' => 'Czech',\n 'Goddag' => 'Danish',\n 'Goede dag' => 'Dutch',\n 'Hello' => 'English',\n 'Saluton' => 'Esperanto',\n 'Hei' => 'Finnish',\n 'Bonjour' => 'French',\n 'Guten Tag' => 'German',\n 'Gia\\'sou' => 'Greek',\n 'Aloha' => 'Hawaiian',\n 'Shalom' => 'Hebrew',\n 'Namaste' => 'Hindi',\n 'Jó napot' => 'Hungarian',\n 'Góðan daginn' => 'Icelandic',\n 'Halo' => 'Indonesian',\n 'Aksunai Qanuipit?' => ' Inuit',\n 'Dia dhuit' => 'Irish',\n 'Salve' => 'Italian',\n 'Kon-nichiwa' => 'Japanese',\n 'An-nyong Ha-se-yo' => ' Korean',\n 'Salvëte' => 'Latin',\n 'Ni hao' => 'Mandarin',\n 'Hallo' => 'Norwegian',\n 'Dzien\\' dobry' => 'Polish',\n 'Olá' => 'Portuguese',\n 'Bunã ziua' => 'Romanian',\n 'Zdravstvuyte' => 'Russian',\n 'Hola' => 'Spanish',\n 'Hujambo' => ' Swahili',\n 'Hej' => 'Swedish',\n 'Sa-wat-dee' => 'Thai',\n 'Merhaba' => 'Turkish',\n 'Vitayu' => 'Ukrainian',\n 'Xin chào' => 'Vietnamese',\n 'Hylo; Sut Mae?' => 'Welsh',\n 'Sholem Aleychem' => 'Yiddish',\n 'Sawubona' => 'Zulu');\n \n $greeting = array_rand($greetings);\n $language = $greetings[$greeting];\n $this->_privmessage($greeting .' '. $this->_data->nick .'! (That\\'s how you greet someone in '. $language .')', $this->_data->nick);\n $this->_privmessage('Type \"!help\" to find out what I can do for you.', $this->_data->nick);\n }", "public function get_description()\n {\n return 'A chat bot for your chatroom named Trickstr who will interact with your members. Simply install the addon and chat away to Trickstr. Note that Trickstr is only active if there are no more than 2 members in a chatroom.';\n }", "public function run()\n\t{\n\t\tif (count($this->liste_attente) > 0)\n\t\t\t$this->analyser_liste_attente();\n\n\t\t// Envoyer une rumeur de temps en temps\n\t\tif ($this->enabled)\n\t\t\t$this->lancer_rumeur();\n\n\t\t// Vérifier les derniers sujets du tobozon\n\t\tif ($this->enabled)\n\t\t\t$this->verifier_tobozon();\n\n\t\t// Vérifier les dernières parties de plouk\n\t\tif ($this->enabled)\n\t\t\t$this->verifier_plouk();\n\n\t\t// On regarde si il faut recharger la config\n\t\tif (file_exists('update_config'))\n\t\t{\n\t\t\t$this->lire_config();\n\t\t\t@unlink('update_config');\n\t\t}\n\t\t\t\n\t\t// On enlève les chut ban qui ont fait leur temps\n\t\t$this->supprimer_chut_bans();\n\t\t\n\t\tif ($this->buffer() === false)\n\t\t\treturn;\n\t\t\t\n\t\tswitch ($this->buffer('event'))\n\t\t{\n\t\t\t// On dit bonjour aux nouveaux arrivants\n\t\t\tcase 'JOIN':\n\t\t\t\tif ($this->buffer('text') == $this->bot->config('chan') && $this->enabled)\n\t\t\t\t{\n\t\t\t\t\tif ($this->autovoice)\n\t\t\t\t\t\t$this->command('MODE '.$this->bot->config('chan').' +v '.$this->buffer('nick'));\n\n\t\t\t\t\t$this->ajouter_bonjour();\n\t\t\t\t\t$this->lignes[$this->buffer('nick')] = '';\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\t// On réponds aux messages\n\t\t\tcase 'PRIVMSG':\n\t\t\t\t// Message privé\n\t\t\t\t$params = $this->buffer('params');\n\t\t\t\t\n\t\t\t\tif ($params[0] == $this->bot->config('nick'))\n\t\t\t\t\t$this->analyse_prive();\n\n\t\t\t\t// On analyse les messages publiques\n\t\t\t\telse if ($params[0] == $this->bot->config('chan'))\n\t\t\t\t{\n\t\t\t\t\tif ($this->enabled)\n\t\t\t\t\t\t$this->analyse_publique();\n\n\t\t\t\t\t$this->lignes[$this->buffer('nick')] = $this->buffer('text');\n\t\t\t\t\t$this->analyse_admin();\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tbreak;\n\n\t\t\t// Notices\n\t\t\tcase 'NOTICE':\n\t\t\t\t$params = $this->buffer('params');\n\n\t\t\t\tif ($params[0] == $this->bot->config('nick'))\n\t\t\t\t\t$this->analyse_admin();\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase 'KICK':\n\t\t\t\t// On rejoint le chan si le bot se fait kicker\n\t\t\t\t$params = $this->buffer('params');\n\t\t\t\t\n\t\t\t\tif ($params[0] == $this->bot->config('chan') && $params[1] == $this->bot->config('nick'))\n\t\t\t\t{\n\t\t\t\t\t$this->bot->join_chan();\n\t\t\t\t\t$this->ajouter_liste_attente('Merci beaucoup '.$this->buffer('nick').'...', 3);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}", "function botSpawEditorInit() {\n}", "public function index()\n \t{\n \t\t// load the header\n \t\t$this->displayHeader();\n\n \t\t// load the view\n \t\t$this->displayView(\"chat/index.php\");\n\n \t\t// load the footer\n \t\t$this->displayFooter();\n \t}", "public static function welcome() {\n\t}", "function sendHeader() {\n\t\t$this->console_text('###############################################################################');\n\t\t$this->console_text(' Aseco v' . ASECO_VERSION . ' running on {1}:{2}', $this->server->ip, $this->server->port);\n\t\t$this->console_text(' Game : {1} - {2}', $this->server->game, $this->server->gameinfo->getMode());\n\t\t$this->console_text(' Author: Florian Schnell');\n\t\t$this->console_text('###############################################################################');\n\n\t\tif ($this->welcome_msgs) {\n\t\t\tforeach ($this->welcome_msgs as $message) {\n\t\t\t\t$this->console_text('[' . $message['DATE'][0].'] ' . $message['TEXT'][0]);\n\t\t\t}\n\t\t\t$this->console_text('###############################################################################');\n\t\t}\n\n\t\t// format the text of the message ...\n\t\t$startup_msg = formatText($this->getChatMessage('STARTUP'),\n\t\t\tASECO_VERSION,\n\t\t\t$this->server->ip,\n\t\t\t$this->server->port);\n\n\t\t// replace colors ...\n\t\t$startup_msg = $this->formatColors($startup_msg);\n\n\t\t// send the message ...\n\t\t$this->client->addCall('ChatSendServerMessage', array($startup_msg));\n\t\t$this->client->multiquery();\n\t}", "public function single_user_conversation_fun(){\n require_once REALTEO_PLUGIN_DIR . '/includes/single-user_conversation.php';\n }", "function send_to_Telegram($data)\n\t{\n\t\t$agenda_id = $data['id_agenda'];\n\t\t$nip\t\t\t= $data['nip'];\n\t\t\n\t\t$TelegramAkun\t = $this->verifikator->getAgenda_byid($agenda_id,$nip);\n\t\tif($TelegramAkun->num_rows() > 0)\n\t\t{\t\n\t\t\t$row_agenda = $TelegramAkun->row();\n\t\t\t\n\t\t\t// send to telegram API\n\t\t\tif(!empty($row_agenda->telegram_id))\n\t\t\t{\t\n\t\t\t\t$this->telegram->sendApiAction($row_agenda->telegram_id);\n\t\t\t\t$text = \"<pre>Hello, <strong>\".$row_agenda->first_name .\" \".$row_agenda->last_name. \"</strong> Berkas kamu sudah selesai verifikasi dengan hasil berikut ini :\";\n\t\t\t\t$text .= \"\\n Tanggal:\".date('d-m-Y H:i:s');\n\t\t\t\t$text .= \"\\n Nomor Usul:\".$row_agenda->agenda_nousul;\n\t\t\t\t$text .= \"\\n Layanan:\".$row_agenda->layanan_nama;\n\t\t\t\t$text .= \"\\n NIP:\".$row_agenda->nip;\n\t\t\t\t$text .= \"\\n Nama PNS:\".$row_agenda->PNS_GLRDPN.' '.$row_agenda->PNS_PNSNAM.' '.$row_agenda->PNS_GLRBLK;\n\t\t\t\t$text .= \"\\n Tahapan:\".$row_agenda->tahapan_nama;\n\t\t\t\t(!empty($row_agenda->status_level_satu) ? $text .= \"\\n Status Level 1 :\".$row_agenda->status_level_satu : '');\n\t\t\t\t(!empty($row_agenda->status_level_dua) ? $text .= \"\\n Status Level 2 :\".$row_agenda->status_level_dua : '');\n\t\t\t\t(!empty($row_agenda->status_level_tiga) ? $text .= \"\\n Status Level 3 :\".$row_agenda->status_level_tiga : '');\n\t\t\t\t$text .= \"\\n Status Berkas:\".$row_agenda->nomi_status;\n\t\t\t\t$text .= \"\\n Keterangan:\".$row_agenda->nomi_alasan;\n\t\t\t\t$text .= \"\\n Instansi:\".$row_agenda->instansi.'</pre>';\n\t\t\t\t$this->telegram->sendApiMsg($row_agenda->telegram_id, $text , false, 'HTML');\n\t\t\t\t\t\t\t\t\t\n\t\t\t}\t\n\t\t\t\n\t\t\t\n\t\t}\n\t}", "public function index()\n {\n /*//Get Telegram group ID.. Admin last message must be sent to the group\n $activity = Telegram::getUpdates();\n dd($activity);*/\n\n /*//Telegram Bot notification\n $text = \"Message From The Developer\\n\"\n . \"<b>Ignore Please: </b>\\n\"\n . \"<b>Message: </b>\\n\"\n . \"Telegram Bot test successful\";\n\n Telegram::sendMessage([\n 'chat_id' => env('TELEGRAM_CHANNEL_ID', ''),\n 'parse_mode' => 'HTML',\n 'text' => $text\n ]);*/\n\n /*//SMS Functionality\n $phone = $this->serializePhoneNumberForSms(Auth::user()->phone);\n $message = 'Congratulations! '\n .Auth::user()->username.\n ', you have successfully registered with Secured Investment.';\n $this->sendSms($message, $phone);\n session()->flash('success', 'SMS test sent successfully');*/\n\n $from = ReferrerDetail::where('user_id', auth()->user()->referred_from_id)->first();\n $ref = null;\n if ($from){\n $ref = $from->user->username;\n }\n return view('home', compact('ref'));\n }", "public function Talk();", "public function run()\n {\n //['name','code','status',[hd/sd]]\n\n\n {\n $this->createChannel();\n }\n }", "public function example() {\n \\Drupal::messenger()->addStatus('example message');\n\n \\Drupal::messenger()->addError('example error');\n\n \\Drupal::messenger()->addStatus('example status');\n\n \\Drupal::messenger()->addWarning('example warning');\n\n \\Drupal::messenger()->addStatus('example warning', TRUE);\n\n return NULL;\n }", "public function index()\n\t{\n\t\t$bot = new Kobot('irc.freenode.net');\n\n\t\t// Enable debugging\n\t\t$bog->log_level = 1;\n\n\t\t// Add triggers\n\t\t$bot->set_trigger('^goodnight, bot$', array($this, 'trigger_quit'))\n\t\t ->set_trigger('^register(.+)?$', array($this, 'register'))\n\t\t ->set_trigger('^tell (.+?) about (.+)$', array($this, 'trigger_say'))\n\t\t ->set_trigger('^([r|#])(\\d+)$', array($this, 'trigger_trac'))\n\t\t ->set_trigger('^[a-z_]+$', array($this, 'trigger_default'));\n\n\t\t// Login and join the default channel\n\t\t$bot->login('koboto', 'PhoenixRisingKO');\n\t\t$bot->join('#kohana-dev', 'lovespeed');\n\t\t$bot->read();\n\t}", "public function sendMessage(){\n\n\n }", "protected function welcome() {\n echo \"*****************\" . PHP_EOL .\n \"*** TicTacToe ***\" . PHP_EOL .\n \"*****************\" . PHP_EOL;\n $this->drawBoard(array(), true);\n echo \"[\" . self::QUIT_BUTTON . \"] - End game\" . PHP_EOL . PHP_EOL;\n }", "function greeting(){\n\t\t\techo \"Idol ni Noli si Pong\";\n\t\t}", "private function _whereAreYou()\n {\n $channels = '';\n foreach($this->_currentChannels AS $channel)\n {\n $channels .= $channel .\", \";\n }\n\n $this->_message($this->_data->nick .\": I am in \". $channels);\n }", "public function guide(){\n\t\t$this->load->model(\"professionalop\");\n\t\t$data['chat']=$this->professionalop->mychats();\n\t\t$this->load->view(\"professional/home/header\");\n\t\t$this->load->view(\"professional/home/guide\",$data);\n\t\t$this->load->view(\"professional/home/footer\");\n\t}", "public function askWhatToDo(){\n $question = Question::create('¿Qué deseas hacer en mi blog?')\n ->fallback('Lo siento pero...')\n ->callbackId('que_quieres_hacer')\n ->addButtons([Button::create('¿Ver todos los posts?')->value('all'),Button::create('¿Ver todas las categorías?')->value('categorias'),]);\n $this->ask($question, function(Answer $answer) {\n\n if ($answer->isInteractiveMessageReply()){\n $value = $answer->getValue();\n $text = $answer->getText();\n $this->say('Opcion, '.$value.' '.$text);\n }\n });\n }", "private function send_msg() {\r\n }", "public function sendMessage()\n {\n $this->getTemplate(\"审核结果通知\");\n\n if (empty($this->temp_open)) {\n $back['message'] = \"消息通知未开启\";\n \\Log::debug($back['message']);\n return ;\n }\n\n $this->organizeData();\n\n \\Log::debug(\"新版小程序消息-直播审核1\",$this->temp_id);\n \\Log::debug(\"新版小程序消息-直播审核2\",$this->member->hasOneMiniApp->openid);\n \\Log::debug(\"新版小程序消息-直播审核3\",$this->data);\n\n $result = (new AppletMessageNotice($this->temp_id,$this->member->hasOneMiniApp->openid,$this->data,[],2))->sendMessage();\n\n if ($result['status'] == 0) {\n \\Log::debug($result['message']);\n }\n }", "public function abrir_chat()\n\t{\n\t\t$usuario=$this->session->userdata('id');\n\t\t$id_otro_usuario=$_REQUEST['id_otro_usuario'];\n\t\t\n\t\t//var_dump($_REQUEST);\n\t\t\n\t\t$mensajes=$this->Mensaje_model->buscar_mensajes_chat($usuario,$id_otro_usuario);//TODO cambiar por $usuario\n\t\techo(json_encode($mensajes));\n\t}", "function onTextmessage(TeamSpeak3_Adapter_ServerQuery_Event $event, TeamSpeak3_Node_Host $host)\n{\n global $ts3, $name, $debug; \n $msg = $event[\"msg\"];\n $invoker = $event[\"invokername\"];\n \n if($invoker != $name) {\n \n if($debug) echo($invoker.\": \".$msg.\"\\n\");\n \n if($debug) echo(\"User \".$invoker.\" passed security check\\n\");\n \n $invoker_db = $ts3->clientGetByName($invoker);\n \n if($invoker_db[\"client_unique_identifier\"] == \"DOgQ0YV9+wZ9YMdD3JPfhvlv/xqM=\" OR $invoker_db[\"client_unique_identifier\"] == \"gWszaxdv1W+8KlIHafUe+ZdOaiI=\") {\n\n // preparing the command arguments\n $block = array(11, 26, 2);\n $values[1] = intval( $uid );\n $id_a = $ts3->getId();\n $arguments = explode(\" \", $msg);\n if($debug) echo(\"Arguments:\\n\"); print_r($arguments);echo(\"\\n\"); \n switch ($arguments[0]) {\n\tcase \"!ping\":\n\t\tgizisent(\"Pong!\",$ts3,$id_a);\n\t\tbreak;\n\tcase \"!add\":\n\t\tif (in_array($arguments[1], $block)){\n\t\tgizisent(\"Access denied\",$ts3,$id_a);\n\t\t} else {\n\t\t$ts3->serverGroupClientAdd($arguments[1],$arguments[2]);\t\t\n\t\tgizisent(\"Rank was add\",$ts3,$id_a);\n\t\t}\n\t\tbreak;\t \n\tcase \"!del\":\n\t\tif (in_array($arguments[1], $block)){\n\t\tgizisent(\"Access denied\",$ts3,$id_a);\n\t\t} else {\n\t\t$ts3->serverGroupClientDel($arguments[1],$arguments[2]);\t\t\n\t\tgizisent(\"Rank was remove\",$ts3,$id_a);\n\t\t}\n\t\tbreak;\t\t\t\n\tcase \"!info\":\n\t\tgizisent(\"Project GzPro.net\",$ts3,$id_a);\n\t\tbreak;\t \n\tcase \"!help\":\n\t\tgizisent(\"Commands:\n\t\t!ping - test\n\t\t!add <id ServerGroup> <dbid user> - Giving Rank\n\t\t!del <id ServerGroup> <dbid user> - Remove Rank\n\t\t!info - Information Bot\",$ts3,$id_a);\n }\n \n}\n}\n}", "public function run()\n {\n //\n $chat = new Message();\n $chat->room_id = 1;\n $chat->send_account_id = 1;\n $chat->receive_account_id = 2;\n $chat->text = \"こんにちは\";\n $chat->is_read = true;\n $chat->save();\n\n //\n $chat2 = new Message();\n $chat2->room_id = 1;\n $chat2->send_account_id = 2;\n $chat2->receive_account_id = 1;\n $chat2->text = \"よろしくお願いします。\";\n $chat2->is_read = true;\n $chat2->save();\n\n }", "public function run()\n {\n BotAccount::create([\n \t'name' => 'studioapi',\n\t\t\t'password' => '7411328'\n\t\t]);\n }", "public function sayHello()\n {\n }", "function chat(){\r\n \tif($this->session->userdata('akses')=='1' || $this->session->userdata('akses')=='2' || $this->session->userdata('akses')=='3'){\r\n \t$this->load->view('v_chat');\r\n \t}else{\r\n \techo \"Anda tidak berhak mengakses halaman ini\";\r\n \t}\r\n \t}", "public function run()\n {\n $NoiDung = \"\n\t\t<p>Kể từ khi ra mắt vào tháng 03 năm ngoái, Nintendo Switch đã tẩu tán được gần 20 triệu máy. Tính đến giờ, hầu hết mọi người đều nghĩ rằng Nintendo Switch, Xbox One và Sony PS4 là ba đối thủ cạnh tranh trực tiếp trên thị trường.</p>\n\t\t<p>Tuy nhiên nếu nhìn sâu hơn vào những số liệu cũng như thói quen chơi game của những gia đình và người tiêu dùng sở hữu Switch, phát hiện được ra một điều đáng nể của Nintendo: Họ đang tự tạo ra cả một thị trường riêng, không cạnh tranh trực tiếp với console truyền thống, lại càng không đụng vào game mobile trên các thiết bị di động khác.</p>\n\t\t<p>Tháng 10/2017, chủ tịch Nintendo Tatsumi Kimishima chia sẻ một bản báo cáo sau khi cuộc họp công bố báo cáo tài chính kết thúc. Những dữ kiện ông chia sẻ trong bản báo cáo này khiến chúng ta nhận ra một điều rằng Nintendo Switch có một tính năng mà không máy console hiện tại nào cạnh tranh được, đó chính là cơ chế căn bản cho phép chơi kiểu hybrid, vừa ngồi nhà xuất hình lên TV thông qua dock sạc, vừa cho phép mang ra đường thưởng thức game như một tablet nho nhỏ.</p>\n\t\t<p>Hiện tại hơn 50% tổng số người sử dụng Switch đều chơi game bằng cả hai cách, theo dữ liệu gửi về cho Nintendo. Điều này có nghĩa concept máy chơi game của người Nhật Bản đã được cộng đồng chấp nhận và sử dụng hàng ngày.</p>\n\t\t<p>Chính sự độc đáo này khiến cho tiềm năng lâu dài của Switch trở nên vô cùng khả quan.</p>\";\n\n DB::table('blog')->insert([\n \t[\n \t\t'Title' => 'Hơn 1 năm qua Nintendo Switch đã tự tạo ra một thị trường mới toanh như thế nào?',\n \t\t'NoTitle' => 'hon-1-nam-qua-nintendo-switch-da-tu-tao-ra-mot-thi-truong-moi-toanh-nhu-the-nao',\n \t\t'Excerpts' => 'Bên cạnh 400 suất học bổng Nguyễn Văn Đạo, ĐH FPT lần đầu tiên chọn ra 30 học sinh xuất sắc nhất để cấp học bổng toàn phần đào tạo từ cử nhân lên thẳng tiến sĩ, với tổng giá trị quỹ lên tới 5 triệu USD.',\n \t\t'Content' => $NoiDung,\n 'Image' => 'hero-1.jpg',\n 'Highlights' => 1,\n \t\t'View' => 0,\n 'idCategoryBlog'=>'1'\n \t],\n \t[\n \t\t'idCategoryBlog'=>'1',\n \t\t'Title' => 'Lần đầu ĐH FPT cấp học bổng tiến sĩ ',\n \t\t'NoTitle' => 'Lan-Dau-Dh-Fpt-Cap-Hoc-Bong-Tien-Si',\n \t\t'Excerpts' => 'Bên cạnh 400 suất học bổng Nguyễn Văn Đạo, ĐH FPT lần đầu tiên chọn ra 30 học sinh xuất sắc nhất để cấp học bổng toàn phần đào tạo từ cử nhân lên thẳng tiến sĩ, với tổng giá trị quỹ lên tới 5 triệu USD.',\n \t\t'Content' => $NoiDung,\n \t\t'Image' => 'hero-1.jpg',\n 'Highlights' => 1,\n 'View' => 0,\n 'idCategoryBlog'=>'1'\n \t],\n \t[\n \t\t'idCategoryBlog'=>'1',\n \t\t'Title' => 'Bên trong ổ cắm điện cắm 4000W',\n \t\t'NoTitle' => 'ben-trong-o-cam-dien-cam-4000w',\n \t\t'Excerpts' => 'Bên cạnh 400 suất học bổng Nguyễn Văn Đạo, ĐH FPT lần đầu tiên chọn ra 30 học sinh xuất sắc nhất để cấp học bổng toàn phần đào tạo từ cử nhân lên thẳng tiến sĩ, với tổng giá trị quỹ lên tới 5 triệu USD.',\n \t\t'Content' => $NoiDung,\n \t\t'Image' => 'hero-1.jpg',\n \t\t'Highlights' => 1,\n 'View' => 0,\n 'idCategoryBlog'=>'1'\n \t],\n \t[\n \t\t'idCategoryBlog'=>'2',\n \t\t'Title' => 'Phải chăng PS4 là món đồ chơi chỉ dành cho người nhiều tiền?',\n \t\t'NoTitle' => 'phai-chang-ps4-la-mon-do-choi-chi-danh-cho-nguoi-nhieu-tien',\n \t\t'Excerpts' => 'Bên cạnh 400 suất học bổng Nguyễn Văn Đạo, ĐH FPT lần đầu tiên chọn ra 30 học sinh xuất sắc nhất để cấp học bổng toàn phần đào tạo từ cử nhân lên thẳng tiến sĩ, với tổng giá trị quỹ lên tới 5 triệu USD.',\n \t\t'Content' => $NoiDung,\n \t\t'Image' => 'hero-1.jpg',\n \t\t'Highlights' => 1,\n 'View' => 0,\n 'idCategoryBlog'=>'1'\n \t],\n \t[\n \t\t'idCategoryBlog'=>'3',\n \t\t'Title' => 'Tự làm UPS cho modem wifi, đèn led',\n \t\t'NoTitle' => 'tu-lam-ups-cho-modem-wifi-den-led',\n \t\t'Excerpts' => 'Bên cạnh 400 suất học bổng Nguyễn Văn Đạo, ĐH FPT lần đầu tiên chọn ra 30 học sinh xuất sắc nhất để cấp học bổng toàn phần đào tạo từ cử nhân lên thẳng tiến sĩ, với tổng giá trị quỹ lên tới 5 triệu USD.',\n \t\t'Content' => $NoiDung,\n \t\t'Image' => 'hero-1.jpg',\n \t\t'Highlights' => 1,\n 'View' => 0,\n 'idCategoryBlog'=>'1'\n \t]\n\n \t]);\n }", "function aboutMe(){\n return \"Hi my name is Ruby, I am a chatbot, nice to meet you\";\n}", "function aboutMe(){\n return \"Hi my name is Ruby, I am a chatbot, nice to meet you\";\n}", "function view_chat($demand_id)\n {\n }", "public function chat( $charac = Hello) {\n }", "public function sayhello(){\r\n\t\t//http://localhost/170119/index.php/Test/sayhello\r\n\t\techo 'This is sayhello function in Test Controlle';\r\n\t}", "function replyMessage ($message) {\n /*\n * Instantiate Recast.AI SDK, just for connect service\n */\n $request = Client::Request($_ENV[\"REQUEST_TOKEN\"]);\n\n /*\n * Get text from message received\n */\n $text = $message->content;\n\n /*\n * Get senderId to catch unique conversation_token\n */\n $senderId = $message->senderId;\n\n /*\n * Call Recast.AI SDK, through /converse route\n */\n $response = $request->converseText($text, [ 'conversation_token' => $senderId ]);\n\n /*\n * Here, you can add your own process.\n * Ex: You can call any external API\n * Or: Update your DB\n * etc...\n */\n $server = \"localhost\";\n$dbusername = \"root\";\n$dbpassword = \"root\";\n$dbname = \"phplms\";\nif ($response->action->slug == 'greetings') {\n // Do your code\necho \"Greetings User!\";\n\n\n$usernametext = \"sid\";\n$passwordtext = \"sid\";\n//array_push($response->replies, \"Welcome to LMS. You can enquire about your marks as of now.\");\n\n$conn = new mysqli($server, $dbusername, $dbpassword, $dbname);\n// Check connection\nif ($conn->connect_error) {\n die(\"Connection failed: \" . $conn->connect_error);\n} \nelse{\n$sql = \"SELECT * from register where username = 'sid' and password = 'sid';\";\n$result = $conn->query($sql);\n\n//if ($result->num_rows > 0) {\nif($result!=null){\n //array_push($response->replies, \"Inside rows > 0\");\n // output data of each row\n while($row = $result->fetch_assoc()) {\n //array_push($response->replies, \"Inside While\");\n //echo \"id: \" . $row[\"id\"]. \" - Name: \" . $row[\"firstname\"]. \" \" . $row[\"lastname\"]. \"<br>\";\n if($usernametext==$row[\"username\"]){\n if($passwordtext==$row[\"password\"]){\n //session_start();\n echo \"User found! Username = \".$row['username'].\"\\n\";\n echo \"Password = \".$row['password'].\"\\n\";\n //array_push($response->replies, \"Welcome to LMS. You can enquire about your marks as of now.\");\n //$_SESSION['username']=$usernametext;\n //$_SESSION['name']=$row[\"name\"];\n //header('Location: Auth.php');\n $conn->close();\n //exit;\n }\n }\n }\n}\nelse{\n echo \"0 results\";\n $conn->close();\n}\n}\n}\n\nif ($response->action->slug == 'online-test-marks') {\n $sql = \"\";\n $test_number = $response->memory->number->scalar;\n $username = $response->memory->username->value;\n if($username==null){\n array_push($response->replies, \"Code : Username is missing\");\n }\n //array_push($response->replies, \"Test number = \".$test_number);\n else if($test_number==null){\n //array_push($response->replies, \"Test number null\");\n\n \n }else{\n $sql = \"select * from onlinetest\".$test_number.\" where username = '\".$username.\"';\";\n $conn = new mysqli($server, $dbusername, $dbpassword, $dbname);\nif ($conn->connect_error) {\n die(\"Connection failed: \" . $conn->connect_error);\n} \nelse{\n$result = $conn->query($sql);\n\n//if ($result->num_rows > 0) {\nif($result!=null){\n array_push($response->replies, \"Your onlinetest\".$test_number.\" marks :\");\n // output data of each row\n while($row = $result->fetch_assoc()) {\n //echo \"id: \" . $row[\"id\"]. \" - Name: \" . $row[\"firstname\"]. \" \" . $row[\"lastname\"]. \"<br>\";\n array_push($response->replies, $row[\"cname\"].\" - \".$row[\"marks\"]);\n }\n }\n}\n}\n}\n\nif ($response->action->slug == 'login-1') {\n\n\n$usernametext = $response->memory->username->value;\n$passwordtext = $response->memory->password->value;\narray_push($response->replies, \"Username :\".$usernametext.\"END Password :\".$passwordtext.\"END\");\n//array_push($response->replies, \"Welcome to LMS. You can enquire about your marks as of now.\");\n//$result = null;\n$conn = new mysqli($server, $dbusername, $dbpassword, $dbname);\n// Check connection\nif ($conn->connect_error) {\n die(\"Connection failed: \" . $conn->connect_error);\n}\nelse{\n$sql = \"SELECT * from register where username = '.$usernametext.' and password = '.$passwordtext.';\";\n$result = $conn->query($sql);\narray_push($response->replies, \"No. of rows : \".mysqli_num_rows($result));\n//if ($result->num_rows > 0) {\nif($result!=null){\n//if(mysqli_num_rows($result)>0){\n array_push($response->replies, \"Code : Successfully logged in as \".$usernametext);\n array_push($response->replies, \"Welcome to LMS. You can enquire about your marks as of now.\");\n $conn->close();\n}\nelse{\n array_push($response->replies, \"Code : Username or password is wrong! Please log in again.\");\n $conn->close();\n}\n}\n}\n\nif ($response->action->slug == 'my-details') {\n $usernametext = $response->memory->username->value;\n $passwordtext = $response->memory->password->value;\n array_push($response->replies, \"Username : \".$usernametext.\" Password : \".$passwordtext);\n }\n /*\n * Add each replies received from API to replies stack\n */\n foreach ($response->replies as $reply) {\n $message->addReply([(object)['type' => 'text', 'content' => $reply]]);\n }\n\n $message->reply();\n}", "public function run()\n {\n Message::create([\n 'request' => 'info | information | menu | help',\n 'response' => 'This application allows you to deposit, withdraw and exchange currencies, for more information try using one word like deposit, exchange... Available currencies: USD, EUR, GBP, JPY, AUD, CAD, CHF, CNY,', //TODO fill with info of the base\n ]);\n Message::create([\n 'request' => 'bye | good bye | see you ',\n 'response' => 'See you soon!',\n ]);\n Message::create([\n 'request' => 'hey there | hi | hello',\n 'response' => 'If you whant to se more info or the menu please type info or menu',\n ]);\n Message::create([\n 'request' => 'exchange | how to exchange',\n 'response' => 'If you want to perform an exchange of currencies you have to insert the character # followed from the word exchnge amount then the origin currency then the destiny currency. eg: #exchange 30 USD EUR',\n ]);\n Message::create([\n 'request' => 'deposit | how to deposit',\n 'response' => 'If you want to perform a deposit you have toou have to insert the character # followed from the word deposit then amount then currency. eg: #deposit 30 USD',\n ]);\n Message::create([\n 'request' => 'withdraw | how to withdraw',\n 'response' => 'If you want to perform a withdraw you have to insert the character # followed from the word withdraw then amount then currency. eg: #withdraw 30 USD',\n ]);\n Message::create([\n 'request' => 'login | tutorial | how do i login | log in | how do i log in',\n 'response' => 'If you want to log in you have to insert the character # followed from the word login then email then password. eg: #login [email protected] 123456',\n ]);\n Message::create([\n 'request' => 'show balance | balance | my balance',\n 'response' => 'If you want to see your balance you have to insert the character # followed from the word balance to show all your accounts. eg: #balance',\n ]);\n Message::create([\n 'request' => ' sign-up | signup | create account',\n 'response' => 'To sign up you have to insert the character # followed from the word signup then email then password then your inicial amount then your currency. eg: #signup [email protected] 123456 30 USD',\n ]);\n Message::create([\n 'request' => 'logout | how do i log out | log out | how do i log out',\n 'response' => 'To log out you have to insert the character # followed from the word logout. eg: #logout',\n ]);\n }", "public function showMessage($msg){\n// $message += ($msg +\"<br/>\");\n// require APP . 'view/_templates/header.php';\n// require APP . 'view/home/message.php';\n// require APP . 'view/post/index.php';\n// require APP . 'view/_templates/footer.php';\n// return;\n }", "public function bye(){\n return \"Bye... $this->dialogue\";\n }", "function message()\r\n\t{\r\n\t\tglobal $IN, $INFO, $SKIN, $ADMIN, $std, $MEMBER, $GROUP;\r\n\t\t$ibforums = Ibf::app();\r\n\r\n\t\t$this->common_header('domessage', 'Board Message', 'You may change the configuration below. HTML is enabled, and BBCode will be enabled in later versions.');\r\n\r\n\t\t$ADMIN->html .= $SKIN->add_td_row(array(\r\n\t\t \"<b>Turn the message system off?</b>\",\r\n\t\t $SKIN->form_yes_no(\"global_message_on\", $INFO['global_message_on'])\r\n\t\t ));\r\n\r\n\t\t$ADMIN->html .= $SKIN->add_td_row(array(\r\n\t\t \"<b>The message to display</b>\",\r\n\t\t $SKIN->form_textarea(\"global_message\", $INFO['global_message'])\r\n\t\t ));\r\n\r\n\t\t$this->common_footer();\r\n\r\n\t}", "public function create()\n {\n<<<<<<< HEAD\n //return view('chat.chat');\n=======\n //\n>>>>>>> 9c18da2fd4a9a14ffc85a5301e9c9aea5f0f93e1\n }", "public function showMessage(){\n\t\t\n\n\t\ttry {\n\n\t\t\tif(!empty($_POST)){// si un commentaire est poter\n\t\t\t\tTchatModel::setMessage($_POST[\"message\"],$_POST[\"idUsr\"]);\n\t\t\t}\n\n\t\t\t$data = TchatModel::getMessage();\n\t\t} catch (Exception $e) {\n\t\t\t$data = TchatModel::getMessage();\n\t\t\t$warning = $e->getMessage();\n\t\t}\n\t\trequire_once'ViewFrontend/tchat.php';\n\t}", "public function help() {\n $this->say(\"Please let me help!\");\n\n $this->say(\"I'm Martha and I can help you answer questions and find things online. Try asking:\");\n\n $suggestions = $this->suggest(3);\n\n if($this->_context != 'web') {\n foreach($suggestions as $suggestion) {\n $this->say($suggestion);\n }\n $this->say(\"I can talk to all of these APIs thanks to Temboo! https://temboo.com\");\n $this->say(\"You can read my source at https://github.com/temboo/martha\");\n } else {\n foreach($suggestions as $suggestion) {\n $this->say('<p><a href=\"?query=' . htmlentities($suggestion, ENT_COMPAT, 'UTF-8') . '\" class=\"suggestion\">\"' . htmlentities($suggestion, ENT_NOQUOTES, 'UTF-8') . '\"</a></p>', true);\n }\n $this->say('<p>I can talk to all of these APIs thanks to <a href=\"https://temboo.com/\" target=\"_blank\">Temboo</a>!</p>', true);\n $this->say('<p>You can read my source at <a href=\"https://github.com/temboo/martha\" target=\"_blank\">Github</a>.</p>', true);\n }\n }", "public function index()\n\t{\n\n\t\t$this->config->load('bot');\n\n\t\t$botToken = $this->config->item('botToken');\n\t\t$website = \"https://api.telegram.org/bot\".$botToken;\n\n\t\t//$last_id = intval(file_get_contents('./lastid.txt'))+1;\n\t\t$last_id = 1;\n\n\t\t$update = file_get_contents($website.\"/getupdates?offset=$last_id\");\n\n\t\t//cuando se cambie a servidor SSL hay que poner esto\n\t\t//$update = file_get_contents(\"php://input\");\n\t\t//y no hace falta recorrer los mensajes porque te mandan un post por mensaje\n\n\t\techo \"<pre>\";\n\t\tprint_r(json_decode($update));\n\t\t$data = json_decode($update);\n\n\t\t/* \n\n\t\t//esto es un data de ejemplo\n\n\t\tstdClass Object\n\t\t(\n\t\t [ok] => 1\n\t\t [result] => Array\n\t\t (\n\t\t [0] => stdClass Object\n\t\t (\n\t\t [update_id] => 911242039\n\t\t [message] => stdClass Object\n\t\t (\n\t\t [message_id] => 63\n\t\t [from] => stdClass Object\n\t\t (\n\t\t [id] => 8908013\n\t\t [first_name] => Guillermo - Killer\n\t\t [username] => killer415\n\t\t )\n\n\t\t [chat] => stdClass Object\n\t\t (\n\t\t [id] => -12658615\n\t\t [title] => Airsoft partidas club\n\t\t )\n\n\t\t [date] => 1441465223\n\t\t [text] => /crearpartida\n\t\t )\n\n\t\t )\n\n\t\t*/\n\n\t\tforeach ($data->result as $key => $msg){\n\n\t\t\techo \"Analyzing message $key<br>\";\n\n\t\t\t//datos grupo\n\t\t\t$in_group = !isset($msg->message->chat->username);\n\t\t\t$last_update_id = $msg->update_id;\n\n\t\t\t//solo permitimos hablar en grupo\t\t\n\t\t\t//if (!$in_group) continue;\n\t\t\t//echo \"mensaje a grupo :\". intval($in_group) .\"<br>\";\n\n\t\t\t//datos mensaje\n\t\t\t$group_id \t= $msg->message->chat->id;\n\t\t\t$from_id\t= $msg->message->from->id;\n\t\t\t$from_username\t= $msg->message->from->username;\n\t\t\t$text \t\t= $msg->message->text;\n\n\t\t\t//lista de commands disponibles\n\t\t\t$commands = array(\n\t\t\t\t'crearpartida' => '/(\\/crearpartida)$/',\n\t\t\t\t'cancelarpartida' => '/(\\/cancelarpartida)$/',\n\t\t\t\t'infopartida' => '/(\\/infopartida)$/',\n\t\t\t);\n\n\t\t\t$matches = null;\n\t\t\tforeach ($commands as $commandkey => $commandexp){\n\n\t\t\t\t$returnValue = preg_match($commandexp, $text, $matches);\n\n\t\t\t\t//print_r($matches);\n\n\t\t\t\tif (!empty($matches)) {\n\n\t\t\t\t\tswitch($commandkey){\n\n\t\t\t\t\t\tcase \"crearpartida\":\n\t\t\t\t\t\t\techo \"command $commandkey<br>\";\n\t\t\t\t\t\t\tfile_get_contents($website.\"/sendMessage?chat_id=$group_id&text=@$from_username: command crearpartida leído\");\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase \"cancelarpartida\":\n\t\t\t\t\t\t\techo \"command $commandkey<br>\";\n\t\t\t\t\t\t\tfile_get_contents($website.\"/sendMessage?chat_id=$group_id&text=@$from_username: command cerrarpartida leído.\");\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase \"infopartida\":\n\t\t\t\t\t\t\techo \"command $commandkey<br>\";\n\t\t\t\t\t\t\tfile_get_contents($website.\"/sendMessage?chat_id=$group_id&text=@$from_username: command infopartida leído.\");\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t$matches = null;\n\t\t\t\t//$last_id = file_put_contents('./lastid.txt',$last_update_id);\n\n\t\t\t}\n\n\t\t}\n\n\n\t}", "function changeLang($i) //show and change the language for user\n{\n global $message_id;\n global $user_id;\n global $text;\n global $db;\n global $locale;\n if ($i == 0)\n {\n\n mysqli_query($db, \"UPDATE padporsc_bot4.users SET current_level = 'watching_change_language' WHERE user_id = {$user_id}\");\n\n if ($locale == \"farsi\")\n makeCurl(\"editMessageText\", [\"chat_id\" => $user_id, \"message_id\" => $message_id, \"text\" => \"انتخاب کن.\", \"reply_markup\" => json_encode([\n \"inline_keyboard\" =>[\n [\n [\"text\" => \"فارسی\", \"callback_data\" => \"chang3_T0_p3Rs1an\"], [\"text\" => \"انگلیسی\", \"callback_data\" => \"chang3_T0_3nGl1sH\"]\n ],\n [\n [\"text\" => \" بازگشت\", \"callback_data\" => \"R3tuRn\"]\n ]\n ]\n ])]);\n elseif ($locale == \"english\")\n makeCurl(\"editMessageText\", [\"chat_id\" => $user_id, \"message_id\" => $message_id, \"text\" => \"Choose\", \"reply_markup\" => json_encode([\n \"inline_keyboard\" =>[\n [\n [\"text\" => \"Farsi\", \"callback_data\" => \"chang3_T0_p3Rs1an\"], [\"text\" => \"English\", \"callback_data\" => \"chang3_T0_3nGl1sH\"]\n ],\n [\n [\"text\" => \"Return\", \"callback_data\" => \"R3tuRn\"]\n ]\n ]\n ])]);\n }\n elseif ($i == 1)\n {\n\n $result = mysqli_query($db, \"SELECT * FROM padporsc_bot4.users WHERE user_id = {$user_id}\");\n $row = mysqli_fetch_array($result);\n\n if($row['question_string'] == \"111111\")\n $b = 1;\n else\n $b = 0;\n if ($text == \"R3tuRn\")\n userMenu(1, $b);\n elseif ($text == \"chang3_T0_p3Rs1an\")\n {\n $locale = \"farsi\";\n\n mysqli_query($db, \"UPDATE padporsc_bot4.users SET locale = 'farsi' WHERE user_id = {$user_id}\");\n\n userMenu(1, $b);\n }\n elseif ($text == \"chang3_T0_3nGl1sH\")\n {\n $locale = \"english\";\n\n mysqli_query($db, \"UPDATE padporsc_bot4.users SET locale = 'english' WHERE user_id = {$user_id}\");\n\n userMenu(1, $b);\n }\n }\n\n}", "public function processChat(Request $request) {\n $userInput = strtolower($request->input('say'));\n\n //if it's direction request\n if (strchr(strtoupper($userInput),'FROM') && strchr(strtoupper($userInput),'TO')) {\n\n $response['key'] = 'direction';\n $data = BotModel::getDirections($userInput);\n }\n\n //if it's a dictionary request\n elseif(strpos($userInput, 'define') !== false) {\n $response['key'] = 'definition';\n $data = BotModel::getDefinitions($userInput);\n }\n\n //if it's a job request\n elseif(strpos($userInput, 'job') !== false) {\n $response['key'] = 'job';\n $pieces = explode(\" \", $userInput);\n\n $location = false;\n if(strpos($userInput, 'in') !== false) {\n $location = $pieces[array_search('in', $pieces) + 1];\n }\n\n $keyword = false;\n if(strpos($userInput, 'need') !== false) {\n $keyword = $pieces[array_search('need', $pieces) + 1];\n\n if(strpos($keyword, 'job') !== false) {\n $keyword = false;\n }\n }\n\n $number = preg_replace('/\\D/', '', $userInput);\n $limit = is_numeric($number) ? $number : 5;\n $url = $this->jobURL.\"?keyword=$keyword&location=$location&limit=5\";\n $res = UtilitiesModel::getWebPage($url);\n\n $res = json_decode($res);\n\n $jobs = false;\n foreach($res as $datum) {\n $jobs .= '<p><b>'.$datum->title.' ('.$datum->location.')</b><br>'.implode(' ', array_slice(explode(' ', $datum->summary), 0, 10)).' <a target=\"_blank\" href=\"'.$datum->url.'\">view</a></p><br>';\n }\n\n if(!$jobs) {\n $data = \"I didn't find any jobs.\";\n\n if($keyword) {\n Log::info(\"Found keyword $keyword and $location\");\n $data .= \" Kindly provide your email address so I can alert you when I find $keyword jobs \" . (($location) ? 'in ' . $location.' ' : false) . \"for you.\";\n\n $this->cache['location'] = $location;\n $this->cache['keyword'] = $keyword;\n $this->cache['awaiting_email_response'] = true;\n\n Cache::put($this->convoId, $this->cache, 2);\n }\n } else {\n $data = $jobs;\n\n }\n }\n\n elseif($this->cache['awaiting_email_response'] && $email = UtilitiesModel::getEmail($userInput)) {\n $this->cache['awaiting_email_response'] = false;\n $this->cache['awaiting_email_validation'] = true;\n $this->cache['email'] = $email;\n Cache::put($this->convoId, $this->cache, 2);\n $data = \"Should I save your email as $email?\";\n }\n\n elseif($this->cache['awaiting_email_validation']) {\n if(strpos($userInput, 'yes') !== false || strpos($userInput, 'yea') !== false) {\n $data = \"I will send emails to \".$this->cache['email'].\" when I find \".$this->cache['keyword'].\" jobs\";\n $data .= $this->cache['location'] ? \" in \".$this->cache['location'] : \"\";\n\n $this->cache['awaiting_email_validation'] = false;\n $this->cache['awaiting_whatsapp_response'] = true;\n $data .= \". Kindly provide your whatsapp number so I can alert you when I find {$this->cache['keyword']} jobs\";\n $data .= $this->cache['location'] ? \" in \".$this->cache['location'] : '';\n Cache::put($this->convoId, $this->cache, 2);\n UtilitiesModel::getWebPage($this->subscribeUrl, $this->cache);\n } else {\n Cache::forget($this->convoId);\n $data = $this->botResponse($userInput);\n }\n\n }\n\n elseif($this->cache['awaiting_whatsapp_response'] && $whatsapp = UtilitiesModel::validatePhone($userInput)) {\n $this->cache['awaiting_whatsapp_response'] = false;\n $this->cache['awaiting_whatsapp_validation'] = true;\n $this->cache['whatsapp'] = $whatsapp;\n Cache::put($this->convoId, $this->cache, 2);\n $data = \"Should I save your whatsapp number as $whatsapp?\";\n }\n elseif($this->cache['awaiting_whatsapp_validation']) {\n if(strpos($userInput, 'yes') !== false || strpos($userInput, 'yea') !== false) {\n $data = \"I will send messages to \".$this->cache['whatsapp'].\" when I find \".$this->cache['keyword'].\" jobs\";\n $data .= $this->cache['location'] ? \" in \".$this->cache['location'] : \"\";\n\n $this->cache['awaiting_whatsapp_validation'] = false;\n $this->cache['awaiting_telegram_response'] = true;\n// $data .= \". Kindly provide your telegram number so I can alert you when I find {$this->cache['keyword']} jobs\";\n// $data .= $this->cache['location'] ? \" in \".$this->cache['location'] : '';\n\n UtilitiesModel::getWebPage($this->subscribeUrl, $this->cache);\n } else {\n Cache::forget($this->convoId);\n $data = $this->botResponse($userInput);\n }\n }\n\n elseif($this->cache['awaiting_telegram_response'] && $telegram = UtilitiesModel::validatePhone($userInput)) {\n $this->cache['awaiting_telegram_response'] = false;\n $this->cache['awaiting_telegram_validation'] = true;\n $this->cache['telegram'] = $telegram;\n Cache::put($this->convoId, $this->cache, 2);\n $data = \"Should I save your telegram number as $telegram?\";\n }\n elseif($this->cache['awaiting_telegram_validation']) {\n if(strpos($userInput, 'yes') !== false || strpos($userInput, 'yea') !== false) {\n $data = \"I will send messages to \".$this->cache['telegram'].\" when I find \".$this->cache['keyword'].\" jobs\";\n $data .= $this->cache['location'] ? \" in \".$this->cache['location'] : \"\";\n\n Cache::put($this->convoId, $this->cache, 2);\n\n } else {\n Cache::forget($this->convoId);\n $data = $this->botResponse($userInput);\n }\n }\n\n //if it's none\n elseif($userInput == 'clear') {\n\n DB::table('conversation_log')->where('convo_id', request('convo_id'))->delete();\n $data = \"Now we can have a fresh start!\";\n }\n else {\n $data = $this->botResponse($userInput);\n }\n\n $response['status'] = true;\n $response['message'] = $data;\n\n return $response;\n }", "function welcome_message_login()\n{\n\tglobal $SITEURL;\n\t$Feul = new Feul;\n\tif(isset($_SESSION['LoggedIn']))\n\t{\n\t\t$name = $_SESSION['Username'];\n\t\t//Display Welcome Message\n\t\t$welcome_box = '<div class=\"user_login_welcome_box_container\"><span class=\\\"user-login-welcome-label\\\">Добро пожаловать: </span>'.$name.'</div>';\n\n\t\t//Display Logout Link\n\t\t$logout_link = '<a href=\"'.$SITEURL.'?logout=yes\" class=\"user-login-logout-link\">Выйти</a>';\n\t\techo $Feul->getData('welcomebox').$welcome_box.$logout_link ;\n\t}\n}", "function send_reply($chatid, $msgid, $text){\r\n global $debug;\r\n $data = array(\r\n 'chat_id' => $chatid,\r\n 'text' => $text,\r\n 'parse_mode' => 'Markdown'\r\n //'reply_to_message_id' => $msgid // <---- biar ada reply nya balasannya, opsional, bisa dihapus baris ini\r\n );\r\n //Memproses pesan response dari server lokal agar bisa di kirim ke bot\r\n // mengubah \r\n $options = array(\r\n 'http' => array(\r\n 'header' => \"Content-type: application/x-www-form-urlencoded\\r\\n\",\r\n 'method' => 'POST',\r\n // 'ignore_errors' => true,\r\n 'content' => http_build_query($data),\r\n ),\r\n );\r\n $context = stream_context_create($options); \r\n $result = file_get_contents(request_url('sendMessage'), false, $context);\r\n\r\n if ($debug) \r\n print_r($result);\r\n}", "private function replyBot(): string\n { \n $asc_cmd = preg_replace('/\\({.+/s', '', $this->lang['respond']['bio']['wait_approve'] );\n $asc_cmd = trim($asc_cmd);\n\n switch ( true ) {\n case preg_match( '/\\b(' . $asc_cmd . ')\\b/iu', $this->info['reply_text'] ):\n if ( !$this->is_admin )\n return $this->lang['respond']['not_admin'];\n\n if ( !in_array($this->info['msg_text'], $this->lang['command']['confirm']) ) {\n return $this->lang['respond']['bio']['not_approved']; // Bio not approved\n } else {\n preg_match( \"/\\((.*?)\\)/\", $this->info['reply_text'], $user_id ); // Return id inside brackets\n $bio = preg_replace( \"/^.+\\:\\n/\", '', $this->info['reply_text'] ); // Removes all text before colon\n $this->db_post->updateBio( $bio, $user_id[1] );\n return $this->lang['respond']['bio']['approved']; // Bio approved\n }\n case preg_match( '/\\b('. $this->lang['respond']['tanos']['list'] . ')\\b/u', $this->info['reply_text'] ):\n if ( !$this->is_admin )\n return $this->lang['respond']['not_admin'];\n\n $status = $this->tg->getStatus( $this->info['chat_id'], $this->bot['id'] );\n if ( $this->info['reply_date'] + 120 < time() ){\n return $this->lang['respond']['tanos']['overtime'];\n } elseif ( !in_array($this->info['msg_text'], $this->lang['command']['confirm']) ) {\n return $this->lang['respond']['bio']['not_approved'];\n } elseif ( $status !== 'administrator' ) {\n return $this->lang['respond']['tanos']['bot_not_adm'];\n } else {\n preg_match_all( \"/\\((.*?)\\)/\", $this->info['reply_text'], $user_array );\n $results = $this->tg->kickMembers( $user_array[1], $this->info['chat_id'] );\n $this->db_post->kickUsers( $user_array[1] );\n return $this->lang['respond']['tanos']['goodbye'];\n }\n default:\n exit('ok');\n }\n }", "public function chat_exec()\r\n {\r\n if(isset($_POST['method']) === true && empty($_POST['method']) === false){\r\n $method = trim($_POST['method']);\r\n if($method === 'fetch'){\r\n $messages = $this->Ajax->fetchMessages();\r\n if(empty($messages) === true){\r\n echo 'There are currently no messages in the chat';\r\n } else {\r\n foreach ($messages as $message){?>\r\n <div class=\"message\"><?php\r\n if(strlen($message['user_id']) === 10){?>\r\n <a href=\"#\"><?=Sessions::get('user')?></a> says:<?php\r\n }else{ ?>\r\n <a href=\"#\"><?=$message['username']?></a> says:<?php\r\n }?>\r\n <p><?=nl2br($message['message'])?></p>\r\n </div><?php \r\n }\r\n }\r\n }else if($method === 'throw' && isset($_POST['message']) === true){\r\n $message = trim($_POST['message']);\r\n if(empty($message) === false){\r\n $arrData = array('user' => $_SESSION['user_id'], 'message' => $message);\r\n $this->Ajax->throwMessage($arrData);\r\n }\r\n }\r\n }\r\n }", "protected function _welcome()\n {\n $this->out('\n __ ____ _ _______ __\n / |/ (_)_________(_)___ ____ _ / ____(_) /__ _____\n / /|_/ / / ___/ ___/ / __ \\/ __ `/ / /_ / / / _ \\/ ___/\n / / / / (__ |__ ) / / / / /_/ / / __/ / / / __(__ )\n/_/ /_/_/____/____/_/_/ /_/\\__, / /_/ /_/_/\\___/____/\n /____/ ');\n }", "function send_message($chatId, $message){\r\n\t\t\t\t$botToken=\"294190711:AAEIGlNiKaglo-1TuGNu2lSKzysUQRToQQo\";\r\n\t\t\t\t$website=\"https://api.telegram.org/bot\".$botToken;\r\n\r\n\t\t\t\tfile_get_contents($website.\"/sendmessage?parse_mode=markdown&chat_id=\".$chatId.\"&text=\".$message);\r\n\t\t\t}", "function messageTask($fullName, $id, $language, $validEmail){\n echo \"Hello World, this is $fullName with HNGi7 ID $id and email $validEmail using $language for stage 2 task\" ;\n\n //echoing the text\n\n //Hello World, this is Elisha Simeon Ukpong Udoh with HNGi7 ID HNG-01827 and email [email protected] using python for stage 2 task\n\n }", "function StartBot () {\r\n\t\tset_time_limit(0);\r\n\t\t\r\n\t\t// Include the custom functions and settings\r\n\t\tinclude_once(\"irc_functions.php\");\r\n\t\r\n\t\t// mySQL Database Settings\r\n\t\t$IRC_mySQL_Info_Server = \"\";\r\n\t\t$IRC_mySQL_Info_User = \"\";\r\n\t\t$IRC_mySQL_Info_Pass = \"\";\r\n\t\t$IRC_mySQL_Info_DataB = \"\";\r\n\t\r\n\t\t// Connect to the mySQL Database\r\n\t\tIRC_mySQL_Connect(\"$IRC_mySQL_Info_Server\",\"$IRC_mySQL_Info_User\",\"$IRC_mySQL_Info_Pass\",\"$IRC_mySQL_Info_DataB\");\r\n\t\t \r\n\t\t// Unset the variables for security\r\n\t\tunset($IRC_mySQL_Info_Server);\r\n\t\tunset($IRC_mySQL_Info_User);\r\n\t\tunset($IRC_mySQL_Info_Pass);\r\n\t\tunset($IRC_mySQL_Info_DataB);\r\n\t\r\n\t\t// IRC Server Settings Retrieved from database\r\n\t\t$IRC_Server_IP = IRC_Setting(ServerIP);\r\n\t\t$IRC_Server_Port = IRC_Setting(ServerPort);\r\n\t\t$IRC_Server_Pass = IRC_Setting(ServerPass);\r\n\t\t$IRC_Server_Nick = IRC_Setting(ServerNick);\r\n\t\r\n\t\t// Print Various Bot Info\r\n\t\tIRC_Info(\"$IRC_Server_IP\",\"$IRC_Server_Port\",\"$IRC_Server_Pass\",\"$IRC_Server_Nick\");\r\n\t\r\n\t\t// Start the Bot\r\n\t\tIRC_Start(\"$IRC_Server_IP\",\"$IRC_Server_Port\",\"$IRC_Server_Pass\",\"$IRC_Server_Nick\");\r\n\t\r\n\t}", "private function send(): void\n {\n $data = [\n 'code' => $this->status,\n 'message' => $this->message,\n 'datetime' => Carbon::now()\n ];\n\n $config = config(\"tebot.$this->channelConfig\");\n\n $data['title'] = $this->title . ' ' . $config['name'];\n\n if (!empty($this->detail)) $data['detail'] = json_encode($this->detail);\n\n Http::withHeaders(['x-api-key' => $config['key']])->post($config['url'] . '/api/message', $data);\n }", "public function actionSendMessage() {\n\n // get data, sent by client\n $data = Yii::app()->request->getPost('chat', array());\n\n // try to store message\n $model = new Chat();\n $result = $model->storeMessage($data);\n\n // prepare return array, set status\n $response = array(\n 'status' => (bool)$result\n );\n\n // encode return array\n echo json_encode($response);\n\n // force app to end\n Yii::app()->end();\n\t}", "protected function _welcome(){\n\t}", "public function run()\n {\n \\Setting::Lang('ar')->set('twitter','shari__sa');\n }", "public function telegram($mensagem) {\n// Criar bot na api do telegram\n$tele_key = \"1339299608:AAHtPXXEh4nqdlDbdhKfasSw8RtfYULn9mo\";\n// ID pego na Classe TelegramBotHandler dando um var_dump no $result\n$tele_channel = \"-1001264785539\";\n// Setar a classe do telegram\n$tele_handler = new TelegramBotHandler(\n // API key\n $tele_key,\n // Channel\n $tele_channel,\n // Level\n Logger::INFO\n );\n\n $tele_handler->setFormatter( new LineFormatter(\"%level_name%: %message%\"));\n $this->logger->pushHandler($tele_handler);\n $this->logger->info( '|Nome do cliente: '. $mensagem['name'] . \n '|Telefone: ' . $mensagem['telefone'] . \n '|Email: ' . $mensagem['email'] .\n '|assunto: ' . $mensagem['assunto'] .\n '|Mensagem: ' . $mensagem['mensagem']\n , ['info' => true] );\n\n }", "public function textmsgIndex() {\n\n\t\t$viewDataController = new ViewDataController();\n $data = $viewDataController->buildData();\n\n Session::forget('text_message_campaign_users');\n\n if( isset($data['profile_img_loc']) ){\n $data['profile_img_loc'] = 'https://s3-us-west-2.amazonaws.com/asset.plexuss.com/users/images/'.$data['profile_img_loc'];\n }\n\n if( $data['is_agency'] == 1 ){\n $type = 'agency';\n }else{\n $type = 'admin';\n\n $is_admin_premium = $this->validateAdminPremium();\n\n if (!$is_admin_premium) {\n return redirect( '/admin/premium-plan-request' );\n }\n }\n\n $data['title'] = 'Text Messaging';\n $data['currentPage'] = $type.'-textmsg';\n $data['adminType'] = $type;\n\n //student list generated from approval page for group messaging\n\t\t$data['student_list'] = array();\n\t\t$data['student_count'] = 0;\n\n\t\tif( Cache::has(env('ENVIRONMENT').'_'.$data['user_id'].'_studentList') ){\n\t\t\t$data['student_list'] = Cache::pull(env('ENVIRONMENT').'_'.$data['user_id'].'_studentList');\n\t\t\t$data['student_count'] = count($data['student_list']);\n\t\t}\n\n $data = $this->generateListOfCampaigns($data, 1, NULL, true);\n\n $data = $this->getMessageTemplates($data);\n\n //get states\n \n if (Cache::has(env('ENVIRONMENT') .'_all_states_with_abbr')) {\n $states = Cache::get(env('ENVIRONMENT') .'_all_states_with_abbr');\n\n }else{\n\n $zc = new ZipCodes;\n \t\t$states = $zc->getAllUsStateAbbreviation();\n Cache::put(env('ENVIRONMENT') .'_all_states_with_abbr', $states, 120);\n }\n\n $data['states'] = $states;\n\n $data['txt_first_time'] = true;\n\n $pp = PurchasedPhone::on('rds1')->where('org_branch_id', $data['org_branch_id'])->first();\n\n if (isset($pp) && !empty($pp)) {\n \t$data['txt_first_time'] = false;\n \t$data['purchased_phone'] = $pp->phone;\n }\n\n $at = AdminText::where('org_branch_id', $data['org_branch_id'])->first();\n\n if(isset($at) && !empty($at)){\n \t$data['num_of_free_texts'] = $at->num_of_free_texts;\n \t$data['num_of_eligble_texts'] = $at->num_of_eligble_texts;\n \t$data['textmsg_tier'] = $at->tier;\n \t$data['flat_fee_sub_tier'] = $at->flat_fee_sub_tier;\n \t$data['textmsg_expires_date'] = Carbon::parse($at->expires_at);\n \t$data['auto_renew'] = $at->auto_renew;\n }\n \n $data['current_time'] = Carbon::now();\n\n $data['free_text_countries'] = FreeTextCountry::select('country_code', 'country_name')->get();\n // dd($data['free_text_countries']);\n\n return View('groupMessaging.index', $data);\n\t}", "function sendMenu0($chat,$text,$messenger='',$menu=[]){\r\n $keyboard = array();\r\n\t\r\n\tif (count($menu)>0) $keyboard=$menu;\r\n\r\n\tif ((MESSENGER=='viber')||($messenger=='viber')){\r\n\t\t//sendMsg($chat,$help);\r\n\t\tviberMenu($chat,$text,'',$keyboard);\r\n\t}\r\n\r\n\tif ((MESSENGER=='telegram')||($messenger=='telegram')){\r\n //hideMenu($chat);\r\n sendKeyboard($chat, \"$text\" , 'html',0 , $keyboard,0);\r\n\t}\r\n}", "public function index()\n {\n $data = \\App\\BotSpeak::all();\n \n return view('bot_command', ['data'=>$data]);\n }", "public function p_login(){\n \n /* If box is checked then this is a noob and we need to sign him in.*/\n if (isset($_POST['checkbox'])) {\n\t $_POST = DB::instance(DB_NAME)->sanitize($_POST);\t\t\t\t\t\t//sanitize the POST var of cooties\n\t $_POST['password'] = sha1(PASSWORD_SALT.$_POST['password']); \t\t\t\t//hash and salt the PW\n\t $_POST['token'] = sha1(TOKEN_SALT.$_POST['username'].Utils::generate_random_string()); \t//make a token\n\t \n\t $_POST['username'] = htmlspecialchars($_POST['username'], ENT_QUOTES, 'UTF-8');\t\t//sanitize the username of SQLi cooties\n\t \n\t //check if that username is taken.\n\t$q = 'SELECT count(*)\n FROM users\n WHERE username = \"'.$_POST['username'].'\"';\n\t$count = DB::instance(DB_NAME)->select_rows($q);\n\t\n\tif(intval($count[0]['count(*)']) >= 1) { \t//username taken\n Router::redirect('/users/login/error');\n } else {\t\t\t\t\t//username not taken\t\n\t\t//make the user and dump him into chat\n\t\tDB::instance(DB_NAME)->insert_row('users',$_POST);\n\t\t\n\t\t//get the token from the DB and sanitize it\n\t\t$q = 'SELECT token\n\t\t FROM users\n\t\t WHERE username = \"'.$_POST['username'].'\"\n\t\t AND password = \"'.$_POST['password'].'\"';\n\t\t \n\t\t$token = DB::instance(DB_NAME)->select_field($q);\n\t\t$token = DB::instance(DB_NAME)->sanitize($token);\n\t\t#success\n\t\tif($token) {\n\t\t //name, actual value, time length, directory access\n\t\t //pull out cookie from browser developer tools\n\t\t setcookie('token', $token, strtotime('+1 year'), '/');\n\t\t //drop a info message in chat about joining!\n\t\t $q = 'SELECT user_id\n\t\t FROM users\n\t\t WHERE token = \"'.$token.'\" ';\n\t\t $user_id = DB::instance(DB_NAME)->select_field($q);\n\n\t\t $q = 'INSERT INTO `messages`(`message`, `user_id`, `flag`) VALUES ('.\"'has entered the chat!'\" .','.\"'$user_id'\".','.\"'2'\".')';\n\t \n\t\t DB::instance(DB_NAME)->query($q);\n\t\t \n\t\t Router::redirect('/chat');\n\t\t}\n\t\t#fail\n\t\telse {\n\t\t Router::redirect('/users/login/error');\n\t\t }//end little else\n\t } //end big else\n\t} else { //person is not a noob\n\t $_POST = DB::instance(DB_NAME)->sanitize($_POST);\n\t $_POST['password'] = sha1(PASSWORD_SALT.$_POST['password']);\n\t \n\t //get the token from the DB and sanitize it\n\t $q = 'SELECT token\n\t\tFROM users\n\t\tWHERE username = \"'.$_POST['username'].'\"\n\t\tAND password = \"'.$_POST['password'].'\"';\n\t\t\n\t $token = DB::instance(DB_NAME)->select_field($q);\n\t $token = DB::instance(DB_NAME)->sanitize($token);\n\t #success\n\t if($token) {\n\t\t//name, actual value, time length, directory access\n\t\t//pull out cookie from browser developer tools\n\t\tsetcookie('token', $token, strtotime('+1 year'), '/');\n\t\t\n\t\t //drop a info message in chat about joining!\n\t\t $q = 'SELECT user_id\n\t\t FROM users\n\t\t WHERE token = \"'.$token.'\" ';\n\t\t $user_id = DB::instance(DB_NAME)->select_field($q);\n\n\t\t $q = 'INSERT INTO `messages`(`message`, `user_id`, `flag`) VALUES ('.\"'has entered the chat!'\" .','.\"'$user_id'\".','.\"'2'\".')';\n\t \n\t\t DB::instance(DB_NAME)->query($q);\n\t\t\n\t\tRouter::redirect('/chat');\n\t }\n\t #fail\n\t else {\n\t Router::redirect('/users/login/error');\n\t }\n\t\t \n }//end big if\n \n }", "public function message()\n {\n $result = $this->dtbs->list('message');\n $data['info'] = $result;\n $this->load->view('back/message/anasehife',$data);\n }", "function __construct() {\n $this->name=\"vk_bot\";\n $this->title=\"Вконтакте\";\n $this->module_category=\"<#LANG_SECTION_APPLICATIONS#>\";\n $this->checkInstalled();\n}", "private function _broFist()\n {\n $this->_message(\"..............__\");\n $this->_message(\"......../´¯/''/´`¸\");\n $this->_message(\"...../'/../../..../¨¯\\\\\");\n $this->_message(\"...('(...´..´.¯~/'..')\");\n $this->_message(\"....\\...........'.../\");\n $this->_message(\".....\\...\\.... _.·´\");\n $this->_message(\"......\\.......(\");\n $this->_message(\"BRO FIST\");\n }", "public function run()\n {\n\t\t// thank_you\n\t\t$thank_you = Intent::where('name', 'thank_you')->first();\n\t\tDocument::custom_create('cảm ơn nhé (thanks, tks, cám ơn)', $thank_you->id);\n\t\tDocument::custom_create('thanks (cám ơn, cảm ơn, thank, tks, )', $thank_you->id);\n\t\tDocument::custom_create('thank you (cảm ơn)', $thank_you->id);\n\t\tDocument::custom_create('cám ơn (cảm ơn, thank, thanks)', $thank_you->id);\n\t\tDocument::custom_create('tks (cảm ơn, cám ơn)', $thank_you->id);\n\t\tDocument::custom_create('(cám ơn, cảm ơn) nhiều nhé', $thank_you->id);\n\t\tDocument::custom_create('cảm ơn (cám ơn, thanks, thank, tks, )', $thank_you->id);\n\t\tDocument::custom_create('cảm ơn bạn nhé (cám ơn, thanks, thank)', $thank_you->id);\n\t\tDocument::custom_create('thanks bạn (cám ơn, cảm ơn, thank, tks, )', $thank_you->id);\n\t\tDocument::custom_create('xin cảm ơn nhà hàng (cám ơn, thanks, thank, tks)', $thank_you->id);\n\t\tDocument::custom_create('thanks so much (cảm ơn, cám ơn)', $thank_you->id);\n\t\tDocument::custom_create('cảm ơn nhiều nhé (cám ơn, thanks, thank)', $thank_you->id);\n\t\tDocument::custom_create('Xin cảm ơn (cám ơn, thanks, thank, tks, )', $thank_you->id);\n\t\tDocument::custom_create('Cảm ơn đã trả lời tin nhắn (cám ơn, thanks, thank, tks, )', $thank_you->id);\n\t\tDocument::custom_create('Cảm ơn (cám ơn, thanks, thank, tks) đã giúp', $thank_you->id);\n\t\tDocument::custom_create('Thank (thanks, cám ơn, cảm ơn, tks, ) nhiều nhé', $thank_you->id);\n\t\tDocument::custom_create('Thật sự cảm ơn (cám ơn, thanks, thank, tks)', $thank_you->id);\n }", "function startupHandler($param)\n {\n if (true) {\n $app = $param['source']->getApplication();\n $app->removeStyle('common/static/common.css');\n $app->addStyle('/static/tuit.css');\n\n $session_id = $_COOKIE['sessionid'];\n \n $ch = curl_init();\n $server_host = $_SERVER['SERVER_ADDR'];\n $browser_host = $_SERVER['HTTP_HOST'];\n $request_uri = $_SERVER['REQUEST_URI'];\n $server_port = $_SERVER['SERVER_PORT'];\n //\tmessage($_SERVER);\n $port_part = ($server_port != 80)?\":$server_port\":\"\";\n $port_part=\"\";\n\t \n\t \n\t //echo \"http://\" .$server_host . $port_part.\"/tuit/account/session/\";\n\t \t \n curl_setopt($ch, CURLOPT_URL, \"http://\" .$server_host . $port_part.\"/tuit/account/session/\");\n curl_setopt($ch, CURLOPT_HEADER, 0);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);\n curl_setopt($ch, CURLOPT_COOKIE, \"sessionid=$session_id\");\n $res = curl_exec($ch);\n $info = curl_getinfo($ch);\n curl_close($ch);\n //message($_SERVER);\n\t //print_r($info);\n\t \n if ($res !== false) {\n\t \n $msg = json_decode($res);\n //message($msg);\n \n if ($msg != null && strlen($msg->username)) {\n $vg = property::get('loginTuit.viewGroup');\n $eg = property::get('loginTuit.editGroup');\n $ag = property::get('loginTuit.adminGroup');\n $can_view=$can_edit=$can_admin=0;\n if ($vg == '' || in_array($vg, $msg->groups)) {\n $can_view = 1;\n }\n if ($eg == '' || in_array($eg, $msg->groups)) {\n $can_edit = 1;\n }\n if ($ag == '' || in_array($ag, $msg->groups)) {\n $can_admin = 1;\n }\n \n //message(\"view: $can_view, edit: $can_edit, admin: $can_admin\");\n \n ciUser::setUser($msg->username,$msg->first_name . \" \" . $msg->last_name, $msg->email, $can_view, $can_edit, $can_admin);\n $param['source']->addContent('main_menu_pre',sprintf(\"<ul class='user_info'><li class='username'><a href='/tuit/account/%s'>%s - %s</a></li>\\n<li class='logout_button'><a href='/tuit/account/logout'>\"._(\"Log out\").\"</a></li></ul>\\n\",\n ciUser::$_me->username,\n ciUser::$_me->username,\n ciUser::$_me->fullname));\n \n return;\n }\n \n /* message(\"Status: \" . $info['http_code']);\n message(\"Got back \" . strlen($res) . \" characters of information\");\n message(\"Output from session query: \" . $res);\n */\n \n }\n util::redirect(\"http://\" .$browser_host .\"/tuit/account/login/?next=\" . urlencode($request_uri));\n\n }\n else {\n \n $username = $_SERVER['REMOTE_USER'];\t\n if($username) {\n ciUser::loginUser($username);\n }\n }\n \n \n }", "public function responseMsg()\n\t{\n\t\t$postStr = $GLOBALS[\"HTTP_RAW_POST_DATA\"];\n\t\t\n \t//extract post data\n\t\tif (!empty($postStr))\n\t\t{\n /* libxml_disable_entity_loader is to prevent XML eXternal Entity Injection,\n the best way is to check the validity of xml by yourself */\n\t\t\t\t// 使用simplexml技术对xml进行解析 \n\t\t\t\t// libxml_disable_entity_loader(true), 是从安全性考虑,为了防止xml外部注入,\n\t\t\t\t//只对xml内部实体内容进行解析\n libxml_disable_entity_loader(true);\n\t\t\t\t//加载 postStr 字符串\n $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);\t\t\t\n $fromUsername = $postObj->FromUserName;\n $toUsername = $postObj->ToUserName;\n $keyword = trim($postObj->Content);\n $time = time();\n global $tmp_arr;\n\n\t\t\t\t//连接Mysql数据库,并添加信息\n\n switch($postObj->MsgType)\n {\n \tcase 'event':\n \tif($postObj->Event == 'subscribe')\n \t{\t\t\n\n //获取用户信息并入库 \n \t\trequire_once 'get_token.php';\n \t\theader('content-type:text/html;charset=utf-8');\n //获取用户的$openid\n \t\t$url = \"https://api.weixin.qq.com/cgi-bin/user/info?access_token={$access_token}&openid={$fromUsername}\";\n //发送请求\n \t\t$res = http_request($url, null);\n \t\t$res = json_decode($res);\n //获取我们需要的各种信息\n \t\t$openid = $res->openid;\n \t\t$nickname = $res->nickname;\n \t\t$country = $res->country;\n \t\t$province = $res->province;\n \t\t$city = $res->city;\n \t\t$address = $country. ' '. $province. ' '. $city;\n \t\t$sex = $res->sex;\n \t\t$contentStr =\" 嘿,亲爱的 \". $nickname .\"\\n\\r这里是 【 废品回收管理中心 】\\n\\r功能研究请戳导航栏~\\n\\r更多功能期待您的发现~ \";\n \t\t$resultStr = sprintf($tmp_arr['text'], $fromUsername, $toUsername, $time, $contentStr);\n \t\techo $resultStr;\n \t}\n //用户取消关注\n \tif($postObj->Event == 'unsubscribe')\n \t{\n \t\t//应该做一个删除动作\n \t}else if($postObj->Event == 'LOCATION')\n \t{\n\t\t\t\t\t\t\t//取出该用户上报的纬度和经度\n \t\t$Latitude = $postObj->Latitude;\n \t\t$Longitude = $postObj->Longitude;\n\t\t\t\t\t\t\t//返回给用户\n\t\t\t\t\t\t\t// $contentStr = \"我们收到您上报的地理位置:\\n\\n 纬度是: {$Latitude}\\n 经度是:{$Longitude}\";\n\t\t\t\t\t\t\t// $resultStr = sprintf($tmp_arr['text'], $fromUsername, $toUsername, $time, $contentStr);\n\t\t\t\t\t\t\t// echo $resultStr;\n \t}\n\t\t\t\t\t\t//响应用户的点击事件\n \tif($postObj->Event == 'CLICK' )\n \t{\n \t\tif($postObj->EventKey == 'V1001_GOOD')\n \t\t{\n\t\t\t\t\t\t\t\t//这里你就可以写自己的逻辑代码,返回一句话\n \t\t\t$contentStr = \"微信:10010\";\n \t\t\t$resultStr = sprintf($tmp_arr['text'], $fromUsername, $toUsername, $time, $contentStr);\n \t\t\techo $resultStr; \n \t\t}\n \t}\n \tbreak;\n \tcase 'text':\n\t\t\t\t\t\t\t// $sql = \"INSERT INTO `zx_info` (`id`, `openid`, `zx_info`) VALUES(NULL, '{$fromUsername}', '{$keyword}')\";\n\t\t\t\t\t\t\t// mysql_query($sql);\n \t$contentStr = \"暂不支持回复功能,快点击下方按钮进行废品回收吧~~\";\n \t$resultStr = sprintf($tmp_arr['text'], $fromUsername, $toUsername, $time, $contentStr);\n \techo $resultStr;\n \tbreak;\n\t\t\t\t\t//处理用户上传图片\n \tcase 'image':\n\t\t\t\t\t\t//回复用户刚刚上传的这张图片\n\t\t\t\t\t\t//获取到用户上传的图片的mediaid\n \t$media_id = $postObj->MediaId;\n \t$resultStr = sprintf($tmp_arr['image'], $fromUsername, $toUsername, $time, $media_id);\n \techo $resultStr;\n\n\t\t\t\t\t\t//把图片保存到本地服务器的文件系统\n\t\t\t\t\t\t//1. 先给图片创建一个名字\n \t$image_file_name = time(). \".jpg\";\n\t\t\t\t\t\t//2. 获取该图片的内容\n \t$image_file = file_get_contents($postObj->PicUrl);\n\t\t\t\t\t\t//3. 保存到本地服务器的文件系统, 特别提醒,应当保证该你创建的文件夹是www用户可读可写,否\n\t\t\t\t\t\t//无法保存该图片到文件夹 \n \tfile_put_contents(\"./uploadimage/\". $image_file_name, $image_file);\n\n\t\t\t\t\t\t//将图片的路径和相关信息入库\n\t\t\t\t\t\t//1. 创建一张表\n\t\t\t\t\t\t//2. 连接Mysql数据库,并添加图片信息\n \t$connect = mysql_connect('localhost', 'root', 'root');\n \tmysql_select_db('wxdb', $connect);\n \tmysql_query('SET NAMES UTF8');\n \t$media_path = \"./uploadimage/\". $image_file_name;\n \t$sql = \"INSERT INTO keep_image_uploads (id, openid, media_id, media_path) VALUES(NULL, '{$fromUsername}', '{$media_id}', '{$media_path}')\";\n \tmysql_query($sql, $connect);\n \tbreak;\n\t\t\t\t\t\t//处理用户上传语言的业务逻辑\n \tcase 'voice':\n \t$media_id = $postObj->MediaId;\n \t$resultStr = sprintf($tmp_arr['voice'], $fromUsername, $toUsername, $time, $media_id);\n \techo $resultStr;\n \tbreak;\n\t\t\t\t\t\t//处理用户上传的地理位置信息\n \tcase 'location':\n\t\t\t\t\t\t//获取到用户上传的经度\n \t$Location_Y = $postObj->Location_Y;\n\t\t\t\t\t\t//获取上传的纬度\n \t$Location_X = $postObj->Location_X;\n \t$contentStr = \"您上报的地理位置是: \\n\\n 经度是 {$Location_Y} \\n 纬度是{$Location_X}\";\n \t$resultStr = sprintf($tmp_arr['text'], $fromUsername, $toUsername, $time, $contentStr);\n \techo $resultStr;\n \tbreak;\n\t\t\t\t\t\t//处理用户发送的链接消息\n \tcase 'link':\n\t\t\t\t\t\t//获取到用户上传的链接信息\n \t$Title = $postObj->Title;\n \t$Url = $postObj->Url;\n \t$contentStr = \"<a href='{$Url}'>{$Title}</a>\";\n \t$resultStr = sprintf($tmp_arr['text'], $fromUsername, $toUsername, $time, $contentStr);\n \techo $resultStr;\n \tbreak;\n\t\t\t\t\t//default:\n }\n }else {\n \techo \"\";\n \texit;\n }\n }", "function sen_sms($to,$text)///ส่ง sms\n{ //create client with api key and secret\n $rest = substr($to, 1);\n $client = new Nexmo\\Client(new Nexmo\\Client\\Credentials\\Basic('c21feb7d', 'yrxEwwXERXj8yv7L'));\n $message = $client->message()->send([\n 'to' => '66'.$rest,\n 'from' => 'RFLpang',\n 'text' => $text,\n 'type' => 'unicode'\n ]);\n //array access provides response data\n //echo \"Sent message to \" . $message['to'] . \". Balance is now \" . $message['remaining-balance'] . PHP_EOL;\n\n return \"Sent message to \" . $message['to'] . \". Balance is now \" . $message['remaining-balance'] . PHP_EOL;\n}", "function askQuestion($b) //ask user the chosen question LEVEL = question_asked\n{\n global $user_id;\n global $db;\n global $message_id;\n global $locale;\n $string = returnQuestion($b);\n if ($locale == \"farsi\")\n makeCurl(\"editMessageText\", [\"chat_id\" => $user_id, \"message_id\" => $message_id, \"text\" => $string, \"reply_markup\" => json_encode([\n \"inline_keyboard\" => [\n [\n [\"text\" => '💤 نمیدونم', \"callback_data\" => \"Ca_nC_31\"]\n ]\n ]\n ])]);\n elseif ($locale == \"english\")\n makeCurl(\"editMessageText\", [\"chat_id\" => $user_id, \"message_id\" => $message_id, \"text\" => $string, \"reply_markup\" => json_encode([\n \"inline_keyboard\" => [\n [\n [\"text\" => \"Cancel\", \"callback_data\" => \"Ca_nC_31\"]\n ]\n ]\n ])]);\n\n mysqli_query($db, \"UPDATE padporsc_bot4.users SET current_level = 'question_asked' WHERE user_id = {$user_id}\");\n\n}", "public function helloMessage($time) {\n\t\t\n\t\t\t$langs[1] = \"English in case you weren't sure ;)\";\n\t\t\t$langs[2] = \"German\";\n\t\t\t$langs[3] = \"French\";\n\t\t\t$langs[4] = \"Italian\";\n\t\t\t$langs[5] = \"Portuguese\";\n\t\t\t$langs[6] = \"Russian\";\n\t\t\t$langs[7] = \"Spanish\";\n\t\t\t$langs[8] = \"Greek\";\n\t\t\t$langs[9] = \"Chinese\";\n\t\t\t$langs[10] = \"Dutch\";\n\t\t\t$langs[11] = \"Lithuanian\";\n\t\t\t\n\t\t\t$pickLang = rand(1, count($langs));\n\t\t\t\n\t\t\t// Populate Languages\n\t\t\t// Good Morning\n\t\t\t$languages[1][1] = \"Good Morning\";\n\t\t\t$languages[1][2] = \"Guten Morgen\";\n\t\t\t$languages[1][3] = \"Bonjour\";\n\t\t\t$languages[1][4] = \"Buongiorno\";\n\t\t\t$languages[1][5] = \"Bom dia\";\n\t\t\t$languages[1][6] = \"Доброе утро\";\n\t\t\t$languages[1][7] = \"Buenos días\";\n\t\t\t$languages[1][8] = \"Καλημέρα\";\n\t\t\t$languages[1][9] = \"早晨好\";\n\t\t\t$languages[1][10] = \"Goedemorgen\";\n\t\t\t$languages[1][11] = \"Labas Rytas\";\n\t\t\n\t\t\t// Good Afternoon\n\t\t\t$languages[2][1] = \"Good Afternoon\";\n\t\t\t$languages[2][2] = \"Guten Tag\";\n\t\t\t$languages[2][3] = \"Bonjour\";\n\t\t\t$languages[2][4] = \"Buon pomeriggio\";\n\t\t\t$languages[2][5] = \"Boa tarde\";\n\t\t\t$languages[2][6] = \"Добрый день\";\n\t\t\t$languages[2][7] = \"Buonas tardes\";\n\t\t\t$languages[2][8] = \"Καλό απόγευμα\";\n\t\t\t$languages[2][9] = \"你好\";\n\t\t\t$languages[2][10] = \"Goede Middag\";\n\t\t\t$languages[2][11] = \"Labą Dieną\";\n\n\t\t\t// Good Evening\n\t\t\t$languages[3][1] = \"Good Evening\";\n\t\t\t$languages[3][2] = \"Guten Abend\";\n\t\t\t$languages[3][3] = \"Bonsoir\";\n\t\t\t$languages[3][4] = \"Buona sera\";\n\t\t\t$languages[3][5] = \"Boa noite\";\n\t\t\t$languages[3][6] = \"Добрый вечер\";\n\t\t\t$languages[3][7] = \"Buonas noches\";\n\t\t\t$languages[3][8] = \"Καλό βράδυ\";\n\t\t\t$languages[3][9] = \"晚上好\";\n\t\t\t$languages[3][10] = \"Goede Avond\";\n\t\t\t$languages[3][11] = \"Labas Vakaras\";\n\t\t\n\t\t\t$chosen['greeting'] = $languages[$time][$pickLang];\n\t\t\t$chosen['language'] = $langs[$pickLang];\n\t\t\t$chosen['eng'] = $languages[$time][1];\n\t\t\t\n\t\t\treturn $chosen;\n\t\t}", "function my_hook_monitor_function($keyword, $params)\n{\n global $app_name, $app_version, $nama_modem;\n global $my_kembali_sms_format, $my_kembali_sms_sample;\n // Sometime, you don't need to reply SMS from non-user number,\n // such as SMS from Service Center, message center, \n // or promotional SMS:\n $valid_param_count = 5;\n // pre( $params);\n // return true;\n if (strlen($params['sender'])<=6) {\n return true;\n }\n else\n {\n if (count($params['params'])!=$valid_param_count){\n sms_send($params['sender'], '1/2. SMS tidak valid. Jumlah parameter data harus '.$valid_param_count.'.', $nama_modem);\n sms_send($params['sender'], '2/2. Format SMS: '.$my_monitor_sms_format, $nama_modem);\n sms_send($params['sender'], '3/2. Contoh SMS: '.$my_monitor_sms_sample, $nama_modem);\n }\n else\n {\n $kode_pinjam = strtoupper($params['params'][1]);\n // cek kode pinjam, jika ID = 0, berarti kode pinjam tidak valid:\n $id_pinjam = fetch_one_value(\"select coalesce( (\n select UUID_SHORT() id from inkubator_pinjam p where upper(p.kode_pinjam) = '$kode_pinjam'\n and p.status_pinjam = 'Disetujui' \n ),0) as id\");\n if ($id_pinjam == 0)\n {\n sms_send($params['sender'], 'Kode Pinjam tidak ditemukan: '.$kode_pinjam.'.', $nama_modem); \n } \n else\n { \n // proses SMS dan insert ke table `inkubator_kembali`:\n // Sample: KEMBALI*323431-353131-35*30*3.60*SEHAT;\n $p_pjg = trim($params['params'][ 2]);\n $p_berat = trim($params['params'][ 3]);\n $p_kondisi = strtoupper(trim($params['params'][ 4])); \n // cek tangal, panjang dan berat apakah formatnya sesuai atau tidak.\n // $p_validate_tgl = '/^[0-9]{2}\\/[0-9]{2}\\/[0-9]{4}$/'; // dd/mm/yyyy\n $p_validate_pjg = '/^[0-9]{1,2}+([\\,\\.][0-9]{1,2})?$/'; // max2digits[.,]max2digits\n if (!preg_match($p_validate_pjg, $p_pjg))\n {\n sms_send($params['sender'], 'Maaf. Panjang bayi saat kembali salah. Contoh panjang bayi: 31.5', $nama_modem);\n }\n else\n if (!preg_match($p_validate_pjg, $p_berat))\n {\n sms_send($params['sender'], 'Maaf. Berat bayi saat kembali salah. Contoh berat bayi: 3,12', $nama_modem);\n }\n else\n if (($p_kondisi!='SEHAT') && ($p_kondisi!='SAKIT'))\n {\n sms_send($params['sender'], 'Maaf. Kondisi bayi salah. Harus SEHAT atau SAKIT.', $nama_modem);\n }\n else\n {\n // process tgl, berat & panjang:\n // xx/yy/xxxx\n $p_skor = ($p_kondisi=='SEHAT'?1:0);\n $p_berat = str_replace(',','.', $p_berat);\n $p_pjg = str_replace(',','.', $p_pjg);\n // all set! save it to database.\n $sub_mon_sql = \"insert into inkubator_monitoring \n \t\t(id, kode_pinjam, tgl_input, panjang_bayi, berat_bayi, kondisi, skor, keterangan)\n \t values\n \t\t(UUID_SHORT(), '$kode_pinjam', CURRENT_TIMESTAMP(), $p_pjg, $p_berat, '$p_kondisi', $p_skor,\n \t\tconcat('Data monitoring ', (select p.nama_bayi from inkubator_pinjam p where p.kode_pinjam = '$kode_pinjam'))\n \t );\";\n /*\n $f = fopen('d:/test-.txt','w');\n fputs($f, $save_sql);\n fputs($f, $sub_mon_sql);\n fclose($f);\n */ \n if (exec_query($sub_mon_sql))\n {\n sms_send($params['sender'], 'Data monitoring telah diterima.', $nama_modem);\n }\n else\n {\n sms_send($params['sender'], 'Maaf, server sedang sibuk. Cobalah beberapa saat lagi.', $nama_modem);\n } \n } \n }\n }\n return true;\n } \n}", "function welcome()\n{\n outputString(PHP_EOL.'To set up your Craft install, from your project directory, run:', Console::FG_YELLOW);\n $script = './craft setup';\n outputString(PHP_EOL.' '.$script, Console::FG_GREEN);\n outputString(PHP_EOL.'Then to set up custom settings, run:', Console::FG_YELLOW);\n $script = './marlo';\n outputString(PHP_EOL.' '.$script, Console::FG_GREEN);\n outputString(PHP_EOL.'Your setup is not complete until you run these two commands.', Console::FG_YELLOW);\n}", "function bot_wtc_gTxt($what) {\nglobal $event;\nif($event !== 'article') {\n\treturn;\n}\n\tglobal $language;\n\n\t$en_us = array(\n\t\t'install_message' => 'bot_wtc is not yet properly initialized. Use the button below to create the preferences table.',\n\t\t'upgrade_message' => 'bot_wtc must be upgraded. Use the button below to add the new fields to the preferences table.',\n\t\t'uninstall' => 'Uninstall',\n\t\t'uninstall_message' => 'Using the button below will remove all preferences from the db. <br />Use before a complete uninstall or to reset all preferences. ',\n\t\t'uninstall_confirm' => 'Are you sure you want to delete the preferences table?',\n\t\t'td_warning' => 'Columns cannot be moved relative to single items and vice-versa',\n\t\t'same_item_warning' => 'Oops! You are trying to move an item relative to itself',\n\t\t'combo_warning' => 'Oops! You tried to insert an incomplete rule',\n\t\t);\n\n\t$lang = array(\n\t\t'en-us' => $en_us\n\t\t);\n\n\t\t$language = (isset($lang[$language])) ? $language : 'en-us';\n\t\t$msg = (isset($lang[$language][$what])) ? $lang[$language][$what] : $what;\n\t\treturn $msg;\n}", "function schreibe_Telegram($message, $channel_id)\n{\n $send_message = '';\n // prüfe, ob channel_id vorgegeben wurde\n if (!$channel_id) {\n return;\n }\n //\n $telegram_api_token = Config::get('konstanten.telegram.api_token');\n $telegram_bot_username = Config::get('konstanten.telegram.bot_username');\n $telegram_channel_signature = Config::get('konstanten.telegram.channel_signature');\n //\n $message .= $telegram_channel_signature;\n //\n $send_message = implode(\"\\n\", explode('<br />', $message));\n //\n $telegram_apiRUL = 'https://api.telegram.org/bot' . $telegram_api_token . '/';\n //\n $client = new Client(['base_uri' => $telegram_apiRUL]);\n //\n $client->post('sendMessage',\n [\n 'query' =>\n [\n 'chat_id' => $channel_id,\n 'text' => $send_message,\n 'parse_mode' => 'HTML',\n ]\n ]\n );\n}" ]
[ "0.75831056", "0.6789915", "0.63199896", "0.6314304", "0.628125", "0.62314945", "0.6118826", "0.6118642", "0.6100605", "0.60997593", "0.60969764", "0.60642976", "0.60547507", "0.6050241", "0.60116524", "0.60076785", "0.6004268", "0.59915847", "0.59570676", "0.5947858", "0.5945036", "0.5888603", "0.58413917", "0.58396786", "0.58283573", "0.5809178", "0.57910156", "0.57791764", "0.57785165", "0.57676893", "0.5767494", "0.57641435", "0.5730738", "0.57280254", "0.57247776", "0.5723315", "0.5720409", "0.57107663", "0.57003754", "0.56990933", "0.56844294", "0.5675896", "0.5669241", "0.56660545", "0.56507057", "0.56343484", "0.5624838", "0.5620807", "0.5610792", "0.55986905", "0.5562099", "0.5557658", "0.5554979", "0.5527658", "0.55268896", "0.5512494", "0.5512494", "0.55104655", "0.55073375", "0.549982", "0.5497708", "0.5495564", "0.5494697", "0.54856473", "0.5482867", "0.5478843", "0.545708", "0.54484105", "0.54462063", "0.5444675", "0.54405266", "0.5438163", "0.543712", "0.5436396", "0.5434567", "0.5430682", "0.5429719", "0.54261816", "0.5408376", "0.5404337", "0.54042417", "0.5399941", "0.53726065", "0.5371779", "0.53710985", "0.53708726", "0.5362907", "0.53612494", "0.53579694", "0.53541297", "0.53526604", "0.5348545", "0.53405654", "0.5337589", "0.5332704", "0.53270113", "0.5319985", "0.5317303", "0.5317087", "0.53090495", "0.53088754" ]
0.0
-1
/ / Constructors /
public function __construct (Memcached $memcached) { $this->memcached = $memcached; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function __construct()\t{}", "function _construct() {\n \t\n\t\t\n\t}", "private function __construct( )\n {\n\t}", "private function __construct()\r\n\t{\r\n\t\r\n\t}", "final private function __construct() {\n\t\t\t}", "final private function __construct()\n\t{\n\t}", "private function __construct() {\r\n\t\r\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(){}", "final private function __construct() {}", "final private function __construct() {}", "private function __construct()\n\t{\n\t\t\n\t}", "final private function __construct() { }", "final private function __construct() { }", "final private function __construct() { }", "public function __construct( )\r\n\t{\r\n\t\t// TODO Auto-generated constructor\r\n\t}", "function _construct(){ }", "function __construct() ;", "private function __construct () \n\t{\n\t}", "private function __construct()\r\n\t{\r\n\t}", "final private function __construct(){\r\r\n\t}", "private function __construct()\r\r\n\t{\r\r\n\t}", "private function __construct() {\r\n\t\t\r\n\t}", "private function __construct()\r\n {}", "private function __construct () {}", "private function __construct()\n\t{\n\n\t}", "private function __construct() { \n\t\t\n\n\t}", "function __construct() { }", "function __construct() { }", "function __construct() { }", "function __construct (){\n\t\t}", "public function __construct() {\r\n\t\t// TODO Auto-generated constructor\r\n\t}", "public function __construct() {\r\n\t\t// TODO Auto-generated constructor\r\n\t}", "public function __construct() {\r\n\t\t// TODO Auto-generated constructor\r\n\t}", "private final 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() {}" ]
[ "0.8467337", "0.8248555", "0.8224319", "0.82192165", "0.81950736", "0.81936085", "0.818786", "0.81849396", "0.81849396", "0.81849396", "0.81849396", "0.81849396", "0.81849396", "0.81849396", "0.81849396", "0.81849396", "0.81849396", "0.81849396", "0.81849396", "0.81849396", "0.81849396", "0.81849396", "0.81849396", "0.81849396", "0.81822276", "0.81822276", "0.81578755", "0.814176", "0.814176", "0.814176", "0.813044", "0.8125678", "0.8124871", "0.80908734", "0.8085219", "0.808438", "0.8083165", "0.8069602", "0.8069192", "0.80670804", "0.80651367", "0.8064233", "0.8052851", "0.8052851", "0.8052851", "0.804291", "0.80254775", "0.80254775", "0.80254775", "0.80200595", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774", "0.80196774" ]
0.0
-1
Checks extension is okay
public static function load (array $config) : self { if (!extension_loaded('memcached')) { if (extension_loaded('memcache')) { throw new CacheException("Can't initialize Memcached cache engine: PHP extension memcached not loaded. This class uses the Memcached extension AND NOT the Memcache extension (this one is loaded).</strong>"); } else { throw new CacheException("Can't initialize Memcached cache engine: PHP extension memcached not loaded."); } } $memcached = new Memcached; $memcached->addServer( $config["server"] ?? self::DEFAULT_SERVER, $config["port"] ?? self::DEFAULT_PORT, ); // SASL authentication if (array_key_exists("sasl_username", $config)) { $memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, true); $memcached->setSaslAuthData( $config["sasl_username"], $config["sasl_password"] ?? "", ); } return new self($memcached); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function validExtension() {\t\n\t\tif(in_array($this->extension, $this->extensions)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "protected function checkExtension() {\n\t\t\n\t\t//If no extensions set, all are valid\n\t\tif(empty($this->valid_extensions)) {\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t$extension = $this->getExtension();\n\t\t\n\t\treturn in_array($extension, $this->valid_extensions) ? true : false;\n\t\t\n\t}", "public function extensionValid() \n\t{\n\t\tif (!in_array($this->extension_of_file, $this->file_types)) //{\n\t\t\tthrow new Exception(\"Invalid file Extension\",5);\n\t\t//}\n\t}", "public function checkExtensions()\r\n\t{\r\n\t\treturn (strcasecmp(pathinfo($this->targetFile, PATHINFO_EXTENSION), pathinfo($this->referenceFile, PATHINFO_EXTENSION)) === 0);\r\n\t}", "function is_valid_extension ($ext) {\n $ext = strtolower($ext);\n return (is_valid_image_extension($ext) || is_valid_audio_extension($ext)\n || is_valid_video_extension($ext));\n }", "public function checkExtObj() {}", "public function checkExtObj() {}", "public function testSetAllowedExtensionsFail() {\n $dl2 = new downloader();\n $dl2->setAllowedExtensions(array('jpg' => 'image/jpeg',\n 'pl' => 'application/x-perl'));\n $this->assertTrue($dl2->areErrors());\n\n // one invalid extension will invalidate the entire list\n $this->assertFalse($dl2->checkExtension('jpg'));\n $this->assertFalse($dl2->checkExtension('jpeg'));\n $this->assertFalse($dl2->checkExtension('pl'));\n }", "protected function validateExtension($ext,$addional_ext = [])\n\t{\n\t\t$ext = strtolower($ext);\n $valid_extensions = array_merge(['png', 'jpg', 'jpeg', 'gif', 'webp'],$addional_ext);\n\t\treturn in_array($ext,$valid_extensions);\n\t}", "public function isAllowedExtension()\n {\n if (!empty($this->allowed_upload_file_ext)) {\n if (!is_array($this->allowed_upload_file_ext)) {\n NUCLEUS_Exceptions::catcher(FILE_TYPE_LIST_ERROR);\n return false;\n }\n else {\n if (!in_array($this->_file_info['ext'], $this->allowed_upload_file_ext)) {\n NUCLEUS_Exceptions::catcher(UPLOAD_FILE_TYPE_DENIED);\n return false;\n }\n }\n }\n\n return true;\n }", "protected function checkExt(&$inMessage = '') {\n\t\t$isValid = true;\n\t\tif ( !is_string($this->_Ext) && $this->_Ext !== '' ) {\n\t\t\t$inMessage .= \"{$this->_Ext} is not a valid value for Ext\";\n\t\t\t$isValid = false;\n\t\t}\t\t\n\t\tif ( $isValid && strlen($this->_Ext) > 8 ) {\n\t\t\t$inMessage .= \"Ext cannot be more than 8 characters\";\n\t\t\t$isValid = false;\n\t\t}\n\t\tif ( $isValid && strlen($this->_Ext) <= 1 ) {\n\t\t\t$inMessage .= \"Ext must be more than 1 character\";\n\t\t\t$isValid = false;\n\t\t}\t\t\n\t\t\t\t\n\t\treturn $isValid;\n\t}", "function checkExtension($params = array(), $options = array()) {\n\t\t$val = array_shift($params);\n\t\tif (!empty($val['name'])) {\n\t\t\t$pathinfo = pathinfo($val['name'], PATHINFO_EXTENSION);\n\t\t\tif (in_array($pathinfo, $options)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public function validateExtensionplan(){\n $allowed = array('jpeg', 'jpg', 'png');\n $filename = $this->getplanFloor('name');\n $ext = pathinfo($filename, PATHINFO_EXTENSION);\n if(!in_array($ext,$allowed)) {\n return false;\n } else {\n return true;\n }\n }", "public function testPhpExtensionsAreValid()\n {\n $this->assert->php->extensions\n ->isLoaded('simplexml')\n ->isLoaded('fileinfo')\n ->isLoaded('xsl');\n // validate that fileinfo is loaded and configured properly\n $this->assert->php->extensions->fileinfo->isAlive();\n }", "public function extens(){\n $this->typefl = pathinfo($this->filename, PATHINFO_EXTENSION);\n\n if(!in_array($this->typefl, $this->type)){\n echo \"Wrong extension!!!\";\n return false;\n }\n else{\n return true;\n }\n }", "public function hasExtension()\n {\n \treturn ( $this->_extension !== '' );\n }", "public function extension_validation($file_ext,$extensions){\n\t\tif(in_array($file_ext,$extensions) == false){\n\t\t\treturn true;\n\t\t}\n\t}", "public function extension_validation($file_ext,$extensions){\n\t\tif(in_array($file_ext,$extensions) == false){\n\t\t\treturn true;\n\t\t}\n\t}", "public function checkExtension($extension)\n {\n $message = function ($ext) {\n sprintf('Warning: %s extension is not loaded', $ext);\n };\n\n if (is_array($extension)) {\n foreach ($extension as $ext) {\n if (!extension_loaded($ext)) {\n $this->markTestSkipped($message($ext));\n break;\n }\n }\n } elseif (!extension_loaded($extension)) {\n $this->markTestSkipped($message($extension));\n }\n }", "function is_valid_image_extension ($ext) {\n switch ($ext = strtolower($ext)) {\n //Pictures\n case 'jpg':\n case 'gif':\n case 'png':\n case 'bmp':\n case 'xbm':\n return true;\n\n //Denied extension\n default:\n return false;\n }\n }", "abstract public function acceptedExtension(): string;", "protected function checkIfNoConflictingExtensionIsInstalled() {}", "public function testCheckExtensionNotAllowedDefault() {\n $this->assertFalse($this->dl->checkExtension('jpg'));\n }", "protected static function checkFileinfoExtension()\n {\n // Make sure that the \"fileinfo\" extension is loaded/enabled\n if (!extension_loaded('fileinfo')) {\n throw new RuntimeException('Required \"fileinfo\" extension not loaded');\n }\n }", "public function hasExtension($name);", "public function extIsAllowed( $ext )\n {\n if ( !mb_strlen($ext) )\n {\n return false;\n }\n\n return in_array($ext, self::$ext);\n }", "function is_valid_audio_extension ($ext) {\n switch ($ext = strtolower($ext)) {\n //Sounds (HTML5 <audio> formats)\n case 'mp3':\n case 'ogg':\n case 'aac':\n case 'wav':\n case 'wave':\n return true;\n\n //Denied extension\n default:\n return false;\n }\n }", "function allowed_extensions($url) {\n\n\t}", "public function checkExtensions()\n {\n $extensions = array(\n 'fileinfo',\n 'pdo',\n 'mbstring',\n 'tokenizer',\n 'openssl',\n 'json',\n 'curl',\n 'xml'\n );\n\n $results = array();\n\n foreach ($extensions as $extension) {\n $results[$extension] = extension_loaded($extension);\n }\n\n return $results;\n }", "public function getValidExtensions();", "function check_file_extension($ext, $allowed) {\nif (in_array($ext, $allowed)) {\nreturn true;\n}else {\necho \"Only .txt file allow to be uploaded\";\n}\n}", "protected function checkExtensions($extensionList) {\n\t\tforeach($extensionList as $extensionPath )\n\t\t\t$this->checkExtension($extensionPath);\n\t}", "public function checkSubExtObj() {}", "function validateFileExtension(&$model, $fieldData, $fieldName, $allowedExts = array()) {\n if (empty($fieldData[$fieldName]['tmp_name'])) return true;\n \n $extension = strtolower(pathinfo($fieldData[$fieldName]['name'], PATHINFO_EXTENSION));\n \n if (!is_array($allowedExts) || (!in_array('*', $allowedExts) && !in_array($extension, $allowedExts))) return false;\n \n return true;\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 }", "function is_valid_video_extension ($ext) {\n switch ($ext = strtolower($ext)) {\n //Video (HTML5 <video> formats)\n case 'ogg':\n case 'webm':\n return true;\n\n //Denied extension\n default:\n return false;\n }\n }", "private function isFileValid(): bool\n {\n return FileHelper::isExpectedExtensions($this->getPath(), $this->getFileExtensions());\n }", "function is_valid_file_extension($value, $set){\n if (in_array($value, $set)) {\n return true;\n }\n}", "function checkAddon($plugin_path,$e_xxx)\n\t{\n\t\tif(is_readable(e_PLUGIN.$plugin_path.\"/\".$e_xxx.\".php\"))\n\t\t{\n\t\t\t$file_text = file_get_contents(e_PLUGIN.$plugin_path.\"/\".$e_xxx.\".php\");\n\t\t\tif ((substr($file_text, 0, 5) != '<'.'?php')\n\t\t\t\t\t|| ( (substr($file_text, -2, 2) != '?'.'>') && (strrpos($file_text, '?'.'>') !== FALSE) )\n\t\t\t\t\t)\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\t\treturn 2;\n\t}", "protected function checkWebsocExtensions($extensions) \n\t{\n\t\treturn true; // Override and return false if an extension is not found that you would expect.\n\t}", "public function isValidType( $ext=null ){\n global $VALID_FILES;\n if (!$ext)\n $ext = $this->ext; \n return (in_array( $ext, $VALID_FILES )); \n }", "public function is_valid( $extension ) {\n\t\t_deprecated_function( __METHOD__, 'WPSEO 15.4' );\n\n\t\treturn false;\n\t}", "protected function validateExtension(UploadedFile $objUploadFile)\n {\n $error = false;\n\n $strAllowed = $this->extensions ?: \\Config::get('uploadTypes');\n\n $arrAllowed = trimsplit(',', $strAllowed);\n\n $strExtension = $objUploadFile->getClientOriginalExtension();\n\n if (!$strExtension || !is_array($arrAllowed) || !in_array($strExtension, $arrAllowed)) {\n return sprintf(sprintf($GLOBALS['TL_LANG']['ERR']['illegalFileExtension'], $strExtension));\n }\n\n // compare client mime type with mime type check result from server (e.g. user uploaded a php file with jpg extension)\n if (!$this->validateMimeType($objUploadFile->getClientMimeType(), $objUploadFile->getMimeType())) {\n return sprintf(sprintf($GLOBALS['TL_LANG']['ERR']['illegalMimeType'], $objUploadFile->getMimeType()));\n }\n\n return $error;\n }", "public function isValidExtension($extension): bool\n {\n $extension = (string)$extension;\n\n return $extension !== '' && in_array($extension, Utils::getSupportPageTypes(), true);\n }", "private function extension_is_allowed( $extension = null )\n\t{\n\t\tif( $this->config['content_types'] === false || is_null($this->config['content_types']) ) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn ( is_null($extension) || ! in_array($extension, $this->config['content_types']) ) ? false : true;\n\t}", "public function isExtensionLoaded($ext='gd') { \n return extension_loaded($ext); \n }", "static function chkFileExtension($str='') {\n $match= preg_match('/.swf/i', $str);\n if($match>0){\n return \"yes\";\n }else{\n return \"no\";\n }\n }", "function extension($ext){\r\n\t\tif ($ext == \"jpg\" || $ext == \"jpeg\" || $ext == \"png\") {\r\n\t\t\t$ret = 1;\r\n\t\t} else{\r\n\t\t\t$ret = 0;\r\n\t\t}\r\n\r\n\t\treturn $ret;\r\n\t}", "public function guessExtension();", "public function isValid(ExtensionContract $extension) : bool {\n return ! in_array($extension->getPackage()->getName(), $this->configRepository->getReservedNames(), true);\n }", "private function isValidImage() {\r\n\t\t\treturn in_array($this->extension, $this->extAllowed) ? true : false;\r\n\t\t}", "public function canGetExtensionKey() {\n\t\t$provider = $this->getConfigurationProviderInstance();\n\t\t$record = $this->getBasicRecord();\n\t\t$extensionKey = $provider->getExtensionKey($record);\n\t\t$this->assertNull($extensionKey);\n\t}", "public function validateExtensions($attribute){\n $infoFile = $this->$attribute;\n if (!in_array(pathinfo($infoFile['file']['name'], PATHINFO_EXTENSION), ['png', 'jpg', 'jpeg'])) {\n $this->addError($attribute, \\Yii::t('app', 'extensions',['attribute' => $this->attributeLabels()[$attribute]]));\n }\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 }", "protected function checkSupports($ext, $resource)\n {\n if (!is_string($resource)) {\n return false;\n }\n\n $info = pathinfo($resource);\n $extension = $info['extension'];\n\n if ('dist' === $extension) {\n $extension = pathinfo($info['filename'], PATHINFO_EXTENSION);\n }\n\n if (is_string($ext)) {\n return ($ext === $extension);\n }\n\n if (is_array($ext)) {\n $supported = false;\n\n foreach ($ext as $value) {\n if ($value === $extension) {\n $supported = true;\n break;\n }\n }\n\n return $supported;\n }\n\n return false;\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}", "public function checkExtension($fileName){\n \t\t$extName = explode(\".\", $fileName);\n \t\t$extension = end($extName);\n \t\tif ($extension == \"java\"){\n \t\t\treturn true;\n \t\t}else{\n \t\t\treturn false;\n \t\t}\n \t}", "public function is_file_valid($ext){\r\n\t\t$rslt = false;\r\n\r\n\t\tif($ext == '.doc' || $ext == '.DOC' || $ext == '.docx' || $ext == '.DOCX' || $ext == '.xls' || $ext == '.XLS' || $ext == '.xlsx' || $ext == '.XLSX' || $ext == '.ppt' || $ext == '.PPT' || $ext == '.pptx' || $ext == '.PPTX' || $ext == '.pdf' || $ext == '.PDF' || $ext == '.jpg' || $ext == '.JPG' || $ext == '.png' || $ext == '.PNG' || $ext == '.csv' || $ext == '.CSV' || $ext == '.gif' || $ext == '.GIF' || $ext == '.zip' || $ext == '.ZIP') {\r\n\r\n\t\t\t$rslt = true;\r\n\t\t}\r\n\r\n\t\treturn $rslt;\r\n\r\n\t}", "public function mimeTypeValid()\n\t{\n\t\tif (!in_array($this->files['type'], $this->mime_types)) {\n\t\t\tthrow new Exception(\"Invalid file Extension\",6);\n\t\t}\n\t}", "private function isExtensionSupported(string $extension): bool\n {\n return in_array($extension, $this->supportedExtensions);\n }", "function knowsExtension ($anExtension)\n\t{\n\t\t$result = in_array ($anExtension, $this->extensions);\n\t\treturn $result;\n\t}", "private function checkExtension($file) {\n $extension = $file->getClientOriginalExtension();\n if ($extension != self::EXTENSION) {\n throw new Exception(\"Estensione del file non accettata\");\n }\n }", "function checkFileExtension($filename) {\r\n\t\tif ( ($pos = strrpos($filename, '.')) === false ) {\r\n\t\t\treturn $this->getMode();\r\n\t\t} else {\r\n\t\t\t$ext = substr($filename, $pos + 1);\r\n\t\t}\r\n\t\t\r\n\t\tif ( isset($this->_file_extensions[$ext]) ) {\r\n\t\t\treturn $this->_file_extensions[$ext];\r\n\t\t}\r\n\t\t\r\n\t\treturn $this->getMode();\r\n\t}", "public function testExtensionLoaded(): void\n {\n $info = $this->createProvider(false)->getInformation();\n $this->assertEquals(true, $info['extension_loaded']);\n }", "protected function getSecurityStatusOfExtensions() {}", "static function isKnownExtension($strExtension)\n {\n if (empty(self::$arrExtensions2Mimetypes)) self::init();\n return isset(self::$arrExtensions2Mimetypes[$strExtension]);\n }", "protected function checkIfDbalExtensionIsInstalled() {}", "function CheckImageExtension($filename)\n{\n\tif(strlen($filename)<4)\n\t\treturn false;\n\t$ext=strtoupper(substr($filename,strlen($filename)-4));\n\tif($ext==\".GIF\" || $ext==\".JPG\" || $ext==\"JPEG\" || $ext==\".PNG\" || $ext==\".BMP\")\n\t\treturn $ext;\n\treturn false;\n}", "public function checkSubExtObj()\n {\n if (is_object($this->extObj)) {\n $this->extObj->checkExtObj();\n }\n }", "public function checkFormatAllowed() {\n\t\t$imageFileType = pathinfo(basename($this->value[\"name\"]),PATHINFO_EXTENSION);\n\t\tif((($this->extension == \"\") && ($imageFileType == \"jpg\" || $imageFileType == \"png\" || $imageFileType == \"jpeg\"\n\t\t|| $imageFileType == \"gif\")) || ($this->extension == \"pdf\" && $imageFileType == \"pdf\" )) {\n\t\t return true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "public static function isNeedConvertExtension($extension)\n\t{\n\t\tstatic $convertFormat = array(\n\t\t\t'doc' => 'docx',\n\t\t\t'.doc' => '.docx',\n\t\t\t'xls' => 'xlsx',\n\t\t\t'.xls' => '.xlsx',\n\t\t\t'ppt' => 'pptx',\n\t\t\t'.ppt' => '.pptx',\n\t\t);\n\n\t\treturn isset($convertFormat[$extension]) || isset($convertFormat[mb_strtolower($extension)]);\n\t}", "public function testMustProvideValidExtension()\n {\n $response = $this->actingAs($this->user)->json('POST', '/avatar', [\n 'avatar' => UploadedFile::fake()->image('avatar.random')\n ]);\n\n $response->assertStatus(422);\n }", "public function checkExt($f) {\r\n $ext = pathinfo($f, PATHINFO_EXTENSION);\r\n return $ext;\r\n }", "function fn_check_uploaded_data($uploaded_data, $filter_by_ext)\n{\n $result = true;\n $processed = false;\n\n /**\n * Actions before check uploaded data\n *\n * @param array $uploaded_data Uploaded data\n * @param array $filter_by_ext Allowed file extensions\n * @param bool $result Result status\n * @param bool $processed Processed flag\n */\n fn_set_hook('check_uploaded_data_pre', $uploaded_data, $filter_by_ext, $result, $processed);\n\n if ($processed) {\n return $result;\n }\n\n if (!empty($uploaded_data) && is_array($uploaded_data) && !empty($uploaded_data['name'])) {\n $ext = fn_get_file_ext($uploaded_data['name']);\n\n if (empty($ext)) {\n $types = fn_get_ext_mime_types('mime');\n $mime = fn_get_mime_content_type($uploaded_data['path']);\n\n $ext = isset($types[$mime]) ? $types[$mime] : '';\n }\n\n if (!$processed && !empty($filter_by_ext) && !in_array(fn_strtolower($ext), $filter_by_ext)) {\n fn_set_notification('E', __('error'), __('text_not_allowed_to_upload_file_extension', array(\n '[ext]' => $ext\n )));\n\n $result = false;\n $processed = true;\n }\n\n if (!$processed && in_array(fn_strtolower($ext), Registry::get('config.forbidden_file_extensions'))) {\n fn_set_notification('E', __('error'), __('text_forbidden_file_extension', array(\n '[ext]' => $ext\n )));\n\n $result = false;\n $processed = true;\n }\n\n $mime_type = fn_get_mime_content_type($uploaded_data['path'], true, 'text/plain');\n if (\n !$processed\n && !empty($uploaded_data['path'])\n && in_array($mime_type, Registry::get('config.forbidden_mime_types'))\n ) {\n fn_set_notification('E', __('error'), __('text_forbidden_file_mime', array(\n '[mime]' => $mime_type\n )));\n\n $result = false;\n $processed = true;\n }\n }\n\n /**\n * Actions after check uploaded data\n *\n * @param array $uploaded_data Uploaded data\n * @param array $filter_by_ext Allowed file extensions\n * @param bool $result Result status\n * @param bool $processed Processed flag\n */\n fn_set_hook('check_uploaded_data_post', $uploaded_data, $filter_by_ext, $result, $processed);\n\n return $result;\n}", "function getExtension() ;", "protected function checkPhpExtensionEnabled($ext)\n {\n return extension_loaded($ext);\n }", "private function has_valid_extension( $file ) {\n\t\tforeach ( $this->extensions as $extension ) {\n\t\t\tif ( stristr( $file, $extension ) ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "public function testExtensionReturnsExtension()\n {\n file_put_contents(self::$temp.DS.'foo.txt', 'foo');\n\n $this->assertSame('txt', Storage::extension(self::$temp.DS.'foo.txt'));\n }", "public function extension() {}", "public function isExtension()\n {\n return $this->third;\n }", "private function _checkExt($field)\n {\n if ( ! empty($field)) {\n $ext = $field->getClientOriginalExtension();\n $allowed = Config::get('filer.allowed_file_ext');\n\n foreach ($allowed as $type => $ext_arr) {\n if (in_array(strtolower($ext), $ext_arr)) {\n $this->_type\t\t= $type;\n $this->_ext\t\t\t= implode('|', $ext_arr);\n $this->_filename\t= str_random(30);\n\n break;\n }\n }\n\n if ( ! $this->_ext) {\n return $this->result(false, trans('files.invalid_extension'), $field->getClientOriginalName());\n }\n } else {\n return $this->result(false, trans('files.upload_error'));\n }\n\n return $this->result(true);\n }", "function failUnlessExtensionArgs($expected_args)\n {\n $expected_args['mode'] = $this->msg->mode;\n $this->assertEquals($expected_args, $this->msg->getExtensionArgs());\n }", "public function isValid( $size, $ext=null ){ return $this->isValidType($ext) && $this->isValidSize($size); }", "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}", "private function detectExtension()\n {\n $arr = explode('.', $this->file['name']);\n $this->file['extension'] = end($arr);\n }", "private function _has_extension($filename) {\n\t\t$exploded = explode(\".\", $filename);\n\t\tif(sizeof($exploded) > 1)\n\t\t\treturn $exploded;\n\t\telse\n\t\t\treturn false;\n\t}", "public function checkExistenceExtension($type, $extension_name)\n {\n $query = $this->db->query(\"SELECT * FROM \" . DB_PREFIX . \"extension WHERE `type` = '\" . $this->db->escape($type) . \"' AND `code` = '\" . $this->db->escape($extension_name) . \"' \");\n\n return $query->rows;\n }", "function isValidDocument($docFormat, $document){\n $name = $document['name'];\n $ext = explode('.', $name);\n $ext = '.' . $ext[1];\n\n if($ext == $docFormat){\n if($document['error'] === 0){\n return true;\n }\n else{\n echo \"error uploading document\";\n return false;\n }\n }\n else{\n echo \"doc type does not match documents true extension\";\n }\n }", "public function loadExtensionNode()\n {\n $extensions = $this->xml->xpathQuery('//ns:archive/ns:extension');\n\n if ($this->loopExtensions($extensions))\n {\n return true;\n }\n\n throw new \\Exception(trans('errors.missing_meta_extension', ['file' => $this->file]));\n }", "public function extension();", "public function supportsExtension($extension)\n {\n return !empty($this->convertersByExtension[$extension]);\n }", "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 }", "protected function _extensionLoaded() {}", "public function testInvalidInputs($input)\n {\n StringUtils::getFileExtension($input);\n }", "public function imageCheck($extension)\n {\n $allowedTypes = $this->imageTypes;\n return in_array($extension, $allowedTypes);\n }", "public function ExtensionCheck($shop_url)\n {\n $extention = ['walmart' => 'WalmartExtensionCheck', 'jet' => 'JetExtensionCheck'];\n foreach ($extention as $key => $value) {\n\n $data = self::$value($shop_url);\n if ($data) {\n return $data;\n }\n }\n return false;\n }", "function isValidImage( $file ) {\n\n\t$form_errors = array();\n\n\t$part = explode( \".\", $file );\n\t$extension = end( $part );\n\n\tswitch( strtolower( $extension ) ) {\n\n\t\tcase 'jpg':\n\t\tcase 'gif':\n\t\tcase 'bmp':\n\t\tcase 'png':\n\n\t\treturn $form_errors;\n\n\t}\n\n\t$form_errors[] = $extension . \"is not valid image extension\";\n\n\treturn $form_errors;\n\n}", "public static function hasExtension( $ext )\n {\n if( !empty( $ext ) && is_string( $ext ) )\n {\n $ext = strtolower( trim( $ext ) );\n return array_key_exists( $ext, self::loadedExtensions() );\n }\n return false;\n }", "function isFileType($files) {\n $allowedExts = array(\"jpg\", \"jpeg\", \"gif\", \"png\", \"doc\", \"docx\", \"txt\", \"rtf\", \"pdf\", \"xls\", \"xlsx\", \"ppt\", \"pptx\");\n $temp = explode(\".\", $files);\n $extension = end($temp);\n if (in_array($extension, $allowedExts))\n return true;\n else\n return false;\n}", "function cemhub_check_required_php_extensions($set_message = TRUE, $extensions_list = array(CEMHUB_EXTENSION_SSH_NAME, CEMHUB_EXTENSION_GNUPG_NAME)) {\n $return = FALSE;\n $return_extensions_status = array();\n\n foreach ($extensions_list as $extension) {\n $extension_loaded = extension_loaded($extension);\n $return_extensions_status[$extension] = $extension_loaded;\n\n if (empty($extension_loaded) && $set_message) {\n drupal_set_message(t('The extension \"%extension\" must be installed and enabled on the server.', array('%extension' => $extension)), 'warning');\n }\n }\n\n // Check results\n if (!empty($return_extensions_status)) {\n $return = in_array(FALSE, $return_extensions_status) ? FALSE : TRUE;\n }\n\n return $return;\n}", "public function validateExt($file, $ext)\n {\n if (is_object($file)) {\n return $file->extension() == $ext;\n } else {\n return $this->getExt($file) == $ext;\n }\n }" ]
[ "0.78653854", "0.77242017", "0.76244456", "0.75356364", "0.7257333", "0.7173007", "0.7171945", "0.7084392", "0.70505697", "0.70359766", "0.6995934", "0.6976371", "0.69710815", "0.69574195", "0.69421923", "0.69223785", "0.6892601", "0.6892601", "0.68881446", "0.68408394", "0.6826502", "0.6813174", "0.6792003", "0.6769683", "0.6748641", "0.6734085", "0.66722155", "0.66705835", "0.65719724", "0.65430397", "0.6534237", "0.6529155", "0.65152574", "0.6433913", "0.6433367", "0.64189667", "0.6415932", "0.6400341", "0.639293", "0.6376235", "0.6375293", "0.63687515", "0.63483775", "0.63355863", "0.6323392", "0.63196695", "0.6315378", "0.63123643", "0.6304989", "0.6301958", "0.6300079", "0.6297374", "0.628617", "0.6268068", "0.62602943", "0.62246716", "0.6212204", "0.62086374", "0.62079775", "0.6207098", "0.6179681", "0.6158005", "0.6144293", "0.61355203", "0.6134429", "0.6094735", "0.6089726", "0.60867065", "0.6047964", "0.60332674", "0.6027425", "0.6016295", "0.6006774", "0.5997862", "0.59870565", "0.5972126", "0.59606904", "0.59471536", "0.5940459", "0.5926582", "0.59063303", "0.5903272", "0.5892966", "0.5890404", "0.58778423", "0.58659214", "0.5861222", "0.5858839", "0.5843274", "0.58326083", "0.5830648", "0.582549", "0.58236325", "0.579411", "0.5793624", "0.579121", "0.5790816", "0.5770028", "0.5765981", "0.57573164", "0.5755462" ]
0.0
-1
/ / Cache operations / Gets the specified key's data
function get (string $key, mixed $default = null) : mixed { $key = $this->getUnsafePrefix() . $key; $result = $this->memcached->get($key); return match ($result) { false => $default, default => unserialize($result), }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get ($key) {\n return $this->memcached->get($key);\n }", "public function getObjFromCache($key);", "function get($key) {\n return $this->cacheObj->get($key);\n }", "function get($key) {\n return $this->memcached->get($key);\n }", "public function getValFromCache($key);", "public function get($key)\n\t{\n\t\tLogger::getInstance()->log(LoggerEntry::CACHE, 'Cache', 'Get key from cache: ' . $key);\n\t\treturn $this->cacheLayer->get($key);\n\t}", "function get($key)\n {\n return $this->cache->get($key, $this->group);\n }", "public function getData( $key )\r\n {\r\n\t\tif(isset($this->_dataCache[$key])){\r\n \treturn $this->dataCache[$key];\r\n\t\t}\r\n\t\treturn NULL;\r\n }", "public function getData($key);", "function get($key) {\n $memObj = self::getMemcacheObj();\n return $memObj->get($key);\n }", "function get($key) {\n $memObj = self::getMemcacheObj();\n return $memObj->get($key);\n }", "public function get($key) {\n $value = $this->memcached->get($key);\n\n return $value;\n }", "public function get($key)\r\r\n\t{\t\t\r\r\n\t\t$this->get_count++;\t\t\r\r\n\t\treturn $this->_storage->get($key);\t\t\r\r\n\t}", "function fetch_from_cache($key){\n\tglobal $SYSTEM_SHOW_CACHE_METRICS, $TAG;\n\n\t$key = \"$TAG:$key\";\n\n\t$timer_bgn = microtime(true);\n\n\t$val = null;\n\tif ( function_exists('apc_fetch') ) {\n\t\t$val = apc_fetch($key);\n\t\tif ( $val ) {\n\t\t\t$timer_end = microtime(true);\n\n\t\t\tif ($SYSTEM_SHOW_CACHE_METRICS)\n\t\t\t\telog(\"time took fetching from APC-cache for key: $key: \" . ($timer_end - $timer_bgn));\n\t\t}\n\t} else {\n\t\t$redis = conn_redis();\n\t\t$val = $redis->get($key);\n\n\t\tif ( $val ) {\n\t\t\t$timer_end = microtime(true);\n\n\t\t\tif ($SYSTEM_SHOW_CACHE_METRICS)\n\t\t\t\telog(\"time took fetching from REDIS-cache for key: $key: \" . ($timer_end - $timer_bgn));\n\t\t\t$val = @json_decode($val, true);\n\t\t}\n\t}\n\n\treturn $val;\n}", "public function get($key) {\n\n\t\t\t// If desired clean up all expired cached objects\n\t\t\tif ($this->_autoDeleteExpired) {\n\t\t\t\t$this->deleteExpired();\n\t\t\t}\n\n\t\t\t$filename = $this->_getFileName();\n\t\t\t$cachedData = $this->_loadCache($filename);\n\t\t\t// If key exists unserialize and return\n\t\t\tif (!isset($cachedData[$key]['data'])) return null;\n\t\t\treturn unserialize($cachedData[$key]['data']);\n\n\t\t}", "public function load($key)\n\t{\n\n\t\t$this->cached++;\n\t\t$data = $this->_cache->get($key);\n\t\treturn $data;\n\n\t}", "public function get($key){\n if( $value = $this->memcache->get($this->prefix.$key) ) {\n return $value;\n }\n }", "public function getItem($key): CacheItem;", "public function read($key) {\n\t\treturn $this->_Memcached->get($key);\n\t}", "public function get($key)\n\t{\n\t\treturn $this->memcache->get($key);\n\t}", "public function fetch($key);", "public function fetch($key);", "public function fetch($key);", "function get($key) {\n\t\t\tglobal $__cachemem;\n\t\t\t$file = CACHE_DIR.md5($key).\".cache\";\n\t\t\tif($__cachemem[$key] != \"\") {\n\t\t\t\treturn $__cachemem[$key];\n\t\t\t}\n\t\t\tif(@file_exists($file)) {\n\t\t\t\t$dump = file_get_contents($file);\n\t\t\t\tdebugLog(\"Cache file gelesen\", \"Cache File wurde erfolgreich gelesen - KEY: '\".$key.\"'\",$file);\n\t\t\t\t$res = @unserialize($dump);\n\t\t\t\t$__cachemem[$key] = $res;\n\t\t\t\treturn $res;\n\t\t\t} else {\n\t\t\t\t//debugLog(\"Cache File fehler\",\"Cache file konnte nicht gefunden werden, expired?\",$file,UNKWN,DBUG_WARNING);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}", "function KeyGet($key) \n\t{\n\t\t$output = null;\n\n\t\t// Always try local APCu cache first!\n\t\tif($this->apcu->enabled)\n\t\t\t$output = $this->apcu->KeyGet($key);\n\t\t\n\t\tif(!empty($output))\n\t\t\treturn $output;\n\n\t\t// Redis cache next!\n\t\tif($this->redis->enabled)\n\t\t\t$output = $this->redis->KeyGet($key);\n\t\t\n\t\tif(!empty($output) || is_array($output))\n\t\t\treturn $output;\n\n\t\treturn null;\n\t}", "public function get($key) {\n $this->logger->debug('Getting cache data for key [' . $key . ']');\n $filePath = $this->getFilePath($key);\n if (!file_exists($filePath)) {\n $this->logger->info('No cache file found for the key [' . $key . '], return false');\n return false;\n }\n $this->logger->info('The cache file [' . $filePath . '] for the key [' . $key . '] exists, check if the cache data is valid');\n $data = $this->getCacheFileContent($filePath);\n if ($data === false) {\n $this->logger->error('The cache data for the key [' . $key . '] is not valid, return false');\n // If unserializing somehow didn't work out, we'll delete the file\n unlink($filePath);\n return false;\n }\n if (time() > $data['expire']) {\n $this->logger->info('The cache data for the key [' . $key . '] already expired delete the cache file [' . $filePath . ']');\n // Unlinking when the file was expired\n unlink($filePath);\n return false;\n } \n $this->logger->info('The cache not yet expire, now return the cache data '\n . 'for key [' . $key . '], the cache will expire ' \n . 'at [' . date('Y-m-d H:i:s', $data['expire']) . ']');\n return $data['data'];\n }", "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 }", "public function load ($key) {\n return $this->cache->get($key);\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}", "public function getData($key = null);", "public function get( $key )\n {\n return $this->cache->get( $key );\n }", "public function getCache($key)\n {\n return $this->memcache->get($key);\n }", "public function get($key = '*')\n {\n if ($key === '*') {\n return $this->cache;\n }\n return $this->cache[$key];\n }", "public static function fetch($key) {\n\t\t\t$klass = self::getInstance();\n\t\t\treturn $klass->cache[crc32($key)];\n\t\t}", "public function getAtCache($key)\n {\n return self::$__cache->getItem($key);\n }", "public function get( $key );", "function getData($sKey, $iTTL = false)\r\n\t{ \r\n $data = $this->oMemcache->get($sKey);\r\n\t\treturn false === $data ? null : $data;\r\n\t}", "public function get($key) {\n\t\t// First, check to see if the result has been cached.\n\t\tif (!isset($this->_cache[$key])) {\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t// Second, check its freshness.\n\t\tif ($this->_cache[$key]['time'] < time() - self::$_lifespan) {\n\t\t\treturn FALSE;\n\t\t}\n\n\t\treturn $this->_cache[$key]['data'];\n\t}", "public static function get( $key )\n {\n return self::$cache->get( $key );\n }", "public function Get ( $key )\r\n\t{\r\n\t\t$normal_key = self::CACHE_PREFIX . $this->_ns . '_' . $key;\r\n\t\t$sticky_key = self::CACHE_STICKY . $this->_nss . '_' . $key;\r\n\t\t\r\n\t\t// Sticky keys take precedence\r\n\t\t$result = $this->_cache->get ( $sticky_key );\r\n\t\tif ( $result === false )\r\n\t\t\t$result = $this->_cache->get ( $normal_key );\r\n\t\t\r\n\t\treturn $result;\r\n\t}", "public function get($key){\n $item = CacheManager::getInstance('files')->getItem($key);\n return $item->get();\n }", "private function get_cache( $key ) {\n\t\treturn get_site_transient( $key );\n\t}", "abstract protected function retrieve($key);", "public function get(string $key);", "public function get(string $key);", "public function get(string $key);", "public function get(string $key);", "public function get(string $key);", "public function get(string $key);", "public function get(string $key);", "public function get(string $key);", "public static function getCache($key)\n\t{\n\t\t$key = str_replace(\"/\", \"\", $key);\n\t\tif (!file_exists(TwitchHelper::$cache_folder . DIRECTORY_SEPARATOR . \"kv\" . DIRECTORY_SEPARATOR . $key)) return false;\n\t\treturn file_get_contents(TwitchHelper::$cache_folder . DIRECTORY_SEPARATOR . \"kv\" . DIRECTORY_SEPARATOR . $key);\n\t}", "public function get( $key ) {\n if ( isset( $this->cache[ $key ] ) ) {\n return $this->cache[ $key ];\n }else{\n return null;\n }\n }", "abstract public function get($key);", "public function getByKey($key);", "public function get($key) {\n $filename = $key.'.cache';\n $file = $this->file_path_for_key($key);\n $ttl = $this->definition->get_ttl();\n $maxtime = 0;\n if ($ttl) {\n $maxtime = cache::now() - $ttl;\n }\n $readfile = false;\n if ($this->prescan && array_key_exists($filename, $this->keys)) {\n if ((!$ttl || $this->keys[$filename] >= $maxtime) && file_exists($file)) {\n $readfile = true;\n } else {\n $this->delete($key);\n }\n } else if (file_exists($file) && (!$ttl || filemtime($file) >= $maxtime)) {\n $readfile = true;\n }\n if (!$readfile) {\n return false;\n }\n // Open ensuring the file for reading in binary format.\n if (!$handle = fopen($file, 'rb')) {\n return false;\n }\n // Lock it up!\n // We don't care if this succeeds or not, on some systems it will, on some it won't, meah either way.\n flock($handle, LOCK_SH);\n $data = '';\n // Read the data in 1Mb chunks. Small caches will not loop more than once. We don't use filesize as it may\n // be cached with a different value than what we need to read from the file.\n do {\n $data .= fread($handle, 1048576);\n } while (!feof($handle));\n // Unlock it.\n flock($handle, LOCK_UN);\n // Return it unserialised.\n return $this->prep_data_after_read($data);\n }", "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 get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "public function get($key);", "abstract public function get ($key);", "function get($key) {\n $cacheFile = $this->_getFilePath($key); \n if (!file_exists($cacheFile)){\n return '';\n }\n $fp = fopen($cacheFile, 'r');\n $meta = $this->_readMeta($fp);\n if ($meta['expired']!=0 && $meta['expired']<time()){\n fclose($fp);\n unlink($cacheFile);\n return '';\n }\n $ret = '';\n $str = '';\n while($str = fread($fp, 8192)){\n $ret .= $str;\n }\n fclose($fp);\n return unserialize($ret);\n\n }", "public function get($key)\n {\n $prefixed = $this->prefix.$key;\n\n $cache = $this->table()->where('key', '=', $prefixed)->first();\n\n // If we have a cache record we will check the expiration time against current\n // time on the system and see if the record has expired. If it has, we will\n // remove the records from the database table so it isn't returned again.\n if (! is_null($cache)) {\n if (is_array($cache)) {\n $cache = (object) $cache;\n }\n\n if (time() >= $cache->expiration) {\n $this->forget($key);\n\n return;\n }\n\n return unserialize($cache->value);\n }\n }", "function get($key){\n\t\tif ($this->connect_successful) return @$this->memcache->get($key);\n\t\telse return NULL;\n\t}", "public function retrieve($key) {\n $value = $this->_memcache->get($key);\n if ($value === false) $value = null;\n return $value;\n }", "public function getItem($key){}", "public function cacheGet() {\n }", "public function read($key) {}", "public function getItem(string $key): CacheItemInterface;", "public function getItem($key);", "public function getItem($key);", "public function getItem($key);", "public function getItem($key);", "public function get ($key) {\n try {\n if (empty($key) ) throw new Exception(\"Empty 'name'!\");\n $filename = $this->ValidateFileName($key);\n $result = @file_get_contents(CACHE.$filename);\n if ($result === false) throw new Exception(\"Can't read file '\".CACHE.$filename.\"'!\");\n //$result = unserialize($result);\n $result = json_decode($result, true, JSON_UNESCAPED_UNICODE);\n if (!empty($result)){ //is_array($result) // for unserialize !empty($result)\n if (isset($result['expiries']) && $result['expiries']<time()) {\n $this->rm($key);\n return NULL;\n }\n return $result['value'];\n }\n } catch (Exception $e) {\n //echo 'Exception: ', $e->getMessage(), \"\\n\";\n }\n return NULL;\n }", "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 static function get($key);" ]
[ "0.7954589", "0.7759613", "0.7734601", "0.7683159", "0.7657801", "0.74805397", "0.74276024", "0.74225837", "0.74194884", "0.73984116", "0.73984116", "0.7360951", "0.7360374", "0.7347785", "0.72912455", "0.72902447", "0.72877294", "0.7286532", "0.72533745", "0.7205624", "0.7189778", "0.7189778", "0.7189778", "0.715633", "0.7131037", "0.7123116", "0.71186393", "0.7116043", "0.7106786", "0.7105486", "0.7090676", "0.7088163", "0.70821244", "0.70804095", "0.70521086", "0.7046008", "0.7029372", "0.6998845", "0.6976876", "0.69591165", "0.6947848", "0.6927025", "0.6921944", "0.69190806", "0.69190806", "0.69190806", "0.69190806", "0.69190806", "0.69190806", "0.69190806", "0.69190806", "0.6916917", "0.69071937", "0.6899608", "0.68957216", "0.68948907", "0.6893574", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6893519", "0.6889902", "0.6878693", "0.68480116", "0.68263525", "0.6825928", "0.6817066", "0.68097126", "0.68092877", "0.6808025", "0.67987245", "0.67987245", "0.67987245", "0.67987245", "0.6789424", "0.6769815", "0.67531276" ]
0.0
-1
Sets the specified data at the specified key
function set ( string $key, mixed $value, null|int|\DateInterval $ttl = null ) : bool { $key = $this->getUnsafePrefix() . $key; return $this->memcached->set($key, serialize($value)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function set($key, $data);", "public function set(string $key, $data);", "public function set_data($key, $data)\n\t{\n\t\t$this->_data[$key] = $data;\n\t}", "public function setDataByKey($key, $data)\n {\n $data = $this->hydrateIfJsonToArray($data);\n $this->data[$key] = $data;\n }", "public function set(string $key, string $data) : void;", "public function setData($data, $key = null);", "public function set($key, $data) {\n\t\tif ($this->isValidKey($key) && $this->isValidData($data)) {\n\t\t\treturn $this->setKey($key, $data);\n\t\t}\n\t}", "public function set($key, $data) {\n\t\t$this->_cache[$key] = array(\n\t\t\t'time' => time(),\n\t\t\t'data' => $data,\n\t\t);\n\t}", "public function setData($key, $value);", "public function setData($key, $value);", "public function set($key, $data) {\n return $this->zadd($key, $data);\n }", "function set($key,$data)\n\t{\n\t\t// Get file path\n\t\t$file_path = $this->get_file_path($key);\n\n\t\t// Add content to file\n\t\tfile_put_contents($file_path,serialize($data));\n\t}", "public function setData($key, $value = null)\n {\n\n if (is_string($key))\n $this->data = json_decode($key);\n else\n $this->data = $key;\n\n }", "public static function set($data, $class_id, $key)\n\t{\n\t\t$args = func_get_args();\n\t\tcall_user_func_array(array(self::$data_cache_provider, \"set_data\"), $args);\n\t}", "public function set($key,$value) {\n $this->_data[$key]=$value;\n }", "public function setData($key, $value = null);", "public function _set($key, $value)\n {\n $this->data[$key] = $value;\n }", "public function _set($key, $value)\n {\n $this->data[$key] = $value;\n }", "protected function setData($key, $value)\n {\n $this->data[$key] = $value;\n }", "public function set($key, $value) {\n\t\t$this->data[$key] = $value;\n\t}", "public function set ($key, $value) {\r\n\t\t$this->_data[$key] = $value;\r\n\t}", "public function __set($key, $value) {\n $this->pos = 0;\n $this->data[$key] = $value;\n $this->keys = array_keys($this->data);\n }", "protected function setPersistentData($key, $value)\r\n {\r\n }", "public function __set($key, $value)\n {\n self::$data[$key] = $value;\n }", "public function set($key, $value)\n\t{\n\t\t$this->data[$key] = $value;\n\t}", "public function setJson($key, $data)\n {\n \n $this->synchronized = false;\n $this->data[$key] = json_encode($data);\n \n }", "public function set(string $key, $value) {\n\t\t$this->data[$key] = $value;\n\t}", "public function set($key, $value)\n {\n $this->data[$key] = $value;\n }", "public function set($key, $value)\n {\n $this->data[$key] = $value;\n }", "public function set($key, $value)\n {\n $this->data[$key] = $value;\n }", "public function __set($key, $value)\n {\n $this->data[$key] = $value;\n }", "private function setData($key, $value)\n {\n $this->data[ $key ] = $this->cleanForXML($value);\n }", "public function set(string $key, $value): void {\n\t\t$this->data[$key] = $value;\n\t}", "public function __set($key, $value)\n\t{\n\t\t$this->data[$key] = $value;\n\t}", "public function set($key, $val){\n\t\t\t$this->data[$key] = $val;\n\t\t}", "private function setKey($key, $data) {\n\n\t\t// Replace existing key?\n\t\tif ($this->getKey($key) !== false) {\n\t\t\treturn $this->replaceKey($key, $data);\n\t\t}\n\n\t\t// Save to cache\n\t\tif ($this->options['cache'] === true) {\n\t\t\t$this->data['cache'][$key] = $data;\n\t\t}\n\n\t\t// Preserve new lines\n\t\t$data = $this->preserveLines($data, false);\n\n\t\t// Serialize data\n\t\t$data = serialize($data);\n\n\t\t// Set line, we don't use PHP_EOL to keep it cross-platform compatible\n\t\t$line = $key . \"=\" . $data . \"\\n\";\n\n\t\t// Open file\n\t\t$fp = $this->openFile($this->data['file'], self::FILE_APPEND);\n\n\t\t// Write line\n\t\tif (@fwrite($fp, $line) === false) {\n\t\t\tthrow new FlintstoneException('Could not write to file ' . $this->data['file']);\n\t\t}\n\n\t\t// Close file\n\t\t$this->closeFile($fp);\n\n\t\treturn true;\n\t}", "public static function set($key, $value)\r\n {\r\n self::$_data[$key] = $value;\r\n }", "public function __set( $key, $value ) {\n\n\t\t$this->_data[ $key ] = $value;\n\t}", "public function setData($key, $value)\n\t{\n\t\t$old = $this->data;\n\t\tif ($value === null) {\n\t\t\tunset($this->data[$key]);\n\t\t} else {\n\t\t\t$this->data[$key] = $value;\n\t\t}\n\n\t\t$this->_onPropertyChanged('data', $old, $this->data);\n\t}", "public function set($key, $data) {\n $this->ensure_path_exists();\n $filename = $key.'.cache';\n $file = $this->file_path_for_key($key, true);\n $result = $this->write_file($file, $this->prep_data_before_save($data));\n if (!$result) {\n // Couldn't write the file.\n return false;\n }\n // Record the key if required.\n if ($this->prescan) {\n $this->keys[$filename] = cache::now() + 1;\n }\n // Return true.. it all worked **miracles**.\n return true;\n }", "public function offsetSet($key, $value)\n {\n $this->data[$key] = $value;\n }", "public function offsetSet($key, $value)\n {\n $this->data[$key] = $value;\n }", "public function setData($key, $value)\n {\n $this->owner->{$this->dataAttribute} = ArrayHelper::merge($this->owner->{$this->dataAttribute}, [$key => $value]);\n }", "public static function set(string $key, $data)\n {\n $_SESSION[$key] = $data;\n }", "public function set($key, $data, $group = 'default', $expire = 0)\n {\n }", "public function setData($key, $value) {\n\n if (\\is_string($key) === false) {\n /**\n * @todo Implement proper error handling\n */\n throw new \\Exception('Key must be of type string');\n }\n\n $this->datastore->$key = $value;\n $this->datastore->save();\n }", "public function set(string $key, $value): void\n {\n $this->data[$key] = $value;\n }", "public function update(string $key, $newData);", "public function setKeyData($key_data)\n {\n if (!is_array($key_data) && strlen(trim($key_data)) > 0) {\n $key_data = array ('data' => $key_data);\n } elseif (!is_array($key_data)) {\n throw new Exception('Error: Expected input to be array.');\n }\n $this->_keyData = $key_data;\n }", "public function setData($key, $value) {\r\n\t\t$this->templateData[$key] = $value;\r\n\t}", "public function setApplicationData($key, $value);", "public function updateData(string $key, $value)\n {\n $this->data[$key] = $value;\n }", "public function write($key, $data)\n {\n }", "public function getFieldsetDataValue($key);", "function put($key, $data) {\n $fn = $this->name($key);\n file_put_contents($fn, serialize($data), LOCK_EX);\n }", "public function __set($key, $value)\n {\n\n $this->setData($key, $value);\n\n }", "public function setDataKey($key)\n {\n $this->dataKey = $key;\n return $this;\n }", "protected function putData($key, $value)\n {\n $this->templateData[$key] = $value;\n }", "public function setData($key, $value = null) {\n if ($key === (array)$key) {\n $this->_data = $key;\n } else {\n $this->_data[$key] = $value;\n }\n return $this;\n }", "public function setKey($key, $data) {\n\t $this->_memcached->set($key, $data);\n\t return $this;\n\t}", "public function save($key, $data);", "function setData($sKey, $data, $iTTL = false)\r\n\t{\r\n return $this->oMemcache->set($sKey, $data, $this->iStoreFlag, false === $iTTL ? $this->iTTL : $iTTL);\r\n\t}", "static public function set_cache_data( $key, $data ) {\n\t\t$cache_duration = IBX_WPFomo_Admin::get_settings( 'cache_duration' );\n\t\tif ( ! $cache_duration || empty( $cache_duration ) ) {\n\t\t\t$cache_duration = 45;\n\t\t}\n\n\t\tdelete_transient( $key );\n\t\tset_transient( $key, maybe_serialize( $data ), ( $cache_duration / 60 ) * HOUR_IN_SECONDS );\n\t}", "public function storeSetting( $data, $key )\r\n\t{\r\n\t\tself::$settings[ $key ] = $data;\r\n\t}", "public function set($key, $data, $ttl = 0);", "public function set($key, $data, $ttl = 0);", "public function set($setting_data = '', string $setting_key = '');", "public function set($data);", "abstract public function set ($key, $value);", "function setField (&$data, $key, $value)\n{\n if (is_object ($data))\n $data->$key = $value;\n else if (is_array ($data))\n $data[$key] = $value;\n else throw new \\InvalidArgumentException;\n}", "public function offsetSet($key,$value){\n if(!array_key_exists($key,$this->definition)){\n throw new \\Disco\\exceptions\\Exception(\"Field `{$key}` is not defined by this data model\");\n }//if\n $this->data[$key] = $value;\n }", "public function set()\n {\n $args = func_get_args();\n $num = func_num_args();\n if ($num == 2) {\n self::$data[$args[0]] = $args[1];\n } else {\n if (is_array($args[0])) {\n foreach ($args[0] as $k => $v) {\n self::$data[$k] = $v;\n }\n }\n }\n }", "public function __set($key, $val) \n\t{\n\t\t$this->_data[$key] = $val;\n\t}", "abstract public function set($key, $value);", "abstract public function set($key, $value);", "protected function setData($key, $path)\n {\n if (method_exists($this, 'set') &&\n in_array('ArrayAccess', class_implements($this))\n ) {\n $this->set($key, require $path);\n }\n }", "function assign($key, $value = null) \n\t{\n\t\tif (is_array($key)) \n\t\t{\n\t\t\tforeach ($key as $k => $v) \n\t\t\t{\n\t\t\t\t$this->data[$k] = $v;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->data[$key] = $value;\n\t\t}\n\t}", "public function setKeyFromData()\n\t{\n\t\t$key = isset($this->data[$this->primaryKey])\n\t\t\t? $this->data[$this->primaryKey]\n\t\t\t: null;\n\n\t\tif ($key !== null && !is_numeric($key)) {\n\t\t\t$key = Hash::decode($key);\n\t\t}\n\n\t\t$this->key = $key;\n\t}", "public function set(string $prefix, string $key, int $data): void;", "public function setItem($key, $item);", "public function setExtraByKey($key, $data)\n {\n $data = $this->hydrateIfJsonToArray($data);\n $this->extra[$key] = $data;\n }", "public function offsetSet($key,$value)\n {\n if( !in_array($key,$this->_allowed_variables) )\n {\n\ttrigger_error('Modification of internal data is deprecated: '.$key,E_USER_NOTICE);\n }\n $this->_data[$key] = $value;\n }", "public function set($key,$value){\n\t\t$this->data[$key] = $value;\n\t\treturn true;\n\t}", "public function setRawValue($key, $value) {\n $this->_data[$key] = $value;\n }", "public function setAdditionalDataAttribute($key, $value)\n {\n $this->additionalData[$key] = $value;\n }", "public function setData($key, $value)\n {\n\n if (is_object($value)) {\n // muss auf false gesetzt werden, da der wert der Entity\n // sich ändern könnte und auf dieser beim save auch ein save getriggert\n // werden muss\n $this->synchronized = false;\n \n if ($value instanceof Entity) {\n \n if ('rowid' === $key) {\n\n // speichern der entity nachdem diese entity gespeichert wurde\n Log::warn('Veraltete zuweisung auf rowid');\n $this->postSave[] = $value;\n\n } else {\n\n $this->preSave[$key] = array($value,$key,null) ;\n\n if (!$value->isNew()) {\n $this->data[$key] = $value->getId();\n }\n \n $this->linked[$key] = $value;\n }\n \n } else {\n\n /// TODO was soll das?\n $this->data[$key] = $value->getId();\n\n // kann zB ein Upload Element sein, dass die ID des hochgeladenen Files zurückgibt\n $value->setEntity($this);\n $this->postSave[$key] = array($value, $key,null);\n }\n\n } else {\n\n if (!isset($this->data[$key])) {\n\n $this->synchronized = false;\n $this->data[$key] = $value;\n \n } elseif (!is_array($value) && $this->data[$key] !== (string)$value) {\n\n $this->synchronized = false;\n $this->data[$key] = $value;\n } else {\n\n $this->synchronized = false;\n $this->data[$key] = $value;\n }\n }\n\n }", "public function set($key, $data, $ttl = 0) {\n\t\t$debugger = Application::getInstance()->getDiContainer()->getDebugger();\n\n\t\t// If we have a debugger, we have to log the query\n\t\tif (!$this->debuggerDisabled && $debugger !== false) {\n\t\t\t$debugger->addItem(new StorageItem('dummy', 'dummy.' . $this->currentConfigurationName,\n\t\t\t\tStorageItem::METHOD_SET . ' ' . $key . ' for ' . $ttl, $data, 0));\n\t\t}\n\t}", "public function set( $key, $value );", "public function set( $key, $value );", "private function assign($key, $val)\n {\n $this->_data[$key] = $val;\n }", "public function set ($key, $value);", "public function set($key, $data): void\n {\n throw new LogicException('Non permitted operation.');\n }", "#[\\ReturnTypeWillChange]\n public function offsetSet($key, $value)\n {\n if (is_null($key)) {\n $this->data[] = $value;\n } else {\n $this->data[$key] = $value;\n }\n }", "public function __set(string $key, $value): void\n\t{\n\t\tif ($this->parentIsSet($key)) {\n\t\t\t$this->parentSet($key, $value);\n\n\t\t} else {\n\t\t\t$this->data[$key] = $value;\n\t\t}\n\t}", "public function assign($key, $value) {\n $this->dwoo_data->$key = $value;\n }", "abstract function set ($item, $data);", "public function __set($key,$value){\n if(!array_key_exists($key,$this->definition)){\n throw new \\Disco\\exceptions\\Exception(\"Field `{$key}` is not defined by this data model\");\n }//if\n $this->data[$key] = $value;\n }", "public function __set($key, $value)\r\n {\r\n $this->shared_data->set($key, $value);\r\n }", "public function AddData ($key, $value) {\n\t\t$this->data[$key] = $value;\t\t\t\t\n\t}", "public function put($key, $value)\n {\n $this->data[$key] = $value;\n }", "function set(array $data) {\n\t\tforeach ($data as $key => $value) {\n\t\t\t$this->$key = $value;\n\t\t}\n\t}" ]
[ "0.8836089", "0.8808068", "0.8503419", "0.8469229", "0.84649765", "0.84515786", "0.8041483", "0.78729576", "0.7846157", "0.7846157", "0.77286106", "0.7668747", "0.76631165", "0.75729126", "0.744478", "0.7431797", "0.74141586", "0.74141586", "0.73792315", "0.7283875", "0.72626126", "0.72521806", "0.72361827", "0.7220731", "0.71865976", "0.71859044", "0.7176953", "0.71709377", "0.71709377", "0.71709377", "0.7165487", "0.7153966", "0.71412945", "0.71332633", "0.7066271", "0.70652837", "0.7055209", "0.7054861", "0.7034191", "0.7026117", "0.70209926", "0.70209926", "0.70114404", "0.70060015", "0.69959503", "0.6983759", "0.69598186", "0.6944947", "0.6940686", "0.693842", "0.69379234", "0.6918334", "0.68961823", "0.68935627", "0.68903625", "0.68844986", "0.68818957", "0.68706805", "0.6869188", "0.6867663", "0.6865681", "0.6857804", "0.6847664", "0.6816788", "0.68117857", "0.68117857", "0.6806649", "0.6790625", "0.6782164", "0.6775951", "0.67716175", "0.6751589", "0.67458797", "0.67250913", "0.67250913", "0.67116743", "0.6703808", "0.6694851", "0.66946137", "0.66724116", "0.6670444", "0.66582984", "0.6656093", "0.66444796", "0.6637372", "0.66325533", "0.66286373", "0.6627984", "0.6627984", "0.6621504", "0.66196465", "0.6614598", "0.6611907", "0.6611744", "0.660166", "0.6593124", "0.65902144", "0.6589516", "0.65863544", "0.65833706", "0.65817076" ]
0.0
-1
Deletes the specified key's data
function delete (string $key) : bool { $key = $this->getUnsafePrefix() . $key; return $this->memcached->delete($key); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delData($key) {\n\t\tunset($this->_data[$key]);\n\t}", "public function delete( $key );", "public function del($key);", "public function delete($key);", "public function delete($key);", "public function delete($key);", "abstract public function delete( $key );", "abstract public function delete($key);", "abstract public function delete ($key);", "public function delete($key): void;", "public function deleteData($key) {\r\n\t\tif (isset($this->templateData[$key])) {\r\n\t\t\tunset($this->templateData[$key]);\r\n\t\t}\r\n\t}", "public function deleteItem($key);", "public function delete(string $key): void;", "public function delete_key($key){\n if($this->driver==\"file\"){\n $this->file->delete_file($this->path.md5($key).\".txt\");\n }\n if($this->driver==\"redis\"){\n $this->redis->hDel($this->path,md5($key));\n }\n }", "public function delete($key)\n {\n $data = new Data(self::$configs);\n\n $data->remove($key);\n self::$configs = $data->export();\n }", "function delete($key, $key2 = null)\n\t{\n\t\tif (isset($this->_data[$key]))\n\t\t{\n\t\t\tunset($this->_data[$key]);\n\t\t\t$this->store();\n\t\t}\n\t}", "private function delKey($key)\n {\n $this->model::where('key', $key)->get()->map(function($row){ $row->delete(); });\n }", "public function deleteItem($key)\n {\n }", "public function erase($key);", "public function delete( $key )\n\t{\n\t\t$this->getObject()->delete( $key );\n\t}", "public function delete($key) {\n\t\tif ($this->isValidKey($key)) {\n\t\t\treturn $this->deleteKey($key);\n\t\t}\n\t}", "public static function delete ( $key ) {\n return self::getAdapter()->delete( $key );\n }", "public function delete($key) {\n\t\t// and return the result\n\t\treturn eaccelerator_rm($key);\n\t}", "public function delete( $key ) {\n unset($this->data[$key]);\n return TRUE;\n }", "public function delete($key)\n {\n return DotArr::delete($this->data, $key);\n }", "public function delete($strKey)\n\t{\n\t\t$this->blnIsModified = true;\n\t\tunset($this->arrData[$strKey]);\n\t}", "function _delete($key){\n $this->_set($key, null);\n }", "public function delete($key)\n {\n $this->getTable()->wherePrimary($key)->delete();\n }", "public function unlink($key);", "public function removeData(string $key)\n {\n if (isset($this->data[$key])) {\n unset($this->data[$key]);\n }\n }", "function remove($key)\n {\n unset($this->data[$key]);\n }", "function remove($key)\n {\n unset($this->data[$key]);\n }", "protected function _removeKey($key) {}", "public function delete($key) {\n\t\t$debugger = Application::getInstance()->getDiContainer()->getDebugger();\n\n\t\t// If we have a debugger, we have to log the query\n\t\tif (!$this->debuggerDisabled && $debugger !== false) {\n\t\t\t$debugger->addItem(new StorageItem('dummy', 'dummy.' . $this->currentConfigurationName,\n\t\t\t\tStorageItem::METHOD_DELETE . ' ' . $key, null, 0));\n\t\t}\n\t}", "public function delete($key){\n return $this->connection->del($key);\n }", "function delete($key) {\n\t\tunset($this->_cache[$key]);\n\t}", "public static function delete($key)\n {\n if (self::has($key)) {\n unset(self::$__request[$key]);\n }\n }", "protected function clearPersistentData($key)\r\n {\r\n }", "function delete($key) {\n\t\t\treturn $this->inst->delete($key);\n\t\t}", "public function remove($key)\n {\n unset($this->data[$key]);\n }", "public function remove($key);", "public function remove($key);", "public function remove($key);", "public function remove($key);", "public function remove($key);", "public function remove($key);", "public function remove($key);", "public function remove($key);", "public function delete($key) {\n\t\treturn $this->engine->delete($key);\n\t}", "public function delete(string $key) : bool;", "public function deleteByKey($key)\r\n {\r\n return $this->db->delete()\r\n ->from(self::getTableName())\r\n ->whereEquals('key', $key)\r\n ->execute(true);\r\n }", "public function remove($key)\n\t{\n\t\tif (isset($this->data[$key])) {\n\t\t\tunset($this->data[$key]);\n\t\t}\n\t}", "public function remove($key) {}", "function delete ($key) {\n return $this->memcached->delete($key);\n }", "public function deleteByKey($key)\n {\n // Direct delete from memcached and local cache\n unset($this->cache[$key]);\n foreach ($this->mc as $mc) {\n $mc->delete($key);\n }\n }", "abstract public function remove($key);", "public function delete($key) {\n return 0;\n }", "function rm($key) {\n }", "abstract public function delete_cached( $key );", "public function delete($key) {\n\t\tif ($this->has($key)) {\n\t\t\tunlink($this->_dir . $key);\n\t\t}\n\t}", "public abstract function deleteObject($objKey);", "public function delete(string $key): void\n {\n $app = App::get();\n $keyMD5 = md5($key);\n $app->data->delete('.temp/cache/' . substr($keyMD5, 0, 3) . '/' . substr($keyMD5, 3) . '.2');\n }", "public function delete($key)\r\n\t{\r\n\t\t$args = func_get_args();\r\n\t\r\n\t\tforeach ($args as $key)\r\n\t\t{\r\n\t\t\tunset($this->_data[$key]);\r\n\t\t}\r\n\t\r\n\t\treturn $this;\r\n\t}", "public function delete($key)\n {\n return $this->send(['command'=>'delete', 'key'=>$key, 'seq'=>$this->getSequence()]);\n }", "public function delete(string $key): bool;", "public function delete(string $key): bool;", "public function delete(string $key): bool;", "public function delInCache($key);", "public function removeItem($key);", "public function delete ($key)\n {\n return apc_delete($key);\n }", "public function delete($key, array $options = array());", "public function _unset($key)\n {\n if (isset(self::$data[$key]))\n unset(self::$data[$key]);\n }", "public function delete($key = '')\n\t{\n\t\treturn false;\n\t}", "public function remove(string $key);", "function remove($key);", "function remove($key);", "public function __unset($key)\r\n {\r\n $this->shared_data->remove($key);\r\n }", "public function __unset($key) {\n unset(current($this->_data)[$key]);\n }", "public function __unset( $key ) {\n\t\tunset( $this->_data[$key] );\n\t}", "public function deleteItem(string $key): bool;", "public function deleteItem(string $key): bool;", "public function delete($ssh_key);", "public static function delete(string $key)\n {\n return \\apcu_delete(self::PREFIX.$key);\n }", "public function delete($key) {\n return apc_delete($key);\n }", "public function removeAt($key);", "public function del($key, $hash = 'request') {\n\t\tunset($this->_hashes[$hash][$key]);\n\t}", "public function removeData($key) {\n if (!is_null($this->getDataByKey($key))) {\n unset($this->new_log->getData()[$key]);\n }\n }", "function removeDataFor(PersonalKey $personalKey): void\n {\n $this->db->write(\n \"delete from {$this->table} where personal_key = :personal_key\",\n [\n 'personal_key' => $personalKey->toString(),\n ]\n );\n }", "public function delete($keyName);", "public function delete($key)\n {\n // don't start a new session to remove something that isn't there\n $this->lazyStart();\n unset($this->_store[$key]);\n }", "public function deleteKey( $key )\n {\n /** @var $client \\Memcached */\n $client = $this->getClient();\n $client->delete( $key );\n }", "function remove ($key);", "public function __unset($key);", "public function __unset($key);", "public function delete($key)\n {\n return $this->findOrDelete($key, true);\n }", "function delete_post_meta_by_key($post_meta_key)\n {\n }", "public function offsetUnset($key){\n if($this->offsetExists($key)){\n unset($this->data[$key]);\n }//if\n }", "public function remove($key){\n\n }", "public function delete($key)\n {\n return $this->client->del($key);\n }", "public function delete_by($key, $value){\n \n if (empty($key)) {\n return FALSE;\n }\n \n $this->db->where(htmlentities($key), htmlentities($value))->delete($this->table_name);\n }", "public function remove(string $key): void;" ]
[ "0.83516246", "0.81429935", "0.8136656", "0.8077837", "0.8077837", "0.8077837", "0.7903742", "0.7899064", "0.7872455", "0.785028", "0.7844502", "0.7739798", "0.7592863", "0.75309414", "0.74576163", "0.742858", "0.7405364", "0.7299999", "0.7278668", "0.7260282", "0.72602487", "0.725214", "0.72189015", "0.71984154", "0.7181945", "0.71663517", "0.71437675", "0.7131851", "0.7122259", "0.7102711", "0.70902646", "0.70902646", "0.7088936", "0.7082081", "0.70688796", "0.70496744", "0.70486605", "0.7039477", "0.7029013", "0.70077395", "0.7002704", "0.7002704", "0.7002704", "0.7002704", "0.7002704", "0.7002704", "0.7002704", "0.7002704", "0.6976448", "0.6973675", "0.6972578", "0.6939201", "0.69384915", "0.69224733", "0.6919583", "0.6919577", "0.6876493", "0.68711585", "0.6869793", "0.6869028", "0.68572634", "0.68438435", "0.6834598", "0.6819744", "0.6805184", "0.6805184", "0.6805184", "0.6802722", "0.6792356", "0.67866534", "0.67814463", "0.6778881", "0.67745835", "0.67682135", "0.6760455", "0.6760455", "0.6756418", "0.67513466", "0.67491657", "0.673929", "0.673929", "0.67032534", "0.6701524", "0.66857404", "0.6679597", "0.6674963", "0.66563475", "0.6651786", "0.66473883", "0.66364974", "0.66242194", "0.66185033", "0.6613863", "0.6613863", "0.6613329", "0.6603545", "0.65943515", "0.6592839", "0.65915376", "0.6566637", "0.65665954" ]
0.0
-1