function checkAlias($name) { $aliases = Alias::FindBySql('alias', "SELECT * FROM alias WHERE path LIKE '/{$name}%' OR path LIKE '{$name}%'"); if (count($aliases)) { foreach ($aliases as $alias) { $pathParts = explode("/", $alias->path); if (substr($alias->path, 0, 1) == "/") { $path = "/{$this->name}/" . $pathParts[2]; } else { $path = "/{$this->name}/" . $pathParts[1]; } $alias->path = $path; $alias->save(); } } return false; }
function checkAlias($selected_areas, $name) { foreach ($selected_areas as $areaid) { $area = Areas::FindById($areaid); $aliases = Alias::FindBySql('alias', "SELECT * FROM alias WHERE path LIKE '/{$area->name}/{$name}%' OR path LIKE '{$area->name}/{$name}%'"); if (count($aliases)) { foreach ($aliases as $alias) { $alias->path = "/{$area->name}/" . $this->name; $alias->save(); } } } return false; }