Beispiel #1
0
 while (true) {
     // Validate the wildcards
     if (!preg_match("#^(.*)\\*\$#", $sourceWildcard, $matches)) {
         logError("Invalid source wildcard '{$sourceWildcard}', item is skipped, URL entry ID is " . $row['id']);
         list($column, $counter) = displayProgress('E', $urlImportStartTime, $counter, $urlCount, $column);
         continue 2;
     }
     $fromPath = $matches[1];
     $fromPath = eZURLAliasML::sanitizeURL($fromPath);
     if (!preg_match("#^(.*)\\{1\\}\$#", $destinationWildcard, $matches)) {
         logError("Invalid destination wildcard '{$destinationWildcard}', item is skipped, URL entry ID is " . $row['id']);
         list($column, $counter) = displayProgress('E', $urlImportStartTime, $counter, $urlCount, $column);
         continue 2;
     }
     $toPath = $matches[1];
     $toPath = eZURLAliasML::sanitizeURL($toPath);
     $newWildcard = $toPath . '/*';
     $newWildcardSQL = $db->escapeString($newWildcard);
     $query = "SELECT * FROM ezurlalias WHERE source_url = '{$newWildcardSQL}' AND is_wildcard=1";
     $rowsw = $db->arrayQuery($query);
     if (count($rowsw) == 0) {
         // The redirection has stopped, we can use the destination
         break;
     }
     $newSourceWildcard = $rowsw[0]['destination_url'];
     if (!preg_match("#^(.*)\\{1\\}\$#", $newSourceWildcard, $matches)) {
         logError("Invalid destination wildcard '{$destinationWildcard}', item is skipped, URL entry ID is " . $rowsw[0]['id']);
         list($column, $counter) = displayProgress('E', $urlImportStartTime, $counter, $urlCount, $column);
         continue 2;
     }
     $newSourceWildcard = $matches[1];
 public function testSanitizeURL()
 {
     $url1 = "/content/view/full/2";
     $url2 = "/////content/view/full/2/";
     $url3 = "/content/view/full/2///";
     $url4 = "///content/view/full/2///";
     $url5 = "///content///view////full//2///";
     self::assertEquals("content/view/full/2", eZURLAliasML::sanitizeURL($url1));
     self::assertEquals("content/view/full/2", eZURLAliasML::sanitizeURL($url2));
     self::assertEquals("content/view/full/2", eZURLAliasML::sanitizeURL($url3));
     self::assertEquals("content/view/full/2", eZURLAliasML::sanitizeURL($url4));
     self::assertEquals("content/view/full/2", eZURLAliasML::sanitizeURL($url5));
     // Make sure funky characters doesn't get messed up
     $invalidUrl = "//ウ//ー//ラ//";
     self::assertEquals("ウ/ー/ラ", eZURLAliasML::sanitizeURL($invalidUrl));
 }
Beispiel #3
0
 while (true) {
     // Validate the wildcards
     if (!preg_match("#^(.*)\\*\$#", $sourceWildcard, $matches)) {
         logError("Invalid source wildcard '{$sourceWildcard}', item is skipped, URL entry ID is " . $row['id']);
         list($column, $counter) = displayProgress('E', $urlImportStartTime, $counter, $urlCount, $column);
         continue 2;
     }
     $fromPath = $matches[1];
     $fromPath = eZURLAliasML::sanitizeURL($fromPath, true);
     if (!preg_match("#^(.*)\\{1\\}\$#", $destinationWildcard, $matches)) {
         logError("Invalid destination wildcard '{$destinationWildcard}', item is skipped, URL entry ID is " . $row['id']);
         list($column, $counter) = displayProgress('E', $urlImportStartTime, $counter, $urlCount, $column);
         continue 2;
     }
     $toPath = $matches[1];
     $toPath = eZURLAliasML::sanitizeURL($toPath, true);
     $newWildcard = $toPath . '/*';
     $newWildcardSQL = $db->escapeString($newWildcard);
     $query = "SELECT * FROM ezurlalias WHERE source_url = '{$newWildcardSQL}' AND is_wildcard=1";
     $rowsw = $db->arrayQuery($query);
     if (count($rowsw) == 0) {
         // The redirection has stopped, we can use the destination
         break;
     }
     $newSourceWildcard = $rowsw[0]['destination_url'];
     if (!preg_match("#^(.*)\\{1\\}\$#", $newSourceWildcard, $matches)) {
         logError("Invalid destination wildcard '{$destinationWildcard}', item is skipped, URL entry ID is " . $rowsw[0]['id']);
         list($column, $counter) = displayProgress('E', $urlImportStartTime, $counter, $urlCount, $column);
         continue 2;
     }
     $newSourceWildcard = $matches[1];