{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \n\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":315,"cells":{"blob_id":{"kind":"string","value":"8919c5d615ce5afee948f795aff5778d3834a10a"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"mindthanizz/freshonefood"},"path":{"kind":"string","value":"/fresh_database/create/ordersdetail_table.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":666,"string":"666"},"score":{"kind":"number","value":2.703125,"string":"2.703125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":""},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":316,"cells":{"blob_id":{"kind":"string","value":"c4dca0013fd3886375c0bae319e8cd49f7b56dec"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"pssubashps/image-organizer"},"path":{"kind":"string","value":"/imagemove.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2800,"string":"2,800"},"score":{"kind":"number","value":2.8125,"string":"2.8125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":" 0) {\n foreach ($files1 as $file) {\n \n \n $fileDetails = @exif_read_data($dir . \"/\" . $file);\n if(!$fileDetails) {\n echo \"Not able to read image property\\n\\n\";\n $completedItems++;\n show_status($completedItems,$totalImages);\n continue;\n }\n // print_r($fileDetails);exit;\n $dt = new DateTime();\n $dt->setTimestamp($fileDetails['FileDateTime']);\n $ext = pathinfo($dir . \"/\" . $file, PATHINFO_EXTENSION);\n $Yeardir = $dt->format('Y');\n $monthdir = $dt->format('M');\n $daydir = $dt->format('d');\n \n if (! file_exists(\"$movDir/\" . $Yeardir)) {\n mkdir(\"$movDir/\" . $Yeardir, 0777);\n }\n if (! file_exists(\"$movDir/\" . $Yeardir . \"/$monthdir\")) {\n mkdir(\"$movDir/\" . $Yeardir . \"/$monthdir\", 0777);\n }\n if (! file_exists(\"$movDir/\" . $Yeardir . \"/$monthdir/$daydir\")) {\n mkdir(\"$movDir/\" . $Yeardir . \"/$monthdir/$daydir\", 0777);\n }\n $photoDir = $Yeardir . \"/$monthdir/$daydir\";\n If (copy(\"$dir/\" . $fileDetails['FileName'], \"$movDir/\" . $photoDir . \"/\" . $dt->format('d_F_H_i_s') . \"_\" . $fileDetails['FileName'])) {\n // unlink($dir . \"/\" . $file);\n }\n //print \"\\n\\n\" . $dt->format('j_M_Y_H_i_s');\n $completedItems++;\n show_status($completedItems,$totalImages);\n }\n}\n\n\nfunction show_status($done, $total, $size=30) {\n \n static $start_time;\n \n // if we go over our bound, just ignore it\n if($done > $total) return;\n \n if(empty($start_time)) $start_time=time();\n $now = time();\n \n $perc=(double)($done/$total);\n \n $bar=floor($perc*$size);\n \n $status_bar=\"\\r[\";\n $status_bar.=str_repeat(\"=\", $bar);\n if($bar<$size){\n $status_bar.=\">\";\n $status_bar.=str_repeat(\" \", $size-$bar);\n } else {\n $status_bar.=\"=\";\n }\n \n $disp=number_format($perc*100, 0);\n \n $status_bar.=\"] $disp% $done/$total\";\n \n $rate = ($now-$start_time)/$done;\n $left = $total - $done;\n $eta = round($rate * $left, 2);\n \n $elapsed = $now - $start_time;\n \n $status_bar.= \" remaining: \".number_format($eta).\" sec. elapsed: \".number_format($elapsed).\" sec.\";\n \n echo \"$status_bar \";\n \n flush();\n \n // when done, send a newline\n if($done == $total) {\n echo \"\\n\";\n }\n \n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":317,"cells":{"blob_id":{"kind":"string","value":"b5a6c67be2056666194134068a2b52e76755fe9f"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"fauzanhamzah/invoice-manager"},"path":{"kind":"string","value":"/app/Http/Controllers/CustomerController.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":5026,"string":"5,026"},"score":{"kind":"number","value":2.546875,"string":"2.546875"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"middleware('auth');\n\n $this->middleware('permission:customer-list|customer-create|customer-edit|customer-delete', ['only' => ['index', 'store']]);\n $this->middleware('permission:customer-create', ['only' => ['create', 'store']]);\n $this->middleware('permission:customer-edit', ['only' => ['edit', 'update']]);\n $this->middleware('permission:customer-delete', ['only' => ['destroy']]);\n }\n\n /**\n * Display a listing of the resource.\n *\n * @return \\Illuminate\\Http\\Response\n */\n public function index()\n {\n $customers = Customer::orderBy('id', 'DESC')->get();\n return view('customers.index', compact('customers'));\n }\n\n public function indexlist()\n {\n $customers = Customer::orderBy('id', 'DESC')->get();\n return view('customers.indexlist', compact('customers'));\n }\n\n public function view(Customer $customer)\n {\n return view('customers.view', compact('customer'));\n }\n\n /**\n * Show the form for creating a new resource.\n *\n * @return \\Illuminate\\Http\\Response\n */\n public function create()\n {\n return view('customers.create');\n }\n\n /**\n * Store a newly created resource in storage.\n *\n * @param \\Illuminate\\Http\\Request $request\n * @return \\Illuminate\\Http\\Response\n */\n public function store(Request $request)\n {\n $request->validate([\n 'name' => 'required|string',\n 'addressline1' => 'required|string',\n 'town' => 'required|string',\n 'zipcode' => 'required|integer',\n 'phone' => 'required|string',\n 'email' => 'required|string'\n\n ]);\n\n if (Customer::create($request->all())) {\n $request->session()->flash('success', ' Customer has been Added!');\n } else {\n $request->session()->flash('error', ' There was an error adding the customer!');\n }\n\n // Customer::create($request->all());\n return redirect('/customers');\n }\n\n /**\n * Display the specified resource.\n *\n * @param int $id\n * @return \\Illuminate\\Http\\Response\n */\n public function show($id)\n {\n //\n }\n\n /**\n * Show the form for editing the specified resource.\n *\n * @param int $id\n * @return \\Illuminate\\Http\\Response\n */\n public function edit(Customer $customer)\n {\n return view('customers.edit', compact('customer'));\n }\n\n /**\n * Update the specified resource in storage.\n *\n * @param \\Illuminate\\Http\\Request $request\n * @param int $id\n * @return \\Illuminate\\Http\\Response\n */\n public function update(Request $request, Customer $customer)\n {\n $request->validate([\n 'name' => 'required|string',\n 'addressline1' => 'required|string',\n 'town' => 'required|string',\n 'zipcode' => 'required|integer',\n 'phone' => 'required|string',\n 'email' => 'required|string'\n\n ]);\n\n if (Customer::where('id', $customer->id)\n ->update([\n 'name' => $request->name,\n 'addressline1' => $request->addressline1,\n 'addressline2' => $request->addressline2,\n 'town' => $request->town,\n 'zipcode' => $request->zipcode,\n 'phone' => $request->phone,\n 'fax' => $request->fax,\n 'email' => $request->email\n\n ])\n ) {\n $request->session()->flash('success', $customer->name . ' has been Updated!');\n } else {\n $request->session()->flash('error', ' There was an error updating! ' . $customer->name);\n }\n\n // Customer::where('id', $customer->id)\n // ->update([\n // 'name' => $request->name,\n // 'addressline1' => $request->addressline1,\n // 'addressline2' => $request->addressline2,\n // 'town' => $request->town,\n // 'zipcode' => $request->zipcode,\n // 'phone' => $request->phone,\n // 'fax' => $request->fax,\n // 'email' => $request->email\n\n // ]);\n return redirect('/customers');\n }\n\n /**\n * Remove the specified resource from storage.\n *\n * @param int $id\n * @return \\Illuminate\\Http\\Response\n */\n public function destroy(Customer $customer, Request $request)\n {\n\n if (Customer::destroy($customer->id)) {\n $request->session()->flash('success', $customer->name . ' has been deleted!');\n } else {\n $request->session()->flash('error', ' There was an error deleting! ' . $customer->name);\n }\n // Customer::destroy($customer->id);\n return redirect('/customers');\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":318,"cells":{"blob_id":{"kind":"string","value":"2d3ddfacfa36b7bf8e9898d11fbe6a0d225cdf97"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"robyfirnandoyusuf/DataStructures"},"path":{"kind":"string","value":"/DataStructures/Trees/Traits/CountTrait.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":285,"string":"285"},"score":{"kind":"number","value":3.140625,"string":"3.140625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"tree->size().\n *\n * @return integer the tree size. 0 if it is empty.\n */\n public function count() {\n return $this->size;\n }\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":319,"cells":{"blob_id":{"kind":"string","value":"4db84f616f733fc25584dfb88c5a4a0160aa5b4e"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"KEVINYZY1/Algorithm-11"},"path":{"kind":"string","value":"/src/Algorithm.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":6992,"string":"6,992"},"score":{"kind":"number","value":2.84375,"string":"2.84375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["Apache-2.0"],"string":"[\n \"Apache-2.0\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":" $arr[$j + 1]) {\n $arr = self::array_swap($arr, $j, $j + 1);\n }\n }\n }\n\n return $arr;\n }\n\n public static function selectionSort($arr) {\n if (! is_array($arr)) {\n return false;\n }\n $len = count($arr);\n if ($len <= 1) {\n return $arr;\n }\n\n for ($i = 0; $i < $len; $i++) {\n $min_i = $arr[$i];\n $index = $i;\n $min_j = $i + 1;\n for ($j = $min_j; $j < $len; $j++) {\n if ($arr[$j] < $min_i) {\n $min_i = $arr[$j];\n $index = $j;\n }\n }\n if ($i < $index) {\n $arr = self::array_swap($arr, $i, $index);\n }\n }\n\n return $arr;\n }\n\n public static function insertionSort($arr) {\n if (! is_array($arr)) {\n return false;\n }\n $len = count($arr);\n if ($len <= 1) {\n return $arr;\n }\n\n for ($i = 0; $i < $len; $i++) {\n $pre_i = $i - 1;\n $current = $arr[$i];\n while ($pre_i >= 0 && $arr[$pre_i] > $current) {\n $arr[$pre_i + 1] = $arr[$pre_i];\n $pre_i -= 1;\n }\n $arr[$pre_i + 1] = $current;\n }\n\n return $arr;\n }\n\n public static function shellSort($arr) {\n if (! is_array($arr)) {\n return false;\n }\n $len = count($arr);\n if ($len <= 1) {\n return $arr;\n }\n\n $gap = 1;\n $pre_i = $len / 3;\n while ($gap < $pre_i) {\n $gap = $gap * 3 + 1;\n }\n\n while ($gap > 0) {\n for ($i = 0; $i < $len; $i++) {\n $temp = $arr[$i];\n $j = $i - $gap;\n\n while ($j >= 0 and $arr[$j] > $temp) {\n\n $arr[$j + $gap] = $arr[$j];\n $j -= $gap;\n }\n\n $arr[$j + $gap] = $temp;\n }\n\n $gap = floor($gap / 3);\n }\n\n return $arr;\n }\n\n public static function mergeSort(&$arr) {\n if (! is_array($arr)) {\n return false;\n }\n $len = count($arr);\n if ($len <= 1) {\n return $arr;\n }\n\n $mid = $len >> 1;\n $left = array_slice($arr, 0, $mid);\n $right = array_slice($arr, $mid);\n static::mergeSort($left);\n static::mergeSort($right);\n if (end($left) <= $right[0]) {\n $arr = array_merge($left, $right);\n } else {\n for ($i = 0, $j = 0, $k = 0; $k <= $len - 1; $k++) {\n if ($i >= $mid && $j < $len - $mid) {\n $arr[$k] = $right[$j++];\n } elseif ($j >= $len - $mid && $i < $mid) {\n $arr[$k] = $left[$i++];\n } elseif ($left[$i] <= $right[$j]) {\n $arr[$k] = $left[$i++];\n } else {\n $arr[$k] = $right[$j++];\n }\n }\n }\n\n return $arr;\n }\n\n public static function countingSort($arr) {\n if (! is_array($arr)) {\n return false;\n }\n $len = count($arr);\n if ($len <= 1) {\n return $arr;\n }\n\n $count = $sorted = [];\n $min = min($arr);\n $max = max($arr);\n for ($i = 0; $i < $len; $i++) {\n $count[$arr[$i]] = isset($count[$arr[$i]]) ? $count[$arr[$i]] + 1 : 1;\n }\n for ($j = $min; $j <= $max; $j++) {\n while (isset($count[$j]) && $count[$j] > 0) {\n $sorted[] = $j;\n $count[$j]--;\n }\n }\n\n return $sorted;\n }\n\n public static function heapSort($arr) {\n if (! is_array($arr)) {\n return false;\n }\n global $len;\n $len = count($arr);\n if ($len <= 1) {\n return $arr;\n }\n\n for ($i = $len; $i >= 0; $i--) {\n self::heapify($arr, $i);\n }\n\n return $arr;\n }\n\n static function heapify($arr, $i) {\n $left = 2 * $i + 1;\n $right = 2 * $i + 2;\n $largest = $i;\n\n global $len;\n if ($left < $len && $arr[$left] > $arr[$largest]) {\n $largest = $left;\n }\n if ($right < $len && $arr[$right] > $arr[$largest]) {\n $largest = $right;\n }\n if ($largest != $i) {\n self::array_swap($arr, $i, $largest);\n self::heapify($arr, $largest);\n }\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":320,"cells":{"blob_id":{"kind":"string","value":"ce5d5e7f8ed9279b45ee1979af2cf6e6328a0411"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"OckiFals/Ngaji2.0"},"path":{"kind":"string","value":"/Ngaji/Database/QueryBuilder.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":4985,"string":"4,985"},"score":{"kind":"number","value":3.125,"string":"3.125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"pdo = Connection::connect();\n $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n }\n\n /**\n * Get the sql command\n * @return string\n */\n public function get_sql() {\n return $this->sql;\n }\n\n /**\n * Get the sql param\n * @return array\n */\n public function get_params() {\n return $this->param;\n }\n\n /**\n * @param string $field null for fect all columns\n * @return $this\n */\n public function select($field = '*') {\n if (is_array($field))\n $field = implode(', ', $field);\n\n $this->sql .= \"SELECT $field \";\n return $this;\n }\n\n public function from($table) {\n $this->sql .= \"FROM $table \";\n return $this;\n }\n\n public function where($condition) {\n if (is_array($condition)) {\n $list = Array();\n $param = null;\n foreach ($condition as $key => $value) {\n if (is_array($value)) {\n /*\n * Model::findOne[\n * ...\n * 'type' = [\n * '!=' => 1\n * ],\n * ...\n * ]\n *\n * SELECT ... FROM Model\n * ... WHERE ... `type` != 1\n * LIMIT 1\n */\n $list[] = \"$key \" . array_keys($value)[0] . \" :$key\";\n\n $param .= ', \":' . $key . '\":\"' . array_values($value)[0] . '\"';\n } else {\n $list[] = \"$key = :\" . str_replace('.', '_', $key);\n\n $param .= ', \":' . str_replace('.', '_', $key) . '\":\"' . $value . '\"';\n }\n }\n\n $json = \"{\" . substr($param, 1) . \"}\";\n $this->param = json_decode($json, true);\n $this->sql .= ' WHERE ' . implode(' AND ', $list);\n } else {\n $this->sql .= ' WHERE ' . $condition;\n }\n\n return $this;\n }\n\n public function and_($and) {\n if (is_array($and)) {\n $this->sql .= \" AND \" . array_keys($and)[0] . \"='\" . array_values($and)[0] . \"'\";\n } else {\n $this->sql .= \" AND {$and}\";\n }\n\n return $this;\n }\n\n public function or_($or) {\n if (is_array($or)) {\n $this->sql .= \" OR \" . array_keys($or)[0] . \"='\" . array_values($or)[0] . \"'\";\n } else {\n $this->sql .= \" OR {$or}\";\n }\n\n return $this;\n }\n\n public function like($like) {\n $this->sql .= ' LIKE ' . \"'{$like}'\";\n\n return $this;\n }\n\n public function orderBy($criteria) {\n $this->sql .= ' ORDER BY ' . \"'{$criteria}'\";\n\n return $this;\n }\n\n public function asArray() {\n $this->fetch = PDO::FETCH_ASSOC;\n\n return $this;\n }\n\n /**\n * Execute the current $sql statements that return one record data!\n * @return array | \\stdClass\n */\n public function getOne() {\n $prepareStatement = $this->pdo->prepare($this->sql);\n $prepareStatement->execute($this->param);\n\n Connection::disconnect();\n\n if ($this->fetch !== PDO::FETCH_CLASS) {\n if (1 == $prepareStatement->columnCount())\n return $prepareStatement->fetch(PDO::FETCH_COLUMN);\n return $prepareStatement->fetch($this->fetch);\n }\n\n return $prepareStatement->fetchObject();\n }\n\n /**\n * Execute the current $sql statements that return many records data!\n * @return array stdClass | array in array\n */\n public function getAll() {\n $prepareStatement = $this->pdo->prepare($this->sql);\n $prepareStatement->execute($this->param);\n\n # close connection\n Connection::disconnect();\n\n return $prepareStatement->fetchAll($this->fetch);\n }\n\n /**\n * Count the current $sql query!\n * @return int\n */\n public function count() {\n $prepareStatement = $this->pdo->prepare($this->sql);\n $prepareStatement->execute($this->param);\n\n # close connection\n Connection::disconnect();\n\n return $prepareStatement->rowCount();\n }\n\n /**\n * Return representated of the instance with $sql String\n * @return string\n */\n public function __toString() {\n return str_replace(array_keys($this->param), array_values($this->param), $this->sql);\n }\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":321,"cells":{"blob_id":{"kind":"string","value":"38d23955ab78541bb12f9097bb397feb8ea26620"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"italolelis/EasyFramework"},"path":{"kind":"string","value":"/src/Easy/Mvc/DependencyInjection/Compiler/SerializerPass.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2099,"string":"2,099"},"score":{"kind":"number","value":2.59375,"string":"2.59375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"\n */\nclass SerializerPass implements CompilerPassInterface\n{\n\n public function process(ContainerBuilder $container)\n {\n if (!$container->hasDefinition('serializer')) {\n return;\n }\n\n // Looks for all the services tagged \"serializer.normalizer\" and adds them to the Serializer service\n $normalizers = $this->findAndSortTaggedServices('serializer.normalizer', $container);\n $container->getDefinition('serializer')->replaceArgument(0, $normalizers);\n\n // Looks for all the services tagged \"serializer.encoders\" and adds them to the Serializer service\n $encoders = $this->findAndSortTaggedServices('serializer.encoder', $container);\n $container->getDefinition('serializer')->replaceArgument(1, $encoders);\n }\n\n private function findAndSortTaggedServices($tagName, ContainerBuilder $container)\n {\n $services = $container->findTaggedServiceIds($tagName);\n\n if (empty($services)) {\n throw new \\RuntimeException(sprintf('You must tag at least one service as \"%s\" to use the Serializer service', $tagName));\n }\n\n $sortedServices = array();\n foreach ($services as $serviceId => $tags) {\n foreach ($tags as $tag) {\n $priority = isset($tag['priority']) ? $tag['priority'] : 0;\n $sortedServices[$priority][] = new Reference($serviceId);\n }\n }\n\n krsort($sortedServices);\n\n // Flatten the array\n return call_user_func_array('array_merge', $sortedServices);\n }\n\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":322,"cells":{"blob_id":{"kind":"string","value":"f1ed4b8428447f4966bb722c829290380bd264b2"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"kabsnation/creotec"},"path":{"kind":"string","value":"/UI/getStrand.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":511,"string":"511"},"score":{"kind":"number","value":2.640625,"string":"2.640625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":" getStrandByBatchCode($_POST[\"batchcode\"]);\n\n\t?>\n\t \n\t0){\n\t\tforeach ($results as $row) {\n\t\t\t$slots[$row[\"idStrand\"]] = (int)$row[\"capacity\"] - (int)$row[\"counter\"];\n\t\t\tif($slots[$row[\"idStrand\"]]>0)\n\t\t\t\techo '';\n\t\t}\n\t}\n}\n?>"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":323,"cells":{"blob_id":{"kind":"string","value":"d9e3a899958308f22776b3ddbb92165743cd5cce"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"wturnerharris/phpcheckout"},"path":{"kind":"string","value":"/cal/includes/ldap/session_php.inc"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":5235,"string":"5,235"},"score":{"kind":"number","value":2.703125,"string":"2.703125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"User Not authenticated.

\";\n \tprintLoginForm($TargetURL);\n\t\tinclude('includes/footer.html'); \n\n exit();\n }\n\n if (isset($_SESSION))\n {\n $_SESSION[\"user\"] = $NewUserName;\n }\n else\n {\n global $HTTP_SESSION_VARS;\n $HTTP_SESSION_VARS[\"user\"] = $NewUserName;\n }\n// }\n // preserve the original $HTTP_REFERER by sending it as a GET parameter\n if (!empty($returl))\n {\n // check to see whether there's a query string already\n if (strpos($TargetURL, '?') === false)\n {\n $TargetURL .= \"?returl=\" . urlencode($returl);\n }\n else\n {\n $TargetURL .= \"&returl=\" . urlencode($returl);\n }\n }\n echo \"
\\n\";\n //SUCCESS!!\n session_register($NewUserName);\n $_SESSION['auth'] = true;\n $_SESSION['time'] = time();\n /* Redirect browser to initial page */\n echo \"\";\n echo \"

Please click here if you're not redirected automatically to the page you requested.

\\n\";\n}\n\n/*\n Display the login form. Used by two routines below.\n Will eventually return to $TargetURL.\n*/\nfunction printLoginForm($TargetURL)\n{\n global $PHP_SELF, $HTTP_REFERER;\n global $returl;\n?>\n
\r\n

Enter your user name and password to login.

\r\n
\">\n
\n Your personal EDM account logon info.\n
\n \n \n
\n
\n \n \n
\n \\n\";\n ?>\n \">\n \n
\n \">\n
\n
\n
\n
\n\".get_vocab(\"norights\").\"

\\n\";\n\n $TargetURL = basename($PHP_SELF);\n if (isset($QUERY_STRING))\n {\n $TargetURL = $TargetURL . \"?\" . $QUERY_STRING;\n }\n printLoginForm($TargetURL);\n\n exit();\n}\n\nfunction getUserName()\n{\n if (isset($_SESSION) && isset($_SESSION[\"UserName\"]) && ($_SESSION[\"UserName\"] != \"\"))\n {\n return $_SESSION[\"UserName\"];\n }\n else\n {\n global $HTTP_SESSION_VARS;\n if (isset($HTTP_SESSION_VARS[\"UserName\"]) && ($HTTP_SESSION_VARS[\"UserName\"] != \"\"))\n {\n return $HTTP_SESSION_VARS[\"UserName\"];\n }\n }\n}\n\n?>\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":324,"cells":{"blob_id":{"kind":"string","value":"5dfbf691c26061541ce1f59c1495e01ff9cf1926"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"amacrobert/last"},"path":{"kind":"string","value":"/Router/FileSuffixUrlGenerator.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1228,"string":"1,228"},"score":{"kind":"number","value":2.625,"string":"2.625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":" -1) {\n return $path;\n }\n $path_parts = explode('?', $path);\n\n // If path ends with an \"/\", transform it to \"/index\".\n if(substr($path_parts[0], -1) === '/') {\n $path_parts[0] .= 'index';\n }\n\n $path_parts[0].= '.'.static::DEFAULT_SUFFIX;\n return join('?', $path_parts);\n }\n\n /**\n * {@inheritdoc}\n */\n public function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = []) {\n return static::appendSuffix(parent::doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, $requiredSchemes));\n }\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":325,"cells":{"blob_id":{"kind":"string","value":"9ea7213fc783f3720d11fe2ce41adfa0ba0ce1c6"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"MarcosT96/Acort.ar"},"path":{"kind":"string","value":"/ejemplo.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1071,"string":"1,071"},"score":{"kind":"number","value":2.765625,"string":"2.765625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"setURL(\"https://acort.ar/api\");\n$Acortador->setKey(\"Fgvsld81Hvex\");\n/**\n * Llamada simple\n */\necho $Acortador->acortar(\"https://acort.ar\");\n\n/**\n * Obtner URL acortada directamente\n */\necho $Acortador->toText()->acortar(\"https://gempixel.com\");\n\n/**\n * Llamadas avanzandas\n */\n// Alias Personalizado\n$Acortador->setCustom(\"acortar\");\n\n// Establecer Tipo: Direct, Splash o Frame\n$Acortador->setType(\"direct\");\n\n// Establecer Contraseña\n$Acortador->setPassword(\"123456\");\n\n// Formato: text o json\n$Acortador->setFormat(\"text\");\n\necho $Acortador->acortar(\"https://acort.ar\");\n\n\n/**\n * Obtener detalles y estadisticas\n */\n\nvar_dump($Acortador->details(\"acortar\"));\n\n/**\n * Obtener todas tus URLs\n * @param string $sort Organiza tus URLs entre \"date\" o \"click\" (opcional - por defecto = date)\n * @param integer $limit Limita el numero de URLs\n */\nvar_dump($Acortador->urls());\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":326,"cells":{"blob_id":{"kind":"string","value":"be79fdb2330419300cb6f4393ae8906d0406ea78"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"mosiurp/web-devlopment-"},"path":{"kind":"string","value":"/US_03/admin/page_new.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2184,"string":"2,184"},"score":{"kind":"number","value":2.765625,"string":"2.765625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"\n\n\n\n\n\n\nRequired\";\n\t}\n\tif($tag == \"\")\n\t{\n\t\t$er++;\n\t\t$etag = \"Required\";\n\t}\n\tif($category == \"0\")\n\t{\n\t\t$er++;\n\t\t$ecategory = \"Required\";\n\t}\n\tif($content == \"\")\n\t{\n\t\t$er++;\n\t\t$econtent = \"Required\";\n\t}\n\t\n\tif($er == 0)\n\t{\n\t\t$sql = \"insert into pages(title, tag, userId, categoryId, count) values\n\t\t('\".ms($title).\"', '\".ms($tag).\"', 1, \".ms($category).\", 0)\";\n\n\t\tif(mysqli_query($cn, $sql))\n\t\t{\n\t\t\t$file = fopen(\"article/\". str_replace(\" \", \"_\", trim(strtolower($title))).\".html\", \"w\");\n\t\t\t\n\t\t\tfwrite($file, $content);\n\t\t\t\n\t\t\tprint \"Data Saved\";\n\t\t\t$title = \"\";\n\t\t\t$tag = \"\";\n\t\t\t$category = \"\";\n\t\t\t$content = \"\";\n\t\t}\n\t\telse{\n\t\t\tprint \"\".mysqli_error($cn).\"\";\n\t\t}\n\t}\n\t\n}\n\n\n?>\n
\n\n
\n\tNew Page\n\t\n\t
\n\t\"/>

\n\t\n\t
\n\t\"/>

\n\n\n\t
\n\t

\n\t\n\t
\n\t

\n\t\n\t\n\t\n
\n\n\n
"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":327,"cells":{"blob_id":{"kind":"string","value":"b0202ec2541ffee4c5450d08219110e8ca44ee66"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"wasimulislam/Tuition-Management-System"},"path":{"kind":"string","value":"/lab_Task_9/model_a/model.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2744,"string":"2,744"},"score":{"kind":"number","value":2.703125,"string":"2.703125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"query($selectQuery);\r\n }catch(PDOException $e){\r\n echo $e->getMessage();\r\n }\r\n $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);\r\n return $rows;\r\n}\r\nfunction getAllTeacherCount_Department($dep)\r\n{\r\n $conn = db_conn();\r\n $selectQuery = \"SELECT COUNT(1) as TOTAL FROM `teacher` WHERE Department LIKE '$dep%' \";\r\n try{\r\n $stmt = $conn->query($selectQuery);\r\n }catch(PDOException $e){\r\n echo $e->getMessage();\r\n }\r\n $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);\r\n return $rows[0]['TOTAL'];\r\n}\r\n\r\nfunction showAllTeacherWithPagination_Department($page, $number_of_rows, $dep)\r\n{\r\n $offset = ($page-1) * $number_of_rows;\r\n\r\n $conn = db_conn();\r\n $selectQuery = \"SELECT * FROM `teacher` WHERE Department LIKE '$dep%' LIMIT $number_of_rows OFFSET $offset\";\r\n try{\r\n $stmt = $conn->query($selectQuery);\r\n }catch(PDOException $e){\r\n echo $e->getMessage();\r\n }\r\n $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);\r\n return $rows;\r\n}\r\n\r\nfunction searchTeacher($user_name)\r\n{\r\n $conn = db_conn();\r\n $selectQuery = \"SELECT * FROM `user_info` WHERE Username LIKE '%$user_name%'\";\r\n\r\n \r\n try\r\n {\r\n $stmt = $conn->query($selectQuery);\r\n }\r\n catch(PDOException $e)\r\n {\r\n echo $e->getMessage();\r\n }\r\n $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);\r\n return $rows;\r\n}\r\n\r\n\r\nfunction addTeacher($data)\r\n{\r\n $conn = db_conn();\r\n $selectQuery = \"INSERT into teacher (Name, Email, Username, Password, Gender, Current_Institution, Department, DOB, image)\r\nVALUES (:name, :email, :username, :password, :gender, :ins, :dep, :dob, :image)\";\r\n try{\r\n $stmt = $conn->prepare($selectQuery);\r\n $stmt->execute([\r\n ':name' => $data['name'],\r\n ':email' => $data['email'],\r\n ':username' => $data['username'],\r\n ':password' => $data['password'],\r\n ':gender' => $data['gender'],\r\n ':ins' => $data['ins'],\r\n ':dep' => $data['dep'],\r\n ':dob' => $data['dob'],\r\n ':image' => $data['image']\r\n ]);\r\n }\r\n catch(PDOException $e)\r\n {\r\n echo $e->getMessage();\r\n }\r\n \r\n $conn = null;\r\n return true;\r\n}\r\n\r\nfunction deleteTeacher($id)\r\n{\r\n $conn = db_conn();\r\n $selectQuery = \"DELETE FROM `teacher` WHERE `ID` = ?\";\r\n try\r\n {\r\n $stmt = $conn->prepare($selectQuery);\r\n $stmt->execute([$id]);\r\n }\r\n catch(PDOException $e)\r\n {\r\n echo $e->getMessage();\r\n }\r\n $conn = null;\r\n\r\n return true;\r\n}\r\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":328,"cells":{"blob_id":{"kind":"string","value":"180d7b54a77a6825d5ef9b0e788194b53eb55597"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"bfinlay/laravel-excel-seeder"},"path":{"kind":"string","value":"/src/Readers/HeaderImporter.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2556,"string":"2,556"},"score":{"kind":"number","value":3,"string":"3"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"settings = resolve(SpreadsheetSeederSettings::class);\n }\n\n public function import(array $headerRow)\n {\n $this->headerRow = $headerRow;\n $this->makeHeader();\n\n return $this->toArray();\n }\n\n private function makeHeader()\n {\n if (!empty($this->settings->mapping)) {\n $this->makeMappingHeader();\n } else {\n $this->makeSheetHeader();\n }\n }\n\n private function makeMappingHeader() {\n $this->rawColumns = $this->settings->mapping;\n foreach($this->rawColumns as $key => $value) {\n $this->columnNumbersByNameMap[$value] = $key;\n $this->columnNamesByNumberMap[$key] = $value;\n }\n }\n\n private function makeSheetHeader() {\n foreach ($this->headerRow as $columnName) {\n $this->rawColumns[] = $columnName;\n if (!$this->skipColumn($columnName)) {\n $columnName = $this->columnAlias($columnName);\n $this->columnNumbersByNameMap[$columnName] = count($this->rawColumns) - 1;\n $this->columnNamesByNumberMap[count($this->rawColumns) - 1] = $columnName;\n }\n }\n }\n\n private function columnAlias($columnName) {\n $columnName = isset($this->settings->aliases[$columnName]) ? $this->settings->aliases[$columnName] : $columnName;\n return $columnName;\n }\n\n private function skipColumn($columnName) {\n return $this->settings->skipper == substr($columnName, 0, strlen($this->settings->skipper));\n }\n\n public function toArray() {\n return $this->columnNamesByNumberMap;\n }\n \n public function rawColumns() {\n return $this->rawColumns;\n }\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":329,"cells":{"blob_id":{"kind":"string","value":"60a48f87589f832e0b669786ac026a887052f890"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"Naru-hub/PHP"},"path":{"kind":"string","value":"/loop.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":611,"string":"611"},"score":{"kind":"number","value":3.890625,"string":"3.890625"},"int_score":{"kind":"number","value":4,"string":"4"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":" 'yen',\n 'us' => 'dollar',\n 'england' => 'pound',\n ];\n foreach($currencies as $country => $currency) {\n echo $country . ': '. $currency .PHP_EOL;\n }\n\n\n\n\n//無限ループwhile\n// $i = 0;\n\n// while (true) {\n// //50より少なければ\n// if ($i <= 50) {\n// //10ずつ増やし、数値を出力する\n// // $i = $i + 10;\n// echo $i . PHP_EOL;\n// $i += 10;\n// } else {\n// //ループ処理を終了する\n// break;\n// }\n// }"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":330,"cells":{"blob_id":{"kind":"string","value":"4a49db271c1826b4b59fbc8a62d85f464d6e8e2e"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"cawatou/smarty_tour"},"path":{"kind":"string","value":"/app/core/DxException/DBO.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":463,"string":"463"},"score":{"kind":"number","value":2.78125,"string":"2.78125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"errorInfo();\n $e = new PDOException($error[2], $error[1]);\n }\n\n parent::__construct($message, $code, $e);\n }\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":331,"cells":{"blob_id":{"kind":"string","value":"841a4bb19f37ab9c86e8d3017dbfc4817e877aee"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"smietao/vtmerexam"},"path":{"kind":"string","value":"/microblogService.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":7311,"string":"7,311"},"score":{"kind":"number","value":2.703125,"string":"2.703125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"id = $row[\"id\"];\r\n\t\t\t\t$m->subject = $row[\"subject\"];\r\n\t\t\t\t$m->content = $row[\"content\"];\r\n\t\t\t\t$m->author = $row[\"author\"];\r\n\t\t\t\t$m->last_post_time = $row[\"last_post_time\"];\r\n\t\t\t\t$m->comment_count = $row[\"comment_count\"];\r\n\t\t\t\t$m->likes = $row[\"likes\"];\r\n\t\t\t\tarray_push($listObj,$m);\r\n\t\t\t}\r\n\t\t}\r\n\t\tmysqli_free_result($result);\r\n mysqli_close($conn);\r\n\t\treturn $listObj;\r\n\t} //end microblogList\r\n///////////////////////////////////添加微博功能/////////////////////////////////////////\r\n\tfunction addMicroblog($m){\r\n\t\t$result = 0;\r\n\t\t$mysqli = new mysqli(\"localhost\",\"root\",\"\",\"mydb\");\r\n\t\t$mysqli->set_charset('utf8');//设定字符集\r\n\t\tif (strlen($m->content)<=600) { //判断微博正文长度\r\n\t\t$sql = \"insert into microblog (subject,content,author,last_post_time) values (?,?,?,?)\";\r\n\t\t$insert = $mysqli->prepare($sql);\t\r\n\t\t$insert->bind_param(\"ssss\",$m->subject,$m->content,$m->author,$m->last_post_time);\r\n\t\t//对应字段参数先后顺序加入参数值\r\n\t\t$res=$insert->execute();\r\n\t\tif($res){ \r\n\t\t\t$result = 1; //发布成功返回1\r\n\r\n\t\t}else{\r\n\t\t\t$result = 2; //发布失败返回2\r\n\t\t}\r\n\t }else{\r\n\t \t$result = 0; //如果微博正文长度超过200字,返回0\r\n\t }\r\n\t\treturn $result;\r\n\t\t$insert->close();\r\n\t\t$mysqli->close();\r\n\t} //end addMicroblog\r\n//////////////////////根据用户名查询微博,用于个人中心和搜索用户显示微博////////////////////\r\n\tfunction userMicroblog($u,$page){\r\n\t\t$listObj = array();\r\n\t\t$mysqli = new mysqli(\"localhost\",\"root\",\"\",\"mydb\");\r\n\t\t$mysqli->set_charset('utf8');//设定字符集\r\n\t\t$sql=\"select * from microblog where author=? order by id desc \r\n\t\t limit 3 offset $page\";\r\n\t\t$stmt = $mysqli->prepare($sql);\r\n\t\t$stmt->bind_param(\"s\",$u->username);\r\n\t\t$stmt->execute(); //居然忘了写执行...\r\n\t\t$result = $stmt->get_result(); \r\n\t\tif($result){\r\n\t\t\twhile($row = $result->fetch_array()) {\r\n\t\t\t\t$m = new Microblog();\r\n\t\t\t\t$m->id = $row[\"id\"];\r\n\t\t\t\t$m->subject = $row[\"subject\"];\r\n\t\t\t\t$m->content = $row[\"content\"];\r\n\t\t\t\t$m->author = $row[\"author\"];\r\n\t\t\t\t$m->last_post_time = $row[\"last_post_time\"];\r\n\t\t\t\t$m->comment_count = $row[\"comment_count\"];\r\n\t\t\t\t$m->likes = $row[\"likes\"];\r\n\t\t\t\tarray_push($listObj,$m);\r\n\t\t\t} //end while\r\n\t\t} //end if\r\n\t\t$stmt->close();\r\n\t\t$mysqli->close();\r\n\t\treturn $listObj;\r\n\t} //end userMicroblog\r\n///////////////////////////////////根据微博id删除微博////////////////////////////////////\r\n function deleteMicroblog($m){\r\n \t$mysqli = new mysqli(\"localhost\",\"root\",\"\",\"mydb\");\r\n \t$mysqli->set_charset('utf8');//设定字符集\r\n \t$sql=\"delete from love where microblog_id=?\"; //删除相关点赞数据\r\n \t$stmt = $mysqli->prepare($sql);\r\n \t$stmt->bind_param(\"i\",$m->id); \r\n \t$res=$stmt->execute();\r\n \t$sql=\"delete from comment where microblog_id=?\"; //删除相关评论数据\r\n \t$stmt = $mysqli->prepare($sql);\r\n \t$stmt->bind_param(\"i\",$m->id); \r\n \t$res=$stmt->execute();\r\n \t$sql=\"delete from microblog where id=?\"; //删除微博\r\n \t$stmt = $mysqli->prepare($sql);\r\n \t$stmt->bind_param(\"i\",$m->id); \r\n \t$res=$stmt->execute();\r\n \tif($res){\r\n \t $result=1;\r\n }else{\r\n \t$result=0;\r\n }\r\n return $result;\r\n $stmt->close();\r\n $mysqli->close();\r\n }//end deleteMicroblog\r\n//////////////根据微博id查询微博,用于评论详情和点赞列表显示单条微博////////////////////////\r\n function idMicroblog($m){\r\n\t\t$listObj = array();\r\n\t\t$mysqli = new mysqli(\"localhost\",\"root\",\"\",\"mydb\");\r\n\t\t$mysqli->set_charset('utf8');//设定字符集\r\n\t\t$sql=\"select * from microblog where id=? order by id desc\";\r\n\t\t$stmt = $mysqli->prepare($sql);\r\n\t\t$stmt->bind_param(\"i\",$m->id);\r\n\t\t$stmt->execute(); \r\n\t\t$result = $stmt->get_result(); \r\n\t\tif($result){\r\n\t\t\twhile($row = $result->fetch_array()) {\r\n\t\t\t\t$m = new Microblog();\r\n\t\t\t\t$m->id = $row[\"id\"];\r\n\t\t\t\t$m->subject = $row[\"subject\"];\r\n\t\t\t\t$m->content = $row[\"content\"];\r\n\t\t\t\t$m->author = $row[\"author\"];\r\n\t\t\t\t$m->last_post_time = $row[\"last_post_time\"];\r\n\t\t\t\t$m->comment_count = $row[\"comment_count\"];\r\n\t\t\t\t$m->likes = $row[\"likes\"];\r\n\t\t\t\tarray_push($listObj,$m);\r\n\t\t\t} //end while\r\n\t\t} //end if\r\n\t\t$stmt->close();\r\n\t\t$mysqli->close();\r\n\t\treturn $listObj;\r\n\t} //end idMicroblog\r\n//////////////////////////////////根据主题查询微博///////////////////////////////////////\r\n\tfunction subjectMicroblog($m){\r\n\t\t$listObj = array();\r\n\t\t$mysqli = new mysqli(\"localhost\",\"root\",\"\",\"mydb\");\r\n\t\t$mysqli->set_charset('utf8');//设定字符集\r\n\t\t$sql=\"select * from microblog where subject=? order by id desc\";\r\n\t\t$stmt = $mysqli->prepare($sql);\r\n\t\t$stmt->bind_param(\"s\",$m->subject);\r\n\t\t$stmt->execute(); \r\n\t\t$result = $stmt->get_result(); \r\n\t\tif($result){\r\n\t\t\twhile($row = $result->fetch_array()) {\r\n\t\t\t\t$m1 = new Microblog();\r\n\t\t\t\t$m1->id = $row[\"id\"];\r\n\t\t\t\t$m1->subject = $row[\"subject\"];\r\n\t\t\t\t$m1->content = $row[\"content\"];\r\n\t\t\t\t$m1->author = $row[\"author\"];\r\n\t\t\t\t$m1->last_post_time = $row[\"last_post_time\"];\r\n\t\t\t\t$m1->comment_count = $row[\"comment_count\"];\r\n\t\t\t\t$m1->likes = $row[\"likes\"];\r\n\t\t\t\tarray_push($listObj,$m1);\r\n\t\t\t} //end while\r\n\t\t} //end if\r\n\t\t$stmt->close();\r\n\t\t$mysqli->close();\r\n\t\treturn $listObj;\r\n\t}//end subjectMicroblog\r\n//////////////////////////////根据用户名查找微博数量/////////////////////////////////////\r\n\tfunction countMicroblog($u){\r\n\t\t$mysqli = new mysqli(\"localhost\",\"root\",\"\",\"mydb\");\r\n $mysqli->set_charset('utf8');//设定字符集\r\n $sql=\"select count(*) from microblog where author=?\";\r\n $stmt = $mysqli->prepare($sql);\r\n $stmt->bind_param(\"s\",$u->username);\r\n $stmt->execute();\r\n $stmt->bind_result($count);\r\n $stmt->fetch();\r\n return $count;\r\n $stmt->close();\r\n $mysqli->close();\r\n\t}//end countMicroblog\r\n////////////////////////////////////分页函数//////////////////////////////////////////\r\n\tfunction showPage($page,$count){ //$page为当前页数,$u为用户对象\r\n\t\tif ($count%3) { //计算总页数\r\n $allpage=(int)($count/3)+1;\r\n }else{\r\n $allpage=$count/3;\r\n }\r\n if ($page!=1) { //如果当前页数不为一,显示上一页 ?> \r\n

\r\n \t\">上一页\r\n

\r\n 第\".$page.\"页/第\".$allpage.\"页

\";\r\n if($page!=$allpage){ //如果当前页数不等于总页数显示下一页 ?> \r\n

\r\n \t\">下一页\r\n

\r\n 返回首页'; \r\n\r\n\t}//end showPage\r\n } //end class\r\n?>"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":332,"cells":{"blob_id":{"kind":"string","value":"1183b8202a0e0d1a2bfea580415990419102fb33"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"SSPKHas/LabWorks"},"path":{"kind":"string","value":"/LabWorks/denemeler/a/sumofdigits.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":121,"string":"121"},"score":{"kind":"number","value":2.796875,"string":"2.796875"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"0){\n\n\t$b = $a%10;\n\t$sum +=$b;\n\t$a/=10;\n\t\n}\n\n\necho \"
$sum\"\t;\n \n?>"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":333,"cells":{"blob_id":{"kind":"string","value":"b9fba0717b9b06633dfb687c2d2321b56eb21890"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"sujeetkryadav/jasper-client"},"path":{"kind":"string","value":"/src/Jaspersoft/Dto/ReportExecution/Status.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":775,"string":"775"},"score":{"kind":"number","value":2.890625,"string":"2.890625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":" $v) {\n if ($k == ErrorDescriptor::jsonField()) {\n $result->errorDescriptor = ErrorDescriptor::createFromJSON($v);\n }\n $result->$k = $v;\n }\n return $result;\n }\n\n} "},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":334,"cells":{"blob_id":{"kind":"string","value":"565f056c177dbe2e1ba79d0216c9934c3544ef88"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"waowl/minishop"},"path":{"kind":"string","value":"/models/News.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":671,"string":"671"},"score":{"kind":"number","value":2.90625,"string":"2.90625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"query('SELECT * FROM product ');\n $res->setFetchMode(\\PDO::FETCH_ASSOC);\n\n $items = $res->fetchAll();\n return $items;\n }\n\n public static function getById($id)\n {\n $id = intval($id);\n if ($id) {\n $db = Db::getConnection();\n $result = $db->query('SELECT * FROM product WHERE `id`=' . $id);\n\n /*$result->setFetchMode(PDO::FETCH_NUM);*/\n $result->setFetchMode(PDO::FETCH_ASSOC);\n\n $newsItem = $result->fetch();\n\n return $newsItem;\n }\n }\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":335,"cells":{"blob_id":{"kind":"string","value":"2a49af8f4112aec4bdf91a009fb7e29c94f293e6"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"miladrahimi/netnevis"},"path":{"kind":"string","value":"/core/reporter.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1111,"string":"1,111"},"score":{"kind":"number","value":3.140625,"string":"3.140625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"getMessage();\n $type = substr($exception, 0, 3);\n // Do based on type\n if ($type == \"msg\") {\n // Return Messages\n $message = substr($exception, 4);\n return ($message);\n } else {\n // Store Errors\n self::save($e);\n return \"error\";\n }\n }\n //******************************************************************************\n static private function save($e) {\n // Store exceptions in file\n $fp = fopen(dirname(__FILE__) . \"/../error_log.txt\", \"a+\");\n fwrite($fp, $e);\n fwrite($fp, \"\\r\\n###\\r\\n\");\n fclose($fp);\n }\n //******************************************************************************\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":336,"cells":{"blob_id":{"kind":"string","value":"68c684ff04dc23c533c7926c8532101357840bb0"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"plambert/enolib"},"path":{"kind":"string","value":"/php/spec/generated/errors/parsing/two_or_more_templates_found.spec.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2322,"string":"2,322"},"score":{"kind":"number","value":2.984375,"string":"2.984375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"toBeAnInstanceOf('Enolib\\ParseError');\n \n $text = \"There are at least two elements with the key 'field' that qualify for being copied here, it is not clear which to copy.\";\n \n expect($error->text)->toEqual($text);\n \n $snippet = \" Line | Content\\n\" .\n \" ? 1 | field: value\\n\" .\n \" ? 2 | field: value\\n\" .\n \" 3 | \\n\" .\n \" > 4 | copy < field\";\n \n expect($error->snippet)->toEqual($snippet);\n \n expect($error->selection['from']['line'])->toEqual(3);\n expect($error->selection['from']['column'])->toEqual(0);\n expect($error->selection['to']['line'])->toEqual(3);\n expect($error->selection['to']['column'])->toEqual(12);\n });\n});\n\ndescribe('Copying a section that exists twice', function() {\n it('throws the expected ParseError', function() {\n $error = null;\n\n $input = \"# section\\n\" .\n \"\\n\" .\n \"# section\\n\" .\n \"\\n\" .\n \"# copy < section\";\n\n try {\n Enolib\\Parser::parse($input);\n } catch(Enolib\\ParseError $_error) {\n $error = $_error;\n }\n\n expect($error)->toBeAnInstanceOf('Enolib\\ParseError');\n \n $text = \"There are at least two elements with the key 'section' that qualify for being copied here, it is not clear which to copy.\";\n \n expect($error->text)->toEqual($text);\n \n $snippet = \" Line | Content\\n\" .\n \" ? 1 | # section\\n\" .\n \" 2 | \\n\" .\n \" ? 3 | # section\\n\" .\n \" 4 | \\n\" .\n \" > 5 | # copy < section\";\n \n expect($error->snippet)->toEqual($snippet);\n \n expect($error->selection['from']['line'])->toEqual(4);\n expect($error->selection['from']['column'])->toEqual(0);\n expect($error->selection['to']['line'])->toEqual(4);\n expect($error->selection['to']['column'])->toEqual(16);\n });\n});"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":337,"cells":{"blob_id":{"kind":"string","value":"5b02f2716f3e75728cbef279f224f3245726fb54"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"ivanhoe011/srp"},"path":{"kind":"string","value":"/application/models/factories/AddressFactory.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2291,"string":"2,291"},"score":{"kind":"number","value":2.921875,"string":"2.921875"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"setIdMexicoState($idMexicoState);\n $newAddress->setStreet($street);\n $newAddress->setSettlement($settlement);\n $newAddress->setDistrict($district);\n $newAddress->setCity($city);\n $newAddress->setZipCode($zipCode);\n $newAddress->setCountry($country);\n return $newAddress;\n }\n\n /**\n * Crea un objeto Address con parametros solo para uso de catalogos\n * @param int $idAddress \n * @param int $idMexicoState \n * @param string $street Calle y numero\n * @param string $settlement Colonia\n\n * @param string $district Delegacion o municipio\n * @param string $city Ciudad\n * @param int $zipCode Codigo postal\n * @param string $country Pais\n * @return Address Objeto Address\n */\n public static function createAddressInternal($idAddress, $idMexicoState, $street, $settlement, $district, $city, $zipCode, $country)\n {\n $newAddress = AddressFactory::createAddress($idMexicoState, $street, $settlement, $district, $city, $zipCode, $country);\n $newAddress->setIdAddress($idAddress);\n return $newAddress;\n }\n\n}\n\n\n\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":338,"cells":{"blob_id":{"kind":"string","value":"516f4db41d1e2c0b1a448301ec0145eba5edd4f8"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"gitomato/redis"},"path":{"kind":"string","value":"/src/RedisHyperLogLog.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1343,"string":"1,343"},"score":{"kind":"number","value":2.78125,"string":"2.78125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"queryExecutor = $queryExecutor;\n $this->key = $key;\n }\n\n /**\n * @param string $element\n * @param string ...$elements\n *\n * @return Promise\n *\n * @link https://redis.io/commands/pfadd\n */\n public function add(string $element, string ...$elements): Promise\n {\n return $this->queryExecutor->execute(\\array_merge(['pfadd', $this->key, $element], $elements), toBool);\n }\n\n /**\n * @return Promise\n *\n * @link https://redis.io/commands/pfcount\n */\n public function count(): Promise\n {\n return $this->queryExecutor->execute(['pfcount', $this->key]);\n }\n\n /**\n * @param string $sourceKey\n * @param string ...$sourceKeys\n *\n * @return Promise\n *\n * @link https://redis.io/commands/pfmerge\n */\n public function storeMergeOf(string $sourceKey, string ...$sourceKeys): Promise\n {\n return $this->queryExecutor->execute(\\array_merge(['pfmerge', $this->key, $sourceKey], $sourceKeys));\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":339,"cells":{"blob_id":{"kind":"string","value":"229b71065d2a20ca2125b69c726f955da0bdb837"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"blackout314/d13"},"path":{"kind":"string","value":"/classes/d13_blacklist.class.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2333,"string":"2,333"},"score":{"kind":"number","value":2.8125,"string":"2.8125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["LicenseRef-scancode-other-permissive","LicenseRef-scancode-unknown-license-reference"],"string":"[\n \"LicenseRef-scancode-other-permissive\",\n \"LicenseRef-scancode-unknown-license-reference\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"dbQuery('select count(*) as count from blacklist where type=\"' . $type . '\" and value=\"' . $value . '\"');\n\t\t$row = $d13->dbFetch($result);\n\t\treturn $row['count'];\n\t}\n\n\tpublic static\n\n\tfunction get($type)\n\t{\n\t\tglobal $d13;\n\t\t$result = $d13->dbQuery('select * from blacklist where type=\"' . $type . '\"');\n\t\t$blacklist = array();\n\t\tfor ($i = 0; $row = $d13->dbFetch($result); $i++) $blacklist[$i] = $row;\n\t\treturn $blacklist;\n\t}\n\n\tpublic static\n\n\tfunction add($type, $value)\n\t{\n\t\tglobal $d13;\n\t\tif (!self::check($type, $value)) {\n\t\t\t$d13->dbQuery('insert into blacklist (type, value) values (\"' . $type . '\", \"' . $value . '\")');\n\t\t\tif ($d13->dbAffectedRows() > - 1) $status = 'done';\n\t\t\telse $status = 'error';\n\t\t}\n\t\telse $status = 'duplicateEntry';\n\t\treturn $status;\n\t}\n\n\tpublic static\n\n\tfunction remove($type, $value)\n\t{\n\t\tglobal $d13;\n\t\tif (self::check($type, $value)) {\n\t\t\t$d13->dbQuery('delete from blacklist where type=\"' . $type . '\" and value=\"' . $value . '\"');\n\t\t\tif ($d13->dbAffectedRows() > - 1) $status = 'done';\n\t\t\telse $status = 'error';\n\t\t}\n\t\telse $status = 'noEntry';\n\t\treturn $status;\n\t}\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":340,"cells":{"blob_id":{"kind":"string","value":"91bf401b2b768180e0b222f49d25bae94e6fbda1"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"openwse/ipfs-api"},"path":{"kind":"string","value":"/src/Namespaces/Dag.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2381,"string":"2,381"},"score":{"kind":"number","value":2.84375,"string":"2.84375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"client->request('dag/export', [\n 'arg' => $cid,\n 'progress' => $progress,\n ])->send([RequestOptions::STREAM => $progress === true]);\n }\n\n /**\n * Get a dag node from IPFS.\n */\n public function get(string $object): array\n {\n /* @phpstan-ignore-next-line */\n return $this->client->request('dag/export', [\n 'arg' => $object,\n ])->send();\n }\n\n /**\n * Import the contents of .car files.\n *\n * @param array|string $files\n */\n public function import($files, ?bool $silent = null, bool $pinRoots = true): array\n {\n $request = $this->client->request('dag/import', [\n 'silent' => $silent,\n 'pin-roots' => $pinRoots,\n ]);\n\n if (is_string($files)) {\n $files = [$files];\n }\n\n foreach ($files as $file) {\n $request->attach($file);\n }\n\n /* @phpstan-ignore-next-line */\n return $request->send();\n }\n\n /**\n * Add a dag node to IPFS.\n */\n public function put(string $file, string $format = 'cbor', string $inputEnc = 'json', ?bool $pin = null, ?string $hash = null): array\n {\n /* @phpstan-ignore-next-line */\n return $this->client->request('dag/put', [\n 'format' => $format,\n 'input-enc' => $inputEnc,\n 'pin' => $pin,\n 'hash' => $hash,\n ])->attach($file)->send();\n }\n\n /**\n * Resolve IPLD block.\n */\n public function resolve(string $path): array\n {\n /* @phpstan-ignore-next-line */\n return $this->client->request('dag/resolve', [\n 'arg' => $path,\n ])->send();\n }\n\n /**\n * Gets stats for a DAG.\n */\n public function stat(string $cid, bool $progress = true): array\n {\n /* @phpstan-ignore-next-line */\n return $this->client->request('dag/stat', [\n 'arg' => $cid,\n 'progress' => $progress,\n ])->send();\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":341,"cells":{"blob_id":{"kind":"string","value":"c42dc5eac5f059cd462c141cff29f9a7284dfd86"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"Sopoala/prac4"},"path":{"kind":"string","value":"/loginControl.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":766,"string":"766"},"score":{"kind":"number","value":2.640625,"string":"2.640625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":""},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":342,"cells":{"blob_id":{"kind":"string","value":"7250450d77b74a5ecf9518e73cf7001ece595b5a"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"dementedshaman/vosuco"},"path":{"kind":"string","value":"/agi/Handler.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1851,"string":"1,851"},"score":{"kind":"number","value":3,"string":"3"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"s_in = $in;\n $this->s_out = $out;\n\n $agivars = array();\n while (!feof($this->s_in)) {\n $agivar = trim(fgets($this->s_in));\n if ($agivar === '') {\n break;\n }\n else {\n $agivar = explode(':', $agivar);\n $agivars[$agivar[0]] = trim($agivar[1]);\n }\n }\n\n foreach($agivars as $k=>$v) {\n $this->log_agi(\"Got $k=$v\");\n }\n\n $this->agivars = $agivars;\n }\n\n public function getCallerId()\n {\n return $this->agivars[\"agi_callerid\"];\n }\n\n function execute_agi($command) {\n\n fwrite($this->s_out, \"$command\\n\");\n fflush($this->s_out);\n $result = trim(fgets($this->s_in));\n $ret = array('code'=> -1, 'result'=> -1, 'timeout'=> false, 'data'=> '');\n if (preg_match(\"/^([0-9]{1,3}) (.*)/\", $result, $matches)) {\n $ret['code'] = $matches[1];\n $ret['result'] = 0;\n if (preg_match('/^result=([0-9a-zA-Z]*)\\s?(?:\\(?(.*?)\\)?)?$/', $matches[2], $match)) {\n $ret['result'] = $match[1];\n $ret['timeout'] = ($match[2] === 'timeout') ? true : false;\n $ret['data'] = $match[2];\n }\n }\n return $ret;\n }\n\n function log_agi($entry, $level = 1) {\n if (!is_numeric($level)) {\n $level = 1;\n }\n $result = $this->execute_agi(\"VERBOSE \\\"$entry\\\" $level\");\n }\n\n function startConversation()\n {\n $this->execute_agi('ANSWER');\n }\n\n function endConversation()\n {\n $this->execute_agi('STREAM FILE vm-goodbye \"\"');\n $this->execute_agi('HANGUP');\n exit;\n }\n\n}\n\n?>\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":343,"cells":{"blob_id":{"kind":"string","value":"bd728e9bef5dbef1cd786900abe4677348cc5bbb"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"leovidalgithub/php"},"path":{"kind":"string","value":"/DataTypes/Numbers.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":857,"string":"857"},"score":{"kind":"number","value":3.5625,"string":"3.5625"},"int_score":{"kind":"number","value":4,"string":"4"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"\n\t\t\n\t\tVariables\n\t\t\n\t\n\n\t
\n\t\t\n\t\tBasic Math uses on PHP:\n\t\t
\n\t\tMath Operations:
\n\t\t+=
\n\t\t-=
\n\t\t*=
\n\t\t/=
\n\t\tIncrement =
\n\t\tDecrement =
\n\n\t\tFloat and Points:
\n\t\tFloating
\n\t\tRound
\n\t\tCeiling
\n\t\tFloor
\n\t
\t\n\t\t\n\n\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":344,"cells":{"blob_id":{"kind":"string","value":"a8e3f20c1133388b9768aaa5e8eb26b1a914aab0"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"jcordero/mgp"},"path":{"kind":"string","value":"/mgp/www/includes/presentation/ticket/gisgrilla.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1932,"string":"1,932"},"score":{"kind":"number","value":2.65625,"string":"2.65625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"m_parent;\n\t\t//$grillas = $this->pedirGrillasUsig();\n\t\t//if(is_array($grillas)) {\n // foreach($grillas as $grilla)\n // {\n // $opciones[$grilla] = $grilla;\n // }\n // $this->m_array = $opciones;\n\t\t//}\n $this->m_array = array(\n \"1\" => \"Barrios\",\n \"2\" => \"Zonas de luminarias\"\n );\n\t}\n\t\n\tprivate function pedirGrillasUsig()\n\t{\n\t\t$resp = array();\n\t\t\n\t\t//Existe el cache?\n\t\tif( file_exists(HOME_PATH.\"temp/delimitaciones.json\") )\n\t\t{\n\t\t\t$delim = file_get_contents(HOME_PATH.\"temp/delimitaciones.json\");\n\t\t\treturn json_decode($delim);\n\t\t}\n\t\t\n\t\t//Pido via web service\n\t\ttry\n {\n\t\t\t$host = $_SERVER[\"HTTP_HOST\"];\n $ch = curl_init(\"http://$host/direcciones/proxyjson.php?method=delimitacionesDisponibles\");\n\t\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\t\t\tcurl_setopt($ch, CURLOPT_BINARYTRANSFER, true);\n\t\t\tcurl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);\n\t\t\tcurl_setopt($ch, CURLOPT_TIMEOUT,20);\n\t\t\t$output = curl_exec($ch);\n\t\t\tif($output!=false)\n\t\t\t{\n\t\t\t\t$resp = json_decode($output);\n\n\t\t\t\t//Salvo al cache\n\t\t\t\tfile_put_contents(HOME_PATH.\"temp/delimitaciones.json\",$output);\n\t\t\t} \t\n }\n catch (SoapFault $ex) \n { \n error_log( \"pedirGrillasUsig() delimitacionesDisponibles() ->\".$ex->getMessage() ); \n }\n catch (Exception $ex) \n { \n error_log( \"pedirGrillasUsig() delimitacionesDisponibles() ->\".$ex->getMessage() ); \n }\n return $resp;\n }\n}\n?>"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":345,"cells":{"blob_id":{"kind":"string","value":"3a6705ae421c02c8c1633589a6332844931292aa"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"victoruizr/PHP"},"path":{"kind":"string","value":"/Ejercicios/PDO/SentenciaPreparada.PHP"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":693,"string":"693"},"score":{"kind":"number","value":3.15625,"string":"3.15625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"prepare(\"create table $nTable (alumno varchar(99))\");\n $crear->execute();\n\n //Insertamos en la tabla creada anteriormente todos los alumnos cuyo curso sea el pasado como parametro\n $sentencia = \"INSERT INTO $nTable (alumno)\n (SELECT (numMatricula) FROM alumno WHERE alumno.curso = :mat)\";\n $res_enc = $mbd->prepare($sentencia);\n $res_enc->bindParam(':mat', $curso); \n $res_enc->execute();\n \n\n }\n\n datos(\"02\",\"pepe\");\n\n?>"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":346,"cells":{"blob_id":{"kind":"string","value":"78bc7fed63cfbcd2fd0774ae9254d580bb31a825"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"andrewFisherUa/widget-market"},"path":{"kind":"string","value":"/app/WidgetEditor.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":6657,"string":"6,657"},"score":{"kind":"number","value":2.515625,"string":"2.515625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"$attr);\n }\n public function widgetSave($parameters){\n \n }\n public function mobile_render(){\n\t\t$body=$this->getTemplateMobile();\n\t\t$style=$this->getStyleMobile();\n\t\t$script=$this->getScriptMobile();\n\t\t if(!$this->name_mobile){\n\t$name=\"block-mobile\";\n\t}\n\telse{\n\t$name=$this->name_mobile;\n\t}\n\tif(!$this->width || !$this->height){\n\t\t $width=\"200px\";\n\t\t\t$height=\"200px\";\n\t }\n\t else{\n\t $width=$this->width;\n\t\t\t$height=$this->height;\n\t }\n\tif (!$this->mobile_background){\n\t\t\t$background='rgba(255,255,255,1)';\n\t\t }\n\t\t else{\n\t\t\t$background=$this->mobile_background;\n\t\t }\n\tif (!$this->background_model){\n\t\t\t$background_model='rgba(255,255,255,1)';\n\t\t }\n\t\t else{\n\t\t\t$background_model=$this->background_model;\n\t\t }\n\tif (!$this->background_model_hover){\n\t\t\t$background_model_hover='rgba(255,255,255,1)';\n\t\t }\n\t\t else{\n\t\t\t$background_model_hover=$this->background_model_hover;\n\t\t }\n\tif (!$this->mobile_font_family){\n\t\t\t$mobile_font_family='ArialRegular';\n\t\t }\n\t\t else{\n\t\t\t$mobile_font_family=$this->mobile_font_family;\n\t\t }\n\t\t $res=[\"body\"=>$body, \"style\"=>$style, \"script\"=>$script, \"name\"=>$name, \"width\"=>$width, \"height\"=>$height, \"background\"=>$background, \"background_model\"=>$background_model, \"background_model_hover\"=>$background_model_hover, 'mobile_font_family'=>$mobile_font_family];\n return $res;\n }\n public function render(){\n \t\n\n\n\t\t $body=$this->getTemplate();\n\t\t\n\t\t $style=$this->getStyle();\n\t\t $script=$this->getScript();\n\t\t\n\t\t /*\n \t\t if (!isset($parameters[\"name\"])){\n\t\t $name=\"block-mono\";\n\t\t}\n\t\telse{\n\t\t\t$name=$parameters[\"name\"];\n\t\t}\n\t\t*/\n\tif(!$this->name){\n\t$name=\"block-mono\";\n\t}\n\telse{\n\t$name=$this->name;\n\t}\n\t\n\t\t if($this->width===null || $this->height ===null){\n\t\t $width=\"200px\";\n\t\t\t$height=\"200px\";\n\t }\n\t else{\n\t $width=$this->width;\n\t\t\t$height=$this->height;\n\t }\n\t\t if ($this->width=='0'){\n\t\t\t$width='0';\n\t\t }\n\t\t if ($this->height=='0'){\n\t\t\t$height='0';\n\t\t }\n\t\t if (!$this->cols){\n\t\t\t$cols=1;\n\t\t }\n\t\t else{\n\t\t\t$cols=$this->cols;\n\t\t }\n\t\t if (!$this->row){\n\t\t\t$row=1;\n\t\t }\n\t\t else{\n\t\t\t$row=$this->row;\n\t\t }\n\t\t if (!$this->background){\n\t\t\t$background='rgba(255,255,255,1)';\n\t\t }\n\t\t else{\n\t\t\t$background=$this->background;\n\t\t }\n\t\t if (!$this->border_color){\n\t\t\t$border_color='rgba(0, 0, 0, .1)';\n\t\t }\n\t\t else{\n\t\t\t$border_color=$this->border_color;\n\t\t }\n\t\t if (!$this->border_width){\n\t\t\t$border_width=1;\n\t\t }\n\t\t else{\n\t\t\t$border_width=$this->border_width;\n\t\t }\n\t\t if (!$this->border_radius){\n\t\t\t$border_radius=1;\n\t\t }\n\t\t else{\n\t\t\t$border_radius=$this->border_radius;\n\t\t }\n\t\t if (!$this->background_model){\n\t\t\t$background_model='rgba(255,255,255,1)';\n\t\t }\n\t\t else{\n\t\t\t$background_model=$this->background_model;\n\t\t }\n\t\t if (!$this->background_model_hover){\n\t\t\t$background_model_hover='rgba(255,255,255,1)';\n\t\t }\n\t\t else{\n\t\t\t$background_model_hover=$this->background_model_hover;\n\t\t }\n\t\t if (!$this->font_family){\n\t\t\t$font_family='ArialRegular';\n\t\t }\n\t\t else{\n\t\t\t$font_family=$this->font_family;\n\t\t }\n\t\t if (!$this->font_size){\n\t\t\t$font_size=1;\n\t\t }\n\t\t else{\n\t\t\t$font_size=$this->font_size;\n\t\t }\n\t\t \n\t\t \n\t\t \n\t\t $res=[\"font_size\"=>$font_size, \"font_family\"=>$font_family, \"background_model_hover\"=>$background_model_hover, \"background_model\"=>$background_model, \"border_radius\"=>$border_radius, \"border_width\"=>$border_width, \"border_color\"=>$border_color, \"background\"=>$background, \"name\"=>$name, \"body\"=>$body, \"style\"=>$style, \"script\"=>$script, \"width\"=>$width, \"height\"=>$height, \"cols\"=>$cols, \"row\"=>$row];\n\t\t \n return $res;\n }\n \tpublic function getTemplate(){\n\n\n\t/*\n\tif(!isset($parameters[\"name\"])){\n\t$name=\"block-mono\";\n\t}\n\telse{\n\t$name=$parameters[\"name\"];\n\t}\n\t*/\n\tif(!$this->name){\n\t$name=\"block-mono\";\n\t}\n\telse{\n\t$name=$this->name;\n\t}\n $b=\"/home/mp.su/api.market-place.su/widget_product/templates/widget-\".$name.\"/body.html\";\n\t\n\n\n\tif(!is_file($b)){\n\techo \"незабуду !!!\".$name.\"любимое моё html\"; exit();\n\t}\n\t// if(!is_file($b)){\n\t// echo \"незабуду !!!\".$name.\"любимое моё html\"; exit();\n\t// }\n\t\n\t$body=file_get_contents($b);\n\t\n\treturn $body;\n\t}\n\t\n\tpublic function getTemplateMobile(){\n\tif(!$this->name_mobile){\n\t$name=\"block-mobile\";\n\t}\n\telse{\n\t$name=$this->name_mobile;\n\t}\n\t//var_dump($name);\n $b=\"/home/mp.su/api.market-place.su/widget_product/templates/widget-\".$name.\"/body.html\";\n\tif(!is_file($b)){\n\techo \"Не нашел мобильный боди !!!\"; exit();\n\t}\n\t$body=file_get_contents($b);\n\treturn $body;\n\t}\n\t\n\tpublic function getStyle(){\n\t/*\n\tif(!isset($parameters[\"name\"])){\n\t$name=\"block-mono\";\n\t}\n\telse{\n\t$name=$parameters[\"name\"];\n\t}\n\t*/\n\tif(!$this->name){\n\t$name=\"block-mono\";\n\t}\n\telse{\n\t$name=$this->name;\n\t}\n $css=\"/home/mp.su/api.market-place.su/widget_product/templates/widget-\".$name.\"/css/widget-slider-big.css\";\n\t//var_dump($css); die();\n\t\n\t// если это шаблон виджета от Яндекса, то будет ругаться(т.к. нет файлов шаблона). Но мы этого не допустим.\n\t\n\n\t// if (!is_file($css)) {\n\t// \techo \"незабуду !!!\".$name.\"любимое моё\"; exit();\n\t// }\n\n\n\tif (!is_file($css)) {\n echo \"незабуду !!!\".$name.\"любимое моё css\"; exit();\n}\n\t\n\t$style=file_get_contents($css);\n\treturn $style;\n\t}\n\t\n\tpublic function getStyleMobile(){\n\tif(!$this->name_mobile){\n\t$name=\"block-mobile\";\n\t}\n\telse{\n\t$name=$this->name_mobile;\n\t}\n $css=\"/home/mp.su/api.market-place.su/widget_product/templates/widget-\".$name.\"/css/widget-slider-big.css\";\n\t//var_dump($css); die();\n\tif(!is_file($css)){\n\techo \"Не нашел стили мобильного !!!\"; exit();\n\t}\n\t$style=file_get_contents($css);\n\treturn $style;\n\t}\n\t\n\tpublic function getScript(){\n\tif(!$this->name){\n\t$name=\"block-mono\";\n\t}\n\telse{\n\t$name=$this->name;\n\t}\n $s=\"/home/mp.su/api.market-place.su/widget_product/templates/widget-\".$name.\"/js/~init.js\";\n\t\n\tif(!is_file($s)){\n\n\techo \"незабуду !!!\".$name.\"любимое моё js\"; exit();\n\t}\n\t$script=file_get_contents($s);\n\treturn $script;\n\t}\n\t\n\tpublic function getScriptMobile(){\n\tif(!$this->name_mobile){\n\t$name=\"block-mobile\";\n\t}\n\telse{\n\t$name=$this->name_mobile;\n\t}\n $s=\"/home/mp.su/api.market-place.su/widget_product/templates/widget-\".$name.\"/js/~init.js\";\n\tif(!is_file($s)){\n\techo \"не нашел скрипты мобильные !!!\"; exit();\n\t}\n\t$script=file_get_contents($s);\n\treturn $script;\n\t}\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":347,"cells":{"blob_id":{"kind":"string","value":"21acedae2062aa283de8f8723fb40c86b5e60fd2"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"itsurya/itsurya.github.edu.np"},"path":{"kind":"string","value":"/Check_score.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2252,"string":"2,252"},"score":{"kind":"number","value":2.546875,"string":"2.546875"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"\r\n\r\n \tSurya Online Exam \r\n\r\n\r\n \r\n \r\n\r\n
\r\nSurya Online Exam \r\nInformation and Communication Technology (ICT), E - Education, Nepal\r\n

Welcome to all Students

\r\n\r\n
\r\n// Home // Online Exam Sample // Downloads // Online Questions // Student Score List // Developer // \r\n
\r\n\r\nconnect_error){\r\n die('Error: ' . $con->connect_error);\r\n}\r\n$sql = \"SELECT * FROM tbl_stud\";\r\n\r\nif(isset($_GET['search']) )\r\n\t{\r\n $name = mysqli_real_escape_string($con, htmlspecialchars($_GET['search']));\r\n $sql = \"SELECT * FROM tbl_stud WHERE studcode ='$name'\";\r\n\tif ($name==\"all\" || $name==\"ALL\")\r\n\t\t{\r\n\t$sql = \"SELECT * FROM tbl_stud\";\r\n\r\n\t\t}\r\n\t}\r\n$result = $con->query($sql);\r\n?>\r\n\r\n\r\nBasic Search form using mysqli\r\n\r\n
\r\n\r\n
\r\n&nbsp;\r\n\r\n
\r\n

Thank You for Your Exam // Student Result

\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nfetch_assoc()){\r\n$c=$c+1;\r\n\t?>\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Student codeStudent NameStudent CatagoryStudent Score
\r\n
\r\n\r\n\r\n
Total Records is = \r\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":348,"cells":{"blob_id":{"kind":"string","value":"4a77f19860b15dc4b330452b2da28cff1e96d060"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"kebrahim/kara-designs"},"path":{"kind":"string","value":"/util/mail_helper.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1432,"string":"1,432"},"score":{"kind":"number","value":2.984375,"string":"2.984375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"\\r\\n\";\n $headers .= \"Reply-To: \" . $fromName . \" <\" . $fromEmail . \">\\r\\n\";\n $headers .= \"Return-Path: \" . $fromName . \" <\" . $fromEmail . \">\\r\\n\";\n $headers .= \"MIME-Version: 1.0\" . \"\\r\\n\";\n $headers .= \"Content-type: text/html; charset=iso-8859-1\" . \"\\r\\n\";\n\n return mail($to, $subject, $message, $headers);\n\n // Used for testing what will be mailed.\n // return MailHelper::displayMail($to, $subject, $message, $headers);\n }\n\n /**\n * Utility method to display what will be mailed.\n */\n private static function displayMail($to, $subject, $message, $headers) {\n echo \"

To

\n

\" . htmlentities($to) . \"

\n

Subject

\n

\" . htmlentities($subject) . \"

\n

Message

\n

\" . htmlentities($message) . \"

\n

Headers

\n

\" . htmlentities($headers) . \"

\";\n return true;\n }\n }\n?>\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":349,"cells":{"blob_id":{"kind":"string","value":"fc9c948556d5a0b70740df3937a98f5979643b5f"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"aplinxy9plin/vk-bot"},"path":{"kind":"string","value":"/core/apiVK.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1086,"string":"1,086"},"score":{"kind":"number","value":2.8125,"string":"2.8125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":" $msg,\n\t\t 'user_id' => $uid,\n\t\t 'access_token' => $token,\n\t\t 'v' => self::API_VERSION\n\t\t);\n\t\t$get_params = http_build_query($request_params);\n\t\tfile_get_contents(self::METHOD_URL.\"messages.send?\".$get_params);\n\t}\n /*\n\tpublic function curl_post($url){\n\t\techo $url;\n\t\t$ch = curl_init( $url );\n\t\tcurl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );\n\t\tcurl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );\n\t\tcurl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );\n\t\t$response = curl_exec( $ch );\n\t\tcurl_close( $ch );\n\t\treturn $response;\n\t\t\n\t}\n\t*/\n\n}\n\n?>\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":350,"cells":{"blob_id":{"kind":"string","value":"05b21ffc3ac04917432be349706d3df8f5450316"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"Schema31/php-gcloud-storage-sdk"},"path":{"kind":"string","value":"/examples/exampleBuildPdV.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2062,"string":"2,062"},"score":{"kind":"number","value":2.671875,"string":"2.671875"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":" \\n\\n\");\n}\n\n$repositoryName = $argv[1];\n$Authentication = $argv[2];\n$filePath = $argv[3];\n$documentId = $argv[4];\n$subject = $argv[5];\n\n/**\n * Il file da conservare esiste?\n */\nif (!file_exists($filePath) || !is_readable($filePath) || !is_file($filePath)) {\n die(\"\\n\\nAttenzione!\\n\\nFile non valido!\\n\\n\");\n}\n\n/**\n * Settiamo i dettagli del file da inviare in conservazione\n */\n$myDocument = new stdClass();\n$myDocument->filePath = $filePath;\n$myDocument->fileName = basename($filePath);\n$myDocument->mimeType = mime_content_type($filePath);\n$myDocument->documentId = $documentId; // Dimensione fissa (20 caratteri)\n$myDocument->subject = $subject;\n\n/**\n * Il metodo 'buildPdV' consente di creare dei bundle di documenti, aggiungiamo quindi il file ad una lista.\n */\n$files = array($myDocument);\n\n/**\n * Inizializziamo un'istanza della classe gCloud_Storage\n */\n$Storage = new gCloud_Storage();\n$Storage->repositoryName = $repositoryName;\n$Storage->Authentication = $Authentication;\n\n/**\n * Generiamo il PdV\n */\n$PdV = $Storage->buildPdV($files);\nif (!$PdV) {\n die(\"\\n\\nAttenzione!\\n\\nSi è verificato un errore nella costruzione dl PdV: {$Storage->LastError}\\n\\n\");\n}\n\n/**\n * Creiamo localmente un file temporaneo per il PdV\n */\n$PdVFilePath = tempnam(sys_get_temp_dir(), 'gCloudPdV_');\n\n/**\n * Effettuiamo il salvataggio del PdV su gCloud\n */\n$fileKey = $Storage->sendFile($PdVFilePath, 'application/xml', 'gCloud_Storage_PdV.xml');\n\n/**\n * Rimuoviamo il file temporaneo\n */\n@unlink($PdVFilePath);\n\n/**\n * Verifichiamo l'esito del salvataggio\n */\nif (!$fileKey) {\n die(\"\\n\\nAttenzione!\\n\\nSi è verificato un errore nel salvataggio su gCloud: {$Storage->LastError}\\n\\n\");\n}\n\n/**\n * Fatto!\n */\necho \"\\n\";\necho \"Il sistema ha ritornato la seguente fileKey: {$fileKey}\\n\";\necho \"\\n\";\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":351,"cells":{"blob_id":{"kind":"string","value":"c67949a0553db5dcf9b619d0b3afad5a91d62389"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"Smartling/api-sdk-php"},"path":{"kind":"string","value":"/src/Jobs/Params/CancelJobParameters.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":495,"string":"495"},"score":{"kind":"number","value":2.640625,"string":"2.640625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["Apache-2.0"],"string":"[\n \"Apache-2.0\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":" 4096) {\n throw new \\InvalidArgumentException('Reason should be less or equal to 4096 characters.');\n }\n\n $this->set('reason', $reason);\n }\n\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":352,"cells":{"blob_id":{"kind":"string","value":"d6c2988542da48ba296d9b507ff3a4ae17c4eef7"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"Arriadnie/fit.nubip"},"path":{"kind":"string","value":"/app/Integration/Esq/Entity.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2527,"string":"2,527"},"score":{"kind":"number","value":2.859375,"string":"2.859375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"schemaName = $schemaName;\n $this->values = array();\n if (is_null($collection)) {\n $this->IsNew = true;\n return;\n }\n $this->IsNew = false;\n foreach ($collection as $key => $value) {\n $this->values[$key] = $value;\n }\n }\n\n function GetColumnValue($columnName) {\n return $this->values[$columnName];\n }\n function GetValuesCollection() {\n return $this->values;\n }\n function SetColumnValue($columnName, $value) {\n $this->values[$columnName] = $value;\n }\n\n function SetDefaultValues() {\n $this->values[\"Id\"] = Livlag::NewGuid();\n }\n\n static function Create($schemaName) {\n $entity = new \\App\\Integration\\Base\\Entity($schemaName);\n // Some code for set columns config;\n return $entity;\n }\n\n function Save() {\n if ($this->IsNew) {\n $sql = $this->_getInsertSql();\n }\n else {\n $sql = $this->_getUpdateSql();\n }\n //echo $sql;\n DataBaseHandler::ExecuteQuery($sql);\n }\n\n private function _getInsertSql() {\n $sqlInsert = \"INSERT INTO \" . $this->schemaName . \" (\";\n $sqlValues = \"VALUES (\";\n\n\n foreach ($this->values as $key => $value) {\n if (is_null($value)) {\n continue;\n }\n $sqlInsert .= $key . \", \";\n $sqlValues .= (Livlag::IsString($value) ? \"'\" : \"\") . $value . (Livlag::IsString($value) ? \"'\" : \"\") . \", \";\n }\n $sqlInsert = substr($sqlInsert, 0, -2);\n $sqlValues = substr($sqlValues, 0, -2);\n $sqlInsert .= \")\";\n $sqlValues .= \")\";\n\n $sql = $sqlInsert . \" \" . $sqlValues;\n return $sql;\n }\n private function _getUpdateSql() {\n $sql = \"UPDATE \" . $this->schemaName . \" SET \";\n\n foreach ($this->values as $key => $value) {\n if (is_null($value)) {\n continue;\n }\n if ($key == \"Id\") {\n continue;\n }\n $sql .= $key . \"=\" . (Livlag::IsString($value) ? \"'\" : \"\") . $value . (Livlag::IsString($value) ? \"'\" : \"\") . \", \";\n }\n $sql = substr($sql, 0, -2);\n $sql .= \" WHERE Id='\" . $this->values[\"Id\"] . \"'\";\n return $sql;\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":353,"cells":{"blob_id":{"kind":"string","value":"f67168ad26a12de62a613513d84c3ca243160801"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"SamerSenbol/RestAPI-Fetch-Ajax"},"path":{"kind":"string","value":"/viewHoroscope.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":446,"string":"446"},"score":{"kind":"number","value":2.890625,"string":"2.890625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"\nfile = fopen($file_name, $mode);\n return $this;\n }\n\n abstract public function write($data);\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":355,"cells":{"blob_id":{"kind":"string","value":"8fe5f20f7bd3fb206b7e91cfb52a0f1373ea6e13"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"misaki0710/minnano"},"path":{"kind":"string","value":"/product.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":876,"string":"876"},"score":{"kind":"number","value":2.59375,"string":"2.59375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\r\n prepare('select * from product where name like ?');\r\n\t$sql -> execute(['%'.$_REQUEST['keyword'].'%']);\r\n}else{\r\n\t$sql = $pdo -> prepare('select * from product');\r\n\t$sql -> execute([]);\r\n\r\n/*\r\n\t$sql = $pdo -> query('select * from product');\r\n*/\r\n}\r\n\r\nforeach($sql as $row){\r\n\t$id = $row['id'];\r\n?>\r\n\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\r\n\r\n
商品番号商品名価格
\">
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":356,"cells":{"blob_id":{"kind":"string","value":"eb27ec69a44376c97207f702139852e8861555f3"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"songluco/fortune"},"path":{"kind":"string","value":"/fortune/app/Services/SongluReflectionTest/Person.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":902,"string":"902"},"score":{"kind":"number","value":2.703125,"string":"2.703125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"id;\n }\n public function setId($v) {\n $this->id = $v;\n }\n public function getName() {\n return $this->name;\n }\n public function setName($v) {\n $this->name = $v;\n }\n public function getBiography() {\n return $this->biography;\n }\n public function setBiography($v) {\n $this->biography = $v;\n }\n}\n\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":357,"cells":{"blob_id":{"kind":"string","value":"3a43986fdb8e6ba03106c3ed274c5f91a17501ed"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"IT-341/jipa-web"},"path":{"kind":"string","value":"/src/Controller/Component/JIPAApiComponent.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":3366,"string":"3,366"},"score":{"kind":"number","value":2.859375,"string":"2.859375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"http = new Client();\n }\n\n /**\n * GET request method.\n *\n * @param $config Check buildUrl method for more details.\n */\n public function get(array $config = array())\n {\n $response = $this->http->get($this->buildUrl($config));\n\n if ($response->code == '404') {\n return null;\n }\n\n return $response->body('json_decode');\n }\n\n public function post(array $config = array(), array $data = array())\n {\n $response = $this->http->post(\n $this->buildUrl($config),\n json_encode($data),\n ['headers' => ['Content-Type' => 'application/json']]\n );\n\n return $response->code == '201';\n }\n\n /**\n * PUT request method.\n *\n * @param $config Check buildUrl method for more details.\n * @param $data The data to be updated.\n */\n public function put(array $config = array(), array $data = array())\n {\n $response = $this->http->put(\n $this->buildUrl($config),\n json_encode($data),\n ['headers' => ['Content-Type' => 'application/json']]\n );\n\n return $response->isOk();\n }\n\n /**\n * DELETE request method.\n *\n * @param $config Check buildUrl method for more details.\n */\n public function delete(array $config = array())\n {\n $response = $this->http->delete($this->buildUrl($config));\n\n return $response->code == '204' || $response->isOk();\n }\n\n /**\n * Build the url based on the $config parameters.\n *\n * Parameters used are:\n * resource [required] the resource to look for\n * id [optional] the id of the resource you want\n * select [optional] to get only some attributes\n * filter [optional] to filter the search\n * populate [optional] populate the relationship\n */\n private function buildUrl(array $config)\n {\n if (!isset($config['resource'])) {\n throw new BadRequestException('Missing resource on JIPAApiComponent->get() method');\n }\n\n $url = $this->apiUrl . $config['resource'] . '/';\n\n if (isset($config['id'])) {\n $url .= $config['id'];\n }\n\n $url .= '?';\n\n if (isset($config['select'])) {\n $url .= 'select=';\n\n foreach ($config['select'] as $key => $value) {\n if ($key != 0) {\n $url .= '%20';\n }\n\n $url .= $value;\n }\n\n $url .= '&';\n }\n\n if (isset($config['filter'])) {\n foreach ($config['filter'] as $key => $value) {\n $url .= $key . '=' . $value;\n }\n\n $url .= '&';\n }\n\n if (isset($config['populate'])) {\n $url .= 'populate=' . $config['populate'];\n }\n\n return $url;\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":358,"cells":{"blob_id":{"kind":"string","value":"3820239e28b496959ae61b648c5793408343da18"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"d-l-cloud/dlc"},"path":{"kind":"string","value":"/app/Models/Shop/ProductCategory.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2961,"string":"2,961"},"score":{"kind":"number","value":2.59375,"string":"2.59375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"belongsTo(Profile::class, 'user_id');\n }\n public function productList() {\n return $this->hasMany(ProductList::class, 'productCategoryId')->where('variable', '<=', '1');\n }\n\n public static function getCategories() {\n // Получаем одним запросом все разделы\n $arr = self::orderBy('name')->where('isHidden', '=' , '0')->with(['productList','user'])->get();\n // Запускаем рекурсивную постройку дерева и отдаем на выдачу\n return self::buildTree($arr, 0);\n }\n\n public static function buildTree($arr, $pid = 0) {\n // Находим всех детей раздела\n $found = $arr->filter(function($item) use ($pid){return $item->parent_id == $pid; });\n\n // Каждому детю запускаем поиск его детей\n foreach ($found as $key => $cat) {\n $sub = self::buildTree($arr, $cat->id);\n $cat->sub = $sub;\n }\n return $found;\n }\n\n public function searchUrl(Request $request) {\n $query=strip_tags(htmlspecialchars($request->route('query')));\n $getSubCategoryUrl = ProductCategory::where('id', '=', $query)->first();\n $getCategoryUrl = ProductCategory::where('id', '=', $getSubCategoryUrl->parent_id)->first();\n $fullUrl = '/katalog/'.$getCategoryUrl->slug.'/'.$getSubCategoryUrl->slug.'/'.$query.'/';\n return $fullUrl;\n }\n public function searchUrlProduct($article) {\n $query=strip_tags(htmlspecialchars($article));\n $getSubCategoryUrl = ProductCategory::where('id', '=', $query)->first();\n\n $getCategoryUrl = ProductCategory::where('id', '=', $getSubCategoryUrl->parent_id)->first();\n $fullUrl = '/katalog/'.$getCategoryUrl->slug.'/'.$getSubCategoryUrl->slug.'/'.$query.'/';\n return $fullUrl;\n }\n public static function rulesAdd() {\n return [\n 'name' => 'required|unique:product_categories,name',\n 'slug' => \"required|unique:product_categories,slug\",\n ];\n }\n public static function rulesEdit($id) {\n return [\n 'name' => \"required|unique:product_categories,name,$id\",\n 'slug' => \"required|unique:product_categories,slug,$id\",\n ];\n }\n public static function attributeNames() {\n return [\n 'title' => 'Название категории',\n 'slug' => 'ЧПУ категории',\n ];\n }\n\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":359,"cells":{"blob_id":{"kind":"string","value":"746dbbaa9f553d5e2c6e404ccc4cf58f9816f1db"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"Maxoslav/utils"},"path":{"kind":"string","value":"/tests/Utils/JsonTest.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":4081,"string":"4,081"},"score":{"kind":"number","value":2.59375,"string":"2.59375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"toString());\n self::assertSame(['name' => 'Rosta'], $instance->toArray());\n }\n\n public function testFromArray() : void\n {\n $instance = \\Infinityloop\\Utils\\Json::fromArray(['name' => 'Rosta']);\n\n self::assertSame('{\"name\":\"Rosta\"}', $instance->toString());\n self::assertSame(['name' => 'Rosta'], $instance->toArray());\n }\n\n public function testLoadArrayInvalidInput() : void\n {\n $instance = \\Infinityloop\\Utils\\Json::fromString('{name: Rosta}');\n\n self::assertFalse($instance->isValid());\n }\n\n public function testLoadStringInvalidInput() : void\n {\n $instance = \\Infinityloop\\Utils\\Json::fromArray(['name' => \" \\xB1\\x31\"]);\n\n self::assertFalse($instance->isValid());\n }\n\n public function testIsValid() : void\n {\n $check = \\Infinityloop\\Utils\\Json::fromString('{\"name\":\"Rosta\"}')->isValid()\n && \\Infinityloop\\Utils\\Json::fromArray(['name' => 'Rosta'])->isValid();\n\n self::assertEquals(true, $check);\n }\n\n public function testCount() : void\n {\n $instance = \\Infinityloop\\Utils\\Json::fromString('{\"name\":\"Rosta\"}');\n\n self::assertSame(1, $instance->count());\n self::assertCount($instance->count(), $instance->toArray());\n }\n\n public function testGetIterator() : void\n {\n self::assertInstanceOf('\\ArrayIterator', \\Infinityloop\\Utils\\Json::fromString('{\"name\":\"Rosta\"}')->getIterator());\n }\n\n public function testOffsetExists() : void\n {\n self::assertSame(true, \\Infinityloop\\Utils\\Json::fromString('{\"name\":\"Rosta\"}')->offsetExists('name'));\n }\n\n public function testOffsetGet() : void\n {\n self::assertSame('Rosta', \\Infinityloop\\Utils\\Json::fromString('{\"name\":\"Rosta\"}')->offsetGet('name'));\n }\n\n public function testOffsetSet() : void\n {\n $instance = \\Infinityloop\\Utils\\Json::fromString('{\"name\":\"Rosta\"}');\n $instance->offsetSet('car', 'Tesla');\n\n self::assertSame('{\"name\":\"Rosta\",\"car\":\"Tesla\"}', $instance->toString());\n self::assertTrue($instance->offsetExists('car'));\n }\n\n public function testOffsetUnset() : void\n {\n $instance = \\Infinityloop\\Utils\\Json::fromString('{\"name\":\"Rosta\"}');\n $instance->offsetUnset('name');\n\n self::assertSame(false, $instance->offsetExists('name'));\n }\n\n public function testSerialize() : void\n {\n self::assertSame('{\"name\":\"Rosta\"}', \\Infinityloop\\Utils\\Json::fromString('{\"name\":\"Rosta\"}')->serialize());\n }\n\n public function testUnserialize() : void\n {\n $instance = \\Infinityloop\\Utils\\Json::fromString('{\"name\":\"Rosta\"}');\n $instance->unserialize('{\"name\":\"Rosta\"}');\n\n self::assertSame('{\"name\":\"Rosta\"}', $instance->toString());\n }\n\n public function testMagicToString() : void\n {\n self::assertSame('{\"name\":\"Rosta\"}', \\Infinityloop\\Utils\\Json::fromArray(['name' => 'Rosta'])->__toString());\n }\n\n public function testMagicIsset() : void\n {\n self::assertSame(true, \\Infinityloop\\Utils\\Json::fromArray(['name' => 'Rosta'])->__isset('name'));\n }\n\n public function testMagicGet() : void\n {\n self::assertSame('Rosta', \\Infinityloop\\Utils\\Json::fromArray(['name' => 'Rosta'])->__get('name'));\n }\n\n public function testMagicSet() : void\n {\n $instance = \\Infinityloop\\Utils\\Json::fromString('{\"name\":\"Rosta\"}');\n $instance->__set('car', 'Tesla');\n\n self::assertTrue($instance->offsetExists('car'));\n }\n\n public function testMagicUnset() : void\n {\n $instance = \\Infinityloop\\Utils\\Json::fromArray(['name' => 'Rosta']);\n $instance->__unset('name');\n\n self::assertSame(false, $instance->offsetExists('name'));\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":360,"cells":{"blob_id":{"kind":"string","value":"a891df8ee241a52b22e120d801b9a94b900ef5fe"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"louLabo/applicationAPI"},"path":{"kind":"string","value":"/src/Main.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2050,"string":"2,050"},"score":{"kind":"number","value":3.234375,"string":"3.234375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"\nrequesting($data_Sent, $parameter);\n array_push($res_experience['experience'] , ( $Experience->analyse($results, $parameter)));\n\n }\n return $res_experience['experience'];\n}\n\nfunction experience_requesting_without_data()\n{\n $Experience = new Experience();\n $results = $Experience->requesting_without_data();\n $res_experience['experience'] = ($Experience->analyse($results, 'all'));\n return $res_experience['experience'];\n}\n\n\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":361,"cells":{"blob_id":{"kind":"string","value":"129a58e8c8505a3747665c9dc58a61aae0094a66"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"xNicoPaz/emailfy"},"path":{"kind":"string","value":"/app/Mail/PlainTextEmail.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":805,"string":"805"},"score":{"kind":"number","value":2.5625,"string":"2.5625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"customFrom = $from;\n $this->customSubject = $subject;\n $this->customBody = $body;\n }\n\n /**\n * Build the message.\n *\n * @return $this\n */\n public function build()\n {\n return $this->text('emails.rawbody')\n ->from($this->customFrom)\n ->subject($this->customSubject);\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":362,"cells":{"blob_id":{"kind":"string","value":"4b72b56c64b059c4dd177eee7a29f103d320a699"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"torrentpier/torrentpier"},"path":{"kind":"string","value":"/src/Legacy/WordsRate.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":3015,"string":"3,015"},"score":{"kind":"number","value":2.75,"string":"2.75"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"words_del_exp = $del_exp;\n }\n\n /**\n * Возвращает \"показатель полезности\" сообщения используемый для автоудаления коротких сообщений типа \"спасибо\", \"круто\" и т.д.\n *\n * @param string $text\n * @return int\n */\n public function get_words_rate($text)\n {\n $this->words_rate = 127; // максимальное значение по умолчанию\n $this->deleted_words = [];\n $this->del_text_hl = $text;\n\n // длинное сообщение\n if (\\strlen($text) > 600) {\n return $this->words_rate;\n }\n // вырезаем цитаты если содержит +1\n if (preg_match('#\\+\\d+#', $text)) {\n $text = strip_quotes($text);\n }\n // содержит ссылку\n if (strpos($text, '://')) {\n return $this->words_rate;\n }\n // вопрос\n if ($questions = preg_match_all('#\\w\\?+#', $text, $m)) {\n if ($questions >= 1) {\n return $this->words_rate;\n }\n }\n\n if ($this->dbg_mode) {\n preg_match_all($this->words_del_exp, $text, $this->deleted_words);\n $text_dbg = preg_replace($this->words_del_exp, '$0', $text);\n $this->del_text_hl = '
' . $text_dbg . '
';\n }\n $text = preg_replace($this->words_del_exp, '', $text);\n\n // удаление смайлов\n $text = preg_replace('#:\\w+:#', '', $text);\n // удаление bbcode тегов\n $text = preg_replace('#\\[\\S+\\]#', '', $text);\n\n $words_count = preg_match_all($this->words_cnt_exp, $text, $m);\n\n if ($words_count !== false && $words_count < 127) {\n $this->words_rate = ($words_count == 0) ? 1 : $words_count;\n }\n\n return $this->words_rate;\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":363,"cells":{"blob_id":{"kind":"string","value":"5ccddd230c88a665fc0fcc4e8598f3b7f3c4af32"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"DEVSENSE/Phalanger"},"path":{"kind":"string","value":"/Testing/Tests/@PHP/lang/bug7515.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":402,"string":"402"},"score":{"kind":"number","value":2.671875,"string":"2.671875"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["Apache-2.0"],"string":"[\n \"Apache-2.0\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"[expect php]\r\n[file]\r\nroot=new obj();\r\n\r\nob_start();\r\n__var_dump($o);\r\n$x=ob_get_contents();\r\nob_end_clean();\r\n\r\n$o->root->method();\r\n\r\nob_start();\r\n__var_dump($o);\r\n$y=ob_get_contents();\r\nob_end_clean();\r\nif ($x == $y) {\r\n print \"success\";\r\n} else {\r\n print \"failure\r\nx=$x\r\ny=$y\r\n\";\r\n}\r\n?>\r\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":364,"cells":{"blob_id":{"kind":"string","value":"42876300f248e9209b56e3d893884e7d3be504e4"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"jojoe77777/BlockSniper"},"path":{"kind":"string","value":"/src/BlockHorizons/BlockSniper/brush/types/FreezeType.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1433,"string":"1,433"},"score":{"kind":"number","value":3.015625,"string":"3.015625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["Apache-2.0"],"string":"[\n \"Apache-2.0\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"blocks as $block){\n\t\t\tswitch($block->getId()){\n\t\t\t\tcase Block::WATER:\n\t\t\t\tcase Block::FLOWING_WATER:\n\t\t\t\t\tyield $block;\n\t\t\t\t\t$this->putBlock($block, Block::ICE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Block::LAVA:\n\t\t\t\tcase Block::FLOWING_LAVA:\n\t\t\t\t\tyield $block;\n\t\t\t\t\t$this->putBlock($block, Block::OBSIDIAN);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Block::FIRE:\n\t\t\t\t\tyield $block;\n\t\t\t\t\t$this->putBlock($block, 0);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Block::ICE:\n\t\t\t\t\tyield $block;\n\t\t\t\t\t$this->putBlock($block, Block::PACKED_ICE);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function fillAsynchronously() : void{\n\t\tforeach($this->blocks as $block){\n\t\t\tswitch($block->getId()){\n\t\t\t\tcase Block::WATER:\n\t\t\t\tcase Block::FLOWING_WATER:\n\t\t\t\t\t$this->putBlock($block, Block::ICE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Block::LAVA:\n\t\t\t\tcase Block::FLOWING_LAVA:\n\t\t\t\t\t$this->putBlock($block, Block::OBSIDIAN);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Block::FIRE:\n\t\t\t\t\t$this->putBlock($block, 0);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Block::ICE:\n\t\t\t\t\t$this->putBlock($block, Block::PACKED_ICE);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Freeze\";\n\t}\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":365,"cells":{"blob_id":{"kind":"string","value":"85b04d63ff5d3086a2a7d79ccae78019e4b07fe8"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"lwapet/IMAD_project"},"path":{"kind":"string","value":"/mobifake/check_image_service/controllers/Check_near_salient_shape_applications.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":4769,"string":"4,769"},"score":{"kind":"number","value":2.578125,"string":"2.578125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"computeImage();\n\t\n\t\n\t\n\t$shapePointList = NivGris_transformer::get_contours_from_GD_color_IMG($binary_salient_cutted_image);\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\techo \"\\n seuil:\".$seuil.\"\\n\"; \n\tif ($dir = @opendir (Constants::getSalientShapesDataBaseDir())) { $test_iteration= 0;\n\t\twhile ( ($file = readdir ( $dir )) !== false ) {\n\t\t\tif ($file != \"..\" && $file != \".\") {\n\t\t\t\t// ouverture du dossier de chaque application\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t// attention chaque application a son dossier\n\t\t\t\t// le nom de l'application est la première partie du nom de l'image\n\t\t\t\t$app_distance = Constants::getMaximumShapeDistance();\n\t\t\t\t// on ouvre le prochain dossier\n\t\t\t\tif ($actual_application_dir = @opendir ( Constants::getSalientShapesDataBaseDir().$file )) {\n\t\t\t\t\twhile ( ($image_file = readdir ( $actual_application_dir )) !== false ) {\n\t\t\t\t\t\tif ($image_file != \"..\" && $image_file != \".\") {\n\t\t\t\t\t\t\techo \"\\n ***********************************************début du test\";\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$current_ext = pathinfo ( $image_file, PATHINFO_EXTENSION );\n\t\t\t\t\t\t\t$current_name = pathinfo ( $image_file, PATHINFO_FILENAME );\n\t\t\t\t\t\t\techo \"\\n ***********************************************avec l'image\".$current_name;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$i = strpos($current_name, \"_\");\n\t\t\t\t\t\t\t$folder_name = substr($current_name,0,$i);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$handler = fopen ( Constants::getSalientShapesDataBaseDir().$folder_name.\"/\".$current_name.\".\".$current_ext, 'r' );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$string = fgets ( $handler );\n\t\t\t\t\t\t\tfclose ( $handler );\n\t\t\t\t\t\t\t$array_shapePoint = json_decode ( $string, true );\n\t\t\t\t\t\t\t$current_shapePointArrayList = $array_shapePoint[\"salientShapePoint_list\"];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$current_shapePointList = array();\n\t\t\t\t\t\t\tforeach ($current_shapePointArrayList as $shapePointArray){\n\t\t\t\t\t\t\t\t$shapePointObject = new ShapePoint($shapePointArray[\"x\"], $shapePointArray[\"y\"]);\n\t\t\t\t\t\t\t\t$current_shapePointList[]=$shapePointObject;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$distance_actuelle = ShapePoint_ComparerNeutralPoint::compare($shapePointList, $current_shapePointList);\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$result_distance[] = array(\"image_name\"=>$current_name,\"distance\"=>$distance_actuelle);\n\t\t\t\t\t\t\t//if($distance_actuelle<$app_distance) {$app_distance = $distance_actuelle;}\n\t\t\t\t\t\t\tgc_collect_cycles();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//$result_distance[] = array(\"application_name\"=>$file,\"distance\"=>$app_distance);\n\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\t\n\t$distances_applications = array();\n\t\n\tforeach($result_distance as $k => $v) {\n\t\t$distances_applications[$k] = $v[\"distance\"];\n\t}\n\t\n\tarray_multisort($distances_applications, SORT_ASC,$result_distance);\n\t\n\t\n\techo \"\\n résultat final : \\n\";\n\tvar_dump($result_distance);\n\t\n\t\n\t\n\t\n\t/*\n\t\n\t$handler = fopen ( Constants::getLabDatabase (), 'r' );\n\t$string = fgets ( $handler );\n\tfclose ( $handler );\n\t$array_lab = json_decode ( $string, true );\n\t$images_filtre_couleur = array ();\n\t\n\tforeach ( $array_lab as $array ) {\n\t\t$dist_min = Lba_comparer::compare_distinct_lba_values_occurence ( $array [\"image_lab_values\"], $final_distinct_lba_value_occurences );\n\t\tif ($dist_min <= $seuil) {\n\t\t\techo \"\\n similarité_detectee avec l'image \\n\" . $array [\"image_name\"];\n\t\t\t$images_filtre_couleur [] = $array [\"image_name\"];\n\t\t}\n\t}\n\t\n\t\n\t\n\t*/\n\t\n\t\n\t\n} else {\n\techo \"\\nformat non pris en charge....\" . $ext;\n}\n\n\n\n\n\n\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":366,"cells":{"blob_id":{"kind":"string","value":"56563d9b7a72bb239339d3d5bd71e15cc1115a42"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"slasher1959/comp1920"},"path":{"kind":"string","value":"/htdocs/comp1920/lesson02/wk2stst1.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":752,"string":"752"},"score":{"kind":"number","value":3,"string":"3"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"\"; //prints the full textual day of week\n$thedate = date(\"F\"); echo $thedate . \"
\"; //prints the full textual month\n$thedate = date(\"d\"); echo $thedate . \"
\"; //prints the two digit day of month\n$thedate = date(\"F l\"); echo $thedate . \"
\"; //prints Month TextualDayofWk\n$thedate = date(\"l F\"); echo $thedate . \"
\"; //prints TextualDayofWk Month\n$thedate = date(\"l F d\"); echo $thedate . \"
\"; //prints TextualDayofWk Month DD\n*/\n\n$thedate = date(\"l F d Y H:i:s\");\necho \"$thedate
\";\n\n?>\n\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":367,"cells":{"blob_id":{"kind":"string","value":"0a6d830b65e953f4a26b8ed7083a2cd9f4c86d7e"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"jpirnat/dex"},"path":{"kind":"string","value":"/src/Infrastructure/DatabaseItemNameRepository.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1329,"string":"1,329"},"score":{"kind":"number","value":3.015625,"string":"3.015625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"db->prepare(\n\t\t\t'SELECT\n\t\t\t\t`name`\n\t\t\tFROM `item_names`\n\t\t\tWHERE `language_id` = :language_id\n\t\t\t\tAND `item_id` = :item_id\n\t\t\tLIMIT 1'\n\t\t);\n\t\t$stmt->bindValue(':language_id', $languageId->value(), PDO::PARAM_INT);\n\t\t$stmt->bindValue(':item_id', $itemId->value(), PDO::PARAM_INT);\n\t\t$stmt->execute();\n\t\t$result = $stmt->fetch(PDO::FETCH_ASSOC);\n\n\t\tif (!$result) {\n\t\t\tthrow new ItemNameNotFoundException(\n\t\t\t\t'No item name exists with language id '\n\t\t\t\t. $languageId->value() . ' and item id '\n\t\t\t\t. $itemId->value() . '.'\n\t\t\t);\n\t\t}\n\n\t\t$itemName = new ItemName(\n\t\t\t$languageId,\n\t\t\t$itemId,\n\t\t\t$result['name']\n\t\t);\n\n\t\treturn $itemName;\n\t}\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":368,"cells":{"blob_id":{"kind":"string","value":"794d444be6e902cc1a92363db8896c5760cb4d2b"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"zodream/image"},"path":{"kind":"string","value":"/src/ThumbImage.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1075,"string":"1,075"},"score":{"kind":"number","value":3,"string":"3"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"instance()->getWidth();\n\t\t$height = $this->instance()->getHeight();\n\t\tif ($thumbWidth <= 0) {\n\t\t\t$thumbWidth = $auto ? ($thumbHeight / $height * $width) : $width;\n\t\t} elseif ($thumbHeight <= 0) {\n\t\t\t$thumbHeight = $auto ? ($thumbWidth / $width * $height) : $height;\n\t\t} elseif($auto) {\n\t\t\t$rate = min($height / $thumbHeight, $width / $thumbWidth);\n $thumbWidth *= $rate;\n $thumbHeight *= $rate;\n\t\t}\n $thumb = $this->instance();\n\t\t$thumb->thumbnail(new Box($width, $height));\n\t\t$thumb->saveAs($output);\n\t\treturn $output;\n\t}\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":369,"cells":{"blob_id":{"kind":"string","value":"0a3869e35171559df0b127f7396317aad38e2ac2"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"RabinPhaiju/Laravel-8"},"path":{"kind":"string","value":"/blog/app/Http/Controllers/Users.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2414,"string":"2,414"},"score":{"kind":"number","value":2.59375,"string":"2.59375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"$data]);\n }\n\n function deleteUserDB($id){\n // How to delete more than one data at a time.\n $data = User::find($id);\n session()->flash('deleteUser',$data['username']);\n $data->delete();\n return redirect('user/rabin?age=20');\n }\n\n function editUserDB($id){\n $data = User::find($id);\n // return $data;\n return view('editUserDB',['data'=>$data]);\n }\n\n function updateUserDB(Request $req){\n $data = User::find($req->id);\n $data->firstname=$req->firstname;\n $data->email=$req->email;\n $data->location=$req->location;\n $data->contact=$req->contact;\n $data->save();\n return redirect('user/rabin?age=20');\n }\n\n\n function addDBData(Request $req){\n $user = new User;\n $user->firstname=$req->firstname;\n $user->email=$req->email;\n $user->location=$req->location;\n $user->contact=$req->contact;\n\n $user->save();\n return redirect('user/rabin?age=20');\n }\n\n function fetchHttp(){\n echo \"API Data will be here\";\n $collection= Http::get(\"https://reqres.in/api/users?page=1\");\n return view(\"collection\",['collection'=>$collection['data']]);\n }\n\n public function index_func($user){\n // return ['name'=>\"rabin\",'age'=>34]; // api return\n echo \" Hello from controller \".$user;\n $data = ['rabin','sabin',$user];\n\n return view(\"user\",['name'=>$data]);\n }\n\n function getData(Request $req){\n $username = $req->old('username');\n $req->validate([\n 'username'=>'required | max:10 | min:5',\n 'password' => ['required', \n 'min:6', \n 'regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\\d\\x])(?=.*[!$#%]).*$/']\n ]);\n \n return $req->input();\n }\n \n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":370,"cells":{"blob_id":{"kind":"string","value":"e01eb5fd21202703985212c3b0cbb3f525dafa50"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"mjcaabay06/devam"},"path":{"kind":"string","value":"/include/general_functions.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1610,"string":"1,610"},"score":{"kind":"number","value":2.59375,"string":"2.59375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"prepare(\"SELECT * FROM users WHERE username = :uname AND password = :pass AND user_type_id = 1\");\n\t$chkLogin->execute(array(\":uname\" => $username, \":pass\" => encryptPass($password)));\n\t$results = $chkLogin->fetch();\n\n\tif(!empty($results)){\n\t\t$_SESSION['AuthId'] = $results['id'];\n\t\t$_SESSION['username'] = $results['username'];\n\t\t$isAuthenticated = true;\n\t}\n\n\treturn $isAuthenticated;\n}\n\nfunction encryptPass($password){\n\t$cryptKey = 'encrypt-pass';\n\t$cryptPass = base64_encode( mcrypt_encrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), $password, MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ) );\n\n\treturn $cryptPass;\n}\n\nfunction decryptPass($password){\n\t$cryptKey = 'encrypt-pass';\n\t$dcrypt = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), base64_decode($password ), MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ), \"\\0\");\n\n\treturn $dcrypt;\n}\n\nfunction sendViaSemaphore($parameters){\n\t$ch = curl_init();\n\tcurl_setopt( $ch, CURLOPT_URL,'http://api.semaphore.co/api/v4/messages' );\n\tcurl_setopt( $ch, CURLOPT_POST, 1 );\n\tcurl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( $parameters ) );\n\tcurl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );\n\t$output = curl_exec( $ch );\n\tcurl_close ($ch);\n\n\treturn json_decode($output);\n}\n\nfunction getMsgReceivers(){\n\tglobal $dbh;\t\n\n\t$getData = $dbh->prepare(\"SELECT * FROM farmer_infos WHERE user_id = :user_id \");\n\t$getData->execute(array(\":user_id\" => (int)$_SESSION['AuthId']));\n\t$results = $getData->fetchAll(PDO::FETCH_ASSOC);\n\n\treturn $results;\n}\n\n?>"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":371,"cells":{"blob_id":{"kind":"string","value":"6a71ef3934fc557d942c0375af26a6b96f5b2454"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"NolwennWM/-2019-WF3-Becycle"},"path":{"kind":"string","value":"/src/Entity/Address.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":3471,"string":"3,471"},"score":{"kind":"number","value":2.578125,"string":"2.578125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"orders = new ArrayCollection();\n }\n\n public function getId(): ?int\n {\n return $this->id;\n }\n\n public function getName(): ?string\n {\n return $this->name;\n }\n\n public function setName(string $name): self\n {\n $this->name = $name;\n\n return $this;\n }\n\n public function getStreet(): ?string\n {\n return $this->street;\n }\n\n public function setStreet(string $street): self\n {\n $this->street = $street;\n\n return $this;\n }\n\n public function getPostalCode(): ?string\n {\n return $this->postal_code;\n }\n\n public function setPostalCode(string $postal_code): self\n {\n $this->postal_code = $postal_code;\n\n return $this;\n }\n\n public function getCity(): ?string\n {\n return $this->city;\n }\n\n public function setCity(string $city): self\n {\n $this->city = $city;\n\n return $this;\n }\n\n public function getCountry(): ?string\n {\n return $this->country;\n }\n\n public function setCountry(string $country): self\n {\n $this->country = $country;\n\n return $this;\n }\n\n public function getIdUser(): ?user\n {\n return $this->id_user;\n }\n\n public function setIdUser(?user $id_user): self\n {\n $this->id_user = $id_user;\n\n return $this;\n }\n\n /**\n * @return Collection|Orders[]\n */\n public function getOrders(): Collection\n {\n return $this->orders;\n }\n\n public function addOrder(Orders $order): self\n {\n if (!$this->orders->contains($order)) {\n $this->orders[] = $order;\n $order->setIdAdress($this);\n }\n\n return $this;\n }\n\n public function removeOrder(Orders $order): self\n {\n if ($this->orders->contains($order)) {\n $this->orders->removeElement($order);\n // set the owning side to null (unless already changed)\n if ($order->getIdAdress() === $this) {\n $order->setIdAdress(null);\n }\n }\n\n return $this;\n }\n\n public function getActive(): ?int\n {\n return $this->active;\n }\n\n public function setActive(int $active): self\n {\n $this->active = $active;\n\n return $this;\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":372,"cells":{"blob_id":{"kind":"string","value":"a382695db1dac41b79a71f5fe6bb21410284cfc8"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"TYPO3-svn-archive/cz_simple_cal"},"path":{"kind":"string","value":"/Classes/Hook/Datamap.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1838,"string":"1,838"},"score":{"kind":"number","value":2.734375,"string":"2.734375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"create($tce->substNEWwithIDs[$id]);\n\t\t\t} elseif($this->haveFieldsChanged(Tx_CzSimpleCal_Domain_Model_Event::getFieldsRequiringReindexing(), $fieldArray)) {\n\t\t\t\t//if: record was updated and a value that requires re-indexing was changed\n\t\t\t\t$indexer->update($id);\n\t\t\t}\n\t\t}\n\t}\n\t\n\t/**\n\t * implement the hook processDatamap_postProcessFieldArray that gets invoked\n\t * right before a dataset is written to the database\n\t * \n\t * @param $status\n\t * @param $table\n\t * @param $id\n\t * @param $fieldArray\n\t * @param $tce\n\t * @return null\n\t */\n\tpublic function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, $tce) {\n\t\t\n\t\tif($table == 'tx_czsimplecal_domain_model_event' || $table == 'tx_czsimplecal_domain_model_exception') {\n\t\t\t// store the timezone to the database\n\t\t\t$fieldArray['timezone'] = date('T');\n\t\t}\n\t}\n\t\n\t/**\n\t * check if fields have been changed in the record \n\t * \n\t * @param $fields\n\t * @return boolean\n\t */\n\tprotected function haveFieldsChanged($fields, $inArray) {\n\t\t$criticalFields = array_intersect(\n\t\t\tarray_keys($inArray),\n\t\t\t$fields\n\t\t);\n\t\treturn !empty($criticalFields);\n\t}\n\t\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":373,"cells":{"blob_id":{"kind":"string","value":"2b606a2892246f38b916256ac1e173dea7fceae7"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"Ntlzyjstdntcare/Colms_Portfolio"},"path":{"kind":"string","value":"/ThoughtCatcher/enter_username.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2727,"string":"2,727"},"score":{"kind":"number","value":2.8125,"string":"2.8125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":" 0)\n\t{\n\t //If it is, insert the date of login into the database, and then send the user to logger page.\n\t\t$sql=mysql_query(\"UPDATE users SET last_log_date=now() WHERE username='$name'\")\n\t or die (mysql_error());\n\t\t$sql = mysql_result(mysql_query(\"SELECT id FROM users WHERE username = '$name' LIMIT 1\"),0);\n\t $_SESSION['userID'] = $sql;\n\theader(\"location: logger.php \");\n\t exit();\n\t} else\n\t{\n\t //if the customer is not in the system, add it to the database\n\t //Run an sql query to insert the product details into the database\n\t $sql=mysql_query(\"INSERT INTO users(username, last_log_date)\n\t VALUES('$name', now())\") or die (mysql_error());\n\t $sql = mysql_result(mysql_query(\"SELECT id FROM users WHERE username = '$name' LIMIT 1\"),0);\n\t $_SESSION['userID'] = $sql;\t \n\t\n\t header(\"location: logger.php \");\n exit();\n\t}\n}\n?>\n\n\n\n \n \n\t\tCreate User Page\n\t\t\t\t\t\n\t\n\t\n\t\n\t\t
\n\t\t\"Thought\n\t\t
\n\t\t
\n\t\t\"Mood\n\t\t
\n\t\t

Welcome!

\n\t\t

Store your thoughts and moods here.

\n\t\t

What is your name?

\n\t\t
\n\t\t
\n\t\t \n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t
\n\t\t
\n\t\n\t\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":374,"cells":{"blob_id":{"kind":"string","value":"e2890e5ac1d047d056cdcac578569b206cff19fd"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"bbattulga/dental-erp"},"path":{"kind":"string","value":"/app/ToothType.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":808,"string":"808"},"score":{"kind":"number","value":2.78125,"string":"2.78125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"name;\n \t$words = explode(' ', $name);\n \treturn mb_strtolower($words[0]);\n }\n\n public static function milk(){\n\n \tif (!isset(self::$MILK)){\n \t\tself::$MILK = self::where('name', 'like', '%Сү%')\n \t\t\t\t->orWhere('name', 'like', '%Milk%')\n \t\t\t\t->first();\n \t}\n \treturn self::$MILK;\n }\n\n public static function permanent(){\n \tif (!isset(self::$PERMA)){\n \t\tself::$PERMA = self::where('name', 'like', '%Яс%')\n \t\t\t\t->orWhere('name', 'like', '%Perm%')\n \t\t\t\t->first();\n \t}\n \treturn self::$PERMA;\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":375,"cells":{"blob_id":{"kind":"string","value":"fd5b0b25f10566d3c9ab1872eac946b2b629c3fd"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"loevgaard/dandomain-api"},"path":{"kind":"string","value":"/src/Endpoint/Customer.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":4746,"string":"4,746"},"score":{"kind":"number","value":2.5625,"string":"2.5625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"greaterThan(0, 'The $customerId has to be positive');\n\n return (array)$this->master->doRequest(\n 'GET',\n sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/%d', $customerId)\n );\n }\n\n /**\n * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#GetCustomerByEmail_GET\n *\n * @param string $email\n * @return array\n */\n public function getCustomerByEmail(string $email) : array\n {\n Assert::that($email)->email();\n\n return (array)$this->master->doRequest(\n 'GET',\n sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/GetCustomerByEmail?email=%s', rawurlencode($email))\n );\n }\n \n /**\n * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#General_Online_Reference\n *\n * @param \\DateTimeInterface $date\n * @return array \n */\n public function getCustomersCreatedSince(\\DateTimeInterface $date) : array\n {\n return (array)$this->master->doRequest(\n 'GET',\n sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/CreatedSince?date=%s', $date->format('Y-m-d\\TH:i:s'))\n );\n }\n\n /**\n * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#CreateCustomer_POST\n *\n * @param array|\\stdClass $customer\n * @return array\n */\n public function createCustomer($customer) : array\n {\n return (array)$this->master->doRequest('POST', '/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}', $customer);\n }\n\n /**\n * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#UpdateCustomer_PUT\n *\n * @param int $customerId\n * @param array|\\stdClass $customer\n * @return array\n */\n public function updateCustomer(int $customerId, $customer) : array\n {\n Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive');\n\n return (array)$this->master->doRequest(\n 'PUT',\n sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/%d', $customerId),\n $customer\n );\n }\n\n /**\n * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#DeleteCustomer_DELETE\n *\n * @param int $customerId\n * @return boolean\n */\n public function deleteCustomer(int $customerId) : bool\n {\n Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive');\n\n return (bool)$this->master->doRequest(\n 'DELETE',\n sprintf(\n '/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/%d',\n $customerId\n )\n );\n }\n\n /**\n * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#GetCustomerGroups_GET\n *\n * @return array\n */\n public function getCustomerGroups() : array\n {\n return (array)$this->master->doRequest(\n 'GET',\n '/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/CustomerGroup'\n );\n }\n\n /**\n * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#UpdateCustomerDiscountPOST\n *\n * @param int $customerId\n * @param array|\\stdClass $customerDiscount\n * @return array\n */\n public function updateCustomerDiscount(int $customerId, $customerDiscount) : array\n {\n Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive');\n\n return (array)$this->master->doRequest(\n 'POST',\n sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/UpdateCustomerDiscount/%d', $customerId),\n $customerDiscount\n );\n }\n\n /**\n * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#GetCustomerDiscountGET\n *\n * @param int $customerId\n * @return array\n */\n public function getCustomerDiscount(int $customerId) : array\n {\n Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive');\n\n return (array)$this->master->doRequest(\n 'GET',\n sprintf(\n '/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/GetCustomerDiscount/%d',\n $customerId\n )\n );\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":376,"cells":{"blob_id":{"kind":"string","value":"e03baa375474538d51723a9bb973844509bb0474"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"sumiredc/php-pokemon.com"},"path":{"kind":"string","value":"/webapp/html/app/Classes/AutoLoader.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":824,"string":"824"},"score":{"kind":"number","value":2.78125,"string":"2.78125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"connect_errno){\n\tdie('Connect Error: ' . $mysqli->connect_errno . \": \" . $mysqli->connect_error);\n\t\n}\n\n$mysqli->select_db($dbName) or die($mysqli->error);\n\n$username = $_COOKIE['UsersName'];\n$item = $_GET['item'];\n\n$command = \"SELECT item FROM $username WHERE item = '$item'\";\n$result = $mysqli->query($command);\n$array = $result->fetch_array(MYSQLI_ASSOC);\n\nif($array['item'] == $item){\n\tprint(\"Item already in Collection\");\n}\nelse{\n\t$high = $_GET['high'];\n\t$low = $_GET['low'];\n\t$mid = $_GET['mid'];\n\t$image = $_GET['image'];\n\t$product = $_GET['prod'];\n\n\t$command = \"INSERT INTO $username VALUES ('$item', '$high', '$low', '$mid', '$product', '$image')\";\n\t$mysqli->query($command);\n\n}\n\n?>"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":378,"cells":{"blob_id":{"kind":"string","value":"2243f17e4ed2a5aa4e96648a238b9b1cbc0780e7"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"lanizz/weixin"},"path":{"kind":"string","value":"/src/Menu/Menu.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":520,"string":"520"},"score":{"kind":"number","value":2.6875,"string":"2.6875"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"button[] = $button;\n }\n\n public function output()\n {\n return Arr::cnJsonEncode(get_object_vars($this));\n }\n\n public function __set($name, $value)\n {\n $this->$name = $value;\n }\n\n public function __get($name)\n {\n return $name;\n }\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":379,"cells":{"blob_id":{"kind":"string","value":"e900a7a0cb4f097f235c50ecf8d4c628606d3415"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"matlae-ugly/magebit-test"},"path":{"kind":"string","value":"/libs/bootstrap.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":676,"string":"676"},"score":{"kind":"number","value":2.859375,"string":"2.859375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"{$url[1]}();\n }\n } else {\n echo \"404 not found\";\n }\n }\n\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":380,"cells":{"blob_id":{"kind":"string","value":"c722ae7afa74e37f06801fe2ee07b89cd7e05dfd"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"ironhacker-sadigova/Inventory"},"path":{"kind":"string","value":"/src/Orga/Domain/Service/WorkspaceConsistencyService.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":4966,"string":"4,966"},"score":{"kind":"number","value":2.515625,"string":"2.515625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"translator = $translator;\n }\n\n /**\n * Methode qui vérifie la cohérence d'un cube.\n *\n * @param Workspace $workspace\n * @return array();\n */\n public function check($workspace)\n {\n $listAxes = array();\n $listParentsAxes = array();\n $listParentsMembers = array();\n $listChildrenAxes = array();\n $listChildrenMembers = array();\n\n $checkAxes = __('Orga', 'control', 'axisWithNoMember');\n $checkBroaderMember = __('Orga', 'control', 'memberWithMissingDirectParent');\n $checkNarrowerMember = __('Orga', 'control', 'memberWithNoDirectChild');\n\n foreach ($workspace->getFirstOrderedAxes() as $axis) {\n if (!$axis->hasMembers()) {\n $listAxes[] = $this->translator->get($axis->getLabel());\n }\n if ($axis->hasDirectBroaders()) {\n foreach ($axis->getDirectBroaders() as $broaderAxis) {\n foreach ($axis->getOrderedMembers() as $member) {\n try {\n $member->getParentForAxis($broaderAxis);\n } catch (Core_Exception_NotFound $e) {\n $listParentsAxes[] = $this->translator->get($axis->getLabel());\n $listParentsMembers[] = $this->translator->get($member->getLabel());\n }\n }\n foreach ($broaderAxis->getOrderedMembers() as $parentMember) {\n if (count($parentMember->getChildrenForAxis($axis)) === 0) {\n $listChildrenAxes[] = $this->translator->get($broaderAxis->getLabel());\n $listChildrenMembers[] = $this->translator->get($parentMember->getLabel());\n }\n }\n }\n }\n }\n\n $n = count($listAxes);\n $text1 = '';\n $i = 0;\n foreach ($listAxes as $l1) {\n if ($i == $n - 1) {\n $text1 = $text1 . $l1;\n } else {\n $text1 = $text1 . $l1 . '; ';\n }\n $i++;\n }\n\n $text2 = '';\n $m = count($listParentsAxes);\n for ($i = 0; $i <= $m - 1; $i++) {\n if ($i == $m - 1) {\n $text2 = $text2 . __('UI', 'name', 'axis') . __('UI', 'other', ':') . $listParentsAxes[$i]\n . __('UI', 'other', ';') . __('UI', 'name', 'elementSmallCap') . __(\n 'UI',\n 'other',\n ':'\n ) . $listParentsMembers[$i];\n } else {\n $text2 = $text2 . __('UI', 'name', 'axis') . __('UI', 'other', ':') . $listParentsAxes[$i]\n . __('UI', 'other', ';') . __('UI', 'name', 'elementSmallCap') . __(\n 'UI',\n 'other',\n ':'\n ) . $listParentsMembers[$i] . ' / ';\n }\n }\n\n $text3 = '';\n $l = count($listChildrenAxes);\n for ($i = 0; $i <= $l - 1; $i++) {\n if ($i == $l - 1) {\n $text3 = $text3 . __('UI', 'name', 'axis') . __('UI', 'other', ':') . $listChildrenAxes[$i]\n . __('UI', 'other', ';') . __('UI', 'name', 'elementSmallCap') . __(\n 'UI',\n 'other',\n ':'\n ) . $listChildrenMembers[$i];\n } else {\n $text3 = $text3 . __('UI', 'name', 'axis') . __('UI', 'other', ':') . $listChildrenAxes[$i]\n . __('UI', 'other', ';') . __('UI', 'name', 'elementSmallCap') . __(\n 'UI',\n 'other',\n ':'\n ) . $listChildrenMembers[$i] . ' / ';\n }\n }\n\n $result = array();\n $result['okAxis'] = empty($listAxes);\n $result['controlAxis'] = $checkAxes;\n $result['failureAxis'] = $text1;\n\n $result['okMemberParents'] = empty($listParentsAxes);\n $result['controlMemberParents'] = $checkBroaderMember;\n $result['failureMemberParents'] = $text2;\n\n $result['okMemberChildren'] = empty($listChildrenAxes);\n $result['controlMemberChildren'] = $checkNarrowerMember;\n $result['failureMemberChildren'] = $text3;\n\n return $result;\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":381,"cells":{"blob_id":{"kind":"string","value":"9b481317990d444f22b77b13b70dda9dac5d8a6a"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"comboyin/dbpwater"},"path":{"kind":"string","value":"/class/acl.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":3125,"string":"3,125"},"score":{"kind":"number","value":2.8125,"string":"2.8125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"_config = $config;\r\n\t\t$this->_router = $router;\r\n\t\t$this->init();\r\n\t}\r\n\r\n\tprivate function init(){\r\n\t\t// start session\r\n\t\t$session = session_id();\r\n\t\tif(empty($session)){\r\n\t\t\tsession_start();\r\n\t\t}\r\n\r\n\t\t$moduleName = $this->_router->module;\r\n\t\t$controllerName = $this->_router->controller;\r\n\t\t$actionName = $this->_router->action;\r\n\r\n\t\tif(!isset($_SESSION['acl']['account'])){\r\n\t\t\t$accountTemp = new User();\r\n\t\t\t$_SESSION['acl']['account'] = $accountTemp;\r\n\t\t}\r\n\r\n\t\t/* @var $account User */\r\n\t\t$account = $_SESSION['acl']['account'];\r\n\r\n\r\n\t\t// check login form backend module\r\n\t\tif( $moduleName == 'user' ){\r\n\t\t\tif( $account->getGroup()->getLevel() <= 0){\r\n\t\t\t\t// redirect to login controller\r\n\t\t\t\t$this->redirect(\r\n\t\t\t\t\t$this->_router->url(\r\n\t\t\t\t\t\tarray(\r\n\r\n\t\t\t\t\t\t\t'module' => 'login'\r\n\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t)\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif($moduleName == 'error' && $controllerName == 'error404'){\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t// check pemission account\r\n\t\telse if( !$this->checkPermission($moduleName, $controllerName, $actionName, $account->getGroup()->getLevel() )){\r\n\t\t\t// redictect to deny page\r\n\t\t\t$this->redirect(\r\n\t\t\t\t\t$this->_router->url(\r\n\t\t\t\t\t\t\tarray(\r\n\t\t\t\t\t\t\t\t'module' => 'error',\r\n\t\t\t\t\t\t\t\t'controller' => 'deny',\r\n\t\t\t\t\t\t\t\t'action' => 'index'\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t)\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Check permission\r\n\t * @param string $moduleName\r\n\t * @param string $controllerName\r\n\t * @param string $action\r\n\t * @param string $type\r\n\t * @return bool*/\r\n\tpublic function checkPermission( $moduleName, $controllerName, $action, $type){\r\n\r\n\t\t$config = $this->_config;\r\n\t\t$allow = $config['allow'];\r\n\t\t$deny = $config['deny'];\r\n\t\t$result = false;\r\n\r\n\r\n\t\t// check allow\r\n\t\tif(isset($allow[$moduleName][$controllerName])){\r\n\r\n\t\t\t$permissionController = $allow[$moduleName][$controllerName];\r\n\t\t\t// if isset \"all\" (all action)\r\n\t\t\tif(isset($permissionController['all'])){\r\n\r\n\t\t\t\tif($permissionController['all'] == 'all'){\r\n\r\n\t\t\t\t\t$result = true;\r\n\t\t\t\t}else if(in_array($type, $permissionController['all'])){\r\n\r\n\t\t\t\t\t$result = true;\r\n\t\t\t\t}\r\n\t\t\t}else if(isset($permissionController[$action])){\r\n\t\t\t\tif($permissionController[$action] == 'all'){\r\n\t\t\t\t\t$result = true;\r\n\t\t\t\t}else if(in_array($type, $permissionController[$action])){\r\n\t\t\t\t\t$result = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//check deny\r\n\t\tif(isset($deny[$moduleName][$controllerName])){\r\n\t\t\t$permissionController = $deny[$moduleName][$controllerName];\r\n\t\t\t// if isset \"all\" (all action)\r\n\t\t\tif(isset($permissionController['all'])){\r\n\t\t\t\tif($permissionController['all'] == 'all'){\r\n\t\t\t\t\t$result = false;\r\n\t\t\t\t}else if(in_array($type, $permissionController['all'])){\r\n\t\t\t\t\t$result = false;\r\n\t\t\t\t}\r\n\t\t\t}else if(isset($permissionController[$action])){\r\n\t\t\t\tif($permissionController[$action] == 'all'){\r\n\t\t\t\t\t$result = false;\r\n\t\t\t\t}else if(in_array($type, $permissionController[$action])){\r\n\t\t\t\t\t$result = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn $result;\r\n\t}\r\n\r\n\tpublic function redirect( $url ){\r\n\t\theader(\"Location: \".$url);\r\n\t\texit(0);\r\n\t}\r\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":382,"cells":{"blob_id":{"kind":"string","value":"7b5ad1a8ce2836a488c9f536df6f6d70c673b167"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"MorganPfister/Comptes"},"path":{"kind":"string","value":"/src/CDC/CoreBundle/Entity/BudgetInstance.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2935,"string":"2,935"},"score":{"kind":"number","value":2.515625,"string":"2.515625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"id;\n }\n\n /**\n * Set datestart\n *\n * @param \\DateTime $datestart\n *\n * @return BudgetInstance\n */\n public function setDatestart($datestart)\n {\n $this->datestart = $datestart;\n\n return $this;\n }\n\n /**\n * Get datestart\n *\n * @return \\DateTime\n */\n public function getDatestart()\n {\n return $this->datestart;\n }\n\n /**\n * Set dateend\n *\n * @param \\DateTime $dateend\n *\n * @return BudgetInstance\n */\n public function setDateend($dateend)\n {\n $this->dateend = $dateend;\n\n return $this;\n }\n\n /**\n * Get dateend\n *\n * @return \\DateTime\n */\n public function getDateend()\n {\n return $this->dateend;\n }\n\n /**\n * Set budgetmodele\n *\n * @param \\CDC\\CoreBundle\\Entity\\BudgetModele $budgetmodele\n *\n * @return BudgetInstance\n */\n public function setBudgetmodele(\\CDC\\CoreBundle\\Entity\\BudgetModele $budgetmodele = null)\n {\n $this->budgetmodele = $budgetmodele;\n\n return $this;\n }\n\n /**\n * Get budgetmodele\n *\n * @return \\CDC\\CoreBundle\\Entity\\BudgetModele\n */\n public function getBudgetmodele()\n {\n return $this->budgetmodele;\n }\n\n /**\n * Set seuil\n *\n * @param $seuil\n *\n * @return BudgetInstance\n */\n public function setSeuil($seuil)\n {\n $this->seuil= $seuil;\n\n return $this;\n }\n\n /**\n * Get seuil\n *\n * @return \\CDC\\CoreBundle\\Entity\\BudgetModele\n */\n public function getSeuil()\n {\n return $this->seuil;\n }\n\n /**\n * Set current value\n *\n * @param $value\n *\n * @return BudgetInstance\n */\n public function setCurrentvalue($value){\n $this->currentvalue = $value;\n\n return $this;\n }\n\n /**\n * Get current value\n *\n * @return float\n */\n public function getCurrentvalue(){\n return $this->currentvalue;\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":383,"cells":{"blob_id":{"kind":"string","value":"2ac3d248bc02341a180f8bd8d706e44e7f608ce2"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"hmimeee/article-management"},"path":{"kind":"string","value":"/functions/DB.func.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":10541,"string":"10,541"},"score":{"kind":"number","value":2.71875,"string":"2.71875"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"query($query);\n\tif ($result === true) {\n\t\t$messagetype = \"1\";\n\t} else {\n\t\t$messagetype = \"0\";\n\t}\n\t$message1 = $connect->error;\n\tmessage($message,$messagetype);\n}\n\n//Check if data and return result\nfunction select_data($query,$connect){\n\t$result = $connect->query($query);\n\treturn $result;\n}\n\n//Update data into a table\nfunction update_data($query,$connect,$message){\n\t$result = $connect->query($query);\n\tif ($result->num_rows > 0) {\n\t\treturn $result;\n\t}\n\tif ($result === true) {\n\t\t$messagetype = \"1\";\n\t} else {\n\t\t$messagetype = \"0\";\n\t}\n\t$message1 = $connect->error;\n\tmessage($message,$message1,$messagetype);\n}\n\n//Delete data and return message\nfunction delete_data($query,$connect,$message){\n\t$result = $connect->query($query);\n\tif ($result->num_rows > 0) {\n\t\treturn $result;\n\t}\n\tif ($result === true) {\n\t\t$messagetype = \"1\";\n\t} else {\n\t\t$messagetype = \"0\";\n\t}\n\t$message1 = $connect->error;\n\tmessage($message,$message1,$messagetype);\n}\n\n\nfunction get_users($connect){\n\t$sql = \"SELECT * FROM users ORDER BY id ASC\";\n\t$result = $connect->query($sql);\n\tif ($result->num_rows > 0) {\n\t\treturn $result;\n\t}\n}\n\nfunction get_user_data($connect,$id){\n\t$sql = \"SELECT * FROM users WHERE id=$id\";\n\t$result = $connect->query($sql);\n\tif ($result->num_rows > 0) {\n\t\treturn $result->fetch_assoc();\n\t}\n}\n\nfunction update_user_data($connect,$name,$email,$phone,$address,$payment_method,$payment_account,$fb_url,$twitter_url,$instagram_url,$picture,$id){\n\t$sql = \"UPDATE users SET name='$name',email='$email',phone='$phone',address='$address',payment_method='$payment_method',payment_account='$payment_account',fb_url='$fb_url',twitter_url='$twitter_url',instagram_url='$instagram_url',picture='$picture' WHERE id=$id\";\n\t$result = $connect->query($sql);\n\tif ($result === true) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\nfunction update_password($connect,$new,$id){\n\t$sql = \"UPDATE users SET password = '$new' WHERE id = '$id'\";\n\t$result = $connect->query($sql);\n\tif ($result === true) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\nfunction update_user($connect,$role,$quality,$rate,$id){\n\t$sql = \"UPDATE users SET role='$role',rate='$rate',quality='$quality' WHERE id = '$id'\";\n\t$result = $connect->query($sql);\n\tif ($result === true) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\nfunction delete_user($connect,$id){\n\t$sql = \"DELETE FROM users WHERE id='$id'\";\n\t$result = $connect->query($sql);\n\tif ($result === true) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\nfunction get_roles($connect){\n\t$sql = \"SELECT * FROM roles\";\n\t$result = $connect->query($sql);\n\tif ($result->num_rows > 0) {\n\t\treturn $result;\n\t}\n}\n\nfunction get_role_name($connect,$id){\n\t$sql = \"SELECT * FROM roles WHERE id=$id\";\n\t$rslt = $connect->query($sql);\n\t$result = $rslt->fetch_assoc();\n\tif ($rslt->num_rows > 0) {\n\t\treturn $result['name'];\n\t} else {\n\t\treturn \"No role found\";\n\t}\n}\n\nfunction get_projects($connect){\n\t//ORDER BY deadline ASC\n\t$sql = \"SELECT * FROM projects WHERE status='' OR status=0 OR status=1\";\n\t$result = $connect->query($sql);\n\t\treturn $result;\n}\n\nfunction get_project($connect,$id){\n\t$sql = \"SELECT * FROM projects WHERE id='$id'\";\n\t$result = $connect->query($sql);\n\tif ($result->num_rows > 0) {\n\t\treturn $result->fetch_assoc();\n\t} else {\n\t\treturn \"0\";\n\t}\n}\n\nfunction create_project($connect,$name,$description,$creator,$deadline,$created){\n\t$description = base64_encode($description);\n\t$sql = \"INSERT INTO projects VALUES ('','$name','$description','$creator','$deadline','$created',0)\";\n\t$result = $connect->query($sql);\n\tif ($result === true) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\nfunction update_project($connect,$name,$description,$deadline,$id){\n\t$description = base64_encode($description);\n\t$sql = \"UPDATE projects SET name='$name',description='$description',deadline='$deadline' WHERE id=$id\";\n\t$result = $connect->query($sql);\n\tif ($result === true) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\nfunction delete_project($connect,$id){\n\t$sql = \"DELETE FROM projects WHERE id=$id\";\n\t$result = $connect->query($sql);\n\tif ($result === true) {\n\t\treturn \"1\";\n\t} else {\n\t\treturn \"0\";\n\t}\n}\n\nfunction get_project_by_id($connect,$id){\n\t$sql = \"SELECT * FROM projects WHERE id=$id\";\n\t$result = $connect->query($sql);\n\tif ($result->num_rows > 0) {\n\t\treturn $result->fetch_assoc();\n\t} else {\n\t\treturn \"0\";\n\t}\n}\n\n\nfunction create_task($connect,$name,$description,$assignee,$creator,$words,$rate,$type,$project,$deadline,$publishing,$priority){\n\tif ($name ==\"\") {\n\t\treturn 0;\n\t} else {\n\t\t$description = base64_encode($description);\n\t\t$sql = \"INSERT INTO tasks (name,description,assignee,creator,words,rate,type,project,deadline,status,publishing,priority) VALUES ('$name','$description','$assignee','$creator','$words','$rate','$type','$project','$deadline',0,'$publishing','$priority')\";\n\t\t$result = $connect->query($sql);\n\t\tif ($result === true) {\n\t\t\treturn 1;\n\t\t} else {\n\t\t\treturn $connect->error;\n\t\t}\n\t}\n}\n\nfunction update_task($connect,$name,$description,$assignee,$creator,$words,$rate,$type,$project,$deadline,$publishing,$priority,$id){\n\t$description = base64_encode($description);\n\t$sql = \"UPDATE tasks SET name='$name', description='$description', assignee='$assignee', creator='$creator', words='$words', rate='$rate', type='$type', project='$project', deadline='$deadline', publishing='$publishing', priority='$priority' WHERE id=$id\";\n\t$result = $connect->query($sql);\n\tif ($result === true) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\nfunction update_task_payment($connect,$invoice,$status,$id){\n\t$sql = \"UPDATE tasks SET status=$status, invoice='$invoice' WHERE id=$id\";\n\t$result = $connect->query($sql);\n\tif ($result === true) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\nfunction get_tasks($connect,$status=0){\n\tif ($status ==0) {\n\t\t$sql = \"SELECT * FROM tasks ORDER BY deadline,priority DESC\";\n\t} else {\n\t\t$sql = \"SELECT * FROM tasks WHERE status='$status' ORDER BY deadline,priority DESC\";\n\t}\n\t$result = $connect->query($sql);\n\treturn $result;\n}\n\nfunction get_tasks_by_project($connect,$project){\n\t$sql = \"SELECT * FROM tasks WHERE project=$project ORDER BY deadline ASC,priority DESC\";\n\t$result = $connect->query($sql);\n\treturn $result;\n}\n\nfunction get_tasks_by_assignee($connect,$assignee,$status=0){\n\tif ($status ==0) {\n\t\t$sql = \"SELECT * FROM tasks WHERE (status='0' OR status='1') AND assignee=$assignee \";\n\t} else {\n\t\t$sql = \"SELECT * FROM tasks WHERE status='$status' AND assignee=$assignee\";\n\t}\n\t$result = $connect->query($sql);\n\treturn $result;\n}\n\nfunction get_tasks_by_creator($connect,$creator,$status=0){\n\tif ($status ==0) {\n\t\t$sql = \"SELECT * FROM tasks WHERE (status='0' OR status='1') AND creator=$creator\";\n\t} else {\n\t\t$sql = \"SELECT * FROM tasks WHERE status='$status' AND creator=$creator\";\n\t}\n\t$result = $connect->query($sql);\n\treturn $result;\n}\n\nfunction get_tasks_by_publisher($connect,$publisher,$status=0){\n\tif ($status ==0) {\n\t\t$sql = \"SELECT * FROM tasks WHERE (publish_status=0 OR publish_status=1) AND publisher=$publisher\";\n\t} else {\n\t\t$sql = \"SELECT * FROM tasks WHERE publish_status='$status' AND publisher=$publisher\";\n\t}\n\t$result = $connect->query($sql);\n\treturn $result;\n}\n\nfunction get_paid_tasks_number($connect,$assignee){\n\t$sql = \"SELECT * FROM tasks WHERE status=4 AND assignee=$assignee\";\n\t$result = $connect->query($sql);\n\treturn $result->num_rows;\n}\n\nfunction get_tasks_by_invoice($connect,$invoice){\n\t$sql = \"SELECT * FROM tasks WHERE status=4 AND invoice='$invoice'\";\n\t$result = $connect->query($sql);\n\t\treturn $result;\n}\n\nfunction get_task_data($connect,$id){\n\t$sql = \"SELECT * FROM tasks WHERE id=$id\";\n\t$result = $connect->query($sql);\n\tif ($result->num_rows > 0) {\n\t\treturn $result;\n\t}\n}\n\n\nfunction delete_task($connect,$id){\n\t$sql = \"DELETE FROM tasks WHERE id=$id\";\n\t$result = $connect->query($sql);\n\tif ($result === true) {\n\t\treturn \"1\";\n\t} else {\n\t\treturn \"0\";\n\t}\n}\n\nfunction delete_tasks($connect,$data){\n\tforeach($data as $key=>$value){\n \t\t\tif(\"id_\" == substr($key,0,3)){\n \t\t\t\t$number = \"id\".substr($key,strrpos($key,'_'));\n \t\t\t\t$sql = \"DELETE FROM tasks WHERE id=$_POST[$number]\";\n \t\t\t\t$batch = $connect->query($sql);\n \t\t\t}\n \t\t}\n}\n\nfunction create_invoice($connect,$name,$paid,$words,$paid_to){\n\t$sql = \"INSERT INTO invoice (name,paid,words,paid_to,creation_date) VALUES ('$name','$paid','$words','$paid_to',CURRENT_TIMESTAMP)\";\n\t$result = $connect->query($sql);\n\tif ($result === true) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\nfunction get_invoice_by_name($connect,$name){\n\t$sql = \"SELECT * FROM invoice WHERE name='$name'\";\n\t$result = $connect->query($sql);\n\tif ($result->num_rows > 0) {\n\t\treturn $result->fetch_assoc();\n\t} else {\n\t\treturn \"0\";\n\t}\n}\n\nfunction get_invoices($connect,$status=0){\n\tif ($status==0) {\n\t$sql = \"SELECT * FROM invoice\";\n} else {\n\t$sql = \"SELECT * FROM invoice WHERE status=$status\";\n}\n\t$result = $connect->query($sql);\n\t\treturn $result;\n}\n\nfunction get_invoices_by_user($connect,$id){\n\t$sql = \"SELECT * FROM invoice WHERE paid_to=$id\";\n\t$result = $connect->query($sql);\n\t\treturn $result;\n}\n\nfunction get_invoices_report($connect,$date){\n\t$sql = \"SELECT * FROM invoice WHERE status=1 AND paid_date LIKE '%$date%'\";\n\t$result = $connect->query($sql);\n\t\treturn $result;\n}\n\n\nfunction get_invoice_data($connect,$id){\n\t$sql = \"SELECT * FROM invoice WHERE id=$id\";\n\t$result = $connect->query($sql);\n\t\treturn $result->fetch_assoc();\n}\n\nfunction delete_invoice($connect,$id){\n\t$sql = \"DELETE FROM invoice WHERE id=$id\";\n\t$result = $connect->query($sql);\n\tif ($result===true) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\n\n//Comments\nfunction create_comment($connect,$comment_of,$creator,$comment,$file,$comment_type){\n\t$comment = base64_encode($comment);\n\t$sql = \"INSERT INTO comments (comment_of,creator,comment,file,type,creation_date) VALUES ('$comment_of','$creator','$comment','$file','$comment_type',CURRENT_TIMESTAMP)\";\n\t$result = $connect->query($sql);\n\tif ($result === true) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\nfunction get_all_comments($connect,$limit=10){\n\t$sql = \"SELECT * FROM comments ORDER BY id DESC LIMIT $limit\";\n\t$result = $connect->query($sql);\n\t\treturn $result;\n}\n\nfunction get_comments($connect,$comment_type,$comment_of){\n\t$sql = \"SELECT * FROM comments WHERE comment_of='$comment_of' AND type='$comment_type' ORDER BY id DESC\";\n\t$result = $connect->query($sql);\n\t\treturn $result;\n}\n\nfunction delete_comment($connect,$id){\n\t$sql = \"DELETE FROM comments WHERE id=$id\";\n\t$result = $connect->query($sql);\n\tif ($result === true) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\n?>"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":384,"cells":{"blob_id":{"kind":"string","value":"3e10617178a1e7e5e15a72a8963b0666b2e9d3fc"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"cosnicsTHLU/cosnics"},"path":{"kind":"string","value":"/src/Chamilo/Application/Weblcms/Tool/Implementation/Assignment/Table/Publication/PublicationTableCellRenderer.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":6751,"string":"6,751"},"score":{"kind":"number","value":2.515625,"string":"2.515625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"get_component()->get_content_object_from_publication($publication);\n \n switch ($column->get_name())\n {\n case ContentObject::PROPERTY_TITLE :\n return $this->generate_title_link($publication);\n case Assignment::PROPERTY_END_TIME :\n $time = $content_object->get_end_time();\n $date_format = Translation::get('DateTimeFormatLong', null, Utilities::COMMON_LIBRARIES);\n $time = DatetimeUtilities::format_locale_date($date_format, $time);\n if ($publication[ContentObjectPublication::PROPERTY_HIDDEN])\n {\n return '' . $time . '';\n }\n return $time;\n case Manager::PROPERTY_NUMBER_OF_SUBMISSIONS :\n $tracker = new \\Chamilo\\Application\\Weblcms\\Integration\\Chamilo\\Core\\Tracking\\Storage\\DataClass\\AssignmentSubmission();\n $condition = new EqualityCondition(\n new PropertyConditionVariable(\n \\Chamilo\\Application\\Weblcms\\Integration\\Chamilo\\Core\\Tracking\\Storage\\DataClass\\AssignmentSubmission::class_name(), \n \\Chamilo\\Application\\Weblcms\\Integration\\Chamilo\\Core\\Tracking\\Storage\\DataClass\\AssignmentSubmission::PROPERTY_PUBLICATION_ID), \n new StaticConditionVariable($publication[ContentObjectPublication::PROPERTY_ID]));\n \n return DataManager::count(\n \\Chamilo\\Application\\Weblcms\\Integration\\Chamilo\\Core\\Tracking\\Storage\\DataClass\\AssignmentSubmission::class_name(), \n new DataClassCountParameters($condition));\n case Assignment::PROPERTY_ALLOW_GROUP_SUBMISSIONS :\n if ($content_object->get_allow_group_submissions())\n {\n return 'getImagePath(\n 'Chamilo\\Application\\Weblcms\\Tool\\Implementation\\Assignment', \n 'Type/Group') . '\" alt=\"' . Translation::get('GroupAssignment') . '\" title=\"' .\n Translation::get('GroupAssignment') . '\"/>';\n }\n return 'getImagePath(\n 'Chamilo\\Application\\Weblcms\\Tool\\Implementation\\Assignment', \n 'Type/Individual') . '\" alt=\"' . Translation::get('IndividualAssignment') . '\" title=\"' .\n Translation::get('IndividualAssignment') . '\"/>';\n }\n \n return parent::render_cell($column, $publication);\n }\n\n /**\n * Generated the HTML for the title column, including link, depending on the status of the current browsing user.\n * \n * @param $publication type The publication for which the title link is to be generated.\n * @return string The HTML for the link in the title column.\n */\n private function generate_title_link($publication)\n {\n if ($this->get_component()->is_allowed(WeblcmsRights::EDIT_RIGHT))\n {\n return $this->generate_teacher_title_link($publication);\n }\n return $this->generate_student_title_link($publication);\n }\n\n /**\n * Generates the link applicable for the current browsing user being a teacher or admin.\n * \n * @param $publication type The publication for which the link is being generated.\n * @return string The HTML anchor elemnt that represents the link.\n */\n private function generate_teacher_title_link($publication)\n {\n $url = $this->get_component()->get_url(\n array(\n \\Chamilo\\Application\\Weblcms\\Tool\\Manager::PARAM_PUBLICATION_ID => $publication[ContentObjectPublication::PROPERTY_ID], \n \\Chamilo\\Application\\Weblcms\\Tool\\Manager::PARAM_ACTION => Manager::ACTION_BROWSE_SUBMITTERS));\n return '' .\n StringUtilities::getInstance()->truncate($publication[ContentObject::PROPERTY_TITLE], 50) . '';\n }\n\n /**\n * Generates the link applicable for the current browsing user being a student.\n * \n * @param $publication type The publication for which the link is being generated.\n * @return string The HTML anchor element that represents the link.\n */\n private function generate_student_title_link($publication)\n {\n $url = $this->get_component()->get_url(\n array(\n \\Chamilo\\Application\\Weblcms\\Tool\\Manager::PARAM_ACTION => Manager::ACTION_STUDENT_BROWSE_SUBMISSIONS, \n \\Chamilo\\Application\\Weblcms\\Tool\\Manager::PARAM_PUBLICATION_ID => $publication[ContentObjectPublication::PROPERTY_ID]));\n return '' .\n StringUtilities::getInstance()->truncate($publication[ContentObject::PROPERTY_TITLE], 50) . '';\n }\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":385,"cells":{"blob_id":{"kind":"string","value":"fc297c012bca9bb27d713f81ee958645f2fdc80b"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"bluegate010/ysaward"},"path":{"kind":"string","value":"/newpwd.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2868,"string":"2,868"},"score":{"kind":"number","value":2.5625,"string":"2.5625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":" Sorry, that is not a valid password reset token. Please go back to your email and try again?\");\n\n\t// Get the associated credentials ID...\n\t$row = mysql_fetch_array($r);\n\t$credID = $row['CredentialsID'];\n\tif (!$credID)\n\t\tdie(\"ERROR > That token doesn't seem associated with any account...\");\n\n\t// Make sure it hasn't expired; delete it if it has\n\t$tokenID = $row['ID'];\n\t$tooLate = strtotime(\"+48 hours\", strtotime($row['Timestamp']));\n\tif (time() > $tooLate)\n\t{\n\t\tDB::Run(\"DELETE FROM PwdResetTokens WHERE ID='$tokenID' LIMIT 1\");\n\t\tdie(\"ERROR > Sorry, that token has expired. They only last 48 hours.\");\n\t}\n}\n?>\n\n\n\t\n\t\tFinish password reset &mdash; <?php echo SITE_NAME; ?>\n\t\t\n\t\n\t\n\n\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\" alt=\"\" class=\"logo-big\">\n\t\t\t\t\n\n\t\t\t\t

Reset Password

\n\n\t\t\t\t

\n\t\t\t\t\tType your new password below, then try logging in.\n\t\t\t\t\tDon't use the same password you use on other sites.\n\t\t\t\t

\n\n\t\t\t\t\n\t\t\t\t\n\n\t\t\t\t\">\n\t\t\t\t\">\n\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\n\t\t\t
\n\t\t
\n\n\t\t\n\n\n\n\n\n\t\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":386,"cells":{"blob_id":{"kind":"string","value":"cddea5e2fabd97c3c049ae6f778159835a83a8ba"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"bitJun/vue-tb"},"path":{"kind":"string","value":"/h5/app/Model/Member.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":318,"string":"318"},"score":{"kind":"number","value":2.53125,"string":"2.53125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"table = $member_id ? 'member_'.($member_id % 100) : '';\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":387,"cells":{"blob_id":{"kind":"string","value":"f8c639eac54489cefcc6faf4d183ad40d8b478ca"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"jiangyu7408/notification"},"path":{"kind":"string","value":"/tests/unit/Storage/RedisStorageFactoryTest.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":797,"string":"797"},"score":{"kind":"number","value":2.515625,"string":"2.515625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["Unlicense"],"string":"[\n \"Unlicense\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"create($this->options, $prefix);\n static::assertInstanceOf(RedisStorage::class, $redisStorage);\n static::assertEquals($prefix, $redisStorage->getPrefix());\n }\n\n protected function setUp()\n {\n $this->options = [\n 'scheme' => 'tcp',\n 'host' => '127.0.0.1',\n 'port' => 6379,\n 'timeout' => 5.0\n ];\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":388,"cells":{"blob_id":{"kind":"string","value":"914e2d555422855fd273f97ceff646e9e1a0e7ee"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"steel1989/teste2"},"path":{"kind":"string","value":"/reporte_ok.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":7083,"string":"7,083"},"score":{"kind":"number","value":2.59375,"string":"2.59375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"query($sql);\r\n\t$fila = 7; //Establecemos en que fila inciara a imprimir los datos\r\n\t\r\n\t$gdImage = imagecreatefrompng('images/logo.png');//Logotipo\r\n\t\r\n\t//Objeto de PHPExcel\r\n\t$objPHPExcel = new PHPExcel();\r\n\t\r\n\t//Propiedades de Documento\r\n\t$objPHPExcel->getProperties()->setCreator(\"Ansony Martinez\")->setDescription(\"Relatorio de vendas\");\r\n\t\r\n\t//Establecemos la pestaña activa y nombre a la pestaña\r\n\t$objPHPExcel->setActiveSheetIndex(0);\r\n\t$objPHPExcel->getActiveSheet()->setTitle(\"Relatorio\");\r\n\t\r\n\t$objDrawing = new PHPExcel_Worksheet_MemoryDrawing();\r\n\t$objDrawing->setName('Logotipo');\r\n\t$objDrawing->setDescription('Logotipo');\r\n\t$objDrawing->setImageResource($gdImage);\r\n\t$objDrawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG);\r\n\t$objDrawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);\r\n\t$objDrawing->setHeight(100);\r\n\t$objDrawing->setCoordinates('A1');\r\n\t$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());\r\n\t\r\n\t$estiloTituloReporte = array(\r\n 'font' => array(\r\n\t'name' => 'Arial',\r\n\t'bold' => true,\r\n\t'italic' => false,\r\n\t'strike' => false,\r\n\t'size' =>13\r\n ),\r\n 'fill' => array(\r\n\t'type' => PHPExcel_Style_Fill::FILL_SOLID\r\n\t),\r\n 'borders' => array(\r\n\t'allborders' => array(\r\n\t'style' => PHPExcel_Style_Border::BORDER_NONE\r\n\t)\r\n ),\r\n 'alignment' => array(\r\n\t'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,\r\n\t'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER\r\n )\r\n\t);\r\n\t\r\n\t$estiloTituloColumnas = array(\r\n 'font' => array(\r\n\t'name' => 'Arial',\r\n\t'bold' => true,\r\n\t'size' =>10,\r\n\t'color' => array(\r\n\t'rgb' => 'FFFFFF'\r\n\t)\r\n ),\r\n 'fill' => array(\r\n\t'type' => PHPExcel_Style_Fill::FILL_SOLID,\r\n\t'color' => array('rgb' => '538DD5')\r\n ),\r\n 'borders' => array(\r\n\t'allborders' => array(\r\n\t'style' => PHPExcel_Style_Border::BORDER_THIN\r\n\t)\r\n ),\r\n 'alignment' => array(\r\n\t'horizontal'=> PHPExcel_Style_Alignment::HORIZONTAL_CENTER,\r\n\t'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER\r\n )\r\n\t);\r\n\t\r\n\t$estiloInformacion = new PHPExcel_Style();\r\n\t$estiloInformacion->applyFromArray( array(\r\n 'font' => array(\r\n\t'name' => 'Arial',\r\n\t'color' => array(\r\n\t'rgb' => '000000'\r\n\t)\r\n ),\r\n 'fill' => array(\r\n\t'type' => PHPExcel_Style_Fill::FILL_SOLID\r\n\t),\r\n 'borders' => array(\r\n\t'allborders' => array(\r\n\t'style' => PHPExcel_Style_Border::BORDER_THIN\r\n\t)\r\n ),\r\n\t'alignment' => array(\r\n\t'horizontal'=> PHPExcel_Style_Alignment::HORIZONTAL_CENTER,\r\n\t'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER\r\n )\r\n\t));\r\n\t\r\n\t$objPHPExcel->getActiveSheet()->getStyle('A1:E4')->applyFromArray($estiloTituloReporte);\r\n\t$objPHPExcel->getActiveSheet()->getStyle('A6:O6')->applyFromArray($estiloTituloColumnas);\r\n\t\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('B3', 'RELATORIO DE VENDAS');\r\n\t$objPHPExcel->getActiveSheet()->mergeCells('B3:D3');\r\n\t\r\n\t$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(10);\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('A6', 'cliente');\r\n\t$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(30);\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('B6', 'vendedor');\r\n\t$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(10);\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('C6', 'JAN');\r\n\t$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10);\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('D6', 'FEV');\r\n\t$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(10);\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('E6', 'MAR');\r\n\t$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(10);\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('E6', 'ABR');\r\n\t$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(10);\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('E6', 'MAI');\r\n\t$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(10);\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('E6', 'JUN');\r\n\t$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(10);\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('E6', 'JUL');\r\n\t$objPHPExcel->getActiveSheet()->getColumnDimension('J')->setWidth(10);\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('E6', 'AGOSTO');\r\n\t$objPHPExcel->getActiveSheet()->getColumnDimension('K')->setWidth(10);\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('E6', 'SET');\r\n\t$objPHPExcel->getActiveSheet()->getColumnDimension('L')->setWidth(10);\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('E6', 'OUT');\r\n\t$objPHPExcel->getActiveSheet()->getColumnDimension('N')->setWidth(10);\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('E6', 'NOV');\r\n\t$objPHPExcel->getActiveSheet()->getColumnDimension('M')->setWidth(10);\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('E6', 'DEZ');\r\n\t$objPHPExcel->getActiveSheet()->getColumnDimension('O')->setWidth(10);\r\n\t$objPHPExcel->getActiveSheet()->setCellValue('E6', 'TOTAL');\r\n\t//Recorremos los resultados de la consulta y los imprimimos\r\n\twhile($rows = $resultado->fetch_assoc()){\r\n\t\t\r\n\t\t$objPHPExcel->getActiveSheet()->setCellValue('A'.$fila, $rows['nome']);\r\n\t\t$objPHPExcel->getActiveSheet()->setCellValue('B'.$fila, $rows['nome']);\r\n\t\t$objPHPExcel->getActiveSheet()->setCellValue('C'.$fila, $rows['data']);\r\n\t\t$objPHPExcel->getActiveSheet()->setCellValue('D'.$fila, $rows['existencia']);\r\n\t\t$objPHPExcel->getActiveSheet()->setCellValue('E'.$fila, $rows['existencia']);\r\n\t\t$objPHPExcel->getActiveSheet()->setCellValue('F'.$fila, $rows['existencia']);\r\n\t\t$objPHPExcel->getActiveSheet()->setCellValue('G'.$fila, $rows['existencia']);\r\n\t\t$objPHPExcel->getActiveSheet()->setCellValue('H'.$fila, $rows['existencia']);\r\n\t\t$objPHPExcel->getActiveSheet()->setCellValue('I'.$fila, $rows['existencia']);\r\n\t\t$objPHPExcel->getActiveSheet()->setCellValue('J'.$fila, $rows['existencia']);\r\n\t\t$objPHPExcel->getActiveSheet()->setCellValue('K'.$fila, $rows['existencia']);\r\n\t\t$objPHPExcel->getActiveSheet()->setCellValue('L'.$fila, $rows['existencia']);\r\n\t\t$objPHPExcel->getActiveSheet()->setCellValue('N'.$fila, $rows['existencia']);\r\n\t\t$objPHPExcel->getActiveSheet()->setCellValue('M'.$fila, $rows['existencia']);\r\n\t\t$objPHPExcel->getActiveSheet()->setCellValue('O'.$fila, '=C'.$fila.'*D'.$fila);\r\n\t\t\r\n\t\t$fila++; //Sumamos 1 para pasar a la siguiente fila\r\n\t}\r\n\t\r\n\t\r\n\theader(\"Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\");\r\n\theader('Content-Disposition: attachment;filename=\"Productos.xlsx\"');\r\n\theader('Cache-Control: max-age=0');\r\n\t\r\n\t$writer->save('php://output');\r\n\t\r\n?>"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":389,"cells":{"blob_id":{"kind":"string","value":"4a7ec5e4fff0aeceaaad342953e915c81a6a496c"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"akilawww/blend_myself"},"path":{"kind":"string","value":"/database/seeds/RecipesTableSeeder.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2733,"string":"2,733"},"score":{"kind":"number","value":2.515625,"string":"2.515625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":" 'ジンバック',\n 'body' => 'さっぱりしていて美味しい',\n 'image' => '/storage/testdata/ジンバック.jpg',\n 'user_id' => 2,\n 'created_at' => Carbon::now()->subDays(32),\n 'updated_at' => Carbon::now()->subDays(32),\n ]);\n // recipe 2\n App\\Recipe::create([\n 'title' => 'ブラックルシアン',\n 'body' => 'めちゃ甘い',\n 'image' => '/storage/testdata/ブラックルシアン.jpg',\n 'user_id' => 1,\n 'created_at' => Carbon::now()->subDays(32),\n 'updated_at' => Carbon::now()->subDays(32),\n ]);\n // recipe 3\n App\\Recipe::create([\n 'title' => 'チャールストンソーダ',\n 'body' => '名前がオシャレ',\n 'image' => '/storage/testdata/チャールストンソーダ.jpg',\n 'user_id' => 1,\n 'created_at' => Carbon::now()->subDays(32),\n 'updated_at' => Carbon::now()->subDays(32),\n ]);\n // recipe 4\n App\\Recipe::create([\n 'title' => 'ジムハイボール',\n 'body' => '王道なハイボール',\n 'image' => '/storage/testdata/ジムハイボール.jpg',\n 'user_id' => 1,\n 'created_at' => Carbon::now()->subDays(32),\n 'updated_at' => Carbon::now()->subDays(32),\n ]);\n // recipe 5\n App\\Recipe::create([\n 'title' => 'グリーンアイズ',\n 'body' => '南国の風味がする夏向きカクテル。メロンリキュールとラムの香りのハーモニー、パイナップルの酸味とココナッツミルクの滑らかな口当たり。メロンリキュール界の革命児カワサキによる革新的(kawasaki SuperEdition)',\n 'image' => '/storage/testdata/グリーンアイズ.jpg',\n 'user_id' => 1,\n 'created_at' => Carbon::now()->subDays(32),\n 'updated_at' => Carbon::now(),\n ]);\n // recipe 6\n App\\Recipe::create([\n 'title' => 'カルーアミルク',\n 'body' => 'コーヒーミルクのようなカクテル',\n 'image' => '/storage/testdata/カルーアミルク.jpg',\n 'user_id' => 1,\n 'created_at' => Carbon::now()->subDays(32),\n 'updated_at' => Carbon::now(),\n ]);\n // recipe 7\n App\\Recipe::create([\n 'title' => 'アイスの実の革命',\n 'body' => 'カクテルカラフルで見ていて楽しくなります',\n 'image' => '/storage/testdata/ice.jpg',\n 'user_id' => 1,\n 'created_at' => Carbon::now()->subDays(32),\n 'updated_at' => Carbon::now()->subDays(32),\n ]);\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":390,"cells":{"blob_id":{"kind":"string","value":"c074ed1342f438297022888ef9988b3a600f069f"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"WangSHo/honghong"},"path":{"kind":"string","value":"/0115.php"},"src_encoding":{"kind":"string","value":"GB18030"},"length_bytes":{"kind":"number","value":1465,"string":"1,465"},"score":{"kind":"number","value":3.5625,"string":"3.5625"},"int_score":{"kind":"number","value":4,"string":"4"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"\n\";\nvar_dump($c);\necho \"
\";\nvar_dump($d);\necho \"
\";\nvar_dump($str);\necho \"
\";\nvar_dump($a);\necho \"
\";\n\n//ɱ\n$h=\"hello\";\n$$h=\"word\";\necho $h.$$h;\necho \"
\";\n\n//Ԥ\necho ($_SERVER['REMOTE_ADDR']);\necho \"
\";\necho ($_SERVER['REMOTE_PORT']);\necho \"
\";\n\n//ȫֱ global\n$a=123;\nfunction a(){\n global $a;\n echo $a;\n}\na();\n\n//̬\n/* function a(){\n\tstatic $i=0; // ̬\n\t$i+=1;\n\techo $i;\n}\nfor($i=0; $i<10;$i++){\n\ta();\n\n} */\necho \"
\";\n?>\n\n
\n \n \n \n
\n\n\";\n//\ndefine(\"ABC\", 100);\necho ABC;\necho \"
\";\n//define($name, $value,boool) boolΪtrueʱִСд\n\n//ϵͳеԤ峣\necho PHP_OS;\necho \"
\";\necho PHP_VERSION;\necho \"
\";\necho TRUE;\necho \"
\";\necho \"
\";\n\n\n//PHPеħ \necho __FILE__; //ǰļ\necho \"
\";\necho __LINE__; //ǰ \necho \"
\";\n?>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":391,"cells":{"blob_id":{"kind":"string","value":"92f01cdab5210707d90adb1fe38d9cd3fa8ee93b"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"creeartelo-desarrollo/SoundTube"},"path":{"kind":"string","value":"/application/models/Showroom_model.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1619,"string":"1,619"},"score":{"kind":"number","value":2.578125,"string":"2.578125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"load->database();\n }\n\n # Consulta videos del ShowRoom\n function CNS_Showroom(){\n $this->db->select(\"*\");\n $this->db->from(\"Showroom\"); \n $query = $this->db->get();\n return $query->result_array();\n }\n\n #\tInserta video en tabla\n function INS_Showroom($dataarray)\n {\n \t$this->db->insert(\"Showroom\",$dataarray);\n \treturn $this->db->insert_id();\n }\n\n # Actualiza video en tabla\n function UPD_Showroom($Id_Showroom, $dataarray)\n {\n $this->db->where(\"Id_Showroom\",$Id_Showroom);\n $this->db->update(\"Showroom\",$dataarray);\n return $this->db->affected_rows();\n }\n\n # Consulta que el Id_Video sea unico\n function CNS_UQVideo($Id_Video,$Id_Showroom){ \n $this->db->select(\"Id_Video\");\n $this->db->from(\"Showroom\");\n $this->db->where(\"Id_Video\",$Id_Video);\n if($Id_Showroom != \"\"){ \n $this->db->where(\"Id_Showroom !=\",$Id_Showroom);\n }\n return $this->db->count_all_results();\n }\n\n # Consulta un registro por su ID\n function CNS_ShowroomById($Id_Showroom){\n $this->db->select(\"*\");\n $this->db->from(\"Showroom\");\n $this->db->where(\"Id_Showroom\",$Id_Showroom);\n $query = $this->db->get();\n return $query->row();\n }\n\n # Elimina registro\n function DEL_Showroom($Id_Showroom){\n $this->db->where(\"Id_Showroom\",$Id_Showroom);\n $this->db->delete(\"Showroom\");\n return $this->db->affected_rows();\n }\n}\n?>"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":392,"cells":{"blob_id":{"kind":"string","value":"dd2262a22daf1b12e95862ee6bb824bdaef35a57"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"dscheinah/pwsafe"},"path":{"kind":"string","value":"/src/lib/sx/Container/Container.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1325,"string":"1,325"},"score":{"kind":"number","value":3.1875,"string":"3.1875"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"has($id)) {\n throw new NotFoundException(sprintf('%s: unable to get %s', \\get_class($this), $id));\n }\n return $this->stack[$id];\n }\n\n /**\n * Checks if a value was set for the given ID.\n *\n * @param string $id\n *\n * @return bool\n */\n public function has($id): bool\n {\n return isset($this->stack[$id]);\n }\n\n /**\n * Sets an arbitrary value for the given ID.\n *\n * @param string $id\n * @param mixed $value\n */\n public function set(string $id, $value): void\n {\n $this->stack[$id] = $value;\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":393,"cells":{"blob_id":{"kind":"string","value":"ef3dc32c1c5e03cf437acef5cb64cc0efd613fb1"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"efique/testunitaire"},"path":{"kind":"string","value":"/src/Product.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":737,"string":"737"},"score":{"kind":"number","value":3.359375,"string":"3.359375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"name = $name;\n $this->type = $type;\n $this->price = $price;\n }\n\n public function computeTva()\n {\n if($this->price < 0) {\n throw new LogicException('la tva et le prix ne peuvent pas être négatif');\n }\n if (self::FOOD_PRODUCT == $this->type) {\n return $this->price * 0.055;\n }\n\n return $this->price * 0.196;\n }\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":394,"cells":{"blob_id":{"kind":"string","value":"4f77c4316d7cff9d2a5bbfaaaa4f4616f7a803c1"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"turag/GOLAM-SHAFI-AFROZE-PORTFOLIO-"},"path":{"kind":"string","value":"/admin/changepassword.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2443,"string":"2,443"},"score":{"kind":"number","value":2.640625,"string":"2.640625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"\n
\n
\n
\n
\n
Change Password
\n \n
\" method=\"post\" class=\"form-group\">\n \n \n \n \n \n \n
\n \n
\n\n
\n
\n
\n
\n\n\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":395,"cells":{"blob_id":{"kind":"string","value":"9e9054ad9737df5209dc43b8dc865742daf98ab2"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"qrichert/goji"},"path":{"kind":"string","value":"/src/Admin/Controller/XhrInPageContentEditController.class.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1091,"string":"1,091"},"score":{"kind":"number","value":2.59375,"string":"2.59375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"m_app->getLanguages()->getCurrentCountryCode();\n\t\t$content = (string) $_POST['content'] ?? '';\n\n\t\tif (empty($action) || empty($contentId) || empty($pageId)) {\n\t\t\tHttpResponse::JSON([], false);\n\t\t}\n\n\t\tif ($action == 'get-formatted-content') {\n\n\t\t\tHttpResponse::JSON([\n\t\t\t\t'content' => InPageEditableContent::formatContent($content)\n\t\t\t], true);\n\n\t\t} else if ($action == 'save-content') {\n\n\t\t\t// string $contentId, string $pageId, string $locale = null\n\t\t\t$editableContent = new InPageEditableContent($this->m_app, $contentId, $pageId, $locale);\n\n\t\t\t$editableContent->updateContent($content);\n\n\t\t\tHttpResponse::JSON([\n\t\t\t\t'content' => $editableContent->getFormattedContent()\n\t\t\t], true);\n\t\t}\n\t}\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":396,"cells":{"blob_id":{"kind":"string","value":"f6be0888e2470876bdccab5168659a8db8fe5d6d"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"diasonti/online-auction"},"path":{"kind":"string","value":"/core/mandatoryAuth.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1139,"string":"1,139"},"score":{"kind":"number","value":2.703125,"string":"2.703125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":" $value) {\n if($name == \"Authorization\") {\n global $token;\n $token = mb_substr($value, 6);\n break;\n }\n}\n\nrequire_once(__DIR__.'/db.php');\nrequire_once(__DIR__.'/../data/repository/UserAccountRepository.php');\n\nfunction getUserByToken($token) {\n $decodedToken = base64_decode($token);\n $credentials = explode(':', $decodedToken);\n if(sizeof($credentials) != 2) {\n return null;\n }\n $email = $credentials[0];\n $password = $credentials[1];\n $userAccount = findUserAccountByEmail($email);\n if(!empty($userAccount) and $userAccount->password == $password) {\n return $userAccount;\n } else {\n return null;\n }\n}\n\nfunction accessDenied() {\n header('HTTP/1.0 403 Forbidden');\n echo 'Access denied';\n die();\n}\n\nfunction authenticate($token) {\n if(empty($token)) {\n var_dump($token);\n accessDenied();\n }\n $userAccount = getUserByToken($token);\n if(!empty($userAccount)) {\n $GLOBALS[\"user\"] = $userAccount;\n } else {\n accessDenied();\n }\n}\n\nauthenticate($token);\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":397,"cells":{"blob_id":{"kind":"string","value":"0acc9f7bd95a06764b754453490e4fc733a48df8"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"PacktPublishing/Modular-Programming-with-PHP7"},"path":{"kind":"string","value":"/Chapter06/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/ExpressionLanguage/DoctrineParserCache.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1036,"string":"1,036"},"score":{"kind":"number","value":2.625,"string":"2.625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT"],"string":"[\n \"MIT\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nnamespace Symfony\\Bridge\\Doctrine\\ExpressionLanguage;\n\nuse Doctrine\\Common\\Cache\\Cache;\nuse Symfony\\Component\\ExpressionLanguage\\ParsedExpression;\nuse Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheInterface;\n\n/**\n * @author Adrien Brault \n */\nclass DoctrineParserCache implements ParserCacheInterface\n{\n /**\n * @var Cache\n */\n private $cache;\n\n public function __construct(Cache $cache)\n {\n $this->cache = $cache;\n }\n\n /**\n * {@inheritdoc}\n */\n public function fetch($key)\n {\n if (false === $value = $this->cache->fetch($key)) {\n return;\n }\n\n return $value;\n }\n\n /**\n * {@inheritdoc}\n */\n public function save($key, ParsedExpression $expression)\n {\n $this->cache->save($key, $expression);\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":398,"cells":{"blob_id":{"kind":"string","value":"7579939a5bcf87bb05801507992a14f60c71a883"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"irpul/vip2"},"path":{"kind":"string","value":"/lib/database/database.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1783,"string":"1,783"},"score":{"kind":"number","value":3.109375,"string":"3.109375"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"db_dbname = $database;\r\n \t\tif ($server !== null) $this->db_host = $server;\r\n \t\tif ($username !== null) $this->db_user = $username;\r\n \t\tif ($password !== null) $this->db_pass = $password;\r\n \t\tif ($charset !== null) $this->db_charset = $charset;\r\n \t\t\r\n\t \tif (strlen($this->db_host) > 0 && strlen($this->db_user) > 0) {\r\n \t\t\tif ($connect) $this->Open($option);\r\n \t\t}\r\n \t\t\r\n \t}\r\n\r\n \tpublic function query($statement)\r\n \t{\r\n \t\t$this->last_query = $statement;\r\n \t\treturn parent::query($statement);\r\n \t}\r\n \tpublic function exec($statement)\r\n \t{\r\n \t\t$this->last_query = $statement;\r\n \t\treturn parent::exec($statement);\r\n \t}\r\n \t\r\n \tpublic function open($options) {\r\n \t\tparent::__construct ( \"mysql:host={$this->db_host};dbname={$this->db_dbname}\", $this->db_user, $this->db_pass, $options );\r\n \t\tparent::query(\"SET NAMES utf8\");\r\n \t\tparent::setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_BOTH);\r\n \t\tparent::setAttribute(PDO::ATTR_EMULATE_PREPARES, false);\r\n \t\tparent::setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\r\n \t}\r\n\t\r\n\t\r\n\tpublic function close_connection() {\r\n\t\tunset($this->connection);\r\n\t}\r\n\t\r\n}\r\n?>"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":399,"cells":{"blob_id":{"kind":"string","value":"bbd649ec23beec74b8dc51d039d07d9ca8104e41"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"ebaldizon/Puri1.0"},"path":{"kind":"string","value":"/Entities/Buy.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1719,"string":"1,719"},"score":{"kind":"number","value":3.203125,"string":"3.203125"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":[],"string":"[]"},"license_type":{"kind":"string","value":"no_license"},"text":{"kind":"string","value":"id = $id;\n $this->date = $date;\n $this->name = $name;\n $this->cart = $cart;\n $this->subTotal = $subTotal;\n $this->tax = $tax;\n $this->total = $total;\n }\n\n function getId()\n {\n return $this->id;\n }\n\n function setId($id)\n {\n $this->id = $id;\n }\n\n function getDate()\n {\n return $this->date;\n }\n\n function setDate($date)\n {\n $this->date = $date;\n }\n\n function getName()\n {\n return $this->name;\n }\n\n function setName($name)\n {\n $this->name = $name;\n }\n\n function getCart()\n {\n return $this->cart;\n }\n\n function setCart($cart)\n {\n $this->cart = $cart;\n }\n\n function getSubTotal()\n {\n return $this->subTotal = $subtotal;\n }\n\n function setSubtotal($subTotal)\n {\n $this->subTotal = $subTotal;\n }\n\n function getTax()\n {\n return $this->tax;\n }\n\n function setTax($tax)\n {\n $this->tax = $tax;\n }\n\n function getTotal()\n {\n return $this->total;\n }\n\n function setTotal($total)\n {\n $this->total = $total;\n }\n }\n?>"},"download_success":{"kind":"bool","value":true,"string":"true"}}}],"truncated":false,"partial":false},"paginationData":{"pageIndex":3,"numItemsPerPage":100,"numTotalItems":9914478,"offset":300,"length":100}},"jwt":"eyJhbGciOiJFZERTQSJ9.eyJyZWFkIjp0cnVlLCJwZXJtaXNzaW9ucyI6eyJyZXBvLmNvbnRlbnQucmVhZCI6dHJ1ZX0sImlhdCI6MTc1NjYyMzM2OCwic3ViIjoiL2RhdGFzZXRzL2hvbmdsaXU5OTAzL3N0YWNrX2VkdV9waHAiLCJleHAiOjE3NTY2MjY5NjgsImlzcyI6Imh0dHBzOi8vaHVnZ2luZ2ZhY2UuY28ifQ.iL8Iek9bRneqlWxc8G-DVApSIytxWG-nKE2frbV76FTk56Cu86MNwYGLV6x4wbXO9r1sResnNVC52-atNY4lCg","displayUrls":true},"discussionsStats":{"closed":0,"open":0,"total":0},"fullWidth":true,"hasGatedAccess":true,"hasFullAccess":true,"isEmbedded":false,"savedQueries":{"community":[],"user":[]}}">
blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
116
path
stringlengths
2
241
src_encoding
stringclasses
31 values
length_bytes
int64
14
3.6M
score
float64
2.52
5.13
int_score
int64
3
5
detected_licenses
listlengths
0
41
license_type
stringclasses
2 values
text
stringlengths
14
3.57M
download_success
bool
1 class
845c053f20cdaa9e1c70f50b901b6cb00a4122cd
PHP
juuhe/localhost
/lu/library/phpexcel/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php
UTF-8
2,087
2.796875
3
[]
no_license
<?php class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache { private $_fileHandle; private function _storeData() { $this->_currentObject->detach(); fseek($this->_fileHandle, 0, SEEK_END); $offset = ftell($this->_fileHandle); fwrite($this->_fileHandle, serialize($this->_currentObject)); $this->_cellCache[$this->_currentObjectID] = array('ptr' => $offset, 'sz' => ftell($this->_fileHandle) - $offset); $this->_currentObjectID = $this->_currentObject = NULL; } public function addCacheData($pCoord, PHPExcel_Cell $cell) { if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== NULL)) { $this->_storeData(); } $this->_currentObjectID = $pCoord; $this->_currentObject = $cell; return $cell; } public function getCacheData($pCoord) { if ($pCoord === $this->_currentObjectID) { return $this->_currentObject; } $this->_storeData(); if (!isset($this->_cellCache[$pCoord])) { return NULL; } $this->_currentObjectID = $pCoord; fseek($this->_fileHandle, $this->_cellCache[$pCoord]['ptr']); $this->_currentObject = unserialize(fread($this->_fileHandle, $this->_cellCache[$pCoord]['sz'])); $this->_currentObject->attach($this->_parent); return $this->_currentObject; } public function unsetWorksheetCells() { if (!is_null($this->_currentObject)) { $this->_currentObject->detach(); $this->_currentObject = $this->_currentObjectID = NULL; } $this->_cellCache = array(); $this->_parent = NULL; $this->__destruct(); } public function __construct(PHPExcel_Worksheet $parent, $memoryCacheSize = '1MB') { $memoryCacheSize = (isset($arguments['memoryCacheSize']) ? $arguments['memoryCacheSize'] : '1MB'); parent::__construct($parent); if (is_null($this->_fileHandle)) { $this->_fileHandle = fopen('php://temp/maxmemory:' . $memoryCacheSize, 'a+'); } } public function __destruct() { if (!is_null($this->_fileHandle)) { fclose($this->_fileHandle); } $this->_fileHandle = NULL; } } ?>
true
7ff769754be6b4d3d3f6cea41c9060b03d343c5d
PHP
DowebDomobile/cakephp-users-plugin
/src/View/Cell/AuthCell.php
UTF-8
1,629
2.59375
3
[ "MIT" ]
permissive
<?php /** * This file is part of the CakePHP(tm) Users plugin package. * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @copyright Copyright (c) DowebDomobile (http://dowebdomobile.ru) * @link https://github.com/DowebDomobile/cakephp-users-plugin CakePHP(tm) Users plugin project * @license http://www.opensource.org/licenses/mit-license.php MIT License */ namespace Dwdm\Users\View\Cell; use Cake\Controller\Component\AuthComponent; use Cake\View\Cell; /** * Auth cell */ class AuthCell extends Cell { /** * List of valid options that can be passed into this * cell's constructor. * * @var array */ protected $_validCellOptions = []; /** * Display user logged in or logged out menu. * * @param \Cake\Controller\Component\AuthComponent $Auth * @param array $options * @return void */ public function display(AuthComponent $Auth, array $options = []) { $this->template = $Auth->user() ? 'logout' : 'login'; $this->set(compact('Auth')); $this->set($options); } /** * Display menu if user logged in, * * @param \Cake\Controller\Component\AuthComponent $Auth * @param array $menu * @param array $options */ public function menu(AuthComponent $Auth, array $menu = [], array $options = []) { $this->set('menu', $Auth->user() ? $menu : []); $this->set(compact('Auth')); $this->set($options); } }
true
147d1e273531de884375e8aa24beb50c243ad827
PHP
derekdreery/group-office-templates
/netbeans/modelTemplate.php
UTF-8
2,725
2.703125
3
[ "MIT" ]
permissive
<?php <#assign licenseFirst = "/* "> <#assign licensePrefix = " * "> <#assign licenseLast = " */"> <#include "${project.licensePath}"> /** * The ${name} model * * @author ${user} */ class GO_${module?capitalize}_Model_${name} extends GO_Base_Db_ActiveRecord { /** * Returns a static model of itself * * @param String $className * @return GO_${module?capitalize}_Model_${name} */ public static function model($className = __CLASS__) { return parent::model($className); } /** * @return array An array of attributes for the model */ public function init() { // TODO set column properties e.g. $this->columns['date_start']['required']=true; parent::init(); } /** * @return the localized name of the model */ public function getLocalizedName() { return GO::t('${name?lower_case}', '${module?lower_case}'); } /** * @return string The name of the table in the db */ public function tableName() { return "${module?lower_case}_${name?lower_case}s"; } /** * @return array The relations to this model */ public function relations() { $rels = array(); // Insert relations here return array_merge(parent::relations(), $rels); } /** * @return array The defaults for this model */ public function defaultAtributes() { $attrs = array(); // Insert default attributes here return array_merge(parent::defaultAttributes(), $attrs); } /** * Get the cache attributes (identifiers for the models also * used for logging) * * @return array The name and description of the model */ public function getCacheAttributes() { return array( "name" => $this->id // TODO You will probably want to rewrite this ); } /** * Override this function to mutate attribute values on passthrough * * @param $name string The name of the attribute ($this->name) * @paramn $outputType {'formatted', 'raw'} Whether to format data or pass raw * * @return mixed The attribute specified by $name */ public function getAttribute($name, $outputType='formatted') { $output = parent::getAttribute($name, $outputType); // TODO Mutate attribute here if necessary return $output; } /** * Override this function to mutate attribute values before save, sister * function of getAttribute (except we don't call parent here as this function * is called from within save()) * * @return bool 'true' to proceed with db insert/update, false to bail out */ public function beforeSave() { return true; } // public functions // ================ //TODO put any extra public functions of the model data here // private utility functions // ========================= //TODO put any private functions used elsewhere in the model here }
true
e76f46eca6ea96caeb8b6f8d021f1f44cf565daf
PHP
ibouleroi/CakePHP
/app/Model/Client.php
UTF-8
1,247
2.53125
3
[]
no_license
<?php App::uses('AppModel', 'Model'); /** * Client Model * * @property Employee $Employee * @property Dette $Dette * @property Requette $Requette */ class Client extends AppModel { /** * Display field * * @var string */ public $displayField = 'nom'; //The Associations below have been created with all possible keys, those that are not needed can be removed /** * belongsTo associations * * @var array */ public $belongsTo = array( 'Employee' => array( 'className' => 'Employee', 'foreignKey' => 'employee_id', 'conditions' => '', 'fields' => '', 'order' => '' ) ); /** * hasMany associations * * @var array */ public $hasMany = array( 'Dette' => array( 'className' => 'Dette', 'foreignKey' => 'client_id', 'dependent' => false, 'conditions' => '', 'fields' => '', 'order' => '', 'limit' => '', 'offset' => '', 'exclusive' => '', 'finderQuery' => '', 'counterQuery' => '' ), 'Requette' => array( 'className' => 'Requette', 'foreignKey' => 'client_id', 'dependent' => false, 'conditions' => '', 'fields' => '', 'order' => '', 'limit' => '', 'offset' => '', 'exclusive' => '', 'finderQuery' => '', 'counterQuery' => '' ) ); }
true
0d179669fa87681e374ca3988d0f6c92f5fc5aac
PHP
reddevman/php
/resumen/resumenAvanzado.php
UTF-8
3,297
3.578125
4
[]
no_license
<?php // // POO básico // class nombreClase { private $propiedad1; private $propiedad2; public function __construct($parámetro1, $parámetro2) { $this->propiedad1 = $parámetro1; $this->propiedad2 = $parámetro2; } // SET public function setPropiedad1($parámetro1) { $this->propiedad1 = $parámetro1; } public function setPropiedad2($parámetro2) { $this->propiedad1 = $parámetro2; } // GET public function getPropiedad1() { return $this->propiedad1; } public function getPropiedad2() { return $this->propiedad2; } } $objeto = new nombreClase($parámetro1, $parámetro2); ?> <?php # Los TRAITS se usan para reutilizar código entre clases que compartan el mismo código, por ejemplo # con mensajes que se repiten o reutilizan # Declaración del trait trait mensajes { public function info($color) { echo "El color es $color."; } } class Coche { private $color; public function __construct($color) { $this->color = $color; } public function getColor() { return $this->color; } # De esta manera la clase podrá usar el trait cuando se le llame en la instancia. use mensajes; } class Moto { private $color; public function __construct($color) { $this->color = $color; } public function getColor() { return $this->color; } use mensajes; } $coche1 = new Coche('rojo'); $moto1 = new Moto('azul'); $coche1->info($coche1->getColor()); $moto1->info($moto1->getColor()); ?> <?php // // FORMULARIOS // # Comprobación de si está declarada la variable y no está vacía. if (isset($_POST["nombre"], $_POST["apellidos"]) && !empty($_POST["nombre"]) && !empty($_POST["apellidos"])) { } # Ejemplo de función que comprueba un valor mayor y que devuelve un array con 2 valores/posiciones function notaMasAlta($notaProgram, $notaEntornos, $notaLenguajes, $notaBBDD) { $mayor = $notaProgram; $nombre = 'Programación'; if ($notaEntornos > $mayor) { $mayor = $notaEntornos; $nombre = 'Entornos de Desarrollo'; } else if ($notaLenguajes > $mayor) { $mayor = $notaLenguajes; $nombre = 'Lenguajes de Marca'; } else if ($notaBBDD > $mayor) { $mayor = $notaBBDD; $nombre = 'Bases de Datos'; } else echo 'Todas las asignaturas tienen la misma nota.<br>'; return array($mayor, $nombre); } ?> <html> <!-- En un formulario se reciben los datos mediante las variables $_POST[] y $_GET[] usando los valores encontrados en las etiquetas name de html--> <!-- min y max para hacer un selector y step para controlar los pasos del selector --> <input type="number" name="notaprog" min="0" max="10" step=".5" class="form-control mb-2" title="Introduzca valores del 1 al 10"> <!-- Uso de pattern para limitar en el input lo que se debe introducir --> <input type="text" pattern="#[a-fA-F0-9]{6}" name="hexa" placeholder="#000000" value="#"> <select name="edad"> <option value="15-26">15-26 años</option> <option value="26-35">26-35 años</option> <option value="36-45">36-45 años</option> <option value="+46">Más de 46 años</option> </select> </html>
true
10e0b2f114d00eeb5cb51e192b635fd663d65db2
PHP
miniframework/mini
/cli/command/curd.class.php
UTF-8
5,280
2.625
3
[]
no_license
<?php class mini_cli_command_curd extends mini_cli_command { public $viewName = array("List","addview","modifyview"); public function run($args) { if(isset($args[0]) && $args[0]=='create' ) { if(isset($args[1]) && !empty($args[1])) { $modelPath = mini::getRunPath()."/models"; $modelFile = $args[1].".class.php"; $modelName = $args[1]; if(!file_exists($modelPath."/".$modelFile)) { echo "model file:$modelFile not exists."; return; } if(!class_exists($modelName)) { echo "model class:$modelName not exists."; return; } $controllerPath = mini::getRunPath()."/apps/admin"; $controllerFile = $modelName.".class.php"; if(file_exists($controllerPath."/".$controllerFile)) { echo "controller file: $controllerFile exists. delete first."; return; } $model = mini_db_model::model($modelName); if($this->confirm("Create a controller under '$controllerPath'?")) { $this->createController($model); $viewPath = mini::getRunPath()."/views/admin"; if(!is_dir($viewPath."/".$modelName)) { mkdir($viewPath."/".$modelName); } foreach($this->viewName as $name) { $createview = "create$name"; $this->$createview($model); } $this->addMenu($model); } } } else { echo $this->help(); } } public function addMenu($model) { $modelName = get_class($model); $viewPath = mini::getRunPath()."/views/admin/index"; $viewFile = "menu.view.php"; if(file_exists($viewPath."/".$viewFile)) { $menuTag = '<!-- {Mini-Crud-Menu} -->'; $menuView = file_get_contents($viewPath."/".$viewFile); $modelMenu = '<li><a href="<?php echo $this->createUrl("admin","'.$modelName.'","list");?>" target="main">'.$model->modelTag.'</a></li>'; $modelMenu .= "\r\n".$menuTag; $menuView = str_replace($menuTag, $modelMenu, $menuView); file_put_contents($viewPath."/".$viewFile,$menuView); echo "add model Menu successfull.\r\n"; } else { echo "Menu file not exists.\r\n"; return; } } public function createmodifyview($model) { $modelName = get_class($model); ob_start(); ob_implicit_flush(false); include dirname(__FILE__)."/view/modifyview.php"; $content = ob_get_clean(); $viewPath = mini::getRunPath()."/views/admin"; $viewFile = "modifyview.view.php"; $view = $viewPath."/".$modelName."/".$viewFile; if(file_exists($view)) { echo "view file: $viewFile exists. delete first.\r\n"; return; } file_put_contents($view, $content); echo $viewFile." view create successfull.\r\n"; } public function createaddview($model) { $modelName = get_class($model); ob_start(); ob_implicit_flush(false); include dirname(__FILE__)."/view/addview.php"; $content = ob_get_clean(); $viewPath = mini::getRunPath()."/views/admin"; $viewFile = "addview.view.php"; $view = $viewPath."/".$modelName."/".$viewFile; if(file_exists($view)) { echo "view file: $viewFile exists. delete first.\r\n"; return; } file_put_contents($view, $content); echo $viewFile." view create successfull.\r\n"; } public function createList($model) { $modelName = get_class($model); ob_start(); ob_implicit_flush(false); include dirname(__FILE__)."/view/list.php"; $content = ob_get_clean(); $viewPath = mini::getRunPath()."/views/admin"; $viewFile = "list.view.php"; $view = $viewPath."/".$modelName."/".$viewFile; if(file_exists($view)) { echo "view file: $viewFile exists. delete first.\r\n"; return; } file_put_contents($view, $content); echo $viewFile." view create successfull.\r\n"; } public function createController($model) { $modelName = get_class($model); ob_start(); ob_implicit_flush(false); include dirname(__FILE__)."/view/controller.php"; $content = ob_get_clean(); $controllerPath = mini::getRunPath()."/apps/admin"; $controllerFile = $modelName.".class.php"; file_put_contents($controllerPath."/".$controllerFile, $content); echo $modelName.".class.php controller create successfull.\r\n"; } public function help() { return <<<EOD USAGE curd create [model] DESCRIPTION create curd for model in apps/admin. EOD; } }
true
83415c484bcb15d31896065e699276e4474ad4f3
PHP
FirePanther/MyAlfredWorkflows
/zzz-includes-zzz/workflow.php
UTF-8
3,576
2.625
3
[]
no_license
<?php /** * @author FirePanther * @copyright FirePanther (http://firepanther.pro/) * @description workflow managing * @date 2014 * @version 1.0  */ $fp_items = array(); $fp_cache_data = array(); function add($return = '', $title = '', $text = '', $img = null, $cache = 1) { global $fp_items, $fp_cache_data; // default icon if ($img === null) $img = 'icon.png'; // cache if ($cache) $fp_cache_data[] = array($return, $title, $text, $img); if (strstr($return, '{title}')) $return = str_replace('{title}', $title, $return); if (strstr($return, '{text}')) $return = str_replace('{text}', $title, $return); $fp_items[] = array($return, $title, $text, $img); } function show($cacheName = '') { global $fp_items, $fp_cache_data; $items = []; foreach($fp_items as $item) { $icon = [ 'path' => $item[3], //'type' => 'default' ]; if (substr($icon['path'], 0, 9) == 'fileicon:' || substr($icon['path'], 0, 9) == 'filetype:') { list($type, $path) = explode(':', $icon['path'], 2); $type = 'default'; //$icon['type'] = $type; $icon['path'] = str_replace($_SERVER['HOME'].'/', '~/', $path); $item[2] = $icon['path']; } $items[] = [ 'arg' => $item[0], 'title' => $item[1], 'subtitle' => $item[2], 'icon' => $icon ]; } /* $echo = '<?xml version="1.0"?> <items>'; foreach($fp_items as $item) { $echo .= _getItem($item[0], $item[1], $item[2], $item[3]); } $echo .= '</items>'; */ echo json_encode(['items' => $items]); //_addCache($cacheName, $echo); } function _getItem($arg, $title, $subtitle, $icon, $extended = array()) { $iconAttr = ''; if (substr($icon, 0, 9) == 'fileicon:' || substr($icon, 0, 9) == 'filetype:') { $iconAttr = ' type="'.substr($icon, 0, strpos($icon, ':')).'"'; $icon = substr($icon, strpos($icon, ':')+1); } $xml = '<item arg="'.htmlspecialchars($arg).'" valid="yes">'. '<arg>'.htmlspecialchars($arg).'</arg>'. '<title>'.htmlspecialchars($title).'</title>'. '<subtitle>'.htmlspecialchars($subtitle).'</subtitle>'. '<icon'.$iconAttr.'>'.htmlspecialchars($icon).'</icon>'; if (count($extended)) { foreach ($extended as $key => $body) { if (is_array($body)) { if (isset($body['attr'])) $attr = ' '.$body['attr']; $body = $body['body']; } else $attr = ''; $xml .= '<'.$key.$attr.'>'.$body.'</'.$key.'>'; } } return $xml.'</item>'; } function _addCache($cacheName, $xml) { if ($cacheName) file_put_contents('/tmp/history.'.md5($cacheName).'.log', $xml); } function get_cache($cacheName) { $cache = '/tmp/history.'.md5($cacheName).'.log'; if (is_file($cache)) { echo file_get_contents($cache); exit; } } function icon($url, $ext = '', $filename = '', $override = 0) { $cache = '/tmp/'; if ($filename) $cache .= filename($filename); else $cache .= 'icon.'.md5($url); $cache .= $ext; if (!$filename && !$ext) $cache .= '.png'; if (!is_file($cache) || $override) { $fallback = 1; if ($url) { $img = @file_get_contents($url); if ($img) { @file_put_contents($cache, $img); $fallback = 0; } } if ($fallback) $cache = 'icon.png'; } return $cache; } function ignore_short($q, $chars = 3, $wait = 1) { if (strlen($q) < $chars) { add('', '"'.$q.'" enthält zu wenige Zeichen...'); show(); if ($wait) sleep($wait); exit; } } function showEmpty($title = '') { if ($title) add('', $title); else { $plist = file_get_contents('info.plist'); preg_match('~<key>description</key>\s*<string>(.*?)</string>~si', $plist, $m); add('', $m[1]); } show(); exit; }
true
e87926c7ea69610a65f68365301931c5ff5e057e
PHP
xerk/gp
/database/seeds/CitiesAndRegionsSeeder.php
UTF-8
1,216
2.59375
3
[]
no_license
<?php use App\Region; use Illuminate\Database\Seeder; use App\City; class CitiesAndRegionsSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { $collection = collect([ 'Haram', 'Fisal', 'Omranya', ]); $collectionCairo = collect([ 'El marg', 'El Salam', 'El Salam Owel', 'El Elnozha', 'ein Shams', 'Naser City', ]); City::create(['city' => 'Giza']); City::create(['city' => 'Cairo']); $city = City::where('city', 'Giza')->first(); $cairo = City::where('city', 'Cairo')->first(); $collection->each(function ($item, $key) use($city){ // create permissions for each collection item Region::create([ 'city_id' => $city->id, 'region' => $item]); }); $collectionCairo->each(function ($item, $key) use($cairo){ // create permissions for each collection item Region::create([ 'city_id' => $cairo->id, 'region' => $item]); }); } }
true
2ef86bad5ad449a66a07a7c528417482cc84a9de
PHP
SM-Net-Application/sm-net-project-4
/php/query/sp_q34.php
UTF-8
2,888
2.640625
3
[]
no_license
<?php // Get last circuit overseer weeks require_once dirname(__DIR__, 1) . '/config.php'; $database = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD, DB_DATABASE); mysqli_set_charset($database, 'utf8'); if (! $database) { $response["status"] = 4; $response["error"] = mysqli_connect_error(); } else { $query = "SELECT spWeekOvID, spInf1, spInf2, spInf3, spInf4, spInf5,"; $query .= "spInf6, spInf7, spInf8, spInf9, spInf10, spInf11, spInf12,"; $query .= "spInf13, spInf14, spInf15, spInf16, spInf17, spInf18, spInf19,"; $query .= "spInf20, spInf21, spInf22"; $query .= " FROM sp_week_ov"; $query .= " WHERE spInf20 = 0"; $query .= " ORDER BY spInf1 DESC"; $query .= " LIMIT 1"; $result = mysqli_query($database, $query); if (mysqli_num_rows($result) > 0) { $response["status"] = 0; $response["result"] = array(); while ($resultRow = $result->fetch_assoc()) { $resultRow = array_map("utf8_encode", $resultRow); $row = array(); $row["spWeekOvID"] = $resultRow["spWeekOvID"]; $row["spInf1"] = $resultRow["spInf1"]; $row["spInf2"] = $resultRow["spInf2"]; $row["spInf3"] = $resultRow["spInf3"]; $row["spInf4"] = $resultRow["spInf4"]; $row["spInf5"] = $resultRow["spInf5"]; $row["spInf6"] = $resultRow["spInf6"]; $row["spInf7"] = $resultRow["spInf7"]; $row["spInf8"] = $resultRow["spInf8"]; $row["spInf9"] = $resultRow["spInf9"]; $row["spInf10"] = $resultRow["spInf10"]; $row["spInf11"] = $resultRow["spInf11"]; $row["spInf12"] = $resultRow["spInf12"]; $row["spInf13"] = $resultRow["spInf13"]; $row["spInf14"] = $resultRow["spInf14"]; $row["spInf15"] = $resultRow["spInf15"]; $row["spInf16"] = $resultRow["spInf16"]; $row["spInf17"] = $resultRow["spInf17"]; $row["spInf18"] = $resultRow["spInf18"]; $row["spInf19"] = $resultRow["spInf19"]; $row["spInf20"] = $resultRow["spInf20"]; $row["spInf21"] = $resultRow["spInf21"]; $row["spInf22"] = $resultRow["spInf22"]; // Carico la riga nel risultato array_push($response["result"], $row); } } else { $response["status"] = 5; } $result->close(); mysqli_close($database); }
true
f197c9d984b231fcf5045feb3d48c4988841026a
PHP
Rondesignlab/Rondesignlab.github.io
/html-video/send-form-email.php
UTF-8
1,506
2.734375
3
[]
no_license
<?php require_once('config.php'); if(isset($_POST['email'])) { $error_text = 'Oops! Sorry! But something happened with our server.'; $success_text = 'Thank you! Your message has been sent successfully'; function send_request($data, $error = false){ $return = array( 'error' => $error, 'message' => $data ); echo json_encode($return); die(); } function clean_string($string) { $bad = array("content-type", "bcc:", "to:", "cc:", "href"); return str_replace($bad, "", $string); } if(!isset($_POST['name']) || !isset($_POST['email']) || !isset($_POST['message'])) { send_request($error_text, true); } $name = $_POST['name']; // required $email_from = $_POST['email']; // required $message = $_POST['message']; // required $subject = 'Message from site form'; $email_message = "Form details below.\n\n"; $email_message .= "Name: ".clean_string($name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "Comment: ".clean_string($message)."\n"; $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); $return_value = @mail($email_to, $email_subject, $email_message, $headers); if($return_value){ send_request($success_text); } else { send_request($error_text); } } ?>
true
82ef7dc64d3fe9fae55a3c1acc084fbae25d1fb8
PHP
Truke/studymi
/database/migrations/2017_06_19_090049_create_comment_table.php
UTF-8
1,240
2.515625
3
[ "MIT" ]
permissive
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateCommentTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('comment', function(Blueprint $table){ $table->increments('id')->comment('评论id'); $table->integer('member_id')->index()->comment('用户id'); $table->integer('p_id')->index()->comment('商品id'); $table->string('content')->comment('评论内容'); $table->string('images')->comment('评论图片路径'); $table->tinyInteger('star')->default(0)->comment(',默认0代表好评,1为中评,2为差评'); $table->tinyInteger('is_hide')->default(0)->comment('是否匿名,默认0为匿名,1为显示用户名'); $table->tinyInteger('type')->comment('评论类型,0为首次评价,1为追加,2为回复'); $table->timestamps(); $table->charset='utf8'; $table->engine='InnoDB'; }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('comment'); } }
true
618a6f3cc72b6666260833737ca078c78eebb7b5
PHP
htmlacademy-php/426679-doingsdone-12
/auth.php
UTF-8
1,300
2.640625
3
[]
no_license
<?php /** *Страница проверки авторизации * */ require_once('templates/functions.php'); $link = conect(); $errors = []; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $form = $_POST; $required = ['email', 'password']; foreach ($required as $field) { if (empty($form[$field])) { $errors[$field] = 'Это поле надо заполнить'; } } if (!empty($form['email'])) { $email = mysqli_real_escape_string($link, $form['email']); } else { $email = null; } if (filter_var($email, FILTER_VALIDATE_EMAIL)) { $passwordHash = password_hash($_POST['password'], PASSWORD_DEFAULT); $sql = "SELECT * FROM users WHERE email = '$email'"; $result = mysqli_query($link, $sql); $user = $result ? mysqli_fetch_array($result, MYSQLI_ASSOC) : null; if ($user) { if (password_verify($form['password'], $user['password'])) { $_SESSION['user'] = $user; header("Location: index.php"); exit(); } } else { $errors['email'] = 'Email не существует'; } } else { $errors['email'] = 'Проверьте написание Email'; } } auth($errors);
true
574b584ad24d2b50a30714e70256662d1cd1bd8f
PHP
Rayyyyyyyyyyyyyyyyyyyy/php
/20201105/string2.php
UTF-8
583
3.921875
4
[]
no_license
<?php $var1="John"; $var2="John"; echo strcmp($var1, $var2)."<br>"; echo "比較字串 兩個一樣會0 不一樣就1"."<br>"; if($var1 ==$var2){ echo "yes"; }else{ echo "no"; } echo "<br>"; $string="Samantha"; echo substr($string,5)."<br>"; echo "拆解字串,數字代表第幾個開始往後"."<br>"; echo substr($string,-4)."<br>"; echo "拆解字串,數字代表往前到第幾個"."<br>"; echo substr($string, 5 ,3)."<br>"; echo "拆解字串,第一個數字代表第幾個開始 第二個數字是抓幾個,第一個數字的位子的不會算"."<br>";
true
e37037d1de26c336c4e6c7a275cb92db36fc12d5
PHP
JorgitoPaiva/terracap
/fontes/protected/components/Controller.php
UTF-8
3,012
2.671875
3
[]
no_license
<?php /** * Controller is the customized base controller class. * All controller classes for this application should extend from this base class. */ class Controller extends CController { /** * @var string the default layout for the controller view. Defaults to '//layouts/column1', * meaning using a single column layout. See 'protected/views/layouts/column1.php'. */ public $layout = '//layouts/main-'; //'//layouts/column1'; /** * @var array context menu items. This property will be assigned to {@link CMenu::items}. */ public $menu = array(); /** * @var array the breadcrumbs of the current page. The value of this property will * be assigned to {@link CBreadcrumbs::links}. Please refer to {@link CBreadcrumbs::links} * for more details on how to specify this property. */ public $breadcrumbs = array(); /** * @var string the default TbButtonColumn for the TbGridView. * Show buttons Edit, Delete anda View */ public $gridViewTemplate = '{update}{delete}{view}'; /** * * @var string the base path for register JavaScript and CSS files */ public $baseUrl = ''; /** * * @var string the theme name for render layout */ public $themeName = ''; /** * * @param type $action */ protected function beforeAction($action) { $this->baseUrl = Yii::app()->theme->baseUrl; $this->pageTitle = Yii::app()->name; return parent::beforeAction($action); } /** * @param string $id id of this controller * @param CWebModule $module the module that this controller belongs to. */ public function __construct($id, $module = NULL) { $this->themeName = Yii::app()->theme->name; $this->layout .= $this->themeName; parent::__construct($id, $module); } /** * Permissions validate from RBAC. * @param string the controller to be validated */ public function validationAccessRules($nameController) { $rbac = Usuario::rbac($nameController); // deny authenticated user to all actions $acesso = array('deny', 'actions' => array('*'), 'users' => array('@'),); switch ($rbac) { case '01': // Completo $this->gridViewTemplate = '{update}{delete}{view}'; $acesso = array('allow', 'actions' => array('index', 'create', 'update', 'delete', 'view'), 'users' => array('@'),); break; case '02': // Edição $this->gridViewTemplate = '{update}{view}'; $acesso = array('allow', 'actions' => array('index', 'create', 'update', 'view'), 'users' => array('@'),); break; case '03': // Leitura $this->gridViewTemplate = '{view}'; $acesso = array('allow', 'actions' => array('index', 'view'), 'users' => array('@'),); break; } return $acesso; } }
true
92151452c3c9ab63577e3aff1d435b1dae2df948
PHP
AURELIO2154715/req_app_design
/request_app JL/dashboard/request_form.php
UTF-8
3,374
2.640625
3
[]
no_license
<?php include '../shared/session.php'; include '../shared/connection.php'; if(isset($_POST['addrequest'])){ $user_id = $_SESSION['user_id']; $request_status = 'pending'; $user_of_item = $_POST['reason']; $date_needed = $_POST['date_needed']; $quantity = $_POST['quantity']; $items = $_POST['item']; $request = "INSERT INTO request_form (requested_by,request_status,use_of_item,date_needed,created_at,updated_at) VALUES ('$user_id','$request_status','$user_of_item','$date_needed',now(),now())"; $requestQuery = mysqli_query($conn,$request); if($requestQuery){ //get inserted id $request_form_id = mysqli_insert_id($conn); //loop on items to be saved on database for ($i=0; $i < count($quantity); $i++) { # query // echo $items[$i] . '<br>'; $item = "INSERT INTO items (quantity,description,request_form_id,created_at,updated_at) VALUES ('$quantity[$i]','$items[$i]','$request_form_id',now(),now())"; $itemQuery = mysqli_query($conn,$item); if($itemQuery){ //why ngay }else{ echo "Error: " + $item . mysqli_error($conn); } } //redirect after loop header("Location: home.php"); die(); }else{ echo "Error: " . $request . mysqli_error($conn); } } ?> <!DOCTYPE html> <html> <head> <title>Request Form</title> </head> <body> <a href="../shared/logout.php" style="float:right">Logout</a> <div> <h1>Request Form</h1> <a href="home.php">Back to Home</a> <form method="POST" action="request_form.php"> <table border="1"> <thead> <tr> <th>Quantity</th> <th>Item</th> <th>Action</th> </tr> </thead> <tbody id="items"> <tr> <td><input type="text" name="quantity[]"></td> <td><input type="text" name="item[]"></td> <td><button type="button" onclick="event.srcElement.parentElement.parentElement.remove()" class="remove">X</button></td> </tr> </tbody> </table> <button type="button" class="addItem" onclick="addItem()">Add another Item</button><br> Use of Item: <br><textarea name="reason" rows="4" cols="50"></textarea><br> Date needed: <input type="date" name="date_needed"><br> <input type="submit" name="addrequest" value="Submit Request"> </form> </div> </body> <script type="text/javascript"> (function() { // your page initialization code here // the DOM will be available here })(); function addItem(){ var quantity = document.createElement('input'); quantity.setAttribute('type','text'); quantity.setAttribute('name','quantity[]'); var item = document.createElement('input'); item.setAttribute('type','text'); item.setAttribute('name', 'item[]'); var removeBtn = document.createElement('button'); var textnode = document.createTextNode('X'); removeBtn.appendChild(textnode); removeBtn.setAttribute('type','button'); removeBtn.setAttribute('onclick','event.srcElement.parentElement.parentElement.remove()'); var quantityTD = document.createElement('td'); quantityTD.appendChild(quantity); var itemTD = document.createElement('td'); itemTD.appendChild(item); var btnTd = document.createElement('td'); btnTd.appendChild(removeBtn); var row = document.createElement('tr'); row.appendChild(quantityTD); row.appendChild(itemTD); row.appendChild(btnTd); var tablebody = document.getElementById('items'); tablebody.appendChild(row); } </script> </html>
true
8919c5d615ce5afee948f795aff5778d3834a10a
PHP
mindthanizz/freshonefood
/fresh_database/create/ordersdetail_table.php
UTF-8
666
2.703125
3
[]
no_license
<?php require "fresh_database.php"; $conn = mysqli_connect($servername, $username, $password, $dbname); if (!$conn) { die("Connection failed: ".mysqli_connect_error()); } $sql = "CREATE TABLE OrdersDetail ( orderId INT(6), productId INT(6), quantity INT(4) NOT NULL, totalPrice INT(10) NOT NULL, CONSTRAINT FK_OrdersDetail FOREIGN KEY (orderId) REFERENCES Orders(orderId), CONSTRAINT FK_ProductOrdersDetail FOREIGN KEY (productId) REFERENCES Product(productId) )"; if (mysqli_query($conn, $sql)) { echo "Table OrdersDetail created successfully"; } else { echo "Error creating table: ".mysqli_error($conn); } mysqli_close($conn); ?>
true
c4dca0013fd3886375c0bae319e8cd49f7b56dec
PHP
pssubashps/image-organizer
/imagemove.php
UTF-8
2,800
2.8125
3
[ "MIT" ]
permissive
<?php $dir = "myim"; $movDir = "myphoto"; echo "\n Read all the Image from DIR\n"; echo "*********************************\n\n"; $dir = readline("Input Folder Name : "); $movDir = readline("Output Folder Name : "); $files1 = scandir($dir); array_shift($files1); array_shift($files1); $totalImages = count($files1); $completedItems = 0; echo "Total Items Found ". $totalImages; echo "\n\n"; if ($totalImages > 0) { foreach ($files1 as $file) { $fileDetails = @exif_read_data($dir . "/" . $file); if(!$fileDetails) { echo "Not able to read image property\n\n"; $completedItems++; show_status($completedItems,$totalImages); continue; } // print_r($fileDetails);exit; $dt = new DateTime(); $dt->setTimestamp($fileDetails['FileDateTime']); $ext = pathinfo($dir . "/" . $file, PATHINFO_EXTENSION); $Yeardir = $dt->format('Y'); $monthdir = $dt->format('M'); $daydir = $dt->format('d'); if (! file_exists("$movDir/" . $Yeardir)) { mkdir("$movDir/" . $Yeardir, 0777); } if (! file_exists("$movDir/" . $Yeardir . "/$monthdir")) { mkdir("$movDir/" . $Yeardir . "/$monthdir", 0777); } if (! file_exists("$movDir/" . $Yeardir . "/$monthdir/$daydir")) { mkdir("$movDir/" . $Yeardir . "/$monthdir/$daydir", 0777); } $photoDir = $Yeardir . "/$monthdir/$daydir"; If (copy("$dir/" . $fileDetails['FileName'], "$movDir/" . $photoDir . "/" . $dt->format('d_F_H_i_s') . "_" . $fileDetails['FileName'])) { // unlink($dir . "/" . $file); } //print "\n\n" . $dt->format('j_M_Y_H_i_s'); $completedItems++; show_status($completedItems,$totalImages); } } function show_status($done, $total, $size=30) { static $start_time; // if we go over our bound, just ignore it if($done > $total) return; if(empty($start_time)) $start_time=time(); $now = time(); $perc=(double)($done/$total); $bar=floor($perc*$size); $status_bar="\r["; $status_bar.=str_repeat("=", $bar); if($bar<$size){ $status_bar.=">"; $status_bar.=str_repeat(" ", $size-$bar); } else { $status_bar.="="; } $disp=number_format($perc*100, 0); $status_bar.="] $disp% $done/$total"; $rate = ($now-$start_time)/$done; $left = $total - $done; $eta = round($rate * $left, 2); $elapsed = $now - $start_time; $status_bar.= " remaining: ".number_format($eta)." sec. elapsed: ".number_format($elapsed)." sec."; echo "$status_bar "; flush(); // when done, send a newline if($done == $total) { echo "\n"; } }
true
b5a6c67be2056666194134068a2b52e76755fe9f
PHP
fauzanhamzah/invoice-manager
/app/Http/Controllers/CustomerController.php
UTF-8
5,026
2.546875
3
[ "MIT" ]
permissive
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Customer; class CustomerController extends Controller { function __construct() { $this->middleware('auth'); $this->middleware('permission:customer-list|customer-create|customer-edit|customer-delete', ['only' => ['index', 'store']]); $this->middleware('permission:customer-create', ['only' => ['create', 'store']]); $this->middleware('permission:customer-edit', ['only' => ['edit', 'update']]); $this->middleware('permission:customer-delete', ['only' => ['destroy']]); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $customers = Customer::orderBy('id', 'DESC')->get(); return view('customers.index', compact('customers')); } public function indexlist() { $customers = Customer::orderBy('id', 'DESC')->get(); return view('customers.indexlist', compact('customers')); } public function view(Customer $customer) { return view('customers.view', compact('customer')); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { return view('customers.create'); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $request->validate([ 'name' => 'required|string', 'addressline1' => 'required|string', 'town' => 'required|string', 'zipcode' => 'required|integer', 'phone' => 'required|string', 'email' => 'required|string' ]); if (Customer::create($request->all())) { $request->session()->flash('success', ' Customer has been Added!'); } else { $request->session()->flash('error', ' There was an error adding the customer!'); } // Customer::create($request->all()); return redirect('/customers'); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Customer $customer) { return view('customers.edit', compact('customer')); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, Customer $customer) { $request->validate([ 'name' => 'required|string', 'addressline1' => 'required|string', 'town' => 'required|string', 'zipcode' => 'required|integer', 'phone' => 'required|string', 'email' => 'required|string' ]); if (Customer::where('id', $customer->id) ->update([ 'name' => $request->name, 'addressline1' => $request->addressline1, 'addressline2' => $request->addressline2, 'town' => $request->town, 'zipcode' => $request->zipcode, 'phone' => $request->phone, 'fax' => $request->fax, 'email' => $request->email ]) ) { $request->session()->flash('success', $customer->name . ' has been Updated!'); } else { $request->session()->flash('error', ' There was an error updating! ' . $customer->name); } // Customer::where('id', $customer->id) // ->update([ // 'name' => $request->name, // 'addressline1' => $request->addressline1, // 'addressline2' => $request->addressline2, // 'town' => $request->town, // 'zipcode' => $request->zipcode, // 'phone' => $request->phone, // 'fax' => $request->fax, // 'email' => $request->email // ]); return redirect('/customers'); } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy(Customer $customer, Request $request) { if (Customer::destroy($customer->id)) { $request->session()->flash('success', $customer->name . ' has been deleted!'); } else { $request->session()->flash('error', ' There was an error deleting! ' . $customer->name); } // Customer::destroy($customer->id); return redirect('/customers'); } }
true
2d3ddfacfa36b7bf8e9898d11fbe6a0d225cdf97
PHP
robyfirnandoyusuf/DataStructures
/DataStructures/Trees/Traits/CountTrait.php
UTF-8
285
3.140625
3
[ "MIT" ]
permissive
<?php namespace DataStructures\Trees\Traits; trait CountTrait { /** * Binds to count() method. This is equal to make $this->tree->size(). * * @return integer the tree size. 0 if it is empty. */ public function count() { return $this->size; } }
true
4db84f616f733fc25584dfb88c5a4a0160aa5b4e
PHP
KEVINYZY1/Algorithm-11
/src/Algorithm.php
UTF-8
6,992
2.84375
3
[ "Apache-2.0" ]
permissive
<?php /** * Created by PhpStorm. * User: frowhy * Date: 2017/4/4 * Time: 04:14 * *_______________%%%%%%%%%_______________________ *______________%%%%%%%%%%%%_____________________ *______________%%%%%%%%%%%%%____________________ *_____________%%__%%%%%%%%%%%___________________ *____________%%%__%%%%%%_%%%%%__________________ *____________%%%_%%%%%%%___%%%%_________________ *___________%%%__%%%%%%%%%%_%%%%________________ *__________%%%%__%%%%%%%%%%%_%%%%_______________ *________%%%%%___%%%%%%%%%%%__%%%%%_____________ *_______%%%%%%___%%%_%%%%%%%%___%%%%%___________ *_______%%%%%___%%%___%%%%%%%%___%%%%%%_________ *______%%%%%%___%%%__%%%%%%%%%%%___%%%%%%_______ *_____%%%%%%___%%%%_%%%%%%%%%%%%%%__%%%%%%______ *____%%%%%%%__%%%%%%%%%%%%%%%%%%%%%_%%%%%%%_____ *____%%%%%%%__%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%____ *___%%%%%%%__%%%%%%_%%%%%%%%%%%%%%%%%_%%%%%%%___ *___%%%%%%%__%%%%%%_%%%%%%_%%%%%%%%%___%%%%%%___ *___%%%%%%%____%%__%%%%%%___%%%%%%_____%%%%%%___ *___%%%%%%%________%%%%%%____%%%%%_____%%%%%____ *____%%%%%%________%%%%%_____%%%%%_____%%%%_____ *_____%%%%%________%%%%______%%%%%_____%%%______ *______%%%%%______;%%%________%%%______%________ *________%%_______%%%%________%%%%______________ */ namespace Frowhy\Algorithm; class Algorithm { public static function quickSort($arr) { if (! is_array($arr)) { return false; } $len = count($arr); if ($len <= 1) { return $arr; } $left = $right = []; for ($i = 1; $i < $len; $i++) { if ($arr[$i] < $arr[0]) { $left[] = $arr[$i]; } else { $right[] = $arr[$i]; } } $left = self::quickSort($left); $right = self::quickSort($right); return array_merge($left, [$arr[0]], $right); } static function array_swap($arr, $l, $r) { $arr[$l] = $arr[$l] ^ $arr[$r]; $arr[$r] = $arr[$l] ^ $arr[$r]; $arr[$l] = $arr[$l] ^ $arr[$r]; return $arr; } public static function bubbleSort($arr) { if (! is_array($arr)) { return false; } $len = count($arr); if ($len <= 1) { return $arr; } for ($i = 1; $i < $len; $i++) { $max_j = $len - $i; for ($j = 0; $j < $max_j; $j++) { if ($arr[$j] > $arr[$j + 1]) { $arr = self::array_swap($arr, $j, $j + 1); } } } return $arr; } public static function selectionSort($arr) { if (! is_array($arr)) { return false; } $len = count($arr); if ($len <= 1) { return $arr; } for ($i = 0; $i < $len; $i++) { $min_i = $arr[$i]; $index = $i; $min_j = $i + 1; for ($j = $min_j; $j < $len; $j++) { if ($arr[$j] < $min_i) { $min_i = $arr[$j]; $index = $j; } } if ($i < $index) { $arr = self::array_swap($arr, $i, $index); } } return $arr; } public static function insertionSort($arr) { if (! is_array($arr)) { return false; } $len = count($arr); if ($len <= 1) { return $arr; } for ($i = 0; $i < $len; $i++) { $pre_i = $i - 1; $current = $arr[$i]; while ($pre_i >= 0 && $arr[$pre_i] > $current) { $arr[$pre_i + 1] = $arr[$pre_i]; $pre_i -= 1; } $arr[$pre_i + 1] = $current; } return $arr; } public static function shellSort($arr) { if (! is_array($arr)) { return false; } $len = count($arr); if ($len <= 1) { return $arr; } $gap = 1; $pre_i = $len / 3; while ($gap < $pre_i) { $gap = $gap * 3 + 1; } while ($gap > 0) { for ($i = 0; $i < $len; $i++) { $temp = $arr[$i]; $j = $i - $gap; while ($j >= 0 and $arr[$j] > $temp) { $arr[$j + $gap] = $arr[$j]; $j -= $gap; } $arr[$j + $gap] = $temp; } $gap = floor($gap / 3); } return $arr; } public static function mergeSort(&$arr) { if (! is_array($arr)) { return false; } $len = count($arr); if ($len <= 1) { return $arr; } $mid = $len >> 1; $left = array_slice($arr, 0, $mid); $right = array_slice($arr, $mid); static::mergeSort($left); static::mergeSort($right); if (end($left) <= $right[0]) { $arr = array_merge($left, $right); } else { for ($i = 0, $j = 0, $k = 0; $k <= $len - 1; $k++) { if ($i >= $mid && $j < $len - $mid) { $arr[$k] = $right[$j++]; } elseif ($j >= $len - $mid && $i < $mid) { $arr[$k] = $left[$i++]; } elseif ($left[$i] <= $right[$j]) { $arr[$k] = $left[$i++]; } else { $arr[$k] = $right[$j++]; } } } return $arr; } public static function countingSort($arr) { if (! is_array($arr)) { return false; } $len = count($arr); if ($len <= 1) { return $arr; } $count = $sorted = []; $min = min($arr); $max = max($arr); for ($i = 0; $i < $len; $i++) { $count[$arr[$i]] = isset($count[$arr[$i]]) ? $count[$arr[$i]] + 1 : 1; } for ($j = $min; $j <= $max; $j++) { while (isset($count[$j]) && $count[$j] > 0) { $sorted[] = $j; $count[$j]--; } } return $sorted; } public static function heapSort($arr) { if (! is_array($arr)) { return false; } global $len; $len = count($arr); if ($len <= 1) { return $arr; } for ($i = $len; $i >= 0; $i--) { self::heapify($arr, $i); } return $arr; } static function heapify($arr, $i) { $left = 2 * $i + 1; $right = 2 * $i + 2; $largest = $i; global $len; if ($left < $len && $arr[$left] > $arr[$largest]) { $largest = $left; } if ($right < $len && $arr[$right] > $arr[$largest]) { $largest = $right; } if ($largest != $i) { self::array_swap($arr, $i, $largest); self::heapify($arr, $largest); } } }
true
ce5d5e7f8ed9279b45ee1979af2cf6e6328a0411
PHP
OckiFals/Ngaji2.0
/Ngaji/Database/QueryBuilder.php
UTF-8
4,985
3.125
3
[]
no_license
<?php namespace Ngaji\Database; /** * Class QueryBuilder * * Build your own SQL queries without model class! * * @package Ngaji\Database * @author Ocki Bagus Pratama * @since 2.0.1 */ use Ngaji\Base\Component; use PDO; class QueryBuilder extends Component { private $sql = ''; private $param = []; private $fetch = PDO::FETCH_CLASS; private $pdo; /** * Make the instance of the object */ public function __construct() { parent::__construct(); $this->pdo = Connection::connect(); $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } /** * Get the sql command * @return string */ public function get_sql() { return $this->sql; } /** * Get the sql param * @return array */ public function get_params() { return $this->param; } /** * @param string $field null for fect all columns * @return $this */ public function select($field = '*') { if (is_array($field)) $field = implode(', ', $field); $this->sql .= "SELECT $field "; return $this; } public function from($table) { $this->sql .= "FROM $table "; return $this; } public function where($condition) { if (is_array($condition)) { $list = Array(); $param = null; foreach ($condition as $key => $value) { if (is_array($value)) { /* * Model::findOne[ * ... * 'type' = [ * '!=' => 1 * ], * ... * ] * * SELECT ... FROM Model * ... WHERE ... `type` != 1 * LIMIT 1 */ $list[] = "$key " . array_keys($value)[0] . " :$key"; $param .= ', ":' . $key . '":"' . array_values($value)[0] . '"'; } else { $list[] = "$key = :" . str_replace('.', '_', $key); $param .= ', ":' . str_replace('.', '_', $key) . '":"' . $value . '"'; } } $json = "{" . substr($param, 1) . "}"; $this->param = json_decode($json, true); $this->sql .= ' WHERE ' . implode(' AND ', $list); } else { $this->sql .= ' WHERE ' . $condition; } return $this; } public function and_($and) { if (is_array($and)) { $this->sql .= " AND " . array_keys($and)[0] . "='" . array_values($and)[0] . "'"; } else { $this->sql .= " AND {$and}"; } return $this; } public function or_($or) { if (is_array($or)) { $this->sql .= " OR " . array_keys($or)[0] . "='" . array_values($or)[0] . "'"; } else { $this->sql .= " OR {$or}"; } return $this; } public function like($like) { $this->sql .= ' LIKE ' . "'{$like}'"; return $this; } public function orderBy($criteria) { $this->sql .= ' ORDER BY ' . "'{$criteria}'"; return $this; } public function asArray() { $this->fetch = PDO::FETCH_ASSOC; return $this; } /** * Execute the current $sql statements that return one record data! * @return array | \stdClass */ public function getOne() { $prepareStatement = $this->pdo->prepare($this->sql); $prepareStatement->execute($this->param); Connection::disconnect(); if ($this->fetch !== PDO::FETCH_CLASS) { if (1 == $prepareStatement->columnCount()) return $prepareStatement->fetch(PDO::FETCH_COLUMN); return $prepareStatement->fetch($this->fetch); } return $prepareStatement->fetchObject(); } /** * Execute the current $sql statements that return many records data! * @return array stdClass | array in array */ public function getAll() { $prepareStatement = $this->pdo->prepare($this->sql); $prepareStatement->execute($this->param); # close connection Connection::disconnect(); return $prepareStatement->fetchAll($this->fetch); } /** * Count the current $sql query! * @return int */ public function count() { $prepareStatement = $this->pdo->prepare($this->sql); $prepareStatement->execute($this->param); # close connection Connection::disconnect(); return $prepareStatement->rowCount(); } /** * Return representated of the instance with $sql String * @return string */ public function __toString() { return str_replace(array_keys($this->param), array_values($this->param), $this->sql); } }
true
38d23955ab78541bb12f9097bb397feb8ea26620
PHP
italolelis/EasyFramework
/src/Easy/Mvc/DependencyInjection/Compiler/SerializerPass.php
UTF-8
2,099
2.59375
3
[ "MIT" ]
permissive
<?php // Copyright (c) Lellys Informática. All rights reserved. See License.txt in the project root for license information. namespace Easy\Mvc\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; /** * Adds all services with the tags "serializer.encoder" and "serializer.normalizer" as * encoders and normalizers to the Serializer service. * * @author Javier Lopez <[email protected]> */ class SerializerPass implements CompilerPassInterface { public function process(ContainerBuilder $container) { if (!$container->hasDefinition('serializer')) { return; } // Looks for all the services tagged "serializer.normalizer" and adds them to the Serializer service $normalizers = $this->findAndSortTaggedServices('serializer.normalizer', $container); $container->getDefinition('serializer')->replaceArgument(0, $normalizers); // Looks for all the services tagged "serializer.encoders" and adds them to the Serializer service $encoders = $this->findAndSortTaggedServices('serializer.encoder', $container); $container->getDefinition('serializer')->replaceArgument(1, $encoders); } private function findAndSortTaggedServices($tagName, ContainerBuilder $container) { $services = $container->findTaggedServiceIds($tagName); if (empty($services)) { throw new \RuntimeException(sprintf('You must tag at least one service as "%s" to use the Serializer service', $tagName)); } $sortedServices = array(); foreach ($services as $serviceId => $tags) { foreach ($tags as $tag) { $priority = isset($tag['priority']) ? $tag['priority'] : 0; $sortedServices[$priority][] = new Reference($serviceId); } } krsort($sortedServices); // Flatten the array return call_user_func_array('array_merge', $sortedServices); } }
true
f1ed4b8428447f4966bb722c829290380bd264b2
PHP
kabsnation/creotec
/UI/getStrand.php
UTF-8
511
2.640625
3
[]
no_license
<?php require_once('../UI/StrandHandler.php'); require_once('../config/config.php'); $handler = new StrandHandler(); if(isset($_POST["batchcode"])){ $results = $handler -> getStrandByBatchCode($_POST["batchcode"]); ?> <option></option> <?php if(mysqli_num_rows($results)>0){ foreach ($results as $row) { $slots[$row["idStrand"]] = (int)$row["capacity"] - (int)$row["counter"]; if($slots[$row["idStrand"]]>0) echo '<option value="'.$row["idStrand"].'">'.$row["strand"].'</option>'; } } } ?>
true
d9e3a899958308f22776b3ddbb92165743cd5cce
PHP
wturnerharris/phpcheckout
/cal/includes/ldap/session_php.inc
UTF-8
5,235
2.703125
3
[]
no_license
<?php global $PHP_SELF; // Get form variables $Action = get_form_var('Action', 'string'); $NewUserName = get_form_var('NewUserName', 'string'); $NewUserPassword = get_form_var('NewUserPassword', 'string'); $TargetURL = get_form_var('TargetURL', 'string'); $returl = get_form_var('returl', 'string'); if (isset($cookie_path_override)) { $cookie_path = $cookie_path_override; } else { $cookie_path = $PHP_SELF; // Strip off everything after the last '/' in $PHP_SELF $cookie_path = preg_replace('/[^/]*$/', '', $cookie_path); } global $auth; if (!isset($auth["session_php"]["session_expire_time"])) { // session cookies - no persistent cookie. $auth["session_php"]["session_expire_time"] = 0; } session_set_cookie_params($auth["session_php"]["session_expire_time"],$cookie_path); session_name("EquipmentReservation"); session_start(); /* Target of the form with sets the URL argument "Action=SetName". Will eventually return to URL argument "TargetURL=whatever". */ if (isset($Action) && ($Action == "SetName")) { /* First make sure the password is valid */ // if ($NewUserName == "") // { // Unset the session variables // if (isset($_SESSION)) // { // $_SESSION = array(); // } // else // { // $_SESSION = array(); // } // } // else // { if (!authValidateUser($NewUserName, $NewUserPassword)) { //FAILURE!! include('includes/heading2.html'); echo "<p style='text-align: center;' class='alert'>User Not authenticated.</p>"; printLoginForm($TargetURL); include('includes/footer.html'); exit(); } if (isset($_SESSION)) { $_SESSION["user"] = $NewUserName; } else { global $HTTP_SESSION_VARS; $HTTP_SESSION_VARS["user"] = $NewUserName; } // } // preserve the original $HTTP_REFERER by sending it as a GET parameter if (!empty($returl)) { // check to see whether there's a query string already if (strpos($TargetURL, '?') === false) { $TargetURL .= "?returl=" . urlencode($returl); } else { $TargetURL .= "&returl=" . urlencode($returl); } } echo "<br>\n"; //SUCCESS!! session_register($NewUserName); $_SESSION['auth'] = true; $_SESSION['time'] = time(); /* Redirect browser to initial page */ echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php\">"; echo "<p>Please click <a href=\"index.php\">here</a> if you're not redirected automatically to the page you requested.</p>\n"; } /* Display the login form. Used by two routines below. Will eventually return to $TargetURL. */ function printLoginForm($TargetURL) { global $PHP_SELF, $HTTP_REFERER; global $returl; ?> <div style="margin-left: auto; margin-right: auto; text-align: left; width: 300px;"> <p><strong>Enter your user name and password to login.</strong></p> <form class="form_general" id="logon" method="post" action="<?php echo htmlspecialchars(basename($PHP_SELF)) ?>"> <fieldset> <legend><span class="alert">Your personal EDM account logon info.</span></legend> <div> <label for="NewUserName">Username:</label> <input type="text" id="NewUserName" name="NewUserName"> </div> <div> <label for="NewUserPassword">Password:</label> <input type="password" id="NewUserPassword" name="NewUserPassword"> </div> <?php // We need to preserve the original calling page, so that it's there when we eventually get // to the TargetURL (especially if that's edit_entry.php). If this is the first time through then $HTTP_REFERER holds // the original caller. If this is the second time through we will have stored it in $returl. if (!isset($returl)) { $returl = isset($HTTP_REFERER) ? $HTTP_REFERER : ""; } echo "<input type=\"hidden\" name=\"returl\" value=\"" . htmlspecialchars($returl) . "\">\n"; ?> <input type="hidden" name="TargetURL" value="<?php echo htmlspecialchars($TargetURL) ?>"> <input type="hidden" name="Action" value="SetName"> <div id="logon_submit"> <input class="submit" type="submit" value=" <?php echo get_vocab('login') ?> "> </div> </fieldset> </form> </div> <?php // Print footer and exit // print_footer(TRUE); } /* Target of the form with sets the URL argument "Action=QueryName". Will eventually return to URL argument "TargetURL=whatever". */ if (isset($Action) && ($Action == "QueryName")) { print_header(0, 0, 0, 0, ""); printLoginForm($TargetURL); exit(); } /* authGet() * * Request the user name/password * * Returns: Nothing */ function authGet() { global $PHP_SELF, $QUERY_STRING; print_header(0, 0, 0, 0, ""); echo "<p>".get_vocab("norights")."</p>\n"; $TargetURL = basename($PHP_SELF); if (isset($QUERY_STRING)) { $TargetURL = $TargetURL . "?" . $QUERY_STRING; } printLoginForm($TargetURL); exit(); } function getUserName() { if (isset($_SESSION) && isset($_SESSION["UserName"]) && ($_SESSION["UserName"] != "")) { return $_SESSION["UserName"]; } else { global $HTTP_SESSION_VARS; if (isset($HTTP_SESSION_VARS["UserName"]) && ($HTTP_SESSION_VARS["UserName"] != "")) { return $HTTP_SESSION_VARS["UserName"]; } } } ?>
true
5dfbf691c26061541ce1f59c1495e01ff9cf1926
PHP
amacrobert/last
/Router/FileSuffixUrlGenerator.php
UTF-8
1,228
2.625
3
[]
no_license
<?php /** * Created by PhpStorm. * User: franzwilding * Date: 14.08.18 * Time: 17:51 */ namespace Fw\LastBundle\Router; use Symfony\Component\Routing\Generator\UrlGenerator; class FileSuffixUrlGenerator extends UrlGenerator { const DEFAULT_SUFFIX = 'html'; /** * Returns path with default suffix if no suffix is included. * * @param $path * @return string */ static function appendSuffix(string $path) : string { if(empty($path) || strpos($path, '.') > -1) { return $path; } $path_parts = explode('?', $path); // If path ends with an "/", transform it to "/index". if(substr($path_parts[0], -1) === '/') { $path_parts[0] .= 'index'; } $path_parts[0].= '.'.static::DEFAULT_SUFFIX; return join('?', $path_parts); } /** * {@inheritdoc} */ public function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = []) { return static::appendSuffix(parent::doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, $requiredSchemes)); } }
true
9ea7213fc783f3720d11fe2ce41adfa0ba0ce1c6
PHP
MarcosT96/Acort.ar
/ejemplo.php
UTF-8
1,071
2.765625
3
[]
no_license
<?php /** * Incluir la clase principal */ include("Acortador.php"); /** * Instanciarlo * @var acortar */ $Acortador = new acortar\Acortador(); /** * Establece la URL y la API Key */ $Acortador->setURL("https://acort.ar/api"); $Acortador->setKey("Fgvsld81Hvex"); /** * Llamada simple */ echo $Acortador->acortar("https://acort.ar"); /** * Obtner URL acortada directamente */ echo $Acortador->toText()->acortar("https://gempixel.com"); /** * Llamadas avanzandas */ // Alias Personalizado $Acortador->setCustom("acortar"); // Establecer Tipo: Direct, Splash o Frame $Acortador->setType("direct"); // Establecer Contraseña $Acortador->setPassword("123456"); // Formato: text o json $Acortador->setFormat("text"); echo $Acortador->acortar("https://acort.ar"); /** * Obtener detalles y estadisticas */ var_dump($Acortador->details("acortar")); /** * Obtener todas tus URLs * @param string $sort Organiza tus URLs entre "date" o "click" (opcional - por defecto = date) * @param integer $limit Limita el numero de URLs */ var_dump($Acortador->urls());
true
be79fdb2330419300cb6f4393ae8906d0406ea78
PHP
mosiurp/web-devlopment-
/US_03/admin/page_new.php
UTF-8
2,184
2.765625
3
[]
no_license
<script type="text/javascript" src="js/tinymce/tinymce.min.js"></script> <script type="text/javascript"> tinymce.init({ selector:'.editor' }); </script> <?php $title = ""; $tag = ""; $category = ""; $content = ""; $etitle = ""; $etag = ""; $ecategory = ""; $econtent = ""; if(isset($_POST['submit'])) { $title = $_POST['title']; $tag = $_POST['tag']; $category = $_POST['category']; $content = $_POST['content']; $er = 0; if($title == "") { $er++; $etitle = "<span class=\"error\">Required</span>"; } if($tag == "") { $er++; $etag = "<span class=\"error\">Required</span>"; } if($category == "0") { $er++; $ecategory = "<span class=\"error\">Required</span>"; } if($content == "") { $er++; $econtent = "<span class=\"error\">Required</span>"; } if($er == 0) { $sql = "insert into pages(title, tag, userId, categoryId, count) values ('".ms($title)."', '".ms($tag)."', 1, ".ms($category).", 0)"; if(mysqli_query($cn, $sql)) { $file = fopen("article/". str_replace(" ", "_", trim(strtolower($title))).".html", "w"); fwrite($file, $content); print "<span class=\"success\">Data Saved</span>"; $title = ""; $tag = ""; $category = ""; $content = ""; } else{ print "<span class=\"error\">".mysqli_error($cn)."</span>"; } } } ?> <form method="post" action=""> <fieldset> <legend>New Page</legend> <label>Title</label><br> <input type="text" name="title" value="<?php print $title; ?>"/><?php print $etitle; ?><br><br> <label>Tag</label><br> <input type="text" name="tag" value="<?php print $tag; ?>"/><?php print $etag; ?><br><br> <label>Category</label><br> <select name="category"> <option value="0">Select</option> <?php $sql = "select id, name from category"; $table = mysqli_query($cn, $sql); while($row = mysqli_fetch_assoc($table)) { print "<option value=\"".$row["id"]."\">".$row["name"]."</option>"; } ?> </select><br><br> <label>Content</label><br> <textarea name="content" class="editor"><?php print $content; ?></textarea><?php print $econtent; ?><br><br> <input type="submit" name="submit" value="Submit"/> </fieldset> </form>
true
b0202ec2541ffee4c5450d08219110e8ca44ee66
PHP
wasimulislam/Tuition-Management-System
/lab_Task_9/model_a/model.php
UTF-8
2,744
2.703125
3
[]
no_license
<?php require_once 'db_connect.php'; function showAllTeacher() { $conn = db_conn(); $selectQuery = 'SELECT * FROM `teacher` '; try{ $stmt = $conn->query($selectQuery); }catch(PDOException $e){ echo $e->getMessage(); } $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); return $rows; } function getAllTeacherCount_Department($dep) { $conn = db_conn(); $selectQuery = "SELECT COUNT(1) as TOTAL FROM `teacher` WHERE Department LIKE '$dep%' "; try{ $stmt = $conn->query($selectQuery); }catch(PDOException $e){ echo $e->getMessage(); } $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); return $rows[0]['TOTAL']; } function showAllTeacherWithPagination_Department($page, $number_of_rows, $dep) { $offset = ($page-1) * $number_of_rows; $conn = db_conn(); $selectQuery = "SELECT * FROM `teacher` WHERE Department LIKE '$dep%' LIMIT $number_of_rows OFFSET $offset"; try{ $stmt = $conn->query($selectQuery); }catch(PDOException $e){ echo $e->getMessage(); } $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); return $rows; } function searchTeacher($user_name) { $conn = db_conn(); $selectQuery = "SELECT * FROM `user_info` WHERE Username LIKE '%$user_name%'"; try { $stmt = $conn->query($selectQuery); } catch(PDOException $e) { echo $e->getMessage(); } $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); return $rows; } function addTeacher($data) { $conn = db_conn(); $selectQuery = "INSERT into teacher (Name, Email, Username, Password, Gender, Current_Institution, Department, DOB, image) VALUES (:name, :email, :username, :password, :gender, :ins, :dep, :dob, :image)"; try{ $stmt = $conn->prepare($selectQuery); $stmt->execute([ ':name' => $data['name'], ':email' => $data['email'], ':username' => $data['username'], ':password' => $data['password'], ':gender' => $data['gender'], ':ins' => $data['ins'], ':dep' => $data['dep'], ':dob' => $data['dob'], ':image' => $data['image'] ]); } catch(PDOException $e) { echo $e->getMessage(); } $conn = null; return true; } function deleteTeacher($id) { $conn = db_conn(); $selectQuery = "DELETE FROM `teacher` WHERE `ID` = ?"; try { $stmt = $conn->prepare($selectQuery); $stmt->execute([$id]); } catch(PDOException $e) { echo $e->getMessage(); } $conn = null; return true; }
true
180d7b54a77a6825d5ef9b0e788194b53eb55597
PHP
bfinlay/laravel-excel-seeder
/src/Readers/HeaderImporter.php
UTF-8
2,556
3
3
[ "MIT" ]
permissive
<?php namespace bfinlay\SpreadsheetSeeder\Readers; use bfinlay\SpreadsheetSeeder\SpreadsheetSeederSettings; class HeaderImporter { /** * @var array */ private $headerRow; /** * @var SpreadsheetSeederSettings */ private $settings; /** * Array of raw column names unaliased and un-skipped from the sheet * * @var string[] */ private $rawColumns; /** * Map of post-processed column names to column numbers * * @var int[] */ public $columnNumbersByNameMap; /** * Sparse array; map of column numbers to post-processed column names * * @ var string[] */ public $columnNamesByNumberMap; /** * Header constructor. * @param array $headerRow */ public function __construct() { $this->settings = resolve(SpreadsheetSeederSettings::class); } public function import(array $headerRow) { $this->headerRow = $headerRow; $this->makeHeader(); return $this->toArray(); } private function makeHeader() { if (!empty($this->settings->mapping)) { $this->makeMappingHeader(); } else { $this->makeSheetHeader(); } } private function makeMappingHeader() { $this->rawColumns = $this->settings->mapping; foreach($this->rawColumns as $key => $value) { $this->columnNumbersByNameMap[$value] = $key; $this->columnNamesByNumberMap[$key] = $value; } } private function makeSheetHeader() { foreach ($this->headerRow as $columnName) { $this->rawColumns[] = $columnName; if (!$this->skipColumn($columnName)) { $columnName = $this->columnAlias($columnName); $this->columnNumbersByNameMap[$columnName] = count($this->rawColumns) - 1; $this->columnNamesByNumberMap[count($this->rawColumns) - 1] = $columnName; } } } private function columnAlias($columnName) { $columnName = isset($this->settings->aliases[$columnName]) ? $this->settings->aliases[$columnName] : $columnName; return $columnName; } private function skipColumn($columnName) { return $this->settings->skipper == substr($columnName, 0, strlen($this->settings->skipper)); } public function toArray() { return $this->columnNamesByNumberMap; } public function rawColumns() { return $this->rawColumns; } }
true
60a48f87589f832e0b669786ac026a887052f890
PHP
Naru-hub/PHP
/loop.php
UTF-8
611
3.890625
4
[]
no_license
<?php // $numbers = [1,2,3,4,5]; // foreach ($numbers as $number) { // echo $number * 2 .PHP_EOL; // } $currencies = [ 'japan' => 'yen', 'us' => 'dollar', 'england' => 'pound', ]; foreach($currencies as $country => $currency) { echo $country . ': '. $currency .PHP_EOL; } //無限ループwhile // $i = 0; // while (true) { // //50より少なければ // if ($i <= 50) { // //10ずつ増やし、数値を出力する // // $i = $i + 10; // echo $i . PHP_EOL; // $i += 10; // } else { // //ループ処理を終了する // break; // } // }
true
4a49db271c1826b4b59fbc8a62d85f464d6e8e2e
PHP
cawatou/smarty_tour
/app/core/DxException/DBO.php
UTF-8
463
2.78125
3
[]
no_license
<?php DxFactory::import('DxException'); class DxException_DBO extends DxException { /** * @param string $message * @param int $code * @param PDOStatement|PDOException $e */ public function __construct($message, $code, $e) { if ($e instanceof PDOStatement) { $error = $e->errorInfo(); $e = new PDOException($error[2], $error[1]); } parent::__construct($message, $code, $e); } }
true
841a4bb19f37ab9c86e8d3017dbfc4817e877aee
PHP
smietao/vtmerexam
/microblogService.php
UTF-8
7,311
2.703125
3
[]
no_license
<?php include "microblog.php"; class MicroblogService{ ///////////////////////////////////查询所有微博//////////////////////////////////////// function microblogList(){ $listObj =array(); $conn = mysqli_connect("localhost","root","","mydb"); if(mysqli_connect_errno($conn)){ echo "连接数据库失败!!"; exit; } $sql = "select * from microblog order by id desc"; $result = mysqli_query($conn,$sql); if($result){ while($row=mysqli_fetch_array($result)) { $m = new Microblog(); $m->id = $row["id"]; $m->subject = $row["subject"]; $m->content = $row["content"]; $m->author = $row["author"]; $m->last_post_time = $row["last_post_time"]; $m->comment_count = $row["comment_count"]; $m->likes = $row["likes"]; array_push($listObj,$m); } } mysqli_free_result($result); mysqli_close($conn); return $listObj; } //end microblogList ///////////////////////////////////添加微博功能///////////////////////////////////////// function addMicroblog($m){ $result = 0; $mysqli = new mysqli("localhost","root","","mydb"); $mysqli->set_charset('utf8');//设定字符集 if (strlen($m->content)<=600) { //判断微博正文长度 $sql = "insert into microblog (subject,content,author,last_post_time) values (?,?,?,?)"; $insert = $mysqli->prepare($sql); $insert->bind_param("ssss",$m->subject,$m->content,$m->author,$m->last_post_time); //对应字段参数先后顺序加入参数值 $res=$insert->execute(); if($res){ $result = 1; //发布成功返回1 }else{ $result = 2; //发布失败返回2 } }else{ $result = 0; //如果微博正文长度超过200字,返回0 } return $result; $insert->close(); $mysqli->close(); } //end addMicroblog //////////////////////根据用户名查询微博,用于个人中心和搜索用户显示微博//////////////////// function userMicroblog($u,$page){ $listObj = array(); $mysqli = new mysqli("localhost","root","","mydb"); $mysqli->set_charset('utf8');//设定字符集 $sql="select * from microblog where author=? order by id desc limit 3 offset $page"; $stmt = $mysqli->prepare($sql); $stmt->bind_param("s",$u->username); $stmt->execute(); //居然忘了写执行... $result = $stmt->get_result(); if($result){ while($row = $result->fetch_array()) { $m = new Microblog(); $m->id = $row["id"]; $m->subject = $row["subject"]; $m->content = $row["content"]; $m->author = $row["author"]; $m->last_post_time = $row["last_post_time"]; $m->comment_count = $row["comment_count"]; $m->likes = $row["likes"]; array_push($listObj,$m); } //end while } //end if $stmt->close(); $mysqli->close(); return $listObj; } //end userMicroblog ///////////////////////////////////根据微博id删除微博//////////////////////////////////// function deleteMicroblog($m){ $mysqli = new mysqli("localhost","root","","mydb"); $mysqli->set_charset('utf8');//设定字符集 $sql="delete from love where microblog_id=?"; //删除相关点赞数据 $stmt = $mysqli->prepare($sql); $stmt->bind_param("i",$m->id); $res=$stmt->execute(); $sql="delete from comment where microblog_id=?"; //删除相关评论数据 $stmt = $mysqli->prepare($sql); $stmt->bind_param("i",$m->id); $res=$stmt->execute(); $sql="delete from microblog where id=?"; //删除微博 $stmt = $mysqli->prepare($sql); $stmt->bind_param("i",$m->id); $res=$stmt->execute(); if($res){ $result=1; }else{ $result=0; } return $result; $stmt->close(); $mysqli->close(); }//end deleteMicroblog //////////////根据微博id查询微博,用于评论详情和点赞列表显示单条微博//////////////////////// function idMicroblog($m){ $listObj = array(); $mysqli = new mysqli("localhost","root","","mydb"); $mysqli->set_charset('utf8');//设定字符集 $sql="select * from microblog where id=? order by id desc"; $stmt = $mysqli->prepare($sql); $stmt->bind_param("i",$m->id); $stmt->execute(); $result = $stmt->get_result(); if($result){ while($row = $result->fetch_array()) { $m = new Microblog(); $m->id = $row["id"]; $m->subject = $row["subject"]; $m->content = $row["content"]; $m->author = $row["author"]; $m->last_post_time = $row["last_post_time"]; $m->comment_count = $row["comment_count"]; $m->likes = $row["likes"]; array_push($listObj,$m); } //end while } //end if $stmt->close(); $mysqli->close(); return $listObj; } //end idMicroblog //////////////////////////////////根据主题查询微博/////////////////////////////////////// function subjectMicroblog($m){ $listObj = array(); $mysqli = new mysqli("localhost","root","","mydb"); $mysqli->set_charset('utf8');//设定字符集 $sql="select * from microblog where subject=? order by id desc"; $stmt = $mysqli->prepare($sql); $stmt->bind_param("s",$m->subject); $stmt->execute(); $result = $stmt->get_result(); if($result){ while($row = $result->fetch_array()) { $m1 = new Microblog(); $m1->id = $row["id"]; $m1->subject = $row["subject"]; $m1->content = $row["content"]; $m1->author = $row["author"]; $m1->last_post_time = $row["last_post_time"]; $m1->comment_count = $row["comment_count"]; $m1->likes = $row["likes"]; array_push($listObj,$m1); } //end while } //end if $stmt->close(); $mysqli->close(); return $listObj; }//end subjectMicroblog //////////////////////////////根据用户名查找微博数量///////////////////////////////////// function countMicroblog($u){ $mysqli = new mysqli("localhost","root","","mydb"); $mysqli->set_charset('utf8');//设定字符集 $sql="select count(*) from microblog where author=?"; $stmt = $mysqli->prepare($sql); $stmt->bind_param("s",$u->username); $stmt->execute(); $stmt->bind_result($count); $stmt->fetch(); return $count; $stmt->close(); $mysqli->close(); }//end countMicroblog ////////////////////////////////////分页函数////////////////////////////////////////// function showPage($page,$count){ //$page为当前页数,$u为用户对象 if ($count%3) { //计算总页数 $allpage=(int)($count/3)+1; }else{ $allpage=$count/3; } if ($page!=1) { //如果当前页数不为一,显示上一页 ?> <p align="center"> <a href="search1.php?page=<?php echo $page-1; ?>">上一页</a> </p> <?php } echo "<p align='center'>第".$page."页/第".$allpage."页</p>"; if($page!=$allpage){ //如果当前页数不等于总页数显示下一页 ?> <p align="center"> <a href="search1.php?page=<?php echo $page+1; ?>">下一页</a> </p> <?php } echo '<h4 align="center"><a href="index.php">返回首页</a></h4>'; }//end showPage } //end class ?>
true
1183b8202a0e0d1a2bfea580415990419102fb33
PHP
SSPKHas/LabWorks
/LabWorks/denemeler/a/sumofdigits.php
UTF-8
121
2.796875
3
[]
no_license
<?php $a= $_REQUEST["number1"]; $sum=0; while($a>0){ $b = $a%10; $sum +=$b; $a/=10; } echo "<br>$sum" ; ?>
true
b9fba0717b9b06633dfb687c2d2321b56eb21890
PHP
sujeetkryadav/jasper-client
/src/Jaspersoft/Dto/ReportExecution/Status.php
UTF-8
775
2.890625
3
[]
no_license
<?php /** * @author Grant Bacon ([email protected]) */ namespace Jaspersoft\Dto\ReportExecution; use Jaspersoft\Dto\DTOObject; class Status extends DTOObject { /** * The status of the report * "queued" "ready" "failed", etc. * * @var string */ public $value; /** * A description of an error which occurred during execution * * @var Object */ public $errorDescriptor; public static function createFromJSON($json_obj) { $result = new self(); foreach ($json_obj as $k => $v) { if ($k == ErrorDescriptor::jsonField()) { $result->errorDescriptor = ErrorDescriptor::createFromJSON($v); } $result->$k = $v; } return $result; } }
true
565f056c177dbe2e1ba79d0216c9934c3544ef88
PHP
waowl/minishop
/models/News.php
UTF-8
671
2.90625
3
[]
no_license
<?php class News { public static function getAll() { $db = Db::getConnection(); $res = $db->query('SELECT * FROM product '); $res->setFetchMode(\PDO::FETCH_ASSOC); $items = $res->fetchAll(); return $items; } public static function getById($id) { $id = intval($id); if ($id) { $db = Db::getConnection(); $result = $db->query('SELECT * FROM product WHERE `id`=' . $id); /*$result->setFetchMode(PDO::FETCH_NUM);*/ $result->setFetchMode(PDO::FETCH_ASSOC); $newsItem = $result->fetch(); return $newsItem; } } }
true
2a49af8f4112aec4bdf91a009fb7e29c94f293e6
PHP
miladrahimi/netnevis
/core/reporter.php
UTF-8
1,111
3.140625
3
[]
no_license
<?php class Reporter { //****************************************************************************** static public function report($e, $force_store = false) { // Force store (even messages!) if ($force_store) { self::save($e); return ("error"); } // Detect exception type $exception = $e->getMessage(); $type = substr($exception, 0, 3); // Do based on type if ($type == "msg") { // Return Messages $message = substr($exception, 4); return ($message); } else { // Store Errors self::save($e); return "error"; } } //****************************************************************************** static private function save($e) { // Store exceptions in file $fp = fopen(dirname(__FILE__) . "/../error_log.txt", "a+"); fwrite($fp, $e); fwrite($fp, "\r\n###\r\n"); fclose($fp); } //****************************************************************************** }
true
68c684ff04dc23c533c7926c8532101357840bb0
PHP
plambert/enolib
/php/spec/generated/errors/parsing/two_or_more_templates_found.spec.php
UTF-8
2,322
2.984375
3
[ "MIT" ]
permissive
<?php declare(strict_types=1); describe('Copying a field that exists twice', function() { it('throws the expected ParseError', function() { $error = null; $input = "field: value\n" . "field: value\n" . "\n" . "copy < field"; try { Enolib\Parser::parse($input); } catch(Enolib\ParseError $_error) { $error = $_error; } expect($error)->toBeAnInstanceOf('Enolib\ParseError'); $text = "There are at least two elements with the key 'field' that qualify for being copied here, it is not clear which to copy."; expect($error->text)->toEqual($text); $snippet = " Line | Content\n" . " ? 1 | field: value\n" . " ? 2 | field: value\n" . " 3 | \n" . " > 4 | copy < field"; expect($error->snippet)->toEqual($snippet); expect($error->selection['from']['line'])->toEqual(3); expect($error->selection['from']['column'])->toEqual(0); expect($error->selection['to']['line'])->toEqual(3); expect($error->selection['to']['column'])->toEqual(12); }); }); describe('Copying a section that exists twice', function() { it('throws the expected ParseError', function() { $error = null; $input = "# section\n" . "\n" . "# section\n" . "\n" . "# copy < section"; try { Enolib\Parser::parse($input); } catch(Enolib\ParseError $_error) { $error = $_error; } expect($error)->toBeAnInstanceOf('Enolib\ParseError'); $text = "There are at least two elements with the key 'section' that qualify for being copied here, it is not clear which to copy."; expect($error->text)->toEqual($text); $snippet = " Line | Content\n" . " ? 1 | # section\n" . " 2 | \n" . " ? 3 | # section\n" . " 4 | \n" . " > 5 | # copy < section"; expect($error->snippet)->toEqual($snippet); expect($error->selection['from']['line'])->toEqual(4); expect($error->selection['from']['column'])->toEqual(0); expect($error->selection['to']['line'])->toEqual(4); expect($error->selection['to']['column'])->toEqual(16); }); });
true
5b02f2716f3e75728cbef279f224f3245726fb54
PHP
ivanhoe011/srp
/application/models/factories/AddressFactory.php
UTF-8
2,291
2.921875
3
[]
no_license
<?php /** * ##$BRAND_NAME$## * * ##$DESCRIPTION$## * * @category Project * @package Project_Models * @copyright ##$COPYRIGHT$## * @author ##$AUTHOR$##, $LastChangedBy$ * @version ##$VERSION$##, SVN: $Id$ */ /** * Address */ require_once 'application/models/beans/Address.php'; /** * Clase AddressFactory * * @category Project * @package Project_Models * @subpackage Project_Models_Factories * @copyright ##$COPYRIGHT$## * @copyright ##$COPYRIGHT$## * @author ##$AUTHOR$##, $LastChangedBy$ * @version ##$VERSION$##, SVN: $Id$ */ class AddressFactory { /** * Instancia un nuevo objeto Address * @param int $idMexicoState * @param string $street Calle y numero * @param string $settlement Colonia * @param string $district Delegacion o municipio * @param string $city Ciudad * @param int $zipCode Codigo postal * @param string $country Pais * @return Address Objeto Address */ public static function createAddress($idMexicoState, $street, $settlement, $district, $city, $zipCode, $country) { $newAddress = new Address(); $newAddress->setIdMexicoState($idMexicoState); $newAddress->setStreet($street); $newAddress->setSettlement($settlement); $newAddress->setDistrict($district); $newAddress->setCity($city); $newAddress->setZipCode($zipCode); $newAddress->setCountry($country); return $newAddress; } /** * Crea un objeto Address con parametros solo para uso de catalogos * @param int $idAddress * @param int $idMexicoState * @param string $street Calle y numero * @param string $settlement Colonia * @param string $district Delegacion o municipio * @param string $city Ciudad * @param int $zipCode Codigo postal * @param string $country Pais * @return Address Objeto Address */ public static function createAddressInternal($idAddress, $idMexicoState, $street, $settlement, $district, $city, $zipCode, $country) { $newAddress = AddressFactory::createAddress($idMexicoState, $street, $settlement, $district, $city, $zipCode, $country); $newAddress->setIdAddress($idAddress); return $newAddress; } }
true
516f4db41d1e2c0b1a448301ec0145eba5edd4f8
PHP
gitomato/redis
/src/RedisHyperLogLog.php
UTF-8
1,343
2.78125
3
[ "MIT" ]
permissive
<?php /** @noinspection DuplicatedCode */ namespace Amp\Redis; use Amp\Promise; final class RedisHyperLogLog { /** @var QueryExecutor */ private $queryExecutor; /** @var string */ private $key; public function __construct(QueryExecutor $queryExecutor, string $key) { $this->queryExecutor = $queryExecutor; $this->key = $key; } /** * @param string $element * @param string ...$elements * * @return Promise<bool> * * @link https://redis.io/commands/pfadd */ public function add(string $element, string ...$elements): Promise { return $this->queryExecutor->execute(\array_merge(['pfadd', $this->key, $element], $elements), toBool); } /** * @return Promise<int> * * @link https://redis.io/commands/pfcount */ public function count(): Promise { return $this->queryExecutor->execute(['pfcount', $this->key]); } /** * @param string $sourceKey * @param string ...$sourceKeys * * @return Promise<string> * * @link https://redis.io/commands/pfmerge */ public function storeMergeOf(string $sourceKey, string ...$sourceKeys): Promise { return $this->queryExecutor->execute(\array_merge(['pfmerge', $this->key, $sourceKey], $sourceKeys)); } }
true
229b71065d2a20ca2125b69c726f955da0bdb837
PHP
blackout314/d13
/classes/d13_blacklist.class.php
UTF-8
2,333
2.8125
3
[ "LicenseRef-scancode-other-permissive", "LicenseRef-scancode-unknown-license-reference" ]
permissive
<?php // ======================================================================================== // // BLACKLIST.CLASS // // !!! THIS FREE PROJECT IS DEVELOPED AND MAINTAINED BY A SINGLE HOBBYIST !!! // # Author......................: Tobias Strunz (Fhizban) // # Sourceforge Download........: https://sourceforge.net/projects/d13/ // # Github Repo.................: https://github.com/CriticalHit-d13/d13 // # Project Documentation.......: http://www.critical-hit.biz // # License.....................: https://creativecommons.org/licenses/by/4.0/ // // ABOUT CLASSES: // // Represents the lowest layer, next to the database. All logic checks must be performed // by a controller beforehand. Any class function calls directly access the database. // // NOTES: // // Used to organize the message blacklist of a player. Allows to check, add, remove and // retrieve entries to/from the blacklist. Blacklisting prevents a player from receiving // messages from other players on his/her blacklist in order to prevent spam/molesting. // // ======================================================================================== class d13_blacklist { public static function check($type, $value) { global $d13; $result = $d13->dbQuery('select count(*) as count from blacklist where type="' . $type . '" and value="' . $value . '"'); $row = $d13->dbFetch($result); return $row['count']; } public static function get($type) { global $d13; $result = $d13->dbQuery('select * from blacklist where type="' . $type . '"'); $blacklist = array(); for ($i = 0; $row = $d13->dbFetch($result); $i++) $blacklist[$i] = $row; return $blacklist; } public static function add($type, $value) { global $d13; if (!self::check($type, $value)) { $d13->dbQuery('insert into blacklist (type, value) values ("' . $type . '", "' . $value . '")'); if ($d13->dbAffectedRows() > - 1) $status = 'done'; else $status = 'error'; } else $status = 'duplicateEntry'; return $status; } public static function remove($type, $value) { global $d13; if (self::check($type, $value)) { $d13->dbQuery('delete from blacklist where type="' . $type . '" and value="' . $value . '"'); if ($d13->dbAffectedRows() > - 1) $status = 'done'; else $status = 'error'; } else $status = 'noEntry'; return $status; } }
true
91bf401b2b768180e0b222f49d25bae94e6fbda1
PHP
openwse/ipfs-api
/src/Namespaces/Dag.php
UTF-8
2,381
2.84375
3
[ "MIT" ]
permissive
<?php namespace Ipfs\Namespaces; use GuzzleHttp\RequestOptions; use Ipfs\IpfsNamespace; use Psr\Http\Message\StreamInterface; class Dag extends IpfsNamespace { /** * Streams the selected DAG as a .car stream on stdout. * * @return array|resource|StreamInterface */ public function export(string $cid, ?bool $progress = null) { return $this->client->request('dag/export', [ 'arg' => $cid, 'progress' => $progress, ])->send([RequestOptions::STREAM => $progress === true]); } /** * Get a dag node from IPFS. */ public function get(string $object): array { /* @phpstan-ignore-next-line */ return $this->client->request('dag/export', [ 'arg' => $object, ])->send(); } /** * Import the contents of .car files. * * @param array|string $files */ public function import($files, ?bool $silent = null, bool $pinRoots = true): array { $request = $this->client->request('dag/import', [ 'silent' => $silent, 'pin-roots' => $pinRoots, ]); if (is_string($files)) { $files = [$files]; } foreach ($files as $file) { $request->attach($file); } /* @phpstan-ignore-next-line */ return $request->send(); } /** * Add a dag node to IPFS. */ public function put(string $file, string $format = 'cbor', string $inputEnc = 'json', ?bool $pin = null, ?string $hash = null): array { /* @phpstan-ignore-next-line */ return $this->client->request('dag/put', [ 'format' => $format, 'input-enc' => $inputEnc, 'pin' => $pin, 'hash' => $hash, ])->attach($file)->send(); } /** * Resolve IPLD block. */ public function resolve(string $path): array { /* @phpstan-ignore-next-line */ return $this->client->request('dag/resolve', [ 'arg' => $path, ])->send(); } /** * Gets stats for a DAG. */ public function stat(string $cid, bool $progress = true): array { /* @phpstan-ignore-next-line */ return $this->client->request('dag/stat', [ 'arg' => $cid, 'progress' => $progress, ])->send(); } }
true
c42dc5eac5f059cd462c141cff29f9a7284dfd86
PHP
Sopoala/prac4
/loginControl.php
UTF-8
766
2.640625
3
[]
no_license
<?php session_start(); $username = $_POST['username']; $password = $_POST['password']; $duration = $_POST['duration']; if(($username == "infs" && $password == "3202") || ($username =="INFS" && $password == "3202")) { $_SESSION['username'] = $username; $_SESSION['password'] = $password; $_SESSION['duration'] = $duration; $_SESSION['login_time'] = time(); header('Location: index.php'); date_default_timezone_set('Australia/Brisbane'); $date=date('d/m/Y H:i:s'); $stringData = "$date"; $file = fopen("logs/logfile.txt","a"); echo fwrite($file, $stringData." ".$_SESSION['username']."-Login\r\n"); fclose($file); } else { $error = "Username or Password is incorrect"; $_SESSION['error'] = $error; header("Location: login.php"); } ?>
true
7250450d77b74a5ecf9518e73cf7001ece595b5a
PHP
dementedshaman/vosuco
/agi/Handler.php
UTF-8
1,851
3
3
[]
no_license
<?php class Handler { private $s_in; private $s_out; public function __construct($in, $out) { $this->s_in = $in; $this->s_out = $out; $agivars = array(); while (!feof($this->s_in)) { $agivar = trim(fgets($this->s_in)); if ($agivar === '') { break; } else { $agivar = explode(':', $agivar); $agivars[$agivar[0]] = trim($agivar[1]); } } foreach($agivars as $k=>$v) { $this->log_agi("Got $k=$v"); } $this->agivars = $agivars; } public function getCallerId() { return $this->agivars["agi_callerid"]; } function execute_agi($command) { fwrite($this->s_out, "$command\n"); fflush($this->s_out); $result = trim(fgets($this->s_in)); $ret = array('code'=> -1, 'result'=> -1, 'timeout'=> false, 'data'=> ''); if (preg_match("/^([0-9]{1,3}) (.*)/", $result, $matches)) { $ret['code'] = $matches[1]; $ret['result'] = 0; if (preg_match('/^result=([0-9a-zA-Z]*)\s?(?:\(?(.*?)\)?)?$/', $matches[2], $match)) { $ret['result'] = $match[1]; $ret['timeout'] = ($match[2] === 'timeout') ? true : false; $ret['data'] = $match[2]; } } return $ret; } function log_agi($entry, $level = 1) { if (!is_numeric($level)) { $level = 1; } $result = $this->execute_agi("VERBOSE \"$entry\" $level"); } function startConversation() { $this->execute_agi('ANSWER'); } function endConversation() { $this->execute_agi('STREAM FILE vm-goodbye ""'); $this->execute_agi('HANGUP'); exit; } } ?>
true
bd728e9bef5dbef1cd786900abe4677348cc5bbb
PHP
leovidalgithub/php
/DataTypes/Numbers.php
UTF-8
857
3.5625
4
[]
no_license
<html> <head> <title>Variables</title> <link rel="stylesheet" type="text/css" href="../style.css?v=1.21"> </head> <body> <div class="thisMain"> <?php $var1 = 3; $var2 = 4; $myFloat = 3.14; ?> Basic Math uses on PHP: <?php echo ((1+2+$var1) * $var2) / 2 - 5; ?><hr> Math Operations: <br> += <?php $var2 += 4; echo $var2;?><br> -= <?php $var2 -= 4; echo $var2;?><br> *= <?php $var2 *= 4; echo $var2;?><br> /= <?php $var2 /= 4; echo $var2;?><br> Increment =<?php $var2 ++; echo $var2;?><br> Decrement =<?php $var2 --; echo $var2;?><hr> Float and Points:<br> Floating <?php echo $myFloat;?><br> Round <?php echo round($myFloat,1);?><br> Ceiling <?php echo ceil($myFloat);?><br> Floor <?php echo floor($myFloat);?><hr> </div> <script src="../myscripts.js?v=1.21"></script> </body> </html>
true
a8e3f20c1133388b9768aaa5e8eb26b1a914aab0
PHP
jcordero/mgp
/mgp/www/includes/presentation/ticket/gisgrilla.php
UTF-8
1,932
2.65625
3
[]
no_license
<?php include_once "presentation/selectarray.php"; class CDH_GISGRILLA extends CDH_SELECTARRAY { function __construct($parent) { parent::__construct($parent); //$fld = $this->m_parent; //$grillas = $this->pedirGrillasUsig(); //if(is_array($grillas)) { // foreach($grillas as $grilla) // { // $opciones[$grilla] = $grilla; // } // $this->m_array = $opciones; //} $this->m_array = array( "1" => "Barrios", "2" => "Zonas de luminarias" ); } private function pedirGrillasUsig() { $resp = array(); //Existe el cache? if( file_exists(HOME_PATH."temp/delimitaciones.json") ) { $delim = file_get_contents(HOME_PATH."temp/delimitaciones.json"); return json_decode($delim); } //Pido via web service try { $host = $_SERVER["HTTP_HOST"]; $ch = curl_init("http://$host/direcciones/proxyjson.php?method=delimitacionesDisponibles"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_TIMEOUT,20); $output = curl_exec($ch); if($output!=false) { $resp = json_decode($output); //Salvo al cache file_put_contents(HOME_PATH."temp/delimitaciones.json",$output); } } catch (SoapFault $ex) { error_log( "pedirGrillasUsig() delimitacionesDisponibles() ->".$ex->getMessage() ); } catch (Exception $ex) { error_log( "pedirGrillasUsig() delimitacionesDisponibles() ->".$ex->getMessage() ); } return $resp; } } ?>
true
3a6705ae421c02c8c1633589a6332844931292aa
PHP
victoruizr/PHP
/Ejercicios/PDO/SentenciaPreparada.PHP
UTF-8
693
3.15625
3
[]
no_license
<?php function datos($curso, $nTable){ // creamos la conexion $mbd = new PDO('mysql:host=localhost;dbname=instituto', 'root', '123456'); //creamos la tabla con el nombre pasado como prametro $crear = $mbd->prepare("create table $nTable (alumno varchar(99))"); $crear->execute(); //Insertamos en la tabla creada anteriormente todos los alumnos cuyo curso sea el pasado como parametro $sentencia = "INSERT INTO $nTable (alumno) (SELECT (numMatricula) FROM alumno WHERE alumno.curso = :mat)"; $res_enc = $mbd->prepare($sentencia); $res_enc->bindParam(':mat', $curso); $res_enc->execute(); } datos("02","pepe"); ?>
true
78bc7fed63cfbcd2fd0774ae9254d580bb31a825
PHP
andrewFisherUa/widget-market
/app/WidgetEditor.php
UTF-8
6,657
2.515625
3
[]
no_license
<?php namespace App; use Illuminate\Database\Eloquent\Model; class WidgetEditor extends Model { protected $table='widget_products'; protected $fillable = [ 'wid_id' ]; public function hasAttribute($attr) { return isset($this->$attr); } public function widgetSave($parameters){ } public function mobile_render(){ $body=$this->getTemplateMobile(); $style=$this->getStyleMobile(); $script=$this->getScriptMobile(); if(!$this->name_mobile){ $name="block-mobile"; } else{ $name=$this->name_mobile; } if(!$this->width || !$this->height){ $width="200px"; $height="200px"; } else{ $width=$this->width; $height=$this->height; } if (!$this->mobile_background){ $background='rgba(255,255,255,1)'; } else{ $background=$this->mobile_background; } if (!$this->background_model){ $background_model='rgba(255,255,255,1)'; } else{ $background_model=$this->background_model; } if (!$this->background_model_hover){ $background_model_hover='rgba(255,255,255,1)'; } else{ $background_model_hover=$this->background_model_hover; } if (!$this->mobile_font_family){ $mobile_font_family='ArialRegular'; } else{ $mobile_font_family=$this->mobile_font_family; } $res=["body"=>$body, "style"=>$style, "script"=>$script, "name"=>$name, "width"=>$width, "height"=>$height, "background"=>$background, "background_model"=>$background_model, "background_model_hover"=>$background_model_hover, 'mobile_font_family'=>$mobile_font_family]; return $res; } public function render(){ $body=$this->getTemplate(); $style=$this->getStyle(); $script=$this->getScript(); /* if (!isset($parameters["name"])){ $name="block-mono"; } else{ $name=$parameters["name"]; } */ if(!$this->name){ $name="block-mono"; } else{ $name=$this->name; } if($this->width===null || $this->height ===null){ $width="200px"; $height="200px"; } else{ $width=$this->width; $height=$this->height; } if ($this->width=='0'){ $width='0'; } if ($this->height=='0'){ $height='0'; } if (!$this->cols){ $cols=1; } else{ $cols=$this->cols; } if (!$this->row){ $row=1; } else{ $row=$this->row; } if (!$this->background){ $background='rgba(255,255,255,1)'; } else{ $background=$this->background; } if (!$this->border_color){ $border_color='rgba(0, 0, 0, .1)'; } else{ $border_color=$this->border_color; } if (!$this->border_width){ $border_width=1; } else{ $border_width=$this->border_width; } if (!$this->border_radius){ $border_radius=1; } else{ $border_radius=$this->border_radius; } if (!$this->background_model){ $background_model='rgba(255,255,255,1)'; } else{ $background_model=$this->background_model; } if (!$this->background_model_hover){ $background_model_hover='rgba(255,255,255,1)'; } else{ $background_model_hover=$this->background_model_hover; } if (!$this->font_family){ $font_family='ArialRegular'; } else{ $font_family=$this->font_family; } if (!$this->font_size){ $font_size=1; } else{ $font_size=$this->font_size; } $res=["font_size"=>$font_size, "font_family"=>$font_family, "background_model_hover"=>$background_model_hover, "background_model"=>$background_model, "border_radius"=>$border_radius, "border_width"=>$border_width, "border_color"=>$border_color, "background"=>$background, "name"=>$name, "body"=>$body, "style"=>$style, "script"=>$script, "width"=>$width, "height"=>$height, "cols"=>$cols, "row"=>$row]; return $res; } public function getTemplate(){ /* if(!isset($parameters["name"])){ $name="block-mono"; } else{ $name=$parameters["name"]; } */ if(!$this->name){ $name="block-mono"; } else{ $name=$this->name; } $b="/home/mp.su/api.market-place.su/widget_product/templates/widget-".$name."/body.html"; if(!is_file($b)){ echo "незабуду !!!".$name."любимое моё html"; exit(); } // if(!is_file($b)){ // echo "незабуду !!!".$name."любимое моё html"; exit(); // } $body=file_get_contents($b); return $body; } public function getTemplateMobile(){ if(!$this->name_mobile){ $name="block-mobile"; } else{ $name=$this->name_mobile; } //var_dump($name); $b="/home/mp.su/api.market-place.su/widget_product/templates/widget-".$name."/body.html"; if(!is_file($b)){ echo "Не нашел мобильный боди !!!"; exit(); } $body=file_get_contents($b); return $body; } public function getStyle(){ /* if(!isset($parameters["name"])){ $name="block-mono"; } else{ $name=$parameters["name"]; } */ if(!$this->name){ $name="block-mono"; } else{ $name=$this->name; } $css="/home/mp.su/api.market-place.su/widget_product/templates/widget-".$name."/css/widget-slider-big.css"; //var_dump($css); die(); // если это шаблон виджета от Яндекса, то будет ругаться(т.к. нет файлов шаблона). Но мы этого не допустим. // if (!is_file($css)) { // echo "незабуду !!!".$name."любимое моё"; exit(); // } if (!is_file($css)) { echo "незабуду !!!".$name."любимое моё css"; exit(); } $style=file_get_contents($css); return $style; } public function getStyleMobile(){ if(!$this->name_mobile){ $name="block-mobile"; } else{ $name=$this->name_mobile; } $css="/home/mp.su/api.market-place.su/widget_product/templates/widget-".$name."/css/widget-slider-big.css"; //var_dump($css); die(); if(!is_file($css)){ echo "Не нашел стили мобильного !!!"; exit(); } $style=file_get_contents($css); return $style; } public function getScript(){ if(!$this->name){ $name="block-mono"; } else{ $name=$this->name; } $s="/home/mp.su/api.market-place.su/widget_product/templates/widget-".$name."/js/~init.js"; if(!is_file($s)){ echo "незабуду !!!".$name."любимое моё js"; exit(); } $script=file_get_contents($s); return $script; } public function getScriptMobile(){ if(!$this->name_mobile){ $name="block-mobile"; } else{ $name=$this->name_mobile; } $s="/home/mp.su/api.market-place.su/widget_product/templates/widget-".$name."/js/~init.js"; if(!is_file($s)){ echo "не нашел скрипты мобильные !!!"; exit(); } $script=file_get_contents($s); return $script; } }
true
21acedae2062aa283de8f8723fb40c86b5e60fd2
PHP
itsurya/itsurya.github.edu.np
/Check_score.php
UTF-8
2,252
2.546875
3
[]
no_license
<!doctype html> <html lang="en"> <head><title> Surya Online Exam </title> <style> a.ex1:hover, a.ex1:active {color: red;} </style> </head> <body background="image/back2.png"> <center> <font color='red' size='20'>Surya Online Exam </font> Information and Communication Technology (ICT), E - Education, Nepal <H3>Welcome to all Students </H3> <hr color='green'> // <a class="ex1" href="index.php">Home</a> // <a class="ex1" href="onlineSample.php">Online Exam Sample </a> // <a class="ex1" href="download.php">Downloads</a> // <a class="ex1" href="question_data_list.php">Online Questions</a> // <a class="ex1" href="Search_Checking.php">Student Score List </a> // <a class="ex1" href="developer.php">Developer</a> // <Hr color='red'> <?php $localhost = "localhost"; $username = "root"; $password = ""; $dbname = "suryaonlinedb"; $c="0"; $con = new mysqli($localhost, $username, $password, $dbname); if( $con->connect_error){ die('Error: ' . $con->connect_error); } $sql = "SELECT * FROM tbl_stud"; if(isset($_GET['search']) ) { $name = mysqli_real_escape_string($con, htmlspecialchars($_GET['search'])); $sql = "SELECT * FROM tbl_stud WHERE studcode ='$name'"; if ($name=="all" || $name=="ALL") { $sql = "SELECT * FROM tbl_stud"; } } $result = $con->query($sql); ?> <!DOCTYPE html> <html> <head><title>Basic Search form using mysqli</title></head> <body> <div class="container"> <form action="" method="GET"> <input type="text" placeholder="Type the name here" name="search">&nbsp; <input type="submit" value="Search" name="btn" class="btn btn-sm btn-primary"> </form> <h3>Thank You for Your Exam // Student Result</h3> <table bgcolor='pink' class="table table-striped table-responsive"> <tr> <th>Student code</th> <th>Student Name</th> <th>Student Catagory</th> <th>Student Score</th> </tr> <?php while($row = $result->fetch_assoc()){ $c=$c+1; ?> <tr> <td><?php echo $row['studcode']; ?></td> <td><?php echo $row['studname']; ?></td> <td><?php echo $row['studcat']; ?></td> <td><?php echo $row['studscore']; ?></td> </tr> <?php } ?> </table> </div> </body> <center>Total Records is = <?php echo $c; ?> </html>
true
4a77f19860b15dc4b330452b2da28cff1e96d060
PHP
kebrahim/kara-designs
/util/mail_helper.php
UTF-8
1,432
2.984375
3
[ "MIT" ]
permissive
<?php /** * Handles automatic e-mailing functionality */ class MailHelper { const KARA_EMAIL = "[email protected]"; /** * Sends the specified message w/ the specified subject to the specified set of users. */ public static function sendContactMail($fromName, $fromEmail, $message) { $to = MailHelper::KARA_EMAIL; $subject = "Contact from " . $fromName . " (" . $fromEmail . ") via karaebrahim.com"; // set headers $headers = "From: KaraEbrahim.com <[email protected]>\r\n"; $headers .= "Reply-To: " . $fromName . " <" . $fromEmail . ">\r\n"; $headers .= "Return-Path: " . $fromName . " <" . $fromEmail . ">\r\n"; $headers .= "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n"; return mail($to, $subject, $message, $headers); // Used for testing what will be mailed. // return MailHelper::displayMail($to, $subject, $message, $headers); } /** * Utility method to display what will be mailed. */ private static function displayMail($to, $subject, $message, $headers) { echo "<h1>To</h1> <p>" . htmlentities($to) . "</p> <h1>Subject</h1> <p>" . htmlentities($subject) . "</p> <h1>Message</h1> <p>" . htmlentities($message) . "</p> <h1>Headers</h1> <p>" . htmlentities($headers) . "</p>"; return true; } } ?>
true
fc9c948556d5a0b70740df3937a98f5979643b5f
PHP
aplinxy9plin/vk-bot
/core/apiVK.php
UTF-8
1,086
2.8125
3
[]
no_license
<?php /*************************************** * Class vk * author: https://github.com/retro3f ***************************************/ class vk { const API_VERSION = '5.24'; const METHOD_URL = 'https://api.vk.com/method/'; public function get(){ return json_decode(file_get_contents('php://input')); } public function usersGet($uid){ return file_get_contents(self::METHOD_URL."users.get?user_ids={$uid}&v=".self::API_VERSION); } public function msgSend($msg, $uid, $token){ $request_params = array( 'message' => $msg, 'user_id' => $uid, 'access_token' => $token, 'v' => self::API_VERSION ); $get_params = http_build_query($request_params); file_get_contents(self::METHOD_URL."messages.send?".$get_params); } /* public function curl_post($url){ echo $url; $ch = curl_init( $url ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); $response = curl_exec( $ch ); curl_close( $ch ); return $response; } */ } ?>
true
05b21ffc3ac04917432be349706d3df8f5450316
PHP
Schema31/php-gcloud-storage-sdk
/examples/exampleBuildPdV.php
UTF-8
2,062
2.671875
3
[]
no_license
<?php require __DIR__."/../vendor/autoload.php"; use Schema31\GCloudStorageSDK\gCloud_Storage; if ($argc < 6) { die("\n\nAttenzione!\n\nNon hai specificato abbastanza parametri: \n" . $argv[0] . " <repositoryName> <Authentication> <filePath> <documentId> <subject>\n\n"); } $repositoryName = $argv[1]; $Authentication = $argv[2]; $filePath = $argv[3]; $documentId = $argv[4]; $subject = $argv[5]; /** * Il file da conservare esiste? */ if (!file_exists($filePath) || !is_readable($filePath) || !is_file($filePath)) { die("\n\nAttenzione!\n\nFile non valido!\n\n"); } /** * Settiamo i dettagli del file da inviare in conservazione */ $myDocument = new stdClass(); $myDocument->filePath = $filePath; $myDocument->fileName = basename($filePath); $myDocument->mimeType = mime_content_type($filePath); $myDocument->documentId = $documentId; // Dimensione fissa (20 caratteri) $myDocument->subject = $subject; /** * Il metodo 'buildPdV' consente di creare dei bundle di documenti, aggiungiamo quindi il file ad una lista. */ $files = array($myDocument); /** * Inizializziamo un'istanza della classe gCloud_Storage */ $Storage = new gCloud_Storage(); $Storage->repositoryName = $repositoryName; $Storage->Authentication = $Authentication; /** * Generiamo il PdV */ $PdV = $Storage->buildPdV($files); if (!$PdV) { die("\n\nAttenzione!\n\nSi è verificato un errore nella costruzione dl PdV: {$Storage->LastError}\n\n"); } /** * Creiamo localmente un file temporaneo per il PdV */ $PdVFilePath = tempnam(sys_get_temp_dir(), 'gCloudPdV_'); /** * Effettuiamo il salvataggio del PdV su gCloud */ $fileKey = $Storage->sendFile($PdVFilePath, 'application/xml', 'gCloud_Storage_PdV.xml'); /** * Rimuoviamo il file temporaneo */ @unlink($PdVFilePath); /** * Verifichiamo l'esito del salvataggio */ if (!$fileKey) { die("\n\nAttenzione!\n\nSi è verificato un errore nel salvataggio su gCloud: {$Storage->LastError}\n\n"); } /** * Fatto! */ echo "\n"; echo "Il sistema ha ritornato la seguente fileKey: {$fileKey}\n"; echo "\n";
true
c67949a0553db5dcf9b619d0b3afad5a91d62389
PHP
Smartling/api-sdk-php
/src/Jobs/Params/CancelJobParameters.php
UTF-8
495
2.640625
3
[ "Apache-2.0" ]
permissive
<?php namespace Smartling\Jobs\Params; use Smartling\Parameters\BaseParameters; /** * Class CancelJobParameters * @package Jobs\Params */ class CancelJobParameters extends BaseParameters { /** * @param string $reason */ public function setReason($reason) { if (\mb_strlen($reason, 'UTF-8') > 4096) { throw new \InvalidArgumentException('Reason should be less or equal to 4096 characters.'); } $this->set('reason', $reason); } }
true
d6c2988542da48ba296d9b507ff3a4ae17c4eef7
PHP
Arriadnie/fit.nubip
/app/Integration/Esq/Entity.php
UTF-8
2,527
2.859375
3
[ "MIT" ]
permissive
<?php namespace App\Integration\Esq; class Entity { public $values; // custom object public $schemaName; // string public $IsNew; // bool function __construct($schemaName, $collection = null) { $this->schemaName = $schemaName; $this->values = array(); if (is_null($collection)) { $this->IsNew = true; return; } $this->IsNew = false; foreach ($collection as $key => $value) { $this->values[$key] = $value; } } function GetColumnValue($columnName) { return $this->values[$columnName]; } function GetValuesCollection() { return $this->values; } function SetColumnValue($columnName, $value) { $this->values[$columnName] = $value; } function SetDefaultValues() { $this->values["Id"] = Livlag::NewGuid(); } static function Create($schemaName) { $entity = new \App\Integration\Base\Entity($schemaName); // Some code for set columns config; return $entity; } function Save() { if ($this->IsNew) { $sql = $this->_getInsertSql(); } else { $sql = $this->_getUpdateSql(); } //echo $sql; DataBaseHandler::ExecuteQuery($sql); } private function _getInsertSql() { $sqlInsert = "INSERT INTO " . $this->schemaName . " ("; $sqlValues = "VALUES ("; foreach ($this->values as $key => $value) { if (is_null($value)) { continue; } $sqlInsert .= $key . ", "; $sqlValues .= (Livlag::IsString($value) ? "'" : "") . $value . (Livlag::IsString($value) ? "'" : "") . ", "; } $sqlInsert = substr($sqlInsert, 0, -2); $sqlValues = substr($sqlValues, 0, -2); $sqlInsert .= ")"; $sqlValues .= ")"; $sql = $sqlInsert . " " . $sqlValues; return $sql; } private function _getUpdateSql() { $sql = "UPDATE " . $this->schemaName . " SET "; foreach ($this->values as $key => $value) { if (is_null($value)) { continue; } if ($key == "Id") { continue; } $sql .= $key . "=" . (Livlag::IsString($value) ? "'" : "") . $value . (Livlag::IsString($value) ? "'" : "") . ", "; } $sql = substr($sql, 0, -2); $sql .= " WHERE Id='" . $this->values["Id"] . "'"; return $sql; } }
true
f67168ad26a12de62a613513d84c3ca243160801
PHP
SamerSenbol/RestAPI-Fetch-Ajax
/viewHoroscope.php
UTF-8
446
2.890625
3
[]
no_license
<?php // page should only be able to request via GET, it should check if a horoscope is saved in $ _SESSION and in that case print it in the output. Otherwise, the page will not print anything. session_start(); if ($_SERVER['REQUEST_METHOD'] == 'GET'){ header('Content-Type: application/json'); if (isset($_SESSION["horoscope"])) { echo json_encode($_SESSION["horoscope"]); } else{ echo json_encode(""); } }
true
341fcac512aa7c26e011461cabf00639726ea520
PHP
ezzatmohamed/String-tool
/FileHandler/FileHandler.php
UTF-8
233
3.140625
3
[]
no_license
<?php abstract class FileHandler { public function openFile($file_name, $mode = 'w') : FileHandler { $this->file = fopen($file_name, $mode); return $this; } abstract public function write($data); }
true
8fe5f20f7bd3fb206b7e91cfb52a0f1373ea6e13
PHP
misaki0710/minnano
/product.php
UTF-8
876
2.59375
3
[]
no_license
<?php require 'header.php'; ?> <!-- コンテンツ開始 --> <table> <tr> <th>商品番号</th> <th>商品名</th> <th>価格</th> </tr> <?php $pdo = new PDO('mysql:host=localhost;dbname=shop;charset=utf8','staff','password'); if(isset($_REQUEST['keyword'])){ $sql = $pdo -> prepare('select * from product where name like ?'); $sql -> execute(['%'.$_REQUEST['keyword'].'%']); }else{ $sql = $pdo -> prepare('select * from product'); $sql -> execute([]); /* $sql = $pdo -> query('select * from product'); */ } foreach($sql as $row){ $id = $row['id']; ?> <tr> <td><?php echo $id ?></td> <td><a href="detail.php?id=<?php echo $id ?>"><?php echo $row['name'] ?></a></td> <td><?php echo $row['price'] ?></td> </tr> <?php } ?> </table> <!-- コンテンツ終了 --> <?php require 'footer.php'; ?>
true
eb27ec69a44376c97207f702139852e8861555f3
PHP
songluco/fortune
/fortune/app/Services/SongluReflectionTest/Person.php
UTF-8
902
2.703125
3
[ "MIT" ]
permissive
<?php namespace App\Services\SongluReflectionTest; /** * Created by PhpStorm. * User: songlu * Date: 2017/9/18 * Time: 上午10:36 */ class Person { /** * For the sake of demonstration, we"re setting this private */ private $_allowDynamicAttributes = false; /** * type=primary_autoincrement */ protected $id = 0; /** * type=varchar length=255 null */ protected $name; /** * type=text null */ protected $biography; public function getId() { return $this->id; } public function setId($v) { $this->id = $v; } public function getName() { return $this->name; } public function setName($v) { $this->name = $v; } public function getBiography() { return $this->biography; } public function setBiography($v) { $this->biography = $v; } }
true
3a43986fdb8e6ba03106c3ed274c5f91a17501ed
PHP
IT-341/jipa-web
/src/Controller/Component/JIPAApiComponent.php
UTF-8
3,366
2.859375
3
[]
no_license
<?php namespace App\Controller\Component; use Cake\Controller\Component; use Cake\Network\Http\Client; use Cake\Network\Exception\BadRequestException; class JIPAApiComponent extends Component { /** * The API url. */ private $apiUrl = 'http://jipa-server.herokuapp.com/api/'; /** * The HTTP Client used to make the request to the API. */ private $http; public function initialize(array $config) { $this->http = new Client(); } /** * GET request method. * * @param $config Check buildUrl method for more details. */ public function get(array $config = array()) { $response = $this->http->get($this->buildUrl($config)); if ($response->code == '404') { return null; } return $response->body('json_decode'); } public function post(array $config = array(), array $data = array()) { $response = $this->http->post( $this->buildUrl($config), json_encode($data), ['headers' => ['Content-Type' => 'application/json']] ); return $response->code == '201'; } /** * PUT request method. * * @param $config Check buildUrl method for more details. * @param $data The data to be updated. */ public function put(array $config = array(), array $data = array()) { $response = $this->http->put( $this->buildUrl($config), json_encode($data), ['headers' => ['Content-Type' => 'application/json']] ); return $response->isOk(); } /** * DELETE request method. * * @param $config Check buildUrl method for more details. */ public function delete(array $config = array()) { $response = $this->http->delete($this->buildUrl($config)); return $response->code == '204' || $response->isOk(); } /** * Build the url based on the $config parameters. * * Parameters used are: * resource [required] the resource to look for * id [optional] the id of the resource you want * select [optional] to get only some attributes * filter [optional] to filter the search * populate [optional] populate the relationship */ private function buildUrl(array $config) { if (!isset($config['resource'])) { throw new BadRequestException('Missing resource on JIPAApiComponent->get() method'); } $url = $this->apiUrl . $config['resource'] . '/'; if (isset($config['id'])) { $url .= $config['id']; } $url .= '?'; if (isset($config['select'])) { $url .= 'select='; foreach ($config['select'] as $key => $value) { if ($key != 0) { $url .= '%20'; } $url .= $value; } $url .= '&'; } if (isset($config['filter'])) { foreach ($config['filter'] as $key => $value) { $url .= $key . '=' . $value; } $url .= '&'; } if (isset($config['populate'])) { $url .= 'populate=' . $config['populate']; } return $url; } }
true
3820239e28b496959ae61b648c5793408343da18
PHP
d-l-cloud/dlc
/app/Models/Shop/ProductCategory.php
UTF-8
2,961
2.59375
3
[ "MIT" ]
permissive
<?php namespace App\Models\Shop; use App\Models\User\Profile; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use App\Models\Shop\ProductList; use Illuminate\Http\Request; class ProductCategory extends Model { use HasFactory; protected $fillable = ['description','keywords','name','slug','text','images','isHidden','views','user_id','source']; public function user() { return $this->belongsTo(Profile::class, 'user_id'); } public function productList() { return $this->hasMany(ProductList::class, 'productCategoryId')->where('variable', '<=', '1'); } public static function getCategories() { // Получаем одним запросом все разделы $arr = self::orderBy('name')->where('isHidden', '=' , '0')->with(['productList','user'])->get(); // Запускаем рекурсивную постройку дерева и отдаем на выдачу return self::buildTree($arr, 0); } public static function buildTree($arr, $pid = 0) { // Находим всех детей раздела $found = $arr->filter(function($item) use ($pid){return $item->parent_id == $pid; }); // Каждому детю запускаем поиск его детей foreach ($found as $key => $cat) { $sub = self::buildTree($arr, $cat->id); $cat->sub = $sub; } return $found; } public function searchUrl(Request $request) { $query=strip_tags(htmlspecialchars($request->route('query'))); $getSubCategoryUrl = ProductCategory::where('id', '=', $query)->first(); $getCategoryUrl = ProductCategory::where('id', '=', $getSubCategoryUrl->parent_id)->first(); $fullUrl = '/katalog/'.$getCategoryUrl->slug.'/'.$getSubCategoryUrl->slug.'/'.$query.'/'; return $fullUrl; } public function searchUrlProduct($article) { $query=strip_tags(htmlspecialchars($article)); $getSubCategoryUrl = ProductCategory::where('id', '=', $query)->first(); $getCategoryUrl = ProductCategory::where('id', '=', $getSubCategoryUrl->parent_id)->first(); $fullUrl = '/katalog/'.$getCategoryUrl->slug.'/'.$getSubCategoryUrl->slug.'/'.$query.'/'; return $fullUrl; } public static function rulesAdd() { return [ 'name' => 'required|unique:product_categories,name', 'slug' => "required|unique:product_categories,slug", ]; } public static function rulesEdit($id) { return [ 'name' => "required|unique:product_categories,name,$id", 'slug' => "required|unique:product_categories,slug,$id", ]; } public static function attributeNames() { return [ 'title' => 'Название категории', 'slug' => 'ЧПУ категории', ]; } }
true
746dbbaa9f553d5e2c6e404ccc4cf58f9816f1db
PHP
Maxoslav/utils
/tests/Utils/JsonTest.php
UTF-8
4,081
2.59375
3
[ "MIT" ]
permissive
<?php declare(strict_types = 1); namespace Infinityloop\Tests\Utils; final class JsonTest extends \PHPUnit\Framework\TestCase { public function testFromString() : void { $instance = \Infinityloop\Utils\Json::fromString('{"name":"Rosta"}'); self::assertSame('{"name":"Rosta"}', $instance->toString()); self::assertSame(['name' => 'Rosta'], $instance->toArray()); } public function testFromArray() : void { $instance = \Infinityloop\Utils\Json::fromArray(['name' => 'Rosta']); self::assertSame('{"name":"Rosta"}', $instance->toString()); self::assertSame(['name' => 'Rosta'], $instance->toArray()); } public function testLoadArrayInvalidInput() : void { $instance = \Infinityloop\Utils\Json::fromString('{name: Rosta}'); self::assertFalse($instance->isValid()); } public function testLoadStringInvalidInput() : void { $instance = \Infinityloop\Utils\Json::fromArray(['name' => " \xB1\x31"]); self::assertFalse($instance->isValid()); } public function testIsValid() : void { $check = \Infinityloop\Utils\Json::fromString('{"name":"Rosta"}')->isValid() && \Infinityloop\Utils\Json::fromArray(['name' => 'Rosta'])->isValid(); self::assertEquals(true, $check); } public function testCount() : void { $instance = \Infinityloop\Utils\Json::fromString('{"name":"Rosta"}'); self::assertSame(1, $instance->count()); self::assertCount($instance->count(), $instance->toArray()); } public function testGetIterator() : void { self::assertInstanceOf('\ArrayIterator', \Infinityloop\Utils\Json::fromString('{"name":"Rosta"}')->getIterator()); } public function testOffsetExists() : void { self::assertSame(true, \Infinityloop\Utils\Json::fromString('{"name":"Rosta"}')->offsetExists('name')); } public function testOffsetGet() : void { self::assertSame('Rosta', \Infinityloop\Utils\Json::fromString('{"name":"Rosta"}')->offsetGet('name')); } public function testOffsetSet() : void { $instance = \Infinityloop\Utils\Json::fromString('{"name":"Rosta"}'); $instance->offsetSet('car', 'Tesla'); self::assertSame('{"name":"Rosta","car":"Tesla"}', $instance->toString()); self::assertTrue($instance->offsetExists('car')); } public function testOffsetUnset() : void { $instance = \Infinityloop\Utils\Json::fromString('{"name":"Rosta"}'); $instance->offsetUnset('name'); self::assertSame(false, $instance->offsetExists('name')); } public function testSerialize() : void { self::assertSame('{"name":"Rosta"}', \Infinityloop\Utils\Json::fromString('{"name":"Rosta"}')->serialize()); } public function testUnserialize() : void { $instance = \Infinityloop\Utils\Json::fromString('{"name":"Rosta"}'); $instance->unserialize('{"name":"Rosta"}'); self::assertSame('{"name":"Rosta"}', $instance->toString()); } public function testMagicToString() : void { self::assertSame('{"name":"Rosta"}', \Infinityloop\Utils\Json::fromArray(['name' => 'Rosta'])->__toString()); } public function testMagicIsset() : void { self::assertSame(true, \Infinityloop\Utils\Json::fromArray(['name' => 'Rosta'])->__isset('name')); } public function testMagicGet() : void { self::assertSame('Rosta', \Infinityloop\Utils\Json::fromArray(['name' => 'Rosta'])->__get('name')); } public function testMagicSet() : void { $instance = \Infinityloop\Utils\Json::fromString('{"name":"Rosta"}'); $instance->__set('car', 'Tesla'); self::assertTrue($instance->offsetExists('car')); } public function testMagicUnset() : void { $instance = \Infinityloop\Utils\Json::fromArray(['name' => 'Rosta']); $instance->__unset('name'); self::assertSame(false, $instance->offsetExists('name')); } }
true
a891df8ee241a52b22e120d801b9a94b900ef5fe
PHP
louLabo/applicationAPI
/src/Main.php
UTF-8
2,050
3.234375
3
[]
no_license
<?php include "Experience.php"; // Déclaration des Types d'articles à requeter if(isset($_GET["recherche"])){ main_with_data($_GET["recherche"]); } else { main_without_data(); } //************ Fonctions Main *************** function main_with_data($data_Sent) { // //Requete sur les types de contenu $res_experience = experience_requesting_with_data($data_Sent); // Ajouter tous les résultats dans l'array $allResults = array($res_experience); //On boucle foreach ($allResults as $res) { foreach ( $res as $r ){ echo $r; } } } function main_without_data() { $res_experience = experience_requesting_without_data(); //On boucle $allResults = array($res_experience); //On boucle foreach ($allResults as $res) { echo $res; } } //********************** Fonction de traitement des types de contenu ************************** //C'est fonctionx nom_contenu_requesting renvoient une array avec pour structure [nom_contenu][param1[],parm2[]...] function experience_requesting_with_data($data_Sent) { //liste des critères de selection des données. $list_parameter = array( 'ville' // exemple on veut crée un sous tableau comportant les résultats des recherches pour les villes égales au mots clés // 'organisme', 'budget', ... ); $res_experience = array(); $res_experience['experience'] = array(); foreach ($list_parameter as $parameter) { $Experience = new Experience(); $results = $Experience->requesting($data_Sent, $parameter); array_push($res_experience['experience'] , ( $Experience->analyse($results, $parameter))); } return $res_experience['experience']; } function experience_requesting_without_data() { $Experience = new Experience(); $results = $Experience->requesting_without_data(); $res_experience['experience'] = ($Experience->analyse($results, 'all')); return $res_experience['experience']; }
true
129a58e8c8505a3747665c9dc58a61aae0094a66
PHP
xNicoPaz/emailfy
/app/Mail/PlainTextEmail.php
UTF-8
805
2.5625
3
[]
no_license
<?php namespace App\Mail; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue; class PlainTextEmail extends Mailable { use Queueable, SerializesModels; public $customFrom, $customSubject, $customBody; /** * Create a new message instance. * * @return void */ public function __construct($from, $subject, $body) { $this->customFrom = $from; $this->customSubject = $subject; $this->customBody = $body; } /** * Build the message. * * @return $this */ public function build() { return $this->text('emails.rawbody') ->from($this->customFrom) ->subject($this->customSubject); } }
true
4b72b56c64b059c4dd177eee7a29f103d320a699
PHP
torrentpier/torrentpier
/src/Legacy/WordsRate.php
UTF-8
3,015
2.75
3
[ "MIT" ]
permissive
<?php /** * TorrentPier – Bull-powered BitTorrent tracker engine * * @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com) * @link https://github.com/torrentpier/torrentpier for the canonical source repository * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License */ namespace TorrentPier\Legacy; /** * Class WordsRate * @package TorrentPier\Legacy */ class WordsRate { public $dbg_mode = false; public $words_rate = 0; public $deleted_words = []; public $del_text_hl = ''; public $words_del_exp = ''; public $words_cnt_exp = '#[a-zA-Zа-яА-ЯёЁ]{4,}#'; public function __construct() { // слова начинающиеся на.. $del_list = file_get_contents(BB_ROOT . '/library/words_rate_del_list.txt'); $del_list = str_compact($del_list); $del_list = str_replace(' ', '|', preg_quote($del_list, '/')); $del_exp = '/\b(' . $del_list . ')[\w\-]*/i'; $this->words_del_exp = $del_exp; } /** * Возвращает "показатель полезности" сообщения используемый для автоудаления коротких сообщений типа "спасибо", "круто" и т.д. * * @param string $text * @return int */ public function get_words_rate($text) { $this->words_rate = 127; // максимальное значение по умолчанию $this->deleted_words = []; $this->del_text_hl = $text; // длинное сообщение if (\strlen($text) > 600) { return $this->words_rate; } // вырезаем цитаты если содержит +1 if (preg_match('#\+\d+#', $text)) { $text = strip_quotes($text); } // содержит ссылку if (strpos($text, '://')) { return $this->words_rate; } // вопрос if ($questions = preg_match_all('#\w\?+#', $text, $m)) { if ($questions >= 1) { return $this->words_rate; } } if ($this->dbg_mode) { preg_match_all($this->words_del_exp, $text, $this->deleted_words); $text_dbg = preg_replace($this->words_del_exp, '<span class="del-word">$0</span>', $text); $this->del_text_hl = '<div class="prune-post">' . $text_dbg . '</div>'; } $text = preg_replace($this->words_del_exp, '', $text); // удаление смайлов $text = preg_replace('#:\w+:#', '', $text); // удаление bbcode тегов $text = preg_replace('#\[\S+\]#', '', $text); $words_count = preg_match_all($this->words_cnt_exp, $text, $m); if ($words_count !== false && $words_count < 127) { $this->words_rate = ($words_count == 0) ? 1 : $words_count; } return $this->words_rate; } }
true
5ccddd230c88a665fc0fcc4e8598f3b7f3c4af32
PHP
DEVSENSE/Phalanger
/Testing/Tests/@PHP/lang/bug7515.php
UTF-8
402
2.671875
3
[ "Apache-2.0" ]
permissive
[expect php] [file] <?php include('Phalanger.inc'); error_reporting(E_ALL); class obj { function method() {} } $o->root=new obj(); ob_start(); __var_dump($o); $x=ob_get_contents(); ob_end_clean(); $o->root->method(); ob_start(); __var_dump($o); $y=ob_get_contents(); ob_end_clean(); if ($x == $y) { print "success"; } else { print "failure x=$x y=$y "; } ?>
true
42876300f248e9209b56e3d893884e7d3be504e4
PHP
jojoe77777/BlockSniper
/src/BlockHorizons/BlockSniper/brush/types/FreezeType.php
UTF-8
1,433
3.015625
3
[ "Apache-2.0" ]
permissive
<?php declare(strict_types=1); namespace BlockHorizons\BlockSniper\brush\types; use BlockHorizons\BlockSniper\brush\BaseType; use pocketmine\block\Block; /* * Freezes the terrain, causing water to become ice, lava to become obsidian and extinguishes fire. */ class FreezeType extends BaseType{ const ID = self::TYPE_FREEZE; public function fillSynchronously() : \Generator{ foreach($this->blocks as $block){ switch($block->getId()){ case Block::WATER: case Block::FLOWING_WATER: yield $block; $this->putBlock($block, Block::ICE); break; case Block::LAVA: case Block::FLOWING_LAVA: yield $block; $this->putBlock($block, Block::OBSIDIAN); break; case Block::FIRE: yield $block; $this->putBlock($block, 0); break; case Block::ICE: yield $block; $this->putBlock($block, Block::PACKED_ICE); } } } public function fillAsynchronously() : void{ foreach($this->blocks as $block){ switch($block->getId()){ case Block::WATER: case Block::FLOWING_WATER: $this->putBlock($block, Block::ICE); break; case Block::LAVA: case Block::FLOWING_LAVA: $this->putBlock($block, Block::OBSIDIAN); break; case Block::FIRE: $this->putBlock($block, 0); break; case Block::ICE: $this->putBlock($block, Block::PACKED_ICE); } } } public function getName() : string{ return "Freeze"; } }
true
85b04d63ff5d3086a2a7d79ccae78019e4b07fe8
PHP
lwapet/IMAD_project
/mobifake/check_image_service/controllers/Check_near_salient_shape_applications.php
UTF-8
4,769
2.578125
3
[]
no_license
<?php include_once "../utils/ShapePointDatabaseManager.class.php"; include_once "../utils/Constants.class.php"; include_once "../utils/ShapePoint_Comparer.class.php"; include_once "../utils/ShapePoint_ComparerNeutralPoint.class.php"; include_once "../utils/NivGris_transformer.class.php"; include_once "../utils/Databases_Manager.class.php"; include_once "../utils/SalientShapesDatabaseManager.class.php"; include_once "../utils/SaliencyCut.class.php"; include_once "../utils/HistogramContrastTransformer.class.php"; $seuil = $_POST["seuil"]; $result_distance_image=array(); $result_distance = array(); echo "récupération de l'image"; $filename = $_FILES ["file_path"] ["name"]; $ext = pathinfo ( $filename, PATHINFO_EXTENSION ); $image_name = pathinfo ( $filename, PATHINFO_FILENAME ); if (in_array( $ext,Constants::getExtentionAllowed())) { Database_Manager::clearFolder ( Constants::getTestedImagesDir () ); $move_success = move_uploaded_file ( $_FILES ["file_path"] ["tmp_name"], Constants::getTestedImagesDir () . $image_name . "." . $ext ); echo " \n début du traitement avec succès: " . $move_success; $GD_img = Database_Manager::read_image ( Constants::getTestedImagesDir () . $image_name, $ext ); $final_salient_image = HistogramContrastTransformer::transform_to_saliency($GD_img,$image_name,$ext); $saliency = new SaliencyCut($GD_img, $final_salient_image, $image_name, $ext); $binary_salient_cutted_image = $saliency->computeImage(); $shapePointList = NivGris_transformer::get_contours_from_GD_color_IMG($binary_salient_cutted_image); echo "\n seuil:".$seuil."\n"; if ($dir = @opendir (Constants::getSalientShapesDataBaseDir())) { $test_iteration= 0; while ( ($file = readdir ( $dir )) !== false ) { if ($file != ".." && $file != ".") { // ouverture du dossier de chaque application // attention chaque application a son dossier // le nom de l'application est la première partie du nom de l'image $app_distance = Constants::getMaximumShapeDistance(); // on ouvre le prochain dossier if ($actual_application_dir = @opendir ( Constants::getSalientShapesDataBaseDir().$file )) { while ( ($image_file = readdir ( $actual_application_dir )) !== false ) { if ($image_file != ".." && $image_file != ".") { echo "\n ***********************************************début du test"; $current_ext = pathinfo ( $image_file, PATHINFO_EXTENSION ); $current_name = pathinfo ( $image_file, PATHINFO_FILENAME ); echo "\n ***********************************************avec l'image".$current_name; $i = strpos($current_name, "_"); $folder_name = substr($current_name,0,$i); $handler = fopen ( Constants::getSalientShapesDataBaseDir().$folder_name."/".$current_name.".".$current_ext, 'r' ); $string = fgets ( $handler ); fclose ( $handler ); $array_shapePoint = json_decode ( $string, true ); $current_shapePointArrayList = $array_shapePoint["salientShapePoint_list"]; $current_shapePointList = array(); foreach ($current_shapePointArrayList as $shapePointArray){ $shapePointObject = new ShapePoint($shapePointArray["x"], $shapePointArray["y"]); $current_shapePointList[]=$shapePointObject; } $distance_actuelle = ShapePoint_ComparerNeutralPoint::compare($shapePointList, $current_shapePointList); $result_distance[] = array("image_name"=>$current_name,"distance"=>$distance_actuelle); //if($distance_actuelle<$app_distance) {$app_distance = $distance_actuelle;} gc_collect_cycles(); } } } //$result_distance[] = array("application_name"=>$file,"distance"=>$app_distance); } } } $distances_applications = array(); foreach($result_distance as $k => $v) { $distances_applications[$k] = $v["distance"]; } array_multisort($distances_applications, SORT_ASC,$result_distance); echo "\n résultat final : \n"; var_dump($result_distance); /* $handler = fopen ( Constants::getLabDatabase (), 'r' ); $string = fgets ( $handler ); fclose ( $handler ); $array_lab = json_decode ( $string, true ); $images_filtre_couleur = array (); foreach ( $array_lab as $array ) { $dist_min = Lba_comparer::compare_distinct_lba_values_occurence ( $array ["image_lab_values"], $final_distinct_lba_value_occurences ); if ($dist_min <= $seuil) { echo "\n similarité_detectee avec l'image \n" . $array ["image_name"]; $images_filtre_couleur [] = $array ["image_name"]; } } */ } else { echo "\nformat non pris en charge...." . $ext; }
true
56563d9b7a72bb239339d3d5bd71e15cc1115a42
PHP
slasher1959/comp1920
/htdocs/comp1920/lesson02/wk2stst1.php
UTF-8
752
3
3
[]
no_license
<?php /** File: wk2sandbox.php This file is used for creating some PHP Script that I play with for week 02 lesson in COMP1920 Author: John Elash Last Modified: May 05, 2015 */ /* $thedate = date("l"); echo $thedate . "<br />"; //prints the full textual day of week $thedate = date("F"); echo $thedate . "<br />"; //prints the full textual month $thedate = date("d"); echo $thedate . "<br />"; //prints the two digit day of month $thedate = date("F l"); echo $thedate . "<br />"; //prints Month TextualDayofWk $thedate = date("l F"); echo $thedate . "<br />"; //prints TextualDayofWk Month $thedate = date("l F d"); echo $thedate . "<br />"; //prints TextualDayofWk Month DD */ $thedate = date("l F d Y H:i:s"); echo "$thedate<br />"; ?>
true
0a6d830b65e953f4a26b8ed7083a2cd9f4c86d7e
PHP
jpirnat/dex
/src/Infrastructure/DatabaseItemNameRepository.php
UTF-8
1,329
3.015625
3
[]
no_license
<?php declare(strict_types=1); namespace Jp\Dex\Infrastructure; use Jp\Dex\Domain\Items\ItemId; use Jp\Dex\Domain\Items\ItemName; use Jp\Dex\Domain\Items\ItemNameNotFoundException; use Jp\Dex\Domain\Items\ItemNameRepositoryInterface; use Jp\Dex\Domain\Languages\LanguageId; use PDO; final class DatabaseItemNameRepository implements ItemNameRepositoryInterface { public function __construct( private PDO $db, ) {} /** * Get an item name by language and item. * * @throws ItemNameNotFoundException if no item name exists for this * language and item. */ public function getByLanguageAndItem( LanguageId $languageId, ItemId $itemId ) : ItemName { $stmt = $this->db->prepare( 'SELECT `name` FROM `item_names` WHERE `language_id` = :language_id AND `item_id` = :item_id LIMIT 1' ); $stmt->bindValue(':language_id', $languageId->value(), PDO::PARAM_INT); $stmt->bindValue(':item_id', $itemId->value(), PDO::PARAM_INT); $stmt->execute(); $result = $stmt->fetch(PDO::FETCH_ASSOC); if (!$result) { throw new ItemNameNotFoundException( 'No item name exists with language id ' . $languageId->value() . ' and item id ' . $itemId->value() . '.' ); } $itemName = new ItemName( $languageId, $itemId, $result['name'] ); return $itemName; } }
true
794d444be6e902cc1a92363db8896c5760cb4d2b
PHP
zodream/image
/src/ThumbImage.php
UTF-8
1,075
3
3
[ "MIT" ]
permissive
<?php declare(strict_types=1); namespace Zodream\Image; use Zodream\Image\Base\Box; /** * 缩略图 * @author zx648 * */ class ThumbImage extends Image { /** * 缩率图 * @param string $output 缩率之后存储的图片 * @param int $thumbWidth 缩率图宽度 * @param int $thumbHeight 缩率图高度 * @param bool|int $auto 那种方式进行缩略处理 * @return string */ public function thumb(string $output, int $thumbWidth = 0, int $thumbHeight = 0, bool $auto = true){ $width = $this->instance()->getWidth(); $height = $this->instance()->getHeight(); if ($thumbWidth <= 0) { $thumbWidth = $auto ? ($thumbHeight / $height * $width) : $width; } elseif ($thumbHeight <= 0) { $thumbHeight = $auto ? ($thumbWidth / $width * $height) : $height; } elseif($auto) { $rate = min($height / $thumbHeight, $width / $thumbWidth); $thumbWidth *= $rate; $thumbHeight *= $rate; } $thumb = $this->instance(); $thumb->thumbnail(new Box($width, $height)); $thumb->saveAs($output); return $output; } }
true
0a3869e35171559df0b127f7396317aad38e2ac2
PHP
RabinPhaiju/Laravel-8
/blog/app/Http/Controllers/Users.php
UTF-8
2,414
2.59375
3
[ "MIT" ]
permissive
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\HTTP; use App\Models\User; class Users extends Controller { // function fetchUserData(){ echo 'from db user control'; // direct DB connection. return DB::select("select * from users"); } function fetchDBData(){ // model connection DB // return User::all(); // $data= User::all(); $data= User::paginate(5); return view('userList',['userData'=>$data]); } function deleteUserDB($id){ // How to delete more than one data at a time. $data = User::find($id); session()->flash('deleteUser',$data['username']); $data->delete(); return redirect('user/rabin?age=20'); } function editUserDB($id){ $data = User::find($id); // return $data; return view('editUserDB',['data'=>$data]); } function updateUserDB(Request $req){ $data = User::find($req->id); $data->firstname=$req->firstname; $data->email=$req->email; $data->location=$req->location; $data->contact=$req->contact; $data->save(); return redirect('user/rabin?age=20'); } function addDBData(Request $req){ $user = new User; $user->firstname=$req->firstname; $user->email=$req->email; $user->location=$req->location; $user->contact=$req->contact; $user->save(); return redirect('user/rabin?age=20'); } function fetchHttp(){ echo "API Data will be here"; $collection= Http::get("https://reqres.in/api/users?page=1"); return view("collection",['collection'=>$collection['data']]); } public function index_func($user){ // return ['name'=>"rabin",'age'=>34]; // api return echo " Hello from controller ".$user; $data = ['rabin','sabin',$user]; return view("user",['name'=>$data]); } function getData(Request $req){ $username = $req->old('username'); $req->validate([ 'username'=>'required | max:10 | min:5', 'password' => ['required', 'min:6', 'regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\x])(?=.*[!$#%]).*$/'] ]); return $req->input(); } }
true
e01eb5fd21202703985212c3b0cbb3f525dafa50
PHP
mjcaabay06/devam
/include/general_functions.php
UTF-8
1,610
2.59375
3
[]
no_license
<?php function checkLogin($username, $password){ global $dbh; $isAuthenticated = false; $chkLogin = $dbh->prepare("SELECT * FROM users WHERE username = :uname AND password = :pass AND user_type_id = 1"); $chkLogin->execute(array(":uname" => $username, ":pass" => encryptPass($password))); $results = $chkLogin->fetch(); if(!empty($results)){ $_SESSION['AuthId'] = $results['id']; $_SESSION['username'] = $results['username']; $isAuthenticated = true; } return $isAuthenticated; } function encryptPass($password){ $cryptKey = 'encrypt-pass'; $cryptPass = base64_encode( mcrypt_encrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), $password, MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ) ); return $cryptPass; } function decryptPass($password){ $cryptKey = 'encrypt-pass'; $dcrypt = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), base64_decode($password ), MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ), "\0"); return $dcrypt; } function sendViaSemaphore($parameters){ $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL,'http://api.semaphore.co/api/v4/messages' ); curl_setopt( $ch, CURLOPT_POST, 1 ); curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( $parameters ) ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); $output = curl_exec( $ch ); curl_close ($ch); return json_decode($output); } function getMsgReceivers(){ global $dbh; $getData = $dbh->prepare("SELECT * FROM farmer_infos WHERE user_id = :user_id "); $getData->execute(array(":user_id" => (int)$_SESSION['AuthId'])); $results = $getData->fetchAll(PDO::FETCH_ASSOC); return $results; } ?>
true
6a71ef3934fc557d942c0375af26a6b96f5b2454
PHP
NolwennWM/-2019-WF3-Becycle
/src/Entity/Address.php
UTF-8
3,471
2.578125
3
[]
no_license
<?php namespace App\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity(repositoryClass="App\Repository\AddressRepository") */ class Address { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\Column(type="string", length=255) */ private $street; /** * @ORM\Column(type="string", length=10) */ private $postal_code; /** * @ORM\Column(type="string", length=255) */ private $city; /** * @ORM\Column(type="string", length=255) */ private $country; /** * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="addresses") * @ORM\JoinColumn(nullable=false) */ private $id_user; /** * @ORM\OneToMany(targetEntity="App\Entity\Orders", mappedBy="id_adress") */ private $orders; /** * @ORM\Column(type="integer") */ private $active=2; public function __construct() { $this->orders = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getStreet(): ?string { return $this->street; } public function setStreet(string $street): self { $this->street = $street; return $this; } public function getPostalCode(): ?string { return $this->postal_code; } public function setPostalCode(string $postal_code): self { $this->postal_code = $postal_code; return $this; } public function getCity(): ?string { return $this->city; } public function setCity(string $city): self { $this->city = $city; return $this; } public function getCountry(): ?string { return $this->country; } public function setCountry(string $country): self { $this->country = $country; return $this; } public function getIdUser(): ?user { return $this->id_user; } public function setIdUser(?user $id_user): self { $this->id_user = $id_user; return $this; } /** * @return Collection|Orders[] */ public function getOrders(): Collection { return $this->orders; } public function addOrder(Orders $order): self { if (!$this->orders->contains($order)) { $this->orders[] = $order; $order->setIdAdress($this); } return $this; } public function removeOrder(Orders $order): self { if ($this->orders->contains($order)) { $this->orders->removeElement($order); // set the owning side to null (unless already changed) if ($order->getIdAdress() === $this) { $order->setIdAdress(null); } } return $this; } public function getActive(): ?int { return $this->active; } public function setActive(int $active): self { $this->active = $active; return $this; } }
true
a382695db1dac41b79a71f5fe6bb21410284cfc8
PHP
TYPO3-svn-archive/cz_simple_cal
/Classes/Hook/Datamap.php
UTF-8
1,838
2.734375
3
[]
no_license
<?php class Tx_CzSimpleCal_Hook_Datamap { /** * implements the hook processDatamap_afterDatabaseOperations that gets invoked * when a form in the backend was saved and written to the database. * * Here we will do the caching of recurring events * * @param string $status * @param string $table * @param integer $id * @param array $fieldArray * @param t3lib_TCEmain $tce */ public function processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, $tce) { if ($table == 'tx_czsimplecal_domain_model_event') { //if: an event was changed $indexer = t3lib_div::makeInstance('Tx_CzSimpleCal_Indexer_Event'); if($status == 'new') { // if: record is new $indexer->create($tce->substNEWwithIDs[$id]); } elseif($this->haveFieldsChanged(Tx_CzSimpleCal_Domain_Model_Event::getFieldsRequiringReindexing(), $fieldArray)) { //if: record was updated and a value that requires re-indexing was changed $indexer->update($id); } } } /** * implement the hook processDatamap_postProcessFieldArray that gets invoked * right before a dataset is written to the database * * @param $status * @param $table * @param $id * @param $fieldArray * @param $tce * @return null */ public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, $tce) { if($table == 'tx_czsimplecal_domain_model_event' || $table == 'tx_czsimplecal_domain_model_exception') { // store the timezone to the database $fieldArray['timezone'] = date('T'); } } /** * check if fields have been changed in the record * * @param $fields * @return boolean */ protected function haveFieldsChanged($fields, $inArray) { $criticalFields = array_intersect( array_keys($inArray), $fields ); return !empty($criticalFields); } }
true
2b606a2892246f38b916256ac1e173dea7fceae7
PHP
Ntlzyjstdntcare/Colms_Portfolio
/ThoughtCatcher/enter_username.php
UTF-8
2,727
2.8125
3
[]
no_license
<?php //Start a session in order to use session variables session_start(); //Connect to the database include "Scripts/connect_to_mysql.php"; if(isset($_POST['name'])) { $name=$_POST['name']; $_SESSION['name'] = $name; //See if the customer is already in the system. $sql =mysql_query("SELECT id FROM users WHERE username = '$name' LIMIT 1"); $userMatch=mysql_num_rows($sql); if ($userMatch > 0) { //If it is, insert the date of login into the database, and then send the user to logger page. $sql=mysql_query("UPDATE users SET last_log_date=now() WHERE username='$name'") or die (mysql_error()); $sql = mysql_result(mysql_query("SELECT id FROM users WHERE username = '$name' LIMIT 1"),0); $_SESSION['userID'] = $sql; header("location: logger.php "); exit(); } else { //if the customer is not in the system, add it to the database //Run an sql query to insert the product details into the database $sql=mysql_query("INSERT INTO users(username, last_log_date) VALUES('$name', now())") or die (mysql_error()); $sql = mysql_result(mysql_query("SELECT id FROM users WHERE username = '$name' LIMIT 1"),0); $_SESSION['userID'] = $sql; header("location: logger.php "); exit(); } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Create User Page</title> <link rel="stylesheet" href="style/style.css" type="text/css" media="screen"/> <head> <body> <div style="float: left; position:relative; TOP:15px; LEFT:170px;"> <img src="Images/thought_icon_inactive.png" alt="Thought Icon" width="120" height="120"> </div> <div style="float: right; position:relative; TOP:15px; RIGHT:170px;"> <img src="Images/mood_icon_inactive.jpg" alt="Mood Icon" width="120" height="120"> </div> <div align="center" style="position:relative; top:125px; font-size:35px; color:blue;"><h1>Welcome!</h1></div> <div style="position:relative; top: 200px;"><p style="font-size:20px;">Store your thoughts and moods here.</p></div> <div style="position:relative; top: 230px;"><p style="font-size:20px;">What is your name?</p></div> <div style="position:relative; top: 270px; left: 120px;"> <form action="enter_username.php" method="POST"> <textarea name="name" rows="1" cols="100"></textarea> <br/> <br/> <br/> <input type="submit" value="Register" style="position:relative; left: 500px; font-size:30px;"/> <br/> <br/> <br/> </form> </div> </body> </html>
true
e2890e5ac1d047d056cdcac578569b206cff19fd
PHP
bbattulga/dental-erp
/app/ToothType.php
UTF-8
808
2.78125
3
[ "MIT" ]
permissive
<?php namespace App; use Illuminate\Database\Eloquent\Model; class ToothType extends Model { // protected $table='tooth_types'; private static $MILK; private static $PERMA; public function getShortNameAttribute(){ $name = $this->name; $words = explode(' ', $name); return mb_strtolower($words[0]); } public static function milk(){ if (!isset(self::$MILK)){ self::$MILK = self::where('name', 'like', '%Сү%') ->orWhere('name', 'like', '%Milk%') ->first(); } return self::$MILK; } public static function permanent(){ if (!isset(self::$PERMA)){ self::$PERMA = self::where('name', 'like', '%Яс%') ->orWhere('name', 'like', '%Perm%') ->first(); } return self::$PERMA; } }
true
fd5b0b25f10566d3c9ab1872eac946b2b629c3fd
PHP
loevgaard/dandomain-api
/src/Endpoint/Customer.php
UTF-8
4,746
2.5625
3
[ "MIT" ]
permissive
<?php namespace Loevgaard\Dandomain\Api\Endpoint; use Assert\Assert; class Customer extends Endpoint { /** * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#GetCustomer_GET * * @param int $customerId * @return array */ public function getCustomer(int $customerId) : array { Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive'); return (array)$this->master->doRequest( 'GET', sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/%d', $customerId) ); } /** * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#GetCustomerByEmail_GET * * @param string $email * @return array */ public function getCustomerByEmail(string $email) : array { Assert::that($email)->email(); return (array)$this->master->doRequest( 'GET', sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/GetCustomerByEmail?email=%s', rawurlencode($email)) ); } /** * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#General_Online_Reference * * @param \DateTimeInterface $date * @return array */ public function getCustomersCreatedSince(\DateTimeInterface $date) : array { return (array)$this->master->doRequest( 'GET', sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/CreatedSince?date=%s', $date->format('Y-m-d\TH:i:s')) ); } /** * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#CreateCustomer_POST * * @param array|\stdClass $customer * @return array */ public function createCustomer($customer) : array { return (array)$this->master->doRequest('POST', '/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}', $customer); } /** * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#UpdateCustomer_PUT * * @param int $customerId * @param array|\stdClass $customer * @return array */ public function updateCustomer(int $customerId, $customer) : array { Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive'); return (array)$this->master->doRequest( 'PUT', sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/%d', $customerId), $customer ); } /** * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#DeleteCustomer_DELETE * * @param int $customerId * @return boolean */ public function deleteCustomer(int $customerId) : bool { Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive'); return (bool)$this->master->doRequest( 'DELETE', sprintf( '/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/%d', $customerId ) ); } /** * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#GetCustomerGroups_GET * * @return array */ public function getCustomerGroups() : array { return (array)$this->master->doRequest( 'GET', '/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/CustomerGroup' ); } /** * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#UpdateCustomerDiscountPOST * * @param int $customerId * @param array|\stdClass $customerDiscount * @return array */ public function updateCustomerDiscount(int $customerId, $customerDiscount) : array { Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive'); return (array)$this->master->doRequest( 'POST', sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/UpdateCustomerDiscount/%d', $customerId), $customerDiscount ); } /** * @see https://shoppartner.dandomain.dk/dokumentation/api-documentation/customer/#GetCustomerDiscountGET * * @param int $customerId * @return array */ public function getCustomerDiscount(int $customerId) : array { Assert::that($customerId)->greaterThan(0, 'The $customerId has to be positive'); return (array)$this->master->doRequest( 'GET', sprintf( '/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/GetCustomerDiscount/%d', $customerId ) ); } }
true
e03baa375474538d51723a9bb973844509bb0474
PHP
sumiredc/php-pokemon.com
/webapp/html/app/Classes/AutoLoader.php
UTF-8
824
2.78125
3
[]
no_license
<?php /** * オートローダー */ abstract class AutoLoader { /** * 検索するクラスが格納されているフォルダ * @var array */ private const FOLDERS = [ 'Move', 'Pokemon', 'Type', 'StatusAilment', 'StateChange', 'Field', 'Item', 'Gym' ]; /** * 起動 * @return void */ public static function init() { spl_autoload_register(function($class){ // クラス名からファイルを検索 foreach(self::FOLDERS as $folder){ $path = __DIR__ . '/../Classes/'.$folder.'/'.$class.'.php'; if(file_exists($path)){ // 見つかった場合は読み込み実行 require $path; break; } } }); } }
true
ac398daf96b4d938412753a8968a3e0953f2ba91
PHP
ChrisrPerry/ProspectCollect
/Phase 6/addData.php
UTF-8
947
2.640625
3
[]
no_license
<?php error_reporting(E_ALL); ini_set("display_errors", "on"); $server = "spring-2021.cs.utexas.edu"; $user = "cs329e_bulko_mike247"; $pwd = "union_Hearth4glance"; $dbName = "cs329e_bulko_mike247"; $mysqli = new mysqli($server, $user, $pwd, $dbName); if($mysqli->connect_errno){ die('Connect Error: ' . $mysqli->connect_errno . ": " . $mysqli->connect_error); } $mysqli->select_db($dbName) or die($mysqli->error); $username = $_COOKIE['UsersName']; $item = $_GET['item']; $command = "SELECT item FROM $username WHERE item = '$item'"; $result = $mysqli->query($command); $array = $result->fetch_array(MYSQLI_ASSOC); if($array['item'] == $item){ print("Item already in Collection"); } else{ $high = $_GET['high']; $low = $_GET['low']; $mid = $_GET['mid']; $image = $_GET['image']; $product = $_GET['prod']; $command = "INSERT INTO $username VALUES ('$item', '$high', '$low', '$mid', '$product', '$image')"; $mysqli->query($command); } ?>
true
2243f17e4ed2a5aa4e96648a238b9b1cbc0780e7
PHP
lanizz/weixin
/src/Menu/Menu.php
UTF-8
520
2.6875
3
[]
no_license
<?php /** * * User: Jinming * Date: 2017/8/4 * Time: 18:42 */ namespace Lanizz\Weixin\Menu; use Lanizz\PHPHelper\Arr; class Menu { private $button = []; public function addButton(Button $button) { return $this->button[] = $button; } public function output() { return Arr::cnJsonEncode(get_object_vars($this)); } public function __set($name, $value) { $this->$name = $value; } public function __get($name) { return $name; } }
true
e900a7a0cb4f097f235c50ecf8d4c628606d3415
PHP
matlae-ugly/magebit-test
/libs/bootstrap.php
UTF-8
676
2.859375
3
[]
no_license
<?php class Bootstrap { public function __construct() { //Getting the URL params as array where $url[0] is a controller name // and $url[1] is a controller method if ($_GET['url'] == NULL) { $url = explode('/', env('defaultRoute')); } else { $url = explode('/', rtrim($_GET['url'],'/')); } $file = 'controllers/' . $url[0] . '.php'; if (file_exists($file)) { require $file; $controller = new $url[0]; if (isset($url[1])) { $controller->{$url[1]}(); } } else { echo "404 not found"; } } }
true
c722ae7afa74e37f06801fe2ee07b89cd7e05dfd
PHP
ironhacker-sadigova/Inventory
/src/Orga/Domain/Service/WorkspaceConsistencyService.php
UTF-8
4,966
2.515625
3
[]
no_license
<?php /** * @author valentin.claras * @author diana.dragusin * @package Orga */ namespace Orga\Domain\Service; use Core\Translation\TranslatedString; use Core_Exception_NotFound; use Mnapoli\Translated\Translator; use Orga\Domain\Axis; use Orga\Domain\Granularity; use Orga\Domain\Workspace; /** * Controller du datagrid de coherence * @package Orga */ class WorkspaceConsistencyService { /** * @var Translator */ private $translator; public function __construct(Translator $translator) { $this->translator = $translator; } /** * Methode qui vérifie la cohérence d'un cube. * * @param Workspace $workspace * @return array(); */ public function check($workspace) { $listAxes = array(); $listParentsAxes = array(); $listParentsMembers = array(); $listChildrenAxes = array(); $listChildrenMembers = array(); $checkAxes = __('Orga', 'control', 'axisWithNoMember'); $checkBroaderMember = __('Orga', 'control', 'memberWithMissingDirectParent'); $checkNarrowerMember = __('Orga', 'control', 'memberWithNoDirectChild'); foreach ($workspace->getFirstOrderedAxes() as $axis) { if (!$axis->hasMembers()) { $listAxes[] = $this->translator->get($axis->getLabel()); } if ($axis->hasDirectBroaders()) { foreach ($axis->getDirectBroaders() as $broaderAxis) { foreach ($axis->getOrderedMembers() as $member) { try { $member->getParentForAxis($broaderAxis); } catch (Core_Exception_NotFound $e) { $listParentsAxes[] = $this->translator->get($axis->getLabel()); $listParentsMembers[] = $this->translator->get($member->getLabel()); } } foreach ($broaderAxis->getOrderedMembers() as $parentMember) { if (count($parentMember->getChildrenForAxis($axis)) === 0) { $listChildrenAxes[] = $this->translator->get($broaderAxis->getLabel()); $listChildrenMembers[] = $this->translator->get($parentMember->getLabel()); } } } } } $n = count($listAxes); $text1 = ''; $i = 0; foreach ($listAxes as $l1) { if ($i == $n - 1) { $text1 = $text1 . $l1; } else { $text1 = $text1 . $l1 . '; '; } $i++; } $text2 = ''; $m = count($listParentsAxes); for ($i = 0; $i <= $m - 1; $i++) { if ($i == $m - 1) { $text2 = $text2 . __('UI', 'name', 'axis') . __('UI', 'other', ':') . $listParentsAxes[$i] . __('UI', 'other', ';') . __('UI', 'name', 'elementSmallCap') . __( 'UI', 'other', ':' ) . $listParentsMembers[$i]; } else { $text2 = $text2 . __('UI', 'name', 'axis') . __('UI', 'other', ':') . $listParentsAxes[$i] . __('UI', 'other', ';') . __('UI', 'name', 'elementSmallCap') . __( 'UI', 'other', ':' ) . $listParentsMembers[$i] . ' / '; } } $text3 = ''; $l = count($listChildrenAxes); for ($i = 0; $i <= $l - 1; $i++) { if ($i == $l - 1) { $text3 = $text3 . __('UI', 'name', 'axis') . __('UI', 'other', ':') . $listChildrenAxes[$i] . __('UI', 'other', ';') . __('UI', 'name', 'elementSmallCap') . __( 'UI', 'other', ':' ) . $listChildrenMembers[$i]; } else { $text3 = $text3 . __('UI', 'name', 'axis') . __('UI', 'other', ':') . $listChildrenAxes[$i] . __('UI', 'other', ';') . __('UI', 'name', 'elementSmallCap') . __( 'UI', 'other', ':' ) . $listChildrenMembers[$i] . ' / '; } } $result = array(); $result['okAxis'] = empty($listAxes); $result['controlAxis'] = $checkAxes; $result['failureAxis'] = $text1; $result['okMemberParents'] = empty($listParentsAxes); $result['controlMemberParents'] = $checkBroaderMember; $result['failureMemberParents'] = $text2; $result['okMemberChildren'] = empty($listChildrenAxes); $result['controlMemberChildren'] = $checkNarrowerMember; $result['failureMemberChildren'] = $text3; return $result; } }
true
9b481317990d444f22b77b13b70dda9dac5d8a6a
PHP
comboyin/dbpwater
/class/acl.php
UTF-8
3,125
2.8125
3
[]
no_license
<?php class acl { private $_config; /** * @var router * */ public $_router; public function __construct( $config, $router ){ $this->_config = $config; $this->_router = $router; $this->init(); } private function init(){ // start session $session = session_id(); if(empty($session)){ session_start(); } $moduleName = $this->_router->module; $controllerName = $this->_router->controller; $actionName = $this->_router->action; if(!isset($_SESSION['acl']['account'])){ $accountTemp = new User(); $_SESSION['acl']['account'] = $accountTemp; } /* @var $account User */ $account = $_SESSION['acl']['account']; // check login form backend module if( $moduleName == 'user' ){ if( $account->getGroup()->getLevel() <= 0){ // redirect to login controller $this->redirect( $this->_router->url( array( 'module' => 'login' ) ) ); } } if($moduleName == 'error' && $controllerName == 'error404'){ return; } // check pemission account else if( !$this->checkPermission($moduleName, $controllerName, $actionName, $account->getGroup()->getLevel() )){ // redictect to deny page $this->redirect( $this->_router->url( array( 'module' => 'error', 'controller' => 'deny', 'action' => 'index' ) ) ); } } /** * Check permission * @param string $moduleName * @param string $controllerName * @param string $action * @param string $type * @return bool*/ public function checkPermission( $moduleName, $controllerName, $action, $type){ $config = $this->_config; $allow = $config['allow']; $deny = $config['deny']; $result = false; // check allow if(isset($allow[$moduleName][$controllerName])){ $permissionController = $allow[$moduleName][$controllerName]; // if isset "all" (all action) if(isset($permissionController['all'])){ if($permissionController['all'] == 'all'){ $result = true; }else if(in_array($type, $permissionController['all'])){ $result = true; } }else if(isset($permissionController[$action])){ if($permissionController[$action] == 'all'){ $result = true; }else if(in_array($type, $permissionController[$action])){ $result = true; } } } //check deny if(isset($deny[$moduleName][$controllerName])){ $permissionController = $deny[$moduleName][$controllerName]; // if isset "all" (all action) if(isset($permissionController['all'])){ if($permissionController['all'] == 'all'){ $result = false; }else if(in_array($type, $permissionController['all'])){ $result = false; } }else if(isset($permissionController[$action])){ if($permissionController[$action] == 'all'){ $result = false; }else if(in_array($type, $permissionController[$action])){ $result = false; } } } return $result; } public function redirect( $url ){ header("Location: ".$url); exit(0); } }
true
7b5ad1a8ce2836a488c9f536df6f6d70c673b167
PHP
MorganPfister/Comptes
/src/CDC/CoreBundle/Entity/BudgetInstance.php
UTF-8
2,935
2.515625
3
[]
no_license
<?php namespace CDC\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity * @ORM\Table(name="BudgetInstance") * @ORM\Entity(repositoryClass="CDC\CoreBundle\Repository\BudgetInstanceRepository") */ class BudgetInstance { protected $currentvalue; /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\ManyToOne(targetEntity="BudgetModele") * @ORM\JoinColumn(name="budgetmodele_id", referencedColumnName="id") **/ protected $budgetmodele; /** * @var @ORM\Column(type="decimal") */ protected $seuil; /** * @ORM\Column(type="datetime") */ protected $datestart; /** * @ORM\Column(type="datetime") */ protected $dateend; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set datestart * * @param \DateTime $datestart * * @return BudgetInstance */ public function setDatestart($datestart) { $this->datestart = $datestart; return $this; } /** * Get datestart * * @return \DateTime */ public function getDatestart() { return $this->datestart; } /** * Set dateend * * @param \DateTime $dateend * * @return BudgetInstance */ public function setDateend($dateend) { $this->dateend = $dateend; return $this; } /** * Get dateend * * @return \DateTime */ public function getDateend() { return $this->dateend; } /** * Set budgetmodele * * @param \CDC\CoreBundle\Entity\BudgetModele $budgetmodele * * @return BudgetInstance */ public function setBudgetmodele(\CDC\CoreBundle\Entity\BudgetModele $budgetmodele = null) { $this->budgetmodele = $budgetmodele; return $this; } /** * Get budgetmodele * * @return \CDC\CoreBundle\Entity\BudgetModele */ public function getBudgetmodele() { return $this->budgetmodele; } /** * Set seuil * * @param $seuil * * @return BudgetInstance */ public function setSeuil($seuil) { $this->seuil= $seuil; return $this; } /** * Get seuil * * @return \CDC\CoreBundle\Entity\BudgetModele */ public function getSeuil() { return $this->seuil; } /** * Set current value * * @param $value * * @return BudgetInstance */ public function setCurrentvalue($value){ $this->currentvalue = $value; return $this; } /** * Get current value * * @return float */ public function getCurrentvalue(){ return $this->currentvalue; } }
true
2ac3d248bc02341a180f8bd8d706e44e7f608ce2
PHP
hmimeee/article-management
/functions/DB.func.php
UTF-8
10,541
2.71875
3
[]
no_license
<?php //Insert data into any table function add_data($query,$connect,$message){ $result = $connect->query($query); if ($result === true) { $messagetype = "1"; } else { $messagetype = "0"; } $message1 = $connect->error; message($message,$messagetype); } //Check if data and return result function select_data($query,$connect){ $result = $connect->query($query); return $result; } //Update data into a table function update_data($query,$connect,$message){ $result = $connect->query($query); if ($result->num_rows > 0) { return $result; } if ($result === true) { $messagetype = "1"; } else { $messagetype = "0"; } $message1 = $connect->error; message($message,$message1,$messagetype); } //Delete data and return message function delete_data($query,$connect,$message){ $result = $connect->query($query); if ($result->num_rows > 0) { return $result; } if ($result === true) { $messagetype = "1"; } else { $messagetype = "0"; } $message1 = $connect->error; message($message,$message1,$messagetype); } function get_users($connect){ $sql = "SELECT * FROM users ORDER BY id ASC"; $result = $connect->query($sql); if ($result->num_rows > 0) { return $result; } } function get_user_data($connect,$id){ $sql = "SELECT * FROM users WHERE id=$id"; $result = $connect->query($sql); if ($result->num_rows > 0) { return $result->fetch_assoc(); } } function update_user_data($connect,$name,$email,$phone,$address,$payment_method,$payment_account,$fb_url,$twitter_url,$instagram_url,$picture,$id){ $sql = "UPDATE users SET name='$name',email='$email',phone='$phone',address='$address',payment_method='$payment_method',payment_account='$payment_account',fb_url='$fb_url',twitter_url='$twitter_url',instagram_url='$instagram_url',picture='$picture' WHERE id=$id"; $result = $connect->query($sql); if ($result === true) { return 1; } else { return 0; } } function update_password($connect,$new,$id){ $sql = "UPDATE users SET password = '$new' WHERE id = '$id'"; $result = $connect->query($sql); if ($result === true) { return 1; } else { return 0; } } function update_user($connect,$role,$quality,$rate,$id){ $sql = "UPDATE users SET role='$role',rate='$rate',quality='$quality' WHERE id = '$id'"; $result = $connect->query($sql); if ($result === true) { return 1; } else { return 0; } } function delete_user($connect,$id){ $sql = "DELETE FROM users WHERE id='$id'"; $result = $connect->query($sql); if ($result === true) { return 1; } else { return 0; } } function get_roles($connect){ $sql = "SELECT * FROM roles"; $result = $connect->query($sql); if ($result->num_rows > 0) { return $result; } } function get_role_name($connect,$id){ $sql = "SELECT * FROM roles WHERE id=$id"; $rslt = $connect->query($sql); $result = $rslt->fetch_assoc(); if ($rslt->num_rows > 0) { return $result['name']; } else { return "No role found"; } } function get_projects($connect){ //ORDER BY deadline ASC $sql = "SELECT * FROM projects WHERE status='' OR status=0 OR status=1"; $result = $connect->query($sql); return $result; } function get_project($connect,$id){ $sql = "SELECT * FROM projects WHERE id='$id'"; $result = $connect->query($sql); if ($result->num_rows > 0) { return $result->fetch_assoc(); } else { return "0"; } } function create_project($connect,$name,$description,$creator,$deadline,$created){ $description = base64_encode($description); $sql = "INSERT INTO projects VALUES ('','$name','$description','$creator','$deadline','$created',0)"; $result = $connect->query($sql); if ($result === true) { return 1; } else { return 0; } } function update_project($connect,$name,$description,$deadline,$id){ $description = base64_encode($description); $sql = "UPDATE projects SET name='$name',description='$description',deadline='$deadline' WHERE id=$id"; $result = $connect->query($sql); if ($result === true) { return 1; } else { return 0; } } function delete_project($connect,$id){ $sql = "DELETE FROM projects WHERE id=$id"; $result = $connect->query($sql); if ($result === true) { return "1"; } else { return "0"; } } function get_project_by_id($connect,$id){ $sql = "SELECT * FROM projects WHERE id=$id"; $result = $connect->query($sql); if ($result->num_rows > 0) { return $result->fetch_assoc(); } else { return "0"; } } function create_task($connect,$name,$description,$assignee,$creator,$words,$rate,$type,$project,$deadline,$publishing,$priority){ if ($name =="") { return 0; } else { $description = base64_encode($description); $sql = "INSERT INTO tasks (name,description,assignee,creator,words,rate,type,project,deadline,status,publishing,priority) VALUES ('$name','$description','$assignee','$creator','$words','$rate','$type','$project','$deadline',0,'$publishing','$priority')"; $result = $connect->query($sql); if ($result === true) { return 1; } else { return $connect->error; } } } function update_task($connect,$name,$description,$assignee,$creator,$words,$rate,$type,$project,$deadline,$publishing,$priority,$id){ $description = base64_encode($description); $sql = "UPDATE tasks SET name='$name', description='$description', assignee='$assignee', creator='$creator', words='$words', rate='$rate', type='$type', project='$project', deadline='$deadline', publishing='$publishing', priority='$priority' WHERE id=$id"; $result = $connect->query($sql); if ($result === true) { return 1; } else { return 0; } } function update_task_payment($connect,$invoice,$status,$id){ $sql = "UPDATE tasks SET status=$status, invoice='$invoice' WHERE id=$id"; $result = $connect->query($sql); if ($result === true) { return 1; } else { return 0; } } function get_tasks($connect,$status=0){ if ($status ==0) { $sql = "SELECT * FROM tasks ORDER BY deadline,priority DESC"; } else { $sql = "SELECT * FROM tasks WHERE status='$status' ORDER BY deadline,priority DESC"; } $result = $connect->query($sql); return $result; } function get_tasks_by_project($connect,$project){ $sql = "SELECT * FROM tasks WHERE project=$project ORDER BY deadline ASC,priority DESC"; $result = $connect->query($sql); return $result; } function get_tasks_by_assignee($connect,$assignee,$status=0){ if ($status ==0) { $sql = "SELECT * FROM tasks WHERE (status='0' OR status='1') AND assignee=$assignee "; } else { $sql = "SELECT * FROM tasks WHERE status='$status' AND assignee=$assignee"; } $result = $connect->query($sql); return $result; } function get_tasks_by_creator($connect,$creator,$status=0){ if ($status ==0) { $sql = "SELECT * FROM tasks WHERE (status='0' OR status='1') AND creator=$creator"; } else { $sql = "SELECT * FROM tasks WHERE status='$status' AND creator=$creator"; } $result = $connect->query($sql); return $result; } function get_tasks_by_publisher($connect,$publisher,$status=0){ if ($status ==0) { $sql = "SELECT * FROM tasks WHERE (publish_status=0 OR publish_status=1) AND publisher=$publisher"; } else { $sql = "SELECT * FROM tasks WHERE publish_status='$status' AND publisher=$publisher"; } $result = $connect->query($sql); return $result; } function get_paid_tasks_number($connect,$assignee){ $sql = "SELECT * FROM tasks WHERE status=4 AND assignee=$assignee"; $result = $connect->query($sql); return $result->num_rows; } function get_tasks_by_invoice($connect,$invoice){ $sql = "SELECT * FROM tasks WHERE status=4 AND invoice='$invoice'"; $result = $connect->query($sql); return $result; } function get_task_data($connect,$id){ $sql = "SELECT * FROM tasks WHERE id=$id"; $result = $connect->query($sql); if ($result->num_rows > 0) { return $result; } } function delete_task($connect,$id){ $sql = "DELETE FROM tasks WHERE id=$id"; $result = $connect->query($sql); if ($result === true) { return "1"; } else { return "0"; } } function delete_tasks($connect,$data){ foreach($data as $key=>$value){ if("id_" == substr($key,0,3)){ $number = "id".substr($key,strrpos($key,'_')); $sql = "DELETE FROM tasks WHERE id=$_POST[$number]"; $batch = $connect->query($sql); } } } function create_invoice($connect,$name,$paid,$words,$paid_to){ $sql = "INSERT INTO invoice (name,paid,words,paid_to,creation_date) VALUES ('$name','$paid','$words','$paid_to',CURRENT_TIMESTAMP)"; $result = $connect->query($sql); if ($result === true) { return 1; } else { return 0; } } function get_invoice_by_name($connect,$name){ $sql = "SELECT * FROM invoice WHERE name='$name'"; $result = $connect->query($sql); if ($result->num_rows > 0) { return $result->fetch_assoc(); } else { return "0"; } } function get_invoices($connect,$status=0){ if ($status==0) { $sql = "SELECT * FROM invoice"; } else { $sql = "SELECT * FROM invoice WHERE status=$status"; } $result = $connect->query($sql); return $result; } function get_invoices_by_user($connect,$id){ $sql = "SELECT * FROM invoice WHERE paid_to=$id"; $result = $connect->query($sql); return $result; } function get_invoices_report($connect,$date){ $sql = "SELECT * FROM invoice WHERE status=1 AND paid_date LIKE '%$date%'"; $result = $connect->query($sql); return $result; } function get_invoice_data($connect,$id){ $sql = "SELECT * FROM invoice WHERE id=$id"; $result = $connect->query($sql); return $result->fetch_assoc(); } function delete_invoice($connect,$id){ $sql = "DELETE FROM invoice WHERE id=$id"; $result = $connect->query($sql); if ($result===true) { return 1; } else { return 0; } } //Comments function create_comment($connect,$comment_of,$creator,$comment,$file,$comment_type){ $comment = base64_encode($comment); $sql = "INSERT INTO comments (comment_of,creator,comment,file,type,creation_date) VALUES ('$comment_of','$creator','$comment','$file','$comment_type',CURRENT_TIMESTAMP)"; $result = $connect->query($sql); if ($result === true) { return 1; } else { return 0; } } function get_all_comments($connect,$limit=10){ $sql = "SELECT * FROM comments ORDER BY id DESC LIMIT $limit"; $result = $connect->query($sql); return $result; } function get_comments($connect,$comment_type,$comment_of){ $sql = "SELECT * FROM comments WHERE comment_of='$comment_of' AND type='$comment_type' ORDER BY id DESC"; $result = $connect->query($sql); return $result; } function delete_comment($connect,$id){ $sql = "DELETE FROM comments WHERE id=$id"; $result = $connect->query($sql); if ($result === true) { return 1; } else { return 0; } } ?>
true
3e10617178a1e7e5e15a72a8963b0666b2e9d3fc
PHP
cosnicsTHLU/cosnics
/src/Chamilo/Application/Weblcms/Tool/Implementation/Assignment/Table/Publication/PublicationTableCellRenderer.php
UTF-8
6,751
2.515625
3
[ "MIT" ]
permissive
<?php namespace Chamilo\Application\Weblcms\Tool\Implementation\Assignment\Table\Publication; use Chamilo\Application\Weblcms\Rights\WeblcmsRights; use Chamilo\Application\Weblcms\Storage\DataClass\ContentObjectPublication; use Chamilo\Application\Weblcms\Table\Publication\Table\ObjectPublicationTableCellRenderer; use Chamilo\Application\Weblcms\Tool\Implementation\Assignment\Manager; use Chamilo\Core\Repository\ContentObject\Assignment\Storage\DataClass\Assignment; use Chamilo\Core\Repository\Storage\DataClass\ContentObject; use Chamilo\Libraries\Format\Theme; use Chamilo\Libraries\Platform\Translation; use Chamilo\Libraries\Storage\DataManager\DataManager; use Chamilo\Libraries\Storage\Parameters\DataClassCountParameters; use Chamilo\Libraries\Storage\Query\Condition\EqualityCondition; use Chamilo\Libraries\Storage\Query\Variable\PropertyConditionVariable; use Chamilo\Libraries\Storage\Query\Variable\StaticConditionVariable; use Chamilo\Libraries\Utilities\DatetimeUtilities; use Chamilo\Libraries\Utilities\StringUtilities; use Chamilo\Libraries\Utilities\Utilities; /** * Extension on the content object publication table cell renderer for this tool * * @author Sven Vanpoucke - Hogeschool Gent */ class PublicationTableCellRenderer extends ObjectPublicationTableCellRenderer { /** * ************************************************************************************************************** * Inherited Functionality * * ************************************************************************************************************** */ /** * Renders a cell for a given object * * @param $column \libraries\ObjectTableColumn * * @param mixed $publication * * @return String */ public function render_cell($column, $publication) { $content_object = $this->get_component()->get_content_object_from_publication($publication); switch ($column->get_name()) { case ContentObject::PROPERTY_TITLE : return $this->generate_title_link($publication); case Assignment::PROPERTY_END_TIME : $time = $content_object->get_end_time(); $date_format = Translation::get('DateTimeFormatLong', null, Utilities::COMMON_LIBRARIES); $time = DatetimeUtilities::format_locale_date($date_format, $time); if ($publication[ContentObjectPublication::PROPERTY_HIDDEN]) { return '<span style="color: gray">' . $time . '</span>'; } return $time; case Manager::PROPERTY_NUMBER_OF_SUBMISSIONS : $tracker = new \Chamilo\Application\Weblcms\Integration\Chamilo\Core\Tracking\Storage\DataClass\AssignmentSubmission(); $condition = new EqualityCondition( new PropertyConditionVariable( \Chamilo\Application\Weblcms\Integration\Chamilo\Core\Tracking\Storage\DataClass\AssignmentSubmission::class_name(), \Chamilo\Application\Weblcms\Integration\Chamilo\Core\Tracking\Storage\DataClass\AssignmentSubmission::PROPERTY_PUBLICATION_ID), new StaticConditionVariable($publication[ContentObjectPublication::PROPERTY_ID])); return DataManager::count( \Chamilo\Application\Weblcms\Integration\Chamilo\Core\Tracking\Storage\DataClass\AssignmentSubmission::class_name(), new DataClassCountParameters($condition)); case Assignment::PROPERTY_ALLOW_GROUP_SUBMISSIONS : if ($content_object->get_allow_group_submissions()) { return '<img src="' . Theme::getInstance()->getImagePath( 'Chamilo\Application\Weblcms\Tool\Implementation\Assignment', 'Type/Group') . '" alt="' . Translation::get('GroupAssignment') . '" title="' . Translation::get('GroupAssignment') . '"/>'; } return '<img src="' . Theme::getInstance()->getImagePath( 'Chamilo\Application\Weblcms\Tool\Implementation\Assignment', 'Type/Individual') . '" alt="' . Translation::get('IndividualAssignment') . '" title="' . Translation::get('IndividualAssignment') . '"/>'; } return parent::render_cell($column, $publication); } /** * Generated the HTML for the title column, including link, depending on the status of the current browsing user. * * @param $publication type The publication for which the title link is to be generated. * @return string The HTML for the link in the title column. */ private function generate_title_link($publication) { if ($this->get_component()->is_allowed(WeblcmsRights::EDIT_RIGHT)) { return $this->generate_teacher_title_link($publication); } return $this->generate_student_title_link($publication); } /** * Generates the link applicable for the current browsing user being a teacher or admin. * * @param $publication type The publication for which the link is being generated. * @return string The HTML anchor elemnt that represents the link. */ private function generate_teacher_title_link($publication) { $url = $this->get_component()->get_url( array( \Chamilo\Application\Weblcms\Tool\Manager::PARAM_PUBLICATION_ID => $publication[ContentObjectPublication::PROPERTY_ID], \Chamilo\Application\Weblcms\Tool\Manager::PARAM_ACTION => Manager::ACTION_BROWSE_SUBMITTERS)); return '<a href="' . $url . '">' . StringUtilities::getInstance()->truncate($publication[ContentObject::PROPERTY_TITLE], 50) . '</a>'; } /** * Generates the link applicable for the current browsing user being a student. * * @param $publication type The publication for which the link is being generated. * @return string The HTML anchor element that represents the link. */ private function generate_student_title_link($publication) { $url = $this->get_component()->get_url( array( \Chamilo\Application\Weblcms\Tool\Manager::PARAM_ACTION => Manager::ACTION_STUDENT_BROWSE_SUBMISSIONS, \Chamilo\Application\Weblcms\Tool\Manager::PARAM_PUBLICATION_ID => $publication[ContentObjectPublication::PROPERTY_ID])); return '<a href="' . $url . '">' . StringUtilities::getInstance()->truncate($publication[ContentObject::PROPERTY_TITLE], 50) . '</a>'; } }
true
fc297c012bca9bb27d713f81ee958645f2fdc80b
PHP
bluegate010/ysaward
/newpwd.php
UTF-8
2,868
2.5625
3
[ "MIT" ]
permissive
<?php require_once "lib/init.php"; if ($MEMBER || $LEADER) // If logged in... just go to directory. header("Location: /directory.php"); if (!isset($_GET['key'])) die("Oops! Couldn't find any password reset token. Make sure you clicked on the link in the email or copied the entire link... "); // Valid key? $key = ''; $credID = 0; if (isset($_GET['key'])) { $key = DB::Safe($_GET['key']); $q = "SELECT * FROM PwdResetTokens WHERE Token='{$key}' LIMIT 1"; $r = DB::Run($q); if (mysql_num_rows($r) == 0) die("ERROR > Sorry, that is not a valid password reset token. Please go back to your email and try again?"); // Get the associated credentials ID... $row = mysql_fetch_array($r); $credID = $row['CredentialsID']; if (!$credID) die("ERROR > That token doesn't seem associated with any account..."); // Make sure it hasn't expired; delete it if it has $tokenID = $row['ID']; $tooLate = strtotime("+48 hours", strtotime($row['Timestamp'])); if (time() > $tooLate) { DB::Run("DELETE FROM PwdResetTokens WHERE ID='$tokenID' LIMIT 1"); die("ERROR > Sorry, that token has expired. They only last 48 hours."); } } ?> <!DOCTYPE html> <html> <head> <title>Finish password reset &mdash; <?php echo SITE_NAME; ?></title> <?php include "includes/head.php"; ?> </head> <body class="narrow"> <form method="post" action="/api/resetpwd-finish.php"> <div class="text-center"> <a href="/"> <img src="<?php echo SITE_LARGE_IMG; ?>" alt="<?php echo SITE_NAME; ?>" class="logo-big"> </a> <h1>Reset Password</h1> <p> Type your new password below, then try logging in. Don't use the same password you use on other sites. </p> <input type="password" name="pwd1" placeholder="New password" required> <input type="password" name="pwd2" placeholder="Password again" required> <input type="hidden" name="credID" value="<?php echo($credID); ?>"> <input type="hidden" name="token" value="<?php echo($key); ?>"> <div class="text-right"> <button type="submit">Finish</button> </div> <br> </div> </form> <?php include "includes/footer.php"; ?> <script> $(function() { $("input").first().focus(); // TODO Make this the thing for every page? var redirecting = false; $('form').hijax({ before: function() { $('[type=submit]').showSpinner(); return !redirecting; }, complete: function(xhr) { if (xhr.status == 200) { _gaq.push(['_trackEvent', 'Account', 'Submit Form', 'Reset Finished']); $.sticky("Password changed! Going to login..."); setTimeout(function() { window.location = '/'; }, 3500); redirecting = true; } else { $.sticky(xhr.responseText || "Something went wrong. Check your connection and try again.", { classList: 'error' }); $('[type=submit]').hideSpinner(); } } }); }); </script> </body> </html>
true
cddea5e2fabd97c3c049ae6f778159835a83a8ba
PHP
bitJun/vue-tb
/h5/app/Model/Member.php
UTF-8
318
2.53125
3
[ "MIT" ]
permissive
<?php namespace App\Model; use Illuminate\Database\Eloquent\Model; class Member extends Model { protected $table = ''; protected $guarded = []; public function __construct($member_id = '') { parent::__construct(); $this->table = $member_id ? 'member_'.($member_id % 100) : ''; } }
true
f8c639eac54489cefcc6faf4d183ad40d8b478ca
PHP
jiangyu7408/notification
/tests/unit/Storage/RedisStorageFactoryTest.php
UTF-8
797
2.515625
3
[ "Unlicense" ]
permissive
<?php /** * Created by PhpStorm. * User: Jiang Yu * Date: 2015/07/03 * Time: 1:24 PM */ namespace Persistency\Storage; class RedisStorageFactoryTest extends \PHPUnit_Framework_TestCase { /** * @var array */ protected $options; public function testFactory() { $prefix = 'test'; $factory = new RedisStorageFactory(); $redisStorage = $factory->create($this->options, $prefix); static::assertInstanceOf(RedisStorage::class, $redisStorage); static::assertEquals($prefix, $redisStorage->getPrefix()); } protected function setUp() { $this->options = [ 'scheme' => 'tcp', 'host' => '127.0.0.1', 'port' => 6379, 'timeout' => 5.0 ]; } }
true
914e2d555422855fd273f97ceff646e9e1a0e7ee
PHP
steel1989/teste2
/reporte_ok.php
UTF-8
7,083
2.59375
3
[]
no_license
<?php //Incluimos librería y archivo de conexión require 'Classes/PHPExcel.php'; require 'conexion.php'; //Consulta $sql = "SELECT trani.quantidade, tran.data, tran.tipo_transacao, cli.nome, ven.nome, ite.quantidade, ite.valor FROM transacao_item trani INNER JOIN transacao tran ON trani.id_transacao = tran.id_trancasao INNER JOIN cliente cli ON cli.id_cliente = trani.id_transacaoitem INNER JOIN vendedor ven ON ven.id_vendedor = trani.id_transacaoitem INNER JOIN item ite ON trani.id_item = ite.id_item"; $resultado = $mysqli->query($sql); $fila = 7; //Establecemos en que fila inciara a imprimir los datos $gdImage = imagecreatefrompng('images/logo.png');//Logotipo //Objeto de PHPExcel $objPHPExcel = new PHPExcel(); //Propiedades de Documento $objPHPExcel->getProperties()->setCreator("Ansony Martinez")->setDescription("Relatorio de vendas"); //Establecemos la pestaña activa y nombre a la pestaña $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setTitle("Relatorio"); $objDrawing = new PHPExcel_Worksheet_MemoryDrawing(); $objDrawing->setName('Logotipo'); $objDrawing->setDescription('Logotipo'); $objDrawing->setImageResource($gdImage); $objDrawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG); $objDrawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT); $objDrawing->setHeight(100); $objDrawing->setCoordinates('A1'); $objDrawing->setWorksheet($objPHPExcel->getActiveSheet()); $estiloTituloReporte = array( 'font' => array( 'name' => 'Arial', 'bold' => true, 'italic' => false, 'strike' => false, 'size' =>13 ), 'fill' => array( 'type' => PHPExcel_Style_Fill::FILL_SOLID ), 'borders' => array( 'allborders' => array( 'style' => PHPExcel_Style_Border::BORDER_NONE ) ), 'alignment' => array( 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER ) ); $estiloTituloColumnas = array( 'font' => array( 'name' => 'Arial', 'bold' => true, 'size' =>10, 'color' => array( 'rgb' => 'FFFFFF' ) ), 'fill' => array( 'type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => '538DD5') ), 'borders' => array( 'allborders' => array( 'style' => PHPExcel_Style_Border::BORDER_THIN ) ), 'alignment' => array( 'horizontal'=> PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER ) ); $estiloInformacion = new PHPExcel_Style(); $estiloInformacion->applyFromArray( array( 'font' => array( 'name' => 'Arial', 'color' => array( 'rgb' => '000000' ) ), 'fill' => array( 'type' => PHPExcel_Style_Fill::FILL_SOLID ), 'borders' => array( 'allborders' => array( 'style' => PHPExcel_Style_Border::BORDER_THIN ) ), 'alignment' => array( 'horizontal'=> PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER ) )); $objPHPExcel->getActiveSheet()->getStyle('A1:E4')->applyFromArray($estiloTituloReporte); $objPHPExcel->getActiveSheet()->getStyle('A6:O6')->applyFromArray($estiloTituloColumnas); $objPHPExcel->getActiveSheet()->setCellValue('B3', 'RELATORIO DE VENDAS'); $objPHPExcel->getActiveSheet()->mergeCells('B3:D3'); $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(10); $objPHPExcel->getActiveSheet()->setCellValue('A6', 'cliente'); $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(30); $objPHPExcel->getActiveSheet()->setCellValue('B6', 'vendedor'); $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(10); $objPHPExcel->getActiveSheet()->setCellValue('C6', 'JAN'); $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10); $objPHPExcel->getActiveSheet()->setCellValue('D6', 'FEV'); $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(10); $objPHPExcel->getActiveSheet()->setCellValue('E6', 'MAR'); $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(10); $objPHPExcel->getActiveSheet()->setCellValue('E6', 'ABR'); $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(10); $objPHPExcel->getActiveSheet()->setCellValue('E6', 'MAI'); $objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(10); $objPHPExcel->getActiveSheet()->setCellValue('E6', 'JUN'); $objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(10); $objPHPExcel->getActiveSheet()->setCellValue('E6', 'JUL'); $objPHPExcel->getActiveSheet()->getColumnDimension('J')->setWidth(10); $objPHPExcel->getActiveSheet()->setCellValue('E6', 'AGOSTO'); $objPHPExcel->getActiveSheet()->getColumnDimension('K')->setWidth(10); $objPHPExcel->getActiveSheet()->setCellValue('E6', 'SET'); $objPHPExcel->getActiveSheet()->getColumnDimension('L')->setWidth(10); $objPHPExcel->getActiveSheet()->setCellValue('E6', 'OUT'); $objPHPExcel->getActiveSheet()->getColumnDimension('N')->setWidth(10); $objPHPExcel->getActiveSheet()->setCellValue('E6', 'NOV'); $objPHPExcel->getActiveSheet()->getColumnDimension('M')->setWidth(10); $objPHPExcel->getActiveSheet()->setCellValue('E6', 'DEZ'); $objPHPExcel->getActiveSheet()->getColumnDimension('O')->setWidth(10); $objPHPExcel->getActiveSheet()->setCellValue('E6', 'TOTAL'); //Recorremos los resultados de la consulta y los imprimimos while($rows = $resultado->fetch_assoc()){ $objPHPExcel->getActiveSheet()->setCellValue('A'.$fila, $rows['nome']); $objPHPExcel->getActiveSheet()->setCellValue('B'.$fila, $rows['nome']); $objPHPExcel->getActiveSheet()->setCellValue('C'.$fila, $rows['data']); $objPHPExcel->getActiveSheet()->setCellValue('D'.$fila, $rows['existencia']); $objPHPExcel->getActiveSheet()->setCellValue('E'.$fila, $rows['existencia']); $objPHPExcel->getActiveSheet()->setCellValue('F'.$fila, $rows['existencia']); $objPHPExcel->getActiveSheet()->setCellValue('G'.$fila, $rows['existencia']); $objPHPExcel->getActiveSheet()->setCellValue('H'.$fila, $rows['existencia']); $objPHPExcel->getActiveSheet()->setCellValue('I'.$fila, $rows['existencia']); $objPHPExcel->getActiveSheet()->setCellValue('J'.$fila, $rows['existencia']); $objPHPExcel->getActiveSheet()->setCellValue('K'.$fila, $rows['existencia']); $objPHPExcel->getActiveSheet()->setCellValue('L'.$fila, $rows['existencia']); $objPHPExcel->getActiveSheet()->setCellValue('N'.$fila, $rows['existencia']); $objPHPExcel->getActiveSheet()->setCellValue('M'.$fila, $rows['existencia']); $objPHPExcel->getActiveSheet()->setCellValue('O'.$fila, '=C'.$fila.'*D'.$fila); $fila++; //Sumamos 1 para pasar a la siguiente fila } header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); header('Content-Disposition: attachment;filename="Productos.xlsx"'); header('Cache-Control: max-age=0'); $writer->save('php://output'); ?>
true
4a7ec5e4fff0aeceaaad342953e915c81a6a496c
PHP
akilawww/blend_myself
/database/seeds/RecipesTableSeeder.php
UTF-8
2,733
2.515625
3
[]
no_license
<?php use Illuminate\Database\Seeder; use Carbon\Carbon; class RecipesTableSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { // recipe 1 App\Recipe::create([ 'title' => 'ジンバック', 'body' => 'さっぱりしていて美味しい', 'image' => '/storage/testdata/ジンバック.jpg', 'user_id' => 2, 'created_at' => Carbon::now()->subDays(32), 'updated_at' => Carbon::now()->subDays(32), ]); // recipe 2 App\Recipe::create([ 'title' => 'ブラックルシアン', 'body' => 'めちゃ甘い', 'image' => '/storage/testdata/ブラックルシアン.jpg', 'user_id' => 1, 'created_at' => Carbon::now()->subDays(32), 'updated_at' => Carbon::now()->subDays(32), ]); // recipe 3 App\Recipe::create([ 'title' => 'チャールストンソーダ', 'body' => '名前がオシャレ', 'image' => '/storage/testdata/チャールストンソーダ.jpg', 'user_id' => 1, 'created_at' => Carbon::now()->subDays(32), 'updated_at' => Carbon::now()->subDays(32), ]); // recipe 4 App\Recipe::create([ 'title' => 'ジムハイボール', 'body' => '王道なハイボール', 'image' => '/storage/testdata/ジムハイボール.jpg', 'user_id' => 1, 'created_at' => Carbon::now()->subDays(32), 'updated_at' => Carbon::now()->subDays(32), ]); // recipe 5 App\Recipe::create([ 'title' => 'グリーンアイズ', 'body' => '南国の風味がする夏向きカクテル。メロンリキュールとラムの香りのハーモニー、パイナップルの酸味とココナッツミルクの滑らかな口当たり。メロンリキュール界の革命児カワサキによる革新的(kawasaki SuperEdition)', 'image' => '/storage/testdata/グリーンアイズ.jpg', 'user_id' => 1, 'created_at' => Carbon::now()->subDays(32), 'updated_at' => Carbon::now(), ]); // recipe 6 App\Recipe::create([ 'title' => 'カルーアミルク', 'body' => 'コーヒーミルクのようなカクテル', 'image' => '/storage/testdata/カルーアミルク.jpg', 'user_id' => 1, 'created_at' => Carbon::now()->subDays(32), 'updated_at' => Carbon::now(), ]); // recipe 7 App\Recipe::create([ 'title' => 'アイスの実の革命', 'body' => 'カクテルカラフルで見ていて楽しくなります', 'image' => '/storage/testdata/ice.jpg', 'user_id' => 1, 'created_at' => Carbon::now()->subDays(32), 'updated_at' => Carbon::now()->subDays(32), ]); } }
true
c074ed1342f438297022888ef9988b3a600f069f
PHP
WangSHo/honghong
/0115.php
GB18030
1,465
3.5625
4
[]
no_license
<title>﷨</title> <?php //ת /* $a="132bdhssb"; $b="122"; echo $a+$b; */ // //ǿת $a="123.22352sbdvlf"; $b=(bool)$a; $c=(float)$a; $d=(array)$a; $str=floatval($a); settype($a, "bool"); //settype()ñͣ var_dump($b); echo "<br />"; var_dump($c); echo "<br />"; var_dump($d); echo "<br />"; var_dump($str); echo "<br />"; var_dump($a); echo "<br />"; //ɱ $h="hello"; $$h="word"; echo $h.$$h; echo "<br />"; //Ԥ echo ($_SERVER['REMOTE_ADDR']); echo "<br />"; echo ($_SERVER['REMOTE_PORT']); echo "<br />"; //ȫֱ global $a=123; function a(){ global $a; echo $a; } a(); //̬ /* function a(){ static $i=0; // ̬ $i+=1; echo $i; } for($i=0; $i<10;$i++){ a(); } */ echo "<hr />"; ?> <form action="0115test.php" method="get"> <!--method="post" get:ȫ post:ȫ --> <input type="text" name="txt1"> <input type="password" name="txt2"> <input type="submit" value="ύ" name="btn_ok"> </form> <?php echo "<hr />"; // define("ABC", 100); echo ABC; echo "<br />"; //define($name, $value,boool) boolΪtrueʱִСд //ϵͳеԤ峣 echo PHP_OS; echo "<br />"; echo PHP_VERSION; echo "<br />"; echo TRUE; echo "<br />"; echo "<br />"; //PHPеħ echo __FILE__; //ǰļ echo "<br />"; echo __LINE__; //ǰ echo "<br />"; ?>
true
92f01cdab5210707d90adb1fe38d9cd3fa8ee93b
PHP
creeartelo-desarrollo/SoundTube
/application/models/Showroom_model.php
UTF-8
1,619
2.578125
3
[]
no_license
<?php class Showroom_model extends CI_Model { public function __construct() { $this->load->database(); } # Consulta videos del ShowRoom function CNS_Showroom(){ $this->db->select("*"); $this->db->from("Showroom"); $query = $this->db->get(); return $query->result_array(); } # Inserta video en tabla function INS_Showroom($dataarray) { $this->db->insert("Showroom",$dataarray); return $this->db->insert_id(); } # Actualiza video en tabla function UPD_Showroom($Id_Showroom, $dataarray) { $this->db->where("Id_Showroom",$Id_Showroom); $this->db->update("Showroom",$dataarray); return $this->db->affected_rows(); } # Consulta que el Id_Video sea unico function CNS_UQVideo($Id_Video,$Id_Showroom){ $this->db->select("Id_Video"); $this->db->from("Showroom"); $this->db->where("Id_Video",$Id_Video); if($Id_Showroom != ""){ $this->db->where("Id_Showroom !=",$Id_Showroom); } return $this->db->count_all_results(); } # Consulta un registro por su ID function CNS_ShowroomById($Id_Showroom){ $this->db->select("*"); $this->db->from("Showroom"); $this->db->where("Id_Showroom",$Id_Showroom); $query = $this->db->get(); return $query->row(); } # Elimina registro function DEL_Showroom($Id_Showroom){ $this->db->where("Id_Showroom",$Id_Showroom); $this->db->delete("Showroom"); return $this->db->affected_rows(); } } ?>
true
dd2262a22daf1b12e95862ee6bb824bdaef35a57
PHP
dscheinah/pwsafe
/src/lib/sx/Container/Container.php
UTF-8
1,325
3.1875
3
[]
no_license
<?php namespace Sx\Container; use Psr\Container\ContainerInterface; /** * A very simple implementation of the corresponding PSR interface. * This can be used as standalone or base for other containers like done with the Injector in this package. * * @package Sx\Container */ class Container implements ContainerInterface { /** * This property holds the data as simple key/ value pairs. * * @var array */ private $stack = []; /** * Returns the value for the given ID and throws an exception if the value was not set before. * * @param string $id * * @return mixed * @throws NotFoundException */ public function get($id) { if (!$this->has($id)) { throw new NotFoundException(sprintf('%s: unable to get %s', \get_class($this), $id)); } return $this->stack[$id]; } /** * Checks if a value was set for the given ID. * * @param string $id * * @return bool */ public function has($id): bool { return isset($this->stack[$id]); } /** * Sets an arbitrary value for the given ID. * * @param string $id * @param mixed $value */ public function set(string $id, $value): void { $this->stack[$id] = $value; } }
true
ef3dc32c1c5e03cf437acef5cb64cc0efd613fb1
PHP
efique/testunitaire
/src/Product.php
UTF-8
737
3.359375
3
[]
no_license
<?php namespace App; use LogicException; class Product { /** @var string */ const FOOD_PRODUCT = 'food'; /** @var string */ private $name; /** @var string */ private $type; /** @var float */ private $price; public function __construct(string $name, string $type, float $price) { $this->name = $name; $this->type = $type; $this->price = $price; } public function computeTva() { if($this->price < 0) { throw new LogicException('la tva et le prix ne peuvent pas être négatif'); } if (self::FOOD_PRODUCT == $this->type) { return $this->price * 0.055; } return $this->price * 0.196; } }
true
4f77c4316d7cff9d2a5bbfaaaa4f4616f7a803c1
PHP
turag/GOLAM-SHAFI-AFROZE-PORTFOLIO-
/admin/changepassword.php
UTF-8
2,443
2.640625
3
[]
no_license
<?php include 'include/head.php'; ?> <div id="content-wrapper"> <div class="container-fluid"> <div class="row"> <div class="col-md-4"> <h5>Change Password</h5> <?php if (isset($_POST['change'])){ $oldp = $_POST['oldp']; $oldp_has = password_hash($oldp, PASSWORD_DEFAULT); $newp1 = $_POST['newp1']; $newp2 = $_POST['newp2']; $id = $_SESSION['id']; if (!password_verify($oldp, $_SESSION['pass'])){ echo 'Wrong Old Password'; } else{ if($newp1 !== $newp2){ echo 'New Password & Password Again Not Match'; } else{ $new_pass = password_hash($newp1, PASSWORD_DEFAULT); $done_sql = "UPDATE b_user SET pass='$new_pass' WHERE id='$id'"; $done = mysqli_query($con, $done_sql); if($done){ $_SESSION['pass'] = $new_pass; echo 'Password Change'; } else{ echo 'error'; } } } } ?> <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" class="form-group"> <label for="oldp">Enter Old Password*</label> <input id="oldp" name="oldp" type="password" class="form-control" placeholder="Enter Your Old Password" required> <label for="newp1">Enter New Password*</label> <input id="newp1" name="newp1" type="password" class="form-control" placeholder="Enter Your New Password" required> <label for="newp2">Enter New Password Again*</label> <input id="oldp2" name="newp2" type="password" class="form-control" placeholder="Enter Your New Password Again" required> <br> <button name="change" class="btn btn-dark"> Change Password</button> </form> </div> </div> </div> </div> <?php include 'include/footer.php'; ?>
true
9e9054ad9737df5209dc43b8dc865742daf98ab2
PHP
qrichert/goji
/src/Admin/Controller/XhrInPageContentEditController.class.php
UTF-8
1,091
2.59375
3
[ "MIT" ]
permissive
<?php namespace Admin\Controller; use Goji\Blueprints\XhrControllerAbstract; use Goji\Core\HttpResponse; use Goji\Rendering\InPageEditableContent; class XhrInPageContentEditController extends XhrControllerAbstract { public function render(): void { $action = $_POST['action'] ?? null; $contentId = $_POST['content-id'] ?? null; $pageId = $_POST['page-id'] ?? null; $locale = $this->m_app->getLanguages()->getCurrentCountryCode(); $content = (string) $_POST['content'] ?? ''; if (empty($action) || empty($contentId) || empty($pageId)) { HttpResponse::JSON([], false); } if ($action == 'get-formatted-content') { HttpResponse::JSON([ 'content' => InPageEditableContent::formatContent($content) ], true); } else if ($action == 'save-content') { // string $contentId, string $pageId, string $locale = null $editableContent = new InPageEditableContent($this->m_app, $contentId, $pageId, $locale); $editableContent->updateContent($content); HttpResponse::JSON([ 'content' => $editableContent->getFormattedContent() ], true); } } }
true
f6be0888e2470876bdccab5168659a8db8fe5d6d
PHP
diasonti/online-auction
/core/mandatoryAuth.php
UTF-8
1,139
2.703125
3
[]
no_license
<?php $token = null; foreach (getallheaders() as $name => $value) { if($name == "Authorization") { global $token; $token = mb_substr($value, 6); break; } } require_once(__DIR__.'/db.php'); require_once(__DIR__.'/../data/repository/UserAccountRepository.php'); function getUserByToken($token) { $decodedToken = base64_decode($token); $credentials = explode(':', $decodedToken); if(sizeof($credentials) != 2) { return null; } $email = $credentials[0]; $password = $credentials[1]; $userAccount = findUserAccountByEmail($email); if(!empty($userAccount) and $userAccount->password == $password) { return $userAccount; } else { return null; } } function accessDenied() { header('HTTP/1.0 403 Forbidden'); echo 'Access denied'; die(); } function authenticate($token) { if(empty($token)) { var_dump($token); accessDenied(); } $userAccount = getUserByToken($token); if(!empty($userAccount)) { $GLOBALS["user"] = $userAccount; } else { accessDenied(); } } authenticate($token);
true
0acc9f7bd95a06764b754453490e4fc733a48df8
PHP
PacktPublishing/Modular-Programming-with-PHP7
/Chapter06/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/ExpressionLanguage/DoctrineParserCache.php
UTF-8
1,036
2.625
3
[ "MIT" ]
permissive
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\ExpressionLanguage; use Doctrine\Common\Cache\Cache; use Symfony\Component\ExpressionLanguage\ParsedExpression; use Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface; /** * @author Adrien Brault <[email protected]> */ class DoctrineParserCache implements ParserCacheInterface { /** * @var Cache */ private $cache; public function __construct(Cache $cache) { $this->cache = $cache; } /** * {@inheritdoc} */ public function fetch($key) { if (false === $value = $this->cache->fetch($key)) { return; } return $value; } /** * {@inheritdoc} */ public function save($key, ParsedExpression $expression) { $this->cache->save($key, $expression); } }
true
7579939a5bcf87bb05801507992a14f60c71a883
PHP
irpul/vip2
/lib/database/database.php
UTF-8
1,783
3.109375
3
[]
no_license
<?php class Database extends PDO { private $db_host = "localhost"; // server name private $db_user = "root"; // user name private $db_pass = ""; // password private $db_dbname = "mikrotik"; // database name private $db_charset = "utf8"; // optional character set (i.e. utf8) private $db_pcon = false; // use persistent connection? public $last_query; function __construct($connect = true, $database = null, $server = null, $username = null, $password = null, $charset = null , $option = null) { if ($database !== null) $this->db_dbname = $database; if ($server !== null) $this->db_host = $server; if ($username !== null) $this->db_user = $username; if ($password !== null) $this->db_pass = $password; if ($charset !== null) $this->db_charset = $charset; if (strlen($this->db_host) > 0 && strlen($this->db_user) > 0) { if ($connect) $this->Open($option); } } public function query($statement) { $this->last_query = $statement; return parent::query($statement); } public function exec($statement) { $this->last_query = $statement; return parent::exec($statement); } public function open($options) { parent::__construct ( "mysql:host={$this->db_host};dbname={$this->db_dbname}", $this->db_user, $this->db_pass, $options ); parent::query("SET NAMES utf8"); parent::setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_BOTH); parent::setAttribute(PDO::ATTR_EMULATE_PREPARES, false); parent::setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } public function close_connection() { unset($this->connection); } } ?>
true
bbd649ec23beec74b8dc51d039d07d9ca8104e41
PHP
ebaldizon/Puri1.0
/Entities/Buy.php
UTF-8
1,719
3.203125
3
[]
no_license
<?php class Buy { private $id; private $date; private $name; private $cart; private $subTotal; private $tax; private $total; function __construct($id, $date, $name, $cart, $subTotal, $tax, $total) { $this->id = $id; $this->date = $date; $this->name = $name; $this->cart = $cart; $this->subTotal = $subTotal; $this->tax = $tax; $this->total = $total; } function getId() { return $this->id; } function setId($id) { $this->id = $id; } function getDate() { return $this->date; } function setDate($date) { $this->date = $date; } function getName() { return $this->name; } function setName($name) { $this->name = $name; } function getCart() { return $this->cart; } function setCart($cart) { $this->cart = $cart; } function getSubTotal() { return $this->subTotal = $subtotal; } function setSubtotal($subTotal) { $this->subTotal = $subTotal; } function getTax() { return $this->tax; } function setTax($tax) { $this->tax = $tax; } function getTotal() { return $this->total; } function setTotal($total) { $this->total = $total; } } ?>
true