{ // 获取包含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 }); }); } })(); \r\n\r\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":610,"cells":{"blob_id":{"kind":"string","value":"563445cb16ba4abb7be435ccac5475c5cebd45bf"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"VinceM83/Discussion"},"path":{"kind":"string","value":"/test/utilisateur.test.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":227,"string":"227"},"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":"getPseudo();"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":611,"cells":{"blob_id":{"kind":"string","value":"114b60bb2558ddb131c9de02c8b8b8e3ec98a1ce"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"ghaitsatha/skripsi"},"path":{"kind":"string","value":"/core/prosescrud.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":3303,"string":"3,303"},"score":{"kind":"number","value":3,"string":"3"},"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":"db = $db;\n }\n\n function proses_login($username,$password)\n {\n // untuk password kita enkrip dengan md5\n $row = $this->db->prepare('SELECT * FROM tbl_user WHERE username=username AND password=md5(password)');\n $row->execute(array($username,$password));\n $count = $row->rowCount();\n if($count > 0)\n {\n return $hasil = $row->fetch();\n }else{\n return 'gagal';\n }\n }\n\n // variable $tabel adalah isi dari nama table database yang ingin ditampilkan\n\n function tampil_data($tabel)\n {\n $row = $this->db->prepare(\"SELECT * FROM sms\");\n $row->execute();\n return $hasil = $row->fetchAll();\n }\n\n // variable $tabel adalah isi dari nama table database yang ingin ditampilkan\n // variable where adalah isi kolom tabel yang mau diambil\n // variable id adalah id yang mau di ambil\n \n function tampil_data_id($tabel,$where,$id)\n {\n $row = $this->db->prepare(\"SELECT * FROM $tabel WHERE $where = :id,:teks,:label,:predict\");\n $row->execute(array($id));\n return $hasil = $row->fetch();\n }\n\n function tambah_data($tabel,$data)\n {\n // buat array untuk isi values insert sumber kode \n // http://thisinterestsme.com/pdo-prepared-multi-inserts/\n $rowsSQL = array();\n // buat bind param Prepared Statement\n $toBind = array();\n // list nama kolom\n $columnNames = array_keys($data[0]);\n // looping untuk mengambil isi dari kolom / values\n foreach($data as $arrayIndex => $row){\n $params = array();\n foreach($row as $columnName => $columnValue){\n $param = \":\" . $columnName . $arrayIndex;\n $params[] = $param;\n $toBind[$param] = $columnValue;\n }\n $rowsSQL[] = \"(\" . implode(\", \", $params) . \")\";\n }\n $sql = \"INSERT INTO $tabel (\" . implode(\", \", $columnNames) . \") VALUES \" . implode(\", \", $rowsSQL);\n $row = $this->db->prepare($sql);\n //Bind our values.\n foreach($toBind as $param => $val){\n $row ->bindValue($param, $val);\n }\n //Execute our statement (i.e. insert the data).\n return $row ->execute();\n }\n\n // function edit_data($sms,$data,$where,$id)\n // {\n // // sumber kode \n // // https://stackoverflow.com/questions/23019219/creating-generic-update-function-using-php-mysql\n // $setPart = array();\n // foreach ($data as $key => $value)\n // {\n // $setPart[] = $key.\"=:\".$key;\n // }\n // $sql = \"UPDATE $tabel SET \".implode(', ', $setPart).\" WHERE $where = :id\";\n // $row = $this->db->prepare($sql);\n // //Bind our values.\n // $row ->bindValue(':id',$id); // where\n // foreach($data as $param => $val)\n // {\n // $row ->bindValue($param, $val);\n // }\n // return $row ->execute();\n // }\n\n function hapus_data($tabel,$where,$id)\n {\n $sql = \"DELETE FROM $tabel WHERE $where = :id,:teks,:label,:predict\";\n $row = $this->db->prepare($sql);\n return $row ->execute(array($id));\n }\n\n\n}\n "},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":612,"cells":{"blob_id":{"kind":"string","value":"d838d5ac093c58817b35c779a316918b67469f20"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"RezaulAlamOni/Web-Engineering-"},"path":{"kind":"string","value":"/3PHP&MySql/b/show.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2372,"string":"2,372"},"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 \n \n Employee List\n \n\n\n \n\n\n

All Employee List



\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n
IDNameAddressEmailPhoneSalaryAction
\n Edit ||\n Delete\n
Total
\n Add Employee\n\n
\n\n\n\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":613,"cells":{"blob_id":{"kind":"string","value":"aec37515476e189c8f58725bf6488641ae5d55ad"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"tdorkaa/ToDoApp"},"path":{"kind":"string","value":"/Tests/Validator/InputValidatorTest.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":3421,"string":"3,421"},"score":{"kind":"number","value":2.75,"string":"2.75"},"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":"inputValidator = new InputValidator();\n }\n\n /**\n * @test\n */\n public function validate_AllInputsAreValid_DoesNotThrowException()\n {\n $this->inputValidator->validate(new Todo(1, 'todo name', 'todo description', '2018-08-29 10:00:00'));\n $this->expectNotToPerformAssertions();\n }\n\n /**\n * @test\n */\n public function validate_NameInputIsMissing_ThrowsException()\n {\n try {\n $this->inputValidator->validate(new Todo(1, '', 'todo description', '2018-08-29 10:00:00'));\n $this->fail('An exception was expected');\n } catch (InvalidInputException $exception) {\n $actualErrorCodes= $exception->getErrorCodes();\n $this->assertEquals([InputValidator::ERROR_EMPTY_NAME], $actualErrorCodes);\n }\n }\n\n /**\n * @test\n */\n public function validate_DescriptionInputIsMissing_ThrowsException()\n {\n try {\n $this->inputValidator->validate(new Todo(1, 'todo name', '', '2018-08-29 10:00:00'));\n $this->fail('An exception was expected');\n } catch (InvalidInputException $exception) {\n $actualErrorCodes= $exception->getErrorCodes();\n $this->assertEquals([InputValidator::ERROR_EMPTY_DESCRIPTION], $actualErrorCodes);\n }\n }\n\n /**\n * @test\n */\n public function validate_DueAtInputIsMissing_ThrowsException()\n {\n try {\n $this->inputValidator->validate(new Todo(1, 'todo name', 'todo description', ''));\n $this->fail('An exception was expected');\n } catch (InvalidInputException $exception) {\n $actualErrorCodes= $exception->getErrorCodes();\n $this->assertEquals([InputValidator::ERROR_EMPTY_DUE_AT], $actualErrorCodes);\n }\n }\n\n /**\n * @test\n */\n public function validate_NameDescriptionAndDueDateInputsAreMissing_ThrowsException()\n {\n try {\n $this->inputValidator->validate(new Todo(null, '', '', ''));\n $this->fail('An exception was expected');\n } catch (InvalidInputException $exception) {\n $actualErrorCodes= $exception->getErrorCodes();\n $this->assertEquals([InputValidator::ERROR_EMPTY_NAME, InputValidator::ERROR_EMPTY_DESCRIPTION, InputValidator::ERROR_EMPTY_DUE_AT], $actualErrorCodes);\n }\n }\n\n /**\n * @test\n */\n public function validate_DueDateIsNotValid_ThrowsException()\n {\n try {\n $this->inputValidator->validate(new Todo(null, 'todo name', 'todo desc', 'invalid date'));\n $this->fail('An exception was expected');\n } catch (InvalidInputException $exception) {\n $actualErrorCodes= $exception->getErrorCodes();\n $this->assertEquals([InputValidator::ERROR_INVALID_DUE_AT], $actualErrorCodes);\n }\n }\n\n /**\n * @test\n */\n public function validate_GivenDueDateIsValid_DoesNotThrowException()\n {\n $this->inputValidator->validate(new Todo(null, 'todo name', 'todo desc', '2018-01-01'));\n $this->expectNotToPerformAssertions();\n }\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":614,"cells":{"blob_id":{"kind":"string","value":"5161cbd38cab3b08244cd6f881af4292d69e95a2"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"doulmi/Laravel-Vuejs-Ecommerce"},"path":{"kind":"string","value":"/app/Http/Controllers/AddressController.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1916,"string":"1,916"},"score":{"kind":"number","value":2.609375,"string":"2.609375"},"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":"repo = $repo;\n }\n /**\n * Display a listing of the resource.\n *\n * @return \\Illuminate\\Http\\Response\n */\n public function index()\n {\n $address = $this->repo->index(Auth::id());\n return view('address.index', compact('address'));\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(AddressRequest $request)\n {\n $success = $this->repo->store(Auth::id());\n if($success) {\n //go to next page: delivery method\n return redirect()->route('delivery.index');\n } else {\n return redirect()->back();\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($id)\n {\n $address = $this->repo->find(Auth::id(), $id);\n if($address) {\n return view('address.edit', compact('address'));\n } else {\n abort(404);\n }\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, $id)\n {\n $address = $this->repo->find(Auth::id(), $id);\n if ($address) {\n $success = $this->repo->update($address);\n if($success) {\n\n } else {\n\n }\n } else {\n abort(403);\n }\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($id)\n {\n //\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":615,"cells":{"blob_id":{"kind":"string","value":"9722295ba78412641197ed8302c6cec151d1d8a9"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"torilife/torilife"},"path":{"kind":"string","value":"/fuel/app/classes/controller/error.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1003,"string":"1,003"},"score":{"kind":"number","value":2.609375,"string":"2.609375"},"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":"template->title = '404 Not Found';\n\t\t$this->template->header_title = site_title($this->template->title);\n\t\t$this->template->content = View::forge('error/404');\n\t\t$this->response->status = 404;\n\t}\n\t\n\t/**\n\t * The 500 action for the application.\n\t * \n\t * @access public\n\t * @return Response\n\t */\n\tpublic function action_500()\n\t{\n\t\t$this->template->title = '500 Server Error';\n\t\t$this->template->header_title = site_title($this->template->title);\n\t\t$this->template->content = View::forge('error/500');\n\t\t$this->response->status = 500;\n\t}\n\t\n\t/**\n\t * Error page for invalid input data\n\t */\n\tpublic function action_invalid()\n\t{\n\t\t$this->template->title = 'Invalid input data';\n\t\t$this->template->header_title = site_title($this->template->title);\n\t\t$this->template->content = View::forge('error/invalid');\n\t}\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":616,"cells":{"blob_id":{"kind":"string","value":"c4510c55f552560ddb7b42a6295c74deca837025"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"Axelcureno/core"},"path":{"kind":"string","value":"/classes/View/PHP.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1889,"string":"1,889"},"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":"templatePath = rtrim($path,'/') . '/';\n }\n \n public function exists($path){\n return is_file($this->templatePath.$path.'.php');\n }\n \n public static function addGlobal($key,$val){\n self::$globals[$key] = $val;\n }\n\n public static function addGlobals(array $defs){\n foreach ((array)$defs as $key=>$val) {\n self::$globals[$key] = $val;\n }\n }\n\n public function render($template,$data=[]){\n $template_path = $this->templatePath . trim($template,'/') . '.php';\n $sandbox = function() use ($template_path){\n ob_start();\n include($template_path);\n $__buffer__ = ob_get_contents();\n ob_end_clean();\n return $__buffer__;\n };\n $sandbox = $sandbox->bindTo(new PHPContext(\n array_merge(self::$globals,$data),\n $this->templatePath\n ));\n return $sandbox();\n }\n}\n\nclass PHPContext {\n protected $data = [];\n protected $templatePath = __DIR__;\n \n public function __construct($data=[],$path=null){\n $this->data = $data;\n if ($path) $this->templatePath = rtrim($path,'/') . '/';\n }\n \n public function partial($template){\n $template_path = $this->templatePath . trim($template,'/') . '.php';\n include $template_path; \n }\n \n public function __isset($n){return 1;}\n public function __unset($n){}\n public function __get($n){return (empty($this->data[$n])?'':$this->data[$n]);}\n \n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":617,"cells":{"blob_id":{"kind":"string","value":"3e9cfbb36dad66789f48c0c051ce77e6c7e0c801"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"MohammedAafaque/Brokeflix"},"path":{"kind":"string","value":"/includes/classes/FormSanitizer.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":799,"string":"799"},"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":""},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":618,"cells":{"blob_id":{"kind":"string","value":"a98f888c7168c1d0e9b3ec1c9146b5e8c5821dc5"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"cursesun/sms"},"path":{"kind":"string","value":"/src/Gateways/ChuangLan.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":3830,"string":"3,830"},"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":"\n * @copyright © 2020 MuCTS.com All Rights Reserved.\n * @see https://zz.253.com/v5.html#/api_doc\n */\n\nnamespace MuCTS\\SMS\\Gateways;\n\n\nuse Exception;\nuse MuCTS\\SMS\\Config\\Config;\nuse MuCTS\\SMS\\Interfaces\\Message;\nuse MuCTS\\SMS\\Interfaces\\Mobile;\nuse MuCTS\\SMS\\Traits\\HasHttpRequest;\n\nclass ChuangLan extends Gateway\n{\n use HasHttpRequest;\n\n /** @var string 请求接口 */\n protected const ENDPOINT_URL_TEMPLATE = 'https://%s.253.com/msg/send/json';\n /** @var string 国际短信 */\n protected const INT_URL = 'http://intapi.253.com/send/json';\n /** @var string 验证码渠道code */\n protected const CHANNEL_VALIDATE_CODE = 'smsbj1';\n /** @var string 会员营销渠道code. */\n protected const CHANNEL_PROMOTION_CODE = 'smssh1';\n\n /**\n * @param int $IDDCode\n * @return string\n * @throws Exception\n */\n protected function buildEndpoint(int $IDDCode = 86)\n {\n $channel = $this->getChannel($IDDCode);\n if (self::INT_URL === $channel) {\n return $channel;\n }\n return sprintf(self::ENDPOINT_URL_TEMPLATE, $channel);\n }\n\n /**\n * @param int $IDDCode\n * @return mixed\n * @throws Exception\n */\n protected function getChannel(int $IDDCode)\n {\n if (86 != $IDDCode) {\n return self::INT_URL;\n }\n $channel = $this->getConfig()->get('channel', self::CHANNEL_VALIDATE_CODE);\n if (!in_array($channel, [self::CHANNEL_VALIDATE_CODE, self::CHANNEL_PROMOTION_CODE])) {\n throw new Exception('Invalid channel for ChuangLan Gateway.');\n }\n return $channel;\n }\n\n /**\n * @param string $content\n * @param int $IDDCode\n * @return string\n * @throws Exception\n */\n protected function wrapChannelContent(string $content, int $IDDCode): string\n {\n $channel = $this->getChannel($IDDCode);\n if (self::CHANNEL_PROMOTION_CODE == $channel) {\n $sign = (string)$this->getConfig()->get('sign', '');\n if (empty($sign)) {\n throw new Exception('Invalid sign for ChuangLan Gateway when using promotion channel');\n }\n $unsubscribe = (string)$this->getConfig()->get('unsubscribe', '');\n if (empty($unsubscribe)) {\n throw new Exception('Invalid unsubscribe for ChuangLan Gateway when using promotion channel');\n }\n $content = $sign . $content . $unsubscribe;\n }\n return $content;\n }\n\n public function send(Message $message, Mobile $mobile, ?Config $config = null): array\n {\n if($config) $this->setConfig($config);\n $IDDCode = $mobile->getIDDCode() ?? 86;\n $params = [\n 'account' => $this->getConfig()->get('account'),\n 'password' => $this->getConfig()->get('password'),\n 'phone' => $mobile->getNumber(),\n 'msg' => $this->wrapChannelContent($message->getContent($this), $IDDCode),\n ];\n if (86 != $IDDCode) {\n $params['mobile'] = $IDDCode . $mobile->getNumber();\n $params['account'] = $this->getConfig()->get('intel_account') ?: $this->getConfig()->get('account');\n $params['password'] = $this->getConfig()->get('intel_password') ?: $this->getConfig()->get('password');\n }\n $result = $this->postJson($this->buildEndpoint($IDDCode), $params);\n if (!isset($result['code']) || '0' != $result['code']) {\n throw new Exception(json_encode($result, JSON_UNESCAPED_UNICODE), isset($result['code']) ? $result['code'] : 0, $result);\n }\n return $result;\n }\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":619,"cells":{"blob_id":{"kind":"string","value":"bb7ed6ed220d356f0d8fff1f2177893304fe4151"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"cultivatingcoders/ecn-church"},"path":{"kind":"string","value":"/php/classes/dbconnect.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":701,"string":"701"},"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":" true));\n\n }\n\n return $GLOBALS['dbConn'];\n\n}\n\n?>\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":620,"cells":{"blob_id":{"kind":"string","value":"35854304ca7a3c0f4fef6d975728cf774a780f73"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"xuelanghua/rrshop"},"path":{"kind":"string","value":"/addons/fr_hb/inc/function/packet.func.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":5869,"string":"5,869"},"score":{"kind":"number","value":2.609375,"string":"2.609375"},"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// +----------------------------------------------------------------------\ndefined('IN_IA') or exit('Access Denied');\n\n/**\n * 打开红包\n * @param type $openid\n * @param type $packet\n * @param type $project\n */\nfunction openPacket($openid, $packet, $project, $isFollow = true) {\n if ($isFollow == false && $project['is_follow'] == 1) {\n return true;\n }\n $money = $packet['money'] / 100;\n if ($project['type'] == 1) {\n return addIntegral($openid, $money, \"获得{$project['title']}积分红包:{$money}\");\n }else if($project['type'] == 2) {\n return addBalance($openid, $money, \"获得{$project['title']}余额红包:{$money}\");\n }else if($project['type'] == 3) {\n $res = sendWeixinRedPacket($openid, $packet['money'], \"恭喜获得{$project['title']}红包:{$money}元\", $project['title'], \"记得分享给您的朋友哦\");\n if (is_error($res)){\n WeUtility::logging('waring', \"fr_hb--{$res['message']}\");\n return false;\n }else {\n return true;\n }\n }else if($project['type'] == 4) {\n $card = getCardId($packet['card_id']);\n if (empty($card)) {\n return false;\n }\n $res = sendWeixinCard($openid, $packet['card_id'], \"获得{$project['title']}卡券:{$card['title']}\");\n if (is_error($res)){\n WeUtility::logging('waring', \"fr_hb--{$res['message']}\");\n return false;\n }else {\n return true;\n }\n }\n}\n\n/**\n * 格式化奖品数据\n * @param type $money\n * @param type $type\n * @return string\n */\nfunction format_prize($money, $type) {\n $money = $money / 100;\n switch ($type) {\n case 1:\n $text = $money . \"积分红包\";\n break;\n case 2:\n $text = $money . \"元余额红包\";\n break;\n case 3:\n $text = $money . \"元现金红包\";\n break;\n }\n return $text;\n}\n\n\n/**\n * 获取项目已生成红包总数\n * @global type $_W\n * @param type $project_id\n * @return int\n */\nfunction getPacketCount($project_id) {\n global $_W;\n if (empty($project_id)) {\n return 0;\n }\n $id = intval($project_id);\n $uniacid = $_W['uniacid'];\n $sql = \"SELECT count(*) FROM \". tablename('fr_hb_packet') . \" WHERE project_id = :project_id AND uniacid = :uniacid\";\n $params = array(\":project_id\" => $id, \":uniacid\" => $uniacid);\n $item = pdo_fetchcolumn($sql, $params);\n return $item;\n}\n/**\n * 获取项目已生成红包总数\n * @global type $_W\n * @param type $project_id\n * @return int\n */\nfunction getCardIdPacketCount($project_id, $card_id) {\n global $_W;\n if (empty($project_id) || empty($card_id)) {\n return 0;\n }\n $id = intval($project_id);\n $uniacid = $_W['uniacid'];\n $sql = \"SELECT count(*) FROM \". tablename('fr_hb_packet') . \" WHERE project_id = :project_id AND card_id = :card_id AND uniacid = :uniacid\";\n $params = array(\":project_id\" => $id, \":uniacid\" => $uniacid, \":card_id\" => $card_id);\n $item = pdo_fetchcolumn($sql, $params);\n return $item;\n}\n/**\n * 获取所有红包\n * @global type $_W\n * @param type $project_id\n * @return type\n */\nfunction getPacketAll($project_id, $offset = 0) {\n global $_W;\n if (empty($project_id)) {\n return array();\n }\n $id = intval($project_id);\n $uniacid = $_W['uniacid'];\n $sql = \"SELECT * FROM \". tablename('fr_hb_packet') . \" WHERE project_id = :project_id AND uniacid = :uniacid LIMIT {$offset}, 10000\";\n $params = array(\":project_id\" => $id, \":uniacid\" => $uniacid);\n $result = pdo_fetchall($sql, $params);\n return $result;\n}\n/**\n * 获取红包状态\n * @param type $status\n * @param type $start\n * @param type $end\n * @return string\n */\nfunction getPacketStatus($status, $start, $end) {\n if ($status == -1) {\n return '已失效';\n }\n if ($status == 1) {\n return '已领取';\n }\n return '未领取';\n// if ($start > TIMESTAMP) {\n// return '未领取';\n// }\n// if ($end < TIMESTAMP) {\n// return '已过期';\n// }\n}\n\n\n/**\n * 获取红包详情\n * @param type $id\n * @return type\n */\nfunction getPacketById($id) {\n return getDataById('fr_hb_packet', $id);\n}\n/**\n * 获取红包详情\n * @global type $_W\n * @param type $token\n * @return boolean\n */\nfunction getPacketByToken($token) {\n global $_W;\n if (empty($token)) {\n return FALSE;\n }\n $token = trim($token);\n $uniacid = $_W['uniacid'];\n $sql = \"SELECT * FROM \". tablename('fr_hb_packet') . \" WHERE token = :token AND uniacid = :uniacid\";\n $params = array(\":token\" => $token, \":uniacid\" => $uniacid);\n $item = pdo_fetch($sql, $params);\n return $item;\n}\n\n/**\n * 获取领取红包记录\n * @param type $id\n */\nfunction getPacketReceive($id) {\n global $_W;\n if (empty($id)) {\n return FALSE;\n }\n $id = intval($id);\n $uniacid = $_W['uniacid'];\n $sql = \"SELECT * FROM \". tablename('fr_hb_receive') . \" WHERE packet_id = :packet_id AND uniacid = :uniacid\";\n $params = array(\":packet_id\" => $id, \":uniacid\" => $uniacid);\n $item = pdo_fetch($sql, $params);\n return $item;\n}\n\n/**\n * 获取项目未生成二维码图片的红包总数\n * @global type $_W\n * @param type $project_id\n * @return int\n */\nfunction getPacketNoqrcCount($project_id) {\n global $_W;\n if (empty($project_id)) {\n return 0;\n }\n $id = intval($project_id);\n $uniacid = $_W['uniacid'];\n $sql = \"SELECT count(*) FROM \". tablename('fr_hb_packet') . \" WHERE project_id = :project_id AND uniacid = :uniacid AND isqrc = :isqrc\";\n $params = array(\":project_id\" => $id, \":uniacid\" => $uniacid, \":isqrc\" => 0);\n $item = pdo_fetchcolumn($sql, $params);\n return $item;\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":621,"cells":{"blob_id":{"kind":"string","value":"44cd5d1a41f17515511bdfae5b096b225b75b459"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"AndreasRaisl/smallPortfolio"},"path":{"kind":"string","value":"/weitereFormularePHP/affenformularKartenbestellungNewer.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":4628,"string":"4,628"},"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":" Bitte bestellen Sie hier Karten für mein fantastisches Gitarrenkonzert mit Wandervogelliedern am 25.12.2019.\n\t\t\t (Ist Fake, also bitte bedenkenlos bestellen :))

';\t\n\n\t\t\techo '
\t\t\n\t\t\t

Ihr Vorname: \n\t\t\t\n\t\t\t

';\n\n\t\t\tif (empty($_GET['nachname']) AND !empty($_GET['kontrolle']))\n\t\t\t{\n\t\t\t\techo \"

Bitte tragen Sie Ihren Nachnamen ein! Feld darf nicht leer sein.

\";\n\t\t\t}\n\t\t\techo \n\t\t\t'

Ihr Nachname: \n\t\t\t\n\t\t\t

';\n\t\t\n\t\t\tif (empty($_GET['anzahl']) AND !empty($_GET['kontrolle']))\n\t\t\t{\n\t\t\t\techo \"

Bitte tragen Sie die Anzahl ein. Das Feld Anzahl darf nicht leer sein, wenn Sie Karten bestellen wollen.

\";\n\t\t\t}\n\n\t\t\tif(!is_numeric($_GET['anzahl']))\n\t\t\t{\n\t\t\t\techo \"

Es muss ein Zahlenwert eingegeben werden

\";\n\t\t\t}\n\n\t\t\techo \n\t\t\t'

Ihre Anzahl: \n\t\t\t\n\t\t\t

';\n\t\t\n\t\t\tif (empty($_GET['email']) AND !empty($_GET['kontrolle']))\n\t\t\t{\n\t\t\t\techo \"

Bitte tragen Sie die Email ein. Das Feld Email darf nicht leer sein.

\";\n\t\t\t}\n\t\t\techo \n\t\t\t'

Ihre Email: \n\t\t\t\n\t\t\t

\n\t\t\t \n\t\t\t';\n\n\t\t\techo'\n\t\t\t\n\t\t\t\n\t\t\t
';\t\t\n\n\t}\n\n\telse // wenn Anzahl, Email und Nachname korrekt eingegeben, dann verarbeiten der Daten\n\t{\n\t\techo \"Sie haben soviele Karten bestellt: \".$_GET['anzahl'].\"
\";\n echo \"Sie haben als Nachnamen eingetragen: \".$_GET['nachname']. \"
\";\n\t\techo \"Sie haben als Email eingetragen: \".$_GET['email'].\"
\";\n\t\techo \"Sie haben das Formular am \" . $_GET['timestamp'] . \" abgeschickt.
\";\n\t\n\t\t//write data to file\n\t\t$handle = fopen('textdatei.txt', 'a');\n\t\tfwrite($handle, $_GET['nachname']);\n\t\tfwrite($handle, ';');\n\t\tfwrite($handle, $_GET['email']);\n\t\tfwrite($handle, ';');\n\t\tfwrite($handle, $_GET['anzahl']);\n\t\tfwrite($handle, '\\n');\n\t\tfclose($handle);\n\n\t\techo \"Die Bestellung wurde ordnungsgemäß in einer Datei gespeichert.\";\n\t}\t\n\n\n\n// else {\n// \tshowForm();\n// \techo \"
Bin im else Zweig für Step != formSubmitted
\";\n// }\n\nfunction showForm() {\n\n\techo date (\"H:i:s\");\n\n\t\t\t//Show the form again\n\t\t\techo \n\t\t\t'

Bitte bestellen Sie hier Karten für mein fantastisches Gitarrenkonzert mit Wandervogelliedern am 25.12.2019.\n\t\t\t (Ist Fake, also bitte bedenkenlos bestellen :))

';\t\n\n\t\t\techo '
\t\t\n\t\t\t

Ihr Vorname: \n\t\t\t\n\t\t\t

';\n\n\t\t\tif (empty($_GET['nachname']) AND !empty($_GET['kontrolle']))\n\t\t\t{\n\t\t\t\techo \"

Bitte tragen Sie Ihren Nachnamen ein! Feld darf nicht leer sein.

\";\n\t\t\t}\n\t\t\techo \n\t\t\t'

Ihr Nachname: \n\t\t\t\n\t\t\t

';\n\t\t\n\t\t\tif (empty($_GET['anzahl']) AND !empty($_GET['kontrolle']))\n\t\t\t{\n\t\t\t\techo \"

Bitte tragen Sie die Anzahl ein. Das Feld Anzahl darf nicht leer sein, wenn Sie Karten bestellen wollen.

\";\n\t\t\t}\n\t\t\techo \n\t\t\t'

Ihre Anzahl: \n\t\t\t\n\t\t\t

';\n\t\t\n\t\t\tif (empty($_GET['email']) AND !empty($_GET['kontrolle']))\n\t\t\t{\n\t\t\t\techo \"

Bitte tragen Sie die Email ein. Das Feld Email darf nicht leer sein.

\";\n\t\t\t}\n\t\t\techo \n\t\t\t'

Ihre Email: \n\t\t\t\n\t\t\t

\n\t\t\t \n\t\t\t';\n\n\t\t\techo'\n\t\t\t\n\t\t\t\n\t\t\t
';\t\t\n\n}\n?>"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":622,"cells":{"blob_id":{"kind":"string","value":"334f96bd0166d4ec0cc468b3043dba3ad24c9280"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"Mixeys/coursePHP"},"path":{"kind":"string","value":"/cookie1.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":844,"string":"844"},"score":{"kind":"number","value":3.3125,"string":"3.3125"},"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\t\n\tCookie\n\n\n\t

Мой сайт.

\n\t
\n\t\t\";\n\t\t\t\techo \"Последнее посещение : $lastVisit .\";\n\t\t\t}\n\t\t?>\n\t
\n\n\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":623,"cells":{"blob_id":{"kind":"string","value":"c6fe4fa08216209748847f34b926c7e9b0ca2317"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"MatokUK/shunting-yard-php"},"path":{"kind":"string","value":"/tests/Token/PlusTokenTest.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":858,"string":"858"},"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":"assertEquals(2, $token->getOperandsCount());\n }\n\n /**\n * @dataProvider getEvaluateTests\n */\n public function testEvaluate($a, $b, $expectedResult)\n {\n $token = new PlusToken('+');\n\n $result = $token->evaluate(new ValueToken($a), new ValueToken($b));\n\n $this->assertEquals($expectedResult, $result->value());\n }\n\n public function getEvaluateTests()\n {\n return [\n [0, 0, 0],\n [1, 2, 3],\n [1, -2, -1],\n [-1, 2, 1],\n [-1, -2, -3],\n ];\n }\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":624,"cells":{"blob_id":{"kind":"string","value":"b5235347255e124209a90f39ddb8649f6d3d6c44"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"sheepcat/piebridge"},"path":{"kind":"string","value":"/piebridge/protected/models/UserInfoAR.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1071,"string":"1,071"},"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":"val = $val; }\n * }\n */\nclass Solution {\n\n /**\n * @param ListNode $l1\n * @param ListNode $l2\n * @return ListNode\n */\n function addTwoNumbers($l1, $l2) {\n //定义一个标志位;\n $add = 0;\n $dummyHead=new ListNode(0);$curr=$dummyHead;\n while ($l1||$l2) {\n if (($remain = ($l1->val ?? 0) + ($l2->val ?? 0) - 10 + $add) >= 0) {\n $add = 1;\n $curr->next= new ListNode($remain);\n } else {\n $add =0;\n $curr->next=new ListNode($remain + 10) ;\n }\n $curr=$curr->next;\n $l1 = $l1->next??null;\n $l2 = $l2->next??null;\n }\n //如果有最后一位:\n $add>0&&$curr->next=new ListNode(1);\n return $dummyHead->next;\n }\n}\n\nclass ListNode {\n public $val = 0;\n public $next = null;\n\n function __construct($val) {\n $this->val = $val;\n }\n}\n$l1=new ListNode(2);\n$l1->next=new ListNode(1);\n$l1->next->next=new ListNode(7);\n$l2=new ListNode(5);\n$l2->next=new ListNode(6);\n$l2->next->next=new ListNode(3);\n//$l2->next->next->next=new ListNode(4);\nvar_dump((new Solution())->addTwoNumbers($l1, $l2));"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":626,"cells":{"blob_id":{"kind":"string","value":"cd730c8b0762d58fff1dec51d16eeb6f55267d09"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"ciniki/donations"},"path":{"kind":"string","value":"/public/donationList.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":5777,"string":"5,777"},"score":{"kind":"number","value":2.625,"string":"2.625"},"int_score":{"kind":"number","value":3,"string":"3"},"detected_licenses":{"kind":"list like","value":["MIT","LicenseRef-scancode-unknown-license-reference"],"string":"[\n \"MIT\",\n \"LicenseRef-scancode-unknown-license-reference\"\n]"},"license_type":{"kind":"string","value":"permissive"},"text":{"kind":"string","value":"array('required'=>'yes', 'blank'=>'no', 'name'=>'Tenant'), \n 'year'=>array('required'=>'no', 'blank'=>'yes', 'name'=>'year'), \n 'category'=>array('required'=>'no', 'blank'=>'yes', 'name'=>'category'), \n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $args = $rc['args'];\n \n // \n // Check access to tnid as owner, or sys admin. \n // \n ciniki_core_loadMethod($ciniki, 'ciniki', 'donations', 'private', 'checkAccess');\n $ac = ciniki_donations_checkAccess($ciniki, $args['tnid'], 'ciniki.donations.donationList');\n if( $ac['stat'] != 'ok' ) { \n return $ac;\n } \n\n //\n // Load the tenant intl settings\n //\n ciniki_core_loadMethod($ciniki, 'ciniki', 'tenants', 'private', 'intlSettings');\n $rc = ciniki_tenants_intlSettings($ciniki, $args['tnid']);\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $intl_timezone = $rc['settings']['intl-default-timezone'];\n $intl_currency_fmt = numfmt_create($rc['settings']['intl-default-locale'], NumberFormatter::CURRENCY);\n $intl_currency = $rc['settings']['intl-default-currency'];\n\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbQuote');\n ciniki_core_loadMethod($ciniki, 'ciniki', 'users', 'private', 'dateFormat');\n $date_format = ciniki_users_dateFormat($ciniki, 'mysql');\n\n //\n // Get the range of years\n //\n $strsql = \"SELECT DISTINCT DATE_FORMAT(date_received, '%Y') AS year \"\n . \"FROM ciniki_donations \"\n . \"WHERE tnid = '\" . ciniki_core_dbQuote($ciniki, $args['tnid']) . \"' \"\n . \"ORDER BY year DESC \"\n . \"\";\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbQueryList');\n $rc = ciniki_core_dbQueryList($ciniki, $strsql, 'ciniki.donations', 'years', 'year');\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $years = array();\n if( isset($rc['years']) ) {\n $years = $rc['years'];\n }\n\n if( (!isset($args['year']) || $args['year'] == '') && count($years) > 0 ) {\n $args['year'] = $years[0];\n }\n\n //\n // Get the categories\n //\n $strsql = \"SELECT DISTINCT IF(category='', '?', category) as category \"\n . \"FROM ciniki_donations \"\n . \"WHERE tnid = '\" . ciniki_core_dbQuote($ciniki, $args['tnid']) . \"' \";\n if( isset($args['year']) && $args['year'] != '' ) {\n $strsql .= \"AND YEAR(date_received) = '\" . ciniki_core_dbQuote($ciniki, $args['year']) . \"' \";\n }\n $strsql .= \"ORDER BY category DESC \"\n . \"\";\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbQueryList');\n $rc = ciniki_core_dbQueryList($ciniki, $strsql, 'ciniki.donations', 'categories', 'category');\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n $categories = array();\n if( isset($rc['categories']) ) {\n $categories = $rc['categories'];\n }\n\n if( (!isset($args['year']) || $args['year'] == '') && count($years) > 0 ) {\n $args['year'] = $years[0];\n }\n\n\n //\n // Load the donations for the year\n //\n $donations = array();\n $total_amount = 0;\n if( isset($args['year']) && $args['year'] != '' ) {\n $strsql = \"SELECT id, \"\n . \"receipt_number, \"\n . \"category, \"\n . \"name, \"\n . \"DATE_FORMAT(date_received, '\" . ciniki_core_dbQuote($ciniki, $date_format) . \"') AS date_received, \"\n . \"amount \"\n . \"FROM ciniki_donations \"\n . \"WHERE tnid = '\" . ciniki_core_dbQuote($ciniki, $args['tnid']) . \"' \"\n . \"AND date_received >= '\" . ciniki_core_dbQuote($ciniki, $args['year']) . \"-01-01' \"\n . \"AND date_received < '\" . ciniki_core_dbQuote($ciniki, ($args['year']+1)) . \"-01-01' \"\n . \"\";\n if( isset($args['category']) && $args['category'] != '' ) {\n $strsql .= \"AND category = '\" . ciniki_core_dbQuote($ciniki, $args['category']) . \"' \";\n }\n $strsql .= \"ORDER BY ciniki_donations.date_received DESC \"\n . \"\";\n ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryTree');\n $rc = ciniki_core_dbHashQueryTree($ciniki, $strsql, 'ciniki.donations', array(\n array('container'=>'donations', 'fname'=>'id', 'name'=>'donation',\n 'fields'=>array('id', 'receipt_number', 'category', 'name', 'date_received', 'amount')),\n ));\n if( $rc['stat'] != 'ok' ) {\n return $rc;\n }\n if( isset($rc['donations']) ) {\n $donations = $rc['donations'];\n foreach($donations as $did => $donation) {\n $total_amount = bcadd($total_amount, $donation['donation']['amount'], 4);\n $donations[$did]['donation']['amount_display'] = numfmt_format_currency($intl_currency_fmt,\n $donation['donation']['amount'], $intl_currency);\n }\n } \n }\n $total_amount_display = numfmt_format_currency($intl_currency_fmt, $total_amount, $intl_currency);\n\n return array('stat'=>'ok', 'years'=>implode('::', $years), 'categories'=>implode('::', $categories), 'donations'=>$donations, 'total_amount'=>$total_amount, 'total_amount_display'=>$total_amount_display);\n}\n?>\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":627,"cells":{"blob_id":{"kind":"string","value":"96aa2ded18755617bd77e8327c3412020e570402"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"zivkovicmilos/Amenic"},"path":{"kind":"string","value":"/Implementation/Amenic/app/Entities/Movie.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1107,"string":"1,107"},"score":{"kind":"number","value":3.296875,"string":"3.296875"},"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":"
tmdbID: \".$this->tmdbID.\"
Title: \".$this->title.\"
Released: \".$this->released.\"
Runtime: \".$this->runtime.\n \"
Genre: \".$this->genre.\"
Director: \".$this->director.\"
Writer: \".$this->writer.\"
Actor: \".$this->actor.\n \"
Plot: \".$this->plot.\"
Poster: \".$this->poster.\"
Background: \".$this->backgroundImg.\"
imdbRating: \".$this->imdbRating.\n \"
ImdbID: \".$this->imdbID.\"
Reviews: \".$this->reviews.\"
Trailer: \".$this->trailer;\n }\n}\n\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":628,"cells":{"blob_id":{"kind":"string","value":"03eb4f8321b659ed65f139214b5a4a60b50a030c"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"josmel/buen"},"path":{"kind":"string","value":"/source/app/Models/PuTypes.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":433,"string":"433"},"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":"lists('id')->first();\n\treturn $dataType;\n\t}\n\t\n\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":629,"cells":{"blob_id":{"kind":"string","value":"cd223dd9abb9c646e80ae4ea34485abecbb1fa74"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"jamiebclark/CakeAssets"},"path":{"kind":"string","value":"/Utility/AssetFile.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2095,"string":"2,095"},"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":"copy($dstFile, true);\n\t}\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":630,"cells":{"blob_id":{"kind":"string","value":"d31ad010a4398e7ab49a33e15dbe02b9fc6c44a1"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"Eteckq/PimpMyBicycle"},"path":{"kind":"string","value":"/model/UserManager.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":1284,"string":"1,284"},"score":{"kind":"number","value":3.03125,"string":"3.03125"},"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":"dbConnect();\n\t\t$accountsReq = $db->query('SELECT * FROM users');\n\t\twhile ($accountReq = $accountsReq->fetch()) {\n\t\t\t$account = new User($accountReq[\"id\"]);\n\t\t\t$account->pseudo = $accountReq[\"pseudo\"];\n\t\t\t$account->password = $accountReq[\"password\"];\n\n\t\t\t$accounts[] = $account;\n\t\t}\n\t\treturn $accounts;\n\t}\n\n\tpublic function getUser($id){\n\t\t$db = $this->dbConnect();\n\t $req = $db->prepare('SELECT * FROM users WHERE id=?');\n\t $req->execute(array(\n \t\t$id\n\t\t));\n\t\t$accountReq = $req->fetch();\n\n\t\t$account = new User($accountReq[\"id\"]);\n\t\t$account->pseudo = $accountReq[\"pseudo\"];\n\t\t$account->password = $accountReq[\"password\"];\n\n \treturn $account;\n\t}\n\n\tpublic function createUser($pseudo, $password){\n\t\t$hash = password_hash($password, PASSWORD_DEFAULT);\n\t\t$db = $this->dbConnect();\n\t $req = $db->prepare('INSERT INTO `users` (`pseudo`,`password`) VALUES (:pseudo, :password)');\n\t if (strlen($password) <= 1 || strlen($pseudo) <= 1) {\n\t \t//exception\n\t } else {\n\t\t $req->execute(array(\n\t\t \t':pseudo' => htmlspecialchars($pseudo),\n\t\t \t':password' => $hash\n\t\t\t));\n\t\t}\n\t}\n\n\n}\n\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":631,"cells":{"blob_id":{"kind":"string","value":"f406fcd8d71993ae5ab36016a806bd21172bc5d2"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"Mortec/photographywhy"},"path":{"kind":"string","value":"/public/newsletter.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":321,"string":"321"},"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":"\n 0) {\n echo \"$ret bytes written to file\";\n }\n else {\n die('There was an error recording email');\n }\n}\nelse {\n die('Die');\n}\n?> "},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":632,"cells":{"blob_id":{"kind":"string","value":"a95921d99f604341dae936cfaa03a9ca5c55e2a5"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"medamineDev/laravel_basics"},"path":{"kind":"string","value":"/app/Http/Controllers/PagesController.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":527,"string":"527"},"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":"with([\n \"nom\" => $mayname,\n \"poste\" => $poste,\n \"skills\" => $skills\n ]);\n\n\n }\n}\n"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":633,"cells":{"blob_id":{"kind":"string","value":"08e8f65725f5da5ff519e12fc5d6020058cf2781"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"plmhq/web-re-deprecated"},"path":{"kind":"string","value":"/app/controllers/APIController.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2361,"string":"2,361"},"score":{"kind":"number","value":2.828125,"string":"2.828125"},"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":"setStatusCode(self::HTTP_OK)\n\t\t\t->respond($data, $headers);\n\t}\n\n\t/**\n\t * Respond a 404 error\n\t * \n\t * @param array|object \t $data\n\t * @return \tResponse\n\t */\n\tprotected function respond404($data = [], $headers = [])\n\t{\n\t\treturn $this->setStatusCode(self::HTTP_NOT_FOUND)\n\t\t\t->respond($data, $headers)\n\t}\n\n\t/**\n\t * Returns a successful response\n\t * \n\t * @param array|object \tdata\n\t * @return Response\n\t */\n\tprotected function respondWithErrors($data = [], $headers = [])\n\t{\n\t\treturn $this->setStatusCode(self::HTTP_BAD_REQUEST)\n\t\t\t->respond($data), $headers;\n\t}\n\n\t/**\n\t * Sets status code\n\t * @param int \t$statusCode\n\t * @return \t$this\n\t */\n\tprivate function setStatusCode($statusCode)\n\t{\n\t\t$this->statusCode = $statusCode;\n\t\t\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Actual response implementation\n\t * \n\t * @param array|object $data\n\t * @return Response\n\t */\n\tprotected function respond($data = [], $headers = [])\n\t{\n\t\treturn Response::json(\n\t\t\t$data,\n\t\t\t$this->statusCode,\n\t\t\t$headers\n\t\t);\n\t}\n\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":634,"cells":{"blob_id":{"kind":"string","value":"bf64d660b455974cca293f9e50092f9e2cdd4255"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"WPPlugins/agentrank"},"path":{"kind":"string","value":"/reviews.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":3669,"string":"3,669"},"score":{"kind":"number","value":2.875,"string":"2.875"},"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":"view_all_reviews($start, $display);\r\n//if empty response print service unavailable message\r\nif (empty($xml)) {\r\n $htm = \"\";\r\n return $htm;\r\n}\r\n//check that $xml response is returned from api\r\nif (!empty($xml)) {\r\n if ($xml->status['code'] == '400') {\r\n $error_message = $xml->status->messages->message;\r\n return \"

$error_message

Please check your admin setting

\";\r\n }\r\n//parse total number of records from response\r\n $num_records = $xml->reviews['total_results'];\r\n// Determine how many pages there are.\r\n if (isset($_GET['np'])) { // Already been determined.\r\n $num_pages = $_GET['np'];\r\n } else { // Need to determine.\r\n // Calculate the number of pages.\r\n if ($num_records > $display) { // More than 1 page.\r\n $num_pages = ceil($num_records / $display); // use ceil to round up to nearest number.\r\n } else {\r\n $num_pages = 1;\r\n }\r\n } // End of np IF.\r\n $htm = \"
\";\r\n $htm .= \"

View All Client Reviews

\";\r\n if ($status_code = \"200\") {\r\n $htm .= \"
\";\r\n foreach ($xml->charts->image as $image) {\r\n $image_title = $image['alt'];\r\n $image_url = $image['url'];\r\n $image_height = $image['height'];\r\n $image_width = $image['width'];\r\n $htm .= \"
$image_title
\";\r\n }\r\n $htm .= \"
\";\r\n $htm .= \"
\";\r\n $htm .= \"
    \";\r\n foreach ($xml->reviews->review as $review) {\r\n $id = $review['id'];\r\n $title = $review->title;\r\n $review_url = get_bloginfo('url') . \"/agentrank/review?id=$id\";\r\n $htm .= \"
  • \" . $title . \"
  • \";\r\n }\r\n $htm .= \"
\";\r\n }\r\n //end if($status_code = \"200\")\r\n $q_url_structure = get_bloginfo('url') . \"/agentrank/reviews\";\r\n// Make the links to other pages, if necessary.\r\n if ($num_pages > 1) {\r\n $htm .= \"
\";\r\n // Determine what page the script is on.\r\n $current_page = $start;\r\n // If it's not the first page, make a Previous button.\r\n if ($current_page != 0) {\r\n $htm .= \"Previous \";\r\n }\r\n // Make all the numbered pages.\r\n for ($i = 0; $i < $num_pages; $i++) {\r\n if ($i != $current_page) {\r\n $htm .= \"\" . ($i + 1) . \" \";\r\n } else {\r\n $htm .= '';\r\n $htm .= ($i + 1);\r\n $htm .= '';\r\n $htm .= ' ';\r\n }\r\n }\r\n // If it's not the last page, make a Next button.\r\n if (($current_page + 1) != $num_pages) {\r\n $htm .= \"Next\";\r\n }\r\n $htm .= \"
\";\r\n } // End of links section.\r\n $htm .= \"
\";\r\n}\r\n//end of if(!empty($xml))\r\nreturn $htm;\r\n?>"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":635,"cells":{"blob_id":{"kind":"string","value":"9db8de038a732a70b20b71d6e2355131aecdf1a3"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"ZYallers/easyswoole3"},"path":{"kind":"string","value":"/App/Utility/Code.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":750,"string":"750"},"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":" 'sign非法',\n 0001 => 'token超时',\n 200 => 'OK',\n 400 => 'Bad Request',\n 401 => '请登录后再操作',\n 404 => 'Not Found',\n 501 => '参数缺少或非法',\n ];\n\n static function getReasonPhrase($statusCode): string\n {\n return isset(self::$phrases[$statusCode]) ? self::$phrases[$statusCode] : '';\n }\n}"},"download_success":{"kind":"bool","value":true,"string":"true"}}},{"rowIdx":636,"cells":{"blob_id":{"kind":"string","value":"422d6e4fdcffb25829385b60d7616759f49602d1"},"language":{"kind":"string","value":"PHP"},"repo_name":{"kind":"string","value":"amaraimusi/CrudBaseBulk"},"path":{"kind":"string","value":"/app/View/Helper/AppHelper.php"},"src_encoding":{"kind":"string","value":"UTF-8"},"length_bytes":{"kind":"number","value":2817,"string":"2,817"},"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":"有効\";\n\t\t\t\t}elseif($ent['delete_flg']==1){\n\t\t\t\t\t$v=\"削除\";\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase CB_FLD_BR://改行対応\n\t\t\t\tif(empty($v)){break;}\n\n\t\t\t\t$v= str_replace('\\\\r\\\\n', '
', h($v));\n\t\t\t\t$v= str_replace('\\\\', '', $v);\n\t\t\t\tbreak;\n\n\t\t\tcase CB_FLD_BOUTOU://長文字用。テキストエリアなど長文字を指定文字数分表示。\n\n\t\t\t\tif(empty($v)){break;}\n\n\t\t\t\t$strLen=20;//表示文字数\n\t\t\t\tif(!empty($option)){\n\t\t\t\t\t$strLen=$option;\n\t\t\t\t}\n\t\t\t\t$v=mb_strimwidth($v, 0, $strLen, \"...\");\n\t\t\t\t$v= str_replace('\\\\r\\\\n', ' ', h($v));\n\t\t\t\t$v= str_replace('\\\\', '', $v);\n\n\t\t\t\tbreak;\n\n\t\t\tcase CB_FLD_TEXTAREA://テキストエリア用(改行対応)\n\t\t\t\tif(empty($v)){break;}\n\n\t\t\t\t$v = str_replace('\\\\r\\\\n', '&#13;', h($ent[$key]));//サニタイズされた改行コードを「&#13;」に置換\n\t\t\t\t$v = str_replace('\\\\', '', $v);\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn $v;\n\n\t}\n\n\n\t/**\n\t * ラベル名と値からなる要素を作成\n\t * ent_show_xの拡張メソッド\n\t */\n\tfunction ent_show_preview($label_name,$ent,$key,$type=null,$option=array()){\n\n\t\t$value=$this->ent_show_x($ent,$key,$type,$option);\n\t\t$h=\"\n\t\t\t
\n\t\t\t
{$label_name}
\n\t\t\t
{$value}
\n\t\t\t
\n\t\t\t
\";\n\n\t\treturn $h;\n\n\t}\n\n\n\n\n\n\n\t/**\n\t * 配列からdatalistを作成する。\n\t * @param $id ID属性\n\t * @param $list datalist内に表示するオプション\n\t * @return datalist要素のHTML\n\t */\n\tfunction datalist($id,$list){\n\n\t\t$str_options='';\n\t\tforeach($list as $v){\n\t\t\t$str_options.=\"