Overview
Comment: | Correction bugs squelette par plugin |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
bd066439f309d40d01e326e8d5a0bf5d |
User & Date: | bohwaz on 2015-01-18 02:20:30 |
Other Links: | manifest | tags |
Context
2015-01-18
| ||
02:20 | mise à jour doc. plugins développeur check-in: 44152a3893 user: bohwaz tags: trunk | |
02:20 | Correction bugs squelette par plugin check-in: bd066439f3 user: bohwaz tags: trunk | |
02:20 | Correction bugs mise à jour plugin check-in: 7fa91bc99f user: bohwaz tags: trunk | |
Changes
Modified src/include/lib/Garradin/Squelette.php from [708fed8a81] to [b6c3807dbf].
︙ | ︙ | |||
443 444 445 446 447 448 449 | else { $db = DB::getInstance(); // Type de boucles gérés par des plugins if ($plugin = $db->simpleQuerySingle('SELECT plugin FROM plugins_skel_boucles WHERE nom = ? LIMIT 1;', false, $loopType)) { | | | | | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | else { $db = DB::getInstance(); // Type de boucles gérés par des plugins if ($plugin = $db->simpleQuerySingle('SELECT plugin FROM plugins_skel_boucles WHERE nom = ? LIMIT 1;', false, $loopType)) { $plugin = new \Garradin\Plugin($plugin); if (!file_exists($plugin->path() . '/skel_loop.php')) { throw new \KD2\MiniSkelMarkupException("Le type de boucle '".$loopType."' est géré par un plugin, mais celui-ci ne contient pas de fichier skel_loop.php."); } // Ici le plugin peut soit peupler $query et $loopStart lui-même, soit faire un return include $plugin->path() . '/skel_loop.php'; } else { throw new \KD2\MiniSkelMarkupException("Le type de boucle '".$loopType."' est inconnu."); } } $hash = sha1(uniqid(mt_rand(), true)); $out = new Squelette_Snippet(); $out->append(1, '$parent_hash = $this->current[\'_self_hash\'];'); $out->append(1, '$this->parent =& $parent_hash ? $this->_vars[$parent_hash] : null;'); if (!empty($search)) { $out->append(1, 'if (trim($this->getVariable(\'recherche\'))) { '); } $out->append(1, '$statement = $db->prepare(\''.$query.'\'); '); // Sécurité anti injection $out->append(1, 'if (!$statement->readOnly()) { throw new \\MiniSkelMarkupException("Requête en écriture illégale: '.$query.'"); } '); $out->append(1, '$result_'.$hash.' = $statement->execute(); '); $out->append(1, '$nb_rows = $db->countRows($result_'.$hash.'); '); if (!empty($search)) { $out->append(1, '} else { $result_'.$hash.' = false; $nb_rows = 0; }'); } $out->append(1, '$this->_vars[\''.$hash.'\'] = [\'_self_hash\' => \''.$hash.'\', \'_parent_hash\' => $parent_hash, \'total_boucle\' => $nb_rows, \'compteur_boucle\' => 0];'); $out->append(1, '$this->current =& $this->_vars[\''.$hash.'\']; '); $out->append(1, 'if ($nb_rows > 0):'); |
︙ | ︙ |