Your project uses non-strict array lookups 3
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.strict_array_lookup
- // Extract statement type
- $stmt_type = strtoupper(trim(explode(' ', $sql)[0]));
- // Whitelist allowed SQL types
- if (!in_array($stmt_type, $allowed_statements)) {
- $CLICSHOPPING_MessageStack->add('Restore skipped: unsupported SQL statement type (' . $stmt_type . ')', 'warning');
- continue;
- }
- // Validate DROP TABLE statements to prevent SQL injection
- }
- // Optional: Whitelist specific domains (e.g., GitHub)
- // Uncomment and modify as needed:
- $allowed_domains = ['github.com', 'api.github.com'];
- if (!in_array($parsed_url['host'] ?? '', $allowed_domains)) {
- $this->messageStack->add('Download from unauthorized domain', 'error');
- CLICSHOPPING::redirect('Upgrade&Marketplace');
- return null;
- }
- $flags['session_id'] = false;
- }
- // Security: Validate method against whitelist
- $allowed_methods = ['post', 'get'];
- $safe_method = in_array(strtolower($method ?? 'post'), $allowed_methods) ? strtolower($method ?? 'post') : 'post';
- // Security: Sanitize form action URL
- $safe_action = static::sanitizeUrl($action);
- $form = '<form name="' . static::outputProtected($name) . '" action="' . $safe_action . '" method="' . $safe_method . '"';
Your project should not contain PHP files defining multiple classes 2
- Read doc
- Productivity
- Info
More information: https://insight.symfony.com/what-we-analyse/php.file_contains_more_than_one_class
Your project should use dedicated PHP string functions 10
- Read doc
- Productivity
- Info
More information: https://insight.symfony.com/what-we-analyse/php.use_string_function
- }
- $expectedV6 = filter_var($expected, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
- $actualV6 = filter_var($actual, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
- if ($expectedV6 !== false && $actualV6 !== false) {
- return substr(inet_pton($expectedV6), 0, 8) === substr(inet_pton($actualV6), 0, 8);
- }
- // Mixed family or unparseable — fall back to strict to avoid silent bypass.
- return $expected === $actual;
- }
- $expectedV6 = filter_var($expected, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
- $actualV6 = filter_var($actual, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
- if ($expectedV6 !== false && $actualV6 !== false) {
- // Same /64 — first 8 bytes of the 16-byte packed form.
- return substr(inet_pton($expectedV6), 0, 8) === substr(inet_pton($actualV6), 0, 8);
- }
- // Mixed family or unparseable — fall back to strict to avoid silent bypass.
- return $expected === $actual;
- }
- if ($zip->open($filename_localisation) === true) {
- $has_traversal = false;
- for ($i = 0; $i < $zip->numFiles; $i++) {
- $filename = $zip->getNameIndex($i);
- // Check for path traversal
- if (strpos($filename, '..') !== false || strpos($filename, '/') === 0 || strpos($filename, '\\') === 0) {
- $has_traversal = true;
- break;
- }
- // Check for absolute paths
- if (preg_match('/^[a-zA-Z]:\\/', $filename)) {
- if ($zip->open($filename_localisation) === true) {
- $has_traversal = false;
- for ($i = 0; $i < $zip->numFiles; $i++) {
- $filename = $zip->getNameIndex($i);
- // Check for path traversal
- if (strpos($filename, '..') !== false || strpos($filename, '/') === 0 || strpos($filename, '\\') === 0) {
- $has_traversal = true;
- break;
- }
- // Check for absolute paths
- if (preg_match('/^[a-zA-Z]:\\/', $filename)) {
- if ($response === '') {
- return $response;
- }
- // If there are no HTML tags at all, skip the work
- $hasTags = (\strpos($response, '<') !== false);
- if ($hasTags) {
- $response = \strip_tags($response);
- $response = \html_entity_decode($response, ENT_QUOTES | ENT_HTML5, 'UTF-8');
- }
- $llmProvider = 'openai'; // Default
- if (defined('CLICSHOPPING_APP_CHATGPT_CH_MODEL')) {
- $model = CLICSHOPPING_APP_CHATGPT_CH_MODEL;
- // Determine provider from model name
- if (strpos($model, 'anth-') === 0 || strpos($model, 'claude') !== false) {
- $llmProvider = 'anthropic';
- } elseif (strpos($model, 'mistral') !== false) {
- $llmProvider = 'mistral';
- } elseif (strpos($model, 'ollama:') === 0 || strpos($model, 'mistral:') === 0) {
- $llmProvider = 'ollama';
- $llmProvider = 'openai'; // Default
- if (defined('CLICSHOPPING_APP_CHATGPT_CH_MODEL')) {
- $model = CLICSHOPPING_APP_CHATGPT_CH_MODEL;
- // Determine provider from model name
- if (strpos($model, 'anth-') === 0 || strpos($model, 'claude') !== false) {
- $llmProvider = 'anthropic';
- } elseif (strpos($model, 'mistral') !== false) {
- $llmProvider = 'mistral';
- } elseif (strpos($model, 'ollama:') === 0 || strpos($model, 'mistral:') === 0) {
- $llmProvider = 'ollama';
- $model = CLICSHOPPING_APP_CHATGPT_CH_MODEL;
- // Determine provider from model name
- if (strpos($model, 'anth-') === 0 || strpos($model, 'claude') !== false) {
- $llmProvider = 'anthropic';
- } elseif (strpos($model, 'mistral') !== false) {
- $llmProvider = 'mistral';
- } elseif (strpos($model, 'ollama:') === 0 || strpos($model, 'mistral:') === 0) {
- $llmProvider = 'ollama';
- } elseif (strpos($model, 'openai/') === 0 || strpos($model, 'microsoft/') === 0 || strpos($model, 'qwen/') === 0) {
- $llmProvider = 'lmstudio';
- // Determine provider from model name
- if (strpos($model, 'anth-') === 0 || strpos($model, 'claude') !== false) {
- $llmProvider = 'anthropic';
- } elseif (strpos($model, 'mistral') !== false) {
- $llmProvider = 'mistral';
- } elseif (strpos($model, 'ollama:') === 0 || strpos($model, 'mistral:') === 0) {
- $llmProvider = 'ollama';
- } elseif (strpos($model, 'openai/') === 0 || strpos($model, 'microsoft/') === 0 || strpos($model, 'qwen/') === 0) {
- $llmProvider = 'lmstudio';
- } else {
- // Default to OpenAI for gpt-* models
- $llmProvider = 'anthropic';
- } elseif (strpos($model, 'mistral') !== false) {
- $llmProvider = 'mistral';
- } elseif (strpos($model, 'ollama:') === 0 || strpos($model, 'mistral:') === 0) {
- $llmProvider = 'ollama';
- } elseif (strpos($model, 'openai/') === 0 || strpos($model, 'microsoft/') === 0 || strpos($model, 'qwen/') === 0) {
- $llmProvider = 'lmstudio';
- } else {
- // Default to OpenAI for gpt-* models
- $llmProvider = 'openai';
- }