query
stringlengths
9
43.3k
document
stringlengths
17
1.17M
metadata
dict
negatives
sequencelengths
0
30
negative_scores
sequencelengths
0
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
/ Remove any expired cache. This checks all files to ensure we don't get a build up.
private function CleanupCache() { $cached_files = (glob("$this->CacheTmp/emuwebcache*")); foreach($cached_files as $file) { $cacheseconds = $this->Cache * 60 * 60; $expiretime = filemtime($file) + $cacheseconds; if (time() >= $expiretime) { /* * Remove the file */ unlink($file); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function delete_expired() {\n $cwd = getcwd();\n chdir($this->directory);\n foreach ($this->all() as $filename) {\n // XXX reads all entries XXX\n $content = @file_get_contents($filename);\n if ($content === FALSE) {\n continue;\n }\n $cache = @_filecache_unserialize($content);\n if ($cache === FALSE) {\n continue;\n }\n if ($cache->expire == CACHE_PERMANENT) {\n continue;\n }\n if ($cache->expire == CACHE_TEMPORARY ||\n $cache->expire < REQUEST_TIME) {\n @unlink($filename);\n }\n } // foreach $filename\n chdir($cwd);\n }", "function cleanup() {\n $d = dir($this->cache_dir);\n \n $older_than = time() - $this->lifetime;\n \n while(($entry = $d->read()) !== false) {\n $path = $this->cache_dir . $entry;\n if(str_starts_with($entry, 'cch_') && (filectime($path) < $older_than)) {\n unlink($path);\n } // if\n } // if\n }", "private function deleteOldCacheFiles()\n\t{\n\t\tif( rand(0,20) === 0 ) {\n\t\t\tif( $handle = opendir($this->cachePath) ) {\n\t\t\t\twhile( false !== ($entry = readdir($handle)) ) {\n\t\t\t\t\tif( strpos($entry, 'cache_') === 0 ) {\n\t\t\t\t\t\t$path = $this->cachePath . DIRECTORY_SEPARATOR . $entry;\n\t\t\t\t\t\t$filemtime = filemtime($path);\n\t\t\t\t\t\tif( (time() - filemtime($path)) > $this->options['cache_lifetime'] ) {\n\t\t\t\t\t\t\t@unlink($path);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private function cleanUp()\n {\n foreach (glob($this->getCachePath() . '/*') as $file) {\n\n if (strpos('mimeMap.json', $file) !== false) {\n continue;\n }\n\n if (time() - filemtime($file) >= $this->ttl->inSeconds()) {\n @unlink($file);\n }\n }\n }", "function deleteCache() {\n if ($dh = opendir(PAPAYA_PATH_CACHE)) {\n while ($file = readdir($dh)) {\n $match = preg_match(\n '(^\\.box_\\d+_'.(int)$this->boxId.'(_[a-f\\d]{32})+(\\.\\w+)?$)i', $file\n );\n if ($match) {\n unlink(PAPAYA_PATH_CACHE.$file);\n }\n }\n closedir($dh);\n }\n }", "private static function clearcache()\n {\n foreach (glob(self::$cache_path . '*') as $file) {\n unlink($file);\n }\n }", "private function delete_cache_files() {\n\t\tforeach ( $this->cache_dirs as $dir ) {\n\t\t\t$this->delete( $this->cache_path . $dir );\n\t\t}\n\t}", "public function clearCache()\n {\n $finder = new Finder();\n\n /** @var SplFileInfo $file */\n foreach ($finder->in($this->options['cache_dir'])->files() as $file) {\n unlink($file->getRealpath());\n }\n }", "static function cleanupTmpFiles(){\n $files = CHOQ_FileManager::getFiles(CHOQ_ACTIVE_MODULE_DIRECTORY.\"/tmp\");\n foreach($files as $file){\n if(preg_match(\"~filecontents\\.|import\\.~i\", basename($file))){\n if(filemtime($file) < time() - self::CACHETIME) unlink($file);\n }\n }\n }", "protected function clearExpired()\n {\n if (empty($this->cache)) {\n $file = $this->directory . 'Cache.dat';\n\n //~ Retrieve Cache information.\n if (file_exists($file)) {\n $content = file_get_contents($file);\n if (!empty($content)) {\n $this->cache = unserialize($content);\n } else {\n $this->cache = array();\n }\n }\n }\n\n // Clean all caches have expired.\n foreach ($this->cache as $pKey => $time) {\n if ($time < time()) {\n $this->remove($pKey);\n }\n }\n\n return true;\n }", "public function cleanUpGarbage()\n\t{\n\t\t$phptalCacheFilesExpire = time() - $this->getCacheLifetime() * 3600 * 24;\n\t\t$upperLimit = $this->getPhpCodeDestination() . 'tpl_' . $phptalCacheFilesExpire . '_';\n\t\t$lowerLimit = $this->getPhpCodeDestination() . 'tpl_0_';\n\t\t$phptalCacheFiles = glob($this->getPhpCodeDestination() . 'tpl_*.' . $this->getPhpCodeExtension() . '*');\n\n\t\tif ($phptalCacheFiles)\n\t\t{\n\t\t\tforeach($phptalCacheFiles as $index => $file)\n\t {\n\t\t\t\tif ($file > $upperLimit && substr($file,0,strlen($lowerLimit)) !== $lowerLimit)\n\t\t\t\t{\n\t\t\t\t unset($phptalCacheFiles[$index]);\n\t\t\t\t}\n\t }\n\t foreach($phptalCacheFiles as $file)\n\t {\n\t $time = filemtime($file);\n\t if ($time && $time < $phptalCacheFilesExpire) @unlink($file);\t\t\t \n\t\t }\n\t }\n\t}", "private function __deleteCache() {\n\t\t$iterator = new RecursiveDirectoryIterator(CACHE);\n\t\tforeach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file) {\n\t\t\t$path_info = pathinfo($file);\n\t\t\tif ($path_info['dirname']==TMP.\"cache\" && $path_info['basename']!='.svn') {\n\t\t\t\tif (!is_dir($file->getPathname())) {\n\t\t\t\t\tunlink($file->getPathname());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public function purge() {\n\t\tforeach(glob($this->_cachepath . '*.page') as $file) {\n\t\t\tunlink($file);\n\t\t}\n\t}", "public function process() {\n\t\t$path = PATH_site . self::CACHE_DIRECTORY;\n\t\t$files = t3lib_div::getFilesInDir($path);\n\n\t\tforeach ($files as $file) {\n\t\t\tunlink($path . $file);\n\t\t}\n\t}", "public function clearAll()\n\t{\n\t\t$dh = opendir($this->dir); \n\t\twhile($file = readdir($dh)) \n\t\t{ \n\t\t\tif(!is_dir($file)) \n\t\t\t{ @unlink($dir.$file); } \n\t\t} \n\t\t\tclosedir($dh);\n\t\t\techo \"cache clear\";\n\t}", "private function freshen()\n {\n //step through the cache array, remove all expired elements\n $cache_key_arr = array_keys($this->cache_contents);\n foreach ($cache_key_arr as $cacheKey) {\n if ($this->isValid($cacheKey) == -1) {\n $this->expire($cacheKey);\n }\n }\n }", "private static function fileCleanup()\n {\n $dir = new DirectoryIterator(Framework::tmp('Cache'));\n $files = [];\n foreach ($dir as $entry) {\n if ($entry->isFile()) {\n $files[] = $entry->getFilename();\n }\n }\n shuffle($files);\n $files = array_slice($files, 0, ceil(count($files) / 10)); // Take 10% of the files\n $cache = new self('GC', 'file');\n foreach ($files as $id) {\n $cache->_guid = $id;\n $cache->_file = fopen(Framework::tmp('Cache') . $id, 'r');\n $hit = $cache->read($output);\n fclose($cache->_file);\n $cache->_file = null;\n if ($hit === false) { // Expired?\n $cache->clear();\n }\n }\n }", "function _img_cleanCache($cache){\r\n$files=glob($cache.'*');\r\nif(count($files)>0)foreach($files as $file)unlink($file);\r\n}", "private function clearCache($allCache = true){\n \tif (is_dir($this->cache_dir)) {\n \t\tif ($dh = opendir($this->cache_dir)) {\n \t\t\twhile (($file = readdir($dh)) !== false) {\n \t\t\t\tif (filemtime($this->cache_dir . $file) < (time() - ($this->cache_time * 61)) || $allCache) {\n \t\t\t\t\t@unlink($this->cache_dir . $file);\n \t\t\t\t}\n \t\t\t}\n \t\t\tclosedir($dh);\n \t\t}\n \t}\n }", "private function clean() {\n if (file_exists(__DIR__ . '/cache/example')) {\n unlink(__DIR__ . '/cache/example');\n }\n if (file_exists(__DIR__ . '/cache')) {\n rmdir(__DIR__ . '/cache');\n }\n }", "public static function purgeCache()\n\t{\n\t\t$filePaths = static::getCacheFilePaths();\n\n\t\tif (file_exists($filePaths['fullPath'])) {\n\t\t\t(new Filesystem())->dumpFile($filePaths['fullPath'], '');\n\t\t\tstatic::refreshOpcodeCache($filePaths['fullPath']);\n\t\t}\n\t}", "function page_cache_remove_all_cached_contents() {}", "public static function clean_cache_dir() : void\n\t{\n\t\t$files = new RecursiveIteratorIterator(\n\t\t\tnew RecursiveDirectoryIterator(KO7::$cache_dir, RecursiveDirectoryIterator::SKIP_DOTS),\n\t\t\tRecursiveIteratorIterator::CHILD_FIRST\n\t\t);\n\n\t\tforeach ($files as $file) {\n\t\t\tif ($file->getExtension() === 'gitignore') {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$todo = ($file->isDir() ? 'rmdir' : 'unlink');\n\t\t\t$todo($file->getRealPath());\n\t\t}\n\t}", "protected function cleanOldCaptcha()\n {\n $time = time();\n\n if ($handle = opendir($this->captchaDirectory)) {\n while (false !== ($entry = readdir($handle))) {\n if ($entry != \".\" && $entry != \"..\") {\n $chunks = explode('-', $entry);\n $timelapse = $time - $chunks[1];\n if($timelapse > $this->expire){\n unlink($this->captchaDirectory . DIRECTORY_SEPARATOR . $entry);\n }\n }\n }\n closedir($handle);\n }\n }", "public function removeCached();", "protected function _clearCachedTemplates()\n\t{\n\t\t$directories = array(\n\t\t\tISC_ADMIN_TEMPLATE_CACHE_DIRECTORY,\n\t\t\tISC_FRONT_TEMPLATE_CACHE_DIRECTORY,\n\t\t);\n\t\tforeach($directories as $directory) {\n\t\t\t$dh = opendir($directory);\n\t\t\tif (!$dh) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\twhile (($file = readdir($dh)) !== false) {\n\t\t\t\tif (substr($file, -4) != '.php') {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t@unlink($directory . '/' . $file);\n\t\t\t}\n\n\t\t\tclosedir($dh);\n\t\t}\n\t}", "protected function clearCache(): void\n {\n $filesystem = new Filesystem();\n // We need to normalize path to prevent Windows 260-length filename trouble\n $absoluteCacheDir = PathResolver::realpath($this->configuration['cacheDir']);\n if ($filesystem->exists($absoluteCacheDir)) {\n $filesystem->remove($absoluteCacheDir);\n }\n }", "public function clear_cache() {\n if ($this->file_root) {\n $this->rrmdir($this->file_root);\n }\n }", "protected function delete_flushed() {\n static $recursion = FALSE; // XXX how cache.inc survives this?\n if ($recursion) {\n return;\n }\n $recursion = TRUE;\n\n // Garbage collection necessary when enforcing a minimum cache lifetime.\n $cache_flush = variable_get('cache_flush_' . $this->bin, 0);\n if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= REQUEST_TIME)) {\n // Reset the variable immediately to prevent a meltdown in heavy load situations.\n variable_set('cache_flush_' . $this->bin, 0);\n // Time to flush old cache data\n $cwd = getcwd();\n chdir($this->directory);\n foreach ($this->all() as $filename) {\n // XXX reads all entries XXX\n $content = @file_get_contents($filename);\n if ($content === FALSE) {\n continue;\n }\n $cache = @_filecache_unserialize($content);\n if ($content === FALSE) {\n continue;\n }\n if ($cache->expire != CACHE_PERMANENT &&\n $cache->expire <= $cache_flush) {\n @unlink($filename);\n }\n } // foreach $filename\n chdir($cwd);\n } // if $cache_flush\n\n $recursion = FALSE;\n }", "private function __deleteCache()\n {\n $iterator = new RecursiveDirectoryIterator(CACHE);\n foreach(new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file)\n {\n $path_info = pathinfo($file);\n \n if($path_info['dirname'] == ROOT . DS . \"tmp\" . DS . \"cache\")\n {\n \t$file_name = $path_info['filename'];\n \t$file_arr = str_split($file_name, 25);\n \t\n if($file_arr[0] == \"UserMgmt_rules_for_group_\")\n {\n \tunlink($file->getPathName());\n }\n }\n }\n }" ]
[ "0.8377084", "0.82819843", "0.8080858", "0.80006933", "0.7742555", "0.7655393", "0.76100284", "0.7506979", "0.7488957", "0.7455908", "0.7410741", "0.7403073", "0.7360637", "0.73289573", "0.72915083", "0.72634566", "0.7245051", "0.71775347", "0.7174182", "0.71631867", "0.715352", "0.7122412", "0.7120346", "0.7112123", "0.71016544", "0.7095636", "0.7089421", "0.70696187", "0.7065272", "0.70644706" ]
0.8400031
0
deleteCharterStatusTypeById Deletes an existing resource using the resource identifier.
public function deleteCharterStatusTypeById($id, $if_match = null) { list($response, $statusCode, $httpHeader) = $this->deleteCharterStatusTypeByIdWithHttpInfo ($id, $if_match); return $response; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\n\t\t$sql = \"SELECT `name` FROM `statuses` WHERE `statusID` = '$_GET[statusID]'\";\n\t\t$result = $this->new_mysql($sql);\n\t\twhile ($row = $result->fetch_assoc()) {\n\t\t\t$name = $row['name'];\n\t\t}\n\n\t\t$sql = \"SELECT `statusID` FROM `charters` WHERE `statusID` = '$_GET[statusID]'\";\n\t\t$counter = \"0\";\n\t\t$result = $this->new_mysql($sql);\n while ($row = $result->fetch_assoc()) {\n\t\t\t$counter++;\n }\n if ($counter > 0) {\n\t\t\t$msg = '<div class=\"alert alert-danger\">'.$name.' has linked charters and can not be deleted.</div>';\n } else {\n $sql = \"DELETE FROM `statuses` WHERE `statusID` = '$_GET[statusID]'\";\n $result = $this->new_mysql($sql);\n if ($result == \"TRUE\") {\n\t\t\t\t$msg = '<div class=\"alert alert-success\">'.$name.' was deleted.</div>';\n } else {\n\t\t\t\t$msg = '<div class=\"alert alert-danger\">'.$name.' failed to delete.</div>';\n }\n }\n $this->charter_status($msg);\n\t}", "public function deleteCharterStatusTypeByIdWithHttpInfo($id, $if_match = null)\n {\n \n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling deleteCharterStatusTypeById');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes/{id}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n \n // header params\n \n if ($if_match !== null) {\n $headerParams['If-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_match);\n }\n // path params\n \n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n \n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'DELETE',\n $queryParams, $httpBody,\n $headerParams\n );\n \n return array(null, $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function delete($id)\n {\n $bt = BatteryType::findOrFail(base64_decode($id));\n if($bt){\n $bt->delete();\n return redirect()->route('admin.battery-type.list')\n ->with('Success','Battery type deleted SuccessFully'); \n } else {\n return redirect()->route('admin.battery-type.list')\n ->with('Error','Failed');\n }\n }", "public function destroy($id)\n {\n // Get country\n $industryType = IndustryType::findOrFail($id);\n if($industryType->delete()) {\n return $industryType;\n }\n }", "function delete_award_type($id)\n{\n $_title = $GLOBALS['SITE_DB']->query_select_value_if_there('award_types', 'a_title', array('id' => $id));\n if (is_null($_title)) {\n warn_exit(do_lang_tempcode('MISSING_RESOURCE', 'award_type'));\n }\n $_description = $GLOBALS['SITE_DB']->query_select_value('award_types', 'a_description', array('id' => $id));\n log_it('DELETE_AWARD_TYPE', strval($id), get_translated_text($_title));\n $GLOBALS['SITE_DB']->query_delete('award_types', array('id' => $id), '', 1);\n $GLOBALS['SITE_DB']->query_delete('award_archive', array('a_type_id' => $id), '', 1);\n delete_lang($_title);\n delete_lang($_description);\n\n if ((addon_installed('commandr')) && (!running_script('install')) && (!get_mass_import_mode())) {\n require_code('resource_fs');\n expunge_resource_fs_moniker('award_type', strval($id));\n }\n}", "public function destroy($id)\n {\n $user_type = UserType::find($id);\n $user_type->activo = 0;\n if($user_type->save()){\n return response()->json(['message' => \"Eliminado\"]);\n }\n }", "public function destroy($id)\n {\n $type = CustomerType::find($id);\n\n $type->delete();\n \n //Session::flash('message', 'Successfully deleted the nerd!');\n Alert::success('Customer type deleted.'); \n return Redirect::route('customertype.index');\n }", "public function delete($id)\n\t{\n\t\t//Soft delete the specimentype\n\t\t$specimentype = SpecimenType::find($id);\n\t\t$inUseByTesttype = $specimentype->testTypes->toArray();\n\t\t$inUseBySpecimen = $specimentype->specimen->toArray();\n\t\tif (empty($inUseByTesttype) && empty($inUseBySpecimen)) {\n\t\t // The specimen type is not in use\n\t\t\t$specimentype->delete();\n\t\t} else {\n\t\t // The specimen type is in use\n\t\t return Redirect::route('specimentype.index')\n\t\t \t->with('message', trans('messages.failure-specimen-type-in-use'));\n\t\t}\n\t\t// redirect\n\t\t $url = Session::get('SOURCE_URL');\n\t\t\t\n\t\t\treturn Redirect::to($url)\n\t\t\t->with('message', trans('messages.success-updating-specimen-type'));\n\t}", "function delete($id)\n {\n $this->db->where('id', $id);\n $this->db->delete('rondetype', $rondetype);\n }", "public function deleteType()\n {\n $query = \"DELETE FROM sms_todo_status WHERE todo_status_id = :id\";\n\n $sql = $this->db->prepare($query);\n $sql->bindValue(':id', $this->data->id);\n\n if ($sql->execute()) {\n $data[\"status\"] = 'success';\n }\n return $data;\n }", "public function destroy($id)\n {\n DB::table(\"CustomerTYPE\")->where('Ctype_No', '=', $id)->delete();\n return redirect('customertype');\n }", "public function destroy($id)\n {\n Lettertype::destroy($id);\n return redirect('/lettertypes');\n }", "public function destroy($id)\n {\n //Valida se usuário possui permissão para acessar esta opção\n if(App\\Models\\User::getPermission('printer_types_remove',Auth::user()->user_type_code)){\n \n $printerType = $this->printerTypeRepository->findWithoutFail($id);\n\n if (empty($printerType)) {\n Flash::error(Lang::get('validation.not_found'));\n\n return redirect(route('printerTypes.index'));\n }\n\n $this->printerTypeRepository->delete($id);\n\n //Grava log\n $descricao = 'Excluiu PrinterType ID: '.$id;\n $log = App\\Models\\Log::wlog('printer_types_remove', $descricao);\n\n\n Flash::success(Lang::get('validation.delete_success'));\n return array(0,Lang::get('validation.delete_success'));\n\n }else{\n //Sem permissão\n Flash::error(Lang::get('validation.permission'));\n return array(1,Lang::get('validation.permission'));\n } \n }", "public function destroy($id)\n {\n UserTypeModel::destroy($id);\n return redirect('usertypes');\n }", "public function destroy($id)\n {\n // Si no tiene permisos para modificar lo echamos\n if (!auth()->user()->can('admin-bouncetypes-delete')) {\n app()->abort(403);\n }\n\n $bouncetype = BounceType::find($id);\n if (empty($bouncetype)) {\n app()->abort(404);\n }\n\n $bouncetype->delete();\n\n return response()->json(array(\n 'success' => true,\n 'msg' => trans(\"notificationbroker::bouncetypes/admin_lang.deleted\"),\n 'id' => $bouncetype->id\n ));\n }", "public function destroy($id)\n {\n $room = room_type::find($id);\n $room->delete();\n set_flash_msg('flash_success','Room Type Deleted Successsfully.');\n return redirect('admin/room-type');\n }", "public function destroyStatus ($id='')\n\t{\n\t\tif(!empty($id) && is_integer($id))\n\t\t{\n\t\t\t$url = $this->UrlStatus;\n\t\t\t$url .= 'destroy/'. $id .'.xml';\n\t\t\n\t\t\t$request = $this->requestToTwitter($url);\n\t\t\treturn $request;\n\t\t}else\n\t\t{\n\t\t\t$this->Error(6);\n\t\t}\t\n\t}", "public function delete_user_type_by_id($id)\n\t{\n\t\t\n\t\t$this->db->where('user_type_id', $id);\n\t\t$this->db->delete('user_type');\n\t\treturn $this->db->affected_rows();\n\t}", "public function destroy($id_type)\n {\n $type_product = TypeProduct::find($id_type);\n $type_product->status_type = 'ยกเลิก';\n $type_product->save();\n return response()->json('Users Deleted Successfully.');\n }", "public function destroy($id)\n {\n if (Gate::denies('RESTAURANT_ACCOUNT_TYPE')) {\n return redirect()->back();\n }\n\n $this->restAccountTypeRepo->deleteItem($id);\n return redirect()->route('admin.restAccountType.index')->with(['success' => 'Deleted']);\n }", "public function destroy($id)\n\t{\n\t\t//custom message if this methods throw an exception\n\t\t\\Session::put('errorOrigin', \" eliminando el Acceso a Trabajo\");\t\n\n\t\t//custom route to REDIRECT redirect('x') if there's an error\n\t\t\\Session::put('errorRoute', \"state_user_types\");\n\n\t\tDB::beginTransaction();//starts database transaction. If there´s no commit no transaction\n\t\t\t//will be made. Also, all transactions can be rollbacked.\n\n\t\t$state_user_types = $this->model->find($id);\n\n\t\tif($state_user_types == null) {\n\t\t\tthrow new \\Exception('Error en editar el Acceso a Trabajo con el id:' .$id\n\t\t. \" en el método State_user_typeController@edit\");\n\t\t} else {\n\t\t\t$state_user_types->active_flag = 0;\n\t\t\t$state_user_types->save();\n\n\t\t\tDB::commit();//commit to database\n\n\t\t\t$user_type = Auth::user()->user_type_id;\t\n\t\t\tif($user_type == 1){//admin user\n\t\t\t\treturn redirect('state_user_types')->with('success', \n\t\t\t\t'Acceso a trabajo eliminado satisfactoriamente');\n\t\t\t}\n\t\t}\n\t}", "function delete_type($id)\n {\n return $this->db->delete('type',array('id'=>$id));\n }", "public function destroy($id)\n {\n $user = auth()->user();\n $documentTypeUser = \\App\\DocumentType::find($id)->users;\n $message = 'Success';\n if ($user->organization_id == $documentTypeUser->organization_id) {\n $documentTypes = \\App\\DocumentType::find($id);\n try {\n $documentTypes->delete();\n } catch (\\Exception $e) {\n $documentTypes->status=0;\n $documentTypes->save();\n }\n } else {\n $message = 'You are not authorized to performe this action';\n } \n return redirect('documentTypes')->with('success',$message);\n }", "function delete_user_type($user_type_id)\n {\n $parameter_array = array();\n \n array_push($parameter_array, array(\n 'and',\n 'id',\n '=',\n $user_type_id\n ));\n \n parent::delete('i', $parameter_array);\n }", "abstract function deleteResource(int $id);", "public function destroy($id)\n {\n $count_classroom_type = DB::select('SELECT * FROM classrooms where md5(concat(ClassroomType)) = \"'.$id.'\"');\n\n if(!empty($count_classroom_type)){\n return [\"type\"=>\"error\",\"message\"=>\"This Classroom Type has sub record\"];\n }\n else{\n \n $query = DB::delete('DELETE FROM classroom_types WHERE md5(concat(CTID)) = \"'.$id.'\"');\n \n if($query){\n return [\"type\"=>\"success\",\"message\"=>\"Classroom Type Deleted Successfully\"];\n }\n else{\n return [\"type\"=>\"error\",\"message\"=>\"Error Deleting\"];\n }\n \n }\n }", "public function destroy($id)\n {\n $examtype = Examtype::where('id',$id)->first();\n $this->authorize('update', $examtype);\n\n \n $examtype->delete();\n\n flash('Examtype Successfully deleted!')->success();\n return redirect()->route('examtype.index');\n }", "public function destroy($id)\n {\n $cruiseshipType = CruiseshipsTypes::findOrFail($id);\n\n try {\n CruiseshipsTypesTranslation::where('fk_cruiseship_type', $id)->delete();\n $cruiseshipType->delete();\n Alert::success('Registro eliminado correctamente!')->flash();\n } catch (Exception $e) {\n Alert::error('No puedes eliminar el registro!')->flash();\n } \n\n return redirect()->route('admin.cruiseships-types.index');\n }", "public function deleteById(string $id);", "public function destroy($id)\n {\n try {\n $typeOutcome = TypeOutcome::findOrFail($id);\n $typeOutcome->delete();\n return $this->success('Tipo de egreso eliminado correctamente', 204);\n } catch (\\Throwable $th) {\n return response()->json([$th->getMessage(), $th->getLine()]);\n }\n }" ]
[ "0.6845801", "0.60792756", "0.5784982", "0.57276803", "0.57025343", "0.5685829", "0.56471586", "0.56079215", "0.55486375", "0.5478571", "0.54785544", "0.5476222", "0.5435576", "0.5404853", "0.5396479", "0.539123", "0.5390358", "0.5383187", "0.5382703", "0.53705555", "0.53692317", "0.53582245", "0.53459775", "0.53451484", "0.53445506", "0.53401023", "0.5339768", "0.53254366", "0.5306966", "0.5297139" ]
0.72178674
0
deleteCharterStatusTypeByIdWithHttpInfo Deletes an existing resource using the resource identifier.
public function deleteCharterStatusTypeByIdWithHttpInfo($id, $if_match = null) { // verify the required parameter 'id' is set if ($id === null) { throw new \InvalidArgumentException('Missing the required parameter $id when calling deleteCharterStatusTypeById'); } // parse inputs $resourcePath = "/charterStatusTypes/{id}"; $httpBody = ''; $queryParams = array(); $headerParams = array(); $formParams = array(); $_header_accept = ApiClient::selectHeaderAccept(array('application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array()); // header params if ($if_match !== null) { $headerParams['If-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_match); } // path params if ($id !== null) { $resourcePath = str_replace( "{" . "id" . "}", $this->apiClient->getSerializer()->toPathValue($id), $resourcePath ); } // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, 'DELETE', $queryParams, $httpBody, $headerParams ); return array(null, $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 500: $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\WebServiceError', $e->getResponseHeaders()); $e->setResponseObject($data); break; } throw $e; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function deleteCharterStatusTypeById($id, $if_match = null)\n {\n list($response, $statusCode, $httpHeader) = $this->deleteCharterStatusTypeByIdWithHttpInfo ($id, $if_match);\n return $response; \n }", "public function delete_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\n\t\t$sql = \"SELECT `name` FROM `statuses` WHERE `statusID` = '$_GET[statusID]'\";\n\t\t$result = $this->new_mysql($sql);\n\t\twhile ($row = $result->fetch_assoc()) {\n\t\t\t$name = $row['name'];\n\t\t}\n\n\t\t$sql = \"SELECT `statusID` FROM `charters` WHERE `statusID` = '$_GET[statusID]'\";\n\t\t$counter = \"0\";\n\t\t$result = $this->new_mysql($sql);\n while ($row = $result->fetch_assoc()) {\n\t\t\t$counter++;\n }\n if ($counter > 0) {\n\t\t\t$msg = '<div class=\"alert alert-danger\">'.$name.' has linked charters and can not be deleted.</div>';\n } else {\n $sql = \"DELETE FROM `statuses` WHERE `statusID` = '$_GET[statusID]'\";\n $result = $this->new_mysql($sql);\n if ($result == \"TRUE\") {\n\t\t\t\t$msg = '<div class=\"alert alert-success\">'.$name.' was deleted.</div>';\n } else {\n\t\t\t\t$msg = '<div class=\"alert alert-danger\">'.$name.' failed to delete.</div>';\n }\n }\n $this->charter_status($msg);\n\t}", "public function getCharterStatusTypeByKeyWithHttpInfo($charter_status_type_id, $if_none_match = null)\n {\n \n // verify the required parameter 'charter_status_type_id' is set\n if ($charter_status_type_id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $charter_status_type_id when calling getCharterStatusTypeByKey');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n // query params\n \n if ($charter_status_type_id !== null) {\n $queryParams['charterStatusTypeId'] = $this->apiClient->getSerializer()->toQueryValue($charter_status_type_id);\n }\n // header params\n \n if ($if_none_match !== null) {\n $headerParams['If-None-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_none_match);\n }\n \n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n \n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'GET',\n $queryParams, $httpBody,\n $headerParams, '\\Swagger\\Client\\Model\\CharterStatusType'\n );\n \n if (!$response) {\n return array(null, $statusCode, $httpHeader);\n }\n\n return array(\\Swagger\\Client\\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\CharterStatusType', $httpHeader), $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 200:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\CharterStatusType', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function getCharterStatusTypesByIdWithHttpInfo($id, $if_none_match = null)\n {\n \n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling getCharterStatusTypesById');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes/{id}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n \n // header params\n \n if ($if_none_match !== null) {\n $headerParams['If-None-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_none_match);\n }\n // path params\n \n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n \n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'GET',\n $queryParams, $httpBody,\n $headerParams, '\\Swagger\\Client\\Model\\CharterStatusType'\n );\n \n if (!$response) {\n return array(null, $statusCode, $httpHeader);\n }\n\n return array(\\Swagger\\Client\\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\CharterStatusType', $httpHeader), $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 200:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\CharterStatusType', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function putCharterStatusTypeWithHttpInfo($id, $charter_status_type, $if_match = null)\n {\n \n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling putCharterStatusType');\n }\n // verify the required parameter 'charter_status_type' is set\n if ($charter_status_type === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $charter_status_type when calling putCharterStatusType');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes/{id}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n \n // header params\n \n if ($if_match !== null) {\n $headerParams['If-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_match);\n }\n // path params\n \n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // body params\n $_tempBody = null;\n if (isset($charter_status_type)) {\n $_tempBody = $charter_status_type;\n }\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'PUT',\n $queryParams, $httpBody,\n $headerParams\n );\n \n return array(null, $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function delEntityWithHttpInfo()\n {\n // parse inputs\n $resourcePath = \"/{uuid}\";\n $httpBody = '';\n $queryParams = [];\n $headerParams = [];\n $formParams = [];\n $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);\n\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'DELETE',\n $queryParams,\n $httpBody,\n $headerParams,\n null,\n '/{uuid}'\n );\n\n return [null, $statusCode, $httpHeader];\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n }\n\n throw $e;\n }\n }", "public function deleteType()\n {\n $query = \"DELETE FROM sms_todo_status WHERE todo_status_id = :id\";\n\n $sql = $this->db->prepare($query);\n $sql->bindValue(':id', $this->data->id);\n\n if ($sql->execute()) {\n $data[\"status\"] = 'success';\n }\n return $data;\n }", "public function destroyStatus ($id='')\n\t{\n\t\tif(!empty($id) && is_integer($id))\n\t\t{\n\t\t\t$url = $this->UrlStatus;\n\t\t\t$url .= 'destroy/'. $id .'.xml';\n\t\t\n\t\t\t$request = $this->requestToTwitter($url);\n\t\t\treturn $request;\n\t\t}else\n\t\t{\n\t\t\t$this->Error(6);\n\t\t}\t\n\t}", "public function deleteWithHttpInfo($request)\n {\n $request = $this->deleteRequest($request);\n \n $response = $this->callClient($request);\n return [null, $response->getStatusCode(), $response->getHeaders()];\n }", "public function customersIdTeamsDeleteWithHttpInfo($id)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling customersIdTeamsDelete');\n }\n // parse inputs\n $resourcePath = \"/Customers/{id}/teams\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'DELETE',\n $queryParams,\n $httpBody,\n $headerParams,\n null,\n '/Customers/{id}/teams'\n );\n\n return array(null, $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n }\n\n throw $e;\n }\n }", "public function destroy($id)\n {\n $user_type = UserType::find($id);\n $user_type->activo = 0;\n if($user_type->save()){\n return response()->json(['message' => \"Eliminado\"]);\n }\n }", "public function delAttributeWithHttpInfo()\n {\n // parse inputs\n $resourcePath = \"/{uuid}/attribute/{key}\";\n $httpBody = '';\n $queryParams = [];\n $headerParams = [];\n $formParams = [];\n $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);\n\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'DELETE',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\Swagger\\Client\\Model\\InlineResponse2004',\n '/{uuid}/attribute/{key}'\n );\n\n return [$this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\InlineResponse2004', $httpHeader), $statusCode, $httpHeader];\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\InlineResponse2004', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "public function destroy($id,Request $request)\n {\n\n $carrierActivityType = $this->carrierActivityTypeRepository->findWithoutFail($id);\n\n if (empty($carrierActivityType)) {\n\n return $this->sendNotFoundResponse();\n }\n\n $this->carrierActivityTypeRepository->delete($id);\n\n return $this->sendSuccessResponse(route('carrierActivityTypes.index'));\n\n }", "public function putCharterStatusType($id, $charter_status_type, $if_match = null)\n {\n list($response, $statusCode, $httpHeader) = $this->putCharterStatusTypeWithHttpInfo ($id, $charter_status_type, $if_match);\n return $response; \n }", "public function destroy($id)\n {\n // Get country\n $industryType = IndustryType::findOrFail($id);\n if($industryType->delete()) {\n return $industryType;\n }\n }", "public function destroy($id)\n {\n if(!isset($_GET['status']))\n {\n return hotelService::json(['errors'=>'Thao tác không thành công']);\n }\n return $this->hotelService->destroy($id,$_GET['status']);\n }", "public function destroy(Request $request, $id)\n {\n if (!session()->has('session_user')) {return response([\"Status\" => 2], 200);}\n $data_active = $request->data_active;\n DB::table('bgdata_typemenusystem')->whereIn('idTypeMenu',$data_active)->delete();\n return response([\"Status\" => true,\"Massages\" => \"Cập nhật thành công\"], 200);\n }", "public function destroy($id)\n {\n try {\n $typeOutcome = TypeOutcome::findOrFail($id);\n $typeOutcome->delete();\n return $this->success('Tipo de egreso eliminado correctamente', 204);\n } catch (\\Throwable $th) {\n return response()->json([$th->getMessage(), $th->getLine()]);\n }\n }", "public function destroy($id)\n {\n $type = CustomerType::find($id);\n\n $type->delete();\n \n //Session::flash('message', 'Successfully deleted the nerd!');\n Alert::success('Customer type deleted.'); \n return Redirect::route('customertype.index');\n }", "public function typesRemove()\n {\n $session = FR_Session::singleton();\n $id_type = null;\n\n // Support POST & GET\n if(filter_input(INPUT_POST, 'type_id') != ''){\n $id_type = filter_input(INPUT_POST, 'type_id');\n }\n else{\n $id_type = filter_input(INPUT_GET, 'type_id');\n }\n\n if($id_type != null){\n require_once 'models/TypesModel.php';\n $model = new TypesModel();\n\n $status = 9; // 9 removed status\n\n // remove\n $result = $model->updateStatusType($id_type, $session->id_tenant, $status);\n\n if($result != null){\n $error = $result->errorInfo();\n $numr = $result->rowCount();\n\n if($error[0] == 00000 && $numr > 0){\n header(\"Location: \".$this->root.\"?controller=types&action=typesDt&error_flag=1'\");\n }\n else{\n header(\"Location: \".$this->root.\"?controller=types&action=typesDt&error_flag=10&message='No se lograron aplicar cambios: \".$error[2].\"'\");\n }\n }\n else{\n header(\"Location: \".$this->root.\"?controller=types&action=typesDt&error_flag=10&message='Error: no se ha podido eliminar!\");\n }\n }\n else{\n header(\"Location: \".$this->root.\"?controller=types&action=typesDt&error_flag=10&message='Error: esta materia ya no existe!\");\n }\n }", "public function delete($tipo_equipo);", "public function delete($id)\n {\n $bt = BatteryType::findOrFail(base64_decode($id));\n if($bt){\n $bt->delete();\n return redirect()->route('admin.battery-type.list')\n ->with('Success','Battery type deleted SuccessFully'); \n } else {\n return redirect()->route('admin.battery-type.list')\n ->with('Error','Failed');\n }\n }", "public function deletecharinfo()\n\t{\n\t\t$this->checkcharingame();\n\t\t\n\t\tif ( $char = $this->io->deleteCharInfo( $this->getParam('user'), $this->getParam('char') ) )\n\t\t\treturn $char;\n\t\telse\n\t\t\tthrow new Exception('Can not delete the character');\n\t}", "function deleteType() {\r\n\r\n if(!array_key_exists(36,$this->role_privileges)){\r\n echo(json_encode(array('status' => 'access')));\r\n } else {\r\n $id = $this->input->post('id');\r\n $data = array('deleted' => 1, 'updated_by' => $this->vendorId, 'updated_time' => date('Y-m-d H:i:s'));\r\n $result = $this->k_master_vehicle_type_model->delete($id, $data);\r\n if ($result > 0) {\r\n echo(json_encode(array('status' => TRUE)));\r\n } else {\r\n echo(json_encode(array('status' => FALSE)));\r\n }\r\n }\r\n }", "public function customersIdTeamsFkDeleteWithHttpInfo($id, $fk)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling customersIdTeamsFkDelete');\n }\n // verify the required parameter 'fk' is set\n if ($fk === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $fk when calling customersIdTeamsFkDelete');\n }\n // parse inputs\n $resourcePath = \"/Customers/{id}/teams/{fk}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // path params\n if ($fk !== null) {\n $resourcePath = str_replace(\n \"{\" . \"fk\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($fk),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'DELETE',\n $queryParams,\n $httpBody,\n $headerParams,\n null,\n '/Customers/{id}/teams/{fk}'\n );\n\n return array(null, $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n }\n\n throw $e;\n }\n }", "public function destroy(Request $request, $id)\n\t{\n\t\t//request\n\t\t$type = $request->input('type');\n\t\t\n\t\tif(!$request->user()->hasMenu($this->get_($this->menu_id, $type), 'delete'))\n\t\t{\n\t\t\treturn response('Forbidden', 403);\n\t\t}\n\t\t\n\t\tif(is_numeric($id))\n\t\t{\n\t\t\t$ac = AccountCode::findOrFail($id);\n\t\t\tif($ac->delete())\n\t\t\t{\n\t\t\t\treturn response(['result' => true], 200);\n\t\t\t}\n\t\t\treturn response('server error', 500);\n\t\t}\n\t\treturn response('bad request', 400);\n\t}", "public function deleteAction(Request $request, $id)\n {\n $form = $this->createDeleteForm($id);\n $form->handleRequest($request);\n\n if ($form->isValid()) {\n $em = $this->getDoctrine()->getManager();\n $entity = $em->getRepository('ZIMZIMBundlesOpinionBundle:TypeButchery')->find($id);\n\n if (!$entity) {\n throw $this->createNotFoundException('Unable to find TypeButchery entity.');\n }\n\n $em->remove($entity);\n $em->flush();\n $this->deleteSuccess();\n }\n\n return $this->redirect($this->generateUrl('zimzim_opinion_typebutchery'));\n }", "public function destroy($id_type)\n {\n $type_product = TypeProduct::find($id_type);\n $type_product->status_type = 'ยกเลิก';\n $type_product->save();\n return response()->json('Users Deleted Successfully.');\n }", "public function destroy($id)\n {\n // Si no tiene permisos para modificar lo echamos\n if (!auth()->user()->can('admin-bouncetypes-delete')) {\n app()->abort(403);\n }\n\n $bouncetype = BounceType::find($id);\n if (empty($bouncetype)) {\n app()->abort(404);\n }\n\n $bouncetype->delete();\n\n return response()->json(array(\n 'success' => true,\n 'msg' => trans(\"notificationbroker::bouncetypes/admin_lang.deleted\"),\n 'id' => $bouncetype->id\n ));\n }", "public function technologicalProviderDeleteWithHttpInfo($id)\n {\n $returnType = 'string';\n $request = $this->technologicalProviderDeleteRequest($id);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n 'string',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }" ]
[ "0.68412054", "0.6206633", "0.509905", "0.50805885", "0.50162584", "0.49272066", "0.4881711", "0.48182324", "0.47455657", "0.4717204", "0.46669155", "0.46070987", "0.45995283", "0.4558567", "0.45523965", "0.4528056", "0.45044842", "0.44827354", "0.4482634", "0.4475325", "0.44580543", "0.44573617", "0.4452735", "0.4441972", "0.44322205", "0.44209996", "0.44203207", "0.44175285", "0.44167063", "0.4406213" ]
0.68798405
0
getCharterStatusTypeByKeyWithHttpInfo Retrieves a specific resource using the values of the resource's natural key (using the \"Get By Key\" pattern).
public function getCharterStatusTypeByKeyWithHttpInfo($charter_status_type_id, $if_none_match = null) { // verify the required parameter 'charter_status_type_id' is set if ($charter_status_type_id === null) { throw new \InvalidArgumentException('Missing the required parameter $charter_status_type_id when calling getCharterStatusTypeByKey'); } // parse inputs $resourcePath = "/charterStatusTypes"; $httpBody = ''; $queryParams = array(); $headerParams = array(); $formParams = array(); $_header_accept = ApiClient::selectHeaderAccept(array('application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array()); // query params if ($charter_status_type_id !== null) { $queryParams['charterStatusTypeId'] = $this->apiClient->getSerializer()->toQueryValue($charter_status_type_id); } // header params if ($if_none_match !== null) { $headerParams['If-None-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_none_match); } // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, 'GET', $queryParams, $httpBody, $headerParams, '\Swagger\Client\Model\CharterStatusType' ); if (!$response) { return array(null, $statusCode, $httpHeader); } return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\CharterStatusType', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\CharterStatusType', $e->getResponseHeaders()); $e->setResponseObject($data); break; case 500: $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\WebServiceError', $e->getResponseHeaders()); $e->setResponseObject($data); break; } throw $e; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCharterStatusTypeByKey($charter_status_type_id, $if_none_match = null)\n {\n list($response, $statusCode, $httpHeader) = $this->getCharterStatusTypeByKeyWithHttpInfo ($charter_status_type_id, $if_none_match);\n return $response; \n }", "public function restExportsFormatKeysTypeGetWithHttpInfo($type)\n {\n $request = $this->restExportsFormatKeysTypeGetRequest($type);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n switch($statusCode) {\n case 200:\n if ('object[]' === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = (string) $responseBody;\n }\n\n return [\n ObjectSerializer::deserialize($content, 'object[]', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n }\n\n $returnType = 'object[]';\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = (string) $responseBody;\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n 'object[]',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function putCharterStatusTypeWithHttpInfo($id, $charter_status_type, $if_match = null)\n {\n \n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling putCharterStatusType');\n }\n // verify the required parameter 'charter_status_type' is set\n if ($charter_status_type === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $charter_status_type when calling putCharterStatusType');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes/{id}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n \n // header params\n \n if ($if_match !== null) {\n $headerParams['If-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_match);\n }\n // path params\n \n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // body params\n $_tempBody = null;\n if (isset($charter_status_type)) {\n $_tempBody = $charter_status_type;\n }\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'PUT',\n $queryParams, $httpBody,\n $headerParams\n );\n \n return array(null, $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function queryKey($key_type)\n {\n $params = ['key_type' => $key_type];\n $body = [\n 'method' => 'query_key',\n 'params' => $params\n ];\n return $this->_request($body);\n }", "public function systemConfigurationGetByKeyWithHttpInfo($key)\n {\n $returnType = 'string';\n $request = $this->systemConfigurationGetByKeyRequest($key);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n 'string',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function retrieve($resourceType, $key);", "function getStatus($key, $subkey)\n {\n $statuses = PratsRoomtypes::getInstance()->getOptionArray('status', $key);\n if (isset($statuses[$subkey])) {\n return $statuses[$subkey];\n }\n return NULL;\n }", "public function searchInterventionsByGet($name = NULL, $category = NULL, $sort = NULL, $order = NULL, $size = NULL, $code = NULL, $current_trial_status = NULL);", "function getEntrystatus_key($entry_key) {\r\n\t\r\n\t\tglobal $CONN, $CONFIG;\r\n\t\t\t\r\n\t\t$entry_data = $this->getEntryData($entry_key);\r\n\t\t\r\n\t\treturn $entry_data['status_key'];\r\n\t\t\r\n\t}", "function fn_2lm_bm_transaction_status_info($key = '')\r\n{\r\n $statuses = [\r\n 'PENDING' => __('2lm_bm_transaction_status_pending'),\r\n 'SUCCESS' => __('2lm_bm_transaction_status_success'), // Serwis Partnera otrzyma środki za transakcje - można wydać towar/usługę\r\n 'FAILURE' => __('2lm_bm_transaction_status_failure'),\r\n ];\r\n\r\n return (!empty($key) && array_key_exists($key, $statuses)) ? $statuses[$key] : null;\r\n}", "public function getCharterStatusTypesByIdWithHttpInfo($id, $if_none_match = null)\n {\n \n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling getCharterStatusTypesById');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes/{id}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n \n // header params\n \n if ($if_none_match !== null) {\n $headerParams['If-None-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_none_match);\n }\n // path params\n \n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n \n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'GET',\n $queryParams, $httpBody,\n $headerParams, '\\Swagger\\Client\\Model\\CharterStatusType'\n );\n \n if (!$response) {\n return array(null, $statusCode, $httpHeader);\n }\n\n return array(\\Swagger\\Client\\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\CharterStatusType', $httpHeader), $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 200:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\CharterStatusType', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function getCurrenciesWithHttpInfo($x_game_key, string $contentType = self::contentTypes['getCurrencies'][0])\n {\n $request = $this->getCurrenciesRequest($x_game_key, $contentType);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n (int) $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n } catch (ConnectException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n (int) $e->getCode(),\n null,\n null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n (string) $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n\n switch($statusCode) {\n case 200:\n if ('\\MetaFab\\Model\\GetCurrencies200ResponseInner[]' === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n if ('\\MetaFab\\Model\\GetCurrencies200ResponseInner[]' !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\MetaFab\\Model\\GetCurrencies200ResponseInner[]', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n case 400:\n if ('string' === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n if ('string' !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, 'string', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n }\n\n $returnType = '\\MetaFab\\Model\\GetCurrencies200ResponseInner[]';\n if ($returnType === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\MetaFab\\Model\\GetCurrencies200ResponseInner[]',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 400:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n 'string',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function edit_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\t\t$sql = \"SELECT `statusID`,`name`,`status` FROM `statuses` WHERE `statusID` = '$_GET[statusID]'\";\n\t\t$result = $this->new_mysql($sql);\n\t\twhile ($row = $result->fetch_assoc()) {\n\t\t\tforeach ($row as $key=>$value) {\n\t\t\t\t$data[$key] = $value;\n\t\t\t}\n\t\t}\n\t\t$template = \"edit_charter_status.tpl\";\n\t\t$dir = \"/charters\";\n\t\t$this->load_smarty($data,$template,$dir);\n\t}", "public function request_environment_info($info_type, $opt = null)\n\t{\n\t\tif (!$opt) $opt = array();\n\t\t$opt['InfoType'] = $info_type;\n\t\t\n\t\treturn $this->authenticate('RequestEnvironmentInfo', $opt);\n\t}", "public function restExportsFormatKeysGetWithHttpInfo()\n {\n $request = $this->restExportsFormatKeysGetRequest();\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n switch($statusCode) {\n case 200:\n if ('object[]' === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = (string) $responseBody;\n }\n\n return [\n ObjectSerializer::deserialize($content, 'object[]', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n }\n\n $returnType = 'object[]';\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = (string) $responseBody;\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n 'object[]',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function interventionTypeGet(Request $request) {\n\t\t$clientIntervention = \\DB::table(config('module.client_intervention.table'))->where('client_id', $request['clientId'])->get()->toArray();\n\t\t$interventionsId = array_column($clientIntervention, 'intervention_type');\n\n\t\tif (!empty($interventionsId)) {\n\t\t\t$interventionTypeGet = \\DB::table(config('module.interventions_type.table'))->whereIn('id', $interventionsId)->get()->toArray();\n\t\t} else {\n\t\t\t$interventionTypeGet = '';\n\t\t}\n\t\t$alert = $this->checkThreshold($request['clientId']);\n\n\t\treturn response()->json([$interventionTypeGet, $alert]);\n\t}", "public function getRequest($key, $type)\n\t{\n\t\treturn $this->auth->getRequest($key, $type);\n\t}", "protected function servicesCancelRequest($api_key, $v, $content_type, $body)\n {\n // verify the required parameter 'api_key' is set\n if ($api_key === null || (is_array($api_key) && count($api_key) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $api_key when calling servicesCancel'\n );\n }\n // verify the required parameter 'v' is set\n if ($v === null || (is_array($v) && count($v) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $v when calling servicesCancel'\n );\n }\n // verify the required parameter 'content_type' is set\n if ($content_type === null || (is_array($content_type) && count($content_type) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $content_type when calling servicesCancel'\n );\n }\n // verify the required parameter 'body' is set\n if ($body === null || (is_array($body) && count($body) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $body when calling servicesCancel'\n );\n }\n\n $resourcePath = '/accounts/me/cancelservices';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // query params\n if ($api_key !== null) {\n $queryParams['api_key'] = ObjectSerializer::toQueryValue($api_key);\n }\n // query params\n if ($v !== null) {\n $queryParams['v'] = ObjectSerializer::toQueryValue($v);\n }\n // header params\n if ($content_type !== null) {\n $headerParams['Content-Type'] = ObjectSerializer::toHeaderValue($content_type);\n }\n\n\n // body params\n $_tempBody = null;\n if (isset($body)) {\n $_tempBody = $body;\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']\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\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 }", "public function addKeyProperty($resourceType, $name, $typeCode)\n {\n $this->_addPrimitivePropertyInternal($resourceType, $name, $typeCode, true);\n }", "function audition_get_request_value($key, $type = 'any') {\n\t$type = strtoupper($type);\n\tif ('POST' == $type && array_key_exists($key, $_POST)) {\n\t\t$value = $_POST[ $key ];\n\t} elseif ('GET' == $type && array_key_exists($key, $_GET)) {\n\t\t$value = $_GET[ $key ];\n\t} elseif (array_key_exists($key, $_REQUEST)) {\n\t\t$value = $_REQUEST[ $key ];\n\t} else {\n\t\t$value = '';\n\t}\n\n\tif (is_string($value)) {\n\t\t$value = wp_unslash($value);\n\t}\n\n\treturn $value;\n}", "protected function restExportsFormatKeysTypeGetRequest($type)\n {\n // verify the required parameter 'type' is set\n if ($type === null || (is_array($type) && count($type) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $type when calling restExportsFormatKeysTypeGet'\n );\n }\n\n $resourcePath = '/rest/exports/format_keys/{type}';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // path params\n if ($type !== null) {\n $resourcePath = str_replace(\n '{' . 'type' . '}',\n ObjectSerializer::toPathValue($type),\n $resourcePath\n );\n }\n\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['*/*']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['*/*'],\n []\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n if ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody));\n } else {\n $httpBody = $_tempBody;\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem\n ];\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\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 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function restExportsFormatKeysTypeGetAsyncWithHttpInfo($type)\n {\n $returnType = 'object[]';\n $request = $this->restExportsFormatKeysTypeGetRequest($type);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = (string) $responseBody;\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }", "public function type(string $key) {}", "public function getStatus($key=NULL){\n $data = array(\n \"1\" =>\"Active\",\n \"2\" =>\"Inactive\"\n );\n if(!is_null($key)){\n return $data[$key];\n }\n return $data;\n }", "public function findOrdersByStatus()\n {\n $input = Request::all();\n\n //path params validation\n\n\n //not path params validation\n if (!isset($input['status'])) {\n throw new \\InvalidArgumentException('Missing the required parameter $status when calling findOrdersByStatus');\n }\n $status = $input['status'];\n\n\n return response('How about implementing findOrdersByStatus as a GET method ?');\n }", "public function get($type, $key, $default = null)\n {\n if (! is_string($type) || empty($type)) {\n return $default;\n }\n $type = strtolower($type);\n\n if (! is_string($key) || empty($key)) {\n return $default;\n }\n\n if (! array_key_exists($key, $this->params[$type])) {\n return $default;\n }\n\n return $this->params[$type][$key];\n }", "public function deleteCharterStatusTypeByIdWithHttpInfo($id, $if_match = null)\n {\n \n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling deleteCharterStatusTypeById');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes/{id}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n \n // header params\n \n if ($if_match !== null) {\n $headerParams['If-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_match);\n }\n // path params\n \n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n \n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'DELETE',\n $queryParams, $httpBody,\n $headerParams\n );\n \n return array(null, $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "private function getCodeMeta($status, $key)\n {\n $refl = new \\ReflectionClass(__CLASS__);\n $const = array_search($status, $refl->getConstants());\n $keyJson = file_get_contents(realpath(__DIR__) . '/../../statuses.json');\n $keyMap = json_decode($keyJson, true);\n $defn = '';\n\n foreach ($keyMap as $map) {\n if (isset($map[$const])) {\n $defn = $map[$const];\n }\n }\n\n $data = [\n 'code' => $const,\n 'defn' => $defn,\n ];\n\n return $data[$key] ?? $data;\n }", "public function checkrequeststatusAction()\n\t{\n\t\t$request_id = $this->_request->getParam('request_id');\n\t\t$request_status = '';\n\t\tif(!empty($request_id) && is_numeric($request_id))\n\t\t{\n\t\t\t$service_request_model = new Default_Model_Servicerequests(); \n\t\t\t$request_data = $service_request_model->getRequestById($request_id);\n\t\t\t$request_status = $request_data['status'];\n\t\t}\n\t\tif($request_status != 'Open')\n\t\t{\n\t\t $this->_helper->getHelper(\"FlashMessenger\")->addMessage(array(array(\"error\"=>\"You cannot cancel the request as the current status is \".$request_status.\".\")));\n\t\t}\n\t\t$this->_helper->json($request_status);\n\t}", "public function searchWithHttpInfo($entity_type, $restriction = null)\n {\n $request = $this->searchRequest($entity_type, $restriction);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n switch($statusCode) {\n case 200:\n if ('\\CrowdClient\\Model\\CwdSearchResponse' === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\CrowdClient\\Model\\CwdSearchResponse', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n }\n\n $returnType = '\\CrowdClient\\Model\\CwdSearchResponse';\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\CrowdClient\\Model\\CwdSearchResponse',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }" ]
[ "0.5116276", "0.47736531", "0.47127932", "0.46671686", "0.4666708", "0.46226215", "0.43533584", "0.43321913", "0.43246916", "0.43238908", "0.42964253", "0.4185493", "0.41811842", "0.41775712", "0.41709897", "0.41699907", "0.410518", "0.41022798", "0.4065292", "0.4058862", "0.40447405", "0.4037381", "0.40324327", "0.402672", "0.40089917", "0.40030032", "0.39802447", "0.39729974", "0.39567694", "0.39516565" ]
0.6388345
0
getCharterStatusTypesByIdWithHttpInfo Retrieves a specific resource using the resource's identifier (using the \"Get By Id\" pattern).
public function getCharterStatusTypesByIdWithHttpInfo($id, $if_none_match = null) { // verify the required parameter 'id' is set if ($id === null) { throw new \InvalidArgumentException('Missing the required parameter $id when calling getCharterStatusTypesById'); } // parse inputs $resourcePath = "/charterStatusTypes/{id}"; $httpBody = ''; $queryParams = array(); $headerParams = array(); $formParams = array(); $_header_accept = ApiClient::selectHeaderAccept(array('application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array()); // header params if ($if_none_match !== null) { $headerParams['If-None-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_none_match); } // path params if ($id !== null) { $resourcePath = str_replace( "{" . "id" . "}", $this->apiClient->getSerializer()->toPathValue($id), $resourcePath ); } // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, 'GET', $queryParams, $httpBody, $headerParams, '\Swagger\Client\Model\CharterStatusType' ); if (!$response) { return array(null, $statusCode, $httpHeader); } return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\CharterStatusType', $httpHeader), $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\CharterStatusType', $e->getResponseHeaders()); $e->setResponseObject($data); break; case 500: $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\WebServiceError', $e->getResponseHeaders()); $e->setResponseObject($data); break; } throw $e; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCharterStatusTypeByKeyWithHttpInfo($charter_status_type_id, $if_none_match = null)\n {\n \n // verify the required parameter 'charter_status_type_id' is set\n if ($charter_status_type_id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $charter_status_type_id when calling getCharterStatusTypeByKey');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n // query params\n \n if ($charter_status_type_id !== null) {\n $queryParams['charterStatusTypeId'] = $this->apiClient->getSerializer()->toQueryValue($charter_status_type_id);\n }\n // header params\n \n if ($if_none_match !== null) {\n $headerParams['If-None-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_none_match);\n }\n \n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n \n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'GET',\n $queryParams, $httpBody,\n $headerParams, '\\Swagger\\Client\\Model\\CharterStatusType'\n );\n \n if (!$response) {\n return array(null, $statusCode, $httpHeader);\n }\n\n return array(\\Swagger\\Client\\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\CharterStatusType', $httpHeader), $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 200:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\CharterStatusType', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function deleteCharterStatusTypeByIdWithHttpInfo($id, $if_match = null)\n {\n \n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling deleteCharterStatusTypeById');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes/{id}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n \n // header params\n \n if ($if_match !== null) {\n $headerParams['If-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_match);\n }\n // path params\n \n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n \n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'DELETE',\n $queryParams, $httpBody,\n $headerParams\n );\n \n return array(null, $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function expenseTypesIdGetWithHttpInfo($id)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling expenseTypesIdGet');\n }\n // parse inputs\n $resourcePath = \"/expense/types/{id}\";\n $httpBody = '';\n $queryParams = [];\n $headerParams = [];\n $formParams = [];\n $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]);\n\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires HTTP basic authentication\n if (strlen($this->apiClient->getConfig()->getUsername()) !== 0 or strlen($this->apiClient->getConfig()->getPassword()) !== 0) {\n $headerParams['Authorization'] = 'Basic ' . base64_encode($this->apiClient->getConfig()->getUsername() . \":\" . $this->apiClient->getConfig()->getPassword());\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'GET',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\Spinen\\ConnectWise\\Clients\\Expense\\Model\\ExpenseType',\n '/expense/types/{id}'\n );\n\n return [$this->apiClient->getSerializer()->deserialize($response, '\\Spinen\\ConnectWise\\Clients\\Expense\\Model\\ExpenseType', $httpHeader), $statusCode, $httpHeader];\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Spinen\\ConnectWise\\Clients\\Expense\\Model\\ExpenseType', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n case 401:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Spinen\\ConnectWise\\Clients\\Expense\\Model\\Error', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "public function getCharterStatusTypesById($id, $if_none_match = null)\n {\n list($response, $statusCode, $httpHeader) = $this->getCharterStatusTypesByIdWithHttpInfo ($id, $if_none_match);\n return $response; \n }", "public function customersIdTeamsGetWithHttpInfo($id, $filter = null)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling customersIdTeamsGet');\n }\n // parse inputs\n $resourcePath = \"/Customers/{id}/teams\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // query params\n if ($filter !== null) {\n $queryParams['filter'] = $this->apiClient->getSerializer()->toQueryValue($filter);\n }\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'GET',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\Swagger\\Client\\Model\\Team[]',\n '/Customers/{id}/teams'\n );\n\n return array($this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\Team[]', $httpHeader), $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Team[]', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "public function customersIdExistsGetWithHttpInfo($id)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling customersIdExistsGet');\n }\n // parse inputs\n $resourcePath = \"/Customers/{id}/exists\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'GET',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\Swagger\\Client\\Model\\InlineResponse2002',\n '/Customers/{id}/exists'\n );\n\n return array($this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\InlineResponse2002', $httpHeader), $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\InlineResponse2002', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "public function customersIdInvitationTicketsGetWithHttpInfo($id, $filter = null)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling customersIdInvitationTicketsGet');\n }\n // parse inputs\n $resourcePath = \"/Customers/{id}/invitationTickets\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // query params\n if ($filter !== null) {\n $queryParams['filter'] = $this->apiClient->getSerializer()->toQueryValue($filter);\n }\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'GET',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\Swagger\\Client\\Model\\InvitationTicket[]',\n '/Customers/{id}/invitationTickets'\n );\n\n return array($this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\InvitationTicket[]', $httpHeader), $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\InvitationTicket[]', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "public function expenseTypesIdDeleteWithHttpInfo($id)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling expenseTypesIdDelete');\n }\n // parse inputs\n $resourcePath = \"/expense/types/{id}\";\n $httpBody = '';\n $queryParams = [];\n $headerParams = [];\n $formParams = [];\n $_header_accept = $this->apiClient->selectHeaderAccept([]);\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]);\n\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires HTTP basic authentication\n if (strlen($this->apiClient->getConfig()->getUsername()) !== 0 or strlen($this->apiClient->getConfig()->getPassword()) !== 0) {\n $headerParams['Authorization'] = 'Basic ' . base64_encode($this->apiClient->getConfig()->getUsername() . \":\" . $this->apiClient->getConfig()->getPassword());\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'DELETE',\n $queryParams,\n $httpBody,\n $headerParams,\n null,\n '/expense/types/{id}'\n );\n\n return [null, $statusCode, $httpHeader];\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 401:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Spinen\\ConnectWise\\Clients\\Expense\\Model\\Error', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "public function getIncidentsWithHttpInfo($incident_id = null, $incident_type = null, $incident_message = null, $incident_message_like = null, $process_definition_id = null, $process_definition_key_in = null, $process_instance_id = null, $execution_id = null, $incident_timestamp_before = null, $incident_timestamp_after = null, $activity_id = null, $failed_activity_id = null, $cause_incident_id = null, $root_cause_incident_id = null, $configuration = null, $tenant_id_in = null, $job_definition_id_in = null, $sort_by = null, $sort_order = null)\n {\n $request = $this->getIncidentsRequest($incident_id, $incident_type, $incident_message, $incident_message_like, $process_definition_id, $process_definition_key_in, $process_instance_id, $execution_id, $incident_timestamp_before, $incident_timestamp_after, $activity_id, $failed_activity_id, $cause_incident_id, $root_cause_incident_id, $configuration, $tenant_id_in, $job_definition_id_in, $sort_by, $sort_order);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n (int) $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n (string) $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n\n switch($statusCode) {\n case 200:\n if ('\\OpenAPI\\Client\\Model\\IncidentDto[]' === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\OpenAPI\\Client\\Model\\IncidentDto[]', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n case 400:\n if ('\\OpenAPI\\Client\\Model\\ExceptionDto' === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\OpenAPI\\Client\\Model\\ExceptionDto', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n }\n\n $returnType = '\\OpenAPI\\Client\\Model\\IncidentDto[]';\n if ($returnType === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\OpenAPI\\Client\\Model\\IncidentDto[]',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 400:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\OpenAPI\\Client\\Model\\ExceptionDto',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function putCharterStatusTypeWithHttpInfo($id, $charter_status_type, $if_match = null)\n {\n \n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling putCharterStatusType');\n }\n // verify the required parameter 'charter_status_type' is set\n if ($charter_status_type === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $charter_status_type when calling putCharterStatusType');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes/{id}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n \n // header params\n \n if ($if_match !== null) {\n $headerParams['If-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_match);\n }\n // path params\n \n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // body params\n $_tempBody = null;\n if (isset($charter_status_type)) {\n $_tempBody = $charter_status_type;\n }\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'PUT',\n $queryParams, $httpBody,\n $headerParams\n );\n \n return array(null, $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function teamBuilderConfigsIdProductTypesGetWithHttpInfo($id, $filter = null)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling teamBuilderConfigsIdProductTypesGet');\n }\n // parse inputs\n $resourcePath = \"/TeamBuilderConfigs/{id}/productTypes\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // query params\n if ($filter !== null) {\n $queryParams['filter'] = $this->apiClient->getSerializer()->toQueryValue($filter);\n }\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'GET',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\Swagger\\Client\\Model\\ProductType[]',\n '/TeamBuilderConfigs/{id}/productTypes'\n );\n\n return array($this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\ProductType[]', $httpHeader), $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\ProductType[]', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "public function getIncidentWithHttpInfo($id)\n {\n $request = $this->getIncidentRequest($id);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n (int) $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n (string) $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n\n switch($statusCode) {\n case 200:\n if ('\\OpenAPI\\Client\\Model\\IncidentDto' === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\OpenAPI\\Client\\Model\\IncidentDto', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n case 404:\n if ('\\OpenAPI\\Client\\Model\\ExceptionDto' === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\OpenAPI\\Client\\Model\\ExceptionDto', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n }\n\n $returnType = '\\OpenAPI\\Client\\Model\\IncidentDto';\n if ($returnType === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\OpenAPI\\Client\\Model\\IncidentDto',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 404:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\OpenAPI\\Client\\Model\\ExceptionDto',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function getStatuses($type = 'link.status'){\n\t\t$statuses = Lookup::where('lookup.type', $type)->get();\n\t\treturn $statuses;\n\t}", "public function customersIdHeadWithHttpInfo($id)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling customersIdHead');\n }\n // parse inputs\n $resourcePath = \"/Customers/{id}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'HEAD',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\Swagger\\Client\\Model\\InlineResponse2002',\n '/Customers/{id}'\n );\n\n return array($this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\InlineResponse2002', $httpHeader), $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\InlineResponse2002', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "public function customersIdTeamsFkGetWithHttpInfo($id, $fk)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling customersIdTeamsFkGet');\n }\n // verify the required parameter 'fk' is set\n if ($fk === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $fk when calling customersIdTeamsFkGet');\n }\n // parse inputs\n $resourcePath = \"/Customers/{id}/teams/{fk}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // path params\n if ($fk !== null) {\n $resourcePath = str_replace(\n \"{\" . \"fk\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($fk),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'GET',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\Swagger\\Client\\Model\\Team',\n '/Customers/{id}/teams/{fk}'\n );\n\n return array($this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\Team', $httpHeader), $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\Team', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "public function availableOperationsAuthorizationInstanceWithHttpInfo($id)\n {\n $request = $this->availableOperationsAuthorizationInstanceRequest($id);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n (int) $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n (string) $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n\n switch($statusCode) {\n case 200:\n if ('\\OpenAPI\\Client\\Model\\ResourceOptionsDto' === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\OpenAPI\\Client\\Model\\ResourceOptionsDto', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n }\n\n $returnType = '\\OpenAPI\\Client\\Model\\ResourceOptionsDto';\n if ($returnType === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\OpenAPI\\Client\\Model\\ResourceOptionsDto',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function venues($id, Request $request)\n {\n $type = $request->only('type')['type'];\n\n if ( ! $region = Region::find($id)) {\n return response()->json(['not found' => 'specified region was not found'], 404);\n }\n if ( ! $region->venues->first()) {\n return response()->json(['not found' => 'specified region does not have any venues'], 404);\n }\n\n switch ($type) {\n case Venue::CELLAR_DOOR:\n $venues = Venue::with(['account', 'address'])\n ->where('region_id', $id)\n ->where('type', Venue::CELLAR_DOOR)\n ->get();\n\n if ($venues->first()) {\n return array_flatten($venues);\n }\n\n return response()->json([\n 'not found' => 'specified region does not have any venues of the specified type'\n ], 404);\n break;\n\n case Venue::RESTAURANT:\n\n $venues = Venue::with(['account', 'address'])\n ->where('region_id', $id)\n ->where('type', Venue::RESTAURANT)\n ->get();\n\n if ($venues->first()) {\n return array_flatten($venues);\n }\n\n return response()->json([\n 'not found' => 'specified region does not have any venues of the specified type'\n ], 404);\n break;\n\n default:\n\n return Venue::with(['account', 'address'])->where('region_id', $id)->get();\n break;\n }\n }", "public function customersIdTeamsDeleteWithHttpInfo($id)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling customersIdTeamsDelete');\n }\n // parse inputs\n $resourcePath = \"/Customers/{id}/teams\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'DELETE',\n $queryParams,\n $httpBody,\n $headerParams,\n null,\n '/Customers/{id}/teams'\n );\n\n return array(null, $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n }\n\n throw $e;\n }\n }", "public function getRuleTypesWithHttpInfo($ids)\n {\n $request = $this->getRuleTypesRequest($ids);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n switch($statusCode) {\n case 200:\n if ('\\OpenAPI\\Client\\Model\\ApiRuleTypesResponse' === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = (string) $responseBody;\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\OpenAPI\\Client\\Model\\ApiRuleTypesResponse', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n case 403:\n if ('\\OpenAPI\\Client\\Model\\MsaReplyMetaOnly' === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = (string) $responseBody;\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\OpenAPI\\Client\\Model\\MsaReplyMetaOnly', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n case 404:\n if ('\\OpenAPI\\Client\\Model\\MsaReplyMetaOnly' === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = (string) $responseBody;\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\OpenAPI\\Client\\Model\\MsaReplyMetaOnly', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n case 429:\n if ('\\OpenAPI\\Client\\Model\\MsaReplyMetaOnly' === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = (string) $responseBody;\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\OpenAPI\\Client\\Model\\MsaReplyMetaOnly', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n default:\n if ('\\OpenAPI\\Client\\Model\\ApiRuleTypesResponse' === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = (string) $responseBody;\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\OpenAPI\\Client\\Model\\ApiRuleTypesResponse', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n }\n\n $returnType = '\\OpenAPI\\Client\\Model\\ApiRuleTypesResponse';\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = (string) $responseBody;\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\OpenAPI\\Client\\Model\\ApiRuleTypesResponse',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 403:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\OpenAPI\\Client\\Model\\MsaReplyMetaOnly',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 404:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\OpenAPI\\Client\\Model\\MsaReplyMetaOnly',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 429:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\OpenAPI\\Client\\Model\\MsaReplyMetaOnly',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n default:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\OpenAPI\\Client\\Model\\ApiRuleTypesResponse',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function teamBuilderConfigsIdProductTypesFkGetWithHttpInfo($id, $fk)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling teamBuilderConfigsIdProductTypesFkGet');\n }\n // verify the required parameter 'fk' is set\n if ($fk === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $fk when calling teamBuilderConfigsIdProductTypesFkGet');\n }\n // parse inputs\n $resourcePath = \"/TeamBuilderConfigs/{id}/productTypes/{fk}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // path params\n if ($fk !== null) {\n $resourcePath = str_replace(\n \"{\" . \"fk\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($fk),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'GET',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\Swagger\\Client\\Model\\ProductType',\n '/TeamBuilderConfigs/{id}/productTypes/{fk}'\n );\n\n return array($this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\ProductType', $httpHeader), $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\ProductType', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "public function customersIdActiveGetWithHttpInfo($id)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling customersIdActiveGet');\n }\n // parse inputs\n $resourcePath = \"/Customers/{id}/active\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'GET',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\Swagger\\Client\\Model\\InlineResponse2003',\n '/Customers/{id}/active'\n );\n\n return array($this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\InlineResponse2003', $httpHeader), $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\InlineResponse2003', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "public function customersIdInvitationTicketsDeleteWithHttpInfo($id)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling customersIdInvitationTicketsDelete');\n }\n // parse inputs\n $resourcePath = \"/Customers/{id}/invitationTickets\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'DELETE',\n $queryParams,\n $httpBody,\n $headerParams,\n null,\n '/Customers/{id}/invitationTickets'\n );\n\n return array(null, $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n }\n\n throw $e;\n }\n }", "public function deleteCharterStatusTypeById($id, $if_match = null)\n {\n list($response, $statusCode, $httpHeader) = $this->deleteCharterStatusTypeByIdWithHttpInfo ($id, $if_match);\n return $response; \n }", "public function getIncidentsAsyncWithHttpInfo($incident_id = null, $incident_type = null, $incident_message = null, $incident_message_like = null, $process_definition_id = null, $process_definition_key_in = null, $process_instance_id = null, $execution_id = null, $incident_timestamp_before = null, $incident_timestamp_after = null, $activity_id = null, $failed_activity_id = null, $cause_incident_id = null, $root_cause_incident_id = null, $configuration = null, $tenant_id_in = null, $job_definition_id_in = null, $sort_by = null, $sort_order = null)\n {\n $returnType = '\\OpenAPI\\Client\\Model\\IncidentDto[]';\n $request = $this->getIncidentsRequest($incident_id, $incident_type, $incident_message, $incident_message_like, $process_definition_id, $process_definition_key_in, $process_instance_id, $execution_id, $incident_timestamp_before, $incident_timestamp_after, $activity_id, $failed_activity_id, $cause_incident_id, $root_cause_incident_id, $configuration, $tenant_id_in, $job_definition_id_in, $sort_by, $sort_order);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n if ($returnType === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n );\n }", "public function servicesCancelWithHttpInfo($api_key, $v, $content_type, $body)\n {\n $returnType = '';\n $request = $this->servicesCancelRequest($api_key, $v, $content_type, $body);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n return [null, $statusCode, $response->getHeaders()];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n }\n throw $e;\n }\n }", "public function queryAuthorizationsWithHttpInfo($id = null, $type = null, $user_id_in = null, $group_id_in = null, $resource_type = null, $resource_id = null, $sort_by = null, $sort_order = null, $first_result = null, $max_results = null)\n {\n $request = $this->queryAuthorizationsRequest($id, $type, $user_id_in, $group_id_in, $resource_type, $resource_id, $sort_by, $sort_order, $first_result, $max_results);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n (int) $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? (string) $e->getResponse()->getBody() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n (string) $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n (string) $response->getBody()\n );\n }\n\n switch($statusCode) {\n case 200:\n if ('\\OpenAPI\\Client\\Model\\AuthorizationDto[]' === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\OpenAPI\\Client\\Model\\AuthorizationDto[]', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n case 400:\n if ('\\OpenAPI\\Client\\Model\\ExceptionDto' === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n }\n\n return [\n ObjectSerializer::deserialize($content, '\\OpenAPI\\Client\\Model\\ExceptionDto', []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n }\n\n $returnType = '\\OpenAPI\\Client\\Model\\AuthorizationDto[]';\n if ($returnType === '\\SplFileObject') {\n $content = $response->getBody(); //stream goes to serializer\n } else {\n $content = (string) $response->getBody();\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\OpenAPI\\Client\\Model\\AuthorizationDto[]',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 400:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\OpenAPI\\Client\\Model\\ExceptionDto',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "protected function getBulkStatusUsingGetRequest($id)\n {\n // verify the required parameter 'id' is set\n if ($id === null || (is_array($id) && count($id) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $id when calling getBulkStatusUsingGet'\n );\n }\n\n $resourcePath = '/nucleus/v1/bulk/status/{id}';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n '{' . 'id' . '}',\n ObjectSerializer::toPathValue($id),\n $resourcePath\n );\n }\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 []\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\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 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function cost_type_by_id() {\r\n if ($this->get_request_method() != \"GET\") {\r\n $this->response('', 406);\r\n }\r\n $id = (int) $this->_request['id'];\r\n if ($id > 0) {\r\n $query = \"SELECT * FROM fleet_vehicle_cost_type where id = $id\";\r\n $r = $this->mysqli->query($query) or die($this->mysqli->error . __LINE__);\r\n if ($r->num_rows > 0) {\r\n $result = $r->fetch_assoc();\r\n $this->response($this->json($result), 200); // send user details\r\n }\r\n }\r\n $this->response('', 204); // If no records \"No Content\" status\r\n }", "public function customersIdInvitationTicketsCountGetWithHttpInfo($id, $where = null)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling customersIdInvitationTicketsCountGet');\n }\n // parse inputs\n $resourcePath = \"/Customers/{id}/invitationTickets/count\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // query params\n if ($where !== null) {\n $queryParams['where'] = $this->apiClient->getSerializer()->toQueryValue($where);\n }\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'GET',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\Swagger\\Client\\Model\\InlineResponse2001',\n '/Customers/{id}/invitationTickets/count'\n );\n\n return array($this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\InlineResponse2001', $httpHeader), $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\InlineResponse2001', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "public function find($id)\n {\n $result = $this -> client -> request('GET', $this -> resource_type . \"/$id\");\n $data = json_decode($result->getBody());\n\n return ['resources' => [$data]];\n }" ]
[ "0.5196666", "0.5115407", "0.508174", "0.5024443", "0.4963323", "0.47996074", "0.4776648", "0.4771618", "0.4742698", "0.46952143", "0.45968294", "0.44850302", "0.44515428", "0.44458002", "0.44376817", "0.4419712", "0.4408838", "0.4401098", "0.4392673", "0.43913534", "0.43794644", "0.435887", "0.4353752", "0.43049693", "0.42860535", "0.42809802", "0.42765132", "0.42637706", "0.4251993", "0.4247314" ]
0.6294438
0
postCharterStatusTypesWithHttpInfo Creates or updates resources based on the natural key values of the supplied resource.
public function postCharterStatusTypesWithHttpInfo($charter_status_type) { // verify the required parameter 'charter_status_type' is set if ($charter_status_type === null) { throw new \InvalidArgumentException('Missing the required parameter $charter_status_type when calling postCharterStatusTypes'); } // parse inputs $resourcePath = "/charterStatusTypes"; $httpBody = ''; $queryParams = array(); $headerParams = array(); $formParams = array(); $_header_accept = ApiClient::selectHeaderAccept(array('application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array()); // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); // body params $_tempBody = null; if (isset($charter_status_type)) { $_tempBody = $charter_status_type; } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, 'POST', $queryParams, $httpBody, $headerParams ); return array(null, $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 500: $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\WebServiceError', $e->getResponseHeaders()); $e->setResponseObject($data); break; } throw $e; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function postCharterStatusTypes($charter_status_type)\n {\n list($response, $statusCode, $httpHeader) = $this->postCharterStatusTypesWithHttpInfo ($charter_status_type);\n return $response; \n }", "public function putCharterStatusTypeWithHttpInfo($id, $charter_status_type, $if_match = null)\n {\n \n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling putCharterStatusType');\n }\n // verify the required parameter 'charter_status_type' is set\n if ($charter_status_type === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $charter_status_type when calling putCharterStatusType');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes/{id}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n \n // header params\n \n if ($if_match !== null) {\n $headerParams['If-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_match);\n }\n // path params\n \n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // body params\n $_tempBody = null;\n if (isset($charter_status_type)) {\n $_tempBody = $charter_status_type;\n }\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'PUT',\n $queryParams, $httpBody,\n $headerParams\n );\n \n return array(null, $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function getCharterStatusTypesByIdWithHttpInfo($id, $if_none_match = null)\n {\n \n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling getCharterStatusTypesById');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes/{id}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n \n // header params\n \n if ($if_none_match !== null) {\n $headerParams['If-None-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_none_match);\n }\n // path params\n \n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n \n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'GET',\n $queryParams, $httpBody,\n $headerParams, '\\Swagger\\Client\\Model\\CharterStatusType'\n );\n \n if (!$response) {\n return array(null, $statusCode, $httpHeader);\n }\n\n return array(\\Swagger\\Client\\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\CharterStatusType', $httpHeader), $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 200:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\CharterStatusType', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function getCharterStatusTypeByKeyWithHttpInfo($charter_status_type_id, $if_none_match = null)\n {\n \n // verify the required parameter 'charter_status_type_id' is set\n if ($charter_status_type_id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $charter_status_type_id when calling getCharterStatusTypeByKey');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n // query params\n \n if ($charter_status_type_id !== null) {\n $queryParams['charterStatusTypeId'] = $this->apiClient->getSerializer()->toQueryValue($charter_status_type_id);\n }\n // header params\n \n if ($if_none_match !== null) {\n $headerParams['If-None-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_none_match);\n }\n \n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n \n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'GET',\n $queryParams, $httpBody,\n $headerParams, '\\Swagger\\Client\\Model\\CharterStatusType'\n );\n \n if (!$response) {\n return array(null, $statusCode, $httpHeader);\n }\n\n return array(\\Swagger\\Client\\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\CharterStatusType', $httpHeader), $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 200:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\CharterStatusType', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function putCharterStatusType($id, $charter_status_type, $if_match = null)\n {\n list($response, $statusCode, $httpHeader) = $this->putCharterStatusTypeWithHttpInfo ($id, $charter_status_type, $if_match);\n return $response; \n }", "public function save_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\t\t$sql = \"INSERT INTO `statuses` (`name`,`status`) VALUES ('$_POST[name]','$_POST[status]')\";\n\t\t$result = $this->new_mysql($sql);\n if ($result == \"TRUE\") {\n\t\t\t$msg = '<div class=\"alert alert-success\">'.$_POST['name'].' was added.</div>';\n } else {\n\t\t\t$msg = '<div class=\"alert alert-danger\">'.$_POST['name'].' failed to add.</div>';\n }\n $this->charter_status($msg);\n\t}", "public function update_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\t\t$sql = \"UPDATE `statuses` SET `name` = '$_POST[name]', `status` = '$_POST[status]' \n\t\tWHERE `statusID` = '$_POST[statusID]'\";\n\t\t$result = $this->new_mysql($sql);\n if ($result == \"TRUE\") {\n\t\t\t$msg = '<div class=\"alert alert-success\">'.$_POST['name'].' was updated.</div>';\n } else {\n\t\t\t$msg = '<div class=\"alert alert-danger\">'.$_POST['name'].' failed to update.</div>';\n }\n $this->charter_status($msg);\n\t}", "public function deleteCharterStatusTypeByIdWithHttpInfo($id, $if_match = null)\n {\n \n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling deleteCharterStatusTypeById');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes/{id}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n \n // header params\n \n if ($if_match !== null) {\n $headerParams['If-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_match);\n }\n // path params\n \n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n \n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'DELETE',\n $queryParams, $httpBody,\n $headerParams\n );\n \n return array(null, $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "function bbp_register_post_statuses()\n{\n}", "public function register_post_statues() {\n\t\t\t$statuses = learn_press_get_register_order_statuses();\n\t\t\tforeach ( $statuses as $status => $args ) {\n\t\t\t\tregister_post_status( $status, $args );\n\t\t\t}\n\t\t}", "public function getCharterStatusTypesById($id, $if_none_match = null)\n {\n list($response, $statusCode, $httpHeader) = $this->getCharterStatusTypesByIdWithHttpInfo ($id, $if_none_match);\n return $response; \n }", "function register_post_type_statuses() {\n \n // Payment Statuses\n register_post_status( 'challenge', array(\n 'label' => _x( 'Challenge', 'challenge, payment status', 'edd' ),\n 'public' => true,\n 'exclude_from_search' => false,\n 'show_in_admin_all_list' => true,\n 'show_in_admin_status_list' => true,\n 'label_count' => _n_noop( 'Challange <span class=\"count\">(%s)</span>', 'Challenge <span class=\"count\">(%s)</span>', 'edd' )\n ) );\n register_post_status( 'cancel', array(\n 'label' => _x( 'Cancel', 'cancel, payment status', 'edd' ),\n 'public' => true,\n 'exclude_from_search' => false,\n 'show_in_admin_all_list' => true,\n 'show_in_admin_status_list' => true,\n 'label_count' => _n_noop( 'Cancel <span class=\"count\">(%s)</span>', 'Cancel <span class=\"count\">(%s)</span>', 'edd' )\n ) );\n}", "public function delete_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\n\t\t$sql = \"SELECT `name` FROM `statuses` WHERE `statusID` = '$_GET[statusID]'\";\n\t\t$result = $this->new_mysql($sql);\n\t\twhile ($row = $result->fetch_assoc()) {\n\t\t\t$name = $row['name'];\n\t\t}\n\n\t\t$sql = \"SELECT `statusID` FROM `charters` WHERE `statusID` = '$_GET[statusID]'\";\n\t\t$counter = \"0\";\n\t\t$result = $this->new_mysql($sql);\n while ($row = $result->fetch_assoc()) {\n\t\t\t$counter++;\n }\n if ($counter > 0) {\n\t\t\t$msg = '<div class=\"alert alert-danger\">'.$name.' has linked charters and can not be deleted.</div>';\n } else {\n $sql = \"DELETE FROM `statuses` WHERE `statusID` = '$_GET[statusID]'\";\n $result = $this->new_mysql($sql);\n if ($result == \"TRUE\") {\n\t\t\t\t$msg = '<div class=\"alert alert-success\">'.$name.' was deleted.</div>';\n } else {\n\t\t\t\t$msg = '<div class=\"alert alert-danger\">'.$name.' failed to delete.</div>';\n }\n }\n $this->charter_status($msg);\n\t}", "public function new_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\t\t$template = \"new_charter_status.tpl\";\n\t\t$dir = \"/charters\";\n\t\t$this->load_smarty(null,$template,$dir);\n\t}", "public function quotesV2PostWithHttpInfo($id, $number, $customer_id, $due_date, $quote_date, $created_utc, $approved_date, $currency_code, $status, $currency_rate, $company_reference, $eu_third_party, $customer_reference, $invoice_customer_name, $invoice_address1, $invoice_address2, $invoice_postal_code, $invoice_city, $invoice_country_code, $delivery_customer_name, $delivery_address1, $delivery_address2, $delivery_postal_code, $delivery_city, $delivery_country_code, $delivery_method_name, $delivery_method_code, $delivery_term_code, $delivery_term_name, $customer_is_private_person, $includes_vat, $is_domestic, $rot_reduced_invoicing_type, $rot_property_type, $rot_reduced_invoicing_property_name, $rot_reduced_invoicing_org_number, $rot_reduced_invoicing_amount, $rot_reduced_invoicing_automatic_distribution, $persons, $terms_of_payment, $sales_document_attachments, $rows, $total_amount, $vat_amount, $roundings_amount, $uses_green_technology)\n {\n $returnType = '\\Swagger\\Client\\Model\\QuoteApi';\n $request = $this->quotesV2PostRequest($id, $number, $customer_id, $due_date, $quote_date, $created_utc, $approved_date, $currency_code, $status, $currency_rate, $company_reference, $eu_third_party, $customer_reference, $invoice_customer_name, $invoice_address1, $invoice_address2, $invoice_postal_code, $invoice_city, $invoice_country_code, $delivery_customer_name, $delivery_address1, $delivery_address2, $delivery_postal_code, $delivery_city, $delivery_country_code, $delivery_method_name, $delivery_method_code, $delivery_term_code, $delivery_term_name, $customer_is_private_person, $includes_vat, $is_domestic, $rot_reduced_invoicing_type, $rot_property_type, $rot_reduced_invoicing_property_name, $rot_reduced_invoicing_org_number, $rot_reduced_invoicing_amount, $rot_reduced_invoicing_automatic_distribution, $persons, $terms_of_payment, $sales_document_attachments, $rows, $total_amount, $vat_amount, $roundings_amount, $uses_green_technology);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if (!in_array($returnType, ['string','integer','bool'])) {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 201:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Swagger\\Client\\Model\\QuoteApi',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function appendResTypes($value)\n {\n return $this->append(self::RES_TYPES, $value);\n }", "public function updateWarehouseServiceTypeWithHttpInfo($body)\n {\n $returnType = '';\n $request = $this->updateWarehouseServiceTypeRequest($body);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n return [null, $statusCode, $response->getHeaders()];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n }\n throw $e;\n }\n }", "public static function openAPITypes();", "public static function openAPITypes();", "public function technologicalProviderCreateWithHttpInfo($technological_provider)\n {\n $returnType = 'string';\n $request = $this->technologicalProviderCreateRequest($technological_provider);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n 'string',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function addWarehouseServiceTypeWithHttpInfo($body)\n {\n $returnType = '\\Infoplus\\Infoplus\\Model\\WarehouseServiceType';\n $request = $this->addWarehouseServiceTypeRequest($body);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Infoplus\\Infoplus\\Model\\WarehouseServiceType',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 405:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Infoplus\\Infoplus\\Model\\ApiResponse',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function teamBuilderConfigsIdProductTypesPostWithHttpInfo($id, $data = null)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling teamBuilderConfigsIdProductTypesPost');\n }\n // parse inputs\n $resourcePath = \"/TeamBuilderConfigs/{id}/productTypes\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n // body params\n $_tempBody = null;\n if (isset($data)) {\n $_tempBody = $data;\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'POST',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\Swagger\\Client\\Model\\ProductType',\n '/TeamBuilderConfigs/{id}/productTypes'\n );\n\n return array($this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\ProductType', $httpHeader), $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\ProductType', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "public function createCardSpendingControlUsingPostWithHttpInfo($request)\n {\n $returnType = '\\com\\hydrogen\\electron\\Model\\CardSpendingControlResponseVO';\n $request = $this->createCardSpendingControlUsingPostRequest($request);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\com\\hydrogen\\electron\\Model\\CardSpendingControlResponseVO',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function connectionTypesList(): Response\n {\n $response = $this->transport->get('/3.1/connection-types');\n\n return new Response($response['status'], $response['types']);\n }", "public function postAction(Request $request)\n {\n $em = $this->getDoctrine()->getManager();\n $serializer = $this->container->get('winefing.serializer_controller');\n $characteristicCategory = new CharacteristicCategory();\n $repository = $this->getDoctrine()->getRepository('WinefingApiBundle:Scope');\n $scope = $repository->findOneById($request->request->get('scope'));\n $characteristicCategory->setDescription($request->request->get('description'));\n $characteristicCategory->setActivated($request->request->get('activated'));\n $characteristicCategory->setScope($scope);\n\n $validator = $this->get('validator');\n $errors = $validator->validate($characteristicCategory);\n if (count($errors) > 0) {\n $errorsString = (string) $errors;\n return new Response(400, $errorsString);\n }\n $em->persist($characteristicCategory);\n $em->flush();\n $json = $serializer->serialize($characteristicCategory);\n return new Response($json);\n }", "public function teamBuilderConfigsIdProductGroupsNkTypesPostWithHttpInfo($id, $nk, $data = null)\n {\n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling teamBuilderConfigsIdProductGroupsNkTypesPost');\n }\n // verify the required parameter 'nk' is set\n if ($nk === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $nk when calling teamBuilderConfigsIdProductGroupsNkTypesPost');\n }\n // parse inputs\n $resourcePath = \"/TeamBuilderConfigs/{id}/productGroups/{nk}/types\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // path params\n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // path params\n if ($nk !== null) {\n $resourcePath = str_replace(\n \"{\" . \"nk\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($nk),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n // body params\n $_tempBody = null;\n if (isset($data)) {\n $_tempBody = $data;\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'POST',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\Swagger\\Client\\Model\\ProductType',\n '/TeamBuilderConfigs/{id}/productGroups/{nk}/types'\n );\n\n return array($this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\ProductType', $httpHeader), $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\ProductType', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "public function channelsV2BookingsPostAsyncWithHttpInfo($post_booking_request = null)\n {\n $returnType = '\\Piksel\\KigoPro\\Model\\PostBookingResponse';\n $request = $this->channelsV2BookingsPostRequest($post_booking_request);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }", "public function init_api( $server ) {\n if ( defined( 'JSON_API_VERSION' ) && ! empty( $this->api_prefix ) && ! empty( $this->api_endpoints ) ) {\n require_once ALQUIMIA__PLUGIN_DIR . 'api/class-q-sluggedcustomposttype.php';\n require_once ALQUIMIA__PLUGIN_DIR . 'api/class-q-json-customposttype.php';\n\n foreach ( $this->api_endpoints as $api_endpoint ) {\n $endpoint_filename = str_replace( '-', '', $api_endpoint );\n\n require_once $this->plugin_dir . \"api/class-$this->api_prefix-json-$endpoint_filename.php\";\n\n $object = strtoupper( $this->api_prefix ) . '_JSON_';\n $matches = explode( '-', $api_endpoint );\n\n foreach ( $matches as &$match ) $match = ucfirst( $match );\n\n $object .= implode( '', $matches );\n $object = new $object( $server );\n\n if ( ! empty( $this->post_statuses ) ) {\n if ( method_exists( $object, 'get_type' ) ) {\n $type = $object->get_type();\n\n if ( ! empty( $this->post_statuses[$type] ) ) {\n $object->allow_custom_post_statuses( true );\n $object->set_post_statuses( $this->post_statuses[$type] );\n }\n }\n }\n\n add_filter( 'json_endpoints', array( $object, 'register_routes' ) );\n }\n }\n }", "public function technologicalProviderCountWithHttpInfo($technological_provider_search_criteria_input_dto_id = null, $technological_provider_search_criteria_input_dto_name = null, $technological_provider_search_criteria_input_dto_nit = null)\n {\n $returnType = 'int';\n $request = $this->technologicalProviderCountRequest($technological_provider_search_criteria_input_dto_id, $technological_provider_search_criteria_input_dto_name, $technological_provider_search_criteria_input_dto_nit);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n 'int',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function customersRegisterPostWithHttpInfo($data = null)\n {\n // parse inputs\n $resourcePath = \"/Customers/register\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/x-www-form-urlencoded','application/xml','text/xml'));\n\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n // body params\n $_tempBody = null;\n if (isset($data)) {\n $_tempBody = $data;\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // this endpoint requires API key authentication\n $apiKey = $this->apiClient->getApiKeyWithPrefix('access_token');\n if (strlen($apiKey) !== 0) {\n $queryParams['access_token'] = $apiKey;\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'POST',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\Swagger\\Client\\Model\\TeamMember',\n '/Customers/register'\n );\n\n return array($this->apiClient->getSerializer()->deserialize($response, '\\Swagger\\Client\\Model\\TeamMember', $httpHeader), $statusCode, $httpHeader);\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\TeamMember', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }" ]
[ "0.58153284", "0.5423963", "0.52388763", "0.48914927", "0.45729983", "0.45380586", "0.4464926", "0.4350134", "0.41871163", "0.4175934", "0.41017064", "0.40694878", "0.4065157", "0.40292948", "0.39817438", "0.39465293", "0.393537", "0.39198387", "0.39198387", "0.3912599", "0.38760322", "0.38600966", "0.38589728", "0.38248104", "0.38202617", "0.3810793", "0.38077664", "0.37877166", "0.378676", "0.37822044" ]
0.6089922
0
putCharterStatusType Updates an existing resource based on the resource identifier.
public function putCharterStatusType($id, $charter_status_type, $if_match = null) { list($response, $statusCode, $httpHeader) = $this->putCharterStatusTypeWithHttpInfo ($id, $charter_status_type, $if_match); return $response; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function update_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\t\t$sql = \"UPDATE `statuses` SET `name` = '$_POST[name]', `status` = '$_POST[status]' \n\t\tWHERE `statusID` = '$_POST[statusID]'\";\n\t\t$result = $this->new_mysql($sql);\n if ($result == \"TRUE\") {\n\t\t\t$msg = '<div class=\"alert alert-success\">'.$_POST['name'].' was updated.</div>';\n } else {\n\t\t\t$msg = '<div class=\"alert alert-danger\">'.$_POST['name'].' failed to update.</div>';\n }\n $this->charter_status($msg);\n\t}", "public function save_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\t\t$sql = \"INSERT INTO `statuses` (`name`,`status`) VALUES ('$_POST[name]','$_POST[status]')\";\n\t\t$result = $this->new_mysql($sql);\n if ($result == \"TRUE\") {\n\t\t\t$msg = '<div class=\"alert alert-success\">'.$_POST['name'].' was added.</div>';\n } else {\n\t\t\t$msg = '<div class=\"alert alert-danger\">'.$_POST['name'].' failed to add.</div>';\n }\n $this->charter_status($msg);\n\t}", "public function edit_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\t\t$sql = \"SELECT `statusID`,`name`,`status` FROM `statuses` WHERE `statusID` = '$_GET[statusID]'\";\n\t\t$result = $this->new_mysql($sql);\n\t\twhile ($row = $result->fetch_assoc()) {\n\t\t\tforeach ($row as $key=>$value) {\n\t\t\t\t$data[$key] = $value;\n\t\t\t}\n\t\t}\n\t\t$template = \"edit_charter_status.tpl\";\n\t\t$dir = \"/charters\";\n\t\t$this->load_smarty($data,$template,$dir);\n\t}", "public function change_char(){\n\t\tif($this->user->check_auth('a_cal_revent_conf', false) || $this->check_permission('raidleader')){\n\t\t\t$this->pdh->put('calendar_raids_attendees', 'update_status', array(\n\t\t\t\t$this->url_id,\n\t\t\t\t$this->in->get('charchange_char', 0),\n\t\t\t\t$this->in->get('charchange_role', 0),\n\t\t\t\t$this->in->get('charchange_status', 0),\n\t\t\t\t$this->in->get('raidgroup', 0),\n\t\t\t\t$this->in->get('subscribed_member_id', 0),\n\t\t\t\t''\n\t\t\t));\n\t\t\t$this->pdh->process_hook_queue();\n\t\t}\n\t}", "public function new_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\t\t$template = \"new_charter_status.tpl\";\n\t\t$dir = \"/charters\";\n\t\t$this->load_smarty(null,$template,$dir);\n\t}", "public function putCharterStatusTypeWithHttpInfo($id, $charter_status_type, $if_match = null)\n {\n \n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling putCharterStatusType');\n }\n // verify the required parameter 'charter_status_type' is set\n if ($charter_status_type === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $charter_status_type when calling putCharterStatusType');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes/{id}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n \n // header params\n \n if ($if_match !== null) {\n $headerParams['If-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_match);\n }\n // path params\n \n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // body params\n $_tempBody = null;\n if (isset($charter_status_type)) {\n $_tempBody = $charter_status_type;\n }\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'PUT',\n $queryParams, $httpBody,\n $headerParams\n );\n \n return array(null, $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function getCharterStatusTypeByKey($charter_status_type_id, $if_none_match = null)\n {\n list($response, $statusCode, $httpHeader) = $this->getCharterStatusTypeByKeyWithHttpInfo ($charter_status_type_id, $if_none_match);\n return $response; \n }", "public function delete_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\n\t\t$sql = \"SELECT `name` FROM `statuses` WHERE `statusID` = '$_GET[statusID]'\";\n\t\t$result = $this->new_mysql($sql);\n\t\twhile ($row = $result->fetch_assoc()) {\n\t\t\t$name = $row['name'];\n\t\t}\n\n\t\t$sql = \"SELECT `statusID` FROM `charters` WHERE `statusID` = '$_GET[statusID]'\";\n\t\t$counter = \"0\";\n\t\t$result = $this->new_mysql($sql);\n while ($row = $result->fetch_assoc()) {\n\t\t\t$counter++;\n }\n if ($counter > 0) {\n\t\t\t$msg = '<div class=\"alert alert-danger\">'.$name.' has linked charters and can not be deleted.</div>';\n } else {\n $sql = \"DELETE FROM `statuses` WHERE `statusID` = '$_GET[statusID]'\";\n $result = $this->new_mysql($sql);\n if ($result == \"TRUE\") {\n\t\t\t\t$msg = '<div class=\"alert alert-success\">'.$name.' was deleted.</div>';\n } else {\n\t\t\t\t$msg = '<div class=\"alert alert-danger\">'.$name.' failed to delete.</div>';\n }\n }\n $this->charter_status($msg);\n\t}", "public function update_charter() {\n\t\t$this->security('create_new_charter',$_SESSION['user_typeID']);\n\n\t\t$start_date = date(\"Ymd\", strtotime($_POST['charter_date']));\n\t\t$sql = \"UPDATE `charters` SET `nights` = '$_POST[nights]', `start_date` = '$start_date', `statusID` = '$_POST[status]', `status_commentID` = '$_POST[status_commentID]',\n\t\t`destinationID` = '$_POST[destinationID]', `overriding_comment` = '$_POST[overriding_comment]', `itinerary` = '$_POST[itinerary]',\n\t\t`destination` = '$_POST[destination]', `embarkment` = '$_POST[embarkment]', `disembarkment` = '$_POST[disembarkment]', `group1` = '$_POST[group1]',\n\t\t`group2` = '$_POST[group2]', `add_on_price_commissionable` = '$_POST[add_on_price_commissionable]', `add_on_price` = '$_POST[add_on_price]'\n\t\tWHERE `charterID` = '$_POST[charterID]'\";\n\n $result = $this->new_mysql($sql);\n if ($result == \"true\") {\n print '<div class=\"alert alert-success\">The charter was updated. Loading please wait...</div>';\n ?>\n <script>\n setTimeout(function() {\n\t\t\t\twindow.location.replace('/locate_charter')\n }\n ,3000);\n </script>\n <?php\n } else {\n\t\t\tprint '<div class=\"alert alert-success\">The charter failed to update.</div>';\n\t\t\tprint \"<br><font color=red>SQL Query:<br><pre>$sql</pre>\";\n }\n\t}", "function set_supported_status(int $equipment_id, int $status)\n{\n $tablename = ($equipment_id % 2 == 0) ? \"HardwareEquipment\" : \"SoftwareEquipment\";\n $conn = meta_open_db();\n if ($stmt = $conn->prepare(\"UPDATE `$tablename` SET `Supported`=? WHERE `ID`=?\"))\n {\n $raw_id = intdiv($equipment_id, 2);\n $stmt->bind_param(\"ii\", $status, $raw_id);\n $stmt->execute();\n $stmt->close();\n }\n $conn->close();\n}", "function set_ticket_status(int $ticket_id, int $status)\n{\n amend_ticket($ticket_id, null, null, null, $status, null);\n}", "public function getCharterStatusTypeByKeyWithHttpInfo($charter_status_type_id, $if_none_match = null)\n {\n \n // verify the required parameter 'charter_status_type_id' is set\n if ($charter_status_type_id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $charter_status_type_id when calling getCharterStatusTypeByKey');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n // query params\n \n if ($charter_status_type_id !== null) {\n $queryParams['charterStatusTypeId'] = $this->apiClient->getSerializer()->toQueryValue($charter_status_type_id);\n }\n // header params\n \n if ($if_none_match !== null) {\n $headerParams['If-None-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_none_match);\n }\n \n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n \n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'GET',\n $queryParams, $httpBody,\n $headerParams, '\\Swagger\\Client\\Model\\CharterStatusType'\n );\n \n if (!$response) {\n return array(null, $statusCode, $httpHeader);\n }\n\n return array(\\Swagger\\Client\\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\CharterStatusType', $httpHeader), $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 200:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\CharterStatusType', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function deleteCharterStatusTypeById($id, $if_match = null)\n {\n list($response, $statusCode, $httpHeader) = $this->deleteCharterStatusTypeByIdWithHttpInfo ($id, $if_match);\n return $response; \n }", "public function setStatus(string $consumerKey, string $status): void;", "public static function setTaggedStatus($tag,$status)\n\t{\n\t\t$pc = App\\PcTicket::ticket($tag)->first();\n\t\tif(count($pc) > 0)\n\t\t{\n\t\t\tApp\\Pc::setItemStatus($pc->pc_id,$status);\n\t\t}\n\n\t\t/*\n\t\t|--------------------------------------------------------------------------\n\t\t|\n\t\t| \tCheck if the tag is equipment\n\t\t|\n\t\t|--------------------------------------------------------------------------\n\t\t|\n\t\t*/\n\t\t$itemticket = App\\ItemTicket::ticketID($tag)->first();\n\t\tif( count($itemticket) > 0)\n\t\t{\n\t\t\tApp\\ItemProfile::setItemStatus($itemticket->item_id,$status);\n\t\t}\n\t}", "public function updateStatus($status)\n {\n $user = Auth::user()->id;\n $service_provider_id = UserHelper::getServiceProviderID($user);\n try {\n $service_provider = ServiceProvider::findOrFail($service_provider_id);\n $service_provider->availability = $status;\n $service_provider->save();\n\n return response()->json([\n 'sucess' => true,\n 'status' => $status,\n 'message' => __('messages.update-status-message')\n ]);\n } catch (ModelNotFoundException $ex) {\n return response()\n ->json([\n 'message' => __('messages.no_user_found_message')\n ]);\n }\n }", "function updateStatus($resourceID, $statusID)\n {\n // address city state zip website serviceID recommendedInfoID statusID\n\n // define the query\n $sql = 'UPDATE\n resources\n SET\n statusID = :statusID\n WHERE\n resourceID = :resourceID';\n\n // prepare the statement\n $statement = $this->_dbh->prepare($sql);\n\n\n // bind params\n $statement->bindParam(':resourceID', $resourceID, PDO::PARAM_STR);\n $statement->bindParam(':statusID', $statusID, PDO::PARAM_STR);\n\n // Execute the statement\n $statement->execute();\n\n //confirmation\n return $this->getSelectedListInfo($resourceID);\n }", "public function updateCourseStatus( )\n {\n //\n }", "public function updateStatus($booking_id, Request $request);", "public function fuel_type_status() {\n\t\t$id = $this->uri->segment(4);\n\t\t$status = $this->uri->segment(5);\n\n\t\tCheckAdminLoginSession();\t\t\n\t\t$data['status'] = $status;\n\t\t$data['modified_date'] = date('Y-m-d H:i:s');\t\t\t\t \t \t\t \n\n\t\t$this->admin_model->setUpdateData($this->fuel_type,$data,$id);\n\t\t$this->session->set_flashdata('message','Your status has been update successfully');\n\t\tredirect('admin/vehicle/fuel-type','refresh');\t\t\t\n\t}", "function changeStatusVendor()\n {\n if($this->isAdmin() == TRUE)\n {\n echo(json_encode(array('status'=>'access')));\n }\n else\n {\n $id = $this->input->post('id');\n\t\t\t\n\t\t\t$vendor_arr = $this->vendor_model->getVendorInfo($id);\n\t\t\t\n\t\t\t$status = $vendor_arr[0]->status;\n\t\t\t\n\t\t\tif($status=='0'){\n\t\t\t\t$statusVal='1';\n\t\t\t}else{\n\t\t\t\t$statusVal='0';\n\t\t\t}\n $vendorInfo = array(\n\t\t\t'status'=>$statusVal,\n\t\t\t'updated_by'=>$this->vendorId, \n\t\t\t'updated_on'=>date('Y-m-d H:i:s'));\n \n $result = $this->vendor_model->changeStatusVendor($id, $vendorInfo);\n \n if ($result > 0) { echo(json_encode(array('status'=>TRUE))); }\n else { echo(json_encode(array('status'=>FALSE))); }\n }\n }", "public function setResourceType($resourceType);", "function set_status($id, $rate){\n\n $id = $this->m_ps->encrypt_decrypt('decrypt', $id);\n\n $where\t= array('uid' => $id);\n\n $data_arr = array(\n\n 'status'\t\t\t\t=> $rate == 1 ? 0 : 1,\n\n 'user_create' \t\t=> $this->session->userdata('name'),\n\n 'updated_date' \t\t=> date('Y-m-d H:i:s')\n\n );\n\n $result\t=\t$this->m_ps->update_field('users', $data_arr, $where);\n\n\n\n if($result){\n\n $this->session->set_userdata('message', $this->connect->message(\"tour has been updated!\", \"success\"));\n\n }else{\n\n $this->session->set_userdata('message', $this->connect->message(\"Error!\", \"warning\"));\n\n }\n\n\n\n redirect(site_url().'backend/users', 'location', 302);\n\n }", "public function updateStatus()\n {\n }", "public function putStatus($id)\n {\n $booking = BookingModel::ofCurrentUser()->findOrFail($id);\n\n $booking->status = BookingModel::getStatus(Input::get('booking_status'));\n\n try {\n $booking->saveOrFail();\n\n return Response::json([\n 'error' => false,\n 'data' => $this->_prepareBookingData($booking),\n ], 200);\n } catch (ValidationException $e) {\n return Response::json([\n 'error' => true,\n 'message' => $e->getMessage(),\n ], 400);\n }\n }", "public function vehicle_type_status() {\n\t\t$id = $this->uri->segment(4);\n\t\t$status = $this->uri->segment(5);\n\t\tCheckAdminLoginSession();\t\t\n\t\t$data['status'] = $status;\t\t\t\t \t \t\t \n\t\t$this->admin_model->setUpdateData($this->vehicle_type,$data,$id);\n\t\t$this->session->set_flashdata('message','Your status has been update successfully');\n\t\tredirect('admin/vehicle/vehicle-type','refresh');\t\t\t\n\t}", "public function change_driver_status() {\n if ($this->checkLogin('C') == '') {\n redirect(COMPANY_NAME);\n } else {\n $mode = $this->uri->segment(4, 0);\n $driver_id = $this->uri->segment(5, 0);\n $status = ($mode == '0') ? 'Inactive' : 'Active';\n $newdata = array('status' => $status);\n $condition = array('_id' => MongoID($driver_id));\n $this->driver_model->update_details(DRIVERS, $newdata, $condition);\n $this->setErrorMessage('success', 'Driver Status Changed Successfully','admin_driver_status_changed');\n redirect(COMPANY_NAME.'/drivers/display_drivers_list');\n }\n }", "function change_status()\n {\n //Create Model Object\n $equipmentObj=new equipmentModel();\n \n //change status\n $equipmentObj->changeStatus();\n\n $msg=\"Equipment Type status has been activated successfully\";\n if($_GET['newstatus']=='0')\n {\n $msg=\"Equipment Type status has been deactivated successfully\";\n }\n\n echo json_encode(array(\"result\" => \"success\",\"title\" => \"Equipment Status\",\"message\" => $msg));\n exit();\n }", "function update_country_resources( $term_id, $tt_id ){\n if ( ! isset( $_POST['country_resources_nonce'] ) || ! wp_verify_nonce( $_POST['country_resources_nonce'], basename( __FILE__ ) ) ) {\n \t\treturn;\n \t}\n if( isset( $_POST['resources'] ) && '' !== $_POST['resources'] ){\n $resources = $_POST['resources'];\n update_term_meta( $term_id, 'resources', sanitize_details($resources) );\n }\n }", "public function updateStatus(string $token);" ]
[ "0.6650566", "0.5994911", "0.58362085", "0.5705299", "0.5585295", "0.5468421", "0.5174291", "0.51212406", "0.49847293", "0.4855461", "0.48398504", "0.47992826", "0.4728339", "0.4675795", "0.46439224", "0.4629956", "0.45538965", "0.45075586", "0.44805804", "0.44698384", "0.44495633", "0.44451833", "0.44368744", "0.44099402", "0.43997756", "0.43841198", "0.43819848", "0.43759894", "0.43707028", "0.43654725" ]
0.66109127
1
putCharterStatusTypeWithHttpInfo Updates an existing resource based on the resource identifier.
public function putCharterStatusTypeWithHttpInfo($id, $charter_status_type, $if_match = null) { // verify the required parameter 'id' is set if ($id === null) { throw new \InvalidArgumentException('Missing the required parameter $id when calling putCharterStatusType'); } // verify the required parameter 'charter_status_type' is set if ($charter_status_type === null) { throw new \InvalidArgumentException('Missing the required parameter $charter_status_type when calling putCharterStatusType'); } // parse inputs $resourcePath = "/charterStatusTypes/{id}"; $httpBody = ''; $queryParams = array(); $headerParams = array(); $formParams = array(); $_header_accept = ApiClient::selectHeaderAccept(array('application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array()); // header params if ($if_match !== null) { $headerParams['If-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_match); } // path params if ($id !== null) { $resourcePath = str_replace( "{" . "id" . "}", $this->apiClient->getSerializer()->toPathValue($id), $resourcePath ); } // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); // body params $_tempBody = null; if (isset($charter_status_type)) { $_tempBody = $charter_status_type; } // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, 'PUT', $queryParams, $httpBody, $headerParams ); return array(null, $statusCode, $httpHeader); } catch (ApiException $e) { switch ($e->getCode()) { case 500: $data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\WebServiceError', $e->getResponseHeaders()); $e->setResponseObject($data); break; } throw $e; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function putCharterStatusType($id, $charter_status_type, $if_match = null)\n {\n list($response, $statusCode, $httpHeader) = $this->putCharterStatusTypeWithHttpInfo ($id, $charter_status_type, $if_match);\n return $response; \n }", "public function getCharterStatusTypeByKeyWithHttpInfo($charter_status_type_id, $if_none_match = null)\n {\n \n // verify the required parameter 'charter_status_type_id' is set\n if ($charter_status_type_id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $charter_status_type_id when calling getCharterStatusTypeByKey');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n // query params\n \n if ($charter_status_type_id !== null) {\n $queryParams['charterStatusTypeId'] = $this->apiClient->getSerializer()->toQueryValue($charter_status_type_id);\n }\n // header params\n \n if ($if_none_match !== null) {\n $headerParams['If-None-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_none_match);\n }\n \n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n \n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'GET',\n $queryParams, $httpBody,\n $headerParams, '\\Swagger\\Client\\Model\\CharterStatusType'\n );\n \n if (!$response) {\n return array(null, $statusCode, $httpHeader);\n }\n\n return array(\\Swagger\\Client\\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\CharterStatusType', $httpHeader), $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 200:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\CharterStatusType', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function update_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\t\t$sql = \"UPDATE `statuses` SET `name` = '$_POST[name]', `status` = '$_POST[status]' \n\t\tWHERE `statusID` = '$_POST[statusID]'\";\n\t\t$result = $this->new_mysql($sql);\n if ($result == \"TRUE\") {\n\t\t\t$msg = '<div class=\"alert alert-success\">'.$_POST['name'].' was updated.</div>';\n } else {\n\t\t\t$msg = '<div class=\"alert alert-danger\">'.$_POST['name'].' failed to update.</div>';\n }\n $this->charter_status($msg);\n\t}", "public function getCharterStatusTypesByIdWithHttpInfo($id, $if_none_match = null)\n {\n \n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling getCharterStatusTypesById');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes/{id}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n \n // header params\n \n if ($if_none_match !== null) {\n $headerParams['If-None-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_none_match);\n }\n // path params\n \n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n \n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'GET',\n $queryParams, $httpBody,\n $headerParams, '\\Swagger\\Client\\Model\\CharterStatusType'\n );\n \n if (!$response) {\n return array(null, $statusCode, $httpHeader);\n }\n\n return array(\\Swagger\\Client\\ObjectSerializer::deserialize($response, '\\Swagger\\Client\\Model\\CharterStatusType', $httpHeader), $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 200:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\CharterStatusType', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function edit_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\t\t$sql = \"SELECT `statusID`,`name`,`status` FROM `statuses` WHERE `statusID` = '$_GET[statusID]'\";\n\t\t$result = $this->new_mysql($sql);\n\t\twhile ($row = $result->fetch_assoc()) {\n\t\t\tforeach ($row as $key=>$value) {\n\t\t\t\t$data[$key] = $value;\n\t\t\t}\n\t\t}\n\t\t$template = \"edit_charter_status.tpl\";\n\t\t$dir = \"/charters\";\n\t\t$this->load_smarty($data,$template,$dir);\n\t}", "public function postCharterStatusTypesWithHttpInfo($charter_status_type)\n {\n \n // verify the required parameter 'charter_status_type' is set\n if ($charter_status_type === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $charter_status_type when calling postCharterStatusTypes');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n \n \n \n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n // body params\n $_tempBody = null;\n if (isset($charter_status_type)) {\n $_tempBody = $charter_status_type;\n }\n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'POST',\n $queryParams, $httpBody,\n $headerParams\n );\n \n return array(null, $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function save_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\t\t$sql = \"INSERT INTO `statuses` (`name`,`status`) VALUES ('$_POST[name]','$_POST[status]')\";\n\t\t$result = $this->new_mysql($sql);\n if ($result == \"TRUE\") {\n\t\t\t$msg = '<div class=\"alert alert-success\">'.$_POST['name'].' was added.</div>';\n } else {\n\t\t\t$msg = '<div class=\"alert alert-danger\">'.$_POST['name'].' failed to add.</div>';\n }\n $this->charter_status($msg);\n\t}", "public function deleteCharterStatusTypeById($id, $if_match = null)\n {\n list($response, $statusCode, $httpHeader) = $this->deleteCharterStatusTypeByIdWithHttpInfo ($id, $if_match);\n return $response; \n }", "public function getCharterStatusTypeByKey($charter_status_type_id, $if_none_match = null)\n {\n list($response, $statusCode, $httpHeader) = $this->getCharterStatusTypeByKeyWithHttpInfo ($charter_status_type_id, $if_none_match);\n return $response; \n }", "public function deleteCharterStatusTypeByIdWithHttpInfo($id, $if_match = null)\n {\n \n // verify the required parameter 'id' is set\n if ($id === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $id when calling deleteCharterStatusTypeById');\n }\n \n // parse inputs\n $resourcePath = \"/charterStatusTypes/{id}\";\n $httpBody = '';\n $queryParams = array();\n $headerParams = array();\n $formParams = array();\n $_header_accept = ApiClient::selectHeaderAccept(array('application/json'));\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());\n \n \n // header params\n \n if ($if_match !== null) {\n $headerParams['If-Match'] = $this->apiClient->getSerializer()->toHeaderValue($if_match);\n }\n // path params\n \n if ($id !== null) {\n $resourcePath = str_replace(\n \"{\" . \"id\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($id),\n $resourcePath\n );\n }\n // default format to json\n $resourcePath = str_replace(\"{format}\", \"json\", $resourcePath);\n\n \n \n \n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n \n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath, 'DELETE',\n $queryParams, $httpBody,\n $headerParams\n );\n \n return array(null, $statusCode, $httpHeader);\n \n } catch (ApiException $e) {\n switch ($e->getCode()) { \n case 500:\n $data = \\Swagger\\Client\\ObjectSerializer::deserialize($e->getResponseBody(), '\\Swagger\\Client\\Model\\WebServiceError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n \n throw $e;\n }\n }", "public function new_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\t\t$template = \"new_charter_status.tpl\";\n\t\t$dir = \"/charters\";\n\t\t$this->load_smarty(null,$template,$dir);\n\t}", "public function postCharterStatusTypes($charter_status_type)\n {\n list($response, $statusCode, $httpHeader) = $this->postCharterStatusTypesWithHttpInfo ($charter_status_type);\n return $response; \n }", "public function delete_charter_status() {\n\t\t$this->security('charter_status',$_SESSION['user_typeID']);\n\n\t\t$sql = \"SELECT `name` FROM `statuses` WHERE `statusID` = '$_GET[statusID]'\";\n\t\t$result = $this->new_mysql($sql);\n\t\twhile ($row = $result->fetch_assoc()) {\n\t\t\t$name = $row['name'];\n\t\t}\n\n\t\t$sql = \"SELECT `statusID` FROM `charters` WHERE `statusID` = '$_GET[statusID]'\";\n\t\t$counter = \"0\";\n\t\t$result = $this->new_mysql($sql);\n while ($row = $result->fetch_assoc()) {\n\t\t\t$counter++;\n }\n if ($counter > 0) {\n\t\t\t$msg = '<div class=\"alert alert-danger\">'.$name.' has linked charters and can not be deleted.</div>';\n } else {\n $sql = \"DELETE FROM `statuses` WHERE `statusID` = '$_GET[statusID]'\";\n $result = $this->new_mysql($sql);\n if ($result == \"TRUE\") {\n\t\t\t\t$msg = '<div class=\"alert alert-success\">'.$name.' was deleted.</div>';\n } else {\n\t\t\t\t$msg = '<div class=\"alert alert-danger\">'.$name.' failed to delete.</div>';\n }\n }\n $this->charter_status($msg);\n\t}", "public function quotesV2PutWithHttpInfo($id2, $number, $customer_id, $due_date, $quote_date, $created_utc, $approved_date, $currency_code, $status, $currency_rate, $company_reference, $eu_third_party, $customer_reference, $invoice_customer_name, $invoice_address1, $invoice_address2, $invoice_postal_code, $invoice_city, $invoice_country_code, $delivery_customer_name, $delivery_address1, $delivery_address2, $delivery_postal_code, $delivery_city, $delivery_country_code, $delivery_method_name, $delivery_method_code, $delivery_term_code, $delivery_term_name, $customer_is_private_person, $includes_vat, $is_domestic, $rot_reduced_invoicing_type, $rot_property_type, $rot_reduced_invoicing_property_name, $rot_reduced_invoicing_org_number, $rot_reduced_invoicing_amount, $rot_reduced_invoicing_automatic_distribution, $persons, $terms_of_payment, $sales_document_attachments, $rows, $total_amount, $vat_amount, $roundings_amount, $uses_green_technology, $id)\n {\n $returnType = 'object';\n $request = $this->quotesV2PutRequest($id2, $number, $customer_id, $due_date, $quote_date, $created_utc, $approved_date, $currency_code, $status, $currency_rate, $company_reference, $eu_third_party, $customer_reference, $invoice_customer_name, $invoice_address1, $invoice_address2, $invoice_postal_code, $invoice_city, $invoice_country_code, $delivery_customer_name, $delivery_address1, $delivery_address2, $delivery_postal_code, $delivery_city, $delivery_country_code, $delivery_method_name, $delivery_method_code, $delivery_term_code, $delivery_term_name, $customer_is_private_person, $includes_vat, $is_domestic, $rot_reduced_invoicing_type, $rot_property_type, $rot_reduced_invoicing_property_name, $rot_reduced_invoicing_org_number, $rot_reduced_invoicing_amount, $rot_reduced_invoicing_automatic_distribution, $persons, $terms_of_payment, $sales_document_attachments, $rows, $total_amount, $vat_amount, $roundings_amount, $uses_green_technology, $id);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if (!in_array($returnType, ['string','integer','bool'])) {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n 'object',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function update_charter() {\n\t\t$this->security('create_new_charter',$_SESSION['user_typeID']);\n\n\t\t$start_date = date(\"Ymd\", strtotime($_POST['charter_date']));\n\t\t$sql = \"UPDATE `charters` SET `nights` = '$_POST[nights]', `start_date` = '$start_date', `statusID` = '$_POST[status]', `status_commentID` = '$_POST[status_commentID]',\n\t\t`destinationID` = '$_POST[destinationID]', `overriding_comment` = '$_POST[overriding_comment]', `itinerary` = '$_POST[itinerary]',\n\t\t`destination` = '$_POST[destination]', `embarkment` = '$_POST[embarkment]', `disembarkment` = '$_POST[disembarkment]', `group1` = '$_POST[group1]',\n\t\t`group2` = '$_POST[group2]', `add_on_price_commissionable` = '$_POST[add_on_price_commissionable]', `add_on_price` = '$_POST[add_on_price]'\n\t\tWHERE `charterID` = '$_POST[charterID]'\";\n\n $result = $this->new_mysql($sql);\n if ($result == \"true\") {\n print '<div class=\"alert alert-success\">The charter was updated. Loading please wait...</div>';\n ?>\n <script>\n setTimeout(function() {\n\t\t\t\twindow.location.replace('/locate_charter')\n }\n ,3000);\n </script>\n <?php\n } else {\n\t\t\tprint '<div class=\"alert alert-success\">The charter failed to update.</div>';\n\t\t\tprint \"<br><font color=red>SQL Query:<br><pre>$sql</pre>\";\n }\n\t}", "function putVendorAttribute($vendor, $attrib, $value, $type = null)\n {\n\n if ($type == null) {\n $type = gettype($value);\n }\n\n switch ($type) {\n case 'integer':\n return radius_put_vendor_int($this->res, $vendor, $attrib, $value);\n\n case 'addr':\n return radius_put_vendor_addr($this->res, $vendor,$attrib, $value);\n\n case 'string':\n default:\n return radius_put_vendor_attr($this->res, $vendor, $attrib, $value);\n }\n\n }", "public function updateCompetition($type, $competitionId, $competitionInfo)\n {\n return $this->request($type . 's/' . $competitionId, 'POST', $competitionInfo);\n }", "public function charter_status($msg='') {\n $this->security('charter_status',$_SESSION['user_typeID']);\n\n // load data\n if ($_GET['status'] != \"\") {\n $status = $_GET['status'];\n }\n if ($_POST['status'] != \"\") {\n $status = $_POST['status'];\n } \n switch ($status) {\n case \"on\":\n $charter_status = \"Active\";\n $data['status_button'] = \"<input type=\\\"button\\\" value=\\\"Show Inactive\\\" onclick=\\\"document.location.href='/charter_status/off'\\\" class=\\\"btn btn-warning\\\">\";\n break; \n \n case \"off\":\n $charter_status = \"Inactive\";\n $data['status_button'] = \"<input type=\\\"button\\\" value=\\\"Show Active\\\" onclick=\\\"document.location.href='/charter_status/on'\\\" class=\\\"btn btn-primary\\\">\";\n break;\n\n default:\n $charter_status = \"Active\";\n $data['status_button'] = \"<input type=\\\"button\\\" value=\\\"Show Inactive\\\" onclick=\\\"document.location.href='/charter_status/off'\\\" class=\\\"btn btn-warning\\\">\";\n break;\n } \n\n\t\t$sql = \"SELECT `statusID`,`name`,`status` FROM `statuses` WHERE `status` = '$charter_status' AND `name` != '' ORDER BY `name` ASC\";\n\t\t$result = $this->new_mysql($sql);\n\t\twhile ($row = $result->fetch_assoc()) {\n $html .= \"<tr><td>\n <a href=\\\"/edit_charter_status/$row[statusID]\\\" data-toggle=\\\"tooltip\\\" title=\\\"Edit Charter Status\\\">\n\t\t\t<i class=\\\"fa fa-pencil-square-o\\\" aria-hidden=\\\"true\\\"></i></a>&nbsp;\n\n <a href=\\\"javascript:void(0);\\\" data-toggle=\\\"tooltip\\\" title=\\\"Delete Charter Status\\\"\n onclick=\\\"\n if(confirm('You are about to delete $row[name]. If there are linked charter the system will not delete the status. Click OK to continue.')) {\n document.location.href='/delete_charter_status/$row[statusID]';\n }\n \\\"\n ><i class=\\\"fa fa-trash-o\\\" aria-hidden=\\\"true\\\"></i></a>&nbsp;\n </td><td>$row[name]</td><td>$row[status]</td></tr>\";\n\t\t}\n\t\t$data['html'] = $html;\n\t\t$data['msg'] = $msg;\n\t\t$template = \"charter_status.tpl\";\n\t\t$dir = \"/charters\";\n\t\t$this->load_smarty($data,$template,$dir);\n\t}", "public function change_char(){\n\t\tif($this->user->check_auth('a_cal_revent_conf', false) || $this->check_permission('raidleader')){\n\t\t\t$this->pdh->put('calendar_raids_attendees', 'update_status', array(\n\t\t\t\t$this->url_id,\n\t\t\t\t$this->in->get('charchange_char', 0),\n\t\t\t\t$this->in->get('charchange_role', 0),\n\t\t\t\t$this->in->get('charchange_status', 0),\n\t\t\t\t$this->in->get('raidgroup', 0),\n\t\t\t\t$this->in->get('subscribed_member_id', 0),\n\t\t\t\t''\n\t\t\t));\n\t\t\t$this->pdh->process_hook_queue();\n\t\t}\n\t}", "public function api_status($time_id = null, $status = null, $confirm = null)\n\t{\n\t\tif(\n\t\t\t$this->request->is('post', 'put') \n\t\t\t&& $confirm == 1 \n\t\t\t&& $this->Time->exists($time_id)\n\t\t\t&& in_array($status, array('approved', 'rejected', 'pending') )\n\t\t\t&& ($time = $this->Time->findByTimeId($time_id) )\n\t\t\t&& !empty($time['OrganizationTime'])\n\t\t\t&& ($this->organization_id = $time['OrganizationTime'][0]['organization_id'])\n\t\t\t&& $this->_CurrentUserCanWrite($this->organization_id)\n\t\t)\n\t\t{\n\t\t\t$this->Time->id = $time_id;\n\t\t\tif( $this->Time->saveField('status', $status) )\n\t\t\t{\n\t\t\t\tif( isset($this->request->data['TimeComment']['body']) )\n\t\t\t\t{\n\t\t\t\t\t$comment = array(\n\t\t\t\t\t\t'time_id' => $time_id,\n\t\t\t\t\t\t'user_id' => $this->Auth->user('user_id'),\n\t\t\t\t\t\t'body' => $this->request->data['TimeComment']['body']\n\t\t\t\t\t);\n\t\t\t\t\t$this->Time->TimeComment->save($comment);\n\t\t\t\t}\n\t\t\t\t$response = array(\n\t\t\t\t\t'approved' => true,\n\t\t\t\t\t'message' => __(\"Time entry %s is %s\", $this->Time->id, $status)\n\t\t\t\t);\t\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$response = array(\n\t\t\t\t'approved' => false,\n\t\t\t\t'message' => __(\"There was a problem with your request\")\n\t\t\t);\n\t\t}\n\n\t\t$this->autoRender = false;\n\t\t$this->response->body( json_encode( compact('response') ) );\n\t\t$this->response->type('json');\n\t\t\n\t\treturn $this->response;\n\t}", "public function addToStatus($item)\n {\n // validation for constraint: enumeration\n if (!\\Devlabs91\\GenericOtaHotelApiService\\EnumType\\Status::valueIsValid($item)) {\n throw new \\InvalidArgumentException(sprintf('Value \"%s\" is invalid, please use one of: %s', $item, implode(', ', \\Devlabs91\\GenericOtaHotelApiService\\EnumType\\Status::getValidValues())), __LINE__);\n }\n $this->Status[] = $item;\n return $this;\n }", "public function setStatusInfo(?StatusBase $value): void {\n $this->getBackingStore()->set('statusInfo', $value);\n }", "public function setProvisioningStatusInfo(?ProvisioningStatusInfo $value): void {\n $this->getBackingStore()->set('provisioningStatusInfo', $value);\n }", "public function update(IndustryTypeRequest $request, ContactType $contactType)\n {\n $contactType->fill($request->post())->save();\n\n return response()->json([\n 'message' => 'Contact Type Updated Successfully!!',\n 'contact_type' => $contactType\n ]);\n }", "public function setAuthorizationInfo(?AuthorizationInfo $value): void {\n $this->getBackingStore()->set('authorizationInfo', $value);\n }", "public function technologicalProviderCountWithHttpInfo($technological_provider_search_criteria_input_dto_id = null, $technological_provider_search_criteria_input_dto_name = null, $technological_provider_search_criteria_input_dto_nit = null)\n {\n $returnType = 'int';\n $request = $this->technologicalProviderCountRequest($technological_provider_search_criteria_input_dto_id, $technological_provider_search_criteria_input_dto_name, $technological_provider_search_criteria_input_dto_nit);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n 'int',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "protected function getType()\n {\n return 'status';\n }", "public function channelsV2BookingsIdCancelPutWithHttpInfo($id, $cancelled_by_role = null, $cancellation_reason = null)\n {\n $request = $this->channelsV2BookingsIdCancelPutRequest($id, $cancelled_by_role, $cancellation_reason);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n return [null, $statusCode, $response->getHeaders()];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 400:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Piksel\\KigoPro\\Model\\ApiError',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 401:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Piksel\\KigoPro\\Model\\ApiError',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 403:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Piksel\\KigoPro\\Model\\ApiError',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 404:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Piksel\\KigoPro\\Model\\ApiError',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n case 500:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Piksel\\KigoPro\\Model\\ApiError',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function updateAch(array $account_info, array $contact, $client_reference_id, $account_reference_id) {\n\t\t$this->setErrors($this->getCommonError(\"unsupported\"));\n\t}", "public function setResponseType($value)\n {\n return $this->setParameter('responseType', $value);\n }" ]
[ "0.65194654", "0.5772681", "0.5533619", "0.5094798", "0.5025692", "0.5009734", "0.49116728", "0.4852343", "0.48439538", "0.47540274", "0.46783626", "0.44081584", "0.43393064", "0.4168104", "0.41388652", "0.40859687", "0.40502155", "0.40135548", "0.3982826", "0.3968227", "0.39426813", "0.3907567", "0.38276663", "0.38213333", "0.38134432", "0.37847075", "0.37822437", "0.3777305", "0.37683567", "0.3761529" ]
0.6670485
0
TODO: Implement getNbContactsBySociete() method.
public function getNbContactsBySociete() { return []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getContactos();", "public function getContactListCount()\n {\n return $this->count(self::CONTACTLIST);\n }", "public function GetNcontacts($criteria = null)\r\n\t{\r\n\t\treturn $this->_phreezer->GetOneToMany($this, \"FK_q27ejta8y2arisfx6k2v8y01v\", $criteria);\r\n\t}", "public function getContactos(){\n\t\t$cont = $this->_db->query(\"SELECT distinct c.id, c.nombre, c.telefono, c.encuesta, c.rut, c.comuna, c.region, c.codigo, c.dato1, c.dato2, c.dato3, c.dato4, c.dato5, c.dato6, c.dato7, c.dato8, c.dato9, c.dato10, c.dato11, c.fecha1, c.fecha2, c.fecha3, c.telefono2, c.telefono3, c.telefono4, c.telefono5, c.telefono6, c.telefono7, c.telefono8, c.telefono9, c.telefono10, c.created_at as creado, c.num_carga, c.estado_contacto, ec.nombre as e_contacto, c.estado_llamada, c.modified_at as modificado, ell.nombre as llamada, e.nombre as nom_encuesta, car.usuario_id, u.nombre as usuario FROM contactos c INNER JOIN estado_llamadas ell ON c.estado_llamada = ell.id INNER JOIN encuestas e ON c.encuesta = e.id LEFT JOIN cargas car ON c.num_carga = car.id INNER JOIN usuarios u ON car.usuario_id = u.id INNER JOIN estado_contactos ec ON c.estado_contacto = ec.id\");\n\n\t\treturn $cont->fetchall();\n\t}", "public static function listarContacto() {\r\n $cont = 0;\r\n try {\r\n global $con;\r\n $re = $con->Execute(\"select *from contacto\");\r\n foreach ($re as $row) {\r\n $contactoID = $row[\"contactoid\"];\r\n $nombre = $row[\"nombre\"];\r\n $apellido = $row[\"apellido\"];\r\n $sexo = $row[\"sexo\"];\r\n $parentesco = $row[\"parentesco\"];\r\n $telefono = $row[\"telefono\"];\r\n $email = $row[\"email\"];\r\n $fecha_ini = $row[\"fechacre\"];\r\n $fecha_fin = $row[\"fechaMod\"];\r\n $contacto = new Contacto($contactoID , $nombre, $apellido, $sexo, $parentesco, $telefono, $email, $fecha_ini, $fecha_fin);\r\n $lista[$cont++] = $contacto;\r\n }\r\n return $lista;\r\n } catch (Exception $exc) {\r\n echo $exc->getTraceAsString();\r\n }\r\n }", "public function get_all_contact() {\r\n\t\t\r\n\t}", "public function getNumberOfSchoolContacts(){\n $this->db->order_by('cid', 'DESC');\n $query = $this->db->get('schoolcontacts');\n return $query;\n\n }", "public function JQGRIDCountAtencionClienteDetalleCuenta(dto_cuenta $dtoCuenta, dto_cartera $dtoCartera) {\n//\t\t\t\tFROM ca_detalle_cuenta WHERE idcuenta=? \";\n//\t\t\t$sql=\" SELECT COUNT(*) AS 'COUNT'\n//\t\t\t\tFROM ca_detalle_cuenta WHERE numero_cuenta = ? AND idcartera = ? \";\n\n $sql = \" SELECT COUNT(*) AS 'COUNT'\n\t\t\t\tFROM ca_detalle_cuenta WHERE numero_cuenta = ? AND idcartera = ? AND moneda = ? \";\n\n //$cuenta=$dtoCuenta->getId();\n $numero_cuenta = $dtoCuenta->getNumeroCuenta();\n $cartera = $dtoCartera->getId();\n /* * ****** */\n $moneda = $dtoCuenta->getMoneda();\n /* * ****** */\n\n $factoryConnection = FactoryConnection::create('mysql');\n $connection = $factoryConnection->getConnection();\n\n //$connection->beginTransaction();\n\n $pr = $connection->prepare($sql);\n /* * * */\n $pr->bindParam(1, $numero_cuenta);\n $pr->bindParam(2, $cartera);\n /* * * */\n $pr->bindParam(3, $moneda);\n /* * * */\n\n //$pr->bindParam(1,$cuenta);\n if ($pr->execute()) {\n //$connection->commit();\n return $pr->fetchAll(PDO::FETCH_ASSOC);\n } else {\n //$connection->rollBack();\n return array(array('COUNT' => 0));\n }\n }", "protected function contacts() {\n $last_id = 0;\n $count = 0;\n list($min_id, $max_id) = $this->range;\n while (TRUE) {\n $contact_ids = db_select('redhen_contact', 'c')\n ->fields('c', ['contact_id'])\n ->condition('type', $this->bundle)\n ->condition('contact_id', $last_id, '>')\n ->condition('contact_id', $min_id, '>=')\n ->condition('contact_id', $max_id, '<')\n ->orderBy('contact_id')\n ->range(0, 100)\n ->execute()\n ->fetchCol();\n if (!$contact_ids) {\n break;\n }\n\n $contacts = entity_load('redhen_contact', $contact_ids, [], TRUE);\n foreach ($contacts as $contact) {\n yield $contact;\n $last_id = $contact->contact_id;\n }\n }\n }", "public function getIdContacto()\n {\n return $this->id_contacto;\n }", "public function ajax_get_nbcontactsAction($mailing_id){\n\n\t\t$mailing = new mailing();\n\t\t$mailing->get($mailing_id);\n\n\t\t$mailing->cible = unserialize($mailing->cible);\n\n\t\tif( isset($mailing->cible['ctype']) ){\n\t\t\tforeach($mailing->cible['ctype'] as $k => $v){\n\t\t\t\t$mailing->cible[$v] = 1;\n\t\t\t}\n\t\t}\n\n\t\t$ccontacts = $this->load_controller('contacts');\n\t\t$where = $ccontacts->getWhere($mailing->cible);\n\t\t$this->load_manager('contacts');\n\t\t\t\n\t\treturn $this->manager->contacts->count($where);\n\t}", "public function contacto()\n {\n return $this->hasMany('crmcomercial\\Entities\\Contacto', 'coc_prospecto');\n }", "public function index()\n\t{\n\t\t//\n\t\t$societes = new Societe;\n\t\t\n\n\n\t\t//$societe = Societe::where('etat',1)->orderBy('nom_clt','asc')->get();\n\t\t$actif = 'contact';\n\t\t$type = 0;\n\t\tif(isset($_GET['sort'])){\n\t\t\tif($_GET['sort']=='pays_clt'){\n\t\t\t\t$tri = 'pays';\n\t\t\t\t$societe = $societes->sortable()->where('etat',1)->get();\n\t\t\t}elseif($_GET['sort']=='statut'){\n\t\t\t\t$tri = 'client';\n\t\t\t\t$societe = $societes->sortable()->where('etat',1)->get();\n\t\t\t}elseif($_GET['sort']=='created_at'){\n\t\t\t\t$tri = 'ajout';\n\t\t\t\t$societe = $societes->sortable()->where('etat',1)->get();\n\t\t\t}elseif($_GET['sort']=='updated_at'){\n\t\t\t\t$tri = 'modif';\n\t\t\t\t$societe = $societes->sortable()->where('etat',1)->get();\n\t\t\t}elseif($_GET['sort']=='nom_clt'){\n\t\t\t\t$tri = 'alpha';\n\t\t\t\t$societe = $societes->sortable()->where('etat',1)->get();\n\t\t\t}elseif($_GET['sort']=='ville_siege_clt'){\n\t\t\t\t$tri = 'ville';\n\t\t\t\t$societe = $societes->sortable()->where('etat',1)->get();\n\t\t\t}elseif('notes'){\n\t\t\t\t$note = DB::table('societes')\n\t\t\t\t ->join('contacts', 'societes.id', '=', 'contacts.societe_id')\n\t\t\t\t ->join('notes', 'contacts.id', '=', 'notes.contact_id')\n\t\t\t\t ->select('societes.*', 'notes.*')->where('societes.etat',1)\n\t\t\t\t ->get();\n\t\t\t\t$societes = Societe::where('etat',1)->orderBy('nom_clt','asc')->get();\n\t\t\t\t$tri = 'notes';\n\n\t\t\t\t// Tri des contacts sans note\n\t\t\t\tforeach ($societes as $key => $value) {\n\t\t\t\t\t$exist = 0;\n\t\t\t\t\tforeach ($note as $keyn => $valuen) {\n\t\t\t\t\t\tif($value->nom_clt == $valuen->nom_clt){\n\t\t\t\t\t\t\t$exist = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif($exist==0){\n\t\t\t\t\t\t$societe [] = $value;\n\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\t\n\t\t\t\n\t\t}else{\n\t\t\t$tri = 'alpha';\n\t\t\t$societe = $societes->where('etat',1)->orderBy('nom_clt','asc')->get();\n\t\t}\n\t\t\n\t\treturn view('contact.contact', compact('actif','societe','type','tri'));\n\t}", "public function getUserContacts();", "public function getContactInformation();", "public function contactos($sede = 0)\r\n {\r\n return empty($sede) ? EmpSucursales::st_contactos($this->id) : EmpSucursales::find($sede)->contactos();\r\n }", "public function getContacto()\n\t\t{\n\t\t\t$query = \"select * from contacto\";\n\t\t\t$this->conexionDAO->Abrir();\n\t\t\t$resultado = $this->conexionDAO->select($query);\n\t\t\t$contactos = array();\n\t\t\twhile($row = $resultado->fetch_array()) \n\t\t\t{\n\t\t\t\t$contacto = new Contacto();\n\t\t\t\t$contacto->rut = $row[\"RUT\"];\n\t\t\t\t$contacto->dv = $row[\"DV\"];\n\t\t\t\t$contacto->ap_paterno = $row[\"APELLIDO_PATERNO\"];\n\t\t\t\t$contacto->ap_materno = $row[\"APELLIDO_MATERNO\"];\n\t\t\t\t$contacto->nombres = $row[\"NOMBRES\"];\n\t\t\t\t$contacto->telefono = $row[\"\tTELEFONO\"];\n\t\t\t\t$contacto->mail = $row[\"EMAIL\"];\n\n\t\t\t\t$contactos[] = $contacto;\n\t\t\t} \n\t\t\t$this->conexionDAO->Cerrar();\n\t\t\treturn $contactos;\n\t\t}", "public function getCountContactosDisponiblesCarga($carga){\n\t\t$carga = (int) $carga;\n\n\t\t$cont = $this->_db->query(\"SELECT count(c.id) as filas, c.estado_contacto, ec.nombre as estado FROM contactos c INNER JOIN estado_contactos ec ON c.estado_contacto = ec.id WHERE num_carga = {$carga} GROUP BY estado, c.estado_contacto\");\n\t\t\n\t\treturn $cont->fetchall();\n\t}", "public function getTotalContactCount() //for all assigned quires\n\t\t{\n\t\t\t\n\t\t\t\t$this->load->model('admin/Users_model', 'users');\n\t\t\t\t$data['queryCount'] = $this->users->getContactTotalCount();\n\t\t\t\techo $data['queryCount'];\n\t\t\t\n\t\t}", "public function getCountContactosEncuestadosCarga($carga){\n\t\t$carga = (int) $carga;\n\n\t\t$cont = $this->_db->query(\"SELECT count(id) as filas FROM contactos WHERE num_carga = {$carga} AND estado_llamada = 1\");\n\t\t$filas = $cont->fetch();\n\t\t$row = $filas['filas'];\n\t\t//print_r($row);exit;\n\t\t\n\t\treturn $row;\n\t}", "public function donneNbClients()\n\t\t{\n\t\treturn $this->tousLesClients->nbClients();\n\t\t}", "public function getContactosTelefono($telefono){\n\t\t$telefono = (int) $telefono;\n\n\t\t$cont = $this->_db->prepare(\"SELECT distinct c.id, c.nombre, c.telefono, c.encuesta, c.rut, c.comuna, c.region, c.codigo, c.dato1, c.dato2, c.dato3, c.dato4, c.dato5, c.dato6, c.dato7, c.dato8, c.dato9, c.dato10, c.dato11, c.fecha1, c.fecha2, c.fecha3, c.telefono2, c.telefono3, c.telefono4, c.telefono5, c.telefono6, c.telefono7, c.telefono8, c.telefono9, c.telefono10, c.created_at as creado, c.num_carga, c.estado_contacto, ec.nombre as e_contacto, c.estado_llamada, c.modified_at as modificado, ell.nombre as llamada, e.nombre as nom_encuesta, car.usuario_id, u.nombre as usuario FROM contactos c INNER JOIN estado_llamadas ell ON c.estado_llamada = ell.id INNER JOIN encuestas e ON c.encuesta = e.id INNER JOIN cargas car ON c.num_carga = car.id INNER JOIN usuarios u ON car.usuario_id = u.id INNER JOIN estado_contactos ec ON c.estado_contacto = ec.id WHERE c.telefono = ?\");\n\t\t$cont->bindParam(1, $telefono);\n\t\t$cont->execute();\n\n\t\treturn $cont->fetchall();\n\t}", "public function getContactSansEntreprise()\n\t{\n\t\t$this->db->distinct()->select(\"GMCON_CODE, GMCON_NOM, GMCON_PRENOM\")\n\t\t\t\t\t\t\t->from('gmcontact')\n\t\t\t\t\t\t\t->where_not_in('gmcontact.GMCON_CODE', 'gm_contact_entreprise.GMCON_CODE')\n\t\t\t\t\t\t\t->order_by(\"GMCON_NOM\", \"asc\");\n\n\t\t$query = $this->db->get();\n\t\treturn $query->result();\n\t}", "public function getContacts() {\n return $this->contacts;\n }", "public function getContactCount()\n {\n $value = $this->get(self::CONTACTCOUNT);\n return $value === null ? (integer)$value : $value;\n }", "function listarContacto(){\n\t\t$this->procedimiento='prov.ft_contacto_sel';\n\t\t$this->transaccion='PROV_CONTAC_SEL';\n\t\t$this->tipo_procedimiento='SEL';//tipo de transaccion\n\t\t\t\t\n\t\t//Definicion de la lista del resultado del query\n\t\t$this->captura('idContacto','int4');\n\t\t$this->captura('id_proveedor','int4');\n\t\t$this->captura('emailContacto','varchar');\n\t\t$this->captura('estado_reg','varchar');\n\t\t$this->captura('nombreContacto','varchar');\n\t\t$this->captura('id_usuario_ai','int4');\n\t\t$this->captura('fecha_reg','timestamp');\n\t\t$this->captura('usuario_ai','varchar');\n\t\t$this->captura('id_usuario_reg','int4');\n\t\t$this->captura('id_usuario_mod','int4');\n\t\t$this->captura('fecha_mod','timestamp');\n\t\t$this->captura('usr_reg','varchar');\n\t\t$this->captura('usr_mod','varchar');\n\t\t\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\t\t\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "public function JQGRIDCountAtencionClientePago(dto_detalle_cuenta $dtoDetalleCuenta, dto_cliente_cartera $dtoClienteCartera) {\n//\t\t\t\tFROM ca_pago WHERE iddetalle_cuenta=? \";\n//\t\t\t$sql=\" SELECT COUNT(*) AS 'COUNT' \n//\t\t\t\tFROM ca_pago WHERE iddetalle_cuenta=? AND estado = 1 \n//\t\t\t\tAND idcartera_pago = ( SELECT idcartera_pago FROM ca_cartera_pago WHERE idcartera=? ) \";\t\t\n\n $sql = \" SELECT COUNT(*) AS 'COUNT' \n\t\t\t\tFROM ca_pago WHERE codigo_operacion = ? AND estado = 1 \n\t\t\t\tAND idcartera = ? \";\n\n //$DetalleCuenta=$dtoDetalleCuenta->getId();\n $codigo_operacion = $dtoDetalleCuenta->getCodigoOperacion();\n /* * * */\n $cartera = $dtoClienteCartera->getIdCartera();\n /* * * */\n\n $factoryConnection = FactoryConnection::create('mysql');\n $connection = $factoryConnection->getConnection();\n\n //$connection->beginTransaction();\n\n $pr = $connection->prepare($sql);\n $pr->bindParam(1, $codigo_operacion);\n //$pr->bindParam(1,$DetalleCuenta);\n /* * * */\n $pr->bindParam(2, $cartera);\n /* * * */\n if ($pr->execute()) {\n //$connection->commit();\n return $pr->fetchAll(PDO::FETCH_ASSOC);\n } else {\n //$connection->rollBack();\n return array(array('COUNT' => 0));\n }\n }", "public function getCountContactadosCarga($carga){\n\t\t$carga = (int) $carga;\n\n\t\t$cont = $this->_db->query(\"SELECT count(id) as filas FROM contactos WHERE estado_llamada != 7 AND num_carga = {$carga}\");\n\t\t$filas = $cont->fetch();\n\t\t$row = $filas['filas'];\n\n\t\treturn $row;\n\t}", "public function getContacts() \n {\n return $this->contacts;\n }", "public function JQGRIDCountAtencionClienteNumeroTelefono(dto_cliente $dtoCliente, dto_cartera $dtoCartera) {\n\t\t\n\t\t$sql = \" SELECT COUNT(*) AS 'COUNT' FROM \n\t\t\t(\n\t\t\tSELECT idtelefono, numero, IFNULL(anexo,'') AS 'anexo', is_new\n\t\t\tFROM ca_telefono \n\t\t\tWHERE codigo_cliente = ? AND estado = 1 AND is_active = 1 \n\t\t\tGROUP BY numero\n\t\t\t) AS t1\n\t\t\t\";\n\n $codigo_cliente = $dtoCliente->getCodigo();\n $cartera = $dtoCartera->getId();\n\n $factoryConnection = FactoryConnection::create('mysql');\n $connection = $factoryConnection->getConnection();\n\n ////$connection->beginTransaction();\n\n $pr = $connection->prepare($sql);\n //$pr->bindParam(1, $cartera);\n $pr->bindParam(1, $codigo_cliente);\n //$pr->bindParam(3, $codigo_cliente);\n if ($pr->execute()) {\n ////$connection->commit();\n return $pr->fetchAll(PDO::FETCH_ASSOC);\n } else {\n ////$connection->rollBack();\n return array();\n }\n }" ]
[ "0.68150806", "0.6307879", "0.62609875", "0.605272", "0.60289776", "0.5951507", "0.59462166", "0.5798069", "0.5785717", "0.5739298", "0.5701155", "0.5635328", "0.5631372", "0.5630705", "0.56254154", "0.56132174", "0.56073016", "0.5586706", "0.55620044", "0.5559751", "0.55179757", "0.5510554", "0.55075043", "0.5503415", "0.55023426", "0.5490977", "0.54790217", "0.5474719", "0.54664636", "0.54631776" ]
0.8421191
0
$this>_db = new PDO('mysql:host=jbeunaicmcblogp4.mysql.db;dbname=jbeunaicmcblogp4;charset=utf8', 'jbeunaicmcblogp4', 'Forteroche72');
protected function dbConnect() { $this->_db = new PDO('mysql:host=localhost;dbname=blog;charset=utf8', 'root', ''); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function __construct(){\n $dsn = 'mysql:host=localhost;dbname=dwes;charset=utf8';\n $username='javier';\n $password ='Nohay2sin3';\n try{\n $this->conexion = new PDO( $dsn, $username, $password );//intenta iniciar la conexion\n }catch ( PDOException $e){//excepcion!\n die( \"¡Error!: \" . $e->getMessage() . \"<br/>\");//si falla, para la ejecucion\n }\n }", "function __construct() {\n $dsn = \"mysql:host=$this->host;dbname=$this->nombre_bd\";\n\n $opciones = array(\n PDO::ATTR_PERSISTENT => true,\n PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION\n );\n\n try {\n $this->dbh = new PDO ($dsn, $this->usuario, $this->password, $opciones);\n $this->dbh->exec('set names utf8');\n\n } catch (PDOException $e){\n $this->error = $e->getMessage();\n echo $this->error;\n }\n\n }", "function __construct(){\n $this->db = new PDO('mysql:host=localhost;'.'dbname=db_productos;charset=utf8', 'root', '');\n }", "public function __construct()\r\n{\r\n\t$dbHost = 'localhost';\r\n $dbName = 'cuestions';\r\n $dbUser = 'root';\r\n $dbPass = '';\r\n\r\n \t//try catch en caso de error de conexión\r\n\t\ttry {\r\n\t\t $this->pdo = new PDO(\"mysql:host=$dbHost;dbname=$dbName;charset=utf8\",\r\n\t\t $dbUser, $dbPass);\r\n\t\t $this->pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);\r\n\t\t } catch(Exception $e) {\r\n\t\t echo $e->getMessage();\r\n\t\t }\r\n}", "function __construct(){\n $this->db = new PDO('mysql:host=localhost;'.'dbname=db_products;charset=utf8', 'root', '');\n }", "function Database () {\n #$dsn = 'mysql:dbname=viol0011;localhost';\n $dsn = 'mysql:host=postvagen-224150.mysql.binero.se;dbname=224150-postvagen';\n $user = '224150_jl76916';\n $password = 'Kristevik1';\n try {\n $this->db=new PDO ($dsn,$user,$password);\n $this->db->exec('set names utf8');\n } catch (PDOException $e) {\n return FALSE;\n }\n }", "public function getDB(){\r\n return new PDO('mysql:host=mysql.info.unicaen.fr;port=3306;dbname=21706521_0;charset=utf8', '21706521', 'aoY9eingie5uuVei');\r\n }", "public function __construct() {\n\n $dsn = \"mysql:host=\". $this->servername. \";dbname=\". $this->dbname;\n//try & catch pour vérifier l'état de connexion\n try {\n $this->con = new PDO($dsn, $this->username, $this->password);\n $this->con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n echo \"Connexion réussie\";\n } catch(PDOException $e){\n echo \"Connexion échouée\". $e->getMessage();\n }\n}", "function __construct(){\n \ttry\n\t\t{\n\t\t\t$this->db = new PDO(\"mysql:dbname=iot_tesi;host=localhost;charset=utf8\", \"piero\", \"pierino87\",array(PDO::MYSQL_ATTR_INIT_COMMAND => \"SET NAMES 'utf8'\"));\n\t\t\t$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n\t\t\t\n\t\t} catch(PDOException $e) {\n\t\t\techo 'PDO ERROR: '.$e->getMessage();\n\t\t}\n }", "function __construct()\r\n\t{\r\n\t\t$this->connect = new PDO(\"mysql:servername=localhost;dbname=lab1;charset=utf8\", \"root\", \"\");\r\n\t}", "private function __construct(){\n try {\n self::$_instance = new PDO(\"mysql:host=www;dbname=GestionStage;charset=utf8\", \"AdminGS\", \"T12jaf6W\");\n }\n catch (PDOException $e) {\n echo $e->getMessage();//traitement d'une erreur de connexion\n }\n }", "public function __construct() \n { \n $this->conn = new PDO('mysql:host=mysql.labranet.jamk.fi;dbname=H8566;charset=utf8',\n\t\t\t\t\t\t\t'H8566','jznmOhKezTpPxioCt4Y2tK0R3v8LKFt6');\n $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);\n $this->conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);\n if ($this->conn == false) {\n die(\"Could not connect to database: \" . $this->conn->errorInfo());\n }\n \n }", "private function __construct()\n {\n $this->conn = new PDO(\"mysql:host={$this->host};\n dbname={$this->name}\", $this->user, $this->pass,\n [PDO::MYSQL_ATTR_INIT_COMMAND => \"SET NAMES 'utf8'\"]);\n }", "public function __construct(){\n // open database connection\n $connectionString = sprintf(\"mysql:host=%s;dbname=%s;charset=utf8\",\n BobDemo::DB_HOST,\n BobDemo::DB_NAME);\n \n try {\n $this->conn = new PDO($connectionString,\n BobDemo::DB_USER,\n BobDemo::DB_PASSWORD);\n //for prior PHP 5.3.6\n //$conn->exec(\"set names utf8\");\n \n } catch (PDOException $pe) {\n die($pe->getMessage());\n }\n }", "public function __construct() {\n $this->host = HOST;\n $this->user = USERDB;\n $this->password = PASSDB;\n $this->name = NAMEDB;\n $this->charset = CHARSETDB;\n\n try {\n $this->PDO = new \\PDO(\"mysql:host=\".$this->host.\";dbname=\".$this->name.\";charset=\".$this->charset, $this->user, $this->password);\n } catch(PDOException $e ){\n echo \"Connection failed:\".$e->getMessage();\n } \n }", "public function __construct()\n {\n $db = 'mysql:dbname=guitar_site; host=127.0.0.1; charset=utf8';\n $user = 'root';\n $pass = '';\n try \n {\n $this->DB = new PDO( $db, $user, $pass);\n $this->DB->setAttribute ( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );\n } \n catch (PDOException $e)\n {\n echo \"Connection to guitar_site failed!\";\n exit();\n }\n }", "public function __construct() {\n $this->db = new PDO('mysql:host=workspace;dbname=shortener', 'root', 'mypassword');\n }", "public function __construct(){\n\t\ttry {\n\n\t\t$dsn = \"mysql:dbname=BDF1403;host=127.0.0.1;port=8889\";\n\t\t$db_user = \"root\";\n\t\t$db_pass = \"root\";\n\n\t\t$this->db = new PDO($dsn, $db_user, $db_pass);\n\t\t\n\t\t\n\t\t} catch (PDOException $error) {\n\t\t\tvar_dump($error);\n\t\t}\n\t}", "function pdo_connect_mysql() {\r\n $DATABASE_HOST = 'localhost';\r\n $DATABASE_USER = 'admin';\r\n $DATABASE_PASS = 'lubega1992';\r\n $DATABASE_NAME = 'fremuug';\r\n try {\r\n \treturn new PDO('mysql:host=' . $DATABASE_HOST . ';dbname=' . $DATABASE_NAME . ';charset=utf8', $DATABASE_USER, $DATABASE_PASS);\r\n // \r\n } catch (PDOException $exception) {\r\n \t// If there is an error with the connection, stop the script and display the error.\r\n \texit('Failed to connect to database!');\r\n }\r\n\r\n \r\n}", "private function __construct() {\n $this->bdd = new PDO('mysql:host=localhost;dbname=minichat;charset=utf8', 'root', 'admin');\n }", "function ligar_bd() {\r\n\t\t\tglobal $host; global $dbname; global $user; global $pass;\r\n\r\n\t\t\ttry {\r\n\t\t\t\t$this->DBH = new PDO(\"mysql:host=$host;dbname=$dbname;charset=utf8\", $user, $pass);\r\n\t\t\t\t$this->DBH->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\r\n\t\t\t} catch(PDOException $e) {\r\n\t\t\t\techo $e->getMessage();\r\n\t\t\t}\r\n\t\t}", "public function __construct()\n {\n $host = \"localhost\";\n $dbname = \"neonledstore\";\n $username = \"root\";\n $password = \"\";\n\n try {\n $this->db = new PDO(\"mysql:host=$host;dbname=$dbname\", $username, $password);\n $this->db->setAttribute(PDO:: ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n } catch (PDOException $e) {\n echo \"Error:\".$e->getMessage();\n }\n }", "function db_connect()\r\n{\r\n $PDO = new PDO('mysql:host=' . FOZE_DB_HOST . ';dbname=' . FOZE_DB_NAME . ';charset=utf8', FOZE_DB_USER, FOZE_DB_PASS);\r\n \r\n return $PDO;\r\n}", "function getConn(){\n return new PDO('mysql:host=localhost;dbname=rest','root','root',array(PDO::MYSQL_ATTR_INIT_COMMAND => \"SET NAMES utf8\"));\n\n}", "private function __construct(){\n try{\n $this->_pdo=new PDO('mysql:host='.Config::get('mysql/host').';dbname='.Config::get('mysql/db'),Config::get('mysql/username'),Config::get('mysql/password'));\n \n }\n catch(PDOException $e){\n //set the error\n die($e->getMessage());\n }\n}", "public function __construct(){\n\t// Berfungsi untuk menghubungkan PHP dengan Basis Data, berisi informasi (nama_basis:host=nama_server_basis_data;dbname=nama_basis_data','nama_pengguna','kata_sandi')\n\t$this->db = new PDO('mysql:host=localhost;dbname=psikopat','root','root');\n\t}", "function pdo_connect_mysql(){\n $dbhost = 'localhost';\n $dbuser = 'root'; \n $dbpassword = ''; \n $dbname = 'vykhyotm_forum';\n\n try{\n return new PDO('mysql:host='.$dbhost.';dbname=' . $dbname . ';charset=utf8', $dbuser, $dbpassword);\n } catch (PDOException $exception){\n //if error to connect\n die ('Failed to connect to database');\n }\n}", "function __construct() {\n $this->servername = 'localhost'; // 127.0.0.1\n $this->database = 'flowerpower';\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 // set the PDO error mode to exception\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 }", "function db_connect(){\r\n $db_uid = 'root';\r\n $db_pwd = '';\r\n $connString = 'mysql:host=localhost;dbname=flea;charset=utf8';\r\n\r\n $pdo = new PDO($connString, $db_uid, $db_pwd);\r\n\r\n $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\r\n return $pdo;\r\n}", "public function __construct()\n {\n $host = 'localhost';\n $user = 'root';\n $dbname = 'blumenshop';\n\n //set DSN Data source name\n $dsn = 'mysql:host=' . $host . ';dbname=' . $dbname;\n //create PDO instance\n $this->database = new PDO($dsn, $user);\n\n }" ]
[ "0.8096534", "0.8050926", "0.8044243", "0.8016189", "0.79868466", "0.7845084", "0.7844728", "0.78338814", "0.78103167", "0.78087324", "0.7743471", "0.7701528", "0.7680847", "0.76754385", "0.7668214", "0.7667691", "0.76545733", "0.7648943", "0.7643166", "0.7624551", "0.76179093", "0.7564854", "0.7534768", "0.7515948", "0.7513592", "0.7492489", "0.747618", "0.7466859", "0.74649096", "0.7435107" ]
0.81515557
0
Lists all Reports models.
public function actionIndex() { $searchModel = new ReportsSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getAllReports()\n\t{\n\t\thome::displayHeader();\n\n\t\t$allReports = self::model('Report')->orderBy('Report_Id', 'desc')->get(); \n\t\t//->orderBy('listingID', 'desc'); // Retrieves all reports in an array\n\t\tself::view('reports/reportList', ['reports' => $allReports]);\n\t}", "public function getAllReports()\n {\n return $this->getEntityManager()->createQuery('SELECT r FROM addventure\\Report r')->getResult();\n }", "public function actionIndex()\n {\n\t\t$searchModel = new ReportsSearch();\n\t\t$params = $this->saveFilter('reports', Yii::$app->request->queryParams);\n $dataProvider = $searchModel->search($params);\n\n return $this->render('index', [\n 'dataProvider' => $dataProvider,\n\t\t\t'searchModel' => $searchModel,\n\t\t\t'teamSerach' => Team::getTeams(),\n\t\t\t'typeSearch' => CabinetHdbkReportType::getTypes(),\n ]);\n }", "public function index ()\n {\n $reports = Report::simplePaginate (10);\n\n return view ('admin.reportList')\n ->with ('reports' , $reports);\n\n\n }", "public function getReports();", "public function actionIndex()\n {\n $searchModel = new ReportSearch();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n\n return $this->render('index', [\n 'searchModel' => $searchModel,\n 'dataProvider' => $dataProvider,\n ]);\n }", "public function index()\n {\n $reports = Report::latest()->paginate();\n \n return ReportResource::collection($reports);\n\n }", "public function actionIndex()\n {\n $searchModel = new ReportsSearch();\n $user_id__fio = ArrayHelper::map(ArrayHelper::toArray($searchModel->search([])->getModels(), [\n 'common\\models\\Reports' => [\n 'user_card_id',\n 'fio' => function ($report) {\n return Reports::getFio($report);\n }\n ],\n ]),'user_card_id', 'fio');\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n\n return $this->render('index');\n }", "public function reports()\n\t{\n\t\treturn $this->hasMany('App\\Report');\n\t}", "public function getReports()\n {\n return $this->hasMany(Report::className(), ['doctor_id' => 'doctor_id']);\n }", "public function index()\n {\n $reports = Report::paginate(20);\n\n return view('admin.reports.index', compact('reports'));\n }", "public static function get_all_reports()\n {\n\t\t$user = Auth::instance()->get_user();\n return DB::select(self::MAIN_TABLE.'.id',self::MAIN_TABLE.'.name',self::MAIN_TABLE.'.category',self::MAIN_TABLE.'.dashboard',self::MAIN_TABLE.'.date_created',self::MAIN_TABLE.'.date_modified',array(self::CATEGORIES_TABLE.'.name','category_name'),array(self::FAVORITES_TABLE.'.user_id','is_favorite'))\n\t\t\t->from(self::MAIN_TABLE)\n\t\t\t->join(self::CATEGORIES_TABLE,'LEFT')->on(self::CATEGORIES_TABLE.'.id','=',self::MAIN_TABLE.'.category')\n\t\t\t->join(self::FAVORITES_TABLE,'LEFT')->on(self::FAVORITES_TABLE.'.report_id', '=', self::MAIN_TABLE.'.id')->on(self::FAVORITES_TABLE.'.user_id', '=', DB::expr($user['id']))\n\t\t\t->where(self::MAIN_TABLE.'.delete','=',0)\n\t\t\t->order_by(self::MAIN_TABLE.'.date_modified','DESC')\n\t\t\t->execute()->as_array();\n }", "public function getAllReports()\n {\n return $this->console['reports'];\n }", "public function reports()\n {\n return $this->hasMany('App\\Report');\n }", "public function index()\n {\n $reports = Report::all();\n\n return view('reports.index',['reports'=>$reports]);\n }", "public function index()\n {\n $reports = Report::get()->map(function($report){\n $report->computer;\n return $report;\n });\n\n return $reports;\n }", "public function getReports()\n {\n return $this->reportRepo->getReport();\n }", "public function index()\n {\n $reports = DB::table('reports')\n ->paginate(10);\n return $this->respondWithPagination($reports, $this->reportTransformer->transformCollection($reports->all()));\n\n }", "public function actionIndex()\n {\n $searchModel = new ReportTypeSearch();\n $dataProvider = $searchModel->search(Yii::$app->request->queryParams);\n\n return $this->render('index', [\n 'searchModel' => $searchModel,\n 'dataProvider' => $dataProvider,\n ]);\n }", "public function reports()\n {\n $reports = Reports::join('users', 'users.id', '=', 'reports.assigned_doctor_id')->orderBy('reports.id', 'DESC')->paginate(5);\n\n $data =\n [\n 'reports' => $reports\n ];\n\n return view('frontend.management.all-reports', $data);\n }", "public function reports()\n {\n return $this->morphMany(Report::class, 'reported');\n }", "public function index()\n {\n $reports = Report::orderBy('reported_at')->paginate(10);\n return view('report.index', ['reports' => $reports]);\n }", "public function indexReports()\n {\n $shop = $this->user->shop;\n $branches = $shop->branches;\n $statuses = Status::all();\n $lines = Line::where('shop_id', NULL)->get();\n $categories = Category::where('shop_id', NULL)->get();\n $shop = Auth::user()->shop;\n\n return view('product.Reports.index', compact('shop', 'branches', 'statuses', 'lines', 'categories'));\n }", "public function allReports()\n {\n return $this->hasMany('App\\TopicTaskRelationship', 'task_id')->where('listing_id', '!=', 0)->where('type', 2)->where('company_id', $this->company_id)->groupBy('listing_id');\n }", "public function index()\n {\n $this->authorize('view', ReportsController::class);\n\n return view('finance.reports.index')->with(self::getReportAttributes());\n }", "public function report()\n {\n return $this->dataRepository->all();\n }", "public function reports()\n {\n return $this->hasMany(Report::class, 'user_id');\n }", "public function getRelatedReports()\n {\n return array();\n }", "public function report()\n {\n return $this->hasMany('App\\Report');\n }", "function get_all_report()\n {\n $this->db->order_by('id', 'desc');\n return $this->db->get('report')->result_array();\n }" ]
[ "0.77910537", "0.73745364", "0.72126406", "0.69724315", "0.69715154", "0.69235194", "0.69213414", "0.67683345", "0.6740379", "0.6707356", "0.67056996", "0.66591424", "0.66516846", "0.6645072", "0.66311276", "0.6631069", "0.66006714", "0.6595861", "0.6425786", "0.6368757", "0.6359682", "0.63496196", "0.63301116", "0.6255796", "0.6235565", "0.6213756", "0.6198581", "0.61768055", "0.6170848", "0.61527455" ]
0.7380417
1
Finds the Reports model based on its primary key value. If the model is not found, a 404 HTTP exception will be thrown.
protected function findModel($id) { if (($model = Reports::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function findModel($id)\n {\n if (($model = Reports::findOne($id)) !== null) {\n return $model;\n }\n\n throw new NotFoundHttpException('The requested page does not exist.');\n }", "protected function findModel($id)\n {\n if (($model = Report::findOne($id)) !== null) {\n return $model;\n }\n\n throw new NotFoundHttpException(Yii::t('app', 'The requested page does not exist.'));\n }", "protected function findModel($id)\n {\n if (($model = ReportType::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "public function loadModel($id)\n\t{\n\t\t$model=Reportepesca::model()->findByPk($id);\n\t\tif($model===null)\n\t\t\tthrow new CHttpException(404,'El enlace o direccion solicitado no existe');\n\t\treturn $model;\n\t}", "public function loadModel($id)\n\t{\n\t\t$model=RzReport::model()->findByPk($id);\n\t\tif($model===null)\n\t\t\tthrow new CHttpException(404,'The requested page does not exist.');\n\t\treturn $model;\n\t}", "public function loadModel($id)\n\t{\n\t\t$model=DailyReport::model()->findByPk($id);\n\t\tif($model===null)\n\t\t\tthrow new CHttpException(404,'The requested page does not exist.');\n\t\treturn $model;\n\t}", "public function loadModel($id)\n{\n$model=FindingReport::model()->findByPk($id);\nif($model===null)\nthrow new CHttpException(404,'The requested page does not exist.');\nreturn $model;\n}", "protected function findModel(int $report_id, int $question_id): LeadAnswer {\n\t\tif (($model = LeadAnswer::findOne(['report_id' => $report_id, 'question_id' => $question_id])) !== null) {\n\t\t\treturn $model;\n\t\t}\n\n\t\tthrow new NotFoundHttpException(Yii::t('lead', 'The requested page does not exist.'));\n\t}", "protected function findModel($item_id)\n\t{\n\t\tif (($model = SapItem::findOne($item_id)) !== null) {\n\t\t\treturn $model;\n\t\t} else {\n\t\t\tthrow new HttpException(404, 'The requested page does not exist.');\n\t\t}\n\t}", "protected function findModel($id)\n {\n if (($model = Blog::findOne($id)) !== null) {\n return $model;\n } else {\n Log::record(Log::DOCUMENTS, Log::WARNING, 'The requested page does not exist', 404, true);\n }\n }", "protected function findModel($id)\n {\n if (($model = LicensesDocumentsPage::findOne($id)) !== null) {\n return $model;\n }\n\n throw new NotFoundHttpException('The requested page does not exist.');\n }", "protected function findModel($id)\n {\n $this->layout='main';\n if (($model = OmDocuments::findOne($id)) !== null) {\n return $model;\n }\n throw new NotFoundHttpException('The requested page does not exist.');\n }", "protected function findModel($id)\n\t{\n\t\tif (($model = Designer::findOne($id)) !== null) {\n\t\t\treturn $model;\n\t\t} else {\n\t\t\tthrow new NotFoundHttpException('The requested page does not exist.');\n\t\t}\n\t}", "public function find($key): ?Model;", "protected function findModel($id) {\n\t\tif (($model = ServiceMapping::findOne($id)) !== null) {\n\t\t\treturn $model;\n\t\t}\n\n\t\tthrow new NotFoundHttpException('The requested page does not exist.');\n\t}", "protected function findModel($id)\n {\n if (($model = AlertMaster::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "private function findModel($id)\n {\n $model=Post::model()->findByPk($id);\n if($model===null)\n throw new CHttpException(404,'The requested page does not exist.');\n return $model;\n }", "protected function findModel($id)\n {\n if (($model = Settingcatalogdetail::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "protected function findModel($id)\n {\n \t\n \t$model = SoSheet::find()->alias(\"so\")\n \t->joinWith(\"vip vip\")\n \t->joinWith(\"city city\")\n \t->joinWith(\"country country\")\n \t->joinWith(\"deliveryStatus deliveryStatus\")\n \t->joinWith(\"district district\")\n \t->joinWith(\"invoiceType invoiceType\")\n \t->joinWith(\"orderStatus orderStatus\")\n \t->joinWith(\"payStatus payStatus\")\n \t->joinWith(\"province province\")\n \t->joinWith(\"deliveryType deliveryType\")\n \t->joinWith(\"payType payType\")\n \t->joinWith(\"pickPoint pickPoint\")\n \t->joinWith(\"quotation quotation\")\n \t->where(['so.id' => $id])->one();\n \t\n \tif($model){\n return $model;\n } else {\n throw new NotFoundHttpException(Yii::t('app', 'The requested page does not exist.'));\n }\n }", "public function find($id)\n {\n $rel = $this->currentOrClone();\n $modelClass = $this->modelClass;\n $tableName = $modelClass::tableName();\n $first = $rel->where([$tableName . '.' . $modelClass::primaryKey() => $id])->first();\n if (!$first) {\n throw new RecordNotFoundException(sprintf(\n \"Couldn't find %s with %s=%s\",\n $this->modelClass,\n $modelClass::primaryKey(),\n $id\n ));\n }\n return $first;\n }", "protected function findModel($id)\n {\n if (($model = ServicerDivideRecord::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "protected function findModel($id)\n\t{\n\t\tif (($model = Office::findOne($id)) !== null) {\n\t\t\treturn $model;\n\t\t} else {\n\t\t\tthrow new NotFoundHttpException('The requested page does not exist.');\n\t\t}\n\t}", "protected function findModel($id)\n\t{\n\t\tif (($model = TicketComment::findOne($id)) !== null) {\n\t\t\treturn $model;\n\t\t} else {\n\t\t\tthrow new HttpException(404, 'The requested page does not exist.');\n\t\t}\n\t}", "protected function findModel($id) {\n\t\tif (($model = Beaches::findOne ( $id )) !== null) {\n\t\t\treturn $model;\n\t\t} else {\n\t\t\tthrow new NotFoundHttpException ( 'The requested page does not exist.' );\n\t\t}\n\t}", "protected function findModel($id)\n {\n if (($model = Prodrec::findOne($id)) !== null) {\n return $model;\n }\n\n throw new NotFoundHttpException(Yii::t('app', 'The requested page does not exist.'));\n }", "protected function findModel($id)\n {\n if (($model = HealthItems::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "protected function findModel($id) {\n if (($model = PdmP52::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "public function loadModel($id) {\r\n $model = Documents::model()->findByPk($id);\r\n if ($model === null)\r\n throw new CHttpException(404, 'The requested page does not exist.');\r\n return $model;\r\n }", "protected function findModel($id) {\n if (($model = ProductAdjustmentMaster::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }", "protected function findModel($id)\n {\n if (($model = Sales::findOne($id)) !== null) {\n return $model;\n } else {\n throw new NotFoundHttpException('The requested page does not exist.');\n }\n }" ]
[ "0.6978534", "0.6795489", "0.67373055", "0.65123117", "0.6463043", "0.63183886", "0.6310737", "0.6251715", "0.6211749", "0.61849827", "0.6168839", "0.60786486", "0.60751706", "0.60726637", "0.6057943", "0.602195", "0.6013487", "0.59931517", "0.59920895", "0.59900004", "0.5987275", "0.59671944", "0.59668756", "0.5951326", "0.5937773", "0.5935247", "0.5929553", "0.59264725", "0.59129876", "0.5912094" ]
0.7074806
1
The settings which should be available on the field in the form editor.
function get_form_editor_field_settings() { return array( 'conditional_logic_field_setting', 'prepopulate_field_setting', 'error_message_setting', 'label_setting', 'label_placement_setting', 'admin_label_setting', 'rules_setting', 'visibility_setting', 'description_setting', 'css_class_setting', ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function settings()\n\t{\n\t\treturn array(\n\t\t\t\n\t\t);\n\t}", "public function settings()\n\t{\n\t\treturn array(\n\t\t\t\n\t\t);\n\t}", "public function settings()\n {\n Event::listen('backend.form.extendFields', function ($widget) {\n if (!$widget->model instanceof Settings) {\n return;\n }\n\n $widget->addFields([\n 'backend_enabled' => [\n 'label' => 'Enable Backend Auto-Logout',\n 'comment' => 'This option will auto-logout admins who leave the dashboard entirely.',\n 'type' => 'checkbox',\n 'span' => 'left',\n 'default' => false,\n ],\n 'backend_allowed_inactivity' => [\n 'label' => 'Admins Mins of inactivity',\n 'comment' => 'The number of minutes of inactivity allowed before the admin gets logged out. Make it zero if you don\\'nt want to logout the user after amount of inactivity time.',\n 'span' => 'right',\n 'default' => 0,\n 'trigger' => [\n 'action' => 'show',\n 'field' => 'backend_enabled',\n 'condition' => 'checked'\n ]\n ],\n 'backend_popup_custom_class' => [\n 'label' => 'Backend Popup Custom Class',\n 'comment' => 'If you want to add a custom class for the warning modal in backend dashboard.',\n 'span' => 'right',\n 'default' => 0,\n 'trigger' => [\n 'action' => 'show',\n 'field' => 'backend_enabled',\n 'condition' => 'checked'\n ]\n ],\n ]);\n });\n }", "protected function field_settings_for_type() {\n\t\t$settings = array(\n\t\t\t'description' => false,\n\t\t\t'default' => false,\n\t\t\t'clear_on_focus' => false, // Don't use the regular placeholder option.\n\t\t\t'logic' => true,\n\t\t\t'visibility' => true,\n\t\t);\n\n\t\treturn $settings;\n\t}", "public function settings() {\n\t\treturn array();\n\t}", "function getSettings()\n\t{\n\t\t$controller = $this->getController();\n\t\t$request = $controller->getRequest();\n\t\t$legend = LAN_UI_PREF_LABEL;\n\t\t$forms = $models = array();\n\t\t$forms[] = array(\n\t\t\t\t'id' => $this->getElementId(),\n\t\t\t\t//'url' => e_SELF,\n\t\t\t\t//'query' => 'self', or custom GET query, self is default\n\t\t\t\t'tabs' => false, // TODO - NOT IMPLEMENTED YET - enable tabs (only if fieldset count is > 1)\n\t\t\t\t'fieldsets' => array(\n\t\t\t\t\t'settings' => array(\n\t\t\t\t\t\t'legend' => $legend,\n\t\t\t\t\t\t'fields' => $controller->getPrefs(), //see e_admin_ui::$prefs\n\t\t\t\t\t\t'after_submit_options' => false,\n\t\t\t\t\t\t'after_submit_default' => false, // or true for default redirect options\n\t\t\t\t\t\t'triggers' => array('save' => array(LAN_SAVE, 'update')), // standard create/update-cancel triggers\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t);\n\t\t$models[] = $controller->getConfig();\n\n\t\treturn $this->renderCreateForm($forms, $models, e_AJAX_REQUEST);\n\t}", "function bbp_admin_get_settings_fields()\n{\n}", "public function getSettingsFields() {\n return static::$settingsFields;\n }", "protected function getFieldSettings() {\n return $this->fieldDefinition->getSettings();\n }", "public function settings(){\n $form = new Form(array(\n 'id' => 'h-page-editor-settings-form',\n 'inputs' => array(\n new TextInput(array(\n 'name' => 'url-prefix',\n 'required' => true,\n 'default' => Option::get($this->_plugin . '.url-prefix'),\n 'label' => Lang::get($this->_plugin . '.settings-url-prefix-label'),\n 'pattern' => '/^\\w[\\w\\/\\-]+\\w$/'\n )),\n\n new SubmitInput(array(\n 'name' => 'valid',\n 'value' => Lang::get('main.valid-button'),\n 'nl' => true\n )),\n ),\n 'onsuccess' => 'app.dialog(\"close\")'\n ));\n\n if(!$form->submitted()) {\n return Dialogbox::make(array(\n 'title' => Lang::get($this->_plugin . '.settings-title'),\n 'icon' => 'cogs',\n 'page' => $form\n ));\n }\n else {\n if($form->check()) {\n Option::set($this->_plugin . '.url-prefix', $form->getData('url-prefix'));\n\n return $form->response(Form::STATUS_SUCCESS);\n }\n }\n }", "public function plugin_settings_fields() {\n\n\t\t$settings = array(\n\t\t\tarray(\n\t\t\t\t'title' => esc_html__( 'Download Gate Settings', 'lc-gforms_dg' ),\n\t\t\t\t'fields' => array(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'name' => 'lc_gforms_dg_settings_download_form',\n\t\t\t\t\t\t'tooltip' => esc_html__( 'The form a visitor will need to complete prior to accessing each downloadable file', 'lc-gforms_dg' ),\n\t\t\t\t\t\t'label' => esc_html__( 'Download Access Form', 'lc-gforms_dg' ),\n\t\t\t\t\t\t'type' => 'select',\n\t\t\t\t\t\t'choices' => $this->forms_select_choices(),\n\t\t\t\t\t\t'feedback_callback' => array( $this, 'is_valid_setting' ),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\n\t\treturn apply_filters( 'lc_gforms_dg_settings', $settings );\n\n\t}", "public function get_settings() {\n\t\t$settings = parent::get_settings();\n\n\t\t$settings[] = 'adyen';\n\n\t\treturn $settings;\n\t}", "public function settings()\n {\n return $this->settings;\n }", "function admin_settings() {\n\t\t\t\twoocommerce_admin_fields( $this->settings );\n\t\t\t}", "public function getSettingsFields()\n {\n return static::$hSettingsFields;\n }", "public function settings() {\n\t\trequire_once FUSION_BUILDER_PLUGIN_DIR . 'inc/admin-screens/settings.php';\n\t}", "public function settings() {\n\t\trequire_once FUSION_BUILDER_PLUGIN_DIR . 'inc/admin-screens/settings.php';\n\t}", "public function get_view_settings() {\r\n\t\treturn array(\r\n\t\t\t'type' => 'text',\r\n\t\t\t'display_ajax' => false,\r\n\t\t);\r\n\t}", "function settings() {\n\t\t$this->validate();\n\t\t$this->setupTemplate(true);\n\n\t\timport('classes.admin.form.SiteSettingsForm');\n\n\t\t$settingsForm = new SiteSettingsForm();\n\t\tif ($settingsForm->isLocaleResubmit()) {\n\t\t\t$settingsForm->readInputData();\n\t\t} else {\n\t\t\t$settingsForm->initData();\n\t\t}\n\t\t$settingsForm->display();\n\t}", "function getSettings()\n {\n return $this->settings;\n }", "protected function getConfigTemplateFieldSettings()\n {\n $field = $this->createTemplateFieldObject();\n\n return array(\n 'form' => array(\n 'legend' => array(\n 'title' => ((int)Tools::getValue('id_field')\n ? $this->l('Edit field')\n : $this->l('Add field')),\n 'icon' => 'icon-cogs',\n ),\n 'input' => array(\n array(\n 'col' => 9,\n 'label' => $this->l('Type:'),\n 'type' => 'select',\n 'name' => 'type',\n 'options' => array(\n 'query' => $this->getAvailableFieldTypes($field->type),\n 'id' => 'id_type',\n 'name' => 'name'\n )\n ),\n array(\n 'type' => 'switch',\n 'label' => $this->l('Required'),\n 'is_bool' => true,\n 'class' => 'required',\n 'name' => 'required',\n 'values' => array(\n array(\n 'id' => 'active_on',\n 'value' => true,\n 'label' => $this->l('Enabled')\n ),\n array(\n 'id' => 'active_off',\n 'value' => false,\n 'label' => $this->l('Disabled')\n )\n ),\n ),\n array(\n 'col' => 3,\n 'class' => 'specific_class',\n 'label' => $this->l('Specific class'),\n 'type' => 'text',\n 'name' => 'specific_class',\n 'lang' => false,\n ),\n array(\n 'col' => 9,\n 'label' => $this->l('Name'),\n 'type' => 'text',\n 'name' => 'field_name',\n 'lang' => true,\n 'class' => 'fields_name',\n ),\n array(\n 'col' => 9,\n 'label' => $this->l('Description'),\n 'type' => 'textarea',\n 'name' => 'field_description',\n 'autoload_rte' => true,\n 'lang' => true,\n 'class' => 'field_description'\n ),\n array(\n 'col' => 2,\n 'type' => 'text',\n 'name' => 'id_field',\n 'class' => 'hidden'\n ),\n ),\n 'submit' => array(\n 'title' => $this->l('Save'),\n 'type' => 'submit',\n 'name' => 'savefield'\n ),\n )\n );\n }", "public function getSettings(){\n return $this->settings;\n }", "function settings()\n\t{\n\t\treturn \\Yii::$app->get('settings');\n\t}", "function bmg_forms_get_options_settings() {\n\t\n\t// setup our return data\n\t$settings = array( \n\t\t'group'=>'bmg_forms_settings',\n\t\t'settings'=>array(\n\t\t\t'bmg_forms_admin_email',\t\t\n\t\t\t'bmg_table_row_limit',\n\t\t),\n\t);\n\t\n\t// return option data\n\treturn $settings;\n\t\n}", "public function plugin_settings_fields() {\n\t\t\n\t\treturn array(\n\t\t\tarray(\n\t\t\t\t'title' => '',\n\t\t\t\t'description' => $this->plugin_settings_description(),\n\t\t\t\t'fields' => array(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'name' => 'api_key',\n\t\t\t\t\t\t'label' => __( 'API Key', 'gravityformscleverreach' ),\n\t\t\t\t\t\t'type' => 'text',\n\t\t\t\t\t\t'class' => 'medium',\n\t\t\t\t\t\t'feedback_callback' => array( $this, 'initialize_api' )\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'type' => 'save',\n\t\t\t\t\t\t'messages' => array(\n\t\t\t\t\t\t\t'success' => __( 'CleverReach settings have been updated.', 'gravityformscleverreach' )\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\n\t}", "public function getSettings(){\r\n\t\treturn($this->settings);\r\n\t}", "public function formDefaultSettings() {\n return array(\n 'ajax_enabled' => variable_get('ajax_enabled'),\n 'notifications' => variable_get('notifications_enabled'),\n );\n }", "public function settings()\n {\n if (!$this->settings) {\n $this->settings = $this->standardSettings();\n }\n return $this->settings;\n }", "public static function getSettings()\n {\n return [\n 'login' => 'admin',\n 'legalTemplates' => ['skyscraper'],\n 'legalFields' => ['title'],\n ];\n }", "public function get_settings();" ]
[ "0.7433977", "0.7433977", "0.7423275", "0.73958164", "0.72343236", "0.720124", "0.71866786", "0.7153015", "0.71264535", "0.70801055", "0.7057305", "0.70416176", "0.70332235", "0.7016901", "0.7015645", "0.7011887", "0.7011887", "0.6948697", "0.69223267", "0.69092685", "0.68990546", "0.68647647", "0.6851761", "0.684915", "0.6837062", "0.6817591", "0.6809211", "0.680349", "0.678645", "0.6780304" ]
0.84204954
0
Checks if the passed request is automaticaly routable. Routable in this context is a request that can map to a controller/action combo based on the Request URI.
public function parseAutoRoutable(\IRequest $request) { $route = preg_replace("@^/@", "", str_replace(WEB_ROOT, "", $request->getRequestPath())); if(!is_string($route)) { return FALSE; } $parts = $this->parseRoute($route); if(!$parts[0] || !$parts[1]) { return FALSE; } try { $controller = $this->findControllerByName($parts[0]); $action = $controller->findActionByName($parts[1]); if($action instanceof IAction && $controller instanceof IController) { return $controller->getId() . "/" . $action->getId(); } } catch(Exception $e) { } return FALSE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isResponsibleFor(Request $request) {\r\n\r\n // store the current request\r\n $this->_request = $request;\r\n\r\n // check if the current URL (first URL param) equals this page's URL\r\n if (!is_null($this->_request) && strcasecmp($this->_request->getUrlParam(0), $this->_url) == 0) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }", "public function shouldDispatch(Request $request)\n {\n if($this->getMethod() === $request->method){\n\n if( preg_match_all( $this->getRouteRegExp(), $request->path ) )\n {\n return true;\n }\n }\n return false;\n }", "function route($request)\n {\n if (!$this->matches($request->getRequestUri())) {\n return false;\n }\n\n $request->setModuleName($this->getModuleName());\n $request->setControllerName($this->getControllerName());\n $request->setActionName($this->getActionName());\n $request->setParam(array_merge($_GET, $this->params));\n $request->setRouted();\n\n return true;\n }", "public function execute(Request $request): bool\n {\n /** @var Rout $rout */\n foreach ($this->routs as $rout) {\n if ($rout->type === $request->type && $rout->url === $request->url) {\n\n $calss = $rout->controller;\n try {\n (new $calss())->{$rout->method}($request);\n } catch (\\Exception $e){\n header('HTTP/1.1 405 Method Not Allowed', true, 405);\n }\n\n return true;\n }\n }\n\n return false;\n }", "public function supports(Request $request)\n {\n if ($request->get('_route') != $this->checkRoute)\n {\n return false;\n }\n return true;\n }", "public function canHandle(Request $request): bool\n {\n return true;\n }", "public static function availableForNavigation(Request $request)\n {\n return false;\n }", "public static function availableForNavigation(Request $request)\n {\n return false;\n }", "public function match(Request &$request)\n {\n if(preg_match((string) $this, $request->getURI(), $matches)) {\n // Add any already set routings to the request\n if(count($this->_routings)) {\n $request->setRoutings($this->_routings);\n }\n\n foreach($matches as $key => $value) {\n if(in_array($key, static::$_defaultRoutings, true)) {\n $request->setRoutings([$key => $value]);\n } elseif(is_string($key)) {\n $request->setParams([$key => $value]);\n }\n }\n\n return true;\n }\n\n return false;\n }", "protected function shouldNotPassThrough($request)\n {\n $user = $request->user();\n $router = $request->route()->getAction();\n if (isset($router['as'])) {\n $permissions = $user->apiPermissions;\n $status = $permissions\n ->contains(function ($permission) use ($router) {\n return $permission->router === $router['as'] && !in_array($router['as'], config('authapi.permission.excepts'));\n });\n unset($user->apiPermissions);\n return $status;\n } else {\n return false;\n }\n\n }", "private function isRequestValid() {\n if (!class_exists($this->controller)) {\n // Redirect to 404 page.\n $this->error = 'The controller specified - ' . $this->controller . ' does not exist.';\n return false;\n }\n $this->objView = new View($this);\n $this->objController = new $this->controller($this, $this->objView);\n $action = $this->action;\n if (!method_exists($this->objController, $action)) {\n // Redirect to 405. Method does not exist.\n $this->error = 'The action specified - ' . $action . ' does not exist.';\n return false;\n }\n return true;\n }", "public static function availableForNavigation(Request $request)\n {\n return $request->user()->can('create', static::newModel());\n }", "public function matches(Request $request) {\n\t\ttry {\n\t\t\tif ($request instanceof InternalRequest) return true;\n\t\t\tif (!isset($this->requestDescriptor)) return false;\n\t\t\t$this->requestDescriptor->compare($request);\n\t\t} catch (Exception $e) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public function checkACL(Zend_Controller_Request_Abstract $request) {\n // check if a user is logged in and has a valid role,\n // otherwise, assign them the default role(guest)\n if ($this->auth->hasIdentity()) {\n $role = $this->auth->getIdentity()->rolename;\n } else {\n $role = $this->_defaultRole;\n }\n\n if (!$this->acl->hasRole($role))\n $role = $this->_defaultRole;\n\n // the ACL resource is the requested controller name\n $resource = $request->controller;\n // the ACL privilege is the requested action name\n $privilege = $request->action;\n\n // if we haven't explicitly added the resource, check\n // the default global permissions\n if (!$this->acl->has($resource))\n $resource = null;\n\n // access denied - reroute the request to the default action handler\n if (!$this->acl->isAllowed($role, $resource, $privilege)){\n $request->setControllerName(($this->_authController['controller']));\n $request->setActionName($this->_authController['action']);\n $request->setModuleName($this->_authController['module']);\n }\n }", "public function hasAccessToCurrentRoute()\n {\n return $this->hasAccess($this->router->current()->getName());\n }", "public function isRequest(){ \n\t\treturn $this->isPost() || $this->isGet(); \n\t}", "public static function authorizedToViewAny(Request $request)\n {\n if (! static::authorizable()) {\n return true;\n }\n\n return static::policyMethodExistsForClass(static::newModel(), 'viewAny')\n ? Gate::check('viewAny', get_class(static::newModel()))\n : (new static)->authorizedWithoutGateTo($request, 'viewAny');\n }", "public function allows($action, $user, $request)\n {\n $parentResult = parent::allows($action, $user, $request);\n\n if (is_null($parentResult))\n return null;\n else\n return ( $parentResult && $this->matchScope($user) );\n }", "function is_request()\r\n\t{\r\n\t\treturn $this->is_request;\r\n\t}", "public function checkAccess()\n\t{\n\t\t$request = $this->getRequest();\n\t\t$currentAction = $request->getAction();\n\n\t\t// access based on mode setting - general controller access\n\t\tif(!empty($this->disallow) && in_array($currentAction, $this->disallow))\n\t\t{\n\t\t\t$request->setAction('e403');\n\t\t\te107::getMessage()->addError('You don\\'t have permissions to view this page.')\n\t\t\t\t->addDebug('Controller action disallowed restriction triggered.');\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t// access based on $access settings - access per action\n\t\tif(!empty($this->allow) && !in_array($currentAction, $this->allow))\n\t\t{\n\t\t\t$request->setAction('e403');\n\t\t\te107::getMessage()->addError('You don\\'t have permissions to view this page.')\n\t\t\t\t->addDebug('Controller action not in allowed list restriction triggered.');\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public abstract function supportsRequest(Request $request): bool;", "private function permissionrequestCheck($request){\n $permission = CustomAuth::getRoutePermission($request);\n $rolelist = CustomAuth::getRolesUser();\n \n if(!in_array($permission,$this->permissionAllowed) && count(array_intersect($rolelist,$this->roleallowed))==0){ \n \n $haspermission = CustomAuth::hasPermission($permission); \n if(!$haspermission){ \n return false;\n }\n }\n return true;\n }", "public function matches(Request $request)\n {\n if ($request->getMethod() == $this->method && $this->path->matches($request)) {\n return true;\n } else {\n return false;\n }\n }", "public function hasBaseRequest()\n {\n return $this->get(self::BASEREQUEST) !== null;\n }", "public static function isRouteAble()\n {\n return true;\n }", "public function hasRequest()\n {\n return $this->request ? true : false;\n }", "private function validate( Request $request ) {\n return !($request->parameter('controller') === null) || !($request->parameter('action') === null);\n }", "public function is_internal()\n {\n return Request::instance() !== $this->request;\n }", "public function checkPermission(\\App\\Request $request)\n\t{\n\t\t$mode = $request->getMode();\n\t\tif (\n\t\t\t!Users_Privileges_Model::getCurrentUserPrivilegesModel()->hasModulePermission($request->getModule()) ||\n\t\t\t($mode === 'addMessage' && !$request->has('room_id')) ||\n\t\t\t($mode === 'addRoom' && !$request->has('record')) ||\n\t\t\t($mode === 'switchRoom' && !$request->has('room_id'))\n\t\t) {\n\t\t\tthrow new \\App\\Exceptions\\NoPermitted('LBL_PERMISSION_DENIED', 406);\n\t\t}\n\t\tif (\n\t\t\t$request->has('record') &&\n\t\t\t!Vtiger_Record_Model::getInstanceById($request->getInteger('record'))->isViewable()\n\t\t) {\n\t\t\tthrow new \\App\\Exceptions\\NoPermitted('LBL_PERMISSION_DENIED', 406);\n\t\t}\n\t\tif (\n\t\t\t$request->has('room_id') &&\n\t\t\t$request->getInteger('room_id') !== 0 &&\n\t\t\t!Vtiger_Record_Model::getInstanceById($request->getInteger('room_id'))->isViewable()\n\t\t) {\n\t\t\tthrow new \\App\\Exceptions\\NoPermitted('LBL_PERMISSION_DENIED', 406);\n\t\t}\n\t}", "public function hasCurrentRoute();" ]
[ "0.6560812", "0.63718975", "0.636209", "0.6358825", "0.62813026", "0.6195538", "0.6046699", "0.6046699", "0.6021926", "0.59927934", "0.5983323", "0.5970033", "0.59530586", "0.5926499", "0.5924864", "0.5897319", "0.58855736", "0.5872149", "0.582171", "0.5809605", "0.5796451", "0.5786274", "0.5779204", "0.57718104", "0.5771344", "0.5765516", "0.5742928", "0.572809", "0.57242393", "0.5710357" ]
0.6575761
0
This bit builds up rewrite rules for taxonomies as well as custom posts
function rewriteRulesForCustomPostTypeAndTax($wp_rewrite) { $tax_rules = array(); $custom_post_rules = array(); foreach ($this->arr_list_of_post_taxs as $post_type) { $args = array( 'post_type' => $post_type['name'], 'posts_per_page' => -1 ); $custom_post_type_posts = new WP_Query($args); foreach ($custom_post_type_posts->posts as $post_key => $post_val) { $arr_slugs = $this->getSlugsForPostTax($post_val->ID); $base_taxonomy = $post_type['basepage']->post_name; if (!empty($arr_slugs)) { //there are more than one slug for the same post, create a rule for each foreach ((array) $arr_slugs as $slug_key => $slug_val) { $single_post_slug = explode('/', $slug_val); $single_post_slug[] = $post_val->post_name; //add the post name at the end of the array $single_post_slug = array_values(array_filter($single_post_slug)); //re-index after removing all the empty keys from array $single_post_slug[0] = $base_taxonomy; //replace the old base taxonomy with the new one. $single_post_slug = implode('/', $single_post_slug) . '-' . $post_val->ID; $custom_post_rules['^' . $single_post_slug . '$'] = 'index.php?' . $post_type['name'] . '=' . $post_val->post_name; } } else { //only one slug available, create the rule $single_post_slug = $post_type['basepage']->post_name . '/' . $post_val->post_name . '-' . $post_val->ID; $custom_post_rules['^' . $single_post_slug . '$'] = 'index.php?' . $post_type['name'] . '=' . $post_val->post_name; } } $arr_categories = get_categories(array('type' => $post_type, 'taxonomy' => $post_type['custom_taxonomy']['slug'], 'hide_empty' => 0)); foreach ($arr_categories as $category) { $tax_rules['^' . $base_taxonomy . '/' . $category->slug . '/?$'] = 'index.php?' . $category->taxonomy . '=' . $category->slug; } } $final_rules = array_merge($custom_post_rules, $tax_rules); $wp_rewrite->rules = $final_rules + $wp_rewrite->rules; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function set_subpage_rewrites() {\n\t\tforeach ( $this->types as $taxonomy => $config ) {\n\t\t\t$post_type = $this->types[ $taxonomy ]['post_type'];\n\t\t\tif ( ! empty( $post_type ) ) {\n\t\t\t\t$tax_rule = '^' . $taxonomy . '/([^/]+)/([^/]+)/?$';\n\t\t\t\t$tax_feed_rule = '^' . $taxonomy . '/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$';\n\t\t\t\t$tax_feed_rule1 = '^' . $taxonomy . '/([^/]+)/(feed|rdf|rss|rss2|atom)/?$';\n\n\t\t\t\t$post_type_rule = '^' . $post_type . '/([^/]+)/([^/]+)/?$';\n\t\t\t\t$post_type_feed_rule = '^' . $post_type . '/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$';\n\t\t\t\t$post_type_feed_rule1 = '^' . $post_type . '/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$';\n\n\t\t\t\t$rewrite = 'index.php?' . $post_type . '=$matches[2]';\n\t\t\t\t$feed_rewrite = 'index.php?' . $taxonomy . '=$matches[1]&feed=$matches[2]';\n\n\t\t\t\tadd_rewrite_rule( $tax_feed_rule, $feed_rewrite, 'top' );\n\t\t\t\tadd_rewrite_rule( $tax_feed_rule1, $feed_rewrite, 'top' );\n\t\t\t\tadd_rewrite_rule( $tax_rule, $rewrite, 'top' );\n\n\t\t\t\tadd_rewrite_rule( $post_type_feed_rule, $feed_rewrite, 'top' );\n\t\t\t\tadd_rewrite_rule( $post_type_feed_rule1, $feed_rewrite, 'top' );\n\t\t\t\tadd_rewrite_rule( $post_type_rule, $rewrite, 'top' );\n\n\t\t\t}\n\t\t}\n\t}", "function suesdesign_custom_posts_flush_rewrites() {\n\tsuesdesign_custom_register_post_type();\n\tflush_rewrite_rules();\n}", "function pvs_posts_flush_rewrites() {\n\tpvs_register_post_type();\n\tpvs_events_create_taxonomy();\n\tflush_rewrite_rules();\n}", "function vt_add_rewrite_rules( $wp_rewrite )\n{\n $post_page_ID = get_option( 'page_for_posts' );\t\n\t$post_page_slug = $post_page_ID ? get_post_field( 'post_name', $post_page_ID ) : 'aktuelt';\n $new_rules = array(\n $post_page_slug.'/(.+?)/?$' => 'index.php?post_type=post&name='. $wp_rewrite->preg_index(1),\n );\n $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;\n}", "function vt_custom_rewrite_rule() {\n $post_page_ID = get_option( 'page_for_posts' );\t\n\t$post_page_slug = $post_page_ID ? get_post_field( 'post_name', $post_page_ID ) : 'aktuelt';\n\n\tglobal $wp_rewrite;\n\n\t$wp_rewrite->front = $wp_rewrite->root;\n\n\t//$wp_rewrite->set_permalink_structure( $post_page_slug.'/%postname%/' );\n\n\t$wp_rewrite->page_structure = $wp_rewrite->root . '/%pagename%/';\n\n\t//$wp_rewrite->author_base = 'author';\n\t//$wp_rewrite->author_structure = '/' . $wp_rewrite->author_base . '/%author%';\n\n\t$wp_rewrite->set_category_base( $post_page_slug );\n\t$wp_rewrite->set_tag_base( 'tag' );\n\n\t//$wp_rewrite->add_rule( '^'.$post_page_slug.'$', 'index.php', 'top' );\n\n}", "function wp_post_generate_rewrite_rules( $wp_rewrite ) {\n $new_rules = array(\n '(([^/]+/)*post)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[3]',\n 'post/([^/]+)/?$' => 'index.php?post_type=post&name=$matches[1]',\n 'post/[^/]+/attachment/([^/]+)/?$' => 'index.php?post_type=post&attachment=$matches[1]',\n 'post/[^/]+/attachment/([^/]+)/trackback/?$' => 'index.php?post_type=post&attachment=$matches[1]&tb=1',\n 'post/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=post&attachment=$matches[1]&feed=$matches[2]',\n 'post/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=post&attachment=$matches[1]&feed=$matches[2]',\n 'post/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?post_type=post&attachment=$matches[1]&cpage=$matches[2]',\t\t\n 'post/[^/]+/attachment/([^/]+)/embed/?$' => 'index.php?post_type=post&attachment=$matches[1]&embed=true',\n 'post/[^/]+/embed/([^/]+)/?$' => 'index.php?post_type=post&attachment=$matches[1]&embed=true',\n 'post/([^/]+)/embed/?$' => 'index.php?post_type=post&name=$matches[1]&embed=true',\n 'post/[^/]+/([^/]+)/embed/?$' => 'index.php?post_type=post&attachment=$matches[1]&embed=true',\n 'post/([^/]+)/trackback/?$' => 'index.php?post_type=post&name=$matches[1]&tb=1',\n 'post/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=post&name=$matches[1]&feed=$matches[2]',\n 'post/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=post&name=$matches[1]&feed=$matches[2]',\n 'post/page/([0-9]{1,})/?$' => 'index.php?post_type=post&paged=$matches[1]',\n 'post/[^/]+/page/?([0-9]{1,})/?$' => 'index.php?post_type=post&name=$matches[1]&paged=$matches[2]',\n 'post/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?post_type=post&name=$matches[1]&paged=$matches[2]',\n 'post/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?post_type=post&name=$matches[1]&cpage=$matches[2]',\n 'post/([^/]+)(/[0-9]+)?/?$' => 'index.php?post_type=post&name=$matches[1]&page=$matches[2]',\n 'post/[^/]+/([^/]+)/?$' => 'index.php?post_type=post&attachment=$matches[1]',\n 'post/[^/]+/([^/]+)/trackback/?$' => 'index.php?post_type=post&attachment=$matches[1]&tb=1',\n 'post/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=post&attachment=$matches[1]&feed=$matches[2]',\n 'post/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=post&attachment=$matches[1]&feed=$matches[2]',\n 'post/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?post_type=post&attachment=$matches[1]&cpage=$matches[2]',\n );\n $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;\n}", "function cltvo_rewrite_rules() {\n\tadd_rewrite_rule('products/([^/]+)/([^/]+)/?$', 'index.php?Cltvo_Product_Taxonomy=$matches[1]&cltvo_product=$matches[2]', 'top');\n\tadd_rewrite_rule('products/([^/]+)/?$', 'index.php?Cltvo_Product_Taxonomy=$matches[1]', 'top');\n\t\n\tadd_rewrite_rule('journal/archive/([^/]+)/?$', 'index.php?post_type=post&category_name=$matches[1]', 'top');\n\tadd_rewrite_rule('journal/archive/([^/]+)/([^/]+)/?$', 'index.php?post_type=post&category_name=$matches[1]&name=$matches[2]', 'top');\n}", "function build_taxonomies() {\n // custom tax\n register_taxonomy( 'main', 'post',\n array(\n 'hierarchical' => true, // true = acts like categories false = acts like tags\n 'label' => 'Categories',\n 'query_var' => true,\n 'show_admin_column' => true,\n 'public' => true,\n 'rewrite' => array( 'slug' => 'main-categories' ),\n '_builtin' => true\n ) );\n }", "function ih_app_detail_rewrite_rules(){\r\n global $wp_rewrite;\r\n //add_rewrite_rule('^inboxmember_listhacking/market/(.*)/(.*)/?$','index.php?pagename=child1&market=parent','top');\r\n //add_rewrite_rule('^inboxmember_listhacking/market/(.*)/(.*)/?$','index.php?pagename=market/parent/child1','top');\r\n add_rewrite_rule('^market/(.*)/(.*)/?$','index.php?market=$matches[1]/$matches[2]','top');\r\n //add_rewrite_rule('^market/(.*)/(.*)/?$','index.php?market=metropolitan-atlanta/sample','top');\r\n //flush_rewrite_rules();\r\n //add_rewrite_rule('^inboxmember_listhacking/market/(.*)/(.*)/?$','^inboxmember_listhacking/index.php?pagename=$matches[2]','top');\r\n //echo \"<pre>sadasd\"; print_r($wp_rewrite);\r\n\t//echo \"<pre>\"; print_r($wp_query);\r\n\r\n\t//remove action of plugin custom-post-type-permalinks\r\n}", "function update_term_rewrite_rules() {\n\t\tglobal $wp_rewrite;\n\t\t$options = get_option( 'dwqa_options' );\n\n\t\t$page_id = $options['pages']['archive-question'];\n\t\t$question_list_page = get_post( $page_id );\n\t\t$rewrite_category = isset( $options['question-category-rewrite'] ) ? sanitize_title( $options['question-category-rewrite'] ) : 'question-category';\n\t\t$rewrite_tag = isset( $options['question-tag-rewrite'] ) ? sanitize_title( $options['question-tag-rewrite'] ) : 'question-tag';\n\n\t\tif ( $question_list_page ) {\n\t\t\t$dwqa_rewrite_rules = array(\n\t\t\t\t'^'.$question_list_page->post_name.'/'.$rewrite_category.'/([^/]*)' => 'index.php?page_id='.$page_id.'&taxonomy=dwqa-question_category&dwqa-question_category=$matches[1]',\n\t\t\t\t'^'.$question_list_page->post_name.'/'.$rewrite_tag.'/([^/]*)' => 'index.php?page_id='.$page_id.'&taxonomy=dwqa-question_tag&dwqa-question_tag=$matches[1]',\n\t\t\t);\n\t\t\tforeach ( $dwqa_rewrite_rules as $regex => $redirect ) {\n\t\t\t\tadd_rewrite_rule( $regex, $redirect, 'top' );\n\t\t\t}\n\t\t\t// Add permastruct for pretty link\n\t\t\tadd_permastruct( 'dwqa-question_category', \"{$question_list_page->post_name}/{$rewrite_category}/%dwqa-question_category%\", array( 'with_front' => false ) );\n\t\t\tadd_permastruct( 'dwqa-question_tag', \"{$question_list_page->post_name}/{$rewrite_tag}/%dwqa-question_tag%\", array( 'with_front' => false ) );\n\t\t}\n\t}", "function bli_rewrite_flush() {\n bli_custom_post_type();\n flush_rewrite_rules();\n}", "function wp_page_generate_rewrite_rules( $wp_rewrite ) {\n $new_rules = array(\n 'page/([^/]+)/?$' => 'index.php?post_type=page&name=$matches[1]',\n 'page/[^/]+/attachment/([^/]+)/?$' => 'index.php?post_type=page&attachment=$matches[1]',\n 'page/[^/]+/attachment/([^/]+)/trackback/?$' => 'index.php?post_type=page&attachment=$matches[1]&tb=1',\n 'page/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=page&attachment=$matches[1]&feed=$matches[2]',\n 'page/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=page&attachment=$matches[1]&feed=$matches[2]',\n 'page/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?post_type=page&attachment=$matches[1]&cpage=$matches[2]',\t\t\n 'page/[^/]+/attachment/([^/]+)/embed/?$' => 'index.php?post_type=page&attachment=$matches[1]&embed=true',\n 'page/[^/]+/embed/([^/]+)/?$' => 'index.php?post_type=page&attachment=$matches[1]&embed=true',\n 'page/([^/]+)/embed/?$' => 'index.php?post_type=page&name=$matches[1]&embed=true',\n 'page/[^/]+/([^/]+)/embed/?$' => 'index.php?post_type=page&attachment=$matches[1]&embed=true',\n 'page/([^/]+)/trackback/?$' => 'index.php?post_type=page&name=$matches[1]&tb=1',\n 'page/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=page&name=$matches[1]&feed=$matches[2]',\n 'page/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=page&name=$matches[1]&feed=$matches[2]',\n 'page/[^/]+/page/?([0-9]{1,})/?$' => 'index.php?post_type=page&name=$matches[1]&paged=$matches[2]',\n 'page/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?post_type=page&name=$matches[1]&paged=$matches[2]',\n 'page/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?post_type=page&name=$matches[1]&cpage=$matches[2]',\n 'page/([^/]+)(/[0-9]+)?/?$' => 'index.php?post_type=page&name=$matches[1]&page=$matches[2]',\n 'page/[^/]+/([^/]+)/?$' => 'index.php?post_type=page&attachment=$matches[1]',\n 'page/[^/]+/([^/]+)/trackback/?$' => 'index.php?post_type=page&attachment=$matches[1]&tb=1',\n 'page/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=page&attachment=$matches[1]&feed=$matches[2]',\n 'page/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=page&attachment=$matches[1]&feed=$matches[2]',\n 'page/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?post_type=page&attachment=$matches[1]&cpage=$matches[2]',\n );\n $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;\n}", "function generate_rewrite_rules($wp_rewrite) {\n\n// $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;\n\t}", "function additional_rewrite_rules() {\n global $wp_rewrite;\n\n // define new rules\n $new_rules = array(\n\n _x('series', 'http route', config('textdomain')).'/?$'\n => \"index.php?archive=series\",\n\n _x('speakers', 'http route', config('textdomain')).'/?$'\n => \"index.php?archive=speakers\",\n\n _x('topics', 'http route', config('textdomain')).'/?$'\n => \"index.php?archive=topics\",\n\n _x('podcasts', 'http route', config('textdomain')).'/?$'\n => \"index.php?archive=podcasts\",\n );\n\n // Add new rules to existing rules\n $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;\n}", "function myplugin_flush_rewrites() {\n tt_register_post_type();\n flush_rewrite_rules();\n}", "function bbp_generate_rewrite_rules($wp_rewrite)\n{\n}", "function qtranslate_edit_taxonomies(){\r\n $args=array(\r\n 'public' => true ,\r\n '_builtin' => false\r\n );\r\n $output = 'object'; // or objects\r\n $operator = 'and'; // 'and' or 'or'\r\n\r\n $taxonomies = get_taxonomies($args,$output,$operator);\r\n\r\n if ($taxonomies) {\r\n foreach ($taxonomies as $taxonomy ) {\r\n add_action( $taxonomy->name.'_add_form', 'qtrans_modifyTermFormFor');\r\n add_action( $taxonomy->name.'_edit_form', 'qtrans_modifyTermFormFor');\r\n\r\n }\r\n }\r\n\r\n}", "function poxy_custom_grain_flush_rules(){\n poxy_create_grain_post_type();\n //and flush the rules.\n flush_rewrite_rules(); \n}", "function bbp_add_rewrite_rules()\n{\n}", "function tf_setup_rewrite_rules() {\n\n\t// hm_add_rewrite_rule( 'events/([^/]+)/([^/]+)(/page/([0-9]+))?/?$', 'post_type=tf_events&name=$matches[2]&page=$matches[4]' );\n}", "function rp3_blog_taxonomies() {\n\n\t$industry_args = array(\n\t\t'labels'\t\t\t\t=> array(\n\t\t\t'name'\t\t\t\t\t=> 'Industries',\n\t\t\t'singular_name'\t\t\t=> 'Industry'\n\t\t),\n\t\t'public'\t\t\t\t=> true,\n\t\t'hierarchical'\t\t\t=> true\n\t);\n\n\tregister_taxonomy( 'rp3_tax_industries', 'post', $industry_args );\n\n\t$service_args = array(\n\t\t'labels'\t\t\t\t=> array(\n\t\t\t'name'\t\t\t\t\t=> 'Services',\n\t\t\t'singular_name'\t\t\t=> 'Service'\n\t\t),\n\t\t'public'\t\t\t\t=> true,\n\t\t'hierarchical'\t\t\t=> true\n\t);\n\n\tregister_taxonomy( 'rp3_tax_services', 'post', $service_args );\n\n\t// remove default \"category\" taxonomy from posts\n\tregister_taxonomy( 'category', array() );\n}", "function project_flush_rules(){\n register_project_post_type();\n\n //and flush the rules.\n flush_rewrite_rules();\n}", "function re_rewrite_rules() {\n global $wp_rewrite;\n $wp_rewrite->pagination_base = 'trang';\n $wp_rewrite->flush_rules();\n}", "function activate_brewdetectives_taxonomies() {\r\n create_beer_recipe_post_type();\r\n create_beer_post_type();\r\n\t// activate short codes\r\n\tregister_brewdetectives_shortcodes();\r\n\t// activate taxonomies\r\n register_taxonomy_grains();\r\n register_taxonomy_hops();\r\n register_taxonomy_BJCPStyles();\r\n register_taxonomy_yeasts();\r\n register_taxonomy_types();\r\n register_taxonomy_breweries();\r\n register_taxonomy_stores();\r\n register_taxonomy_restaurants();\r\n register_taxonomy_beer_descriptor();\r\n register_taxonomy_upcnumbers();\r\n\t$GLOBALS['wp_rewrite']->flush_rules();\r\n}", "public function register_rewrite_rule( $post_type, $args ) {\n\t\tglobal $wp_rewrite;\n\t\tif ( '' == get_option( 'permalink_structure' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$permastruct_args = $args->rewrite;\n\t\t$permastruct_args['feed'] = $permastruct_args['feeds'];\n\n\t\tif ( $struct = $this->option->get_structure( $post_type ) ) {\n\n\t\t\t$post_type_slug = $this->option->get_front_struct( $post_type );\n\t\t\tadd_rewrite_tag( \"%${post_type}_slug%\", \"(${post_type_slug})\", \"post_type=${post_type}&slug=\" );\n\n\t\t\t$struct = str_replace( array( $post_type_slug, '%postname%' ), array( \"%${post_type}_slug%\", \"%{$post_type}%\" ), $struct );\n\n\t\t\t// $rewrite_args['walk_dirs'] = false;\n\t\t\tadd_permastruct( $post_type, $struct, $permastruct_args );\n\n\t\t\t$slug = $this->option->get_front_struct( $post_type );\n\n\t\t\tif ( $slug ) {\n\t\t\t\tadd_rewrite_rule( \"$slug/?$\", \"index.php?post_type=$post_type\", 'top' );\n\n\t\t\t\tif ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) {\n\t\t\t\t\t$feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')';\n\t\t\t\t\tadd_rewrite_rule( \"{$slug}/feed/$feeds/?$\", \"index.php?post_type=$post_type\" . '&feed=$matches[1]', 'top' );\n\t\t\t\t\tadd_rewrite_rule( \"{$slug}/$feeds/?$\", \"index.php?post_type=$post_type\" . '&feed=$matches[1]', 'top' );\n\t\t\t\t}\n\n\t\t\t\tif ( $args->rewrite['pages'] ) {\n\t\t\t\t\tadd_rewrite_rule( \"$slug/{$wp_rewrite->pagination_base}/?([0-9]{1,})/?$\", \"index.php?post_type=$post_type\" . '&paged=$matches[1]', 'top' );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function process_multiterm_url( $wp ) {\n\t$pattern = '#' . get_rewrite_rule() . '#i';\n\tif ( preg_match_all( $pattern, $wp->request, $matches ) ) {\n\n\t\t// Map rewrite slugs to taxonomy names.\n\t\t$taxonomies = get_taxonomies( [ 'public' => true ], 'objects' );\n\t\t$taxonomy_map = [];\n\t\tforeach ( $taxonomies as $tax ) {\n\t\t\t$taxonomy_map[ $tax->rewrite['slug'] ] = $tax->name;\n\t\t}\n\n\t\t// Build tax query.\n\t\t$tax_query = [\n\t\t\t'relation' => 'AND',\n\t\t];\n\t\tforeach ( $matches[0] as $term_string ) {\n\t\t\t$terms = array_filter( explode( '/', $term_string ) );\n\t\t\t$rewrite_slug = array_shift( $terms );\n\t\t\t$tax_query[] = [\n\t\t\t\t'taxonomy' => $taxonomy_map[ $rewrite_slug ],\n\t\t\t\t'field' => 'slug',\n\t\t\t\t'terms' => $terms,\n\t\t\t\t'operator' => 'AND',\n\t\t\t];\n\t\t}\n\t\t$wp->query_vars['tax_query'] = $tax_query;\n\t\tunset( $wp->query_vars['error'] );\n\t}\n}", "function create_custom_taxonomies() {\n\n\t\tregister_taxonomy(\n\t\t\t'fictiv_role',\n\t\t\tarray (\n\t\t\t\t'cpt_blog',\n\t\t\t\t'cpt_teardown',\n\t\t\t\t'cpt_webinar',\n\t\t\t\t'cpt_ebook'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'labels'\t=> array(\n\t\t\t\t\t'name'\t\t\t=> 'Roles',\n\t\t\t\t\t'singular_name'\t=> 'Role',\n\t\t\t\t\t'menu_name'\t\t=> 'Roles',\n\t\t\t\t\t'add_new_item'\t=> 'Add New Role',\n\t\t\t\t\t'new_item_name'\t=> 'New Role'\n\t\t\t\t),\n\t\t\t\t'show_ui'\t\t\t=> true,\n\t\t\t\t'public' => false,\n\t\t\t\t'show_in_nav_menus'\t=> false,\n\t\t\t\t'show_tagcloud'\t\t=> false,\n\t\t\t\t'hierarchical'\t\t=> true,\n\t\t\t\t'query_var'\t\t\t=> true,\n\t\t\t\t'show_admin_column'\t=> true,\n\t\t\t\t'show_in_rest' => true,\n\t\t\t\t'rewrite'\t=> array(\n\t\t\t\t\t'slug' => 'role', 'with_front' => false\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\n\t\tregister_taxonomy(\n\t\t\t'fictiv_topic',\n\t\t\tarray (\n\t\t\t\t'cpt_blog',\n\t\t\t\t'cpt_teardown',\n\t\t\t\t'cpt_webinar',\n\t\t\t\t'cpt_ebook'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'labels'\t=> array(\n\t\t\t\t\t'name'\t\t\t=> 'Topics',\n\t\t\t\t\t'singular_name'\t=> 'Topic',\n\t\t\t\t\t'menu_name'\t\t=> 'Topics',\n\t\t\t\t\t'add_new_item'\t=> 'Add New Topic',\n\t\t\t\t\t'new_item_name'\t=> 'New Topic'\n\t\t\t\t),\n\t\t\t\t'show_ui'\t\t\t=> true,\n\t\t\t\t'show_in_nav_menus'\t=> false,\n\t\t\t\t'show_tagcloud'\t\t=> false,\n\t\t\t\t'hierarchical'\t\t=> true,\n\t\t\t\t'query_var'\t\t\t=> true,\n\t\t\t\t'show_admin_column'\t=> true,\n\t\t\t\t'show_in_rest' => true,\n\t\t\t\t'rewrite'\t=> array(\n\t\t\t\t\t'slug' => 'topic', \n\t\t\t\t\t'with_front' => false\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\n\t\tregister_taxonomy(\n\t\t\t'fictiv_industry',\n\t\t\tarray (\n\t\t\t\t'cpt_blog',\n\t\t\t\t'cpt_teardown',\n\t\t\t\t'cpt_webinar',\n\t\t\t\t'cpt_ebook',\n\t\t\t\t'cpt_case_study',\n\t\t\t\t'cpt_video',\n\t\t\t\t'cpt_tool',\n\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'labels'\t=> array(\n\t\t\t\t\t'name'\t\t\t=> 'Industries',\n\t\t\t\t\t'singular_name'\t=> 'Industry',\n\t\t\t\t\t'menu_name'\t\t=> 'Industries',\n\t\t\t\t\t'add_new_item'\t=> 'Add New Industry',\n\t\t\t\t\t'new_item_name'\t=> 'New Industry'\n\t\t\t\t),\n\t\t\t\t'show_ui'\t\t\t=> true,\n\t\t\t\t'public' => false,\n\t\t\t\t'show_in_nav_menus'\t=> false,\n\t\t\t\t'show_tagcloud'\t\t=> false,\n\t\t\t\t'hierarchical'\t\t=> true,\n\t\t\t\t'query_var'\t\t\t=> true,\n\t\t\t\t'show_admin_column'\t=> true,\n\t\t\t\t'show_in_rest' => true,\n\t\t\t\t'rewrite'\t=> array(\n\t\t\t\t\t'slug' => 'industry', 'with_front' => false\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\n\t\tregister_taxonomy(\n\t\t\t'fictiv_manufacturing_process',\n\t\t\tarray (\n\t\t\t\t'cpt_blog',\n\t\t\t\t'cpt_webinar',\n\t\t\t\t'cpt_ebook',\n\t\t\t\t'cpt_case_study',\n\t\t\t\t'cpt_video',\n\t\t\t\t'cpt_tool',\n\t\t\t\t'cpt_cap_material',\n\t\t\t\t'cpt_cap_finish',\n\t\t\t\t'cpt_partners',\n\t\t\t\t'page'\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'labels'\t=> array(\n\t\t\t\t\t'name'\t\t\t=> 'Manufacturing Processes',\n\t\t\t\t\t'singular_name'\t=> 'Manufacturing Processes',\n\t\t\t\t\t'menu_name'\t\t=> 'Manufacturing Processes',\n\t\t\t\t\t'add_new_item'\t=> 'Add New Process',\n\t\t\t\t\t'new_item_name'\t=> 'New Process'\n\t\t\t\t),\n\t\t\t\t'show_ui'\t\t\t=> true,\n\t\t\t\t'public' => false,\n\t\t\t\t'show_in_nav_menus'\t=> false,\n\t\t\t\t'show_tagcloud'\t\t=> false,\n\t\t\t\t'hierarchical'\t\t=> true,\n\t\t\t\t'query_var'\t\t\t=> true,\n\t\t\t\t'show_admin_column'\t=> true,\n\t\t\t\t'show_in_rest' => true,\n\t\t\t\t'rewrite'\t=> array(\n\t\t\t\t\t'slug' => 'manufacturing-processes', 'with_front' => false\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\n\n\n\t\tregister_taxonomy(\n\t\t\t'fictiv_page_type',\n\t\t\tarray ('page'),\n\t\t\tarray(\n\t\t\t\t'labels'\t=> array(\n\t\t\t\t\t'name'\t\t\t=> 'Page Types',\n\t\t\t\t\t'singular_name'\t=> 'Page Type',\n\t\t\t\t\t'menu_name'\t\t=> 'Page Types',\n\t\t\t\t\t'add_new_item'\t=> 'Add New Page Type',\n\t\t\t\t\t'new_item_name'\t=> 'New Page Type'\n\t\t\t\t),\n\t\t\t\t'show_ui'\t\t\t=> true,\n\t\t\t\t'public' => false,\n\t\t\t\t'show_in_nav_menus'\t=> false,\n\t\t\t\t'show_tagcloud'\t\t=> false,\n\t\t\t\t'hierarchical'\t\t=> true,\n\t\t\t\t'query_var'\t\t\t=> true,\n\t\t\t\t'show_admin_column'\t=> true,\n\t\t\t\t'show_in_rest' => true,\n\t\t\t\t'rewrite'\t=> array(\n\t\t\t\t\t'slug' => 'page-type'\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\n\t}", "function rewriteRulesForWoocommerce($wp_rewrite) {\n\t\tglobal $arr_termSlug;\n\t\tglobal $wp_rewrite;\n\n\t\t$custom_post_rules = array();\n\t\t$product_categories = get_terms('product_cat');\n\t\t$obj_shop_page = get_post(woocommerce_get_page_id('shop'));\n\t\tforeach ($product_categories as $category) {\n\t\t\t$arr_termSlug = array();\n\t\t\t$this->getTaxonomyHierarchy($category, 'product');\n\t\t\t$slug = implode('/', array_reverse($arr_termSlug));\n\t\t\t$custom_post_rules['^' . $obj_shop_page->post_name . '/' . $slug . '/?$'] = 'index.php?product_cat=' . $category->slug;\n\t\t}\n\n\t\t//------------This code is simply for products that do no have a category, by default wordpress assigns \"uncategorized\" category and puts it in the slug\n\t\t$args = array(\n\t\t\t\t'post_type' => 'product',\n\t\t\t\t'posts_per_page' => -1\n\t\t);\n\t\t$arr_woo_products = new WP_Query($args);\n\n\t\tforeach ($arr_woo_products->posts as $product) {\n\t\t\t$links = $this->getTheTermListModified($product->ID, 'product_cat');\n\t\t\tif (empty($links)) { //no category\n\t\t\t\t$custom_post_rules['^' . $obj_shop_page->post_name . '/' . $product->post_name . '/?$'] = 'index.php?product=' . $product->post_name;\n\t\t\t}\n\t\t}\n\t\t//-------------------------------------------------------------------------------------------------------------------------------------------------------\n\n\t\treturn $wp_rewrite->rules = $custom_post_rules + $wp_rewrite->rules;\n\t}", "function bbp_get_forum_post_type_rewrite()\n{\n}", "function build_taxonomies(){\n $city_labels = array(\n 'name' => __( 'Cidade', 'framework' ),\n 'singular_name' => __( 'Cidade', 'framework' ),\n 'search_items' => __( 'Pesquisar por Cidades', 'framework' ),\n 'popular_items' => __( 'Cidades populares', 'framework' ),\n 'all_items' => __( 'Todas as Cidades', 'framework' ),\n 'parent_item' => __( 'Parent Cidade', 'framework' ),\n 'parent_item_colon' => __( 'Parent Cidade:', 'framework' ),\n 'edit_item' => __( 'Editar Cidade', 'framework' ),\n 'update_item' => __( 'Atualizar Cidade', 'framework' ),\n 'add_new_item' => __( 'Adicionar nova Cidade', 'framework' ),\n 'new_item_name' => __( 'Nova Cidade', 'framework' ),\n 'separate_items_with_commas' => __( 'Separe Cidades com vírgulas', 'framework' ),\n 'add_or_remove_items' => __( 'Adicione ou remova Cidades', 'framework' ),\n 'choose_from_most_used' => __( 'Escolha das Cidades mais usadas', 'framework' ),\n 'menu_name' => __( 'Cidades', 'framework' )\n );\n\n register_taxonomy(\n 'property-city',\n array( 'property' ),\n array(\n 'hierarchical' => false,\n 'labels' => $city_labels,\n 'show_ui' => true,\n 'query_var' => true,\n 'rewrite' => array('slug' => __('property-city', 'framework'))\n )\n );\n ////////////\n $labels = array(\n 'name' => __( 'UF', 'framework' ),\n 'singular_name' => __( 'UF', 'framework' ),\n 'search_items' => __( 'Pesquisar por Estado', 'framework' ),\n 'popular_items' => __( 'Popular UF', 'framework' ),\n 'all_items' => __( 'Todas propriedades por Estado', 'framework' ),\n 'parent_item' => __( 'Parent Property Feature', 'framework' ),\n 'parent_item_colon' => __( 'Parent Property Feature:', 'framework' ),\n 'edit_item' => __( 'Edit Property Feature', 'framework' ),\n 'update_item' => __( 'Update Property Feature', 'framework' ),\n 'add_new_item' => __( 'Novo Estado', 'framework' ),\n 'new_item_name' => __( 'Novo Estado', 'framework' ),\n 'separate_items_with_commas' => __( 'Estados', 'framework' ),\n 'add_or_remove_items' => __( 'Adicione ou remova Estado', 'framework' ),\n 'choose_from_most_used' => __( 'Escolha dos Estados mais usados', 'framework' ),\n 'menu_name' => __( 'UF', 'framework' )\n );\n\n register_taxonomy(\n 'property-feature',\n array('property'),\n array(\n 'hierarchical' => false,\n 'labels' => $labels,\n 'show_ui' => true,\n 'query_var' => true,\n 'rewrite' => array('slug' => __('property-feature', 'framework'))\n )\n );\n /////////////\n $type_labels = array(\n 'name' => __( 'Tipo de Empreendimento', 'framework' ),\n 'singular_name' => __( 'Tipo de Empreendimento', 'framework' ),\n 'search_items' => __( 'Pesquisar por Tipo de Empreendimentos', 'framework' ),\n 'popular_items' => __( 'Populares Tipos de Empreendimentos', 'framework' ),\n 'all_items' => __( 'Todos os Tipos de Empreendimentos', 'framework' ),\n 'parent_item' => __( 'Parent Tipo de Empreendimento', 'framework' ),\n 'parent_item_colon' => __( 'Parent Tipo de Empreendimento:', 'framework' ),\n 'edit_item' => __( 'Editar Tipo de Empreendimento', 'framework' ),\n 'update_item' => __( 'Atualizar Tipo de Empreendimento', 'framework' ),\n 'add_new_item' => __( 'Adicionar novo Tipo de Empreendimento', 'framework' ),\n 'new_item_name' => __( 'Novo Tipo de Empreendimento Name', 'framework' ),\n 'separate_items_with_commas' => __( 'Separe Tipos de Empreendimentos por vírgula', 'framework' ),\n 'add_or_remove_items' => __( 'Adicione ou remova Tipos de Empreendimentos', 'framework' ),\n 'choose_from_most_used' => __( 'Escolha dos Tipos de Empreendimentos mais usados', 'framework' ),\n 'menu_name' => __( 'Tipos de Empreendimentos', 'framework' )\n );\n\n register_taxonomy(\n 'property-type',\n array( 'property' ),\n array(\n 'hierarchical' => false,\n 'labels' => $type_labels,\n 'show_ui' => true,\n 'query_var' => true,\n 'rewrite' => array('slug' => __('property-type', 'framework'))\n )\n );\n ////////////\n $status_labels = array(\n 'name' => __( 'Status do Empreendimento', 'framework' ),\n 'singular_name' => __( 'Status do Empreendimento', 'framework' ),\n 'search_items' => __( 'Pesquisar Status do Empreendimento', 'framework' ),\n 'popular_items' => __( 'Popular Status do Empreendimento', 'framework' ),\n 'all_items' => __( 'Todos os Status do Empreendimento', 'framework' ),\n 'parent_item' => __( 'Parent Status do Empreendimento', 'framework' ),\n 'parent_item_colon' => __( 'Parent Status do Empreendimento:', 'framework' ),\n 'edit_item' => __( 'Editar Status do Empreendimento', 'framework' ),\n 'update_item' => __( 'Atualizar Status do Empreendimento', 'framework' ),\n 'add_new_item' => __( 'Adicione novo Status do Empreendimento', 'framework' ),\n 'new_item_name' => __( 'Novo Status do Empreendimento', 'framework' ),\n 'separate_items_with_commas' => __( 'Separe Status do Empreendimento com vírgulas', 'framework' ),\n 'add_or_remove_items' => __( 'Adicione ou remova Status do Empreendimento', 'framework' ),\n 'choose_from_most_used' => __( 'Escolha do Status de Empreendimento mais usados ', 'framework' ),\n 'menu_name' => __( 'Status do Empreendimento', 'framework' )\n );\n\n register_taxonomy(\n 'property-status',\n array( 'property' ),\n array(\n 'hierarchical' => false,\n 'labels' => $status_labels,\n 'show_ui' => true,\n 'query_var' => true,\n 'rewrite' => array('slug' => __('property-status', 'framework'))\n )\n );\n}" ]
[ "0.7754139", "0.7234459", "0.7230452", "0.71599716", "0.7085259", "0.70820427", "0.6975829", "0.6911853", "0.6765052", "0.6706165", "0.6700879", "0.6657192", "0.66438144", "0.66066885", "0.6529893", "0.64594436", "0.645178", "0.64372456", "0.64181846", "0.6414616", "0.64027977", "0.63842994", "0.63035834", "0.62960047", "0.6291259", "0.6278411", "0.624594", "0.62404275", "0.62366486", "0.62174505" ]
0.8022531
0
Generate the rewrite rules for Woocommerce
function rewriteRulesForWoocommerce($wp_rewrite) { global $arr_termSlug; global $wp_rewrite; $custom_post_rules = array(); $product_categories = get_terms('product_cat'); $obj_shop_page = get_post(woocommerce_get_page_id('shop')); foreach ($product_categories as $category) { $arr_termSlug = array(); $this->getTaxonomyHierarchy($category, 'product'); $slug = implode('/', array_reverse($arr_termSlug)); $custom_post_rules['^' . $obj_shop_page->post_name . '/' . $slug . '/?$'] = 'index.php?product_cat=' . $category->slug; } //------------This code is simply for products that do no have a category, by default wordpress assigns "uncategorized" category and puts it in the slug $args = array( 'post_type' => 'product', 'posts_per_page' => -1 ); $arr_woo_products = new WP_Query($args); foreach ($arr_woo_products->posts as $product) { $links = $this->getTheTermListModified($product->ID, 'product_cat'); if (empty($links)) { //no category $custom_post_rules['^' . $obj_shop_page->post_name . '/' . $product->post_name . '/?$'] = 'index.php?product=' . $product->post_name; } } //------------------------------------------------------------------------------------------------------------------------------------------------------- return $wp_rewrite->rules = $custom_post_rules + $wp_rewrite->rules; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bbp_generate_rewrite_rules($wp_rewrite)\n{\n}", "public function generate_rewrite_rules($wp_rewrite)\n {\n }", "function generate_rewrite_rules($wp_rewrite) {\n\n// $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;\n\t}", "function cltvo_rewrite_rules() {\n\tadd_rewrite_rule('products/([^/]+)/([^/]+)/?$', 'index.php?Cltvo_Product_Taxonomy=$matches[1]&cltvo_product=$matches[2]', 'top');\n\tadd_rewrite_rule('products/([^/]+)/?$', 'index.php?Cltvo_Product_Taxonomy=$matches[1]', 'top');\n\t\n\tadd_rewrite_rule('journal/archive/([^/]+)/?$', 'index.php?post_type=post&category_name=$matches[1]', 'top');\n\tadd_rewrite_rule('journal/archive/([^/]+)/([^/]+)/?$', 'index.php?post_type=post&category_name=$matches[1]&name=$matches[2]', 'top');\n}", "function generateRewriteRules($wp_rewrite)\n {\n $wp_rewrite->add_external_rule($this->pluginURL() . 'index.php', 'index.php%{REQUEST_URI}');\n $wp_rewrite->add_external_rule($this->pluginURL() . 'readme.txt', 'index.php%{REQUEST_URI}');\n $wp_rewrite->add_external_rule($this->pluginURL(), 'index.php%{REQUEST_URI}');\n }", "function create_rewrite_rules($rewrite) {\n\t\t\t$newrules = array();\n\t\t\t$newrules['wpxlstopdfw-upload/(.*)$'] = 'index.php?wpxlstopdfw-upload=$matches[1]';\n\t\t\t$newrules['wpxlstopdfw-download/(.*)$'] = 'index.php?wpxlstopdfw-download=$matches[1]';\n\t\t\treturn $newrules + $rewrite;\n }", "function regenerate_rules() {\n global $wp_rewrite;\n $oldstruct = get_option('permalink_redirect_oldstruct');\n if ($oldstruct) {\n $rules = array();\n $oldstruct = explode(\"\\n\", $oldstruct);\n foreach ($oldstruct as $item) {\n $rules2 = $wp_rewrite->generate_rewrite_rule(trim($item), \n false, false, false, true);\n $rules3 = array();\n foreach ($rules2 as $match => $query) {\n $query = preg_replace('/\\$(\\d+)/', '\\$matches[\\1]', $query);\n $rules3[$match] = $query;\n }\n $rules[] = $rules3;\n }\n update_option('permalink_redirect_rules', $rules);\n } else {\n delete_option('permalink_redirect_rules');\n }\n }", "function wp_insertMyRewriteRules($rules){\n $newrules = array();\n //If the URL matches any of the locations, do an internal re-write.\n //$locations = require(\"locations.php\");\n //$newrules['(.?.+?)(/[0-9]+)?/('.$locations.')'] = 'index.php?pagename=$matches[1]&page=$matches[2]&placename=$matches[3]';\n return $newrules + $rules;\n}", "function additional_rewrite_rules() {\n global $wp_rewrite;\n\n // define new rules\n $new_rules = array(\n\n _x('series', 'http route', config('textdomain')).'/?$'\n => \"index.php?archive=series\",\n\n _x('speakers', 'http route', config('textdomain')).'/?$'\n => \"index.php?archive=speakers\",\n\n _x('topics', 'http route', config('textdomain')).'/?$'\n => \"index.php?archive=topics\",\n\n _x('podcasts', 'http route', config('textdomain')).'/?$'\n => \"index.php?archive=podcasts\",\n );\n\n // Add new rules to existing rules\n $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;\n}", "function bbp_add_rewrite_rules()\n{\n}", "function create_rewrite_rules($rules) {\n global $wp_rewrite;\n $newRule = array('owark/(.+)' => 'index.php?owark='.$wp_rewrite->preg_index(1));\n $newRules = $newRule + $rules;\n return $newRules;\n }", "public static function add_rewrite_rules($wp_rewrite) {\n\t\t$prefix = easyazon_get_setting('link_cloak_prefix');\n\n\t\t$wp_rewrite->rules = array(\n\t\t\t\"{$prefix}/([^/]+)/([^/]+)(/([^/]+))?/?\" => sprintf('index.php?easyazon-cloaking-identifier=%s&easyazon-cloaking-locale=%s&easyazon-cloaking-tag=%s', $wp_rewrite->preg_index(1), $wp_rewrite->preg_index(2), $wp_rewrite->preg_index(4)),\n\t\t) + $wp_rewrite->rules;\n\t}", "function ih_app_detail_rewrite_rules(){\r\n global $wp_rewrite;\r\n //add_rewrite_rule('^inboxmember_listhacking/market/(.*)/(.*)/?$','index.php?pagename=child1&market=parent','top');\r\n //add_rewrite_rule('^inboxmember_listhacking/market/(.*)/(.*)/?$','index.php?pagename=market/parent/child1','top');\r\n add_rewrite_rule('^market/(.*)/(.*)/?$','index.php?market=$matches[1]/$matches[2]','top');\r\n //add_rewrite_rule('^market/(.*)/(.*)/?$','index.php?market=metropolitan-atlanta/sample','top');\r\n //flush_rewrite_rules();\r\n //add_rewrite_rule('^inboxmember_listhacking/market/(.*)/(.*)/?$','^inboxmember_listhacking/index.php?pagename=$matches[2]','top');\r\n //echo \"<pre>sadasd\"; print_r($wp_rewrite);\r\n\t//echo \"<pre>\"; print_r($wp_query);\r\n\r\n\t//remove action of plugin custom-post-type-permalinks\r\n}", "function update_term_rewrite_rules() {\n\t\tglobal $wp_rewrite;\n\t\t$options = get_option( 'dwqa_options' );\n\n\t\t$page_id = $options['pages']['archive-question'];\n\t\t$question_list_page = get_post( $page_id );\n\t\t$rewrite_category = isset( $options['question-category-rewrite'] ) ? sanitize_title( $options['question-category-rewrite'] ) : 'question-category';\n\t\t$rewrite_tag = isset( $options['question-tag-rewrite'] ) ? sanitize_title( $options['question-tag-rewrite'] ) : 'question-tag';\n\n\t\tif ( $question_list_page ) {\n\t\t\t$dwqa_rewrite_rules = array(\n\t\t\t\t'^'.$question_list_page->post_name.'/'.$rewrite_category.'/([^/]*)' => 'index.php?page_id='.$page_id.'&taxonomy=dwqa-question_category&dwqa-question_category=$matches[1]',\n\t\t\t\t'^'.$question_list_page->post_name.'/'.$rewrite_tag.'/([^/]*)' => 'index.php?page_id='.$page_id.'&taxonomy=dwqa-question_tag&dwqa-question_tag=$matches[1]',\n\t\t\t);\n\t\t\tforeach ( $dwqa_rewrite_rules as $regex => $redirect ) {\n\t\t\t\tadd_rewrite_rule( $regex, $redirect, 'top' );\n\t\t\t}\n\t\t\t// Add permastruct for pretty link\n\t\t\tadd_permastruct( 'dwqa-question_category', \"{$question_list_page->post_name}/{$rewrite_category}/%dwqa-question_category%\", array( 'with_front' => false ) );\n\t\t\tadd_permastruct( 'dwqa-question_tag', \"{$question_list_page->post_name}/{$rewrite_tag}/%dwqa-question_tag%\", array( 'with_front' => false ) );\n\t\t}\n\t}", "function wp_page_generate_rewrite_rules( $wp_rewrite ) {\n $new_rules = array(\n 'page/([^/]+)/?$' => 'index.php?post_type=page&name=$matches[1]',\n 'page/[^/]+/attachment/([^/]+)/?$' => 'index.php?post_type=page&attachment=$matches[1]',\n 'page/[^/]+/attachment/([^/]+)/trackback/?$' => 'index.php?post_type=page&attachment=$matches[1]&tb=1',\n 'page/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=page&attachment=$matches[1]&feed=$matches[2]',\n 'page/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=page&attachment=$matches[1]&feed=$matches[2]',\n 'page/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?post_type=page&attachment=$matches[1]&cpage=$matches[2]',\t\t\n 'page/[^/]+/attachment/([^/]+)/embed/?$' => 'index.php?post_type=page&attachment=$matches[1]&embed=true',\n 'page/[^/]+/embed/([^/]+)/?$' => 'index.php?post_type=page&attachment=$matches[1]&embed=true',\n 'page/([^/]+)/embed/?$' => 'index.php?post_type=page&name=$matches[1]&embed=true',\n 'page/[^/]+/([^/]+)/embed/?$' => 'index.php?post_type=page&attachment=$matches[1]&embed=true',\n 'page/([^/]+)/trackback/?$' => 'index.php?post_type=page&name=$matches[1]&tb=1',\n 'page/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=page&name=$matches[1]&feed=$matches[2]',\n 'page/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=page&name=$matches[1]&feed=$matches[2]',\n 'page/[^/]+/page/?([0-9]{1,})/?$' => 'index.php?post_type=page&name=$matches[1]&paged=$matches[2]',\n 'page/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?post_type=page&name=$matches[1]&paged=$matches[2]',\n 'page/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?post_type=page&name=$matches[1]&cpage=$matches[2]',\n 'page/([^/]+)(/[0-9]+)?/?$' => 'index.php?post_type=page&name=$matches[1]&page=$matches[2]',\n 'page/[^/]+/([^/]+)/?$' => 'index.php?post_type=page&attachment=$matches[1]',\n 'page/[^/]+/([^/]+)/trackback/?$' => 'index.php?post_type=page&attachment=$matches[1]&tb=1',\n 'page/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=page&attachment=$matches[1]&feed=$matches[2]',\n 'page/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=page&attachment=$matches[1]&feed=$matches[2]',\n 'page/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?post_type=page&attachment=$matches[1]&cpage=$matches[2]',\n );\n $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;\n}", "public static function add_rewrite_rules($wp_rewrite) {\n global $wp_rewrite;\n $new_rules = array('salmonpress/?(.+)' => 'index.php?salmonpress=' . $wp_rewrite->preg_index(1),\n 'salmonpress' => 'index.php?salmonpress=true');\n $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;\n }", "function prop_filter_rewrites($rules)\n{\n\n foreach ($rules as $rule => $rewrite) {\n if (preg_match('/trackback\\/\\?\\$$/i', $rule)) {\n unset($rules[$rule]);\n }\n }\n return $rules;\n\n}", "function rewriteRulesForCustomPostTypeAndTax($wp_rewrite) {\n\t\t$tax_rules = array();\n\t\t$custom_post_rules = array();\n\n\t\tforeach ($this->arr_list_of_post_taxs as $post_type) {\n\n\t\t\t$args = array(\n\t\t\t\t\t'post_type' => $post_type['name'],\n\t\t\t\t\t'posts_per_page' => -1\n\t\t\t);\n\t\t\t$custom_post_type_posts = new WP_Query($args);\n\n\n\t\t\tforeach ($custom_post_type_posts->posts as $post_key => $post_val) {\n\t\t\t\t$arr_slugs = $this->getSlugsForPostTax($post_val->ID);\n\t\t\t\t$base_taxonomy = $post_type['basepage']->post_name;\n\n\t\t\t\tif (!empty($arr_slugs)) { //there are more than one slug for the same post, create a rule for each\n\t\t\t\t\tforeach ((array) $arr_slugs as $slug_key => $slug_val) {\n\t\t\t\t\t\t$single_post_slug = explode('/', $slug_val);\n\t\t\t\t\t\t$single_post_slug[] = $post_val->post_name; //add the post name at the end of the array\n\t\t\t\t\t\t$single_post_slug = array_values(array_filter($single_post_slug)); //re-index after removing all the empty keys from array\n\t\t\t\t\t\t$single_post_slug[0] = $base_taxonomy; //replace the old base taxonomy with the new one.\n\t\t\t\t\t\t$single_post_slug = implode('/', $single_post_slug) . '-' . $post_val->ID;\n\t\t\t\t\t\t$custom_post_rules['^' . $single_post_slug . '$'] = 'index.php?' . $post_type['name'] . '=' . $post_val->post_name;\n\t\t\t\t\t}\n\t\t\t\t} else { //only one slug available, create the rule\n\t\t\t\t\t$single_post_slug = $post_type['basepage']->post_name . '/' . $post_val->post_name . '-' . $post_val->ID;\n\t\t\t\t\t$custom_post_rules['^' . $single_post_slug . '$'] = 'index.php?' . $post_type['name'] . '=' . $post_val->post_name;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$arr_categories = get_categories(array('type' => $post_type, 'taxonomy' => $post_type['custom_taxonomy']['slug'], 'hide_empty' => 0));\n\t\t\tforeach ($arr_categories as $category) {\n\t\t\t\t$tax_rules['^' . $base_taxonomy . '/' . $category->slug . '/?$'] = 'index.php?' . $category->taxonomy . '=' . $category->slug;\n\t\t\t}\n\t\t}\n\n\t\t$final_rules = array_merge($custom_post_rules, $tax_rules);\n\t\t$wp_rewrite->rules = $final_rules + $wp_rewrite->rules;\n\t}", "function generate_mod_rewrite($lang) {\n global $db;\n global $apt_path;\n $dicObjs = db_getAll(\"SELECT * FROM dictionary WHERE section='url' and language='$lang'\");\n $lang_name = get_lang_name($lang);\n $mod_str = \"# $lang_name URLs\\n\";\n foreach($dicObjs as $dicObj) {\n $page_key = substr($dicObj->term, 4);\n $page = db_getRow(\"SELECT * FROM page WHERE page='$page_key'\");\n $url = $dicObj->phrase;\n //dump($page);\n \n if(strpos($page->script, 'relocation.php')) { // special case for relocation services\n $ss = $page_key;\n $mod_str .= 'RewriteRule ^(/aid[0-9]{4})?(/[a-z]{2})?(/[^/\\.]+)?/'.$url.'/?$ '.$page->script.'?_aid=$1&_el=$2&_il='.$lang.'&_geo=$3&_s=relocation&_ss='.$ss.' [L]'.\"\\n\";\n //echo(\"mod_str = $mod_str<br>\");\n } elseif(strpos($page->script, 'guide.php')) { // special case for city guide\n $ss = substr($dicObj->term, 10); // key is 'url_guide_'\n $mod_str .= 'RewriteRule ^(/aid[0-9]{4})?(/[a-z]{2})?(/[^/\\.]+)?/'.$url.'/?$ '.$page->script.'?_aid=$1&_el=$2&_il='.$lang.'&_geo=$3&_s=guide&_ss='.$ss.' [L]'.\"\\n\";\n } else {\n $mod_str .= 'RewriteRule ^(/aid[0-9]{4})?(/[a-z]{2})?(/[^/\\.]+)?/'.$url.'(/[^/\\.]+)?(/[^/\\.]+)?/?$ '.$page->script.'?_aid=$1&_el=$2&_il='.$lang.'&_geo=$3&_s=$4&_ss=$5 [L]'.\"\\n\";\n }\n\n }\n $file = \"$apt_path/server/rewrite.$lang\";\n write_file($file, $mod_str);\n $len = strlen($mod_str);\n //echo(str_replace(\"\\n\",'<br>',$mod_str));\n echo(\"Wrote $len bytes to '$file' [Web server URL file]<br>\");\n}", "function re_rewrite_rules() {\n global $wp_rewrite;\n $wp_rewrite->pagination_base = 'trang';\n $wp_rewrite->flush_rules();\n}", "public function addRewriteRule() {\n\t\tadd_rewrite_rule( '^' . self::WEBHOOK_PREFIX . '(/.*)?$', 'index.php?__mpwcwh=1', 'top' );\n\t}", "function psean_rewrite_rules() {\n // ( $regex, $redirect, $after )\n\n\n // TODO: get rid of test page\n // test page\n add_rewrite_rule(\n '^test/?$',\n 'index.php?psean=test',\n 'top' );\n\n\n // json data pages\n $base_url = get_option('psean_base_url');\n //// countries\n add_rewrite_rule(\n $base_url.'/data/countries/?$',\n substr( plugin_dir_path( __FILE__ ), 1 ) . 'data/locations/countries.php',\n 'top'\n );\n //// provinces\n add_rewrite_rule(\n $base_url.'/data/provinces/([^/].*)/?$',\n substr( plugin_dir_path( __FILE__ ), 1 ) . 'data/locations/provinces.php?c=$1',\n 'top'\n );\n //// cities\n add_rewrite_rule(\n $base_url.'/data/cities/([^/].*)/([^/].*)/?$',\n substr( plugin_dir_path( __FILE__ ), 1 ) . 'data/locations/cities.php?p=$1&c=$2',\n 'top'\n );\n\n //// geoip\n add_rewrite_rule(\n $base_url.'/data/geoip/?$',\n substr( plugin_dir_path( __FILE__ ), 1 ) . 'data/locations/geoip.php',\n 'top'\n );\n\n\n // flush rewrite rules\n flush_rewrite_rules();\n}", "function vt_add_rewrite_rules( $wp_rewrite )\n{\n $post_page_ID = get_option( 'page_for_posts' );\t\n\t$post_page_slug = $post_page_ID ? get_post_field( 'post_name', $post_page_ID ) : 'aktuelt';\n $new_rules = array(\n $post_page_slug.'/(.+?)/?$' => 'index.php?post_type=post&name='. $wp_rewrite->preg_index(1),\n );\n $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;\n}", "public function add_client_endpoint_rules() {\n add_rewrite_rule('client_api/v1/(update|delete)/?', 'index.php?__client_api=$matches[1]', 'top');\n\n // If this was the first time, flush rules\n //if ( get_option( 'client-rewrite-rules-version' ) != '1.1' ) {\n flush_rewrite_rules();\n // update_option( 'client-rewrite-rules-version', '1.1' );\n //}\n }", "function wp_post_generate_rewrite_rules( $wp_rewrite ) {\n $new_rules = array(\n '(([^/]+/)*post)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[3]',\n 'post/([^/]+)/?$' => 'index.php?post_type=post&name=$matches[1]',\n 'post/[^/]+/attachment/([^/]+)/?$' => 'index.php?post_type=post&attachment=$matches[1]',\n 'post/[^/]+/attachment/([^/]+)/trackback/?$' => 'index.php?post_type=post&attachment=$matches[1]&tb=1',\n 'post/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=post&attachment=$matches[1]&feed=$matches[2]',\n 'post/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=post&attachment=$matches[1]&feed=$matches[2]',\n 'post/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?post_type=post&attachment=$matches[1]&cpage=$matches[2]',\t\t\n 'post/[^/]+/attachment/([^/]+)/embed/?$' => 'index.php?post_type=post&attachment=$matches[1]&embed=true',\n 'post/[^/]+/embed/([^/]+)/?$' => 'index.php?post_type=post&attachment=$matches[1]&embed=true',\n 'post/([^/]+)/embed/?$' => 'index.php?post_type=post&name=$matches[1]&embed=true',\n 'post/[^/]+/([^/]+)/embed/?$' => 'index.php?post_type=post&attachment=$matches[1]&embed=true',\n 'post/([^/]+)/trackback/?$' => 'index.php?post_type=post&name=$matches[1]&tb=1',\n 'post/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=post&name=$matches[1]&feed=$matches[2]',\n 'post/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=post&name=$matches[1]&feed=$matches[2]',\n 'post/page/([0-9]{1,})/?$' => 'index.php?post_type=post&paged=$matches[1]',\n 'post/[^/]+/page/?([0-9]{1,})/?$' => 'index.php?post_type=post&name=$matches[1]&paged=$matches[2]',\n 'post/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?post_type=post&name=$matches[1]&paged=$matches[2]',\n 'post/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?post_type=post&name=$matches[1]&cpage=$matches[2]',\n 'post/([^/]+)(/[0-9]+)?/?$' => 'index.php?post_type=post&name=$matches[1]&page=$matches[2]',\n 'post/[^/]+/([^/]+)/?$' => 'index.php?post_type=post&attachment=$matches[1]',\n 'post/[^/]+/([^/]+)/trackback/?$' => 'index.php?post_type=post&attachment=$matches[1]&tb=1',\n 'post/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=post&attachment=$matches[1]&feed=$matches[2]',\n 'post/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=post&attachment=$matches[1]&feed=$matches[2]',\n 'post/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?post_type=post&attachment=$matches[1]&cpage=$matches[2]',\n );\n $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;\n}", "private function findProductRewritesByFilter(array $data): array\n {\n if (empty($data[UrlRewrite::ENTITY_TYPE])) {\n return [];\n }\n $rewrites = [];\n $metadata = $data[UrlRewrite::METADATA] ?? [];\n if (isset($data[UrlRewrite::METADATA])) {\n unset($data[UrlRewrite::METADATA]);\n }\n $productsFromDb = $this->connection->fetchAll($this->prepareSelect($data));\n\n if (!empty($metadata['category_id'])) {\n $categoryId = $metadata['category_id'];\n $data[UrlRewrite::ENTITY_ID] = $categoryId;\n $data[UrlRewrite::ENTITY_TYPE] = 'category';\n $categoryFromDb = $this->connection->fetchRow($this->prepareSelect($data));\n foreach ($productsFromDb as $productFromDb) {\n $productUrl = $this->getBaseName($productFromDb[UrlRewrite::REQUEST_PATH]);\n $productFromDb[UrlRewrite::REQUEST_PATH] = str_replace(\n $this->getCategoryUrlSuffix($data[UrlRewrite::STORE_ID]),\n '',\n $categoryFromDb[UrlRewrite::REQUEST_PATH]\n )\n . '/' . $productUrl;\n $rewrites[] = $productFromDb;\n }\n } else {\n $rewrites = $productsFromDb;\n }\n\n return $rewrites;\n }", "function wck_flush_rewrite_rules() {\n\n $rules = get_option( 'rewrite_rules' );\n\n if( ! isset( $rules['(.+?)/pag/([^/]+)'] ) || ! isset( $rules['(.+?)/s/([^/]+)'] ) ) {\n global $wp_rewrite;\n\n $wp_rewrite->flush_rules();\n }\n\n}", "public static function addPatreonRewriteRules() {\r\n\t\tif ( get_option( 'patreon-enable-file-locking', false ) == false ) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\t// Check if htaccess exists, bail out if not\r\n\t\t\r\n\t\tif ( !file_exists( ABSPATH . '.htaccess' ) ) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\t\t\r\n\t\t$htaccess = file_get_contents( ABSPATH . '.htaccess' );\r\n\t\t\r\n\t\t// First remove the rules.\r\n\t\t\r\n\t\tself::removePatreonRewriteRules();\r\n\t\t\r\n\t\t// Move on to adding the rules, this will refresh the rules as well\r\n\t\t\r\n\t\t$upload_locations = wp_upload_dir();\r\n\r\n\t\t// We want the base upload location so we can account for any changes to date based subfolders in case there are\r\n\r\n\t\t$upload_dir = substr( wp_make_link_relative( $upload_locations['baseurl'] ) , 1 );\r\n\r\n\t\t$append = PHP_EOL . \"# BEGIN Patreon WordPress Image Protection\r\nRewriteEngine On\r\nRewriteBase /\t\t\r\nRewriteCond %{REQUEST_FILENAME} (\\.png|\\.jpg|\\.gif|\\.jpeg|\\.bmp)\r\nRewriteCond %{HTTP_REFERER} !^wp-admin [NC]\r\nRewriteRule ^\" . $upload_dir . \"/(.*)$ index.php?patreon_action=serve_patron_only_image&patron_only_image=$1 [QSA,L]\r\n# END Patreon WordPress\".PHP_EOL;\r\n\t\t\r\n \tfile_put_contents( ABSPATH .'.htaccess', $htaccess . $append );\r\n\t\t\r\n\t}", "function pfund_add_rewrite_rules( $flush_rules = true ) {\n\t$options = get_option( 'pfund_options' );\n\t$campaign_root = $options['campaign_slug'];\n\t$cause_root = $options['cause_slug'];\t\n\tif ( $options['campaign_listing'] ) {\n\t\tadd_rewrite_rule(\"$campaign_root$\", \"index.php?pfund_action=campaign-list\",'top');\n\t}\n\tadd_rewrite_rule($campaign_root.'/([0-9]+)/?', 'index.php?post_type=pfund_campaign&p=$matches[1]&preview=true','top');\n\tif ( $options['cause_listing'] ) {\n\t\tadd_rewrite_rule(\"$cause_root$\", \"index.php?pfund_action=cause-list\",'top');\n\t}\n\tif ( $flush_rules ) {\n\t\tflush_rewrite_rules();\n\t}\n}", "public function rewrite_step_rule() {\n\n\t\t$cf_permalink = Cartflows_Helper::get_permalink_settings();\n\n\t\tif ( isset( $cf_permalink['permalink_structure'] ) ) {\n\t\t\tswitch ( $cf_permalink['permalink_structure'] ) {\n\t\t\t\tcase '/cartflows_flow/%flowname%/cartflows_step':\n\t\t\t\t\tadd_rewrite_rule( '^' . $cf_permalink['permalink_flow_base'] . '/([^/]*)/' . $cf_permalink['permalink'] . '/([^\\/]*)/?', 'index.php?cartflows_step=$matches[2]', 'top' );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase '/cartflows_flow/%flowname%':\n\t\t\t\t\tadd_rewrite_rule( '^' . $cf_permalink['permalink_flow_base'] . '/([^/]*)/([^/]*)/?', 'index.php?cartflows_step=$matches[2]', 'top' );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase '/%flowname%/cartflows_step':\n\t\t\t\t\tadd_rewrite_rule( '([^/]*)/' . $cf_permalink['permalink'] . '/([^\\/]*)/?', 'index.php?cartflows_step=$matches[2]', 'top' );\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t}" ]
[ "0.730486", "0.72976923", "0.7234198", "0.70085776", "0.6892691", "0.68173087", "0.65155584", "0.6407107", "0.63179374", "0.6224767", "0.6124817", "0.61128193", "0.6063883", "0.60250133", "0.5995037", "0.59459496", "0.58866274", "0.58787996", "0.5868964", "0.5860501", "0.58136034", "0.57089", "0.5696728", "0.5694619", "0.5677487", "0.5662305", "0.56190854", "0.56051743", "0.5576062", "0.5560629" ]
0.76588863
0
This is simply a recursive function to build up the custom taxonomy hierarchy WP has a function that does something similar, but not exactly what I needed here
function getTermHierarchy($term, $custom_tax) { array_push($this->arr_customPostTermSlug, $term->slug); if ($term->parent > 0) { $this->getTermHierarchy(get_term($term->parent), $custom_tax); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function create_country_hierarchical_taxonomy() {\n \n// Add new taxonomy, make it hierarchical like categories\n//first do the translations part for GUI\n \n $labels = array(\n 'name' => _x( 'country', 'taxonomy general name' ),\n 'singular_name' => _x( 'country', 'taxonomy singular name' ),\n 'search_items' => __( 'Search countries' ),\n 'all_items' => __( 'All Countries' ),\n 'parent_item' => __( 'Parent country' ),\n 'parent_item_colon' => __( 'Parent \tcountry:' ),\n 'edit_item' => __( 'Edit country' ), \n 'update_item' => __( 'Update country' ),\n 'add_new_item' => __( 'Add New country' ),\n 'new_item_name' => __( 'New country Name' ),\n 'menu_name' => __( 'Countries' ),\n ); \n \n // Now register the taxonomy\n register_taxonomy('countries',array('voulunteer'), array(\n 'hierarchical' => true,\n 'labels' => $labels,\n 'show_ui' => true,\n 'show_in_rest' => true,\n 'show_admin_column' => true,\n 'query_var' => true,\n //'rewrite' => array( 'slug' => 'country' ),\n\t'rewrite' => array( 'slug' => 'country', 'with_front' => false ),\n ));\n \n}", "function build_taxonomies() {\n // custom tax\n register_taxonomy( 'main', 'post',\n array(\n 'hierarchical' => true, // true = acts like categories false = acts like tags\n 'label' => 'Categories',\n 'query_var' => true,\n 'show_admin_column' => true,\n 'public' => true,\n 'rewrite' => array( 'slug' => 'main-categories' ),\n '_builtin' => true\n ) );\n }", "function get_taxonomy_hierarchy_multiple( $taxonomies, $parent = 0 ) {\n\tif ( ! is_array( $taxonomies ) ) {\n\t\t$taxonomies = array( $taxonomies );\n\t}\n\n\t$results = array();\n\n\tforeach( $taxonomies as $taxonomy ){\n\t\t$terms = get_taxonomy_hierarchy( $taxonomy, $parent );\n\n\t\tif ( $terms ) {\n\t\t\t$results[ $taxonomy ] = $terms;\n\t\t}\n\t}\n\n\treturn $results;\n}", "function get_taxonomy_hierarchy( $taxonomy, $parent = 0 ) {\n\t// only 1 taxonomy\n\t$taxonomy = is_array( $taxonomy ) ? array_shift( $taxonomy ) : $taxonomy;\n\n\t// get all direct decendants of the $parent\n\t$terms = get_terms( $taxonomy, array( 'parent' => $parent, 'hide_empty' => false ) );\n\n\t// prepare a new array. these are the children of $parent\n\t// we'll ultimately copy all the $terms into this new array, but only after they\n\t// find their own children\n\t$children = array();\n\n\t// go through all the direct decendants of $parent, and gather their children\n\tforeach ( $terms as $term ){\n\t\t// recurse to get the direct decendants of \"this\" term\n\t\t$term->children = get_taxonomy_hierarchy( $taxonomy, $term->term_id );\n\n\t\t// add the term to our new array\n\t\t$children[ $term->term_id ] = $term;\n\t}\n\n\t// send the results back to the caller\n\treturn $children;\n}", "function buildPlayScriptTaxonomy()\n {\n $labels = array(\n 'name' => 'Story Genres',\n 'singular_name' => 'Story Genre',\n 'search_items' => 'Search All Story Genres',\n 'all_items' => 'All Story Genres',\n 'edit_item' => 'Edit Story Genre',\n 'update_item' => 'Update Story Genre',\n 'add_new_item' => 'Add New Story Genre',\n 'new_item_name' => 'New Story Genre',\n 'menu_name' => 'Story Genres'\n );\n\n register_taxonomy(\n 'genres',\n 'playscripts',\n array(\n 'hierarchical' => true,\n 'labels' => $labels,\n 'query_var' => true,\n 'rewrite' => array(\n 'slug' => 'genres',\n 'with_front' => true\n ),\n 'show_admin_column' => true\n )\n );\n }", "function build_taxonomies(){\n $city_labels = array(\n 'name' => __( 'Cidade', 'framework' ),\n 'singular_name' => __( 'Cidade', 'framework' ),\n 'search_items' => __( 'Pesquisar por Cidades', 'framework' ),\n 'popular_items' => __( 'Cidades populares', 'framework' ),\n 'all_items' => __( 'Todas as Cidades', 'framework' ),\n 'parent_item' => __( 'Parent Cidade', 'framework' ),\n 'parent_item_colon' => __( 'Parent Cidade:', 'framework' ),\n 'edit_item' => __( 'Editar Cidade', 'framework' ),\n 'update_item' => __( 'Atualizar Cidade', 'framework' ),\n 'add_new_item' => __( 'Adicionar nova Cidade', 'framework' ),\n 'new_item_name' => __( 'Nova Cidade', 'framework' ),\n 'separate_items_with_commas' => __( 'Separe Cidades com vírgulas', 'framework' ),\n 'add_or_remove_items' => __( 'Adicione ou remova Cidades', 'framework' ),\n 'choose_from_most_used' => __( 'Escolha das Cidades mais usadas', 'framework' ),\n 'menu_name' => __( 'Cidades', 'framework' )\n );\n\n register_taxonomy(\n 'property-city',\n array( 'property' ),\n array(\n 'hierarchical' => false,\n 'labels' => $city_labels,\n 'show_ui' => true,\n 'query_var' => true,\n 'rewrite' => array('slug' => __('property-city', 'framework'))\n )\n );\n ////////////\n $labels = array(\n 'name' => __( 'UF', 'framework' ),\n 'singular_name' => __( 'UF', 'framework' ),\n 'search_items' => __( 'Pesquisar por Estado', 'framework' ),\n 'popular_items' => __( 'Popular UF', 'framework' ),\n 'all_items' => __( 'Todas propriedades por Estado', 'framework' ),\n 'parent_item' => __( 'Parent Property Feature', 'framework' ),\n 'parent_item_colon' => __( 'Parent Property Feature:', 'framework' ),\n 'edit_item' => __( 'Edit Property Feature', 'framework' ),\n 'update_item' => __( 'Update Property Feature', 'framework' ),\n 'add_new_item' => __( 'Novo Estado', 'framework' ),\n 'new_item_name' => __( 'Novo Estado', 'framework' ),\n 'separate_items_with_commas' => __( 'Estados', 'framework' ),\n 'add_or_remove_items' => __( 'Adicione ou remova Estado', 'framework' ),\n 'choose_from_most_used' => __( 'Escolha dos Estados mais usados', 'framework' ),\n 'menu_name' => __( 'UF', 'framework' )\n );\n\n register_taxonomy(\n 'property-feature',\n array('property'),\n array(\n 'hierarchical' => false,\n 'labels' => $labels,\n 'show_ui' => true,\n 'query_var' => true,\n 'rewrite' => array('slug' => __('property-feature', 'framework'))\n )\n );\n /////////////\n $type_labels = array(\n 'name' => __( 'Tipo de Empreendimento', 'framework' ),\n 'singular_name' => __( 'Tipo de Empreendimento', 'framework' ),\n 'search_items' => __( 'Pesquisar por Tipo de Empreendimentos', 'framework' ),\n 'popular_items' => __( 'Populares Tipos de Empreendimentos', 'framework' ),\n 'all_items' => __( 'Todos os Tipos de Empreendimentos', 'framework' ),\n 'parent_item' => __( 'Parent Tipo de Empreendimento', 'framework' ),\n 'parent_item_colon' => __( 'Parent Tipo de Empreendimento:', 'framework' ),\n 'edit_item' => __( 'Editar Tipo de Empreendimento', 'framework' ),\n 'update_item' => __( 'Atualizar Tipo de Empreendimento', 'framework' ),\n 'add_new_item' => __( 'Adicionar novo Tipo de Empreendimento', 'framework' ),\n 'new_item_name' => __( 'Novo Tipo de Empreendimento Name', 'framework' ),\n 'separate_items_with_commas' => __( 'Separe Tipos de Empreendimentos por vírgula', 'framework' ),\n 'add_or_remove_items' => __( 'Adicione ou remova Tipos de Empreendimentos', 'framework' ),\n 'choose_from_most_used' => __( 'Escolha dos Tipos de Empreendimentos mais usados', 'framework' ),\n 'menu_name' => __( 'Tipos de Empreendimentos', 'framework' )\n );\n\n register_taxonomy(\n 'property-type',\n array( 'property' ),\n array(\n 'hierarchical' => false,\n 'labels' => $type_labels,\n 'show_ui' => true,\n 'query_var' => true,\n 'rewrite' => array('slug' => __('property-type', 'framework'))\n )\n );\n ////////////\n $status_labels = array(\n 'name' => __( 'Status do Empreendimento', 'framework' ),\n 'singular_name' => __( 'Status do Empreendimento', 'framework' ),\n 'search_items' => __( 'Pesquisar Status do Empreendimento', 'framework' ),\n 'popular_items' => __( 'Popular Status do Empreendimento', 'framework' ),\n 'all_items' => __( 'Todos os Status do Empreendimento', 'framework' ),\n 'parent_item' => __( 'Parent Status do Empreendimento', 'framework' ),\n 'parent_item_colon' => __( 'Parent Status do Empreendimento:', 'framework' ),\n 'edit_item' => __( 'Editar Status do Empreendimento', 'framework' ),\n 'update_item' => __( 'Atualizar Status do Empreendimento', 'framework' ),\n 'add_new_item' => __( 'Adicione novo Status do Empreendimento', 'framework' ),\n 'new_item_name' => __( 'Novo Status do Empreendimento', 'framework' ),\n 'separate_items_with_commas' => __( 'Separe Status do Empreendimento com vírgulas', 'framework' ),\n 'add_or_remove_items' => __( 'Adicione ou remova Status do Empreendimento', 'framework' ),\n 'choose_from_most_used' => __( 'Escolha do Status de Empreendimento mais usados ', 'framework' ),\n 'menu_name' => __( 'Status do Empreendimento', 'framework' )\n );\n\n register_taxonomy(\n 'property-status',\n array( 'property' ),\n array(\n 'hierarchical' => false,\n 'labels' => $status_labels,\n 'show_ui' => true,\n 'query_var' => true,\n 'rewrite' => array('slug' => __('property-status', 'framework'))\n )\n );\n}", "function hol_nav_menu_objects($sorted_menu_items, $args) {\n// get all post types that support the taxonomy 'category'\n $post_types = array_filter(\n get_post_types(array(), 'names'), '_filter_taxonomy'\n );\n// flatten the array\n $post_types = array_values($post_types);\n\n foreach ($sorted_menu_items as $menu_item) {\n if ( $menu_item->type == 'taxonomy' && $menu_item->object == \"category\" ) {\n $menu_item_parent = $menu_item->ID;\n $term_id = $menu_item->object_id;\n// go and get all posts in this category\n// @todo abstract out post_type to use all post_types that support this taxonomy type\n// @TODO add child categories into the list (currently we add them manually)\n $args = array(\n \"orderby\" => \"post_title\",\n \"order\" => \"ASC\",\n \"post_type\" => $post_types,\n \"numberposts\" => 100,\n \"posts_per_page\" => 100,\n 'tax_query' => array(\n array(\n 'taxonomy' => \"category\",\n 'field' => 'id',\n 'terms' => $term_id, // Where term_id of Term 1 is \"1\".\n 'operator' => \"IN\",\n 'include_children'=>0,\n ),\n ),\n );\n $query = new WP_Query( $args );\n $children = $query->posts;\n\n $i = 0;\n global $post;\n foreach ( $children as $child ) {\n $current = 0;\n if ( $post->ID == $child->ID ) {\n $current = 1;\n }\n/*\n print \"parent: \" . $menu_item_parent . \n \", term: \" . $term_id .\n \", child: \" . $child->ID .\n \"<br>\";\n*/\n// $child->ID = count($sorted_menu_items);\n $child->menu_item_parent = $menu_item_parent;\n $child->post_type = 'nav_menu_item';\n //$child->url = $child->guid;\n $child->url = get_permalink($child->ID);\n $child->title = $child->post_title;\n $child->menu_order = $i++;\n $child->object = 'post';\n $child->type = 'post_type';\n $child->type_label = 'Post';\n $child->target = '';\n $child->attr_title = '';\n $child->description = '';\n $child->xfn = '';\n $child->current = $current;\n/*\n we are missing these attributes\n object_id\n current 0:1\n current_item_ancestor ''\n current_item_parent ''\n*/\n $child->classes = array(\n 'menu-item',\n 'menu-item',\n 'menu-item-type-post_type',\n );\n// check for current-menu-item and current_post_item \n if ( $current ) {\n $child->classes[] = \"current-menu-item\";\n $child->classes[] = \"current_post_item\";\n }\n // the problem is that items end up in their parents and grandparents.\n // ignore grandparents if there is an appropriate parent\n array_push($sorted_menu_items, $child);\n }\n }\n }\n //print_r($sorted_menu_items);\n return $sorted_menu_items;\n }", "function _getTreeWithChildren() {\n\t\t$idField = $this->fields['id'];\n\t\t$parentField = $this->fields['parent'];\n\n\t\t$query = sprintf('select %s from %s', join(',', $this->_getFields()), $this->db->dbprefix( 'taxonomy_term_data' ));\n\t\t$query .= ' where t_type = '.$this->db->escape( $this->tax_type ).'';\n\t\t$query .= ' and language = '.$this->db->escape( $this->lang->get_current_lang() ).'';\n\n\t\t$result = $this->db->query($query);\n\n\t\t// create a root node to hold child data about first level items\n\t\t$root = new stdClass;\n\t\t$root->$idField = 0;\n\t\t$root->children = array();\n\n\t\t$arr = array($root);\n\n\t\t// populate the array and create an empty children array\n\t\tforeach ($result->result() as $row) {\n\t\t\t$arr[$row->$idField] = $row;\n\t\t\t$arr[$row->$idField]->children = array();\n\t\t}\n\n\t\t// now process the array and build the child data\n\t\tforeach ($arr as $id => $row) {\n\t\t\tif (isset($row->$parentField))\n\t\t\t\t$arr[$row->$parentField]->children[$id] = $id;\n\t\t}\n\n\t\treturn $arr;\n\t}", "function wpr_list_categories_walk( $parent = 0, $depth = 0, $args ) {\n\t$term_ids = get_terms( WPBDP_CATEGORY_TAX,\n\t\tarray(\n\t\t\t'orderby' => $args['orderby'],\n\t\t\t'order' => $args['order'],\n\t\t\t'hide_empty' => false,\n\t\t\t'pad_counts' => false,\n\t\t\t'parent' => is_object( $args['parent'] ) ? $args['parent']->term_id : intval( $args['parent'] ),\n\t\t\t'fields' => 'ids'\n\t\t)\n\t);\n\n\t$terms = array();\n\tforeach ( $term_ids as $term_id ) {\n\t\t$t = get_term( $term_id, WPBDP_CATEGORY_TAX );\n\t\t// 'pad_counts' doesn't work because of WP bug #15626 (see http://core.trac.wordpress.org/ticket/15626).\n\t\t// we need a workaround until the bug is fixed.\n\t\t_wpbdp_padded_count( $t );\n\n\t\t$terms[] = $t;\n\t}\n\n\t// filter empty terms\n\tif ( $args['hide_empty'] ) {\n\t\t$terms = array_filter( $terms, create_function( '$x', 'return $x->count > 0;' ) );\n\t}\n\n\t$html = '';\n\n\tif ( ! $terms && $depth === 0 ) {\n\t\tif ( $args['no_items_msg'] ) {\n\t\t\t$html .= '<p>' . $args['no_items_msg'] . '</p>';\n\t\t}\n\n\t\treturn $html;\n\t}\n\n\t$wpr_taxonomy_list = array();\n\tforeach ( $terms as &$term ) {\n\t\t$count_str = '';\n\t\tif ( $args['show_count'] ) {\n\t\t\t$count_str = ' <span class=\"wpr_count\">(' . intval( $term->count ) . ')</span>';\n\t\t\t$count_str = apply_filters( 'wpbdp_categories_item_count_str', $count_str, $term );\n\t\t}\n\n\t\t$wpr_children = array();\n\t\tif ( ! $args['parent_only'] ) {\n\t\t\t$args['parent'] = $term->term_id;\n\t\t\t$wpr_subcategories = wpr_list_categories_walk( $term->term_id, $depth + 1, $args );\n\t\t\tif ( ! empty( $wpr_subcategories ) ) {\n\t\t\t\t$wpr_children = $wpr_subcategories;\n\t\t\t}\n\t\t}\n\n\t\t$wpr_taxonomy_list[] = array(\n\t\t\t'taxonomy_title' => esc_attr( $term->name ),\n\t\t\t'tag_title' => esc_attr( strip_tags( apply_filters( 'category_description', $term->description, $term ) ) ),\n\t\t\t'count' => $count_str,\n\t\t\t'link' => esc_url( get_term_link( $term ) ),\n\t\t\t'subcategories' => $wpr_children\n\t\t);\n\t}\n\n\treturn $wpr_taxonomy_list;\n\n}", "function create_topics_hierarchical_taxonomy() {\n\n// Add new taxonomy, make it hierarchical like categories\n//first do the translations part for GUI\n\n $labels = array(\n 'name' => _x( 'Faculty Department', 'taxonomy general name' ),\n 'singular_name' => _x( 'Faculty Department', 'taxonomy singular name' ),\n 'search_items' => __( 'Search Faculty Department' ),\n 'all_items' => __( 'All Faculty Department' ),\n 'parent_item' => __( 'Parent Faculty Department' ),\n 'parent_item_colon' => __( 'Parent Faculty Department:' ),\n 'edit_item' => __( 'Edit Faculty Department' ),\n 'update_item' => __( 'Update Faculty Department' ),\n 'add_new_item' => __( 'Add New Faculty Department' ),\n 'new_item_name' => __( 'New Faculty Department Name' ),\n 'menu_name' => __( 'Faculty Department' ),\n );\n\n// // Now register the taxonomy\n//\n register_taxonomy('faculty-departments',array('faculty'), array(\n 'hierarchical' => true,\n 'labels' => $labels,\n 'show_ui' => true,\n 'show_admin_column' => true,\n 'query_var' => true,\n 'rewrite' => array( 'slug' => 'faculty-department' ),\n 'show_in_menu' => true,\n 'show_in_rest' => true,\n\t\t'rest_base' => 'faculty-department',\n\t\t'rest_controller_class' => 'WP_REST_Terms_Controller',\n ));\n\n}", "function create_topics_hierarchical_taxonomy() {\n\n// Add new taxonomy, make it hierarchical like categories\n//first do the translations part for GUI\n\n $labels = array(\n 'name' => _x( 'Classes', 'taxonomy general name' ),\n 'singular_name' => _x( 'Class', 'taxonomy singular name' ),\n 'search_items' => __( 'Search Classes' ),\n 'all_items' => __( 'All Classes' ),\n 'parent_item' => __( 'Parent Class' ),\n 'parent_item_colon' => __( 'Parent Class:' ),\n 'edit_item' => __( 'Edit Class' ),\n 'update_item' => __( 'Update Class' ),\n 'add_new_item' => __( 'Add New Class' ),\n 'new_item_name' => __( 'New Class Name' ),\n 'menu_name' => __( 'Specific Classes' ),\n );\n\n// Now register the taxonomy\n\n register_taxonomy('class-name',array('post'), array(\n 'hierarchical' => true,\n 'labels' => $labels,\n 'show_ui' => true,\n 'show_admin_column' => true,\n 'query_var' => true,\n 'rewrite' => array( 'slug' => 'class-name' ),\n ));\n\n}", "function build_taxonomies() {\n\t/*$labels = array(\n\t\t'name' => __( 'Tipos'),\n\t\t'singular_name' => __( 'Tipo'),\n\t\t'search_items' => __( 'Buscar' ),\n\t\t'popular_items' => __( 'Mais usados' ),\n\t\t'all_items' => __( 'Todos os Tipos' ),\n\t\t'parent_item' => null,\n\t\t'parent_item_colon' => null,\n\t\t'edit_item' => __( 'Adicionar novo' ),\n\t\t'update_item' => __( 'Atualizar' ),\n\t\t'add_new_item' => __( 'Adicionar novo' ),\n\t\t'new_item_name' => __( 'New' )\n\t\t); */\n\tregister_taxonomy('prod-category', array('products'),\n\t\tarray(\n\t\t\t'hierarchical' => true,\n\t\t\t//'labels' => $labels,\n\t\t\t//'singular_label' => 'Tipo',\n\t\t\t//'all_items' => 'Todos os prod-category',\n\t\t\t'query_var' => true,\n\t\t\t'rewrite' => array( 'slug' => 'prod-category' ))\n\t\t);\n}", "final public function get_hierarchical_taxonomies($args = array(), $output = 'objects'){\r\n\t\t\r\n\t\t//Define defaults\r\n\t\t$defaults = array(\r\n\t\t\t'public' => true\r\n\t\t);\r\n\t\t\r\n\t\t//Get all the taxonomies\r\n\t\t$tax_array = get_taxonomies(array_merge($defaults, $args), $output);\r\n\t\t\r\n\t\t//Quick check\r\n\t\tif(empty($tax_array)){\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\t\r\n\t\t//Begin iterate\r\n\t\t$new_tax_array = array();\r\n\t\tforeach($tax_array as $tax_obj){\r\n\t\t\tif($tax_obj->hierarchical === true){\r\n\t\t\t\t$new_tax_array[] = $tax_obj;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn $new_tax_array;\r\n\t\t\r\n\t}", "function get_child_page_tree( $post_id, $helper, $grandchildren = true ) {\n\n $args = [\n 'posts_per_page' => -1,\n 'post_type' => 'page',\n 'post_parent' => $post_id,\n 'post_status' => 'publish',\n 'orderby' => 'level',\n 'order' => 'ASC'\n ];\n $children = \\DustPress\\Query::get_acf_posts( $args );\n\n if ( is_array( $children ) ) {\n $order = array();\n foreach ( $children as $key => &$c ) {\n\n // format images and tags\n map_api_images( $c->fields['api_images'] );\n\n // format tags for tasks\n if ( $c->fields['api_type'] === 'task' ) {\n\n // remove level data if not level set, make sort array otherwise\n if ((int)$c->fields['level'] <= 0) {\n unset ($c->fields['level']);\n } else {\n $order[$key] = (int)$c->fields['level'] - 1;\n }\n map_api_tags( $c->fields['tags'] );\n }\n\n if ( $grandchildren ) {\n // get grandchildren\n $gc = get_child_page_tree( $c->ID, $helper );\n\n if ( is_array( $gc ) ) {\n $c->children = $gc;\n }\n }\n }\n\n // sort level -tasks by level\n if (!empty($order)) {\n array_multisort( $order, SORT_ASC, $children );\n }\n\n // return tree if something found\n return $children;\n }\n}", "function category($post_type) {\n $terms = get_the_terms( get_the_id(), get_taxonomy_name($post_type) );\n \n if ($terms) {\n foreach ( $terms as $term ) {\n $p = false;\n if ($term->parent) {\n $p = get_term($term->parent, $post_type === 'lwa_feature' ? 'featured_tax' : 'news_tax');\n }\n \n return array(\n 'id' => $term->term_id,\n 'name' => enc( $term->name ),\n 'permalink' => get_bloginfo('url') . \"/\" . ($post_type === 'lwa_feature' ? 'featured' : 'news') . \"/\". $term->slug,\n 'slug' => $term->slug,\n 'description' => $term->description,\n 'parent' => $p ? enc( $p->name ) : null,\n 'parentPermalink' => $p ? get_bloginfo('url') . \"/\" . ($post_type === 'lwa_feature' ? 'featured' : 'news') . \"/\". $p->slug : null\n );\n }\n }\n return null;\n}", "function tt_taxonomies() {\n $label_name = 'Type';\n $label_name_plural = 'Types';\n \n\t$labels = array(\n\t\t'name' => _x( $label_name, 'taxonomy general name' ),\n\t\t'singular_name' => _x( $label_name, 'taxonomy singular name' ),\n\t\t'search_items' => __( 'Search '.$label_name ),\n\t\t'all_items' => __( 'All '.$label_name_plural ),\n\t\t'parent_item' => __( 'Parent '.$label_name ),\n\t\t'parent_item_colon' => __( 'Parent '.$label_name.':' ),\n\t\t'edit_item' => __( 'Edit '.$label_name ),\n\t\t'update_item' => __( 'Update '.$label_name ),\n\t\t'add_new_item' => __( 'Add New '.$label_name ),\n\t\t'new_item_name' => __( 'New '.$label_name ),\n\t\t'menu_name' => __( $label_name ),\n\t);\n\t$args = array(\n\t\t'hierarchical' => true,\n\t\t'labels' => $labels,\n\t\t'show_ui' => true,\n\t\t'show_admin_column' => true,\n\t\t'query_var' => true,\n\t\t'rewrite' => array( 'slug' => $label_name ),\n\t);\n\tregister_taxonomy( $label_name, array( 'speaker' ), $args );\n}", "function my_taxonomies_undersokelse() {\n $labels = array(\n 'name' => _x( 'Kategori', 'taxonomy general name' ),\n 'singular_name' => _x( 'Kategori', 'taxonomy singular name' ),\n 'search_items' => __( 'Søk i kategori' ),\n 'all_items' => __( 'Alle elementer i kategori' ),\n 'parent_item' => __( 'Foreldreelementer i kategori' ),\n 'parent_item_colon' => __( 'Foreldreelement kategori:' ),\n 'edit_item' => __( 'Rediger kategori' ),\n 'update_item' => __( 'Oppdater foreldrekategori' ),\n 'add_new_item' => __( 'Lag ny kategori' ),\n 'new_item_name' => __( 'Ny kategori' ),\n 'menu_name' => __( 'Oversikt kategorier' ),\n );\n $args = array(\n 'labels' => $labels,\n 'hierarchical' => true,\n 'public' => true,\n 'query_var' => 'undersokelsekategori',\n 'rewrite' => array('slug' => 'undersokelse' ),\n '_builtin' => false,\n );\n register_taxonomy( 'undersokelsekategori', 'undersokelse', $args );\n}", "function create_state_hierarchical_taxonomy() {\n \n// Add new taxonomy, make it hierarchical like categories\n//first do the translations part for GUI\n \n $labels = array(\n 'name' => _x( 'States', 'taxonomy general name' ),\n 'singular_name' => _x( 'State', 'taxonomy singular name' ),\n 'search_items' => __( 'Search States' ),\n 'all_items' => __( 'All States' ),\n 'parent_item' => __( 'Parent state' ),\n 'parent_item_colon' => __( 'Parent \tstate:' ),\n 'edit_item' => __( 'Edit state' ), \n 'update_item' => __( 'Update state' ),\n 'add_new_item' => __( 'Add New state' ),\n 'new_item_name' => __( 'New state Name' ),\n 'menu_name' => __( 'states' ),\n ); \n \n// Now register the state taxonomy\n register_taxonomy('states',array('voulunteer'), array(\n 'hierarchical' => true,\n 'labels' => $labels,\n 'show_ui' => true,\n 'show_in_rest' => true,\n 'show_admin_column' => true,\n 'query_var' => true,\n //'rewrite' => array( 'slug' => 'state' ),\n\t'rewrite' => array( 'slug' => 'state', 'with_front' => false ),\n ));\n \n}", "function create_topics_hierarchical_taxonomy() {\n \n// Add new taxonomy, make it hierarchical like categories\n//first do the translations part for GUI\n \n $labels = array(\n 'name' => _x( 'Topics', 'taxonomy general name' ),\n 'singular_name' => _x( 'Topic', 'taxonomy singular name' ),\n 'search_items' => __( 'Search Topics' ),\n 'all_items' => __( 'All Topics' ),\n 'parent_item' => __( 'Parent Topic' ),\n 'parent_item_colon' => __( 'Parent Topic:' ),\n 'edit_item' => __( 'Edit Topic' ), \n 'update_item' => __( 'Update Topic' ),\n 'add_new_item' => __( 'Add New Topic' ),\n 'new_item_name' => __( 'New Topic Name' ),\n 'menu_name' => __( 'Topics' ),\n ); \n \n// Now register the taxonomy\n \n register_taxonomy('topics',array('post'), array(\n 'hierarchical' => true,\n 'labels' => $labels,\n 'show_ui' => true,\n 'show_admin_column' => true,\n 'query_var' => true,\n 'rewrite' => array( 'slug' => 'topic' ),\n ));\n \n}", "function ocs_admin_build_tree( $nodes, $meta_field, $depth_offset = 0)\n{\n // first calculate the depth\n $depthlist = array();\n foreach( $nodes as $node) {\n $path = _ocs_admin_build_path( $nodes, $node, $meta_field);\n\n $depth = count( $path);\n $depthlist[ $depth][] = array(\n 'db' => $node,\n 'title' => $node[ $meta_field['title']],\n 'mlid' => $node[ $meta_field['mlid']],\n 'plid' => $node[ $meta_field['plid']],\n 'depth' => $depth + $depth_offset,\n 'path' => $path,\n 'below' => array(),\n );\n }\n// dpm( $depthlist, 'depthlist');\n\n // build tree\n $depth = 1;\n $tree = array();\n while( isset( $depthlist[$depth])) {\n // check each depth as one by one\n foreach( $depthlist[ $depth] as $item) {\n // traverse path\n // dpm( $item['item']['path'], 'path');\n _ocs_admin_build_tree( $tree, $item['path'], $item);\n }\n\n $depth = $depth +1;\n }\n\n // depthlist[1][0] is the root node\n return array( $depthlist[1][0], $tree);\n}", "function ig_hierarchical_taxonomy_for_venues()\n{\n\n // Add new taxonomy, make it hierarchical like categories\n //first do the translations part for GUI\n\n $labels = array(\n 'name' => _x('Current Year Venue', 'taxonomy general name'),\n 'singular_name' => _x('Current Year Venue', 'taxonomy singular name'),\n 'search_items' => __('Search Current Year Venue'),\n 'all_items' => __('All Current Year Venue'),\n 'parent_item' => __('Parent Current Year Venue'),\n 'parent_item_colon' => __('Parent Current Year Venue:'),\n 'edit_item' => __('Edit Current Year Venue'),\n 'update_item' => __('Update Current Year Venue'),\n 'add_new_item' => __('Add New Current Year Venue'),\n 'new_item_name' => __('New Current Year Venue Name'),\n 'menu_name' => __('Current Year Venue'),\n );\n\n // Now register the taxonomy\n register_taxonomy('current_year_venue', array('venues'), array(\n 'hierarchical' => true,\n 'labels' => $labels,\n 'show_ui' => true,\n 'show_in_rest' => true,\n 'show_admin_column' => true,\n 'query_var' => true,\n 'rewrite' => array('slug' => 'current_year_venue'),\n ));\n}", "function mrc_create_genere_hierarchical_taxonomy() {\n \n// Add new taxonomy, make it hierarchical like categories\n//first do the translations part for GUI\n \n $labels = array(\n 'name' => _x( 'Genere', 'taxonomy general name' ),\n 'singular_name' => _x( 'Genere', 'taxonomy singular name' ),\n 'search_items' => __( 'Cerca Genere' ),\n 'all_items' => __( 'Tutti i Generi' ),\n 'parent_item' => __( 'Genere Genitore' ),\n 'parent_item_colon' => __( 'Genere Genitore:' ),\n 'edit_item' => __( 'Edita Genere' ), \n 'update_item' => __( 'Aggiorna Genere' ),\n 'add_new_item' => __( 'Aggiungi nuovo Genere' ),\n 'new_item_name' => __( 'Nuovo Genere Nome' ),\n 'menu_name' => __( 'Generi' ),\n ); \n \n// Now register the taxonomy\n \n register_taxonomy('genere',array('libri'), array(\n 'hierarchical' => true,\n 'labels' => $labels,\n 'show_ui' => true,\n 'show_admin_column' => true,\n 'query_var' => true,\n 'rewrite' => array( 'slug' => 'genere' ),\n ));\n \n}", "function acfe_get_taxonomy_terms_ids($taxonomies = array()){\n \n // force array\n $taxonomies = acf_get_array($taxonomies);\n \n // get pretty taxonomy names\n $taxonomies = acf_get_taxonomy_labels($taxonomies);\n \n // vars\n $r = array();\n \n // populate $r\n foreach(array_keys($taxonomies) as $taxonomy){\n \n // vars\n $label = $taxonomies[$taxonomy];\n $is_hierarchical = is_taxonomy_hierarchical($taxonomy);\n \n $terms = acf_get_terms(array(\n 'taxonomy' => $taxonomy,\n 'hide_empty' => false\n ));\n \n // bail early if no terms\n if(empty($terms))\n continue;\n \n // sort into hierachial order!\n if($is_hierarchical){\n \n $terms = _get_term_children(0, $terms, $taxonomy);\n \n }\n \n // add placeholder\n $r[ $label ] = array();\n \n // add choices\n foreach($terms as $term){\n \n $k = \"{$term->term_id}\";\n $r[$label][$k] = acf_get_term_title($term);\n \n }\n \n }\n \n // return\n return $r;\n \n}", "function hierarchical_category_tree( $cat ) {\n // wpse-41548 // alchymyth // a hierarchical list of all categories //\n\n $next = get_categories('hide_empty=false&orderby=name&order=ASC&parent=' . $cat);\n\n if( $next ) : \n foreach( $next as $cat ) :\n echo '<ul><li>';\n echo ' <a href=\"' . get_category_link( $cat->term_id ) . '\" title=\"' . sprintf( __( \"View all posts in %s\" ), $cat->name ) . '\" ' . '>'. $cat->name .' </a> '; \n hierarchical_category_tree( $cat->term_id );\n endforeach; \n endif;\n\n echo '</li></ul>'; echo \"\\n\";\n }", "function my_taxonomies_klagebrev() {\n $labels = array(\n 'name' => _x( 'Kategori', 'taxonomy general name' ),\n 'singular_name' => _x( 'Kategori', 'taxonomy singular name' ),\n 'search_items' => __( 'Søk i kategori' ),\n 'all_items' => __( 'Alle elementer i kategori' ),\n 'parent_item' => __( 'Foreldreelementer i kategori' ),\n 'parent_item_colon' => __( 'Foreldreelement kategori:' ),\n 'edit_item' => __( 'Rediger kategori' ),\n 'update_item' => __( 'Oppdater foreldrekategori' ),\n 'add_new_item' => __( 'Lag ny kategori' ),\n 'new_item_name' => __( 'Ny kategori' ),\n 'menu_name' => __( 'Oversikt kategorier' ),\n );\n $args = array(\n 'labels' => $labels,\n 'hierarchical' => true,\n 'public' => true,\n 'query_var' => 'klagebrevkategori',\n 'rewrite' => array('slug' => 'klagebrev' ),\n '_builtin' => false,\n );\n register_taxonomy( 'klagebrevkategori', 'klagebrev', $args );\n}", "function generate_ntree()\n{\n $categories = Db::getInstance()->executeS('SELECT id_category, id_parent FROM ' . _DB_PREFIX_ . 'category ORDER BY id_parent ASC, position ASC');\n $categoriesArray = [];\n if (is_array($categories)) {\n foreach ($categories as $category) {\n $categoriesArray[(int) $category['id_parent']]['subcategories'][(int) $category['id_category']] = 1;\n }\n }\n $n = 1;\n generate_ntree_subTree($categoriesArray, 1, $n);\n}", "function subCategoryTemplateHierarchy()\n{\n $category = get_queried_object();\n $templates = [];\n\n if ($category instanceof WP_Term) {\n if (isset($category->slug)) {\n $slugDecoded = urldecode($category->slug);\n\n if ($slugDecoded !== $category->slug) {\n $templates[] = \"category-{$slugDecoded}.php\";\n }\n\n $templates[] = \"category-{$category->slug}.php\";\n $templates[] = \"category-{$category->term_id}.php\";\n }\n\n if (!empty($category->parent)) {\n $parent = get_category($category->parent);\n\n if ($parent) {\n $templates[] = \"category-{$parent->slug}.php\";\n $templates[] = \"category-{$parent->term_id}.php\";\n }\n }\n }\n\n $templates[] = 'category.php';\n\n return locate_template($templates);\n}", "function my_taxonomies_guide() {\n $labels = array(\n 'name' => _x( 'Kategori', 'taxonomy general name' ),\n 'singular_name' => _x( 'Kategori', 'taxonomy singular name' ),\n 'search_items' => __( 'Søk i kategori' ),\n 'all_items' => __( 'Alle elementer i kategori' ),\n 'parent_item' => __( 'Foreldreelementer i kategori' ),\n 'parent_item_colon' => __( 'Foreldreelement kategori:' ),\n 'edit_item' => __( 'Rediger kategori' ),\n 'update_item' => __( 'Oppdater foreldrekategori' ),\n 'add_new_item' => __( 'Lag ny kategori' ),\n 'new_item_name' => __( 'Ny kategori' ),\n 'menu_name' => __( 'Oversikt kategorier' ),\n );\n $args = array(\n 'labels' => $labels,\n 'hierarchical' => true,\n 'public' => true,\n 'query_var' => 'guidekategori',\n 'rewrite' => array('slug' => 'guide' ),\n '_builtin' => false,\n );\n register_taxonomy( 'guidekategori', 'guide', $args );\n}", "function media_dei_custom_taxonomy() {\n\n $labels = array(\n 'name' => _x( 'Categories', 'Taxonomy General Name', 'text_domain' ),\n 'singular_name' => _x( 'Category', 'Taxonomy Singular Name', 'text_domain' ),\n 'menu_name' => __( 'Media Dei Document Categories', 'text_domain' ),\n 'all_items' => __( 'All Categories', 'text_domain' ),\n 'parent_item' => __( 'Parent Category', 'text_domain' ),\n 'parent_item_colon' => __( 'Parent Category:', 'text_domain' ),\n 'new_item_name' => __( 'New Category', 'text_domain' ),\n 'add_new_item' => __( 'Add New Category', 'text_domain' ),\n 'edit_item' => __( 'Edit Category', 'text_domain' ),\n 'update_item' => __( 'Update Category', 'text_domain' ),\n 'view_item' => __( 'View Category', 'text_domain' ),\n 'separate_items_with_commas' => __( 'Separate Categories with commas', 'text_domain' ),\n 'add_or_remove_items' => __( 'Add or remove Categories', 'text_domain' ),\n 'choose_from_most_used' => __( 'Choose from the most used', 'text_domain' ),\n 'popular_items' => __( 'Popular Categories', 'text_domain' ),\n 'search_items' => __( 'Search Categories', 'text_domain' ),\n 'not_found' => __( 'Not Found', 'text_domain' ),\n 'no_terms' => __( 'No Categories', 'text_domain' ),\n 'items_list' => __( 'Categories list', 'text_domain' ),\n 'items_list_navigation' => __( 'Categories list navigation', 'text_domain' ),\n );\n $args = array(\n 'labels' => $labels,\n 'hierarchical' => false,\n 'public' => true,\n 'show_ui' => true,\n 'show_admin_column' => true,\n 'show_in_nav_menus' => true,\n 'show_tagcloud' => true,\n );\n register_taxonomy( 'Category', array( 'document' ), $args );\n\n}", "function portfolio_categories_build_taxonomies() {\n\t\tregister_taxonomy(__( \"portfolio_categories\" , 'mav' ), array(__( \"portfolio\" , 'mav' )), array(\"hierarchical\" => true, \"label\" => __( \"Categories\" , 'mav' ), \"singular_label\" => __( \"Portfolio Categories\" , 'mav' ), \"rewrite\" => array('slug' => 'portfolio_categories', 'hierarchical' => true)));\n\t}" ]
[ "0.6715422", "0.6547081", "0.65410465", "0.65083116", "0.6487039", "0.6467057", "0.6460388", "0.64505666", "0.64268893", "0.64118963", "0.6409999", "0.6396635", "0.6390351", "0.6365211", "0.63609815", "0.6341789", "0.63394773", "0.6334488", "0.63310534", "0.6321458", "0.62849635", "0.62819993", "0.6269083", "0.6261428", "0.625993", "0.62596136", "0.62542856", "0.62405723", "0.6187663", "0.6162718" ]
0.659049
1
Gets query for [[Chapterlanguages]].
public function getChapterlanguages() { return $this->hasMany(Chapterlanguage::className(), ['fklanguage' => 'idlanguage']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLanguages()\n {\n $query = $this->db->get(\"language\");\n return $query;\n }", "public function query()\n {\n return Language::query();\n }", "public function get_languages()\n {\n return $this->found_languages;\n }", "public function getActiveLanguages() {\n\n return $this->findBy(array('isActive' => true), array('sort' => 'ASC'));\n }", "public function getAllLanguages($id);", "private function getLanguages()\n {\n return Language::find()->select(['id', 'code'])->orderBy(['default' => SORT_DESC, 'id' => SORT_DESC])->asArray()->all();\n }", "public function getLanguages($mixID);", "public function expertLanguages($id){\n $languages = ExpertLanguages::select('language', 'id as value')->where('expert_id', $id)->orderBy('language', 'asc')->get();\n return $languages;\n }", "public function getAvailableLanguages ();", "public function getChapter();", "public function languages()\n {\n return $this->hasMany(Language::class);\n }", "public function languages()\n {\n return $this->hasMany('App\\ElderlyLanguage');\n }", "public function getAllLanguages()\n {\n return array('de');\n }", "public function getEnabledLanguages();", "public function getFkchapters()\n {\n return $this->hasMany(Chapter::className(), ['idcapter' => 'fkchapter'])->viaTable('chapterlanguage', ['fklanguage' => 'idlanguage']);\n }", "public function getLanguages()\n {\n return $this->request->send(\"translations/v1/languages\");\n }", "public static function listLanguages()\r\n {\r\n static $data=array();\r\n \r\n if(empty($data))\r\n {\r\n $data = self::model()->findAll(array('order'=>'title_native', 'condition'=>'published=1'));\r\n }\r\n \r\n return $data;\r\n }", "public function getTermLanguages()\n {\n return $this->hasMany(TermLanguage::className(), ['term_id' => 'id']);\n }", "public static function getAll() {\n\tself::create();\n\treturn self::$instance->languages;\n }", "public function getLang();", "public function lstLanguage(){\r\n\t\t$Sql = \"SELECT\r\n\t\t\t\t\tlanguage_id,\r\n\t\t\t\t\tlanguage_name,\r\n\t\t\t\t\tis_active\r\n\t\t\t\tFROM\r\n\t\t\t\t\trs_tbl_language\r\n\t\t\t\tWHERE\r\n\t\t\t\t\t1=1\";\r\n\t\tif($this->isPropertySet(\"language_id\", \"V\"))\r\n\t\t\t$Sql .= \" AND language_id=\" . $this->getProperty(\"language_id\");\r\n\t\t\r\n\t\tif($this->isPropertySet(\"search\", \"V\"))\r\n\t\t\t$Sql .= \" AND language_name LIKE '%%%\" . $this->getProperty(\"search\").\"%%%'\";\r\n\t\t\t\r\n\t\tif($this->isPropertySet(\"is_active\", \"V\"))\r\n\t\t\t$Sql .= \" AND is_active=\" . $this->getProperty(\"is_active\");\r\n\t\t\r\n\t\tif($this->isPropertySet(\"ORDERBY\", \"V\"))\r\n\t\t\t$Sql .= \" ORDER BY \" . $this->getProperty(\"ORDERBY\");\r\n\t\t\r\n\t\tif($this->isPropertySet(\"limit\", \"V\"))\r\n\t\t\t$Sql .= $this->appendLimit($this->getProperty(\"limit\"));\r\n\r\n\t\treturn $this->dbQuery($Sql);\r\n\t}", "public function getListChapters()\n\t{\n\t\t$db = $this->dbConnect();\n\t\t$listChapter = $db->query('SELECT idChapter, numChapter, title, texte FROM chapter ORDER BY numChapter ASC');\n\t\treturn $listChapter;\n\t}", "public function all() {\n\n return $this->languages;\n\n }", "public function listlang()\r\n {\r\n $getLang = new Model_DbTable_Language();\r\n \r\n $lang = $getLang->getAllLang();\r\n \r\n \r\n return $lang;\r\n \r\n }", "public function getLanguages() {\n return $this->langSource->getAllLanguages(); \n }", "private function language(){\r\n\t\t$em = $this->container->get('doctrine')->getManager();\t\r\n\t\t$query = $em->createQuery(\"SELECT p FROM MytripAdminBundle:Language p\");\t\t\t\r\n\t\treturn $query->getArrayResult();\r\n\t}", "function availableLangs() {\n $objLang = new Language();\n //$conditions = $this->Access->isAdmin() ? array() : array('visible' => 1);\n $conditions = array();\n return $objLang->find('list', array('conditions' => $conditions));\n }", "protected function get_all_languages(){\n $this->languages = array();\n $i = 1;\n $this->languages['en'] = (object)array('id'=>$i++, 'name'=>'english', url=>'/en/');\n $this->languages['fr'] = (object)array('id'=>$i++, 'name'=>'francais', url=>'/fr/');\n $this->languages['nl'] = \n (object)array('id'=>$i++, 'name'=>'nederlands', url=>'/nl/');\n $this->languages['de'] = (object)array('id'=>$i++, 'name'=>'deutsch', url=>'/de/');\n }", "function get_langs($active=false)\r\n\t{\r\n\t\tglobal $db;\r\n\t\t$cond = NULL;\r\n\t\tif($active)\r\n\t\t\t$cond = \" language_active='yes' \";\r\n\t\t$results = $db->select(tbl(\"languages\"),\"*\",$cond);\r\n\t\treturn $results;\r\n\t}", "public function languageExams(){\n\t\treturn $this->languageExams;\n\t}" ]
[ "0.63893545", "0.6286958", "0.61051583", "0.600559", "0.5975316", "0.593966", "0.59368616", "0.58898085", "0.5801237", "0.57898754", "0.5773666", "0.57578415", "0.5743425", "0.57308304", "0.5720363", "0.5713641", "0.5711686", "0.57038504", "0.56806976", "0.5674223", "0.56552386", "0.56441015", "0.56323355", "0.5611197", "0.5605081", "0.5602489", "0.56015474", "0.5597682", "0.5589123", "0.55809784" ]
0.74926704
0
Gets query for [[Fkchapters]].
public function getFkchapters() { return $this->hasMany(Chapter::className(), ['idcapter' => 'fkchapter'])->viaTable('chapterlanguage', ['fklanguage' => 'idlanguage']); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function chapters(){\n return $this->hasMany(Chapter::class);\n }", "public function getListChapters()\n\t{\n\t\t$db = $this->dbConnect();\n\t\t$listChapter = $db->query('SELECT idChapter, numChapter, title, texte FROM chapter ORDER BY numChapter ASC');\n\t\treturn $listChapter;\n\t}", "public function getList()\n {\n $chapters = [];\n $req = $this->db->prepare('SELECT id, title, content, num_chapter, DATE_FORMAT(created_at, \\'%d/%m/%Y à %Hh%i\\') AS created_at FROM chapters ORDER BY created_at DESC');\n $req->execute();\n while ($data = $req->fetch()) {\n $chapters[] = new Chapter($data);\n }\n return $chapters;\n }", "public function getChapter()\n {\n return $this->hasOne(TblChapter::className(), ['id_chapter' => 'id_chapter']);\n }", "public function getChapter();", "public function chapters ()\n {\n return $this->belongsTo(Chapters::class);\n }", "public function getFkchapter0()\n {\n return $this->hasOne(Chapter::className(), ['idcapter' => 'fkchapter']);\n }", "public function get_chapter($params = [])\n {\n // Validate\n $v = $this->validator($params);\n $v->set_rules('textbook_id', '教科書ID', 'required|integer');\n\n if (FALSE === $v->run()) {\n return $v->error_json();\n }\n\n // If there is no params to find return\n if (empty($params['textbook_id']) && empty($params['chapter_name'])) {\n return $this->false_json(self::BAD_REQUEST);\n }\n\n // Load model\n $this->load->model('textbook_content_model');\n\n // Add the textbook_id condition\n if (!empty($params['textbook_id'])) {\n $this->textbook_content_model->where(\n 'textbook_content.textbook_id', $params['textbook_id']\n );\n }\n\n // Add the textbook_name condition\n if (!empty($params['chapter_name'])) {\n $this->textbook_content_model->where(\n 'textbook_content.chapter_name', $params['chapter_name']\n );\n }\n\n // Get textbook info\n $res = $this->textbook_content_model\n ->calc_found_rows()\n ->select('textbook_content.id, textbook_content.textbook_id, textbook_content.name, textbook_content.chapter_name ')\n ->select('textbook_content.description, textbook_content.order, textbook_content.deck_id, schooltv_content.deck_video_inuse.video_id')\n ->join('schooltv_content.deck_video_inuse', 'schooltv_content.deck_video_inuse.deck_id = textbook_content.deck_id', 'left')\n ->order_by('textbook_content.order', 'ASC')\n ->all();\n\n // Return\n return $this->true_json([\n 'items' => $this->build_responses($res, ['chapter_detail']),\n 'total' => (int) $this->textbook_content_model->found_rows()\n ]);\n }", "public function get_chapter_detail($params = [])\n {\n // Validate\n $v = $this->validator($params);\n $v->set_rules('chapter_id', '単元ID', 'required|integer');\n\n if (FALSE === $v->run()) {\n return $v->error_json();\n }\n\n // Load model\n $this->load->model('textbook_content_model');\n\n // Get textbook info\n $res = $this->textbook_content_model\n ->calc_found_rows()\n ->select('textbook_content.id, textbook_content.textbook_id, textbook_content.name, textbook_content.chapter_name ')\n ->select('textbook_content.description, textbook_content.order, textbook_content.deck_id')\n ->where('textbook_content.id', (int) $params['chapter_id'])\n ->first();\n\n // Return\n return $this->true_json($this->build_responses($res, [\n 'chapter_detail'\n ]));\n }", "public function getChapterlanguages()\n {\n return $this->hasMany(Chapterlanguage::className(), ['fklanguage' => 'idlanguage']);\n }", "function chapterList(){\n $query = \"SELECT * FROM \" . $this->table_name . \" where subjectId=?\";\n \n // prepare query statement\n $stmtchapter = $this->conn->prepare($query); \n $stmtchapter->bindParam(1, $this->subjectId); \n // execute query\n $stmtchapter->execute();\n return $stmtchapter;\n }", "public function chaptersList() {\n\t\t$page = $this->page;\n\t\t$chapterList = \"\";\n\t\tif(count($this->chapters) > 1) {\n\t\t\t$chapterList .= \"<select class='reader--chapters-list uk-select'>\";\n\t\t\tforeach($this->chapters as $chapter) {\n\t\t\t\t$selected = ($this->page->name == $chapter) ? \"selected='selected'\" : \"\";\n\t\t\t\t$chapterList .= \"<option value='{$chapter}' {$selected}>Chapter {$chapter}</option>\";\n\t\t\t}\n\t\t\t$chapterList .= \"</select>\";\n\t\t}\n\t\treturn $chapterList;\n\t}", "public function getChapters() {\n\t\tif (!$this->isLibrary()) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif ($this->chapters === null) {\n\t\t\t// get posts from cache\n\t\t\t$this->chapters = 0;\n\t\t\t$cache = WCF::getCache()->get('libraryData', 'counts');\n\t\t\tif (isset($cache[$this->libraryID]['chapters']))\n\t\t\t\t$this->chapters = $cache[$this->libraryID]['chapters'];\n\t\t}\n\n\t\treturn $this->chapters;\n\t}", "public static function get_chapters_by_story_id($story_id = 0, $count = 15, $page = 1, $is_newest = false) {\n $chapters = [];\n $total = 0;\n if ($story_id) {\n $order_by = array('id', 'asc');\n if ($is_newest){\n $order_by = array('id', 'desc');\n }\n $chapters = self::select('id', 'title', 'created_at', 'modified_at')\n ->where('story_id', $story_id)\n ->orderby($order_by[0], $order_by[1])\n ->offset(($page - 1) * $count)\n ->limit($count)\n ->get();\n\n// $total = DB::select('SELECT FOUND_ROWS()');\n }\n return $chapters;\n }", "function getChapters($object) {\n if (!$object) {\n $object = new chapter();\n }\n\n $object->Select(array('ch_id', 'ch_title'), '', null, 1, null, false);\n\n $cntRows = $object->RowCount();\n\n if (!$cntRows) {\n $chapters = '<div class=\"menuitem\" id=\"chapters\"><a href=\"chapters.php\">Chapters</a></div>';\n } else {\n $chapters = '\n <div class=\"menuitem\" id=\"chapters\"><a href=\"javascript:revelerCacherSousNav(\\'chapters\\')\">Chapters</a></div>\n <div id=\"chapters_sub\" style=\"display: none\">\n <div class=\"hiddendiv\">';\n\n while (!$object->EOF()) {\n $row = $object->Row();\n\n $chapters .= '\n <div class=\"linksstyle\"><a href=\"chapters.php?ch_id=' . $row->ch_id . '\" id=\"chapters_sub_' . $row->ch_id . '\">' . $row->ch_title . '</a></div>\n <br style=\"line-height:2px;\" />';\n }\n\n $chapters .= '\n </div> \n <div class=\"bordertop1pxblue\"></div>\n </div>';\n }\n\n return $chapters;\n}", "public function getBookChapters() // {{{\n {\n global $CCV_CONST;\n $records = array();\n $elements = $this->m_xpath->query(\"//section[@id='fd8f2ffe3f5c43db8b5c3f72d8ffd994']\");\n for ($i = 0; !is_null($elements) && $i < $elements->length; $i++)\n {\n $id = $this->get_xpath(\"@recordId\", $elements->item($i));\n $record = array();\n $record[\"booktitle\"] = $this->get_xpath(\"field[@id='b864a9512e89482487f83ed22c454e9d']/value\", $elements->item($i));\n $record[\"title\"] = $this->get_xpath(\"field[@id='52a699a6b0fe42a4851a7d5ae355360b']/value\", $elements->item($i));\n $record[\"authors\"] = $this->get_xpath(\"field[@id='5bc7b0b361f843d296e0e035b4b87176']/value\", $elements->item($i));\n $record[\"editors\"] = $this->get_xpath(\"field[@id='dcb27492e1554fc9838992ba7c70f416']/value\", $elements->item($i));\n $record[\"pages\"] = $this->get_xpath(\"field[@id='45b9d02a4bb04ec782357741b53dc135']/value\", $elements->item($i));\n $record[\"url\"] = $this->get_xpath(\"field[@id='6f1c66fc402d4b0db3d9987e2c5d49e8']/value\", $elements->item($i));\n $record[\"publisher\"] = $this->get_xpath(\"field[@id='51a088349c1442238d5d0331d95f3205']/value\", $elements->item($i));\n $record[\"status\"] = $this->get_xpath(\"field[@id='cf36bbd2e16c45cba9768a84ac2d6729']/lov/@id\", $elements->item($i));\n $pr = $this->get_xpath(\"field[@id='51bd72e89f85442a9ae199e75fe5e765']/lov/@id\", $elements->item($i));\n if ($pr === $CCV_CONST[\"Yes-No\"][\"Yes\"])\n $record[\"peer_reviewed\"] = true;\n elseif ($pr === $CCV_CONST[\"Yes-No\"][\"No\"])\n $record[\"peer_reviewed\"] = false;\n $record[\"journal\"] = $this->get_xpath(\"field[@id='5c04ea4dae464499807d0b40b4cad049']/value\", $elements->item($i));\n $date = $this->get_xpath(\"field[@id='c114eabcd4674f3c9467b2bf6820cbd6']/value\", $elements->item($i));\n @list($date_year, $date_month) = explode(\"/\", $date);\n $record[\"date_year\"] = $date_year;\n $record[\"date_month\"] = $date_month;\n $records[$id] = $record;\n }\n return $records;\n }", "public function getLastChapters()\n {\n $request = $this->db->query('SELECT id, title, number, text, DATE_FORMAT(creation_date,\\'%d/%m/%y\\') AS creationDate FROM chapter ORDER BY creation_date DESC LIMIT 3');\n $results = $request->fetchAll(PDO::FETCH_ASSOC);\n $chapters = [];\n foreach($results as $data)\n {\n $objArticle = new Chapter($data);\n $chapters[] = $objArticle;\n }\n return $chapters;\n }", "public function getChapter()\n {\n return $this->chapter;\n }", "public function chapter_kurals($id)\n {\n $kurals = Kural::where('chapter_id', $id)->get();\n return KuralResource::collection($kurals);\n }", "function getListChapter($id) {\n\t\t$model = new NovelModel;\n\t\t$res = $model->getListChapter($id);\n\t\tforeach ($res as $row) {\n\t\t\techo '<tr><td><a href=\"/enovel/novel/'.$id.'/'.$row[\"id\"].'\">'.$row['ten'].'</a></td>\n\t\t\t <td><a href=\"read.php\">'.$row['ngaytao'].'</a></td>\n\t\t\t </tr>\n\t\t\t <tr>';\n\t\t}\n\t}", "public function getChapter() {\n\t\treturn $this->chapter;\n\t}", "public function getChapterSort();", "public function model()\n {\n return Chapter::class;\n }", "public function listChapter(Story $id)\n {\n $chapters = $id->chapters()->paginate(20);\n $story = $id;\n //return\n return view('admin.chapter.list', compact('story', 'chapters'));\n }", "abstract public function getListOf($chapter);", "public function byChapterID($chapter_id, $with = array());", "public function index()\n {\n $chapters = Chapter::all();\n\nreturn $chapters;\n }", "function getChapter() {\n\t\treturn $this->Analysis_Context->getChapter();\n\t}", "function chapterDetails(){\n $query = \"SELECT * FROM \" . $this->table_name . \" where chapterId=?\";\n \n // prepare query statement\n $stmtchapterdetails = $this->conn->prepare($query); \n $stmtchapterdetails->bindParam(1, $this->chapterId);\n // execute query\n $stmtchapterdetails->execute();\n return $stmtchapterdetails;\n }", "public function getIdChapters(): array\n {\n $db = $this->dbConnect();\n $req = $db->query('SELECT id FROM chapters');\n $tab = array();\n\n while ($data = $req->fetch())\n {\n array_push($tab, $data['id']);\n }\n\n return $tab;\n }" ]
[ "0.66263205", "0.64119434", "0.6292201", "0.6223291", "0.6182981", "0.6173493", "0.59048593", "0.5882161", "0.5780072", "0.5774639", "0.57599187", "0.5638654", "0.56231886", "0.54611546", "0.54510826", "0.5435587", "0.5434149", "0.54316705", "0.5401289", "0.5341325", "0.52536476", "0.5236875", "0.52149135", "0.5213252", "0.51961744", "0.5188758", "0.5180568", "0.5114971", "0.5112293", "0.5108198" ]
0.7821817
0
/ Eemail template To send email in proper html format Params: 1, $resetpasswordlink= link to resetpassword Returns/Results load html body
function emailtemplate($resetlink){ return <<<EOD <!DOCTYPE html"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="viewport" content="width=device-width" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>CometChat Admin Panel password reset</title> <style> * { margin: 0; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; } img { max-width: 100%; } body { -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6em; } table td { vertical-align: top; } body { background-color: #f6f6f6; } .body-wrap { background-color: #f6f6f6; width: 100%; } .container { display: block !important; max-width: 600px !important; margin: 0 auto !important; clear: both !important; } .content { max-width: 600px; margin: 0 auto; display: block; padding: 20px; } .main { background-color: #fff; border: 1px solid #e9e9e9; border-radius: 3px; } .content-wrap { padding: 20px; } .content-block { padding: 0 0 20px; } .header { width: 100%; margin-bottom: 20px; } .footer { width: 100%; clear: both; color: #999; padding: 20px; } .footer p, .footer a, .footer td { color: #999; font-size: 12px; } h1, h2, h3 { font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; color: #000; margin: 40px 0 0; line-height: 1.2em; font-weight: 400; } h1 { font-size: 32px; font-weight: 500; } h2 { font-size: 24px; } h3 { font-size: 18px; } h4 { font-size: 14px; font-weight: 600; } p, ul, ol { margin-bottom: 10px; font-weight: normal; } p li, ul li, ol li { margin-left: 5px; list-style-position: inside; } a { color: #348eda; text-decoration: underline; } .btn-primary { text-decoration: none; color: #FFF; background-color: #348eda; border: solid #348eda; border-width: 10px 20px; line-height: 2em; font-weight: bold; text-align: center; cursor: pointer; display: inline-block; border-radius: 5px; text-transform: capitalize; } .last { margin-bottom: 0; } .first { margin-top: 0; } .aligncenter { text-align: center; } .alignright { text-align: right; } .alignleft { text-align: left; } .clear { clear: both; } .alert { font-size: 16px; color: #fff; font-weight: 500; padding: 20px; text-align: center; border-radius: 3px 3px 0 0; } .alert a { color: #fff; text-decoration: none; font-weight: 500; font-size: 16px; } .alert.alert-warning { background-color: #FF9F00; } .alert.alert-bad { background-color: #D0021B; } .alert.alert-good { background-color: #68B90F; } /* ------------------------------------- RESPONSIVE AND MOBILE FRIENDLY STYLES ------------------------------------- */ @media only screen and (max-width: 640px) { body { padding: 0 !important; } h1, h2, h3, h4 { font-weight: 800 !important; margin: 20px 0 5px !important; } h1 { font-size: 22px !important; } h2 { font-size: 18px !important; } h3 { font-size: 16px !important; } .container { padding: 0 !important; width: 100% !important; } .content { padding: 0 !important; } .content-wrap { padding: 10px !important; } .invoice { width: 100% !important; } } </style> </head> <body itemscope itemtype="http://schema.org/EmailMessage"> <table class="body-wrap"> <tr> <td></td> <td class="container" width="600"> <div class="content"> <table class="main" width="100%" cellpadding="0" cellspacing="0" itemprop="action" itemscope itemtype="http://schema.org/ConfirmAction"> <tr> <td class="content-wrap"> <meta itemprop="name" content="Confirm Email"/> <table width="100%" cellpadding="0" cellspacing="0"> <tr> <td class="content-block aligncenter"> <img src='https://www.cometchat.com/public/img/newsletter_logo.png'" /> </td> </tr> <tr> <td class="content-block"> Hello, </td> </tr> <tr> <td class="content-block"> Please reset your CometChat Admin Panel password by clicking the reset password button below. </td> </tr> <tr> <td class="content-block"> This email is only valid for next 30 minutes. If you did not request a password reset, please ignore this email. </td> </tr> <tr> <td class="content-block" itemprop="handler" itemscope itemtype="http://schema.org/HttpActionHandler"> <a href="{$resetlink}" class="btn-primary" itemprop="url">Reset Your Password</a> </td> </tr> </table> </td> </tr> </table> </div> </td> <td></td> </tr> </table> </body> </html> EOD; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function forgotPassword()\n\t{\n\t\tglobal $objSmarty;\n\t\textract($_REQUEST);\n\t\t$SelQuery\t= \"SELECT * FROM `admin`\"\n\t\t .\" WHERE `Email` = '\".$txtEmail.\"' LIMIT 0,1\";\n\t\t$SelResult\t= $this->ExecuteQuery($SelQuery, \"select\");\n\t\tif(!empty($SelResult) && !empty($SelResult[0]['Ident'])){\n\t\t\t$Username = $SelResult[0]['Username'];\n\t\t\t$Password = $SelResult[0]['Password'];\n\t\t\t$subject = \"Password Request!!!\";\n\t\t\t$message='<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\t\t\t\t<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\t\t<head>\n\t\t\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n\t\t\t\t<title>Password Retrival</title>\n\t\t\t\t<link href=\"melslifecss.css\" rel=\"stylesheet\" type=\"text/css\" />\n\t\t\t\t</head>\n\t\t\t\t\n\t\t\t\t<body>\n\t\t\t\t<table width=\"75%\" border=\"0\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\" class=\"border_grey\">\n\t\t\t\t <tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t </tr>\n\t\t\t\t <tr>\n\t\t\t\t\t<td><hr size=\"1px\" color=\"#e0e0e0\" /></td>\n\t\t\t\t </tr>\n\t\t\t\t <tr>\n\t\t\t\t\t<td><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\n\t\t\t\t\t <tr>\n\t\t\t\t\t\t<td height=\"8\"></td>\n\t\t\t\t\t\t<td height=\"8\" colspan=\"2\"></td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t <tr>\n\t\t\t\t\t\t<td width=\"8\">&nbsp;</td>\n\t\t\t\t\t\t<td colspan=\"2\" align=\"left\" valign=\"middle\" style=\"font-family: Arial, Helvetica, sans-serif;\n\t\t\t\t\t\t\t\tfont-size: 14px;\n\t\t\t\t\t\t\t\tfont-weight: bolder;\n\t\t\t\t\t\t\t\tcolor: #D53B29;\">Welcome to Admin </td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t <tr>\n\t\t\t\t\t\t<td height=\"8\"></td>\n\t\t\t\t\t\t<td height=\"8\" colspan=\"2\" ></td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t <tr>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t<td colspan=\"2\" align=\"left\" valign=\"middle\" ><div align=\"justify\" style=\"font-family: Arial, Helvetica, sans-serif;font-size: 12px;font-weight: normal;color: #000000;text-decoration: none;\" >Your login detail for Admin Panel,</div></td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t <tr>\n\t\t\t\t\t\t<td height=\"8\"></td>\n\t\t\t\t\t\t<td height=\"8\" colspan=\"2\"></td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t <tr>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t<td colspan=\"2\" align=\"left\" valign=\"middle\" ><span style=\"font-family: Arial, Helvetica, sans-serif;\tfont-size: 12px; font-weight: bold;\tcolor: #000000;\ttext-decoration: none;\" >Username: &nbsp;</span><b>'.$Username.'</b></td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t <tr>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t<td colspan=\"2\" align=\"left\" valign=\"middle\" ><span style=\"font-family: Arial, Helvetica, sans-serif;\tfont-size: 12px; font-weight: bold;\tcolor: #000000;\ttext-decoration: none;\" >Password: &nbsp;</span><b>'.$Password.'</b></td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t <tr>\n\t\t\t\t\t\t<td height=\"8\"></td>\n\t\t\t\t\t\t<td height=\"8\" colspan=\"2\"></td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t \n\t\t\t\t\t <tr>\n\t\t\t\t\t\t<td height=\"8\"></td>\n\t\t\t\t\t\t<td height=\"8\" colspan=\"2\" align=\"left\">Thanks,</td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t <tr>\n\t\t\t\t\t\t<td height=\"8\"></td>\n\t\t\t\t\t\t<td height=\"8\" colspan=\"2\" align=\"left\">The Admin Team</td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t <tr>\n\t\t\t\t\t\t<td height=\"8\"></td>\n\t\t\t\t\t\t<td height=\"8\" colspan=\"2\"></td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t</table></td>\n\t\t\t\t </tr>\n\t\t\t\t <tr>\n\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t </tr>\n\t\t\t\t <tr>\n\t\t\t\t\t<td align=\"center\" bgcolor=\"#7e7e7e\"><span class=\"footer_text\">&copy; 2015. Tutor Website. All Rights Reserved.</span></td>\n\t\t\t\t </tr>\n\t\t\t\t</table>\n\t\t\t\t</body>\n\t\t\t\t</html>';\n\t\t\t\t$headers = 'From: [email protected]'.\"\\r\\n\";\n\t\t\t\t$headers.= 'Reply-To: [email protected]'.\"\\r\\n\";\n\t\t\t\t$headers.= \"MIME-Version: 1.0\\r\\n\";\n\t\t\t\t$headers.= \"Content-type: text/html; charset=iso-8859-1\\r\\n\";\t\t\n\t\t\t\t//echo $message. $headers;\t\t\t\n\t\t\t\t$mail=@mail($txtEmail,$subject,$message,$headers);\n\t\t\t$objSmarty->assign(\"SuccessMessage\", \"Login details has been sent successfully. Please check your mail\");\n\t\t}else{\n\t\t\t$objSmarty->assign(\"ErrorMessage\", \"Given email is not available in our database. Please check the email you have entered\");\n\t\t}\n\t}", "function sendPasswordResetLink($email,$user_id,$subject){\n\t\t \n\t\t $encode_id=$this->helper_model->encode($user_id);\n\t\t \n\t\t $from_email = \"[email protected]\"; \n $to_email = $email; \n\t\t\n $this->email->from($from_email, 'Your Name'); \n $this->email->to($to_email);\n $this->email->subject($subject); \n\t\t $mail_bodydetails=\"Please click the below link for Password Reseting\";\n\t\t $mail_bodydetails.='<a href=\"'.BASE_PATH.'login/reset_password/'.$encode_id.'\">Click to </a>';\n\t\t echo $mail_bodydetails;die;\n $this->email->message($mail_bodydetails); \n \n //Send mail \n if($this->email->send()){\t \n return true;\n\t\t } \n else{\n\t\t\t return false;\n\t\t } \n \n \n\t}", "public function sendPasswordResetLink() {\n $this->password_reset_code = $this->generateToken();\n $this->save();\n try {\n $mail = new \\PHPMailer(true);\n $mail->From = getSiteEmail();\n $mail->FromName = getSiteName();\n $mail->addAddress($this->email);\n $mail->isHTML(true);\n $mail->Subject = display(\"email/forgot_password_subject\");\n $mail->Body = display(\"email/forgot_password_body\", array(\n \"user_guid\" => $this->guid\n ));\n $mail->From = getSiteEmail();\n $mail->FromName = getSiteName();\n\n $mail->isHTML(true); // Set email format to HTML\n\n $mail->send();\n return true;\n } catch (\\Exception $e) {\n return false;\n }\n }", "function sendRecoverPasswordEmail() {\n\t\t$template = new EmailTemplate(); \n\t\t// create mail object\n\t\t$mail = Zend_Registry::get(\"mail\");\n\n\t\t// assign values\n\t\t$template->assign('firstname', $this->getFirstName());\n\t\t// just send the parameters for the activationurl, the actual url will be built in the view \n\t\t$template->assign('resetpasswordurl', array(\"controller\"=> \"user\",\"action\"=> \"resetpassword\", \"actkey\" => $this->getActivationKey(), \"id\" => encode($this->getID())));\n\t\t\n\t\t// configure base stuff\n\t\t$mail->addTo($this->getEmail());\n\t\t$mail->setSubject($this->translate->_('useraccount_email_subject_recoverpassword'));\n\t\t// render the view as the body of the email\n\t\t$mail->setBodyText($template->render('recoverpassword.phtml'));\n\t\t$mail->send();\n\t\t\n\t\treturn true;\n }", "public function emailPasswordReset()\n {\n $email = $this->getEmailInstance();\n $email->subject('Requested Password Reset')\n ->template('Propeller/Users.reset_password')\n ->send();\n }", "protected function sendPasswordResetEmail()\n {\n $url = 'http://' . $_SERVER['HTTP_HOST'] . '/password/reset/' . $this->password_reset_token;\n\n $text = View::getTemplate('Password/reset_email.txt', ['url' => $url]);\n $html = View::getTemplate('Password/reset_email.html', ['url' => $url]);\n //var_dump($url);\n Mail::send($this->email, 'Changement de mot de passe', $text, $html);\n }", "public function emailTemplate()\n\t{\n\t\t$result = $this->db->query(\"SELECT * FROM `emails` WHERE \n\t\t\t\t\t\t\t\t\teCode = 'reset-password'\");\n\t\tif($result->num_rows == 1)\n\t { \n\t \treturn $result->fetch_object();\n\t }\n\t else\n\t {\n\t return false;\n\t } \n\n\t}", "function sendForgotPasswordEmail($argArrPOST)\n {\n //pre($argArrPOST);\n $arrUserFlds = array('pkCustomerID', 'CustomerFirstName', 'CustomerLastName');\n $varUserWhere = \"CustomerEmail = '\" . stripcslashes($argArrPOST['frmUserEmail']) . \"' AND CustomerStatus = 'active' \";\n $arrUserList = $this->select(TABLE_CUSTOMER, $arrUserFlds, $varUserWhere);\n $objTemplate = new EmailTemplate();\n $objCore = new Core();\n $objCustomer = new Customer();\n if (count($arrUserList) > 0)\n {\n\n $varToUser = trim(strip_tags($argArrPOST['frmUserEmail']));\n $better_token = uniqid(md5(rand()), true);\n $objCustomer->insCustomerForgotPWCode($better_token, $varToUser);\n\n $varForgotPasswordLink = '<a href=\"' . SITE_ROOT_URL . 'reset_password.php?uid=' . $varToUser . '&code=' . $better_token . '\">' . SITE_ROOT_URL . 'reset_password.php?uid=' . $varToUser . '&code=' . $better_token . '</a>';\n\n $varFromUser = SITE_NAME;\n $name = $arrUserList[0]['CustomerFirstName'] . ' ' . $arrUserList[0]['CustomerLastName'];\n $varWhereTemplate = ' EmailTemplateTitle= binary \\'Customer forgot password\\' AND EmailTemplateStatus = \\'Active\\' ';\n\n $arrMailTemplate = $objTemplate->getTemplateInfo($varWhereTemplate);\n\n $varOutput = html_entity_decode(stripcslashes($arrMailTemplate[0]['EmailTemplateDescription']));\n\n\n $varSubject = html_entity_decode(stripcslashes($arrMailTemplate[0]['EmailTemplateSubject']));\n $varPathImage = '<img src=\"' . SITE_ROOT_URL . 'common/images/logo.png\" >';\n\n $varSubject = str_replace('{PROJECT_NAME}', SITE_NAME, html_entity_decode(stripcslashes($arrMailTemplate['0']['EmailTemplateSubject'])));\n\n $varKeyword = array('{SITE_NAME}', '{IMAGE_PATH}', '{NAME}', '{PROJECT_NAME}', '{FORGOT_PWD_LINK}');\n\n $varKeywordValues = array(SITE_NAME, $varPathImage, $name, SITE_NAME, $varForgotPasswordLink);\n\n $varOutPutValues = str_replace($varKeyword, $varKeywordValues, $varOutput);\n\n// Calling mail function\n\n $objCore->sendMail($varToUser, $varFromUser, $varSubject, $varOutPutValues);\n echo 1;\n //echo FRONT_END_FORGET_PASSWORD_SUCCESS_MSG;\n //$objCore->setSuccessMsg('<span>' . FRONT_END_FORGET_PASSWORD_SUCCESS_MSG . '</span>');\n //echo '<script>parent.window.location.href = \"'.SITE_ROOT_URL.'index.php\";</script>';\n die;\n }\n else\n {\n echo 0;\n //echo FRONT_END_FORGET_PASSWORD_ERROR_MSG;\n }\n }", "private function send_reset_link( $email = NULL ) {\n $message = $this->settings->email_notification( 'forget_password_link', 'email_content' );\n $subject = $this->settings->email_notification( 'forget_password_link', 'email_subject' );\n $from = $this->settings->email_notification( 'forget_password_link', 'email_from' );\n $siteName = $this->settings->get( 'sitename' );\n $website = $this->settings->get( 'website' );\n $merchant = $this->userData['merchant_uniqname'];\n $name = $this->userData['user_fname'];\n $fullname = $this->userData['user_fname'] . ' ' . $this->userData['user_lname'];\n $authCode = $this->db->code_generator( 20, array( 'special' => FALSE ) );\n $encryptAuthCode = $this->db->_encrypt( $authCode, ENCRYPT );\n $keys = array( $name => '{name}', $website => '{website}', $merchant => '{merchant-uname}', $authCode => '{auth-code}', $siteName => '{site-name}' );\n foreach( $keys as $replace => $find ) {\n $message = str_replace( $find, $replace, $message );\n }\n\n $fromName = $siteName . \"-\" . $merchant;\n\n $updateData = array(\n \"user_auth_code\" => $encryptAuthCode,\n );\n\n $branchID = $this->userData['user_branch_id'];\n\n if ( !empty( $branchID ) ) {\n $dbTable = $this->userTableName;\n $whereClause = \"WHERE `user_branch_id` = '\" . $this->db->escape( $this->userData['user_branch_id'] ) . \"' AND `user_id` = '\" . $this->db->escape( $this->userData['user_id'] ) . \"'\";\n } else {\n $dbTable = $this->adminTableName;\n $whereClause = \"WHERE `user_id` = '\" . $this->db->escape( $this->userData['user_id'] ) . \"'\";\n }\n\n $updated = $this->db->update(\n $dbTable,\n $updateData,\n $whereClause\n );\n\n $email = array(\n \"to\" => $fullname,\n \"toemail\" => $email,\n \"from\" => $fromName,\n \"fromemail\" => $from,\n \"subject\" => $subject,\n \"message\" => $message,\n );\n\n if ( $this->db->send_email( $email ) ) {\n $this->access = TRUE;\n $this->confirmation = 'password_reset_sent';\n return TRUE;\n } else {\n $this->errors[] .= 'email_not_sent';\n return FALSE;\n }\n\n }", "public function send_pwd($reset_url = '', $query) {\n $newsid = '1';\n $template_values = $this->company_model->get_newsletter_template_details($newsid);\n $subject = 'From: ' . $this->config->item('email_title') . ' - ' . $template_values->message['subject'];\n $adminnewstemplateArr = array('email_title' => $this->config->item('email_title'), 'logo' => $this->config->item('logo_image'), 'footer_content' => $this->config->item('footer_content'), 'meta_title' => $this->config->item('meta_title'));\n extract($adminnewstemplateArr);\n $message = '<!DOCTYPE HTML>\n\t\t\t<html>\n\t\t\t<head>\n\t\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n\t\t\t<meta name=\"viewport\" content=\"width=device-width\"/>\n\t\t\t<title>' . $template_values->message['subject'] . '</title>\n\t\t\t<body>';\n include('./newsletter/template' . $newsid . '.php');\n $message .= '</body>\n\t\t\t</html>';\n\n $sender_email = $this->config->item('site_contact_mail');\n $sender_name = $this->config->item('email_title');\n \n $email_values = array('mail_type' => 'html',\n 'from_mail_id' => $sender_email,\n 'mail_name' => $sender_name,\n 'to_mail_id' => $query->row()->email,\n 'subject_message' => 'Password Reset',\n 'body_messages' => $message\n );\n $email_send_to_common = $this->company_model->common_email_send($email_values);\n }", "private function emailTosend_reset_password_link($user_name, $userEmail){\n\n // Loading encryption library to encrypt user_name\n $this->load->library('encrypt');\n\n $this->load->model('basic_functions');\n $encryptionKey = $this->basic_functions->getEncryptionKey();\n \n \n $un_plus_timeToken = $user_name . '|' . (time() + 7200);\n \n //echo $un_plus_timeToken;\n \n \n $encrypteUserName = $this->encrypt->encode($un_plus_timeToken, $encryptionKey);\n\n $base64userName = base64_encode($encrypteUserName); // changing user_name to base64 algo.\n //echo $encrypteUserName; exit();\n\n $message = '<b> Hi! ' . $user_name . ' </b><br /><br />'\n . 'Kindly click on below link to reset your account. <br />'\n . '<a href=\"' . base_url() . 'reset_password/email_address?uid=' . $base64userName . '\" > Click here to reset password </a>'\n . '<br /><br /><br /><br /><br /><br /><br /><hr />'\n . '<hr /> '\n . '<br /><strong class=\"text-info\">Note: </strong>'\n . '<ul>'\n . '<li>If you did not request for reset password. Then your account might be at risk.</li>'\n . '<li>Kindly update your password to secure one asap.</li>'\n . '</ul>'\n . '<br /> <br />'\n . '<hr /><br />';\n \n //$this->load->helper('custom_functions');\n //$this->custom_functions->custom_sendemail();\n $this->load->library('email');\n $this->load->model('send_email');\n $success = $this->send_email->send($userEmail, $message, 'reset password');\n return $success;\n\n\n }", "static function forgotPassword($params){\n $con = $params['dbconnection'];\n if($params['email'] != ''){\n if(DbMethods::checkEmail($params) != 'emailexist'){\n return 'emailnotexist';\n }\n }\n $password_reset_token = sha1($params['email']);\n $query = \"UPDATE `admin` SET\n\t\t`password_reset_token`='{$password_reset_token}'\n\t\tWHERE `email`='{$params['email']}' \";\n mysqli_query($con, $query);\n $baseurl = \"http://18.185.217.28/up_qatar/cms/#/auth/reset-password\";\n $resetLink = \"?token=\".$password_reset_token;\n $resetLink = $baseurl.$resetLink.\"&type=admin\";\n $angertag = \" <a href='\".$resetLink.\"' style='background: #b64645 none repeat scroll 0 0; border-radius: 2px; color: #fff; font-size: 14px; font-weight: 400; padding: 4px 28px; display: block; max-width: 160px; font-size: 16px; font-weight: 600; text-decoration: none; margin: 10px auto 8px; padding: 15px 25px;' target='_blank'>Reset Password</a>\";\n $params['to'] = $params['email'];\n $params['subject'] = \"Password Recovery\";\n $params['body'] = \"<html>\n\t\t<head>\n\t\t<title>Password Recovery</title>\n\t\t</head>\n\t\t<body>\n\t\t<h3>Dear user,</h3>\n\t\t<p>Click on Link to reset Password: <b>\".$angertag.\" </b></p>\n\t\t<p></p>\n\t\t<p>Regards, </p>\n\t\t<p>UP</p>\n\t\t</body>\n\t\t</html>\";\n //HelpingMethods::sendEmail($params);//send mail\n $dir = $params['apiBasePath'].\"../../../common/sendEmail.php\";\n DbMethods:: post_async($dir, [\n 'to' => $params['to'],\n 'subject' => $params['subject'],\n 'body' => $params['body'],\n 'con' => $params['dbconnection']\n ]);\n return \"sended\";\n }", "function activationEmailMessage($userId, $userName, $authCode)\r\n {\r\n global $html;\r\n $message = <<< EOT\r\n<html>\r\n <body>\r\n <div style=\"width:550px;margin:0 auto;\">\r\n <p>Hi</p><p>As discussed, we’ve created an account for you to create Remembrance Page’s for your client families on A Memory Tree.</p>\r\n <p><strong>It takes less than 30 seconds</strong> to create a listing and you will also soon have access to a list of all funerals linked to your organization. Our records go back to December 2006.</p>\r\n <p>By clicking on the link below to activate your account you are also agreeing to our <a href=\"http://www.amemorytree.co.nz/terms.php\">terms and conditions</a> of use and <a href=\"http://www.amemorytree.co.nz/codeofethics.php\">code of ethics</a></p>\r\n <p><b>There is NO FEE to list a death and create a Remembrance Page.</b></p>\r\n <p><b>Username: %s<br /><a href=\"http://www.amemorytree.co.nz/resetPassword.php?userid=%d&amp;auth=%s\">Activate my account</a></b></p>\r\n <p><div style=\"color:#FF0000;\"><b>This link will expire in 7 days.</b></div></p>\r\n <p>If this time has lapsed, we can send you a new activation link on request.</p>\r\n <p>If you have any questions, please do not hesitate to contact me directly.</p>\r\n <p>Kind regards</p>\r\n <p><big>Sue Skeet</big><br />Managing Director</p>\r\n <p>www.amemorytree.co.nz</p>\r\n <p>PO Box 26 124, Christchurch, New Zealand<br />Tel: +64 03 385 5105 Fax: +64 03 385 5105<br />Mobile: 021 226 3054</p>\r\n <p>create, remember, enjoy, learn, share & discover...</p>\r\n <div style=\"background-color:#E6F1F9;padding:5px\">\r\n <p><strong>Did this email go into your junk mail folder on Microsoft Outlook?</strong><br>\r\n You can either:</p>\r\n <p>Add [email protected] to your address book to make sure our emails arrive in your inbox or,</p>\r\n <p>Simply drag the mail from your junk mail box to your inbox. This now accepts all future mail from [email protected]</p>\r\n </div>\r\n </div>\r\n </body>\r\n</html>\r\nEOT;\r\n return sprintf($message,\r\n $html->text($userName),\r\n $html->text($userId),\r\n $html->text($authCode)\r\n );\r\n }", "public function sendEmail()\n {\n /* @var $user User */\n $user = User::findOne([\n 'status' => User::STATUS_ACTIVE,\n 'email' => $this->email,\n ]);\n\n if (!$user) {\n return false;\n }\n \n if (!User::isPasswordResetTokenValid($user->password_reset_token)) {\n $user->generatePasswordResetToken();\n }\n \n if (!$user->save()) {\n return false;\n }\n\n /*return Yii::$app\n ->mailer\n ->compose(\n ['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'],\n ['user' => $user,'title'=>'Password Reset Instructions']\n )\n ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' autogen'])\n ->setTo($this->email)\n ->setSubject('Password reset for ' . Yii::$app->name)\n ->send();*/\n \n\n $params = \n [\n 'htmltemplate'=>'passwordResetToken-html', \n 'texttemplate'=>'passwordResetToken-text',\n 'sender'=>Yii::$app->name . ' autogen',\n 'to'=>$this->email,\n 'from'=>Yii::$app->params['supportEmail'], \n 'subject'=>'Password reset for '.Yii::$app->name,\n 'user'=>$user,\n 'title'=>'Link for password reset', \n \n ];\n return MailHelper::sendFormattedEmail($params);\n \n\n\n }", "public function emailResetLink()\n\t{\n $ret = false;\n\t\tif(!$this->hasErrors() && ($this->username_email != \"\"))\n\t\t{\n if (strstr($this->username_email,\"@\") === false) {\n // its username\n $userRow=User::model()->find('username=:username', array(':username'=> $this->username_email));\n } else {\n // its an email\n $userRow=User::model()->find('email=:email', array(':email'=> $this->username_email));\n }\n if ($userRow) {\n $passwordResetCode = $this->getPasswordResetCode($userRow->username); \n $userRow->passwordResetCode = $passwordResetCode; \n $userRow->save();\n $userEmail = $userRow->email;\n $resetUrl = Yii::app()->request->getBaseUrl(true) . \"/site/forgotpassword?pc=$passwordResetCode\" ; \n $this->sendMail($userEmail, $resetUrl);\n $ret = true;\n } else {\n\t\t\t\t$this->addError('username_email','Username or Email not found');\n $ret = false;\n }\n\t\t}\n return $ret;\n\t}", "function stuurWachtwoordResetEmail( $email ) {\n\t$reset_code = md5( uniqid( rand(), true ) );\n\t$connection = dbConnect();\n\t$sql = \"UPDATE `gebruikers` SET `password_reset` = :code WHERE `email` = :email\";\n\t$statement = $connection->prepare( $sql );\n\t$params = [\n\t\t'code' => $reset_code,\n\t\t'email' => $email\n\t];\n\n\t$statement->execute( $params );\n\n\t$url = url( 'wachtwoord.reset', [ 'reset_code' => $reset_code ] );\n\t$absolute_url = absolute_url( $url );\n\n\t$mailer = getSwiftMailer();\n\t$message = createEmailMessage( $email, 'Wachtwoord resetten', 'Sharing is Caring', '[email protected]' );\n\n\t// $email_text = 'klik <a href=\"' . $absolute_url . '\">hier</a> om je wachtwoord te resetten';\n\n\t$template_engine = get_template_engine();\n\t$html = $template_engine->render('wachtwoord_vergeten_email', ['message' => $message, 'url' => $absolute_url]);\n\n\t$message->setBody( $html, 'text/html');\n\n\t$mailer->send( $message );\n\n}", "public function sendMail($email, $rs) {\n \n $this->load->library('email');\n\n $this->email->from('[email protected]', 'Arun');\n $this->email->to($email);\n\n $this->email->subject('Get your forgotten Password');\n if($this->isAdmin == 1)\n $this->email->message('Please go to this link to get your password.'. site_url('get_password/adminPassChange/' . $rs));\n else\n $this->email->message('Please go to this link to get your password.'. site_url('get_password/index/' . $rs));\n\n $this->email->send(); \n /*$to = $email;\n $subject = 'Get your forgotten Password';\n $message = 'Please go to this link to get your password.' . site_url('get_password/index/' . $rs);\n $headers = 'MIME-Version: 1.0' . \"\\r\\n\";\n $headers .= 'Content-type: text/html; charset=iso-8859-1' . \"\\r\\n\";\n\n// Additional headers\n \n $headers .= 'From: Admin <[email protected]>' . \"\\r\\n\";\n $headers .= 'Reply-To: [email protected]' . \"\\r\\n\" .\n 'X-Mailer: PHP/' . phpversion();\n\n mail($to, $subject, $message, $headers);*/\n \n $this->mailSubmission($email);\n }", "function sendPasswordResetLink($userEmail,$token,$username){\n\t\tglobal $mailer; // to be access function\n\t\t$body = '<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t<meta charset=\"UTF-8\">\n\t\t\t\t\t\t<title>Recover Email</title>\n\t\t\t\t\t</head>\n\t\t\t\t\t<body>\n\t\t\t\t\t\t<div class=\"wrapper\">\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t<strong>Hello!</strong><br><br/>\n\t\t\t\t\t\t\tPleas Click On The Link below To Reset Password\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<a href=\"http://localhost/Faculty-Task/homepage.php?password-token=' . $token . '\">\n\t\t\t\t\t\t\tReset Password</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</body>\n\t\t\t\t</html>';\t\t\n\t\t\t// Create a message\n\t$message = (new Swift_Message('Hello '.$username. ' - Reset Your password'))\n\t ->setFrom(EMAIL)\n\t ->setTo($userEmail)\n\t ->setBody($body, 'text/html');\n\t ;\n\n\t// Send the message\n\t$result = $mailer->send($message);\n\n\n\t}", "public function forgot_password()\n\t{\n\t\t$tag_vars = array(array(\n\t\t\t'email' => FALSE,\n\t\t\t'error:email' => FALSE,\n\t\t));\n\n\t\tif ($this->EE->input->post('forgot_password'))\n\t\t{\n\t\t\t$tag_vars[0]['email'] = $this->EE->input->post('email', TRUE);\n\n\t\t\t// generate reset code and URL\n\t\t\t$reset_code = random_string('alnum', 10);\n\t\t\tif ($reset_url = $this->EE->TMPL->fetch_param('reset'))\n\t\t\t{\n\t\t\t\t$reset_url = $this->EE->functions->create_url($reset_url.'/'.$reset_code);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$reset_url = $this->EE->functions->fetch_site_index(0, 0).QUERY_MARKER.\n\t\t\t\t\t'ACT='.$this->EE->functions->fetch_action_id('Member', 'reset_password').'&id='.$reset_code;\n\t\t\t}\n\n\t\t\t// valide email address and send reset instructions\n\t\t\t$errors = $this->_member_forgot_password($reset_code, $reset_url);\n\n\t\t\tif (empty($errors))\n\t\t\t{\n\t\t\t\t$return_url = $this->EE->functions->create_url($this->EE->input->post('return_url'));\n\t\t\t\t$this->EE->functions->redirect($return_url);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$tag_vars = $this->_display_errors($tag_vars, $errors);\n\t\t\t}\n\t\t}\n\n\t\t// start our form output\n\t\t$out = $this->_form_open(array(\n\t\t\t'hidden_fields' => array('forgot_password' => 1),\n\t\t));\n\n\t\t// parse tagdata variables\n\t\t$out .= $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $tag_vars);\n\n\t\t// end form output and return\n\t\treturn $out.'</form>';\n\t}", "function send_reset_link_email( $user )\n{\n // Redefining user_login ensures we return the right case in the email.\n $user_login = $user->user_login;\n $user_email = $user->user_email;\n $key = get_password_reset_key( $user );\n\n if ( is_wp_error( $key ) ) {\n $_SESSION[\"errors\"][\"reset_link_error_url\"] = \"Something went wrong, please try again or contact support.\";\n wp_safe_redirect( $lost_password_url );\n exit;\n }\n\n $message = __('Someone has requested a password reset for the following account:') . \"\\r\\n\\r\\n\";\n $message .= network_home_url( '/' ) . \"\\r\\n\\r\\n\";\n $message .= sprintf(__('Username: %s'), $user_login) . \"\\r\\n\\r\\n\";\n $message .= __('If this was a mistake, just ignore this email and nothing will happen.') . \"\\r\\n\\r\\n\";\n $message .= __('To reset your password, visit the following address:') . \"\\r\\n\\r\\n\";\n $message .= '<' . network_site_url(\"reset-password?action=rp&key=$key&login=\" . rawurlencode($user_login), 'login') . \">\\r\\n\";\n\n $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);\n\n $title = sprintf( __('[%s] Password Reset'), $blogname );\n\n //Filter the subject of the password reset email.\n $title = apply_filters( 'retrieve_password_title', $title, $user_login, $user );\n\n // Filter the message body of the password reset mail.\n $message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user );\n\n if ( $message && !wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) )\n {\n $_SESSION[\"errors\"][\"reset_link_error_url\"] = \"The email could not be sent, please try again or contact support.\";\n wp_safe_redirect( $lost_password_url );\n exit;\n }\n}", "public function sendMail($val) {\n// exit;\n $to = '[email protected]';\n\n// subject\n $subject = 'Change password';\n\n// message\n $message = '\n<html>\n<head>\n <title>Forgot Password</title>\n</head>\n<body>\n <p>Change Password</p>\n <table>\n\n <tr>\n <td><a href=\"http://eazycheque.com/admin/site/new-password?token=' . $val . '\">Click here change password</a></td>\n </tr>\n\n </table>\n</body>\n</html>\n';\n \n\n// To send HTML mail, the Content-type header must be set\n$headers = 'MIME-Version: 1.0' . \"\\r\\n\";\n$headers .= 'Content-type: text/html; charset=iso-8859-1' . \"\\r\\n\";\nmail($to, $subject, $message, $headers);\n }", "function sendPasswordResetEmail($email) {\n\t$reset_code = md5( uniqid( rand(), true) );\n\t$connection = dbConnect();\n\t$sql \t\t= 'UPDATE `gebruikers` SET `password_reset` = :code WHERE `email` = :email';\n\t$statement\t= $connection->prepare($sql);\n\t$params \t= [\n\t\t'code' => $reset_code,\n\t\t'email' => $email\n\t];\n\t$statement->execute($params);\n\n\n\t// Link genereren met code\n\t$url = url('wachtwoord.reset', ['reset_code' => $reset_code]);\n\t$absolute_url = absolute_url($url);\n\n\n\t// Mail opstellen en versturen\n\t$mailer = getSwiftMailer();\n\t$message = createEmailMessage($email, 'Wachtwoord resetten', 'HeldenHub', '[email protected]');\n\t$email_text = 'Hallo, klik hier om je wachtwoord te resetten: <a href=\"' . $absolute_url . '\">Wachtwoord resetten </a>';\n\n\t$message->setBody($email_text, 'text/html');\n\t$mailer->send($message);\n}", "function forgotpassword($param=array()){\n\t$staticCDNUrl = STATIC_CDN_URL;\n\tglobal $body;\n\t$body=<<<EOD\n\t<div class=\"outerframe\">\n\t\t<div class=\"middleform\">\n\t\t\t<div class=\"cometchat_logo_div\">\n\t\t\t\t<img class=\"cometchat_logo_image\" src=\"{$staticCDNUrl}/admin/images/logo.png\" style=\"height:50px;\" />\n\t\t\t</div>\n\t\t\t\t<div class=\"module form-module\">\n\t\t\t\t\t<div class=\"form\" >\n\t\t\t\t\t\t<h2 >Forgot Password</h2>\n\t\t\t\t\t\t<p>To reset your password, enter your email address and we will send you an email with instructions.</p>\n\t\t\t\t\t\t<form method=\"post\" action=\"index.php?module=forgotpassword&action=sendemail\">\n\t\t\t\t\t\t\t<input type=\"email\" name=\"email\" placeholder=\"Your email\" required=\"true\" />\n\t\t\t\t\t\t\t<button type=\"submit\" value=\"Submit\">Submit</button>\n\t\t\t\t\t\t\t<input type=\"hidden\" name=\"currentTime\" class=\"login_inputbox currentTime\" />\n\t\t\t\t\t\t\t<div class=\"cometchat_forgotpwd\"><a href=\"index.php\">Cancel</a></div>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\nEOD;\n\ttemplate(1);\n}", "public function forgotPasswordMail($params)\n {\n // login url sent via email\n $loginURL = SOCKET_HOST_NAME;\n if ($_SERVER['HTTP_HOST'] == 'localhost') {\n $loginURL = \"http://\" . $_SERVER['HTTP_HOST'] . '/pu/';\n }\n $params['loginURL'] = $loginURL;\n\n // Get ACmailer service\n $mailService = $this->getACMailer();\n\n // Header html\n $header = new ViewModel();\n $header->setTemplate('api/email_templates/header');\n\n // Footer html\n $footer = new ViewModel();\n $footer->setTemplate('api/email_templates/footer');\n\n $template = 'forgot-password';\n $fromEmail = ADMIN_EMAIL_ID;\n $subject = 'Password reset request';\n if($this->sendToLocalMachine){\n $toEmail = '[email protected]';\n }else{\n $toEmail = $params['to_email'];\n }\n\n\n // Main layout html\n $layout = new ViewModel($params);\n $layout->setTemplate('api/email_templates/' . $template);\n\n // Add header, footer to main layout\n $layout->addChild($header, 'header')->addChild($footer, 'footer');\n\n $mailService->setTemplate($layout);\n $message = $mailService->getMessage();\n $message->setSubject($subject)\n ->addFrom(ADMIN_CONFIG['email'], ADMIN_CONFIG['name'])\n ->setTo($toEmail);\n\n $result = $mailService->send();\n\n if ($result->isValid()) {\n $result = 'Message sent. Congratulations!';\n } else {\n if ($result->hasException()) {\n $result = sprintf('An error occurred. Exception: \\n %s', $result->getException()->getTraceAsString());\n } else {\n $result = sprintf('An error occurred. Message: %s', $result->getMessage());\n }\n }\n\n return $result;\n }", "function sendemail($param=array()){\n\tif($_POST['email']==ADMIN_USER){\n\t\t$resetlink\t\t = $_SERVER['HTTP_HOST'] . strtok($_SERVER[\"REQUEST_URI\"],'?') . '?module=forgotpassword&action=resetpassword&key=' . base64_encode(ADMIN_USER) . '&ts=' . time();\n\t\t$headers = \"MIME-Version: 1.0\" . \"\\r\\n\";\n\t\t$headers .= \"Content-type:text/html;charset=UTF-8\" . \"\\r\\n\";\n\t\t$to\t\t\t= ADMIN_USER;\n\t\t$subject = \"Reset CometChat Admin Panel Password\";\n\t\t$emailtemplate=emailtemplate($resetlink);\n\n\t\t$status = mail($to, $subject, $emailtemplate, $headers);\n\t\tif ($status){\n\t\t\t$_SESSION['cometchat']['error'] = 'Email sent successfully.';\n\t\t\theader(\"Location:index.php\");\n\t\t}else{\n\t\t\t$_SESSION['cometchat']['error'] = 'Invalid Email OR SMTP not configured.';\n\t\t\t$_SESSION['cometchat']['type'] = 'alert';\n\t\t\theader(\"Location:index.php\");\n\t\t}\n\t}else{\n\t\t$_SESSION['cometchat']['error'] = 'Email not matched.';\n\t\t$_SESSION['cometchat']['type'] = 'alert';\n\t\theader(\"Location:index.php\");\n\t}\n}", "public static function sendPasswordResetTokenMail($user)\n {\n\n $status = '';\n $link = \\Yii::$app->params['frontendURL'] . '#/set-password?token=' . $user->password_reset_token;\n // get forgot password mail\n $forgot_mail_templates = \\app\\models\\EmailTemplates::find()->where([\n 'template_id' => 1\n ])->One();\n\n if (!empty($forgot_mail_templates)) {\n // removing place holders in mail body\n $firstName = self::getFirstName($user);\n $body = str_replace(\"&lt;&lt;name&gt;&gt;\", $firstName, $forgot_mail_templates->body);\n $response = self::replaceDynamicVariables($body, $user);\n $body = $response['body'];\n $brand = $response['brand'];\n $body = str_replace(\"&lt;&lt;password_btn&gt;&gt;\", '<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"mcnButtonBlock\" style=\"min-width:100%;\">\n\t\t\t <tbody class=\"mcnButtonBlockOuter\">\n\t\t\t <tr>\n\t\t\t <td style=\"padding-top:0; padding-right:18px; padding-bottom:18px; padding-left:18px;\" valign=\"top\" align=\"center\" class=\"mcnButtonBlockInner\">\n\t\t\t <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"mcnButtonContentContainer\" style=\"border-collapse: separate !important;border-radius: 3px;background-color: #0076BC;\">\n\t\t\t <tbody>\n\t\t\t <tr>\n\t\t\t <td align=\"center\" valign=\"middle\" class=\"mcnButtonContent\" style=\"font-family: Arial; font-size: 16px; padding: 15px;\">\n\t\t\t <a class=\"mcnButton \" title=\"Reset Your Password\" href=\"' . $link . '\" target=\"_blank\" style=\"font-weight: bold;letter-spacing: normal;line-height: 100%;text-align: center;text-decoration: none;color: #FFFFFF;\">Reset Your Password</a>\n\t\t\t </td>\n\t\t\t </tr>\n\t\t\t </tbody>\n\t\t\t </table>\n\t\t\t </td>\n\t\t\t </tr>\n\t\t\t </tbody>\n\t\t\t</table>', $body);\n\n $status = ResourceComponent::sendMail($brand['support_email'], $user->username, $forgot_mail_templates->subject, $body);\n }\n return $status;\n }", "function wpwebapp_email_pw_reset( $to, $user_login, $reset_url ) {\n\n $from = 'passwordreset'; // TODO: Get custom from name from options\n $site_name = get_bloginfo('name');\n $domain = wpwebapp_get_site_domain();\n $headers = 'From: ' . $site_name . ' <' . $from . '@' . $domain . '>' . \"\\r\\n\";\n $subject = 'Password reset for ' . $site_name;\n $message =\n 'We received a request to reset the password for your ' . $site_name . ' account (' . $user_login . ').' . \"\\r\\n\\r\\n\" .\n 'To reset your password, click on the link below (or copy and paste the URL into your browser): ' . $reset_url . \"\\r\\n\\r\\n\" .\n 'If this was a mistake, just ignore this email.' . \"\\r\\n\";\n\n return wp_mail( $to, $subject, $message, $headers );\n\n}", "public function sendPasswordResetMail($email, $passwordResetUrl);", "public function resetpassword() {\n\n $this->form_validation->set_error_delimiters(ERROR_START_DIV, ERROR_END_DIV);\n $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');\n\n if ($this->form_validation->run() == FALSE) {\n $msg = validation_errors();\n $this->session->set_flashdata('msg', $msg);\n redirect('Masteradmin/forgotpassword');\n } else {\n $exitEmailId = $this->checkEmailId($this->input->post('email'));\n if (empty($exitEmailId)) {\n // error\n $msg = $this->lang->line('email_id_not_exit');\n $this->session->set_flashdata('msg', \"<div class='alert alert-danger text-center'>$msg</div>\");\n //redirect('user/register');\n redirect('Masteradmin/forgotpassword');\n } else {\n if ($this->input->post('email')) {\n\n $token = md5($this->input->post('email') . date(\"Y-m-d H:i:s\"));\n $newpasswordlink = \"<a href='\" . base_url() . \"/Masteradmin/updatepassword?token=\" . $token . \"'>\" . \"Click Here\" . \"</a>\";\n\n // Get Template from Template Master\n $table = EMAIL_TEMPLATE_MASTER . ' as et';\n // $match = \"et.subject ='Forgot Password' \";\n $match = \"et.template_id =1\";\n $fields = array(\"et.subject,et.body\");\n $template = $this->common_model->get_records($table, $fields, '', '', $match);\n\n $body1 = str_replace(\"{PASS_KEY_URL}\", $newpasswordlink, $template[0]['body']);\n\n $to = $this->input->post('email');\n $body = str_replace(\"{SITE_NAME}\", base_url(), $body1);\n $subject = \"NFC Tracker :: \" . $template[0]['subject'];\n\n $data = array('reset_password_token' => $token, 'modified_date' => datetimeformat());\n $where = array('email' => $this->input->post('email'));\n\n if ($this->common_model->update(LOGIN, $data, $where)) {\n //send_mail($to, $subject, $body);\n if (send_mail($to, $subject, $body)) {\n $msg = $this->lang->line('new_password_sent');\n } else {\n\n $msg = $this->lang->line('FAIL_WITH_SENDING_EMAILS');\n }\n\n $this->session->set_flashdata('msg', \"<div class='alert alert-success text-center'>$msg</div>\");\n redirect('Masteradmin/forgotpassword');\n } else {\n // error\n $msg = $this->lang->line('error_msg');\n $this->session->set_flashdata('msg', \"<div class='alert alert-danger text-center'>$msg</div>\");\n //redirect('user/register');\n redirect('Masteradmin/forgotpassword');\n }\n }\n }\n\n redirect('Masteradmin/forgotpassword');\n }\n }", "public function email() {\r\n $this->load->view('layout/templates/email', $this->template_vars);\r\n }" ]
[ "0.72698987", "0.7262193", "0.7234204", "0.7233058", "0.71064216", "0.7062785", "0.703742", "0.7015988", "0.6984188", "0.6935658", "0.6909429", "0.6872221", "0.68720245", "0.68719643", "0.68355936", "0.6819674", "0.67812276", "0.6778805", "0.6769342", "0.6730069", "0.6709682", "0.6702604", "0.67012584", "0.6692472", "0.66810614", "0.66696215", "0.6663006", "0.6656751", "0.6655428", "0.66492265" ]
0.78060836
0
Show the form for creating a new LabelVariable.
public function create() { //Valida se usuário possui permissão para acessar esta opção if(App\Models\User::getPermission('label_variables_add',Auth::user()->user_type_code)){ return view('print.label_variables.create'); }else{ //Sem permissão Flash::error(Lang::get('validation.permission')); return redirect(route('label_variables.index')); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function create()\n\t{\n\t\treturn view('variables.create');\n\t}", "public function create()\n {\n return view('eval.form', [\n 'action' => 'eval/tambah',\n 'subtitle' => 'Existence Value',\n ]);\n }", "public function create() {\n\t\t$this->initForm();\n\t\t$this->getStandardValues();\n\t\t$this->tpl->setContent($this->form->getHTML());\n\t}", "public function create()\n {\n $label = new Label();\n return response()->view('label.create', compact('label'));\n }", "public function create()\n {\n $data = old($this->name);\n $allTags = Tag::lists('id', 'name');\n return view('admin.label.create', compact('fields'))->with('allTags', $allTags)->with('name',$data);\n }", "public function setLabel($var) {}", "private function create_label($label)\n\t{\n\t\tif ($mylabel = $this->get_label($label))\n\t\t{\n\t\t\t$this->pair .= form::label($this->id, $mylabel, $this->label_extra);\n\t\t}\n\n\t}", "public function newAction($id)\n {\n $issueLabel = $this->issueLabelRepository->newLabel();\n $form = $this->createCreateForm($issueLabel);\n\n return array_merge($this->viewVariables, array(\n 'entity' => $issueLabel,\n 'form' => $form->createView(),\n ));\n }", "public function create()\n {\n return view('marketing.eduzz.form',[\n 'title_postfix' => $this->configs['new'],\n 'navigation' => $this->navigation,\n ]);\n }", "public function actionCreate()\n {\n //create new instance\n $model = new SystemLabel();\n\n //check if form submitted then validate, save and redirect\n if ($model->load(Yii::$app->request->post()) && $model->save()) {\n\n //showing success message and redirect\n \\Yii::$app->getSession()->setFlash('success', 'System-label created successfully.');\n return $this->redirect(['index']);\n //return $this->redirect(['view', 'id' => $model->label_id]);\n\n } else {\n //if form was not submit set screen-window data and show input form\n $screenWindow = ArrayHelper::map(ScreenWindow::find()->all(), 'window_id', 'window_name');\n\n return $this->render('create', [\n 'model' => $model,\n 'screenWindow' => $screenWindow,\n ]);\n }\n }", "public function create()\n {\n return view('adminpanel.varsity.addvarsity'); \n }", "public function create()\n {\n $label = new LabelTemplate();\n\n return view('labelTemplates.create')->with('label', $label);\n }", "public function show()\n {\n $template = parent::show();\n if ($this->getValue() !== null && ($this->getValue() == $this->getName() || $this->getValue() === true)) {\n $template->setAttr('element', 'checked', 'checked');\n }\n $template->setAttr('element', 'value', $this->getName());\n $template->setAttr('hidden', 'name', $this->getName());\n $template->setAttr('hidden', 'value', '');\n $template->setAttr('checkbox-label', 'for', $this->getId());\n if ($this->getCheckboxLabel()) {\n $template->insertHtml('label', $this->getCheckboxLabel());\n $template->addCss('checkbox', 'is-cbl');\n }\n return $template;\n }", "protected function formCreate()\n {\n _p('<b>formCreate</b> called<br/>', false);\n // Define the Label -- Set HtmlEntities to false because we intend on hard coding HTML into the Control\n $this->lblMessage = new Label($this);\n $this->lblMessage->HtmlEntities = false;\n $this->lblMessage->Text = 'Click the button to change my message.';\n\n // Definte the Button\n $this->btnButton = new Button($this);\n $this->btnButton->Text = 'Click Me!';\n\n // We add CausesValidation to the Button so that formValidate() will get called\n $this->btnButton->CausesValidation = true;\n\n // Add a Click event handler to the button -- the action to run is a ServerAction (e.g. PHP method)\n // called \"btnButton_Click\"\n $this->btnButton->addAction(new Click(), new Server('btnButton_Click'));\n }", "function FormLabel($id, $value) {\n $output = sprintf('<label for=\"%s\">%s</label> :', $id, $value);\n return $output;\n}", "public function newAction()\n {\n $entity = new Configfield();\n $form = $this->createForm(new ConfigfieldType(), $entity);\n\n return $this->render('HegesAppConfigFileBundle:Configfield:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView()\n ));\n }", "public function create()\n {\n\n return view('profile.form')->with([\n 'suffix' => $this->suf,\n ]);\n }", "public function newAction()\n {\n $entity = new NotificationParameter();\n $form = $this->createCreateForm($entity);\n\n return $this->render('MesdNotificationBundle:NotificationParameter:new.html.twig', array(\n 'entity' => $entity,\n 'form' => $form->createView(),\n ));\n }", "public function create()\n {\n return view('backend.optionvalues.create');\n }", "public function create()\n\t{\n\t\treturn View::make('ref_objective_codes.create');\n\t}", "public function addInputLabel($label);", "public function newLookupForm()\n {\n return view::make($this->viewPath . 'new');\n }", "public function create()\n\t{\n\t\t$form = $this->initForm(true);\n\t\tif ($form->checkInput())\n\t\t{\n\t\t\t$properties = array(\n\t\t\t\t\"value_1\" => $form->getInput(\"val1\")//,\n\t\t\t\t//\"value_2\" => $form->getInput(\"val2\")\n\t\t\t);\n\t\t\tif ($this->createElement($properties))\n\t\t\t{\n\t\t\t\tilUtil::sendSuccess($this->lng->txt(\"msg_obj_modified\"), true);\n\t\t\t\t$this->returnToParent();\n\t\t\t}\n\t\t}\n\n\t\t$form->setValuesByPost();\n\t\t$this->tpl->setContent($form->getHtml());\n\n\t}", "public function create()\n {\n return view ('fields.create');\n }", "protected function addField()\n\t{\n\t\t$this->initFieldForm(self::MODE_CREATE);\n\t\t\n\t\t$this->form->getItemByPostVar('va')->setValues(array(''));\n\t\t\n\t\t$this->tpl->setContent($this->form->getHTML());\n\t}", "public function create() {\n $viewData = $this->getDefaultFormViewData();\n $viewData[\"mode\"] = \"create\";\n $viewData[\"supplier\"] = new Supplier();\n\n $viewData[\"supplier\"]->supplier_number = NumberSeries::getNextNumber(Supplier::MODULE_CODE);\n\n return view(\"{$this->viewPath}.form\", $viewData);\n }", "public function create()\n {\n $xlcdLocationFormGUI = new xlcdLocationFormGUI($this, new xlcdLocation());\n\n $xlcdLocationFormGUI->setValuesByPost();\n if ($xlcdLocationFormGUI->save()) {\n ilUtil::sendSuccess($this->pl->txt('system_account_msg_success'), true);\n $this->ctrl->redirect($this);\n }\n $this->tpl->setContent($xlcdLocationFormGUI->getHTML());\n }", "public function create()\n {\n return view($this->sPath.'/form', ['sPageTitle' => $this->sName]);\n }", "public function create()\n {\n return view('panel.attributes.create');\n }", "public function show()\n {\n $this->tag->name = $this->name;\n $this->tag->value = $this->value;\n $this->tag->type = 'checkbox';\n\n //se o campo é editavel\n if(!parent::getEditable())\n {\n $this->tag->readonly = \"1\";\n }\n\n //exive a tag\n $this->tag->show();\n\n }" ]
[ "0.6613216", "0.63539946", "0.62667793", "0.6225991", "0.6188576", "0.61716336", "0.6147151", "0.6050979", "0.5966524", "0.59520787", "0.59350514", "0.59176403", "0.5864745", "0.58142596", "0.58105797", "0.57933223", "0.57916117", "0.57826716", "0.5769119", "0.57670397", "0.57349813", "0.5733966", "0.57317775", "0.5725435", "0.57239187", "0.57123715", "0.5688855", "0.56797916", "0.5673129", "0.5671962" ]
0.6761433
0
Store a newly created LabelVariable in storage.
public function store(CreateLabelVariableRequest $request) { $input = $request->all(); //Valida se Tabela e Campo existem no Banco de Dados if(!Schema::hasTable($input['table'])){ Flash::error('Tabela informada não existe no sistema.'); }else if(!Schema::hasColumn($input['table'], $input['field'])) { Flash::error('Campo não encontrado na tabela informada.'); }else{ $labelVariable = $this->labelVariableRepository->create($input); Flash::success(Lang::get('validation.save_success')); return redirect(route('labelVariables.index')); } //Retorna para a tela de inputs sem perder os valores return redirect()->back() ->withInput(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function store($var);", "public function store()\n\t{\n\t\t$metadata = new Metadata;\n\t\t$metadata->fill(Input::all());\n\t\t$metadata->key = 'custom_' . $metadata->key;\n\n\t\t$metadata->save();\n\n\t\treturn Redirect::route('admin.extend.variables.index');\n\t}", "public function store(LabelRequest $request)\n {\n $user = auth()->user();\n $user->labels()->create($request->all());\n flash(__('messages.labelWasCreated'), 'success');\n return redirect()->route('labels.index');\n }", "public function store(LabelCreateUpdateRequest $request)\n {\n $label = Label::create($request->labelFillData());\n $label->syncTags($request->input('tags', []));\n return redirect('/admin/tag')\n ->withSuccess(\"大标签 '$label->name' 已创建\");\n }", "public function store(CreateactivityVariableAPIRequest $request)\n {\n $input = $request->all();\n\n $activityVariables = $this->activityVariableRepository->create($input);\n\n return $this->sendResponse($activityVariables->toArray(), 'Activity Variable saved successfully');\n }", "public static function put($variable, $value, $persistence = 'session') {\n\t\t// Do we need to store this variable in the session?\n\t\tif ($persistence == 'session') {\n\t\t\t$_SESSION['store'][$variable] = is_array($value) || is_object($value)\n\t\t\t\t? serialize($value)\n\t\t\t\t: $value;\n\t\t}\n\n\t\t// A local variable\n\t\tself::$store[$variable] = $value;\n\t}", "public function store(Request $request)\n {\n $label = $this->labelTemplateFactory->createFromRequest($request);\n $this->labelTemplateRepository->save($label);\n flash()->success('Label Template \\'' . $label->getTemplateName() . '\\' created.');\n\n return redirect()->route('labels.show', ['label' => $label->getTemplateName()]);\n }", "public function store()\n {\n $this->storage->set($this);\n\n }", "public function store(Request $request)\n\t{\n\t\t$variable = new Variable();\n\n $main = json_decode($request->input('main'), true);\n $data = json_decode($request->input('data'), true);\n\n $json_array = [\n $main['value'],\n ];\n $sets_array = [\"0\"];\n\n foreach($data as $d){\n $sets_array[] = $d['select'];\n $json_array[] = $d['input'];\n }\n\n $json = json_encode($json_array);\n $set = json_encode($sets_array);\n\n\t\t$variable->key = str_replace(\"&amp;\", \"&\", $main['key']);\n $variable->value = $json;\n $variable->sets = $set;\n\t\t$variable->save();\n\n\t\treturn redirect()->route('variables.index')->with('message', 'Item created successfully.');\n\t}", "private function add_var( $name, $value ) {\n\t\t\t$this->datalayer[$name] = $value;\n\t\t}", "public function writeVariable($name, $value);", "private function persistLabelTags() {\r\n\t\t$hash = $this->getHash();\r\n\t\t$fileContent = $hash.\";\".$this->name;\r\n\t\tforeach ( $this->functionTags as $id => $tag ) {\r\n\t\t\t$fileContent .= \"\\nfunction;\".$this->functions[$id].\";\".$this->taggedFunctions[$id].\";\".$tag;\r\n\t\t}\r\n\t\tforeach ( $this->eventTags as $id => $tag ) {\r\n\t\t\t$fileContent .= \"\\nevent;\".$this->events[$id].\";\".$this->taggedEvents[$id].\";\".$tag;\r\n\t\t}\r\n\t\t\r\n\t\t$fileGenerator = new FileGenerator(\"NLP-Tags_\".$hash.\".csv\", $fileContent);\r\n\t\t$fileGenerator->setFilename(\"NLP-Tags_\".$hash.\".csv\");\r\n\t\t$fileGenerator->setContent($fileContent);\r\n\t\t$fileGenerator->setPath(\"persistedData\");\r\n\t\treturn $fileGenerator->execute(false);\r\n\t}", "public function store($key, $value);", "public function create()\n {\n //Valida se usuário possui permissão para acessar esta opção\n if(App\\Models\\User::getPermission('label_variables_add',Auth::user()->user_type_code)){\n\n return view('print.label_variables.create');\n\n }else{\n //Sem permissão\n Flash::error(Lang::get('validation.permission'));\n return redirect(route('label_variables.index'));\n }\n }", "public function store()\r\n\t{\r\n\t\t//\r\n\t}", "public function store($key, $var = null, $ttl = 0)\n\t{\n\t\t$ttl = ($ttl === 0) ? PHP_INT_MAX : time() + $ttl;\n\n\t\t$this->data[$key] = array($var, $ttl);\n\n\t\treturn true;\n\t}", "function register($var, $value) {\n\t\t$this->variables[$var] = $value;\n\t}", "public function save_var_value()\n {\n\t\t// get array\n\t\t\t$get=$this->get_input_vals();\n\n\t\t// save the var value\n\t\t\t$this->variation_model->save_var_value($get);\n\n\t\t// get the full var type with values\n\t\t\t$vtype=$this->variation_model->get_var_type($get['var_type_id']);\n\n exit(json_encode($this->variation_model->get_var_values_html($vtype)));\n }", "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.61595076", "0.60467774", "0.5737969", "0.57036686", "0.5636469", "0.541649", "0.540908", "0.53624004", "0.53572536", "0.53299946", "0.530055", "0.52587456", "0.5240081", "0.5207535", "0.5200848", "0.5195421", "0.51916057", "0.5165433", "0.51331615", "0.51331615", "0.51331615", "0.51331615", "0.51331615", "0.51331615", "0.51331615", "0.51331615", "0.51331615", "0.51331615", "0.51331615", "0.51331615" ]
0.66584927
0
Show the form for editing the specified LabelVariable.
public function edit($id) { //Valida se usuário possui permissão para acessar esta opção if(App\Models\User::getPermission('label_variables_edit',Auth::user()->user_type_code)){ $labelVariable = $this->labelVariableRepository->findWithoutFail($id); if (empty($labelVariable)) { Flash::error(Lang::get('validation.not_found')); return redirect(route('labelVariables.index')); } return view('print.label_variables.edit')->with('labelVariable', $labelVariable); }else{ //Sem permissão Flash::error(Lang::get('validation.permission')); return redirect(route('label_variables.index')); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function edit(LabelTemplate $label)\n {\n return view('labelTemplates.edit')->with('label', $label);\n }", "function edit()\n\t{\n\t\terror_log(\"show the vacation EDIT form\\n\", 3, JPATH_ROOT.DS.\"logs\".DS.\"salonbook.log\");\n\t\t\n\t\tJRequest::setVar('view','vacation');\n\t\tJRequest::setVar('layout','edit');\n\t\tJRequest::setVar('hidemanmenu',true);\n\t\t\n\t\tparent::display();\n\t}", "public static function taxonomy_edit_form( $tag, $taxonomy ) {\n\t\tself::panel( $tag, $taxonomy );\n\t\t\n\t}", "public function edit(Label $label)\n {\n return response()->view('label.edit', compact('label'));\n }", "public function edit($id)\n {\n $label = Label::findOrFail($id);\n $allTags = Tag::lists('id', 'name')->all();\n $tags = $label->tags()->lists('tag_id')->all();\n $data = ['id' => $id, 'name' => $label->name, 'allTags' => $allTags, 'tags' => $tags, 'label' => $label];\n\n return view('admin.label.edit', $data);\n }", "function edit()\r\n\t{\r\n\t\tJRequest::setVar( 'view', 'Suggestion' );\r\n\t\tJRequest::setVar( 'layout', 'form' );\r\n\t\tJRequest::setVar( 'hidemainmenu', 1);\r\n\r\n\t\tparent::display();\r\n\t}", "public function edit()\n {\n JRequest::setVar( 'view', 'actions' );\n JRequest::setVar( 'layout', 'form' );\n JRequest::setVar( 'hidemainmenu', 1 );\n\n parent::display();\n }", "public function show()\n {\n $this->tag->name = $this->name;\n $this->tag->value = $this->value;\n $this->tag->type = 'checkbox';\n\n //se o campo é editavel\n if(!parent::getEditable())\n {\n $this->tag->readonly = \"1\";\n }\n\n //exive a tag\n $this->tag->show();\n\n }", "function btn_EditStorageFacilityReportOnClick($sender, $varname, $varvalue)\n\t\t{\n\t\t\t$context = $this->getContext();\n\t\t\tif ($context == null) return;\n\t\t\tif ($context->application == null) return;\n\t\t\t\t\n\t\t\t$frm = $context->application->CreateForm('frm_StorageFacilityReportDLG.xml');\n\t\t\tif ($frm != null) $frm->editEntry($this->ID_StorageReport, $varvalue);\n\t\t}", "public function edit($id)\n\t{\n\t\t$variable = Variable::findOrFail($id);\n\n\t\treturn view('variables.edit', compact('variable'));\n\t}", "public function edit()\n {\n //It cannot retrieve an id for the location so it wants to create a new one. (is_new) {SOLVED}\n if ($this->access->hasWriteAccess()) {\n $xlcdLocationFormGUI = new xlcdLocationFormGUI($this, xlcdLocation::find($_GET[self::IDENTIFIER]));\n $xlcdLocationFormGUI->fillForm();\n $this->tpl->setContent($xlcdLocationFormGUI->getHTML());\n } else {\n $this->ctrl->redirect(ilMyTableGUI::class);\n }\n }", "public function edit() {\n return $this->app->html->_('control.text', $this->getControlName('value'), $this->get('value', $this->config->get('default')), 'size=\"60\" maxlength=\"255\"');\n }", "public function showCategoryEditForm($category)\n {\n include UAM_REALPATH.'tpl/categoryEditForm.php';\n }", "public function showFormAsociarse() {\n $this->smarty->display('templates/showFormAsociarse.tpl');\n }", "public function form()\n {\n\t\t$this->hidden('id');\n\t\t//$this->switch('open', '启用位置')->help('是否启用位置功能');\n $this->tags('poses', '设置位置')->help('设置位置,如 焦点,精华,固顶等');\n }", "private function editForm($id) {\n\n $this->getView($id);\n }", "public function edit($id)\n {\n $oItem = $this->oRepository\n ->getFillFromView($this->sPath.'/form')\n ->find($id);\n \n $sPageTitle = $this->sName;\n \n return view($this->sPath.'/form', compact('oItem','sPageTitle'));\n }", "public function setLabel($var) {}", "function edit()\n {\n $this->_view_edit('edit');\n }", "public function editForm($id)\n {\n /* Check if instance exists, will throw if not existing */\n $homework = $this->homework->findOrFail($id);\n\n /* If current user is the owner or has permission for this action */\n if( Auth::user()->id !== $homework->author && !Auth::user()->has('edit-homework') )\n return $this->notFound();\n\n $subjects = $this->subject->options();\n\n return View::make('edit-homework')\n ->with('title', 'Huiswerk bewerken')\n ->with('homework', $homework)\n ->with('subjects', $subjects);\n }", "public function edit_form($taxonomy){\n $id = $taxonomy->term_id;\n $term_meta = get_option( \"taxonomy_$id\" );\n echo \"<p><br/><p/><h3>Content</h3>\";\n echo \"<p>Add content to display on the series&rsquo; hub page.</p>\";\n FMSeries::build_panel('term_meta[my_content]', $term_meta['my_content']);\n }", "public function formEditAsistenciaManual(){\r\n Obj::run()->View->render();\r\n }", "public function showEditForm()\n {\n return view('profile.edit');\n }", "public function editForm() {\n $data = $this->parent->getModel('grades')->select(\"SELECT studentid, studentname, studentpercent FROM studentgrades WHERE studentid = :id\", [':id'=>$_GET['id']]);\n $this->getView('editForm', $data);\n }", "public function edit($id)\n {\n $ingredient = Ingredient::find($id);\n\n return \"Form for editing ingredient\";\n }", "public function _editActionView() {\n\t\tbfLoad ( 'bfSmarty' );\n\t\t\n\t\t$tmp = bfSmarty::getInstance ( 'com_form' );\n\t\t$tmp->caching = false;\n\t\t$tmp->assignFromArray ( $this->_config );\n\t\t\n\t\t$tmp->assign ( 'CONFIG', $this->_config );\n\t\t\n\t\t$disabled = bfHTML::yesnoRadioList ( 'published', '', $this->_config ['published'] );\n\t\t$tmp->assign ( 'PUBLISHED', $disabled );\n\t\t\n\t\t$CUSTOM6 = bfHTML::yesnoRadioList ( 'custom6', '', $this->_config ['custom6'] );\n\t\t$tmp->assign ( 'CUSTOM6', $CUSTOM6 );\n\t\t\n\t\t$OPTIONS = array (bfHTML::makeOption ( '0', 'Public' ), bfHTML::makeOption ( '1', 'Registered' ), bfHTML::makeOption ( '2', 'Special' ) );\n\t\t\n\t\t$access = bfHTML::selectList2 ( $OPTIONS, 'access', '', 'value', 'text', $this->_config ['access'] );\n\t\t$tmp->assign ( 'ACCESS', $access );\n\t\t\n\t\t$OPTIONS = array (bfHTML::makeOption ( 'POST', 'POST' ), bfHTML::makeOption ( 'GET', 'GET' ) );\n\t\t$custom4 = bfHTML::selectList2 ( $OPTIONS, 'custom4', '', 'value', 'text', $this->_config ['custom4'] );\n\t\t$tmp->assign ( 'CUSTOM4', $custom4 );\n\t\t\n\t\t$tmp->display ( dirname ( __FILE__ ) . DS . 'editView.tpl' );\n\t\n\t}", "public function edit_job() {\n\t\tglobal $job_manager;\n\n\t\techo $job_manager->forms->get_form( 'edit-job' );\n\t}", "public function edit_label($edit = -1, $mode = 'inbox') {\n\n $label = $this->message->getLabelById($edit);\n\n AZ::layout('block-only', array(\n 'block' => 'messages/label-form',\n 'label' => $label,\n 'mode' => $mode,\n ));\n }", "public function edit(DomainFormBuilder $form, $id)\n {\n return $form->render($id);\n }", "function showform(){\n $rep = $this->getResponse('html');\n $rep->title = 'Form editing';\n $rep->body->assign('page_title', 'forms');\n\n // recupère les données du formulaire dont l'id est dans le paramètre id\n $form = jForms::get('sample2', $this->param('id'));\n if ($form) {\n $tpl = new jTpl();\n $tpl->assign('form', $form->getContainer());\n $tpl->assign('id', $form->id());\n if ($form->securityLevel != jFormsBase::SECURITY_LOW)\n $tpl->assign('token', $form->createNewToken());\n else\n $tpl->assign('token','');\n $rep->body->assign('MAIN',$tpl->fetch('forms_edit'));\n }else{\n $rep->body->assign('MAIN','<p>bad id</p>' );\n }\n\n return $rep;\n }" ]
[ "0.6078672", "0.60307103", "0.602961", "0.60294276", "0.6003634", "0.5988375", "0.59292364", "0.5866234", "0.5832244", "0.5791934", "0.5679556", "0.5655874", "0.5648897", "0.5643445", "0.5640473", "0.5632344", "0.5606021", "0.55921996", "0.55870295", "0.5582062", "0.5568081", "0.556107", "0.555165", "0.5548315", "0.5541488", "0.5512539", "0.549264", "0.54914665", "0.54844314", "0.5482058" ]
0.6267922
0
Update the specified LabelVariable in storage.
public function update($id, UpdateLabelVariableRequest $request) { $labelVariable = $this->labelVariableRepository->findWithoutFail($id); if (empty($labelVariable)) { Flash::error(Lang::get('validation.not_found')); return redirect(route('labelVariables.index')); } //Grava log $requestF = $request->all(); $descricao = 'Alterou LabelVariable ID: '.$id.' - '.$requestF['code']; $log = App\Models\Log::wlog('label_variables_edit', $descricao); $labelVariable = $this->labelVariableRepository->update($request->all(), $id); Flash::success(Lang::get('validation.update_success')); return redirect(route('labelVariables.index')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function updateVariable(CachedVariable $variable): CachedVariable;", "public function update(LabelRequest $request, Label $label)\n {\n $user = auth()->user();\n $label->user()->associate($user);\n $label->fill($request->all());\n $label->save();\n flash(__('messages.labelWasUpdated'), 'success');\n return redirect()->route('labels.index');\n }", "public function updateVariable($id, $varName, $value, $type = null, $valueInfo = null)\n {\n $type = is_null($type) ? gettype($value) : $type;\n return $this->getApi()->postJson([\n 'value' => $value,\n 'type' => $type,\n 'valueInfo' => $valueInfo\n ])\n ->methodPut()\n ->execute(\"process-instance/$id/variables/$varName\");\n }", "public function update(Request $request)\n {\n $ID_VARIABLE = $request->ID_VARIABLE;\n $ID_SLAVE = $request->ID_SLAVE;\n $ID_SLOT = $request->ID_SLOT;\n $VARIABLE_NAME = $request->VARIABLE_NAME;\n $TYPE = $request->TYPE;\n $ACCESS = $request->ACCESS;\n $ADDRESS = $request->ADDRESS;\n $VALUE=\"\";\n\n if ($TYPE == 'BOOL') {\n $VALUE = 'FALSE';\n } elseif ($TYPE == 'DOUBLE') {\n $VALUE = 0;\n } elseif ($TYPE == 'INT') {\n $VALUE = 0;\n } elseif ($TYPE == 'REAL') {\n $VALUE = 0;\n } elseif ($TYPE == 'FLOAT') {\n $VALUE = 0;\n } elseif ($TYPE == 'STRING') {\n $VALUE = 0;\n }\n\n $slave_variables = RcbModel::where('ID_VARIABLE', '=', $ID_VARIABLE)\n ->update([\n 'ID_SLAVE' => $ID_SLAVE,\n 'ID_SLOT' => $ID_SLOT,\n 'VARIABLE_NAME' => $request->VARIABLE_NAME,\n 'TYPE' => $request->TYPE,\n 'ACCESS' => $request->ACCESS,\n 'ADDRESS' => $ADDRESS,\n 'VALUE' => $VALUE,\n ]);\n\n // alihkan halaman ke halaman /variable-list/slave-variable\n return redirect('/variable-list/rcb-variable')\n ->with('update-success', 'Data has ben updated!');\n }", "public function update(Request $request, LabelTemplate $label)\n {\n $label->setTemplateName($request['templateName']);\n $label->setTemplate($request['template']);\n\n $this->labelTemplateRepository->save($label);\n flash()->success('Label Template \\'' . $label->getTemplateName() . '\\' updated.');\n\n return redirect()->route('labels.show', ['label' => $label->getTemplateName()]);\n }", "private function updateDV($label, array $dv)\n\t{\n\t\t$this->nDVs[$label] = $dv;\n\t}", "public function update(Request $request, $id)\n\t{\n\t\t$variable = Variable::findOrFail($id);\n\n $main = json_decode($request->input('main'), true);\n $data = json_decode($request->input('data'), true);\n\n\n $json_array = [\n $main['value'],\n ];\n $sets_array = [\"0\"];\n\n foreach($data as $d){\n $sets_array[] = $d['select'];\n $json_array[] = $d['input'];\n }\n\n $json = json_encode($json_array);\n $set = json_encode($sets_array);\n\n\n $variable->key = $main['key'];\n $variable->value = $json;\n $variable->sets = $set;\n $variable->save();\n\n return redirect()->route('variables.index')->with('message', 'Item updated successfully.');\n\t}", "public function update($id)\n\t{\n\t\t$metadata = Metadata::find($id);\n\n\t\t$metadata->fill(Input::all());\n\t\t$metadata->key = 'custom_' . $metadata->key;\n\t\t$metadata->save();\n\n\t\treturn Redirect::route('admin.extend.variables.index');\n\t}", "public function setValueAction()\n {\n $value = $_REQUEST['varValue'];\n $matches = array();\n\n if (isset($this->variable_doc_links[$_REQUEST['varName']][3])\n && $this->variable_doc_links[$_REQUEST['varName']][3] == 'byte'\n && preg_match(\n '/^\\s*(\\d+(\\.\\d+)?)\\s*(mb|kb|mib|kib|gb|gib)\\s*$/i',\n $value,\n $matches\n )\n ) {\n $exp = array(\n 'kb' => 1,\n 'kib' => 1,\n 'mb' => 2,\n 'mib' => 2,\n 'gb' => 3,\n 'gib' => 3\n );\n $value = floatval($matches[1]) * pow(\n 1024,\n $exp[mb_strtolower($matches[3])]\n );\n } else {\n $value = $GLOBALS['dbi']->escapeString($value);\n }\n\n if (! is_numeric($value)) {\n $value=\"'\" . $value . \"'\";\n }\n\n if (! preg_match(\"/[^a-zA-Z0-9_]+/\", $_REQUEST['varName'])\n && $this->dbi->query(\n 'SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value\n )\n ) {\n // Some values are rounded down etc.\n $varValue = $this->dbi->fetchSingleRow(\n 'SHOW GLOBAL VARIABLES WHERE Variable_name=\"'\n . $GLOBALS['dbi']->escapeString($_REQUEST['varName'])\n . '\";', 'NUM'\n );\n list($formattedValue, $isHtmlFormatted) = $this->_formatVariable(\n $_REQUEST['varName'], $varValue[1]\n );\n\n if ($isHtmlFormatted == false) {\n $this->response->addJSON(\n 'variable',\n htmlspecialchars(\n $formattedValue\n )\n );\n } else {\n $this->response->addJSON(\n 'variable',\n $formattedValue\n );\n }\n } else {\n $this->response->setRequestStatus(false);\n $this->response->addJSON(\n 'error',\n __('Setting variable failed')\n );\n }\n }", "public function setVar($variable,$value){\n $this->dataArr[$variable] = $value;\n }", "protected function _update ()\n {\n $storage = $this->_make_storage ();\n $storage->update_object ($this);\n }", "public function set($variable, $value) {\n\t\t$this->session[$this->prefix.\"new\"][$variable] = $value;\n\t\t$this->session[$this->prefix.\"old\"][$variable] = $value;\n\t}", "public function doUpdate() {\r\n\t\t// need to set the where clause\r\n\t\t$v = $this->valueObject->getvariable();\r\n\t\t$where[] = array('variable'=>$v);\r\n\t\t$this->valueObject->getQueryObject()->setWhere($where);\r\n\r\n\t\t//$sql = $this->getSQLFactory()->prepUpdateStatement($this->valueObject);\r\n\t\t$result = $this->getDBFactory()->doUpdate($this->valueObject);\r\n\r\n\t}", "public function update(Request $request, Varsity $varsity)\n {\n //\n }", "public function setLabel($var) {}", "public function setLabel(?string $value): void {\n $this->getBackingStore()->set('label', $value);\n }", "public function update( $name, $value );", "public function update(LabelCreateUpdateRequest $request, $id)\n {\n $label = Label::findOrFail($id);\n $label->fill($request->labelFillData());\n $label->save();\n $label->syncTags($request->get('tags', []));\n return redirect('/admin/tag')\n ->withSuccess(\"已修改\");\n }", "public function ltiParameterUpdate($varname, $value) {\n if ( ! isset($this->launch) ) return;\n return $this->launch->ltiParameterUpdate($varname, $value);\n }", "public function update(Request $request, $id)\n {\n //dd($id);\n $this->validate($request, ['nombre' => 'required', 'nivel' => 'required']);\n\n diccionario_variable::find($id)->update($request->all());\n return redirect()->route('variable.index')->with('success', 'Registro actualizado satisfactoriamente');\n }", "public function update($input)\r\n {\r\n $this->value = $input;\r\n\r\n $this->validate();\r\n }", "public function update(Request $request, Storage $storage)\n {\n //\n }", "public function update(Request $request, $id)\n {\n $peticion = $request->all();\n $arreglo = $peticion[\"data\"];\n\n $variable = Variable::find($id);\n\n $variable->sal_diario = $arreglo['sal_diario'];\n $variable->alimentacion = $arreglo['alimentacion'];\n $variable->vacaciones = $arreglo['vacaciones'];\n $variable->inss_campo = $arreglo['inss_campo'];\n $variable->inss_admin = $arreglo['inss_admin'];\n $variable->cuje_peq = $arreglo['cuje_peq'];\n $variable->cuje_grand = $arreglo['cuje_grand'];\n $variable->hora_ext = $arreglo['hora_ext'];\n $variable->septimo = $arreglo['septimo'];\n $variable->inss_patron = $arreglo['inss_patron'];\n $variable->inss_patron_catorce = $arreglo['inss_patron_catorce'];\n $variable->safa_grand = $arreglo['safa_grand'];\n $variable->safa_peq = $arreglo['safa_peq'];\n $variable->save();\n return \"Registro Actualizado\";\n }", "function updateMemoryVarList(){\n shm_put_var($this->id, 0, $this->nameToKey);\n }", "public function update() {\n\t\t$_SESSION = $this->data;\n\t}", "public function setLabels(?Dictionary $value): void {\n $this->getBackingStore()->set('labels', $value);\n }", "public function updateAction($value);", "static function requirementUpdate($label, $value, $meta = 'status')\n\t{\n\n\t\t$status = self::requirementsStatus();\n\t\tif (!is_array($status)) $status = array();\n\n\t\tif (array_key_exists($label, $status)) $metas = $status[$label];\n\t\telse $metas = array();\n\n\t\tif ($meta == 'status' && $metas['status'] != $value) $metas['updated'] = time(); //mark as update only if changed\n\t\t$metas[$meta] = $value;\n\n\t\t$status[$label] = $metas;\n\t\tupdate_option( __CLASS__ . '_requirements', $status);\n\t}", "public function setVariable(?string $variableName, $value, ...$args): void;", "public function updateLabel($id){\n $lang = $this->Cms_model->getValueArray('lang_iso', 'lang_iso', \"lang_iso != ''\", '');\n foreach($lang as $value){\n $this->db->set('lang_'.$value['lang_iso'], $this->input->post(\"lang_\".$value['lang_iso'], TRUE), TRUE);\n }\n $this->db->set('timestamp_update', 'NOW()', FALSE);\n $this->db->where('general_label_id', $id);\n $this->db->update('general_label');\n }" ]
[ "0.61442107", "0.57056737", "0.5697752", "0.55588347", "0.55135614", "0.54210323", "0.5378886", "0.53592914", "0.52909017", "0.5251897", "0.5192144", "0.51678234", "0.51405555", "0.50764406", "0.5039261", "0.50325954", "0.50242805", "0.49827036", "0.49474722", "0.49421787", "0.493031", "0.49157077", "0.49056473", "0.48974383", "0.48905435", "0.4885889", "0.4867898", "0.48555028", "0.48503348", "0.4839708" ]
0.6362603
0
End function get user resume and CV by user ID
function get_user_resume($where){ $resume = base_url().USER_RESUME; $cv = base_url().USER_CV; $this->db->select('COALESCE(user_resume,"") as user_resume, COALESCE(user_cv,"") as user_cv, (case when(user_resume = "") THEN "" ELSE CONCAT ("'.$resume.'",user_resume) END ) as user_resume_url , (case when(user_cv = "") THEN "" ELSE CONCAT("'.$cv.'",user_cv) END ) as user_cv_url'); $res = $this->db->where($where)->get(USER_META)->row(); return $res; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function userfileDetails($user_id) {\n $select = $this->pdo->prepare(\"SELECT resume_file_data,resume_file_name,first_name,last_name FROM user_profile left join users on user_profile.user_id=users.id WHERE user_id=?\");\n $select->execute(array($user_id));\n $user_details = $select->fetch(PDO::FETCH_ASSOC);\n return $user_details;\n }", "private function complete_profile(){\n\t\t$this->load->model('resume_model');\n\t\t$user = $this->session->userdata('user');\n\t\t$profile_details = $this->resume_model->get_resume_details_by_user_id($user->id);\n\t\t$profile_education = $this->resume_model->get_resume_edu_by_user_id($user->id);\n\t\t$profile_experience = $this->resume_model->get_experience_by_id($user->id);\n\n\t\treturn ($profile_details != null && ($profile_education != null) && ($profile_experience != null)) ? true : false;\n\n\t}", "public function downloadResume($targetUser)\n\t{\n\t\tif($this->isAtLeastCoordinator())\n\t\t{\n\t\t\t\n\t\t}\n\t}", "function getUserResumeHeadlineDetails($user_id) {\n \n //echo $select;\n $select = $this->pdo->prepare(\"SELECT * FROM user_resume_headline WHERE user_id=?\");\n $select->execute(array($user_id));\n \n $user_details = $select->fetchAll(PDO::FETCH_ASSOC);\n \n return $user_details;\n }", "function _profile_progress($user_id, $email_id){\n $this->load->model(array('course_model', 'user_model'));\n $user_stat = array(\n 'completed_all_exams' => (($this->course_model->hasAttendedAllExams($user_id, 'P')) ? array('class'=>'visited') : FALSE),\n 'registerd_in_crashcourse' => FALSE,\n 'state_exam_applied' => FALSE,\n 'obtained_license' => FALSE,\n 'obtained_license_from' => FALSE\n );\n \n if($user_stat['completed_all_exams']) {\n \n if($this->course_model->isCrashCourseUser($email_id)){\n $user_stat['registerd_in_crashcourse'] = array('class' => 'visited');\n }\n\n $profile_progress = $this->user_model->getProfileProgress($user_id);\n\n /* Whether the user applied for State Exam */\n if($profile_progress && $this->_item_key_exists($profile_progress, 'state_exam_applied')){\n\n $user_stat['state_exam_applied'] = array('class' => 'visited');\n \n if($this->course_model->isCrashCourseUser($email_id)){\n $user_stat['obtained_license'] = array('class' => 'active');\n }\n\n /* Whether the user obtained license and applied for State Exam */\n if($profile_progress && $this->_item_key_exists($profile_progress, 'obtained_license')){\n $user_stat['obtained_license'] = array('class' => 'visited');\n \n if(!empty($profile_progress)){\n foreach($profile_progress as $key => $prog){\n if(\"obtained_license\" == $prog[\"item\"]){\n $user_stat['obtained_license_from'] = $prog[\"broker_name\"];\n }\n }\n }\n }\n }else{\n $user_stat['state_exam_applied'] = array('class' => 'active');\n }\n \n }\n \n $this->gen_contents['user_stat'] = $user_stat; \n /* Profile stage progress ends here */\n }", "public function get_resume2()\n {\n return $this->db->join('category', 'resume.work_category = category.id_category')\n ->where('id_login',$this->uri->segment(4))\n ->get('resume')\n ->result();\n }", "public function queryCompanyAndResumeInfo($uid){\n// ->where([\"rsm.uid\" => $uid]) -> find();\n $querySql = 'SELECT u.uid,rsm.regionid AS rregionid,rsm.expectregion,rsm.address AS raddress,cmp.regionid AS cregionid,cmp.region,cmp.address AS caddress FROM tcyy_user_info u LEFT JOIN tcyy_personal_resume rsm ON u.uid = rsm.uid '.\n 'LEFT JOIN tcyy_personal_company cmp ON u.uid = cmp.uid WHERE u.uid = ?';\n $data = $this -> query($querySql,[$uid]);\n return $data;\n }", "function get_resume_points($email) {\n global $my_database;\n\n $query_string = \"SELECT * FROM `xdr_user` WHERE `email` = '\" . $email . \"'\";\n $my_result = $my_database->send_query($query_string);\n \n if ($my_result->num_rows != 1)\n launch_error(\"Read user data failed.\");\n \n $resume = $my_result->fetch_array();\n return $resume;\n}", "public function sidebarResume()\n {\n $userManager = new UserManager();\n\n $admin = $userManager->findOneBy(['role' => User::ROLE_ADMIN]);\n\n //Sends the list of networks links corresponding to the admin user to the twig template\n $uploadManager = new UploadManager();\n\n ! is_null($admin['resume_id'])\n ? $this->templateVars['resume'] = $uploadManager->findOneBy(['id'=>$admin['resume_id']])\n : $this->templateVars['resume'] = null;\n }", "public function get_data() {\n $query = \"SELECT * FROM user_resume WHERE id = :id\";\n $usresume = $this->pdo->prepare($query);\n $usresume->execute(['id' => $_POST['id']]); \n return $usresume;\n }", "public function myIprofileAction()\n {\n \t$userObj = Auth_UserAdapter::getIdentity();\n \t $current_user_id = $userObj->getId();\n $this->view->userId = $current_user_id;\n $this->view->user_obj=$userObj;\n $this->view->profileId=$current_user_id;\n $this->view->current_user_id = $current_user_id;\n // Get Education information list....\n $result=\\Extended\\education_detail::getEduInfoList($current_user_id);\n \t$this->view->eduInfoList=$result;\n \n \t// Get User profile Information\n \t$userinfo=\\Extended\\ilook_user::getUserInformation($current_user_id);\n \t$this->view->personalInfo = $userinfo[0];\n \t\n \t// Get User experiences....\n \t$this->view->myExps = Extended\\experience::getAllExperiences( $current_user_id );\n \n \t\n \t// Get User Country and Industry titles.\n \t$em = Zend_Registry::get('em');\n \t// get country name as compare to country id\n \t$country_id = $em->getUnitOfWork()->getEntityIdentifier($userObj->getUsersCountry());\n \t\n \t// get industry title as compare to industry id\n \t$industry_id = @$em->getUnitOfWork()->getEntityIdentifier($userObj->getUsersIndustry());\n\t\tif($industry_id)\n\t\t{\n\t\t\t$industry = $em->find('\\Entities\\industry_ref',$industry_id[\"id\"]);\n\t\t\t$this->view->industry_title=$industry->getTitle();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->view->industry_title=\"\";\n\t\t}\n\t\t\n\t\t// get all languages of the login user.\n \t$this->view->languages = Extended\\user_languages::getAllLanguages( $current_user_id );\n \t$this->view->skillInfoList=\\Extended\\user_skills::getSkillInfoList($current_user_id );\n \t// get bookmark status..\n \t$this->view->bookmark_status = \\Extended\\bookmark_profile::getBookmarkStatus($current_user_id, $current_user_id);\n\t\t//get user received refernces \n $reference_received = Extended\\reference_request::getAllReceivedReferenceForProfile( $current_user_id );\n if($reference_received)\n {\n \t \t$this->view->reference_received = $reference_received;\n }\n // User's cover photo\n\t\tif($userObj->getCoverPhoto())\n\t\t{\n \t$this->view->my_cover_photo = IMAGE_PATH.'/cover_photo/user_'.$current_user_id.'/'.$userObj->getCoverPhoto()->getName();\n \t$this->view->my_cover_photo_name = $userObj->getCoverPhoto()->getName();\n \t$this->view->my_cover_photo_y_position = $userObj->getCoverPhoto()->getY_position();\n\t\t}\n\t\telse if( !$userObj->getCoverPhoto() && $userObj->getGender() == \\Extended\\ilook_user::USER_GENDER_FEMALE)\n\t\t{\n\t\t\t$this->view->default_cover_photo = IMAGE_PATH.'/cover-female-default.png';\n\t\t\n\t\t}\n\t\telse if( !$userObj->getCoverPhoto() && $userObj->getGender() == \\Extended\\ilook_user::USER_GENDER_MALE)\n\t\t{\n\t\t\t$this->view->default_cover_photo = IMAGE_PATH.'/cover-male-default.png';\n\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->view->default_cover_photo = IMAGE_PATH.'/cover-male-default.png';\n\t\t}\n //get user received feedbacks with visibility is set to 1\n $this->view->reference_received_visible= Extended\\reference_request::getVisibleReceivedReference( $current_user_id,'desc', \\Extended\\feedback_requests::VISIBILITY_CRITERIA_DISPLAYED, \\Extended\\feedback_requests:: IS_ACCEPTED_YES );\n //get user received feedback \n $this->view->feedback_received= Extended\\feedback_requests::getAllReceivedFeedbackForProfile( $current_user_id);\n //get user received feedbacks with visibility is set to 1\n $this->view->feedback_received_visible= Extended\\feedback_requests::getVisibleReceivedFeedback( $current_user_id,'desc', \\Extended\\feedback_requests::VISIBILITY_CRITERIA_DISPLAYED, \\Extended\\feedback_requests:: IS_ACCEPTED_YES );\n \t\t\n \n \t$this->view->usersblockedNBlocked_by = \\Extended\\blocked_users::getAllBlockersAndBlockedUsers($current_user_id);\n \t\n }", "public function resume($id) {\n if($this->Auth->User('profil_id') != 1) return $this->redirect(['controller' => 'Users', 'action' => 'permission']);\n \n // On prend les données de l'événement\n $this->loadModel('Evenements');\n $event = $this->Evenements->find()->contain(['Passages'])->first();\n $this->set('id',$id);\n $title = $event['name'];\n $description = $event['name'];\n //Envoie de l'image, dépend de si y en a une uploadée ou pas\n if(!empty($event['image'])) $headimg = 'headers/evenements/g-'.$event['image'];\n else $headimg = 'header_main.png';\n $idPassage = $event->passage->id;\n //on retrouve les infos du passage\n $this->loadModel('Passages');\n $passage = $this->Passages->find()->where(['id'=> $idPassage])->first();\n\n\n\n // On cherche les inscriptions au passages\n $inscriptions = $this->InscriptionPassages->find()\n ->contain(['Passages' => ['Disciplines'],'Licencies' => ['Grades', 'Clubs'],'Grades'])\n ->where(['passage_id' => $idPassage]);\n \n \t\t$this->set(compact(['passage', 'title', 'description', 'headimg', 'event', 'passage', 'inscriptions']));\n \n \n }", "function EmployerAccountsResumeDatabase($err = \"\")\n\t\t{\n\t\t\tif($err == \"\" && $_REQUEST['msg'] != \"\" ) {\n\t\t\t\tif($_REQUEST['msg'] == 1) {\n\t\t\t\t\t$err = \"Employer detail has been updated successfully.\";\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t$this->oView->sErrorMsg = $err;\n\t\t\t$search_field\t=\t$_REQUEST['search_field'];\n\t\t\t$search_text\t=\t$_REQUEST['search_text'];\n\t\t\t$this->oModel->bPagingApplied \t= true;\n\t\t\t$this->oModel->vPage['PageSize']=50;\n\t\t\tif(!empty($_REQUEST['sort']))\n\t\t\t{\t\n\t\t\t\t// defining sort field \n\t\t\t\t$this->oModel->bSortingApplied \t\t= true;\n\t\t\t\t$this->oModel->vSort['Field']\t\t= $_REQUEST['sort'];\n\t\t\t\t$this->oModel->vSort['Direction'] \t= $_REQUEST['direction'];\n\t\t\t} else {\n\t\t\t\t$this->oModel->bSortingApplied \t\t= true;\n\t\t\t\t$this->oModel->vSort['Field']\t\t= 'member_id';\n\t\t\t\t$this->oModel->vSort['Direction'] \t= 0;\n\t\t\t}\n\t\t\t$this->oModel->vPage['CurrentPage'] \t= (empty($_REQUEST['pos']) ? 0 : $_REQUEST['pos']);\n\t\t\t$OEmployer\t=\t$this->oModel->getAllEmployersResumeDatabase($search_field,$search_text);\n\t\t\tforeach($OEmployer as $Employer) {\n\t\t\t\t$str = $Employer->date_access_expired;\n\t\t\t\tif (($timestamp = strtotime($str)) === false) {\n\t\t\t\t\t$Employer->date_access_expired = \"\";\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t$_REQUEST['pos'] \t\t\t\t\t\t= $this->oModel->vPage['CurrentPage'];\n\t\t\t$this->oView->OEmployer\t\t\t\t\t= &$OEmployer;\n\t\t\t$this->oView->vPage \t\t\t\t\t= $this->oModel->vPage;\t\n\t\t\t$this->oView->search_field \t\t\t\t= $search_field;\n\t\t\t$this->oView->search_text \t\t\t\t= $search_text;\n\t\t\t$this->oView->EmployerAccountsResumeDatabase();\n\t\t}", "public function downloadresumeAction(){\n\t\t$cand_details_model = new Default_Model_Candidatedetails();\n \t$result = $cand_details_model->getcandidateData($this->_getParam('id'));\n \tif(!empty($result['cand_resume'])){\n \t\t$status = array();\n\t\t\t$file = BASE_PATH.'/uploads/resumes/'.$result['cand_resume'];\n\t\t\t$status = sapp_Global::downloadFile($file);\n\t\t\tif(!empty($status['message'])){\n\t\t\t\t$this->_helper->FlashMessenger()->setNamespace('down_resume')->addMessage($status['message']);\n\t\t\t}\n \t}\n \t\t$this->_redirect('scheduleinterviews/edit/id/'.$this->_getParam('int_id'));\n }", "public function resume()\n {\n $pend = Pendidikan::where('user_id', Auth::user()->id)->orderBy('tahun_lulus', 'desc')->get();\n $work = Experience::where('user_id', Auth::user()->id)->orderBy('work_from', 'desc')->get();\n $skill = Skill::where('user_id', Auth::user()->id)->get();\n $bahasa = Bahasa::where('user_id', Auth::user()->id)->get();\n $serti = Sertificate::where('user_id', Auth::user()->id)->get();\n return view('pegawai.resume', compact('pend', 'work', 'skill', 'bahasa', 'serti'));\n }", "public function getResume()\n {\n return $this->_resume;\n }", "public function resume();", "public function getUserCvs($user_id) : object\n {\n $cvs = Cv::where('user_id', $user_id)->with(\n [\n 'previosExpirience'\n ]\n )->get();\n return $cvs;\n }", "public function getResume()\n {\n return $this->_resume;\n }", "function googledocs_user_complete($course, $user, $mod, $googledocs) {\n}", "public function loadUserFromPC() {\n $pccon = new PCCon();\n $d = $pccon->getData(\"https://api.planningcenteronline.com/people/v2/me\");\n //var_dump($d);\n $this->name = $d['attributes']['name'] ?? null;\n $this->userid = $d['id'];\n //var_dump($this);\n \n //teamid=4438974 is the team giving access to reports\n //sangrapporter = 24030414\n //cellegruppeplanlegging = 24030415\n\n\n $a = $pccon->getRaw(\"https://api.planningcenteronline.com/services/v2/teams/4438974?include=person_team_position_assignments\");\n //$a = $pccon->getRaw(\"https://api.planningcenteronline.com/services/v2/teams/\" . USER::ACCESS_CELLGROUP_PLANNING .\"?include=person_team_position_assignments\");\n $this->access = [];\n\n //if(sizeof($a['included'])>0) {\n foreach ($a['included'] as $ptpa) {\n if($ptpa['relationships']['person']['data']['id'] == $this->userid) {\n $this->access[] = $ptpa['relationships']['team_position']['data']['id'];\n }\n\n }\n // }\n\n //var_dump($this);\n }", "public function resume()\n {\n }", "public function detail_data_profil() {\n // return $query;\n\n $this->db->select('*');\n $this->db->from('tb_cv');\n $this->db->join('tb_user', 'tb_cv.id = tb_user.id');\n // $this->db->get('tb_cv.id', array('tb_cv.id' => 'tb_user.id'));\n $query = $this->db->get();\n }", "function verify_student_access($progress_id) {\n $current_user = wp_get_current_user();\n $user_id = $current_user->ID;\n return CNMI_Progress::get_progress_by_id_and_user_id($progress_id, $user_id);\n}", "function view_users (){\n\t\t\t$this->gen_contents[\"course\"]\t\t=\tarray();\n\t\t\t$this->gen_contents['page_title']\t=\t'User Details';\n\n\t\t\t$this->session->set_flashdata('search_firstname',$this->session->flashdata('search_firstname'));\n\t\t\t$this->session->set_flashdata('search_lastname',$this->session->flashdata('search_lastname'));\n\t\t\t$this->session->set_flashdata('search_email',$this->session->flashdata('search_email'));\n\t\t\t$this->session->set_flashdata(\"course_completed\",$this->session->flashdata('course_completed'));\n\n\t\t\t$this->_user_details($this->uri->segment(3));\n $this->_profile_progress($this->userid, $this->gen_contents[\"userdetails\"]->emailid);\n\n\t\t\t$this->_template('view_user_details',$this->gen_contents);\n\t\t}", "function userGetProfile($uid) {\r\n}", "function getInformationResumeOnlineOfUser($email) {\n\n $this->db->where('email', $email);\n $this->db->order_by(\"createdate\", \"desc\");\n $this->db->limit(1);\n\n $query = $this->db->get('tr_resumes_online');\n\n if ($query != NULL && $query->num_rows() > 0) {\n\n return $query->row_array();\n }\n return FALSE;\n }", "function get_profile_user_get()\n {\n $account_id = $this->checkSessionAndTokenAuth();\n $res = $this->responseUserAccountDatas($account_id);\n\n $res = removeNullOfObject($res);\n $this->response(RestSuccess($res), SUCCESS_CODE);\n }", "public function candidateprofile($id)\n {\n $jobseekerdetail = JobseekerDetail::where('user_id', $id)->first();\n $personalstatement = PersonalStatement::where('user_id', $id)->first();\n $academics = Education::where('user_id', $id)->get();\n $experiences = WorkExperience::where('user_id', $id)->get();\n $referees = Reference::where('user_id', $id)->get();\n $certifications = Awards::where('user_id', $id)->get();\n $skills = Skills::where('user_id', $id)->get();\n $talent=TalentPool::whereIn('employer_id', [0,Auth::guard('employer')->user()->id])->get();\n\n return view('employer-dashboard.resume-view', compact( 'jobseekerdetail', 'personalstatement', \n 'academics', 'experiences', 'referees', 'certifications','skills', 'talent'));\n }", "public function getUserViewById($id) {\n $user = [];\n $user_id = $id;\n // Fetch fields\n $fields = [\n \"um.first_name\",\n \"um.last_name\",\n \"um.created\",\n \"um.last_login\",\n \"um.verified\",\n \"ui.invited_at\",\n \"ui.joined_at\",\n \"um.account_id\"\n\n ];\n\n // Fetch from tables\n $tables = \" FROM user_master um\n LEFT JOIN user_invitations ui ON ui.user_id = um.id\n WHERE um.id = \".$user_id;\n try {\n $sql = \"SELECT \" . implode(\", \", $fields) . \" \" . $tables;\n \n $this->_query_string = $sql;\n\n $stmt = $this->_db->query($sql);\n \n foreach ($stmt as $row) {\n $user = $row;\n }\n } catch(\\PDOException $e) {\n $this->_failed_query_message = $e->getMessage();\n $this->_query_error = true;\n\n throw new \\Exception($this->_failed_query_message);\n }\n\n $account_id = $user['account_id'];\n $fields2 = [\n \"um.id\",\n \"um.user_type_id\",\n \"um.first_name\",\n \"um.last_name\",\n \"um.email\",\n \"um.created\",\n \"um.last_login\",\n \"um.status\",\n \"um.outlook_allow_all\",\n \"am.id as account_id\",\n \"am.ac_number\",\n \"ao.name as company_name\",\n \"(SELECT pm.name FROM account_subscription_details asd INNER JOIN plan_master pm ON pm.id = asd.plan_id WHERE um.account_id = asd.account_id ORDER BY asd.id DESC LIMIT 1) as plan_name\",\n \"(SELECT id FROM account_billing_master abm WHERE account_id =\". $account_id .\") as abm_id\"\n ];\n\n $tables2 = \"FROM user_master um \n INNER JOIN account_master am ON am.id = um.account_id\n LEFT JOIN account_organization ao ON ao.account_id = am.id\n WHERE um.account_id = \".$account_id;\n\n try {\n $sql2 = \"SELECT \" . implode(\", \", $fields2) . \" \" . $tables2;\n \n $this->_query_string = $sql2;\n \n $stmt2 = $this->_db->query($sql2);\n\n foreach ($stmt2 as $row2) {\n $user[\"member_row\"][] = $row2;\n }\n } catch(\\PDOException $e) {\n $this->_failed_query_message = $e->getMessage();\n $this->_query_error = true;\n\n throw new \\Exception($this->_failed_query_message);\n }\n\n return $user;\n }" ]
[ "0.5993613", "0.58327854", "0.5810789", "0.5789966", "0.57823604", "0.5762752", "0.57161754", "0.56766933", "0.56691957", "0.56655395", "0.5611027", "0.55118394", "0.5488155", "0.54829365", "0.5472221", "0.54178023", "0.53973645", "0.53085446", "0.5299617", "0.52789426", "0.52725565", "0.52669317", "0.5257108", "0.52556884", "0.5250216", "0.5225183", "0.5211599", "0.52075154", "0.52020013", "0.51880234" ]
0.65305406
0
Inactive and Active profile by user
function inactive_profile($table,$where){ $get = $this->db->select('*')->where('userId',$where)->get($table); if($get->num_rows()){ $result = $get->row(); /*$password = $result->password; if(password_verify($data,$password)){*/ $res = $this->common_model->updateFields(USERS,array('isActive'=>0),array('userId'=>$where)); if($res == true){ return $response = array('type' => "SU"); } return $response = array('type' => "ADU"); } /*return $response = array('type' => "WP"); }*/ return $response = array('type' => "UNF"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getUserProfile();", "public function isActive() {\n\t\t// Logic to determine if User is active or not\n\t}", "public function activeOrDesactivateUser() {\n \n if ($this->isActive !== NULL) {\n if($this->isActive === false) {\n $this->expirationDate = new DateTime('now');\n } else {\n if($this->isActive === true) {\n $this->expirationDate = NULL;\n }\n }\n } else {\n if(empty($this->isActive) && !empty($this->isVerified)) {\n $this->isActive = 1;\n }\n }\n }", "public function getCurrentProfile(){ }", "function bbp_is_user_active($user_id = 0)\n{\n}", "public function activeAction()\n {\n $all = $this->users->query()\n ->where('active != 0 OR active is NOT NULL')\n ->andWhere('deleted = 0 OR deleted is NULL')\n ->andWhere('deactivate = 0 OR deactivate is NULL')\n ->execute();\n\n $this->theme->setTitle(\"Users that are active\");\n $this->views->add('users/list-all', [\n 'users' => $all,\n 'title' => \"Users that are active\",\n ]);\n }", "public function user_profile() {\n $input = check_inputs();\n $status = false;\n $message = \"User not exist\";\n $profile = $this->User_model->get_user(array(\"id\" => $input['user_id']));\n if ($profile) {\n $status = true;\n $message = \"User found successfully\";\n }\n return_data($status, $message, $profile);\n //create_log_file();\n }", "public function activeUser() {\n $inactive = isset($this->current_record['deactivate___1']) && $this->current_record['deactivate___1'] == '1';\n return !$inactive;\n }", "public function actionProfile() {\n $user = User::model()->findByPk(Yii::app()->user->id);\n $activity = Activity::model()->findByPk($user->id_primary_activity);\n $address = Address::model()->findByPk($user->id_address);\n if($address != null){\n $country = Country::model()->findByPk($address->id_country);\n }\n else{\n $country = null;\n }\n $fitness = UserFitness::model()->findByPk($user->id_user_fitness);\n \n $summary = $this->getSummary($user->id);\n \n $sharedworkouts = TrainingEntry::model()->findAll('id_user='.$user->id.' and id_visibility != 3 order by date DESC limit 8');\n $activity_array = Activity::model()->findAll(array('index'=>'id'));\n \n\t\t$this->render('profile',array(\n\t\t\t'user'=>$user,\n 'activity'=>$activity,\n 'address'=>$address,\n 'country'=>$country,\n 'fitness'=>$fitness,\n 'summary'=>$summary,\n 'sharedworkouts'=>$sharedworkouts, \n 'activity_array'=>$activity_array,\n\t\t));\n\t}", "function active_filter($active, $url_params, $row) {\n\tglobal $_user;\n\tif ($active=='1') {\n\t\t$action='AccountActive';\n\t\t$image='accept';\n\t}\n\tif ($active=='0') {\n\t\t$action='AccountInactive';\n\t\t$image='error';\n\t}\n\t$result = '';\n\tif ($row[count($row)-1]<>$_user['user_id']) { // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.\n\t\t$result = '<center><img src=\"../img/icons/16/'.$image.'.png\" border=\"0\" style=\"vertical-align: middle;\" alt=\"'.get_lang(ucfirst($action)).'\" title=\"'.get_lang(ucfirst($action)).'\"/></center>';\n\t}\n\treturn $result;\n}", "public function activeAction()\n {\n $all = $this->users->query()\n ->where('active IS NOT NULL')\n ->andWhere('deleted is NULL')\n ->execute();\n \n $this->theme->setTitle(\"Users that are active\");\n $this->views->add('users/list-all', [\n 'users' => $all,\n 'title' => \"Users that are active\",\n ]);\n }", "public function profile()\n {\n \t$this->User->id = $this->othAuth->user('id');\n \t$user = $this->User->read();\n\n \tif(!empty($this->data))\n \t{\t\n \t\tif($this->User->save($this->data))\n \t\t{\n \t\t\t$this->set('saved', true);\n \t\t\t$this->othAuth->updateSession($this->data); \t\t\t\n \t\t}\n \t\t\n \t\t$user = $this->data;\t\t \t\t\n \t}\n \t\n \t$this->set('user', $user);\n }", "function bbp_user_has_profile($user_id = 0)\n{\n}", "function bbp_is_user_inactive($user_id = 0)\n{\n}", "public function myprofile() {\n $this->request->allowMethod(['get']);\n $user_id = $this->Auth->user('id');\n if (!empty($user_id)) {\n $user = $this->Users->get($user_id, [\n 'contain' => ['Roles']\n ]);\n $this->set('user', $user);\n $this->set('_serialize', ['user']);\n $_resultflag = true;\n $message = __('Success');\n } else {\n $_resultflag = false;\n $message = __('sorry');\n }\n $this->set(compact('_resultflag', 'message'));\n }", "function activeUser(){\n if(isset($_SESSION['user'])){\n return true;\n }else{\n return false;\n }\n }", "public function others_profile() \n {\n $user_id = Param::get('user_id');\n $row = User::get($user_id); \n $user = new Follow($row);\n $user->user_id = $_SESSION['user_id']; \n $this->set(get_defined_vars()); \n }", "public function getProfile();", "function update_loggedin_user_status($fbId,$email) {\n\t// marking the status as active and updating his email address if the user in presend in database \n\t$check_for_user_existence = Zzuser::model()->findByAttributes(array('user_fbid'=>$fbId,'zzuser_status'=>'invited'));\n\tif(isset($check_for_user_existence)) {\n\t\t$check_for_user_existence->user_email = $email;\n\t\t$check_for_user_existence->user_handle = $email;\n\t\t$check_for_user_existence->zzuser_status = 'active';\n\t\t$check_for_user_existence->save();\n\t}\n}", "public function showProfile();", "public function getCurrentUser()\n\t{\n\t\t\n\t\t$username = $_SESSION['user']['username'];\n\t\t$userObj = new users();\n\t\t$userObj->username=$username;\n\t\t$dbCon = new DbContext();\n\t\t$userInfo = $dbCon->Get($userObj)->ToArray();\n\t\t$userprofileObj = new user_profile();\n\t\t$userprofileObj->user_id=$userInfo['id'];\n\t\t$profileInfo = $dbCon->Get($userprofileObj)->ToArray();\n\t\t$userInfo = array_merge($userInfo,$profileInfo);\n\t\treturn $userInfo;\t\n\t}", "public function myIprofileAction()\n {\n \t$userObj = Auth_UserAdapter::getIdentity();\n \t $current_user_id = $userObj->getId();\n $this->view->userId = $current_user_id;\n $this->view->user_obj=$userObj;\n $this->view->profileId=$current_user_id;\n $this->view->current_user_id = $current_user_id;\n // Get Education information list....\n $result=\\Extended\\education_detail::getEduInfoList($current_user_id);\n \t$this->view->eduInfoList=$result;\n \n \t// Get User profile Information\n \t$userinfo=\\Extended\\ilook_user::getUserInformation($current_user_id);\n \t$this->view->personalInfo = $userinfo[0];\n \t\n \t// Get User experiences....\n \t$this->view->myExps = Extended\\experience::getAllExperiences( $current_user_id );\n \n \t\n \t// Get User Country and Industry titles.\n \t$em = Zend_Registry::get('em');\n \t// get country name as compare to country id\n \t$country_id = $em->getUnitOfWork()->getEntityIdentifier($userObj->getUsersCountry());\n \t\n \t// get industry title as compare to industry id\n \t$industry_id = @$em->getUnitOfWork()->getEntityIdentifier($userObj->getUsersIndustry());\n\t\tif($industry_id)\n\t\t{\n\t\t\t$industry = $em->find('\\Entities\\industry_ref',$industry_id[\"id\"]);\n\t\t\t$this->view->industry_title=$industry->getTitle();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->view->industry_title=\"\";\n\t\t}\n\t\t\n\t\t// get all languages of the login user.\n \t$this->view->languages = Extended\\user_languages::getAllLanguages( $current_user_id );\n \t$this->view->skillInfoList=\\Extended\\user_skills::getSkillInfoList($current_user_id );\n \t// get bookmark status..\n \t$this->view->bookmark_status = \\Extended\\bookmark_profile::getBookmarkStatus($current_user_id, $current_user_id);\n\t\t//get user received refernces \n $reference_received = Extended\\reference_request::getAllReceivedReferenceForProfile( $current_user_id );\n if($reference_received)\n {\n \t \t$this->view->reference_received = $reference_received;\n }\n // User's cover photo\n\t\tif($userObj->getCoverPhoto())\n\t\t{\n \t$this->view->my_cover_photo = IMAGE_PATH.'/cover_photo/user_'.$current_user_id.'/'.$userObj->getCoverPhoto()->getName();\n \t$this->view->my_cover_photo_name = $userObj->getCoverPhoto()->getName();\n \t$this->view->my_cover_photo_y_position = $userObj->getCoverPhoto()->getY_position();\n\t\t}\n\t\telse if( !$userObj->getCoverPhoto() && $userObj->getGender() == \\Extended\\ilook_user::USER_GENDER_FEMALE)\n\t\t{\n\t\t\t$this->view->default_cover_photo = IMAGE_PATH.'/cover-female-default.png';\n\t\t\n\t\t}\n\t\telse if( !$userObj->getCoverPhoto() && $userObj->getGender() == \\Extended\\ilook_user::USER_GENDER_MALE)\n\t\t{\n\t\t\t$this->view->default_cover_photo = IMAGE_PATH.'/cover-male-default.png';\n\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->view->default_cover_photo = IMAGE_PATH.'/cover-male-default.png';\n\t\t}\n //get user received feedbacks with visibility is set to 1\n $this->view->reference_received_visible= Extended\\reference_request::getVisibleReceivedReference( $current_user_id,'desc', \\Extended\\feedback_requests::VISIBILITY_CRITERIA_DISPLAYED, \\Extended\\feedback_requests:: IS_ACCEPTED_YES );\n //get user received feedback \n $this->view->feedback_received= Extended\\feedback_requests::getAllReceivedFeedbackForProfile( $current_user_id);\n //get user received feedbacks with visibility is set to 1\n $this->view->feedback_received_visible= Extended\\feedback_requests::getVisibleReceivedFeedback( $current_user_id,'desc', \\Extended\\feedback_requests::VISIBILITY_CRITERIA_DISPLAYED, \\Extended\\feedback_requests:: IS_ACCEPTED_YES );\n \t\t\n \n \t$this->view->usersblockedNBlocked_by = \\Extended\\blocked_users::getAllBlockersAndBlockedUsers($current_user_id);\n \t\n }", "public function actionProfile() {\n return $this->actionUpdate(Yii::$app->user->getId(), 'profile');\n }", "function bbp_is_single_user_profile()\n{\n}", "function list_user_status($status = FALSE)\n\t{\n\t\t// Check user has privileges to view user accounts, else display a message to notify the user they do not have valid privileges.\n\t\tif (! $this->flexi_auth->is_privileged('View Users'))\n\t\t{\n\t\t\t$this->session->set_flashdata('message', '<p class=\"error_msg\">You do not have privileges to view user accounts.</p>');\n\t\t\tredirect('auth_admin');\t\t\n\t\t}\n\n\t\t// The view associated with this controller method is used by multiple methods, therefore set a page title.\n\t\t$this->data['page_title'] = ($status == 'inactive') ? 'Inactive Users' : 'Active Users';\n\t\t$this->data['status'] = ($status == 'inactive') ? 'inactive_users' : 'active_users'; // Indicate page function.\n\t\t\n\t\t// Get an array of all active/inactive user accounts, using the sql select and where statements defined below.\n\t\t// Note: The columns defined using the 'db_column()' functions are native table columns to the auth library. \n\t\t// Read more on 'db_column()' functions in the quick help section near the top of this controller. \n\t\t$sql_select = array(\n\t\t\t$this->flexi_auth->db_column('user_acc', 'id'),\n\t\t\t$this->flexi_auth->db_column('user_acc', 'email'),\n\t\t\t$this->flexi_auth->db_column('user_acc', 'active'),\n\t\t\t$this->flexi_auth->db_column('user_group', 'name'),\n\t\t\t// The following columns are located in the demo example 'demo_user_profiles' table, which is not required by the library.\n\t\t\t'upro_first_name', \n\t\t\t'upro_last_name'\n\t\t);\n\t\t$sql_where[$this->flexi_auth->db_column('user_acc', 'active')] = ($status == 'inactive') ? 0 : 1;\n\t\tif (! $this->flexi_auth->in_group('Master Admin'))\n\t\t{\n\t\t\t// For this example, prevent any 'Master Admin' users being listed to non master admins.\n\t\t\t$sql_where[$this->flexi_auth->db_column('user_group', 'id').' !='] = 2;\n\t\t}\n\t\t$this->data['users'] = $this->flexi_auth->get_users_array($sql_select, $sql_where);\n\t\t\t\n\t\t$this->load->view('demo/admin_examples/users_view', $this->data);\n\t}", "public function activeAction()\n\t{\n\t\t$this->session->remove('form-save');\n\t\t\n\t\t$all = $this->users->query()\n\t\t->where('active IS NOT NULL')\n\t\t->andWhere('deleted is NULL')\n\t\t->execute();\n\t\n\t\t$this->theme->setTitle(\"Aktiva användare\");\n\t\t$this->views->add('users/list-all', [\n\t\t\t\t'users' => $all,\n\t\t\t\t'title' => \"Aktiva användare\",\n\t\t]);\n\t}", "static function isActive($user_id){\n return true;\n }", "public function profile()\n\t{\n\t\t$id_user_view = $this->uri->segment(3);\n\t\t\n\t\tif(isset($_SESSION['sessionUserId'])){\n\n\t\t\t$userID = $this->session->userdata('sessionUserId');\n\t\t\t$user = $this->user->getUserById($userID);\n\n\t\t\t$data = array();\n\t $data = $this->load_view_profile($id_user_view, $data);\n\n\t $data['USER_NAME'] = $user->USER_NAME;\n\t\t\t$data['USER_POINT'] = $user->USER_POINT;\n\n\t\t\t//load game active\n\t $data['noti'] = $this->user->get_all_noti_user($user->USER_ID);\n\t $data['top_point'] = $this->user->get_top_point();\n\t $data['user_id'] = $user->USER_ID;\n\t $data['is_related_YN'] = $this->user->is_related_YN($user->USER_ID);\n\t $data['is_related_MUL'] = $this->user->is_related_MUL($user->USER_ID);\n\t $data['is_history'] = false;\n\n\t\t\t$this->load->view('user/history', $data);\n\t\t\t\n\t\t}else{\n\t\t\t//guest view profile\n\t\t\t$data = array();\n\t $data = $this->load_view_profile($id_user_view, $data);\n\n\t $this->load->view('user/history', $data);\n\t\t}\n\t}", "protected function getActiveUser()\n {\n return Yii::$app->user->identity;\n }", "public function setActive(): UserResponse;" ]
[ "0.6605765", "0.6584802", "0.64456546", "0.6405619", "0.6307848", "0.62941885", "0.6284392", "0.626759", "0.62151515", "0.6184614", "0.6183748", "0.61782634", "0.61415935", "0.61395055", "0.61358565", "0.6115825", "0.60995954", "0.6088984", "0.60730755", "0.60612047", "0.60578287", "0.6039555", "0.6032154", "0.6028396", "0.602406", "0.6020878", "0.60156214", "0.5993153", "0.5992204", "0.5956079" ]
0.6665056
0
Return the url of the entity image
protected function _getEntityImage() { try{ $imgSrc = (string) Mage::helper('gene_bluefoot/image')->init($this->getAppEntity()->getFeaturedImage())->useConfig('thumbnail'); } catch(Exception $e) { $imgSrc = Mage::getDesign()->getSkinUrl('images/catalog/product/placeholder/image.jpg',array('_area'=>'frontend')); } return $imgSrc; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function image_url()\r\n {\r\n if (! $this->image)\r\n return;\r\n\r\n return Storage::url($this->image);\r\n }", "public function getImageURL() {\r\n\t\treturn $this->getProperty(\"image_url\");\r\n\t}", "public function get_url()\n {\n return $this->imageUrl;\n }", "abstract public function imageUrl(): string;", "public function getImageUrlAttribute()\n {\n return url(\"/{$this->image}\");\n }", "public function getImageUrl();", "public function getImageUrl(){\n return Url::to($this->detailDir.$this->pic); \n }", "public function getImageURL()\n\t{\n\t\t$path = Config::get('dream.paths.vote');\n\t\treturn url(\"{$path}/{$this->image}\");\n\t}", "public function getImageUrl()\n\t{\n\t\treturn $this->image_url;\n\t}", "public function getImageUrl()\r\n {\r\n return $this->_image_url;\r\n }", "public function getImageUrl()\n {\n return $this->imageUrl;\n }", "public function imageUrl()\n {\n if (!empty($this->image) && File::exists(public_path(config('constants.UPLOAD.IMAGE_LIST')) . '/' . $this->image)) {\n return asset(config('constants.UPLOAD.IMAGE_LIST') . '/' . $this->image);\n }\n return url(config('constants.DEFAULT.ITEM_IMAGE'));\n }", "public function getImageUrl() \n {\n // return a default image placeholder if your source avatar is not found\n $image = $this->image;\n return Yii::$app->urlManager->baseUrl . '/admin/uploads/center/' . $image;\n }", "public function getUrlAttribute(){\n \tif (substr($this->image, 0,4) === \"http\") {\n \t\treturn $this->image;\n \t}\n\n \treturn '/images/products/' . $this->image;\n }", "private static function getUrlFromEntity($entity) {\n if ($entity instanceof MediaInterface) {\n $source = $entity->getSource();\n $value = $source->getSourceFieldValue($entity);\n if ($source instanceof OEmbedInterface) {\n return $value;\n }\n elseif ($file = File::load($value)) {\n return $file->createFileUrl();\n }\n }\n elseif ($entity instanceof FileInterface) {\n return $entity->createFileUrl();\n }\n }", "public function getImageUrl()\n {\n return $this->_imageUrl;\n }", "public function getImageUrl()\n {\n return $this->getProperty(\"ImageUrl\");\n }", "public function getUrlImage()\n {\n return $this->urlImage;\n }", "public function getImageUrlAttribute(): string\n {\n return Storage::url($this->image);\n }", "public function getImageUrlAttribute()\r\n {\r\n return $this->image_url();\r\n }", "public function getUrl()\n {\n return $this->imageParam . CHtml::encode($this->filename);\n }", "public function getImageUrlPath() {\n return Mage::getBaseUrl(Mage_Core_Model_Store:: URL_TYPE_MEDIA) . $this->getImage();\n }", "public function getImageUrlAttribute()\n {\n return asset(config('define.product.upload_image_url') . $this->img_url);\n }", "public function imageUrl(): string\n {\n return '/images/test-image.jpg';\n }", "public function getUrlImageAttribute()\n {\n return asset('storage/' . $this->image);\n }", "public function getImageUrl() \n {\n $IMAGE = isset($this->image) ? $this->image : 'default_user.jpg';\n return Yii::$app->params['uploadUrl'] . $IMAGE;\n }", "protected function getOpenGraphImage()\n {\n return '[IMAGE_URL]';\n }", "public function getImageUrlAttribute()\n\t{\n\t\treturn static::$path . $this->image;\n\t}", "public function getGetImageAttribute()\n {\n //Si la imagen existe\n if ($this->image)\n //Accedemos al public/storage\n return url(\"storage/$this->image\");\n }", "public function getGetImageAttribute()\n {\n if($this->image)\n return url(\"storage/$this->image\");\n }" ]
[ "0.7941127", "0.7858106", "0.7798875", "0.77368027", "0.7661677", "0.7652047", "0.7640809", "0.76074713", "0.7548183", "0.75329614", "0.7520832", "0.74948585", "0.74824756", "0.74637884", "0.74417424", "0.74295837", "0.7427114", "0.7425482", "0.74146014", "0.7398886", "0.735931", "0.7333179", "0.73146546", "0.7310051", "0.72934437", "0.72932327", "0.7275398", "0.7269721", "0.72426665", "0.7234273" ]
0.79256976
1
Return a friendly published date
protected function _getPublishedDate() { if ($date = $this->getAppEntity()->getPublishedDate()) { return Mage::helper('gene_bluefoot')->__('Published %s', Mage::helper('gene_bluefoot/date')->getFriendlyDateTime(strtotime($date))); } return ''; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function _get_date_published() {\n // Element is required and may appear once only\n return $this->_eval_query_as_string(\"/{$this->nsp}article/{$this->nsp}admin/{$this->nsp}numero/{$this->nsp}pubnum/{$this->nsp}date\");\n }", "public function published(): string\n\t{\n\t\t$format = 'c';\n\t\t$date = date($format, strtotime($this->comment->comment_date));\n\n\t\treturn Hook::apply('get_the_date', $date, $format, $this->comment);\n\t}", "public function getPublishDate() {\n\t\t\treturn get_post_time('U',false,$this->aritcle_id);\n\t\t}", "public function getDatePublished();", "function osc_static_page_pub_date() {\n return osc_static_page_field(\"dt_pub_date\");\n }", "public function getPublishedDate(): ?string;", "public function getPublishStartDate();", "public function getPublishingDate()\n {\n return $this->_publishing ? $this->_publishing->format('U') : null;\n }", "public function pubDate($date);", "function bp_yt_item_date_published(){\n echo bp_yt_get_item_date_published();\n}", "public function getPubDate()\n {\n return $this->pubDate;\n }", "public function getPublishDate()\n {\n return $this->cvPublishDate;\n }", "public static function load_pubdate() {\n if (isset($_REQUEST['postid'])) { // WPCS: CSRF okay.\n $stamp = get_post_meta(absint(wp_unslash($_REQUEST['postid'])), self::$_tao_publish_status . '_pubdate', true); // WPCS: CSRF okay.\n if ($stamp) {\n $str = '<div style=\"margin-left:20px\">';\n $str .= TaoPublish::get_pubdate($stamp);\n $str .= '</div>';\n die($str); // WPCS: XSS okay.\n }\n }\n }", "public function date()\n {\n return $this->object->getPublishAt();\n }", "function snazzy_entry_date() {\n\t\t$time_string = '<time class=\"entry-date published updated\" datetime=\"%1$s\">%2$s</time>';\n\n\t\t$time_string = sprintf(\n\t\t\t$time_string,\n\t\t\tesc_attr( get_the_date( 'c' ) ),\n\t\t\tesc_html( get_the_date() ),\n\t\t\tesc_attr( get_the_modified_date( 'c' ) ),\n\t\t\tesc_html( get_the_modified_date() )\n\t\t);\n\n\t\tprintf(\n\t\t\t'<span class=\"posted-on\"><span class=\"screen-reader-text\">%1$s </span><a href=\"%2$s\" rel=\"bookmark\">%3$s</a></span>',\n\t\t\tesc_html_x( 'Posted on', 'Used before publish date.', '@@textdomain' ),\n\t\t\tesc_url( get_permalink() ),\n\t\t\t$time_string\n\t\t);\n\t}", "function sela_entry_date() {\n\t$time_string = '<time class=\"entry-date published\" datetime=\"%1$s\">%2$s</time>';\n\tif ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {\n\t\t$time_string .= '<time class=\"updated\" datetime=\"%3$s\">%4$s</time>';\n\t}\n\n\t$time_string = sprintf( $time_string,\n\t\tesc_attr( get_the_date( 'c' ) ),\n\t\tesc_html( get_the_date() ),\n\t\tesc_attr( get_the_modified_date( 'c' ) ),\n\t\tesc_html( get_the_modified_date() )\n\t);\n\n\tprintf( '<span class=\"date\"><a href=\"%1$s\" title=\"%2$s\" rel=\"bookmark\">%3$s</a></span>',\n\t\tesc_url( get_permalink() ),\n\t\tesc_attr( sprintf( __( 'Permalink to %s', 'sela' ), the_title_attribute( 'echo=0' ) ) ),\n\t\t$time_string\n\t);\n}", "function unicorn_posted_meta()\n{\n return '<span class=\"posted-date\"><a href=\"'.esc_url(get_permalink()).'\">'.get_the_date().'</a></span>';\n}", "public function getArticleDatePublished() : \\DateTime{\n\treturn($this->articleDatePublished);\n}", "public function getPublishDate($format = null)\n {\n return $this->published;\n }", "public function getPublishedAt()\n {\n return $this->publishedAt;\n }", "function get_public_date(){\n return $this->public_date;\n }", "public function getPublishAt();", "function iblog_entry_date() {\n\t$time_string = 'Creado el <time class=\"entry-date published updated\" datetime=\"%1$s\">%2$s</time>';\n\n\tif ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {\n\t\t$time_string = 'Actualizado el <time class=\"updated\" datetime=\"%3$s\">%4$s</time>';\n\t}\n\n\t$time_string = sprintf( $time_string,\n\t\tesc_attr( get_the_date( 'c' ) ),\n\t\tget_the_date(),\n\t\tesc_attr( get_the_modified_date( 'c' ) ),\n\t\tget_the_modified_date()\n\t);\n\n\tprintf( '<span class=\"posted-on\"><span class=\"screen-reader-text\">%1$s </span>%2$s</span>',\n\t\t_x( 'Posted on', 'Used before publish date.', 'iblog-theme' ),\n\t\t$time_string\n\t);\n}", "public function getFeedItemPubDate()\n {\n return $this->getPublicatedAt();\n }", "function nuqneH_print_post_date() {\r\n /* translators: 1: date, 2: time */\r\n printf( __('<div class=\"just-a-date\"> %1$s at %2$s </div>'), get_the_date(), get_the_time() );\r\n}", "private function get_publication_date( $item ) {\n\t\tif ( $this->is_valid_datetime( $item->post_date_gmt ) ) {\n\t\t\t// Create a DateTime object date in the correct timezone.\n\t\t\treturn $this->format_date_with_timezone( $item->post_date_gmt );\n\t\t}\n\t\tif ( $this->is_valid_datetime( $item->post_modified_gmt ) ) {\n\t\t\t// Fallback 1: post_modified_gmt.\n\t\t\treturn $this->format_date_with_timezone( $item->post_modified_gmt );\n\t\t}\n\t\tif ( $this->is_valid_datetime( $item->post_modified ) ) {\n\t\t\t// Fallback 2: post_modified.\n\t\t\treturn $this->format_date_with_timezone( $item->post_modified );\n\t\t}\n\t\tif ( $this->is_valid_datetime( $item->post_date ) ) {\n\t\t\t// Fallback 3: post_date.\n\t\t\treturn $this->format_date_with_timezone( $item->post_date );\n\t\t}\n\n\t\treturn '';\n\t}", "public function getFeedItemPubDate()\n {\n return $this->getCreated();\n }", "public function getPublishedAt()\n {\n return $this->post['snippet']['publishedAt'];\n }", "function bbp_topic_post_date($topic_id = 0, $humanize = \\false, $gmt = \\false)\n{\n}", "function multipurpose_magazine_posted_on() {\n\t$time_string = '<time class=\"entry-date published\" datetime=\"%1$s\">%2$s</time>';\n\tif ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) )\n\t\t$time_string .= '<time class=\"updated\" datetime=\"%3$s\">%4$s</time>';\n\n\t$time_string = sprintf( $time_string,\n\t\tesc_attr( get_the_date( 'c' ) ),\n\t\tesc_html( get_the_date() ),\n\t\tesc_attr( get_the_modified_date( 'c' ) ),\n\t\tesc_html( get_the_modified_date() )\n\t);\n\n\tprintf('<span class=\"posted-on\">Published %1$s</span><span class=\"byline\"> by %2$s</span>',\n\t\tsprintf( '<a href=\"%1$s\" rel=\"bookmark\">%2$s</a>',\n\t\t\tesc_url( get_permalink() ),\n\t\t\tesc_html($time_string)\n\t\t),\n\t\tsprintf( '<span class=\"author vcard\"><a class=\"url fn n\" href=\"%1$s\">%2$s</a></span>',\n\t\t\tesc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),\n\t\t\tesc_html( get_the_author() )\n\t\t)\n\t);\n}" ]
[ "0.8076978", "0.7999326", "0.79501504", "0.77092546", "0.765927", "0.7491949", "0.7456417", "0.744915", "0.72343504", "0.71925414", "0.7174468", "0.7153769", "0.71375966", "0.7029571", "0.7007015", "0.695407", "0.6935258", "0.691747", "0.6915551", "0.69037384", "0.69002575", "0.68921286", "0.6873541", "0.685755", "0.6822477", "0.6806467", "0.677974", "0.6738632", "0.670125", "0.6659456" ]
0.84915197
0
This is the lexer this function splits up a SQL statement into easy to "parse" tokens for the SQL processor
private function split_sql($sql) { if (!is_string($sql)) { echo "SQL:\n"; print_r($sql); exit; } $sql = str_replace(array('\\\'', '\\"', "\r\n", "\n", '()'), array("''", '""', ' ', ' ', ' '), $sql); $regex = <<<EOREGEX /(`(?:[^`]|``)`|[@A-Za-z0-9_.`-]+(?:\(\s*\)){0,1}) |(\+|-|\*|\/|!=|>=|<=|<>|>|<|&&|\|\||=|\^) |(\(.*?\)) # Match FUNCTION(...) OR BAREWORDS |('(?:[^']|'')*'+) |("(?:[^"]|"")*"+) |([^ ,]+) /ix EOREGEX; $tokens = preg_split($regex, $sql, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); $token_count = count($tokens); /* The above regex has one problem, because the parenthetical match is not greedy. Thus, when matching grouped expresions such as ( (a and b) or c) the tokenizer will produce "( (a and b)", " ", "or", " " , "c,")" This block detects the number of open/close parens in the given token. If the parens are balanced (balanced == 0) then we don't need to do anything. otherwise, we need to balance the expression. */ $reset = false; for ($i = 0; $i < $token_count; ++$i) { if (empty($tokens[$i])) { continue; } $token = $tokens[$i]; $trim = trim($token); if ($trim) { if ('(' != $trim[0] && ')' == substr($trim, -1)) { $trim = trim(substr($trim, 0, strpos($trim, '('))); } $tokens[$i] = $trim; $token = $trim; } if ($token && '(' == $token[0]) { $info = $this->count_paren($token); if (0 == $info['balanced']) { continue; } //we need to find this many closing parens $needed = abs($info['balanced']); $n = $i; while ($needed > 0 && $n < $token_count - 1) { ++$n; //echo "LOOKING FORWARD TO $n [ " . $tokens[$n] . "]\n"; $token2 = $tokens[$n]; $info2 = $this->count_paren($token2); $closes = count($info2['close']); if ($closes != $needed) { $tokens[$i] .= $tokens[$n]; unset($tokens[$n]); $reset = true; $info2 = $this->count_paren($tokens[$i]); $needed = abs($info2['balanced']); // echo "CLOSES LESS THAN NEEDED (still need $needed)\n"; } else { /*get the string pos of the last close paren we need*/ $pos = $info2['close'][count($info2['close']) - 1]; $str1 = $str2 = ''; if (0 == $pos) { $str1 = ')'; } else { $str1 = substr($tokens[$n], 0, $pos).')'; $str2 = substr($tokens[$n], $pos + 1); } //echo "CLOSES FOUND AT $n, offset:$pos [$str1] [$str2]\n"; if (strlen($str2) > 0) { $tokens[$n] = $str2; } else { unset($tokens[$n]); $reset = true; } $tokens[$i] .= $str1; $info2 = $this->count_paren($tokens[$i]); $needed = abs($info2['balanced']); } } } } //the same problem appears with backticks :( /* reset the array if we deleted any tokens above */ if ($reset) { $tokens = array_values($tokens); } $token_count = count($tokens); for ($i = 0; $i < $token_count; ++$i) { if (empty($tokens[$i])) { continue; } $token = $tokens[$i]; $needed = true; $reset = false; if ($needed && $token && false !== strpos($token, '`')) { $info = $this->count_backtick($token); if (0 == $info % 2) { //even number of backticks means we are balanced continue; } $needed = 1; $n = $i; while ($needed && $n < $token_count - 1) { $reset = true; //echo "BACKTICK COUNT[$i]: $info old: {$tokens[$i]}, new: ($token)\n"; ++$n; $token .= $tokens[$n]; unset($tokens[$n]); $needed = $this->count_backtick($token) % 2; } } if ($reset) { $tokens[$i] = $token; } } /* reset the array if we deleted any tokens above */ $tokens = array_values($tokens); return $tokens; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function split_sql_file($sql, $delimiter)\n{\n // Split up our string into \"possible\" SQL statements.\n $tokens = explode($delimiter, $sql);\n\n // try to save mem.\n $sql = \"\";\n $output = array();\n\n // we don't actually care about the matches preg gives us.\n $matches = array();\n\n // this is faster than calling count($oktens) every time thru the loop.\n $token_count = count($tokens);\n for ($i = 0; $i < $token_count; $i++)\n {\n // Don't wanna add an empty string as the last thing in the array.\n if (($i != ($token_count - 1)) || (strlen($tokens[$i] > 0)))\n {\n // This is the total number of single quotes in the token.\n $total_quotes = preg_match_all(\"/'/\", $tokens[$i], $matches);\n // Counts single quotes that are preceded by an odd number of backslashes,\n // which means they're escaped quotes.\n $escaped_quotes = preg_match_all(\"/(?<!\\\\\\\\)(\\\\\\\\\\\\\\\\)*\\\\\\\\'/\", $tokens[$i], $matches);\n\n $unescaped_quotes = $total_quotes - $escaped_quotes;\n\n // If the number of unescaped quotes is even, then the delimiter did NOT occur inside a string literal.\n if (($unescaped_quotes % 2) == 0)\n {\n // It's a complete sql statement.\n $output[] = $tokens[$i];\n // save memory.\n $tokens[$i] = \"\";\n }\n else\n {\n // incomplete sql statement. keep adding tokens until we have a complete one.\n // $temp will hold what we have so far.\n $temp = $tokens[$i] . $delimiter;\n // save memory..\n $tokens[$i] = \"\";\n\n // Do we have a complete statement yet?\n $complete_stmt = false;\n\n for ($j = $i + 1; (!$complete_stmt && ($j < $token_count)); $j++)\n {\n // This is the total number of single quotes in the token.\n $total_quotes = preg_match_all(\"/'/\", $tokens[$j], $matches);\n // Counts single quotes that are preceded by an odd number of backslashes,\n // which means they're escaped quotes.\n $escaped_quotes = preg_match_all(\"/(?<!\\\\\\\\)(\\\\\\\\\\\\\\\\)*\\\\\\\\'/\", $tokens[$j], $matches);\n\n $unescaped_quotes = $total_quotes - $escaped_quotes;\n\n if (($unescaped_quotes % 2) == 1)\n {\n // odd number of unescaped quotes. In combination with the previous incomplete\n // statement(s), we now have a complete statement. (2 odds always make an even)\n $output[] = $temp . $tokens[$j];\n\n // save memory.\n $tokens[$j] = \"\";\n $temp = \"\";\n\n // exit the loop.\n $complete_stmt = true;\n // make sure the outer loop continues at the right point.\n $i = $j;\n }\n else\n {\n // even number of unescaped quotes. We still don't have a complete statement.\n // (1 odd and 1 even always make an odd)\n $temp .= $tokens[$j] . $delimiter;\n // save memory.\n $tokens[$j] = \"\";\n }\n\n } // for..\n } // else\n }\n }\n\n return $output;\n}", "private function split_sql_file($sql, $delimiter) {\n // Split up our string into \"possible\" SQL statements.\n $tokens = explode($delimiter, $sql);\n\n // try to save mem.\n $sql = \"\";\n $output = array();\n\n // we don't actually care about the matches preg gives us.\n $matches = array();\n\n // this is faster than calling count($oktens) every time thru the loop.\n $token_count = count($tokens);\n for ($i = 0; $i < $token_count; $i++) {\n // Don't wanna add an empty string as the last thing in the array.\n if (($i != ($token_count - 1)) || (strlen($tokens[$i] > 0))) {\n // This is the total number of single quotes in the token.\n $total_quotes = preg_match_all(\"/'/\", $tokens[$i], $matches);\n // Counts single quotes that are preceded by an odd number of backslashes,\n // which means they're escaped quotes.\n $escaped_quotes = preg_match_all(\"/(?<!\\\\\\\\)(\\\\\\\\\\\\\\\\)*\\\\\\\\'/\", $tokens[$i], $matches);\n\n $unescaped_quotes = $total_quotes - $escaped_quotes;\n\n // If the number of unescaped quotes is even, then the delimiter did NOT occur inside a string literal.\n if (($unescaped_quotes % 2) == 0) {\n // It's a complete sql statement.\n $output[] = $tokens[$i];\n // save memory.\n $tokens[$i] = \"\";\n } else {\n // incomplete sql statement. keep adding tokens until we have a complete one.\n // $temp will hold what we have so far.\n $temp = $tokens[$i] . $delimiter;\n // save memory..\n $tokens[$i] = \"\";\n\n // Do we have a complete statement yet?\n $complete_stmt = false;\n\n for ($j = $i + 1; (!$complete_stmt && ($j < $token_count)); $j++) {\n // This is the total number of single quotes in the token.\n $total_quotes = preg_match_all(\"/'/\", $tokens[$j], $matches);\n // Counts single quotes that are preceded by an odd number of backslashes,\n // which means they're escaped quotes.\n $escaped_quotes = preg_match_all(\"/(?<!\\\\\\\\)(\\\\\\\\\\\\\\\\)*\\\\\\\\'/\", $tokens[$j], $matches);\n\n $unescaped_quotes = $total_quotes - $escaped_quotes;\n\n if (($unescaped_quotes % 2) == 1) {\n // odd number of unescaped quotes. In combination with the previous incomplete\n // statement(s), we now have a complete statement. (2 odds always make an even)\n $output[] = $temp . $tokens[$j];\n\n // save memory.\n $tokens[$j] = \"\";\n $temp = \"\";\n\n // exit the loop.\n $complete_stmt = true;\n // make sure the outer loop continues at the right point.\n $i = $j;\n } else {\n // even number of unescaped quotes. We still don't have a complete statement.\n // (1 odd and 1 even always make an odd)\n $temp .= $tokens[$j] . $delimiter;\n // save memory.\n $tokens[$j] = \"\";\n }\n } // for..\n } // else\n }\n }\n\n return $output;\n }", "private function split_sql_file($sql, $delimiter) {\n // Split up our string into \"possible\" SQL statements.\n $tokens = explode($delimiter, $sql);\n\n // try to save mem.\n $sql = \"\";\n $output = array();\n\n // we don't actually care about the matches preg gives us.\n $matches = array();\n\n // this is faster than calling count($oktens) every time thru the loop.\n $token_count = count($tokens);\n for ($i = 0; $i < $token_count; $i++) {\n // Don't wanna add an empty string as the last thing in the array.\n if (($i != ($token_count - 1)) || (strlen($tokens[$i] > 0))) {\n // This is the total number of single quotes in the token.\n $total_quotes = preg_match_all(\"/'/\", $tokens[$i], $matches);\n // Counts single quotes that are preceded by an odd number of backslashes,\n // which means they're escaped quotes.\n $escaped_quotes = preg_match_all(\"/(?<!\\\\\\\\)(\\\\\\\\\\\\\\\\)*\\\\\\\\'/\", $tokens[$i], $matches);\n\n $unescaped_quotes = $total_quotes - $escaped_quotes;\n\n // If the number of unescaped quotes is even, then the delimiter did NOT occur inside a string literal.\n if (($unescaped_quotes % 2) == 0) {\n // It's a complete sql statement.\n $output[] = $tokens[$i];\n // save memory.\n $tokens[$i] = \"\";\n } else {\n // incomplete sql statement. keep adding tokens until we have a complete one.\n // $temp will hold what we have so far.\n $temp = $tokens[$i] . $delimiter;\n // save memory..\n $tokens[$i] = \"\";\n\n // Do we have a complete statement yet?\n $complete_stmt = false;\n\n for ($j = $i + 1; (!$complete_stmt && ($j < $token_count)); $j++) {\n // This is the total number of single quotes in the token.\n $total_quotes = preg_match_all(\"/'/\", $tokens[$j], $matches);\n // Counts single quotes that are preceded by an odd number of backslashes,\n // which means they're escaped quotes.\n $escaped_quotes = preg_match_all(\"/(?<!\\\\\\\\)(\\\\\\\\\\\\\\\\)*\\\\\\\\'/\", $tokens[$j], $matches);\n\n $unescaped_quotes = $total_quotes - $escaped_quotes;\n\n if (($unescaped_quotes % 2) == 1) {\n // odd number of unescaped quotes. In combination with the previous incomplete\n // statement(s), we now have a complete statement. (2 odds always make an even)\n $output[] = $temp . $tokens[$j];\n\n // save memory.\n $tokens[$j] = \"\";\n $temp = \"\";\n\n // exit the loop.\n $complete_stmt = true;\n // make sure the outer loop continues at the right point.\n $i = $j;\n } else {\n // even number of unescaped quotes. We still don't have a complete statement.\n // (1 odd and 1 even always make an odd)\n $temp .= $tokens[$j] . $delimiter;\n // save memory.\n $tokens[$j] = \"\";\n }\n } // for..\n } // else\n }\n }\n\n return $output;\n }", "function split_sql($sql) {\n\t$sql = trim($sql);\n\t$sql = preg_replace(\"|\\n#[^\\n]*\\n|\", \"\\n\", $sql);\n\t$buffer = array();\n\t$ret = array();\n\t$in_string = false;\n\tfor ($i = 0; $i < strlen($sql) - 1; $i++) {\n\t\tif ($sql[$i] == \";\" && !$in_string) {\n\t\t\t$ret[] = substr($sql, 0, $i);\n\t\t\t$sql = substr($sql, $i + 1);\n\t\t\t$i = 0;\n\t\t}\n\t\tif ($in_string && ($sql[$i] == $in_string) && $buffer[1] != \"\\\\\") {\n\t\t\t$in_string = false;\n\t\t} elseif (!$in_string && ($sql[$i] == '\"' || $sql[$i] == \"'\") && (!isset ($buffer[0]) || $buffer[0] != \"\\\\\")) {\n\t\t\t$in_string = $sql[$i];\n\t\t}\n\t\tif (isset ($buffer[1])) {\n\t\t\t$buffer[0] = $buffer[1];\n\t\t}\n\t\t$buffer[1] = $sql[$i];\n\t}\n\tif (!empty ($sql)) {\n\t\t$ret[] = $sql;\n\t}\n\treturn ($ret);\n}", "public function parse($sql_string = NULL) {\n if (is_string($sql_string)) {\n $this->sql_string = $sql_string;\n // Initialize the Lexer with a 3-level look-back buffer.\n $this->lexer = new SqlLexer($this->sql_string, 3);\n $this->lexer->symbols =& $this->dialect->symbols;\n } \n else {\n if (!is_object($this->lexer)) {\n return $this->raiseError('No initial string specified');\n }\n }\n\n // Get query action.\n $this->getToken();\n switch ($this->token) {\n case NULL:\n // NULL == end of string\n return $this->raiseError('Nothing to do');\n case 'select':\n return $this->parseSelect();\n case 'update':\n return $this->parseUpdate();\n case 'insert':\n return $this->parseInsert();\n case 'delete':\n return $this->parseDelete();\n case 'create':\n return $this->parseCreate();\n case 'drop':\n return $this->parseDrop();\n default:\n return $this->raiseError('Unknown action :' . $this->token);\n }\n }", "function split_sql($sql) {\n $sql = trim($sql);\n $sql = preg_replace(\"/\\n#[^\\n]*\\n/\", \"\\n\", $sql);\n $buffer = array();\n $ret = array();\n $in_string = false;\n for($i=0; $i<strlen($sql)-1; $i++) {\n if($sql[$i] == \";\" && !$in_string) {\n $ret[] = substr($sql, 0, $i);\n $sql = substr($sql, $i + 1);\n $i = 0;\n }\n if($in_string && ($sql[$i] == $in_string) && $buffer[1] != \"\\\\\") {\n $in_string = false;\n }\n elseif(!$in_string && ($sql[$i] == '\"' || $sql[$i] == \"'\") && (!isset($buffer[0]) || $buffer[0] != \"\\\\\")) {\n $in_string = $sql[$i];\n }\n if(isset($buffer[1])) {\n $buffer[0] = $buffer[1];\n }\n $buffer[1] = $sql[$i];\n }\n if(!empty($sql)) {\n $ret[] = $sql;\n }\n return($ret);\n}", "private function process_sql($tokens, $start_at = 0, $stop_at = false)\n {\n $prev_category = '';\n $token_category = '';\n\n $skip_next = false;\n $token_count = count($tokens);\n\n if (!$stop_at) {\n $stop_at = $token_count;\n }\n\n $out = false;\n\n for ($token_number = $start_at; $token_number < $stop_at; ++$token_number) {\n $token = trim($tokens[$token_number]);\n if ($token && '(' == $token[0] && '' == $token_category) {\n $token_category = 'SELECT';\n }\n\n /* If it isn't obvious, when $skip_next is set, then we ignore the next real\n token, that is we ignore whitespace.\n */\n if ($skip_next) {\n //whitespace does not count as a next token\n if ('' == $token) {\n continue;\n }\n\n //to skip the token we replace it with whitespace\n $new_token = '';\n $skip_next = false;\n }\n\n $upper = strtoupper($token);\n switch ($upper) {\n /* Tokens that get their own sections. These keywords have subclauses. */\n case 'SELECT':\n case 'ORDER':\n case 'LIMIT':\n case 'SET':\n case 'DUPLICATE':\n case 'VALUES':\n case 'GROUP':\n case 'HAVING':\n case 'INTO':\n case 'WHERE':\n case 'RENAME':\n case 'CALL':\n case 'PROCEDURE':\n case 'FUNCTION':\n case 'DATABASE':\n case 'SERVER':\n case 'LOGFILE':\n case 'DEFINER':\n case 'RETURNS':\n case 'EVENT':\n case 'TABLESPACE':\n case 'VIEW':\n case 'TRIGGER':\n case 'DATA':\n case 'DO':\n case 'PASSWORD':\n case 'USER':\n case 'PLUGIN':\n case 'FROM':\n case 'FLUSH':\n case 'KILL':\n case 'RESET':\n case 'START':\n case 'STOP':\n case 'PURGE':\n case 'EXECUTE':\n case 'PREPARE':\n case 'DEALLOCATE':\n if ('DEALLOCATE' == $token) {\n $skip_next = true;\n }\n /* this FROM is different from FROM in other DML (not join related) */\n if ('PREPARE' == $token_category && 'FROM' == $upper) {\n continue 2;\n }\n\n $token_category = $upper;\n //$join_type = 'JOIN';\n if ('FROM' == $upper && 'FROM' == $token_category) {\n /* DO NOTHING*/\n } else {\n continue 2;\n }\n break;\n\n /* These tokens get their own section, but have no subclauses.\n These tokens identify the statement but have no specific subclauses of their own. */\n case 'DELETE':\n case 'ALTER':\n case 'INSERT':\n case 'REPLACE':\n case 'TRUNCATE':\n case 'CREATE':\n case 'OPTIMIZE':\n case 'GRANT':\n case 'REVOKE':\n case 'SHOW':\n case 'HANDLER':\n case 'LOAD':\n case 'ROLLBACK':\n case 'SAVEPOINT':\n case 'UNLOCK':\n case 'INSTALL':\n case 'UNINSTALL':\n case 'ANALZYE':\n case 'BACKUP':\n case 'CHECK':\n case 'CHECKSUM':\n case 'REPAIR':\n case 'RESTORE':\n case 'CACHE':\n case 'DESCRIBE':\n case 'EXPLAIN':\n case 'USE':\n case 'HELP':\n $token_category = $upper; /* set the category in case these get subclauses\n in a future version of MySQL */\n $out[$upper][0] = $upper;\n continue 2;\n break;\n\n /* This is either LOCK TABLES or SELECT ... LOCK IN SHARE MODE*/\n case 'LOCK':\n if ('' == $token_category) {\n $token_category = $upper;\n $out[$upper][0] = $upper;\n } else {\n $token = 'LOCK IN SHARE MODE';\n $skip_next = true;\n $out['OPTIONS'][] = $token;\n }\n continue 2;\n break;\n\n case 'USING':\n /* USING in FROM clause is different from USING w/ prepared statement*/\n if ('EXECUTE' == $token_category) {\n $token_category = $upper;\n continue 2;\n }\n if ('FROM' == $token_category && !empty($out['DELETE'])) {\n $token_category = $upper;\n continue 2;\n }\n break;\n\n /* DROP TABLE is different from ALTER TABLE DROP ... */\n case 'DROP':\n if ('ALTER' != $token_category) {\n $token_category = $upper;\n $out[$upper][0] = $upper;\n continue 2;\n }\n break;\n\n case 'FOR':\n $skip_next = true;\n $out['OPTIONS'][] = 'FOR UPDATE';\n continue 2;\n break;\n\n case 'UPDATE':\n if ('' == $token_category) {\n $token_category = $upper;\n continue 2;\n }\n if ('DUPLICATE' == $token_category) {\n continue 2;\n }\n break;\n break;\n\n case 'START':\n $token = 'BEGIN';\n $out[$upper][0] = $upper;\n $skip_next = true;\n break;\n\n /* These tokens are ignored. */\n case 'BY':\n case 'ALL':\n case 'SHARE':\n case 'MODE':\n case 'TO':\n\n case ';':\n continue 2;\n break;\n\n case 'KEY':\n if ('DUPLICATE' == $token_category) {\n continue 2;\n }\n break;\n\n /* These tokens set particular options for the statement. They never stand alone.*/\n case 'DISTINCTROW':\n $token = 'DISTINCT';\n // no break\n case 'DISTINCT':\n case 'HIGH_PRIORITY':\n case 'LOW_PRIORITY':\n case 'DELAYED':\n case 'IGNORE':\n case 'FORCE':\n case 'STRAIGHT_JOIN':\n case 'SQL_SMALL_RESULT':\n case 'SQL_BIG_RESULT':\n case 'QUICK':\n case 'SQL_BUFFER_RESULT':\n case 'SQL_CACHE':\n case 'SQL_NO_CACHE':\n case 'SQL_CALC_FOUND_ROWS':\n $out['OPTIONS'][] = $upper;\n continue 2;\n break;\n\n case 'WITH':\n if ('GROUP' == $token_category) {\n $skip_next = true;\n $out['OPTIONS'][] = 'WITH ROLLUP';\n continue 2;\n }\n break;\n\n case 'AS':\n break;\n\n case '':\n case ',':\n case ';':\n break;\n\n default:\n break;\n }\n\n if ($prev_category == $token_category) {\n $out[$token_category][] = $token;\n }\n\n $prev_category = $token_category;\n }\n\n if (!$out) {\n return false;\n }\n\n //process the SELECT clause\n if (!empty($out['SELECT'])) {\n $out['SELECT'] = $this->process_select($out['SELECT']);\n }\n\n if (!empty($out['FROM'])) {\n $out['FROM'] = $this->process_from($out['FROM']);\n }\n if (!empty($out['USING'])) {\n $out['USING'] = $this->process_from($out['USING']);\n }\n if (!empty($out['UPDATE'])) {\n $out['UPDATE'] = $this->process_from($out['UPDATE']);\n }\n\n if (!empty($out['GROUP'])) {\n $out['GROUP'] = $this->process_group($out['GROUP'], $out['SELECT']);\n }\n if (!empty($out['ORDER'])) {\n $out['ORDER'] = $this->process_group($out['ORDER'], $out['SELECT']);\n }\n\n if (!empty($out['LIMIT'])) {\n $out['LIMIT'] = $this->process_limit($out['LIMIT']);\n }\n\n if (!empty($out['WHERE'])) {\n $out['WHERE'] = $this->process_expr_list($out['WHERE']);\n }\n if (!empty($out['HAVING'])) {\n $out['HAVING'] = $this->process_expr_list($out['HAVING']);\n }\n if (!empty($out['SET'])) {\n $out['SET'] = $this->process_set_list($out['SET']);\n }\n if (!empty($out['DUPLICATE'])) {\n $out['ON DUPLICATE KEY UPDATE'] = $this->process_set_list($out['DUPLICATE']);\n unset($out['DUPLICATE']);\n }\n if (!empty($out['INSERT'])) {\n $out = $this->process_insert($out);\n }\n if (!empty($out['REPLACE'])) {\n $out = $this->process_insert($out, 'REPLACE');\n }\n if (!empty($out['DELETE'])) {\n $out = $this->process_delete($out);\n }\n\n return $out;\n }", "function split_sql($sql) {\n $sql = trim($sql);\n $sql = ereg_replace(\"\\n#[^\\n]*\\n\", \"\\n\", $sql);\n $buffer = array();\n $ret = array();\n $in_string = false;\n for($i=0; $i<strlen($sql)-1; $i++) {\n if($sql[$i] == \";\" && !$in_string) {\n $ret[] = substr($sql, 0, $i);\n $sql = substr($sql, $i + 1);\n $i = 0;\n }\n if($in_string && ($sql[$i] == $in_string) && $buffer[1] != \"\\\\\") {\n $in_string = false;\n }\n elseif(!$in_string && ($sql[$i] == '\"' || $sql[$i] == \"'\") && (!isset($buffer[0]) || $buffer[0] != \"\\\\\")) {\n $in_string = $sql[$i];\n }\n if(isset($buffer[1])) {\n $buffer[0] = $buffer[1];\n }\n $buffer[1] = $sql[$i];\n }\n if(!empty($sql)) {\n $ret[] = $sql;\n }\n return($ret);\n}", "function _splitQueries($sql)\n\t{\n\t\t// Initialise variables.\n\t\t$buffer\t\t= array();\n\t\t$queries\t= array();\n\t\t$in_string\t= false;\n\n\t\t// Trim any whitespace.\n\t\t$sql = trim($sql);\n\n\t\t// Remove comment lines.\n\t\t$sql = preg_replace(\"/\\n\\#[^\\n]*/\", '', \"\\n\".$sql);\n\n\t\t// Parse the schema file to break up queries.\n\t\tfor ($i = 0; $i < strlen($sql) - 1; $i ++)\n\t\t{\n\t\t\tif ($sql[$i] == \";\" && !$in_string)\n {\n\t\t\t\t$queries[] = substr($sql, 0, $i);\n\t\t\t\t$sql = substr($sql, $i +1);\n\t\t\t\t$i = 0;\n\t\t\t}\n\n\t\t\tif ($in_string && ($sql[$i] == $in_string) && $buffer[1] != \"\\\\\")\n {\n\t\t\t\t$in_string = false;\n\t\t\t}\n\t\t\telseif (!$in_string && ($sql[$i] == '\"' || $sql[$i] == \"'\") && (!isset ($buffer[0]) || $buffer[0] != \"\\\\\"))\n {\n\t\t\t\t$in_string = $sql[$i];\n\t\t\t}\n\t\t\tif (isset ($buffer[1]))\n {\n\t\t\t\t$buffer[0] = $buffer[1];\n\t\t\t}\n\t\t\t$buffer[1] = $sql[$i];\n\t\t}\n\n\t\t// If the is anything left over, add it to the queries.\n\t\tif (!empty($sql))\n {\n\t\t\t$queries[] = $sql;\n\t\t}\n\n\t\treturn $queries;\n\t}", "protected function token(): array|string\n {\n if ($this->consume($this->delimiter_pattern)) {\n return \"\"; // end of statement\n }\n\n $token = $this->consume('\\w+');\n if ($token !== \"\") {\n return $token;\n }\n\n $token = $this->consume('\\s+');\n if ($token) {\n return $token;\n }\n\n $token = $this->comment();\n if ($token) {\n return $token;\n }\n\n $token = $this->consume('\\@\\w+');\n if ($token) {\n return $token; // @var\n }\n\n $token = $this->consume(':\\w+');\n if ($token) {\n return $token; // PDO placeholder\n }\n\n $token = $this->consume('[+\\-\\*\\/.,!=^|&<>:@%~#]+');\n if ($token) {\n return $token; // various operators\n }\n\n $token = $this->consume(';');\n if ($token) {\n return $token; // statement separator (when $delimiter_pattern has been modified)\n }\n\n $token = $this->quoted();\n if ($token) {\n return $token;\n }\n\n $tokens = $this->grouped();\n if ($tokens) {\n return $tokens;\n }\n\n $token = $this->dollarquoted();\n if ($token) {\n return $token;\n }\n\n if ($this->isEOF()) {\n return \"\"; // end of file/statement\n }\n\n $this->fail(\"expected SQL token\");\n }", "protected function parseQuery ( $sql )\r\n {\r\n\r\n $positions = array();\r\n\t// match anything ? ' \" or \\ in $sql with an early out if we find nothing\r\n if ( preg_match_all ( '([\\?]|[\\']|[\\\"]|[\\\\\\])', $sql, $matches, PREG_OFFSET_CAPTURE ) !== 0 ) {\r\n $matches = $matches['0'];\r\n $open = NULL;\r\n\t\t// go thru all our matches and see what we can find\r\n for ( $i = 0, $j = count ( $matches ); $i < $j; $i++ ) {\r\n switch ( $matches[$i]['0'] ) {\r\n\t\t\t\t// if we already have an open \" or ' then check if this is the end\r\n\t\t\t\t// to close it or not\r\n case $open:\r\n $open = NULL;\r\n break;\r\n\t\t\t\t// we have a quote, set ourselves open\r\n case '\"':\r\n case \"'\":\r\n $open = $matches[$i]['0'];\r\n break;\r\n\t\t\t\t// check if it is an escaped quote and skip if it is\r\n case '\\\\':\r\n $next_match = $matches[$i+1]['0'];\r\n if ( $next_match === '\"' || $next_match === \"'\" ) {\r\n $i++;\r\n }\r\n unset ( $next_match );\r\n break;\r\n\t\t\t\t// we found a ?, check we arent in an open \"/' first and\r\n\t\t\t\t// add it to the position list if we arent\r\n default:\r\n if ( $open === NULL ) {\r\n $positions[] = $matches[$i]['1'];\r\n }\r\n }\r\n unset ( $matches[$i] );\r\n }\r\n unset ( $open, $matches, $i, $j );\r\n }\r\n\r\n\treturn $positions;\r\n\r\n }", "function parsesql ($sql)\n {\n $this->lastsql = $sql;\n $final = $sql;\n $thesql = strtoupper ($sql);\n //echo $thesql;\n /* FIRST = LIMIT */\n $pos = 0;\n if ($this->dbtype == \"firebird\")\n {\n }\n else\n if ($this->dbtype == \"mssql\")\n {\n //fix for blobs & dates -- make sure space before the words\n $sqlwords = array('/ blob/','/ date/');\n \n $repwords = array (' VarBinary null', ' datetime null');\n \n $final = preg_replace($sqlwords, $repwords, $final);\n }\n else \n if ($this->dbtype == \"sqlite\" || $this->dbtype == \"mysql\")\n {\n \n \n \n $pos = strpos ($thesql, \"FIRST\", $pos);\n if ($pos != 0)\n {\n //now to get the number and delete\n $start = $pos;\n //skip the first keyword\n $pos = $pos+5;\n while ($thesql[$pos] == \" \")\n {\n $pos++;\n }\n //we have now found the number eg FIRST 100\n while ($thesql[$pos] != \" \")\n {\n $pos++;\n }\n $end = $pos;\n //get the string FIRST 100\n $keyword = substr ($thesql, $start, $end-$start);\n //delete from sql statement\n $thesql = str_replace ($keyword, \"\", $thesql);\n //replace LIMIT by FIRST\n $keyword = str_replace (\"FIRST\", \"LIMIT\", $keyword);\n // add LIMIT to the end\n $thesql = $thesql.\" \".$keyword;\n $final = $thesql;\n }\n \n //Find Firebird date defaults\n \n $final = str_ireplace (\"'now'\", \"'\".date($this->dateformat).\"'\", $final);\n \n }\n return $final;\n }", "public static function splitSQLStatements(string $sqlScript, string $quote = self::SINGLE_QUOTE, string $sqlEscapedQuote = self::BACKSLASH_SINGLE_QUOTE, string $endOfStatement = self::SEMICOLON_END_OF_STATEMENT): array {\n\t\t$token = '*!@::@!*';\n\t\t$map = [$sqlEscapedQuote => $token];\n\t\t$inverseMap = [$token => $sqlEscapedQuote];\n\t\t// Convert our string to make pattern matching easier\n\t\t$sqlScript = strtr($sqlScript, $map);\n\t\t$index = 0;\n\t\t$matches = [];\n\t\t$pattern = '/' . $quote . '[^' . $quote . ']*' . $quote . '/';\n\t\twhile (preg_match($pattern, $sqlScript, $matches) !== 0) {\n\t\t\t[$from] = $matches;\n\t\t\t$to = chr(1) . '{' . $index . '}' . chr(2);\n\t\t\t$index++;\n\t\t\t// Map BACK to the original string, not the munged one\n\t\t\t$inverseMap[$to] = $from;\n\t\t\t$sqlScript = strtr($sqlScript, [\n\t\t\t\t$from => $to,\n\t\t\t]);\n\t\t}\n\t\t// Split on end of line character and remove blank lines\n\t\t$sqlStatements = array_filter(ArrayTools::listTrimClean(explode($endOfStatement, $sqlScript . $endOfStatement)));\n\t\t// Convert everything back to what it is supposed to be\n\t\treturn Types::replaceSubstrings($sqlStatements, $inverseMap);\n\t}", "private function splitSQL($sql, $explodeChars)\n {\n if (preg_match('|^(.*)DELIMITER (\\S+)\\s(.*)$|isU', $sql, $matches)) {\n $queries = explode($explodeChars, $matches[1]);\n $recursive = $this->splitSQL($matches[3], $matches[2]);\n\n return array_merge($queries, $recursive);\n }\n else {\n return explode($explodeChars, $sql);\n }\n }", "protected function statement(): ?array\n {\n $this->consume('\\s*');\n\n if ($this->isEOF()) {\n return null;\n }\n\n $tokens = [];\n\n $token = $this->token();\n while ($token !== \"\") {\n /**\n * DEV NOTE: This checks for DELIMITER statement, that changes delimiter from ; to something else.\n * If detected, it will extract the new DELIMITER and reassign $this->delimiter_pattern.\n */\n if (is_string($token) && preg_match('/^delimiter$/i', $token) === 1) {\n // Omit DELIMITER command - it isn't part of SQL statement syntax\n\n $this->consume('[ ]*');\n\n $delimiter = trim($this->consume('.*?[\\r\\n]+'));\n\n if ($delimiter === \"\") {\n $this->fail(\"expected delimiter character(s)\");\n }\n\n $this->delimiter_pattern = preg_quote($delimiter);\n\n } else {\n $tokens[] = $token;\n }\n $token = $this->token();\n }\n\n return $tokens;\n }", "protected function parseQuery()\r\n {\r\n do {\r\n switch (strtolower(current($this->tokens))) {\r\n case \"base\":\r\n $this->parseBase();\r\n break;\r\n case \"prefix\":\r\n $this->parsePrefix();\r\n break;\r\n case \"select\":\r\n $this->parseSelect();\r\n break;\r\n case \"describe\":\r\n $this->parseDescribe();\r\n break;\r\n case \"ask\":\r\n $this->parseAsk('ask');\r\n break;\r\n case \"count\":\r\n $this->parseAsk('count');\r\n break;\r\n case \"from\":\r\n $this->parseFrom();\r\n break;\r\n case \"construct\":\r\n $this->parseConstruct();\r\n break;\r\n case \"where\":\r\n $this->parseWhere();\r\n $this->parseModifier();\r\n break;\r\n case \"{\":\r\n prev($this->tokens);\r\n $this->parseWhere();\r\n $this->parseModifier();\r\n break;\r\n }\r\n } while (next($this->tokens));\r\n\r\n }", "private function splitStatements($sql, $params)\n {\n $semicolonIndex = strpos($sql, ';');\n if ($semicolonIndex === false || $semicolonIndex === StringHelper::byteLength($sql) - 1) {\n return false;\n }\n\n $tokenizer = new SqlTokenizer($sql);\n $codeToken = $tokenizer->tokenize();\n if (count($codeToken->getChildren()) === 1) {\n return false;\n }\n\n $statements = [];\n foreach ($codeToken->getChildren() as $statement) {\n $statements[] = [$statement->getSql(), $this->extractUsedParams($statement, $params)];\n }\n return $statements;\n }", "function _scrapeSQL($sql) {\n\t\t$sql = str_replace(\"\\\"\", '', $sql);\n\n\t\tif (1) {\n\t\t\t// in Common Table Expression there are way more selects\n\t\t\t// we care only about the final select\n\t\t\t// workaround:\n\t\t\t$selectParts = preg_split('/\\SELECT\\b/', $sql);\n\t\t\t$sql = array_pop($selectParts);\n\t\t}\n\n\t\t$preFrom = preg_split('/\\bFROM\\b/', $sql);\n\t\t$preFrom = $preFrom[0];\n\t\t$find = array('SELECT');\n\t\t$replace = array('');\n\t\t$fieldList = trim(str_replace($find, $replace, $preFrom));\n\t\t$fields = preg_split('/,\\s+/', $fieldList);//explode(', ', $fieldList);\n\t\t$lastTableName\t= '';\n\n\t\tforeach($fields as $key => $value) {\n\t\t\tif ($value != 'COUNT(*) AS count') {\n\t\t\t\tif (preg_match('/\\s+(\\w+(\\.\\w+)*)$/', $value, $matches)) {\n\t\t\t\t\t$fields[$key]\t= $matches[1];\n\n\t\t\t\t\tif (preg_match('/^(\\w+\\.)/', $value, $matches)) {\n\t\t\t\t\t\t$fields[$key]\t= $matches[1] . $fields[$key];\n\t\t\t\t\t\t$lastTableName\t= $matches[1];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\tif (preg_match('/(([[:alnum:]_]+)\\.[[:alnum:]_]+)(\\s+AS\\s+(\\w+))?$/i', $value, $matches)) {\n\t\t\t\t\t$fields[$key]\t= isset($matches[4]) ? $matches[2] . '.' . $matches[4] : $matches[1];\n\t\t\t\t}\n\t\t\t\t*/\n\t\t\t}\n\t\t}\n\t\t$this->_map = array();\n\n\t\tforeach($fields as $f) {\n\t\t\t$e = explode('.', $f);\n\t\t\tif (count($e) > 1) {\n\t\t\t\t$table = $e[0];\n\t\t\t\t// here used to be a strtolower call\n\t\t\t\t// https://github.com/ptica/Oracle/commit/aacb1fe7df0bf5315ef8d35eb6105468a46fb54b\n\t\t\t\t$field = $e[1];\n\t\t\t} else {\n\t\t\t\t$table = 0;\n\t\t\t\t$field = $e[0];\n\t\t\t}\n\t\t\t$this->_map[] = array($table, $field);\n\t\t}\n\t}", "public static function splitSql($query)\n\t{\n\t\t$start = 0;\n\t\t$open = false;\n\t\t$char = '';\n\t\t$end = strlen($query);\n\t\t$queries = [];\n\n\t\tfor ($i = 0; $i < $end; $i++)\n\t\t{\n\t\t\t$current = substr($query, $i, 1);\n\t\t\tif (($current == '\"' || $current == '\\''))\n\t\t\t{\n\t\t\t\t$n = 2;\n\n\t\t\t\twhile (substr($query, $i - $n + 1, 1) == '\\\\' && $n < $i)\n\t\t\t\t{\n\t\t\t\t\t$n++;\n\t\t\t\t}\n\n\t\t\t\tif ($n % 2 == 0)\n\t\t\t\t{\n\t\t\t\t\tif ($open)\n\t\t\t\t\t{\n\t\t\t\t\t\tif ($current == $char)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$open = false;\n\t\t\t\t\t\t\t$char = '';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t$open = true;\n\t\t\t\t\t\t$char = $current;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (($current == ';' && !$open) || $i == $end - 1)\n\t\t\t{\n\t\t\t\t$queries[] = substr($query, $start, ($i - $start + 1));\n\t\t\t\t$start = $i + 1;\n\t\t\t}\n\t\t}\n\n\t\treturn $queries;\n\t}", "private function parseStatement()\n {\n $token = $this->tokenStream->currentToken();\n\n switch ($token->getValue()) {\n case 'if':\n return $this->parseIfStatement();\n\n case 'while':\n return $this->parseWhileStatement();\n\n default:\n throw new Exception('Expected if or while');\n }\n }", "public function parse_sql($condition)\n {\n if (count($condition) == 1) {\n return $condition[0];\n }\n\n $sql = array_shift($condition);\n $count = substr_count($sql, '?');\n\n if (is_array($condition[0])) {\n $condition = $condition[0];\n }\n\n if ($count > count($condition)) {\n return $sql . \"\\n\" . print_r($condition, TRUE);\n }\n\n for ($i = 0; $i < $count; $i++) {\n $sql = preg_replace('/\\?/', $this->master_link->quote($condition[$i]), $sql, 1);\n }\n\n // replace :id\n $sql = preg_replace_callback('/:(\\w+)/', function ($matches) use ($condition) {\n if (isset($condition[$matches[1]])) {\n return $this->master_link->quote($condition[$matches[1]]);\n } else if (isset($condition[':' . $matches[1]])) {\n return $this->master_link->quote($condition[':' . $matches[1]]);\n }\n return $matches[0];\n }, $sql);\n\n return $sql;\n }", "function split_sql_file($sql, $delimiter)\r\n{\r\n\t$sql = str_replace(\"\\r\" , '', $sql);\r\n\t$data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql);\r\n\r\n\tforeach ($data as $key => $value)\r\n\t{\r\n\t\t$data[$key] = trim($value);\r\n\t}\r\n\r\n\t// The empty case\r\n\t$end_data = end($data);\r\n\r\n\tif (empty($end_data))\r\n\t{\r\n\t\tunset($data[key($data)]);\r\n\t}\r\n\r\n\treturn $data;\r\n}", "private function process_expr_list($tokens)\n {\n $expr = '';\n $type = '';\n $prev_token = '';\n $skip_next = false;\n $sub_expr = '';\n\n $in_lists = array();\n foreach ($tokens as $key => $token) {\n if (0 == strlen(trim($token))) {\n continue;\n }\n if ($skip_next) {\n $skip_next = false;\n continue;\n }\n\n $processed = false;\n $upper = strtoupper(trim($token));\n if (trim($token)) {\n $token = trim($token);\n }\n\n /* is it a subquery?*/\n if (preg_match('/^\\\\s*\\\\(\\\\s*SELECT/i', $token)) {\n $type = 'subquery';\n //tokenize and parse the subquery.\n //we remove the enclosing parenthesis for the tokenizer\n $processed = $this->parse(trim($token, ' ()'));\n /* is it an inlist */\n } elseif ('(' == $upper[0] && ')' == substr($upper, -1)) {\n if ('IN' == $prev_token) {\n $type = 'in-list';\n $processed = $this->split_sql(substr($token, 1, -1));\n $list = array();\n foreach ($processed as $v) {\n if (',' == $v) {\n continue;\n }\n $list[] = $v;\n }\n $processed = $list;\n unset($list);\n $prev_token = '';\n } elseif ('AGAINST' == $prev_token) {\n $type = 'match-arguments';\n $list = $this->split_sql(substr($token, 1, -1));\n if (count($list) > 1) {\n $match_mode = implode('', array_slice($list, 1));\n $processed = array($list[0], $match_mode);\n } else {\n $processed = $list[0];\n }\n $prev_token = '';\n }\n /* it is either an operator, a colref or a constant */\n } else {\n switch ($upper) {\n case 'AND':\n case '&&':\n case 'BETWEEN':\n case 'BINARY':\n case '&':\n case '~':\n case '|':\n case '^':\n case 'CASE':\n case 'WHEN':\n case 'END':\n case 'DIV':\n case '/':\n case '<=>':\n case '=':\n case '>=':\n case '>':\n case 'IS':\n case 'NOT':\n case 'NULL':\n case '<<':\n case '<=':\n case '<':\n case 'LIKE':\n case '-':\n case '%':\n case '!=':\n case '<>':\n case 'REGEXP':\n case '!':\n case '||':\n case 'OR':\n case '+':\n case '>>':\n case 'RLIKE':\n case 'SOUNDS':\n case '*':\n case 'XOR':\n case 'IN':\n $processed = false;\n $type = 'operator';\n break;\n default:\n switch ($token[0]) {\n case \"'\":\n case '\"':\n $type = 'const';\n break;\n case '`':\n $type = 'colref';\n break;\n\n default:\n if (is_numeric($token)) {\n $type = 'const';\n } else {\n $type = 'colref';\n }\n break;\n }\n //$processed = $token;\n $processed = false;\n }\n }\n /* is a reserved word? */\n if (('operator' != $type && 'in-list' != $type && 'sub_expr' != $type) && in_array($upper, $this->reserved)) {\n $token = $upper;\n if (!in_array($upper, $this->functions)) {\n $type = 'reserved';\n } else {\n switch ($token) {\n case 'AVG':\n case 'SUM':\n case 'COUNT':\n case 'MIN':\n case 'MAX':\n case 'STDDEV':\n case 'STDDEV_SAMP':\n case 'STDDEV_POP':\n case 'VARIANCE':\n case 'VAR_SAMP':\n case 'VAR_POP':\n case 'GROUP_CONCAT':\n case 'BIT_AND':\n case 'BIT_OR':\n case 'BIT_XOR':\n $type = 'aggregate_function';\n if (!empty($tokens[$key + 1])) {\n $sub_expr = $tokens[$key + 1];\n }\n //$skip_next=true;\n break;\n\n default:\n $type = 'function';\n if (!empty($tokens[$key + 1])) {\n $sub_expr = $tokens[$key + 1];\n } else {\n $sub_expr = '()';\n }\n //$skip_next=true;\n\n break;\n }\n }\n }\n\n if (!$type) {\n if ('(' == $upper[0]) {\n $local_expr = substr(trim($token), 1, -1);\n } else {\n $local_expr = $token;\n }\n $processed = $this->process_expr_list($this->split_sql($local_expr));\n $type = 'expression';\n\n if (1 == count($processed)) {\n $type = $processed[0]['expr_type'];\n $base_expr = $processed[0]['base_expr'];\n $processed = $processed[0]['sub_tree'];\n }\n }\n\n $sub_expr = trim($sub_expr);\n $sub_expr = '';\n\n $expr[] = array('expr_type' => $type, 'base_expr' => $token, 'sub_tree' => $processed);\n $prev_token = $upper;\n $expr_type = '';\n $type = '';\n }\n if ($sub_expr) {\n $processed['sub_tree'] = $this->process_expr_list($this->split_sql(substr($sub_expr, 1, -1)));\n }\n\n if (!is_array($processed)) {\n print_r($processed);\n $processed = false;\n }\n\n if ($expr_type) {\n $expr[] = array('expr_type' => $type, 'base_expr' => $token, 'sub_tree' => $processed);\n }\n $mod = false;\n\n /*\n\n for($i=0;$i<count($expr);++$i){\n if($expr[$i]['expr_type'] == 'function' ||\n $expr[$i]['expr_type'] == 'aggregate_function') {\n if(!empty($expr[$i+1])) {\n $expr[$i]['sub_tree']=$expr[$i+1]['sub_tree'];\n unset($expr[$i+1]);\n $mod = 1;\n ++$i; // BAD FORM TO MODIFY THE LOOP COUNTER\n }\n }\n\n }\n\n */\n\n if ($mod) {\n $expr = array_values($expr);\n }\n\n return $expr;\n }", "public function parseSql(){\n\n $sql='select %s from %s %s %s %s %s %s';\n\n $sql=sprintf($sql,$this->option['cols'],$this->table,$this->option['where'],$this->option['group'],$this->option['having'],$this->option['order'],$this->option['limit']);\n\n echo $sql;\n return $sql;\n }", "public static function ParseString($sqlQuery) {\n\n // returns a SqlParser object \n if (! isset($this)) {\n $handle = new SqlParser();\n } else {\n $handle = $this;\n }\n \n // tokenize the query\n $tokens = self::Tokenize($sqlQuery);\n $tokenCount = count($tokens);\n $queryParts = array();\n $section = $tokens[0];\n \n // parse the tokens\n for ($t = 0; $t < $tokenCount; $t ++) {\n \n if (in_array($tokens[$t], self::$startparens)) {\n \n $sub = $handle->readsub($tokens, $t);\n $handle->query[$section] .= $sub;\n \n } else {\n \n if (in_array(strtolower($tokens[$t]), self::$querysections) && ! isset($handle->query[$tokens[$t]])) {\n $section = strtolower($tokens[$t]);\n }\n \n // rebuild the query in sections\n if (! isset($handle->query[$section])) $handle->query[$section] = '';\n $handle->query[$section] .= $tokens[$t];\n \n }\n }\n \n return $handle;\n }", "function hql_to_sql($str, $prefix = 'hql')\n{\n\t// allowed HQL fields, need to exist in messagelog table\n\t$fields = array();\n\t$fields['messageid'] = 'msgid';\n\t$fields['from'] = 'msgfrom';\n\t$fields['to'] = 'msgto';\n\t$fields['subject'] = 'msgsubject';\n\t$fields['ip'] = 'msgfromserver';\n\t$fields['action'] = 'msgaction';\n\t$fields['transport'] = 'msgtransport';\n\t$fields['server'] = 'msglistener';\n\t$fields['sasl'] = 'msgsasl';\n\t$fields['rpdscore'] = 'score_rpd';\n\t$fields['sascore'] = 'score_sa';\n\t$fields['time'] = 'UNIX_TIMESTAMP(msgts0)'; // XXX MySQL only\n\n\tpreg_match_all('/\\s*([a-z]+([=~><])(\"(\\\"|[^\"])*?\"|[^\\s]*)|and|or|not|&&)\\s*/', $str, $parts);\n\t$parts = $parts[1]; // because of the regex above, index 1 contains what we want\n\t$filter = '';\n\t$params = array();\n\t$i = 0;\n\t$ftok = 0; // filter token\n\tforeach ($parts as $p) {\n\t\tif ($p == 'and') { if ($ftok != 1) die('no filter condition before and'); $filter .= 'AND '; $ftok = 0; }\n\t\telse if ($p == 'or') { if ($ftok != 1) die('no filter condition before or'); $filter .= 'OR '; $ftok = 0; }\n\t\telse if ($p == 'not') { if ($ftok == 1) $filter .= 'AND '; $filter .= 'NOT '; $ftok = 0; }\n\t\telse if (preg_match('/^([a-z]+)([=~><])(.*?)$/', $p, $m)) {\n\t\t\tif ($ftok == 1) $filter .= 'AND ';\n\t\t\t$i++;\n\t\t\tlist($tmp, $field, $type, $value) = $m;\n\t\t\t// unescape\n\t\t\tif ($value[0] == '\"' && substr($value, -1) == '\"') {\n\t\t\t\t$value = substr($value, 1, strlen($value) - 1);\n\t\t\t\t$value = str_replace('\\\"', '\"', $value);\n\t\t\t}\n\t\t\tif (!isset($fields[$field])) die('unknown field '.htmlspecialchars($field));\n\t\t\t$field = $fields[$field];\n\t\t\tif ($type == '~') {\n\t\t\t\t$type = 'LIKE';\n\t\t\t\tif (strpos($value, '%') === false)\n\t\t\t\t\t$value = '%'.$value.'%';\n\t\t\t}\n\t\t\t// domain search from~%@\n\t\t\tif ($field == 'msgfrom' && substr($value, 0, 2) == '%@') {\n\t\t\t\t$field = 'msgfrom_domain';\n\t\t\t\t$value = substr($value, 2); // strip %@\n\t\t\t\t$type = '=';\n\t\t\t}\n\t\t\t// domain search to~%@\n\t\t\tif ($field == 'msgto' && substr($value, 0, 2) == '%@') {\n\t\t\t\t$field = 'msgto_domain'; // strip %@\n\t\t\t\t$value = substr($value, 2);\n\t\t\t\t$type = '=';\n\t\t\t}\n\t\t\t// fully rewrite fulltext search\n\t\t\tif ($field == 'msgsubject' && $type == 'LIKE') {\n\t\t\t\t$filter .= 'MATCH (msgsubject) AGAINST (:'.$prefix.$i.' IN BOOLEAN MODE)';\n\t\t\t\t$value = str_replace('%', ' ', $value); // remove all % in fulltext search\n\t\t\t} else {\n\t\t\t\t$filter .= $field.' '.$type.' :'.$prefix.$i.' ';\n\t\t\t}\n\t\t\t$params[':'.$prefix.$i] = $value;\n\t\t\t$ftok = 1;\n\t\t} else die('unexpected token '.htmlspecialchars($p));\n\t}\n\tif ($str && !$filter) die('invalid query');\n\treturn array('filter' => $filter, 'params' => $params);\n}", "public function testTokenization( $sql, $expectedTokens )\n {\n $tokenizer = $this->_getMysqlTokenTokenizerInstance();\n $tokenizer->tokenize( $sql );\n $tokens = $tokenizer->shiftAllStack();\n $this->assertTokenTreeEquals( $expectedTokens, $tokens );\n }", "public function scrapeSql($sql)\n {\n $sql = str_replace('\"', '', $sql);\n $preFrom = preg_split('/\\bFROM\\b/', $sql);\n $preFrom = $preFrom[0];\n $find = ['SELECT'];\n $replace = [''];\n $fieldList = trim(str_replace($find, $replace, $preFrom));\n $fields = preg_split('/,\\s+/', $fieldList); //explode(', ', $fieldList);\n $lastTableName = '';\n\n foreach ($fields as $key => $value) {\n if ($value != 'COUNT(*) AS count') {\n if (preg_match('/\\s+(\\w+(\\.\\w+)*)$/', $value, $matches)) {\n $fields[$key] = $matches[1];\n\n if (preg_match('/^(\\w+\\.)/', $value, $matches)) {\n $fields[$key] = $matches[1].$fields[$key];\n $lastTableName = $matches[1];\n }\n }\n /*\n if (preg_match('/(([[:alnum:]_]+)\\.[[:alnum:]_]+)(\\s+AS\\s+(\\w+))?$/i', $value, $matches)) {\n $fields[$key]\t= isset($matches[4]) ? $matches[2] . '.' . $matches[4] : $matches[1];\n }\n */\n }\n }\n $this->_map = [];\n\n foreach ($fields as $f) {\n $e = explode('.', $f);\n if (count($e) > 1) {\n $table = $e[0];\n $field = strtolower($e[1]);\n } else {\n $table = 0;\n $field = $e[0];\n }\n $this->_map[] = [$table, $field];\n }\n }", "protected function parseStatementData()\n {\n return preg_split(\n '/(^:20:|^-X{,3}$|\\Z)/m',\n $this->getRawData(),\n -1,\n PREG_SPLIT_NO_EMPTY\n );\n }", "public function split_sql_file($sql, $delimiter)\n\t{\n\t\t$sql = str_replace(\"\\r\" , '', $sql);\n\t\t$data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql);\n\n\t\t$data = array_map('trim', $data);\n\n\t\t// The empty case\n\t\t$end_data = end($data);\n\n\t\tif (empty($end_data))\n\t\t{\n\t\t\tunset($data[key($data)]);\n\t\t}\n\n\t\treturn $data;\n\t}" ]
[ "0.6975106", "0.69383657", "0.69383657", "0.6857623", "0.6838937", "0.678127", "0.6695361", "0.649831", "0.6458806", "0.622524", "0.62083435", "0.61765236", "0.61370504", "0.60923845", "0.60534817", "0.60192347", "0.60028476", "0.5994579", "0.59131324", "0.58408505", "0.5719103", "0.5616621", "0.55902076", "0.5578881", "0.55300766", "0.54902524", "0.54805297", "0.54720247", "0.54627633", "0.5457163" ]
0.75175434
0
/ A SET list is simply a list of key = value expressions separated by comma (,). This function produces a list of the key/value expressions.
private function process_set_list($tokens) { $column = ''; $expression = ''; foreach ($tokens as $token) { $token = trim($token); if (!$column) { if (false === $token || empty($token)) { continue; } $column .= $token; continue; } if ('=' == $token) { continue; } if (',' == $token) { $expr[] = array('column' => trim($column), 'expr' => trim($expression)); $expression = $column = ''; continue; } $expression .= $token; } if ($expression) { $expr[] = array('column' => trim($column), 'expr' => trim($expression)); } return $expr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function buildSetClause() {\n\t\tif (isset($this->expression))\n\t\t\treturn $this->expression;\n\t\t\n\t\t$set = [];\n\t\t\n\t\tforeach (array_keys($this->value) as $k )\n\t\t\t$set[] = $k . '=#{' . $k . '}';\n\t\t\n\t\treturn implode(',', $set);\n\t}", "static function sqlSetExpression($values)\n {\n if(is_array($values)) {\n $set_expression = '';\n foreach($values as $column => $value) {\n if(isset($value))\n $set_expression .= $column . '=\"' . Security::sanitizeForDatabase($value) . '\", ';\n }\n\n $set_expression = rtrim($set_expression, ', ');\n } else {\n $set_expression = $values;\n }\n return $set_expression;\n }", "function MakeValuesList(&$ds)\n{\n $result = '';\n if (sizeof($ds) > 0)\n foreach ($ds as $k => $v)\n {\n if ($k!='')\n $result = $result.',\"'.DB_Safe($v).'\"';\n }\n return substr($result,1);\n}", "public function compile_builder_setlist(GlueDB_Fragment_Builder_Setlist $fragment) {\n\t\treturn $this->compile_builder($fragment, ', ');\n\t}", "protected function _compile_set(Database $db, array $values)\n\t{\n\t\t$set = [];\n\t\tforeach ($values as $group)\n\t\t{\n\t\t\t// Split the set\n\t\t\tlist ($column, $value) = $group;\n\n\t\t\t// Quote the column name\n\t\t\t$column = $db->quote_column($column);\n\n\t\t\tif ((is_string($value) AND array_key_exists($value, $this->_parameters)) === FALSE)\n\t\t\t{\n\t\t\t\t// Quote the value, it is not a parameter\n\t\t\t\t$value = $db->quote($value);\n\t\t\t}\n\n\t\t\t$set[$column] = $column.' = '.$value;\n\t\t}\n\n\t\treturn implode(', ', $set);\n\t}", "function GetSetArray($sSet){\n\treturn SetReverseArrayToTrue(explode(',',$sSet));\n}", "protected function getSetQuery(): string\n {\n $values = [];\n\n foreach ($this->values as $column => $value) {\n $values[] = $column . ' = ' . $value;\n }\n\n return Statement::SET . ' ' . implode(', ', $values);\n }", "function make_inlist_from_list($list){\n\tif (empty($list) )return false;\n\t$qlist = array_map(function ($c) {return \"'$c'\";},$list);\n\n\t$inlist = join(',',$qlist);\n\treturn $inlist;\n}", "private function parseSetColumnsClause() {\n\t\t$startIndex = $this->index;\n\t\tif ($this->isIdentifierWithValue($this->nextToken(), 'set')) {\n\t\t\t$hasValues = true;\n\t\t\twhile ($this->parseSetColumnClause()) {\n\t\t\t\t$hasValues = true;\n\t\t\t\t$savePoint = $this->index;\n\t\t\t\tif ($this->isTokenOfType($this->nextToken(), wfWAFSQLiLexer::COMMA)) {\n\t\t\t\t\t$hasValues = false;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$this->index = $savePoint;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ($hasValues) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t$this->index = $startIndex;\n\t\treturn false;\n\t}", "function assignments_to_sql($assignments) {\n if(is_array($assignments)) {\n return static::separate_each_by_comma($assignments, function($value, $name) {\n return $this->assignment_to_sql($name, $value);\n });\n }\n\n return $assignments;\n }", "protected function compilePartSet(): string\n {\n if (! empty($this->query['values'])) {\n $parts = [];\n\n foreach ($this->query['values'] as $k => $v) {\n $parts[] = $this->quoteIdentifier(identifier: $k) . ' = ' . $this->quote(value: $v);\n }\n\n return ' SET ' . implode(separator: ', ', array: $parts);\n }\n\n return '';\n }", "public function getSetValues()\n {\n return $this->setValues;\n }", "public function createSetFromList(array $list): SetInterface;", "public function setMultiple($key);", "function array_tuplets($array, $del=\", \") {\n $tuplets = array();\n foreach($array as $key=>$val) {\n $val = addslashes($val);\n $tuplets[] = \"$key='$val'\"; // quote value\n }\n return implode($del, $tuplets);\n}", "public function setMultiple($values, $ttl = null);", "private function _commaToArray(string $list): array\n {\n $r = [];\n\n if (!empty($list)) {\n $r = array_filter(preg_split('/[\\s,]+/', trim($list)));\n }\n\n // remove duplicated values\n return array_unique($r);\n }", "function mysqlUpdateArray($table, $keys, $values, $where)\n {\n $set = array();\n for($i = 0; $i < count($keys); $i++)\n {\n $set[] = \"`\".$keys[$i].\"` = '\".addslashes($values[$i]).\"'\";\n }\n\n $sets = implode(\", \", $set);\n\n //echo \"UPDATE $table SET $sets WHERE $where\". \"<br />\\n\";\n mysql_query(\"UPDATE $table SET $sets WHERE $where\");\n\n }", "public function setMultiple($values, $ttl = null)\n {\n }", "public function setMultiple($values, $ttl = null)\n {\n }", "function array_keys_list($array, $del=\", \") {\n return implode($del, array_keys($array));\n}", "private function sql_column_value_list() {\n \n $list = \"\";\n foreach ($this->GAME_TABLE_COLUMNS as $item) {\n if ($item != \"stamp\") { # stamp must be null for auto-update\n $list = $list . \"\\\"{$this->$item}\\\", \";\n }\n }\n $list = rtrim($list, \", \");\n// dbg(\"=\".__METHOD__.\":Game:sql_column_value_list()=$list\");\n return $list;\n }", "function _update($values) {\n\t\tforeach ($values as $key => $value)\n\t\t\t$values[$key] = \"$key = $value\";\n\t\treturn implode(', ', $values);\n\t}", "public function keysSet();", "function true_value_keys(array $set) {\n $tv = array();\n foreach ($set as $k => $v) {\n if ($v) {\n $tv[] = $k;\n }\n }\n return $tv;\n}", "function values_to_sql($values) {\n if(is_array($values)) {\n return static::separate_each_by_comma($values, function($value) {\n return $this->value_to_sql($value);\n });\n }\n\n return $values;\n }", "function get_set($params)\n\t\t{\n\t\t\tif( !is_array( $params ) )\n\t\t\t{\n\t\t\t\t$this->register_error( 'get_set() parameter invalid. Expected array in '.__FILE__.' on line '.__LINE__);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$sql = array();\n\t\t\tforeach ( $params as $field => $val )\n\t\t\t{\n\t\t\t\tif ( $val === 'true' || $val === true )\n\t\t\t\t\t$val = 1;\n\t\t\t\tif ( $val === 'false' || $val === false )\n\t\t\t\t\t$val = 0;\n\n\t\t\t\tswitch( $val ){\n\t\t\t\t\tcase 'NOW()' :\n\t\t\t\t\tcase 'NULL' :\n\t\t\t\t\t $sql[] = \"$field = $val\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault :\n\t\t\t\t\t\t$sql[] = \"$field = '\".$this->escape( $val ).\"'\";\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn implode( ', ' , $sql );\n\t\t}", "protected function _createSetOfStrings($strings, $quoted = TRUE) {\n $set = '';\n foreach ($strings as $string) {\n if (TRUE === $quoted) {\n $set .= ' \"' . $string . '\", ';\n } else {\n $set .= ' ' . $string . ', ';\n }\n }\n\n if ('' !== $set) {\n $set = substr($set, 0, -2);\n }\n\n $set = ' ( ' . $set . ' ) ';\n\n return $set;\n }", "public static function retrieveSetterOperators() {\n\t\treturn array(\n\t\t\t\tself::SETTER_OPERATOR_SET => array(\n\t\t\t\t\t\t'name' => 'Set',\n\t\t\t\t\t\t'type' => '1'\n\t\t\t\t),\n\t\t\t\tself::SETTER_OPERATOR_UNSET => array(\n\t\t\t\t\t\t'name' => 'Unset',\n\t\t\t\t\t\t'type' => '1'\n\t\t\t\t),\n\t\t\t\tself::SETTER_OPERATOR_INC => array(\n\t\t\t\t\t\t'name' => 'Inc',\n\t\t\t\t\t\t'type' => '1'\n\t\t\t\t),\n\t\t\t\tself::SETTER_OPERATOR_DEC => array(\n\t\t\t\t\t\t'name' => 'Dec',\n\t\t\t\t\t\t'type' => '1'\n\t\t\t\t)\n\t\t);\n\t}", "public function valuesBulk(array $valuesSet);" ]
[ "0.629372", "0.61953604", "0.5948094", "0.58841115", "0.58242047", "0.5322793", "0.5286243", "0.5251722", "0.5226994", "0.51908964", "0.51577383", "0.51560616", "0.5134005", "0.5114171", "0.5071105", "0.5047958", "0.5032721", "0.50275105", "0.5015632", "0.5015632", "0.50100064", "0.5006819", "0.4990804", "0.49300525", "0.49268436", "0.492676", "0.4924601", "0.49233082", "0.49224174", "0.49187845" ]
0.6796802
0
/ This function processes the SELECT section. It splits the clauses at the commas. Each clause is then processed by process_select_expr() and the results are added to the expression list. Finally, at the end, the epxression list is returned.
private function process_select($tokens) { $expression = ''; $expr = array(); foreach ($tokens as $token) { if (',' == $token) { $expr[] = $this->process_select_expr(trim($expression)); $expression = ''; } else { if ('' === $token || false === $token) { $token = ' '; } $expression .= $token; } } if ($expression) { $expr[] = $this->process_select_expr(trim($expression)); } return $expr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function select () {\n $fieldName = $this->expectGetValue(SQLToken::TOK_STR);\n $this->_selectList[] = $fieldName;\n if ($this->_debug) {\n echo 'select: ' . $fieldName . \"\\n\";\n }\n\n while ($this->accept(SQLToken::TOK_COMMA)) {\n $fieldName = $this->expectGetValue(SQLToken::TOK_STR);\n $this->_selectList[] = $fieldName;\n if ($this->_debug) {\n echo 'select: ' . $fieldName . \"\\n\";\n }\n }\n }", "private function process_select_expr($expression)\n {\n $capture = false;\n $alias = '';\n $base_expression = $expression;\n $upper = trim(strtoupper($expression));\n //if necessary, unpack the expression\n if ('(' == $upper[0]) {\n //$expression = substr($expression,1,-1);\n $base_expression = $expression;\n }\n\n $tokens = $this->split_sql($expression);\n $token_count = count($tokens);\n\n /* Determine if there is an explicit alias after the AS clause.\n If AS is found, then the next non-whitespace token is captured as the alias.\n The tokens after (and including) the AS are removed.\n */\n $base_expr = '';\n $stripped = array();\n $capture = false;\n $alias = '';\n $processed = false;\n for ($i = 0; $i < $token_count; ++$i) {\n $token = strtoupper($tokens[$i]);\n if (trim($token)) {\n $stripped[] = $tokens[$i];\n }\n\n if ('AS' == $token) {\n unset($tokens[$i]);\n $capture = true;\n continue;\n }\n\n if ($capture) {\n if (trim($token)) {\n $alias .= $tokens[$i];\n }\n unset($tokens[$i]);\n continue;\n }\n $base_expr .= $tokens[$i];\n }\n\n $stripped = $this->process_expr_list($stripped);\n $last = array_pop($stripped);\n if (!$alias && 'colref' == $last['expr_type']) {\n $prev = array_pop($stripped);\n if ('operator' == $prev['expr_type'] || 'const' == $prev['expr_type'] || 'function' == $prev['expr_type'] || 'expression' == $prev['expr_type'] || //$prev['expr_type'] == 'aggregate_function' ||\n 'subquery' == $prev['expr_type'] || 'colref' == $prev['expr_type']\n ) {\n $alias = $last['base_expr'];\n\n //remove the last token\n array_pop($tokens);\n\n $base_expr = implode('', $tokens);\n }\n }\n\n if (!$alias) {\n $base_expr = implode('', $tokens);\n $alias = $base_expr;\n }\n\n /* Properly escape the alias if it is not escaped */\n if ('`' != $alias[0]) {\n $alias = '`'.str_replace('`', '``', $alias).'`';\n }\n $processed = false;\n $type = 'expression';\n\n if ('(' == substr(trim($base_expr), 0, 1)) {\n $base_expr = substr($expression, 1, -1);\n if (preg_match('/^sel/i', $base_expr)) {\n $type = 'subquery';\n $processed = $this->parse($base_expr);\n }\n }\n if (!$processed) {\n $processed = $this->process_expr_list($tokens);\n }\n\n if (1 == count($processed)) {\n $type = $processed[0]['expr_type'];\n $processed = false;\n }\n\n return array('expr_type' => $type, 'alias' => $alias, 'base_expr' => $base_expr, 'sub_tree' => $processed);\n }", "protected function compileSelectQuery()\n {\n $select_part = '*';\n $from_part = '';\n $where_part = '';\n $join_part = '';\n $distinct = '';\n $group_by_part = '';\n $order_by_part = '';\n $having_part = '';\n\n // if there aren't any selected fields, add them all\n if (empty($this->sugar_query->select->select) && $this->sugar_query->select->getCountQuery() === false) {\n $this->sugar_query->select('*');\n }\n\n if (!empty($this->sugar_query->from)) {\n $from_part = trim($this->compileFrom($this->sugar_query->from));\n }\n\n if (!empty($this->sugar_query->select)) {\n $select_part = trim(\n $this->compileSelect($this->sugar_query->select)\n );\n }\n if (!empty($this->sugar_query->where)) {\n $this->sugar_query->startData('where');\n $where_part = trim($this->compileWhere($this->sugar_query->where));\n $this->sugar_query->endData();\n }\n\n if ($this->sugar_query->distinct) {\n $distinct = 'DISTINCT';\n }\n\n if (!empty($this->sugar_query->group_by)) {\n $group_by_part = $this->compileGroupBy($this->sugar_query->group_by);\n }\n\n if (!empty($this->sugar_query->having)) {\n $this->sugar_query->startData('having');\n $having_part = $this->compileHaving($this->sugar_query->having);\n $this->sugar_query->endData();\n }\n\n if (!empty($this->sugar_query->order_by)) {\n $order_by_part = $this->compileOrderBy($this->sugar_query->order_by);\n }\n\n if (!empty($this->sugar_query->join)) {\n $this->sugar_query->startData('join');\n $join_part = trim($this->compileJoin($this->sugar_query->join));\n $this->sugar_query->endData();\n }\n\n $data = array();\n $sql = \"SELECT {$distinct} {$select_part} FROM {$from_part}\";\n if (!empty($join_part)) {\n $sql .= \" {$join_part} \";\n $data = array_merge($data, $this->sugar_query->getData('join'));\n }\n if (!empty($where_part)) {\n $sql .= \" WHERE {$where_part} \";\n $data = array_merge($data, $this->sugar_query->getData('where'));\n }\n if (!empty($group_by_part)) {\n $sql .= \" GROUP BY {$group_by_part} \";\n }\n if (!empty($having_part)) {\n $sql .= \" HAVING {$having_part} \";\n $data = array_merge($data, $this->sugar_query->getData('having'));\n }\n if (!empty($order_by_part)) {\n $sql .= \" ORDER BY {$order_by_part} \";\n }\n if (!empty($this->sugar_query->limit) && $this->sugar_query->select->getCountQuery() === false) {\n $sql = $this->db->limitQuery($sql, $this->sugar_query->offset, $this->sugar_query->limit, false, '', false);\n }\n $this->sugar_query->data = $data;\n\n return trim($sql);\n }", "private function toLexemesSelect(): array\n {\n // Lexemes\n $lexemes = [\"SELECT\"];\n\n // if there are no manipulate_columns, throw an exception\n if (empty($this->manipulate_columns)) {\n throw new \\Exception(\"No columns to retrieve\");\n }\n\n // Then with the columns to retrieve\n foreach ($this->manipulate_columns as $index => $column) {\n $column_attributes = $this->table_columns[$column] ?? [];\n\n // Check for special attributes\n if (array_search(\"hex\", $column_attributes) !== false) {\n $lexemes[] = \"HEX(\";\n $lexemes[] = $column;\n $lexemes[] = \") as \";\n $lexemes[] = $column;\n } else if (array_search(\"timestamp\", $column_attributes) !== false) {\n $lexemes[] = \"UNIX_TIMESTAMP(\";\n $lexemes[] = $column;\n $lexemes[] = \") as \";\n $lexemes[] = $column;\n } else {\n $lexemes[] = $column;\n }\n\n // If we're not finished, insert a comma\n if ($index !== count($this->manipulate_columns) - 1) {\n $lexemes[] = \",\";\n }\n }\n\n // Now the table\n $lexemes[] = \"FROM\";\n $lexemes[] = $this->table;\n\n // Now the where clause\n if (!empty($this->where) && !empty($this->where->operands)) {\n $lexemes[] = \"WHERE\";\n $lexemes[] = $this->where->toSQL();\n }\n\n // Now the order by clause\n if (!empty($this->orderby)) {\n $lexemes[] = \"ORDER BY\";\n foreach ($this->orderby as $key => $order) {\n $lexemes[] = $key;\n $lexemes[] = $order;\n $keys = array_keys($this->orderby);\n if ($key !== end($keys)) {\n $lexemes[] = \",\";\n }\n }\n }\n\n // Now the limit clause\n if (!empty($this->limit_value)) {\n $lexemes[] = \"LIMIT\";\n $lexemes[] = (string)$this->limit_value;\n }\n\n // Now the offset clause (ALWAYS JUST AFTER LIMIT)\n if (!empty($this->offset) && $this->offset !== 0) {\n $lexemes[] = \"OFFSET\";\n $lexemes[] = (string)$this->offset;\n }\n\n\n // Return\n return $lexemes;\n }", "private function process_expr_list($tokens)\n {\n $expr = '';\n $type = '';\n $prev_token = '';\n $skip_next = false;\n $sub_expr = '';\n\n $in_lists = array();\n foreach ($tokens as $key => $token) {\n if (0 == strlen(trim($token))) {\n continue;\n }\n if ($skip_next) {\n $skip_next = false;\n continue;\n }\n\n $processed = false;\n $upper = strtoupper(trim($token));\n if (trim($token)) {\n $token = trim($token);\n }\n\n /* is it a subquery?*/\n if (preg_match('/^\\\\s*\\\\(\\\\s*SELECT/i', $token)) {\n $type = 'subquery';\n //tokenize and parse the subquery.\n //we remove the enclosing parenthesis for the tokenizer\n $processed = $this->parse(trim($token, ' ()'));\n /* is it an inlist */\n } elseif ('(' == $upper[0] && ')' == substr($upper, -1)) {\n if ('IN' == $prev_token) {\n $type = 'in-list';\n $processed = $this->split_sql(substr($token, 1, -1));\n $list = array();\n foreach ($processed as $v) {\n if (',' == $v) {\n continue;\n }\n $list[] = $v;\n }\n $processed = $list;\n unset($list);\n $prev_token = '';\n } elseif ('AGAINST' == $prev_token) {\n $type = 'match-arguments';\n $list = $this->split_sql(substr($token, 1, -1));\n if (count($list) > 1) {\n $match_mode = implode('', array_slice($list, 1));\n $processed = array($list[0], $match_mode);\n } else {\n $processed = $list[0];\n }\n $prev_token = '';\n }\n /* it is either an operator, a colref or a constant */\n } else {\n switch ($upper) {\n case 'AND':\n case '&&':\n case 'BETWEEN':\n case 'BINARY':\n case '&':\n case '~':\n case '|':\n case '^':\n case 'CASE':\n case 'WHEN':\n case 'END':\n case 'DIV':\n case '/':\n case '<=>':\n case '=':\n case '>=':\n case '>':\n case 'IS':\n case 'NOT':\n case 'NULL':\n case '<<':\n case '<=':\n case '<':\n case 'LIKE':\n case '-':\n case '%':\n case '!=':\n case '<>':\n case 'REGEXP':\n case '!':\n case '||':\n case 'OR':\n case '+':\n case '>>':\n case 'RLIKE':\n case 'SOUNDS':\n case '*':\n case 'XOR':\n case 'IN':\n $processed = false;\n $type = 'operator';\n break;\n default:\n switch ($token[0]) {\n case \"'\":\n case '\"':\n $type = 'const';\n break;\n case '`':\n $type = 'colref';\n break;\n\n default:\n if (is_numeric($token)) {\n $type = 'const';\n } else {\n $type = 'colref';\n }\n break;\n }\n //$processed = $token;\n $processed = false;\n }\n }\n /* is a reserved word? */\n if (('operator' != $type && 'in-list' != $type && 'sub_expr' != $type) && in_array($upper, $this->reserved)) {\n $token = $upper;\n if (!in_array($upper, $this->functions)) {\n $type = 'reserved';\n } else {\n switch ($token) {\n case 'AVG':\n case 'SUM':\n case 'COUNT':\n case 'MIN':\n case 'MAX':\n case 'STDDEV':\n case 'STDDEV_SAMP':\n case 'STDDEV_POP':\n case 'VARIANCE':\n case 'VAR_SAMP':\n case 'VAR_POP':\n case 'GROUP_CONCAT':\n case 'BIT_AND':\n case 'BIT_OR':\n case 'BIT_XOR':\n $type = 'aggregate_function';\n if (!empty($tokens[$key + 1])) {\n $sub_expr = $tokens[$key + 1];\n }\n //$skip_next=true;\n break;\n\n default:\n $type = 'function';\n if (!empty($tokens[$key + 1])) {\n $sub_expr = $tokens[$key + 1];\n } else {\n $sub_expr = '()';\n }\n //$skip_next=true;\n\n break;\n }\n }\n }\n\n if (!$type) {\n if ('(' == $upper[0]) {\n $local_expr = substr(trim($token), 1, -1);\n } else {\n $local_expr = $token;\n }\n $processed = $this->process_expr_list($this->split_sql($local_expr));\n $type = 'expression';\n\n if (1 == count($processed)) {\n $type = $processed[0]['expr_type'];\n $base_expr = $processed[0]['base_expr'];\n $processed = $processed[0]['sub_tree'];\n }\n }\n\n $sub_expr = trim($sub_expr);\n $sub_expr = '';\n\n $expr[] = array('expr_type' => $type, 'base_expr' => $token, 'sub_tree' => $processed);\n $prev_token = $upper;\n $expr_type = '';\n $type = '';\n }\n if ($sub_expr) {\n $processed['sub_tree'] = $this->process_expr_list($this->split_sql(substr($sub_expr, 1, -1)));\n }\n\n if (!is_array($processed)) {\n print_r($processed);\n $processed = false;\n }\n\n if ($expr_type) {\n $expr[] = array('expr_type' => $type, 'base_expr' => $token, 'sub_tree' => $processed);\n }\n $mod = false;\n\n /*\n\n for($i=0;$i<count($expr);++$i){\n if($expr[$i]['expr_type'] == 'function' ||\n $expr[$i]['expr_type'] == 'aggregate_function') {\n if(!empty($expr[$i+1])) {\n $expr[$i]['sub_tree']=$expr[$i+1]['sub_tree'];\n unset($expr[$i+1]);\n $mod = 1;\n ++$i; // BAD FORM TO MODIFY THE LOOP COUNTER\n }\n }\n\n }\n\n */\n\n if ($mod) {\n $expr = array_values($expr);\n }\n\n return $expr;\n }", "function map_select_process($t, $xml_slice) {\n //global $select_clause_criterion;\n global $select_clause_quote_criterion;\n global $select_clause_quote_condition;\n global $select_clause_func_criterion;\n global $select_clause_func_condition;\n global $select_clause_parc_criterion;\n global $select_clause_parc_condition;\n\n $xpath = new DOMXPath($xml_slice);\n\n $select_crt = $select_clause_quote_criterion[0];\n $select_crt_xpath = \"//criterion[@id='$select_crt']\";\n $select_crt_check = $xpath->query($select_crt_xpath);\n $select_check = $select_crt_check->length;\n if($select_check == 0) {\n\t// out xml slice doesn't have Select clause class\n\treturn false;\n } else {\n\t$quote = $t->process->quote;\n\t$func = $t->process->func;\n\t$parc = $t->process->parc;\n\tif(is_bool($quote)) {\n\t $quote = conv_bool_to_str($quote);\n\t}\n\tif(is_bool($func)) {\n\t $func = conv_bool_to_str($func);\n\t}\n\tif(is_int($parc)) {\n\t $parc = strval($parc);\n\t}\n\n\t$select_quote_cond = $select_clause_quote_condition[$quote];\n\t$select_func_cond = $select_clause_func_condition[$func];\n\t$select_parc_cond = $select_clause_parc_condition[$parc];\n\n\t$select_quote_crt = $select_clause_quote_criterion[0];\n\t$select_func_crt = $select_clause_func_criterion[0];\n\t$select_parc_crt = $select_clause_parc_criterion[0];\n\n\t$select_quote_xpath = \"//criterion[@id='$select_quote_crt']/condition[@value='$select_quote_cond']\";\n\t$select_func_xpath = \"//criterion[@id='$select_func_crt']/condition[@value='$select_func_cond']\";\n\t$select_parc_xpath = \"//criterion[@id='$select_parc_crt']/condition[@value='$select_parc_cond']\";\n\n\t$select_quote_check = $xpath->query($select_quote_xpath);\n\t$select_func_check = $xpath->query($select_func_xpath);\n\t$select_parc_check = $xpath->query($select_parc_xpath);\n\n\t$quote_check = $select_quote_check->length;\n\t$func_check = $select_func_check->length;\n\t$parc_check = $select_parc_check->length;\n\n\t/*\n\techo $quote .\"\\n\";\n\techo $func .\"\\n\";\n\techo $parc .\"\\n\\n\";\n\n\techo $select_quote_xpath .\"\\n\";\n\techo $select_func_xpath .\"\\n\";\n\techo $select_parc_xpath .\"\\n\\n\";\n\n\techo $quote_check .\"\\n\";\n\techo $func_check .\"\\n\";\n\techo $parc_check .\"\\n\";\n\t*/\n\n\tif($quote_check > 1 || $func_check > 1 || $parc_check > 1) {\n\t die(\"wrong xml or mapping select function\");\n\t} else if($quote_check == 1 && $func_check == 1 && $parc_check == 1) {\n\t return true;\n\t} else {\n\t return false;\n\t}\n }\n}", "function parseSelect(&$sqlBuilder, $selectString) {\n\n\t// If something matches the pattern /whitespace,KEYWORD,whitespace/ where keyword is in UPPER CASE, \n\t// and it exists in the $selectOpions array,then is should be handled as a MySQL keyword.\n\t$options = findKeywords($selectString, sqlSelect::$selectOptions, function($e) {return '\\s' . $e . '\\s';});\n\t$options = array_map('trim', $options);\n\t$sqlBuilder->select = array_merge($sqlBuilder->select, array('options' => $options));\n\t\n\t$parts = str_replace($options, '', $selectString);\n\t$columnParts = explode(',', $parts);\n\t// (?:) is a non-capturing group. The syntax says that AS is optional. \n\t// whitespace (columnname) (AS) (aliasname) whitespace\n\t// columnname and aliasname could be `here be dragons` or $total.\n\t// Really it should be separated by whitespace or the backtick, if present.\n\t// For now, we use an mandatory AS. \n\t// $regex1 = /(\\S+)\\s+(?:AS\\s)?(\\S+)/ // with whitespace separated\n\t// $regex2 = /`([^`]+)`\\s+(?:AS\\s)?`([^`]+)`/ // with back-tick separated\n\t// $columnPart = \"(`(?:[^`]+)`|(?:\\S+))\";\n\t// $aliasPart = $columnPart;\n\t// $optionalAliasKeyword = (?:AS\\s)?\n\t// Combined? : \"/\" . $columnPart . \"\\s+\" . $optionalAliasKeyword. \"\\s*\" . $aliasPart . \"/\";\n\tforeach ($columnParts as $columnPart) {\n\t\t$t = explode(' AS ', $columnPart);\n\t\t# If there is no alias, just assign a number to it.\n\t\tif (isset($t[1])) {\n\t\t\t$alias = trim($t[1]);\n\t\t\t$columns[$alias] = trim($t[0]);\n\t\t} else {\n\t\t\t$columns[] = trim($t[0]);\n\t\t}\n\t}\n\t$sqlBuilder->select = array_merge($sqlBuilder->select, array('columns' => $columns));\n}", "protected function parseSelect()\r\n {\r\n $this->_fastForward();\r\n $curLow = strtolower(current($this->tokens));\r\n prev($this->tokens);\r\n if ($curLow == 'distinct') {\r\n $this->query->setResultForm('select distinct');\r\n } else {\r\n $this->query->setResultForm('select');\r\n }\r\n\r\n $currentVar = null;\r\n $currentFunc = null;\r\n $bWaitForRenaming = false;\r\n while ($curLow != 'from' && $curLow != 'where' &&\r\n $curLow != \"{\"\r\n ){\r\n $this->_fastForward();\r\n $curTok = current($this->tokens);\r\n $curLow = strtolower($curTok);\r\n\r\n if ($this->varCheck($curTok) || $curLow == '*') {\r\n if ($bWaitForRenaming) {\r\n $bWaitForRenaming = false;\r\n $currentVar->setAlias($curTok);\r\n if ($currentFunc != null) {\r\n $currentVar->setFunc($currentFunc);\r\n }\r\n $this->query->addResultVar($currentVar);\r\n $currentVar = null;\r\n } else {\r\n if ($currentVar != null) {\r\n $this->query->addResultVar($currentVar);\r\n $currentVar = null;\r\n }\r\n $currentVar = new Query_ResultVariable($curTok);\r\n if ($currentFunc != null) {\r\n $currentVar->setFunc($currentFunc);\r\n }\r\n }\r\n $currentFunc = null;\r\n } else if ($curLow == 'as') {\r\n if ($currentVar === null) {\r\n throw new SparqlParserException(\r\n 'AS requires a variable left and right',\r\n null,\r\n key($this->tokens)\r\n );\r\n }\r\n $bWaitForRenaming = true;\r\n } else if (in_array($curLow, self::$sops)) {\r\n $currentFunc = $curLow;\r\n }\r\n\r\n if (!current($this->tokens)) {\r\n throw new SparqlParserException(\r\n \"Unexpected end of File.\",\r\n null,\r\n key($this->tokens)\r\n );\r\n }\r\n }\r\n\r\n if ($currentVar != null) {\r\n $this->query->addResultVar($currentVar);\r\n }\r\n prev($this->tokens);\r\n\r\n if (count($this->query->getResultVars()) == 0) {\r\n throw new SparqlParserException(\r\n \"Variable or '*' expected.\",\r\n null,\r\n key($this->tokens)\r\n );\r\n }\r\n }", "public function exec_SELECTquery($select_fields, $from_table, $where_clause, $groupBy = '', $orderBy = '', $limit = '');", "private function buildSelect(): void {\r\n\r\n $this -> query[] = 'SELECT';\r\n $this -> buildDistinct();\r\n\r\n if(0 === count($this -> select)) {\r\n $this -> query[] = '*';\r\n }\r\n else {\r\n\r\n foreach($this -> select as &$select) {\r\n\r\n if($select instanceof self) {\r\n\r\n $sql = $select -> build();\r\n $this -> bind($sql -> getParameters());\r\n $select = $sql -> getQuery();\r\n }\r\n }\r\n\r\n $this -> query[] = implode(', ', $this -> select);\r\n }\r\n }", "protected function evaluateSelect( Select $select )\r\n {\r\n // pueden haber agregaciones y funciones.\r\n $projections = $select->getAll();\r\n if (count($projections) == 0) return \"SELECT *\";\r\n else\r\n {\r\n $res = \"SELECT \";\r\n foreach ($projections as $proj)\r\n {\r\n // FIXME: la aggregation puede ser una evaluacion\r\n // recursiva porque param es SelectItem y\r\n // puede ser que tenga una agg adentro, asi sucesivamente.\r\n if ($proj instanceof SelectAttribute)\r\n $res .= $proj->getAlias() . \".\" . $proj->getAttrName() . \", \"; // Projection\r\n else if ($proj instanceof SelectAggregation)\r\n $res .= $proj->getName() . \"(\". $proj->getParam()->getAlias() . \".\" . $proj->getParam()->getAttrName() .\"), \";\r\n }\r\n return substr($res, 0, -2); // Saca ultimo \"; \"\r\n }\r\n }", "private function selectFields()\n {\n collect($this->request->get('fields', []))->each(function($expression, $key) {\n $fields = explode(',', $expression);\n $this->builder->select($fields);\n });\n }", "public function SELECTquery($select_fields, $from_table, $where_clause, $groupBy = '', $orderBy = '', $limit = '');", "public function compile_query_select(GlueDB_Fragment_Query_Select $fragment) {\n\t\t// Get data from fragment :\n\t\t$selectsql\t= $fragment->get()->sql($this);\n\t\t$fromsql\t= $fragment->from()->sql($this);\n\t\t$wheresql\t= $fragment->where()->sql($this);\n\t\t$groupbysql\t= $fragment->groupby()->sql($this);\n\t\t$havingsql\t= $fragment->having()->sql($this);\n\t\t$orderbysql\t= $fragment->orderby()->sql($this);\n\t\t$limit\t\t= $fragment->limit();\n\t\t$offset\t\t= $fragment->offset();\n\n\t\t// Mandatory :\n\t\t$sql = 'SELECT ' . (empty($selectsql) ? '*' : $selectsql) . ' FROM ' . $fromsql;\n\n\t\t// Optional :\n\t\tif ( ! empty($wheresql))\t$sql .= ' WHERE '\t\t. $wheresql;\n\t\tif ( ! empty($groupbysql))\t$sql .= ' GROUP BY '\t. $groupbysql;\n\t\tif ( ! empty($havingsql))\t$sql .= ' HAVING '\t\t. $havingsql;\n\t\tif ( ! empty($orderbysql))\t$sql .= ' ORDER BY '\t. $orderbysql;\n\t\tif ( isset($limit))\t\t$sql .= ' LIMIT '\t\t. $limit;\n\t\tif ( isset($offset))\t\t$sql .= ' OFFSET '\t\t. $offset;\n\n\t\treturn $sql;\n\t}", "function fetchList($select,$where = \"\",$order = \"\",$values = null){\n //if( ! is_object($this)) {\n // $this->print_pre(debug_backtrace(),\"fetchList: debug_backtrace\");\n //}\n \n $qstr = \"select $select\";\n if( $where != \"\" ) $qstr .= \" where $where\";\n if( $order != \"\" ) $qstr .= \" order by $order\";\n \n //print \"fetchVal: qstr: $qstr<br>\\n\";\n if( ($result = $this->query(\"$qstr\",$values)) === false) {\n print \"query: $qstr failed, possibly db init error<br />\\n\";\n return array();\n }\n //$this->print_pre($result,\"dbh\");\n $r = $result->fetchAll(PDO::FETCH_COLUMN);\n //$this->print_pre($r,\"result fetchAll\");\n //$this->print_pre($dbh,\"dbh\");\n return $r;\n }", "protected function _build_select() {\n // If the query is raw, just set the $this->_values to be\n // the raw query parameters and return the raw query\n if ($this->_is_raw_query) {\n $this->_values = $this->_raw_parameters;\n return $this->_raw_query;\n }\n\n // Build and return the full SELECT statement by concatenating\n // the results of calling each separate builder method.\n return $this->_join_if_not_empty(\" \", array(\n $this->_build_select_start(),\n $this->_build_join(),\n $this->_build_where(),\n $this->_build_group_by(),\n $this->_build_order_by(),\n $this->_build_limit(),\n $this->_build_offset(),\n ));\n }", "protected function _build_select() {\n\t\t// If the query is raw, just set the $this->_values to be\n\t\t// the raw query parameters and return the raw query\n\t\tif ( $this->_is_raw_query ) {\n\t\t\t$this->_values = $this->_raw_parameters;\n\n\t\t\treturn $this->_raw_query;\n\t\t}\n\t\t// Build and return the full SELECT statement by concatenating\n\t\t// the results of calling each separate builder method.\n\t\treturn $this->_join_if_not_empty( ' ', [\n\t\t\t$this->_build_select_start(),\n\t\t\t$this->_build_join(),\n\t\t\t$this->_build_where(),\n\t\t\t$this->_build_group_by(),\n\t\t\t$this->_build_having(),\n\t\t\t$this->_build_order_by(),\n\t\t\t$this->_build_limit(),\n\t\t\t$this->_build_offset(),\n\t\t] );\n\t}", "function build_select_query($table, $fields, $where_clause, $order_clause, $limit)\n {\n $query = \"select\\n\";\n\n $query .= implode(\", \", $fields) . \"\\n\";\n\n $query .= \"from \" . $table . \"\\n\";\n\n if (!empty($where_clause)) {\n $query .= $where_clause . \"\\n\";\n }\n\n if (!empty($where_clause)) {\n $query .= $order_clause . \"\\n\";\n }\n\n if (!empty($limit) && is_numeric($limit)) {\n $query .= \"limit \" . $limit . \"\\n\";\n }\n\n return $query;\n }", "public function select_many_expr() {\n\t\t$columns = \\func_get_args();\n\t\tif ( ! empty( $columns ) ) {\n\t\t\t$columns = $this->_normalise_select_many_columns( $columns );\n\t\t\tforeach ( $columns as $alias => $column ) {\n\t\t\t\tif ( \\is_numeric( $alias ) ) {\n\t\t\t\t\t$alias = null;\n\t\t\t\t}\n\t\t\t\t$this->select_expr( $column, $alias );\n\t\t\t}\n\t\t}\n\n\t\treturn $this;\n\t}", "private function prepare_select_query()\n {\n $select = \"*\";\n if(count($this->select_array) > 0) {\n $select = implode(\" , \", $this->select_array);\n }\n return $select;\n }", "protected function compileSelect(SugarQuery_Builder_Select $selectObj)\n {\n $return = array();\n $addedFields = array();\n\n if ($selectObj->getCountQuery() === true) {\n $return['count(0) AS record_count'] = 'count(0) AS record_count';\n }\n\n foreach ($selectObj->select as $field) {\n if ($field->isNonDb()) {\n continue;\n }\n $compiledField = $this->compileField($field);\n $return[$compiledField] = $compiledField;\n\n if ($selectObj->getCountQuery() === true) {\n $this->sugar_query->groupBy(\"{$field->table}.{$field->field}\");\n }\n }\n\n return implode(\", \", $return);\n\n }", "private function split_sql($sql)\n {\n if (!is_string($sql)) {\n echo \"SQL:\\n\";\n print_r($sql);\n exit;\n }\n\n $sql = str_replace(array('\\\\\\'', '\\\\\"', \"\\r\\n\", \"\\n\", '()'), array(\"''\", '\"\"', ' ', ' ', ' '), $sql);\n $regex = <<<EOREGEX\n/(`(?:[^`]|``)`|[@A-Za-z0-9_.`-]+(?:\\(\\s*\\)){0,1})\n|(\\+|-|\\*|\\/|!=|>=|<=|<>|>|<|&&|\\|\\||=|\\^)\n|(\\(.*?\\)) # Match FUNCTION(...) OR BAREWORDS\n|('(?:[^']|'')*'+)\n|(\"(?:[^\"]|\"\")*\"+)\n|([^ ,]+)\n/ix\nEOREGEX;\n\n $tokens = preg_split($regex, $sql, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);\n $token_count = count($tokens);\n\n /* The above regex has one problem, because the parenthetical match is not greedy.\n Thus, when matching grouped expresions such as ( (a and b) or c) the\n tokenizer will produce \"( (a and b)\", \" \", \"or\", \" \" , \"c,\")\"\n\n This block detects the number of open/close parens in the given token. If the parens are balanced\n (balanced == 0) then we don't need to do anything.\n\n otherwise, we need to balance the expression.\n */\n $reset = false;\n for ($i = 0; $i < $token_count; ++$i) {\n if (empty($tokens[$i])) {\n continue;\n }\n\n $token = $tokens[$i];\n $trim = trim($token);\n if ($trim) {\n if ('(' != $trim[0] && ')' == substr($trim, -1)) {\n $trim = trim(substr($trim, 0, strpos($trim, '(')));\n }\n $tokens[$i] = $trim;\n $token = $trim;\n }\n\n if ($token && '(' == $token[0]) {\n $info = $this->count_paren($token);\n if (0 == $info['balanced']) {\n continue;\n }\n\n //we need to find this many closing parens\n $needed = abs($info['balanced']);\n $n = $i;\n while ($needed > 0 && $n < $token_count - 1) {\n ++$n;\n //echo \"LOOKING FORWARD TO $n [ \" . $tokens[$n] . \"]\\n\";\n $token2 = $tokens[$n];\n $info2 = $this->count_paren($token2);\n $closes = count($info2['close']);\n if ($closes != $needed) {\n $tokens[$i] .= $tokens[$n];\n unset($tokens[$n]);\n $reset = true;\n $info2 = $this->count_paren($tokens[$i]);\n $needed = abs($info2['balanced']);\n //\techo \"CLOSES LESS THAN NEEDED (still need $needed)\\n\";\n } else {\n /*get the string pos of the last close paren we need*/\n $pos = $info2['close'][count($info2['close']) - 1];\n $str1 = $str2 = '';\n if (0 == $pos) {\n $str1 = ')';\n } else {\n $str1 = substr($tokens[$n], 0, $pos).')';\n $str2 = substr($tokens[$n], $pos + 1);\n }\n //echo \"CLOSES FOUND AT $n, offset:$pos [$str1] [$str2]\\n\";\n if (strlen($str2) > 0) {\n $tokens[$n] = $str2;\n } else {\n unset($tokens[$n]);\n $reset = true;\n }\n $tokens[$i] .= $str1;\n $info2 = $this->count_paren($tokens[$i]);\n $needed = abs($info2['balanced']);\n }\n }\n }\n }\n\n //the same problem appears with backticks :(\n\n /* reset the array if we deleted any tokens above */\n if ($reset) {\n $tokens = array_values($tokens);\n }\n\n $token_count = count($tokens);\n for ($i = 0; $i < $token_count; ++$i) {\n if (empty($tokens[$i])) {\n continue;\n }\n $token = $tokens[$i];\n $needed = true;\n $reset = false;\n if ($needed && $token && false !== strpos($token, '`')) {\n $info = $this->count_backtick($token);\n if (0 == $info % 2) { //even number of backticks means we are balanced\n continue;\n }\n $needed = 1;\n\n $n = $i;\n while ($needed && $n < $token_count - 1) {\n $reset = true;\n //echo \"BACKTICK COUNT[$i]: $info old: {$tokens[$i]}, new: ($token)\\n\";\n ++$n;\n $token .= $tokens[$n];\n unset($tokens[$n]);\n $needed = $this->count_backtick($token) % 2;\n }\n }\n if ($reset) {\n $tokens[$i] = $token;\n }\n }\n /* reset the array if we deleted any tokens above */\n $tokens = array_values($tokens);\n\n return $tokens;\n }", "protected function compilePartSelect(): string\n {\n $columns = $this->query['columns'];\n empty($columns) && $columns = ['*'];\n $columns = array_map(callback: [$this, 'quoteIdentifier'], array: $columns);\n return 'SELECT' . ($this->query['distinct'] === true ? ' DISTINCT ' : ' ') . trim(string: implode(separator: ', ', array: $columns));\n }", "public function compileSelect(): string\n {\n $sql = $this->compilePartSelect();\n $sql .= $this->compilePartFrom();\n $sql .= $this->compilePartJoin();\n $sql .= $this->compilePartWhere();\n $sql .= $this->compilePartGroupBy();\n $sql .= $this->compilePartHaving();\n $sql .= $this->compilePartOrderBy();\n $sql .= $this->compilePartLimitOffset();\n return $sql;\n }", "public static function parse($expression, $limit = PHP_INT_MAX, $delimiter = '__comma__')\n {\n $expression = preg_replace_callback('/\\'(.*?)\\'|\"(.*?)\"/', function ($matches) use ($delimiter) {\n return str_replace(',', $delimiter, $matches[0]);\n }, $expression);\n\n return collect(explode(',', $expression, $limit))\n ->map(function ($item) use ($delimiter) {\n $item = str_replace($delimiter, ',', $item);\n $item = trim($item);\n\n if (is_numeric($item)) {\n return (int) $item;\n }\n\n return $item;\n });\n }", "public function selectComplex($select, $logic='AND')\n\t{\n\t\t$found = false;\n\t\t$logic = (strtoupper($logic) == 'OR') ? '||' : '&&';\n\t\t$tmpData = array();\n\t\t\n\t\t// Generate string to be evaluated\n\t\t$evalString = '$found = ';\n\t\tforeach($select as $key=>$val)\n\t\t\t$evalString .= '$data[\"' . $key . '\"] == \"' . $val . '\" ' . $logic . ' ';\n\t\t$evalString = substr($evalString, 0, strlen($evalString)-4);\n\t\t$evalString .= ';';\n\t\t\n\t\tforeach($this->data as $data)\n\t\t{\n\t\t\teval($evalString);\n\t\t\tif($found)\n\t\t\t{\n\t\t\t\t$tmpData[] = $data;\n\t\t\t\t$found = false;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $tmpData;\n\t}", "public function select()\n\t{\n\t\tif(empty($this->query->limit))\n\t\t{\n\t\t\t// No limit so we can just execute a normal query\n\n\t\t\treturn parent::select();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// There is a limit so we need to emulate the LIMIT/OFFSET clause with ANSI-SQL\n\n\t\t\t$order = trim($this->orderings($this->query->orderings));\n\n\t\t\tif(empty($order))\n\t\t\t{\n\t\t\t\t$order = 'ORDER BY (SELECT 0)';\n\t\t\t}\n\n\t\t\t$sql = $this->query->distinct ? 'SELECT DISTINCT ' : 'SELECT ';\n\t\t\t$sql .= $this->columns($this->query->columns);\n\t\t\t$sql .= ', ROW_NUMBER() OVER (' . $order . ') AS mako_rownum';\n\t\t\t$sql .= ' FROM ';\n\t\t\t$sql .= $this->wrap($this->query->table);\n\t\t\t$sql .= $this->joins($this->query->joins);\n\t\t\t$sql .= $this->wheres($this->query->wheres);\n\t\t\t$sql .= $this->groupings($this->query->groupings);\n\t\t\t$sql .= $this->havings($this->query->havings);\n\n\t\t\t$offset = empty($this->query->offset) ? 0 : $this->query->offset;\n\n\t\t\t$limit = $offset + $this->query->limit;\n\t\t\t$offset = $offset + 1;\n\n\t\t\t$sql = 'SELECT * FROM (' . $sql . ') AS m1 WHERE mako_rownum BETWEEN ' . $offset . ' AND ' . $limit;\n\n\t\t\treturn array('sql' => $sql, 'params' => $this->params);\n\t\t}\n\t}", "protected function processSelect(\\Zend_Db_Select $select)\n {\n // $select->joinLeft('gems__rounds', 'gto_id_round = gro_id_round', array());\n // $select->join('gems__tracks', 'gto_id_track = gtr_id_track', array());\n $select->join('gems__surveys', 'gto_id_survey = gsu_id_survey', array());\n $select->join('gems__groups', 'gsu_id_primary_group = ggp_id_group', array());\n $select->join('gems__respondents', 'gto_id_respondent = grs_id_user', array());\n $select->join('gems__respondent2track','gto_id_respondent_track = gr2t_id_respondent_track', array());\n $select->join('gems__reception_codes', 'gto_reception_code = grc_id_reception_code', array());\n }", "private function process_set_list($tokens)\n {\n $column = '';\n $expression = '';\n foreach ($tokens as $token) {\n $token = trim($token);\n if (!$column) {\n if (false === $token || empty($token)) {\n continue;\n }\n $column .= $token;\n continue;\n }\n\n if ('=' == $token) {\n continue;\n }\n\n if (',' == $token) {\n $expr[] = array('column' => trim($column), 'expr' => trim($expression));\n $expression = $column = '';\n continue;\n }\n\n $expression .= $token;\n }\n if ($expression) {\n $expr[] = array('column' => trim($column), 'expr' => trim($expression));\n }\n\n return $expr;\n }", "private function build_select_sql(){\r\n \r\n $select_sql = $join_sql = $where_sql = $having_sql = $group_by_sql = $order_by_sql = $limit_sql = '';\r\n\r\n if( sizeof( $this->select_arr ) > 0 ){\r\n $select_sql = \"SELECT \";\r\n foreach( $this->select_arr as $key => $value ){\r\n if( array_key_exists( $this->table, $this->join_arr ) AND $value === $this->id_field ){\r\n $key_table = $this->table.\".\";\r\n }else{\r\n $key_table = \"\";\r\n }\r\n\r\n if( is_int( $key) ){\r\n $select_sql .= $key_table.$value.\", \";\r\n }else{\r\n $select_sql .= $key_table.$value.\" AS \".$key.\", \";\r\n }\r\n }\r\n $select_sql = rtrim( $select_sql, \", \" );\r\n $select_sql .= \" FROM \".$this->table;\r\n }else{\r\n $select_sql = \"SELECT * FROM \".$this->table;\r\n }\r\n\r\n if( sizeof( $this->join_arr ) > 0 ){\r\n $join_sql = '';\r\n foreach( $this->join_arr as $table1 => $joining ){\r\n foreach( $joining as $table2 => $join ){\r\n if( strstr( $select_sql, \"FROM \".$table2 ) OR strstr( $join_sql, \"JOIN \".$table2 ) ){\r\n $join_sql .= ( ( array_key_exists( 'join_type', $join ) AND is_string( $join['join_type'] ) )?\" \".strtoupper( $join['join_type'] ):\"\" ).\" JOIN \".$table1;\r\n }else{\r\n $join_sql .= ( ( array_key_exists( 'join_type', $join ) AND is_string( $join['join_type'] ) )?\" \".strtoupper( $join['join_type'] ):\"\" ).\" JOIN \".$table2;\r\n }\r\n $foreign_key = ( array_key_exists( 'join_type', $join ) AND is_string( $join['foreign_key'] ) )?$join['foreign_key']:text::singular($table1).\"_id\";\r\n $join_sql .= \" ON \".$table2.\".\".$foreign_key.\" = \".$table1.\".\".text::singular($table1).\"_id \";\r\n }\r\n }\r\n }\r\n \r\n if( sizeof( $this->where_clause_arr['and'] ) > 0 OR sizeof( $this->where_clause_arr['or'] ) > 0 ){\r\n $where_sql .= \" WHERE \";\r\n \r\n if( sizeof( $this->where_clause_arr['or'] ) > 0 )\r\n {\r\n $this->where_clause_arr['and'] = array_merge( $this->where_clause_arr['and'], array( 'or' => $this->where_clause_arr['or'] ) );\r\n }\r\n unset( $this->where_clause_arr['or'] );\r\n\r\n $where_sql .= $this->append_clause( $this->where_clause_arr, $join_sql );\r\n }\r\n \r\n if( sizeof( $this->having_clause_arr['and'] ) > 0 OR sizeof( $this->having_clause_arr['or'] ) > 0 ){\r\n $having_sql .= \" HAVING \";\r\n\r\n if( sizeof( $this->having_clause_arr['or'] ) > 0 )\r\n {\r\n $this->having_clause_arr['and'] = array_merge( $this->having_clause_arr['and'], array( 'or' => $this->having_clause_arr['or'] ) );\r\n }\r\n unset( $this->having_clause_arr['or'] );\r\n\r\n $having_sql .= $this->append_clause( $this->having_clause_arr, $join_sql );\r\n }\r\n\r\n if( sizeof( $this->group_by_arr ) > 0 ){\r\n $group_by_sql .= \" GROUP BY \";\r\n foreach( $this->group_by_arr as $key => $value ){\r\n if( preg_match( '/(.*) JOIN ([A-Za-z0-9_]+) ON ([A-Za-z0-9_]+).'.preg_replace( '/([A-Za-z0-9]+)([<>=]+| IN)/i', '$1', $value ).' (.*)/i', $join_sql ) ){\r\n $group_table = preg_replace( '/(.*) JOIN ([A-Za-z0-9_]+) ON ([A-Za-z0-9_]+).'.preg_replace( '/([A-Za-z0-9]+)([<>=]+| IN)/i', '$1', $value ).' (.*)/i', '$2.', $join_sql );\r\n }else{\r\n $group_table = \"\";\r\n }\r\n\r\n $group_by_sql .= $group_table.$value.\", \";\r\n }\r\n $group_by_sql = rtrim( $group_by_sql, \", \" );\r\n }\r\n\r\n if( sizeof( $this->order_by_arr ) > 0 ){\r\n $order_by_sql .= \" ORDER BY \";\r\n foreach( $this->order_by_arr as $key => $value ){\r\n if( preg_match( '/(.*) JOIN ([A-Za-z0-9_]+) ON ([A-Za-z0-9_]+).'.preg_replace( '/([A-Za-z0-9]+)([<>=]+| IN)/i', '$1', $key ).' (.*)/i', $join_sql ) ){\r\n $order_table = preg_replace( '/(.*) JOIN ([A-Za-z0-9_]+) ON ([A-Za-z0-9_]+).'.preg_replace( '/([A-Za-z0-9]+)([<>=]+| IN)/i', '$1', $key ).' (.*)/i', '$2.', $join_sql );\r\n }else{\r\n $order_table = \"\";\r\n }\r\n\r\n if( empty( $value ) ){\r\n $order_by_sql .= $order_table.$key.\", \";\r\n }else{\r\n $order_by_sql .= $order_table.$key.\" \".$value.\", \";\r\n }\r\n }\r\n $order_by_sql = rtrim( $order_by_sql, \", \" );\r\n }\r\n\r\n if( array_key_exists( \"limit\", $this->limit_arr ) AND $this->limit_arr['limit'] !== FALSE ){\r\n $limit_sql .= \" LIMIT \".$this->limit_arr['limit'];\r\n\r\n if( array_key_exists( \"offset\", $this->limit_arr ) AND $this->limit_arr['offset'] !== FALSE ){\r\n $limit_sql .= \", \".$this->limit_arr['offset'];\r\n }\r\n }\r\n\r\n return $select_sql.$join_sql.$where_sql.$having_sql.$group_by_sql.$order_by_sql.$limit_sql;\r\n }" ]
[ "0.64671403", "0.62088823", "0.6082425", "0.5819197", "0.5799779", "0.5778229", "0.5725504", "0.56423074", "0.5591793", "0.5588744", "0.5392897", "0.53096724", "0.52755326", "0.52419156", "0.51179224", "0.509008", "0.50756466", "0.5033278", "0.49849248", "0.49453634", "0.49416918", "0.49174064", "0.49132308", "0.4892582", "0.48510313", "0.4850739", "0.48479262", "0.48449826", "0.48441643", "0.48315173" ]
0.6900171
0
/ This fuction processes each SELECT clause. We determine what (if any) alias is provided, and we set the type of expression.
private function process_select_expr($expression) { $capture = false; $alias = ''; $base_expression = $expression; $upper = trim(strtoupper($expression)); //if necessary, unpack the expression if ('(' == $upper[0]) { //$expression = substr($expression,1,-1); $base_expression = $expression; } $tokens = $this->split_sql($expression); $token_count = count($tokens); /* Determine if there is an explicit alias after the AS clause. If AS is found, then the next non-whitespace token is captured as the alias. The tokens after (and including) the AS are removed. */ $base_expr = ''; $stripped = array(); $capture = false; $alias = ''; $processed = false; for ($i = 0; $i < $token_count; ++$i) { $token = strtoupper($tokens[$i]); if (trim($token)) { $stripped[] = $tokens[$i]; } if ('AS' == $token) { unset($tokens[$i]); $capture = true; continue; } if ($capture) { if (trim($token)) { $alias .= $tokens[$i]; } unset($tokens[$i]); continue; } $base_expr .= $tokens[$i]; } $stripped = $this->process_expr_list($stripped); $last = array_pop($stripped); if (!$alias && 'colref' == $last['expr_type']) { $prev = array_pop($stripped); if ('operator' == $prev['expr_type'] || 'const' == $prev['expr_type'] || 'function' == $prev['expr_type'] || 'expression' == $prev['expr_type'] || //$prev['expr_type'] == 'aggregate_function' || 'subquery' == $prev['expr_type'] || 'colref' == $prev['expr_type'] ) { $alias = $last['base_expr']; //remove the last token array_pop($tokens); $base_expr = implode('', $tokens); } } if (!$alias) { $base_expr = implode('', $tokens); $alias = $base_expr; } /* Properly escape the alias if it is not escaped */ if ('`' != $alias[0]) { $alias = '`'.str_replace('`', '``', $alias).'`'; } $processed = false; $type = 'expression'; if ('(' == substr(trim($base_expr), 0, 1)) { $base_expr = substr($expression, 1, -1); if (preg_match('/^sel/i', $base_expr)) { $type = 'subquery'; $processed = $this->parse($base_expr); } } if (!$processed) { $processed = $this->process_expr_list($tokens); } if (1 == count($processed)) { $type = $processed[0]['expr_type']; $processed = false; } return array('expr_type' => $type, 'alias' => $alias, 'base_expr' => $base_expr, 'sub_tree' => $processed); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function exec_SELECTquery($select_fields, $from_table, $where_clause, $groupBy = '', $orderBy = '', $limit = '');", "function parseSelect(&$sqlBuilder, $selectString) {\n\n\t// If something matches the pattern /whitespace,KEYWORD,whitespace/ where keyword is in UPPER CASE, \n\t// and it exists in the $selectOpions array,then is should be handled as a MySQL keyword.\n\t$options = findKeywords($selectString, sqlSelect::$selectOptions, function($e) {return '\\s' . $e . '\\s';});\n\t$options = array_map('trim', $options);\n\t$sqlBuilder->select = array_merge($sqlBuilder->select, array('options' => $options));\n\t\n\t$parts = str_replace($options, '', $selectString);\n\t$columnParts = explode(',', $parts);\n\t// (?:) is a non-capturing group. The syntax says that AS is optional. \n\t// whitespace (columnname) (AS) (aliasname) whitespace\n\t// columnname and aliasname could be `here be dragons` or $total.\n\t// Really it should be separated by whitespace or the backtick, if present.\n\t// For now, we use an mandatory AS. \n\t// $regex1 = /(\\S+)\\s+(?:AS\\s)?(\\S+)/ // with whitespace separated\n\t// $regex2 = /`([^`]+)`\\s+(?:AS\\s)?`([^`]+)`/ // with back-tick separated\n\t// $columnPart = \"(`(?:[^`]+)`|(?:\\S+))\";\n\t// $aliasPart = $columnPart;\n\t// $optionalAliasKeyword = (?:AS\\s)?\n\t// Combined? : \"/\" . $columnPart . \"\\s+\" . $optionalAliasKeyword. \"\\s*\" . $aliasPart . \"/\";\n\tforeach ($columnParts as $columnPart) {\n\t\t$t = explode(' AS ', $columnPart);\n\t\t# If there is no alias, just assign a number to it.\n\t\tif (isset($t[1])) {\n\t\t\t$alias = trim($t[1]);\n\t\t\t$columns[$alias] = trim($t[0]);\n\t\t} else {\n\t\t\t$columns[] = trim($t[0]);\n\t\t}\n\t}\n\t$sqlBuilder->select = array_merge($sqlBuilder->select, array('columns' => $columns));\n}", "private function buildSelect(): void {\r\n\r\n $this -> query[] = 'SELECT';\r\n $this -> buildDistinct();\r\n\r\n if(0 === count($this -> select)) {\r\n $this -> query[] = '*';\r\n }\r\n else {\r\n\r\n foreach($this -> select as &$select) {\r\n\r\n if($select instanceof self) {\r\n\r\n $sql = $select -> build();\r\n $this -> bind($sql -> getParameters());\r\n $select = $sql -> getQuery();\r\n }\r\n }\r\n\r\n $this -> query[] = implode(', ', $this -> select);\r\n }\r\n }", "public function SELECTquery($select_fields, $from_table, $where_clause, $groupBy = '', $orderBy = '', $limit = '');", "function exec_SELECT_mm_alias_query($select,$local_table,$local_table_alias, $mm_table, $mm_table_alias, $foreign_table, $foreign_table_alias,$whereClause='',$groupBy='',$orderBy='',$limit='')\t{\r\n\t\t\r\n\t\t$where_local_table = $local_table_alias ? $local_table_alias : $local_table;\r\n\t\t$where_mm_table = $mm_table_alias ? $mm_table_alias : $mm_table;\r\n\t\t$where_foreign_table = $foreign_table_alias ? $foreign_table_alias : $foreign_table;\r\n\r\n\t\t$mmWhere = $where_local_table ? $where_local_table.'.uid='.$where_mm_table.'.uid_local' : '';\r\n\t\t$mmWhere.= ($where_local_table AND $where_foreign_table) ? ' AND ' : '';\r\n\t\t$mmWhere.= $where_foreign_table ? $where_foreign_table.'.uid='.$where_mm_table.'.uid_foreign' : '';\r\n\t\t\r\n\t\treturn $GLOBALS['TYPO3_DB']->exec_SELECTquery(\r\n\t\t\t$select,\r\n\t\t\t($local_table ? $local_table . ($where_local_table ? ' '.$where_local_table: '' ) .',' : '').\r\n\t\t\t$mm_table.($mm_table_alias ? ' '.$mm_table_alias : '').\r\n\t\t\t($foreign_table ? ','.$foreign_table. ($foreign_table_alias?' '.$foreign_table_alias : '' ): ''),\r\n\t\t\t$mmWhere.' '.$whereClause,\t\t// whereClauseMightContainGroupOrderBy\r\n\t\t\t$groupBy,\r\n\t\t\t$orderBy,\r\n\t\t\t$limit\r\n\t\t);\r\n\t}", "function QueryBuilder_SELECT($attribs) {\n if(!$attribs)\n $attribs = \"*\";\n return \"SELECT $attribs \";\n}", "protected function evaluateSelect( Select $select )\r\n {\r\n // pueden haber agregaciones y funciones.\r\n $projections = $select->getAll();\r\n if (count($projections) == 0) return \"SELECT *\";\r\n else\r\n {\r\n $res = \"SELECT \";\r\n foreach ($projections as $proj)\r\n {\r\n // FIXME: la aggregation puede ser una evaluacion\r\n // recursiva porque param es SelectItem y\r\n // puede ser que tenga una agg adentro, asi sucesivamente.\r\n if ($proj instanceof SelectAttribute)\r\n $res .= $proj->getAlias() . \".\" . $proj->getAttrName() . \", \"; // Projection\r\n else if ($proj instanceof SelectAggregation)\r\n $res .= $proj->getName() . \"(\". $proj->getParam()->getAlias() . \".\" . $proj->getParam()->getAttrName() .\"), \";\r\n }\r\n return substr($res, 0, -2); // Saca ultimo \"; \"\r\n }\r\n }", "abstract public function prepareFieldAliases(array $selects);", "protected function compileSelectQuery()\n {\n $select_part = '*';\n $from_part = '';\n $where_part = '';\n $join_part = '';\n $distinct = '';\n $group_by_part = '';\n $order_by_part = '';\n $having_part = '';\n\n // if there aren't any selected fields, add them all\n if (empty($this->sugar_query->select->select) && $this->sugar_query->select->getCountQuery() === false) {\n $this->sugar_query->select('*');\n }\n\n if (!empty($this->sugar_query->from)) {\n $from_part = trim($this->compileFrom($this->sugar_query->from));\n }\n\n if (!empty($this->sugar_query->select)) {\n $select_part = trim(\n $this->compileSelect($this->sugar_query->select)\n );\n }\n if (!empty($this->sugar_query->where)) {\n $this->sugar_query->startData('where');\n $where_part = trim($this->compileWhere($this->sugar_query->where));\n $this->sugar_query->endData();\n }\n\n if ($this->sugar_query->distinct) {\n $distinct = 'DISTINCT';\n }\n\n if (!empty($this->sugar_query->group_by)) {\n $group_by_part = $this->compileGroupBy($this->sugar_query->group_by);\n }\n\n if (!empty($this->sugar_query->having)) {\n $this->sugar_query->startData('having');\n $having_part = $this->compileHaving($this->sugar_query->having);\n $this->sugar_query->endData();\n }\n\n if (!empty($this->sugar_query->order_by)) {\n $order_by_part = $this->compileOrderBy($this->sugar_query->order_by);\n }\n\n if (!empty($this->sugar_query->join)) {\n $this->sugar_query->startData('join');\n $join_part = trim($this->compileJoin($this->sugar_query->join));\n $this->sugar_query->endData();\n }\n\n $data = array();\n $sql = \"SELECT {$distinct} {$select_part} FROM {$from_part}\";\n if (!empty($join_part)) {\n $sql .= \" {$join_part} \";\n $data = array_merge($data, $this->sugar_query->getData('join'));\n }\n if (!empty($where_part)) {\n $sql .= \" WHERE {$where_part} \";\n $data = array_merge($data, $this->sugar_query->getData('where'));\n }\n if (!empty($group_by_part)) {\n $sql .= \" GROUP BY {$group_by_part} \";\n }\n if (!empty($having_part)) {\n $sql .= \" HAVING {$having_part} \";\n $data = array_merge($data, $this->sugar_query->getData('having'));\n }\n if (!empty($order_by_part)) {\n $sql .= \" ORDER BY {$order_by_part} \";\n }\n if (!empty($this->sugar_query->limit) && $this->sugar_query->select->getCountQuery() === false) {\n $sql = $this->db->limitQuery($sql, $this->sugar_query->offset, $this->sugar_query->limit, false, '', false);\n }\n $this->sugar_query->data = $data;\n\n return trim($sql);\n }", "abstract protected function getSelectStatement();", "protected function processSelect(\\Zend_Db_Select $select)\n {\n // $select->joinLeft('gems__rounds', 'gto_id_round = gro_id_round', array());\n // $select->join('gems__tracks', 'gto_id_track = gtr_id_track', array());\n $select->join('gems__surveys', 'gto_id_survey = gsu_id_survey', array());\n $select->join('gems__groups', 'gsu_id_primary_group = ggp_id_group', array());\n $select->join('gems__respondents', 'gto_id_respondent = grs_id_user', array());\n $select->join('gems__respondent2track','gto_id_respondent_track = gr2t_id_respondent_track', array());\n $select->join('gems__reception_codes', 'gto_reception_code = grc_id_reception_code', array());\n }", "private function _compile_select($select_override = FALSE)\n\t{\n\t\t$sql = ( !$this->ar_distinct) ? 'SELECT ' : 'SELECT DISTINCT ';\n\t\t$sql .= (count($this->ar_select) == 0) ? '*' : implode(', ', $this->_filter_table_aliases($this->ar_select));\n\n\t\tif ($select_override !== FALSE)\n\t\t{\n\t\t\t$sql = $select_override;\n\t\t}\n\n\t\tif (count($this->ar_union) > 0)\n\t\t{\n\t\t\t$sql = implode(' ', $this->ar_union);\n\t\t}\n\n\t\tif (count($this->ar_from) > 0)\n\t\t{\n\t\t\t$sql .= \"\\nFROM \";\n\t\t\t$sql .= $this->_from_tables($this->ar_from);\n\t\t}\n\n\t\tif (count($this->ar_join) > 0)\n\t\t{\n\t\t\t$sql .= \"\\n\";\n\n\t\t\t/* special consideration for table aliases */\n\t\t\tif (count($this->ar_aliased_tables) > 0 && $this->dbprefix)\n\t\t\t{\n\t\t\t\t$sql .= implode(\"\\n\", $this->_filter_table_aliases($this->ar_join));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$sql .= implode(\"\\n\", $this->ar_join);\n\t\t\t}\n\t\t}\n\n\t\tif (count($this->ar_where) > 0 OR count($this->ar_like) > 0)\n\t\t{\n\t\t\t$sql .= \"\\nWHERE \";\n\t\t}\n\n\t\t$sql .= implode(\"\\n\", $this->ar_where);\n\n\t\tif (count($this->ar_like) > 0)\n\t\t{\n\t\t\tif (count($this->ar_where) > 0)\n\t\t\t{\n\t\t\t\t$sql .= \" AND \";\n\t\t\t}\n\n\t\t\t$sql .= implode(\"\\n\", $this->ar_like);\n\t\t}\n\n\t\tif (count($this->ar_groupby) > 0)\n\t\t{\n\n\t\t\t$sql .= \"\\nGROUP BY \";\n\n\t\t\t/* special consideration for table aliases */\n\t\t\tif (count($this->ar_aliased_tables) > 0 && $this->dbprefix)\n\t\t\t{\n\t\t\t\t$sql .= implode(\", \", $this->_filter_table_aliases($this->ar_groupby));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$sql .= implode(', ', $this->ar_groupby);\n\t\t\t}\n\t\t}\n\n\t\tif (count($this->ar_having) > 0)\n\t\t{\n\t\t\t$sql .= \"\\nHAVING \";\n\t\t\t$sql .= implode(\"\\n\", $this->ar_having);\n\t\t}\n\n\t\tif (count($this->ar_orderby) > 0)\n\t\t{\n\t\t\t$sql .= \"\\nORDER BY \";\n\t\t\t$sql .= implode(', ', $this->ar_orderby);\n\n\t\t\tif ($this->ar_order !== FALSE)\n\t\t\t{\n\t\t\t\t$sql .= ($this->ar_order == 'desc') ? ' DESC' : ' ASC';\n\t\t\t}\n\t\t}\n\n\t\tif (is_numeric($this->ar_limit))\n\t\t{\n\t\t\t$sql .= \"\\n\";\n\t\t\t$sql = $this->_limit($sql, $this->ar_limit, $this->ar_offset);\n\t\t}\n\n\t\treturn $sql;\n\t}", "protected function parseSelect()\r\n {\r\n $this->_fastForward();\r\n $curLow = strtolower(current($this->tokens));\r\n prev($this->tokens);\r\n if ($curLow == 'distinct') {\r\n $this->query->setResultForm('select distinct');\r\n } else {\r\n $this->query->setResultForm('select');\r\n }\r\n\r\n $currentVar = null;\r\n $currentFunc = null;\r\n $bWaitForRenaming = false;\r\n while ($curLow != 'from' && $curLow != 'where' &&\r\n $curLow != \"{\"\r\n ){\r\n $this->_fastForward();\r\n $curTok = current($this->tokens);\r\n $curLow = strtolower($curTok);\r\n\r\n if ($this->varCheck($curTok) || $curLow == '*') {\r\n if ($bWaitForRenaming) {\r\n $bWaitForRenaming = false;\r\n $currentVar->setAlias($curTok);\r\n if ($currentFunc != null) {\r\n $currentVar->setFunc($currentFunc);\r\n }\r\n $this->query->addResultVar($currentVar);\r\n $currentVar = null;\r\n } else {\r\n if ($currentVar != null) {\r\n $this->query->addResultVar($currentVar);\r\n $currentVar = null;\r\n }\r\n $currentVar = new Query_ResultVariable($curTok);\r\n if ($currentFunc != null) {\r\n $currentVar->setFunc($currentFunc);\r\n }\r\n }\r\n $currentFunc = null;\r\n } else if ($curLow == 'as') {\r\n if ($currentVar === null) {\r\n throw new SparqlParserException(\r\n 'AS requires a variable left and right',\r\n null,\r\n key($this->tokens)\r\n );\r\n }\r\n $bWaitForRenaming = true;\r\n } else if (in_array($curLow, self::$sops)) {\r\n $currentFunc = $curLow;\r\n }\r\n\r\n if (!current($this->tokens)) {\r\n throw new SparqlParserException(\r\n \"Unexpected end of File.\",\r\n null,\r\n key($this->tokens)\r\n );\r\n }\r\n }\r\n\r\n if ($currentVar != null) {\r\n $this->query->addResultVar($currentVar);\r\n }\r\n prev($this->tokens);\r\n\r\n if (count($this->query->getResultVars()) == 0) {\r\n throw new SparqlParserException(\r\n \"Variable or '*' expected.\",\r\n null,\r\n key($this->tokens)\r\n );\r\n }\r\n }", "public function select($column_name, $alias = null, $value = null, $data_type = null)\n {\n\n }", "public function select() {\n $columns = func_get_args();\n \n if(count($columns) > 0 ) {\n $this->select = 'select ';\n foreach ($columns as $column) {\n $this->select .= $column . ', ';\n }\n $this->select = substr($this->select, 0, -2).' from ';\n }\n }", "public function select_1_t_real ($query);", "public function select($fields, string $alias = null) :ISelect\n {\n if(is_array($fields)) {\n $newFields = [];\n foreach($fields as $alias => $field) {\n if($field instanceof ISelect) {\n $tablesInQuery = $field->getTablesInQuery();\n if(count($tablesInQuery) > 0) {\n foreach($tablesInQuery as $table) {\n if(!in_array($table, $this->tablesInQuery)) {\n $this->tablesInQuery[] = $table;\n }\n }\n }\n $fieldSQL = '(' . $field->getSQL() . ')';\n if(!is_int($alias)) {\n $fieldSQL .= ' AS `' . $alias . '`';\n }\n $newFields[] = $fieldSQL;\n }else{\n $fieldsExp = explode('.', $field);\n if(count($fieldsExp) == 2) {\n $fieldSQL = '`' . $fieldsExp[0] . '`.`' . $fieldsExp[1] . '`';\n }\n if(!is_int($alias)) {\n $fieldSQL .= ' AS `' . $alias . '`';\n }\n $newFields[] = $fieldSQL;\n }\n }\n if(count($newFields) > 0) {\n $fields = $newFields;\n }\n }\n if(!is_array($fields)) {\n if($fields instanceof ISelect) {\n $tablesInQuery = $fields->getTablesInQuery();\n if(count($tablesInQuery) > 0) {\n foreach($tablesInQuery as $table) {\n if(!in_array($table, $this->tablesInQuery)) {\n $this->tablesInQuery[] = $table;\n }\n }\n }\n $fields = '(' . $fields->getSQL() . ')';\n if(!empty($alias)) {\n $fields .= ' AS `' . $alias . '`';\n }\n }else{\n if(gettype($fields) == 'object') {\n $fields = $fields->call($this);\n }else{\n $fieldsExp = explode('.', $fields);\n if(count($fieldsExp) == 2) {\n $fields = '`' . $fieldsExp[0] . '`.`' . $fieldsExp[1] . '`';\n }else{\n $fields = '`' . $fields . '`';\n }\n }\n if(!empty($alias)) {\n $fields .= ' AS `' . $alias . '`';\n }\n }\n \n $fields = [$fields];\n }\n $this->select = $fields;\n return $this;\n }", "public function select_expr( $expr, $alias = null ) {\n\t\treturn $this->_add_result_column( $expr, $alias );\n\t}", "public function select_expr($expr, $alias=null) {\n return $this->_add_result_column($expr, $alias);\n }", "public function select ($query_etc);", "public function select_1_t ($query_quotef);", "public function select_1_i ($query_quotef);", "function _build_select($select)\n\t{\n\t\tif(is_object($select))\n\t\t{\n\t\t\t$select->q_to_prefix = $this->q_to_prefix;\n\t\t\t\n\t\t\treturn $select->get_select_sql();\n\t\t}\n\t\telseif(is_array($select))\n\t\t{\n\t\t\t$str = '';\n\t\t\t$i = 0;\n\t\t\t\n\t\t\tforeach($select as $key => $col)\n\t\t\t{\n\t\t\t\t// add commas if needed\n\t\t\t\t$str .= $i++ > 0 ? ', ' : '';\n\t\t\t\t\n\t\t\t\t// these are db functions, just echo them\n\t\t\t\tif(in_array($col, array('MIN','MAX','AVG','SUM','COUNT')))\n\t\t\t\t{\n\t\t\t\t\t$str .= $col;\n\t\t\t\t\t$i = 0;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif( ! is_numeric($key))\n\t\t\t\t\t$str .= $this->_build_select($key) . ' AS ' . $this->_protect_identifiers($col);\n\t\t\t\telse\n\t\t\t\t\t$str .= $this->_build_select($col);\n\t\t\t}\n\t\t\t\n\t\t\treturn $str;\n\t\t}\n\t\t\n\t\treturn $this->_prefix($select);\n\t}", "public function select_1_s ($query_quotef);", "public function buildSelect() {\n\t\t$this->qry->select('*');\n\t\t// -TODO- only selected fields\n\t\t$this->qry->from($this->obj->table);\n\t\t// -TODO- JOIN for objects, and GROUP BY if necessary\n\t}", "public function compile_query_select(GlueDB_Fragment_Query_Select $fragment) {\n\t\t// Get data from fragment :\n\t\t$selectsql\t= $fragment->get()->sql($this);\n\t\t$fromsql\t= $fragment->from()->sql($this);\n\t\t$wheresql\t= $fragment->where()->sql($this);\n\t\t$groupbysql\t= $fragment->groupby()->sql($this);\n\t\t$havingsql\t= $fragment->having()->sql($this);\n\t\t$orderbysql\t= $fragment->orderby()->sql($this);\n\t\t$limit\t\t= $fragment->limit();\n\t\t$offset\t\t= $fragment->offset();\n\n\t\t// Mandatory :\n\t\t$sql = 'SELECT ' . (empty($selectsql) ? '*' : $selectsql) . ' FROM ' . $fromsql;\n\n\t\t// Optional :\n\t\tif ( ! empty($wheresql))\t$sql .= ' WHERE '\t\t. $wheresql;\n\t\tif ( ! empty($groupbysql))\t$sql .= ' GROUP BY '\t. $groupbysql;\n\t\tif ( ! empty($havingsql))\t$sql .= ' HAVING '\t\t. $havingsql;\n\t\tif ( ! empty($orderbysql))\t$sql .= ' ORDER BY '\t. $orderbysql;\n\t\tif ( isset($limit))\t\t$sql .= ' LIMIT '\t\t. $limit;\n\t\tif ( isset($offset))\t\t$sql .= ' OFFSET '\t\t. $offset;\n\n\t\treturn $sql;\n\t}", "function &_select_func($col, $alias, $func, $protect_identifiers)\n\t{\n\t\t$this->q_cached = false;\n\t\t\n\t\tif(is_string($this->q_select))\n\t\t{\n\t\t\t$this->q_select = array();\n\t\t}\n\t\t\n\t\t$this->q_select[] = $func;\n\t\t\n\t\tif($col == false)\n\t\t{\n\t\t\t$obj = new IgnitedQuery();\n\t\t\t$obj->q_as = is_empty($alias) ? false : $alias;\n\t\t\t$obj->q_parent =& $this;\n\t\t\t$this->q_select[] =& $obj;\n\t\t\treturn $obj;\n\t\t}\n\t\t\n\t\tif(is_object($col) && is_a($col, 'IgnitedRecord'))\n\t\t{\n\t\t\t$col->q_as = is_empty($alias) ? false : $alias;\n\t\t\t$this->q_select[] =& $col;\n\t\t\t\n\t\t\treturn $this;\n\t\t}\n\t\t\n\t\tif($protect_identifiers)\n\t\t\t$col = $this->_protect_identifiers($col);\n\t\t\n\t\t$this->q_select[] = '('.$col.') AS '.\n\t\t\t\t\t\t ($alias != ''\n\t\t\t\t\t\t \t? $this->_protect_identifiers($alias)\n\t\t\t\t\t\t \t: $this->_protect_identifiers($col)\n\t\t\t\t\t\t );\n\t\t\n\t\treturn $this;\n\t}", "static function select($table, $wherePairs, $sel='*', $order='',$qtype='default') {\n\n if(count($wherePairs))\n $where_str = \" WHERE \".IdaDB::makeWhereFromArraysForPrep($wherePairs);\n else\n $where_str = \"\";\n\n if(is_array($sel)) {\n $sel = implode(',',$sel);\n }\n\n $sql = \"SELECT\n $sel\n FROM\n \"._DBPREFIX.\"_$table\n \n $where_str $order\";\n\n return IdaDB::prepareExecute($sql, $wherePairs, $qtype);\n\n\n }", "public function select_d ($query_quotef);", "public function select_1 ($query_etc);" ]
[ "0.6285841", "0.60646623", "0.59289867", "0.58907455", "0.5886872", "0.581391", "0.58047014", "0.57976425", "0.5750779", "0.5734168", "0.5712145", "0.5703785", "0.57024336", "0.56940764", "0.5654245", "0.5641841", "0.56233805", "0.55519706", "0.55434364", "0.55276805", "0.5475439", "0.546212", "0.5439087", "0.54184353", "0.53831464", "0.5380339", "0.5366266", "0.5334004", "0.5311286", "0.52964973" ]
0.66491854
0
temp(); echo "Test gia tri cua bien ngoai ham: " . $y. ""; // gia tri cua bien trong ham chi co ham moi hieu echo "Gia tri cua bien ngoai ham: ".$x."<br";
function tong() { global $x, $y; // globar se chuyen bien ben ngoai vao ham, giong nhu loi khai bao cho bien dc dua vao ham $y = $x + $y; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tampilX(){\n $x = 20;\n echo $x;\n}", "function aturan1($x,$y){ \n\t\tglobal $x;\n\t\tglobal $y;\n\t\tif ($x<4) {\n\t\t\t$x=4;\n\t\t // echo \"(\".$x.\",\".$y.\")\";\n\t\t} else {\n\t\t\t$x=5;\n\t\t\t$y=5;\n\t\t}\n\n\t}", "function meteo($saison, $temperature){\n echo \"Nous sommes en $saison et il fait $temperature degre(s) <br>\";\n}", "function meteo($saison, $temperature){\n echo \"Nous sommes en $saison et il fait $temperature degre(s) <br>\";\n}", "function tong1()\n{\n\t$GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y']; // khai bao bien vao ham kieu cmn khac\n}", "function tampilX(){\n global $x;//variable global\n echo $x;\n}", "function saberi($a,$b){\r\n\t\t\techo $a + $b;\r\n\t\t}", "function example($var1,$var2)\n{\n\t$var3 = \"$var1 $var2\";\n\treturn $var3;\n}", "function test(){\n return \"x\";\n}", "function thaidate($temp){\n\t\t\t\tglobal $mname;\n\t\t\t\t$temp1 = explode(\" \",$temp);\n\t\t\t\t$x = explode(\"-\",$temp1[0]);\n\t\t\t\t$m1 = $mname[intval($x[1])];\n\t\t\t\t$d1 = (intval($x[0])+543);\n\t\t\t\t$xrs = intval($x[2]).\" $m1 \".\" $d1 \".$temp1[1];\n\t\t\t\treturn $xrs;\n\t\t\t}", "function aFunction()\n {\n echo \"<br>This is a random string.<br>\"; \n }", "function perevod($pysto){\n\n\t\techo $pysto;\n\n\t}", "function testVariable($dede)\n{\n echo $dede;\n}", "function myTest2($x) {\n echo \"<p>Variable passed to function is: $x</p>\";\n}", "function displayMessage($message, &$x) {\n $x += 10;\n return $message . ' : ' . $x;\n}", "function verify($a,$b) // je créer une fonction avec un nom et un paramétres\n{\n echo $a.''.$b;\n return $a.''.$b;//la fonction doit afficher la variable\n}", "function hoge($hoge)\n{\n echo 'hoge';\n}", "function abc($x)\n{\n $x=$x+10;\n return($x);\n}", "function addX ($param)\n {\n $param = $param . \"X\";\n echo $param;\n }", "function AlexAge($bigwolf){\n echo \"Alex is $bigwolf.<br />\";\n}", "function row2($x, $y) {\n echo \"<tr><td width=\\\"40%\\\" class=\\\"text-right\\\"><strong>$x</strong></td><td>$y</td></tr>\n \";\n}", "function dummy(){ return \"<br><br>Is this thing on? Testing, testing.<br>\"; }", "function bonjour($qui)\n{\n\treturn \"Bonjour \" . $qui . '<br />';\n}", "function myTest() {\n \n // need to use the word global\n global $x, $y;\n $y = $x + $y + 145;\n}", "function t ($str) {\n return $str;\n}", "function hallo()\n{\n echo \"Hallo Nama Saya Ucup<br>\";\n}", "function myFirstFunction($yas= \"Awesome sauce\") {\n\techo \"Things are $yas. <br>\";\n}", "function sumvars(){\r\n $a = 50;\r\n $b = 175;\r\n $samplevar = $a + $b;\r\n echo \"<br> <b>[inside]</b> samplevar is added up to $samplevar\";\r\n \r\n}", "function t( $str )\n{\n return $str;\n}", "function supergy1($str){\n\t$g=rand(0,100);\n\t$str=$str.$g;\n\t\nreturn\t$r=gy1($str);\n\t\n}" ]
[ "0.68243533", "0.6614668", "0.6168801", "0.6168801", "0.61075264", "0.6102976", "0.59726346", "0.5779092", "0.57635546", "0.5708919", "0.5669659", "0.56604636", "0.5646393", "0.56266814", "0.556821", "0.55643356", "0.55462414", "0.5540793", "0.5533326", "0.5510984", "0.5499429", "0.54947084", "0.5477041", "0.5459565", "0.5452239", "0.542405", "0.5423771", "0.54159087", "0.5409997", "0.5407764" ]
0.6643763
1
tong1(); echo $y; how about with static variable
function tongstatic() { static $x = 0; echo $x; $x++; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function coba() {\n static $x = 0;\n echo $x;\n $x++;\n}", "function tampilX(){\n $x = 20;\n echo $x;\n}", "function tong1()\n{\n\t$GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y']; // khai bao bien vao ham kieu cmn khac\n}", "function myTest() /*function adalah sebuah fungsi milik sendiri dengan nama my test*/{\n static $x = 0;//variabel lokal tidak akan dihapus dan di set dari 0\n echo $x;/*echo adalah built-in printout menampilkan variabel $x */\n $x++;// perulangan\n}", "function myTests() {\n static $a = 0;\n echo $a;//echo\n print $a;//print\n $a++;\n}", "function Iki(){\n static $sayi = 0;\n $sayi = $sayi + 1;\n echo \"Deger : \" . $sayi . \"</br>\";\n }", "function tong()\n{\n\tglobal $x, $y; // globar se chuyen bien ben ngoai vao ham, giong nhu loi khai bao cho bien dc dua vao ham\n\t$y = $x + $y;\n}", "function pvz_static (){\n static $a = 0; // sukurimas su pradine reiksme\n $a++; //pridedama +1\n echo $a . '<br>'; //isvedame ir kas karta i nauja eilute ta musu skaiciu\n}", "function tampilX(){\n global $x;//variable global\n echo $x;\n}", "public function testStaticClassVariableMethode2()\n {\n $tpl = $this->smarty->createTemplate('eval:{mystaticclass::$foo(5)}');\n $tpl->assign('foo','square');\n $this->assertEquals('25', $this->smarty->fetch($tpl));\n }", "function zmien(){\n \n //echo \"warotsc \\$l w funci wynosi: $GLOBALS[l]\";\n // echo \"warotsc \\$l w funci wynosi: {$GLOBALS['l']}\";\n echo \"warotsc \\$l w funci wynosi: \".$GLOBALS['l'];\n //echo \"warotsc \\$l w funci wynosi: $l\";\n }", "public function testStaticClassVariableMethode()\n {\n $tpl = $this->smarty->createTemplate('eval:{$foo=\\'square\\'}{mystaticclass::$foo(5)}');\n $this->assertEquals('25', $this->smarty->fetch($tpl));\n }", "function checkStatic()\n{\n static $x =0;\n $x++;\n print \"unset前: {$x}\";\n unset($x);\n $x = 13;\n print \"unset後: {$x}\";\n}", "function menghitung(){\n\n global $a, $b;\n $c = $a + $b;\n // return;\n }", "public static function just_a_test_static(){\n\t\treturn \"just_a_test_static\";\n\t}", "public static function just_a_test_static(){\n\t\treturn \"just_a_test_static\";\n\t}", "function trocaValor() {\n // que esta externamente ao escopo da função, sendo assim são posições de memória diferentes.\n $variavel = 2;\n echo \"Durante a função: $variavel<br>\";\n }", "function counter() \n{\n static $c = 0;\n return $c++;\n}", "function p1() { echo $this->foo . $this->bar . $this->baz; }", "function myTest() {\n \n // need to use the word global\n global $x, $y;\n $y = $x + $y + 145;\n}", "static function s()\n\t{\n\t\tfor($x=0;$x<1000000;++$x) $v = static::$static;\n\t}", "function derivedHookVar(&$t,$padding)\n {\n // This is so derived generator classes can generate variabels\n // It MUST NOT be changed here!!!\n return \"\";\n }", "function f1($x){\n $h=9;\n }", "public static function callable_test() {\n\t\tself::$time = \"Time = \" . rand();\n\n\t\techo self::$time;\n\t}", "public function useStaticProp()\n {\n // on appelle bar (prop. statique) avec la classe\n return $this->baz . self::$bar;\n }", "function saberi4 ($a,$b){\r\n\t\t\t$d = 10;\r\n\t\t\t$c = ($a + $b) * $GLOBALS['d'] ;\r\n\t\t\treturn $c;\r\n\t\t}", "function verify($a,$b) // je créer une fonction avec un nom et un paramétres\n{\n echo $a.''.$b;\n return $a.''.$b;//la fonction doit afficher la variable\n}", "public static function output()\n {\n static::bar();\n }", "function JPSpan_getTmpVar($refresh = FALSE) {\r\n static $count = 1;\r\n if ( !$refresh ) {\r\n $name = 't'.$count;\r\n $count++;\r\n return $name;\r\n }\r\n $count = 1;\r\n}", "function saberi($a,$b){\r\n\t\t\techo $a + $b;\r\n\t\t}" ]
[ "0.648429", "0.6335535", "0.6321781", "0.62930536", "0.62359285", "0.6144641", "0.6114793", "0.60796124", "0.58322155", "0.55291975", "0.54957074", "0.54404145", "0.5361126", "0.5252231", "0.52418727", "0.52418727", "0.5234054", "0.5209203", "0.5205669", "0.5172957", "0.5141357", "0.512763", "0.5121942", "0.5115064", "0.51008767", "0.50740373", "0.49879164", "0.49608123", "0.49485594", "0.49206576" ]
0.70188624
0
Gets the configured purchasable entity IDS.
public function getPurchasableEntityIds();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getPurchasableEntities();", "protected function getEntityIds() {\n $query = $this->getStorage()\n ->getQuery()\n ->sort($this->entityType->getKey('id'))\n ->condition('published', TRUE)\n ->condition('queued_for_delete', FALSE);\n\n // Only add the pager if a limit is specified.\n if ($this->limit) {\n $query->pager($this->limit);\n }\n return $query->execute();\n }", "protected function getEntityIds() {\n $query = $this->cpt_storage->getQuery();\n $keys = $this->entityType->getKeys();\n return $query\n ->sort($keys['id'])\n ->pager($this->limit)\n ->execute();\n }", "public function getCouponIds();", "public function getAssurantProductIds()\n {\n if (!$this->hasAssurantProductIds()) {\n $ids = array();\n foreach ($this->getAssurantProducts() as $product) {\n $ids[] = $product->getId();\n }\n $this->setAssurantProductIds($ids);\n }\n return $this->getData('assurant_product_ids');\n }", "public function getAllIds()\n {\n if (is_null($this->_allProductIds)) {\n if (!$this->isShuffled()) {\n return parent::getAllIds();\n }\n\n $ids = parent::getAllIds();\n $ids = new Varien_Object(array('items' => array_flip($ids)));\n /**\n * Updating collection with desired items\n */\n Mage::dispatchEvent('catalog_product_upsell', array(\n 'product' => $this->getProduct(),\n 'collection' => $ids,\n 'limit' => null,\n ));\n\n $this->_allProductIds = array_keys($ids->getItems());\n shuffle($this->_allProductIds);\n }\n\n return $this->_allProductIds;\n }", "public function getIds();", "protected function getEntityIds() {\n $query = $this->getStorage()->getQuery()\n ->sort($this->entityType->getKey('id'));\n\n if (!\\Drupal::currentUser()->hasPermission('administer workspaces')) {\n $workspaces = $this->getUserWorkspaces();\n $query->condition($this->entityType->getKey('id'), $workspaces, 'IN');\n }\n // Only add the pager if a limit is specified.\n if ($this->limit) {\n $query->pager($this->limit);\n }\n return $query->execute();\n }", "public function confiSimpleProductIds(){\r\n\t\t \t\t$assoc_productIds = array();\r\n\t\t\t\t$collection = Mage::getResourceModel('catalog/product_collection')-> addFieldToFilter('type_id', array('configurable'));\r\n\t\t\t\tforeach($collection->getAllIds() as $key => $pId){\r\n\t\t\t\t\t$product = Mage::getModel('catalog/product')->load($pId);\r\n\t\t\t\t\t$associated_prods = $product->getTypeInstance()->getUsedProducts();\r\n\t\t\t\t\tforeach ($associated_prods as $assoc_product) {\r\n\t\t\t\t\t\t\t$assoc_products[] = $assoc_product;\r\n\t\t\t\t\t\t\t$assoc_productIds[] = $assoc_product->getId();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn $assoc_productIds;\r\n\t\t }", "public function getIdentities()\n {\n return [\\Ss\\Collection\\Model\\Collection::CACHE_TAG . '_' . $this->getCollection()->getId()];\n }", "public function getIdentities()\r\n {\r\n return [\\Magento\\Catalog\\Model\\Product::CACHE_TAG];\r\n }", "public function getConfigEntityTypeIds();", "public function getIdentities()\n {\n return [\n Value::CACHE_TAG . '_' . $this->storeManager->getStore()->getId(),\n ];\n }", "public function getPromotionIds()\n {\n return $this->_promotion_ids;\n }", "public function getIds(): array;", "private function productsIds():array\n {\n return array_column($this->get()['products'], 'id');\n }", "public function loadIdList() {\n $currencyIds = $this->db->fetchCol(\"SELECT id FROM \" . $this->tableName . $this->getCondition() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());\n return $currencyIds;\n }", "public function getIdentities()\n {\n return [self::CACHE_TAG . '_' . $this->getEntityId()];\n }", "public function getIds()\n {\n return $this->pluck('id');\n }", "public function getProductsIds() {\n return array_keys($this->getProducts());\n }", "public function getBannerProductIds()\n {\n return $this->_banner_product_ids;\n }", "public function retrieveAllIds()\n {\n return $this->getIdsByCriteria(new Criteria());\n }", "public function retrieveAllIds()\n {\n return $this->getIdsByCriteria(new Criteria());\n }", "public function getAssociatedProductIdsProperty()\n {\n return collect(\n $this->associations->map(fn ($assoc) => ['id' => $assoc['target_id']])\n );\n }", "public function getIds()\n {\n return $this->ids;\n }", "public function getIds()\n {\n return $this->ids;\n }", "public function getIds()\n {\n return $this->ids;\n }", "public function getIds()\n {\n return $this->ids;\n }", "public function getIdentities()\n {\n $identities = [];\n if ($this->getId()) {\n $identities = [self::CACHE_TAG . '_' . $this->getId()];\n }\n return $identities;\n }", "public function entityIds(string $modelName)\n {\n return Arr::get($this->cachedEntityIds, $modelName, [0]);\n }" ]
[ "0.6878747", "0.6504705", "0.64796877", "0.63756156", "0.6223006", "0.62149525", "0.6123591", "0.61083466", "0.6065357", "0.6046885", "0.6040315", "0.5971056", "0.5970585", "0.5961626", "0.5924357", "0.5888789", "0.5870148", "0.58624643", "0.58613646", "0.58427626", "0.58270645", "0.5806865", "0.5806865", "0.57939005", "0.57895786", "0.57895786", "0.57895786", "0.57895786", "0.5781103", "0.57702297" ]
0.864686
0
Gets the configured purchasable entities.
public function getPurchasableEntities();
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getPurchasableEntityIds();", "public function users()\n {\n return $this->morphedByMany('App\\User', 'deliverable');\n }", "public function products()\n {\n return $this->morphedByMany('Product', 'assetable');\n }", "public function getPurchasedItems();", "public function distributors()\n {\n return $this->morphedByMany(Distributor::class, 'categoriable');\n }", "public function organizations()\n {\n return $this->morphedByMany('App\\Organization', 'deliverable');\n }", "protected function getPurgers() {\n if (is_null($this->purgePurgers)) {\n $this->purgePurgers = $this->container->get('purge.purgers');\n }\n return $this->purgePurgers;\n }", "function getProducts() {\n $manager = new ManageProduct($this->getDataBase());\n return $manager->getAll();\n }", "public function getProducts()\r\n {\r\n return $this->storage->getProducts();\r\n }", "public function getProducts() {\n return $this->session->get(self::BASKET_SESSION_KEY);\n }", "public function getAssurantProducts()\n {\n if (!$this->hasAssurantProducts()) {\n $products = array();\n $collection = $this->getAssurantProductCollection();\n foreach ($collection as $product) {\n $products[] = $product;\n }\n $this->setAssurantProducts($products);\n }\n return $this->getData('assurant_products');\n }", "public function all()\n {\n return $this->product->all();\n }", "public static function getList()\n {\n if (isset ($_GET['selling_token']) && Yii::$app->user->isGuest) {\n $user = SellingService::getSellingOwner();\n $currencies = self::getCurrenciesByUser($user);\n return ArrayHelper::map($currencies, 'id', 'name');\n }\n// return ArrayHelper::map(self::find()->all(), 'id', 'name');\n //todo: нужно давать доступы к стандартым валютам всем, либо добавлять валюты для каждого\n return EntityLister::getList(self::className());\n }", "public function findAll()\n {\n return Item::with('taxes')->get();\n }", "public function getQuotas()\n {\n return $this->quotas;\n }", "public function getItems()\n {\n $items = [];\n\n if ($this->getQuote(true)) {\n $items = $this->getQuote(true)->getAllVisibleItems();\n }\n\n return $items;\n }", "public function stores()\n {\n return $this->morphedByMany('Store', 'assetable');\n }", "public function allSuppliers();", "public function purchases()\n {\n return $this->hasMany(Purchase::class, 'user_id');\n }", "public function entities()\n {\n return $this->hasMany('App\\TopicTaskRelationship', 'task_id')->where('company_id', $this->company_id)\n ->where('listing_id', '!=', 0)->groupBy('listing_id');\n }", "public function getAllHousingEntity()\n {\n $this->em->getFilters()->enable('deleted');\n if ($this->security->isGranted('ROLE_ADMIN')) {\n $this->em->getFilters()->disable('deleted');\n return $this->em->getRepository(Housing::class)->findAll();\n }\n if (!$this->security->isGranted('ROLE_ADMIN') && $this->security->isGranted('ROLE_PROPRIETARY')) {\n /** @var User $user */\n $user = $this->security->getUser();\n return $user->getHousings();\n }\n\n return $this->em->getRepository(Housing::class)->findBy(['visible' => true]);\n }", "public function purchases()\n {\n return $this->hasMany(Purchase::class);\n }", "public function purchases()\n {\n return $this->hasMany(Purchase::class);\n }", "public function getSuppliers()\n {\n return $this->hasMany(Supplier::className(), ['profileId' => 'profileId']);\n }", "public function getObjects()\n {\n return $this->hasMany(Entity::class, ['user_id' => 'id']);\n }", "public function getItems()\n {\n return $this->hasMany(Item::className(), ['id' => 'item_id'])\n ->viaTable('{{%bill_item}}', ['bill_id' => 'id']);\n }", "public function getQuotes()\n {\n return $this->hasMany(Quote::className(), ['id' => 'quoteid'])\n ->viaTable('relation_quote_item', ['itemid' => 'id']);\n }", "public function getAllHousingProprietaryEntity()\n {\n $user = $this->security->getUser();\n $this->em->getFilters()->enable('deleted');\n\n if ($this->security->isGranted('ROLE_ADMIN')) {\n $this->em->getFilters()->disable('deleted');\n }\n\n return $this->em->getRepository(Housing::class)->findBy(['proprietary' => $user]);\n }", "public function users(){\n return $this->morphedByMany(User::class, 'usersectoryables');\n }", "public function purchases()\n {\n return $this->hasMany('App\\Purchase', 'user_id');\n }" ]
[ "0.7103875", "0.5810653", "0.58049875", "0.57377625", "0.5678448", "0.5621804", "0.5543708", "0.54591215", "0.5406752", "0.5365135", "0.5357542", "0.52774954", "0.52553076", "0.5245275", "0.523865", "0.52291524", "0.52160895", "0.5208764", "0.51964587", "0.5194647", "0.5178137", "0.5175507", "0.5175507", "0.5171422", "0.5170565", "0.5155421", "0.51486045", "0.51465154", "0.51393986", "0.51372445" ]
0.77655077
0
Will process a selection of imports given as parameter as uid
public function importUidSelection(array $uidArray, $force = FALSE) { if ($this->logger) $this->logger->logTrace(); $importCollection = $this->importRepository->findInUidEverywhere($uidArray); $this->importSelection($importCollection, $force); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wp_all_import_before_xml_import( $import_id ) {\n // Unless you want this code to execute for every import, check the import id\n // if ($import_id == 5) { ... }\n}", "public function loadFromUid($uid){\r\n\t\t$select = '*';\r\n\t\t$table \t= 'tt_content';\r\n\t\t$row = t3lib_BEfunc::getRecordWSOL($table,$uid,$fields='*',$where='',$useDeleteClause=true);\r\n\r\n\t\tif(parent::checkAccess($row['pid'])){\r\n\t\t\t$this->setUid($row['uid']);\r\n\t\t\t$this->setHeader($row['header']);\r\n\t\t\t$this->setPid($row['pid']);\r\n\t\t\t\r\n\t\t\tif($row['l18n_parent'] != 0){\r\n\t\t\t\t$this->setTranslation(true);\r\n\t\t\t\t$this->setL18NParent($row['l18n_parent']);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t$this->setIcon(t3lib_iconworks::getIcon($table,$row));\r\n\t}", "function import( $args, $assoc_args ) {\n extract( $assoc_args );\n\n if ( isset( $json_file ) ) {\n $choice = \\ACFWPCLI\\CLIUtils::expand_tilde( $json_file );\n } else if (isset($all) && $all) {\n $choice = 'all';\n } else {\n $choice = $this->menu_choice_import_field_group();\n }\n\n $patterns = [];\n if ( $choice == 'all' ) {\n foreach ( $this->paths as $key => $value ) {\n $patterns[ $key ] = trailingslashit( $value ) . '*.json'; }\n } else {\n $patterns[] = $choice;\n }\n\n foreach ( $patterns as $pattern ) {\n foreach ( glob( $pattern ) as $file ) {\n $field_groups = \\ACFWPCLI\\FieldGroup::import( $file );\n\n foreach ( $field_groups as $field_group ) {\n WP_CLI::success( \"Imported field group: {$field_group['title']}\" );\n }\n }\n }\n }", "public function fetchUserGroupRecords($uid);", "function punbb2drupal_import_users() {\n global $F_PREFIX;\n\n $counter = db_result(db_query(\"SELECT COUNT(*) FROM {punbb2drupal_user} WHERE 1\"));\n if (empty($counter)) {\n $sql = \"SELECT * FROM {$F_PREFIX}_users WHERE id > 1 ORDER BY id\";\n $q = db_query($sql);\n while ($v = db_fetch_object($q)) {\n $account = (array)fPunbbUser2DrupalUser($v);\n\n // Find for existing user on system\n $sql = \"SELECT uid FROM {users} WHERE name LIKE '%s'\";\n $uid = db_result(db_query($sql, $account['name']));\n if ($uid) {\n $record = new stdClass;\n $record->uid = $uid;\n $record->id = $account['id'];\n $record->data = serialize($account);\n drupal_write_record('punbb2drupal_user', $record);\n \n drupal_set_message(\"Imported {$account['name']} ({$account['mail']})\");\n }\n else {\n $account = user_save('', $account);\n drupal_set_message(\"Imported {$account->name} ({$account->mail})\");\n }\n }\n\n return '&nbsp;';\n }\n\n return '<div class=\"error\">Script was already run.</div>';\n}", "function processData(&$uid) {\n\t}", "public function importSelection($importCollection, $force = FALSE) {\n\t\tif ($this->logger) $this->logger->logTrace();\n\t\t/* @var $import \\Innologi\\Decosdata\\Domain\\Model\\Import */\n\t\tforeach ($importCollection as $import) {\n\t\t\ttry {\n\t\t\t\t$this->importSingle($import, $force);\n\t\t\t} catch (Exception\\ImporterError $e) {\n\t\t\t\t// register the error and move on\n\t\t\t\t$this->errors[$import->getUid() . ':' . $import->getTitle()] = $e->getFormattedErrorMessage();\n\t\t\t}\n\t\t\t// any other exception is so serious that we have to halt the entire process anyway\n\t\t}\n\t}", "function selectFields()\n {\n\t\t$args = new safe_args();\n\t\t$args->set('key',NOTSET,'any');\t\t\n\t\t\n\t\tfor( $i = 0 ; $i < $_SESSION['import']['count'] ; $i++ )\n\t\t\t$args->set( 'f'.$i, NOTSET, 'any');\t\t\n\t\t\t\n\t\t$args = $args->get(func_get_args());\n\n\t\t$this->load_specific_xsl();\n $GLOBALS['appshore']->add_xsl('lib.import');\n $GLOBALS['appshore']->add_xsl('lib.base'); \n\n\t\t// test of RBAC level upon record owner, if no READ_WRITE then go to the View display\n\t\tif ( !$GLOBALS['appshore']->rbac->check( $this->appRole, RBAC_USER_WRITE ) )\n {\n\t\t\t$args['key'] = 'Error';\n $error = ERROR_PERMISSION_WRITE_DENIED;\n }\n\n \t\tswitch($args['key'])\n\t\t{\n\t\t\tcase 'Error':\n\t\t\t\tmessagebox( $error, ERROR);\n\t\t\t\t$result['action']['import'] = 'selectFields';\n\t\t\t\tbreak;\t\n\n\t\t\tcase 'Previous':\t\n\t\t\t\tunset( $args['key']);\n\t\t\t\t$result = $this->upload( $args);\n\t\t\t\tbreak;\t\t\t\t\t\n\t\t\t\t\n\t\t\tcase 'Next':\n\n \tif ( $this->checkFields($args) )\n {\n\t\t\t\t\t// we modify the $args['key'] value to trigger the import\n\t\t\t\t\t$args['key'] = 'importFile';\n\t\t\t\t\treturn $this->importFile( $args);\n\t\t\t\t}\n\n messagebox( ERROR_INVALID_DATA, ERROR);\n\t\t\t\t//\tNo break\n\n\t\t\tdefault:\n \t\t\t\t$fp = fopen( $_SESSION['import']['tmp_name'], \"r\"); //open the file\n \t\t\t\t\n \t\t\t\t//if the file to import has a different encoding from utf-8 then we convert it\n \t\t\t\tif( $GLOBALS['appshore_data']['current_user']['charset_id'] != 'UTF-8' )\n \t\t\t\t{\n\t \t\t\t\t// test character set\n\t \t\t\t\t$test = fread( $fp, 1024); //read the first characters\n\t \t\t\t\tif( ($charset = mb_detect_encoding( $test, $GLOBALS['appshore_data']['current_user']['charset_id'])) )\n\t \t\t\t\t{\n\t\t\t\t\t\tfclose($fp);\n\t \t\t\t\t\texec('iconv -f '.$charset.' -t UTF-8//IGNORE '.$_SESSION['import']['tmp_name'].' -o '.$_SESSION['import']['tmp_name'].'2') ;\n\t \t\t\t\t\tunlink($_SESSION['import']['tmp_name']);\n\t \t\t\t\t\t$_SESSION['import']['tmp_name'] .= '2';\n\t\t \t\t\t\t$fp = fopen( $_SESSION['import']['tmp_name'], \"r\"); //open the file\n\t \t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t \tfseek($fp,0);\n\t\t\t\t}\n\n \t\t\t\t$filesize = filesize( $_SESSION['import']['tmp_name']);\n \t\t\tif( $_SESSION['import']['header'] == 'Y' )\t// there is a header\n \t\t\t\t{\t\n \t\t\t\t\t//First is the main column names\n\t \t\t\t\t$header = $this->readCSV( $fp, $filesize, $_SESSION['import']['format_id'],'\"'); \n\t\t\t\t\t$sample1 = $this->readCSV( $fp, $filesize, $_SESSION['import']['format_id'],'\"'); \t \t\t\t\t\n\t\t\t\t\t$sample2 = $this->readCSV( $fp, $filesize, $_SESSION['import']['format_id'],'\"'); \t \t\t\t\t\n\n \t\t\t\t\tif( $header['data'] )\n \t\t\t\t\t{\n\t \t\t\t\t\t$i=0;\n\t \t\t\t\t\tforeach( $header['data'] as $key => $val)\n\t \t\t\t\t\t{\n\t \t\t\t\t\t\t$result['sample'][] = array( \n\t \t\t\t\t\t\t\t'field' \t=> \t'f'.$i, \t\t\t\t\t\t\n\t \t\t\t\t\t\t\t'header' \t=> \tsanitize($val, 'string'), \n\t \t\t\t\t\t\t\t'column1' \t=> \tsubstr(sanitize($sample1['data'][$i], 'string'), 0, 30),\n\t \t\t\t\t\t\t\t'column2' \t=> \tsubstr(sanitize($sample2['data'][$i], 'string'), 0, 30));\t\n\t \t\t\t\t\t\t$i++;\n\t \t\t\t\t\t}\n\t \t\t\t\t}\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n \t\t\t\t{\n \t\t\t\t\tunset( $header);\n\t\t\t\t\t$sample1 = $this->readCSV( $fp, $filesize, $_SESSION['import']['format_id'],'\"'); \t \t\t\t\t\n\t\t\t\t\t$sample2 = $this->readCSV( $fp, $filesize, $_SESSION['import']['format_id'],'\"'); \t \t\t\t\t\n\t\t\t\t\t$sample3 = $this->readCSV( $fp, $filesize, $_SESSION['import']['format_id'],'\"'); \t \t\t\t\t\n \t\t\t\t\t\t\n \t\t\t\t\t\t\n \t\t\t\t\tif( $sample1['data'] )\n \t\t\t\t\t{\n\t \t\t\t\t\t$i=0;\n\t \t\t\t\t\tforeach( $sample1['data'] as $key => $val)\n\t \t\t\t\t\t{\n\t \t\t\t\t\t\t$result['sample'][] = array( \n\t \t\t\t\t\t\t\t'field' \t=> \t'f'.$i, \t\t\t\t\t\t\n\t \t\t\t\t\t\t\t'column1' \t=> \tsubstr(sanitize($sample1['data'][$i], 'string'), 0, 30),\n\t \t\t\t\t\t\t\t'column2' \t=> \tsubstr(sanitize($sample2['data'][$i], 'string'), 0, 30),\n\t \t\t\t\t\t\t\t'column3' \t=> \tsubstr(sanitize($sample3['data'][$i], 'string'), 0, 30));\t\t\t\t\t\t\t\n\t \t\t\t\t\t\t$i++;\n\t \t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t\t\n \t\t\t\t}\t\t\t\t\n\t\t\t\tfclose($fp);\n\n\t \t\t// we get the table schema from child classe \n\t\t\t\t$this->setTableSchema($header['data']);\t \n \t\t\t\t\n \t\t\t\t$result['columns'] = $this->tableSchema;\n \t\t\t\t$result['index_name'] = $this->importIndex;\n\t\t\t\t\n\t\t\t\t$_SESSION['import']['count'] = $i;\n\t\t\t\t\t\t \n\t\t\t\t$result['action']['import'] = 'selectFields';\n\t\t\t\t$result['import'] = $_SESSION['import'];\t\t\t\t\n\t\t\t\tbreak;\n\t\t}\n\n return $result;\n }", "public function getStaticIdList($table, $uid)\r\n {\r\n $switchTable = $table == 'fe_groups' ? 'fe_users' : $table;\r\n $queryBuilder = $this->getQueryBuilder($table);\r\n // fe user group uid should be in list of fe users list of user groups\r\n // $field = $switchTable.'.usergroup';\r\n // $command = $table.'.uid';\r\n \r\n // See comment above\r\n // $usergroupInList = ' AND ('.$field.' LIKE \\'%,\\'||'.$command.'||\\',%\\' OR '.$field.' LIKE '.$command.'||\\',%\\' OR '.$field.' LIKE \\'%,\\'||'.$command.' OR '.$field.'='.$command.')';\r\n \r\n // for fe_users and fe_group, only activated modulde_sys_dmail_newsletter\r\n if ($switchTable == 'fe_users') {\r\n $addWhere = $queryBuilder->expr()->eq(\r\n $switchTable . '.module_sys_dmail_newsletter',\r\n 1\r\n );\r\n }\r\n \r\n if ($table == 'fe_groups') {\r\n $res = $queryBuilder\r\n ->selectLiteral('DISTINCT ' . $switchTable . '.uid', $switchTable . '.email')\r\n ->from('sys_dmail_group_mm', 'sys_dmail_group_mm')\r\n ->innerJoin(\r\n 'sys_dmail_group_mm',\r\n 'sys_dmail_group',\r\n 'sys_dmail_group',\r\n $queryBuilder->expr()->eq('sys_dmail_group_mm.uid_local', $queryBuilder->quoteIdentifier('sys_dmail_group.uid'))\r\n )\r\n ->innerJoin(\r\n 'sys_dmail_group_mm',\r\n $table,\r\n $table,\r\n $queryBuilder->expr()->eq('sys_dmail_group_mm.uid_foreign', $queryBuilder->quoteIdentifier($table . '.uid'))\r\n )\r\n ->innerJoin(\r\n $table,\r\n $switchTable,\r\n $switchTable,\r\n $queryBuilder->expr()->inSet($switchTable.'.usergroup', $queryBuilder->quoteIdentifier($table.'.uid'))\r\n )\r\n ->andWhere(\r\n $queryBuilder->expr()->andX()\r\n ->add($queryBuilder->expr()->eq('sys_dmail_group_mm.uid_local', $queryBuilder->createNamedParameter($uid, \\PDO::PARAM_INT)))\r\n ->add($queryBuilder->expr()->eq('sys_dmail_group_mm.tablenames', $queryBuilder->createNamedParameter($table)))\r\n ->add($queryBuilder->expr()->neq($switchTable . '.email', $queryBuilder->createNamedParameter('')))\r\n ->add($queryBuilder->expr()->eq('sys_dmail_group.deleted', $queryBuilder->createNamedParameter(0, \\PDO::PARAM_INT)))\r\n ->add($addWhere)\r\n )\r\n ->orderBy($switchTable . '.uid')\r\n ->addOrderBy($switchTable . '.email')\r\n ->execute();\r\n }\r\n else {\r\n $res = $queryBuilder\r\n ->selectLiteral('DISTINCT ' . $switchTable . '.uid', $switchTable . '.email')\r\n ->from('sys_dmail_group_mm', 'sys_dmail_group_mm')\r\n ->innerJoin(\r\n 'sys_dmail_group_mm',\r\n 'sys_dmail_group',\r\n 'sys_dmail_group',\r\n $queryBuilder->expr()->eq('sys_dmail_group_mm.uid_local', $queryBuilder->quoteIdentifier('sys_dmail_group.uid'))\r\n )\r\n ->innerJoin(\r\n 'sys_dmail_group_mm',\r\n $switchTable,\r\n $switchTable,\r\n $queryBuilder->expr()->eq('sys_dmail_group_mm.uid_foreign', $queryBuilder->quoteIdentifier($switchTable . '.uid'))\r\n )\r\n ->andWhere(\r\n $queryBuilder->expr()->andX()\r\n ->add($queryBuilder->expr()->eq('sys_dmail_group_mm.uid_local', $queryBuilder->createNamedParameter($uid, \\PDO::PARAM_INT)))\r\n ->add($queryBuilder->expr()->eq('sys_dmail_group_mm.tablenames', $queryBuilder->createNamedParameter($switchTable)))\r\n ->add($queryBuilder->expr()->neq($switchTable . '.email', $queryBuilder->createNamedParameter('')))\r\n ->add($queryBuilder->expr()->eq('sys_dmail_group.deleted', $queryBuilder->createNamedParameter(0, \\PDO::PARAM_INT)))\r\n ->add($addWhere)\r\n )\r\n ->orderBy($switchTable . '.uid')\r\n ->addOrderBy($switchTable . '.email')\r\n ->execute();\r\n }\r\n \r\n $outArr = [];\r\n \r\n while ($row = $res->fetch()) {\r\n $outArr[] = $row['uid'];\r\n }\r\n \r\n if ($table == 'fe_groups') {\r\n // get the uid of the current fe_group\r\n $queryBuilder = $this->getQueryBuilder($table);\r\n $res = $queryBuilder\r\n ->selectLiteral('DISTINCT ' . $table . '.uid')\r\n ->from($table, $table)\r\n ->from('sys_dmail_group', 'sys_dmail_group')\r\n ->leftJoin(\r\n 'sys_dmail_group',\r\n 'sys_dmail_group_mm',\r\n 'sys_dmail_group_mm',\r\n $queryBuilder->expr()->eq('sys_dmail_group_mm.uid_local', $queryBuilder->quoteIdentifier('sys_dmail_group.uid'))\r\n )\r\n ->andWhere(\r\n $queryBuilder->expr()->andX()\r\n ->add($queryBuilder->expr()->eq('sys_dmail_group.uid', $queryBuilder->createNamedParameter($uid, \\PDO::PARAM_INT)))\r\n ->add($queryBuilder->expr()->eq('fe_groups.uid', $queryBuilder->quoteIdentifier('sys_dmail_group_mm.uid_foreign')))\r\n ->add($queryBuilder->expr()->eq('sys_dmail_group_mm.tablenames', $queryBuilder->createNamedParameter($table)))\r\n )\r\n ->execute();\r\n \r\n list($groupId) = $res->fetchAll();\r\n \r\n // recursively get all subgroups of this fe_group\r\n $subgroups = $this->getFEgroupSubgroups($groupId);\r\n \r\n if (!empty($subgroups)) {\r\n $usergroupInList = null;\r\n foreach ($subgroups as $subgroup) {\r\n $usergroupInList .= (($usergroupInList == null) ? null : ' OR') . ' INSTR( CONCAT(\\',\\',fe_users.usergroup,\\',\\'),CONCAT(\\',' . intval($subgroup) . ',\\') )';\r\n }\r\n $usergroupInList = '(' . $usergroupInList . ')';\r\n \r\n // fetch all fe_users from these subgroups\r\n $queryBuilder = $this->getQueryBuilder($table);\r\n // for fe_users and fe_group, only activated modulde_sys_dmail_newsletter\r\n if ($switchTable == 'fe_users') {\r\n $addWhere = $queryBuilder->expr()->eq(\r\n $switchTable . '.module_sys_dmail_newsletter',\r\n 1\r\n );\r\n }\r\n \r\n $res = $queryBuilder\r\n ->selectLiteral('DISTINCT ' . $switchTable . '.uid', $switchTable . '.email')\r\n ->from($table, $table)\r\n ->innerJoin(\r\n $table,\r\n $switchTable,\r\n $switchTable\r\n )\r\n ->orWhere($usergroupInList)\r\n ->andWhere(\r\n $queryBuilder->expr()->andX()\r\n ->add($queryBuilder->expr()->neq($switchTable . '.email', $queryBuilder->createNamedParameter('')))\r\n ->add($addWhere)\r\n )\r\n ->orderBy($switchTable . '.uid')\r\n ->addOrderBy($switchTable . '.email')\r\n ->execute();\r\n \r\n while ($row = $res->fetch()) {\r\n $outArr[] = $row['uid'];\r\n }\r\n }\r\n }\r\n \r\n return $outArr;\r\n }", "private function _cleanup_imported_ids() {\n\n\t\t}", "function loadImportModulesList() {\n unset($this->importModules);\n $sql = \"SELECT module_guid, module_title, modulegroup_id\n FROM %s\n WHERE module_type = 'import' AND module_active = 1\n ORDER BY module_title\";\n if ($res = $this->databaseQueryFmt($sql, $this->tableModules)) {\n while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {\n $this->importModules[$row['module_guid']] = $row;\n }\n }\n }", "abstract protected function doImport(Finder $finder, InputInterface $input, OutputInterface $output);", "public function action_auth_ajax_hab_import_users( $handler )\r\n\t{\r\n\t\t$inputs = $_POST->filter_keys( 'db_type', 'db_name','db_host','db_user','db_pass','db_prefix','userindex', 'tag_import' );\r\n\t\tforeach ( $inputs as $key => $value ) {\r\n\t\t\t$$key = $value;\r\n\t\t}\r\n\r\n\t\t$connect_string = $this->get_connect_string( $db_type, $db_host, $db_name );\r\n\t\t$db = $this->hab_connect( $connect_string, $db_user, $db_pass );\r\n\t\tif( $db ) {\r\n\t\t\tDB::begin_transaction();\r\n\t\t\t$new_users = $db->get_results(\r\n\t\t\t\t\"\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\tusername,\r\n\t\t\t\t\t\tpassword,\r\n\t\t\t\t\t\temail,\r\n\t\t\t\t\t\t{$db_prefix}users.id as old_id\r\n\t\t\t\t\tFROM {$db_prefix}users\r\n\t\t\t\t\tINNER JOIN {$db_prefix}posts ON {$db_prefix}posts.user_id = {$db_prefix}users.id\r\n\t\t\t\t\tGROUP BY {$db_prefix}users.id\r\n\t\t\t\t\",\r\n\t\t\t\tarray(),\r\n\t\t\t\t'User'\r\n\t\t\t);\r\n\t\t\t$usercount = 0;\r\n\t\t\t_e('<p>Importing users...</p>');\r\n\r\n\t\t\tforeach($new_users as $user) {\r\n\t\t\t\t$habari_user = User::get_by_name($user->username);\r\n\t\t\t\t// If username exists\r\n\t\t\t\tif($habari_user instanceof User) {\r\n\t\t\t\t\t$habari_user->info->old_id = $user->old_id;\r\n\t\t\t\t\t$habari_user->update();\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\t$user->info->old_id = $user->old_id;\r\n\t\t\t\t\t\t// This should probably remain commented until we implement ACL more,\r\n\t\t\t\t\t\t// or any imported user will be able to log in and edit stuff\r\n\t\t\t\t\t\t//$user->password = '{MD5}' . $user->password;\r\n\t\t\t\t\t\t$user->exclude_fields( array( 'old_id' ) );\r\n\t\t\t\t\t\t$user->insert();\r\n\t\t\t\t\t\t$usercount++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcatch( Exception $e ) {\r\n\t\t\t\t\t\tEventLog::log($e->getMessage(), 'err', null, null, print_r(array($user, $e), 1));\r\n\t\t\t\t\t\tSession::error( $e->getMessage() );\r\n\t\t\t\t\t\t$errors = Options::get('import_errors');\r\n\t\t\t\t\t\t$errors[] = $user->username . ' : ' . $e->getMessage();\r\n\t\t\t\t\t\tOptions::set('import_errors', $errors);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif( DB::in_transaction()) DB::commit();\r\n\r\n\t\t\t$ajax_url = URL::get( 'auth_ajax', array( 'context' => 'hab_import_posts' ) );\r\n\r\n\t\t\t$vars = Utils::addslashes( array( 'type' => $db_type, 'host' => $db_host, 'name' => $db_name, 'user' => $db_user, 'pass' => $db_pass, 'prefix' => $db_prefix ) );\r\n\r\n\t\t\techo <<< HAB_IMPORT_POSTS\r\n\t\t\t<script type=\"text/javascript\">\r\n\t\t\t// A lot of ajax stuff goes here.\r\n\t\t\t$( document ).ready( function(){\r\n\t\t\t\t$( '#import_progress' ).load(\r\n\t\t\t\t\t\"{$ajax_url}\",\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdb_type: \"{$db_type}\",\r\n\t\t\t\t\t\tdb_host: \"{$vars['host']}\",\r\n\t\t\t\t\t\tdb_name: \"{$vars['name']}\",\r\n\t\t\t\t\t\tdb_user: \"{$vars['user']}\",\r\n\t\t\t\t\t\tdb_pass: \"{$vars['pass']}\",\r\n\t\t\t\t\t\tdb_prefix: \"{$vars['prefix']}\",\r\n\t\t\t\t\t\ttag_import: \"{$tag_import}\",\r\n\t\t\t\t\t\tpostindex: 0\r\n\t\t\t\t\t}\r\n\t\t\t\t );\r\n\t\t\t} );\r\n\t\t\t</script>\r\nHAB_IMPORT_POSTS;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tEventLog::log(sprintf(_t('Failed to import from \"%s\"'), $db_name), 'crit');\r\n\t\t\tSession::error( $e->getMessage() );\r\n\t\t\techo '<p>'._t( 'Failed to connect using the given database connection details.' ).'</p>';\r\n\t\t}\r\n\t}", "public function findImport($id);", "function melodev_reimport_user_queue() {\n\n global $user;\n $uid = arg(4);\n if(!is_numeric($uid) || $uid < 1) {\n drupal_set_message('Please select a valid user to reimport.');\n drupal_goto();\n }\n \n // Make sure they're not already queued\n if(db_fetch_object(db_query('select * from {melodev_reimport_user} where uid = %d', $uid))) {\n drupal_set_message('User with ID '.$uid.' has already been queued for reimport. If you think this message is an error please contact a developer.');\n drupal_goto('user/'.$uid);\n }\n\n // Save to reimport queue for cron processing\n db_query('insert into melodev_reimport_user (uid) values(%d)', $uid);\n drupal_set_message('User with ID '.$uid.' has been queued for reimport.');\n drupal_goto('user/'.$uid);\n}", "function importFile()\n {\n\t\t$args = new safe_args();\n\t\t$args->set('key',NOTSET,'any');\t\t\n\n\t\tfor( $i = 0 ; $i < $_SESSION['import']['count'] ; $i++ )\n\t\t\t$args->set( 'f'.$i, NOTSET, 'any');\n\n\t\t$args = $args->get(func_get_args());\t\n\n\t\t$this->load_specific_xsl();\n $GLOBALS['appshore']->add_xsl('lib.import');\n $GLOBALS['appshore']->add_xsl('lib.base'); \n\n\t\t// test of RBAC level upon record owner, if no READ_WRITE then go to the View display \n\t\tif ( !$GLOBALS['appshore']->rbac->check( $this->appRole, RBAC_USER_WRITE ) )\n {\n\t\t\t$args['key'] = 'Error';\n $error = ERROR_PERMISSION_WRITE_DENIED;\n }\n\n \t\tswitch($args['key'])\n\t\t{\n\t\t\tcase 'Error':\n\t\t\t\tmessagebox( $error, ERROR);\n\t\t\t\t$result['action']['import'] = 'importFile';\n\t\t\t\tbreak;\t\t\t\t\t\n\t\t\t\t\n\t\t\tcase 'importFile':\n\t\t\t\t\n \t\t\t\t$fp = fopen( $_SESSION['import']['tmp_name'], \"r\"); //open the file\n \t\t\t\t$filesize = filesize( $_SESSION['import']['tmp_name']);\n \t\t\t\t\n \t\t\t\tif( $_SESSION['import']['header'] == 'Y' )\t// there is a header\n \t\t\t\t{\n\t \t\t\t\t$this->readCSV( $fp, $filesize, $_SESSION['import']['format_id'],'\"'); \n\t\t\t\t}\n\n\t\t\t\t$this->error = array();\n\n\t\t\t\t// set the log \n\t\t\t\t$log['app_name'] = $this->appName;\n\t\t\t\t$log['user_id'] = $GLOBALS['appshore_data']['current_user']['user_id'];\n\t\t\t\t$log['timestamp'] = gmdate( 'Y-m-d H:i:s');\n\t\t\t\tdeleteRowWhere( 'logs_import', 'where app_name = \"'.$log['app_name'].'\" and user_id = \"'.$log['user_id'].'\"', false);\n\t\t\t\t\n\t\t\t\t$row = $rejected = 0;\n\t\t\t\twhile ( ($record = $this->readCSV( $fp, $filesize, $_SESSION['import']['format_id'],'\"')) !== false && $row < IMPORT_MAX_LINES) \n\t\t\t\t{\t\t\t\t\n\t\t\t\t\t$converted = array();\n\t\t\t\t\tforeach($record['data'] as $key => $value)\n\t\t\t\t\t{\n\t\t\t\t\t\t$converted[$args['f'.$key]] = trim(sanitize($value,'string'));\n\t\t\t\t\t}\n\n\t\t\t\t\t$row++;\t \t\t\n\t\t\t\t\n\t\t\t\t\tif( ($imp = $this->importSpecific( $tmpTable, $converted)) !== true )\n\t\t\t\t\t{\n\t\t\t\t\t\t$rejected++;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t$log['line'] = $row;\n\t\t\t\t\t\t$log['reason'] = $imp;\n\t\t\t\t\t\t$log['record'] = mysql_real_escape_string($record['line']);\n\t\t\t\t\t\tinsertRow( 'logs_import', 'user_id', $log, false);\n\t\t\t\t\t}\n\n\t\t\t\t\tif( $rejected == 100 )\n\t\t\t\t\t\tbreak;\t\t\t\t\t\t\n\t\t\t\t}\t\n\t\t\t\t\t\t\t\n\t\t\t\tfclose($fp);\n\t\t\t\tunlink( $_SESSION['import']['tmp_name']);\n\n\t\t\t\t$result['import']['rows'] = $row-1; \t\t\n\t\t\t\t$result['import']['rejected'] = $rejected; \t\t\n\t\t\t\t$result['import']['specific'] = $this->specific;\t\t\t\t\t\t\t\t\n\t\t\t\t$result['action']['import'] = 'importFile';\t\t\t\t\n\t\t\t\tbreak;\n\t\t}\n\t\t\n return $result;\n }", "function imagepicker_user_page($uid, $path=\"\", $func=\"\", $id=0) {\n drupal_add_css(drupal_get_path('module', 'imagepicker') .'/imagepicker.css');\n $content = '';\n // path/func/id\n if ($path == 'images') {\n if ( ($func == 'browse' || $func == 'browseadmin') && is_numeric($id) && $id > 0) {\n $content .= imagepicker_user_view($id);\n }\n elseif ($func == 'edit' && is_numeric($id) && $id > 0) {\n include_once('imagepicker.edit.inc');\n $content .= imagepicker_user_image_edit($id);\n }\n elseif ($func == 'browse') {\n $content .= imagepicker_user_browse();\n }\n elseif ($func == 'browse_public') {\n if (is_numeric($id) && $id > 0) {\n $content .= imagepicker_user_view_public($id);\n }\n else {\n $content .= imagepicker_user_browse_public();\n }\n }\n elseif ($func == 'browseadmin') {\n $content .= imagepicker_user_browse_admin();\n }\n elseif ($func == 'delete' && is_numeric($id) && $id > 0) {\n imagepicker_image_delete($id, FALSE, 'account');\n }\n }\n elseif (variable_get('imagepicker_groups_enabled', 1) && $path == 'groups') {\n include_once('imagepicker.group.inc');\n if ($func == 'edit' && is_numeric($id) && $id > 0) {\n $content .= imagepicker_user_groups($func, $id);\n }\n elseif ($func == 'browse' && is_numeric($id) && $id > 0) {\n imagepicker_set_user_group_state(1, $id);\n $content .= imagepicker_user_browse();\n }\n elseif ($func == 'browse') {\n $content .= imagepicker_user_groups();\n }\n elseif ($func == 'delete') {\n $content .= drupal_get_form('imagepicker_group_delete_form', $id);\n }\n }\n elseif ($path == 'stats') {\n $content .= imagepicker_group_stats(-1);\n }\n elseif ($path == 'config') {\n $content .= imagepicker_user_config_admin();\n }\n else {\n include_once('imagepicker.upload.inc');\n $content .= imagepicker_user_upload();\n }\n return $content;\n}", "private function _subActionImport()\n\t{\n\t\tglobal $context;\n\n\t\t// Importing any smileys from an existing set?\n\t\tif ($context['sub_action'] === 'import')\n\t\t{\n\t\t\tcheckSession('get');\n\t\t\tvalidateToken('admin-mss', 'request');\n\n\t\t\t$set = (int) $this->_req->query->set;\n\n\t\t\t// Sanity check - then import.\n\t\t\tif (isset($context['smiley_sets'][$set]))\n\t\t\t{\n\t\t\t\t$this->importSmileys(un_htmlspecialchars($context['smiley_sets'][$set]['path']));\n\t\t\t}\n\n\t\t\t// Force the process to continue.\n\t\t\t$context['sub_action'] = 'modifyset';\n\t\t\t$context['sub_template'] = 'modifyset';\n\t\t}\n\t}", "public function findByUid($uid) {\n\t\t// @TODO implement\n\t}", "public function handleImports($event)\n {\n //Clears file cache so that everything is clean.\n if (isset($_GET['clearCache']) && $_GET['clearCache'] == 1)\n {\n GeneralCache::forgetEntry('filesClassMap');\n }\n try\n {\n // not using default value to save cpu cycles on requests that follow the first exception.\n Yii::$classMap = GeneralCache::getEntry('filesClassMap');\n }\n catch (NotFoundException $e)\n {\n $filesToInclude = FileUtil::getFilesFromDir(Yii::app()->basePath . '/modules', Yii::app()->basePath . '/modules', 'application.modules');\n $filesToIncludeFromCore = FileUtil::getFilesFromDir(Yii::app()->basePath . '/core', Yii::app()->basePath . '/core', 'application.core');\n $totalFilesToIncludeFromModules = count($filesToInclude);\n\n foreach ($filesToIncludeFromCore as $key => $file)\n {\n $filesToInclude[$totalFilesToIncludeFromModules + $key] = $file;\n }\n foreach ($filesToInclude as $file)\n {\n Yii::import($file);\n }\n GeneralCache::cacheEntry('filesClassMap', Yii::$classMap);\n }\n }", "abstract public function import();", "public function getIdList($table, $pidList, $groupUid, $cat)\r\n {\r\n $addWhere = '';\r\n $switchTable = $table == 'fe_groups' ? 'fe_users' : $table;\r\n $pidArray = GeneralUtility::intExplode(',', $pidList);\r\n \r\n $queryBuilder = $this->getQueryBuilder($table);\r\n\r\n if ($switchTable == 'fe_users') {\r\n //$addWhere = ' AND fe_users.module_sys_dmail_newsletter = 1';\r\n $addWhere = $queryBuilder->expr()->eq(\r\n 'fe_users.module_sys_dmail_newsletter',\r\n 1\r\n );\r\n }\r\n \r\n // fe user group uid should be in list of fe users list of user groups\r\n //\t\t$field = $switchTable.'.usergroup';\r\n //\t\t$command = $table.'.uid';\r\n // This approach, using standard SQL, does not work,\r\n // even when fe_users.usergroup is defined as varchar(255) instead of tinyblob\r\n // $usergroupInList = ' AND ('.$field.' LIKE \\'%,\\'||'.$command.'||\\',%\\' OR '.$field.' LIKE '.$command.'||\\',%\\' OR '.$field.' LIKE \\'%,\\'||'.$command.' OR '.$field.'='.$command.')';\r\n // The following will work but INSTR and CONCAT are available only in mySQL\r\n \r\n $mmTable = $GLOBALS['TCA'][$switchTable]['columns']['module_sys_dmail_category']['config']['MM'];\r\n $cat = intval($cat);\r\n if ($cat < 1) {\r\n if ($table == 'fe_groups') {\r\n $res = $queryBuilder\r\n ->selectLiteral('DISTINCT ' . $switchTable . '.uid', $switchTable . '.email')\r\n ->from($switchTable, $switchTable)\r\n ->from($table, $table)\r\n ->andWhere(\r\n $queryBuilder->expr()->andX()\r\n ->add($queryBuilder->expr()->in('fe_groups.pid', $queryBuilder->createNamedParameter($pidArray, Connection::PARAM_INT_ARRAY)))\r\n ->add('INSTR( CONCAT(\\',\\',fe_users.usergroup,\\',\\'),CONCAT(\\',\\',fe_groups.uid ,\\',\\') )')\r\n ->add(\r\n $queryBuilder->expr()->neq($switchTable . '.email', $queryBuilder->createNamedParameter(''))\r\n )\r\n ->add($addWhere)\r\n )\r\n ->orderBy($switchTable . '.uid')\r\n ->addOrderBy($switchTable . '.email')\r\n ->execute();\r\n }\r\n else {\r\n $res = $queryBuilder\r\n ->selectLiteral('DISTINCT ' . $switchTable . '.uid', $switchTable . '.email')\r\n ->from($switchTable)\r\n ->andWhere(\r\n $queryBuilder->expr()->andX()\r\n ->add($queryBuilder->expr()->in($switchTable . '.pid', $queryBuilder->createNamedParameter($pidArray, Connection::PARAM_INT_ARRAY)))\r\n ->add(\r\n $queryBuilder->expr()->neq($switchTable . '.email', $queryBuilder->createNamedParameter(''))\r\n )\r\n ->add($addWhere)\r\n )\r\n ->orderBy($switchTable . '.uid')\r\n ->addOrderBy($switchTable . '.email')\r\n ->execute();\r\n }\r\n }\r\n else {\r\n if ($table == 'fe_groups') {\r\n $res = $queryBuilder\r\n ->selectLiteral('DISTINCT ' . $switchTable . '.uid', $switchTable . '.email')\r\n ->from('sys_dmail_group', 'sys_dmail_group')\r\n ->from('sys_dmail_group_category_mm', 'g_mm')\r\n ->from('fe_groups', 'fe_groups')\r\n ->from($mmTable, 'mm_1')\r\n ->leftJoin(\r\n 'mm_1',\r\n $switchTable,\r\n $switchTable,\r\n $queryBuilder->expr()->eq($switchTable .'.uid', $queryBuilder->quoteIdentifier('mm_1.uid_local'))\r\n )\r\n ->andWhere(\r\n $queryBuilder->expr()->andX()\r\n ->add($queryBuilder->expr()->in('fe_groups.pid', $queryBuilder->createNamedParameter($pidArray, Connection::PARAM_INT_ARRAY)))\r\n ->add('INSTR( CONCAT(\\',\\',fe_users.usergroup,\\',\\'),CONCAT(\\',\\',fe_groups.uid ,\\',\\') )')\r\n ->add($queryBuilder->expr()->eq('mm_1.uid_foreign', $queryBuilder->quoteIdentifier('g_mm.uid_foreign')))\r\n ->add($queryBuilder->expr()->eq('sys_dmail_group.uid', $queryBuilder->quoteIdentifier('g_mm.uid_local')))\r\n ->add($queryBuilder->expr()->eq('sys_dmail_group.uid', $queryBuilder->createNamedParameter($groupUid, \\PDO::PARAM_INT)))\r\n ->add(\r\n $queryBuilder->expr()->neq($switchTable . '.email', $queryBuilder->createNamedParameter(''))\r\n )\r\n ->add($addWhere)\r\n )\r\n ->orderBy($switchTable . '.uid')\r\n ->addOrderBy($switchTable . '.email')\r\n ->execute();\r\n }\r\n else {\r\n $res = $queryBuilder\r\n ->selectLiteral('DISTINCT ' . $switchTable . '.uid', $switchTable . '.email')\r\n ->from('sys_dmail_group', 'sys_dmail_group')\r\n ->from('sys_dmail_group_category_mm', 'g_mm')\r\n ->from($mmTable, 'mm_1')\r\n ->leftJoin(\r\n 'mm_1',\r\n $table,\r\n $table,\r\n $queryBuilder->expr()->eq($table .'.uid', $queryBuilder->quoteIdentifier('mm_1.uid_local'))\r\n )\r\n ->andWhere(\r\n $queryBuilder->expr()->andX()\r\n ->add($queryBuilder->expr()->in($switchTable . '.pid', $queryBuilder->createNamedParameter($pidArray, Connection::PARAM_INT_ARRAY)))\r\n ->add($queryBuilder->expr()->eq('mm_1.uid_foreign', $queryBuilder->quoteIdentifier('g_mm.uid_foreign')))\r\n ->add($queryBuilder->expr()->eq('sys_dmail_group.uid', $queryBuilder->quoteIdentifier('g_mm.uid_local')))\r\n ->add($queryBuilder->expr()->eq('sys_dmail_group.uid', $queryBuilder->createNamedParameter($groupUid, \\PDO::PARAM_INT)))\r\n ->add(\r\n $queryBuilder->expr()->neq($switchTable . '.email', $queryBuilder->createNamedParameter(''))\r\n )\r\n ->add($addWhere)\r\n )\r\n ->orderBy($switchTable . '.uid')\r\n ->addOrderBy($switchTable . '.email')\r\n ->execute();\r\n }\r\n }\r\n $outArr = [];\r\n while ($row = $res->fetch()) {\r\n $outArr[] = $row['uid'];\r\n }\r\n return $outArr;\r\n }", "public function handle($import)\n {\n $headings = request()->except('import');\n $total = count($import->all());\n\n //\\Log::debug('total to import', ['total' => $total]);\n\n $import->chunk(25, function ($results) use ($headings, $total) {\n foreach ($results as $row) {\n //find or create new user\n $user = User::firstOrNew(['username' => $row->{$this->formatHeading($headings['username_heading'])}]);\n\n try {\n //set user values\n $user->firstname = $row->{$this->formatHeading($headings['firstname_heading'])};\n $user->lastname = $row->{$this->formatHeading($headings['lastname_heading'])};\n $user->email = $row->{$this->formatHeading($headings['email_heading'])};\n //generate random password for ldap users; they should only authenticate via ldap\n $user->password = bcrypt(str_random(24));\n\n $user->save();\n\n //find candidate\n $candidate = $user->candidate;\n if (is_null($candidate)) {\n $candidate = new Candidate();\n $user->candidate()->save($candidate);\n }\n $candidate->update([\n 'gender' => $row->{$this->formatHeading($headings['gender_heading'])},\n 'college' => $row->{$this->formatHeading($headings['college_heading'])},\n 'major' => $row->{$this->formatHeading($headings['major_heading'])},\n 'class' => $row->{$this->formatHeading($headings['class_heading'])},\n 'total_hours' => $row->{$this->formatHeading($headings['hours_heading'])},\n 'gpa' => $row->{$this->formatHeading($headings['gpa_heading'])}\n ]);\n } catch (\\PDOException $e) {\n //TODO: log candidates that could not be imported to DB to display to user\n \\Log::error('Error importing user.', ['user' => $user->toArray(), 'exception' => $e->getMessage()]);\n }\n }\n event(new \\App\\Events\\CandidatesImported($total, count($results)));\n });\n }", "function os2intra_user_import_save_user($user, $uid = '') {\n // Load users account, if any\n $account = user_load($uid);\n\n $keep_groups = array();\n $no_import_groups = FALSE;\n\n // Load users values from account\n if (is_object($account)) {\n $og_user_node = array();\n $import_groups = array();\n // Get a list of current group nids\n if ($og_user_node_field = field_get_items('user', $account, variable_get('os2intra_user_organisation_field'))) { // gruppemedlemskab\n foreach ($og_user_node_field as $key => $field) {\n $og_user_node[$field['target_id']] = $field['target_id'];\n }\n }\n // And organisation and centre nid from last import\n if ($import_group_field = field_get_items('user', $account, variable_get('os2intra_user_department_field'))) { // afdeling\n foreach ($import_group_field as $key => $field) {\n $import_groups[$field['target_id']] = $field['target_id'];\n }\n }\n // The diff will be the groups the user should keep.\n if (!empty($import_groups)) {\n $keep_groups = array_diff($og_user_node, $import_groups);\n // Group id 2 is unset as we add this to all users later.\n unset($keep_groups[2]);\n }\n else {\n // Keep all groups, if there are no import groups\n $keep_groups = $og_user_node;\n $no_import_groups = TRUE;\n }\n }\n\n // Get node id for group\n $query = new EntityFieldQuery;\n $query->entityCondition('entity_type', 'node');\n\n $group_department_title_field = variable_get('os2intra_user_import_group_department_title_field');\n // Property field\n if (strpos($group_department_title_field, 'field_') !== 0) {\n $query->propertyCondition($group_department_title_field, $user['department']);\n } else {\n $query->fieldCondition($group_department_title_field, 'value', $user['department'], '=');\n }\n\n $result = $query->execute();\n\n if (!empty($result['node'])) {\n\n $new_group_nid = key(array_shift($result));\n\n // Attach new group.\n // We rebuild the association completely so we start with an empty\n // array.\n $user_groups = array(LANGUAGE_NONE => array());\n if (variable_get('os2intra_user_default_groups')) {\n $def_groups = explode(',', variable_get('os2intra_user_default_groups'));\n foreach ($def_groups as $def_group) {\n $user_groups[LANGUAGE_NONE][]['target_id'] = $def_group;\n }\n }\n $user_groups[LANGUAGE_NONE][]['target_id'] = $new_group_nid;\n\n // In field_os2intra_import_groups we store the group ids\n // imported, for both organisation unit and center.\n // On the next import, we need this to find out what groups the\n // user has been added to, that are not organisational.\n $import_groups = array();\n $import_groups[LANGUAGE_NONE][]['target_id'] = $new_group_nid;\n }\n\n $og_user_node = array();\n // Get a list of current nids\n //FIXME We need to user variable here, instead \"og_user_node\" field\n if ( $og_user_node_field = field_get_items('user', $account, variable_get('os2intra_user_group_field')) ) {\n foreach ($og_user_node_field as $key => $field) {\n if (isset($field['target_id']) && node_load($field['target_id']) ) {\n $og_user_node[]['target_id'] = $field['target_id'];\n }\n }\n }\n\n // Get node id for centre\n/* $query = new EntityFieldQuery;\n $query->entityCondition('entity_type', 'taxonomy_term');\n $query->fieldCondition('field_os2intra_department_id', 'value', $user['centre'], '=');\n $result = $query->execute();\n\n\n if (!empty($result['taxonomy_term'])) {\n $centre_nid = key(array_shift($result));\n $user_groups[LANGUAGE_NONE][]['target_id'] = $centre_nid;\n\n // Don't do duplicates\n if ($new_group_nid !== $centre_nid) {\n $import_groups[LANGUAGE_NONE][]['target_id'] = $centre_nid;\n }\n }*/\n\n // If there are no import groups, we add the groups, the user had at import.\n // import groups will be set during this import, so next time, this should\n // not be an issue.\n // This is only done in order to migrate user groups, from users before the\n // import groups field was added.\n if ($no_import_groups) {\n $user_groups = array(LANGUAGE_NONE => array());\n }\n\n // Add back the groups we want to keep.\n foreach ($keep_groups as $group_id) {\n // Only the existing nodes\n if (node_load($group_id) !== FALSE ) {\n $user_groups[LANGUAGE_NONE][]['target_id'] = $group_id;\n }\n }\n\n // @todo: check that timestamp is not today\n if (array_key_exists('termination_date', $user)) {\n // Check if termination date is formatted as date\n $termination_date = date_create_from_format(variable_get('os2intra_user_import_date_format', 'd.m.y H:i:s') , $user['termination_date'] . ' 00:00:00');\n if ($termination_date) {\n $termination_date_timestamp = date_timestamp_get($termination_date);\n } else {\n $termination_date_timestamp = $user['termination_date'];\n }\n\n // Check if the timestamp supplied from the import is larger than\n // what unix timestamps can be.\n if ($termination_date_timestamp > 2147483647 or $termination_date_timestamp == FALSE ) {\n $termination_date_timestamp = 1;\n }\n }\n\n // Create Opus Roles and set them on user\n $keep_opus_roles = array();\n $opus_role_tids = array();\n $opus_role_vocabulary = taxonomy_vocabulary_machine_name_load('os2intra_bi_opus_roles');\n $opus_roles = array();\n\n if ($uid) {\n if (isset($account->os2intra_users_opus_roles)) {\n foreach ($account->os2intra_users_opus_roles as $os2intra_users_opus_role) {\n foreach ($os2intra_users_opus_role as $key => $value) {\n $keep_opus_roles[] = $value;\n }\n }\n }\n }\n $opus_roles = explode(',', $user['opus_roles']);\n os2intra_user_import_create_opus_roles($opus_roles);\n\n foreach ($opus_roles as $opus_role) {\n $query = new EntityFieldQuery;\n $result = $query\n ->entityCondition('entity_type', 'taxonomy_term')\n ->propertyCondition('name', trim($opus_role))\n ->propertyCondition('vid', $opus_role_vocabulary->vid)\n ->execute();\n\n if (isset($result['taxonomy_term'])) {\n foreach ($result['taxonomy_term'] as $term) {\n $opus_role_tids[] = $term->tid;\n }\n }\n }\n $opus_role_tids = array_diff($opus_role_tids, $keep_opus_roles);\n\n // User title tid\n $title_tid = os2intra_user_import_user_title($user['job_description']);\n\n // Birthday\n // For some reason, the first zero is chopped somewhere. Let's add it.\n if (array_key_exists('birthdate', $user) && strlen($user['birthdate']) < 6) {\n $user['birthdate'] = '0' . $user['birthdate'];\n }\n $user['birthdate'] = date_format(date_create_from_format(variable_get('os2intra_user_import_date_format', 'd.m.y H:i:s'), $user['birthdate'] . ' 00:00:00'), variable_get('os2intra_user_import_birthdate_db_format'));\n\n // Get user membership to department\n $department_nid = _os2intra_user_import_get_department_nid($user['department']);\n\n // Get current user timestamp.\n $current_timestamp = &drupal_static('os2intra_user_import_current_timestamp');\n if (empty($current_timestamp)) {\n $current_timestamp = time();\n }\n\n // Populate static fields.\n $fields = array(\n\n // Set employee_id\n 'field_os2intra_employee_id' => array(LANGUAGE_NONE => array(0 => array('value' => $user['employee_id']))),\n\n // AD name\n 'field_os2intra_ad_name' => array(LANGUAGE_NONE => array(0 => array('value' => $user['ad_name']))),\n\n // First Name\n 'field_name_first' => array(LANGUAGE_NONE => array(0 => array('value' => $user['first_name']))),\n\n // Last Name\n 'field_name_last' => array(LANGUAGE_NONE => array(0 => array('value' => $user['last_name']))),\n\n // Activate user\n //'status' => ($account->uid != 0) ? $account->status : 1,\n\n 'timezone' => 'Europe/Copenhagen',\n // The organisational ids from this import\n 'field_os2intra_import_groups' => $import_groups,\n\n 'field_os2intra_import_timestamp' => array(LANGUAGE_NONE => array(0 => array('value' => $current_timestamp))),\n );\n\n // Phone\n if ((array_key_exists('phone', $user))) {\n $fields['field_os2intra_phone'] = array(LANGUAGE_NONE => array(0 => array('value' => $user['phone'])));\n }\n // Mobile\n if ((array_key_exists('mobile', $user))) {\n $fields['field_os2intra_mobile'] = array(LANGUAGE_NONE => array(0 => array('value' => $user['mobile'])));\n }\n\n if (variable_get('os2intra_user_import_user_disable_method', 'termination_date') == 'csv_file') {\n $fields['status'] = 1;\n }\n else {\n $fields['status'] = ($account->uid != 0) ? $account->status : 1;\n }\n // Populate dynamic fields.\n // Set birthdate.\n $birthday_field = variable_get('os2intra_user_import_birthday_field');\n if (!empty($birthday_field)) {\n $fields[$birthday_field] = array(\n LANGUAGE_NONE => array(\n 0 => array(\n 'value' => (array_key_exists('birthdate', $user)) ? $user['birthdate'] : NULL,\n ),\n ),\n );\n }\n\n // Set users groups.\n $group_field = variable_get('os2intra_user_group_field');\n if (!empty($group_field)) {\n $fields[$group_field] = array(LANGUAGE_NONE => $og_user_node);\n }\n\n // Set department membership.\n $organisation_field = variable_get('os2intra_user_organisation_field');\n if (!empty($organisation_field)) {\n $organisational_groups = variable_get('os2intra_save_old_departments', FALSE) ? $user_groups : array(LANGUAGE_NONE => array(0 => array('target_id' => $department_nid)));\n if ($organisation_field != $group_field) {\n // Different field used for department membership.\n $fields[$organisation_field] = $organisational_groups;\n }\n else {\n // Merging field values when the same field used\n // to store organizations and user groups references.\n $groups = !empty($fields[$group_field][LANGUAGE_NONE]) ? $fields[$group_field][LANGUAGE_NONE] : array();\n foreach ($organisational_groups[LANGUAGE_NONE] as $org_group) {\n $exist = FALSE;\n foreach ($groups as $group) {\n $exist = $group['target_id'] == $org_group['target_id'];\n if ($exist) {\n break;\n }\n }\n if (!$exist) {\n $groups[] = $org_group;\n }\n }\n\n $fields[$group_field][LANGUAGE_NONE] = $groups;\n }\n }\n\n if (isset($user['email'])) {\n $fields['mail'] = $user['email'];\n $fields['init'] = $user['email'];\n }\n if (isset($user['phone'])) {\n $fields['field_os2intra_phone'] = array(LANGUAGE_NONE => array(0 => array('value' => $user['phone'])));\n }\n if (isset($user['mobile'])) {\n $fields['field_os2intra_mobile'] = array(LANGUAGE_NONE => array(0 => array('value' => $user['mobile'])));\n }\n\n // Job description\n if ($title_tid) {\n $fields['field_os2intra_user_titles'] = array(LANGUAGE_NONE => array(0 => array(variable_get('os2intra_user_import_job_title_connection_reference') => $title_tid)));\n }\n\n // Termination date\n if (isset($termination_date_timestamp)) {\n $fields['field_os2intra_termination_date'] = array(LANGUAGE_NONE => array(0 => array('value' => $termination_date_timestamp)));\n }\n\n // Handle whether we're updating or creating a new user\n // if we're updating we don't generate username and sets password\n if (!is_numeric($uid)) {\n\n // By default user name comes from ad_id.\n $fields['name'] = $user['ad_id'];\n\n // For empty ad_id generate username.\n if (empty($user['ad_id'])) {\n $fields['name'] = os2intra_user_import_generate_username($user);\n }\n\n $password = user_password(8);\n $fields['pass'] = $password;\n\n // Before create check if user has correct name.\n if (empty($fields['name'])) {\n os2intra_user_import_save_log($user['employee_id'], 'Cannot add user with empty name. Employee id: ' . $user['employee_id'] . ' Ad id: ' . $user['ad_id']);\n return;\n }\n\n // Before create check if user with this name already exist.\n if (!empty(user_load_by_name($fields['name']))) {\n os2intra_user_import_save_log($user['employee_id'], 'User with name already exists Employee id: ' . $user['employee_id'] . ' Ad id: ' . $user['ad_id']);\n return;\n }\n }\n\n // Set Opus Roles\n if (field_info_instance('user', 'os2intra_users_opus_roles', 'user')) {\n $fields['os2intra_users_opus_roles'][LANGUAGE_NONE] = array();\n foreach ($opus_role_tids as $opus_role_tid) {\n $fields['os2intra_users_opus_roles'][LANGUAGE_NONE][]['tid'] = $opus_role_tid;\n }\n }\n\n // Save user\n $account = user_save($account, $fields);\n\n if (variable_get('os2intra_revoke_og_roles', false) ) {\n // Remove all department memberships\n $gid_types = og_get_groups_by_user($account);\n if (is_array($gid_types)) {\n foreach ($gid_types as $gid_type) {\n foreach ($gid_type as $gid) {\n og_role_revoke('node', $gid, $account->uid, variable_get('os2intra_user_import_og_role_id_primary', 16));\n }\n }\n }\n }\n if ($department_nid) {\n // Set department membership and role\n $values = array(\n 'entity' => $account,\n 'field_name' => variable_get('os2intra_user_primary_og_role_reference_field')\n );\n og_group('node', $department_nid, $values);\n //we need to give manager role to user, if he is manager of own department\n $is_manager = FALSE;\n if (variable_get('os2intra_add_managers_to_departments')) {\n\n /*$og_department_node = node_load($department_nid);\n $group_organisation_field = variable_get('os2intra_groups_organisation_connection_field');\n $group_organisation_reference = variable_get('os2intra_groups_organisation_connection_reference');\n $organisation_tid = field_get_items('node', $og_department_node, $group_organisation_field)[0][$group_organisation_reference];\n $department_term = entity_metadata_wrapper('taxonomy_term', $organisation_tid);\n $managers_uids = $department_term->field_os2intra_manager_id->raw();\n if (in_array($account->uid, $managers_uids)) {\n $is_manager = TRUE;\n }*/\n }\n if (os2intra_user_import_is_user_department_manager($account->uid, $department_nid)) {\n og_role_grant('node', $department_nid, $account->uid, variable_get('os2intra_user_import_og_role_id_manager', 15));\n }\n else {\n og_role_grant('node', $department_nid, $account->uid, variable_get('os2intra_user_import_og_role_id_primary', 16));\n }\n }\n //create subscription to user's department\n $user_subscriptions = flag_get_user_flags('node', $department_nid, $account->uid);\n if (!isset($user_subscriptions['subscribe_og'])) {\n flag('flag', 'subscribe_og', $department_nid, $account, true);\n }\n\n if (!empty($user['ad_name'])) {\n // Create authmap for user\n $authmap = array(\n 'authname_simplesamlphp_auth' => $user['ad_name'] . variable_get('os2intra_user_import_authmap_name_suffix'),\n );\n } elseif (!empty($user['ad_id'])) {\n // Create authmap for user\n $authmap = array(\n 'authname_simplesamlphp_auth' => $user['ad_id'] . variable_get('os2intra_user_import_authmap_name_suffix'),\n );\n }\n\n if (!empty($authmap) && !user_get_authmaps($authmap)) {\n user_set_authmaps($account, $authmap);\n }\n // Add users to parent departments\n if (variable_get('os2intra_add_users_to_parent_departments') && $department_nid) {\n os2intra_user_import_add_user_to_parent_departments($account, $department_nid);\n }\n\n // Write log entry\n if ($uid) {\n os2intra_user_import_save_log($user['employee_id'], 'update user: ' . $user['employee_id'] . ' ' . $user['first_name'] . ' ' . $user['last_name'] . ' uid: ' . $account->uid);\n }\n else {\n os2intra_user_import_save_log($user['employee_id'], 'create user: ' . $user['first_name'] . ' uid: ' . $account->uid);\n }\n}", "function os2intra_user_import_save_user($user, $uid = '') {\n // Load users account, if any\n $account = user_load($uid);\n\n $keep_groups = array();\n $no_import_groups = FALSE;\n\n // Load users values from account\n if (is_object($account)) {\n $og_user_node = array();\n $import_groups = array();\n // Get a list of current group nids\n if ($og_user_node_field = field_get_items('user', $account, variable_get('os2intra_user_organisation_field'))) { // gruppemedlemskab\n foreach ($og_user_node_field as $key => $field) {\n $og_user_node[$field['target_id']] = $field['target_id'];\n }\n }\n // And organisation and centre nid from last import\n if ($import_group_field = field_get_items('user', $account, variable_get('os2intra_user_department_field'))) { // afdeling\n foreach ($import_group_field as $key => $field) {\n $import_groups[$field['target_id']] = $field['target_id'];\n }\n }\n // The diff will be the groups the user should keep.\n if (!empty($import_groups)) {\n $keep_groups = array_diff($og_user_node, $import_groups);\n // Group id 2 is unset as we add this to all users later.\n unset($keep_groups[2]);\n }\n else {\n // Keep all groups, if there are no import groups\n $keep_groups = $og_user_node;\n $no_import_groups = TRUE;\n }\n }\n\n // Get node id for group\n $query = new EntityFieldQuery;\n $query->entityCondition('entity_type', 'node');\n\n $group_department_title_field = variable_get('os2intra_user_import_group_department_title_field');\n // Property field\n if (strpos($group_department_title_field, 'field_') !== 0) {\n $query->propertyCondition($group_department_title_field, $user['department']);\n } else {\n $query->fieldCondition($group_department_title_field, 'value', $user['department'], '=');\n }\n\n $result = $query->execute();\n\n if (!empty($result['node'])) {\n\n $new_group_nid = key(array_shift($result));\n\n // Attach new group.\n // We rebuild the association completely so we start with an empty\n // array.\n $user_groups = array();\n if (variable_get('os2intra_user_default_groups')) {\n $def_groups = explode(',', variable_get('os2intra_user_default_groups'));\n foreach ($def_groups as $def_group) {\n $user_groups[LANGUAGE_NONE][]['target_id'] = $def_group;\n }\n }\n $user_groups[LANGUAGE_NONE][]['target_id'] = $new_group_nid;\n\n // In field_os2intra_import_groups we store the group ids\n // imported, for both organisation unit and center.\n // On the next import, we need this to find out what groups the\n // user has been added to, that are not organisational.\n $import_groups = array();\n $import_groups[LANGUAGE_NONE][]['target_id'] = $new_group_nid;\n }\n\n $og_user_node = array();\n // Get a list of current nids\n //FIXME We need to user variable here, instead \"og_user_node\" field\n if ( $og_user_node_field = field_get_items('user', $account, variable_get('os2intra_user_group_field')) ) {\n foreach ($og_user_node_field as $key => $field) {\n if (isset($field['target_id']) && node_load($field['target_id']) ) {\n $og_user_node[]['target_id'] = $field['target_id'];\n }\n }\n }\n\n // Get node id for centre\n/* $query = new EntityFieldQuery;\n $query->entityCondition('entity_type', 'taxonomy_term');\n $query->fieldCondition('field_os2intra_department_id', 'value', $user['centre'], '=');\n $result = $query->execute();\n\n\n if (!empty($result['taxonomy_term'])) {\n $centre_nid = key(array_shift($result));\n $user_groups[LANGUAGE_NONE][]['target_id'] = $centre_nid;\n\n // Don't do duplicates\n if ($new_group_nid !== $centre_nid) {\n $import_groups[LANGUAGE_NONE][]['target_id'] = $centre_nid;\n }\n }*/\n\n // If there are no import groups, we add the groups, the user had at import.\n // import groups will be set during this import, so next time, this should\n // not be an issue.\n // This is only done in order to migrate user groups, from users before the\n // import groups field was added.\n if ($no_import_groups) {\n $user_groups = array();\n }\n\n // Add back the groups we want to keep.\n foreach ($keep_groups as $group_id) {\n // Only the existing nodes\n if (node_load($group_id) !== FALSE ) {\n $user_groups[LANGUAGE_NONE][]['target_id'] = $group_id;\n }\n }\n\n // @todo: check that timestamp is not today\n if (array_key_exists('termination_date', $user)) {\n // Check if termination date is formatted as date\n $termination_date = date_create_from_format(variable_get('os2intra_user_import_date_format', 'd.m.y H:i:s') , $user['termination_date'] . ' 00:00:00');\n if ($termination_date) {\n $termination_date_timestamp = date_timestamp_get($termination_date);\n } else {\n $termination_date_timestamp = $user['termination_date'];\n }\n\n // Check if the timestamp supplied from the import is larger than\n // what unix timestamps can be.\n if ($termination_date_timestamp > 2147483647 or $termination_date_timestamp == FALSE ) {\n $termination_date_timestamp = 1;\n }\n }\n\n // Create Opus Roles and set them on user\n $keep_opus_roles = array();\n $opus_role_tids = array();\n $opus_role_vocabulary = taxonomy_vocabulary_machine_name_load('os2intra_bi_opus_roles');\n $opus_roles = array();\n\n if ($uid) {\n if (isset($account->os2intra_users_opus_roles)) {\n foreach ($account->os2intra_users_opus_roles as $os2intra_users_opus_role) {\n foreach ($os2intra_users_opus_role as $key => $value) {\n $keep_opus_roles[] = $value;\n }\n }\n }\n }\n $opus_roles = explode(',', $user['opus_roles']);\n os2intra_user_import_create_opus_roles($opus_roles);\n\n foreach ($opus_roles as $opus_role) {\n $query = new EntityFieldQuery;\n $result = $query\n ->entityCondition('entity_type', 'taxonomy_term')\n ->propertyCondition('name', trim($opus_role))\n ->propertyCondition('vid', $opus_role_vocabulary->vid)\n ->execute();\n\n if (isset($result['taxonomy_term'])) {\n foreach ($result['taxonomy_term'] as $term) {\n $opus_role_tids[] = $term->tid;\n }\n }\n }\n $opus_role_tids = array_diff($opus_role_tids, $keep_opus_roles);\n\n // User title tid\n $title_tid = os2intra_user_import_user_title($user['job_description']);\n\n // Birthday\n // For some reason, the first zero is chopped somewhere. Let's add it.\n if (array_key_exists('birthdate', $user) && strlen($user['birthdate']) < 6) {\n $user['birthdate'] = '0' . $user['birthdate'];\n }\n $user['birthdate'] = date_format(date_create_from_format(variable_get('os2intra_user_import_date_format', 'd.m.y H:i:s'), $user['birthdate'] . ' 00:00:00'), variable_get('os2intra_user_import_birthdate_db_format'));\n\n // Get user membership to department\n $department_nid = _os2intra_user_import_get_department_nid($user['department']);\n\n // Get current user timestamp.\n $current_timestamp = &drupal_static('os2intra_user_import_current_timestamp');\n if (empty($current_timestamp)) {\n $current_timestamp = time();\n }\n\n // Populate fields\n $fields = array(\n\n // Set employee_id\n 'field_os2intra_employee_id' => array(LANGUAGE_NONE => array(0 => array('value' => $user['employee_id']))),\n\n // AD name\n 'field_os2intra_ad_name' => array(LANGUAGE_NONE => array(0 => array('value' => $user['ad_name']))),\n\n // First Name\n 'field_name_first' => array(LANGUAGE_NONE => array(0 => array('value' => $user['first_name']))),\n\n // Last Name\n 'field_name_last' => array(LANGUAGE_NONE => array(0 => array('value' => $user['last_name']))),\n\n // Phone\n 'field_os2intra_phone' => array(LANGUAGE_NONE => array(0 => array('value' => (array_key_exists('phone', $user)) ? $user['phone'] : ''))),\n\n // Mobile\n 'field_os2intra_mobile' => array(LANGUAGE_NONE => array(0 => array('value' => (array_key_exists('mobile', $user)) ? $user['mobile'] : ''))),\n\n // Set birthdate\n variable_get('os2intra_user_import_birthday_field') => array(LANGUAGE_NONE => array(0 => array('value' => (array_key_exists('birthdate', $user)) ? $user['birthdate'] : NULL))),\n\n //Set users nodes\n variable_get('os2intra_user_group_field') => array(LANGUAGE_NONE => $og_user_node),\n\n // Set department membership\n variable_get('os2intra_user_organisation_field') => variable_get('os2intra_save_old_departments', false) ? $user_groups : array(LANGUAGE_NONE => array(0 => array('target_id' => $department_nid))),\n\n // Activate user\n 'status' => ($account->uid != 0) ? $account->status : 1,\n\n 'timezone' => 'Europe/Copenhagen',\n // The organisational ids from this import\n 'field_os2intra_import_groups' => $import_groups,\n\n 'field_os2intra_import_timestamp' => array(LANGUAGE_NONE => array(0 => array('value' => $current_timestamp))),\n );\n \n if (isset($user['email'])) {\n $fields['mail'] = $user['email'];\n $fields['init'] = $user['email'];\n }\n if (isset($user['phone'])) {\n $fields['field_os2intra_phone'] = array(LANGUAGE_NONE => array(0 => array('value' => $user['phone'])));\n }\n if (isset($user['mobile'])) {\n $fields['field_os2intra_mobile'] = array(LANGUAGE_NONE => array(0 => array('value' => $user['mobile'])));\n }\n\n // Job description\n if ($title_tid) {\n $fields['field_os2intra_user_titles'] = array(LANGUAGE_NONE => array(0 => array(variable_get('os2intra_user_import_job_title_connection_reference') => $title_tid)));\n }\n\n // Termination date\n if (isset($termination_date_timestamp)) {\n $fields['field_os2intra_termination_date'] = array(LANGUAGE_NONE => array(0 => array('value' => $termination_date_timestamp)));\n }\n\n // Handle whether we're updating or creating a new user\n // if we're updating we don't generate username and sets password\n if (!is_numeric($uid)) {\n $password = user_password(8);\n\n // At this step even if the ad_id was empty initially it must have been generated\n $fields['name'] = $user['ad_id'];\n $fields['pass'] = $password;\n }\n\n\n // Set Opus Roles\n if (field_info_instance('user', 'os2intra_users_opus_roles', 'user')) {\n $fields['os2intra_users_opus_roles'][LANGUAGE_NONE] = array();\n foreach ($opus_role_tids as $opus_role_tid) {\n $fields['os2intra_users_opus_roles'][LANGUAGE_NONE][]['tid'] = $opus_role_tid;\n }\n }\n\n // Save user\n $account = user_save($account, $fields);\n\n if (variable_get('os2intra_revoke_og_roles', false) ) {\n // Remove all department memberships\n $gid_types = og_get_groups_by_user($account);\n if (is_array($gid_types)) {\n foreach ($gid_types as $gid_type) {\n foreach ($gid_type as $gid) {\n og_role_revoke('node', $gid, $account->uid, variable_get('os2intra_user_import_og_role_id_primary', 16));\n }\n }\n }\n }\n if ($department_nid) {\n // Set department membership and role\n $values = array(\n 'entity' => $account,\n 'field_name' => variable_get('os2intra_user_organisation_field')\n );\n og_group('node', $department_nid, $values);\n og_role_grant('node', $department_nid, $account->uid, variable_get('os2intra_user_import_og_role_id_primary', 16));\n }\n //create subscription to user's department\n $user_subscriptions = flag_get_user_flags('node', $department_nid, $account->uid);\n if (!isset($user_subscriptions['subscribe_og'])) {\n flag('flag', 'subscribe_og', $department_nid, $account, true);\n }\n\n if (!empty($user['ad_name'])) {\n // Create authmap for user\n $authmap = array(\n 'authname_simplesamlphp_auth' => $user['ad_name'] . variable_get('os2intra_user_import_authmap_name_suffix'),\n );\n } elseif (!empty($user['ad_id'])) {\n // Create authmap for user\n $authmap = array(\n 'authname_simplesamlphp_auth' => $user['ad_id'] . variable_get('os2intra_user_import_authmap_name_suffix'),\n );\n }\n\n if (!user_get_authmaps($authmap)) {\n user_set_authmaps($account, $authmap);\n }\n\n // Add users to parent departments\n if (variable_get('os2intra_add_users_to_parent_departments') && $department_nid) {\n os2intra_user_import_add_user_to_parent_departments($account);\n }\n\n // Write log entry\n if ($uid) {\n os2intra_user_import_save_log($user['employee_id'], 'update user: ' . $user['employee_id'] . ' ' . $user['first_name'] . ' ' . $user['last_name'] . ' uid: ' . $account->uid);\n }\n else {\n os2intra_user_import_save_log($user['employee_id'], 'create user: ' . $user['first_name'] . ' uid: ' . $account->uid);\n }\n}", "private static function _entry($mid, $pid, array $input, $ES = array(), $IMPORT = false) {\n\n if ($IMPORT) {\n // Statuses\n $LOCKED = $PLAYED = false;\n // Node IDs\n $mid = T_IMPORT_MID;\n $input['f_tour_id'] = $input['f_did'] = $input['f_lid'] = 0;\n } \n else {\n // Statuses\n $result = mysql_query(\"SELECT locked, IF(date_played IS NULL OR date_played = '', FALSE, TRUE) AS 'played' FROM matches WHERE match_id = $mid\");\n list($LOCKED, $PLAYED) = mysql_fetch_array($result);\n // Node IDs\n $query = \"SELECT tour_id AS 'f_tour_id', did AS 'f_did', f_lid AS 'f_lid' FROM matches,tours,divisions WHERE matches.f_tour_id = tours.tour_id AND tours.f_did = divisions.did AND matches.match_id = $mid\";\n $result = mysql_query($query);\n $input = array_merge($input, mysql_fetch_assoc($result));\n }\n\n /* \n Relation IDs\n */\n $rels = array();\n switch ($pid) \n {\n case ($pid > 0): # Ordinary player?\n $query = \"SELECT owned_by_team_id AS 'f_team_id', f_cid AS 'f_coach_id', f_rid AS 'f_race_id' FROM players WHERE player_id = $pid\";\n $result = mysql_query($query); \n $rels = mysql_fetch_assoc($result);\n break;\n \n case ($pid <= ID_STARS_BEGIN || $pid == ID_MERCS): # Star player or Mercenary?\n $query = \"SELECT owned_by_coach_id AS 'f_coach_id', f_race_id AS 'f_race_id' FROM teams WHERE team_id = $input[f_team_id]\";\n $result = mysql_query($query); \n $rels = mysql_fetch_assoc($result);\n \n /* Special $input field processing. */\n switch ($pid) \n {\n case ($pid <= ID_STARS_BEGIN): # Star player?\n // Star match_data should not be counted/considered as race stats when a team of a given race hires the star.\n $rels['f_race_id'] = 'NULL';\n break;\n case ID_MERCS: # Mercenary?\n // Mercs use the injs/agn fields differently from ordinary players. \n // Nr: #Merc hired by that team. \n // Skills: Extra skill bought count for the merc.\n $input['inj'] = $input['nr']; unset($input['nr']);\n $input['agn1'] = $input['skills']; unset($input['skills']);\n $input['agn2'] = NONE;\n break;\n }\n break;\n }\n $input = array_merge($input, $rels);\n\n /* \n Other match data\n */\n $input['mg'] = $MG = (int) (Player::getPlayerStatus($pid,$mid) == MNG); // Missed (this) Game (ie. had a MNG from previous match)?\n $input['f_player_id'] = $pid;\n $input['f_match_id'] = $mid;\n \n /* \n Verify input\n */\n global $T_PMD;\n $EXPECTED = $T_PMD; # We will be modifying (sorting) the contents, therefore we make a copy.\n sort($EXPECTED);\n ksort($input);\n if (array_keys($input) !== $EXPECTED)\n return false;\n \n // Make sure $T_PMD_ACH input data is numeric\n global $T_PMD_ACH;\n foreach ($T_PMD_ACH as $field) {\n if (!is_numeric($input[$field])) {\n $input[$field] = 0;\n }\n }\n \n /* \n Post/pre match fixes\n \n Before we write player's match data, we need to check if player's status was...\n - Set to DEAD? In which case we must delete all the player's match data from matches played after this match (if any played).\n - Set to MNG? In which case we must zero set the player's match data from match played after this match (if this match is not the latest).\n */\n $status = true;\n \n if ($PLAYED) { # Must be played to have a date to compare with.\n if ($input['inj'] == DEAD) {\n $query = \"DELETE FROM match_data USING match_data INNER JOIN matches \n WHERE match_data.f_match_id = matches.match_id AND f_player_id = $pid AND date_played > (SELECT date_played FROM matches WHERE match_id = $mid)\";\n $status &= mysql_query($query);\n\n }\n elseif ($input['inj'] != NONE) { # Player has MNG status.\n global $T_PMD_ACH, $T_PMD_IR, $T_PMD_INJ;\n $status &= mysql_query(\"UPDATE match_data SET \".\n array_strpack('%s = 0', array_merge($T_PMD_ACH, $T_PMD_IR), ',').','.\n array_strpack('%s = '.NONE, $T_PMD_INJ, ',').\"\n mg = TRUE \n WHERE f_player_id = $pid AND f_match_id = (\n SELECT match_id FROM matches, match_data WHERE \n match_data.f_match_id = matches.match_id AND \n date_played IS NOT NULL AND \n date_played > (SELECT date_played FROM matches WHERE match_id = $mid) AND \n f_player_id = $pid \n ORDER BY date_played ASC LIMIT 1)\");\n }\n }\n \n /* \n Injury corrections\n \n THIS IS NO LONGER USED - see issue 462 http://code.google.com/p/obblm/issues/detail?id=462\n */\n\n /*\n Insert data into MySQL \n */\n // Delete entry if already exists (we don't use MySQL UPDATE on rows for simplicity)\n if (!$IMPORT && $pid != ID_MERCS) {\n $status &= mysql_query(\"DELETE FROM match_data WHERE f_player_id = $pid AND f_match_id = $mid\");\n }\n $query = 'INSERT INTO match_data ('.implode(',', $EXPECTED).') VALUES ('.implode(',', array_values($input)).')';\n $result = mysql_query($query) or status(false, 'Failed to save player entry with PID = '.$pid.'<br><br>'.mysql_error().'<br><br>'.$query);\n return $result && \n // Extra stats, if sent.\n (!empty($ES) ? self::ESentry(array(\n 'f_pid' => $input['f_player_id'], 'f_tid' => $input['f_team_id'], 'f_cid' => $input['f_coach_id'], 'f_rid' => $input['f_race_id'], \n 'f_mid' => $input['f_match_id'], 'f_trid' => $input['f_tour_id'], 'f_did' => $input['f_did'], 'f_lid' => $input['f_lid']\n ), $ES) : true)\n && $status;\n }", "function getUserModules($user_uid,$dashboard){\n\t\t$modules = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid','tx_icsdashboard_register', 'fe_user='.$user_uid.' AND id_dashboard=\\''.$dashboard.'\\''.$this->cObj->enableFields('tx_icsdashboard_register'),'','position');\n\t\t$modules_list='';\n\t\twhile( $module = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($modules) ) {\n\t\t\t$modules_list.=($modules_list=='')?$module['uid']:','.$module['uid'];\n\t\t}\n\t\tif ($modules_list==''){\n\t\t\t$modules_list=$this->conf['modules'];\n\t\t\t$register=explode(',',$modules_list);\n\t\t\tforeach ($register as $key=>$register){\n\t\t\t\t$values= array('fe_user' => $user_uid,\n 'module_uid' => $register,\n 'id_dashboard' => $dashboard,\n\t\t\t\t\t\t\t 'crdate' => time(),\n\t\t\t\t\t\t\t 'pid' =>$this->conf['pid']\n\t\t\t\t\t\t\t );\n\t\t\t\t$GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_icsdashboard_register', $values);\n\t\t\t}\n\t\t\t$conf = array(\n\t\t\t\t\t'parameter' => $GLOBALS['TSFE']->id,\n\t\t\t\t\t'addQueryString' => 1,\n\t\t\t\t\t'addQueryString.' => array('exclude'=>'uid,L,tx_icsdashboard_pi1[reset],tx_icsdashboard_pi1[id_dashboard]'),\n\t\t\t\t\t'returnLast' => 'url',\n\t\t\t\t);\n\t\t\t\theader('Location: '.t3lib_div::locationHeaderUrl($this->cObj->typoLink('', $conf)));\n\t\t\t\texit();\n\t\t}\n\t\treturn $modules_list;\n\t}", "function plugin_usercontributed_downloads($uid)\n{\n global $_TABLES, $LANG_DLM;\n\n $retval = '';\n\n // Include downloads and downloads submissions\n $count = DB_getItem($_TABLES['downloads'], 'COUNT(owner_id)', \"owner_id = {$uid}\") + DB_getItem($_TABLES['downloadsubmission'], 'COUNT(owner_id)', \"owner_id = {$uid}\");\n\n if ($count > 0) {\n $retval = str_replace('%s', $count, $LANG_DLM['num_downloads']);\n }\n\n return $retval;\n}", "function setUserId($uid)\n {\n $this->_reaktorfile->setUserId($uid);\n }", "public function setRevisionUserId($uid);" ]
[ "0.56314373", "0.54896796", "0.54159373", "0.5398082", "0.52813834", "0.52767503", "0.5197538", "0.51868105", "0.50720805", "0.5018033", "0.49505857", "0.4936856", "0.4912169", "0.49057525", "0.4893197", "0.48767892", "0.4870644", "0.48396865", "0.48396105", "0.48230165", "0.48004186", "0.4754981", "0.4745669", "0.47349375", "0.47349375", "0.473301", "0.47204956", "0.46945068", "0.46799865", "0.46441287" ]
0.57783633
0
Returns hash of $filePath, only if it does not match $knownHash. Returns boolean FALSE if file does not exist or hash matches $knownHash.
protected function getHashIfReadyForProcessing($filePath, $knownHash) { if ($this->logger) $this->logger->logTrace(); return ($newHash = md5_file($filePath)) !== $knownHash ? $newHash : FALSE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getHash($filename) {\n if (!isset($this->data[$filename]))\n return FALSE;\n return $this->data[$filename];\n }", "public function getFileableEnsuredHash();", "public function check($hash, $path, array $runtimeConfig = null);", "private function fileExists($filePath) {\n if (file_exists($filePath)) {\n return true;\n }\n\n $arrUrl = parse_url($filePath);\n if (!empty($arrUrl['path'])\n && substr($arrUrl['path'], -4) !== '.php'\n && file_exists($arrUrl['path'])) {\n return true;\n }\n\n return false;\n }", "public function hasFileSha()\n {\n return $this->file_sha !== null;\n }", "protected function checkIfFileExists($filePath)\n {\n return file_exists($filePath);\n }", "public function hasFilePath(): bool;", "public static function exists($filePath)\n {\n $file = static::ensureFileObject($filePath);\n return $file->exists();\n }", "function fileHash($filepath, $use_last_modification_datetime=false, $filepath_to_compare=NULL)\n{\n\t/** Hash 1st $filepath (required) */\n\tif (md5_file($filepath) !== false)\n\t{\n\t\t$file_hash = md5_file($filepath);\n\n\t\tif ($use_last_modification_datetime)\n\t\t{\n\t\t\t/** filemtime() requires a LOCAL file (no URL) */\n\t\t\tif (fileExists($filepath) !== false)\n\t\t\t{\n\t\t\t\t$file_lastmodified = filemtime($filepath);\n\t\t\t\t$file_hash = md5($file_lastmodified.$file_hash);\n\t\t\t} else {\n\t\t\t\terror_log(sprintf('[WARN] <%s:%d> filemtime() requires a LOCAL file (no URL), given: %s', __FILE__, __LINE__, $filepath));\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t//error_log(sprintf('[WARN] <%s:%d> %s Non-existent $filepath: %s', __FILE__, __LINE__, __FUNCTION__, $filepath));\n\t\treturn false;\n\t}\n\n\t/** Hash 2nd $filepath_to_compare (optional) */\n\tif (!empty($filepath_to_compare) && $filepath_to_compare != null)\n\t{\n\t\tif (md5_file($filepath_to_compare) !== false)\n\t\t{\n\t\t\t$file_to_compare_hash = md5_file($filepath_to_compare);\n\n\t\t\tif ($use_last_modification_datetime)\n\t\t\t{\n\t\t\t\t/** filemtime() requires a LOCAL file (no URL) */\n\t\t\t\tif (fileExists($filepath_to_compare) !== false)\n\t\t\t\t{\n\t\t\t\t\t$file_to_compare_lastmodified = filemtime($filepath_to_compare);\n\t\t\t\t\t$file_to_compare_hash = md5($file_to_compare_lastmodified.$file_to_compare_hash);\n\t\t\t\t} else {\n\t\t\t\t\terror_log(sprintf('[WARN] <%s:%d> filemtime() requires a LOCAL file (no URL), given: %s', __FILE__, __LINE__, $filepath_to_compare));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/** Compare the two Hashes & return true on match (false will be handled later) */\n\t\t\tif (!empty($file_to_compare_hash) && $file_to_compare_hash != null && $file_to_compare_hash === $file_hash) return true;\n\n\t\t} else {\n\t\t\t//error_log(sprintf('[WARN] <%s:%d> %s Non-existent $filepath_to_compare: %s', __FILE__, __LINE__, __FUNCTION__, $filepath_to_compare));\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/** Check if $filepath was hashed - and return it. In case $file_to_compare_hash was also hashed, return false (otherwise a matching Hash would have been true already) */\n\treturn (!empty($file_hash) && $file_hash != null && empty($file_to_compare_hash) ? $file_hash : false);\n}", "function fileExists($filePath){\n\t\tif(is_file($filePath) && file_exists($filePath)){\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "public function fileHash($path);", "public function has(string $filePath): bool\n {\n return $this->datastoreFlysystem->has($filePath);\n }", "public function getFileableHash();", "public function hasFilePath() : bool;", "public function compareHash(FileHash $fh) {\n $oldhash = $this->getHash($fh->getFilename());\n return ($oldhash === $fh->getHash());\n }", "function validateHash($argHash,$argFileId,$webuserId)\n{\n $hash = substr($argHash,0,32);\n $expire = substr($argHash,32,strlen($argHash));\n if (mktime() > $expire) return false;\n return (md5($expire.$argFileId.$webuserId) == $hash)? true : false;\n}", "public function compareHash(FileHash $fh) {\n $oldhash = $this->getHash($fh->getFilename());\n return ($oldhash == $fh->getHash());\n }", "public function has( Loco_fs_File $file ){\n $hash = $this->hash( $file );\n return isset($this->unique[$hash]);\n }", "public function hasFile(string $key): bool;", "public function hasFilePath() : bool ;", "protected function fileKnownToExist() {\n return realpath(Runtime::getInstance()->getExecutable()->getFilename());\n }", "public function exists(string $filename): bool;", "public function isMyHash(string $hash): bool;", "public function fileExists(): bool;", "public function hasShaFilename()\n {\n return $this->sha_filename !== null;\n }", "public static function isLocked($filePath)\n {\n $filePath = FileHelper::normalizePath($filePath);\n return isset(static::$_lockedFiles[$filePath]);\n }", "function find_url_hash_in_list($url_hash, $file) {\n if (!file_exists($file)) {\n return null;\n }\n\n $list_file = fopen($file, \"r\") or die(\"unable to read: \" . $file . \" error: \" . print_r(error_get_last(), true));\n while (($buffer = fgets($list_file)) !== false) {\n $buffer = trim($buffer);\n if (strcmp(hash(\"sha256\", $buffer), $url_hash) == 0) {\n fclose($list_file);\n return $buffer;\n }\n }\n\n fclose($list_file);\n return null;\n}", "public static function exist($filename)\r\n {\r\n if (file_exists($filename) AND $filename) {\r\n return realpath($filename);\r\n } else {\r\n return false;\r\n }\r\n }", "public static function isFileModified($path, $hash = null)\n\t{\n\t\tif ($hash === null) {\n\t\t\t$hash = self::getFilehash($path);\n\t\t}\n\n\t\tif (!is_file(DP_ROOT . 'app/sys/Resources/distro-checksums.php')) {\n\t\t\treturn true;\n\t\t}\n\n\t\t$checksums = require(DP_ROOT . 'app/sys/Resources/distro-checksums.php');\n\t\t$key = str_replace(DP_ROOT, '', $path);\n\n\t\tif (!isset($checksums[$key]) || $hash != $checksums[$key]) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}", "private function doesFileMatchPattern(string $filePath, string $ignoredPath) : bool\n {\n // in ecs.php, the path can be absolute\n if ($filePath === $ignoredPath) {\n return \\true;\n }\n $ignoredPath = $this->fnMatchPathNormalizer->normalizeForFnmatch($ignoredPath);\n if ($ignoredPath === '') {\n return \\false;\n }\n if (\\strncmp($filePath, $ignoredPath, \\strlen($ignoredPath)) === 0) {\n return \\true;\n }\n if (\\substr_compare($filePath, $ignoredPath, -\\strlen($ignoredPath)) === 0) {\n return \\true;\n }\n if ($this->fnmatcher->match($ignoredPath, $filePath)) {\n return \\true;\n }\n return $this->realpathMatcher->match($ignoredPath, $filePath);\n }" ]
[ "0.61598283", "0.59373546", "0.59343374", "0.575336", "0.5731412", "0.5726336", "0.5684285", "0.56479853", "0.56160766", "0.5515241", "0.54578096", "0.54406685", "0.5429812", "0.54277647", "0.53834087", "0.5376255", "0.536933", "0.536354", "0.53548294", "0.5348301", "0.53354764", "0.5326358", "0.53140205", "0.53102046", "0.5309323", "0.5303778", "0.53033197", "0.5286406", "0.52703214", "0.5268135" ]
0.81467545
0
Elimina el contacto con toda su respectiva informacion $person : string
public function delete( $person) { try { $this->db->StartTrans(); $persona = $this->getInfo($person); $sql="DELETE FROM contact_institutions WHERE pins_persona = '$person'"; $this->db->Execute($sql); $sql = "DELETE FROM personas WHERE pers_persona='$person'"; $this->db->Execute($sql); $this->db->CompleteTrans(); return array("success"=> true, 'message'=>"Se ha eliminado de la base de datos a la persona: \n\n".$persona['nombre']); }catch(Exception $e){ $this->db->RollbackTrans(); $this->setError($e->getCode(), $e->getMessage()); throw new Exception( $e->getMessage() , $e->getCode() ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function action_personDelete(){\r\n\t\tif ( $this->validateEdit() ){\r\n\t\t\t\r\n\t\t\ttry{\r\n\t\t\t\t// 2. usunięcie rekordu\r\n\t\t\t\tgetDB()->delete(\"person\",[\r\n\t\t\t\t\t\"idperson\" => $this->form->id\r\n\t\t\t\t]);\r\n\t\t\t\tgetMessages()->addInfo('Pomyślnie usunięto rekord');\r\n\t\t\t} catch (PDOException $e){\r\n\t\t\t\tgetMessages()->addError('Wystąpił błąd podczas usuwania rekordu');\r\n\t\t\t\tif (getConf()->debug) getMessages()->addError($e->getMessage());\t\t\t\r\n\t\t\t}\t\r\n\t\t}\r\n\t\t\r\n\t\t// 3. Przekierowanie na stronę listy osób\r\n\t\tforwardTo('personList');\t\t\r\n\t}", "public function EliminarRegistrosPersona($persona_r){\n \n $stmt = self::$pdo->prepare(\"delete from $this->table where persona_r=:persona_r\");\n $stmt->bindParam(\":persona_r\",$persona_r);\n $stmt->execute();\n \n }", "function eliminarContacto(){\n\t\t$this->procedimiento='prov.ft_contacto_ime';\n\t\t$this->transaccion='PROV_CONTAC_ELI';\n\t\t$this->tipo_procedimiento='IME';\n\t\t\t\t\n\t\t//Define los parametros para la funcion\n\t\t$this->setParametro('idContacto','idContacto','int4');\n\n\t\t//Ejecuta la instruccion\n\t\t$this->armarConsulta();\n\t\t$this->ejecutarConsulta();\n\n\t\t//Devuelve la respuesta\n\t\treturn $this->respuesta;\n\t}", "public function delete($Person_ID);", "public function deleteThePerson($sender) {\n $this->collection->removeFirstWhere(\"id\", $sender->data_id);\n }", "public function destroy(Person $person)\n {\n $person->delete();\n return \"Person Deleted Seccussfully\";\n }", "public function deleted(Personne $personne)\n {\n //\n }", "public function nopersona ($id_formulario, $id_persona) {\n\t\t$this->load->model(\"Mform\");\n\t\t$data = $this->Mform->eliminarpersona($id_formulario, $id_persona);\n\t\treturn true;\n\t}", "public static function BorrarPersona($id){\n\t\t$sql = 'DELETE FROM personas WHERE id = :id';\n\t\t$consulta = AccesoDatos::ObtenerObjetoAccesoDatos()->ObtenerConsulta($sql);\n\t\t$consulta->bindValue(':id', $id, PDO::PARAM_INT);\n\t\t$consulta->execute();\n\t}", "public function delete(string $collabPersonId);", "public function removeParticipantAssociation($person)\n {\n $this->participants->removeElement($person);\n }", "function deleteContact() {\n\t$contacts = contactArray();\n\tfwrite(STDOUT, \"Please enter name to delete: \") . PHP_EOL;\n\t$searchName = trim(fgets(STDIN));\n\tforeach ($contacts as $contact => $info) {\n\t\tif (stripos($info['name'], $searchName) !== false) {\n\t\t\tunset($contacts[$contact]);\n\t\t\tcontinue;\n\t\t} \n\t\t$contacts[$contact] = implode(\"|\", $info);\n\t}\n\t$contacts = implode(\"\\n\", $contacts);\n\t$filename = 'contacts.txt';\n\t$handle = fopen($filename, 'w');\n\tfwrite($handle, $contacts);\n\tfclose($handle);\n}", "public function destroy(Person $person)\n {\n //\n }", "public function destroy(Person $person)\n {\n //\n }", "public function destroy(Person $person)\n {\n //\n }", "public function destroy(Persona $persona)\n {\n $persona->delete();\n return redirect()->route(\"personas.index\")->with([\n 'msj'=>'Se elimino su informacón',\n 'alert-type'=>'alert-success'\n ]);\n }", "public function destroy($person_id, $id)\n {\n $email = $this->model->where(['person_id' => $person_id,'id' => $id])->first();\n\n if( count($email) != 1) return view('errors.404');\n\n if( $email->delete() )\n session(['success' => \"o email [{$email->email}] foi removido com sucesso!\"]);\n else\n session(['error' => \"o email [{$email->email}] não foi removido!\"]);\n\n return redirect()->back();\n }", "public function eliminarContacto($rut)\n\t\t{\n\t\t\t\n\t\t\t\t$query = \"delete from contacto where \";\n\t\t\t\t$query = $query.\"RUT = \".$rut;\n\t\t\t\techo \"$query\";\n\t\t\t\t\t$this->conexionDAO->Abrir();\n\t\t\t\t\t$retorno = $this->conexionDAO->insertUpdateDelete($query);\n\t\t\t\t\t$this->conexionDAO->Cerrar();\n\t\t\t\t\treturn $retorno;\n\t\t\t\t\t\n\t\t}", "public function destroy($person_id)\n {\n $person = Person::find($person_id);\n\n if(!$person) {\n return [\n 'message' => [\n 'type' => 'danger',\n 'body' => '此聯絡人不存在。'\n ]\n ];\n }\n\n $person->delete();\n // return redirect()->route('persons.index')->with('success', '已成功刪除資料。');\n\n return [\n 'person' => $person,\n 'message' => [\n 'type' => 'warning',\n 'body' => '已成功刪除資料。'\n ]\n ];\n }", "static function deletePerson($dni) {\n // Abro la conexion\n GestionBDD::conectarBDD();\n\n // Preparo la sentencia SQL\n $query = 'DELETE FROM ' . Constants::$PEOPLE . ' WHERE dni = ?';\n $stmt = GestionBDD::$conexion->prepare($query);\n $stmt->bind_param(\"s\", $val1);\n\n // Valores de la sentencia\n $val1 = $dni;\n\n // Ejecuto y cierro la conexion\n $stmt->execute();\n GestionBDD::cerrarBDD();\n }", "public function destroy($personService)\n {\n \n //return $personService ;\n PersonService::where('id', $personService)->delete(); \n Session::flash('message', 'رکورد حذف شد ');\n return Redirect::back();\n /*person_services*/\n }", "function removeRecipient(IRecipient $recipient);", "public function eliminarComida($id_formulario, $id_persona, $id_comida) {\n\t\t$delete = \"DELETE FROM ENIG_FORM_GDP_COMIDASFUERA WHERE ID_FORMULARIO='$id_formulario' AND ID_PERSONA='$id_persona' AND ID_COMIDA='$id_comida'\";\n\t\t$query = $this->db->query($delete);\n\t\t$this->db->close();\n\t\treturn $query;\n\t}", "public function personDelete($codigo)\n\t{\n\t\t$sql = \"DELETE FROM person where dni ='$codigo'\";\n\t\tmysqli_query($this->open(), $sql) or die('Error. ' . mysqli_error($sql));\n\t\t$this->personSelect();\n\t}", "public function removePerson($aName)\n {\n \n $aPerson = $this->find(ucfirst ($aName));\n if($aPerson !=null)\n {\n $compareName = ucfirst($aPerson->getName());\n }\n \n \n if($aName == $compareName)\n {\n $personObject = $this->find($aName);\n\t\t\t$key = array_search($personObject, $this->people);\n \n\n unset($this->people[$key]);\n\t\t\t\n\t\t\t//===DATABASE CODE GOES HERE\n\t\t\t\n\t\t\t//Checks if the person object still exists\n if(!$this->find($aName))\n\t\t\t{\n// echo $aName.\" has been removed succesfully.<br/>\";\n\t\t\t}\n }\n else\n {\n echo $aPerson.' does not exist';\n }\n \n }", "public function supprimerContact() {\n\t $idContact = $this->input->get('idContact');\n\t $instanceDao = $this->ContactFactory->getInstance();\n\t $supp = $instanceDao->getContactById($idContact);\n\t $instanceDao->deleteContact($supp);\n\t $this->redirection();\n\t}", "public function remove_client_person()\n\t{\n\t\t$updateFlag = 0;\n\t\t$compnay_id = trim($this->input->post('compnay_id'));\n\t\t$action = trim($this->input->post('action'));\n\t\tif($compnay_id > 0 && $action === 'update'){\n\t\t\t$updated = $this->clients_model->updateHandlingPerson($compnay_id);\n\t\t\t$updateFlag = 1;\n\t\t}\n\t\techo $updateFlag;\n\t}", "public function deletePerson($request) {\n\n $id = $request['id'];\n $domain = $request['domain'];\n $column = prefixed($domain) . '_id';\n $sql = 'DELETE FROM ' . $domain . ' WHERE '.$column.' = :id';\n //echo $id; //exit\n //echo $column; //exit;\n //echo $domain; //exit;\n //echo $sql; //exit\n\n $statement = $this->pdo->prepare($sql);\n //$statement->bindParam(':column', $column);\n $statement->bindValue(':id', $id);\n $statement->execute();\n return $statement->rowCount();\n\n }", "public function deletePersonal($id, $id_person)\n {\n $sc = ServiceCenter::find($id);\n\n DB::table('service_center_personal')\n ->where('service_center_id', '=', $sc->id)\n ->where('id', '=', $id_person)\n ->delete();\n return true;\n }", "public function delete($person)\n {\n if(!($person instanceof Person))\n throw new PersonException(\"passed parameter isn't a Person instance\");\n $this->deleteById($person->getIdPerson());\n }" ]
[ "0.69894856", "0.6530645", "0.65054286", "0.6421209", "0.62866396", "0.62462574", "0.61823565", "0.6177118", "0.61295474", "0.60875404", "0.6072671", "0.6071586", "0.60439956", "0.60439956", "0.60439956", "0.6013105", "0.600526", "0.59150016", "0.5912697", "0.5910538", "0.58934206", "0.5859083", "0.58212775", "0.5793656", "0.57679635", "0.5750305", "0.5732644", "0.56968975", "0.5678686", "0.56601924" ]
0.7205759
0
Obtiene el catalogo de titulos para el tratamiento de las personas $search string : palabra a buscar $return string : Forma en que debe de devolver los datos
public function getTitulos( $search, $return='array') { try { if(strlen($return)==0) return false; $sql = " SELECT id_titulos AS clave, d_titulos AS descrip FROM cat_titulos WHERE d_titulos LIKE '%".strtoupper($search)."%' ORDER BY d_titulos LIMIT 10;"; $rs = $this->db->Execute($sql); if ($return=='array'){ $rows = $rs->GetAll(); $rs->Close(); return $rows; }elseif($return=='pipe'){ $str = ''; while($row = $rs->FetchRow()){ $str.= $row['descrip']."|".$row['clave']."\n"; } return $str; } }catch(Exception $e){ $this->setError($e->getCode(), $e->getMessage()); throw new Exception( $e->getMessage() , $e->getCode() ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function search()\n {\n $limit = Input::get('limit') ?: 9;\n $offset = Input::get('offset') ?: 0;\n $term = trim(Input::get('term'));\n // $termArray = (strstr($term, ' ')) ? $this->wildcard($term) : $term;\n $busca = [\n 'pedidos' => [],\n 'clientes' => [],\n 'produtos' => [],\n 'offset' => 0,\n ];\n\n try {\n $categories = $this->parseCategories(Input::get('categories'));\n\n if (!$categories || empty($categories)) {\n return $this->listResponse($busca);\n }\n\n if (in_array('pedidos', $categories)) {\n $busca['pedidos'] = $this->orders($term)\n ->offset($offset)\n ->limit($limit)\n ->get([\n 'pedidos.*'\n ]);\n\n $busca['pedidos'] = OrderTransformer::search($busca['pedidos']);\n }\n\n if (in_array('clientes', $categories)) {\n /*$busca['clientes'] = Cliente\n ::with('enderecos')\n ->search($termArray, [\n 'nome' => 100,\n 'taxvat' => 75,\n 'email' => 50,\n 'inscricao' => 25,\n ])*/\n $busca['clientes'] = $this->customers($term)\n ->with('enderecos')\n ->groupBy('id')\n ->orderBy('nome', 'ASC')\n ->offset($offset)\n ->limit($limit)\n ->get();\n\n $busca['clientes'] = ClientTransformer::search($busca['clientes']);\n }\n\n if (in_array('produtos', $categories)) {\n /*$busca['produtos'] = Produto\n ::search($termArray, [\n 'sku' => 125,\n 'titulo' => 100,\n 'ncm' => 75,\n 'ean' => 50,\n 'referencia' => 25,\n ])*/\n $busca['produtos'] = $this->products($term)\n ->groupBy('sku')\n ->orderBy('titulo', 'ASC')\n ->offset($offset)\n ->limit($limit)\n ->get();\n\n $busca['produtos'] = ProductTransformer::search($busca['produtos']);\n }\n\n $busca['offset'] = $offset;\n } catch (\\Exception $exception) {\n \\Log::error(logMessage($exception, 'Ocorreu um erro ao tentar realizar um busca.'));\n }\n\n return $this->listResponse($busca);\n }", "public function getTCalles( $search, $return='array') {\n \t\n\t\ttry \n\t\t{ \n\t\t if(strlen($return)==0) return false;\t\t\n\t\t\n\t\t $sql = \"\t\n\t\t SELECT id_clase_calle AS clave ,\n\t\t\t d_clase_calle AS descrip \n\t\t\t FROM cat_clase_calle\n\t\t\t WHERE d_clase_calle LIKE '%$search%'\n\t\t\t ORDER BY d_clase_calle\n\t\t\t LIMIT 10\";\n\t\t \t \n\t\t\t $rs = $this->db->Execute($sql);\t\t\t \n\t\t\t \n\t\t\t if ($return=='array'){\n\t\t\t\t $rows = $rs->GetAll();\n\t\t\t $rs->Close();\n\t\t\t\t return $rows;\n\t\t\t }elseif($return=='pipe'){\n\t\t\t $str = '';\n\t\t\t\t while($row = $rs->FetchRow()){\n\t $str.= $row['descrip'].\"|\".$row['clave'].\"\\n\";\n\t }\n\t\t\t\t return $str;\t\t \n\t\t\t }\n\t\t\t \n\t\t\t \n\t\t}catch(Exception $e){\t\t \n\t\t\t$this->setError($e->getCode(), $e->getMessage());\n\t\t\tthrow new Exception( $e->getMessage() , $e->getCode() );\t\n\t\t}\t\t\t\t\n }", "public function search();", "public function busqueda()\n {\n \tif ($this->request->is('ajax')) {\n //recibe el codigo via ajax\n \t\t$this->autoRender=false;\n \t\t$codigo=$_POST['id'];\n //obtiene la cotizacion y la envia a la vista\n \t\t$cotizacion=$this->Cotizacion->get($codigo);\n \t\t//busca el nombre del proveedor en la base de datos sgbodega\n \t\t$conn = ConnectionManager::get('copec');\n \t\t$results = $conn->execute('SELECT PR_RAZON FROM proveedor WHERE PR_NCORR='.$cotizacion->codigoEmpresa);\n \t\t$NombreP=$results->fetch('assoc');\n \t\t$NombreP=$NombreP['PR_RAZON'];\n //asigna el nombre a la cotizacion\n \t\t$cotizacion->codigoEmpresa=$NombreP;\n \t//busca el nombre de la empresa comprante en base de datos sgyonley\n \t\t$conn = ConnectionManager::get('copec');\n \t\t$results = $conn->execute('SELECT empe_desc FROM empresas WHERE empe_rut='.$cotizacion->codigoComprador);\n \t\t$Comprante=$results->fetch('assoc');\n //cuando lo obtiene lo asigna a la cotizacion\n \t\t$cotizacion->codigoComprador = $Comprante['empe_desc'];\n \t\t$cotizacion->fechaCotizacion=$cotizacion->fechaCotizacion->i18nFormat('dd-MM-YYYY');\n \t\techo json_encode($cotizacion);\n \t}\n }", "function SEARCH(){\n\tif(!empty($this)){\n\t\t$sql = \"SELECT `idCategoria`, `genero`, `nivel`, `idCampeonato` FROM CATEGORIA WHERE(\n\t\t\t\t\t(idCategoria LIKE '%$this->idCategoria%') &&\n \t\t\t\t(genero LIKE '%$this->genero%') &&\n \t\t\t\t(nivel LIKE '%$this->nivel%') &&\n \t\t\t\t(idCampeonato LIKE '%$this->idCampeonato%'))\";\n\t}\t\n \t$result = $this->mysqli->query($sql); \n // var_dump($result);\n\t\t//exit();\n\tif($result->num_rows>0){\n\t\t//\n\t\t$j = 0;\n\t\twhile($tupla = mysqli_fetch_assoc($result)){\n\t\t $tuplas[$j] = $tupla;\n\t\t $j++;\t\t\n\t\t}\n\t\treturn $tuplas;\n\t}else{\n\t\treturn false;\n\t}\n}", "public function search() {\n\t\t\t$Recherches = $this->Components->load( 'WebrsaRecherchesFichesprescriptions93' );\n\t\t\t$Recherches->search();\n\t\t}", "public function searchAction(){\r\n \r\n $em =$this->container->get('doctrine')->getEntityManager();\r\n $pat = $em->getRepository('PidevMedecinBundle:Patient')->findAll();\r\n //Recherche par libelle\r\n $Request = $this->get('request');\r\n if ($Request->getMethod() == 'POST') {\r\n $search = $Request->get('search');\r\n // $Modeles = $em->getRepository('EspritParcBundle:Modele')->findBy(array(\"Libelle\"=> $search));\r\n $query = $em->createQuery('SELECT P\r\n FROM PidevMedecinBundle:Patient P\r\n WHERE P.nomPatient like :nomPatient')->setParameter('nomPatient', '%' . $search . '%');\r\n $pat = $query->getResult();\r\n }\r\n return $this->render('PidevMedecinBundle:Rdv:new.html.twig', array(\"pat\" => $pat));\r\n }", "public function find() {\n \tif ($this->request->is('ajax')) {\n //impide la creacion de vista\n \t\t$this->autoRender = false; \n //recibe el string con el termino a buscar\n \t\t$name = $this->request->query('term'); \n //busca en la base de datos todos los nombres parecidos \n \t\t$conn = ConnectionManager::get('copec');\n \t\t$results = $conn->execute('SELECT TA_BUSQUEDA, TA_NCORR FROM tallasnew WHERE TA_BUSQUEDA like \"%'.$name.'%\"');\n \t\t$resultArr = array();\n \t\t$Repuesto=$results->fetchAll('assoc');\n //cuando lo obtiene lo manda a la vista encondado como json\n \t\tforeach($Repuesto as $Repuesto) { \n \t\t\t$resultArr[] = array('label' =>$Repuesto['TA_BUSQUEDA'],'mid'=>$Repuesto['TA_NCORR']);\n \t\t}\n //envia la lsita encodad como json\n \t\techo json_encode($resultArr); \n \t} \n }", "function busqueda($queryExpandida){\n global $terminosConsulta,$q;\n busquedaSolr($queryExpandida);\n foreach($terminosConsulta as $key => $valor){\n $q = $q.\" \".$valor;\n }\n spellChecker();\n //suggestions($q);\n }", "function formulaires_inscription3_recherche_charger_dist(){\n\n\t$datas['ordre'] = _request('ordre');\n\t$datas['desc'] = _request('desc');\n\t$datas['case'] = _request('case');\n\t$datas['valeur'] = _request('valeur');\n\n\t$datas['exceptions'] = pipeline('i3_exceptions_des_champs_auteurs_elargis',array());\n\n\tif(_request('afficher_tous')){\n\t\tset_request('valeur','');\n\t\tset_request('case','');\n\t}\n\treturn $datas;\n}", "public function search(SearchFormRequest $request)\n\t{\n\t\t//\n\t\t//$lettres = Lettre::where('name','LIKE %'.$request.'%');\n\n\t\t$q = Input::get('query');\n\t\t$domaine_id = Input::get('domaine_id');\n\n \t\tif($q && $q != ''){\n \t\t$searchTerms = explode(' ', $q);\n \t\t$query = DB::table('lettres'); \n\n \t\tif(!empty($searchTerms)){\n\n \t\t\tforeach($searchTerms as $term) {\n \t\t\t$query->where('description', 'LIKE', '%'. $term .'%')->orWhere('name', 'LIKE', '%'. $term .'%')->where('domaine_id',$domaine_id);\n \t\t\t}\n \t\t}\n \t\t$results = $query->paginate(10);\n\n \t\t//dd($results); \n \t\t}\n \t$domaines = Domaine::all();\n \t$sort = (isset($_GET['sort'])) ? $_GET['sort'] : 'name';\n\t\t$sens = (isset($_GET['sens'])) ? $_GET['sens'] : 'ASC';\n\t\t//$lettres = Lettre::where('domaine_id',$id)->orderBy($sort, $sens)->paginate(10);\n\t\treturn view('admin.adminlettrelist')->with('domaines',$domaines)->with('results',$results)->with('sort',$sort)->with('sens',$sens)->with('id',$domaine_id);\n \t//echo $request->query;die();\n\n\t}", "public function getCiudades( $search, $municipio='', $return='array') {\n \t\n\t\ttry \n\t\t{ \n\t\t if(strlen($return)==0) return false;\t\t\n\t\t\n\t\t $sql = \"\t\n\t\t SELECT l.id_localidad AS id ,\n\t\t\t l.d_localidad AS value ,\n\t\t\t\t\tCONCAT(initcap(m.d_municipio),', ',initcap(e.d_estado)) AS info\n\t\t\t FROM cat_localidad l, cat_municipios m, cat_estados e\n\t\t\t WHERE l.id_municipio = m.id_municipio_inegi\n\t\t\t AND m.id_estado = e.id_estado\n\t\t\t\tAND l.d_localidad LIKE '%$search%'\";\t\t\t \n\t\t\t \n\t\t\t if(strlen($municipio) > 0){\n\t\t\t $sql.=\" AND l.id_municipio = '\".$municipio.\"' \";\n\t\t\t }\n\t\t\t $sql.= \"\n\t\t\t ORDER BY d_localidad\n\t\t\t LIMIT 10\t\t\t \n\t\t\t \";\n\t\t \t \n\t\t\t $rs = $this->db->Execute($sql);\t\t\t \n\t\t\t \n\t\t\t if ($return=='array'){\n\t\t\t\t $rows = $rs->GetAll();\n\t\t\t $rs->Close();\n\t\t\t\t return $rows;\n\t\t\t }elseif($return=='pipe'){\n\t\t\t $str = '';\n\t\t\t\t while($row = $rs->FetchRow()){\n\t $str.= $row['descrip'].\"|\".$row['clave'].\"\\n\";\n\t }\n\t\t\t\t return $str;\t\t \n\t\t\t }\n\t\t\t \n\t\t\t \n\t\t}catch(Exception $e){\t\t \n\t\t\t$this->setError($e->getCode(), $e->getMessage());\n\t\t\tthrow new Exception( $e->getMessage() , $e->getCode() );\t\n\t\t}\t\t\t\t\n }", "function traercampos($bd,$entidad,$campo,$filtro,$valor_busqueda)\n\t{\n\t\t$rcsusuariotemp = new Recordset();\n\t\tif (!empty($bd)) $rcsusuariotemp->bd = $bd;\n\t\t$consulta = \"SELECT \" . $campo . \" FROM \" . $entidad . \" where \" . $filtro . \" = '\" . $valor_busqueda . \"'\";\n\t\t$rcsusuariotemp->sql = $consulta;\n\t\t$rcsusuariotemp->abrir();\n\t\t$rcsusuariotemp->siguiente();\n\t\treturn trim($rcsusuariotemp->fila[$campo]);\n\t\t$rcsusuariotemp->cerrar();\n\t}", "public function autoCompletadoPais($search)\n\t{\n\t\t$this->db->select('\n\t\t\tctipo as id,\n\t\t\tdregistro as text,\n\t\t\t*\n\t\t');\n\t\t$this->db->from('ttabla');\n\t\t$this->db->where('ctabla', 11);\n\t\t$this->db->where('sregistro', 'A');\n\t\t$this->db->like('dregistro', $search);\n\t\t$this->db->order_by('dregistro', 'ASC');\n\t\t$this->db->limitAnyWhere(LIMITE_AUTOCOMPLETADO);\n\t\t$query = $this->db->get();\n\t\tif (!$query) {\n\t\t\treturn [];\n\t\t}\n\t\treturn ($query->num_rows() > 0) ? $query->result() : [];\n\t}", "private function buscadorVista($busqueda){\n\n $band = 0;\n $_SERVER['REQUEST_URI'] = str_replace(\"pagina\",\"\", $_SERVER['REQUEST_URI'] );\n if(!array_key_exists('where',$this->sentenciasQuery)){\n\n $this->sentenciasQuery['where']=\" \";\n }else{\n $band=1;\n $this->sentenciasQuery['where']=\"(\".$this->sentenciasQuery['where'].\") and (\";\n }\n $contadorFiltroFecha=0;\n if($this->filtroFecha){\n if(is_string($this->filtroFecha)){\n\n if(!empty($_POST['ctrlBusqDesde'])){\n\n $this->sentenciasQuery['where'].=\"\".$this->filtroFecha.\" >= '\".FechaHora::fechaInvertida($_POST['ctrlBusqDesde']).\"'\";\n ++$contadorFiltroFecha;\n }\n\n if(!empty($_POST['ctrlBusqHasta'])){\n if($contadorFiltroFecha>0) $this->sentenciasQuery['where'].=\" and \";\n $this->sentenciasQuery['where'].=$this->filtroFecha.\" <= '\".FechaHora::fechaInvertida($_POST['ctrlBusqHasta']).\"'\";\n ++$contadorFiltroFecha;\n }\n }\n\n }\n if(is_array($this->camposBusqueda)){\n if(count($this->camposBusqueda)>0){\n if($contadorFiltroFecha>0){\n $this->sentenciasQuery['where'] .=\" and (\";\n }\n $i=0;\n foreach ($this->camposBusqueda as $key => $campo) {\n if($i>0)\n $this->sentenciasQuery['where'].=\" or \";\n $this->sentenciasQuery['where'].=\" $campo like '%$busqueda%' \";\n $i++;\n }\n }else{\n throw new Exception(\"No se han definido campos de busqueda para la vista $this->nombreVista\", 1);\n\n }\n if($band==1){\n $this->sentenciasQuery['where'].=\")\";\n }\n if($contadorFiltroFecha>0){\n $this->sentenciasQuery['where'] .=\")\";\n }\n }else{\n throw new Exception(\"El atributo camposBusqueda no está definido como arreglo\", 1);\n\n }\n\n $this->consultaBD = $this->consultaBD;\n $this->prepareConsulta();\n return $this->crearVista();\n }", "function Filtros_Listar_EstadosOrdenProduccion()\n {\n $Helper=new htmlhelper; $TipoTxt=new TipoTextBox; $index=0;\n $inputs=array(\n \"Nombre\" => $Helper->textbox(\"fil_txtNombreEstadoOrdenProduccion\",++$index,\"\",128,150,$TipoTxt->texto,\"\",\"\",\"\",\"textoInput\") \n );\n $buttons=array($Helper->button(\"btnBuscarEstadoOrdenProduccion\",\"Buscar\",70,\"Buscar_Grilla('configuracion','Grilla_Listar_EstadoOrdenProduccion','tbl_listaresultados','','td_General')\",\"textoInput\"));\n $html = '<fieldset class=\"textoInput\"><legend align= \"left\">Filtros de b&uacute;squeda</legend>';\n $html .= $Helper->Crear_Layer(\"tbl_listaresultados\",$inputs,$buttons,3,990,\"\",\"\");\n $html .='</fieldset>';\n return $html;\n }", "public function consulta() {\n if ($this->Form->parameters) {\n $page=($this->Form->parameters[0])?$this->Form->parameters[0]:1;\n $criterio=$this->Form->busqueda;\n $paged=$this->Form->conPaginacion;\n } else {\n $criterio=\"\";\n $page=1;\n $paged=true;\n }\n if ($paged) {\n $rows=$this->modeloContactos->buscarCaulquierPaginado($criterio,$page,15);\n $this->jQ(\"#paging\")->html($this->paginacion($page));\n } else {\n $rows=$this->modeloContactos->buscarCaulquier($criterio);\n $this->jQ(\"#paging\")->empty();\n }\n $cuerpo=\" \";\n if (!$rows) {\n $this->jWarning(\"No hay resultados de la busqueda\");\n return false;\n }\n $cuerpo=$this->preparaTabla($rows);\n // Modifica las filas de la consulta por jquery. Solo a peticion desde la vista con APJSubmit\n $this->jQ(\"#cuerpo\")->html($cuerpo);\n // Retorna la filas de la consulta al controlador para que genere la vista, llamdado desde la vista con APJ:{consulta(1)}\n return $cuerpo;\n }", "protected function _getSearchData() {}", "function cari($cari) {\n $query = \"SELECT * FROM pelanggan WHERE NAMA_PELANGGAN LIKE '%$cari%' OR NIK LIKE '%$cari%' OR ALAMAT_PELANGGAN LIKE '%$cari%' OR NOHP_PELANGGAN LIKE '%$cari%' OR EMAIL_PELANGGAN LIKE '%$cari%'\";\nreturn Data_plg($query);\n}", "public function Busqueda_General(){\n $Id_Area_Consulta = Session::Get('Id_Area_Consulta');\n $Texto_Busqueda = General_Functions::Validar_Entrada('texto_busqueda','TEXT');\n $Tipo_Busqueda = General_Functions::Validar_Entrada('tipo_busqueda','TEXT');\n $pagina = General_Functions::Validar_Entrada('Pagina','NUM');\n\n if ( strlen($Texto_Busqueda) > 0 ){\n $this->View->SetCss(array('tron_carrito' , 'tron_productos_categorias_marcas','tron_estilos-titulos_destacados_novedades_ofertas','tron_varias_referencias-ofertas-tecnologias_SA'));\n $this->View->SetJs(array('tron_productos.jquery','tron_carrito','tron_marcas_categorias','mostrar_tabla_carrito'));\n $this->View->Productos = $this->Productos->Busqueda_General($Texto_Busqueda, $Tipo_Busqueda);\n $this->View->Productos_Pagina = $this->Paginador->Paginar($this->View->Productos, $pagina);\n $this->View->Paginacion = $this->Paginador->Mostrar_Paginacion('paginador_ajax');\n Session::Set('nom_categoria','');\n $this->View->Mostrar_Vista('resultado_busqueda');\n\n }\n\n }", "public function actionSearchCandidates(){\n if ($this->isGuest || ($this->checkPermission('candidates:admin') !== true)){ \n\t\t\theader('HTTP/1.0 403 Forbidden');\n\t\t\t$this->render(\"errors\", \n\t\t\t\t[\n\t\t\t\t\"code\"=> \"403\",\n\t\t\t\t\"title\"=> \"Acceso denegado\",\n\t\t\t\t\"description\" => \"\",\n\t\t\t]); exit();\t\n\t\t}\n\t\t$error = isset($_GET['searchText']) ? false : true;\n\t\t$text = isset($_GET['searchText']) ? $_GET['searchText'] : \"\";\n\t\t$items = array();\n\t\t$returning = (object) [\n\t\t\t'error' \t=> $error,\n\t\t\t'text' => $text,\n\t\t\t'records' => $items,\n\t\t];\n\t\t\n\t\tif ($error === false){\n\t\t\t// \"Busqueda 1\"\n\t\t\t$sql = \"SELECT * FROM `candidates` \n\t\t\tWHERE \n\t\t\t\t`identification_number` LIKE '%{$text}%' \n\t\t\t\tOR `names` LIKE '%{$text}%' \n\t\t\t\tOR `surname` LIKE '%{$text}%' \n\t\t\t\tOR `address` LIKE '%{$text}%' \n\t\t\t\tOR `salary` LIKE '%{$text}%' \n\t\t\t\tOR `email` LIKE '%{$text}%' \n\t\t\t\tOR `phone` LIKE '%{$text}%' \n\t\t\t\tOR `mobile` LIKE '%{$text}%' \n\t\t\t\tOR `notes` LIKE '%{$text}%'\";\n\t\t\t$conn = new EntidadBase('candidates', $this->adapter);\n\t\t\t$data = $conn->getSQL($sql);\n\t\t\t$records1 = [];\n\t\t\tforeach($data as $candidate){\n\t\t\t\t$candidate = is_array($candidate) ? (object) $candidate : $candidate;\n\t\t\t\t//$returning->records[] = $candidate->id;\n\t\t\t\tif(!isset($records1[$candidate->id])){\n\t\t\t\t\t$records1[] = $candidate->id;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// \"Busqueda 2\" - Dentro de experiencia\n\t\t\t$sql2 = \"SELECT * FROM `candidates_experience` \n\t\t\tWHERE \n\t\t\t\t`business` LIKE '%{$text}%' \n\t\t\t\tOR `position` LIKE '%{$text}%' \n\t\t\t\tOR `functions` LIKE '%{$text}%' \";\n\t\t\t$conn2 = new EntidadBase('candidates_experience', $this->adapter);\n\t\t\t$data2 = $conn2->getSQL($sql2);\n\t\t\t$records2 = [];\n\t\t\tforeach($data2 as $experience){\n\t\t\t\t$experience = is_array($experience) ? (object) $experience : $experience;\n\t\t\t\tif(!isset($records2[$experience->candidate])){\n\t\t\t\t\t$records2[] = $experience->candidate;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$returning->records = array_merge(array_unique(array_merge($records1, $records2)), array());\n\t\techo json_encode($returning);\n\t\treturn json_encode($returning);\n\t}", "function form($searchString)\r\n {\r\n \tif (session::get(\"hyrarchy\")) echo \"<div id='search' class='search'>\";\r\n \telse echo \"<div id='searchbig' class='search'>\";\r\n\r\n\r\n echo \"<form method='GET' action='index.php' name='search'>\";\r\n echo \"<b>Suche in</b><br>\";\r\n \r\n// Freie Suche\r\n if (!session::get(\"searchstart\") and !session::get(\"searchexact\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n \r\n echo form::field(\"radio\",\"searchtype\",0,\"\",$checkString,\"\",\"frei\",\"search-free\");\r\n \r\n// Suche am Wortanfang\r\n if (session::get(\"searchstart\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n\r\n echo form::field(\"radio\",\"searchtype\",1,\"\",$checkString,\"\",\"Wortanfang\",\"search-start\");\r\n\r\n// exakte Suche\r\n if (session::get(\"searchexact\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n\r\n echo form::field(\"radio\",\"searchtype\",2,\"\",$checkString,\"\",\"exact\",\"search-exact\");\r\n\r\n\r\n// search in comment field\r\n if (session::get(\"searchcom\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n echo form::field(\"checkbox\",\"searchcom\",1,\"\",$checkString,\"\",\"Erl&auml;uterungen\",\"search-comment\");\r\n\r\n\r\n // search only for ordered entries\r\n // create array for selector\r\n $typeArray = thesaurus::get_type_list();\r\n $statusArray = thesaurus::get_status_list();\r\n $ownerArray = user::get_users(\"entry\");\r\n\r\n if (count($statusArray))\r\n {\r\n echo \"<br>\";\r\n echo form::selector(\"searchentrytype\",$typeArray,1,\"\",session::get(\"searchentrytype\"),\"\",\" Begriffstype \",\"searchtype\",\"\");\r\n echo form::selector(\"searchstatus\",$statusArray,1,\"\",session::get(\"searchstatus\"),\"\",\" Status \",\"searchstatus\",\"\");\r\n echo form::selector(\"searchowner\",$ownerArray,1,\"\",session::get(\"searchowner\"),\"\",\" Eigentümer mit Einträgen \",\"searchowner\",\"\");\r\n }\r\n else\r\n echo form::link(\"\",\"<span class='small'>Keine beantragten Einträge</span>\",\"\",\"no-ordered\");\r\n \r\n\r\n// search field\r\n echo \"<p><input type='text' size='35' name='searchString' value='\" . session::get(\"search\") . \"' \";\r\n echo help::show(\"search-field\",\"\");\r\n echo \">\";\r\n\r\n \r\n echo form::field(\"submit\",\"action\",\"suchen\",\"\",\"\",\" \",\"\",\"search\");\r\n echo form::field(\"submit\",\"reset\",\"zurücksetzen\",\"\",\"\",\" \",\"\",\"newsearch\");\r\n echo \"</form></p>\";\r\n echo \"</div>\";\r\n }", "function do_search() {\n $sql['query'] = array();\n $sql['data'] = '';\n \n if (isset($_POST['custid']) && $_POST['custid']) {\n $sql['query'][] .= '`custid` LIKE ?';\n $sql['data'][] = \"{$_POST['custid']}%\";\n unset($_POST['custid']);\n }\n \n if (isset($_POST['email']) && $_POST['email']) {\n $sql['query'][] .= '`email` = ?';\n $sql['data'][] = $_POST['email'];\n unset($_POST['email']);\n }\n \n $glue = isset($_POST['match_all']) ? ' AND ' : ' OR ';\n $prefix = $_POST['search_type'];\n \n unset($_POST['match_all']);\n unset($_POST['search_type']);\n \n foreach ($_POST as $key => $field) {\n if ($field) {\n $sql['query'][] .= \"`$prefix$key` = ?\";\n $sql['data'][] = $field; \n }\n }\n \n $sql['query'] = implode($glue,$sql['query']);\n \n $this->SC->CP->load_view('customers/view_results',array(\n 'customers'=>\\Model\\Customer::all(array('conditions'=>array_merge((array) $sql['query'],$sql['data'])))\n )); \n \n }", "public static function search();", "function SEARCH()\n{\n $sql = \"select * from CLASH \";\n\n // si se produce un error en la busqueda mandamos el mensaje de error en la consulta\n if (!($resultado = $this->bd->query($sql))){\n\t\treturn 'Error en la consulta sobre la base de datos';\n\t}\n else{ // si la busqueda es correcta devolvemos el recordset resultado\n\t\treturn $resultado;\n\t}\n\n\n}", "function fnBuscaRelacionamentos($tabela,$strSecao) {\n\tglobal $conexao;\n\t\n\t$query = \"SELECT\n\t\t\t\t\ttb_secao_bn_id,\n\t\t\t\t\tbn_secao,\n\t\t\t\t\tbt_tabela,\n\t\t\t\t\tbt_campo\n\t\t\t\tFROM\n\t\t\t\t\ttb_secao_relacionamento\n\t\t\t\tWHERE\n\t\t\t\t\ttb_secao_bn_id = '\".$strSecao.\"'\n\t\t\t\tGROUP BY\n\t\t\t\t\tbt_campo\"; /* WHERE ~ OR bn_secao = '\".$strSecao.\"' */\n\t$rs\t= $conexao->query($query);\n\tif(!DB::isError($rs)) {\n\t\t$arrCamposRel = array();\n\t\twhile($ob = $rs->fetchRow()) {\n\t\t\t// Define o nome da tabela relacionada\n\t\t\t#$strTabelas = substr($ob->bt_tabela,6,strlen($ob->bt_tabela)-6);\n\t\t\t$arrTabelas = explode('_tb_',str_replace('tb_rel_tb_','',$ob->bt_tabela));\n\t\t\t\n\t\t\tif($ob->tb_secao_bn_id == $ob->bn_secao) {\n\t\t\t\t$arrTabelas[0] = str_replace('_parent','',$arrTabelas[0]);\n\t\t\t\t$arrTabelas[1] = str_replace('_child','',$arrTabelas[1]);\n\t\t\t}\n\t\t\t\n\t\t\tif('tb_conteudo_'.$arrTabelas[0] == $tabela) {\n\t\t\t\t$strTabelas = 'tb_conteudo_'.$arrTabelas[1];\n\t\t\t}\n\t\t\tif('tb_conteudo_'.$arrTabelas[1] == $tabela) {\n\t\t\t\t$strTabelas = 'tb_conteudo_'.$arrTabelas[0];\n\t\t\t}\n\t\t\t\n\t\t\t// Define o ID da seo relacionada\n\t\t\tif($ob->tb_secao_bn_id == $strSecao) {\n\t\t\t\t$strSecaoRel = $ob->bn_secao;\n\t\t\t} elseif($ob->bn_secao == $strSecao) {\n\t\t\t\t$strSecaoRel = $ob->tb_secao_bn_id;\n\t\t\t}\n\t\t\t\n\t\t\t// Seta o prefixo para o ALIAS dos campos da tabela relacionada\n\t\t\t//$strPrefixo = str_replace('tb_conteudo_','tb_',$strTabelas).'_';\n\t\t\t\n\t\t\t$arrCamposRel[$ob->bt_campo]['id']\t = $strSecaoRel;\n\t\t\t$arrCamposRel[$ob->bt_campo]['tabela'] = $strTabelas;\n\t\t\t$arrCamposRel[$ob->bt_campo]['tabelaRel'] = $ob->bt_tabela;\n\t\t\t$arrCamposRel[$ob->bt_campo]['campos'] = fnBuscaCampos($strSecaoRel);\n\t\t\t\n\t\t\t/**********************************************************************/\n\t\t\t/**********************************************************************/\n\t\t\t/***\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t***/\n\t\t\t/*** FALTA BUSCAR OS CAMPOS DE RELACIONAMENTO DA TABELA RELACIONADA ***/\n\t\t\t/***\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t***/\n\t\t\t/**********************************************************************/\n\t\t\t/**********************************************************************/\n\t\t}\n\t\tunset($query,$rs,$ob);\n\t\t\n\t\treturn $arrCamposRel;\n\t} else {\n\t\treturn false;\n\t}\n}", "public function searchPrint()\n {\n // should not be searched.\n\n $criteria=new CDbCriteria;\n\t\t$criteria->compare('anamesadiet_id',$this->anamesadiet_id);\n\t\t$criteria->compare('pasien_id',$this->pasien_id);\n\t\t$criteria->compare('pasienadmisi_id',$this->pasienadmisi_id);\n\t\t$criteria->compare('ruangan_id',$this->ruangan_id);\n\t\t$criteria->compare('jeniswaktu_id',$this->jeniswaktu_id);\n\t\t$criteria->compare('bahanmakanan_id',$this->bahanmakanan_id);\n\t\t$criteria->compare('pegawai_id',$this->pegawai_id);\n\t\t$criteria->compare('pendaftaran_id',$this->pendaftaran_id);\n\t\t$criteria->compare('pekerjaan_id',$this->pekerjaan_id);\n\t\t$criteria->compare('menudiet_id',$this->menudiet_id);\n\t\t$criteria->compare('LOWER(tglanamesadiet)',strtolower($this->tglanamesadiet),true);\n\t\t$criteria->compare('LOWER(keterangan)',strtolower($this->keterangan),true);\n\t\t$criteria->compare('LOWER(katpekerjaan)',strtolower($this->katpekerjaan),true);\n\t\t$criteria->compare('beratbahan',$this->beratbahan);\n\t\t$criteria->compare('LOWER(urt)',strtolower($this->urt),true);\n\t\t$criteria->compare('energikalori',$this->energikalori);\n\t\t$criteria->compare('protein',$this->protein);\n\t\t$criteria->compare('lemak',$this->lemak);\n\t\t$criteria->compare('hidratarang',$this->hidratarang);\n\t\t$criteria->compare('LOWER(create_time)',strtolower($this->create_time),true);\n\t\t$criteria->compare('LOWER(update_time)',strtolower($this->update_time),true);\n\t\t$criteria->compare('LOWER(create_loginpemakai_id)',strtolower($this->create_loginpemakai_id),true);\n\t\t$criteria->compare('LOWER(update_loginpemakai_id)',strtolower($this->update_loginpemakai_id),true);\n\t\t$criteria->compare('LOWER(create_ruangan)',strtolower($this->create_ruangan),true);\n\t\t$criteria->compare('ahligizi',$this->ahligizi);\n // Klo limit lebih kecil dari nol itu berarti ga ada limit \n $criteria->limit=-1; \n\n return new CActiveDataProvider($this, array(\n 'criteria'=>$criteria,\n 'pagination'=>false,\n ));\n }", "private function buscapropiedad($array,$param,$search){\n ///param es la relacion a buscar por ejemplo usuarios.roles \n ///seaarch es que buscamos en ese ejemplo se buscaria admin en usarios.roles puede ser un permiso en userios.permisos\n $nuevoarray=[];\n for($a=0;$a<count($array);$a++){\n \n for($b=0;$b<count($array[$a]->$param);$b++){\n if($array[$a]->$param[$b]['name']==$search){\n array_push($nuevoarray,$array[$a]);\n }\n }\n }\n return $nuevoarray;\n}", "public static function busquedaMedico($text='',$area=null){\n $text='%'.htmlentities($text).'%';\n if (Session::valid_session()) {\n $paciente=$_SESSION['id'];\n if (is_numeric($area) and $area>=1) {\n $query=\"SELECT m.`id`, m.`nombre`, `cedula`, `area`, `estatus`, `correo`,a.nombre as 'nombre_area',DATE_FORMAT(fecha_registro,'%d/%b/%Y') AS 'fecha_registro'\n FROM `medicos` m\n inner join soport16_chatdoc.areas a on m.area=a.id\n WHERE m.`nombre` LIKE ? AND m.`area`=?\n ORDER BY id DESC\";\n $results=resultados_query($query,'si',$text,$area);\n \n } else {\n $query=\"SELECT m.`id`, m.`nombre`, `cedula`, `area`, `estatus`, `correo`,a.nombre as 'nombre_area',DATE_FORMAT(fecha_registro,'%d/%b/%Y') AS 'fecha_registro'\n FROM `medicos` m\n inner join soport16_chatdoc.areas a on m.area=a.id\n WHERE m.`nombre` LIKE ?\n ORDER BY id DESC\";\n $results=resultados_query($query,'s',$text);\n \n }\n $cant=mysqli_num_rows($results);\n if ($cant>=1) {\n $hilos = array();\n $hilos['cantidad']=$cant;\n while ($r=mysqli_fetch_array($results)) {\n $hilos['registros'][$r['id']]= array(\n 'nombre' => $r['nombre']\n ,'correo' => $r['correo']\n ,'cedula' => $r['cedula']\n ,'fecha' => $r['fecha_registro']\n ,'nombre_area' => $r['nombre_area']\n ,'num_area' => $r['area']\n ,'estatus' => $r['estatus']\n );}\n return $hilos;\n } else {\n return 0;\n }\n } else {\n return -4;\n }\n\n /*\n foreach:\n [idHilo]={area, estatus,motivo}\n */\n }", "function ciniki_merchandise_productSearch($ciniki) {\n //\n // Find all the required and optional arguments\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs');\n $rc = ciniki_core_prepareArgs($ciniki, 'no', array(\n 'tnid'=>array('required'=>'yes', 'blank'=>'no', 'name'=>'Tenant'),\n 'start_needle'=>array('required'=>'yes', 'blank'=>'no', 'name'=>'Search String'),\n 'limit'=>array('required'=>'no', 'blank'=>'yes', 'name'=>'Limit'),\n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $args = $rc['args'];\n\n //\n // Check access to tnid as owner, or sys admin.\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'merchandise', 'private', 'checkAccess');\n $rc = ciniki_merchandise_checkAccess($ciniki, $args['tnid'], 'ciniki.merchandise.productList');\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n\n //\n // Get the list of products\n //\n $strsql = \"SELECT ciniki_merchandise.id, \"\n . \"ciniki_merchandise.code, \"\n . \"ciniki_merchandise.name, \"\n . \"ciniki_merchandise.permalink, \"\n . \"ciniki_merchandise.status, \"\n . \"ciniki_merchandise.sequence, \"\n . \"ciniki_merchandise.flags, \"\n . \"ciniki_merchandise.unit_amount, \"\n . \"ciniki_merchandise.unit_discount_amount, \"\n . \"ciniki_merchandise.unit_discount_percentage, \"\n . \"ciniki_merchandise.taxtype_id, \"\n . \"ciniki_merchandise.inventory, \"\n . \"ciniki_merchandise.shipping_other, \"\n . \"ciniki_merchandise.shipping_CA, \"\n . \"ciniki_merchandise.shipping_US, \"\n . \"ciniki_merchandise.primary_image_id, \"\n . \"ciniki_merchandise.synopsis, \"\n . \"ciniki_merchandise.description \"\n . \"FROM ciniki_merchandise \"\n . \"WHERE ciniki_merchandise.tnid = '\" . ciniki_core_dbQuote($ciniki, $args['tnid']) . \"' \"\n . \"\";\n if( ciniki_core_checkModuleFlags($ciniki, 'ciniki.merchandise', 0x01) ) {\n $strsql .= \"AND (code LIKE '\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR code LIKE '% \" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR name LIKE '\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR name LIKE '% \" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \") \";\n } else {\n $strsql .= \"AND (name LIKE '\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR name LIKE '% \" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \") \";\n }\n if( isset($args['limit']) && is_numeric($args['limit']) && $args['limit'] > 0 ) {\n $strsql .= \"LIMIT \" . ciniki_core_dbQuote($ciniki, $args['limit']) . \" \";\n } else {\n $strsql .= \"LIMIT 25 \";\n }\n\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryArrayTree');\n $rc = ciniki_core_dbHashQueryArrayTree($ciniki, $strsql, 'ciniki.merchandise', array(\n array('container'=>'products', 'fname'=>'id', \n 'fields'=>array('id', 'code', 'name', 'permalink', 'status', 'sequence', 'flags', 'unit_amount', 'unit_discount_amount', 'unit_discount_percentage', 'taxtype_id', 'inventory', 'shipping_other', 'shipping_CA', 'shipping_US', 'primary_image_id', 'synopsis', 'description')),\n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n if( isset($rc['products']) ) {\n $products = $rc['products'];\n foreach($products as $pid => $product) {\n if( ciniki_core_checkModuleFlags($ciniki, 'ciniki.merchandise', 0x01) && $product['code'] != '' ) {\n $products[$pid]['display_name'] = $product['code'] . ' - ' . $product['name'];\n } else {\n $products[$pid]['display_name'] = $product['name'];\n }\n }\n } else {\n $products = array();\n }\n\n return array('stat'=>'ok', 'products'=>$products);\n}" ]
[ "0.63926727", "0.61592174", "0.6078278", "0.603647", "0.60273373", "0.6025336", "0.6023707", "0.60127693", "0.6008439", "0.59847194", "0.5947041", "0.5936034", "0.59335697", "0.59236795", "0.5909534", "0.5888453", "0.5855509", "0.5851008", "0.58506024", "0.58473057", "0.5836148", "0.58300954", "0.58228374", "0.58130985", "0.5801012", "0.57973003", "0.57972413", "0.57957405", "0.5786444", "0.57802993" ]
0.65653986
0
Obtiene el catalogo de tipos de calles $search string : palabra a buscar $return string : Forma en que debe de devolver los datos
public function getTCalles( $search, $return='array') { try { if(strlen($return)==0) return false; $sql = " SELECT id_clase_calle AS clave , d_clase_calle AS descrip FROM cat_clase_calle WHERE d_clase_calle LIKE '%$search%' ORDER BY d_clase_calle LIMIT 10"; $rs = $this->db->Execute($sql); if ($return=='array'){ $rows = $rs->GetAll(); $rs->Close(); return $rows; }elseif($return=='pipe'){ $str = ''; while($row = $rs->FetchRow()){ $str.= $row['descrip']."|".$row['clave']."\n"; } return $str; } }catch(Exception $e){ $this->setError($e->getCode(), $e->getMessage()); throw new Exception( $e->getMessage() , $e->getCode() ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getCalles( $search, $return='array') {\n \t\n\t\ttry \n\t\t{ \n\t\t if(strlen($return)==0) return false;\t\t\n\t\t\n\t\t $sql = \"\t\n\t\t SELECT id_calle AS clave ,\n\t\t\t nombre As descrip \n\t\t\t FROM cat_calles\n\t\t\t WHERE nombre LIKE '%$search%' \n\t\t\t LIMIT 10\";\n\t\t \t \n\t\t\t $rs = $this->db->Execute($sql);\t\t\t \n\t\t\t \n\t\t\t if ($return=='array'){\n\t\t\t\t $rows = $rs->GetAll();\n\t\t\t $rs->Close();\n\t\t\t\t return $rows;\n\t\t\t }elseif($return=='pipe'){\n\t\t\t $str = '';\n\t\t\t\t while($row = $rs->FetchRow()){\n\t $str.= $row['descrip'].\"|\".$row['clave'].\"\\n\";\n\t }\n\t\t\t\t return $str;\t\t \n\t\t\t }\n\t\t\t \n\t\t\t \n\t\t}catch(Exception $e){\t\t \n\t\t\t$this->setError($e->getCode(), $e->getMessage());\n\t\t\tthrow new Exception( $e->getMessage() , $e->getCode() );\t\n\t\t}\t\t\t\t\n }", "public function getSearchRe($field1,$field2,$date){\n $sql = \"SELECT a.IdBitacora, a.Foliorequisicion, DATE_FORMAT(a.FechaRecepcion,'%d/%m/%Y') as FechaRecepcion, DATE_FORMAT(a.FechaReporte,'%d/%m/%Y') as FechaReporte, a.IdDep, a.IdSolicitante,a.Comentario,\n a.Concepto, FORMAT(a.Costo, 2) AS Costo,a.Estatus, DATE_FORMAT(a.FechaAutorizacion,'%d/%m/%Y') as FechaAutorizacion, a.Estado, DATE_FORMAT(a.FechaAatencion,'%d/%m/%Y') as FechaAatencion , a.Archivo,d.nombreDepto,s.Subfijo,s.Nombre,s.A_paterno,s.A_materno\n FROM \" .self::$tablename. \" as a INNER JOIN departamento as d ON a.IdDep=d.idDepart\n INNER JOIN jefe_area as s ON a.IdSolicitante=s.IdJefe WHERE {$field1} LIKE '%{$date}%' OR {$field2} LIKE '%{$date}%'\";\n return Executor::doit($sql);\n\n }", "function Filtros_Listar_EstadosOrdenProduccion()\n {\n $Helper=new htmlhelper; $TipoTxt=new TipoTextBox; $index=0;\n $inputs=array(\n \"Nombre\" => $Helper->textbox(\"fil_txtNombreEstadoOrdenProduccion\",++$index,\"\",128,150,$TipoTxt->texto,\"\",\"\",\"\",\"textoInput\") \n );\n $buttons=array($Helper->button(\"btnBuscarEstadoOrdenProduccion\",\"Buscar\",70,\"Buscar_Grilla('configuracion','Grilla_Listar_EstadoOrdenProduccion','tbl_listaresultados','','td_General')\",\"textoInput\"));\n $html = '<fieldset class=\"textoInput\"><legend align= \"left\">Filtros de b&uacute;squeda</legend>';\n $html .= $Helper->Crear_Layer(\"tbl_listaresultados\",$inputs,$buttons,3,990,\"\",\"\");\n $html .='</fieldset>';\n return $html;\n }", "function Filtros_Listar_EstadosOrdenCompra()\n {\n $Helper=new htmlhelper; $TipoTxt=new TipoTextBox; $index=0;\n $inputs=array(\n \"Nombre\" => $Helper->textbox(\"fil_txtNombreEstadoOrdenCompra\",++$index,\"\",128,150,$TipoTxt->texto,\"\",\"\",\"\",\"textoInput\") \n );\n $buttons=array($Helper->button(\"btnBuscarEstadoOrdenCompra\",\"Buscar\",70,\"Buscar_Grilla('configuracion','Grilla_Listar_EstadoOrdenCompra','tbl_listaresultados','','td_General')\",\"textoInput\"));\n $html = '<fieldset class=\"textoInput\"><legend align= \"left\">Filtros de b&uacute;squeda</legend>';\n $html .= $Helper->Crear_Layer(\"tbl_listaresultados\",$inputs,$buttons,3,990,\"\",\"\");\n $html .='</fieldset>';\n return $html;\n }", "function displaySearch() {\r\n\t\t// Get the template\r\n\t\t$this->templateCode = $this->cObj->fileResource($this->conf['template.']['search']);\r\n\t\tif (is_null($this->templateCode)) {\r\n\t\t\treturn $this->pi_getLL('template_not_found');\r\n\t\t}\r\n\r\n\t\t// Get the parts out of the template\r\n\t\t$template['total'] = $this->cObj->getSubpart($this->templateCode, '###TEMPLATE###');\r\n\r\n\t\t// Get all the labels and the form data\r\n\t\t$markerArray = $this->getLabels() + $this->getFormData();\r\n\r\n\t\treturn $this->cObj->substituteMarkerArrayCached($template['total'], $markerArray);\r\n\t}", "function urlsearch($type_search = 0){\n\t\t$str = '';\n\t\t$str = '<form action=\"' . $_SERVER['SCRIPT_NAME'] . '\" methor=\"get\" name=\"form_search\" onsubmit=\"check_form_submit(this); return false\">';\n\t\t$str .= '<input type=\"hidden\" name=\"search\" id=\"search\" value=\"1\" />';\n\t\t$str .= '<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr>';\n\n\t\t// Show nút search ở đầu\n\t\tif($type_search == 1){\n\t\t\t$str .= '<td>&nbsp;<input type=\"submit\" class=\"btn btn-sm btn-info\" value=\"' . translate_text(\"Tìm kiếm\") . '\"></td>';\n\t\t}\n\n\t\tforeach($this->arraySearch as $key=>$field){\n\t\t\tswitch($this->arrayType[$key]){\n\n\t\t\t\tcase \"string\":\n\t\t\t\tcase \"text\":\n\t\t\t\t\t$value = getValue($field,\"str\",\"GET\", $this->arrayLabel[$key]);\n\t\t\t\t\t$str .= '<td class=\"text\">' . $this->arrayLabel[$key] . '</td><td><input type=\"text\" class=\"form-control\" ' . $this->arrayAttribute[$key] . ' name=\"' . $field . '\" id=\"' . $field . '\" onfocus=\"if(this.value==\\'' . $this->arrayLabel[$key] . '\\') this.value=\\'\\'\" onblur=\"if(this.value==\\'\\') this.value=\\'' . $this->arrayLabel[$key] . '\\'\" value=\"' . $value . '\"></td>';\n\t\t\t\tbreak;\n\t\t\t\tcase \"numbernotedit\":\n\t\t\t\t\t$value = getValue($field,\"str\",\"GET\",$this->arrayLabel[$key]);\n\t\t\t\t\t$str .= '<td class=\"text\">' . $this->arrayLabel[$key] . '</td><td><input type=\"text\" class=\"form-control\" ' . $this->arrayAttribute[$key] . ' name=\"' . $field . '\" id=\"' . $field . '\" onfocus=\"if(this.value==\\'' . $this->arrayLabel[$key] . '\\') this.value=\\'\\'\" onblur=\"if(this.value==\\'\\') this.value=\\'' . $this->arrayLabel[$key] . '\\'\" value=\"' . $value . '\"></td>';\n\t\t\t\tbreak;\n\t\t\t\tcase \"date\":\n\t\t\t\t\t$value = getValue($field,\"str\",\"GET\",\"dd/mm/yyyy\");\n\t\t\t\t\t$str .= '<td class=\"text\">' . $this->arrayLabel[$key] . '</td><td>&nbsp;<input type=\"text\" class=\"form-control date\" ' . $this->arrayAttribute[$key] . ' name=\"' . $field . '\" id=\"' . $field . '\" onKeyPress=\"displayDatePicker(\\'' . $field . '\\', this);\" onClick=\"displayDatePicker(\\'' . $field . '\\', this);\" onfocus=\"if(this.value==\\'' . translate_text(\"Enter\") . ' ' . $this->arrayLabel[$key] . '\\') this.value=\\'\\'\" onblur=\"if(this.value==\\'\\') this.value=\\'' . translate_text(\"Enter\") . ' ' . $this->arrayLabel[$key] . '\\'\" value=\"' . $value . '\"></td>';\n\t\t\t\tbreak;\n\t\t\t\tcase \"array\":\n\t\t\t\tcase \"arraytext\":\n\t\t\t\t\t$field = $this->arrayField[$key];\n\t\t\t\t\tglobal $$field;\n\t\t\t\t\t$arrayList = $$field;\n\t\t\t\t\t$str \t\t\t.= '<td class=\"text\">' . $this->arrayLabel[$key] . '</td><td><select class=\"form-control\" name=\"' . $field . '\" id=\"' . $field . '\" ' . $this->arrayAttribute[$key] . '>';\n\t\t\t\t\t$str \t\t\t.= '<option value=\"-1\">' . $this->arrayLabel[$key] . '</option>';\n\t\t\t\t\t$selected \t\t= getValue($field,\"str\",\"GET\",-1);\n\t\t\t\t\tforeach($arrayList as $key=>$value){\n\t\t\t\t\t\t$str \t\t.= '<option value=\"' . $key . '\" ' . (($selected==$key) ? 'selected' : '') . '>' . $value . '</option>';\n\t\t\t\t\t}\n\t\t\t\t\t$str .= '</select></td>';\n\t\t\t\tbreak;\n\n\t\t\t}\n\t\t}\n\n\t\tforeach($this->arrayAddSearch as $key=>$value){\n\t\t\tif($value[2] != \"\"){\n\t\t\t\t$str .= \"<td>&nbsp;<b>\";\n\t\t\t\t$str .= $value[2];\n\t\t\t\t$str .= \"</b>&nbsp;&nbsp;</td>\";\n\t\t\t}\n\n\t\t\t$str .= \"<td>\";\n\t\t\t$str .= $value[0];\n\t\t\t$str .= \"</td>\";\n\t\t}\n\t\t// Show nút search ở cuối\n\t\tif($type_search != 1){\n\t\t\t$str .= '<td>&nbsp;<input type=\"submit\" class=\"btn btn-sm btn-info\" value=\"' . translate_text(\"Tìm kiếm\") . '\"></td>';\n\t\t}\n\n\t\t\t$str .= '</tr></table>';\n\t\t\t$str .= '</form>';\n\n\t\t\t//phần check javascript cho form tìm kiếm\n\t\t\t$str .= '<script type=\"text/javascript\">';\n\t\t\t$str .= 'function check_form_submit(obj){';\n\t\t\tforeach($this->arraySearch as $key=>$field){\n\t\t\t\tswitch($this->arrayType[$key]){\n\t\t\t\t\tcase \"string\":\n\t\t\t\t\t\t$str .= 'if(document.getElementById(\"' . $field . '\").value == \\'' . translate_text(\"Enter\") . ' ' . $this->arrayLabel[$key] . '\\'){document.getElementById(\"' . $field . '\").value = \\'\\'}';\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$str .= 'document.form_search.submit(); ';\n\t\t\t$str .= '};';\n\t\t\t$str .= '</script>';\n\n\t\treturn $str;\n\t}", "public function Busqueda_General(){\n $Id_Area_Consulta = Session::Get('Id_Area_Consulta');\n $Texto_Busqueda = General_Functions::Validar_Entrada('texto_busqueda','TEXT');\n $Tipo_Busqueda = General_Functions::Validar_Entrada('tipo_busqueda','TEXT');\n $pagina = General_Functions::Validar_Entrada('Pagina','NUM');\n\n if ( strlen($Texto_Busqueda) > 0 ){\n $this->View->SetCss(array('tron_carrito' , 'tron_productos_categorias_marcas','tron_estilos-titulos_destacados_novedades_ofertas','tron_varias_referencias-ofertas-tecnologias_SA'));\n $this->View->SetJs(array('tron_productos.jquery','tron_carrito','tron_marcas_categorias','mostrar_tabla_carrito'));\n $this->View->Productos = $this->Productos->Busqueda_General($Texto_Busqueda, $Tipo_Busqueda);\n $this->View->Productos_Pagina = $this->Paginador->Paginar($this->View->Productos, $pagina);\n $this->View->Paginacion = $this->Paginador->Mostrar_Paginacion('paginador_ajax');\n Session::Set('nom_categoria','');\n $this->View->Mostrar_Vista('resultado_busqueda');\n\n }\n\n }", "function Filtros_Listar_CategoriaProductoCalidad()\n {\n $Helper=new htmlhelper; $TipoTxt=new TipoTextBox; $index=0;\n $inputs=array(\n \"Categoria\" => $Helper->combo_categoriaproducto(\"fil_cmbTransportista\",++$index,\"\",\"\",\"\",\"\",\"\"), \n \"Nombre\" => $Helper->textbox(\"fil_txtNombreTamano\",++$index,\"\",128,150,$TipoTxt->texto,\"\",\"\",\"\",\"textoInput\")\n );\n $buttons=array($Helper->button(\"btnBuscarTamano\",\"Buscar\",70,\"Buscar_Grilla('configuracion','Grilla_Listar_CategoriaProductoCalidad','tbl_lista','','td_General')\",\"textoInput\"));\n $html = '<fieldset class=\"textoInput\"><legend align= \"left\">Filtros de b&uacute;squeda</legend>';\n $html .= $Helper->Crear_Layer(\"tbl_lista\",$inputs,$buttons,3,990,\"\",\"\");\n $html .='</fieldset>';\n return $html;\n }", "public function search()\n {\n $limit = Input::get('limit') ?: 9;\n $offset = Input::get('offset') ?: 0;\n $term = trim(Input::get('term'));\n // $termArray = (strstr($term, ' ')) ? $this->wildcard($term) : $term;\n $busca = [\n 'pedidos' => [],\n 'clientes' => [],\n 'produtos' => [],\n 'offset' => 0,\n ];\n\n try {\n $categories = $this->parseCategories(Input::get('categories'));\n\n if (!$categories || empty($categories)) {\n return $this->listResponse($busca);\n }\n\n if (in_array('pedidos', $categories)) {\n $busca['pedidos'] = $this->orders($term)\n ->offset($offset)\n ->limit($limit)\n ->get([\n 'pedidos.*'\n ]);\n\n $busca['pedidos'] = OrderTransformer::search($busca['pedidos']);\n }\n\n if (in_array('clientes', $categories)) {\n /*$busca['clientes'] = Cliente\n ::with('enderecos')\n ->search($termArray, [\n 'nome' => 100,\n 'taxvat' => 75,\n 'email' => 50,\n 'inscricao' => 25,\n ])*/\n $busca['clientes'] = $this->customers($term)\n ->with('enderecos')\n ->groupBy('id')\n ->orderBy('nome', 'ASC')\n ->offset($offset)\n ->limit($limit)\n ->get();\n\n $busca['clientes'] = ClientTransformer::search($busca['clientes']);\n }\n\n if (in_array('produtos', $categories)) {\n /*$busca['produtos'] = Produto\n ::search($termArray, [\n 'sku' => 125,\n 'titulo' => 100,\n 'ncm' => 75,\n 'ean' => 50,\n 'referencia' => 25,\n ])*/\n $busca['produtos'] = $this->products($term)\n ->groupBy('sku')\n ->orderBy('titulo', 'ASC')\n ->offset($offset)\n ->limit($limit)\n ->get();\n\n $busca['produtos'] = ProductTransformer::search($busca['produtos']);\n }\n\n $busca['offset'] = $offset;\n } catch (\\Exception $exception) {\n \\Log::error(logMessage($exception, 'Ocorreu um erro ao tentar realizar um busca.'));\n }\n\n return $this->listResponse($busca);\n }", "function formulaires_inscription3_recherche_charger_dist(){\n\n\t$datas['ordre'] = _request('ordre');\n\t$datas['desc'] = _request('desc');\n\t$datas['case'] = _request('case');\n\t$datas['valeur'] = _request('valeur');\n\n\t$datas['exceptions'] = pipeline('i3_exceptions_des_champs_auteurs_elargis',array());\n\n\tif(_request('afficher_tous')){\n\t\tset_request('valeur','');\n\t\tset_request('case','');\n\t}\n\treturn $datas;\n}", "public function getTitulos( $search, $return='array') {\n \t\n\t\ttry \n\t\t{ \n\t\t if(strlen($return)==0) return false;\t\t\n\t\t\n\t\t $sql = \"\t\n\t\t SELECT id_titulos AS clave, \n\t\t\t d_titulos AS descrip \n\t\t\t FROM cat_titulos \n\t\t\t WHERE d_titulos LIKE '%\".strtoupper($search).\"%' \n\t\t\t ORDER BY d_titulos \n\t\t\t LIMIT 10;\";\n\t\t \t \n\t\t\t $rs = $this->db->Execute($sql);\t\t\t \n\t\t\t \n\t\t\t if ($return=='array'){\n\t\t\t\t $rows = $rs->GetAll();\n\t\t\t $rs->Close();\n\t\t\t\t return $rows;\n\t\t\t }elseif($return=='pipe'){\n\t\t\t $str = '';\n\t\t\t\t while($row = $rs->FetchRow()){\n\t $str.= $row['descrip'].\"|\".$row['clave'].\"\\n\";\n\t }\n\t\t\t\t return $str;\t\t \n\t\t\t }\n\t\t\t \n\t\t\t \n\t\t}catch(Exception $e){\t\t \n\t\t\t$this->setError($e->getCode(), $e->getMessage());\n\t\t\tthrow new Exception( $e->getMessage() , $e->getCode() );\t\n\t\t}\t\t\t\t\n }", "function cari($cari) {\n $query = \"SELECT * FROM pelanggan WHERE NAMA_PELANGGAN LIKE '%$cari%' OR NIK LIKE '%$cari%' OR ALAMAT_PELANGGAN LIKE '%$cari%' OR NOHP_PELANGGAN LIKE '%$cari%' OR EMAIL_PELANGGAN LIKE '%$cari%'\";\nreturn Data_plg($query);\n}", "function Search($size,$gfx,$flat = 0){\n\t\n\tglobal $db_category,$db_articles;\n\t\n\t$_GET['filter'] = AGet($_GET,'filter');\n\t$_GET['lang'] = AGet($_GET,'lang');\n\t\n\tif (!empty($_POST['podminka'])){$podminka = $_POST['podminka'];} else {$podminka = AGet($_GET,'podminka');}\n\tif (!empty($_POST['search_choice'])){$search_choice = $_POST['search_choice'];} else {$search_choice = AGet($_GET,'search_choice');}\n\tif (!empty($_POST['retezec'])){$retezec = $_POST['retezec'];} else {$retezec = AGet($_GET,'retezec');}\n\t\n\t$retezec = stripslashes($retezec);\n\t$retezec = htmlspecialchars($retezec, ENT_QUOTES);\n \techo \"<form action=\\\"index.php?action=search&amp;lang=\".$_GET['lang'].\"&amp;filter=\".$_GET['filter'].\"\\\" method=\\\"post\\\">\";\n\techo \"<input type=\\\"text\\\" name=\\\"retezec\\\" size=\\\"\".$size.\"\\\" maxlength=\\\"50\\\" value=\\\"\".$retezec.\"\\\">\"; if ($flat == 0){ echo \"<br>\";}\n\techo \"<select name=\\\"podminka\\\"><option value=\\\"1\\\" \"; if ($podminka == 1){echo \"selected=\\\"selected\\\"\";} echo \">\"._SEARCH_PODMINKA_1.\"</option>\";\n\techo \" <option value=\\\"2\\\" \"; if ($podminka == 2){ echo \"selected=\\\"selected\\\"\";} echo \">\"._SEARCH_PODMINKA_2.\"</option>\";\n\techo \"\t<option value=\\\"3\\\" \"; if ($podminka == 3){ echo \"selected=\\\"selected\\\"\";} echo \">\"._SEARCH_PODMINKA_3.\"</option>\";\n\techo \"</select>\"; if ($flat == 0){echo \"<br>\"; }\n\techo _SEARCH_CHOICE_WHERE; if ($flat == 0){echo\"<br>\";}\n\techo \"<input type=\\\"radio\\\" name=\\\"search_choice\\\" value=\\\"article\\\" \"; if ($search_choice == \"article\" || $search_choice == \"\"){echo \"checked\";} echo \"> \"._SEARCH_CHOICE_ARTICLES; if ($flat == 0){echo \"<br>\"; }\n\techo \"<input type=\\\"radio\\\" name=\\\"search_choice\\\" value=\\\"news\\\" \"; if ($search_choice == \"news\"){echo \"checked\";} echo \"> \"._SEARCH_CHOICE_ACT; if ($flat == 0){echo \"<br>\"; }\n\techo \"<input type=\\\"submit\\\" class=\\\"eden_button\\\" value=\\\" \";if ($gfx != 1){echo _CMN_SUBMIT_SEARCH;} echo \"\\\">\";\n\techo \"</form>\";\n}", "public function getDependencias( $search, $return='array') {\n \t\n\t\ttry \n\t\t{ \n\t\t if(strlen($return)==0) return false;\n\t\t\t \n\t\t\t $start = $search['start'] ? $search['start'] : 0;\n\t\t\t $limit = $search['limit'] ? $search['limit'] : 10;\n\t\t\t \n\t\t\t \n\t\t\t $sql=\"\n\t\t\t SELECT d.*,\n\t\t\t\t ( SELECT d_localidad FROM cat_localidad WHERE id_localidad = depe_ciudad) nciudad,\n\t\t\t\t ( SELECT d_colonia FROM cat_colonias WHERE id_colonia = depe_colonia ) ncolonia ,\n\t\t\t\t ( SELECT nombre FROM cat_calles WHERE id_calle = depe_calle) ncalle\n\t\t FROM cat_dependencias d\n\t\t\t WHERE 1 = 1\n\t\t\t \";\n\t\t\t \n\t\t\t if(strlen($search['grupo'])>0){ $sql.=\" AND depe_grupo LIKE '\".$search['grupo'].\"'\";}\n\t\t\t if(strlen($search['query'])>0){ $sql.=\" AND depe_nombre LIKE '%\".$search['query'].\"%'\";}\t\t\t \t\n\t\t\n\t\t $csql = \"\t\n\t\t SELECT SQL_CALC_FOUND_ROWS\n\t\t\t depe_dependencia AS id,\n\t\t\t depe_nombre AS value,\n\t\t\t\t\tIFNULL(CONCAT(initcap(ncalle),' ',initcap(depe_entre),' ',initcap(depe_y_entre),' No. ',depe_numero,', Col. ',ncolonia,', ',nciudad),' ') info \n\t\t\t FROM ( \n\t\t\t $sql \n\t\t\t\t\t) a\n\t\t\t WHERE 1 = 1\n\t\t\t ORDER BY depe_nombre\";\n\t\t\t \t\t\t\n\t\t\t\t\t\t \t\t\t \n\t\t\t $rs = $this->db->SelectLimit($csql, $limit, $start);\n\t\t\t $tt = $this->db->GetOne(\"SELECT FOUND_ROWS()\");\n\t\t\t \n\t\t\t if($return=='response'){\n\t\t\t $rows = $rs->GetAll();\n\t\t\t\t $rs->Close();\n\t\t\t\t $response = array('success'=>true, 'rows'=>$rows, 'total'=>$tt, 'sql'=>$sql );\n\t\t\t\t return $response;\t\t\t \n\t\t\t }elseif ($return=='array'){\n\t\t\t\t $rows = $rs->GetAll();\n\t\t\t $rs->Close();\n\t\t\t\t return $rows;\n\t\t\t }elseif($return=='pipe'){\n\t\t\t $str = '';\n\t\t\t\t while($row = $rs->FetchRow()){\n\t $str.= $row['descrip'].\"|\".$row['clave'].\"\\n\";\n\t }\n\t\t\t\t $rs->Close();\n\t\t\t\t return $str;\t\t \n\t\t\t }\n\t\t\t \n\t\t\t \n\t\t}catch(Exception $e){\t\t \n\t\t\t$this->setError($e->getCode(), $e->getMessage());\n\t\t\tthrow new Exception( $e->getMessage() , $e->getCode() );\t\n\t\t}\t\t\t\t\n }", "function form($searchString)\r\n {\r\n \tif (session::get(\"hyrarchy\")) echo \"<div id='search' class='search'>\";\r\n \telse echo \"<div id='searchbig' class='search'>\";\r\n\r\n\r\n echo \"<form method='GET' action='index.php' name='search'>\";\r\n echo \"<b>Suche in</b><br>\";\r\n \r\n// Freie Suche\r\n if (!session::get(\"searchstart\") and !session::get(\"searchexact\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n \r\n echo form::field(\"radio\",\"searchtype\",0,\"\",$checkString,\"\",\"frei\",\"search-free\");\r\n \r\n// Suche am Wortanfang\r\n if (session::get(\"searchstart\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n\r\n echo form::field(\"radio\",\"searchtype\",1,\"\",$checkString,\"\",\"Wortanfang\",\"search-start\");\r\n\r\n// exakte Suche\r\n if (session::get(\"searchexact\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n\r\n echo form::field(\"radio\",\"searchtype\",2,\"\",$checkString,\"\",\"exact\",\"search-exact\");\r\n\r\n\r\n// search in comment field\r\n if (session::get(\"searchcom\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n echo form::field(\"checkbox\",\"searchcom\",1,\"\",$checkString,\"\",\"Erl&auml;uterungen\",\"search-comment\");\r\n\r\n\r\n // search only for ordered entries\r\n // create array for selector\r\n $typeArray = thesaurus::get_type_list();\r\n $statusArray = thesaurus::get_status_list();\r\n $ownerArray = user::get_users(\"entry\");\r\n\r\n if (count($statusArray))\r\n {\r\n echo \"<br>\";\r\n echo form::selector(\"searchentrytype\",$typeArray,1,\"\",session::get(\"searchentrytype\"),\"\",\" Begriffstype \",\"searchtype\",\"\");\r\n echo form::selector(\"searchstatus\",$statusArray,1,\"\",session::get(\"searchstatus\"),\"\",\" Status \",\"searchstatus\",\"\");\r\n echo form::selector(\"searchowner\",$ownerArray,1,\"\",session::get(\"searchowner\"),\"\",\" Eigentümer mit Einträgen \",\"searchowner\",\"\");\r\n }\r\n else\r\n echo form::link(\"\",\"<span class='small'>Keine beantragten Einträge</span>\",\"\",\"no-ordered\");\r\n \r\n\r\n// search field\r\n echo \"<p><input type='text' size='35' name='searchString' value='\" . session::get(\"search\") . \"' \";\r\n echo help::show(\"search-field\",\"\");\r\n echo \">\";\r\n\r\n \r\n echo form::field(\"submit\",\"action\",\"suchen\",\"\",\"\",\" \",\"\",\"search\");\r\n echo form::field(\"submit\",\"reset\",\"zurücksetzen\",\"\",\"\",\" \",\"\",\"newsearch\");\r\n echo \"</form></p>\";\r\n echo \"</div>\";\r\n }", "private function getFilters()\r\n { \r\n $this->searchfilters = '';\r\n \r\n if ($this->streek != '')\r\n {\r\n $id = substr($this->streek, 1);\r\n \r\n if (substr($this->streek, 0, 1) == 's')\r\n {\r\n $this->streek_id = $id;\r\n $sql = \"SELECT streek_naam AS name FROM tblStreek WHERE streek_id = '$id'\";\r\n } \r\n else\r\n {\r\n $this->dept_id = $id;\r\n $sql = \"SELECT dpt.dept_naam AS name FROM tblDepts dpt WHERE dpt.dept_id = '$id'\";\r\n } \r\n \r\n $komma = 1;\r\n }\r\n \r\n if (isset($komma))\r\n {\r\n $name = $this->get_name($sql);\r\n $this->searchfilters .= $name;\r\n }\r\n \r\n /** aantal personen */\r\n if ($this->aantalpersonen != '' && $this->aantalpersonen != 0)\r\n { \r\n if (isset($komma))\r\n {\r\n $this->searchfilters .= ', ';\r\n } \r\n if ($this->aantalpersonen != '12-12')\r\n {\r\n $this->searchfilters .= $this->aantalpersonen . ' pers.';\r\n } \r\n else\r\n {\r\n $this->searchfilters .= 'vanaf 12 pers.';\r\n } \r\n $komma = 1; \r\n }\r\n \r\n /** aankomst */\r\n if ($this->aankomst != '')\r\n {\r\n $dt = new Datum();\r\n $tmp = strtotime($this->aankomst);\r\n $dt->setTmp($tmp);\r\n $datum = $dt->setFormat('dkdmlj');\r\n if (isset($komma))\r\n {\r\n $this->searchfilters .= ', ';\r\n } \r\n $this->searchfilters .= $datum.' ';\r\n \r\n if($this->weken == 1 || $this->weken == 0)\r\n {\r\n $this->searchfilters .= ', 1 week';\r\n }\r\n else \r\n {\r\n $this->searchfilters .= ', '.$this->weken.' weken'; \r\n }\r\n $komma = 1; \r\n } \r\n \r\n /** checkboxen */\r\n if ($this->count_checkbox != 0)\r\n {\r\n if (isset($komma)) $this->searchfilters .= ', ';\r\n \r\n for ($x = 0; $x < $this->arrcheckbox; $x++)\r\n {\r\n $str = $this->formatFac($this->arrcheckbox[$x]);\r\n $this->searchfilters .= $str.', ';\r\n }\r\n $komma = 1; \r\n // laatste komma weg\r\n $this->searchfilters = substr($this->searchfilters, 0, strlen($this->searchfilters)-2); \r\n } \r\n $this->searchfilters = 'Zoekfilters: '.$this->searchfilters;\r\n }", "private function buscadorVista($busqueda){\n\n $band = 0;\n $_SERVER['REQUEST_URI'] = str_replace(\"pagina\",\"\", $_SERVER['REQUEST_URI'] );\n if(!array_key_exists('where',$this->sentenciasQuery)){\n\n $this->sentenciasQuery['where']=\" \";\n }else{\n $band=1;\n $this->sentenciasQuery['where']=\"(\".$this->sentenciasQuery['where'].\") and (\";\n }\n $contadorFiltroFecha=0;\n if($this->filtroFecha){\n if(is_string($this->filtroFecha)){\n\n if(!empty($_POST['ctrlBusqDesde'])){\n\n $this->sentenciasQuery['where'].=\"\".$this->filtroFecha.\" >= '\".FechaHora::fechaInvertida($_POST['ctrlBusqDesde']).\"'\";\n ++$contadorFiltroFecha;\n }\n\n if(!empty($_POST['ctrlBusqHasta'])){\n if($contadorFiltroFecha>0) $this->sentenciasQuery['where'].=\" and \";\n $this->sentenciasQuery['where'].=$this->filtroFecha.\" <= '\".FechaHora::fechaInvertida($_POST['ctrlBusqHasta']).\"'\";\n ++$contadorFiltroFecha;\n }\n }\n\n }\n if(is_array($this->camposBusqueda)){\n if(count($this->camposBusqueda)>0){\n if($contadorFiltroFecha>0){\n $this->sentenciasQuery['where'] .=\" and (\";\n }\n $i=0;\n foreach ($this->camposBusqueda as $key => $campo) {\n if($i>0)\n $this->sentenciasQuery['where'].=\" or \";\n $this->sentenciasQuery['where'].=\" $campo like '%$busqueda%' \";\n $i++;\n }\n }else{\n throw new Exception(\"No se han definido campos de busqueda para la vista $this->nombreVista\", 1);\n\n }\n if($band==1){\n $this->sentenciasQuery['where'].=\")\";\n }\n if($contadorFiltroFecha>0){\n $this->sentenciasQuery['where'] .=\")\";\n }\n }else{\n throw new Exception(\"El atributo camposBusqueda no está definido como arreglo\", 1);\n\n }\n\n $this->consultaBD = $this->consultaBD;\n $this->prepareConsulta();\n return $this->crearVista();\n }", "function busqueda($queryExpandida){\n global $terminosConsulta,$q;\n busquedaSolr($queryExpandida);\n foreach($terminosConsulta as $key => $valor){\n $q = $q.\" \".$valor;\n }\n spellChecker();\n //suggestions($q);\n }", "public function search() {\n\t\t\t$Recherches = $this->Components->load( 'WebrsaRecherchesFichesprescriptions93' );\n\t\t\t$Recherches->search();\n\t\t}", "function searchFumetti($p, $ordine){\n\t//$p = htmlspecialchars($p, ENT_QUOTES);\n\t$query = \"SELECT *, nome as `nomeFum` FROM `Fumetti` WHERE `Fumetti`.`nome` LIKE '%$p%' OR `volume` like '$p' ORDER BY '$ordine' \";\n\treturn eseguiQuery($query);\n\n}", "function SEARCH()\n{\n $sql = \"select * from CLASH \";\n\n // si se produce un error en la busqueda mandamos el mensaje de error en la consulta\n if (!($resultado = $this->bd->query($sql))){\n\t\treturn 'Error en la consulta sobre la base de datos';\n\t}\n else{ // si la busqueda es correcta devolvemos el recordset resultado\n\t\treturn $resultado;\n\t}\n\n\n}", "public function search();", "function search()\n\t\t{\n\n\t\t\techo '\n\t\t\t<!-- The search div -->\n\t\t\t<div id=\"content\">\n\n\t\t\t\t<form class=\"card\" id=\"search\">\n\t\t\t\t\t<header class = \"subheading\"><span class=\"fa fa-search\"></span> Package Finder</header>\n\t\t\t\t\t<p>Search by tracking number, customer, shipping provider or item description</p><br>\n\t\t\t\t\t<input id=\"queryField\" type = \"text\" name=\"query\" placeholder = \"e.g enter a tracking number, name, courier or item description to search \" autofocus/><br>\n\t\t\t\t\t<header class=\"subheading searchOptions\">Show results </header>\n\t\t\t\t\t<label for=\"beforeDate\"> Between</label> <input type=\"date\" id=\"before\" name=\"beforeDate\" />\n\t\t\t\t\t<label for=\"afterDate\"> And</label><input type=\"date\" id=\"after\" name=\"afterDate\" />\n\t\t\t\t\t<input id=\"lookupButton\" type=\"submit\" value=\"Find\">\n\n\t\t\t\t\t<header class=\"subheading searchOptions\">Icon guide</header>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-bug\"></i></span> : Package Issue</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-shopping-bag\"></i></span> : Item description</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-ship\"></i></span> : Shipping carrier e.g UPS</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-truck\"></i></span> : Tracking number</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-hashtag\"></i></span> : Account number e.g WEB720</p>\n\t\t\t\t</form>\n\n\n\t\t\t\t<section id = \"lookupResults\">\n\n\t\t\t\t</section>\n\t\t\t</div>';\n\t\t}", "function produk_search($produk_id ,$produk_kode ,$produk_kodelama ,$produk_group ,$produk_kategori ,$produk_jenis ,$produk_nama ,$produk_satuan ,\r\n\t\t\t\t\t\t\t\t$produk_du ,$produk_dm ,$produk_dultah, $produk_dcard, $produk_dkolega, $produk_dkeluarga, $produk_downer, $produk_dgrooming,\r\n\t\t\t\t\t\t\t\t$produk_point ,$produk_kredit,$produk_kontribusi ,$produk_volume ,$produk_harga ,$produk_keterangan ,$produk_aktif ,$start,$end, $kategori2_nama){\r\n\t\t\t//full query\r\n\t\t\tif($produk_aktif==\"\")\r\n\t\t\t\t$produk_aktif=\"Aktif\";\r\n\t\t\t$query=\"select * from vu_produk\";\r\n\t\t\t\r\n\t\t\tif($produk_id!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_id LIKE '%\".$produk_id.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_kode!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_kode LIKE '%\".$produk_kode.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_kodelama!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_kodelama LIKE '%\".$produk_kodelama.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_group!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_group = '\".$produk_group.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_kategori!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" kategori_id = '\".$produk_kategori.\"'\";\r\n\t\t\t};\r\n\t\t\tif($kategori2_nama!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" kategori2_nama = '\".$kategori2_nama.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_jenis!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_jenis = '\".$produk_jenis.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_nama!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_nama LIKE '%\".$produk_nama.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_satuan!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_satuan LIKE '%\".$produk_satuan.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_du!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_du = '\".$produk_du.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_dm!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_dm = '\".$produk_dm.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_dultah!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_dultah = '\".$produk_dultah.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_dcard!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_dcard = '\".$produk_dcard.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_dkolega!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_dkolega = '\".$produk_dkolega.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_dkeluarga!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_dkeluarga = '\".$produk_dkeluarga.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_downer!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_downer = '\".$produk_downer.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_dgrooming!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_dgrooming = '\".$produk_dgrooming.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_point!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_point LIKE '%\".$produk_point.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_kredit!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_kredit LIKE '%\".$produk_kredit.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_kontribusi!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_kontribusi='\".$produk_kontribusi.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_volume!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_volume = '\".$produk_volume.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_harga!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_harga = '\".$produk_harga.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_keterangan!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_keterangan LIKE '%\".$produk_keterangan.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_aktif!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_aktif = '\".$produk_aktif.\"'\";\r\n\t\t\t};\r\n\t\t\t$result = $this->db->query($query);\r\n\t\t\t$nbrows = $result->num_rows();\r\n\t\t\t\r\n\t\t\t$limit = $query.\" LIMIT \".$start.\",\".$end;\t\t\r\n\t\t\t$result = $this->db->query($limit); \r\n\t\t\t\r\n\t\t\tif($nbrows>0){\r\n\t\t\t\tforeach($result->result() as $row){\r\n\t\t\t\t\t$arr[] = $row;\r\n\t\t\t\t}\r\n\t\t\t\t$jsonresult = json_encode($arr);\r\n\t\t\t\treturn '({\"total\":\"'.$nbrows.'\",\"results\":'.$jsonresult.'})';\r\n\t\t\t} else {\r\n\t\t\t\treturn '({\"total\":\"0\", \"results\":\"\"})';\r\n\t\t\t}\r\n\t\t}", "function procurarReports($myDb, $string, $filtro){\r\n\r\n\tglobal $tabAchados;\r\n\tglobal $tabPerdidos;\r\n\tglobal $tabItens;\r\n\r\n\t//Valida a string\r\n\t$string = validarString2($string);\r\n\t$filtro = validarString2($filtro);\r\n\r\n\tif (strlen($string) < 1) {\r\n\t\techo \"Erro: informar algo para ser buscado.\";\r\n\t\treturn \"falha\";\r\n\t}\r\n\r\n\tif (strlen($filtro) < 1) {\r\n\t\techo \"Erro: informar o filtro.\";\r\n\t\treturn \"falha\";\r\n\t}\r\n\r\n\t//Busca por data\r\n\tif (strcmp($filtro, \"data\") == 0) {\r\n\r\n\t\t//Busca na tabela de achados\r\n\t\t$resultatosBusca = searchData($myDb, $tabAchados, \"data\", $string, \"s\");\r\n\t\t\r\n\t\t//Busca na tabela de perdidos\r\n\t\t$temp = searchData($myDb, $tabPerdidos, \"data\", $string, \"s\");\r\n\t\t\r\n\t\tfor ($i=0; $i<count($temp); $i++) { \r\n\t\t\tarray_push($resultatosBusca, $temp[$i]);\r\n\t\t}\r\n\t\t\r\n\t\treturn $resultatosBusca;\r\n\t\r\n\t//Busca por local de marcacao\r\n\t} elseif (strcmp($filtro, \"local\") == 0) {\r\n\r\n\t\t//Busca na tabela de achados\r\n\t\t$resultatosBusca = searchData($myDb, $tabAchados, \"mapsLocal\", $string, \"s\");\r\n\t\t\r\n\t\t//Busca na tabela de perdidos\r\n\t\t$temp = searchData($myDb, $tabPerdidos, \"mapsLocal\", $string, \"s\");\r\n\t\t\r\n\t\tfor ($i=0; $i<count($temp); $i++) { \r\n\t\t\tarray_push($resultatosBusca, $temp[$i]);\r\n\t\t}\r\n\t\t\r\n\t\treturn $resultatosBusca;\r\n\t \r\n\t //Busca por titulo do item\r\n\t } elseif (strcmp($filtro, \"titulo\") == 0) {\r\n\t\t\treturn seachTabelaItens($myDb, $tabItens, \"titulo\", $string, \"s\");\r\n\t\t\t\r\n\t\t//Busca por marca do item\r\n\t\t} elseif (strcmp($filtro, \"marca\") == 0) {\r\n\t\t\treturn seachTabelaItens($myDb, $tabItens, \"marca\", $string, \"s\");\r\n\t \r\n\t //Busca por identificador do item\r\n\t\t } elseif (strcmp($filtro, \"identificador\") == 0) {\r\n\t\t\t\treturn seachTabelaItens($myDb, $tabItens, \"identificador\", $string, \"s\");\r\n\t }\r\n\r\n}", "private function search() {\n\t\tGLOBAL $db, $MYSQL_PREFIX, $TDTRAC_SITE;\n\t\t$keywords = $this->action['keywords'];\n\t\t\n\t\t$sqlwhere = \"( category LIKE '%\" . mysql_real_escape_string($keywords) . \"%' OR \"; \n\t\t$sqlwhere .= \"vendor LIKE '%\" . mysql_real_escape_string($keywords) . \"%' OR \"; \n\t\t$sqlwhere .= \"date = '\" . mysql_real_escape_string($keywords) . \"' OR \"; \n\t\t$sqlwhere .= \"dscr LIKE '%\" . mysql_real_escape_string($keywords) . \"%' )\";\n\t\t\n\t\t$sql = \"SELECT * FROM {$MYSQL_PREFIX}budget b, {$MYSQL_PREFIX}shows s WHERE b.showid = s.showid AND {$sqlwhere} ORDER BY b.showid DESC, category ASC, date ASC, vendor ASC\";\n\t\t$result = mysql_query($sql, $db);\n\t\t\n\t\t$html[] = \"<h3>Search Results</h3>\\n\";\n\t\tif ( mysql_num_rows($result) == 0 ) { return array_merge($html, array(\"<br /><br /><h4>No Records Found!</h4>\")); }\n\t\t\n\t\t$tabl = new tdtable(\"searchresult\");\n\t\t$tabl->addHeader(array('Show', 'Date', 'Category', 'Vendor', 'Description', 'Price', 'Tax'));\n\t\t$tabl->addSubtotal('Show');\n\t\t$tabl->addCurrency('Price');\n\t\t$tabl->addCurrency('Tax');\n\t\t$tabl->addAction(array('bpend','breim','rview'));\n\t\tif ( $this->user->can(\"editbudget\") ) { $tabl->addAction(array('bedit', 'bdel')); }\n\t\t\n\t\twhile( $line = mysql_fetch_array($result) ) {\n\t\t\t$tabl->addRow(array($line['showname'], $line['date'], $line['category'], $line['vendor'], $line['dscr'], $line['price'], $line['tax']), $line);\n\t\t}\n\t\treturn array_merge($html, $tabl->output(false));\n\t}", "public function search($module,$ceco){\n\n //en caso de no existir seleccion apareceran todos\n if(($ceco===\"all\")&&($module===\"all\")){\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" 1 \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n //en caso de existir seleccion en modulo buscamos modulo en todos los posibles cecos\n else if (($ceco===\"all\")&&($module!==\"all\")){\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" Modulo='\".$module.\"' \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n //en caso de existir busqueda en ceco buscamos parecidos\n else if (($ceco!==\"all\")&&($module===\"all\")){\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" Kostl LIKE '\".$ceco.\"%' \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n //en caso de existir ambos criterios aplicamos busqueda incluyendolos\n else{\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" Modulo = '\".$module.\"' AND Kostl LIKE '\".$ceco.\"%' \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n }", "public function find() {\n \tif ($this->request->is('ajax')) {\n //impide la creacion de vista\n \t\t$this->autoRender = false; \n //recibe el string con el termino a buscar\n \t\t$name = $this->request->query('term'); \n //busca en la base de datos todos los nombres parecidos \n \t\t$conn = ConnectionManager::get('copec');\n \t\t$results = $conn->execute('SELECT TA_BUSQUEDA, TA_NCORR FROM tallasnew WHERE TA_BUSQUEDA like \"%'.$name.'%\"');\n \t\t$resultArr = array();\n \t\t$Repuesto=$results->fetchAll('assoc');\n //cuando lo obtiene lo manda a la vista encondado como json\n \t\tforeach($Repuesto as $Repuesto) { \n \t\t\t$resultArr[] = array('label' =>$Repuesto['TA_BUSQUEDA'],'mid'=>$Repuesto['TA_NCORR']);\n \t\t}\n //envia la lsita encodad como json\n \t\techo json_encode($resultArr); \n \t} \n }", "public function consulta() {\n if ($this->Form->parameters) {\n $page=($this->Form->parameters[0])?$this->Form->parameters[0]:1;\n $criterio=$this->Form->busqueda;\n $paged=$this->Form->conPaginacion;\n } else {\n $criterio=\"\";\n $page=1;\n $paged=true;\n }\n if ($paged) {\n $rows=$this->modeloContactos->buscarCaulquierPaginado($criterio,$page,15);\n $this->jQ(\"#paging\")->html($this->paginacion($page));\n } else {\n $rows=$this->modeloContactos->buscarCaulquier($criterio);\n $this->jQ(\"#paging\")->empty();\n }\n $cuerpo=\" \";\n if (!$rows) {\n $this->jWarning(\"No hay resultados de la busqueda\");\n return false;\n }\n $cuerpo=$this->preparaTabla($rows);\n // Modifica las filas de la consulta por jquery. Solo a peticion desde la vista con APJSubmit\n $this->jQ(\"#cuerpo\")->html($cuerpo);\n // Retorna la filas de la consulta al controlador para que genere la vista, llamdado desde la vista con APJ:{consulta(1)}\n return $cuerpo;\n }", "public function search(){\n if( $search = \\Request::get('q') ){\n $perfumes = Perfume::where(function ($query) use ($search){\n $query->where('name', 'LIKE', \"%$search%\")\n ->orWhere('aroma', 'LIKE', \"%$search%\")\n ->orWhere('type', 'LIKE', \"%$search%\")\n ->orWhere('stock', 'LIKE', \"%$search%\");\n })->paginate(6);\n return $perfumes;\n }\n else{\n return Perfume::latest()->paginate(6);\n }\n \n }" ]
[ "0.6395447", "0.6119858", "0.6097977", "0.6077958", "0.60681826", "0.60626185", "0.6013042", "0.60121155", "0.5987971", "0.598796", "0.59763396", "0.59377414", "0.59221554", "0.5911665", "0.59025675", "0.5884365", "0.5869864", "0.5867986", "0.58642584", "0.5855762", "0.58464503", "0.5830801", "0.5819556", "0.57837325", "0.57790864", "0.5766637", "0.57633126", "0.5761447", "0.5740918", "0.5739311" ]
0.6515959
0
Obtiene el catalogo de de calles $search string : palabra a buscar $return string : Forma en que debe de devolver los datos
public function getCalles( $search, $return='array') { try { if(strlen($return)==0) return false; $sql = " SELECT id_calle AS clave , nombre As descrip FROM cat_calles WHERE nombre LIKE '%$search%' LIMIT 10"; $rs = $this->db->Execute($sql); if ($return=='array'){ $rows = $rs->GetAll(); $rs->Close(); return $rows; }elseif($return=='pipe'){ $str = ''; while($row = $rs->FetchRow()){ $str.= $row['descrip']."|".$row['clave']."\n"; } return $str; } }catch(Exception $e){ $this->setError($e->getCode(), $e->getMessage()); throw new Exception( $e->getMessage() , $e->getCode() ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getTCalles( $search, $return='array') {\n \t\n\t\ttry \n\t\t{ \n\t\t if(strlen($return)==0) return false;\t\t\n\t\t\n\t\t $sql = \"\t\n\t\t SELECT id_clase_calle AS clave ,\n\t\t\t d_clase_calle AS descrip \n\t\t\t FROM cat_clase_calle\n\t\t\t WHERE d_clase_calle LIKE '%$search%'\n\t\t\t ORDER BY d_clase_calle\n\t\t\t LIMIT 10\";\n\t\t \t \n\t\t\t $rs = $this->db->Execute($sql);\t\t\t \n\t\t\t \n\t\t\t if ($return=='array'){\n\t\t\t\t $rows = $rs->GetAll();\n\t\t\t $rs->Close();\n\t\t\t\t return $rows;\n\t\t\t }elseif($return=='pipe'){\n\t\t\t $str = '';\n\t\t\t\t while($row = $rs->FetchRow()){\n\t $str.= $row['descrip'].\"|\".$row['clave'].\"\\n\";\n\t }\n\t\t\t\t return $str;\t\t \n\t\t\t }\n\t\t\t \n\t\t\t \n\t\t}catch(Exception $e){\t\t \n\t\t\t$this->setError($e->getCode(), $e->getMessage());\n\t\t\tthrow new Exception( $e->getMessage() , $e->getCode() );\t\n\t\t}\t\t\t\t\n }", "public function getSearchRe($field1,$field2,$date){\n $sql = \"SELECT a.IdBitacora, a.Foliorequisicion, DATE_FORMAT(a.FechaRecepcion,'%d/%m/%Y') as FechaRecepcion, DATE_FORMAT(a.FechaReporte,'%d/%m/%Y') as FechaReporte, a.IdDep, a.IdSolicitante,a.Comentario,\n a.Concepto, FORMAT(a.Costo, 2) AS Costo,a.Estatus, DATE_FORMAT(a.FechaAutorizacion,'%d/%m/%Y') as FechaAutorizacion, a.Estado, DATE_FORMAT(a.FechaAatencion,'%d/%m/%Y') as FechaAatencion , a.Archivo,d.nombreDepto,s.Subfijo,s.Nombre,s.A_paterno,s.A_materno\n FROM \" .self::$tablename. \" as a INNER JOIN departamento as d ON a.IdDep=d.idDepart\n INNER JOIN jefe_area as s ON a.IdSolicitante=s.IdJefe WHERE {$field1} LIKE '%{$date}%' OR {$field2} LIKE '%{$date}%'\";\n return Executor::doit($sql);\n\n }", "function SEARCH()\n{\n $sql = \"select * from CLASH \";\n\n // si se produce un error en la busqueda mandamos el mensaje de error en la consulta\n if (!($resultado = $this->bd->query($sql))){\n\t\treturn 'Error en la consulta sobre la base de datos';\n\t}\n else{ // si la busqueda es correcta devolvemos el recordset resultado\n\t\treturn $resultado;\n\t}\n\n\n}", "public function search()\n {\n $limit = Input::get('limit') ?: 9;\n $offset = Input::get('offset') ?: 0;\n $term = trim(Input::get('term'));\n // $termArray = (strstr($term, ' ')) ? $this->wildcard($term) : $term;\n $busca = [\n 'pedidos' => [],\n 'clientes' => [],\n 'produtos' => [],\n 'offset' => 0,\n ];\n\n try {\n $categories = $this->parseCategories(Input::get('categories'));\n\n if (!$categories || empty($categories)) {\n return $this->listResponse($busca);\n }\n\n if (in_array('pedidos', $categories)) {\n $busca['pedidos'] = $this->orders($term)\n ->offset($offset)\n ->limit($limit)\n ->get([\n 'pedidos.*'\n ]);\n\n $busca['pedidos'] = OrderTransformer::search($busca['pedidos']);\n }\n\n if (in_array('clientes', $categories)) {\n /*$busca['clientes'] = Cliente\n ::with('enderecos')\n ->search($termArray, [\n 'nome' => 100,\n 'taxvat' => 75,\n 'email' => 50,\n 'inscricao' => 25,\n ])*/\n $busca['clientes'] = $this->customers($term)\n ->with('enderecos')\n ->groupBy('id')\n ->orderBy('nome', 'ASC')\n ->offset($offset)\n ->limit($limit)\n ->get();\n\n $busca['clientes'] = ClientTransformer::search($busca['clientes']);\n }\n\n if (in_array('produtos', $categories)) {\n /*$busca['produtos'] = Produto\n ::search($termArray, [\n 'sku' => 125,\n 'titulo' => 100,\n 'ncm' => 75,\n 'ean' => 50,\n 'referencia' => 25,\n ])*/\n $busca['produtos'] = $this->products($term)\n ->groupBy('sku')\n ->orderBy('titulo', 'ASC')\n ->offset($offset)\n ->limit($limit)\n ->get();\n\n $busca['produtos'] = ProductTransformer::search($busca['produtos']);\n }\n\n $busca['offset'] = $offset;\n } catch (\\Exception $exception) {\n \\Log::error(logMessage($exception, 'Ocorreu um erro ao tentar realizar um busca.'));\n }\n\n return $this->listResponse($busca);\n }", "private function buscadorVista($busqueda){\n\n $band = 0;\n $_SERVER['REQUEST_URI'] = str_replace(\"pagina\",\"\", $_SERVER['REQUEST_URI'] );\n if(!array_key_exists('where',$this->sentenciasQuery)){\n\n $this->sentenciasQuery['where']=\" \";\n }else{\n $band=1;\n $this->sentenciasQuery['where']=\"(\".$this->sentenciasQuery['where'].\") and (\";\n }\n $contadorFiltroFecha=0;\n if($this->filtroFecha){\n if(is_string($this->filtroFecha)){\n\n if(!empty($_POST['ctrlBusqDesde'])){\n\n $this->sentenciasQuery['where'].=\"\".$this->filtroFecha.\" >= '\".FechaHora::fechaInvertida($_POST['ctrlBusqDesde']).\"'\";\n ++$contadorFiltroFecha;\n }\n\n if(!empty($_POST['ctrlBusqHasta'])){\n if($contadorFiltroFecha>0) $this->sentenciasQuery['where'].=\" and \";\n $this->sentenciasQuery['where'].=$this->filtroFecha.\" <= '\".FechaHora::fechaInvertida($_POST['ctrlBusqHasta']).\"'\";\n ++$contadorFiltroFecha;\n }\n }\n\n }\n if(is_array($this->camposBusqueda)){\n if(count($this->camposBusqueda)>0){\n if($contadorFiltroFecha>0){\n $this->sentenciasQuery['where'] .=\" and (\";\n }\n $i=0;\n foreach ($this->camposBusqueda as $key => $campo) {\n if($i>0)\n $this->sentenciasQuery['where'].=\" or \";\n $this->sentenciasQuery['where'].=\" $campo like '%$busqueda%' \";\n $i++;\n }\n }else{\n throw new Exception(\"No se han definido campos de busqueda para la vista $this->nombreVista\", 1);\n\n }\n if($band==1){\n $this->sentenciasQuery['where'].=\")\";\n }\n if($contadorFiltroFecha>0){\n $this->sentenciasQuery['where'] .=\")\";\n }\n }else{\n throw new Exception(\"El atributo camposBusqueda no está definido como arreglo\", 1);\n\n }\n\n $this->consultaBD = $this->consultaBD;\n $this->prepareConsulta();\n return $this->crearVista();\n }", "public function search() {\n\t\t\t$Recherches = $this->Components->load( 'WebrsaRecherchesFichesprescriptions93' );\n\t\t\t$Recherches->search();\n\t\t}", "public function search();", "function cari($cari) {\n $query = \"SELECT * FROM pelanggan WHERE NAMA_PELANGGAN LIKE '%$cari%' OR NIK LIKE '%$cari%' OR ALAMAT_PELANGGAN LIKE '%$cari%' OR NOHP_PELANGGAN LIKE '%$cari%' OR EMAIL_PELANGGAN LIKE '%$cari%'\";\nreturn Data_plg($query);\n}", "public function search($module,$ceco){\n\n //en caso de no existir seleccion apareceran todos\n if(($ceco===\"all\")&&($module===\"all\")){\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" 1 \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n //en caso de existir seleccion en modulo buscamos modulo en todos los posibles cecos\n else if (($ceco===\"all\")&&($module!==\"all\")){\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" Modulo='\".$module.\"' \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n //en caso de existir busqueda en ceco buscamos parecidos\n else if (($ceco!==\"all\")&&($module===\"all\")){\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" Kostl LIKE '\".$ceco.\"%' \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n //en caso de existir ambos criterios aplicamos busqueda incluyendolos\n else{\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" Modulo = '\".$module.\"' AND Kostl LIKE '\".$ceco.\"%' \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n }", "public static function search();", "function search()\n\t\t{\n\n\t\t\techo '\n\t\t\t<!-- The search div -->\n\t\t\t<div id=\"content\">\n\n\t\t\t\t<form class=\"card\" id=\"search\">\n\t\t\t\t\t<header class = \"subheading\"><span class=\"fa fa-search\"></span> Package Finder</header>\n\t\t\t\t\t<p>Search by tracking number, customer, shipping provider or item description</p><br>\n\t\t\t\t\t<input id=\"queryField\" type = \"text\" name=\"query\" placeholder = \"e.g enter a tracking number, name, courier or item description to search \" autofocus/><br>\n\t\t\t\t\t<header class=\"subheading searchOptions\">Show results </header>\n\t\t\t\t\t<label for=\"beforeDate\"> Between</label> <input type=\"date\" id=\"before\" name=\"beforeDate\" />\n\t\t\t\t\t<label for=\"afterDate\"> And</label><input type=\"date\" id=\"after\" name=\"afterDate\" />\n\t\t\t\t\t<input id=\"lookupButton\" type=\"submit\" value=\"Find\">\n\n\t\t\t\t\t<header class=\"subheading searchOptions\">Icon guide</header>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-bug\"></i></span> : Package Issue</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-shopping-bag\"></i></span> : Item description</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-ship\"></i></span> : Shipping carrier e.g UPS</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-truck\"></i></span> : Tracking number</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-hashtag\"></i></span> : Account number e.g WEB720</p>\n\t\t\t\t</form>\n\n\n\t\t\t\t<section id = \"lookupResults\">\n\n\t\t\t\t</section>\n\t\t\t</div>';\n\t\t}", "function busqueda($queryExpandida){\n global $terminosConsulta,$q;\n busquedaSolr($queryExpandida);\n foreach($terminosConsulta as $key => $valor){\n $q = $q.\" \".$valor;\n }\n spellChecker();\n //suggestions($q);\n }", "function procurarReports($myDb, $string, $filtro){\r\n\r\n\tglobal $tabAchados;\r\n\tglobal $tabPerdidos;\r\n\tglobal $tabItens;\r\n\r\n\t//Valida a string\r\n\t$string = validarString2($string);\r\n\t$filtro = validarString2($filtro);\r\n\r\n\tif (strlen($string) < 1) {\r\n\t\techo \"Erro: informar algo para ser buscado.\";\r\n\t\treturn \"falha\";\r\n\t}\r\n\r\n\tif (strlen($filtro) < 1) {\r\n\t\techo \"Erro: informar o filtro.\";\r\n\t\treturn \"falha\";\r\n\t}\r\n\r\n\t//Busca por data\r\n\tif (strcmp($filtro, \"data\") == 0) {\r\n\r\n\t\t//Busca na tabela de achados\r\n\t\t$resultatosBusca = searchData($myDb, $tabAchados, \"data\", $string, \"s\");\r\n\t\t\r\n\t\t//Busca na tabela de perdidos\r\n\t\t$temp = searchData($myDb, $tabPerdidos, \"data\", $string, \"s\");\r\n\t\t\r\n\t\tfor ($i=0; $i<count($temp); $i++) { \r\n\t\t\tarray_push($resultatosBusca, $temp[$i]);\r\n\t\t}\r\n\t\t\r\n\t\treturn $resultatosBusca;\r\n\t\r\n\t//Busca por local de marcacao\r\n\t} elseif (strcmp($filtro, \"local\") == 0) {\r\n\r\n\t\t//Busca na tabela de achados\r\n\t\t$resultatosBusca = searchData($myDb, $tabAchados, \"mapsLocal\", $string, \"s\");\r\n\t\t\r\n\t\t//Busca na tabela de perdidos\r\n\t\t$temp = searchData($myDb, $tabPerdidos, \"mapsLocal\", $string, \"s\");\r\n\t\t\r\n\t\tfor ($i=0; $i<count($temp); $i++) { \r\n\t\t\tarray_push($resultatosBusca, $temp[$i]);\r\n\t\t}\r\n\t\t\r\n\t\treturn $resultatosBusca;\r\n\t \r\n\t //Busca por titulo do item\r\n\t } elseif (strcmp($filtro, \"titulo\") == 0) {\r\n\t\t\treturn seachTabelaItens($myDb, $tabItens, \"titulo\", $string, \"s\");\r\n\t\t\t\r\n\t\t//Busca por marca do item\r\n\t\t} elseif (strcmp($filtro, \"marca\") == 0) {\r\n\t\t\treturn seachTabelaItens($myDb, $tabItens, \"marca\", $string, \"s\");\r\n\t \r\n\t //Busca por identificador do item\r\n\t\t } elseif (strcmp($filtro, \"identificador\") == 0) {\r\n\t\t\t\treturn seachTabelaItens($myDb, $tabItens, \"identificador\", $string, \"s\");\r\n\t }\r\n\r\n}", "function formulaires_inscription3_recherche_charger_dist(){\n\n\t$datas['ordre'] = _request('ordre');\n\t$datas['desc'] = _request('desc');\n\t$datas['case'] = _request('case');\n\t$datas['valeur'] = _request('valeur');\n\n\t$datas['exceptions'] = pipeline('i3_exceptions_des_champs_auteurs_elargis',array());\n\n\tif(_request('afficher_tous')){\n\t\tset_request('valeur','');\n\t\tset_request('case','');\n\t}\n\treturn $datas;\n}", "public function Busqueda_General(){\n $Id_Area_Consulta = Session::Get('Id_Area_Consulta');\n $Texto_Busqueda = General_Functions::Validar_Entrada('texto_busqueda','TEXT');\n $Tipo_Busqueda = General_Functions::Validar_Entrada('tipo_busqueda','TEXT');\n $pagina = General_Functions::Validar_Entrada('Pagina','NUM');\n\n if ( strlen($Texto_Busqueda) > 0 ){\n $this->View->SetCss(array('tron_carrito' , 'tron_productos_categorias_marcas','tron_estilos-titulos_destacados_novedades_ofertas','tron_varias_referencias-ofertas-tecnologias_SA'));\n $this->View->SetJs(array('tron_productos.jquery','tron_carrito','tron_marcas_categorias','mostrar_tabla_carrito'));\n $this->View->Productos = $this->Productos->Busqueda_General($Texto_Busqueda, $Tipo_Busqueda);\n $this->View->Productos_Pagina = $this->Paginador->Paginar($this->View->Productos, $pagina);\n $this->View->Paginacion = $this->Paginador->Mostrar_Paginacion('paginador_ajax');\n Session::Set('nom_categoria','');\n $this->View->Mostrar_Vista('resultado_busqueda');\n\n }\n\n }", "function searchFumetti($p, $ordine){\n\t//$p = htmlspecialchars($p, ENT_QUOTES);\n\t$query = \"SELECT *, nome as `nomeFum` FROM `Fumetti` WHERE `Fumetti`.`nome` LIKE '%$p%' OR `volume` like '$p' ORDER BY '$ordine' \";\n\treturn eseguiQuery($query);\n\n}", "function Search($size,$gfx,$flat = 0){\n\t\n\tglobal $db_category,$db_articles;\n\t\n\t$_GET['filter'] = AGet($_GET,'filter');\n\t$_GET['lang'] = AGet($_GET,'lang');\n\t\n\tif (!empty($_POST['podminka'])){$podminka = $_POST['podminka'];} else {$podminka = AGet($_GET,'podminka');}\n\tif (!empty($_POST['search_choice'])){$search_choice = $_POST['search_choice'];} else {$search_choice = AGet($_GET,'search_choice');}\n\tif (!empty($_POST['retezec'])){$retezec = $_POST['retezec'];} else {$retezec = AGet($_GET,'retezec');}\n\t\n\t$retezec = stripslashes($retezec);\n\t$retezec = htmlspecialchars($retezec, ENT_QUOTES);\n \techo \"<form action=\\\"index.php?action=search&amp;lang=\".$_GET['lang'].\"&amp;filter=\".$_GET['filter'].\"\\\" method=\\\"post\\\">\";\n\techo \"<input type=\\\"text\\\" name=\\\"retezec\\\" size=\\\"\".$size.\"\\\" maxlength=\\\"50\\\" value=\\\"\".$retezec.\"\\\">\"; if ($flat == 0){ echo \"<br>\";}\n\techo \"<select name=\\\"podminka\\\"><option value=\\\"1\\\" \"; if ($podminka == 1){echo \"selected=\\\"selected\\\"\";} echo \">\"._SEARCH_PODMINKA_1.\"</option>\";\n\techo \" <option value=\\\"2\\\" \"; if ($podminka == 2){ echo \"selected=\\\"selected\\\"\";} echo \">\"._SEARCH_PODMINKA_2.\"</option>\";\n\techo \"\t<option value=\\\"3\\\" \"; if ($podminka == 3){ echo \"selected=\\\"selected\\\"\";} echo \">\"._SEARCH_PODMINKA_3.\"</option>\";\n\techo \"</select>\"; if ($flat == 0){echo \"<br>\"; }\n\techo _SEARCH_CHOICE_WHERE; if ($flat == 0){echo\"<br>\";}\n\techo \"<input type=\\\"radio\\\" name=\\\"search_choice\\\" value=\\\"article\\\" \"; if ($search_choice == \"article\" || $search_choice == \"\"){echo \"checked\";} echo \"> \"._SEARCH_CHOICE_ARTICLES; if ($flat == 0){echo \"<br>\"; }\n\techo \"<input type=\\\"radio\\\" name=\\\"search_choice\\\" value=\\\"news\\\" \"; if ($search_choice == \"news\"){echo \"checked\";} echo \"> \"._SEARCH_CHOICE_ACT; if ($flat == 0){echo \"<br>\"; }\n\techo \"<input type=\\\"submit\\\" class=\\\"eden_button\\\" value=\\\" \";if ($gfx != 1){echo _CMN_SUBMIT_SEARCH;} echo \"\\\">\";\n\techo \"</form>\";\n}", "public function consulta() {\n if ($this->Form->parameters) {\n $page=($this->Form->parameters[0])?$this->Form->parameters[0]:1;\n $criterio=$this->Form->busqueda;\n $paged=$this->Form->conPaginacion;\n } else {\n $criterio=\"\";\n $page=1;\n $paged=true;\n }\n if ($paged) {\n $rows=$this->modeloContactos->buscarCaulquierPaginado($criterio,$page,15);\n $this->jQ(\"#paging\")->html($this->paginacion($page));\n } else {\n $rows=$this->modeloContactos->buscarCaulquier($criterio);\n $this->jQ(\"#paging\")->empty();\n }\n $cuerpo=\" \";\n if (!$rows) {\n $this->jWarning(\"No hay resultados de la busqueda\");\n return false;\n }\n $cuerpo=$this->preparaTabla($rows);\n // Modifica las filas de la consulta por jquery. Solo a peticion desde la vista con APJSubmit\n $this->jQ(\"#cuerpo\")->html($cuerpo);\n // Retorna la filas de la consulta al controlador para que genere la vista, llamdado desde la vista con APJ:{consulta(1)}\n return $cuerpo;\n }", "public function busqueda()\n {\n \tif ($this->request->is('ajax')) {\n //recibe el codigo via ajax\n \t\t$this->autoRender=false;\n \t\t$codigo=$_POST['id'];\n //obtiene la cotizacion y la envia a la vista\n \t\t$cotizacion=$this->Cotizacion->get($codigo);\n \t\t//busca el nombre del proveedor en la base de datos sgbodega\n \t\t$conn = ConnectionManager::get('copec');\n \t\t$results = $conn->execute('SELECT PR_RAZON FROM proveedor WHERE PR_NCORR='.$cotizacion->codigoEmpresa);\n \t\t$NombreP=$results->fetch('assoc');\n \t\t$NombreP=$NombreP['PR_RAZON'];\n //asigna el nombre a la cotizacion\n \t\t$cotizacion->codigoEmpresa=$NombreP;\n \t//busca el nombre de la empresa comprante en base de datos sgyonley\n \t\t$conn = ConnectionManager::get('copec');\n \t\t$results = $conn->execute('SELECT empe_desc FROM empresas WHERE empe_rut='.$cotizacion->codigoComprador);\n \t\t$Comprante=$results->fetch('assoc');\n //cuando lo obtiene lo asigna a la cotizacion\n \t\t$cotizacion->codigoComprador = $Comprante['empe_desc'];\n \t\t$cotizacion->fechaCotizacion=$cotizacion->fechaCotizacion->i18nFormat('dd-MM-YYYY');\n \t\techo json_encode($cotizacion);\n \t}\n }", "function busqueda($buscar,$num){\n\t\t$filas = 12; /*AQUI PUEDO AJUSTAR A CUANTAS PAGINAS QUIERO QUE TENGA LA PAGINACION*/\n\t\tif(isset($_GET[\"pagina\"])){\n\t\t\t$pagina = $_GET[\"pagina\"];\n\t\t}\n\t\telse{\n\t\t\t$pagina = 1;\n\t\t}\n\n\t\t$empezar = ($pagina-1)*$filas;/*PARA LA PAGINACION*/\n\t\ttry{\n\n\t\t\t$bdd=new PDO(\"mysql:host=localhost; dbname=digusti\", \"root\", \"\"); //conexion a la base de datos\n\n\t\t\t$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n\t\t\t\n\t\t\tif($num==1){/*BUSCADOR INGRESADO POR EL USUARIO*/\n\t\t\t\t$sql=\"SELECT * FROM PRODUCTOS WHERE NOMBRE LIKE ? ORDER BY NOMBRE LIMIT $empezar,$filas\"; /*CONSULTA PAGINADA*/\n\n\t\t\t\t$sql2=\"SELECT * FROM PRODUCTOS WHERE NOMBRE LIKE ? ORDER BY NOMBRE\"; /*CONSULTA NORMAL*/\n\n\t\t\t\t$bdd->exec(\"SET CHARACTER SET utf8\");\n\n\t\t\t\t$query=$bdd->prepare($sql);\n\n\t\t\t\t$query->execute(array(\"%$buscar%\"));\n\n\t\t\t\t$total=$bdd->prepare($sql2); $total->execute(array(\"%$buscar%\")); /*PARA RECOJER NUMERO DE PRODUCTOS*/\n\t\t\t}\n\t\t\t\n\t\t\telse{/*CATEGORIA NORMAL DE LA BARRA DE BUSQUEDA*/\n\t\t\t\t//$sql=\"SELECT * FROM PRODUCTOS WHERE CATEGORIA= :pro ORDER BY NOMBRE LIMIT $empezar,$filas\"; /*CONSULTA PAGINADA*/\n\n\t\t\t\t//$sql2=\"SELECT * FROM PRODUCTOS WHERE CATEGORIA= :pro ORDER BY NOMBRE\"; /*CONSULTA NORMAL*/\n\t\t\t\t/*\n\t\t\t\t$bdd->exec(\"SET CHARACTER SET utf8\");\n\n\t\t\t\t$query=$bdd->prepare($sql);\n\n\t\t\t\t$query->execute(array(\":pro\"=>$buscar));\n\n\t\t\t\t$total=$bdd->prepare($sql2); $total->execute(array(\":pro\"=>$buscar));*/ /*PARA RECOJER NUMERO DE PRODUCTOS*/\n\n\t\t\t\t$sql=\"SELECT * FROM $buscar ORDER BY NOMBRE LIMIT $empezar,$filas\"; /*CONSULTA PAGINADA*/\n\n\t\t\t\t$sql2=\"SELECT * FROM $buscar ORDER BY NOMBRE\"; /*CONSULTA NORMAL*/\n\n\t\t\t\t$bdd->exec(\"SET CHARACTER SET utf8\");\n\n\t\t\t\t$query=$bdd->query($sql);\n\n\t\t\t\t$total=$bdd->query($sql2); /*PARA RECOJER NUMERO DE PRODUCTOS*/\n\t\t\t}\n\t\t\n\t\t\t$contador=0;\n\t\t\t$cantidad = $total->rowCount();\n\t\t\t/*SECCION PARA ACOMODAR LA INFORMACION DE LA PAGINACIONA*/\n\t\t\t$empezar++; /*para imprimir el numerito de la paginacion producto inicial*/\n\t\t\t$empezarf = $empezar+$filas-1; \n\t\t\tif(!($empezarf<$cantidad)){\n\t\t\t\t$empezarf=$cantidad;\n\t\t\t}\n\t\t\t$tpag = ceil($cantidad/$filas); /*CANTIDAD DE PAGINAS TOTALES QUE DEBERIA TENER LA PAGINACION*/\n\n\t\t\t/*IMPRESION DE LA CANTIDAD DE PRODUCTOS*/ \n\t\t\t/* ECHO NORMAL POR SI LA PAGINACION SALE CHIMBA\n\t\t\t\techo \"\n\t\t\t \t <div class='col-9'>\n\t\t\t \t <h6 class='text-muted mb-lg-3 mb-2'>Cantidad de Productos: <strong class='text-dark'>(\".$cantidad.\")</strong></h6>\n\t\t\t \t </div>\";*/\n\t\t\t\n\t\t\t/*IMPRESION POR SI HAY PAGINACION*/\n\t\t\t\techo \"\t\n\t\t\t\t\t<div class='row justify-content-between w-80 pag'>\n\t\t\t\t <div class='col-xl-4 col-lg-4 col-md-5 col-sm-12'>\n\t\t\t\t <h6 class='text-muted mb-lg-3 mb-2'>Cantidad de Productos: <strong class='text-dark'>(\".$cantidad.\")</strong></h6>\n\t\t\t\t </div>\n\t\t\t\t <div class='col-xl-4 col-lg-3 col-md-4 col-sm-12 text-right'>\n\t\t\t\t \t<h6 class='text-muted mb-lg-3 mb-2'>\".$empezar.\"-\".$empezarf.\" / Página\";\n\t\t\t\tfor($i=1; $i<=$tpag; $i++){\n\t\t\t\t if($pagina==$i){\n\t\t\t\t \techo \"<a class='text-dark' href='productos.php?producto=\".$buscar.\"&pagina=\".$i.\"'><strong> \".$i.\"</strong></a>\";\n\t\t\t\t }\n\t\t\t\t else{\n\t\t\t\t \techo \"<a class='text-muted' href='productos.php?producto=\".$buscar.\"&pagina=\".$i.\"'> \".$i.\"</a>\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\techo \" </h6>\n\t\t\t\t </div>\n\t\t\t\t </div>\";\n\t\t\t\t \n\t\t\t/*IMPRESION DE LA TABLA DEVUELTA POR LA CONSULTA DE LOS PRODUCTOS*/\n\n\t\t\twhile($tabla=$query->fetch(PDO::FETCH_ASSOC)){\n\t\t\t\tglobal $contador;\n\t\t\t\t$contador++;\n\t\t\t\t\techo \" <div class='card col-xl-3 col-lg-4 col-md-5 col-sm-6 col-10 mb-2 mx-md-2 mx-0'>\n\t\t\t\t\t\t\t <img class='card-img-top' src='\".$tabla[\"Imagen\"].\"' alt='Card image cap' height='180'>\n\t\t\t\t\t\t\t <div class='card-body'>\n\t\t\t\t\t\t\t <h5 class='card-title d-inline'>\".$tabla[\"Nombre\"].\"</h5>\";\n\n\t\t\t\t\techo\"\t <p class='card-text text-center text-danger font-weight-bold' style='font-size: 2.2rem; margin-top: -8px'>\".$tabla[\"Precio\"].\"\n\t\t\t\t\t\t\t <span class='font-weight-normal' style='font-size: 1.5rem'>Bs<span>\";\n\n\t\t\t\t\tif($tabla[\"Categoria\"]!=\"Bodega\"){\n\t\t\t\t\t\t\t echo \"<font size='2' class='text-dark'> x Kg</font>\";}\n\t\t\t\t\telse{\n\t\t\t\t\t\t\t\techo \"<font size='2' class='text-dark'> x Und</font>\";}\n\t\t\t\t\t\t\t \n\t\t\t\t\techo\"\t </p>\n\t\t\t\t\t\t\t <div class='row' style='margin-top: -12px'>\n\t\t\t\t\t\t\t <input id='\".$tabla[\"Codigo\"].\"' align='left' class='col-2 form-control form-control-sm cantidad' type='number' name='cantidad' value='1' min='1'><font size='2' class='m-auto'>.und</font>\n\t\t\t\t\t\t\t <a id='\".$tabla[\"Codigo\"].\"' class='text-white btn bg-success btn-primary col-8 font-weight-bold borde car'>Agregar al Carrito</a>\n\t\t\t\t\t\t\t </div>\n\t\t\t\t\t\t\t </div>\n\t\t\t\t\t\t\t</div>\";\n\t\t\t}\n\n\t\t\tif($contador==0){\n\t\t\t\techo \"\n\t\t\t\t <script>$('.pag').hide();</script>\t\n\t\t\t <div class='col-md-8 col-12'>\n\t\t\t <h5 class='text-muted mb-lg-4 mb-2'>Resultado para: <strong class='text-dark'>\".$buscar.\"</strong></h5>\n\t\t\t <p class='display-6 text-dark mb-3'><span class='display-5 text-primary'>LO SENTIMOS,</span><br>NO SE HAN ENCONTRADO RESULTADOS COINCIDENTES</p>\n\t\t\t <h5 class='text-muted'>¡Prueba a realizar otra búsqueda!</h5>\n\t\t\t </div>\";\n\t\t\t}\n\n\t\t$query->closeCursor();\n\n\t\t}catch(Exception $e){\n\n\t\t\tdie('Error: ' . $e->GetMessage());\n\n\t\t}finally{\n\n\t\t\t$bdd=NULL;\n\t\t}\n\t}", "public function find() {\n \tif ($this->request->is('ajax')) {\n //impide la creacion de vista\n \t\t$this->autoRender = false; \n //recibe el string con el termino a buscar\n \t\t$name = $this->request->query('term'); \n //busca en la base de datos todos los nombres parecidos \n \t\t$conn = ConnectionManager::get('copec');\n \t\t$results = $conn->execute('SELECT TA_BUSQUEDA, TA_NCORR FROM tallasnew WHERE TA_BUSQUEDA like \"%'.$name.'%\"');\n \t\t$resultArr = array();\n \t\t$Repuesto=$results->fetchAll('assoc');\n //cuando lo obtiene lo manda a la vista encondado como json\n \t\tforeach($Repuesto as $Repuesto) { \n \t\t\t$resultArr[] = array('label' =>$Repuesto['TA_BUSQUEDA'],'mid'=>$Repuesto['TA_NCORR']);\n \t\t}\n //envia la lsita encodad como json\n \t\techo json_encode($resultArr); \n \t} \n }", "public function getDependencias( $search, $return='array') {\n \t\n\t\ttry \n\t\t{ \n\t\t if(strlen($return)==0) return false;\n\t\t\t \n\t\t\t $start = $search['start'] ? $search['start'] : 0;\n\t\t\t $limit = $search['limit'] ? $search['limit'] : 10;\n\t\t\t \n\t\t\t \n\t\t\t $sql=\"\n\t\t\t SELECT d.*,\n\t\t\t\t ( SELECT d_localidad FROM cat_localidad WHERE id_localidad = depe_ciudad) nciudad,\n\t\t\t\t ( SELECT d_colonia FROM cat_colonias WHERE id_colonia = depe_colonia ) ncolonia ,\n\t\t\t\t ( SELECT nombre FROM cat_calles WHERE id_calle = depe_calle) ncalle\n\t\t FROM cat_dependencias d\n\t\t\t WHERE 1 = 1\n\t\t\t \";\n\t\t\t \n\t\t\t if(strlen($search['grupo'])>0){ $sql.=\" AND depe_grupo LIKE '\".$search['grupo'].\"'\";}\n\t\t\t if(strlen($search['query'])>0){ $sql.=\" AND depe_nombre LIKE '%\".$search['query'].\"%'\";}\t\t\t \t\n\t\t\n\t\t $csql = \"\t\n\t\t SELECT SQL_CALC_FOUND_ROWS\n\t\t\t depe_dependencia AS id,\n\t\t\t depe_nombre AS value,\n\t\t\t\t\tIFNULL(CONCAT(initcap(ncalle),' ',initcap(depe_entre),' ',initcap(depe_y_entre),' No. ',depe_numero,', Col. ',ncolonia,', ',nciudad),' ') info \n\t\t\t FROM ( \n\t\t\t $sql \n\t\t\t\t\t) a\n\t\t\t WHERE 1 = 1\n\t\t\t ORDER BY depe_nombre\";\n\t\t\t \t\t\t\n\t\t\t\t\t\t \t\t\t \n\t\t\t $rs = $this->db->SelectLimit($csql, $limit, $start);\n\t\t\t $tt = $this->db->GetOne(\"SELECT FOUND_ROWS()\");\n\t\t\t \n\t\t\t if($return=='response'){\n\t\t\t $rows = $rs->GetAll();\n\t\t\t\t $rs->Close();\n\t\t\t\t $response = array('success'=>true, 'rows'=>$rows, 'total'=>$tt, 'sql'=>$sql );\n\t\t\t\t return $response;\t\t\t \n\t\t\t }elseif ($return=='array'){\n\t\t\t\t $rows = $rs->GetAll();\n\t\t\t $rs->Close();\n\t\t\t\t return $rows;\n\t\t\t }elseif($return=='pipe'){\n\t\t\t $str = '';\n\t\t\t\t while($row = $rs->FetchRow()){\n\t $str.= $row['descrip'].\"|\".$row['clave'].\"\\n\";\n\t }\n\t\t\t\t $rs->Close();\n\t\t\t\t return $str;\t\t \n\t\t\t }\n\t\t\t \n\t\t\t \n\t\t}catch(Exception $e){\t\t \n\t\t\t$this->setError($e->getCode(), $e->getMessage());\n\t\t\tthrow new Exception( $e->getMessage() , $e->getCode() );\t\n\t\t}\t\t\t\t\n }", "public function buscar()\n {\n $query = Input::get('search');\n\n // Returns an array of products that have the query string located somewhere within\n // our products product name. Paginate them so we can break up lots of search results.\n $search = Producto::where('nombre', 'LIKE', '%' . $query . '%')->paginate(200);\n\n // If no results come up, flash info message with no results found message.\n if ($search->isEmpty()) {\n flash('No se encontraron resultados de ese producto. Por favor intente otra vez', 'info')->important();\n return redirect('/tienda');\n }\n\n // Return a view and pass the view the list of products and the original query.\n return view('templates.tienda.show-buscador', compact('search', 'query'));\n }", "function anamnesa_search($anam_id ,$anam_cust ,$anam_tanggal ,$anam_petugas ,$anam_pengobatan ,$anam_perawatan ,$anam_terapi ,$anam_alergi ,\r\n\t\t\t\t\t\t\t\t $anam_obatalergi ,$anam_efekobatalergi ,$anam_hamil ,$anam_kb ,$anam_harapan ,$start,$end){\r\n\t\t\t//full query\r\n\t\t\t$query = \"SELECT * FROM anamnesa,customer,karyawan\r\n\t\t\t\t\t\tWHERE anam_cust=cust_id AND anam_petugas=karyawan_id\";\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tif($anam_cust!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" anam_cust LIKE '%\".$anam_cust.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($anam_tanggal!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" anam_tanggal LIKE '%\".$anam_tanggal.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($anam_petugas!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" anam_petugas LIKE '%\".$anam_petugas.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($anam_pengobatan!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" anam_pengobatan LIKE '%\".$anam_pengobatan.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($anam_perawatan!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" anam_perawatan LIKE '%\".$anam_perawatan.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($anam_terapi!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" anam_terapi LIKE '%\".$anam_terapi.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($anam_alergi!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" anam_alergi LIKE '%\".$anam_alergi.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($anam_obatalergi!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" anam_obatalergi LIKE '%\".$anam_obatalergi.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($anam_efekobatalergi!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" anam_efekobatalergi LIKE '%\".$anam_efekobatalergi.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($anam_hamil!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" anam_hamil LIKE '%\".$anam_hamil.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($anam_kb!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" anam_kb LIKE '%\".$anam_kb.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($anam_harapan!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" anam_harapan LIKE '%\".$anam_harapan.\"%'\";\r\n\t\t\t};\r\n\t\t\t$result = $this->db->query($query);\r\n\t\t\t$nbrows = $result->num_rows();\r\n\t\t\t\r\n\t\t\t$limit = $query.\" LIMIT \".$start.\",\".$end;\t\t\r\n\t\t\t$result = $this->db->query($limit); \r\n\t\t\t\r\n\t\t\tif($nbrows>0){\r\n\t\t\t\tforeach($result->result() as $row){\r\n\t\t\t\t\t$arr[] = $row;\r\n\t\t\t\t}\r\n\t\t\t\t$jsonresult = json_encode($arr);\r\n\t\t\t\treturn '({\"total\":\"'.$nbrows.'\",\"results\":'.$jsonresult.'})';\r\n\t\t\t} else {\r\n\t\t\t\treturn '({\"total\":\"0\", \"results\":\"\"})';\r\n\t\t\t}\r\n\t\t}", "function promo_search($promo_acara ,$promo_tempat,$promo_keterangan ,$promo_tglmulai ,$promo_tglselesai ,\r\n\t\t\t\t\t\t\t $promo_diskon ,$start,$end){\r\n\t\t\t//full query\r\n\t\t\t$query=\"select *\r\n\t\t\t\t\tfrom promo\";\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tif($promo_acara!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" promo_acara LIKE '%\".$promo_acara.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($promo_tempat!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" promo_tempat LIKE '%\".$promo_tempat.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($promo_keterangan!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" promo_keterangan LIKE '%\".$promo_keterangan.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($promo_tglmulai!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" promo_tglmulai LIKE '%\".$promo_tglmulai.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($promo_tglselesai!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" promo_tglselesai LIKE '%\".$promo_tglselesai.\"%'\";\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tif($promo_diskon!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" promo_diskon LIKE '%\".$promo_diskon.\"%'\";\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\t$result = $this->db->query($query);\r\n\t\t\t$nbrows = $result->num_rows();\r\n\t\t\t\r\n\t\t\t$limit = $query.\" LIMIT \".$start.\",\".$end;\t\t\r\n\t\t\t$result = $this->db->query($limit); \r\n\t\t\t\r\n\t\t\tif($nbrows>0){\r\n\t\t\t\tforeach($result->result() as $row){\r\n\t\t\t\t\t$arr[] = $row;\r\n\t\t\t\t}\r\n\t\t\t\t$jsonresult = json_encode($arr);\r\n\t\t\t\treturn '({\"total\":\"'.$nbrows.'\",\"results\":'.$jsonresult.'})';\r\n\t\t\t} else {\r\n\t\t\t\treturn '({\"total\":\"0\", \"results\":\"\"})';\r\n\t\t\t}\r\n\t\t}", "function create_search() {\n\t\t$this->include_scripts();\n\t\t$this->include_styles();\n\t\tob_start();\n\t\t?>\n\t\t<div class=\"searchbar\">\n\t\t <input id=\"searchfor\" type=\"text\" value=\"\" maxlength=\"75\" autocorrect=\"off\" spellcheck=\"false\" autocomplete=\"off\" autocapitalize=\"off\" placeholder=\"Zoek een abonnement...\" class=\"search\">\n\t\t</div>\n\t\t<div class=\"selection-list\">\n\t\t\t<div class=\"selection-container\" id=\"selection-container-id\" style=\"display: none;\">\n\t\t\t</div>\n\t\t</div>\n\t\t<?php\n\t\treturn ob_get_clean();\n\t}", "function form($searchString)\r\n {\r\n \tif (session::get(\"hyrarchy\")) echo \"<div id='search' class='search'>\";\r\n \telse echo \"<div id='searchbig' class='search'>\";\r\n\r\n\r\n echo \"<form method='GET' action='index.php' name='search'>\";\r\n echo \"<b>Suche in</b><br>\";\r\n \r\n// Freie Suche\r\n if (!session::get(\"searchstart\") and !session::get(\"searchexact\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n \r\n echo form::field(\"radio\",\"searchtype\",0,\"\",$checkString,\"\",\"frei\",\"search-free\");\r\n \r\n// Suche am Wortanfang\r\n if (session::get(\"searchstart\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n\r\n echo form::field(\"radio\",\"searchtype\",1,\"\",$checkString,\"\",\"Wortanfang\",\"search-start\");\r\n\r\n// exakte Suche\r\n if (session::get(\"searchexact\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n\r\n echo form::field(\"radio\",\"searchtype\",2,\"\",$checkString,\"\",\"exact\",\"search-exact\");\r\n\r\n\r\n// search in comment field\r\n if (session::get(\"searchcom\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n echo form::field(\"checkbox\",\"searchcom\",1,\"\",$checkString,\"\",\"Erl&auml;uterungen\",\"search-comment\");\r\n\r\n\r\n // search only for ordered entries\r\n // create array for selector\r\n $typeArray = thesaurus::get_type_list();\r\n $statusArray = thesaurus::get_status_list();\r\n $ownerArray = user::get_users(\"entry\");\r\n\r\n if (count($statusArray))\r\n {\r\n echo \"<br>\";\r\n echo form::selector(\"searchentrytype\",$typeArray,1,\"\",session::get(\"searchentrytype\"),\"\",\" Begriffstype \",\"searchtype\",\"\");\r\n echo form::selector(\"searchstatus\",$statusArray,1,\"\",session::get(\"searchstatus\"),\"\",\" Status \",\"searchstatus\",\"\");\r\n echo form::selector(\"searchowner\",$ownerArray,1,\"\",session::get(\"searchowner\"),\"\",\" Eigentümer mit Einträgen \",\"searchowner\",\"\");\r\n }\r\n else\r\n echo form::link(\"\",\"<span class='small'>Keine beantragten Einträge</span>\",\"\",\"no-ordered\");\r\n \r\n\r\n// search field\r\n echo \"<p><input type='text' size='35' name='searchString' value='\" . session::get(\"search\") . \"' \";\r\n echo help::show(\"search-field\",\"\");\r\n echo \">\";\r\n\r\n \r\n echo form::field(\"submit\",\"action\",\"suchen\",\"\",\"\",\" \",\"\",\"search\");\r\n echo form::field(\"submit\",\"reset\",\"zurücksetzen\",\"\",\"\",\" \",\"\",\"newsearch\");\r\n echo \"</form></p>\";\r\n echo \"</div>\";\r\n }", "function searchSerie($p, $ordine){\n\t$query = \"SELECT * FROM `Serie` WHERE `nome` LIKE '%$p%' ORDER BY '$ordine'\";\n\treturn eseguiQuery($query);\n}", "public static function busquedaMedico($text='',$area=null){\n $text='%'.htmlentities($text).'%';\n if (Session::valid_session()) {\n $paciente=$_SESSION['id'];\n if (is_numeric($area) and $area>=1) {\n $query=\"SELECT m.`id`, m.`nombre`, `cedula`, `area`, `estatus`, `correo`,a.nombre as 'nombre_area',DATE_FORMAT(fecha_registro,'%d/%b/%Y') AS 'fecha_registro'\n FROM `medicos` m\n inner join soport16_chatdoc.areas a on m.area=a.id\n WHERE m.`nombre` LIKE ? AND m.`area`=?\n ORDER BY id DESC\";\n $results=resultados_query($query,'si',$text,$area);\n \n } else {\n $query=\"SELECT m.`id`, m.`nombre`, `cedula`, `area`, `estatus`, `correo`,a.nombre as 'nombre_area',DATE_FORMAT(fecha_registro,'%d/%b/%Y') AS 'fecha_registro'\n FROM `medicos` m\n inner join soport16_chatdoc.areas a on m.area=a.id\n WHERE m.`nombre` LIKE ?\n ORDER BY id DESC\";\n $results=resultados_query($query,'s',$text);\n \n }\n $cant=mysqli_num_rows($results);\n if ($cant>=1) {\n $hilos = array();\n $hilos['cantidad']=$cant;\n while ($r=mysqli_fetch_array($results)) {\n $hilos['registros'][$r['id']]= array(\n 'nombre' => $r['nombre']\n ,'correo' => $r['correo']\n ,'cedula' => $r['cedula']\n ,'fecha' => $r['fecha_registro']\n ,'nombre_area' => $r['nombre_area']\n ,'num_area' => $r['area']\n ,'estatus' => $r['estatus']\n );}\n return $hilos;\n } else {\n return 0;\n }\n } else {\n return -4;\n }\n\n /*\n foreach:\n [idHilo]={area, estatus,motivo}\n */\n }", "public function buscar() \n {\n \n if($buscar = \\Request::get('q')){\n $insumo= Insumo:: where(function($query) use ($buscar){\n $query->where('marca','LIKE', \"%$buscar%\")->orWhere('tipo','LIKE',\"%$buscar%\");\n\n })->paginate(20);\n }\n\n return $insumo; //retorna toda la consulta\n }" ]
[ "0.6637447", "0.63712955", "0.6286906", "0.62804216", "0.6269076", "0.6250621", "0.6221588", "0.6198726", "0.6147375", "0.6082318", "0.60682327", "0.6066653", "0.60512227", "0.604357", "0.6039009", "0.60226685", "0.60013586", "0.5988062", "0.59865904", "0.5980815", "0.59783465", "0.59777504", "0.59743893", "0.5963381", "0.596203", "0.5944705", "0.5933081", "0.59056187", "0.5903517", "0.5902921" ]
0.67388725
0
Obtiene el catalogo de grupos $search string : palabra a buscar $return string : Forma en que debe de devolver los datos
public function getGrupos( $search, $return='array') { try { if(strlen($return)==0) return false; $start = $search['start'] ? $search['start'] : 0; $limit = $search['limit'] ? $search['limit'] : 10; $sql = " SELECT SQL_CALC_FOUND_ROWS id_grup AS id , d_grupo AS value, initcap(d_categoria) AS info, ( SELECT COUNT(grupo) ngrupo FROM ( SELECT pers_persona, pers_grupo grupo FROM personas UNION ALL SELECT pins_persona,pins_grupo grupo FROM contact_institutions ) p WHERE p.grupo = g.id_grup ) num FROM cat_grupos g, cat_categorias c WHERE g.id_cat = c.id_categoria"; if(strlen($search['categoria'])>0 ){ $sql.=" AND id_cat = '".$search['categoria']."'"; } if(strlen($search['query'])>0 ){ $sql.=" AND g.d_grupo LIKE '%".$search['query']."%'"; } $sql.=" ORDER BY d_categoria, d_grupo ASC "; $rs = $this->db->SelectLimit($sql, $limit, $start); $tt = $this->db->GetOne("SELECT FOUND_ROWS()"); if($return=='response'){ $rows = $rs->GetAll(); $rs->Close(); $response = array('success'=>true, 'rows'=>$rows, 'total'=>$tt, 'sql'=>$sql ); return $response; }elseif ($return=='array'){ $rows = $rs->GetAll(); $rs->Close(); return $rows; }elseif($return=='pipe'){ $str = ''; while($row = $rs->FetchRow()){ $str.= $row['descrip']."|".$row['clave']."\n"; } $rs->Close(); return $str; } }catch(Exception $e){ $this->setError($e->getCode(), $e->getMessage()); throw new Exception( $e->getMessage() , $e->getCode() ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fill_search_prod(){\n\t\t$user_info = select(\"select codigo from producto where activo=1\");\n\t\techo('<optgroup label=\"Codigo\">');\n\t\tfor($i=0;$i<count($user_info);$i++){\n\t\t\techo('<option value=\"'.array_values($user_info[$i])[0].'\">'.array_values($user_info[$i])[0].'</option>');\n\t\t}\n\t\techo('<optgroup label=\"Nombre\">');\n\t\t$user_info = select(\"select codigo, nombre from producto where activo=1\");\n\t\tfor($i=0;$i<count($user_info);$i++){\n\t\t\techo('<option value=\"'.array_values($user_info[$i])[0].'\">'.array_values($user_info[$i])[1].'</option>');\n\t\t}\n\t}", "function Search($size,$gfx,$flat = 0){\n\t\n\tglobal $db_category,$db_articles;\n\t\n\t$_GET['filter'] = AGet($_GET,'filter');\n\t$_GET['lang'] = AGet($_GET,'lang');\n\t\n\tif (!empty($_POST['podminka'])){$podminka = $_POST['podminka'];} else {$podminka = AGet($_GET,'podminka');}\n\tif (!empty($_POST['search_choice'])){$search_choice = $_POST['search_choice'];} else {$search_choice = AGet($_GET,'search_choice');}\n\tif (!empty($_POST['retezec'])){$retezec = $_POST['retezec'];} else {$retezec = AGet($_GET,'retezec');}\n\t\n\t$retezec = stripslashes($retezec);\n\t$retezec = htmlspecialchars($retezec, ENT_QUOTES);\n \techo \"<form action=\\\"index.php?action=search&amp;lang=\".$_GET['lang'].\"&amp;filter=\".$_GET['filter'].\"\\\" method=\\\"post\\\">\";\n\techo \"<input type=\\\"text\\\" name=\\\"retezec\\\" size=\\\"\".$size.\"\\\" maxlength=\\\"50\\\" value=\\\"\".$retezec.\"\\\">\"; if ($flat == 0){ echo \"<br>\";}\n\techo \"<select name=\\\"podminka\\\"><option value=\\\"1\\\" \"; if ($podminka == 1){echo \"selected=\\\"selected\\\"\";} echo \">\"._SEARCH_PODMINKA_1.\"</option>\";\n\techo \" <option value=\\\"2\\\" \"; if ($podminka == 2){ echo \"selected=\\\"selected\\\"\";} echo \">\"._SEARCH_PODMINKA_2.\"</option>\";\n\techo \"\t<option value=\\\"3\\\" \"; if ($podminka == 3){ echo \"selected=\\\"selected\\\"\";} echo \">\"._SEARCH_PODMINKA_3.\"</option>\";\n\techo \"</select>\"; if ($flat == 0){echo \"<br>\"; }\n\techo _SEARCH_CHOICE_WHERE; if ($flat == 0){echo\"<br>\";}\n\techo \"<input type=\\\"radio\\\" name=\\\"search_choice\\\" value=\\\"article\\\" \"; if ($search_choice == \"article\" || $search_choice == \"\"){echo \"checked\";} echo \"> \"._SEARCH_CHOICE_ARTICLES; if ($flat == 0){echo \"<br>\"; }\n\techo \"<input type=\\\"radio\\\" name=\\\"search_choice\\\" value=\\\"news\\\" \"; if ($search_choice == \"news\"){echo \"checked\";} echo \"> \"._SEARCH_CHOICE_ACT; if ($flat == 0){echo \"<br>\"; }\n\techo \"<input type=\\\"submit\\\" class=\\\"eden_button\\\" value=\\\" \";if ($gfx != 1){echo _CMN_SUBMIT_SEARCH;} echo \"\\\">\";\n\techo \"</form>\";\n}", "function create_search() {\n\t\t$this->include_scripts();\n\t\t$this->include_styles();\n\t\tob_start();\n\t\t?>\n\t\t<div class=\"searchbar\">\n\t\t <input id=\"searchfor\" type=\"text\" value=\"\" maxlength=\"75\" autocorrect=\"off\" spellcheck=\"false\" autocomplete=\"off\" autocapitalize=\"off\" placeholder=\"Zoek een abonnement...\" class=\"search\">\n\t\t</div>\n\t\t<div class=\"selection-list\">\n\t\t\t<div class=\"selection-container\" id=\"selection-container-id\" style=\"display: none;\">\n\t\t\t</div>\n\t\t</div>\n\t\t<?php\n\t\treturn ob_get_clean();\n\t}", "public function search() {\n\t\t\t$Recherches = $this->Components->load( 'WebrsaRecherchesFichesprescriptions93' );\n\t\t\t$Recherches->search();\n\t\t}", "function cari($cari) {\n $query = \"SELECT * FROM pelanggan WHERE NAMA_PELANGGAN LIKE '%$cari%' OR NIK LIKE '%$cari%' OR ALAMAT_PELANGGAN LIKE '%$cari%' OR NOHP_PELANGGAN LIKE '%$cari%' OR EMAIL_PELANGGAN LIKE '%$cari%'\";\nreturn Data_plg($query);\n}", "public function search();", "function produk_search($produk_id ,$produk_kode ,$produk_kodelama ,$produk_group ,$produk_kategori ,$produk_jenis ,$produk_nama ,$produk_satuan ,\r\n\t\t\t\t\t\t\t\t$produk_du ,$produk_dm ,$produk_dultah, $produk_dcard, $produk_dkolega, $produk_dkeluarga, $produk_downer, $produk_dgrooming,\r\n\t\t\t\t\t\t\t\t$produk_point ,$produk_kredit,$produk_kontribusi ,$produk_volume ,$produk_harga ,$produk_keterangan ,$produk_aktif ,$start,$end, $kategori2_nama){\r\n\t\t\t//full query\r\n\t\t\tif($produk_aktif==\"\")\r\n\t\t\t\t$produk_aktif=\"Aktif\";\r\n\t\t\t$query=\"select * from vu_produk\";\r\n\t\t\t\r\n\t\t\tif($produk_id!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_id LIKE '%\".$produk_id.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_kode!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_kode LIKE '%\".$produk_kode.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_kodelama!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_kodelama LIKE '%\".$produk_kodelama.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_group!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_group = '\".$produk_group.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_kategori!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" kategori_id = '\".$produk_kategori.\"'\";\r\n\t\t\t};\r\n\t\t\tif($kategori2_nama!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" kategori2_nama = '\".$kategori2_nama.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_jenis!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_jenis = '\".$produk_jenis.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_nama!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_nama LIKE '%\".$produk_nama.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_satuan!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_satuan LIKE '%\".$produk_satuan.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_du!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_du = '\".$produk_du.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_dm!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_dm = '\".$produk_dm.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_dultah!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_dultah = '\".$produk_dultah.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_dcard!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_dcard = '\".$produk_dcard.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_dkolega!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_dkolega = '\".$produk_dkolega.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_dkeluarga!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_dkeluarga = '\".$produk_dkeluarga.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_downer!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_downer = '\".$produk_downer.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_dgrooming!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_dgrooming = '\".$produk_dgrooming.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_point!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_point LIKE '%\".$produk_point.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_kredit!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_kredit LIKE '%\".$produk_kredit.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_kontribusi!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_kontribusi='\".$produk_kontribusi.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_volume!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_volume = '\".$produk_volume.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_harga!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_harga = '\".$produk_harga.\"'\";\r\n\t\t\t};\r\n\t\t\tif($produk_keterangan!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_keterangan LIKE '%\".$produk_keterangan.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($produk_aktif!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" produk_aktif = '\".$produk_aktif.\"'\";\r\n\t\t\t};\r\n\t\t\t$result = $this->db->query($query);\r\n\t\t\t$nbrows = $result->num_rows();\r\n\t\t\t\r\n\t\t\t$limit = $query.\" LIMIT \".$start.\",\".$end;\t\t\r\n\t\t\t$result = $this->db->query($limit); \r\n\t\t\t\r\n\t\t\tif($nbrows>0){\r\n\t\t\t\tforeach($result->result() as $row){\r\n\t\t\t\t\t$arr[] = $row;\r\n\t\t\t\t}\r\n\t\t\t\t$jsonresult = json_encode($arr);\r\n\t\t\t\treturn '({\"total\":\"'.$nbrows.'\",\"results\":'.$jsonresult.'})';\r\n\t\t\t} else {\r\n\t\t\t\treturn '({\"total\":\"0\", \"results\":\"\"})';\r\n\t\t\t}\r\n\t\t}", "function form($searchString)\r\n {\r\n \tif (session::get(\"hyrarchy\")) echo \"<div id='search' class='search'>\";\r\n \telse echo \"<div id='searchbig' class='search'>\";\r\n\r\n\r\n echo \"<form method='GET' action='index.php' name='search'>\";\r\n echo \"<b>Suche in</b><br>\";\r\n \r\n// Freie Suche\r\n if (!session::get(\"searchstart\") and !session::get(\"searchexact\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n \r\n echo form::field(\"radio\",\"searchtype\",0,\"\",$checkString,\"\",\"frei\",\"search-free\");\r\n \r\n// Suche am Wortanfang\r\n if (session::get(\"searchstart\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n\r\n echo form::field(\"radio\",\"searchtype\",1,\"\",$checkString,\"\",\"Wortanfang\",\"search-start\");\r\n\r\n// exakte Suche\r\n if (session::get(\"searchexact\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n\r\n echo form::field(\"radio\",\"searchtype\",2,\"\",$checkString,\"\",\"exact\",\"search-exact\");\r\n\r\n\r\n// search in comment field\r\n if (session::get(\"searchcom\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n echo form::field(\"checkbox\",\"searchcom\",1,\"\",$checkString,\"\",\"Erl&auml;uterungen\",\"search-comment\");\r\n\r\n\r\n // search only for ordered entries\r\n // create array for selector\r\n $typeArray = thesaurus::get_type_list();\r\n $statusArray = thesaurus::get_status_list();\r\n $ownerArray = user::get_users(\"entry\");\r\n\r\n if (count($statusArray))\r\n {\r\n echo \"<br>\";\r\n echo form::selector(\"searchentrytype\",$typeArray,1,\"\",session::get(\"searchentrytype\"),\"\",\" Begriffstype \",\"searchtype\",\"\");\r\n echo form::selector(\"searchstatus\",$statusArray,1,\"\",session::get(\"searchstatus\"),\"\",\" Status \",\"searchstatus\",\"\");\r\n echo form::selector(\"searchowner\",$ownerArray,1,\"\",session::get(\"searchowner\"),\"\",\" Eigentümer mit Einträgen \",\"searchowner\",\"\");\r\n }\r\n else\r\n echo form::link(\"\",\"<span class='small'>Keine beantragten Einträge</span>\",\"\",\"no-ordered\");\r\n \r\n\r\n// search field\r\n echo \"<p><input type='text' size='35' name='searchString' value='\" . session::get(\"search\") . \"' \";\r\n echo help::show(\"search-field\",\"\");\r\n echo \">\";\r\n\r\n \r\n echo form::field(\"submit\",\"action\",\"suchen\",\"\",\"\",\" \",\"\",\"search\");\r\n echo form::field(\"submit\",\"reset\",\"zurücksetzen\",\"\",\"\",\" \",\"\",\"newsearch\");\r\n echo \"</form></p>\";\r\n echo \"</div>\";\r\n }", "function searchFumetti($p, $ordine){\n\t//$p = htmlspecialchars($p, ENT_QUOTES);\n\t$query = \"SELECT *, nome as `nomeFum` FROM `Fumetti` WHERE `Fumetti`.`nome` LIKE '%$p%' OR `volume` like '$p' ORDER BY '$ordine' \";\n\treturn eseguiQuery($query);\n\n}", "public static function search();", "function ciniki_merchandise_productSearch($ciniki) {\n //\n // Find all the required and optional arguments\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs');\n $rc = ciniki_core_prepareArgs($ciniki, 'no', array(\n 'tnid'=>array('required'=>'yes', 'blank'=>'no', 'name'=>'Tenant'),\n 'start_needle'=>array('required'=>'yes', 'blank'=>'no', 'name'=>'Search String'),\n 'limit'=>array('required'=>'no', 'blank'=>'yes', 'name'=>'Limit'),\n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $args = $rc['args'];\n\n //\n // Check access to tnid as owner, or sys admin.\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'merchandise', 'private', 'checkAccess');\n $rc = ciniki_merchandise_checkAccess($ciniki, $args['tnid'], 'ciniki.merchandise.productList');\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n\n //\n // Get the list of products\n //\n $strsql = \"SELECT ciniki_merchandise.id, \"\n . \"ciniki_merchandise.code, \"\n . \"ciniki_merchandise.name, \"\n . \"ciniki_merchandise.permalink, \"\n . \"ciniki_merchandise.status, \"\n . \"ciniki_merchandise.sequence, \"\n . \"ciniki_merchandise.flags, \"\n . \"ciniki_merchandise.unit_amount, \"\n . \"ciniki_merchandise.unit_discount_amount, \"\n . \"ciniki_merchandise.unit_discount_percentage, \"\n . \"ciniki_merchandise.taxtype_id, \"\n . \"ciniki_merchandise.inventory, \"\n . \"ciniki_merchandise.shipping_other, \"\n . \"ciniki_merchandise.shipping_CA, \"\n . \"ciniki_merchandise.shipping_US, \"\n . \"ciniki_merchandise.primary_image_id, \"\n . \"ciniki_merchandise.synopsis, \"\n . \"ciniki_merchandise.description \"\n . \"FROM ciniki_merchandise \"\n . \"WHERE ciniki_merchandise.tnid = '\" . ciniki_core_dbQuote($ciniki, $args['tnid']) . \"' \"\n . \"\";\n if( ciniki_core_checkModuleFlags($ciniki, 'ciniki.merchandise', 0x01) ) {\n $strsql .= \"AND (code LIKE '\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR code LIKE '% \" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR name LIKE '\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR name LIKE '% \" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \") \";\n } else {\n $strsql .= \"AND (name LIKE '\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR name LIKE '% \" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \") \";\n }\n if( isset($args['limit']) && is_numeric($args['limit']) && $args['limit'] > 0 ) {\n $strsql .= \"LIMIT \" . ciniki_core_dbQuote($ciniki, $args['limit']) . \" \";\n } else {\n $strsql .= \"LIMIT 25 \";\n }\n\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryArrayTree');\n $rc = ciniki_core_dbHashQueryArrayTree($ciniki, $strsql, 'ciniki.merchandise', array(\n array('container'=>'products', 'fname'=>'id', \n 'fields'=>array('id', 'code', 'name', 'permalink', 'status', 'sequence', 'flags', 'unit_amount', 'unit_discount_amount', 'unit_discount_percentage', 'taxtype_id', 'inventory', 'shipping_other', 'shipping_CA', 'shipping_US', 'primary_image_id', 'synopsis', 'description')),\n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n if( isset($rc['products']) ) {\n $products = $rc['products'];\n foreach($products as $pid => $product) {\n if( ciniki_core_checkModuleFlags($ciniki, 'ciniki.merchandise', 0x01) && $product['code'] != '' ) {\n $products[$pid]['display_name'] = $product['code'] . ' - ' . $product['name'];\n } else {\n $products[$pid]['display_name'] = $product['name'];\n }\n }\n } else {\n $products = array();\n }\n\n return array('stat'=>'ok', 'products'=>$products);\n}", "function promo_print($promo_acara ,$promo_tempat, $promo_keterangan ,$promo_tglmulai ,$promo_tglselesai ,\r\n\t\t\t\t\t\t\t $promo_diskon ,$option,$filter){\r\n\t\t\t//full query\r\n\t\t\t$query=\"select * from promo\";\r\n\t\t\tif($option=='LIST'){\r\n\t\t\t\t$query .=eregi(\"WHERE\",$query)? \" AND \":\" WHERE \";\r\n\t\t\t\t$query .= \" (promo_acara LIKE '%\".addslashes($filter).\"%' OR \r\n\t\t\t\t\t\t\t promo_tempat LIKE '%\".addslashes($filter).\"%' OR \r\n\t\t\t\t\t\t\t promo_keterangan LIKE '%\".addslashes($filter).\"%' )\";\r\n\t\t\t\t$result = $this->db->query($query);\r\n\t\t\t} else if($option=='SEARCH'){\r\n\r\n\t\t\t\tif($promo_acara!=''){\r\n\t\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t\t$query.= \" promo_acara LIKE '%\".$promo_acara.\"%'\";\r\n\t\t\t\t};\r\n\t\t\t\tif($promo_tempat!=''){\r\n\t\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t\t$query.= \" promo_tempat LIKE '%\".$promo_tempat.\"%'\";\r\n\t\t\t\t};\r\n\t\t\t\tif($promo_keterangan!=''){\r\n\t\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t\t$query.= \" promo_keterangan LIKE '%\".$promo_keterangan.\"%'\";\r\n\t\t\t\t};\r\n\t\t\t\tif($promo_tglmulai!=''){\r\n\t\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t\t$query.= \" promo_tglmulai LIKE '%\".$promo_tglmulai.\"%'\";\r\n\t\t\t\t};\r\n\t\t\t\tif($promo_tglselesai!=''){\r\n\t\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t\t$query.= \" promo_tglselesai LIKE '%\".$promo_tglselesai.\"%'\";\r\n\t\t\t\t};\r\n\t\t\t\t\r\n\t\t\t\tif($promo_diskon!=''){\r\n\t\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t\t$query.= \" promo_diskon LIKE '%\".$promo_diskon.\"%'\";\r\n\t\t\t\t};\r\n\t\t\t\t\r\n\t\t\t\t$result = $this->db->query($query);\r\n\t\t\t}\r\n\t\t\treturn $result->result();\r\n\t\t}", "public function search()\n {\n $limit = Input::get('limit') ?: 9;\n $offset = Input::get('offset') ?: 0;\n $term = trim(Input::get('term'));\n // $termArray = (strstr($term, ' ')) ? $this->wildcard($term) : $term;\n $busca = [\n 'pedidos' => [],\n 'clientes' => [],\n 'produtos' => [],\n 'offset' => 0,\n ];\n\n try {\n $categories = $this->parseCategories(Input::get('categories'));\n\n if (!$categories || empty($categories)) {\n return $this->listResponse($busca);\n }\n\n if (in_array('pedidos', $categories)) {\n $busca['pedidos'] = $this->orders($term)\n ->offset($offset)\n ->limit($limit)\n ->get([\n 'pedidos.*'\n ]);\n\n $busca['pedidos'] = OrderTransformer::search($busca['pedidos']);\n }\n\n if (in_array('clientes', $categories)) {\n /*$busca['clientes'] = Cliente\n ::with('enderecos')\n ->search($termArray, [\n 'nome' => 100,\n 'taxvat' => 75,\n 'email' => 50,\n 'inscricao' => 25,\n ])*/\n $busca['clientes'] = $this->customers($term)\n ->with('enderecos')\n ->groupBy('id')\n ->orderBy('nome', 'ASC')\n ->offset($offset)\n ->limit($limit)\n ->get();\n\n $busca['clientes'] = ClientTransformer::search($busca['clientes']);\n }\n\n if (in_array('produtos', $categories)) {\n /*$busca['produtos'] = Produto\n ::search($termArray, [\n 'sku' => 125,\n 'titulo' => 100,\n 'ncm' => 75,\n 'ean' => 50,\n 'referencia' => 25,\n ])*/\n $busca['produtos'] = $this->products($term)\n ->groupBy('sku')\n ->orderBy('titulo', 'ASC')\n ->offset($offset)\n ->limit($limit)\n ->get();\n\n $busca['produtos'] = ProductTransformer::search($busca['produtos']);\n }\n\n $busca['offset'] = $offset;\n } catch (\\Exception $exception) {\n \\Log::error(logMessage($exception, 'Ocorreu um erro ao tentar realizar um busca.'));\n }\n\n return $this->listResponse($busca);\n }", "public function search_bcv()\n{\n $urlToGet ='http://www.bcv.org.ve/tasas-informativas-sistema-bancario';\n $pageDocument = @file_get_contents($urlToGet);\n preg_match_all('|<div class=\"col-sm-6 col-xs-6 centrado\"><strong> (.*?) </strong> </div>|s', $pageDocument, $cap);\n\n if ($cap[0] == array()){ // VALIDAR Concidencia\n $titulo = '0,00';\n } else {\n $titulo = $cap[1][4];\n }\n\n $bcv_con_formato = $titulo;\n $bcv = str_replace(',', '.', str_replace('.', '',$bcv_con_formato));\n\n\n /*-------------------------- */\n return $bcv;\n\n}", "function urlsearch($type_search = 0){\n\t\t$str = '';\n\t\t$str = '<form action=\"' . $_SERVER['SCRIPT_NAME'] . '\" methor=\"get\" name=\"form_search\" onsubmit=\"check_form_submit(this); return false\">';\n\t\t$str .= '<input type=\"hidden\" name=\"search\" id=\"search\" value=\"1\" />';\n\t\t$str .= '<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr>';\n\n\t\t// Show nút search ở đầu\n\t\tif($type_search == 1){\n\t\t\t$str .= '<td>&nbsp;<input type=\"submit\" class=\"btn btn-sm btn-info\" value=\"' . translate_text(\"Tìm kiếm\") . '\"></td>';\n\t\t}\n\n\t\tforeach($this->arraySearch as $key=>$field){\n\t\t\tswitch($this->arrayType[$key]){\n\n\t\t\t\tcase \"string\":\n\t\t\t\tcase \"text\":\n\t\t\t\t\t$value = getValue($field,\"str\",\"GET\", $this->arrayLabel[$key]);\n\t\t\t\t\t$str .= '<td class=\"text\">' . $this->arrayLabel[$key] . '</td><td><input type=\"text\" class=\"form-control\" ' . $this->arrayAttribute[$key] . ' name=\"' . $field . '\" id=\"' . $field . '\" onfocus=\"if(this.value==\\'' . $this->arrayLabel[$key] . '\\') this.value=\\'\\'\" onblur=\"if(this.value==\\'\\') this.value=\\'' . $this->arrayLabel[$key] . '\\'\" value=\"' . $value . '\"></td>';\n\t\t\t\tbreak;\n\t\t\t\tcase \"numbernotedit\":\n\t\t\t\t\t$value = getValue($field,\"str\",\"GET\",$this->arrayLabel[$key]);\n\t\t\t\t\t$str .= '<td class=\"text\">' . $this->arrayLabel[$key] . '</td><td><input type=\"text\" class=\"form-control\" ' . $this->arrayAttribute[$key] . ' name=\"' . $field . '\" id=\"' . $field . '\" onfocus=\"if(this.value==\\'' . $this->arrayLabel[$key] . '\\') this.value=\\'\\'\" onblur=\"if(this.value==\\'\\') this.value=\\'' . $this->arrayLabel[$key] . '\\'\" value=\"' . $value . '\"></td>';\n\t\t\t\tbreak;\n\t\t\t\tcase \"date\":\n\t\t\t\t\t$value = getValue($field,\"str\",\"GET\",\"dd/mm/yyyy\");\n\t\t\t\t\t$str .= '<td class=\"text\">' . $this->arrayLabel[$key] . '</td><td>&nbsp;<input type=\"text\" class=\"form-control date\" ' . $this->arrayAttribute[$key] . ' name=\"' . $field . '\" id=\"' . $field . '\" onKeyPress=\"displayDatePicker(\\'' . $field . '\\', this);\" onClick=\"displayDatePicker(\\'' . $field . '\\', this);\" onfocus=\"if(this.value==\\'' . translate_text(\"Enter\") . ' ' . $this->arrayLabel[$key] . '\\') this.value=\\'\\'\" onblur=\"if(this.value==\\'\\') this.value=\\'' . translate_text(\"Enter\") . ' ' . $this->arrayLabel[$key] . '\\'\" value=\"' . $value . '\"></td>';\n\t\t\t\tbreak;\n\t\t\t\tcase \"array\":\n\t\t\t\tcase \"arraytext\":\n\t\t\t\t\t$field = $this->arrayField[$key];\n\t\t\t\t\tglobal $$field;\n\t\t\t\t\t$arrayList = $$field;\n\t\t\t\t\t$str \t\t\t.= '<td class=\"text\">' . $this->arrayLabel[$key] . '</td><td><select class=\"form-control\" name=\"' . $field . '\" id=\"' . $field . '\" ' . $this->arrayAttribute[$key] . '>';\n\t\t\t\t\t$str \t\t\t.= '<option value=\"-1\">' . $this->arrayLabel[$key] . '</option>';\n\t\t\t\t\t$selected \t\t= getValue($field,\"str\",\"GET\",-1);\n\t\t\t\t\tforeach($arrayList as $key=>$value){\n\t\t\t\t\t\t$str \t\t.= '<option value=\"' . $key . '\" ' . (($selected==$key) ? 'selected' : '') . '>' . $value . '</option>';\n\t\t\t\t\t}\n\t\t\t\t\t$str .= '</select></td>';\n\t\t\t\tbreak;\n\n\t\t\t}\n\t\t}\n\n\t\tforeach($this->arrayAddSearch as $key=>$value){\n\t\t\tif($value[2] != \"\"){\n\t\t\t\t$str .= \"<td>&nbsp;<b>\";\n\t\t\t\t$str .= $value[2];\n\t\t\t\t$str .= \"</b>&nbsp;&nbsp;</td>\";\n\t\t\t}\n\n\t\t\t$str .= \"<td>\";\n\t\t\t$str .= $value[0];\n\t\t\t$str .= \"</td>\";\n\t\t}\n\t\t// Show nút search ở cuối\n\t\tif($type_search != 1){\n\t\t\t$str .= '<td>&nbsp;<input type=\"submit\" class=\"btn btn-sm btn-info\" value=\"' . translate_text(\"Tìm kiếm\") . '\"></td>';\n\t\t}\n\n\t\t\t$str .= '</tr></table>';\n\t\t\t$str .= '</form>';\n\n\t\t\t//phần check javascript cho form tìm kiếm\n\t\t\t$str .= '<script type=\"text/javascript\">';\n\t\t\t$str .= 'function check_form_submit(obj){';\n\t\t\tforeach($this->arraySearch as $key=>$field){\n\t\t\t\tswitch($this->arrayType[$key]){\n\t\t\t\t\tcase \"string\":\n\t\t\t\t\t\t$str .= 'if(document.getElementById(\"' . $field . '\").value == \\'' . translate_text(\"Enter\") . ' ' . $this->arrayLabel[$key] . '\\'){document.getElementById(\"' . $field . '\").value = \\'\\'}';\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$str .= 'document.form_search.submit(); ';\n\t\t\t$str .= '};';\n\t\t\t$str .= '</script>';\n\n\t\treturn $str;\n\t}", "function cari4 ($keyword){\r\n\t$query = \"SELECT kriteria.nama_kriteria, bobot_kriteria.nilai FROM bobot_kriteria INNER JOIN kriteria \r\n\t\t\t ON bobot_kriteria.id_kriteria = kriteria.id_kriteria\r\n\t\t\t WHERE nama_kriteria LIKE '%$keyword%'\";\r\n\treturn query($query);\r\n\t//manggil func yg udh diubat, didalam func baru\t\t\t\r\n}", "public function search($module,$ceco){\n\n //en caso de no existir seleccion apareceran todos\n if(($ceco===\"all\")&&($module===\"all\")){\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" 1 \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n //en caso de existir seleccion en modulo buscamos modulo en todos los posibles cecos\n else if (($ceco===\"all\")&&($module!==\"all\")){\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" Modulo='\".$module.\"' \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n //en caso de existir busqueda en ceco buscamos parecidos\n else if (($ceco!==\"all\")&&($module===\"all\")){\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" Kostl LIKE '\".$ceco.\"%' \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n //en caso de existir ambos criterios aplicamos busqueda incluyendolos\n else{\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" Modulo = '\".$module.\"' AND Kostl LIKE '\".$ceco.\"%' \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n }", "function search()\n\t\t{\n\n\t\t\techo '\n\t\t\t<!-- The search div -->\n\t\t\t<div id=\"content\">\n\n\t\t\t\t<form class=\"card\" id=\"search\">\n\t\t\t\t\t<header class = \"subheading\"><span class=\"fa fa-search\"></span> Package Finder</header>\n\t\t\t\t\t<p>Search by tracking number, customer, shipping provider or item description</p><br>\n\t\t\t\t\t<input id=\"queryField\" type = \"text\" name=\"query\" placeholder = \"e.g enter a tracking number, name, courier or item description to search \" autofocus/><br>\n\t\t\t\t\t<header class=\"subheading searchOptions\">Show results </header>\n\t\t\t\t\t<label for=\"beforeDate\"> Between</label> <input type=\"date\" id=\"before\" name=\"beforeDate\" />\n\t\t\t\t\t<label for=\"afterDate\"> And</label><input type=\"date\" id=\"after\" name=\"afterDate\" />\n\t\t\t\t\t<input id=\"lookupButton\" type=\"submit\" value=\"Find\">\n\n\t\t\t\t\t<header class=\"subheading searchOptions\">Icon guide</header>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-bug\"></i></span> : Package Issue</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-shopping-bag\"></i></span> : Item description</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-ship\"></i></span> : Shipping carrier e.g UPS</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-truck\"></i></span> : Tracking number</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-hashtag\"></i></span> : Account number e.g WEB720</p>\n\t\t\t\t</form>\n\n\n\t\t\t\t<section id = \"lookupResults\">\n\n\t\t\t\t</section>\n\t\t\t</div>';\n\t\t}", "function getQueryForCatalog($searchType)\n{\n // common start of search query\n $query = 'SELECT bookISBN, bookName, author, pages, edition, express, category, holds FROM `books` WHERE ';\n\n switch ($searchType) {\n case 'keyword':\n //separate keyword because it uses multiple parameter\n $query .= 'bookISBN like CONCAT(\\'%\\',:bookISBN,\\'%\\') OR ';\n $query .= 'bookName like CONCAT(\\'%\\',:bookName,\\'%\\') OR ';\n $query .= 'author like CONCAT(\\'%\\',:author,\\'%\\') OR ';\n $query .= 'pages like CONCAT(\\'%\\',:pages,\\'%\\') OR ';\n $query .= 'edition like CONCAT(\\'%\\',:edition,\\'%\\') OR ';\n $query .= 'category like CONCAT(\\'%\\',:category,\\'%\\')';\n break;\n case 'title':\n $query .= 'bookName like CONCAT(\\'%\\',:term,\\'%\\')';\n break;\n case 'author':\n $query .= 'author like CONCAT(\\'%\\',:term,\\'%\\')';\n break;\n case 'ISBN':\n $query .= 'bookISBN like CONCAT(\\'%\\',:term,\\'%\\')';\n break;\n case 'tag':\n $query .= 'bookISBN IN (SELECT `bookISBN` FROM bookTags WHERE tag LIKE CONCAT(\\'%\\',:term,\\'%\\'))';\n break;\n default:\n return '';\n }\n\n return $query;\n}", "protected function _getSearchData() {}", "function displaySearch() {\r\n\t\t// Get the template\r\n\t\t$this->templateCode = $this->cObj->fileResource($this->conf['template.']['search']);\r\n\t\tif (is_null($this->templateCode)) {\r\n\t\t\treturn $this->pi_getLL('template_not_found');\r\n\t\t}\r\n\r\n\t\t// Get the parts out of the template\r\n\t\t$template['total'] = $this->cObj->getSubpart($this->templateCode, '###TEMPLATE###');\r\n\r\n\t\t// Get all the labels and the form data\r\n\t\t$markerArray = $this->getLabels() + $this->getFormData();\r\n\r\n\t\treturn $this->cObj->substituteMarkerArrayCached($template['total'], $markerArray);\r\n\t}", "public function searchGrafik() {\n // should not be searched.\n\n $criteria = new CDbCriteria;\n \n $criteria = $this->functionCriteria();\n\n\t\tif ($_GET['tampilGrafik'] == 'kelaspelayanan'){\n\t\t\t$criteria->select = 'count(pendaftaran_id) as jumlah, kelaspelayanan_nama as data';\n\t\t\t$criteria->group = 'data';\n\t\t}elseif ($_GET['tampilGrafik'] == 'carabayar'){\n\t\t\tif (!empty($this->penjamin_id)){\n\t\t\t\t$criteria->select = 'count(pendaftaran_id) as jumlah, penjamin_nama as data';\n\t\t\t\t$criteria->group = 'data';\n\t\t\t}else{\n\t\t\t\t$criteria->select = 'count(pendaftaran_id) as jumlah, carabayar_nama as data';\n\t\t\t\t$criteria->group = 'data';\n\t\t\t}\n\t\t}\n \n\t\t$criteria->order = 'jumlah DESC';\n return new CActiveDataProvider($this, array(\n 'criteria' => $criteria,\n ));\n }", "function produk_group_search(){\r\n\t\t//POST varibale here\r\n\t\t$group_id=trim(@$_POST[\"group_id\"]);\r\n\t\t$group_kode=trim(@$_POST[\"group_kode\"]);\r\n\t\t$group_kode=str_replace(\"/(<\\/?)(p)([^>]*>)\", \"\",$group_kode);\r\n\t\t$group_kode=str_replace(\"'\", '\"',$group_kode);\r\n\t\t$group_nama=trim(@$_POST[\"group_nama\"]);\r\n\t\t$group_nama=str_replace(\"/(<\\/?)(p)([^>]*>)\", \"\",$group_nama);\r\n\t\t$group_nama=str_replace(\"'\", '\"',$group_nama);\r\n\t\t$group_duproduk=trim(@$_POST[\"group_duproduk\"]);\r\n\t\t$group_dmproduk=trim(@$_POST[\"group_dmproduk\"]);\r\n\t\t$group_durawat=trim(@$_POST[\"group_durawat\"]);\r\n\t\t$group_dmrawat=trim(@$_POST[\"group_dmrawat\"]);\r\n\t\t$group_dupaket=trim(@$_POST[\"group_dupaket\"]);\r\n\t\t$group_dmpaket=trim(@$_POST[\"group_dmpaket\"]);\r\n\t\t$group_keterangan=trim(@$_POST[\"group_keterangan\"]);\r\n\t\t$group_keterangan=str_replace(\"/(<\\/?)(p)([^>]*>)\", \"\",$group_keterangan);\r\n\t\t$group_keterangan=str_replace(\"'\", '\"',$group_keterangan);\r\n\t\t$group_kelompok=trim(@$_POST[\"group_kelompok\"]);\r\n\t\t$group_aktif=trim(@$_POST[\"group_aktif\"]);\r\n\t\t$group_aktif=str_replace(\"/(<\\/?)(p)([^>]*>)\", \"\",$group_aktif);\r\n\t\t$group_aktif=str_replace(\"'\", '\"',$group_aktif);\r\n\t\t$group_kredit=trim(@$_POST[\"group_kredit\"]);\r\n\t\t$group_dultah=trim(@$_POST[\"group_dultah\"]);\r\n\t\t$group_dcard=trim(@$_POST[\"group_dcard\"]);\r\n\t\t$group_dkolega=trim(@$_POST[\"group_dkolega\"]);\r\n\t\t$group_dkeluarga=trim(@$_POST[\"group_dkeluarga\"]);\r\n\t\t$group_downer=trim(@$_POST[\"group_downer\"]);\r\n\t\t$group_dgrooming=trim(@$_POST[\"group_dgrooming\"]);\r\n\t\t$group_dkaryawan=trim(@$_POST[\"group_dkaryawan\"]);\r\n\t\t$group_dstaffdokter=trim(@$_POST[\"group_dstaffdokter\"]);\r\n\t\t$group_dstaffnondokter=trim(@$_POST[\"group_dstaffnondokter\"]);\r\n\t\t$group_dpromo=trim(@$_POST[\"group_dpromo\"]);\r\n\t\t$group_creator=trim(@$_POST[\"group_creator\"]);\r\n\t\t$group_creator=str_replace(\"/(<\\/?)(p)([^>]*>)\", \"\",$group_creator);\r\n\t\t$group_creator=str_replace(\"'\", '\"',$group_creator);\r\n\t\t$group_date_create=trim(@$_POST[\"group_date_create\"]);\r\n\t\t$group_update=trim(@$_POST[\"group_update\"]);\r\n\t\t$group_update=str_replace(\"/(<\\/?)(p)([^>]*>)\", \"\",$group_update);\r\n\t\t$group_update=str_replace(\"'\", '\"',$group_update);\r\n\t\t$group_date_update=trim(@$_POST[\"group_date_update\"]);\r\n\t\t$group_revised=trim(@$_POST[\"group_revised\"]);\r\n\t\t\r\n\t\t$start = (integer) (isset($_POST['start']) ? $_POST['start'] : $_GET['start']);\r\n\t\t$end = (integer) (isset($_POST['limit']) ? $_POST['limit'] : $_GET['limit']);\r\n\t\t$result = $this->m_produk_group->produk_group_search($group_id, $group_kode ,$group_nama ,$group_duproduk ,$group_dmproduk ,$group_durawat ,$group_dmrawat ,$group_dupaket ,$group_dmpaket ,$group_keterangan ,$group_kelompok, $group_aktif,$group_kredit, $group_dultah, $group_dcard, $group_dkolega, $group_dkeluarga, $group_downer, $group_dgrooming, $group_dkaryawan,$group_dstaffdokter,$group_dstaffnondokter,$group_dpromo,$group_creator ,$group_date_create ,$group_update ,$group_date_update ,$group_revised ,$start,$end);\r\n\t\techo $result;\r\n\t}", "function promo_search($promo_acara ,$promo_tempat,$promo_keterangan ,$promo_tglmulai ,$promo_tglselesai ,\r\n\t\t\t\t\t\t\t $promo_diskon ,$start,$end){\r\n\t\t\t//full query\r\n\t\t\t$query=\"select *\r\n\t\t\t\t\tfrom promo\";\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tif($promo_acara!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" promo_acara LIKE '%\".$promo_acara.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($promo_tempat!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" promo_tempat LIKE '%\".$promo_tempat.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($promo_keterangan!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" promo_keterangan LIKE '%\".$promo_keterangan.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($promo_tglmulai!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" promo_tglmulai LIKE '%\".$promo_tglmulai.\"%'\";\r\n\t\t\t};\r\n\t\t\tif($promo_tglselesai!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" promo_tglselesai LIKE '%\".$promo_tglselesai.\"%'\";\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tif($promo_diskon!=''){\r\n\t\t\t\t$query.=eregi(\"WHERE\",$query)?\" AND \":\" WHERE \";\r\n\t\t\t\t$query.= \" promo_diskon LIKE '%\".$promo_diskon.\"%'\";\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\t$result = $this->db->query($query);\r\n\t\t\t$nbrows = $result->num_rows();\r\n\t\t\t\r\n\t\t\t$limit = $query.\" LIMIT \".$start.\",\".$end;\t\t\r\n\t\t\t$result = $this->db->query($limit); \r\n\t\t\t\r\n\t\t\tif($nbrows>0){\r\n\t\t\t\tforeach($result->result() as $row){\r\n\t\t\t\t\t$arr[] = $row;\r\n\t\t\t\t}\r\n\t\t\t\t$jsonresult = json_encode($arr);\r\n\t\t\t\treturn '({\"total\":\"'.$nbrows.'\",\"results\":'.$jsonresult.'})';\r\n\t\t\t} else {\r\n\t\t\t\treturn '({\"total\":\"0\", \"results\":\"\"})';\r\n\t\t\t}\r\n\t\t}", "function bones_wpsearch($form) {\n\t$form = '<div class=\"searchContainer\"><form role=\"search\" method=\"get\" class=\"searchform\" >\n\t<label class=\"screen-reader-text\" for=\"s\">' . __('Search for:', 'bonestheme') . '</label>\n\t<input type=\"search\" value=\"' . get_search_query() . '\" name=\"s\" id=\"s\" placeholder=\"'.esc_attr__('Search','bonestheme').'\" />\n\t</form></div>';\n\treturn $form;\n}", "public function generalsearch($value=array(),$limitst=null,$limitend=null){\n //$this->_db->real_escape_string($id)\n $add='';\n $add.=(!empty($value['category']))? \" and category_c like('%\".$value['category'].\"%')\":'';\n $add.=(!empty($value['model']))? \" and type_c= \".(int)$value['model']:''; \n $add.=(!empty($value['pricemin']))? \" and price_c >= \".(int)$value['pricemin']:'';\n $add.=(!empty($value['pricemax']))? \" and price_c <= \".(int)$value['pricemax']:'';\n $add.=(!empty($value['yearsemin']))? \" and year_c >= \".(int)$value['yearsemin']:'';\n $add.=(!empty($value['yearsemax']))? \" and year_c <= \".(int)$value['yearsemax']:'';\n $add.=(!empty($value['desemin']))? \" and odometer_c >= \".(int)$value['desemin']:'';\n $add.=(!empty($value['desemax']))? \" and odometer_c <= \".(int)$value['desemax']:'';\n $add.=(!empty($value['country']))? \" and Country_c = \".(int)$value['country']:'';\n $add.=(!empty($value['city']))? \" and city_c = \".(int)$value['city']:'';\n $add.=(!empty($value['status']))? \" and status_c = \".(int)$value['status']:'';\n\n $limit=(isset($limitend) and $limitend!='')?\" limit $limitst $limitend \":'';\n $sql=$this->_db->query(\"select * from cars where id_c!='' $add order by id_c desc $limit\");\n if($sql){\n $rows=array();\n\n while($array=$sql->fetch_array()){\n $rows[]=$array;\n }\n return $rows;\n }\n return false;\n }", "function busqueda($buscar,$num){\n\t\t$filas = 12; /*AQUI PUEDO AJUSTAR A CUANTAS PAGINAS QUIERO QUE TENGA LA PAGINACION*/\n\t\tif(isset($_GET[\"pagina\"])){\n\t\t\t$pagina = $_GET[\"pagina\"];\n\t\t}\n\t\telse{\n\t\t\t$pagina = 1;\n\t\t}\n\n\t\t$empezar = ($pagina-1)*$filas;/*PARA LA PAGINACION*/\n\t\ttry{\n\n\t\t\t$bdd=new PDO(\"mysql:host=localhost; dbname=digusti\", \"root\", \"\"); //conexion a la base de datos\n\n\t\t\t$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n\t\t\t\n\t\t\tif($num==1){/*BUSCADOR INGRESADO POR EL USUARIO*/\n\t\t\t\t$sql=\"SELECT * FROM PRODUCTOS WHERE NOMBRE LIKE ? ORDER BY NOMBRE LIMIT $empezar,$filas\"; /*CONSULTA PAGINADA*/\n\n\t\t\t\t$sql2=\"SELECT * FROM PRODUCTOS WHERE NOMBRE LIKE ? ORDER BY NOMBRE\"; /*CONSULTA NORMAL*/\n\n\t\t\t\t$bdd->exec(\"SET CHARACTER SET utf8\");\n\n\t\t\t\t$query=$bdd->prepare($sql);\n\n\t\t\t\t$query->execute(array(\"%$buscar%\"));\n\n\t\t\t\t$total=$bdd->prepare($sql2); $total->execute(array(\"%$buscar%\")); /*PARA RECOJER NUMERO DE PRODUCTOS*/\n\t\t\t}\n\t\t\t\n\t\t\telse{/*CATEGORIA NORMAL DE LA BARRA DE BUSQUEDA*/\n\t\t\t\t//$sql=\"SELECT * FROM PRODUCTOS WHERE CATEGORIA= :pro ORDER BY NOMBRE LIMIT $empezar,$filas\"; /*CONSULTA PAGINADA*/\n\n\t\t\t\t//$sql2=\"SELECT * FROM PRODUCTOS WHERE CATEGORIA= :pro ORDER BY NOMBRE\"; /*CONSULTA NORMAL*/\n\t\t\t\t/*\n\t\t\t\t$bdd->exec(\"SET CHARACTER SET utf8\");\n\n\t\t\t\t$query=$bdd->prepare($sql);\n\n\t\t\t\t$query->execute(array(\":pro\"=>$buscar));\n\n\t\t\t\t$total=$bdd->prepare($sql2); $total->execute(array(\":pro\"=>$buscar));*/ /*PARA RECOJER NUMERO DE PRODUCTOS*/\n\n\t\t\t\t$sql=\"SELECT * FROM $buscar ORDER BY NOMBRE LIMIT $empezar,$filas\"; /*CONSULTA PAGINADA*/\n\n\t\t\t\t$sql2=\"SELECT * FROM $buscar ORDER BY NOMBRE\"; /*CONSULTA NORMAL*/\n\n\t\t\t\t$bdd->exec(\"SET CHARACTER SET utf8\");\n\n\t\t\t\t$query=$bdd->query($sql);\n\n\t\t\t\t$total=$bdd->query($sql2); /*PARA RECOJER NUMERO DE PRODUCTOS*/\n\t\t\t}\n\t\t\n\t\t\t$contador=0;\n\t\t\t$cantidad = $total->rowCount();\n\t\t\t/*SECCION PARA ACOMODAR LA INFORMACION DE LA PAGINACIONA*/\n\t\t\t$empezar++; /*para imprimir el numerito de la paginacion producto inicial*/\n\t\t\t$empezarf = $empezar+$filas-1; \n\t\t\tif(!($empezarf<$cantidad)){\n\t\t\t\t$empezarf=$cantidad;\n\t\t\t}\n\t\t\t$tpag = ceil($cantidad/$filas); /*CANTIDAD DE PAGINAS TOTALES QUE DEBERIA TENER LA PAGINACION*/\n\n\t\t\t/*IMPRESION DE LA CANTIDAD DE PRODUCTOS*/ \n\t\t\t/* ECHO NORMAL POR SI LA PAGINACION SALE CHIMBA\n\t\t\t\techo \"\n\t\t\t \t <div class='col-9'>\n\t\t\t \t <h6 class='text-muted mb-lg-3 mb-2'>Cantidad de Productos: <strong class='text-dark'>(\".$cantidad.\")</strong></h6>\n\t\t\t \t </div>\";*/\n\t\t\t\n\t\t\t/*IMPRESION POR SI HAY PAGINACION*/\n\t\t\t\techo \"\t\n\t\t\t\t\t<div class='row justify-content-between w-80 pag'>\n\t\t\t\t <div class='col-xl-4 col-lg-4 col-md-5 col-sm-12'>\n\t\t\t\t <h6 class='text-muted mb-lg-3 mb-2'>Cantidad de Productos: <strong class='text-dark'>(\".$cantidad.\")</strong></h6>\n\t\t\t\t </div>\n\t\t\t\t <div class='col-xl-4 col-lg-3 col-md-4 col-sm-12 text-right'>\n\t\t\t\t \t<h6 class='text-muted mb-lg-3 mb-2'>\".$empezar.\"-\".$empezarf.\" / Página\";\n\t\t\t\tfor($i=1; $i<=$tpag; $i++){\n\t\t\t\t if($pagina==$i){\n\t\t\t\t \techo \"<a class='text-dark' href='productos.php?producto=\".$buscar.\"&pagina=\".$i.\"'><strong> \".$i.\"</strong></a>\";\n\t\t\t\t }\n\t\t\t\t else{\n\t\t\t\t \techo \"<a class='text-muted' href='productos.php?producto=\".$buscar.\"&pagina=\".$i.\"'> \".$i.\"</a>\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\techo \" </h6>\n\t\t\t\t </div>\n\t\t\t\t </div>\";\n\t\t\t\t \n\t\t\t/*IMPRESION DE LA TABLA DEVUELTA POR LA CONSULTA DE LOS PRODUCTOS*/\n\n\t\t\twhile($tabla=$query->fetch(PDO::FETCH_ASSOC)){\n\t\t\t\tglobal $contador;\n\t\t\t\t$contador++;\n\t\t\t\t\techo \" <div class='card col-xl-3 col-lg-4 col-md-5 col-sm-6 col-10 mb-2 mx-md-2 mx-0'>\n\t\t\t\t\t\t\t <img class='card-img-top' src='\".$tabla[\"Imagen\"].\"' alt='Card image cap' height='180'>\n\t\t\t\t\t\t\t <div class='card-body'>\n\t\t\t\t\t\t\t <h5 class='card-title d-inline'>\".$tabla[\"Nombre\"].\"</h5>\";\n\n\t\t\t\t\techo\"\t <p class='card-text text-center text-danger font-weight-bold' style='font-size: 2.2rem; margin-top: -8px'>\".$tabla[\"Precio\"].\"\n\t\t\t\t\t\t\t <span class='font-weight-normal' style='font-size: 1.5rem'>Bs<span>\";\n\n\t\t\t\t\tif($tabla[\"Categoria\"]!=\"Bodega\"){\n\t\t\t\t\t\t\t echo \"<font size='2' class='text-dark'> x Kg</font>\";}\n\t\t\t\t\telse{\n\t\t\t\t\t\t\t\techo \"<font size='2' class='text-dark'> x Und</font>\";}\n\t\t\t\t\t\t\t \n\t\t\t\t\techo\"\t </p>\n\t\t\t\t\t\t\t <div class='row' style='margin-top: -12px'>\n\t\t\t\t\t\t\t <input id='\".$tabla[\"Codigo\"].\"' align='left' class='col-2 form-control form-control-sm cantidad' type='number' name='cantidad' value='1' min='1'><font size='2' class='m-auto'>.und</font>\n\t\t\t\t\t\t\t <a id='\".$tabla[\"Codigo\"].\"' class='text-white btn bg-success btn-primary col-8 font-weight-bold borde car'>Agregar al Carrito</a>\n\t\t\t\t\t\t\t </div>\n\t\t\t\t\t\t\t </div>\n\t\t\t\t\t\t\t</div>\";\n\t\t\t}\n\n\t\t\tif($contador==0){\n\t\t\t\techo \"\n\t\t\t\t <script>$('.pag').hide();</script>\t\n\t\t\t <div class='col-md-8 col-12'>\n\t\t\t <h5 class='text-muted mb-lg-4 mb-2'>Resultado para: <strong class='text-dark'>\".$buscar.\"</strong></h5>\n\t\t\t <p class='display-6 text-dark mb-3'><span class='display-5 text-primary'>LO SENTIMOS,</span><br>NO SE HAN ENCONTRADO RESULTADOS COINCIDENTES</p>\n\t\t\t <h5 class='text-muted'>¡Prueba a realizar otra búsqueda!</h5>\n\t\t\t </div>\";\n\t\t\t}\n\n\t\t$query->closeCursor();\n\n\t\t}catch(Exception $e){\n\n\t\t\tdie('Error: ' . $e->GetMessage());\n\n\t\t}finally{\n\n\t\t\t$bdd=NULL;\n\t\t}\n\t}", "function Filtros_Listar_EstadosOrdenProduccion()\n {\n $Helper=new htmlhelper; $TipoTxt=new TipoTextBox; $index=0;\n $inputs=array(\n \"Nombre\" => $Helper->textbox(\"fil_txtNombreEstadoOrdenProduccion\",++$index,\"\",128,150,$TipoTxt->texto,\"\",\"\",\"\",\"textoInput\") \n );\n $buttons=array($Helper->button(\"btnBuscarEstadoOrdenProduccion\",\"Buscar\",70,\"Buscar_Grilla('configuracion','Grilla_Listar_EstadoOrdenProduccion','tbl_listaresultados','','td_General')\",\"textoInput\"));\n $html = '<fieldset class=\"textoInput\"><legend align= \"left\">Filtros de b&uacute;squeda</legend>';\n $html .= $Helper->Crear_Layer(\"tbl_listaresultados\",$inputs,$buttons,3,990,\"\",\"\");\n $html .='</fieldset>';\n return $html;\n }", "function formulaires_inscription3_recherche_charger_dist(){\n\n\t$datas['ordre'] = _request('ordre');\n\t$datas['desc'] = _request('desc');\n\t$datas['case'] = _request('case');\n\t$datas['valeur'] = _request('valeur');\n\n\t$datas['exceptions'] = pipeline('i3_exceptions_des_champs_auteurs_elargis',array());\n\n\tif(_request('afficher_tous')){\n\t\tset_request('valeur','');\n\t\tset_request('case','');\n\t}\n\treturn $datas;\n}", "public function buscar()\n {\n $query = Input::get('search');\n\n // Returns an array of products that have the query string located somewhere within\n // our products product name. Paginate them so we can break up lots of search results.\n $search = Producto::where('nombre', 'LIKE', '%' . $query . '%')->paginate(200);\n\n // If no results come up, flash info message with no results found message.\n if ($search->isEmpty()) {\n flash('No se encontraron resultados de ese producto. Por favor intente otra vez', 'info')->important();\n return redirect('/tienda');\n }\n\n // Return a view and pass the view the list of products and the original query.\n return view('templates.tienda.show-buscador', compact('search', 'query'));\n }" ]
[ "0.6343092", "0.61486554", "0.60949284", "0.6050238", "0.6033763", "0.6027691", "0.6021881", "0.59516215", "0.59296703", "0.5903645", "0.58517104", "0.5838331", "0.58345526", "0.58231664", "0.5811673", "0.58021677", "0.5783378", "0.5782928", "0.5761619", "0.57152826", "0.5713597", "0.57117695", "0.56898314", "0.56881696", "0.5669987", "0.5660782", "0.56559515", "0.5654861", "0.56535023", "0.56508595" ]
0.65009373
0
Obtiene el catalogo de dependencias $search string : palabra a buscar $return string : Forma en que debe de devolver los datos
public function getDependencias( $search, $return='array') { try { if(strlen($return)==0) return false; $start = $search['start'] ? $search['start'] : 0; $limit = $search['limit'] ? $search['limit'] : 10; $sql=" SELECT d.*, ( SELECT d_localidad FROM cat_localidad WHERE id_localidad = depe_ciudad) nciudad, ( SELECT d_colonia FROM cat_colonias WHERE id_colonia = depe_colonia ) ncolonia , ( SELECT nombre FROM cat_calles WHERE id_calle = depe_calle) ncalle FROM cat_dependencias d WHERE 1 = 1 "; if(strlen($search['grupo'])>0){ $sql.=" AND depe_grupo LIKE '".$search['grupo']."'";} if(strlen($search['query'])>0){ $sql.=" AND depe_nombre LIKE '%".$search['query']."%'";} $csql = " SELECT SQL_CALC_FOUND_ROWS depe_dependencia AS id, depe_nombre AS value, IFNULL(CONCAT(initcap(ncalle),' ',initcap(depe_entre),' ',initcap(depe_y_entre),' No. ',depe_numero,', Col. ',ncolonia,', ',nciudad),' ') info FROM ( $sql ) a WHERE 1 = 1 ORDER BY depe_nombre"; $rs = $this->db->SelectLimit($csql, $limit, $start); $tt = $this->db->GetOne("SELECT FOUND_ROWS()"); if($return=='response'){ $rows = $rs->GetAll(); $rs->Close(); $response = array('success'=>true, 'rows'=>$rows, 'total'=>$tt, 'sql'=>$sql ); return $response; }elseif ($return=='array'){ $rows = $rs->GetAll(); $rs->Close(); return $rows; }elseif($return=='pipe'){ $str = ''; while($row = $rs->FetchRow()){ $str.= $row['descrip']."|".$row['clave']."\n"; } $rs->Close(); return $str; } }catch(Exception $e){ $this->setError($e->getCode(), $e->getMessage()); throw new Exception( $e->getMessage() , $e->getCode() ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function buscar_referencia()\n {\n $this->template = FALSE;\n\n $articulo = new articulo();\n $json = array();\n foreach ($articulo->search($_REQUEST['buscar_referencia']) as $art) {\n $json[] = array('value' => $art->referencia . ' ' . $art->descripcion(60), 'data' => $art->referencia);\n }\n\n header('Content-Type: application/json');\n echo json_encode(array('query' => $_REQUEST['buscar_referencia'], 'suggestions' => $json));\n }", "function formulaires_inscription3_recherche_charger_dist(){\n\n\t$datas['ordre'] = _request('ordre');\n\t$datas['desc'] = _request('desc');\n\t$datas['case'] = _request('case');\n\t$datas['valeur'] = _request('valeur');\n\n\t$datas['exceptions'] = pipeline('i3_exceptions_des_champs_auteurs_elargis',array());\n\n\tif(_request('afficher_tous')){\n\t\tset_request('valeur','');\n\t\tset_request('case','');\n\t}\n\treturn $datas;\n}", "public function search() {\n\t\t\t$Recherches = $this->Components->load( 'WebrsaRecherchesFichesprescriptions93' );\n\t\t\t$Recherches->search();\n\t\t}", "public function search($module,$ceco){\n\n //en caso de no existir seleccion apareceran todos\n if(($ceco===\"all\")&&($module===\"all\")){\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" 1 \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n //en caso de existir seleccion en modulo buscamos modulo en todos los posibles cecos\n else if (($ceco===\"all\")&&($module!==\"all\")){\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" Modulo='\".$module.\"' \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n //en caso de existir busqueda en ceco buscamos parecidos\n else if (($ceco!==\"all\")&&($module===\"all\")){\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" Kostl LIKE '\".$ceco.\"%' \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n //en caso de existir ambos criterios aplicamos busqueda incluyendolos\n else{\n\n $cecos = $this->mySql->select(\"Cecos\",[\"Id\",\"Modulo\",\"Kostl\",\"Incluido\"],\" Modulo = '\".$module.\"' AND Kostl LIKE '\".$ceco.\"%' \",\"Id\",\"assoc\");\n\n if(count($cecos)){\n\n for ($i=0; $i <count($cecos); $i++) { \n \n $cecos[$i]['Id']=intval($cecos[$i]['Id']);\n $cecos[$i]['Incluido']=intval($cecos[$i]['Incluido']);\n \n }\n \n }\n\n return $cecos;\n\n }\n\n }", "public static function search();", "function busqueda($queryExpandida){\n global $terminosConsulta,$q;\n busquedaSolr($queryExpandida);\n foreach($terminosConsulta as $key => $valor){\n $q = $q.\" \".$valor;\n }\n spellChecker();\n //suggestions($q);\n }", "public function search();", "function recherche_keyword_in_xmlfile($keyword, $xml_file, $session) {\n // dans ce tableau on va mettre les balises qui contiennent le mots clé\n $resultat = array();\n // dans ce tableau on va mettre les requetes executés\n $queries = array();\n // contient le resultat final\n $repense = array();\n \n // vérifier si le mot clé existe dans la balise <catalogRef>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem\n where $x/catalogRef contains text \"' . $keyword . '\"\n return $x/catalogRef';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <rightsInfo><copyrightHolder>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/rightsInfo\n where $x/copyrightHolder contains text \"' . $keyword . '\"\n return $x/copyrightHolder';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <rightsInfo><copyrightHolder>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/rightsInfo\n where $x/copyrightNotice contains text \"' . $keyword . '\"\n return $x/copyrightNotice';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <itemMeta><itemClass>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/itemMeta\n where $x/itemClass contains text \"' . $keyword . '\"\n return $x/itemClass';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <itemMeta><provider>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/itemMeta\n where $x/provider contains text \"' . $keyword . '\"\n return $x/provider';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <itemMeta><versionCreated>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/itemMeta\n where $x/versionCreated contains text \"' . $keyword . '\"\n return $x/versionCreated';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <itemMeta><firstCreated>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/itemMeta\n where $x/firstCreated contains text \"' . $keyword . '\"\n return $x/firstCreated';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <itemMeta><pubStatus>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/itemMeta\n where $x/pubStatus contains text \"' . $keyword . '\"\n return $x/pubStatus';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <itemMeta><title>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/itemMeta\n where $x/title contains text \"' . $keyword . '\"\n return $x/title';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><contentCreated>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta\n where $x/contentCreated contains text \"' . $keyword . '\"\n return $x/contentCreated';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><contentModified>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta\n where $x/contentModified contains text \"' . $keyword . '\"\n return $x/contentModified';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><located><name>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta/located\n where $x/name contains text \"' . $keyword . '\"\n return $x/name';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><creator>[literal]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta/creator\n where $x/@literal contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><contributor>[role]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta/contributor\n where $x/@role contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><contributor>[literal]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta/contributor\n where $x/@literal contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><altId>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta\n where $x/altId contains text \"' . $keyword . '\"\n return $x/altId';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><altId>[type]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta/altId\n where $x/@type contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><language>[tag]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta/language\n where $x/@tag contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><genre>[qcode]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta/genre\n where $x/@qcode contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><genre><name>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta/genre\n where $x/name contains text \"' . $keyword . '\"\n return $x/name';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><genre><name>[xml:lang]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta/genre/name\n where $x/@xml:lang contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><keyword>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta\n where $x/keyword contains text \"' . $keyword . '\"\n return $x/keyword';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><subject>[type]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta/subject\n where $x/@type contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><subject>[qcode]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta/subject\n where $x/@qcode contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><subject><name>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta/subject\n where $x/name contains text \"' . $keyword . '\"\n return $x/name';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><creditline>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta\n where $x/creditline contains text \"' . $keyword . '\"\n return $x/creditline';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><headline>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta\n where $x/headline contains text \"' . $keyword . '\"\n return $x/headline';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><description>\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta\n where $x/description contains text \"' . $keyword . '\"\n return $x/description';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentMeta><description>[role]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentMeta/description\n where $x/@role contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentSet><remoteContent>[rendition]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentSet/remoteContent\n where $x/@rendition contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentSet><remoteContent>[contenttype]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentSet/remoteContent\n where $x/@contenttype contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentSet><remoteContent>[href]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentSet/remoteContent\n where $x/@href contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentSet><remoteContent>[size]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentSet/remoteContent\n where $x/@size contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentSet><remoteContent>[width]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentSet/remoteContent\n where $x/@width contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n\n // vérifier si le mot clé existe dans la balise <contentSet><remoteContent>[height]\n $query = 'xquery for $x in doc(\"bdxml/' . $xml_file . '\")/newsItem/contentSet/remoteContent\n where $x/@height contains text \"' . $keyword . '\"\n return $x';\n $result = $session->execute($query);\n if ($result != \"\") {\n $resultat [] = '<li>' . htmlentities($result) . '</li>';\n $queries [] = $query;\n }\n $repense['resultat'] = $resultat;\n $repense['queries'] = $queries;\n \n return $repense;\n}", "public function searchAction(){\r\n \r\n $em =$this->container->get('doctrine')->getEntityManager();\r\n $pat = $em->getRepository('PidevMedecinBundle:Patient')->findAll();\r\n //Recherche par libelle\r\n $Request = $this->get('request');\r\n if ($Request->getMethod() == 'POST') {\r\n $search = $Request->get('search');\r\n // $Modeles = $em->getRepository('EspritParcBundle:Modele')->findBy(array(\"Libelle\"=> $search));\r\n $query = $em->createQuery('SELECT P\r\n FROM PidevMedecinBundle:Patient P\r\n WHERE P.nomPatient like :nomPatient')->setParameter('nomPatient', '%' . $search . '%');\r\n $pat = $query->getResult();\r\n }\r\n return $this->render('PidevMedecinBundle:Rdv:new.html.twig', array(\"pat\" => $pat));\r\n }", "public function sel_dependencia($filtro,$rvini,$rvfin){\n\t\t$resultado = null;\n\t\t$modelo = new conexion();\n\t\t$conexion = $modelo->get_conexion(); \n\t\t$sql = 'SELECT id_dependencia, nom, correo, activi, nove, emp_nit FROM dependencia';\n\t\tif($filtro){\n\t\t\t$filtro = '%'.$filtro.'%';\n\t\t\t$sql .= ' WHERE nom LIKE :filtro';\n\t\t}\n\t\t$sql .= ' LIMIT '.$rvini.', '.$rvfin.';';\n\t\t$result = $conexion->prepare($sql);\n\t\tif($filtro){\n\t\t\t$result->bindParam(':filtro',$filtro);\n\t\t}\n\t\t$result->execute();\n\n\t\twhile($f=$result->fetch()){\n\t\t\t$resultado[]=$f;\n\t\t}\n\t\treturn $resultado;\n\t}", "public function getSearchRe($field1,$field2,$date){\n $sql = \"SELECT a.IdBitacora, a.Foliorequisicion, DATE_FORMAT(a.FechaRecepcion,'%d/%m/%Y') as FechaRecepcion, DATE_FORMAT(a.FechaReporte,'%d/%m/%Y') as FechaReporte, a.IdDep, a.IdSolicitante,a.Comentario,\n a.Concepto, FORMAT(a.Costo, 2) AS Costo,a.Estatus, DATE_FORMAT(a.FechaAutorizacion,'%d/%m/%Y') as FechaAutorizacion, a.Estado, DATE_FORMAT(a.FechaAatencion,'%d/%m/%Y') as FechaAatencion , a.Archivo,d.nombreDepto,s.Subfijo,s.Nombre,s.A_paterno,s.A_materno\n FROM \" .self::$tablename. \" as a INNER JOIN departamento as d ON a.IdDep=d.idDepart\n INNER JOIN jefe_area as s ON a.IdSolicitante=s.IdJefe WHERE {$field1} LIKE '%{$date}%' OR {$field2} LIKE '%{$date}%'\";\n return Executor::doit($sql);\n\n }", "public function searchPackages($search)\n {\n }", "public function getTCalles( $search, $return='array') {\n \t\n\t\ttry \n\t\t{ \n\t\t if(strlen($return)==0) return false;\t\t\n\t\t\n\t\t $sql = \"\t\n\t\t SELECT id_clase_calle AS clave ,\n\t\t\t d_clase_calle AS descrip \n\t\t\t FROM cat_clase_calle\n\t\t\t WHERE d_clase_calle LIKE '%$search%'\n\t\t\t ORDER BY d_clase_calle\n\t\t\t LIMIT 10\";\n\t\t \t \n\t\t\t $rs = $this->db->Execute($sql);\t\t\t \n\t\t\t \n\t\t\t if ($return=='array'){\n\t\t\t\t $rows = $rs->GetAll();\n\t\t\t $rs->Close();\n\t\t\t\t return $rows;\n\t\t\t }elseif($return=='pipe'){\n\t\t\t $str = '';\n\t\t\t\t while($row = $rs->FetchRow()){\n\t $str.= $row['descrip'].\"|\".$row['clave'].\"\\n\";\n\t }\n\t\t\t\t return $str;\t\t \n\t\t\t }\n\t\t\t \n\t\t\t \n\t\t}catch(Exception $e){\t\t \n\t\t\t$this->setError($e->getCode(), $e->getMessage());\n\t\t\tthrow new Exception( $e->getMessage() , $e->getCode() );\t\n\t\t}\t\t\t\t\n }", "public function search_bcv()\n {\n $urlToGet ='http://www.bcv.org.ve/tasas-informativas-sistema-bancario';\n $pageDocument = @file_get_contents($urlToGet);\n preg_match_all('|<div class=\"col-sm-6 col-xs-6 centrado\"><strong> (.*?) </strong> </div>|s', $pageDocument, $cap);\n\n if ($cap[0] == array()){ // VALIDAR Concidencia\n $titulo = '0,00';\n }else {\n $titulo = $cap[1][4];\n }\n\n $bcv_con_formato = $titulo;\n $bcv = str_replace(',', '.', str_replace('.', '',$bcv_con_formato));\n\n\n /*-------------------------- */\n return $bcv;\n\n }", "public function search_bcv()\n {\n $urlToGet ='http://www.bcv.org.ve/tasas-informativas-sistema-bancario';\n $pageDocument = @file_get_contents($urlToGet);\n preg_match_all('|<div class=\"col-sm-6 col-xs-6 centrado\"><strong> (.*?) </strong> </div>|s', $pageDocument, $cap);\n\n if ($cap[0] == array()){ // VALIDAR Concidencia\n $titulo = '0,00';\n } else {\n $titulo = $cap[1][4];\n }\n\n $bcv_con_formato = $titulo;\n $bcv = str_replace(',', '.', str_replace('.', '',$bcv_con_formato));\n\n\n /*-------------------------- */\n return $bcv;\n\n }", "public function searchCotizacionServicios($cotizacion)\n {\n $query = $this->db->query(\" SELECT\n co_servicio.id,\n servicio_sub_id servicio_id,\n co_sub_servicio.nombre servicio_nombre,\n descripcion servicio_descripcion,\n co_moneda.id moneda_id,\n simbolo moneda_simbolo,\n cantidad servicio_cantidad,\n ROUND(subtotal,2) servicio_costo,\n IF(total_igv = 0, '', ' + IGV') servicio_igv_letra\n FROM co_servicio\n LEFT JOIN co_sub_servicio ON co_servicio.servicio_sub_id = co_sub_servicio.id\n LEFT JOIN co_pago ON co_servicio.cotizacion_id = co_pago.cotizacion_id\n LEFT JOIN co_moneda ON co_pago.total_moneda_id = co_moneda.id\n WHERE co_servicio.cotizacion_id = $cotizacion AND co_servicio.info_status = 1\");\n if($query->num_rows()> 0) {\n return $query->result();\n }\n else{\n return false;\n }\n }", "function form($searchString)\r\n {\r\n \tif (session::get(\"hyrarchy\")) echo \"<div id='search' class='search'>\";\r\n \telse echo \"<div id='searchbig' class='search'>\";\r\n\r\n\r\n echo \"<form method='GET' action='index.php' name='search'>\";\r\n echo \"<b>Suche in</b><br>\";\r\n \r\n// Freie Suche\r\n if (!session::get(\"searchstart\") and !session::get(\"searchexact\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n \r\n echo form::field(\"radio\",\"searchtype\",0,\"\",$checkString,\"\",\"frei\",\"search-free\");\r\n \r\n// Suche am Wortanfang\r\n if (session::get(\"searchstart\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n\r\n echo form::field(\"radio\",\"searchtype\",1,\"\",$checkString,\"\",\"Wortanfang\",\"search-start\");\r\n\r\n// exakte Suche\r\n if (session::get(\"searchexact\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n\r\n echo form::field(\"radio\",\"searchtype\",2,\"\",$checkString,\"\",\"exact\",\"search-exact\");\r\n\r\n\r\n// search in comment field\r\n if (session::get(\"searchcom\")) $checkString = \" checked='checked'\";\r\n else $checkString = \"\";\r\n echo form::field(\"checkbox\",\"searchcom\",1,\"\",$checkString,\"\",\"Erl&auml;uterungen\",\"search-comment\");\r\n\r\n\r\n // search only for ordered entries\r\n // create array for selector\r\n $typeArray = thesaurus::get_type_list();\r\n $statusArray = thesaurus::get_status_list();\r\n $ownerArray = user::get_users(\"entry\");\r\n\r\n if (count($statusArray))\r\n {\r\n echo \"<br>\";\r\n echo form::selector(\"searchentrytype\",$typeArray,1,\"\",session::get(\"searchentrytype\"),\"\",\" Begriffstype \",\"searchtype\",\"\");\r\n echo form::selector(\"searchstatus\",$statusArray,1,\"\",session::get(\"searchstatus\"),\"\",\" Status \",\"searchstatus\",\"\");\r\n echo form::selector(\"searchowner\",$ownerArray,1,\"\",session::get(\"searchowner\"),\"\",\" Eigentümer mit Einträgen \",\"searchowner\",\"\");\r\n }\r\n else\r\n echo form::link(\"\",\"<span class='small'>Keine beantragten Einträge</span>\",\"\",\"no-ordered\");\r\n \r\n\r\n// search field\r\n echo \"<p><input type='text' size='35' name='searchString' value='\" . session::get(\"search\") . \"' \";\r\n echo help::show(\"search-field\",\"\");\r\n echo \">\";\r\n\r\n \r\n echo form::field(\"submit\",\"action\",\"suchen\",\"\",\"\",\" \",\"\",\"search\");\r\n echo form::field(\"submit\",\"reset\",\"zurücksetzen\",\"\",\"\",\" \",\"\",\"newsearch\");\r\n echo \"</form></p>\";\r\n echo \"</div>\";\r\n }", "function SEARCH()\n{\n $sql = \"select * from CLASH \";\n\n // si se produce un error en la busqueda mandamos el mensaje de error en la consulta\n if (!($resultado = $this->bd->query($sql))){\n\t\treturn 'Error en la consulta sobre la base de datos';\n\t}\n else{ // si la busqueda es correcta devolvemos el recordset resultado\n\t\treturn $resultado;\n\t}\n\n\n}", "public function search()\n {\n $limit = Input::get('limit') ?: 9;\n $offset = Input::get('offset') ?: 0;\n $term = trim(Input::get('term'));\n // $termArray = (strstr($term, ' ')) ? $this->wildcard($term) : $term;\n $busca = [\n 'pedidos' => [],\n 'clientes' => [],\n 'produtos' => [],\n 'offset' => 0,\n ];\n\n try {\n $categories = $this->parseCategories(Input::get('categories'));\n\n if (!$categories || empty($categories)) {\n return $this->listResponse($busca);\n }\n\n if (in_array('pedidos', $categories)) {\n $busca['pedidos'] = $this->orders($term)\n ->offset($offset)\n ->limit($limit)\n ->get([\n 'pedidos.*'\n ]);\n\n $busca['pedidos'] = OrderTransformer::search($busca['pedidos']);\n }\n\n if (in_array('clientes', $categories)) {\n /*$busca['clientes'] = Cliente\n ::with('enderecos')\n ->search($termArray, [\n 'nome' => 100,\n 'taxvat' => 75,\n 'email' => 50,\n 'inscricao' => 25,\n ])*/\n $busca['clientes'] = $this->customers($term)\n ->with('enderecos')\n ->groupBy('id')\n ->orderBy('nome', 'ASC')\n ->offset($offset)\n ->limit($limit)\n ->get();\n\n $busca['clientes'] = ClientTransformer::search($busca['clientes']);\n }\n\n if (in_array('produtos', $categories)) {\n /*$busca['produtos'] = Produto\n ::search($termArray, [\n 'sku' => 125,\n 'titulo' => 100,\n 'ncm' => 75,\n 'ean' => 50,\n 'referencia' => 25,\n ])*/\n $busca['produtos'] = $this->products($term)\n ->groupBy('sku')\n ->orderBy('titulo', 'ASC')\n ->offset($offset)\n ->limit($limit)\n ->get();\n\n $busca['produtos'] = ProductTransformer::search($busca['produtos']);\n }\n\n $busca['offset'] = $offset;\n } catch (\\Exception $exception) {\n \\Log::error(logMessage($exception, 'Ocorreu um erro ao tentar realizar um busca.'));\n }\n\n return $this->listResponse($busca);\n }", "function search()\n\t\t{\n\n\t\t\techo '\n\t\t\t<!-- The search div -->\n\t\t\t<div id=\"content\">\n\n\t\t\t\t<form class=\"card\" id=\"search\">\n\t\t\t\t\t<header class = \"subheading\"><span class=\"fa fa-search\"></span> Package Finder</header>\n\t\t\t\t\t<p>Search by tracking number, customer, shipping provider or item description</p><br>\n\t\t\t\t\t<input id=\"queryField\" type = \"text\" name=\"query\" placeholder = \"e.g enter a tracking number, name, courier or item description to search \" autofocus/><br>\n\t\t\t\t\t<header class=\"subheading searchOptions\">Show results </header>\n\t\t\t\t\t<label for=\"beforeDate\"> Between</label> <input type=\"date\" id=\"before\" name=\"beforeDate\" />\n\t\t\t\t\t<label for=\"afterDate\"> And</label><input type=\"date\" id=\"after\" name=\"afterDate\" />\n\t\t\t\t\t<input id=\"lookupButton\" type=\"submit\" value=\"Find\">\n\n\t\t\t\t\t<header class=\"subheading searchOptions\">Icon guide</header>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-bug\"></i></span> : Package Issue</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-shopping-bag\"></i></span> : Item description</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-ship\"></i></span> : Shipping carrier e.g UPS</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-truck\"></i></span> : Tracking number</p>\n\t\t\t\t\t<p class=\"searchKey\"><span><i class=\"fa fa-hashtag\"></i></span> : Account number e.g WEB720</p>\n\t\t\t\t</form>\n\n\n\t\t\t\t<section id = \"lookupResults\">\n\n\t\t\t\t</section>\n\t\t\t</div>';\n\t\t}", "function ciniki_merchandise_productSearch($ciniki) {\n //\n // Find all the required and optional arguments\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs');\n $rc = ciniki_core_prepareArgs($ciniki, 'no', array(\n 'tnid'=>array('required'=>'yes', 'blank'=>'no', 'name'=>'Tenant'),\n 'start_needle'=>array('required'=>'yes', 'blank'=>'no', 'name'=>'Search String'),\n 'limit'=>array('required'=>'no', 'blank'=>'yes', 'name'=>'Limit'),\n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $args = $rc['args'];\n\n //\n // Check access to tnid as owner, or sys admin.\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'merchandise', 'private', 'checkAccess');\n $rc = ciniki_merchandise_checkAccess($ciniki, $args['tnid'], 'ciniki.merchandise.productList');\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n\n //\n // Get the list of products\n //\n $strsql = \"SELECT ciniki_merchandise.id, \"\n . \"ciniki_merchandise.code, \"\n . \"ciniki_merchandise.name, \"\n . \"ciniki_merchandise.permalink, \"\n . \"ciniki_merchandise.status, \"\n . \"ciniki_merchandise.sequence, \"\n . \"ciniki_merchandise.flags, \"\n . \"ciniki_merchandise.unit_amount, \"\n . \"ciniki_merchandise.unit_discount_amount, \"\n . \"ciniki_merchandise.unit_discount_percentage, \"\n . \"ciniki_merchandise.taxtype_id, \"\n . \"ciniki_merchandise.inventory, \"\n . \"ciniki_merchandise.shipping_other, \"\n . \"ciniki_merchandise.shipping_CA, \"\n . \"ciniki_merchandise.shipping_US, \"\n . \"ciniki_merchandise.primary_image_id, \"\n . \"ciniki_merchandise.synopsis, \"\n . \"ciniki_merchandise.description \"\n . \"FROM ciniki_merchandise \"\n . \"WHERE ciniki_merchandise.tnid = '\" . ciniki_core_dbQuote($ciniki, $args['tnid']) . \"' \"\n . \"\";\n if( ciniki_core_checkModuleFlags($ciniki, 'ciniki.merchandise', 0x01) ) {\n $strsql .= \"AND (code LIKE '\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR code LIKE '% \" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR name LIKE '\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR name LIKE '% \" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \") \";\n } else {\n $strsql .= \"AND (name LIKE '\" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \"OR name LIKE '% \" . ciniki_core_dbQuote($ciniki, $args['start_needle']) . \"%' \"\n . \") \";\n }\n if( isset($args['limit']) && is_numeric($args['limit']) && $args['limit'] > 0 ) {\n $strsql .= \"LIMIT \" . ciniki_core_dbQuote($ciniki, $args['limit']) . \" \";\n } else {\n $strsql .= \"LIMIT 25 \";\n }\n\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryArrayTree');\n $rc = ciniki_core_dbHashQueryArrayTree($ciniki, $strsql, 'ciniki.merchandise', array(\n array('container'=>'products', 'fname'=>'id', \n 'fields'=>array('id', 'code', 'name', 'permalink', 'status', 'sequence', 'flags', 'unit_amount', 'unit_discount_amount', 'unit_discount_percentage', 'taxtype_id', 'inventory', 'shipping_other', 'shipping_CA', 'shipping_US', 'primary_image_id', 'synopsis', 'description')),\n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n if( isset($rc['products']) ) {\n $products = $rc['products'];\n foreach($products as $pid => $product) {\n if( ciniki_core_checkModuleFlags($ciniki, 'ciniki.merchandise', 0x01) && $product['code'] != '' ) {\n $products[$pid]['display_name'] = $product['code'] . ' - ' . $product['name'];\n } else {\n $products[$pid]['display_name'] = $product['name'];\n }\n }\n } else {\n $products = array();\n }\n\n return array('stat'=>'ok', 'products'=>$products);\n}", "public function search_bcv()\n{\n $urlToGet ='http://www.bcv.org.ve/tasas-informativas-sistema-bancario';\n $pageDocument = @file_get_contents($urlToGet);\n preg_match_all('|<div class=\"col-sm-6 col-xs-6 centrado\"><strong> (.*?) </strong> </div>|s', $pageDocument, $cap);\n\n if ($cap[0] == array()){ // VALIDAR Concidencia\n $titulo = '0,00';\n } else {\n $titulo = $cap[1][4];\n }\n\n $bcv_con_formato = $titulo;\n $bcv = str_replace(',', '.', str_replace('.', '',$bcv_con_formato));\n\n\n /*-------------------------- */\n return $bcv;\n\n}", "protected function _getSearchData() {}", "function create_search() {\n\t\t$this->include_scripts();\n\t\t$this->include_styles();\n\t\tob_start();\n\t\t?>\n\t\t<div class=\"searchbar\">\n\t\t <input id=\"searchfor\" type=\"text\" value=\"\" maxlength=\"75\" autocorrect=\"off\" spellcheck=\"false\" autocomplete=\"off\" autocapitalize=\"off\" placeholder=\"Zoek een abonnement...\" class=\"search\">\n\t\t</div>\n\t\t<div class=\"selection-list\">\n\t\t\t<div class=\"selection-container\" id=\"selection-container-id\" style=\"display: none;\">\n\t\t\t</div>\n\t\t</div>\n\t\t<?php\n\t\treturn ob_get_clean();\n\t}", "private function search() {\n\t\tGLOBAL $db, $MYSQL_PREFIX, $TDTRAC_SITE;\n\t\t$keywords = $this->action['keywords'];\n\t\t\n\t\t$sqlwhere = \"( category LIKE '%\" . mysql_real_escape_string($keywords) . \"%' OR \"; \n\t\t$sqlwhere .= \"vendor LIKE '%\" . mysql_real_escape_string($keywords) . \"%' OR \"; \n\t\t$sqlwhere .= \"date = '\" . mysql_real_escape_string($keywords) . \"' OR \"; \n\t\t$sqlwhere .= \"dscr LIKE '%\" . mysql_real_escape_string($keywords) . \"%' )\";\n\t\t\n\t\t$sql = \"SELECT * FROM {$MYSQL_PREFIX}budget b, {$MYSQL_PREFIX}shows s WHERE b.showid = s.showid AND {$sqlwhere} ORDER BY b.showid DESC, category ASC, date ASC, vendor ASC\";\n\t\t$result = mysql_query($sql, $db);\n\t\t\n\t\t$html[] = \"<h3>Search Results</h3>\\n\";\n\t\tif ( mysql_num_rows($result) == 0 ) { return array_merge($html, array(\"<br /><br /><h4>No Records Found!</h4>\")); }\n\t\t\n\t\t$tabl = new tdtable(\"searchresult\");\n\t\t$tabl->addHeader(array('Show', 'Date', 'Category', 'Vendor', 'Description', 'Price', 'Tax'));\n\t\t$tabl->addSubtotal('Show');\n\t\t$tabl->addCurrency('Price');\n\t\t$tabl->addCurrency('Tax');\n\t\t$tabl->addAction(array('bpend','breim','rview'));\n\t\tif ( $this->user->can(\"editbudget\") ) { $tabl->addAction(array('bedit', 'bdel')); }\n\t\t\n\t\twhile( $line = mysql_fetch_array($result) ) {\n\t\t\t$tabl->addRow(array($line['showname'], $line['date'], $line['category'], $line['vendor'], $line['dscr'], $line['price'], $line['tax']), $line);\n\t\t}\n\t\treturn array_merge($html, $tabl->output(false));\n\t}", "function getQueryForCatalog($searchType)\n{\n // common start of search query\n $query = 'SELECT bookISBN, bookName, author, pages, edition, express, category, holds FROM `books` WHERE ';\n\n switch ($searchType) {\n case 'keyword':\n //separate keyword because it uses multiple parameter\n $query .= 'bookISBN like CONCAT(\\'%\\',:bookISBN,\\'%\\') OR ';\n $query .= 'bookName like CONCAT(\\'%\\',:bookName,\\'%\\') OR ';\n $query .= 'author like CONCAT(\\'%\\',:author,\\'%\\') OR ';\n $query .= 'pages like CONCAT(\\'%\\',:pages,\\'%\\') OR ';\n $query .= 'edition like CONCAT(\\'%\\',:edition,\\'%\\') OR ';\n $query .= 'category like CONCAT(\\'%\\',:category,\\'%\\')';\n break;\n case 'title':\n $query .= 'bookName like CONCAT(\\'%\\',:term,\\'%\\')';\n break;\n case 'author':\n $query .= 'author like CONCAT(\\'%\\',:term,\\'%\\')';\n break;\n case 'ISBN':\n $query .= 'bookISBN like CONCAT(\\'%\\',:term,\\'%\\')';\n break;\n case 'tag':\n $query .= 'bookISBN IN (SELECT `bookISBN` FROM bookTags WHERE tag LIKE CONCAT(\\'%\\',:term,\\'%\\'))';\n break;\n default:\n return '';\n }\n\n return $query;\n}", "public function search() {\r\n $produit = Produit::getProduit($_POST[\"reference\"]);\r\n if (empty($produit)) {\r\n $vue = new AdminProduitVue();\r\n $vue->displayPage();\r\n } else {\r\n $vue = new AdminProduitVue($produit);\r\n $vue->displayPage();\r\n }\r\n }", "public function autoCompletadoPais($search)\n\t{\n\t\t$this->db->select('\n\t\t\tctipo as id,\n\t\t\tdregistro as text,\n\t\t\t*\n\t\t');\n\t\t$this->db->from('ttabla');\n\t\t$this->db->where('ctabla', 11);\n\t\t$this->db->where('sregistro', 'A');\n\t\t$this->db->like('dregistro', $search);\n\t\t$this->db->order_by('dregistro', 'ASC');\n\t\t$this->db->limitAnyWhere(LIMITE_AUTOCOMPLETADO);\n\t\t$query = $this->db->get();\n\t\tif (!$query) {\n\t\t\treturn [];\n\t\t}\n\t\treturn ($query->num_rows() > 0) ? $query->result() : [];\n\t}", "public function getCalles( $search, $return='array') {\n \t\n\t\ttry \n\t\t{ \n\t\t if(strlen($return)==0) return false;\t\t\n\t\t\n\t\t $sql = \"\t\n\t\t SELECT id_calle AS clave ,\n\t\t\t nombre As descrip \n\t\t\t FROM cat_calles\n\t\t\t WHERE nombre LIKE '%$search%' \n\t\t\t LIMIT 10\";\n\t\t \t \n\t\t\t $rs = $this->db->Execute($sql);\t\t\t \n\t\t\t \n\t\t\t if ($return=='array'){\n\t\t\t\t $rows = $rs->GetAll();\n\t\t\t $rs->Close();\n\t\t\t\t return $rows;\n\t\t\t }elseif($return=='pipe'){\n\t\t\t $str = '';\n\t\t\t\t while($row = $rs->FetchRow()){\n\t $str.= $row['descrip'].\"|\".$row['clave'].\"\\n\";\n\t }\n\t\t\t\t return $str;\t\t \n\t\t\t }\n\t\t\t \n\t\t\t \n\t\t}catch(Exception $e){\t\t \n\t\t\t$this->setError($e->getCode(), $e->getMessage());\n\t\t\tthrow new Exception( $e->getMessage() , $e->getCode() );\t\n\t\t}\t\t\t\t\n }", "public function consultarDependenciaRefrigerio(){\r\n $conexion=new conexion();\r\n \r\n $query = \"SELECT r.idr, d.fechad, d.cedulad, r.dependencia, r.cursoevento, d.iddoc, e.nombree, t.nombretipo\r\n FROM refrigerio as r, documento as d, estatus as e, tipodocumento as t\r\n where r.iddoc = d.iddoc and d.estatus = e.idestatus and d.tipodoc = t.idtipo and r.dependencia=\".\"'\".$this->getdepensol().\"'\";\r\n\r\n \r\n \r\n $result=pg_query($conexion->getStrcnx(),$query);\r\n pg_close($conexion->getStrcnx()); //cerramos la conexion a la db\r\n \r\n return $result;\r\n }" ]
[ "0.5984571", "0.5848931", "0.5811685", "0.5799735", "0.5762292", "0.57536787", "0.572536", "0.56741303", "0.5657011", "0.56442577", "0.5617604", "0.56065536", "0.5587288", "0.55778515", "0.55712336", "0.55666655", "0.55641466", "0.5561631", "0.555019", "0.55441386", "0.55397344", "0.5534317", "0.5513608", "0.55072874", "0.54975617", "0.54940575", "0.5486286", "0.5479766", "0.54533666", "0.54487014" ]
0.6674117
0
Funcion que retorna ID_UNIDAD
function obtenerIDUnidad($idCurso,$noUnidad) { $sql = new Query("SG"); $sql->sql = "SELECT id_unidad as id FROM unidades WHERE status = 1 AND id_curso = ".$idCurso." AND no_unidad = ".$noUnidad." LIMIT 1"; $resultado = $sql->select("arr"); if($resultado) { return $resultado[0]['id']; } return NULL; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function obtenerUltimoId();", "public function getId_unidad_medida()\n {\n return $this->id_unidad_medida;\n }", "function id_ordine_user($idu){\r\n \r\n $sql = \"SELECT retegas_ordini.id_utente FROM retegas_ordini WHERE (((retegas_ordini.id_ordini)='$idu'));\";\r\n $ret = mysql_query($sql);\r\n $row = mysql_fetch_row($ret);\r\n return $row[0];\r\n}", "function id_listino_user($idu){\r\n \r\n $sql = \"SELECT retegas_listini.id_utenti FROM retegas_listini WHERE (((retegas_listini.id_listini)=$idu));\";\r\n $ret = mysql_query($sql);\r\n $row = mysql_fetch_row($ret);\r\n return $row[0];\r\n}", "public function getUltimoId()\n {\n\n return $this->ultimoID;\n\n }", "public function getUdid()\n {\n return $this->get(self::UDID);\n }", "function dameUltimoId($wSeq=null) {\n\t\t\treturn $this->lastID;\n\t}", "Function id_listino_from_id_ordine($idu){\r\n\r\n$sql = \"SELECT retegas_ordini.id_listini FROM retegas_ordini\r\nWHERE (((retegas_ordini.id_ordini)='$idu'));\";\r\n $ret = mysql_query($sql);\r\n $row = mysql_fetch_row($ret);\r\n return $row[0];\r\n}", "function articolo_id_listino($idu){\n $sql = \"SELECT retegas_articoli.id_listini\n\t\t\tFROM retegas_articoli \n\t\t\tWHERE (((retegas_articoli.id_articoli)='$idu'));\";\n $ret = mysql_query($sql);\n $row = mysql_fetch_row($ret);\n return $row[0];\n}", "public function getKonsumenUnikId($konsumen_kunci_api) {\n $app = \\Slim\\Slim::getInstance();\n \n $sql = \"SELECT konsumen_id FROM konsumen WHERE konsumen_kunci_api = :konsumen_kunci_api\";\n\n $stmt = $app->db->prepare($sql);\n $stmt->execute(array('konsumen_kunci_api'=>$konsumen_kunci_api));\n \n $konsumen_id=$stmt->fetch(PDO::FETCH_ASSOC);\n \n if($stmt->rowCount() > 0)\n {\n return $konsumen_id[\"konsumen_id\"];\n } else {\n return FALSE;\n }\n }", "public function obtenerUltimoId(){\n\t\t$this->db = Database::getInstance();\n\t\t$sql=\"SELECT MAX(idNino) AS id FROM nino\";\n\t\t$result = $this->db->get_data($sql);\n\t\treturn $result['DATA'][0]['id'];\n\t}", "public function getIdAnuncio() {\n\t\treturn $this->idAnuncio;\n\t}", "public function getIdu() {\r\n return $this->idu;\r\n }", "public function obtenerIdActual($nino);", "function getUniqueID(){\n\n $maxID = $this->Model->maxFrom('id','tbl_sukarelawan');\n\n return (int) $maxID;\n }", "public function getUlogaID()\n {\n return $this->ulogaID;\n }", "function get_unique_id()\n{\n\tstatic $id = 0;\n\treturn 'ud' . ($id ++);\n}", "function get_unitid() {\n \tglobal $conn;\n \n \t$sql = \"SELECT id FROM unitname WHERE unitname='each'\";\n \t$result = $conn->Execute($sql);\n \t$unitpk = $result->fields[0];\n \n \tif (!$unitpk) {\n $sql = \"SELECT id FROM unitname\";\n\t $result = $conn->Execute($sql);\n\t $unitpk = $result->fields[0];\n \t}\n\tif (!$unitpk) $unitpk = 1;\n\treturn $unitpk;\n }", "function pegar_idoid($idocod) {\n global $db;\n $sql = \"select idoid from idoc where idocod = '\" . $idocod . \"'\";\n return (integer) $db->pegaUm($sql);\n}", "public function get_ID();", "public function getUdid()\n {\n return $this->udid;\n }", "function getUniqueID(){\n\n\t\t$maxID = $this->Model->maxFrom('id_kampanye','infokampanye');\n\n\t\treturn (int) $maxID;\n}", "function dimeidciudad($ciudad) {\n //Conectar base de datos\n $c = conectar();\n //Consulta sql\n $select = \"select id_ciudad from ciudad where nombre='$ciudad';\";\n $resultado = mysqli_query($c, $select);\n //Entra en el if si se encuentra la ciudad\n desconectar($c);\n if ($fila = mysqli_fetch_assoc($resultado)) {\n extract($fila);\n return $id_ciudad;\n //Devuelve id ciudad\n } else {\n //Si no se encuentra la ciudad devuelve -1\n return -1;\n }\n}", "function get_id() {\n\t\treturn '';\n\t}", "public function getArticleId(): Uuid {\n\t\treturn ($this->articleId);\n\n\t\t//this outside of class\n\t\t//$article->get article id();\n\t}", "public static function dernier () {\n self:self::initialiserDB();\n return self::$database->dernierId();\n }", "protected function unid() {\n\t\treturn $this->module() . '_' . $this->field_id();\n\t}", "function getID();", "function dimeidconcierto($nomconcierto) {\n //Conectar base de datos\n $c = conectar();\n //Consulta sql\n $select = \"select id_concierto from concierto where nombre='$nomconcierto';\";\n $resultado = mysqli_query($c, $select);\n desconectar($c);\n if ($fila = mysqli_fetch_assoc($resultado)) {\n //Devuelve el id de usuario\n $id_concierto = $fila['id_concierto'];\n return $id_concierto;\n } else {\n //Si el usuario no existe devuelve -1\n return -1;\n }\n}", "function ultimoId($db,$id_tabla,$tabla){\n\t$rs = $db->query(\"SELECT MAX($id_tabla) AS id FROM $tabla\");\n\tif ($row = $rs->fetch_Row()){\n\t\t$id = (int)trim($row[0]);\n\t}\n\treturn $id;\n}" ]
[ "0.679327", "0.6689022", "0.66812736", "0.6673836", "0.6670627", "0.66317976", "0.66218084", "0.6503436", "0.6497275", "0.6482551", "0.6479007", "0.64599174", "0.6430387", "0.6414284", "0.64134556", "0.64079434", "0.63661766", "0.63620394", "0.63238496", "0.6313787", "0.63080275", "0.6291323", "0.62775135", "0.62499255", "0.6230912", "0.62250704", "0.62129587", "0.6204819", "0.6174375", "0.61695" ]
0.70784414
0
addToJanesWalk Adds array properties to the JSON we make available on the rendered page
public function addToJanesWalk(array $properties) { $this->pageData = array_merge_recursive($this->pageData, $properties); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function on_before_render()\n {\n $this->addFooterItem('<script type=\"text/javascript\">window.JanesWalk = window.JanesWalk || {}; Object.assign(window.JanesWalk, ' . json_encode($this->pageData) . ');</script>');\n }", "function jsonify($json, $rowsNames, $food, $mealPrice, $columns, $rows,\n $place, $week){\n\n $year = date(\"Y\",time());\n $timestamp = strtotime($year.\"W\".str_pad($week, 2, '0', STR_PAD_LEFT));\n\n //get the index for the week element\n $weekIndex = isWeekRegistered($week);\n\n if ($weekIndex === FALSE){\n registerWeek($week);\n $weekIndex = isWeekRegistered($week);\n global $daysRegistered;\n $daysRegistered[$weekIndex] = array();\n }\n\n $json[\"weeks\"][$weekIndex][\"weekNumber\"] = (int) $week;\n\n for ( $i = 0; $i < $columns; $i++ ){\n\n //get index for the day element\n $dayIndex = isDayRegistered(date(\"Y-m-d\", $timestamp),$weekIndex);\n if($dayIndex === FALSE){\n registerDay(date(\"Y-m-d\", $timestamp),$weekIndex);\n $dayIndex = isDayRegistered(date(\"Y-m-d\", $timestamp),$weekIndex);\n }\n\n $json[\"weeks\"][$weekIndex][\"days\"][$dayIndex][\"date\"]=date(\"Y-m-d\", $timestamp);\n $k = 0;\n $theresSomethingToEatToday=FALSE;\n for ( $j = 0; $j < $rows; $j++){\n if ( filterMeals($food[$i][$j]) != \"\" && $rowsNames[$j] != \"Salatbuffet\"){\n $json[\"weeks\"][$weekIndex][\"days\"][$dayIndex][$place][\"meals\"][$k] = array();\n $json[\"weeks\"][$weekIndex][\"days\"][$dayIndex][$place][\"meals\"][$k][\"category\"]= $rowsNames[$j];\n $json[\"weeks\"][$weekIndex][\"days\"][$dayIndex][$place][\"meals\"][$k][\"meal\"]= filterMeals($food[$i][$j]);\n $json[\"weeks\"][$weekIndex][\"days\"][$dayIndex][$place][\"meals\"][$k][\"meal_raw\"]=$food[$i][$j];\n if ( $mealPrice[$i][$j] != \"\" ){\n $json[\"weeks\"][$weekIndex][\"days\"][$dayIndex][$place][\"meals\"][$k][\"price\"]= filterPrice($mealPrice[$i][$j]);\n }\n $theresSomethingToEatToday=TRUE;\n $k++;\n }\n }\n $json[\"weeks\"][$weekIndex][\"days\"][$dayIndex][$place][\"open\"] = $theresSomethingToEatToday;\n $timestamp = $timestamp + 24*60*60;\n }\n return $json;\n }", "protected function fillArray() {\r\n\t\t$counter = 0;\r\n\t\tfor($j=0;$j<$this->weeksInMonth;$j++) {\r\n\t\t\tfor($i=0;$i<7;$i++) {\r\n\t\t\t\t$counter++;\r\n\t\t\t\t$this->week[$j][$i] = $counter; \r\n\t\t\t\t// offset the days\r\n\t\t\t\t$this->week[$j][$i] -= $this->firstDay;\r\n\t\t\t\tif (($this->week[$j][$i] < 1) || ($this->week[$j][$i] > $this->daysInMonth)) {\t\r\n\t\t\t\t\t$this->week[$j][$i] = \"\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "protected function fillArray() {\r\n\t\t$counter = 0;\r\n\t\tfor($j=0;$j<$this->weeksInMonth;$j++) {\r\n\t\t\tfor($i=0;$i<7;$i++) {\r\n\t\t\t\t$counter++;\r\n\t\t\t\t$this->week[$j][$i] = $counter; \r\n\t\t\t\t// offset the days\r\n\t\t\t\t$this->week[$j][$i] -= $this->firstDay;\r\n\t\t\t\tif (($this->week[$j][$i] < 1) || ($this->week[$j][$i] > $this->daysInMonth)) {\t\r\n\t\t\t\t\t$this->week[$j][$i] = \"\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private function buildPagesMap()\n {\n foreach(glob($this->pagesDir . '/*.md') as $file) {\n $fContent = file_get_contents($file);\n $ext = pathinfo($file, PATHINFO_EXTENSION);\n $fileName = ucfirst(basename($file,\".\".$ext));\n\n $split = explode(PHP_EOL, $fContent);\n $open = false;\n $json = '';\n $shiftCounter = 0;\n foreach($split as $line) {\n ++$shiftCounter;\n if(preg_match('#^}#',$line)) {\n $open = false;\n $json .= $line;\n break;\n }\n if(preg_match('#^{#',$line)) {\n $open = true;\n }\n if($open) {\n $json .= $line;\n }\n }\n for($i = 0; $i < $shiftCounter; ++$i) {\n array_shift($split);\n }\n\n $json = json_decode($json,true);\n\n $text = implode(PHP_EOL, $split);\n\n $text = $this->parsedown->text($text);\n\n $fileName = preg_replace('#( )#','_',$fileName);\n\n $this->pagesMap[$fileName] = array(\n 'meta' => $json,\n 'content' => $text\n );\n }\n }", "function fillArray() {\n\t\tfor($j=0;$j<$this->weeksInMonth;$j++) {\n\t\t\tfor($i=0;$i<7;$i++) {\n\t\t\t\t$counter++;\n\t\t\t\t$this->week[$j][$i] = $counter; \n\t\t\t\t// offset the days\n\t\t\t\t$this->week[$j][$i] -= $this->firstDay;\n\t\t\t\tif (($this->week[$j][$i] < 1) || ($this->week[$j][$i] > $this->daysInMonth)) {\t\n\t\t\t\t\t$this->week[$j][$i] = \"\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private function setMovies(){\n\t\t$this->movies[] = new Movie(\"Movie 1\", 1);\n\t\t$this->movies[] = new Movie(\"Movie 2\", 2);\t\n\t}", "private function managerAcivitiesAWeek()\n {\n $managers = $this->Activities->Users->find();\n $managers->where(['group_id' => 2, 'active' => 1]);\n $allManagers = [];\n $dataID = 0;\n\n foreach ($managers as $manager) {\n $id = $manager['id'];\n\n $userTotal = $this->Activities->Users->Markers->find()\n ->where([\n 'AND' => [\n ['Markers.user_id' => $id],\n ['Markers.active' => 1]\n ]\n ])\n ->count();\n\n $userTotalWeek = $this->Activities->Users->Markers->find()\n ->where([\n 'AND' => [\n ['Markers.user_id' => $id],\n ['Markers.active' => 1],\n ['DATE(Markers.created) >' => date('Y-m-d', strtotime('-7 days'))]\n ]\n ])\n ->count();\n\n // user count 7 days\n $weekly = [];\n for($i = 0; $i < 7; $i++) {\n $days = '-' . (6-$i) . ' days';\n $date = date('Y-m-d', strtotime($days));\n $userRowsCount = $this->Activities->Users->Markers->find()\n ->where([\n 'AND' => [\n ['Markers.user_id' => $id],\n ['Date(Markers.created)' => $date],\n ['Markers.active' => 1]\n ]\n ])\n ->count();\n $weekly[] = [\n 'val' => $userRowsCount\n ];\n //$weekly[] = $userRowsCount;\n /*$weekly[] = [\n 'id' => $i+1,\n 'name' => $date,\n 'value' => $userRowsCount\n ];*/\n }\n\n $dataID++;\n $allManagers[] = [\n 'id' => $dataID,\n 'name' => $manager['username'],\n 'value' => [\n 'total' => $userTotal,\n 'totalWeek' => $userTotalWeek,\n 'weekly' => $weekly\n ]\n ];\n }\n\n return $allManagers;\n }", "public function test_month(){\n // $start->modify('first day of this month');\n // $end = new DateTime('2019-06-20');\n // $end->modify('first day of next month');\n // $interval = DateInterval::createFromDateString('1 month');\n // $period = new DatePeriod($start, $interval, $end);\n\n // foreach ($period as $dt) {\n // echo $dt->format(\"M-y\") . \"<br>\\n\";\n // echo $dt->format(\"m\") . \"<br>\\n\";\n // }\n\n // echo json_encode($period);\n\n // $this->export_model->generate_monthly_sales_overview_report();\n $this->export_model->generate_monthly_sales_overview_zonewise_report();\n }", "public function run()\n {\n $properties = [\n [\n 'name' => \"Hill at Woodway\",\n 'description' => \"Welcome to Hill at Woodway, a beautiful place to live. Our property features lush landscaping in a quiet, peaceful environment. \n You will enjoy the spacious apartments and wonderful neighbors. This gated community is professionally managed with excellent \n management and maintenance staff. Call our leasing office today for more information on your new home at Hill at Woodway.\n Come check out our Fishing Special!!\",\n 'address1' => \"10951 Laureate Dr.\",\n 'country' => \"United States\",\n 'city' => \"San Antonio\",\n 'state' => \"Texas\",\n 'zipcode' => 78249,\n 'units' => [\n [\n 'rental_amount' => 749,\n 'rental_type' => 'month',\n 'sqfeet' => 781,\n 'bedrooms' => 1,\n 'bathrooms' => 1,\n 'unit_number' => '1510'\n ],\n [\n 'rental_amount' => 623,\n 'rental_type' => 'month',\n 'sqfeet' => 566,\n 'bedrooms' => 1,\n 'bathrooms' => 1,\n 'unit_number' => '1914'\n ]\n ]\n ],\n [\n 'name' => \"Stratford Place\",\n 'description' => \"A haven from the rush of daily living... Nestled between urban sophistication and suburban living, \n Stratford Place provides a quality community that gives you a true sense of belonging, \n with resort-style amenities and comfortable living spaces. The elegant architecture and beautiful landscaping \n are designed for the comfort you need after a long day. \n You will enjoy the convenience of Stratford Places' location. An abundance of shopping and dining options can be found just moments away.\n With quick access to both the expressways and the train, you can get downtown, to the airports, or anywhere else you need to go quickly and easily.\",\n 'address1' => \"232 Butterfield Dr.\",\n 'country' => \"United States\",\n 'city' => \"Bloomingdale\",\n 'state' => \"Illinois\",\n 'zipcode' => 60108,\n 'units' => [\n [\n 'rental_amount' => 1800,\n 'rental_type' => 'month',\n 'sqfeet' => 1230,\n 'bedrooms' => 2,\n 'bathrooms' => 2,\n 'unit_number' => '2202'\n ],\n [\n 'rental_amount' => 800,\n 'rental_type' => 'month',\n 'sqfeet' => 780,\n 'bedrooms' => 1,\n 'bathrooms' => 1,\n 'unit_number' => '456'\n ],\n [\n 'rental_amount' => 1650,\n 'rental_type' => 'month',\n 'sqfeet' => 1110,\n 'bedrooms' => 2,\n 'bathrooms' => 1,\n 'unit_number' => '2100'\n ]\n ]\n ],\n [\n 'name' => \"Westchester Square\",\n 'description' => \"We have exactly what you're looking for at Westchester Square Apartment Homes in Des Moines, Iowa! \n Looking for easy access to Johnston schools? We are located in the Johnston School district! \n Our spacious one and two bedroom apartment homes are perfect for spreading out and entertaining your best friends. \n Our extremely close proximity to the shopping, entertainment and conveniences of Merle Hay puts \n all of your desires right at your fingertips. Close enough to walk to Dahl's and more!\",\n 'country' => \"United States\",\n 'city' => \"Des Moines\",\n 'state' => \"Iowa\",\n 'zipcode' => 50310,\n 'units' => [\n [\n 'rental_amount' => 750,\n 'rental_type' => 'month',\n 'sqfeet' => 560,\n 'bedrooms' => 1,\n 'bathrooms' => 1,\n 'unit_number' => '15'\n ],\n [\n 'rental_amount' => 1450,\n 'rental_type' => 'month',\n 'sqfeet' => 860,\n 'bedrooms' => 2,\n 'bathrooms' => 1,\n 'unit_number' => '19'\n ],\n [\n 'rental_amount' => 1650,\n 'rental_type' => 'month',\n 'sqfeet' => 980,\n 'bedrooms' => 2,\n 'bathrooms' => 2,\n 'unit_number' => '22'\n ]\n ]\n\n ]\n ];\n\n foreach ($properties as $property){\n $units = $property['units'];\n unset($property['units']);\n $propertyId = DB::table('property')->insertGetId($property);\n foreach ($units as $unit){\n $unit['property_id'] = $propertyId;\n DB::table('unit')->insert($unit);\n }\n }\n }", "public function jsonToArrayOfSchedule(){\n\t\t$timetables = array();\n\t\t$today = Carbon::today();\n\t\t$tomorrow = Carbon::tomorrow();\n\t\t$dates = array($today,$tomorrow);\n\n\t\tforeach ($dates as $d){\n\t\t\t$this->outputName = $d->__get('day').\"_\".$d->__get('month').\"_\".$d->__get('year').'.json';\n\t\t\ttry\n\t\t\t{\n\t\t\t $contents = File::get($this->savePath.$this->outputName);\n\t\t\t $arrayClass = json_decode($contents);\n\t\t\t $counter = 0;\n\t\t\t $dateString = $d->toDateString();\n\n\t\t\t foreach ($arrayClass as $element) {\n\t\t\t \t//$object = $this->arrayElementToObject($element);\n\t\t\t \t$timetables[$dateString][] = $element; //$object;\n\t\t\t }\n\n\t\t\t \n\t\t\t //var_dump($timetables[$dateString]);\n\t\t\t}\n\t\t\tcatch (Illuminate\\Filesystem\\FileNotFoundException $exception)\n\t\t\t{\n\t\t\t\t$this->getOne($this->idExternal);\n\t\t\t //die(\"The file \".$this->outputName.\" doesn't exist\");\n\t\t\t}\n\t\t}\n\t\tusort($timetables[$dateString], array($this, 'compareWeekday'));\n\t\tusort($timetables[$dateString], array($this, 'compareStart'));\n\t\t$timetables['__dates'] = $dates;\n\t\treturn $timetables;\n\t}", "public function setMonth(\\stdClass $data)\n {\n $this->month = Period::createFromJson($data);\n }", "function jsonAdd(string $root, array $arrays): void\n {\n $root = str_replace(\".\", \"\", $root);\n parent::jsonAddTool($this->folderRoot . $root, $arrays);\n }", "function setWeekMarkers()\n {\n $dIW = $this->cE->getDaysInWeek(\n $this->thisYear(),\n $this->thisMonth(),\n $this->thisDay()\n );\n $sDOM = $this->tableHelper->getNumTableDaysInMonth();\n for ($i=1; $i <= $sDOM; $i+= $dIW) {\n $this->children[$i]->setFirst();\n $this->children[$i+($dIW-1)]->setLast();\n }\n }", "function tsml_cache_rebuild() {\n\tglobal $tsml_cache;\n\n\t//strip empty, null values from array to save 12% space\n\t$meetings = array_map('tsml_cache_clean', tsml_get_meetings(array(), false));\n\n\t//save to file\n\tfile_put_contents(WP_CONTENT_DIR . $tsml_cache, json_encode($meetings));\n}", "function updateJson($dir, $tier, $name, $no, $since){\r\n\t\r\n\t\t$f = $dir.'/pass.json';\r\n\t\t$jsonString = file_get_contents($f);\r\n\t\r\n\t\t$data = json_decode($jsonString, true);\r\n \r\n //set Member Tier\r\n $data['generic']= setFieldValue($data['generic'], 'primaryFields', 'tier', $tier); \r\n \r\n //set Member Name\r\n\t\t$data['generic'] = setFieldValue($data['generic'], 'secondaryFields', 'name', $name); \r\n \r\n //set Member no & since\r\n $data['generic'] = setFieldValue($data['generic'], 'auxiliaryFields', 'no', $no); \r\n $data['generic'] = setFieldValue($data['generic'], 'auxiliaryFields', 'since', $since); \r\n \r\n file_put_contents($f,json_encode($data));\r\n }", "protected function aging()\n {\n foreach ($this->males as $male) {\n $male->incrementAgeByMonth();\n }\n\n foreach ($this->females as $female) {\n $female->incrementAgeByMonth();\n }\n }", "public function parse() {\n $years = range(1998, date('Y'));\n rsort($years);\n $months = range(1, 12);\n rsort($months);\n $this->items = [];\n\n foreach ($years as $year) {\n foreach ($months as $month) {\n \tif ($year >= date('Y') && $month > date('n')) {\n \t\tcontinue;\n\t }\n $startDate = sprintf('%02d/%02d/%d', $month, 1, $year);\n $endDate = sprintf('%02d/%02d/%d', $month, date('j'), $year);\n echo \"\\n\\nGathering items from {$startDate} to {$endDate}\\n\";\n\n try {\n $this->searchByMonth($startDate, $endDate);\n $this->items = array_merge($this->items, $this->_gatherItems());\n } catch (\\Exception $e) {\n die($e->getMessage());\n }\n }\n }\n }", "function build_js_map($files, $align = 0)\n{\n\t\n\t$tab_width = 4;\n\tglobal $dir_array_name;\n\tglobal $file_array_name;\n\t\n\t$align_string1 = \"\";\n\t$align_string2 = \"\";\n\t\n\tfor($i = 0; $i < $tab_width * $align; $i ++)\n\t{\n\t\t$align_string1 .= \" \";\n\t}\n\t\n\t$return_dir_map = \"{\\n\";\n\t\n\t$align ++;\n\tfor($i = 0; $i < $tab_width * $align; $i ++)\n\t{\n\t\t$align_string2 .= \" \";\n\t}\n\t\n\t$i = 0;\n\t$dirs_i = 0;\n\t$files_i = 0;\n\t\n\t$files_str = \"[\";\n\t$dirs_str = \"[\";\n\t\n\tforeach($files as $file => $info)\n\t{\n\t\t$file_basename = basename($file);\n\t\t\n\t\tif(is_array($info)) //that mean this is a dir\n\t\t{\n\t\t\t$result = build_js_map($info, $align+1);\n\t\t\t$result_dir_map = $result;\n\t\t\t\n\t\t\t$return_dir_map .= \"{$align_string2}\\\"{$file_basename}\\\":{$result_dir_map}\";\n\t\t\t$return_dir_map .= \"{$align_string2},\\n\";\n\t\t\t\n\t\t\tif($dirs_i != 0)\n\t\t\t{\n\t\t\t\t$dirs_str .= \", \";\n\t\t\t}\n\t\t\t$dirs_str .=\"\\\"{$file_basename}\\\"\";\n\t\t\t$dirs_i ++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//here the $dir supposed to be null,\n\t\t\t$return_dir_map .= \"{$align_string2}\\\"{$file_basename}\\\":\\\"${file}\\\",\\n\";\n\t\t\t\n\t\t\tif($files_i != 0)\n\t\t\t{\n\t\t\t\t$files_str .= \", \";\n\t\t\t}\n\t\t\t$files_str .= \"\\\"{$file_basename}\\\"\";\n\t\t\t$files_i ++;\n\t\t}\n\t\t$i ++;\n\t}\n\t\n\t$dirs_str .= \"],\\n\";\n\t$files_str .= \"]\\n\";\n\t\n\t$return_dir_map .= \"{$align_string2}{$dir_array_name}:$dirs_str\";\n\t$return_dir_map .= \"{$align_string2}{$file_array_name}:$files_str\";\n\t\n\t$return_dir_map .= \"{$align_string1}}\\n\";\n\t\n\treturn $return_dir_map;\n}", "public function to_json() {\n \n\t\tparent::to_json();\n \n\t\t$this->json['layouts'] = $this->layouts;\n \n\t}", "public function saveJsonFields() {\n foreach ($this->json_data as $field => $data)\n $this->$field = json_encode($data);\n\n }", "function _statistics()\n {\n \t$object = new JObject();\n \t// returns an array of objects with ->title and ->value\n \t$model = JModel::getInstance( 'Newsletters', 'PhplistModel' );\n \t$model->setState( 'order', 'tbl.name' );\n \t$list = $model->getList();\n \t$this->assign('newsletters', $list);\n }", "private function writeJson(): void\n {\n $this->files->put($this->statusesFile, serialize($this->modulesStatuses));\n }", "private function sortMonths()\r\n {\r\n // Ensure chronological order using array_merge and array_flip\r\n $tempMonthList = $newMonthOrder = [];\r\n foreach ($this->months as $key => $value) {\r\n $tempMonthList[] = date('Y-m', strtotime($key));\r\n }\r\n sort($tempMonthList);\r\n for ($i = 0; $i < count($tempMonthList); $i++) {\r\n $newMonthOrder[] = date('M Y', strtotime($tempMonthList[$i]));\r\n }\r\n $monthHolder = array_merge(array_flip($newMonthOrder), $this->months);\r\n $this->months = $monthHolder;\r\n }", "function bbp_add_permastructs()\n{\n}", "function MostrarLunas($pdf, $cMonth, $cYear, $monthNames,$dir){\n\n $date = $cMonth.'/01/'.$cYear;\n $moon_phase = 5;\n\n $Url = 'http://api.usno.navy.mil/moon/phase?date='.$date.'&nump='.$moon_phase;\n $mi_cadena = '';\n\n $mi_url= $Url; \n\n $fo= fopen(\"$mi_url\",\"r\") or die (\"No se ha encontrado la pagina.\"); \n\n while ( !feof($fo) ) { \n\n $mi_cadena .= fgets($fo, 4096); \n\n \n } \n\n fclose ($fo); \n\n //Variable de prueba para ver resultado de la api\n $q = 0;\n\n if ( $q == 1 ){\n\n $pdf->Write(5,$mi_cadena);\n\n } \n else {\n\n //Convierto json en array\n $mi_cadena = json_decode($mi_cadena, true);\n\n //Numero de fases en este mes\n $Total_fases_luna = $mi_cadena['numphases'];\n\n //$pdf->Write(5,'Numero de Fases Lunares >> '.$mi_cadena['numphases']);\n //$pdf->Ln();\n $pdf->SetXY(170,20);\n //$pdf->Write(5, $monthNames[$cMonth-1].' '.$cYear);\n $pdf->Ln(2);\n\n //Guardo en un arry el mes actual dado por la api\n $fecha_Fase_Lunar = $mi_cadena['phasedata'][0]['date'];\n $fecha_Fase_Lunar_no_space = explode(\" \", $fecha_Fase_Lunar);\n // Separo el mes dentro de la información del array\n $Control_mes_Lunar = $fecha_Fase_Lunar_no_space[1];\n\n for ($i=0; $i < $Total_fases_luna; $i++) { \n\n //Muestro array\n $tipo_Luna = $mi_cadena['phasedata'][$i]['phase'];\n // $pdf->Write(5,$tipo_Luna);\n // $pdf->Write(5,' >>> ');\n // Solo mostrar dia, separo por espacios y muestro dia\n $fecha_Fase_Lunar = $mi_cadena['phasedata'][$i]['date'];\n $fecha_Fase_Lunar_no_space = explode(\" \", $fecha_Fase_Lunar);\n $dia_luna = $fecha_Fase_Lunar_no_space[2];\n // Separo el mes dentro de la información del array\n $mes_luna = $fecha_Fase_Lunar_no_space[1];\n\n //Controlo el ultimo evento lunar para que esté dentro del mes\n //Esto se hace porque existen meses con 5 lunas\n If ($Control_mes_Lunar == $mes_luna){\n\n \tMoon_2($pdf,$tipo_Luna, $dia_luna,$i,$dir);\n\n }\n \t \n\n \n \n }\n\n $pdf->Ln();\n\n }\n}", "public function create_json_per_kecamatan() {\n foreach( $this->list_kecamatan as $kecamatan => $kecamatan_id ) {\n $data_kecamatan = $this->process_per_kecamatan($kecamatan_id);\n $file_create = fopen('json/'. $kecamatan .'.json', 'w');\n fwrite($file_create, json_encode( $data_kecamatan ) ); \n fclose($file_create);\n }\n }", "function setDayNames() {\n\t\tforeach ( $this->rcy->fullYear as $monthVal => $dateList ) {\n\t\t\tforeach ( $dateList as $datVal => $dayFeastList ) {\n\t\t\t\t\n\t\t\t\tforeach ( $dayFeastList as $feastIndex => $singleFeas ) {\n\t\t\t\t\t\n\t\t\t\t\tif (preg_match ( \"/^[C|L|E|O|A]W\\d{2}-/\", $singleFeas ['code'] ) === 1) {\n\t\t\t\t\t\t$this->rcy->fullYear [$monthVal] [$datVal] [$feastIndex] ['name'] = $this->getSingleTitle ( $singleFeas ['code'] );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Localization has to be done here. Depending upon the requirement, get data even from database.\n\t\t\t\t\t\t$this->rcy->fullYear [$monthVal] [$datVal] [$feastIndex] ['name'] = $singleFeas ['code'];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "protected function json_ld_loop()\n\t{\t\t\n\t\t$postion = 1;\n\t\t$breadcrumbs = array();\n\t\t//Loop around our breadcrumbs, call the JSON-LD assembler\n\t\tforeach($this->breadcrumbs as $breadcrumb)\n\t\t{\n\t\t\t$breadcrumbs[] = $breadcrumb->assemble_json_ld($postion);\n\t\t\t$postion++;\n\t\t}\n\t\treturn $breadcrumbs;\n\t}", "public function json_output() {\n \n global $wp_query;\n \n $movies_tag = $wp_query->get( 'movies' );\n \n \n if ( ! $movies_tag || $movies_tag !== 'all' ) { \n return;\n }\n \n $movies_array = array();\n \n $args = array(\n 'post_type' => 'movies',\n 'posts_per_page' => 100,\n );\n \n\n // Get any existing copy of our transient data\n if ( false === ( $movies_query = get_transient( 'cacheMoviesQuery' ) ) ) {\n // It wasn't there, so regenerate the data and save the transient\n $movies_query = new WP_Query($args);\n set_transient( 'cacheMoviesQuery', $movies_query );\n }\n\n $movies_array['data']= array();\n\n if ( $movies_query->have_posts() ) : while ( $movies_query->have_posts() ) : $movies_query->the_post();\n $post_id = get_the_ID();\n \n $movies_array['data'][] = array(\n 'id' => $post_id,\n 'title' => get_the_title(),\n 'poster_url'=> get_post_meta($post_id, 'poster_url', true),\n 'rating' => get_post_meta($post_id, 'rating', true),\n 'year' => get_post_meta($post_id, 'year', true),\n 'short_description' => get_post_meta($post_id, 'short_description', true)\n );\n \n endwhile;\n \n wp_reset_postdata(); \n \n endif;\n header(\"Access-Control-Allow-Origin: *\");\n header( 'Content-Type: application/json;' );\n wp_send_json( $movies_array );\n \n }" ]
[ "0.5385485", "0.49365306", "0.47877198", "0.47877198", "0.47633165", "0.47390458", "0.47267362", "0.46846956", "0.46692765", "0.46613178", "0.46530375", "0.46321315", "0.4609286", "0.45399135", "0.45304626", "0.4510983", "0.4446401", "0.44454446", "0.44363892", "0.44227046", "0.44184867", "0.4418226", "0.44137383", "0.4401244", "0.4344363", "0.43401873", "0.43363893", "0.43214947", "0.4292438", "0.42912027" ]
0.7254236
0
The 'on_before_render' will set up our JanesWalk json in the page
public function on_before_render() { $this->addFooterItem('<script type="text/javascript">window.JanesWalk = window.JanesWalk || {}; Object.assign(window.JanesWalk, ' . json_encode($this->pageData) . ');</script>'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function onPreRender() {\n\t\t$this->view->register('events', $this->events);\n\t\t$this->view->register('delta', $this->delta);\n\t\t$this->view->register('result', $this->result);\n\t}", "public function setup()\n {\n $this->RequestHandler->prefers('json');\n // Force a JSON response regardless of extension\n // $this->RequestHandler->renderAs($this->_registry->getController(), 'json');\n }", "function onBeforeRender()\n\t{\n\t}", "public function preRender()\n {\n $this->setGlobals();\n $this->renderCategories();\n }", "protected function beforeRender() {\n\t}", "public function onRun()\n {\n $this->itemPage = $this->page['itemPage'] = $this->property('itemPage');\n $this->catListPage = $this->page['catListPage'] = $this->property('catListPage');\n $this->templateType = Settings::get('css_framework') ? 'bulma' : 'bootstrap';\n $this->page['listTemplate'] = $this->property('listTemplate');\n $this->page['showCategories'] = $this->property('showCategories');\n $this->page['showPagination'] = $this->property('showPagination');\n $this->page['liClass'] = $this->property('liClass');\n $this->page['ulClass'] = $this->property('ulClass');\n $this->page['aClass'] = $this->property('aClass');\n $this->page['cats'] = Category::whereHas('items', function ($q) {\n $q->where('enabled', 1);\n })->get();\n $this->page['selectedCat'] = $this->property('selectedCat');\n\n if ($this->property('listTemplate') == 'table') {\n $this->addJs('https://cdnjs.cloudflare.com/ajax/libs/axios/0.16.2/axios.js');\n $this->addJs('https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.2/vue.js');\n }\n\n // find the correct property to select the items with\n $object = null;\n if ($this->property('selectedCat') != null) {\n $object = $this->loadItemsByCategory($this->property('selectedCat'), true);\n } elseif ($this->property('category') != null) {\n $object = $this->loadItemsByCategory($this->property('category'));\n }\n\n // check if a valid object has been created\n if (!$object) {\n // display all items\n if ($this->property('listTemplate') == 'menu') {\n $this->links = LinkItem::with('category')->where('enabled', 1)->orderBy('order', $this->property('order'))->get();\n } else {\n $this->links = LinkItem::with('category')->where('enabled', 1)->orderBy('order', $this->property('order'))->paginate($this->property('itemsPerPage'), $this->property('pageNumber'));\n }\n } else {\n // show the items in the links\n $this->links = $object->items()->where('enabled', 1)\n ->orderBy('order', $this->property('order'))->paginate($this->property('itemsPerPage'), $this->property('pageNumber'));\n }\n\n // Add url helper to the items\n if ($this->links != null) {\n $this->links = $this->updatePageUrls($this->links);\n }\n }", "public function before()\n\t{\n\t\tparent::before();\n\n\t\tif ($this->auto_render === TRUE)\n\t\t{\n\t\t\t// Load the template\n\t\t\t$this->template = JadeView::factory($this->template);\n\t\t}\n\t}", "protected function beforeRender() {\n $userData = $this->getToken();\n //set view variables with this function\n //key will be the variables name\n $this->setVars(array(\n 'vehicles' => Vehicle::getAll($userData['id']),\n 'token' => $userData['token']\n ));\n }", "public function onBeforeRender()\n\t{\n\t\tif ($this->isLdap)\n\t\t{\n\t\t\tSHLdapHelper::triggerEvent('onBeforeRender');\n\t\t}\n\t}", "protected function onPreRender()\n\t\t{\n\t\t\t$this->applyFilterAndSort();\n\t\t\tparent::onPreRender();\n\t\t}", "public function beforeRender() {\n\t\tparent::beforeRender();\n\t}", "public function before()\n {\n parent::before();\n if($this->auto_render)\n {\n // Initialize empty values\n $this->template->title = '';\n $this->template->content = ''; \n $this->template->styles = array();\n $this->template->scripts = array();\n }\n }", "public function init()\r\n {\r\n $ajaxContext = $this->_helper->getHelper(\"ajaxContext\")\r\n ->addActionContext('loginx','json')\r\n //->setAutoJsonSerialization(false)\r\n ->setAutoDisableLayout(true)\r\n ->initContext('json');\r\n }", "public function init() {\n $ajaxContext = $this->_helper->getHelper('AjaxContext');\n $ajaxContext->addActionContext('index', array('json', 'html'))\n ->initContext();\n }", "public function beforeRender()\n\t{\n $this->set('jsVars', $this->_jsVars);\n\n\t\t$flash_message = $this->Cookie->read('flash-message');\n\t \t$this->Cookie->delete('flash-message');\n $this->set('flash_message', json_encode($flash_message));\n\n\t\tif($this->Auth->User()){\n\t\t\t$Users = ClassRegistry::init('User');\n\t\t\t$safe_user = $Users->getSafe($this->Auth->User('id'));\n\t\t\t$safe_user['User']['first_name'] = preg_replace_callback('/\\\\\\\\u([0-9a-f]{4})/i', array($this, 'replace_unicode_escape_sequence'), $safe_user['User']['first_name']);\n\t\t\t$this->set('AuthUser', $safe_user['User']);\n\t\t}\n\n\t\t/* Set default meta content */\n\t\t$title = 'Cribspot - College Housing Made Simple';\n\t\t$description = \"Cribspot takes the pain out of finding college housing. We've gathered thousands of listings so \" .\n\t\t\"you can stop stressing about housing and get back to making the most of your college experience.\";\n\t\t$this->set('meta', array(\n\t\t\t'title' => $title,\n\t\t\t'description' => $description\n\t\t));\n\t}", "function beforeRender() {\n parent::beforeRender();\n\n // Pull the list of available API Users\n $this->set('vv_api_users', $this->CoreApi->Co->ApiUser->availableApiUsers($this->cur_co['Co']['id']));\n \n // and identifier types\n $this->set('vv_identifier_types', $this->CoreApi->Co->CoPerson->Identifier->types($this->cur_co['Co']['id'], 'type'));\n \n $this->set('vv_api_endpoint', Router::url('/', true) . 'api/co/' . $this->cur_co['Co']['id'] . '/core/v1');\n }", "public function initialize() {\n if ($this->dispatcher->isFinished() && $this->dispatcher->wasForwarded())\n return;\n\n parent::initialize();\n\n if ($this->isListing()) {\n $this->type = $this->controllerName;\n $this->resultsPerPage = $this->di['config']->application->postsPerPage;\n $this->periods = Helper\\TimeHelper::$periods;\n\n $this->assets->addJs($this->dist.\"/js/tab.min.js\", FALSE);\n $this->assets->addJs($this->dist.\"/js/list.min.js\", FALSE);\n\n // FOR DEBUG PURPOSE ONLY UNCOMMENT THE FOLLOWING LINE AND COMMENT THE ONE ABOVE.\n //$this->assets->addJs(\"/reindex/themes/\".$this->themeName.\"/src/js/list.js\", FALSE);\n\n $this->view->pick('views/index');\n }\n }", "public function onAfterRender() {}", "protected function initializeForPage(){\r\n\t\t\t$this->addExternalJavascript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js');\r\n\t\t\t$this->addExternalJavascript('http://code.jquery.com/ui/1.10.3/jquery-ui.js');\r\n\r\n\t\t\t//Load leaflet.js\r\n\t\t\t//$this->addExternalCSS(\"http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css\");\r\n \t//$this->addExternalJavascript(\"http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js\");\r\n \t$this->addExternalCSS(\"http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.css\");\r\n \t$this->addExternalJavascript(\"http://cdn.leafletjs.com/leaflet-0.5.1/leaflet-src.js\");\r\n\r\n \t/*$this->addExternalJavascript(\"http://beta.mapquestapi.com/sdk/leaflet/v0.1/mq-map.js?key=Fmjtd%7Cluur29012d%2C2n%3Do5-90zxdf\");\r\n \t$this->addExternalJavascript(\"http://beta.mapquestapi.com/sdk/leaflet/v0.1/mq-routing.js?key=Fmjtd%7Cluur29012d%2C2n%3Do5-90zxdf\");\r\n\t\t\t*/\r\n \t//Load local js files\r\n \t$this->addInternalJavascript(\"/modules/RoadworkFlooding/javascript/heatmap.js\");\r\n\t\t\t$this->addInternalJavascript(\"/modules/RoadworkFlooding/javascript/heatmap-leaflet.js\");\r\n\t\t\t$this->addInternalJavascript(\"/modules/RoadworkFlooding/javascript/QuadTree.js\");\r\n\r\n\t\t\t$this->addExternalCSS(\"http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css\");\r\n\t\t\t$this->addExternalCSS(\"\");\r\n\t\t\t$this->addExternalJavascript(\"http://code.jquery.com/ui/1.10.4/jquery-ui.js\");\r\n\t\t\t$this->addExternalJavascript(\"\");\r\n\r\n\t //instantiate controller\r\n\t /*$this->controller = DataRetriever::factory('InteropDataRetriever', array());\r\n\t \r\n\t switch ($this->page) \r\n\t { \r\n\t case 'index': \r\n\t break; \r\n\t } */\r\n\t\t}", "public function onConstruct()\n {\n $this->view->setLayout('main');\n\n $basePath = \"/\";\n $templateDir = APP_PATH . \"/public/dist/templates/\";\n\n //Dynamic PHP code that will normally be stored in some kind of controller\n $templateData = array(\n 'favorites' => file_get_contents($templateDir . 'favorites.html'),\n 'favorite' => file_get_contents($templateDir . 'favorite.html'),\n 'location' => file_get_contents($templateDir . 'location.html'),\n 'compare' => file_get_contents($templateDir . 'compare.html'),\n 'error' => file_get_contents($templateDir . 'error.html')\n );\n\n $settings = json_encode(array(\n 'basePath' => $basePath,\n 'templates' => $templateData\n ));\n\n $this->view->user = ($this->auth->isUserSignedIn()) ? $this->auth->getIdentity() : false;\n $this->view->js_settings = $settings;\n\n $this->reader = new Reader(APP_PATH . \"/app/database/geoip/GeoLite2-City.mmdb\");\n }", "protected function preRender() {\n\n }", "public function preDispatch()\n {\n $this->db = $this->container->get('db');\n if (!in_array($this->Request()->getActionName(), ['index', 'load'], true)) {\n $this->Front()->Plugins()->Json()->setRenderer(true);\n }\n }", "function beforeRender () {\n\t\n\t\n\t\tparent::beforeRender();\n\t\n\t\n\t}", "function pre_render() {}", "public function beforeRender() {\n\t\t$this->Html->script('markitup/jquery.markitup.js', false);\n\t}", "public function before()\n {\n parent::before();\n\n if (!Request::current()->is_ajax() AND Kohana::$environment !== Kohana::DEVELOPMENT)\n {\n header('Content-type: application/json');\n echo json_encode(array(\n 'success' => false,\n 'message' => 'Not authotized request',\n 'total' => 0\n ));\n exit;\n }\n \n $this->format = $this->request->param('format');\n\n $this->template = array(\n 'success' => false,\n 'data' => null,\n 'message' => '',\n 'total' => null\n );\n\n switch ($this->format) {\n case 'json':\n case 'jsonp':\n $this->response->headers('Content-Type', 'application/json');\n break;\n // TODO make xml view output\n case 'xml':\n $this->response->headers('Content-Type', 'text/xml');\n break;\n }\n }", "public function loadMoive(){\n $this->autoRender = false;\n \n $json_string = $this->request->data('data');\n $json_string = utf8_encode($json_string);\n $data_array = json_decode($json_string, true);\n \n $this->set('data', $data_array);\n $this->render('get_info');\n }", "public function initJsonContext()\n {\n if (!$this->getAutoJsonSerialization()) {\n return;\n }\n\n $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');\n $view = $viewRenderer->view;\n if ($view instanceof Zend_View_Interface) {\n $viewRenderer->setNoRender(true);\n }\n }", "public function beforeFilter() {\r\n if ($this->RequestHandler->ext === 'json') {\r\n $this->RequestHandler->setContent('json');\r\n Configure::write('debug', 0);\r\n }\r\n parent::beforeFilter();\r\n }", "public function before()\n {\n parent::before();\n\n if ($this->auto_render === TRUE)\n {\n $this->template->styles = array();\n $this->template->scripts = array();\n $this->template->content = NULL;\n }\n }" ]
[ "0.64645565", "0.62165093", "0.61690897", "0.6133459", "0.6096738", "0.60017145", "0.59791565", "0.5971206", "0.59558356", "0.59311664", "0.5918661", "0.5908279", "0.58866847", "0.5872882", "0.58656406", "0.5820709", "0.58094937", "0.5805208", "0.57990336", "0.5759418", "0.5759172", "0.57542455", "0.57202536", "0.5657322", "0.5640057", "0.5637064", "0.56186724", "0.55956614", "0.5583475", "0.5576675" ]
0.72802556
0
Formats the Neo4j Response.
public function format($response) { $this->isNew = false; $responseObject = new Response(); $responseObject->setRawResponse($response); if ($responseObject->containsResults()) { $this->extractResults($response); $this->prepareResultSet(); $this->prepareNodesByLabels(); $this->prepareRelationshipsByType(); $this->processIdentification($response); } if ($responseObject->containsRows()) { $rows = $this->formatRows($response); $responseObject->setRows($rows); if ($responseObject->containsResults()) { foreach ($responseObject->geRows() as $k => $v) { if (!$this->result->hasIdentifier($k)) { $this->result->addIdentifierValue($k, $v); } } } } $responseObject->setResult($this->result); $this->reset(); return $responseObject; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function toResponseFormat()\n {\n return [\n 'target' => $this->getTarget(),\n 'caption' => $this->getCaption()\n ];\n }", "public function formaterResponseData($response);", "function sendResponse()\n\t{\n\t\t$arr = array();\n\t\tforeach($this as $key => $tag) {\n\t\t\tif (is_object($tag) && $tag instanceof JSONField) {\n\t\t\t\t$tag->formatJSON($arr);\n\t\t\t}\n\t\t}\n\t\theader('Content-type: application/json; charset=utf-8');\n\t\tprint json_encode($arr, JSON_UNESCAPED_UNICODE|JSON_HEX_TAG);\n\t}", "public function toApiGatewayFormat()\n {\n return $this->response;\n }", "private function formatResponse()\n {\n $formatedResponse = ['error' => ''];\n $this->response = json_decode($this->response, true);\n if(!array_key_exists('def', $this->response))\n $formatedResponse['error'] = 'empty response';\n elseif(empty($this->response['def']))\n $formatedResponse['error'] = 'word not found';\n else\n {\n $isNoun = true;\n $formatedResponse['pos'] = $this->response['def'][0]['pos'];\n if($this->response['def'][0]['pos'] != 'noun')\n {\n $formatedResponse['error'] = 'is not noun';\n $isNoun = false;\n }\n foreach($this->response['def'][0]['tr'] as $variant)\n {\n if(($isNoun && $variant['pos'] == 'noun') || !$isNoun)\n $formatedResponse['translate'][] = $variant['text'];\n \n if($formatedResponse['translate'] && count($formatedResponse['translate']) > 3)\n break;\n \n }\n $formatedResponse['translate'] = implode(', ', $formatedResponse['translate']);\n $this->response = $formatedResponse;\n }\n }", "public function format($response)\n {\n $response->getHeaders()->set('Content-Type', 'text/xml; charset=UTF-8');\n if ($response->data !== null) {\n $response->content = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' . PHP_EOL . $response->data;\n }\n }", "public function toJson(): string\n {\n $fluent = new Fluent($this->response);\n\n return $fluent->toJson();\n }", "protected function formatResult()\n\t{\n\t\t$this->arResult =& $this->dbResult;\n\t\t$this->arResult['ERRORS'] =& $this->errors;\n\n\t\tif(is_array($this->componentData['LIST_HEADERS']))\n\t\t{\n\t\t\t// grid\n\t\t\t$this->arResult['HEADERS'] = array();\n\t\t\tforeach($this->componentData['LIST_HEADERS'] as $code => $fld)\n\t\t\t{\n\t\t\t\t$this->arResult['HEADERS'][] = array(\n\t\t\t\t\t'id' => $code,\n\t\t\t\t\t'name' => $fld['title'],\n\t\t\t\t\t'sort' => $code,\n\t\t\t\t\t'default' => $fld['DEFAULT'],\n\t\t\t\t\t'editable' => false\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tunset($this->componentData);\n\t}", "public function writeResponse();", "public function format($response)\n {\n if ($response->data !== null) {\n $response->content = $response->data;\n }\n }", "public function format($response)\n {\n if (!is_array($response->data)) {\n return;\n }\n // type 'check' or 'avisio'\n $type = ArrayHelper::getValue($response->data, 'type', '');\n $charset = $this->encoding === null ? $response->charset : $this->encoding;\n if (stripos($this->contentType, 'charset') === false) {\n $this->contentType .= '; charset=' . $charset;\n }\n $response->getHeaders()->set('Content-Type', $this->contentType);\n $dom = new DOMDocument($this->version, $charset);\n if ($type == 'check') {\n $root = new DOMElement('checkOrderResponse');\n } elseif ($type == 'avisio') {\n $root = new DOMElement('paymentAvisoResponse');\n }\n $dom->appendChild($root);\n\n foreach ($response->data as $name => $value) {\n if ($name !== 'type') {\n $root->setAttribute($name, $value);\n }\n }\n\n $response->content = $dom->saveXML();\n }", "public function serialize() :array\n {\n return (new ResponsePresenter($this))->format();\n }", "public function toResponseFormat()\n {\n return [\n 'url' => $this->getUrl(),\n 'caption' => $this->getCaption(),\n 'webview_size' => $this->getSize()\n ];\n }", "public function format($response, $data);", "public function toResponseFormat()\n {\n return [\n 'url' => $this->getUrl()\n ];\n }", "public function dumpResponse()\n {\n $content = $this->response->getContent();\n $json = json_decode($content, true);\n $output = (JSON_ERROR_NONE === json_last_error()) ? $json : $content;\n var_export($output);\n }", "public function outgoingResponse();", "public function writeResponseContent();", "public function format_response($response)\n\t{\n\t\treturn (string) $response;\n\t}", "private function format(){\n $this->params['format'] = 'json';\n }", "public function as_raw()\n {\n return $this->response_data;\n }", "public function processResponse(){\n return json_encode($this->getData());\n }", "public function __toString() {\n return '[Response Object]';\n }", "private function createResponse(){\n $request = $this->serviceContainer['request'];\n $rawResponse = $this->serviceContainer['databasehelper']->getResponse($request->requestMethod, $request->requestBody,$request->requestParam);\n\n $this->response = $this->serviceContainer['response']->getResponse($rawResponse, $this->serviceContainer['request']->requestMethod);\n\n }", "public function to_string() {\n\n\t\t// TODO: print this nicer and with less irrelevant information (e.g. subscription attributes, etc) @MR 2015-11-05\n\t\treturn print_r( $this->response, true );\n\t}", "public function toJson()\n {\n $this->sendHeaders();\n if (!$this->isError() && null === $this->getId()) {\n return '';\n }\n\n return parent::toJson();\n }", "public function format()\n {\n if ($this->groupEvent) {\n // ugly fix for misunderstanding of this...\n $this->version = 2;\n }\n\n $result = [\n 'Url' => $this->url,\n 'EventType' => $this->eventType,\n 'IsBackup' => $this->isBackup,\n 'Status' => $this->status,\n 'Version' => $this->version\n ];\n\n if($this->apikeyId){\n $result['APIKeyID'] = $this->apikeyId;\n }\n\n return $result;\n }", "public function formatResponse($jsonObject)\n {\n return '<pre>' . $this->stringifyJsonObject($jsonObject) . '</pre>';\n }", "public function iDumpTheResponse()\n {\n if (empty($this->client)) {\n $this->fail(\"No client. Request something first.\");\n }\n $response = $this->client->getResponse();\n $content = $response->getContent();\n try {\n $content = json_encode(json_decode($content), JSON_PRETTY_PRINT);\n } catch (\\Exception $e) {}\n\n print($response->getStatusCode() . \"\\n\" . $content . \"\\n\");\n }", "public function returnJson()\n {\n Yii::$app->response->format = \\yii\\web\\Response::FORMAT_JSON;\n }" ]
[ "0.6403634", "0.6296872", "0.6239121", "0.6220233", "0.6214615", "0.60413593", "0.59822524", "0.5978025", "0.5961059", "0.5938431", "0.5927599", "0.5892992", "0.58371323", "0.58137715", "0.5771093", "0.5762874", "0.57001704", "0.56929135", "0.56758845", "0.5590919", "0.55860907", "0.55455595", "0.5514965", "0.5495048", "0.5492061", "0.5489604", "0.5373011", "0.5369165", "0.5358973", "0.5346985" ]
0.6757546
0
Dumps a skin data in multiple files.
public function dumpSkinData(Skin $skin, string $path) : void{ //file_put_contents($path . "SkinId.txt", $skin->getSkinId()); file_put_contents($path . "SkinData.txt", $skin->getSkinData()); file_put_contents($path . "SkinGeometryData.txt", $skin->getGeometryData()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function save_skin() {\n\t\t$_POST['file'] = trim( $_POST['file'] );\n\n\t\t$pages = array( 'general', 'layout', 'styles', 'import' );\n\t\t$skin_data = array();\n\n\t\tforeach ( $pages as $page_str ) {\n\t\t\t$tabs = include WPV_THEME_OPTIONS . $page_str . '/list.php';\n\n\t\t\tforeach ( $tabs as $tab ) {\n\t\t\t\t$tab_contents = include WPV_THEME_OPTIONS.$page_str.\"/$tab.php\";\n\n\t\t\t\tforeach ( $tab_contents as $field ) {\n\t\t\t\t\tif ( ! isset( $field['static'] ) || ! $field['static'] ) {\n\t\t\t\t\t\t$type = $field['type'];\n\t\t\t\t\t\tif ( isset( $field['id'] ) ) {\n\t\t\t\t\t\t\t$skin_data = array_merge( $skin_data, $this->get_values( $this->process_option_id( $type, $field['id'] ) ) );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$skin_data = array_merge( $skin_data, $this->get_values( $this->process_option_noid( $type, $field ) ) );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( file_put_contents( WPV_SAVED_OPTIONS.$_POST['file'], json_encode( $skin_data ) ) ) {\n\t\t\techo '<span class=\"success\">'. __( 'Success.', 'construction' ) . '</span>'; // xss ok\n\t\t\texit;\n\t\t}\n\n\t\techo '<span class=\"error\">'. __( 'Cannot save file.', 'construction' ) . '</span>'; // xss ok\n\t\texit;\n\t}", "public function dumpFiles()\n\t\t{\n\t\t\t$this->preint_r( $this->files );\n\t\t}", "public function createDump($fileName);", "function main() {\n\t\t$data = t3lib_div::_GP('data');\n\t\tif (isset($data['skin_selector'])) {\n\t\t\ttx_wecconfig_skins::assignTemplate($this->pObj->id);\n\t\t}\n\n\t\tif ($this->allowSkinCopy() && t3lib_div::_GP('copySkin')) {\n\t\t\ttx_wecconfig_skins::copyTemplate();\n\t\t}\n\n\t\t$theOutput .= $this->pObj->doc->spacer(5);\n\t\t$theOutput .= $this->pObj->doc->section('', $this->renderSkinSelector(), 0, 1);\n\t\t$theOutput .= $this->pObj->doc->spacer(5);\n\n\t\treturn $theOutput;\n\t}", "protected function generateSQLDumps() {\n $this->output('==SQL Dumps Generator Initiated==');\n\n $this->createDefaultPaths(array(\n 'mysql' => 'mysql/',\n 'mysql_dumps' => 'dumps/',\n ));\n $mysqlBasePath = $this->paths['mysql'];\n\n $this->makeDirectory($mysqlBasePath);\n\n foreach ($this->databases as $database) {\n $namespace = $this->makeNamespace($database);\n $this->makeDirectory($mysqlBasePath . $namespace);\n $this->makeDirectory($mysqlBasePath . $namespace . '/' . $this->paths['mysql_dumps']);\n\n $results = $this->generateSQLDump($database, $namespace);\n if (!$results) {\n $this->output('Mysql Dump could not be created for ' . $database);\n }\n }\n $this->output('==SQL Dumps Generator Complete==');\n }", "static public function load_assets()\n\t{\t\t\n\t\t// Load dependencies.\n\t\tself::load_dependencies();\n\t\t\n\t\t// Get an array of paths that inherit this skin.\n\t\t$skin_inheritor_paths = self::config('skin_inheritor_paths');\n\t\t\t\n\t\t// Strip the unwanted uri segments.\n\t\t$paths['url_base'] = str_replace($skin_inheritor_paths, '', url::base());\n\t\t$paths['DOCROOT'] = str_replace($skin_inheritor_paths, '', DOCROOT);\n\t\t\n\t\t// Echo stylesheets.\n\t\tforeach (self::$stylesheets as $file => $media)\n\t\t{\n\t\t\techo html::stylesheet($paths['url_base'].$file, $media);\n\t\t}\n\t\t\n\t\t// Echo scripts.\n\t\tforeach (self::$scripts as $file)\n\t\t{\n\t\t\techo html::script($paths['url_base'].$file);\n\t\t}\n\t\t\n\t\t// Include files.\n\t\tforeach (self::$files as $file)\n\t\t{\n\t\t\tinclude($paths['DOCROOT'].$file);\n\t\t}\n\t}", "public function handlesDumpCompression();", "function dump_all() {\n\t\techo \"-----------------------------<br />\";\n\t\t$this -> dump_tree();\n\t\t$this -> dump_jail();\n\t\techo \"-----------------------------<br />\";\n\t}", "function setSkins() {\n\t$skiny_thumbs = \"\";\n\tif(isset($_SESSION[\"tema_id\"][$_SESSION[\"aplikace_id\"]])) {\n\t\t$dir_tema = 'tema/';\n\t\t$dir_skin = $dir_tema.$_SESSION[\"tema_id\"][$_SESSION[\"aplikace_id\"]].\"/skiny\";\n\t\t\n\t\t$dir = glob($dir_skin.'/*');\n\n\t\t// srovname adresare podle datumu ulozeni, aby nove skiny, byli na zacatku!\n\t\tuasort($dir, \"newest\");\n\t\t\n\t\tforeach($dir as $file) \n\t\t{ \n//\t\t echo basename($file).'<br />'; \n//\t\t echo $file.'<br />'; \n\t\t}\n\n\t\tif ($dir) {\n\t\t//\techo \"Directory handle: $handle\\n\";\n\t\t//\techo \"Entries:\\n\";\n\n\t\t\t/* This is the correct way to loop over the directory. */\n//\t\t\twhile (false !== ($entry = readdir($handle))) \n\t\t\tforeach($dir as $entry) {\n\t\t\t\t$entry = basename($entry);\n\t\t\t\t// preskocim x51 extra privileg temata\n\t\t\t\tif(strpos($entry, \"x51\") && !$_SESSION[\"x51admin\"]) continue;\n\t\t\t\tif(substr($entry, 0,1) == \".\") continue;\n\t\t\t\t$img_thumb = $dir_skin.\"/\".$entry.\"/\".\"thumb.png\";\n\t\t\t\t$class = \"\";\n\t\t\t\tif(isset($_SESSION[\"skin_id\"][$_SESSION[\"aplikace_id\"]]) && $_SESSION[\"skin_id\"][$_SESSION[\"aplikace_id\"]] == $entry)\n\t\t\t\t\t$class .= \"current\";\n\t\t\t\t$class = $class ? \" class=\\\"\".$class.\"\\\"\" : \"\";\n\t\t\t\tif(is_file($img_thumb))\n\t\t\t\t\t$skiny_thumbs .=\"<div$class><img src=\\\"\".$img_thumb.\"\\\" id=\\\"skin_$entry\\\"></div>\\n\";\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\treturn \"<p>Nejsou skiny pro toto téma</p>\";\n\t\treturn $skiny_thumbs;\n\t}\n}", "public function writeOptimizedFiles() {\n\t\t$extensionDir = dirname( __FILE__ );\n\t\t$resourceDir = \"$extensionDir/resources\";\n\n\t\t// have to group styles by dirname, since they sometimes refer to resources by relative path.\n\t\t$dirStyleCombinedUrls = array();\n\t\t$dirStyleMinifiedUrls = array();\n\t\t$dirStylesMap = array();\n\t\tforeach ( $this->styles as $style ) {\n\t\t\t$dir = dirname( $style );\n\t\t\tif ( !isset( $dirStylesMap[$dir] ) ) {\n\t\t\t\t$dirStylesMap[$dir] = array();\n\t\t\t}\n\t\t\t$dirStylesMap[$dir][] = $style;\n\t\t}\n\t\tforeach ( $dirStylesMap as $dir => $styles ) {\n\t\t\t$combined = \"$dir/dir.\" . self::STYLES_COMBINED;\n\t\t\t$this->concatenateFiles( $styles, $combined );\n\t\t\t$dirStyleCombinedUrls[] = preg_replace( '/^resources\\//', '', $combined );\n\n\t\t\t$minified = \"$dir/dir.\" . self::STYLES_MINIFIED;\n\t\t\t$this->writeMinifiedCss( $combined, $minified );\n\t\t\t$dirStyleMinifiedUrls[] = preg_replace( '/^resources\\//', '', $minified );\n\t\t}\n\t\t$this->writeStyleImporter( $dirStyleCombinedUrls, $resourceDir . '/' . self::STYLES_COMBINED );\n\t\t$this->writeStyleImporter( $dirStyleMinifiedUrls, $resourceDir . '/' . self::STYLES_MINIFIED );\n\n\t\t// scripts are easy, they don't (or shouldn't) refer to other resources with relative paths\n\t\t$scriptsCombinedFile = $resourceDir . '/' . self::SCRIPTS_COMBINED;\n\t\t$this->concatenateFiles( $this->scripts, $scriptsCombinedFile );\n\t\t$this->writeMinifiedJs( $scriptsCombinedFile, $resourceDir . '/' . self::SCRIPTS_MINIFIED );\n\t}", "function ShowSkinWithBuff() {\r\nglobal $uInfo, $config; \r\n\r\n\t$skin = GetVisual('skin');\r\n\tif ($skin === false and $uInfo['name'] !== false ) return; // user not exists - all users have default skin in skins dir\r\n\t\r\n\tloadTool('skin.class.php');\t\r\n\t$dir = MCRAFT . ( ( $uInfo['female'] == -1 and $uInfo['name'] ) ? 'tmp/skin_buffer/' : 'tmp/skin_buffer/default/' );\r\n\t$buffer = $dir.($uInfo['name'] ? $uInfo['name'] : 'Char').($uInfo['mini'] ? '_Mini' : '').($uInfo['female'] == 1 ? '_female' : '').'.png';\r\n\r\n\t\tif (file_exists($buffer)) { readfile($buffer); return; }\r\n\telseif ( $config['sbuffer'] ) \r\n\t\r\n\t\t$image = ($uInfo['mini'])? skinGenerator2D::saveHead($buffer, $skin) : skinGenerator2D::savePreview($buffer, $skin, GetVisual('cloak'));\r\n\telse \t\r\n\t\t$image = (!$uInfo['mini'])? skinGenerator2D::createHead($skin) : skinGenerator2D::createPreview($skin, GetVisual('cloak'));\r\n\r\n\tif ($image) { imagepng($image); imagedestroy($image); } \r\n}", "private function saveProfilesToFile() {\n\t\t$fp = fopen(D3P_DATAFILE, 'w');\n\t\tfwrite($fp, json_encode($this->profiles));\n\t\tfclose($fp);\t\t\n\t}", "public function generateFiles()\n {\n $bundles = $this->bundles;\n\n //parse the bundles\n foreach ($bundles as $bundleName) {\n $this->logger->info('Bundle analysed: '. $bundleName);\n\n //the path of the files\n $allMetadata = $this->doctrineHelper->getMetadata($bundleName);\n\n /** @var ClassMetadata $meta */\n foreach ($allMetadata as $meta) {\n $customRepositoryClassName = $meta->customRepositoryClassName;\n if ($meta->customRepositoryClassName === null) {\n $this->logger->info('SKIPPING entity: '. $meta->name);\n continue;\n }\n\n $this->logger->info('Entity: '. $meta->name);\n $renderedTemplate = $this->generateRepository($allMetadata, $bundleName, $meta);\n\n //store the generated content\n $reflector = new \\ReflectionClass($customRepositoryClassName);\n $originalRepostoryPath = $reflector->getFileName();\n $fullPath = str_replace('.php', 'Base.php', $originalRepostoryPath);\n\n $this->persister->persistClass($fullPath, $renderedTemplate);\n }\n }\n }", "public function restoreDump($fileName);", "public function dump(array $packages);", "public function load_skins()\n {\n // Import MEC skins Class\n $this->import('app.libraries.skins');\n \n $MEC_skins = new MEC_skins();\n $MEC_skins->load();\n }", "public function dumpFileContents($identifier);", "public static function saveLayoutFiles($scss, $theme, $layout_id, $options);", "public function assetsDump(\n array $opt = [\n 'bootstrap-dir' => 'vendor/twbs/bootstrap/dist',\n 'jquery-dir' => 'vendor/components/jquery'\n ]\n ) {\n $opt['bootstrap-dir'] = realpath($opt['bootstrap-dir']);\n $opt['jquery-dir'] = realpath($opt['jquery-dir']);\n\n $this->taskDeleteDir('public/assets/')->run();\n\n $this->taskFileSystemStack()\n ->mkdir('public/assets/css')\n ->mkdir('public/assets/js')\n ->mkdir('public/assets/fonts')\n ->mkdir('public/assets/img')\n ->copy($opt['bootstrap-dir'].'/css/bootstrap.min.css', 'public/assets/css/bootstrap.min.css')\n ->copy($opt['bootstrap-dir'].'/js/bootstrap.min.js', 'public/assets/js/bootstrap.min.js')\n ->mirror($opt['bootstrap-dir'].'/fonts/', 'public/assets/fonts/')\n ->copy($opt['jquery-dir'].'/jquery.min.js', 'public/assets/js/jquery.min.js')\n ->run();\n }", "public function loadDataFileBackground()\n {\n $this->wide_dimensionsFileBackground = [20, 500, 800, 1200, 1900, 3600];\n\n $this->filenamesFileBackground = [];\n foreach ($this->wide_dimensionsFileBackground as $wide)\n array_push($this->filenamesFileBackground, $this->getFileBackgroundAbsolutePath().'-'.$wide.'.jpg');\n }", "function _coda_backup_migrate_dump_tables() {\n $filename = $_ENV['CODA_SITE_LOCAL_PATH'] . '/sql/dump.sql';\n\n // Dump the database.\n $temp_file = _backup_migrate_temp_file();\n\n $success = _backup_migrate_get_dump_sql(\n $filename, \n variable_get(\"backup_migrate_exclude_tables\", _backup_migrate_default_exclude_tables()),\n variable_get(\"backup_migrate_nodata_tables\", _backup_migrate_default_structure_only_tables())\n );\n $filename .= \".sql\";\n $filemime = 'text/x-sql';\n\n\n // Save or download the results.\n if ($success) {\n rename($temp_file, $filepath);\n }\n\n // Delete any temporary files we've created.\n _backup_migrate_temp_file(\"\", TRUE);\n}", "protected function copyFiles()\n {\n $skeleton_finder = new SkeletonFinder();\n $source_path = $skeleton_finder->findByName($this->skeleton_name)->getRealpath();\n\n $finder = $this->getFinderForFilesToCopy($source_path);\n\n foreach ($finder as $file) {\n $target_file_path = $this->target_path . DIRECTORY_SEPARATOR . $file->getRelativePathname();\n $target_file_path = $this->twig_string_renderer->renderToString($target_file_path, $this->data);\n\n $this->fs->copy($file->getRealpath(), $target_file_path, $this->overwrite_enabled);\n\n $msg = '[copy] ' . $file->getRealpath() . ' => ' . $target_file_path;\n\n if ($this->reporting_enabled) {\n $this->report[] = $msg;\n }\n }\n }", "private function generateSkeletonFiles()\r\n {\r\n $data = $this->getModuleInfo();\r\n\r\n $providerPath = $this->getProviderPath($data);\r\n\r\n $this->files->delete($providerPath . 'ServiceProvider.php');\r\n\r\n $files = [\r\n 'resources/admin/js/' . $data['name'] . '.js' => $this->getSkeletonPath('app.skeleton.js'),\r\n 'resources/admin/js/controllers/' . $data['className'] . 'Ctrl.js' => $this->getSkeletonPath('controller.skeleton.js'),\r\n 'resources/admin/js/config/routes.js' => $this->getSkeletonPath('routes.skeleton.js'),\r\n 'resources/admin/js/config/navigation.js' => $this->getSkeletonPath('navigation.skeleton.js'),\r\n $providerPath . 'ModuleProvider.php' => $this->getSkeletonPath('provider.skeleton'),\r\n $providerPath . '.php' => $this->getSkeletonPath('module.skeleton')\r\n ];\r\n\r\n $this->generateSkeletonsFromArray($files, $data);\r\n\r\n //add empty routes and settings file\r\n $this->files->put($this->basePath . '/src/routes.php', '<?php' . PHP_EOL);\r\n $this->files->put($this->basePath . '/src/settings.php', '<?php' . PHP_EOL);\r\n\r\n //add empty scss file\r\n $this->files->put($this->basePath . '/resources/admin/sass/main.scss', '');\r\n\r\n //add view skeleton\r\n $this->files->copy($this->getSkeletonPath('view.skeleton.html'), $this->basePath . 'resources/admin/views/index.html');\r\n }", "public static function dump() {\n\t\tself::setAppPath();\n\t\t$dump = array();\n\t\tforeach(self::$list as $target => $path) {\n\t\t\ttry{\n\t\t\t\t$buildPath = self::createBuildPath($target, $path);\n\t\t\t\tif(!empty($buildPath)) {\n\t\t\t\t\tpr(\n\t\t\t\t\t\t'App::build(array(' . PHP_EOL .\n\t\t\t\t\t\t\t'\"' . $target .'\" => array(\"' . join('\", \"', $buildPath) . '\")'. PHP_EOL .\n\t\t\t\t\t\t');'. PHP_EOL \n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (Exception $e){\n\t\t\t\t//nothing to do\n\t\t\t}\n\t\t}\n\n\t}", "function dump()\n {\n $arguments = func_get_args();\n require(\"../views/dump.php\");\n exit;\n }", "public static function dump()\n {\n $this->objList();\n $this->includeList();\n }", "public function dump($filename, $connectionName = null);", "private function saveProfiles() {\n switch(D3P_STORAGE) {\n\t case 'file':\n\t $this->saveProfilesToFile();\n\t break;\n }\n\t}", "public function run() {\n\t\tforeach($this->_sources as $path => $content) {\n\t\t\t\n\t\t\t/* W3C-Compliant browsers */\n\t\t\tprint \"[info]\tgenerating \".$path.\" (data URLs)\\n\";\n\t\t\t$this->_outputStylesheet($path, $content, 'w3c');\n\t\t\t\n\t\t\t/* IE */\n\t\t\tprint \"[info]\tgenerating \".$path.\" (MHTML)\\n\";\n\t\t\t$this->_outputStylesheet($path, $content, 'ie');\n\t\t}\n\t}", "private function saveArticleAssets() {\n foreach ($this->files as $url => $path) {\n $contents = file_get_contents($path);\n \\Drupal::service('file_system')->saveData($contents, $this->entityDirectory . '/' . basename($url));\n }\n }" ]
[ "0.59998524", "0.5773677", "0.5347873", "0.52540123", "0.5215236", "0.51405", "0.49528515", "0.4927005", "0.4858519", "0.48544458", "0.48460555", "0.4816386", "0.48127088", "0.48002988", "0.47930485", "0.4760097", "0.472316", "0.47119159", "0.4674446", "0.4635136", "0.46150568", "0.46139225", "0.46031383", "0.46018597", "0.46003824", "0.4578145", "0.4571855", "0.45675623", "0.45560205", "0.45492432" ]
0.630735
0
To override for defining a new adminData
protected function getAdminData ():CRUDDatas{ return new CRUDDatas(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function setData(\\App\\Model\\Admin $adminData)\n {\n $this->adminData = $adminData;\n }", "public function adminStore()\n {\n //\n }", "function __construct() {\n\t\t$this->type = 'admin';\n\t\treturn parent::__construct();\n\t}", "abstract public function initializeAdminList();", "public function admin() {}", "function admin_init() {}", "public function admin_init(){\n\t\t\t\n\t\t\t\t \t\n\t\t\t\n\t\t}", "public function setAdmin()\n {\n $this->type = self::ADMIN_TYPE;\n $this->save();\n }", "public function __construct()\n {\n $this->title = __('decoy::admins.controller.title');\n $this->description = __('decoy::admins.controller.description');\n $this->columns = [\n __('decoy::admins.controller.column.name') => 'getAdminTitleHtmlAttribute',\n __('decoy::admins.controller.column.status') => 'getAdminStatusAttribute',\n __('decoy::admins.controller.column.email') => 'email',\n ];\n\n parent::__construct();\n }", "function Landlord_admin_handler()\n\t\t{\n\t\t\tparent::__construct();\n\t\t}", "abstract public function is_admin();", "public function admin_init() {\n\t\t\tregister_setting('mt_id_mapper-group', 'mt_db_host');\n\t\t\tregister_setting('mt_id_mapper-group', 'mt_db_name');\n\t\t\tregister_setting('mt_id_mapper-group', 'mt_db_user');\n\t\t\tregister_setting('mt_id_mapper-group', 'mt_db_password');\n\n\t\t\tadd_settings_section('mt_id_mapper-db_section', 'Database Connection', array(&$this, 'settings_section'), 'mt_id_mapper');\n\t\t\tadd_settings_field('mt_id_mapper-db_host', 'Database host', array(&$this, 'settings_input_text'), 'mt_id_mapper', 'mt_id_mapper-db_section', array('field' => 'mt_db_host'));\n\t\t\tadd_settings_field('mt_id_mapper-db_name', 'Database name', array(&$this, 'settings_input_text'), 'mt_id_mapper', 'mt_id_mapper-db_section', array('field' => 'mt_db_name'));\n\t\t\tadd_settings_field('mt_id_mapper-db_user', 'Database user', array(&$this, 'settings_input_text'), 'mt_id_mapper', 'mt_id_mapper-db_section', array('field' => 'mt_db_user'));\n\t\t\tadd_settings_field('mt_id_mapper-db_password', 'Database password', array(&$this, 'settings_input_password'), 'mt_id_mapper', 'mt_id_mapper-db_section', array('field' => 'mt_db_password'));\n\t\t}", "abstract public function initializeAdminForm();", "private function admin()\n {\n return [\n \"total\" => [\n \"orders\" => [\n \"count\" => $this->order->total($this->auth->id(), $this->role),\n \"text\" => \"Orders\",\n \"route\" => \"/orders\",\n \"icon\" => \"fa-shopping-cart\"\n ],\n \"technicians\" => [\n \"count\" => (new TechnicianModel())->total(),\n \"text\" => \"Teknisi\",\n \"route\" => \"/technician\",\n \"icon\" => \"fa-users\"\n ],\n \"users\" => [\n \"count\" => (new UserModel())->total(),\n \"text\" => \"Pelanggan\",\n \"route\" => \"/user\",\n \"icon\" => \"fa-user\"\n ],\n \"messages\" => [\n \"count\" => (new SuggestionModel())->total($this->auth->id(), $this->role),\n \"text\" => \"Saran\",\n \"route\" => \"/suggestions\",\n \"icon\" => \"fa-envelope\"\n ]\n ]\n ];\n }", "public function getAdminOptions()\n {\n if (empty($this->adminOptions)) {\n $uamAdminOptions = array(\n \t'hide_post_title' => 'false', \n \t'post_title' => __('No rights!', 'user-access-manager'),\n \t'post_content' => __(\n \t\t'Sorry you have no rights to view this post!', \n \t\t'user-access-manager'\n ),\n 'hide_post' => 'false', \n \t'hide_post_comment' => 'false', \n \t'post_comment_content' => __(\n \t\t'Sorry no rights to view comments!', \n \t\t'user-access-manager'\n ), \n \t'post_comments_locked' => 'false',\n \t'hide_page_title' => 'false', \n \t'page_title' => __('No rights!', 'user-access-manager'), \n \t'page_content' => __(\n \t\t'Sorry you have no rights to view this page!', \n \t\t'user-access-manager'\n ), \n \t'hide_page' => 'false',\n 'hide_page_comment' => 'false', \n \t'page_comment_content' => __(\n \t\t'Sorry no rights to view comments!', \n \t\t'user-access-manager'\n ), \n \t'page_comments_locked' => 'false',\n \t'redirect' => 'false', \n \t'redirect_custom_page' => '', \n \t'redirect_custom_url' => '', \n \t'lock_recursive' => 'true',\n 'authors_has_access_to_own' => 'true',\n 'authors_can_add_posts_to_groups' => 'false',\n \t'lock_file' => 'false', \n \t'file_pass_type' => 'random', \n \t'lock_file_types' => 'all', \n \t'download_type' => 'fopen', \n \t'locked_file_types' => 'zip,rar,tar,gz,bz2', \n \t'not_locked_file_types' => 'gif,jpg,jpeg,png', \n \t'blog_admin_hint' => 'true', \n \t'blog_admin_hint_text' => '[L]',\n \t'hide_empty_categories' => 'true', \n \t'protect_feed' => 'true', \n \t'show_post_content_before_more' => 'false', \n \t'full_access_role' => 'administrator'\n );\n \n $uamOptions = get_option($this->adminOptionsName);\n \n if (!empty($uamOptions)) {\n foreach ($uamOptions as $key => $option) {\n $uamAdminOptions[$key] = $option;\n }\n }\n \n update_option($this->adminOptionsName, $uamAdminOptions);\n $this->adminOptions = $uamAdminOptions;\n }\n\n return $this->adminOptions;\n }", "protected function createAdmin(array $data)\n {\n return Admin::create([\n 'name' => $data['name'],\n 'email' => $data['email'],\n 'phone' => $data['phone'],\n 'add_by' => auth()->guard('admin')->user()->id,\n 'password' => bcrypt($data['password']),\n 'online_at' => now(),\n 'img' => 'https://ui-avatars.com/api/?background=0D8ABC&color=fff&length=1&rounded=true&bold=true&size=65&name='.$data['name'],\n\n ]);\n }", "public function adminCreate()\n {\n //\n }", "public function initAdmin()\n {\n \\Yii::trace('Init users module admin resources.');\n parent::initAdmin();\n }", "public function __construct()\n {\n $adminModel = new adminModel();\n $admins = $adminModel->getRows();\n if (empty($admins)) {\n $data = array(\n 'id' => 0,\n 'username' => 'datdo',\n 'email' => '[email protected]',\n 'password' => 'a12345678',\n 'name' => '',\n 'address' => '',\n 'phone' => '',\n 'note' => '',\n 'status' => 1,\n 'avatar' => ''\n );\n $adminModel->store($data);\n }\n }", "public function notAdmin(){\n parent::notAdmin();\n }", "function _horde_admin_list()\n{\n return array('configuration' => array(\n 'link' => '%application%/admin/setup/',\n 'name' => _(\"_Setup\"),\n 'icon' => 'config.png'),\n 'users' => array(\n 'link' => '%application%/admin/user.php',\n 'name' => _(\"_Users\"),\n 'icon' => 'user.png'),\n 'groups' => array(\n 'link' => '%application%/admin/groups.php',\n 'name' => _(\"_Groups\"),\n 'icon' => 'group.png'),\n 'perms' => array(\n 'link' => '%application%/admin/perms/index.php',\n 'name' => _(\"_Permissions\"),\n 'icon' => 'perms.png'),\n 'alarms' => array(\n 'link' => '%application%/admin/alarms.php',\n 'name' => _(\"_Alarms\"),\n 'icon' => 'alerts/alarm.png'),\n 'datatree' => array(\n 'link' => '%application%/admin/datatree.php',\n 'name' => _(\"_DataTree\"),\n 'icon' => 'datatree.png'),\n 'sessions' => array(\n 'link' => '%application%/admin/sessions.php',\n 'name' => _(\"Sessions\"),\n 'icon' => 'user.png'),\n 'phpshell' => array(\n 'link' => '%application%/admin/phpshell.php',\n 'name' => _(\"P_HP Shell\"),\n 'icon' => 'mime/php.png'),\n 'sqlshell' => array(\n 'link' => '%application%/admin/sqlshell.php',\n 'name' => _(\"S_QL Shell\"),\n 'icon' => 'sql.png'),\n 'cmdshell' => array(\n 'link' => '%application%/admin/cmdshell.php',\n 'name' => _(\"_CLI\"),\n 'icon' => 'shell.png'),\n );\n}", "public function include_admin()\n {\n }", "public function isAdmin();", "public function isAdmin();", "public function adminUserData()\n {\n $password = password_hash(\"admin\", PASSWORD_BCRYPT);\n $data = \"INSERT INTO users (username, password, permission) VALUES('admin', '$password', 'admin')\";\n return $data;\n }", "function admins_only()\r\r\n\t{\r\r\n\t\tparent::__construct();\r\r\n\t}", "public function __construct(array $data = array())\n {\n $this->_app = isset($data['app']) ? $data['app'] : Mage::app();\n $this->_appConfig = isset($data['appConfig']) ? $data['appConfig'] : Mage::getConfig();\n if (isset($data['helpers'])) {\n $this->_helpers = $data['helpers'];\n }\n\n\n parent::__construct();\n $this->setCacheId('adminhtml_acl_menu_config');\n\n /* @var $adminhtmlConfig Varien_Simplexml_Config */\n $adminhtmlConfig = $this->_app->loadCache($this->getCacheId());\n if ($adminhtmlConfig) {\n $this->_adminhtmlConfig = new Varien_Simplexml_Config($adminhtmlConfig);\n } else {\n $adminhtmlConfig = new Varien_Simplexml_Config;\n $adminhtmlConfig->loadString('<?xml version=\"1.0\"?><config></config>');\n $this->_appConfig->loadModulesConfiguration('adminhtml.xml', $adminhtmlConfig);\n $this->_adminhtmlConfig = $adminhtmlConfig;\n\n if ($this->_app->useCache('config')) {\n $this->_app->saveCache($adminhtmlConfig->getXmlString(), $this->getCacheId(),\n array(Mage_Core_Model_Config::CACHE_TAG));\n }\n }\n }", "public function adminInit()\n {\n // Hinzufügen von Einstellungsbereichen\n foreach ($this->settingsSections as $section) {\n if (isset($section['desc']) && !empty($section['desc'])) {\n $section['desc'] = '<div class=\"inside\">' . $section['desc'] . '</div>';\n $callback = function () use ($section) {\n echo str_replace('\"', '\\\"', $section['desc']);\n };\n } elseif (isset($section['callback'])) {\n $callback = $section['callback'];\n } else {\n $callback = null;\n }\n\n add_settings_section($section['id'], $section['title'], $callback, $section['id']);\n }\n\n // Hinzufügen von Einstellungsfelder\n foreach ($this->settingsFields as $section => $field) {\n foreach ($field as $option) {\n $name = $option['name'];\n $type = isset($option['type']) ? $option['type'] : 'text';\n $label = isset($option['label']) ? $option['label'] : '';\n $callback = isset($option['callback']) ? $option['callback'] : [$this, 'callback' . ucfirst($type)];\n\n $args = [\n 'id' => $name,\n 'class' => isset($option['class']) ? $option['class'] : $name,\n 'label_for' => \"{$section}[{$name}]\",\n 'desc' => isset($option['desc']) ? $option['desc'] : '',\n 'name' => $label,\n 'section' => $section,\n 'size' => isset($option['size']) ? $option['size'] : null,\n 'options' => isset($option['options']) ? $option['options'] : '',\n 'default' => isset($option['default']) ? $option['default'] : '',\n 'sanitize_callback' => isset($option['sanitize_callback']) ? $option['sanitize_callback'] : '',\n 'type' => $type,\n 'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : '',\n 'min' => isset($option['min']) ? $option['min'] : '',\n 'max' => isset($option['max']) ? $option['max'] : '',\n 'step' => isset($option['step']) ? $option['step'] : '',\n ];\n\n add_settings_field(\"{$section}[{$name}]\", $label, $callback, $section, $section, $args);\n\n if (in_array($type, ['color', 'file'])) {\n add_action('admin_enqueue_scripts', [$this, $type . 'EnqueueScripts']);\n }\n }\n }\n\n // Registrieren der Einstellungen\n foreach ($this->settingsSections as $section) {\n register_setting($section['id'], $this->optionName, [$this, 'sanitizeOptions']);\n }\n }", "public function getAdminId()\n {\n return $this->admin_id;\n }", "public function getAdmin()\n {\n return $this->admin;\n }" ]
[ "0.69821054", "0.68535477", "0.68508464", "0.68217766", "0.6530991", "0.64386344", "0.64373654", "0.638846", "0.629258", "0.6292431", "0.62790436", "0.6192835", "0.6175106", "0.61578816", "0.6136738", "0.61357665", "0.6127078", "0.6062521", "0.6051934", "0.6038566", "0.6027678", "0.60232025", "0.600723", "0.600723", "0.5995596", "0.59940326", "0.5959519", "0.5922472", "0.5906573", "0.5873899" ]
0.6935857
1
To override for defining a new ModelViewer
protected function getModelViewer ():ModelViewer{ return new ModelViewer($this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abstract protected function getModel();", "protected abstract function defineModel();", "public function setNewModel();", "protected abstract function model();", "public function __construct()\n {\n $this->setModel(new $this->model);\n }", "function getModelView()\n {\n return $this->modelView;\n }", "abstract function getModel();", "function eventclass_Viewer()\n\t{\n\t\t$this->events[\"CopyOnLoad\"]=true;\n\n\t\t$this->events[\"BeforeShowEdit\"]=true;\n\n\t\t$this->events[\"BeforeProcessList\"]=true;\n\n\n//\tonscreen events\n\t\t$this->events[\"Viewer_snippet4\"] = true;\n\t\t$this->events[\"surat_snippet191\"] = true;\n\t\t$this->events[\"suratview_snippet15\"] = true;\n\t\t$this->events[\"suratview_snippet23\"] = true;\n\t\t$this->events[\"suratview_snippet33\"] = true;\n\n\t}", "public function videourl()\n\t{\n\t\t$view = $this->getView('videourl');\n\n\t\tif ($model = $this->getModel('videourl'))\n\t\t{\n\t\t\t$view->setModel($model, true);\n\t\t}\n\n\t\t$view->getvideourl();\n\t}", "abstract protected function model();", "abstract protected function model();", "function __construct() {\n parent::__construct();\n $this->_model = $this->cargar_modelo('matricula');\n }", "function Livre_model()\n {\n parent::__construct();\n }", "public function getViewer()\n {\n return $this->controller->getViewer();\n }", "protected function afterInitReadOnlyModel(){\n\t\t\n\t}", "abstract public function getView();", "function setModel($model){\n\n\t\t/***** commneted code is shoud be run *****/\n\t\t// $this->add('H1',null,'name')->set($model['name']);\n\n\t\t/** \n\t\tadd( 'View_Name' , 'Class_Property' , 'Template_Spot' , 'Template_Path' ) \n\t\t**/ \n\n\t\t/***** trySet() function set model Field name value in \"name\" spot->it is a template part *****/\n\t\t$this->template->trySet('name',$model['name']);\n\t\t\n\t\t/***** button add in \"btn\" spot *****/ \n\t\t$this->add('Button',null,'btn')\n\t\t\t->js('click')\n\t\t\t->univ()\n\t\t\t->frameURL('frame_title',$this->api->url('chapter26')) /***** frameURL('new_popup_form_title' , 'page_url' ) *****/\n\t\t\t;\n\n\t\t/***** \n\t\t\t$this->api->url('page_name',array('key'=>'value'));\n\t\t\tarray pass more parameters \n\t\t*****/\n\n\t\t/***** its use for because it cannot be call parent setModel() function *****/ \n\t\tparent::setModel($model);\n\n\t}", "public abstract function model();", "public abstract function model();", "abstract public function model();", "abstract public function model();", "abstract public function model();", "abstract public function model();", "abstract public function model();", "abstract public function model();", "public function __construct()\n {\n //$this->model = $model;\n }", "public abstract function getView();", "public function __construct()\n\t{\n\t\tparent::__construct();\n\t\t$this->load->model('view_enveloppe_model');\n\n\n\n\t}", "public function getModel();", "public function getModel();" ]
[ "0.5829748", "0.5769645", "0.5766164", "0.57038885", "0.5650409", "0.5627029", "0.56175345", "0.56123275", "0.56011945", "0.55915874", "0.55915874", "0.55629104", "0.5553745", "0.55303794", "0.5505789", "0.5466988", "0.5465999", "0.5398661", "0.5398661", "0.53882354", "0.53882354", "0.53882354", "0.53882354", "0.53882354", "0.53882354", "0.5385477", "0.5366598", "0.5361892", "0.5361198", "0.5361198" ]
0.7616956
0
Unassigns a user from a role
function unassign_role($user_id, $role_id) { $result = $this->db->get_where('users_roles', array('user_id' => $user_id, 'role_id' => $role_id)); if ($result->num_rows == 0) { return false; } else { $array = $result->result(); return $this->db->delete('users_roles', array('id' => $array[0]->id)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function revokeRole($role);", "public function removeRole($user, $role);", "public function detachRole($role);", "public function detachRole($role);", "public function removeRole($role);", "public function removeRole($role);", "static function removeRoleAssignment($data)\n { global $DB;\n $sql = 'SELECT {role_assignments}.roleid,{role_assignments}.userid,{context}.instanceid AS categoryid\n FROM {role_assignments}\n INNER JOIN {context} ON {context}.id = {role_assignments}.contextid\n WHERE {role_assignments}.id = ?';\n $result = $DB->get_record_sql($sql,array($data));\n\n $user = new User($result->userid);\n $output = $user->unsetUserRole($result->categoryid,$result->roleid);\n \n \n return $output;\n }", "function extendedforum_role_unassign($userid, $context) {\n if (empty($context->contextlevel)) {\n return false;\n }\n\n extendedforum_remove_user_subscriptions($userid, $context);\n extendedforum_remove_user_tracking($userid, $context);\n\n return true;\n}", "function removeRole($role) {\n $this->removeValues('roles', $role);\n }", "public function unassignRol($userId,$rolId){\n $user = User::find($userId);\n $user->roles()->detach($rolId);\n return redirect('/usuarios/'.$userId.'/assignOrUnassignRol');\n }", "function mpt_remove_role( $role ) {\n\treturn MPT_Roles::remove_role( $role );\n}", "function rules_action_user_remove_role($account, $roles) {\n if ($account->uid) {\n foreach ($roles as $rid) {\n // If the user has this role, remove it.\n if (isset($account->roles[$rid])) {\n unset($account->roles[$rid]);\n }\n }\n }\n else {\n return FALSE;\n }\n}", "public function unassignTask()\n\t{\n\t\tRequest::setVar('hidemainmenu', 1);\n\n\t\t$ids = Request::getArray('id', array());\n\t\t$ids = (!is_array($ids) ? array($ids) : $ids);\n\t\t$gid = Request::getString('gid', '');\n\t\t$roleid = Request::getInt('roleid', 0);\n\n\t\tif (!$gid)\n\t\t{\n\t\t\tApp::redirect(\n\t\t\t\tRoute::url('index.php?option=' . $this->_option, false),\n\t\t\t\tLang::txt('COM_GROUPS_MISSING_ID'),\n\t\t\t\t'error'\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tforeach ($ids as $id)\n\t\t{\n\t\t\t$model = \\Components\\Groups\\Models\\Member\\Role::oneByUserAndRole((int)$id, $roleid);\n\n\t\t\tif ($model->get('id'))\n\t\t\t{\n\t\t\t\t$model->destroy();\n\t\t\t}\n\t\t}\n\n\t\tif ($rtrn = Request::getString('return'))\n\t\t{\n\t\t\tApp::redirect(\n\t\t\t\tRoute::url('index.php?option=' . $this->_option . '&controller=' . $rtrn . '&gid=' . $gid, false)\n\t\t\t);\n\t\t}\n\n\t\t// Output the HTML\n\t\t$this->cancelTask();\n\t}", "function Unassign($Role, $UserID = null)\n\t{\n\t\tif ($UserID === null)\n\t\t\t$UserID = jf::CurrentUser ();\n\t\treturn jf::SQL ( \"DELETE FROM {$this->TablePrefix()}rbac_userroles\n\t\tWHERE UserID=? AND RoleID=?\", $UserID, $Role ) >= 1;\n\t}", "public function actionUnassign(string $roleName, int $userId)\n {\n $model = new Role(['roleName' => $roleName, 'userId' => $userId]);\n if (!$model->validate()) {\n $this->setBadRequest();\n return $model->getErrors();\n }\n\n Authorize::checkPermission('unassignRole', $model->getRole()->toArray());\n $this->setStatusDeleted();\n $model->unassignUser($userId);\n }", "function mumiemodule_role_unassign($userid, $context) { //TODO: return-werte bearbeiten\n\tglobal $CFG; \n //it is not possible to check if this had been a teacher before removal\n //but we can check if this user was NOT a student in a group in this course\n if($context->contextlevel==CONTEXT_COURSE){\n\t if($groups = groups_get_all_groups($context->instanceid, $userid)){\n\t\t foreach($groups as $group){\n\t\t\t if(groups_is_member($group->id, $userid)){ //so this is a tutor or student\n\t\t\t\t $mumiemodules = get_records('mumiemodule', 'course', $context->instanceid); //list of all mumiemodules in the course\n\t\t\t\t $mumiemodules = array_values($mumiemodules);\n\t\t\t\t\t if(!record_exists('mumiemodule_students', 'userid', $userid, 'mumiemodule', $mumiemodules[0]->id)){ //so this was no student\n\t\t\t\t\t\t\t//the user had been a tutor - we have to change the tutorial\n\t\t\t\t\t\t\t$tutorial = new object();\n\t\t\t\t\t\t\t$tutorial->syncid = 'moodle-'.$CFG->prefix.'group-'.$group->id;\n\t\t\t\t\t\t\t$tutorial->tutor = 'moodle-dummy_tutor';\n\t\t\t\t\t\t\tchange_tutorial_for_mumie($tutorial);\n\t\t\t\t\t\t //the user could have been a tutor but could also been a teacher - so try:\n\t\t\t\t\t\t return mumiemodule_remove_teacher_subscriptions($userid, $context);\n\t\t\t\t\t } else { //this had been a student that is still in a MUMIE-tutorial\n\t\t\t\t\t\t $user_sync_id = 'moodle-'.$CFG->prefix.'user-'.$userid;\n\t\t\t\t\t\t $group_sync_id = 'moodle-'.$CFG->prefix.'group-'.$group->id;\n\t\t\t\t\t\t remove_user_from_mumie_tutorial($user_sync_id, $group_sync_id);\n\t\t\t\t\t\t //and now the student has to be removed from all mumiemodules in this course\n\t\t\t\t\t\t foreach ($mumiemodules as $mumiemodule){\n\t\t\t\t\t\t \tmumiemodule_students_unsubscribe($userid, $mumiemodule, $group->id);\n\t\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t }\n\t\t }\n\t } else { //this user could have been nearly any role - so try:\n\t \treturn mumiemodule_remove_teacher_subscriptions($userid, $context);\n\t }\n }\n //for any other context we try to remove teachers:\n return mumiemodule_remove_teacher_subscriptions($userid, $context);\n}", "public function detachRole($role, $company = null);", "function bbp_remove_roles()\n{\n}", "public function unassignRole($roleName, $userId)\n {\n $role = $this->role->findByName($roleName);\n $user = $this->model->find($userId);\n\n $user->roles()->detach($role);\n }", "public function removeRole($role)\n {\n // TODO: Implement removeRole() method.\n }", "public function detachRoles($role)\n {\n $role = ! is_int($role) ? $role : $this->find($role);\n $role->roles()->detach();\n }", "public function destroy(User $user,Role $role)\n {\n $user->roles()->detach($role);\n\n return back()->with('success','Role Detached Successfully');\n }", "public function removeSubscriberRole($subscriberRole);", "function remove_roles() {\n\n remove_role( 'subscriber' );\n remove_role( 'contributor' );\n\n}", "public function stopManagingRole()\n {\n $this->currentlyManagingRole = false;\n }", "public function destroy(RoleUser $roleuser)\n {\n //\n }", "public function unassignAllRoles($userId)\n {\n $user = $this->model->find($userId);\n $user->roles()->detach();\n }", "public function detachUser(Request $request) {\n $validator = Validator::make($request->all(), [\n 'user_id' => 'required|numeric|exists:users,id',\n 'role_id' => 'required|numeric|exists:roles,id'\n ]);\n if ($validator->fails()) {\n return response()->json(['response'=>'error', 'message'=>$validator->errors()->first()], 400); \n }\n $role = Role::find($request->role_id);\n $user = User::find($request->user_id);\n\n $user->roles()->detach($role->id);\n $notif = new Notification;\n $notif->text = __('notification.role_unassign', ['role'=> Role::find($request->role_id)->name]);\n $user->notifications()->save($notif);\n return response()->json(null,204); \n }", "public function removeRole($role)\n {\n $roleElement = $this->getRole($role);\n if ($roleElement) {\n $this->user_roles->removeElement($roleElement);\n }\n }", "private function setRole()\n {\n $this->role = $this->getUser()->getRoles();\n\n if(in_array('ROLE_USER', $this->role) && count($this->role) > 1) {\n unset($this->role[array_search('ROLE_USER', $this->role)]);\n }\n }" ]
[ "0.75307184", "0.72352916", "0.7202825", "0.7202825", "0.7107796", "0.7107796", "0.69644344", "0.6812336", "0.6744926", "0.6742201", "0.6731392", "0.67195153", "0.664108", "0.66188526", "0.65797544", "0.6575799", "0.6545316", "0.65255356", "0.64405173", "0.6385484", "0.6341926", "0.6306055", "0.63059217", "0.6294011", "0.6288786", "0.6285752", "0.6267398", "0.6248631", "0.62174785", "0.6207404" ]
0.72612697
1
Returns an array of users who have a given capability. This takes capability dependencies into consideration, so for example if a user has site:doanything, any capname requested here will include that user.
function get_users_by_capability($capname, $blacklist=array(), $where_conditions=array()) { $this->load->model('users/capability_model'); $this->load->model('users/role_model'); $capability = $this->capability_model->get(array('name' => $capname), true); if (!$capability) { show_error("Capability '$capname' doesn't exist!"); return false; } $included_caps = array($capability->id); $loopcap = clone($capability); while (!empty($loopcap->dependson)) { $parentcap = $this->capability_model->get($loopcap->dependson); $loopcap = clone($parentcap); $included_caps[] = $loopcap->id; } $this->db->distinct(); $this->db->select('users.*'); $this->db->join('users_roles', 'users.id = users_roles.user_id'); $this->db->join('roles_capabilities', 'roles_capabilities.role_id = users_roles.role_id'); $this->db->join('capabilities', 'capabilities.id = roles_capabilities.capability_id'); $this->db->where_in('capabilities.id', $included_caps); $this->db->order_by('surname'); if (!empty($where_conditions)) { $this->db->where($where_conditions); } if (!empty($blacklist)) { $this->db->where_not_in('capabilities.name', $blacklist); } return $this->user_model->get(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function get_capabilities() {\n global $DB;\n\n $sort = 'ORDER BY contextlevel,component,name'; // To group them sensibly for display\n\n $params = array();\n $sql = \"SELECT *\n FROM {capabilities}\n WHERE contextlevel IN (\".CONTEXT_UNIVERSITY.\",\".CONTEXT_FACULTY.\")\";\n\n return $DB->get_records_sql($sql.' '.$sort, $params);\n }", "function tc_admin_users_caps( $caps, $cap, $user_id, $args ){\n \n foreach( $caps as $key => $capability ){\n \n if( $capability != 'do_not_allow' )\n continue;\n \n switch( $cap ) {\n case 'edit_user':\n case 'edit_users':\n $caps[$key] = 'edit_users';\n break;\n case 'delete_user':\n case 'delete_users':\n $caps[$key] = 'delete_users';\n break;\n case 'create_users':\n $caps[$key] = $cap;\n break;\n }\n }\n \n return $caps;\n}", "public static function getAllCapabilities() {\n static $caps = array();\n \n if (empty($caps)) {\n foreach (self::getRoles()->role_objects as $role) {\n if (is_array($role->capabilities)) {\n $caps = array_merge($caps, $role->capabilities);\n }\n }\n }\n \n return $caps;\n }", "function mc_admin_users_caps( $caps, $cap, $user_id, $args ){\n\n\tforeach( $caps as $key => $capability ){\n\n\t\t\n\t\tif( $capability != 'do_not_allow' )\n\t\t\tcontinue;\n\n\t\tswitch( $cap ) {\n\t\t\tcase 'edit_user':\n\t\t\tcase 'edit_users':\n\t\t\t\t$caps[$key] = 'edit_users';\n\t\t\t\tbreak;\n\t\t\tcase 'delete_user':\n\t\t\tcase 'delete_users':\n\t\t\t\t$caps[$key] = 'delete_users';\n\t\t\t\tbreak;\n\t\t\tcase 'create_users':\n\t\t\t\t$caps[$key] = $cap;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn $caps;\n}", "function get_capability($cap)\n {\n return $this->conn->getCapability(strtoupper($cap));\n }", "function bbp_get_caps_for_role($role = '')\n{\n}", "public function get_capabilities() {\n global $DB;\n\n $sort = 'ORDER BY contextlevel,component,name'; // To group them sensibly for display\n\n $params = array();\n $sql = \"SELECT * FROM {capabilities}\n WHERE contextlevel IN (\".CONTEXT_FACULTY.\",\".CONTEXT_SUBDEPARTMENT.\",\".CONTEXT_ACADEMYGROUP.\")\";\n\n return $DB->get_records_sql($sql.' '.$sort, $params);\n }", "function qa_get_user_caps() {\n\tglobal $user_ID;\n\t$cap\t=\tarray ();\n\tif( $user_ID ) {\n\t\t$privileges\t=\tqa_get_privileges();\n\t\t$user_point\t=\tqa_get_user_point($user_ID);\n\t\n\t\tforeach ( $privileges as $privi => $point ) {\n\t\t\tif( $point > $user_point && !current_user_can( 'manage_options' ) ) continue;\n\t\t\t$cap[$privi]\t=\ttrue;\n\t\t}\n\n\t\tif( current_user_can('manage_options') /*|| $privileges->edit_qa < $user_point */) {\n\t\t\t$cap['edit']\t=\ttrue;\n\t\t}\n\t}\n\n\treturn $cap;\n}", "function user_cap_filter( $user_caps, $required_caps, $args ) {\n\t\tif ( 'switch_to_user' == $args[0] )\n\t\t\t$user_caps['switch_to_user'] = ( current_user_can( 'edit_user', $args[2] ) and ( $args[2] != $args[1] ) );\n\t\telse if ( 'switch_off' == $args[0] )\n\t\t\t$user_caps['switch_off'] = ( current_user_can( 'edit_users' ) and !$this->get_old_user() );\n\t\treturn $user_caps;\n\t}", "public function get_capabilities() {\n global $DB;\n\n $sort = 'ORDER BY contextlevel,component,name'; // To group them sensibly for display\n\n $params = array();\n $sql = \"SELECT * FROM {capabilities}\n WHERE contextlevel IN (\".CONTEXT_DISSERSOVET.\")\";\n\n return $DB->get_records_sql($sql.' '.$sort, $params);\n }", "public function get_upstream_user_caps()\n {\n $capabilities['project'] = [\n 'edit_project',\n 'read_project',\n 'edit_projects',\n // 'edit_others_projects',\n // 'read_private_projects',\n // 'edit_private_projects',\n 'edit_published_projects',\n\n // === TERMS ===\n 'assign_project_terms',\n 'manage_project_terms',\n //'edit_project_terms',\n //'delete_project_terms',\n\n /*\n * Individual project fields.\n * Giving the role access to these fields, means that\n * they can edit OTHER users tasks, bugs, milestones\n * but only the fields added to their capabilities.\n * And this will only work in the WP admin.\n */\n 'project_title_field',\n 'project_status_field',\n 'project_owner_field',\n 'project_client_field',\n 'project_users_field',\n 'project_start_date_field',\n 'project_end_date_field',\n // \"project_description_field\",\n\n 'edit_milestone',\n 'read_milestone',\n 'edit_milestones',\n 'edit_others_milestones',\n 'read_private_milestones',\n 'edit_private_milestones',\n // individual milestone fields\n 'milestone_milestone_field',\n 'milestone_assigned_to_field',\n 'milestone_start_date_field',\n 'milestone_end_date_field',\n 'milestone_notes_field',\n\n // individual task fields\n 'task_title_field',\n 'task_assigned_to_field',\n 'task_status_field',\n 'task_progress_field',\n 'task_start_date_field',\n 'task_end_date_field',\n 'task_notes_field',\n 'task_milestone_field',\n\n // individual bug fields\n 'bug_title_field',\n 'bug_assigned_to_field',\n 'bug_description_field',\n 'bug_status_field',\n 'bug_severity_field',\n 'bug_files_field',\n 'bug_due_date_field',\n\n // Publish project items\n 'publish_project_milestones', // enables the 'Add Milestone' button within project\n 'publish_project_tasks', // enables the 'Add Task' button within project\n 'publish_project_bugs', // enables the 'Add Bug' button within project\n 'publish_project_files', // enables the 'Add Files' button within project\n 'publish_project_discussion',\n 'delete_project_discussion',\n\n //'delete_project_milestones',\n //'delete_project_tasks',\n //'delete_project_bugs',\n //'delete_project_files',\n\n //'sort_project_milestones',\n //'sort_project_tasks',\n //'sort_project_bugs',\n //'sort_project_files',\n\n ];\n\n $capabilities['client'] = [\n 'edit_client',\n 'read_client',\n 'edit_clients',\n 'edit_others_clients',\n 'publish_clients',\n // 'read_private_clients',\n // 'edit_private_clients',\n 'edit_published_clients',\n ];\n\n return $capabilities;\n }", "public function get_capabilities($user_id, $all_caps=array()) {\n $caps = array();\n\n\n $this->benchmark->mark('get_capabilities_query_start');\n $this->db->select('capabilities.*')->from('capabilities')->join('roles_capabilities', 'capabilities.id = capability_id')->join('roles', 'roles.id = role_id');\n $this->db->join('users_roles', 'users_roles.role_id = roles.id');\n $this->db->where('users_roles.user_id', $user_id);\n $query = $this->db->get();\n $this->benchmark->mark('get_capabilities_query_end');\n\n $this->benchmark->mark('get_dependents_start');\n if (empty($all_caps)) {\n $all_caps = $this->capability_model->get();\n }\n if ($query->num_rows() > 0) {\n foreach ($query->result() as $row) {\n $caps[$row->id] = $row;\n $caps_to_check = $caps;\n $this->capability_model->get_dependents($row->id, $caps, $caps_to_check, true, $all_caps);\n }\n }\n $this->benchmark->mark('get_dependents_end');\n\n return $caps;\n }", "public function get_capabilities() {\n global $DB;\n\n $sort = 'ORDER BY contextlevel,component,name'; // To group them sensibly for display\n\n $params = array();\n $sql = \"SELECT * FROM {capabilities}\n WHERE contextlevel IN (\".CONTEXT_BUILDING.\",\".CONTEXT_ROOM.\")\";\n\n return $DB->get_records_sql($sql.' '.$sort, $params);\n }", "public static function check_for_cap($cap, $user = null) {\r\n\r\n //if no user is passed in then check the default role\r\n if (!is_array($cap)) {\r\n $cap = array($cap);\r\n }\r\n\r\n if (empty($user)) {\r\n $default_role = Kohana::config('acl.default_role');\r\n foreach ($cap as $capability) {\r\n if (!self::check_role_for_cap($capability, $default_role)) {\r\n return FALSE;\r\n }\r\n }\r\n return TRUE;\r\n } else {\r\n\r\n $result = TRUE;\r\n\r\n //first check the user directly\r\n foreach ($cap as $capability) {\r\n if (!self::check_user_for_cap($capability, $user)) {\r\n $result = FALSE;\r\n }\r\n }\r\n\r\n if (TRUE === $result) {\r\n return TRUE;\r\n }\r\n\r\n //Jx_Debug::dump(null, 'not on user');\r\n $result = TRUE;\r\n //didn't find it on the user so check their roles\r\n foreach ($user->roles as $role) {\r\n if (!self::check_role_for_cap($cap,$role)) {\r\n $result = FALSE;\r\n }\r\n }\r\n\r\n //Jx_Debug::dump($result, 'result of check on roles');\r\n return $result;\r\n }\r\n\r\n }", "public function get_capabilities() {\n global $DB;\n\n $sort = 'ORDER BY contextlevel,component,name'; // To group them sensibly for display\n\n $params = array();\n $sql = \"SELECT * FROM {capabilities}\n WHERE contextlevel IN (\".CONTEXT_AREA.\",\".CONTEXT_BUILDING.\",\".CONTEXT_ROOM.\")\";\n\n return $DB->get_records_sql($sql.' '.$sort, $params);\n }", "function current_member_can( $capability ) {\n\t$current_member = mpt_get_current_member();\n\tif ( empty( $current_member ) ) {\n\t\treturn false;\n\t}\n\t\n\t$args = array_slice( func_get_args(), 1 );\n\t$args = array_merge( array( $capability ), $args );\n\n\treturn call_user_func_array( array( $current_member, 'has_cap' ), $args );\n}", "private function _current_user_can($cap = '', $args = array())\r\n\t{\r\n\t\tglobal $bb_current_user;\r\n\r\n\t\t$retvalue = false;\r\n\r\n\t\t// if a logged-in user, then we'll do what bb_current_user_can() would do\r\n\t\tif ( ! empty($bb_current_user) ) {\r\n\t\t\t$retvalue = call_user_func_array(array(&$bb_current_user, 'has_cap'), array_merge(array($cap), $args));\r\n\t\t// not logged in, which is what we're interested in\r\n\t\t} else {\r\nreturn false;\r\n\t\t\t// let's whitelist capabilities of an anonymous user\r\n\t\t\tswitch( $cap ) {\r\n\t\t\t\tcase 'write_post' :\r\n\t\t\t\tcase 'write_posts' :\r\n\t\t\t\tcase 'write_topic' :\r\n\t\t\t\tcase 'write_topics' :\r\n\t\t\t\t\t$retvalue = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn $retvalue;\r\n\t}", "public function getExtendedPolicy($capability, PhabricatorUser $viewer) {\n switch ($capability) {\n case PhabricatorPolicyCapability::CAN_EDIT:\n if ($this->getService()->isClusterService()) {\n return array(\n array(\n new PhabricatorAlmanacApplication(),\n AlmanacManageClusterServicesCapability::CAPABILITY,\n ),\n );\n }\n break;\n }\n\n return array();\n }", "public static function capabilities( $capabilities ) \r\n\t{\r\n\t\t$capabilities['MailPress_tracking_mails'] = array( \t'name' \t=> __( 'View tracking', 'MailPress' ), \r\n \t\t\t\t\t\t\t\t\t'group' \t=> 'mails'\r\n \t\t\t\t\t\t\t\t );\r\n\t\t$capabilities['MailPress_tracking_users'] = array( \t'name' \t=> __( 'View tracking', 'MailPress' ), \r\n \t\t\t\t\t\t\t\t\t'group' \t=> 'users'\r\n \t\t\t\t\t\t\t\t );\r\n\t\treturn $capabilities;\r\n\t}", "public function user_has_cap( $allcaps, $caps, $args ) {\n\t\tglobal $pagenow, $typenow;\n\n\t\tif ( isset( $caps[0] ) ) {\n\n\t\t\tswitch ( $caps[0] ) {\n\n\t\t\t\tcase 'wc_memberships_access_all_restricted_content':\n\n\t\t\t\t\tif ( $this->can_manage_woocommerce( $allcaps ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\t\tcase 'wc_memberships_view_restricted_post_content' :\n\n\t\t\t\t\tif ( $this->can_manage_woocommerce( $allcaps ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$user_id = $args[1];\n\t\t\t\t\t$post_id = $args[2];\n\n\t\t\t\t\tif ( $this->post_is_public( $post_id ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$rules = wc_memberships()->get_rules_instance()->get_post_content_restriction_rules( $post_id );\n\t\t\t\t\t$allcaps[ $caps[0] ] = wc_memberships()->get_rules_instance()->user_has_content_access_from_rules( $user_id, $rules, $post_id );\n\n\t\t\t\tbreak;\n\n\t\t\t\tcase 'wc_memberships_view_restricted_product' :\n\n\t\t\t\t\tif ( $this->can_manage_woocommerce( $allcaps ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$user_id = $args[1];\n\t\t\t\t\t$post_id = $args[2];\n\n\t\t\t\t\tif ( $this->post_is_public( $post_id ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$rules = wc_memberships()->get_rules_instance()->get_the_product_restriction_rules( $post_id );\n\t\t\t\t\t$allcaps[ $caps[0] ] = wc_memberships()->get_rules_instance()->user_has_product_view_access_from_rules( $user_id, $rules, $post_id );\n\n\t\t\t\tbreak;\n\n\t\t\t\tcase 'wc_memberships_purchase_restricted_product' :\n\n\t\t\t\t\tif ( $this->can_manage_woocommerce( $allcaps ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$user_id = $args[1];\n\t\t\t\t\t$post_id = $args[2];\n\n\t\t\t\t\tif ( $this->post_is_public( $post_id ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$rules = wc_memberships()->get_rules_instance()->get_the_product_restriction_rules( $post_id );\n\t\t\t\t\t$allcaps[ $caps[0] ] = wc_memberships()->get_rules_instance()->user_has_product_purchase_access_from_rules( $user_id, $rules, $post_id );\n\n\t\t\t\tbreak;\n\n\t\t\t\tcase 'wc_memberships_view_restricted_product_taxonomy_term':\n\n\t\t\t\t\tif ( $this->can_manage_woocommerce( $allcaps ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$user_id = $args[1];\n\t\t\t\t\t$taxonomy = $args[2];\n\t\t\t\t\t$term_id = $args[3];\n\n\t\t\t\t\t$rules = wc_memberships()->get_rules_instance()->get_taxonomy_term_product_restriction_rules( $taxonomy, $term_id );\n\t\t\t\t\t$allcaps[ $caps[0] ] = wc_memberships()->get_rules_instance()->user_has_content_access_from_rules( $user_id, $rules, $term_id );\n\n\t\t\t\tbreak;\n\n\t\t\t\tcase 'wc_memberships_view_delayed_product_taxonomy_term';\n\n\t\t\t\t\tif ( $this->can_manage_woocommerce( $allcaps ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$user_id = $args[1];\n\t\t\t\t\t$taxonomy = $args[2];\n\t\t\t\t\t$term = $args[3];\n\t\t\t\t\t$has_access = false;\n\n\t\t\t\t\t$access_time = $this->get_user_access_start_time_for_taxonomy_term( $user_id, $taxonomy, $term );\n\n\t\t\t\t\tif ( $access_time && current_time( 'timestamp', true ) >= $access_time ) {\n\t\t\t\t\t\t$has_access = true;\n\t\t\t\t\t}\n\n\t\t\t\t\t$allcaps[ $caps[0] ] = $has_access;\n\n\t\t\t\tbreak;\n\n\t\t\t\tcase 'wc_memberships_view_restricted_taxonomy_term' :\n\n\t\t\t\t\tif ( $this->can_manage_woocommerce( $allcaps ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$user_id = $args[1];\n\t\t\t\t\t$taxonomy = $args[2];\n\t\t\t\t\t$term_id = $args[3];\n\n\t\t\t\t\t$rules = wc_memberships()->get_rules_instance()->get_taxonomy_term_content_restriction_rules( $taxonomy, $term_id );\n\t\t\t\t\t$allcaps[ $caps[0] ] = wc_memberships()->get_rules_instance()->user_has_content_access_from_rules( $user_id, $rules, $term_id );\n\n\t\t\t\tbreak;\n\n\t\t\t\tcase 'wc_memberships_view_restricted_taxonomy' :\n\n\t\t\t\t\tif ( $this->can_manage_woocommerce( $allcaps ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$user_id = $args[1];\n\t\t\t\t\t$taxonomy = $args[2];\n\n\t\t\t\t\t$rules = wc_memberships()->get_rules_instance()->get_taxonomy_content_restriction_rules( $taxonomy );\n\t\t\t\t\t$allcaps[ $caps[0] ] = wc_memberships()->get_rules_instance()->user_has_content_access_from_rules( $user_id, $rules );\n\n\t\t\t\tbreak;\n\n\t\t\t\tcase 'wc_memberships_view_restricted_post_type' :\n\n\t\t\t\t\tif ( $this->can_manage_woocommerce( $allcaps ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$user_id = $args[1];\n\t\t\t\t\t$post_type = $args[2];\n\n\t\t\t\t\tif ( in_array( $post_type, array( 'product', 'product_variation' ) ) ) {\n\n\t\t\t\t\t\t$rules = wc_memberships()->get_rules_instance()->get_product_restriction_rules( array(\n\t\t\t\t\t\t\t'content_type' => 'post_type',\n\t\t\t\t\t\t\t'content_type_name' => 'product',\n\t\t\t\t\t\t) );\n\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = wc_memberships()->get_rules_instance()->user_has_product_view_access_from_rules( $user_id, $rules );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t$rules = wc_memberships()->get_rules_instance()->get_post_type_content_restriction_rules( $post_type );\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = wc_memberships()->get_rules_instance()->user_has_content_access_from_rules( $user_id, $rules );\n\t\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\t\tcase 'wc_memberships_view_delayed_post_type';\n\n\t\t\t\t\tif ( $this->can_manage_woocommerce( $allcaps ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$user_id = $args[1];\n\t\t\t\t\t$post_type = $args[2];\n\t\t\t\t\t$has_access = false;\n\n\t\t\t\t\t$access_time = $this->get_user_access_start_time_for_post_type( $user_id, $post_type );\n\n\t\t\t\t\tif ( $access_time && current_time( 'timestamp', true ) >= $access_time ) {\n\t\t\t\t\t\t$has_access = true;\n\t\t\t\t\t}\n\n\t\t\t\t\t$allcaps[ $caps[0] ] = $has_access;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'wc_memberships_view_delayed_taxonomy';\n\n\t\t\t\t\tif ( $this->can_manage_woocommerce( $allcaps ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$user_id = $args[1];\n\t\t\t\t\t$taxonomy = $args[2];\n\t\t\t\t\t$has_access = false;\n\n\t\t\t\t\t$access_time = $this->get_user_access_start_time_for_taxonomy( $user_id, $taxonomy );\n\n\t\t\t\t\tif ( $access_time && current_time( 'timestamp', true ) >= $access_time ) {\n\t\t\t\t\t\t$has_access = true;\n\t\t\t\t\t}\n\n\t\t\t\t\t$allcaps[ $caps[0] ] = $has_access;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'wc_memberships_view_delayed_taxonomy_term';\n\n\t\t\t\t\tif ( $this->can_manage_woocommerce( $allcaps ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$user_id = $args[1];\n\t\t\t\t\t$taxonomy = $args[2];\n\t\t\t\t\t$term = $args[3];\n\t\t\t\t\t$has_access = false;\n\n\t\t\t\t\t$access_time = $this->get_user_access_start_time_for_taxonomy_term( $user_id, $taxonomy, $term );\n\n\t\t\t\t\tif ( $access_time && current_time( 'timestamp', true ) >= $access_time ) {\n\t\t\t\t\t\t$has_access = true;\n\t\t\t\t\t}\n\n\t\t\t\t\t$allcaps[ $caps[0] ] = $has_access;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'wc_memberships_view_delayed_post_content' :\n\t\t\t\tcase 'wc_memberships_view_delayed_product' :\n\n\t\t\t\t\tif ( $this->can_manage_woocommerce( $allcaps ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$user_id = $args[1];\n\t\t\t\t\t$post_id = $args[2];\n\t\t\t\t\t$has_access = false;\n\n\t\t\t\t\tif ( $this->post_is_public( $post_id ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$access_time = $this->get_user_access_start_time_for_post( $user_id, $post_id, 'view' );\n\n\t\t\t\t\tif ( $access_time && current_time( 'timestamp', true ) >= $access_time ) {\n\t\t\t\t\t\t$has_access = true;\n\t\t\t\t\t}\n\n\t\t\t\t\t$allcaps[ $caps[0] ] = $has_access;\n\n\t\t\t\tbreak;\n\n\t\t\t\tcase 'wc_memberships_purchase_delayed_product' :\n\n\t\t\t\t\tif ( $this->can_manage_woocommerce( $allcaps ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$user_id = $args[1];\n\t\t\t\t\t$post_id = $args[2];\n\t\t\t\t\t$has_access = false;\n\n\t\t\t\t\tif ( $this->post_is_public( $post_id ) ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$access_time = $this->get_user_access_start_time_for_post( $user_id, $post_id, 'purchase' );\n\n\t\t\t\t\tif ( $access_time && current_time( 'timestamp', true ) >= $access_time ) {\n\t\t\t\t\t\t$has_access = true;\n\t\t\t\t\t}\n\n\t\t\t\t\t$allcaps[ $caps[0] ] = $has_access;\n\n\t\t\t\tbreak;\n\n\t\t\t\t// Editing a rule depends on the rule's content type and related capabilities\n\t\t\t\tcase 'wc_memberships_edit_rule' :\n\n\t\t\t\t\t$user_id = $args[1];\n\t\t\t\t\t$rule_id = $args[2];\n\t\t\t\t\t$can_edit = false;\n\n\t\t\t\t\t$rule = wc_memberships()->get_rules_instance()->get_rule( $rule_id );\n\n\t\t\t\t\tif ( $rule ) {\n\n\t\t\t\t\t\tswitch ( $rule->get_content_type() ) {\n\n\t\t\t\t\t\t\tcase 'post_type':\n\n\t\t\t\t\t\t\t\t$post_type = get_post_type_object( $rule->get_content_type_name() );\n\n\t\t\t\t\t\t\t\tif ( ! $post_type ) {\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t$can_edit = current_user_can( $post_type->cap->edit_posts ) && current_user_can( $post_type->cap->edit_others_posts );\n\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 'taxonomy':\n\n\t\t\t\t\t\t\t\t$taxonomy = get_taxonomy( $rule->get_content_type_name() );\n\n\t\t\t\t\t\t\t\tif ( ! $taxonomy ) {\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t$can_edit = current_user_can( $taxonomy->cap->manage_terms ) && current_user_can( $taxonomy->cap->edit_terms );\n\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\t$allcaps[ $caps[0] ] = $can_edit;\n\n\t\t\t\tbreak;\n\n\t\t\t\tcase 'wc_memberships_cancel_membership' :\n\t\t\t\tcase 'wc_memberships_renew_membership' :\n\n\t\t\t\t\t$user_id = $args[1];\n\t\t\t\t\t$user_membership_id = $args[2];\n\n\t\t\t\t\t$user_membership = wc_memberships_get_user_membership( $user_membership_id );\n\n\t\t\t\t\t// complimentary memberships cannot be cancelled or renewed by the user\n\t\t\t\t\t$allcaps[ $caps[0] ] = $user_membership && $user_membership->get_user_id() == $user_id && ! $user_membership->has_status( 'complimentary' );\n\n\t\t\t\tbreak;\n\n\t\t\t\t// Prevent deleting membership plans with active memberships\n\t\t\t\tcase 'delete_published_membership_plan' :\n\t\t\t\tcase 'delete_published_membership_plans' :\n\n\t\t\t\t\t// This workaround (*hack*, *cough*) allows displaying the trash/delete\n\t\t\t\t\t// link on membership plans list table even if the plan has active members\n\t\t\t\t\tif ( is_admin() && 'edit.php' == $pagenow && 'wc_membership_plan' == $typenow && empty( $_POST ) ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$post_id = $args[2];\n\n\t\t\t\t\t$plan = wc_memberships_get_membership_plan( $post_id );\n\n\t\t\t\t\tif ( $plan->has_active_memberships() ) {\n\t\t\t\t\t\t$allcaps[ $caps[0] ] = false;\n\t\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\t\t}\n\n\t\treturn $allcaps;\n\t}", "public function getCapabilities();", "public function getCapabilities();", "function helpdesk_is_capable($capability=null, $require=false, $user=null) {\n\n if (empty($user)) {\n global $USER;\n $user = $USER;\n }\n\n if (is_numeric($user)) {\n\t$user = get_record('user', 'id', $user);\n }\n\n $context = get_context_instance(CONTEXT_SYSTEM);\n if (empty($capability)) {\n // When returning which capability applies for the user, we can't\n // require this. The type that is returned is *mixed*.\n\n if ($require !== false) {\n notify(get_string('warning_getandrequire', 'block_helpdesk'));\n }\n\n\t// Order here does matter.\n\t$rval = false;\n $cap = has_capability(HELPDESK_CAP_ASK, $context, $user->id);\n if ($cap) {\n $rval = HELPDESK_CAP_ASK;\n }\n $cap = has_capability(HELPDESK_CAP_ANSWER, $context, $user->id);\n if ($cap) {\n $rval = HELPDESK_CAP_ANSWER;\n }\n return $rval;\n }\n\n if ($require) {\n require_capability($capability, $context, $user->id);\n return true;\n }\n return has_capability($capability, $context, $user->id);\n}", "public function filter_user_has_cap( $user_caps, $required_caps, $args ) {\n\n\t\tif ( 'view_woozonelite_debug_bar' !== $args[0] ) {\n\t\t\treturn $user_caps;\n\t\t}\n\t\tif ( ! is_multisite() && user_can( $args[1], 'manage_options' ) ) {\n\t\t\t$user_caps['view_woozonelite_debug_bar'] = true;\n\t\t}\n\t\treturn $user_caps;\n\t}", "public function getUserCapabilities(string $userId): array\n {\n if (empty($this->userCapabilities)) {\n $this->userCapabilities = Utils::fetchUserCapabilities($userId);\n }\n\n return $this->userCapabilities;\n }", "public function hasAnyCapability(array $capabilityName);", "public function get_capabilities() {\n global $DB;\n\n $sort = 'ORDER BY contextlevel,component,name'; // To group them sensibly for display\n\n $params = array();\n $sql = \"SELECT * FROM {capabilities}\n WHERE contextlevel IN (\".CONTEXT_SUBDEPARTMENT.\")\";\n\n return $DB->get_records_sql($sql.' '.$sort, $params);\n }", "public function getCapabilities()\n {\n $this->writeLog('getCapabilities()');\n return $this->capabilities;\n }", "public function getCapabilities() {\n return $this->capabilities;\n }", "function map_meta_cap( $required_caps, $cap, $user_id, $args ) {\n\t\tif ( ( 'switch_to_user' == $cap ) and ( $args[0] == $user_id ) )\n\t\t\t$required_caps[] = 'do_not_allow';\n\t\telse if ( ( 'switch_off' == $cap ) and ( $this->get_old_user() ) )\n\t\t\t$required_caps[] = 'do_not_allow';\n\t\treturn $required_caps;\n\t}" ]
[ "0.59057415", "0.5845246", "0.5821557", "0.5756517", "0.57167655", "0.567332", "0.5632082", "0.56043863", "0.5588409", "0.55484945", "0.5493826", "0.5484563", "0.5463299", "0.5459552", "0.5453398", "0.54325795", "0.5418333", "0.5361347", "0.53528935", "0.53454137", "0.5343124", "0.5343124", "0.5333935", "0.53067106", "0.5289961", "0.5286074", "0.52734655", "0.5264502", "0.52487105", "0.52417743" ]
0.71745807
0
Returns an array of all roles not yet assigned to a given user
function get_available_roles($user_id) { $this->load->model('users/role_model'); // Get roles assigned to this user $query = $this->db->from('roles')->where("id NOT IN (SELECT role_id FROM users_roles WHERE user_id = $user_id)", null, false)->get(); $available_roles = array(); foreach ($query->result() as $row) { $available_roles[] = $row; } return $available_roles; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getAssignedRoles($user = null)\n\t{\n\t\t// if we don't have a user, get the logged-in user\n\t\tif ( ! $user and ! $user = $this->manager->getUserId())\n\t\t{\n\t\t\tthrow new AuthException('Unable to get the assigned roles. There is no user logged in.');\n\t\t}\n\n\t\t// fetch the list of role id/name combo's\n\t\t$roles = array();\n\n\t\tforeach ($this->data as $role)\n\t\t{\n\t\t\tif (isset($role['__users__']) and in_array($user, $role['__users__']))\n\t\t\t{\n\t\t\t\t$roles[$role['id']] = $role['name'];\n\t\t\t}\n\t\t}\n\n\t\treturn $roles;\n\t}", "function get_not_my_courses_by_role($userid, $roleid, $sortorder='c.sortorder',\n $fields='c.id, c.fullname, x.id AS contextid', $contextlevel='50') {\n \n global $CFG, $DB;\n $notmyrolecourses = array();\n \n $rs = $DB->get_recordset_sql(\"\n SELECT $fields\n FROM {$CFG->prefix}context x\n INNER JOIN {$CFG->prefix}course c ON x.instanceid = c.id AND x.contextlevel = $contextlevel\n WHERE x.instanceid NOT IN \n (SELECT x.instanceid\n FROM {$CFG->prefix}role_assignments ra\n INNER JOIN {$CFG->prefix}context x ON x.id = ra.contextid AND x.contextlevel = $contextlevel\n WHERE ra.roleid = $roleid AND ra.userid = $userid)\n ORDER BY $sortorder\");\n \n if ($rs && count($rs) > 0) {\n foreach ($rs as $course) {\n if ($course->id != SITEID) {\n $notmyrolecourses[$course->id] = $course;\n }\n }\n }\n \n $rs->close();\n \n return $notmyrolecourses;\n}", "public function getRoles(): array\n {\n $roles = $this->roles;\n // guarantees that a user always has at least one role for security\n if (empty($roles)) {\n $roles[] = 'ROLE_USER';\n }\n return array_unique($roles);\n }", "public function getRoles(): array\n {\n $roles = $this->roles;\n\n // guarantees that a user always has at least one role for security\n if (empty($roles)) {\n $roles[] = 'ROLE_USER';\n }\n\n return array_unique($roles);\n }", "public function getRoles(): array\n {\n $roles = $this->roles;\n\n // guarantees that a user always has at least one role for security\n if (empty($roles)) {\n $roles[] = 'ROLE_USER';\n }\n\n return array_unique($roles);\n }", "public function getRoles(): array\n {\n $roles = $this->roles;\n\n // guarantees that a user always has at least one role for security\n if (empty($roles)) {\n $roles[] = 'ROLE_USER';\n }\n\n return array_unique($roles);\n }", "public function getRoles():array\n {\n $roles = $this->roles;\n\n $role[] = 'ROLE_USER';\n\n return array_unique($roles);\n\n }", "public function getRoles()\n {\n $roles = $this->roles;\n // guarantees that a user always has at least one role for security\n if (empty($roles)) {\n $roles[] = 'ROLE_USER';\n }\n return array_unique($roles);\n }", "public function getUserRoles($user)\n {\n return $user->roles()->pluck('name')->toArray();\n }", "function getNonAdminRoles()\r\n {\r\n return $this->getRecords(\"SELECT * FROM roles WHERE RoleID NOT IN (1, 2, 9, 11) ORDER BY Title\");\r\n }", "private function get_excluded_roles() {\n\t\t$roles = WordPress::get_roles();\n\t\tunset( $roles['administrator'], $roles['editor'], $roles['author'] );\n\n\t\treturn $roles;\n\t}", "protected function get_user_roles() : array\n\t{\n\t\t$roles = ci()->user->roles();\n\n\t\t/* we must return something for the in clause or every record will match which is not what we want */\n\t\t$keys = [-1];\n\n\t\tif (is_array($roles)) {\n\t\t\tif (count($roles) > 0) {\n\t\t\t\t$keys = array_keys($roles);\n\t\t\t}\n\t\t}\n\n\t\treturn $keys;\n\t}", "public function userRoles()\n {\n return array_map(function ($item) {\n return $item[\"name\"];\n }, $this->db\n ->select(\"roles.*\")\n ->from(\"roles\")\n ->join(\"roles_users\", \"roles.id = roles_users.role_id\", \"inner\")\n ->where(array(\"roles_users.user_id\" => $this->userID(),\"roles.status\" => 1, \"deleted_at\" => null))\n ->get()->result_array());\n }", "public function getEffectiveRolesForUser($user)\n {\n if (isset($user['roles']) && is_array($user['roles'])) {\n $userRoles = $user['roles'];\n $userRoles[] = self::ROLE_EVERYONE;\n } else {\n $userRoles = [];\n }\n $userRoles[] = self::ROLE_ANONYMOUS;\n\n return $userRoles;\n }", "public static function pc_user_roles(){\n\t \n\t global $wp_roles;\n\t\t\n\t\t$all_roles = $wp_roles->roles;\n\t\t$user_roles = [];\n\n\t if(!empty($all_roles)){\n\t foreach($all_roles as $key => $value){\n\t $user_roles[$key] = $all_roles[$key]['name'];\n\t }\n\t }\n\n\t return $user_roles;\n\t}", "public static function roles() {\n\t\t$roles = AuthComponent::user(USER_ROLE_KEY);\n\t\tif (!is_array($roles)) {\n\t\t\treturn $roles;\n\t\t}\n\t\tif (isset($roles[0]['id'])) {\n\t\t\t$roles = Hash::extract($roles, '{n}.id');\n\t\t}\n\t\treturn $roles;\n\t}", "public function getUserRoles();", "public function getUserRoles()\n {\n return $this->user_roles;\n }", "public function getRoles()\n {\n return array_unique($this->roles);\n }", "public static function getUserRoles() {\n\t\treturn array(\n\t\t\tself::ROLE_ADMINISTRATOR => 'Administrator',\n\t\t\tself::ROLE_OPERATOR => 'Operator',\n\t\t\tself::ROLE_USER => 'User',\n\t\t);\n\t}", "public function getUserRoles()\n\t{\n\t\t$query = $this->db_con->query(\"SELECT * FROM user_roles\");\n\t\t$result = array();\n \t\twhile ($row=$query->fetch_assoc()){\n \t\t\t$result[] = $row;\n \t\t}\n \t\treturn $result;\n\t}", "public function rolesNotAssigned($roles)\n {\n $rolesAll = Role::all();\n $notAssigned = $rolesAll->diff($roles);\n return $notAssigned->all();\n }", "function getUserRoles(){\r\n $roles = array();\r\n $criteria=new CDbCriteria;\r\n $criteria->condition='userid=:id';\r\n $criteria->params=array(':id'=>Yii::app()->user->id);\r\n $Rol = Sysroleassignments::model()->findAll($criteria);\r\n $indexArray = 0;\r\n foreach ($Rol as $item){\r\n $roles[$indexArray++] = $item->itemname;\r\n }\r\n return $roles;\r\n }", "public function getUserRoles()\n {\n return $this->userRoles;\n }", "public function getUserRoles()\n {\n return $this->userRoles;\n }", "public function getUserRoles(): ?array {\n\t\tif($user = $this->getUser()) {\n\t\t\tif(!isset($this->cachedUserRoles[$user->getUsername()]) || NULL === $this->cachedUserRoles[$user->getUsername()]) {\n\t\t\t\t$this->cachedUserRoles[$user->getUsername()] = array_map(function($r) {if($r instanceof RoleInterface){return$r->getRole();}else{return(string)$r;}}, $user->getRoles());\n\t\t\t\t$this->userRoleCache[$user->getUsername()] = [];\n\t\t\t}\n\t\t\treturn $this->cachedUserRoles[$user->getUsername()];\n\t\t}\n\t\treturn NULL;\n\t}", "public function getRoles(\\Security\\User $user)\n {\n return array('ROLE_ADMIN');\n }", "public function getRoles()\n {\n $role = $this->userRole->map(function($role){\n return $role->getTitle();\n })->toArray();\n $role[] = 'ROLE_USER';\n return $role;\n }", "public function getUserRoles() : ?array\n {\n return $this->userRoles;\n }", "public function getRoles()\n {\n\n if(!$this->roles)\n return array();\n\n// if(!in_array('ROLES_USER',$this->roles)){\n// $this->roles[]='ROLES_USER';\n// }\n\n return $this->roles;\n\n }" ]
[ "0.70447046", "0.68349576", "0.6792253", "0.67675734", "0.67675734", "0.67675734", "0.6737609", "0.67123556", "0.66801906", "0.66252375", "0.658415", "0.65828043", "0.65278864", "0.65224046", "0.65212035", "0.64592713", "0.6436037", "0.6424603", "0.64015883", "0.6381448", "0.6376934", "0.6376292", "0.63719803", "0.6351664", "0.6351664", "0.6345002", "0.63432807", "0.63367563", "0.63327926", "0.6328013" ]
0.71271336
0
Should sign with the client credentials.
public function shouldSignWithClientCredentials() { return $this->signer->isKeyBased(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function Auth() {\n // default cert and sign for OTA Server\n /*$sign = 'MEQCID7ixhzSsoZHK5A23QYQ+IqEB+JuekupuuOjNAWSjZo4AiBbdLfbjpsjZ3aU/fpBHoIrrkatohNSrWJPZh3kSPmWIg==';\n $cert = 'MIIDJzCCAsygAwIBAgIJALWcScNmfs+NMAoGCCqGSM49BAMCMIHXMQswCQYDVQQGEwJDTjEQMA4GA1UECAwHSmlhbmdzdTEQMA4GA1UEBwwHTmFuamluZzEsMCoGA1UECgwjSHVhd2VpIFNvZnR3YXJlIFRlY2hub2xvZ2llcyBDTy5MdGQxQTA/BgNVBAsMOERldmllIFJlZ2lvbiBEZWxpdmVyeSAmIFNlcnZpY2UgUXVhbGl0eSAmIE9wZXJhdGlvbiBEZXB0MRQwEgYDVQQDDAtPVEEgUm9vdCBDQTEdMBsGCSqGSIb3DQEJARYOb3RhQGh1YXdlaS5jb20wHhcNMTYwNzEyMDgxOTU5WhcNMTcwNzEyMDgxOTU5WjCB2zELMAkGA1UEBhMCQ04xEDAOBgNVBAgMB0ppYW5nc3UxEDAOBgNVBAcMB05hbmppbmcxLDAqBgNVBAoMI0h1YXdlaSBTb2Z0d2FyZSBUZWNobm9sb2dpZXMgQ08uTHRkMUEwPwYDVQQLDDhEZXZpZSBSZWdpb24gRGVsaXZlcnkgJiBTZXJ2aWNlIFF1YWxpdHkgJiBPcGVyYXRpb24gRGVwdDEYMBYGA1UEAwwPT1RBIEF1dGggU2VydmVyMR0wGwYJKoZIhvcNAQkBFg5vdGFAaHVhd2VpLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGeDtAUO4uTY5yWwS54sk030WOdHYoaaO0dufn4jvul22Ytogvua1W0qY+ABblhA3eB49YXYPnpLvGhjr+73oZ6jezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBTGCe/51LIS2ZT9nAj06RaAFcQa4jAfBgNVHSMEGDAWgBTH3T3aib5XZtlRccAInw7VjXJS0jAKBggqhkjOPQQDAgNJADBGAiEAjyic8z59ws8PvB2Q7apf69yFLM7ByICD8RBXxmz1WtUCIQChb2PYP5BzGRFxKV9ow9DesWt4bakIgdNFsUuT4NwMlQ==';\n \n $postData = json_decode(file_get_contents('php://input'));\n $updateToken = $postData->updateToken;\n $deviceId = $postData->deviceId;\n $versionId = $postData->version[0]->versionId;\n $versionNum = file_get_contents(E('MOEFRAME_TMP_ROOT').\"/versionNumber.txt\");\n \n $dataTemplate = '{\"updateToken\":\"'.$updateToken.'\",\"deviceId\":\"'.$deviceId.'\",\"approvedVersionList\":[{\"versionId\":\"'.$versionId.'\",\"status\":\"0\",\"versionNumber\":\"'.$versionNum.'\"}]}';\n $respData = \"data=\".base64_encode($dataTemplate).\"&sign=$sign&cert=$cert\";\n \n $this->directshow($respData);*/\n \n /*\n * PROXY SIGNATURE PROCCESS\n */\n // Loading Original Data\n $postData = file_get_contents('php://input');\n \n // Resolving Huawei Official Server IP address\n $ch = curl_init(\"http://119.29.29.29/d?dn=query.hicloud.com\");\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n $hwOtaIp = curl_exec($ch);\n \n // Proxy Signature Proccess\n $ch = curl_init(); \n curl_setopt($ch, CURLOPT_POST, 1);\n curl_setopt($ch, CURLOPT_URL, \"https://$hwOtaIp/sp_ard_common/v1/authorize.action\");\n curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);\n curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);\n curl_setopt($ch, CURLOPT_HTTPHEADER, array(\n 'User-Agent: Dalvik/2.1.0 (Linux; U; Android 7.0; ALE-L09 Build/HUAWEIALE-L09)',\n 'Content-Type: application/json; charset=utf-8',\n 'Content-Length: ' . strlen($postData),\n 'Host: query.hicloud.com'\n ));\n $return_content = curl_exec($ch);\n curl_close($ch);\n \n // Insert Version Number and Modify status\n $verNum = file_get_contents(E('MOEFRAME_TMP_ROOT').\"/versionNumber.txt\");\n parse_str($return_content, $query_parts);\n $dataStr = json_decode(base64_decode($query_parts[\"data\"]));\n $dataStr->approvedVersionList[0]->status = \"0\";\n $dataStr->approvedVersionList[0]->versionNumber = $verNum;\n $dataStr = base64_encode(json_encode($dataStr));\n \n // Rebuild Result\n preg_match(\"/&(sign=.*)$/\", $return_content, $signCert);\n $return_content = \"data=$dataStr&\".$signCert[1];\n\n $this->directshow($return_content);\n }", "public function sign(Request $request)\n {\n $oauth_params = $this->getOAuthParams();\n $oauth_params['oauth_signature'] = $this->getSignature($request);\n\n //put it where it needs to go in the request\n switch ($this->config['signature_location']) {\n case self::SIGN_LOCATION_HEADER:\n //Needs escaping in the header, not in the QS\n $oauth_params['oauth_signature'] = Helpers::escape($oauth_params['oauth_signature']);\n\n $header = 'OAuth '.Helpers::flattenAssocArray($oauth_params, '%s=\"%s\"', ', ');\n $request->setHeader(Request::HEADER_AUTHORIZATION, $header);\n\n break;\n\n case self::SIGN_LOCATION_QUERY:\n foreach ($oauth_params as $param_name => $param_value) {\n $request->setParameter($param_name, $param_value);\n }\n\n break;\n\n default:\n throw new Exception('Invalid signing location specified.');\n }\n\n //Reset so this instance of the Client can sign subsequent requests.\n //Mainly for the nonce.\n $this->resetOAuthParams();\n }", "public function signOn()\n {\n $this->sessionTokenTime = time();\n if (! empty($this->serviceKey)) {\n $this->sessionToken = $this->serviceInformationService->delegatedSignOn($this->identityToken, $this->serviceKey);\n } else {\n $this->sessionToken = $this->serviceInformationService->signOn($this->identityToken);\n }\n }", "public function client_credentials(){\n\t\t$this->server->addGrantType(new OAuth2\\GrantType\\ClientCredentials($this->storage, array(\n \t\t\"allow_credentials_in_request_body\" => true\n\t\t)));\n\t\t$this->server->handleTokenRequest($this->request)->send();\n\t}", "public function authenticateByClientLogin()\r\n\t{\r\n\t}", "private function sign( Ga_Lib_Api_Request $request ) {\r\n\t\tif ( empty( $this->token ) ) {\r\n\t\t\tthrow new Ga_Lib_Api_Client_Exception( 'Access Token is not available. Please reauthenticate' );\r\n\t\t}\r\n\r\n\t\t// Check if the token is set to expire in the next 30 seconds\r\n\t\t// (or has already expired).\r\n\t\t$this->check_access_token();\r\n\r\n\t\t// Add the OAuth2 header to the request\r\n\t\t$request->set_request_headers( array( 'Authorization: Bearer ' . $this->token['access_token'] ) );\r\n\r\n\t\treturn $request;\r\n\t}", "function client_credential_post() {\n $format = $this->response->get_default_format();\n $this->oauth->client_credentials($format);\n }", "function sign($certificate,$privateKey=null);", "public function sign($message);", "protected function auth()\n {\n $url = 'https://sandbox.safaricom.co.ke/oauth/v1/generate?grant_type=client_credentials';\n $curl = curl_init();\n curl_setopt( $curl, CURLOPT_URL, $url );\n $credentials = base64_encode( $this -> key.':'.$this -> secret );\n curl_setopt( $curl, CURLOPT_HTTPHEADER, [ 'Content-Type:application/json', 'Authorization: Basic '.$credentials ] );\n curl_setopt( $curl, CURLOPT_HEADER, true );\n curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );\n\n $curl_response = curl_exec( $curl );\n\n return json_decode( $curl_response );\n }", "public function testSignedParams()\n {\n $expiresIn = time() + 600;\n $_SERVER['SCRIPT_URI'] = \"http://www.zf-test.com/test.php\";\n $storage = new Zend_OpenId_Consumer_Storage_File(dirname(__FILE__) . \"/_files/consumer\");\n $consumer = new Zend_OpenId_ConsumerHelper($storage);\n\n $storage->addDiscoveryInfo(self::ID, self::REAL_ID, self::SERVER, 1.1, $expiresIn);\n\n // Wrong arguments\n $this->assertFalse($consumer->verify([]));\n // HMAC-SHA1\n $consumer->clearAssociation();\n $params = [\n \"openid_return_to\" => \"http://www.zf-test.com/test.php\",\n \"openid_assoc_handle\" => self::HANDLE,\n \"openid_claimed_id\" => self::ID,\n \"openid_identity\" => self::REAL_ID,\n \"openid_response_nonce\" => \"2007-08-14T12:52:33Z46c1a59124ffe\",\n \"openid_mode\" => \"id_res\",\n \"openid_signed\" => \"assoc_handle,return_to,claimed_id,identity,response_nonce,mode,signed\",\n \"openid_sig\" => \"h/5AFD25NpzSok5tzHEGCVUkQSw=\"\n ];\n $storage->delAssociation(self::SERVER);\n $storage->addAssociation(self::SERVER, self::HANDLE, \"sha1\", pack(\"H*\", \"8382aea922560ece833ba55fa53b7a975f597370\"), $expiresIn);\n $storage->purgeNonces();\n $this->assertFalse($consumer->verify($params));\n $this->assertEquals(\"The required parameter op_endpoint is missing in the signed\", $consumer->getError());\n }", "public function signin()\n {\n $this->oauth();\n\n }", "public function testSign()\n {\n $digest = new Digest();\n\n $hash = 'vcOqnVc4i0YB5ILPTt92mE4zsBHC0cMHq6YpM5Gw8rI=';\n\n $this->assertEquals($hash, $digest->sign($this->message, $this->authSecret));\n }", "function GApps_OpenID_SimpleSign($trust_roots = null) {\n $this->trust_roots = $trust_roots;\n if ($this->trust_roots == null) { \n $file = dirname(__FILE__).\"/ca-bundle.crt\";\n $this->trust_roots = array($file);\n }\n }", "function ilSoapAuthentication()\n\t{\n\t\tunset($_COOKIE['PHPSESSID']);\n\n\t\tparent::ilBaseAuthentication();\n\t\t$this->__setMessageCode('Client');\n\t}", "public function sign($path, array $runtimeConfig = null);", "public function authenticate() : void\r\n {\r\n $this->client->setBaseUrl('https://auth.routee.net');\r\n $response = $this->client->post(\r\n '/oauth/token',\r\n [\r\n 'grant_type' => 'client_credentials'\r\n ],\r\n [\r\n 'headers' => $this->headers\r\n ]);\r\n\r\n File::createFile(self::FILE_NAME, json_encode([\r\n 'access_token' => $response['access_token'],\r\n 'expire_on' => date(\"d-m-Y h:i:s\", time() + $response['expires_in'])\r\n ]));\r\n\r\n $this->setHeaders();\r\n\r\n }", "private function _setSignature() {\n // A new linefeed is necessary between your AccessID and Expires\n $string_to_sign = $this->_accessID.\"\\n\".$this->_expires;\n \n // Get the \"raw\" or binary output of the hmac hash\n $binary_signature = hash_hmac('sha1', $string_to_sign, $this->_secretKey, true);\n \n // We need to base64-encode it and then url-encode that\n $url_safe_signature = urlencode(base64_encode($binary_signature));\n \n // Set the authenticated signature\n $this->_signature = $url_safe_signature;\n }", "abstract public function sign($payload, $header);", "public function sign(array $params) {\n\t\t\t# -- zisti ci je nadefinovany callback\n\t\t\t$callback = Arr::path($this->config, 'authorization.callback');\n\t\t\tif(!empty($callback) && !is_callable($callback)) {\n\t\t\t\tthrow new Kohana_Exception('Sign callback :callback is not callable.', array(\n\t\t\t\t\t':callback' => $callback\n\t\t\t\t));\n\t\t\t}\n\n\t\t\t# -- zavolaj callback\n\t\t\t$output = call_user_func_array($callback, array(\n\t\t\t\tArr::path($this->config, 'authorization.username'),\n\t\t\t\tArr::path($this->config, 'authorization.password'),\n\t\t\t\t$params\n\t\t\t));\n\n\t\t\t# -- skontroluj vystup\n\t\t\tif(!is_array($output)) {\n\t\t\t\tthrow new SOAP_Exception('Output from sign callback must be an array, :type was returned.', array(\n\t\t\t\t\t':type' => gettype($output)\n\t\t\t\t));\n\t\t\t}\n\n\t\t\tif(!array_key_exists('username', $output) || !array_key_exists('password', $output)) {\n\t\t\t\tthrow new SOAP_Exception('Username and/or password is missing from sign callback output');\n\t\t\t}\n\n\t\t\t$this->authOutput = array(\n\t\t\t\t'username' => Arr::get($output, 'username'),\n\t\t\t\t'password' => Arr::get($output, 'password'),\n\t\t\t\t'method' => Arr::path($this->config, 'authorization.method'),\n\t\t\t);\n\n\t\t\treturn $this;\n\t\t}", "public function testBasicSignature() {\n\t\t$request = new OutboundRequest( 'https://api.globalcollect.com/v1/9991/tokens/123456789' );\n\t\t$request->setHeader( 'Date', 'Fri, 06 Jun 2014 13:39:43 GMT' );\n\t\t$this->authenticator->signRequest( $request );\n\t\t$headers = $request->getHeaders();\n\t\t$this->assertEquals(\n\t\t\t'GCS v1HMAC:5e45c937b9db33ae:J5LjfSBvrQNhu7gG0gvifZt+IWNDReGCmHmBmth6ueI=',\n\t\t\t$headers['Authorization']\n\t\t);\n\t}", "public function forAuth()\n {\n\n }", "public function clientCredentialsExampleAction()\n {\n $request = $this->getAuthenticatedRequest('/client');\n $response = $this->oAuthClient->getResponse($request);\n\n $data = \\json_decode($response->getBody()->getContents());\n $response = new JsonResponse($data);\n\n return $response; // usually the data would be sent to a view for display, but that's outwith the scope\n }", "public function sign(AbstractHttpMessage $message, string $key = null);", "public function authenticate() : void\n {\n try {\n $authenticate = $this->http_client->request('POST', 'authenticate', [\n 'json'=> [\n 'username'=> $this->config['username'],\n 'password' => $this->config['password']\n ]\n ]);\n } catch (\\GuzzleHttp\\Exception\\ClientException $e) {\n $message = 'There was a problem authenticating with the Creditsafe API';\n $code = 400;\n if ($e->hasResponse()) {\n $body = $e->getResponse()->getBody();\n $details = json_decode($body, true);\n if (json_last_error() === JSON_ERROR_NONE && isset($details['message'])) {\n $message = $details['message'];\n }\n $code = $e->getResponse()->getStatusCode();\n }\n throw new Exception\\Unauthorized($message, $code, $e);\n }\n $decode = json_decode((string) $authenticate->getBody(), true);\n $this->setToken($decode['token']);\n }", "public function setAuth()\n {\n $now = time();\n $nonce = $this->makeNonce();\n $join_string = $this->apiSecret . $nonce . $now;\n $checkSum = sha1($join_string);\n\n $this->addHeader(\"AppKey: {$this->apikey}\");\n $this->addHeader(\"CheckSum: {$checkSum}\");\n $this->addHeader(\"CurTime: {$now}\");\n $this->addHeader(\"Nonce: {$nonce}\");\n\n }", "public function testGenerateSignatureContainer()\n {\n $credentials = new SharedAccessSignature('myaccount', 'WXuEUKMijV/pxUu5/RhDn1bYRuFlLSbmLUJJWRqYQ/uxbMpEx+7S/jo9sT3ZIkEucZGbEafDuxD1kwFOXf3xyw==', false);\n $result = $credentials->createSignature(\n 'pictures',\n 'c',\n 'r',\n '2009-02-09',\n '2009-02-10',\n 'YWJjZGVmZw=='\n );\n $this->assertEquals('TEfqYYiY9Qrb7fH7nhiRCP9o5BzfO/VL8oYgfVpUl6s=', $result);\n }", "public function signRequest(Request $request)\n {\n $bearerToken = \"Bearer \". $this->tokenRef;\n return $request->withHeader(Resources::AUTHENTICATION, $bearerToken);\n }", "public static function verify_client() \n {\n $client = Request::input('client');\n\n $client_id = config('app.client_id');\n $client_secret = config('app.client_secret');\n if($client_id==$client['id'] && $client_secret==$client['secret'])\n {\n return true;\n } \n else\n {\n return false;\n }\n }", "public function authenticate(): void;" ]
[ "0.60804266", "0.600315", "0.5893426", "0.58602035", "0.5827879", "0.5759788", "0.5677403", "0.5612417", "0.5512211", "0.5495308", "0.54723173", "0.5457181", "0.54556566", "0.5450837", "0.54162204", "0.54120463", "0.5374889", "0.5332701", "0.52993244", "0.5290004", "0.5278457", "0.52631044", "0.5260101", "0.5257274", "0.51968294", "0.5191864", "0.51690197", "0.5167974", "0.5161712", "0.51595753" ]
0.7452851
0
adding new user to room
public function addUserToRoom($user,$room) { if($room=="") { return; } $this->getRoom($room)->addUserToRoom($user); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function addNewRoom()\n\t{\n\t\t$sql = \"INSERT INTO rooms\n\t\t\t\t\t(UserID, name)\n\t\t\t\tVALUES ( (SELECT ID FROM users WHERE Email=:user), :name)\";\n\t\ttry\n\t\t{\n\t\t\t$stmt = $this->_db->prepare($sql);\n\t\t\t$user = $_SESSION['Email'];\n\t\t\t$name = $_POST['name'];\n\t\t\t$stmt->bindParam(':user', $user, PDO::PARAM_STR);\n\t\t\t$stmt->bindParam(':name', $name, PDO::PARAM_STR);\n\t\t\t$stmt->execute();\n\t\t\t$stmt->closeCursor();\n\n\t\t\treturn $this->_db->lastInsertId();\n\t\t}\n\t\tcatch(PDOException $e)\n\t\t{\n\t\t\treturn $e->getMessage();\n\t\t}\n\t}", "public function addUser(){\n if(isset($_POST['easy_submit'])){\n $user_name = $_POST['easy_name'];\n $user_login = $_POST['easy_login'];\n $user_password = $_POST['easy_password'];\n\n $new_user = new User();\n $new_user->setName($user_name);\n $new_user->setLogin($user_login);\n $new_user->setPassword($user_password);\n\n $query = $this->model->add($new_user);\n if($query){\n AlertManager::add(EASY_NEW_USER_ADDED, AlertManager::SUCCESS);\n header('Location: ' . URL . 'home/');\n }else{\n AlertManager::add($query, AlertManager::DANGER);\n header('Location: ' . URL . 'home/');\n }\n }else{\n header('Location: ' . URL . 'home/');\n }\n }", "public function add_user () {\r\n $this->socket->event->addEvent(\"add user\",function($socket, $username,$userid) {\r\n $socket->username=$username;\r\n \r\n //add the client's username to the global list\r\n $socket->usernames[\"$username\"] = $username;\r\n $socket->socketID[\"$userid\"] = $username;\r\n $socket->numUsers++;\r\n \r\n //inform me that my login was successful\r\n $socket->event->emitMessage('login', array(\r\n 'numUsers'=>$socket->numUsers, \r\n 'users' =>$socket->ids_to_username_keys(),\r\n ));\r\n\r\n //broadcast to others that i have joined\r\n $socket->event->broadcastMessage('user joined', array(\r\n 'username'=>$socket->username,\r\n 'numUsers'=>$socket->numUsers,\r\n 'usersnames' =>$socket->ids_to_username_keys()\r\n ));\r\n \r\n $socket->addedUser=true;\r\n\r\n });\r\n\r\n }", "public function addRoom(){\n }", "public function newUser()\n {\n $this->user = new User(['type' => 'admin']);\n }", "public function addUser() {\n\t\t$user = new User();\n\t\t$user -> setId('999999999') -> setName('john') -> setEmail('[email protected]') -> setPassword('test');\n\n\t\t$this -> userService -> addUser($user);\n\n\t\t$this -> users[] = $user;\n\t}", "public function createUser() {\n $user = new User($this->uname);\n try {\n $query = $this->chatDB->prepare('INSERT INTO users (userID, userName) VALUES (?, ?)');\n $query->bindParam(1, $user->userID);\n $query->bindParam(2, $user->userName);\n $query->execute();\n } catch(Exception $e) {\n echo $e->getMessage();\n }\n }", "public function addMember($userId)\n {\n\n $user = User::model()->findByPk($userId);\n $membership = $this->getMembership($userId);\n\n if ($membership == null) {\n // Add Membership\n $membership = new RoomMembership;\n $membership->room_id = $this->getOwner()->id;\n $membership->user_id = $userId;\n $membership->status = RoomMembership::STATUS_MEMBER;\n $membership->invite_role = 0;\n $membership->admin_role = 0;\n $membership->share_role = 0;\n\n $userInvite = UserInvite::model()->findByAttributes(array('email' => $user->email));\n if ($userInvite !== null && $userInvite->source == UserInvite::SOURCE_INVITE) {\n RoomInviteAcceptedNotification::fire($userInvite->user_originator_id, $user, $this->getOwner());\n }\n } else {\n\n // User is already member\n if ($membership->status == RoomMembership::STATUS_MEMBER) {\n return true;\n }\n\n // User requested membership\n if ($membership->status == RoomMembership::STATUS_APPLICANT) {\n RoomApprovalRequestAcceptedNotification::fire(Yii::app()->user->id, $user, $this->getOwner());\n }\n\n // User was invited\n if ($membership->status == RoomMembership::STATUS_INVITED) {\n RoomInviteAcceptedNotification::fire($membership->originator_user_id, $user, $this->getOwner());\n }\n\n // Update Membership\n $membership->status = RoomMembership::STATUS_MEMBER;\n }\n $membership->save();\n\n // Create Wall Activity for that\n $activity = new Activity;\n $activity->content->room_id = $this->getOwner()->id;\n $activity->content->visibility = Content::VISIBILITY_PRIVATE;\n $activity->content->created_by = $this->getOwner()->id;\n $activity->created_by = $userId;\n $activity->type = \"ActivityRoomMemberAdded\";\n $activity->save();\n $activity->fire();\n\n // Members can't also follow the space\n $this->getOwner()->unfollow($userId);\n\n // Cleanup Notifications\n RoomInviteNotification::remove($userId, $this->getOwner());\n RoomApprovalRequestNotification::remove($userId, $this->getOwner());\n }", "public function addNewUser() {\n\t\t\tGLOBAL $page;\n\t\t\t\n\t\t\t$db = new database();\n\t\t\t$db->query(\"INSERT INTO `cashltd_cash`.`admin_login` (\n\t\t\t\t\t\t`id` ,\n\t\t\t\t\t\t`username` ,\n\t\t\t\t\t\t`password` ,\n\t\t\t\t\t\t`rank` ,\n\t\t\t\t\t\t`fname` ,\n\t\t\t\t\t\t`sname`\n\t\t\t\t\t\t)\n\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\tNULL , '\".safe::post('username').\"', '\".MD5(safe::post('password')).\"', '\".safe::post('rank').\"', '\".safe::post('fnamex').\"', '\".safe::post('lnamex').\"'\n\t\t\t\t\t\t);\");\n\t\t\t\n\t\t}", "function addnewuser()\n\t{\n\t\t\t\tif (!$this->ion_auth->logged_in())\n\t\t{\n\t\t\t//redirect them to the login page\n\t\t\tredirect('auth/login', 'refresh');\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');\n\t\t\t//list the users\n\t\t\t$this->data['users'] = $this->ion_auth->users()->result();\n\t\t\tforeach ($this->data['users'] as $k => $user)\n\t\t\t{\n\t\t\t\t$this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();\n\t\t\t}\n\n\t\t\tif($this->ion_auth->is_admin()){\n\t\t\t$this->template->set_template('user');\n\t\t\t$this->template->write_view('header', 'default/header', $this->session->userdata);\n\t\t\t$this->template->write_view('sidebar', 'default/sidebar');\n\t\t\t$this->template->write_view('content', 'auth/create_user',$this->data);\n\t\t\t$this->template->write_view('footer', 'default/footer');\n\t\t\t$this->template->render();\n\t\t\t}\n\t\t\t\n\t\t}\n\t}", "public function actionAddToUser() {\r\n\t\ttry {\r\n\t\t\tYii::app()->permitManager->check(array('BASE_DATA_EDIT'));\r\n\t\t\r\n\t\t\t$userId = $this->validateIntVal('userId');\r\n\t\t\t$roleIds = $this->validateArrayVal('roleIds');\r\n\r\n\t\t\t$data = Role::addToUser($roleIds, $userId);\r\n\r\n\t\t\t$this->renderJsonBms(true, 'OK', $data);\r\n\t\t} catch(Exception $e) {\r\n\t\t\t$this->renderJsonBms(false, $e->getMessage());\r\n\t\t}\r\n\t}", "public function newUser($data);", "public function addNewUser()\n {\n $email = $_POST['mail'];\n $password = $_POST['pass'];\n $name = $_POST['name'];\n $surname = $_POST['surname'];\n $role = $_POST['rol'];\n\n // Se busca si el mail ya figura en la base de datos\n $userdb = $this->model->getUser($email);\n if (!empty($userdb)) {\n $this->view->showError(\"Ese mail ya esta registrado\", 'signIn');\n die();\n }\n // Encripto el password\n $hash = password_hash($password, PASSWORD_DEFAULT);\n\n if (empty($email && $hash && $name && $surname)) {\n $this->view->showError(\"Faltan datos obligatorios\", 'signIn');\n die();\n }\n\n $success = $this->model->addUser($email, $hash, $name, $surname, $role);\n if ($success) {\n $user = $this->model->getUser($email);\n AuthHelper::SetSessionData($user);\n $this->redirect();\n }\n\n header('Location: ' . BASE_URL . \"index\");\n }", "public function addUser(\\PHPAuth\\User $user);", "function add_room($name,$realm,$x,$y,$text,$password_question,$password_answer,$password_fail_message,$required_item,$locked_up,$locked_down,$locked_right,$locked_left,$picture_url,$owner,$allow_portal)\n{\n\t$GLOBALS['SITE_DB']->query_insert('w_rooms',array(\n\t\t'name'=>$name,\n\t\t'location_realm'=>$realm,\n\t\t'location_x'=>$x,\n\t\t'location_y'=>$y,\n\t\t'r_text'=>$text,\n\t\t'password_question'=>$password_question,\n\t\t'password_answer'=>$password_answer,\n\t\t'password_fail_message'=>$password_fail_message,\n\t\t'required_item'=>$required_item,\n\t\t'locked_up'=>$locked_up,\n\t\t'locked_down'=>$locked_down,\n\t\t'locked_right'=>$locked_right,\n\t\t'locked_left'=>$locked_left,\n\t\t'picture_url'=>$picture_url,\n\t\t'owner'=>$owner,\n\t\t'allow_portal'=>$allow_portal,\n\t));\n}", "public function createUser()\n\t\t{\n\t\t\t\t\tlog_message('info', \"userCtrl\");\n\t\t\t\t\t$userData = $this->jsonbourne->decodeReqBody(); //get json\n\t\t\t\t\t$resultFromCreateANewUser = $this->userModel->create($userData); // pass arguments as array\n\t\t\t\t\techo count($resultFromCreateANewUser) > 1 ? $this->jsonbourne->forge(0, \"The user has been created\", $resultFromCreateANewUser): $this->jsonbourne->forge(1, \"error in the creation of user\", null);\n\t\t}", "function add_new_user ($username, $fullname, $password, $admin)\n\t{\n\t\t$query_stmt = $this->database_conn->prepare (\"INSERT INTO users VALUES (null, :username, :fullname, :password, :admin)\");\n\t\t$query_stmt->bindParam (':username', $username);\n\t\t$query_stmt->bindParam (':fullname', $fullname);\n\t\t$query_stmt->bindParam (':password', $password);\n\t\t$query_stmt->bindParam (':admin', $admin);\n\t\t$query_stmt->execute ();\n\t}", "function addUser()\n {\n if (APP_INSTALLED)\n {\n $this->_template->setRedirection(APP_URL);\n return ;\n }\n \n // Check post values and populate db\n if (isset($_POST['name']) && isset($_POST['pass']))\n {\n $newName = htmlspecialchars($_POST['name']);\n\n // Username lenght check\n if (strlen($newName) == 0)\n {\n $this->set('error', 'User Name needs to be at least 1 character long');\n return ;\n }\n\n // Username uniqueness check\n $user = new UserModel;\n $uNames = $user->getUserNames();\n\n $alreadyPresent = false;\n foreach ($uNames as $key => $value) {\n if ($value['name'] == $newName)\n $alreadyPresent = true;\n }\n\n if (!$alreadyPresent)\n {\n // success, lets add it to the database and inform the user\n $user->addUser($newName, hash(\"sha256\", $_POST['pass'] . BACK_HASH_SALT));\n $this->set('success', 'Added user <strong>' . $newName . '</strong> to SerieLast.');\n }\n else {\n $this->set('error', 'This name is already used');\n }\n }\n }", "public function add_room(){\n \n}", "public function createNewUser($user);", "public function addUser() {\n\t\t$userGroups=$this->UserGroup->getGroups();\n\t\t$this->set('userGroups', $userGroups);\n\t\tif ($this->request -> isPost()) {\n\t\t\t$time = strtotime ( \"now\" );\n\t\t\t$token = $time . $this->__randomStr ( 3 );\n\n\t\t\t$this->User->set($this->data);\n\t\t\tif ($this->User->RegisterValidate()) {\n\t\t\t\t$this->request->data['User']['username']=$this->request->data['User']['email'];\n\t\t\t\t$this->request->data['User']['email_verified']=1;\n\t\t\t\t$this->request->data['User']['active']=1;\n\t\t\t\t$this->request->data['User']['user_group_id']=3;\n\t\t\t\t$salt=$this->UserAuth->makeSalt();\n\t\t\t\t$this->request->data['User']['salt'] = $salt;\n\t\t\t\t$this->request->data['User']['token'] = $token;\n\t\t\t\t$this->request->data['User']['password'] = $this->UserAuth->makePassword($token, $salt);\n\t\t\t\t$this->User->save($this->request->data,false);\n\t\t\t\t$this->Session->setFlash('El participante se agregó correctamente.', 'default', array('class' => 'success_message'));\n\t\t\t\t$this->redirect('/allUsers');\n\t\t\t}\n\t\t}\n\t}", "function addUser() {\n\t\t$this->hashEmail();\n\t\t$this->hashPassword();\n\t\t$stmt = $this->db->prepare('INSERT INTO note_users (UserId, UserEmail, UserPassword) VALUES(:id, :email, :password);');\n\t\t$stmt->execute(array(':id' => $this->emailHash, ':email' => $this->email, ':password' => $this->passwordHash));\n\t\t\n\t\tif($stmt) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "public function executeAdd() \n {\n \t$user = new User();\n \t$user->setUserFn($this->getRequestParameter('fname'));\n \t$user->setUserLn($this->getRequestParameter('lname'));\n \t$user->setUserLogin($this->getRequestParameter('login'));\n \t$user->setUserEmail($this->getRequestParameter('email'));\n \t$user->setAuthLvlId('1');\n \t$user->setUserPswd($this->getRequestParameter('password'));\n \t$user->save();\n \t\n\t$this->forward('user', 'login');\n }", "private function registerUser() {\n $newUser = new \\Model\\User;\n $newUser->setName($this->registerView->getName());\n $newUser->setPassword($this->registerView->getPassword());\n \n try {\n $this->userList->saveNewUser($newUser);\n $this->userSession->destroyUserSession(); // logs out if user wants to register\n $message = \"Registered new user.\";\n } catch (\\Exception $e) {\n $message = $e->getMessage();\n }\n \n $this->msgSession->setMessage($message);\n $this->headerLocation(\"index.php\");\n }", "function create_user()\r\n\t{\r\n\t\tif ($_SERVER['REQUEST_METHOD'] == \"POST\")\r\n\t\t{\r\n\t\t\t$username = $this->connection->real_escape_string($_POST['username']);\r\n\t\t\t$password = sha1($_POST['password']); \r\n\t\t\t$roleID = 1;\r\n\t\t\t\r\n\t\t\t$sql = \"INSERT INTO users (username, encrypted_password, role_id) VALUES\"\r\n\t\t\t. \"('$username','$password', '$roleID')\";\r\n\r\n\t\t\t$result = mysqli_query($this->connection, $sql);\r\n\t\t\tif($result)\r\n\t\t\t{\r\n\t\t\t\t$_SESSION['message'] = \"New admin successfully created\";\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tdie('Error: ' . mysqli_error($mysqli));\r\n\t\t\t}\r\n\r\n\t\t\t$this->connection->close();\r\n\t\t}\t\t\r\n\t}", "private function createNewUser(){\t\n\t\t$this->dbObj->sqlSet(\"INSERT INTO {$this->_prefix}etchat_user ( etchat_username, etchat_usersex ) VALUES ( '\".$this->_user.\"', '\".$this->_gender{0}.\"')\");\n\t\t$user_neu=$this->dbObj->sqlGet(\"SELECT etchat_user_id, etchat_username, etchat_userprivilegien FROM {$this->_prefix}etchat_user WHERE etchat_username = '\".$this->_user.\"' LIMIT 1\");\n\t\t$_SESSION['etchat_'.$this->_prefix.'user_id'] = $user_neu[0][0];\n\t\t$_SESSION['etchat_'.$this->_prefix.'username'] = $user_neu[0][1];\n $_SESSION['etchat_'.$this->_prefix.'user_priv'] = $user_neu[0][2];\n\t\t$this->status=1;\n\t}", "function add_new_user_post()\n {\n $role = !empty($this->post('role')) ? $this->post('role') : '';\n $sess_token = !empty($this->post('token')) ? $this->post('token') : '';\n\n\n if ($this->checkAdminAPI($role, $sess_token) || CHECK_POSTMAN) { // admin\n /*user info*/\n $username = $this->post('username');\n $password = hash256($this->post('password'));\n $email = $this->post('email');\n $gender = !empty($this->post('gender')) ? strtolower($this->post('gender')) : GENDER_DEFAULT;\n $phone = $this->post('phone');\n $birthday = str_replace('/', '-', $this->post('birthday'));\n $birthday = !empty($this->post('birthday')) ? date('Y-m-d', strtotime($birthday)) : null;\n /*$last_name = $this->post('last_name');\n $first_name = $this->post('first_name');*/\n $fullname = $this->post('fullname');\n $address = $this->post('address');\n $province_id = !empty($this->post('province_id')) ? $this->post('province_id') : null;\n $purpose_stay = $this->post('purpose_stay');\n\n if (empty($email)) {\n $this->response(RestBadRequest(EMAIL_IS_EMPTY_MSG), SUCCESS_CODE);\n }\n\n $check_verify_params = checkVerifyParams(array(\n $username,\n $password,\n $fullname,\n ));\n\n if (!empty($check_verify_params)) {\n $this->response(RestBadRequest(MISMATCH_PARAMS_MSG), BAD_REQUEST_CODE);\n }\n\n //check email exists\n $where = array(\n 'email' => $email\n );\n $email_exists = $this->user_model->get_first_row($where);\n if (!empty($email_exists)) {\n $this->response(RestBadRequest(EMAIL_IS_EXISTED_MSG), BAD_REQUEST_CODE);\n }\n //check birthday\n if (!empty($birthday)) {\n if (DateTime::createFromFormat('Y-m-d', $birthday) == FALSE) {\n $this->response(RestBadRequest(DAY_FALSE_MSG), BAD_REQUEST_CODE);\n }\n if ($birthday > CURRENT_TIME) {\n $this->response(RestBadRequest(DAY_FUTURE_MSG), BAD_REQUEST_CODE);\n }\n }\n\n //check username exists\n $where = array(\n 'username' => $username\n );\n $user_exists = $this->user_model->get_first_row($where);\n if (!empty($user_exists)) {\n $this->response(RestBadRequest(USER_EXISTED_MSG), BAD_REQUEST_CODE);\n }\n\n //insert account tb\n $this->account_model->create(array(\n 'fullname' => $fullname,\n 'province_id' => $province_id,\n 'plain_name' => skipVN($fullname, true),\n 'create_time_mi' => CURRENT_MILLISECONDS,\n 'create_time' => CURRENT_TIME,\n 'update_time' => CURRENT_TIME,\n ));\n\n $account_id = $this->db->insert_id();\n\n //insert account_info tb\n $this->account_info_model->create(array(\n 'address' => $address,\n 'phone' => $phone,\n 'purpose_stay' => $purpose_stay,\n 'birthday' => !empty($birthday) ? date('Y-m-d', strtotime($birthday)) : '',\n 'gender' => $gender,\n 'account_id' => $account_id\n ));\n\n //insert user tb\n $this->user_model->create(array(\n 'username' => $username,\n 'password' => $password,\n 'email' => $email,\n 'last_login' => CURRENT_TIME,\n 'account_id' => $account_id,\n ));\n\n if (!empty($_FILES['img_src']['name'])) {\n\n $upload_dir = FOLDER_IMG_UPLOAD . '/user/' . hash256($account_id) . '/avatar';\n if (!is_dir($upload_dir)) {\n mkdir('./' . $upload_dir, 0777, TRUE);\n }\n\n //upload img_src\n $img_path = $_FILES['img_src']['name'];\n $img_path_ext = pathinfo($img_path, PATHINFO_EXTENSION);\n $img_name = cleanFileName(str_replace($img_path_ext, '', $img_path));\n $config['upload_path'] = './' . $upload_dir;\n $config['allowed_types'] = 'jpg|jpeg|png';\n $file_name = strtolower(strtotime('now') . '_' . $img_name . '.' . $img_path_ext);\n $config['file_name'] = $file_name;\n\n //Load upload library and initialize configuration\n $this->load->library('upload', $config);\n $this->upload->initialize($config);\n\n if ($this->upload->do_upload('img_src')) {\n //create crop_img_src\n $img_src = $upload_dir . '/' . $config['file_name'];\n $crop_img_src = $upload_dir . '/cr_' . $config['file_name'];\n resizeImage($img_src, null, '240', '300', false, $crop_img_src, false, false, 100);\n\n $this->account_model->update_by_condition(array(\n '_id' => $account_id\n ), array(\n 'img_src' => $img_src,\n 'crop_img_src' => $crop_img_src,\n ));\n } else {\n //server err\n $this->response(RestServerError(), BAD_REQUEST_CODE);\n }\n } /* !empty($_FILES['img_src']['name'] */\n $this->response(RestSuccess(), SUCCESS_CODE);\n } else {\n //API\n }\n }", "public function create()\n\t{\n\t global $tpl, $ilUser, $ilCtrl;\n\n\t require_once 'Modules/Chatroom/classes/class.ilChatroom.php';\n\t require_once 'Modules/Chatroom/classes/class.ilChatroomUser.php';\n\n\t if ( !ilChatroom::checkUserPermissions( 'read', $this->gui->ref_id ) )\n\t {\n\t \t$ilCtrl->setParameterByClass(\"ilrepositorygui\", \"ref_id\", ROOT_FOLDER_ID);\n\t \t$ilCtrl->redirectByClass(\"ilrepositorygui\", \"\");\n\t }\n\n\t $room = ilChatroom::byObjectId( $this->gui->object->getId() );\n\n\t $chat_user = new ilChatroomUser($ilUser, $room);\n\t $user_id = $chat_user->getUserId();\n\n\t if( !$room )\n\t {\n\t\t$response = json_encode( array(\n\t\t\t'success'\t=> false,\n\t\t\t'reason'\t=> 'unkown room'\n\t\t) );\n\t\techo json_encode( $response );\n\t\texit;\n\t }\n\t else if( !$room->isSubscribed( $chat_user->getUserId() ) )\n\t {\n\t\t$response = json_encode( array(\n\t\t\t'success'\t=> false,\n\t\t\t'reason'\t=> 'not subscribed'\n\t\t) );\n\t\techo json_encode( $response );\n\t\texit;\n\t }\n\n\t $title\t = $room->getUniquePrivateRoomTitle($_REQUEST['title']);\n\t $connector = $this->gui->getConnector();\n\t $response = $connector->createPrivateRoom($room, $title, $chat_user);\n\n\t echo json_encode($response);\n\t exit;\n\t}", "public function addroom(){\n\t\tif(isset($_SESSION['user_id'])){\n\t\t\tif(isset($_POST)){\n\t\t\t\tif(isset($_POST['name']) && isset($_POST['longitude']) && isset($_POST['latitude']) && isset($_POST['building_id']) && $_POST['name']!='' && $_POST['longitude']!='' && $_POST['latitude']!='' && $_POST['building_id']!=''){\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t$_POST['added_by_id'] = $_SESSION['user_id'];\n\t\t\t\t\t$insertroom = $this->mapModel->addBuilding($_POST);\n\t\t\t\t\t\n\t\t\t\t\techo json_encode(array('message'=>'room_added', 'result'=>array('room_id'=>$insertroom)));\n\t\t\t\t}else{\n\t\t\t\t\techo json_encode(array('message'=>'$_POST[\"name\"], $_POST[\"longitude\"], $_POST[\"latitude\"],$_POST[\"building_id\"] all need to be set and not empty'));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}else{\n\t\t\t\techo json_encode(array('message'=>'use post'));\n\t\t\t}\t\n\t\t}else{\n\t\t\techo json_encode(array('message'=>'must_log_in'));\n\t\t}\n\t\t\n\t}", "public function addUser(Room $room, UserInterface $user)\n {\n $this->redis->pipeline(function ($pipe) use ($room, $user) {\n /** @var Redis $pipe */\n $pipe->sadd($this->keyRoomUsers($room), $user->getUsername());\n $pipe->sadd($this->keyUserRooms($user), $room->getName());\n });\n }" ]
[ "0.7097728", "0.6749838", "0.6726911", "0.67135644", "0.6701877", "0.6670821", "0.6629663", "0.66216666", "0.6598712", "0.6592575", "0.6586752", "0.6517814", "0.6517651", "0.6511451", "0.64934504", "0.64876527", "0.6439154", "0.6399045", "0.6398424", "0.63901776", "0.63883185", "0.6361803", "0.63393974", "0.63328224", "0.63271767", "0.63067764", "0.63052154", "0.63044655", "0.6302504", "0.6299465" ]
0.7020149
1
Prepend the theme_parent_url, which is the url to the parent theme directory.
function theme_parent_url($url) { return create_url(CLanaya::Instance()->themeParentUrl . "/{$url}"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function activate_parent() {\n\t\t\t$this->activate_theme( 'parent', jet_theme_interface()->get_page_link( 'child-theme' ) );\n\t\t}", "public function install_parent() {\n\n\t\t\t$this->verify_request();\n\n\t\t\t$install_data = get_transient( jet_theme_wizard()->slug() );\n\t\t\t$theme_url = isset( $install_data['link'] ) ? $install_data['link'] : false;\n\n\t\t\t/**\n\t\t\t * Allow to filter parent theme URL\n\t\t\t *\n\t\t\t * @var string\n\t\t\t */\n\t\t\t$theme_url = apply_filters( 'jet_theme_wizard_parent_zip_url', $theme_url );\n\n\t\t\tif ( ! $theme_url ) {\n\t\t\t\twp_send_json_error( array(\n\t\t\t\t\t'message' => esc_html__( 'Theme URL was lost. Please refresh page and try again.', 'jet-theme-wizard' ),\n\t\t\t\t) );\n\t\t\t}\n\n\t\t\tjet_theme_wizard()->dependencies( array( 'install-api' ) );\n\t\t\t$api = jet_theme_install_api( $theme_url );\n\n\t\t\t$result = $api->do_theme_install();\n\n\t\t\tif ( true !== $result['success'] ) {\n\t\t\t\twp_send_json_error( array(\n\t\t\t\t\t'message' => $result['message'],\n\t\t\t\t) );\n\t\t\t}\n\n\t\t\tupdate_option( jet_theme_wizard()->settings['options']['parent_data'], array(\n\t\t\t\t'TextDomain' => 'kava',\n\t\t\t\t'ThemeName' => 'Kava',\n\t\t\t) );\n\n\t\t\t/**\n\t\t\t * Fires when parent installed before sending result.\n\t\t\t */\n\t\t\tdo_action( 'jet-theme-wizard/parent-installed' );\n\n\t\t\twp_send_json_success( array(\n\t\t\t\t'message' => $result['message'],\n\t\t\t\t'doNext' => true,\n\t\t\t\t'nextRequest' => array(\n\t\t\t\t\t'action' => 'jet_theme_wizard_activate_parent',\n\t\t\t\t),\n\t\t\t) );\n\t\t}", "function _manually_load_parent_theme() {\n\t//echo \"LOADING Theme\";\n\n\treturn str_replace( 'be', 'reworldmedia', dirname( dirname( __FILE__ ) )) ; // . '/functions.php';\n}", "public static function _enqueue_parent_style() {\n\t\twp_enqueue_style(\n\t\t\t'parent-theme',\n\t\t\tget_template_directory_uri() . '/style.css',\n\t\t\tfalse,\n\t\t\tself::VERSION\n\t\t);\n\t}", "function get_child_theme_path($path = '')\n{\n\treturn get_stylesheet_directory() . '/' . ltrim($path, '/\\\\');\n}", "function custom_parent_theme_style() {\n wp_enqueue_style( \n 'theme-parent-style', \n get_template_directory_uri().'/style.css' \n );\n}", "public function getParentUrl()\n {\n return parent::getUrl();\n }", "function bf_get_child_theme_uri( $append = '' ) {\n\n\t\tstatic $uri;\n\n\t\tif ( ! $uri ) {\n\t\t\t$uri = get_stylesheet_directory_uri() . '/';\n\t\t}\n\n\t\treturn $uri . $append;\n\t}", "public function linkParent()\n {\n return $this->container->get('git_router')->parentUrl();\n }", "function lowermedia_enqueue_parent_style() {\n wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );\n}", "function childtheme_parent_styles() {\r\n \r\n // enqueue style\r\n wp_enqueue_style( 'parent', get_template_directory_uri().'/style.css' ); \r\n}", "function kd_enqueue_parent_theme_style() {\n\n wp_enqueue_style( 'bootstrap' );\n wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css', array( 'bootstrap' ) );\n wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style') );\n }", "function eedt_theme_url()\n\t{\n\t\t$url = '';\n\t\tif(defined('URL_THIRD_THEMES'))\n\t\t{\n\t\t\t$url = URL_THIRD_THEMES;\n\t\t}\n\t\telse \n\t\t{\n\t\t\t$ee =& get_instance();\n\t\t\t$url = rtrim($ee->config->config['theme_folder_url'], '/') .'/third_party/';\n\t\t}\n\t\t\n\t\treturn $url;\n\t}", "public function prependUserThemeLocation($theme) {\n $this->viewFinder->prependLocation(implode('/', [storage_path('framework/userthemes'), $theme]));\n }", "private function getThemeRelativePath()\n {\n $theme = PageTheme::getSiteTheme();\n\n return $this->app->make('environment')->getURL(DIRNAME_THEMES . '/' . $theme->getThemeHandle(), $theme->getPackageHandle());\n }", "protected function getThemeURL() {\n return \\Config::getInstance()->getThemeURL() . '/';\n }", "public function OriginalURL(){\n\t\tif( $this->owner->ID ){\n\t\t\t$rootPath = '/' . $this->owner->getRelativePath();\n\t\t\tself::ensureDirectoryExists($rootPath);\n\t\t\treturn $rootPath;\n\t\t}\n\t}", "function _manually_load_child_theme() {\n\t//echo \"LOADING Theme\";\n\n\treturn dirname( dirname( __FILE__ ) ) ; // . '/functions.php';\n}", "public function parent()\n {\n $parent = $this->offsetGet('parent');\n\n if (!$this->parent && $parent) {\n try {\n $this->parent = new ThemeDetails($parent);\n } catch (\\RuntimeException $e) {\n throw new \\RuntimeException(sprintf('Parent theme %s not found', $parent), 404);\n }\n }\n\n return $this->parent;\n }", "private function ws_make_urls_relative() {\n\t\tif (\n\t\t\t\tis_admin() ||\n\t\t\t\tisset( $_GET['sitemap'] ) ||\n\t\t\t\tin_array(\n\t\t\t\t\t$GLOBALS['pagenow'],\n\t\t\t\t\t[\n\t\t\t\t\t\t'wp-login.php',\n\t\t\t\t\t\t'wp-register.php',\n\t\t\t\t\t],\n\t\t\t\t\ttrue\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t}\n\t\t\t$root_rel_filters = [\n\t\t\t\t'bloginfo_url',\n\t\t\t\t'the_permalink',\n\t\t\t\t'wp_list_pages',\n\t\t\t\t'wp_list_categories',\n\t\t\t\t'wp_get_attachment_url',\n\t\t\t\t'the_content_more_link',\n\t\t\t\t'the_tags',\n\t\t\t\t'get_pagenum_link',\n\t\t\t\t'get_comment_link',\n\t\t\t\t'month_link',\n\t\t\t\t'day_link',\n\t\t\t\t'year_link',\n\t\t\t\t'term_link',\n\t\t\t\t'the_author_posts_link',\n\t\t\t\t'script_loader_src',\n\t\t\t\t'style_loader_src',\n\t\t\t\t'theme_file_uri',\n\t\t\t\t'parent_theme_file_uri',\n\t\t\t];\n\t\t\t$this->ws_add_filters( $root_rel_filters, [ $this, 'ws_root_relative_url' ] );\n\n\t\t\tadd_filter(\n\t\t\t\t'wp_calculate_image_srcset',\n\t\t\t\tfunction ( $sources ) {\n\t\t\t\t\tforeach ( (array) $sources as $source => $src ) {\n\t\t\t\t\t\t$sources[ $source ]['url'] = $this->ws_root_relative_url( $src['url'] );\n\t\t\t\t\t}\n\t\t\t\t\treturn $sources;\n\t\t\t\t}\n\t\t\t);\n\t\t/**\n\t\t * Compatibility with The SEO Framework\n\t\t */\n\t\tadd_action(\n\t\t\t'the_seo_framework_do_before_output',\n\t\t\tfunction () {\n\t\t\t\tremove_filter( 'wp_get_attachment_url', [ $this, 'ws_root_relative_url' ] );\n\t\t\t}\n\t\t);\n\t\tadd_action(\n\t\t\t'the_seo_framework_do_after_output',\n\t\t\tfunction () {\n\t\t\t\tadd_filter( 'wp_get_attachment_url', [ $this, 'ws_root_relative_url' ] );\n\t\t\t}\n\t\t);\n\t}", "function install($parent)\n\t{\n\t\t// $parent is the class calling this method\n\t\t$parent->getParent()->setRedirectURL('index.php?option=com_helloworld');\n\t}", "public function getParentDir();", "function oceanwp_child_enqueue_parent_style() {\n\t// Dynamically get version number of the parent stylesheet (lets browsers re-cache your stylesheet when you update your theme)\n\t$theme = wp_get_theme( 'OceanWP' );\n\t$version = $theme->get( 'Version' );\n\t// Load the stylesheet\n\twp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'oceanwp-style' ), $version );\n\n}", "function classy_theme_enqueue_styles() {\n wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );\n}", "function fcwp_load_parent_stylesheets() {\n\t\twp_enqueue_style( 'parent-style', FCWP_URI . '/style.css', array(), '1.0.0' );\n\t}", "function common_theme_path($subpath=null, $url=false) {\n\t\t// This is a URL.\n\t\t$dir = \\trailingslashit(\\get_stylesheet_directory_uri());\n\t\t$path = \\trailingslashit($dir);\n\t\tif (! \\is_null($subpath)) {\n\t\t\t$path .= v_file::unleadingslash($subpath);\n\t\t}\n\n\t\treturn $url ? $path : \\common_get_path_by_url($path);\n\t}", "public function getRelativeParentFolder()\n {\n return dirname($this->getRelativeFilePath());\n }", "function get_child_template_path($path = '')\n{\n\treturn get_child_theme_path('templates/' . ltrim($path, '/'));\n}", "function get_parent_recursive($post_id) {\n $post = get_post($post_id);\n if ($post->post_parent) {\n get_parent_recursive($post->post_parent);\n echo \"&nbsp;&nbsp;>&nbsp;&nbsp;\";\n // Don't link to the actual theme page (those are empty), but link to\n // the projects page filtered on this theme\n if (in_array($post->post_parent, Array(9113, 9116, 9118, 9120, 9122))) {\n $post_parent = get_post($post->post_parent);\n if (get_bloginfo(\"language\") == 'en-US') {\n echo '<a href=\"/en/projects-tools-data/?_projects=' . $post_parent->post_name . '\">' . get_the_title($post->post_parent) . '</a>';\n } else {\n echo '<a href=\"/nl/projecten-tools-data/?_projects=' . $post_parent->post_name . '\">' . get_the_title($post->post_parent) . '</a>';\n }\n } else {\n echo '<a href=\"' . get_permalink($post->post_parent) . '\">' . get_the_title($post->post_parent) . '</a>';\n }\n }\n}", "function divi_child_enqueue_parent_styles() {\n wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );\n}" ]
[ "0.68774545", "0.67789614", "0.6574474", "0.6355967", "0.6223822", "0.6152092", "0.6104999", "0.6018572", "0.5971936", "0.588591", "0.5882945", "0.5878533", "0.5827754", "0.5799484", "0.5781336", "0.57525563", "0.57479143", "0.57178843", "0.57014096", "0.567812", "0.56740224", "0.5660308", "0.5659897", "0.56526136", "0.56501055", "0.56421494", "0.5634853", "0.5628607", "0.56013614", "0.5589451" ]
0.7987552
0
Login menu. Creates a menu which reflects if user is logged in or not.
function login_menu() { $lanaya = CLanaya::Instance(); if($lanaya->user->IsAuthenticated()) { $items = '<img src="' . get_gravatar(30) . '" alt="Gravatar"/>'; $items .= "<a href='" . create_url('user/profile') . "'>" . $lanaya->user->GetAcronym() . "</a> "; if($lanaya->user->IsAdministrator()) { $items .= "<a href='" . create_url('acp') . "'>acp</a> "; } $items .= "<a href='" . create_url('user/logout') . "'>logout</a> "; } else { $items = "<a href='" . create_url('user/login') . "'>login</a> "; } return "<nav>$items</nav>"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function login_bootstrap_menu() {\t\n\t$lanaya = CLanaya::Instance();\n\tif($lanaya->user->IsAuthenticated()) {\n\t\t$items = \"<li><a href='\" . create_url('user/profile') . \"'>Profile</a></li>\";\n\t\t$items .= \"<li><a href='\" . create_url('user/logout') . \"'>logout</a></li>\";\n\t} else {\n\t\t$items = \"<li><a href='\" . create_url('user/login') . \"'>login</a></li>\";\n\t}\n\n\treturn \"$items\";\n}", "function setMenu(){\r\n\t\t$auth = new auth();\r\n\t\t$str=\"\";\r\n\t\t$str=$str.\"<div id='cssmenu' style='padding-top:5px;padding-bottom:5px;'><ul>\";\r\n\t\tforeach ($this->menu as $Indice => $Index){\t\t\t\r\n\t\t\t$str=$str.\"<li><a href='\".$Index[\"url\"].\"'>\".$Index[\"txt\"].\"</a></li>\";\r\n\t\t}\r\n\t\tif($auth->logged()){\r\n\t\t\t$str=$str.\"<li><a href='index.php?id=5'>Perfil</a></li>\";\r\n\t\t\t$str=$str.\"<div id='identi' style='float:right;padding-top:5px;padding-right:10px;'><a href='index.php?id=1&event=exit' class='pure-button pure-button-primary'>Salir</a></div></ul></div>\";\r\n\t\t}else if(isset($_COOKIE[\"failUser\"])){\r\n\t\t\tif($_COOKIE[\"failUser\"] >= 3){\r\n\t\t\t\t\t$str=$str.\"<div id='identi' style='float:right;'><p>Debera esperar 60 segundos por temas de seguridad.</p></div></ul></div>\";\r\n\t\t\t}else{\r\n\t\t\t\t\t$str=$str.\"<div id='identi' style='float:right;padding-top:5px;padding-right:10px;'><form action='index.php?id=1&event=login' method='POST' class='pure-form' ><input type='text' name='user' placeholder='Username'><input type='password' placeholder='Password' name='pass'><input type='Submit' class='pure-button pure-button-primary' value='Login'></form></div></ul></div>\";\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\t$str=$str.\"<div id='identi' style='float:right;padding-top:5px;padding-right:10px;'><form action='index.php?id=1&event=login' method='POST' class='pure-form' ><input type='text' name='user' placeholder='Username'><input type='password' placeholder='Password' name='pass'><input type='Submit' class='pure-button pure-button-primary' value='Login'></form></div></ul></div>\";\t\r\n\t\t}\r\n\t\t$this->setContenido($str);\r\n\t}", "function admin_login() {\r\n\t\t// Setting the correct layout as well as needed view variables\r\n\t\t$this->layout = 'admin_logout';\r\n\t\t$this->set('mainToolbar', $this->model->adminSettings['toolbar']['main']['login']);\r\n\t\t$this->login();\r\n\t}", "function login() {\n\t\tif(isset($_SESSION['Auth']['User'])){\n\t\t\t//redirect if already logged in\t\t\t\n\t\t\t$this->redirect(array('controller'=>'claims','action'=>'homedisplay','home'));\n\t\t} else {\n\t\t\t$this->set('title_for_layout', 'Login to access Website Content Management System');\n\t\t\t$this->layout = 'admin';\t\n\t\t\t$this->set('page','Login');\n\t\t}\n\t}", "public function Menu ()\n {\n require('language.php');\n if(isset($_GET['logout']))\n {\n if($_GET['logout'] == \"true\")\n {\n setcookie('id', null, -1, '/');\n setcookie('username', null, -1, '/');\n setcookie('password', null, -1, '/');\n unset($_COOKIE['id']);\n unset($_COOKIE['username']);\n unset($_COOKIE['password']);\n $this->msg = $str['logout_success'];\n if(basename($_SERVER['PHP_SELF']) != \"index.php\")\n header (\"Location: index.php?logout=true\");\n }\n }\n elseif($this->AdminIsLogged())\n {\n return 2;\n }\n elseif($this->UserIsLogged())\n {\n return 1;\n }\n elseif (isset($_GET['access']))\n {\n if($_GET['access'] == \"false\")\n {\n $this->msg=$str['access_denied'];\n return 3;\n }\n }\n elseif(isset($_POST['login']))\n {\n if(empty($_POST['username']) || empty($_POST['password']))\n {\n $this->msg = $str['error_message_empty'];\n return 3;\n }\n else\n {\n $user = new User();\n $db = new Database();\n $user->username = $this->Check_Param($_POST['username']);\n $user->password = $this->HashCode(($this->Check_Param($_POST['password'])));\n $db->query(\"SELECT * FROM tbl_user WHERE username = ? AND password = ?\");\n $db->bind(1,$user->username);\n $db->bind(2,$user->password);\n $db->execute();\n if ($db->rowCount() == 1)\n {\n $row = $db->single();\n $user->id = $row['id'];\n $user->username = $row['username'];\n $user->password = $row['password'];\n setcookie('id', $user->id, false, '/');\n setcookie('username', $user->username , false, '/');\n setcookie('password', $user->password, false, '/');\n $address = $_SERVER['PHP_SELF'];\n header(\"Location: $address\");\n return 1;\n }\n else\n {\n $this->msg = $str['invalid_username_password'];\n return 3;\n }\n }\n }\n return 3;\n }", "public function connectMenu() {\n $url = trim(Zend_Controller_Front::getInstance()->getRequest()->getRequestUri(), '/');\n\n // If user is viewing 'News' tab, fake it as being on 'Home'\n $url = (strpos($url, '/news/') !== false) ? 'connect' : $url;\n\n // Check if user is logged in\n $auth = Zend_Auth::getInstance();\n $auth->setStorage(new Zend_Auth_Storage_Session('hl_connect'));\n\n $isInIris = isset($auth->getStorage()->read()->isInIris) ? $auth->getStorage()->read()->isInIris : false;\n\n $menuData = array(\n 'url' => $url,\n 'loggedIn' => $auth->hasIdentity(),\n 'userresources' => $this->view->userresources,\n 'fsastatusabbr' => $this->view->fsastatusabbr,\n 'isInIris' => $isInIris,\n );\n\n $mainMenu =\n $subHeader = '';\n\n if ($auth->hasIdentity() && $this->view->layout()->getLayout() != 'login') {\n\n // Extra agent user info for constructing MyConnect link\n $menuData['agentSchemeNumber'] = $auth->getStorage()->read()->agentschemeno;\n $menuData['agentId'] = $auth->getStorage()->read()->agentid;\n $menuData['agentUsername'] = $auth->getStorage()->read()->username;\n\n $mainMenu = $this->view->partial('partials/main-menu.phtml', $menuData);\n\n } else {\n\n $mainMenu = $this->view->partial('partials/main-menu-prelogin.phtml', $menuData);\n\n }\n\n $subHeader = $this->view->partial('partials/sub-header.phtml', $menuData);\n\n echo $mainMenu;\n echo $subHeader;\n }", "private function login() {\n $this->_template->title = 'Login';\n $this->_template->loginErrors = $this->_model->getErrors();\n $this->_template->input = $this->_model->getSubmittedValues();\n $this->_template->missing = $this->_model->getMissingValues();\n $this->_template->token = $this->_security->generateToken();\n if ($this->_model->isJustProcessed()) {\n if (filter_has_var(INPUT_POST, 'login') && $this->_model->isLoggedIn() === false) {\n $this->_template->buildFromTemplates('header.php', 'sidebar.php', 'main.login.php', 'footer.php');\n } elseif ($this->_model->isLoggedIn() === true && $this->_model->isAdmin() === true) {\n $this->_security->deleteTokenFromSession();\n $this->_registry->redirectTo('admin/main');\n } else {\n $this->_security->deleteTokenFromSession();\n $this->_session->exists('url') === true ? $this->_registry->redirectToPrevious() : $this->_registry->redirectTo('account/info'); \n }\n } else {\n if ($this->_model->isLoggedIn() === true) {\n $this->_security->deleteTokenFromSession();\n $this->_session->exists('url') === true ? $this->_registry->redirectToPrevious() : $this->_registry->redirectTo('account/info');\n } elseif ($this->_model->isLoggedIn() === true && $this->_model->isAdmin() === true) {\n $this->_security->deleteTokenFromSession();\n $this->_registry->redirectTo('admin/main');\n } else {\n $this->_template->buildFromTemplates('header.php', 'sidebar.php', 'main.login.php', 'footer.php');\n }\n } \n }", "function showLogin()\n {\n // Is the user logged in?\n if (isset($_SESSION[\"loginUsername\"]))\n $this->setVariable(\"LOGIN_STATUS\", \n \"You are currently logged in as {$_SESSION[\"loginUsername\"]}\");\n else\n $this->setVariable(\"LOGIN_STATUS\", \n \"You are currently not logged in\");\n }", "function logInOut() {\r\n\tif (!isset($_SESSION['userType']))\r\n\t{\r\n\t\techo \"<li><a href='register.php'>Register</a></li>\";\r\n\t\techo \"<li><a href='login.php'>Login</a></li>\";\r\n\t}\r\n\telse\r\n\t{\r\n\t\techo \"<li><a href='logout.php'>Logout</a></li>\";\r\n\t}\r\n}", "public function login()\n {\n $login = $_POST['login'];\n $password = $_POST['passwd'];\n $pass_check = $this->dbh->prepare(\n \"SELECT * FROM Users WHERE u_Login=:Login\"\n );\n $pass_check->bindValue(\":Login\", $login);\n $pass_check->execute();\n $pass_check_r = $pass_check->fetch();\n $pwd_correct = password_verify($password, $pass_check_r['u_Password']);\n if ((bool) $pwd_correct === true) {\n $this->smarty->assign(\"logged\", true);\n $found[0] = true;\n if ($pass_check_r['u_UserType'] == 1) {\n $_SESSION['user_type'] = 1;\n $this->smarty->assign(\"user_Type\", 1);\n } elseif ($pass_check_r['u_UserType'] == 2) {\n $_SESSION['user_type'] = 2;\n $this->smarty->assign(\"user_Type\", 2);\n } elseif ($pass_check_r['u_UserType'] == 3) {\n $_SESSION['user_type'] = 3;\n $this->smarty->assign(\"user_Type\", 3);\n }\n $_SESSION['id'] = 1;\n $_SESSION['nickname'] = $pass_check_r['u_Nickname'];\n $menu = $this->smarty->fetch(\"menu.tpl\");\n $this->smarty->assign(\"menu\", $menu);\n $this->smarty->display(\"index.tpl\");\n exit();\n } else {\n $found[0] = false;\n $this->smarty->assign(\"logged\", false);\n }\n exit();\n }", "public function login()\n\t{\n\t\t\n\t\t$this->template->load('login');\n\t}", "function checkLoginPage(){\n\tif (isset($_SESSION['logged-in']) && $_SESSION['logged-in']==true){\n\t\t\t\t$loginPage = \"accountDetails.php\";\n\t\t\t\t$name = \"ACCOUNT\";\n\t\t\t}\n\t\t\telse{\n\t\t\t\t$loginPage = \"loginForm.php\";\n\t\t\t\t$name = \"LOGIN\";\n\t\t\t}\n\t\t\t$loginMenu = array();\n\t\t\t$loginMenu['loginPage'] = $loginPage;\n\t\t\t$loginMenu['name'] = $name;\n\t\t\treturn $loginMenu;\n}", "protected function createHTMLMenu() {\n\t\t$ulvl = $this->getUser()->getUserLevel();\n\t\t$tpl_data = array(\n\t\t\t'label_help' => psm_get_lang('menu', 'help'),\n\t\t\t'label_profile' => psm_get_lang('users', 'profile'),\n\t\t\t'label_logout' => psm_get_lang('login', 'logout'),\n\t\t\t'url_profile' => psm_build_url(array('mod' => 'user_profile')),\n\t\t\t'url_logout' => psm_build_url(array('logout' => 1)),\n\t\t);\n\t\tswitch($ulvl) {\n\t\t\tcase PSM_USER_ADMIN:\n\t\t\t\t$items = array('server_status', 'server', 'server_log', 'user', 'config', 'server_update');\n\t\t\t\tbreak;\n\t\t\tcase PSM_USER_USER:\n\t\t\t\t$items = array('server_status', 'server', 'server_log', 'server_update');\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$items = array();\n\t\t\t\tbreak;\n\t\t}\n\t\t$tpl_data['menu'] = array();\n\t\tforeach($items as $key) {\n\t\t\t$tpl_data['menu'][] = array(\n\t\t\t\t'active' => ($key == psm_GET('mod')) ? 'active' : '',\n\t\t\t\t'url' => psm_build_url(array('mod' => $key)),\n\t\t\t\t'label' => psm_get_lang('menu', $key),\n\t\t\t);\n\t\t}\n\t\tif($ulvl != PSM_USER_ANONYMOUS) {\n\t\t\t$user = $this->getUser()->getUser();\n\t\t\t$tpl_data['label_usermenu'] = str_replace(\n\t\t\t\t'%user_name%',\n\t\t\t\t$user->name,\n\t\t\t\tpsm_get_lang('login', 'welcome_usermenu')\n\t\t\t);\n\t\t}\n\t\treturn $this->twig->render('main/menu.tpl.html', $tpl_data);\n\t}", "public function menu()\n\t{\n\t\tif (!$this->pemilwa_library->is_loggedin()) {\n\t\t\tredirect('admin','refresh');\n\t\t}\n\t\t\n\t\t//ambil data role dan ambil id dari session\n\t\t$var['role'] = $this->pemilwa_library->role();\n\t\t$var['cek'] = $this->session->userdata('id');\n\n\t\t//load halaman\n\t\t$data['header'] = 'header';\n\t\t$data['navbar'] = 'navbar';\n\t\t$data['footer'] = 'footer';\n\t\t$this->pemilwa_library->display('menu-admin', $data, $var);\n\t}", "protected function viewMenu(){\n\t\t$userStatus = $_SESSION[\"user_status\"];\n\t\t\n\t\t// menus\n\t\t$menu = false;\n\t\tif ($userStatus > 2){\n\t\t\t$menu = true;\n\t\t}\n\t\treturn $menu;\n\t}", "public function login_form() {\n\n\t\treturn $this->render('user-login-form.php', array(\n\t\t\t'page_title' => 'Login',\n\t\t));\n\t}", "function default_menu() {\n\n echo '<ul class=\"nav navbar-nav navbar-right\">';\n if (is_user_logged_in()) {\n echo '<li><a href=\"' . home_url() . '/wp-admin/nav-menus.php\">Create a menu</a></li>';\n } else {\n echo '<li><a href=\"' . home_url() . '\">Home</a></li>';\n }\n echo '</ul>';\n}", "static function site_menu($menu, $theme) {\n\n // If this page doesn't belong to an item, don't display the menu.\n if (!$theme->item()) {\n return;\n }\n $item = $theme->item();\n\n // If there isn't currently a password stored in the cookie, \n // then display the enter password link.\n if (cookie::get(\"g3_albumpassword\") == \"\") {\n $menu->append(Menu::factory(\"dialog\")\n ->id(\"albumpassword_login\")\n ->css_id(\"g-album-password-login\")\n ->url(url::site(\"albumpassword/login\"))\n ->label(t(\"Unlock albums\")));\n } else {\n // If a password has been entered already\n // display the log out link, and links to the protected albums\n $menu->append(Menu::factory(\"submenu\")\n ->id(\"albumpassword_protected\")\n ->css_id(\"g-album-password-protected\")\n ->label(t(\"Protected albums\")));\n $menu->get(\"albumpassword_protected\")\n ->append(Menu::factory(\"link\")\n ->id(\"albumpassword_logout\")\n ->css_id(\"g-album-password-logout\")\n ->url(url::site(\"albumpassword/logout\"))\n ->label(t(\"Clear password\")));\n $existing_password = \"\";\n if (cookie::get(\"g3_albumpassword_id\") != \"\") {\n $existing_password = ORM::factory(\"items_albumpassword\")\n ->where(\"password\", \"=\", cookie::get(\"g3_albumpassword\"))\n ->where(\"id\", \"=\", cookie::get(\"g3_albumpassword_id\"))\n ->find_all();\n } else {\n $existing_password = ORM::factory(\"items_albumpassword\")\n ->where(\"password\", \"=\", cookie::get(\"g3_albumpassword\"))\n ->find_all();\n }\n if (count($existing_password) > 0) {\n $counter = 0;\n while ($counter < count($existing_password)) {\n $item_album = ORM::factory(\"item\")->where(\"id\", \"=\", $existing_password[$counter]->album_id)->find();\n $menu->get(\"albumpassword_protected\")\n ->append(Menu::factory(\"link\")\n ->id(\"albumpassword_album\" . $counter)\n ->label(html::purify($item_album->title))\n ->css_id(\"g-album-password-album\" . $counter)\n ->url(url::abs_site(\"{$item_album->type}s/{$item_album->id}\")));\n $counter++;\n }\n }\n }\n\n // If this is an album without a password, display a link for assigning one.\n // If this is an album with a password, display a link to remove it.\n if ($item->is_album()) {\n if ((access::can(\"view\", $item)) && (access::can(\"edit\", $item))) {\n $existing_password = ORM::factory(\"items_albumpassword\")\n ->where(\"album_id\", \"=\", $item->id)\n ->find_all();\n if (count($existing_password) > 0) {\n $menu->get(\"options_menu\")\n ->append(Menu::factory(\"link\")\n ->id(\"albumpassword_remove\")\n ->label(t(\"Remove password\"))\n ->css_id(\"g-album-password-remove\")\n ->url(url::site(\"albumpassword/remove/\" . $item->id)));\n } elseif ($item->id != 1) {\n $passworded_subitems = ORM::factory(\"item\", $item->id)\n ->and_open()->join(\"albumpassword_idcaches\", \"items.id\", \"albumpassword_idcaches.item_id\", \"LEFT OUTER\")\n ->where(\"albumpassword_idcaches.item_id\", \"IS NOT\", NULL)->close()\n ->descendants();\n\t\t\n $existing_cacheditem = ORM::factory(\"albumpassword_idcache\")->where(\"item_id\", \"=\", $item->id)->order_by(\"cache_id\")->find_all();\n if ((count($existing_cacheditem) == 0) && count($passworded_subitems) == 0) {\n $menu->get(\"options_menu\")\n ->append(Menu::factory(\"dialog\")\n ->id(\"albumpassword_assign\")\n ->label(t(\"Assign password\"))\n ->css_id(\"g-album-password-assign\")\n ->url(url::site(\"albumpassword/assign/\" . $item->id)));\n }\n }\n }\n }\n }", "public function authenticate(Menu $menu, UserInterface $user): bool;", "public function login()\r\n {\r\n if (!isset($_SESSION['pseudo'])){\r\n $this->viewTemplate('app/view/admin/login.php', 'app/view/admin/Template.php', 'Connection administration');\r\n }\r\n else {\r\n header('Location: /app/admin/home');\r\n }\r\n }", "public function set_menu(){\n \t$this->_main_menu = array();\n \n $this->_main_menu['index'] = new Model_Ui_Menuitem(\n \t \"View My Entries\" ,\n \t \"/user/\");\n $this->_main_menu['create'] = new Model_Ui_Menuitem(\n \t\"Upload Content\",\n \t\"/user/create\");\n $this->_main_menu['drafts'] = new Model_Ui_Menuitem(\n \t\"My Drafts\" ,\n \t\"/user/drafts\");\n $this->_main_menu['trash'] = new Model_Ui_Menuitem(\n \t\"Trash\" ,\t\n \t\"/user/trash\");\n $this->_main_menu['edit'] = new Model_Ui_Menuitem(\n \t\"Edit Profile\" ,\n \t\"/user/edit\");\n /*\n $this->_main_menu['my_files'] = new Model_Ui_Menuitem(\n \t\"My Files\" ,\n \t\"/user/my_files\");\n */\n \n $action = $this->request->action();\n $this->_main_menu[$action]->active = true;\n\t\n }", "function leftMenu() \n\t{\n\t\techo\"<ul>\\n\n\t\t\t<li><a href='index.php'>Career PathWays</a></li>\\n\n \t\t<li><a href='quiz.php'>Major Match Maker</a></li>\\n\n\n\t\t\t<li><strong>Admin</strong></li>\\n\";\n\t\t\n\t\t//If admin is logged in, display pages that all admins can access, and the logout link\n\t\tif($_SESSION['islogged']!=0)\n\t\t{\n\t\t\techo\"<li> <a href='majorAdd.php'>Major</a></li>\\n\n\t\t\t\t<li> <a href='jobAdd.php'>Job</a></li>\\n\n\t\t\t\t<li> <a href='alumnaAdd.php'>Alumna</a></li>\\n\n\t\t\t\t<li> <a href='interestAdd.php'>Interest</a></li>\\n\n\t\t\t\t<li> <a href='opportunityAdd.php'>Opportunities</a></li>\\n\n\t\t\t\t<li> <a href='linkAdd.php'>Links</a></li>\\n\";\n\n\t\t\t//If full-admin is logged in, dislay main_register page link\n\t\t\tif($_SESSION['accessLv'] == 2)\n\t\t\t{\n\t\t\t\techo \"<li> <a href='main_register.php'>Add Admin</a></li>\\n\";\n\t\t\t}\n\n\t\t\techo \"<li> <a href='logout.php'>Logout</a></li>\\n\";\n\t\t}\n\t\t//If user id NOT logged in, display the login link\n\t\telse\n\t\t{\n\t\t\techo \"<li> <a href='main_login.php'>Login</a></li>\\n\";\n\t\t}\n\t\techo\"</ul>\\n\";\n\t}", "public function logInAction() {\n $user = $GLOBALS['TSFE']->fe_user->user;\n\n if ($user != NULL) {\n $this->redirect('index', 'Index');\n }\n\n\n if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'])) {\n $_params = array();\n foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'] as $funcRef) {\n list($onSub, $hid) = \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::callUserFunction($funcRef, $_params, $this);\n $onSubmitAr[] = $onSub;\n $extraHiddenAr[] = $hid;\n }\n }\n\n if (count($onSubmitAr)) {\n $onSubmit = implode('; ', $onSubmitAr) . '; return true;';\n }\n\n if (count($extraHiddenAr)) {\n $extraHidden = implode(LF, $extraHiddenAr);\n }\n $this->view->assign('storagePid', $this->settings['storagePid']);\n $this->view->assign('onSubmit', $onSubmit);\n $this->view->assign('extraHidden', $extraHidden);\n $this->view->assign('currentPid', \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::_GP('id'));\n }", "public function loginAction() {\n\t\tif (Form::$requested_data !== false) {\n\t\t\t$data = Form::$requested_data;\n\t\t\t$user = new userModule($data['user_id']);\n\t\t\t$user = $user->object();\n\t\t\tif ($user !== false && $user->password == $data['password']) {\n\t\t\t\tuserModule::login($user->user_id, $user->password);\n\t\t\t\tif ($user->type == 'student') {\n\t\t\t\t\theader(''); // Reffer to student index.\n\t\t\t\t}\n\t\t\t\telse if ($user->type == 'teacher') {\n\t\t\t\t\theader(''); // Reffer to teacher index.\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$this->_view->error = 'No such username || password.';\n\t\t\t}\n\t\t}\n\t\n\t\t$form = new Form();\n\t\t$form\n\t\t\t->label('ID: ')\n\t\t\t->validator('int')\n\t\t\t->attr('name', 'user_id')\n\t\t\t->element('text');\n\t\t\t\n\t\t$form\n\t\t\t->label('Password:')\n\t\t\t->attr('name', 'password')\n\t\t\t->element('password');\n\t\t\t\n\t\t$form\n\t\t\t->attr('value', 'Login')\n\t\t\t->element('submit');\n\t\t\n\t\t$this->_view->login_form = $form->setAsStaticForm();\n\t}", "public function index()\n\t{\n\t\t//cek user telah login atau belum\n\t\tif ($this->pemilwa_library->is_loggedin()) {\n\t\t\tredirect('admin/menu','refresh');\n\t\t} else {\n\t\t\tredirect('admin/login','refresh');\n\t\t}\t\t\n\t}", "public function index(){\n\t\t\t\t/*if(IdEnSession::getSession(DEFAULT_USER_AUTHENTICATE) == true){\n $this->redirect('admin');\n } else {\n $this->vView->visualize('login');\n }*/\n /* END VALIDATION TIME SESSION USER */ \n $this->vView->visualize('login');\n\t\t\t}", "function create_menu()\n {\n $nav = '<a href=\"index.php?page=index\"> Accueil </a>';\n $nav .= '<a href=\"index.php?page=wiki\"> Wiki </a>';\n $nav .= '<a href=\"index.php?page=contact\"> Contact </a>';\n if(logged())\n {\n $nav .= '<a href=\"index.php?page=profile\"> Profil </a>';\n if(admin($_SESSION['user']->getId()))\n {\n $nav .= '<a href=\"index.php?page=administration\"> Administration </a>';\n }\n $nav .= '<a href=\"index.php?page=logout\"> Déconnexion </a>';\n }\n else\n {\n $nav .= '<a href=\"index.php?page=register\"> Inscription </a>';\n $nav .= '<a href=\"index.php?page=login\"> Connexion </a>';\n }\n echo $nav;\n }", "public function DisplayLogin(){ \n if ($this->checkLoggedIn()){\n $this->juegosController->DisplayJuegos();\n }else{ \n $this->view->DisplayLogin();\n }\n\n }", "public function doLogInPage() {\n if(!isset($_SESSION['userSession'])) {\n $this->view->show(\"login.php\");\n } else {\n header(\"Location: index.php?loggedstatus=true\");\n }\n }", "public function login() {\n $data['ActivePage'] = \"login\";\n\n $this -> load -> view('repeating/header', $data);\n $this -> load -> view('content/vLogin');\n $this -> load -> view('repeating/footer', $data);\n }" ]
[ "0.7255024", "0.69939405", "0.6855307", "0.67768383", "0.6707028", "0.663314", "0.6601567", "0.65345055", "0.6492113", "0.6464697", "0.6456277", "0.64432764", "0.64289355", "0.63986754", "0.63967943", "0.6371834", "0.63704216", "0.6346257", "0.63419193", "0.6327969", "0.63125306", "0.62627184", "0.62386835", "0.6232016", "0.6222641", "0.621659", "0.6214637", "0.6210719", "0.6203427", "0.619011" ]
0.7738376
0
Login menu. Creates a menu which reflects if user is logged in or not.
function login_bootstrap_menu() { $lanaya = CLanaya::Instance(); if($lanaya->user->IsAuthenticated()) { $items = "<li><a href='" . create_url('user/profile') . "'>Profile</a></li>"; $items .= "<li><a href='" . create_url('user/logout') . "'>logout</a></li>"; } else { $items = "<li><a href='" . create_url('user/login') . "'>login</a></li>"; } return "$items"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function login_menu() {\n\t$lanaya = CLanaya::Instance();\n\tif($lanaya->user->IsAuthenticated()) {\n\t\t$items = '<img src=\"' . get_gravatar(30) . '\" alt=\"Gravatar\"/>';\n\t\t$items .= \"<a href='\" . create_url('user/profile') . \"'>\" . $lanaya->user->GetAcronym() . \"</a> \";\n\t\tif($lanaya->user->IsAdministrator()) {\n\t\t\t$items .= \"<a href='\" . create_url('acp') . \"'>acp</a> \";\n\t\t}\n\t\t$items .= \"<a href='\" . create_url('user/logout') . \"'>logout</a> \";\n\t} else {\n\t\t$items = \"<a href='\" . create_url('user/login') . \"'>login</a> \";\n\t}\n\t\n\treturn \"<nav>$items</nav>\";\n}", "function setMenu(){\r\n\t\t$auth = new auth();\r\n\t\t$str=\"\";\r\n\t\t$str=$str.\"<div id='cssmenu' style='padding-top:5px;padding-bottom:5px;'><ul>\";\r\n\t\tforeach ($this->menu as $Indice => $Index){\t\t\t\r\n\t\t\t$str=$str.\"<li><a href='\".$Index[\"url\"].\"'>\".$Index[\"txt\"].\"</a></li>\";\r\n\t\t}\r\n\t\tif($auth->logged()){\r\n\t\t\t$str=$str.\"<li><a href='index.php?id=5'>Perfil</a></li>\";\r\n\t\t\t$str=$str.\"<div id='identi' style='float:right;padding-top:5px;padding-right:10px;'><a href='index.php?id=1&event=exit' class='pure-button pure-button-primary'>Salir</a></div></ul></div>\";\r\n\t\t}else if(isset($_COOKIE[\"failUser\"])){\r\n\t\t\tif($_COOKIE[\"failUser\"] >= 3){\r\n\t\t\t\t\t$str=$str.\"<div id='identi' style='float:right;'><p>Debera esperar 60 segundos por temas de seguridad.</p></div></ul></div>\";\r\n\t\t\t}else{\r\n\t\t\t\t\t$str=$str.\"<div id='identi' style='float:right;padding-top:5px;padding-right:10px;'><form action='index.php?id=1&event=login' method='POST' class='pure-form' ><input type='text' name='user' placeholder='Username'><input type='password' placeholder='Password' name='pass'><input type='Submit' class='pure-button pure-button-primary' value='Login'></form></div></ul></div>\";\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\t$str=$str.\"<div id='identi' style='float:right;padding-top:5px;padding-right:10px;'><form action='index.php?id=1&event=login' method='POST' class='pure-form' ><input type='text' name='user' placeholder='Username'><input type='password' placeholder='Password' name='pass'><input type='Submit' class='pure-button pure-button-primary' value='Login'></form></div></ul></div>\";\t\r\n\t\t}\r\n\t\t$this->setContenido($str);\r\n\t}", "function admin_login() {\r\n\t\t// Setting the correct layout as well as needed view variables\r\n\t\t$this->layout = 'admin_logout';\r\n\t\t$this->set('mainToolbar', $this->model->adminSettings['toolbar']['main']['login']);\r\n\t\t$this->login();\r\n\t}", "function login() {\n\t\tif(isset($_SESSION['Auth']['User'])){\n\t\t\t//redirect if already logged in\t\t\t\n\t\t\t$this->redirect(array('controller'=>'claims','action'=>'homedisplay','home'));\n\t\t} else {\n\t\t\t$this->set('title_for_layout', 'Login to access Website Content Management System');\n\t\t\t$this->layout = 'admin';\t\n\t\t\t$this->set('page','Login');\n\t\t}\n\t}", "public function Menu ()\n {\n require('language.php');\n if(isset($_GET['logout']))\n {\n if($_GET['logout'] == \"true\")\n {\n setcookie('id', null, -1, '/');\n setcookie('username', null, -1, '/');\n setcookie('password', null, -1, '/');\n unset($_COOKIE['id']);\n unset($_COOKIE['username']);\n unset($_COOKIE['password']);\n $this->msg = $str['logout_success'];\n if(basename($_SERVER['PHP_SELF']) != \"index.php\")\n header (\"Location: index.php?logout=true\");\n }\n }\n elseif($this->AdminIsLogged())\n {\n return 2;\n }\n elseif($this->UserIsLogged())\n {\n return 1;\n }\n elseif (isset($_GET['access']))\n {\n if($_GET['access'] == \"false\")\n {\n $this->msg=$str['access_denied'];\n return 3;\n }\n }\n elseif(isset($_POST['login']))\n {\n if(empty($_POST['username']) || empty($_POST['password']))\n {\n $this->msg = $str['error_message_empty'];\n return 3;\n }\n else\n {\n $user = new User();\n $db = new Database();\n $user->username = $this->Check_Param($_POST['username']);\n $user->password = $this->HashCode(($this->Check_Param($_POST['password'])));\n $db->query(\"SELECT * FROM tbl_user WHERE username = ? AND password = ?\");\n $db->bind(1,$user->username);\n $db->bind(2,$user->password);\n $db->execute();\n if ($db->rowCount() == 1)\n {\n $row = $db->single();\n $user->id = $row['id'];\n $user->username = $row['username'];\n $user->password = $row['password'];\n setcookie('id', $user->id, false, '/');\n setcookie('username', $user->username , false, '/');\n setcookie('password', $user->password, false, '/');\n $address = $_SERVER['PHP_SELF'];\n header(\"Location: $address\");\n return 1;\n }\n else\n {\n $this->msg = $str['invalid_username_password'];\n return 3;\n }\n }\n }\n return 3;\n }", "public function connectMenu() {\n $url = trim(Zend_Controller_Front::getInstance()->getRequest()->getRequestUri(), '/');\n\n // If user is viewing 'News' tab, fake it as being on 'Home'\n $url = (strpos($url, '/news/') !== false) ? 'connect' : $url;\n\n // Check if user is logged in\n $auth = Zend_Auth::getInstance();\n $auth->setStorage(new Zend_Auth_Storage_Session('hl_connect'));\n\n $isInIris = isset($auth->getStorage()->read()->isInIris) ? $auth->getStorage()->read()->isInIris : false;\n\n $menuData = array(\n 'url' => $url,\n 'loggedIn' => $auth->hasIdentity(),\n 'userresources' => $this->view->userresources,\n 'fsastatusabbr' => $this->view->fsastatusabbr,\n 'isInIris' => $isInIris,\n );\n\n $mainMenu =\n $subHeader = '';\n\n if ($auth->hasIdentity() && $this->view->layout()->getLayout() != 'login') {\n\n // Extra agent user info for constructing MyConnect link\n $menuData['agentSchemeNumber'] = $auth->getStorage()->read()->agentschemeno;\n $menuData['agentId'] = $auth->getStorage()->read()->agentid;\n $menuData['agentUsername'] = $auth->getStorage()->read()->username;\n\n $mainMenu = $this->view->partial('partials/main-menu.phtml', $menuData);\n\n } else {\n\n $mainMenu = $this->view->partial('partials/main-menu-prelogin.phtml', $menuData);\n\n }\n\n $subHeader = $this->view->partial('partials/sub-header.phtml', $menuData);\n\n echo $mainMenu;\n echo $subHeader;\n }", "private function login() {\n $this->_template->title = 'Login';\n $this->_template->loginErrors = $this->_model->getErrors();\n $this->_template->input = $this->_model->getSubmittedValues();\n $this->_template->missing = $this->_model->getMissingValues();\n $this->_template->token = $this->_security->generateToken();\n if ($this->_model->isJustProcessed()) {\n if (filter_has_var(INPUT_POST, 'login') && $this->_model->isLoggedIn() === false) {\n $this->_template->buildFromTemplates('header.php', 'sidebar.php', 'main.login.php', 'footer.php');\n } elseif ($this->_model->isLoggedIn() === true && $this->_model->isAdmin() === true) {\n $this->_security->deleteTokenFromSession();\n $this->_registry->redirectTo('admin/main');\n } else {\n $this->_security->deleteTokenFromSession();\n $this->_session->exists('url') === true ? $this->_registry->redirectToPrevious() : $this->_registry->redirectTo('account/info'); \n }\n } else {\n if ($this->_model->isLoggedIn() === true) {\n $this->_security->deleteTokenFromSession();\n $this->_session->exists('url') === true ? $this->_registry->redirectToPrevious() : $this->_registry->redirectTo('account/info');\n } elseif ($this->_model->isLoggedIn() === true && $this->_model->isAdmin() === true) {\n $this->_security->deleteTokenFromSession();\n $this->_registry->redirectTo('admin/main');\n } else {\n $this->_template->buildFromTemplates('header.php', 'sidebar.php', 'main.login.php', 'footer.php');\n }\n } \n }", "function showLogin()\n {\n // Is the user logged in?\n if (isset($_SESSION[\"loginUsername\"]))\n $this->setVariable(\"LOGIN_STATUS\", \n \"You are currently logged in as {$_SESSION[\"loginUsername\"]}\");\n else\n $this->setVariable(\"LOGIN_STATUS\", \n \"You are currently not logged in\");\n }", "function logInOut() {\r\n\tif (!isset($_SESSION['userType']))\r\n\t{\r\n\t\techo \"<li><a href='register.php'>Register</a></li>\";\r\n\t\techo \"<li><a href='login.php'>Login</a></li>\";\r\n\t}\r\n\telse\r\n\t{\r\n\t\techo \"<li><a href='logout.php'>Logout</a></li>\";\r\n\t}\r\n}", "public function login()\n {\n $login = $_POST['login'];\n $password = $_POST['passwd'];\n $pass_check = $this->dbh->prepare(\n \"SELECT * FROM Users WHERE u_Login=:Login\"\n );\n $pass_check->bindValue(\":Login\", $login);\n $pass_check->execute();\n $pass_check_r = $pass_check->fetch();\n $pwd_correct = password_verify($password, $pass_check_r['u_Password']);\n if ((bool) $pwd_correct === true) {\n $this->smarty->assign(\"logged\", true);\n $found[0] = true;\n if ($pass_check_r['u_UserType'] == 1) {\n $_SESSION['user_type'] = 1;\n $this->smarty->assign(\"user_Type\", 1);\n } elseif ($pass_check_r['u_UserType'] == 2) {\n $_SESSION['user_type'] = 2;\n $this->smarty->assign(\"user_Type\", 2);\n } elseif ($pass_check_r['u_UserType'] == 3) {\n $_SESSION['user_type'] = 3;\n $this->smarty->assign(\"user_Type\", 3);\n }\n $_SESSION['id'] = 1;\n $_SESSION['nickname'] = $pass_check_r['u_Nickname'];\n $menu = $this->smarty->fetch(\"menu.tpl\");\n $this->smarty->assign(\"menu\", $menu);\n $this->smarty->display(\"index.tpl\");\n exit();\n } else {\n $found[0] = false;\n $this->smarty->assign(\"logged\", false);\n }\n exit();\n }", "public function login()\n\t{\n\t\t\n\t\t$this->template->load('login');\n\t}", "function checkLoginPage(){\n\tif (isset($_SESSION['logged-in']) && $_SESSION['logged-in']==true){\n\t\t\t\t$loginPage = \"accountDetails.php\";\n\t\t\t\t$name = \"ACCOUNT\";\n\t\t\t}\n\t\t\telse{\n\t\t\t\t$loginPage = \"loginForm.php\";\n\t\t\t\t$name = \"LOGIN\";\n\t\t\t}\n\t\t\t$loginMenu = array();\n\t\t\t$loginMenu['loginPage'] = $loginPage;\n\t\t\t$loginMenu['name'] = $name;\n\t\t\treturn $loginMenu;\n}", "protected function createHTMLMenu() {\n\t\t$ulvl = $this->getUser()->getUserLevel();\n\t\t$tpl_data = array(\n\t\t\t'label_help' => psm_get_lang('menu', 'help'),\n\t\t\t'label_profile' => psm_get_lang('users', 'profile'),\n\t\t\t'label_logout' => psm_get_lang('login', 'logout'),\n\t\t\t'url_profile' => psm_build_url(array('mod' => 'user_profile')),\n\t\t\t'url_logout' => psm_build_url(array('logout' => 1)),\n\t\t);\n\t\tswitch($ulvl) {\n\t\t\tcase PSM_USER_ADMIN:\n\t\t\t\t$items = array('server_status', 'server', 'server_log', 'user', 'config', 'server_update');\n\t\t\t\tbreak;\n\t\t\tcase PSM_USER_USER:\n\t\t\t\t$items = array('server_status', 'server', 'server_log', 'server_update');\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$items = array();\n\t\t\t\tbreak;\n\t\t}\n\t\t$tpl_data['menu'] = array();\n\t\tforeach($items as $key) {\n\t\t\t$tpl_data['menu'][] = array(\n\t\t\t\t'active' => ($key == psm_GET('mod')) ? 'active' : '',\n\t\t\t\t'url' => psm_build_url(array('mod' => $key)),\n\t\t\t\t'label' => psm_get_lang('menu', $key),\n\t\t\t);\n\t\t}\n\t\tif($ulvl != PSM_USER_ANONYMOUS) {\n\t\t\t$user = $this->getUser()->getUser();\n\t\t\t$tpl_data['label_usermenu'] = str_replace(\n\t\t\t\t'%user_name%',\n\t\t\t\t$user->name,\n\t\t\t\tpsm_get_lang('login', 'welcome_usermenu')\n\t\t\t);\n\t\t}\n\t\treturn $this->twig->render('main/menu.tpl.html', $tpl_data);\n\t}", "public function menu()\n\t{\n\t\tif (!$this->pemilwa_library->is_loggedin()) {\n\t\t\tredirect('admin','refresh');\n\t\t}\n\t\t\n\t\t//ambil data role dan ambil id dari session\n\t\t$var['role'] = $this->pemilwa_library->role();\n\t\t$var['cek'] = $this->session->userdata('id');\n\n\t\t//load halaman\n\t\t$data['header'] = 'header';\n\t\t$data['navbar'] = 'navbar';\n\t\t$data['footer'] = 'footer';\n\t\t$this->pemilwa_library->display('menu-admin', $data, $var);\n\t}", "protected function viewMenu(){\n\t\t$userStatus = $_SESSION[\"user_status\"];\n\t\t\n\t\t// menus\n\t\t$menu = false;\n\t\tif ($userStatus > 2){\n\t\t\t$menu = true;\n\t\t}\n\t\treturn $menu;\n\t}", "public function login_form() {\n\n\t\treturn $this->render('user-login-form.php', array(\n\t\t\t'page_title' => 'Login',\n\t\t));\n\t}", "function default_menu() {\n\n echo '<ul class=\"nav navbar-nav navbar-right\">';\n if (is_user_logged_in()) {\n echo '<li><a href=\"' . home_url() . '/wp-admin/nav-menus.php\">Create a menu</a></li>';\n } else {\n echo '<li><a href=\"' . home_url() . '\">Home</a></li>';\n }\n echo '</ul>';\n}", "static function site_menu($menu, $theme) {\n\n // If this page doesn't belong to an item, don't display the menu.\n if (!$theme->item()) {\n return;\n }\n $item = $theme->item();\n\n // If there isn't currently a password stored in the cookie, \n // then display the enter password link.\n if (cookie::get(\"g3_albumpassword\") == \"\") {\n $menu->append(Menu::factory(\"dialog\")\n ->id(\"albumpassword_login\")\n ->css_id(\"g-album-password-login\")\n ->url(url::site(\"albumpassword/login\"))\n ->label(t(\"Unlock albums\")));\n } else {\n // If a password has been entered already\n // display the log out link, and links to the protected albums\n $menu->append(Menu::factory(\"submenu\")\n ->id(\"albumpassword_protected\")\n ->css_id(\"g-album-password-protected\")\n ->label(t(\"Protected albums\")));\n $menu->get(\"albumpassword_protected\")\n ->append(Menu::factory(\"link\")\n ->id(\"albumpassword_logout\")\n ->css_id(\"g-album-password-logout\")\n ->url(url::site(\"albumpassword/logout\"))\n ->label(t(\"Clear password\")));\n $existing_password = \"\";\n if (cookie::get(\"g3_albumpassword_id\") != \"\") {\n $existing_password = ORM::factory(\"items_albumpassword\")\n ->where(\"password\", \"=\", cookie::get(\"g3_albumpassword\"))\n ->where(\"id\", \"=\", cookie::get(\"g3_albumpassword_id\"))\n ->find_all();\n } else {\n $existing_password = ORM::factory(\"items_albumpassword\")\n ->where(\"password\", \"=\", cookie::get(\"g3_albumpassword\"))\n ->find_all();\n }\n if (count($existing_password) > 0) {\n $counter = 0;\n while ($counter < count($existing_password)) {\n $item_album = ORM::factory(\"item\")->where(\"id\", \"=\", $existing_password[$counter]->album_id)->find();\n $menu->get(\"albumpassword_protected\")\n ->append(Menu::factory(\"link\")\n ->id(\"albumpassword_album\" . $counter)\n ->label(html::purify($item_album->title))\n ->css_id(\"g-album-password-album\" . $counter)\n ->url(url::abs_site(\"{$item_album->type}s/{$item_album->id}\")));\n $counter++;\n }\n }\n }\n\n // If this is an album without a password, display a link for assigning one.\n // If this is an album with a password, display a link to remove it.\n if ($item->is_album()) {\n if ((access::can(\"view\", $item)) && (access::can(\"edit\", $item))) {\n $existing_password = ORM::factory(\"items_albumpassword\")\n ->where(\"album_id\", \"=\", $item->id)\n ->find_all();\n if (count($existing_password) > 0) {\n $menu->get(\"options_menu\")\n ->append(Menu::factory(\"link\")\n ->id(\"albumpassword_remove\")\n ->label(t(\"Remove password\"))\n ->css_id(\"g-album-password-remove\")\n ->url(url::site(\"albumpassword/remove/\" . $item->id)));\n } elseif ($item->id != 1) {\n $passworded_subitems = ORM::factory(\"item\", $item->id)\n ->and_open()->join(\"albumpassword_idcaches\", \"items.id\", \"albumpassword_idcaches.item_id\", \"LEFT OUTER\")\n ->where(\"albumpassword_idcaches.item_id\", \"IS NOT\", NULL)->close()\n ->descendants();\n\t\t\n $existing_cacheditem = ORM::factory(\"albumpassword_idcache\")->where(\"item_id\", \"=\", $item->id)->order_by(\"cache_id\")->find_all();\n if ((count($existing_cacheditem) == 0) && count($passworded_subitems) == 0) {\n $menu->get(\"options_menu\")\n ->append(Menu::factory(\"dialog\")\n ->id(\"albumpassword_assign\")\n ->label(t(\"Assign password\"))\n ->css_id(\"g-album-password-assign\")\n ->url(url::site(\"albumpassword/assign/\" . $item->id)));\n }\n }\n }\n }\n }", "public function authenticate(Menu $menu, UserInterface $user): bool;", "public function login()\r\n {\r\n if (!isset($_SESSION['pseudo'])){\r\n $this->viewTemplate('app/view/admin/login.php', 'app/view/admin/Template.php', 'Connection administration');\r\n }\r\n else {\r\n header('Location: /app/admin/home');\r\n }\r\n }", "public function set_menu(){\n \t$this->_main_menu = array();\n \n $this->_main_menu['index'] = new Model_Ui_Menuitem(\n \t \"View My Entries\" ,\n \t \"/user/\");\n $this->_main_menu['create'] = new Model_Ui_Menuitem(\n \t\"Upload Content\",\n \t\"/user/create\");\n $this->_main_menu['drafts'] = new Model_Ui_Menuitem(\n \t\"My Drafts\" ,\n \t\"/user/drafts\");\n $this->_main_menu['trash'] = new Model_Ui_Menuitem(\n \t\"Trash\" ,\t\n \t\"/user/trash\");\n $this->_main_menu['edit'] = new Model_Ui_Menuitem(\n \t\"Edit Profile\" ,\n \t\"/user/edit\");\n /*\n $this->_main_menu['my_files'] = new Model_Ui_Menuitem(\n \t\"My Files\" ,\n \t\"/user/my_files\");\n */\n \n $action = $this->request->action();\n $this->_main_menu[$action]->active = true;\n\t\n }", "function leftMenu() \n\t{\n\t\techo\"<ul>\\n\n\t\t\t<li><a href='index.php'>Career PathWays</a></li>\\n\n \t\t<li><a href='quiz.php'>Major Match Maker</a></li>\\n\n\n\t\t\t<li><strong>Admin</strong></li>\\n\";\n\t\t\n\t\t//If admin is logged in, display pages that all admins can access, and the logout link\n\t\tif($_SESSION['islogged']!=0)\n\t\t{\n\t\t\techo\"<li> <a href='majorAdd.php'>Major</a></li>\\n\n\t\t\t\t<li> <a href='jobAdd.php'>Job</a></li>\\n\n\t\t\t\t<li> <a href='alumnaAdd.php'>Alumna</a></li>\\n\n\t\t\t\t<li> <a href='interestAdd.php'>Interest</a></li>\\n\n\t\t\t\t<li> <a href='opportunityAdd.php'>Opportunities</a></li>\\n\n\t\t\t\t<li> <a href='linkAdd.php'>Links</a></li>\\n\";\n\n\t\t\t//If full-admin is logged in, dislay main_register page link\n\t\t\tif($_SESSION['accessLv'] == 2)\n\t\t\t{\n\t\t\t\techo \"<li> <a href='main_register.php'>Add Admin</a></li>\\n\";\n\t\t\t}\n\n\t\t\techo \"<li> <a href='logout.php'>Logout</a></li>\\n\";\n\t\t}\n\t\t//If user id NOT logged in, display the login link\n\t\telse\n\t\t{\n\t\t\techo \"<li> <a href='main_login.php'>Login</a></li>\\n\";\n\t\t}\n\t\techo\"</ul>\\n\";\n\t}", "public function logInAction() {\n $user = $GLOBALS['TSFE']->fe_user->user;\n\n if ($user != NULL) {\n $this->redirect('index', 'Index');\n }\n\n\n if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'])) {\n $_params = array();\n foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'] as $funcRef) {\n list($onSub, $hid) = \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::callUserFunction($funcRef, $_params, $this);\n $onSubmitAr[] = $onSub;\n $extraHiddenAr[] = $hid;\n }\n }\n\n if (count($onSubmitAr)) {\n $onSubmit = implode('; ', $onSubmitAr) . '; return true;';\n }\n\n if (count($extraHiddenAr)) {\n $extraHidden = implode(LF, $extraHiddenAr);\n }\n $this->view->assign('storagePid', $this->settings['storagePid']);\n $this->view->assign('onSubmit', $onSubmit);\n $this->view->assign('extraHidden', $extraHidden);\n $this->view->assign('currentPid', \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::_GP('id'));\n }", "public function loginAction() {\n\t\tif (Form::$requested_data !== false) {\n\t\t\t$data = Form::$requested_data;\n\t\t\t$user = new userModule($data['user_id']);\n\t\t\t$user = $user->object();\n\t\t\tif ($user !== false && $user->password == $data['password']) {\n\t\t\t\tuserModule::login($user->user_id, $user->password);\n\t\t\t\tif ($user->type == 'student') {\n\t\t\t\t\theader(''); // Reffer to student index.\n\t\t\t\t}\n\t\t\t\telse if ($user->type == 'teacher') {\n\t\t\t\t\theader(''); // Reffer to teacher index.\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$this->_view->error = 'No such username || password.';\n\t\t\t}\n\t\t}\n\t\n\t\t$form = new Form();\n\t\t$form\n\t\t\t->label('ID: ')\n\t\t\t->validator('int')\n\t\t\t->attr('name', 'user_id')\n\t\t\t->element('text');\n\t\t\t\n\t\t$form\n\t\t\t->label('Password:')\n\t\t\t->attr('name', 'password')\n\t\t\t->element('password');\n\t\t\t\n\t\t$form\n\t\t\t->attr('value', 'Login')\n\t\t\t->element('submit');\n\t\t\n\t\t$this->_view->login_form = $form->setAsStaticForm();\n\t}", "public function index()\n\t{\n\t\t//cek user telah login atau belum\n\t\tif ($this->pemilwa_library->is_loggedin()) {\n\t\t\tredirect('admin/menu','refresh');\n\t\t} else {\n\t\t\tredirect('admin/login','refresh');\n\t\t}\t\t\n\t}", "public function index(){\n\t\t\t\t/*if(IdEnSession::getSession(DEFAULT_USER_AUTHENTICATE) == true){\n $this->redirect('admin');\n } else {\n $this->vView->visualize('login');\n }*/\n /* END VALIDATION TIME SESSION USER */ \n $this->vView->visualize('login');\n\t\t\t}", "function create_menu()\n {\n $nav = '<a href=\"index.php?page=index\"> Accueil </a>';\n $nav .= '<a href=\"index.php?page=wiki\"> Wiki </a>';\n $nav .= '<a href=\"index.php?page=contact\"> Contact </a>';\n if(logged())\n {\n $nav .= '<a href=\"index.php?page=profile\"> Profil </a>';\n if(admin($_SESSION['user']->getId()))\n {\n $nav .= '<a href=\"index.php?page=administration\"> Administration </a>';\n }\n $nav .= '<a href=\"index.php?page=logout\"> Déconnexion </a>';\n }\n else\n {\n $nav .= '<a href=\"index.php?page=register\"> Inscription </a>';\n $nav .= '<a href=\"index.php?page=login\"> Connexion </a>';\n }\n echo $nav;\n }", "public function DisplayLogin(){ \n if ($this->checkLoggedIn()){\n $this->juegosController->DisplayJuegos();\n }else{ \n $this->view->DisplayLogin();\n }\n\n }", "public function doLogInPage() {\n if(!isset($_SESSION['userSession'])) {\n $this->view->show(\"login.php\");\n } else {\n header(\"Location: index.php?loggedstatus=true\");\n }\n }", "public function login() {\n $data['ActivePage'] = \"login\";\n\n $this -> load -> view('repeating/header', $data);\n $this -> load -> view('content/vLogin');\n $this -> load -> view('repeating/footer', $data);\n }" ]
[ "0.7738376", "0.69939405", "0.6855307", "0.67768383", "0.6707028", "0.663314", "0.6601567", "0.65345055", "0.6492113", "0.6464697", "0.6456277", "0.64432764", "0.64289355", "0.63986754", "0.63967943", "0.6371834", "0.63704216", "0.6346257", "0.63419193", "0.6327969", "0.63125306", "0.62627184", "0.62386835", "0.6232016", "0.6222641", "0.621659", "0.6214637", "0.6210719", "0.6203427", "0.619011" ]
0.7255024
1
Check if region has views. Accepts variable amount of arguments as regions.
function region_has_content($region='default' /*...*/) { return CLanaya::Instance()->views->RegionHasView(func_get_args()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function viewExists($view): bool;", "public function hasView(){\n return $this->_has(2);\n }", "public function hasView(){\n return $this->_has(2);\n }", "public function hasContent($region)\n {\n return isset($this->views[$region]);\n }", "public function hasRegions(): bool\n {\n\n return count( $this->_regions ) > 0;\n\n }", "public function hasView()\n {\n return $this->viewName != null;\n }", "public function testAllViewsExists() {\n $views = $this->views['test'];\n foreach ($views as $view => $config) {\n try {\n $this->assertArrayHasKey(\n $view,\n $this->views['system'],\n \"Failed asserting that {$view} view is in the system.\"\n );\n }\n catch (Exception $e) {\n $this->handleAssertException($e);\n }\n }\n // Verify if all views passed the test.\n $this->checkAllAssertionsPassedWholeTest();\n }", "function isValidView($inView) {\n\t\treturn $this->_itemValueInSet($inView);\n\t}", "public function hasView(string $name): bool\n {\n $views = $this->getViews();\n\n return in_array($name, array_column($views, 'name'), true);\n }", "public function getViewForAll() : bool\n {\n return $this->viewForAll;\n }", "public function testViewAccess()\n\t{\n\t\tforeach ($this->views as $key => $name)\n\t\t{\n\t\t\t$this->assertSame( $name, $this->definition->view( $key ) );\n\t\t}\n\t}", "function bbp_is_single_view()\n{\n}", "public function exists ( $view )\n {\n try {\n $this->finder->find ( $view );\n }\n catch ( \\InvalidArgumentException $e ) {\n return false;\n }\n\n return true;\n }", "private function exists($view):bool{\r\n return in_array($view,scandir(Env::app('VIEWS').'Pages'));\r\n }", "public function canUserView()\n\t{\n\t\tfor($i = 0; $i < sizeof($this->_nonViewers); $i++)\n\t\t{\n\t\t\tif($this->_userRole == $this->_nonViewers[$i] && $this->layout != null)\n\t\t\t{\n\t\t\t\t$this->actionIndex();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}", "public function testAllNodeViewModesExists() {\n $view_modes = $this->entities['test']['node']['view modes'];\n foreach ($view_modes as $mode => $value) {\n try {\n $this->assertArrayHasKey(\n $mode,\n $this->entities['system']['node']['view modes'],\n \"Failed asserting that {$mode} view mode exist.\"\n );\n }\n catch (Exception $e) {\n $this->handleAssertException($e);\n }\n }\n // Verify if all view modes passed the test.\n $this->checkAllAssertionsPassedWholeTest();\n }", "public function hasRegionId(){\n return $this->_has(7);\n }", "public function hasView($template) : bool\n {\n try {\n $this->viewFinder->find($template);\n } catch (\\InvalidArgumentException $e) {\n return FALSE;\n }\n\n return TRUE;\n }", "protected function viewExists($view){\n $view_path = ltrim($view, '/');\n $view_file = ROOT . '/private/views/' . $view_path . '.view';\n $exists = is_file($view_file);\n\n if(!$exists){\n foreach (\\sb\\Gateway::$mods as $mod) {\n $m = ROOT . '/mod/' . $mod . '/views/' . $view_path . '.view';\n if (\\is_file($m)) {\n $exists = true;\n $view_file = $m;\n break;\n }\n }\n }\n\n return $exists ? $view_file : false;\n\n }", "function can_view() {\n\t\tif ($this->permissions['all']) {\n\t\t\treturn $this->check_permission($this->permissions['all']);\n\t\t} elseif ($this->permissions['view']) {\n\t\t\treturn $this->check_permission($this->permissions['view']);\n\t\t}\n\n\t\treturn false;\n\t}", "protected function support_views() {\n foreach ($this->get_module_names() as $modname => $modfullname) {\n if (!plugin_supports('mod', $modname, FEATURE_COMPLETION_TRACKS_VIEWS, false)) {\n return false;\n }\n }\n return true;\n }", "public function canView()\n\t{\n\t\treturn $this->source->canView();\n\t}", "function region_blocks_exist($block1 = NULL, $block2 = NULL, $block3 = NULL, $block4 = NULL, $block5 = NULL, $block6 = NULL){\n\t\n\tif(!empty($block1) || !empty($block2) || !empty($block3) || !empty($block4) || !empty($block5) || !empty($block6) )\t{\n\t\treturn TRUE;\n\t}\n\t\n\telse{\n\t\treturn FALSE;\n\t}\n}", "public function match(ViewInterface $view, array $config): bool;", "public function isViewPathEmpty()\n {\n return count(glob($this->getViewPath() . '/*')) == 0;\n }", "public function verifyView()\n {\n // Fetch view definition from database\n try\n {\n $view = self::fetchById( '_design/' . $this->getViewName() );\n }\n catch ( phpillowResponseNotFoundErrorException $e )\n {\n // If the view does not exist yet, recreate it from current view\n $view = $this;\n }\n\n // Force setting of view definitions\n $views = array();\n foreach ( $this->viewDefinitions as $name => $function )\n {\n $views[$name]['map'] = $function;\n\n // Check if there is also a reduce function for the given view\n // function.\n if ( isset( $this->viewReduces[$name] ) )\n {\n $views[$name]['reduce'] = $this->viewReduces[$name];\n }\n }\n\n $view->views = $views;\n $view->save();\n }", "public static function checkRegions($region1,$region2)\r\n\t{\r\n\t\t$arSimpledRegions = array();\r\n\t\tif(class_exists('cityExport')){\r\n\t\t\tif(method_exists(cityExport,'getRegLinks')){\r\n\t\t\t\t$arSimpledRegions = cityExport::getRegLinks();\r\n\t\t\t}\r\n\t\t\tif(method_exists(cityExport,'simpleRegion')){\r\n\t\t\t\t$region1 = cityExport::simpleRegion($region1,$arSimpledRegions);\r\n\t\t\t\t$region2 = cityExport::simpleRegion($region2,$arSimpledRegions);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn ($region1 == $region2 && $region1 !== 'UNDEFINED');\r\n\t}", "public function viewsUpdate() {\n try {\n // check if step has to be performed\n if (!$this->startStep('ViewsUpdate')) return true;\n\n // add additionalviews here...\n $this->updateView('views/content_by_internal_id.view');\n\n // clear views cache\n if (module_exists('views')) {\n views_invalidate_cache();\n }\n\n return $this->endStep('ViewsUpdate');\n }\n catch (Exception $ex) {\n drupal_set_message(t('ViewsUpdate failed: @msg', array('@msg' => $ex->getMessage())), 'error');\n return false;\n }\n }", "public function IsRegion(){\n\t\t$region = true;\n\t\tif($this->AddressLine1Visible)\n\t\t\t$region = false;\n\n\t\tif($this->AddressLine2Visible)\n\t\t\t$region = false;\n\n\t\treturn $region;\n\t}", "public function exists($view)\n {\n try {\n $this->finder->find($view);\n } catch (\\InvalidArgumentException $e) {\n return false;\n }\n return true;\n }" ]
[ "0.6653275", "0.6605145", "0.6605145", "0.6347277", "0.6339758", "0.6295659", "0.61419576", "0.6046409", "0.6029362", "0.5784024", "0.57273185", "0.5690782", "0.5685555", "0.5630374", "0.5619798", "0.5613329", "0.55785006", "0.55511445", "0.5547096", "0.5538461", "0.55026114", "0.54967266", "0.5445271", "0.5424567", "0.5397696", "0.5395793", "0.5382424", "0.5324886", "0.5319912", "0.53063977" ]
0.7707723
0
Filter data according to a filter. Uses CMContent::Filter()
function filter_data($data, $filter) { return CMContent::Filter($data, $filter); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function filter($content);", "public function filters();", "public function filter($filter_param);", "public function filter(\\Magento\\Framework\\DataObject $params);", "public function filterData()\n\t{\n\t\tif( count($this->data) === 0 || count($this->filters) === 0 ) return $this->data;\n\n\t\t$filtered = array();\n\n\t\tforeach( $this->data as $entry )\n\t\t{\n\t\t\tif( $this->applyFilters($entry) ) $filtered[] = $entry;\n\t\t}\n\n\t\treturn $filtered;\n\t}", "public function filter (){\n\n $this->filter = array();\n\n }", "abstract public function filter($value);", "public function getFilter();", "public function filter($value);", "protected function filters()\n {\n }", "private function filter()\n {\n $this->builder->where(function ($builder) {\n collect($this->request->get('filter', []))->each(function ($value, $column) use ($builder) {\n $this->guardFilter($column);\n $this->filterColumn($builder, $column, $value);\n });\n });\n }", "function content_filter($content) {\n global $post;\n return $this->link_filter($content, $post->ID, $post->post_type);\n }", "function filter($data) {\n return $data;\n}", "public function filter(FilterContract $filter);", "function &getFilter()\n {\n // override \n }", "protected function filters(){\n\n }", "public function toFilter();", "public function filters() {\n\n\t}", "public function dataListHasFilter();", "public function filter($results, $key, $filter);", "abstract protected function filterEducation($data);", "public function filter($data)\n {\n return $data;\n }", "abstract public function getFilters();", "public function filters(): array;", "public function getFilter(): array;", "function UserID_Filtering(&$filter) {\n\n\t\t// Enter your code here\n\t}", "function UserID_Filtering(&$filter) {\n\n\t\t// Enter your code here\n\t}", "function UserID_Filtering(&$filter) {\n\n\t\t// Enter your code here\n\t}", "function UserID_Filtering(&$filter) {\n\n\t\t// Enter your code here\n\t}", "function UserID_Filtering(&$filter) {\n\n\t\t// Enter your code here\n\t}" ]
[ "0.74623495", "0.7238272", "0.70774466", "0.6925603", "0.67429465", "0.66084725", "0.65890706", "0.6500001", "0.63971555", "0.6360814", "0.6318916", "0.6308394", "0.6282787", "0.6265386", "0.6261411", "0.6261111", "0.6255359", "0.62451285", "0.62213063", "0.6220403", "0.6215066", "0.61863977", "0.6153677", "0.61091405", "0.6080106", "0.60594195", "0.60594195", "0.60594195", "0.60594195", "0.60594195" ]
0.78348494
0
Connects to the provided server and port. LDAP protocol version is set to 3.
public function connect($server, $port = 389) { $this->conn = @ldap_connect($server, $port); @ldap_set_option($this->conn, LDAP_OPT_PROTOCOL_VERSION, 3); @ldap_set_option($this->conn, LDAP_OPT_REFERRALS, 0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function connect()\n\t{\n\t\tglobal $lang;\n\t\t$this->ldapconn = ldap_connect($this->ldapconfig['host'])\n\t \tor die($lang['posixldapauth_could_not_connect_to_ldap_server']);\n\t\tldap_set_option($this->ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);\n\t\t// set referals to 0 to search the entire AD! - Added April 2014\n\t\t\n\t\tif ($this->ldap_debug) { error_log( __FILE__ . \" \" . __METHOD__ . \" \" . __LINE__ . \" Connected to LDAP Server \" . $this->ldapconfig['host']); }\n\t\treturn 1;\n\t}", "private function connect()\n {\n if( is_resource( $this->resource ) ) return;\n\n $this->resource = ldap_connect( $this->server, $this->port );\n if( $this->active_directory )\n {\n if( false == @ldap_set_option( $this->resource, LDAP_OPT_PROTOCOL_VERSION, 3 ) )\n throw new exc\\ldap( ldap_error( $this->resource ), ldap_errno( $this->resource ) );\n }\n\n if( !( @ldap_bind( $this->resource, $this->username, $this->password ) ) )\n throw new exc\\ldap( ldap_error( $this->resource ), ldap_errno( $this->resource ) );\n }", "public function connect()\n\t{\n\t\tif ( ! is_null($this->connection)) return $this->connection;\n\n\t\t$this->connection = ldap_connect($this->config['server'], $this->config['port']);\n\n\t\tif ($this->connection === false)\n\t\t{\n\t\t\tthrow new \\Exception(\"Connection to Ldap server {$this->server} impossible.\");\n\t\t}\n\n\t\tldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, 3);\n\t\tldap_set_option($this->connection, LDAP_OPT_REFERRALS, 0);\n\t}", "function ldap_connect($hostname = NULL, $port = 389)\n{\n}", "public function connect()\n {\n $port = $this->ssl ? $this::PORT_SSL : $this::PORT;\n\n $hostname = $this->domainController->getHostname();\n\n return $this->connection = ldap_connect($hostname, $port);\n }", "function Connect() {\n\t\t\t\n\t\t\t// Enable error reporting for all errors\n\t\t\terror_reporting(E_ALL);\n\t\t\t$this->_Connection = ldap_connect($this->Server, $this->Port) or die('LDAP Fehler: ' . ldap_error($this->_Connection));\n\t\t\t\n\t\t\t// Set any protokoll options\n\t\t\tldap_set_option($this->_Connection, LDAP_OPT_PROTOKOL_OPTION, $this->ProtokollVersion);\n\t\t\t\n\t\t\t// Try to bind the local user to the serverconnection\n\t\t\tif ($this->UserName != '' && $this->Password != '') {\n\t\t\t\t$this->_UserBinding = ldap_bind($this->_Connection, $this->UserName, $this->Password) or die('LDAP Fehler: ' . ldap_error($this->_Connection));\n\t\t\t}\n\t\t\telse {\n\t\t\t\t\n\t\t\t\t// Try anonymous login\n\t\t\t\t$this->_UserBinding = ldap_bind($this->_Connection);\n\t\t\t}\n\t\t}", "function connect($arguments)\n\t{\t\t\t\t\n \t$this->server_name = $arguments['server_name'];\n \t$this->base_dn = $arguments['base_dn'];\n \t$this->min_uid_number = 1000;\n \t$this->min_gid_number = 1000;\n \t\n \t$this->user_filter = (isset($arguments['user_filter'])) ?\n \t\t$arguments['user_filter'] : '(uid=%USERNAME%)';\n\t\t$this->bind_username = (isset($arguments['bind_username'])) ?\n\t\t\t$arguments['bind_username'] : null;\n\t\t$this->bind_password = (isset($arguments['bind_password'])) ?\n\t\t\t$arguments['bind_password'] : null;\n\n\t\t$admin_username = (isset($arguments['admin_username'])) ?\n\t\t\t$arguments['admin_username'] : $this->bind_username;\n\t\t$admin_password = (isset($arguments['admin_password'])) ?\n\t\t\t$arguments['admin_password'] : $this->bind_password;\n\n\t\tif ($this->server_name == null || $this->base_dn == null) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->conn = ldap_connect($this->server_name);\n\t\tif (ldap_errno($this->conn) !== 0 | $this->conn === FALSE) {\n\t\t\ttrigger_error(ldap_error($this->conn), E_USER_ERROR);\n\t\t}\n\t\t\n\t\t$result = ldap_set_option($this->conn, LDAP_OPT_PROTOCOL_VERSION, 3);\n\t\tif ($result === FALSE) {\n\t\t\ttrigger_error(ldap_error($this->conn), E_USER_ERROR);\n\t\t}\n \t$result = ldap_set_option($this->conn, LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS);\n \tif ($result === FALSE) {\n\t\t\ttrigger_error(ldap_error($this->conn), E_USER_ERROR);\n\t\t}\n \t\n \t// @ldap_start_tls($this->conn);\n \t$result = ldap_bind($this->conn, $this->bind_username, $this->bind_password);\n \tif ($result == FALSE) {\n \t\treturn false;\n \t}\n \t\n\t\tif ($this->bind_username == $admin_username) {\n\t\t\t$this->priv_conn =& $this->conn;\n\t\t} else {\n\t\t\t$this->priv_conn = ldap_connect('ldap://' .$this->server_name, 389);\n\t\t\tldap_set_option($this->priv_conn, LDAP_OPT_PROTOCOL_VERSION, 3);\n\t \tldap_set_option($this->priv_conn, LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS);\n\t \t// @ldap_start_tls($this->priv_conn);\n\t \t$result = ldap_bind($this->priv_conn, $admin_username, $admin_password);\n\t \tif ($result == FALSE) {\n\t \t\treturn false;\n\t \t}\n\t\t}\n\t\t\n \treturn true;\n }", "public function connect()\n {\n //Connection to LDAP\n //ldap_connect always has a return value, even if LDAP is not reachable\n $this->ldapConnection = ldap_connect($this->ldapHost);\n\n //Set options\n ldap_set_option($this->ldapConnection, LDAP_OPT_PROTOCOL_VERSION, 3);\n ldap_set_option($this->ldapConnection, LDAP_OPT_REFERRALS, 0);\n //ldap_set_option($this->ldapConnection, LDAP_OPT_DEBUG_LEVEL, 7);\n\n //StartTLS\n ldap_start_tls($this->ldapConnection);\n\n //Check trough anonymous bind if LDAP is reachable\n if (ldap_bind($this->ldapConnection)) {\n $message = \"connect - Connection to LDAP-Server (\" . $this->ldapHost . \") successfully established.\";\n $this->logger->info($message);\n //$this->setStatus($message, LOGLEVEL::INFO);\n } else {\n $errorMessage = $this->getLdapError(\"connect - Error: Connection to LDAP-Server (\" . $this->ldapHost . \") could not be established.\");\n $this->logger->error($errorMessage);\n //$this->setStatus($errorMessage, LOGLEVEL::ERROR);\n $this->connected = false;\n return false;\n }\n\n //Authentication bind to access data (anonymous cant read)\n if (ldap_bind($this->ldapConnection, $this->ldapUser, $this->ldapPassword)) {\n $message = \"connect - Bind successfull.\";\n $this->logger->info($message);\n //$this->setStatus($message, LOGLEVEL::INFO);\n $this->connected = true;\n } else {\n $errorMessage = $this->getLdapError(\"connect - Error: Bind failed.\");\n $this->logger->error($errorMessage);\n //$this->setStatus($errorMessage, LOGLEVEL::ERROR);\n $this->connected = false;\n return false;\n }\n return true;\n }", "public function connect()\n\t{\n\t\t$this->link\t= ldap_connect($this->host, $this->port)\n\t\t\t\t\t or die (\"Can't connect to \". $this->host . \":\". $this->port . \"!\");\n\t\treturn $this->link;\n\t}", "function ldap_connect_ex() {\r\tglobal $CBT_config;\r\r\t$connection = ldap_connect($CBT_config['ldap_host'], $CBT_config['ldap_port']);\r\tldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION, 3);\r\r\treturn $connection;\r}", "function Ldap($Server, $Port, $ProtokollVersion = 3, $UserName = '', $Password = '') {\n\t\t\t\n\t\t\t// Initialize the local variables\n\t\t\t$this->Server = $Server;\n\t\t\t$this->Port = $Port;\n\t\t\t$this->ProtokollVersion = $ProtokollVersion;\n\t\t\t$this->UserName = $UserName;\n\t\t\t$this->Password = $Password;\n\t\t}", "public function connect() {\n $this->ldapConnexion = ldap_connect($this->uri);\n $this->bind();\n\n return $this->ldapConnexion;\n }", "public function connect() {\n $useSsl = $this->getOption(modActiveDirectoryDriver::OPT_USE_SSL,false);\n $useTls = $this->getOption(modActiveDirectoryDriver::OPT_USE_TLS,false);\n \n // Connect to the AD/LDAP server as the username/password\n $dc = $this->getRandomController();\n if ($useSsl) {\n $this->_conn = ldap_connect(\"ldaps://\".$dc, (int)$this->getOption(modActiveDirectoryDriver::OPT_LDAP_SSL_PORT,636));\n } else {\n $this->_conn = ldap_connect($dc);\n }\n\n // Set some ldap options for talking to AD\n ldap_set_option($this->_conn, LDAP_OPT_PROTOCOL_VERSION, (int)$this->getOption(modActiveDirectoryDriver::OPT_LDAP_PROTOCOL_VERSION,3));\n ldap_set_option($this->_conn, LDAP_OPT_REFERRALS, (int)$this->getOption(modActiveDirectoryDriver::OPT_LDAP_REFERRALS,0));\n ldap_set_option($this->_conn, LDAP_OPT_TIMELIMIT, (int)$this->getOption(modActiveDirectoryDriver::OPT_LDAP_TIMELIMIT,10));\n\n if ($useTls) {\n ldap_start_tls($this->_conn);\n }\n\n // Bind as a domain admin if they've set it up\n $username = $this->getOption(modActiveDirectoryDriver::OPT_ADMIN_USERNAME,'');\n $password = $this->getOption(modActiveDirectoryDriver::OPT_ADMIN_PASSWORD,'');\n $accountSuffix = $this->getOption(modActiveDirectoryDriver::OPT_ACCOUNT_SUFFIX,'@forest.local');\n if (!empty($password) && !empty($password)) {\n $this->_bind = @ldap_bind($this->_conn,$username.$accountSuffix,$password);\n if (!$this->_bind) {\n if ($useSsl && !$useTls) {\n // If you have problems troubleshooting, remove the @ character from the ldap_bind command above to get the actual error message\n $this->modx->log(modX::LOG_LEVEL_ERROR,'Bind to Active Directory failed. Either the LDAPs connection failed or the login credentials are incorrect. AD said: ' . $this->getLastError());\n } else {\n $this->modx->log(modX::LOG_LEVEL_ERROR,'Bind to Active Directory failed. Check the login credentials and/or server details. AD said: ' . $this->getLastError());\n }\n }\n }\n\n $baseDn = $this->getOption(modActiveDirectoryDriver::OPT_BASE_DN,'');\n if (empty($baseDn)) {\n $this->setOption(modActiveDirectoryDriver::OPT_BASE_DN,$this->findBaseDn());\n }\n\n return true;\n }", "private function connectAndBind($port = 389, $tls = false, $ncc = false) {\n\t\tif($ncc) {\n\t\t\t//No certificate check\n\t\t\t//FIXME: undo afterwards\n\t\t\tputenv('LDAPTLS_REQCERT=never');\n\t\t}\n\n\t\t//connect, does not really trigger any server communication\n\t\t\\OCP\\Util::writeLog('user_ldap', 'Wiz: Checking Host Info ', \\OCP\\Util::DEBUG);\n\t\t$host = $this->configuration->ldapHost;\n\t\t$hostInfo = parse_url($host);\n\t\tif(!$hostInfo) {\n\t\t\tthrow new \\Exception($this->l->t('Invalid Host'));\n\t\t}\n\t\tif(isset($hostInfo['scheme'])) {\n\t\t\tif(isset($hostInfo['port'])) {\n\t\t\t\t//problem\n\t\t\t} else {\n\t\t\t\t$host .= ':' . $port;\n\t\t\t}\n\t\t}\n\t\t\\OCP\\Util::writeLog('user_ldap', 'Wiz: Attempting to connect ', \\OCP\\Util::DEBUG);\n\t\t$cr = $this->ldap->connect($host, $port);\n\t\tif(!is_resource($cr)) {\n\t\t\tthrow new \\Exception($this->l->t('Invalid Host'));\n\t\t}\n\n\t\t\\OCP\\Util::writeLog('user_ldap', 'Wiz: Setting LDAP Options ', \\OCP\\Util::DEBUG);\n\t\t//set LDAP options\n\t\t$this->ldap->setOption($cr, LDAP_OPT_PROTOCOL_VERSION, 3);\n\t\t$this->ldap->setOption($cr, LDAP_OPT_NETWORK_TIMEOUT, self::LDAP_NW_TIMEOUT);\n\t\tif($tls) {\n\t\t\t$isTlsWorking = @$this->ldap->startTls($cr);\n\t\t\tif(!$isTlsWorking) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t\\OCP\\Util::writeLog('user_ldap', 'Wiz: Attemping to Bind ', \\OCP\\Util::DEBUG);\n\t\t//interesting part: do the bind!\n\t\t$login = $this->ldap->bind($cr,\n\t\t\t\t\t\t\t\t\t$this->configuration->ldapAgentName,\n\t\t\t\t\t\t\t\t\t$this->configuration->ldapAgentPassword);\n\n\t\tif($login === true) {\n\t\t\t$this->ldap->unbind($cr);\n\t\t\tif($ncc) {\n\t\t\t\tthrow new \\Exception('Certificate cannot be validated.');\n\t\t\t}\n\t\t\t\\OCP\\Util::writeLog('user_ldap', 'Wiz: Bind successfull to Port '. $port . ' TLS ' . intval($tls), \\OCP\\Util::DEBUG);\n\t\t\treturn true;\n\t\t}\n\n\t\t$errno = $this->ldap->errno($cr);\n\t\t$error = ldap_error($cr);\n\t\t$this->ldap->unbind($cr);\n\t\tif($errno === -1 || ($errno === 2 && $ncc)) {\n\t\t\t//host, port or TLS wrong\n\t\t\treturn false;\n\t\t} else if ($errno === 2) {\n\t\t\treturn $this->connectAndBind($port, $tls, true);\n\t\t}\n\t\tthrow new \\Exception($error);\n\t}", "private function __ldapConnect() {\n\t\t$ldapConnection = @ldap_connect($this->settings['ldap_url']);\n\n\t\tif (!$ldapConnection) {\n\t\t\tthrow new CakeException(\"Could not connect to LDAP authentication server\");\n\t\t}\n\n\t\t// avoid protocol mismatch\n ldap_set_option($ldapConnection, LDAP_OPT_PROTOCOL_VERSION, Configure::read('ldap.protocol_version'));\n\n // bind to search user\n @ldap_bind($ldapConnection, Configure::read('ldap.search_dn'), Configure::read('ldap.search_pass'));\n\n\t\treturn $ldapConnection;\n\t}", "public function &connect($params=array())\n {\n if(is_array($params)){\n if(array_key_exists('ldapServer', $params)) $this->ldapServer = $params['ldapServer'];\n if(array_key_exists('ldapServerPort', $params)) $this->ldapServerPort = $params['ldapServerPort'];\n if(array_key_exists('ldapDomain', $params)) $this->ldapDomain = $params['ldapDomain'];\n if(array_key_exists('bindUsername', $params)) $this->bindUsername = $params['bindUsername'];\n if(array_key_exists('bindPassword', $params)) $this->bindPassword = $params['bindPassword'];\n if(array_key_exists('baseDN', $params)) $this->baseDN = $params['baseDN'];\n }\n $ldapConnection = ldap_connect($this->ldapServer, $this->ldapServerPort);\n if($ldapConnection === FALSE){\n errorHandle::newError(__METHOD__.'() - Failed to open LDAP connection. '.ldap_errno($ldapConnection).':'.ldap_error($ldapConnection), errorHandle::HIGH);\n return NULL;\n }else{\n ldap_set_option($ldapConnection, LDAP_OPT_PROTOCOL_VERSION, 3);\n ldap_set_option($ldapConnection, LDAP_OPT_REFERRALS, 0);\n return $ldapConnection;\n }\n }", "function _connect( $host, $username, $password, $ldapbase)\n\t{\n\t\tglobal $LDAP_CONNECT_OPTIONS;\n\n\t\tif ( !function_exists( 'ldap_connect' ) ) return null;\n\n\t\tif (strpos($host,'ldap://') === 0 || strpos($host,'ldaps://') === 0) {\n\t\t\t$this->_connectionID = @ldap_connect($host);\n\t\t} else {\n\t\t\t$conn_info = array( $host,$this->port);\n\n\t\t\tif ( strstr( $host, ':' ) ) {\n\t\t\t\t$conn_info = explode( ':', $host );\n\t\t\t}\n\n\t\t\t$this->_connectionID = @ldap_connect( $conn_info[0], $conn_info[1] );\n\t\t}\n\t\tif (!$this->_connectionID) {\n\t\t\t$e = 'Could not connect to ' . $conn_info[0];\n\t\t\t$this->_errorMsg = $e;\n\t\t\tif ($this->debug) ADOConnection::outp($e);\n\t\t\treturn false;\n\t\t}\n\t\tif( count( $LDAP_CONNECT_OPTIONS ) > 0 ) {\n\t\t\t$this->_inject_bind_options( $LDAP_CONNECT_OPTIONS );\n\t\t}\n\n\t\tif ($username) {\n\t\t\t$bind = @ldap_bind( $this->_connectionID, $username, $password );\n\t\t} else {\n\t\t\t$username = 'anonymous';\n\t\t\t$bind = @ldap_bind( $this->_connectionID );\n\t\t}\n\n\t\tif (!$bind) {\n\t\t\t$e = sprintf($this->_bind_errmsg,ldap_error($this->_connectionID));\n\t\t\t$this->_errorMsg = $e;\n\t\t\tif ($this->debug) ADOConnection::outp($e);\n\t\t\treturn false;\n\t\t}\n\t\t$this->_errorMsg = '';\n\t\t$this->database = $ldapbase;\n\t\treturn $this->_connectionID;\n\t}", "protected function connect() {\n if($this->connection) {\n return false;\n }\n $this->connection = ldap_connect(self::SERVER, self::PORT);\n if(!$this->connection) {\n throw new \\RuntimeException('Could not connect to LDAP server.');\n }\n ldap_bind($this->connection);\n return true;\n }", "function connect($arguments)\n\t{\n\t\t$options = array();\n\t\t// $options['account_suffix'] = '';\n\t\t$options['base_dn'] = $arguments['base_dn'];\n\t\t$options['domain_controllers'] = array($arguments['server_name']);\n\t\t \n\t\tif (isset($arguments['admin_username'])) {\n\t\t\t$options['ad_username'] = $arguments['admin_username'];\n\t\t}\n\t\tif (isset($arguments['admin_password'])) {\n\t\t\t$options['ad_password'] = $arguments['admin_password'];\n\t\t}\n\t\t$options['use_ssl'] = true;\n\t\t$this->ad = new adLDAP($options);\n\n \tif ($this->ad == NULL) {\n \t\treturn FALSE;\n \t} else {\n \t\treturn TRUE;\n \t}\n }", "public function connect($serveraddr, $username, $password);", "function __construct($ldap_server_type,$base_dn,$ldap_server_host_or_url,$ldap_server_port = null)\n\t{\n\t\tglobal $ldap_server_list;\n\n\t\t$ldap_server_list[] = &$this;\n\t\t$this->server_id = count($ldap_server_list)-1;\n\n\t\t// function may be missing if PHP's LDAP module not available - this will be\n\t\t// reported to the user via a subsequent call to prereq_components_ok()\n\t\tif(function_exists(\"ldap_connect\"))\n\t\t\tif(is_null($ldap_server_port))\n\t\t\t\t$this->connection = ldap_connect($ldap_server_host_or_url);\n\t\t\telse\n\t\t\t\t$this->connection = ldap_connect($ldap_server_host_or_url,\n\t\t\t\t\t$ldap_server_port);\n\n\t\t$this->server_type = $ldap_server_type;\n\t\t$this->base_dn = $base_dn;\n\t\t$this->host_or_url = $ldap_server_host_or_url;\n\t\t$this->add_allowed_dn($base_dn);\n\n\t\t$schema_list = \"\";\n\t\tforeach($this->server_types as $server_type)\n\t\t{\n\t\t\tif($server_type[\"name\"] == $this->server_type)\n\t\t\t{\n\t\t\t\t$this->default_create_class = $server_type[\"default_create_class\"];\n\t\t\t\t$schema_list = $server_type[\"schema_list\"];\n\t\t\t\tif(isset($server_type[\"dn_search_filter\"]))\n\t\t\t\t\t$this->dn_search_filter = $server_type[\"dn_search_filter\"];\n\t\t\t\tif(isset($server_type[\"compare_dn_supported\"]))\n\t\t\t\t\t$this->compare_dn_supported = $server_type[\"compare_dn_supported\"];\n\t\t\t}\n\t\t}\n\t\t$schema_list = explode(\",\",$schema_list);\n\n\t\tforeach($schema_list as $schema)\n\t\t\t$this->add_schema($schema);\n\t}", "public function testConnection()\n {\n $connection = ldap_connect(ADLDS_HOST);\n $success = false;\n if ($connection) {\n ldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION, 3);\n if (ldap_bind($connection, ADLDS_BINDDN, ADLDS_PSWD)) {\n $success = true;\n }\n }\n ldap_close($connection);\n\n return $success;\n }", "function ldap_logon($user_name, $user_password)\r\n{\r\n\tglobal $ldap;\r\n\t$connect = null;\r\n\t$result = 3;\r\n\t\r\n\tfor ($i = 0; $i < count($ldap['host']); $i++)\r\n\t{\r\n\t\t$connect = ldap_connect($ldap['host'][$i]);\r\n\t\t\r\n\t\tif ($connect)\r\n\t\t{\r\n\t\t\tldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);\r\n\t\t\tldap_set_option($connect, LDAP_OPT_REFERRALS, 0);\r\n\t\t\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\tif ($connect)\r\n\t{\r\n\t\tif (ldap_bind($connect, $user_name, $user_password))\r\n\t\t{\r\n\t\t\t$result = 0;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$result = 1;\r\n\t\t}\r\n\t\t\r\n\t\tldap_close($connect);\r\n\t}\r\n\r\n\treturn $result;\r\n}", "function ldap_connect($hostname = null, $port = 389)\n{\n\t$mockLdapResource =& MockLdap::$mock;\n\n\t$mockLdapResource->hostname = $hostname;\n\t$mockLdapResource->port = $port;\n\n\tif (isset($mockLdapResource->failConnect)) {\n\t\treturn false;\n\t}\n\n\treturn $mockLdapResource;\n}", "public function __construct($server, $dn)\n {\n $this->server = $server;\n $this->dn = $dn;\n $this->ldap = ldap_connect($this->server);\n }", "protected function _doConnect($url, $port, $bindDn, $bindPw) {\n\t\ttry {\n\t\t\t$ldap = ldap_connect($url, $port) or die(\"Could not connect to $url\");\n\n\t\t\tldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3) or die(\"Could not set ldap protocol\");\n\t\t\tldap_set_option($ldap, LDAP_OPT_REFERRALS, 0) or die(\"Could not set ldap protocol\");\n\t\t\tldap_set_option($ldap, LDAP_OPT_NETWORK_TIMEOUT, 10) or die(\"Could not set ldap protocol\");\n\n\t\t\tif (!$ldap) {\n\t\t\t\tthrow new CakeException(\"Could not connect to LDAP server\");\n\t\t\t}\n\n\t\t\t$bind = @ldap_bind($ldap, $bindDn, $bindPw);\n\n\t\t\tif (!$bind) {\n\t\t\t\tthrow new CakeException(\"Could not bind to LDAP server - check your bind DN and password.\");\n\t\t\t}\n\n\t\t\t$this->_ldap = $ldap;\n\t\t\t$this->_connected = true;\n\n\t\t\t$this->_url = $url;\n\t\t\t$this->_port = $port;\n\t\t\t$this->_bindDn = $bindDn;\n\t\t}\n\t\tcatch (Exception $e) {\n\t\t\t$errorMsg = 'Error occured: ' . $e->getMessage();\n\n\t\t\t$this->ldapError = $errorMsg;\n\t\t\treturn $errorMsg . \"\\n\";\n\t\t}\n\t\t\n\t\treturn true;\n\t}", "private function directory_connect ($authparams) {\n # adLDAP script\n\trequire_once(dirname(__FILE__) . \"/../adLDAP/src/adLDAP.php\");\n $dirparams = Array();\n $dirparams['base_dn'] = @$authparams['base_dn'];\n $dirparams['ad_port'] = @$authparams['ad_port'];\n $dirparams['account_suffix'] = @$authparams['account_suffix'];\n $dirparams['domain_controllers'] = explode(\";\", str_replace(\" \", \"\", $authparams['domain_controllers']));\n // set ssl and tls separate for ldap and AD\n if ($this->ldap) {\n // set ssl and tls\n $dirparams['use_ssl'] = false;\n $dirparams['use_tls'] = false;\n // Support the pre-1.2 auth settings as well as the current version\n // TODO: remove legacy support at some point\n if ($authparams['ldap_security'] == 'tls' || $authparams['use_tls'] == 1) { $dirparams['use_tls'] = true; }\n elseif ($authparams['ldap_security'] == 'ssl' || $authparams['use_ssl'] == 1) { $dirparams['use_ssl'] = true; }\n if (isset($authparams['admin_username']) && isset($authparams['admin_password'])) {\n $dirparams['admin_username'] = $authparams['adminUsername'];\n $dirparams['admin_password'] = $authparams['adminPassword'];\n }\n }\n else {\n $dirparams['use_ssl'] = @$authparams['use_ssl'];\n $dirparams['use_tls'] = @$authparams['use_tls'];\n }\n # open connection\n try {\n # Initialize adLDAP\n $dirconn = new adLDAP($dirparams);\n } catch (adLDAPException $e) {\n $this->Log->write( _(\"Directory connection error\"), _(\"Failed to connect\").\": \" . $e->getMessage(), 2, null);\n $this->Result->show(\"danger\", _(\"Error: \") . $e->getMessage(), true);\n }\n return $dirconn;\n }", "public function __construct ()\r\n {\r\n // getting all parameters\r\n $this->ldap = System::getConfig ('ldap');\r\n // connecting to the server\r\n $this->ds = ldap_connect ($this->ldap['host']);\r\n if (!$this->ds)\r\n throw new GameError ('Unable to connect to ldap server');\r\n // binding to it (you need to bind to general searching user, in order to speed up search)\r\n if (!ldap_bind ($this->ds, $this->ldap['bindRdn'], $this->ldap['bindPass']))\r\n throw new GameError ('Initial bind was unsuccessfull');\r\n }", "public function laminasBind( $username, $password, $ldapType=1 ) {\n\n echo \"username=[$username], password=[$password] <br>\";\n\n //$host = 'a.wcmc-ad.net';\n $userSecUtil = $this->container->get('user_security_utility');\n\n $postfix = $this->getPostfix($ldapType);\n\n $LDAPHost = $userSecUtil->getSiteSettingParameter('aDLDAPServerAddress'.$postfix);\n\n $options = [\n 'host' => $LDAPHost,\n //'username' => 'xxx',\n //'password' => 'xxx',\n //'bindRequiresDn' => false,\n //'bindRequiresDn' => true,\n 'accountDomainName' => $LDAPHost,\n //'baseDn' => 'dc=a,dc=wcmc-ad,dc=net',\n //'baseDn' => 'cn=Users,dc=a,dc=wcmc-ad,dc=net',\n //'baseDn' => 'ou=NYP Users,ou=External,dc=a,dc=wcmc-ad,dc=net',\n //'useSsl' => true,\n //'useStartTls' => true\n ];\n\n $ldap = new \\Laminas\\Ldap\\Ldap($options);\n //$ldap->bind($username, $password);\n\n try {\n $ldap->bind($username, $password);\n //$acctname = $ldap->getCanonicalAccountName($username);\n //$acctname = $ldap->getCanonicalAccountName($username, \\Laminas\\Ldap\\Ldap::ACCTNAME_FORM_DN);\n //echo \"SUCCESS: authenticated $acctname\\n\";\n echo \"SUCCESS: authenticated\";\n return 1;\n } catch (LdapException $zle) {\n echo ' ' . $zle->getMessage() . \"\\n\";\n //if ($zle->getCode() === LdapException::LDAP_X_DOMAIN_MISMATCH) {\n // continue;\n //}\n $this->logger->notice(\"Laminas Bind failed:\" . $zle->getMessage());\n exit(\"Laminas Bind failed:\" . $zle->getMessage());\n\n return NULL;\n }\n\n //dump($ldap);\n //exit('EOF');\n\n //$acctname = $ldap->getCanonicalAccountName($username, \\Laminas\\Ldap\\Ldap::ACCTNAME_FORM_DN);\n\n $acctname = $ldap->getCanonicalAccountName($username, \\Laminas\\Ldap\\Ldap::ACCTNAME_FORM_DN);\n echo \"acctname=[$acctname] <br>\";\n\n //dump($acctname);\n\n echo \"EOF loginLaminasTest <br>\";\n exit('EOF');\n }", "function connect() {\n $this->conn = imap_open('{'.$this->server.'/notls}', $this->user, $this->pass);\n }" ]
[ "0.75409144", "0.7423188", "0.7403675", "0.7206318", "0.7154516", "0.70967215", "0.6875192", "0.6757364", "0.67219", "0.67197907", "0.6701687", "0.6697913", "0.6664101", "0.6620794", "0.65304506", "0.64121306", "0.635697", "0.6271267", "0.6240608", "0.6111375", "0.6048409", "0.60470504", "0.60464984", "0.5956725", "0.56519485", "0.5553979", "0.55091584", "0.54780143", "0.54581195", "0.5447843" ]
0.76527584
0
Deletes an entry at the given DN.
public function delete($dn) { return ldap_delete($this->conn, $dn); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function delete($dn);", "public function ldap_delete($dn) {\n return ldap_delete($this->ldap_conn, $dn);\n }", "public function modDelete($dn, array $entry);", "public function modDel(string $dn, array $entry): self\n {\n return $this->modDelete($dn, $entry);\n }", "public function modDelete(string $dn, array $entry): self\n {\n @ldap_mod_del($this->resource, $dn, $entry);\n $this->verifyOperation();\n\n return $this;\n }", "function deleteEntry() {\n $fullname = hsc(trim($_REQUEST['delete__entry']));\n if (!$this->isAllowedToEditEntry($fullname)) return;\n\n unset($this->doodle[\"$fullname\"]);\n $this->writeDoodleDataToFile();\n $this->template['msg'] = $this->getLang('vote_deleted');\n }", "public function delete(string $dn): self\n {\n @ldap_delete($this->resource, $dn);\n $this->verifyOperation();\n\n return $this;\n }", "protected function dnDelete($dn){\n $result = ldap_delete($this->_conn, $dn);\n return !empty($result);\n }", "public function delete_entry( Entry $entry ) : int {\n\t\tglobal $wpdb;\n\t\t$result = $wpdb->delete( self::$glossary_table_name, array( 'id' => $entry->id ) );\n\n\t\tif ( false === $result ) {\n\t\t\treturn -1;\n\t\t}\n\n\t\treturn $result;\n\t}", "private function deleteEntry( $entry_id ) {\n\n\t\tglobal $wpdb;\n\n\t\t$table = OCF_TABLE_PREFIX . OCF_TABLE;\n\n\t\t$where = array(\n\t\t\t'id_contact_entries' => $entry_id\n\t\t);\n\n\t\t$where_format = array(\n\t\t\t'%d'\n\t\t);\n\n\t\treturn $wpdb->delete( $table, $where, $where_format );\n\n\t}", "public function deleteEntry($entryId)\n {\n\n $this->db->delete( 'simfi_blog_entry', $entryId);\n\n }", "public function delete($rdn)\n\t{\n\t\t$delete = ldap_delete($this->link, $rdn . \",\" . $this->baseDN);\n\t\treturn $delete;\n\t}", "public function deleting(OdometerEntries $entry)\n {\n $entry->deleted_by = Auth::user()->id;\n\n }", "public function delete()\n {\n if ($this->isLoaded) {\n $sqlQuery = \"DELETE FROM `\" . $this->table\n . \"` WHERE $this->primaryKey = ?\";\n\n $statement = self::$dbh->prepare($sqlQuery);\n $statement->execute([$this->data[$this->primaryKey]]);\n $this->isLoaded = false;\n $this->data[$this->primaryKey] = null;\n } else {\n self::$logger->notice(\"You must load an entry before deleting\");\n }\n }", "public function delete(EntryInterface $entry);", "function delete_entry($entry_id)\n\t{\n\t\t$query_string = \"DELETE FROM $this->table_name WHERE id = '\" . $entry_id . \"' RETURNING id;\";\n\t\treturn $this->db_query($query_string);\n\t}", "public function destroy(Entry $entry)\n {\n $entry->delete();\n return redirect(route('home'));\n }", "public function DeleteAssociatedSignupEntry(SignupEntry $objSignupEntry) {\n\t\t\tif ((is_null($this->intId)))\n\t\t\t\tthrow new QUndefinedPrimaryKeyException('Unable to call UnassociateSignupEntry on this unsaved SignupForm.');\n\t\t\tif ((is_null($objSignupEntry->Id)))\n\t\t\t\tthrow new QUndefinedPrimaryKeyException('Unable to call UnassociateSignupEntry on this SignupForm with an unsaved SignupEntry.');\n\n\t\t\t// Get the Database Object for this Class\n\t\t\t$objDatabase = SignupForm::GetDatabase();\n\n\t\t\t// Perform the SQL Query\n\t\t\t$objDatabase->NonQuery('\n\t\t\t\tDELETE FROM\n\t\t\t\t\t`signup_entry`\n\t\t\t\tWHERE\n\t\t\t\t\t`id` = ' . $objDatabase->SqlVariable($objSignupEntry->Id) . ' AND\n\t\t\t\t\t`signup_form_id` = ' . $objDatabase->SqlVariable($this->intId) . '\n\t\t\t');\n\n\t\t\t// Journaling\n\t\t\tif ($objDatabase->JournalingDatabase) {\n\t\t\t\t$objSignupEntry->Journal('DELETE');\n\t\t\t}\n\t\t}", "public function deleteLDAPObject($dname) \n {\n if (!$this->connected) \n {\n $errorMessage = \"deleteLDAPObject - Error: No valid LDAP-Connection.\";\n $this->logger->error($errorMessage);\n //$this->setStatus($errorMessage, LOGLEVEL::ERROR);\n return;\n }\n\n //Deleting the object\n if (ldap_delete($this->ldapConnection, $dname)) \n {\n $message = \"deleteLDAPObject - Object '\" . $dname . \"' successfully deleted.\";\n $this->logger->info($message);\n //$this->setStatus($message, LOGLEVEL::INFO);\n return true;\n } else {\n $errorMessage = $this->getLdapError(\"deleteLDAPObject - Error: Delete of '\" . $dname . \"' failed.\");\n $this->logger->error($errorMessage);\n //$this->setStatus($errorMessage, LOGLEVEL::ERROR);\n return false;\n }\n }", "function delete_entry($ID){\n include('connection.php');\n $sql = 'DELETE FROM entries WHERE id = ?';\n try {\n $results = $db -> prepare($sql);\n $results -> bindValue(1, $ID, PDO::PARAM_INT);\n $results -> execute();\n } catch (Exception $e) {\n echo \"Error: \" . $e -> getMessage() . '<br/>';\n return false;\n }\n return true;\n }", "function ldap_mod_del($link_identifier, $dn, $entry)\n{\n}", "public function delete_d_pkn() {\r\n $where = ' kd_d_pkn=' . $this->get_kd_d_pkn();\r\n $this->db->delete($this->_table, $where);\r\n }", "public function deleteByEntryId($entryId) {\n $adapter = $this->_getWriteAdapter();\n\n return $adapter->delete($this->getMainTable(), array('entry_id = ?' => $entryId));\n }", "public function delete($uid)\n {\n $sql_query = $this->db->where('id', $uid)\n ->delete('careers');\n }", "static function deletePerson($dni) {\n // Abro la conexion\n GestionBDD::conectarBDD();\n\n // Preparo la sentencia SQL\n $query = 'DELETE FROM ' . Constants::$PEOPLE . ' WHERE dni = ?';\n $stmt = GestionBDD::$conexion->prepare($query);\n $stmt->bind_param(\"s\", $val1);\n\n // Valores de la sentencia\n $val1 = $dni;\n\n // Ejecuto y cierro la conexion\n $stmt->execute();\n GestionBDD::cerrarBDD();\n }", "public function delete_entry( $slug )\n\t{\n\t\t$params = array();\n\n\t\t$this->is_auth( true );\n\n\t\t$params['slug'] = $slug;\n\t\t$params['status'] = Post::status( 'published' );\n\t\tif ( $post = Post::get( $params ) ) {\n\t\t\t$post->delete();\n\t\t}\n\t}", "public function delete($entryName) {\n switch ($this->driver) {\n case 'redis':\n $this->oDriver->del($entryName);\n break;\n\n case 'memcached':\n $this->oDriver->delete($entryName);\n break;\n\n case 'file':\n @unlink($this->path . '/' . $entryName . '.tmp');\n break;\n\n default:\n throw \\Exception('The method for delete of cache driver not implemented');\n }\n }", "public function entry_deleted( $entry_id ) {\n\t\tglobal $wpdb;\n\n\t\t//deleting from transaction table\n\t\t$wpdb->delete( \"{$wpdb->prefix}gf_addon_payment_transaction\", array( 'lead_id' => $entry_id ), array( '%d' ) );\n\n\t\t//deleting from callback table\n\t\t$wpdb->delete( \"{$wpdb->prefix}gf_addon_payment_callback\", array( 'lead_id' => $entry_id ), array( '%d' ) );\n\t}", "function delete_entry($target, $type)\n\t{\n\t\tglobal $db;\n\n\t\t$sql = \"DELETE FROM \" . SN_ENTRIES_TABLE . \"\n\tWHERE entry_target = \" . $target . \"\n\tAND entry_type = \" . $type;\n\t\t$db->sql_query($sql);\n\t}", "function deleteEntry()\n {\n return true;\n }" ]
[ "0.74899095", "0.7276746", "0.72161", "0.71151936", "0.68019074", "0.66259575", "0.650543", "0.6282042", "0.6164377", "0.60768324", "0.6050633", "0.6021212", "0.5990013", "0.5982747", "0.5903139", "0.57727855", "0.5750215", "0.57261693", "0.5724476", "0.5649915", "0.5634729", "0.56302047", "0.55856735", "0.5569169", "0.5560886", "0.55494153", "0.55353564", "0.5527775", "0.55029655", "0.5485102" ]
0.7407204
1
Performs a ldapsearch on the provided baseDN with your filter in Subtree scope
public function search($baseDN, $filter = '(objectClass=*)', $attributes = array(), $attrsonly = 0, $sizelimit = 0, $timelimit = 0, $deref = LDAP_DEREF_NEVER) { $result = @ldap_search($this->conn, $baseDN, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref); if (ldap_errno($this->conn)) { throw new LdapException(ldap_error($this->conn), ldap_errno($this->conn)); } return new LdapResult($this->conn, $result); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function searchBase($baseDN, $filter = '(objectClass=*)', $attributes = array(), $attrsonly = 0, $sizelimit = 0, $timelimit = 0, $deref = LDAP_DEREF_NEVER) {\n\t\t$result = @ldap_read($this->conn, $baseDN, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref);\n\t\tif (ldap_errno($this->conn)) {\n\t\t\tthrow new LdapException(ldap_error($this->conn), ldap_errno($this->conn));\n\t\t}\n\n\t\treturn new LdapResult($this->conn, $result);\n\t}", "public function search($filter, $extendedBaseDN = \"\")\n\t{\n\t\t$search\t= ldap_search($this->link, ((trim($extendedBaseDN) != \"\") ? $extendedBaseDN.\",\" : \"\").$this->baseDN, $filter);\n\t\t$result\t= ldap_get_entries($this->link, $search);\n\t\treturn $result;\n\t}", "public function search($baseDN, $filter, $filterArgs = array(), $attributes = array())\n\t{\n\t\t$filteredSearch = self::_replaceFilterArgs($filter, $filterArgs);\n\t\t$result = ldap_search($this->_getLink(), $baseDN, $filteredSearch, $attributes);\n\t\tif ($result)\n\t\t{\n\t\t\t$this->_setResult($result);\n return $this->_createResult();\n\t\t}\n return false;\n\t}", "function LdapSearch($BaseDn, $Filter) {\n\t\t\t\n\t\t\t$this->QueryCount++;\n\t\t\t$result = ldap_search($this->_Connection, $BaseDn, $Filter) or die('LDAP Error: ' . ldap_error($this->_Connection));\n\t\t}", "public function search($baseDn, $filter, $attributes)\n {\n if ($this->config['hideErrors']) {\n return @ldap_search($this->ldapConnection, $baseDn, $filter, $attributes);\n }\n\n return ldap_search($this->ldapConnection, $baseDn, $filter, $attributes);\n }", "public function searchOne($baseDN, $filter = '(objectClass=*)', $attributes = array(), $attrsonly = 0, $sizelimit = 0, $timelimit = 0, $deref = LDAP_DEREF_NEVER) {\n\t\t$result = @ldap_list($this->conn, $baseDN, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref);\n\t\tif (ldap_errno($this->conn)) {\n\t\t\tthrow new LdapException(ldap_error($this->conn), ldap_errno($this->conn));\n\t\t}\n\n\t\treturn new LdapResult($this->conn, $result);\n\t}", "function ldap_search_cms($filter, $base_dn = NULL, $attributes = array()) {\n $ret = array();\n if($this->ldap_conn) {\n $final_base_dn = !empty($base_dn) ? $base_dn : $this->base_dn;\n if($this->ldap_last_search_identifier = ldap_search($this->ldap_conn, $final_base_dn, $filter, $attributes)) {\n $rows = ldap_get_entries($this->ldap_conn, $this->ldap_last_search_identifier);\n if($rows !== FALSE && $rows['count'] > 0) {\n unset($rows['count']);\n $ret = $rows;\n $this->ldap_free_last_result();\n }\n if($rows === FALSE) {\n $this->ldap_handle_error('ldap_get_entries');\n }\n } else {\n $this->ldap_handle_error('ldap_search');\n }\n } else {\n $this->ldap_handle_error('connection');\n }\n return $ret;\n }", "public function ldapSearch(\n $baseDn,\n $filter,\n array $attributes = [],\n int $scope = self::SCOPE_SUBTREE,\n bool $attrsOnly = false,\n int $sizeLimit = 0,\n int $timeLimit = 0,\n int $deref = LDAP_DEREF_NEVER\n ) {\n $function = $this->scopeToFunction($scope);\n // Support for parallel search\n $baseDn = (array)$baseDn;\n $filter = (array)$filter;\n\n // Sanity check... We need to do this ourselves because we are suppressing errors from the\n // ldap function call.\n if (count($baseDn) !== count($filter)) {\n // This is a programmer error - we should raise an error instead of catchable exception\n trigger_error('Array sizes of base DNs and filters do not match', E_USER_ERROR);\n }\n\n // Align the resources to match the amount of baseDns and filters provided\n $resources = array_fill(0, count($baseDn), $this->resource);\n\n $results = @$function(\n $resources,\n $baseDn,\n $filter,\n $attributes,\n $attrsOnly,\n $sizeLimit,\n $timeLimit,\n $deref\n );\n $this->verifyOperation();\n\n // Convert result resources into Result instances\n foreach ($results as $key => $result) {\n if (is_resource($result)) {\n $results[$key] = new Result($this, $result);\n } // Else - let it be whatever it was (probably FALSE - a failed search)\n }\n\n // If there is only one result, this was not a parallel search - return it directly\n return count($results) === 1 ? $results[0] : $results;\n }", "function twpn_search($ldap_domain, $ldap_server, $query_user, $query_password, $filter) {\n\t// global $ldap_domain, $ldap_server;\n \n /**\n * DN (Distinguished Name) is a set of RDN (Relative Distinguished name) comma delimited \n * components. The DN is passed to ldap_search, along with a connection to the ldap\n * server, in order to locate records.\n * Our LDAP DN's are composed of the following RDN's\n * -- OU: Organizational Unit (e.g. \"News\", \"Natl Politics and Gov\", \"TWPN\")\n * -- DC: Domain component (e.g. my.ldap.system.com -> dc=my,dc=ldap,dc=system,dc=com)\n * -- CN: Common Name (e.g. \"username\". NOTE: in PHP ldap_search, CN filters (e.g. CN=*, \n * CN=username in DN cause search to hang))\n * Other RDNs exist (e.g. STREET, ST (state), C (Country), UID (User id)) but are not used by \n * our DN system. Rather, these components are stored in various ldap attributes (countryCode, \n * employeeID, etc.)\n *\n * In addition to passing DC's that point to the ldap domain, we pass OU=TWPN, an \n * Organizational unit which includes all users */\n\n //parse domain into dc's, then contruct dn string from those dc's and TWPN OU\n $domain_dcs = domain_to_dcs($ldap_domain);\n $ldap_dn = \"OU=TWPN,\".$domain_dcs;\n \n // Connect to the ldap AD (Active directory)\n $ldap = ldap_connect($ldap_server) or die(\"Could not connect to LDAP\");\n // Authenticate by binding user credentials to ldap domain\n ldap_bind($ldap, $query_user.\"@\".$ldap_domain, $query_password) or die(\"Could not bind to LDAP\");\n\n /** \n * Search using TWPN DN and filter.\n * Filters search ldap attributes (e.g. objectClass, group, cn, displayName, countryCode, etc)\n * Filters can use logical operators &, |, ! as well as <=, >= (all attributes are strings, so * these are lexicographal comparisons), = and ~= (approx equal to, unclear on how this\n * functions). Example filter strings:\n * \"(attr1=val1)\" attr1 has value val1\n * \"!(attr1=val1)\" attr1 has any value but val1\n * \"(&(attr1=val1)(attr2=val2))\" attr1 has value val1 AND attr2 has value val2\n * \"((|(attr1=val1)(attr1=val2))(!attr3=val3))\" attr1 has value val1 OR val2 AND attr3 is not \n * equal to val3\n */\n $results = ldap_search($ldap,$ldap_dn,$filter);\n $entries = ldap_get_entries($ldap, $results);\n if($entries['count'] == 0) return false;\n \t\n return $entries;\n}", "function _search($filter, $dn, & $attributes) {\r\n\t\t$resource = $this->_resource;\n\t\taddLogEntry('Joomla! LDAP Library Mambot', 'search', 'debug', 'Searching for '. $filter .' in DN '. $dn);\r\n\t\t$search_result = ldap_search($resource, $dn, $filter);\n\t\taddLogEntry('Joomla! LDAP Library Mambot', 'search', 'debug', 'Got search result of '. print_r($search_result,1));\r\n\t\taddLogEntry('LDAP Library', 'search', 'debug', 'Search for '. $filter . ' in '. $dn . ' returned ' . $search_result . ' with '. ldap_count_entries($resource, $search_result) .' results');\r\n\t\tif ($search_result && ($count = ldap_count_entries($resource, $search_result)) > 0) {\r\n\t\t\tfor ($i = 0; $i < $count; $i++) {\r\n\t\t\t\t$attributes[$i] = Array ();\r\n\t\t\t\tif (!$i) {\r\n\t\t\t\t\t$firstentry = ldap_first_entry($resource, $search_result);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$firstentry = ldap_next_entry($resource, $firstentry);\r\n\t\t\t\t}\r\n\t\t\t\t$attributes_array = ldap_get_attributes($resource, $firstentry); // load user-specified attributes\r\n\t\t\t\t// ldap returns an array of arrays, fit this into attributes result array\r\n\t\t\t\tforeach ($attributes_array as $ki => $ai) {\r\n\t\t\t\t\tif (is_array($ai)) {\r\n\t\t\t\t\t\t$subcount = $ai['count'];\r\n\t\t\t\t\t\t$attributes[$i][$ki] = Array ();\r\n\t\t\t\t\t\tfor ($k = 0; $k < $subcount; $k++) {\r\n\t\t\t\t\t\t\t$attributes[$i][$ki][$k] = $ai[$k];\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$attributes[$i]['dn'] = ldap_get_dn($resource, $firstentry);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public function search($dn, $filter, $attributes, $options = array()) {\n\t\tif (!$this->connected()) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$options = am(array(\n\t\t\t'subtree' => true\n\t\t), $options);\n\n\n\t\t// attributes array must be formatted in incremental numbered keys (0,1,...)\n\t\t// otherwise ldap_search() fails with error\n\t\t$attributes = array_values($attributes);\n\n\t\tif ($this->_sizeLimit != 0) {\n\t\t\t// $pageSize = $this->_sizeLimit;\n\t\t\tldap_control_paged_result($this->_ldap, $this->_sizeLimit, true);\n\n\t\t\t$sr = @ldap_search($this->_ldap, $dn, $filter, $attributes, 0, $this->_sizeLimit);\n\t\t\tif (!is_resource($sr)) {\n\t\t\t\tCakeLog::write('debug', 'LDAP testing failed, $dn:'.Debugger::exportVar($dn).' $filter: ' . Debugger::exportVar($filter) . ' Attributes: ' . Debugger::exportVar($attributes));\n\n\t\t\t\t$data = [\n\t\t\t\t\t'count' => 0\n\t\t\t\t];\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$data = ldap_get_entries($this->_ldap, $sr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t$cacheStr = 'ldap_results_'. $this->_url . '_' . $this->_port . '_' . $dn . '_' . $filter . '_' . (implode('_', $attributes));\n\t\t\t$cacheStr = sha1($cacheStr);\n\n\t\t\tif (($data = Cache::read($cacheStr, 'ldap')) === false) {\n\n\t\t\t\t$pageSize = 1000;\n\t\t\t\t$data = array();\n\t\t\t\t$cookie = '';\n\t\t\t\t$count = 0;\n\t\t\t\t$i = 0;\n\t\t\t\tdo {\n\t\t\t\t\tldap_control_paged_result($this->_ldap, $pageSize, true, $cookie);\n\n\t\t\t\t\tif ($options['subtree']) {\n\t\t\t\t\t\t$sr = ldap_search($this->_ldap, $dn, $filter, $attributes);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$sr = ldap_list($this->_ldap, $dn, $filter, $attributes);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$entries = ldap_get_entries($this->_ldap, $sr);\n\n\t\t\t\t\t$count += array_shift($entries);\n\t\t\t\t\t$data = array_merge($data, $entries);\n\n\t\t\t\t\tldap_control_paged_result_response($this->_ldap, $sr, $cookie);\n\t\t\t\t\t\n\t\t\t\t\t$i++;\n\t\t\t\t} while ($cookie !== null && $cookie != '');\n\n\t\t\t\t// $data = array('count' => $count) + $data;\n\t\t\t\t$data = array_merge([\n\t\t\t\t\t'count' => $count\n\t\t\t\t], $data);\n\n\t\t\t\tCache::write($cacheStr, $data, 'ldap');\n\t\t\t\tCache::write('last_cache_update', ['time' => time()], 'ldap');\n\t\t\t}\n\t\t}\n\n\t\t$this->_lastSearch = array(\n\t\t\t'dn' => $dn,\n\t\t\t'filter' => $filter,\n\t\t\t'attributes' => $attributes,\n\t\t);\n\n\t\treturn $data;\n\t}", "function search($filters, $dnoverride = null) {\r\n\t\t$result = array ();\r\n\t\tif ($dnoverride) {\r\n\t\t\t$dn = $dnoverride;\r\n\t\t} else {\r\n\t\t\t$dn = $this->base_dn;\r\n\t\t}\r\n\r\n\t\tforeach ($filters as $search_filter) {\r\n\t\t\t$dn_list = explode(';', $dn);\r\n\t\t\tforeach ($dn_list as $dn) {\r\n\t\t\t\t$this->_search($search_filter, $dn, $result);\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $result;\r\n\t}", "function authValidateUserCallback(&$ldap, $base_dn, $dn, $user_search,\n $user, &$object)\n{\n authLdapDebug(\"authValidateUserCallback: base_dn '$base_dn' \".\n \"dn '$dn' user '$user'\");\n\n $pass = $object['pass'];\n\n // try an authenticated bind\n // use this to confirm that the user/password pair\n if ($dn && @ldap_bind($ldap, $dn, $pass))\n {\n $filter = $object['config']['ldap_filter'];\n\n // however if there is a filter check that the\n // user is part of the group defined by the filter\n if (! $filter)\n {\n authLdapDebug(\"authValidateUserCallback: Successful authenticated \".\n \"bind with no \\$ldap_filter\");\n return true;\n }\n else\n {\n authLdapDebug(\"authValidateUserCallback: Successful authenticated \".\n \"bind checking '$filter'\");\n\n // If ldap_filter_base_dn is set, set the filter to search for the user\n // in the given base_dn (OpenLDAP). If not, read from the user\n // attribute (AD)\n if (isset($object['config']['ldap_filter_base_dn']))\n {\n $f = \"(&(\".\n $object['config']['ldap_filter_user_attr'].\n \"=$user)($filter))\";\n $filter_dn = $object['config']['ldap_filter_base_dn'];\n $call = 'ldap_search';\n }\n else\n {\n $f = \"($filter)\";\n $filter_dn = $dn;\n $call = 'ldap_read';\n }\n\n authLdapDebug(\"authValidateUserCallback: Trying filter: $f: \".\n \"dn: $filter_dn: method: $call\");\n\n $res = $call(\n $ldap,\n $filter_dn,\n $f,\n array()\n );\n if (@ldap_count_entries($ldap, $res) > 0)\n {\n authLdapDebug(\"authValidateUserCallback: Found entry with filter\");\n return true;\n }\n authLdapDebug(\"authValidateUserCallback: No entry found with filter\");\n }\n }\n else\n {\n authLdapDebug(\"authValidateUserCallback: Bind to '$dn' failed: \".ldap_error($ldap));\n }\n\n if ($ldap_unbind_between_attempts)\n {\n @ldap_unbind($ldap);\n }\n\n // return failure if no connection is established\n return false;\n}", "public function search($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0);", "public function searchEntries($filter,$params=array())\n {\n // Process user input parameters\n $baseDN = (array_key_exists('baseDN', $params)) ? $params['baseDN'] : $this->baseDN;\n $sizeLimit = (array_key_exists('sizeLimit', $params)) ? $params['sizeLimit'] : 0;\n $timeLimit = (array_key_exists('timeLimit', $params)) ? $params['timeLimit'] : 0;\n $attributes = (array_key_exists('listAttributes', $params) and $params['listAttributes'])\n ? array()\n : ((array_key_exists('attributes', $params))\n ? ((is_array($params['attributes']))\n ? $params['attributes']\n : explode(',',$params['attributes']))\n : array('dn'));\n $sort = (array_key_exists('sort', $params))\n ? (is_array($params['sort']))\n ? array_reverse($params['sort'])\n : array_reverse(explode(',',$params['sort']))\n : array('dn');\n\n // Catch the 'ALL' attributes use-case\n if(in_array('*', $attributes)) $attributes=array();\n\n // Build the filter string (if needed)\n if(!preg_match('/^\\(+([\\|&])/', $filter)) $filter = self::buildFilterString($filter);\n\n // If we're not connected, connect now\n if(!$this->ldap){\n $connParams = (array_key_exists('connection', $params)) ? $params['connection'] : NULL;\n if(!$this->ldap =& $this->connect($connParams)){\n return array();\n }\n }\n\n // Do the LDAP search\n $ldapSearch = ldap_search($this->ldap, $baseDN, $filter, (array)$attributes, 0, $sizeLimit, $timeLimit, LDAP_DEREF_ALWAYS);\n if(!$ldapSearch){\n errorHandle::newError(__METHOD__.\"() - Failed to search ldap directory. LDAP Error:\".ldap_error($this->ldap), errorHandle::MEDIUM);\n return array();\n }\n\n // Do we need to sort the results?\n if(isset($sort)){\n foreach ($sort as $sortBy) {\n if (in_array($sortBy, $attributes)) { // make sure we sort against an existing field\n ldap_sort($this->ldap, $ldapSearch, $sortBy);\n }\n }\n }\n\n // Are we returning the raw result, or the cleaned 'pretty' version?\n $entries = ldap_get_entries($this->ldap, $ldapSearch);\n if(array_key_exists('returnRaw', $params) and $params['returnRaw']){\n // Return the RAW result of ldap_get_entries()\n return $entries;\n }else{\n // Return a cleaned, formatted, results array\n return $this->formatSearchResults($entries, $attributes);\n }\n }", "public function query($filter, $scope, $attributes = array(), $limit = 200)\n {\n // This performs the search for a specified filter on the directory with the scope of LDAP_SCOPE_SUBTREE\n // error suppression added because ldap_search throws WARNINGs when the search limit is hit\n $result = @ldap_search($this->link, $scope, $filter, $attributes, 0, $limit);\n if (! $result) {\n return false;\n }\n return new Coe_Ldap_Result($this->link, $result);\n }", "function searchOnLDAP($correo, $member_name, $member_pwd)\r\n{\r\n\t$resultado = '';\r\n\t$ldap = ldap_connect(\"euedcadsls01.ls.ege.ds\");\r\n\tldap_set_option ($ldap, LDAP_OPT_REFERRALS, 0);\r\n\tldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);\r\n\tif (@$bind = ldap_bind($ldap, \"ls\\\\\".$member_name, $member_pwd)) \t\r\n\t{\r\n\t\t//Credentials work now let's do LDAP query for data.....LDAP parameters\r\n\t\t//$ldap_dn = 'OU=Users,OU=PBL,OU=MX,DC=ls,DC=ege,DC=ds';\r\n\t\t$ldap_dn = 'DC=ls,DC=ege,DC=ds';\r\n\t\t//$attributes = array(\"displayname\", \"mail\", \"samaccountname\");\r\n\t\t$attributes = array(\"displayname\"); \r\n\t\t//$filter = \"(&(objectCategory=person)(sAMAccountName=$member_name))\";\r\n\t\t$filter = \"(&(objectCategory=person)(mail=$correo))\";\r\n\t\t$result = ldap_search($ldap, $ldap_dn, $filter, $attributes);\r\n\t\t$entries = ldap_get_entries($ldap, $result);\r\n\t\t$entries_clean = rCountRemover($entries);\r\n\t\tif(isset($entries_clean[0]['displayname']))\r\n\t\t{\r\n\t\t\t$resultado= str_replace(' (external)', '', $entries_clean[0]['displayname'][0]);\r\n\t\t}\t\t \r\n\t\t//$resultado[1] = $entries_clean[0]['mail'][0]; \r\n\t\t//$resultado[2] = $entries_clean[0]['samaccountname'][0]; \r\n\t\treturn $resultado;\r\n\t}\r\n}", "public function testSingleLevelSearch()\n {\n $bdn = 'cn=admin,dc=demo,dc=squiz,dc=net';\n $pass = 'squiz';\n $conn = LDAP::connectToLDAP('localhost', 389, $bdn, $pass);\n\n // Should only get the 'Staff' group.\n $start = 'c=au,dc=demo,dc=squiz,dc=net';\n $filter = '(objectClass=*)';\n $multiLevel = FALSE;\n $sr = LDAP::search($conn, $start, $filter, $multiLevel);\n $count = LDAP::getNumEntries($conn, $sr);\n PHPUnit_Framework_Assert::assertEquals(1, $count);\n\n $entries = LDAP::getEntries($conn, $sr);\n $data = LDAP::getData($entries);\n $expected = 'o=Squiz,c=au,dc=demo,dc=squiz,dc=net';\n PHPUnit_Framework_Assert::assertEquals($expected, $data[0]['dn']);\n\n }", "public function search($query) {\n $ldap = ldap_connect(Configure::read('Ldap.host'));\n \n if($ldap) {\n ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, Configure::read('Ldap.protocol'));\n \n if(ldap_bind($ldap)) {\n $result = ldap_search($ldap,\n Configure::read('Ldap.searchbase'),\n \"(&(objectclass=\". Configure::read('Ldap.objectclass') .\")(cn=*\" . $query . \"*))\");\n \n $entries = ldap_get_entries($ldap, $result);\n \n $this->set('people', $entries);\n \n ldap_unbind($ldap);\n } else {\n $this->Session->setFlash(\"Could not find directory server\", '', array(), 'error');\n }\n }\n }", "function _pm_search(&$data,$base,$func,$opts,$dir='',$lvl=1){\n $dirs = array();\n $files = array();\n\n //read in directories and files\n $dh = @opendir($base.'/'.$dir);\n if(!$dh) return;\n while(($file = readdir($dh)) !== false){\n if(preg_match('/^\\./',$file)) continue; //skip hidden files and upper dirs\n if(is_dir($base.'/'.$dir.'/'.$file)){\n $dirs[] = $dir.'/'.$file;\n continue;\n }\n $files[] = $dir.'/'.$file;\n }\n closedir($dh);\n sort($files);\n sort($dirs);\n\n //give directories to userfunction then recurse\n foreach($dirs as $dir){\n if ($this->$func($data,$base,$dir,'d',$lvl,$opts)){\n $this->_pm_search($data,$base,$func,$opts,$dir,$lvl+1);\n }\n }\n //now handle the files\n foreach($files as $file){\n $this->$func($data,$base,$file,'f',$lvl,$opts);\n }\n }", "function _ldap_search($search, $email = False)\n {\n global $ldap_server, $ldap_search;\n\n $ret = array();\n $ds = ldap_connect($ldap_server);\n if ($ds)\n {\n // Explictly set the protocol version to prevent bind errors\n ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);\n $r = ldap_bind($ds);\n $sr = ldap_search($ds, $ldap_search, $search);\n $info = ldap_get_entries($ds, $sr);\n\n for ($i = 0; $i < $info[\"count\"]; $i++)\n {\n // Strictly speaking we could set anything as the key here, since only the first record is used in e.g. _get_email_fn\n // But as the logic maps fedid=>email, use similar keys here\n $fedid = $info[$i]['uid'][0];\n if ($email)\n {\n $ret[$fedid] = array_key_exists('mail', $info[$i]) ? $info[$i]['mail'][0] : '';\n }\n else\n $ret[$fedid] = $info[$i]['givenname'][0] . ' ' . $info[$i]['sn'][0];\n }\n\n ldap_close($ds);\n }\n return $ret;\n }", "function compare_dn_to_base($dn,$base_dn)\n\t{\n\t\t$test_rdn_list = ldap_explode_dn($dn,0);\n\n\t\t// Handle case where $dn couldn't be parsed into\n\t\t// a list of RDNs - ldap_explode_dn() returns false.\n\t\tif(gettype($test_rdn_list)!=\"array\")\n\t\t\t$test_rdn_list = array(\"count\"=>1,0=>$dn);\n\n\t\t$base_rdn_list = ldap_explode_dn($base_dn,0);\n\n\t\t$base_rdn_count = $base_rdn_list[\"count\"];\n\n\t\t$dn_base_section = implode(array_slice($test_rdn_list,\n\t\t\t-$base_rdn_count),\",\");\n\n\t\tif($base_dn == \"\")\n\t\t\treturn true;\n\t\tif($this->compare_dn_supported)\n\t\t\treturn @ldap_compare($this->connection,\n\t\t\t\t$base_dn,\"DN\",$dn_base_section);\n\t\telse\n\t\t\treturn !strcasecmp($dn_base_section,$base_dn);\n\t}", "public function testSearch()\n {\n $bdn = 'cn=admin,dc=demo,dc=squiz,dc=net';\n $pass = 'squiz';\n $conn = LDAP::connectToLDAP('localhost', 389, $bdn, $pass);\n\n $start = 'ou=Staff,o=Squiz,c=au,dc=demo,dc=squiz,dc=net';\n $filter = '(objectClass=*)';\n $sr = LDAP::search($conn, $start, $filter);\n $count = LDAP::getNumEntries($conn, $sr);\n PHPUnit_Framework_Assert::assertEquals(12, $count);\n\n $entries = LDAP::getEntries($conn, $sr);\n $data = LDAP::getData($entries);\n $dn = array();\n foreach ($data as $d) {\n $dn[] = $d['dn'];\n }\n\n sort($dn);\n $expected = array(\n 'ou=Staff,o=Squiz,c=au,dc=demo,dc=squiz,dc=net',\n 'uid=Manager,ou=Staff,o=Squiz,c=au,dc=demo,dc=squiz,dc=net',\n 'uid=aschwarzenegger,ou=Staff,o=Squiz,c=au,dc=demo,dc=squiz,dc=net',\n 'uid=blee,ou=Staff,o=Squiz,c=au,dc=demo,dc=squiz,dc=net',\n 'uid=jchan,ou=Staff,o=Squiz,c=au,dc=demo,dc=squiz,dc=net',\n 'uid=jrabbit,ou=Staff,o=Squiz,c=au,dc=demo,dc=squiz,dc=net',\n 'uid=jroberts,ou=Staff,o=Squiz,c=au,dc=demo,dc=squiz,dc=net',\n 'uid=mgibson,ou=Staff,o=Squiz,c=au,dc=demo,dc=squiz,dc=net',\n 'uid=mmonroe,ou=Staff,o=Squiz,c=au,dc=demo,dc=squiz,dc=net',\n 'uid=nkidman,ou=Staff,o=Squiz,c=au,dc=demo,dc=squiz,dc=net',\n 'uid=sjohansson,ou=Staff,o=Squiz,c=au,dc=demo,dc=squiz,dc=net',\n 'uid=sstallone,ou=Staff,o=Squiz,c=au,dc=demo,dc=squiz,dc=net',\n );\n PHPUnit_Framework_Assert::assertEquals($expected, $dn);\n\n }", "function getUserRecord_dn($dn) {\n\t\t$filter = \"(&(objectCategory=person)(objectClass=user))\";\n\t\t$result = ldap_search($this->ldapconn, $dn, $filter, $this->justthese)\n\t\t\t\tor die(\"ERROR: Failed to search the AD Tree.\");\n\n\t\t$entries = ldap_get_entries($this->ldapconn, $result);\n\t\t//print_r($entries);\n\n\t\tif ($entries[\"count\"] > 0)\n\t\t{\n\t\t\t$exclude = count(array_intersect($this->excludegroups, $entries[0]['memberof']));\n\t\t\t$accountDisabled = (isset($entries[0]['useraccountcontrol']) and (((int)$entries[0]['useraccountcontrol'][0] & 2) != 2));\n\t\t\tif(($exclude == 0) and $accountDisabled){\n\t\t\t\t$user_name = strtolower($entries[0]['samaccountname'][0]);\n\t\t\t\t$entries[0]['user_picture'] = site_url(\"images/profile/$user_name\");\n\t\t\t\t$entries[0]['i_department'] = $this->getUserDepartment($entries[0]['samaccountname'][0]);\n\n\t\t\t\treturn $entries[0];\n\t\t\t}\n\t\t}\n\n\t\treturn FALSE;\n\t}", "function authLdapGetEmailCallback(&$ldap, $base_dn, $dn, $user_search,\n $user, &$object)\n{\n $email_attrib = $object['config']['ldap_email_attrib'];\n\n authLdapDebug(\"authLdapGetEmailCallback: base_dn '$base_dn' dn '$dn' \".\n \"user_search '$user_search' user '$user'\");\n\n if ($ldap && $base_dn && $dn && $user_search)\n {\n $res = @ldap_read(\n $ldap,\n $dn,\n \"(objectclass=*)\",\n array(utf8_strtolower($email_attrib))\n );\n if (@ldap_count_entries($ldap, $res) > 0)\n {\n authLdapDebug(\"authLdapGetEmailCallback: search successful\");\n $entries = ldap_get_entries($ldap, $res);\n $object['email'] = $entries[0][utf8_strtolower($email_attrib)][0];\n\n authLdapDebug(\"authLdapGetEmailCallback: email is '\".\n $object['email'].\"'\");\n \n return true;\n }\n }\n return false;\n}", "public function search() {\n\t\t// @todo Please modify the following code to remove attributes that should not be searched.\n\n\t\t$criteria = new CDbCriteria;\n\n\t\t$criteria->compare('id', $this->id);\n\t\t$criteria->compare('child_urn', $this->child_urn, true);\n\t\t$criteria->compare('child_urn_prefix', $this->child_urn_prefix, true);\n\t\t$criteria->compare('child_urn_suffix', $this->child_urn_suffix, true);\n\t\t$criteria->compare('first_name', $this->first_name, true);\n\t\t$criteria->compare('middle_name', $this->middle_name, true);\n\t\t$criteria->compare('last_name', $this->last_name, true);\n\t\t$criteria->compare('preffered_name', $this->preffered_name, true);\n\t\t$criteria->compare('address_1', $this->address_1, true);\n\t\t$criteria->compare('address_2', $this->address_2, true);\n\t\t$criteria->compare('address_3', $this->address_3, true);\n\t\t$criteria->compare('postcode', $this->postcode, true);\n\t\t$criteria->compare('dob', $this->dob, true);\n\t\t$criteria->compare('birth_certificate', $this->birth_certificate, true);\n\t\t$criteria->compare('is_term_time', $this->is_term_time, true);\n\t\t$criteria->compare('is_funding', $this->is_funding, true);\n\t\t$criteria->compare('booking_type', $this->booking_type, true);\n\t\t$criteria->compare('enroll_date', $this->enroll_date, true);\n\t\t$criteria->compare('start_date', $this->start_date, true);\n\t\t$criteria->compare('leave_date', $this->leave_date, true);\n\t\t$criteria->compare('gender', $this->gender, true);\n\t\t$criteria->compare('client_id', $this->client_id);\n\t\t$criteria->compare('profile_photo', $this->profile_photo, true);\n\t\t$criteria->compare('profile_photo_thumb', $this->profile_photo_thumb, true);\n\t\t$criteria->compare('branch_id', Yii::app()->session['branch_id']);\n\t\t$criteria->compare('is_deleted', $this->is_deleted);\n\t\t$criteria->compare('is_active', $this->is_active);\n\t\t$criteria->compare('room_id', $this->room_id);\n\t\t$criteria->compare('key_person', $this->key_person);\n\t\t$criteria->compare('discount', $this->discount);\n\t\t$criteria->compare('funded_hours', $this->funded_hours);\n\t\t$criteria->compare('link_to_staff', $this->link_to_staff, true);\n\t\t$criteria->compare('sibling_id', $this->sibling_id);\n\t\t$criteria->compare('preffered_session', $this->preffered_session);\n\t\t$criteria->compare('latitude', $this->latitude, true);\n\t\t$criteria->compare('longitude', $this->longitude, true);\n\t\t$criteria->compare('monthly_invoice_amount', $this->monthly_invoice_amount);\n\t\t$criteria->compare('external_id', $this->external_id);\n\t\t$criteria->compare('monthly_invoice_start_date', $this->monthly_invoice_start_date, true);\n\t\t$criteria->compare('monthly_invoice_finish_date', $this->monthly_invoice_finish_date, true);\n\t\t$criteria->compare('is_lac', $this->is_lac);\n\t\t$criteria->compare('is_pupil_premium', $this->is_pupil_premium);\n\n\t\treturn new CActiveDataProvider($this, array(\n\t\t\t'criteria' => $criteria,\n\t\t\t'pagination' => array(\n\t\t\t\t'pageSize' => 20,\n\t\t\t)\n\t\t));\n\t}", "public function listEntries($filter,$params=array())\n {\n // Process user input parameters\n $baseDN = (array_key_exists('baseDN', $params)) ? $params['baseDN'] : $this->baseDN;\n $sizeLimit = (array_key_exists('sizeLimit', $params)) ? $params['sizeLimit'] : 0;\n $timeLimit = (array_key_exists('timeLimit', $params)) ? $params['timeLimit'] : 0;\n $attributes = (array_key_exists('listAttributes', $params) and $params['listAttributes'])\n ? array()\n : ((array_key_exists('attributes', $params))\n ? ((is_array($params['attributes']))\n ? $params['attributes']\n : explode(',',$params['attributes']))\n : array('dn'));\n $sort = (array_key_exists('sort', $params))\n ? (is_array($params['sort']))\n ? array_reverse($params['sort'])\n : array_reverse(explode(',',$params['sort']))\n : array('dn');\n\n // Catch the 'ALL' attributes use-case\n if(in_array('*', $attributes)) $attributes=array();\n\n // Build the filter string (if needed)\n if(!preg_match('/^\\(+([\\|&])/', $filter)) $filter = self::buildFilterString($filter);\n\n // If we're not connected, connect now\n if(!$this->ldap){\n $connParams = (array_key_exists('connection', $params)) ? $params['connection'] : NULL;\n if(!$this->ldap =& $this->connect($connParams)){\n return array();\n }\n }\n\n // Do the LDAP search\n $ldapSearch = ldap_list($this->ldap, $baseDN, $filter, (array)$attributes, 0, $sizeLimit, $timeLimit,LDAP_DEREF_ALWAYS);\n if(!$ldapSearch){\n errorHandle::newError(__METHOD__.\"() - Failed to search ldap directory. \".ldap_errno($this->ldap).':'.ldap_error($this->ldap), errorHandle::MEDIUM);\n return array();\n }\n\n // Do we need to sort the results?\n if(isset($sort)){\n foreach ($sort as $sortBy) {\n if (in_array($sortBy, $attributes)) { // make sure we sort against an existing field\n ldap_sort($this->ldap, $ldapSearch, $sortBy);\n }\n }\n }\n\n // Are we returning the raw result, or the cleaned 'pretty' version?\n $entries = ldap_get_entries($this->ldap, $ldapSearch);\n if(array_key_exists('returnRaw', $params) and $params['returnRaw']){\n // Return the RAW result of ldap_get_entries()\n return $entries;\n }else{\n // Return a cleaned, formatted, results array\n return $this->formatSearchResults($entries, $attributes);\n }\n }", "function groupSearchRun(&$db, &$u, &$arg, &$t) {\n\n\t\t$arg->getvars[gid] != ''? $gid = $arg->getvars[gid]:$gid = $arg->postvars[gid];\n\n\t\t//patch for broken groups/suspended accounts\n\t\tif ($gid == '') { $or = \" or groups = '' \"; }\n\t\t$t[start] = $arg->getvars[start];\n\t\tsettype($t[start],\"integer\");\n\n\n\t\t$db->query(\"select *, lc.username as lc_username from lcUsers as lc LEFT JOIN profile on lc.username = profile.username where groups like '%|\".$gid.\"|%' $or order by lc.username LIMIT \".$t[start].\",\".$this->PAGE_SIZE);\n\t\twhile ($db->next_record() ) {\n\t\t\tif ( ($db->Record['firstname']== '') and ($db->Record['lastname'] == '') ) {\n\t\t\t\t$db->Record['profiledata'] = \"<i>Incomplete profile data</i>\";\n\t\t\t} else {\n\t\t\t\t$db->Record['profiledata'] = \"<a href=\\\"\"._APP_URL.\"users/\".$db->Record['pkey'].\"/event=show\\\">\".$db->Record['lastname'].\", \".$db->Record['firstname'].\"</a>\";\n\t\t\t}\n\t\t\t$t['users'][] = $db->Record;\n\t\t}\n\t\t$db->query(\"select count(username) from lcUsers where groups like '%|\".$gid.\"|%' $or\");\n\t\t$db->next_record();\n\t\t$t[result_pages] = ceil( $db->Record[0] / $this->PAGE_SIZE);\n\t\t$t[current_page] = ceil( $t[start] / $this->PAGE_SIZE) + 1;\n\t\t$t[max_results] = $db->Record[0];\n\t\t$t[PAGE_SIZE] = $this->PAGE_SIZE;\n\n\t\t//groups\n\t\t$db->query(\"select * from lcGroups\");\n\t\twhile ($db->next_record() ) {\n\t\t\t$t[\"group_opt\"] .= \"<option value=\\\"\".$db->Record[gid].\"\\\">\".$db->Record[groupName].\" (\".$db->Record[gid].\") </option>\\n\";\n\t\t}\n\n\t\t//profile\n\t\t$db->query(\"describe profile\");\t//get profile meta data\n\t\t$db->next_record(); \t\t//drop off pkey\n\t\t$t['profile_opt'] .= \"<option value='_email'>Email</option>\\n\";\n\t\t$t['profile_opt'] .= \"<option value='_username'>Username</option>\\n\";\n\t\twhile ($db->next_record() ) {\n\t\t\t$t[profile_opt] .= \"<option value=\\\"\".$db->Record[0].\"\\\">\".$db->Record[0].\"</option>\\n\";\n\t\t}\n\n\t\t$t[opt1] = 'event=groupSearch';\n\t\t$t[opt2] = 'gid='.$gid;\n\t}", "public function LdapAuthenticationWithSearch($token, $ldapType=1) {\n\n //$this->logger->notice(\"LdapAuthentication: LDAP authenticate user by token->getUsername()=\".$token->getUsername());\n //echo \"LdapAuthentication<br>\";\n //exit();\n\n// if( !$this->supportedUsertypesLdap ) {\n// $this->logger->notice('LDAP usertype is not set.');\n// return false;\n// }\n\n //get clean username\n $userSecUtil = $this->container->get('user_security_utility');\n $usernameClean = $userSecUtil->createCleanUsername($token->getUsername());\n\n $usernamePrefix = $userSecUtil->getUsernamePrefix($token->getUsername());\n\n $searchRes = null;\n $withNewUserPrePopulation = true;\n //$withNewUserPrePopulation = false; //testing\n //$userSearchRequired = true;\n $userSearchRequired = false; //auth without required user search is more flexible if admin bind failed\n if( $withNewUserPrePopulation ) {\n\n //////////////// first search this user if exists in ldap directory ////////////////\n $searchRes = $this->searchLdap($usernameClean,$ldapType);\n //////////////// EOF first search this user if exists in ldap directory ////////////////\n\n if( $searchRes == NULL || count($searchRes) == 0 ) {\n $this->logger->error(\"LdapAuthentication: can not find user by usernameClean=\" . $usernameClean);\n //$this->logger->error(\"LdapAuthentication: can not find user by usernameClean=[\" . $usernameClean . \"]; token=[\" . $token->getCredentials() . \"]\");\n //$this->logger->error(print_r($searchRes));\n\n if($userSearchRequired) {\n return NULL;\n }\n } else {\n $this->logger->notice(\"LdapAuthentication: user found by usernameClean=\" . $usernameClean);\n /////// EOF testing ///////\n// $user = $this->findUserByUsername($token->getUsername());\n// if( $user ) {\n// $userEmail = $user->getSingleEmail();\n// if (strpos((string)$userEmail, '@nyp.org') !== false) {\n// $this->logger->error(\"LdapAuthentication: NYP user found by usernameClean=[\" . $usernameClean . \"]; token=[\" . $token->getCredentials() . \"]\");\n// }\n// }\n /////// testing ///////\n }\n }\n\n\n //echo \"user exists in ldap directory<br>\";\n //$this->logger->notice(\"LdapAuthentication: user found in LDAP by usernameClean=\".$usernameClean);\n\n //if user exists in ldap, try bind this user and password\n $ldapRes = $this->ldapBind($usernameClean,$token->getCredentials(),$ldapType); //LdapAuthenticationWithSearch\n if( $ldapRes == NULL ) {\n //exit('ldap failed');\n //$this->logger->error(\"LdapAuthentication: can not bind user by usernameClean=[\".$usernameClean.\"]; token=[\".$token->getCredentials().\"]\");\n $this->logger->error(\"LdapAuthentication: can not bind user by usernameClean=[\".$usernameClean.\"];\");\n\n $user = $this->findUserByUsername($token->getUsername());\n $this->validateFailedAttempts($user);\n\n return NULL;\n }\n //exit('ldap success');\n\n //check if user already exists in DB\n $user = $this->findUserByUsername($token->getUsername());\n //echo \"Ldap user =\".$user.\"<br>\";\n\n if( $user ) {\n //echo \"DB user found=\".$user->getUsername().\"<br>\";\n //exit();\n\n $this->logger->notice(\"findUserByUsername: existing user found in DB by token->getUsername()=\".$token->getUsername());\n\n if( $this->canLogin($user) === false ) {\n $this->logger->warning(\"LdapAuthentication: User cannot login \".$user);\n return NULL;\n }\n\n return $user;\n } else {\n $this->logger->warning(\"findUserByUsername: Can not find existing user in DB by token->getUsername()=\".$token->getUsername());\n }\n\n //echo \"1<br>\";\n\n //////////////////// constract a new user ////////////////////\n\n\n// $user = $this->findUserByUsernameAsEmail($token->getUsername());\n// if( $user ) {\n// $this->logger->notice(\"Ldap Authentication: Exit: Username is not cwid. User found in DB by token->getUsername()=\".$token->getUsername());\n// return NULL;\n// }\n\n //testing\n //if( $usernameClean == \"oli2002\" ) {\n //exit(\"attempt generate new admin user\");\n //}\n //exit(\"attempt generate new user\");\n\n $this->logger->notice(\"LdapAuthentication: create a new user found by token->getUsername()=\".$token->getUsername());\n $user = $userSecUtil->constractNewUser($token->getUsername());\n //echo \"user=\".$user->getUsername().\"<br>\";\n\n $user->setCreatedby('ldap');\n\n //modify user: set keytype and primary public user id\n $userkeytype = $userSecUtil->getUsernameType($usernamePrefix);\n\n if( !$userkeytype ) {\n //$userUtil = new UserUtil();\n //$userUtil = $this->get('user_utility');\n //$count_usernameTypeList = $userUtil->generateUsernameTypes();\n $userkeytype = $userSecUtil->getUsernameType($this->usernamePrefix);\n //echo \"userkeytype=\".$userkeytype.\"<br>\";\n }\n\n $user->setKeytype($userkeytype);\n $user->setPrimaryPublicUserId($usernameClean);\n\n if( $searchRes ) {\n $user->setEmail($searchRes['mail']);\n $user->setFirstName($searchRes['givenName']);\n $user->setLastName($searchRes['lastName']);\n $user->setDisplayName($searchRes['displayName']);\n $user->setPreferredPhone($searchRes['telephoneNumber']);\n $user->setPreferredMobilePhone($searchRes['mobile']);\n }\n\n //cwid is admin cwid\n //if( $user->getUsername() == \"cwid1_@_ldap-user\" || $user->getUsername() == \"cwid2_@_ldap-user\" ) {\n // $user->addRole('ROLE_PLATFORM_ADMIN');\n //}\n\n //exit('ldap ok');\n\n //////////////////// save user to DB ////////////////////\n //$userManager = $this->container->get('fos_user.user_manager');\n $userManager = $this->container->get('user_manager');\n $userManager->updateUser($user);\n\n return $user;\n }", "function doSearch(){\n if($this->find != ''){\n if((is_array($this->files) AND count($this->files) > 0) OR $this->files != '') $this->doFiles($this->search_function);\n if($this->directories != '') $this->doDirectories($this->search_function);\n }\n }" ]
[ "0.7170022", "0.7168994", "0.7028124", "0.6902661", "0.6900166", "0.66447973", "0.6480266", "0.6424719", "0.6344938", "0.6316482", "0.61292267", "0.59808165", "0.596607", "0.59406155", "0.5870621", "0.5789442", "0.5735585", "0.5515309", "0.53992605", "0.5398651", "0.53843594", "0.5228728", "0.5191145", "0.5190693", "0.51329577", "0.5120849", "0.5120719", "0.50846374", "0.5065549", "0.50056714" ]
0.7242194
0
Performs a ldapsearch on the provided baseDN with your filter in Base scope
public function searchBase($baseDN, $filter = '(objectClass=*)', $attributes = array(), $attrsonly = 0, $sizelimit = 0, $timelimit = 0, $deref = LDAP_DEREF_NEVER) { $result = @ldap_read($this->conn, $baseDN, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref); if (ldap_errno($this->conn)) { throw new LdapException(ldap_error($this->conn), ldap_errno($this->conn)); } return new LdapResult($this->conn, $result); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function search($baseDN, $filter = '(objectClass=*)', $attributes = array(), $attrsonly = 0, $sizelimit = 0, $timelimit = 0, $deref = LDAP_DEREF_NEVER) {\n\t\t$result = @ldap_search($this->conn, $baseDN, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref);\n\t\tif (ldap_errno($this->conn)) {\n\t\t\tthrow new LdapException(ldap_error($this->conn), ldap_errno($this->conn));\n\t\t}\n\n\t\treturn new LdapResult($this->conn, $result);\n\t}", "public function search($filter, $extendedBaseDN = \"\")\n\t{\n\t\t$search\t= ldap_search($this->link, ((trim($extendedBaseDN) != \"\") ? $extendedBaseDN.\",\" : \"\").$this->baseDN, $filter);\n\t\t$result\t= ldap_get_entries($this->link, $search);\n\t\treturn $result;\n\t}", "public function search($baseDN, $filter, $filterArgs = array(), $attributes = array())\n\t{\n\t\t$filteredSearch = self::_replaceFilterArgs($filter, $filterArgs);\n\t\t$result = ldap_search($this->_getLink(), $baseDN, $filteredSearch, $attributes);\n\t\tif ($result)\n\t\t{\n\t\t\t$this->_setResult($result);\n return $this->_createResult();\n\t\t}\n return false;\n\t}", "public function search($baseDn, $filter, $attributes)\n {\n if ($this->config['hideErrors']) {\n return @ldap_search($this->ldapConnection, $baseDn, $filter, $attributes);\n }\n\n return ldap_search($this->ldapConnection, $baseDn, $filter, $attributes);\n }", "function LdapSearch($BaseDn, $Filter) {\n\t\t\t\n\t\t\t$this->QueryCount++;\n\t\t\t$result = ldap_search($this->_Connection, $BaseDn, $Filter) or die('LDAP Error: ' . ldap_error($this->_Connection));\n\t\t}", "public function searchOne($baseDN, $filter = '(objectClass=*)', $attributes = array(), $attrsonly = 0, $sizelimit = 0, $timelimit = 0, $deref = LDAP_DEREF_NEVER) {\n\t\t$result = @ldap_list($this->conn, $baseDN, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref);\n\t\tif (ldap_errno($this->conn)) {\n\t\t\tthrow new LdapException(ldap_error($this->conn), ldap_errno($this->conn));\n\t\t}\n\n\t\treturn new LdapResult($this->conn, $result);\n\t}", "function ldap_search_cms($filter, $base_dn = NULL, $attributes = array()) {\n $ret = array();\n if($this->ldap_conn) {\n $final_base_dn = !empty($base_dn) ? $base_dn : $this->base_dn;\n if($this->ldap_last_search_identifier = ldap_search($this->ldap_conn, $final_base_dn, $filter, $attributes)) {\n $rows = ldap_get_entries($this->ldap_conn, $this->ldap_last_search_identifier);\n if($rows !== FALSE && $rows['count'] > 0) {\n unset($rows['count']);\n $ret = $rows;\n $this->ldap_free_last_result();\n }\n if($rows === FALSE) {\n $this->ldap_handle_error('ldap_get_entries');\n }\n } else {\n $this->ldap_handle_error('ldap_search');\n }\n } else {\n $this->ldap_handle_error('connection');\n }\n return $ret;\n }", "public function ldapSearch(\n $baseDn,\n $filter,\n array $attributes = [],\n int $scope = self::SCOPE_SUBTREE,\n bool $attrsOnly = false,\n int $sizeLimit = 0,\n int $timeLimit = 0,\n int $deref = LDAP_DEREF_NEVER\n ) {\n $function = $this->scopeToFunction($scope);\n // Support for parallel search\n $baseDn = (array)$baseDn;\n $filter = (array)$filter;\n\n // Sanity check... We need to do this ourselves because we are suppressing errors from the\n // ldap function call.\n if (count($baseDn) !== count($filter)) {\n // This is a programmer error - we should raise an error instead of catchable exception\n trigger_error('Array sizes of base DNs and filters do not match', E_USER_ERROR);\n }\n\n // Align the resources to match the amount of baseDns and filters provided\n $resources = array_fill(0, count($baseDn), $this->resource);\n\n $results = @$function(\n $resources,\n $baseDn,\n $filter,\n $attributes,\n $attrsOnly,\n $sizeLimit,\n $timeLimit,\n $deref\n );\n $this->verifyOperation();\n\n // Convert result resources into Result instances\n foreach ($results as $key => $result) {\n if (is_resource($result)) {\n $results[$key] = new Result($this, $result);\n } // Else - let it be whatever it was (probably FALSE - a failed search)\n }\n\n // If there is only one result, this was not a parallel search - return it directly\n return count($results) === 1 ? $results[0] : $results;\n }", "function _search($filter, $dn, & $attributes) {\r\n\t\t$resource = $this->_resource;\n\t\taddLogEntry('Joomla! LDAP Library Mambot', 'search', 'debug', 'Searching for '. $filter .' in DN '. $dn);\r\n\t\t$search_result = ldap_search($resource, $dn, $filter);\n\t\taddLogEntry('Joomla! LDAP Library Mambot', 'search', 'debug', 'Got search result of '. print_r($search_result,1));\r\n\t\taddLogEntry('LDAP Library', 'search', 'debug', 'Search for '. $filter . ' in '. $dn . ' returned ' . $search_result . ' with '. ldap_count_entries($resource, $search_result) .' results');\r\n\t\tif ($search_result && ($count = ldap_count_entries($resource, $search_result)) > 0) {\r\n\t\t\tfor ($i = 0; $i < $count; $i++) {\r\n\t\t\t\t$attributes[$i] = Array ();\r\n\t\t\t\tif (!$i) {\r\n\t\t\t\t\t$firstentry = ldap_first_entry($resource, $search_result);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$firstentry = ldap_next_entry($resource, $firstentry);\r\n\t\t\t\t}\r\n\t\t\t\t$attributes_array = ldap_get_attributes($resource, $firstentry); // load user-specified attributes\r\n\t\t\t\t// ldap returns an array of arrays, fit this into attributes result array\r\n\t\t\t\tforeach ($attributes_array as $ki => $ai) {\r\n\t\t\t\t\tif (is_array($ai)) {\r\n\t\t\t\t\t\t$subcount = $ai['count'];\r\n\t\t\t\t\t\t$attributes[$i][$ki] = Array ();\r\n\t\t\t\t\t\tfor ($k = 0; $k < $subcount; $k++) {\r\n\t\t\t\t\t\t\t$attributes[$i][$ki][$k] = $ai[$k];\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$attributes[$i]['dn'] = ldap_get_dn($resource, $firstentry);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function search($filters, $dnoverride = null) {\r\n\t\t$result = array ();\r\n\t\tif ($dnoverride) {\r\n\t\t\t$dn = $dnoverride;\r\n\t\t} else {\r\n\t\t\t$dn = $this->base_dn;\r\n\t\t}\r\n\r\n\t\tforeach ($filters as $search_filter) {\r\n\t\t\t$dn_list = explode(';', $dn);\r\n\t\t\tforeach ($dn_list as $dn) {\r\n\t\t\t\t$this->_search($search_filter, $dn, $result);\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $result;\r\n\t}", "function twpn_search($ldap_domain, $ldap_server, $query_user, $query_password, $filter) {\n\t// global $ldap_domain, $ldap_server;\n \n /**\n * DN (Distinguished Name) is a set of RDN (Relative Distinguished name) comma delimited \n * components. The DN is passed to ldap_search, along with a connection to the ldap\n * server, in order to locate records.\n * Our LDAP DN's are composed of the following RDN's\n * -- OU: Organizational Unit (e.g. \"News\", \"Natl Politics and Gov\", \"TWPN\")\n * -- DC: Domain component (e.g. my.ldap.system.com -> dc=my,dc=ldap,dc=system,dc=com)\n * -- CN: Common Name (e.g. \"username\". NOTE: in PHP ldap_search, CN filters (e.g. CN=*, \n * CN=username in DN cause search to hang))\n * Other RDNs exist (e.g. STREET, ST (state), C (Country), UID (User id)) but are not used by \n * our DN system. Rather, these components are stored in various ldap attributes (countryCode, \n * employeeID, etc.)\n *\n * In addition to passing DC's that point to the ldap domain, we pass OU=TWPN, an \n * Organizational unit which includes all users */\n\n //parse domain into dc's, then contruct dn string from those dc's and TWPN OU\n $domain_dcs = domain_to_dcs($ldap_domain);\n $ldap_dn = \"OU=TWPN,\".$domain_dcs;\n \n // Connect to the ldap AD (Active directory)\n $ldap = ldap_connect($ldap_server) or die(\"Could not connect to LDAP\");\n // Authenticate by binding user credentials to ldap domain\n ldap_bind($ldap, $query_user.\"@\".$ldap_domain, $query_password) or die(\"Could not bind to LDAP\");\n\n /** \n * Search using TWPN DN and filter.\n * Filters search ldap attributes (e.g. objectClass, group, cn, displayName, countryCode, etc)\n * Filters can use logical operators &, |, ! as well as <=, >= (all attributes are strings, so * these are lexicographal comparisons), = and ~= (approx equal to, unclear on how this\n * functions). Example filter strings:\n * \"(attr1=val1)\" attr1 has value val1\n * \"!(attr1=val1)\" attr1 has any value but val1\n * \"(&(attr1=val1)(attr2=val2))\" attr1 has value val1 AND attr2 has value val2\n * \"((|(attr1=val1)(attr1=val2))(!attr3=val3))\" attr1 has value val1 OR val2 AND attr3 is not \n * equal to val3\n */\n $results = ldap_search($ldap,$ldap_dn,$filter);\n $entries = ldap_get_entries($ldap, $results);\n if($entries['count'] == 0) return false;\n \t\n return $entries;\n}", "public function searchEntries($filter,$params=array())\n {\n // Process user input parameters\n $baseDN = (array_key_exists('baseDN', $params)) ? $params['baseDN'] : $this->baseDN;\n $sizeLimit = (array_key_exists('sizeLimit', $params)) ? $params['sizeLimit'] : 0;\n $timeLimit = (array_key_exists('timeLimit', $params)) ? $params['timeLimit'] : 0;\n $attributes = (array_key_exists('listAttributes', $params) and $params['listAttributes'])\n ? array()\n : ((array_key_exists('attributes', $params))\n ? ((is_array($params['attributes']))\n ? $params['attributes']\n : explode(',',$params['attributes']))\n : array('dn'));\n $sort = (array_key_exists('sort', $params))\n ? (is_array($params['sort']))\n ? array_reverse($params['sort'])\n : array_reverse(explode(',',$params['sort']))\n : array('dn');\n\n // Catch the 'ALL' attributes use-case\n if(in_array('*', $attributes)) $attributes=array();\n\n // Build the filter string (if needed)\n if(!preg_match('/^\\(+([\\|&])/', $filter)) $filter = self::buildFilterString($filter);\n\n // If we're not connected, connect now\n if(!$this->ldap){\n $connParams = (array_key_exists('connection', $params)) ? $params['connection'] : NULL;\n if(!$this->ldap =& $this->connect($connParams)){\n return array();\n }\n }\n\n // Do the LDAP search\n $ldapSearch = ldap_search($this->ldap, $baseDN, $filter, (array)$attributes, 0, $sizeLimit, $timeLimit, LDAP_DEREF_ALWAYS);\n if(!$ldapSearch){\n errorHandle::newError(__METHOD__.\"() - Failed to search ldap directory. LDAP Error:\".ldap_error($this->ldap), errorHandle::MEDIUM);\n return array();\n }\n\n // Do we need to sort the results?\n if(isset($sort)){\n foreach ($sort as $sortBy) {\n if (in_array($sortBy, $attributes)) { // make sure we sort against an existing field\n ldap_sort($this->ldap, $ldapSearch, $sortBy);\n }\n }\n }\n\n // Are we returning the raw result, or the cleaned 'pretty' version?\n $entries = ldap_get_entries($this->ldap, $ldapSearch);\n if(array_key_exists('returnRaw', $params) and $params['returnRaw']){\n // Return the RAW result of ldap_get_entries()\n return $entries;\n }else{\n // Return a cleaned, formatted, results array\n return $this->formatSearchResults($entries, $attributes);\n }\n }", "function authValidateUserCallback(&$ldap, $base_dn, $dn, $user_search,\n $user, &$object)\n{\n authLdapDebug(\"authValidateUserCallback: base_dn '$base_dn' \".\n \"dn '$dn' user '$user'\");\n\n $pass = $object['pass'];\n\n // try an authenticated bind\n // use this to confirm that the user/password pair\n if ($dn && @ldap_bind($ldap, $dn, $pass))\n {\n $filter = $object['config']['ldap_filter'];\n\n // however if there is a filter check that the\n // user is part of the group defined by the filter\n if (! $filter)\n {\n authLdapDebug(\"authValidateUserCallback: Successful authenticated \".\n \"bind with no \\$ldap_filter\");\n return true;\n }\n else\n {\n authLdapDebug(\"authValidateUserCallback: Successful authenticated \".\n \"bind checking '$filter'\");\n\n // If ldap_filter_base_dn is set, set the filter to search for the user\n // in the given base_dn (OpenLDAP). If not, read from the user\n // attribute (AD)\n if (isset($object['config']['ldap_filter_base_dn']))\n {\n $f = \"(&(\".\n $object['config']['ldap_filter_user_attr'].\n \"=$user)($filter))\";\n $filter_dn = $object['config']['ldap_filter_base_dn'];\n $call = 'ldap_search';\n }\n else\n {\n $f = \"($filter)\";\n $filter_dn = $dn;\n $call = 'ldap_read';\n }\n\n authLdapDebug(\"authValidateUserCallback: Trying filter: $f: \".\n \"dn: $filter_dn: method: $call\");\n\n $res = $call(\n $ldap,\n $filter_dn,\n $f,\n array()\n );\n if (@ldap_count_entries($ldap, $res) > 0)\n {\n authLdapDebug(\"authValidateUserCallback: Found entry with filter\");\n return true;\n }\n authLdapDebug(\"authValidateUserCallback: No entry found with filter\");\n }\n }\n else\n {\n authLdapDebug(\"authValidateUserCallback: Bind to '$dn' failed: \".ldap_error($ldap));\n }\n\n if ($ldap_unbind_between_attempts)\n {\n @ldap_unbind($ldap);\n }\n\n // return failure if no connection is established\n return false;\n}", "public function search($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0);", "function searchOnLDAP($correo, $member_name, $member_pwd)\r\n{\r\n\t$resultado = '';\r\n\t$ldap = ldap_connect(\"euedcadsls01.ls.ege.ds\");\r\n\tldap_set_option ($ldap, LDAP_OPT_REFERRALS, 0);\r\n\tldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);\r\n\tif (@$bind = ldap_bind($ldap, \"ls\\\\\".$member_name, $member_pwd)) \t\r\n\t{\r\n\t\t//Credentials work now let's do LDAP query for data.....LDAP parameters\r\n\t\t//$ldap_dn = 'OU=Users,OU=PBL,OU=MX,DC=ls,DC=ege,DC=ds';\r\n\t\t$ldap_dn = 'DC=ls,DC=ege,DC=ds';\r\n\t\t//$attributes = array(\"displayname\", \"mail\", \"samaccountname\");\r\n\t\t$attributes = array(\"displayname\"); \r\n\t\t//$filter = \"(&(objectCategory=person)(sAMAccountName=$member_name))\";\r\n\t\t$filter = \"(&(objectCategory=person)(mail=$correo))\";\r\n\t\t$result = ldap_search($ldap, $ldap_dn, $filter, $attributes);\r\n\t\t$entries = ldap_get_entries($ldap, $result);\r\n\t\t$entries_clean = rCountRemover($entries);\r\n\t\tif(isset($entries_clean[0]['displayname']))\r\n\t\t{\r\n\t\t\t$resultado= str_replace(' (external)', '', $entries_clean[0]['displayname'][0]);\r\n\t\t}\t\t \r\n\t\t//$resultado[1] = $entries_clean[0]['mail'][0]; \r\n\t\t//$resultado[2] = $entries_clean[0]['samaccountname'][0]; \r\n\t\treturn $resultado;\r\n\t}\r\n}", "public function search($dn, $filter, $attributes, $options = array()) {\n\t\tif (!$this->connected()) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$options = am(array(\n\t\t\t'subtree' => true\n\t\t), $options);\n\n\n\t\t// attributes array must be formatted in incremental numbered keys (0,1,...)\n\t\t// otherwise ldap_search() fails with error\n\t\t$attributes = array_values($attributes);\n\n\t\tif ($this->_sizeLimit != 0) {\n\t\t\t// $pageSize = $this->_sizeLimit;\n\t\t\tldap_control_paged_result($this->_ldap, $this->_sizeLimit, true);\n\n\t\t\t$sr = @ldap_search($this->_ldap, $dn, $filter, $attributes, 0, $this->_sizeLimit);\n\t\t\tif (!is_resource($sr)) {\n\t\t\t\tCakeLog::write('debug', 'LDAP testing failed, $dn:'.Debugger::exportVar($dn).' $filter: ' . Debugger::exportVar($filter) . ' Attributes: ' . Debugger::exportVar($attributes));\n\n\t\t\t\t$data = [\n\t\t\t\t\t'count' => 0\n\t\t\t\t];\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$data = ldap_get_entries($this->_ldap, $sr);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t$cacheStr = 'ldap_results_'. $this->_url . '_' . $this->_port . '_' . $dn . '_' . $filter . '_' . (implode('_', $attributes));\n\t\t\t$cacheStr = sha1($cacheStr);\n\n\t\t\tif (($data = Cache::read($cacheStr, 'ldap')) === false) {\n\n\t\t\t\t$pageSize = 1000;\n\t\t\t\t$data = array();\n\t\t\t\t$cookie = '';\n\t\t\t\t$count = 0;\n\t\t\t\t$i = 0;\n\t\t\t\tdo {\n\t\t\t\t\tldap_control_paged_result($this->_ldap, $pageSize, true, $cookie);\n\n\t\t\t\t\tif ($options['subtree']) {\n\t\t\t\t\t\t$sr = ldap_search($this->_ldap, $dn, $filter, $attributes);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$sr = ldap_list($this->_ldap, $dn, $filter, $attributes);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$entries = ldap_get_entries($this->_ldap, $sr);\n\n\t\t\t\t\t$count += array_shift($entries);\n\t\t\t\t\t$data = array_merge($data, $entries);\n\n\t\t\t\t\tldap_control_paged_result_response($this->_ldap, $sr, $cookie);\n\t\t\t\t\t\n\t\t\t\t\t$i++;\n\t\t\t\t} while ($cookie !== null && $cookie != '');\n\n\t\t\t\t// $data = array('count' => $count) + $data;\n\t\t\t\t$data = array_merge([\n\t\t\t\t\t'count' => $count\n\t\t\t\t], $data);\n\n\t\t\t\tCache::write($cacheStr, $data, 'ldap');\n\t\t\t\tCache::write('last_cache_update', ['time' => time()], 'ldap');\n\t\t\t}\n\t\t}\n\n\t\t$this->_lastSearch = array(\n\t\t\t'dn' => $dn,\n\t\t\t'filter' => $filter,\n\t\t\t'attributes' => $attributes,\n\t\t);\n\n\t\treturn $data;\n\t}", "public function query($filter, $scope, $attributes = array(), $limit = 200)\n {\n // This performs the search for a specified filter on the directory with the scope of LDAP_SCOPE_SUBTREE\n // error suppression added because ldap_search throws WARNINGs when the search limit is hit\n $result = @ldap_search($this->link, $scope, $filter, $attributes, 0, $limit);\n if (! $result) {\n return false;\n }\n return new Coe_Ldap_Result($this->link, $result);\n }", "public function search($query) {\n $ldap = ldap_connect(Configure::read('Ldap.host'));\n \n if($ldap) {\n ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, Configure::read('Ldap.protocol'));\n \n if(ldap_bind($ldap)) {\n $result = ldap_search($ldap,\n Configure::read('Ldap.searchbase'),\n \"(&(objectclass=\". Configure::read('Ldap.objectclass') .\")(cn=*\" . $query . \"*))\");\n \n $entries = ldap_get_entries($ldap, $result);\n \n $this->set('people', $entries);\n \n ldap_unbind($ldap);\n } else {\n $this->Session->setFlash(\"Could not find directory server\", '', array(), 'error');\n }\n }\n }", "function compare_dn_to_base($dn,$base_dn)\n\t{\n\t\t$test_rdn_list = ldap_explode_dn($dn,0);\n\n\t\t// Handle case where $dn couldn't be parsed into\n\t\t// a list of RDNs - ldap_explode_dn() returns false.\n\t\tif(gettype($test_rdn_list)!=\"array\")\n\t\t\t$test_rdn_list = array(\"count\"=>1,0=>$dn);\n\n\t\t$base_rdn_list = ldap_explode_dn($base_dn,0);\n\n\t\t$base_rdn_count = $base_rdn_list[\"count\"];\n\n\t\t$dn_base_section = implode(array_slice($test_rdn_list,\n\t\t\t-$base_rdn_count),\",\");\n\n\t\tif($base_dn == \"\")\n\t\t\treturn true;\n\t\tif($this->compare_dn_supported)\n\t\t\treturn @ldap_compare($this->connection,\n\t\t\t\t$base_dn,\"DN\",$dn_base_section);\n\t\telse\n\t\t\treturn !strcasecmp($dn_base_section,$base_dn);\n\t}", "public function read($baseDn, $filter, $attributes)\n {\n if ($this->config['hideErrors']) {\n return @ldap_read($this->ldapConnection, $baseDn, $filter, $attributes);\n }\n\n return ldap_read($this->ldapConnection, $baseDn, $filter, $attributes);\n }", "function _ldap_search($search, $email = False)\n {\n global $ldap_server, $ldap_search;\n\n $ret = array();\n $ds = ldap_connect($ldap_server);\n if ($ds)\n {\n // Explictly set the protocol version to prevent bind errors\n ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);\n $r = ldap_bind($ds);\n $sr = ldap_search($ds, $ldap_search, $search);\n $info = ldap_get_entries($ds, $sr);\n\n for ($i = 0; $i < $info[\"count\"]; $i++)\n {\n // Strictly speaking we could set anything as the key here, since only the first record is used in e.g. _get_email_fn\n // But as the logic maps fedid=>email, use similar keys here\n $fedid = $info[$i]['uid'][0];\n if ($email)\n {\n $ret[$fedid] = array_key_exists('mail', $info[$i]) ? $info[$i]['mail'][0] : '';\n }\n else\n $ret[$fedid] = $info[$i]['givenname'][0] . ' ' . $info[$i]['sn'][0];\n }\n\n ldap_close($ds);\n }\n return $ret;\n }", "public function listEntries($filter,$params=array())\n {\n // Process user input parameters\n $baseDN = (array_key_exists('baseDN', $params)) ? $params['baseDN'] : $this->baseDN;\n $sizeLimit = (array_key_exists('sizeLimit', $params)) ? $params['sizeLimit'] : 0;\n $timeLimit = (array_key_exists('timeLimit', $params)) ? $params['timeLimit'] : 0;\n $attributes = (array_key_exists('listAttributes', $params) and $params['listAttributes'])\n ? array()\n : ((array_key_exists('attributes', $params))\n ? ((is_array($params['attributes']))\n ? $params['attributes']\n : explode(',',$params['attributes']))\n : array('dn'));\n $sort = (array_key_exists('sort', $params))\n ? (is_array($params['sort']))\n ? array_reverse($params['sort'])\n : array_reverse(explode(',',$params['sort']))\n : array('dn');\n\n // Catch the 'ALL' attributes use-case\n if(in_array('*', $attributes)) $attributes=array();\n\n // Build the filter string (if needed)\n if(!preg_match('/^\\(+([\\|&])/', $filter)) $filter = self::buildFilterString($filter);\n\n // If we're not connected, connect now\n if(!$this->ldap){\n $connParams = (array_key_exists('connection', $params)) ? $params['connection'] : NULL;\n if(!$this->ldap =& $this->connect($connParams)){\n return array();\n }\n }\n\n // Do the LDAP search\n $ldapSearch = ldap_list($this->ldap, $baseDN, $filter, (array)$attributes, 0, $sizeLimit, $timeLimit,LDAP_DEREF_ALWAYS);\n if(!$ldapSearch){\n errorHandle::newError(__METHOD__.\"() - Failed to search ldap directory. \".ldap_errno($this->ldap).':'.ldap_error($this->ldap), errorHandle::MEDIUM);\n return array();\n }\n\n // Do we need to sort the results?\n if(isset($sort)){\n foreach ($sort as $sortBy) {\n if (in_array($sortBy, $attributes)) { // make sure we sort against an existing field\n ldap_sort($this->ldap, $ldapSearch, $sortBy);\n }\n }\n }\n\n // Are we returning the raw result, or the cleaned 'pretty' version?\n $entries = ldap_get_entries($this->ldap, $ldapSearch);\n if(array_key_exists('returnRaw', $params) and $params['returnRaw']){\n // Return the RAW result of ldap_get_entries()\n return $entries;\n }else{\n // Return a cleaned, formatted, results array\n return $this->formatSearchResults($entries, $attributes);\n }\n }", "public function bindForSearch() {\r\n\r\n // use this instance credentials if not passed\r\n if ($this->username == '' || $this->password == '') {\r\n throw new CException('LDAP: system credentials cannot be empty');\r\n }\r\n // if already binded unbinds\r\n if ($this->_binded)\r\n $this->unbind();\r\n\r\n $this->_binded = @ldap_bind($this->_conn, \"{$this->domain}\\\\{$this->username}\", $this->password);\r\n if (!$this->_binded)\r\n throw new CException('LDAP: system credentials are wrong');\r\n }", "function authLdapGetEmailCallback(&$ldap, $base_dn, $dn, $user_search,\n $user, &$object)\n{\n $email_attrib = $object['config']['ldap_email_attrib'];\n\n authLdapDebug(\"authLdapGetEmailCallback: base_dn '$base_dn' dn '$dn' \".\n \"user_search '$user_search' user '$user'\");\n\n if ($ldap && $base_dn && $dn && $user_search)\n {\n $res = @ldap_read(\n $ldap,\n $dn,\n \"(objectclass=*)\",\n array(utf8_strtolower($email_attrib))\n );\n if (@ldap_count_entries($ldap, $res) > 0)\n {\n authLdapDebug(\"authLdapGetEmailCallback: search successful\");\n $entries = ldap_get_entries($ldap, $res);\n $object['email'] = $entries[0][utf8_strtolower($email_attrib)][0];\n\n authLdapDebug(\"authLdapGetEmailCallback: email is '\".\n $object['email'].\"'\");\n \n return true;\n }\n }\n return false;\n}", "function &search($params,$sql_filter=null)\n\t{\n\t\t$params_in = $params;\n\n\t\t$params['sql_filter'] = $sql_filter;\t// dont allow to set it via UI or xmlrpc\n\n\t\t// check if any resource wants to hook into\n\t\tforeach($this->resources as $data)\n\t\t{\n\t\t\tif (isset($data['search_filter']))\n\t\t\t{\n\t\t\t\t$params = ExecMethod($data['search_filter'],$params);\n\t\t\t}\n\t\t}\n\n\t\tif (!isset($params['users']) || !$params['users'] ||\n\t\t\tcount($params['users']) == 1 && isset($params['users'][0]) && !$params['users'][0])\t// null or '' casted to an array\n\t\t{\n\t\t\t// for a search use all account you have read grants from\n\t\t\t$params['users'] = $params['query'] ? array_keys($this->grants) : $this->user;\n\t\t}\n\t\t// resolve users to add memberships for users and members for groups\n\t\t// for search, do NOT use freebusy rights, as it would allow to probe the content of event entries\n\t\t$users = $this->resolve_users($params['users'], $params['filter'] == 'no-enum-groups', $params['ignore_acl'], empty($params['query']));\n\n\t\t// supply so with private_grants, to not query them again from the database\n\t\tif (!empty($params['query']))\n\t\t{\n\t\t\t$params['private_grants'] = array();\n\t\t\tforeach($this->grants as $user => $rights)\n\t\t\t{\n\t\t\t\tif ($rights & EGW_ACL_PRIVATE) $params['private_grants'][] = $user;\n\t\t\t}\n\t\t}\n\n\t\t// replace (by so not understood filter 'no-enum-groups' with 'default' filter\n\t\tif ($params['filter'] == 'no-enum-groups')\n\t\t{\n\t\t\t$params['filter'] = 'default';\n\t\t}\n\t\t// if we have no grants from the given user(s), we directly return no events / an empty array,\n\t\t// as calling the so-layer without users would give the events of all users (!)\n\t\tif (!count($users))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tif (isset($params['start'])) $start = $this->date2ts($params['start']);\n\n\t\tif (isset($params['end']))\n\t\t{\n\t\t\t$end = $this->date2ts($params['end']);\n\t\t\t$this->check_move_horizont($end);\n\t\t}\n\t\t$daywise = !isset($params['daywise']) ? False : !!$params['daywise'];\n\t\t$params['enum_recuring'] = $enum_recuring = $daywise || !isset($params['enum_recuring']) || !!$params['enum_recuring'];\n\t\t$cat_id = isset($params['cat_id']) ? $params['cat_id'] : 0;\n\t\t$filter = isset($params['filter']) ? $params['filter'] : 'all';\n\t\t$offset = isset($params['offset']) && $params['offset'] !== false ? (int) $params['offset'] : false;\n\t\t// socal::search() returns rejected group-invitations, as only the user not also the group is rejected\n\t\t// as we cant remove them efficiantly in SQL, we kick them out here, but only if just one user is displayed\n\t\t$users_in = (array)$params_in['users'];\n\t\t$remove_rejected_by_user = !in_array($filter,array('all','rejected','everything')) &&\n\t\t\tcount($users_in) == 1 && $users_in[0] > 0 ? $users_in[0] : null;\n\t\t//error_log(__METHOD__.'('.array2string($params_in).\", $sql_filter) params[users]=\".array2string($params['users']).' --> remove_rejected_by_user='.array2string($remove_rejected_by_user));\n\n\t\tif ($this->debug && ($this->debug > 1 || $this->debug == 'search'))\n\t\t{\n\t\t\t$this->debug_message('calendar_bo::search(%1) start=%2, end=%3, daywise=%4, cat_id=%5, filter=%6, query=%7, offset=%8, num_rows=%9, order=%10, sql_filter=%11)',\n\t\t\t\tTrue,$params,$start,$end,$daywise,$cat_id,$filter,$params['query'],$offset,(int)$params['num_rows'],$params['order'],$params['sql_filter']);\n\t\t}\n\t\t// date2ts(,true) converts to server time, db2data converts again to user-time\n\t\t$events =& $this->so->search(isset($start) ? $this->date2ts($start,true) : null,isset($end) ? $this->date2ts($end,true) : null,\n\t\t\t$users,$cat_id,$filter,$offset,(int)$params['num_rows'],$params,$remove_rejected_by_user);\n\n\t\tif (isset($params['cols']))\n\t\t{\n\t\t\treturn $events;\n\t\t}\n\t\t$this->total = $this->so->total;\n\t\t$this->db2data($events,isset($params['date_format']) ? $params['date_format'] : 'ts');\n\n\t\t//echo \"<p align=right>remove_rejected_by_user=$remove_rejected_by_user, filter=$filter, params[users]=\".print_r($param['users']).\"</p>\\n\";\n\t\tforeach($events as $id => $event)\n\t\t{\n\t\t\tif ($params['enum_groups'] && $this->enum_groups($event))\n\t\t\t{\n\t\t\t\t$events[$id] = $event;\n\t\t\t}\n\t\t\t$matches = null;\n\t\t\tif (!(int)$event['id'] && preg_match('/^([a-z_]+)([0-9]+)$/',$event['id'],$matches))\n\t\t\t{\n\t\t\t\t$is_private = self::integration_get_private($matches[1],$matches[2],$event);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t$is_private = !$this->check_perms(EGW_ACL_READ,$event);\n\t\t\t}\n\t\t\tif ($is_private || (!$event['public'] && $filter == 'hideprivate'))\n\t\t\t{\n\t\t\t\t$this->clear_private_infos($events[$id],$users);\n\t\t\t}\n\t\t}\n\n\t\tif ($daywise)\n\t\t{\n\t\t\tif ($this->debug && ($this->debug > 2 || $this->debug == 'search'))\n\t\t\t{\n\t\t\t\t$this->debug_message('socalendar::search daywise sorting from %1 to %2 of %3',False,$start,$end,$events);\n\t\t\t}\n\t\t\t// create empty entries for each day in the reported time\n\t\t\tfor($ts = $start; $ts <= $end; $ts += DAY_s) // good enough for array creation, but see while loop below.\n\t\t\t{\n\t\t\t\t$daysEvents[$this->date2string($ts)] = array();\n\t\t\t}\n\t\t\tforeach($events as $k => $event)\n\t\t\t{\n\t\t\t\t$e_start = max($this->date2ts($event['start']),$start);\n\t\t\t\t// $event['end']['raw']-1 to allow events to end on a full hour/day without the need to enter it as minute=59\n\t\t\t\t$e_end = min($this->date2ts($event['end'])-1,$end);\n\n\t\t\t\t// add event to each day in the reported time\n\t\t\t\t$ts = $e_start;\n\t\t\t\t// $ts += DAY_s in a 'for' loop does not work for daylight savings in week view\n\t\t\t\t// because the day is longer than DAY_s: Fullday events will be added twice.\n\t\t\t\t$ymd = null;\n\t\t\t\twhile ($ts <= $e_end)\n\t\t\t\t{\n\t\t\t\t\t$daysEvents[$ymd = $this->date2string($ts)][] =& $events[$k];\n\t\t\t\t\t$ts = strtotime(\"+1 day\",$ts);\n\t\t\t\t}\n\t\t\t\tif ($ymd != ($last = $this->date2string($e_end)))\n\t\t\t\t{\n\t\t\t\t\t$daysEvents[$last][] =& $events[$k];\n\t\t\t\t}\n\t\t\t}\n\t\t\t$events =& $daysEvents;\n\t\t\tif ($this->debug && ($this->debug > 2 || $this->debug == 'search'))\n\t\t\t{\n\t\t\t\t$this->debug_message('socalendar::search daywise events=%1',False,$events);\n\t\t\t}\n\t\t}\n\t\tif ($this->debug && ($this->debug > 0 || $this->debug == 'search'))\n\t\t{\n\t\t\t$this->debug_message('calendar_bo::search(%1)=%2',True,$params,$events);\n\t\t}\n\t\t//error_log(__METHOD__.\"() returning \".count($events).\" entries, total=$this->total \".function_backtrace());\n\t\treturn $events;\n\t}", "function getUserRecord_dn($dn) {\n\t\t$filter = \"(&(objectCategory=person)(objectClass=user))\";\n\t\t$result = ldap_search($this->ldapconn, $dn, $filter, $this->justthese)\n\t\t\t\tor die(\"ERROR: Failed to search the AD Tree.\");\n\n\t\t$entries = ldap_get_entries($this->ldapconn, $result);\n\t\t//print_r($entries);\n\n\t\tif ($entries[\"count\"] > 0)\n\t\t{\n\t\t\t$exclude = count(array_intersect($this->excludegroups, $entries[0]['memberof']));\n\t\t\t$accountDisabled = (isset($entries[0]['useraccountcontrol']) and (((int)$entries[0]['useraccountcontrol'][0] & 2) != 2));\n\t\t\tif(($exclude == 0) and $accountDisabled){\n\t\t\t\t$user_name = strtolower($entries[0]['samaccountname'][0]);\n\t\t\t\t$entries[0]['user_picture'] = site_url(\"images/profile/$user_name\");\n\t\t\t\t$entries[0]['i_department'] = $this->getUserDepartment($entries[0]['samaccountname'][0]);\n\n\t\t\t\treturn $entries[0];\n\t\t\t}\n\t\t}\n\n\t\treturn FALSE;\n\t}", "public function LdapAuthenticationWithSearch($token, $ldapType=1) {\n\n //$this->logger->notice(\"LdapAuthentication: LDAP authenticate user by token->getUsername()=\".$token->getUsername());\n //echo \"LdapAuthentication<br>\";\n //exit();\n\n// if( !$this->supportedUsertypesLdap ) {\n// $this->logger->notice('LDAP usertype is not set.');\n// return false;\n// }\n\n //get clean username\n $userSecUtil = $this->container->get('user_security_utility');\n $usernameClean = $userSecUtil->createCleanUsername($token->getUsername());\n\n $usernamePrefix = $userSecUtil->getUsernamePrefix($token->getUsername());\n\n $searchRes = null;\n $withNewUserPrePopulation = true;\n //$withNewUserPrePopulation = false; //testing\n //$userSearchRequired = true;\n $userSearchRequired = false; //auth without required user search is more flexible if admin bind failed\n if( $withNewUserPrePopulation ) {\n\n //////////////// first search this user if exists in ldap directory ////////////////\n $searchRes = $this->searchLdap($usernameClean,$ldapType);\n //////////////// EOF first search this user if exists in ldap directory ////////////////\n\n if( $searchRes == NULL || count($searchRes) == 0 ) {\n $this->logger->error(\"LdapAuthentication: can not find user by usernameClean=\" . $usernameClean);\n //$this->logger->error(\"LdapAuthentication: can not find user by usernameClean=[\" . $usernameClean . \"]; token=[\" . $token->getCredentials() . \"]\");\n //$this->logger->error(print_r($searchRes));\n\n if($userSearchRequired) {\n return NULL;\n }\n } else {\n $this->logger->notice(\"LdapAuthentication: user found by usernameClean=\" . $usernameClean);\n /////// EOF testing ///////\n// $user = $this->findUserByUsername($token->getUsername());\n// if( $user ) {\n// $userEmail = $user->getSingleEmail();\n// if (strpos((string)$userEmail, '@nyp.org') !== false) {\n// $this->logger->error(\"LdapAuthentication: NYP user found by usernameClean=[\" . $usernameClean . \"]; token=[\" . $token->getCredentials() . \"]\");\n// }\n// }\n /////// testing ///////\n }\n }\n\n\n //echo \"user exists in ldap directory<br>\";\n //$this->logger->notice(\"LdapAuthentication: user found in LDAP by usernameClean=\".$usernameClean);\n\n //if user exists in ldap, try bind this user and password\n $ldapRes = $this->ldapBind($usernameClean,$token->getCredentials(),$ldapType); //LdapAuthenticationWithSearch\n if( $ldapRes == NULL ) {\n //exit('ldap failed');\n //$this->logger->error(\"LdapAuthentication: can not bind user by usernameClean=[\".$usernameClean.\"]; token=[\".$token->getCredentials().\"]\");\n $this->logger->error(\"LdapAuthentication: can not bind user by usernameClean=[\".$usernameClean.\"];\");\n\n $user = $this->findUserByUsername($token->getUsername());\n $this->validateFailedAttempts($user);\n\n return NULL;\n }\n //exit('ldap success');\n\n //check if user already exists in DB\n $user = $this->findUserByUsername($token->getUsername());\n //echo \"Ldap user =\".$user.\"<br>\";\n\n if( $user ) {\n //echo \"DB user found=\".$user->getUsername().\"<br>\";\n //exit();\n\n $this->logger->notice(\"findUserByUsername: existing user found in DB by token->getUsername()=\".$token->getUsername());\n\n if( $this->canLogin($user) === false ) {\n $this->logger->warning(\"LdapAuthentication: User cannot login \".$user);\n return NULL;\n }\n\n return $user;\n } else {\n $this->logger->warning(\"findUserByUsername: Can not find existing user in DB by token->getUsername()=\".$token->getUsername());\n }\n\n //echo \"1<br>\";\n\n //////////////////// constract a new user ////////////////////\n\n\n// $user = $this->findUserByUsernameAsEmail($token->getUsername());\n// if( $user ) {\n// $this->logger->notice(\"Ldap Authentication: Exit: Username is not cwid. User found in DB by token->getUsername()=\".$token->getUsername());\n// return NULL;\n// }\n\n //testing\n //if( $usernameClean == \"oli2002\" ) {\n //exit(\"attempt generate new admin user\");\n //}\n //exit(\"attempt generate new user\");\n\n $this->logger->notice(\"LdapAuthentication: create a new user found by token->getUsername()=\".$token->getUsername());\n $user = $userSecUtil->constractNewUser($token->getUsername());\n //echo \"user=\".$user->getUsername().\"<br>\";\n\n $user->setCreatedby('ldap');\n\n //modify user: set keytype and primary public user id\n $userkeytype = $userSecUtil->getUsernameType($usernamePrefix);\n\n if( !$userkeytype ) {\n //$userUtil = new UserUtil();\n //$userUtil = $this->get('user_utility');\n //$count_usernameTypeList = $userUtil->generateUsernameTypes();\n $userkeytype = $userSecUtil->getUsernameType($this->usernamePrefix);\n //echo \"userkeytype=\".$userkeytype.\"<br>\";\n }\n\n $user->setKeytype($userkeytype);\n $user->setPrimaryPublicUserId($usernameClean);\n\n if( $searchRes ) {\n $user->setEmail($searchRes['mail']);\n $user->setFirstName($searchRes['givenName']);\n $user->setLastName($searchRes['lastName']);\n $user->setDisplayName($searchRes['displayName']);\n $user->setPreferredPhone($searchRes['telephoneNumber']);\n $user->setPreferredMobilePhone($searchRes['mobile']);\n }\n\n //cwid is admin cwid\n //if( $user->getUsername() == \"cwid1_@_ldap-user\" || $user->getUsername() == \"cwid2_@_ldap-user\" ) {\n // $user->addRole('ROLE_PLATFORM_ADMIN');\n //}\n\n //exit('ldap ok');\n\n //////////////////// save user to DB ////////////////////\n //$userManager = $this->container->get('fos_user.user_manager');\n $userManager = $this->container->get('user_manager');\n $userManager->updateUser($user);\n\n return $user;\n }", "function gnavi_global_search_base( $mydirname , $keywords , $andor , $limit , $offset , $userid )\n{\n\t//if( ! empty( $userid ) ) {\n\t//\treturn array() ;\n\t//}\n\n\t$db =& Database::getInstance() ;\n\n\t// XOOPS Search module\n\t$showcontext = empty( $_GET['showcontext'] ) ? 0 : 1 ;\n\t$select4con = $showcontext ? \"t.description\" : \"'' AS description\" ;\n\n\t$sql = \"SELECT l.lid,l.cid,l.title,l.caption,l.caption1,l.caption2,l.poster_name,l.submitter,l.date,$select4con FROM \".$db->prefix($mydirname.\"_photos\").\" l LEFT JOIN \".$db->prefix($mydirname.\"_text\").\" t ON t.lid=l.lid LEFT JOIN \".$db->prefix(\"users\").\" u ON u.uid=l.submitter WHERE status>0\" ;\n\n\tif( $userid > 0 ) {\n\t\t$sql .= \" AND l.submitter=\".$userid.\" \";\n\t}\n\n\t$whr = \"\" ;\n\tif( is_array( $keywords ) && count( $keywords ) > 0 ) {\n\t\t$whr = \"AND (\" ;\n\t\tswitch( strtolower( $andor ) ) {\n\t\t\tcase \"and\" :\n\t\t\t\tforeach( $keywords as $keyword ) {\n\t\t\t\t\t$whr .= \"CONCAT(l.title,' ',l.caption,' ',l.caption1,' ',l.caption2,' ',t.description,' ',t.addinfo,' ',IFNULL(u.uname,''),' ',l.poster_name) LIKE '%$keyword%' AND \" ;\n\t\t\t\t}\n\t\t\t\t$whr = substr( $whr , 0 , -5 ) ;\n\t\t\t\tbreak ;\n\t\t\tcase \"or\" :\n\t\t\t\tforeach( $keywords as $keyword ) {\n\t\t\t\t\t$whr .= \"CONCAT(l.title,' ',l.caption,' ',l.caption1,' ',l.caption2,' ',t.description,' ',t.addinfo,' ',IFNULL(u.uname,''),' ',l.poster_name) LIKE '%$keyword%' OR \" ;\n\t\t\t\t}\n\t\t\t\t$whr = substr( $whr , 0 , -4 ) ;\n\t\t\t\tbreak ;\n\t\t\tdefault :\n\t\t\t\t$whr .= \"CONCAT(l.title,' ',l.caption,' ',l.caption1,' ',l.caption2,' ',t.description,' ',t.addinfo,' ',IFNULL(u.uname,''),' ',l.poster_name) LIKE '%{$keywords[0]}%'\" ;\n\t\t\t\tbreak ;\n\t\t}\n\t\t$whr .= \")\" ;\n\t}\n\n\t$sql = \"$sql $whr ORDER BY l.date DESC\";\n\t$result = $db->query( $sql , $limit , $offset ) ;\n\t$ret = array() ;\n\t$context = '' ;\n\twhile( $myrow = $db->fetchArray($result) ) {\n\n\t\t// get context for module \"search\"\n\t\tif( function_exists( 'search_make_context' ) && $showcontext ) {\n\t\t\t$full_context = strip_tags( $myrow['description'] ) ;\n\t\t\tif( function_exists( 'easiestml' ) ) $full_context = easiestml( $full_context ) ;\n\t\t\t$context = search_make_context( $full_context , $keywords ) ;\n\t\t}\n\n\t\t$ret[] = array(\n\t\t\t\"image\" => \"images/pict.gif\" ,\n\t\t\t\"link\" => \"index.php?lid=\".$myrow[\"lid\"] ,\n\t\t\t\"title\" => $myrow[\"title\"] ,\n\t\t\t\"time\" => $myrow[\"date\"] ,\n\t\t\t\"uid\" => $myrow[\"submitter\"] ,\n\t\t\t\"context\" => $context\n\t\t) ;\n\t}\n\treturn $ret;\n}", "public function search() {\n\t\t// @todo Please modify the following code to remove attributes that should not be searched.\n\n\t\t$criteria = new CDbCriteria;\n\n\t\t$criteria->compare('id', $this->id);\n\t\t$criteria->compare('child_urn', $this->child_urn, true);\n\t\t$criteria->compare('child_urn_prefix', $this->child_urn_prefix, true);\n\t\t$criteria->compare('child_urn_suffix', $this->child_urn_suffix, true);\n\t\t$criteria->compare('first_name', $this->first_name, true);\n\t\t$criteria->compare('middle_name', $this->middle_name, true);\n\t\t$criteria->compare('last_name', $this->last_name, true);\n\t\t$criteria->compare('preffered_name', $this->preffered_name, true);\n\t\t$criteria->compare('address_1', $this->address_1, true);\n\t\t$criteria->compare('address_2', $this->address_2, true);\n\t\t$criteria->compare('address_3', $this->address_3, true);\n\t\t$criteria->compare('postcode', $this->postcode, true);\n\t\t$criteria->compare('dob', $this->dob, true);\n\t\t$criteria->compare('birth_certificate', $this->birth_certificate, true);\n\t\t$criteria->compare('is_term_time', $this->is_term_time, true);\n\t\t$criteria->compare('is_funding', $this->is_funding, true);\n\t\t$criteria->compare('booking_type', $this->booking_type, true);\n\t\t$criteria->compare('enroll_date', $this->enroll_date, true);\n\t\t$criteria->compare('start_date', $this->start_date, true);\n\t\t$criteria->compare('leave_date', $this->leave_date, true);\n\t\t$criteria->compare('gender', $this->gender, true);\n\t\t$criteria->compare('client_id', $this->client_id);\n\t\t$criteria->compare('profile_photo', $this->profile_photo, true);\n\t\t$criteria->compare('profile_photo_thumb', $this->profile_photo_thumb, true);\n\t\t$criteria->compare('branch_id', Yii::app()->session['branch_id']);\n\t\t$criteria->compare('is_deleted', $this->is_deleted);\n\t\t$criteria->compare('is_active', $this->is_active);\n\t\t$criteria->compare('room_id', $this->room_id);\n\t\t$criteria->compare('key_person', $this->key_person);\n\t\t$criteria->compare('discount', $this->discount);\n\t\t$criteria->compare('funded_hours', $this->funded_hours);\n\t\t$criteria->compare('link_to_staff', $this->link_to_staff, true);\n\t\t$criteria->compare('sibling_id', $this->sibling_id);\n\t\t$criteria->compare('preffered_session', $this->preffered_session);\n\t\t$criteria->compare('latitude', $this->latitude, true);\n\t\t$criteria->compare('longitude', $this->longitude, true);\n\t\t$criteria->compare('monthly_invoice_amount', $this->monthly_invoice_amount);\n\t\t$criteria->compare('external_id', $this->external_id);\n\t\t$criteria->compare('monthly_invoice_start_date', $this->monthly_invoice_start_date, true);\n\t\t$criteria->compare('monthly_invoice_finish_date', $this->monthly_invoice_finish_date, true);\n\t\t$criteria->compare('is_lac', $this->is_lac);\n\t\t$criteria->compare('is_pupil_premium', $this->is_pupil_premium);\n\n\t\treturn new CActiveDataProvider($this, array(\n\t\t\t'criteria' => $criteria,\n\t\t\t'pagination' => array(\n\t\t\t\t'pageSize' => 20,\n\t\t\t)\n\t\t));\n\t}", "function search()\n\t{\n\t\n\t\t$filter = null;\n\t\t$sort = null;\n\t \n\t \tif ($this->searchString)\n\t \t{\n\t \t\tif ($this->searchField==\"name\") $filter = $this->nameFilter();\n\t \t\telse $filter = $this->searchField.\"='\".$this->searchString.\"'\";\n\t\t}\n\n\t\tif ($this->searchSort)\n\t\t{\n\t\t\tif ($this->searchSort==\"name\") $sort = \"first_name,last_name\";\n\t\t\telse $sort = $this->searchSort;\n\t\t}\n\t\t\n\t\t//run the query\t \n\t\t$sql = \"SELECT auth.accounts.*,(first_name || ' ' || last_name) AS full_name FROM auth.accounts \";\n\t\tif ($filter) $sql .= \" WHERE \".$filter;\n\t\tif ($sort) $sql .= \" ORDER BY \".$sort;\n\n\t\treturn $this->DB->fetch($sql);\n\t \n\t}" ]
[ "0.7656768", "0.7459528", "0.7445053", "0.7397273", "0.73678654", "0.7127501", "0.6956033", "0.69118017", "0.66198444", "0.6499346", "0.62780184", "0.61971945", "0.61842906", "0.61796135", "0.6091552", "0.5949315", "0.59187734", "0.564659", "0.55321264", "0.5526388", "0.55209243", "0.5407453", "0.53924924", "0.53905755", "0.53614503", "0.52963954", "0.5260993", "0.522615", "0.5211969", "0.5197073" ]
0.7694474
0
If the given value is not an array and not null, wrap it in one.
public static function wrap($value) { if (is_null($value)) { return []; } return is_array($value) ? $value : [$value]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private function wrap($value): array\n {\n if (! is_array($value)) {\n $value = empty($value) ? [] : [$value];\n }\n\n return $value;\n }", "public static function wrap(mixed $value): array\n {\n if (is_null($value)) {\n return [];\n }\n\n return is_array($value) ? $value : [$value];\n }", "function liftArray($val) {\n return is_array($val)\n ? $val\n : [$val];\n}", "private static function expandValue($value): ?array\n {\n // Drops all empty values (but not 0 or false).\n if ('' === $value || null === $value || [] === $value) {\n return null;\n }\n // Normalize non-array input using the value separator.\n if (\\is_string($value)) {\n return Query::valuesDecode($value);\n }\n if (!\\is_array($value)) {\n // @todo This might explode.\n return [(string)$value];\n }\n return $value;\n }", "function maybe_json_encode($value)\n {\n if (is_array($value) || is_object($value)) {\n $value = json_encode($value);\n }\n\n return $value;\n }", "abstract protected function _normalizeArray($value);", "abstract protected function _normalizeArray($value);", "abstract protected function _normalizeArray($value);", "function array_convert($value, $default = array())\n{\n if (is_array($value)) return $value;\n\n if ($value instanceof \\Traversable) {\n return iterator_to_array($value);\n } elseif (is_object($value)) {\n return get_object_vars($value);\n } elseif (is_string($value)) {\n return str_split($value);\n } elseif (is_scalar($value) || is_null($value)) {\n return array($value);\n }\n\n return $default;\n}", "private function fixValue($value)\n {\n if (is_array($value)) {\n foreach ($value as &$v) {\n $v = $this->fixValue($v);\n }\n } elseif (is_numeric($value)) {\n // aus dem int ein string machen\n $value = strval($value);\n }\n //\t\telseif(is_object($value)) {\n //\t\t\t// was passiert mit objekten?\n //\t\t}\n return $value;\n }", "protected function filter_array($value) : ?array\n\t{\n\t\tif(is_array($value) == true)\n\t\t{\n\t\t\treturn $value;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn null;\n\t\t}\n\t}", "public static function arrayWriteFilter($value)\n {\n if (is_array($value)) {\n return serialize($value);\n }\n return $value;\n }", "function smart_implode($value, $glue='') {\n return is_array($value) ? implode($glue, $value) : $value;\n}", "protected function convertToArray($value)\n {\n if (\\is_string($value)) {\n $value = [$value];\n } elseif (null === $value) {\n $value = [];\n }\n\n return $value;\n }", "public function escape($value) {\n if (is_array($value)) {\n $res = '';\n if (count($value) == 0) return 'null';\n foreach($value as $val) {\n $res .= $this->escapeOne($val).',';\n }\n $res = substr($res, 0, -1);\n return $res;\n } else {\n return $this->escapeOne($value);\n }\n }", "static function prepareArrayForInput(array $value) {\n return base64_encode(json_encode($value));\n }", "function kore_array_filter_array($value) {\r\n if (is_array($value)) {\r\n return FALSE;\r\n }\r\n return TRUE;\r\n}", "protected function prepare_value( $value ) {\n\t\tif ( papi_is_empty( $value ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$value = papi_santize_data( $value );\n\n\t\tif ( is_array( $value ) ) {\n\t\t\t$value = array_filter( $value, function ( $val ) {\n\t\t\t\treturn ! papi_is_empty( $val );\n\t\t\t} );\n\n\t\t\tif ( ! count( array_filter( array_keys( $value ), 'is_string' ) ) ) {\n\t\t\t\t$value = array_values( $value );\n\t\t\t}\n\t\t}\n\n\t\treturn $value;\n\t}", "private function filterValue($value)\n {\n if (is_array($value) && count($value) == 1) {\n foreach ($value as $v) {\n $value = $v;\n }\n }\n\n return $value;\n }", "private function asArray(mixed $value): array {\n if (is_array($value)) {\n return $value;\n }\n\n return [$value];\n }", "private function add_value(mixed $value){\r\n\t\tarray_push($this->values, ...(is_array($value) ? $value : [$value]));\r\n\t}", "static function set_data_type( $value = NULL ) {\n\n\t\t// Definitely an array\n\t\tif ( is_array( $value )) { \n\n\t\t\treturn (array) $value;\n\n\t\t// Definitely a string\n\t\t} elseif ( is_string( $value )) { \n\n\t\t\t// Definitely a string containing numbers\n\t\t\tif ( is_numeric( $value )) { \n\n\t\t\t\t// This checks if the number is an octal ( check http://php.net/manual/en/function.octdec.php ). If this so, must be returned as it is\n\t\t\t\tif ( decoct( octdec( $value ) ) == $value ) { \n\n\t\t\t\t\treturn $value;\n\n\t\t\t\t// If the string DOES NOT contain non-digit characters, this means that it is an integer\n\t\t\t\t} elseif ( ctype_digit( $value ) ) { \n\n\t\t\t\t\tsettype( $value, 'integer');\n\t\t\t\t\treturn $value;\n\n\t\t\t\t// If the string DOES contain non-digit characters, this means that it's a float number\n\t\t\t\t} else { \n\n\t\t\t\t\tsettype( $value, 'float');\n\t\t\t\t\treturn $value;\n\n\t\t\t\t} \n\n\t\t\t// A string that should be returned normally as a string\n\t\t\t} else { \n\n\t\t\t\treturn $value;\n\t\t\t} \n\n\t\t// Definitely an integer\n\t\t} elseif ( is_int( $value )) { \n\n\t\t\tsettype( $value, 'integer');\n\t\t\treturn $value;\n\n\t\t// Definitely a float/double number\n\t\t} elseif ( is_float( $value )) { \n\n\t\t\tsettype( $value, 'float');\n\t\t\treturn $value;\n\n\t\t// Definitely a boolean\n\t\t} elseif ( is_bool( $value )) { \n\n\t\t\tsettype( $value, 'boolean');\n\t\t\treturn $value;\n\n\t\t// Definitely a NULL\n\t\t} elseif ( is_null( $value )) { \n\n\t\t\treturn NULL;\n\t\t}\n\t}", "public static function forceArrayAccess($value)\n {\n return Type::forceAndReturn($value, ArrayAccess::class);\n }", "public function stringEncode($value)\n {\n return $value\n ? json_encode(array_values($value))\n : null;\n }", "function addtoarray_single($array1, $array2)\n{\n //\n if (is_array($array2)) {\n foreach ($array2 as $ar) {\n if ($ar && $ar !== null) {\n $array1[] = $ar;\n }\n }\n }\n return $array1;\n}", "public function marshal($value)\n {\n if (is_array($value) || $value === null) {\n return $value;\n }\n return json_decode($value, true);\n }", "protected function flattenValues(array $value){\n\t\tarray_walk($value, function(&$v, $k){\n\t\t\tif(is_array($v)){\n\t\t\t\t$v = implode(\",\", $v);\n\t\t\t}\n\t\t});\n\t\treturn $value;\n\t}", "function ensure_array($x) {\n if (is_array($x)) {\n return $x;\n }\n return [$x];\n}", "private function Wrap1DArray( array $input ) {\r\n\r\n\t\tif ($this->Is1DArray( $input )) { return array( $input );\r\n\t\t} else { return $input; }\r\n\r\n\t}", "function with($value = null) {\n if(!is_array($value) && !is_object($value)) {\n $value = [$value];\n }\n \n return apply($value);\n}" ]
[ "0.70521003", "0.66502225", "0.6561632", "0.6424765", "0.6157786", "0.59931237", "0.59931237", "0.59931237", "0.59184986", "0.5916572", "0.5839903", "0.58289677", "0.57525873", "0.57245296", "0.5708314", "0.57051545", "0.56889147", "0.56798697", "0.5678344", "0.56209433", "0.5569218", "0.5545437", "0.5534882", "0.5520096", "0.5507005", "0.549209", "0.5485041", "0.5475051", "0.54685354", "0.5466411" ]
0.744515
1
Separate an array into two arrays. One with keys and the other with values.
public static function separate($array) { return ["keys" => array_keys($array), "values" => array_values($array)]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function divide($array)\n {\n return [array_keys($array), array_values($array)];\n }", "function arrayKeysAndValues() {\r\n}", "function array_divide($array)\n {\n return array(array_keys($array), array_values($array));\n }", "function array_divide($array)\n {\n return array(array_keys($array), array_values($array));\n }", "function pairs($arr) {\n return call(compose(\n 'array_values',\n mapKV(function($key, $val) { return [$key, $val]; })\n ), $arr);\n}", "public static function divide($array)\n {\n return [\n array_keys($array),\n array_values($array),\n ];\n }", "function array_divide($array)\n{\n\treturn array(array_keys($array), array_values($array));\n}", "protected function _split(array $array)\r\n {\r\n $associated = array();\r\n $indexed = array();\r\n foreach ($array as $key => $value) {\r\n if (is_int($key)) {\r\n $indexed[$key] = $value;\r\n } else {\r\n $associated[$key] = $value;\r\n }\r\n }\r\n return compact('associated', 'indexed');\r\n }", "function AssocArrayToValues ($input) {\r\n $array = array();\r\n foreach ($input as $key => $value)\r\n $array[] = array($key, $value);\r\n return $array;\r\n}", "public static function switchKeyValue(&$array) {\n if (!is_array($array)) return array();\n \n $return = array();\n foreach($array as $k => &$row) {\n $return[$row] = $k;\n }\n \n return $return;\n }", "public static function makeValuepairs($array, $key, $value)\n {\n\n $temp_array = array();\n\n if (is_array($array)) {\n foreach($array as $item) {\n if (empty($key)) {\n $temp_array[] = $item[$value];\n } else {\n $temp_array[$item[$key]] = $item[$value];\n }\n\n }\n }\n\n return $temp_array;\n\n }", "function array_transpose($array) {\n\t$t = [];\n\n\tforeach ($array as $key => $value) {\n\t\tforeach ($value as $key2 => $value2) {\n\t\t\t$t[$key2][$key] = $value2;\n\t\t}\n\t}\n\n\treturn $t;\n}", "public static function keyExplode(&$array, $key) {\n if (!is_array($array)) return array();\n $return = array();\n \n foreach($array as $k => &$row) {\n if (isset($row[$key])) {\n $return[$row[$key]] = $row;\n }\n }\n \n return $return;\n }", "public function getArray(){\n\t\t$array = array();\n\t\tforeach ($this as $key => $value) {\n\t\t\t$array[substr($key, 1)] = $value;\n\t\t}\n\t\treturn $array;\n\t}", "public function toArray(): array {\n $array = [];\n foreach ($this->pairs as $pair) {\n $array[$pair->key] = $pair->value;\n }\n return $array;\n }", "function array_combine (array $keys, array $values) {}", "function ArrayNormalize($array) {\n $result = [];\n foreach ($array as $key => $items) {\n foreach ($items as $arr => $value) {\n $result[$value] = $key;\n }\n }\n return $result;\n}", "function explodearray($delimiters, $array,$kv = '=>')\n\t \t{\n\t \t$a=true;\n\t \t$b=0;\n\t \t$c=0;\n\t \tif ($a = explode(chr( 1 ), str_replace( $delimiters, chr( 1 ), $array))) \n\t\t\t{ // create parts\n\t\t\t foreach ($a as $s) \n\t\t\t { // each part\n\t\t\t \tif ($s) \n\t\t\t \t{\n\t\t\t \tif ($pos = strpos($s, $kv)) \n\t\t\t \t{ // key/value delimiter\n\t\t\t \t\t$ka[trim(substr($s, 0, $pos))] = trim(substr($s, $pos + strlen($kv)));\n\t\t\t \t} \n\t\t\t \telse \n\t\t\t \t{ // key delimiter not found\n\t\t\t \t\tif ($a==true)\n\t\t\t \t\t{\n\t\t\t \t\t\t$ka['lat'][$b++] = trim($s);\n\t\t\t \t\t\t$a=false;\n\t\t\t \t\t}\n\t\t\t \t\telse\n\t\t\t \t\t{\n\t\t\t \t\t\t$ka['lng'][$c++] = trim($s);\n\t\t\t \t\t\t$a=true;\n\t\t\t \t\t}\n\t\t\t \t\t\n\t\t\t \t}\n\t\t\t \t}\n\t\t\t }\n\t\t\t return $ka;\n\t\t\t}\n\t \t}", "function _rearrange_array( array $array ): array {\n\t$ret = array();\n\tforeach ( $array as $key => $val ) {\n\t\tif ( is_array( $val ) ) {\n\t\t\t$val = _rearrange_array( $val );\n\t\t}\n\t\tif ( ! empty( $val ) ) {\n\t\t\tif ( is_int( $key ) ) {\n\t\t\t\t$ret[] = $val;\n\t\t\t} else {\n\t\t\t\t$key = lcfirst( strtr( ucwords( strtr( $key, '_', ' ' ) ), ' ', '' ) );\n\n\t\t\t\t$ret[ $key ] = $val;\n\t\t\t}\n\t\t}\n\t}\n\treturn $ret;\n}", "function associative_array_to_tuples($array, $f = null)\n{\n\t$ret = array();\n\tforeach ($array as $k => $v)\n\t\t// convert to float for json_encode (int overflows)\n\t\t$ret[] = array((float) $k, $v);\n\treturn $ret;\n}", "function assoc_array($array) {\n $assoc_array = array();\n foreach($array as $k => $v) $assoc_array[$v] = $v;\n return $assoc_array;\n}", "public static function explode($array,$delim = \"=\")\n {\n $result = array();\n foreach ($array as $value)\n {\n $pair = explode($delim, $value);\n $result[trim($pair[0])] = (isset($pair[1])) ? $pair[1] : null;\n }\n\n return $result;\n }", "public function toArray(): array\n {\n $array = [];\n\n foreach ($this as $pair) {\n $array[$pair->getKey()] = $pair->getValue();\n }\n\n return $array;\n }", "public static function double_explode($array,$delim_pairs = \" \",$delim_KeyValue = \"=\")\n {\n $result = array();\n foreach ($array as $line)\n {\n $pairs = explode($delim_pairs, $line);\n\n $row = array();\n foreach ($pairs as $KeyValue)\n {\n $split_key_value = explode($delim_KeyValue,$KeyValue);\n $row[$split_key_value[0]] = (!array_key_exists(1, $split_key_value)) ? null : $split_key_value[1];\n }\n $result[] = $row;\n }\n\n return $result;\n }", "public static function set2Array(array $array) {\n\t\tforeach( $array as &$value ) {\n\t\t\t$value = $value->getValue();\n\t\t}\n\t\treturn $array;\n\t}", "public function interlaceAssocArray(array $array){\n\t\t$return = [];\n\t\tforeach($array as $key => $value){\n\t\t\t$return[] = $key;\n\t\t\t$return[] = $value;\n\t\t}\n\t\treturn $return;\n\t}", "protected function diverse_array($vector) { \n\t\t$result = array(); \n\t\t\tforeach($vector as $key1 => $value1) \n\t\t\t\tforeach($value1 as $key2 => $value2) \n\t\t\t\t\t$result[$key2][$key1] = $value2; \n\t\t\treturn $result; \n\t}", "public function getArrayKeyvaluePair( $key ) {\n $array = array();\n foreach ($key as $Arrkey => $Arrvalue) {\n $array[$Arrvalue] = $Arrvalue; \n }\n return $array;\n }", "public function toKeyValues(array $array, $key) {\n // traverse the input\n foreach ($array as $arrayKey => $value) {\n // create a new array entry\n $array[$value[$key]] = $value;\n // unset the original key and redundant subarray key\n unset($array[$arrayKey]); unset($array[$value[$key]][$key]);\n }\n return $array;\n }", "function hashToPairs($hash1)\n{\n $newArr = [];\n foreach ($hash1 as $key => $value) {\n $newArr[] = [$key, $value];\n }\n return $newArr;\n}" ]
[ "0.67144096", "0.66880417", "0.6658741", "0.6658741", "0.65322953", "0.6518045", "0.6482652", "0.6333797", "0.6251427", "0.62162286", "0.6208218", "0.62053317", "0.5975063", "0.59133726", "0.58963287", "0.5887097", "0.58746547", "0.5851991", "0.5755393", "0.57527107", "0.5732072", "0.57215554", "0.57060057", "0.5696713", "0.5679891", "0.56445044", "0.5639457", "0.5638123", "0.5637721", "0.5630471" ]
0.7666559
0
Cross join the given arrays, returning all possible permutations.
public static function crossJoin(...$arrays) { $results = [[]]; foreach ($arrays as $index => $array) { $append = []; foreach ($results as $product) { foreach ($array as $item) { $product[$index] = $item; $append[] = $product; } } $results = $append; } return $results; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cross(array $A, array $B) {\n $out = array();\n foreach ($A as $a) {\n foreach ($B as $b) {\n $out[] = $a . $b;\n }\n }\n return $out;\n}", "function combinations($arrays=Array(), $i=0) {\n\t\tif (!isset($arrays[$i])) {\n return array();\n }\n if ($i == count($arrays) - 1) {\n return $arrays[$i];\n }\n\n $tmp = $this->combinations($arrays, $i + 1);\n\n $result = array();\n\n foreach ($arrays[$i] as $v) {\n foreach ($tmp as $t) {\n $result[] = is_array($t) ? \n array_merge(array($v), $t) :\n array($v, $t);\n }\n }\n\n return $result;\n\t}", "public static function mconcat(array $xs);", "private function _combineArraysSeq(array $fields, array $values) {\n \n $fieldscount = count($fields);\n $valuescount = count($values);\n \n // More fields than values\n if ($fieldscount > $valuescount) {\n // How many fields are we missing at the end of the $values array?\n $more = $fieldscount - $valuescount;\n // Add empty strings to ensure arrays $fields and $values have same number of elements\n for($i = 0; $i < $more; $i++) {\n $values[] = '';\n }\n \n // More values than fields\n } elseif ($valuescount > $fieldscount) {\n // Slice extra values \n $values = array_slice($values, 0, $fieldscount);\n }\n \n $combined = array_combine($fields, $values);\n return $combined;\n }", "function sbx_array_cartesian( $input ) {\n\t$input = array_filter( $input );\n\t$results = array();\n\t$indexes = array();\n\t$index = 0;\n\n\t// Generate indexes from keys and values so we have a logical sort order.\n\tforeach ( $input as $key => $values ) {\n\t\tforeach ( $values as $value ) {\n\t\t\t$indexes[ $key ][ $value ] = $index++;\n\t\t}\n\t}\n\n\t// Loop over the 2D array of indexes and generate all combinations.\n\tforeach ( $indexes as $key => $values ) {\n\t\t// When result is empty, fill with the values of the first looped array.\n\t\tif ( empty( $results ) ) {\n\t\t\tforeach ( $values as $value ) {\n\t\t\t\t$results[] = array( $key => $value );\n\t\t\t}\n\t\t} else {\n\t\t\t// Second and subsequent input sub-array merging.\n\t\t\tforeach ( $results as $result_key => $result ) {\n\t\t\t\tforeach ( $values as $value ) {\n\t\t\t\t\t// If the key is not set, we can set it.\n\t\t\t\t\tif ( ! isset( $results[ $result_key ][ $key ] ) ) {\n\t\t\t\t\t\t$results[ $result_key ][ $key ] = $value;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If the key is set, we can add a new combination to the results array.\n\t\t\t\t\t\t$new_combination = $results[ $result_key ];\n\t\t\t\t\t\t$new_combination[ $key ] = $value;\n\t\t\t\t\t\t$results[] = $new_combination;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Sort the indexes.\n\tarsort( $results );\n\n\t// Convert indexes back to values.\n\tforeach ( $results as $result_key => $result ) {\n\t\t$converted_values = array();\n\n\t\t// Sort the values.\n\t\tarsort( $results[ $result_key ] );\n\n\t\t// Convert the values.\n\t\tforeach ( $results[ $result_key ] as $key => $value ) {\n\t\t\t$converted_values[ $key ] = array_search( $value, $indexes[ $key ], true );\n\t\t}\n\n\t\t$results[ $result_key ] = $converted_values;\n\t}\n\n\treturn $results;\n}", "public function createCombinations(array $array1, array $array2)\n {\n $combinations = [];\n \n $totalCombinations = 1;\n foreach (func_get_args() as $array) {\n $totalCombinations *= count($array);\n }\n \n // Initialise the indexes for accessing the arrays to build the\n // combinations.\n $indexes = [];\n for ($i = 0; $i < func_num_args(); ++$i) {\n $indexes[] = 0;\n }\n \n for ($i = 0; $i < $totalCombinations; ++$i) {\n $elements = [];\n foreach (func_get_args() as $a => $array) {\n $elements[] = $array[$indexes[$a]];\n }\n $combinations[] = $elements;\n \n // Set the next index to create the next combination.\n foreach (func_get_args() as $a => $array) {\n if (++$indexes[$a] < count($array)) {\n break;\n }\n $indexes[$a] = 0;\n }\n }\n \n return $combinations;\n }", "function zip() {\n\t\t// Grab all arrays from the parameters\n\t\t$arrays = func_get_args();\n\t\t$result = array();\n\t \n\t\t// Count the length of the arrays to get the length of the longest\n\t\t$longest = array_reduce($arrays, function($old, $e) {\n\t\t\treturn max($old, count($e));\n\t\t}, 0);\n\t \n\t\t// Traverse the arrays, one element at a time\n\t\tfor ($i = 0; $i < $longest; $i++) {\n\t\t\tforeach($arrays as $a) {\n\t\t\t\tif(isset($a[$i])) {\n\t\t\t\t\t$result[] = $a[$i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Turn string array into a full string (remove if string array needed) and return\n\t\treturn implode($result);\n\t}", "function array_product (array $array) {}", "public function join(array $left, array $right) : array;", "public static function array_comb($array1, $array2) {\n $out = array();\n foreach ($array1 as $key => $value) {\n $out[$value] = $array2[$key];\n }\n return $out;\n }", "function mg_create_array_combinations( $array ) {\n\t// initialize by adding the empty set\n\t$results = array(array( ));\n\n\tforeach ($array as $element)\n\t\tforeach ($results as $combination)\n\t\t\tarray_push($results, array_merge(array($element), $combination));\n\n\treturn $results;\n}", "protected function makeCombinations($product_ids = array()) {\n $this->squareup_diff->output(\"Preparing combinations of OpenCart required product options...\");\n\n $limit = 1000;\n $page = 0;\n\n do {\n $product_id_condition = \"\";\n\n if (!empty($product_ids)) {\n $product_id_condition = \" WHERE product_id IN (\" . implode(\",\", $product_ids) . \") \";\n }\n\n $sql = \"SELECT product_id, sku, upc, model, price, quantity, subtract FROM `\" . DB_PREFIX . \"product` \" . $product_id_condition . \" LIMIT \" . ($page * $limit) . \",\" . $limit;\n\n $result = $this->db->query($sql);\n $num_rows = $result->num_rows;\n\n if ($num_rows > 0) {\n array_map(array($this, 'makeProductCombinations'), $result->rows);\n\n $page++;\n }\n } while ($num_rows > 0);\n\n $this->submitCombinations();\n\n $this->db->query(\"DELETE FROM `\" . DB_PREFIX . \"squareup_combination` WHERE product_id NOT IN (SELECT product_id FROM `\" . DB_PREFIX . \"product`)\");\n }", "public static function couple(array $items)\n\t{\n\t\t$a = array();\n\t\tfor ($i = 0, $n = count($items); $i < $n; $i++)\n\t\t\tfor ($j = $i + 1; $j < $n; $j++)\n\t\t\t\t$a[] = array($items[$j], $items[$i]);\n\t\treturn $a;\n\t}", "public function pc_array_power_set($array) \n {\n $results = array(array( ));\n $ids = array(array( ));\n \n foreach ($array as $key => $element)\n {\n \n foreach ($results as $combination)\n {\n array_push($results, array_merge(array($element), $combination));\n }\n foreach($ids as $combinations)\n {\n array_push($ids, array_merge(array($key), $combinations));\n }\n }\n return array($results,$ids);\n }", "public static function concat()\n {\n foreach (func_get_args() as $xs) {\n foreach ($xs as $x) {\n yield $x;\n }\n }\n }", "private function getCombinations(array $vars)\n {\n return VarUtils::getCombinations($vars, $this->values);\n }", "function pcArrayPowerSet($array)\n{\n $results = array(array());\n\n foreach ($array as $element)\n\tforeach ($results as $combination)\n\t array_push($results, array_merge(array($element), $combination));\n\n return $results;\n\n}", "public static function multiPad($arrays, $pad = null)\n {\n $longest = max(static::map('count', $arrays));\n return static::map(F::curry('array_pad', new _, $longest, $pad), $arrays);\n }", "public function mTranspose($a)\n {\n $n = count($a);\n $m = count($a[1]);\n \n for ($i=1; $i<=$n; $i++) {\n for ($j=1; $j<=$m; $j++) {\n $c[$j][$i] = $a[$i][$j];\n }\n }\n \n return $c; \n }", "function array_merge_recursive_distinct()\n\t{\n\t\t$arrays = func_get_args();\n\t\t$base = array_shift($arrays);\n\t\tif(!is_array($base)) $base = empty($base) ? array() : array($base);\n\t\tforeach($arrays as $append)\n\t\t{\n\t\t\tif(!is_array($append)) $append = array($append);\n\t\t\tforeach($append as $key => $value) {\n\t\t\t\tif(!array_key_exists($key, $base) and !is_numeric($key))\n\t\t\t\t{\n\t\t\t\t\t$base[$key] = $append[$key];\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif(is_array($value) or is_array($base[$key]))\n\t\t\t\t{\n\t\t\t\t\t$base[$key] = array_merge_recursive_distinct($base[$key], $append[$key]);\n\t\t\t\t} else if(is_numeric($key))\n\t\t\t\t{\n\t\t\t\t\tif(!in_array($value, $base)) $base[] = $value;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\t$base[$key] = $value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $base;\n\t}", "protected static function multiple_combine($properties) {\n $combinations = array();\n // Get first key, value. We need to make sure the array pointer is reset.\n $value = reset($properties);\n $key = key($properties);\n array_shift($properties);\n $values = is_array($value) ? $value : array($value);\n foreach ($values as $value) {\n if ($properties) {\n foreach (self::multiple_combine($properties) as $merge) {\n $combinations[] = array_merge(array($key => $value), $merge);\n }\n }\n else {\n $combinations[] = array($key => $value);\n }\n }\n return $combinations;\n }", "public function transpose(array $similarArrays): array\n {\n return StaticArrayUtils::transpose($similarArrays);\n }", "public static function getAllCombinations($arr): array\n {\n $firstId = key($arr);\n if (count($arr) === 1) {\n return [$firstId => $arr];\n }\n $first = $arr[$firstId];\n unset($arr[$firstId]);\n $combinations = self::getAllCombinations($arr);\n $newCombinations = $combinations;\n foreach ($newCombinations as &$item) {\n $item[$firstId] = $first;\n }\n return array_merge([[$firstId => $first]], $combinations, $newCombinations);\n }", "function premutation($arr){\n\tif(count($arr)<2){\n\t\treturn $arr;\n\t}else{\n\t\t$ret = array();\n\t\tforeach ($arr as $key => $value) {\n\t\t\t$newRet = $arr;\n\t\t\tunset($newRet[$key]);\n\t\t\t$tmpRet = premutation($newRet);\n\t\t\tforeach($tmpRet as $k=>$v){\n\t\t\t\t$ret[] = $value.$v;\n\t\t\t}\n\t\t}\n\t\treturn $ret;\n\t}\n}", "public static function permutations($set, $length) {\n // If generating single-length elements, just wrap each element as an array\n // and return.\n if ($length === 1) {\n $wrapped = array();\n\n for ($i = 0; $i < sizeof($set); $i++) {\n array_push($wrapped, array($set[$i]));\n }\n\n return $wrapped;\n }\n\n // Length greater than 1, recurse.\n $subperms = Util::permutations($set, $length - 1);\n // Carry forward elements from recursion.\n $perms = $subperms;\n\n // Take each element from the set, insert into each position in each \n // subpermutation where the subpermutation doesn't already include said \n // element.\n for ($i = 0; $i < sizeof($set); $i++) {\n for ($j = 0; $j < sizeof($subperms); $j++) {\n if (!in_array($set[$i], $subperms[$j])) {\n for ($k = 0; $k <= sizeof($subperms[$j]); $k++) {\n $copy = $subperms[$j];\n array_splice($copy, $k, 0, $set[$i]);\n // Don't duplicate permutations.\n if (!in_array($copy, $perms)) {\n array_push($perms, $copy);\n }\n }\n }\n }\n }\n\n return $perms;\n }", "function combine_arrays($names, $compare){\n foreach ($names as $val) {\n $val2 = array_shift($compare);\n $array3[] = $val;\n if ($val != $val2) {\n $array3[] = $val2;\n }\n }\n return $array3;\n}", "public static function uniteArrays() {\r\n $_aArray = array();\r\n foreach (array_reverse(func_get_args()) as $_aArg) {\r\n $_aArray = self::uniteArraysRecursive(self::getAsArray($_aArg), $_aArray);\r\n }\r\n return $_aArray;\r\n }", "public static function combine(array $keys, array $values)\n {\n $keyCount = count($keys);\n $valueCount = count($values);\n if ($keyCount != $valueCount) {\n $size = ($keyCount > $valueCount) ? $valueCount : $keyCount;\n $keys = array_slice($keys, 0, $size);\n $values = array_slice($values, 0, $size);\n }\n return array_combine($keys, $values);\n }", "public function concatenate(array $paths);", "protected function combineArrays($array1, $array2) {\n\t\tif($array1 && $array2) {\n\t\t\t$result = array();\n\t\t\tforeach($array2 as $k2 => $v2) {\n\t\t\t\tif(!is_array($v2) && strlen($v2) > 0) $result[$k2] = $v2;\n\t\t\t}\n\t\t\tforeach($array1 as $k1 => $v1) if(!array_key_exists($k1, $result) && !is_array($v1) && strlen($v1) > 0) $result[$k1] = $v1;\n\t\t\treturn $result;\n\t\t} else if($array1) return $array1;\n\t\telse if($array2) return $array2;\n\t\telse return array();\n\t}" ]
[ "0.687357", "0.66913456", "0.60365283", "0.5833637", "0.58315104", "0.58100265", "0.5801152", "0.57353127", "0.56593055", "0.5577729", "0.55674076", "0.54386866", "0.5356879", "0.5318304", "0.52413183", "0.5198324", "0.5196868", "0.5163738", "0.5159052", "0.51386374", "0.5082545", "0.50807387", "0.49689558", "0.49612588", "0.49464497", "0.49423045", "0.49339554", "0.49073726", "0.490326", "0.4870875" ]
0.8095172
0
Get only Positive numeric values from an array
public static function positive($array) { $callback = function ($v) { return (is_numeric($v) && $v > 0) + 0; }; return self::filter($array, $callback); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function negative($array)\n {\n $callback = function ($v) {\n return (is_numeric($v) && $v < 0) + 0;\n };\n return self::filter($array, $callback);\n }", "public static function isPositive(array $array)\n {\n if (min($array) > 0) {\n return true;\n }\n return false;\n }", "function array_is_numeric($array){\r\n\t\t$results = array();\r\n\t\tif(is_array($array)){\r\n\t\t\tforeach($array as $key => $item){\r\n\t\t\t\t$results[] = (is_numeric($item)&&is_numeric($key));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn ( !in_array(false, $results) && count($results) > 0 );\r\n\t}", "function CleanUpArrayOfInt($array)\n{\n $result = array();\n if (isNullOrEmptyArray($array)) {\n return $result;\n }\n reset($array);\n foreach ($array as $key => $value) {\n if (isInteger($value)) {\n $result[] = $value;\n }\n }\n reset($array);\n\n return $result;\n}", "function positiveVibrationalFequencies($array) {\n if(!empty($array)) {\n $error = 0;\n foreach($array as $line) {\n $num = floatval(substr($line, 0, -7));\n if($num < 0) {\n $error = 1;\n }\n }\n if($error == 0) {\n return TRUE;\n } else {\n return FALSE;\n }\n } else {\n return null;\n }\n}", "protected function _numeric ($array = array()) {\n $isNumeric = true;\n \n \tif (empty($array)) {\n \t\treturn null;\n \t}\n \t$keys = array_keys($array);\n\tforeach ($keys as $key) {\n\t if (!is_numeric($key)) {\n\t \treturn !$isNumeric;\n\t }\n\t}\n\treturn $isNumeric;\n }", "function positive_sum($arr) {\n $sum = 0;\n foreach($arr as $x) {\n if ($x > 0) {\n $sum += $x;\n }\n }\n return $sum;\n }", "protected function array_values_are_numeric($array) {\n foreach ($array as $value) {\n if (!is_numeric($value))\n return false;\n }\n return true;\n }", "function CheckIntVars($array_to_check=array())\n\t{\n\t\tif (!is_array($array_to_check)) {\n\t\t\treturn array();\n\t\t}\n\t\tforeach ($array_to_check as $p => $var) {\n\t\t\tif (!is_numeric($var)) {\n\t\t\t\tunset($array_to_check[$p]);\n\t\t\t}\n\t\t}\n\t\treturn $array_to_check;\n\t}", "function plusMinus($arr) \n{ \n array_walk($arr, 'intval');\n $count = count($arr);\n $positive = 0;\n $negative = 0;\n $zero = 0;\n\n for($i = 0; $i < $count; $i++){\n if($arr[$i] > 0){\n $positive += 1;\n }elseif($arr[$i] < 0){\n $negative += 1;\n }\n else{\n $zero += 1;\n }\n }\n $result = [];\n $positive = round($positive/$count, 6);\n $negative = round($negative/$count, 6);\n $zero = round($zero/$count, 6);\n\n print($positive.\"\\n\");\n print($negative.\"\\n\");\n print($zero);\n}", "function array_clean(array $array, $callback = null, $flag = 0)\n {\n $keys = array_keys($array);\n $hasOnlyNumericKeys = $keys === array_filter($keys, 'is_numeric');\n $array = is_callable($callback) ? array_filter($array, $callback, $flag) : array_filter($array);\n $array = array_unique($array);\n\n //Performs `array_values()` only if all array keys are numeric\n return $hasOnlyNumericKeys ? array_values($array) : $array;\n }", "private function isNumericArray(array $array)\n {\n return is_array($array) && (array_keys($array) === range(0, count($array) - 1));\n }", "function hapus_array_kosong($array, $remove_null_number = true) {\n\t\t$new_array = array();\n\t\t$null_exceptions = array();\n\t\tforeach ($array as $key=>$value) {\n\t\t\t$value = trim($value);\n\t\t \tif($remove_null_number) {\n\t\t \t\t$null_exceptions[] = '0';\n\t\t \t}\n\t\t \tif(!in_array($value, $null_exceptions) && $value != \"\") {\n\t\t \t\t$new_array[] = $value;\n\t\t \t}\n\t\t}\n\t\treturn $new_array;\n\t}", "public function isPositive();", "function is_numeric_array($array)\n {\n foreach ($array as $element) {\n if (!is_numeric($element)) {\n return false;\n }\n }\n\n return true;\n }", "protected function _numeric ($array = array()) {\n\t\tif (empty($array)) {\n\t\t\treturn null;\n\t\t}\n\t\t$keys = array_keys($array);\n\t\tforeach ($keys as $key) {\n\t\t\tif (!is_numeric($key)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "static function ditchFirstNumericLevel($Array){\n \n foreach($Array as $useless_key=>$Values)\n foreach($Values as $key=>$SubValues)\n $NewArray[]=$SubValues;\n\n return $NewArray;\n }", "function min_not_null(array $values) {\r\n\treturn min(array_diff(array_map('intval', $values), array(0)));\r\n}", "function isNumeric($array)\n {\n $keys = array_keys($array);\n foreach ($keys as $key) {\n if (!is_numeric($key)) {\n return false;\n }\n }\n return true;\n }", "function clean_numberarray($numberarray)\n{\n $numarray = explode(' ', $numberarray);\n foreach($numarray as $num)\n {\n $numericarray[] = clean_number($num);\n }\n \n return implode(\" \", $numericarray);\n}", "function print_array_pre(&$array)\n{\n $rows = count($array);\n $columns = count($array[0]);\n\n for ($i = 0; $i < $rows; $i++)\n {\n for ($j = 0; $j < $columns; $j++)\n {\n if (is_null($array[$i][$j]))\n {\n echo \" \" . \"NaN\" . \"\\t\";\n }\n else\n {\n echo ($array[$i][$j] >= 0 ? \" \" : \"\") . round($array[$i][$j], 2) . \"\\t\";\n }\n }\n echo \"\\n\";\n }\n}", "function thmplt_convert_numeric($arr){\n\t$nummeric = array();\n\t\n\tif (!empty($arr) && !is_array( $arr ) ){ \n\t\t$arr = array($arr);\n\t}\n\t\n\tif ( is_array($arr) ){ \n\t\tforeach ($arr as $n) {\n\t\t\tif (is_numeric($n)) {\n\t\t\t\t$nummeric[] = (int)$n;\n\t\t\t} else {\n\t\t\t\t$nummeric[] = $n;\n\t\t\t}\n\t\t}\n\t\treturn $nummeric;\t\t\n\t}\n\treturn \"-\";\n}", "function filter_list(l) {\n\n let result = []\n\n for (let i = 0; i<l.length; i++){\n if (typeof l[i] == \"number\"){\n result.push(l[i])\n\n }\n\n }", "function positive($value, $key) {\n\t\treturn $value[$key] >= 0;\n\t}", "private static function isNumericArray($arr){\n foreach ( $arr as $key => $value ) {\n if ( !is_numeric( $key ) ) {\n return false;\n }\n }\n return true;\n }", "public function checkAllValues($tempArray)\n {\n \n $checkFlag = 0;\n foreach($tempArray as $value){\n\n // check whether the value is numeric\n if(is_numeric($value)){\n // check whether the value is positive number\n if($value < 0){\n $checkFlag = 1;\n break;\n }\n } else {\n $checkFlag = 1;\n break;\n }\n }\n return $checkFlag;\n }", "public static function clean($array) {\n // Remove empty elements\n $array = array_values(array_filter($array));\n\n return $array;\n }", "public function providerNumeric()\n\t{\n\t\treturn array(\n\t\t\tarray('12345', TRUE),\n\t\t array('10.5', TRUE),\n\t\t array('-10.5', TRUE),\n\t\t array('10.5a', FALSE)\n\t\t);\n\t}", "public static function isNegative(array $array)\n {\n if (max($array) < 0) {\n return true;\n }\n return false;\n }", "function numeric($value)\r\n{\r\n return !empty($value) && ctype_digit(str_replace(array('-', '(', ')', ' '), '', $value));\r\n}" ]
[ "0.68236405", "0.60102797", "0.6001871", "0.5968099", "0.59225535", "0.5922377", "0.5882062", "0.57960856", "0.5752694", "0.57167447", "0.57099986", "0.56960523", "0.5694313", "0.5683892", "0.5632875", "0.5603699", "0.55998045", "0.5559207", "0.55403095", "0.54218453", "0.54084986", "0.54038", "0.539109", "0.5358545", "0.53455764", "0.53430146", "0.5240408", "0.5228908", "0.5205382", "0.5198853" ]
0.74977916
0
Get only Negative numeric values from an array
public static function negative($array) { $callback = function ($v) { return (is_numeric($v) && $v < 0) + 0; }; return self::filter($array, $callback); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function positive($array)\n {\n $callback = function ($v) {\n return (is_numeric($v) && $v > 0) + 0;\n };\n return self::filter($array, $callback);\n }", "public static function isNegative(array $array)\n {\n if (max($array) < 0) {\n return true;\n }\n return false;\n }", "public function isNegative();", "function plusMinus($arr) \n{ \n array_walk($arr, 'intval');\n $count = count($arr);\n $positive = 0;\n $negative = 0;\n $zero = 0;\n\n for($i = 0; $i < $count; $i++){\n if($arr[$i] > 0){\n $positive += 1;\n }elseif($arr[$i] < 0){\n $negative += 1;\n }\n else{\n $zero += 1;\n }\n }\n $result = [];\n $positive = round($positive/$count, 6);\n $negative = round($negative/$count, 6);\n $zero = round($zero/$count, 6);\n\n print($positive.\"\\n\");\n print($negative.\"\\n\");\n print($zero);\n}", "function array_clean(array $array, $callback = null, $flag = 0)\n {\n $keys = array_keys($array);\n $hasOnlyNumericKeys = $keys === array_filter($keys, 'is_numeric');\n $array = is_callable($callback) ? array_filter($array, $callback, $flag) : array_filter($array);\n $array = array_unique($array);\n\n //Performs `array_values()` only if all array keys are numeric\n return $hasOnlyNumericKeys ? array_values($array) : $array;\n }", "function positive_sum($arr) {\n $sum = 0;\n foreach($arr as $x) {\n if ($x > 0) {\n $sum += $x;\n }\n }\n return $sum;\n }", "function CleanUpArrayOfInt($array)\n{\n $result = array();\n if (isNullOrEmptyArray($array)) {\n return $result;\n }\n reset($array);\n foreach ($array as $key => $value) {\n if (isInteger($value)) {\n $result[] = $value;\n }\n }\n reset($array);\n\n return $result;\n}", "function negative ($number)\n{\n return $number < 0?TRUE:FALSE;\n}", "function positiveVibrationalFequencies($array) {\n if(!empty($array)) {\n $error = 0;\n foreach($array as $line) {\n $num = floatval(substr($line, 0, -7));\n if($num < 0) {\n $error = 1;\n }\n }\n if($error == 0) {\n return TRUE;\n } else {\n return FALSE;\n }\n } else {\n return null;\n }\n}", "public function getNegativeIntValue() {}", "function hapus_array_kosong($array, $remove_null_number = true) {\n\t\t$new_array = array();\n\t\t$null_exceptions = array();\n\t\tforeach ($array as $key=>$value) {\n\t\t\t$value = trim($value);\n\t\t \tif($remove_null_number) {\n\t\t \t\t$null_exceptions[] = '0';\n\t\t \t}\n\t\t \tif(!in_array($value, $null_exceptions) && $value != \"\") {\n\t\t \t\t$new_array[] = $value;\n\t\t \t}\n\t\t}\n\t\treturn $new_array;\n\t}", "public static function negatePoint($point) { \r\n return array('x' => $point['x'], 'y' => bcsub(0, $point['y'])); \r\n }", "function array_values (array $input) {}", "function neg($n){\n if(!is_numeric($n)){\n //we could throw an error but meh\n return $n;\n }\n return -abs($n);\n}", "function CheckIntVars($array_to_check=array())\n\t{\n\t\tif (!is_array($array_to_check)) {\n\t\t\treturn array();\n\t\t}\n\t\tforeach ($array_to_check as $p => $var) {\n\t\t\tif (!is_numeric($var)) {\n\t\t\t\tunset($array_to_check[$p]);\n\t\t\t}\n\t\t}\n\t\treturn $array_to_check;\n\t}", "static function ditchFirstNumericLevel($Array){\n \n foreach($Array as $useless_key=>$Values)\n foreach($Values as $key=>$SubValues)\n $NewArray[]=$SubValues;\n\n return $NewArray;\n }", "private function isNumericArray(array $array)\n {\n return is_array($array) && (array_keys($array) === range(0, count($array) - 1));\n }", "function thmplt_convert_numeric($arr){\n\t$nummeric = array();\n\t\n\tif (!empty($arr) && !is_array( $arr ) ){ \n\t\t$arr = array($arr);\n\t}\n\t\n\tif ( is_array($arr) ){ \n\t\tforeach ($arr as $n) {\n\t\t\tif (is_numeric($n)) {\n\t\t\t\t$nummeric[] = (int)$n;\n\t\t\t} else {\n\t\t\t\t$nummeric[] = $n;\n\t\t\t}\n\t\t}\n\t\treturn $nummeric;\t\t\n\t}\n\treturn \"-\";\n}", "public static function subtract(array $array, array $otherArray): array\n {\n return array_values(array_diff($array, array_intersect($array, $otherArray)));\n }", "function bbp_number_not_negative($number = 0)\n{\n}", "function negate ($number)\n{\n return -1 * $number;\n}", "public static function negatePoint($point) { \r\n return array('x' => $point['x'], 'y' => gmp_neg($point['y'])); \r\n }", "public function invalidCounterValues() {\n return [\n ['a'], [-1]\n ];\n }", "function array_is_numeric($array){\r\n\t\t$results = array();\r\n\t\tif(is_array($array)){\r\n\t\t\tforeach($array as $key => $item){\r\n\t\t\t\t$results[] = (is_numeric($item)&&is_numeric($key));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn ( !in_array(false, $results) && count($results) > 0 );\r\n\t}", "public function getUnwantedValues()\n {\n return $this->unwanted_values;\n }", "public static function clean($array) {\n // Remove empty elements\n $array = array_values(array_filter($array));\n\n return $array;\n }", "function array_without(array $array, $values) : array\n {\n return array_values(array_diff($array, array_wrap($values)));\n }", "public static function nonEmpty(array $array)\n {\n return array_values(self::filter($array, 'strlen'));\n }", "function filter_list(l) {\n\n let result = []\n\n for (let i = 0; i<l.length; i++){\n if (typeof l[i] == \"number\"){\n result.push(l[i])\n\n }\n\n }", "protected function _numeric ($array = array()) {\n $isNumeric = true;\n \n \tif (empty($array)) {\n \t\treturn null;\n \t}\n \t$keys = array_keys($array);\n\tforeach ($keys as $key) {\n\t if (!is_numeric($key)) {\n\t \treturn !$isNumeric;\n\t }\n\t}\n\treturn $isNumeric;\n }" ]
[ "0.7157094", "0.629551", "0.5963323", "0.5899327", "0.5756935", "0.57526493", "0.5722219", "0.5659935", "0.56011623", "0.5593056", "0.5577996", "0.5536792", "0.5500053", "0.5498559", "0.548622", "0.54831487", "0.5453364", "0.54287255", "0.53791654", "0.5368633", "0.5345095", "0.53042865", "0.5285736", "0.5281328", "0.5261918", "0.5217471", "0.52151895", "0.5169438", "0.5146385", "0.51463085" ]
0.8077168
0
Checks if all the array values are integer
public static function isInt(array $array) { return $array === self::filter($array, 'is_int'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function is_array_of_ints( $array )\n\t{\n\t\tif ( ! is_array( $array ) || count( $array ) < 1 ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t$all_int = true;\n\n\t\tforeach ( $array as $el ) {\n\t\t\tif ( ! is_numeric( $el ) ) {\n\t\t\t\t$all_int = false;\n\t\t\t}\n\t\t}\n\n\t\treturn $all_int;\n\t}", "protected function checkAllIntegers()\n {\n $foundNonInt = false;\n\n $args = func_get_args();\n\n foreach ($args as $arg) {\n if (!is_int($arg)) {\n $foundNonInt = true;\n break;\n }\n }\n\n return !$foundNonInt;\n }", "function array_is_numeric($array){\r\n\t\t$results = array();\r\n\t\tif(is_array($array)){\r\n\t\t\tforeach($array as $key => $item){\r\n\t\t\t\t$results[] = (is_numeric($item)&&is_numeric($key));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn ( !in_array(false, $results) && count($results) > 0 );\r\n\t}", "public function checkValable(){\n\n $arrayInt = $this->getBytesInt();\n\n for($i=1;$i<4;$i++) {\n\n if($arrayInt[$i]>255 || $arrayInt[$i]<0)\n return false;\n }\n\n return true;\n\n }", "public static function all(){\n $are_all = true;\n $values = func_get_args();\n\n foreach($values as $value){\n if(!is_integer($value)){\n $are_all = false;\n break;\n }\n }\n\n return $are_all;\n }", "function isInteger($input){\n\tif (is_array($input)) {\n\t\treturn false;\n\t}\n return(ctype_digit(strval($input)));\n}", "public static function any(){\n $are_any = false;\n $values = func_get_args();\n\n foreach($values as $value){\n if(is_integer($value)){\n $are_any = true;\n break;\n }\n }\n\n return $are_any;\n }", "function is_numeric_array($array)\n {\n foreach ($array as $element) {\n if (!is_numeric($element)) {\n return false;\n }\n }\n\n return true;\n }", "function CheckIntVars($array_to_check=array())\n\t{\n\t\tif (!is_array($array_to_check)) {\n\t\t\treturn array();\n\t\t}\n\t\tforeach ($array_to_check as $p => $var) {\n\t\t\tif (!is_numeric($var)) {\n\t\t\t\tunset($array_to_check[$p]);\n\t\t\t}\n\t\t}\n\t\treturn $array_to_check;\n\t}", "function CheckIntVars($array_to_check=array())\n\t{\n\t\tif ($this->ids_checked) {\n\t\t\treturn $array_to_check;\n\t\t}\n\n\t\tif (!is_array($array_to_check)) {\n\t\t\treturn array();\n\t\t}\n\t\tforeach ($array_to_check as $p => $var) {\n\t\t\tif (!is_numeric($var)) {\n\t\t\t\tunset($array_to_check[$p]);\n\t\t\t}\n\t\t}\n\t\t$this->ids_checked = true;\n\t\treturn $array_to_check;\n\t}", "protected function array_values_are_numeric($array) {\n foreach ($array as $value) {\n if (!is_numeric($value))\n return false;\n }\n return true;\n }", "private static function isIntegerArray($arrayInteger)\n {\n if(is_array($arrayInteger)) {\n foreach($arrayInteger as $elementArray) {\n if (! isInt($elementArray))\n return false;\n }\n\n return true;\n }\n\n return false;\n }", "private static function isNumericArray($arr){\n foreach ( $arr as $key => $value ) {\n if ( !is_numeric( $key ) ) {\n return false;\n }\n }\n return true;\n }", "function CheckIntVars($array_to_check = array())\r\n {\r\n if ($this->ids_checked) {\r\n return $array_to_check;\r\n }\r\n\r\n if (!is_array($array_to_check)) {\r\n return array();\r\n }\r\n foreach ($array_to_check as $p => $var) {\r\n if (!is_numeric($var)) {\r\n unset($array_to_check[$p]);\r\n }\r\n }\r\n $this->ids_checked = true;\r\n return $array_to_check;\r\n }", "public static function isIntegerOrArrayInteger($attribute, $value, $parameters)\n {\n if(! isInt($value) && ! self::isIntegerArray($value) )\n return false;\n \n return true;\n }", "public function isInt()\n {\n return is_int($this->storedValue);\n }", "function isNumeric($array)\n {\n $keys = array_keys($array);\n foreach ($keys as $key) {\n if (!is_numeric($key)) {\n return false;\n }\n }\n return true;\n }", "public static function isNumericArray(array $data)\n {\n return count($data) > 0 && count(\n array_filter(array_keys($data), 'is_numeric')\n ) === count($data);\n }", "private function isNumericArray(array $array)\n {\n return is_array($array) && (array_keys($array) === range(0, count($array) - 1));\n }", "public function isInteger(): bool\n {\n return false;\n }", "public function checkAllValues($tempArray)\n {\n \n $checkFlag = 0;\n foreach($tempArray as $value){\n\n // check whether the value is numeric\n if(is_numeric($value)){\n // check whether the value is positive number\n if($value < 0){\n $checkFlag = 1;\n break;\n }\n } else {\n $checkFlag = 1;\n break;\n }\n }\n return $checkFlag;\n }", "function isint($x){ return (is_numeric($x) ? intval($x) == $x : false); }", "protected function _numeric ($array = array()) {\n\t\tif (empty($array)) {\n\t\t\treturn null;\n\t\t}\n\t\t$keys = array_keys($array);\n\t\tforeach ($keys as $key) {\n\t\t\tif (!is_numeric($key)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "public static function validIsInt($value){\n if($value === null){\n return true;\n }\n \n return parent::validIsInt($value);\n }", "protected function isIntegeric($value)\n\t{\n\t\treturn is_string($value) ? (preg_match('/^-?[0-9]*$/D', $value) === 1) : is_int($value);\n\t}", "protected function _numeric ($array = array()) {\n $isNumeric = true;\n \n \tif (empty($array)) {\n \t\treturn null;\n \t}\n \t$keys = array_keys($array);\n\tforeach ($keys as $key) {\n\t if (!is_numeric($key)) {\n\t \treturn !$isNumeric;\n\t }\n\t}\n\treturn $isNumeric;\n }", "public function isIntegral(): bool\n {\n $integralTypes = [\n self::Int64,\n self::Int32,\n self::Int16,\n self::Byte,\n self::SByte,\n ];\n return in_array($this->getValue(), $integralTypes);\n }", "function is_integer ($var) {}", "function CleanUpArrayOfInt($array)\n{\n $result = array();\n if (isNullOrEmptyArray($array)) {\n return $result;\n }\n reset($array);\n foreach ($array as $key => $value) {\n if (isInteger($value)) {\n $result[] = $value;\n }\n }\n reset($array);\n\n return $result;\n}", "function checkIfInt($arg){\n return is_numeric($arg) && is_int(+$arg);\n }" ]
[ "0.79417694", "0.7210851", "0.7124436", "0.7041374", "0.6875067", "0.68398994", "0.68250483", "0.6804713", "0.67686826", "0.6762098", "0.6747157", "0.66713816", "0.6638512", "0.66328895", "0.6567242", "0.65292394", "0.6506816", "0.6397922", "0.63876206", "0.6376573", "0.6362488", "0.6346905", "0.6275153", "0.62552863", "0.6146594", "0.6097935", "0.60844547", "0.60665965", "0.60658294", "0.60514736" ]
0.7575754
1
Checks if all the array values are positive value
public static function isPositive(array $array) { if (min($array) > 0) { return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function isNegative(array $array)\n {\n if (max($array) < 0) {\n return true;\n }\n return false;\n }", "public function checkAllValues($tempArray)\n {\n \n $checkFlag = 0;\n foreach($tempArray as $value){\n\n // check whether the value is numeric\n if(is_numeric($value)){\n // check whether the value is positive number\n if($value < 0){\n $checkFlag = 1;\n break;\n }\n } else {\n $checkFlag = 1;\n break;\n }\n }\n return $checkFlag;\n }", "public function isPositive();", "public static function positive($array)\n {\n $callback = function ($v) {\n return (is_numeric($v) && $v > 0) + 0;\n };\n return self::filter($array, $callback);\n }", "public function checkValable(){\n\n $arrayInt = $this->getBytesInt();\n\n for($i=1;$i<4;$i++) {\n\n if($arrayInt[$i]>255 || $arrayInt[$i]<0)\n return false;\n }\n\n return true;\n\n }", "function positive($value, $key) {\n\t\treturn $value[$key] >= 0;\n\t}", "function positive_sum($arr) {\n $sum = 0;\n foreach($arr as $x) {\n if ($x > 0) {\n $sum += $x;\n }\n }\n return $sum;\n }", "public function containsOnlyNullOrZero($input)\n {\n // If array is empty -> user didn't give valid values\n return empty(array_filter($input, function ($a) { \n if($a !== null && $a !== 0) {\n return $a;\n }\n }));\n }", "public static function all(){\n $are_all = true;\n $values = func_get_args();\n\n foreach($values as $value){\n if(!is_integer($value)){\n $are_all = false;\n break;\n }\n }\n\n return $are_all;\n }", "private static function arrayEmpty($arr)\n\t{\n\t\tforeach ($arr as $v) {\n\t\t\tif (!empty($v) || $v === \"0\" || $v === 0 || $v === false) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "public function isPositive(): bool\n {\n return bccomp($this->value, '0') === 1;\n }", "function positiveVibrationalFequencies($array) {\n if(!empty($array)) {\n $error = 0;\n foreach($array as $line) {\n $num = floatval(substr($line, 0, -7));\n if($num < 0) {\n $error = 1;\n }\n }\n if($error == 0) {\n return TRUE;\n } else {\n return FALSE;\n }\n } else {\n return null;\n }\n}", "public static function negative($array)\n {\n $callback = function ($v) {\n return (is_numeric($v) && $v < 0) + 0;\n };\n return self::filter($array, $callback);\n }", "public function isPositive(): bool\n {\n return $this->seconds > 0 || ($this->seconds === 0 && $this->micros !== 0);\n }", "function valid()\n {\n return !($c < 0 xor $this->evaluate() < 0);\n }", "public static function any(){\n $are_any = false;\n $values = func_get_args();\n\n foreach($values as $value){\n if(is_integer($value)){\n $are_any = true;\n break;\n }\n }\n\n return $are_any;\n }", "protected function array_values_are_numeric($array) {\n foreach ($array as $value) {\n if (!is_numeric($value))\n return false;\n }\n return true;\n }", "function checkNotNull($array) {\n foreach($array as $v) {\n if(!isset($v) || empty($v)) {\n return false;\n }\n }\n return true;\n}", "function array_is_numeric($array){\r\n\t\t$results = array();\r\n\t\tif(is_array($array)){\r\n\t\t\tforeach($array as $key => $item){\r\n\t\t\t\t$results[] = (is_numeric($item)&&is_numeric($key));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn ( !in_array(false, $results) && count($results) > 0 );\r\n\t}", "public function isNegative();", "private function isNumericArray(array $array)\n {\n return is_array($array) && (array_keys($array) === range(0, count($array) - 1));\n }", "public function isZero();", "public static function isPositive($val): bool\n {\n return ($val >0);\n }", "public function isNaN()\n {\n return $this->exponent == static::getMaxExponent() && $this->significand != 0;\n }", "public function isNegative(): bool\n {\n return bccomp($this->value, '0') === -1;\n }", "public function isPositive()\n {\n return $this->amount->isPositive();\n }", "function is_numeric_array($array)\n {\n foreach ($array as $element) {\n if (!is_numeric($element)) {\n return false;\n }\n }\n\n return true;\n }", "public function isZero() {\n\t\tfor( $row = 0; $row < $this->getRows(); ++$row ) {\n\t\t\tfor( $col = 0; $col < $this->getCols(); ++$col ) {\n\t\t\t\tif( $this->matrix[$row][$col] != 0 ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "function is_null_all(...$values): bool\n {\n return is_all('is_null', ...$values);\n }", "static function positive($number) {\n\n\t\treturn $number > 0;\n\n\t}" ]
[ "0.6856343", "0.6794276", "0.6792693", "0.67284083", "0.6697165", "0.6485639", "0.644782", "0.6381637", "0.6325168", "0.628583", "0.62253", "0.62074685", "0.60817873", "0.60074234", "0.597875", "0.5960654", "0.59127116", "0.59001774", "0.585357", "0.58329445", "0.5823458", "0.5805249", "0.58039635", "0.5803605", "0.57495767", "0.5727142", "0.57105315", "0.5680534", "0.565736", "0.5655175" ]
0.72498775
0
Checks if all the array values are negative
public static function isNegative(array $array) { if (max($array) < 0) { return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function isNegative();", "public static function negative($array)\n {\n $callback = function ($v) {\n return (is_numeric($v) && $v < 0) + 0;\n };\n return self::filter($array, $callback);\n }", "public function isNegative(): bool\n {\n return bccomp($this->value, '0') === -1;\n }", "public function checkValable(){\n\n $arrayInt = $this->getBytesInt();\n\n for($i=1;$i<4;$i++) {\n\n if($arrayInt[$i]>255 || $arrayInt[$i]<0)\n return false;\n }\n\n return true;\n\n }", "public static function isPositive(array $array)\n {\n if (min($array) > 0) {\n return true;\n }\n return false;\n }", "public function isPositive();", "public static function positive($array)\n {\n $callback = function ($v) {\n return (is_numeric($v) && $v > 0) + 0;\n };\n return self::filter($array, $callback);\n }", "public function checkAllValues($tempArray)\n {\n \n $checkFlag = 0;\n foreach($tempArray as $value){\n\n // check whether the value is numeric\n if(is_numeric($value)){\n // check whether the value is positive number\n if($value < 0){\n $checkFlag = 1;\n break;\n }\n } else {\n $checkFlag = 1;\n break;\n }\n }\n return $checkFlag;\n }", "public function isNegative()\n {\n return $this->amount->isNegative();\n }", "function positive($value, $key) {\n\t\treturn $value[$key] >= 0;\n\t}", "public function isNegativeOrZero(): bool\n {\n return $this->seconds < 0 || ($this->seconds === 0 && $this->micros === 0);\n }", "function positive_sum($arr) {\n $sum = 0;\n foreach($arr as $x) {\n if ($x > 0) {\n $sum += $x;\n }\n }\n return $sum;\n }", "public static function all(){\n $are_all = true;\n $values = func_get_args();\n\n foreach($values as $value){\n if(!is_integer($value)){\n $are_all = false;\n break;\n }\n }\n\n return $are_all;\n }", "function positiveVibrationalFequencies($array) {\n if(!empty($array)) {\n $error = 0;\n foreach($array as $line) {\n $num = floatval(substr($line, 0, -7));\n if($num < 0) {\n $error = 1;\n }\n }\n if($error == 0) {\n return TRUE;\n } else {\n return FALSE;\n }\n } else {\n return null;\n }\n}", "function negative ($number)\n{\n return $number < 0?TRUE:FALSE;\n}", "public function containsOnlyNullOrZero($input)\n {\n // If array is empty -> user didn't give valid values\n return empty(array_filter($input, function ($a) { \n if($a !== null && $a !== 0) {\n return $a;\n }\n }));\n }", "public function isNegative(): bool\n {\n return $this->seconds < 0;\n }", "function valid()\n {\n return !($c < 0 xor $this->evaluate() < 0);\n }", "private function isNumericArray(array $array)\n {\n return is_array($array) && (array_keys($array) === range(0, count($array) - 1));\n }", "public function testNeg()\n {\n self::assertEquals(\n 123,\n to_int(neg(from_int(-123, \\PHP_INT_SIZE)))\n );\n // 0\n self::assertEquals(\n 0,\n to_int(neg(from_int(0, \\PHP_INT_SIZE)))\n );\n // small size\n self::assertEquals(\n 255,\n to_int(neg(from_int(1, 1)))\n );\n }", "private static function arrayEmpty($arr)\n\t{\n\t\tforeach ($arr as $v) {\n\t\t\tif (!empty($v) || $v === \"0\" || $v === 0 || $v === false) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "function checkAltitude($arrAlt)\n{\n\tfor ($i = 0; $i < count($arrAlt); $i++) {\n if($arrAlt[$i] < 0 || $arrAlt[$i] > 100000) {\n return false;\n }\n }\n return true;\n}", "function is_false_all(...$values): bool\n {\n return is_all(\n function ($value) {\n return $value === false;\n },\n ...$values\n );\n }", "public function isNegated(): bool;", "public function testNonzero()\n\t{\n\t\t$passPos = Rules::validate(['score' => 1], ['score' => 'nonzero']);\n\t\t$passNeg = Rules::validate(['score' => -1], ['score' => 'nonzero']);\n\t\t$fail = Rules::validate(['score' => 0], ['score' => 'nonzero']);\n\n\t\t$this->assertTrue($passPos, 'Rule (nonzero) should have validated with a score of 1');\n\t\t$this->assertTrue($passNeg, 'Rule (nonzero) should have validated with a score of -1');\n\t\t$this->assertCount(1, $fail, 'Rule (nonzero) should have returned one error for a score of 0');\n\t}", "public function isPositive(): bool\n {\n return bccomp($this->value, '0') === 1;\n }", "public function isNaN()\n {\n return $this->exponent == static::getMaxExponent() && $this->significand != 0;\n }", "public function shouldBeUnsigned()\n {\n if (!$this->isNumeric()) {\n throw new Exception('This method should only be called on numeric columns');\n }\n\n return $this->minValue >= 0;\n }", "public function isPositive(): bool\n {\n return $this->seconds > 0 || ($this->seconds === 0 && $this->micros !== 0);\n }", "function array_is_numeric($array){\r\n\t\t$results = array();\r\n\t\tif(is_array($array)){\r\n\t\t\tforeach($array as $key => $item){\r\n\t\t\t\t$results[] = (is_numeric($item)&&is_numeric($key));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn ( !in_array(false, $results) && count($results) > 0 );\r\n\t}" ]
[ "0.69318956", "0.6660206", "0.65985286", "0.64943784", "0.6422815", "0.6217818", "0.61837214", "0.61770016", "0.6082111", "0.6040688", "0.6037605", "0.59924746", "0.58556277", "0.58375096", "0.58368117", "0.57967156", "0.57848555", "0.57158285", "0.56927335", "0.56541944", "0.5624015", "0.55985767", "0.55916077", "0.5572223", "0.5532769", "0.55227596", "0.5504089", "0.549534", "0.54936", "0.548742" ]
0.76159847
0
Determine if the given value is callable, but not a string.
private static function useAsCallable($value) { return !is_string($value) && is_callable($value); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function useAsCallable($value)\n {\n return ! is_string($value) && is_callable($value);\n }", "final public static function is($value):bool\n {\n return is_callable($value);\n }", "function is_callable (callable $name, $syntax_only = false, &$callable_name = null) {}", "public function isCallable()\n\t{\n\t\treturn $this->typeHint === self::CALLABLE_TYPE_HINT;\n\t}", "public function isCallable()\n\t{\n\t\treturn is_callable($this->cb);\n\t}", "public function isCallable(): bool\n\t{\n\t\treturn is_callable($this->definition);\n\t}", "public static function callable()\n {\n return Hamcrest_Type_IsCallable::callable();\n }", "function proveCallableString(mixed $subject): Option\n{\n return proveString($subject)->filter(fn($string) => is_callable($string));\n}", "public function isCallable()\n\t{\n\t\treturn is_callable($this->callback);\n\t}", "final public static function isFunction($value):bool\n {\n return is_string($value) && function_exists($value);\n }", "function wponion_is_callable( $callback ) {\n\t\tif ( is_callable( $callback ) ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( is_string( $callback ) && has_action( $callback ) ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( is_string( $callback ) && has_filter( $callback ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "function is($callable, array $data) {\n return filter($callable, $data);\n}", "function proveCallableString(string $subject): Option\n{\n return Option::fromNullable(is_callable($subject) ? $subject : null);\n}", "public function testAssertIsCallable() {\n\t\t$this->assertIsCallable( 'strpos' );\n\t}", "function value($value)\n{\n\treturn (is_callable($value) and ! is_string($value)) ? call_user_func($value) : $value;\n}", "public static function isCallable($val, $opts = 0)\n {\n if (\\is_object($val)) {\n // test if Closure or obj with __invoke\n return \\is_callable($val, false);\n }\n if (\\is_array($val)) {\n return self::isCallableArray($val, $opts);\n }\n if ($opts & self::IS_CALLABLE_ARRAY_ONLY) {\n return false;\n }\n $syntaxOnly = \\is_string($val) && \\preg_match('/(::|\\\\\\)/', $val) !== 1\n ? false // string without namespace: do a full check\n : ($opts & self::IS_CALLABLE_SYNTAX_ONLY) === self::IS_CALLABLE_SYNTAX_ONLY;\n return \\is_callable($val, $syntaxOnly);\n }", "final public static function isClosure($value):bool\n {\n return $value instanceof \\Closure;\n }", "protected function callback( &$_callback, &$_name, &$_value ) {\n\t\tif ( isset( $_callback ) && is_callable( $_callback ) ) {\n\t\t\tif ( !call_user_func( $_callback, $_name, $_value, $this ) ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}", "public function noneMatch(callable $callable) : bool\n {\n return !$this->anyMatch($callable);\n }", "public function isDefiniteNonCallableType(CodeBase $code_base): bool\n {\n return true;\n }", "function is($str);", "private function assertIsCallable($callable)\n {\n if (!is_callable($callable))\n {\n throw new InvalidArgumentException('The given Argument must be a callable.');\n }\n }", "function test_ignoring_is_type_function_calls() {\n\tif ( isset( $_POST[ $key ] ) && is_numeric( $_POST[ $key ] ) ) {} // OK.\n\tif ( isset($_POST['plugin']) && is_string( $_POST['plugin'] ) ) {} // OK.\n\n\tif ( ! is_null( $_GET['not_set'] ) ) {} // Bad x1 - missing validation.\n\tif ( array_key_exists( 'null', $_GET ) && ! is_null( $_GET['null'] ) ) {} // OK.\n\tif ( array_key_exists( 'null', $_POST ) && $_POST['null'] !== null ) {} // OK.\n}", "private function isValueOf($value, string $type) : bool\n {\n if (! $this->isBuiltinType($type)) {\n return ($value instanceof $type);\n }\n\n if ($type == 'callable') {\n return is_callable($value);\n }\n\n if ($type == 'iterable') {\n return (is_array($value) || ($value instanceof Traversable));\n }\n\n $valueType = $this->getTypeNameFromValue($value);\n $numerics = ['int', 'float'];\n\n // PHP accepts float for int and vice versa, as well as numeric string values\n if (in_array($type, $numerics)) {\n return in_array($valueType, $numerics) || (is_string($value) && is_numeric($value));\n }\n\n return ($type == $valueType);\n }", "public function testAssertIsNotCallable() {\n\t\tself::assertIsNotCallable( null );\n\t}", "function validate($value)\n {\n if (!isset($this->_callback)) throw new Validator_Exception('No callback function');\n\n $args = func_get_args();\n $args = array_merge($this->args, $args);\n \t$result = call_user_func_array($callback, $args);\n\n return isset($result) ? $this->negate xor $result : null;\n }", "public function isCallable()\n {\n \tif(!empty($this->isCallable)) return $this->isCallable;\n \t\n \tif(!class_exists(str_replace(\" \", \"_\", $this->module), true)) return $this->isCallable=false;\n \t\n \t$refl = new ReflectionClass($this->module);\n \tif(!$refl->hasMethod(str_replace(\" \", \"_\", $this->name))) return $this->isCallable=false;\n \t\n \t$m = $refl->getMethod(str_replace(\" \", \"_\", $this->name));\n \tif(!$m->isPublic() || !$m->isStatic()) return $this->isCallable=false;\n \t\n \t$n = $m->getNumberOfParameters();\n \tif($n!=1 && $n!=3) return $this->isCallable=false;\n \t\n \tif(!strpos($m->getDocComment(), \"* @mr:remote\\n\")) return $this->isCallable=false;\n \t\n \t$params = $m->getParameters();\n \t\n \t/* @var $p ReflectionParameter */\n \t\n \t$p = $params[0];\n \tif(!$p->isArray()) return $this->isCallable=false;\n \t\n \t$this->isCallable = true;\n \t$this->methodReflection = $m;\n \t\n \treturn true;\n }", "private static function isCallableArrayString(array $val, $opts)\n {\n if ($opts & self::IS_CALLABLE_SYNTAX_ONLY) {\n // is_callable syntaxOnly only tested if 1st val is obj or string\n // we'll test that string is a valid label\n $regexClass = '/^(\\\\\\\\?[a-zA-Z_\\x80-\\xff][a-zA-Z0-9_\\x80-\\xff]*)+$/';\n return \\preg_match($regexClass, $val[0]) === 1;\n }\n if (\\class_exists($val[0], false) === false) {\n // test if class exists before calling method_exists to avoid autoload attempt\n return false;\n }\n if (\\method_exists($val[0], $val[1])) {\n return true;\n }\n return $opts & self::IS_CALLABLE_NO_CALL\n ? false\n : \\method_exists($val[0], '__callStatic');\n }", "protected function possibleBool() {\n\t\treturn function( &$_value ) {\n\t\t\treturn empty( $_value ) || is_scalar( $_value );\n\t\t};\n\t}", "public function none(callable $callable);" ]
[ "0.7440649", "0.6865545", "0.6565962", "0.6402422", "0.6325277", "0.6310134", "0.6278026", "0.62659913", "0.6245939", "0.6194569", "0.61071914", "0.5985003", "0.5957831", "0.59155214", "0.5887974", "0.5868599", "0.583106", "0.5645203", "0.5630458", "0.5615213", "0.55274034", "0.55121225", "0.5508579", "0.5495417", "0.549164", "0.5461534", "0.54190487", "0.53773737", "0.53579473", "0.532361" ]
0.7677341
0
scope last_active untuk mengambil riwayat login yang belum kadaluarsa
public function scopeLastActive($query) { return $query->where("expired_at", ">=", DB::raw("NOW()"))->orderBy("expired_at", "DESC"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function __commonAdmin_RegisterLastActive()\n {\n\n //update team member as last active now()\n $this->teamprofile_model->registerLastActive($this->session->userdata('team_profile_id'));\n\n }", "function __commonClient_registerLastActive()\n {\n $this->users_model->registerLastActive($this->session->userdata('client_users_clients_id'));\n\n }", "public function updateLastActive() {\n\t\t$this -> setData(\"lastActive\", date(\"Y-m-d H:i:s\"));\n\t}", "function update_group_last_active() {\n\t\tglobal $bp;\n\n\t\tgroups_update_groupmeta( $bp->groups->current_group->id, 'last_activity', bp_core_current_time() );\n\t}", "public function lastLogin();", "public function scopeActive($query)\n {\n \treturn $query->where(\"expired_at\", \">=\", DB::raw(\"NOW()\"));\n }", "public function updateLastActive()\n\t{\n\t\t$this->lastActive = date('Y-m-d H:i:s');\n\t\t$this->save();\n\t}", "public function getLastActive()\n {\n return $this->lastActive;\n }", "public function getLastLogin();", "public function scopeActive($query)\n {\n return $query->where('status', config('constants.user.status.active'));\n }", "public function scopeActive($query)\n {\n $query = $query->notComplete();\n\n if (is_null(auth()->user()) or \\PanicHDMember::find(auth()->user()->id)->currentLevel() < 2) {\n return $query;\n } else {\n return $query->where('status_id', '!=', Setting::grab('default_status_id'));\n }\n }", "public function lastLogin($carbon=false){\n $fecha=Useraudit::lastLogin($this->id); \n if($carbon){\n return Carbon::createFromFormat(\\common\\helpers\\timeHelper::formatMysqlDateTime(), $fecha);\n }else{\n return $fecha;\n }\n \n }", "function update_last_activity() {\n\t\t$update = new ElUser;\n\t\t$update->update_last_activity();\n}", "public function getLastActive()\n {\n return $this->segment->get('last_active');\n }", "function bbp_forum_last_active_time($forum_id = 0)\n{\n}", "function bbp_forum_last_active_id($forum_id = 0)\n{\n}", "function bbp_update_forum_last_active_id($forum_id = 0, $active_id = 0)\n{\n}", "public function logout_user(){\n\t\t//utilisation de la fonction du model qui met la colonne is_active de la table à false\n\t\t\n\t}", "public function check_login_active($data)\n {\n $this->db->order_by('i_login', 'desc');\n $this->db->limit(1);\n $this->db->select('*')->from('tacm.t_d_login')->where($data);\n $user = $this->db->get();\n \n return $user;\n }", "public function activeAction()\n\t{\n\t\t$this->session->remove('form-save');\n\t\t\n\t\t$all = $this->users->query()\n\t\t->where('active IS NOT NULL')\n\t\t->andWhere('deleted is NULL')\n\t\t->execute();\n\t\n\t\t$this->theme->setTitle(\"Aktiva användare\");\n\t\t$this->views->add('users/list-all', [\n\t\t\t\t'users' => $all,\n\t\t\t\t'title' => \"Aktiva användare\",\n\t\t]);\n\t}", "public function checkOnline() {\n\n $con = connectToDb::getInstance();\n // $con = new connecttodb();\n //$openCon = $con->connect();\n //$sessionid = $_SESSION['sessionid'];\n $time = time() - 600; //if remain inactive for 10 Minute \n\n $usersOnlineQuery = $con->prepare(\"SELECT `id`,`username`,`email` FROM `users` WHERE `lastactive`> ? ORDER BY `username` ASC\");\n $usersOnlineQuery->bindValue(1, $time);\n try {\n $usersOnlineQuery->execute();\n $result = $usersOnlineQuery->fetchAll();\n return $result;\n } catch (Exception $e) {\n die($e->getMessage());\n }\n }", "public static function scopeActive($query)\n {\n \treturn $query->whereStatus('Active');\n }", "function afterFilter() {\n if ($this->Auth->user()) {\n $this->loadModel('User');\n $this->User->id = $this->Auth->user('id');\n $this->User->saveField('last_access', date('Y-m-d H:i:s'));\n }\n }", "function afterFilter() {\n if ($this->Auth->user()) {\n $this->loadModel('User');\n $this->User->id = $this->Auth->user('id');\n $this->User->saveField('last_access', date('Y-m-d H:i:s'));\n }\n }", "function active_user(){\n\t\t\t\n\t\t\t\t$token = $_POST['token'];\n\t\t\t\tprint_r($token);\n\t\t\t\tloadModel(MODEL_HOME, \"home_model\", \"active_user\",$token);\n\t\t\t\t\n\t\t\t\n\t\t}", "function get_active_users( $limit = \"\" )\n\t{\n\t\t$limit = $limit != \"\" ? \" LIMIT 0, \".$limit : \"\";\n\t\t$q = \"SELECT * FROM users WHERE user_status = 1 ORDER BY addeddate DESC\".$limit;\n\t\t$r = $this -> db -> getMultipleRecords( $q );\n\t\tif( $r != false )\n\t\t\treturn $r;\n\t\telse\n\t\t\treturn false;\n\t}", "function inactive_profile($table,$where){\n $get = $this->db->select('*')->where('userId',$where)->get($table);\n if($get->num_rows()){\n $result = $get->row();\n /*$password = $result->password;\n if(password_verify($data,$password)){*/\n $res = $this->common_model->updateFields(USERS,array('isActive'=>0),array('userId'=>$where));\n if($res == true){\n return $response = array('type' => \"SU\");\n }\n return $response = array('type' => \"ADU\");\n }\n /*return $response = array('type' => \"WP\");\n }*/\n return $response = array('type' => \"UNF\");\n }", "public function first_time_log_in(){\n\t\t\t\n\t\t\t$email = $this->session->userdata('email');\n\t\t\t\n\t\t\t$user = $this->get_user($email);\n\t\t\t$last_login = '';\n\t\t\t\n\t\t\tforeach($user as $u){\t\n\t\t\t\t$last_login = $u->last_login;\n\t\t\t}\n\t\t\tif ($last_login === '0000-00-00 00:00:00'){\t\t\n\t\t\t\treturn TRUE;\t\t\n\t\t\t}else {\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t}", "function login_activity()\n {\n return LoginActivity::whereUserId(auth()->user()->id)->latest()->first();\n }", "function get_last_status() {\n return $this->last_status;\n }" ]
[ "0.6658249", "0.65106744", "0.6076731", "0.59794223", "0.59367406", "0.5874487", "0.5866638", "0.57885665", "0.5768038", "0.5618103", "0.5603395", "0.55967206", "0.5588343", "0.5568623", "0.55669254", "0.5541825", "0.55365205", "0.55337006", "0.55027163", "0.5497719", "0.54851395", "0.5406493", "0.5369733", "0.5369733", "0.536701", "0.5355181", "0.534857", "0.5342391", "0.5318849", "0.531855" ]
0.6975684
0
replace all spaces with hyphin
private function replacespacewithhyphin($input) { $str = preg_replace("/\s/", "-", $input); $str = preg_replace("/[\-]+/", "-", $str); // remove special characters return strtolower(preg_replace("/[^0-9a-zA-Z-_]+/", "", $str)); //return preg_replace("/[^\w\._]+/","",$str); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function sanitize_hyp($str){\n\t\t$ireplace_value=\"_\";\n\t\t$search_value=\"-\";\n\t\t$value=str_replace($search_value,$ireplace_value,$str);\n\t\treturn $value;\n\t}", "function spaceout($string){\n\n $string = str_replace(\n array(' '),\n array('_'),\n $string\n );\n return $string;\n }", "function update_punctuation(&$word) {\n\t$word = strtr($word, '/\\|+-!?;.:,()[]{}*', ' ');\n\t//$word = str_replace(' ', '', $word);\n\treturn(True);\n}", "function underscorespaces($text)\n{\n return str_replace(array(' ', '$', '(', ')'), '_', $text);\n}", "function spacein($string){\n\n $string = str_replace(\n array('_'),\n array(' '),\n $string\n );\n return $string;\n }", "function makeslug($text) {\n\t/**\n\t * taken from https://stackoverflow.com/questions/11330480/strip-php-variable-replace-white-spaces-with-dashes\n\t */\n\n\t// make all letters lowercase\n\t$text\t\t= strtolower($text);\n\n\t// make it alphanumeric and turn other characters into hyphens\n\t$text = preg_replace(\"/[^a-z0-9_\\s-]/\", \"\", $text);\n\n\t// clean up multiple hyphens and whitespaces\n\t$text = preg_replace(\"/[\\s-]+/\", \" \", $text);\n\n\t// convert whitespaces and underscores to hyphens\n\t$text = preg_replace(\"/[\\s_]/\", \"-\", $text);\n\n\treturn $text;\n}", "function clear_sym($text)\n {\n $text = preg_replace('~[^\\\\pL\\d]+~u', ' ', $text);\n\n // trim\n $text = trim($text, '-');\n\n // transliterate\n //$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);\n\n // lowercase\n $text = strtolower($text);\n\n // remove unwanted characters\n $text = preg_replace('~[^-\\w]+~', ' ', $text);\n\n if (empty($text)) {\n return 'n-a';\n }\n\n return $text;\n }", "function no_space($val){\n\t\t\t$int = array(\" \");\n\t\t\t$deb = array(\"\");\n\t\t\t$val = str_replace($int,$deb,$val);\n\t\t\treturn $val;\n\t\t}", "function sanitize($string, $spaces = TRUE) {\n $search = array(\n '/[^\\w\\-\\. ]+/u', // Remove non safe characters\n '/\\s\\s+/', // Remove extra whitespace\n '/\\.\\.+/', '/--+/', '/__+/' // Remove duplicate symbols\n );\n\n $string = preg_replace($search, array(' ', ' ', '.', '-', '_'), $string);\n\n if (!$spaces) {\n $string = preg_replace('/--+/', '-', str_replace(' ', '-', $string));\n }\n\n return trim($string, '-._ ');\n}", "function removeStrtr($value){\n\t\t$value = strtr($value,[\"-\"=>\" \"]);\n\t\treturn $value;\n\t}", "function hyphenize ($str) {\r\n\t$result = trim($str);\r\n\t$result = strtolower($result);\r\n\t\r\n\t/* Reserved characters\r\n\t\tDollar (\"$\")\r\n\t\tAmpersand (\"&\")\r\n\t\tPlus (\"+\")\r\n\t\tComma (\",\")\r\n\t\tForward slash/Virgule (\"/\")\r\n\t\tColon (\":\")\r\n\t\tSemi-colon (\";\")\r\n\t\tEquals (\"=\")\r\n\t\tQuestion mark (\"?\")\r\n\t\t'At' symbol (\"@\")\r\n\t*/\r\n\t$result = str_replace(\"$\",\"\", $result);\r\n\t$result = str_replace(\"&\",\"\", $result);\r\n\t$result = str_replace(\"+\",\"\", $result);\r\n\t$result = str_replace(\",\",\"\", $result);\r\n\t$result = str_replace(\"/\",\"\", $result);\r\n\t$result = str_replace(\":\",\"\", $result);\r\n\t$result = str_replace(\";\",\"\", $result);\r\n\t$result = str_replace(\"=\",\"\", $result);\r\n\t$result = str_replace(\"?\",\"\", $result);\r\n\t$result = str_replace(\"@\",\"\", $result);\r\n\t\r\n\t/* Unsafe characters\r\n\t\tSpace\r\n\t\tQuotation marks\r\n\t\t'Less Than' symbol (\"<\")\r\n\t\t'Greater Than' symbol (\">\")\r\n\t\t'Pound' character (\"#\")\r\n\t\tPercent character (\"%\")\t\r\n\t*/\r\n\t$result = str_replace(\"'\",\"\",$result);\r\n\t$result = str_replace('\"',\"\", $result);\r\n\t$result = str_replace(\"<\",\"\", $result);\r\n\t$result = str_replace(\">\",\"\", $result);\r\n\t$result = str_replace(\"#\",\"\", $result);\r\n\t$result = str_replace(\"%\",\"\", $result);\r\n\t\r\n\t/* Miscellaneous characters */\r\n\t$result = str_replace(\"à\",\"a\",$result);\t\r\n\t$result = str_replace(\"è\",\"e\",$result);\r\n\t$result = str_replace(\"é\",\"e\",$result);\t\r\n\t$result = str_replace(\"ì\",\"i\",$result);\r\n\t$result = str_replace(\"ò\",\"o\",$result);\r\n\t$result = str_replace(\"ù\",\"u\",$result);\r\n\t$result = str_replace(\".\",\"\", $result);\r\n\t$result = str_replace(\"!\",\"\", $result);\r\n\t$result = str_replace(\"(\",\"\", $result);\r\n\t$result = str_replace(\")\",\"\", $result);\r\n\t$result = str_replace(\"[\",\"\", $result);\r\n\t$result = str_replace(\"]\",\"\", $result);\r\n\t$result = str_replace(\"{\",\"\", $result);\r\n\t$result = str_replace(\"}\",\"\", $result);\r\n\t$result = str_replace(\"|\",\"\", $result);\r\n\t$result = str_replace(\"\\\\\",\"\",$result);\r\n\t$result = str_replace(\"^\",\"\", $result);\r\n\t$result = str_replace(\"~\",\"\", $result);\r\n\t$result = str_replace(\"`\",\"\", $result);\r\n\t\r\n\t/* final */\r\n\t$result = str_replace(\"-\",\"\",$result);\r\n\t$result = str_replace(\" \",\"-\",$result);\t// three consecutive spaces\r\n\t$result = str_replace(\" \",\"-\",$result);\t// two consecutive spaces\r\n\t$result = str_replace(\" \",\"-\",$result);\r\n\r\n\treturn $result;\r\n}", "public function normalizeSpace() {\n return new String(\\trim(\\preg_replace('#[\\s\\p{Zs}]+#u', ' ', $this->value)));\n }", "function delete_spc_before_after($chaine){\r\n $debut=0;\r\n $fin=long_chaine($chaine)-1;\r\n $newChaine = '';\r\n\r\n if($chaine==''){ return $chaine; }\r\n\r\n while ($chaine[$debut]==' '){\r\n $debut++; \r\n if(!isset($chaine[$debut])){\r\n return '';\r\n } \r\n }\r\n\r\n while ($chaine[$fin]==' '){ $fin--; }\r\n \r\n \r\n for ($i=$debut; $i <=$fin ; $i++) { \r\n $newChaine.=$chaine[$i];\r\n }\r\n return $newChaine;\r\n}", "function supprimer_espaces($texte){\n $texte=preg_replace('/\\s\\s+/', '',$texte);\n $texte=preg_replace('/^\\s+/', '',$texte); \n $texte=preg_replace('/\\s+$/', '',$texte);\n return $texte; \n }", "function loseSpace($pcon){\n //$pcon = preg_replace(\"/&nbsp;/\",\"\",$pcon);\n// $pcon = preg_replace(\"/ /\",\"\",$pcon);\n $pcon = preg_replace(\"/\\r\\n/\",\"\",$pcon);\n //$pcon = str_replace(chr(13),\"\",$pcon);\n //$pcon = str_replace(chr(10),\"\",$pcon);\n //$pcon = str_replace(chr(9),\"\",$pcon);\n return $pcon;\n}", "function strip_seps($haystack) {\n foreach (array(' ', '_', '-') as $n) {\n $haystack = str_replace($n, \"\", $haystack);\n }\n return $haystack;\n}", "function removeTitle($string, $keyReplace = \"/\"){\n\t$string = removeAccent($string);\n\t$string = trim(preg_replace(\"/[^A-Za-z0-9]/i\",\" \",$string)); // khong dau\n\t$string = str_replace(\" \",\"-\",$string);\n\t$string = str_replace(\"--\",\"-\",$string);\n\t$string = str_replace(\"--\",\"-\",$string);\n\t$string = str_replace(\"--\",\"-\",$string);\n\t$string = str_replace(\"--\",\"-\",$string);\n\t$string = str_replace(\"--\",\"-\",$string);\n\t$string = str_replace(\"--\",\"-\",$string);\n\t$string = str_replace(\"--\",\"-\",$string);\n\t$string = str_replace($keyReplace,\"-\",$string);\n\treturn strtolower($string);\n}", "function put_name( $name ) {\n $name = str_replace( '|' , ' ', $name );\n $name = str_replace( ' ' , ' ', $name );\n return $name;\n}", "public function toSlug($string,$space=\"-\") {\n if (function_exists('iconv')) {\n $string = @iconv('UTF-8', 'ASCII//TRANSLIT', $string);\n }\n $string = preg_replace(\"/[^a-zA-Z0-9 -]/\", \"\", $string);\n $string = strtolower($string);\n $string = str_replace(\" \", $space, $string);\n\n return $string;\n }", "function remove_spaces($str)\n{\n// Das ist jetzt 'foo o'\n $str = preg_replace('/\\s\\s+/', ' ', $str);\n return $str;\n}", "function replace_chars($content)\r\n\t{\r\n\t\t//convert all characters to lower case\r\n\t\t$content = mb_strtolower($content);\r\n\t\t//$content = mb_strtolower($content, \"UTF-8\");\r\n\t\t$content = strip_tags($content);\r\n\r\n\t\t$punctuations = array(',', ')', '(', '.', \"'\", '\"',\r\n\t\t'<', '>', '!', '?', '/', '-',\r\n\t\t'_', '[', ']', ':', '+', '=', '#',\r\n\t\t'$', '&quot;', '&copy;', '&gt;', '&lt;', \r\n\t\t'&nbsp;', '&trade;', '&reg;', '', '•',\r\n\t\tchr(10), chr(13), chr(9));\r\n\r\n\t\t$content = str_replace($punctuations, \" \", $content);\r\n\t\t// replace multiple gaps\r\n\t\t$content = preg_replace('/ {2,}/si', \" \", $content);\r\n\r\n\t\treturn $content;\r\n\t}", "public function unglue($word);", "function sq_unspace(&$attvalue){\n $me = 'sq_unspace';\n if (strcspn($attvalue, \"\\t\\r\\n\\0 \") != strlen($attvalue)){\n $attvalue = str_replace(Array(\"\\t\", \"\\r\", \"\\n\", \"\\0\", \" \"),\n Array('', '', '', '', ''), $attvalue);\n }\n}", "function mfp_Fix_Text_Spacing($the_Post)\n {\n $the_New_Post = str_replace(\"electrónica\", \" ELECTRÓNICA \", $the_Post);\n return $the_New_Post;\n }", "function slugify($text)\n{\n $text = preg_replace('/\\W+/', '-', $text);\n // trim and lowercase\n $text = strtolower(trim($text, '- '));\n return $text;\n}", "function title_lowercase_no_chars($content) {\n $content = preg_replace(\"/ +/\", \" \", trim($content)); \n //trim spaces \n $content = str_replace(\" \", \"\", $content); \n //to lower case \n $content = strtolower($content);\n\n return $content;\n\n }", "function convSpace($string) {\n return str_replace(\" \",\"+\",$string);\n}", "function as_slug_this($content) {\n\t\treturn preg_replace(\"/-$/\",\"\",preg_replace('/[^a-z0-9]+/i', \"-\", strtolower($content)));\n\t}", "function as_slug_this($content) {\n\t\treturn preg_replace(\"/-$/\",\"\",preg_replace('/[^a-z0-9]+/i', \"-\", strtolower($content)));\n\t}", "function removeExtraSpaces( $str=\"\" ) {\n\t\t$s = preg_replace(array('/\\s{2,}/','/[\\t\\n]/'),' ',$str);\n\t\t$s = $this->spaceTildeSwap($s, array(' <a',' <span',' <b',' <strong',' <i','a> ','span> ','b> ','strong> ','i> '));\n\t\t$s = str_replace('> ','>',$s); $s = str_replace(' <','<',$s);\n\t\t$s = $this->tildeSpaceSwap($s, array('~<a','~<span','~<b','~<strong','~<i','a>~','span>~','b>~','strong>~','i>~'));\n\t\treturn $s;\n\t}" ]
[ "0.66871464", "0.66147584", "0.6600131", "0.6502027", "0.645953", "0.62895316", "0.6287327", "0.625694", "0.62496173", "0.619359", "0.6193049", "0.61898875", "0.6174519", "0.6171691", "0.61544645", "0.60894805", "0.6078999", "0.6058361", "0.60502595", "0.60475147", "0.60420185", "0.602143", "0.5973311", "0.59379816", "0.5934583", "0.5927297", "0.58953255", "0.5891756", "0.5891756", "0.589019" ]
0.7804742
0
Test is response method in SimpleRenderer will just fullfill body of the response and return RESPONSE.
public function testJustResponseFullfilled() { $renderSimpleMock = $this->getMock( SimpleRenderer::class, ['render'], [$this->helperManagerMock, [], $this->factoryMock, $this->wpMock] ); $renderSimpleMock->expects($this->once()) ->method('render') ->with($this->stubPath, $this->stubArgs) ->willReturn($this->stubContent); $responseMock = $this->getMockBuilder(ResponseInterface::class)->getMock(); $streamMock = $this->getMockBuilder(StreamInterface::class)->getMock(); $responseMock->expects($this->once())->method('getBody')->willReturn($streamMock); $streamMock->expects($this->once())->method('write')->with($this->stubContent); $this->assertEquals( $responseMock, $renderSimpleMock->response( $responseMock, $this->stubPath, $this->stubArgs ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function get_response();", "public function getResponse () {}", "public function response();", "public function response();", "public function response();", "abstract public function getResponse();", "public function returnResponse()\n {\n echo $this->body;\n }", "public function getResponse() {}", "public function response(): ResponseInterface;", "public function getResponse()\n {\n }", "public static function response()\n {\n }", "public function getResponse(): Response;", "public function response()\n {\n $statusCode = $this->request->getStatusCode();\n $statusMsg = $this->getStatusMessages($statusCode);\n $this->setStatusHeaders($statusCode);\n $this->renderJSON(array('msg' => $statusMsg));\n }", "public function getBasicResponse();", "public function testRender() {\n $builder = new Builder();\n $response = $this->createMock(Response::class);\n $message = ['message' => 'this is a message'];\n $response->expects($this->any())->method('data')->willReturn(null, $message, $message);\n $response->expects($this->any())->method('headers')->willReturn([]);\n $response->expects($this->any())->method('code')->willReturn(Code::OK_200);\n\n $builder->response($response);\n\n $this->assertEquals(\"HTTP/1.1 200 OK\\r\\nContent-Length: 0\\r\\n\\r\\n\", $builder->render());\n $this->assertEquals(\"HTTP/1.1 200 OK\\r\\nContent-Length: 25\\r\\n\\r\\nmessage=this+is+a+message\", $builder->render());\n $builder->written(10);\n $this->assertEquals(\"00 OK\\r\\nContent-Length: 25\\r\\n\\r\\nmessage=this+is+a+message\", $builder->render());\n\n $this->expectException(\\Error::class);\n (new Builder())->render();\n }", "public function getResponse() {\n }", "public function getResponse() {\n }", "public function GetResponse();", "abstract protected function getResponse(): ResponseInterface;", "abstract public function getExpectedResponse(): string;", "public function respond() {\n if (empty($this->responseData))\n $this->responseData = (object) array();\n $this->response->type('json');\n $this->response->body([\n 'status' => $this->status,\n 'code' => $this->code,\n 'data' => $this->responseData,\n 'message' => $this->message,\n //'errors' => $this->errors,\n ]);\n $this->response->send();\n $this->response->stop();\n }", "public function getResponse();", "public function getResponse();", "public function getResponse();", "public function getResponse();", "public function getResponse();", "public function getResponse();", "public function getResponse();", "public function getResponse();", "public function getResponse();" ]
[ "0.6795491", "0.6642477", "0.6606862", "0.6606862", "0.6606862", "0.66037726", "0.6581517", "0.6567831", "0.654403", "0.6540445", "0.65359193", "0.65298045", "0.6506941", "0.6488457", "0.6483146", "0.6469797", "0.6469797", "0.6468742", "0.6414032", "0.64018774", "0.63946587", "0.63867044", "0.63867044", "0.63867044", "0.63867044", "0.63867044", "0.63867044", "0.63867044", "0.63867044", "0.63867044" ]
0.6896598
0
Test is alias will be converted to the full path then requesting template with relative path
public function testIsTemplatePathCorrectlyTransformed() { vfsStreamWrapper::register(); $streamDir = new vfsStreamDirectory('superpupper'); $streamDir->addChild(new vfsStreamFile('test.phtml')); vfsStreamWrapper::setRoot($streamDir); $this->stubPath = vfsStream::url('superpupper/test.phtml'); $this->closureMock->method('bindTo')->willReturn($this->stubClosure); $this->factoryMock->method('make')->willReturn($this->closureMock); $renderSimpleMock = new SimpleRenderer( $this->helperManagerMock, [ 'view' => vfsStream::url('superpupper') ], $this->factoryMock, $this->wpMock ); $result = $renderSimpleMock->render('view/test.phtml', $this->stubArgs); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function test_template()\n {\n $t = $this->template;\n $case = __DIR__ . '/templates/case1.php';\n $content = $t->render( $case, array( 'test' => 'case1' ) );\n $this->assertEquals( 'test:case1', $content );\n }", "abstract public function getTemplatePath();", "public function testParseFileFromThemeUsingAlias()\n\t{\n\t\t$this->stub->map(array(\n\t\t\t'foo.index' => 'home.index',\n\t\t));\n\n\t\t$theme = \\Bundle::path('orchestra').'tests'.DS.'fixtures'.DS.'public'.DS.'themes'.DS;\n\t\t$expected = \"path: {$theme}default/home/index.blade.php\";\n\n\t\t$this->assertEquals($expected, $this->stub->parse('foo.index'));\n\t\t$this->assertEquals($expected, $this->stub->path('foo.index'));\n\t}", "public abstract function getTemplatePath();", "public function getTemplatePath()\n\t{\n\t\treturn P::m($this->rootDirectory, (string)$this->test['template']);\n\t}", "function test_template()\n {\n $t = $this->template;\n $t->setTemplate( 'case1.php' );\n $t->test = 'case1';\n $content = $t->render();\n $this->assertEquals( 'test:case1', $content );\n }", "public function testRenderTemplateName(): void\n {\n $pathEntry = new PathEntry(dirname(dirname(__DIR__)) . '/templates', 'tpl');\n $engine = new Engine('test', null, [$pathEntry]);\n $engine->variable('test', $this->randomString);\n $result = $engine->render();\n $this->assertEquals('(' . $this->randomString . ')', $result);\n }", "function getTemplatesPath();", "function templatePath(){\r\n\treturn basePath().'templates/';\r\n}", "function Engine_GetTemplate($test) {\n\t\t$tpl = $this->templum->template('Engine_GetTemplate');\n\t}", "public function testInvalidPath() {\n AbstractTemplate::setPath(DATA_DIR.'no-templates');\n }", "function template_path( $scriptName = \"\" ){\n return dirname(__FILE__) .\"/\". $scriptName;\n}", "public static function loadTemplate(): string\n\t{\n\t\t$backtrace = \\debug_backtrace();\n\t\t$callPath = $backtrace[0]['file'] ?? '';\n\t\t$staticHtmlPath = self::parsePath(self::$htmlPath);\n\t\t$staticOverridePath = self::parsePath(self::$overridePath);\n\t\t$templateOverrideUri = self::parsePath(self::$tmplOverridePath);\n\t\t$webAssetUri = self::parsePath('/templates/{{template}}/joomla.asset.json');\n\n\t\t$relativePath = '';\n\t\t$overridePath = '';\n\n\t\t/**\n\t\t * If the callee file is in the template's html directory.\n\t\t */\n\t\tif (\\strpos($callPath, $staticHtmlPath) === 0)\n\t\t{\n\t\t\t$relativePath = \\substr($callPath, \\strlen($staticHtmlPath));\n\t\t}\n\n\t\t/** If no relative path extracted. */\n\t\tif (empty($relativePath))\n\t\t{\n\t\t\treturn self::generateExtensionPath(\\substr($callPath, stripos($callPath, '/html/') + 5));\n\t\t}\n\n\t\t$templateOverridePath = $templateOverrideUri . $relativePath;\n\n\t\tif (\\file_exists($templateOverridePath))\n\t\t{\n\t\t\treturn $templateOverridePath;\n\t\t}\n\n\t\t$pluginOverridePath = $staticOverridePath . $relativePath;\n\n\t\tif (\\file_exists($pluginOverridePath))\n\t\t{\n\t\t\treturn $pluginOverridePath;\n\t\t}\n\n\t\treturn self::generateExtensionPath($relativePath);\n\t}", "public function getTemplateDirectory(): string;", "public function getTemplateDirectory(): string;", "function testRespectSmartyTemplateDirInAppOptions() {\n // to make sure that templates in the site's templates/ dir are rendered\n\n $dir = sys_get_temp_dir();\n $app = $this->startApp(array('template_dir' => $dir));\n\n Octopus::loadExternal('smarty');\n $smarty = Octopus_Smarty::trusted();\n\n $this->assertEquals(array($dir), $smarty->smarty->template_dir);\n\n }", "function templateroot() {\r\n\treturn __REWRITEBASE . __DEFAULT_TEMPLATEPATH;\r\n}", "function template_path($template = '')\n { \n return extension_path(\"templates\").($template ? DS.$template : $template);\n }", "public function testValidPath1() {\n $path = DATA_DIR.'templates/';\n AbstractTemplate::setPath($path);\n $this->assertSame($path, AbstractTemplate::getPath());\n }", "public function testResource()\n {\n $result = $this->twigEnvironment->render('test.twig', ['var' => opendir(sys_get_temp_dir())]);\n\n self::assertSame('<script>console.log(\\'%cresource\\',\\'color:#555;font-weight:400\\');</script>', $result);\n }", "public function testValidPath2() {\n $path = DATA_DIR.'templates';\n AbstractTemplate::setPath($path);\n $this->assertNotSame($path, AbstractTemplate::getPath());\n $this->assertSame(\"$path/\", AbstractTemplate::getPath());\n }", "private function templateDir ($file)\n\t{\n\t\techo $file;\n\t}", "function admin_template(string $path): string\n {\n return admin()->template($path);\n }", "function st_get_template($file,$data = array()){\n $file = ST_DIR.'/templates/'.$file;\n if(file_exists($file)){\n include($file); return true;\n }\n return false;\n}", "public function defaultTemplate()\n\t{\n\t\treturn $this->processRelativePath(A::get($this->settings, 'defaultTemplate'));\n\t}", "function template_path($file, $data = [])\n{\n return sage('blade')->compiledPath($file, $data);\n}", "function template_path($file, $data = [])\n{\n return sage('blade')->compiledPath($file, $data);\n}", "public function findTemplatePath() {\r\n \t\tforeach (tx_auxo_loader::getTemplatePathes($this->extension, $this->module) as $path) {\r\n\t\t\t$fullpath = $path . '/' . $this->getTemplate();\r\n\t\t\tif (is_readable($fullpath)) {\r\n\t\t\t\treturn $path;\r\n\t\t\t}\r\n \t\t}\r\n \t\t\r\n \t\tthrow new tx_auxo_presentationException(sprintf('Template %s not found', $this->getTemplate()));\r\n\t}", "function template_hint(string $template, string $directory = null)\n { \n return call_user_func('template_hint_key', $template, $directory); \n }", "function getUrlToPath($path)\n{\n return \"%%ROOT%%\" . $path;\n}" ]
[ "0.67773086", "0.67767626", "0.67465365", "0.67225087", "0.63647246", "0.63606846", "0.6343995", "0.6236703", "0.61611897", "0.61586267", "0.60685354", "0.6058807", "0.59932715", "0.5975467", "0.5975467", "0.58984154", "0.5812217", "0.5807388", "0.5801696", "0.5798961", "0.5779197", "0.57594556", "0.5757589", "0.57524204", "0.5738484", "0.57112294", "0.57112294", "0.5703272", "0.5702479", "0.5673815" ]
0.6957928
0
Test if render method and response methods can be called without template args, and in this case will be used default empty array
public function testIfTemplateArgsOptionalAndEmptyArrayByDefault() { $this->closureMock->expects($this->once()) ->method('bindTo') ->with( $this->helperManagerMock, get_class($this->helperManagerMock) ) ->willReturn($this->stubClosure); $this->factoryMock->expects($this->once()) ->method('make') ->with( Closure::class, ['closure'=>function () { }] ) ->willReturn($this->closureMock); $renderSimpleMock = $this->getMock( SimpleRenderer::class, ['getTemplatePath'], [$this->helperManagerMock, [], $this->factoryMock, $this->wpMock] ); $renderSimpleMock->expects($this->once()) ->method('getTemplatePath') ->with($this->stubTemplate) ->willReturn($this->stubPath); $this->stubArgs = []; $result = $renderSimpleMock->render($this->stubTemplate); $renderSimpleMock = $this->getMock( SimpleRenderer::class, ['render'], [$this->helperManagerMock, [], $this->factoryMock, $this->wpMock] ); $responseMock = $this->getMockBuilder(ResponseInterface::class)->getMock(); $streamMock = $this->getMockBuilder(StreamInterface::class)->getMock(); $responseMock->expects($this->once())->method('getBody')->willReturn($streamMock); $streamMock->expects($this->once())->method('write'); $renderSimpleMock->response($responseMock, $this->stubPath); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function test_no_filter_listing_view() {\n\t\t$dynamic_view = self::get_view_by_key( 'dynamic-view' );\n\t\t$expected_content = array( 'Jamie', 'Steph', 'Steve' );\n\n\t\t$d = self::get_default_args( $dynamic_view, $expected_content, array() );\n\n\t\tself::run_get_display_data_tests( $d, 'dynamic view with no filters' );\n\n\t\tself::run_frm_vars_test( 1 );\n\t}", "public function testAjaxViewWithEmptyArguments() {\n $request = new Request();\n $request->request->set('view_name', 'test_view');\n $request->request->set('view_display_id', 'page_1');\n // Simulate a request that has a second, empty argument.\n $request->request->set('view_args', 'arg1/');\n\n [$view, $executable] = $this->setupValidMocks();\n $executable->expects($this->once())\n ->method('preview')\n ->with('page_1', $this->identicalTo(['arg1', NULL]));\n\n $response = $this->viewAjaxController->ajaxView($request);\n $this->assertInstanceOf(ViewAjaxResponse::class, $response);\n\n $this->assertViewResultCommand($response);\n }", "protected function renderViewDefaultData()\n {\n return [];\n }", "public function render()\n {\n\n $args = \\func_get_args();\n $template = isset($args[0]) ? $args[0] : '';\n $extract_vars = isset($args[1]) ? $args[1] : null;\n\n $output = '';\n\n //capture view to buffer\n ob_start();\n\n $is_index_controller = \\get_called_class() == 'Controllers\\Index';\n\n //if no method is set, use index\n if ($is_index_controller) {\n $method = !empty($this->request->path_array[0]) ? $this->request->path_array[0] : $this->default_file;\n } else {\n $method = isset($this->request->path_array[1]) ? $this->request->path_array[1] : $this->default_file;\n }\n\n //return the servable method\n $response = $this->processControllerMethod($method);\n\n //if there is a response, return that\n if ($response['exists']) {\n return $response['data'];\n }\n\n //if direct view rendering is allowed\n //use controller from first part of URL or default index controller and\n //render the view using it as the implied controller\n if (\\sb\\Gateway::$allow_direct_view_rendering) {\n $direct_view_rendering_output = $this->processDirectViewRendering($template, $extract_vars);\n if($direct_view_rendering_output !== false){\n return $direct_view_rendering_output;\n }\n }\n\n //return whatever notFound has as long as it is a string\n $result = $this->notFound();\n\n if(!is_null($result) && !is_string($result) && !is_numeric($result)){\n throw(new \\Exception(ucfirst(gettype($result)).\" returned where string expected. You must return a string from \\\\\".get_called_class().'->notFound().'));\n }\n return $result;\n }", "public function testEmptyResponseReturnedWhenNoResponseIsOtherwiseReturned()\n {\n $controller = function () {\n // Don't do anything\n };\n $response = $this->middlewarePipeline->send(Request::createFromGlobals(), [], $controller);\n /** @var Response $response */\n $this->assertInstanceOf(Response::class, $response);\n $this->assertEmpty($response->getContent());\n $this->assertEquals(ResponseHeaders::HTTP_OK, $response->getStatusCode());\n }", "public function nothingAction()\n {\n return $this->render('default/nothing.html.twig');\n }", "public function testProtectedRenderNoContext()\n {\n $template = uniqid('template');\n $tStart = uniqid('token-start');\n $tEnd = uniqid('token-end');\n $defaultValue = uniqid('default-value');\n $context = null;\n $rendered = uniqid('rendered');\n $subject = $this->createInstance(['_getPlaceholderTemplate', '_getTokenStart', '_getTokenEnd', '_getDefaultPlaceholderValue', '_replaceTokens']);\n $_subject = $this->reflect($subject);\n\n $subject->expects($this->exactly(1))\n ->method('_getPlaceholderTemplate')\n ->will($this->returnValue($template));\n $subject->expects($this->exactly(1))\n ->method('_getTokenStart')\n ->will($this->returnValue($tStart));\n $subject->expects($this->exactly(1))\n ->method('_getTokenEnd')\n ->will($this->returnValue($tEnd));\n $subject->expects($this->exactly(1))\n ->method('_getDefaultPlaceholderValue')\n ->will($this->returnValue($defaultValue));\n $subject->expects($this->exactly(1))\n ->method('_replaceTokens')\n ->with($template, [], $tStart, $tEnd, $defaultValue)\n ->will($this->returnValue($rendered));\n\n $_subject->_render($context);\n }", "public function testEmptyArrayRoutes(): void\n {\n $this->setRequestUri('/catalog/item/');\n\n $router = $this->getRouter();\n $router->addRoute('/catalog/item/', function (string $route): string {\n return $route;\n }, 'GET');\n\n /** @var string $result */\n $result = $router->callRoute([\n 0 => ''\n ]);\n\n $this->assertEquals($result, 'catalog/item');\n }", "public function renderDefault() { }", "public function testHandleNoAjax()\n {\n $mock = m::mock(\n 'Estey\\ReactMiddleware\\CompileReact[respondWithJson, compile]',\n [$this->config]\n )->shouldAllowMockingProtectedMethods();\n\n $request = m::mock('Illuminate\\Http\\Request');\n $next = function ($request) {\n return $this->response;\n };\n\n $request\n ->shouldReceive('path')\n ->once();\n\n $request\n ->shouldReceive('query')\n ->once();\n\n $this->response\n ->shouldReceive('getOriginalContent')\n ->once()\n ->andReturn($this->view);\n\n $mock\n ->shouldReceive('compile')\n ->once()\n ->andReturn('foo bar baz');\n\n $this->assertEquals(\n $mock->handle($request, $next, 'disable_json'),\n 'foo bar baz'\n );\n }", "function beforeRender() {\n if (!isset($this->params['requested']) && $this->__defaultSettings['genericElement']) {\n $view =& ClassRegistry:: getObject('view');\n if ($view) {\n echo $view->element($this->__defaultSettings['genericElement']);\n }\n }\n return true;\n }", "public function testMethodOverrideEmptyParsedBody(): void\n {\n $body = ['_method' => 'GET', 'foo' => 'bar'];\n $request = ServerRequestFactory::fromGlobals(\n ['REQUEST_METHOD' => 'POST'],\n [],\n $body\n );\n $this->assertEmpty($request->getParsedBody());\n\n $request = ServerRequestFactory::fromGlobals(\n [\n 'REQUEST_METHOD' => 'POST',\n 'HTTP_X_HTTP_METHOD_OVERRIDE' => 'GET',\n ],\n [],\n ['foo' => 'bar']\n );\n $this->assertEmpty($request->getParsedBody());\n }", "public static function none(){\n return !call_user_func_array(__CLASS__.'::any', func_get_args());\n }", "protected function _renderWithoutResources(): Response\n {\n $this->_controller()->viewBuilder()->setOptions([\n 'withJsonApiVersion' => $this->getConfig('withJsonApiVersion'),\n 'meta' => $this->getConfig('meta'),\n 'links' => $this->getConfig('links'),\n 'absoluteLinks' => $this->getConfig('absoluteLinks'),\n 'jsonOptions' => $this->getConfig('jsonOptions'),\n 'debugPrettyPrint' => $this->getConfig('debugPrettyPrint'),\n 'serialize' => true,\n ]);\n\n return $this->_controller()->render();\n }", "protected function _renderWithoutResources()\n {\n $this->_controller()->set([\n '_withJsonApiVersion' => $this->config('withJsonApiVersion'),\n '_meta' => $this->config('meta'),\n '_absoluteLinks' => $this->config('absoluteLinks'),\n '_jsonApiBelongsToLinks' => $this->config('jsonApiBelongsToLinks'),\n '_jsonOptions' => $this->config('jsonOptions'),\n '_debugPrettyPrint' => $this->config('debugPrettyPrint'),\n '_serialize' => true,\n ]);\n\n return $this->_controller()->render();\n }", "protected function _noRouteShouldBeApplied()\n {\n return true;\n }", "protected function _renderWithoutResources()\n {\n $this->_controller()->set([\n '_withJsonApiVersion' => $this->getConfig('withJsonApiVersion'),\n '_meta' => $this->getConfig('meta'),\n '_absoluteLinks' => $this->getConfig('absoluteLinks'),\n '_jsonApiBelongsToLinks' => $this->getConfig('jsonApiBelongsToLinks'),\n '_jsonOptions' => $this->getConfig('jsonOptions'),\n '_debugPrettyPrint' => $this->getConfig('debugPrettyPrint'),\n '_serialize' => true,\n ]);\n\n return $this->_controller()->render();\n }", "function test_empty_get_param_filter() {\n\t\tself::clear_get_values();\n\t\t$dynamic_view = self::get_view_by_key( 'dynamic-view' );\n\n\t\t// Add filter \"Single Line Text is equal to [get param=test]\"\n\t\t$filter_args = array(\n\t\t\tarray( 'type' => 'field',\n\t\t\t\t'col' => '493ito',\n\t\t\t\t'op' => '=',\n\t\t\t\t'val' => '[get param=test]',\n\t\t\t),\n\t\t);\n\t\tself::add_filter_to_view( $dynamic_view, $filter_args );\n\n\t\t$expected_content = array( 'Jamie', 'Steph', 'Steve' );\n\t\t$d = self::get_default_args( $dynamic_view, $expected_content, array() );\n\n\t\tself::run_get_display_data_tests( $d, 'view with empty get param filter' );\n\t}", "private function set_default_template()\n {\n $excluded_pages = array('delete', 'update', 'destroy', 'noaccess', 'logout','language');\n if ( ! in_array( Request::current()->action(), $excluded_pages ) )\n {\n if (Request::current()->directory() )\n {\n return View::factory(Request::current()->directory().'/'.Request::current()->controller().'/'.Request::current()->action());\n }\n elseif (in_array(Request::current()->controller(), array('Pages','Account')) )\n {\n return View::factory(Request::current()->controller().'/'.Request::current()->action());\n } \n }\n // else\n return false; \n }", "public function withoutAnyArgument() {}", "public function except($methods = array())\n {\n if (is_array($methods) && count(is_array($methods))) {\n foreach ($methods as $method) {\n if ($method == (is_null($this->uri->segment(2)) ? \"index\" : $this->uri->segment(2))) {\n return true;\n }\n }\n }\n\n return $this->route_access();\n }", "public function testGenerateWithOptionalOnBareUrl()\n {\n $this->router->map(\n 'GET',\n '/[i:page]?',\n function () {\n },\n 'bare_route'\n );\n $params = array(\n 'page' => 1\n );\n $this->assertEquals(\n '/1',\n $this->router->generate('bare_route', $params)\n );\n $params = array();\n $this->assertEquals(\n '/',\n $this->router->generate('bare_route', $params)\n );\n }", "protected function defaultResponse($args = null) {\n\t\t$args = (empty($args) || !is_array($args))? [] : $args;\n\t\treturn array_merge(['status' => 'ok', 'reason' => '', 'data' => []], $args);\n\t}", "public function testReturnArrayReturnsNonEmpty()\n {\n\n $this->assertTrue((count($this->pages->returnArray()) > 0));\n }", "private function forceOtherwise() {\n\n // Clean Buffer\n ob_clean();\n\n // Set response code\n http_response_code(404);\n\n if (isset($this->aRoutes[':all']) && $this->bRenderAllBeforeOtherwise){\n $this->render(':all', true);\n }\n\n if (isset($this->aRoutes[':otherwise']) && count($this->aRoutes[':otherwise'])) {\n // Render will handle ob_end_flush\n return $this->render(':otherwise');\n } else {\n echo $this->sDeathMessage;\n // Flush Buffer\n ob_end_flush();\n return true;\n }\n\n // If this is a Unit Test, we want it to carry on through the forceOtherwise.\n if (!$this->bUnitTest){ die; }\n }", "public function willRenderEmpty(): bool\n {\n return $this->renderEmpty;\n }", "function test_no_entries_no_msg_view() {\n\t\t$dynamic_view = self::get_view_by_key( 'dynamic-view' );\n\t\tunset( $dynamic_view->frm_empty_msg );\n\n\t\t// Add filter \"Entry ID is equal to 0\"\n\t\t$filter_args = array(\n\t\t\tarray( 'type' => 'col', 'col' => 'id', 'op' => '=', 'val' => '0' ),\n\t\t);\n\t\tself::add_filter_to_view( $dynamic_view, $filter_args );\n\n\t\t$expected_content = array( 'No Entries Found');\n\n\t\t$d = self::get_default_args( $dynamic_view, $expected_content, array() );\n\n\t\tself::run_get_display_data_tests( $d, 'dynamic view with entry_id=0 and no empty message' );\n\t}", "public static function responseNoContent(){\n $responder = \\App::make('JsonResponder');\n return $responder->responseNoContent();\n }", "public function internalNoCacheRoute() {\n // No cache from route\n // Simulate a long process.\n $data = $this->getMyData(2, \"Internal Page Cache (no-cache in route)\");\n\n // Return the render array.\n return [\n '#type' => 'markup',\n '#markup' => $data,\n ];\n }", "public function testBeforeRenderPaginationDataIsNull() {\n\t\t$Request = $this->getMock('CakeRequest', array('is'));\n\t\t$Request->paging = null;\n\t\t$Request\n\t\t\t->expects($this->once())\n\t\t\t->method('is')\n\t\t\t->with('api')\n\t\t\t->will($this->returnValue(true));\n\n\t\t$Crud = $this->getMock('stdClass', array('action'));\n\t\t$Crud\n\t\t\t->expects($this->never())\n\t\t\t->method('action');\n\n\t\t$CrudSubject = new CrudSubject(array('request' => $Request, 'crud' => $Crud, 'modelClass' => 'AnotherModel'));\n\n\t\t$Instance = new ApiPaginationListener($CrudSubject);\n\t\t$Instance->beforeRender(new CakeEvent('something', $CrudSubject));\n\t}" ]
[ "0.57458895", "0.57211125", "0.5710984", "0.552106", "0.5507327", "0.54475904", "0.54390883", "0.54311335", "0.54263574", "0.5421868", "0.54217577", "0.541487", "0.53801453", "0.5376751", "0.53535116", "0.5326439", "0.53234535", "0.5306249", "0.5279469", "0.52491486", "0.52231055", "0.5190376", "0.51812637", "0.51796246", "0.51716614", "0.5161405", "0.51610583", "0.513065", "0.51070434", "0.51051515" ]
0.6319503
0
GenSeed is the first method that should be used to instantiate a new lnd instance. This method allows a caller to generate a new aezeed cipher seed given an optional passphrase. If provided, the passphrase will be necessary to decrypt the cipherseed to expose the internal wallet seed. Once the cipherseed is obtained and verified by the user, the InitWallet method should be used to commit the newly generated seed, and create the wallet.
public function GenSeed(\Lnrpc\GenSeedRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/lnrpc.WalletUnlocker/GenSeed', $argument, ['\Lnrpc\GenSeedResponse', 'decode'], $metadata, $options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function genSeed($aezeedPassphrase = null, $seedEntropy = null)\n {\n list($response) = $this->genSeedWithHttpInfo($aezeedPassphrase, $seedEntropy);\n return $response;\n }", "protected function genSeedRequest($aezeedPassphrase = null, $seedEntropy = null)\n {\n\n $resourcePath = '/v1/genseed';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // query params\n if ($aezeedPassphrase !== null) {\n $queryParams['aezeed_passphrase'] = ObjectSerializer::toQueryValue($aezeedPassphrase);\n }\n // query params\n if ($seedEntropy !== null) {\n $queryParams['seed_entropy'] = ObjectSerializer::toQueryValue($seedEntropy);\n }\n\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/json']\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 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public static function newWalletFromPlatformSeedAndWalletSeed($platform_seed, $wallet_seed) {\n $wallet = new CopayWallet();\n $wallet->initEntropyFromSeeds($platform_seed, $wallet_seed);\n return $wallet;\n }", "public function create_seed() {\n\n $limiter = ceil($this->hash_bit_count / 16);\n\n if (empty($limiter)) {\n $limiter = 20;\n }\n\n $s1a = gmp_random($limiter);\n $s1b = gmp_random($limiter);\n $s2a = gmp_random($limiter);\n $s2b = gmp_random($limiter);\n\n $s1_prime = gmp_nextprime(gmp_mul($s1a, $s1b));\n $s2_prime = gmp_nextprime(gmp_mul($s2a, $s2b));\n\n $seed = gmp_mul($s1_prime, $s2_prime);\n\n $seed = $this->ring_big_numbers($seed);\n\n return gmp_strval($seed);\n }", "function sodium_crypto_box_seed_keypair(string $seed): string {}", "static public function fromSeed($seed): Keypair\n {\n $seed = Buffer::from($seed)->toString();\n\n $keypair = sodium_crypto_sign_seed_keypair($seed);\n\n return static::from($keypair);\n }", "public function genSeedWithHttpInfo($aezeedPassphrase = null, $seedEntropy = null)\n {\n $returnType = '\\Lnd\\Rest\\Model\\LnrpcGenSeedResponse';\n $request = $this->genSeedRequest($aezeedPassphrase, $seedEntropy);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Lnd\\Rest\\Model\\LnrpcGenSeedResponse',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public static function generate()\n {\n if (empty(env('NKN_BIN_DIR'))) {\n throw new \\Exception('Invalid NKN_BIN_DIR env var.');\n }\n\n $nknc = env('NKN_BIN_DIR') . 'nknc';\n if (!is_file($nknc)) {\n throw new \\Exception('NKNC not found.');\n }\n\n if (empty(env('NKN_DEFAULT_PASS'))) {\n throw new \\Exception('Invalid NKN_DEFAULT_PASS env var.');\n }\n\n $walletFile = storage_path('nkn/wallet.json');\n\n if (is_file($walletFile)) {\n unlink($walletFile);\n }\n\n [$address, $privateKey] = explode(' ', exec(env('NKN_BIN_DIR') . 'nknc wallet -c -p ' . env('NKN_DEFAULT_PASS') . ' -n ' . $walletFile));\n\n $wallet = self::create([\n 'address' => $address,\n 'keystore' => file_get_contents($walletFile),\n 'password' => env('NKN_DEFAULT_PASS'),\n ]);\n\n if (is_file($walletFile)) {\n unlink($walletFile);\n }\n\n return $wallet;\n }", "public function seed($seed) {\r\n srand($seed);\r\n mt_srand($seed);\r\n }", "public function keySeed(string $keySeed)\n {\n $this->keySeed = $keySeed;\n\n return $this;\n }", "private function seed(): void\n {\n }", "public function genSeedAsync($aezeedPassphrase = null, $seedEntropy = null)\n {\n return $this->genSeedAsyncWithHttpInfo($aezeedPassphrase, $seedEntropy)\n ->then(\n function ($response) {\n return $response[0];\n }\n );\n }", "public function __construct(Seed $seed)\n {\n parent::__construct();\n $this->seed = $seed;\n }", "function sodium_crypto_sign_seed_keypair(string $seed): string {}", "public function setSeed($lpaId, $seedId)\n {\n $helper = new ApplicationResourceService($lpaId, 'seed', $this);\n return $helper->setResource(json_encode(['seed' => $seedId]));\n }", "function sodium_crypto_kdf_keygen(): string {}", "public function seeder()\r\n\t{\r\n\t\t\r\n\t}", "public function encryptwallet($passphrase) {\n\n $args = $this->args;\n $args[ \"method\" ] = __FUNCTION__;\n $args[ \"params\" ] = [ \"$passphrase\" ];\n\n $res = $this->call($args);\n if ($res)\n return $res[ \"result\" ];\n }", "public static function generate(): self\n {\n $keypair = \\sodium_crypto_sign_keypair();\n $ed25519sk = \\sodium_crypto_sign_secretkey($keypair);\n $ed25519pk = \\sodium_crypto_sign_publickey($keypair);\n $keyId = \\random_bytes(8);\n\n $self = new static();\n $self->ed25519sk = $ed25519sk;\n $self->ed25519pk = $ed25519pk;\n $self->keyId = $keyId;\n return $self;\n }", "public function setClientSeed(string $clientSeed = null): self;", "public function seed( $args, $assoc_args ) {\n list( $name ) = $args;\n $type = strtolower( $name );\n $number = isset( $assoc_args['num'] ) ? $assoc_args['num'] : 0;\n\n erp_seeder()->run_seeder_from_cli( $type, intval( $number ) );\n\n WP_CLI::success( \"Tables are successfully seeded!\" );\n }", "public function seed()\n {\n // TODO: Implement seed() method.\n }", "public function generateKeyPair($keySize = 2048, $passphrase = null);", "public static function generateKeys($seed = null, $hashKey = '')\n {\n # The keys are being generated from a seed.\n if ($seed !== null) {\n # Generate some repeatable hashes to create keys against for recovery\n $encrHash = Hash::hash($seed, $hashKey, Constants::BOX_SEEDBYTES);\n $signHash = Hash::hash($seed, $hashKey, Constants::SIGN_SEEDBYTES);\n\n # Build recoverable pre-seeded key pairs.\n $seeds = [\n 'encr' => \\Sodium\\crypto_box_keypair($encrHash),\n 'sign' => \\Sodium\\crypto_sign_keypair($signHash),\n ];\n } else {\n # Build un-recoverable key pairs.\n $seeds = [\n 'encr' => \\Sodium\\crypto_box_keypair(),\n 'sign' => \\Sodium\\crypto_sign_keypair(),\n ];\n }\n\n # Return the two generated key pairs to the client.\n return [\n 'encr' => [\n 'pri' => Helpers::bin2hex(\\Sodium\\crypto_box_secretkey($seeds['encr'])),\n 'pub' => Helpers::bin2hex(\\Sodium\\crypto_box_publickey($seeds['encr'])),\n ],\n 'sign' => [\n 'pri' => Helpers::bin2hex(\\Sodium\\crypto_sign_secretkey($seeds['sign'])),\n 'pub' => Helpers::bin2hex(\\Sodium\\crypto_sign_publickey($seeds['sign'])),\n ],\n ];\n }", "public function sethdseed($newkeypool = true, $seed = NULL) {\n\n $args = $this->args;\n $args[ \"method\" ] = __FUNCTION__;\n $args[ \"params\" ] = [ $newkeypool ];\n if (!is_null($seed))\n array_push($args[ \"params\" ], $seed);\n\n $res = $this->call($args);\n if ($res)\n return $res[ \"result\" ];\n }", "public function run()\n {\n $this->seedOauthClientAccess();\n $this->seedPrimaryPages();\n $this->seedDevPosition();\n $this->seedDevPositionAccesses(1);\n $this->seedDevAccount();\n $this->seedDummyDataForTesting();\n\n // $this->call(UsersTableSeeder::class);\n\n //MODULE SEEDINGS\n $this->seedDefaultBenefitTypes();\n $this->seedDefaultPaymentModes();\n $this->seedDefaultPreExisting();\n $this->seedDefaultPaymentMethod();\n $this->seedDefaultProcedureTypes();\n $this->seedDefaultProcedures();\n\n // $this->seedDefaultTesting();\n }", "protected function getSeed()\n {\n return 100;\n }", "public function can_create_a_seeder()\n {\n\n $this->artisan(\"module:seeder\", [\n \"name\" => \"SeederTest\",\n \"--module\" => \"Test\"\n ])->expectsOutput(\"SeederTest seeder created\");\n\n $this->assertFileExists($this->workdir . \"/modules/Test/database/seeders/SeederTest.php\");\n }", "public static function generate($params = array())\n\t{\n\n\t\t$length = (!array_key_exists('length', $params)) ? 15 : $params['length'];\n\t\t$use_lower = (!array_key_exists('use_lower', $params)) ? TRUE : $params['use_lower'];\n\t\t$use_upper = (!array_key_exists('use_upper', $params)) ? TRUE : $params['use_upper'];\n\t\t$use_number = (!array_key_exists('use_number', $params)) ? TRUE : $params['use_number'];\n\t\t//$use_custom = (!array_key_exists('use_custom', $params)) ? '-_()' : $params['use_custom'];\n\n\t\t$upper = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n\t\t$lower = \"abcdefghijklmnopqrstuvwxyz\";\n\t\t$number = \"0123456789\";\n\n\t\t$seed_length = 0;\n\t\t$seed = '';\n\n\t\tif($use_upper === TRUE){\n\t\t\t$seed_length += 26;\n\t\t\t$seed .= $upper;\n\t\t}\n\t\tif($use_lower === TRUE){\n\t\t\t$seed_length += 26;\n\t\t\t$seed .= $lower;\n\t\t}\n\t\tif($use_number === TRUE){\n\t\t\t$seed_length += 10;\n\t\t\t$seed .= $number;\n\t\t}\n\t\tif(!empty($use_custom)){\n\t\t\t$seed_length +=strlen($use_custom);\n\t\t\t$seed .= $use_custom;\n\t\t}\n\t\t$password = '';\n\t\tfor($i = 1; $i <= $length; $i++){\n\t\t\t$password .= $seed{mt_rand(0,$seed_length-1)};\n\t\t}\n\t\treturn $password;\n\t}", "function sodium_crypto_secretbox_keygen(): string {}" ]
[ "0.64239985", "0.57078886", "0.5560418", "0.54058987", "0.5327785", "0.52161235", "0.51817554", "0.512324", "0.49639872", "0.48324215", "0.48181605", "0.48145926", "0.4763487", "0.47536656", "0.47457907", "0.47018224", "0.46844792", "0.46776626", "0.4666803", "0.46449426", "0.46408162", "0.46352583", "0.4617293", "0.4614229", "0.45873675", "0.4559417", "0.45357415", "0.4494152", "0.44933745", "0.44887042" ]
0.6071142
1
InitWallet is used when lnd is starting up for the first time to fully initialize the daemon and its internal wallet. At the very least a wallet password must be provided. This will be used to encrypt sensitive material on disk. In the case of a recovery scenario, the user can also specify their aezeed mnemonic and passphrase. If set, then the daemon will use this prior state to initialize its internal wallet. Alternatively, this can be used along with the GenSeed RPC to obtain a seed, then present it to the user. Once it has been verified by the user, the seed can be fed into this RPC in order to commit the new wallet.
public function InitWallet(\Lnrpc\InitWalletRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/lnrpc.WalletUnlocker/InitWallet', $argument, ['\Lnrpc\InitWalletResponse', 'decode'], $metadata, $options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function initWallet($body)\n {\n list($response) = $this->initWalletWithHttpInfo($body);\n return $response;\n }", "public function __construct(Wallet $wallet)\n {\n $this->wallet = $wallet;\n }", "public function initWalletAsync($body)\n {\n return $this->initWalletAsyncWithHttpInfo($body)\n ->then(\n function ($response) {\n return $response[0];\n }\n );\n }", "public function __construct(Wallet $wallet)\n {\n $this->wallet = new WalletResources((new WalletService())->getWallet($wallet->id));\n }", "public function __construct($wallet)\n {\n $this->wallet = $wallet;\n }", "public function __construct( Wallet $wallet )\n {\n $this -> wallet = $wallet;\n }", "public function initWalletWithHttpInfo($body)\n {\n $returnType = '\\Lnd\\Rest\\Model\\LnrpcInitWalletResponse';\n $request = $this->initWalletRequest($body);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Lnd\\Rest\\Model\\LnrpcInitWalletResponse',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function __construct(Wallet $wallet, WalletConfig $walletConfig)\n {\n parent::__construct();\n\n $this->wallet = $wallet;\n $this->walletConfig = $walletConfig->first();\n }", "public static function generate()\n {\n if (empty(env('NKN_BIN_DIR'))) {\n throw new \\Exception('Invalid NKN_BIN_DIR env var.');\n }\n\n $nknc = env('NKN_BIN_DIR') . 'nknc';\n if (!is_file($nknc)) {\n throw new \\Exception('NKNC not found.');\n }\n\n if (empty(env('NKN_DEFAULT_PASS'))) {\n throw new \\Exception('Invalid NKN_DEFAULT_PASS env var.');\n }\n\n $walletFile = storage_path('nkn/wallet.json');\n\n if (is_file($walletFile)) {\n unlink($walletFile);\n }\n\n [$address, $privateKey] = explode(' ', exec(env('NKN_BIN_DIR') . 'nknc wallet -c -p ' . env('NKN_DEFAULT_PASS') . ' -n ' . $walletFile));\n\n $wallet = self::create([\n 'address' => $address,\n 'keystore' => file_get_contents($walletFile),\n 'password' => env('NKN_DEFAULT_PASS'),\n ]);\n\n if (is_file($walletFile)) {\n unlink($walletFile);\n }\n\n return $wallet;\n }", "public function createWallet($account)\n {\n }", "protected function initWalletRequest($body)\n {\n // verify the required parameter 'body' is set\n if ($body === null || (is_array($body) && count($body) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $body when calling initWallet'\n );\n }\n\n $resourcePath = '/v1/initwallet';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // body params\n $_tempBody = null;\n if (isset($body)) {\n $_tempBody = $body;\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']\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 }", "public function wallet();", "public static function newWalletFromPlatformSeedAndWalletSeed($platform_seed, $wallet_seed) {\n $wallet = new CopayWallet();\n $wallet->initEntropyFromSeeds($platform_seed, $wallet_seed);\n return $wallet;\n }", "public function init()\n {\n $this->requireLogin();\n }", "public function setIdWallet($idWallet): TransactionModel\n {\n $this->idWallet = $idWallet;\n\n return $this;\n }", "function wallet_add_new_wallet(){\n\t}", "public function setWalletAmount(int $int) : void {\n $this->wallet = $int;\n }", "public function encryptwallet($passphrase) {\n\n $args = $this->args;\n $args[ \"method\" ] = __FUNCTION__;\n $args[ \"params\" ] = [ \"$passphrase\" ];\n\n $res = $this->call($args);\n if ($res)\n return $res[ \"result\" ];\n }", "public function init()\n {\n // generate private key\n $this->generate_private_key();\n\n // compute public key\n $this->compute_public();\n }", "private function initPrivateKey(): void\n {\n // Private Key handling / config updates\n $privateKey = $this->pemManager->readPrivateKey($this->config->getPrivateKey());\n if (!$privateKey) {\n throw new FintectureException('Cannot get private key.');\n }\n\n $pemResults = $this->pemManager->formatPrivateKey($privateKey);\n\n $finalPrivateKey = $pemResults['encrypted'] ? $privateKey : $pemResults['privateKey'];\n if ($this->pemManager->isPemString($finalPrivateKey)) {\n $this->config->setFinalPrivateKey($finalPrivateKey);\n } else {\n throw new FintectureException('The private key is not well formatted. Please verify it.');\n }\n\n if ($this->config->getEncryptionDir()) {\n // Store encrypted private key for developers\n if ($pemResults['encrypted']) {\n $this->config->setEncryptedPrivateKey($pemResults['privateKey']); // newly encrypted key (to save)\n } else {\n $this->config->setEncryptedPrivateKey($privateKey); // original key\n }\n }\n }", "public function initWalletAsyncWithHttpInfo($body)\n {\n $returnType = '\\Lnd\\Rest\\Model\\LnrpcInitWalletResponse';\n $request = $this->initWalletRequest($body);\n\n return $this->client\n ->sendAsync($request, $this->createHttpClientOption())\n ->then(\n function ($response) use ($returnType) {\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n },\n function ($exception) {\n $response = $exception->getResponse();\n $statusCode = $response->getStatusCode();\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $exception->getRequest()->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n );\n }", "public function getWallet()\n {\n return $this->hasOne(Wallet::class, ['user_id' => 'id']);\n }", "public function testInit(): void\n {\n $deDir = $this->localeDir . 'de_DE' . DS;\n if (!is_dir($deDir)) {\n mkdir($deDir, 0770, true);\n }\n file_put_contents($this->localeDir . 'default.pot', 'Testing POT file.');\n file_put_contents($this->localeDir . 'cake.pot', 'Testing POT file.');\n if (file_exists($deDir . 'default.po')) {\n unlink($deDir . 'default.po');\n }\n if (file_exists($deDir . 'default.po')) {\n unlink($deDir . 'cake.po');\n }\n\n $this->exec('i18n init --verbose', [\n 'de_DE',\n $this->localeDir,\n ]);\n\n $this->assertExitSuccess();\n $this->assertOutputContains('Generated 2 PO files');\n $this->assertFileExists($deDir . 'default.po');\n $this->assertFileExists($deDir . 'cake.po');\n }", "public function init() {\n\t\t$this->password = null;\n\t}", "protected function initMasterPrivateHDKeySeedFromMnemonic($mnemonic, $password='') {\n $bip39 = MnemonicFactory::bip39();\n $seedGenerator = new Bip39SeedGenerator($bip39);\n $this->master_priv_hd_key_seed = $seedGenerator->getSeed($mnemonic, $password);\n $this['mnemonic'] = $mnemonic;\n }", "public function fetchWallet()\n {\n $this->status = 'Loading';\n $apiUrl = SelectedNetwork::getUrl().'/wallets/'.$this->walletAddress;\n\n $response = Http::get($apiUrl);\n\n if($response->successful()) {\n\n $this->errorCode = null;\n $this->errorMessage = null;\n $this->status = 'Success';\n\n $responseData = $response->json();\n $this->formatted = $this->format($responseData['data']);\n\n } else {\n\n $error = $response->json();\n $this->errorMessage = $error['message'];\n $this->errorCode = $error['statusCode'];\n $this->status = 'Failure';\n\n $this->formatted = [];\n }\n }", "public function setInitCallback(InitCallback $oCallback)\n {\n $this->aConfigStruct['init'] = $oCallback;\n \n return $this;\n }", "public function destroy(Wallet $wallet)\n {\n //\n }", "private function initConnection() {\n $user = $this->account->user;\n $proxy_user = $this->account->proxy_user;\n $zone = $this->account->zone;\n\n $relVersion = RODS_REL_VERSION;\n $apiVersion = RODS_API_VERSION;\n $option = NULL;\n\n if (array_key_exists('client', $GLOBALS['PRODS_CONFIG']) &&\n array_key_exists('server_negotiation', $GLOBALS['PRODS_CONFIG']['client'])) {\n $neg = $GLOBALS['PRODS_CONFIG']['client']['server_negotiation'];\n debug(8, \"packConnectMsg added client server negotiation option $neg\");\n $option .= $neg;\n }\n\n $msgbody = new RP_StartupPack($user, $proxy_user, $zone, $relVersion, $apiVersion, $option);\n $conn_msg = new RODSMessage(\"RODS_CONNECT_T\", $msgbody);\n\n $resp = $this->sendMessage($conn_msg, \"Startup for user $user zone $zone (proxy: $proxy_user)\");\n $this->handleCSNEG($resp);\n\n if (!is_null($this->ssl) && !$this->ssl_enabled) {\n $this->enableSSL();\n }\n }", "public function destroy(Wallet $wallet) {\n //\n }" ]
[ "0.74053323", "0.5472244", "0.54033077", "0.53849083", "0.5342569", "0.53177965", "0.51893306", "0.51525193", "0.49054134", "0.47625923", "0.46986234", "0.46814907", "0.4676439", "0.46362892", "0.45944747", "0.4467981", "0.44540277", "0.4418104", "0.44176632", "0.43769795", "0.43183395", "0.42949852", "0.42932573", "0.42587835", "0.4256783", "0.42415398", "0.42320317", "0.4214442", "0.4207615", "0.4201279" ]
0.7102459
1
lncli: `unlock` UnlockWallet is used at startup of lnd to provide a password to unlock the wallet database.
public function UnlockWallet(\Lnrpc\UnlockWalletRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/lnrpc.WalletUnlocker/UnlockWallet', $argument, ['\Lnrpc\UnlockWalletResponse', 'decode'], $metadata, $options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function unlockWallet($body)\n {\n list($response) = $this->unlockWalletWithHttpInfo($body);\n return $response;\n }", "public function record_unlock( Secret $secret ) {\n\t\t$this->db->perform( 'UPDATE vault_secrets '\n\t\t . 'SET secret = NULL, mac = NULL '\n\t\t . 'WHERE vault_request_id = ?',\n\t\t [ $secret->reqid ] );\n\t}", "public function swarmUnlock($body)\n {\n $this->swarmUnlockWithHttpInfo($body);\n }", "public function unlock() {\n \n }", "public function unlock();", "public function stop_wallet()\n {\n return $this->_run('stop_wallet');\n }", "protected function getUnlockUrl()\n {\n return $this->getUrl('customer/locks/unlock', ['customer_id' => $this->getCustomerId()]);\n }", "public function unlock()\n {\n\n }", "public function unlock()\r\n {\r\n }", "static public function unlock()\n {\n if (!isset(aTools::$lockService))\n {\n /**\n * It is not an error to call with no locks\n */\n return;\n }\n aTools::$lockService->unlock();\n }", "public function stopWallet()\n {\n $body = ['method' => 'stop_wallet'];\n return $this->_request($body);\n }", "public function debitWallet()\n {\n\n set_time_limit(0);\n dispatch(new DebitWalletJob());\n }", "function unlock()\r\n {\r\n $this->query( \"UNLOCK TABLES\" );\r\n }", "public function walletlock() {\n\n $args = $this->args;\n $args[ \"method\" ] = __FUNCTION__;\n\n $res = $this->call($args);\n if ($res)\n return $res[ \"result\" ];\n }", "public function unlockTables();", "function sweepWallets(){}", "function _unlock($table, $lock_id, $lock = 'lock') {\n $table = $this->_table_name($table);\n $time = microtime();\n $q = \"update \n\t\t\t`$table` \n\t\t\tset \n\t\t\t`$table`.`{$lock}`=''\n\t\t\t,`$table`.`{$lock}_ttl`='$time'\n\t\t\twhere\n\t\t\t`$table`.`{$lock}`='$lock_id' \n\t\t\t\";\n $this->query($q);\n}", "public function unlocked();", "function try_to_unlock( $attempt, $dir ) {\n\t\n\ttry {\n\t\t$dbLogin = db_login();\n $db = new PDO( $dbLogin[ 'dsn' ], $dbLogin[ 'user' ], $dbLogin[ 'pass' ] );\n\t\t$db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );\n\t\t$stmt = $db->prepare( \"SELECT * FROM projects WHERE directory='\" . $dir . \"' LIMIT 1\" );\n\t\t$stmt->execute(); \n\t\t$row = $stmt->fetch();\n\t\t$password = $row['password'];\n\t\t$result = ( $attempt === $password ? 'yup' : 'nope' );\n\t\t\n\t\techo( $result );\n\t\t\n\t\tif ( $result === 'yup' ) {\n\t\t\t$sql = \"UPDATE projects SET islocked=? WHERE directory=?\";\n\t\t\t$query = $db->prepare( $sql );\n\t\t\t$query->execute( array( 0, $dir ) );\n\t\t}\n\t} catch ( PDOException $e ) {\n\t\tdie( 'Could not connect to the database:<br/>' . $e );\n\t}\n\t\n\tdie();\n}", "public abstract function unlockTables();", "public function lockUnspent(bool $unlock, array $transactions)\n {\n return $this->__call('lockunspent', [$unlock, $transactions]);\n }", "public function unlockDb()\n {\n try {\n $qry = $this->prepare(\"UPDATE system SET state = 0 WHERE id = 'dbLock'\");\n $qry->execute();\n $this->isLocked = false;\n } catch (\\PDOException $e) {\n echo $e->getMessage();\n }\n }", "function unlockDatabase() {\n @rmdir(LOCK_DIRECTORY);\n}", "protected function unlockWalletRequest($body)\n {\n // verify the required parameter 'body' is set\n if ($body === null || (is_array($body) && count($body) === 0)) {\n throw new \\InvalidArgumentException(\n 'Missing the required parameter $body when calling unlockWallet'\n );\n }\n\n $resourcePath = '/v1/unlockwallet';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n // body params\n $_tempBody = null;\n if (isset($body)) {\n $_tempBody = $body;\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']\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 }", "public function InitWallet(\\Lnrpc\\InitWalletRequest $argument,\n $metadata = [], $options = []) {\n return $this->_simpleRequest('/lnrpc.WalletUnlocker/InitWallet',\n $argument,\n ['\\Lnrpc\\InitWalletResponse', 'decode'],\n $metadata, $options);\n }", "public function unlockWalletAsync($body)\n {\n return $this->unlockWalletAsyncWithHttpInfo($body)\n ->then(\n function ($response) {\n return $response[0];\n }\n );\n }", "public function unlockWalletWithHttpInfo($body)\n {\n $returnType = '\\Lnd\\Rest\\Model\\LnrpcUnlockWalletResponse';\n $request = $this->unlockWalletRequest($body);\n\n try {\n $options = $this->createHttpClientOption();\n try {\n $response = $this->client->send($request, $options);\n } catch (RequestException $e) {\n throw new ApiException(\n \"[{$e->getCode()}] {$e->getMessage()}\",\n $e->getCode(),\n $e->getResponse() ? $e->getResponse()->getHeaders() : null,\n $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null\n );\n }\n\n $statusCode = $response->getStatusCode();\n\n if ($statusCode < 200 || $statusCode > 299) {\n throw new ApiException(\n sprintf(\n '[%d] Error connecting to the API (%s)',\n $statusCode,\n $request->getUri()\n ),\n $statusCode,\n $response->getHeaders(),\n $response->getBody()\n );\n }\n\n $responseBody = $response->getBody();\n if ($returnType === '\\SplFileObject') {\n $content = $responseBody; //stream goes to serializer\n } else {\n $content = $responseBody->getContents();\n if ($returnType !== 'string') {\n $content = json_decode($content);\n }\n }\n\n return [\n ObjectSerializer::deserialize($content, $returnType, []),\n $response->getStatusCode(),\n $response->getHeaders()\n ];\n\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = ObjectSerializer::deserialize(\n $e->getResponseBody(),\n '\\Lnd\\Rest\\Model\\LnrpcUnlockWalletResponse',\n $e->getResponseHeaders()\n );\n $e->setResponseObject($data);\n break;\n }\n throw $e;\n }\n }", "public function destroy(wallet $wallet)\n {\n //\n }", "public function releaseLock($lockName);", "public function isUnlockable() {\r\n\t\tif (($this->fmt($this->defaultRec(),'unlockPlanet')!=\"\") ||\r\n\t\t\t($this->fmt($this->defaultRec(),'upgradeShards')!=\"\")\r\n\t\t\t)\r\n\t\t\treturn TRUE;\r\n\t\telse\r\n\t\t\treturn FALSE;\r\n\t}" ]
[ "0.59568626", "0.59256315", "0.56458944", "0.54924506", "0.5463654", "0.5415295", "0.53996795", "0.53111917", "0.5309196", "0.52586854", "0.51974875", "0.5194875", "0.5132801", "0.5123523", "0.50761753", "0.5056504", "0.4994487", "0.49910358", "0.495127", "0.48816046", "0.48712003", "0.48686153", "0.4848398", "0.48470956", "0.48450762", "0.48313916", "0.48285264", "0.4817281", "0.4774718", "0.4760214" ]
0.67001
0
lncli: `changepassword` ChangePassword changes the password of the encrypted wallet. This will automatically unlock the wallet database if successful.
public function ChangePassword(\Lnrpc\ChangePasswordRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/lnrpc.WalletUnlocker/ChangePassword', $argument, ['\Lnrpc\ChangePasswordResponse', 'decode'], $metadata, $options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function changePassword()\n {\n if ($this->validate()) {\n /**\n * @var Accounts $account\n */\n $account = Accounts::findOne($this->account_id);\n\n $params = [\n 'login' => $account->foreign_account,\n 'password' => $this->password,\n 'investor' => $this->investor,\n ];\n $result = Yii::$app->{$account->accountType->driver}->сhangePass($params);\n if ($result) {\n return true;\n }\n }\n\n return false;\n }", "public function changePassword(): void\n\t{\n\t\t$response = \\App\\Api::getInstance()->call('Users/ResetPassword', [\n\t\t\t'token' => $this->request->getByType('token', \\App\\Purifier::ALNUM),\n\t\t\t'password' => $this->request->getRaw('password'),\n\t\t\t'deviceId' => $this->request->getByType('fingerprint', \\App\\Purifier::ALNUM_EXTENDED),\n\t\t], 'put');\n\t\tif ($response) {\n\t\t\t$_SESSION['login_errors'][] = \\App\\Language::translate('LBL_PASSWORD_CHANGED', 'Users');\n\t\t} else {\n\t\t\t$_SESSION['login_errors'][] = \\App\\Language::translate('LBL_FAILED_PASSWORD_CHANGED', 'Users');\n\t\t}\n\t}", "public function changepassword($user,$password);", "function changePassword(\\Token $token, string $oldPassword, string $newPassword);", "public function changePassword() {\n \n if ($this->http->method() != 'PUT') {\n $this->json->sendBack([\n 'success' => false,\n 'code' => 403,\n 'message' => 'This API only supports method PUT'\n ]);\n return;\n }\n\n $get_data = $this->http->data('GET');\n if ($this->user->isTokenValid($get_data['token'])) {\n $this->model->load('account/account');\n $put_data = $this->http->data('PUT');\n $response = $this->model->account->changePassword($put_data);\n \n $this->json->sendBack($response);\n return;\n }\n\n $this->json->sendBack([\n 'success' => false,\n 'code' => 401,\n 'message' => 'Token is invalid'\n ]);\n }", "public function change_wallet_password($old_password = '', $new_password = '')\n {\n $params = array(\n 'old_password' => $old_password,\n 'new_password' => $new_password\n );\n return $this->_run('change_wallet_password', $params);\n }", "public static function changePassword()\n {\n self::getTemplate('change_password');\n }", "public function changePassword($user, $currentPassword, $newPassword, $newPassword2);", "public function setPassword($password);", "public function setPassword($password);", "public function setPassword($password);", "public function setPassword($password);", "public function setPassword($password);", "public function setPassword($password);", "public function changePass($password) {\n\t\t$purifier = new CHtmlPurifier();\n\t\t$password = md5($purifier->purify($password));\n\n\t\t$user = Yii::app()->user->id;\n\t\t$command = Yii::app()->db->createCommand('UPDATE ' . $this->tableName() . ' SET password=:password WHERE username=:user');\n\t\t$command->bindParam(\":user\", $user, PDO::PARAM_STR);\n\t\t$command->bindParam(\":password\", $password, PDO::PARAM_STR);\n\t\t$command->execute();\n\t}", "public function changePassword()\n\t{\n\t\t$getData = $this->input->post();\n\t\t$tableData = $getData['table'];\n\t\t$arrayData = $getData['arrayData'];\n\t\t$arrayData['user_password'] = password_hash($arrayData['user_password'], PASSWORD_DEFAULT);\n\t\t$arrayWhere['user_id'] = $_SESSION['id'];\n\n\t\t$this->ieModel->update($tableData['tableName'], $arrayWhere, $arrayData);\n\t}", "public function changePassword() {\n\t\tif ($this->app->user->account == 'guest') {\n\t\t\tdie(js::alert('guest') . js::locate('back'));\n\t\t}\n\n\t\tif (!empty($_POST)) {\n\t\t\t$password1 = $_POST['password1'];\n\t\t\tif (!$password1) {\n\t\t\t\tdie(js::error('Please input password!'));\n\t\t\t}\n\t\t\t$isDefult = $this->dao->select('password')\n\t\t\t\t->from(TABLE_DEFAULTPASSWORD)\n\t\t\t\t->Where('password')->eq($this->post->password1)\n\t\t\t\t->fetchAll();\n\n\t\t\t//如果用户使用默认密码则跳到修改密码界面\n\t\t\tif ($isDefult) {\n\t\t\t\tdie(js::error('Password can not in default list!')\n\t\t\t\t\t. js::locate($this->createLink('my', 'changePassword', 'type=forbidden'), 'parent'));\n\t\t\t}\n\n\t\t\t$this->user->updatePassword($this->app->user->id);\n\t\t\tif (dao::isError())\n\t\t\t\tdie(js::error(dao::getError()));\n\t\t\tdie(js::locate($this->createLink('my', 'profile'), 'parent'));\n\t\t}\n\n\t\t$this->view->title\t\t = $this->lang->my->common . $this->lang->colon . $this->lang->my->changePassword;\n\t\t$this->view->position[]\t = $this->lang->my->changePassword;\n\t\t$this->view->user\t\t = $this->user->getById($this->app->user->id);\n\n\t\t$this->display();\n\t}", "function changePassword(){\r\n\t\t\t// $this->application_log->log('profile module','changing password');\r\n\t\t\tif (isset($_POST['ajax-sub'])) {\r\n\t\t\t\t$old = $_POST['oldpassword'];\r\n\t\t\t\t$new = $_POST['newpassword'];\r\n\t\t\t\t$confirm = $_POST['confirmPassword'];\r\n\t\t\t\tif ($new !==$confirm) {\r\n\t\t\t\t\t// $this->application_log->log('profile module','password does not match');\r\n\t\t\t\t\techo createJsonMessage('status',false,'message','new password does not match with the confirmaton','flagAction',false);exit;\r\n\t\t\t\t}\r\n\t\t\t\t//check that this user owns the password\r\n\t\t\t\tloadClass($this->load,'user');\r\n\t\t\t\t$this->user->user_ID = $this->webSessionManager->getCurrentUserProp('ID');\r\n\t\t\t\t$result = $this->user->changePassword($old,$new,$message);\r\n\t\t\t\t// $this->application_log->log('profile module',$message);\r\n\t\t\t\techo createJsonMessage('status',$result,'message',$message,'flagAction',true);\r\n\t\t\t}\r\n\t\t}", "function change_password() {\r\n $this->autoLayout = false;\r\n $this->autoRender = false;\r\n $response = true;\r\n $response_bck = \"\";\r\n $old_pass_status = true;\r\n if ($_GET['new_password'] != $_GET['repeat_new_password']) {\r\n $response_bck = 'Repeated Password Is Incorrect';\r\n $response = false;\r\n }\r\n $user = $this->Session->read('memberData');\r\n // print_r($user);\r\n $user_old = $this->User->checkUser($user['User']['user_email'], $_GET['old_password']);\r\n //user account username and pass is available but account may be locked\r\n if (!isset($user_old['User'])) {\r\n $response_bck.=\"\\nOld Password Is Incorrect\";\r\n $old_pass_status = false;\r\n }\r\n\r\n\r\n if ($old_pass_status == false || $response == false) {\r\n echo json_encode(array(\"status\" => \"false\", \"message\" => $response_bck));\r\n } else {\r\n $usern = new User();\r\n $usern->set(array(\r\n 'id' => $user['User']['id'],\r\n 'password' => hash('sha256', $_GET['new_password'])\r\n ));\r\n $usern->save();\r\n echo json_encode(array(\"status\" => \"true\"));\r\n }\r\n exit();\r\n }", "public function setPassword( $password );", "public function changePassword(){\n\t\t$this->layouts->setTitle('Edit Profile');\n\t\t$this->__loadJsAndCSS();\n\t\t$userData = $this->account_model->get_userdata();\n\t\t$this->layouts->setUserData($userData);\n\t\t$this->layouts->view('account/changePassword','','dashboard');\n\t}", "public function action_change_password()\n\t{\n\t\t$this->redirect_user(FALSE);\n\t\t\n\t\t$post = $this->request->post();\n\t\t$user = clone Auth::instance()->get_user();\n\t\t$manager = Manager::factory('User', $user);\n\t\t\n\t\t$manager->change_password($post);\n\t\t\n\t\t$this->view_container = $manager->get_views_result('container');\n\t\t$this->view_content = $manager->get_views_result('content');\n\t}", "public function testChangePassword()\n {\n // TODO: implement\n $this->markTestIncomplete('Not implemented');\n }", "public function actionChangePassword(){\n $model = \\employer\\models\\Employer::findOne(Yii::$app->user->identity->employer_id);\n \n if($model){\n $model->scenario = \"changePassword\";\n \n if ($model->load(Yii::$app->request->post()) && !Yii::$app->params['isDemo']) {\n $model->setPassword($model->employer_password_hash);\n if($model->save()){\n Yii::$app->getSession()->setFlash('success', Yii::t('student', 'New password was saved.'));\n return $this->redirect(['setting/index']);\n }\n }\n }\n \n return $this->render('changePassword', [\n 'model' => $model,\n ]);\n }", "public function updatePassword($databaseId, $databaseUserId, $newPassword);", "public function changePassword()\n {\n $passwordRegex = '/^[\\x20-\\x7F]{6,}$/';\n\n $json = file_get_contents('php://input');\n $obj = json_decode($json);\n\n $oldPassword = property_exists($obj, 'oldPassword') ? $obj->oldPassword : null;\n $newPassword = property_exists($obj, 'newPassword') ? $obj->newPassword : null;\n\n // check valid password and username\n // avoid sql injection\n if (preg_match($passwordRegex, $newPassword) == 1) {\n $uid = $_SESSION['uid'];\n\n // Encrypt password\n $oldPassword = hash('sha512', $oldPassword);\n $newPassword = hash('sha512', $newPassword);\n\n $success = AccountTable::changePassword($uid, $oldPassword, $newPassword);\n if ($success) {\n http_response_code(200);\n echo json_encode(array(\n 'message' => Constant::updated\n ));\n } else {\n http_response_code(400);\n echo json_encode(array(\n 'message' => 'Sai mật khẩu cũ'\n ));\n }\n } else {\n http_response_code(400);\n echo json_encode(array(\n 'message' => 'Mật khẩu mới không hợp lệ'\n ));\n }\n }", "public function changePassword() : void\n {\n // Set required $_POST fields\n $this->setReq('oldpassword', 'newpassword', 'repeatpassword');\n\n // Check if all required items are posted\n // Fail if not\n if (!$this->checkReq()) {\n\n $this->insertLog('Customers', 'Edit', 'Changing password ('.$_SESSION['webuser'].') through website failed, not all required fields are set');\n return;\n }\n\n if ($_POST['newpassword'] != $_POST['repeatpassword']) {\n\n // New password and repeated password did not match\n $this->insertLog('Customers', 'Edit', 'Changing password ('.$_SESSION['webuser'].') through website failed, new password did not match with the repeated password');\n return;\n }\n\n // Get customer data\n $customer = $this->getCustomer($_SESSION['webuser']);\n\n // Salt passwords\n $salt = $GLOBALS['customerSalt'];\n $oldPassword = hash('whirlpool', $salt.$_POST['oldpassword']);\n $newPassword = hash('whirlpool', $salt.$_POST['newpassword']);\n\n if ($oldPassword != $customer['password']) {\n\n // Old password not correct\n $this->insertLog('Customers', 'Edit', 'Changing password ('.$_SESSION['webuser'].') through website failed, old password was not correct');\n return;\n }\n\n if ($this->editCustomerPassword($newPassword, $_SESSION['webuser']) == 1) {\n\n // Succes\n $this->insertLog('Customers', 'Edit', 'Password of '.$customer['lastname'].', '.$customer['firstname'].' '.$customer['insertion'].' ('.$_SESSION['webuser'].') changed');\n \n } else {\n\n // Failed\n $this->insertLog('Customers', 'Edit', 'Changing password ('.$_SESSION['webuser'].') through website failed');\n }\n\n\n }", "public function changePassword(){\n //$user = $this->_ap_right_check(); -- FIXME Add right to ACO\n $user = $this->Aa->user_for_token($this);\n if(!$user){\n return;\n }\n $user_id = $user['id'];\n $success = false;\n if(isset($this->request->data['user_id'])){\n $entity = $this->{$this->main_model}->get($this->request->data['user_id']); \n $data = [\n 'password' => $this->request->data['password'],\n 'token' => ''\n ];\n $this->{$this->main_model}->patchEntity($entity, $data);\n $this->{$this->main_model}->save($entity);\n $success = true; \n }\n\n $this->set(array(\n 'success' => $success,\n '_serialize' => array('success',)\n ));\n }", "public function change_password() {\n if ($this->request->is('post')) {\n $this->request->data['User']['id'] = $this->Auth->user('id');\n if ($this->User->changePassword($this->request->data)) {\n $this->flashMessage(__d('users', 'Password changed.'), 'alert-info', '/');\n }\n }\n }", "public function changePassword(){\t\n\t\t/** else goto user's cronogram*/\n\t\t$nutricionista = Nutricionista::findOrFail(Input::get(\"nutricionista_id\"));\n\t\t$nutricionista->password = Hash::make(Input::get(\"senha\"));\n\t\t$nutricionista->password_confirmation = Hash::make(Input::get(\"senha_confirmation\"));\n\n\t\tif ($nutricionista->save()) {\n\t\t\treturn \"Saved\";\n\t\t}else{\n\t\t\treturn \"Not Saved\";\n\t\t}\n\t}" ]
[ "0.7213143", "0.7161422", "0.71526", "0.71112704", "0.7018637", "0.69990134", "0.69700617", "0.6940896", "0.68525815", "0.68525815", "0.68525815", "0.68525815", "0.68525815", "0.68525815", "0.6847156", "0.6835456", "0.68299574", "0.68104684", "0.67911786", "0.67567414", "0.67522126", "0.6716918", "0.6662854", "0.6658399", "0.66525483", "0.6635998", "0.6625104", "0.66245764", "0.66241324", "0.66171974" ]
0.7447192
0
Returns the normalized parameters of the request This will be all (except Oauth__signature) parameters, sorted first by key, and if duplicate keys, then by value. The returned string will be all the key=value pairs concated by &.
public function getSignableParameters() { // Grab all parameters $params = $this->_parameters; // Remove Oauth__signature if present if (isset($params['oauth_signature'])) { unset($params['oauth_signature']); } // Urlencode both keys and values $keys = Oauth_Util::urlencodeRfc3986(array_keys($params)); $values = Oauth_Util::urlencodeRfc3986(array_values($params)); $params = array_combine($keys, $values); // Sort by keys (natsort) uksort($params, 'strcmp'); // Generate key=value pairs $pairs = array(); foreach ($params as $key =>$value ) { if (is_array($value)) { /* If the value is an array, it's because there are multiple * with the same key, sort them, then add all the pairs */ natsort($value); foreach ($value as $v2) { $pairs[] = $key . '=' . $v2; } } else { $pairs[] = $key . '=' . $value; } } // Return the pairs, concated with & return implode('&', $pairs); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _getSignableParameters()\n {\n // Grab all parameters\n $params = $this->_params;\n\n // Remove oauth_signature if present\n if (isset($params['oauth_signature'])) {\n unset($params['oauth_signature']);\n }\n\n // Urlencode both keys and values\n $keys = array_map(array('Horde_Oauth_Utils', 'urlencodeRfc3986'), array_keys($params));\n $values = array_map(array('Horde_Oauth_Utils', 'urlencodeRfc3986'), array_values($params));\n $params = array_combine($keys, $values);\n\n // Sort by keys (natsort)\n uksort($params, 'strnatcmp');\n\n // Generate key=value pairs\n $pairs = array();\n foreach ($params as $key => $value) {\n if (is_array($value)) {\n // If the value is an array, it's because there are multiple values\n // with the same key. Sort them, then add all the pairs.\n natsort($value);\n foreach ($value as $v2) {\n $pairs[] = $key . '=' . $v2;\n }\n } else {\n $pairs[] = $key . '=' . $value;\n }\n }\n\n // Return the pairs, concatenated with &\n return implode('&', $pairs);\n }", "public function getSignableParameters()\n {\n // Grab all parameters\n $params = $this->getParameters();\n\n // Remove oauth_signature if present\n // Ref: Spec: 9.1.1 (\"The oauth_signature parameter MUST be excluded.\")\n if (isset($params['oauth_signature'])) {\n unset($params['oauth_signature']);\n }\n\n return Util::buildHttpQuery($params);\n }", "public function getSignableParameters()\n {\n // Grab all parameters\n $params = $this->parameters;\n\n // Remove oauth_signature if present\n // Ref: Spec: 9.1.1 (\"The oauth_signature parameter MUST be excluded.\")\n if (isset($params['oauth_signature'])) {\n unset($params['oauth_signature']);\n }\n\n return Zeed_OAuth_Util::buildHttpQuery($params);\n }", "protected function get_query_string() {\n\n\t\t$param = $this->request_parameter;\n\t\t$param[ 'oauth_signature' ] = $this->get_signature();\n\n\t\tforeach ( $param as $name => $value ) {\n\t\t\t$param[] =\n\t\t\t\t oAuth_urlencode( $name )\n\t\t\t\t. '='\n\t\t\t\t. oAuth_urlencode( $value )\n\t\t\t;\n\t\t\tunset( $param[ $name ] );\n\t\t}\n\n\t\treturn implode( '&', $param );\n\t}", "public function getRequestParameters()\n\t{\t\n\n\t\t$digest_type = $this->getDigestType();\n\t\t$digest = new Digest($digest_type, $this->requestbag->getRequestParams()['digest']);\n\t\t$query_params = array_merge($this->requestbag->getRequestParams(), ['digest' => (string) $digest]);\n\n\t\treturn http_build_query($query_params, '', '&');\n\t}", "public function params_str ()\n\t{\n\t\t$params = array();\n\t\t\n\t\tforeach ($this as $key => $val) {\n\t\t\tif (!(preg_match('/^x_/', $key)))\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\t$params[] = $key . '=' . urlencode($val);\n\t\t}\n\t\t\n\t\treturn implode('&', $params);\n\t}", "protected function buildQueryParams() {\n $params = array(\n 'Action' => $this->ActionName,\n 'ResponseGroup' => $this->ResponseGroupName,\n 'AWSAccessKeyId' => $this->accessKeyId,\n 'Timestamp' => self::getTimestamp(),\n 'Count' => $this->NumReturn,\n 'Start' => $this->StartNum,\n 'SignatureVersion' => self::$SigVersion,\n 'SignatureMethod' => self::$HashAlgorithm,\n 'Url' => $this->site\n );\n if (isset($this->countryCode)) {\n $params['CountryCode'] = $this->countryCode;\n }\n ksort($params);\n $keyvalue = array();\n foreach($params as $k => $v) {\n $keyvalue[] = $k . '=' . rawurlencode($v);\n }\n return implode('&',$keyvalue);\n }", "private function encodeParameters(): array\n {\n $encodedParams = [];\n\n foreach ($this->parameters as $key => $value) {\n if ('realm' !== $key) {\n $encodedParams[rawurlencode((string)$key)] = rawurlencode((string)$value);\n }\n }\n\n ksort($encodedParams);\n\n return $encodedParams;\n }", "protected function prepareParams()\n\t{\n\t\t$size = count($this->params);\n\t\t$params = '';\n\n\t\tif($size > 1)\n\t\t{\n\t\t\t$params = http_build_query($this->params, null, $this->argSeparator);\n\t\t}\n\t\telseif($size == 1)\n\t\t{\n\t\t\t$keys = array_keys($this->params);\n\n\t\t\tif($keys[0] === 0)\n\t\t\t\t$params = $this->params[0];\n\t\t\telse\n\t\t\t\t$params = http_build_query($this->params, null, $this->argSeparator);\n\t\t}\n\n\t\treturn $params;\n\t}", "private function getFormattedParameterNames() {\n $retval = array();\n foreach($_GET as $key => $value) {\n if(strpos($key, '_dot_') !== false) {\n $retval[str_replace('_dot_', '.', $key)] = $value;\n }else{\n $retval[$key] = $value;\n }\n }\n\n return $retval;\n }", "function buildParams()\n {\n $this->_aParams = array(\n rawurlencode('oauth_consumer_key') => rawurlencode($this->_consumerKey),\n rawurlencode('oauth_token') => rawurlencode($this->_oAuthToken),\n rawurlencode('oauth_nonce') => rawurlencode($this->_oAuthNonce),\n rawurlencode('oauth_signature_method') => rawurlencode($this->_oAuthSignatureMethod),\n rawurlencode('oauth_timestamp') => rawurlencode($this->_oAuthTimeStamp),\n rawurlencode('oauth_version') => rawurlencode($this->_oAuthVersion)\n );\n \n $this->_aParams[rawurlencode('oauth_signature')] = $this->getSignature();\n }", "public function buildHttpQuery()\n {\n $parts = array();\n foreach ($this->_params as $k => $v) {\n $parts[] = Horde_Oauth_Utils::urlencodeRfc3986($k) . '=' . Horde_Oauth_Utils::urlencodeRfc3986($v);\n }\n return implode('&', $parts);\n }", "public function getQueryParams()\n\t{\n\t\treturn http_build_query(\n\t\t\t$this->signParams($this->params)\n\t\t);\n\t}", "private function _format_params()\n\t{\n\t\t$param_names = $this->EE->input->post('param_names');\n\t\t$param_values = $this->EE->input->post('param_values');\n\n\t\t// Convert useless HTML array into useful PHP array\n\t\t$params = array();\n\t\tfor($i = 0; $i < count($param_names); $i++)\n\t\t{\n\t\t\tif(!empty($param_names[$i]))\n\t\t\t{\n\t\t\t\t$params[$param_names[$i]] = $param_values[$i];\n\t\t\t}\n\t\t}\n\n\t\treturn self::_build_query($params);\n\t}", "function parameter_string (array $params)\n{\n $temp_array = array();\n $parameter_string = '';\n\n while (current($params)) {\n $temp_array[rawurlencode(key($params))] = rawurlencode(current($params));\n next($params);\n }\n ksort($temp_array);\n foreach ($temp_array as $key => $value) {\n $parameter_string .= '&' . $key . '=' . $value;\n }\n\n return trim($parameter_string, '&');\n}", "function buildAuthHeader()\n {\n $authHeader = 'OAuth ';\n \n ksort($this->_aParams);\n \n $paramCount = 1;\n \n foreach($this->_aParams as $paramKey => $paramValue)\n {\n $authHeader .= rawurlencode($paramKey) . '=\"' . rawurlencode($paramValue) . '\"';\n \n if($paramCount != count($this->_aParams))\n $authHeader .= ', ';\n \n $paramCount++;\n }\n \n return $authHeader;\n }", "function buildParamString()\n {\n $paramString = '';\n \n foreach($this->_aRequestParams as $paramKey => $paramValue)\n {\n if($paramString != '')\n $paramString .= '&';\n \n $paramString .= $paramKey . '=' . $paramValue;\n }\n \n return $paramString;\n }", "public function getParams()\n\t{\n\t\t$params = array();\n\t\tforeach (get_object_vars($this) as $name => $value) {\n\t\t\t$value = trim($value);\n\n\t\t\tif (!empty($value) && is_scalar($value)) {\n\t\t\t\t$params[] = ucfirst($name) . \"=\" . $value;\n\t\t\t}\n\t\t}\n\t\treturn implode(\"&\", $params);\n\t}", "public function getParams()\n {\n $params = [\n 'openid.assoc_handle' => $this->request->get(self::OPENID_ASSOC_HANDLE),\n 'openid.signed' => $this->request->get(self::OPENID_SIGNED),\n 'openid.sig' => $this->request->get(self::OPENID_SIG),\n 'openid.ns' => self::OPENID_NS,\n 'openid.mode' => 'check_authentication',\n 'openid.error' => $this->request->get(self::OPENID_ERROR),\n ];\n\n $signedParams = explode(',', $this->request->get(self::OPENID_SIGNED));\n\n foreach ($signedParams as $item) {\n $value = $this->request->get('openid_'.str_replace('.', '_', $item));\n $params['openid.'.$item] = $value;\n }\n\n return $params;\n }", "private function prepare_params($params) {\r\n // do not encode multipart parameters, leave them alone\r\n if ($this->config['multipart']) {\r\n $this->request_params = $params;\r\n $params = array();\r\n }\r\n\r\n // signing parameters are request parameters + OAuth default parameters\r\n $this->signing_params = array_merge($this->get_defaults(), (array)$params);\r\n\r\n // Remove oauth_signature if present\r\n // Ref: Spec: 9.1.1 (\"The oauth_signature parameter MUST be excluded.\")\r\n if (isset($this->signing_params['oauth_signature'])) {\r\n unset($this->signing_params['oauth_signature']);\r\n }\r\n\r\n // Parameters are sorted by name, using lexicographical byte value ordering.\r\n // Ref: Spec: 9.1.1 (1)\r\n uksort($this->signing_params, 'strcmp');\r\n\r\n // encode. Also sort the signed parameters from the POST parameters\r\n foreach ($this->signing_params as $k => $v) {\r\n $k = $this->safe_encode($k);\r\n $v = $this->safe_encode($v);\r\n $_signing_params[$k] = $v;\r\n $kv[] = \"{$k}={$v}\";\r\n }\r\n\r\n // auth params = the default oauth params which are present in our collection of signing params\r\n $this->auth_params = array_intersect_key($this->get_defaults(), $_signing_params);\r\n if (isset($_signing_params['oauth_callback'])) {\r\n $this->auth_params['oauth_callback'] = $_signing_params['oauth_callback'];\r\n unset($_signing_params['oauth_callback']);\r\n }\r\n\r\n // request_params is already set if we're doing multipart, if not we need to set them now\r\n if ( ! $this->config['multipart'])\r\n $this->request_params = array_diff_key($_signing_params, $this->get_defaults());\r\n\r\n // create the parameter part of the base string\r\n $this->signing_params = implode('&', $kv);\r\n }", "protected function _sanitizeParams()\n\t{\n\t\t$sanitizeParams = [];\n\n\t\tif (!$this->post) {\n\t\t\t$sanitizeParams = $this->args;\n\t\t} else {\n\t\t\t$methodParams = $this->_get_func_args($this->method);\n\t\t\tforeach ($methodParams as $keyObject => $methodObject) {\n\t\t\t\tforeach ($this->post as $key => $value) {\n\t\t\t\t\tif ($methodObject->name == $key) {\n\t\t\t\t\t\t$sanitizeParams[$keyObject] = $value;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $sanitizeParams;\n\t}", "private function getRequestQueryParams() {\n $requestQueryParameters = [\n 'page' => $this->page,\n 'per_page' => $this->pageSize,\n 'order' => $this->sortingOrder,\n 'sort' => $this->sortingBy\n ];\n\n $filterQueryParameters = $this->getFilterQueryParams();\n\n return urldecode(http_build_query(array_merge($filterQueryParameters, $requestQueryParameters)));\n }", "private function _searchParamsFromString()\n\t{\n\t\t$this->_search_params = array();\n\n\t\tif (isset($this->_req->query->params) || isset($this->_req->post->params))\n\t\t{\n\t\t\t// Feed it\n\t\t\t$temp_params = $this->_req->query->params ?? $this->_req->post->params;\n\n\t\t\t// Decode and replace the uri safe characters we added\n\t\t\t$temp_params = base64_decode(str_replace(array('-', '_', '.'), array('+', '/', '='), $temp_params));\n\n\t\t\t$temp_params = explode('|\"|', $temp_params);\n\t\t\tforeach ($temp_params as $i => $data)\n\t\t\t{\n\t\t\t\tlist ($k, $v) = array_pad(explode('|\\'|', $data), 2, '');\n\t\t\t\t$this->_search_params[$k] = $v;\n\t\t\t}\n\t\t}\n\n\t\treturn $this->_search_params;\n\t}", "public function getSignatureBaseString()\n {\n $parts = array($this->getNormalizedHttpMethod(),$this->getNormalizedHttpUrl(),$this->getSignableParameters());\n\n $parts = Zeed_OAuth_Util::urlencode_rfc3986($parts);\n\n return implode('&', $parts);\n }", "function buildArguments($p) {\n // [email protected]: undefined warning otherwise\n $args = '';\n foreach ($p as $key => $value) {\n \n // Skip these\n if ($key == 'method' || $key == 'submit' || $key == 'MAX_FILE_SIZE') continue;\n \n $args .= $key.'='.urlencode($value).'&';\n \n } // end foreach\n \n // Chop off last ampersand\n return substr($args, 0, -1);\n }", "private function getOAuthParams()\n {\n //this needs to be stateful until the request is signed, then it gets unset\n if (! isset($this->oauth_params)) {\n $this->oauth_params = [\n 'oauth_consumer_key' => $this->getConsumerKey(),\n 'oauth_signature_method' => $this->getSignatureMethod(),\n 'oauth_timestamp' => $this->getTimestamp(),\n 'oauth_nonce' => $this->getNonce(),\n 'oauth_callback' => $this->getCallback(),\n 'oauth_version' => self::OAUTH_VERSION,\n ];\n\n if (null !== $token = $this->getToken()) {\n $this->oauth_params['oauth_token'] = $token;\n }\n if (null !== $verifier = $this->getVerifier()) {\n $this->oauth_params['oauth_verifier'] = $verifier;\n }\n }\n\n return $this->oauth_params;\n }", "public function getSignatureBaseString()\n {\n $parts = array(\n $this->getNormalizedHttpMethod(),\n $this->getNormalizedHttpUrl(),\n $this->getSignableParameters()\n );\n \n $parts = Oauth_Util::urlencodeRfc3986($parts);\n \n return implode('&', $parts);\n }", "protected function buildQueryString()\n {\n $queryString = [];\n $queryString['key'] = $this->getApiKey();\n if ($this->sortOrder) {\n $queryString['sort'] = $this->sortOrder;\n }\n return http_build_query($queryString);\n }", "public function getPaymentParams()\n\t{\n\t\t$url = parse_url(current_url(true));\n\t\tif(!isset($url['query']) || !$url['query'])\n\t\t\treturn '';\n\t\tparse_str($url['query'], $query);\n\t\t// loai bo cac param yeu cau\n\t\t$not_include_key =array('payment_id','token');\n\t\tif($query ){\n\t\t\tforeach($query as $k=>$v){\n\t\t\t\tif(in_array($k,$not_include_key)){\n\t\t\t\t\tunset($query[$k]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//pr($query);\n\t\treturn $query;\n\n\t}", "public function processVars()\n\t{\n\t\t// Initialise params array.\n\t\t$params = array();\n\n\t\t// Iterate over the reserved parameters and look for them in the POST variables.\n\t\tforeach (Request::getReservedParameters() as $k)\n\t\t{\n\t\t\t$value = $this->input->get->getString('oauth_' . $k, false);\n\n\t\t\tif ($value)\n\t\t\t{\n\t\t\t\t$params['OAUTH_' . strtoupper($k)] = trim($value);\n\t\t\t}\n\t\t}\n\n\t\t// Make sure that any found oauth_signature is not included.\n\t\t// TODO: I think this should this be oauth_signature instead of signature (and probably uppercase?)\n\t\tunset($params['signature']);\n\n\t\t// Ensure the parameters are in order by key.\n\t\tksort($params);\n\n\t\treturn $params;\n\t}" ]
[ "0.751982", "0.6725391", "0.6708116", "0.6605094", "0.6541971", "0.64491576", "0.6348146", "0.6303993", "0.6297416", "0.6277884", "0.6243042", "0.62268883", "0.62157154", "0.6203711", "0.6192063", "0.61490965", "0.61235875", "0.612037", "0.60569257", "0.5937287", "0.5909255", "0.58980906", "0.5895599", "0.58644325", "0.5847998", "0.5841111", "0.5815761", "0.5806074", "0.580203", "0.5768547" ]
0.7606235
0
builds the data one would send in a POST request TODO(morten.fangel): this function might be easily replaced with http_build_query() and corrections for rfc3986 compatibility.. but not sure
public function toPostdata() { $total = array(); foreach ($this->_parameters as $k => $v) { if (is_array($v)) { foreach ($v as $va) { $total[] = Oauth_Util::urlencodeRfc3986($k) . "[]=" . Oauth_Util::urlencodeRfc3986($va); } } else { $total[] = Oauth_Util::urlencodeRfc3986($k) . "=" . Oauth_Util::urlencodeRfc3986($v); } } $out = implode("&", $total); return $out; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function makeHTTPParameters()\n { \n $b =\"&\";\n $b.=\"id=\".$this->id.\"&\";\n $b.=\"gid=\".$this->gid.\"&\";\n $b.=\"name=\".$this->name.\"&\";\n $b.=\"artist_credit=\".$this->artist_credit.\"&\";\n $b.=\"length=\".$this->length.\"&\";\n $b.=\"comment=\".$this->comment.\"&\";\n $b.=\"edits_pending=\".$this->edits_pending.\"&\";\n $b.=\"last_updated=\".$this->last_updated.\"&\";\n $b.=\"video=\".$this->video.\"&\";\n return($b);\n\n\n }", "function http_build_query ($query_data, $numeric_prefix = null, $arg_separator = null, $enc_type = 'PHP_QUERY_RFC1738') {}", "function build_query( $data ) {\n\treturn _http_build_query( $data, null, '&', '', false );\n}", "public function makeHTTPParameters()\n { \n $b =\"&\";\n $b.=\"id=\".$this->id.\"&\";\n $b.=\"release=\".$this->release.\"&\";\n $b.=\"position=\".$this->position.\"&\";\n $b.=\"format=\".$this->format.\"&\";\n $b.=\"name=\".$this->name.\"&\";\n $b.=\"edits_pending=\".$this->edits_pending.\"&\";\n $b.=\"last_updated=\".$this->last_updated.\"&\";\n $b.=\"track_count=\".$this->track_count.\"&\";\n return($b);\n\n\n }", "static function gen_req($data) {\n return base64_encode(http_build_query($data));\n }", "public function buildData( $data ) {\n\t\tksort( $data );\n\t\t$params = array();\n\t\tforeach ( $data as $key => $value ) {\n\t\t\t$params[] = $key . '=' . $this->encode( $value );\n\t\t}\n\n\t\treturn implode( '&', $params );\n\t}", "function _postEncode($data){\n foreach($data as $key => $val){\n if($url) $url .= '&';\n $url .= urlencode($key).'='.urlencode($val);\n }\n return $url;\n }", "public function toPostdata()\n {\n return Util::buildHttpQuery($this->getParameters());\n }", "function _qsencode($data) {\n\t\tlog_message ( 'debug', \"Recaptcha::_qsencode(\\n\" . print_r ( $data, TRUE ) . \"\\n)\" );\n\t\t// http_build_query() = PHP 5 ONLY!\n\t\treturn http_build_query ( $data );\n\t}", "function http_build_query($formdata, $numeric_prefix = null, $arg_separator = null) {\n if ( is_object($formdata) ) {\n $formdata = get_object_vars($formdata);\n }\n\n// Check we have an array to work with\n if ( !is_array($formdata) || !empty($formdata) ) {\n return false;\n }\n\n// Argument seperator\n if ( empty($arg_separator) ) {\n $arg_separator = ini_get('arg_separator.output');\n\n if ( empty($arg_separator) ) {\n $separator = '&';\n }\n }\n\n// Start building the query\n $tmp = array();\n\n foreach ( $formdata as $key => $val ) {\n if ( is_null($val) ) {\n continue;\n }\n\n if ( is_integer($key) && ( $numeric_prefix != null ) ) {\n $key = $numeric_prefix . $key;\n }\n\n if ( is_scalar($val) ) {\n array_push($tmp, urlencode($key) . '=' . urlencode($val));\n continue;\n }\n\n// If the value is an array, recursively parse it\n if ( is_array($val) || is_object($val) ) {\n array_push($tmp, http_build_query_helper($val, urlencode($key), $arg_separator));\n continue;\n }\n\n// The value is a resource\n return null;\n }\n\n return implode($separator, $tmp);\n }", "function post($data = \"\",$options = array()){\n\t\tif(is_array($data)){\n\t\t\t$d = array();\n\t\t\tforeach($data as $k => $v){\n\t\t\t\t$d[] = urlencode($k).\"=\".urlencode((string) $v);\n\t\t\t}\n\t\t\t$data = join(\"&\",$d);\n\t\t}\n\n\t\tif(!is_a($data,\"StringBuffer\")){\n\t\t\t$data = new StringBuffer($data);\n\t\t}\n\n\t\t$options = array_merge(array(\n\t\t\t\"content_type\" => \"application/x-www-form-urlencoded\",\n\t\t\t\"additional_headers\" => array(),\n\t\t),$options);\n\n\t\t$this->_RequestMethod = \"POST\";\n\t\t$this->_PostData->addStringBuffer($data);\n\t\t$this->_AdditionalHeaders = $options[\"additional_headers\"];\n\t\t$this->_AdditionalHeaders[] = \"Content-Type: $options[content_type]\";\n\n\t\treturn $this->fetchContent();\n\t}", "protected function _buildRequest($method,$url,$data) {\n\t\tif ( is_object($data) OR is_array($data) )\n\t\t\t$data = json_encode($data);\n\t\t$req = \"$method $url HTTP/1.0\\r\\nHost: {$this->hostname}\\r\\n\";\n\t $req.= \"Accept: application/json,text/html,text/plain,*/*\\r\\n\";\n if ( $method == 'COPY') {\n $req .= 'Destination: '.$data.\"\\r\\n\\r\\n\";\n } elseif ($data) {\n\t\t\t$req .= 'Content-Length: '.strlen($data).\"\\r\\n\";\n\t\t\t$req .= 'Content-Type: application/json'.\"\\r\\n\\r\\n\";\n\t\t\t$req .= $data.\"\\r\\n\";\n\t\t} else {\n\t\t\t$req .= \"\\r\\n\";\n\t\t}\n\t\treturn $req;\n\t}", "protected function _buildRequestUri()\n {\n $requestParameters = array();\n\n // add entity\n if (!empty($this->_options['entity'])) {\n $tmp = array_keys($this->_options['entity']);\n $key = array_pop($tmp);\n $requestParameters[] = 'entity=' . $this->_options['entity'][$key];\n }\n\n // add media type\n if (!empty($this->_options['mediaType'])) {\n $requestParameters[] = 'media=' . $this->_options['mediaType'];\n }\n\n // add attribute\n if (!empty($this->_options['attribute'])) {\n $requestParameters[] = 'attribute=' . $this->_options['attribute'];\n }\n\n // add language\n if (!empty($this->_options['language'])) {\n $requestParameters[] = 'lang=' . $this->_options['language'];\n }\n\n // add limit\n if ($this->_options['limit'] <> 100) {\n $requestParameters[] = 'limit=' . $this->_options['limit'];\n }\n\n // add country\n if ($this->_options['country'] != 'us') {\n $requestParameters[] = 'country=' . $this->_options['country'];\n }\n\n // add callback\n if (!empty($this->_options['callback'])) {\n $requestParameters[] = 'callback=' . $this->_options['callback'];\n }\n\n // add version\n if ($this->_options['version'] <> 2) {\n $requestParameters[] = 'version=' . $this->_options['version'];\n }\n\n // add explicity\n if ($this->_options['explicit'] != 'yes') {\n $requestParameters[] = 'explicit=' . $this->_options['explicit'];\n }\n\n return implode('&', $requestParameters);\n }", "function &asPostString(&$theData, $theName = NULL)\n\t {\n\t\t$thePostString = '' ;\n\t\t$thePrefix = $theName ;\n\n\t\tif (is_array($theData))\n\t\t{\n\t\t foreach ($theData as $theKey => $theValue)\n\t\t {\n\t\t\tif ($thePrefix === NULL)\n\t\t{\n\t\t\t $thePostString .= '&' . curl::asPostString($theValue, $theKey) ;\n\t\t}\n\t\telse\n\t\t\t{\n\t\t\t $thePostString .= '&' . curl::asPostString($theValue, $thePrefix . '[' . $theKey . ']') ;\n\t\t\t}\n\t\t }\n\t\t}\n\t\telse\n\t\t{\n\t\t $thePostString .= '&' . urlencode((string)$thePrefix) . '=' . urlencode($theData) ;\n\t\t}\n\n\t\t$xxx =& substr($thePostString, 1) ;\n\n\t\treturn $xxx ;\n\t }", "abstract public function buildRequest();", "private function _captchafa_qsencode($data)\n\t{\n\t\t$req = \"\";\n\t\tforeach ($data as $key => $value)\n\t\t{\n\t\t\t$req .= $key . '=' . urlencode(stripslashes($value)) . '&';\n\t\t}\n\n\t\t// Cut the last '&'\n\t\t$req = rtrim($req, '&');\n\t\treturn $req;\n\t}", "public function build_post_body($data = NULL)\n {\n $data = ($data !== NULL) ? $data : $this->_request_body;\n \n if ( ! is_array($data)) \n {\n throw new InvalidArgumentException('Invalid data input for postBody. Array expected');\n }\n \n $data = http_build_query($data, '', '&');\n $this->_request_body = $data;\n }", "public function toPostdata()\n {\n return Zeed_OAuth_Util::buildHttpQuery($this->parameters);\n }", "protected function _buildPostData() {\n\t\t$req = 'cmd=_notify-validate';\n\t\t\t\n\t\t//reading raw POST data from input stream. reading pot data from $_POST may cause serialization issues since POST data may contain arrays\n\t\t$raw_post_data = file_get_contents('php://input');\n\t\tif ($raw_post_data) {\n\t\t\t$raw_post_array = explode('&', $raw_post_data);\n\t\t\t$myPost = array();\n\t\t\tforeach ($raw_post_array as $keyval) {\n\t\t\t\t$keyval = explode ('=', $keyval);\n\t\t\t\tif (count($keyval) == 2) {\n\t\t\t\t\t$myPost[$keyval[0]] = urldecode($keyval[1]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t$get_magic_quotes_exists \t= function_exists('get_magic_quotes_gpc');\n\t\t\t$get_magic_quotes_gpc \t\t= get_magic_quotes_gpc();\n\t\t\t\n\t\t\tforeach ($myPost as $key => $value) {\n\t\t\t\tif ($key == 'limit' || $key == 'limitstart' || $key == 'option') continue;\n\t\t\t\t\n\t\t\t\tif ($get_magic_quotes_exists && $get_magic_quotes_gpc) {\n\t\t\t\t\t$value = urlencode(stripslashes($value)); \n\t\t\t\t} else {\n\t\t\t\t\t$value = urlencode($value);\n\t\t\t\t}\n\t\t\t\t$req .= \"&$key=$value\";\n\t\t\t}\n\t\t} else {\n\t\t\t// read the post from PayPal system\n\t\t\t$post = $_POST;\n\t\t\tforeach ($post as $key => $value) {\n\t\t\t\tif ($key == 'limit' || $key == 'limitstart' || $key == 'option') continue;\n\t\t\t\t\n\t\t\t\t$value = urlencode($value);\n\t\t\t\t$req .= \"&$key=$value\";\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $req;\n\t}", "function _qsencode ($data)\n\t{\n $req = \"\";\n foreach ( $data as $key => $value ) {\n $req .= $key . '=' . urlencode( stripslashes($value) ) . '&';\n }\n\n // Cut the last '&'\n $req = substr($req, 0, strlen($req)-1);\n return $req;\n\t}", "protected function postfields($data) {\n\n if(is_object($data) || is_array($data)) {\n return http_build_query($data);\n } else {\n return $data;\n }\n\n }", "private function curl_data($query_data) {\n\t\tksort($query_data);\n\t\t$this->debug($query_data);\n\t\t$query_string = http_build_query($query_data);\n\t\tcurl_setopt($this->curl, CURLOPT_POSTFIELDS, $query_string);\n\t\treturn $query_string;\n\t}", "function http_build_query($data, $prefix=null, $sep=null, $key='', $urlencode=true) {\n\t\t$ret = array();\n\n foreach ( (array) $data as $k => $v ) {\n if ( $urlencode)\n $k = urlencode($k);\n if ( is_int($k) && $prefix != null )\n $k = $prefix.$k;\n if ( !empty($key) )\n $k = $key . '%5B' . $k . '%5D';\n if ( $v === NULL )\n continue;\n elseif ( $v === FALSE )\n $v = '0';\n\n if ( is_array($v) || is_object($v) )\n array_push($ret, http_build_query($v, '', $sep, $k, $urlencode));\n elseif ( $urlencode )\n array_push($ret, $k.'='.urlencode($v));\n else\n array_push($ret, $k.'='.$v);\n }\n\n if ( NULL === $sep )\n $sep = ini_get('arg_separator.output');\n\n return implode($sep, $ret);\n\t}", "function build_twilio_data_string() {\n\n // Our data string starts with the full URL\n\n // Note, that if your URL uses an implied \"index\" document (index.php), then apache\n // often adds a slash to the SCRIPT_URI while Twilio's original request will not have a slash\n // Example: if Twilio requested http://mycompany.com/twilio\n // and that url is handled by an index.php script\n // Apache/PHP will report the URI as being: http://mycompany.com/twilio/ \n // But the hash should be calculated without the trailing slash\n\n // Also note, if you're using URL rewriting, then you should check to see that\n // PHP is reporting your SCRIPT_URI and QUERY_STRING correctly. \n\n $string_to_sign = $_SERVER['SCRIPT_URI'];\n\n // if there's a query string, add it here along with the question mark\n if(strlen($_SERVER['QUERY_STRING']))\n $string_to_sign .= \"?{$_SERVER['QUERY_STRING']}\";\n\n // Now, if it's a POST, then we need to add the POST parameters\n // alphabetized to the data string\n if(isset($_POST)) {\n\n // copy the post data\n $data = $_POST;\n\n // sort the array by keys\n ksort($data);\n\n // append them to the data string in order with no delimiters\n foreach($data AS $key=>$value)\n $string_to_sign .= \"$key$value\";\n\n }\n\n return $string_to_sign;\n\n }", "function _http_build_query($data, $prefix=null, $sep=null, $key='', $urlencode=true) {\n\t$ret = array();\n\n\tforeach ( (array) $data as $k => $v ) {\n\t\tif ( $urlencode)\n\t\t\t$k = urlencode($k);\n\t\tif ( is_int($k) && $prefix != null )\n\t\t\t$k = $prefix.$k;\n\t\tif ( !empty($key) )\n\t\t\t$k = $key . '%5B' . $k . '%5D';\n\t\tif ( $v === null )\n\t\t\tcontinue;\n\t\telseif ( $v === FALSE )\n\t\t\t$v = '0';\n\n\t\tif ( is_array($v) || is_object($v) )\n\t\t\tarray_push($ret,_http_build_query($v, '', $sep, $k, $urlencode));\n\t\telseif ( $urlencode )\n\t\t\tarray_push($ret, $k.'='.urlencode($v));\n\t\telse\n\t\t\tarray_push($ret, $k.'='.$v);\n\t}\n\n\tif ( null === $sep )\n\t\t$sep = ini_get('arg_separator.output');\n\n\treturn implode($sep, $ret);\n}", "public function buildPostBody($data = null)\n\t{\n\t\t$data = ($data !== null) ? $data : $this->requestBody;\n\n\t\tif (!is_array($data)) {\n\t\t\tthrow new InvalidArgumentException(\"Invalid data input for postBody. Array expected.\");\n\t\t}\n\n\t\t$data = http_build_query($data, '', '&');\n\t\t$this->requestBody = $data;\n\t}", "function buildParams()\n {\n $this->_aParams = array(\n rawurlencode('oauth_consumer_key') => rawurlencode($this->_consumerKey),\n rawurlencode('oauth_token') => rawurlencode($this->_oAuthToken),\n rawurlencode('oauth_nonce') => rawurlencode($this->_oAuthNonce),\n rawurlencode('oauth_signature_method') => rawurlencode($this->_oAuthSignatureMethod),\n rawurlencode('oauth_timestamp') => rawurlencode($this->_oAuthTimeStamp),\n rawurlencode('oauth_version') => rawurlencode($this->_oAuthVersion)\n );\n \n $this->_aParams[rawurlencode('oauth_signature')] = $this->getSignature();\n }", "protected function buildParams($params)\n {\n return 'data=' . urlencode(base64_encode(json_encode($params)));\n }", "function oss_http_build_query($formdata, $numeric_prefix = null) {\n if (is_object($formdata)) {\n $formdata = get_object_vars($formdata);\n }\n\n // Check we have an array to work with\n if (!is_array($formdata)) {\n trigger_error('http_build_query() Parameter 1 expected to be Array or Object. Incorrect value given.', E_USER_WARNING);\n return false;\n }\n\n // If the array is empty, return null\n if (empty($formdata)) {\n return;\n }\n\n // Argument seperator\n $separator = \"&\";\n\n // Start building the query\n $tmp = array ();\n foreach ($formdata as $key => $val) {\n if (is_integer($key) && $numeric_prefix != null) {\n $key = $numeric_prefix . $key;\n }\n\n if (is_scalar($val)) {\n array_push($tmp, urlencode($key).'='.urlencode($val));\n continue;\n }\n\n // If the value is an array, recursively parse it\n if (is_array($val)) {\n array_push($tmp, __http_build_query($val, urlencode($key)));\n continue;\n }\n }\n\n return implode($separator, $tmp);\n}", "public function buildRequest()\n {\n $requestUrl = self::ENDPOINT_URL . 'token=' . $this->token .\n '&street_number=' . rawurlencode($this->street_number) .\n '&street_name=' . rawurlencode($this->street_name) .\n '&street_suffix=' . rawurlencode($this->street_suffix) .\n '&city=' . rawurlencode($this->city) .\n '&state=' . rawurlencode($this->state);\n\n if ($this->unit_number) {\n $requestUrl .= '&unit_number=' . rawurlencode($this->unit_number);\n }\n\n if ($this->street_direction) {\n $requestUrl .= '&street_direction=' . rawurlencode($this->street_direction);\n }\n\n if ($this->zipcode) {\n $requestUrl .= '&zipcode=' . rawurlencode($this->zipcode);\n }\n\n if ($this->format) {\n $requestUrl .= '&format=' . rawurlencode($this->format);\n }\n\n return $requestUrl;\n }" ]
[ "0.6967939", "0.696309", "0.69309235", "0.68769526", "0.68128335", "0.66949606", "0.6578338", "0.6573187", "0.6567116", "0.6528311", "0.6514511", "0.64654297", "0.64515436", "0.6406994", "0.6384761", "0.6382447", "0.63799906", "0.6365943", "0.63512087", "0.634592", "0.6342481", "0.6289049", "0.6287222", "0.62745863", "0.6250971", "0.62290496", "0.6226729", "0.6218375", "0.620421", "0.6195121" ]
0.721191
0
Returns OAuth access token, using an OpenID Connect scope This method is used using the OAuth Client Credentials Flow for machinetomachine applications. Therefore the grant type must be Authorization::GRANT_CLIENT_CREDENTIALS. You need to specify the client identifier and client secret and may optionally specify a scope. This method will check if an access token already exists (stored in an Authorization record), and if it doesn't, requests one via OAuth. The authorization id which leads to the Authorization record is deterministic and derived from the service name, client id, client secret and scope.
public function getAccessToken(string $serviceName, string $clientId, string $clientSecret, string $scope, array $additionalParameters = []): AccessToken { $scope = trim(implode(' ', array_unique(array_merge(explode(' ', $scope), ['openid'])))); $accessToken = null; $authorizationId = Authorization::generateAuthorizationIdForClientCredentialsGrant($serviceName, $clientId, $clientSecret, $scope, $additionalParameters); $authorization = $this->getAuthorization($authorizationId); if ($authorization !== null) { $accessToken = $authorization->getAccessToken(); if ($accessToken === null) { $this->logger->warning(sprintf('OpenID Connect Client: Authorization %s for service "%s", clientId "%s" contained no token', $authorizationId, $serviceName, $clientId), LogEnvironment::fromMethodName(__METHOD__)); } elseif ($accessToken->hasExpired()) { $this->logger->info(sprintf('OpenID Connect Client: Access token contained in authorization %s for service "%s", clientId "%s" has expired', $authorizationId, $serviceName, $clientId), LogEnvironment::fromMethodName(__METHOD__)); } } if ($accessToken === null || $accessToken->hasExpired()) { $this->logger->info(sprintf('OpenID Connect Client: Requesting new access token for service %s using client id %s %s', $serviceName, $clientId, ($scope ? 'requesting scope "' . $scope . '"' : 'requesting no scope')), LogEnvironment::fromMethodName(__METHOD__)); $this->oAuthClient->requestAccessToken($serviceName, $clientId, $clientSecret, $scope, $additionalParameters); $authorization = $this->getAuthorization($authorizationId); if ($authorization === null) { throw new ConnectionException(sprintf('OpenID Connect Client: Failed retrieving access token for service "%s", clientId "%s": No authorization found for id %s', $serviceName, $clientId, $authorizationId)); } $accessToken = $authorization->getAccessToken(); if ($accessToken === null) { throw new AuthenticationException(sprintf('OpenID Connect Client: Failed retrieving access token for service "%s", clientId "%s": Authorization %s contains no token', $serviceName, $clientId, $authorizationId)); } } else { $expiresInSeconds = $accessToken->getExpires() - time(); $this->logger->info(sprintf('OpenID Connect Client: Using existing access token for service %s using client id %s %s. Remaining lifetime: %d seconds', $serviceName, $clientId, ($scope ? 'with scope "' . $scope . '"' : 'without a scope'), $expiresInSeconds), LogEnvironment::fromMethodName(__METHOD__)); } return $accessToken; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function grantAccessToken() {\n $filters = array(\n \"grant_type\" => array(\"filter\" => FILTER_VALIDATE_REGEXP, \"options\" => array(\"regexp\" => OAUTH2_GRANT_TYPE_REGEXP), \"flags\" => FILTER_REQUIRE_SCALAR),\n \"scope\" => array(\"flags\" => FILTER_REQUIRE_SCALAR),\n \"code\" => array(\"flags\" => FILTER_REQUIRE_SCALAR),\n \"redirect_uri\" => array(\"filter\" => FILTER_SANITIZE_URL),\n \"username\" => array(\"flags\" => FILTER_REQUIRE_SCALAR),\n \"password\" => array(\"flags\" => FILTER_REQUIRE_SCALAR),\n \"assertion_type\" => array(\"flags\" => FILTER_REQUIRE_SCALAR),\n \"assertion\" => array(\"flags\" => FILTER_REQUIRE_SCALAR),\n \"refresh_token\" => array(\"flags\" => FILTER_REQUIRE_SCALAR),\n );\n\n $input = filter_input_array(INPUT_POST, $filters);\n\n // Grant Type must be specified.\n if (!$input[\"grant_type\"])\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_INVALID_REQUEST, 'Invalid grant_type parameter or parameter missing');\n\n // Make sure we've implemented the requested grant type\n if (!in_array($input[\"grant_type\"], $this->getSupportedGrantTypes()))\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_UNSUPPORTED_GRANT_TYPE);\n\n // Authorize the client\n $client = $this->getClientCredentials();\n\n if ($this->checkClientCredentials($client[0], $client[1]) === FALSE)\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_INVALID_CLIENT);\n\n if (!$this->checkRestrictedGrantType($client[0], $input[\"grant_type\"]))\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_UNAUTHORIZED_CLIENT);\n\n // Do the granting\n switch ($input[\"grant_type\"]) {\n case OAUTH2_GRANT_TYPE_AUTH_CODE:\n if (!$input[\"code\"] || !$input[\"redirect_uri\"])\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_INVALID_REQUEST);\n\n $stored = $this->getAuthCode($input[\"code\"]);\n\n // Ensure that the input uri starts with the stored uri\n if ($stored === NULL || (strcasecmp(substr($input[\"redirect_uri\"], 0, strlen($stored[\"redirect_uri\"])), $stored[\"redirect_uri\"]) !== 0) || $client[0] != $stored[\"client_id\"])\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_INVALID_GRANT);\n\n if ($stored[\"expires\"] < time())\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_EXPIRED_TOKEN);\n\n break;\n case OAUTH2_GRANT_TYPE_USER_CREDENTIALS:\n if (!$input[\"username\"] || !$input[\"password\"])\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_INVALID_REQUEST, 'Missing parameters. \"username\" and \"password\" required');\n\n $stored = $this->checkUserCredentials($client[0], $input[\"username\"], $input[\"password\"]);\n\n if ($stored === FALSE)\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_INVALID_GRANT);\n\n break;\n case OAUTH2_GRANT_TYPE_ASSERTION:\n if (!$input[\"assertion_type\"] || !$input[\"assertion\"])\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_INVALID_REQUEST);\n\n $stored = $this->checkAssertion($client[0], $input[\"assertion_type\"], $input[\"assertion\"]);\n\n if ($stored === FALSE)\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_INVALID_GRANT);\n\n break;\n case OAUTH2_GRANT_TYPE_REFRESH_TOKEN:\n if (!$input[\"refresh_token\"])\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_INVALID_REQUEST, 'No \"refresh_token\" parameter found');\n\n $stored = $this->getRefreshToken($input[\"refresh_token\"]);\n\n if ($stored === NULL || $client[0] != $stored[\"client_id\"])\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_INVALID_GRANT);\n\n if ($stored[\"expires\"] < time())\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_EXPIRED_TOKEN);\n\n // store the refresh token locally so we can delete it when a new refresh token is generated\n $this->setVariable('_old_refresh_token', $stored[\"token\"]);\n\n break;\n case OAUTH2_GRANT_TYPE_NONE:\n $stored = $this->checkNoneAccess($client[0]);\n\n if ($stored === FALSE)\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_INVALID_REQUEST);\n }\n\n // Check scope, if provided\n if ($input[\"scope\"] && (!is_array($stored) || !isset($stored[\"scope\"]) || !$this->checkScope($input[\"scope\"], $stored[\"scope\"])))\n $this->errorJsonResponse(OAUTH2_HTTP_BAD_REQUEST, OAUTH2_ERROR_INVALID_SCOPE);\n\n if (!$input[\"scope\"])\n $input[\"scope\"] = NULL;\n\n $token = $this->createAccessToken($client[0], $input[\"scope\"]);\n\n $this->sendJsonHeaders();\n echo json_encode($token);\n }", "public function grantNewAccessToken()\n {\n if (empty($_GET['code'])\n || empty($_GET['state'])\n || $_GET['state'] !== $this->apiConfiguration->ourSecretState()\n ) {\n throw new ThirdPartyConnectionFailedException('Invalid request!');\n }\n\n $headers = array(\n 'Authorization' => sprintf(\n 'Basic %s',\n base64_encode(\n sprintf('%s:%s', $this->apiConfiguration->clientId(), $this->apiConfiguration->clientSecret())\n )\n ),\n );\n\n $accessTokenJsonInfo = $this->curlClient->postUrlEncoded(\n sprintf(\"%s/oauth/token\", self::API_BASE),\n sprintf(\n 'client_id=%s&client_secret=%s&grant_type=authorization_code&redirect_uri=%s&code=%s',\n $this->apiConfiguration->clientId(),\n $this->apiConfiguration->clientSecret(),\n urlencode($this->apiConfiguration->redirectUrl()),\n $_GET['code']\n ),\n $headers\n );\n\n $accessTokenInfo = json_decode($accessTokenJsonInfo, true);\n if (empty($accessTokenInfo['access_token'])) {\n throw new ThirdPartyConnectionFailedException(\n 'An error occurred while getting the access.'\n );\n }\n\n $accessToken = new CommonAccessToken($accessTokenInfo['access_token'], ThirdParty::ZOOM);\n if (!empty($accessTokenInfo['refresh_token'])) {\n $accessToken->setRefreshToken($accessTokenInfo['refresh_token']);\n }\n\n /*\n $refreshTokenJsonInfo = $this->curlClient->post(\n sprintf(\"%s/oauth/token?grant_type=refresh_token&refresh_token=%s\", self::API_BASE, $accessTokenInfo['refresh_token']),\n array(),\n $headers\n );\n\n // if refresh token found, return that or return the access token\n $refreshTokenInfo = json_decode($refreshTokenJsonInfo, true);\n if (!empty($refreshTokenInfo['access_token']) && !empty($refreshTokenInfo['refresh_token'])) {\n $accessToken = new CommonAccessToken($refreshTokenInfo['access_token'], ThirdParty::ZOOM);\n $accessToken->setRefreshToken($refreshTokenInfo['refresh_token']);\n }//*/\n\n return $accessToken;\n }", "public function getAccessToken()\n\t{\n\t\tif ($this->access_token !== null) {\n\t\t\treturn $this->access_token;\n\t\t}\n\n\t\t$request = $this->getOauthHttpClient()->post()->addPostFields(array(\n\t\t\t'grant_type' => 'client_credentials',\n\t\t\t'scope' => self::OAUTH_SCOPE_URL,\n\t\t\t'client_id' => $this->client_id,\n\t\t\t'client_secret' => $this->client_secret,\n\t\t));\n\n\t\t$response = $request->send();\n\t\t$data = $response->json();\n\n\t\t$this->access_token = $data['access_token'];\n\t\treturn $this->access_token;\n\t}", "public function getOauthAccessToken();", "public function createAccessToken($oauthToken, IOAuth2Client $client, $data, $expires, $scope = null)\n\t{\n\t\t$token = new AccessToken();\n\t\t$token->client_id = $client->id;\n\t\t$token->token = $oauthToken;\n\t\t$token->expires_at = $expires;\n\t\t$token->scope = $scope;\n\n\t\tif ( $data instanceof Authenticatable) {\n\t\t\t$token->user_id = $data->getAuthIdentifier();\n\t\t}\n\n\t\t$token->save();\n\n\t\treturn $token;\n\t}", "protected function generateClientAccessToken()\n {\n $server = $this->getAuthorisationServer();\n // Enable the client credentials grant on the server\n $server->enableGrantType(\n new ClientCredentialsGrant(),\n new \\DateInterval('PT1H') // access tokens will expire after 1 hour\n );\n\n $client = $this->objFromFixture(Client::class, 'webapp');\n\n $request = $this->getClientRequest($client);\n\n $response = new Response();\n return $server->respondToAccessTokenRequest($request, $response);\n }", "protected function generateToken() {\n\t\t$server = $this->getServer();\n\n\t\t// Handle a request for an OAuth2.0 Access Token and send the response to the client\n\t\treturn $server->handleTokenRequest(Request::createFromGlobals())->send();\n\t}", "public function getAccessToken($grant, array $options = []);", "public function authen ()\n {\n $config = $this->getApiConfig();\n $this->token = new OAuthTokenCredential(\n $config['clientId'],\n $config['secret'],\n $config['sdk']\n );\n\n return $this->token;\n }", "function getAccessToken($google_code) {\n // Make sure these are clear if we fail\n $this->authentication_object = FALSE;\n $this->access_token = FALSE;\n\n // From: https://github.com/PenguinProtocols/Basic-OpenID-Connect-Google\n // This approach gets us the openid_id from the former realm\n\n $token_url = \"https://www.googleapis.com/oauth2/v3/token\";\n $post = \"code={$google_code}&client_id={$this->client_id}&client_secret={$this->client_secret}\"\n . \"&redirect_uri={$this->redirect}&grant_type=authorization_code\";\n\n if ( $this->openid_realm ) {\n $post .= \"&openid.realm=\" . $this->openid_realm;\n }\n\n $response = $this->curl_post($token_url, $post);\n\n /* $response normally looks like this:\n {\n \"access_token\" : \"QEX3L0Fm ... about 80 characters ... 4tLMYze617\",\n \"token_type\" : \"Bearer\",\n \"expires_in\" : 3599,\n \"id_token\" : \"hbGciO ... about 700 characers ... t3cE\"\n }\n */\n\n if ($response) {\n $this->authentication_object = json_decode($response);\n }\n\n if (isset($this->authentication_object->refresh_token)) {\n $this->Google_RefreshToken = $this->authentication_object->refresh_token;\n }\n if (isset($this->authentication_object->access_token)) {\n $this->access_token = $this->authentication_object->access_token;\n return $this->authentication_object;\n } else {\n return FALSE;\n }\n }", "public function authorize(Request $request) {\n $client_uuid = $request->get('client_id');\n if (empty($client_uuid)) {\n return OAuthServerException::invalidClient()\n ->generateHttpResponse(new Response());\n }\n $consumer_storage = $this->entityTypeManager()->getStorage('consumer');\n $client_drupal_entities = $consumer_storage\n ->loadByProperties([\n 'uuid' => $client_uuid,\n ]);\n if (empty($client_drupal_entities)) {\n return OAuthServerException::invalidClient()\n ->generateHttpResponse(new Response());\n }\n\n $client_drupal_entity = reset($client_drupal_entities);\n $is_third_party = $client_drupal_entity->get('third_party')->value;\n\n $scopes = [];\n if ($request->query->get('scope')) {\n $scopes = explode(' ', $request->query->get('scope'));\n }\n\n if ($this->currentUser()->isAnonymous()) {\n $message = $this->t('An external client application is requesting access to your data in this site. Please log in first to authorize the operation.');\n $this->messenger()->addStatus($message);\n // If the user is not logged in.\n $destination = Url::fromRoute('oauth2_token.authorize', [], [\n 'query' => UrlHelper::parse('/?' . $request->getQueryString())['query'],\n ]);\n $url = Url::fromRoute('user.login', [], [\n 'query' => ['destination' => $destination->toString()],\n ]);\n // Client ID and secret may be passed as Basic Auth. Copy the headers.\n return RedirectResponse::create($url->toString(), 302, $request->headers->all());\n }\n elseif (!$is_third_party || $this->isKnownClient($client_uuid, $scopes)) {\n // Login user may skip the grant step if the client is not third party or\n // known.\n if ($request->get('response_type') == 'code') {\n $grant_type = 'code';\n }\n elseif ($request->get('response_type') == 'token') {\n $grant_type = 'implicit';\n }\n else {\n $grant_type = NULL;\n }\n try {\n $server = $this->grantManager->getAuthorizationServer($grant_type, $client_drupal_entity);\n $ps7_request = $this->messageFactory->createRequest($request);\n $auth_request = $server->validateAuthorizationRequest($ps7_request);\n }\n catch (OAuthServerException $exception) {\n $this->messenger()->addError($this->t('Fatal error. Unable to get the authorization server.'));\n watchdog_exception('simple_oauth', $exception);\n return RedirectResponse::create(Url::fromRoute('<front>')->toString());\n }\n if ($auth_request) {\n $can_grant_codes = $this->currentUser()\n ->hasPermission('grant simple_oauth codes');\n return static::redirectToCallback(\n $auth_request,\n $server,\n $this->currentUser,\n $can_grant_codes\n );\n }\n }\n return $this->formBuilder()->getForm(Oauth2AuthorizeForm::class);\n }", "public function do_oauth( $code ) {\n // Set up the request headers\n $headers = array( 'Accept' => 'application/json' );\n\n // Add the application id and secret to authenticate the request\n $options = array( 'auth' => array( $this->get_client_id(), $this->get_client_secret() ) );\n\n // Add the one-time token to request parameters\n $data = array( 'code' => $code );\n\n $response = Requests::post( self::$api_root . 'oauth.access', $headers, $data, $options );\n\n // Handle the JSON response\n $json_response = json_decode( $response->body );\n\n if ( ! $json_response->ok ) {\n // There was an error in the request\n throw new Slack_API_Exception( $json_response->error );\n }\n\n // The action was completed successfully, store and return access data\n $this->access = new Slack_Access(\n array(\n 'access_token' => $json_response->access_token,\n 'scope' => explode( ',', $json_response->scope ),\n 'team_name' => $json_response->team_name,\n 'team_id' => $json_response->team_id\n //'incoming_webhook' => array()\n )\n );\n\n return $this->access;\n }", "protected function createAccessToken($client_id, $scope = NULL) {\n $token = array(\n \"access_token\" => $this->genAccessToken(),\n \"expires_in\" => $this->getVariable('access_token_lifetime', OAUTH2_DEFAULT_ACCESS_TOKEN_LIFETIME),\n \"scope\" => $scope\n );\n\n $this->setAccessToken($token[\"access_token\"], $client_id, time() + $this->getVariable('access_token_lifetime', OAUTH2_DEFAULT_ACCESS_TOKEN_LIFETIME), $scope);\n\n // Issue a refresh token also, if we support them\n if (in_array(OAUTH2_GRANT_TYPE_REFRESH_TOKEN, $this->getSupportedGrantTypes())) {\n $token[\"refresh_token\"] = $this->genAccessToken();\n $this->setRefreshToken($token[\"refresh_token\"], $client_id, time() + $this->getVariable('refresh_token_lifetime', OAUTH2_DEFAULT_REFRESH_TOKEN_LIFETIME), $scope);\n // If we've granted a new refresh token, expire the old one\n if ($this->getVariable('_old_refresh_token'))\n $this->unsetRefreshToken($this->getVariable('_old_refresh_token'));\n }\n\n return $token;\n }", "protected function _od_obtainAccessToken($client_id, $client_secret, $code, $nodeid)\n {\n if (null === $client_id) {\n return 'The client ID must be set to call obtainAccessToken()';\n }\n\n if (null === $client_secret) {\n return 'The client Secret must be set to call obtainAccessToken()';\n }\n\n $redirect = elFinder::getConnectorUrl();\n if (strpos($redirect, '/netmount/onedrive/') === false) {\n $redirect .= '/netmount/onedrive/' . ($nodeid === 'elfinder'? '1' : $nodeid);\n }\n\n $url = self::TOKEN_URL;\n\n $curl = curl_init();\n\n $fields = http_build_query(\n array(\n 'client_id' => $client_id,\n 'redirect_uri' => $redirect,\n 'client_secret' => $client_secret,\n 'code' => $code,\n 'grant_type' => 'authorization_code',\n )\n );\n\n curl_setopt_array($curl, array(\n // General options.\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_POST => true,\n CURLOPT_POSTFIELDS => $fields,\n\n CURLOPT_HTTPHEADER => array(\n 'Content-Length: ' . strlen($fields),\n ),\n\n CURLOPT_URL => $url,\n ));\n\n $result = elFinder::curlExec($curl);\n\n $decoded = json_decode($result);\n\n if (null === $decoded) {\n throw new \\Exception('json_decode() failed');\n }\n\n if (!empty($decoded->error)) {\n $error = $decoded->error;\n if (!empty($decoded->error_description)) {\n $error .= ': ' . $decoded->error_description;\n }\n throw new \\Exception($error);\n }\n\n $res = (object)array(\n 'expires' => time() + $decoded->expires_in - 30,\n 'initialToken' => '',\n 'data' => $decoded\n );\n if (!empty($decoded->refresh_token)) {\n $res->initialToken = md5($client_id . $decoded->refresh_token);\n }\n return $res;\n }", "public function createAccessToken($oauthToken, IOAuth2Client $client, $data, $expires, $scope = null)\n {\n try {\n $clientId = $client->getPublicId();\n\n $sql = \"INSERT INTO \" . self::TABLE_TOKENS . \" (oauth_token,\n client_id,\n user_id,\n expires,\n scope)\n VALUES (:oauth_token, :client_id, :user_id, :expires, :scope)\";\n\n $stmt = $this->db->prepare($sql);\n $stmt->bindParam(':oauth_token', $oauthToken, \\PDO::PARAM_STR);\n $stmt->bindParam(':client_id', $clientId, \\PDO::PARAM_STR);\n $stmt->bindParam(':user_id', $data, \\PDO::PARAM_STR);\n $stmt->bindParam(':expires', $expires, \\PDO::PARAM_INT);\n $stmt->bindParam(':scope', $scope, \\PDO::PARAM_STR);\n\n $stmt->execute();\n } catch (PDOException $e) {\n $this->handleException($e);\n }\n }", "abstract protected function getAccessToken($oauth_token);", "protected function requestApplicationAccessToken() {\r\n\r\n $url = $this->getUrl('graph', '/oauth/access_token');\r\n $paramList = array(\r\n \t\t\"client_id\" => $this->getAppId(),\r\n \t\t\"client_secret\" => $this->getApiSecret(),\r\n \t\t\"grant_type\" => \"client_credentials\"\r\n );\r\n $access_token_response = $this->makeRequest($url, $paramList);\r\n\r\n $response_params = array();\r\n parse_str($access_token_response, $response_params);\r\n if (!isset($response_params['access_token'])) {\r\n return false;\r\n }\r\n\r\n return $response_params['access_token'];\r\n }", "protected function get_access_token() {\n\n\t\tif ( 'access' !== $this->status )\n\t\t\treturn;\n\n\t\t$this->request_method = $this->settings->access_token_method;\n\t\t$this->request_url = $this->settings->access_token_url;\n\t\t$this->build_request_parameter();\n\t\t$http = new self::$http_adapter();\n\n\t\tif ( $this->param_in_header ) {\n\t\t\t$url = $this->settings->access_token_url;\n\t\t\t$headers = $this->get_header();\n\t\t} else {\n\t\t\t$url = $this->settings->access_token_url . '?' . $this->get_query_string();\n\t\t\t$headers = array();\n\t\t}\n\t\t$reply = call_user_func_array(\n\t\t\tarray( $http, $this->request_method ),\n\t\t\tarray( $url, $headers )\n\t\t);\n\n\t\tif ( 200 == $reply[ 'response' ][ 'code'] ) {\n\t\t\t$response = array();\n\t\t\tparse_str( $reply[ 'body' ], $response );\n\t\t\t$this->oauth_access_token = $response[ 'oauth_token' ];\n\t\t\t$this->oauth_access_secret = $response[ 'oauth_token_secret' ];\n\t\t\t$this->status = 'signed_in';\n\t\t}\n\t}", "public function get_token()\n {\n $clientID = $this->clientID;\n $clientSecret = $this->clientSecret;\n\n $auth = $clientID . ':' . $clientSecret;\n $basic_token = 'Basic ' . base64_encode($auth);\n\n $client = new Client();\n\n try {\n $response = $client->post(\n $this->host . '/oauth/v2/token', [\n 'form_params' => [\n 'grant_type' => 'client_credentials',\n ],\n\n 'headers' => [\n 'Authorization' => $basic_token,\n 'Content-Type' => 'application/x-www-form-urlencoded'\n ]\n ]\n );\n\n $data = json_decode($response->getBody(), true);\n\n return $data['access_token'];\n\n } catch (RequestException $ex) {\n abort(501, $ex->getMessage());\n }\n }", "public function getAccessToken($code, $scope, $redirect_uri)\n {\n $url = \"https://login.bigcommerce.com/oauth2/token\";\n\n $payload = array(\n 'grant_type' => 'authorization_code',\n 'client_id' => $this->client_id,\n 'client_secret' => $this->secret,\n 'context' => $this->store_context,\n 'code' => $code,\n 'scope' => $scope,\n 'redirect_uri' => $redirect_uri\n );\n\n $response = $this->curlHttpRequest('POST', $url, '', $payload, array('Content-Type: application/x-www-form-urlencoded'));\n $response = json_decode($response, true);\n if (isset($response['access_token'])) {\n $this->token = $response['access_token'];\n return $response['access_token'];\n }\n return false;\n }", "protected function getAuthorizationCodeRequest($client_id = null, $redirect_uri = null, $state = null, $scope = null, $response_type = 'code', $app_name = null, $app_logo_url = null)\n {\n\n $resourcePath = '/oauth2/authorize';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // query params\n if ($client_id !== null) {\n $queryParams['clientId'] = ObjectSerializer::toQueryValue($client_id);\n }\n // query params\n if ($redirect_uri !== null) {\n $queryParams['redirectUri'] = ObjectSerializer::toQueryValue($redirect_uri);\n }\n // query params\n if ($state !== null) {\n $queryParams['state'] = ObjectSerializer::toQueryValue($state);\n }\n // query params\n if ($scope !== null) {\n $queryParams['scope'] = ObjectSerializer::toQueryValue($scope);\n }\n // query params\n if ($response_type !== null) {\n $queryParams['responseType'] = ObjectSerializer::toQueryValue($response_type);\n }\n // query params\n if ($app_name !== null) {\n $queryParams['appName'] = ObjectSerializer::toQueryValue($app_name);\n }\n // query params\n if ($app_logo_url !== null) {\n $queryParams['appLogoUrl'] = ObjectSerializer::toQueryValue($app_logo_url);\n }\n\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 []\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 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "protected function getAuthorizationCodeRequest($client_id = null, $redirect_uri = null, $state = null, $scope = null, $response_type = 'code', $app_name = null, $app_logo_url = null)\n {\n\n $resourcePath = '/oauth2/authorize';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n // query params\n if ($client_id !== null) {\n $queryParams['clientId'] = ObjectSerializer::toQueryValue($client_id);\n }\n // query params\n if ($redirect_uri !== null) {\n $queryParams['redirectUri'] = ObjectSerializer::toQueryValue($redirect_uri);\n }\n // query params\n if ($state !== null) {\n $queryParams['state'] = ObjectSerializer::toQueryValue($state);\n }\n // query params\n if ($scope !== null) {\n $queryParams['scope'] = ObjectSerializer::toQueryValue($scope);\n }\n // query params\n if ($response_type !== null) {\n $queryParams['responseType'] = ObjectSerializer::toQueryValue($response_type);\n }\n // query params\n if ($app_name !== null) {\n $queryParams['appName'] = ObjectSerializer::toQueryValue($app_name);\n }\n // query params\n if ($app_logo_url !== null) {\n $queryParams['appLogoUrl'] = ObjectSerializer::toQueryValue($app_logo_url);\n }\n\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 []\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 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function getAccessTokenAsResourceOwner($scope = '', $username, $password)\n {\n if (!empty($this->access_token) || $code == '')\n {\n // @todo check the expiration time\n return $this->access_token;\n }\n\n $params = array();\n $params['client_id'] = $this->client_id;\n $params['client_secret'] = $this->client_secret;\n $params['grant_type'] = 'password';\n $params['username'] = $username;\n $params['password'] = $password;\n\n $response = $this->sendRequest($this->getTokenEndpoint(), $params, 'POST');\n $this->afterGetAccessToken($response);\n\n return $this->access_token;\n }", "public function getAccessTokenByAssociatedToken(ClientInterface $client, string $token): ?AccessTokenInterface;", "public function getAccessToken($oauth_token)\n {\n if (!$tokenData = $this->encryptionUtil->decode($oauth_token, null, false)) {\n return false;\n }\n\n $client_id = isset($tokenData['aud']) ? $tokenData['aud'] : null;\n $public_key = $this->publicKeyStorage->getPublicKey($client_id);\n $algorithm = $this->publicKeyStorage->getEncryptionAlgorithm($client_id);\n\n // now that we have the client_id, verify the token\n if (false === $this->encryptionUtil->decode($oauth_token, $public_key, array($algorithm))) {\n return false;\n }\n\n // normalize the JWT claims to the format expected by other components in this library\n return $this->convertJwtToOAuth2($tokenData);\n }", "public function requestTwoLeggedAccessToken(){\n\n if($this->defaultAccessToken == null ||\n ($this->defaultAccessToken != null\n && $this->defaultAccessToken->isExpired())) {\n\n $params = ['scope' => static::TWO_LEGGED_SCOPE, 'grant_type' => static::CLIENT_CREDENTIALS_GRANT_TYPE];\n $request = $this->request('POST', 'oauth/token', $params, null, null, $this->defaultApiVersion);\n return $this->lastResponse = $this->client->sendRequest($request);\n }\n }", "function getAccessToken($oauth_verifier = FALSE, $oauth_token = false) { \n $parameters = array(); \n if (!empty($oauth_verifier)) { \n $parameters['oauth_verifier'] = $oauth_verifier; \n } \n\n\n $request = $this->oAuthRequest($this->accessTokenURL(), 'GET', $parameters); \n $token = OAuthUtil::parse_parameters($request); \n $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']); \n return $token; \n }", "public function requestAppToken()\n {\n return $this->requestToken([\n 'grant_type' => 'client_credentials',\n ]);\n }", "protected function getAccessToken()\n { $tenant = 'b4ca5b14-c6b7-4903-99a0-115d95fcaf56';\n $client_id = 'f5f48366-f0dc-4e5c-bea2-51d7c31caa0f';\n $scope = 'https%3A%2F%2Fb4ca5b14-c6b7-4903-99a0-115d95fcaf56%2FEPApiPoc%2F.default';\n $client_secret = '8%2FoFv3q%3E%29vL%24jx%29if%21Kyx2%26U7%3FE%25%3BR';\n $grant_type = 'client_credentials';\n\n // get our access token\n $client = new Client();\n $response = $client->request('POST', 'https://login.microsoftonline.com/' . $tenant . '/oauth2/v2.0/token', [\n 'body' => \"client_id={$client_id}&scope={$scope}&client_secret={$client_secret}&grant_type={$grant_type}\"\n ]);\n $body = $response->getBody();\n $json = json_decode((string) $body, true);\n if ( !isset($json['access_token']) || empty($json['access_token']) ) {\n fail('Unable to obtain access token');\n }\n session(['access_token' => $json['access_token']]);\n return $json['access_token'];\n }", "public static function getAccessToken($provider,$oauth_token,$oauth_token_secret,$oauth_verifier)\n {\n $config = sfConfig::get('app_cacophony');\n \n $oauth = self::getInstance($provider);\n $oauth->setToken($oauth_token,$oauth_token_secret);\n \n if (sfConfig::get('sf_logging_enabled')) $oauth->enableDebug();\n \n try\n {\n return $oauth->getAccessToken($config['providers'][$provider]['access_token_url'], null, $oauth_verifier);\n }\n catch (OAuthException $e)\n {\n if (sfConfig::get('sf_logging_enabled'))\n {\n sfContext::getInstance()->getLogger()->err(sprintf('{OAuthException} %s',$e->lastResponse));\n sfContext::getInstance()->getLogger()->info(sprintf('{OAuthException} %s',print_r($oauth->debugInfo,true)));\n }\n throw $e;\n }\n }" ]
[ "0.6964931", "0.6437082", "0.6401724", "0.6336455", "0.631853", "0.62832946", "0.6209748", "0.6199706", "0.61829823", "0.61203575", "0.60958725", "0.60092026", "0.59658474", "0.5940242", "0.59369934", "0.59345263", "0.59256446", "0.5901864", "0.58821595", "0.58774084", "0.58494943", "0.58494943", "0.58411634", "0.5824277", "0.5777616", "0.5769814", "0.57560295", "0.57465917", "0.57309306", "0.57165575" ]
0.73228747
0
Removes the specified authorization, so that it can't be used again
public function removeAuthorization(string $authorizationIdentifier): void { $this->oAuthClient->removeAuthorization($authorizationIdentifier); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deauthorize()\n {\n\t\t# delete remember me cookie if set\n\t\t$this->delete_auth_cookie();\n\n $this->sd->wipe_group('_auth');\n }", "public static function deauthorize() {\n\t\tself::_set('authorized', false);\n\t}", "public function clearAuthAssignments();", "public function withoutAuthorization();", "public function removeAuthItem($name);", "public function revoke_access() {\n // Nothing to do!\n }", "function resetAuthorization(){\n\t\t$this->_Username = \"\";\n\t\t$this->_Password = \"\";\n\t\t$this->_AuthType = \"\";\n\t}", "public function destroy(AuthorizationCompanion $authorizationCompanion)\n {\n //\n }", "protected function deleteExpendedAuthorizationCode()\n {\n if (!class_exists('Ninja_Forms')) {\n return;\n }\n\n Ninja_Forms()->update_setting(NF_ZohoCRM()->constants->authorization_code, '');\n }", "public function action_clear_deauth() {\n\t\t$id = $_GET['clear_deauth'];\n\t\t$service = $_GET['service'];\n\t\t$deauthed = get_option('social_deauthed', array());\n\t\tif (isset($deauthed[$service][$id])) {\n\t\t\tunset($deauthed[$service][$id]);\n\t\t\tupdate_option('social_deauthed', $deauthed);\n\n\t\t\t$this->social->remove_from_default_accounts($service, $id);\n\t\t}\n\t}", "public function remove() {\n $this->session->remove('auth-identity');\n }", "public function logout(){\n Zend_Auth::getInstance()->getStorage()->clear();\n }", "public function revokeAuthorizationCode(ClientInterface $client, AuthorizationCodeInterface $authorizationCode): void;", "public function unauthorized(){\r\n response::unauthorized();\r\n }", "public function renewAuthorization();", "public function test_delete_membership_without_authorization() {\n\t\t// Create a membership first.\n\t\twp_set_current_user( $this->user_allowed );\n\t\t$membership = $this->factory->membership->create_and_get();\n\n\t\t// Delete membership.\n\t\twp_set_current_user( 0 );\n\t\t$response = $this->perform_mock_request( 'DELETE', $this->route . '/' . $membership->get( 'id' ) );\n\n\t\t// Unauthorized.\n\t\t$this->assertEquals( 401, $response->get_status() );\n\t}", "static function removeAuthKey($params){\n $con = $params['dbconnection'];\n $queryd = \"DELETE FROM `authkeys` WHERE `auth_key`='{$params['Authorization']}'\";\n mysqli_query($con, $queryd);\n return \"removed\";\n }", "public function unauthAction(){\n $this->view->templateType = 'none';\n\n $auth = Zend_Auth::getInstance();\n\n if(!$auth->hasIdentity()){\n $this->_redirect('/customers');\n } else {\n echo $auth->getIdentity();\n //print_r ($auth);\n }\n }", "public function testWebAuthDeleteUnautorized(): void\n\t{\n\t\t$this->createCredentials();\n\n\t\t$responseDelete = $this->postJson('/api/WebAuthn::delete', ['id' => '_Xlz-khgFhDdkvOWyy_YqC54ExkYyp1o6HAQiybqLST-9RGBndpgI06TQygIYI7ZL2dayCMYm6J1-bXyl72obA']);\n\t\t$this->assertUnauthorized($responseDelete);\n\t}", "public static function revoke_access() {\n if (is_callable(self::$_auth_failure_callback)) {\n call_user_func(self::$_auth_failure_callback, array(\n self::$user,\n $_SERVER['REQUEST_URI']\n ));\n } else {\n throw new \\Exception('Unauthorized access on ' . $_SERVER['REQUEST_URI'], 1);\n }\n }", "public function revoke_access() \n {\n if (!$this->user_model->isAuth()) {\n redirect('user/login', 'refresh');\n }\n\n $this->load->model('user_admin_model');\n\n $this->user_admin_model->deleteAccessToken(\n $this->session->userdata('ID'),\n $this->input->get('id')\n );\n redirect('/user/apikey');\n }", "public function deleteAuthorizationById($id) {\n Craft::log('PicPuller service: deleteAppById '.$id);\n if( $this->authorizationRecord->deleteByPk($id) )\n {\n return true;\n } else {\n return false;\n }\n }", "public function unregisterResource()\n {\n Zend_Registry::get('acl')->remove($this);\n }", "public function revokePrivilege($email, $privilege);", "static function removeAuthKey($params) \n{\n\t$con =$params['dbconnection'];\t\n\t$queryd = \"DELETE FROM `authkeys` WHERE `auth_key`='{$params['Authorization']}'\";\n\tmysqli_query($con,$queryd) ;\n\treturn \"removed\";\n}", "public function clear_access_allowed() {\n global $SESSION;\n if (!empty($SESSION->passwordcheckedquizzes[$this->quiz->id])) {\n unset($SESSION->passwordcheckedquizzes[$this->quiz->id]);\n }\n }", "public function remove()\n {\n if ($this->cookies->has('RMU')) {\n $this->cookies->get('RMU')->delete();\n }\n if ($this->cookies->has('RMT')) {\n $token = $this->cookies->get('RMT')->getValue();\n\n $user = $this->findFirstByToken($token);\n $this->deleteToken($user);\n \n $this->cookies->get('RMT')->delete();\n }\n\n $this->session->remove('auth');\n }", "public function eraseCredentials(){}", "public function eraseCredentials(){}", "public function destroy(Autorisation $autorisation)\n {\n //\n }" ]
[ "0.6695456", "0.6657231", "0.6402302", "0.61641175", "0.61231875", "0.59751874", "0.59502006", "0.5858555", "0.5857297", "0.5773131", "0.577029", "0.5768195", "0.5753351", "0.57376236", "0.57359105", "0.5732017", "0.5706341", "0.5700081", "0.56933737", "0.565166", "0.5649687", "0.5646212", "0.5588206", "0.55589086", "0.553628", "0.5532242", "0.54803675", "0.54730606", "0.54730606", "0.5470296" ]
0.6692203
1
Retrieves the JSON Web Key Set from the endpoint configured via the "jwksUri" option
public function getJwks(): array { $cacheIdentifier = sha1($this->options['jwksUri']); $jwks = $this->jwksCache->get($cacheIdentifier); if (empty($jwks)) { try { $response = $this->httpClient->request('GET', $this->options['jwksUri']); } catch (GuzzleException $e) { throw new ConnectionException(sprintf('OpenID Connect Client: Failed retrieving JWKS from %s: %s', $this->options['jwksUri'], $e->getMessage()), 1559211266); } $response = \GuzzleHttp\json_decode($response->getBody()->getContents(), true); if (!is_array($response) || !isset($response['keys'])) { throw new ServiceException(sprintf('OpenID Connect Client: Failed decoding response while retrieving JWKS from %s', $this->options['jwksUri']), 1559211340); } $jwks = $response['keys']; $this->jwksCache->set($cacheIdentifier, $jwks); } return $jwks; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getJwks($parent, $optParams = [])\n {\n $params = ['parent' => $parent];\n $params = array_merge($params, $optParams);\n return $this->call('getJwks', [$params], GetJSONWebKeysResponse::class);\n }", "public function getSigningKeysRequest()\n {\n $resourcePath = '/signing_key';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['application/json']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['application/json'],\n []\n );\n }\n\n // For model (json/xml)\n if (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem,\n ];\n }\n }\n\n // For HTTP post (form)\n $httpBody = new MultipartStream($multipartContents);\n } elseif ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode($formParams);\n } else {\n // For HTTP post (form)\n $httpBody = ObjectSerializer::buildQuery($queryParams);\n }\n }\n\n // this endpoint requires OAuth (access token)\n if (! empty($this->config->getAccessToken())) {\n $headers['Authorization'] = 'Bearer '.$this->config->getAccessToken();\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 = ObjectSerializer::buildQuery($queryParams);\n\n return new Request(\n 'GET',\n $this->config->getHost().$resourcePath.($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "function getKeys() {\n\t\t$params = array (\n\t\t\t\t'props' => 'false',\n\t\t\t\t'keys' => 'true' \n\t\t);\n\t\t$url = Utils::buildRestPath ( $this->client, $this, NULL, NULL, $params );\n\t\t$response = Utils::httpRequest ( 'GET', $url );\n\t\t\n\t\t// Use a Object to interpret the response, we are just interested in the value.\n\t\t$obj = new Object ( $this->client, $this, NULL );\n\t\t$obj->populate ( $response, array (\n\t\t\t\t200 \n\t\t) );\n\t\tif (! $obj->exists ()) {\n\t\t\tthrow new Exception ( \"Error getting bucket properties.\" );\n\t\t}\n\t\t$keys = $obj->getData ();\n\t\treturn array_map ( \"urldecode\", $keys [\"keys\"] );\n\t}", "protected static function get_jwk_url()\n {\n return InstanceLocalCache::remember('jwk_url__'.self::OPENID_CONFIGURATION_URI, 86400, function () {\n $httpclient = new Client();\n\n $content = [\n 'connect_timeout' => JWT::REQUEST_CONNECTION_TIMEOUT_S,\n 'timeout' => JWT::REQUEST_TIMEOUT_S,\n ];\n\n $response = (new ExponentialBackoff(6, [JWT::class, 'shouldRetry']))->execute([$httpclient, 'request'], ['GET', self::OPENID_CONFIGURATION_URI, $content]);\n\n $result = json_decode((string) $response->getBody(), true);\n\n return $result['jwks_uri'];\n });\n }", "function retrieveKey()\r\n{\r\n //Create a KMSClient\r\n $client = new KMSClient([\r\n 'profile' => 'default',\r\n 'version' => '2014-11-01',\r\n 'region' => 'us-east-1'\r\n ]);\r\n \r\n $result = $client->listKeys();\r\n $keys = $result->get(\"Keys\");\r\n $test = \"Hoy's my boy!\";\r\n $key_chain = array();\r\n \r\n //For Loop for the keys\r\n foreach($keys as $key)\r\n {\r\n try //Trying to encrypt and decrypt\r\n {\r\n $cipher = $client->encrypt([\r\n 'KeyId' => $key['KeyArn'],\r\n 'Plaintext' => $test,\r\n ]);\r\n \r\n $plain = $client->decrypt([\r\n 'CiphertextBlob' => $cipher['CiphertextBlob'],\r\n ]);\r\n \r\n /*\r\n echo \"Key ID: \".$key['KeyId'].\"</br>\";\r\n echo \"Key ARN: \".$key['KeyArn'].\"</br>\";\r\n echo \"Test: \".$test.\"</br>\";\r\n echo \"Encrypted: \".$cipher['CiphertextBlob'].\"</br>\";\r\n echo \"Plain: \".$plain['Plaintext'].\"</br><br>\";\r\n */\r\n $key_chain[] = $key;\r\n \r\n }//End of try\r\n \r\n catch(Exception $e)\r\n {\r\n //echo \"Failed: \".$e->getMessage().\"</br><br>\";\r\n }\r\n }//End of foreach($keys as $key)\r\n \r\n return $key_chain;\r\n}", "function getKeys($params = \"\")\n {\n $query = \"select id as keyId, startDate, endDate, clientId, name as propName, email as propEmail from SSLKey\";\n return $this->get_config_array($query);\n }", "public function getJsonWebKeySet($set)\n {\n list($response) = $this->getJsonWebKeySetWithHttpInfo($set);\n return $response;\n }", "public function getApiKeys();", "public function getPublicKey()\n {\n if(empty($this->_publicKey) && !empty($this->jwkUrl))\n {\n if(Yii::app()->cache)\n {\n $cacheKey = \"JWK_\".sha1($this->jwkUrl);\n $jwk = Yii::app()->cache->get($cacheKey);\n }\n\n if(empty($jwk))\n {\n $jwk = $this->sendRequest('GET', $this->jwkUrl);\n if(!empty($jwk) && Yii::app()->cache)\n Yii::app()->cache->set($cacheKey, $jwk, self::PUBLIC_KEY_EXPIRE_DURATION);\n }\n\n if(!empty($jwk))\n $this->_publicKey = JWK::parseKeySet($jwk);\n }\n return $this->_publicKey;\n }", "public function getJsonWebKeyWithHttpInfo($kid, $set)\n {\n // verify the required parameter 'kid' is set\n if ($kid === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $kid when calling getJsonWebKey');\n }\n // verify the required parameter 'set' is set\n if ($set === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $set when calling getJsonWebKey');\n }\n // parse inputs\n $resourcePath = \"/keys/{set}/{kid}\";\n $httpBody = '';\n $queryParams = [];\n $headerParams = [];\n $formParams = [];\n $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);\n\n // path params\n if ($kid !== null) {\n $resourcePath = str_replace(\n \"{\" . \"kid\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($kid),\n $resourcePath\n );\n }\n // path params\n if ($set !== null) {\n $resourcePath = str_replace(\n \"{\" . \"set\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($set),\n $resourcePath\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'GET',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\HydraSDK\\Model\\JSONWebKeySet',\n '/keys/{set}/{kid}'\n );\n\n return [$this->apiClient->getSerializer()->deserialize($response, '\\HydraSDK\\Model\\JSONWebKeySet', $httpHeader), $statusCode, $httpHeader];\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\HydraSDK\\Model\\JSONWebKeySet', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n case 404:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\HydraSDK\\Model\\GenericError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n case 500:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\HydraSDK\\Model\\GenericError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "function fetchPublicCerts($kid) {\n $json = file_get_contents('https://www.googleapis.com/oauth2/v3/certs');\n\n // add to return var\n global $response;\n $response['certs'] = $json;\n\n $obj = json_decode($json);\n foreach ($obj->keys as $key) {\n if ($key->kid == $kid) {\n\n $rsa = new RSA();\n $dec = new Decoder();\n\n $modulus = new BigInteger($dec->base64UrlDecode($key->n), 256);\n $exponent = new BigInteger($dec->base64UrlDecode($key->e), 256);\n\n $rsa->loadKey(array('n' => $modulus, 'e' => $exponent));\n // https://tls.mbed.org/kb/cryptography/asn1-key-structures-in-der-and-pem\n return $rsa->getPublicKey();\n }\n }\n return null;\n}", "public function getKeys(): GetKeys\n {\n return new GetKeys($this->_provider);\n }", "public function get_oauth_public_keys () {\n\t\t$database = $this->db->select('*')\n\t\t\t\t\t->from('oauth_public_keys')\n\t\t\t\t\t->get()->result();\n\t\treturn $database;\n\t}", "protected function restExportsFormatKeysGetRequest()\n {\n\n $resourcePath = '/rest/exports/format_keys';\n $formParams = [];\n $queryParams = [];\n $headerParams = [];\n $httpBody = '';\n $multipart = false;\n\n\n\n\n // body params\n $_tempBody = null;\n\n if ($multipart) {\n $headers = $this->headerSelector->selectHeadersForMultipart(\n ['*/*']\n );\n } else {\n $headers = $this->headerSelector->selectHeaders(\n ['*/*'],\n []\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n // $_tempBody is the method argument, if present\n if ($headers['Content-Type'] === 'application/json') {\n $httpBody = \\GuzzleHttp\\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody));\n } else {\n $httpBody = $_tempBody;\n }\n } elseif (count($formParams) > 0) {\n if ($multipart) {\n $multipartContents = [];\n foreach ($formParams as $formParamName => $formParamValue) {\n $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];\n foreach ($formParamValueItems as $formParamValueItem) {\n $multipartContents[] = [\n 'name' => $formParamName,\n 'contents' => $formParamValueItem\n ];\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\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 'GET',\n $this->config->getHost() . $resourcePath . ($query ? \"?{$query}\" : ''),\n $headers,\n $httpBody\n );\n }", "public function getKeys( $secretId );", "public function getKeys(): array {\n return [\n 'client_key'=>$this->client_key,\n 'secret_key'=>$this->secret_key\n ];\n }", "public function getApiKey();", "public function getApiKey();", "public function getApiKey();", "public function getJsonWebKeySetWithHttpInfo($set)\n {\n // verify the required parameter 'set' is set\n if ($set === null) {\n throw new \\InvalidArgumentException('Missing the required parameter $set when calling getJsonWebKeySet');\n }\n // parse inputs\n $resourcePath = \"/keys/{set}\";\n $httpBody = '';\n $queryParams = [];\n $headerParams = [];\n $formParams = [];\n $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);\n if (!is_null($_header_accept)) {\n $headerParams['Accept'] = $_header_accept;\n }\n $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);\n\n // path params\n if ($set !== null) {\n $resourcePath = str_replace(\n \"{\" . \"set\" . \"}\",\n $this->apiClient->getSerializer()->toPathValue($set),\n $resourcePath\n );\n }\n\n // for model (json/xml)\n if (isset($_tempBody)) {\n $httpBody = $_tempBody; // $_tempBody is the method argument, if present\n } elseif (count($formParams) > 0) {\n $httpBody = $formParams; // for HTTP post (form)\n }\n // make the API Call\n try {\n list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(\n $resourcePath,\n 'GET',\n $queryParams,\n $httpBody,\n $headerParams,\n '\\HydraSDK\\Model\\JSONWebKeySet',\n '/keys/{set}'\n );\n\n return [$this->apiClient->getSerializer()->deserialize($response, '\\HydraSDK\\Model\\JSONWebKeySet', $httpHeader), $statusCode, $httpHeader];\n } catch (ApiException $e) {\n switch ($e->getCode()) {\n case 200:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\HydraSDK\\Model\\JSONWebKeySet', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n case 401:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\HydraSDK\\Model\\GenericError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n case 403:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\HydraSDK\\Model\\GenericError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n case 500:\n $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\\HydraSDK\\Model\\GenericError', $e->getResponseHeaders());\n $e->setResponseObject($data);\n break;\n }\n\n throw $e;\n }\n }", "public function jwtGetKey()\n {\n $this->config->load('rest');\n return $this->getHeader($this->config->item('rest_key_name'));\n }", "public function getApiKey($store = null)\n {\n return Mage::getStoreConfig(self::XML_PATH_API_KEY, $store);\n }", "private static function getAccessKey()\n {\n return json_decode(file_get_contents(self::$config['access_key']), true);\n }", "public function getKeys(string $jku): array\n {\n $cacheKey = 'keys-' . md5($jku);\n\n $cached = $this->cache->get($cacheKey);\n if ($cached) {\n return self::parseKeySet($cached);\n }\n\n $keys = json_decode($this->request->setUrl($jku)->get()->getBody()->getContents());\n $this->cache->set($cacheKey, $keys, Carbon::now()->addDay());\n\n return self::parseKeySet($keys);\n }", "public function getJsonWebKey($kid, $set)\n {\n list($response) = $this->getJsonWebKeyWithHttpInfo($kid, $set);\n return $response;\n }", "public function getKeys()\n {\n #return response()->json($this->appKeys);\n $response = [];\n\n foreach ($this->appKeys as $appKey => $severity) {\n $response[$appKey] = [\n 'severity' => $severity\n ];\n }\n\n return response()->json($response);\n }", "public function getEncryptedSettingKeys(): array;", "public function getPrivateKey() {\n\n $path = base_url();\n $url = $path . 'api/Admin_api/getPrivateKey?setting_name=pass_privateKey';\n $ch = curl_init($url);\n curl_setopt($ch, CURLOPT_HTTPGET, true);\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n $response_json = curl_exec($ch);\n curl_close($ch);\n $response = json_decode($response_json, true);\n return $response;\n }", "public function listYourPublicKeys()\n\t{\n\t\t$data = array();\n\t\t\n\t\treturn $this->client->request(\"/user/keys\", 'GET', $data, 200, 'GitHubPublicKey', true);\n\t}", "public function get()\n {\n $values = [];\n $key = $this->request->get('key');\n\n if (is_array($key)) {\n foreach ($key as $key_item) {\n $values[$key_item] = get_option($key_item);\n }\n } else {\n $values[$key] = get_option($key);\n }\n\n wp_send_json_success($values, 200);\n }" ]
[ "0.5538305", "0.54621863", "0.5435886", "0.5347703", "0.52904296", "0.52666986", "0.52656907", "0.52134836", "0.5183965", "0.51743245", "0.5160906", "0.51112205", "0.5064755", "0.50232387", "0.5015312", "0.5009239", "0.49831182", "0.49831182", "0.49831182", "0.49748155", "0.49634132", "0.49593908", "0.49508768", "0.49196643", "0.48908043", "0.48490268", "0.4834328", "0.48251283", "0.4811868", "0.47995445" ]
0.60196775
0
array with all urls /Constructor $route: $totalEntries: $currentPage:
function __construct ($route, $totalEntries, $currentPage) { //TRAZA Log::info('+++ PaginadorClass>Constructor:', array("totalEntries:",$totalEntries,"currentPage:",$currentPage)); $this->totalEntries = $totalEntries; $this->currentPage=$currentPage; //$urlCurrent = URL::current(); $this->route=$route; if($totalEntries > $this->rowsPerPage){ //Total pages $pages = $totalEntries / $this->rowsPerPage; $pages = ceil($pages); //ceil get roundUp number of float $this->totalPages = $pages; //current start row: pageTobeSeen * rowsPerPage - rowsPerPage if($currentPage>1){ $this->firstRowOfPage = ($currentPage * $this->rowsPerPage) - $this->rowsPerPage; } //Create URL link for all pages if($this->totalPages > 1){ for($i = 1; $i <= $pages; $i++){ $pageUrl = $route . "?page=" . $i; Log::info('+++ PaginadorClass>URLs:', array(URL::current())); $this->urls[$i] = $pageUrl; } } //TRAZA //Log::info('+++ PaginadorClass>Pages:', array($pages, $this->firstRowOfPage, $this->rowsPerPage)); //Log::info('+++ PaginadorClass>URLs:', $this->urls); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function getPageRoutes()\n {\n $pages = $this->api->request('findAllPages');\n $pageRoutes = array();\n \n if($pages) {\n foreach($pages['data'] as $page) {\n $url = trim($page['url']);\n // akhiran \"/\" mesti ditambahkan jika belum ada (saya mau semua URL berakhiran '/')\n $route = ( (substr($url, 0, 1) !== '/') && (substr($url, -1) !== '/') ) ? '/'.$url.'/' : $url;\n \n $options = $this->routeOptions;\n $options['options']['route'] = $route;\n $options['options']['defaults']['slug'] = $page['slug'];\n $options['priority'] = -1;\n $pageRoutes[$page['slug']] = $options;\n }\n }\n return $pageRoutes;\n }", "public static function &generateUrlData()\n {\n if (null === self::$kernel || null === self::$kernel->getContainer()) {\n // kernel not booted (properly)\n self::bootKernel();\n }\n $routes = self::$kernel->getContainer()->get('router')->getRouteCollection();\n $result = array();\n foreach ($routes as $name => $route) {\n // only use interesting urls, the rest is too much uninteresting data\n if (static::interestedInRoute($route)) {\n $infos = array('path' => $route->getPath(),\n 'methods' => $route->getMethods(),\n 'defaults' => $route->getDefaults(),\n );\n $result[$name] = $infos;\n }\n }\n ksort($result);\n\n return $result;\n }", "public static function getRoutes()\n {\n //You need to follow this pattern to add new URLS\n //You should improve this function by making functions to create routes in a factory. I will look for this when grading\n\n //I also use object for the route because it has data and it's easier to access.\n\n $routes[] = self::create('GET','show','homepage','homepageController','show');\n $routes[] = self::create('POST','create','homepage','homepageController','create');\n $routes[] = self::create('GET','show','tasks','tasksController','show');\n $routes[] = self::create('GET','all','tasks','tasksController','all');\n $routes[] = self::create('GET','all','accounts','accountsController','all');\n $routes[] = self::create('GET','show','accounts','accountsController','show');\n $routes[] = self::create('POST','login','accounts','accountsController','login');\n $routes[] = self::create('POST','delete','tasks','tasksController','delete');\n $routes[] = self::create('POST','delete','accounts','accountsController','delete');\n $routes[] = self::create('GET','edit','accounts','accountsController','edit');\n $routes[] = self::create('POST','save','accounts','accountsController','save');\n $routes[] = self::create('POST','save','tasks','tasksController','save');\n $routes[] = self::create('GET','register','accounts','accountsController','register');\n $routes[] = self::create('POST','register','accounts','accountsController','store');\n $routes[] = self::create('POST','insertTodo','tasks','tasksController','insertTodo');\n $routes[] = self::create('GET','getTodo','tasks','tasksController','getTodo');\n $routes[] = self::create('GET','logout','accounts','accountsController','logout');\n $routes[] = self::create('GET','myprofile','accounts','accountsController','myprofile');\n \n return $routes;\n }", "public function publicUrlProvider() {\n yield ['/'];\n yield ['/hot'];\n yield ['/new'];\n yield ['/hot/1'];\n yield ['/new/1'];\n yield ['/all/hot'];\n yield ['/all/new'];\n yield ['/all/hot/1'];\n yield ['/all/new/1'];\n yield ['/featured/hot'];\n yield ['/featured/new'];\n yield ['/featured/hot/1'];\n yield ['/featured/new/1'];\n yield ['/featured/hot/1.atom'];\n yield ['/featured/new/1.atom'];\n yield ['/f/news/hot'];\n yield ['/f/news/new'];\n yield ['/f/news/hot/1'];\n yield ['/f/news/new/1'];\n yield ['/f/news/hot/1.atom'];\n yield ['/f/news/new/1.atom'];\n yield ['/f/news/1'];\n yield ['/f/news/1/comment/1'];\n yield ['/f/news/bans'];\n yield ['/f/news/moderation_log'];\n yield ['/f/cats/2'];\n yield ['/forums'];\n yield ['/forums/by_name'];\n yield ['/forums/by_title'];\n yield ['/forums/by_subscribers'];\n yield ['/forums/by_submissions'];\n yield ['/forums/by_name/1'];\n yield ['/forums/by_title/1'];\n yield ['/forums/by_subscribers/1'];\n yield ['/forums/by_submissions/1'];\n yield ['/login'];\n yield ['/registration'];\n yield ['/user/emma'];\n yield ['/reset_password'];\n }", "public function getRoutes(): array;", "public function getRoutes(): array;", "public static function get_routes(): ?iterable;", "public function getRoutes();", "public function getRoutes();", "public function getRoutes();", "public function getRoutes();", "public function getRoutes();", "public function getRoutes();", "protected function route(): array\n {\n $requestUri = $_SERVER['REQUEST_URI'] ?? '';\n $requestUri = parse_url($requestUri, PHP_URL_PATH);\n $page = null;\n foreach ($this->pageConfigs as $pageId => $pageConfig) {\n $pattern = $pageConfig['parse_pattern'];\n if (preg_match($pattern, $requestUri, $match) === 1) {\n $page = $pageId;\n break;\n }\n }\n\n if (empty($page)) {\n throw new \\Exception('Page not found.', 404);\n }\n\n $routeInfo = ['page' => $page];\n if (count($match) === 1) {\n return $routeInfo;\n }\n\n switch ($page) {\n case 'article':\n $routeInfo['slug'] = $match[1];\n break;\n case 'image':\n $routeInfo['width'] = (int) $match[1];\n $routeInfo['height'] = (int) $match[2];\n $routeInfo['path'] = $match[3];\n break;\n }\n\n return $routeInfo;\n }", "function getpages(){\n \t\n }", "public function getPages();", "private function getPages()\n {\n $pages = new ArrayList();\n $config = Config::inst()->get('SEO_Sitemap','objects');\n\n foreach($this->objects as $className => $value){\n\n $object = $className::get()->filter([\n 'Robots:not' => 'noindex,nofollow',\n 'SitemapHide' => 0\n ]);\n\n foreach($object as $page){\n if(!$page instanceof Page){\n $page->Link = $this->getPrefix($className, $page);\n }\n $pages->push($page);\n }\n }\n $pages->Sort('Priority DESC');\n return $pages;\n }", "abstract public function routes(): array;", "public function getUrlS();", "public static function all()\n\t{\n\t\t$links = array();\n\t\tforeach ( self::$_flowOrder as $key => $flow )\n\t\t{\n\t\t\t$prefix = ( ! preg_match('/\\Ahttp/u', $flow) ) ? page_link() : '';\n\t\t\t$links[] = $prefix . ltrim($flow, '/');\n\t\t}\n\t\treturn $links;\n\t}", "public static function build_routes() {\n $routes = array();\n\n $query = new WP_Query(array(\n 'post_type' => 'any',\n 'post_status' => 'publish',\n 'posts_per_page' => -1\n ));\n\n if ($query->have_posts()) {\n while ($query->have_posts()) {\n $query->the_post();\n $routes[] = array(\n 'id' => get_the_ID(),\n 'type' => get_post_type(),\n 'slug' => basename(get_permalink())\n );\n }\n }\n\n wp_reset_postdata();\n\n return $routes;\n }", "public function routes()\n {\n return page('routes')->children()->filterBy('section', '==', $this->uid());\n }", "public function getPaginate() {\n $data = $this->getDatas();\n if (empty($data)) {\n return $data;\n }\n $url = $_SERVER['REQUEST_URI'].(strpos($_SERVER['REQUEST_URI'],'?')?'':\"?\");\n $parse = parse_url($url);\n $path = $parse['path'];\n $params = array();\n if(isset($parse['query'])) {\n parse_str($parse['query'],$params);\n unset($params[$this->pageVar]);\n }\n\n $buildQuery = function($key,$val) use ($params) {\n $params[$key] = $val;\n return http_build_query($params);\n };\n\n $data['urls'] = array(\n 'firstPage' => $path.'?'.$buildQuery($this->pageVar,$data['firstPage']),\n 'lastPage' => $path.'?'.$buildQuery($this->pageVar,$data['lastPage']),\n 'prevPage' => $path.'?'.$buildQuery($this->pageVar,$data['prevPage']),\n 'nextPage' => $path.'?'.$buildQuery($this->pageVar,$data['nextPage']),\n );\n\n $_pages = array();\n foreach ($data['pageNums'] as $value) {\n $page_num = $value;\n $_pages[$page_num] = $path.'?'.$buildQuery($this->pageVar,$value);\n }\n $data['urls']['pageNums'] = $_pages;\n return $data;\n }", "public function getAllForSitemap() {\n $questions = $this->getAll('*');\n\n $urls = array();\n if (!empty($questions)) {\n foreach ($questions as $q) {\n $urls[] = array('loc' => $q['page_url']);\n }\n }\n\n return $urls;\n }", "function buildStaticPages() {\n global $pages;\n\n $list = array();\n $pagesKey = $pages->getStaticDB();\n foreach ($pagesKey as $pageKey) {\n try {\n $page = new Page($pageKey);\n array_push($list, $page);\n } catch (Exception $e) {\n // continue\n }\n }\n\n return $list;\n}", "private function parseUrls()\n\t{\n\t\tforeach ($this->urls as $url) {\n\t\t\t$urlEntity = $url->url;\n\t\t\tif ($urlEntity['isIndex'] && !$urlEntity['hideInSitemap'] && !empty($this->localesWebsites[$urlEntity['locale']])) {\n\t\t\t\t$entity = $url->entity;\n\t\t\t\t$entityObject = $url->entityObject;\n\t\t\t\t$interface = $url->interface;\n\t\t\t\tif (!empty($interface['classname']) && $interface['classname'] === Page::class && !$entity['isIndex']) {\n\t\t\t\t\t$this->setPage($entity, $url);\n\t\t\t\t} elseif (!empty($interface['classname']) && $interface['classname'] !== Page::class) {\n\t\t\t\t\t$this->setAsCard($entity, $entityObject, $interface, $url);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private function generateUrls() {\n $paths = [\n '/',\n ];\n\n $paths = $this->generateUrlsByContentTypes($paths);\n $paths = $this->generateUrlsByTaxonomies($paths);\n $paths = $this->generateUrlsByViews($paths);\n $paths = $this->generateUrlsByPageManager($paths);\n\n return $paths;\n }", "public static function getNextURLs(){\n\t\t\n\t\t// Get the global config\n\t\tglobal $CrawlerConfig;\n\t\t\n\t\t// Get the PDO object\n\t\t$db = self::pdo();\n\t\t\n\t\t// Return array\n\t\t$ret = array();\n\t\t\n\t\t/* Check if table is empty, if so, create a row in the table for \n\t\t * the starting URL from the config file then return an array containing\n\t\t * that single row.\n\t\t * \n\t\t * If there are rows in the table, get and return an array containing\n\t\t * all rows of URLs that have not been crawled yet.\n\t\t */\n\t\t\n\t\t// If the table is empty\n\t\tif(self::isTableEmpty()){\n\t\t\t\n\t\t\t// Generate the starting row\n\t\t\t$row = array(\n\t\t\t\t\"url\" => $CrawlerConfig[\"BASE_URL\"].$CrawlerConfig[\"INIT_PATH\"],\n\t\t\t\t\"title\" => \"Unknown Title\",\n\t\t\t\t\"body\" => \"<html></html>\",\n\t\t\t\t\"depth\" => 0,\n\t\t\t\t\"updated\" => time(),\n\t\t\t\t\"linked_from\" => 0\n\t\t\t);\n\t\t\t\n\t\t\tself::insertRow($row);\n\t\t\tarray_push($ret, $row);\n\t\t}\n\t\t\n\t\t// If the table is not empty\n\t\telse{\n\t\t\t\n\t\t\t// Get all rows that have not been crawled\n\t\t\t$q = $db->query(\"SELECT * FROM {$CrawlerConfig['CRAWLER_TABLE']} WHERE crawled = 0\");\n\t\t\t$ret = $q->fetchAll(PDO::FETCH_ASSOC);\n\t\t\t\n\t\t\tif($CrawlerConfig['DB_TYPE'] !== \"MySQL\"){\n\t\t\t\tforeach($ret as $r){\n\t\t\t\t\t$path = realpath(dirname(__FILE__)).\"/blobs\";\n\t\t\t\t\tif(file_exists(\"$path/{$r['body']}\"))\n\t\t\t\t\t\t$body = file_get_contents(\"$path/{$r['body']}\");\n\t\t\t\t\telse $body = \"<html></html>\";\n\t\t\t\t\t$r['body'] = $body;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn $ret;\n\t}", "public function routes()\n {\n return [\n [\n 'route' => 'page/(?:/(?P<name>\\D+))?',\n 'args' => [\n 'method' => WP_REST_Server::READABLE,\n 'callback' => [$this, 'get_page'],\n 'permission_callback' => '__return_true',\n 'args' => [\n 'name' => [\n 'validate_callback' => function ($param, $request, $key) {\n return true;\n }\n ]\n ]\n ]\n ],\n [\n 'route' => 'data',\n 'args' => [\n 'methods' => WP_REST_Server::READABLE,\n 'callback' => [$this, 'get_data'],\n 'permission_callback' => [$this, 'verify_nonce']\n ],\n ],\n [\n 'route' => 'search\\/(?P<query>\\D+)',\n 'args' => [\n 'methods' => WP_REST_Server::READABLE,\n 'callback' => [$this, 'search_data'],\n 'permission_callback' => [$this, 'verify_nonce'],\n 'args' => [\n 'query' => [\n 'required' => true,\n 'validate_callback' => function ($param, $request, $key) {\n return true;\n }\n ]\n ]\n ]\n ]\n ];\n }", "public function getUrlsList(){\n return $this->_get(2);\n }" ]
[ "0.64866257", "0.6074059", "0.5957594", "0.5954476", "0.59544104", "0.59544104", "0.5936055", "0.5903097", "0.5903097", "0.5903097", "0.5903097", "0.5903097", "0.5903097", "0.5875441", "0.58631516", "0.5838404", "0.58082014", "0.57796395", "0.5758627", "0.57301974", "0.57225084", "0.5714812", "0.56920487", "0.56734914", "0.56629485", "0.5661849", "0.5651162", "0.5634436", "0.5617928", "0.560992" ]
0.6990612
0
Check if log must be filtered. True is returned when log must be filtered, false instead.
public function filter(LogInterface $log): bool;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function canFilter() {\n return true;\n }", "public function filtersPass(): bool;", "public function shouldLog()\n {\n return config('corporate.logging', false);\n }", "public function shouldLog(): bool\n {\n return $this->shouldLog;\n }", "public function checkOnly(){\n\t\treturn ( !empty($this->filteringOptions['only']) ) ? true : false;\n\t}", "public function hasTrueFilter(){\n return $this->_has(2);\n }", "public function isFilterable(): bool\n {\n return $this->filterable;\n }", "public function hasFalseFilter(){\n return $this->_has(3);\n }", "public function hasFilter() \r\n\t{\r\n\t\treturn (true === (count($this->_filters) > 0));\r\n\t}", "function has_filters() {\n return false;\n }", "public function trelloDataIsFiltered()\n {\n //print_r( $this->trelloRawData() );\n }", "function CheckFilter() {\n\n\t// Check date popup filter\n\tif (!ewrpt_MatchedArray($GLOBALS[\"seld_date\"], $GLOBALS[\"sel_date\"]))\n\t\treturn TRUE;\n\n\t// Check unit popup filter\n\tif (!ewrpt_MatchedArray($GLOBALS[\"seld_unit\"], $GLOBALS[\"sel_unit\"]))\n\t\treturn TRUE;\n\n\t// Check fromtype popup filter\n\tif (!ewrpt_MatchedArray($GLOBALS[\"seld_fromtype\"], $GLOBALS[\"sel_fromtype\"]))\n\t\treturn TRUE;\n\n\t// Check category popup filter\n\tif (!ewrpt_MatchedArray($GLOBALS[\"seld_category\"], $GLOBALS[\"sel_category\"]))\n\t\treturn TRUE;\n\n\t// Check tocode popup filter\n\tif (!ewrpt_MatchedArray($GLOBALS[\"seld_tocode\"], $GLOBALS[\"sel_tocode\"]))\n\t\treturn TRUE;\n\n\t// Check todescription popup filter\n\tif (!ewrpt_MatchedArray($GLOBALS[\"seld_todescription\"], $GLOBALS[\"sel_todescription\"]))\n\t\treturn TRUE;\n\treturn FALSE;\n}", "public function hasFilters()\n {\n return session()->has($this->getSessionKey(static::TYPE_FILTERS));\n }", "public function isLoggingEnabled(): bool;", "public function hasFilter(string $name): bool;", "public function hasFilters(){\n return $this->_has(1);\n }", "public function hasFilters(){\n return $this->_has(1);\n }", "public function hasFilters()\n {\n return $this->delegate->hasFilters();\n }", "function is_log() {\n\tif( !empty($_SESSION['user']) && !empty($_SESSION['email']) )\n\t\treturn TRUE;\n\telse\n\t\treturn FALSE;\n}", "protected function isFilter($text){\n\n return $this->isFieldOrFunction($text);\n }", "public function checkExcept(){\n\t\treturn ( !empty($this->filteringOptions['except']) ) ? true : false;\n\t}", "function doFilter($k){ return !in_array($k, $this->filter); }", "protected function isLogging()\n {\n return Config::get('udemy.logging', false);\n }", "public function checkFilter($filter = null){\n if(!empty($filter)){\n // For each filter, check if the filter exist\n foreach($this->filters as $val){\n if($val == $filter)\n return true;\n }\n return false;\n }\n return true;\n }", "public function isFilter($key)\n {\n return false;\n }", "public function isFiltered()\n\t{\n\t\treturn ( isset($_GET['category']) && $_GET['category'] !== \"all\" ) ? true : false;\n\t}", "public function testFilter_notLogged()\n {\n $logger = new EchoLogger(LogLevel::WARNING);\n $logger->debug('something unimportant');\n $this->assertEquals(1, count($this->logFile()));\n }", "public function hasFilters()\n {\n return (! empty($this->_filters));\n }", "public function dataSyncShouldBeLogged() {\n return !property_exists($this, 'dataSyncLoggingDisabled') || $this->dataSyncLoggingDisabled === false;\n }", "public function isLogEnabled() {\r\n $config = $this->config; \r\n return $config->getPropertyValue(\"log.enabled\");\r\n }" ]
[ "0.673749", "0.67244166", "0.6531312", "0.6474954", "0.6337259", "0.63269275", "0.6266849", "0.62304115", "0.6195668", "0.618722", "0.6078672", "0.6052856", "0.6003865", "0.59892446", "0.59771544", "0.59465235", "0.59465235", "0.59448195", "0.59263295", "0.5919262", "0.5893325", "0.5876101", "0.5870967", "0.5838152", "0.5822231", "0.5816472", "0.58033335", "0.58018667", "0.5773601", "0.5762487" ]
0.7466027
0
Creates the compiler instance, configured with the given arguments. It can be rerun multiple times on new files with the same configuration. $includePathArray an array of paths, relative to the current directory, which will be used to resolve file paths. Cannot be null. $ignoredFileNameArray an array of the file names which will be ignored when a require is resolved (useful for files which include data which is invalid or redundant when compiled). Cannot be null.
public function __construct($includePathArray, $ignoredFileNameArray) { // This cannot be used this way. assert(null !== $includePathArray); // This cannot be used this way. assert(null !== $ignoredFileNameArray); $this->includePathArray = $includePathArray; $this->ignoredFileNameArray = $ignoredFileNameArray; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function __construct(Compiler $compiler, Filesystem $filesystem);", "public function compile()\n {\n $pharFile = 'refactor.phar';\n\n if (file_exists($pharFile)) {\n unlink($pharFile);\n }\n\n $phar = new \\Phar($pharFile, 0, 'refactor.phar');\n $phar->setSignatureAlgorithm(\\Phar::SHA1);\n\n $phar->startBuffering();\n\n $this->includeSrc($phar);\n $this->includeVendor($phar);\n $this->includeBin($phar);\n\n $phar->setStub($this->getStub());\n $phar->stopBuffering();\n\n unset($phar);\n }", "static public function scan(){\r\n // Initialize defaults\r\n self::$recursive = true;\r\n self::$directories = array();\r\n self::$files = array();\r\n self::$ext_filter = false;\r\n\r\n // Check we have minimum parameters\r\n if(!$args = func_get_args()){\r\n $args[0]=$_SERVER[\"DOCUMENT_ROOT\"].\"/2wframework\";\r\n }\r\n\r\n // filter with [.] php extension\r\n self::$ext_filter[] = strtolower('php');\r\n\r\n $files = self::verifyPaths($args[0]);\r\n self::requireFiles($files);\r\n }", "function testCompilerAuto() {\n \n // make input/output path absolute\n $this->c->setConfigOption('source_dirs', EP_TESTS.'/classes/bookstore/src');\n\n // compile (static)\n $this->assertTrue($this->c->compile());\n\n // get the class map file output by static compile\n $compiled_dir = $this->c->getConfigOption('compiled_dir');\n $compiled_file_static = $this->c->getConfigOption('compiled_file');\n \n // validate file\n $this->assertTrue(!empty($compiled_file_static));\n \n // get class map factory\n $this->assertTrue($cmf = epClassMapFactory::instance());\n \n // get all classes and include files from class map factory\n $this->assertTrue($cms = $cmf->allMade());\n $class_files = array(); // array to key class-file pairs\n foreach($cms as $cm) {\n $class_files[$cm->getName()] = $cm->getClassFile();\n }\n \n // make sure we have some classes\n $this->assertTrue(!empty($class_files));\n \n // auto-compile preparation: include all class files\n foreach($class_files as $class => $file) {\n include_once($file);\n }\n \n $cmf_string_static = $this->_cmfToString($cmf);\n \n // --------------------------------------------------------------\n // compile by passing class names\n \n // before auto-compile lets remove all class maps in class factory\n $cmf->removeAll();\n \n // make sure there is no class map in class map factory\n $this->assertFalse($cms = $cmf->allMade());\n $this->assertTrue(count($cms) == 0);\n \n // make up a new class file name\n $compiled_file_auto = $compiled_file_static . '.2';\n \n // set config to use new class map file \n $this->c->setConfigOption('compiled_file', $compiled_file_auto);\n \n // auto-compile each class\n foreach($class_files as $class => $file) {\n $this->assertTrue($this->c->compile($class));\n }\n \n // get contents of the two class map files\n $class_map_content_static = file_get_contents($this->c->getAbsolutePath($compiled_dir) . '/' . $compiled_file_static);\n $this->assertTrue($class_map_content_static);\n\n $class_map_content_auto = file_get_contents($this->c->getAbsolutePath($compiled_dir) . '/' .$compiled_file_auto);\n $this->assertTrue($class_map_content_auto);\n \n // check if results of static-compiled and auto-compiled are the same\n $cmf_string_auto = $this->_cmfToString($cmf);\n $this->assertTrue($cmf_string_static == $cmf_string_auto);\n \n // --------------------------------------------------------------\n // compile by passing objects \n \n // before auto-compile lets remove all class maps in class factory\n $cmf->removeAll();\n \n // make sure there is no class map in class map factory\n $this->assertFalse($cms = $cmf->allMade());\n $this->assertTrue(count($cms) == 0);\n \n // make up a new class file name\n $compiled_file_auto = $compiled_file_static . '.3';\n \n // set config to use new class map file \n $this->c->setConfigOption('compiled_file', $compiled_file_auto);\n \n // auto-compile each class\n foreach($class_files as $class => $file) {\n $this->assertTrue($o = new $class);\n $this->assertTrue($this->c->compile($o));\n }\n \n // get contents of the two class map files\n $class_map_content_static = file_get_contents($this->c->getAbsolutePath($compiled_dir) . '/' . $compiled_file_static);\n $this->assertTrue($class_map_content_static);\n $class_map_content_auto = file_get_contents($this->c->getAbsolutePath($compiled_dir) . '/' .$compiled_file_auto);\n $this->assertTrue($class_map_content_auto);\n \n // check if results of static-compiled and auto-compiled are the same\n $cmf_string_auto = $this->_cmfToString($cmf);\n $this->assertTrue($cmf_string_static == $cmf_string_auto);\n\n }", "public function compileFromFile($fileName) {}", "public function __construct(DocParser $docParser, FileSystem $fileSystem, array $includePaths) {\n $this->docParser = $docParser;\n $this->fileSystem = $fileSystem;\n $this->includePaths = $includePaths;\n }", "public function compile($autoloaderFilename = 'autoload.php', $mapFilename = 'autoload_map.php')\n {\n if (file_exists($mapFilename)) {\n unlink($mapFilename);\n }\n $mappings = '';\n\n foreach ($this->findPhpFile()->in($this->libPath . '/src') as $file) {\n $path = str_replace($this->libPath . '/src/', '', $file->getRealPath());\n $class = str_replace(array('/', '.php'), array('\\\\', ''), $path);\n $mappings .= \"\\$mappings['$class'] = \\$behatDir . 'src/$path';\\n\";\n }\n\n foreach ($this->findPhpFile()->in($this->libPath . '/vendor/Gherkin/src') as $file) {\n $path = str_replace($this->libPath . '/vendor/Gherkin/src/', '', $file->getRealPath());\n $class = str_replace(array('/', '.php'), array('\\\\', ''), $path);\n $mappings .= \"\\$mappings['$class'] = \\$gherkinDir . 'src/$path';\\n\";\n }\n\n $mappings .= \"\\nif (!defined('BEHAT_AUTOLOAD_SF2') || true === BEHAT_AUTOLOAD_SF2) {\\n\";\n foreach ($this->findPhpFile()->in($this->libPath . '/vendor/Symfony') as $file) {\n $path = str_replace($this->libPath . '/vendor/', '', $file->getRealPath());\n $class = str_replace(array('/', '.php'), array('\\\\', ''), $path);\n $mappings .= \" \\$mappings['$class'] = \\$symfonyDir . '$path';\\n\";\n }\n $mappings .= \"}\\n\";\n\n $mapContent = <<<MAP_FILE\n<?php\n\n\\$behatDir = __DIR__ . '/';\nif (is_dir(__DIR__ . '/vendor/Symfony/')) {\n \\$symfonyDir = __DIR__ . '/vendor/';\n} else {\n \\$symfonyDir = '';\n}\nif (!is_dir(\\$gherkinDir = __DIR__ . '/vendor/Gherkin/')) {\n \\$gherkinDir = 'gherkin/';\n}\n\n\\$mappings = array();\n$mappings\nreturn \\$mappings;\nMAP_FILE;\n\n file_put_contents($mapFilename, $mapContent);\n file_put_contents($autoloaderFilename, $this->getAutoloadScript($mapFilename));\n }", "protected function __construct() {\n $includePath = get_include_path();\n $this->paths = explode(PATH_SEPARATOR, $includePath);\n }", "public static function compile($source, $dest, $stripWhitespaces = true, $excludedFiles = array(), $excludedClasses = array())\n {\n $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), \r\n RecursiveIteratorIterator::LEAVES_ONLY);\r\n\r\n foreach ($it as $file) {\r\n $e = explode('.', $file->getFileName());\r\n // Filter files\r\n \r\n if (in_array($file->getFileName(), $excludedFiles)) {\r\n continue;\r\n }\r\n \r\n if (end($e) === 'php' && strpos($file->getFileName(), '.inc') === false) {\r\n require_once($file->getPathName());\r\n }\r\n }\r\n \r\n $classes = array_merge(get_declared_classes(), get_declared_interfaces());\r\n \r\n $result = array();\r\n foreach ($classes as $class) {\r\n if (in_array($class, $excludedClasses)) {\r\n continue;\r\n }\r\n \r\n $reflection = new ReflectionClass($class);\r\n $file = $reflection->getFileName();\r\n \r\n // Embeded class like SPL etc\r\n if (!$file || !file_exists($file)) {\r\n continue;\r\n }\r\n \r\n // Skip self class\r\n if ($class == 'Adept_SourceCompiler') {\r\n continue;\r\n }\r\n\r\n $lines = file($file);\r\n \r\n $start = $reflection->getStartLine() - 1;\r\n $end = $reflection->getEndLine();\r\n \r\n $classCodeLines = array_slice($lines, $start, ($end - $start));\r\n\r\n $result = array_merge($result, $classCodeLines);\r\n } \r\n \r\n // Source bundle\r\n $result = implode(\"\", $result);\r\n \r\n $fp = @fopen($dest, 'w');\r\n if ($fp === false) {\r\n return false;\r\n }\r\n \r\n fwrite($fp, '<' . '?php ' . $result);\r\n fclose($fp);\r\n\r\n if ($stripWhitespaces) {\r\n \r\n // Strip php whiltespaces on result file.\r\n $stripped = php_strip_whitespace($dest);\r\n \r\n // Save stripped content.\r\n $fp = @fopen($dest, 'w');\r\n if ($fp === false) {\r\n return false;\r\n }\r\n fwrite($fp, $stripped);\r\n fclose($fp);\r\n }\r\n\r\n return true;\r\n }", "public function compileScan() {\n\t\t\n\t\t// TODO: The following is very platform and configuration specific! This needs to be moved into a config file or generalized to just \"coffee --help\"\n\t\texec( \"C:\\\\npm\\\\coffee --help\", $coffeeTest );\n\t\t$coffeeTest = implode( $coffeeTest );\n\t\tif( false === strpos( $coffeeTest, \"coffee [options]\" ) ) {\n\t\t\tthrow new Exception( \"CoffeeScript compiler could not be found in Page.compileScan\" );\n\t\t}\n\t\t\n\t\t// TODO: The following is very platform and configuration specific! This needs to be moved into a config file or generalized to just \"lessc --help\"\n\t\texec( \"C:\\\\npm\\\\lessc --help\", $lessTest );\n\t\t$lessTest = implode( $lessTest );\n\t\tif( false === strpos( $lessTest, \"lessc [options]\" ) ) {\n\t\t\tthrow new Exception( \"LESS compiler could not be found in Page.compileScan\" );\n\t\t}\n\t\t\n\t\t// Empty out the webroot folder of everything except the \"router.php\" file\n\t\t\n\t\t$directory = new RecursiveDirectoryIterator( WEBROOT );\n\t\t$iterator = new RecursiveIteratorIterator( $directory, RecursiveIteratorIterator::CHILD_FIRST );\n\t\tforeach( $iterator as $filePath => $fileObject ) {\n\t\t\tif( basename( $filePath ) == \"router.php\" ) continue;\n\t\t\tif( is_file( $filePath ) ) unlink( $filePath );\n\t\t\tif( is_dir( $filePath ) ) rmdir( $filePath );\n\t\t}\n\t\t\n\t\t// Recursively scan through every folder in \"source\" and process files into local arrays for further processing and eventual placement into webroot\n\t\t\n\t\t$cssFiles = [];\n\t\t$jsFiles = [];\n\t\t$directory = new RecursiveDirectoryIterator( SOURCE );\n\t\t$iterator = new RecursiveIteratorIterator( $directory, RecursiveIteratorIterator::CHILD_FIRST );\n\t\tforeach( $iterator as $filePath => $fileObject ) {\n\t\t\t$ext = strtolower( pathinfo($filePath, PATHINFO_EXTENSION) );\n\t\t\t$relPath = str_replace( \"\\\\\", \"/\", str_replace( SOURCE, \"\", $filePath ) );\n\t\t\t\n\t\t\tif( in_array( $ext, $this->_statics ) ) {\n\t\t\t\t$source = $filePath;\n\t\t\t\t$destination = str_replace( SOURCE, WEBROOT, $filePath );\n\t\t\t\t$folder = dirname( $destination );\n\t\t\t\tif( ! is_dir( $folder ) ) mkdir( $folder, 0777, true );\n\t\t\t\tcopy( $source, $destination );\n\t\t\t}\n\t\t\t\n\t\t\tif( \"css\" == $ext ) {\n\t\t\t\t$cssFiles[ $relPath ] = file_get_contents( $filePath );\n\t\t\t}\n\t\t\t\n\t\t\tif( \"js\" == $ext ) {\n\t\t\t\t$jsFiles[ $relPath ] = file_get_contents( $filePath );\n\t\t\t}\n\t\t\t\n\t\t\tif( \"less\" == $ext ) {\n\t\t\t\texec( \"C:\\\\npm\\\\lessc -x \\\"$filePath\\\"\", $lessCompiled );\n\t\t\t\t$cssFiles[ $relPath ] = implode( \"\\n\", $lessCompiled );\n\t\t\t}\n\t\t\t\n\t\t\tif( \"coffee\" == $ext ) {\n\t\t\t\texec( \"C:\\\\npm\\\\coffee -p \\\"$filePath\\\"\", $coffeeCompiled );\n\t\t\t\t$jsFiles[ $relPath ] = implode( \"\\n\", $coffeeCompiled );\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Build the CSS document string that shall become the contents of the CSS file\n\t\t\n\t\t$cssString = \"\";\n\t\t\n\t\tforeach( self::$_cssOrder as $relPath ) {\n\t\t\tif( $cssString != \"\" ) $cssString .= \" \";\n\t\t\t$cssString .= $cssFiles[ $relPath ];\n\t\t\tunset( $cssFiles[ $relPath ] );\n\t\t}\n\t\t\n\t\tforeach( $cssFiles as $cssFile ) {\n\t\t\tif( $cssString != \"\" ) $cssString .= \" \";\n\t\t\t$cssString .= $cssFile;\n\t\t}\n\t\t\n\t\t// Build the JS document string that shall become the contents of the JS file\n\t\t\n\t\t$jsString = \"\";\n\t\t\n\t\tforeach( self::$_jsOrder as $relPath ) {\n\t\t\tif( $jsString != \"\" ) $jsString .= \" \";\n\t\t\t$jsString .= $jsFiles[ $relPath ];\n\t\t\tunset( $jsFiles[ $relPath ] );\n\t\t}\n\t\t\n\t\tforeach( $jsFiles as $jsFile ) {\n\t\t\tif( $jsString != \"\" ) $jsString .= \" \";\n\t\t\t$jsString .= $jsFile;\n\t\t}\n\t\t\n\t\t// Keep track of the md5 signatures of the CSS and JS document strings\n\t\t\n\t\t$this->_cssMd5 = md5( $cssString );\n\t\t$this->_jsMd5 = md5( $jsString );\n\t\t\n\t\t// Save the CSS and JS files with the md5 signatures as the filenames\n\t\t\n\t\tfile_put_contents( WEBROOT . \"/\" . $this->_cssMd5 . \".css\", $cssString );\n\t\tfile_put_contents( WEBROOT . \"/\" . $this->_jsMd5 . \".js\", $jsString );\n\t\t\n\t\t// Save the md5 signatures of the CSS and JS files where it can be found later\n\t\t\n\t\tif( ! is_dir( DATA . \"/Page\" ) ) mkdir( DATA . \"/Page\", 0777, true );\n\t\t$resources = [\n\t\t\t\"cssMd5\" => $this->_cssMd5,\n\t\t\t\"jsMd5\" => $this->_jsMd5\n\t\t];\n\t\tfile_put_contents( DATA . \"/Page/resources.md5\", serialize( $resources ) );\n\t}", "public function compile(CompilationParams $params): array\n {\n // Create a separate directory where all *.class files will end up.\n $mkdirTask = new Task();\n $mkdirTask->setPriority(Priorities::$INITIATION);\n $mkdirTask->setType(TaskType::$INITIATION);\n $mkdirTask->setCommandBinary(TaskCommands::$MKDIR);\n $mkdirTask->setCommandArguments(\n [\n ConfigParams::$SOURCE_DIR . $this->getDirectory() .\n ConfigParams::$PATH_DELIM . self::$COMPILATION_SUBDIR\n ]\n );\n\n // Prepare compile task\n $compileTask = $this->compileBaseTask($params);\n $compileTask->setCommandBinary($this->getInputPortValue(self::$COMPILER_EXEC_PORT_KEY)->getValue());\n\n $args = [];\n if ($this->hasInputPortValue(self::$ARGS_PORT_KEY)) {\n $args = $this->getInputPortValue(self::$ARGS_PORT_KEY)->getValue();\n }\n\n // First order of business -- make sure all *.class files will be yielded to prepared dir (but in eval box)\n $args[] = '-d';\n $args[] = ConfigParams::$EVAL_DIR . self::$COMPILATION_SUBDIR;\n\n // if there were some provided jar files, lets add them to the command line args\n $classpath = JavaUtils::constructClasspath($this->getInputPortValue(self::$JAR_FILES_PORT_KEY));\n $args = array_merge($args, $classpath);\n\n // the whole directory with compiled classes is handed over to the upcoming tasks\n $this->getOutputPortValue(self::$CLASS_FILES_DIR_PORT_KEY)->setValue(self::$COMPILATION_SUBDIR);\n\n $compileTask->setCommandArguments(\n array_merge(\n $args,\n $this->getInputPortValue(self::$SOURCE_FILES_PORT_KEY)\n ->getValue(ConfigParams::$EVAL_DIR),\n $this->getInputPortValue(self::$EXTRA_FILES_PORT_KEY)\n ->getValue(ConfigParams::$EVAL_DIR)\n )\n );\n\n return [$mkdirTask, $compileTask];\n }", "public function __construct($filename = NULL, $config = NULL, $encoding = NULL, $use_include_path = NULL)\n {\n }", "function generate() {\n $nativeSrcDir = $this->projDir . \"/\" . $this->projectFile->nativeSourceDir;\n foreach (OneFile::listFiles($nativeSrcDir, true) as $fn)\n OneFile::copy($nativeSrcDir . \"/\" . $fn, $this->outDir . \"/\" . $fn);\n \n $generators = array(new JavaGenerator(), new CsharpGenerator(), new PythonGenerator(), new PhpGenerator());\n foreach ($this->projectFile->projectTemplates as $tmplName) {\n $compiler = CompilerHelper::initProject($this->projectFile->name, $this->srcDir, $this->projectFile->sourceLang, null);\n $compiler->processWorkspace();\n \n $projTemplate = new ProjectTemplate($this->baseDir . \"/project-templates/\" . $tmplName);\n $langId = $projTemplate->meta->language;\n $generator = \\OneLang\\Core\\ArrayHelper::find($generators, function ($x) use ($langId) { return strtolower($x->getLangName()) === $langId; });\n $langName = $generator->getLangName();\n $outDir = $this->outDir . \"/\" . $langName;\n \n foreach ($generator->getTransforms() as $trans)\n $trans->visitFiles(array_values($compiler->projectPkg->files));\n \n // copy implementation native sources\n $oneDeps = array();\n $nativeDeps = Array();\n foreach ($this->projectFile->dependencies as $dep) {\n $impl = \\OneLang\\Core\\ArrayHelper::find($compiler->pacMan->implementationPkgs, function ($x) use ($dep) { return $x->content->id->name === $dep->name; });\n $oneDeps[] = $impl;\n $langData = (@$impl->implementationYaml->languages[$langId] ?? null);\n if ($langData === null)\n continue;\n \n foreach ($langData->nativeDependencies ?? array() as $natDep)\n $nativeDeps[$natDep->name] = $natDep->version;\n \n if ($langData->nativeSrcDir !== null) {\n if ($projTemplate->meta->packageDir === null)\n throw new \\OneLang\\Core\\Error(\"Package directory is empty in project template!\");\n $srcDir = $langData->nativeSrcDir . ((substr_compare($langData->nativeSrcDir, \"/\", strlen($langData->nativeSrcDir) - strlen(\"/\"), strlen(\"/\")) === 0) ? \"\" : \"/\");\n $dstDir = $outDir . \"/\" . $projTemplate->meta->packageDir . \"/\" . ($langData->packageDir ?? $impl->content->id->name);\n $depFiles = array_map(function ($x) use ($srcDir) { return substr($x, strlen($srcDir)); }, array_values(array_filter(array_keys($impl->content->files), function ($x) use ($srcDir) { return (substr_compare($x, $srcDir, 0, strlen($srcDir)) === 0); })));\n foreach ($depFiles as $fn)\n OneFile::writeText($dstDir . \"/\" . $fn, (@$impl->content->files[$srcDir . $fn] ?? null));\n }\n \n if ($langData->generatorPlugins !== null)\n foreach ($langData->generatorPlugins as $genPlugFn)\n $generator->addPlugin(new TemplateFileGeneratorPlugin($generator, (@$impl->content->files[$genPlugFn] ?? null)));\n }\n \n // generate cross compiled source code\n \\OneLang\\Core\\console::log(\"Generating \" . $langName . \" code...\");\n $files = $generator->generate($compiler->projectPkg);\n foreach ($files as $file)\n OneFile::writeText($outDir . \"/\" . ($projTemplate->meta->destinationDir ?? \"\") . \"/\" . $file->path, $file->content);\n \n // generate files from project template\n $model = new ObjectValue(Array(\n \"dependencies\" => new ArrayValue(array_map(function ($name) use ($nativeDeps) { return new ObjectValue(Array(\n \"name\" => new StringValue($name),\n \"version\" => new StringValue((@$nativeDeps[$name] ?? null))\n )); }, array_keys($nativeDeps))),\n \"onepackages\" => new ArrayValue(array_map(function ($dep) { return new ObjectValue(Array(\n \"vendor\" => new StringValue($dep->implementationYaml->vendor),\n \"id\" => new StringValue($dep->implementationYaml->name)\n )); }, $oneDeps))\n ));\n $projTemplate->generate($outDir, $model);\n }\n }", "private function initialize()\n {\n if ($this->initialized === true) {\n return;\n }\n\n $paths = glob($this->pattern, \\GLOB_BRACE);\n $sources = array_map(function ($path) {\n return new DefinitionFile($path, $this->autowiring);\n }, $paths);\n $this->sourceChain = new SourceChain($sources);\n\n $this->initialized = true;\n }", "public function __construct(array $options = [])\n {\n if (isset($options['excludeDirs']) && is_array($options['excludeDirs'])) {\n $this->setExcludeDirs($options['excludeDirs']);\n }\n if (isset($options['excludeFiles']) && is_array($options['excludeFiles'])) {\n $this->setExcludeFiles($options['excludeFiles']);\n }\n if (isset($options['extensionsToParse']) && is_array($options['extensionsToParse'])) {\n $this->setExtensionsToParse($options['extensionsToParse']);\n }\n if (isset($options['enableDebug']) && is_bool($options['enableDebug'])) {\n Util::setEnableDebug(true);\n }\n }", "protected function _compileFiles()\n {\n $classesInfo = $this->getCompileClassList();\n\n foreach ($classesInfo as $code => $classes) {\n //Hotfix for double declaration of Currency class on checkout\n if (Mage::helper(\"shopgate/config\")->getIsMagentoVersionLower('1.7.0.2')\n && $code === 'checkout'\n && (($key = array_search('Mage_Directory_Model_Currency', $classes)) !== false)\n ) {\n unset($classes[$key]);\n }\n $classesSorce = $this->_getClassesSourceCode($classes, $code);\n file_put_contents(\n $this->_includeDir . DS . Varien_Autoload::SCOPE_FILE_PREFIX . $code . '.php',\n $classesSorce\n );\n }\n\n return $this;\n }", "public function setCompilerOptions(array $options)\n {\n $this->compilerOptions = $options;\n\n return $this;\n }", "public function compile() {}", "protected function prepareCompiler(string $path)\n {\n $this->compiler->list = $this->getList();\n $this->compiler->autoloader = $this->autoloader;\n $this->compiler->contents = file_get_contents(static::STUB_LOCATION);\n $this->compiler->opcacheConfig = $this->getOpcacheConfig();\n $this->compiler->preloaderConfig = $this->getPreloaderConfig();\n $this->compiler->useRequire = $this->useRequire;\n $this->compiler->ignoreNotFound = $this->ignoreNotFound;\n $this->compiler->autoloader = $this->autoloader;\n $this->compiler->writeTo = $path;\n\n return $this->compiler;\n }", "static public function prepare(array $parameters = [])\n {\n $currentDir = realpath(dirname(__FILE__));\n\n self::$countryCodes = include $currentDir . '\\CountryCodes.php';\n\n if (array_key_exists('locale', $parameters)) {\n self::setLocale(strtolower($parameters['locale']));\n }\n\n if (array_key_exists('fallbackLocale', $parameters)) {\n self::setLocale(strtolower($parameters['fallbackLocale']), 1);\n }\n\n if (array_key_exists('langDir', $parameters)) {\n self::$langDir = $parameters['langDir'];\n } else {\n self::$langDir = $currentDir . '\\languages';\n }\n }", "public function __construct( $args, $assoc_args ) {\n\t\tif ( empty( $args ) ) {\n\t\t\tWP_CLI::line( \"usage: wp eval-file <path>\" );\n\t\t\texit;\n\t\t}\n\n\t\tforeach ( $args as $file ) {\n\t\t\tif ( !file_exists( $file ) ) {\n\t\t\t\tWP_CLI::error( \"'$file' does not exist.\" );\n\t\t\t} else {\n\t\t\t\tinclude( $file );\n\t\t\t}\n\t\t}\n\t}", "protected function compileClasses()\n {\n $outputPath = $this->nova['path'] .DS .'Boot' .DS .'Compiled.php';\n\n //\n $config = array('skip' => true);\n\n $preloader = with(new Factory)->create($config);\n\n $handle = $preloader->prepareOutput($outputPath);\n\n foreach ($this->getClassFiles() as $file) {\n try {\n fwrite($handle, $preloader->getCode($file, false).\"\\n\");\n } catch (VisitorExceptionInterface $e) {\n //\n }\n }\n\n fclose($handle);\n }", "static function setIncludePath($array)\r\n\t{\r\n\t\tself::$_includePath = $array;\r\n\t}", "public function __construct(string $sources, array $excludes, bool $ignoreFilters = false, array $dirExcludes = [])\n {\n $fs = new Filesystem();\n\n $sources = $fs->normalizePath(realpath($sources));\n\n if ($ignoreFilters) {\n $filters = [];\n } else {\n $filters = [\n new GitExcludeFilter($sources),\n new ComposerExcludeFilter($sources, $excludes),\n ];\n }\n\n $this->finder = new Finder();\n\n $filter = static function (\\SplFileInfo $file) use ($sources, $filters, $fs): bool {\n if ($file->isLink() && ($file->getRealPath() === false || strpos($file->getRealPath(), $sources) !== 0)) {\n return false;\n }\n\n $relativePath = Preg::replace(\n '#^'.preg_quote($sources, '#').'#',\n '',\n $fs->normalizePath($file->getRealPath())\n );\n\n $exclude = false;\n foreach ($filters as $filter) {\n $exclude = $filter->filter($relativePath, $exclude);\n }\n\n return !$exclude;\n };\n\n if (method_exists($filter, 'bindTo')) {\n $filter = $filter->bindTo(null);\n }\n\n $this->finder\n ->in($sources)\n ->filter($filter)\n ->exclude($dirExcludes) // Changes by plugin\n ->ignoreVCS(true)\n ->ignoreDotFiles(false)\n ->sortByName();\n\n \\FilterIterator::__construct($this->finder->getIterator());\n }", "public function __construct($argv)\n\t{ \n\t //$this->generated_dir = GENERATED;\n\t $this->overwrite = 'false';\n\t $this->is_extends = 'false';\n\t \n\t if (!array_key_exists('0', $argv) || ($argv[0] != 'backend' && $argv[0] != 'frontend')) {\n\t unset($argv);\n\t while (!isset($argv))\n\t {\n\t fwrite(STDOUT, \"Build Module For? (backend, frontend) or type 'exit': \");\n\t $user = trim(fgets(STDIN));\n\t \n\t if ($user == 'exit') {\n\t exit(0);\n\t }\n\t elseif ($user != '' && ($user == 'backend' || $user == 'frontend')) {\n\t $argv[0] = $user;\n\t $this->generated_dir .= $argv[0];\n\t }\n\t }\n\t }\n\t\n if ($argv[0] == 'help') {\n $this->help();\n exit(0);\n }\n // set location for generated modules (based on application frontend or backend\n $this->generated_dir = GENERATED_MODULES.DIRECTORY_SEPARATOR.$argv[0];\n // Module Name\n\t if (!array_key_exists('1', $argv)) {\n\t while (!array_key_exists('1', $argv))\n {\n fwrite(STDOUT, \"Enter a ModuleName: \");\n $user = trim(fgets(STDIN));\n \n if ($user == 'exit') {\n exit(0);\n }\n elseif ($user != '') {\n $argv[1] = $this->camelCase($user);\n $this->moduleName = $this->camelCase($argv[1]);\n }\n }\n // Controller Name\n fwrite(STDOUT, \"Enter a Controller Name (default Index): \");\n $user = trim(fgets(STDIN));\n \n if ($user == 'exit') {\n exit(0);\n }\n elseif ($user != '') {\n $this->controller_name = ucfirst(strtolower($this->camelCase($user)));\n }\n else {\n $this->controller_name = 'Index';\n }\n\t // Table Name\n\t $tb_name = '';\n\t while ($tb_name == '')\n\t {\n fwrite(STDOUT, \"Table for CRUD (default none): \");\n $user = trim(fgets(STDIN));\n \n if ($user == 'exit') {\n exit(0);\n }\n elseif ($user != '') {\n if (!class_exists($user)) {\n fwrite(STDOUT, \"Doctrine Class \".$user.\" does not exist\\n\");\n }\n else {\n $tb_name = $user;\n $argv[2] = $user;\n }\n }\n else {\n $tb_name = 'none';\n }\n\t }\n }\n\t \n\t if (!file_exists(PROJECT_LOCATION.'/library/')) {\n\t $this->kill(\"cannot run from \",PROJECT_LOCATION);\n\t }\n\t \n\t // In Order to specify controller, we'll use an underscore\n\t if ($this->moduleName == '') {\n \t if (substr_count($argv[1], '_') > 0) {\n \t $temp = explode('_', $argv[1]);\n \t $this->controller_name = ucfirst(strtolower(array_pop($temp)));\n \t if (is_array($temp)) {\n \t $this->moduleName = ($this->camelCase(implode(' ', $temp)));\n \t }\n \t else {\n \t $this->moduleName = ucfirst($this->camelCase($temp));\n \t }\n \t }\n \t else {\n \t $this->moduleName = $this->camelCase($argv[1]);\n \t $this->controller_name = 'Index';\n \t }\n\t }\n\t $this->app = $argv[0];\n \n $this->moduleNameGenerated = $this->moduleName;\n $this->moduleNameVar = strtolower($this->moduleName);\n \n\t if (array_key_exists(2, $argv)) {\n if (!class_exists($argv[2])) {\n $this->error($argv['2'].\" class does not exist.\");\n $this->help();\n }\n $this->tableName = $argv[2];\n $tmp = explode(' ', trim(preg_replace('/([A-Z])/', ' $1', $this->tableName)));\n $as = '';\n \n foreach ($tmp as $t) {\n $as .= $t[0];\n }\n $this->table_as = strtolower($as);\n unset($tmp, $as);\n }\n $this->info();\n\t\t$this->process();\n\t}", "public static function createJsCompiler(IFileCollection $files, string $outputDir): self\n\t{\n\t\treturn new self($files, DefaultOutputNamingConvention::createJsConvention(), $outputDir);\n\t}", "public function setConstructArgs(array $arguments);", "private function __construct($filepath, $type = 'ARRAY')\n {\n $this->options = include $filepath;\n }", "protected abstract function compile();", "public static function setup(array $paths = []) {\n\t\t$folders = [\n\t\t\t'controllers',\n\t\t\t'models',\n\t\t\t'views',\n\t\t\t'includes',\n\t\t\t'system'\n\t\t];\n\n\t\tforeach($folders as $folder) {\n\t\t\t$var_name = $folder . '_path';\n\t\t\tself::$$var_name = self::remove_slashes( isset($paths[$folder]) ? $paths[$folder] : \"../$folder\" );\n\t\t}\n\n\t\t//classes folder a little different a resides in includes.\n\t\tself::$classes_path = self::remove_slashes($paths['classes'] ?: (self::$includes_path . '/classes'));\n\t}" ]
[ "0.5214597", "0.52066594", "0.5163361", "0.5111166", "0.51072973", "0.50808185", "0.5064473", "0.5009794", "0.4903504", "0.4894944", "0.48798943", "0.4877112", "0.4856427", "0.48441136", "0.4834527", "0.4778305", "0.4762948", "0.47330764", "0.4720719", "0.47206146", "0.47125393", "0.47009405", "0.46321443", "0.46283075", "0.4626203", "0.4611679", "0.4607576", "0.45628068", "0.45586723", "0.4537911" ]
0.6629558
0
Starts preprocessing the given $inputFilePath, returning the string, up to and including the first PHP start.
public function start($inputFilePath) { // This cannot be used this way. assert(null !== $inputFilePath); $realInputPath = realpath($inputFilePath); assert(false !== $realInputPath); // Set up the receiver ivar state. $this->alreadyIncludedPathArray = array(); $this->alreadyReferencedFileNamesArray = array(); $this->lineStack = array(); $this->fileStack = array(); $this->lineNumberStack = array(); $this->startingDirectory = dirname($realInputPath); $this->currentLines = array(); $this->currentFileName = ''; $this->currentLineNumber = 0; $toReturn = null; list($preLines, $lines, $this->postLines) = $this->_loadFile($realInputPath); if (null === $this->error) { // Process these lines until we find one containing only the PHP start. if (count($lines) > 0) { $this->currentLines = $lines; $this->currentFileName = $realInputPath; $this->currentLineNumber = count($preLines); } $toReturn = $preLines; } return array($toReturn, $this->error); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)\n\t{\n\t\t$filename = $phpcsFile->getFilename();\n\t\tif ($filename === 'STDIN') {\n\t\t\treturn;\n\t\t}\n\n\t\t$filename = basename($filename);\n\t\t$lowercaseFilename = strtolower($filename);\n\t\tif ($filename !== $lowercaseFilename) {\n\t\t\tif (!$this->checkAutoloadNamespaceClass($phpcsFile, $stackPtr)) {\n\t\t\t\t$data = array(\n\t\t\t\t\t$filename,\n\t\t\t\t\t$lowercaseFilename,\n\t\t\t\t);\n\t\t\t\t$error = 'Filename \"%s\" doesn\\'t match the expected filename \"%s\"';\n\t\t\t\t$phpcsFile->addError($error, $stackPtr, 'NotFound', $data);\n\t\t\t\t$phpcsFile->recordMetric($stackPtr, 'Lowercase filename', 'no');\n\t\t\t} else {\n\t\t\t\t$phpcsFile->recordMetric($stackPtr, 'Lowercase filename', 'no. psr-0 autoload detected');\n\t\t\t}\n\t\t} else {\n\t\t\t$phpcsFile->recordMetric($stackPtr, 'Lowercase filename', 'yes');\n\t\t}\n\n\t\t// Ignore the rest of the file.\n\t\treturn ($phpcsFile->numTokens + 1);\n\t}", "public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {\n\n\t\t$filename = $phpcsFile->getFilename();\n\t\tif ($filename === 'STDIN') {\n\t\t\treturn;\n\t\t}\n\n\t\t$filename = basename($filename);\n\t\t$lowercaseFilename = strtolower($filename);\n\t\tif ($filename !== $lowercaseFilename) {\n\t\t\t$data = array(\n\t\t\t\t\t $filename,\n\t\t\t\t\t $lowercaseFilename,\n\t\t\t\t\t );\n\t\t\t$error = 'Lowercase filenames are preferred.';\n\t\t\t$phpcsFile->addWarning($error, $stackPtr, 'NotFound', $data);\n\t\t\t$phpcsFile->recordMetric($stackPtr, 'Lowercase filename', 'no');\n\t\t} else {\n\t\t\t$phpcsFile->recordMetric($stackPtr, 'Lowercase filename', 'yes');\n\t\t}\n\n\t\t// Ignore the rest of the file.\n\t\treturn ($phpcsFile->numTokens + 1);\n\n\t}", "private function convertInputFile(): string\n {\n // Split the content in an array on new line \"\\n\"\n $contentLines = explode(\"\\n\", $this->content);\n\n $class = [];\n $classNames = [];\n foreach ($contentLines as $line) {\n // We exclude blank line\n if ($line == '') {\n continue;\n }\n\n // We got a new class\n if (strpos($line, '{')) {\n // The class name is the line content without bracket\n $classNames[] = str_replace(' {', '', $line);\n continue;\n }\n\n // If end of class definition => remove last class name\n if (strpos($line, '}') !== false) {\n array_pop($classNames);\n continue;\n }\n\n $class[implode(' ', $classNames)][] = $line;\n }\n\n // We generate the new content with the array of class\n $newContent = '';\n foreach ($class as $key => $classItem) {\n $newContent .= \"\\n\" . $key . \" { \\n\" . implode(\"\\n\", $classItem) . \"\\n}\";\n }\n\n $pathInfo = pathinfo($this->filePath);\n $newFilePath = $pathInfo['dirname'] . '/' . $pathInfo['filename'] . '-compiled.css';\n File::put($newFilePath, $newContent);\n\n Log::info('New file generated : ' . $newFilePath);\n return $newFilePath;\n }", "private function loadSource()\n {\n $source = rtrim(trim(\\file_get_contents($this->_path)), '}');\n $this->_source = \\preg_replace('/\\<\\?php/', '', $source, 1);\n }", "public function preprocess();", "function import_start($file)\n {\n }", "function pre_split_work_phpcode(&$line,&$rem_state,$list_string_tag,$list_string_tag_id) {\n/*\nThis function manages the $line when in a php state ($rem_state['rem_state'] = 1)\n*/\n\t\n// drop escapes (hopefully inside strings!)\n$line = drop_escapes($line);\n\n// in PHP code, you can drop strings\n$line = drop_strings($line);\n\n// search for rem closing tags\n$tag = '?>';\n$rem_state_restart_tag = '<?php'; // tag to search in following text to exit the out-of-php-code state (0)\n$ind = strfind($line,$tag);\n\nif ($ind === False)\n{\n\t$tag = '/*';\n\t$rem_state_restart_tag = '*/'; // tag to search in following text to exit the out-of-php-code state (0)\n\t$ind = strfind($line,$tag);\n}\n\n// verify if a potential rem closing tag is inside a string\nif ( ($ind > 0) && (strlen($line) > 0) )\n{\n\t$line = drop_strings(substr($line,0,$ind)).substr($line,$ind);\n\t$ind = strfind($line,$tag);\n\t\n\tpreg_match_all(\"/'/\",substr($line,0,$ind),$z);\n\tif ( count($z[0]) % 2 == 1 )\n\t{\n\t\t$ind = False; // if so, don't consider it\n\t}\n}\n\n// if a rem tag (\"<?php\" or \"/*\") was found, change the state\nif ($ind !== False)\n{\n\t$line2 = substr($line,0,$ind);\n\t$rem_state['rem_state'] = 0;\n\t$rem_state['rem_state_restart_tag'] = $rem_state_restart_tag; // save the restart tag: only its occurrence will restart php code\n\t\n\t$temp_result = pre_split_work(substr($line,$ind+strlen($tag)), $rem_state);\n\t$line3 = $temp_result[0];\n\t$rem_state = $temp_result[1];\n// \t\t$line = $line2.';'.$line3;\n\t$line = $line2.' '.$line3; // join code before and after a /*...*/ comment by a blank space\n}\n\n\n// search for multiline unclosed string\n$line2 = drop_strings($line);\nfor ($i_tag = 0;$i_tag < count($list_string_tag);$i_tag++)\n{\n\t$string_tag = $list_string_tag[$i_tag];\n\t$string_tag_id = $list_string_tag_id[$i_tag];\n\tpreg_match_all(\"/$string_tag/\",$line2,$z);\n\tif ( count($z[0]) % 2 == 1 )\n\t{\n\t\t$line = $line2.\" \".$string_tag;\n\t\t$rem_state['rem_state'] = $string_tag_id;\n\t\tbreak;\n\t}\n}\n\n// search for heredoc string opening tag\n$string_tag = '<<<([a-zA-Z_][a-zA-Z0-9_]+)$';\npreg_match_all(\"/$string_tag/\",$line,$z);\n\nif ( isset($z[1][0]) && (count($z[1][0]) > 0) )\n{\n\t$heredoc_close_tag = $z[1][0];\n\tpreg_match(\"/$string_tag/\",$line,$z,PREG_OFFSET_CAPTURE);\n\t$pos = $z[0][1];\n\t\n\t$line2 = drop_strings(substr($line,0,$pos));\n\t$line = $line2.' \" \";';\n\t$rem_state['rem_state'] = max($list_string_tag_id)+1;\n\t$rem_state['heredoc_close_tag'] = $heredoc_close_tag;\n}\n\nreturn Array($line,$rem_state);\n\n}", "public function input($filename, $input) {\n\t\tif (substr($filename, strlen($this->_settings['ext']) * -1) !== $this->_settings['ext']) {\n\t\t\treturn $input;\n\t\t}\n\t\t$cmd = $this->_settings['node'] . ' ' . $this->_settings['coffee'] . ' -c -p -s ';\n\t\t$env = array('NODE_PATH' => $this->_settings['node_path']);\n\t\treturn $this->_runCmd($cmd, $input, $env);\n\t}", "public function input($filename, $content) {\n\t\tApp::import('Vendor', 'coffeescript-php', array('file' => $this->_settings['path']));\n\t\tCoffeeScript\\Init::load();\n\t\treturn CoffeeScript\\Compiler::compile($content);\n\t}", "private function open_php( &$src ){\n\t\tif( ! $this->inphp ){\n\t\t\t$this->inphp = true;\n\t\t\t\n\t\t\t// this may result in back to back tags, which we can avoid with a bit of string manipulation.\n\t\t\t$makenice = $this->opt(COMPILER_OPTION_NICE_TAGS);\n\t\t\t\n\t\t\tif( $makenice && substr( $src, -2 ) === '?>' ){\n\t\t\t\t// trim trailing close tag, so no need to open one\n\t\t\t\t$src = substr_replace( $src, '', -2 );\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$ws = $this->opt(COMPILER_OPTION_WHITESPACE) ? \"\\n\" : ' ';\n\t\t\t\t$src .= '<?php'.$ws;\n\t\t\t}\n\t\t}\n\t\treturn $src;\t\n\t}", "public function process(File $phpcsFile, $stackPtr)\n {\n $tokens = $phpcsFile->getTokens();\n\n // Check whether this is a single quoted or double quoted string.\n if ($tokens[$stackPtr]['code'] === \\T_CONSTANT_ENCAPSED_STRING) {\n\n // Find the start of the - potentially multi-line - text string.\n $start = $stackPtr;\n for ($i = ($stackPtr - 1); $i >= 0; $i--) {\n if ($tokens[$i]['code'] === \\T_WHITESPACE) {\n continue;\n }\n\n if ($tokens[$i]['code'] === \\T_CONSTANT_ENCAPSED_STRING) {\n $start = $i;\n continue;\n }\n\n break;\n }\n\n try {\n $textString = $this->getCompleteTextString($phpcsFile, $start, false);\n } catch (PHPCS_Exception $e) {\n // Something went wrong determining the start of the text string.\n return;\n }\n\n $startQuote = $textString[0];\n $endQuote = substr($textString, -1);\n if (($startQuote === \"'\" && $endQuote === \"'\")\n || $startQuote !== $endQuote\n ) {\n // Single quoted string, not our concern.\n return;\n }\n }\n\n $content = $this->stripQuotes($tokens[$stackPtr]['content']);\n $count = preg_match_all('`(?<!\\\\\\\\)\\\\\\\\u\\{([^}\\n\\r]*)(\\})?`', $content, $matches, \\PREG_SET_ORDER);\n if ($count === false || $count === 0) {\n return;\n }\n\n foreach ($matches as $match) {\n $valid = false; // If the close curly is missing, we have an incomplete escape sequence.\n if (isset($match[2])) {\n $valid = $this->isValidUnicodeEscapeSequence($match[1]);\n }\n\n if ($this->supportsBelow('5.6') === true && $valid === true) {\n $phpcsFile->addError(\n 'Unicode codepoint escape sequences are not supported in PHP 5.6 or earlier. Found: %s',\n $stackPtr,\n 'Found',\n array($match[0])\n );\n }\n\n if ($this->supportsAbove('7.0') === true && $valid === false) {\n $phpcsFile->addError(\n 'Strings containing a literal \\u{ followed by an invalid unicode codepoint escape sequence will cause a fatal error in PHP 7.0 and above. Escape the leading backslash to prevent this. Found: %s',\n $stackPtr,\n 'Invalid',\n array($match[0])\n );\n }\n }\n }", "public function beforeProcessing(array $input = array());", "private static function preprocess(){\n $CREATE_MINIFIED_FILES=(self::LINK_MINIFIED_FILES||self::INCLUDE_MINIFIED_FILES)?true:false;\n\n ////////////////////////////\n\n ////// PHP DEFAULTS -- things should work without fiddling here.\n $included_css=\"\";\n $included_js=\"\";\n $create_minified_files=true;\n ///////////////////////////\n\n\t\t\n\t\t// css & js is stored in variables. Then they are output to the html, stored in external files, or whatever.\n\t\t\n\t\t// CSS /////////////////\t\t\n\t\tob_start();\n\t\tforeach(self::CSS_FILES as $v)include $v;\n\t\t$included_css=ob_get_contents();\n\t\tob_end_clean();\n\t\tif(self::INCLUDE_MINIFIED_FILES){\n\t\t\t// fixing image and font paths for inclusion\n\t\t\t// ASSUMED PATHS\n\t\t\t// ROOT/im/\t\tfor images\n\t\t\t// ROOT/css/fonts/ \t\tfor fonts\n\t\t\t$included_css=str_replace(\"fonts/\",\"css/fonts/\",$included_css);\n\t\t\t$included_css=str_replace(\"../im/\",\"im/\",$included_css);\n\t\t\t\n\t\t\t$included_css=self::stripComments($included_css);\n\t\t\t\n\t\t}\n\t\t\n\t\t// JS /////////////////\n\t\t// TO DO: replace Uglify call for exec(yui.jar) calls\n\t\tinclude $_SERVER['DOCUMENT_ROOT'].\"/_scripts/php/UGLY.php\";\n\t\t\n\t\t$ug = new UglifyJS();\n\t\t\n\t\t\n\t\t\n\t\tforeach(self::JS_FILES as $v)$ug->add($v);\n\t\t\n\t\tob_start();\n\t\t$ug->write(true);\n\t\t$included_js=ob_get_contents();\n\t\tob_end_clean();\n\t\t\n\t\t///////////////////////\n\t\t\n\t\t\n\t\tif($CREATE_MINIFIED_FILES){\n\t\t\tfile_put_contents(self::CSS_MIN_URI,$included_css);\n\t\t\tfile_put_contents(self::JS_MIN_URI,$included_js);\n\t\t\n\t\t\t}\n\t\t\n\t\t\n\t\t echo '<div style=\"position:absolute;z-index:99999;width:100%;font-size:1em;font-family:arial,sans;background:rgba(200,200,40,.4);border:2px green solid;color:#111;padding:4px;\">COMPILER INCLUDED</div>';\n\n}", "public function precompiler(string $viewTemplateCode) : string\n {\n collect($this->manifest)->each(function (string $jsFile, string $tag) use (&$viewTemplateCode) {\n $check = $this->findPositionOfSvelteTagInBlade($viewTemplateCode, $tag);\n if (! $check || in_array($tag, $this->loadedTags, true)) {\n return; // skip\n }\n $pushDirective = $this->generatePushDirective([$tag]);\n $viewTemplateCode = substr_replace($viewTemplateCode, $pushDirective, $check - 1, 0);\n $this->loadedTags = array_merge($this->loadedTags, [$tag]);\n });\n\n return $viewTemplateCode;\n }", "protected function _compileSource(){ }", "private static function _runPHP($_path, $IN, &$OUT)\n\t{\n\t\t// Running a new command line process has an overhead of around .04s\n\t\tinclude($_path);\n\t}", "public function tokenize() {\n \n foreach($this->files as $file) {\n\n $ext = explode('.', $file);\n $ext = array_pop($ext);\n $ext = strtolower($ext);\n\n if(!array_key_exists($ext, $this->extensions)) {\n continue;\n } \n\n switch($this->extensions[$ext]) {\n case 'php':\n\n $strings = Extractor::tokenizePHP(file_get_contents(realpath($file)), $this->method);\n\n foreach($strings as $string) {\n foreach($string['locations'] as &$location) {\n $location = sprintf('%s:%d', realpath($file), $location);\n }\n if(array_key_exists($string['definition'], $this->strings)) {\n $this->strings[$string['definition']]['locations'] = array_merge($this->strings[$string['definition']]['locations'], $string['locations']);\n } else {\n $this->strings[$string['definition']] = $string;\n }\n }\n\n break;\n case 'js':\n\n $strings = Extractor::tokenizeJS(file_get_contents(realpath($file)), $this->method);\n\n foreach($strings as $string) {\n foreach($string['locations'] as &$location) {\n $location = sprintf('%s:%d', realpath($file), $location);\n }\n if(array_key_exists($string['definition'], $this->strings)) {\n $this->strings[$string['definition']]['locations'] = array_merge($this->strings[$string['definition']]['locations'], $string['locations']);\n } else {\n $this->strings[$string['definition']] = $string;\n }\n }\n\n break;\n }\n\n }\n\n }", "protected function pre_processing() {\n\t\treturn true;\n\t}", "public function process(File $phpcsFile, $stackPtr)\n {\n $tokens = $phpcsFile->getTokens();\n\n // We are only interested in the first token in a multi-line string.\n if ($tokens[$stackPtr]['code'] === $tokens[($stackPtr - 1)]['code']) {\n return;\n }\n\n $content = $tokens[$stackPtr]['content'];\n $i = ($stackPtr + 1);\n while ($tokens[$i]['code'] === $tokens[$stackPtr]['code']) {\n $content .= $tokens[$i]['content'];\n $i++;\n }\n\n // We are only interested in multi-lines\n if (strpos($content, \"\\n\") === false) {\n return;\n }\n\n // We are only interested in SQL.\n if (!$this->isSql($content)) {\n return;\n }\n\n $lines = preg_split('/\\r\\n|\\n/', $content);\n $firstLine = array_shift($lines);\n if ($firstLine !== '\"' && $firstLine !== \"'\") {\n $error = 'The first line in multi-line SQL must be in a single line';\n $phpcsFile->addError($error, $stackPtr, 'FirstSQLLine');\n }\n\n $lastLine = trim(end($lines));\n $lastLineKey = key($lines);\n if ($lastLine !== '\"' && $lastLine !== \"'\") {\n $error = 'The last line in multi-line SQL must be in a single line';\n $phpcsFile->addError($error, $stackPtr, 'LastSQLLine');\n }\n\n $currentLine = $tokens[$stackPtr]['line'];\n $lineColumn = $tokens[$stackPtr]['column'];\n $i = $stackPtr-1;\n while ($tokens[$i]['line'] === $currentLine) {\n if ($tokens[$i]['code'] === T_WHITESPACE) {\n $i--;\n continue;\n }\n $lineColumn = $tokens[$i]['column'];\n $i--;\n }\n\n foreach ($lines as $pos => $line) {\n $foundIndent = 0;\n // Assuming the spaces will be tab\n while (isset($line[$foundIndent]) && $line[$foundIndent] === \"\\t\") {\n $foundIndent++;\n }\n $expectedIndent = $pos === $lastLineKey ? $lineColumn-1 : $lineColumn;\n if ($foundIndent !== $expectedIndent) {\n // Ok, we give a chance for 1 space, except in the first line\n if ($pos !== 0 && $foundIndent-1 === $expectedIndent) {\n continue;\n }\n $error = 'Multi-line SQL not indented correctly; expected %s spaces but found %s';\n $data = array(\n $expectedIndent,\n $foundIndent,\n );\n $phpcsFile->addError($error, $stackPtr+$pos+1, 'AlignSQLLine', $data);\n }\n }\n }", "protected function compilePrepend(string $expression): string\n {\n return \"<?php \\$__env->startPrepend{$expression}; ?>\";\n }", "public function insert_file($source_path){\n\t\t// open file as source\n\t\t\t$source = new zajCompileSource($source_path, $this);\n\t\t// set not to parse\n\t\t\t$source->set_parse(false);\n\t\t// now compile\n\t\t\twhile(!$source->eof()) $source->compile();\n\t\t $source->close();\n\t\treturn true;\n\t}", "public static function preProcess()\n {\n return true;\n }", "public function process(File $phpcsFile, $stackPtr)\n {\n $tokens = $phpcsFile->getTokens();\n\n $ignore = array(\n \\T_DOUBLE_COLON => true,\n \\T_OBJECT_OPERATOR => true,\n \\T_FUNCTION => true,\n \\T_CONST => true,\n );\n\n $prevToken = $phpcsFile->findPrevious(\\T_WHITESPACE, ($stackPtr - 1), null, true);\n if (isset($ignore[$tokens[$prevToken]['code']]) === true) {\n // Not a call to a PHP function.\n return;\n }\n\n $functionLc = strtolower($tokens[$stackPtr]['content']);\n if (isset($this->iniFunctions[$functionLc]) === false) {\n return;\n }\n\n $iniToken = $this->getFunctionCallParameter($phpcsFile, $stackPtr, $this->iniFunctions[$functionLc]);\n if ($iniToken === false) {\n return;\n }\n\n $filteredToken = $this->stripQuotes($iniToken['raw']);\n if (isset($this->deprecatedIniDirectives[$filteredToken]) === false) {\n return;\n }\n\n $itemInfo = array(\n 'name' => $filteredToken,\n 'functionLc' => $functionLc,\n );\n $this->handleFeature($phpcsFile, $iniToken['end'], $itemInfo);\n }", "public function compileFromFile($fileName) {}", "protected function _preprocess() {\r\n\t\tFlex_Process::factory(Flex_Process::PROCESS_PAYMENTS_PREPROCESS)->lock();\r\n\r\n\t\t// Optional FileImport.Id parameter\r\n\t\t$iFileImportId = $this->_aArgs[self::SWITCH_FILE_IMPORT_ID];\r\n\t\tif ($iFileImportId && ($oFileImport = File_Import::getForId($iFileImportId))) {\r\n\t\t\tif ($oFileImport->Status !== FILE_COLLECTED) {\r\n\t\t\t\tthrow new Exception(\"Only Files with Status FILE_COLLECTED (\".FILE_COLLECTED.\") can be pre-Processed\");\r\n\t\t\t}\r\n\r\n\t\t\t// Make sure that we have a Carrier Module defined to process this File\r\n\t\t\tCarrier_Module::getForDefinition(MODULE_TYPE_NORMALISATION_PAYMENT, $oFileImport->FileType, $oFileImport->Carrier);\r\n\t\t}\r\n\r\n\t\t// Optional Limit Parameter\r\n\t\t$iLimit = (isset($this->_aArgs[self::SWITCH_LIMIT]) ? (int)$this->_aArgs[self::SWITCH_LIMIT] : null);\r\n\r\n\t\t// Process the Files\r\n\t\ttry {\r\n\t\t\tResource_Type_File_Import_Payment::preProcessFiles($iFileImportId, $iLimit);\r\n\t\t} catch (Exception $oException) {\r\n\t\t\t// TODO: Transaction if testing\r\n\t\t\tthrow $oException;\r\n\t\t}\r\n\t}", "public function getSourceFile();", "function pre($content,$conf){\r\n\t\t//handlepre processing for future preprocessing ;)\r\n\t\t//todo: implement hook\r\n\t\t//$out = \"<!-- \";\r\n\t\t$out = \"\";\r\n\t\treturn $out;\r\n\t}", "function _compile_file($resource_name, $source_content, &$compiled_content)\r\n {\r\n\r\n if ($this->security)\r\n\t\t{\r\n // do not allow php syntax to be executed unless specified\r\n if ($this->php_handling == SMARTY_PHP_ALLOW &&\r\n !$this->security_settings['PHP_HANDLING']) {\r\n $this->php_handling = SMARTY_PHP_PASSTHRU;\r\n }\r\n }\r\n $this->_load_filters();\r\n $this->_current_file = $resource_name;\r\n $this->_current_line_no = 1;\r\n $ldq = preg_quote($this->left_delimiter, '~');\r\n $rdq = preg_quote($this->right_delimiter, '~');\r\n // run template source through prefilter functions\r\n if (count($this->_plugins['prefilter']) > 0)\r\n\t\t{\r\n foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter)\r\n\t\t\t{\r\n if ($prefilter === false) continue;\r\n if ($prefilter[3] || is_callable($prefilter[0]))\r\n\t\t\t\t{\r\n $source_content = call_user_func_array($prefilter[0],\r\n array($source_content, &$this));\r\n $this->_plugins['prefilter'][$filter_name][3] = true;\r\n } else {\r\n $this->_trigger_fatal_error(\"[plugin] prefilter '$filter_name' is not implemented\");\r\n }\r\n }\r\n }\r\n /* fetch all special blocks */\r\n $search = \"~{$ldq}\\*(.*?)\\*{$rdq}|{$ldq}\\s*literal\\s*{$rdq}(.*?){$ldq}\\s*/literal\\s*{$rdq}|{$ldq}\\s*php\\s*{$rdq}(.*?){$ldq}\\s*/php\\s*{$rdq}~s\";\r\n preg_match_all($search, $source_content, $match, PREG_SET_ORDER);\r\n $this->_folded_blocks = $match;\r\n reset($this->_folded_blocks);\r\n /* replace special blocks by \"{php}\" */\r\n $source_content = preg_replace($search.'e', \"'\"\r\n . $this->_quote_replace($this->left_delimiter) . 'php'\r\n . \"' . str_repeat(\\\"\\n\\\", substr_count('\\\\0', \\\"\\n\\\")) .'\"\r\n . $this->_quote_replace($this->right_delimiter)\r\n . \"'\"\r\n , $source_content);\r\n\r\n /* Gather all template tags. */\r\n preg_match_all(\"~{$ldq}\\s*(.*?)\\s*{$rdq}~s\", $source_content, $_match);\r\n $template_tags = $_match[1];\r\n /* Split content by template tags to obtain non-template content. */\r\n $text_blocks = preg_split(\"~{$ldq}.*?{$rdq}~s\", $source_content);\r\n /* loop through text blocks */\r\n for ($curr_tb = 0, $for_max = count($text_blocks); $curr_tb < $for_max; $curr_tb++) {\r\n /* match anything resembling php tags */\r\n if (preg_match_all('~(<\\?(?:\\w+|=)?|\\?>|language\\s*=\\s*[\\\"\\']?\\s*php\\s*[\\\"\\']?)~is', $text_blocks[$curr_tb], $sp_match)) {\r\n /* replace tags with placeholders to prevent recursive replacements */\r\n $sp_match[1] = array_unique($sp_match[1]);\r\n usort($sp_match[1], '_smarty_sort_length');\r\n for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) {\r\n $text_blocks[$curr_tb] = str_replace($sp_match[1][$curr_sp],'%%%SMARTYSP'.$curr_sp.'%%%',$text_blocks[$curr_tb]);\r\n }\r\n /* process each one */\r\n for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) {\r\n if ($this->php_handling == SMARTY_PHP_PASSTHRU) {\r\n /* echo php contents */\r\n $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '<?php echo \\''.str_replace(\"'\", \"\\'\", $sp_match[1][$curr_sp]).'\\'; ?>'.\"\\n\", $text_blocks[$curr_tb]);\r\n } else if ($this->php_handling == SMARTY_PHP_QUOTE) {\r\n /* quote php tags */\r\n $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', htmlspecialchars($sp_match[1][$curr_sp]), $text_blocks[$curr_tb]);\r\n } else if ($this->php_handling == SMARTY_PHP_REMOVE) {\r\n /* remove php tags */\r\n $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '', $text_blocks[$curr_tb]);\r\n } else {\r\n /* SMARTY_PHP_ALLOW, but echo non php starting tags */\r\n $sp_match[1][$curr_sp] = preg_replace('~(<\\?(?!php|=|$))~i', '<?php echo \\'\\\\1\\'?>'.\"\\n\", $sp_match[1][$curr_sp]);\r\n $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', $sp_match[1][$curr_sp], $text_blocks[$curr_tb]);\r\n }\r\n }\r\n }\r\n }\r\n /* Compile the template tags into PHP code. */\r\n $compiled_tags = array();\r\n for ($i = 0, $for_max = count($template_tags); $i < $for_max; $i++)\r\n\t\t{\r\n $this->_current_line_no += substr_count($text_blocks[$i], \"\\n\");\r\n $compiled_tags[] = $this->_compile_tag($template_tags[$i]);\r\n $this->_current_line_no += substr_count($template_tags[$i], \"\\n\");\r\n }\r\n if (count($this->_tag_stack)>0)\r\n\t\t{\r\n list($_open_tag, $_line_no) = end($this->_tag_stack);\r\n $this->_syntax_error(\"unclosed tag \\{$_open_tag} (opened line $_line_no).\", E_USER_ERROR, __FILE__, __LINE__);\r\n return;\r\n }\r\n /* Reformat $text_blocks between 'strip' and '/strip' tags,\r\n removing spaces, tabs and newlines. */\r\n $strip = false;\r\n for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++)\r\n\t\t{\r\n if ($compiled_tags[$i] == '{strip}')\r\n\t\t\t{\r\n $compiled_tags[$i] = '';\r\n $strip = true;\r\n /* remove leading whitespaces */\r\n $text_blocks[$i + 1] = ltrim($text_blocks[$i + 1]);\r\n }\r\n if ($strip)\r\n\t\t\t{\r\n /* strip all $text_blocks before the next '/strip' */\r\n for ($j = $i + 1; $j < $for_max; $j++)\r\n\t\t\t\t{\r\n /* remove leading and trailing whitespaces of each line */\r\n $text_blocks[$j] = preg_replace('![\\t ]*[\\r\\n]+[\\t ]*!', '', $text_blocks[$j]);\r\n if ($compiled_tags[$j] == '{/strip}')\r\n\t\t\t\t\t{\r\n /* remove trailing whitespaces from the last text_block */\r\n $text_blocks[$j] = rtrim($text_blocks[$j]);\r\n }\r\n $text_blocks[$j] = \"<?php echo '\" . strtr($text_blocks[$j], array(\"'\"=>\"\\'\", \"\\\\\"=>\"\\\\\\\\\")) . \"'; ?>\";\r\n if ($compiled_tags[$j] == '{/strip}')\r\n\t\t\t\t\t{\r\n $compiled_tags[$j] = \"\\n\"; /* slurped by php, but necessary\r\n if a newline is following the closing strip-tag */\r\n $strip = false;\r\n $i = $j;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n $compiled_content = '';\r\n $tag_guard = '%%%SMARTYOTG' . md5(uniqid(rand(), true)) . '%%%';\r\n /* Interleave the compiled contents and text blocks to get the final result. */\r\n for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++)\r\n\t\t{\r\n if ($compiled_tags[$i] == '')\r\n\t\t\t{\r\n // tag result empty, remove first newline from following text block\r\n $text_blocks[$i+1] = preg_replace('~^(\\r\\n|\\r|\\n)~', '', $text_blocks[$i+1]);\r\n }\r\n // replace legit PHP tags with placeholder\r\n $text_blocks[$i] = str_replace('<?', $tag_guard, $text_blocks[$i]);\r\n $compiled_tags[$i] = str_replace('<?', $tag_guard, $compiled_tags[$i]);\r\n $compiled_content .= $text_blocks[$i] . $compiled_tags[$i];\r\n }\r\n $compiled_content .= str_replace('<?', $tag_guard, $text_blocks[$i]);\r\n // escape php tags created by interleaving\r\n $compiled_content = str_replace('<?', \"<?php echo '<?' ?>\\n\", $compiled_content);\r\n $compiled_content = preg_replace(\"~(?<!')language\\s*=\\s*[\\\"\\']?\\s*php\\s*[\\\"\\']?~\", \"<?php echo 'language=php' ?>\\n\", $compiled_content);\r\n // recover legit tags\r\n $compiled_content = str_replace($tag_guard, '<?', $compiled_content);\r\n // remove \\n from the end of the file, if any\r\n if (strlen($compiled_content) && (substr($compiled_content, -1) == \"\\n\") )\r\n\t\t{\r\n $compiled_content = substr($compiled_content, 0, -1);\r\n }\r\n if (!empty($this->_cache_serial))\r\n\t\t{\r\n $compiled_content = \"<?php \\$this->_cache_serials['\".$this->_cache_include.\"'] = '\".$this->_cache_serial.\"'; ?>\" . $compiled_content;\r\n }\r\n // run compiled template through postfilter functions\r\n if (count($this->_plugins['postfilter']) > 0)\r\n\t\t{\r\n foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter)\r\n\t\t\t{\r\n if ($postfilter === false) continue;\r\n if ($postfilter[3] || is_callable($postfilter[0]))\r\n\t\t\t\t{\r\n $compiled_content = call_user_func_array($postfilter[0],\r\n array($compiled_content, &$this));\r\n $this->_plugins['postfilter'][$filter_name][3] = true;\r\n } else {\r\n $this->_trigger_fatal_error(\"Smarty plugin error: postfilter '$filter_name' is not implemented\");\r\n }\r\n }\r\n }\r\n // put header at the top of the compiled template\r\n $template_header = \"<?php /* Smarty version \".$this->_version.\", created on \".strftime(\"%Y-%m-%d %H:%M:%S\").\"\\n\";\r\n $template_header .= \" compiled from \".strtr(urlencode($resource_name), array('%2F'=>'/', '%3A'=>':')).\" */ ?>\\n\";\r\n /* Emit code to load needed plugins. */\r\n $this->_plugins_code = '';\r\n if (count($this->_plugin_info))\r\n\t\t{\r\n $_plugins_params = \"array('plugins' => array(\";\r\n foreach ($this->_plugin_info as $plugin_type => $plugins)\r\n\t\t\t{\r\n foreach ($plugins as $plugin_name => $plugin_info)\r\n\t\t\t\t{\r\n $_plugins_params .= \"array('$plugin_type', '$plugin_name', '\" . strtr($plugin_info[0], array(\"'\" => \"\\\\'\", \"\\\\\" => \"\\\\\\\\\")) . \"', $plugin_info[1], \";\r\n $_plugins_params .= $plugin_info[2] ? 'true),' : 'false),';\r\n }\r\n }\r\n $_plugins_params .= '))';\r\n $plugins_code = \"<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');\\nsmarty_core_load_plugins($_plugins_params, \\$this); ?>\\n\";\r\n $template_header .= $plugins_code;\r\n $this->_plugin_info = array();\r\n $this->_plugins_code = $plugins_code;\r\n }\r\n if ($this->_init_smarty_vars)\r\n\t\t{\r\n $template_header .= \"<?php require_once(SMARTY_CORE_DIR . 'core.assign_smarty_interface.php');\\nsmarty_core_assign_smarty_interface(null, \\$this); ?>\\n\";\r\n $this->_init_smarty_vars = false;\r\n }\r\n $compiled_content = $template_header . $compiled_content;\r\n return true;\r\n }", "public function process(File $phpcsFile, $stackPtr)\n {\n if (isset($this->phpVersion) === \\false || \\defined('PHP_CODESNIFFER_IN_TESTS')) {\n // Set default value to prevent this code from running every time the sniff is triggered.\n $this->phpVersion = 0;\n $phpVersion = Helper::getConfigData('php_version');\n if ($phpVersion !== null) {\n $this->phpVersion = (int) $phpVersion;\n }\n }\n $this->processSpacingBefore($phpcsFile, $stackPtr);\n $this->processSpacingAfter($phpcsFile, $stackPtr);\n }", "private function readFileSource()\n {\n $file = fopen($this->getFileName(), 'r');\n $line = 0;\n $source = '';\n\n while (!feof($file)) {\n ++$line;\n\n if ($line >= $this->getStartLine()) {\n break;\n }\n\n $source .= fgets($file);\n }\n\n fclose($file);\n\n return $source;\n }" ]
[ "0.50723255", "0.5050016", "0.50460094", "0.49665695", "0.4958976", "0.49182892", "0.48836678", "0.48057604", "0.47954243", "0.4788214", "0.47719517", "0.47576022", "0.47504503", "0.47457954", "0.47098857", "0.47001076", "0.46998838", "0.46916023", "0.46816397", "0.46741304", "0.4664514", "0.46519396", "0.46481144", "0.46280363", "0.4619715", "0.45939007", "0.4574855", "0.45747715", "0.45601022", "0.45554677" ]
0.71487874
0
Returns the next line in the input, returning null on error, endoffile, or encountering PHP end in the initial include file.
public function getLine() { $line = $this->_fetchNextLine(); $lineToSet = null; while ((null === $this->error) && (null !== $line) && (null === $lineToSet)) { // If this is a require_once line, we need to process it to see if the file should be inlined, ignored, or // processed as PHP code. $requireOnce = 'require_once('; if (0 === strpos($line, $requireOnce)) { // This is a require_once line so see how we should handle this one before proceeding. $endIndex = strpos($line, ')'); $requireOnceLength = strlen($requireOnce) + 1; $subFileName = substr($line, $requireOnceLength, $endIndex - $requireOnceLength - 1); if (in_array($subFileName, $this->ignoredFileNameArray)) { // We can ignore this require_once line so do nothing and loop around again. } else { $subFilePath = $this->_getRealPath($subFileName); if (null !== $subFilePath) { // We found the file so see what we should do with it. if (in_array($subFilePath, $this->alreadyIncludedPathArray)) { // This is a valid file which we could include but we have already done so so skip it. } else { // We did find the file, we haven't yet included it, and it isn't in our ignored list so we can // try to inline it. list($preLines, $lines, $postLines) = $this->_loadFile($subFilePath); if (null === $this->error) { if (count($lines) > 0) { // Push our existing state onto the stack and assume these. // Note that we only push if there would be some data to return to (since we can't // return to an empty line array). if (count($this->currentLines) > 0) { array_push($this->lineStack, $this->currentLines); array_push($this->fileStack, $this->currentFileName); array_push($this->lineNumberStack, $this->currentLineNumber); } $this->currentLines = $lines; $this->currentFileName = $subFilePath; $this->currentLineNumber = count($preLines); } } } } else { // We couldn't find this so we will leave the existing require_once (as this means we can still // leave large, external libraries in their original shapes). if (in_array($subFileName, $this->alreadyReferencedFileNamesArray)) { // We already have this file referenced so we will skip referencing it a second time. } else { // Return this as a normal line. $this->alreadyReferencedFileNamesArray[] = $subFileName; $lineToSet = $line; } } } } else { // This is just a normal line so we can return it. $lineToSet = $line; } // If we didn't find a line to return, get the next one. if (null === $lineToSet) { $line = $this->_fetchNextLine(); } } assert(false !== $lineToSet); return array($lineToSet, $this->currentFileName, $this->currentLineNumber, $this->error); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function next( )\n {\n return( next( $this->line_segments ) );\n }", "public function getNextLine()\n {\n if ( $this->currentMessage === null )\n {\n $this->nextMail();\n }\n if ( $this->hasMoreMailData )\n {\n $data = $this->connection->getLine();\n if ( rtrim( $data ) === \".\" )\n {\n $this->hasMoreMailData = false;\n // remove the mail if required by the user.\n if ( $this->deleteFromServer == true )\n {\n $this->connection->sendData( \"DELE {$this->currentMessage}\" );\n $response = $this->connection->getLine(); // ignore response\n }\n return null;\n }\n return $data;\n }\n return null;\n }", "public function get_line() {\n\t\t\n\t\tstatic $get_line;\n\t\t\n\t\tif(!$get_line) {\n\t\t\tif(is_array($this->source)) {\n\t\t\t\t$get_line = function(&$source) {\n\t\t\t\t\t$line = each($source);\n\t\t\t\t\tif(!$line)\n\t\t\t\t\t\treturn false;\n\t\t\t\t\telse\n\t\t\t\t\t\treturn $line[1];\n\t\t\t\t};\n\t\t\t} elseif(is_resource($this->source)) {\n\t\t\t\t$get_line = function(&$source) {\n\t\t\t\t\tif(feof($source))\n\t\t\t\t\t\treturn false;\n\t\t\t\t\telse\n\t\t\t\t\t\treturn rtrim(fgets($source), \"\\r\\n\");\n\t\t\t\t};\n\t\t\t} else\n\t\t\t\tthrow new Exception('Sanity error: unexpected source type - ' . typeof($this->source));\n\t\t}\n\t\t\n\t\treturn $get_line($this->source);\n\t\t\n\t}", "public function readLine(){\r\n if (!$this->fName)\r\n return NULL; //File not found\r\n\r\n $file_handle = fopen($this->fName, \"rb\");\r\n fseek($file_handle, $this->FilePointer);\r\n if(!feof($file_handle)){\r\n $value = fgets($file_handle);\r\n $this->FilePointer += strlen($value);\r\n fclose($file_handle);\r\n return $value;\r\n }\r\n else\r\n return NULL;\r\n }", "public function next() {\n\t\t++$this->currentLineNumber;\n\t\t$this->currentLine = fgets($this->fileHandle);\n\t}", "private function fetchNextRow()\n {\n if (feof($this->fileResource)) {\n $this->fileResource = null;\n return;\n }\n $this->currentRowNumber++;\n $line = fgets($this->fileResource);\n\n $line = str_replace(array(\"\\n\", \"\\r\"), '', $line);\n if ($line == '') {\n $this->fileResource = null;\n return;\n }\n $fields = explode($this->separator, $line);\n\n $rowNumber = 0;\n foreach ($this->columnTitles as $key) {\n $this->currentRow[$key] = $fields[$rowNumber];\n $rowNumber++;\n }\n }", "public function getLine(): ?int\n\t{\n\t\treturn isset($this->tokens[$this->position]) ? $this->tokens[$this->position]->line : null;\n\t}", "public function pullInclude()\n {\n if (!$this->hasIncludes()) {\n throw new ArrayEmptyException(\"Could not get next include - include path is empty\");\n }\n return array_shift($this->include_path);\n }", "function lineStart($file) {\n $position = ftell($file);\n //if at beginning of file don't try to go farther\n if ($position == false) {\n return $position;\n } else {\n while (fgetc($file) != \"\\n\") {\n fseek($file, --$position);\n if ($position == 0) break;\n }\n }\n\n return $position;\n}", "public function getCurrentLine() {\n // Check the string isn't empty\n if ($this->EOF) {\n // Add one to $this->char because we want the number for the next\n // byte to be processed.\n return substr_count($this->data, \"\\n\", 0, min($this->char, $this->EOF)) + 1;\n } else {\n // If the string is empty, we are on the first line (sorta).\n return 1;\n }\n }", "public function current() {\n\t\tif ($this->currentLine === NULL) {\n\t\t\t// we're at the start of the file, so read the first line\n\t\t\t$this->next();\n\t\t}\n\t\treturn $this->lineParser->parseLine($this->currentLine);\n\t}", "public function nextCharacter() {\n\t\t\tif($this->position >= $this->length)\n\t\t\t\treturn null;\n\t\t\telse {\n\t\t\t\t// Skip a comment.\n\t\t\t\tif(($this->position === 0 || $this->data[$this->position - 1] === \"\\n\") &&\n\t\t\t\t $this->data[$this->position] === '#')\n\t\t\t\t\t$this->position = strpos($this->data, \"\\n\", $this->position) + 1;\n\t\t\t\t\n\t\t\t\treturn $this->data[$this->position++];\n\t\t\t}\n\t\t}", "public function next()\n {\n if (!($this->_current = trim(fgets($this->_stream)))) {\n // EOF, blank line, or error so close the stream; valid() will now\n // return false.\n fclose($this->_stream);\n $this->_stream = null;\n }\n return;\n }", "protected function next() {\n $c = $this->get();\n\n if ($c === '/') {\n switch($this->peek()) {\n case '/':\n for (;;) {\n $c = $this->get();\n\n if (ord($c) <= self::ORD_LF) {\n return $c;\n }\n }\n\n case '*':\n $this->get();\n\n for (;;) {\n switch($this->get()) {\n case '*':\n if ($this->peek() === '/') {\n $this->get();\n return ' ';\n }\n break;\n\n case null:\n throw new JSMinException('Unterminated comment.');\n }\n }\n\n default:\n return $c;\n }\n }\n\n return $c;\n }", "function stream_get_line ($handle, $length, $ending = null) {}", "public function getLineEnd()\n {\n $this->scan();\n return $this->lineEnd;\n }", "function ReadNextLine() {\n\t\t$newdata = array();\n\t\tswitch ($this->extension) {\n\t\t\tcase 'csv':\n\t\t\t\t$template = JRequest::getVar('template');\n\t\t\t\t/* Set the delimiter */\n\t\t\t\tif (strtolower($template->field_delimiter) == 't') $field_delimiter = \"\\t\";\n\t\t\t\telse $field_delimiter = $template->field_delimiter;\n\t\t\t\t\n\t\t\t\t$csvdata = array(0=>''); \n\t\t\t\t/* Ignore empty records */\n while (is_array($csvdata) && count($csvdata)==1 && $csvdata[0]=='') {\n if (!empty($template->text_enclosure)) $csvdata = fgetcsv($this->fp, 0, $field_delimiter, $template->text_enclosure); \n else $csvdata = fgetcsv($this->fp, 0, $template->field_delimiter); \n }\n\t\t\t\t\n\t\t\t\tif ($csvdata) {\n\t\t\t\t\t/* Do BOM check */\n\t\t\t\t\tif (JRequest::getVar('currentline') == 1) {\n\t\t\t\t\t\t/* Remove text delimiters as they are not recognized by fgetcsv */\n\t\t\t\t\t\t$csvdata[0] = str_replace($template->text_enclosure, \"\", $this->CheckBom($csvdata[0]));\n\t\t\t\t\t}\n\t\t\t\t\tforeach ($csvdata as $key => $value) { \n $newdata[$key+1] = $value; \n } \n return $newdata;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$this->CloseFile();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'xls':\n\t\t\t\tif ($this->data->sheets[0]['numRows'] >= $this->linepointer) {\n\t\t\t\t\t/* Make sure we include the empty fields */\n\t\t\t\t\tfor ($i=1;$i<=$this->data->sheets[0]['numCols'];$i++) {\n\t\t\t\t\t if (!isset($this->data->sheets[0]['cells'][$this->linepointer][$i])) $this->data->sheets[0]['cells'][$this->linepointer][$i] = '';\n\t\t\t\t\t}\n\t\t\t\t\t$newdata = $this->data->sheets[0]['cells'][$this->linepointer];\n\t\t\t\t\t$this->linepointer++;\n\t\t\t\t\treturn $newdata;\n\t\t\t\t}\n\t\t\t\telse return false;\n\t\t\t\tbreak;\n\t\t\tcase 'xml':\n\t\t\t\tif ($this->data->items >= JRequest::getVar('currentline')) {\n\t\t\t\t\t$newdata = $this->ToArray($this->data->item[JRequest::getVar('currentline')-1], false);\n\t\t\t\t\treturn $newdata;\n\t\t\t\t}\n\t\t\t\telse return false;\n\t\t\t\tbreak;\n\t\t\tcase 'ods':\n\t\t\t\tif ($this->data->rows >= JRequest::getVar('currentline')) {\n\t\t\t\t\treturn $this->data->fulldata[JRequest::getVar('currentline')-1];\n\t\t\t\t}\n\t\t\t\telse return false;\n\t\t\t\tbreak;\n\t\t}\n\t}", "public function _readline($fp)\n {\n $line = '';\n\n while (($c = fgetc($fp)) !== false) {\n // Leading \\n is just hang over from the last line\n if (strlen($line) == 0 && $c == \"\\n\")\n continue;\n $line .= $c;\n if ($c == \"\\r\")\n return $line;\n }\n return $line;\n }", "public function getFixedLineNumber(): ?string;", "public function next() {\n\n $current_post_contents = '';\n \n while ($line = fgets($this->mtif_handle)) {\n\n // If this line is the end of a post section, time to parse the section and\n // see if it contains a valid post\n if ($line === '--------' . PHP_EOL) {\n\n return $current_post = new MT2WP_MTIF_Post($current_post_contents);\n }\n\n $current_post_contents .= $line;\n }\n \n return false;\n }", "public function getStartLine() : ?int\n {\n return $this->startLine;\n }", "public static function firstLine(string $filepath): ?string\n {\n if (\\file_exists($filepath)) {\n $cacheRes = \\fopen($filepath, 'r');\n if ($cacheRes !== false) {\n $firstLine = \\fgets($cacheRes);\n \\fclose($cacheRes);\n\n return $firstLine === false ? null : $firstLine;\n }\n }\n\n return null;\n }", "public static function findOffset(Reader $reader)\n {\n $reader->seek(0);\n\n $offset = 0;\n\n while (!$reader->isEndOfFile()) {\n if (strtolower($reader->read(1)) === self::$sequence[$offset]) {\n $offset++;\n } else {\n $offset = 0;\n }\n\n if (!isset(self::$sequence[$offset + 1])) {\n break;\n }\n }\n\n $reader->seek(1, SEEK_CUR);\n\n if ($offset === (count(self::$sequence) - 1)) {\n $position = $reader->getPosition();\n\n if (\"\\r\\n\" === $reader->read(2)) {\n return $position + 2;\n }\n\n return $position;\n }\n\n return null;\n }", "private function getLine() {\n\t\treturn $this->token->line;\n\t}", "public function readLine() {\n $this->checkNotClosed();\n\n $line = \"\";\n\n do {\n\n $c = $this->nextChar();\n\n if ($c !== null && ord($c) !== 13 && ord($c) !== 10) {\n $line.=$c;\n } else {\n if ($c == null)\n return strlen($line) === 0 ? null : $line;\n\n if (ord($c) === 13) {\n $nc = $this->nextChar();\n if ($nc !== null && ord($nc) !== 10)\n $this->ungetChar($nc);\n }\n\n return $line;\n }\n\n } while (true);\n\n throw new IOException(\"Should never happen ...\");\n }", "public function getLine()\n {\n return isset($this->line) ? $this->line : null;\n }", "public function readline() {\n if (empty($this->code)) print PHP_EOL;\n\n $prompt = (empty($this->code)) ? 'idb:> ' : '.. ';\n\n if (count($this->code_buffer) > 0) {\n print $prompt;\n\n $line = array_shift($this->code_buffer);\n\n print $line.PHP_EOL;\n\n return $line.PHP_EOL;\n }\n\n if ($this->have_readline) {\n $l = readline($prompt);\n\n readline_add_history($l);\n } else {\n print $prompt;\n\n if (is_null($this->stdin)) {\n if (false === ($this->stdin = fopen(\"php://stdin\", \"r\"))) {\n return false;\n }\n }\n $l = fgets($this->stdin);\n }\n return $l;\n }", "private function nextChar() {\n if ($this->ch !== null) {\n $r = $this->ch;\n $this->ch = null;\n return $r;\n }\n if (feof($this->my_handle))\n return null;\n return fgetc($this->my_handle);\n }", "public function getLine($code)\n {\n if (!isset($this->lines[$code])) {\n return NULL;\n }\n return $this->lines[$code];\n }", "public function next()\n {\n $this->currentRowNumber++;\n $currentLine = fgetcsv($this->filePointer, 0, $this->delimiter, $this->enclosure);\n\n\n if ($currentLine === false) {\n $this->currentLine = false;\n } else {\n // Combine fieldNames and currentLine to an associative array.\n $this->currentLine = array_combine($this->fieldNames, $currentLine);\n }\n }" ]
[ "0.6364447", "0.61436164", "0.60133755", "0.5943814", "0.5933697", "0.58650905", "0.580361", "0.5797259", "0.57761365", "0.5769742", "0.5682392", "0.56349045", "0.5580753", "0.5496997", "0.5471046", "0.5446316", "0.5379192", "0.53459495", "0.53400826", "0.5328367", "0.5312003", "0.53045225", "0.5293912", "0.5266626", "0.52626747", "0.5261714", "0.5252815", "0.521103", "0.51972467", "0.51952195" ]
0.70985484
0
Gets the real path of the file by the given name. Note that it locates it by first looking relative to the current directory, then relative to the directory containing $includingFilePath, and then looks relative to each directory in $includePathArray. Returns the string for the path, on success, or null if it couldn't be found.
private function _getRealPath($fileName) { $realPath = realpath($fileName); if (false === $realPath) { $realPath = realpath($this->startingDirectory . DIRECTORY_SEPARATOR . $fileName); if (false === $realPath) { foreach($this->includePathArray as $path) { $realPath = realpath($path . DIRECTORY_SEPARATOR . $fileName); if (false !== $realPath) { break; } } } } return (false !== $realPath) ? $realPath : null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected function _include_path( $file ) {\n\t\tstatic $Path = null;\n\t\tif ( null === $Path ) {\n\t\t\t$basedir = dirname( __FILE__ ) . '/';\n\t\t\t$Path = $basedir . 'inc/';\n\t\t}\n\t\treturn $Path . $file;\n\t}", "public function includePath()\n {\n return __file__;\n }", "public function getFilePath($mediaFileId, $applicationName)\n {\n // Get the file info\n $fileInfo = $this->storage->getFileInfo($mediaFileId);\n if (null === $fileInfo) {\n return null;\n }\n\n // Check that the requesting application can view it\n if (!$fileInfo->canBeViewedBy($applicationName)) {\n return null;\n }\n\n // Return the file path\n return new FilePath(\n $fileInfo->getFullFilePath(),\n $fileInfo->getContentType()\n );\n }", "protected function getFilePath()\n {\n $argument = $this->argument('request_name');\n $dest = $this->getFromOptionOrMethod('dest', 'getDestinationPath');\n $basename = $this->getBasename($argument);\n $dirname = $this->getDirname($argument);\n $parts = [$dest, $dirname, $basename . '.php'];\n return implode('/', array_filter($parts));\n }", "private function requireFile(): string\n {\n foreach ($this->pathOverride as $path) {\n foreach ($this->nameOverride as $name) {\n if (is_file($path . $name)) {\n return $path . $name;\n }\n }\n if (is_file($path . $this->name)) {\n return $path . $this->name;\n }\n }\n foreach ($this->nameOverride as $name) {\n if (is_file($this->path . $name)) {\n return $this->path . $name;\n }\n }\n\n return $this->path . $this->name;\n }", "public static function file_in_path($name, Array $paths)\n {\n $file_path = FALSE;\n\n foreach ($paths as $path) {\n if (file_exists($path . $name)) {\n $file_path = $path . $name;\n break;\n }\n }\n\n return $file_path;\n }", "private static function findPath(string $rawName) {\n $validExtensions = array(\n \".php\" ,\".inc\", \".module\", \".php4\", \".php5\", \".hphp\", \".phtml\", \".ctp\",\n );\n foreach($validExtensions as $ext) {\n foreach(self::getPaths() as $path) {\n if(file_exists($path . \"/\" . $rawName . $ext)) {\n return $path . \"/\" . $rawName . $ext;\n }\n }\n }\n\n return \"\";\n }", "public function getFilePath(string $relativePath) : string;", "protected function getPath($name)\n {\n $module = $this->option(\"module\");\n $path = $this->getPathForModule($module);\n return $path;\n }", "public function getFileWithPath()\n {\n return base_path($this->fileName);\n }", "final public function getRelativeFilePath()\n {\n return $this->file->getRelativeFilePath();\n }", "public function getFilePath(): string\n {\n $filePath = '';\n\n if ($this->module) {\n $filePath = modules_dir() . DS . $this->module . DS;\n }\n\n if ($this->pathPrefix) {\n $filePath .= $this->pathPrefix . DS;\n }\n\n $filePath .= $this->fileName . '.php';\n\n if (!$this->fs->exists($filePath)) {\n if ($this->hierarchical) {\n $filePath = base_dir() . DS . 'shared' . DS . strtolower($this->pathPrefix) . DS . $this->fileName . '.php';\n\n if (!$this->fs->exists($filePath)) {\n throw new LoaderException(_message($this->exceptionMessage, $this->fileName));\n }\n } else {\n throw new LoaderException(_message($this->exceptionMessage, $this->fileName));\n }\n }\n\n return $filePath;\n }", "protected function pathFromIncludeStatement($statement)\n\t{\n\t\t$matches = $this->includeStatements($statement);\n\n return count($matches) > 0 ? array_pop($matches) : null;\n\t}", "protected function getRelativeFilePath(): ?string\n {\n $parameter = GeneralUtility::_GET();\n if (!isset($parameter['P'])) {\n return null;\n }\n $p = $parameter['P'];\n if (!isset($p['table']) || !isset($p['field']) || !isset($p['file'])) {\n return null;\n }\n if (!isset($GLOBALS['TCA'][$p['table']])) {\n return null;\n }\n $tableTca = $GLOBALS['TCA'][$p['table']];\n if (!isset($tableTca['columns'][$p['field']])) {\n return null;\n }\n $fieldTca = $tableTca['columns'][$p['field']];\n\n $uploadFolder = $fieldTca['config']['uploadfolder'] ?? '';\n $baseFolder = '';\n if ('' !== trim($uploadFolder, '/')) {\n $baseFolder = rtrim($uploadFolder, '/').'/';\n }\n\n $filePath = $baseFolder.$p['file'];\n if (!is_file(GeneralUtility::getFileAbsFileName($filePath))) {\n return null;\n }\n\n return $filePath;\n }", "protected static function getFilePath($name)\r\n {\r\n $path = str_replace(\"_\", DIRECTORY_SEPARATOR, $name);\r\n $path = str_replace(__CLASS__, dirname(__FILE__), $path);\r\n\r\n return $path;\r\n }", "function fileExistsInPath($file) {\n\t\t$paths = explode(PATH_SEPARATOR, ini_get('include_path'));\n\t\tforeach ($paths as $path) {\n\t\t\t$fullPath = $path . DS . $file;\n\n\t\t\tif (file_exists($fullPath)) {\n\t\t\t\treturn $fullPath;\n\t\t\t} elseif (file_exists($file)) {\n\t\t\t\treturn $file;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "private function getSourceFilePath()\n {\n return $this->getSourceDirPath() . DIRECTORY_SEPARATOR .\n trim($this->getSourceFileName(), DIRECTORY_SEPARATOR);\n }", "static function getIncludePath()\r\n\t{\r\n\t\tif (self::$_includePath === null)\r\n\t\t\tself::setDefaultIncludePath();\r\n\t\t\t\r\n\t\treturn self::$_includePath;\r\n\t}", "public function resolve_fileinfo_filepath($fileareapath) {\n if (empty($fileareapath)) {\n $fileareapath = '/';\n }\n\n if (substr($fileareapath, 0, 1) != '/') {\n $fileareapath = '/' . $fileareapath;\n }\n\n if (substr($fileareapath, -1) != '/') {\n $fileareapath .= '/';\n }\n\n return $fileareapath;\n }", "public function pullInclude()\n {\n if (!$this->hasIncludes()) {\n throw new ArrayEmptyException(\"Could not get next include - include path is empty\");\n }\n return array_shift($this->include_path);\n }", "public function getFileName($fileFromSetup)\n {\n $file = trim($fileFromSetup);\n if (!$file) {\n return null;\n }\n if (strpos($file, '../') !== false) {\n if ($this->tt_track) {\n $this->getTimeTracker()->setTSlogMessage('File path \"' . $file . '\" contained illegal string \"../\"!', 3);\n }\n return null;\n }\n // Cache\n $hash = md5($file);\n if (isset($this->fileCache[$hash])) {\n return $this->fileCache[$hash];\n }\n\n // if this is an URL, it can be returned directly\n $urlScheme = parse_url($file, PHP_URL_SCHEME);\n if ($urlScheme === 'https' || $urlScheme === 'http' || is_file(PATH_site . $file)) {\n return $file;\n }\n\n // this call also resolves EXT:myext/ files\n $file = GeneralUtility::getFileAbsFileName($file);\n if (!$file) {\n if ($this->tt_track) {\n $this->getTimeTracker()->setTSlogMessage('File \"' . $fileFromSetup . '\" was not found!', 3);\n }\n return null;\n }\n\n $file = PathUtility::stripPathSitePrefix($file);\n\n // Check if the found file is in the allowed paths\n foreach ($this->allowedPaths as $val) {\n if (GeneralUtility::isFirstPartOfStr($file, $val)) {\n $this->fileCache[$hash] = $file;\n return $file;\n }\n }\n\n if ($this->tt_track) {\n $this->getTimeTracker()->setTSlogMessage('\"' . $file . '\" was not located in the allowed paths: (' . implode(',', $this->allowedPaths) . ')', 3);\n }\n return null;\n }", "private function getFullPath($fileName)\n {\n return $this->pathToFiles . $this->DS . $fileName;\n }", "public function getRealPathOfTemplateFile($templateFilePath) {\n return $this->_baseDirectory.ltrim($templateFilePath, DIRECTORY_SEPARATOR);\n }", "public function getFullPath() {\n $path = $this->getPath() . $this->getFilename();\n\n return $path;\n }", "public static function getFilePath($relativePath) {\n\t\treturn Yii::app ()->basePath . \"/../\" . $relativePath;\n\t}", "private function getFilePath()\r\n {\r\n $path = $this->filePath;\r\n if ($this->getIsConvertedToArchive()) {\r\n $path = $this->getArchiveFilePath($path);\r\n }\r\n\r\n return $path;\r\n }", "function requireInPath($strFile2Include, $strPathFromRoot = 'searchbar/')\n{\n $strPathAttuale = $_SERVER['PHP_SELF'];\n $strPathAttuale = str_replace(ROOT_FOLDER, null, $strPathAttuale);\n $strPathToRoot = '';\n $arrayPath = explode('/', $strPathAttuale); //esplodendo la path attuale ho i valori 0 null, e ultimo con il nome del file. Inutili\n $intCartelle = count($arrayPath) - 2; //li elimino quindi dalla lista per sapere quanti salti indietro devo fare per raggiungere la root\n if ($intCartelle > 0) {\n for ($i = 0; $i < $intCartelle; $i++) $strPathToRoot .= '../';\n }\n\n return $strPathToRoot . $strPathFromRoot . $strFile2Include;\n}", "public function getTemplateFile($templateName = '')\n {\n $templateName = (empty($templateName)) ? $this->fileName : $templateName;\n if (strpos($templateName, '/') !== false) {\n return $this->locateTemplate($templateName); // it's a literal\n }\n $arr = explode('.', $templateName);\n $c = \\count($arr);\n if ($c == 1) {\n // its in the root of the template folder.\n return $this->locateTemplate(\"{$templateName}.blade.php\");\n }\n\n $file = $arr[$c - 1];\n \\array_splice($arr, $c - 1, $c - 1); // delete the last element\n $path = implode('/', $arr);\n return $this->locateTemplate(\"{$path}/{$file}.blade.php\");\n }", "public function relativePath(){\n\t\treturn static::joinCleanPaths([$this->sub, $this->path]);\n\t}", "public function findPath(string $name): string\n {\n // Ensure plugin config is loaded each time. This is necessary primarily\n // for testing because the Configure::clear() call in TestCase::tearDown()\n // wipes out all configuration including plugin paths config.\n $this->loadConfig();\n\n $path = Configure::read('plugins.' . $name);\n if ($path) {\n return $path;\n }\n\n $pluginPath = str_replace('/', DIRECTORY_SEPARATOR, $name);\n $paths = App::path('plugins');\n foreach ($paths as $path) {\n if (is_dir($path . $pluginPath)) {\n return $path . $pluginPath . DIRECTORY_SEPARATOR;\n }\n }\n\n throw new MissingPluginException(['plugin' => $name]);\n }" ]
[ "0.6163537", "0.56673187", "0.55946136", "0.5525757", "0.54943967", "0.54934746", "0.5492311", "0.54453415", "0.5413706", "0.54108876", "0.54098254", "0.54076314", "0.53808886", "0.53701204", "0.53501844", "0.5320596", "0.52960044", "0.5280177", "0.5277892", "0.5239984", "0.52293545", "0.5138653", "0.5125237", "0.51202476", "0.51134527", "0.511278", "0.50912845", "0.50840694", "0.50755155", "0.5069168" ]
0.63846827
0
Renders an atom marker
private function renderAtomMarker (array $openMarkupIndexes, int $numberOfClosedMarkups, int $atomIndex) : string { [$identifier, $textContent, $payload] = $this->mobiledoc["atoms"][$atomIndex] ?? []; $atom = $this->extensionRegistry->getExtension($identifier); $result = null !== $atom ? $atom->render($textContent, $payload) : \htmlspecialchars($textContent, \ENT_QUOTES); return $this->wrapTextWithMarker($openMarkupIndexes, $numberOfClosedMarkups, $result); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function render()\n {\n\t$layer = $this->layer->id;\n\t$location = $this->location->id;\n\t$siteNumber = substr($location, strpos($location, \"_\") + 1);\n\n\treturn \"addMarker($location, \\\"$siteNumber\\\", $layer, $this->class, '$this->content', \" . (($this->closeButton) ? \"true\" : \"false\") . \", true, '$this->icon');\";\n }", "public function show(Marker $marker)\n {\n //\n }", "public function icon($icon)\r\r\n {\r\r\n return '<span class=\"dashicons dashicons-marker ' . $icon . '\"><br/> </span>';\r\r\n }", "public function setMark();", "public function addMarker($content) \n {\n $this->appendPreScript($this->getProperty(\"marker\", $content, \"\", true));\n }", "function getMark($tag, $number = -1) {\n\t\t// like links, f.e.\n\t\t// returns a marker\n\n\t\t++$this->marks_counter;\n\t\tif ( $number == -1 ) {\n\t\t\t$number = $this->marks_counter;\n\t\t}\n\t\t$marker = '((UNIQ-W2L-'.$this->unique.'-'.$tag.'-'.sprintf('%08X', $number).'-QINU))';\n\n\t\treturn $marker;\n\t}", "private function renderMarkers (array $markers) : string\n {\n $text = [];\n\n foreach ($markers as $marker)\n {\n switch ($marker[0])\n {\n case 0:\n $text[] = $this->renderTextMarker($marker[1], $marker[2], $marker[3]);\n break;\n\n case 1:\n $text[] = $this->renderAtomMarker($marker[1], $marker[2], $marker[3]);\n break;\n }\n }\n\n return \\implode(\"\", $text);\n }", "function output_atom($feed) {\n\tglobal $luna_config;\n\n\t// Send XML/no cache headers\n\theader('Content-Type: application/atom+xml; charset=utf-8');\n\theader('Expires: '.date('D, d M Y H:i:s').' GMT');\n\theader('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n\theader('Pragma: public');\n\n\techo '<?xml version=\"1.0\" encoding=\"utf-8\"?>'.\"\\n\";\n\techo '<feed xmlns=\"http://www.w3.org/2005/Atom\">'.\"\\n\";\n\n\techo \"\\t\".'<title type=\"html\"><![CDATA['.escape_cdata($feed['title']).']]></title>'.\"\\n\";\n\techo \"\\t\".'<link rel=\"self\" href=\"'.luna_htmlspecialchars(get_current_url()).'\"/>'.\"\\n\";\n\techo \"\\t\".'<link href=\"'.luna_htmlspecialchars($feed['link']).'\"/>'.\"\\n\";\n\techo \"\\t\".'<updated>'.date('Y-m-d\\TH:i:s\\Z', count($feed['items']) ? $feed['items'][0]['pubdate'] : time()).'</updated>'.\"\\n\";\n\techo \"\\t\".'<generator version=\"'.$luna_config['o_cur_version'].'\">Luna</generator>'.\"\\n\";\n\n\techo \"\\t\".'<id>'.luna_htmlspecialchars($feed['link']).'</id>'.\"\\n\";\n\n\t$content_tag = ($feed['type'] == 'comments') ? 'content' : 'summary';\n\n\tforeach ($feed['items'] as $item) {\n\t\techo \"\\t\".'<entry>'.\"\\n\";\n\t\techo \"\\t\\t\".'<title type=\"html\"><![CDATA['.escape_cdata($item['title']).']]></title>'.\"\\n\";\n\t\techo \"\\t\\t\".'<link rel=\"alternate\" href=\"'.luna_htmlspecialchars($item['link']).'\"/>'.\"\\n\";\n\t\techo \"\\t\\t\".'<'.$content_tag.' type=\"html\"><![CDATA['.escape_cdata($item['description']).']]></'.$content_tag.'>'.\"\\n\";\n\t\techo \"\\t\\t\".'<author>'.\"\\n\";\n\t\techo \"\\t\\t\\t\".'<name><![CDATA['.escape_cdata($item['author']['name']).']]></name>'.\"\\n\";\n\n\t\tif (isset($item['author']['email']))\n\t\t\techo \"\\t\\t\\t\".'<email><![CDATA['.escape_cdata($item['author']['email']).']]></email>'.\"\\n\";\n\n\t\tif (isset($item['author']['uri']))\n\t\t\techo \"\\t\\t\\t\".'<uri>'.luna_htmlspecialchars($item['author']['uri']).'</uri>'.\"\\n\";\n\n\t\techo \"\\t\\t\".'</author>'.\"\\n\";\n\t\techo \"\\t\\t\".'<updated>'.date('Y-m-d\\TH:i:s\\Z', $item['pubdate']).'</updated>'.\"\\n\";\n\n\t\techo \"\\t\\t\".'<id>'.luna_htmlspecialchars($item['link']).'</id>'.\"\\n\";\n\t\techo \"\\t\".'</entry>'.\"\\n\";\n\t}\n\n\techo '</feed>'.\"\\n\";\n}", "public static function mark( $_text )\n\t{\n\t\treturn '<mark>'. $_text . '</mark>';\n\t}", "public function show(Mark $mark)\n {\n //\n }", "function output_atom($feed)\n{\n\tglobal $lang_common, $pun_config;\n\n\t// Send XML/no cache headers\n\theader('Content-Type: application/atom+xml; charset=utf-8');\n\theader('Expires: '.gmdate('D, d M Y H:i:s').' GMT');\n\theader('Cache-Control: must-revalidate, post-check=0, pre-check=0');\n\theader('Pragma: public');\n\n\techo '<?xml version=\"1.0\" encoding=\"utf-8\"?>'.\"\\n\";\n\techo '<feed xmlns=\"http://www.w3.org/2005/Atom\">'.\"\\n\";\n\n\techo \"\\t\".'<title type=\"html\"><![CDATA['.escape_cdata($feed['title']).']]></title>'.\"\\n\";\n\techo \"\\t\".'<link rel=\"self\" href=\"'.pun_htmlspecialchars(get_current_url()).'\"/>'.\"\\n\";\n\techo \"\\t\".'<link href=\"'.pun_htmlspecialchars($feed['link']).'\"/>'.\"\\n\";\n\techo \"\\t\".'<updated>'.gmdate('Y-m-d\\TH:i:s\\Z', count($feed['items']) ? $feed['items'][0]['pubdate'] : time()).'</updated>'.\"\\n\";\n\n\tif ($pun_config['o_show_version'] == '1')\n\t\techo \"\\t\".'<generator version=\"'.$pun_config['o_cur_version'].'\">FluxBB</generator>'.\"\\n\";\n\telse\n\t\techo \"\\t\".'<generator>FluxBB</generator>'.\"\\n\";\n\n\techo \"\\t\".'<id>'.pun_htmlspecialchars($feed['link']).'</id>'.\"\\n\";\n\n\t$content_tag = ($feed['type'] == 'posts') ? 'content' : 'summary';\n\n\tforeach ($feed['items'] as $item)\n\t{\n\t\techo \"\\t\".'<entry>'.\"\\n\";\n\t\techo \"\\t\\t\".'<title type=\"html\"><![CDATA['.escape_cdata($item['title']).']]></title>'.\"\\n\";\n\t\techo \"\\t\\t\".'<link rel=\"alternate\" href=\"'.pun_htmlspecialchars($item['link']).'\"/>'.\"\\n\";\n\t\techo \"\\t\\t\".'<'.$content_tag.' type=\"html\"><![CDATA['.escape_cdata($item['description']).']]></'.$content_tag.'>'.\"\\n\";\n\t\techo \"\\t\\t\".'<author>'.\"\\n\";\n\t\techo \"\\t\\t\\t\".'<name><![CDATA['.escape_cdata($item['author']['name']).']]></name>'.\"\\n\";\n\n\t\tif (isset($item['author']['email']))\n\t\t\techo \"\\t\\t\\t\".'<email><![CDATA['.escape_cdata($item['author']['email']).']]></email>'.\"\\n\";\n\n\t\tif (isset($item['author']['uri']))\n\t\t\techo \"\\t\\t\\t\".'<uri>'.pun_htmlspecialchars($item['author']['uri']).'</uri>'.\"\\n\";\n\n\t\techo \"\\t\\t\".'</author>'.\"\\n\";\n\t\techo \"\\t\\t\".'<updated>'.gmdate('Y-m-d\\TH:i:s\\Z', $item['pubdate']).'</updated>'.\"\\n\";\n\n\t\techo \"\\t\\t\".'<id>'.pun_htmlspecialchars($item['link']).'</id>'.\"\\n\";\n\t\techo \"\\t\".'</entry>'.\"\\n\";\n\t}\n\n\techo '</feed>'.\"\\n\";\n}", "function PM_ATagWrap($icon,$cmd,$bMark='treeroot')\t{\n\t\t$linkConf = array();\n\t\t$linkConf['parameter.']['data'] = 'TSFE:id';\n\t\t$linkConf['additionalParams'] = '&tx_damfrontend_pi1[treeID]='.$this->treeID.'&PM='.htmlspecialchars($cmd);\n\t\t$linkConf['section'] = $bMark;\n\t\tif ($bMark) $linkConf['ATagParams'] = ' name=\"'.$bMark.'\" ';\n\t\treturn $this->cObj->typoLink($icon, $linkConf);\n\t}", "public function edit(Marker $marker)\n {\n //\n }", "function getMarkerFor($content, $type = 'UNKNOWN') {\n\t\t$marker = $this->getMark($type);\n\t\t$this->mask($marker, $content);\n\t\treturn $marker;\n\t}", "protected function renderMarkers(Map $map)\n {\n $html = '';\n \n foreach ($map->getMarkers() as $marker) {\n $lat = $marker->getCoordinate()->getLat();\n $lng = $marker->getCoordinate()->getLng();\n \n if (is_null($lat) || is_null($lng)) {\n continue;\n }\n \n $html .= sprintf(\n 'var %s = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(%s, %s)%s); %s.entities.push(%s);',\n $marker->getVarName(),\n $lat,\n $lng,\n (null !== $marker->getIcon()) ? ', { icon: \"' . $marker->getIcon() . '\" }' : '',\n $map->getVarName(),\n $marker->getVarName()\n );\n \n if (null !== $marker->getIcon()) {\n \n }\n \n if (null !== $marker->getInfoWindow()) {\n $html .= sprintf(\n 'var %s = new Microsoft.Maps.Infobox(%s.getLocation(), {offset:new Microsoft.Maps.Point(-%s,%s), ' .\n 'title:\"%s\", htmlContent:\"<div style=\\\"padding: 10px; width: %spx; height: %spx; border-radius: 5px; ' .\n 'border: solid 1px #777777; background-color: #FFFFFF;\\\"><div style=\\\"text-align: right; ' .\n 'margin-bottom: 10px;\\\"><a href=\\\"#\\\" onclick=\\\"return vichGeoCloseInfobox(%s);\\\" style=\\\"font-size: 10px; ' .\n 'color: #777777;\\\" id=\\\"vich_geo_bing_close\\\">X</a></div>%s</div>\", visible:false, width:%s, height:%s});'.\n 'Microsoft.Maps.Events.addHandler(%s, \"click\", function(e) { %s.setOptions({visible:true}); }); ' .\n '%s.entities.push(%s);',\n $marker->getInfoWindow()->getVarName(),\n $marker->getVarName(),\n $marker->getInfoWindow()->getWidth() / 2.0,\n $marker->getInfoWindow()->getHeight() + 50,\n $this->escapeQuotes($marker->getInfoWindow()->getTitle()),\n $marker->getInfoWindow()->getWidth(),\n $marker->getInfoWindow()->getHeight(),\n $marker->getInfoWindow()->getVarName(),\n $marker->getInfoWindow()->getContent(),\n $marker->getInfoWindow()->getWidth(),\n $marker->getInfoWindow()->getHeight(),\n $marker->getVarName(),\n $marker->getInfoWindow()->getVarName(),\n $map->getVarName(),\n $marker->getInfoWindow()->getVarName()\n );\n \n $html .= 'function vichGeoCloseInfobox(infobox) { infobox.setOptions({ visible: false }); return false; }';\n }\n \n $html .= sprintf(\n '%s.push(new Microsoft.Maps.Location(%s, %s));',\n $this->getMapPinsVarName($map),\n $lat,\n $lng\n );\n }\n \n return $html;\n }", "public function setMark()\n {\n $this->mark = true;\n }", "public function addMark( $value){\n return $this->_add(15, $value);\n }", "public function getMark()\n {\n return $this->mark;\n }", "function atom_start_tag($tag, $level=0, $endline = false, $attributes = null) {\n if ($endline) {\n $endchar = \"\\n\";\n } else {\n $endchar = \"\";\n }\n $attrstring = '';\n if (!empty($attributes) && is_array($attributes)) {\n foreach ($attributes as $key => $value) {\n $attrstring .= \" \".$key.\"=\\\"\".htmlspecialchars($value).\"\\\"\";\n }\n }\n return str_repeat(\" \", $level*2) . \"<\" . $tag . $attrstring . \">\" . $endchar;\n}", "function getInsertMark(){\n\t\t$type = $this->getObjectType(); // \"galleries\" -> \"Gallery\"\n\t\t$title = strip_tags((string)$this->getTitle());\n\t\t$title = preg_replace('/[\\[\\]\\n\\r]/','_',$title);\n\t\t$title = trim($title);\n\t\tif(!strlen($title)){\n\t\t\treturn sprintf('[#%s %s]',$this->getId(),$this->_getObjectClassName()); // [#123 Video]\n\t\t}\n\t\treturn sprintf('[#%s %s: %s]',$this->getId(),$this->_getObjectClassName(),$title); // [#123 Video: Arnold jede na kole]\n\t}", "function addMarkerIcon($dataArray) {\n\t\tif (empty($dataArray)) {\n\t\t\treturn false;\n\t\t} else {\n\t\t \t$this->icons[] = 'WecMap.addIcon(\"' . $this->mapName . '\", \"' . $dataArray['iconID'] . '\", \"' . $dataArray['imagepath'] . '\", \"' . $dataArray['shadowpath'] . '\", new GSize(' . $dataArray['width'] . ', ' . $dataArray['height'] . '), new GSize(' . $dataArray['shadowWidth'] . ', ' . $dataArray['shadowHeight'] . '), new GPoint(' . $dataArray['anchorX'] . ', ' . $dataArray['anchorY'] . '), new GPoint(' . $dataArray['infoAnchorX'] . ', ' . $dataArray['infoAnchorY'] . '));\n\t\t\t';\n\t\t\treturn true;\n\t\t}\n\n\t}", "private function _renderIcon ()\r\n {\r\n return !empty($this->_icon) ? '<i class=\"' . $this->_icon . '\"></i>' : '';\r\n }", "function atom ($href, $title = 'Atom Feed') {\n\t\treturn $this->link(\n\t\t\t[\n\t\t\t\t'href' => $href,\n\t\t\t\t'title' => $title,\n\t\t\t\t'rel' => 'alternate',\n\t\t\t\t'type' => 'application/atom+xml'\n\t\t\t]\n\t\t);\n\t}", "public function icon() {\n\t\t$icon_url = MACHETE_BASE_URL . 'inc/' . $this->params['slug'] . '/icon.svg';\n\t\techo '<img src=\"' . esc_attr( $icon_url ) . '\" style=\"width: 96px; height: 96px;\">';\n\t}", "public function getMarkerStatic()\n {\n return $this->getLat() . ', ' . $this->getLng();\n }", "public function render($flags = null);", "public static function marker()\n\t\t{\n\t\t\t$trace = static::__where_call( __CLASS__ . '::marker()' );\n\t\t\tstatic::$_chronology[] = $trace;\n\t\t}", "public function setMark($arg)\n {\n if (!is_string($arg)) {\n throw new InvalidArgumentException(\n \"ScrapLinePoint name expects string value, \"\n .gettype($arg).\" given\");\n }\n $this->_data['mark'] = $arg;\n }", "function display( array $atts, $content = '' ) {\n\n\t\treturn '<span class=\"main-color\">' . $content . '</span>'; // escaped before\n\t}", "public function setIcon()\n {\n $args = func_get_args();\n \n if(isset($args[0]) && is_string($args[0]))\n {\n if($this->icon === null)\n $this->icon = new MarkerImage();\n \n $this->icon->setUrl($args[0]);\n }\n else if(isset($args[0]) && ($args[0] instanceof MarkerImage))\n $this->icon = $args[0];\n else\n throw new \\InvalidArgumentException();\n }" ]
[ "0.6174508", "0.60378397", "0.58157", "0.5715088", "0.56802666", "0.54767674", "0.53517294", "0.5335319", "0.5325828", "0.53177685", "0.53006464", "0.5243691", "0.51893777", "0.50959355", "0.5077057", "0.5062678", "0.5055235", "0.50379205", "0.50171775", "0.5000075", "0.49679902", "0.49607575", "0.49479222", "0.49457118", "0.49131164", "0.4865766", "0.48525587", "0.48518828", "0.482104", "0.47943416" ]
0.604573
1
Parses the flat attribute list into a structured attribute map. If there are duplicate keys in the list, the last one will overwrite all previous ones in the map.
private function parseFlatAttributes (array $attributes) : array { $numberOfEntries = \floor(\count($attributes) / 2); $structured = []; for ($i = 0; $i < $numberOfEntries; ++$i) { $key = $attributes[$i * 2]; $value = $attributes[($i * 2) + 1]; $structured[$key] = $value; } // if the array has an odd number of entries, just add the last remaining key with `null` as value $lastIndex = \count($attributes) - 1; if (0 === $lastIndex % 2) { $structured[$attributes[$lastIndex]] = null; } return $structured; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static function attributeMap();", "public static function attributeMap();", "public static function attributeMap();", "public static function attributeMap();", "public static function attributeMap();", "public static function attributeMap();", "private function process_attributes() {\n\t\t$paf = file_get_contents($this->dir . $this->file_prefix . 'a' . $this->ext);\n\n\t\t// Match ID and ZIP lines\n\t\tpreg_match_all('!(\\d+)\\s+\"(\\d{5})\"!', $paf, $zips);\n\n\t\t// Assemble matches into a single array with ID and ZIP\n\t\tforeach ($zips[1] as $key => $id) {\n\t\t\tif (preg_match('!\\d{5}!', $zips[2][$key])) {\n\t\t\t\t$this->zip_id_map[$id] = $zips[2][$key];\n\t\t\t}\n\t\t}\n\t\tunset($zips); // free up memory\n\t}", "private function moveAttributes(array $attributeList, array $fieldAttributeList): array\n {\n if (is_iterable($attributeList)) {\n foreach ($attributeList as $key => $attribute) {\n if ($this->isFieldAttribute($key)) {\n $fieldAttributeList[$key] = $attribute;\n }\n }\n }\n return $fieldAttributeList;\n }", "public function preprocessAttributes() {\n foreach ($this->variables as $name => $value) {\n if (strpos($name, 'attributes') !== FALSE && is_array($value)) {\n $this->variables[$name] = new Attribute($value);\n }\n }\n }", "public static function attributeMap()\n {\n return [\n 'email' => 'email',\n 'address1' => 'address1',\n 'address2' => 'address2',\n 'country' => 'country',\n 'state' => 'state',\n 'city' => 'city',\n 'zipcode' => 'zipcode',\n 'phone' => 'phone',\n 'firstname' => 'firstname',\n 'lastname' => 'lastname'\n ];\n }", "public function applyWCAttributesPost($listitem)\n {\n //variations parent's applyWCAttributes() can mess this up, so patching\n if (is_array($listitem->wc_attributes)) {\n foreach ($listitem->wc_attributes as $index => $thisAttribute) {\n //For Attributes not in pa_XYZ but in attribute_XYZ exists in listitem->attributes, trim the word attribute\n $custom_index = 'attribute_' . strtolower($thisAttribute['name']);\n if (isset($listitem->attributes[$custom_index])) {\n $listitem->attributes[strtolower($thisAttribute['name'])] = $listitem->attributes[$custom_index];\n unset($listitem->attributes[$custom_index]);\n }\n }\n }\n }", "private function ProcessAttributes() {\n\t\t$csvilog = JRequest::getVar('csvilog');\n\t\t/* Check if the attributes is to be added */\n\t\tif ($this->attributes) {\n\t\t\t$csvfields = JRequest::getVar('csv_fields');\n\t\t\t$csvilog->AddMessage('debug', JText::_('DEBUG_ADDING_ATTRIBUTES'));\n\t\t\t$attributes = explode( \"|\", $this->attributes );\n\t\t\t$i = 0;\n\t\t\twhile(list(,$val) = each($attributes)) {\n\t\t\t\t$values = explode( \"::\", $val );\n\t\t\t\tif (count($values) == 2) {\n\t\t\t\t\t/* Fix the array to show the correct names to bind the data */\n\t\t\t\t\t$this->_vm_product_attribute_sku->bind(array('product_id' => $this->product_id, 'attribute_name' => $values[0], 'attribute_list' => $values[1]));\n\t\t\t\t\t/* Store the data */\n\t\t\t\t\t$this->_vm_product_attribute_sku->store();\n\t\t\t\t\t$csvilog->AddMessage('debug', JText::_('DEBUG_STORE_ATTRIBUTE'), true);\n\t\t\t\t\t/* Clean for new insert */\n\t\t\t\t\t$this->_vm_product_attribute_sku->reset();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$csvilog->AddMessage('debug', JText::_('DEBUG_ATTRIBUTE_INCORRECT'));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function mergeAttributeListFromFFData($ffData, $prefix, $ctList, $uid_local, &$paList)\t{\n\t if(is_array($ctList)){\t\n\t foreach ($ctList as $ctUid)\t{\n\t\t\t$ffaList = explode(',', $ffData[$prefix .$ctUid['uid']]['vDEF']);\n\t\t\tif (count($ffaList) == 1 && $ffaList[0] == '') continue;\n\t\t\tforeach ($ffaList as $aUid)\t{\n\t\t\t\tif (!(\n\t\t\t\t\t$this->checkArray($uid_local, $paList, 'uid_local') &&\n\t\t\t\t\t$this->checkArray($aUid, $paList, 'uid_foreign') &&\n\t\t\t\t\t$this->checkArray($ctUid['uid'], $paList, 'uid_correlationtype')\n\t\t\t\t))\t{\n\t\t\t\t\t\n\t\t\t\t\tif($aUid != '') {\n\t\t\t\t\t\t$newRel = array(\n\t\t\t\t\t\t\t'uid_local' => $uid_local,\n\t\t\t\t\t\t\t'uid_foreign' => $aUid,\n\t\t\t\t\t\t\t'uid_correlationtype' => $ctUid['uid']\n\t\t\t\t\t\t);\n\t\n\t\t\t\t\t\t$paList[] = $newRel;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t }\n\t}", "protected function _prepareData($data)\n {\n foreach ($this->_mapAttributes as $attributeAlias=>$attributeCode) {\n if(isset($data[$attributeAlias]))\n {\n $data[$attributeCode] = $data[$attributeAlias];\n unset($data[$attributeAlias]);\n }\n }\n return $data;\n }", "private function processArrayAttributes(&$attributes)\n {\n foreach ($this->rules() as $fieldName => $rule) {\n\n // Only process field names with array-dividers.\n if (strpos($fieldName, '.') > 0) {\n\n // Explode the field-name via the array-divider character '.'.\n $explodedFieldName = explode('.', $fieldName);\n\n // Find out attribute to use.\n // Array fields might come in 2 possible variants:\n // - The wanted attribute is the last element (e.g. [...]domainList.*.domainName)\n // - The wanted attribute is the last but one element (e.g. [...]domainName.*)\n // (In either case of the examples, the attribute should be 'domainName'.\n\n // In case of [...]domainList.*.domainName, the last element of $explodedFieldName is the attribute we want.\n $attribute = array_pop($explodedFieldName);\n\n // In case of [...]domainName.*, the one before the last is the attribute we want.\n if (is_numeric($attribute)) {\n $attribute = array_pop($explodedFieldName);\n }\n\n // Finally, if a translation for $attribute exits, we add the array-field-name with that translation.\n if (isset($attributes[$attribute])) {\n $attributes[$fieldName] = $attributes[$attribute];\n }\n }\n }\n }", "public static function attributeMap()\n {\n return [\n 'barcode' => 'barcode',\n 'url' => 'url'\n ];\n }", "function hackAttrib($value){\t\t\r\n\t $attribute = explode (';',$value);\t\t\r\n\t foreach ($attribute as $pair) {\t\t\r\n\t list ($k,$v) = explode (':',$pair);\t\t\r\n\t $pairs[$k] = $v;\t\t\r\n\t }\t\t\r\n\t return $pairs;\t\t\r\n\t}", "function parse_attributes(array $attr = []) : string\n {\n return join(' ', array_map(function($key) use ($attr) {\n if (is_bool($attr[$key])) {\n return $attr[$key] ? $key : '';\n }\n\n if (is_array($attr[$key])) {\n return $key.'=\"'.implode(' ', $attr[$key]).'\"';\n }\n else {\n return $key.'=\"'.$attr[$key].'\"';\n }\n }, array_keys($attr)));\n }", "public static function attributeMap()\n {\n return parent::attributeMap() + self::$attributeMap;\n }", "public static function attributeMap()\n {\n return parent::attributeMap() + self::$attributeMap;\n }", "public static function attributeMap()\n {\n return parent::attributeMap() + self::$attributeMap;\n }", "public static function attributeMap()\n {\n return parent::attributeMap() + self::$attributeMap;\n }", "public static function attributeMap()\n {\n return parent::attributeMap() + self::$attributeMap;\n }", "public static function attributeMap()\n {\n return parent::attributeMap() + self::$attributeMap;\n }", "public static function attributeMap()\n {\n return parent::attributeMap() + self::$attributeMap;\n }", "public static function attributeMap()\n {\n return parent::attributeMap() + self::$attributeMap;\n }", "public static function attributeMap()\n {\n return parent::attributeMap() + self::$attributeMap;\n }", "function groupArray($attribs){\t\t\r\n\t$gr_attrib = array();\t\t\r\n\tforeach ($attribs as $key => $value) {\t\t\r\n\t\tif (array_key_exists($value, $gr_attrib)) {\t\t\r\n\t\t\t $gr_attrib[$value] .= \",$key\";\t\t\r\n\t\t\t} else {\t\t\r\n\t\t\t $gr_attrib[$value] = $key;\t\t\r\n\t\t\t} // endif\t\t\r\n\t\t} // end foreach\t\t\r\n\t$attribs = array_flip($gr_attrib);\t\t\r\n\treturn $attribs;\t\t\r\n\t\t\r\n\t}", "private function parseAttributes($source, $attributesList)\n {\n\n if (is_null($source) || !$source) {\n return false;\n }\n\n foreach ($source as $column => $value) {\n $property = \"set\" . ucfirst($column);\n if (is_array($attributesList) && in_array($column, $attributesList)) {\n $this->$property($value);\n }\n }\n }", "protected function scanAttributes()\n {\n if (preg_match('/^ *\\(.+\\)/', $this->input)) {\n $this->input = trim($this->input);\n $index = $this->getDelimitersIndex('(', ')');\n $input = preg_replace('/ *= */', '=', trim(mb_substr($this->input, 1, $index - 1)));\n $token = $this->takeToken('attributes', $input);\n\n preg_match_all('/#{[^}]*}/', $input, $matches);\n $placeHolders = $matches[0];\n $this->placeHolderCounter = -1;\n $input = trim(preg_replace_callback('/#{[^}]*}/', function ($matches) {\n $this->placeHolderCounter++;\n return '{' . (int)$this->placeHolderCounter . '}';\n }, $input));\n\n preg_match_all('/\"([^\"]*)\"/', $input, $matches);\n $doubleQuotedValues = $matches[1];\n $this->placeHolderCounter = -1;\n $input = trim(preg_replace_callback('/\"([^\"]*)\"/', function ($matches) {\n $this->placeHolderCounter++;\n return '{<' . (int)$this->placeHolderCounter . '>}';\n }, $input));\n\n preg_match_all(\"/'([^']*)'/\", $input, $matches);\n $singleQuotedValues = $matches[1];\n $this->placeHolderCounter = -1;\n $input = trim(preg_replace_callback(\"/'([^']*)'/\", function ($matches) {\n $this->placeHolderCounter++;\n return '{<<' . (int)$this->placeHolderCounter . '>>}';\n }, $input));\n\n //$attributes = preg_split('/ *(?:,| ) *(?=[\\'\"\\w\\-]+ *[=]|[\\w\\-]+ *$)/', $token->value);\n $attributes = preg_split('/ *(?:,| ) */', $input);\n\n $this->consumeInput($index + 1);\n $token->attributes = [];\n\n foreach ($attributes as $pair) {\n $pair = preg_replace('/^ *| *$/', '', $pair);\n $equal = mb_strpos($pair, '=');\n\n $sbrac = mb_strpos($pair, '\\'');\n $dbrac = mb_strpos($pair, '\"');\n if ($sbrac < 1) {\n $sbrac = false;\n }\n if ($dbrac < 1) {\n $dbrac = false;\n }\n if ((false !== $sbrac && $equal > $sbrac) || (false !== $dbrac && $equal > $dbrac)) {\n $equal = false;\n }\n\n if (false === $equal) {\n $key = $pair;\n if (preg_match('/^{<<(\\d+)>>}$/', $key, $matches)) {\n $key = $singleQuotedValues[$matches[1]];\n }\n if (preg_match('/^{<(\\d+)>}$/', $key, $matches)) {\n $key = $doubleQuotedValues[$matches[1]];\n }\n if (preg_match('/(.*){(\\d+)}(.*)/', $key, $matches)) {\n $key = $matches[1] . $placeHolders[$matches[2]] . $matches[3];\n }\n $value = true;\n } else {\n $splitter = $equal;\n\n $key = mb_substr($pair, 0, $splitter);\n $value = preg_replace('/^ *[\\'\"]?|[\\'\"]? *$/', '', mb_substr($pair, ++$splitter, mb_strlen($pair)));\n\n if ('true' === $value) {\n $value = true;\n } else if (empty($value) || 'null' === $value || 'false' === $value) {\n $value = false;\n }\n\n if (preg_match('/^{<<(\\d+)>>}$/', $value, $matches)) {\n $value = $singleQuotedValues[$matches[1]];\n }\n if (preg_match('/^{<(\\d+)>}$/', $value, $matches)) {\n $value = $doubleQuotedValues[$matches[1]];\n }\n if (preg_match('/(.*){(\\d+)}(.*)/', $value, $matches)) {\n $value = $matches[1] . $placeHolders[$matches[2]] . $matches[3];\n }\n }\n\n $token->attributes[preg_replace( ['/^ +| +$/', '/^[\\'\"]|[\\'\"]$/'], '', $key )] = $value;\n }\n\n return $token;\n }\n }" ]
[ "0.5653926", "0.5653926", "0.5653926", "0.5653926", "0.5653926", "0.5653926", "0.55837816", "0.53254336", "0.52852374", "0.52431184", "0.5194906", "0.5071859", "0.5040619", "0.5032642", "0.5026232", "0.49919996", "0.4974432", "0.49731025", "0.4940545", "0.4940545", "0.4940545", "0.4940545", "0.4940545", "0.4940545", "0.4940545", "0.4940545", "0.4940545", "0.4916153", "0.48952636", "0.48433656" ]
0.60295707
0
Add an error for missing use of unslashing.
public function add_unslash_error( File $phpcsFile, $stackPtr ) { $tokens = $phpcsFile->getTokens(); $var_name = $tokens[ $stackPtr ]['content']; if ( isset( $this->slashed_superglobals[ $var_name ] ) === false ) { // WP doesn't slash these, so they don't need unslashing. return; } // We know there will be array keys as that's checked in the process_token() method. $array_keys = VariableHelper::get_array_access_keys( $phpcsFile, $stackPtr ); $error_data = array( $var_name . '[' . implode( '][', $array_keys ) . ']' ); $phpcsFile->addError( '%s not unslashed before sanitization. Use wp_unslash() or similar', $stackPtr, 'MissingUnslash', $error_data ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function add_unslash_error($stackPtr)\n {\n $this->phpcsFile->addError('%s data not unslashed before sanitization. Use wp_unslash() or similar', $stackPtr, 'MissingUnslash', array($this->tokens[$stackPtr]['content']));\n }", "public function addError(string $error): void;", "function addSlashAtEnd(&$url) : void\n{\n if (!$url || (is_string($url) && substr($url, -1) !== '/')) {\n $url .= '/';\n }\n}", "private function validatePath()\n\t{\n\t\t$this->path = CLASSOVERRIDER_PATH;\n\t\tif( strpos(strrev($this->path), '/') !== 0 ) {\n\t\t\t$this->path .= '/';\n\t\t}\n\t}", "public function testInvalidUrlPath()\n {\n new ObjectUrl('http://invalid~url*path', true);\n }", "public function addError($key, $value = '');", "public function testInvalidDirectorySeparatorException()\n {\n new PathShortener('whatev', '/');\n new PathShortener('whatev', '\\\\');\n\n $this->expectException(InvalidDirectorySeparatorException::class);\n\n // This should cause an exception\n new PathShortener('because', 'it\\'s not a slash');\n }", "function is_slash_term($path)\n {\n return in_array($path[strlen($path) - 1], ['/', '\\\\']);\n }", "public function testRunBadLocation()\n {\n $this->setExpectedException('\\SLiib\\WebApp\\Security\\Exception\\CheckerError');\n\n $this->object->getRule(1)->addLocation('BadLoacation');\n $this->object->run();\n }", "public function testAddPathThrowsExceptionOnUnreadableDirectory()\n {\n try {\n $this->handler->addPath('/an/unreadable/directory/path');\n } catch(Phergie_Plugin_Exception $e) {\n $this->assertEquals(\n Phergie_Plugin_Exception::ERR_DIRECTORY_NOT_READABLE,\n $e->getCode()\n );\n return;\n }\n\n $this->fail('An expected exception has not been raised.');\n }", "public function addSlashes( $t );", "public function parseErrorAction()\n {\n // include file with parse error\n require __DIR__ . '/../../../extra/parse-error.phpx';\n }", "public function testLoaderClassIllegalFilename()\n {\n $this->setExpectedException('\\\\Zend\\\\Loader\\\\SecurityException', 'Illegal character');\n Loader::loadClass('/path/:to/@danger');\n }", "public function preventAddSlashes( $fields=array() );", "function error_override() {\n\t\t\techo '404 NOT FOUND';\n\t\t}", "public function testRemoveExtraSlashesWithoutHost(): void\n {\n // present, the starting slashes MUST be reduced to one.\n $uri = $this->uri->withPath('//path');\n $this->assertNotSame($this->uri, $uri);\n $this->assertSame('/path', $uri->getPath());\n // URI \"//path\" would be interpreted as network reference and thus change the original path to the host.\n $this->assertSame('/path', (string) $uri);\n }", "public function testInvalidStartLineParsingWithRelativeUri()\n {\n $parser = $this->parser;\n $uri = 'test/%2F..%2F..%2F..%2F';\n $parser->parseStartLine('GET ' . $uri . ' HTTP/1.1' . \"\\r\\n\");\n }", "public function testInvalidPath() {\n AbstractTemplate::setPath(DATA_DIR.'no-templates');\n }", "public static function noInstallDirName()\n {\n\n printf(\"\\033[37;01;41m An Error Has Occured \\n \\033[00m\\033[37;41mAn installation directory path is required \\033[0m \\n\\n\");\n self::help();\n }", "public function ignoreErrorsFrom($path) {\r\n\t\t\tPDebug::$ignoreErrorPaths[] = realpath($path);\r\n\t\t}", "private function sanitizePath(&$path) {\n\t\t$path = str_replace(array(\n\t\t\t'/',\n\t\t\t'\\\\'\n\t\t), DIRECTORY_SEPARATOR, $path);\n\t}", "private function trail_slash ( $url ) \r\n\t{\r\n\t $slash = mb_substr($url, -1);\r\n\t \r\n\t if ('/' == $slash) {\r\n\t return $url;\r\n\t } elseif (\"\\\\\" == $slash) {\r\n\t return $url;\r\n\t }\r\n\t \r\n\t return $url . '/';\r\n\t}", "public function addError($error);", "abstract protected function _getErrorString();", "private function verifyPath(&$path)\n {\n $lastChar = substr($path, -1);\n\n if ($lastChar !== '/'){\n $path .= '/';\n }\n }", "function wrong_path(){\n\n\t\t$this->view->response(\"Ruta mal especificada\",404);\n\n\t}", "public static function invalidUri() : self\n {\n return self::error('invalid_uri');\n }", "function add_ending_slash($path){\r\n // Check if last character is a slash\r\n //$last_char = substr($path, strlen($path)-1, 1);\r\n $last_char = $path[strlen($path)-1];\r\n if ($last_char != '/' && $last_char != '\\\\') {\r\n // determine if windows or unix\r\n $path .= (substr_count($path, '\\\\') > 0) ? '\\\\\\\\' : '/'; \r\n }\r\n return $path;\r\n}", "protected function addError($key, $value = '')\n {\n $this->addErrors([$key => $value]);\n }", "public function handleNotFoundError($errnum, $errstr)\n {\n if (strstr($errstr, 'No such file')) {\n $this->error = true;\n }\n }" ]
[ "0.6820275", "0.5649859", "0.5616267", "0.56055486", "0.55968416", "0.55826974", "0.5554482", "0.5393044", "0.5380126", "0.53652275", "0.5346869", "0.52707714", "0.52426845", "0.52425575", "0.5233818", "0.5220439", "0.52031404", "0.52000946", "0.5182503", "0.51689327", "0.51345813", "0.5098198", "0.506466", "0.5058911", "0.5053424", "0.50488275", "0.5041885", "0.5034517", "0.5025446", "0.50228953" ]
0.64617306
1
Attach roles to the user.
public function attachRoles($roles);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function attachRoles($roles = []);", "public function attachRole(User $user, Role $role);", "public function setRole($userId, $roles)\n { \n foreach ($roles as $key => $value) {\n $this->model->find($userId)->roles()->attach($value); \n } \n }", "public function attachRoles($roles) {\n foreach ($roles as $role) {\n $this->attachRole($role);\n }\n }", "public function attachRole($user, $role)\n {\n $user->attachRole($role);\n }", "public function attachRoles($roles)\n {\n foreach($roles as $role)\n {\n $this->attachRole($role);\n }\n }", "public function attachRoles($roles)\n {\n foreach ($roles as $role) {\n $this->attachRole($role);\n }\n }", "public function attachRole($role);", "public function attachRole($role);", "public function attachRoles($roles = [], $company = null);", "public function attachRole(Role $role, User $user, Request $request)\n {\n $user= Auth::user();\n $roles= Role::all();\n $user->roles()->attach($request->role);\n //$book->saveBook($data);\n return redirect()->back();\n }", "public function assignRole($user, $role);", "public static function assignRoleToUser($user_id,$role_id);", "protected function assignRoleToUsers(): void\n {\n foreach (User::all() as $user) {\n $role = Role::firstOrCreate(['name' => Role::USER]);\n $user->assignRole($role);\n }\n }", "public function testAttachRoles()\n {\n $user = m::mock('HasRoleUser')->makePartial();\n\n /*\n |------------------------------------------------------------\n | Expectation\n |------------------------------------------------------------\n */\n $user->shouldReceive('attachRole')\n ->with(1)\n ->once()->ordered();\n $user->shouldReceive('attachRole')\n ->with(2)\n ->once()->ordered();\n $user->shouldReceive('attachRole')\n ->with(3)\n ->once()->ordered();\n\n /*\n |------------------------------------------------------------\n | Assertion\n |------------------------------------------------------------\n */\n $result = $user->attachRoles([1, 2, 3]);\n $this->assertInstanceOf('HasRoleUser', $result);\n }", "public function setRolesAttribute($roles)\n {\n static::saved(function (self $model) use ($roles) {\n $model->roles()->sync($roles);\n });\n }", "public function attachRoles($role, $roleIds)\n {\n $role = ! is_int($role) ? $role : $this->find($role);\n $role->roles()->attach($roleIds);\n }", "public function attachRole($role_name)\n {\n $role = Role::where('name', '=', $role_name)->first();\n if(isset($role))\n {\n $pivot = DB::table('user_roles')->where('user_id', '=', $this->id)->where('role_id', '=', $role->id)-get();\n if(!isset($pivot))\n {\n DB::table('user_roles')->insert(array( 'role_id' => $role->id, 'user_id' => $this->id, ));\n }\n }\n }", "public function syncRoles($roles, $detaching = true);", "public function testAddRoles() {\n\n $user = Auth::user();\n //return dd($user);\n\n //Таким образом добавляем Роль для пользователя\n //$user->roles()->attach(2);\n\n //$user->roles()->attach($admin); // id only\n\n return \"success\";\n }", "public function run(User $user, Role $roles) {\n\n $admin = $user->create([\n 'name' => 'BlogAdmin',\n 'email' => '[email protected]',\n 'password' => app('hash')->make('password'),\n ]);\n\n $roleid = $roles->where('role_key', User::ROLE_ADMIN)->first();\n $admin->roles()->attach($roleid->id);\n }", "public function setroles(){\n $dev_permission = AdminPermission::where('slug','create-tasks')->first();\n\t\t$manager_permission = AdminPermission::where('slug', 'edit-tasks')->first();\n\n\t\t//RoleTableSeeder.php\n\t\t$dev_role = new AdminRole();\n\t\t$dev_role->slug = 'developer';\n\t\t$dev_role->name = 'Front-end Developer';\n\t\t$dev_role->save();\n\t\t$dev_role->permissions()->attach($dev_permission);\n\n\t\t$manager_role = new AdminRole();\n\t\t$manager_role->slug = 'manager';\n\t\t$manager_role->name = 'Assistant Manager';\n\t\t$manager_role->save();\n\t\t$manager_role->permissions()->attach($manager_permission);\n\n\t\t$dev_role = AdminRole::where('slug','developer')->first();\n\t\t$manager_role = AdminRole::where('slug', 'manager')->first();\n\n\t\t$createTasks = new AdminPermission();\n\t\t$createTasks->slug = 'create-tasks';\n\t\t$createTasks->name = 'Create Tasks';\n\t\t$createTasks->save();\n\t\t$createTasks->roles()->attach($dev_role);\n\n\t\t$editUsers = new AdminPermission();\n\t\t$editUsers->slug = 'edit-users';\n\t\t$editUsers->name = 'Edit Users';\n\t\t$editUsers->save();\n\t\t$editUsers->roles()->attach($manager_role);\n\n\t\t$dev_role = AdminRole::where('slug','developer')->first();\n\t\t$manager_role = AdminRole::where('slug', 'manager')->first();\n\t\t$dev_perm = AdminPermission::where('slug','create-tasks')->first();\n\t\t$manager_perm = AdminPermission::where('slug','edit-users')->first();\n\n\t\t$developer = new AdminAuth();\n\t\t$developer->name = 'Swapnil M.';\n\t\t$developer->email = '[email protected]';\n\t\t$developer->password = bcrypt('swapnil');\n\t\t$developer->save();\n\t\t$developer->roles()->attach($dev_role);\n\t\t$developer->permissions()->attach($dev_perm);\n\n\t\t$manager = new AdminAuth();\n\t\t$manager->name = 'Anil Kumar';\n\t\t$manager->email = '[email protected]';\n\t\t$manager->password = bcrypt('kumar');\n\t\t$manager->save();\n\t\t$manager->roles()->attach($manager_role);\n\t\t$manager->permissions()->attach($manager_perm);\n\n\n\t\treturn redirect()->back();\n }", "public function setRoles(Authenticatable $user) {\n if (isset($this->ldapRole) && isset($this->roleMap)) {\n $this->connect();\n $userInfo = $this->adldap->user()->info($user->name, [$this->ldapRole])[0];\n $this->disconnect();\n $userRolesFromLdap = array_slice($userInfo[$this->ldapRole],1);\n $userModel = $this->userModel;\n foreach ($this->roleMap as $role => $entrust_role) {\n $userHasRole = $userModel::find($user->id)->hasRole($entrust_role);\n $ldapHasRole = in_array($role,$userRolesFromLdap);\n $entrust_role = \\App\\Role::where('name','=',$entrust_role)->first();\n if ($userHasRole && !$ldapHasRole) {\n $user->detachRole($entrust_role);\n }\n if (!$userHasRole && $ldapHasRole) {\n $user->attachRole($entrust_role);\n }\n }\n }\n }", "public function store(Request $request)\n {\n $v = Validator::make($request->all(), [\n 'usersName' => 'required',\n 'usersEmail' => 'required|email',\n ]);\n if($v->fails())\n {\n return redirect()->back()->withErrors($v->errors());\n }\n \n $users = new User(); \n $users->name = $request->input('usersName');\n $users->email = $request->input('usersEmail');\n \n $roles_id = $request->get('roles');\n $users->save();\n $users->roles()->attach($roles_id, ['users_id' => $users->id]);\n $users->save();\n\n\n \n \n\n return redirect('/users');\n }", "public static function set(\n\t\t\t\\Scrivo\\Context $context, \\Scrivo\\User $user, array $roles) {\n\t\t\\Scrivo\\ArgumentCheck::assertArgs(func_get_args(), array(\n\t\t\tnull, null, null));\n\t\ttry {\n\n\t\t\t$sth = $context->connection->prepare(\n\t\t\t\t\"DELETE FROM user_role WHERE\n\t\t\t\tinstance_id = :instId AND user_id = :userId\");\n\n\t\t\t$context->connection->bindInstance($sth);\n\t\t\t$sth->bindValue(\":userId\", $user->id, \\PDO::PARAM_INT);\n\n\t\t\t$sth->execute();\n\n\t\t\tif ($roles) {\n\t\t\t\t$sth = $context->connection->prepare(\n\t\t\t\t\t\"INSERT INTO user_role\n\t\t\t\t\t (instance_id, role_id, user_id, is_publisher)\n\t\t\t\t\tVALUES (:instId, :roleId, :userId, :publisher)\");\n\n\t\t\t\t$context->connection->bindInstance($sth);\n\t\t\t\t$sth->bindValue(\":userId\", $user->id, \\PDO::PARAM_INT);\n\n\t\t\t\tforeach ($roles as $role) {\n\t\t\t\t\t$sth->bindValue(\":roleId\", $role->id, \\PDO::PARAM_INT);\n\t\t\t\t\t$sth->bindValue(\":publisher\",\n\t\t\t\t\t\t(bool)$role->isPublisher, \\PDO::PARAM_BOOL);\n\n\t\t\t\t\t$sth->execute();\n\t\t\t\t}\n\t\t\t}\n\n\t\t} catch(\\PDOException $e) {\n\t\t\tthrow new \\Scrivo\\ResourceException($e);\n\t\t}\n\t}", "public function postAdminAssignRoles(Request $request)\n {\n $user = User::where('email', $request['email'])->first();\n $user->roles()->detach();\n if ($request['role_user']) {\n $user->roles()->attach(Role::where('name', 'User')->first());\n }\n if ($request['role_author']) {\n $user->roles()->attach(Role::where('name', 'Author')->first());\n }\n if ($request['role_admin']) {\n $user->roles()->attach(Role::where('name', 'Admin')->first());\n }\n return redirect()->back();\n }", "public function syncRoles($roles = []);", "function bbp_add_roles()\n{\n}", "public function attachRole($role, $company = null);", "public function add_user_roles(){\n add_role('open_star','Open Star',array('edit_posts' => false,'delete_posts' => false,'read' => true,'show_bar'=>true));\n add_role('close_star','Close Star',array('edit_posts' => false,'delete_posts' => false,'read' => true));\n }" ]
[ "0.7933213", "0.76053697", "0.711227", "0.70956224", "0.70549184", "0.70026034", "0.69926655", "0.6791473", "0.6791473", "0.67614084", "0.666673", "0.6603117", "0.63645905", "0.63066584", "0.624248", "0.6235366", "0.6207281", "0.62062067", "0.6191241", "0.6172904", "0.61658394", "0.616551", "0.61637014", "0.6141494", "0.611885", "0.61077297", "0.6082626", "0.60539806", "0.6048843", "0.6036908" ]
0.79045486
1
Detach roles from the user.
public function detachRoles($roles);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function detachRoles($roles = []);", "public function detachRoles($roles)\n {\n foreach($roles as $role)\n {\n $this->detachRole($role);\n }\n }", "public function detachRole($role);", "public function detachRole($role);", "public function detachRoles($roles=null)\n {\n if (!$roles) $roles = $this->roles()->get();\n foreach ($roles as $role) {\n $this->detachRole($role);\n }\n }", "public function detachRoles($roles = [], $company = null);", "public function detachRoles($roles = null) {\n if (!$roles) $roles = $this->roles()->get();\n\n foreach ($roles as $role) {\n $this->detachRole($role);\n }\n }", "public function detachRoles($role)\n {\n $role = ! is_int($role) ? $role : $this->find($role);\n $role->roles()->detach();\n }", "function bbp_remove_roles()\n{\n}", "public function detach(UserInterface $user = null)\n {\n // remove all users from a role\n if ($user === null) {\n $this\n ->findByRoleId($this->getRoleId())\n ->delete();\n return;\n }\n\n // remove a user from a role\n $roleUsers = $this\n ->findFirst([\n 'conditions' => [\n ['user_id = ?0'],\n ['role_id = ?1']\n ],\n 'bind' => [\n (int) $user->getUserId(),\n (int) $this->getRoleId()\n ]\n ]);\n\n // check if there is a role record to remove\n if ($roleUsers) {\n $roleUsers->delete();\n }\n }", "public function removeRole($user, $role);", "public function detachAllRole()\n {\n DB::table('role_user')->where('user_id', $this->id)->delete();\n\n return $this;\n }", "function remove_roles() {\n\n remove_role( 'subscriber' );\n remove_role( 'contributor' );\n\n}", "public function detachUser(Request $request) {\n $validator = Validator::make($request->all(), [\n 'user_id' => 'required|numeric|exists:users,id',\n 'role_id' => 'required|numeric|exists:roles,id'\n ]);\n if ($validator->fails()) {\n return response()->json(['response'=>'error', 'message'=>$validator->errors()->first()], 400); \n }\n $role = Role::find($request->role_id);\n $user = User::find($request->user_id);\n\n $user->roles()->detach($role->id);\n $notif = new Notification;\n $notif->text = __('notification.role_unassign', ['role'=> Role::find($request->role_id)->name]);\n $user->notifications()->save($notif);\n return response()->json(null,204); \n }", "public function detachAllRoles() {\n\t\t$this->clearCached();\n\n\t\treturn $this->roles()->detach();\n\t}", "public function testDetachRole()\n {\n $roleObject = m::mock('Role');\n $roleArray = ['id' => 2];\n\n $user = m::mock('HasRoleUser')->makePartial();\n\n /*\n |------------------------------------------------------------\n | Expectation\n |------------------------------------------------------------\n */\n $roleObject->shouldReceive('getKey')\n ->andReturn(1);\n\n $user->shouldReceive('roles')\n ->andReturn($user);\n $user->shouldReceive('detach')\n ->with(1)\n ->once()->ordered();\n $user->shouldReceive('detach')\n ->with(2)\n ->once()->ordered();\n $user->shouldReceive('detach')\n ->with(3)\n ->once()->ordered();\n\n Cache::shouldReceive('forget')\n ->times(6);\n\n /*\n |------------------------------------------------------------\n | Assertion\n |------------------------------------------------------------\n */\n $result = $user->detachRole($roleObject);\n $this->assertInstanceOf('HasRoleUser', $result);\n $result = $user->detachRole($roleArray);\n $this->assertInstanceOf('HasRoleUser', $result);\n $result = $user->detachRole(3);\n $this->assertInstanceOf('HasRoleUser', $result);\n }", "function rules_action_user_remove_role($account, $roles) {\n if ($account->uid) {\n foreach ($roles as $rid) {\n // If the user has this role, remove it.\n if (isset($account->roles[$rid])) {\n unset($account->roles[$rid]);\n }\n }\n }\n else {\n return FALSE;\n }\n}", "public static function removeUsersRole($user_id);", "public function testDetachAllRoles()\n {\n $roleA = $this->mockRole('RoleA');\n $roleB = $this->mockRole('RoleB');\n\n $user = m::mock('HasRoleUser')->makePartial();\n $user->roles = [$roleA, $roleB];\n\n $relationship = m::mock('BelongsToMany');\n\n /*\n |------------------------------------------------------------\n | Expectation\n |------------------------------------------------------------\n */\n Config::shouldReceive('get')->with('laratrust.role')->once()->andReturn('App\\Role');\n Config::shouldReceive('get')->with('laratrust.role_user_table')->once()->andReturn('role_user');\n Config::shouldReceive('get')->with('laratrust.user_foreign_key')->once()->andReturn('user_id');\n Config::shouldReceive('get')->with('laratrust.role_foreign_key')->once()->andReturn('role_id');\n\n $relationship->shouldReceive('get')\n ->andReturn($user->roles)->once();\n\n $user->shouldReceive('belongsToMany')\n ->andReturn($relationship)->once();\n\n $user->shouldReceive('detachRole')->twice();\n\n /*\n |------------------------------------------------------------\n | Assertion\n |------------------------------------------------------------\n */\n $user->detachRoles();\n }", "public function testDetachRoles()\n {\n $user = m::mock('HasRoleUser')->makePartial();\n\n /*\n |------------------------------------------------------------\n | Expectation\n |------------------------------------------------------------\n */\n $user->shouldReceive('detachRole')\n ->with(1)\n ->once()->ordered();\n $user->shouldReceive('detachRole')\n ->with(2)\n ->once()->ordered();\n $user->shouldReceive('detachRole')\n ->with(3)\n ->once()->ordered();\n\n /*\n |------------------------------------------------------------\n | Assertion\n |------------------------------------------------------------\n */\n $result = $user->detachRoles([1, 2, 3]);\n $this->assertInstanceOf('HasRoleUser', $result);\n }", "public function unassignAllRoles($userId)\n {\n $user = $this->model->find($userId);\n $user->roles()->detach();\n }", "public function detachRole($role, $company = null);", "public function down()\n\t{\n\t\tSchema::drop('role');\n\t}", "public function removeRoles(array $roles)\n {\n $this->storedRoles = array_diff($this->storedRoles, $roles);\n }", "public function detachRole($RoleObj)\n {\n parent::detachRole($RoleObj);\n\n DB::delete(\n DB::raw(\n '\n DELETE FROM access_list_users \n WHERE \n user_id = :USER_ID AND\n access_list_id = :ACCESS_LIST_ID\n '\n ),\n [\n 'USER_ID' => $this->id,\n 'ACCESS_LIST_ID' => $this->client->allAccessList->id,\n ]\n );\n if (Cache::getStore() instanceof TaggableStore)\n {\n Cache::tags(Config::get('entrust.role_user_table'))->flush();\n }\n\n $this->refresh();\n event(\n new CalculateVariousPropertyListsEvent(\n $this->client,\n [\n 'event_trigger_message' => 'Triggered at ' . __CLASS__ . ':' . __LINE__,\n 'event_trigger_id' => waypoint_generate_uuid(),\n 'event_trigger_class' => self::class,\n 'event_trigger_class_instance' => get_class($this),\n 'event_trigger_object_class' => get_class($this->client),\n 'event_trigger_file' => __FILE__,\n 'event_trigger_line' => __LINE__,\n ]\n )\n );\n }", "public function destroy(User $user,Role $role)\n {\n $user->roles()->detach($role);\n\n return back()->with('success','Role Detached Successfully');\n }", "public function detachRole($role)\n {\n if( is_object($role))\n\n $role = $role->getKey();\n\n if( is_array($role))\n\n $role = $role['id'];\n\n $this->roles()->detach($role);\n }", "function revokeRole($role);", "protected function removeRoles() {\n\t\tforeach (self::$tennisRoles as $slug => $name) {\n\t\t\tremove_role( $slug );\n\t\t}\n\t}", "public function detachRole($role)\n {\n if (is_object($role)) {\n $role = $role->getKey();\n }\n\n if (is_array($role)) {\n $role = $role['id'];\n }\n\n $this->role()->detach($role);\n }" ]
[ "0.781375", "0.7214118", "0.71273565", "0.71273565", "0.70444244", "0.69482434", "0.69375205", "0.69184357", "0.6680461", "0.66324", "0.66243833", "0.65696985", "0.65662616", "0.6562721", "0.6552944", "0.652438", "0.64869756", "0.64851516", "0.6472695", "0.64648706", "0.64292836", "0.6422359", "0.63290703", "0.62480783", "0.6230463", "0.6224792", "0.61687803", "0.6160333", "0.61555237", "0.60861754" ]
0.7875696
0
Attach permissions to the user.
public function attachPermissions($permissions);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public function attachPermissions($permissions = []);", "public function attachPermission($permission);", "public function grant($permissions): void\n {\n $this->permissions()->attach($permissions);\n }", "protected function setUserPermissions() {\n\t\t\t\t\n\t}", "public function addPermissions($permissions);", "public function attachPermissions(int $roleId, array $permissions): void;", "public function attachPerm($perm);", "public function attachPermissions($permissions)\n {\n foreach ($permissions as $permission) {\n $this->attachPermission($permission);\n }\n }", "public function attachPermissions($permissions)\n {\n foreach ($permissions as $permission) {\n $this->attachPermission($permission);\n }\n }", "private function assignPermission() : void\n {\n $roles = RoleModel::all();\n $permissions = PermissionModel::all();\n $admin_role = $roles->firstWhere('name', 'admin');\n\n $role_permission = array();\n foreach ($permissions as $permission) {\n $role_permission[] = array(\n 'permission_id' => $permission->id,\n 'role_id' => $admin_role->id,\n );\n }\n\n foreach (config('default.permissions') as $permission_group) {\n foreach ($permission_group as $name => $assigned_roles) {\n foreach ($assigned_roles as $role) {\n $role_permission[] = array(\n 'permission_id' => $permissions->firstWhere('name', $name)->id,\n 'role_id' => $roles->firstWhere('name', $role)->id\n );\n }\n }\n }\n\n \\DB::table('role_has_permissions')->insert($role_permission);\n }", "public function attach(User $currentUser, Permission $permission)\n {\n return false;\n }", "private function savePermissions()\n {\n $permissionTypes = getArrayParameter($_REQUEST, 'permissionTypes');\n $permissions = getArrayParameter($_REQUEST, 'permissions');\n $this->context->updatePermissions($permissionTypes, $permissions);\n }", "public function permission_assignment(Request $request, User $user)\n {\n $this->authorize('assign_permission', $user);\n $user->permissions()->sync($request->permissions);\n toast('Permisos Asignados!','success', 'top-right');\n return redirect()->route('backoffice.user.show', $user);\n }", "private function register_user_module_permissions () {\n // decode\n $permissions = json_decode($this->user->module_permissions, true);\n // check for each module\n foreach ($this->get_modules_with_permissions() as $m) {\n if (!is_array($permissions)) {\n $this->user->{'perm_'.$m} = 0;\n }\n elseif(array_key_exists($m, $permissions)) {\n $this->user->{'perm_'.$m} = $permissions[$m];\n }\n else {\n $this->user->{'perm_'.$m} = 0;\n }\n }\n }", "public function attachPermissions($permissions)\r\n {\r\n if (is_array($permissions)) {\r\n foreach ($permissions as $perm) {\r\n $this->attachPermission($perm);\r\n }\r\n } else {\r\n throw new \\Exception('permissions must be an array');\r\n }\r\n\r\n }", "public function actionSaveUserPermissions()\n\t{\n\t\t$this->requirePostRequest();\n\t\tblx()->userSession->requirePermission('administrateUsers');\n\n\t\t$userId = blx()->request->getRequiredPost('userId');\n\t\t$user = blx()->users->getUserById($userId);\n\n\t\tif (!$user)\n\t\t{\n\t\t\t$this->_noUserExists($userId);\n\t\t}\n\n\t\t// Only admins can toggle admin settings\n\t\tif (blx()->userSession->isAdmin())\n\t\t{\n\t\t\t$user->admin = (bool)blx()->request->getPost('admin');\n\t\t}\n\n\t\tblx()->users->saveUser($user);\n\n\t\t// Update the user permissions\n\t\tif ($user->admin)\n\t\t{\n\t\t\t$permissions = array();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$permissions = blx()->request->getPost('permissions');\n\t\t}\n\n\t\tblx()->userPermissions->saveUserPermissions($userId, $permissions);\n\n\t\tblx()->userSession->setNotice(Blocks::t('Permissions saved.'));\n\t\t$this->redirectToPostedUrl();\n\t}", "public function setPermissions( $permissions );", "public function testAttachPermissions()\n {\n $user = m::mock('HasRoleUser')->makePartial();\n\n /*\n |------------------------------------------------------------\n | Expectation\n |------------------------------------------------------------\n */\n $user->shouldReceive('attachPermission')\n ->with(1)\n ->once()->ordered();\n $user->shouldReceive('attachPermission')\n ->with(2)\n ->once()->ordered();\n $user->shouldReceive('attachPermission')\n ->with(3)\n ->once()->ordered();\n\n /*\n |------------------------------------------------------------\n | Assertion\n |------------------------------------------------------------\n */\n $result = $user->attachPermissions([1, 2, 3]);\n $this->assertInstanceOf('HasRoleUser', $result);\n }", "function _horde_addUserPermissions($shareRoot, $shareName, $userName,\n $permissions)\n{\n if (!Auth::isAdmin()) {\n return PEAR::raiseError(_(\"You are not allowed to change shares.\"));\n }\n\n require_once 'Horde/Share.php';\n $shares = &Horde_Share::singleton($shareRoot);\n\n if (is_a($share = &$shares->getShare($shareName), 'PEAR_Error')) {\n return $share;\n }\n\n $perm = &$share->getPermission();\n foreach ($permissions as $permission) {\n $permission = String::upper($permission);\n if (defined('PERMS_' . $permission)) {\n $perm->addUserPermission($userName, constant('PERMS_' . $permission), false);\n }\n }\n\n if (is_a($result = $share->setPermission($perm), 'PEAR_Error')) {\n return $result;\n }\n\n return true;\n}", "public function attachPerm($perm)\n {\n $this->perms()->attach($perm);\n }", "public function & SetPermissions ($permissions);", "public function setPermissions($permissions);", "public function testAttachPermission()\n {\n $permissionObject = m::mock('Permission');\n $permissionArray = ['id' => 2];\n\n $user = m::mock('HasRoleUser')->makePartial();\n\n /*\n |------------------------------------------------------------\n | Expectation\n |------------------------------------------------------------\n */\n $permissionObject->shouldReceive('getKey')\n ->andReturn(1);\n\n $user->shouldReceive('permissions')\n ->andReturn($user);\n $user->shouldReceive('attach')\n ->with(1)\n ->once()->ordered();\n $user->shouldReceive('attach')\n ->with(2)\n ->once()->ordered();\n $user->shouldReceive('attach')\n ->with(3)\n ->once()->ordered();\n\n Cache::shouldReceive('forget')\n ->times(6);\n\n /*\n |------------------------------------------------------------\n | Assertion\n |------------------------------------------------------------\n */\n $result = $user->attachPermission($permissionObject);\n $this->assertInstanceOf('HasRoleUser', $result);\n $result = $user->attachPermission($permissionArray);\n $this->assertInstanceOf('HasRoleUser', $result);\n $result = $user->attachPermission(3);\n $this->assertInstanceOf('HasRoleUser', $result);\n $this->setExpectedException(InvalidArgumentException::class);\n $user->attachPermission(true);\n }", "private function setPermissions()\n {\n $this->permissions = \\PermissionModel::getUserPermissionsByRole($this->data['role_id']);\n unset($this->permissions['role_id']);\n }", "public function attachPermission(Request $request){\n /**\n * select role by name\n */\n $role = Role::where('name', '=', \n $request->input('role'))\n ->first();\n\n /**\n * select permission by name\n */\n $permission = Permission::where('name', '=', \n $request->input('permmission'))\n ->first();\n\n $result = $role->attachPermission($permission);\n\n if ($result):\n return response()->json(['body' => ['message' => \"Role: $role->name got Permission: $permission->name with success!\", 'status' => 'success']]);\n else:\n return response()->json(['body' => ['message' => \"Error to add permission to role!\", 'status' => 'warning']]);\n endif;\n }", "public function updatePermissions()\n {\n if ($this->isHiringOrganization()) {\n $organization = $this->getParent();\n $owner = $organization->getUser();\n\n $this->setUser($owner);\n } else {\n $organization = $this;\n }\n\n /* @var $employees null | ArrayCollection | \\Doctrine\\ODM\\MongoDB\\PersistentCollection */\n $employees = $organization->getEmployees();\n\n $perms = $this->getPermissions();\n\n foreach ($employees as $emp) {\n /* @var $emp \\Organizations\\Entity\\Employee */\n $perms->grant($emp->getUser(), PermissionsInterface::PERMISSION_CHANGE, false);\n }\n $perms->build();\n }", "private function setPermissions()\n\t{\n\t\tforeach ($this->foldersToChmod as $folder => $permissions)\n\t\t{\n\t\t\tchmod(__DIR__ . '/' . $folder, $permissions);\n\t\t}\n\n\t\t$this->success('Permissions changed ...');\n\t}", "public function attachPermission(Request $request){\n $role=Role::where('name',$request->input('role'))->first();\n $permission=Permission::where('name',$request->input('name'))->first();\n $role->attachPermission($permission);\n\n return response()->json([\n 'success'=>'Permission added to role'\n ],JsonResponse::HTTP_OK);\n }", "protected function setApplicationPermissions()\n\t{\n\t\t$files = (array) $this->rocketeer->getOption('remote.permissions.files');\n\t\tforeach ($files as $file) {\n\t\t\t$this->setPermissions($file);\n\t\t}\n\t}", "public function attachPermission(Permissions\\RolePermission $permission)\n {\n $this->permissions()->attach($permission->id);\n }" ]
[ "0.7573729", "0.6751107", "0.66516465", "0.6483501", "0.64201003", "0.64144903", "0.63130695", "0.6309439", "0.6309439", "0.6291314", "0.61997896", "0.6183727", "0.6118104", "0.61067253", "0.60753834", "0.6068104", "0.5985953", "0.5960306", "0.59083354", "0.5900978", "0.58923423", "0.5883956", "0.5844885", "0.5799409", "0.57849354", "0.57572234", "0.5734752", "0.5709123", "0.56977963", "0.56661993" ]
0.74081725
1