repo
stringlengths
7
63
file_url
stringlengths
81
284
file_path
stringlengths
5
200
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:02:33
2026-01-05 05:24:06
truncated
bool
2 classes
SiavashBamshadnia/Laravel-Query-Enrich
https://github.com/SiavashBamshadnia/Laravel-Query-Enrich/blob/bafb849ed83b7c816d9a94a0d71651821db780a0/tests/SQLServerBasicFunctionsTest.php
tests/SQLServerBasicFunctionsTest.php
<?php use Workbench\BaseTest\BaseBasicFunctionsTest; class SQLServerBasicFunctionsTest extends BaseBasicFunctionsTest { protected function getDatabaseEngine(): string { return 'sqlsrv'; } }
php
MIT
bafb849ed83b7c816d9a94a0d71651821db780a0
2026-01-05T04:51:45.342665Z
false
SiavashBamshadnia/Laravel-Query-Enrich
https://github.com/SiavashBamshadnia/Laravel-Query-Enrich/blob/bafb849ed83b7c816d9a94a0d71651821db780a0/tests/MysqlWhereClauseTest.php
tests/MysqlWhereClauseTest.php
<?php use Workbench\BaseTest\BaseWhereClauseTest; class MysqlWhereClauseTest extends BaseWhereClauseTest { protected function getDatabaseEngine(): string { return 'mysql'; } }
php
MIT
bafb849ed83b7c816d9a94a0d71651821db780a0
2026-01-05T04:51:45.342665Z
false
SiavashBamshadnia/Laravel-Query-Enrich
https://github.com/SiavashBamshadnia/Laravel-Query-Enrich/blob/bafb849ed83b7c816d9a94a0d71651821db780a0/tests/MariaDBlBasicFunctionsTest.php
tests/MariaDBlBasicFunctionsTest.php
<?php use Orchestra\Testbench\TestCase; use Workbench\BaseTest\BaseBasicFunctionsTest; if (!str_starts_with(phpversion(), '8.1')) { class MariaDBlBasicFunctionsTest extends BaseBasicFunctionsTest { protected function getDatabaseEngine(): string { return 'mariadb'; } } } else { class MariaDBlBasicFunctionsTest extends TestCase { public function testTrue() { self::assertTrue(true); } protected function getDatabaseEngine(): string { return ''; } } }
php
MIT
bafb849ed83b7c816d9a94a0d71651821db780a0
2026-01-05T04:51:45.342665Z
false
SiavashBamshadnia/Laravel-Query-Enrich
https://github.com/SiavashBamshadnia/Laravel-Query-Enrich/blob/bafb849ed83b7c816d9a94a0d71651821db780a0/tests/MariaDBProjectionTest.php
tests/MariaDBProjectionTest.php
<?php use Orchestra\Testbench\TestCase; use Workbench\BaseTest\BaseProjectionTest; if (!str_starts_with(phpversion(), '8.1')) { class MariaDBProjectionTest extends BaseProjectionTest { protected function getDatabaseEngine(): string { return 'mariadb'; } } } else { class MariaDBProjectionTest extends TestCase { public function testTrue() { self::assertTrue(true); } } }
php
MIT
bafb849ed83b7c816d9a94a0d71651821db780a0
2026-01-05T04:51:45.342665Z
false
SiavashBamshadnia/Laravel-Query-Enrich
https://github.com/SiavashBamshadnia/Laravel-Query-Enrich/blob/bafb849ed83b7c816d9a94a0d71651821db780a0/tests/SqliteWhereClauseTest.php
tests/SqliteWhereClauseTest.php
<?php use Workbench\BaseTest\BaseWhereClauseTest; class SqliteWhereClauseTest extends BaseWhereClauseTest { protected function getDatabaseEngine(): string { return 'sqlite'; } }
php
MIT
bafb849ed83b7c816d9a94a0d71651821db780a0
2026-01-05T04:51:45.342665Z
false
SiavashBamshadnia/Laravel-Query-Enrich
https://github.com/SiavashBamshadnia/Laravel-Query-Enrich/blob/bafb849ed83b7c816d9a94a0d71651821db780a0/tests/MysqlBasicFunctionsTest.php
tests/MysqlBasicFunctionsTest.php
<?php use Workbench\BaseTest\BaseBasicFunctionsTest; class MysqlBasicFunctionsTest extends BaseBasicFunctionsTest { protected function getDatabaseEngine(): string { return 'mysql'; } }
php
MIT
bafb849ed83b7c816d9a94a0d71651821db780a0
2026-01-05T04:51:45.342665Z
false
SiavashBamshadnia/Laravel-Query-Enrich
https://github.com/SiavashBamshadnia/Laravel-Query-Enrich/blob/bafb849ed83b7c816d9a94a0d71651821db780a0/tests/PostgreSQLProjectionTest.php
tests/PostgreSQLProjectionTest.php
<?php use Workbench\BaseTest\BaseProjectionTest; class PostgreSQLProjectionTest extends BaseProjectionTest { protected function getDatabaseEngine(): string { return 'pgsql'; } }
php
MIT
bafb849ed83b7c816d9a94a0d71651821db780a0
2026-01-05T04:51:45.342665Z
false
SiavashBamshadnia/Laravel-Query-Enrich
https://github.com/SiavashBamshadnia/Laravel-Query-Enrich/blob/bafb849ed83b7c816d9a94a0d71651821db780a0/tests/SqliteProjectionTest.php
tests/SqliteProjectionTest.php
<?php use Workbench\BaseTest\BaseProjectionTest; class SqliteProjectionTest extends BaseProjectionTest { protected function getDatabaseEngine(): string { return 'sqlite'; } }
php
MIT
bafb849ed83b7c816d9a94a0d71651821db780a0
2026-01-05T04:51:45.342665Z
false
SiavashBamshadnia/Laravel-Query-Enrich
https://github.com/SiavashBamshadnia/Laravel-Query-Enrich/blob/bafb849ed83b7c816d9a94a0d71651821db780a0/tests/MysqlProjectionTest.php
tests/MysqlProjectionTest.php
<?php use Workbench\BaseTest\BaseProjectionTest; class MysqlProjectionTest extends BaseProjectionTest { protected function getDatabaseEngine(): string { return 'mysql'; } }
php
MIT
bafb849ed83b7c816d9a94a0d71651821db780a0
2026-01-05T04:51:45.342665Z
false
SiavashBamshadnia/Laravel-Query-Enrich
https://github.com/SiavashBamshadnia/Laravel-Query-Enrich/blob/bafb849ed83b7c816d9a94a0d71651821db780a0/tests/PostgreSQLWhereClauseTest.php
tests/PostgreSQLWhereClauseTest.php
<?php use Workbench\BaseTest\BaseWhereClauseTest; class PostgreSQLWhereClauseTest extends BaseWhereClauseTest { protected function getDatabaseEngine(): string { return 'pgsql'; } }
php
MIT
bafb849ed83b7c816d9a94a0d71651821db780a0
2026-01-05T04:51:45.342665Z
false
SiavashBamshadnia/Laravel-Query-Enrich
https://github.com/SiavashBamshadnia/Laravel-Query-Enrich/blob/bafb849ed83b7c816d9a94a0d71651821db780a0/tests/MariaDBWhereClauseTest.php
tests/MariaDBWhereClauseTest.php
<?php use Orchestra\Testbench\TestCase; use Workbench\BaseTest\BaseWhereClauseTest; if (!str_starts_with(phpversion(), '8.1')) { class MariaDBWhereClauseTest extends BaseWhereClauseTest { protected function getDatabaseEngine(): string { return 'mariadb'; } } } else { class MariaDBWhereClauseTest extends TestCase { public function testTrue() { self::assertTrue(true); } protected function getDatabaseEngine(): string { return ''; } } }
php
MIT
bafb849ed83b7c816d9a94a0d71651821db780a0
2026-01-05T04:51:45.342665Z
false
SiavashBamshadnia/Laravel-Query-Enrich
https://github.com/SiavashBamshadnia/Laravel-Query-Enrich/blob/bafb849ed83b7c816d9a94a0d71651821db780a0/tests/PostgreSQLBasicFunctionsTest.php
tests/PostgreSQLBasicFunctionsTest.php
<?php use Workbench\BaseTest\BaseBasicFunctionsTest; class PostgreSQLBasicFunctionsTest extends BaseBasicFunctionsTest { protected function getDatabaseEngine(): string { return 'pgsql'; } }
php
MIT
bafb849ed83b7c816d9a94a0d71651821db780a0
2026-01-05T04:51:45.342665Z
false
SiavashBamshadnia/Laravel-Query-Enrich
https://github.com/SiavashBamshadnia/Laravel-Query-Enrich/blob/bafb849ed83b7c816d9a94a0d71651821db780a0/tests/SqliteBasicFunctionsTest.php
tests/SqliteBasicFunctionsTest.php
<?php use Workbench\BaseTest\BaseBasicFunctionsTest; class SqliteBasicFunctionsTest extends BaseBasicFunctionsTest { protected function getDatabaseEngine(): string { return 'sqlite'; } }
php
MIT
bafb849ed83b7c816d9a94a0d71651821db780a0
2026-01-05T04:51:45.342665Z
false
SiavashBamshadnia/Laravel-Query-Enrich
https://github.com/SiavashBamshadnia/Laravel-Query-Enrich/blob/bafb849ed83b7c816d9a94a0d71651821db780a0/tests/SQLServerProjectionTest.php
tests/SQLServerProjectionTest.php
<?php use Workbench\BaseTest\BaseProjectionTest; class SQLServerProjectionTest extends BaseProjectionTest { protected function getDatabaseEngine(): string { return 'sqlsrv'; } }
php
MIT
bafb849ed83b7c816d9a94a0d71651821db780a0
2026-01-05T04:51:45.342665Z
false
SiavashBamshadnia/Laravel-Query-Enrich
https://github.com/SiavashBamshadnia/Laravel-Query-Enrich/blob/bafb849ed83b7c816d9a94a0d71651821db780a0/tests/SQLServerWhereClauseTest.php
tests/SQLServerWhereClauseTest.php
<?php use Workbench\BaseTest\BaseWhereClauseTest; class SQLServerWhereClauseTest extends BaseWhereClauseTest { protected function getDatabaseEngine(): string { return 'sqlsrv'; } }
php
MIT
bafb849ed83b7c816d9a94a0d71651821db780a0
2026-01-05T04:51:45.342665Z
false
darkwhispering/facebook-sdk-codeigniter
https://github.com/darkwhispering/facebook-sdk-codeigniter/blob/f29fb15d81542be7c7769b49b7d70569f9cc8390/application/controllers/Example.php
application/controllers/Example.php
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Example extends CI_Controller { public function __construct() { parent::__construct(); // Load library and url helper $this->load->library('facebook'); $this->load->helper('url'); } // ------------------------------------------------------------------------ /** * Index page */ public function index() { $this->load->view('examples/start'); } // ------------------------------------------------------------------------ /** * Web redirect login example page */ public function web_login() { $data['user'] = array(); // Check if user is logged in if ($this->facebook->is_authenticated()) { // User logged in, get user details $user = $this->facebook->request('get', '/me?fields=id,name,email'); if (!isset($user['error'])) { $data['user'] = $user; } } // display view $this->load->view('examples/web', $data); } // ------------------------------------------------------------------------ /** * JS SDK login example */ public function js_login() { // Load view $this->load->view('examples/js'); } // ------------------------------------------------------------------------ /** * AJAX request method for positing to facebook feed */ public function post() { header('Content-Type: application/json'); $result = $this->facebook->request( 'post', '/me/feed', ['message' => $this->input->post('message')] ); echo json_encode($result); } // ------------------------------------------------------------------------ /** * Logout for web redirect example * * @return [type] [description] */ public function logout() { $this->facebook->destroy_session(); redirect('example/web_login', redirect); } }
php
MIT
f29fb15d81542be7c7769b49b7d70569f9cc8390
2026-01-05T04:51:45.486028Z
false
darkwhispering/facebook-sdk-codeigniter
https://github.com/darkwhispering/facebook-sdk-codeigniter/blob/f29fb15d81542be7c7769b49b7d70569f9cc8390/application/views/examples/web.php
application/views/examples/web.php
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Facebook PHP SDK for CodeIgniter - Redirect login example</title> <style> body { padding: 0; margin: 0; font-family: Helvetica, Sans-serif; font-size: 16px; color: #333; line-height: 1.5; } .wrapper { width: 800px; margin: 60px auto; border: 1px solid #eee; background: #fcfcfc; padding: 0 20px 20px; box-shadow: 1px 1px 2px rgba(0,0,0,0.1); } h1, h3 { text-align: center; } .login { text-align: center; } a { border: none; background: #2F5B85; color: #fff; font-size: 18px; padding: 10px 20px; margin: 20px auto; cursor: pointer; transition: background .6s ease; } a:hover { background: #999; } </style> </head> <body> <div class="wrapper"> <h1>Facebook PHP SDK for CodeIgniter</h1> <h3>Redirect login example</h3> <p> Simple example how you can use the Facebook PHP SDK for CodeIgniter and the Web Redirect login method. </p> <p> <strong> For this example to work, make sure you have set 'facebook_login_type' as 'web' and specified login and logout redirect links in the config file. </strong> </p> <p> This example code do 3 things <ol> <li>Check if a user is logged in on page load.</li> <li>If user are logged in, displayes some basic information about the user and a logout button.</li> <li>If user is not logged in, display login button.</li> </ol> </p> <?php if ( ! $this->facebook->is_authenticated()) : ?> <div class="login"> <a href="<?php echo $this->facebook->login_url(); ?>">Login</a> </div> <?php else : ?> <div class="user-info"> <p><strong>User information</strong></p> <ul> <?php foreach ($user as $key => $value) : ?> <li><?php echo $key; ?> : <?php echo $value; ?></li> <?php endforeach; ?> </ul> <p> <a href="<?php echo $this->facebook->logout_url(); ?>">Logout</a> </p> </div> <div class="upload-form"> <?php if ($this->input->post('imageFile')) { $response = $this->facebook->user_upload_request( $this->input->post('imageFile'), ['message' => 'This is a test'] ); var_dump($response); } ?> <form method="POST"> <input type="text" name="imageFile" value="<?php echo APPPATH; ?>MM8354_GrandCanyon.jpg"/> <input type="submit" name="upload" value="Upload"/> </form> </div> <?php endif; ?> </div> </body> </html>
php
MIT
f29fb15d81542be7c7769b49b7d70569f9cc8390
2026-01-05T04:51:45.486028Z
false
darkwhispering/facebook-sdk-codeigniter
https://github.com/darkwhispering/facebook-sdk-codeigniter/blob/f29fb15d81542be7c7769b49b7d70569f9cc8390/application/views/examples/start.php
application/views/examples/start.php
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Facebook PHP SDK for CodeIgniter</title> <style> body { padding: 0; margin: 0; font-family: Helvetica, Sans-serif; font-size: 16px; color: #333; line-height: 1.5; } .wrapper { width: 800px; margin: 60px auto; border: 1px solid #eee; background: #fcfcfc; padding: 0 20px 20px; box-shadow: 1px 1px 2px rgba(0,0,0,0.1); } h1, h3 { text-align: center; } .examples a { border: medium none; background: none repeat scroll 0% 0% #eee; color: #333; font-size: 24px; padding: 40px 20px; margin: 20px 2%; cursor: pointer; text-decoration: none; border: 1px solid #e9e9e9; width: 40.47%; display: inline-block; text-align: center; transition: background .6s ease; } .examples a:hover { background: #ccc; } </style> </head> <body> <div class="wrapper"> <h1>Facebook PHP SDK for CodeIgniter</h1> <p>Library for integration of Facebook PHP SDK with CodeIgniter 3+</p> <p><strong>Version:</strong> 3.0.0</p> <p>Documentation for this library can be found <a href="https://github.com/darkwhispering/facebook-sdk-codeigniter" target="_blank">here</a>, and documentation about Facebook PHP SDK v5 can be found <a href="https://developers.facebook.com/docs/php/gettingstarted/" target="_blank">here</a>.</p> <div class="examples"> <a href="/example/web_login" class="web">Redirect Login<br/>Example</a> <a href="/example/js_login" class="js">Javascript Login<br/>Example</a> </div> </div> </body> </html>
php
MIT
f29fb15d81542be7c7769b49b7d70569f9cc8390
2026-01-05T04:51:45.486028Z
false
darkwhispering/facebook-sdk-codeigniter
https://github.com/darkwhispering/facebook-sdk-codeigniter/blob/f29fb15d81542be7c7769b49b7d70569f9cc8390/application/views/examples/js.php
application/views/examples/js.php
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Facebook PHP SDK for CodeIgniter - Javascript SDK login example</title> <style> body { padding: 0; margin: 0; font-family: Helvetica, Sans-serif; font-size: 16px; color: #333; line-height: 1.5; } .wrapper { width: 800px; margin: 60px auto; border: 1px solid #eee; background: #fcfcfc; padding: 0 20px 20px; box-shadow: 1px 1px 2px rgba(0,0,0,0.1); } h1, h3 { text-align: center; } .login, .form { text-align: center; } .login button, input[type="submit"] { border: none; background: #2F5B85; color: #fff; font-size: 18px; padding: 10px 20px; margin: 20px auto; cursor: pointer; transition: background .6s ease; } .login button:hover, input[type="submit"]:hover { background: #999; } textarea { width: 96%; height: 200px; background: #fff; border: 1px solid #ccc; padding: 2%; } .form {display:none;} .note { font-size: 12px; color: #888; } </style> </head> <body> <div class="wrapper"> <h1>Facebook PHP SDK for CodeIgniter</h1> <h3>Javascript SDK login example</h3> <p>Simple example how you can use the Facebook PHP SDK for CodeIgniter together with the Facebook Javascript SDK and the login to Facebook functionality.</p> <p><strong>For this example to work, make sure you have set 'facebook_login_type' as 'js' in the config file and have <i>publish_actions</i> permissions!</strong></p> <p> This example code do 4 things <ol> <li>Check if the user is logged in to Facebook on page load.</li> <li>If user are logged in, display form to user to publish to their wall.</li> <li>If user is not logged in, display login button.</li> <li>Display the form after login and publish to users wall when subbmitting form without any page refresh</li> </ol> </p> <div class="login"> <button>Login</button> </div> <div class="form"> <form class="post-to-wall"> <textarea name="message" placeholder="Type some text here and submit to post to your wall"></textarea> <input type="submit" name="submit" value="Post" /> </form> </div> <p class="note"><i>Note: You can publish text posts to a users wall using only the Javascript SDK. This is ONLY an example on how the Javascript SDK can work togheter with the PHP SDK to publish and/or read information and content.</i></p> </div> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script> // Initiate Facebook JS SDK window.fbAsyncInit = function() { FB.init({ appId : '<?php echo $this->config->item('facebook_app_id'); ?>', // Your app id cookie : true, // enable cookies to allow the server to access the session xfbml : false, // disable xfbml improves the page load time version : 'v2.5', // use version 2.4 status : true // Check for user login status right away }); FB.getLoginStatus(function(response) { console.log('getLoginStatus', response); loginCheck(response); }); }; // Check login status function statusCheck(response) { console.log('statusCheck', response.status); if (response.status === 'connected') { $('.login').hide(); $('.form').fadeIn(); } else if (response.status === 'not_authorized') { // User logged into facebook, but not to our app. } else { // User not logged into Facebook. } } // Get login status function loginCheck() { FB.getLoginStatus(function(response) { console.log('loginCheck', response); statusCheck(response); }); } // Here we run a very simple test of the Graph API after login is // successful. See statusChangeCallback() for when this call is made. function getUser() { FB.api('/me', function(response) { console.log('getUser', response); }); } $(function(){ // Trigger login $('.login').on('click', 'button', function() { FB.login(function(){ loginCheck(); }, {scope: '<?php echo implode(",", $this->config->item('facebook_permissions')); ?>'}); }); $('.form').on('submit', '.post-to-wall', function(e) { e.preventDefault(); var formdata = $(this).serialize(); $.ajax({ url: '/example/post', data: formdata, type: 'POST', dataType: 'json', success: function(response) { console.log(response); if (response.id) { $('.form').html('<p>Post submitted successfully.</p>'); } else { $('.form').html('<p>Something happened, please try again!.</p>'); } } }) }); }); (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> </body> </html>
php
MIT
f29fb15d81542be7c7769b49b7d70569f9cc8390
2026-01-05T04:51:45.486028Z
false
darkwhispering/facebook-sdk-codeigniter
https://github.com/darkwhispering/facebook-sdk-codeigniter/blob/f29fb15d81542be7c7769b49b7d70569f9cc8390/application/libraries/Facebook.php
application/libraries/Facebook.php
<?php defined('BASEPATH') OR exit('No direct script access allowed'); /** * Facebook PHP SDK for CodeIgniter 3 * * Library wrapper for Facebook PHP SDK. Check user login status, publish to feed * and more with easy to use CodeIgniter syntax. * * This library requires the Facebook PHP SDK to be installed with Composer, and that CodeIgniter * config is set to autoload the vendor folder. More information in the CodeIgniter user guide at * http://www.codeigniter.com/userguide3/general/autoloader.html?highlight=composer * * It also requires CodeIgniter session library to be correctly configured. * * @package CodeIgniter * @category Libraries * @author Mattias Hedman * @license MIT * @link https://github.com/darkwhispering/facebook-sdk-codeigniter * @version 3.0.0 */ use Facebook\Facebook as FB; use Facebook\Authentication\AccessToken; use Facebook\Exceptions\FacebookResponseException; use Facebook\Exceptions\FacebookSDKException; use Facebook\FacebookBatchResponse; use Facebook\Helpers\FacebookCanvasHelper; use Facebook\Helpers\FacebookJavaScriptHelper; use Facebook\Helpers\FacebookPageTabHelper; use Facebook\Helpers\FacebookRedirectLoginHelper; Class Facebook { const UPLOAD_TYPE_VIDEO = 'video'; const UPLOAD_TYPE_IMAGE = 'image'; /** * @var FB */ private $fb; /** * @var FacebookRedirectLoginHelper|FacebookCanvasHelper|FacebookJavaScriptHelper|FacebookPageTabHelper */ private $helper; /** * @var array */ private $batch_request_pool = []; /** * Facebook constructor. */ public function __construct() { // Load config $this->load->config('facebook'); // Load required libraries and helpers $this->load->library('session'); $this->load->helper('url'); if (!isset($this->fb)) { $this->fb = new FB([ 'app_id' => $this->config->item('facebook_app_id'), 'app_secret' => $this->config->item('facebook_app_secret'), 'default_graph_version' => $this->config->item('facebook_graph_version') ]); } // Load correct helper depending on login type // set in the config file switch ($this->config->item('facebook_login_type')) { case 'js': $this->helper = $this->fb->getJavaScriptHelper(); break; case 'canvas': $this->helper = $this->fb->getCanvasHelper(); break; case 'page_tab': $this->helper = $this->fb->getPageTabHelper(); break; case 'web': $this->helper = $this->fb->getRedirectLoginHelper(); break; } if ($this->config->item('facebook_auth_on_load') === TRUE) { // Try and authenticate the user right away (aka, get valid access token) $this->authenticate(); } } /** * @return FB */ public function object() { return $this->fb; } /** * Check if user are logged in by checking if we have a Facebook * session active. * * @return mixed|boolean */ public function is_authenticated() { $access_token = $this->authenticate(); if (isset($access_token)) { return $access_token; } return false; } /** * Do Graph request * * @param $method * @param $endpoint * @param array $params * @param null $access_token * * @return array */ public function request($method, $endpoint, $params = [], $access_token = null) { try { $response = $this->fb->{strtolower($method)}($endpoint, $params, $access_token); return $response->getDecodedBody(); } catch(FacebookResponseException $e) { return $this->logError($e->getCode(), $e->getMessage()); } catch (FacebookSDKException $e) { return $this->logError($e->getCode(), $e->getMessage()); } } /** * Upload image or video to user profile * * @param $path_to_file * @param array $params * @param string $type * @param null $access_token * * @return array */ public function user_upload_request($path_to_file, $params = [], $type = self::UPLOAD_TYPE_IMAGE, $access_token = null) { if ($type === self::UPLOAD_TYPE_IMAGE) { $data = ['source' => $this->fb->fileToUpload($path_to_file)] + $params; $endpoint = '/me/photos'; } elseif ($type === self::UPLOAD_TYPE_VIDEO) { $data = ['source' => $this->fb->videoToUpload($path_to_file)] + $params; $endpoint = '/me/videos'; } else { return $this->logError(400, 'Invalid upload type'); } try { $response = $this->fb->post($endpoint, $data, $access_token); return $response->getDecodedBody(); } catch(FacebookSDKException $e) { return $this->logError($e->getCode(), $e->getMessage()); } } /** * Add request to batch * * @param $key * @param $method * @param $endpoint * @param array $params * @param null $access_token */ public function add_to_batch_pool($key, $method, $endpoint, $params = [], $access_token = null) { $this->batch_request_pool = array_merge( $this->batch_request_pool, [$key => $this->fb->request($method, $endpoint, $params, $access_token)] ); } /** * Remove request from batch * * @param $key */ public function remove_from_batch_pool($key) { if (isset($this->batch_request_pool[$key])) { unset($this->batch_request_pool[$key]); } } /** * Send all request in the batch pool * * @return array|FacebookBatchResponse */ public function send_batch_pool() { try { $responses = $this->fb->sendBatchRequest($this->batch_request_pool); $this->batch_request_pool = []; $data = []; foreach ($responses as $key => $response) { $data[$key] = $response->getDecodedBody(); } return $data; } catch(FacebookResponseException $e) { return $this->logError($e->getCode(), $e->getMessage()); } catch(FacebookSDKException $e) { return $this->logError($e->getCode(), $e->getMessage()); } } /** * Generate Facebook login url for Facebook Redirect Login (web) * * @return string */ public function login_url() { // Login type must be web, else return empty string if ($this->config->item('facebook_login_type') != 'web') { return ''; } return $this->helper->getLoginUrl( base_url() . $this->config->item('facebook_login_redirect_url'), $this->config->item('facebook_permissions') ); } /** * Generate Facebook login url for Facebook Redirect Login (web) * * @return string * @throws FacebookSDKException */ public function logout_url() { // Login type must be web, else return empty string if ($this->config->item('facebook_login_type') != 'web') { return ''; } // Create logout url return $this->helper->getLogoutUrl( $this->get_access_token(), base_url() . $this->config->item('facebook_logout_redirect_url') ); } /** * Destroy our local Facebook session */ public function destroy_session() { $this->session->unset_userdata('fb_access_token'); } /** * Get a new access token from Facebook * * @return array|AccessToken|null|object|void */ private function authenticate() { $access_token = $this->get_access_token(); if ($access_token && $this->get_expire_time() > (time() + 30) || $access_token && !$this->get_expire_time()) { $this->fb->setDefaultAccessToken($access_token); return $access_token; } // If we did not have a stored access token or if it has expired, try get a new access token if (!$access_token) { try { $access_token = $this->helper->getAccessToken(); } catch (FacebookSDKException $e) { $this->logError($e->getCode(), $e->getMessage()); return null; } // If we got a session we need to exchange it for a long lived session. if (isset($access_token)) { $access_token = $this->long_lived_token($access_token); $this->set_expire_time($access_token->getExpiresAt()); $this->set_access_token($access_token); $this->fb->setDefaultAccessToken($access_token); return $access_token; } } // Collect errors if any when using web redirect based login if ($this->config->item('facebook_login_type') === 'web') { if ($this->helper->getError()) { // Collect error data $error = array( 'error' => $this->helper->getError(), 'error_code' => $this->helper->getErrorCode(), 'error_reason' => $this->helper->getErrorReason(), 'error_description' => $this->helper->getErrorDescription() ); return $error; } } return $access_token; } /** * Exchange short lived token for a long lived token * * @param AccessToken $access_token * * @return AccessToken|null */ private function long_lived_token(AccessToken $access_token) { if (!$access_token->isLongLived()) { $oauth2_client = $this->fb->getOAuth2Client(); try { return $oauth2_client->getLongLivedAccessToken($access_token); } catch (FacebookSDKException $e) { $this->logError($e->getCode(), $e->getMessage()); return null; } } return $access_token; } /** * Get stored access token * * @return mixed */ private function get_access_token() { return $this->session->userdata('fb_access_token'); } /** * Store access token * * @param AccessToken $access_token */ private function set_access_token(AccessToken $access_token) { $this->session->set_userdata('fb_access_token', $access_token->getValue()); } /** * @return mixed */ private function get_expire_time() { return $this->session->userdata('fb_expire'); } /** * @param DateTime $time */ private function set_expire_time(DateTime $time = null) { if ($time) { $this->session->set_userdata('fb_expire', $time->getTimestamp()); } } /** * @param $code * @param $message * * @return array */ private function logError($code, $message) { log_message('error', '[FACEBOOK PHP SDK] code: ' . $code.' | message: '.$message); return ['error' => $code, 'message' => $message]; } /** * Enables the use of CI super-global without having to define an extra variable. * I can't remember where I first saw this, so thank you if you are the original author. * * Borrowed from the Ion Auth library (http://benedmunds.com/ion_auth/) * * @param $var * * @return mixed */ public function __get($var) { return get_instance()->$var; } }
php
MIT
f29fb15d81542be7c7769b49b7d70569f9cc8390
2026-01-05T04:51:45.486028Z
false
darkwhispering/facebook-sdk-codeigniter
https://github.com/darkwhispering/facebook-sdk-codeigniter/blob/f29fb15d81542be7c7769b49b7d70569f9cc8390/application/config/facebook.php
application/config/facebook.php
<?php defined('BASEPATH') OR exit('No direct script access allowed'); /* | ------------------------------------------------------------------- | Facebook App details | ------------------------------------------------------------------- | | To get an facebook app details you have to be a registered developer | at http://developer.facebook.com and create an app for your project. | | facebook_app_id string Your facebook app ID. | facebook_app_secret string Your facebook app secret. | facebook_login_type string Set login type. (web, js, canvas) | facebook_login_redirect_url string URL tor redirect back to after login. Do not include domain. | facebook_logout_redirect_url string URL tor redirect back to after login. Do not include domain. | facebook_permissions array The permissions you need. | facebook_graph_version string Set Facebook Graph version to be used. Eg v2.6 | facebook_auth_on_load boolean Set to TRUE to have the library to check for valid access token on every page load. */ $config['facebook_app_id'] = ''; $config['facebook_app_secret'] = ''; $config['facebook_login_type'] = 'web'; $config['facebook_login_redirect_url'] = 'example/web_login'; $config['facebook_logout_redirect_url'] = 'example/logout'; $config['facebook_permissions'] = array('public_profile', 'publish_actions', 'email'); $config['facebook_graph_version'] = 'v2.6'; $config['facebook_auth_on_load'] = TRUE;
php
MIT
f29fb15d81542be7c7769b49b7d70569f9cc8390
2026-01-05T04:51:45.486028Z
false
Log1x/laravel-webfonts
https://github.com/Log1x/laravel-webfonts/blob/41bea5529ff2fe0c7969e3b9fed2ee55b95c8b60/src/Webfonts.php
src/Webfonts.php
<?php namespace Log1x\LaravelWebfonts; use Illuminate\Support\Str; class Webfonts { /** * The fonts to preload. */ protected array $fonts = []; /** * The asset manifest. */ protected ?array $manifest = null; /** * The Preload Webfonts instance. */ protected PreloadWebfonts $preload; /** * Determine if the WordPress handler has ran. */ protected bool $wordpress = false; /** * The fonts to allow. */ public static array $only = []; /** * The fonts to exclude. */ public static array $except = []; /** * Create a new Webfonts instance. */ public function __construct() { $this->fonts = $this->fonts(); $this->preload = PreloadWebfonts::make($this); } /** * Make a new instance of Webfonts. */ public static function make(): self { return new static; } /** * Run the Webfonts handlers. */ public function handle(): self { $this->handleWordPress(); return $this; } /** * Retrieve the Preload Webfonts instance. */ public function preload(): PreloadWebfonts { return $this->preload; } /** * Set the fonts to exclude. */ public static function except(array $except): void { static::$except = [...static::$except, ...$except]; } /** * Set the fonts to allow. */ public static function only(array $only): void { static::$only = [...static::$only, ...$only]; } /** * Retrieve the fonts from the manifest. */ public function fonts(array $except = [], array $only = []): array { if ($this->fonts) { return $this->fonts; } $except = [...static::$except, ...$except]; $only = [...static::$only, ...$only]; return collect($this->manifest()) ->filter(fn ($value, $key) => Str::endsWith($key, '.woff2')) ->filter(fn ($value, $key) => blank($only) || in_array(basename($key), $only) || in_array(basename($key, '.woff2'), $only)) ->reject(fn ($value, $key) => in_array(basename($key), $except) || in_array(basename($key, '.woff2'), $except)) ->all(); } /** * Handle the font preload markup for WordPress. */ protected function handleWordPress(): void { if ($this->wordpress || ! $this->isWordPress() || ! $this->fonts()) { return; } add_filter('wp_head', function () { if (! $markup = $this->preload()->build()) { return; } echo "{$markup}\n"; }, 5); $this->wordpress = true; } /** * Retrieve the asset manifest. */ protected function manifest(): array { return $this->manifest ??= $this->viteManifest(); } /** * Retrieve the Vite manifest. */ protected function viteManifest(): array { if (! file_exists($manifest = public_path('build/manifest.json'))) { return []; } $manifest = json_decode(file_get_contents($manifest), true); return collect($manifest) ->map(fn ($value, $key) => $value['file']) ->all(); } /** * Determine if the application is running WordPress. */ protected function isWordPress(): bool { return class_exists('\WP') && function_exists('\add_filter'); } }
php
MIT
41bea5529ff2fe0c7969e3b9fed2ee55b95c8b60
2026-01-05T04:52:00.873412Z
false
Log1x/laravel-webfonts
https://github.com/Log1x/laravel-webfonts/blob/41bea5529ff2fe0c7969e3b9fed2ee55b95c8b60/src/PreloadWebfonts.php
src/PreloadWebfonts.php
<?php namespace Log1x\LaravelWebfonts; class PreloadWebfonts { /** * The Webfonts instance. */ protected Webfonts $webfonts; /** * The font preload markup. */ protected ?string $markup = null; /** * Create a new Preload Fonts instance. */ public function __construct(Webfonts $webfonts) { $this->webfonts = $webfonts; } /** * Make a new instance of Preload Fonts. */ public static function make(Webfonts $webfonts): self { return new static($webfonts); } /** * Build the font preload markup. */ public function build(): ?string { if ($this->markup) { return $this->markup; } if (! $fonts = $this->webfonts()->fonts()) { return null; } return $this->markup = collect($fonts) ->map(fn ($font) => $this->asset($font)) ->map(fn ($font) => "<link rel='preload' href='{$font}' as='font' type='font/woff2' crossorigin>") ->implode("\n"); } /** * Retrieve the asset URL. */ protected function asset(string $font): string { return function_exists('\Roots\asset') ? \Roots\asset($font) : asset("build/{$font}"); } /** * Retrieve the Webfonts instance. */ protected function webfonts(): Webfonts { return $this->webfonts; } }
php
MIT
41bea5529ff2fe0c7969e3b9fed2ee55b95c8b60
2026-01-05T04:52:00.873412Z
false
Log1x/laravel-webfonts
https://github.com/Log1x/laravel-webfonts/blob/41bea5529ff2fe0c7969e3b9fed2ee55b95c8b60/src/WebfontsServiceProvider.php
src/WebfontsServiceProvider.php
<?php namespace Log1x\LaravelWebfonts; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Log1x\LaravelWebfonts\Console\Commands\WebfontsAddCommand; class WebfontsServiceProvider extends ServiceProvider { /** * Register any application services. * * @return void */ public function register() { $this->app->singleton('laravel-webfonts', fn () => Webfonts::make($this->app)); } /** * Bootstrap any application services. * * @return void */ public function boot() { if ($this->app->runningInConsole()) { $this->commands(WebfontsAddCommand::class); } $this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-webfonts'); Blade::directive('preloadFonts', fn () => "<?php echo app('laravel-webfonts')->preload()->build(); ?>"); $this->app->make('laravel-webfonts')->handle(); } }
php
MIT
41bea5529ff2fe0c7969e3b9fed2ee55b95c8b60
2026-01-05T04:52:00.873412Z
false
Log1x/laravel-webfonts
https://github.com/Log1x/laravel-webfonts/blob/41bea5529ff2fe0c7969e3b9fed2ee55b95c8b60/src/Facades/Webfonts.php
src/Facades/Webfonts.php
<?php namespace Log1x\LaravelWebfonts\Facades; use Illuminate\Support\Facades\Facade; class Webfonts extends Facade { /** * Get the registered name of the component. * * @return string */ protected static function getFacadeAccessor() { return 'laravel-webfonts'; } }
php
MIT
41bea5529ff2fe0c7969e3b9fed2ee55b95c8b60
2026-01-05T04:52:00.873412Z
false
Log1x/laravel-webfonts
https://github.com/Log1x/laravel-webfonts/blob/41bea5529ff2fe0c7969e3b9fed2ee55b95c8b60/src/Console/Commands/WebfontsAddCommand.php
src/Console/Commands/WebfontsAddCommand.php
<?php namespace Log1x\LaravelWebfonts\Console\Commands; use Exception; use Illuminate\Console\Command; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Http; use Illuminate\Support\Str; use ZipArchive; use function Laravel\Prompts\confirm; use function Laravel\Prompts\multisearch; use function Laravel\Prompts\multiselect; use function Laravel\Prompts\spin; use function Laravel\Prompts\table; class WebfontsAddCommand extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'webfonts:add {--path=css : The font stylesheet path} {--stylesheet=fonts : The font stylesheet filename} {--extension= : The font stylesheet extension} {--clear-cache : Clear the font cache} {--force : Force the download of the fonts}'; /** * The console command description. * * @var string */ protected $description = 'Add web fonts to the project'; /** * The Google webfonts. * * @var \Illuminate\Support\Collection */ protected $fonts; /** * The selected fonts. * * @var array */ protected $selected = []; /** * The downloaded fonts. * * @var array */ protected $downloaded = []; /** * The font faces. * * @var array */ protected $faces = []; /** * The fonts stylesheet path. * * @var string */ protected $stylesheet; /** * The Google webfonts API endpoint. * * @var string */ protected $api = 'https://gwfh.mranftl.com/api/fonts'; /** * The cache key. * * @var string */ protected $cache = 'google-webfonts'; /** * The cache expiry. * * @var int */ protected $expiry = 86400; /** * Execute the console command. */ public function handle() { if ($this->option('clear-cache')) { cache()->forget($this->cache); } $this->fonts = spin( fn () => $this->fonts(), 'Fetching fonts from the <fg=blue>Google Webfonts Helper API</>...' ); if ($this->fonts->isEmpty()) { $this->components->error('Unable to fetch fonts from the API.'); cache()->forget($this->cache); return; } $this->selected = multisearch( label: 'Select the fonts you would like to add to your project', options: fn (string $value) => strlen($value) > 0 ? $this->fonts ->filter(fn ($font) => Str::contains(Str::lower($font->family), Str::lower($value))) ->mapWithKeys(fn ($font) => [$font->id => $font->family]) ->all() : [], scroll: 10, placeholder: 'Inter', hint: "<fg=blue>{$this->fonts->count()}</> fonts available.", required: 'You must select at least one font.', ); foreach ($this->selected as $key => $font) { $font = $this->fonts->get($font); $variants = multiselect( label: "Select the variants you would like to add to {$font->family}", options: $font->variants, scroll: 10, required: 'You must select at least one variant.', default: [$font->defVariant], ); $subsets = multiselect( label: "Select the subsets you would like to add to {$font->family}", options: $font->subsets, scroll: 10, required: 'You must select at least one subset.', default: [$font->defSubset], ); $this->selected[$key] = [ 'id' => $font->id, 'name' => $font->family, 'variants' => $variants, 'subsets' => $subsets, ]; } $selected = collect($this->selected); $this->line(" <fg=blue>❯</> The following <fg=blue>{$selected->count()}</> fonts will be added to your project:"); table( ['<fg=blue>Name</>', '<fg=blue>Variants</>', '<fg=blue>Subsets</>'], $selected->map(function ($font) { $variants = Str::limit( collect($this->fonts->get($font['id'])->variants) ->filter(fn ($variant, $key) => in_array($key, $font['variants'])) ->implode(', '), 25 ); $subsets = Str::limit( collect($this->fonts->get($font['id'])->subsets) ->filter(fn ($subset, $key) => in_array($key, $font['subsets'])) ->implode(', '), 25 ); return [ $font['name'], $variants, $subsets, ]; })->all() ); $count = count($this->selected); $confirmed = confirm("You are about to add {$count} font(s) to your project. Do you wish to continue?"); if (! $confirmed) { return; } foreach ($this->selected as $font) { $this->line(" <fg=blue>❯</> Adding <fg=blue>{$font['name']}</> to the project..."); $this->download($font); } foreach ($this->downloaded as $name => $fonts) { $this->line(" <fg=blue>❯</> Adding <fg=blue>{$name}</> to the fonts stylesheet..."); $this->addFamily($name, $fonts); } $names = collect($this->selected)->map(fn ($font) => $this->faces || $this->downloaded ? "<fg=blue>{$font['name']}</>" : "<fg=red>{$font['name']}</>"); $names = $names->count() > 1 ? $names->splice(0, -1)->implode(', ').' and '.$names->last() : $names->first(); if (! $this->faces && ! $this->downloaded) { $this->components->error("Failed to add {$names} to the project."); $this->output->write("\033[1A"); return; } $names = Str::contains($names, 'and') ? "{$names} have" : "{$names} has"; $this->components->info("🎉 {$names} been successfully added to the project."); $this->output->write("\033[1A"); } /** * Add the font family to the stylesheet. * * @return void */ protected function addFamily(string $name, array $fonts) { if (! File::exists($stylesheet = $this->stylesheet())) { File::put($stylesheet, ''); } foreach ($fonts as $font) { $type = Str::of($font)->afterLast('-')->beforeLast('.')->__toString(); $weight = preg_replace('/[^0-9]/', '', $type) ?: 400; $style = Str::after($type, $weight); if (! $style || $style === 'regular') { $style = 'normal'; } $face = view('laravel-webfonts::font-face', [ 'name' => $name, 'weight' => $weight, 'style' => $style, 'path' => "../fonts/{$font}", ])->render(); if (Str::contains(File::get($stylesheet), $face)) { if ($style) { $style = Str::headline($style); } $type = $weight && $style ? "{$weight} {$style}" : ($weight ?: $style); $this->components->warn("<fg=yellow>{$name}</> <fg=gray>({$type})</> already exists in the stylesheet."); continue; } $this->faces[] = $face; } if (! $this->faces) { return; } File::prepend($stylesheet, implode(PHP_EOL, $this->faces).PHP_EOL); } /** * Download the font to the project. * * @return void */ protected function download(array $font) { $response = Http::withQueryParameters([ 'download' => 'zip', 'formats' => 'woff2', 'variants' => implode(',', $font['variants']), 'subsets' => implode(',', $font['subsets']), ])->get("{$this->api}/{$font['id']}"); if ($response->failed()) { $this->components->error("Failed to download <fg=red>{$font['name']}</> to the project."); return; } File::ensureDirectoryExists($tempPath = storage_path('app/.fonts')); File::put( $tempFile = "{$tempPath}/{$font['id']}.zip", $response->body() ); $zip = new ZipArchive; $archive = $zip->open($tempFile); if ($archive !== true) { $this->components->error("Failed to unzip <fg=red>{$font['name']}</>."); return; } $zip->extractTo($tempPath = "{$tempPath}/{$font['id']}"); $zip->close(); $fileList = File::allFiles($tempPath); File::ensureDirectoryExists($path = resource_path('fonts')); $existing = collect(File::allFiles($path)) ->map(fn ($file) => $file->getFilename()) ->all(); foreach ($fileList as $file) { if (! $this->option('force') && in_array($file->getFilename(), $existing)) { $confirmed = confirm("The font {$file->getFilename()} already exists. Do you wish to overwrite it?"); if (! $confirmed) { continue; } } $this->downloaded[$font['name']][] = $file->getFilename(); File::move($file->getPathname(), "{$path}/{$file->getFilename()}"); } File::deleteDirectory($tempPath); } /** * Retrieve the fonts. * * @return \Illuminate\Support\Collection */ protected function fonts() { return cache()->remember($this->cache, $this->expiry, function () { $fonts = Http::get($this->api); if ($fonts->failed()) { return collect(); } $fonts = json_decode($fonts->body()); return collect($fonts)->mapWithKeys(function ($font) { $font->variants = collect($font->variants) ->flip() ->forget($font->defVariant) ->flip() ->prepend($font->defVariant) ->mapWithKeys(fn ($variant) => [$variant => preg_replace('/([0-9])([a-zA-Z])/', '$1 $2', Str::headline($variant))]) ->all(); $font->subsets = collect($font->subsets) ->flip() ->forget($font->defSubset) ->flip() ->prepend($font->defSubset) ->mapWithKeys(fn ($subset) => [$subset => Str::headline($subset)]) ->all(); return [$font->id => $font]; }); }); } /** * Retrieve the fonts stylesheet path. * * @return string */ protected function stylesheet() { if ($this->stylesheet) { return $this->stylesheet; } $path = resource_path($this->option('path')); $filename = $this->option('stylesheet'); if (! File::isDirectory($path)) { $path = resource_path('styles'); if (! File::isDirectory($path)) { throw new Exception('Unable to locate the styles directory.'); } } $extension = $this->option('extension') ?? collect(File::allFiles($path)) ->map(fn ($file) => $file->getExtension()) ->filter(fn ($extension) => in_array($extension, ['css', 'less', 'sass', 'scss', 'styl'])) ->first(); if (! Str::contains($filename, '.')) { $filename = "{$filename}.{$extension}"; } return $this->stylesheet = "{$path}/{$filename}"; } }
php
MIT
41bea5529ff2fe0c7969e3b9fed2ee55b95c8b60
2026-01-05T04:52:00.873412Z
false
Log1x/laravel-webfonts
https://github.com/Log1x/laravel-webfonts/blob/41bea5529ff2fe0c7969e3b9fed2ee55b95c8b60/resources/views/font-face.blade.php
resources/views/font-face.blade.php
@props(['name', 'weight', 'style', 'path']) @font-face { font-display: swap; font-family: '{{ $name }}'; font-style: {{ $style }}; font-weight: {{ $weight }}; src: url('{{ $path }}') format('woff2'); }
php
MIT
41bea5529ff2fe0c7969e3b9fed2ee55b95c8b60
2026-01-05T04:52:00.873412Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/jump.php
jump.php
<?php /* * @Author: yihua * @Date: 2025-01-04 12:25:10 * @LastEditTime: 2025-01-07 11:08:13 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\jump.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ if(!defined('IN_CRONLITE'))exit(); $is_defend = true; @header('Content-Type: text/html; charset=UTF-8'); include(__DIR__ . "/includes/common.php"); ?> <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <title><?php echo $subconf['hostname']; ?></title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> <style> :root { --primary-color: #4A90E2; --secondary-color: #F5A623; --gradient-start: #4A90E2; --gradient-end: #67B26F; } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%); min-height: 100vh; display: flex; flex-direction: column; color: #fff; } .main-container { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; text-align: center; max-width: 800px; margin: 0 auto; } .title { color: #fff; font-size: 2rem; margin-bottom: 1.5rem; font-weight: 600; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2); } .loading-container { background: rgba(255, 255, 255, 0.95); padding: 2rem; border-radius: 1.5rem; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); backdrop-filter: blur(10px); margin: 1.5rem 0; width: 90%; max-width: 500px; transform: translateY(0); transition: transform 0.3s ease; } .loading-container:hover { transform: translateY(-5px); } .progress-bar { height: 6px; background: rgba(74, 144, 226, 0.1); border-radius: 3px; overflow: hidden; position: relative; } .progress-bar::after { content: ''; position: absolute; top: 0; left: 0; height: 100%; width: 30%; background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end)); animation: progress 2s ease-in-out infinite; } @keyframes progress { 0% { left: -30%; } 100% { left: 100%; } } .message { margin-top: 1.5rem; color: #2c3e50; font-size: 1.1rem; line-height: 1.6; text-align: center; } .browsers-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: 1.5rem; width: 100%; max-width: 500px; padding: 1rem; } .browser-item { background: rgba(255, 255, 255, 0.95); padding: 1rem; border-radius: 1rem; display: flex; flex-direction: column; align-items: center; text-decoration: none; color: #2c3e50; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); } .browser-item:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); } .browser-item img { width: 45px; height: 45px; margin-bottom: 0.5rem; border-radius: 12px; transition: transform 0.3s ease; } .browser-item:hover img { transform: scale(1.1); } .browser-item span { font-size: 0.9rem; text-align: center; font-weight: 500; } .hint { margin-top: 1.5rem; color: rgba(255, 255, 255, 0.9); font-size: 0.95rem; background: rgba(0, 0, 0, 0.2); padding: 0.8rem 1.5rem; border-radius: 2rem; backdrop-filter: blur(5px); } @media (max-width: 768px) { .main-container { padding: 1rem; } .title { font-size: 1.5rem; margin-bottom: 1rem; } .browsers-grid { gap: 0.8rem; padding: 0.5rem; } .browser-item { padding: 0.8rem; } .browser-item img { width: 40px; height: 40px; } } /* 添加动画效果 */ @keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } .main-container > * { animation: fadeIn 0.5s ease-out forwards; } .main-container > *:nth-child(2) { animation-delay: 0.1s; } .main-container > *:nth-child(3) { animation-delay: 0.2s; } .main-container > *:nth-child(4) { animation-delay: 0.3s; } </style> </head> <body> <div class="main-container"> <h1 class="title"><?php echo $subconf['hostname']; ?></h1> <div class="loading-container"> <div class="progress-bar"></div> <div class="message" style="white-space: nowrap;"> <p>当前可能无法提供最佳浏览体验</p> <p>请复制以下网址继续访问:</p> <p style="color: #4A90E2; background: rgba(255, 255, 255, 0.8); padding: 0.5rem; border-radius: 0.5rem; user-select: all; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);"> <?=$site_url; ?> </p> <p>请选择以下任意浏览器继续访问</p> </div> </div> <div class="browsers-grid"> <a href="mqq://forward/url?url=<?=urlencode($site_url); ?>" class="browser-item"> <img src="/assets/img/mtt.png" alt="QQ浏览器"> <span>QQ浏览器</span> </a> <a href="<?=$site_url; ?>" class="browser-item"> <img src="/assets/img/browser.png" alt="系统浏览器"> <span>系统浏览器</span> </a> <a href="googlechrome://navigate?url=<?=urlencode($site_url); ?>" class="browser-item"> <img src="/assets/img/chrome.png" alt="Chrome"> <span>Chrome</span> </a> <a href="ucbrowser://<?=urlencode($site_url); ?>" class="browser-item"> <img src="/assets/img/UCMobile.png" alt="UC浏览器"> <span>UC浏览器</span> </a> <a href="alipays://platformapi/startapp?appId=20000067&url=<?=urlencode($site_url); ?>" class="browser-item"> <img src="/assets/img/ali.jpg" alt="支付宝"> <span>支付宝</span> </a> <a id="taobao" href="taobao://shop.m.taobao.com/shop/shop_index.htm?url=<?=urlencode($site_url); ?>" class="browser-item"> <img src="/assets/img/taobao.png" alt="淘宝"> <span>淘宝</span> </a> </div> <p class="hint">👆 点击图标即可在对应的浏览器中打开</p> </div> <script> document.addEventListener('DOMContentLoaded', function() { document.body.addEventListener('touchmove', function(evt) { if (!evt._isScroller) { evt.preventDefault(); } }); // 添加渐入动画 const elements = document.querySelectorAll('.main-container > *'); elements.forEach((el, index) => { el.style.opacity = '0'; setTimeout(() => { el.style.opacity = '1'; }, index * 100); }); // // 自动点击淘宝浏览器 // setTimeout(() => { // document.getElementById('taobao').children[0].click(); // }, 1000); // 处理应用跳转 function openApp(url, fallback) { var timeout = setTimeout(function() { window.location.href = fallback; }, 2000); window.location.href = url; window.addEventListener('blur', function() { clearTimeout(timeout); }); } // 为所有跳转链接添加事件处理 document.querySelectorAll('.browser-item').forEach(function(item) { item.addEventListener('click', function(e) { e.preventDefault(); var url = this.getAttribute('href'); openApp(url, '<?=$site_url?>'); }); }); }); </script> </body> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/config.php
config.php
<?php /*数据库配置*/ $dbconfig = array( 'host' => 'localhost', //数据库服务器 'port' => 3306, //数据库端口 'user' => '', //数据库用户名 'pwd' => '', //数据库密码 'dbname' => '', //数据库名 );
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/index.php
index.php
<?php /* * @Author: yihua * @Date: 2025-01-04 12:25:10 * @LastEditTime: 2025-01-05 17:52:29 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\index.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ $is_defend = true; @header('Content-Type: text/html; charset=UTF-8'); include("./includes/common.php"); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title><?php echo $subconf['hostname']; ?></title> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> <link rel="stylesheet" href="./assets/layui/css/layui.css" /> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> <link rel="stylesheet" type="text/css" href="./assets/Message/css/message.css" /> <link rel="stylesheet" type="text/css" href="./assets/layui/css/theme.css" /> <link rel="stylesheet" type="text/css" href="./assets/css/style_PC.css" media="screen and (min-width: 960px)" /> <!-- <link rel="stylesheet" type="text/css" href="./assets/css/style_Phone.css" media="screen and (min-width: 720px)" /> --> <style type="text/css"> /* 全局样式 */ body { background: #f5f7fa; color: #333; } .layui-container { padding: 20px; max-width: 1000px; margin: 0 auto; animation: fadeInUp 0.8s ease-out; } /* Logo区域样式优化 */ .layui-logo { padding: 30px 0; text-align: center; } .wz-title h1 { font-size: 2em; color: #333; margin-bottom: 20px; font-weight: 600; animation: fadeInUp 0.8s ease-out; } .img img { border-radius: 15px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); max-width: 300px; width: 100%; transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); } .img img:hover { transform: scale(1.05); } /* 按钮样式优化 */ .cer { margin-top: 25px; text-align: center; display: flex; justify-content: center; gap: 15px; } .cer .layui-btn { padding: 0 25px; height: 40px; line-height: 40px; border-radius: 20px; font-size: 14px; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); } .cer .buwz { display: flex; } .cer .layui-btn:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); } /* 主面板样式 */ .main { background: #fff; border-radius: 10px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); padding: 20px; margin-top: 20px; } /* 选项卡样式 */ .layui-tab-title { border-bottom: 2px solid #f0f0f0; } .layui-tab-title li { padding: 0 25px; font-size: 15px; position: relative; overflow: hidden; } .layui-tab-title .layui-this { color: #009688; } .layui-tab-title .layui-this:after { height: 2px; background-color: #009688; } .layui-tab-title li:after { content: ''; position: absolute; bottom: 0; left: 50%; width: 0; height: 2px; background-color: #009688; transition: all 0.3s ease; } .layui-tab-title li:hover:after { left: 0; width: 100%; } /* 输入框样式 */ .inputs { height: 45px; margin: 15px 0; border-radius: 5px; border: 1px solid #e6e6e6; transition: all 0.3s ease; } .inputs:focus { border-color: #009688; box-shadow: 0 0 5px rgba(0, 150, 136, 0.2); transform: translateY(-2px); } /* 提交按钮样式 */ .submit { margin-top: 25px; text-align: center; } .submit .layui-btn { width: 200px; height: 45px; line-height: 45px; font-size: 15px; border-radius: 25px; background: #009688; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; overflow: hidden; } .submit .layui-btn:hover { opacity: 0.9; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0, 150, 136, 0.2); } .submit .layui-btn:after { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; background: rgba(255,255,255,0.2); border-radius: 50%; transform: translate(-50%, -50%); transition: width 0.6s ease-out, height 0.6s ease-out; } .submit .layui-btn:active:after { width: 300px; height: 300px; opacity: 0; } /* 查询结果样式优化 */ .time { width: 80%; margin: 20px auto; } .time div { box-sizing: border-box; padding: 15px; background-color: #f8f8f8; border: 1px solid #e6e6e6; border-radius: 8px; transition: all 0.3s ease; animation: fadeInUp 0.5s ease-out; } .time div:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); } .time div b { color: #009688; font-weight: 500; } /* 添加移动端选项卡样式优化 */ @media screen and (max-width: 480px) { .layui-tab-title li { padding: 0 12px; /* 减小内边距 */ font-size: 14px; /* 稍微减小字体 */ } /* 简化选项卡文字 */ .layui-tab-title li[data-mobile-text]:not(.layui-this) { font-size: 13px; } } @media screen and (max-width: 360px) { .layui-tab-title li { padding: 0 8px; /* 更小的内边距 */ font-size: 13px; /* 更小的字体 */ } } /* 添加移动端适配 */ @media screen and (max-width: 480px) { .time { padding: 0; } .time div { font-size: 13px; /* 移动端稍微减小字体 */ padding: 12px; /* 减小内边距 */ /* width: calc(100% - 20px); margin-left: 10px; */ } } /* 添加页面加载动画 */ @keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } /* 选项卡切换动画 */ .layui-tab-content .layui-tab-item { transition: opacity 0.3s ease-in-out; } </style> </head> <body> <div class="layui-container"> <!-- logo部分 --> <div class="layui-logo"> <div class="layui-row"> <div class="layui-card layui-col-xs12"> <div class="wz-title"> <h1><?php echo $subconf['hostname']; ?></h1> </div> <div class="img"> <!-- <img src="<?php echo $subconf['img']; ?>" alt="logo"> --> <img src="/assets/img/one-by-one.gif" lay-src="<?php echo $subconf['img']; ?>" alt="logo"> </div> <div class="layui-col-xs-12 cer"> <a class="buwz" style="color:white" onclick="<?php echo $subconf['ggswitch'] == 1 ? "showgg()" : "notgg()"; ?>"> <div class="layui layui-btn layui-btn-danger">公告</div> </a> <a class="buwz" style="color:white" href="<?php echo $subconf['kf']; ?>"> <div class="layui layui-btn layui-btn-normal">客服</div> </a> <a class="buwz" style="color:white" href="<?php echo $subconf['pan']; ?>"> <div class="layui layui-btn layui-btn-checked">网盘</div> </a> </div> </div> </div> </div> <!-- 面板部分 --> <div class="main"> <div style="margin: 0;" class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> <ul class="layui-tab-title"> <li class="layui-this" data-mobile-text="充值">卡密充值</li> <li data-mobile-text="注册">用户注册</li> <li data-mobile-text="查询">用户查询</li> </ul> <div class="layui-tab-content" style="height: auto;"> <div class="layui-tab-item layui-show"> <div class="layui-input-block"> <input type="text" name="km" id="pay-user" class="layui-input inputs" placeholder="请输入充值账号" lay-verify="required" /> </div> <div class="layui-input-block"> <input type="text" name="code" id="pay-code" class="layui-input inputs" placeholder="请输入充值卡密" lay-verify="required" /> </div> <div class="layui-input-block layui-btn-xs submit"> <button id="pay" type="button" class="layui-btn layui-btn-normal">充值</button> </div> </div> <!-- <div class="layui-tab-item"> <div class="layui-input-block"> <input type="text" name="code" id="post-code" class="layui-input inputs" placeholder="请输入兑换卡密" lay-verify="required" /> </div> <div class="layui-input-block layui-btn-xs submit"> <button id="postpay" type="button" class="layui-btn layui-btn-normal">兑换</button> </div> </div> --> <div class="layui-tab-item"> <div class="layui-input-block"> <input type="text" name="km" id="reg-user" class="layui-input inputs" placeholder="请输入账号" lay-verify="required" /> </div> <div class="layui-input-block"> <input type="text" name="km" id="reg-pwd" class="layui-input inputs" placeholder="请输入密码" lay-verify="required" /> </div> <div class="layui-input-block"> <input type="text" name="km" id="reg-code" class="layui-input inputs" placeholder="请输入卡密" lay-verify="required" /> </div> <div class="layui-input-block layui-btn-xs submit"> <button id="registed" type="button" class="layui-btn layui-btn-normal">注册</button> </div> </div> <div class="layui-tab-item"> <div class="layui-input-block"> <div class="layui-form form"> <div class="layui-form-item"> <div class="layui-input-block"> <select id="sel" name="app" lay-filter="app" lay-verify="required"> <option value=""></option> <!-- <option value="0">一花端口(公端)</option> --> </select> </div> </div> </div> </div> <div class="layui-input-block"> <input type="text" name="km" id="check-user" class="layui-input inputs" placeholder="请输入查询账号" lay-verify="required" /> </div> <div class="time"> </div> <div class="layui-input-block layui-btn-xs submit"> <button id="check" type="button" class="layui-btn layui-btn-normal">查询</button> </div> </div> </div> </div> </div> <!-- foot底部 --> <div class="layui-footer"> </div> </div> <script src="./assets/Message/js/message.min.js" type="text/javascript" charset="utf-8"></script> <script src="./assets/layui/layui.js"></script> <script src="./assets//js/jquery-3.5.1.min.js"></script> <script src="./assets/js/jquery.cookie.min.js"></script> <script src="./assets/js/sweetalert.min.js"></script> <script type="text/javascript"> // 统一的 API 处理工具 const API = { async request(url, data, options = {}) { const defaultOptions = { type: "POST", dataType: "json", timeout: 30000, beforeSend: () => { layer.msg("处理中...", { icon: 16, shade: 0.05, time: false }); } }; try { const response = await $.ajax({ url, data, ...defaultOptions, ...options }); layer.closeAll(); return response; } catch (error) { layer.closeAll(); throw error; } } }; // 表单验证工具 const Validator = { username(value) { if (!value) return "账号不能为空"; if (value.length < 5) return "账号长度不得小于5位"; if (!/^[A-Za-z0-9]+$/.test(value)) return "账号只能包含数字和英文"; return null; }, password(value) { if (!value) return "密码不能为空"; if (value.length < 5) return "密码长度不得小于5位"; if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z_]{5,16}$/.test(value)) { return "密码必须包含数字和字母,长度在5-16位之间"; } return null; }, code(value, minLength = 1) { if (!value) return "卡密不能为空"; if (value.length < minLength) return `卡密长度不得小于${minLength}位`; if (value.length > 128) return "卡密长度最大为128位"; return null; } }; // 消息提示工具 const Message = { success(msg) { layer.msg(msg, { icon: 1 }); Qmsg.success(msg, { html: true }); }, error(msg) { layer.msg(msg, { icon: 5 }); Qmsg.error(msg, { html: true }); }, info(msg) { Qmsg.info(msg); } }; layui.use(["jquery", "form", "element", "flow"], function() { const { $, form, element, flow } = layui; let selectHeight = 0; // 初始化 initializeApp(); // 事件绑定 bindEvents(); // 初始化应用 function initializeApp() { loadApplications(); flow.lazyimg(); checkScreenSize(); // 初始化公告 initializeAnnouncement(); } // 加载应用列表 async function loadApplications() { try { const response = await API.request("api/api.php?act=gethostapp"); if (response.code === "1") { updateApplicationSelect(response.msg); } } catch (error) { Message.error("获取应用列表失败"); } } // 更新应用选择器 function updateApplicationSelect(applications) { const $select = $("[name=app]"); const options = applications.map(app => `<option value="${app.appcode}">${app.appname}</option>` ).join(''); $select.append(options); form.render("select"); handleSelectHeight(); } // 处理选择器高度 function handleSelectHeight() { $(".layui-form-select").on("click", function() { const $layuiShow = $(".layui-show"); const $upbit = $(".layui-anim-upbit"); selectHeight = $layuiShow.outerHeight(true); if ($upbit.outerHeight(true) > $layuiShow.outerHeight(true)) { $layuiShow.css("height", $upbit.outerHeight(true) + 40); } }); } // 绑定事件处理 function bindEvents() { // 充值按钮点击事件 $("#pay").on("click", handlePay); // 注册按钮点击事件 $("#registed").on("click", handleRegister); // 查询按钮点击事件 $("#check").on("click", handleQuery); } // 充值处理 async function handlePay() { const user = $("#pay-user").val(); const code = $("#pay-code").val(); const userError = Validator.username(user); if (userError) return Message.info(userError); const codeError = Validator.code(code); if (codeError) return Message.info(codeError); try { const response = await API.request("api/cpproxy.php?type=update", { user, code }); if (response.code === 1) { Message.success("充值成功"); } else { Message.error(response.msg || "充值失败"); } } catch (error) { Message.error("充值失败"); } } // 注册处理 async function handleRegister() { const user = $("#reg-user").val().trim(); const pwd = $("#reg-pwd").val().trim(); const code = $("#reg-code").val().trim(); // 验证输入 const userError = Validator.username(user); if (userError) return Message.info(userError); const pwdError = Validator.password(pwd); if (pwdError) return Message.info(pwdError); const codeError = Validator.code(code, 15); if (codeError) return Message.info(codeError); try { $("#registed").prop("disabled", true); const response = await API.request("api/cpproxy.php?type=insert", { user, pwd, code }); if (response.code === 1) { Message.success(response.msg); } else { Message.error(response.msg); } } catch (error) { Message.error("注册失败"); } finally { $("#registed").prop("disabled", false); } } // 查询处理 async function handleQuery() { const user = $("#check-user").val(); const appcode = $("#sel option:checked").val(); if (!appcode) return Message.info("请选择一个应用"); const userError = Validator.username(user); if (userError) return Message.info(userError); try { const response = await API.request("api/cpproxy.php?type=query", { user, appcode }); if (response.code === 1) { updateQueryResult(response.msg); Message.success("查询成功"); } else { Message.error(response.msg || "查询失败"); } } catch (error) { $(".time").eq(0).html(""); Message.error("查询失败"); } } // 更新查询结果 function updateQueryResult(msg) { $(".time").eq(0).html(` <div style='padding: 10px; border: 1px solid #c3e6cb; color: #155724; font-size: 12px; line-height: 2em; background-color: #e8f8f5; margin-bottom: 10px;'> <b>${msg}</b> </div> `); } // 检查屏幕尺寸 function checkScreenSize() { if (window.innerWidth <= 480) { $('.layui-tab-title li').each(function() { const $this = $(this); const mobileText = $this.data('mobile-text'); if (mobileText) { $this.text(mobileText); } }); } else { // 恢复原始文本 $('.layui-tab-title li').each(function() { const $this = $(this); const originalText = $this.hasClass('layui-this') ? '卡密充值' : ($this.index() === 1 ? '用户注册' : '用户查询'); $this.text(originalText); }); } } // 添加窗口大小改变监听 $(window).on('resize', checkScreenSize); // 初始化公告 function initializeAnnouncement() { const isModal = <?php echo empty($conf['wzgg']) ? 'false' : 'true'; ?>; if (!$.cookie('op') && isModal) { showAnnouncement(); setAnnouncementCookie(); } } // 显示公告 window.showgg = function() { showAnnouncement(); setAnnouncementCookie(); }; // 显示无公告提示 window.notgg = function() { swal({ title: "公告", icon: "info", button: "好的", text: "没有公告" }); }; function showAnnouncement() { const content = document.createElement("div"); content.innerHTML = '<?php echo $conf['wzgg']; ?>'; swal({ title: "公告", icon: "success", button: "好的", content: content }); } function setAnnouncementCookie() { const cookieTime = new Date(); cookieTime.setTime(cookieTime.getTime() + (10 * 60 * 1000)); $.cookie('op', false, { expires: cookieTime }); } }); </script> </body> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/includes/ValidateCode.class.php
includes/ValidateCode.class.php
<?php /* * @Author: yihua * @Date: 2022-06-25 21:02:04 * @LastEditTime: 2022-07-11 14:51:25 * @LastEditors: yihua * @Description: * @FilePath: \ccpy\includes\ValidateCode.class.php * 一花一叶 一行代码 * Copyright (c) 2022 by yihua 487735913@qq.com, All Rights Reserved. */ class ValidateCode { private $charset = 'abcdefghkmnprstuvwxyzABCDEFGHKMNPRSTUVWXYZ23456789';//随机因子 private $code;//验证码 private $codelen = 4;//验证码长度 private $width = 130;//宽度 private $height = 50;//高度 private $img;//图形资源句柄 private $font;//指定的字体 private $fontsize = 20;//指定字体大小 private $fontcolor;//指定字体颜色 //构造方法初始化 public function __construct() { $this->font = ROOT_PATH.'/../assets/font/elephant.ttf'; } //生成随机码 private function createCode() { $_len = strlen($this->charset)-1; for ($i=0;$i<$this->codelen;$i++) { $this->code .= $this->charset[mt_rand(0,$_len)]; } } //生成背景 private function createBg() { $this->img = imagecreatetruecolor($this->width, $this->height); $color = imagecolorallocate($this->img, mt_rand(157,255), mt_rand(157,255), mt_rand(157,255)); imagefilledrectangle($this->img,0,$this->height,$this->width,0,$color); } //生成文字 private function createFont() { $_x = $this->width / $this->codelen; for ($i=0;$i<$this->codelen;$i++) { $this->fontcolor = imagecolorallocate($this->img,mt_rand(0,156),mt_rand(0,156),mt_rand(0,156)); imagettftext($this->img,$this->fontsize,mt_rand(-30,30),$_x*$i+mt_rand(1,5),$this->height / 1.4,$this->fontcolor,$this->font,$this->code[$i]); } } //生成线条、雪花 private function createLine() { //线条 for ($i=0;$i<6;$i++) { $color = imagecolorallocate($this->img,mt_rand(0,156),mt_rand(0,156),mt_rand(0,156)); imageline($this->img,mt_rand(0,$this->width),mt_rand(0,$this->height),mt_rand(0,$this->width),mt_rand(0,$this->height),$color); } //雪花 for ($i=0;$i<100;$i++) { $color = imagecolorallocate($this->img,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255)); imagestring($this->img,mt_rand(1,5),mt_rand(0,$this->width),mt_rand(0,$this->height),'*',$color); } } //输出 private function outPut() { header('Content-type:image/png'); imagepng($this->img); imagedestroy($this->img); } //对外生成 public function doimg() { $this->createBg(); $this->createCode(); $this->createLine(); $this->createFont(); $this->outPut(); } //获取验证码 public function getCode() { return strtolower($this->code); } } ?>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/includes/function.php
includes/function.php
<?php /** * Undocumented function * * @param [type] $string * @param string $operation * @param string $key * @param integer $expiry * @author 一花 <487735913@qq.com> * @copyright Undocumented function [type] string */ function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) { $ckey_length = 4; $key = md5($key ? $key : ''); //ENCRYPT_KEY $keya = md5(substr($key, 0, 16)); $keyb = md5(substr($key, 16, 16)); $keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length) : substr(md5(microtime()), -$ckey_length)) : ''; $cryptkey = $keya . md5($keya . $keyc); $key_length = strlen($cryptkey); $string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0) . substr(md5($string . $keyb), 0, 16) . $string; $string_length = strlen($string); $result = ''; $box = range(0, 255); $rndkey = array(); for ($i = 0; $i <= 255; $i++) { $rndkey[$i] = ord($cryptkey[$i % $key_length]); } for ($j = $i = 0; $i < 256; $i++) { $j = ($j + $box[$i] + $rndkey[$i]) % 256; $tmp = $box[$i]; $box[$i] = $box[$j]; $box[$j] = $tmp; } for ($a = $j = $i = 0; $i < $string_length; $i++) { $a = ($a + 1) % 256; $j = ($j + $box[$a]) % 256; $tmp = $box[$a]; $box[$a] = $box[$j]; $box[$j] = $tmp; $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256])); } if ($operation == 'DECODE') { if ((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $keyb), 0, 16)) { return substr($result, 26); } else { return ''; } } else { return $keyc . str_replace('=', '', base64_encode($result)); } } function daddslashes($string, $force = 0, $strip = FALSE) { return addslashes($string); } /** * Undocumented function * * @param string $msg * @param boolean $die * @author 一花 <487735913@qq.com> * @copyright Undocumented function string boolean */ function sysmsg($msg = '未知的异常', $die = true) { ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>站点提示信息</title> <style type="text/css"> html { background: #eee; text-align: center; } body { background: #fff; color: #333; font-family: "微软雅黑", "Microsoft YaHei", sans-serif; margin: 2em auto; padding: 1em 2em; max-width: 700px; -webkit-box-shadow: 10px 10px 10px rgba(0, 0, 0, .13); box-shadow: 10px 10px 10px rgba(0, 0, 0, .13); opacity: .8 } h1 { border-bottom: 1px solid #dadada; clear: both; color: #666; font: 24px "微软雅黑", "Microsoft YaHei", , sans-serif; margin: 30px 0 0 0; padding: 0; padding-bottom: 7px } #error-page { margin-top: 50px } h3 { text-align: center } #error-page p { font-size: 9px; line-height: 1.5; margin: 25px 0 20px } #error-page code { font-family: Consolas, Monaco, monospace } ul li { margin-bottom: 10px; font-size: 9px } a { color: #21759B; text-decoration: none; margin-top: -10px } a:hover { color: #D54E21 } .button { background: #f7f7f7; border: 1px solid #ccc; color: #555; display: inline-block; text-decoration: none; font-size: 9px; line-height: 26px; height: 28px; margin: 0; padding: 0 10px 1px; cursor: pointer; -webkit-border-radius: 3px; -webkit-appearance: none; border-radius: 3px; white-space: nowrap; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; -webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(0, 0, 0, .08); box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(0, 0, 0, .08); vertical-align: top } .button.button-large { height: 29px; line-height: 28px; padding: 0 12px } .button:focus, .button:hover { background: #fafafa; border-color: #999; color: #222 } .button:focus { -webkit-box-shadow: 1px 1px 1px rgba(0, 0, 0, .2); box-shadow: 1px 1px 1px rgba(0, 0, 0, .2) } .button:active { background: #eee; border-color: #999; color: #333; -webkit-box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, .5); box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, .5) } table { table-layout: auto; border: 1px solid #333; empty-cells: show; border-collapse: collapse } th { padding: 4px; border: 1px solid #333; overflow: hidden; color: #333; background: #eee } td { padding: 4px; border: 1px solid #333; overflow: hidden; color: #333 } </style> </head> <body id="error-page"> <?php echo '<h3>站点提示信息</h3>'; echo $msg; ?> </body> </html> <?php if ($die == true) { exit; } } /** * Undocumented function * * @param [type] $length * @param [type] $qianzhui * @param integer $numeric * @author 一花 <487735913@qq.com> * @copyright Undocumented function [type] [type] */ function random($length, $qianzhui = null, $numeric = 0) { $seed = base_convert(md5(microtime() . $_SERVER['DOCUMENT_ROOT']), 16, $numeric ? 10 : 35); $seed = $numeric ? (str_replace('0', '', $seed) . '012340567890') : ($seed . 'zZ' . strtoupper($seed)); $hash = ''; $max = strlen($seed) - 1; for ($i = 0; $i < $length; $i++) { $hash .= $seed[mt_rand(0, $max)]; } return $qianzhui != null ? $qianzhui . $hash : $hash; } function queryuserall($adminpassword, $adminport, $proxyaddress) { $url = "http://" . $proxyaddress . ":" . $adminport . "/account"; parse_url($url); //print_r();// 解析 URL,返回其组成部分 $data = array(); $query_str = http_build_query($data); // http_build_query()函数的作用是使用给出的关联(或下标)数组生成一个经过 URL-encode 的请求字符串 $info = parse_url($url); $fp = fsockopen($proxyaddress, $adminport, $errno, $errstr, 3); if (!$fp) { // echo "$errstr ($errno)<br>\n"; return false; } else { $auth = "Authorization: Basic " . base64_encode("admin:" . $adminpassword); $head = "GET " . $info['path'] . $query_str . " HTTP/1.0\r\n"; $head .= "Host: " . $info['host'] . "\r\n" . $auth . "\r\n" . "\r\n"; $write = fputs($fp, $head); $line = ""; while (!feof($fp)) { $line .= fread($fp, 4096); // echo str_replace(array("<",">","/"),array("&lt;","&gt;",""), $line); } fclose($fp); } //echo $line; //取出div标籤且id为PostContent的内容,并储存至阵列match preg_match_all('/<input .* name="username" .* value="(.*?)"/ui', $line, $match); preg_match_all('/<input .* name="password" .* value="(.*?)"/ui', $line, $match2); preg_match_all('/<input .* name="enable" .*/', $line, $match3); preg_match_all('/<input .* name="usepassword" .*/', $line, $match4); preg_match_all('/<input .* name="disabledate" .* value="(.*?)"/ui', $line, $match5); preg_match_all('/<input .* name="disabletime" .* value="(.*?)"/ui', $line, $match6); preg_match_all('/<input .* name="autodisable" .*/', $line, $match7); preg_match_all('/<input .* name="connection" .* value="(.*?)"/ui', $line, $match8); preg_match_all('/<input .* name="bandwidth" .* value="(.*?)"/ui', $line, $match9); $ccp = array(); $time = date("Y-m-d H:i:s"); foreach ($match[1] as $key => $use) { // print(str_replace(array("<",">","/"),array(""),$match3[0][$key])); //=='input type="checkbox" name="enable" value="1" checked'?$match3[0][$key]=0:$match3[0][$key]=1 strripos(str_replace(array("<", ">", "/"), array(""), $match3[0][$key]), "checked") != "46" ? $match3[0][$key] = 0 : $match3[0][$key] = 1; //str_replace(array("<",">","/"),array(""),$match3[0][$key])=='input type="checkbox" name="enable" value="1" checked'?$match3[0][$key]=0:$match3[0][$key]=1; strripos(str_replace(array("<", ">", "/"), array(""), $match4[0][$key]), "checked") != "51" ? $match4[0][$key] = 0 : $match4[0][$key] = 1; strripos(str_replace(array("<", ">", "/"), array(""), $match7[0][$key]), "checked") != "51" ? $match7[0][$key] = 0 : $match7[0][$key] = 1; if ($match[1][$key] == "") { continue; } $ccp[$key] = array( "id" => $key, "user" => $match[1][$key], "pwd" => $match2[1][$key], "state" => $match3[0][$key], "pwdstate" => $match4[0][$key], "disabletime" => $match5[1][$key] . " " . $match6[1][$key], "expire" => strtotime($time) > strtotime($match5[1][$key] . " " . $match6[1][$key]) ? 1 : 0, "connection"=>$match8[1][$key], "bandwidthup"=>explode("/",$match9[1][$key])[0], "bandwidthdown"=>explode("/",$match9[1][$key])[1], "autodisable"=>$match7[0][$key] ); } return $ccp; } function userquery($column, $ccp) { // ="admin"; $result = array_filter($ccp, function ($where) use ($column) { return $where['user'] == $column; }); // print_r($result);//打印全部数组 // $col=array_column($result,'disabletime');//expire // $col2=array_column($result,'expire'); // return $col2[0]==1?'<h5 style="color: red;display: inline;">到期时间:'.$col[0].'</h5>':($col[0]!=""?'<h5 style="color: #1E9FFF;display: inline;">到期时间:'.$col[0].'</h5>':'<h5 style="color: red;display: inline;">账号不存在</h5>'); return $result; } function WriteLog($operation, $msg, $operationer, $DB) { $arr = array( 'operation' => str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $operation), 'msg' => str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $msg), 'operationer' => str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $operationer), 'ip' => str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), x_real_ip()) ); $exec = $DB->insertV2('log', $arr); } /** * @description: * @param {*} $adminpassword * @param {*} $adminport * @param {*} $proxyaddress * @param {*} $user * @param {*} $password * @param {*} $day * @param {*} $userenabled 禁用账号 默认不禁用 * @return {*} * @use: */ function UserUpdate($adminpassword, $adminport, $proxyaddress, $user, $password, $day,$connection2,$bandwidthup,$bandwidthdown, $userenable="0",$newuser="") { if (!CheckStrChinese($user)) { return ["code" => "-1", "msg"=>"用户名不合法,大概率是与服务器冲突了", "icon" => "5"]; } if (strlen($user)<5) { return ["code" => "-1", "msg"=>"用户名长度不合法", "icon" => "5"]; } if(!CheckStrPwd($password)){ return ["code" => "-1", "msg"=>"密码不合法", "icon" => "5"]; } $ser = queryuserall($adminpassword, $adminport, $proxyaddress); $date = userquery($user, $ser); //print_r($date); if (is_null($date)&&(empty($date))) { return ["code" => "-1", "msg"=>"用户名不存在", "icon" => "5"]; } else { $username = $user; $connection = $connection2; $bandwidth = $bandwidthup.'/'.$bandwidthdown; $cdate = date("Y-m-d H:i:s"); // $enddate = $date['expire'] == 0 ? date('Y-m-d H:i:s', strtotime($date['disabletime'] . $day . " day")) : date('Y-m-d H:i:s', strtotime($cdate . $day . " day")); // $enddate=date('Y-m-d H:i:s',strtotime("$date + ".$day." day")); $end_date=date('Y-m-d H:i:s', strtotime($day)); $end_date = explode(" ", $end_date); $disabledate = $end_date[0]; $disabletime = $end_date[1]; $fp = fsockopen($proxyaddress, $adminport, $errno, $errstr, 3); if (!$fp) { return ["code" => "无法连接到CCProxy", "icon" => "5"]; } else { $url_ = "/account"; $url = "edit=1" . "&"; $url = $url . "autodisable=1" . "&"; $url = $url . "usepassword=1" . "&"; $url = $url . "enablesocks=1" . "&"; $url = $url . "enablewww=0" . "&"; $url = $url . "enabletelnet=0" . "&"; $url = $url . "enabledial=0" . "&"; $url = $url . "enableftp=0" . "&"; $url = $url . "enableothers=0" . "&"; $url = $url . "enablemail=0" . "&"; $url = $url . "username=" . (empty($newuser)?$username:$newuser) . "&"; $url = $password == "" ? "" : $url . "password=" . $password . "&"; $url = $url . "connection=" . $connection . "&"; $url = $url . "bandwidth=" . $bandwidth . "&"; $url = $url . "disabledate=" . $disabledate . "&"; $url = $url . "disabletime=" . $disabletime . "&"; $url = $url . "bandwidthquota=4560" . "&"; // $url = $userenable == "" ? "" : $url . "enable=1" . "&"; if($userenable==0){ $url = $url . "enable=1" . "&"; } $url = $url . "userid=" . $username; $len = "Content-Length: " . strlen($url); $auth = "Authorization: Basic " . base64_encode("admin" . ":" . $adminpassword); $msg = "POST " . $url_ . " HTTP/1.1\r\nHost: " . $proxyaddress . "\r\n" . $auth . "\r\n" . $len . "\r\n" . "\r\n" . $url; fputs($fp, $msg); //echo $msg; while (!feof($fp)) { $s = fgets($fp, 4096); //echo $s; } fclose($fp); return ["code" => "1", "msg"=>"编辑成功", "icon" => "1"]; } } } /** * @description: 匹配是否有中文 * @param {*} $str * @return {*} * @use: */ function CheckStrChinese($str) { $isMatched = preg_match_all('/^[A-Za-z0-9]+$/', $str); if ($isMatched&&(!empty($str))) { return true; } return false; } /** * @description: 匹配密码密码可以包含数字、字母、下划线,并且要同时含有数字和字母,且长度要在8-16位之间! * @param {*} $str * @return {*} * @use: */ function CheckStrPwd($str) { $isMatched = preg_match_all('/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z_]{5,16}$/', $str); if ($isMatched&&(!empty($str))) { return true; } return false; } function ForServer($server, $user) { try { $user_arr = array(); foreach ($server as $key => $value) { // Array_push($user_arr,(queryuserall($value["password"],$value["cport"],$value["ip"]))); $alldata = queryuserall($value["password"], $value["cport"], $value["ip"]); for ($j = 0; $j <= count($alldata); $j++) { if (empty($alldata[$j]['user'])) { continue; } $getdata = array( "id" => $alldata[$j]['id'], "user" => $alldata[$j]['user'], "pwd" => $alldata[$j]['pwd'], "state" => $alldata[$j]['state'], "pwdstate" => $alldata[$j]['pwdstate'], "disabletime" => $alldata[$j]['disabletime'], "expire" => $alldata[$j]['expire'], "user" => $alldata[$j]['user'], 'serverip' => $value["ip"], "connection"=>$alldata[$j]['connection'], "bandwidthup"=>$alldata[$j]['bandwidthup'], "bandwidthdown"=>$alldata[$j]['bandwidthdown'], "autodisable"=>$alldata[$j]['autodisable'] ); // var_dump($getdata); array_push($user_arr, $getdata); } } // $count=count($user_arr)-1; // $user_merge=array(); // for ($i=0; $i < $count;$i++) { // if($i>=$count){ // break; // } // // print_r($i."".$count); // $user_merge= array_merge($user_arr[$i],$user_arr[$i+1]); // } // print_r($user_merge); if (!empty($user)) { yield userquery($user, $user_arr); } else { yield $user_arr; } // return yield userquery($user,$user_arr); } catch (Exception $th) { yield null; } } /*** * 搜索全部服务器,也可以根据条件来 */ function SerchearchAllServer($app, $user, $DB) { try { if (!empty($app)) { $ip = $DB->selectV2("select serverip from application where appcode = ?", [$app]); } else { $ip = $DB->selectV2("select serverip from application", []); } $serverarr = array(); foreach ($ip as $valuel) { $server = $DB->selectRowV2("select ip,serveruser,password,cport from server_list where ip = ?", [$valuel['serverip']]); //$ip['serverip']服务器IP Array_push($serverarr, $server); }; yield from ForServer($serverarr, $user); } catch (Exception $th) { //yield null; // throw $th; return ["code" => "-1", "msg"=>"无法连接到CCProxy", "icon" => "5"]; } } /** * 删除用户 */ function IDelUser($username, $admin_password, $adminport, $proxyaddress) { try { if (!empty($username)) { $url = "http://" . $proxyaddress . ":" . $adminport . "/account"; $fp = fsockopen($proxyaddress, $adminport, $errno, $errstr, 3); if (!$fp) { yield ["code" => "无法连接到CCProxy", "icon" => "5"]; } else { $url_ = "/account"; $url = "delete=1" . "&"; $url = $url . "userid=" . $username; $len = "Content-Length: " . strlen($url); $auth = "Authorization: Basic " . base64_encode("admin:" . $admin_password); $msg = "POST " . $url_ . " HTTP/1.0\r\nHost: " . $proxyaddress . "\r\n" . $auth . "\r\n" . $len . "\r\n" . "\r\n" . $url; fputs($fp, $msg); while (!feof($fp)) { $s = fgets($fp, 4096); } fclose($fp); yield true; } } else { yield false; } } catch (Exception $th) { //yield null; //throw $th; return ["code" => "-1", "msg"=>"无法连接到CCProxy", "icon" => "5"]; } } /** * 具体删除,批量 线程 删除 */ function DelUser($user, $serverip, $DB) { try { $server = $DB->selectRowV2("select ip,serveruser,password,cport from server_list where ip = ?", [$serverip]); //$ip['serverip']服务器IP yield from IDelUser($user, $server['password'], $server['cport'], $server['ip']); } catch (Exception $th) { // throw $th; //yield null; return ["code" => "-1", "msg"=>"无法连接到CCProxy", "icon" => "5"]; } } function AddUser($proxyaddress,$admin_password,$admin_port,$userdata) { try { if (!CheckStrChinese($userdata["user"])) { return ["code" => "-1", "msg"=>"用户名不合法,大概率是与服务器冲突了", "icon" => "5"]; } if (strlen($userdata["user"])<5) { return ["code" => "-1", "msg"=>"用户名长度不合法", "icon" => "5"]; } if(!CheckStrPwd($userdata["pwd"])){ return ["code" => "-1", "msg"=>"密码不合法", "icon" => "5"]; } $user=queryuserall($admin_password,$admin_port,$proxyaddress); if(!existsuser($userdata["user"],$user)){ $json=[ "code"=>-1, "msg"=>"账号已经存在", "icon" => "5" ]; return $json; } // $username = $_POST["user"]; // $password = $_POST["pwd"]; $ipaddress = ""; $macaddress = ""; $connection = "-1"; $bandwidth = "-1"; $date=date("Y-m-d H:i:s"); if($userdata["expire"]>0){ $enddate=date('Y-m-d H:i:s',strtotime("$date + ".$userdata["expire"]." day")); }else{ $enddate=date('Y-m-d H:i:s',strtotime($userdata["use_date"])); } $end_date = explode(" ", $enddate); $disabledate = $end_date[0]; $disabletime = $end_date[1]; $fp = fsockopen($proxyaddress, $admin_port, $errno, $errstr, 3); if (!$fp) { return ["code" => "-1", "msg"=>"无法连接到CCProxy", "icon" => "5"]; //return false; } else { $url_ = "/account"; $url = "add=1" . "&"; $url = $url . "autodisable=1" . "&"; $url = $url . "enable=1" . "&"; if($admin_password!="") { $url = $url . "usepassword=1" . "&"; } if($ipaddress!=""){ $url = $url . "usepassword=1" . "&"; } if($macaddress!=""){ $url = $url . "usemacaddress=1" . "&"; } $url = $url . "enablesocks=1" . "&"; $url = $url . "enablewww=0" . "&"; $url = $url . "enabletelnet=0" . "&"; $url = $url . "enabledial=0" . "&"; $url = $url . "enableftp=0" . "&"; $url = $url . "enableothers=0" . "&"; $url = $url . "enablemail=0" . "&"; $url = $url . "username=" . $userdata["user"] . "&"; $url = $url . "password=" . $userdata["pwd"] . "&"; $url = $url . "ipaddress=" . $ipaddress . "&"; $url = $url . "macaddress=" . $macaddress . "&"; $url = $url . "connection=" . $connection . "&"; $url = $url . "bandwidth=" . $bandwidth . "&"; $url = $url . "disabledate=" . $disabledate . "&"; $url = $url . "disabletime=" . $disabletime . "&"; $url = $url . "userid=-1"; $len = "Content-Length: " . strlen($url); $auth = "Authorization: Basic " . base64_encode("admin:" . $admin_password); $msg = "POST " . $url_ . " HTTP/1.0\r\nHost: " . $proxyaddress . "\r\n" . $auth . "\r\n" . $len . "\r\n" . "\r\n" . $url; fputs($fp, $msg); while (!feof($fp)) { $s = fgets($fp, 4096); } fclose($fp); return ["code" => "1", "msg"=>"注册用户成功", "icon" => "1"]; } } catch (Exception $th) { //yield null; //throw $th; return ["code" => "-1", "msg"=>"无法连接到CCProxy", "icon" => "5"]; } } /** * @description: 账号存在 false 不存在为 true * @param {*} $column * @param {*} $ccp * @return {*} bool * @use: */ function existsuser($column,$ccp){ if(empty($column)){ return "不能为空!"; } // ="admin"; $result = array_filter($ccp, function ($where) use ($column) { return $where['user'] == $column; }); return empty($result); // print_r($result);//打印全部数组 // $col=array_column($result,'disabletime');//expire // $col2=array_column($result,'expire'); //return $col2[0]==1?'<h5 style="color: red;display: inline;">到期时间:'.$col[0].'</h5>':($col[0]!=""?'<h5 style="color: #1E9FFF;display: inline;">到期时间:'.$col[0].'</h5>':'<h5 style="color: red;display: inline;">账号不存在</h5>'); } function ValidIp($ip){ $preg="/^((([0-9]?[0-9])|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5]))\.){3}(([0-9]?[0-9])|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5]))/"; preg_match($preg,$ip,$matches); if(!empty($matches)&&!empty($ip)){ return true; } return false; } function ValidPort($port){ if ($port<=65535&&!empty($port)) { return true; } return false; } function check_spider() { $useragent=strtolower($_SERVER['HTTP_USER_AGENT']); if (strpos($useragent,'baiduspider')!==false) { return 'baiduspider'; } if (strpos($useragent,'360spider')!==false) { return '360spider'; } if (strpos($useragent,'soso')!==false) { return 'soso'; } if (strpos($useragent,'bing')!==false) { return 'bing'; } if (strpos($useragent,'yahoo')!==false) { return 'yahoo'; } if (strpos($useragent,'sohu-search')!==false) { return 'Sohubot'; } if (strpos($useragent,'sogou')!==false) { return 'sogou'; } if (strpos($useragent,'youdaobot')!==false) { return 'YoudaoBot'; } if (strpos($useragent,'yodaobot')!==false) { return 'YodaoBot'; } if (strpos($useragent,'robozilla')!==false) { return 'Robozilla'; } if (strpos($useragent,'msnbot')!==false) { return 'msnbot'; } if (strpos($useragent,'lycos')!==false) { return 'Lycos'; } if (!strpos($useragent,'ia_archiver')===false) { } else { if (!strpos($useragent,'iaarchiver')===false) { return 'alexa'; } } if (strpos($useragent,'robozilla')!==false) { return 'Robozilla'; } if (strpos($useragent,'sitebot')!==false) { return 'SiteBot'; } if (strpos($useragent,'mj12bot')!==false) { return 'MJ12bot'; } if (strpos($useragent,'gosospider')!==false) { return 'gosospider'; } if (strpos($useragent,'gigabot')!==false) { return 'Gigabot'; } if (strpos($useragent,'yrspider')!==false) { return 'YRSpider'; } if (strpos($useragent,'gigabot')!==false) { return 'Gigabot'; } if (strpos($useragent,'jikespider')!==false) { return 'jikespider'; } if (strpos($useragent,'etaospider')!==false) { return 'EtaoSpider'; } if (strpos($useragent,'foxspider')!==false) { return 'FoxSpider'; } if (strpos($useragent,'docomo')!==false) { return 'DoCoMo'; } if (strpos($useragent,'yandexbot')!==false) { return 'YandexBot'; } if (strpos($useragent,'sinaweibobot')!==false) { return 'SinaWeiboBot'; } if (strpos($useragent,'catchbot')!==false) { return 'CatchBot'; } if (strpos($useragent,'surveybot')!==false) { return 'SurveyBot'; } if (strpos($useragent,'dotbot')!==false) { return 'DotBot'; } if (strpos($useragent,'purebot')!==false) { return 'Purebot'; } if (strpos($useragent,'ccbot')!==false) { return 'CCBot'; } if (strpos($useragent,'mlbot')!==false) { return 'MLBot'; } if (strpos($useragent,'adsbot-google')!==false) { return 'AdsBot-Google'; } if (strpos($useragent,'ahrefsbot')!==false) { return 'AhrefsBot'; } if (strpos($useragent,'spbot')!==false) { return 'spbot'; } if (strpos($useragent,'augustbot')!==false) { return 'AugustBot'; } return false; } function cc_defender() { $iptoken=md5(x_real_ip().date('Ymd')).md5(TIMESTAMP.rand(11111,99999)); if ((!isset($_COOKIE['sec_defend']) || !substr($_COOKIE['sec_defend'],0,32)===substr($iptoken,0,32))) { if (!isset($_COOKIE['sec_defend_time'])) { $_COOKIE['sec_defend_time']=0; } $sec_defend_time=$_COOKIE['sec_defend_time']+1; include_once(SYSTEM_ROOT.'hieroglyphy.class.php'); $x=new hieroglyphy(); $setCookie=$x->hieroglyphyString($iptoken); header('Content-type:text/html;charset=utf-8'); if ($sec_defend_time>=10) { exit('浏览器不支持COOKIE或者不正常访问!'); } echo '<html><head><meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="content-type" content="text/html;charset=utf-8"><title>正在加载中</title><script>function setCookie(name,value){var exp = new Date();exp.setTime(exp.getTime() + 60*60*1000);document.cookie = name + "="+ escape (value).replace(/\\+/g, \'%2B\') + ";expires=" + exp.toGMTString() + ";path=/";}function getCookie(name){var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");if(arr=document.cookie.match(reg))return unescape(arr[2]);else return null;}var sec_defend_time=getCookie(\'sec_defend_time\')||0;sec_defend_time++;setCookie(\'sec_defend\','.$setCookie.');setCookie(\'sec_defend_time\',sec_defend_time);if(sec_defend_time>1)window.location.href="./index.php";else window.location.reload();</script></head><body></body></html>'; exit(0); } elseif (isset($_COOKIE['sec_defend_time'])) { setcookie('sec_defend_time', '', TIMESTAMP - 604800, '/'); } } /** * x_real_ip function * * @author 一花 <487735913@qq.com> * @copyright x_real_ip function 一花 487735913@qq.com */ function x_real_ip() { $ip=$_SERVER['REMOTE_ADDR']; if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && preg_match_all('#\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}#s',$_SERVER['HTTP_X_FORWARDED_FOR'],$matches)) { foreach($matches[0] as $xip) { if (!preg_match('#^(10|172\\.16|192\\.168)\\.#',$xip)) { $ip=$xip; } else { continue; } } } else { if (isset($_SERVER['HTTP_CLIENT_IP']) && preg_match('/^([0-9]{1,3}\\.){3}[0-9]{1,3}$/',$_SERVER['HTTP_CLIENT_IP'])) { $ip=$_SERVER['HTTP_CLIENT_IP']; } else { if (isset($_SERVER['HTTP_CF_CONNECTING_IP']) && preg_match('/^([0-9]{1,3}\\.){3}[0-9]{1,3}$/',$_SERVER['HTTP_CF_CONNECTING_IP'])) { $ip=$_SERVER['HTTP_CF_CONNECTING_IP']; } else { if ((isset($_SERVER['HTTP_X_REAL_IP']) && preg_match('/^([0-9]{1,3}\\.){3}[0-9]{1,3}$/',$_SERVER['HTTP_X_REAL_IP']))) { $ip=$_SERVER['HTTP_X_REAL_IP']; } } } } return $ip; } /* * 方法 isDate * 功能 判断日期格式是否正确 * 参数 $str 日期字符串 $format 日期格式 * 返回 无 */ function is_Date($str,$format='Y-m-d H:i:s',$split='-'){ $validStr=explode($split,explode(" ",$str)[0]); if(intval($validStr[0])<=0) return false; if(intval($validStr[1])<=0) return false; if(intval($validStr[2])<=0) return false; $unixTime_1=strtotime($str); if(!is_numeric($unixTime_1)) return false; //如果不是数字格式,则直接返回 $checkDate=date($format,$unixTime_1); $unixTime_2=strtotime($checkDate); if($unixTime_1==$unixTime_2){ return true; }else{ return false; } } /** * 转换卡密时长为汉字 */ function KamiPaeseString($str) { $res=str_replace(array("+", " ", "year", "month", "day", "hour"), array("", "", "年","月","天","时"), $str); return $res; } ?>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/includes/member.php
includes/member.php
<?php /* * @Author: yihua * @Date: 2022-06-25 21:02:04 * @LastEditTime: 2025-01-05 14:06:36 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\includes\member.php * 一花一叶 一行代码 * Copyright (c) 2022 by yihua 487735913@qq.com, All Rights Reserved. */ if (!defined('IN_CRONLITE')) exit(); if (isset($_COOKIE["sub_admin_token"])) { $cookies = authcode(daddslashes($_COOKIE['sub_admin_token']), 'DECODE', SYS_KEY); list($user, $sid) = explode("\t", $cookies); if ($cookies && $DB->selectRowV2("select * from sub_admin where username=? and cookies=?", [$user, $_COOKIE['sub_admin_token']])) { if ($users = $DB->selectRowV2("select * from sub_admin where username=?", [$user])) { $session = md5($users['username'] . $users['password'] . $password_hash); if (hash_equals($session, $sid)) { // 使用安全的字符串比较 $islogin = 1; // 建议添加登录时间验证 session_regenerate_id(true); // 更新session_id防止会话固定攻击 } } } }
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/includes/authcode.php
includes/authcode.php
<?php /* * @Author: yihua * @Date: 2025-01-04 17:32:11 * @LastEditTime: 2025-01-05 11:20:04 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\includes\authcode.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ $authcode='0a555f617f4a15604345f059d2b37a85'; ?>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/includes/cache.php
includes/cache.php
<?php /* * @Author: yihua * @Date: 2025-01-05 11:25:08 * @LastEditTime: 2025-01-05 11:26:12 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\includes\cache.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ /** * 缓存类 * 使用文件系统实现的缓存机制,支持自动过期、垃圾回收和调试 */ class Cache { private static $instance = null; private $cache_dir; private $enabled = true; private $gc_probability = 100; // 垃圾回收概率:1/100 private $file_prefix = 'cache_'; private $default_ttl = 300; // 默认缓存时间:5分钟 /** * 私有构造函数,初始化缓存目录 */ private function __construct() { $this->cache_dir = dirname(__FILE__) . '/../cache/'; if (!file_exists($this->cache_dir)) { if (!@mkdir($this->cache_dir, 0777, true)) { throw new Exception('Failed to create cache directory'); } } // 随机执行垃圾回收 if (mt_rand(1, $this->gc_probability) === 1) { $this->garbageCollect(); } } /** * 获取缓存实例(单例模式) */ public static function getInstance() { if (self::$instance === null) { self::$instance = new self(); } return self::$instance; } /** * 调试方法,返回缓存状态和内容 */ public function debug() { $files = glob($this->cache_dir . $this->file_prefix . '*'); $cache_content = []; $total_size = 0; foreach ($files as $file) { $key = str_replace($this->file_prefix, '', basename($file)); $content = $this->get($key); if ($content !== null) { $cache_content[$key] = [ 'data' => $content, 'size' => filesize($file), 'modified' => date('Y-m-d H:i:s', filemtime($file)) ]; $total_size += filesize($file); } } return [ 'enabled' => $this->enabled, 'cache_dir' => $this->cache_dir, 'cache_count' => count($cache_content), 'total_size' => $this->formatSize($total_size), 'cache_content' => $cache_content ]; } /** * 获取缓存内容 */ public function get($key) { if (!$this->enabled || !$this->validateKey($key)) { error_log("Cache disabled or invalid key: " . $key); return null; } $cache_file = $this->getCacheFilePath($key); if (file_exists($cache_file)) { try { $data = unserialize(file_get_contents($cache_file)); if ($data && isset($data['expires']) && $data['expires'] > time()) { error_log("Cache hit for key: " . $key); return $data['data']; } // 删除过期缓存 @unlink($cache_file); } catch (Exception $e) { error_log("Cache read error: " . $e->getMessage()); @unlink($cache_file); } } error_log("Cache miss for key: " . $key); return null; } /** * 设置缓存内容 */ public function set($key, $value, $ttl = null) { if (!$this->enabled || !$this->validateKey($key)) { error_log("Cache set failed - disabled or invalid key"); return false; } $ttl = $ttl ?? $this->default_ttl; $cache_file = $this->getCacheFilePath($key); $data = [ 'data' => $value, 'expires' => time() + $ttl ]; try { if (file_put_contents($cache_file, serialize($data), LOCK_EX) === false) { throw new Exception("Failed to write cache file"); } error_log("Cache set successfully for key: " . $key . " with TTL: " . $ttl); return true; } catch (Exception $e) { error_log("Cache write error: " . $e->getMessage()); return false; } } /** * 检查缓存是否存在且有效 */ public function has($key) { return $this->get($key) !== null; } /** * 删除指定缓存 */ public function delete($key) { if (!$this->validateKey($key)) { return false; } $cache_file = $this->getCacheFilePath($key); return file_exists($cache_file) ? @unlink($cache_file) : false; } /** * 清除所有缓存 */ public function clear() { $files = glob($this->cache_dir . $this->file_prefix . '*'); $success = true; foreach ($files as $file) { if (!@unlink($file)) { $success = false; error_log("Failed to delete cache file: " . $file); } } return $success; } /** * 禁用缓存 */ public function disable() { $this->enabled = false; } /** * 启用缓存 */ public function enable() { $this->enabled = true; } /** * 垃圾回收 */ private function garbageCollect() { $files = glob($this->cache_dir . $this->file_prefix . '*'); foreach ($files as $file) { if (filemtime($file) < time() - 86400) { // 清理超过24小时的文件 @unlink($file); } } } /** * 验证缓存键名 */ private function validateKey($key) { return is_string($key) && strlen($key) <= 255 && preg_match('/^[a-zA-Z0-9_.-]+$/', $key); } /** * 获取缓存文件路径 */ private function getCacheFilePath($key) { return $this->cache_dir . $this->file_prefix . md5($key); } /** * 格式化文件大小 */ private function formatSize($bytes) { $units = ['B', 'KB', 'MB', 'GB']; $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); return round($bytes / pow(1024, $pow), 2) . ' ' . $units[$pow]; } // 防止克隆 private function __clone() {} // 防止反序列化 private function __wakeup() {} }
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/includes/txprotect.php
includes/txprotect.php
<?php /* * @Author: yihua * @Date: 2022-06-25 21:02:04 * @LastEditTime: 2022-07-29 09:36:20 * @LastEditors: yihua * @Description: 反腾讯网址安全检测系统 * @FilePath: \ccpy\includes\txprotect.php * 一花一叶 一行代码 * Copyright (c) 2022 by yihua 487735913@qq.com, All Rights Reserved. */ //IP屏蔽 $iptables='977012992~977013247|977084416~977084927|1743654912~1743655935|1949957632~1949958143|2006126336~2006127359|2111446272~2111446527|3418570752~3418578943|3419242496~3419250687|3419250688~3419275263|3682941952~3682942207|3682942464~3682942719|3682986660~3682986663|1707474944~1707606015|1709318400~1709318655|1884967642|1884967620|1893733510|1709332858|1709325774|1709342057|1709341968|1709330358|1709335492|1709327575|1709327041|1709327557|1709327573|1975065457|1902908741|1902908705|3029946827'; $remoteiplong=bindec(decbin(ip2long(get_real_ip()))); foreach(explode('|',$iptables) as $iprows){ if($remoteiplong==$iprows){ exit('欢迎使用!'); } $ipbanrange=explode('~',$iprows); if($remoteiplong>=$ipbanrange[0] && $remoteiplong<=(array_key_exists(1,$ipbanrange)? $ipbanrange[1] :0)){ exit('欢迎使用!'); } } //HEADER特征屏蔽 if(preg_match("/manager/", strtolower($_SERVER['HTTP_USER_AGENT'])) || strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla')===false && strpos($_SERVER['HTTP_USER_AGENT'], 'ozilla')!==false || isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'urls.tr.com')!==false || isset($_COOKIE['ASPSESSIONIDQASBQDRC']) || empty($_SERVER['HTTP_USER_AGENT']) || strpos($_SERVER['HTTP_USER_AGENT'], 'HUAWEI G700-U00')!==false && !isset($_SERVER['HTTP_ACCEPT']) || preg_match("/Alibaba.Security.Heimdall/", $_SERVER['HTTP_USER_AGENT'])) { exit('欢迎使用!'); } if(strpos($_SERVER['HTTP_USER_AGENT'], 'Coolpad Y82-520')!==false && $_SERVER['HTTP_ACCEPT']=='*/*' || strpos($_SERVER['HTTP_USER_AGENT'], 'Mac OS X 10_12_4')!==false && $_SERVER['HTTP_ACCEPT']=='*/*' || strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone OS 9_3_4')!==false && $_SERVER['HTTP_ACCEPT']=='*/*' || strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone OS 8_4')!==false && $_SERVER['HTTP_ACCEPT']=='*/*' || strpos($_SERVER['HTTP_USER_AGENT'], 'Android 6.0.1')!==false && strpos($_SERVER['HTTP_USER_AGENT'], 'MQQBrowser/6.8')!==false && $_SERVER['HTTP_ACCEPT']=='*/*' || strpos($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'en')!==false && strpos($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'zh')===false || strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone')!==false && strpos($_SERVER['HTTP_USER_AGENT'], 'en-')!==false && strpos($_SERVER['HTTP_USER_AGENT'], 'zh')===false) { exit('您当前浏览器不支持或操作系统语言设置非中文,无法访问本站!'); } if(preg_match("/Windows NT 6.1/", $_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_ACCEPT']=='*/*'|| preg_match("/Windows NT 5.1/", $_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_ACCEPT']=='*/*' || preg_match("/vnd.wap.wml/", $_SERVER['HTTP_ACCEPT']) && preg_match("/Windows NT 5.1/", $_SERVER['HTTP_USER_AGENT'])){ exit('您的IE浏览器版本太低,请复制到其他浏览器打开!'); } function get_real_ip(){ $ip = $_SERVER['REMOTE_ADDR']; if (isset($_SERVER['HTTP_CF_CONNECTING_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $_SERVER['HTTP_CF_CONNECTING_IP'])) { $ip = $_SERVER['HTTP_CF_CONNECTING_IP']; } elseif (isset($_SERVER['HTTP_CLIENT_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches)) { foreach ($matches[0] AS $xip) { if (!preg_match('#^(10|172\.16|192\.168)\.#', $xip)) { $ip = $xip; break; } } } return $ip; }
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/includes/common.php
includes/common.php
<?php /* * @Author: yihua * @Date: 2025-01-04 17:32:11 * @LastEditTime: 2025-01-05 18:10:04 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\includes\common.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ set_error_handler(function($errno, $errstr, $errfile, $errline) { if (!(error_reporting() & $errno)) { return false; } throw new ErrorException($errstr, 0, $errno, $errfile, $errline); }); try { // 安全响应头(已放宽限制,允许 iframe 嵌入) // header("X-Frame-Options: DENY"); // 已禁用 // header("X-XSS-Protection: 1; mode=block"); // 已禁用(现代浏览器已弃用) header("X-Content-Type-Options: nosniff"); // header("Referrer-Policy: strict-origin-when-cross-origin"); // 已禁用 if($_SERVER['SERVER_PORT'] == '443') { header("Strict-Transport-Security: max-age=31536000; includeSubDomains; preload"); } // error_reporting(0); if (defined('IN_CRONLITE')) { return null; } define('CACHE_FILE', 0); define('IN_CRONLITE', true); define('VERSION', '2.0.0');//版本号 define('SYSTEM_ROOT', dirname(__FILE__).'/');//定义域名泛解析用于访问文件 define('ROOT', dirname(SYSTEM_ROOT).'/'); define('SYS_KEY', 'yihuaiccp');//定义一个常量 define('CC_Defender', 1); //防CC攻击开关(1为session模式) define('is_defend', true); //防CC攻击开关(1为session模式) define('TIMESTAMP',time()); date_default_timezone_set("PRC"); $site_url = htmlspecialchars($_SERVER['HTTP_HOST'], ENT_QUOTES, 'UTF-8'); $date = date('Y-m-d H:i:s'); ini_set('session.cookie_httponly', 1); ini_set('session.cookie_secure', 1); ini_set('session.use_strict_mode', 1); ini_set('session.use_only_cookies', 1); ini_set('session.gc_maxlifetime', 3600); session_start(); // session_regenerate_id(true); // 定期重新生成会话ID $islogin=-1; $scriptpath = filter_var( htmlspecialchars($_SERVER['SCRIPT_NAME'], ENT_QUOTES, 'UTF-8'), FILTER_SANITIZE_URL ); $sitepath = substr($scriptpath, 0, strrpos($scriptpath, '/')); include_once(SYSTEM_ROOT.'function.php'); include_once(SYSTEM_ROOT.'cache.php'); //360安全 $siteurl = ($_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $sitepath . '/'; if (is_file(SYSTEM_ROOT . '360safe/360webscan.php')) { include_once SYSTEM_ROOT . '360safe/360webscan.php'; include_once SYSTEM_ROOT . '360safe/xss.php'; } //判断是否开启防CC if (is_defend === true || CC_Defender === 3) { $isAjax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'; if (!$isAjax) { include_once(SYSTEM_ROOT.'txprotect.php'); } if ((CC_Defender === 1 && !check_spider()) || CC_Defender === 3) { cc_defender(); } } //判断 if (!file_exists(ROOT . 'config.php')) { header('Content-type:text/html;charset=utf-8'); //echo '你还没安装!<a href="install/">点此安装</a>'; echo '<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>站点提示信息</title> <style type="text/css"> html{background:#eee;text-align: center;}body{background:#fff;color:#333;font-family:"微软雅黑","Microsoft YaHei",sans-serif;margin:2em auto;padding:1em 2em;max-width:700px;-webkit-box-shadow:10px 10px 10px rgba(0,0,0,.13);box-shadow:10px 10px 10px rgba(0,0,0,.13);opacity:.8}h1{border-bottom:1px solid #dadada;clear:both;color:#666;font:24px "微软雅黑","Microsoft YaHei",,sans-serif;margin:30px 0 0 0;padding:0;padding-bottom:7px}#error-page{margin-top:50px}h3{text-align:center}#error-page p{font-size:9px;line-height:1.5;margin:25px 0 20px}#error-page code{font-family:Consolas,Monaco,monospace}ul li{margin-bottom:10px;font-size:9px}a{color:#21759B;text-decoration:none;margin-top:-10px}a:hover{color:#D54E21}.button{background:#f7f7f7;border:1px solid #ccc;color:#555;display:inline-block;text-decoration:none;font-size:9px;line-height:26px;height:28px;margin:0;padding:0 10px 1px;cursor:pointer;-webkit-border-radius:3px;-webkit-appearance:none;border-radius:3px;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);vertical-align:top}.button.button-large{height:29px;line-height:28px;padding:0 12px}.button:focus,.button:hover{background:#fafafa;border-color:#999;color:#222}.button:focus{-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.2);box-shadow:1px 1px 1px rgba(0,0,0,.2)}.button:active{background:#eee;border-color:#999;color:#333;-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5);box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5)}table{table-layout:auto;border:1px solid #333;empty-cells:show;border-collapse:collapse}th{padding:4px;border:1px solid #333;overflow:hidden;color:#333;background:#eee}td{padding:4px;border:1px solid #333;overflow:hidden;color:#333} </style> </head> <body id="error-page"> <h3>站点提示信息</h3><h2>你还没安装!<a href="install/">点此安装</a><br></h2> </body> </html>'; exit(0); } require ROOT.'config.php'; if(!defined('SQLITE') && (!$dbconfig['user']||!$dbconfig['pwd']||!$dbconfig['dbname']))//检测安装 { header('Content-type:text/html;charset=utf-8'); //echo '你还没安装!<a href="install/">点此安装</a>'; echo '<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>站点提示信息</title> <style type="text/css"> html{background:#eee;text-align: center;}body{background:#fff;color:#333;font-family:"微软雅黑","Microsoft YaHei",sans-serif;margin:2em auto;padding:1em 2em;max-width:700px;-webkit-box-shadow:10px 10px 10px rgba(0,0,0,.13);box-shadow:10px 10px 10px rgba(0,0,0,.13);opacity:.8}h1{border-bottom:1px solid #dadada;clear:both;color:#666;font:24px "微软雅黑","Microsoft YaHei",,sans-serif;margin:30px 0 0 0;padding:0;padding-bottom:7px}#error-page{margin-top:50px}h3{text-align:center}#error-page p{font-size:9px;line-height:1.5;margin:25px 0 20px}#error-page code{font-family:Consolas,Monaco,monospace}ul li{margin-bottom:10px;font-size:9px}a{color:#21759B;text-decoration:none;margin-top:-10px}a:hover{color:#D54E21}.button{background:#f7f7f7;border:1px solid #ccc;color:#555;display:inline-block;text-decoration:none;font-size:9px;line-height:26px;height:28px;margin:0;padding:0 10px 1px;cursor:pointer;-webkit-border-radius:3px;-webkit-appearance:none;border-radius:3px;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);vertical-align:top}.button.button-large{height:29px;line-height:28px;padding:0 12px}.button:focus,.button:hover{background:#fafafa;border-color:#999;color:#222}.button:focus{-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.2);box-shadow:1px 1px 1px rgba(0,0,0,.2)}.button:active{background:#eee;border-color:#999;color:#333;-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5);box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5)}table{table-layout:auto;border:1px solid #333;empty-cells:show;border-collapse:collapse}th{padding:4px;border:1px solid #333;overflow:hidden;color:#333;background:#eee}td{padding:4px;border:1px solid #333;overflow:hidden;color:#333} </style> </head> <body id="error-page"> <h3>站点提示信息</h3><h2>你还没安装!<a href="install/">点此安装</a><br></h2> </body> </html>'; exit(0); } // //连接数据库 include_once SYSTEM_ROOT . 'dbhelp.php'; $DB= new SpringMySQLi($dbconfig['host'], $dbconfig['user'], $dbconfig['pwd'], $dbconfig['dbname']); $sql = 'SELECT * FROM `sub_admin`'; $count = $DB->selectV2($sql, []) ?: array(); $installcheck=count($count)>0?true:false; if ($installcheck == false) { @header('Content-Type: text/html; charset=UTF-8'); exit('<script>alert("检测到您的数据库并未安装我们系统,自动为您跳转安装界面!");window.location.href="../install";</script>'); } $password_hash='!@#%!s!0'; include_once SYSTEM_ROOT . 'authcode.php'; define('authcode', $authcode); include_once SYSTEM_ROOT . 'member.php'; $clientip = x_real_ip(); $cookiesid = isset($_COOKIE['mysid'])?$_COOKIE['mysid']:false;//获取mysid if (!$cookiesid || !preg_match('/^[0-9a-z]{32}$/i', $cookiesid)) { $cookiesid = bin2hex(random_bytes(16)); setcookie('mysid', $cookiesid, [ 'expires' => time() + 604800, 'path' => '/', 'domain' => $_SERVER['HTTP_HOST'], 'secure' => true, 'httponly' => true, 'samesite' => 'Strict' ]); } $host = htmlspecialchars($_SERVER['HTTP_HOST'], ENT_QUOTES, 'UTF-8'); $subconf = $DB->selectRowV2('SELECT * FROM sub_admin WHERE siteurl = ?', [$host]); if($subconf==NULL) { sysmsg('<h2>您的站点没有绑定(只能绑定一个域名),请联系管理员,或者手动修改数据库表sub_admin的siteurl字段改成<b style="color:red;">'.$_SERVER['HTTP_HOST'].'</b><br/>', true); exit(0); } $userAgent = htmlspecialchars($_SERVER['HTTP_USER_AGENT'] ?? '', ENT_QUOTES, 'UTF-8'); if (strpos($userAgent, 'QQ/') !== false) { include_once ROOT . 'jump.php'; exit(0); } if(count($subconf)<=0){ sysmsg('<h2>您的站点没有开通,请联系管理员.<br/>', true); } if ($subconf) { $conf = $subconf; if ($date > $conf['over_date']) { sysmsg('<h2>您的站点已到期,请联系管理员续费.<br/>', true); } } if ($subconf) { $conf = $subconf; if ($conf['state'] == 0) { sysmsg('<h2>您的站点违反规定,现已被管理员关闭.<br/>', true); } } //数据库更新 // if ($install == false) { // if (!($xxs['version'] >= VERSION)) { // echo '您尚未更新数据库,请立即<a href="/install/updata.php">前往更新</a>'; // exit(0); // } // } header_remove("X-Powered-By"); } catch (Exception $e) { // 记录错误但不显示详细信息给用户 error_log($e->getMessage()); sysmsg($e, true); exit(1); }
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/includes/dbhelp.php
includes/dbhelp.php
<?php /* * @Author: yihua * @Date: 2025-01-04 17:32:11 * @LastEditTime: 2025-01-05 16:24:41 * @LastEditors: yihua * @Description: * MySQL数据库操作类 * 1. 封装 MySQLi 扩展实现常用数据库快速操作 * 2. 非 ORM 实现方式,更关注 SQL 本身 * 3. 针对大数据表,请注意优化SQL索引及结果集规模 * @FilePath: \ccproxy_end\includes\dbhelp.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ class SpringMySQLi { // 公有变量 public $pageNo; public $pageRows; public $runCount; public $runTime; public $errNo; public $errMsg; // 私有变量 private $dbHost; private $dbUser; private $dbUpwd; private $dbName; private $dbChar; private $dbConn; private $querySql; private $queryLogs; // 查询历史记录计数 public $count; public function __construct($host, $user, $pwd, $dbname, $charset = 'utf8mb4') { $this->dbHost = $host; $this->dbUser = $user; $this->dbUpwd = $pwd; $this->dbName = $dbname; $this->dbChar = $charset; $this->count = 0; $this->querySql = ''; $this->queryLogs = []; $this->pageNo = 1; $this->pageRows = 10; $this->runCount = 0; $this->runTime = 0; $this->errNo = 0; $this->errMsg = ''; } public function __destruct() { $this->closeConnection(); } public function closeConnection() { if ($this->dbConn) { $this->dbConn->close(); } } public function setPageNo($num) { $this->pageNo = (int)$num; } public function setPageRows($num) { $this->pageRows = (int)$num; } public function setDbName($name) { if ($this->dbName != $name) { $this->dbName = $name; if ($this->dbConn && !$this->dbConn->select_db($name)) { $this->fetchError(); } } } public function escape($val) { return $this->dbConn ? $this->dbConn->real_escape_string(trim($val)) : addslashes(trim($val)); } public function select($sql) { $this->querySql = $sql; return $this->fetchResult(); } public function selectPage($sql) { $this->querySql = "{$sql} LIMIT " . (($this->pageNo - 1) * $this->pageRows) . ', ' . $this->pageRows; return $this->fetchResult(); } public function selectRow($sql) { $this->querySql = false === stripos($sql, 'LIMIT') ? "{$sql} LIMIT 1" : $sql; return $this->fetchResult(MYSQLI_ASSOC, true); } public function selectOne($sql) { $this->querySql = false === stripos($sql, 'LIMIT') ? "{$sql} LIMIT 1" : $sql; $result = $this->fetchResult(MYSQLI_NUM, true); return $result[0] ?? null; } public function exec($sql, array $params = []) { if ($this->connect()) { $stmt = $this->dbConn->prepare($sql); if ($stmt) { if ($params) { // 绑定参数 $stmt->bind_param(str_repeat('s', count($params)), ...$params); } $result = $stmt->execute(); if ($result === false) { $this->fetchError(); return false; } return $stmt->insert_id ?: $stmt->affected_rows; } else { $this->fetchError(); return false; } } return false; } public function insert($table, $values) { $vars = $this->filterVars($values); $this->querySql = "INSERT INTO {$table} SET {$vars}"; return $this->exec($this->querySql); } public function update($table, $values, $where) { $val = $this->filterVars($values); $this->querySql = "UPDATE {$table} SET {$val} WHERE {$where}"; return $this->exec($this->querySql); } public function delete($table, $where) { $this->querySql = "DELETE FROM {$table} WHERE {$where}"; return $this->exec($this->querySql); } public function hasError() { return $this->errNo > 0; } public function getError() { return $this->errMsg; } public function getLogs() { return $this->queryLogs; } private function connect() { if (!$this->dbConn || !$this->dbConn->ping()) { $this->dbConn = new mysqli($this->dbHost, $this->dbUser, $this->dbUpwd, $this->dbName); if ($this->dbConn->connect_errno) { $this->fetchError($this->dbConn->connect_errno, $this->dbConn->connect_error); return false; } if (!$this->dbConn->set_charset($this->dbChar)) { $this->fetchError(); return false; } } return true; } private function prepareStatement($sql, $params) { // 确保数据库连接已建立 if (!$this->connect()) { return false; } $stmt = $this->dbConn->prepare($sql); if (!$stmt) { $this->fetchError(); // 捕获 prepare 失败的错误 return false; } if ($params) { // 假设所有参数都是字符串类型,对于其他类型需要适当调整 $types = str_repeat('s', count($params)); $stmt->bind_param($types, ...$params); } return $stmt; } private function filterVars($vars) { $arr = []; foreach ($vars as $k => $v) { if (is_null($v)) { $arr[] = "{$k}=NULL"; } else { $arr[] = "{$k}='" . $this->escape($v) . "'"; } } return implode(',', $arr); } private function fetchResult($type = MYSQLI_ASSOC, $singleRow = false) { $result = []; if (stripos($this->querySql, 'SELECT') === 0) { if ($this->connect()) { $queryResult = $this->dbConn->query($this->querySql); if ($queryResult !== false) { if ($singleRow) { $result = $queryResult->fetch_array($type); } else { while ($row = $queryResult->fetch_array($type)) { $result[] = $row; } } $queryResult->free(); } else { $this->fetchError(); } } } else { $this->fetchError(100, 'wrong query statement'); } return $result; } private function fetchError($errno = null, $error = null) { $this->errNo = $errno ?? $this->dbConn->errno; $this->errMsg = $error ?? $this->dbConn->error; } private function fetchResultV2($statement, $type = MYSQLI_ASSOC, $singleRow = false) { $result = []; if ($statement && $statement->execute()) { $queryResult = $statement->get_result(); if ($singleRow) { $result = $queryResult->fetch_array($type); // 这里传入正确的类型 } else { while ($row = $queryResult->fetch_array($type)) { $result[] = $row; } } $queryResult->free(); } else { $this->fetchError(); // 处理错误 } return $result; } public function selectRowV2($sql, array $params = []) { $sql .= " LIMIT 1"; $stmt = $this->prepareStatement($sql, $params); return $this->fetchResultV2($stmt, MYSQLI_ASSOC, true); } public function selectV2($sql, array $params = []) { $stmt = $this->prepareStatement($sql, $params); return $this->fetchResultV2($stmt); } /** * 使用预处理语句插入数据 * @param string $table 表名 * @param array $values 键值对数组 * @return int|false 插入的ID或影响行数,失败返回false */ public function insertV2($table, array $values) { if (empty($values)) { return false; } if (!$this->connect()) { return false; } // 构建字段名和占位符 $fields = array_keys($values); $placeholders = array_fill(0, count($fields), '?'); // 构建 SQL 语句 $sql = "INSERT INTO {$table} (" . implode(', ', $fields) . ") VALUES (" . implode(', ', $placeholders) . ")"; $stmt = $this->dbConn->prepare($sql); if (!$stmt) { $this->fetchError(); return false; } // 绑定参数 $params = array_values($values); $types = str_repeat('s', count($params)); $stmt->bind_param($types, ...$params); if (!$stmt->execute()) { $this->fetchError(); $stmt->close(); return false; } $result = $stmt->insert_id ?: $stmt->affected_rows; $stmt->close(); return $result; } /** * 使用预处理语句更新数据 * @param string $table 表名 * @param array $values 要更新的键值对数组 * @param string $whereClause WHERE子句(使用?占位符) * @param array $whereParams WHERE子句的参数 * @return int|false 影响的行数,失败返回false */ public function updateV2($table, array $values, $whereClause, array $whereParams = []) { if (empty($values)) { return false; } if (!$this->connect()) { return false; } // 构建 SET 子句 $setClause = []; foreach (array_keys($values) as $field) { $setClause[] = "{$field} = ?"; } // 构建 SQL 语句 $sql = "UPDATE {$table} SET " . implode(', ', $setClause) . " WHERE {$whereClause}"; $stmt = $this->dbConn->prepare($sql); if (!$stmt) { $this->fetchError(); return false; } // 合并 SET 参数和 WHERE 参数 $allParams = array_merge(array_values($values), $whereParams); $types = str_repeat('s', count($allParams)); $stmt->bind_param($types, ...$allParams); if (!$stmt->execute()) { $this->fetchError(); $stmt->close(); return false; } $result = $stmt->affected_rows; $stmt->close(); return $result; } /** * 使用预处理语句删除数据 * @param string $table 表名 * @param string $whereClause WHERE子句(使用?占位符) * @param array $whereParams WHERE子句的参数 * @return int|false 影响的行数,失败返回false */ public function deleteV2($table, $whereClause, array $whereParams = []) { if (!$this->connect()) { return false; } // 构建 SQL 语句 $sql = "DELETE FROM {$table} WHERE {$whereClause}"; $stmt = $this->dbConn->prepare($sql); if (!$stmt) { $this->fetchError(); return false; } // 绑定参数 if (!empty($whereParams)) { $types = str_repeat('s', count($whereParams)); $stmt->bind_param($types, ...$whereParams); } if (!$stmt->execute()) { $this->fetchError(); $stmt->close(); return false; } $result = $stmt->affected_rows; $stmt->close(); return $result; } /** * 使用预处理语句分页查询 * @param string $sql SQL语句(使用?占位符) * @param array $params 参数数组 * @return array 查询结果 */ public function selectPageV2($sql, array $params = []) { if (!$this->connect()) { return []; } // 计算 LIMIT 偏移量 $offset = ($this->pageNo - 1) * $this->pageRows; // 添加 LIMIT 子句 $sql .= " LIMIT {$offset}, {$this->pageRows}"; $stmt = $this->prepareStatement($sql, $params); return $this->fetchResultV2($stmt); } }
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/includes/hieroglyphy.class.php
includes/hieroglyphy.class.php
<?php class hieroglyphy{ private $characters; private $numbers; private $unescape; private $functionConstructor; public function __construct(){ $this->precharacters(); } private function precharacters(){ $this->numbers = array( "+[]", "+!![]", "!+[]+!![]", "!+[]+!![]+!![]", "!+[]+!![]+!![]+!![]", "!+[]+!![]+!![]+!![]+!![]", "!+[]+!![]+!![]+!![]+!![]+!![]", "!+[]+!![]+!![]+!![]+!![]+!![]+!![]", "!+[]+!![]+!![]+!![]+!![]+!![]+!![]+!![]", "!+[]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]" ); $this->characters = array( "0" => "(" . $this->numbers[0] . "+[])", "1" => "(" . $this->numbers[1] . "+[])", "2" => "(" . $this->numbers[2] . "+[])", "3" => "(" . $this->numbers[3] . "+[])", "4" => "(" . $this->numbers[4] . "+[])", "5" => "(" . $this->numbers[5] . "+[])", "6" => "(" . $this->numbers[6] . "+[])", "7" => "(" . $this->numbers[7] . "+[])", "8" => "(" . $this->numbers[8] . "+[])", "9" => "(" . $this->numbers[9] . "+[])" ); $_object_Object = "[]+{}"; $_NaN = "+{}+[]"; $_true = "!![]+[]"; $_false = "![]+[]"; $_undefined = "[][[]]+[]"; $this->characters[" "] = "(" . $_object_Object . ")[" . $this->numbers[7] . "]"; $this->characters["["] = "(" . $_object_Object . ")[" . $this->numbers[0] . "]"; $this->characters["]"] = "(" . $_object_Object . ")[" . $this->characters[1] . "+" . $this->characters[4] . "]"; $this->characters["a"] = "(" . $_NaN . ")[" . $this->numbers[1] . "]"; $this->characters["b"] = "(" . $_object_Object . ")[" . $this->numbers[2] . "]"; $this->characters["c"] = "(" . $_object_Object . ")[" . $this->numbers[5] . "]"; $this->characters["d"] = "(" . $_undefined . ")[" . $this->numbers[2] . "]"; $this->characters["e"] = "(" . $_undefined . ")[" . $this->numbers[3] . "]"; $this->characters["f"] = "(" . $_false . ")[" . $this->numbers[0] . "]"; $this->characters["i"] = "(" . $_undefined . ")[" . $this->numbers[5] . "]"; $this->characters["j"] = "(" . $_object_Object . ")[" . $this->numbers[3] . "]"; $this->characters["l"] = "(" . $_false . ")[" . $this->numbers[2] . "]"; $this->characters["n"] = "(" . $_undefined . ")[" . $this->numbers[1] . "]"; $this->characters["o"] = "(" . $_object_Object . ")[" . $this->numbers[1] . "]"; $this->characters["r"] = "(" . $_true . ")[" . $this->numbers[1] . "]"; $this->characters["s"] = "(" . $_false . ")[" . $this->numbers[3] . "]"; $this->characters["t"] = "(" . $_true . ")[" . $this->numbers[0] . "]"; $this->characters["u"] = "(" . $_undefined . ")[" . $this->numbers[0] ."]"; $this->characters["N"] = "(" . $_NaN . ")[" . $this->numbers[0] . "]"; $this->characters["O"] = "(" . $_object_Object . ")[" . $this->numbers[8] . "]"; $_Infinity = "+(" . $this->numbers[1] . "+" . $this->characters["e"] . "+" . $this->characters[1] . "+" . $this->characters[0] . "+" . $this->characters[0] . "+" . $this->characters[0] . ")+[]"; $this->characters["y"] = "(" . $_Infinity . ")[" . $this->numbers[7] . "]"; $this->characters["I"] = "(" . $_Infinity . ")[" . $this->numbers[0] . "]"; $_1e100 = "+(" . $this->numbers[1] . "+" . $this->characters["e"] . "+" . $this->characters[1] . "+" . $this->characters[0] . "+" . $this->characters[0] . ")+[]"; $this->characters["+"] = "(" . $_1e100 . ")[" . $this->numbers[2] . "]"; $this->functionConstructor = "[][" . $this->hieroglyphyString("sort") . "][" . $this->hieroglyphyString("constructor") . "]"; //Below $this->characters need target http(s) pages $locationString = "[]+" . $this->hieroglyphyScript("return location"); $this->characters["h"] = "(" . $locationString . ")" . "[" . $this->numbers[0] . "]"; $this->characters["p"] = "(" . $locationString . ")" . "[" . $this->numbers[3] . "]"; $this->characters["/"] = "(" . $locationString . ")" . "[" . $this->numbers[6] . "]"; $this->unescape = $this->hieroglyphyScript("return unescape"); $escape = $this->hieroglyphyScript("return escape"); $this->characters["%"] = $escape . "(" . $this->hieroglyphyString("[") . ")[" . $this->numbers[0] . "]"; } private function getHexaString ($number, $digits) { $string = bin2hex($number); while (strlen($string) < $digits) { $string = "0" . $string; } return $string; } private function getUnescapeSequence ($charCode) { return $this->unescape . "(" . $this->hieroglyphyString("%" . $this->getHexaString($charCode, 2)) . ")"; } private function getHexaSequence ($charCode) { return $this->hieroglyphyString("\\x" . $this->getHexaString($charCode, 2)); } private function getUnicodeSequence ($charCode) { return $this->hieroglyphyString("\\u" . $this->getHexaString($charCode, 4)); } private function hieroglyphyCharacter ($char) { $charCode = ord($char); if (isset($this->characters[$char])) { return $this->characters[$char]; } if (($char == "\\") || ($char == "x")) { //These chars must be handled appart becuase the others need them $this->characters[$char] = $this->getUnescapeSequence($charCode); return $this->characters[$char]; } $shortestSequence = $this->getUnicodeSequence($charCode); //ASCII $characters can be obtained with hexa and unscape sequences if ($charCode < 128) { $unescapeSequence = $this->getUnescapeSequence($charCode); if (strlen($shortestSequence) > strlen($unescapeSequence)) { $shortestSequence = $unescapeSequence; } $hexaSequence = $this->getHexaSequence($charCode); if (strlen($shortestSequence) > strlen($hexaSequence)) { $shortestSequence = $hexaSequence; } } $this->characters[$char] = $shortestSequence; return $shortestSequence; } public function hieroglyphyString ($str) { $hieroglyphiedStr = ""; for ($i = 0; $i < strlen($str); $i++) { $hieroglyphiedStr .= ($i > 0) ? "+" : ""; $hieroglyphiedStr .= $this->hieroglyphyCharacter($str[$i]); } return $hieroglyphiedStr; } public function hieroglyphyNumber ($n) { $n = +$n; if ($n <= 9) { return $this->numbers[$n]; } return "+(" . $this->hieroglyphyString(ord($n[10])) . ")"; } public function hieroglyphyScript ($src) { return $this->functionConstructor . "(" . $this->hieroglyphyString($src) . ")()"; } }
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/includes/Scheduler.php
includes/Scheduler.php
<?php /* * @Author: yihua * @Date: 2025-01-04 17:32:11 * @LastEditTime: 2025-01-05 13:47:54 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\includes\Scheduler.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ /** * Class Scheduler */ Class Scheduler { /** * @var SplQueue */ protected $taskQueue; /** * @var int */ protected $tid = 0; /** * Scheduler constructor. */ public function __construct() { /* 原理就是维护了一个队列, * 前面说过,从编程角度上看,协程的思想本质上就是控制流的主动让出(yield)和恢复(resume)机制 * */ $this->taskQueue = new SplQueue(); } /** * 增加一个任务 * * @param Generator $task * @return int */ public function addTask(Generator $task) { $tid = $this->tid; $task = new Task($tid, $task); $this->taskQueue->enqueue($task); $this->tid++; return $tid; } /** * 把任务进入队列 * * @param Task $task */ public function schedule(Task $task) { $this->taskQueue->enqueue($task); } /** * 运行调度器 */ public function run() { $data=null; while (!$this->taskQueue->isEmpty()) { // 任务出队 $task = $this->taskQueue->dequeue(); $res = $task->run(); // 运行任务直到 yield // $task->run(); if (!$task->isFinished()) { $data=$res; $this->schedule($task); // 任务如果还没完全执行完毕,入队等下次执行 } // var_dump($res); } // var_dump($data); return $data; } } ?>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/includes/Task.php
includes/Task.php
<?php /* * @Author: yihua * @Date: 2025-01-04 17:32:11 * @LastEditTime: 2025-01-05 13:47:40 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\includes\Task.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ /** * Task任务类 */ class Task { protected $taskId; protected $coroutine; protected $beforeFirstYield = true; protected $sendValue; /** * Task constructor. * @param $taskId * @param Generator $coroutine */ public function __construct($taskId, Generator $coroutine) { $this->taskId = $taskId; $this->coroutine = $coroutine; } /** * 获取当前的Task的ID * * @return mixed */ public function getTaskId() { return $this->taskId; } /** * 判断Task执行完毕了没有 * * @return bool */ public function isFinished() { return !$this->coroutine->valid(); } /** * 设置下次要传给协程的值,比如 $id = (yield $xxxx),这个值就给了$id了 * * @param $value */ public function setSendValue($value) { $this->sendValue = $value; } /** * 获取执行的结果 */ public function getresult() { while ($this->coroutine->valid()) { var_dump($this->coroutine->current()); $this->coroutine->next(); } } /** * 运行任务 * * @return mixed */ public function run() { // while ($this->coroutine->valid()) { // print_r($this->coroutine->current()); // $this->coroutine->next(); // } // 这里要注意,生成器的开始会reset,所以第一个值要用current获取 if ($this->beforeFirstYield) { $this->beforeFirstYield = false; //var_dump($this->coroutine->current()); //print_r($this->coroutine->current()); return $this->coroutine->current(); } else { // 我们说过了,用send去调用一个生成器 $retval = $this->coroutine->send($this->sendValue); $this->sendValue = null; return $retval; } } }
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/includes/360safe/webscan_cache.php
includes/360safe/webscan_cache.php
<?php /* * @Author: yihua * @Date: 2025-01-04 12:25:10 * @LastEditTime: 2025-01-05 21:31:47 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\includes\360safe\webscan_cache.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ // 基础配置 $webscan_switch = 1; // 总开关,控制整个扫描功能的启用或禁用 // 检测方法配置 $webscan_post = 1; // 启用POST请求检测 $webscan_get = 1; // 启用GET请求检测 $webscan_cookie = 1; // 启用Cookie检测 $webscan_referre = 1; // 启用Referer检测 $webscan_headers = 1; // 启用请求头检测 // 安全配置 $security_config = [ 'max_post_size' => 1024 * 1024 * 15, // 15MB,限制POST请求的最大大小 'max_request_length' => 8000, // 最大请求长度 'enable_logging' => true, // 启用日志记录 'log_path' => 'logs/security/', // 修改为相对路径,相对于网站根目录 ]; // 白名单配置 $webscan_white_directory = 'sub_admin|api/internal'; // 允许访问的目录 // URL白名单配置 - 支持正则表达式 $webscan_white_url = array( // 管理后台 'admin' => array( 'pattern' => '/^\/admin\/[\w-]+\/?$/i', // 匹配管理后台URL 'methods' => ['GET', 'POST'] // 允许的HTTP方法 ), // API endpoints 'api' => array( 'pattern' => '/^\/api\/v[0-9]+\//i', // 匹配API端点 'methods' => ['GET', 'POST', 'PUT', 'DELETE'] // 允许的HTTP方法 ) ); // 现代攻击特征库 $modern_attack_patterns = array( 'sql_injection' => array( // 常见SQL注入模式 'SLEEP\s*?\(.*?\)', 'BENCHMARK\s*?\(.*?\)', 'WAIT\s*?FOR\s*?DELAY', '\{\$where\s*:', '\{\$regex\s*:', ';\s*?(SELECT|INSERT|UPDATE|DELETE|DROP|CREATE|ALTER)', 'UNION\s+ALL\s+SELECT', '%bf%27', '%df%27', 'introspection\s*?\{', '__schema\s*?\{', 'OR\s+1=1', 'UNION\s+SELECT', '--', // 新增SQL注入特征 'HAVING\s+\d+=\d+', 'ORDER\s+BY\s+\d+', 'LOAD_FILE\s*\(', 'INTO\s+OUTFILE', 'INTO\s+DUMPFILE', 'CHAR\(.+?\)', 'CONCAT\(.+?\)', 'INFORMATION_SCHEMA', '@@version', 'xp_cmdshell', 'sysobjects', ), 'xss' => array( // 常见XSS攻击模式 'javascript:.*?\\(.*?\\)', 'data:text/html', 'vbscript:', '(?:<|%3C)script.*?(?:>|%3E)', '(?:<|%3C).*?on\w+\s*=', 'base64.*?,.*?\\(', 'addEventListener\s*\\(', 'attachEvent\s*\\(', '\{\{.*?\}\}', '\${.*?}', 'ng-\w+=".*?"', 'v-\w+=".*?"', 'react-\w+=".*?"', '<img\s+src=.*?onerror=', '<iframe', // 新增XSS攻击特征 '(location.href|window.location|document.cookie)', '<svg.*?on.*?=', '</textarea>.*?<script>', '"><script>alert\(.*?\)</script>', 'document\.write\(', '<iframe.*?src=.*?>', 'data:text/html;base64,.*?', '&#x[0-9A-F]+;', '<audio.*?on.*?=', '<video.*?on.*?=', '<svg.*?on\w+=', ), 'file_inclusion' => array( // 文件包含攻击模式 '(?:\.\.|%2f)(?:\.|%2e)', 'php://filter', 'zip://', 'phar://', 'file://', 'php://input', // 新增文件包含特征 'data://', 'ftp://', 'gopher://', 'rar://', 'compress.zlib://', 'compress.bzip2://', 'expect://', 'glob://', 'php://output', 'php://temp', ), 'command_injection' => array( // 命令注入攻击模式 '(?:\|\s*(?:wget|curl|bash|cmd|powershell))', '(?:;|\{\}\s*)\s*(?:wget|curl|bash|cmd|powershell)', 'system\s*\(.+\)', 'exec\s*\(.+\)', 'shell_exec\s*\(.+\)', '&&\s*(?:wget|curl|bash|cmd|powershell)', // 新增命令注入特征 'passthru\s*\(.+\)', 'proc_open\s*\(.+\)', 'popen\s*\(.+\)', '\`[^`]+\`', // 反引号命令执行(要求至少一个字符) '\$\([^)]+\)', // $(command)格式(要求至少一个字符) '\s+2>&1\s*', // I/O重定向(要求前后有空白或位于末尾) ';\s*(ls|cat|whoami|id|ps|netstat|pwd)\b', // 分号后直接跟命令(更精确) '(?:^|[;&|])\s*(ls|cat|whoami|id|ps|netstat)\s', // 命令开头或管道/分号后跟命令 '(?:\\\\x[a-fA-F0-9]{2}){3,}', // 十六进制命令变种:至少3组\xNN(如\x73\x79\x73) '\|\s*python\b', '\|\s*perl\b', '\|\s*php\b', ), // 'ssrf' 规则已禁用 - 用户可能合法输入内网地址(如配置服务器地址) // SSRF 防护应在实际发起 HTTP 请求的代码中检查目标地址 // 如需启用,请取消下方注释 /* 'ssrf' => array( // SSRF攻击模式 - 需要在 URL 上下文中匹配,避免误报 // 匹配 URL 协议后的内网地址(如 http://localhost, file://127.0.0.1) '(?:https?|ftp|file|gopher|dict)://localhost(?:[:/]|$)', '(?:https?|ftp|file|gopher|dict)://127\.0\.0\.1(?:[:/]|$)', '(?:https?|ftp|file|gopher|dict)://0\.0\.0\.0(?:[:/]|$)', '(?:https?|ftp|file|gopher|dict)://\[?::1\]?(?:[:/]|$)', // AWS/云服务元数据端点 '(?:https?|ftp|file)://169\.254\.\d{1,3}\.\d{1,3}(?:[:/]|$)', // 内网 IP 段(完整 IP 格式,在 URL 上下文中) '(?:https?|ftp|file)://192\.168\.\d{1,3}\.\d{1,3}(?:[:/]|$)', '(?:https?|ftp|file)://10\.\d{1,3}\.\d{1,3}\.\d{1,3}(?:[:/]|$)', '(?:https?|ftp|file)://172\.(1[6-9]|2[0-9]|3[0-1])\.\d{1,3}\.\d{1,3}(?:[:/]|$)', // @ 符号绕过检测(如 http://evil.com@127.0.0.1) '@(?:localhost|127\.0\.0\.1|192\.168\.\d+\.\d+|10\.\d+\.\d+\.\d+)(?:[:/]|$)', ), */ 'serialization' => array( // 反序列化攻击模式 'O:[0-9]+:"', // PHP序列化格式 'C:[0-9]+:"', // PHP序列化特征 '__wakeup', '__destruct', '__toString', 'unserialize\s*\(', 'yaml_parse\s*\(', ), // 'upload' 规则已禁用 - 在 GET/POST 参数中检测文件扩展名误报率高 // 文件上传安全应在实际上传处理代码中检查(验证扩展名、MIME、文件内容) // 如需启用,请取消下方注释 /* 'upload' => array( // 文件上传攻击模式 '\.php\d?$', '\.phtml$', '\.php\.jpg$', '\.php\.png$', '\.php%00\.jpg$', 'application/x-httpd-php', 'text/php', 'application/php', ) */ ); // 请求频率限制 $rate_limit = array( 'enabled' => true, // 启用请求频率限制 'window' => 60, // 时间窗口(秒) 'max_requests' => 900, // 最大请求数 'block_time' => 600 // 阻止时间(秒) ); // 响应头安全配置(已放宽限制) $security_headers = array( // 'X-Frame-Options' => 'SAMEORIGIN', // 已禁用,允许 iframe 嵌入 'X-Content-Type-Options' => 'nosniff', // 防止MIME类型混淆攻击 // 'X-XSS-Protection' => '1; mode=block', // 已禁用,现代浏览器已弃用此头 // 'Content-Security-Policy' 已禁用,避免限制过严 'Referrer-Policy' => 'no-referrer-when-downgrade', // 放宽引用策略 ); // 设置安全响应头 foreach ($security_headers as $header => $value) { $value = trim($value); // 确保头信息值中没有换行符,防止HTTP响应拆分攻击 if (strpos($value, "\n") === false && strpos($value, "\r") === false) { header("$header: $value"); } else { error_log('Invalid header value detected: ' . $value); } } ?>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/includes/360safe/xss.php
includes/360safe/xss.php
<?php /* * @Author: yihua * @Date: 2025-01-04 17:32:11 * @LastEditTime: 2025-01-11 13:34:11 * @LastEditors: yihua * @Description: * @FilePath: \undefinedc:\Users\liuqiang\Desktop\ccp\ccproxy_kami\includes\360safe\xss.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ /** * 通用防护升级版示例 (PHP 7.4+),修正 Unknown modifier 错误 * * 主要修正点: * 1. 在正则匹配时,使用 "~" 作为分隔符,避免与模式内部 "/" 冲突。 * 2. 针对模式内部可能的 "~" 字符先行转义,保证正则正常执行。 */ declare(strict_types=1); /************************************** * 1. 函数定义(必须在调用之前) **************************************/ /** * 检查当前请求是否在定义的白名单数组里 * 命中则返回 true */ function isWhitelistedRequest(array $paths): bool { $requestUri = $_SERVER['REQUEST_URI'] ?? ''; foreach ($paths as $path) { // 使用 strpos() 判断是否以白名单路径开头 if (strpos($requestUri, $path) === 0) { return true; } } return false; } /** * 递归检测数组或单值 */ function checkRequestData($data, array $patterns): void { if (is_array($data)) { foreach ($data as $key => $value) { // 检查 Key if (!is_array($key)) { checkString((string)$key, $patterns); } else { checkRequestData($key, $patterns); } // 检查 Value if (!is_array($value)) { checkString((string)$value, $patterns); } else { checkRequestData($value, $patterns); } } } else { checkString((string)$data, $patterns); } } /** * 核心检测逻辑:对字符串进行正则匹配 * 使用 '~' 作为分隔符,避免与模式内 '/' 冲突 */ function checkString(string $str, array $patterns): void { // 空或过短字符串可跳过 if (trim($str) === '' || mb_strlen($str) < 2) { return; } // 对原始和 urlencode 后的字符串均进行匹配 $encoded = urlencode($str); foreach ($patterns as $rawPattern) { // 如果模式里有 "~",先转义,防止充当分隔符冲突 $safePattern = str_replace('~', '\~', $rawPattern); // 构造安全的正则表达式:~模式~i $regex = "~{$safePattern}~i"; if (@preg_match($regex, $str) === 1 || @preg_match($regex, $encoded) === 1) { // 可疑请求,记录日志并拦截 logSuspiciousAttempt($str, $rawPattern); denyRequest(); } } } /** * 拦截请求并给出提示 */ function denyRequest(): void { header('HTTP/1.1 403 Forbidden'); header('Content-Type: text/html; charset=utf-8'); echo <<<HTML <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>站点提示信息</title> <style type="text/css"> html { background: #eee; text-align: center; } body { background: #fff; color: #333; font-family: "微软雅黑", sans-serif; margin: 2em auto; padding: 1em 2em; max-width: 700px; box-shadow: 10px 10px 10px rgba(0,0,0,.13); } h3 { text-align: center } </style> </head> <body id="error-page"> <h3>站点提示信息</h3> 请求中包含非法或可疑参数,已被拦截。 </body> </html> HTML; exit; } /** * 记录可疑请求到日志 */ function logSuspiciousAttempt(string $str, string $pattern): void { $logFile = __DIR__ . '/attack_' . date('Ymd') . '.log'; $clientIP = $_SERVER['REMOTE_ADDR'] ?? 'UNKNOWN_IP'; $method = $_SERVER['REQUEST_METHOD'] ?? 'UNKNOWN_METHOD'; $uri = $_SERVER['REQUEST_URI'] ?? 'UNKNOWN_URI'; $time = date('Y-m-d H:i:s'); $logContent = sprintf( "[%s][IP: %s][Method: %s][URI: %s]\nMatched String: %s\nMatched Pattern: %s\n\n", $time, $clientIP, $method, $uri, $str, $pattern ); @file_put_contents($logFile, $logContent, FILE_APPEND | LOCK_EX); } /************************************** * 2. 白名单检查 **************************************/ $whitelistedPaths = ['/sub_admin', '/api/cpproxy.php', '/']; // 判断当前请求是否命中白名单 if (isWhitelistedRequest($whitelistedPaths)) { return; } // 白名单中的合法 IP 列表 $allowed_ips = ["192.168.1.6", "127.0.0.1"]; $client_ip = $_SERVER['REMOTE_ADDR'] ?? ''; if (in_array($client_ip, $allowed_ips)) { return; } /************************************** * 3. 定义特征库 **************************************/ /** * XSS 相关特征 */ $xssPatterns = [ "[\"'`;\\*<>].*\\bon[a-zA-Z]{3,15}\\s*=.*", "<(?:script|iframe|body|img|svg|video|audio|embed|object|applet|link|style|meta|base|form|marquee|input).*?>", "(?:javascript|data|vbscript|mocha|livescript|blob):", "expression\\s*\\(|eval\\s*\\(", "url\\s*\\((?:['\"])*(?:\\#|data:|javascript:|vbscript:)", "(?:document\\.(?:cookie|write|location)|window\\.(?:location|open|alert|eval))", "\\{\\{.*?\\}\\}", ]; /** * SQL注入攻击特征模式 */ $sqlInjectionPatterns = [ "(?i)(select|update|insert|delete|union|drop|create|alter|truncate|exec|declare|rename)", "(?i)(sleep\\s*\\([\\s\\d]+\$|benchmark\\s*\\(|pg_sleep|waitfor\\s+delay|delay\\s+'\\d+)", "(?i)(outfile|dumpfile|load_file|information_schema\\.(?:tables|columns)|sys\\.(?:user_tables|tab)|all_tables)", "(?i)(master\\.\\.|msysaccessobjects|msysqueries|sysobjects|syscolumns|sysusers|xp_cmdshell)", "\\$(?:gt|lt|ne|eq|regex|where)|\\{\\s*\\$(?:where|gt|lt|ne|eq)", "(?i)(case\\s+when|if\\s*\\(|substr\\s*\\(|mid\\s*\\(|length\\s*\\()", ]; /** * 命令注入特征 */ $cmdInjectionPatterns = [ "(?i)(\\b(?:rm|cat|wget|curl|nc|netcat|bash|sh|python|perl|ruby|lua)\\b)", "(?:system|exec|passthru|shell_exec|popen|proc_open|pcntl_exec)\\s*\\(", "(?i)(powershell|iex|invoke-expression|encodedcommand)", "\\$(?:ENV|_ENV|_SERVER|GLOBALS)\\[", "(?:>|<)\\s*/dev/(?:tcp|udp)/[\\d.]+/\\d+", ]; /** * 文件上传特征 */ $fileUploadPatterns = [ "(?i)\\.(jpg|gif|png)\\.(php|asp|jsp)$", "^(?:4D5A|7F454C46|CAFEBABE|FFD8FFE0)", ]; /** * SSRF攻击特征(在 URL 上下文中匹配) */ $ssrfPatterns = [ "(?:gopher|dict|ldap|tftp)://", ]; /** * 路径穿越检测 */ $dirTraversalPatterns = [ '#(?<![a-zA-Z0-9_])\\.\\./.*#', '#(?<![a-zA-Z0-9_])(?:%2e%2e|%2e%2e%2f|%252e%252e%252f)#i', '#(%00|\\0|\\u0000|\\x00)#', ]; // 检查 URI 中的路径穿越 $uri = $_SERVER['REQUEST_URI'] ?? ''; foreach ($dirTraversalPatterns as $pattern) { if (@preg_match($pattern, $uri) === 1) { logSuspiciousAttempt($uri, $pattern); denyRequest(); } } /** * 合并所有特征 */ $globalPatterns = array_merge( $xssPatterns, $sqlInjectionPatterns, $cmdInjectionPatterns, $ssrfPatterns, $fileUploadPatterns ); /************************************** * 4. 执行检测 **************************************/ $checkParams = [ 'GET' => $_GET, 'POST' => $_POST, 'COOKIE' => $_COOKIE, ]; $referer = $_SERVER['HTTP_REFERER'] ?? ''; $queryString = $_SERVER['QUERY_STRING'] ?? ''; // 统一检测 checkRequestData([$referer, $queryString], $globalPatterns); foreach ($checkParams as $type => $data) { checkRequestData($data, $globalPatterns); }
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/includes/360safe/360webscan.php
includes/360safe/360webscan.php
<?php /* * @Author: yihua * @Date: 2025-01-04 12:25:10 * @LastEditTime: 2025-01-04 20:41:23 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\includes\360safe\360webscan.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ webscan_error(); require_once('webscan_cache.php'); // 初始化安全日志目录 if ($security_config['enable_logging'] && !is_dir($security_config['log_path'])) { mkdir($security_config['log_path'], 0755, true); } /** * 关闭用户错误提示 */ function webscan_error() { if (ini_get('display_errors')) { ini_set('display_errors', '0'); } } /** * 改进的攻击检查拦截函数 */ function webscan_StopAttack($key, $value, $attack_type, $method) { global $modern_attack_patterns, $rate_limit, $security_config; // 参数验证 if (!is_string($key) && !is_numeric($key)) { return false; } // 安全转换 $key = (string)$key; $value = is_array($value) ? webscan_arr_foreach($value) : (string)$value; try { // 请求频率限制检查 if ($rate_limit['enabled'] && !check_rate_limit()) { webscan_slog([ 'ip' => filter_var($_SERVER["REMOTE_ADDR"], FILTER_VALIDATE_IP), 'type' => 'rate_limit', 'time' => date('Y-m-d H:i:s') ]); exit(webscan_pape('请求过于频繁,请稍后再试')); } // 请求大小检查 if ( isset($_SERVER['CONTENT_LENGTH']) && is_numeric($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] > $security_config['max_post_size'] ) { exit(webscan_pape('请求数据过大')); } // 检查现代攻击特征 foreach ($modern_attack_patterns as $pattern_type => $patterns) { foreach ($patterns as $pattern) { // 转义模式中的 ~ 字符,使用 ~ 作为分隔符避免与模式中的 / 冲突 $safePattern = str_replace('~', '\~', $pattern); // 确保正则表达式有效 if (@preg_match("~{$safePattern}~is", '') === false) { error_log("Invalid regex pattern: $pattern"); continue; } if (@preg_match("~{$safePattern}~is", $value) || @preg_match("~{$safePattern}~is", $key)) { $attack_info = [ 'ip' => filter_var($_SERVER["REMOTE_ADDR"], FILTER_VALIDATE_IP), 'time' => date('Y-m-d H:i:s'), 'page' => filter_var($_SERVER["PHP_SELF"], FILTER_SANITIZE_URL), 'method' => $method, 'type' => $pattern_type, 'key' => substr($key, 0, 100), // 限制长度 'value' => substr($value, 0, 500), // 限制长度 'user_agent' => isset($_SERVER['HTTP_USER_AGENT']) ? substr($_SERVER['HTTP_USER_AGENT'], 0, 200) : '', 'url' => isset($_SERVER["REQUEST_URI"]) ? filter_var($_SERVER["REQUEST_URI"], FILTER_SANITIZE_URL) : '' ]; webscan_slog($attack_info); exit(webscan_pape("检测到潜在的{$pattern_type}攻击")); } } } } catch (Exception $e) { error_log("WebScan Error: " . $e->getMessage()); return false; } } /** * 改进的日志记录函数 */ function webscan_slog($log_info) { global $security_config; if (!$security_config['enable_logging']) { return true; } try { // 验证日志目录 $log_dir = rtrim($security_config['log_path'], '/'); if (!is_dir($log_dir)) { if (!mkdir($log_dir, 0755, true)) { error_log("Failed to create log directory: $log_dir"); return false; } } // 验证日志目录可写 if (!is_writable($log_dir)) { error_log("Log directory not writable: $log_dir"); return false; } $log_file = $log_dir . '/' . date('Y-m-d') . '_security.log'; // 清理和验证日志数据 $log_info = array_map(function ($item) { return is_string($item) ? strip_tags($item) : $item; }, $log_info); $log_data = date('Y-m-d H:i:s') . ' | ' . json_encode($log_info, JSON_UNESCAPED_UNICODE | JSON_PARTIAL_OUTPUT_ON_ERROR) . "\n"; return file_put_contents($log_file, $log_data, FILE_APPEND | LOCK_EX); } catch (Exception $e) { error_log("Log writing error: " . $e->getMessage()); return false; } } /** * 请求频率限制检查 */ function check_rate_limit() { global $rate_limit; try { $ip = filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP); if (!$ip) { error_log("Invalid IP address detected"); return false; } $cache_key = "rate_limit:" . md5($ip); $temp_dir = sys_get_temp_dir(); // 验证临时目录 if (!is_writable($temp_dir)) { error_log("Temp directory not writable: $temp_dir"); return true; // 如果无法写入,默认允许请求 } $cache_file = $temp_dir . '/' . $cache_key; if (file_exists($cache_file)) { $data = @unserialize(file_get_contents($cache_file)); if ($data === false || !is_array($data)) { unlink($cache_file); // 删除损坏的缓存文件 $data = ['count' => 1, 'start' => time()]; } else { if (time() - $data['start'] <= $rate_limit['window']) { if ($data['count'] >= $rate_limit['max_requests']) { return false; } $data['count']++; } else { $data = ['count' => 1, 'start' => time()]; } } } else { $data = ['count' => 1, 'start' => time()]; } file_put_contents($cache_file, serialize($data), LOCK_EX); return true; } catch (Exception $e) { error_log("Rate limit error: " . $e->getMessage()); return true; // 出错时默认允许请求 } } /** * 改进的防护提示页面 */ function webscan_pape($message = '检测到潜在的安全威胁') { $log_data = [ 'IP' => $_SERVER["REMOTE_ADDR"], '时间' => date('Y-m-d H:i:s'), '页面' => $_SERVER["PHP_SELF"], '方法' => $_SERVER["REQUEST_METHOD"], '数据' => $_REQUEST ]; // 记录攻击日志 file_put_contents( "security_log.txt", json_encode($log_data, JSON_UNESCAPED_UNICODE) . "\n", FILE_APPEND ); header('Content-Type: text/html; charset=utf-8'); return <<<HTML <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>站点提示信息</title> <style type="text/css"> html { background: #eee; text-align: center; } body { background: #fff; color: #333; font-family: "微软雅黑", "Microsoft YaHei", sans-serif; margin: 2em auto; padding: 1em 2em; max-width: 700px; -webkit-box-shadow: 10px 10px 10px rgba(0, 0, 0, .13); box-shadow: 10px 10px 10px rgba(0, 0, 0, .13); opacity: .8 } h1 { border-bottom: 1px solid #dadada; clear: both; color: #666; font: 24px "微软雅黑", "Microsoft YaHei", , sans-serif; margin: 30px 0 0 0; padding: 0; padding-bottom: 7px } #error-page { margin-top: 50px } h3 { text-align: center } #error-page p { font-size: 9px; line-height: 1.5; margin: 25px 0 20px } #error-page code { font-family: Consolas, Monaco, monospace } ul li { margin-bottom: 10px; font-size: 9px } a { color: #21759B; text-decoration: none; margin-top: -10px } a:hover { color: #D54E21 } .button { background: #f7f7f7; border: 1px solid #ccc; color: #555; display: inline-block; text-decoration: none; font-size: 9px; line-height: 26px; height: 28px; margin: 0; padding: 0 10px 1px; cursor: pointer; -webkit-border-radius: 3px; -webkit-appearance: none; border-radius: 3px; white-space: nowrap; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; -webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(0, 0, 0, .08); box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(0, 0, 0, .08); vertical-align: top } .button.button-large { height: 29px; line-height: 28px; padding: 0 12px } .button:focus, .button:hover { background: #fafafa; border-color: #999; color: #222 } .button:focus { -webkit-box-shadow: 1px 1px 1px rgba(0, 0, 0, .2); box-shadow: 1px 1px 1px rgba(0, 0, 0, .2) } .button:active { background: #eee; border-color: #999; color: #333; -webkit-box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, .5); box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, .5) } table { table-layout: auto; border: 1px solid #333; empty-cells: show; border-collapse: collapse } th { padding: 4px; border: 1px solid #333; overflow: hidden; color: #333; background: #eee } td { padding: 4px; border: 1px solid #333; overflow: hidden; color: #333 } </style> </head> <body id="error-page"> <h3>站点提示信息</h3> {$message} </body> </html> HTML; } /** * 参数拆分 */ function webscan_arr_foreach($arr) { static $str; static $keystr; if (!is_array($arr)) { return $arr; } foreach ($arr as $key => $val) { $keystr = $keystr . $key; if (is_array($val)) { webscan_arr_foreach($val); } else { $str[] = $val . $keystr; } } return implode($str); } /** * 拦截目录白名单 * * @param string $webscan_white_name 白名单名称 * @param array $webscan_white_url 白名单的 URL 数组,格式 ['路径关键字' => '查询参数关键字'] * * @return bool true 表示通过,false 表示拦截 */ function webscan_white($webscan_white_name, $webscan_white_url = array()) { // 获取当前脚本路径和查询参数 $url_path = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : ''; $url_var = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''; // 判断白名单名称是否匹配路径 if (!empty($webscan_white_name) && preg_match('/' . preg_quote($webscan_white_name, '/') . '/is', $url_path)) { return false; // 如果白名单名称匹配,直接放行 } // 遍历白名单的 URL 条件 foreach ($webscan_white_url as $key => $value) { // 确保键和值为有效的字符串或整数类型 if ((is_string($key) || is_int($key)) && (is_string($value) || is_int($value))) { // 查询参数不为空的情况 if (!empty($url_var) && !empty($value)) { // 转换查询参数为字符串(防止非字符串类型引发错误) if (!is_string($url_var)) { $url_var = strval($url_var); } // 如果路径和查询参数分别匹配对应的白名单条件 if (stristr($url_path, $key) && stristr($url_var, $value)) { return false; // 满足条件放行 } } // 查询参数为空的情况 elseif (empty($url_var) && empty($value)) { if (stristr($url_path, $key)) { return false; // 仅匹配路径关键字时放行 } } } } // 如果未匹配任何白名单条件 return true; } // 主要检测逻辑 if ($webscan_switch && webscan_white($webscan_white_directory, $webscan_white_url)) { try { // GET参数检查 if ($webscan_get && !empty($_GET)) { foreach ($_GET as $key => $value) { webscan_StopAttack($key, $value, 'get', "GET"); } } // POST参数检查 if ($webscan_post && !empty($_POST)) { foreach ($_POST as $key => $value) { webscan_StopAttack($key, $value, 'post', "POST"); } } // Cookie检查 if ($webscan_cookie && !empty($_COOKIE)) { foreach ($_COOKIE as $key => $value) { webscan_StopAttack($key, $value, 'cookie', "COOKIE"); } } // HTTP头检查 if ($webscan_headers) { // 白名单:排除浏览器自动生成的标准 HTTP Headers // 这些 headers 是协议规定的格式,用户无法直接注入恶意内容 $skip_headers = [ 'HTTP_COOKIE', // 已在 Cookie 检查中逐个检测 'HTTP_USER_AGENT', // 浏览器标识,包含版本号如 "NT 10.0" 是正常的 'HTTP_ACCEPT', // 浏览器接受的 MIME 类型,包含分号和斜杠是正常的 'HTTP_ACCEPT_LANGUAGE', // 语言偏好 'HTTP_ACCEPT_ENCODING', // 编码偏好(如 gzip, deflate) 'HTTP_CONNECTION', // 连接类型 'HTTP_HOST', // 目标主机 'HTTP_CACHE_CONTROL', // 缓存控制 'HTTP_UPGRADE_INSECURE_REQUESTS', // 升级请求标志 'HTTP_SEC_FETCH_SITE', // Fetch Metadata 'HTTP_SEC_FETCH_MODE', 'HTTP_SEC_FETCH_USER', 'HTTP_SEC_FETCH_DEST', 'HTTP_SEC_CH_UA', // Client Hints 'HTTP_SEC_CH_UA_MOBILE', 'HTTP_SEC_CH_UA_PLATFORM', ]; foreach ($_SERVER as $key => $value) { if (is_string($key) && stripos($key, 'HTTP_') === 0 && !in_array($key, $skip_headers)) { webscan_StopAttack($key, $value, 'header', "HEADER"); } } } // Referer检查 if ($webscan_referre && isset($_SERVER['HTTP_REFERER'])) { webscan_StopAttack('HTTP_REFERER', $_SERVER['HTTP_REFERER'], 'referer', "REFERER"); } } catch (Exception $e) { error_log("WebScan main logic error: " . $e->getMessage()); } } // 设置安全响应头 foreach ($security_headers as $header => $value) { if (is_string($header) && is_string($value)) { // 检查是否为字符串 $headerValue = trim($value); // Remove any leading/trailing whitespace if (strpos($headerValue, "\n") === false && strpos($headerValue, "\r") === false) { header("$header: $headerValue"); } else { error_log('Invalid header value detected: ' . $headerValue); } } else { error_log("Invalid header: $header or value: $value"); } }
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/api/api.php
api/api.php
<?php /* * @Author: yihua * @Date: 2022-06-25 21:02:04 * @LastEditTime: 2025-01-05 16:25:26 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\api\api.php * 一花一叶 一行代码 * Copyright (c) 2022 by yihua 487735913@qq.com, All Rights Reserved. */ include("../includes/common.php"); @header('Content-Type: application/json; charset=UTF-8'); $act=isset($_GET['act'])?daddslashes($_GET['act']):null; switch($act){ case "gethostapp": $application=$DB->selectV2("select appcode,appname from application where username=?",[$subconf["username"]]); if($application){ $code=[ "code"=>"1", "msg"=>$application ]; } else{ $code=[ "code"=>"0", "msg"=>"未知错误" ]; } exit(json_encode($code,JSON_UNESCAPED_UNICODE)); break; default: exit('{"code":-4,"msg":"No Act"}'); break; }
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/api/cpproxy.php
api/cpproxy.php
<?php /* * @Author: yihua * @Date: 2025-01-04 17:32:11 * @LastEditTime: 2025-01-07 11:16:53 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\api\cpproxy.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ include("../includes/common.php"); @header('Content-Type: application/json; charset=UTF-8'); // 初始化缓存 $cache = Cache::getInstance(); // 请求类型处理 if (isset($_REQUEST["type"])) { $type = $_REQUEST["type"]; try { switch ($type) { case "insert": $json = checkinsert($DB); break; case "del": $json = del(); break; case "update": $json = checkupdate($DB); break; case "query": $json = checkquery($DB); break; default: $json = array("code" => "无效事务", "icon" => "5"); } } catch (Exception $e) { error_log("Error in request processing: " . $e->getMessage()); $json = array("code" => "系统错误", "icon" => "5"); } } else { $json = array("code" => "非法参数", "icon" => "5"); } echo json_encode($json, JSON_UNESCAPED_UNICODE); /** * 查询方法 * @param object $DB 数据库对象 * @return array */ function checkquery($DB) { if (!isset($_POST["appcode"], $_POST["user"])) { return array("code" => "非法参数", "icon" => "5"); } try { // 参数过滤 $appcode = htmlspecialchars(trim($_POST["appcode"])); $user = htmlspecialchars(trim($_POST["user"])); // 使用缓存获取应用信息 $cache = Cache::getInstance(); $appCacheKey = 'app_' . $appcode; $ip = $cache->get($appCacheKey); if ($ip === null) { $ip = $DB->selectRowV2("SELECT serverip FROM application WHERE appcode = ?", [$appcode]); if ($ip) { $cache->set($appCacheKey, $ip, 3600); } } if (!$ip) { return array(-1, "msg" => "应用不存在"); } // 使用缓存获取服务器信息 $serverCacheKey = 'server_' . $ip['serverip']; $server = $cache->get($serverCacheKey); if ($server === null) { $server = $DB->selectRowV2("select ip,serveruser,password,cport from server_list where ip = ?", [$ip['serverip']]); if ($server) { $cache->set($serverCacheKey, $server, 3600); // 缓存1小时 } } if (!$server) { return array(-1, "msg" => "服务器配置不存在"); } $ser = query($server['password'], $server['cport'], $server['ip']); if (!$ser) { return array( -3, "msg" => '<h5 style="color: red;display: inline;">服务器通信出现问题</h5>' ); } return [ "code" => 1, "msg" => userquer($user, $ser) ]; } catch (Exception $e) { error_log("Query error: " . $e->getMessage()); return array(-3, "msg" => "系统错误"); } } /** * 添加用户 * @param object $DB 数据库对象 * @return array */ function checkinsert($DB) { if (!isset($_POST["user"], $_POST["pwd"], $_POST["code"])) { return array("code" => "非法参数", "icon" => "5"); } try { // 参数过滤 $user = htmlspecialchars(trim($_POST["user"])); $pwd = htmlspecialchars(trim($_POST["pwd"])); $code = htmlspecialchars(trim($_POST["code"])); // 验证卡密 $kami = $DB->selectRowV2("select count(*) as num,app,times,state,ext from kami where kami = ? GROUP BY app,times,state,ext", [$code]); if (!$kami || $kami['num'] <= 0) { return array("code" => -2, "msg" => "卡密不存在"); } if ($kami['state'] != 0) { return array("code" => -1, "msg" => "卡密已被使用"); } // 获取服务器信息 $ip = $DB->selectRowV2("select serverip from application where appcode = ?", [$kami['app']]); if (!$ip) { return array("code" => -1, "msg" => "应用不存在"); } $server = $DB->selectRowV2("select ip,serveruser,password,cport from server_list where ip = ?", [$ip['serverip']]); //$ip['serverip']服务器IP if (!$server) { return array("code" => -1, "msg" => "服务器配置不存在"); } $cache = Cache::getInstance(); $cache->clear(); // 检查用户是否存在 $existingUsers = query($server['password'], $server['cport'], $server['ip']); if (!$existingUsers) { return array("code" => -3, "msg" => '<h5 style="color: red;display: inline;">服务器通信出现问题</h5>'); } if (!existsuser($user, $existingUsers)) { return array("code" => -1, "msg" => "账号已经存在"); } // 添加用户 $msg = insert( $server['ip'], $server['serveruser'], $server['password'], $server['cport'], $kami['times'], $user, $pwd, $kami['ext'] ); $cache = Cache::getInstance(); $cache->clear(); if ($msg["icon"] == 1) { $currentDate = date("Y-m-d H:i:s"); $endDate = calculate_expiry_date($currentDate, $kami['times']); // 更新卡密状态 $updateData = [ 'state' => 1, 'username' => $user, 'use_date' => $currentDate, 'end_date' => $endDate ]; $DB->updateV2('kami', $updateData, "kami = ?", [$code]); return array("code" => 1, "msg" => $msg["code"]); } return $msg ?: array("code" => -3, "msg" => '<h5 style="color: red;display: inline;">服务器通信出现问题</h5>'); } catch (Exception $e) { error_log("Insert error: " . $e->getMessage()); return array("code" => -3, "msg" => "系统错误"); } } /** * 续费方法 * @param object $DB 数据库对象 * @return array */ function checkupdate($DB) { if (!isset($_POST["user"], $_POST["code"])) { return array("code" => "非法参数", "icon" => "5"); } try { // 参数过滤 $user = htmlspecialchars(trim($_POST["user"])); $code = htmlspecialchars(trim($_POST["code"])); // 验证卡密 $kami = $DB->selectRowV2("select count(*) as num,app,times,state,ext from kami where kami = ? GROUP BY app,times,state,ext", [$code]); if (!$kami || $kami['num'] <= 0) { return array("code" => -2, "msg" => "卡密不存在"); } if ($kami['state'] != 0) { return array("code" => -1, "msg" => "卡密已被使用"); } // 获取服务器信息 $ip = $DB->selectRowV2("select serverip from application where appcode = ?", [$kami['app']]); $server = $DB->selectRowV2("select ip,serveruser,password,cport from server_list where ip = ?", [$ip['serverip']]); //$ip['serverip']服务器IP $cache = Cache::getInstance(); $cache->clear(); // 验证用户存在性 $users = query($server['password'], $server['cport'], $server['ip']); if (!$users) { return array("code" => -3, "msg" => '<h5 style="color: red;display: inline;">服务器通信出现问题</h5>'); } if (existsuser($user, $users)) { return array("code" => -1, "msg" => "充值账号不存在"); } $userInfo = updatequer($user, $users); if (empty($userInfo['disabletime'])) { return array("code" => -3, "msg" => '<h5 style="color: red;display: inline;">账号不存在</h5>'); } // 更新用户 $updateResult = update( $server['ip'], $server['serveruser'], $server['password'], $server['cport'], $kami['times'], $userInfo, $kami['ext'] ); $cache = Cache::getInstance(); $cache->clear(); if ($updateResult["icon"] == 1) { $currentDate = date("Y-m-d H:i:s"); $endDate = calculate_expiry_date( $userInfo['expire'] == 0 ? $userInfo['disabletime'] : $currentDate, $kami['times'] ); // 更新卡密状态 $updateData = array( 'state' => 1, 'username' => $user, 'use_date' => $currentDate, 'end_date' => $endDate ); $DB->updateV2('kami', $updateData, "kami = ?", [$code]); return array("code" => 1, "msg" => $updateResult); } return array("code" => -3, "msg" => "更新失败"); } catch (Exception $e) { error_log("Update error: " . $e->getMessage()); return array("code" => -3, "msg" => "系统错误"); } } /** * 添加具体方法 * @param string $proxyaddress 代理地址 * @param string $admin_username 管理员用户名 * @param string $admin_password 管理员密码 * @param int $admin_port 管理端口 * @param int|float $day 天数 * @param string $user 用户名 * @param string $pwd 密码 * @param string $ext 扩展配置 * @return array */ function insert($proxyaddress, $admin_username, $admin_password, $admin_port, $day, $user, $pwd, $ext) { try { // 输入验证 if (!CheckStrChinese($user) || strlen($user) < 5) { return array("code" => "-1", "msg" => "用户名不合法", "icon" => "5"); } if (!CheckStrPwd($pwd)) { return array("code" => "-1", "msg" => "密码不合法", "icon" => "5"); } // 解析扩展配置 $extData = json_decode($ext, true); if (json_last_error() !== JSON_ERROR_NONE) { return array("code" => "-1", "msg" => "扩展配置格式错误", "icon" => "5"); } $connection = isset($extData["connection"]) ? $extData["connection"] : ''; $bandwidth = $extData["bandwidthup"] . "/" . $extData["bandwidthdown"]; // 计算到期时间 $date = date("Y-m-d H:i:s"); $enddate = calculate_expiry_date($date, $day); $end_date = explode(" ", $enddate); // 连接代理服务器 $fp = fsockopen($proxyaddress, $admin_port, $errno, $errstr, 10); if (!$fp) { throw new Exception("无法连接到CCProxy"); } // 构建请求数据 $url_ = "/account"; $url = build_account_url(array( 'add' => 1, 'autodisable' => 1, 'enable' => 1, 'usepassword' => 1, 'username' => $user, 'password' => $pwd, 'connection' => $connection, 'bandwidth' => $bandwidth, 'disabledate' => $end_date[0], 'disabletime' => $end_date[1], 'userid' => -1 )); // 发送请求 $response = send_proxy_request($fp, $url_, $url, $proxyaddress, $admin_username, $admin_password); fclose($fp); return array("code" => "注册用户成功", "icon" => "1"); } catch (Exception $e) { error_log("Insert error: " . $e->getMessage()); return array("code" => "操作失败", "icon" => "5"); } } /** * 删除方法 * @return array */ function del() { if (!isset($_POST["username"])) { return array("code" => "非法参数", "icon" => "5"); } try { $username = htmlspecialchars(trim($_POST["username"])); if (!CheckStrChinese($username) || strlen($username) < 5) { return array("-1", "msg" => "用户名不合法", "icon" => "5"); } $admin_username = isset($_POST["admin_username"]) ? $_POST["admin_username"] : ""; $admin_password = isset($_POST["admin_password"]) ? $_POST["admin_password"] : ""; $adminport = isset($_POST["admin_port"]) ? $_POST["admin_port"] : ""; $proxyaddress = isset($_POST["proxyaddress"]) ? $_POST["proxyaddress"] : ""; $fp = fsockopen($proxyaddress, $adminport, $errno, $errstr, 10); if (!$fp) { throw new Exception("无法连接到CCProxy"); } $url_ = "/account"; $url = "delete=1&userid=" . urlencode($username); send_proxy_request($fp, $url_, $url, $proxyaddress, $admin_username, $admin_password); fclose($fp); return array("code" => "删除用户成功", "icon" => "1"); } catch (Exception $e) { error_log("Delete error: " . $e->getMessage()); return array("code" => "删除失败", "icon" => "5"); } } /** * 更新方法 */ function update($proxyaddress, $admin_username, $admin_password, $admin_port, $day, $date, $ext) { try { if (!CheckStrChinese($admin_username) || strlen($admin_username) < 5) { return array("-1", "msg" => "用户名不合法", "icon" => "5"); } if (!isset($_POST["user"])) { return array("code" => "编辑数据存在非法参数", "icon" => "5"); } $username = htmlspecialchars(trim($_POST["user"])); // 解析扩展配置 $extData = json_decode($ext, true); if (json_last_error() !== JSON_ERROR_NONE) { return array("-1", "msg" => "扩展配置格式错误", "icon" => "5"); } $connection = isset($extData["connection"]) ? $extData["connection"] : ''; $bandwidth = $extData["bandwidthup"] . "/" . $extData["bandwidthdown"]; // 计算到期时间 $cdate = date("Y-m-d H:i:s"); $enddate = $date['expire'] == 0 ? calculate_expiry_date($date['disabletime'], $day) : calculate_expiry_date($cdate, $day); $end_date = explode(" ", $enddate); // 连接代理服务器 $fp = fsockopen($proxyaddress, $admin_port, $errno, $errstr, 10); if (!$fp) { throw new Exception("无法连接到CCProxy"); } // 构建请求数据 $url_ = "/account"; $url = build_account_url(array( 'edit' => 1, 'autodisable' => 1, 'enable' => 1, 'usepassword' => 1, 'username' => $username, 'connection' => $connection, 'bandwidth' => $bandwidth, 'disabledate' => $end_date[0], 'disabletime' => $end_date[1], 'userid' => $username )); // 发送请求 send_proxy_request($fp, $url_, $url, $proxyaddress, $admin_username, $admin_password); fclose($fp); return array("code" => "更新用户成功", "icon" => "1"); } catch (Exception $e) { error_log("Update error: " . $e->getMessage()); return array("code" => "更新失败", "icon" => "5"); } } /** * 查询代理服务器信息 * @param string $adminpassword 管理员密码 * @param int $adminport 管理端口 * @param string $proxyaddress 代理地址 * @param string $adminusername 管理员用户名 * @return array|false */ function query($adminpassword, $adminport, $proxyaddress, $adminusername = "admin") { try { // 使用缓存 $cache = Cache::getInstance(); $cacheKey = md5($proxyaddress . $adminport . $adminpassword . $adminusername); $cached = $cache->get($cacheKey); if ($cached !== null) { return $cached; } $url = "http://" . $proxyaddress . ":" . $adminport . "/account"; $info = parse_url($url); // 设置连接超时 $fp = fsockopen($proxyaddress, $adminport, $errno, $errstr, 10); if (!$fp) { throw new Exception("Connection failed: $errstr ($errno)"); } $auth = "Authorization: Basic " . base64_encode("$adminusername:" . $adminpassword); $head = "GET " . $info['path'] . " HTTP/1.0\r\n"; $head .= "Host: " . $info['host'] . "\r\n" . $auth . "\r\n\r\n"; fputs($fp, $head); $response = ''; while (!feof($fp)) { $response .= fread($fp, 4096); } fclose($fp); // 解析响应数据 $patterns = array( 'username' => '/<input [^>]*name="username"[^>]*value="([^"]*)"/', 'password' => '/<input [^>]*name="password"[^>]*value="([^"]*)"/', 'enable' => '/<input [^>]*name="enable"[^>]*/', 'usepassword' => '/<input [^>]*name="usepassword"[^>]*/', 'disabledate' => '/<input [^>]*name="disabledate"[^>]*value="([^"]*)"/', 'disabletime' => '/<input [^>]*name="disabletime"[^>]*value="([^"]*)"/', 'autodisable' => '/<input [^>]*name="autodisable"[^>]*/' ); $matches = array(); foreach ($patterns as $key => $pattern) { preg_match_all($pattern, $response, $matches[$key]); } $ccp = array(); $time = date("Y-m-d H:i:s"); foreach ($matches['username'][1] as $key => $use) { $enable = strripos(str_replace(['<', '>', '/'], '', $matches['enable'][0][$key]), 'checked') !== false ? 1 : 0; $usepassword = strripos(str_replace(['<', '>', '/'], '', $matches['usepassword'][0][$key]), 'checked') !== false ? 1 : 0; $autodisable = strripos(str_replace(['<', '>', '/'], '', $matches['autodisable'][0][$key]), 'checked') !== false ? 1 : 0; $disabletime = $matches['disabledate'][1][$key] . " " . $matches['disabletime'][1][$key]; $ccp[$key] = array( "user" => $use, "pwd" => $matches['password'][1][$key], "state" => $enable, "pwdstate" => $usepassword, "disabletime" => $disabletime, "expire" => strtotime($time) > strtotime($disabletime) ? 1 : 0, ); } // 缓存结果 $cache->set($cacheKey, $ccp, 300); // 缓存5分钟 return $ccp; } catch (Exception $e) { error_log("Query error: " . $e->getMessage()); return false; } } /** * 用户查询 * @param string $column 用户名 * @param array $ccp 用户数据 * @return string */ function userquer($column, $ccp) { if (empty($column)) { return "不能为空!"; } $result = array_filter($ccp, function ($where) use ($column) { return $where['user'] === $column; }); if (empty($result)) { return '<h5 style="color: red;display: inline;">账号不存在</h5>'; } $user = reset($result); $disabletime = $user['disabletime']; return $user['expire'] == 1 ? '<h5 style="color: red;display: inline;">到期时间:' . $disabletime . '</h5>' : '<h5 style="color: #1E9FFF;display: inline;">到期时间:' . $disabletime . '</h5>'; } /** * 更新查询 * @param string $column 用户名 * @param array $ccp 用户数据 * @return array */ function updatequer($column, $ccp) { if (empty($column)) { return array("disabletime" => "", "expire" => 0); } $result = array_filter($ccp, function ($where) use ($column) { return $where['user'] === $column; }); if (empty($result)) { return array("disabletime" => "", "expire" => 0); } $user = reset($result); return array( "disabletime" => $user['disabletime'], "expire" => $user['expire'] ); } /** * 构建账户URL参数 * @param array $params 参数数组 * @return string */ function build_account_url($params) { $defaults = array( 'enablesocks' => 1, 'enablewww' => 0, 'enabletelnet' => 0, 'enabledial' => 0, 'enableftp' => 0, 'enableothers' => 0, 'enablemail' => 0, ); $params = array_merge($defaults, $params); return http_build_query($params); } /** * 发送代理请求 * @param resource $fp 文件句柄 * @param string $url_ URL路径 * @param string $url URL参数 * @param string $proxyaddress 代理地址 * @param string $admin_username 管理员用户名 * @param string $admin_password 管理员密码 * @return string */ function send_proxy_request($fp, $url_, $url, $proxyaddress, $admin_username, $admin_password) { $len = "Content-Length: " . strlen($url); $auth = "Authorization: Basic " . base64_encode($admin_username . ":" . $admin_password); $msg = "POST " . $url_ . " HTTP/1.0\r\nHost: " . $proxyaddress . "\r\n" . $auth . "\r\n" . $len . "\r\n\r\n" . $url; fputs($fp, $msg); $response = ''; while (!feof($fp)) { $response .= fgets($fp, 4096); } return $response; } /** * 计算到期时间 * @param string $current_date 当前时间 * @param string $duration 时长(支持格式如:+1 day、+7 day、+1 hour、+1 year、+1 month) * @return string */ function calculate_expiry_date($current_date, $duration) { try { // 初始化当前时间 $date = new DateTime($current_date); // 检查 $duration 是否符合 DateInterval 支持的格式 if (preg_match('/^\+\d+ (day|hour|month|year)$/', $duration)) { // 使用 strtotime 解析 $duration 并更新时间 $date->modify($duration); } else { throw new Exception("Invalid duration format: $duration"); } // 返回计算后的时间 return $date->format('Y-m-d H:i:s'); } catch (Exception $e) { // 捕获异常并记录错误日志 error_log("Date calculation error: " . $e->getMessage()); // 默认返回当前时间加一天 return date('Y-m-d H:i:s', strtotime("+1 day")); } }
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/newapp.php
sub_admin/newapp.php
<?php include("../includes/common.php"); if (!($islogin == 1)) { exit('<script language=\'javascript\'>alert("您还没有登录,请先登录!");window.location.href=\'login.php\';</script>'); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title><?php echo $subconf['hostname']?>应用名</title> <meta name="renderer" content="webkit" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> <?php include("foot.php"); ?> <!-- <link rel="stylesheet" href="../assets/layui/css/layui.css?v=20201111001?v=20201111001" /> <link rel="stylesheet" type="text/css" href="./css/theme.css?v=20201111001" /> --> <style> body { background-color: #FFFFFF; padding-right: 80px; } </style> </head> <body class="layui-form form"> <div class="layui-form-item"> <label class="layui-form-label"> 应用名 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="username" class="layui-input" lay-verify="required" placeholder="应用名"/> </div> <div class="layui-form-item"> <label class="layui-form-label"> 服务器 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <select name="server" lay-verify="required" lay-filter="server"> <option value="">请选择绑定服务器</option> </select> </div> </div> </div> <!-- <div class="layui-form-item"> <label class="layui-form-label"> 密码 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="number" name="password" class="layui-input" lay-verify="required" placeholder="纯数字密码"/> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 到期时间 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="end_date" class="layui-input" lay-verify="required" placeholder="YYYY-mm-dd HH:ii-dd" /> </div> </div> --> <div class="layui-form-item"> <div class="layui-input-block"> <button class="layui-btn layui-btn-normal layui-btn-sm" lay-submit lay-filter="submit">保存数据</button> </div> </div> </body> <!-- <script src="https://www.layuicdn.com/layui/layui.js?v=20201111001"></script> --> <script type="text/javascript" src="../assets/js/xss.js"></script> <script> layui.use(["jquery", "form", "laydate"], function() { var $ = layui.$, form = layui.form, laydate = layui.laydate; $(".layui-input").eq(0).focus(); form.on("submit(submit)", function(data) { console.log(data); $.ajax({ url: "ajax.php?act=newapp", type: "POST", dataType: "json", data: data.field, beforeSend: function() { layer.msg("正在提交", { icon: 16, shade: 0.05, time: false }); }, success: function(data) { if(data.code== "1"){ window.parent.frames.reload('user'); parent.layer.closeAll(); parent.layer.msg(data.msg, { icon: 1 }); } else{ layer.msg(data.msg==null ? "未知错误" : data.msg, { icon: 5 }); } console.log(data); // if (data.icon == "1") { // } else { // layer.msg(data.code, { // icon: data.icon // }); // } }, error: function(data) { console.log(data); layer.msg("保存数据失败", { icon: 5 }); } }); return false; }); // laydate.render({ // elem: "[name=end_date]", // type: "datetime" // }); function select() { $.ajax({ url: "ajax.php?act=getuseserver", type: "POST", dataType: "json", success: function(data) { if (data.code == "1") { var elem = $("[name=server]"); for (var key in data.msg) { // console.log(data.msg[key]); var json = data.msg[key], comment = json.comment, ip = json.ip; item = '<option value="' + ip + '">' + comment + '[' + ip + ']</option>'; elem.append(item); } form.render("select"); } }, error: function(data) { // console.log(data); layer.msg("获取服务器失败", { icon: 5 }); } }); } select(); }); </script> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/app.php
sub_admin/app.php
<?php include("../includes/common.php"); if (!($islogin == 1)) { exit('<script language=\'javascript\'>alert("您还没有登录,请先登录!");window.location.href=\'login.php\';</script>'); } // $sql = "SELECT * FROM `server_list`"; // $ser = $DB->select($sql); // $serverlist = array(); // foreach ($ser as $key => $value) { // //$serverlist[$ser[$key]['ip']]=$ser[$key]['state']; // $serverlist[$key] = array( // 'ip' => $ser[$key]['ip'], // 'state' => $ser[$key]['state'], // ); // } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title><?php echo $subconf['hostname']?>管理用户</title> <meta name="renderer" content="webkit" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> <?php include("foot.php"); ?> </head> <body> <!-- 筛选条件 --> <div class="layui-card"> <div class="layui-card-body layui-form"> <div class="layui-form-item" style="padding-right: 5vw;padding-top: 15px;"> <label class="layui-form-label" title="应用名"> 应用名: </label> <div class="layui-input-inline"> <input type="text" name="appname" class="layui-input" /> </div> <label class="layui-form-label" title="用户名"> 服务器: </label> <div class="layui-input-inline"> <select name="server" lay-verify="required" lay-filter="server"> <option value="*">全部服务器</option> </select> </div> </div> </div> </div> <!-- 表格 --> <div class="layui-card"> <div class="layui-card-body"> <table id="user" lay-filter="user"></table> </div> </div> </body> <script type="text/html" id="userTool"> <div class="layui-btn-container"> <button class="layui-btn layui-btn-normal layui-btn-sm" lay-event="search"><i class="layui-icon layui-icon-search"></i><span>搜索</span></button> <button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="New"><i class="layui-icon layui-icon-add-1"></i><span>新增</span></button> <button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="Del"><i class="layui-icon layui-icon-delete"></i><span>删除</span></button> </div> </script> <!-- 表格按钮 --> <script type="text/html" id="btnTool"> <a style="line-height: 26px;" class="layui-btn layui-btn-sm layui-btn-normal" lay-event="continued">详情</a> <a style="line-height: 26px;" class="layui-btn layui-btn-sm layui-btn-danger" lay-event="del">删除</a> </script> <!-- 表格开关 --> <script type="text/html" id="switchTpl"> <input type="checkbox" name="state" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="state" {{ d.state == "1" ? 'checked' : '' }} /> </script> <!-- 表格链接 --> <script type="text/html" id="urlTpl"> <a href="{{d.url}}" class="layui-table-link" target="_blank">{{ d.url }}</a> </script> <!-- 表格图片 --> <script type="text/html" id="imgTpl"> <a href="{{d.url}}" class="layui-table-link" target="_blank"><img src="{{ d.url }}" /></a> </script> <!-- 服务器 --> <script type="text/html" id="selserverip"> <div class="layui-form"> <div class="layui-input-inline"> <select onchange="selchange(this)" id="selip" style="display: inline-block;" name="serverip" lay-verify="required" lay-filter="serverip"> <option value="{{d.serverip}}">{{d.serverip}}(当前选择)</option> <?php $server_list = $DB->selectV2('select ip,comment,state from server_list where username = ?', [$subconf['username']]); foreach ($server_list as $key => $server) { if ($server_list[$key]['state'] == 1) { echo '<option value="' . $server_list[$key]['ip'] . '">' . $server_list[$key]['ip'] . "(" . $server_list[$key]['comment'] . ")" . '</option>'; } } ?> </select> </div> </div> </script> <script> layui.use(["jquery", "table", "laydate", "form", "element"], function() { var $ = layui.$, table = layui.table, laydate = layui.laydate, form = layui.form, element = layui.element; window.where = function() { var data = ["server", "appname", "password", "token", "found_date", "code", "user_key", "secret", "notify_url", "return_url", "account", "notice_title", "notice_content", "notice_url", "notice_state", "daili_notify_url", "daili_return_url", "register_state", "kami_state", "page" ]; //循环data,赋值控件取值 var json = {}; for (var key in data) { json[data[key]] = query(data[key]); // console.log(json); } return json; } select(); // $("[name=serverip]").append(""); form.render("select"); table.render({ elem: "#user", escape: true, height: "full-170", url: "ajax.php?act=apptable", page: true, limit: 100, limits: [10, 20, 30, 50, 100, 200, 300, 500, 1000, 2000, 3000, 5000, 10000], title: "应用", // skin: "line", // size: "lg", toolbar: "#userTool", where: where(), cols: [ [{ type: "checkbox" }, { field: "appid", title: "序号", width: 100, sort: true, align: "center" }, { field: "appcode", title: "应用码", //minWidth: 108, width: 300, align: "center", // sort: true, // edit: "text", }, { field: "appname", title: "应用名", //minWidth: 100, width: 200, edit: "text", align: "center", // sort: true, style: "color:#F581B1" }, { field: "serverip", title: "服务器", //minWidth: 108, width: 210, align: "center", // sort: true, toolbar: "#selserverip", style: "align-items: center;text-align: center;vertical-align: middle;" // edit: "text", // style: "color:#F581B1" }, { field: "found_time", title: "创建时间", //minWidth: 108, width: 200, align: "center", sort: true, // edit: "text", // style: "color:#F581B1" }, { title: "操作", toolbar: "#btnTool", width: 150, align: "center", style: "text-align: center;", fixed: "right" } ] ] }); table.on("toolbar(user)", function(obj) { var checkStatus = table.checkStatus(obj.config.id); switch (obj.event) { case "search": reload("user"); break; case "New": New(); break; case "Del": Del(table, checkStatus); break; case "edit": // console.log(checkStatus,obj); edit(checkStatus); break; }; }); table.on("edit(user)", function(obj) { // var server = $("[name=server]").val(); console.log(obj) update(obj.data.appcode, obj.data.appname, obj.data.serverip); }); //选中复选框 $('body').on("click", ".layui-table-body table.layui-table tbody tr td", function () { if ($(this).attr("data-field") === "0") return; $(this).siblings().eq(0).find('i').click(); }); //触发行单击事件 // table.on('row(user)', function(obj){ // //$(obj.tr).children().children().children().next().toggleClass('layui-form-checked') // //$(obj.tr).children().children().children().attr('checked', true) // console.log($(obj.tr).children().children().eq(0).click()); // //layui.table.render(); //重新渲染显示效果 // }); // table.on("select(serverip)", function(obj) { // // var server = $("[name=server]").val(); // console.log(obj) // update(obj.data.appcode, obj.data.appname, obj.data.serverip); // }); form.on("select(server)", function(data) { reload("user"); }); laydate.render({ elem: "[name=found_date]", //range: true, done: function() { setTimeout(function() { reload("user"); }, 100); } }); form.on("select(account)", function(data) { reload("user"); }); form.on("select(notice_state)", function(data) { reload("user"); }); form.on("select(register_state)", function(data) { reload("user"); }); form.on("select(kami_state)", function(data) { reload("user"); }); $(".layui-input").keydown(function(e) { if (e.keyCode == 13) { reload("user"); } }); table.on("tool(user)", function(obj) { //表格按钮事件 var data = obj.data; switch (obj.event) { case "del": modifyBtn(obj); break; case "modify": modifyBtn(obj); break; case "continued": continued(obj); break; }; }); form.on("switch(state)", function(obj) { //表格开关事件 console.log(obj.elem.checked); }); function New() { layer.open({ type: 2, title: "新增应用", area: ["400px", "400px"], maxmin: false, content: "newapp.php?v=20201111001" }); } function edit(checkStatus) { if (checkStatus.data.length == 1) { layer.open({ type: 2, title: "编辑管理用户", area: ["600px", "500px"], maxmin: false, content: "../php/edit.php?id=" + checkStatus.data[0].id + "&surface=user", cancel: function(index, layero) { reload("user"); } }); } else { layer.msg("请选择1条记录", { icon: 3 }); } } function Del(table, checkStatus) { var data = checkStatus.data; var appcode = []; for (var i = 0; i < data.length; i++) { appcode.push(data[i]['appcode']); } if (data.length > 0) { layer.confirm("确定删除选中的用户吗?", { icon: 3 }, function() { $.ajax({ url: "ajax.php?act=seldel", type: "POST", dataType: "json", beforeSend: function() { layer.msg("删除中", { icon: 16, shade: 0.05, time: false }); }, data: { item: appcode, // server: $("[name=server]").val() }, success: function(data) { layer.msg(data.msg, { icon: 1 }); if (data.code == "1") { reload("user"); } }, error: function(data) { console.log(data); layer.msg("删除失败", { icon: 5 }); } }); }); } else { layer.msg("未选择记录", { icon: 3 }); } } function update(appcode, appname, serverip) { $.ajax({ url: "ajax.php?act=update", type: "POST", dataType: "json", beforeSend: function() { layer.msg("正在更新数据", { icon: 16, shade: 0.05, time: false }); }, data: { appcode: appcode, appname: appname, serverip: serverip }, success: function(data) { if (data.code == "1") { layer.msg(data.msg, { icon: 1 }); } else { layer.msg(data.msg, { icon: 5 }); } }, error: function(data) { // console.log(data); layer.msg(data.msg, { icon: 5 }); } }); } function query(name) { return $("[name=" + name + "]").val(); } function modifyBtn(obj) { layer.confirm("确定删除此应用吗?", { icon: 3 }, function() { var item = []; item[0] = obj.data; //console.log(item); $.ajax({ url: "ajax.php?act=delapp", type: "POST", dataType: "json", data: { 'appcode': item[0].appcode, // server: $("[name=server]").val() }, beforeSend: function() { layer.msg("正在删除", { icon: 16, shade: 0.05, time: false }); }, success: function(data) { layer.msg(data.msg, { icon: 1 }); if (data.code == "1") { reload("user"); } }, error: function(data) { // var obj = eval(data); // console.log(obj) layer.alert(data.msg, { icon: 2 }); } }); }); } function continued(obj) { layer.msg("详情还在开发哦!现在基本用不到!"); } // function continued(obj) { // var elem = // '<div class="layui-form"><label class="layui-form-label">续费时长<span class="layui-must">*</span></label><div class="layui-input-block"><select name="duration"><option value="1">1天</option><option value="7">7天</option><option value="30">30天</option></select></div></div>'; // layer.confirm(elem, { // area: ["300px", "300px"], // success: function(layero, index) { // layero.find("select").val(1); // form.render("select"); // } // }, // function(index, layero) { // var duration = layero.find("select").val(); // $.ajax({ // url: "../php/continued.php", // type: "POST", // dataType: "json", // data: { // item:obj.data, // server:$("[name=server]").val(), // duration:duration // }, // beforeSend: function() { // layer.msg("正在续费", { // icon: 16, // shade: 0.05, // time: false // }); // }, // success: function(data) { // layer.msg(data.code, { // icon: data.icon // }); // if (data.icon == "1") { // layer.close(index); // reload("user"); // } // }, // error: function(data) { // var obj = eval(data); // layer.alert(obj.responseText, { // icon: 2 // }); // } // }); // }); // } function select() { $.ajax({ url: "ajax.php?act=getserver", type: "POST", dataType: "json", success: function(data) { if (data.code == "1") { var elem = $("[name=server]"); // var elem2 = $("[name=serverip]"); for (var key in data.msg) { // console.log(elem2); var json = data.msg[key], comment = json.comment, ip = json.ip; item = '<option value="' + ip + '">' + comment + '[' + ip + ']</option>'; // item2 = '<option value="' + ip + '">' + comment + '[' + ip + ']</option>'; elem.append(item); // elem2.append(item2); } form.render("select"); } }, error: function(data) { // console.log(data); layer.msg("获取服务器失败", { icon: 5 }); } }); } // function select() { // $.ajax({ // url: "../php/server.php", // type: "POST", // dataType: "json", // success: function(data) { // if (data.icon == "1") { // var elem = $("[name=server]"); // for (var key in data.data) { // var json = data.data[key], // comment = json.comment, // ip = json.ip; // item = '<option value="' + ip + '">' + comment + '[' + ip + ']</option>'; // elem.append(item); // } // form.render("select"); // } // }, // error: function(data) { // console.log(data); // layer.msg(data.responseText, { // icon: 5 // }); // } // }); // } }); function reload(id) { layui.use(["jquery", "table"], function() { var $ = layui.$, table = layui.table; table.reload(id, { page: { curr: 1 }, where: where() }); }); } function selchange(obj) { layui.use(["jquery"], function() { var $ = layui.$ var appcodeobj = $(obj).parent().parent().parent().parent().parent().children().next().next().html(); var appcode = appcodeobj.substring(appcodeobj.indexOf(">") + 1, appcodeobj.lastIndexOf("</")); var appnameobj = $(obj).parent().parent().parent().parent().parent().children().next().next().next().html(); var appname = appnameobj.substring(appnameobj.indexOf(">") + 1, appnameobj.lastIndexOf("</")); var serverip = $(obj).val(); // console.log(appname,appcode,serverip); update(appcode, appname, serverip); }); } function update(appcode, appname, serverip) { layui.use(["jquery"], function() { var $ = layui.$ $.ajax({ url: "ajax.php?act=update", type: "POST", dataType: "json", beforeSend: function() { layer.msg("正在更新数据", { icon: 16, shade: 0.05, time: false }); }, data: { appcode: appcode, appname: appname, serverip: serverip }, success: function(data) { if (data.code == "1") { layer.msg(data.msg, { icon: 1 }); } else { layer.msg(data.msg, { icon: 5 }); } }, error: function(data) { // console.log(data); layer.msg(data.msg, { icon: 5 }); } }); }); } </script> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/head.php
sub_admin/head.php
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <link rel="stylesheet" href="../assets/layui/css/layui.css?v=20241111001" /> <link rel="stylesheet" type="text/css" href="css/admin.css" /> <link rel="stylesheet" type="text/css" href="css/theme.css" /> <title><?php echo $subconf['hostname'].'后台管理'; ?></title> <style> /* 移除全局过渡动画,改为针对性设置 */ * { transition: none; } /* 导航菜单动画优化 */ .layui-nav-item { transition: background-color 0.3s ease; } .layui-nav-item:hover { background-color: rgba(255,255,255,0.1); } /* 简化菜单项动画 */ .layui-nav-item a i, .layui-nav-item a span, .layui-nav-item a em { display: inline-block; transition: transform 0.2s ease-out; will-change: transform; } .layui-nav-item a:hover i, .layui-nav-item a:hover span, .layui-nav-item a:hover em { transform: translateX(5px); } /* 确保子菜单不受影响 */ .layui-nav-child dd a:hover i, .layui-nav-child dd a:hover span { transform: none; } /* 头部导航优化 */ .custom-header .layui-nav-item a:hover i, .custom-header .layui-nav-item a:hover span { transform: none; } /* LOGO样式优化 */ .custom-logo { padding: 20px 0; text-align: center; transition: all 0.4s; } #logos { font-size: 24px; color: #fff; margin: 0; text-shadow: 0 0 10px rgba(51, 202, 187, 0.5); animation: glow 2s ease-in-out infinite alternate; } .custom-logo #logowz { display: block; font-size: 14px; color: #33cabb !important; margin-top: 5px; font-weight: 500; letter-spacing: 1px; text-shadow: 0 0 3px rgba(0, 0, 0, 0.2); } /* 消息徽章动画 */ .layui-badge { transition: transform 0.3s; } .layui-badge:hover { transform: scale(1.1); } /* LOGO发光动画 */ @keyframes glow { from { text-shadow: 0 0 5px #33cabb, 0 0 10px #33cabb; } to { text-shadow: 0 0 10px #33cabb, 0 0 20px #33cabb; } } /* 移动端遮罩层动画 */ .mobile-mask { transition: opacity 0.3s; } /* 选项卡动画 */ .layui-tab-title li { transition: all 0.3s; } .layui-tab-title li:hover { background-color: rgba(51, 202, 187, 0.1); } /* 响应式布局优化 */ @media screen and (max-width: 768px) { .custom-logo { padding: 10px 0; } #logos { font-size: 20px; } } </style> </head> <body class="layui-layout-body"> <div class="layui-layout layui-layout-admin"> <!-- 头部 --> <div class="layui-header custom-header"> <ul class="layui-nav layui-layout-left"> <li class="layui-nav-item slide-sidebar" lay-unselect> <a href="javascript:;" class="icon-font"><i class="ai ai-menufold"></i></a> </li> </ul> <ul class="layui-nav layui-layout-right"> <li class="layui-nav-item"> <a href="javascript:;"> <i class="layui-icon layui-icon-notice"></i> <span>消息</span><span class="layui-badge">0</span> </a> </li> <li class="layui-nav-item"> <a href="javascript:;" style="color:#33cabb;"> <i class="layui-icon layui-icon-username"></i> <span id="username"><?php echo $subconf['username']; ?></span> </a> <dl class="layui-nav-child"> <dd> <a href="javascript:;" id="update_password"> <i class="layui-icon layui-icon-password"></i> <span>修改密码</span> </a> </dd> <dd> <a href="javascript:;" id="quit"> <i class="layui-icon layui-icon-logout"></i> <span>退出登录</span> </a> </dd> </dl> </li> </ul> </div> <!-- 左侧 --> <div class="layui-side custom-admin"> <div class="layui-side-scroll"> <div class="custom-logo"> <!-- <img src="images/logo.png" alt="LOGO" /> --> <!-- 图片尺寸 200px*50px --> <h1 id="logos">一花</h1> <span id="logowz">管理系统</span> </div> <ul id="Nav" class="layui-nav layui-nav-tree" lay-filter="tabnav"> <li class="layui-nav-item layui-nav-itemed"> <a href="javascript:;"> <i class="layui-icon layui-icon-console"></i> <em>控制台</em> </a> <dl class="layui-nav-child"> <dd><a href="primary.php"><span>主页</span></a></dd> <dd><a href="log.php"><span>网站日志</span></a></dd> <dd><a href="hostset.php"><span>网站管理</span></a></dd> <dd><a href="usermanger.php"><span>用户管理</span></a></dd> </dl> </li> <li class="layui-nav-item layui-nav-itemed"> <a href="javascript:;"> <i class="layui-icon layui-icon-app"></i> <em>应用</em> </a> <dl class="layui-nav-child"> <dd><a href="app.php"><span>应用管理</span></a></dd> <dd><a href="server_list.php"><span>服务器列表</span></a></dd> <dd><a href="kami.php"><span>卡密生成</span></a></dd> </dl> </li> <li class="layui-nav-item layui-nav-itemed" style="display:none"> <a href="javascript:;"> <i class="layui-icon">&#xe66f;</i> <em>代理</em> </a> <dl class="layui-nav-child"> <dd><a href="level_list.html"><span>级别设置</span></a></dd> <dd><a href="daili_user.html"><span>代理管理</span></a></dd> <dd><a href="kami.php"><span>充值订单</span></a></dd> </dl> </li> <li class="layui-nav-item layui-nav-itemed" style="display:none"> <a href="javascript:;"> <i class="layui-icon">&#xe672;</i> <em>IP访问权限</em> </a> <dl class="layui-nav-child"> <dd><a href="ip_show.html"><span>官网限制</span></a></dd> <dd><a href="ip_url.html"><span>访问跳转</span></a></dd> <dd><a href="ip_content.html"><span>访问内容</span></a></dd> <dd><a href="ip_setup.html"><span>默认显示</span></a></dd> </dl> </li> <li class="layui-nav-item layui-nav-itemed" style="display:none"> <a href="javascript:;"> <i class="layui-icon">&#xe60a;</i> <em>网站内容</em> </a> <dl class="layui-nav-child"> <dd><a href="activity_list.html"><span>活动</span></a></dd> <dd><a href="code_list.html"><span>代码</span></a></dd> <dd><a href="explain_list.html"><span>介绍</span></a></dd> <dd><a href="game_list.html"><span>扫码</span></a></dd> <dd><a href="doc_list.html"><span>教程</span></a></dd> </dl> </li> </ul> </div> </div> <!-- 主体 --> <div class="layui-body"> <div class="layui-tab app-container" lay-allowClose="true" lay-filter="tabs"> <ul id="appTabs" class="layui-tab-title custom-tab"></ul> <div id="appTabPage" class="layui-tab-content"></div> </div> </div> <div class="mobile-mask"></div> </div> <script src="../assets/layui/layui.js"></script> <script src="../assets/js/index.js"></script> </body> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/usermanger.php
sub_admin/usermanger.php
<?php include("../includes/common.php"); if (!($islogin == 1)) { exit('<script language=\'javascript\'>alert("您还没有登录,请先登录!");window.location.href=\'login.php\';</script>'); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title><?php echo $subconf['hostname']?>用户管理</title> <meta name="renderer" content="webkit" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> <?php include("foot.php"); ?> <!-- <link rel="stylesheet" href="../assets/layui/css/layui.css?v=20201111001?v=20201111001" /> <link rel="stylesheet" type="text/css" href="./css/theme.css?v=20201111001" /> --> </head> <body> <!-- 筛选条件 --> <div class="layui-card"> <div class="layui-card-body layui-form"> <div class="layui-form-item" style="padding-right: 5vw;padding-top: 15px;"> <label class="layui-form-label" title="用户名"> 用户名: </label> <div class="layui-input-inline"> <input type="text" name="user" class="layui-input" /> </div> <label class="layui-form-label" title="应用"> 应用: </label> <div class="layui-input-inline"> <select name="app" lay-filter="state"> <option value=""></option> </select> </div> </div> </div> </div> <!-- 表格 --> <div class="layui-card"> <div class="layui-card-body"> <table id="server_list" lay-filter="server_list"></table> </div> </div> </body> <!-- <script src="https://www.layuicdn.com/layui/layui.js?v=20201111001"></script> --> <!-- <script src="../assets/layui/layui.js"></script> --> <script type="text/html" id="server_listTool"> <div class="layui-btn-container"> <!-- <button class="layui-btn layui-btn-black layui-btn-sm" lay-event="reload"><i class="layui-icon layui-icon-loading-1 layui-anim layui-anim-rotate layui-anim-loop"></i><span>刷新</span></button> --> <button class="layui-btn layui-btn-normal layui-btn-sm" lay-event="search"><i class="layui-icon layui-icon-search"></i><span>搜索</span></button> <button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="New"><i class="layui-icon layui-icon-add-1"></i><span>新增</span></button> <button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="edit"><i class="layui-icon layui-icon-edit"></i><span>编辑</span></button> <button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="Del"><i class="layui-icon layui-icon-delete"></i><span>删除</span></button> <button class="layui-btn layui-btn-warm layui-btn-sm" lay-event="clearCache"><i class="layui-icon layui-icon-refresh"></i><span>清除缓存</span></button> </div> </script> <!-- 表格按钮 --> <script type="text/html" id="btnTool"> <a class="layui-btn layui-btn-sm layui-btn-normal" lay-event="modify">修改</a> <a class="layui-btn layui-btn-sm layui-btn-normal" lay-event="select">选择</a> <a class="layui-btn layui-btn-sm layui-btn-danger" lay-event="del">删除</a> </script> <!-- 表格开关 --> <script type="text/html" id="stateTool"> <input type="checkbox" name="state" value="{{d.state}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="state" {{ d.state == "1" ? 'checked' : '' }} /> </script> <!-- 表格开关 //background-color:#33cabb--> <style> .green{ background-color:#33cabb; } </style> <script type="text/html" id="pwddot"> <span style="width: 20px;height: 20px;" class="layui-badge-dot {{d.pwdstate==1?'green':''}}"></span> </script> <script type="text/html" id="expirdot"> <span style="width: 20px;height: 20px;" class="layui-badge-dot {{d.expire==0?'green':''}}"></span> </script> <!-- 表格链接 --> <script type="text/html" id="certificateTool"> <a href="{{d.certificate}}" class="layui-table-link" target="_blank">{{ d.certificate }}</a> </script> <!-- 表格图片 --> <script type="text/html" id="imgTpl"> <a href="{{d.url}}" class="layui-table-link" target="_blank"><img src="{{ d.url }}" /></a> </script> <script> layui.use(["jquery", "table", "laydate", "form", "upload", "element"], function() { var $ = layui.$, table = layui.table, laydate = layui.laydate, form = layui.form, upload = layui.upload, element = layui.element; window.where = function() { var data = [ "id", "code", "price","user", "state","app" ]; var json = {}; for (var key in data) { json[data[key]] = query(data[key]); console.log(query(data[key])) } return json; } select(); form.render("select"); table.render({ elem: "#server_list", escape:true, height: "full-170", url: "ajax.php?act=getuserall", page: true, limit: 100, limits: [10, 20, 30, 50, 100, 200, 300, 500, 1000, 2000, 3000, 5000, 10000], title: "用户", // skin: "line", // size: "lg", toolbar: "#server_listTool", where: where(), cols: [ [{ type: "checkbox" }, { field: "id", title: "序号", width: 100, sort: true, align: "center" }, { field: "user", title: "用户名", //minWidth: 100, width: 170, align: "center", // sort: true }, { field: "pwd", title: "密码", //minWidth: 100, width: 170, align: "center", // sort: true }, { field: "state", title: "账号状态", //minWidth: 100, align: "center", width: 170, toolbar: "#stateTool" // sort: true }, { field: "pwdstate", title: "密码状态", //minWidth: 100, width: 170, align: "center", toolbar: "#pwddot" // sort: true }, { field: "connection", title: "连接数", //minWidth: 100, align: "center", width: 100, // hide: true // sort: true }, { field: "bandwidthup", title: "上行带宽", //minWidth: 100, align: "center", width: 100, // hide: true // sort: true }, { field: "bandwidthdown", title: "下行带宽", //minWidth: 100, align: "center", width: 100, // hide: true // sort: true }, { field: "disabletime", title: "到期时间", //minWidth: 100, align: "center", width: 170, // hide: true sort: true }, { field: "expire", title: "到期状态", //minWidth: 100, width: 170, // sort:true, align: "center", toolbar:"#expirdot" // sort: true }, { field: "appname", title: "所属应用", //minWidth: 100, width: 170, align: "center", // sort: true }, { field: "serverip", title: "IP", hide:true, //minWidth: 100, width: 170, align: "center", // sort: true }] ] }); function select() { $.ajax({ url: "ajax.php?act=getapp", type: "POST", dataType: "json", success: function(data) { if (data.code == "1") { var elem = $("[name=app]"); // var elem2 = $("[name=serverip]"); for (var key in data.msg) { // console.log(elem2); var json = data.msg[key], appname = json.appname, appcode = json.appcode; item = '<option value="' + appcode + '">' + appname + '</option>'; // item2 = '<option value="' + ip + '">' + comment + '[' + ip + ']</option>'; elem.append(item); // elem2.append(item2); } form.render("select"); } }, error: function(data) { // console.log(data); layer.msg("获取用户失败", { icon: 5 }); } }); } table.on("toolbar(server_list)", function(obj) { var checkStatus = table.checkStatus(obj.config.id); switch (obj.event) { case "search": reload("server_list"); break; case "New": New(); break; case "Del": Del(table, checkStatus); break; case "edit": // console.log(checkStatus,obj); edit(checkStatus); break; case "clearCache": layer.confirm("确定要清除缓存吗?", { icon: 3 }, function() { $.ajax({ url: "ajax.php?act=clearcache", type: "POST", dataType: "json", beforeSend: function() { layer.msg("正在清除缓存", { icon: 16, shade: 0.05, time: false }); }, success: function(data) { layer.msg(data.msg, { icon: data.code == "1" ? 1 : 5 }); if (data.code == "1") { reload("server_list"); } }, error: function(data) { layer.msg("清除缓存失败", { icon: 5 }); } }); }); break; }; }); table.on('rowDouble(server_list)', function(obj){ var data=obj.data; console.log(data.user); if(data!=null) { layer.open({ type: 2, title: "编辑用户", area: ["400px", "400px"], maxmin: false, content: "edituser.php?user="+data.user+"&pwd="+data.pwd+"&use_date="+data.disabletime+"&serverip="+data.serverip+"&connection="+data.connection+"&bandwidthup="+data.bandwidthup+"&bandwidthdown="+data.bandwidthdown, cancel: function(index, layero) { reload("server_list"); } }); }else{ layer.msg("选中错误!",{ icon: "3" }); } //edit(1); }); //选中复选框 $('body').on("click", ".layui-table-body table.layui-table tbody tr td", function () { if ($(this).attr("data-field") === "0") return; $(this).siblings().eq(0).find('i').click(); }); //触发行单击事件 // table.on('row(server_list)', function(obj){ // $(obj.tr).children().children().children().next().addClass('layui-form-checked') // }); table.on("edit(server_list)", function(obj) { // var server = $("[name=server]").val(); console.log(obj) update(obj.data.appcode, obj.data.appname, obj.data.serverip); }); // table.on("select(serverip)", function(obj) { // // var server = $("[name=server]").val(); // console.log(obj) // update(obj.data.appcode, obj.data.appname, obj.data.serverip); // }); form.on("select(server)", function(data) { reload("server_list"); }); laydate.render({ elem: "[name=found_date]", //range: true, done: function() { setTimeout(function() { reload("server_list"); }, 100); } }); form.on("select(state)", function(data) { reload("server_list"); }); $(".layui-input").keydown(function(e) { if (e.keyCode == 13) { if($("[name=app]").val()==""){ layer.msg("请选择查询的应用!"); }else{ reload("server_list"); } } }); table.on("tool(server_list)", function(obj) { //表格按钮事件 var data = obj.data; switch (obj.event) { case "del": modifyBtn(obj); break; case "modify": modifyBtn(obj); break; case "continued": continued(obj); break; }; }); form.on("switch(state)", function(obj) { elem=$(this).parent().parent().parent().children(); user=elem.eq(2).text(); pwd=elem.eq(3).text(); day=elem.eq(9).text(); ip=elem.eq(12).text(); sw=$(this).val(); connection=elem.eq(6).text()=="无限制"?-1:elem.eq(6).text(); bandwidthup=elem.eq(7).text()=="无限制"?-1:elem.eq(7).text(); bandwidthdown=elem.eq(8).text()=="无限制"?-1:elem.eq(8).text(); $.ajax({ url: "ajax.php?act=upswitchuser", type: "POST", dataType: "json", data: { usermodel:{ user:user, pwd:pwd, day:day, serverip:ip, sw:sw, connection:connection, bandwidthup:bandwidthup, bandwidthdown:bandwidthdown } }, beforeSend: function() { layer.msg("正在更新", { icon: 16, shade: 0.05, time: false }); }, success: function(data) { layer.msg(data.msg, { icon: data.icon }); setTimeout(function() { reload("server_list"); },1000); }, error: function(data) { layer.alert("更新失败:"+data.msg, { icon: 2 }); } }); }); function New() { layer.open({ type: 2, title: "新增用户", area: ["400px", "400px"], maxmin: false, content: "newuser.php?v=20201111001" }); } function edit(checkStatus) { console.log(checkStatus) if (checkStatus.data.length == 1) { layer.open({ type: 2, title: "编辑用户", area: ["400px", "400px"], maxmin: false, //"edituser.php?user="+data.user+"&pwd="+data.pwd+"&use_date="+data.disabletime, content: "edituser.php?user="+checkStatus.data[0].user+"&pwd="+checkStatus.data[0].pwd+"&use_date="+checkStatus.data[0].disabletime+"&serverip="+checkStatus.data[0].serverip, cancel: function(index, layero) { reload("server_list"); } }); } else { layer.msg("请选择1条记录", { icon: 3 }); } } function Del(table, checkStatus) { var data = checkStatus.data; var user=[]; for (var i = 0; i < data.length; i++) { user.push({ "user":data[i]["user"], "serverip":data[i]["serverip"] }); } console.log(user); if (data.length > 0) { layer.confirm("确定删除选中的用户吗?", { icon: 3 }, function() { $.ajax({ url: "ajax.php?act=seldeluser", type: "POST", dataType: "json", beforeSend: function() { layer.msg("删除中", { icon: 16, shade: 0.05, time: false }); }, data: { item: user, // server: $("[name=server]").val() }, success: function(data) { layer.msg(data.msg, { icon: 1 }); if (data.code == "1") { reload("server_list"); } }, error: function(data) { console.log(data); layer.msg("删除失败", { icon: 5 }); } }); }); } else { layer.msg("未选择记录", { icon: 3 }); } } function update(appcode, appname, serverip) { $.ajax({ url: "ajax.php?act=update", type: "POST", dataType: "json", beforeSend: function() { layer.msg("正在更新数据", { icon: 16, shade: 0.05, time: false }); }, data: { appcode: appcode, appname: appname, serverip: serverip }, success: function(data) { if (data.code== "1") { layer.msg(data.msg, { icon: 1 }); } else { layer.msg(data.msg, { icon: 5 }); } }, error: function(data) { // console.log(data); layer.msg(data.msg, { icon: 5 }); } }); } function query(name) { return $("[name=" + name + "]").val(); } }); function reload(id) { layui.use(["jquery", "table"], function() { var $ = layui.$, table = layui.table; table.reload(id, { page: { curr: 1 }, where: where() }); }); } </script> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/editserver.php
sub_admin/editserver.php
<?php /* * @Author: yihua * @Date: 2022-07-11 17:19:14 * @LastEditTime: 2022-08-25 08:29:32 * @LastEditors: yihua * @Description: * @FilePath: \ccpy\sub_admin\editserver.php * 一花一叶 一行代码 * Copyright (c) 2022 by yihua 487735913@qq.com, All Rights Reserved. */ include("../includes/common.php"); if (!($islogin == 1)) { exit('<script language=\'javascript\'>alert("您还没有登录,请先登录!");window.location.href=\'login.php\';</script>'); } $id=$_REQUEST["id"]; $serverip=$_REQUEST["ip"]; $user=$_REQUEST["serveruser"]; $pwd=$_REQUEST["password"]; $state=$_REQUEST["state"]; $cport=$_REQUEST["cport"]; $comment=$_REQUEST["comment"]; ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title><?php echo $subconf['hostname'] ?>编辑服务器</title> <meta name="renderer" content="webkit" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> <?php include("foot.php"); ?> <!-- <link rel="stylesheet" href="../assets/layui/css/layui.css?v=20201111001?v=20201111001" /> <link rel="stylesheet" type="text/css" href="./css/theme.css?v=20201111001" /> --> <style> body { background-color: #FFFFFF; padding-right: 80px; } #layui-laydate1{ top: 0!important; } .usetime{ display: none; } </style> </head> <body class="layui-form form"> <div class="layui-form-item"> <label class="layui-form-label"> 服务器IP <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="serverip" value="<?=$serverip; ?>" class="layui-input" lay-verify="required" placeholder="请填写服务器IP" /> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 登录账号 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="user" value="<?=$user; ?>" class="layui-input" lay-verify="required" placeholder="请填写用户名" /> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 登录密码 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="pwd" value="<?=$pwd; ?>" class="layui-input" lay-verify="required" placeholder="请填写密码" /> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 代理端口 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="cport" value="<?=$cport; ?>" class="layui-input" lay-verify="required" placeholder="请填写端口" /> </div> </div> <div class="layui-form-item"> <label class="layui-form-label" title="服务器状态"> 服务器状态 <span class="layui-must">*</span> </label> <div class="layui-input-inline"> <input type="checkbox" name="state" value="<?=$state;?>" lay-skin="switch" lay-text="开启|关闭" lay-filter="state" <?=$state=="1" ? "checked" :"";?>/> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 备注 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="comment" value="<?=$comment;?>" class="layui-input" lay-verify="required" placeholder="请填写备注" /> <input style="display:none" type="text" name="id" value="<?=$id;?>" class="layui-input" lay-verify="required" placeholder="ID" /> </div> </div> <!-- <div class="layui-form-item"> <label class="layui-form-label" title="应用"> 应用 <span class="layui-must">*</span> </label> <div class="layui-input-inline"> <select lay-verify="required" name="app" lay-filter="state"> <option value="">请选择一个应用</option> </select> </div> </div> --> <!-- <div class="layui-form-item"> <label class="layui-form-label"> 密码 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="number" name="password" class="layui-input" lay-verify="required" placeholder="纯数字密码"/> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 到期时间 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="end_date" class="layui-input" lay-verify="required" placeholder="YYYY-mm-dd HH:ii-dd" /> </div> </div> --> <div class="layui-form-item"> <div class="layui-input-block"> <button class="layui-btn layui-btn-normal layui-btn-sm" lay-submit lay-filter="submit">确定</button> </div> </div> </body> <!-- <script src="https://www.layuicdn.com/layui/layui.js?v=20201111001"></script> --> <script type="text/javascript" src="../assets/js/xss.js"></script> <script> layui.use(["jquery", "form", "laydate"], function() { var $ = layui.$, form = layui.form, laydate = layui.laydate; console.log($("[name=use_date]").eq(0).val('<?=$use_date;?>')); form.render("input"); // form.on('select(expire)', function(data) { // // console.log(data.value==-1?$(da):) // if(data.value==-1){ // $(".usetime").eq(0).css("display","block"); // } // else{ // $(".usetime").eq(0).css("display","none"); // } // // var duration = Number(data.value); // // var price = duration * unit; // }); $(".layui-input").eq(0).focus(); form.on("submit(submit)", function(data) { //console.log(data.field) // if(data.field.expire==-1){ // if(data.field.use_date==""){ // layer.msg("自定义时长不能为空!", { // icon: 5 // }); // return; // } // } // console.log(data); $.ajax({ url: "ajax.php?act=editserver", type: "POST", dataType: "json", data: { data: data.field }, beforeSend: function() { layer.msg("正在提交", { icon: 16, shade: 0.05, time: false }); }, success: function(data) { if (data.code == "1") { parent.layer.closeAll(); parent.layer.msg(data.msg, { icon: 1 }); setTimeout(function(){ window.parent.frames.reload('server_list'); },100); } else { layer.msg(data.msg == null ? "未知错误" : data.msg, { icon: 5 }); } console.log(data); // if (data.icon == "1") { // } else { // layer.msg(data.code, { // icon: data.icon // }); // } }, error: function(data) { console.log(data); layer.msg("编辑数据失败", { icon: 5 }); } }); return false; }); // function select() { // $.ajax({ // url: "ajax.php?act=getapp", // type: "POST", // dataType: "json", // success: function(data) { // if (data.code == "1") { // var elem = $("[name=app]"); // for (var key in data.msg) { // var json = data.msg[key], // appname = json.appname, // appcode = json.appcode; // item = '<option value="' + appcode + '">' + appname + '</option>'; // elem.append(item); // } // form.render("select"); // } // }, // error: function(data) { // layer.msg("获取用户失败", { // icon: 5 // }); // } // }); // }; laydate.render({ elem: "[name=use_date]", format: "yyyy-MM-dd HH:mm:ss", //range: true, done: function(e) { // setTimeout(function() { // window.parent.frames.reload('server_list'); // }, 1000); } }); // laydate.render({ // elem: "[name=end_date]", // type: "datetime" // }); // function select() { // $.ajax({ // url: "ajax.php?act=getserver", // type: "POST", // dataType: "json", // success: function(data) { // if (data.code == "1") { // var elem = $("[name=server]"); // for (var key in data.msg) { // // console.log(data.msg[key]); // var json = data.msg[key], // comment = json.comment, // ip = json.ip; // item = '<option value="' + ip + '">' + comment + '[' + ip + ']</option>'; // elem.append(item); // } // form.render("select"); // } // }, // error: function(data) { // // console.log(data); // layer.msg("获取服务器失败", { // icon: 5 // }); // } // }); // } //select(); }); </script> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/code.php
sub_admin/code.php
<?php session_start(); define('ROOT_PATH', dirname(__FILE__)); require '../includes/ValidateCode.class.php'; $_vc = new ValidateCode(); //实例化一个对象 $_vc->doimg(); $_SESSION['xx_session_code'] = $_vc->getCode();//验证码保存到SESSION中 ?>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/kami.php
sub_admin/kami.php
<?php include("../includes/common.php"); if (!($islogin == 1)) { exit('<script language=\'javascript\'>alert("您还没有登录,请先登录!");window.location.href=\'login.php\';</script>'); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="renderer" content="webkit"> <title><?php echo $subconf['hostname']?>注册卡密</title> <?php include("foot.php"); ?> <style> .layui-form-checked span, .layui-form-checked:hover span{ background-color: #33cabb!important; } </style> <!-- <link rel="stylesheet" href="../assets/layui/css/layui.css?v=20201111001?v=20201111001" /> <link rel="stylesheet" type="text/css" href="./css/theme.css?v=20201111001" /> --> </head> <body> <!-- 筛选条件 --> <div class="layui-card"> <div class="layui-card-body layui-form"> <div class="layui-form-item" style="padding-right: 5vw;padding-top: 15px;"> <label class="layui-form-label" title="生成账号"> 生成账号 </label> <div class="layui-input-inline"> <input type="text" name="sc_user" class="layui-input"> </div> <label class="layui-form-label" title="卡密"> 卡密 </label> <div class="layui-input-inline"> <input type="text" name="code" class="layui-input"> </div> <label class="layui-form-label" title="创建时间"> 创建时间 </label> <div class="layui-input-inline"> <input type="text" name="found_date" class="layui-input" placeholder="YYYY-MM-DD"> </div> <label class="layui-form-label" title="使用时间"> 使用时间 </label> <div class="layui-input-inline" > <input type="text" name="use_date" class="layui-input" placeholder="YYYY-MM-DD"> </div> <label class="layui-form-label" title="备注"> 备注 </label> <div class="layui-input-inline"> <input type="text" name="comment" class="layui-input"> </div> <label class="layui-form-label" title="所属应用"> 所属应用 </label> <div class="layui-input-inline"> <select name="app" lay-filter="state"> <option value=""></option> </select> </div> <label class="layui-form-label" title="状态"> 状态 </label> <div class="layui-input-inline"> <select name="state" lay-filter="state"> <option value=""></option> <option value="0">未使用</option> <option value="1">已使用</option> </select> </div> </div> </div> </div> <!-- 表格 --> <div class="layui-card"> <div class="layui-card-body"> <table id="daili_kami" lay-filter="daili_kami"></table> </div> </div> </body> <!-- <script src="https://www.layuicdn.com/layui/layui.js?v=20201111001"></script> --> <script type="text/html" id="daili_kamiTool"> <div class="layui-btn-container"> <button class="layui-btn layui-btn-normal layui-btn-sm" lay-event="search"><i class="layui-icon layui-icon-search"></i><span>搜索</span></button> <button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="New"><i class="layui-icon layui-icon-add-1"></i><span>新增</span></button> <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="Del"><i class="layui-icon layui-icon-delete"></i><span>删除</span></button> </div> </script> <!-- 表格按钮 --> <script type="text/html" id="btnTool"> <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="modify">修改</a> <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="select">选择</a> <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a> </script> <!-- 表格开关 --> <script type="text/html" id="switchTpl"> <input type="checkbox" name="state" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="state" {{ d.state == "1" ? 'checked' : '' }}> </script> <!-- 表格链接 --> <script type="text/html" id="urlTpl"> <a href="{{d.url}}" class="layui-table-link" target="_blank">{{ d.url }}</a> </script> <!-- 表格图片 --> <script type="text/html" id="imgTpl"> <a href="{{d.url}}" class="layui-table-link" target="_blank"><img src="{{ d.url }}" /></a> </script> <script> layui.use(["jquery", "table", "laydate", "form", "upload", "element"], function() { var $ = layui.$, table = layui.table, laydate = layui.laydate, form = layui.form, upload = layui.upload, element = layui.element; window.where = function() { var data = ["id", "code", "price", "duration", "comment", "found_date", "username", "password", "use_date", "sc_user", "state","app" ]; var json = {}; for (var key in data) { json[data[key]] = query(data[key]); } return json; } table.render({ elem: "#daili_kami", height: "full-170", url: "ajax.php?act=getkami", page: true, limit: 100, limits: [10, 20, 30, 50, 100, 200, 300, 500, 1000, 2000, 3000, 5000, 10000], title: "注册卡密", //skin: "line", //size: "lg", toolbar: "#daili_kamiTool", defaultToolbar: ['filter', 'print', { title: '导出' //标题 ,layEvent: 'exports' //事件名,用于 toolbar 事件中使用 ,icon: 'layui-icon-export' //图标类名 }], where: where(), cols: [ [{ type: "checkbox" }, { field: "id", title: "序号", width: 100, sort: true, align: "center" },{ field: "kami", title: "卡密", width: 200, align: "center", sort: true }, { field: "times", title: "时长", width: 120, align: "center", sort: true },{ field: "sc_user", title: "生成用户", width: 108, align: "center", sort: true }, { field: "found_date", title: "创建时间", width: 170, align: "center", sort: true }, { field: "username", title: "激活账号", width: 120, align: "center", sort: true }, { field: "use_date", title: "卡密使用时间", width: 170, align: "center", sort: true }, { field: "state", title: "状态", sort: true, align: "center", width: 80 }, { field: "app", title: "所属应用", sort: true, align: "center", width: 120 },{ field: "comment", title: "备注", width: 100, align: "center", sort: true } // ,{ // title: "操作", // toolbar: "#btnTool", // width: 220, // style: "text-align: center;", // fixed: "right" // } ] ], done: function (res, curr, count) { exportData=res.data; } }); // table.render({ //其它参数在此省略 // defaultToolbar: ['filter', 'print', 'exports', { // title: '提示' //标题 // ,layEvent: 'LAYTABLE_TIPS' //事件名,用于 toolbar 事件中使用 // ,icon: 'layui-icon-tips' //图标类名 // }] // }); //选中复选框 $('body').on("click", ".layui-table-body table.layui-table tbody tr td", function () { if ($(this).attr("data-field") === "0") return; $(this).siblings().eq(0).find('i').click(); }); // /* edit: "text",style: "color:#F581B1" 列可编辑*/ table.on("toolbar(daili_kami)", function(obj) { var checkStatus = table.checkStatus(obj.config.id); switch (obj.event) { case "search": reload("daili_kami"); break; case "New": New(); break; case "Del": Del(table, checkStatus); break; //自定义头工具栏右侧图标 - 提示 case 'exports': // layer.alert('这是工具栏右侧自定义的一个图标按钮'); $(".layui-table-tool .layui-table-tool-self").children().eq(2).append('<ul class="layui-table-tool-panel" style="max-height: 501px;"><li id="csv" data-type="csv">\u5bfc\u51fa\u5230 Csv \u6587\u4ef6</li><li id="excel" data-type="excel">\u5bfc\u51fa\u5230 Excel \u6587\u4ef6</li><li id="txt" data-type="txt">\u5bfc\u51fa\u5230 Txt \u6587\u4ef6</li><li id="json" data-type="json">\u5bfc\u51fa\u5230 Json \u6587\u4ef6</li><li id="xml" data-type="xml">\u5bfc\u51fa\u5230 Xml \u6587\u4ef6</li></ul>'); //table.exportFile(obj.config.id,exportData,'txt'); //默认导出 csv,也可以为:xls $("#csv").click(function(){ table.exportFile(obj.config.id,exportData,'csv'); //默认导出 csv,也可以为:xls }); $("#excel").click(function(){ table.exportFile(obj.config.id,exportData,'xls'); //默认导出 csv,也可以为:xls }); $("#txt").click(function(){ table.exportFile(obj.config.id,exportData,'txt'); //默认导出 csv,也可以为:xls }); $("#json").click(function(){ table.exportFile(obj.config.id,exportData,'json'); //默认导出 csv,也可以为:xls }); $("#xml").click(function(){ table.exportFile(obj.config.id,exportData,'xml'); //默认导出 csv,也可以为:xls }); break; }; }); table.on("edit(daili_kami)", function(obj) { update(obj.field, obj.value, obj.data.id); }); laydate.render({ elem: "[name=found_date]", //range: true, done: function() { setTimeout(function() { reload("daili_kami"); }, 100); } }); laydate.render({ elem: "[name=use_date]", //range: true, done: function() { setTimeout(function() { reload("daili_kami"); }, 100); } }); form.on("select(state)", function(data) { reload("daili_kami"); }); $(".layui-input").keydown(function(e) { if (e.keyCode == 13) { reload("daili_kami"); } }); table.on("tool(daili_kami)", function(obj) { //表格按钮事件 var data = obj.data; switch (obj.event) { case "del": modifyBtn(obj); break; case "modify": modifyBtn(obj); break; case "select": selectBtn(obj); break; }; }); function New() { layer.open({ type: 2, title: "新增注册卡密", area: ["500px", "450px"], maxmin: false, content: "new_kami.php?v=20201111001" }); } form.on("switch(state)", function(obj) { //表格开关事件 console.log(obj.elem.checked); }); function Del(table, checkStatus) { var data = checkStatus.data; var kami = [];//向数组添加卡密 //console.log(data[0]['kami']); for (var i = 0; i < data.length; i++) { kami.push(data[i]['kami']); } if (data.length > 0) { layer.confirm("确定删除选中的用户吗?", { icon: 3 }, function() { $.ajax({ url: "ajax.php?act=delkami", type: "POST", dataType: "json", beforeSend: function() { layer.msg("删除中", { icon: 16, shade: 0.05, time: false }); }, data: { item: kami, // server: $("[name=server]").val() }, success: function(data) { layer.msg(data.msg, { icon: 1 }); if (data.code == "1") { reload("daili_kami"); } }, error: function(data) { console.log(data); layer.msg("删除失败", { icon: 5 }); } }); }); } else { layer.msg("未选择记录", { icon: 3 }); } } function update(field, value, id, success) { $.ajax({ url: "../php/update.php", type: "POST", dataType: "json", beforeSend: function() { layer.msg("正在更新", { icon: 16, shade: 0.05, time: false }); }, data: { field: field, id: id, value: value, surface: "daili_kami" }, success: function(data) { if (success != undefined) { success(data); } else { layer.msg(data.code, { icon: data.icon }); } }, error: function(data) { console.log(data); layer.msg(data.responseText, { icon: 5 }); } }); } function query(name) { return $("[name=" + name + "]").val(); } function modifyBtn(obj) { layer.confirm("确定修改此记录吗?", { icon: 3 }, function() { $.ajax({ url: "../php/modifyBtn.php", type: "POST", dataType: "json", data: { id: obj.data.id }, beforeSend: function() { layer.msg("正在修改", { icon: 16, shade: 0.05, time: false }); }, success: function(data) { layer.msg(data.code, { icon: data.icon }); if (data.icon == "1") { obj.update({ value: 100 }); } }, error: function(data) { var obj = eval(data); layer.alert(obj.responseText, { icon: 2 }); } }); }); } function selectBtn(obj) { var elem = '<div class="layui-form"><label class="layui-form-label">下拉框<span class="layui-must">*</span></label><div class="layui-input-block"><select name="selectBtn"><option value="0">A</option><option value="1">B</option></select></div></div>'; layer.confirm(elem, { area: ["300px", "250px"], success: function(layero, index) { layero.find("select").val(1); form.render("select"); } }, function(index, layero) { var value = layero.find("select").val(); $.ajax({ url: "../php/selectBtn.php", type: "POST", dataType: "json", data: { id: obj.data.id, value: value }, beforeSend: function() { layer.msg("正在修改", { icon: 16, shade: 0.05, time: false }); }, success: function(data) { layer.msg(data.code, { icon: data.icon }); if (data.icon == "1") { layer.close(index); console.log("修改成功"); } }, error: function(data) { var obj = eval(data); layer.alert(obj.responseText, { icon: 2 }); } }); }); } function select() { $.ajax({ url: "ajax.php?act=getapp", type: "POST", dataType: "json", success: function(data) { if (data.code == "1") { var elem = $("[name=app]"); // var elem2 = $("[name=serverip]"); for (var key in data.msg) { // console.log(elem2); var json = data.msg[key], appname = json.appname, appcode = json.appcode; item = '<option value="' + appcode + '">' + appname + '</option>'; // item2 = '<option value="' + ip + '">' + comment + '[' + ip + ']</option>'; elem.append(item); // elem2.append(item2); } form.render("select"); } }, error: function(data) { // console.log(data); layer.msg("获取服务器失败", { icon: 5 }); } }); } // function select() { // $.ajax({ // url: "../php/classify.php", // type: "POST", // dataType: "json", // success: function(data) { // if (data.icon == "1") { // var elem = $("[name=classify]"); // for (var key in data.data) { // var json = data.data[key], // name = json.name, // id = json.id; // item = '<option value="' + id + '">' + name + '</option>'; // elem.append(item); // } // form.render("select"); // } // }, // error: function(data) { // console.log(data); // layer.msg(data.responseText, { // icon: 5 // }); // } // }); // } select(); //获取数据 /* <select name="classify" lay-verify="required" lay-filter="classify"> <option value=""></option> </select> form.on("select(classify)", function(data) { reload("daili_kami"); }); */ }); function reload(id) { layui.use(["jquery", "table"], function() { var $ = layui.$, table = layui.table; table.reload(id, { page: { curr: 1 }, where: where() }); }); } </script> <!-- 注册卡密页面文件 --> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/server_list.php
sub_admin/server_list.php
<?php include("../includes/common.php"); if (!($islogin == 1)) { exit('<script language=\'javascript\'>alert("您还没有登录,请先登录!");window.location.href=\'login.php\';</script>'); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title><?php echo $subconf['hostname']?>服务器管理</title> <meta name="renderer" content="webkit" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> <?php include("foot.php"); ?> <!-- <link rel="stylesheet" href="../assets/layui/css/layui.css?v=20201111001?v=20201111001" /> <link rel="stylesheet" type="text/css" href="./css/theme.css?v=20201111001" /> --> </head> <body> <!-- 筛选条件 --> <div class="layui-card"> <div class="layui-card-body layui-form"> <div class="layui-form-item" style="padding-right: 5vw;padding-top: 15px;"> <label class="layui-form-label" title="服务器IP"> 服务器IP: </label> <div class="layui-input-inline"> <input type="text" name="ip" class="layui-input" /> </div> <label class="layui-form-label" title="备注"> 备注: </label> <div class="layui-input-inline"> <input type="text" name="comment" class="layui-input" /> </div> </div> </div> </div> <!-- 表格 --> <div class="layui-card"> <div class="layui-card-body"> <table id="server_list" lay-filter="server_list"></table> </div> </div> </body> <!-- <script src="https://www.layuicdn.com/layui/layui.js?v=20201111001"></script> --> <!-- <script src="../assets/layui/layui.js"></script> --> <script type="text/html" id="server_listTool"> <div class="layui-btn-container"> <!-- <button class="layui-btn layui-btn-black layui-btn-sm" lay-event="reload"><i class="layui-icon layui-icon-loading-1 layui-anim layui-anim-rotate layui-anim-loop"></i><span>刷新</span></button> --> <button class="layui-btn layui-btn-normal layui-btn-sm" lay-event="search"><i class="layui-icon layui-icon-search"></i><span>搜索</span></button> <button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="New"><i class="layui-icon layui-icon-add-1"></i><span>新增</span></button> <button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="edit"><i class="layui-icon layui-icon-edit"></i><span>编辑</span></button> <button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="Del"><i class="layui-icon layui-icon-delete"></i><span>删除</span></button> </div> </script> <!-- 表格按钮 --> <script type="text/html" id="btnTool"> <a class="layui-btn layui-btn-sm layui-btn-normal" lay-event="modify">修改</a> <a class="layui-btn layui-btn-sm layui-btn-normal" lay-event="select">选择</a> <a class="layui-btn layui-btn-sm layui-btn-danger" lay-event="del">删除</a> </script> <!-- 表格开关 --> <script type="text/html" id="stateTool"> <input type="checkbox" name="state" value="{{d.ip}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="state" {{ d.state == "1" ? 'checked' : '' }} /> </script> <!-- 表格链接 --> <script type="text/html" id="certificateTool"> <a href="{{d.certificate}}" class="layui-table-link" target="_blank">{{ d.certificate }}</a> </script> <!-- 表格图片 --> <script type="text/html" id="imgTpl"> <a href="{{d.url}}" class="layui-table-link" target="_blank"><img src="{{ d.url }}" /></a> </script> <script> layui.use(["jquery", "table", "laydate", "form", "upload", "element"], function() { var $ = layui.$, table = layui.table, laydate = layui.laydate, form = layui.form, upload = layui.upload, element = layui.element; window.where = function() { var data = ["id", "ip", "username", "password", "port", "state", "comment", "found_date"]; //循环data,赋值控件取值 var json = {}; for (var key in data) { json[data[key]] = query(data[key]); // console.log(json); } return json; } // select(); form.render("select"); table.render({ elem: "#server_list", escape:true, height: "full-170", url: "ajax.php?act=servertable", page: true, limit: 100, limits: [10, 20, 30, 50, 100, 200, 300, 500, 1000, 2000, 3000, 5000, 10000], title: "应用", // skin: "line", // size: "lg", toolbar: "#server_listTool", where: where(), cols: [ [{ type: "checkbox" }, { field: "id", title: "序号", width: 100, sort: true, align: "center" }, { field: "ip", title: "服务器IP", //minWidth: 100, width: 170, // sort: true }, { field: "serveruser", title: "登录账号", //minWidth: 171, width: 150, // sort: true }, { field: "password", title: "登录密码", //minWidth: 171, width: 150, // sort: true },{ field: "state", title: "是否可用", //minWidth: 108, width: 108, // sort: true, toolbar: "#stateTool" },{ field: "cport", title: "代理端口", //minWidth: 144, width: 100, // sort: true },{ field: "comment", title: "备注", //minWidth: 144, width: 100, // sort: true }] ] }); table.on("toolbar(server_list)", function(obj) { var checkStatus = table.checkStatus(obj.config.id); switch (obj.event) { case "search": reload("server_list"); break; case "New": New(); break; case "Del": Del(table, checkStatus); break; case "edit": // console.log(checkStatus,obj); edit(checkStatus); break; }; }); //选中复选框 $('body').on("click", ".layui-table-body table.layui-table tbody tr td", function () { if ($(this).attr("data-field") === "0") return; $(this).siblings().eq(0).find('i').click(); }); //触发行单击事件 // table.on('row(server_list)', function(obj){ // $(obj.tr).children().children().children().next().addClass('layui-form-checked') // }); table.on("edit(server_list)", function(obj) { // var server = $("[name=server]").val(); console.log(obj) update(obj.data.appcode, obj.data.appname, obj.data.serverip); }); // table.on("select(serverip)", function(obj) { // // var server = $("[name=server]").val(); // console.log(obj) // update(obj.data.appcode, obj.data.appname, obj.data.serverip); // }); form.on("select(server)", function(data) { reload("server_list"); }); laydate.render({ elem: "[name=found_date]", //range: true, done: function() { setTimeout(function() { reload("server_list"); }, 100); } }); form.on("select(account)", function(data) { reload("server_list"); }); form.on("select(notice_state)", function(data) { reload("server_list"); }); form.on("select(register_state)", function(data) { reload("server_list"); }); form.on("select(kami_state)", function(data) { reload("server_list"); }); $(".layui-input").keydown(function(e) { if (e.keyCode == 13) { reload("server_list"); } }); table.on("tool(server_list)", function(obj) { //表格按钮事件 var data = obj.data; switch (obj.event) { case "del": modifyBtn(obj); break; case "modify": modifyBtn(obj); break; case "continued": continued(obj); break; }; }); form.on("switch(state)", function(obj) { console.log(this); $.ajax({ url: "ajax.php?act=upswitch", type: "POST", dataType: "json", data: { state: obj.elem.checked?1:0, ip: this.value }, beforeSend: function() { layer.msg("正在更新", { icon: 16, shade: 0.05, time: false }); }, success: function(data) { layer.msg("更新成功", { icon: data.icon }); }, error: function(data) { var obj = eval(data); layer.alert("更新失败", { icon: 2 }); } }); }); function New() { layer.open({ type: 2, title: "新增服务器", area: ["400px", "400px"], maxmin: false, content: "newserver.php?v=20201111001" }); } table.on('rowDouble(server_list)', function(obj){ var data=obj.data; if(data!=null) { layer.open({ type: 2, title: "编辑服务器列表", area: ["600px", "510px"], maxmin: false, content: "editserver.php?" +"ip="+data.ip +"&serveruser="+data.serveruser +"&password="+data.password +"&cport="+data.cport +"&state="+data.state +"&comment="+data.comment +"&id="+data.id , cancel: function(index, layero) { reload("server_list"); } }); }else{ layer.msg("选中错误!",{ icon: "3" }); } }); function edit(checkStatus) { console.log(checkStatus.data[0]); if (checkStatus.data.length == 1) { layer.open({ type: 2, title: "编辑服务器列表", area: ["600px", "510px"], maxmin: false, content: "editserver.php?" +"ip="+checkStatus.data[0].ip +"&serveruser="+checkStatus.data[0].serveruser +"&password="+checkStatus.data[0].password +"&cport="+checkStatus.data[0].cport +"&state="+checkStatus.data[0].state +"&comment="+checkStatus.data[0].comment +"&id="+checkStatus.data[0].id , cancel: function(index, layero) { reload("server_list"); } }); } else { layer.msg("请选择1条记录", { icon: 3 }); } } function Del(table, checkStatus) { var data = checkStatus.data; console.log(data) var appcode=[]; for (var i = 0; i < data.length; i++) { appcode.push(data[i]['ip']); console.log(data[i]['ip']); } if (data.length > 0) { layer.confirm("确定删除选中的服务器吗?", { icon: 3 }, function() { $.ajax({ url: "ajax.php?act=serverdel", type: "POST", dataType: "json", beforeSend: function() { layer.msg("删除中", { icon: 16, shade: 0.05, time: false }); }, data: { item: appcode, // server: $("[name=server]").val() }, success: function(data) { layer.msg(data.msg, { icon: 1 }); if (data.code == "1") { reload("server_list"); } }, error: function(data) { console.log(data); layer.msg("删除失败", { icon: 5 }); } }); }); } else { layer.msg("未选择记录", { icon: 3 }); } } function update(appcode, appname, serverip) { $.ajax({ url: "ajax.php?act=update", type: "POST", dataType: "json", beforeSend: function() { layer.msg("正在更新数据", { icon: 16, shade: 0.05, time: false }); }, data: { appcode: appcode, appname: appname, serverip: serverip }, success: function(data) { if (data.code== "1") { layer.msg(data.msg, { icon: 1 }); } else { layer.msg(data.msg, { icon: 5 }); } }, error: function(data) { // console.log(data); layer.msg(data.msg, { icon: 5 }); } }); } function query(name) { return $("[name=" + name + "]").val(); } }); function reload(id) { layui.use(["jquery", "table"], function() { var $ = layui.$, table = layui.table; table.reload(id, { page: { curr: 1 }, where: where() }); }); } </script> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/ajax.php
sub_admin/ajax.php
<?php require_once("../includes/Task.php"); require_once("../includes/Scheduler.php"); include("../includes/common.php"); if ($islogin == 1) { } else exit("<script language='javascript'>window.location.href='./login.php';</script>"); $act = isset($_GET['act']) ? daddslashes($_GET['act']) : null; @header('Content-Type: application/json; charset=UTF-8'); // 在文件开头添加错误处理函数 function handleError($error, $act = '', $DB = null, $subconf = null) { $message = is_string($error) ? $error : $error->getMessage(); if ($DB && $subconf) { WriteLog("错误", "[{$act}] {$message}", $subconf['username'], $DB); } return [ "code" => "-1", "msg" => $message, "act" => $act ]; } switch ($act) { case 'getserver': try { $server_list = $DB->selectV2('select id,ip,comment from server_list where username = ?', [$subconf['username']]); $code = [ "code" => "1", "msg" => $server_list ]; exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } catch (Exception $e) { exit(json_encode(handleError($e, 'getserver', $DB, $subconf), JSON_UNESCAPED_UNICODE)); } break; case 'getuseserver': try { $server_list = $DB->selectV2('select id,ip,comment from server_list where state=1 and username = ?', [$subconf['username']]); $code = [ "code" => "1", "msg" => $server_list ]; exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } catch (Exception $e) { exit(json_encode(handleError($e, 'getuseserver', $DB, $subconf), JSON_UNESCAPED_UNICODE)); } break; case 'newapp': try { if (!isset($_POST['server']) || !isset($_POST['username'])) { throw new Exception('缺少必要参数'); } $server = $_POST['server']; $username = $_POST['username']; $dist_name = $DB->selectV2('select appname from application', []); $flag = true; foreach ($dist_name as $key => $name) { if ($username == $name['appname']) { $flag = false; } } if ($flag) { $appcode = md5(uniqid(mt_rand(), 1) . time()); $arr = array( 'appname' => str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $username), 'appcode' => str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $appcode), 'serverip' => str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $server), 'username' => str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $subconf['username']), ); $exec = $DB->insertV2('application', $arr); if ($exec) { $code = [ "code" => "1", "msg" => "添加成功" ]; $cache = Cache::getInstance(); $cache->clear(); // $cxserver=$DB->selectRow("SELECT applist FROM server_list WHERE ip='".addslashes($server)."'"); // $sqlserver="UPDATE server_list set applist='".((empty($cxserver['applist'])?"":$cxserver['applist'].",").$appcode)."' where ip='".addslashes(str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $server))."' "; // $result = $DB->exe($sqlserver); WriteLog("添加用户", "添加了" . $username, $subconf['username'], $DB); } else { $code = [ "code" => "-1", "msg" => "添加失败" ]; } exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } else { $code = [ "code" => "0", "msg" => "应用名重复" ]; exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } } catch (Exception $e) { exit(json_encode(handleError($e, 'newapp', $DB, $subconf), JSON_UNESCAPED_UNICODE)); } break; case "apptable": if (isset($_REQUEST['page']) && isset($_REQUEST['limit']) && isset($_REQUEST['server']) && isset($_REQUEST['appname'])) { // 构建参数化查询 $params = [$subconf['username']]; $sql = 'SELECT appid,appcode,appname,serverip,found_time FROM application where username = ?'; // 服务器sql if ($_REQUEST['server'] != "" && $_REQUEST['server'] != "*") { $sql .= " and serverip = ?"; $params[] = $_REQUEST['server']; } // 应用名字搜索 if ($_REQUEST['appname'] != "") { $sql .= " and appname LIKE ?"; $params[] = '%' . $_REQUEST["appname"] . '%'; } $countpage = $DB->selectRowV2("select count(*) as num from application where username = ?", [$subconf['username']]); $DB->pageNo = $_REQUEST['page']; $DB->pageRows = $_REQUEST['limit']; $app = $DB->selectPageV2($sql, $params); foreach ($app as $key => $apps) { $app[$key]['appid'] = $key + 1; } $json = ["code" => "0", "count" => $countpage['num'], "data" => $app, "icon" => "1"]; exit(json_encode($json, JSON_UNESCAPED_UNICODE)); } else { $json = ["code" => "-1", "count" => null, "data" => "参数错误!", "icon" => "5"]; exit(json_encode($json, JSON_UNESCAPED_UNICODE)); } break; case "delapp": if (isset($_POST['appcode'])) { $exesql = $DB->deleteV2("application", "appcode = ?", [$_REQUEST['appcode']]); if ($exesql !== false) { $code = [ "code" => "1", "msg" => "删除成功" ]; WriteLog("删除应用", "删除了" . $_REQUEST['appcode'], $subconf['username'], $DB); exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } else { $code = [ "code" => "0", "msg" => "未知错误" ]; exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } } else { $json = ["code" => "-1", "count" => null, "data" => "参数错误!", "icon" => "5"]; exit(json_encode($json, JSON_UNESCAPED_UNICODE)); } break; case "seldel": if (!isset($_POST['item'])) { $code = [ "code" => "-1", "msg" => "删除失败" ]; WriteLog("删除失败", "删除失败参数为空", $subconf['username'], $DB); exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } $arr = $_POST['item']; $execs = 0; $execf = 0; for ($i = 0; $i < count($arr); $i++) { $exesql = $DB->deleteV2("application", "appcode = ?", [$arr[$i]]); if ($exesql !== false) { $execs++; } else { $execf++; } } if ($execs == count($arr)) { $code = [ "code" => "1", "msg" => "删除成功" ]; WriteLog("删除", "删除了应用", $subconf['username'], $DB); exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } else { $code = [ "code" => "1", "msg" => "删除成功:" . $execs . "删除失败:" . $execf, ]; WriteLog("删除", "删除了应用", $subconf['username'], $DB); exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } break; case "serverdel": $arr = $_POST['item']; $execs = 0; $execf = 0; for ($i = 0; $i < count($arr); $i++) { $exesql = $DB->deleteV2("server_list", "ip = ?", [$arr[$i]]); if ($exesql !== false) { $execs++; } else { $execf++; } } if ($execs == count($arr)) { $code = [ "code" => "1", "msg" => "删除成功" ]; WriteLog("删除", "删除了服务器", $subconf['username'], $DB); exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } else { $code = [ "code" => "1", "msg" => "删除成功:" . $execs . "删除失败:" . $execf, ]; WriteLog("删除", "删除了服务器", $subconf['username'], $DB); exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } break; case "update": if (isset($_REQUEST['appcode']) && isset($_REQUEST['appname']) && isset($_REQUEST['serverip'])) { $appname = str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $_REQUEST['appname']); $values = [ 'appname' => $appname, 'serverip' => $_REQUEST['serverip'] ]; $result = $DB->updateV2('application', $values, 'appcode = ?', [$_REQUEST['appcode']]); $cxserver = $DB->selectRowV2("SELECT applist FROM server_list WHERE ip = ?", [$_REQUEST['serverip']]); if ($result !== false) { $code = [ "code" => "1", "msg" => "更新成功!" ]; WriteLog("更新", "更新了" . $_REQUEST['appname'], $subconf['username'], $DB); exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } else { $code = [ "code" => "-1", "msg" => "更新失败!" ]; exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } } else { $json = ["code" => "-1", "msg" => "参数错误!"]; exit(json_encode($json, JSON_UNESCAPED_UNICODE)); } break; case "servertable": if (isset($_REQUEST['page']) && isset($_REQUEST['limit']) && isset($_REQUEST['ip']) && isset($_REQUEST['comment'])) { // 构建参数化查询 $params = [$subconf['username']]; $sql = 'SELECT id,ip,serveruser,password,cport,state,comment FROM server_list where username = ?'; // 服务器IP if ($_REQUEST['ip'] != "") { $sql .= " and ip = ?"; $params[] = $_REQUEST['ip']; } // 备注搜索 if ($_REQUEST['comment'] != "") { $sql .= " and comment LIKE ?"; $params[] = '%' . $_REQUEST["comment"] . '%'; } $countpage = $DB->selectRowV2("select count(*) as num from server_list where username = ?", [$subconf['username']]); $DB->pageNo = $_REQUEST['page']; $DB->pageRows = $_REQUEST['limit']; $app = $DB->selectPageV2($sql, $params); $json = ["code" => "0", "count" => $countpage['num'], "data" => $app, "icon" => 1]; exit(json_encode($json, JSON_UNESCAPED_UNICODE)); } else { $json = ["code" => "-1", "count" => null, "data" => "参数错误!", "icon" => "5"]; exit(json_encode($json, JSON_UNESCAPED_UNICODE)); } break; case "newserver": $serverip = $_POST['serverip']; $ccpusername = $_POST['ccpusername']; $ccppassword = $_POST['ccppassword']; $ccpport = $_POST['ccpport']; $state = $_POST['state'] == null ? "0" : "1"; $comment = $_POST['comment']; $dist_ip = $DB->selectV2('select ip from server_list', []); $flag = true; foreach ($dist_ip as $key => $name) { if ($serverip == $name['ip']) { $flag = false; } } if ($flag) { $valid = count(explode(".", $serverip)); if ($valid < 2) { $json = [ "code" => "-1", "msg" => "输入了错误的IP或者域名", "icon" => "5" ]; exit(json_encode($json, JSON_UNESCAPED_UNICODE)); } if (!ValidPort($ccpport)) { $json = [ "code" => "-1", "msg" => "输入了错误的端口号", "icon" => "5" ]; exit(json_encode($json, JSON_UNESCAPED_UNICODE)); } $arr = array( 'ip' => str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $serverip), 'serveruser' => str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $ccpusername), 'password' => str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $ccppassword), 'cport' => str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $ccpport), 'state' => str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $state), 'comment' => str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $comment), 'username' => str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $subconf['username']) ); $exec = $DB->insertV2('server_list', $arr); if ($exec) { $code = [ "code" => "1", "msg" => "添加成功" ]; WriteLog("添加服务器", "添加了一个服务器" . $serverip, $subconf['username'], $DB); } else { $code = [ "code" => "-1", "msg" => "添加失败" ]; } exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } else { $code = [ "code" => "0", "msg" => "服务器IP重复" ]; exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } break; case "upswitch": if (isset($_POST['ip']) && isset($_POST["state"])) { $ip = str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $_POST['ip']); $result = $DB->updateV2('server_list', ['state' => $_POST["state"]], 'ip = ?', [$ip]); if ($result !== false) { $code = [ "code" => "1", "msg" => "更新成功" ]; WriteLog("操作开关", "开关" . $_POST['ip'], $subconf['username'], $DB); } else { $code = [ "code" => "0", "msg" => "更新失败" ]; } exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } else { $code = [ "code" => "0", "msg" => "参数错误" ]; exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } break; case "getkami": if (isset($_REQUEST['page']) && isset($_REQUEST['limit']) && isset($_REQUEST['code']) && isset($_REQUEST['found_date']) && isset($_REQUEST['use_date']) && isset($_REQUEST['sc_user']) && isset($_REQUEST['state']) && isset($_REQUEST['comment']) && isset($_REQUEST['app'])) { // 构建参数化查询 $params = [$subconf['siteurl']]; $sql = 'SELECT * FROM kami where host = ?'; if ($_REQUEST['code'] != "") { $sql .= " and kami = ?"; $params[] = $_REQUEST['code']; } if ($_REQUEST['found_date'] != "") { $sql .= " and found_date = ?"; $params[] = $_REQUEST['found_date']; } if ($_REQUEST['use_date'] != "") { $sql .= " and use_date = ?"; $params[] = $_REQUEST['use_date']; } if ($_REQUEST['sc_user'] != "") { $sql .= " and sc_user = ?"; $params[] = $_REQUEST['sc_user']; } if ($_REQUEST['state'] != "") { $sql .= " and state = ?"; $params[] = $_REQUEST['state']; } if ($_REQUEST['comment'] != "") { $sql .= " and comment = ?"; $params[] = $_REQUEST['comment']; } if ($_REQUEST['app'] != "") { $sql .= " and app = ?"; $params[] = $_REQUEST['app']; } $sql .= " order by found_date desc"; $countpage = $DB->selectRowV2("select count(*) as num from kami where sc_user = ?", [$subconf['username']]); $DB->pageNo = $_REQUEST['page']; $DB->pageRows = $_REQUEST['limit']; $app = $DB->selectPageV2($sql, $params); foreach ($app as $key => $apps) { $app[$key]['id'] = $key + 1; if ($app[$key]['state'] == 1) { $app[$key]['state'] = "<span style='color:red'>已激活</span>"; } else { $app[$key]['state'] = "<span style='color:green'>未激活</span>"; } $app[$key]['times'] = KamiPaeseString($app[$key]['times']); } $json = ["code" => "0", "count" => $countpage['num'], "data" => $app, "icon" => "1"]; exit(json_encode($json, JSON_UNESCAPED_UNICODE)); } else { $json = ["code" => "-1", "count" => null, "data" => "参数错误!", "icon" => "5"]; exit(json_encode($json, JSON_UNESCAPED_UNICODE)); } break; case "newkami": if (isset($_POST['app']) && isset($_POST['qianzhui']) && isset($_POST["duration"]) && isset($_POST["kamidur"]) && isset($_POST["kaminum"]) && isset($_POST["comment"]) && isset($_POST["kamilen"]) && isset($_POST["connection"]) && isset($_POST["bandwidthup"]) && isset($_POST["bandwidthdown"])) { // $sql="UPDATE server_list SET state=\"".addslashes($_POST["state"])."\" WHERE ip=\"".addslashes(str_replace(array("<",">","/"),array("&lt;","&gt;",""),$_POST['ip']))."\" "; // $result=$DB->exe($sql); if (!empty($_POST["connection"]) && !is_numeric($_POST["connection"])) { exit(json_encode($code = ["code" => "-1", "msg" => "输入类型错误", "kami" => ""], JSON_UNESCAPED_UNICODE)); } if (!empty($_POST["bandwidthup"]) && !is_numeric($_POST["bandwidthup"])) { exit(json_encode($code = ["code" => "-1", "msg" => "输入类型错误", "kami" => ""], JSON_UNESCAPED_UNICODE)); } if (!empty($_POST["bandwidthdown"]) && !is_numeric($_POST["bandwidthdown"])) { exit(json_encode($code = ["code" => "-1", "msg" => "输入类型错误", "kami" => ""], JSON_UNESCAPED_UNICODE)); } if (!empty($_POST["kamidur"])) { if (intval($_POST["kamidur"]) < 1) { exit(json_encode($code = ["code" => "-1", "msg" => "自定义时长不能小于1,也不能为小数!", "kami" => ""], JSON_UNESCAPED_UNICODE)); } $vlidnum = count(explode(".", $_POST["kamidur"])); if ($vlidnum >= 2) { exit(json_encode($code = ["code" => "-1", "msg" => "自定义时长不能为小数!", "kami" => ""], JSON_UNESCAPED_UNICODE)); } } $kamidurdangwei = "+" . intval((!empty($_POST["kamidur"]) ? $_POST["kamidur"] : $_POST["duration"])); $kamicount = 0; if (isset($_POST["year"]) && $_POST["year"] == "on") { $kamidurdangwei .= " year"; $kamicount++; } if (isset($_POST["month"]) && $_POST["month"] == "on") { $kamidurdangwei .= " month"; $kamicount++; } if (isset($_POST["day"]) && $_POST["day"] == "on") { $kamidurdangwei .= " day"; $kamicount++; } if (isset($_POST["hour"]) && $_POST["hour"] == "on") { $kamidurdangwei .= " hour"; $kamicount++; } if ($kamicount != 1) { exit(json_encode($code = ["code" => "-1", "msg" => "请选择卡密类型", "kami" => ""], JSON_UNESCAPED_UNICODE)); } $kami = array(); for ($i = 0; $i < $_POST["kaminum"]; $i++) { $kami[$i] = array( "kami" => random($_POST["kamilen"] == "" ? 16 : $_POST["kamilen"], $_POST['qianzhui'] == "" ? null : $_POST['qianzhui']) ); } if (empty($_POST["connection"]) || $_POST["connection"] <= 0) { $_POST["connection"] = -1; } if (empty($_POST["bandwidthup"]) || $_POST["bandwidthup"] <= 0) { $_POST["bandwidthup"] = -1; } else { $_POST["bandwidthup"] *= 1024; } if (empty($_POST["bandwidthdown"]) || $_POST["bandwidthdown"] <= 0) { $_POST["bandwidthdown"] = -1; } else { $_POST["bandwidthdown"] *= 1024; } $flag = true; $ext = [ "connection" => empty($_POST["connection"]) ? -1 : (int)$_POST["connection"], "bandwidthup" => empty($_POST["bandwidthup"]) ? -1 : (int)$_POST["bandwidthup"], "bandwidthdown" => empty($_POST["bandwidthdown"]) ? -1 : (int)$_POST["bandwidthdown"] ]; foreach ($kami as $key => $ka) { $arr = array( 'kami' => $kami[$key]["kami"], 'times' => $kamidurdangwei, 'host' => $subconf['siteurl'], 'sc_user' => $subconf['username'], 'state' => 0, 'app' => $_POST["app"], 'comment' => $_POST["comment"], 'ext' => json_encode($ext) ); $exec = $DB->insertV2('kami', $arr); if (!$exec) { $flag = false; } } if ($flag) { if (isset($_POST['copy'])) { $code = [ "code" => "2", "msg" => "更新成功", "kami" => $kami ]; WriteLog("卡密", "卡密" . $_POST['app'], $subconf['username'], $DB); } else { $code = [ "code" => "1", "msg" => "更新成功" ]; WriteLog("卡密", "卡密" . $_POST['app'], $subconf['username'], $DB); } } else { $code = [ "code" => "0", "msg" => "更新失败" ]; } exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } else { $code = [ "code" => "0", "msg" => "参数错误" ]; exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } break; case "getapp": $query = $DB->selectV2('SELECT appcode,appname FROM application where username = ?', [$subconf['username']]); $code = [ "code" => "1", "msg" => $query ]; exit(json_encode($code, JSON_UNESCAPED_UNICODE)); break; case "delkami": $arr = $_POST['item']; if ($arr == null || !(isset($arr)) || empty($arr)) { $code = [ "code" => "-1", "msg" => "删除失败参数为空!", ]; exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } $execs = 0; $execf = 0; for ($i = 0; $i < count($arr); $i++) { $exesql = $DB->deleteV2("kami", "kami = ?", [$arr[$i]]); if ($exesql !== false) { $execs++; } else { $execf++; } } if ($execs == count($arr)) { $code = [ "code" => "1", "msg" => "删除成功" ]; WriteLog("删除卡密", "删除了卡密", $subconf['username'], $DB); exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } else { $code = [ "code" => "1", "msg" => "删除成功:" . $execs . "删除失败:" . $execf, ]; WriteLog("删除卡密", "删除了卡密", $subconf['username'], $DB); exit(json_encode($code, JSON_UNESCAPED_UNICODE)); } break; case "updatepwd": if (isset($_POST['out_password']) && isset($_POST["password"]) && isset($_POST["confirm_password"])) { if ($_POST["password"] != $_POST["confirm_password"]) { $code = [ "code" => "-1", "msg" => "二次密码不一致" ]; } else { if ($_POST['out_password'] == $_POST["confirm_password"]) { $code = [ "code" => "-3", // "msg" => "三次次密码一致" "msg" => "与原密码一致" ]; } else { if ($subconf['password'] == $_POST['out_password']) { $username = str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $subconf['username']); $result = $DB->updateV2('sub_admin', ['password' => $_POST["confirm_password"]], 'username = ?', [$username]); if ($result !== false) { $code = [ "code" => "1", "msg" => "更新成功" ]; WriteLog("修改密码", "密码已修改", $subconf['username'], $DB); } else { $code = [ "code" => "0", "msg" => "更新失败" ]; } } else { $code = [ "code" => "-2", "msg" => "原密码不正确" ]; } } } } else { $code = [ "code" => "0", "msg" => "参数错误" ]; } exit(json_encode($code, JSON_UNESCAPED_UNICODE)); break; case "updateset": $requiredFields = ['user_key', 'kf', 'pan', 'ggswitch', 'wzgg', 'logo']; $gg = 1; if (!isset($_POST['ggswitch'])) { array_splice($requiredFields, 3, 1); //删除数组的ggswictch $gg = 0; } $flag = true; foreach ($requiredFields as $post) { $flag = isset($_POST[$post == "wzgg" ? "user_key" : $post]); } if ($flag) { $values = [ 'hostname' => $_POST["user_key"], 'kf' => $_POST["kf"], 'pan' => $_POST["pan"], 'img' => $_POST["logo"], 'ggswitch' => $gg ]; if ($gg != 0) { $values['wzgg'] = trim(str_replace(array("'"), array('"'), $_POST["wzgg"])); } $username = str_replace(array("<", ">", "/"), array("&lt;", "&gt;", ""), $subconf['username']); $result = $DB->updateV2('sub_admin', $values, 'username = ?', [$username]); if ($result !== false) { $code = [ "code" => "1", "msg" => "保存成功" ]; WriteLog("更新网站设置", "设置内容不详", $subconf['username'], $DB); } else { $code = [ "code" => "0", "msg" => "更新失败" ]; } } else { $code = [ "code" => "0", "msg" => "参数错误" ]; } exit(json_encode($code, JSON_UNESCAPED_UNICODE)); break; case "getuserall": try { $sqlj = ""; if (!isset($_REQUEST['page']) || !isset($_REQUEST['limit'])) { throw new Exception("缺少必要的分页参数"); } if ($_REQUEST['user'] == "") { if ($_REQUEST['app'] == "") { // 使用缓存 $cache = Cache::getInstance(); if (!$cache) { throw new Exception("无法初始化缓存实例"); } $cacheKey = md5("getuserall"); $cached = $cache->get($cacheKey); if ($cached !== null) { exit($cached); } //搜索全部服务器 $ser = SerchearchAllServer("", "", $DB); if (!$ser) { throw new Exception("获取服务器列表失败"); } $user_data = array(); while ($ser->valid()) { $current = $ser->current(); if (!empty($current)) { // 确保当前数据不为空 array_push($user_data, $current); } $ser->next(); } // 检查 $user_data 是否为空 if (empty($user_data)) { throw new Exception("未找到用户数据"); } // 确保第一个元素存在且为数组 if (!isset($user_data[0]) || !is_array($user_data[0])) { throw new Exception("用户数据格式错误"); } $result = array_reduce($user_data, function ($result, $value) { if (!is_array($value)) { return $result; } return array_merge($result ?: [], array_values($value)); }, []); // 检查处理结果 if (empty($result)) { throw new Exception("处理用户数据失败"); } $user_updata = array(); foreach ($result as $key => $value) { try { $appname = $DB->selectRowV2("SELECT appname FROM application WHERE serverip = ?", [$value["serverip"]]); $getdata = array( "id" => $value['id'], "user" => $value['user'], "pwd" => $value['pwd'], "state" => $value['state'], "pwdstate" => $value['pwdstate'], "disabletime" => $value['autodisable'] == 0 ? '2099-10-13 14:34:26' : $value['disabletime'], "expire" => $value['autodisable'] == 0 ? 0 : $value['expire'], "user" => $value['user'], 'serverip' => $value["serverip"], 'appname' => $appname ? $appname['appname'] : '未知', "connection" => $value['connection'] == -1 ? "无限制" : $value['connection'], "bandwidthup" => $value['bandwidthup'] == -1 ? "无限制" : ($value['bandwidthup'] < -1 ? $value['bandwidthup'] : $value['bandwidthup'] / 1024), "bandwidthdown" => $value['bandwidthdown'] == -1 ? "无限制" : ($value['bandwidthdown'] < -1 ? $value['bandwidthdown'] : $value['bandwidthdown'] / 1024) ); array_push($user_updata, $getdata);
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
true
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/login.php
sub_admin/login.php
<?php /* * @Author: yihua * @Date: 2025-01-04 17:32:11 * @LastEditTime: 2025-01-05 22:24:13 * @LastEditors: yihua * @Description: 登录 * @FilePath: \ccproxy_end\sub_admin\login.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ include("../includes/common.php"); // 登出处理 if (isset($_GET['logout'])) { // 定义要更新的表 $table = 'sub_admin'; // 要更新的字段和值 $values = [ 'cookies' => '' ]; // 执行更新操作(使用参数化查询) $affectedRows = $DB->updateV2($table, $values, 'username = ?', [$subconf['username']]); // 生成新的session id防止会话固定攻击 session_regenerate_id(true); setcookie("sub_admin_token", "", time() - 604800); session_destroy(); $json = ["code" => "0", "msg" => "您已成功注销本次登录!"]; exit(json_encode($json, JSON_UNESCAPED_UNICODE)); } // 检查是否已登录 if ($islogin == 1) { exit('<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>提示</title> <script src="../assets/layui/layui.js"></script> <link rel="stylesheet" href="../assets/layui/css/layui.css"> </head> <body> <script> layui.use(["layer"], function(){ var layer = layui.layer; layer.alert("您已登录,无需重复登录", { title: "温馨提示", icon: 1, skin: "layui-layer-molv", anim: 4, btn: ["确定"], yes: function(){ window.location.href="./index.php"; } }); }); </script> </body> </html>'); } // 生成CSRF Token(如果不存在) if (empty($_SESSION['token'])) { $_SESSION['token'] = bin2hex(random_bytes(32)); } if (isset($_POST['username']) && isset($_POST['password'])) { try { // CSRF验证 if ( empty($_POST['token']) || empty($_SESSION['token']) || !hash_equals($_SESSION['token'], $_POST['token']) ) { throw new Exception("请求验证失败,请刷新页面重试!!!"); } // 基础输入过滤 $user = trim(daddslashes($_POST['username'])); $pass = trim(daddslashes($_POST['password'])); $code = trim(daddslashes($_POST['code'])); // 验证码检查 if ( !$code || !isset($_SESSION['xx_session_code']) || strtolower($code) !== strtolower($_SESSION['xx_session_code']) ) { throw new Exception("验证码错误!"); } // 使用参数化方式构建查询 $row = $DB->selectRowV2("SELECT * FROM sub_admin WHERE username=?", [$user]); if ($row) { // 验证密码 (假设密码已经使用password_hash存储) if ($row['password'] && $pass === $row['password']) { // 登录成功处理 unset($_SESSION['xx_session_code']); // 生成新的session id防止会话固定攻击 session_regenerate_id(true); // 生成安全的session值 $session = md5($user . $pass . $password_hash); $cookies = authcode("{$user}\t{$session}", 'ENCODE', SYS_KEY); // 设置安全的cookie setcookie("sub_admin_token", $cookies, [ 'expires' => time() + 604800, 'path' => '/', 'httponly' => true, 'samesite' => 'Strict' ]); setCookie("tab", "primary.php", [ 'expires' => time() + 604800, 'path' => '/', 'httponly' => true ]); // 定义要更新的表 $table = 'sub_admin'; // 要更新的字段和值 $values = [ 'cookies' => $cookies ]; // 执行更新操作(使用参数化查询) $affectedRows = $DB->updateV2($table, $values, 'username = ?', [$row['username']]); WriteLog("登录日志", "登录成功", $user, $DB); $json = ["code" => "1", "msg" => "登录成功,欢迎您使用本系统!"]; exit(json_encode($json, JSON_UNESCAPED_UNICODE)); } } // 登录失败处理 throw new Exception("用户名或密码不正确!"); } catch (Exception $e) { unset($_SESSION['xx_session_code']); $json = ["code" => "-1", "msg" => $e->getMessage()]; WriteLog("登录日志", "验证失败: " . $e->getMessage(), $user ?? null, $DB); exit(json_encode($json, JSON_UNESCAPED_UNICODE)); } } ?> <!-- HTML部分修改 --> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta http-equiv="X-Content-Type-Options" content="nosniff"> <!-- <meta http-equiv="X-Frame-Options" content="DENY"> 已禁用,允许 iframe 嵌入 --> <title><?php echo htmlspecialchars($subconf['hostname']) ?>后台登录</title> <?php include("foot.php"); ?> <link rel="stylesheet" href="../assets/layui/css/logon.css"> <style> /* 整体淡入动画 */ .layout-main { animation: fadeIn 0.8s ease-out; } @keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } } /* 标题动画 */ .layout-title { animation: slideDown 1s ease-out; } @keyframes slideDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } } /* 输入框焦点动画 */ .layui-input { transition: all 0.3s ease; border: 1px solid #e6e6e6; } .layui-input:focus { border-color: #1E9FFF; box-shadow: 0 0 8px rgba(30,159,255,0.2); transform: translateY(-1px); } /* 登录按钮动画 */ .layui-btn { transition: all 0.3s ease; } .layui-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); } /* 验证码图片悬停效果 */ .codeimg { transition: all 0.3s ease; } .codeimg:hover { transform: scale(1.02); cursor: pointer; } </style> </head> <body> <div class="layout-main"> <div class="layout-title">后台登录</div> <div class="layout-explain" style="animation: fadeIn 1.2s ease-out;">KUBTCOIN</div> <!-- 原有的HTML结构不变,只添加token隐藏字段 --> <div class="layout-content layui-form layui-form-pane"> <div class="layui-form-item" style="display:none;"> <input type="hidden" name="token" value="<?php echo htmlspecialchars($_SESSION['token']); ?>"> </div> <!-- 其他表单内容保持不变 --> <div class="layui-form-item"> <label class="layui-form-label"><i class="layui-icon layui-icon-username"></i></label> <div class="layui-input-block"> <input type="text" name="username" lay-verify="required" lay-reqtext="用户名是必填项,岂能为空?" class="layui-input" placeholder="请输入用户名" title="用户名"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"><i class="layui-icon layui-icon-password"></i></label> <div class="layui-input-block"> <input type="password" name="password" lay-verify="required" lay-reqtext="密码是必填项,岂能为空?" class="layui-input" placeholder="请输入密码" title="登录密码"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"><i class="layui-icon layui-icon-vercode"></i></label> <div class="layui-input-block"> <input style="width:50%;display:inline" type="text" name="code" lay-verify="required" lay-reqtext="请输入验证码" class="layui-input" placeholder="请输入验证码" title="验证码"> <img class="codeimg" style="float: right;" src="./code.php?r=<?php echo time(); ?>" width="45%" height="38" title="点击更换验证码"> </div> </div> <div class="layui-form-item nob"> <button class="layui-btn layui-btn-fluid layui-btn-normal" lay-submit lay-filter="submit">登录</button> </div> <div class="extend"> </div> </div> </div> <div class="layout-copyright"> </div> </body> <script> layui.use(["jquery", "form"], function() { var $ = layui.$, form = layui.form; // 防止重复提交 var isSubmitting = false; $(function() { document.onkeydown = function(e) { var keyCode = e.keyCode || e.which || e.charCode; var ctrlKey = e.ctrlKey || e.metaKey; if (keyCode == 13) { $(".layui-btn.layui-btn-fluid").trigger("click"); } }; form.on("submit(submit)", function(data) { if (isSubmitting) return false; isSubmitting = true; // 确保从隐藏字段获取 token var token = $('input[name="token"]').val(); if (!token) { layer.msg("验证信息缺失,请刷新页面重试", { icon: 5 }); return false; } data.field.token = token; $.ajax({ url: "login.php?act", type: "POST", dataType: "json", data: data.field, timeout: 10000, // 添加超时设置 beforeSend: function() { layer.msg("正在登录", { icon: 16, shade: 0.05, time: false }); }, success: function(res) { if (res.code == "1") { layer.msg(res.msg, { icon: 1 }); setTimeout(function() { window.location.href = "./index.php"; }, 500); } else { layer.msg(res.msg, { icon: 5 }); refreshCaptcha(); } }, error: function(xhr, status, error) { layer.msg("登录失败,请稍后重试", { icon: 5 }); refreshCaptcha(); }, complete: function() { isSubmitting = false; } }); return false; }); // 验证码刷新函数 function refreshCaptcha() { $(".codeimg").prop("src", './code.php?r=' + Math.random()); } // 验证码点击刷新 $(".codeimg").click(refreshCaptcha); }); // 添加输入框动画效果 $('.layui-input').focus(function() { $(this).parent().parent().addClass('focused'); }).blur(function() { $(this).parent().parent().removeClass('focused'); }); // 优化按钮点击效果 $('.layui-btn').on('mousedown', function() { $(this).css('transform', 'scale(0.95)'); }).on('mouseup mouseleave', function() { $(this).css('transform', ''); }); // 添加表单提交动画 form.on("submit(submit)", function(data) { if (isSubmitting) return false; isSubmitting = true; // 确保从隐藏字段获取 token var token = $('input[name="token"]').val(); if (!token) { layer.msg("验证信息缺失,请刷新页面重试", { icon: 5 }); return false; } data.field.token = token; // 添加提交时的动画 $('.layout-content').css('opacity', '0.8'); $.ajax({ url: "login.php?act", type: "POST", dataType: "json", data: data.field, timeout: 10000, // 添加超时设置 beforeSend: function() { layer.msg("正在登录", { icon: 16, shade: 0.05, time: false }); }, success: function(res) { if (res.code == "1") { layer.msg(res.msg, { icon: 1 }); setTimeout(function() { window.location.href = "./index.php"; }, 500); } else { layer.msg(res.msg, { icon: 5 }); refreshCaptcha(); } }, error: function(xhr, status, error) { layer.msg("登录失败,请稍后重试", { icon: 5 }); refreshCaptcha(); }, complete: function() { isSubmitting = false; $('.layout-content').css('opacity', '1'); } }); return false; }); }); </script> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/hostset.php
sub_admin/hostset.php
<?php include '../includes/common.php'; if (!($islogin == 1)) { exit('<script language=\'javascript\'>alert("您还没有登录,请先登录!");window.location.href=\'login.php\';</script>'); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> <?php echo $subconf['hostname']; ?>-网站设置 </title> <!-- <link rel="stylesheet" href="../assets/layui/css/layui.css?v=20201111001"> <link rel="stylesheet" type="text/css" href="../css/theme.css" /> --> <?php include("foot.php"); ?> </head> <body> <div class="layui-card layui-form"> <!-- <div class="layui-card-header">网站设置</div> --> <div class="layui-card-body"> <div class="layui-tab"> <ul class="layui-tab-title"> <li class="layui-this">网站设置</li> </ul> <div class="layui-tab-content"> <div class="layui-tab-item layui-show layui-line form"> <div class="layui-form-item"> <label class="layui-form-label"> 网站标题 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="user_key" class="layui-input" value="<?php echo $subconf['hostname']; ?>" placeholder="请输入网站标题"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 网站客服 </label> <div class="layui-input-block"> <input type="text" name="kf" class="layui-input" value="<?php echo $subconf['kf'];?>" placeholder="请输入客服QQ的链接"> </div> </div> <!-- <blockquote class="layui-elem-quote">温馨提示:请把以下的域名信息修改为您的。</blockquote> --> <div class="layui-form-item"> <label class="layui-form-label"> 网盘 </label> <div class="layui-input-block"> <input type="text" name="pan" class="layui-input" value="<?php echo $subconf['pan']; ?>" placeholder="请输入网盘链接"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 首页LOGO </label> <div class="layui-input-block"> <input type="text" name="logo" class="layui-input" value="<?php echo $subconf['img']; ?>" placeholder="LOGO直链接"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 公告 </label> <div class="layui-input-block"> <input type="checkbox" name="ggswitch" lay-skin="switch" lay-text="开启|关闭" lay-filter="ggswitch" <?php echo($subconf["ggswitch"]==1 ? 'checked':'');?> /> </div> <div class="wzggs"> <?php if($subconf['ggswitch']==1){ echo '<div class="layui-form-item"><div class="gg"> <label class="layui-form-label"> 网站公告 </label> <div class="layui-input-block"> <textarea name="wzgg" class="layui-textarea">'. $subconf['wzgg'].'</textarea> </div> </div></div>'; } ?> </div> </div> </div> <div class="layui-form-item"> <div class="layui-input-block"> <button class="layui-btn layui-btn-normal layui-btn-sm" lay-submit lay-filter="submit">保存设置</button> <button class="layui-btn layui-btn-normal layui-btn-sm" lay-submit lay-filter="reset">重置</button> </div> </div> </div> </div> </div> </div> </body> <!-- <script src="https://www.layuicdn.com/layui/layui.js"> --> </script> <script> layui.use(["jquery", "form", "element","util"], function() { var $ = layui.$, form = layui.form, element = layui.element, layedit =layui.layedit, util = layui.util; form.on("submit(submit)", function(data) { //console.log(util.escape("dsadsadas")) //console.log(data.field['wzgg']=data.field.wzgg.replaceAll("script"," ")); data.field['wzgg']=data.field.wzgg.replaceAll("< >"," ") data.field['wzgg']=data.field.wzgg.replaceAll("</ >"," ") data.field['wzgg']=data.field.wzgg.replaceAll("document"," ")//util.escape( data.field['wzgg']=data.field['wzgg'].replaceAll("'",'"'); data.field['wzgg']=data.field['wzgg'].replace(/\n|\r/g,""); $.ajax({ url: "ajax.php?act=updateset", type: "POST", dataType: "json", data: data.field, beforeSend: function() { layer.msg("正在更新", { icon: 16, shade: 0.05, time: false }); }, success: function(data) { if(data.code==1){ layer.msg("保存成功", { icon: 1 }); } else{ layer.msg(data.responseText, { icon: 5 }); } }, error: function(data) { console.log(data); layer.msg(data.responseText, { icon: 5 }); } }); return false; }); form.on("submit(reset)", function(){ console.log($("[name=user_key]").val("一花端口")) console.log($("[name=kf]").val("487735913")) console.log($("[name=pan]").val("https://img.17sucai.com/upload/2413762/2021-12-20/5359f0623d9bcaa356031498e1600634.png?x-oss-process=style/big")) console.log($("[name=logo]").val("https://img.17sucai.com/upload/2413762/2021-12-20/5359f0623d9bcaa356031498e1600634.png?x-oss-process=style/big")) console.log($("[name=wzgg]").val('测试公告<br>公告<br>公告<br><div style="color:red"><span>测试公告</span></div>')) }); // function init() { // $.ajax({ // url: "../php/setup.php", // type: "POST", // dataType: "json", // success: function(data) { // if (data.icon == "1") { // for (var key in data.data) { // if (key != "account" && key != "auto_insert") { // $("[name=" + key + "]").val(data.data[key]); // } // } // } // $("[name=account][value=" + data.data.account + "]").attr("checked", "checked"); // $("[name=auto_insert]").attr("checked", data.data.auto_insert == "1" ? "checked" : false); // form.render(); // }, // error: function(data) { // console.log(data); // layer.msg(data.responseText, { // icon: 5 // }); // } // }); // } // init(); form.on("switch(ggswitch)", function(obj) { var checked = obj.elem.checked; if(checked){ console.log($(".gg").eq(0).show()) $(".wzggs").eq(0).html('<div class="layui-form-item"><div class="gg"> <label class="layui-form-label"> 网站公告 </label> <div class="layui-input-block"> <textarea name="wzgg" id="wzggs" class="layui-textarea"></textarea></div> </div></div>'); $("#wzggs").html(util.escape('<?php echo $subconf['wzgg'] ?>')); }else{ console.log($(".gg").eq(0).hide()) $(".wzggs").eq(0).html(); } }); // layedit.build('wzgg',{ // tool: [ // 'strong' //加粗 // ,'italic' //斜体 // ,'underline' //下划线 // ,'del' //删除线 // ,'|' //分割线 // ,'left' //左对齐 // ,'center' //居中对齐 // ,'right' //右对齐 // ,'link' //超链接 // ,'unlink' //清除链接 // ] // }); // layedit.sync('wzgg'); }); </script> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/newuser.php
sub_admin/newuser.php
<?php include("../includes/common.php"); if (!($islogin == 1)) { exit('<script language=\'javascript\'>alert("您还没有登录,请先登录!");window.location.href=\'login.php\';</script>'); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title><?php echo $subconf['hostname'] ?>添加用户</title> <meta name="renderer" content="webkit" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> <?php include("foot.php"); ?> <!-- <link rel="stylesheet" href="../assets/layui/css/layui.css?v=20201111001?v=20201111001" /> <link rel="stylesheet" type="text/css" href="./css/theme.css?v=20201111001" /> --> <style> body { background-color: #FFFFFF; padding-right: 80px; } #layui-laydate1{ top: 0!important; } .usetime{ display: none; } .layui-form-selectup dl{ top: auto; bottom: auto; } </style> </head> <body class="layui-form form"> <div class="layui-form-item"> <label class="layui-form-label"> 用户名 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="user" class="layui-input" lay-verify="required" placeholder="请填写用户名" /> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 密码 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="pwd" class="layui-input" lay-verify="required" placeholder="请填写用户密码" /> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 使用期限 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <select name="expire" lay-verify="required" lay-filter="expire"> <option value=""></option> <option value="1">1天</option> <option value="7">7天</option> <option value="30">30天</option> <option value="-1">自定义</option> </select> </div> </div> <div class="layui-form-item usetime"> <label class="layui-form-label" title="使用时间"> 使用时间 <span class="layui-must">*</span> </label> <div class="layui-input-inline"> <input type="text" name="use_date" class="layui-input" placeholder="YYYY-MM-DD"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label" title="应用"> 应用 <span class="layui-must">*</span> </label> <div class="layui-input-inline"> <select lay-verify="required" name="app" lay-filter="state"> <option value="">请选择一个应用</option> </select> </div> </div> <!-- <div class="layui-form-item"> <label class="layui-form-label"> 密码 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="number" name="password" class="layui-input" lay-verify="required" placeholder="纯数字密码"/> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 到期时间 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="end_date" class="layui-input" lay-verify="required" placeholder="YYYY-mm-dd HH:ii-dd" /> </div> </div> --> <div class="layui-form-item"> <div class="layui-input-block"> <button class="layui-btn layui-btn-normal layui-btn-sm" lay-submit lay-filter="submit">确定</button> </div> </div> </body> <!-- <script src="https://www.layuicdn.com/layui/layui.js?v=20201111001"></script> --> <script type="text/javascript" src="../assets/js/xss.js"></script> <script> layui.use(["jquery", "form", "laydate"], function() { var $ = layui.$, form = layui.form, laydate = layui.laydate; form.on('select(expire)', function(data) { // console.log(data.value==-1?$(da):) if(data.value==-1){ $(".usetime").eq(0).css("display","block"); } else{ $(".usetime").eq(0).css("display","none"); } // var duration = Number(data.value); // var price = duration * unit; }); $(".layui-input").eq(0).focus(); form.on("submit(submit)", function(data) { if(data.field.expire==-1){ if(data.field.use_date==""){ layer.msg("自定义时长不能为空!", { icon: 5 }); return; } } console.log(data); $.ajax({ url: "ajax.php?act=adduser", type: "POST", dataType: "json", data: { userdata: data.field }, beforeSend: function() { layer.msg("正在提交", { icon: 16, shade: 0.05, time: false }); }, success: function(data) { if (data.code == "1") { parent.layer.closeAll(); parent.layer.msg(data.msg, { icon: 1 }); setTimeout(function(){ window.parent.frames.reload('server_list'); },100); } else { layer.msg(data.msg == null ? "未知错误" : data.msg, { icon: 5 }); } console.log(data); // if (data.icon == "1") { // } else { // layer.msg(data.code, { // icon: data.icon // }); // } }, error: function(data) { console.log(data); layer.msg("保存数据失败", { icon: 5 }); } }); return false; }); function select() { $.ajax({ url: "ajax.php?act=getapp", type: "POST", dataType: "json", success: function(data) { if (data.code == "1") { var elem = $("[name=app]"); for (var key in data.msg) { var json = data.msg[key], appname = json.appname, appcode = json.appcode; item = '<option value="' + appcode + '">' + appname + '</option>'; elem.append(item); } form.render("select"); } }, error: function(data) { layer.msg("获取用户失败", { icon: 5 }); } }); }; laydate.render({ elem: "[name=use_date]", //range: true, done: function() { // setTimeout(function() { // window.parent.frames.reload('server_list'); // }, 1000); } }); // laydate.render({ // elem: "[name=end_date]", // type: "datetime" // }); // function select() { // $.ajax({ // url: "ajax.php?act=getserver", // type: "POST", // dataType: "json", // success: function(data) { // if (data.code == "1") { // var elem = $("[name=server]"); // for (var key in data.msg) { // // console.log(data.msg[key]); // var json = data.msg[key], // comment = json.comment, // ip = json.ip; // item = '<option value="' + ip + '">' + comment + '[' + ip + ']</option>'; // elem.append(item); // } // form.render("select"); // } // }, // error: function(data) { // // console.log(data); // layer.msg("获取服务器失败", { // icon: 5 // }); // } // }); // } select(); }); </script> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/index.php
sub_admin/index.php
<?php include '../includes/common.php'; if (!($islogin == 1)) { // exit('<script language=\'javascript\'>alert("您还没有登录,请先登录!");window.location.href=\'login.php\';</script>'); exit('<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>提示</title> <script src="../assets/layui/layui.js"></script> <link rel="stylesheet" href="../assets/layui/css/layui.css"> </head> <body> <script> layui.use(["layer"], function(){ var layer = layui.layer; layer.alert("您还没有登录,请先登录!", { title: "温馨提示", icon: 1, skin: "layui-layer-molv", anim: 4, btn: ["确定"], yes: function(){ window.location.href="./login.php"; } }); }); </script> </body> </html>'); } include './head.php'; $title = '后台管理首页'; ?>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/log.php
sub_admin/log.php
<?php include("../includes/common.php"); if (!($islogin == 1)) { exit('<script language=\'javascript\'>alert("您还没有登录,请先登录!");window.location.href=\'login.php\';</script>'); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title><?php echo $subconf['hostname']?>用户管理</title> <meta name="renderer" content="webkit" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> <?php include("foot.php"); ?> <!-- <link rel="stylesheet" href="../assets/layui/css/layui.css?v=20201111001?v=20201111001" /> <link rel="stylesheet" type="text/css" href="./css/theme.css?v=20201111001" /> --> </head> <body> <!-- 筛选条件 --> <div class="layui-card"> <div class="layui-card-body layui-form"> <div class="layui-form-item" style="padding-right: 5vw;padding-top: 15px;"> <label class="layui-form-label" title="创建时间"> 日志时间 </label> <div class="layui-input-inline"> <input type="text" name="logtime" class="layui-input" placeholder="YYYY-MM-DD"> </div> </div> </div> </div> <!-- 表格 --> <div class="layui-card"> <div class="layui-card-body"> <table id="log" lay-filter="log"></table> </div> </div> </body> <!-- <script src="https://www.layuicdn.com/layui/layui.js?v=20201111001"></script> --> <!-- <script src="../assets/layui/layui.js"></script> --> <script type="text/html" id="server_listTool"> <div class="layui-btn-container"> <!-- <button class="layui-btn layui-btn-black layui-btn-sm" lay-event="reload"><i class="layui-icon layui-icon-loading-1 layui-anim layui-anim-rotate layui-anim-loop"></i><span>刷新</span></button> --> <button class="layui-btn layui-btn-normal layui-btn-sm" lay-event="search"><i class="layui-icon layui-icon-search"></i><span>搜索</span></button> <!-- <button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="New"><i class="layui-icon layui-icon-add-1"></i><span>新增</span></button> <button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="edit"><i class="layui-icon layui-icon-edit"></i><span>编辑</span></button> <button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="Del"><i class="layui-icon layui-icon-delete"></i><span>删除</span></button> --> </div> </script> <!-- 表格按钮 --> <script type="text/html" id="btnTool"> <a class="layui-btn layui-btn-sm layui-btn-normal" lay-event="modify">修改</a> <a class="layui-btn layui-btn-sm layui-btn-normal" lay-event="select">选择</a> <a class="layui-btn layui-btn-sm layui-btn-danger" lay-event="del">删除</a> </script> <!-- 表格开关 --> <script type="text/html" id="stateTool"> <input type="checkbox" name="state" value="{{d.state}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="state" {{ d.state == "1" ? 'checked' : '' }} /> </script> <!-- 表格开关 //background-color:#33cabb--> <style> .green{ background-color:#33cabb; } </style> <script type="text/html" id="pwddot"> <span style="width: 20px;height: 20px;" class="layui-badge-dot {{d.pwdstate==1?'green':''}}"></span> </script> <script type="text/html" id="expirdot"> <span style="width: 20px;height: 20px;" class="layui-badge-dot {{d.expire==1?'green':''}}"></span> </script> <!-- 表格链接 --> <script type="text/html" id="certificateTool"> <a href="{{d.certificate}}" class="layui-table-link" target="_blank">{{ d.certificate }}</a> </script> <!-- 表格图片 --> <script type="text/html" id="imgTpl"> <a href="{{d.url}}" class="layui-table-link" target="_blank"><img src="{{ d.url }}" /></a> </script> <script> layui.use(["jquery", "table", "laydate", "form", "upload", "element"], function() { var $ = layui.$, table = layui.table, laydate = layui.laydate, form = layui.form, upload = layui.upload, element = layui.element; window.where = function() { var data = [ "id", "logtime", "price","user", "state","app" ]; var json = {}; for (var key in data) { json[data[key]] = query(data[key]); //console.log(query(data[key])) } return json; } laydate.render({ elem: "[name=logtime]", //range: true, done: function() { setTimeout(function() { reload("log"); }, 100); } }); form.render("select"); table.render({ elem: "#log", escape:true, height: "full-170", url: "ajax.php?act=getlog", page: true, limit: 100, limits: [10, 20, 30, 50, 100, 200, 300, 500, 1000, 2000, 3000, 5000, 10000], title: "用户", // skin: "line", // size: "lg", toolbar: "#server_listTool", where: where(), cols: [ [{ type: "checkbox" }, { field: "logid", title: "序号", width: 100, sort: true, align: "center" }, { field: "operation", title: "操作", //minWidth: 100, width: 170, align: "center", // sort: true }, { field: "msg", title: "信息", //minWidth: 100, width: 170, align: "center", // sort: true }, { field: "operationdate", title: "操作时间", //minWidth: 100, align: "center", width: 170, //toolbar: "#stateTool" // sort: true }, { field: "operationer", title: "操作人", //minWidth: 100, width: 170, align: "center", // toolbar: "#pwddot" // sort: true }, { field: "ip", title: "操作IP", //minWidth: 100, align: "center", width: 170, // sort: true }] ] }); table.on("toolbar(log)", function(obj) { var checkStatus = table.checkStatus(obj.config.id); switch (obj.event) { case "search": reload("log"); break; case "New": New(); break; case "Del": Del(table, checkStatus); break; case "edit": // console.log(checkStatus,obj); edit(checkStatus); break; }; }); //选中复选框 $('body').on("click", ".layui-table-body table.layui-table tbody tr td", function () { if ($(this).attr("data-field") === "0") return; $(this).siblings().eq(0).find('i').click(); }); //触发行单击事件 // table.on('row(log)', function(obj){ // $(obj.tr).children().children().children().next().addClass('layui-form-checked') // }); // table.on("edit(log)", function(obj) { // // var server = $("[name=server]").val(); // console.log(obj) // update(obj.data.appcode, obj.data.appname, obj.data.serverip); // }); // table.on("select(serverip)", function(obj) { // // var server = $("[name=server]").val(); // console.log(obj) // update(obj.data.appcode, obj.data.appname, obj.data.serverip); // }); form.on("select(server)", function(data) { reload("log"); }); laydate.render({ elem: "[name=logtime]", //range: true, done: function() { setTimeout(function() { reload("log"); }, 100); } }); form.on("select(state)", function(data) { reload("log"); }); table.on("tool(log)", function(obj) { //表格按钮事件 var data = obj.data; switch (obj.event) { case "del": modifyBtn(obj); break; case "modify": modifyBtn(obj); break; case "continued": continued(obj); break; }; }); function query(name) { return $("[name=" + name + "]").val(); } }); function reload(id) { layui.use(["jquery", "table"], function() { var $ = layui.$, table = layui.table; table.reload(id, { page: { curr: 1 }, where: where() }); }); } </script> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/edituser.php
sub_admin/edituser.php
<?php /* * @Author: yihua * @Date: 2022-07-07 17:45:59 * @LastEditTime: 2022-07-08 13:35:58 * @LastEditors: yihua * @Description: * @FilePath: \ccpy\sub_admin\edituser.php * 一花一叶 一行代码 */ include("../includes/common.php"); if (!($islogin == 1)) { exit('<script language=\'javascript\'>alert("您还没有登录,请先登录!");window.location.href=\'login.php\';</script>'); } $olduser=$_REQUEST["user"]; $newuser=$_REQUEST["user"]; $pwd=$_REQUEST["pwd"]; $use_date=$_REQUEST["use_date"]; $serverip=$_REQUEST["serverip"]; $connection=$_REQUEST["connection"]=="无限制"?-1:$_REQUEST["connection"]; $bandwidthup=$_REQUEST["bandwidthup"]=="无限制"?-1:$_REQUEST["bandwidthup"]; $bandwidthdown=$_REQUEST["bandwidthdown"]=="无限制"?-1:$_REQUEST["bandwidthdown"]; ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title><?php echo $subconf['hostname'] ?>编辑用户</title> <meta name="renderer" content="webkit" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> <?php include("foot.php"); ?> <!-- <link rel="stylesheet" href="../assets/layui/css/layui.css?v=20201111001?v=20201111001" /> <link rel="stylesheet" type="text/css" href="./css/theme.css?v=20201111001" /> --> <style> body { background-color: #FFFFFF; padding-right: 80px; } #layui-laydate1{ top: 0!important; } .usetime{ display: none; } </style> </head> <body class="layui-form form"> <div class="layui-form-item"> <label class="layui-form-label"> 用户名 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="newuser" value="<?=$newuser; ?>" class="layui-input" lay-verify="required" placeholder="请填写用户名"/> <input style="display: none;" type="text" name="olduser" value="<?=$olduser; ?>" class="layui-input" placeholder="请填写用户名" disabled/> </div> <div class="layui-input-block" style="display:none"> <input type="text" name="serverip" value="<?=$serverip; ?>" class="layui-input" placeholder="" /> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 密码 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="pwd" value="<?=$pwd; ?>" class="layui-input" lay-verify="required" placeholder="请填写用户密码" /> </div> </div> <div class="layui-form-item"> <label class="layui-form-label" title="到期时间"> 到期时间 <span class="layui-must">*</span> </label> <div class="layui-input-inline"> <input type="text" name="use_date" value="<?=$use_date; ?>" class="layui-input" placeholder="yyyy-MM-dd HH:mm:ss"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label" title="连接数"> 连接数 </label> <div class="layui-input-inline"> <input type="text" name="connection" value="<?=$connection; ?>" class="layui-input" placeholder="-1 表示不限制"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label" title="上行带宽"> 上行带宽 </label> <div class="layui-input-inline"> <input type="text" name="bandwidthup" value="<?=$bandwidthup; ?>" class="layui-input" placeholder="-1 表示不限制 单位(MS)"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label" title="下行带宽"> 下行带宽 </label> <div class="layui-input-inline"> <input type="text" name="bandwidthdown" value="<?=$bandwidthdown; ?>" class="layui-input" placeholder="-1 表示不限制 单位(MS)"> </div> </div> <!-- <div class="layui-form-item"> <label class="layui-form-label" title="应用"> 应用 <span class="layui-must">*</span> </label> <div class="layui-input-inline"> <select lay-verify="required" name="app" lay-filter="state"> <option value="">请选择一个应用</option> </select> </div> </div> --> <!-- <div class="layui-form-item"> <label class="layui-form-label"> 密码 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="number" name="password" class="layui-input" lay-verify="required" placeholder="纯数字密码"/> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 到期时间 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="end_date" class="layui-input" lay-verify="required" placeholder="YYYY-mm-dd HH:ii-dd" /> </div> </div> --> <div class="layui-form-item"> <div class="layui-input-block"> <button class="layui-btn layui-btn-normal layui-btn-sm" lay-submit lay-filter="submit">确定</button> </div> </div> </body> <!-- <script src="https://www.layuicdn.com/layui/layui.js?v=20201111001"></script> --> <script type="text/javascript" src="../assets/js/xss.js"></script> <script> layui.use(["jquery", "form", "laydate"], function() { var $ = layui.$, form = layui.form, laydate = layui.laydate; console.log($("[name=use_date]").eq(0).val('<?=$use_date;?>')); form.render("input"); // form.on('select(expire)', function(data) { // // console.log(data.value==-1?$(da):) // if(data.value==-1){ // $(".usetime").eq(0).css("display","block"); // } // else{ // $(".usetime").eq(0).css("display","none"); // } // // var duration = Number(data.value); // // var price = duration * unit; // }); $(".layui-input").eq(0).focus(); form.on("submit(submit)", function(data) { //console.log(data.field) // if(data.field.expire==-1){ // if(data.field.use_date==""){ // layer.msg("自定义时长不能为空!", { // icon: 5 // }); // return; // } // } // console.log(data); $.ajax({ url: "ajax.php?act=userupdate", type: "POST", dataType: "json", data: { usermodel: { olduser:data.field.olduser, newuser:data.field.newuser, pwd:data.field.pwd, day:data.field.use_date, serverip:data.field.serverip, connection:data.field.connection, bandwidthup:data.field.bandwidthup, bandwidthdown:data.field.bandwidthdown } }, beforeSend: function() { layer.msg("正在提交", { icon: 16, shade: 0.05, time: false }); }, success: function(data) { if (data.code == "1") { parent.layer.closeAll(); parent.layer.msg(data.msg, { icon: 1 }); setTimeout(function(){ window.parent.frames.reload('server_list'); },100); } else { layer.msg(data.msg == null ? "未知错误" : data.msg, { icon: 5 }); } console.log(data); // if (data.icon == "1") { // } else { // layer.msg(data.code, { // icon: data.icon // }); // } }, error: function(data) { console.log(data); layer.msg("编辑数据失败", { icon: 5 }); } }); return false; }); // function select() { // $.ajax({ // url: "ajax.php?act=getapp", // type: "POST", // dataType: "json", // success: function(data) { // if (data.code == "1") { // var elem = $("[name=app]"); // for (var key in data.msg) { // var json = data.msg[key], // appname = json.appname, // appcode = json.appcode; // item = '<option value="' + appcode + '">' + appname + '</option>'; // elem.append(item); // } // form.render("select"); // } // }, // error: function(data) { // layer.msg("获取用户失败", { // icon: 5 // }); // } // }); // }; laydate.render({ elem: "[name=use_date]", format: "yyyy-MM-dd HH:mm:ss", //range: true, done: function(e) { // setTimeout(function() { // window.parent.frames.reload('server_list'); // }, 1000); } }); // laydate.render({ // elem: "[name=end_date]", // type: "datetime" // }); // function select() { // $.ajax({ // url: "ajax.php?act=getserver", // type: "POST", // dataType: "json", // success: function(data) { // if (data.code == "1") { // var elem = $("[name=server]"); // for (var key in data.msg) { // // console.log(data.msg[key]); // var json = data.msg[key], // comment = json.comment, // ip = json.ip; // item = '<option value="' + ip + '">' + comment + '[' + ip + ']</option>'; // elem.append(item); // } // form.render("select"); // } // }, // error: function(data) { // // console.log(data); // layer.msg("获取服务器失败", { // icon: 5 // }); // } // }); // } //select(); }); </script> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/new_kami.php
sub_admin/new_kami.php
<?php include("../includes/common.php"); if (!($islogin == 1)) { exit('<script language=\'javascript\'>alert("您还没有登录,请先登录!");window.location.href=\'login.php\';</script>'); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> <?php echo $subconf['hostname'] ?>新增卡密 </title> <?php include("foot.php"); ?> <!-- <link rel="stylesheet" href="../assets/layui/css/layui.css?v=20201111001?v=20201111001"> <link rel="stylesheet" type="text/css" href="./css/theme.css?v=20201111001" /> --> <style> body { background-color: #FFFFFF; padding-right: 80px; } .price { color: red; font-size: 25px; } #extparm { display: none; } .kamitype { display: none; } </style> </head> <body class="layui-form form" style="text-align:center;"> <div class="layui-form-item"> <label class="layui-form-label"> 所属应用 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <select name="app" lay-verify="required" lay-filter="app"> <option value=""></option> </select> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 前缀 </label> <div class="layui-input-block"> <input type="text" name="qianzhui" class="layui-input" placeholder="为空则自动生成前缀"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 卡密长度 </label> <div class="layui-input-block"> <input type="num" maxlength="128" name="kamilen" class="layui-input" placeholder="卡密长度,默认为16位"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 卡密时长 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <select name="duration" lay-verify="required" lay-filter="duration"> <option value=""></option> <option value="1">1天</option> <option value="7">7天</option> <option value="30">30天</option> <?php if ($subconf['qx'] == 0) { echo '<option value="-1">自定义</option>'; } ?> </select> </div> </div> <div class="layui-form-item kamitype"> <label class="layui-form-label"> 卡密类型 <span class="layui-must">*</span> </label> <div class="layui-input-block" style="text-align:left;"> <input type="checkbox" name="year" lay-filter="kamitype" title="年"> <input type="checkbox" name="month" lay-filter="kamitype" title="月"> <input type="checkbox" name="day" lay-filter="kamitype" title="天" checked> <input type="checkbox" name="hour" lay-filter="kamitype" title="时"> </div> </div> <div class="layui-form-item zdydur"> <label class="layui-form-label"> 自定义时长 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="kamidur" class="layui-input" placeholder="自定义时长(年/月/天/时)"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 数量 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="num" name="kaminum" maxlength="4" lay-verify="required" class="layui-input" placeholder="生成卡密的数量"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 拓展参数 </label> <div class="layui-input-block" style="text-align:left;"> <input type="checkbox" name="ext" title="拓展参数" lay-filter="ext"> </div> </div> <div id="extparm"> <div class="layui-form-item"> <label class="layui-form-label"> 连接数 </label> <div class="layui-input-block"> <input type="text" name="connection" class="layui-input" placeholder="为空则为无限制"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 上行带宽 </label> <div class="layui-input-block"> <input type="text" name="bandwidthup" class="layui-input" placeholder="为空则为无限制 单位MS"> </div> </div> <label class="layui-form-label"> 下行带宽 </label> <div class="layui-input-block"> <input type="text" name="bandwidthdown" class="layui-input" placeholder="为空则为无限制 单位MS"> </div> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 备注 </label> <div class="layui-input-block"> <input type="text" name="comment" class="layui-input"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 卡密复制 </label> <div class="layui-input-block" style="text-align:left;"> <input type="checkbox" name="copy" title="复制卡密" checked> </div> </div> <div class="layui-form-item"> <div class="layui-input-block"> <button class="layui-btn layui-btn-normal layui-btn-sm" lay-submit lay-filter="submit">新增卡密</button> </div> </div> </body> <!-- <script src="https://www.layuicdn.com/layui/layui.js?v=20201111001"></script> --> <script> layui.use(["jquery", "form", "laydate"], function() { var $ = layui.$, form = layui.form, laydate = layui.laydate, unit = 0; form.on('select(duration)', function(data) { // console.log(data.value==-1?$(da):) if (data.value == -1) { // layer.open({ // title: 'Tips', // content: '自定义默认单位是天,如需要其他时间请换算!<br> <b style="color: red;">1小时==0.1 <b> <br> <b style="color: red;">2小时==0.2 <b><br> <b style="color: red;">大于 1 则 单位为 天<b> <br> <b style="color: red;">不能带小数如 0.24<b>' // }); $(".zdydur").eq(0).css("display", "block"); $(".kamitype").eq(0).css("display", "block"); } else { $(".zdydur").eq(0).css("display", "none"); $(".kamitype").eq(0).css("display", "none"); } // var duration = Number(data.value); // var price = duration * unit; }); form.on('checkbox(ext)', function(e) { if (e.elem.checked) { //判断当前多选框是选中还是取消选中 $("#extparm").eq(0).css("display", "block"); } else { $("#extparm").eq(0).css("display", "none"); } }); /** * 复选框变单选框 */ form.on('checkbox(kamitype)', function(e) { var flag = 0; $("[lay-filter='kamitype']").each(function(e) { if ($(this).prop("checked")) { flag++; } }); if (flag > 1) { $(this).parent().find(".layui-form-checked").each(function(e) { $(this).removeClass("layui-form-checked"); $(this).prev().removeAttr("checked") }); $(this).prop("checked", true); flag = 0; } form.render("checkbox"); }); //复制文本内容 function copy(txval) { let that = this let txa = document.createElement('textarea') // let txval = 'SN:' + that.sn1 + '\n' + 'MAC:' + that.mac1 + '\n' + 'IMEI:' + that.imei1 + '\n' + 'PORT:' + that // .port1 // console.log('copy val:', txval) txa.value = txval document.body.appendChild(txa) txa.select() let res = document.execCommand('copy') document.body.removeChild(txa) console.log('copy success') } form.on("submit(submit)", function(data) { if (data.field.duration == -1) { if (data.field.kamidur == "") { layer.msg("自定义时长不能为空!", { icon: 5 }); return; } } $.ajax({ url: "ajax.php?act=newkami", type: "POST", dataType: "json", data: data.field, beforeSend: function() { layer.msg("正在提交", { icon: 16, shade: 0.05, time: false }); }, success: function(data) { if (data.code == "1") { window.parent.frames.reload("daili_kami"); parent.layer.closeAll(); parent.layer.msg("生成成功", { icon: 1, }); } else if (data.code == "2") { window.parent.frames.reload("daili_kami"); parent.layer.closeAll(); parent.layer.msg("生成成功", { icon: 1, }); // console.log(data); var kami = "您生成的卡密为:\n\n"; var num = 0; for (var key in data.kami) { console.log(data.kami[key]["kami"]) kami += data.kami[key]["kami"] + "\n" num++; } // 当卡密数量大于500时 if (num > 500) { parent.layer.msg("生成成功,但是卡密数量过多,请使用导出功能导出卡密", { icon: 1, time: 2000 }); return; } // 显示卡密内容弹窗 parent.layer.open({ type: 1, title: '卡密窗口', area: ['400px', '500px'], content: '<div style="padding: 20px;">' + '<div style="margin-bottom:10px;">共生成 ' + num + ' 张卡密:</div>' + '<textarea readonly style="width:100%;height:350px;resize:none;">' + kami + '</textarea>' + '<button class="layui-btn layui-btn-normal" onclick="layui.jquery(this).prev().select();document.execCommand(\'copy\');parent.layer.msg(\'复制成功\',{icon:1,time:1000});" style="margin-top:10px;">复制卡密</button>' + '</div>' }); console.log(kami + "\n一花CCPROXY卡密系统卡密生成结束共为您生成" + num + "张。") console.log('\n' + ' %c 一花❀ %c 一花落下满地伤 ' + '\n', 'color: #fadfa3; background: #030307; padding:5px 0;', 'background: #fadfa3; padding:5px 0;; padding:5px 0'); copy(kami + "\n一花CCPROXY卡密系统卡密生成结束共为您生成" + num + "张。"); parent.layer.msg("卡密已经复制成功!", { time: 1500 }) } else { layer.msg(data.msg, { icon: 5 }); } }, error: function(data) { // console.log(data); layer.msg("未知错误", { icon: 5 }); } }); return false; }); function select() { $.ajax({ url: "ajax.php?act=getapp", type: "POST", dataType: "json", success: function(data) { if (data.code == "1") { var elem = $("[name=app]"); // var elem2 = $("[name=serverip]"); for (var key in data.msg) { // console.log(elem2); var json = data.msg[key], appname = json.appname, appcode = json.appcode; item = '<option value="' + appcode + '">' + appname + '</option>'; // item2 = '<option value="' + ip + '">' + comment + '[' + ip + ']</option>'; elem.append(item); // elem2.append(item2); } form.render("select"); } }, error: function(data) { // console.log(data); layer.msg("获取服务器失败", { icon: 5 }); } }); } select(); // function initapp() { // $.ajax({ // url: "ajax.php?act=getapp", // type: "POST", // dataType: "json", // success: function(data) { // if (data.data.unit != false) { // unit = data.data.unit; // } // }, // error: function(data) { // console.log(data); // layer.msg(data.responseText, { // icon: 5 // }); // } // }); // } // init(); }); </script> <!-- 用户信息新增数据页面文件 --> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/update_password.php
sub_admin/update_password.php
<?php include("../includes/common.php"); if (!($islogin == 1)) { exit('<script language=\'javascript\'>alert("您还没有登录,请先登录!");window.location.href=\'login.php\';</script>'); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> <?php echo $subconf['hostname']?>修改密码 </title> <?php include("foot.php"); ?> <!-- <link rel="stylesheet" href="../assets/layui/css/layui.css?v=20201111001"> <link rel="stylesheet" type="text/css" href="../css/theme.css" /> --> <style> body { padding: 20px; padding-right: 80px;background-color: #FFFFFF; } </style> </head> <body class="layui-form"> <div class="layui-form-item"> <label class="layui-form-label"> 旧密码 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="password" name="out_password" class="layui-input" lay-verify="required"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 新密码 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="password" name="password" class="layui-input" lay-verify="required"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 确定新密码 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="password" name="confirm_password" class="layui-input" lay-verify="required"> </div> </div> <div class="layui-form-item"> <div class="layui-input-block"> <button class="layui-btn layui-btn-normal layui-btn-sm" lay-submit lay-filter="submit">确认修改</button> </div> </div> </body> <!-- <script src="https://www.layuicdn.com/layui/layui.js"> --> </script> <script> layui.use(["jquery", "form", "laydate"], function() { var $ = layui.$, form = layui.form, laydate = layui.laydate; form.on("submit(submit)", function(data) { $.ajax({ url: "ajax.php?act=updatepwd", type: "POST", dataType: "json", data: data.field, beforeSend: function() { layer.msg("正在提交", { icon: 16, shade: 0.05, time: false }); }, success: function(data) { if (data.code == "1") { parent.layer.closeAll(); parent.layer.msg(data.msg, { icon: 1 }); parent.location.reload(); // setTimeout("parent.location.reload();",1500); } else if(data.code == "-1") { layer.msg(data.msg, { icon: 5 }); }else if(data.code == "-2") { layer.msg(data.msg, { icon: 5 }); }else if(data.code == "-3"){ layer.msg(data.msg, { icon: 5 }); }else{ layer.msg("未知错误", { icon: 5 }); } }, error: function(data) { console.log(data); layer.msg(data.responseText, { icon: 5 }); } }); return false; }); }); </script> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/newserver.php
sub_admin/newserver.php
<?php include("../includes/common.php"); if (!($islogin == 1)) { exit('<script language=\'javascript\'>alert("您还没有登录,请先登录!");window.location.href=\'login.php\';</script>'); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title><?php echo $subconf['hostname']?>服务器</title> <meta name="renderer" content="webkit" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> <?php include("foot.php"); ?> <!-- <link rel="stylesheet" href="../assets/layui/css/layui.css?v=20201111001?v=20201111001" /> <link rel="stylesheet" type="text/css" href="./css/theme.css?v=20201111001" /> --> <style> body { background-color: #FFFFFF; padding-right: 80px; } </style> </head> <body class="layui-form form"> <div class="layui-form-item"> <label class="layui-form-label"> 服务器IP <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="serverip" class="layui-input" lay-verify="required" placeholder="服务器IP"/> </div> <div class="layui-form-item"> <label class="layui-form-label"> 账号 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="ccpusername" class="layui-input" lay-verify="required" value="admin" placeholder="CCP登录账号"/> </div> <div class="layui-form-item"> <label class="layui-form-label"> 密码 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="ccppassword" class="layui-input" lay-verify="required" placeholder="CCP登录密码"/> </div> <div class="layui-form-item"> <label class="layui-form-label"> 端口 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="ccpport" class="layui-input" lay-verify="required" placeholder="CCP通讯端口"/> </div> <div class="layui-form-item"> <label class="layui-form-label"> 服务器状态 <!-- <span class="layui-must">*</span> --> </label> <div class="layui-input-block"> <input type="checkbox" name="state" lay-skin="switch" lay-text="开启|关闭" lay-filter="state" checked/> </div> <div class="layui-form-item"> <label class="layui-form-label"> 备注 <!-- <span class="layui-must">*</span> --> </label> <div class="layui-input-block"> <input type="text" name="comment" class="layui-input" placeholder="服务器备注"/> </div> </div> </div> <!-- <div class="layui-form-item"> <label class="layui-form-label"> 密码 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="number" name="password" class="layui-input" lay-verify="required" placeholder="纯数字密码"/> </div> </div> <div class="layui-form-item"> <label class="layui-form-label"> 到期时间 <span class="layui-must">*</span> </label> <div class="layui-input-block"> <input type="text" name="end_date" class="layui-input" lay-verify="required" placeholder="YYYY-mm-dd HH:ii-dd" /> </div> </div> --> <div class="layui-form-item"> <div class="layui-input-block"> <button class="layui-btn layui-btn-normal layui-btn-sm" lay-submit lay-filter="submit">新增服务器</button> </div> </div> </body> <!-- <script src="https://www.layuicdn.com/layui/layui.js?v=20201111001"></script> --> <script type="text/javascript" src="../assets/js/xss.js"></script> <script> layui.use(["jquery", "form", "laydate"], function() { var $ = layui.$, form = layui.form, laydate = layui.laydate; $(".layui-input").eq(0).focus(); form.on("submit(submit)", function(data) { console.log(data); $.ajax({ url: "ajax.php?act=newserver", type: "POST", dataType: "json", data: data.field, beforeSend: function() { layer.msg("正在提交", { icon: 16, shade: 0.05, time: false }); }, success: function(data) { if(data.code== "1"){ window.parent.frames.reload('server_list'); parent.layer.closeAll(); parent.layer.msg(data.msg, { icon: 1 }); } else{ layer.msg(data.msg==null ? "未知错误" : data.msg, { icon: 5 }); } console.log(data); // if (data.icon == "1") { // } else { // layer.msg(data.code, { // icon: data.icon // }); // } }, error: function(data) { console.log(data); layer.msg("保存数据失败", { icon: 5 }); } }); return false; }); // laydate.render({ // elem: "[name=end_date]", // type: "datetime" // }); // function select() { // $.ajax({ // url: "ajax.php?act=getserver", // type: "POST", // dataType: "json", // success: function(data) { // if (data.code == "1") { // var elem = $("[name=server]"); // for (var key in data.msg) { // // console.log(data.msg[key]); // var json = data.msg[key], // comment = json.comment, // ip = json.ip; // item = '<option value="' + ip + '">' + comment + '[' + ip + ']</option>'; // elem.append(item); // } // form.render("select"); // } // }, // error: function(data) { // // console.log(data); // layer.msg("获取服务器失败", { // icon: 5 // }); // } // }); // } // select(); }); </script> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/foot.php
sub_admin/foot.php
<?php echo '<link rel="stylesheet" href="../assets/layui/css/layui.css?v=20201111001" />'; echo '<link rel="stylesheet" type="text/css" href="./css/theme.css?v=20201111001" />'; echo '<script src="../assets/layui/layui.js?v=20201111001"></script>'; ?> <!-- echo '<link rel="stylesheet" href="../assets/layui/css/layui.css?v=20201111001" /><br>'; echo '<link rel="stylesheet" type="text/css" href="./css/theme.css?v=20201111001" /><br>'; echo '<script src="../assets/layui/layui.js?v=20201111001"></script><br>'; -->
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/sub_admin/primary.php
sub_admin/primary.php
<?php include '../includes/common.php'; if (!($islogin == 1)) { exit('<script language=\'javascript\'>alert("您还没有登录,请先登录!");window.location.href=\'login.php\';</script>'); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> <?php echo $subconf['hostname'] . "后台管理首页" ?> </title> <?php include("foot.php"); ?> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> <link rel="stylesheet" type="text/css" href="./css/theme.css" /> <link rel="stylesheet" type="text/css" href="./css/home.css" /> </head> <body> <div class="layui-row layui-col-space12 layer-anim layui-anim-scaleSpring" style="margin-bottom: 10px;"> <div class="layui-col-xs12 layui-col-sm6 layui-col-md3"> <div class="card" style="background-color: #33cabb;"> <div class="card-icon"> <div class="card-icon-bor"> <i class="layui-icon layui-icon-flag"></i> </div> </div> <div class="card-box"> <div class="card-box-title">用户数</div> <div id="user" class="card-box-num">0.00</div> </div> </div> </div> <div class="layui-col-xs12 layui-col-sm6 layui-col-md3"> <div class="card" style="background-color: #ce68fd;"> <div class="card-icon"> <div class="card-icon-bor"> <i class="layui-icon layui-icon-rmb"></i> </div> </div> <div class="card-box"> <div class="card-box-title">服务器数</div> <div id="server" class="card-box-num">0.00</div> </div> </div> </div> <div class="layui-col-xs12 layui-col-sm6 layui-col-md3"> <div class="card" style="background-color: #f96868;"> <div class="card-icon"> <div class="card-icon-bor"> <i class="layui-icon layui-icon-component"></i> </div> </div> <div class="card-box"> <div class="card-box-title">日志数</div> <div id="log" class="card-box-num">0.00</div> </div> </div> </div> <div class="layui-col-xs12 layui-col-sm6 layui-col-md3"> <div class="card" style="background-color: #faa123;"> <div class="card-icon"> <div class="card-icon-bor"> <i class="layui-icon layui-icon-find-fill"></i> </div> </div> <div class="card-box"> <div class="card-box-title">订单数</div> <div id="order" class="card-box-num">0.00</div> </div> </div> </div> <div class="layui-col-xs12 layui-col-sm6 layui-col-md3"> <div class="card" style="background-color: #fc4086;"> <div class="card-icon"> <div class="card-icon-bor"> <i class="layui-icon layui-icon-template-1"></i> </div> </div> <div class="card-box"> <div class="card-box-title">代理数</div> <div id="daili" class="card-box-num">0.00</div> </div> </div> </div> <div class="layui-col-xs12 layui-col-sm6 layui-col-md3"> <div class="card" style="background-color: #4d7fff;"> <div class="card-icon"> <div class="card-icon-bor"> <i class="layui-icon layui-icon-snowflake"></i> </div> </div> <div class="card-box"> <div class="card-box-title">卡密数</div> <div id="kami" class="card-box-num">0.00</div> </div> </div> </div> <div class="layui-col-xs12 layui-col-sm6 layui-col-md3"> <div class="card" style="background-color: #009688;"> <div class="card-icon"> <div class="card-icon-bor"> <i class="layui-icon layui-icon-tree"></i> </div> </div> <div class="card-box"> <div class="card-box-title">应用数</div> <div id="app" class="card-box-num">0.00</div> </div> </div> </div> <div class="layui-col-xs12 layui-col-sm6 layui-col-md3"> <div class="card" style="background-color: #5fb878;"> <div class="card-icon"> <div class="card-icon-bor"> <i class="layui-icon layui-icon-website"></i> </div> </div> <div class="card-box"> <div class="card-box-title">今日卡密激活数</div> <div id="jhkami" class="card-box-num">0.00</div> </div> </div> </div> </div> <div class="layui-row layui-col-space16"> <div class="layui-col-xs12 layui-col-sm12 layui-col-md6"> <div class="layui-card"> <div class="layui-card-header layui-form"> <span>网站统计图</span> <!-- <div class="tool"> <input type="radio" name="dateRange" value="7" title="近7天" lay-filter="dateRange" checked> <input type="radio" name="dateRange" value="15" title="近15天" lay-filter="dateRange"> <input type="radio" name="dateRange" value="30" title="近30天" lay-filter="dateRange"> </div> --> </div> <div class="layui-card-body" style="height: 55vh;"> <div id="container" style="height: 100%;width: 100%;"> <div class="lod"> <i class="layui-icon layui-icon-loading layui-icon layui-anim layui-anim-rotate layui-anim-loop"></i> </div> </div> </div> </div> </div> <div class="layui-col-xs12 layui-col-sm12 layui-col-md6"> <div class="layui-card"> <div class="layui-card-header"> <span class="title">站点信息</span> <div class="tool"> <!-- <span style="margin-right: 5px;">选择日期</span> <div class="layui-input-inline" style="width: 150px;"> <input type="text" class="layui-input" id="date" placeholder="YYYY-MM-DD"> </div> <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" id="renovate">刷新</button> --> </div> </div> <div class="layui-card-body" style="height: auto;"> <!-- <table id="data" lay-filter="data"></table> --> <div class="layui-row layui-col-space20"> <div class="layui-col-xs12 layui-col-sm16 layui-col-md12"> <blockquote class="layui-elem-quote"> <div id="test2">网站到期时间: <?php $expir = strtotime($subconf['over_date']) - strtotime($date); $diff_days = floor($expir / 86400); if ($diff_days <= 7) { echo "<span style='color:#5FB878;font-weight: bold;'>还剩 " . $diff_days . ' 天' . "</span>"; } else { echo "<span style='color:#5FB878;font-weight: bold;'> " . $subconf['over_date'] . '' . "</span>"; } if ($subconf["password"] == "123456" || $subconf["password"] == $subconf["username"]) { echo '<li class="list-group-item"><span class="btn-sm btn-danger">高危</span>&nbsp;请修改默认密码,防止黑客破解</li>'; $safe = 1; $p = 1; } if ($subconf["password"] == $subconf["username"]) { echo '<li class="list-group-item"><span class="btn-sm btn-danger">高危</span>&nbsp;账号密码相同,极易被恶意破解</li>'; } if (strlen($subconf["password"]) < 6) { echo '<li class="list-group-item"><span class="btn-sm btn-warning">建议</span>&nbsp;请设置大于6位的密码,降低爆破风险</li>'; $safe = 1; } if (is_numeric($subconf["password"])) { if (empty($p)) { echo '<li class="list-group-item"><span class="btn-sm btn-warning">建议</span>&nbsp;密码建议不要设置为QQ或其他数字</li>'; $safe = 1; } } if ($dbconfig["user"] == $dbconfig["pwd"]) { echo '<li class="list-group-item"><span class="btn-sm btn-danger">危险</span>&nbsp;数据库账号密码相同,极易被黑客破解</li>'; } // if(preg_match("/7.4|74/",phpversion())==false){ // echo '<li class="list-group-item"><span class="btn-sm btn-info">提示</span>&nbsp;为了网站更高性能,请将php版本调至7.4或</li>'; // } $glob = glob("../*"); if ($glob) { for ($i = 0; $i < count($glob); $i++) { if (preg_match("/.zip|.rar|.7z|.tar.gz/", $glob[$i])) { echo '<li class="list-group-item"><span class="btn-sm btn-warning">建议</span>&nbsp;网站根目录下存在压缩包文件,极易被恶意下载</li>'; $safe = 1; } else { continue; } } } $func = ['exec', 'system', 'syslog', 'popen', 'shell_exec', 'dl', 'passthru', 'putenv', 'chroot', 'chown', 'readlink']; for ($i = 0; $i < count($func); $i++) { if (function_exists($func[$i])) { $safe = 1; echo '<li class="list-group-item"><span class="btn-sm btn-danger">危险</span>&nbsp;系统函数:<b style="color: red;">' . $func[$i] . '</b>尚未被禁止</li>'; } } if (preg_match("/\/sub_admin\//", __DIR__)) { echo '<li class="list-group-item"><span class="btn-sm btn-warning">建议</span>&nbsp;网站默认后台地址尚未重命名,若密码泄漏,极易被恶意使用</li>'; $safe = 1; } if (empty($safe)) { echo '<li class="list-group-item"><span class="btn-sm btn-success">安全</span>&nbsp;暂未发现网站安全问题</li>'; } ?> </div> </blockquote> </div> </div> <!-- <div class="layui-row layui-col-space20"> <div class="layui-col-xs12 layui-col-sm16 layui-col-md12"> <blockquote class="layui-elem-quote"> <div id="test2"> </div> </blockquote> </div> </div> --> </div> </div> </div> </div> </body> <!-- <script src="https://cdn.jsdelivr.net/npm/echarts@5.3.3/dist/echarts.min.js"></script> --> <!-- <script type="text/javascript" src="https://www.layuicdn.com/layui/layui.js"></script> --> <!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script> --> <!-- <script src="../js/walden.js"></script> --> <script type="text/javascript" src="/assets/js/echarts.min.js"></script> <script type="text/html" id="ratioTpl"> <div class="layui-progress" lay-showPercent="yes"> <div class="layui-progress-bar {{ d.ratio <= d.refund_quota ? "" : "layui-bg-red"}}" lay-percent="{{d.ratio}}%"></div> </div> </script> <script> layui.use(["jquery", "table", "laydate", "form", "upload", "element"], function() { var $ = layui.$, table = layui.table, laydate = layui.laydate, form = layui.form, upload = layui.upload, element = layui.element, date = 7, state = true; $.ajax({ url: "ajax.php?act=siteinfo", type: "POST", async: true, timeout:3000, success: function(data) { if (data.code == 1) { $("#user").text(data.usernum); $("#server").text(data.servercount); $("#log").text(data.lognum); $("#kami").text(data.kaminum); $("#app").text(data.appnum); $("#jhkami").text(data.todaykami); } else { layer.msg("获取信息失败!"); } }, error: function(error) { layer.msg("获取信息失败!"); console.log(error); } }); // form.on("radio(dateRange)", function(data) { // date = data.value; // layer.msg("加载中", { // icon: 16, // shade: 0.01, // time: false // }); // int(date); // }); // table.render({ // elem: "#data", // url: "../php/data.php", // title: "模拟数据", // //height: 500, // skin: "nob", // initSort: { // field: "value", // type: "desc" // }, // loading: false, // where: { // date: $("#date").val() // }, // cols: [ // [{ // title: "排名", // type: "numbers" // }, { // field: "username", // title: "数据A", // width: 100, // align: "center", // unresize: true // }, { // field: "goodsNum", // title: "数据B", // width: 80, // align: "center", // unresize: true // }, { // field: "payment", // title: "数据C", // width: 100, // align: "center", // unresize: true, // style: "color:red" // }, { // field: "value", // title: "数据D", // width: 140, // align: "center", // unresize: true, // style: "color:red", // hide: true // }, // { // field: "refund", // title: "数据F", // width: 100, // align: "center", // unresize: true, // style: "color:#009688" // }, // { // field: "total", // title: "数据G", // width: 100, // align: "center", // unresize: true, // style: "color:red" // }, // { // title: "数据H", // templet: "#ratioTpl", // align: "center", // unresize: true // } // ] // ], // done: function(res, curr, count) { // $(".title").text(res.msg); // $("#date").val(res.date); // element.init(); // } // }); // laydate.render({ // elem: "#date", // done: function() { // reload("data"); // } // }); // $("#renovate").click(function() { // reload("data"); // }); // function int(date) { // // $.ajax({ // // url: "../php/home.php", // // type: "POST", // // dataType: "json", // // data: { // // date: date // // }, // // success: function(data) { // // if (data.icon == "1") { // // init(data.data.echarts); // // card(data.data.card); // // layer.closeAll(); // // } else { // // parent.layer.msg("您的账户在其他设备登录", function() { // // parent.location.reload(); // // }); // // } // // } // // }); // init(); // layer.closeAll(); // } // function card(data) { // var i = 0; // for (var key in data) { // var elem = $(".card").eq(i); // var json = data[key]; // var name = json.name; // var node = elem.find(".card-box-num"); // elem.find(".card-box-title").text(name); // i++; // num(node, json); // } // state = false; // } // function num(elem, json) { // if (state == true) { // if (json.value > 10) { // var c = (json.value / 100).toFixed(0); // for (var i = 0; i <= 100; i++) { // (function(i) { // setTimeout(function() { // elem.text(i * c); // if (i == 100) { // elem.text(json.num); // } // }, (i + 1) * 10); // })(i); // } // } else { // elem.text(json.num); // } // } else { // elem.text(json.num); // } // } // function init(data) { // var dom = document.getElementById("container"); // var myChart = echarts.init(dom, "walden"); // var app = {}; // option = null; // option = { // xAxis: { // type: "category", // data: ["2020-10-10", "2020-10-11"] // }, // yAxis: { // type: "value" // }, // tooltip: { // trigger: "axis", // axisPointer: { // type: "cross", // label: { // show: false, // backgroundColor: "rgba(0,0,0,0.5)" // } // } // }, // legend: { // show: true, // data: ["模拟数据"] // }, // series: [{ // data: [100, 500, 600], // name: "模拟数据", // type: "line", // smooth: true, // label: { // normal: { // show: false, // position: "top" // } // }, // itemStyle: { // normal: { // color: "#33cabb", // lineStyle: { // color: "#33cabb" // } // } // } // }] // }; // if (option && typeof option === "object") { // myChart.setOption(option, true); // } // } function reload(id) { layui.use(["jquery", "table"], function() { var $ = layui.$, table = layui.table; table.reload(id, { where: { date: $("#date").val() } }); }); } // int(date); // setInterval(function() { // int(date); // }, 60000); }); </script> <script type="text/javascript"> var dom = document.getElementById('container'); var myChart = echarts.init(dom, null, { renderer: 'canvas', useDirtyRect: false }); var app = {}; var option; option = { color: ['#80FFA5', '#00DDFF', '#37A2FF', '#FF0087', '#FFBF00'], title: {}, tooltip: { trigger: 'axis', axisPointer: { type: 'cross', label: { backgroundColor: '#6a7985' } } }, legend: { data: ['用户数', '服务器数', '日志数', '卡密数', '应用数'] }, toolbox: { feature: { saveAsImage: {} } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [{ type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] }], yAxis: [{ type: 'value' }], series: [{ name: '用户数', type: 'line', stack: 'Total', smooth: true, lineStyle: { width: 0 }, zlevel: 1, z: 1, showSymbol: false, areaStyle: { opacity: 0.8, color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgb(128, 255, 165)' }, { offset: 1, color: 'rgb(1, 191, 236)' } ]) }, emphasis: { focus: 'series' }, data: [140, 232, 101, 264, 90, 340, 250] //hover 数据 }, { name: '服务器数', type: 'line', stack: 'Total', smooth: true, lineStyle: { width: 0 }, zlevel: 2, z: 2, showSymbol: false, areaStyle: { opacity: 0.8, color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgb(0, 221, 255)' }, { offset: 1, color: 'rgb(77, 119, 255)' } ]) }, emphasis: { focus: 'series' }, data: [120, 282, 111, 234, 220, 340, 310] }, { name: '日志数', type: 'line', stack: 'Total', smooth: true, lineStyle: { width: 0 }, zlevel: 3, z: 3, showSymbol: false, areaStyle: { opacity: 0.8, color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgb(55, 162, 255)' }, { offset: 1, color: 'rgb(116, 21, 219)' } ]) }, emphasis: { focus: 'series' }, data: [320, 132, 201, 334, 190, 130, 220] }, { name: '卡密数', type: 'line', stack: 'Total', smooth: true, lineStyle: { width: 0 }, zlevel: 4, z: 4, showSymbol: false, areaStyle: { opacity: 0.8, color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgb(255, 0, 135)' }, { offset: 1, color: 'rgb(135, 0, 157)' } ]) }, emphasis: { focus: 'series' }, data: [220, 402, 231, 134, 190, 230, 120] }, { name: '应用数', type: 'line', stack: 'Total', smooth: true, lineStyle: { width: 0 }, showSymbol: false, label: { show: true, position: 'top' }, zlevel: 5, z: 5, areaStyle: { opacity: 0.8, color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgb(255, 191, 0)' }, { offset: 1, color: 'rgb(224, 62, 76)' } ]) }, emphasis: { focus: 'series' }, data: [220, 302, 181, 234, 210, 290, 150] } ] }; if (option && typeof option === 'object') { myChart.setOption(option); setInterval(async function(){ for (let index = 0; index < option.series.length; index++) { option.series[index].data=Random(); } myChart.setOption(option); },3000); } window.addEventListener('resize', myChart.resize); function Random(){ var array=[]; for (let index = 0; index < 7; index++) { array.push(Math.round(Math.random()*80+20)); } return array; } </script> </html>
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/install/class.php
install/class.php
<?php /* * @Author: yihua * @Date: 2025-01-04 17:57:38 * @LastEditTime: 2025-01-05 11:21:27 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\install\class.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ /** * Class install */ class install { /** * @param $string * @param int $force * @param bool $strip * @return array|string */ public function daddslashes($string, $force = 0, $strip = FALSE) { // !defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc()); // if (!MAGIC_QUOTES_GPC || $force) { // if (is_array($string)) { // foreach ($string as $key => $val) { // $string[$key] = install::daddslashes($val, $force, $strip); // } // } else { // $string = htmlspecialchars($strip ? stripslashes($string) : $string); // } // } foreach ($string as $key => $value) { // code... //var_dump($key); $string[$key] = addslashes($value); } return $string; } /** * @param $dbconfig * @return array * 文件修改操作 */ public function ModifyFileContents($dbconfig) { $FILE = '../config.php'; // $data = "<?php // /*数据库配置*/ // $" . "dbconfig" . " = [ // 'host' => '" . $dbconfig['host'] . "', //数据库服务器 // 'port' => " . $dbconfig['port'] . ", //数据库端口 // 'user' => '" . $dbconfig['user'] . "', //数据库用户名 // 'pwd' => '" . $dbconfig['pwd'] . "', //数据库密码 // 'dbname' => '" . $dbconfig['dbname'] . "', //数据库名 // ]"; $data = "<?php /*数据库配置*/ $" . "dbconfig" . "=array( 'host' => '" . $dbconfig['host'] . "', //数据库服务器 'port' => " . $dbconfig['port'] . ", //数据库端口 'user' => '" . $dbconfig['user'] . "', //数据库用户名 'pwd' => '" . $dbconfig['pwd'] . "', //数据库密码 'dbname' => '" . $dbconfig['dbname'] . "', //数据库名 );?>"; $numbytes = file_put_contents($FILE, $data); if ($numbytes) { return ['code' => 1, 'msg' => '数据更新成功!']; } else { return ['code' => -1, 'msg' => '写入失败或者文件(config.php)没有写入权限,注意检查!']; } } }
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/install/ajax.php
install/ajax.php
<?php /* * @Author: yihua * @Date: 2025-01-04 17:57:38 * @LastEditTime: 2025-01-05 11:21:19 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\install\ajax.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ /** * 安裝ajax.php文件 */ error_reporting(0); date_default_timezone_set('Asia/Shanghai'); @header('Content-Type: application/json; charset=UTF-8'); require './db.class.php'; include_once("./class.php"); $class = new install(); $_QET = $class->daddslashes($_REQUEST); if (file_exists("../install.lock")) die(json_encode(['code' => -1, 'msg' => '检测到您已经安装过程序,请先删除install目录下的../install.lock文件再来安装!'])); $act = isset($_GET["act"]) ? $_GET["act"] : ""; switch ($act) { case 1: #安装数据库 if (empty($_QET['host']) || empty($_QET['port']) || empty($_QET['user']) || empty($_QET['pwd']) || empty($_QET['dbname'])) die(json_encode(['code' => -1, 'msg' => '请确保每一项都不为空!'])); /** * 校验 */ if (!$con = DB::connect($_QET['host'], $_QET['user'], $_QET['pwd'], $_QET['dbname'], $_QET['port'])) { if (DB::connect_errno() == 2002) die(json_encode(['code' => 2002, 'msg' => '连接数据库失败,数据库地址填写错误!'])); elseif (DB::connect_errno() == 1045) die(json_encode(['code' => 2002, 'msg' => '连接数据库失败,数据库用户名或密码填写错误!'])); elseif (DB::connect_errno() == 1049) die(json_encode(['code' => 2002, 'msg' => '连接数据库失败,数据库名不存在!'])); else die(json_encode(['code' => DB::connect_errno(), 'msg' => '连接数据库失败' . DB::connect_error()])); } /** * 写入文件 */ $ar = $class->ModifyFileContents($_QET); if ($ar['code'] <> 1) die(json_encode(['code' => -1, 'msg' => $ar['msg']])); /** * 写入数据 */ $sql = file_get_contents("ccpy.sql"); $sql = explode(';', $sql); $DBS = DB::connect($_QET['host'], $_QET['user'], $_QET['pwd'], $_QET['dbname'], $_QET['port']); if (!$DBS) die(json_encode(['code' => -1, 'msg' => DB::connect_error()])); if (DB::get_row("select * from information_schema.TABLES where TABLE_NAME = 'sub_admin'") != null) { die(json_encode(['code' => -2, 'msg' => '安装失败,请清空数据库后重试<br/>如果只是更新请直接填写config文件<br/>SQL成功' . $a . '句/失败' . $b . '句<br/>错误信息:' . $e])); } DB::query("set sql_mode = ''"); DB::query("set names utf8"); $a = 0; $b = 0; $e = ''; foreach ($sql as $v) { if ($_QET['state'] == 2 && strstr($v, 'DROP TABLE IF EXISTS') || $v == '') continue; if (DB::query($v)) { $a++; } else { $b++; $e .= DB::error() . '<br/>'; } } $site_url = $_SERVER['HTTP_HOST']; $sqluser = "UPDATE sub_admin SET siteurl='" . $site_url . "' WHERE username='admin'"; DB::query($sqluser); if ($_QET['state'] == 2) { @file_put_contents("../install.lock", '安装锁'); die(json_encode(['code' => 1, 'msg' => '安装完成!<br/>SQL成功' . $a . '句/失败' . $b . '句,未删除原数据,进入下一步即可!'])); } if ($b == 0) { @file_put_contents("../install.lock", '安装锁'); die(json_encode(['code' => 1, 'msg' => '安装完成!<br/>SQL成功' . $a . '句/失败' . $b . '句'])); } else { die(json_encode(['code' => -2, 'msg' => '安装失败,请清空数据库后重试<br/>如果只是更新请直接填写config文件<br/>SQL成功' . $a . '句/失败' . $b . '句<br/>错误信息:' . $e])); } break; case 2: if (empty($_QET['host']) || empty($_QET['port']) || empty($_QET['user']) || empty($_QET['pwd']) || empty($_QET['dbname'])) die(json_encode(['code' => -1, 'msg' => '请确保每一项都不为空!'])); /** * 校验 */ if (!$con = DB::connect($_QET['host'], $_QET['user'], $_QET['pwd'], $_QET['dbname'], $_QET['port'])) { if (DB::connect_errno() == 2002) die(json_encode(['code' => 2002, 'msg' => '连接数据库失败,数据库地址填写错误!'])); elseif (DB::connect_errno() == 1045) die(json_encode(['code' => 2002, 'msg' => '连接数据库失败,数据库用户名或密码填写错误!'])); elseif (DB::connect_errno() == 1049) die(json_encode(['code' => 2002, 'msg' => '连接数据库失败,数据库名不存在!'])); else die(json_encode(['code' => DB::connect_errno(), 'msg' => '连接数据库失败' . DB::connect_error()])); } $DBS = DB::connect($_QET['host'], $_QET['user'], $_QET['pwd'], $_QET['dbname'], $_QET['port']); if ($DBS) { if (DB::get_row("select * from information_schema.TABLES where TABLE_NAME = 'sub_admin'") != null) { DB::query("set sql_mode = ''"); DB::query("set names utf8"); DB::query("DROP TABLE application"); DB::query("DROP TABLE daili"); DB::query("DROP TABLE kami"); DB::query("DROP TABLE log"); DB::query("DROP TABLE order_list"); DB::query("DROP TABLE server_list"); DB::query("DROP TABLE sub_admin"); DB::query("DROP TABLE sup_admin"); DB::query("DROP TABLE app_server"); $sql = file_get_contents("ccpy.sql"); $sql = explode(';', $sql); $DBS = DB::connect($_QET['host'], $_QET['user'], $_QET['pwd'], $_QET['dbname'], $_QET['port']); if (!$DBS) die(json_encode(['code' => -1, 'msg' => DB::connect_error()])); $a = 0; $b = 0; $e = ''; foreach ($sql as $v) { if ($_QET['state'] == 2 && strstr($v, 'DROP TABLE IF EXISTS') || $v == '') continue; if (DB::query($v)) { $a++; } else { $b++; $e .= DB::error() . '<br/>'; } } $site_url = $_SERVER['HTTP_HOST']; $sqluser = "UPDATE sub_admin SET siteurl='" . $site_url . "' WHERE username='admin'"; DB::query($sqluser); if ($_QET['state'] == 2) { @file_put_contents("../install.lock", '安装锁'); die(json_encode(['code' => 1, 'msg' => '安装完成!<br/>SQL成功' . $a . '句/失败' . $b . '句,未删除原数据,进入下一步即可!'])); } if ($b == 0) { @file_put_contents("../install.lock", '安装锁'); die(json_encode(['code' => 1, 'msg' => '安装完成!<br/>SQL成功' . $a . '句/失败' . $b . '句'])); } else { die(json_encode(['code' => -1, 'msg' => '安装失败,请清空数据库后重试<br/>如果只是更新请直接填写config文件<br/>SQL成功' . $a . '句/失败' . $b . '句<br/>错误信息:' . $e])); } } } else { die(json_encode(['code' => -1, 'msg' => DB::connect_error()])); } break; case 3: @file_put_contents("../install.lock", '安装锁'); die(json_encode(['code' => 1, 'msg' => '安装完成!'])); break; case 4: if (empty($_QET['host']) || empty($_QET['port']) || empty($_QET['user']) || empty($_QET['pwd']) || empty($_QET['dbname'])) die(json_encode(['code' => -1, 'msg' => '请确保每一项都不为空!'])); /** * 校验 */ if (!$con = DB::connect($_QET['host'], $_QET['user'], $_QET['pwd'], $_QET['dbname'], $_QET['port'])) { if (DB::connect_errno() == 2002) die(json_encode(['code' => 2002, 'msg' => '连接数据库失败,数据库地址填写错误!'])); elseif (DB::connect_errno() == 1045) die(json_encode(['code' => 2002, 'msg' => '连接数据库失败,数据库用户名或密码填写错误!'])); elseif (DB::connect_errno() == 1049) die(json_encode(['code' => 2002, 'msg' => '连接数据库失败,数据库名不存在!'])); else die(json_encode(['code' => DB::connect_errno(), 'msg' => '连接数据库失败' . DB::connect_error()])); } $DBS = DB::connect($_QET['host'], $_QET['user'], $_QET['pwd'], $_QET['dbname'], $_QET['port']); if ($DBS) { if (DB::get_row("select * from information_schema.TABLES where TABLE_NAME = 'sub_admin'") != null) { die(json_encode(['code' => 1, 'msg' => '已经安装过'])); } else { die(json_encode(['code' => 0, 'msg' => '没有安装过'])); } } else { die(json_encode(['code' => -1, 'msg' => DB::connect_error()])); } break; }
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/install/db.class.php
install/db.class.php
<?php /* * @Author: yihua * @Date: 2025-01-04 17:57:38 * @LastEditTime: 2025-01-05 10:27:54 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\install\db.class.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ if (extension_loaded('mysqli')) { class DB { private static $link; public static function connect($db_host, $db_user, $db_pass, $db_name, $db_port) { self::$link = mysqli_connect($db_host, $db_user, $db_pass, $db_name, $db_port); return self::$link; } public static function connect_errno() { return mysqli_connect_errno(); } public static function connect_error() { return mysqli_connect_error(); } public static function fetch($q) { return mysqli_fetch_assoc($q); } public static function get_row($q) { $result = mysqli_query(self::$link, $q); return mysqli_fetch_assoc($result); } public static function count($q) { $result = mysqli_query(self::$link, $q); $count = mysqli_fetch_array($result); return $count[0]; } public static function query($q) { return mysqli_query(self::$link, $q); } public static function escape($str) { return mysqli_real_escape_string(self::$link, $str); } public static function affected() { return mysqli_affected_rows(self::$link); } public static function errno() { return mysqli_errno(self::$link); } public static function error() { return mysqli_error(self::$link); } public static function close() { return mysqli_close(self::$link); } } } else { class DB { private static $link; public static function connect($db_host, $db_user, $db_pass, $db_name, $db_port) { self::$link = mysql_connect($db_host . ':' . $db_port, $db_user, $db_pass); if (!self::$link) return false; return mysql_select_db($db_name, self::$link); } public static function connect_errno() { return mysql_errno(); } public static function connect_error() { return mysql_error(); } public static function fetch($q) { return mysql_fetch_assoc($q); } public static function get_row($q) { $result = mysql_query($q, self::$link); return mysql_fetch_assoc($result); } public static function count($q) { $result = mysql_query($q, self::$link); $count = mysql_fetch_array($result); return $count[0]; } public static function query($q) { return mysql_query($q, self::$link); } public static function escape($str) { return mysql_real_escape_string($str, self::$link); } public static function affected() { return mysql_affected_rows(self::$link); } public static function errno() { return mysql_errno(self::$link); } public static function error() { return mysql_error(self::$link); } public static function close() { return mysql_close(self::$link); } } }
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
false
yeuxuan/ccproxy_kami
https://github.com/yeuxuan/ccproxy_kami/blob/7ed97f478a791b213e3a1401a9853133324eed74/install/index.php
install/index.php
<?php /* * @Author: yihua * @Date: 2025-01-04 17:57:38 * @LastEditTime: 2025-01-06 11:31:27 * @LastEditors: yihua * @Description: * @FilePath: \ccproxy_end\install\index.php * 💊物物而不物于物,念念而不念于念🍁 * Copyright (c) 2025 by yihua, All Rights Reserved. */ /** * 安装程序 */ error_reporting(0); define('VERSION', '2.0.0'); //版本号 session_start(); @header('Content-Type: text/html; charset=UTF-8'); include("../config.php"); $type = $type = isset($_GET['type']) ? addslashes($_GET['type']) : "";; $a = 1; function checkfunc($f, $m = false) { if (function_exists($f)) { return '<font color="green">可用</font>'; } else { if ($m == false) { return '<font color="black">不支持</font>'; } else { return '<font color="red">不支持</font>'; } } } // 清空文件夹函数和清空文件夹后删除空文件夹函数的处理 function deldir() { // 设置需要删除的文件夹 $path = "../install"; //如果是目录则继续 if (is_dir($path)) { //扫描一个文件夹内的所有文件夹和文件并返回数组 $data = scandir($path); // todo 赋予文件夹权限 chmod($path, 0777); foreach ($data as $val) { //排除目录中的.和.. if ($val != "." && $val != "..") { // 1,如果是目录则递归子目录,继续操作 if (is_dir($path . '/' . $val)) { // 2,子目录中操作删除文件夹和文件 deldir($path . '/' . $val . '/'); // 3,目录清空后删除空文件夹 @rmdir($path . '/' . $val . '/'); } else { // 4,如果是文件直接删除 unlink($path . '/' . $val); } } } } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>一花CCPROXY系统安装模块</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta content="一花CCPROXY系统安装模块,一花CCPROXY系统安装模块,一花CCPROXY系统安装模块,免费,免费引流程序" name="description" /> <meta content="Coderthemes" name="author" /> <!-- App favicon --> <link rel="shortcut icon" href="../favicon.ico"> <!-- App css --> <link href="../assets/css/icons.min.css" rel="stylesheet" type="text/css" /> <link href="../assets/css/app.min.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="../assets/layui/css/layui.css" /> </head> <style> /* 主题颜色变量定义 */ :root { --primary-color: #2196F3; --secondary-color: #4CAF50; --accent-color: #FF4081; --hover-color: rgba(33, 150, 243, 0.1); --shadow-color: rgba(0, 0, 0, 0.1); } .nav-pills .nav-link.active, .nav-pills .show>.nav-link { background: #2196F3; /* 使用统一的主题色 */ background: -webkit-linear-gradient(45deg, #2196F3, #00BCD4); background: linear-gradient(45deg, #2196F3, #00BCD4); box-shadow: 0 2px 5px rgba(33, 150, 243, 0.3); } .form-control:hover { border-color: var(--primary-color) !important; color: #333333; } .layui-form-onswitch { border-color: var(--secondary-color) !important; background-color: var(--secondary-color); } .card { animation: slideIn 0.8s ease-out; box-shadow: 0 4px 8px var(--shadow-color); transition: all 0.3s ease; background: linear-gradient(145deg, #ffffff, #f5f5f5); } .card:hover { transform: translateY(-5px); box-shadow: 0 8px 16px rgba(33, 150, 243, 0.15); } .btn { transition: all 0.3s ease; background: var(--primary-color); border: none; } .btn-success { background: var(--secondary-color); } .btn:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(33, 150, 243, 0.2); opacity: 0.9; } .form-control { transition: all 0.3s ease; border: 1px solid #e0e0e0; } .form-control:focus { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(33, 150, 243, 0.1); border-color: var(--primary-color); } .table tbody tr:hover { background-color: var(--hover-color); transform: translateX(5px); } /* 成功图标颜色 */ .text-success { color: var(--secondary-color) !important; } /* 进度条颜色 */ .progress-bar { background: linear-gradient(45deg, #2196F3, #00BCD4); } /* 错误提示颜色 */ .text-danger { color: var(--accent-color) !important; } /* 保持其他动画相关的CSS不变 */ @keyframes slideIn { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } } @keyframes checkmark { 0% { transform: scale(0); opacity: 0; } 50% { transform: scale(1.2); } 100% { transform: scale(1); opacity: 1; } } /* 修改开关按钮样式和动画 */ .layui-form-switch { min-width: 54px; height: 24px; line-height: 24px; border-radius: 12px; border-color: #e0e0e0; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* 使用更平滑的过渡曲线 */ padding: 0 5px 0 25px; margin-top: 0; cursor: pointer; overflow: hidden; /* 防止内容溢出 */ } .layui-form-switch i { width: 20px; height: 20px; border-radius: 50%; top: 1px; left: 2px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); background-color: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 添加阴影效果 */ } .layui-form-switch em { font-size: 12px; margin-right: 5px; color: #999; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); opacity: 0.8; /* 稍微降低文字透明度 */ } /* 开关打开状态 */ .layui-form-onswitch { border-color: var(--primary-color) !important; background-color: var(--primary-color); padding: 0 25px 0 5px; } .layui-form-onswitch i { left: auto; right: 2px; background-color: #fff; transform: scale(1.1); /* 开启状态下圆点稍微放大 */ } .layui-form-onswitch em { color: rgba(255, 255, 255, 0.9); /* 开启状态下文字颜色 */ } /* 悬浮效果 */ .layui-form-switch:hover { border-color: var(--primary-color); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2); } .layui-form-switch:hover i { transform: scale(1.05); /* 悬浮时圆点稍微放大 */ } /* 点击效果 */ .layui-form-switch:active i { transform: scale(0.95); /* 点击时圆点稍微缩小 */ transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1); } .layui-form-onswitch:active i { transform: scale(1.05); /* 开启状态下点击效果 */ } /* 开关背景过渡效果 */ .layui-form-switch::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: var(--primary-color); opacity: 0; transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1); border-radius: 12px; } .layui-form-onswitch::before { opacity: 1; } /* 调整协议组中开关的位置 */ .protocol-group { display: flex; align-items: center; justify-content: space-between; padding: 12px 15px; /* 减小内边距 */ background: rgba(33, 150, 243, 0.05); border-radius: 8px; margin: 10px 0; min-height: 45px; /* 减小最小高度 */ } .switch-wrapper { margin-left: 15px; /* 减小左边距 */ display: flex; /* 使用flex布局 */ align-items: center; /* 垂直居中 */ } /* 开关悬浮效果 */ .layui-form-switch:hover { border-color: var(--primary-color); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2); } /* 安装协议链接美化 */ .protocol-link { color: var(--primary-color) !important; text-decoration: none; position: relative; padding-bottom: 2px; font-weight: 500; transition: all 0.3s ease; } .protocol-link::after { content: ''; position: absolute; width: 0; height: 2px; bottom: 0; left: 0; background-color: var(--primary-color); transition: all 0.3s ease; } .protocol-link:hover { color: var(--accent-color) !important; } .protocol-link:hover::after { width: 100%; } /* 按钮美化 */ .btn { padding: 8px 20px; border-radius: 50px; text-transform: uppercase; font-weight: 500; letter-spacing: 1px; transition: all 0.3s ease; position: relative; overflow: hidden; } .btn::after { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; background: rgba(255, 255, 255, 0.2); border-radius: 50%; transform: translate(-50%, -50%); transition: width 0.6s ease, height 0.6s ease; } .btn:hover::after { width: 200px; height: 200px; } .btn-primary { background: linear-gradient(45deg, var(--primary-color), #1976D2); } .btn-success { background: linear-gradient(45deg, var(--secondary-color), #388E3C); } /* 协议开关组样式 */ .protocol-group { display: flex; align-items: center; padding: 15px; background: rgba(33, 150, 243, 0.05); border-radius: 10px; margin: 15px 0; } .protocol-group label { margin-bottom: 0; margin-right: 10px; } /* 添加脉冲动画提示用户注意 */ @keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(33, 150, 243, 0); } 100% { box-shadow: 0 0 0 0 rgba(33, 150, 243, 0); } } .protocol-group { animation: pulse 2s infinite; } </style> <body> <!-- Begin page --> <div class="wrapper"> <div class="content"> <!-- Start Content--> <div class="container-fluid"> <div class="row mt-4 text-center"> <div class="col-xl-6" style="margin:auto"> <div class="card"> <?php if ($type == "installok") { deldir(); ?> <div class="card-body"> <h2 class="header-title mb-3 text-success font-18 font-weight-light">一花CCPROXY在线安装引导程序</h2> <div id="progressbarwizard"> <ul class="nav nav-pills nav-justified form-wizard-header mb-3 "> <li class="nav-item"> <a href="#finish-2" data-toggle="tab" class="nav-link rounded-0 pt-2 pb-2 active"> <i class="mdi mdi-checkbox-marked-circle-outline mr-1"></i> <span class="d-none d-sm-inline font-weight-light">安装完成</span> </a> </li> </ul> <div class="tab-content b-0 mb-0"> <div id="bar" class="progress mb-3" style="height: 10px;"> <div class="bar progress-bar progress-bar-striped progress-bar-animated bg-success"></div> </div> <div class="tab-pane active" id="finish-2"> <div class="row"> <div class="col-12"> <div class="text-center"> <h2 class="mt-0 text-success"><i class="mdi mdi-check-all"></i> </h2> <h3 class="mt-2 text-success">恭喜你</h3> <p class="w-75 mb-2 mt-2 mx-auto">本程序已经成功安装到您的服务器上!</p> <p class="w-75 mb-2 mt-2 mx-auto">默认后台为:sub_admin 账号:admin 密码:123456</p> <p class="w-75 mb-2 mt-2 mx-auto">官方QQ群(o´ω`o)ノ: <font color="red" class="font-18"><a href="https://jq.qq.com/?_wv=1027&k=N4E82kgw">点击加群</a></font>,关注可了解更多资讯! </p> <p class="w-75 mb-2 mt-2 mx-auto"> 当前程序版本:V <?= VERSION ?></p> <!-- <p class="w-75 mb-2 mt-2 mx-auto">点击<a href="http://docs.api.ln.cn/" target="_blank" style="color: turquoise">这里</a>进入网页查看操作文档</p> --> </div> </div> <!-- end col --> </div> <!-- end row --> <ul class="list-inline mb-0 mt-2 wizard text-center"> <li class=" list-inline-item"> <a href="../index.php" target="_blank"> <button type="button" class="btn btn-primary">打开首页</button> </a> <a href="../sub_admin/" target="_blank"> <button type="button" class="btn btn-success">进入后台</button> </a> </li> </ul> </div> </div> <!-- tab-content --> </div> <!-- end #progressbarwizard--> </div> <!-- end card-body --> <?php } else { ?> <div class="card-body"> <h2 class="header-title mb-3 text-success font-18 font-weight-light">一花CCPROXY在线安装引导程序</h2> <div id="progressbarwizard"> <ul class="nav nav-pills nav-justified form-wizard-header mb-3 "> <li class="nav-item"> <a href="#account-2" data-toggle="tab" class="nav-link rounded-0 pt-2 pb-2"> <i class="mdi mdi-account-circle mr-1"></i> <span class="d-none d-sm-inline font-weight-light">环境检测</span> </a> </li> <?php if (!file_exists("../install.lock")) { ?> <li class="nav-item"> <a style="<?php if (!(version_compare(PHP_VERSION, '7.3', '>'))) { echo 'pointer-events: none;'; } ?>" href="#profile-tab-2" data-toggle="tab" class="nav-link rounded-0 pt-2 pb-2"> <i class="mdi mdi-face-profile mr-1"></i> <span class="d-none d-sm-inline font-weight-light">数据填写</span> </a> </li> <?php } ?> </ul> <div class="tab-content b-0 mb-0"> <div id="bar" class="progress mb-3" style="height: 10px;"> <div class="bar progress-bar progress-bar-striped progress-bar-animated bg-danger"></div> </div> <div class="tab-pane" id="account-2"> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-body"> <h4 class="header-title font-weight-light">环境检测</h4> <p class="w-75 mb-2 mt-2 mx-auto">官方QQ群(o´ω`o)ノ: <font color="red" class="font-18"><a href="https://jq.qq.com/?_wv=1027&k=N4E82kgw">点击加群</a></font>,关注可了解更多资讯! </p> <p class="text-muted font-14 mb-3"> <code>为了更好的使用程序,下列环境须支持才可正常运行</code>. </p> <div class="table-responsive-sm"> <table class="table table-striped mb-0"> <thead> <tr> <th>函数检测</th> <th>需求</th> <th>当前</th> <th>用途</th> </tr> </thead> <tbody> <tr> <td>PHP 7.0+</td> <td>必须</td> <td> <?php if (!(version_compare(PHP_VERSION, '7.3', '>')) || !(version_compare(PHP_VERSION, '7.5', '<'))) { $a = 2; } echo (version_compare(PHP_VERSION, '7.3', '>')) && (version_compare(PHP_VERSION, '7.5', '<')) ? '<font color="green">' . PHP_VERSION . '</font>' : '<font color="red">' . PHP_VERSION . '</font>'; ?> </td> <td> PHP版本支持 </td> </tr> <tr> <td>curl_exec()</td> <td>必须</td> <td><?php echo checkfunc('curl_exec', true); ?></td> <td>抓取网页</td> </tr> <tr> <td>file_get_contents()</td> <td>必须</td> <td><?php echo checkfunc('file_get_contents', true); ?></td> <td>读取文件</td> </tr> <tr> <td>session</td> <td>必须</td> <td><?php $_SESSION['checksession'] = 1; echo $_SESSION['checksession'] == 1 ? '<font color="green">可用</font>' : '<font color="red">不支持</font>'; ?></td> <td>PHP必备功能</td> </tr> </tbody> </table> </div> <!-- end table-responsive--> <?php if (file_exists("../install.lock")) { ?> <ul class="list-inline mb-0 wizard"> <li class="list-inline-item float-right"> <a href="#"> <button type="button" class="btn btn-danger" onclick="layer.alert('检测到您已经安装过程序<br>请先删除install目录下的<font color=red>../install.lock</font>文件再来安装!',{icon:2,title:'警告'})"> 进行下一步 </button> </a> </li> </ul> <?php } else { ?> <ul class="list-inline mb-0 wizard"> <li class="next list-inline-item float-right"> <a href="#"> <button type="button" class="btn btn-success" <?= $a == 1 ? '' : 'disabled=""'; ?>> 进入下一步 </button> </a> </li> </ul> <?php } ?> </div> </div> </div> <!-- end col --> </div> <!-- end row --> </div> <?php if (!file_exists("../install.lock")) { ?> <div class="tab-pane" id="profile-tab-2"> <div class="row"> <div class="col-12"> <span class="text-center mb-2 d-block">可手动前往文件:<code>config.php</code> 配置数据!</span> <form class="layui-form form-horizontal"> <div class="form-group row mb-3"> <label class="col-md-3 col-form-label font-weight-light" for="host">数据库地址</label> <div class="col-md-9"> <input type="text" id="host" name="host" class="form-control" lay-verify="required" value="<?= $dbconfig["host"] ?>"> </div> </div> <div class="form-group row mb-3"> <label class="col-md-3 col-form-label font-weight-light" for="port">数据库端口</label> <div class="col-md-9"> <input type="number" id="port" name="port" class="form-control" lay-verify="required" value="<?= $dbconfig["port"] ?>"> </div> </div> <div class="form-group row mb-3"> <label class="col-md-3 col-form-label font-weight-light" for="user">数据库用户名</label> <div class="col-md-9"> <input type="text" id="user" name="user" class="form-control" lay-verify="required" value="<?= $dbconfig["user"] ?>"> </div> </div> <div class="form-group row mb-3"> <label class="col-md-3 col-form-label font-weight-light" for="pwd">数据库密码</label> <div class="col-md-9"> <input type="text" id="pwd" name="pwd" class="form-control" lay-verify="required" value="<?= $dbconfig["pwd"] ?>"> </div> </div> <div class="form-group row mb-3"> <label class="col-md-3 col-form-label font-weight-light" for="token">数据库名称</label> <div class="col-md-9"> <input type="text" id="dbname" name="dbname" class="form-control" lay-verify="required" value="<?= $dbconfig["dbname"] ?>" placeholder="请填写您数据库的名称"> </div> </div> <div class="form-group row mb-3"> <label class="col-md-3 col-form-label font-weight-light" for="url">当前程序版本</label> <div class="col-md-9"> <input type="text" id="versions" name="versions" class="form-control" lay-verify="required" value="V <?= VERSION ?>" readonly> </div> </div> <div class="form-group row mb-3"> <div class="col-md-12"> <div class="protocol-group"> <label class="col-form-label font-weight-light" for="switch"> <a href="disclaimer.html" target="_blank" class="protocol-link"> <i class="mdi mdi-file-document-outline mr-1"></i>安装协议 </a> </label> <div class="switch-wrapper"> <input type="checkbox" name="switch" lay-verify="required" lay-skin="switch" lay-filter="xy">
php
Apache-2.0
7ed97f478a791b213e3a1401a9853133324eed74
2026-01-05T04:52:19.238668Z
true
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/page.php
page.php
<?php $latte->render(tr_view_path('templates/page')); ?>
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/functions.php
functions.php
<?php define('TR_THEME_DIR', get_template_directory()); define('TR_GUTENBERG_DIR', TR_THEME_DIR . '/gutenberg'); define('TR_BLOCKS_DIR', TR_GUTENBERG_DIR . '/blocks'); require get_template_directory() . '/php-inc/theme-support.php'; require get_template_directory() . '/php-inc/latte.php'; // Check if ACF or ACF Pro is installed and activated if (class_exists('acf')) { require get_template_directory() . '/php-inc/sync-acf.php'; require get_template_directory() . '/php-inc/acf-options-pages.php'; } require get_template_directory() . '/php-inc/sync-cptui.php'; require get_template_directory() . '/php-inc/custom-post-types.php'; require get_template_directory() . '/php-inc/ThemeRedoneWalker.php'; // XXX: This file removes some common WP enqueues such as jQuery, emojis etc. // We are disabling those to get better performance. But if you need to support those, // just remove or comment the line require get_template_directory() . '/php-inc/dequeues.php'; require get_template_directory() . '/php-inc/enqueues.php'; require get_template_directory() . '/php-inc/remove-css-js-version.php'; require get_template_directory() . '/php-inc/theme-functions.php'; // require get_template_directory() . '/php-inc/sidebars.php'; // INIT THE BLOCKS FRAMEWORK require get_template_directory() . '/php-inc/enqueue-block-specific-css-and-js.php'; require get_template_directory() . '/gutenberg/init.php';
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/index.php
index.php
<?php $latte->render(tr_view_path('templates/index')); ?>
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/404.php
404.php
<?php $latte->render(tr_view_path('templates/404'));
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/front-page.php
front-page.php
<?php $attrs = []; $latte->render(tr_view_path('templates/front-page'), $attrs); ?>
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/single.php
single.php
<?php $latte->render(tr_view_path('templates/single')); ?>
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/php-inc/custom-post-types.php
php-inc/custom-post-types.php
<?php // Either create them here, or use CPT UI plugin // function create_post_type() // { // NEWS CPT // register_post_type( // 'news', // array( // 'labels' => array( // 'name' => __('News'), // 'singular_name' => __('News Post') // ), // 'hierarchical' => true, // 'public' => true, // 'menu_icon' => 'dashicons-media-text', // 'has_archive' => true, // 'supports' => array( 'title', 'editor', 'thumbnail' ), // 'publicly_queryable' => true, // 'show_in_rest' => true, // 'rest_base' => 'news', // 'rest_controller_class' => 'WP_REST_Posts_Controller', // ) // ); // add_action('init', 'create_post_type');
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/php-inc/enqueue-block-specific-css-and-js.php
php-inc/enqueue-block-specific-css-and-js.php
<?php function tr_enqueue_block_specific_css_and_js() { if (!is_single() && !is_page()) return; global $post; if (empty($post->post_content)) return; if (has_blocks($post->post_content)) { $block_prefix = json_decode(file_get_contents(get_template_directory() . "/theme_redone_global_config.json"), true)['BLOCK_NAME_PREFIX']; $blocks = parse_blocks($post->post_content); if (empty($blocks)) return; $tr_custom_blocks_names = []; //START:populate tr_custom_blocks_names arr without duplicates // if there are repeated blocks, add only once // so we don't enqueue duplicate CSS and JS function tr_parse_blocks($blocks, $block_prefix, &$tr_custom_blocks_names) { foreach ($blocks as $block) { $block_name = $block['blockName']; if (!is_null($block_name) && str_starts_with($block_name, "$block_prefix/")) { if (!in_array($block_name, $tr_custom_blocks_names)) { $tr_custom_blocks_names[] = $block_name; // if nested blocks, parse them as well if (!empty($block['innerBlocks'])) { tr_parse_blocks($block['innerBlocks'], $block_prefix, $tr_custom_blocks_names); } } } } } tr_parse_blocks($blocks, $block_prefix, $tr_custom_blocks_names); //END:populate tr_custom_blocks_names arr without duplicates if (empty($tr_custom_blocks_names)) return; // If page/post contains custom blocks $blocks_shared_css = []; $blocks_shared_js = []; function tr_contains_valid_file($file_path) { return (file_exists($file_path) && filesize($file_path)); } function tr_should_consider_dep($deps_name, $deps_arr) { return ( array_key_exists($deps_name, $deps_arr) && is_array($deps_arr[$deps_name]) && !empty($deps_arr[$deps_name]) ); } foreach ($tr_custom_blocks_names as $custom_block_name) { $block_name_without_prefix = substr( $custom_block_name, strlen($block_prefix) + 1 ); // Check if block has deps (CSS/JS) defined in model.json $block_model = json_decode(file_get_contents(TR_BLOCKS_DIR . "/$block_name_without_prefix/model.json"), true); $block_meta = $block_model['block_meta']; // START:block_meta contains deps property if (array_key_exists("deps", $block_meta)) { $deps = $block_meta['deps']; //START:populate $blocks_shared_css array if (tr_should_consider_dep('css', $deps)) { foreach ($deps['css'] as $single_dep_css) { if (!in_array($single_dep_css, $blocks_shared_css)) { $blocks_shared_css[] = $single_dep_css; } } } //END:populate $blocks_shared_css array //START:populate $blocks_shared_js array if (tr_should_consider_dep('js', $deps)) { foreach ($deps['js'] as $single_js_css) { if (!in_array($single_js_css, $blocks_shared_js)) { $blocks_shared_js[] = $single_js_css; } } } //END:populate $blocks_shared_js array } // END:block_meta contains deps property } //end:foreach custom block name $shared_css_and_js_system_dir_path = TR_THEME_DIR . "/prod/blocks-shared"; $shared_css_and_js_theme_dir_path = get_stylesheet_directory_uri() . "/prod/blocks-shared"; //start:enqueue each shared CSS file if (!empty($blocks_shared_css)) { foreach ($blocks_shared_css as $shared_css_filename) { // if directory contains specified shared CSS file and it is not empty $custom_block_shared_css_path = "$shared_css_and_js_system_dir_path/$shared_css_filename.min.css"; if (tr_contains_valid_file($custom_block_shared_css_path)) { wp_enqueue_style( "tr-block-shared-css--$shared_css_filename", "$shared_css_and_js_theme_dir_path/$shared_css_filename.min.css" ); } } } //end:enqueue each shared CSS file //start:enqueue each shared JS file if (!empty($blocks_shared_js)) { foreach ($blocks_shared_js as $shared_js_filename) { // if directory contains specified shared JS file and it is not empty $custom_block_shared_js_path = "$shared_css_and_js_system_dir_path/$shared_js_filename.min.js"; if (tr_contains_valid_file($custom_block_shared_js_path)) { wp_enqueue_script( "tr-block-shared-js--$shared_js_filename", "$shared_css_and_js_theme_dir_path/$shared_js_filename.min.js", array(), false, true ); } } } //end:enqueue each shared JS file // START:CHECK FOR AND ENQUEUE BLOCK SPECIFIC CSS AND JS $block_css_filename = "frontend.min.css"; $block_js_filename = "frontend.min.js"; foreach ($tr_custom_blocks_names as $custom_block_name) { $block_name_without_prefix = substr( $custom_block_name, strlen($block_prefix) + 1 ); $custom_block_dir_path = TR_THEME_DIR . "/prod/block-specific/$block_name_without_prefix"; $gutenberg_blocks_dir_path = get_stylesheet_directory_uri() . "/prod/block-specific"; // if directory contains frontend.css and it is not empty $custom_block_css_path = "$custom_block_dir_path/$block_css_filename"; if (tr_contains_valid_file($custom_block_css_path)) { wp_enqueue_style( "tr-block-css--$block_prefix-$block_name_without_prefix", "$gutenberg_blocks_dir_path/$block_name_without_prefix/$block_css_filename" ); } //end:enqueue block specific CSS // if directory contains frontend.js and it is not empty $custom_block_js_path = "$custom_block_dir_path/$block_js_filename"; if (tr_contains_valid_file($custom_block_js_path)) { wp_enqueue_script( "tr-block-js--$block_prefix-$block_name_without_prefix", "$gutenberg_blocks_dir_path/$block_name_without_prefix/$block_js_filename", array(), false, true ); } //end:enqueue block specific JS } // END:CHECK FOR AND ENQUEUE BLOCK SPECIFIC CSS AND JS } // END:if post has content } // END:tr_enqueue_block_specific_css_and_js add_action('wp_enqueue_scripts', 'tr_enqueue_block_specific_css_and_js');
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/php-inc/remove-css-js-version.php
php-inc/remove-css-js-version.php
<?php // Remove WP Version From Styles add_filter('style_loader_src', 'sdt_remove_ver_css_js', 9999); // Remove WP Version From Scripts add_filter('script_loader_src', 'sdt_remove_ver_css_js', 9999); // Function to remove version numbers function sdt_remove_ver_css_js($src) { if (strpos($src, 'ver=')) $src = remove_query_arg('ver', $src); return $src; }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/php-inc/acf-options-pages.php
php-inc/acf-options-pages.php
<?php if( function_exists('acf_add_options_page') ) { acf_add_options_page( array( 'page_title' => 'Theme General Settings', 'menu_title' => 'Theme Settings', 'menu_slug' => 'theme-general-settings', 'capability' => 'edit_posts', 'redirect' => false ) ); acf_add_options_sub_page(array( 'page_title' => '404 Template Settings', 'menu_title' => '404 Template Settings', 'parent_slug' => 'theme-general-settings', )); acf_add_options_sub_page(array( 'page_title' => 'Footer Settings', 'menu_title' => 'Footer Settings', 'parent_slug' => 'theme-general-settings', )); }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/php-inc/dequeues.php
php-inc/dequeues.php
<?php //remove stylesheets: Gutenberg, wp-pagenavi function tr_dequeues() { wp_dequeue_style('wp-pagenavi'); } add_action( 'wp_print_styles', 'tr_dequeues', 100 ); function tr_disable_emojis() { remove_action('wp_head', 'print_emoji_detection_script', 7); remove_action('admin_print_scripts', 'print_emoji_detection_script'); remove_action('wp_print_styles', 'print_emoji_styles'); remove_action('admin_print_styles', 'print_emoji_styles'); remove_filter('the_content_feed', 'wp_staticize_emoji'); remove_filter('comment_text_rss', 'wp_staticize_emoji'); remove_filter('wp_mail', 'wp_staticize_emoji_for_email'); add_filter('tiny_mce_plugins', 'tr_disable_emojis_tinymce'); add_filter('wp_resource_hints', 'tr_disable_emojis_remove_dns_prefetch', 10, 2); } add_action('init', 'tr_disable_emojis'); /** * Filter function used to remove the tinymce emoji plugin. * * @param array $plugins * @return array Difference betwen the two arrays */ function tr_disable_emojis_tinymce($plugins) { if (is_array($plugins)) { return array_diff($plugins, array('wpemoji')); } else { return array(); } } /** * Remove emoji CDN hostname from DNS prefetching hints. * * @param array $urls URLs to print for resource hints. * @param string $relation_type The relation type the URLs are printed for. * @return array Difference betwen the two arrays. */ function tr_disable_emojis_remove_dns_prefetch($urls, $relation_type) { if ('dns-prefetch' == $relation_type) { /** This filter is documented in wp-includes/formatting.php */ $emoji_svg_url = apply_filters('emoji_svg_url', 'https://s.w.org/images/core/emoji/2/svg/'); $urls = array_diff($urls, array($emoji_svg_url)); } return $urls; } // Disable embed script function tr_deregister_embed_and_bodhi() { // XXX remove svg inline's plugin script as it pulls whole jQuery with it // code for the replacement is recreated in Vanilla JS class: TransformSvgImgsToSvgCode wp_deregister_script('bodhi_svg_inline'); } add_action('wp_footer', 'tr_deregister_embed_and_bodhi'); add_filter('wp_default_scripts', 'tr_remove_scripts'); function tr_remove_scripts(&$scripts) { if (!is_admin()) { // $scripts->remove('jquery'); } } // remove recent comments inline styles add_filter('show_recent_comments_widget_style', function () { return false; });
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/php-inc/sidebars.php
php-inc/sidebars.php
<?php /* function tr_tr_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Footer Top Left', 'tr' ), 'id' => 'footer-left-widget', 'description' => esc_html__( 'Footer Top Left widget area (Address)', 'tr' ), 'before_widget' => '<address>', 'after_widget' => '</address>' ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Top Right', 'tr' ), 'id' => 'footer-right-widget', 'description' => esc_html__( 'Footer Top Right widget area (above form title and text)', 'tr' ), 'before_widget' => '<div>', 'after_widget' => '</div>' ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Mid - Info', 'tr' ), 'id' => 'footer-mid-widget', 'description' => esc_html__( 'Footer Mid - Info (Text that goes below main links)', 'tr' ), 'before_widget' => '<i>', 'after_widget' => '</i>' ) ); register_sidebar( array( 'name' => esc_html__( 'Blog index', 'tr' ), 'id' => 'blog-index-widget', 'description' => esc_html__( 'Blog index (Categories, Tag cloud in sidebar)', 'tr' ), 'before_widget' => '<div class="widget">', 'after_widget' => '</div>' ) ); } add_action( 'tr_widgets_init', 'tr_tr_widgets_init' ); */
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/php-inc/enqueues.php
php-inc/enqueues.php
<?php // ADMIN-END ENQUEUES function tr_admin_enqueue() { wp_register_style( 'tr-admin-css', get_template_directory_uri() . '/prod/global/admin-style.css', false, '1.0.0' ); wp_enqueue_style( 'tr-admin-css' ); } add_action( 'admin_enqueue_scripts', 'tr_admin_enqueue' ); // FRONT-END ENQUEUES function tr_enqueue() { // STYLES // Main css file wp_enqueue_style('tr-style', get_stylesheet_uri()); //XXX: Theme css file is added in the header.latte file // SCRIPTS wp_enqueue_script('tr-js-main', get_template_directory_uri() . '/prod/global/app.min.js', array(), false, true); } add_action('wp_enqueue_scripts', 'tr_enqueue');
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/php-inc/latte.php
php-inc/latte.php
<?php require get_template_directory() . '/vendor/autoload.php'; $latte = new Latte\Engine; $latte->setTempDirectory(get_template_directory() . '/views/temp'); // TODO: remove/comment out when finished use Tracy\Debugger; Debugger::enable();
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/php-inc/sync-acf.php
php-inc/sync-acf.php
<?php add_filter('acf/settings/save_json', 'tr_acf_json_save_point'); function tr_acf_json_save_point( $path ) { // update path $path = get_stylesheet_directory() . '/acf-data'; // return return $path; } add_filter('acf/settings/load_json', 'tr_acf_json_load_point'); function tr_acf_json_load_point( $paths ) { // remove original path (optional) unset($paths[0]); // append path $paths[] = get_stylesheet_directory() . '/acf-data'; // return return $paths; }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/php-inc/nav-walker-backup.php
php-inc/nav-walker-backup.php
<?php /** * Class Name: bs4Navwalker * GitHub URI: https://github.com/dupkey/bs4navwalker * Description: A custom WordPress nav walker class for Bootstrap 4 nav menus in a custom theme using the WordPress built in menu manager. * License: GPL-2.0+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt */ class bs4Navwalker extends Walker_Nav_Menu { /** * Starts the list before the elements are added. * * @see Walker::start_lvl() * * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of menu item. Used for padding. * @param array $args An array of arguments. @see wp_nav_menu() */ public function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<button class=\"dropdown-toggle-arrow\"></button><div class=\"dropdown-menu\"><span class=\"close-dropdown\"></span><div class=\"dropdown-menu__content\">\n"; } /** * Ends the list of after the elements are added. * * @see Walker::end_lvl() * * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of menu item. Used for padding. * @param array $args An array of arguments. @see wp_nav_menu() */ public function end_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "$indent</div></div>\n"; } /** * Start the element output. * * @see Walker::start_el() * * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param array $args An array of arguments. @see wp_nav_menu() * @param int $id Current item ID. */ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; /** * Filter the CSS class(es) applied to a menu item's list item element. * * @since 3.0.0 * @since 4.1.0 The `$depth` parameter was added. * * @param array $classes The CSS classes that are applied to the menu item's `<li>` element. * @param object $item The current menu item. * @param array $args An array of {@see wp_nav_menu()} arguments. * @param int $depth Depth of menu item. Used for padding. */ $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) ); // New $class_names .= ' nav-item'; if (in_array('menu-item-has-children', $classes)) { $class_names .= ' dropdown'; } if (in_array('current-menu-item', $classes)) { $class_names .= ' active'; } // $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; // print_r($class_names); /** * Filter the ID applied to a menu item's list item element. * * @since 3.0.1 * @since 4.1.0 The `$depth` parameter was added. * * @param string $menu_id The ID that is applied to the menu item's `<li>` element. * @param object $item The current menu item. * @param array $args An array of {@see wp_nav_menu()} arguments. * @param int $depth Depth of menu item. Used for padding. */ $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args, $depth ); $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; // New if ($depth === 0) { $output .= $indent . '<li' . $id . $class_names .'>'; } // // $output .= $indent . '<li' . $id . $class_names .'>'; $atts = array(); $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : ''; $atts['target'] = ''; $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; if (!empty($item->target)) { if ($item->target === "_blank") { $atts['target'] = $item->target; $atts['rel'] = "noopener"; } else { $atts['target'] = $item->target; } } $atts['href'] = ! empty( $item->url ) ? $item->url : ''; // New if ($depth === 0) { $atts['class'] = 'nav-link'; } if ($depth === 0 && in_array('menu-item-has-children', $classes)) { $atts['class'] .= ' dropdown-toggle'; } if ($depth > 0) { $manual_class = array_values($classes)[0] .' '. 'nav-link dropdown-item'; $atts ['class']= $manual_class; } if (in_array('current-menu-item', $item->classes)) { $atts['class'] .= ' active'; } // print_r($item); // /** * Filter the HTML attributes applied to a menu item's anchor element. * * @since 3.6.0 * @since 4.1.0 The `$depth` parameter was added. * * @param array $atts { * The HTML attributes applied to the menu item's `<a>` element, empty strings are ignored. * * @type string $title Title attribute. * @type string $target Target attribute. * @type string $rel The rel attribute. * @type string $href The href attribute. * } * @param object $item The current menu item. * @param array $args An array of {@see wp_nav_menu()} arguments. * @param int $depth Depth of menu item. Used for padding. */ $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth ); $attributes = ''; foreach ( $atts as $attr => $value ) { if ( ! empty( $value ) ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } } $item_output = $args->before; // New /* if ($depth === 0 && in_array('menu-item-has-children', $classes)) { $item_output .= '<a class="nav-link dropdown-toggle"' . $attributes .'data-toggle="dropdown">'; } elseif ($depth === 0) { $item_output .= '<a class="nav-link"' . $attributes .'>'; } else { $item_output .= '<a class="dropdown-item"' . $attributes .'>'; } */ // $item_output .= '<a'. $attributes .'>'; /** This filter is documented in wp-includes/post-template.php */ $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; $item_output .= '</a>'; $item_output .= $args->after; /** * Filter a menu item's starting output. * * The menu item's starting output only includes `$args->before`, the opening `<a>`, * the menu item's title, the closing `</a>`, and `$args->after`. Currently, there is * no filter for modifying the opening and closing `<li>` for a menu item. * * @since 3.0.0 * * @param string $item_output The menu item's starting HTML output. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param array $args An array of {@see wp_nav_menu()} arguments. */ $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } /** * Ends the element output, if needed. * * @see Walker::end_el() * * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $item Page data object. Not used. * @param int $depth Depth of page. Not Used. * @param array $args An array of arguments. @see wp_nav_menu() */ public function end_el( &$output, $item, $depth = 0, $args = array() ) { if ($depth === 0) { $output .= "</li>\n"; } } }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/php-inc/ThemeRedoneWalker.php
php-inc/ThemeRedoneWalker.php
<?php /** * Class Name: ThemeRedoneWalker */ class ThemeRedoneWalker extends Walker_Nav_Menu { /** * Starts the list before the elements are added. * * @see Walker::start_lvl() * * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of menu item. Used for padding. * @param array $args An array of arguments. @see wp_nav_menu() */ public function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<div class=\"collapsible__content\"><div class=\"collapsible__content__inner\">\n"; } /** * Ends the list of after the elements are added. * * @see Walker::end_lvl() * * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of menu item. Used for padding. * @param array $args An array of arguments. @see wp_nav_menu() */ public function end_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "$indent</div></div>\n"; } /** * Start the element output. * * @see Walker::start_el() * * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param array $args An array of arguments. @see wp_nav_menu() * @param int $id Current item ID. */ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; /** * Filter the CSS class(es) applied to a menu item's list item element. * * @since 3.0.0 * @since 4.1.0 The `$depth` parameter was added. * * @param array $classes The CSS classes that are applied to the menu item's `<li>` element. * @param object $item The current menu item. * @param array $args An array of {@see wp_nav_menu()} arguments. * @param int $depth Depth of menu item. Used for padding. */ $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) ); // New $class_names .= ' nav-item'; if (in_array('menu-item-has-children', $classes)) { $class_names .= ' collapsible'; } if (in_array('current-menu-item', $classes)) { $class_names .= ' active'; } // $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; // print_r($class_names); /** * Filter the ID applied to a menu item's list item element. * * @since 3.0.1 * @since 4.1.0 The `$depth` parameter was added. * * @param string $menu_id The ID that is applied to the menu item's `<li>` element. * @param object $item The current menu item. * @param array $args An array of {@see wp_nav_menu()} arguments. * @param int $depth Depth of menu item. Used for padding. */ $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args, $depth ); $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; // New if ($depth === 0) { $output .= $indent . '<li' . $id . $class_names; if (in_array('menu-item-has-children', $classes)) { $output .= 'data-hover-trigger'; } $output .= ' >'; } // // $output .= $indent . '<li' . $id . $class_names .'>'; $atts = array(); $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : ''; $atts['target'] = ''; $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; if (!empty($item->target)) { if ($item->target === "_blank") { $atts['target'] = $item->target; $atts['rel'] = "noopener"; } else { $atts['target'] = $item->target; } } $atts['href'] = ! empty( $item->url ) ? $item->url : ''; // New if ($depth === 0) { $atts['class'] = 'nav-link'; } if ($depth > 0) { $manual_class = array_values($classes)[0] .' '. 'nav-link'; $atts ['class']= $manual_class; } if (in_array('current-menu-item', $item->classes)) { $atts['class'] .= ' active'; } // print_r($item); // /** * Filter the HTML attributes applied to a menu item's anchor element. * * @since 3.6.0 * @since 4.1.0 The `$depth` parameter was added. * * @param array $atts { * The HTML attributes applied to the menu item's `<a>` element, empty strings are ignored. * * @type string $title Title attribute. * @type string $target Target attribute. * @type string $rel The rel attribute. * @type string $href The href attribute. * } * @param object $item The current menu item. * @param array $args An array of {@see wp_nav_menu()} arguments. * @param int $depth Depth of menu item. Used for padding. */ $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth ); $attributes = ''; foreach ( $atts as $attr => $value ) { if ( ! empty( $value ) ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } } $item_output = $args->before; if ($depth > 0) { $item_output .= '<a'. $attributes .'>'; /** This filter is documented in wp-includes/post-template.php */ $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; $item_output .= '</a>'; $item_output .= $args->after; } else { if (in_array('menu-item-has-children', $classes)) { $item_output .= '<button class="collapsible__trigger" aria-label="Toggle Dropdown">'; } $item_output .= '<a'. $attributes .'>'; /** This filter is documented in wp-includes/post-template.php */ $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; $item_output .= '</a>'; if (in_array('menu-item-has-children', $classes)) { $item_output .= '<span class="chevron"></span>'; $item_output .= '</button>'; } $item_output .= $args->after; } /** * Filter a menu item's starting output. * * The menu item's starting output only includes `$args->before`, the opening `<a>`, * the menu item's title, the closing `</a>`, and `$args->after`. Currently, there is * no filter for modifying the opening and closing `<li>` for a menu item. * * @since 3.0.0 * * @param string $item_output The menu item's starting HTML output. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param array $args An array of {@see wp_nav_menu()} arguments. */ $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } /** * Ends the element output, if needed. * * @see Walker::end_el() * * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $item Page data object. Not used. * @param int $depth Depth of page. Not Used. * @param array $args An array of arguments. @see wp_nav_menu() */ public function end_el( &$output, $item, $depth = 0, $args = array() ) { if ($depth === 0) { $output .= "</li>\n"; } } }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/php-inc/theme-support.php
php-inc/theme-support.php
<?php if ( ! function_exists( 'tr_setup' ) ) : /** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which * runs before the init hook. The init hook is too late for some features, such * as indicating support for post thumbnails. */ function tr_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on underscores gbs, use a find and replace * to change 'tr' to the name of your theme in all the template files. */ load_theme_textdomain( 'tr', get_template_directory() . '/languages' ); // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); /* * Let WordPress manage the document title. * By adding theme support, we declare that this theme does not use a * hard-coded <title> tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'menu-1' => esc_html__( 'Primary', 'tr' ), 'menu-footer' => esc_html__( 'Footer Menu', 'tr' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /** * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ add_theme_support( 'custom-logo', array( 'height' => 250, 'width' => 250, 'flex-width' => true, 'flex-height' => true, ) ); } endif; add_action( 'after_setup_theme', 'tr_setup' ); // unwrap images out of p tags function filter_ptags_on_images($content) { // do a regular expression replace... // find all p tags that have just // <p>maybe some white space<img all stuff up to /> then maybe whitespace </p> // replace it with just the image tag... return preg_replace('/<p>(\s*)(<img .* \/>)(\s*)<\/p>/iU', '\2', $content); } // we want it to be run after the autop stuff... 10 is default. add_filter('the_content', 'filter_ptags_on_images'); /** * Remove the h1 tag from the WordPress editor. */ function tr_remove_h1_from_editor( $settings ) { $settings['block_formats'] = 'Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre;'; return $settings; } add_filter( 'tiny_mce_before_init', 'tr_remove_h1_from_editor' ); /* * Remove Read More from tinymce editor */ function tr_remove_read_more( $buttons ){ $remove = array( 'wp_more' ); return array_diff( $buttons, $remove ); } add_filter( 'mce_buttons','tr_remove_read_more' ); // CUSTOM THUMB SIZES // used in cards add_image_size('card-thumb', 600, 9999, false);
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/php-inc/sync-cptui.php
php-inc/sync-cptui.php
<?php // CPT UI post types and taxonomies sync // https://github.com/jonathanjanssens/custom-post-type-ui-sync if(!function_exists('cptui_init')) { require get_template_directory() . '/cptui/post_types.php'; require get_template_directory() . '/cptui/taxonomies.php'; }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/php-inc/theme-functions.php
php-inc/theme-functions.php
<?php /** * Add a pingback url auto-discovery header for single posts, pages, or attachments. */ function tr_pingback_header() { if ( is_singular() && pings_open() ) { echo '<link rel="pingback" href="', esc_url( get_bloginfo( 'pingback_url' ) ), '">'; } } add_action( 'wp_head', 'tr_pingback_header' ); /** * Used for page controllers. For example in 404.php, it would be: * $latte->render(tr_view_path('templates/404')); * @param string $template_name Name of the latte template living inside the /views/ dir * @return string Full path to the view file */ function tr_view_path($template_name) { return get_template_directory() . "/views/$template_name.latte"; } // Shorthand fn for getting parts/partials from /views/parts // Example: Write {tr_view_path('hero')} // instead of: {include tr_view_path('parts/hero')} function tr_part($part_name) { return get_template_directory() . "/views/parts/$part_name.latte"; } // WRAPPER FN FOR TR_GET_MEDIA THAT ONLY PRINTS THE PATH STRING // INSTEAD OF PRINTING THE ELEMENT /** * @param string|array{title:string,src:string, id?:int, alt?:string} $media * @return string Returns the full path to the media */ function tr_get_media_path($media) { $full_path = tr_get_media($media, dont_print: true, path_only: true); return $full_path; } // MAIN FUNCTION THAT DEALS WITH IMAGES AND SVGs from theme assets or wp-media. /** * @param string|array{title:string,src:string, id?:int, alt?:string, class?:string} $media * @param bool $async render media async or sync * @param bool $dont_print print (render) result HTML, or just echo it for debugging purposes * @param bool $path_only if true, it doesn't render, but returns the media full path * @return void|string Prints result HTML or returns it, or returns the full path to the media * @see(https://webredone.com/theme-redone/theme-functions/tr_get_media/) */ function tr_get_media( $media, $async = false, $dont_print = false, $path_only = false ) { if ($media === NULL || (is_array($media) && empty($media['src']))) { return false; } $media_src = false; $media_id = false; $value_type = gettype($media); if ($value_type === 'string') { $media_src = $media; } else { if (array_key_exists('src', $media) || array_key_exists('url', $media)) { if (array_key_exists('src', $media)) { $media_src = $media['src']; } else { $media_src = $media['url']; } if ( array_key_exists('size', $media) && array_key_exists($media['size'], $media['sizes']) ) { $media_src = $media['sizes'][$media['size']]; } } if (array_key_exists('id', $media)) { $media_id = $media['id']; } } // checks if image is from uploads or from theme assets $from_uploads = strpos($media_src, "/wp-content/uploads/") ? true : false; if (tr_str_ends_with($media_src, '.svg')) { if ($dont_print) { return tr_get_svg($media_src, $from_uploads, $async, $path_only); } else { echo tr_get_svg($media_src, $from_uploads, $async, $path_only); } } else { // gets the correct image path based on whether it's uploaded or from theme assets, or external $img_path = $media_src; if ($from_uploads) { $img_path = $media_src; // Not from uploads not assets/img } else if (strpos($media_src, 'http://') !== false || strpos($media_src, 'https://') !== false) { $img_path = $media_src; } else { // From assets $img_path = tr_get_img_path($media_src); } $image_size_obj = wp_getimagesize($img_path); $image_size = [ 'w' => $image_size_obj[0], 'h' => $image_size_obj[1], ]; $alt_txt = false; $class = false; if ($from_uploads) { $alt_txt = get_post_meta($media_id , '_wp_attachment_image_alt', true); } if ("array" === $value_type) { (array_key_exists('alt', $media)) && $alt_txt = $media['alt']; (array_key_exists('class', $media)) && $class = $media['class']; } // dynamic function name $get_img_func = $async ? 'tr_get_img_async' : 'tr_get_img_sync'; if ($dont_print) { // "don't" print is not really useful, and may only come in handy for debugging return $get_img_func($img_path, $image_size, $alt_txt, $class, $path_only); } else { echo $get_img_func($img_path, $image_size, $alt_txt, $class, $path_only); } } } // Import SVG code from theme assets or media. (Previously used on its own, now it gets called from tr_get_media fn) function tr_get_svg( $file_name_or_uploads_path, $from_media = false, $async = false, $path_only = false ) { $html = ''; $correct_svg_file_path = $from_media ? $file_name_or_uploads_path : get_template_directory_uri() . '/assets/svg/' . $file_name_or_uploads_path; // Only print the svg path and don't output its code if ($path_only) { return $correct_svg_file_path; } if ($async) { $html = '<img class="js-async-svg" src="'; $html .= tr_get_img_path('lazy-loading-transparent.png'); $html .= '" data-src="'. $correct_svg_file_path .'" alt="will be replaced with SVG code" />'; } else { $html = file_get_contents($correct_svg_file_path); } echo $html; } // Get img from assets (Previously used on its own, now it gets called from tr_get_media fn) function tr_get_img_path($img_path) { $img_full_path = get_template_directory_uri() . "/assets/img/$img_path"; return $img_full_path; } // (Previously used on its own, now it gets called from tr_get_media fn) function tr_get_img_sync( $img_path, $image_size, $img_alt = "", $img_class = "", $path_only = false ) { // Only print the media path and don't add the img element if ($path_only) { return $img_path; } $img_html = '<img'; if ($img_class) { $img_html .= ' class="'. $img_class .'"'; } $img_html .= ' src="' . $img_path . '"'; if ($img_alt) { $img_html .= ' alt="'. $img_alt .'"'; } $img_html .= ' />'; return $img_html; } function tr_get_img_async( $img_path, $image_size, $img_alt = "", $img_class = "", $path_only = false ) { $img_html = '<div class="tr-img-wrap-outer jsLoading"'; $img_html .= ' style="--size-w-original:' . $image_size['w'] . ';--size-h-original: ' . $image_size['h'] . ';"'; $img_html .= '>'; $img_html .= '<div'; $img_html .= ' class="tr-img-wrap"'; $img_html .= '>'; $img_html .= '<img'; $img_html .= ' class="js-img-lazy '. $img_class .'"'; $img_html .= ' src="' . tr_get_img_path('lazy-loading-transparent.png') . '"'; $img_html .= ' data-img-src="'. $img_path .'"'; if ($img_alt) { $img_html .= ' alt="'. $img_alt .'"'; } $img_html .= ' />'; $img_html .= '</div>'; $img_html .= '</div>'; return $img_html; } // Speeds up buttons or other links html creation /** * @param array{title:string, url:string, target:bool} $a * @param string $class Optional class name * @param bool $attrs_only If true, will print only <a> attrs instead of the whole <a> element * @return void * @see(https://webredone.com/theme-redone/theme-functions/tr_a-link-helper/) */ function tr_a( $a, $class = "", $attrs_only = false ) { if (!$a['url']) return; $new_tab = array_key_exists('target', $a) && $a['target']; if ($attrs_only) { $attrs_html = "href='{$a['url']}'"; if ($class) { $attrs_html .= " class='{$class}'"; } if ($new_tab) { $attrs_html .= " target='_blank' rel='noopener noreferrer'"; } echo $attrs_html; } else { ?> <a href="<?php echo $a['url']; ?>" <?php if ($class) { ?> class="<?php echo $class; ?>" <?php } ?> <?php if ($new_tab) { ?> target="_blank" rel="noopener noreferrer" <?php } ?> > <?php echo $a['title']; ?> </a> <?php } } /** * SHARE LINKS TO SOCIAL MEDIA */ // Usage: <a href="{tr_social_share('twitter')}"></a> function tr_social_share( $soc_name ) { $share_options = [ 'facebook' => 'https://www.facebook.com/sharer/sharer.php?u=' . get_the_permalink(), 'twitter' => 'https://twitter.com/intent/tweet?text='. get_the_title() .'&url='. get_the_permalink(), 'linkedin' => 'https://www.linkedin.com/cws/share?url=' . get_the_permalink(), 'pinterest' => 'http://pinterest.com/pin/create/link/?url=' . get_the_permalink(), 'email' => 'mailto:?subject=I wanted you to see this: ' . get_the_title() . '&amp;body=' . get_the_permalink() ]; echo $share_options[$soc_name]; } /** * Prints HTML with meta information for the current post-date/time. */ function tr_posted_on($post_id = null, $with_last_updated = false) { $time_string = '<time class="entry-date published" datetime="%1$s">%1$s</time>'; $date_format = get_option('date_format'); $published_at = $post_id === null ? get_the_date($date_format) : get_the_date($date_format, $post_id); $time_string = sprintf( $time_string, esc_html($published_at) ); $posted_on = sprintf( /* translators: %s: post date. */ esc_html_x( '%s', 'post date', 'tr' ), '<span class="posted-on" rel="bookmark">' . $time_string . '</span>' ); $posted_on_html = '<span class="entry-date-wrap">'; $posted_on_html .= $posted_on; if ($with_last_updated) { $posted_on_html .= $post_id === null ? tr_last_updated_on() : tr_last_updated_on($post_id); } $posted_on_html .= '</span>'; echo $posted_on_html; } /* * Displays last updated date for a post. */ function tr_last_updated_on($post_id = null) { $u_time = get_the_time('U'); $date_format = get_option('date_format'); $u_modified_time = get_the_modified_time('U'); $modified_date = $post_id === null ? get_the_modified_time($date_format) : get_the_modified_time($date_format, $post_id); if ($u_modified_time >= $u_time + 86400) { $updated_on = sprintf( /* translators: %s: post date. */ esc_html_x( '%s', 'updated date', 'tr' ), '<span class="last-updated-on"> (Last Updated: ' . $modified_date . ') </span>&nbsp;' ); return $updated_on; } } /** * Prints HTML with meta information for the current author. */ function tr_posted_by($author_id = false) { $byline = '<i>By:</i> '; $byline .= '<a '; if ($author_id === false) { $byline .= 'href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '"'; } else { $byline .= 'href="' . esc_url(get_author_posts_url($author_id)) . '"'; } $byline .= '>'; $f_name = get_the_author_meta( 'first_name', $author_id ); $l_name = get_the_author_meta( 'last_name', $author_id ); $print_name = $f_name . ' ' . $l_name; if (!strlen($f_name)) { $print_name = get_the_author_meta( 'display_name', $author_id ); } $byline .= $print_name; $byline .= '</a>'; echo '<span class="byline"> ' . $byline . '</span>'; } if ( ! function_exists( 'tr_get_excerpt' ) ) : function tr_get_excerpt($limit, $source = null, $post_id = false){ $excerpt = ''; if ($source) { $excerpt = $source; } else { if (!$post_id) { $excerpt = get_the_content(); } else { if (has_excerpt($post_id)) { $excerpt = get_the_excerpt($post_id); } else { $excerpt = get_the_content(false, false, $post_id); } } } $excerpt = preg_replace(" (\[.*?\])",'',$excerpt); $excerpt = strip_shortcodes($excerpt); $excerpt = strip_tags($excerpt); $excerpt = substr($excerpt, 0, $limit); $excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt)); if (strlen($excerpt) > $limit) { $excerpt = $excerpt.'...'; } return $excerpt; } endif; /* Sample... Lorem ipsum habitant morbi (26 characters total) Returns first three words which is exactly 21 characters including spaces Example.. echo tr_get_excerpt(21); Result... Lorem ipsum habitant Returns same as above, not enough characters in limit to return last word Example.. echo tr_get_excerpt(24); Result... Lorem ipsum habitant Returns all 26 chars of our content, 30 char limit given, only 26 characters needed. Example.. echo tr_get_excerpt(30); Result... Lorem ipsum habitant morbi */ // Helper for custom looping over menu items function tr_get_nav_menu_items_by_location($location, $args = []) { // Get all locations $locations = get_nav_menu_locations(); // Get object id by location $object = wp_get_nav_menu_object($locations[$location]); // Get menu items by menu name $menu_items = wp_get_nav_menu_items($object->name, $args); // Return menu post objects return $menu_items; } // HELPERS --------------------------------------- // var_dump wrapper function tr_log($toPrint, $isSmall = false, $left = false) { echo '<pre style="position: fixed; line-height: 1.4 !important; bottom: 0; left: 0; font-family: monospace; width: 100vw; height: 70vh;' . ($isSmall ? "max-height: 300px;" : "") . 'overflow-y: scroll; ' . ($left ? "width: 23vw; height: calc(100vh - 32px); max-height: calc(100vh - 32px);" : "") . 'background: #222; color: #cecece; padding: 30px; z-index: 9999; border: 5px solid crimson; font-size: 14px !important;">'; var_dump($toPrint); echo '</pre>'; } // To be used in loops for example function tr_log_i($toPrint, $long = false) { $has_max_height = !$long ? ' max-height: 1500px !important; ' : ' max-height: 730px; '; echo '<pre style="line-height: 1.4 !important; ' . $has_max_height . 'overflow-y: auto !important; font-family: monospace; overflow-y: scroll; background: #222; color: #cecece; padding: 8px; border: 2px solid crimson; font-size: 12px !important;">'; var_dump($toPrint); echo '</pre>'; } // detect if IE function tr_is_ie() { if (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) || (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false)) { return true; } } function tr_hex_to_rgb($hex) { list($r, $g, $b) = sscanf($hex, "#%02x%02x%02x"); $rgb = "$r, $g, $b"; echo $rgb; } function tr_str_ends_with( $haystack, $needle ) { $length = strlen( $needle ); if( !$length ) { return false; } return substr( $haystack, -$length ) === $needle; } // Can be used with dynamically created modal to add the correct HTML for either YT, Vimeo or self hosted videos function tr_get_video_type_and_id($url) { $yt_rx = '/^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?$/'; $has_match_youtube = preg_match($yt_rx, $url, $yt_matches); $vm_rx = '/(https?:\/\/)?(www\.)?(player\.)?vimeo\.com\/([a-z]*\/)*([‌​0-9]{6,11})[?]?.*/'; $has_match_vimeo = preg_match($vm_rx, $url, $vm_matches); //Then we want the video id which is: if($has_match_youtube) { $video_id = $yt_matches[5]; $type = 'youtube'; } elseif($has_match_vimeo) { $video_id = $vm_matches[5]; $type = 'vimeo'; } else { $video_id = 0; $type = 'none'; } $data['video_id'] = $video_id; $data['video_type'] = $type; return $data; } // Can be used with either menus or acf fields to add the correct svg icon function tr_get_soc_name($soc_media_link) { $soc_medias = [ "//facebook", "//twitter", "//instagram", "//youtube", "//linkedin", "//pinterest" ]; $soc_media_name = false; foreach ($soc_medias as $sm_name) { if (strpos($soc_media_link, $sm_name)) { $soc_media_name = substr($sm_name, 2); } } return $soc_media_name; } // Modal 'slot" function tr_modal_start($id, $title = false, $class = '') { $modal_start = "<div class='modal--custom $class' id='$id'>"; $modal_start .= "<div class='modal--custom__backdrop modal-close'></div>"; $modal_start .= "<div class='modal--custom__content'>"; if ($title) { $modal_start .= "<h2 class='modal--custom__title'>$title</h2>"; } $modal_start .= "<i class='modal-close modal--custom-close-x'>"; $modal_start .= "<svg width='36' viewBox='0 0 149.337 149.337'>"; $modal_start .= "<polygon "; $modal_start .= "style='fill:#979797;' "; $modal_start .= "points='149.337,143.96 80.044,74.668 149.336,5.376 143.96,0 74.668,69.292 5.377,0 0.001,5.376 69.292,74.668 0,143.96 5.376,149.336 74.668,80.044 143.961,149.336' "; $modal_start .= "/>"; $modal_start .= "</svg>"; $modal_start .= "</i>"; $modal_start .= "<div class='modal--custom__content--wrap'>"; echo $modal_start; } function tr_modal_end() { echo '</div></div></div>'; }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/views/temp/views-parts-_collapsible.latte--7d8b2f4b26.php
views/temp/views-parts-_collapsible.latte--7d8b2f4b26.php
<?php use Latte\Runtime as LR; /** source: C:\xampp\htdocs\theme_redone/wp-content/themes/theme_redone/views/parts/_collapsible.latte */ final class Template7d8b2f4b26 extends Latte\Runtime\Template { public const Blocks = [ ['collapsible_trigger' => 'blockCollapsible_trigger', 'collapsible_content' => 'blockCollapsible_content'], ]; public function main(array $ʟ_args): void { extract($ʟ_args); unset($ʟ_args); echo ' <div class="collapsible '; echo LR\Filters::escapeHtmlAttr($class ?? '') /* line 11 */; echo ' '; if (!empty($is_absolute)) /* line 11 */ { echo 'collapsible--absolute'; } echo '" data-duration="'; echo LR\Filters::escapeHtmlAttr(!empty($duration) ? $duration : '300') /* line 12 */; echo '" '; if ($close_outside ?? false) /* line 13 */ { echo ' data-close-on-outside-click '; } echo ' '; if ($on_hover ?? false) /* line 16 */ { echo ' data-hover-trigger '; } echo ' '; if (!empty($custom_keyframes)) /* line 19 */ { echo ' data-keyframes="'; echo LR\Filters::escapeHtmlAttr(json_encode($custom_keyframes)) /* line 20 */; echo '" '; } echo ' '; if (!empty($easing)) /* line 22 */ { echo ' data-easing="'; echo LR\Filters::escapeHtmlAttr($easing) /* line 23 */; echo '" '; } echo ' > <button class="collapsible__trigger" type="button" aria-label="'; echo LR\Filters::escapeHtmlAttr(!empty($aria_label) ? $aria_label : 'Toggle Dropdown') /* line 30 */; echo '" > '; $this->renderBlock('collapsible_trigger', get_defined_vars()) /* line 32 */; echo ' <span class="chevron"></span> </button> <div class="collapsible__content"> <div class="collapsible__content__inner"> '; $this->renderBlock('collapsible_content', get_defined_vars()) /* line 38 */; echo ' </div> </div> </div>'; } /** {block collapsible_trigger} on line 32 */ public function blockCollapsible_trigger(array $ʟ_args): void { } /** {block collapsible_content} on line 38 */ public function blockCollapsible_content(array $ʟ_args): void { } }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/views/temp/layout-header.latte--287b753cf4.php
views/temp/layout-header.latte--287b753cf4.php
<?php use Latte\Runtime as LR; /** source: C:\xampp\htdocs\theme_redone/wp-content/themes/theme-redone/views//layout/header.latte */ final class Template287b753cf4 extends Latte\Runtime\Template { public function main(): array { extract($this->params); echo '<!doctype html> <html '; echo language_attributes() /* line 2 */; echo '> <head> <meta charset="'; echo LR\Filters::escapeHtmlAttr(bloginfo('charset')) /* line 5 */; echo '"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0"> <link rel="profile" href="https://gmpg.org/xfn/11"> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet"> '; echo LR\Filters::escapeHtmlText(wp_head()) /* line 13 */; echo ' <style id="critical-css" type="text/css"> '; echo file_get_contents(get_template_directory() . '/prod/global/critical.css') /* line 16 */; echo ' </style> <link rel="preload" href="'; echo LR\Filters::escapeHtmlAttr(LR\Filters::safeUrl(get_template_directory_uri())) /* line 19 */; echo '/prod/global/style.css" as="style"> <link rel="stylesheet" href="'; echo LR\Filters::escapeHtmlAttr(LR\Filters::safeUrl(get_template_directory_uri())) /* line 20 */; echo '/prod/global/style.css"> <script type="text/javascript"> var tr_theme_url = '; echo LR\Filters::escapeJs(get_bloginfo("template_url")) /* line 23 */; echo '; var tr_site_url = '; echo LR\Filters::escapeJs(esc_url( home_url( '/' ) )) /* line 24 */; echo '; </script> </head> <body '; echo body_class() /* line 28 */; echo '> '; $this->createTemplate(tr_view_path('/layout/main-menu'), $this->params, 'include')->renderToContentType('html') /* line 29 */; echo ' <main class="main-content '; echo LR\Filters::escapeHtmlAttr(tr_is_ie() ? 'main_is_ie' : '') /* line 30 */; echo '">'; return get_defined_vars(); } }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/views/temp/views-parts-todo-remove-examples.latte--203ed5b4c3.php
views/temp/views-parts-todo-remove-examples.latte--203ed5b4c3.php
<?php use Latte\Runtime as LR; /** source: C:\xampp\htdocs\theme_redone/wp-content/themes/theme-redone/views/parts/todo-remove-examples.latte */ final class Template203ed5b4c3 extends Latte\Runtime\Template { protected const BLOCKS = [ 1 => ['tab_anchor' => 'blockTab_anchor', 'tab_panel' => 'blockTab_panel'], 2 => ['acc_trigger' => 'blockAcc_trigger', 'acc_content' => 'blockAcc_content'], 3 => ['acc_trigger' => 'blockAcc_trigger1', 'acc_content' => 'blockAcc_content1'], 4 => ['tab_anchor' => 'blockTab_anchor1', 'tab_panel' => 'blockTab_panel1'], 5 => ['slide' => 'blockSlide'], 6 => ['slide_q' => 'blockSlide_q', 'after_loop' => 'blockAfter_loop'], 7 => ['slide' => 'blockSlide1'], ]; public function main(): array { extract($this->params); echo '<div class="container" id="smooth-start"> <h2>SMOOTH SCROLL EXAMPLE</h2> <a class="btn btn--brand" href="#smooth-end">Scroll down</a> </div> <section> <div class="container"> <style> .collapsible, .collapsible__trigger { width: 100%; } .collapsible__content { background: #fff; width: 100%; } .collapsible__content__inner p { margin-bottom: 0; } .collapsible[data-select] .collapsible__content__inner { display: flex; flex-direction: column; } .accordion .collapsible { margin-bottom: 0; } .accordion .collapsible__trigger { padding: 12px 20px; box-shadow: inset 0 0 0 1px black; } .nested-accordions .collapsible__content__inner { padding-right: 0; } </style> '; $test_acc_items = [ [ 'anchor' => 'Accordion Item 1', 'content' => [ 'title' => 'Accordion Item Content 1 Title', 'text' => 'Accordion Item Content 1 text that is very long', ] ], [ 'anchor' => 'Accordion Item 2', 'content' => [ 'text' => 'Accordion Item Content 2 text that is very long', ] ], [ 'anchor' => 'Accordion Item 3', 'content' => [ 'title' => 'Accordion Item Content 3 Title', 'text' => 'Accordion Item Content 3 text that is very long', ] ] ] /* line 43 */; echo "\n"; $this->createTemplate(tr_part('_collapsibles'), ['test_acc_items' => $test_acc_items] + $this->params, 'include')->renderToContentType('html') /* line 66 */; echo ' <h2 class="mb40">Typography</h2> <div class="f-row" style="--i-cols: 2; --i-gap: 30"> <div class="col"> <div> <strong class="mb40">Headlines</strong> <h1>Headline 1</h1> <h2>Headline 2</h2> <h3>Headline 3</h3> <h4>Headline 4</h4> <h5>Headline 5</h5> <h6>Headline 6</h6> <strong class="mb40">Unordered List</strong> <ul> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> <li>List item 4</li> <li>List item 5</li> </ul> </div> </div> <div class="col"> <div> <strong class="mb40">Paragraph</strong> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in <strong>Bold</strong> in <a href="#" target="_blank">Link</a> velit esse cillum dolore eu fugiat nulla pariatur. <em>Italic</em> sint occaecat cupidatat non proident, sunt in culpa qui <strong><em>Bold Italic</em></strong> deserunt mollit anim id est laborum.</p> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Optio ipsam aliquam modi voluptatum itaque sed fuga non quisquam quas eveniet?</p> <strong class="mb40">Ordered List</strong> <ol> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> <li>List item 4</li> <li>List item 5</li> </ol> </div> </div> </div> </div><!-- cont --> </section> <hr> <section> <div class="container"> <h2>Spinners / Loaders</h2> <div class="spinner-wrap" style="width: 100px; height: 100px;"> <div class="lds-ripple"> <div></div> <div></div> </div> </div> </div> </section> <hr> <section> <div class="container"> <div class="f-row" style="--i-cols: 2; --i-gap: 30"> <div class="col"> <h4>Tabs (with nested accordion)</h4> '; $test_tabs = [ [ 'anchor' => 'Tab 1', 'content' => [ 'title' => 'Tab Panel 1 Title', 'text' => 'Tab Panel 1 text that is very long', ] ], [ 'anchor' => 'Tab 2', 'content' => [ 'text' => 'Tab Panel 2 text that is very long', ] ], [ 'anchor' => 'Tab 3', 'content' => [ 'title' => 'Tab Panel 3 Title', 'text' => 'Tab Panel 3 text that is very long', ] ] ] /* line 146 */; echo "\n"; $this->enterBlockLayer(1, get_defined_vars()) /* line 169 */; if (false) { $this->renderBlock('tab_anchor', get_defined_vars()) /* line 170 */; echo ' '; $this->renderBlock('tab_panel', get_defined_vars()) /* line 176 */; echo "\n"; } try { $this->createTemplate(tr_part('_tabs'), ['tabs' => $test_tabs, 'class' => 'optional-test-class-2'], "embed")->renderToContentType('html') /* line 169 */; } finally { $this->leaveBlockLayer(); } echo ' </div> <div class="col"> <h4>Accordion (with nested tabs)</h4> '; $this->enterBlockLayer(3, get_defined_vars()) /* line 213 */; if (false) { $this->renderBlock('acc_trigger', get_defined_vars()) /* line 219 */; echo ' '; $this->renderBlock('acc_content', get_defined_vars()) /* line 225 */; echo "\n"; } try { $this->createTemplate(tr_part('_accordion'), ['items' => $test_acc_items, 'initially_open_item' => 0, 'collapse_siblings' => true], "embed")->renderToContentType('html') /* line 213 */; } finally { $this->leaveBlockLayer(); } echo ' </div> </div> </div><!-- cont --> </section> <section> <div class="container"> <hr> </div> </section> <section class="sliders"> <style> .sliders { max-width: 100%; overflow: hidden; } </style> <div class="container" style="margin-bottom: 100px;" > <h2>SLIDERS (init in InitSliders class)</h2> <h3>GRID THAT TURNS INTO A SLIDER FOR MOBILE</h3> '; $test_slides = [ [ 'src' => 'https://images.unsplash.com/photo-1657788913352-1ce366729324?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=250&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY1ODA4OTY1Ng&ixlib=rb-1.2.1&q=80&w=353', 'alt' => 'Slide Image 1', ], [ 'src' => 'https://images.unsplash.com/photo-1655930119888-d3cd121fa5e6?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=250&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY1ODA4OTc2Mw&ixlib=rb-1.2.1&q=80&w=353', 'alt' => 'Slide Image 2', ], [ 'src' => 'https://images.unsplash.com/photo-1657047408480-5c53b418b394?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=250&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY1ODA4OTc4Mw&ixlib=rb-1.2.1&q=80&w=353', 'alt' => 'Slide Image 3', ], [ 'src' => 'https://images.unsplash.com/photo-1656693391610-7f16ca839254?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=250&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY1ODA4OTc5NQ&ixlib=rb-1.2.1&q=80&w=353', 'alt' => 'Slide Image 4', ], [ 'src' => 'https://images.unsplash.com/photo-1657879005206-3a27c0b782f2?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=250&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY1ODA4OTgwOA&ixlib=rb-1.2.1&q=80&w=353', 'alt' => 'Slide Image 5', ], [ 'src' => 'https://images.unsplash.com/photo-1655552360649-9871415760b6?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=250&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY1ODA4OTgyMA&ixlib=rb-1.2.1&q=80&w=353', 'alt' => 'Slide Image 6', ] ] /* line 283 */; echo ' '; $this->enterBlockLayer(5, get_defined_vars()) /* line 311 */; if (false) { $this->renderBlock('slide', get_defined_vars()) /* line 316 */; echo "\n"; } try { $this->createTemplate(tr_part('_slider'), ['class' => 'slider--test', 'slides' => $test_slides], "embed")->renderToContentType('html') /* line 311 */; } finally { $this->leaveBlockLayer(); } echo ' <hr> <h3 style="margin-top: 100px;">(WP_Query) GRID THAT TURNS INTO A SLIDER FOR MOBILE</h3> '; $posts_query = (new WP_Query( array( 'post_type' => 'post', 'posts_per_page' => 6, 'orderby' => 'DESC', ) )) /* line 331 */; echo "\n"; $this->enterBlockLayer(6, get_defined_vars()) /* line 339 */; if (false) { $this->renderBlock('slide_q', get_defined_vars()) /* line 344 */; echo ' '; $this->renderBlock('after_loop', get_defined_vars()) /* line 350 */; echo "\n"; } try { $this->createTemplate(tr_part('_slider'), ['class' => 'slider--test', 'slides' => $posts_query], "embed")->renderToContentType('html') /* line 339 */; } finally { $this->leaveBlockLayer(); } echo ' </div> <div class="container"><h3>LOOPED SLIDER</h3></div> <div> '; $this->enterBlockLayer(7, get_defined_vars()) /* line 362 */; if (false) { $this->renderBlock('slide', get_defined_vars()) /* line 367 */; echo "\n"; } try { $this->createTemplate(tr_part('_slider'), ['class' => 'slider--test2', 'slides' => $test_slides], "embed")->renderToContentType('html') /* line 362 */; } finally { $this->leaveBlockLayer(); } echo ' </div> </section> <div class="container"> <h2>Flex Grid</h2> </div> <section> <div class="container"> <div class="f-row" style="--i-cols: 4; --i-gap: 35;"> '; for ($i = 0; $i < 12; $i++) /* line 394 */ { echo ' <div class="col" style="box-shadow: inset 0 0 0 1px red;"> <div class="col-content">Column</div> </div> '; } echo ' </div> </div> </section> <section> <div class="container"> <div class="f-row" style="--i-cols: 3; --i-gap: 15; --i-mb: 10;"> '; for ($i = 0; $i < 4; $i++) /* line 408 */ { echo ' <div class="col" style="box-shadow: inset 0 0 0 1px red;"> <div class="col-content">Column</div> </div> '; } echo ' </div> </div> </section> <section> <div class="container"> <div class="f-row" style="--i-cols: 4; --i-gap: 30; --i-mb: 10;"> '; for ($i = 0; $i < 6; $i++) /* line 422 */ { echo ' <div class="col" style="box-shadow: inset 0 0 0 1px red;"> <div class="col-content">Column</div> </div> '; } echo ' </div> </div> </section> <section> <div class="container"> <div class="f-row" style="--i-cols: 5; --i-gap: 15; --i-mb: 10;"> '; for ($i = 0; $i < 10; $i++) /* line 436 */ { echo ' <div class="col" style="box-shadow: inset 0 0 0 1px red;"> <div class="col-content">Column</div> </div> '; } echo ' </div> </div> </section> <section> <div class="container"> <div class="f-row" style="--i-cols: 6; --i-gap: 15; --i-mb: 10;"> '; for ($i = 0; $i < 8; $i++) /* line 450 */ { echo ' <div class="col" style="box-shadow: inset 0 0 0 1px red;"> <div class="col-content">Column</div> </div> '; } echo ' </div> </div> </section> <section> <div class="container"> <div class="f-row" style="--i-cols: 7; --i-gap: 15; --i-mb: 10;"> '; for ($i = 0; $i < 9; $i++) /* line 464 */ { echo ' <div class="col" style="box-shadow: inset 0 0 0 1px red;"> <div class="col-content">Column</div> </div> '; } echo ' </div> </div> </section> <section> <div class="container"> <h2>Flex Grid - two-cols-custom</h2> <div class="f-row two-cols-custom" style="--i-gap: 40; --i-mb: 0; --i-first-col-w: 70%;"> '; for ($i = 0; $i < 2; $i++) /* line 479 */ { echo ' <div class="col" style="box-shadow: inset 0 0 0 1px red;"> <div class="col-content">Column</div> </div> '; } echo ' </div> </div> </section> <section> <div class="container"> <h2>Flex Grid - two-cols-custom</h2> <div class="f-row two-cols-custom" style="--i-cols: 2; --i-gap: 90; --i-mb: 0; --i-first-col-w: 390px;"> '; for ($i = 0; $i < 2; $i++) /* line 494 */ { echo ' <div class="col" style="box-shadow: inset 0 0 0 1px red;"> <div class="col-content">Column</div> </div> '; } echo ' </div> </div> </section> <section> <div class="container"> <h2>Flex Grid - no-gutter</h2> <div class="f-row" style="--i-cols: 5;" > '; for ($i = 0; $i < 10; $i++) /* line 510 */ { echo ' <div class="col" style="box-shadow: inset 0 0 0 1px red;"> <div class="col-content">Column</div> </div> '; } echo ' </div> </div><!-- cont --> </section> <div class="container" id="smooth-end"> <h2>SMOOTH SCROLL EXAMPLE END</h2> <a class="btn btn--brand" href="#smooth-start">Scroll up</a> </div> <section> <div class="container"> <h2>SVG IMPORTING</h2> <div class="f-row" style="--i-cols: 4; --i-gap: 15"> <div class="col" style="box-shadow: 0 0 0 1px red;"> <div style="padding: 20px"> <h4>Import SVG code from theme assets synchronously example</h4> <br><br> '; echo LR\Filters::escapeHtmlText(tr_get_media('svg-1.svg')) /* line 541 */; echo ' <br><br><br> <h4>Get the SVG path only without outputting its code</h4> <br><br> <img src="'; echo LR\Filters::escapeHtmlAttr(LR\Filters::safeUrl(tr_get_media_path('logo.svg'))) /* line 546 */; echo '" alt="yo"> </div> </div> <div class="col" style="box-shadow: 0 0 0 1px red;"> <div style="padding: 20px"> <h4>Import SVG code from theme assets asynchronously example</h4> <br><br> '; echo LR\Filters::escapeHtmlText(tr_get_media('svg-1.svg', true)) /* line 553 */; echo ' </div> </div> <div class="col" style="box-shadow: 0 0 0 1px red;"> <div style="padding: 20px"> <h4>Import SVG code from uploads (media) synchronously example</h4> <br><br> '; echo LR\Filters::escapeHtmlText(tr_get_media('http://localhost/theme_redone/wp-content/uploads/2022/03/svg-1.svg')) /* line 560 */; echo ' </div> </div> <div class="col" style="box-shadow: 0 0 0 1px red;"> <div style="padding: 20px"> <h4>Import SVG code from uploads (media) asynchronously example</h4> <br><br> '; echo LR\Filters::escapeHtmlText(tr_get_media('http://localhost/theme_redone/wp-content/uploads/2022/03/svg-1.svg', true)) /* line 568 */; echo ' </div> </div> </div> </div> </section> <section class="temp-images-importing"> <div class="container"> <h2>IMAGES IMPORTING</h2> <style> .temp-images-importing .tr-img-wrap-outer { max-width: 100%; } </style> <div class="f-row" style="--i-cols: 3; --i-gap: 30"> <div class="col" style="box-shadow: 0 0 0 1px red;"> <div style="padding: 20px"> <h4>Read image from theme assets synchronously</h4> <br><br> <h5>No ALT</h5> <pre style="background: #222; color: #fff; font-family: monospace; border: 2px solid #1d81cc"> <code> {var $img_1_data_string = \'people/photo-1517299151253-d0449b733f57.jpg\'} {tr_get_media($img_1_data_string)} </code> </pre> '; $img_1_data_string = 'people/photo-1517299151253-d0449b733f57.jpg' /* line 600 */; echo ' '; echo LR\Filters::escapeHtmlText(tr_get_media($img_1_data_string)) /* line 601 */; echo ' <br><br> <h5>Don\'t Print (Only useful for debugging and showing how it will look like for some reason)</h5><br> <pre style="background: #222; color: #fff; font-family: monospace; border: 2px solid #1d81cc"> <code> {tr_get_media($img_1_data_string, false, true)} </code> </pre> '; echo LR\Filters::escapeHtmlText(tr_get_media($img_1_data_string, false, true)) /* line 610 */; echo ' <br><br> <h5>With ALT</h5> <pre style="background: #222; color: #fff; font-family: monospace; border: 2px solid #1d81cc"> <code> {var $img_2_data_array = [\'src\' => \'people/photo-1517299151253-d0449b733f57.jpg\', \'alt\' => \'manually added alt text\']} {tr_get_media($img_2_data_array)} </code> </pre> '; $img_2_data_array = ['src' => 'people/photo-1517299151253-d0449b733f57.jpg', 'alt' => 'manually added alt text'] /* line 620 */; echo ' '; echo LR\Filters::escapeHtmlText(tr_get_media($img_2_data_array)) /* line 621 */; echo ' <br><br> <h5>With ALT and class</h5> <pre style="background: #222; color: #fff; font-family: monospace; border: 2px solid #1d81cc"> <code> {var $img_2_data_array_with_class = $img_2_data_array} {var $img_2_data_array_with_class[\'class\'] = \'custom-class\'} {tr_get_media($img_2_data_array_with_class)} </code> </pre> '; $img_2_data_array_with_class = $img_2_data_array /* line 632 */; $img_2_data_array_with_class['class'] = 'custom-class' /* line 633 */; echo ' '; echo LR\Filters::escapeHtmlText(tr_get_media($img_2_data_array_with_class)) /* line 634 */; echo ' </div> </div> <div class="col" style="box-shadow: 0 0 0 1px red;"> <div style="padding: 20px"> <h4>Read image from theme assets asynchronously</h4> <br><br> <h5>No ALT String</h5> <pre style="background: #222; color: #fff; font-family: monospace; border: 2px solid #1d81cc"> <code> {tr_get_media($img_1_data_string, true)} </code> </pre> '; echo LR\Filters::escapeHtmlText(tr_get_media($img_1_data_string, true)) /* line 648 */; echo ' <h5>No ALT Array</h5> <pre style="background: #222; color: #fff; font-family: monospace; border: 2px solid #1d81cc"> <code> {tr_get_media([\'src\' => \'people/photo-1517299151253-d0449b733f57.jpg\'], true)} </code> </pre> '; echo LR\Filters::escapeHtmlText(tr_get_media(['src' => 'people/photo-1517299151253-d0449b733f57.jpg'], true)) /* line 656 */; echo ' <h5>With manually wrritten ALT Array</h5> <pre style="background: #222; color: #fff; font-family: monospace; border: 2px solid #1d81cc"> <code> {tr_get_media($img_2_data_array, true)} </code> </pre> '; echo LR\Filters::escapeHtmlText(tr_get_media($img_2_data_array, true)) /* line 664 */; echo ' <br><br> <h5>With ALT and class</h5> <pre style="background: #222; color: #fff; font-family: monospace; border: 2px solid #1d81cc"> <code> {tr_get_media($img_2_data_array_with_class, true)} </code> </pre> '; echo LR\Filters::escapeHtmlText(tr_get_media($img_2_data_array_with_class, true)) /* line 673 */; echo ' </div> </div> <div class="col" style="box-shadow: 0 0 0 1px red;"> <div style="padding: 20px"> <h4>Read background image from theme assets asynchronously</h4> <br><br> <h5>Get only media path</h5> <pre style="background: #222; color: #fff; font-family: monospace; border: 2px solid #1d81cc"> <code> &lt;div style="background-image: url({tr_get_media_path($img_1_data_string)})"&gt;&lt;/div&gt; </code> </pre> <div style="height: 333px; width: 100%; background-repeat: no-repeat; background-position: center; background-size: cover;" class="js-img-lazy jsLoading" data-img-src="'; echo LR\Filters::escapeHtmlAttr(tr_get_media_path($img_1_data_string)) /* line 690 */; echo '" > </div> <br><br> <h4>Print Image manually with path only to src</h4> <br><br> <pre style="background: #222; color: #fff; font-family: monospace; border: 2px solid #1d81cc"> <code> &lt;img src="{tr_get_media_path($img_1_data_string)}" /&gt; </code> </pre> <img src="'; echo LR\Filters::escapeHtmlAttr(LR\Filters::safeUrl(tr_get_media_path($img_1_data_string))) /* line 701 */; echo '"> </div> </div> </div> </div> </section> <section> <div class="container"> <h2>BUTTONS</h2> '; $btn_vars = ['brand', 'brand-outline', 'sec', 'sec-outline', 'ghost', 'ghost--brand', 'ghost--sec'] /* line 716 */; echo "\n"; $iterations = 0; foreach ($btn_vars as $btn_var) /* line 718 */ { echo ' <a href="#" class="btn btn--'; echo LR\Filters::escapeHtmlAttr($btn_var) /* line 718 */; echo '">Btn '; echo LR\Filters::escapeHtmlText($btn_var) /* line 718 */; echo '</a> '; $iterations++; } echo ' </div> </section> <section> <div class="container"> <h2>Modal</h2> <a href="#modal-example" class="btn btn--brand modalTrigger">Open Modal</a> '; echo LR\Filters::escapeHtmlText(tr_modal_start('modal-example', 'Modal Title here', 'modal-additional-class')) /* line 730 */; echo ' <h3>Modal</h3> <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> '; echo LR\Filters::escapeHtmlText(tr_modal_end()) /* line 740 */; echo ' </div> </section>'; return get_defined_vars(); } public function prepare(): void { extract($this->params); if (!$this->getReferringTemplate() || $this->getReferenceType() === "extends") { foreach (array_intersect_key(['btn_var' => '718'], $this->params) as $ʟ_v => $ʟ_l) { trigger_error("Variable \$$ʟ_v overwritten in foreach on line $ʟ_l"); } } } /** {block tab_anchor} on line 170 */ public function blockTab_anchor(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <span> <strong>'; echo LR\Filters::escapeHtmlText($ta_content['anchor']) /* line 172 */; echo '</strong> ✅ </span> '; } /** {block tab_panel} on line 176 */ public function blockTab_panel(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); if ($tp_key === 0) /* line 177 */ { $this->enterBlockLayer(2, get_defined_vars()) /* line 178 */; if (false) { $this->renderBlock('acc_trigger', get_defined_vars()) /* line 184 */; echo ' '; $this->renderBlock('acc_content', get_defined_vars()) /* line 190 */; echo "\n"; } try { $this->createTemplate(tr_part('_accordion'), ['items' => $test_acc_items, 'initially_open_item' => 0, 'collapse_siblings' => true], "embed")->renderToContentType('html') /* line 178 */; } finally { $this->leaveBlockLayer(); } echo "\n"; } else /* line 199 */ { echo ' <span> <div class="test-custom-class"> '; if (!empty($tp_content['content']['title'])) /* line 202 */ { echo ' <h3>'; echo LR\Filters::escapeHtmlText($tp_content['content']['title']) /* line 202 */; echo '</h3> '; } ob_start(function () {}); try { echo ' <p>'; ob_start(); try { echo LR\Filters::escapeHtmlText($tp_content['content']['text']) /* line 203 */; } finally { $ʟ_ifc[2] = rtrim(ob_get_flush()) === ''; } echo '</p> '; } finally { if ($ʟ_ifc[2] ?? null) { ob_end_clean(); } else { echo ob_get_clean(); } } echo ' </div> </span> '; } } /** {block acc_trigger} on line 184 */ public function blockAcc_trigger(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <h5> <strong>'; echo LR\Filters::escapeHtmlText($item['anchor']) /* line 186 */; echo '</strong> ✅ </h5> '; } /** {block acc_content} on line 190 */ public function blockAcc_content(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <span> <div class="test-custom-class"> '; if (!empty($item['content']['title'])) /* line 193 */ { echo ' <h3>'; echo LR\Filters::escapeHtmlText($item['content']['title']) /* line 193 */; echo '</h3> '; } ob_start(function () {}); try { echo ' <p>'; ob_start(); try { echo LR\Filters::escapeHtmlText($item['content']['text']) /* line 194 */; } finally { $ʟ_ifc[1] = rtrim(ob_get_flush()) === ''; } echo '</p> '; } finally { if ($ʟ_ifc[1] ?? null) { ob_end_clean(); } else { echo ob_get_clean(); } } echo ' </div> </span> '; } /** {block acc_trigger} on line 219 */ public function blockAcc_trigger1(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <h5> <strong>'; echo LR\Filters::escapeHtmlText($item['anchor']) /* line 221 */; echo '</strong> ✅ </h5> '; } /** {block acc_content} on line 225 */ public function blockAcc_content1(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); if ($index === 0) /* line 226 */ { $this->enterBlockLayer(4, get_defined_vars()) /* line 227 */; if (false) { $this->renderBlock('tab_anchor', get_defined_vars()) /* line 228 */; echo ' '; $this->renderBlock('tab_panel', get_defined_vars()) /* line 234 */; echo "\n"; } try { $this->createTemplate(tr_part('_tabs'), ['tabs' => $test_tabs, 'class' => 'optional-test-class'], "embed")->renderToContentType('html') /* line 227 */; } finally { $this->leaveBlockLayer(); } echo "\n"; } else /* line 243 */ { echo ' <span> <div class="test-custom-class"> '; if (!empty($item['content']['title'])) /* line 246 */ { echo ' <h3>'; echo LR\Filters::escapeHtmlText($item['content']['title']) /* line 246 */; echo '</h3> '; } ob_start(function () {}); try { echo ' <p>'; ob_start(); try { echo LR\Filters::escapeHtmlText($item['content']['text']) /* line 247 */; } finally { $ʟ_ifc[4] = rtrim(ob_get_flush()) === ''; } echo '</p> '; } finally { if ($ʟ_ifc[4] ?? null) { ob_end_clean(); } else { echo ob_get_clean(); } } echo ' </div> </span> '; } } /** {block tab_anchor} on line 228 */ public function blockTab_anchor1(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <span> <strong>'; echo LR\Filters::escapeHtmlText($ta_content['anchor']) /* line 230 */; echo '</strong> ✅ </span> '; } /** {block tab_panel} on line 234 */ public function blockTab_panel1(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <span> <div class="test-custom-class"> '; if (!empty($tp_content['content']['title'])) /* line 237 */ { echo ' <h3>'; echo LR\Filters::escapeHtmlText($tp_content['content']['title']) /* line 237 */; echo '</h3> '; } ob_start(function () {}); try { echo ' <p>'; ob_start(); try { echo LR\Filters::escapeHtmlText($tp_content['content']['text']) /* line 238 */; } finally { $ʟ_ifc[3] = rtrim(ob_get_flush()) === ''; } echo '</p> '; } finally { if ($ʟ_ifc[3] ?? null) { ob_end_clean(); } else { echo ob_get_clean(); } } echo ' </div> </span> '; } /** {block slide} on line 316 */ public function blockSlide(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <div style="box-shadow: 0 0 0 1px blue"> '; ob_start(function () {}); try { echo ' <h5>'; ob_start(); try { echo LR\Filters::escapeHtmlText($s_key) /* line 318 */; echo ' - '; echo LR\Filters::escapeHtmlText($s_content['alt']) /* line 318 */; } finally { $ʟ_ifc[5] = rtrim(ob_get_flush()) === ''; } echo '</h5> '; } finally { if ($ʟ_ifc[5] ?? null) { ob_end_clean(); } else { echo ob_get_clean(); } } echo ' <img src="'; echo LR\Filters::escapeHtmlAttr(LR\Filters::safeUrl($s_content['src'])) /* line 320 */; echo '" alt="'; echo LR\Filters::escapeHtmlAttr($s_content['alt']) /* line 321 */; echo '" > </div> '; } /** {block slide_q} on line 344 */ public function blockSlide_q(array $ʟ_args): void { echo ' <div style="box-shadow: 0 0 0 1px blue"> <h5>'; echo LR\Filters::escapeHtmlText(the_title()) /* line 346 */; echo '</h5> </div> '; } /** {block after_loop} on line 350 */ public function blockAfter_loop(array $ʟ_args): void { echo ' <div style="padding: 10px; box-shadow: 0 0 0 1px orange;"> <strong>pagination can be added here</strong> </div> '; } /** {block slide} on line 367 */ public function blockSlide1(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <div style="box-shadow: 0 0 0 1px blue"> '; ob_start(function () {}); try { echo ' <h5>'; ob_start(); try { echo LR\Filters::escapeHtmlText($s_key) /* line 369 */; echo ' - '; echo LR\Filters::escapeHtmlText($s_content['alt']) /* line 369 */; } finally { $ʟ_ifc[6] = rtrim(ob_get_flush()) === ''; } echo '</h5> '; } finally { if ($ʟ_ifc[6] ?? null) { ob_end_clean(); } else { echo ob_get_clean(); } } echo ' <img src="'; echo LR\Filters::escapeHtmlAttr(LR\Filters::safeUrl($s_content['src'])) /* line 371 */; echo '" alt="'; echo LR\Filters::escapeHtmlAttr($s_content['alt']) /* line 372 */; echo '" > </div> '; } }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/views/temp/views-parts-_accordion.latte--a8d33cc756.php
views/temp/views-parts-_accordion.latte--a8d33cc756.php
<?php use Latte\Runtime as LR; /** source: C:\xampp\htdocs\theme_redone/wp-content/themes/theme_redone/views/parts/_accordion.latte */ final class Templatea8d33cc756 extends Latte\Runtime\Template { public const Blocks = [ ['acc_trigger' => 'blockAcc_trigger', 'acc_content' => 'blockAcc_content'], ]; public function main(array $ʟ_args): void { extract($ʟ_args); unset($ʟ_args); echo "\n"; if (!empty($items)) /* line 25 */ { echo '<div class="accordion '; echo LR\Filters::escapeHtmlAttr($class ?? '') /* line 20 */; echo '" '; if ($collapse_siblings ?? false) /* line 21 */ { echo ' data-collapse-siblings '; } echo ' data-duration="'; echo LR\Filters::escapeHtmlAttr(!empty($duration) ? $duration : '300') /* line 24 */; echo '" '; if (!empty($easing)) /* line 26 */ { echo ' data-easing="'; echo LR\Filters::escapeHtmlAttr($easing) /* line 27 */; echo '" '; } echo ' > '; foreach ($iterator = $ʟ_it = new Latte\Essential\CachingIterator($items, $ʟ_it ?? null) as $index => $item) /* line 31 */ { $is_initially_open = isset($initially_open_item) && $index === $initially_open_item /* line 32 */; $aria_label_text = !empty($aria_label) ? $aria_label : 'Toggle Accordion Item' /* line 33 */; echo ' <div class="collapsible" '; if ($is_initially_open) /* line 37 */ { echo ' data-initially-open '; } echo ' > <button class="collapsible__trigger" type="button" id="acc_panel_'; echo LR\Filters::escapeHtmlAttr($panels_ids[$index]) /* line 44 */; echo '" aria-label="'; echo LR\Filters::escapeHtmlAttr($aria_label_text) /* line 45 */; echo '" > '; $this->renderBlock('acc_trigger', get_defined_vars()) /* line 47 */; echo ' <span class="chevron"></span> </button> <div class="collapsible__content" role="region" aria-labelledby="acc_panel_'; echo LR\Filters::escapeHtmlAttr($panels_ids[$index]) /* line 54 */; echo '" > <div class="collapsible__content__inner"> '; $this->renderBlock('acc_content', get_defined_vars()) /* line 57 */; echo ' </div> </div> </div> '; } $iterator = $ʟ_it = $ʟ_it->getParent(); echo ' </div>'; } } public function prepare(): array { extract($this->params); if (!$this->getReferringTemplate() || $this->getReferenceType() === 'extends') { foreach (array_intersect_key(['acc_index' => '14', 'tab_content' => '14', 'index' => '31', 'item' => '31'], $this->params) as $ʟ_v => $ʟ_l) { trigger_error("Variable \$$ʟ_v overwritten in foreach on line $ʟ_l"); } } $panels_ids = [] /* line 12 */; $random_string = uniqid() /* line 13 */; foreach ($items as $acc_index => $tab_content) /* line 14 */ { $index = $acc_index + 1 /* line 15 */; $panels_ids[] = "{$random_string}_{$index}" /* line 16 */; } return get_defined_vars(); } /** {block acc_trigger} on line 47 */ public function blockAcc_trigger(array $ʟ_args): void { } /** {block acc_content} on line 57 */ public function blockAcc_content(array $ʟ_args): void { } }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/views/temp/views-templates-front-page.latte--c1b3f7dea5.php
views/temp/views-templates-front-page.latte--c1b3f7dea5.php
<?php use Latte\Runtime as LR; /** source: C:\xampp\htdocs\theme_redone/wp-content/themes/theme-redone/views/templates/front-page.latte */ final class Templatec1b3f7dea5 extends Latte\Runtime\Template { public function main(): array { extract($this->params); $this->createTemplate(tr_view_path('/layout/header'), $this->params, 'include')->renderToContentType('html') /* line 1 */; echo "\n"; $this->createTemplate(tr_part('todo-remove-examples'), $this->params, 'include')->renderToContentType('html') /* line 3 */; echo ' <div class="content"> '; echo LR\Filters::escapeHtmlText(the_content()) /* line 7 */; echo ' </div> '; $this->createTemplate(tr_view_path('/layout/footer'), $this->params, 'include')->renderToContentType('html') /* line 11 */; return get_defined_vars(); } }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/views/temp/layout-main-menu.latte--8256872286.php
views/temp/layout-main-menu.latte--8256872286.php
<?php use Latte\Runtime as LR; /** source: C:\xampp\htdocs\theme_redone/wp-content/themes/theme_redone/views//layout/main-menu.latte */ final class Template8256872286 extends Latte\Runtime\Template { public function main(array $ʟ_args): void { echo '<header class="header"> <div class="container"> <nav class="navbar"> <a class="navbar-brand" href="'; echo LR\Filters::escapeHtmlAttr(LR\Filters::safeUrl(esc_url(home_url('/')))) /* line 6 */; echo '" itemprop="url" aria-label="'; echo LR\Filters::escapeHtmlAttr(get_bloginfo('name')) /* line 8 */; echo ' Logo - Go to homepage" > '; echo LR\Filters::escapeHtmlText(tr_get_media('logo.svg')) /* line 10 */; echo ' </a> <button class="navbar-toggler collapsed" type="button" data-toggle="collapse" aria-expanded="false" aria-label="Toggle navigation" > <span class="span-icon"></span> <span class="span-icon"></span> <span class="span-icon"></span> </button> '; echo LR\Filters::escapeHtmlText(wp_nav_menu(['menu' => 'top', 'theme_location' => 'menu-1', 'container' => 'div', 'container_id' => 'tr-main-menu', 'container_class' => 'navbar-collapse', 'menu_id' => 'primary-menu', 'menu_class' => 'navbar-nav', 'depth' => 2, 'fallback_cb' => 'ThemeRedoneWalker::fallback', 'walker' => new ThemeRedoneWalker])) /* line 23 */; echo ' </nav> </div> </header> '; } }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/views/temp/layout-header.latte--0b324d01cd.php
views/temp/layout-header.latte--0b324d01cd.php
<?php use Latte\Runtime as LR; /** source: C:\xampp\htdocs\theme_redone/wp-content/themes/theme_redone/views//layout/header.latte */ final class Template0b324d01cd extends Latte\Runtime\Template { public function main(array $ʟ_args): void { extract($ʟ_args); unset($ʟ_args); echo '<!doctype html> <html '; echo language_attributes() /* line 2 */; echo '> <head> <meta charset="'; echo LR\Filters::escapeHtmlAttr(bloginfo('charset')) /* line 5 */; echo '"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" /> <link rel="profile" href="https://gmpg.org/xfn/11"> <link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet" /> '; echo LR\Filters::escapeHtmlText(wp_head()) /* line 13 */; echo ' <style id="critical-css" type="text/css"> '; echo file_get_contents(get_template_directory() . '/prod/global/critical.css') /* line 16 */; echo ' </style> <link rel="preload" href="'; echo LR\Filters::escapeHtmlAttr(LR\Filters::safeUrl(get_template_directory_uri())) /* line 19 */; echo '/prod/global/style.css" as="style"> <link rel="stylesheet" href="'; echo LR\Filters::escapeHtmlAttr(LR\Filters::safeUrl(get_template_directory_uri())) /* line 20 */; echo '/prod/global/style.css"> <script type="text/javascript"> var tr_theme_url = '; echo LR\Filters::escapeJs(get_bloginfo('template_url')) /* line 23 */; echo '; var tr_site_url = '; echo LR\Filters::escapeJs(esc_url(home_url('/'))) /* line 24 */; echo '; </script> </head> <body '; echo body_class() /* line 28 */; echo '> '; $this->createTemplate(tr_view_path('/layout/main-menu'), $this->params, 'include')->renderToContentType('html') /* line 29 */; echo ' <main class="main-content '; echo LR\Filters::escapeHtmlAttr(tr_is_ie() ? 'main_is_ie' : '') /* line 30 */; echo '">'; } }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/views/temp/views-parts-_collapsibles.latte--7b10b89549.php
views/temp/views-parts-_collapsibles.latte--7b10b89549.php
<?php use Latte\Runtime as LR; /** source: C:\xampp\htdocs\theme_redone/wp-content/themes/theme-redone/views/parts/_collapsibles.latte */ final class Template7b10b89549 extends Latte\Runtime\Template { protected const BLOCKS = [ 1 => ['acc_trigger' => 'blockAcc_trigger', 'acc_content' => 'blockAcc_content'], 2 => ['acc_trigger' => 'blockAcc_trigger1', 'acc_content' => 'blockAcc_content1'], 3 => ['acc_trigger' => 'blockAcc_trigger2', 'acc_content' => 'blockAcc_content2'], 4 => ['acc_trigger' => 'blockAcc_trigger3', 'acc_content' => 'blockAcc_content3'], 5 => ['acc_trigger' => 'blockAcc_trigger4', 'acc_content' => 'blockAcc_content4'], 6 => ['acc_trigger' => 'blockAcc_trigger5', 'acc_content' => 'blockAcc_content5'], 7 => ['collapsible_trigger' => 'blockCollapsible_trigger', 'collapsible_content' => 'blockCollapsible_content'], 8 => ['collapsible_trigger' => 'blockCollapsible_trigger1', 'collapsible_content' => 'blockCollapsible_content1'], 9 => ['collapsible_trigger' => 'blockCollapsible_trigger2', 'collapsible_content' => 'blockCollapsible_content2'], 10 => ['collapsible_trigger' => 'blockCollapsible_trigger3', 'collapsible_content' => 'blockCollapsible_content3'], 11 => ['collapsible_trigger' => 'blockCollapsible_trigger4', 'collapsible_content' => 'blockCollapsible_content4'], 12 => ['collapsible_trigger' => 'blockCollapsible_trigger5', 'collapsible_content' => 'blockCollapsible_content5'], 13 => ['collapsible_trigger' => 'blockCollapsible_trigger6', 'collapsible_content' => 'blockCollapsible_content6'], ]; public function main(): array { extract($this->params); echo '<h2>Embed Accordion</h2> '; $dummy_collapsible_content = "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Aperiam \nexplicabo nemo necessitatibus nulla, veniam libero minima velit \naccusantium. Dignissimos blanditiis temporibus tenetur voluptate, \nimpedit odit et quia unde illo ad. Lorem ipsum, dolor sit amet \nconsectetur adipisicing elit. Aperiam explicabo nemo necessitatibus \nnulla, veniam libero minima velit accusantium. Dignissimos blanditiis \ntemporibus tenetur voluptate, impedit odit et quia unde illo ad." /* line 6 */; echo ' <div class="f-row" style="--i-cols: 3; --i-gap: 15;margin-bottom: 100px;" > <div class="col"> <h4>1 Level - collapse siblings</h4> '; $this->enterBlockLayer(1, get_defined_vars()) /* line 26 */; if (false) { $this->renderBlock('acc_trigger', get_defined_vars()) /* line 32 */; echo ' '; $this->renderBlock('acc_content', get_defined_vars()) /* line 38 */; echo "\n"; } try { $this->createTemplate(tr_part('_accordion'), ['items' => $test_acc_items, 'initially_open_item' => 0, 'collapse_siblings' => true], "embed")->renderToContentType('html') /* line 26 */; } finally { $this->leaveBlockLayer(); } echo ' </div> <div class="col"> <h4>1 Level - custom easing</h4> '; $this->enterBlockLayer(2, get_defined_vars()) /* line 50 */; if (false) { $this->renderBlock('acc_trigger', get_defined_vars()) /* line 58 */; echo ' '; $this->renderBlock('acc_content', get_defined_vars()) /* line 64 */; echo "\n"; } try { $this->createTemplate(tr_part('_accordion'), ['items' => $test_acc_items, 'initially_open_item' => 0, 'duration' => 700, 'collapse_siblings' => true, 'easing' => 'cubic-bezier(1,-0.06, 0, 1.56)'], "embed")->renderToContentType('html') /* line 50 */; } finally { $this->leaveBlockLayer(); } echo ' </div> <div class="col"> <h4>1 Level - independent</h4> '; $this->enterBlockLayer(3, get_defined_vars()) /* line 76 */; if (false) { $this->renderBlock('acc_trigger', get_defined_vars()) /* line 81 */; echo ' '; $this->renderBlock('acc_content', get_defined_vars()) /* line 87 */; echo "\n"; } try { $this->createTemplate(tr_part('_accordion'), ['items' => $test_acc_items, 'initially_open_item' => 2], "embed")->renderToContentType('html') /* line 76 */; } finally { $this->leaveBlockLayer(); } echo ' </div> </div> <hr style="margin-top: 40px; margin-bottom: 40px;"> <hr style="margin-top: 40px; margin-bottom: 40px;"> <h2>Nested Accordions</h2> <div class="nested-accordions"> '; $this->enterBlockLayer(4, get_defined_vars()) /* line 111 */; if (false) { $this->renderBlock('acc_trigger', get_defined_vars()) /* line 117 */; echo ' '; $this->renderBlock('acc_content', get_defined_vars()) /* line 123 */; echo "\n"; } try { $this->createTemplate(tr_part('_accordion'), ['items' => $test_acc_items, 'initially_open_item' => 0, 'collapse_siblings' => true], "embed")->renderToContentType('html') /* line 111 */; } finally { $this->leaveBlockLayer(); } echo ' </div> <hr style="margin-top: 40px; margin-bottom: 40px;"> '; $dummy_dd_options = [ [ 'value' => 'none', 'label' => 'Select Option', ], [ 'value' => 'option-1', 'label' => 'Option 1', ], [ 'value' => 'option-2', 'label' => 'Option 2', ], [ 'value' => 'option-3', 'label' => 'Option 3', ], [ 'value' => 'option-4', 'label' => 'Option 4', ], ] /* line 180 */; echo ' <h3>Dropdowns</h3> <div class="f-row" style="--i-cols: 4; --i-gap: 15; margin-bottom: 200px;" > <div class="col"> <h5>Click</h5> '; $this->enterBlockLayer(7, get_defined_vars()) /* line 211 */; if (false) { $this->renderBlock('collapsible_trigger', get_defined_vars()) /* line 212 */; echo "\n"; $this->renderBlock('collapsible_content', get_defined_vars()) /* line 215 */; echo "\n"; } try { $this->createTemplate(tr_part('_collapsible'), [], "embed")->renderToContentType('html') /* line 211 */; } finally { $this->leaveBlockLayer(); } echo ' </div> <div class="col"> <h5>Click (close on click outside)</h5> '; $this->enterBlockLayer(8, get_defined_vars()) /* line 225 */; if (false) { $this->renderBlock('collapsible_trigger', get_defined_vars()) /* line 229 */; echo "\n"; $this->renderBlock('collapsible_content', get_defined_vars()) /* line 232 */; echo "\n"; } try { $this->createTemplate(tr_part('_collapsible'), ['close_outside' => true], "embed")->renderToContentType('html') /* line 225 */; } finally { $this->leaveBlockLayer(); } echo ' </div> <div class="col"> <h5>Hover</h5> '; $this->enterBlockLayer(9, get_defined_vars()) /* line 242 */; if (false) { $this->renderBlock('collapsible_trigger', get_defined_vars()) /* line 246 */; echo "\n"; $this->renderBlock('collapsible_content', get_defined_vars()) /* line 249 */; echo "\n"; } try { $this->createTemplate(tr_part('_collapsible'), ['on_hover' => true], "embed")->renderToContentType('html') /* line 242 */; } finally { $this->leaveBlockLayer(); } echo ' </div> <div class="col"> <h5>Hover absolute</h5> '; $this->enterBlockLayer(10, get_defined_vars()) /* line 259 */; if (false) { $this->renderBlock('collapsible_trigger', get_defined_vars()) /* line 264 */; echo "\n"; $this->renderBlock('collapsible_content', get_defined_vars()) /* line 267 */; echo "\n"; } try { $this->createTemplate(tr_part('_collapsible'), ['on_hover' => true, 'is_absolute' => true], "embed")->renderToContentType('html') /* line 259 */; } finally { $this->leaveBlockLayer(); } echo ' </div> </div> <hr> <h3>Dropdown Selects</h3> <div class="f-row" style="--i-cols: 4; --i-gap: 15; margin-bottom: 200px;" > <div class="col"> <h5>Click</h5> '; $this->createTemplate(tr_part('dropdown-select'), ['options' => $dummy_dd_options] + $this->params, 'include')->renderToContentType('html') /* line 287 */; echo ' </div> <div class="col"> <h5>Close on click outside</h5> '; $this->createTemplate(tr_part('dropdown-select'), ['options' => $dummy_dd_options, 'class' => 'custom-class', 'duration' => 200, 'close_outside' => true, 'default_selected_key' => 3] + $this->params, 'include')->renderToContentType('html') /* line 294 */; echo ' </div> <div class="col"> <h5>Hover</h5> '; $this->createTemplate(tr_part('dropdown-select'), ['options' => $dummy_dd_options, 'on_hover' => true, 'default_selected_key' => 0] + $this->params, 'include')->renderToContentType('html') /* line 306 */; echo ' </div> <div class="col"> <h5>Hover - absolute</h5> '; $this->createTemplate(tr_part('dropdown-select'), ['options' => $dummy_dd_options, 'is_absolute' => true, 'on_hover' => true, 'default_selected_key' => 2] + $this->params, 'include')->renderToContentType('html') /* line 315 */; echo ' </div> </div> '; $custom_keyframes = [ [ "opacity" => 0, "transform" => "translateY(-10px)", "pointer-events" => "none" ], [ "transform" => "translateY(10px)", "offset" => 0.9 ], [ "opacity" => "1", "transform" => "translateY(0)", "pointer-events" => "all" ] ] /* line 334 */; echo ' <div class="f-row" style="--i-cols: 3; --i-gap: 15; margin-bottom: 200px;" > <div class="col"> <h5>Custom Easing</h5> '; $this->enterBlockLayer(11, get_defined_vars()) /* line 358 */; if (false) { $this->renderBlock('collapsible_trigger', get_defined_vars()) /* line 365 */; echo "\n"; $this->renderBlock('collapsible_content', get_defined_vars()) /* line 374 */; echo "\n"; } try { $this->createTemplate(tr_part('_collapsible'), ['on_hover' => true, 'is_absolute' => true, 'duration' => 500, 'easing' => 'cubic-bezier(1,-0.06, 0, 1.56)'], "embed")->renderToContentType('html') /* line 358 */; } finally { $this->leaveBlockLayer(); } echo ' </div> <div class="col"> <h5>Custom Keyframes</h5> '; $this->enterBlockLayer(12, get_defined_vars()) /* line 384 */; if (false) { $this->renderBlock('collapsible_trigger', get_defined_vars()) /* line 391 */; echo "\n"; $this->renderBlock('collapsible_content', get_defined_vars()) /* line 400 */; echo "\n"; } try { $this->createTemplate(tr_part('_collapsible'), ['on_hover' => true, 'is_absolute' => true, 'aria_label' => "Toggle Hover Dropdown", 'custom_keyframes' => $custom_keyframes], "embed")->renderToContentType('html') /* line 384 */; } finally { $this->leaveBlockLayer(); } echo ' </div> <div class="col"> <h5>Custom Keyframes - custom easing</h5> '; $this->enterBlockLayer(13, get_defined_vars()) /* line 410 */; if (false) { $this->renderBlock('collapsible_trigger', get_defined_vars()) /* line 419 */; echo "\n"; $this->renderBlock('collapsible_content', get_defined_vars()) /* line 428 */; echo "\n"; } try { $this->createTemplate(tr_part('_collapsible'), ['on_hover' => true, 'is_absolute' => true, 'aria_label' => "Toggle Hover Dropdown", 'custom_keyframes' => $custom_keyframes, 'duration' => 600, 'easing' => 'cubic-bezier(1,-0.06, 0, 1.56)'], "embed")->renderToContentType('html') /* line 410 */; } finally { $this->leaveBlockLayer(); } echo ' </div> </div> '; return get_defined_vars(); } /** {block acc_trigger} on line 32 */ public function blockAcc_trigger(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <h5> <strong>'; echo LR\Filters::escapeHtmlText($item['anchor']) /* line 34 */; echo '</strong> ✅ </h5> '; } /** {block acc_content} on line 38 */ public function blockAcc_content(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <span> <div class="test-custom-class"> '; if (!empty($item['content']['title'])) /* line 41 */ { echo ' <h4>'; echo LR\Filters::escapeHtmlText($item['content']['title']) /* line 41 */; echo '</h4> '; } ob_start(function () {}); try { echo ' <p>'; ob_start(); try { echo LR\Filters::escapeHtmlText($item['content']['text']) /* line 42 */; } finally { $ʟ_ifc[1] = rtrim(ob_get_flush()) === ''; } echo '</p> '; } finally { if ($ʟ_ifc[1] ?? null) { ob_end_clean(); } else { echo ob_get_clean(); } } echo ' </div> </span> '; } /** {block acc_trigger} on line 58 */ public function blockAcc_trigger1(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <h5> <strong>'; echo LR\Filters::escapeHtmlText($item['anchor']) /* line 60 */; echo '</strong> ✅ </h5> '; } /** {block acc_content} on line 64 */ public function blockAcc_content1(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <span> <div class="test-custom-class"> '; if (!empty($item['content']['title'])) /* line 67 */ { echo ' <h4>'; echo LR\Filters::escapeHtmlText($item['content']['title']) /* line 67 */; echo '</h4> '; } ob_start(function () {}); try { echo ' <p>'; ob_start(); try { echo LR\Filters::escapeHtmlText($item['content']['text']) /* line 68 */; } finally { $ʟ_ifc[2] = rtrim(ob_get_flush()) === ''; } echo '</p> '; } finally { if ($ʟ_ifc[2] ?? null) { ob_end_clean(); } else { echo ob_get_clean(); } } echo ' </div> </span> '; } /** {block acc_trigger} on line 81 */ public function blockAcc_trigger2(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <h5> <strong>'; echo LR\Filters::escapeHtmlText($item['anchor']) /* line 83 */; echo '</strong> ✅ </h5> '; } /** {block acc_content} on line 87 */ public function blockAcc_content2(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <span> <div class="test-custom-class"> '; if (!empty($item['content']['title'])) /* line 90 */ { echo ' <h4>'; echo LR\Filters::escapeHtmlText($item['content']['title']) /* line 90 */; echo '</h4> '; } ob_start(function () {}); try { echo ' <p>'; ob_start(); try { echo LR\Filters::escapeHtmlText($item['content']['text']) /* line 91 */; } finally { $ʟ_ifc[3] = rtrim(ob_get_flush()) === ''; } echo '</p> '; } finally { if ($ʟ_ifc[3] ?? null) { ob_end_clean(); } else { echo ob_get_clean(); } } echo ' </div> </span> '; } /** {block acc_trigger} on line 117 */ public function blockAcc_trigger3(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <h5> <strong>'; echo LR\Filters::escapeHtmlText($item['anchor']) /* line 119 */; echo ' - lvl1</strong> ✅ </h5> '; } /** {block acc_content} on line 123 */ public function blockAcc_content3(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); $this->enterBlockLayer(5, get_defined_vars()) /* line 124 */; if (false) { $this->renderBlock('acc_trigger', get_defined_vars()) /* line 128 */; echo ' '; $this->renderBlock('acc_content', get_defined_vars()) /* line 134 */; echo "\n"; } try { $this->createTemplate(tr_part('_accordion'), ['items' => $test_acc_items], "embed")->renderToContentType('html') /* line 124 */; } finally { $this->leaveBlockLayer(); } echo "\n"; } /** {block acc_trigger} on line 128 */ public function blockAcc_trigger4(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <h5> <strong>'; echo LR\Filters::escapeHtmlText($item['anchor']) /* line 130 */; echo ' - lvl2</strong> ✅ </h5> '; } /** {block acc_content} on line 134 */ public function blockAcc_content4(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); if ($index === 0) /* line 135 */ { $this->enterBlockLayer(6, get_defined_vars()) /* line 136 */; if (false) { $this->renderBlock('acc_trigger', get_defined_vars()) /* line 142 */; echo ' '; $this->renderBlock('acc_content', get_defined_vars()) /* line 148 */; echo "\n"; } try { $this->createTemplate(tr_part('_accordion'), ['items' => $test_acc_items, 'collapse_siblings' => true, 'easing' => 'cubic-bezier(1,-0.06, 0, 1.56)'], "embed")->renderToContentType('html') /* line 136 */; } finally { $this->leaveBlockLayer(); } echo ' '; } else /* line 159 */ { echo ' <span> <div class="test-custom-class"> <h4>lvl2</h4> '; if (!empty($item['content']['title'])) /* line 163 */ { echo ' <h4>'; echo LR\Filters::escapeHtmlText($item['content']['title']) /* line 163 */; echo '</h4> '; } ob_start(function () {}); try { echo ' <p>'; ob_start(); try { echo LR\Filters::escapeHtmlText($item['content']['text']) /* line 164 */; } finally { $ʟ_ifc[5] = rtrim(ob_get_flush()) === ''; } echo '</p> '; } finally { if ($ʟ_ifc[5] ?? null) { ob_end_clean(); } else { echo ob_get_clean(); } } echo ' </div> </span> '; } } /** {block acc_trigger} on line 142 */ public function blockAcc_trigger5(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <h5> <strong>'; if ($index === 0) /* line 144 */ { echo 'INDEX0'; } echo LR\Filters::escapeHtmlText($item['anchor']) /* line 144 */; echo ' - lvl3</strong> ✅ </h5> '; } /** {block acc_content} on line 148 */ public function blockAcc_content5(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <span> <div class="test-custom-class"> <h4>lvl3</h4> '; if (!empty($item['content']['title'])) /* line 152 */ { echo ' <h4>'; echo LR\Filters::escapeHtmlText($item['content']['title']) /* line 152 */; echo '</h4> '; } ob_start(function () {}); try { echo ' <p>'; ob_start(); try { echo LR\Filters::escapeHtmlText($item['content']['text']) /* line 153 */; } finally { $ʟ_ifc[4] = rtrim(ob_get_flush()) === ''; } echo '</p> '; } finally { if ($ʟ_ifc[4] ?? null) { ob_end_clean(); } else { echo ob_get_clean(); } } echo ' </div> </span> '; } /** {block collapsible_trigger} on line 212 */ public function blockCollapsible_trigger(array $ʟ_args): void { echo ' Regular Click Dropdown '; } /** {block collapsible_content} on line 215 */ public function blockCollapsible_content(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <h5>Will close on outside click</h5> <p> '; echo LR\Filters::escapeHtmlText(substr($dummy_collapsible_content, 0, rand(40, strlen($dummy_collapsible_content) - 1))) /* line 218 */; echo ' </p> '; } /** {block collapsible_trigger} on line 229 */ public function blockCollapsible_trigger1(array $ʟ_args): void { echo ' Regular Click Dropdown '; } /** {block collapsible_content} on line 232 */ public function blockCollapsible_content1(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <h5>Will close on outside click</h5> <p> '; echo LR\Filters::escapeHtmlText(substr($dummy_collapsible_content, 0, rand(40, strlen($dummy_collapsible_content) - 1))) /* line 235 */; echo ' </p> '; } /** {block collapsible_trigger} on line 246 */ public function blockCollapsible_trigger2(array $ʟ_args): void { echo ' Regular Click Dropdown '; } /** {block collapsible_content} on line 249 */ public function blockCollapsible_content2(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <h5>Hover</h5> <p> '; echo LR\Filters::escapeHtmlText(substr($dummy_collapsible_content, 0, rand(40, strlen($dummy_collapsible_content) - 1))) /* line 252 */; echo ' </p> '; } /** {block collapsible_trigger} on line 264 */ public function blockCollapsible_trigger3(array $ʟ_args): void { echo ' Hover Absolute '; } /** {block collapsible_content} on line 267 */ public function blockCollapsible_content3(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <h5>Will close on outside click</h5> <p> '; echo LR\Filters::escapeHtmlText(substr($dummy_collapsible_content, 0, rand(40, strlen($dummy_collapsible_content) - 1))) /* line 270 */; echo ' </p> '; } /** {block collapsible_trigger} on line 365 */ public function blockCollapsible_trigger4(array $ʟ_args): void { echo ' <img alt="test" src="https://source.unsplash.com/40x40" width="40" height="40" > <h5 style="margin-left: 10px;">Hover, custom keyframes</h5> '; } /** {block collapsible_content} on line 374 */ public function blockCollapsible_content4(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <h5>Hover - custom easing</h5> <p> '; echo LR\Filters::escapeHtmlText(substr($dummy_collapsible_content, 0, rand(40, strlen($dummy_collapsible_content) - 1))) /* line 377 */; echo ' </p> '; } /** {block collapsible_trigger} on line 391 */ public function blockCollapsible_trigger5(array $ʟ_args): void { echo ' <img alt="test" src="https://source.unsplash.com/40x40" width="40" height="40" > <h5 style="margin-left: 10px;">Hover, custom keyframes</h5> '; } /** {block collapsible_content} on line 400 */ public function blockCollapsible_content5(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <h5>Trigger on hover, custom keyframes</h5> <p> '; echo LR\Filters::escapeHtmlText(substr($dummy_collapsible_content, 0, rand(40, strlen($dummy_collapsible_content) - 1))) /* line 403 */; echo ' </p> '; } /** {block collapsible_trigger} on line 419 */ public function blockCollapsible_trigger6(array $ʟ_args): void { echo ' <img alt="test" src="https://source.unsplash.com/40x40" width="40" height="40" > <h5 style="margin-left: 10px;">Hover, custom keyframes</h5> '; } /** {block collapsible_content} on line 428 */ public function blockCollapsible_content6(array $ʟ_args): void { extract(end($this->varStack)); extract($ʟ_args); unset($ʟ_args); echo ' <h5>Trigger on hover, custom keyframes</h5> <p> '; echo LR\Filters::escapeHtmlText(substr($dummy_collapsible_content, 0, rand(40, strlen($dummy_collapsible_content) - 1))) /* line 431 */; echo ' </p> '; } }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/views/temp/views-parts-_accordion.latte--715e2ae4d8.php
views/temp/views-parts-_accordion.latte--715e2ae4d8.php
<?php use Latte\Runtime as LR; /** source: C:\xampp\htdocs\theme_redone/wp-content/themes/theme_redone/views/parts/_accordion.latte */ final class Template715e2ae4d8 extends Latte\Runtime\Template { protected const BLOCKS = [ ['acc_trigger' => 'blockAcc_trigger', 'acc_content' => 'blockAcc_content'], ]; public function main(): array { extract($this->params); echo ' '; $panels_ids = [] /* line 12 */; $random_string = uniqid() /* line 13 */; $iterations = 0; foreach ($items as $acc_index => $tab_content) /* line 14 */ { $index = $acc_index + 1 /* line 15 */; $panels_ids[] = "{$random_string}_{$index}" /* line 16 */; $iterations++; } echo "\n"; if (!empty($items)) /* line 19 */ { echo '<div class="accordion '; echo LR\Filters::escapeHtmlAttr($class ?? '') /* line 20 */; echo '" '; if ($collapse_siblings ?? false) /* line 21 */ { echo ' data-collapse-siblings '; } echo ' data-duration="'; echo LR\Filters::escapeHtmlAttr(!empty($duration) ? $duration : '300') /* line 24 */; echo '" '; if (!empty($easing)) /* line 26 */ { echo ' data-easing="'; echo LR\Filters::escapeHtmlAttr($easing) /* line 27 */; echo '" '; } echo '> '; $iterations = 0; foreach ($iterator = $ʟ_it = new LR\CachingIterator($items, $ʟ_it ?? null) as $index => $item) /* line 31 */ { $is_initially_open = isset($initially_open_item) && $index === $initially_open_item /* line 32 */; $aria_label_text = !empty($aria_label) ? $aria_label : 'Toggle Accordion Item' /* line 33 */; echo ' <div class="collapsible" '; if ($is_initially_open) /* line 37 */ { echo ' data-initially-open '; } echo ' > <button class="collapsible__trigger" type="button" id="acc_panel_'; echo LR\Filters::escapeHtmlAttr($panels_ids[$index]) /* line 44 */; echo '" aria-label="'; echo LR\Filters::escapeHtmlAttr($aria_label_text) /* line 45 */; echo '" > '; $this->renderBlock('acc_trigger', get_defined_vars()) /* line 47 */; echo ' <span class="chevron"></span> </button> <div class="collapsible__content" role="region" aria-labelledby="acc_panel_'; echo LR\Filters::escapeHtmlAttr($panels_ids[$index]) /* line 54 */; echo '" > <div class="collapsible__content__inner"> '; $this->renderBlock('acc_content', get_defined_vars()) /* line 57 */; echo ' </div> </div> </div> '; $iterations++; } $iterator = $ʟ_it = $ʟ_it->getParent(); echo ' </div>'; } return get_defined_vars(); } public function prepare(): void { extract($this->params); if (!$this->getReferringTemplate() || $this->getReferenceType() === "extends") { foreach (array_intersect_key(['acc_index' => '14', 'tab_content' => '14', 'index' => '31', 'item' => '31'], $this->params) as $ʟ_v => $ʟ_l) { trigger_error("Variable \$$ʟ_v overwritten in foreach on line $ʟ_l"); } } } /** {block acc_trigger} on line 47 */ public function blockAcc_trigger(array $ʟ_args): void { } /** {block acc_content} on line 57 */ public function blockAcc_content(array $ʟ_args): void { } }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false
webredone/theme-redone
https://github.com/webredone/theme-redone/blob/1b016b92c4593563c030e995870b9fb6d102cc6e/views/temp/views-parts-_slider.latte--06877ba0ae.php
views/temp/views-parts-_slider.latte--06877ba0ae.php
<?php use Latte\Runtime as LR; /** source: C:\xampp\htdocs\theme_redone/wp-content/themes/theme_redone/views/parts/_slider.latte */ final class Template06877ba0ae extends Latte\Runtime\Template { protected const BLOCKS = [ ['slide_q' => 'blockSlide_q', 'slide' => 'blockSlide', 'after_loop' => 'blockAfter_loop'], ]; public function main(): array { extract($this->params); $mode = 'array' /* line 4 */; echo ' '; if (gettype($slides) === 'object' && $slides instanceof WP_Query) /* line 5 */ { $mode = 'query' /* line 6 */; } echo ' '; if (!empty($class) && ( ( $mode === 'array' && !empty($slides) ) || ( $mode === 'query' && $slides->have_posts() ) )) /* line 10 */ { echo ' <div class="slider-wrap"> <div class="embla '; echo LR\Filters::escapeHtmlAttr($class) /* line 21 */; echo '"> <div class="embla__container"> '; if ($mode === 'query') /* line 24 */ { while ($slides->have_posts()) /* line 25 */ { echo ' '; echo LR\Filters::escapeHtmlText($slides->the_post()) /* line 26 */; echo ' <div class="embla__slide" > <div class="embla__slide__inner"> '; $this->renderBlock('slide_q', get_defined_vars()) /* line 31 */; echo ' </div> </div> '; } } else /* line 35 */ { $iterations = 0; foreach ($iterator = $ʟ_it = new LR\CachingIterator($slides, $ʟ_it ?? null) as $s_key => $s_content) /* line 36 */ { echo ' <div class="embla__slide" > <div class="embla__slide__inner"> '; $this->renderBlock('slide', get_defined_vars()) /* line 41 */; echo ' </div> </div>'; $iterations++; } $iterator = $ʟ_it = $ʟ_it->getParent(); } echo ' </div> </div> <div class="embla__buttons"> <button class="embla__btn embla__btn-prev" type="button" aria-label="Go to previous slide" ></button> <div class="embla__dots"></div> <button class="embla__btn embla__btn-next" type="button" aria-label="Go to next slide" ></button> </div> '; $this->renderBlock('after_loop', get_defined_vars()) /* line 63 */; echo ' '; if ($mode === 'query') /* line 65 */ { echo ' '; echo LR\Filters::escapeHtmlText(wp_reset_postdata()) /* line 66 */; echo "\n"; } echo ' </div> '; } return get_defined_vars(); } public function prepare(): void { extract($this->params); if (!$this->getReferringTemplate() || $this->getReferenceType() === "extends") { foreach (array_intersect_key(['s_key' => '36', 's_content' => '36'], $this->params) as $ʟ_v => $ʟ_l) { trigger_error("Variable \$$ʟ_v overwritten in foreach on line $ʟ_l"); } } } /** {block slide_q} on line 31 */ public function blockSlide_q(array $ʟ_args): void { } /** {block slide} on line 41 */ public function blockSlide(array $ʟ_args): void { } /** {block after_loop} on line 63 */ public function blockAfter_loop(array $ʟ_args): void { } }
php
MIT
1b016b92c4593563c030e995870b9fb6d102cc6e
2026-01-05T04:52:39.214683Z
false