summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-26 17:18:13 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-26 17:18:13 +0100
commit680880a4b46d99e0e05f74e108f89dc5d1640b94 (patch)
tree156799cd049e819529e694909cb6854ec6423985 /includes
parentb458e321c3361bee831ba7c0c01f21802f8336fa (diff)
downloadstock-680880a4b46d99e0e05f74e108f89dc5d1640b94.tar.gz
stock-680880a4b46d99e0e05f74e108f89dc5d1640b94.tar.bz2
stock-680880a4b46d99e0e05f74e108f89dc5d1640b94.zip
Pretty URL /assembly/<content_id> and fix assembly lookup by content_id
- assembly_lookup_inc: replace lookup() (broken with null content_type_guid) with direct StockAssembly(assembly_id, content_id) constructor + load() - view.php: check both assembly_id and content_id for 404; fix 'gallery'→'assembly' - getDisplayUrlFromHash: prefer content_id for pretty URL assembly/<content_id>, fall back to assembly_id query string Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'includes')
-rwxr-xr-xincludes/assembly_lookup_inc.php9
-rwxr-xr-xincludes/classes/StockAssembly.php15
2 files changed, 11 insertions, 13 deletions
diff --git a/includes/assembly_lookup_inc.php b/includes/assembly_lookup_inc.php
index e39cbb4..be9600b 100755
--- a/includes/assembly_lookup_inc.php
+++ b/includes/assembly_lookup_inc.php
@@ -9,10 +9,11 @@ use \Bitweaver\Stock\StockAssembly;
$lookup = [];
-if( !$gContent = StockAssembly::lookup( $_REQUEST ) ) {
- $gContent = new StockAssembly();
- $assemblyId = null;
-}
+$gContent = new StockAssembly(
+ !empty( $_REQUEST['assembly_id'] ) ? (int)$_REQUEST['assembly_id'] : null,
+ !empty( $_REQUEST['content_id'] ) ? (int)$_REQUEST['content_id'] : null
+);
+$gContent->load();
if( !empty( $_REQUEST['gallery_path'] ) ) {
$gContent->setGalleryPath( $_REQUEST['gallery_path'] );
diff --git a/includes/classes/StockAssembly.php b/includes/classes/StockAssembly.php
index ba41489..f0cd5f3 100755
--- a/includes/classes/StockAssembly.php
+++ b/includes/classes/StockAssembly.php
@@ -621,19 +621,16 @@ class StockAssembly extends StockBase {
public static function getDisplayUrlFromHash( &$pParamHash ) {
$path = null;
$ret = '';
- if( BitBase::verifyIdParameter( $pParamHash, 'assembly_id' ) ) {
+ global $gBitSystem;
+ if( BitBase::verifyId( $pParamHash['content_id'] ?? 0 ) ) {
$ret = STOCK_PKG_URL;
- global $gBitSystem;
if( $gBitSystem->isFeatureActive( 'pretty_urls' ) ) {
- $ret .= 'gallery'.$path.'/'.$pParamHash['assembly_id'];
+ $ret .= 'assembly/'.$pParamHash['content_id'];
} else {
- $ret .= 'view.php?assembly_id='.$pParamHash['assembly_id'];
- if( !empty( $pHash['path'] ) ) {
- $ret .= '&gallery_path='.$pParamHash['path'];
- }
+ $ret .= 'view.php?content_id='.$pParamHash['content_id'];
}
- } elseif( BitBase::verifyId( $pParamHash['content_id'] ?? 0 ) ) {
- $ret = STOCK_PKG_URL.'view.php?content_id='.$pParamHash['content_id'];
+ } elseif( BitBase::verifyIdParameter( $pParamHash, 'assembly_id' ) ) {
+ $ret = STOCK_PKG_URL.'view.php?assembly_id='.$pParamHash['assembly_id'];
}
return $ret;
}