Your project should only use iterable types in foreach loops 686
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_foreach_iterable
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- }
- // Recommandations
- if (!empty($health['recommendations'])) {
- $html .= '<div class="section"><h2>💡 Recommendations</h2>';
- foreach ($health['recommendations'] as $rec) {
- $html .= "<div class=\"recommendation\"><strong>{$rec['category']}</strong>: {$rec['message']}</div>";
- }
- $html .= '</div>';
- }
- HTML;
- // Alertes actives
- if (!empty($data['active_alerts'])) {
- $html .= '<div class="section"><h2>🚨 Active Alerts</h2>';
- foreach ($data['active_alerts'] as $alert) {
- $alertClass = $alert['severity'] === 'high' ? 'alert-item' : 'alert-item warning';
- $html .= "<div class=\"{$alertClass}\"><strong>{$alert['type']}</strong>: {$alert['message']}</div>";
- }
- $html .= '</div>';
- }
- $activeAlerts = $healthReport['active_alerts'] ?? [];
- if (empty($activeAlerts)) {
- $output .= "$timestamp,none,none,No active alerts,0,0\n";
- } else {
- foreach ($activeAlerts as $alert) {
- $type = $alert['type'] ?? 'unknown';
- $severity = $alert['severity'] ?? 'unknown';
- $message = str_replace([',', "\n", "\r"], [';', ' ', ' '], $alert['message'] ?? '');
- $value = $alert['value'] ?? 0;
- $threshold = $alert['threshold'] ?? 0;
- $output .= "Timestamp,Source,Count,Percentage,Success_Rate,Avg_Response_Time\n";
- $sourceStats = $data['source_stats'] ?? [];
- $sources = $sourceStats['sources'] ?? [];
- foreach ($sources as $source => $sourceData) {
- $count = $sourceData['count'] ?? 0;
- $percentage = $sourceData['percentage'] ?? 0;
- $successRate = $sourceData['success_rate'] ?? 0;
- $avgTime = $sourceData['avg_response_time'] ?? 0;
- $componentHealth = $healthReport['component_health'] ?? [];
- $systemReport = $data['system_report'] ?? [];
- $components = $systemReport['components'] ?? [];
- foreach ($componentHealth as $comp) {
- $name = $comp['name'] ?? 'unknown';
- $status = $comp['status'] ?? 'unknown';
- $compData = $components[$name] ?? [];
- $totalCalls = $compData['total_calls'] ?? 0;
- // Tendances
- if (!empty($health['trends']) && !isset($health['trends']['insufficient_data'])) {
- $html .= '<div class="section"><h2>📈 Trends</h2><table><thead><tr><th>Metric</th><th>Trend</th><th>Change</th><th>Current Value</th></tr></thead><tbody>';
- foreach ($health['trends'] as $metric => $trend) {
- $trendClass = match($trend['trend']) {
- 'increasing' => 'trend-up',
- 'decreasing' => 'trend-down',
- default => 'trend-stable',
- };
- $output .= "Timestamp,Query_Type,Count,Percentage,Avg_Response_Time,Success_Rate\n";
- $globalStats = $data['global_stats'] ?? [];
- $queryTypes = $globalStats['query_types'] ?? [];
- foreach ($queryTypes as $type => $typeData) {
- $count = $typeData['count'] ?? 0;
- $percentage = $typeData['percentage'] ?? 0;
- $avgTime = $typeData['avg_response_time'] ?? 0;
- $successRate = $typeData['success_rate'] ?? 0;
- <span class="status-badge">{$health['overall_health']['status']}</span>
- HTML;
- if (!empty($health['overall_health']['issues'])) {
- $html .= '<ul style="margin-top: 12px; color: #6b7280;">';
- foreach ($health['overall_health']['issues'] as $issue) {
- $html .= "<li>{$issue}</li>";
- }
- $html .= '</ul>';
- }
- }
- // Santé des composants
- $html .= '<div class="section"><h2>🔧 Component Health</h2><table><thead><tr><th>Component</th><th>Status</th><th>Total Calls</th><th>Success Rate</th><th>Avg Time</th></tr></thead><tbody>';
- foreach ($health['component_health'] as $comp) {
- $statusColor = $comp['status'] === 'healthy' ? '#10b981' : '#ef4444';
- $metrics = $data['component_metrics'][$comp['name']] ?? [];
- $totalCalls = $metrics['total_calls'] ?? 0;
- $successfulCalls = $metrics['successful_calls'] ?? 0;
- $successRate = $totalCalls > 0 ? round(($successfulCalls / $totalCalls) * 100, 1) : 0;
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Favorites->getConfigModules() as $m) {
- if ($CLICSHOPPING_Favorites->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Favorites->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Favorites->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Favorites_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appFavoritesToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Favorites->getConfigModules() as $m) {
- if ($CLICSHOPPING_Favorites->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Favorites->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Favorites->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_SecDirPermissions->getConfigModules() as $m) {
- if ($CLICSHOPPING_SecDirPermissions->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_SecDirPermissions->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_SecDirPermissions->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appSecDirPermissionsToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_SecDirPermissions->getConfigModules() as $m) {
- if ($CLICSHOPPING_SecDirPermissions->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_SecDirPermissions->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_SecDirPermissions->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_SecDirPermissions_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $modules = $CLICSHOPPING_EditLogError->getConfigModules();
- $default_module = 'EL';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_EditLogError->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- if (is_dir($hybridCacheDir)) {
- $files = glob($hybridCacheDir . '*.cache');
- $filesBefore = count($files);
- // Delete all hybrid cache files
- foreach ($files as $file) {
- @unlink($file);
- }
- }
- // Count files after
- if (is_dir($oldCacheDir)) {
- $oldFiles = glob($oldCacheDir . 'Rag_Ambiguity_*.cache');
- $filesBefore += count($oldFiles);
- // Delete old ambiguity cache files
- foreach ($oldFiles as $file) {
- @unlink($file);
- }
- }
- // Also check very old location (ambiguity_optimizer directory)
- if (is_dir($oldCacheDir)) {
- $oldFiles = glob($oldCacheDir . 'translation_ambiguity_*.cache');
- $filesBefore += count($oldFiles);
- // Delete old translation ambiguity cache files
- foreach ($oldFiles as $file) {
- @unlink($file);
- }
- }
- // Count files after
- if (is_dir($oldEmbeddingSearchDir)) {
- $oldDirFiles = glob($oldEmbeddingSearchDir . '*.cache');
- $filesBefore += count($oldDirFiles);
- // Delete files from old directory
- foreach ($oldDirFiles as $file) {
- @unlink($file);
- }
- }
- // Count files after
- if (is_dir($ambiguityCacheDir)) {
- $files = glob($ambiguityCacheDir . '*.cache');
- $filesBefore = count($files);
- // Delete all ambiguity cache files
- foreach ($files as $file) {
- @unlink($file);
- }
- }
- // Also check old location (root cache directory with Rag_Ambiguity_ prefix)
- if (is_dir($embeddingCacheDir)) {
- $files = glob($embeddingCacheDir . '*.cache');
- $filesBefore = count($files);
- // Delete all embedding cache files
- foreach ($files as $file) {
- @unlink($file);
- }
- }
- // Also check old location (root cache directory with Rag_Embedding_ or embedding_ prefix)
- if (is_dir($translationAmbiguityCacheDir)) {
- $files = glob($translationAmbiguityCacheDir . 'translation_ambiguity_*.cache');
- $filesBefore = count($files);
- // Delete translation ambiguity cache files
- foreach ($files as $file) {
- @unlink($file);
- }
- }
- // Also check old location (root cache directory)
- if (is_dir($intentCacheDir)) {
- $files = glob($intentCacheDir . '*.cache');
- $filesBefore = count($files);
- // Delete all intent cache files
- foreach ($files as $file) {
- @unlink($file);
- }
- }
- // Also check old location (root cache directory with Rag_Intent_ prefix)
- if (is_dir($schemaCacheDir)) {
- $files = glob($schemaCacheDir . '*.cache');
- $filesBefore = count($files);
- // Delete schema cache files
- foreach ($files as $file) {
- @unlink($file);
- }
- }
- // Also check old location (root cache directory with Rag_SchemaQuery_ prefix)
- if (is_dir($oldCacheDir)) {
- $oldFiles = glob($oldCacheDir . 'Rag_Intent_*.cache');
- $filesBefore += count($oldFiles);
- // Delete old intent cache files
- foreach ($oldFiles as $file) {
- @unlink($file);
- }
- }
- // Count files after
- if (is_dir($veryOldCacheDir)) {
- $veryOldFiles = glob($veryOldCacheDir . '*.cache');
- $filesBefore += count($veryOldFiles);
- // Delete very old ambiguity cache files
- foreach ($veryOldFiles as $file) {
- @unlink($file);
- }
- }
- // Count files after
- if (is_dir($oldCacheDir)) {
- $oldFiles = glob($oldCacheDir . 'Rag_SchemaQuery_*.cache');
- $filesBefore += count($oldFiles);
- // Delete old schema cache files
- foreach ($oldFiles as $file) {
- @unlink($file);
- }
- }
- // Count files after
- if (is_dir($embeddingSearchCacheDir)) {
- $files = glob($embeddingSearchCacheDir . '*.cache');
- $filesBefore = count($files);
- // Delete all embedding search cache files
- foreach ($files as $file) {
- @unlink($file);
- }
- }
- // Also check old locations
- if (is_dir($contextCacheDir)) {
- $files = glob($contextCacheDir . '*.cache');
- $filesBefore = count($files);
- // Delete all context cache files
- foreach ($files as $file) {
- @unlink($file);
- }
- }
- // Also check old location (root cache directory with Rag_Context_ or context_ prefix)
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- );
- $CLICSHOPPING_Db->setTablePrefix('');
- $CLICSHOPPING_Db->exec('SET FOREIGN_KEY_CHECKS = 0');
- foreach (glob(CLICSHOPPING::BASE_DIR . 'Schema/MariaDb/*.txt') as $f) {
- $schema = $CLICSHOPPING_Db->getSchemaFromFile($f);
- $sql = $CLICSHOPPING_Db->getSqlFromSchema($schema, $_POST['prefix']);
- $CLICSHOPPING_Db->exec('DROP TABLE IF EXISTS ' . $_POST['prefix'] . basename($f, '.txt'));
- $message = str_replace('src="/', 'src="' . HTTP::getShopUrlDomain(), $message);
- $CLICSHOPPING_Mail->addHtmlCkeditor($message);
- foreach ($send_newsletter as $value) {
- $CLICSHOPPING_Mail->send($value['customers_email_address'], $value['customers_firstname'] . ' ' . $value['customers_lastname'], $this->emailFrom, null, $subject);
- }
- $CLICSHOPPING_Hooks->call('Newsletter', 'NewsletterSendCkEditor');
- }
- //--------------------------------------------------------------
- // level 3
- if (isset($menu_sub[$second_level]['sub_menu'])) {
- $output .= '<ul>';
- foreach ($menu_sub[$second_level]['sub_menu'] as $third_level) {
- $image = '';
- if (!is_null($menu_sub[$third_level]['link'])) {
- $output .= '<li>' . HTML::link(CLICSHOPPING::link($menu_sub[$third_level]['link']), $image . ' ' . $menu_sub[$third_level]['label']) . '</li>';
- } else {
- //--------------------------------------------------------------
- // level 2
- if (isset($menus['sub_menu'])) {
- $output .= '<ul>';
- foreach ($menus['sub_menu'] as $second_level) {
- $image = '';
- if ($menu_sub[$second_level]['link'] != '') {
- $output .= '<li>' . HTML::link(CLICSHOPPING::link($menu_sub[$second_level]['link']), $image . ' ' . $menu_sub[$second_level]['label']) . '</li>';
- } else {
- //--------------------------------------------------------------
- // level 4
- if (isset($menu_sub[$third_level]['sub_menu'])) {
- // $output .= '<ul>';
- foreach ($menu_sub[$third_level]['sub_menu'] as $fourth_level) {
- $image = '';
- if (!is_null($menu_sub[$fourth_level]['link'])) {
- $output .= '<li>' . HTML::link(CLICSHOPPING::link($menu_sub[$fourth_level]['link']), $image . ' ' . $menu_sub[$fourth_level]['label']) . '</li>';
- } else {
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Backup_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Backup->getConfigModules() as $m) {
- if ($CLICSHOPPING_Backup->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Backup->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Backup->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appBackupToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Backup->getConfigModules() as $m) {
- if ($CLICSHOPPING_Backup->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Backup->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Backup->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- $CLICSHOPPING_Hooks = Registry::get('Hooks');
- $page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $Qid = $CLICSHOPPING_Reviews->db->get('reviews_sentiment', 'id', ['reviews_id' => (int)$id]);
- $CLICSHOPPING_Reviews->db->delete('reviews_sentiment', ['reviews_id' => (int)$id]);
- $CLICSHOPPING_Reviews->db->delete('reviews_sentiment_description', ['id' => (int)$Qid->valueInt('id')]);
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Weight_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appWeightToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Weight->getConfigModules() as $m) {
- if ($CLICSHOPPING_Weight->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Weight->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Weight->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Weight->getConfigModules() as $m) {
- if ($CLICSHOPPING_Weight->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Weight->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Weight->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- 'User-Agent' => 'ClicShopping-HttpClient/1.0',
- 'Connection' => 'close'
- ];
- if (!empty($parameters['header'])) {
- foreach ($parameters['header'] as $header) {
- if (strpos($header, ':') !== false) {
- [$name, $value] = explode(':', $header, 2);
- $headers[trim($name)] = trim($value);
- }
- }
- $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]', $this->PageSizes[$n][0], $this->PageSizes[$n][1]));
- $this->_out('/Resources 2 0 R');
- if (isset($this->PageLinks[$n])) {
- //Links
- $annots = '/Annots [';
- foreach ($this->PageLinks[$n] as $pl) {
- $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]);
- $annots .= '<</Type /Annot /Subtype /Link /Rect [' . $rect . '] /Border [0 0 0] ';
- if (is_string($pl[4]))
- $annots .= '/A <</S /URI /URI ' . $this->_textstring($pl[4]) . '>>>>';
- else {
- $this->_out('endobj');
- //Descriptor
- $this->_newobj();
- $s = '<</Type /FontDescriptor /FontName /' . $name;
- foreach ($font['desc'] as $k => $v)
- $s .= ' /' . $k . ' ' . $v;
- $file = $font['file'];
- if ($file)
- $s .= ' /FontFile' . ($type == 'Type1' ? '' : '2') . ' ' . $this->FontFiles[$file]['n'] . ' 0 R';
- $this->_out($s . '>>');
- */
- public function _putimages()
- {
- $filter = ($this->compress) ? '/Filter /FlateDecode ' : '';
- //while(list($file,$info)=each($this->images))
- foreach ($this->images as $file => $info) {
- $this->_newobj();
- $this->images[$file]['n'] = $this->n;
- $this->_out('<</Type /XObject');
- $this->_out('/Subtype /Image');
- $this->_out('/Width ' . $info['w']);
- * @return void
- */
- public function _putfonts()
- {
- $nf = $this->n;
- foreach ($this->diffs as $diff) {
- //Encodings
- $this->_newobj();
- $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $diff . ']>>');
- $this->_out('endobj');
- }
- */
- public function _putresourcedict()
- {
- $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
- $this->_out('/Font <<');
- foreach ($this->fonts as $font)
- $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
- $this->_out('>>');
- $this->_out('/XObject <<');
- $this->_putxobjectdict();
- $this->_out('>>');
- $this->_out('/Length2 ' . $info['length2'] . ' /Length3 0');
- $this->_out('>>');
- $this->_putstream($font);
- $this->_out('endobj');
- }
- foreach ($this->fonts as $k => $font) {
- //Font objects
- $this->fonts[$k]['n'] = $this->n + 1;
- $type = $font['type'];
- $name = $font['name'];
- if ($type == 'core') {
- //Encodings
- $this->_newobj();
- $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $diff . ']>>');
- $this->_out('endobj');
- }
- foreach ($this->FontFiles as $file => $info) {
- //Font file embedding
- $this->_newobj();
- $this->FontFiles[$file]['n'] = $this->n;
- $font = '';
- $f = fopen($this->_getfontpath() . $file, 'rb', 1);
- *
- * @return void
- */
- public function _putxobjectdict()
- {
- foreach ($this->images as $image)
- $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
- }
- /**
- * Adds the resource dictionary to the PDF output.
- }
- }
- // 2. Extract information from long-term context (e.g., Previous SQL Query)
- if (!empty($context['long_term_context'])) {
- foreach ($context['long_term_context'] as $document) {
- $docContent = $document->content ?? '';
- // Use 's' modifier to capture multi-line SQL queries
- if (preg_match('/SQL Query:\s*(.+?)(?:\n|$)/is', $docContent, $matches)) {
- // Truncate SQL query if it's excessively long
- $sql = trim($matches[1]);
- $contextKeywords = [];
- $contextEntities = [];
- // Analyze short-term context (recent conversation)
- if (!empty($context['short_term_context'])) {
- foreach ($context['short_term_context'] as $message) {
- $messageKeywords = $this->extractKeywords($message['content'] ?? '');
- $contextKeywords = array_merge($contextKeywords, $messageKeywords);
- // Extract mentioned entities (products, categories, etc.)
- $entities = $this->extractEntitiesFromMessage($message['content'] ?? '');
- }
- }
- // Analyze long-term context (similar interactions)
- if (!empty($context['long_term_context'])) {
- foreach ($context['long_term_context'] as $document) {
- $docContent = $document->content ?? '';
- $docKeywords = $this->extractKeywords($docContent);
- $contextKeywords = array_merge($contextKeywords, $docKeywords);
- $entities = $this->extractEntitiesFromMessage($docContent);
- // Clean and split query
- $words = preg_split('/\s+/', strtolower(trim($query)));
- $keywords = [];
- foreach ($words as $word) {
- // Clean word (remove punctuation)
- $cleanWord = preg_replace('/[^\w\-]/', '', $word);
- // Ignore short words or stop words
- if (strlen($cleanWord) > 2 && !in_array($cleanWord, $stopWords)) {
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appFeaturedToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Featured->getConfigModules() as $m) {
- if ($CLICSHOPPING_Featured->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Featured->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Featured->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Featured_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Featured->getConfigModules() as $m) {
- if ($CLICSHOPPING_Featured->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Featured->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Featured->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- // Calculer le score pour chaque domaine
- foreach ($this->enrichedDomains as $domain => $termGroups) {
- $domainScore = 0;
- $matchedTerms = [];
- foreach ($termGroups as $groupType => $terms) {
- $weight = $this->termWeights[$groupType] ?? 0.5;
- foreach ($terms as $term) {
- if (strpos($query, $term) !== false) {
- $domainScore += $weight;
- $matchedTerms = [];
- foreach ($termGroups as $groupType => $terms) {
- $weight = $this->termWeights[$groupType] ?? 0.5;
- foreach ($terms as $term) {
- if (strpos($query, $term) !== false) {
- $domainScore += $weight;
- $matchedTerms[] = [
- 'term' => $term,
- 'type' => $groupType,
- if (!isset($this->enrichedDomains[$domain])) {
- return [];
- }
- $allTerms = [];
- foreach ($this->enrichedDomains[$domain] as $termGroup) {
- $allTerms = array_merge($allTerms, $termGroup);
- }
- return array_unique($allTerms);
- }
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appReviewsToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Reviews->getConfigModules() as $m) {
- if ($CLICSHOPPING_Reviews->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Reviews->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Reviews->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- ?>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Reviews->getConfigModules() as $m) {
- if ($CLICSHOPPING_Reviews->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Reviews->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Reviews->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Reviews_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $Qreviews->execute();
- $reviews_array = $Qreviews->fetchAll();
- $reviews_id = $Qreviews->valueInt('reviews_id');
- foreach ($reviews_array as $item) {
- $language_code = $this->lang->getLanguageCodeById((int)$item['language_id']);
- $this->app->loadDefinitions('Module/Hooks/ClicShoppingAdmin/PageManager/rag', $language_code);
- $products_id = $item['products_id'];
- $reviews_text = $item['reviews_text'];
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $text = preg_replace('/[^a-z0-9\s]/', ' ', $text);
- $words = preg_split('/\s+/', $text);
- // Filter words longer than 3 characters
- $keywords = [];
- foreach ($words as $word) {
- if (strlen($word) > 3) {
- $keywords[] = $word;
- }
- }
- $prompt .= "Question: {$query}\n\n";
- // Add context if available
- if (!empty($context['conversation_history'])) {
- $prompt .= "Context from previous conversation:\n";
- foreach ($context['conversation_history'] as $item) {
- if (isset($item['role']) && isset($item['content'])) {
- $prompt .= "{$item['role']}: {$item['content']}\n";
- }
- }
- $prompt .= "\n";
- private function notify(array $alert): void
- {
- $rule = $this->alertRules[$alert['type']] ?? null;
- $channels = $rule['channels'] ?? ['log'];
- foreach ($channels as $channelName) {
- if (isset($this->notificationChannels[$channelName])) {
- $channel = $this->notificationChannels[$channelName];
- try {
- $channel['handler']($alert);
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $modules = $CLICSHOPPING_Api->getConfigModules();
- $default_module = 'AI';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Api->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $modules = $CLICSHOPPING_Cache->getConfigModules();
- $default_module = 'CA';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Cache->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Countries->getConfigModules() as $m) {
- if ($CLICSHOPPING_Countries->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Countries->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Countries->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appCountriesToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Countries->getConfigModules() as $m) {
- if ($CLICSHOPPING_Countries->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Countries->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Countries->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Countries_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $dirs = glob($this->cachePath . '*', GLOB_ONLYDIR);
- foreach ($dirs as $dir) {
- $files = glob($dir . '/*.cache');
- foreach ($files as $file) {
- $totalFiles++;
- $totalSize += filesize($file);
- $content = @file_get_contents($file);
- if ($content !== false) {
- $deleted = 0;
- try {
- $dirs = glob($this->cachePath . '*', GLOB_ONLYDIR);
- foreach ($dirs as $dir) {
- $files = glob($dir . '/*.cache');
- foreach ($files as $file) {
- $content = @file_get_contents($file);
- if ($content === false) {
- $deleted = 0;
- // Parcourir tous les sous-répertoires
- $dirs = glob($this->cachePath . '*', GLOB_ONLYDIR);
- foreach ($dirs as $dir) {
- $files = glob($dir . '/*.cache');
- foreach ($files as $file) {
- if (@unlink($file)) {
- $deleted++;
- }
- $dirs = glob($this->cachePath . '*', GLOB_ONLYDIR);
- foreach ($dirs as $dir) {
- $files = glob($dir . '/*.cache');
- foreach ($files as $file) {
- $content = @file_get_contents($file);
- if ($content === false) {
- continue;
- }
- $totalHits = 0;
- try {
- $dirs = glob($this->cachePath . '*', GLOB_ONLYDIR);
- foreach ($dirs as $dir) {
- $files = glob($dir . '/*.cache');
- foreach ($files as $file) {
- $totalFiles++;
- $totalSize += filesize($file);
- // Parcourir tous les sous-répertoires
- $dirs = glob($this->cachePath . '*', GLOB_ONLYDIR);
- foreach ($dirs as $dir) {
- $files = glob($dir . '/*.cache');
- foreach ($files as $file) {
- if (@unlink($file)) {
- $deleted++;
- }
- }
- // Supprimer le répertoire vide
- ');
- $Qapi->bindint(':api_id', $api_id);
- $Qapi->execute();
- foreach ($Qapi->fetch() as $result) {
- $ip_data[] = $result['ip'];
- }
- return $ip_data;
- }
- $this->db->save('api', $sql_data_array);
- $api_id = $this->db->lastInsertId();
- if (isset($data['api_ip'])) {
- foreach ($data['api_ip'] as $ip) {
- if ($ip) {
- $insert_data_array = [
- 'api_id' => (int)$api_id,
- 'ip' => HTML::sanitize($ip)
- ];
- $this->db->delete('api_ip', $delete_sql_array);
- if (isset($data['api_ip'])) {
- foreach ($data['api_ip'] as $ip) {
- if ($ip) {
- $insert_data_array = [
- 'api_id' => (int)$api_id,
- 'ip' => HTML::sanitize($ip)
- ];
- // Most common tables
- if (!empty($summary['most_common_tables'])) {
- $html .= "<div class='common-tables'>\n";
- $html .= "<h4>Most Frequently Queried Tables</h4>\n";
- $html .= "<ul>\n";
- foreach ($summary['most_common_tables'] as $table => $count) {
- $html .= "<li>{$table}: {$count} queries</li>\n";
- }
- $html .= "</ul>\n";
- $html .= "</div>\n";
- }
- $html .= "<p><strong>SQL:</strong> <code>" . htmlspecialchars($query['sql']) . "</code></p>\n";
- if (!empty($query['analysis']['recommendations'])) {
- $html .= "<p><strong>Recommendations:</strong></p>\n";
- $html .= "<ul>\n";
- foreach ($query['analysis']['recommendations'] as $rec) {
- $html .= "<li>[{$rec['priority']}] {$rec['message']}</li>\n";
- }
- $html .= "</ul>\n";
- }
- // Check for missing indexes on WHERE clauses
- if ($analysis['has_where']) {
- $whereColumns = $this->extractWhereColumns($sql);
- foreach ($whereColumns as $table => $columns) {
- foreach ($columns as $column) {
- $recommendations[] = [
- 'type' => 'index',
- 'priority' => 'high',
- 'message' => "Consider adding index on {$table}.{$column}",
- 'sql' => "CREATE INDEX idx_{$column} ON {$table}({$column});"
- foreach ($this->slowQueries as $query) {
- if (in_array($table, $query['analysis']['tables_accessed'])) {
- $whereColumns = $this->extractWhereColumns($query['sql']);
- if (isset($whereColumns[$table])) {
- foreach ($whereColumns[$table] as $column) {
- if (!isset($columns[$column])) {
- $columns[$column] = 0;
- }
- $columns[$column]++;
- }
- foreach ($this->slowQueries as $query) {
- $time = $query['analysis']['execution_time_ms'];
- $totalTime += $time;
- $maxTime = max($maxTime, $time);
- foreach ($query['analysis']['tables_accessed'] as $table) {
- if (!isset($tableFrequency[$table])) {
- $tableFrequency[$table] = 0;
- }
- $tableFrequency[$table]++;
- }
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appAppsToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Apps->getConfigModules() as $m) {
- if ($CLICSHOPPING_Apps->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Apps->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Apps->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Apps_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Apps->getConfigModules() as $m) {
- if ($CLICSHOPPING_Apps->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Apps->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Apps->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- $query = preg_replace('/[^a-z0-9\s]/', ' ', $query);
- $words = preg_split('/\s+/', $query);
- // Filter words longer than 3 characters
- $keywords = [];
- foreach ($words as $word) {
- if (strlen($word) > 3) {
- $keywords[] = $word;
- }
- }
- $Qapi->execute();
- $suppliers_data = [];
- foreach ($Qapi->fetchAll() as $row) {
- $suppliers_data[] = [
- 'suppliers_id' => $row['suppliers_id'],
- 'languages_id' => $row['languages_id'],
- 'suppliers_name' => $row['suppliers_name'],
- 'date_added' => $row['date_added'],
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_BannerManager->getConfigModules() as $m) {
- if ($CLICSHOPPING_BannerManager->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_BannerManager->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_BannerManager->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appBannerManagerToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_BannerManager->getConfigModules() as $m) {
- if ($CLICSHOPPING_BannerManager->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_BannerManager->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_BannerManager->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_BannerManager_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- public function install()
- {
- $cut_length = \strlen('CLICSHOPPING_APP_SETTINGS_' . $this->code . '_');
- foreach ($this->getParameters() as $key) {
- $p = mb_strtolower(substr($key, $cut_length));
- $class = 'ClicShopping\Apps\Configuration\Settings\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
- $cfg = new $class($this->code);
- $cut = 'CLICSHOPPING_APP_SETTINGS_' . $this->code . '_';
- $cut_length = \strlen($cut);
- foreach ($this->getParameters() as $key) {
- $p = mb_strtolower(substr($key, $cut_length));
- $class = 'ClicShopping\Apps\Configuration\Settings\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
- $cfg = new $class($this->code);
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appAdministratorMenuToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_AdministratorMenu->getConfigModules() as $m) {
- if ($CLICSHOPPING_AdministratorMenu->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_AdministratorMenu->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_AdministratorMenu->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_AdministratorMenu_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_AdministratorMenu->getConfigModules() as $m) {
- if ($CLICSHOPPING_AdministratorMenu->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_AdministratorMenu->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_AdministratorMenu->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- $CLICSHOPPING_Featured = Registry::get('Featured');
- $page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $Qdelete = $CLICSHOPPING_Featured->db->prepare('delete
- from :table_products_featured
- where products_featured_id = :products_featured_id
- ');
- $Qdelete->bindInt(':products_featured_id', (int)$id);
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $QreturnOrders->execute();
- $return_orders_array = $QreturnOrders->fetchAll();
- $embedding_data = "\n" . $this->app->getDef('text_orders_products_return_history') . "\n";
- foreach ($return_orders_array as $item) {
- $embedding_data .= $this->app->getDef('text_orders_products_return_history_comment') . ' : ' . HTMLOverrideCommon::cleanHtmlForEmbedding($item['comment']) . "\n";
- $embedding_data .= $this->app->getDef('text_orders_products_return_history_date_added') . ' : ' . $item['date_added'] . "\n";
- }
- return $embedding_data;
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- // Display applied filters and detected intent
- if (!empty($intent['filters'])) {
- $response .= "**Applied Filters:** ";
- $filters = [];
- foreach ($intent['filters'] as $key => $value) {
- $filters[] = "$key: $value";
- }
- $response .= implode(", ", $filters) . "\n";
- }
- if (!empty($intent['type'])) {
- }
- if (!empty($intent['type'])) {
- $response .= "**Detected Intent:** " . $intent['type'] . "\n\n";
- }
- foreach ($results['products'] as $i => $p) {
- $response .= "**" . ($i + 1) . ". " . ($p['products_name'] ?? '') . "**\n";
- $response .= "💰 Price: " . ($p['products_price'] ?? 'N/A') . "€\n";
- $response .= "📦 Stock: " . ($p['products_quantity'] ?? 'N/A') . " units\n";
- $ean = $p['products_ean'] ?? '';
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_OrdersStatus->getConfigModules() as $m) {
- if ($CLICSHOPPING_OrdersStatus->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_OrdersStatus->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_OrdersStatus->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appOrdersStatusToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_OrdersStatus->getConfigModules() as $m) {
- if ($CLICSHOPPING_OrdersStatus->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_OrdersStatus->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_OrdersStatus->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Categories->getConfigModules() as $m) {
- if ($CLICSHOPPING_Categories->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Categories->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Categories->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Categories_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appCategoriesToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Categories->getConfigModules() as $m) {
- if ($CLICSHOPPING_Categories->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Categories->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Categories->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- $this->total += Tax::addTax($products_price, $products_tax) * $qty;
- $this->weight += ($qty * $products_weight);
- // attributes price
- if (isset($this->contents[$products_id]['attributes'])) {
- foreach ($this->contents[$products_id]['attributes'] as $option => $value) {
- $Qattribute = $this->db->get('products_attributes', [
- 'options_values_price',
- 'price_prefix'
- ], [
- 'products_id' => $prid,
- if (is_dir($source_folder)) {
- $files_get_output = $this->getSpecificFiles($source_folder, $file_get_output);
- $files_get_call = $this->getSpecificFiles($source_folder, $files_get_call);
- foreach ($files_get_output as $value) {
- if (!empty($value['name'])) {
- echo $CLICSHOPPING_Hooks->output($hook_call, $value['name'], null, 'display');
- }
- }
- if (!empty($value['name'])) {
- echo $CLICSHOPPING_Hooks->output($hook_call, $value['name'], null, 'display');
- }
- }
- foreach ($files_get_call as $value) {
- if (!empty($value['name'])) {
- $CLICSHOPPING_Hooks->call($hook_call, $value['name']);
- }
- }
- }
- $parent_category = $parent;
- while ($parent_category != $this->root_category_id) {
- foreach ($this->_data as $parent_parent => $parent_categories) {
- foreach ($parent_categories as $parent_category_id => $parent_category_info) {
- if ($parent_category_id == $parent_category) {
- $this->_data[$parent_parent][$parent_category_id]['count'] += $this->_data[$parent][$id]['count'];
- $parent_category = $parent_parent;
- */
- public function getData(string $id, string $key = null): array|bool
- {
- foreach ($this->_data as $parent => $categories) {
- foreach ($categories as $category_id => $info) {
- if ($id == $category_id) {
- $data = [
- 'id' => $id,
- 'name' => $info['name'],
- 'description' => $info['description'],
- * @return array|bool Returns an associative array of category data or a specific value if a key is provided. Returns false if the category is not found.
- */
- public function getData(string $id, string $key = null): array|bool
- {
- foreach ($this->_data as $parent => $categories) {
- foreach ($categories as $category_id => $info) {
- if ($id == $category_id) {
- $data = [
- 'id' => $id,
- 'name' => $info['name'],
- while ($Qtotals->fetch()) {
- $totals[$Qtotals->valueInt('categories_id')] = $Qtotals->valueInt('total');
- }
- foreach ($this->_data as $parent => $categories) {
- foreach ($categories as $id => $info) {
- if (isset($totals[$id]) && ($totals[$id] > 0)) {
- $this->_data[$parent][$id]['count'] = $totals[$id];
- $parent_category = $parent;
- * @param string $id The ID of the category to search for.
- * @return bool True if the category ID exists, false otherwise.
- */
- public function exists(string $id): bool
- {
- foreach ($this->_data as $parent => $categories) {
- foreach ($categories as $category_id => $info) {
- if ($id == $category_id) {
- return true;
- }
- }
- * @param array &$array Reference to an array where child IDs will be stored.
- * @return array An array containing the IDs of all child categories for the given category.
- */
- public function getChildren(string $category_id, array &$array = []): array
- {
- foreach ($this->_data as $parent => $categories) {
- if ($parent == $category_id) {
- foreach ($categories as $id => $info) {
- $array[] = $id;
- $this->getChildren($id, $array);
- }
- while ($Qtotals->fetch()) {
- $totals[$Qtotals->valueInt('categories_id')] = $Qtotals->valueInt('total');
- }
- foreach ($this->_data as $parent => $categories) {
- foreach ($categories as $id => $info) {
- if (isset($totals[$id]) && ($totals[$id] > 0)) {
- $this->_data[$parent][$id]['count'] = $totals[$id];
- $parent_category = $parent;
- }
- // Mark this category as visited
- $visited[] = $category_id;
- foreach ($this->_data as $parent => $categories) {
- foreach ($categories as $id => $info) {
- if ($id == $category_id) {
- if ($level < 1) {
- $breadcrumb = $id;
- } else {
- if (empty($result)) {
- $result = [];
- }
- if (isset($this->_data[$parent_id])) {
- foreach ($this->_data[$parent_id] as $category_id => $category) {
- if ($this->breadcrumb_usage === true) {
- $category_link = $this->buildBreadcrumb($category_id);
- } else {
- $category_link = $category_id;
- }
- // Mark this category as visited
- $visited[] = $category_id;
- foreach ($this->_data as $parent => $categories) {
- foreach ($categories as $id => $info) {
- if ($id == $category_id) {
- if ($level < 1) {
- $breadcrumb = $id;
- } else {
- $breadcrumb = $id . $this->breadcrumb_separator . $breadcrumb;
- * @return int|bool The number of products in the specified category, or `false` if the category ID is not found.
- */
- public function getNumberOfProducts($id): int|bool
- {
- foreach ($this->_data as $parent => $categories) {
- foreach ($categories as $category_id => $info) {
- if ($id == $category_id) {
- return $info['count'];
- }
- }
- }
- protected function _buildBranch(int|string $parent_id, int $level = 0): string
- {
- $result = ((($level === 0) && ($this->parent_group_apply_to_root === true)) || ($level > 0)) ? $this->parent_group_start_string : null;
- if (isset($this->_data[$parent_id])) {
- foreach ($this->_data[$parent_id] as $category_id => $category) {
- if ($this->breadcrumb_usage === true) {
- $category_link = $this->buildBreadcrumb($category_id);
- } else {
- $category_link = $category_id;
- }
- */
- public function getChildren(string $category_id, array &$array = []): array
- {
- foreach ($this->_data as $parent => $categories) {
- if ($parent == $category_id) {
- foreach ($categories as $id => $info) {
- $array[] = $id;
- $this->getChildren($id, $array);
- }
- }
- }
- * @param mixed $id The unique identifier for the category to search for.
- * @return int|bool The number of products in the specified category, or `false` if the category ID is not found.
- */
- public function getNumberOfProducts($id): int|bool
- {
- foreach ($this->_data as $parent => $categories) {
- foreach ($categories as $category_id => $info) {
- if ($id == $category_id) {
- return $info['count'];
- }
- }
- $this->_data[$parent][$id]['count'] = $totals[$id];
- $parent_category = $parent;
- while ($parent_category != $this->root_category_id) {
- foreach ($this->_data as $parent_parent => $parent_categories) {
- foreach ($parent_categories as $parent_category_id => $parent_category_info) {
- if ($parent_category_id == $parent_category) {
- $this->_data[$parent_parent][$parent_category_id]['count'] += $this->_data[$parent][$id]['count'];
- $parent_category = $parent_parent;
- * @return bool True if the category ID exists, false otherwise.
- */
- public function exists(string $id): bool
- {
- foreach ($this->_data as $parent => $categories) {
- foreach ($categories as $category_id => $info) {
- if ($id == $category_id) {
- return true;
- }
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Api_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Api->getConfigModules() as $m) {
- if ($CLICSHOPPING_Api->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Api->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Api->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appApiToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Api->getConfigModules() as $m) {
- if ($CLICSHOPPING_Api->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Api->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Api->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_PageManager->getConfigModules() as $m) {
- if ($CLICSHOPPING_PageManager->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_PageManager->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_PageManager->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_PageManager_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appPageManagerToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_PageManager->getConfigModules() as $m) {
- if ($CLICSHOPPING_PageManager->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_PageManager->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_PageManager->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- ?>
- // Other table search inside the DB
- try {
- $tables = DoctrineOrm::getEmbeddingTables();
- foreach ($tables as $tableName) {
- if (!in_array($tableName, $knownTables)) {
- try {
- $vectorStore = new MariaDBVectorStore($embeddingGenerator, $tableName);
- $embeddingTables[$tableName] = $vectorStore;
- } catch (\Exception $e) {
- }
- // USe similaritySearch signature
- $results = $vectorStore->similaritySearch($prompt, 2, 0.5, $filter);
- foreach ($results as $doc) {
- $entityInfo = '';
- if (isset($doc->metadata['entity_type']) && isset($doc->metadata['entity_id'])) {
- $entityInfo = " ({$doc->metadata['entity_type']} #{$doc->metadata['entity_id']})";
- }
- public function execute()
- {
- $page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $Qselect = $this->app->db->prepare('select ip_restriction
- from :table_ip_restriction
- where id = :id
- ');
- $Qselect->bindInt(':id', $id);
- $modules = $CLICSHOPPING_SEO->getConfigModules();
- $default_module = 'SE';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_SEO->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appEmailToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_EMail->getConfigModules() as $m) {
- if ($CLICSHOPPING_EMail->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_EMail->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_EMail->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- ?>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_EMail->getConfigModules() as $m) {
- if ($CLICSHOPPING_EMail->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_EMail->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_EMail->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_EMail_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $stepId = $step->getId();
- $dependsOn = $this->dependencies[$stepId]['depends_on'] ?? [];
- // Vérifier si toutes les dépendances sont complétées
- $allDependenciesComplete = true;
- foreach ($dependsOn as $depId) {
- $depStep = $this->getStepById($depId);
- if (!$depStep || $depStep->getStatus() !== 'completed') {
- $allDependenciesComplete = false;
- break;
- }
- $modules = $CLICSHOPPING_ActionsRecorder->getConfigModules();
- $default_module = 'AR';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_ActionsRecorder->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- if (\count($best_sellers) >= (defined('MODULE_BOXES_BEST_SELLERS_MIN_DISPLAY') ? (int)MODULE_BOXES_BEST_SELLERS_MIN_DISPLAY : 0) && \count($best_sellers) <= (defined('MODULE_BOXES_BEST_SELLERS_MAX_DISPLAY') ? (int)MODULE_BOXES_BEST_SELLERS_MAX_DISPLAY : 0)) {
- $position = 1;
- $bestsellers_list = '<ol class="olBestSellers">';
- foreach ($best_sellers as $b) {
- $products_name_url = $CLICSHOPPING_ProductsFunctionTemplate->getProductsUrlRewrited()->getProductNameUrl($b['products_id']);
- $bestsellers_list .= '<li class="BestSellerLi">' . HTML::link($products_name_url, null . ' <span itemprop="itemListElement">' . $b['products_name'] . '</span>') . '</li>';
- $position++;
- }
- $modules = $CLICSHOPPING_Featured->getConfigModules();
- $default_module = 'FE';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Featured->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- ];
- }
- $directories = [];
- foreach (glob(CLICSHOPPING::getConfig('dir_root', 'Shop') . 'sources/languages/*', GLOB_ONLYDIR) as $dir) {
- $code = basename($dir);
- $directories[] = ['id' => $code,
- 'text' => $code
- ];
- $directories[] = ['id' => $code,
- 'text' => $code
- ];
- }
- foreach (glob(CLICSHOPPING::getConfig('dir_root', 'ClicShoppingAdmin') . 'Core/languages/*', GLOB_ONLYDIR) as $dir) {
- $code = basename($dir);
- if (array_search($code, array_column($directories, 'id')) === false) {
- $directories[] = ['id' => $code,
- 'text' => $code
- $lInfo = new ObjectInfo($Qlanguages->toArray());
- $icons = [];
- foreach (glob(CLICSHOPPING::getConfig('dir_root', 'Shop') . 'sources/third_party/flag-icon-css/flags/4x3/*.svg') as $file) {
- $code = basename($file, '.svg');
- $icons[] = ['id' => $code,
- 'text' => $code
- ];
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Newsletter_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Newsletter->getConfigModules() as $m) {
- if ($CLICSHOPPING_Newsletter->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Newsletter->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Newsletter->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appNewsletterToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Newsletter->getConfigModules() as $m) {
- if ($CLICSHOPPING_Newsletter->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Newsletter->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Newsletter->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- ?>
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- if (!isset($this->scopes[$scopeName])) {
- return false;
- }
- // Delete all data associated with the scope
- foreach ($this->scopes[$scopeName] as $scopedKey) {
- unset($this->storage[$scopedKey]);
- unset($this->metadata[$scopedKey]);
- }
- unset($this->scopes[$scopeName]);
- return [];
- }
- // Remove the scope prefix for external use
- $keys = [];
- foreach ($this->scopes[$scope] as $scopedKey) {
- $keys[] = $this->unscopeKey($scopedKey);
- }
- return $keys;
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_ProductsLength->getConfigModules() as $m) {
- if ($CLICSHOPPING_ProductsLength->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_ProductsLength->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ProductsLength->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_ProductsLength_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appProductsLengthToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_ProductsLength->getConfigModules() as $m) {
- if ($CLICSHOPPING_ProductsLength->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_ProductsLength->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ProductsLength->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- $manufacturers_array[] = ['id' => '',
- 'text' => CLICSHOPPING::getDef('pull_down_default')
- ];
- }
- foreach ($manufacturers as $m) {
- $manufacturers_name = ((\strlen($m['name']) > (defined('MODULE_BOXES_MANUFACTURERS_MAX_DISPLAY_MANUFACTURER_NAME_LEN') ? (int)MODULE_BOXES_MANUFACTURERS_MAX_DISPLAY_MANUFACTURER_NAME_LEN : 0)) ? substr($m['name'], 0, defined('MAX_DISPLAY_MANFACTURER_NAME_LEN') ? MAX_DISPLAY_MANFACTURER_NAME_LEN : 0) . '..' : $m['name']);
- $manufacturers_array[] = ['id' => $m['id'],
- 'text' => $manufacturers_name
- ];
- // Display a list
- if (defined('MODULE_BOXES_MANUFACTURERS_MANUFACTURERS_LIST') && MODULE_BOXES_MANUFACTURERS_MANUFACTURERS_LIST == 'list') {
- if (\count($manufacturers) <= (defined('MODULE_BOXES_MANUFACTURERS_MAX_MANUFACTURERS_LIST') ? (int)MODULE_BOXES_MANUFACTURERS_MAX_MANUFACTURERS_LIST : 0)) {
- $manufacturers_list = '<ul style="list-style: none; margin: 0; padding: 0;">';
- foreach ($manufacturers as $m) {
- $manufacturer_url = $CLICSHOPPING_Manufacturers->getManufacturerUrlRewrited()->getManufacturerUrl((int)$m['id']);
- $manufacturers_name = ((\strlen($m['name']) > (defined('MODULE_BOXES_MANUFACTURERS_MAX_DISPLAY_MANUFACTURER_NAME_LEN') ? (int)MODULE_BOXES_MANUFACTURERS_MAX_DISPLAY_MANUFACTURER_NAME_LEN : 0)) ? substr($m['name'], 0, defined('MAX_DISPLAY_MANUFACTURER_NAME_LEN') ? MAX_DISPLAY_MANUFACTURER_NAME_LEN : 0) . '..' : $m['name']);
- if (isset($_GET['manufacturersId']) && ($_GET['manufacturersId'] == $m['id'])) {
- $manufacturers_name = '<strong>' . $manufacturers_name . '</strong>';
- $data .= '</div>';
- } else {
- // load the selected shipping module
- $radio_buttons = 0;
- foreach ($quotes as $n => $quote) {
- if (isset($quote['methods'])) {
- for ($j = 0, $n2 = \count($quote['methods']); $j < $n2; $j++) {
- $data .= '<tr>' . "\n";
- $data .= '<tr>';
- $data .= '<td>';
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- public function install()
- {
- $cut_length = \strlen('CLICSHOPPING_APP_ORDERS_' . $this->code . '_');
- foreach ($this->getParameters() as $key) {
- $p = mb_strtolower(substr($key, $cut_length));
- $class = 'ClicShopping\Apps\Orders\Orders\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
- $cfg = new $class($this->code);
- // Body
- $html .= '<tbody>';
- foreach ($results as $row) {
- $html .= '<tr>';
- foreach ($row as $value) {
- $html .= '<td>' . htmlspecialchars($value ?? '') . '</td>';
- }
- $html .= '</tr>';
- }
- $html .= '</tbody>';
- $html .= '<strong>⚠️ ' . $this->language->getDef('text_rag_ambiguous_multiple_interpretations') . '</strong><br>';
- $html .= $this->language->getDef('text_rag_ambiguous_explanation');
- $html .= '</div>';
- // Each interpretation
- foreach ($interpretations as $index => $interpretation) {
- $html .= $this->formatInterpretation($interpretation, $index + 1);
- }
- // Recommendation
- if (isset($results['recommendation'])) {
- ]);
- }
- $subQueries = [];
- foreach ($temporalPeriods as $index => $period) {
- // Build sub-query for this temporal period
- $subQueryText = $this->buildTemporalSubQuery($baseMetric, $timeRange, $period);
- $subQuery = [
- 'query' => $subQueryText,
- $Qcheck->bindInt(':language_id', $language_id);
- $Qcheck->execute();
- $check_array = $Qcheck->fetchAll();
- foreach ($check_array as $item) {
- $Qcheck = $this->app->db->prepare('select id,
- entity_id
- from :table_reviews_embedding
- where entity_id = :entity_id
- ');
- $Qcheck->bindInt(':language_id', $language_id);
- $Qcheck->execute();
- $check_array = $Qcheck->fetchAll();
- foreach ($check_array as $item) {
- $Qcheck = $this->app->db->prepare('select id,
- entity_id
- from :table_manufacturers_embedding
- where entity_id = :entity_id
- ');
- $Qcheck->bindInt(':language_id', $language_id);
- $Qcheck->execute();
- $check_array = $Qcheck->fetchAll();
- foreach ($check_array as $item) {
- $Qcheck = $this->app->db->prepare('select id,
- entity_id
- from :table_categories_embedding
- where entity_id = :entity_id
- ');
- $Qcheck->execute();
- $check_array = $Qcheck->fetchAll();
- foreach ($check_array as $item) {
- $Qcheck = $this->app->db->prepare('select id,
- entity_id
- from :table_suppliers_embedding
- where entity_id = :entity_id
- ');
- */
- public function updateAllEmbeddings(): void
- {
- $language_array = $this->lang->getLanguages();
- foreach ($language_array as $value) {
- $this->updateAllEmbeddingCategories($value['id']);
- $this->updateAllEmbeddingManufacturers($value['id']);
- $this->updateAllEmbeddingProducts($value['id']);
- $this->updateAllEmbeddingPageManager($value['id']);
- $this->updateAllEmbeddingReviews($value['id']);
- $QcheckProducts->bindInt(':language_id', $language_id);
- $QcheckProducts->execute();
- $check_array = $QcheckProducts->fetchAll();
- foreach ($check_array as $item) {
- $Qcheck = $this->app->db->prepare('select id,
- entity_id
- from :table_products_embedding
- where entity_id = :entity_id
- ');
- $Qcheck->bindInt(':language_id', $language_id);
- $Qcheck->execute();
- $check_array = $Qcheck->fetchAll();
- foreach ($check_array as $item) {
- $Qcheck = $this->app->db->prepare('select id,
- entity_id
- from :table_pages_manager_embedding
- where entity_id = :entity_id
- ');
- * @return void
- */
- public function execute()
- {
- if (isset($_POST['configuration'])) {
- foreach ($_POST['configuration'] as $value) {
- $configuration_value = $value;
- }
- } else {
- $configuration_value = $_POST['configuration_value'] ?? '';
- }
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appZonesToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Zones->getConfigModules() as $m) {
- if ($CLICSHOPPING_Zones->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Zones->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Zones->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Zones->getConfigModules() as $m) {
- if ($CLICSHOPPING_Zones->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Zones->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Zones->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Zones_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $modules = $CLICSHOPPING_DataBaseTables->getConfigModules();
- $default_module = 'DT';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_DataBaseTables->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- <div class="card text-center" style="background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); color: white;">
- <div class="card-body">
- <?php
- $mostUsedMode = '';
- $maxCount = 0;
- foreach ($reasoningStats['by_mode'] as $mode => $modeStats) {
- if ($modeStats['count'] > $maxCount) {
- $maxCount = $modeStats['count'];
- $mostUsedMode = $mode;
- }
- }
- <th><?php echo $CLICSHOPPING_ChatGpt->getDef('perf_agent_success_rate'); ?></th>
- <th><?php echo $CLICSHOPPING_ChatGpt->getDef('perf_agent_avg_confidence'); ?></th>
- </tr>
- </thead>
- <tbody>
- <?php foreach ($advancedStats['agents']['agents'] as $agent): ?>
- <tr>
- <td><strong><?php echo htmlspecialchars($agent['name']); ?></strong></td>
- <td><?php echo $agent['usage_count']; ?></td>
- <td>
- <div class="progress" style="width: 60px; height: 20px;">
- <th><?php echo $CLICSHOPPING_ChatGpt->getDef('trend_change'); ?></th>
- <th><?php echo $CLICSHOPPING_ChatGpt->getDef('trend_current_value'); ?></th>
- </tr>
- </thead>
- <tbody>
- <?php foreach ($healthReport['trends'] as $metric => $trend): ?>
- <tr>
- <td><?php echo ucfirst(str_replace('_', ' ', $metric)); ?></td>
- <td class="trend-<?php echo $trend['trend'];?>">
- <?php echo $trend['trend'] === 'increasing' ? '↗' : ($trend['trend'] === 'decreasing' ? '↘' : '→'); ?>
- <?php echo ucfirst($trend['trend']); ?>
- <th><?php echo $CLICSHOPPING_ChatGpt->getDef('component_avg_time'); ?></th>
- <th><?php echo $CLICSHOPPING_ChatGpt->getDef('component_status_label'); ?></th>
- </tr>
- </thead>
- <tbody>
- <?php foreach ($healthReport['component_health'] ?? [] as $comp): ?>
- <tr>
- <td><strong><?php echo htmlspecialchars($comp['name']); ?></strong></td>
- <td><?php echo $systemReport['components'][$comp['name']]['total_calls'] ?? 'N/A' ?></td>
- <td>
- <?php
- <?php if (!empty($healthReport['overall_health']['issues'])): ?>
- <div style="margin-top: 15px;">
- <h6><?php echo $CLICSHOPPING_ChatGpt->getDef('status_problems_detected'); ?>:</h6>
- <ul style="margin: 0; padding-left: 20px;">
- <?php foreach ($healthReport['overall_health']['issues'] as $issue): ?>
- <li><?php echo htmlspecialchars($issue); ?></li>
- <?php endforeach; ?>
- </ul>
- </div>
- <?php endif; ?>
- 'chain_of_thought' => '🔗',
- 'tree_of_thought' => '🌳',
- 'self_consistency' => '🎯',
- ];
- foreach ($reasoningStats['by_mode'] as $mode => $modeStats):
- if ($modeStats['count'] == 0) continue;
- $successRate = $modeStats['count'] > 0
- ? round(($modeStats['successful'] / $modeStats['count']) * 100, 1)
- : 0;
- <th class="text-end"><?php echo $CLICSHOPPING_ChatGpt->getDef('success_rate'); ?></th>
- <th class="text-end"><?php echo $CLICSHOPPING_ChatGpt->getDef('avg_time'); ?></th>
- </tr>
- </thead>
- <tbody>
- <?php foreach ($sourceStats['sources'] as $source => $data): ?>
- <tr>
- <td>
- <?php
- $sourceIcons = [
- 'documents' => '📚',
- if (!empty($healthReport['recommendations'])) {
- ?>
- <div class="recommendations mt-4">
- <h6><?php echo $CLICSHOPPING_ChatGpt->getDef('tab7_recommendations'); ?></h6>
- <?php
- foreach ($healthReport['recommendations'] as $rec){
- ?>
- <div class="recommendation-item">
- <strong>[<?php echo strtoupper($rec['priority']); ?>]</strong>
- <?php echo htmlspecialchars($rec['message']); ?>
- </div>
- <th class="text-center"><?php echo $CLICSHOPPING_ChatGpt->getDef('token_average'); ?></th>
- <th class="text-center"><?php echo $CLICSHOPPING_ChatGpt->getDef('token_percent_total'); ?></th>
- </tr>
- </thead>
- <tbody>
- <?php foreach ($tokenDashboardStats['top_request_types'] as $type): ?>
- <tr>
- <td>
- <strong><?php echo htmlspecialchars($type['request_type']); ?></strong>
- </td>
- <td class="text-center"><?php echo $type['count'] ?></td>
- <div class="card-header">
- <h6><?php echo $CLICSHOPPING_ChatGpt->getDef('language_statistics'); ?></h6>
- </div>
- <div class="card-body">
- <div class="row">
- <?php foreach ($secMonitoring['languages'] as $lang): ?>
- <div class="col-md-3 mb-2">
- <div class="border rounded p-2 text-center">
- <div class="fs-5 fw-bold"><?php echo strtoupper($lang['language']); ?></div>
- <small class="text-muted"><?php echo $lang['count']; ?> <?php echo $CLICSHOPPING_ChatGpt->getDef('events'); ?></small>
- </div>
- <div class="alert alert-info mb-3">
- <i class="bi bi-info-circle"></i>
- <strong><?php echo count($activeAlerts); ?></strong> <?php echo $CLICSHOPPING_ChatGpt->getDef('alert_active_count'); ?>
- </div>
- <?php foreach ($activeAlerts as $alertType => $alert): ?>
- <div class="alert-item <?php echo $alert['severity'] ?? 'medium';?> mb-3">
- <div style="flex: 1;">
- <div class="d-flex align-items-center mb-2">
- <span class="badge bg-<?php echo $alert['severity'] === 'critical' ? 'danger' : ($alert['severity'] === 'high' ? 'warning' : 'info'); ?> me-2">
- <?php echo strtoupper($alert['severity'] ?? 'MEDIUM'); ?>
- </div>
- </div>
- <div style="padding: 20px;">
- <div class="component-health">
- <?php foreach ($healthReport['component_health'] ?? [] as $comp) {
- ?>
- <div class="component-card <?php echo $comp['status'];;?>">
- <h6><?php echo htmlspecialchars($comp['name']); ?></h6>
- <p><strong><?php echo $CLICSHOPPING_ChatGpt->getDef('component_status_label'); ?>:</strong> <span
- class="badge bg-<?php echo $comp['status'] === 'healthy' ? 'success' : ($comp['status'] === 'degraded' ? 'warning' : 'danger');;?>">
- if (!empty($comp['issues'])) {
- ?>
- <p><strong><?php echo $CLICSHOPPING_ChatGpt->getDef('component_problems'); ?>:</strong></p>
- <ul style="margin: 0; padding-left: 20px; font-size: 0.9rem;">
- <?php
- foreach ($comp['issues'] as $issue) {
- ?>
- <li><?php echo htmlspecialchars($issue); ?></li>
- <?php } ?>
- </ul>
- <?php
- error_log('Dashboard: Failed to load ReasoningAgent stats - ' . $e->getMessage());
- }
- if (!empty($reasoningStats) && !empty($reasoningStats['by_mode'])):
- $hasData = false;
- foreach ($reasoningStats['by_mode'] as $modeStats) {
- if ($modeStats['count'] > 0) {
- $hasData = true;
- break;
- }
- }
- <div class="card-header">
- <h6><?php echo $CLICSHOPPING_ChatGpt->getDef('attack_type_distribution'); ?></h6>
- </div>
- <div class="card-body">
- <?php if (!empty($secMonitoring['threat_types'])): ?>
- <?php foreach ($secMonitoring['threat_types'] as $threat): ?>
- <div class="mb-2">
- <div class="d-flex justify-content-between align-items-center">
- <span><?php echo ucfirst(str_replace('_', ' ', $threat['type'])); ?></span>
- <span class="badge bg-secondary"><?php echo $threat['count']; ?></span>
- </div>
- $Qcurrencies->execute();
- $currencies = $Qcurrencies->fetchAll();
- foreach ($currencies as $c) {
- /**
- *
- */
- $this->currencies[$c['code']] = [
- 'id' => (int)$c['id'],
- // Update items if provided
- if (isset($input['items'])) {
- $lineItems = [];
- $itemsBaseAmount = 0;
- foreach ($input['items'] as $item) {
- $productData = $this->getProductData($item['id']);
- if (!$productData) {
- continue;
- }
- // Build line items according to OpenAI spec
- $lineItems = [];
- $itemsBaseAmount = 0;
- foreach ($items as $item) {
- $productData = $this->getProductData($item['id']);
- if (!$productData) {
- continue; // Skip invalid products
- }
- $Qapi->execute();
- $categories_data = [];
- foreach ($Qapi->fetchAll() as $row) {
- $categories_data[] = [
- 'categories_id' => $row['categories_id'],
- 'parent_id' => $row['parent_id'],
- 'language_id' => $row['language_id'],
- 'categories_name' => $row['categories_name'],
- $Qapi->execute();
- $products = [];
- foreach ($Qapi->fetchAll() as $row) {
- $product_id = $row['products_id'];
- $language_code = $CLICSHOPPING_Language->getLanguageCodeById($row['language_id']);
- if (!isset($products[$product_id])) {
- } elseif (defined('USE_MEMCACHED') && USE_MEMCACHED == 'True' && isset($memcached)) {
- $memcached->set($cache_key, $config_data, $cache_ttl);
- }
- } else {
- // Utiliser les données du cache Memcached
- foreach ($cached_config as $key => $value) {
- define($key, $value);
- }
- }
- }
- $CLICSHOPPING_Hooks = Registry::get('Hooks');
- $page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $reviews_id = HTML::sanitize($id);
- $CLICSHOPPING_Reviews->db->delete('reviews', ['reviews_id' => (int)$reviews_id]);
- $CLICSHOPPING_Reviews->db->delete('reviews_description', ['reviews_id' => (int)$reviews_id]);
- $modules = $CLICSHOPPING_Upgrade->getConfigModules();
- $default_module = 'UP';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Upgrade->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Antispam->getConfigModules() as $m) {
- if ($CLICSHOPPING_Antispam->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Antispam->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Antispam->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appAntispamToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Antispam->getConfigModules() as $m) {
- if ($CLICSHOPPING_Antispam->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Antispam->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Antispam->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- ?>
- </div>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Antispam_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Settings_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Settings->getConfigModules() as $m) {
- if ($CLICSHOPPING_Settings->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Settings->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Settings->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appSettingsToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Settings->getConfigModules() as $m) {
- if ($CLICSHOPPING_Settings->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Settings->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Settings->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_ProductsQuantityUnit_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appProductsQuantityUnitToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_ProductsQuantityUnit->getConfigModules() as $m) {
- if ($CLICSHOPPING_ProductsQuantityUnit->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_ProductsQuantityUnit->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ProductsQuantityUnit->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_ProductsQuantityUnit->getConfigModules() as $m) {
- if ($CLICSHOPPING_ProductsQuantityUnit->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_ProductsQuantityUnit->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ProductsQuantityUnit->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- // Format results for display
- $items = $searchResult['items'] ?? [];
- $formattedResults = [];
- foreach ($items as $item) {
- $formattedResults[] = [
- 'title' => $item['title'] ?? '',
- 'snippet' => $item['snippet'] ?? '',
- 'link' => $item['link'] ?? '',
- 'source' => $item['source'] ?? '',
- $temp[$stepId] = true;
- // Visiter les dépendances d'abord
- $dependsOn = $dependencies[$stepId]['depends_on'] ?? [];
- foreach ($dependsOn as $depId) {
- $depStep = $this->findStepById($allSteps, $depId);
- if ($depStep) {
- $this->topologicalSort($depStep, $allSteps, $dependencies, $visited, $temp, $sorted);
- }
- }
- // 2. Déléguer la création du plan au SubTaskPlanner
- $steps = $selectedPlanner->createPlan($intent, $query);
- // 🔧 TASK 4.3.4.3: Log the steps created
- error_log("\nSteps created by SubTaskPlanner:");
- foreach ($steps as $step) {
- error_log(" Step: " . $step->getId());
- error_log(" Type: " . $step->getType());
- error_log(" Description: " . $step->getDescription());
- $subQuery = $step->getMeta('sub_query', null);
- error_log(" sub_query metadata: " . ($subQuery ?? 'NULL'));
- ];
- }
- // Construire le graphe inverse (required_by)
- foreach ($dependencies as $stepId => $data) {
- foreach ($data['depends_on'] as $dependencyId) {
- if (isset($dependencies[$dependencyId])) {
- $dependencies[$dependencyId]['required_by'][] = $stepId;
- }
- }
- }
- $output .= $language->getDef('price_comparison_competitors_analyzed') . " {$comparison['total_competitors_found']}\n";
- $output .= $language->getDef('price_comparison_average_price') . " \$" . $comparison['comparison']['average_competitor_price'] . "\n\n";
- // Display competitor prices
- $output .= $language->getDef('price_comparison_competitor_prices') . "\n";
- foreach ($comparison['competitor_prices'] as $i => $competitor) {
- $output .= " " . ($i + 1) . ". {$competitor['source']}: \${$competitor['price']}\n";
- }
- $output .= "\n";
- // Display cheapest and most expensive
- // Generate rows with temporal labels
- $output .= '<tbody>';
- foreach ($rows as $row) {
- $output .= '<tr>';
- foreach ($row as $column => $value) {
- $formattedValue = $this->formatTemporalCellValue($column, $value, $temporalPeriod, $languageCode);
- $output .= '<td>' . $formattedValue . '</td>';
- }
- $output .= '</tr>';
- }
- public function install()
- {
- $cut_length = \strlen('CLICSHOPPING_APP_PRODUCTS_ATTRIBUTES_' . $this->code . '_');
- foreach ($this->getParameters() as $key) {
- $p = mb_strtolower(substr($key, $cut_length));
- $class = 'ClicShopping\Apps\Catalog\ProductsAttributes\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
- $cfg = new $class($this->code);
- $cut = 'CLICSHOPPING_APP_PRODUCTS_ATTRIBUTES_' . $this->code . '_';
- $cut_length = \strlen($cut);
- foreach ($this->getParameters() as $key) {
- $p = mb_strtolower(substr($key, $cut_length));
- $class = 'ClicShopping\Apps\Catalog\ProductsAttributes\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
- $cfg = new $class($this->code);
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- }
- // Check 2: Multiple possible entities without clear context
- if (isset($intent['metadata']['entities']) && count($intent['metadata']['entities']) > 1) {
- $hasContext = false;
- foreach ($intent['metadata']['entities'] as $entity) {
- if (isset($entity['from_context']) && $entity['from_context'] === true) {
- $hasContext = true;
- break;
- }
- }
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appTaxRatesToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_TaxRates->getConfigModules() as $m) {
- if ($CLICSHOPPING_TaxRates->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_TaxRates->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_TaxRates->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_TaxRates_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_TaxRates->getConfigModules() as $m) {
- if ($CLICSHOPPING_TaxRates->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_TaxRates->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_TaxRates->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Suppliers->getConfigModules() as $m) {
- if ($CLICSHOPPING_Suppliers->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Suppliers->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Suppliers->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Suppliers_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appSuppliersToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Suppliers->getConfigModules() as $m) {
- if ($CLICSHOPPING_Suppliers->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Suppliers->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Suppliers->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- $parts[] = "Error Type: " . $errorAnalysis['type'];
- $parts[] = "Error Message: " . ($errorContext['error_message'] ?? '');
- if (!empty($errorAnalysis['details'])) {
- foreach ($errorAnalysis['details'] as $key => $value) {
- $parts[] = ucfirst($key) . ": " . $value;
- }
- }
- $parts[] = "Query Fragment: " . substr($errorContext['failed_query'] ?? '', 0, 200);
- $CLICSHOPPING_Hooks = Registry::get('Hooks');
- $page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $CLICSHOPPING_BannerManager->db->delete('banners', ['banners_id' => (int)$id]);
- $CLICSHOPPING_BannerManager->db->delete('banners_history', ['banners_id' => (int)$id]);
- $CLICSHOPPING_Hooks->call('BannerManager', 'RemoveBanner');
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Products->getConfigModules() as $m) {
- if ($CLICSHOPPING_Products->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Products->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Products->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Products_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appProductsToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Products->getConfigModules() as $m) {
- if ($CLICSHOPPING_Products->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Products->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Products->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appSpecialsToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Specials->getConfigModules() as $m) {
- if ($CLICSHOPPING_Specials->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Specials->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Specials->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Specials_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Specials->getConfigModules() as $m) {
- if ($CLICSHOPPING_Specials->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Specials->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Specials->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- ');
- $Qrestriction->execute();
- $restriction = $Qrestriction->fetchAll();
- foreach ($restriction as $value) {
- if (trim($value['0']) === static::getRemoteAddress()) {
- $allowed_ip = true;
- break;
- }
- }
- ');
- $Qrestriction->execute();
- $restriction = $Qrestriction->fetchAll();
- foreach ($restriction as $value) {
- if (trim($value['0']) === static::getRemoteAddress()) {
- $allowed_ip = true;
- break;
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_ServiceAPP_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_ServiceAPP->getConfigModules() as $m) {
- if ($CLICSHOPPING_ServiceAPP->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_ServiceAPP->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ServiceAPP->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appServiceAPPToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_ServiceAPP->getConfigModules() as $m) {
- if ($CLICSHOPPING_ServiceAPP->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_ServiceAPP->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ServiceAPP->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- ');
- $Qcategories->bindInt(':language_id', (int)$this->lang->getId());
- $Qcategories->execute();
- $categories_array = $Qcategories->fetchAll();
- foreach ($categories_array as $cat) {
- $catLower = strtolower($cat['categories_name'] ?? '');
- if (strpos($translated, $catLower) !== false) {
- $intent['entities']['category'] = $catLower;
- $matchWeight += 0.8;
- $totalWeight += 1;
- }
- if (!empty($intent['type'])) {
- $response .= "**Detected Intent:** " . $intent['type'] . "\n\n";
- }
- foreach ($results['products'] as $i => $p) {
- $response .= "**" . ($i + 1) . ". " . ($p['products_name'] ?? '') . "**\n";
- $response .= "💰 Price: " . ($p['products_price'] ?? 'N/A') . "€\n";
- $response .= "📦 Stock: " . ($p['products_quantity'] ?? 'N/A') . " units\n";
- $ean = $p['products_ean'] ?? '';
- // Display applied filters and detected intent
- if (!empty($intent['filters'])) {
- $response .= "**Applied Filters:** ";
- $filters = [];
- foreach ($intent['filters'] as $key => $value) {
- $filters[] = "$key: $value";
- }
- $response .= implode(", ", $filters) . "\n";
- }
- if (!empty($intent['type'])) {
- $stopwords = [
- 'the', 'and', 'for', 'with', 'your', 'our', 'you', 'are', 'not', 'can', 'how', 'what', 'why', 'which', 'have', 'has', 'had', 'from', 'this', 'that', 'these', 'those', 'a', 'an', 'to', 'of', 'in', 'on', 'by', 'at', 'it', 'is', 'as', 'or', 'be', 'do', 'does', 'did', 'me', 'my', 'we', 'us', 'they', 'them', 'their', 'there', 'here', 'about', 'please', 'show', 'find', 'search', 'look', 'list', 'between', 'under', 'over', 'more', 'than', 'less', 'cheaper', 'above', 'below'
- ];
- $tokens = preg_split('/[^a-z0-9]+/i', $translated, -1, PREG_SPLIT_NO_EMPTY);
- foreach ($tokens as $tok) {
- $tokLower = strtolower($tok);
- if (strlen($tokLower) > 2 && !in_array($tokLower, $stopwords, true)) {
- $keywords[] = $tokLower;
- }
- }
- public function execute()
- {
- $CLICSHOPPING_Archive = Registry::get('Archive');
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $Qupdate = $CLICSHOPPING_Archive->db->prepare('update :table_products
- set products_archive = :products_archive
- where products_id = :products_id
- ');
- $Qupdate->bindInt(':products_archive', '0');
- // Module de livraison autorise
- if (isset($_POST['shipping_unallowed'])) {
- $group_shipping_unallowed = '';
- foreach ($_POST['shipping_unallowed'] as $key => $val) {
- if (isset($val)) {
- $group_shipping_unallowed .= $val . ',';
- }
- }
- // Module de paiement autorise
- if (isset($_POST['payment_unallowed'])) {
- $group_payment_unallowed = '';
- foreach ($_POST['payment_unallowed'] as $key => $val) {
- if (isset($val)) {
- $group_payment_unallowed .= $val . ',';
- }
- }
- <td class="text-end"><?php echo $CLICSHOPPING_Mcp->getDef('text_action'); ?></td>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach ($result_array as $value) {
- ?>
- <tr>
- <td><?php echo $value['session_id']; ?></td>
- <td><?php echo $value['ip']; ?></td>
- <td><?php echo $value['date_added']; ?></td>
- <td class="text-end"><?php echo $CLICSHOPPING_Mcp->getDef('text_action'); ?></td>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach ($result as $value) {
- ?>
- <tr>
- <td><?php echo $value['ip']; ?></td>
- <td><?php echo $value['comment']; ?></td>
- <td class="text-end">
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Modules_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appModulesToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Modules->getConfigModules() as $m) {
- if ($CLICSHOPPING_Modules->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Modules->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Modules->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Modules->getConfigModules() as $m) {
- if ($CLICSHOPPING_Modules->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Modules->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Modules->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- if (!isset($_POST['DB_SKIP_IMPORT'])) {
- if (\is_array($modules)) {
- foreach ($modules as $m) {
- $m_installed = [];
- foreach ($m['modules'] as $module) {
- $file = $module['file'];
- $class = $module['class'] ?? basename($file, '.php');
- $code = $module['code'] ?? $file;
- include_once($m['dir'] . $file);
- throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
- }
- }
- }
- foreach (glob(Cache::getPath() . '*.cache') as $c) {
- unlink($c);
- }
- $dir_fs_document_root = $_POST['DIR_FS_DOCUMENT_ROOT'];
- if ((substr($dir_fs_document_root, -1) != '\\') && (substr($dir_fs_document_root, -1) != '/')) {
- $mo->install();
- $m_installed[] = $code;
- if (isset($module['params'])) {
- foreach ($module['params'] as $key => $value) {
- $CLICSHOPPING_Db->save('configuration', ['configuration_value' => $value], ['configuration_key' => $key]);
- }
- }
- }
- );
- $stmt->execute();
- $allTables = $stmt->fetchAll(\PDO::FETCH_COLUMN);
- $similar = [];
- foreach ($allTables as $table) {
- similar_text(strtolower($tableName), strtolower($table), $percent);
- if ($percent > 60) {
- $similar[] = $table;
- }
- }
- $explainSql = "EXPLAIN " . $sql;
- $stmt = $this->db->prepare($explainSql);
- $stmt->execute();
- $explainResult = $stmt->fetchAll(\PDO::FETCH_ASSOC);
- foreach ($explainResult as $row) {
- // 1. Vérifier le type de scan (more lenient for analytics)
- $type = $row['type'] ?? '';
- if ($type === 'ALL') {
- $warnings[] = "Full table scan detected on table: " . ($row['table'] ?? 'unknown');
- WHERE table_schema = DATABASE() AND table_name = ?"
- );
- $stmt->execute([$tableName]);
- $columns = $stmt->fetchAll(\PDO::FETCH_COLUMN);
- foreach ($columns as $col) {
- similar_text(strtolower($column), strtolower($col), $percent);
- if ($percent > 60) {
- $similar[] = "{$tableName}.{$col}";
- }
- }
- class="text-center"><?php echo $CLICSHOPPING_SecDirPermissions->getDef('table_heading_recommended'); ?></th>
- </tr>
- <thead>
- <tbody>
- <?php
- foreach (getOpenDir(CLICSHOPPING::getConfig('dir_root', 'Shop')) as $file) {
- if ($file['is_dir']) {
- ?>
- <tr>
- <th
- scope="row"><?php echo substr($file['name'], \strlen(CLICSHOPPING::getConfig('dir_root', 'Shop'))); ?></th>
- $likeValidation = $this->queryProcessor->validateLikePatterns($resolvedQuery);
- if (!empty($likeValidation['warnings'])) {
- $this->debugLog("LIKE pattern warnings: " . count($likeValidation['warnings']), "VALIDATION");
- // Log warnings using security logger
- foreach ($likeValidation['warnings'] as $warning) {
- $this->securityLogger->logSecurityEvent(
- "LIKE pattern validation warning: " . $warning,
- 'warning',
- [
- 'sql_snippet' => substr($resolvedQuery, 0, 200),
- public function install()
- {
- $cut_length = \strlen('CLICSHOPPING_APP_MCP_' . $this->code . '_');
- foreach ($this->getParameters() as $key) {
- $p = mb_strtolower(substr($key, $cut_length));
- $class = 'ClicShopping\Apps\Tools\MCP\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
- $cfg = new $class($this->code);
- $cut = 'CLICSHOPPING_APP_MCP_' . $this->code . '_';
- $cut_length = \strlen($cut);
- foreach ($this->getParameters() as $key) {
- $p = mb_strtolower(substr($key, $cut_length));
- $class = 'ClicShopping\Apps\Tools\MCP\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
- $cfg = new $class($this->code);
- }
- }
- // Priority 3: Check plan step results (if plan provided)
- if ($plan !== null && is_object($plan) && method_exists($plan, 'getSteps')) {
- foreach ($plan->getSteps() as $step) {
- $stepResult = $plan->getStepResult($step->getId());
- if ($stepResult && isset($stepResult['_step_entity_metadata']['entity_type'])) {
- return $stepResult['_step_entity_metadata']['entity_type'];
- }
- {
- if (!is_object($plan) || !method_exists($plan, 'getSteps')) {
- return null;
- }
- foreach ($plan->getSteps() as $step) {
- $stepResult = $plan->getStepResult($step->getId());
- if (!$stepResult) {
- continue;
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_SecurityCheck->getConfigModules() as $m) {
- if ($CLICSHOPPING_SecurityCheck->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_SecurityCheck->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_SecurityCheck->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appSecurityCheckToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_SecurityCheck->getConfigModules() as $m) {
- if ($CLICSHOPPING_SecurityCheck->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_SecurityCheck->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_SecurityCheck->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_SecurityCheck_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $modules = $CLICSHOPPING_SubTotal->getConfigModules();
- $default_module = 'ST';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_SubTotal->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $modules = $CLICSHOPPING_ServiceAPP->getConfigModules();
- $default_module = 'SV';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_ServiceAPP->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $CLICSHOPPING_Langues = Registry::get('Langues');
- $icons = [];
- foreach (glob(CLICSHOPPING::getConfig('dir_root', 'Shop') . 'sources/third_party/flag-icon-css/flags/4x3/*.svg') as $file) {
- $code = basename($file, '.svg');
- $icons[] = [
- 'id' => $code,
- 'text' => $code
- ];
- }
- $directories = [];
- foreach (glob(CLICSHOPPING::getConfig('dir_root', 'Shop') . 'sources/languages/*', GLOB_ONLYDIR) as $dir) {
- $code = basename($dir);
- $directories[] = ['id' => $code,
- 'text' => $code
- ];
- $directories[] = ['id' => $code,
- 'text' => $code
- ];
- }
- foreach (glob(CLICSHOPPING::getConfig('dir_root', 'ClicShoppingAdmin') . 'Core/languages/*', GLOB_ONLYDIR) as $dir) {
- $code = basename($dir);
- if (array_search($code, array_column($directories, 'id')) === false) {
- $directories[] = ['id' => $code,
- 'text' => $code
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_WhosOnline_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appWhosOnlineToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_WhosOnline->getConfigModules() as $m) {
- if ($CLICSHOPPING_WhosOnline->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_WhosOnline->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_WhosOnline->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_WhosOnline->getConfigModules() as $m) {
- if ($CLICSHOPPING_WhosOnline->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_WhosOnline->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_WhosOnline->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- $modules = $CLICSHOPPING_TotalShipping->getConfigModules();
- $default_module = 'SH';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_TotalShipping->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_EditLogError_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_EditLogError->getConfigModules() as $m) {
- if ($CLICSHOPPING_EditLogError->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_EditLogError->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_EditLogError->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appEditLogErrorToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_EditLogError->getConfigModules() as $m) {
- if ($CLICSHOPPING_EditLogError->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_EditLogError->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_EditLogError->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_StatsProductsNotification_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appStatsProductsNotificationToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_StatsProductsNotification->getConfigModules() as $m) {
- if ($CLICSHOPPING_StatsProductsNotification->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_StatsProductsNotification->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_StatsProductsNotification->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_StatsProductsNotification->getConfigModules() as $m) {
- if ($CLICSHOPPING_StatsProductsNotification->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_StatsProductsNotification->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_StatsProductsNotification->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- $modules = $CLICSHOPPING_Settings->getConfigModules();
- $default_module = 'ST';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Settings->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appMCPToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_MCP->getConfigModules() as $m) {
- if ($CLICSHOPPING_MCP->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_MCP->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_MCP->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_MCP_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_MCP->getConfigModules() as $m) {
- if ($CLICSHOPPING_MCP->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_MCP->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_MCP->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- }
- }
- $score += min($relevantCount * 0.1, 0.3);
- $domains = [];
- foreach ($processedResults['items'] ?? [] as $item) {
- $domains[] = $item['source'];
- }
- $uniqueDomains = count(array_unique($domains));
- if ($uniqueDomains >= 3) {
- $score += 0.1;
- if (!empty($processedResults['featured_snippet'])) {
- $score += 0.2;
- }
- $relevantCount = 0;
- foreach ($processedResults['items'] ?? [] as $item) {
- if (($item['relevance_score'] ?? 0) > 0.7) {
- $relevantCount++;
- }
- }
- $score += min($relevantCount * 0.1, 0.3);
- private function extractRelatedQuestions(array $rawResults): array
- {
- $questions = [];
- if (isset($rawResults['related_questions'])) {
- foreach ($rawResults['related_questions'] as $rq) {
- $questions[] = [
- 'question' => $this->cleanText($rq['question'] ?? ''),
- 'answer' => $this->cleanText($rq['snippet'] ?? ''),
- 'source' => $rq['link'] ?? '',
- ];
- ],
- ];
- $organicResults = $rawResults['organic_results'] ?? [];
- foreach ($organicResults as $result) {
- $processed['items'][] = $this->formatItem($result, $query);
- }
- $featuredSnippet = $this->extractFeaturedSnippet($rawResults);
- if ($featuredSnippet) {
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Total_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $modules = $CLICSHOPPING_Apps->getConfigModules();
- $default_module = 'AP';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Apps->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $cut = 'CLICSHOPPING_APP_TABLE_' . $this->code . '_';
- $cut_length = \strlen($cut);
- foreach ($this->getParameters() as $key) {
- $p = mb_strtolower(substr($key, $cut_length));
- $class = 'ClicShopping\Apps\Shipping\Table\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
- $cfg = new $class($this->code);
- public function install()
- {
- $cut_length = \strlen('CLICSHOPPING_APP_TABLE_' . $this->code . '_');
- foreach ($this->getParameters() as $key) {
- $p = mb_strtolower(substr($key, $cut_length));
- $class = 'ClicShopping\Apps\Shipping\Table\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
- $cfg = new $class($this->code);
- * Génère la signature d'une méthode
- */
- private function generateMethodSignature(array $method): string
- {
- $params = [];
- foreach ($method['parameters'] as $param) {
- $required = $param['required'] ? '' : '?';
- $params[] = "{$required}{$param['type']} \${$param['name']}";
- }
- $paramStr = implode(', ', $params);
- }
- // Paramètres
- if (!empty($method['parameters'])) {
- $md[] = "**Parameters:**";
- foreach ($method['parameters'] as $param) {
- $required = $param['required'] ? '(required)' : '(optional)';
- $md[] = "- `{$param['name']}` ({$param['type']}) {$required}";
- if ($param['default'] !== null) {
- $md[] = " - Default: `{$param['default']}`";
- }
- $md[] = "### Properties";
- $md[] = "";
- $md[] = "| Name | Type | Visibility | Description |";
- $md[] = "|------|------|------------|-------------|";
- foreach ($analysis['properties'] as $prop) {
- $static = $prop['static'] ? ' (static)' : '';
- $md[] = "| `{$prop['name']}{$static}` | {$prop['type']} | {$prop['visibility']} | {$prop['description']} |";
- }
- $md[] = "";
- // Méthodes
- if (!empty($analysis['methods'])) {
- $md[] = "### Methods";
- $md[] = "";
- foreach ($analysis['methods'] as $method) {
- $signature = $this->generateMethodSignature($method);
- $md[] = "#### `{$signature}`";
- $md[] = "";
- if (!empty($method['description'])) {
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Recommendations->getConfigModules() as $m) {
- if ($CLICSHOPPING_Recommendations->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Recommendations->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Recommendations->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Recommendations_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appRecommendationsToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Recommendations->getConfigModules() as $m) {
- if ($CLICSHOPPING_Recommendations->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Recommendations->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Recommendations->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appGdprToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Gdpr->getConfigModules() as $m) {
- if ($CLICSHOPPING_Gdpr->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Gdpr->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Gdpr->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- ?>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Gdpr->getConfigModules() as $m) {
- if ($CLICSHOPPING_Gdpr->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Gdpr->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Gdpr->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Gdpr_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $modules = $CLICSHOPPING_BannerManager->getConfigModules();
- $default_module = 'BM';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_BannerManager->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $modules = $CLICSHOPPING_Langues->getConfigModules();
- $default_module = 'LG';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Langues->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- }
- } else {
- $chosen = [];
- foreach ($_POST['chosen'] as $id) {
- if (is_numeric($id) && !\in_array($id, $chosen)) {
- $chosen[] = $id;
- }
- }
- ];
- }
- } else {
- $chosen = [];
- foreach ($_POST['chosen'] as $id) {
- if (is_numeric($id) && !\in_array($id, $chosen)) {
- $chosen[] = $id;
- }
- }
- // 2. Execute uncached sub-queries only
- $subResults = [];
- if (!empty($cachedSubResults)) {
- // Start with cached results
- foreach ($cachedSubResults as $index => $cachedResult) {
- $subResults[$index] = $cachedResult;
- }
- }
- // Execute uncached sub-queries
- 'aggregation_type' => 'temporal',
- ];
- }
- // Non-temporal sub-queries
- foreach ($nonTemporalDimensions as $nonTemporal) {
- $subQueries[] = [
- 'query' => "{$baseMetric} for {$timeRange} by {$nonTemporal}",
- 'type' => 'analytics',
- 'confidence' => 0.85,
- 'priority' => $priority++,
- 'time_range' => $timeRange,
- 'aggregation_type' => 'temporal',
- ];
- // Then, create combined sub-queries for each non-temporal dimension
- foreach ($nonTemporalDimensions as $nonTemporal) {
- $subQueries[] = [
- 'query' => "{$baseMetric} for {$timeRange} by {$temporal} and by {$nonTemporal}",
- 'type' => 'analytics',
- 'confidence' => 0.85,
- 'priority' => $priority++,
- }
- }
- // Execute uncached sub-queries
- $newResults = [];
- foreach ($uncachedSubQueries as $index => $subQuery) {
- $result = $this->executeSubQuery($subQuery, $context, $taskPlanner, $planExecutor);
- $subResults[$index] = $result;
- // TASK 8: Cache the new result (Requirements 9.1, 9.2)
- if ($this->hybridCache !== null && $this->hybridCache->isEnabled() && ($result['success'] ?? false)) {
- $priority = 1;
- switch ($approach) {
- case 'nested':
- // Create nested sub-queries: temporal first, then non-temporal within each
- foreach ($temporalDimensions as $temporal) {
- // First, create temporal-only sub-query
- $subQueries[] = [
- 'query' => "{$baseMetric} for {$timeRange} by {$temporal}",
- 'type' => 'analytics',
- 'confidence' => 0.9,
- break;
- case 'simplify':
- // Too many dimensions - create separate sub-queries and warn user
- // Temporal sub-queries
- foreach ($temporalDimensions as $temporal) {
- $subQueries[] = [
- 'query' => "{$baseMetric} for {$timeRange} by {$temporal}",
- 'type' => 'analytics',
- 'confidence' => 0.9,
- 'priority' => $priority++,
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appLanguesToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Langues->getConfigModules() as $m) {
- if ($CLICSHOPPING_Langues->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Langues->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Langues->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Langues->getConfigModules() as $m) {
- if ($CLICSHOPPING_Langues->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Langues->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Langues->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Langues_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- foreach ($sources as $source) {
- if (isset($source['error']) || !isset($source['components'])) {
- continue;
- }
- foreach ($source['components'] as $compName => $comp) {
- $calls = $comp['total_calls'] ?? 0;
- $success = $comp['successful_calls'] ?? 0;
- $totalCalls += $calls;
- $totalSuccess += $success;
- foreach ($sources as $source) {
- if (isset($source['error']) || !isset($source['components'])) {
- continue;
- }
- foreach ($source['components'] as $compName => $comp) {
- $avgTime = $comp['avg_execution_time'] ?? 0;
- $metrics['components_performance'][$compName] = [
- 'avg_time' => $avgTime,
- 'total_calls' => $comp['total_calls'] ?? 0,
- $summary['total_api_cost'] += $source['system']['total_api_cost'] ?? 0;
- }
- // Statut des composants
- if (isset($source['components'])) {
- foreach ($source['components'] as $comp => $data) {
- if (!isset($summary['components_status'][$comp])) {
- $summary['components_status'][$comp] = [
- 'total_calls' => 0,
- 'success_count' => 0,
- 'failure_count' => 0,
- }
- }
- // Vérifier les composants défaillants
- if (isset($source['components'])) {
- foreach ($source['components'] as $compName => $comp) {
- $calls = $comp['total_calls'] ?? 0;
- $failures = $comp['failed_calls'] ?? 0;
- if ($calls > 10 && $failures / $calls > 0.2) {
- $anomalies[] = [
- $modules = $CLICSHOPPING_AdministratorMenu->getConfigModules();
- $default_module = 'AM';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_AdministratorMenu->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- echo '</tr>';
- echo '</thead>';
- echo '<tbody>';
- $products = $CLICSHOPPING_ShoppingCart->get_products();
- foreach ($products as $v) {
- echo '<tr>';
- echo '<td class="multiTemplateDefault-cart-qty cart-qty">' . HTML::outputProtected($v['quantity']) . '</td>';
- echo '<td class="multiTemplateDefault-cart-product cart-product">' . HTML::outputProtected($v['name']) . '</td>';
- echo '<td class="multiTemplateDefault-cart-total cart-total text-end">' . $CLICSHOPPING_Currencies->displayPrice($v['final_price'], $CLICSHOPPING_Tax->getTaxRate($v['tax_class_id']), $v['quantity']) . '</td>';
- echo '</tr>';
- echo '</tr>';
- echo '</thead>';
- echo '<tbody>';
- $products = $CLICSHOPPING_ShoppingCart->get_products();
- foreach ($products as $v) {
- echo '<tr>';
- echo '<td class="multiTemplateDefault-cart-qty cart-qty">' . HTML::outputProtected($v['quantity']) . '</td>';
- echo '<td class="multiTemplateDefault-cart-product cart-product">' . HTML::outputProtected($v['name']) . '</td>';
- echo '<td class="multiTemplateDefault-cart-total cart-total text-end">' . $CLICSHOPPING_Currencies->displayPrice($v['final_price'], $CLICSHOPPING_Tax->getTaxRate($v['tax_class_id']), $v['quantity']) . '</td>';
- echo '</tr>';
- <tr>
- <td><?php echo $CLICSHOPPING_Cache->getDef('text_jit_enabled'); ?></td>
- <td>
- <?php
- foreach ($data['directives'] as $item) {
- if ($item['k'] === 'opcache.jit') {
- echo $item['v'] !== 'off' && $item['v'] !== '0' ? 'Yes' : 'No';
- break;
- }
- }
- </tr>
- <tr>
- <td><?php echo $CLICSHOPPING_Cache->getDef('text_memory_consumption'); ?></td>
- <td>
- <?php
- foreach ($data['directives'] as $item) {
- if ($item['k'] === 'opcache.memory_consumption' && is_numeric($item['v'])) {
- echo number_format($item['v'] / 1024 / 1024, 2) . ' MB';
- break;
- }
- }
- <tr>
- <td><?php echo $CLICSHOPPING_Cache->getDef('text_enabled'); ?></td>
- <td>
- <?php
- $enabled = 'Unknown';
- foreach ($data['directives'] as $item) {
- if ($item['k'] === 'opcache.enable') {
- $enabled = $item['v'] ? 'Yes' : 'No';
- break;
- }
- }
- <tr>
- <td><?php echo $CLICSHOPPING_Cache->getDef('text_jit_buffer_size'); ?></td>
- <td>
- <?php
- foreach ($data['directives'] as $item) {
- if ($item['k'] === 'opcache.jit_buffer_size') {
- echo number_format($item['v'] / 1024 / 1024, 2) . ' MB';
- break;
- }
- }
- $CLICSHOPPING_Page = Registry::get('Site')->getPage();
- $files = [];
- foreach (glob(ErrorHandler::getDirectory() . 'errors-*.txt') as $f) {
- $key = basename($f, '.txt');
- if (preg_match('/^errors-([0-9]{4})([0-9]{2})([0-9]{2})$/', $key, $matches)) {
- $files[$key] = [
- 'path' => $f,
- </div>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_ReturnOrders_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appReturnOrdersToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_ReturnOrders->getConfigModules() as $m) {
- if ($CLICSHOPPING_ReturnOrders->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_ReturnOrders->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ReturnOrders->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_ReturnOrders->getConfigModules() as $m) {
- if ($CLICSHOPPING_ReturnOrders->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_ReturnOrders->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ReturnOrders->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <div class="hr"></div>
- <div class="mt-1"></div>
- <?php
- foreach ($historyCheck as $value) {
- ?>
- <div class="col-md-12">
- <div class="card">
- <div class="card-header">
- <div class="row">
- private function validateDependenciesExist(array $steps, array $dependencies): bool
- {
- $stepIds = array_map(fn($step) => $step->getId(), $steps);
- foreach ($dependencies as $stepId => $deps) {
- foreach ($deps['depends_on'] as $depId) {
- if (!in_array($depId, $stepIds)) {
- return false;
- }
- }
- }
- {
- $visited[$stepId] = true;
- $recursionStack[$stepId] = true;
- $dependsOn = $dependencies[$stepId]['depends_on'] ?? [];
- foreach ($dependsOn as $depId) {
- if (!isset($visited[$depId])) {
- if ($this->hasCycleDFS($depId, $dependencies, $visited, $recursionStack)) {
- return true;
- }
- } elseif (isset($recursionStack[$depId]) && $recursionStack[$depId]) {
- {
- $visited[$stepId] = true;
- $recursionStack[$stepId] = true;
- $dependsOn = $dependencies[$stepId]['depends_on'] ?? [];
- foreach ($dependsOn as $depId) {
- if (!isset($visited[$depId])) {
- $this->detectCycles($depId, $dependencies, $visited, $recursionStack, $cycles);
- } elseif (isset($recursionStack[$depId]) && $recursionStack[$depId]) {
- // Cycle détecté
- $cycles[] = [$stepId, $depId];
- $modules = $CLICSHOPPING_Antispam->getConfigModules();
- $default_module = 'GE';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Antispam->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appTemplateEmailToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_TemplateEmail->getConfigModules() as $m) {
- if ($CLICSHOPPING_TemplateEmail->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_TemplateEmail->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_TemplateEmail->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_TemplateEmail_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_TemplateEmail->getConfigModules() as $m) {
- if ($CLICSHOPPING_TemplateEmail->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_TemplateEmail->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_TemplateEmail->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Customers->getConfigModules() as $m) {
- if ($CLICSHOPPING_Customers->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Customers->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Customers->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appCustomersToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Customers->getConfigModules() as $m) {
- if ($CLICSHOPPING_Customers->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Customers->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Customers->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Customers_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $CLICSHOPPING_Hooks = Registry::get('Hooks');
- $page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $Qdelete = $CLICSHOPPING_Favorites->db->prepare('delete
- from :table_products_favorites
- where products_favorites_id = :products_favorites_id
- ');
- $Qdelete->bindInt(':products_favorites_id', (int)$id);
- $CLICSHOPPING_Hooks = Registry::get('Hooks');
- $page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $reviews_id = HTML::sanitize($id);
- $CLICSHOPPING_Reviews->db->delete('reviews', ['reviews_id' => (int)$reviews_id]);
- }
- }
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appDefineLanguageToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_DefineLanguage->getConfigModules() as $m) {
- if ($CLICSHOPPING_DefineLanguage->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_DefineLanguage->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_DefineLanguage->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_DefineLanguage->getConfigModules() as $m) {
- if ($CLICSHOPPING_DefineLanguage->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_DefineLanguage->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_DefineLanguage->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_DefineLanguage_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_OrdersStatusInvoice->getConfigModules() as $m) {
- if ($CLICSHOPPING_OrdersStatusInvoice->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_OrdersStatusInvoice->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_OrdersStatusInvoice->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appOrdersStatusInvoiceToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_OrdersStatusInvoice->getConfigModules() as $m) {
- if ($CLICSHOPPING_OrdersStatusInvoice->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_OrdersStatusInvoice->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_OrdersStatusInvoice->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_OrdersStatusInvoice_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $rows[] = $row;
- }
- }
- if (isset($schema['foreign'])) {
- foreach ($schema['foreign'] as $name => $fields) {
- $row = ' FOREIGN KEY ' . $name . ' (' . implode(', ', $fields['col']) . ') REFERENCES ' . (isset($prefix) && (!isset($fields['prefix']) || ($fields['prefix'] != 'false')) ? $prefix : '') . $fields['ref_table'] . '(' . implode(', ', $fields['ref_col']) . ')';
- if (isset($fields['on_update'])) {
- $row .= ' ON UPDATE ' . mb_strtoupper($fields['on_update']);
- }
- {
- $sql = 'CREATE TABLE ' . (isset($prefix) ? $prefix : '') . $schema['name'] . ' (' . "\n";
- $rows = [];
- foreach ($schema['col'] as $name => $fields) {
- $row = ' ' . $name . ' ' . $fields['type'];
- if (isset($fields['length'])) {
- $row .= '(' . $fields['length'] . ')';
- }
- 'name' => $table
- ];
- $is_index = $is_foreign = $is_property = false;
- foreach (file($file) as $row) {
- $row = trim($row);
- if (!empty($row)) {
- // Check section delimiters first, before comment check
- if ($row == '--') {
- $rows[] = $row;
- }
- if (isset($schema['index'])) {
- foreach ($schema['index'] as $name => $fields) {
- if ($name == 'primary') {
- $name = 'PRIMARY KEY';
- } else {
- $name = 'KEY ' . $name;
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appTaxGeoZonesToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_TaxGeoZones->getConfigModules() as $m) {
- if ($CLICSHOPPING_TaxGeoZones->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_TaxGeoZones->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_TaxGeoZones->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_TaxGeoZones->getConfigModules() as $m) {
- if ($CLICSHOPPING_TaxGeoZones->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_TaxGeoZones->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_TaxGeoZones->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_TaxGeoZones_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $modules = $CLICSHOPPING_EditDesign->getConfigModules();
- $default_module = 'ED';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_EditDesign->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- // This code is never executed (USE_PATTERN_BASED_DETECTION removed in task 5.1.6)
- // TODO: Remove this dead code block in Q2 2026
- // Pattern mode: Use SemanticsPattern for extraction
- // Extract semantic keywords
- $semanticKeywords = SemanticsPattern::calculateConfidenceSemanticKeywords();
- foreach ($semanticKeywords as $keyword) {
- if (stripos($query, $keyword) !== false) {
- $metadata['semantic_keywords'][] = $keyword;
- }
- }
- // This code is never executed (USE_PATTERN_BASED_DETECTION removed in task 5.1.6)
- // TODO: Remove this dead code block in Q2 2026
- // Pattern mode: Use SemanticsPattern for detection
- $contextualPatterns = SemanticsPattern::requiresConversationContext();
- foreach ($contextualPatterns as $pattern) {
- if (preg_match($pattern, $query)) {
- return true;
- }
- }
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appTaxClassToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_TaxClass->getConfigModules() as $m) {
- if ($CLICSHOPPING_TaxClass->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_TaxClass->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_TaxClass->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_TaxClass->getConfigModules() as $m) {
- if ($CLICSHOPPING_TaxClass->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_TaxClass->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_TaxClass->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_TaxClass_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $files = glob($this->cacheDir . '*.json');
- $success = true;
- $count = 0;
- foreach ($files as $file) {
- if (@unlink($file)) {
- $count++;
- } else {
- $success = false;
- }
- $files = glob($this->cacheDir . '*.json');
- $totalSize = 0;
- $oldestTime = PHP_INT_MAX;
- $newestTime = 0;
- foreach ($files as $file) {
- $totalSize += filesize($file);
- $mtime = filemtime($file);
- $oldestTime = min($oldestTime, $mtime);
- $newestTime = max($newestTime, $mtime);
- }
- // level 4
- if (isset($menu_sub[$third_level]['sub_menu'])) {
- $output .= '<ul class="flex-column pl-2 nav" id="submenu4sub1" aria-expanded="false">';
- $x = 1;
- foreach ($menu_sub[$third_level]['sub_menu'] as $fourth_level) {
- $x = $x + 1;
- $image = '';
- if (!is_null($menu_sub[$fourth_level]['link'])) {
- $output .= '<li class="nav-item p-1 small m-1">' . HTML::link(CLICSHOPPING::link($menu_sub[$fourth_level]['link']), $image . ' ' . $menu_sub[$fourth_level]['label'], 'nav-link') . '</li>';
- // level 2
- if (isset($menus['sub_menu'])) {
- $output .= '<ul class="flex-column pl-1 nav" id="submenu2sub1" aria-expanded="false">';
- $n = 1;
- foreach ($menus['sub_menu'] as $second_level) {
- ++$n;
- $image = '';
- if ($menu_sub[$second_level]['link'] != '') {
- $output .= '<li class="nav-item p-1 small m-1">' . HTML::link(CLICSHOPPING::link($menu_sub[$second_level]['link']), $image . ' ' . $menu_sub[$second_level]['label'], 'class="nav-link"') . '</li>';
- // level 3
- if (isset($menu_sub[$second_level]['sub_menu'])) {
- $output .= '<ul class="flex-column p-2 nav" id="submenu3sub1" aria-expanded="false"">';
- $z = 1;
- foreach ($menu_sub[$second_level]['sub_menu'] as $third_level) {
- $z = $z + 1;
- $image = '';
- if (!is_null($menu_sub[$third_level]['link'])) {
- $output .= '<li class="nav-item p-1 small m-1">' . HTML::link(CLICSHOPPING::link($menu_sub[$third_level]['link']), $image . ' ' . $menu_sub[$third_level]['label'], ' class="nav-link"') . '</li>';
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appActionsRecorderToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_ActionsRecorder->getConfigModules() as $m) {
- if ($CLICSHOPPING_ActionsRecorder->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_ActionsRecorder->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ActionsRecorder->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_ActionsRecorder->getConfigModules() as $m) {
- if ($CLICSHOPPING_ActionsRecorder->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_ActionsRecorder->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ActionsRecorder->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_ActionsRecorder_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- return $matches[0]; // Return original match
- }
- // Multi-word pattern detected - split into multiple LIKE conditions
- $conditions = [];
- foreach ($words as $word) {
- $word = trim($word);
- if (!empty($word)) {
- // Escape single quotes in word
- $escapedWord = str_replace("'", "''", $word);
- $conditions[] = "{$columnName} LIKE '%{$escapedWord}%'";
- }
- }
- $prefix = CLICSHOPPING::getConfig('db_table_prefix');
- foreach ($cachedTables as $table) {
- // Ajouter le préfixe uniquement si absent, pour FROM, JOIN, UPDATE, INSERT INTO, DELETE FROM
- $sql = preg_replace(
- '/\b(FROM|JOIN|UPDATE|INSERT\s+INTO|DELETE\s+FROM)\s+(?!' . preg_quote($prefix, '/') . ')(' . preg_quote($table, '/') . ')\b/i',
- '$1 ' . $prefix . '$2',
- $sql
- // Generate suggestion for multi-token pattern
- $words = preg_split('/\s+/', $cleanPattern);
- $multiTokenConditions = [];
- foreach ($words as $word) {
- if (!empty($word)) {
- $multiTokenConditions[] = "LIKE '%" . $word . "%'";
- }
- }
- $modules = $CLICSHOPPING_Stripe->getConfigModules();
- $default_module = 'ST';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Stripe->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- if (isset($filter)) {
- $modules = $CLICSHOPPING_Type->filter($modules, $filter);
- }
- foreach ($modules as $key => $data) {
- $tempResults[] = $CLICSHOPPING_Type->getInfo($vendor->getFilename() . '\\' . $app->getFilename(), $key, $data);
- }
- $result = array_merge(...$tempResults);
- }
- */
- public static function getChildren(string $category_id, array &$array = []): array
- {
- foreach (static::$data as $parent => $categories) {
- if ($parent == $category_id) {
- foreach ($categories as $id => $info) {
- $array[] = $id;
- self::getChildren($id, $array);
- }
- }
- }
- *
- * @return array An array containing all child category IDs, including both direct and indirect children.
- */
- public static function getChildren(string $category_id, array &$array = []): array
- {
- foreach (static::$data as $parent => $categories) {
- if ($parent == $category_id) {
- foreach ($categories as $id => $info) {
- $array[] = $id;
- self::getChildren($id, $array);
- }
- $threatTypeResult->execute();
- $threatTypeTrends = $threatTypeResult->fetchAll();
- // Group by threat type
- $threatTypeData = [];
- foreach ($threatTypeTrends as $row) {
- $type = $row['threat_type'];
- if (!isset($threatTypeData[$type])) {
- $threatTypeData[$type] = [];
- }
- $threatTypeData[$type][] = [
- return $a['chunk_index'] <=> $b['chunk_index'];
- });
- // Reconstruct the full content by concatenating chunks
- $fullContent = '';
- foreach ($interaction['chunks'] as $chunk) {
- $fullContent .= $chunk['content'] . "\n";
- }
- $formatted[] = [
- 'user_message' => $metadata['user_message'] ?? 'N/A',
- $CLICSHOPPING_Specials = Registry::get('Specials');
- $page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $Qdelete = $CLICSHOPPING_Specials->db->prepare('delete
- from :table_specials
- where specials_id = :specials_id
- ');
- $Qdelete->bindInt(':specials_id', (int)$id);
- $QreturnOrders->execute();
- $return_orders_array = $QreturnOrders->fetchAll();
- $embedding_data = "\n" . $this->app->getDef('text_orders_products_return_history') . "\n";
- foreach ($return_orders_array as $item) {
- $embedding_data .= $this->app->getDef('text_orders_products_return_history_comment') . ' : ' . HTMLOverrideCommon::cleanHtmlForEmbedding($item['comment']) . "\n";
- $embedding_data .= $this->app->getDef('text_orders_products_return_history_date_added') . ' : ' . $item['date_added'] . "\n";
- }
- return $embedding_data;
- ?>
- <div class="row">
- <span class="col-md-10 productsReviewsListingContentTag">
- <?php
- echo CLICSHOPPING::getDef('modules_products_reviews_listing_content_text_sentiment') . ' ';
- foreach ($customer_tag as $value) {
- echo ' <span class="badge text-bg-primary">' . $value . '</span> ';
- }
- ?>
- </span>
- </div>
- $modules = $CLICSHOPPING_MCP->getConfigModules();
- $default_module = 'MC';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_MCP->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Administrators_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appAdministratorsToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Administrators->getConfigModules() as $m) {
- if ($CLICSHOPPING_Administrators->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Administrators->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Administrators->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Administrators->getConfigModules() as $m) {
- if ($CLICSHOPPING_Administrators->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Administrators->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Administrators->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- $modules = $CLICSHOPPING_DefineLanguage->getConfigModules();
- $default_module = 'DL';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_DefineLanguage->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $CLICSHOPPING_EditLogError = Registry::get('EditLogError');
- $CLICSHOPPING_MessageStack = Registry::get('MessageStack');
- $files = [];
- foreach (glob(ErrorHandler::getDirectory() . 'phpmail_error-*.txt') as $f) {
- $key = basename($f, '.txt');
- if (preg_match('/^phpmail_error-([0-9]{4})([0-9]{2})([0-9]{2})$/', $key, $matches)) {
- $files[$key] = [
- 'path' => $f,
- <div>
- <?php
- $pi_counter = 0;
- $pi_html = [];
- foreach ($pi as $image) {
- $pi_counter++;
- if (!empty($image['htmlcontent'])) {
- if ($this->getVideo($image['htmlcontent']) === true) {
- $pi_html[] = '<li class="image-additional"><a class="thumbnail popup-youtube" href="' . $image['htmlcontent'] . '"><img src="' . CLICSHOPPING::link($CLICSHOPPING_Template->getDirectoryTemplateImages() . $image['image']) . '" width="' . $thumbail_width . '" height="' . $thumbail_height . '" title="' . $products_name . '" alt="' . $products_name . '" id="piGalImg_' . $pi_counter . '"></a></li>';
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Members_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Members->getConfigModules() as $m) {
- if ($CLICSHOPPING_Members->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Members->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Members->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appMembersToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Members->getConfigModules() as $m) {
- if ($CLICSHOPPING_Members->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Members->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Members->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- ?>
- $deleted = 0;
- if (is_dir($cacheDir)) {
- $files = glob($cacheDir . '*.cache');
- foreach ($files as $file) {
- if (@unlink($file)) {
- $deleted++;
- }
- }
- }
- if (is_dir($cacheDir)) {
- $files = glob($cacheDir . '*.cache');
- $fileCount = count($files);
- foreach ($files as $file) {
- $totalSize += filesize($file);
- $mtime = filemtime($file);
- if ($oldestFile === null || $mtime < $oldestFile) {
- $oldestFile = $mtime;
- $CLICSHOPPING_MessageStack->add($CLICSHOPPING_Cache->getDef('error_cache_directory_does_not_exist'), 'error');
- }
- $cache_files = [];
- foreach (glob(Cache::getPath() . '*.cache') as $c) {
- $key = basename($c, '.cache');
- if (($pos = strpos($key, '-')) !== false) {
- $cache_files[substr($key, 0, $pos)][] = $key;
- } else {
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_MoneyOrder_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <div class="row">
- <span class="col-md-11 productsReviewInfoContentCustomerTag">
- <?php
- echo CLICSHOPPING::getDef('modules_products_reviews_info_content_text_customers_tag');
- foreach ($customer_tag as $value) {
- echo ' <span class="badge text-bg-primary">' . $value . '</span> ';
- }
- ?>
- </span>
- </div>
- }
- sort($result['file']);
- $i = 0;
- foreach ($result['file'] as &$module) {
- $class = substr($module['files_name'], 0, strrpos($module['files_name'], '.'));
- $class1[] = $class;
- if (class_exists($class)) {
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appEditDesignToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_EditDesign->getConfigModules() as $m) {
- if ($CLICSHOPPING_EditDesign->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_EditDesign->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_EditDesign->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_EditDesign->getConfigModules() as $m) {
- if ($CLICSHOPPING_EditDesign->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_EditDesign->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_EditDesign->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_EditDesign_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $this->total += $this->tax->addTax($products_price, $products_tax) * $qty;
- }
- // attributes price
- if (isset($data['attributes'])) {
- foreach ($data['attributes'] as $option => $value) {
- $Qattributes = $this->db->prepare('select options_values_price,
- price_prefix
- from :table_products_attributes
- where products_id = :products_id
- and options_id = :options_id
- 'customers_basket_date_added' => date('Ymd')
- ]
- );
- if (isset($data['attributes'])) {
- foreach ($data['attributes'] as $option => $value) {
- $this->db->save('customers_basket_attributes', [
- 'customers_id' => (int)$this->customer->getID(),
- 'products_id' => $item_id,
- 'products_options_id' => (int)$option,
- 'products_options_value_id' => (int)$value
- $this->content_type = false;
- if ((\defined('DOWNLOAD_ENABLED') && DOWNLOAD_ENABLED == 'true') && ($this->getCountContents() > 0)) {
- foreach ($this->contents as $item_id => $data) {
- if (isset($data['attributes'])) {
- foreach ($data['attributes'] as $value) {
- $check = $this->productsAttributes->getCheckProductsDownload($item_id, $value);
- if ($check > 0) {
- switch ($this->content_type) {
- case 'physical':
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appManufacturersToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Manufacturers->getConfigModules() as $m) {
- if ($CLICSHOPPING_Manufacturers->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Manufacturers->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Manufacturers->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Manufacturers->getConfigModules() as $m) {
- if ($CLICSHOPPING_Manufacturers->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Manufacturers->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Manufacturers->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Manufacturers_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- }
- Registry::get('Hooks')->watch('Session', 'StartAfter', 'execute', function () {
- if (isset($_SESSION['MessageStack_Data']) && !empty($_SESSION['MessageStack_Data'])) {
- foreach ($_SESSION['MessageStack_Data'] as $group => $messages) {
- foreach ($messages as $message) {
- $this->add($message['text'], $message['type'], $group);
- }
- }
- Registry::get('Hooks')->watch('Session', 'StartAfter', 'execute', function () {
- if (isset($_SESSION['MessageStack_Data']) && !empty($_SESSION['MessageStack_Data'])) {
- foreach ($_SESSION['MessageStack_Data'] as $group => $messages) {
- foreach ($messages as $message) {
- $this->add($message['text'], $message['type'], $group);
- }
- }
- unset($_SESSION['MessageStack_Data']);
- }
- });
- if (isset($_SESSION['MessageStack_Data']) && is_array($_SESSION['MessageStack_Data'])) {
- foreach ($_SESSION['MessageStack_Data'] as $group => $messages) {
- foreach ($messages as $message) {
- $this->add($message['text'], $message['type'], $group);
- }
- }
- unset($_SESSION['MessageStack_Data']);
- $modules = $CLICSHOPPING_ProductsLength->getConfigModules();
- $default_module = 'PL';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_ProductsLength->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- </div>
- </div>
- <div class="mt-1"></div>
- <div class="row">
- <?php
- foreach ($address_formats_array as $value) {
- ?>
- <div class="col-md-3">
- <div class="card">
- <div class="card-body">
- <h4 class="card-title">
- // Save the result to cache for future use
- $cache->save($cached_rules);
- }
- foreach ($cached_rules as $rule) {
- $rule_id = $rule['rules_id'];
- $condition = $rule['rules_condition'];
- $ruleName = $rule['rules_name'];
- $ruleType = $rule['rules_type'];
- $ruleValue = (float)$rule['rules_value'];
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- // Si l'ordre d'affichage du shipping < sort order on additionne les frais d'envoi au sous total
- if (defined('CLICSHOPPING_APP_ORDER_TOTAL_SHIPPING_SH_SORT_ORDER') && CLICSHOPPING_APP_ORDER_TOTAL_SHIPPING_SH_SORT_ORDER < CLICSHOPPING_APP_ORDER_TOTAL_TAX_TX_SORT_ORDER) $subtotal += $CLICSHOPPING_Order->info['shipping_cost'];
- $hst_total = $subtotal * ($Qtax->valueDecimal('tax_rate') / 100);
- foreach ($CLICSHOPPING_Order->info['tax_groups'] as $key => $value) {
- if ($value > 0) {
- $this->output[] = [
- 'title' => $Qtax->value('tax_description') . ' : ',
- 'text' => $CLICSHOPPING_Currencies->format($hst_total, true, $CLICSHOPPING_Order->info['currency'], $CLICSHOPPING_Order->info['currency_value']), 'value' => $hst_total
- ];
- } else {
- // **********************************
- // normal tax
- // ************************************
- foreach ($CLICSHOPPING_Order->info['tax_groups'] as $key => $value) {
- if ($value > 0) {
- $this->output[] = [
- 'title' => $key,
- 'text' => $CLICSHOPPING_Currencies->format($value, true, $CLICSHOPPING_Order->info['currency'], $CLICSHOPPING_Order->info['currency_value']),
- 'value' => $value
- if (is_file($json_file)) {
- $get_json_file = file_get_contents($json_file, true);
- $result = json_decode($get_json_file);
- foreach ($result as $key => $value) {
- $text = '';
- if (!\is_array($value)) {
- $text = $value;
- }
- }
- }
- }
- // Fill remaining with any available interpretations
- foreach ($availableInterpretations as $type) {
- if (!in_array($type, $selected)) {
- $selected[] = $type;
- if (count($selected) >= $count) {
- break;
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appArchiveToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Archive->getConfigModules() as $m) {
- if ($CLICSHOPPING_Archive->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Archive->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Archive->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- </div>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Archive_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Archive->getConfigModules() as $m) {
- if ($CLICSHOPPING_Archive->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Archive->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Archive->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $modules = $CLICSHOPPING_Administrators->getConfigModules();
- $default_module = 'AD';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Administrators->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- if ($this->debug) {
- error_log("AmbiguousQueryDetector: Generating " . count($interpretations) . " interpretations");
- }
- // Generate SQL for each interpretation
- foreach ($interpretations as $interpretation) {
- try {
- // Create clarified query based on interpretation
- $clarifiedQuery = $this->clarifyQueryForInterpretation($query, $interpretation);
- if ($this->debug) {
- if ($searchResult['success']) {
- // Format results - map 'link' field to 'url' for consistency
- $items = $searchResult['items'] ?? [];
- $formattedResults = [];
- foreach ($items as $item) {
- $formattedResults[] = [
- 'title' => $item['title'] ?? '',
- 'snippet' => $item['snippet'] ?? '',
- 'url' => $item['link'] ?? $item['url'] ?? '',
- 'source' => $item['source'] ?? '',
- // @deprecated Pattern-based detection removed in Pure LLM mode
- // This code is never executed (USE_PATTERN_BASED_DETECTION removed in task 5.1.6)
- // TODO: Remove this dead code block in Q2 2026
- $priceComparisonPatterns = HybridPattern::priceComparisonPatterns();
- foreach ($priceComparisonPatterns as $pattern) {
- if (preg_match($pattern, $query)) {
- return true;
- }
- }
- $modules = $CLICSHOPPING_Archive->getConfigModules();
- $default_module = 'AR';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Archive->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $modules = $CLICSHOPPING_ReturnOrders->getConfigModules();
- $default_module = 'RO';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_ReturnOrders->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- ];
- }
- // Sinon, décomposer récursivement les sous-problèmes
- $subproblems = [];
- foreach ($parsed['subproblems'] as $subproblem) {
- $subproblems[] = $this->decompose($subproblem, $depth + 1);
- }
- return [
- 'problem' => $problem,
- $message = mb_strtolower($message);
- $entities = [];
- $patterns = self::getPatterns();
- foreach ($patterns as $entityType => $keywords) {
- foreach ($keywords as $keyword) {
- // Escape keyword for regex and match as whole word
- $keywordEscaped = preg_quote($keyword, '/');
- if (preg_match('/\b' . $keywordEscaped . '\b/i', $message)) {
- $entities[] = $entityType;
- break; // Stop after first match for this entity type
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- // Build context from documents (with priority handling)
- $context = $this->optimizeContext($documents, 3000);
- // TASK 5.2.1.4: Collect document names for citation
- $documentNames = [];
- foreach ($documents as $doc) {
- $docName = $this->extractDocumentName($doc);
- // Only include real document names (not generic "Document" fallback)
- if ($docName !== "Document") {
- $documentNames[] = $docName;
- }
- // Table body
- $output .= "<tbody>";
- foreach ($result['rows'] as $row) {
- $output .= "<tr>";
- foreach ($row as $value) {
- $output .= "<td>" . htmlspecialchars($value) . "</td>";
- }
- $output .= "</tr>";
- }
- $output .= "</tbody>";
- if (!$whitelistMatch) {
- return false;
- }
- // Check if query contains any blacklisted pattern
- foreach ($this->queryBlacklist as $pattern) {
- if (preg_match($pattern, $query)) {
- return false;
- }
- }
- */
- private function validateQueryPatterns(string $query): bool
- {
- // Check if query matches any whitelist pattern
- $whitelistMatch = false;
- foreach ($this->queryWhitelist as $pattern) {
- if (preg_match($pattern, $query)) {
- $whitelistMatch = true;
- break;
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- }
- $this->logger->warning("MCP status: Recommendations found. Starting decision process.");
- // 2. Reasoning and Decision: Iterate over recommendations and take actions
- foreach ($recommendations as $rec) {
- $this->logger->info("Recommendation found: " . $rec['message'] . " (Priority: " . $rec['priority'] . ")");
- $this->takeActionAndLog($rec);
- }
- // 3. Cleanup: Delete old alerts
- $modules = $CLICSHOPPING_Newsletter->getConfigModules();
- $default_module = 'NL';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Newsletter->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- count($dedupedRows)
- );
- if ($this->debug && $performanceAnalysis['is_slow']) {
- error_log("QueryExecutor: Performance recommendations:");
- foreach ($performanceAnalysis['recommendations'] as $rec) {
- error_log(" [{$rec['priority']}] {$rec['message']}");
- }
- }
- }
- }
- $response = "Résultats de recherche web :\n\n";
- $count = 0;
- foreach ($webResults['items'] as $item) {
- $count++;
- if ($count > 5) break; // Limit to top 5 results
- $title = $item['title'] ?? 'Sans titre';
- $snippet = $item['snippet'] ?? '';
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_ModulesHooks->getConfigModules() as $m) {
- if ($CLICSHOPPING_ModulesHooks->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_ModulesHooks->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ModulesHooks->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_ModulesHooks_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appModulesHooksToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_ModulesHooks->getConfigModules() as $m) {
- if ($CLICSHOPPING_ModulesHooks->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_ModulesHooks->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ModulesHooks->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_SEO_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_SEO->getConfigModules() as $m) {
- if ($CLICSHOPPING_SEO->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_SEO->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_SEO->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appSEOToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_SEO->getConfigModules() as $m) {
- if ($CLICSHOPPING_SEO->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_SEO->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_SEO->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- $modules = $CLICSHOPPING_Item->getConfigModules();
- $default_module = 'IT';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Item->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Upgrade->getConfigModules() as $m) {
- if ($CLICSHOPPING_Upgrade->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Upgrade->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Upgrade->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Upgrade_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appUpgradeToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Upgrade->getConfigModules() as $m) {
- if ($CLICSHOPPING_Upgrade->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Upgrade->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Upgrade->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- public function execute()
- {
- $page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $Qzones = $this->app->db->prepare('select zone_status
- from :table_zones
- where zone_id = :zone_id
- ');
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- */
- public function execute()
- {
- if (isset($_GET['DeleteAll'])) {
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $this->deleteCustomer($id);
- }
- } else {
- $id = HTML::sanitize($_POST['id']);
- $this->deleteCustomer($id);
- $modules = $CLICSHOPPING_Countries->getConfigModules();
- $default_module = 'CT';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Countries->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $modules = $CLICSHOPPING_Groups->getConfigModules();
- $default_module = 'GR';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Groups->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $report = "Complexity Analysis:\n";
- $report .= " Level: {$complexity['level']}\n";
- $report .= " Score: {$complexity['score']}\n";
- $report .= " Factors:\n";
- foreach ($complexity['factors'] as $factor) {
- $report .= " - {$factor}\n";
- }
- return $report;
- }
- $modules = $CLICSHOPPING_Modules->getConfigModules();
- $default_module = 'MO';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Modules->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $name = (!empty($key) ? 'configuration[' . $key . ']' : 'configuration_value');
- $zones_array = [];
- foreach ($CLICSHOPPING_Address->getZones() as $zone) {
- $zones_array[] = ['id' => $zone['id'],
- 'text' => $zone['name'],
- 'group' => $zone['country_name']
- ];
- }
- $modules = $CLICSHOPPING_TaxClass->getConfigModules();
- $default_module = 'TC';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_TaxClass->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- if (isset($results['featured_snippet']) && !empty($results['featured_snippet']['answer'])) {
- $score += 0.2;
- }
- $relevantCount = 0;
- foreach ($results['items'] ?? [] as $item) {
- if (($item['relevance_score'] ?? 0) > 0.7) {
- $relevantCount++;
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Cronjob->getConfigModules() as $m) {
- if ($CLICSHOPPING_Cronjob->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Cronjob->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Cronjob->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Cronjob_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appCronjobToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Cronjob->getConfigModules() as $m) {
- if ($CLICSHOPPING_Cronjob->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Cronjob->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Cronjob->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- */
- public function execute()
- {
- if (isset($_GET['DeleteAll'])) {
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $this->deleteCustomer($id);
- }
- } else {
- $id = HTML::sanitize($_POST['id']);
- $this->deleteCustomer($id);
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $context = [];
- $ragManager = new MultiDBRAGManager();
- $results = $ragManager->searchDocuments($query, $limit, 0.7);
- if (!empty($results['documents'])) {
- foreach ($results['documents'] as $doc) {
- $context[] = [
- 'type' => 'embedding',
- 'content' => $doc->content ?? '',
- 'score' => $doc->metadata['score'] ?? 0,
- 'entity_type' => $doc->metadata['entity_type'] ?? 'unknown',
- // 1. Load similar documents from embeddings
- $ragManager = new MultiDBRAGManager();
- $results = $ragManager->searchDocuments($query, $limit, 0.7);
- if (!empty($results['documents'])) {
- foreach ($results['documents'] as $doc) {
- $context[] = [
- 'type' => 'embedding',
- 'content' => $doc->content ?? '',
- 'score' => $doc->metadata['score'] ?? 0,
- 'entity_type' => $doc->metadata['entity_type'] ?? 'unknown',
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appProductsAttributesToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_ProductsAttributes->getConfigModules() as $m) {
- if ($CLICSHOPPING_ProductsAttributes->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_ProductsAttributes->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ProductsAttributes->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_ProductsAttributes->getConfigModules() as $m) {
- if ($CLICSHOPPING_ProductsAttributes->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_ProductsAttributes->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ProductsAttributes->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_ProductsAttributes_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_DataBaseTables->getConfigModules() as $m) {
- if ($CLICSHOPPING_DataBaseTables->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_DataBaseTables->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_DataBaseTables->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appDataBaseTablesToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_DataBaseTables->getConfigModules() as $m) {
- if ($CLICSHOPPING_DataBaseTables->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_DataBaseTables->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_DataBaseTables->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_DataBaseTables_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $modules = $CLICSHOPPING_MoneyOrder->getConfigModules();
- $default_module = 'MO';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_MoneyOrder->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- return $sessions;
- }
- $files = glob($this->dirSession . '/*.json');
- foreach ($files as $file) {
- $sessionId = basename($file, '.json');
- if ($fullData) {
- $sessionData = json_decode(file_get_contents($file), true);
- if ($sessionData && isset($sessionData['checkout_session'])) {
- $cut = 'CLICSHOPPING_APP_COUNTRIES_' . $this->code . '_';
- $cut_length = \strlen($cut);
- foreach ($this->getParameters() as $key) {
- $p = mb_strtolower(substr($key, $cut_length));
- $class = 'ClicShopping\Apps\Configuration\Countries\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
- $cfg = new $class($this->code);
- public function install()
- {
- $cut_length = \strlen('CLICSHOPPING_APP_COUNTRIES_' . $this->code . '_');
- foreach ($this->getParameters() as $key) {
- $p = mb_strtolower(substr($key, $cut_length));
- $class = 'ClicShopping\Apps\Configuration\Countries\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
- $cfg = new $class($this->code);
- }
- sort($result['file']);
- $i = 0;
- foreach ($result['file'] as &$module) {
- $class = substr($module['files_name'], 0, strrpos($module['files_name'], '.'));
- $class1[] = $class;
- if (class_exists($class)) {
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- }
- $result = array();
- foreach (DateTime::getTimeZones() as $zone => $zones_array) {
- foreach ($zones_array as $key => $value) {
- $result[] = [
- 'id' => $key,
- 'text' => $value,
- 'group' => $zone
- ];
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Groups->getConfigModules() as $m) {
- if ($CLICSHOPPING_Groups->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Groups->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Groups->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appGroupsToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Groups->getConfigModules() as $m) {
- if ($CLICSHOPPING_Groups->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Groups->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Groups->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- ?>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Groups_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $modules = $CLICSHOPPING_ModulesHooks->getConfigModules();
- $default_module = 'MH';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_ModulesHooks->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $CLICSHOPPING_Hooks = Registry::get('Hooks');
- $page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
- if (isset($_POST['selected'], $_GET['DeleteAll'], $_GET['Recommendations'])) {
- foreach ($_POST['selected'] as $id) {
- $CLICSHOPPING_Recommendations->db->delete('customers_basket', ['products_id' => (int)$id]);
- $CLICSHOPPING_Hooks->call('Recommendations', 'RemoveRecommendations');
- }
- }
- $cInfo = new ObjectInfo($Qcurrency->toArray());
- $currency_select = json_decode(file_get_contents(CLICSHOPPING::BASE_DIR . 'External/CommonCurrencies.json'), true);
- $currency_select_array = array(array('id' => '', 'text' => $CLICSHOPPING_Currency->getDef('text_info_common_currency')));
- foreach ($currency_select as $cs) {
- if (!isset($CLICSHOPPING_Currency->currency[$cs['code']])) {
- $currency_select_array[] = array('id' => $cs['code'], 'text' => '[' . $cs['code'] . '] ' . $cs['title']);
- }
- }
- $cut = 'CLICSHOPPING_APP_SECURITY_CHECK_' . $this->code . '_';
- $cut_length = \strlen($cut);
- foreach ($this->getParameters() as $key) {
- $p = mb_strtolower(substr($key, $cut_length));
- $class = 'ClicShopping\Apps\Tools\SecurityCheck\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
- $cfg = new $class($this->code);
- */
- public function install()
- {
- $cut_length = \strlen('CLICSHOPPING_APP_SECURITY_CHECK_' . $this->code . '_');
- foreach ($this->getParameters() as $key) {
- $p = mb_strtolower(substr($key, $cut_length));
- $class = 'ClicShopping\Apps\Tools\SecurityCheck\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
- $cfg = new $class($this->code);
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $customer_data = [];
- $result = $Qapi->fetchAll();
- foreach ($result as $value) {
- $customer_data[] = [
- 'customers_id' => $value['customers_id'],
- 'customers_company' => $value['customers_company'],
- 'customers_gender' => $value['customers_gender'],
- 'customers_firstname' => Hash::displayDecryptedDataText($value['customers_firstname']),
- $path = static::getPath();
- $files = glob($path . '*.cache', GLOB_NOSORT);
- $totalSize = 0;
- $totalFiles = count($files);
- foreach ($files as $file) {
- $totalSize += filesize($file);
- }
- return [
- 'total_files' => $totalFiles,
- public static function clearAll(): void
- {
- static::clearMemoryCache();
- if (FileSystem::isWritable(static::getPath())) {
- foreach (glob(static::getPath() . '*.cache', GLOB_NOSORT) as $c) {
- unlink($c);
- }
- }
- }
- public static function purgeExpired(int $maxAgeMinutes): int
- {
- $purged = 0;
- $cutoffTime = time() - ($maxAgeMinutes * 60);
- foreach (glob(static::getPath() . '*.cache', GLOB_NOSORT) as $file) {
- if (filemtime($file) < $cutoffTime) {
- unlink($file);
- $purged++;
- }
- }
- }
- }
- $result = [];
- foreach ($calls as $code) {
- $bait = null;
- if (is_string($code)) {
- $class = Apps::getModuleClass($code, 'Hooks');
- $obj = new $class();
- $calls = $this->hooks[$this->site][$group][$hook][$action];
- }
- if (isset($this->watches[$this->site][$group][$hook][$action])) {
- // Filtrer les watches selon le contexte si spécifié
- foreach ($this->watches[$this->site][$group][$hook][$action] as $watchEntry) {
- //Cjekcif it's a structure with context or simple code
- if (is_array($watchEntry) && isset($watchEntry['code'])) {
- // Structure avec contexte
- if ($context !== null) {
- // Si le watch a un contexte défini, il doit correspondre
- $CLICSHOPPING_Hooks = Registry::get('Hooks');
- $page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
- if (isset($_POST['selected']) && !\is_null($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $CLICSHOPPING_ChatGpt->db->delete('gpt', ['gpt_id' => (int)$id]);
- $CLICSHOPPING_Hooks->call('Gpt', 'DeleteAll');
- }
- }
- $modules = $CLICSHOPPING_Recommendations->getConfigModules();
- $default_module = 'PR';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Recommendations->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- // 🔧 TASK 2.17.2 & 4.4: Only use conversation memory if documents have actual content
- // Check if the documents have meaningful content (not just empty "Response: \n")
- $hasContent = false;
- if ($conversationResult !== null && !empty($conversationResult['documents'])) {
- // First, check if any document has actual content in the "Response:" section
- foreach ($conversationResult['documents'] as $doc) {
- $content = '';
- if (is_object($doc) && isset($doc->content)) {
- $content = $doc->content;
- } elseif (is_array($doc) && isset($doc['content'])) {
- $content = $doc['content'];
- // If we found useful content, extract and use it directly
- if ($hasContent) {
- // Extract the response from the first document with useful content
- $extractedResponse = '';
- foreach ($conversationResult['documents'] as $doc) {
- $content = '';
- if (is_object($doc) && isset($doc->content)) {
- $content = $doc->content;
- } elseif (is_array($doc) && isset($doc['content'])) {
- $content = $doc['content'];
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appCacheToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Cache->getConfigModules() as $m) {
- if ($CLICSHOPPING_Cache->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Cache->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Cache->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Cache_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Cache->getConfigModules() as $m) {
- if ($CLICSHOPPING_Cache->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Cache->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Cache->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- $review_array = $Qreview->fetchAll();
- $review_texts = [];
- foreach ($review_array as $value) {
- $review_texts[] = $value['reviews_text'];
- }
- // Output the review texts separated by <br>
- $result = implode('<br> - ', $review_texts);
- </div>
- </div>
- <div class="mt-1"></div>
- <div class="row">
- <?php
- foreach ($address_formats_array as $value) {
- ?>
- <div class="col-md-3">
- <div class="card">
- <div class="card-body">
- <h4 class="card-title">
- $select_array = $CLICSHOPPING_Template->getListCatalogFilesNotIncluded();
- sort($select_array);
- $values_array = explode(';', $values);
- $output = '';
- foreach ($select_array as $file) {
- $output .= HTML::checkboxField('ht_datepicker_jquery_file[]', $file, \in_array($file, $values_array)) . ' ' . HTML::outputProtected($file) . '<br />';
- }
- if (!empty($output)) {
- $output = '<br />' . substr($output, 0, -6);
- $modules = $CLICSHOPPING_EMail->getConfigModules();
- $default_module = 'EM';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_EMail->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- */
- public function install()
- {
- $cut_length = \strlen('CLICSHOPPING_APP_ADMINISTRATOR_MENU_' . $this->code . '_');
- foreach ($this->getParameters() as $key) {
- $p = mb_strtolower(substr($key, $cut_length));
- $class = 'ClicShopping\Apps\Tools\AdministratorMenu\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
- $cfg = new $class($this->code);
- $cut = 'CLICSHOPPING_APP_ADMINISTRATOR_MENU_' . $this->code . '_';
- $cut_length = \strlen($cut);
- foreach ($this->getParameters() as $key) {
- $p = mb_strtolower(substr($key, $cut_length));
- $class = 'ClicShopping\Apps\Tools\AdministratorMenu\Module\ClicShoppingAdmin\Config\\' . $this->code . '\Params\\' . $p;
- $cfg = new $class($this->code);
- $modules = $CLICSHOPPING_OrdersStatus->getConfigModules();
- $default_module = 'OU';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_OrdersStatus->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Currency_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Currency->getConfigModules() as $m) {
- if ($CLICSHOPPING_Currency->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Currency->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Currency->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appCurrencyToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Currency->getConfigModules() as $m) {
- if ($CLICSHOPPING_Currency->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Currency->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Currency->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- public function getDefinitionsFromFile($filename)
- {
- $defs = [];
- if (is_file($filename)) {
- foreach (file($filename) as $line) {
- $line = trim($line);
- if (!empty($line) && (substr($line, 0, 1) != '#')) {
- $delimiter = strpos($line, '=');
- $this->app->db->delete(':table_languages_definitions', $where_array);
- if (\is_array($definition_values)) {
- foreach ($definition_values as $definition_key => $language_definition) {
- foreach ($language_definition as $language_id => $definition_value) {
- $sql_data_array = [
- 'content_group' => $content_group,
- 'definition_key' => $definition_key,
- 'languages_id' => $language_id,
- 'definition_value' => $definition_value
- <?php
- /*
- * Status
- */
- foreach ($HistoryCheckInfo as $value) {
- ?>
- <div class="col-md-12">
- <div class="card">
- <div class="card-header">
- <div class="row">
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- if (!empty($stats['threat_breakdown'])) {
- $html .= "<h3>Threat Breakdown:</h3>";
- $html .= "<table border='1' cellpadding='5' cellspacing='0' style='border-collapse: collapse;'>";
- $html .= "<tr><th>Threat Type</th><th>Count</th><th>Avg Score</th></tr>";
- foreach ($stats['threat_breakdown'] as $threat) {
- $html .= "<tr>";
- $html .= "<td>" . htmlspecialchars($threat['threat_type']) . "</td>";
- $html .= "<td>" . $threat['count'] . "</td>";
- $html .= "<td>" . number_format($threat['avg_score'], 2) . "</td>";
- $html .= "</tr>";
- $CLICSHOPPING_Page = Registry::get('Site')->getPage();
- $files = [];
- foreach (glob(ErrorHandler::getDirectory() . 'errors-*.txt') as $f) {
- $key = basename($f, '.txt');
- if (preg_match('/^errors-([0-9]{4})([0-9]{2})([0-9]{2})$/', $key, $matches)) {
- $files[$key] = [
- 'path' => $f,
- $CLICSHOPPING_EditLogError = Registry::get('EditLogError');
- $CLICSHOPPING_MessageStack = Registry::get('MessageStack');
- $files = [];
- foreach (glob(ErrorHandler::getDirectory() . 'errors-*.txt') as $f) {
- $key = basename($f, '.txt');
- if (preg_match('/^errors-([0-9]{4})([0-9]{2})([0-9]{2})$/', $key, $matches)) {
- $files[$key] = [
- 'path' => $f,
- Mustache.parse(templateLargeImage);
- <?php
- $pi_array = [];
- foreach ($pInfo->products_larger_images as $pi) {
- $pi_array[] = [
- 'counter' => count($pi_array) + 1,
- 'input_file_name' => 'products_image_large_' . $pi['id'],
- 'input_html_content_name' => 'products_image_htmlcontent_' . $pi['id'],
- 'image' => $pi['image'],
- $modules = $CLICSHOPPING_Products->getConfigModules();
- $default_module = 'PD';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Products->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_TotalTax_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Item_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <strong><?php echo CLICSHOPPING::getDef('module_account_customers_history_heading_description'); ?></strong></div>
- <div class="mt-1"></div>
- <div>
- <?php
- if ($ordersTotalRow > 0) {
- foreach ($Qorders->fetchAll() as $order) {
- if (!empty($order['delivery_name'])) {
- $order_type = CLICSHOPPING::getDef('module_account_customers_history_order_shipped_to');
- $order_name = $order['delivery_name'];
- } else {
- $order_type = CLICSHOPPING::getDef('module_account_customers_history_order_billed_to');
- $modules = $CLICSHOPPING_COD->getConfigModules();
- $default_module = 'CO';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_COD->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $result = true;
- $files = [];
- foreach (glob(ErrorHandler::getDirectory() . 'errors-*.txt') as $f) {
- $key = basename($f, '.txt');
- if (preg_match('/^errors-([0-9]{4})([0-9]{2})([0-9]{2})$/', $key, $matches)) {
- $files[$key] = [
- 'path' => $f,
- *
- * @return void
- */
- protected static function _write(\XMLWriter $xml, $data, $parent = null, bool $add_to_parent_element = false)
- {
- foreach ($data as $key => $value) {
- if (is_array($value)) {
- if (is_int($key)) {
- if ($add_to_parent_element === false) {
- $add_to_parent_element = true;
- } elseif (defined('USE_MEMCACHED') && USE_MEMCACHED == 'True' && isset($memcached)) {
- $memcached->set($cache_key, $config_data, $cache_ttl);
- }
- } else {
- // Utiliser les données du cache
- foreach ($cached_config as $key => $value) {
- define($key, $value);
- }
- }
- // set the session name and save path
- public static function resolveRoute(array $route, array $routes)
- {
- $result = [];
- foreach ($routes as $vendor_app => $paths) {
- foreach ($paths as $path => $page) {
- $path_array = explode('&', $path);
- if (count($path_array) <= count($route)) {
- if ($path_array == array_slice($route, 0, count($path_array))) {
- $result[] = [
- $Qreviews->execute();
- $reviews_array = $Qreviews->fetchAll();
- $total = 0;
- foreach ($reviews_array as $value) {
- $customer_tag_array = explode(',', $value['customers_tag']);
- $total += count($customer_tag_array);
- }
- return $total;
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- }
- }
- // Also process workingMemory migrations (for backward compatibility)
- $migrations = $this->workingMemory->get('interactions_to_migrate', []);
- foreach ($migrations as $record) {
- $age = $now - $record['stored_at'];
- if ($age > self::TTL_SHORT_TERM) {
- // Already handled by database query above
- $migrated++;
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Stripe_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </table>
- <div class="mt-1"></div>
- <table border="0" cellspacing="0" cellpadding="2" width="100%">
- <?php
- foreach ($order->totals as $value) {
- echo ' <tr>' . "\n" .
- ' <td class="text-end"><strong>' . $value['title'] . '</strong></td>' . "\n" .
- ' <td class="text-end"><strong>' . strip_tags($value['text']) . '</strong></td>' . "\n" .
- ' </tr>' . "\n";
- }
- <div class="col-md-12">
- <div class="row">
- <?php
- $i = 0;
- foreach ($result_files as $value) {
- $CLICSHOPPING_Marketplace->getFilesInformations($value['file_id']);
- $Qfilesinformation = $CLICSHOPPING_Upgrade->db->prepare('select file_id,
- file_name,
- file_version,
- $modules = $CLICSHOPPING_Suppliers->getConfigModules();
- $default_module = 'CS';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Suppliers->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $CLICSHOPPING_Template = Registry::get('Template');
- if (isset($this->_data[$parent_id])) {
- $result = '';
- foreach ($this->_data[$parent_id] as $category_id => $category) {
- if ($this->breadcrumb_usage === true) {
- $category_link = $this->buildBreadcrumb($category_id);
- } else {
- $category_link = $category_id;
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $modules = $CLICSHOPPING_Orders->getConfigModules();
- $default_module = 'OD';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Orders->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_ChatGpt->getConfigModules() as $m) {
- if ($CLICSHOPPING_ChatGpt->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_ChatGpt->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ChatGpt->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_ChatGpt_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appChatGptToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_ChatGpt->getConfigModules() as $m) {
- if ($CLICSHOPPING_ChatGpt->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_ChatGpt->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_ChatGpt->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- ?>
- $modules = $CLICSHOPPING_Manufacturers->getConfigModules();
- $default_module = 'CM';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Manufacturers->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- * After deletion, redirects to the DynamicPricingRules page.
- */
- public function execute()
- {
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $Qdelete = $this->app->db->prepare('delete
- from :table_dynamic_pricing_rules
- where rules_id = :rules_id
- ');
- $Qdelete->bindInt(':rules_id', $id);
- $modules = $CLICSHOPPING_ProductsQuantityUnit->getConfigModules();
- $default_module = 'PQ';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_ProductsQuantityUnit->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $CLICSHOPPING_Db = Registry::get('Db');
- if (isset($_GET['Update'])) {
- $set = $_GET['set'] ?? '';
- foreach ($_POST['configuration'] as $key => $value) {
- if ((\is_array($value)) && (!empty($value))) {
- $key = HTML::sanitize($key);
- $value = HTML::sanitize($value);
- $pages = '';
- <h4><?php echo CLICSHOPPING::getDef('text_product_options'); ?></h4>
- </div>
- <div>
- <div class="col-md-6">
- <?php
- foreach ($products_options_name_array as $key => $value) {
- ?>
- <div>
- <label class="col-md-3"><?php echo $key . ':'; ?></label>
- <div class="col-md-9">
- <?php echo HTML::selectMenu('id[' . $value . ']', $products_options_array[$value], $selected_attribute[$value]); ?>
- public function clearCache(): bool
- {
- $files = glob($this->cacheDir . '*.json');
- $success = true;
- foreach ($files as $file) {
- if (!@unlink($file)) {
- $success = false;
- }
- }
- $files = glob($this->cacheDir . '*.json');
- $totalSize = 0;
- $oldestTime = PHP_INT_MAX;
- $newestTime = 0;
- foreach ($files as $file) {
- $totalSize += filesize($file);
- $mtime = filemtime($file);
- $oldestTime = min($oldestTime, $mtime);
- $newestTime = max($newestTime, $mtime);
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- for ($i = 0, $n = \count($CLICSHOPPING_Order->products); $i < $n; $i++) {
- $order_total += $CLICSHOPPING_Currencies->calculatePrice($CLICSHOPPING_Order->products[$i]['final_price'], $CLICSHOPPING_Order->products[$i]['tax'], $CLICSHOPPING_Order->products[$i]['qty']);
- if (isset($CLICSHOPPING_Order->products[$i]['attributes'])) {
- foreach ($CLICSHOPPING_Order->products[$i]['attributes'] as $option => $value) {
- $Qcheck = $CLICSHOPPING_Db->prepare('select pa.products_id
- from :table_products_attributes pa,
- :table_products_attributes_download pad
- where pa.products_id = :products_id
- and pa.options_values_id = :options_values_id
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $modules = $CLICSHOPPING_TemplateEmail->getConfigModules();
- $default_module = 'TE';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_TemplateEmail->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $modules = $CLICSHOPPING_Favorites->getConfigModules();
- $default_module = 'FA';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Favorites->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- }
- public function execute()
- {
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $Qdelete = $this->app->db->prepare('delete
- from :table_suppliers
- where suppliers_id = :suppliers_id
- ');
- $Qdelete->bindInt(':suppliers_id', $id);
- $modules = $CLICSHOPPING_Zones->getConfigModules();
- $default_module = 'ZN';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Zones->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $Qcurrencies->execute();
- $Qcurrencies->setCache('currencies');
- $currencies = $Qcurrencies->fetchAll();
- foreach ($currencies as $c) {
- $this->currencies[$c['code']] = [
- 'id' => (int)$c['id'],
- 'title' => $c['title'],
- 'symbol_left' => $c['symbol_left'],
- 'symbol_right' => $c['symbol_right'],
- */
- private function cronJob(): void
- {
- $results = $this->getExpires();
- foreach ($results as $result) {
- $cron_id_gdpr = Cron::getCronCode('gdpr');
- if (isset($_GET['cronId'])) {
- $cron_id = HTML::sanitize($_GET['cronId']);
- $modules = $CLICSHOPPING_Gdpr->getConfigModules();
- $default_module = 'GD';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Gdpr->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $modules = $CLICSHOPPING_PageManager->getConfigModules();
- $default_module = 'PM';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_PageManager->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $modules = $CLICSHOPPING_SecurityCheck->getConfigModules();
- $default_module = 'SC';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_SecurityCheck->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $modules = $CLICSHOPPING_TaxRates->getConfigModules();
- $default_module = 'TR';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_TaxRates->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- {
- public function getInfo($app, $key, $data)
- {
- $result = [];
- foreach ($data as $code => $class) {
- $class = $this->ns . $app . '\\' . $class;
- if (is_subclass_of($class, 'ClicShopping\OM\Modules\\' . $this->code . 'Interface')) {
- $result[$key . DIRECTORY_SEPARATOR . $app . '\\' . $code] = $class;
- }
- $modules = $CLICSHOPPING_Currency->getConfigModules();
- $default_module = 'CR';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Currency->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $modules = $CLICSHOPPING_TaxGeoZones->getConfigModules();
- $default_module = 'TG';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_TaxGeoZones->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $modules = $CLICSHOPPING_StatsProductsNotification->getConfigModules();
- $default_module = 'PN';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_StatsProductsNotification->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- }
- public function getToolSchemas(): array
- {
- $schemas = [];
- foreach ($this->tools as $class) {
- /** @var ActionToolsInterface $toolInstance */
- $toolInstance = new $class();
- $schemas[] = [
- 'name' => $toolInstance->getName(),
- 'description' => $toolInstance->getDescription(),
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- HTML::checkboxField('masterblaster')
- ];
- $table_data = [];
- foreach ($_POST['id'] as $table) {
- $current_table = null;
- $Qaction = $CLICSHOPPING_DataBaseTables->db->query($action . ' table ' . $table);
- while ($Qaction->fetch()) {
- );
- }
- $table_data = [];
- foreach ($_POST['id'] as $table) {
- $result = 'OK';
- $queries = [];
- $Qcols = $CLICSHOPPING_DataBaseTables->db->query('SHOW FULL COLUMNS FROM ' . $table);
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- // Obtenir tous les fichiers CSS de façon sécurisée
- $files_array = get_files_secure($root_dir);
- // Créer les chemins relatifs
- $files_css_replace = [];
- foreach ($files_array as $file) {
- $relative = str_replace($root_dir . DIRECTORY_SEPARATOR, '', $file);
- $relative = str_replace(DIRECTORY_SEPARATOR, '/', $relative);
- $files_css_replace[] = $relative;
- }
- <div class="mt-1"></div>
- <div class="card-text">
- <div class="row">
- <?php
- foreach ($Qstatuse as $value) {
- $customer_support = HistoryInfo::getHistoryInfoSupportCustomer($value['orders_status_support_id']);
- echo '<div class="mt-1"></div>';
- echo '<div class="col-md-12">';
- echo '<span class="col-md-4 text-muted"><i class="bi bi-arrow-right-square-fill" aria-hidden="true"> </i>' . DateTime::toShort($value['date_added']) . '</span> ';
- ]);
- return false;
- }
- foreach ($Qips as $allowedIp) {
- $ip = $allowedIp['ip'];
- if ($ip === '127.0.0.1' || $ip === 'localhost') {
- if (in_array($clientIp, ['127.0.0.1', '::1'])) {
- self::logSecurityEvent('Localhost access granted', [
- $modules = $CLICSHOPPING_Table->getConfigModules();
- $default_module = 'TA';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Table->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $modules = $CLICSHOPPING_WhosOnline->getConfigModules();
- $default_module = 'WO';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_WhosOnline->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $CLICSHOPPING_Page = Registry::get('Site')->getPage();
- $files = [];
- foreach (glob(ErrorHandler::getDirectory() . 'phpmail_error-*.txt') as $f) {
- $key = basename($f, '.txt');
- if (preg_match('/^phpmail_error-([0-9]{4})([0-9]{2})([0-9]{2})$/', $key, $matches)) {
- $files[$key] = [
- 'path' => $f,
- private function extractUrls(array $resultData, bool $hasResults, bool $hasUrls): array
- {
- $urls = [];
- if ($hasResults) {
- foreach ($resultData['results'] as $item) {
- if (isset($item['url'])) {
- $urls[] = $item['url'];
- } elseif (isset($item['link'])) {
- $urls[] = $item['link'];
- }
- $result = true;
- $files = [];
- foreach (glob(ErrorHandler::getDirectory() . 'phpmail_error-*.txt') as $f) {
- $key = basename($f, '.txt');
- if (preg_match('/^phpmail_error-([0-9]{4})([0-9]{2})([0-9]{2})$/', $key, $matches)) {
- $files[$key] = [
- 'path' => $f,
- </thead>
- <tbody>
- <?php
- $mostRecommendedProducts = $CLICSHOPPING_RecommendationsAdmin->getMostRecommendedProducts($limit, $customers_group_id, $date);
- foreach ($mostRecommendedProducts as $product) {
- $productId = $product['products_id'];
- $productName = $CLICSHOPPING_ProductsAdmin->getProductsName($productId, $CLICSHOPPING_Language->getId());
- $recommendationCount = $product['recommendation_count'];
- $score = $product['score'];
- ?>
- </thead>
- <tbody>
- <?php
- $rejectedProducts = $CLICSHOPPING_RecommendationsAdmin->getRejectedProducts($limit, $customers_group_id, $date);
- foreach ($rejectedProducts as $product) {
- $productId = $product['products_id'];
- $productName = $CLICSHOPPING_ProductsAdmin->getProductsName($productId, $CLICSHOPPING_Language->getId());
- $rejectionCount = $product['rejection_count'];
- $rejectionScore = $product['score'];
- ?>
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- }
- if ($products[$i]['attributes']) {
- $subindex = 0;
- foreach ($products[$i]['attributes'] as $option => $value) {
- $Qattributes = $CLICSHOPPING_ProductsAttributes->getProductsAttributesInfo($products[$i]['id'], $option, $value, $this->lang->getId());
- $this->products[$index]['attributes'][$subindex] = ['option' => $Qattributes->value('products_options_name'),
- 'value' => $Qattributes->value('products_options_values_name'),
- $name = (!empty($key) ? 'configuration[' . $key . ']' : 'configuration_value');
- $countries_array = [];
- foreach ($CLICSHOPPING_Address->getCountries() as $country) {
- $countries_array[] = ['id' => $country['countries_id'],
- 'text' => $country['countries_name']
- ];
- }
- if (isset($results['source_attribution'])) {
- $output .= $this->formatSourceAttribution($results['source_attribution']);
- }
- // Process each sub-query result
- foreach ($multipleResults as $index => $subResult) {
- $subQueryNum = $index + 1;
- $subQuery = $subResult['query'] ?? $this->language->getDef('text_rag_analytics_sub_query') . " {$subQueryNum}";
- $output .= "<div class='sub-query-result' style='margin: 20px 0; padding: 15px; border: 1px solid #ddd; border-radius: 5px;'>";
- $output .= "<h5 style='color: #0066cc;'>📊 " . $this->language->getDef('text_rag_analytics_query') . " {$subQueryNum} : " . htmlspecialchars($subQuery) . "</h5>";
- ];
- $i = 0;
- if (\count($CLICSHOPPING_Order->products) < 7) {
- foreach ($CLICSHOPPING_Order->products as $product) {
- $i++;
- $metadata['product_' . $i . '_name'] = $product['name'];
- $metadata['product_' . $i . '_model'] = $product['model'];
- $metadata['product_' . $i . '_id'] = $product['id'];
- */
- private function exportToCsv(array $data): string
- {
- $output = "timestamp,latency,error_rate,requests,uptime\n";
- foreach ($data['history'] as $point) {
- $output .= sprintf("%d,%.2f,%.2f,%d,%.2f\n",
- $point['timestamp'],
- $point['latency'],
- $point['error_rate'],
- $point['requests'],
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- }
- }
- // Si c'est un résultat analytique avec des agrégations
- if (isset($depResult['type']) && $depResult['type'] === 'aggregated_result') {
- foreach ($depResult['results'] as $aggResult) {
- foreach ($aggResult as $key => $value) {
- if (is_numeric($value)) {
- $safeKey = preg_replace('/[^a-z0-9_]/i', '_', $key);
- $variables[$depId . '_' . $safeKey] = $value;
- }
- }
- // Si c'est un résultat analytique avec des agrégations
- if (isset($depResult['type']) && $depResult['type'] === 'aggregated_result') {
- foreach ($depResult['results'] as $aggResult) {
- foreach ($aggResult as $key => $value) {
- if (is_numeric($value)) {
- $safeKey = preg_replace('/[^a-z0-9_]/i', '_', $key);
- $variables[$depId . '_' . $safeKey] = $value;
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $CLICSHOPPING_Hooks = Registry::get('Hooks');
- $page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
- if (isset($_POST['selected']) && isset($_GET['DeleteAll'])) {
- foreach ($_POST['selected'] as $id) {
- $CLICSHOPPING_Customers->db->delete('address_book', ['customers_id' => $id]);
- $CLICSHOPPING_Customers->db->delete('customers', ['customers_id' => $id]);
- $CLICSHOPPING_Customers->db->delete('customers_info', ['customers_info_id' => $id]);
- $CLICSHOPPING_Customers->db->delete('customers_basket', ['customers_id' => $id]);
- $CLICSHOPPING_Customers->db->delete('customers_basket_attributes', ['customers_id' => $id]);
- $modules = $CLICSHOPPING_Total->getConfigModules();
- $default_module = 'TO';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Total->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_COD_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">Install</a>
- <div class="dropdown-menu">
- <?php
- foreach ($CLICSHOPPING_Orders->getConfigModules() as $m) {
- if ($CLICSHOPPING_Orders->getConfigModuleInfo($m, 'is_installed') === false) {
- echo '<a class="dropdown-item" href="' . $CLICSHOPPING_Orders->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Orders->getConfigModuleInfo($m, 'title') . '</a>';
- }
- }
- ?>
- </div>
- <div class="mt-1"></div>
- <ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="appOrdersToolbar">
- <li class="nav-item">
- <?php
- foreach ($CLICSHOPPING_Orders->getConfigModules() as $m) {
- if ($CLICSHOPPING_Orders->getConfigModuleInfo($m, 'is_installed') === true) {
- echo '<li class="nav-link active" data-module="' . $m . '"><a href="' . $CLICSHOPPING_Orders->link('Configure&module=' . $m) . '">' . $CLICSHOPPING_Orders->getConfigModuleInfo($m, 'short_title') . '</a></li>';
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Orders_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- public function execute()
- {
- $page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $this->app->db->delete('rag_websearch', ['id' => (int)$id]);
- }
- }
- $this->app->redirect('RagWebSearch&page=' . $page);
- $modules = $CLICSHOPPING_Cronjob->getConfigModules();
- $default_module = 'CJ';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Cronjob->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- * @return void
- */
- public function execute()
- {
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $this->removeReviews($id);
- $this->removeReviewsSentiment($id);
- }
- } elseif (isset($_POST['products_id'])) {
- $id = HTML::sanitize($_POST['products_id']);
- $parts[] = "Examples:\n" . $sections['examples'];
- }
- // Add conversation history
- if (!empty($sections['conversation'])) {
- foreach ($sections['conversation'] as $message) {
- $role = ucfirst($message['role']);
- $parts[] = "{$role}: {$message['content']}";
- }
- }
- );
- // TASK 5.2.1.3: Extract document names from search results for source attribution
- $documentNames = [];
- if (!empty($searchResults['results'])) {
- foreach ($searchResults['results'] as $result) {
- $metadata = $result['metadata'] ?? [];
- // Try to extract document name from metadata
- $docName = null;
- $possibleFields = ['title', 'document_name', 'name', 'page_title', 'product_name', 'category_name', 'pages_title'];
- foreach ($this->modules as $value) {
- if (str_contains($value, '\\')) {
- $obj = Registry::get('Shipping_' . str_replace('\\', '_', $value));
- if ($obj->enabled) {
- foreach ($obj->quotes['methods'] as $method) {
- if (isset($method['cost']) && !is_null($method['cost'])) {
- return [
- 'id' => $obj->quotes['id'] . '_' . $method['id'],
- 'title' => $obj->quotes['module'] . (isset($method['title']) && !empty($method['title']) ? ' (' . $method['title'] . ')' : ''),
- 'info' => $obj->quotes['info'] . (isset($method['info']) && !empty($method['info']) ? ' (' . $method['info'] . ')' : ''),
- // Module de livraison autorise
- if (isset($_POST['shipping_unallowed'])) {
- $group_shipping_unallowed = '';
- foreach ($_POST['shipping_unallowed'] as $key => $val) {
- if (isset($val)) {
- $group_shipping_unallowed .= $val . ',';
- }
- }
- // Module de paiement autorise
- if (isset($_POST['payment_unallowed'])) {
- $group_payment_unallowed = '';
- foreach ($_POST['payment_unallowed'] as $key => $val) {
- if (isset($val)) {
- $group_payment_unallowed .= $val . ',';
- }
- }
- $modules = $CLICSHOPPING_Specials->getConfigModules();
- $default_module = 'SP';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Specials->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $modules = $CLICSHOPPING_Backup->getConfigModules();
- $default_module = 'BC';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Backup->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $customer_data = [];
- $result = $Qapi->fetchAll();
- foreach ($result as $value) {
- $customer_data[] = [
- 'orders_id' => $value['orders_id'],
- 'customers_id' => $value['customers_id'],
- 'customers_company' => $value['customers_company'],
- 'customers_siret' => $value['customers_siret'],
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_SubTotal_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $modules = $CLICSHOPPING_ProductsAttributes->getConfigModules();
- $default_module = 'PA';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_ProductsAttributes->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $modules = $CLICSHOPPING_ChatGpt->getConfigModules();
- $default_module = 'CH';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_ChatGpt->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_TotalShipping_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $CLICSHOPPING_Page = Registry::get('Site')->getPage();
- $files = [];
- foreach (glob(ErrorHandler::getDirectory() . 'phpmail_error-*.txt') as $f) {
- $key = basename($f, '.txt');
- if (preg_match('/^phpmail_error-([0-9]{4})([0-9]{2})([0-9]{2})$/', $key, $matches)) {
- $files[$key] = [
- 'path' => $f,
- $modules = $CLICSHOPPING_SecDirPermissions->getConfigModules();
- $default_module = 'SP';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_SecDirPermissions->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- * @param int $maxlifetime The maximum lifetime (in seconds) for session files before they are considered expired.
- * @return bool Returns true upon completion of cleanup.
- */
- public function gc(int $maxlifetime): bool
- {
- foreach (glob($this->path . '/sess_*', GLOB_NOSORT) as $file) {
- if (filemtime($file) + $maxlifetime < time()) {
- unlink($file);
- }
- }
- {
- $CLICSHOPPING_Gdpr = Registry::get('Gdpr');
- $page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- GdprAdmin::deleteCustomersData($id);
- }
- }
- $CLICSHOPPING_Gdpr->redirect('Customers', 'page=' . $page);
- if (empty($documents)) {
- return null;
- }
- // Iterate through documents to find one with entity metadata
- foreach ($documents as $doc) {
- $metadata = null;
- // Handle both object and array document formats
- if (is_object($doc) && isset($doc->metadata)) {
- $metadata = $doc->metadata;
- if (is_file(self::BASE_DIR . 'Custom/Conf/global.php')) {
- self::loadConfigFile(self::BASE_DIR . 'Custom/Conf/global.php', 'global');
- }
- foreach (glob(self::BASE_DIR . 'Sites/*', GLOB_ONLYDIR) as $s) {
- $s = basename($s);
- if (self::siteExists($s, false) && is_file(self::BASE_DIR . 'Sites/' . $s . '/site_conf.php')) {
- self::loadConfigFile(self::BASE_DIR . 'Sites/' . $s . '/site_conf.php', $s);
- if (is_file(self::BASE_DIR . 'Custom/Sites/' . $s . '/site_conf.php')) {
- $p95 = $this->percentile($values, 95);
- $p99 = $this->percentile($values, 99);
- // Écart-type
- $variance = 0;
- foreach ($values as $value) {
- $variance += pow($value - $mean, 2);
- }
- $stddev = sqrt($variance / $count);
- return [
- <td class="text-end"><?php echo $CLICSHOPPING_Api->getDef('text_action'); ?></td>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach ($result as $value) {
- ?>
- <tr>
- <td><?php echo $value['ip']; ?></td>
- <td><?php echo $value['comment']; ?></td>
- <td class="text-end">
- <td class="text-end"><?php echo $CLICSHOPPING_Api->getDef('text_action'); ?></td>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach ($result as $value) {
- ?>
- <tr>
- <td><?php echo $value['session_id']; ?></td>
- <td><?php echo $value['ip']; ?></td>
- <td><?php echo $value['date_added']; ?></td>
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- if (!empty($interpretationResults)) {
- // Find the interpretation with the most results
- $bestInterpretation = null;
- $maxResults = 0;
- foreach ($interpretationResults as $key => $interpretation) {
- $resultCount = count($interpretation['results'] ?? []);
- error_log(" Interpretation '{$key}': {$resultCount} results");
- error_log(" Has 'interpretation' key: " . (isset($interpretation['interpretation']) ? 'YES' : 'NO'));
- if (isset($interpretation['interpretation'])) {
- error_log(" Interpretation text: " . substr($interpretation['interpretation'], 0, 100));
- $modules = $CLICSHOPPING_Weight->getConfigModules();
- $default_module = 'WE';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Weight->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- *
- * @param int $now Current timestamp
- */
- private function cleanupStorage(int $now): void
- {
- foreach ($this->storage as $key => $data) {
- if (isset($data['first_request']) && $data['first_request'] < ($now - ($this->timeWindow * 2))) {
- unset($this->storage[$key]);
- }
- }
- }
- {
- // Simple decomposition by connectors
- $parts = preg_split('/\s+(' . implode('|', self::CONNECTORS) . ')\s+/i', $query);
- $sub_queries = [];
- foreach ($parts as $index => $part) {
- $part = trim($part);
- if (empty($part)) continue;
- $sub_queries[] = [
- 'type' => $this->guessQueryType($part, $detection_result),
- {
- $query_lower = mb_strtolower($query_part);
- // Web search for competitor queries
- if (!empty($detection_result['requires_web_search'])) {
- foreach (self::HYBRID_PATTERNS['competitor'] as $keyword) {
- if (preg_match('/\b' . preg_quote($keyword, '/') . '\b/i', $query_lower)) {
- return 'web_search';
- }
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $modules = $CLICSHOPPING_TotalTax->getConfigModules();
- $default_module = 'TX';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_TotalTax->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- ]);
- return false;
- }
- foreach ($Qips as $allowedIp) {
- $ip = $allowedIp['ip'];
- if ($ip === '127.0.0.1' || $ip === 'localhost') {
- if (in_array($clientIp, ['127.0.0.1', '::1'])) {
- self::logSecurityEvent('Localhost access granted', [
- $modules = $CLICSHOPPING_OrdersStatusInvoice->getConfigModules();
- $default_module = 'OI';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_OrdersStatusInvoice->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $modules = $CLICSHOPPING_Reviews->getConfigModules();
- $default_module = 'RV';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Reviews->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- if (isset($_GET['nID'])) {
- $nID = HTML::sanitize($_GET['nID']);
- }
- if (isset($_POST['selected'])) {
- foreach ($_POST['selected'] as $id) {
- $Qdelete = $CLICSHOPPING_Newsletter->db->prepare('delete
- from :table_newsletters
- where newsletters_id = :newsletters_id
- ');
- $Qdelete->bindInt(':newsletters_id', $id);
- $Qapi->execute();
- $manufacturers_data = [];
- foreach ($Qapi->fetchAll() as $row) {
- $manufacturers_data[] = [
- 'manufacturers_id' => $row['manufacturers_id'],
- 'languages_id' => $row['languages_id'],
- 'manufacturers_name' => $row['manufacturers_name'],
- 'date_added' => $row['date_added'],
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $score += 0.2;
- }
- // Résultats pertinents
- $relevantCount = 0;
- foreach ($results['items'] ?? [] as $item) {
- if (($item['relevance_score'] ?? 0) > 0.7) {
- $relevantCount++;
- }
- }
- $score += min($relevantCount * 0.1, 0.3);
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $modules = $CLICSHOPPING_Categories->getConfigModules();
- $default_module = 'CT';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Categories->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- for ($i = 0, $n = \count($CLICSHOPPING_Order->products); $i < $n; $i++) {
- $number_of_items += $CLICSHOPPING_Order->products[$i]['qty'];
- if (isset($CLICSHOPPING_Order->products[$i]['attributes'])) {
- foreach ($CLICSHOPPING_Order->products[$i]['attributes'] as $option => $value) {
- $Qcheck = $CLICSHOPPING_Db->prepare('select pa.products_id
- from :table_products_attributes pa,
- :table_products_attributes_download pad
- where pa.products_id = :products_id
- and pa.options_values_id = :options_values_id
- $this->init();
- $current_module = $this->getCurrentModule();
- $m = $this->getConfigModule($current_module);
- foreach ($m->getParameters() as $key) {
- $p = mb_strtolower($key);
- if (isset($_POST[$p])) {
- $this->app->saveCfgParam($key, $_POST[$p]);
- }
- $modules = $CLICSHOPPING_Customers->getConfigModules();
- $default_module = 'CS';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Customers->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- $modules = $CLICSHOPPING_Members->getConfigModules();
- $default_module = 'ME';
- foreach ($modules as $m) {
- if ($CLICSHOPPING_Members->getConfigModuleInfo($m, 'is_installed') === true) {
- $default_module = $m;
- break;
- }
- }
- <div class="adminformTitle">
- <div class="card-block">
- <p class="card-text">
- <?php
- foreach ($CLICSHOPPING_Table_Config->getInputParameters() as $cfg) {
- echo '<div>' . $cfg . '</div>';
- echo '<div class="mt-1"></div>';
- }
- ?>
- </p>
- $Qapi->execute();
- $product_data = [];
- foreach ($Qapi->fetchAll() as $row) {
- $product_data[] = [
- 'products_id' => $row['products_id'],
- 'language_id' => $row['language_id'],
- 'products_name' => $row['products_name'],
- 'products_description' => $row['products_description'],
Your project should not contain unused code 108
- Read doc
- Productivity
- Minor
More information: https://insight.symfony.com/what-we-analyse/php.unused_local_variable_or_private_member
- * Validates the category data before updating.
- *
- * @param array $data The category data to validate
- * @return array An array containing validation result and errors if any
- */
- private static function validateCategoryData(array $data): array
- {
- $errors = [];
- // Validate required fields if provided
- if (isset($data['categories_name']) && empty(trim($data['categories_name']))) {
- *
- * @param int $id The category ID to update
- * @param array $data The category data to update
- * @return array An array containing the result of the update operation
- */
- private static function updateCategory(int $id, array $data): array
- {
- $CLICSHOPPING_Db = Registry::get('Db');
- try {
- $CLICSHOPPING_Db->beginTransaction();
- * Returns a float score between 0.0 and 1.0 based on the number of citations.
- *
- * @param string $result The AI-generated response to validate.
- * @return float Attribution score (0.0 to 1.0).
- */
- private static function validateAttribution(string $result): float
- {
- $citations = substr_count($result, 'source:') + substr_count($result, '(voir') + preg_match_all('/\[.*?\]/', $result);
- if ($citations === 0) {
- return 0.0;
- private const CONFIDENCE_THRESHOLD = 0.75;
- private const MAX_RESPONSE_LENGTH = 8192;
- private const MIN_CONFIDENCE_SCORE = 0.6;
- protected static ?SecurityLogger $securityLogger = null;
- private static mixed $language = null;
- private static bool $debug = false;
- // Pondérations configurables pour le calcul du score global
- private const WEIGHTS = [
- 'structural' => 0.2,
- #[AllowDynamicProperties]
- class StepExecutor
- {
- private SecurityLogger $logger;
- private bool $debug;
- private int $maxIterations;
- /**
- * Constructor
- *
- * @param bool $debug Enable debug logging
- */
- class Hash
- {
- private static $key; // 32 caractères pour AES-256
- private static $cipher = 'aes-256-cbc'; // Algorithme de chiffremen
- private const EMAIL_PREFIX = 'ENC::'; // Préfixe pour identifier un email chiffré
- /**
- * Hash constructor.
- * @access public
- *
- *
- * @param string $message The chat message.
- * @param mixed $context The chat context.
- * @return void
- */
- private function redirectToRagBI(string $message, mixed $context): void
- {
- // Build the RAG BI URL
- $ragBiUrl = $this->app->getRagBIEndpoint();
- // Prepare data for RAG BI
- * Checks if the user is an administrator based on the context array.
- *
- * @param array $context The context containing user information.
- * @return bool True if the user is an admin, otherwise false.
- */
- private function isAdmin(array $context): bool
- {
- return isset($context['user_type']) && $context['user_type'] === 'admin';
- }
- /**
- /**
- * Handle GET request
- */
- private function handleGetRequest(array $statusCheck)
- {
- if ($statusCheck['get'] == 0) {
- return $this->sendErrorResponse('Category fetch not allowed');
- }
- }
- /**
- * Handle POST request
- */
- private function handlePostRequest(array $statusCheck)
- {
- if (isset($_GET['update']) && $statusCheck['update'] == 0) {
- return $this->sendErrorResponse('Category update not allowed');
- }
- *
- * @param string $string The column name to be selected from the database.
- * @param string $token The session token used for identifying the API session.
- * @return int The integer value associated with the specified column.
- */
- private function statusCheck(string $string, string $token): int
- {
- $QstatusCheck = $this->db->prepare( // Correction: use $this->db instead of $this->Db
- 'select a.' . $string . '
- from :table_mcp a,
- :table_mcp_session ase
- }
- /**
- * Handle PUT request
- */
- private function handlePutRequest(array $statusCheck)
- {
- if (!$statusCheck['update'] == 0) {
- return $this->sendErrorResponse('Update not allowed');
- }
- /**
- * Handle DELETE request
- */
- private function handleDeleteRequest(array $statusCheck)
- {
- if ($statusCheck['delete'] == 0) {
- return $this->sendErrorResponse('Category deletion not allowed');
- }
- ];
- /**
- * @var callable|null A callback function to handle incoming messages asynchronously.
- */
- private $messageCallback = null;
- /**
- * StdioTransport constructor.
- *
- * Initializes the transport with configuration and an optional logger, and validates
- private string $status = 'pending'; // pending, in_progress, completed, failed
- private array $stepResults = [];
- private ?string $finalResult = null;
- private float $executionTime = 0.0;
- private ?AnalyticsAgent $analyticsAgent = null;
- private ?MultiDBRAGManager $ragManager = null;
- private bool $debug;
- private string $userId;
- private int $languageId;
- private ?string $finalResult = null;
- private float $executionTime = 0.0;
- private ?AnalyticsAgent $analyticsAgent = null;
- private ?MultiDBRAGManager $ragManager = null;
- private bool $debug;
- private string $userId;
- private int $languageId;
- private ?CalculatorTool $calculatorTool = null;
- private ?WebSearchTool $webSearchTool = null; // 🆕 Outil de recherche web
- private ?MultiDBRAGManager $ragManager = null;
- private bool $debug;
- private string $userId;
- private int $languageId;
- private ?CalculatorTool $calculatorTool = null;
- private ?WebSearchTool $webSearchTool = null; // 🆕 Outil de recherche web
- /**
- * Constructor
- private array $stepResults = [];
- private ?string $finalResult = null;
- private float $executionTime = 0.0;
- private ?AnalyticsAgent $analyticsAgent = null;
- private ?MultiDBRAGManager $ragManager = null;
- private bool $debug;
- private string $userId;
- private int $languageId;
- private ?CalculatorTool $calculatorTool = null;
- private ?AnalyticsAgent $analyticsAgent = null;
- private ?MultiDBRAGManager $ragManager = null;
- private bool $debug;
- private string $userId;
- private int $languageId;
- private ?CalculatorTool $calculatorTool = null;
- private ?WebSearchTool $webSearchTool = null; // 🆕 Outil de recherche web
- private bool $debug;
- private string $userId;
- private int $languageId;
- private ?CalculatorTool $calculatorTool = null;
- private ?WebSearchTool $webSearchTool = null; // 🆕 Outil de recherche web
- /**
- * Constructor
- *
- private float $executionTime = 0.0;
- private ?AnalyticsAgent $analyticsAgent = null;
- private ?MultiDBRAGManager $ragManager = null;
- private bool $debug;
- private string $userId;
- private int $languageId;
- private ?CalculatorTool $calculatorTool = null;
- private ?WebSearchTool $webSearchTool = null; // 🆕 Outil de recherche web
- * Cache entries expire after 1 hour (TRANSLATION_CACHE_TTL).
- *
- * @param string $query Query to translate
- * @return string Translated query in English
- */
- private function translateToEnglishCached(string $query): string
- {
- // Generate cache key
- $cacheKey = md5($query);
- // Check if translation is cached and not expired
- // 🆕 Refactored components
- private StepExecutor $stepExecutor;
- private AnalyticsExecutor $analyticsExecutor;
- private SemanticExecutor $semanticExecutor;
- private ToolExecutor $toolExecutor;
- private ResultSynthesizer $resultSynthesizer;
- /**
- * Constructor
- *
- private string $userId;
- private int $languageId;
- // Configuration
- private int $maxRetries = 2;
- private bool $enableParallelExecution = false; // Pour future implémentation
- private ?CalculatorTool $calculatorTool = null;
- private mixed $webSearchTool;
- private mixed $cacheManager;
- private mixed $collector;
- #[AllowDynamicProperties]
- class PlanExecutor
- {
- private SecurityLogger $securityLogger;
- private TaskPlanner $planner;
- private ?AnalyticsAgent $analyticsAgent = null;
- private ?MultiDBRAGManager $ragManager = null;
- private bool $debug;
- private string $userId;
- private int $languageId;
- private int $maxRetries = 2;
- private bool $enableParallelExecution = false; // Pour future implémentation
- private ?CalculatorTool $calculatorTool = null;
- private mixed $webSearchTool;
- private mixed $cacheManager;
- private mixed $collector;
- // 🆕 Refactored components
- private StepExecutor $stepExecutor;
- private AnalyticsExecutor $analyticsExecutor;
- class PlanExecutor
- {
- private SecurityLogger $securityLogger;
- private TaskPlanner $planner;
- private ?AnalyticsAgent $analyticsAgent = null;
- private ?MultiDBRAGManager $ragManager = null;
- private bool $debug;
- private string $userId;
- private int $languageId;
- // Configuration
- class TaskPlanner
- {
- private SecurityLogger $securityLogger;
- private mixed $chat;
- private bool $debug;
- private int $languageId;
- private MetricsCollector $collector;
- // SubTaskPlanners spécialisés
- private array $subTaskPlanners = [];
- *
- * PURE LLM MODE: Returns default suggestions
- *
- * @return array List of suggested questions
- */
- private function generateVagueSuggestions(): array
- {
- // PURE LLM MODE: Return default suggestions
- return [
- "Rechercher un produit",
- "Voir les commandes",
- // Configuration
- private float $confidenceThreshold = 0.7;
- private int $maxSimilarCases = 5;
- private mixed $db;
- /**
- * Constructor
- *
- * @param string $userId Identifiant de l'utilisateur
- private Cache $cache;
- private bool $debug;
- private string $userId;
- private int $languageId;
- private mixed $language;
- private mixed $chat;
- // Stratégies de correction
- private array $correctionStrategies = [];
- // Statistiques d'apprentissage
- * This is a helper method to aggregate the statuses. An error in any check results in an overall 'error'.
- *
- * @param array $checks An array of check results, each with a 'status' key.
- * @return string The overall status: 'error', 'warning', or 'healthy'.
- */
- private function determineOverallStatus(array $checks): string
- {
- if (in_array('error', array_column($checks, 'status'))) {
- return 'error';
- }
- if (in_array('warning', array_column($checks, 'status'))) {
- */
- #[AllowDynamicProperties]
- class ValidationAgent
- {
- private SecurityLogger $securityLogger;
- private DbSecurity $dbSecurity;
- private mixed $db;
- private bool $debug;
- private array $schemaCache = [];
- // Configuration
- private AmbiguityHandler $ambiguityHandler;
- private AnalyticsErrorHandler $errorHandler;
- private mixed $app;
- private mixed $conversationMemory = null;
- private string $Usecache;
- /**
- * Constructor for AnalyticsAgent
- * Initializes database connection, language settings, and AI chat interface
- * Sets up schema caching, table relationships, and security components
- $CLICSHOPPING_Db->delete('administrator_menu', ['app_code' => 'app_configuration_orders_status_invoice']);
- }
- }
- private static function removeProductsOrdersStatusInvoiceDb()
- {
- /*
- $CLICSHOPPING_Db = Registry::get('Db');
- $Qcheck = $CLICSHOPPING_Db->query('show tables like ":table_orders_status_invoice"');
- private int $entityId;
- private $db;
- private string $prefix;
- // Agents disponibles
- private ?MultiDBRAGManager $ragManager = null;
- // Statistiques d'exécution
- private array $executionStats = [];
- // Mémoire conversationnelle et de travail
- private RateLimit $rateLimit;
- private string $userId;
- private bool $debug;
- private int $languageId;
- private int $entityId;
- private $db;
- private string $prefix;
- // Agents disponibles
- private ?MultiDBRAGManager $ragManager = null;
- private ValidationAgent $validationAgent;
- private ReasoningAgent $reasoningAgent;
- // Monitoring / alerting / response processing
- private MonitoringAgent $monitoring;
- private AlertManager $alertManager;
- private LlmResponseProcessor $responseProcessor; // LLM formatter
- private ?ResponseProcessorComponent $responseProcessorComponent = null;
- // Sub-orchestrator components
- private IntentAnalyzer $intentAnalyzer;
- class OrchestratorAgent
- {
- // Removed duplicate/unused properties (keep single source of truth)
- private ?MetricsCollector $collector = null;
- private SecurityLogger $securityLogger;
- private RateLimit $rateLimit;
- private string $userId;
- private bool $debug;
- private int $languageId;
- private int $entityId;
- private $db;
- * Validates the supplier data before updating.
- *
- * @param array $data The supplier data to validate
- * @return array An array containing validation result and errors if any
- */
- private static function validateSupplierData(array $data): array
- {
- $errors = [];
- // Validate email format if provided
- if (isset($data['suppliers_email_address']) && !empty($data['suppliers_email_address'])) {
- *
- * @param int $id The supplier ID to update
- * @param array $data The supplier data to update
- * @return array An array containing the result of the update operation
- */
- private static function updateSupplier(int $id, array $data): array
- {
- $CLICSHOPPING_Db = Registry::get('Db');
- try {
- $CLICSHOPPING_Db->beginTransaction();
- *
- * @param int $id The manufacturer ID to update
- * @param array $data The manufacturer data to update
- * @return array An array containing the result of the update operation
- */
- private static function updateManufacturer(int $id, array $data): array
- {
- $CLICSHOPPING_Db = Registry::get('Db');
- try {
- $CLICSHOPPING_Db->beginTransaction();
- * Validates the manufacturer data before updating.
- *
- * @param array $data The manufacturer data to validate
- * @return array An array containing validation result and errors if any
- */
- private static function validateManufacturerData(array $data): array
- {
- $errors = [];
- // Validate required fields if provided
- if (isset($data['manufacturers_name']) && empty(trim($data['manufacturers_name']))) {
- class SecurityLogger
- {
- private $logFile;
- private $maxLogSize;
- private $logRotations;
- private $logLevel;
- private $db;
- // Performance optimization: Cache log level numeric values
- private static $levelCache = [
- 'debug' => 0,
- {
- private mixed $db;
- private mixed $correctionAgent;
- private mixed $queryExecutor;
- private array $correctionLog = [];
- private bool $debug;
- /**
- * Constructor
- *
- * @param mixed $db Database connection
- * Sets up payment information (deprecated/unused).
- *
- * @param Order $order The order object to populate.
- * @param array $paymentData Payment data.
- */
- private function setupPaymentInfo(Order $order, array $paymentData): void
- {
- $order->info['payment_method'] = $paymentData['method'] ?? 'gpt_payment';
- $order->info['cc_type'] = $paymentData['cc_type'] ?? '';
- $order->info['cc_owner'] = $paymentData['cc_owner'] ?? '';
- $order->info['cc_number'] = $paymentData['cc_number'] ?? '';
- * Sets up customer information (deprecated/unused).
- *
- * @param Order $order The order object to populate.
- * @param array $customerData Customer data.
- */
- private function setupCustomerInfo(Order $order, array $customerData): void
- {
- $order->customer = [
- 'id' => $customerData['id'] ?? 0,
- 'firstname' => $customerData['firstname'] ?? 'GPT',
- 'lastname' => $customerData['lastname'] ?? 'Customer',
- * Sets up order products (deprecated/unused in favor of insertOrderProducts).
- *
- * @param Order $order The order object to populate.
- * @param array $items The array of product items.
- */
- private function setupOrderProducts(Order $order, array $items): void
- {
- $order->products = [];
- foreach ($items as $item) {
- $order->products[] = [
- *
- * @param Order $order The order object to populate.
- * @param array $sessionData The session data.
- * @param array $customerData Customer data.
- */
- private function setupAddresses(Order $order, array $sessionData, array $customerData): void
- {
- $shippingAddress = $sessionData['shipping_address'] ?? [];
- $billingAddress = $sessionData['billing_address'] ?? [];
- $order->billing = [
- * Sets up order totals (deprecated/unused in favor of insertOrderTotals).
- *
- * @param Order $order The order object to populate.
- * @param array $sessionData The session data.
- */
- private function setupOrderTotals(Order $order, array $sessionData): void
- {
- $order->totals = [
- [
- 'title' => 'Sub-Total:',
- 'text' => number_format($sessionData['subtotal'] ?? 0, 2) . ' EUR',
- * @param Order $order The order object to populate.
- * @param array $sessionData The session data.
- * @param array $customerData Customer data.
- * @param array $paymentData Payment data.
- */
- private function setupOrderInfo(Order $order, array $sessionData, array $customerData, array $paymentData): void
- {
- $order->info = [
- 'order_status' => 1, // Pending
- 'order_status_invoice' => 1,
- 'currency' => $sessionData['currency'] ?? 'EUR',
- // Slow operation threshold (milliseconds)
- private float $slowOperationThreshold = 100.0;
- // Metrics aggregation
- private array $metrics = [];
- /**
- * Constructor
- *
- * @param bool $debug Enable debug logging
- use ClicShopping\OM\Registry;
- class UpdatePaymentAddress extends \ClicShopping\OM\PagesActionsAbstract
- {
- public mixed $app;
- private mixed $lang;
- private mixed $db;
- public function __construct()
- {
- $this->app = Registry::get('Orders');
- *
- * @package ClicShopping\AI\Helper\Intent
- */
- class SemanticProcessor
- {
- private SecurityLogger $logger;
- private bool $debug;
- /**
- * Cached pattern bypass check result
- *
- #[AllowDynamicProperties]
- class ContextResolver
- {
- private SecurityLogger $logger;
- private bool $debug;
- private int $languageId;
- private int $maxContextWindow = 5; // Max messages to analyze for context
- private EntityTypeRegistry $entityRegistry;
- private ?EntityTracker $entityTracker = null; // TASK 4.4.2.7: Injected dependency
- /**
- ];
- /**
- * Valid response types
- */
- private const VALID_RESPONSE_TYPES = [
- 'analytics_response',
- 'analytics_results',
- 'analytics',
- 'semantic_results',
- 'semantic',
- *
- * @param array $validation Validation result from InputValidator
- * @param string $query SQL query being validated
- * @return bool True if valid, false otherwise
- */
- private function isSqlSyntaxValid(array $validation, string $query): bool
- {
- if (!$validation['valid']) {
- $this->securityLogger->logSecurityEvent(
- "Rejected query due to invalid SQL syntax (parse failure)",
- 'warning',
- * Implements comprehensive security measures for SQL processing
- */
- class SqlQueryProcessor
- {
- private SecurityLogger $securityLogger;
- private int $languageId;
- private bool $debug;
- private array $placeholderMap;
- private mixed $db;
- *
- * @package ClicShopping\AI\Helper\Intent
- */
- class AnalyticsProcessor
- {
- private SecurityLogger $logger;
- private bool $debug;
- /**
- * Cached pattern bypass check result
- *
- private array $config;
- /**
- * @var LoggerInterface The logger instance for logging protocol-related events.
- */
- private LoggerInterface $logger;
- /**
- * @var TransportInterface The transport layer implementation (e.g., SSE, WebSocket).
- */
- private TransportInterface $transport;
- private TransportInterface $transport;
- /**
- * @var int A counter for generating unique request IDs.
- */
- private int $requestId = 0;
- /**
- * @var array A map of pending requests to their resolvers.
- */
- private array $pendingRequests = [];
- private int $requestId = 0;
- /**
- * @var array A map of pending requests to their resolvers.
- */
- private array $pendingRequests = [];
- /**
- * @var array An associative array to store protocol-level statistics.
- */
- private array $stats = [
- * Requirements: 8.3
- */
- class SecurityStatistics
- {
- private $db;
- private string $prefix;
- /**
- * Constructor
- */
- public function __construct()
- private float $similarityThreshold = 0.7; // Threshold for semantic search
- // Statistics
- private array $stats = [];
- private mixed $db;
- // 🆕 Refactored components
- private ShortTermMemoryManager $shortTermManager;
- private LongTermMemoryManager $longTermManager;
- private ContextResolver $contextResolver;
- class ResultSynthesizer extends BaseQueryProcessor
- {
- /**
- * @var PromptValidator Validator for LLM prompts
- */
- private PromptValidator $promptValidator;
- /**
- * Constructor
- *
- * @param bool $debug Enable debug logging
- class WhosOnlineShop
- {
- protected $contents;
- protected $total;
- protected $weight;
- private mixed $db;
- public function __construct()
- {
- }
- */
- #[AllowDynamicProperties]
- class IntentAnalyzer
- {
- private SecurityLogger $logger;
- private ?ConversationMemory $conversationMemory;
- private bool $debug;
- private mixed $language;
- private EntityExtractor $entityExtractor;
- // Performance monitoring
- private ?PerformanceMonitor $performanceMonitor = null;
- // 🔧 PHASE 9: New SubIntentAnalyzer components (deprecated - kept for backward compatibility)
- private TranslationService $translationService;
- private IntentAnalyzerFactory $intentFactory;
- // 🔧 PHASE 14: Unified analyzer for language + intent detection (ALWAYS used)
- private ?UnifiedQueryAnalyzer $unifiedAnalyzer = null;
- private bool $useUnifiedAnalyzer = true; // Always true - required for analytics
- // Context retrieval
- private ?ContextRetriever $contextRetriever = null;
- // Async operations
- private ?AsyncOperationManager $asyncManager = null;
- // Performance monitoring
- private ?PerformanceMonitor $performanceMonitor = null;
- // 🔧 PHASE 9: New SubIntentAnalyzer components (deprecated - kept for backward compatibility)
- {
- private SecurityLogger $logger;
- private ?ConversationMemory $conversationMemory;
- private bool $debug;
- private mixed $language;
- private EntityExtractor $entityExtractor;
- // Cache support
- private bool $cacheEnabled = true;
- private int $cacheTTL = 5; // 5 minutes
- private TranslationService $translationService;
- private IntentAnalyzerFactory $intentFactory;
- // 🔧 PHASE 14: Unified analyzer for language + intent detection (ALWAYS used)
- private ?UnifiedQueryAnalyzer $unifiedAnalyzer = null;
- private bool $useUnifiedAnalyzer = true; // Always true - required for analytics
- private bool $useHybridMode = false; // Deprecated - Pure LLM mode only
- /**
- * Constructor
- *
- // Performance monitoring
- private ?PerformanceMonitor $performanceMonitor = null;
- // 🔧 PHASE 9: New SubIntentAnalyzer components (deprecated - kept for backward compatibility)
- private TranslationService $translationService;
- private IntentAnalyzerFactory $intentFactory;
- // 🔧 PHASE 14: Unified analyzer for language + intent detection (ALWAYS used)
- private ?UnifiedQueryAnalyzer $unifiedAnalyzer = null;
- private bool $useUnifiedAnalyzer = true; // Always true - required for analytics
- private bool $useHybridMode = false; // Deprecated - Pure LLM mode only
- */
- #[AllowDynamicProperties]
- class ReasoningAgent
- {
- private SecurityLogger $securityLogger;
- private mixed $chat;
- private bool $debug;
- private ?ReasoningAgentStats $persistentStats = null;
- // Configuration
- private string $reasoningMode = 'chain_of_thought'; // chain_of_thought, tree_of_thought, self_consistency
- *
- * @param string $prompt La requête utilisateur originale.
- * @param array $context Le contexte structuré (array) retourné par MemoryRetentionService.
- * @return string Le prompt final formaté pour le LLM.
- */
- private function buildPromptWithContext(string $userQuery, array $context): string
- {
- if (empty(array_filter($context, fn($v) => !empty($v)))) {
- return $userQuery;
- }
- private mixed $securityLogger;
- private bool $debug = false;
- private static array $tableStatsCache = [];
- private mixed $resultFormatter;
- private int $userId;
- // Reranking properties (Task 2.14.3 - LLPhant reranking integration)
- private ?LLMReranker $reranker = null;
- private bool $useReranking = false;
- * Analyse le contenu réel d'une table pour comprendre ce qu'elle contient
- *
- * @param string $tableName Nom de la table à analyser
- * @return array Statistiques et échantillons de contenu
- */
- private function analyzeTableContent(string $tableName): array
- {
- // Utiliser le cache si disponible
- if (isset(self::$tableStatsCache[$tableName])) {
- return self::$tableStatsCache[$tableName];
- }
- */
- private function createEmbeddingGenerator(): EmbeddingGeneratorInterface
- {
- return new class(Gpt::class) implements EmbeddingGeneratorInterface
- {
- private $gptClass;
- /**
- * Constructor for the embedding generator
- *
- * @param string $gptClass Class name of the Gpt instance
- {
- /**
- * Temporal period keywords (English-only)
- * These are the aggregation periods that can be combined
- */
- private static array $temporalPeriods = [
- 'month', 'months', 'monthly',
- 'quarter', 'quarters', 'quarterly',
- 'semester', 'semesters', 'half-year', 'half year',
- 'year', 'years', 'yearly', 'annual', 'annually',
- 'week', 'weeks', 'weekly',
- /**
- * Incrémente le compteur de hits
- *
- * @param string $cacheKey Clé de cache
- */
- private function incrementHitCount(string $cacheKey): void
- {
- try {
- $this->db->query("
- UPDATE :table_rag_query_cache
- SET hit_count = hit_count + 1
- private ?CacheStorage $dbStorage = null;
- private ?CacheFileStorage $fileStorage = null;
- private ?RagCache $ragCache = null;
- // Sub-components
- private CacheCleanup $cleanup;
- private CacheStatistics $statistics;
- private mixed $db = null;
- public function __construct()
- {
- // Activer le cache par défaut sauf si explicitement désactivé
- // Backend storage
- private string $backend = 'database'; // 'database', 'file', 'memcached', 'redis'
- private ?CacheStorage $dbStorage = null;
- private ?CacheFileStorage $fileStorage = null;
- private ?RagCache $ragCache = null;
- // Sub-components
- private CacheCleanup $cleanup;
- private CacheStatistics $statistics;
- private mixed $db = null;
- private ?CacheFileStorage $fileStorage = null;
- private ?RagCache $ragCache = null;
- // Sub-components
- private CacheCleanup $cleanup;
- private CacheStatistics $statistics;
- private mixed $db = null;
- public function __construct()
- {
- // Activer le cache par défaut sauf si explicitement désactivé
- $this->enabled = !defined('CLICSHOPPING_APP_CHATGPT_RA_CACHE_RAG_MANAGER') || CLICSHOPPING_APP_CHATGPT_RA_CACHE_RAG_MANAGER === 'True';
- use ClicShopping\OM\Registry;
- use ClicShopping\Apps\Configuration\Api\Classes\Shop\ApiSecurity;
- class Login
- {
- private mixed $lang;
- private string $username;
- private string $key;
- private ?string $ip;
- private mixed $authentification;
- /**
- * 🔧 TASK 6.8: Added QueryPerformanceMonitor integration
- */
- class QueryExecutor
- {
- private SecurityLogger $securityLogger;
- private DbSecurity $dbSecurity;
- private bool $debug;
- private ?QueryPerformanceMonitor $performanceMonitor;
- /**
- * Constructor
- */
- class WebSearchHandler
- {
- private SecurityLogger $logger;
- private ?WebSearchTool $webSearchTool;
- private mixed $db;
- private bool $debug;
- /**
- * Constructor
- *
- {
- private MariaDBVectorStore $vectorStore;
- private EmbeddingGeneratorInterface $embeddingGenerator;
- private SecurityLogger $logger;
- private bool $debug;
- private float $similarityThreshold;
- private int $maxChunkSize = 2000; // Max characters per chunk (reduced chunking to avoid perceived duplicates)
- /**
- * Constructor
- *
- * Requirements: 8.4
- */
- class SecurityAlerter
- {
- private $db;
- private string $prefix;
- private bool $alertsEnabled;
- private string $alertEmail;
- private int $alertThreshold;
- private int $highThreatThreshold;
- private bool $failureAlertsEnabled;
- use ClicShopping\OM\Registry;
- class UpdateShippingAddress extends \ClicShopping\OM\PagesActionsAbstract
- {
- public mixed $app;
- private mixed $lang;
- private mixed $db;
- public function __construct()
- {
- $this->app = Registry::get('Orders');
- */
- private $products_id;
- /**
- * @var int
- */
- private $old_quantity;
- public function __construct()
- {
- $this->app = Registry::get('Orders');
- */
- public mixed $app;
- /**
- * @var bool|\lang|null
- */
- private mixed $lang;
- /**
- * @var bool|\db|null
- */
- private mixed $db;
- /**
- * This function is used to log errors related to database operations.
- *
- * @param string $message The error message to log
- * @return void
- */
- private static function logError(string $message): void
- {
- if (self::$debug == 'True') {
- error_log($message);
- }
- }
- #[AllowDynamicProperties]
- class DoctrineOrm
- {
- private static $debug = false;
- private static $prefixDb;
- private static ?SecurityLogger $logger = null;
- private static ?array $cachedFields = null;
- private static ?array $cachedFieldsByTable = null;
- public function __construct()
- {
- /**
- * Initializes and returns an OpenAIChat instance configured with specified parameters.
- *
- * @return mixed An instance of the OpenAIChat class configured for GPT functionality.
- */
- private static function chat(): mixed // Not use currently
- {
- $api_key = self::getApiKey();
- $parameters = ['model' => CLICSHOPPING_APP_CHATGPT_RA_EMBEDDING_MODEL];
- $config = new OpenAIConfig();
- private McpHealth $health;
- /**
- * @var LoggerInterface The logger instance for logging analysis results and errors.
- */
- private LoggerInterface $logger;
- /**
- * @var array An array to store the performance history.
- */
- private array $performanceHistory = [];
- * 🔧 MIGRATED TO DOCTRINEORM: December 6, 2025
- * All database queries now use DoctrineOrm instead of PDO
- */
- class StatisticsTracker
- {
- private $db;
- private string $prefix;
- private $startTime;
- private $interactionId;
- private $userId;
- private $sessionId;
- * Creates the performance history table if it does not exist.
- *
- * This private method is responsible for setting up the necessary database table
- * with appropriate columns and indexes for storing performance metrics.
- */
- private function createTableIfNotExists(): void
- {
- $sql = "CREATE TABLE IF NOT EXISTS clic_mcp_performance_history (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `timestamp` int(11) NOT NULL,
- `request_rate` decimal(10,2) NOT NULL DEFAULT 0.00,
- private $db;
- /**
- * @var string The name of the database table for performance history.
- */
- private string $tableName = 'mcp_performance_history';
- /**
- * @var int The number of days to retain historical data.
- */
- private int $retentionDays = 90; // Keep data for 90 days by default
- use ClicShopping\Apps\Configuration\TemplateEmail\Classes\ClicShoppingAdmin\TemplateEmailAdmin;
- class Update extends \ClicShopping\OM\PagesActionsAbstract
- {
- public mixed $app;
- private mixed $lang;
- private mixed $db;
- protected int $oID;
- protected int $status;
- protected int $statusInvoice;
- protected string $comments;
- use ClicShopping\OM\Registry;
- class UpdateCustomerAddress extends \ClicShopping\OM\PagesActionsAbstract
- {
- public mixed $app;
- private mixed $lang;
- private mixed $db;
- public function __construct()
- {
- $this->app = Registry::get('Orders');
- */
- abstract class AbstractFormatter
- {
- protected bool $debug;
- protected bool $displaySql;
- private mixed $language;
- public function __construct(bool $debug = false, bool $displaySql = false)
- {
- $this->debug = $debug;
- $this->displaySql = $displaySql;
- */
- class Dashboard
- {
- private $statsCollector;
- private ?MonitoringAgent $monitoringAgent = null;
- private string $prefix;
- public function __construct()
- {
- $this->prefix = CLICSHOPPING::getConfig('db_table_prefix');
- $this->statsCollector = new DashboardStatsCollector();
- private array $alertThresholds;
- /**
- * @var array The configuration settings for the monitor.
- */
- private array $config;
- /**
- * @var MpcPerformanceHistoryStorage The storage component for historical performance data.
- */
- private MpcPerformanceHistoryStorage $historyStorage;
- private static ?SecurityLogger $logger = null;
- private static mixed $language = null;
- private static bool $debug = false;
- // Threat score threshold for blocking (configurable)
- private const DEFAULT_THREAT_THRESHOLD = 0.7;
- // Cache namespace for security analysis
- // This creates cache files in: Work/Cache/Rag/Security/
- private const CACHE_NAMESPACE = 'Rag/Security';
- * Contrôle strict des accès aux données sensibles pour les analyses
- */
- #[AllowDynamicProperties]
- class RagBIPermissions
- {
- private mixed $db;
- private mixed $mcpPermissions;
- // Tables autorisées pour RAG-BI (lecture seule)
- private const ALLOWED_TABLES = [
- 'clic_products',
- $this->clearMenuCache();
- $this->addSuccessMessage($this->app->getDef('alert_module_uninstall_success'));
- $this->redirectToConfigure($current_module);
- }
- private static function removeMenu(): void
- {
- $CLICSHOPPING_Db = Registry::get('Db');
- $Qcheck = $CLICSHOPPING_Db->get('administrator_menu', 'app_code', ['app_code' => 'app_configuration_chatgpt']);
- class ResultInterpreter
- {
- private mixed $chat;
- private Cache $cache;
- private SecurityLogger $securityLogger;
- private mixed $app;
- private mixed $language;
- private int $maxRowsForInterpretation;
- private bool $enablePromptCache;
- private bool $debug;
- private array $promptCache = [];
- use ClicShopping\Apps\Tools\MCP\Classes\Shop\Security\Message;
- class MCPAuth {
- private $validMcpKeys;
- private $accessLevels;
- private $mcpConfigs;
- private $allowedOrigins;
- public function __construct() {
- // Load MCP configurations from database
- $this->loadMcpConfigurations();
- class Cron
- {
- /**
- * @var mixed|null
- */
- private $Cronjob;
- public function __construct()
- {
- // $this->Cronjob = Registry::get('Cronjob');
- }
gyakutsuki
gyakutsuki
gyakutsuki
gyakutsuki
gyakutsuki