What's new
Xen Factory

Register today to become a member! Once signed in, you'll be able to start purchasing our products, ask questions, request support and suggest new ideas!

  • This area is dedicated to the support of our xF1 add-ons. For xF2, please use the dedicated area: HERE.
  • We are aware that a no permission error was shown when you tried to purchase in the last 2 days, this is now fixed.

Bug Fixed Conflict with "Attachment Plus" add-on from XenMade

Freelancer

Member
In "member_view" (User Profile), the above add-on places a tab "Attachments" that lists all attachments of the user. When you click the tab and XFA EC is installed you get the following Server Error:

Code:
Error Info
Invalid model 'XFA_DocMngr_Model_Category' specified - library/XenForo/Model.php:192

Stack Trace
#0 /Applications/XAMPP/xamppfiles/htdocs/mywebsite/library/XFA/ExtendedCover/AttachmentHandler/AMSArticleCover.php(55): XenForo_Model::create('XFA_DocMngr_Mod...')
#1 /Applications/XAMPP/xamppfiles/htdocs/mywebsite/library/XFA/ExtendedCover/AttachmentHandler/AMSArticleCover.php(42): XFA_ExtendedCover_AttachmentHandler_AMSArticleCover->_getCategoryModel()
#2 /Applications/XAMPP/xamppfiles/htdocs/mywebsite/library/XFA/ExtendedCover/AttachmentHandler/AMSArticleCover.php(49): XFA_ExtendedCover_AttachmentHandler_AMSArticleCover->getContentDataFromContentId(14)
#3 /Applications/XAMPP/xamppfiles/htdocs/mywebsite/library/XenForo/Model/Attachment.php(473): XFA_ExtendedCover_AttachmentHandler_AMSArticleCover->getContentLink(Array, Array, false)
#4 /Applications/XAMPP/xamppfiles/htdocs/mywebsite/library/XenForo/Model/Attachment.php(434): XenForo_Model_Attachment->getContentLink(Array)
#5 /Applications/XAMPP/xamppfiles/htdocs/mywebsite/library/XenForo/Model/Attachment.php(454): XenForo_Model_Attachment->prepareAttachment(Array, true)
#6 /Applications/XAMPP/xamppfiles/htdocs/mywebsite/library/phc/AttachmentPlus/Extend/XenForo/ControllerPublic/Member.php(97): XenForo_Model_Attachment->prepareAttachments(Array, true)
#7 /Applications/XAMPP/xamppfiles/htdocs/mywebsite/library/XenForo/FrontController.php(351): phc_AttachmentPlus_Extend_XenForo_ControllerPublic_Member->actionAtpattachments()
#8 /Applications/XAMPP/xamppfiles/htdocs/mywebsite/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#9 /Applications/XAMPP/xamppfiles/htdocs/mywebsite/index.php(13): XenForo_FrontController->run()
#10 {main}

Request State
Array
(
    [url] => http://localhost/mywebsite/members/membername.1/atpattachments?_xfRequestUri=%2Fmywebsite%2Fmembers%2Fmembername.1%2F&_xfNoRedirect=1&_xfToken=1%2C1492103790%2Cd86d5c804fe7e4af92a6a4b668041e1bff36296d&_xfResponseType=json
    [_GET] => Array
        (
            [_xfRequestUri] => /mywebsite/members/membername.1/
            [_xfNoRedirect] => 1
            [_xfToken] => 1,1492103790,d86d5c804fe7e4af92a6a4b668041e1bff36296d
            [_xfResponseType] => json
        )

    [_POST] => Array
        (
        )

)


Please advise
 

Freelancer

Member
I guess I found the bug origin...
Code:
XFA/DocMngr/Model/Category.php
isn't existing on my installation, because I don't have the XFA DM add-on at all... so it's a bug on your side.
 

Fred

Administrator
Staff member
In library/XFA/ExtendedCover/AttachmentHandler/AMSArticleCover.php

replace content of file by

PHP:
<?php
/*************************************************************************
* XenForo Extended Cover - Xen Factory (c) 2015
* All Rights Reserved.
* Created by Fr�d�ric Baudouin aka. Fred
**************************************************************************
* This file is subject to the terms and conditions defined in the Licence
* Agreement available at http://xen-factory.com/pages/license-agreement/.
*************************************************************************/

class XFA_ExtendedCover_AttachmentHandler_AMSArticleCover extends XenForo_AttachmentHandler_Abstract
{
    protected $_contentIdKey            = 'category_id';

    protected $_contentTypePhraseKey    = 'xfaEcAMSArticle';

    protected $_contentRoute            = 'article';

    protected function _canUploadAndManageAttachments(array $contentData, array $viewingUser)
    {
        return true;
    }

    protected function _canViewAttachment(array $attachment, array $viewingUser)
    {
        return true;
    }

    public function attachmentPostDelete(array $attachment, Zend_Db_Adapter_Abstract $db)
    {

    }

    public function getAttachmentConstraints()
    {
        return $this->_getExtendedCoverModelDmCategory()->getCoverAttachmentConstraints();
    }


    public function getContentDataFromContentId($contentId)
    {
        $articleCover = $this->_getArticleModel()->getArticle($contentId);
        return ($articleCover ? $articleCover : parent::getContentDataFromContentId($contentId));
    }


    public function getContentLink(array $attachment, array $extraParams = array(), $skipPrepend = false)
    {
        $entry = $this->getContentDataFromContentId($attachment['content_id']);
        return XenForo_Link::buildPublicLink($this->_contentRoute, $entry, $extraParams, $skipPrepend);
    }

    protected function _getArticleModel()
    {
        return XenForo_Model::create('NFLJ_AMS_Model_Article');
    }

    /**
     * @return XFA_ExtendedCover_Model_DmCategory
     * @throws XenForo_Exception
     */
    protected function _getExtendedCoverModelDmCategory()
    {
        return XenForo_Model::create('XFA_ExtendedCover_Model_DmCategory');
    }
}
 

Freelancer

Member
In library/XFA/ExtendedCover/AttachmentHandler/AMSArticleCover.php replace content of file by

I thought that fixed the problem, but when browsing through the attachment pages I get the following error...

Code:
Error Info
Call to undefined method NFLJ_AMS_Model_Article::getArticle() - library/XFA/ExtendedCover/AttachmentHandler/AMSArticleCover.php:42

Stack Trace
#0 /var/www/clients/client180/web812/web/library/XFA/ExtendedCover/AttachmentHandler/AMSArticleCover.php(49): XFA_ExtendedCover_AttachmentHandler_AMSArticleCover->getContentDataFromContentId(14)
#1 /var/www/clients/client180/web812/web/library/XenForo/Model/Attachment.php(473): XFA_ExtendedCover_AttachmentHandler_AMSArticleCover->getContentLink(Array, Array, false)
#2 /var/www/clients/client180/web812/web/library/XenForo/Model/Attachment.php(434): XenForo_Model_Attachment->getContentLink(Array)
#3 /var/www/clients/client180/web812/web/library/XenForo/Model/Attachment.php(454): XenForo_Model_Attachment->prepareAttachment(Array, true)
#4 /var/www/clients/client180/web812/web/library/phc/AttachmentPlus/Extend/XenForo/ControllerPublic/Member.php(97): XenForo_Model_Attachment->prepareAttachments(Array, true)
#5 /var/www/clients/client180/web812/web/library/XenForo/FrontController.php(351): phc_AttachmentPlus_Extend_XenForo_ControllerPublic_Member->actionAtpattachments()
#6 /var/www/clients/client180/web812/web/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#7 /var/www/clients/client180/web812/web/index.php(13): XenForo_FrontController->run()
#8 {main}

Request State
Array
(
    [url] => https://www.mywebsite.com/members/user.1/atpattachments?page=2
    [_GET] => Array
        (
            [/members/user_1/atpattachments] => 
            [page] => 2
        )

    [_POST] => Array
        (
        )

)
 
Last edited:

Fred

Administrator
Staff member
Try this one

PHP:
<?php
/*************************************************************************
* XenForo Extended Cover - Xen Factory (c) 2015
* All Rights Reserved.
* Created by Fr�d�ric Baudouin aka. Fred
**************************************************************************
* This file is subject to the terms and conditions defined in the Licence
* Agreement available at http://xen-factory.com/pages/license-agreement/.
*************************************************************************/

class XFA_ExtendedCover_AttachmentHandler_AMSArticleCover extends XenForo_AttachmentHandler_Abstract
{
    protected $_contentIdKey            = 'article_id';

    protected $_contentTypePhraseKey    = 'xfaEcAMSArticle';

    protected $_contentRoute            = 'article';

    protected function _canUploadAndManageAttachments(array $contentData, array $viewingUser)
    {
        return true;
    }

    protected function _canViewAttachment(array $attachment, array $viewingUser)
    {
        return true;
    }

    public function attachmentPostDelete(array $attachment, Zend_Db_Adapter_Abstract $db)
    {

    }

    public function getAttachmentConstraints()
    {
        return $this->_getExtendedCoverModelAmsArticle()->getCoverAttachmentConstraints();
    }


    public function getContentDataFromContentId($contentId)
    {
        $articleCover = $this->_getArticleModel()->getArticleById($contentId);
        return ($articleCover ? $articleCover : parent::getContentDataFromContentId($contentId));
    }


    public function getContentLink(array $attachment, array $extraParams = array(), $skipPrepend = false)
    {
        $entry = $this->getContentDataFromContentId($attachment['content_id']);
        return XenForo_Link::buildPublicLink($this->_contentRoute, $entry, $extraParams, $skipPrepend);
    }

    /**
     * @return NFLJ_AMS_Model_Article
     */
    protected function _getArticleModel()
    {
        return XenForo_Model::create('NFLJ_AMS_Model_Article');
    }

    /**
     * @return XFA_ExtendedCover_Model_AMSArticle
     * @throws XenForo_Exception
     */
    protected function _getExtendedCoverModelAmsArticle()
    {
        return XenForo_Model::create('XFA_ExtendedCover_Model_AMSArticle');
    }
}
 

Freelancer

Member
Tried it and as soon as I click on page two of the attachments list I get this Error:

Code:
Error Info
Invalid model 'XFA_DocMngr_Model_Category' specified - library/XenForo/Model.php:192

Stack Trace
#0 /var/www/clients/client180/web812/web/library/XFA/ExtendedCover/AttachmentHandler/ShowcaseItemCover.php(55): XenForo_Model::create('XFA_DocMngr_Mod...')
#1 /var/www/clients/client180/web812/web/library/XFA/ExtendedCover/AttachmentHandler/ShowcaseItemCover.php(42): XFA_ExtendedCover_AttachmentHandler_ShowcaseItemCover->_getCategoryModel()
#2 /var/www/clients/client180/web812/web/library/XFA/ExtendedCover/AttachmentHandler/ShowcaseItemCover.php(49): XFA_ExtendedCover_AttachmentHandler_ShowcaseItemCover->getContentDataFromContentId(21)
#3 /var/www/clients/client180/web812/web/library/XenForo/Model/Attachment.php(473): XFA_ExtendedCover_AttachmentHandler_ShowcaseItemCover->getContentLink(Array, Array, false)
#4 /var/www/clients/client180/web812/web/library/XenForo/Model/Attachment.php(434): XenForo_Model_Attachment->getContentLink(Array)
#5 /var/www/clients/client180/web812/web/library/XenForo/Model/Attachment.php(454): XenForo_Model_Attachment->prepareAttachment(Array, true)
#6 /var/www/clients/client180/web812/web/library/phc/AttachmentPlus/Extend/XenForo/ControllerPublic/Member.php(97): XenForo_Model_Attachment->prepareAttachments(Array, true)
#7 /var/www/clients/client180/web812/web/library/XenForo/FrontController.php(351): phc_AttachmentPlus_Extend_XenForo_ControllerPublic_Member->actionAtpattachments()
#8 /var/www/clients/client180/web812/web/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#9 /var/www/clients/client180/web812/web/index.php(13): XenForo_FrontController->run()
#10 {main}

Request State
Array
(
    [url] => https://www.mywebsite.com/members/member.1/atpattachments?page=2
    [_GET] => Array
        (
            [/members/member_1/atpattachments] =>
            [page] => 2
        )

    [_POST] => Array
        (
        )

)

It is interesting that at first it mentioned AMS and now after clearing it is Showcase.
 

Fred

Administrator
Staff member
In XFA/ExtendedCover/AttachmentHandler/ShowcaseItemCover.php

replace all by

PHP:
<?php
/*************************************************************************
* XenForo Extended Cover - Xen Factory (c) 2015
* All Rights Reserved.
* Created by Fr�d�ric Baudouin aka. Fred
**************************************************************************
* This file is subject to the terms and conditions defined in the Licence
* Agreement available at http://xen-factory.com/pages/license-agreement/.
*************************************************************************/

class XFA_ExtendedCover_AttachmentHandler_ShowcaseItemCover extends XenForo_AttachmentHandler_Abstract
{
    protected $_contentIdKey            = 'item_id';

    protected $_contentTypePhraseKey    = 'xfaEcShowcaseItem';

    protected $_contentRoute            = 'item';

    protected function _canUploadAndManageAttachments(array $contentData, array $viewingUser)
    {
        return true;
    }

    protected function _canViewAttachment(array $attachment, array $viewingUser)
    {
        return true;
    }

    public function attachmentPostDelete(array $attachment, Zend_Db_Adapter_Abstract $db)
    {

    }

    public function getAttachmentConstraints()
    {
        return $this->_getExtendedCoverModelShowcaseItem()->getCoverAttachmentConstraints();
    }


    public function getContentDataFromContentId($contentId)
    {
        $categoryCover = $this->_getItemModel()->getItemById($contentId);
        return ($categoryCover ? $categoryCover : parent::getContentDataFromContentId($contentId));
    }


    public function getContentLink(array $attachment, array $extraParams = array(), $skipPrepend = false)
    {
        $entry = $this->getContentDataFromContentId($attachment['content_id']);
        return XenForo_Link::buildPublicLink($this->_contentRoute, $entry, $extraParams, $skipPrepend);
    }

    /**
     * @return NFLJ_Showcase_Model_Item
     */
    protected function _getItemModel()
    {
        return XenForo_Model::create('NFLJ_Showcase_Model_Item');
    }

    /**
     * @return XFA_ExtendedCover_Model_ShowcaseItem
     * @throws XenForo_Exception
     */
    protected function _getExtendedCoverModelShowcaseItem()
    {
        return XenForo_Model::create('XFA_ExtendedCover_Model_ShowcaseItem');
    }
}
 
Top