Enhance typeopenany.php with new attributes and update router.php for SEO URL handling and improved URL parsing.
This commit is contained in:
0
core/c/auto.php
Normal file → Executable file
0
core/c/auto.php
Normal file → Executable file
0
core/c/nibiru.php
Normal file → Executable file
0
core/c/nibiru.php
Normal file → Executable file
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
namespace Nibiru;
|
||||
use phpseclib3\File\ASN1\Maps\FieldElement;
|
||||
|
||||
/**
|
||||
* User - stephan
|
||||
* Date - 24.01.17
|
||||
@@ -155,11 +153,14 @@ class Router extends Config
|
||||
|
||||
if(is_array($uri_parts))
|
||||
{
|
||||
// FIRST: Check for SEO URLs before standard processing
|
||||
if (self::handleSeoUrls($uri_parts))
|
||||
{
|
||||
// SEO URL was handled, skip normal processing
|
||||
return;
|
||||
}
|
||||
|
||||
// STANDARD PROCESSING (UNCHANGED)
|
||||
if($uri_parts[1] == "")
|
||||
{
|
||||
self::$_cur_page = "index";
|
||||
@@ -252,9 +253,11 @@ class Router extends Config
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Handle single trailing URL segments
|
||||
// Handle single trailing URL segments (e.g., /admin/adwordsgenerator/machines)
|
||||
if(!is_numeric($uri_parts[$i]) && !empty($uri_parts[$i]))
|
||||
{
|
||||
if(!array_key_exists($uri_parts[$i], $_REQUEST))
|
||||
@@ -266,7 +269,6 @@ class Router extends Config
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self::$_page_params = $_REQUEST;
|
||||
}
|
||||
|
||||
@@ -289,8 +291,7 @@ class Router extends Config
|
||||
private static function handleSeoUrls($uri_parts)
|
||||
{
|
||||
// Check if we have the minimum required parts for SEO URL: /controller/slug/id
|
||||
if (!is_array($uri_parts) || count($uri_parts) < 4)
|
||||
{
|
||||
if (!is_array($uri_parts) || count($uri_parts) < 4) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -300,20 +301,17 @@ class Router extends Config
|
||||
$possibleId = $uri_parts[3] ?? '';
|
||||
|
||||
// Validate that the last part is numeric (ID)
|
||||
if (!is_numeric($possibleId))
|
||||
{
|
||||
if (!is_numeric($possibleId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Validate that the slug contains non-numeric characters (to differentiate from traditional URLs)
|
||||
if (is_numeric($slug))
|
||||
{
|
||||
if (is_numeric($slug)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Validate that the slug is not an existing action name
|
||||
if (self::isExistingAction($controller, $slug))
|
||||
{
|
||||
if (self::isExistingAction($controller, $slug)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,10 @@ class TypeOpenAny extends FormAttributes implements IForm
|
||||
self::FORM_ATTRIBUTE_ID => '',
|
||||
self::FORM_ATTRIBUTE_CLASS => '',
|
||||
self::FORM_ATTRIBUTE_ANY => '',
|
||||
self::FORM_ATTRIBUTE_HREF => ''
|
||||
self::FORM_ATTRIBUTE_HREF => '',
|
||||
'src' => '',
|
||||
'alt' => '',
|
||||
'style' => ''
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -35,6 +38,6 @@ class TypeOpenAny extends FormAttributes implements IForm
|
||||
*/
|
||||
private function _setElement( )
|
||||
{
|
||||
$this->_element = '<ANY href="HREF" ID CLASS>' . 'VALUE' . "\n";
|
||||
$this->_element = '<ANY href="HREF" src="SRC" alt="ALT" style="STYLE" ID CLASS>' . 'VALUE' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
0
core/c/typeswitch.php
Normal file → Executable file
0
core/c/typeswitch.php
Normal file → Executable file
Reference in New Issue
Block a user