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 Undefined index: thread

Alfa1

New Member
ErrorException: Undefined index: thread - library/XFA/ExtendedCover/Extends/XenForo/ControllerPublic/Thread.php:81
Generated By: Unknown Account, Oct 16, 2017
Stack Trace
#0 /library/XFA/ExtendedCover/Extends/XenForo/ControllerPublic/Thread.php(81): XenForo_Application::handlePhpError(8, 'Undefined index...', '/home/...', 81, Array)
#1 /library/Audentio/QuickThread/Extend/XenForo/ControllerPublic/Thread.php(7): XFA_ExtendedCover_Extends_XenForo_ControllerPublic_Thread->actionIndex()
#2 /library/NixFifty/Tickets/XenForo/ControllerPublic/Thread.php(7): Audentio_QuickThread_Extend_XenForo_ControllerPublic_Thread->actionIndex()
#3 /library/SV/ModEss/XenForo/ControllerPublic/Thread.php(17): NixFifty_Tickets_XenForo_ControllerPublic_Thread->actionIndex()
#4 /library/SV/ElasticEss/XenForo/ControllerPublic/Thread.php(8): SV_ModEss_XenForo_ControllerPublic_Thread->actionIndex()
#5 /library/SV/PostFriction/XenForo/ControllerPublic/Thread.php(21): SV_ElasticEss_XenForo_ControllerPublic_Thread->actionIndex()
#6 /library/XenForo/FrontController.php(351): SV_PostFriction_XenForo_ControllerPublic_Thread->actionIndex()
#7 /library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#8 /index.php(13): XenForo_FrontController->run()
#9 {main}
Request State
array(3) {
["url"] => string(113) "https://my-forum.com/threads/154889/"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}

Please mind that extended cover for threads is turned off. It should not load on this page.
 

Fred

Administrator
Staff member
In library/XFA/ExtendedCover/Extends/XenForo/ControllerPublic/Thread.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_Extends_XenForo_ControllerPublic_Thread extends XFCP_XFA_ExtendedCover_Extends_XenForo_ControllerPublic_Thread
{
    /**
    * Action index
     * @return mixed
     * @throws XenForo_Exception
     */
    public function actionIndex()
   {
        // Get response of parent action
       $response = parent::actionIndex();

        if ($response instanceof XenForo_ControllerResponse_View)
        {
            if(isset($response->params['thread'])) {
                // Get Model Thread and Rm Resource for extended Cover
                $extendedCoverModelThread = $this->_getExtendedCoverModelThread();
                $extendedCoverModelRmResource = $this->_getExtendedCoverModelRmResource();

                // Get in session trigger for open overlay
                $session = XenForo_Application::getSession();
                $addCoverTrigger = $session->get('xfa_ec_addCoverTrigger');
                if ($addCoverTrigger)
                {
                    $session->remove('xfa_ec_addCoverTrigger');
                }

                // If discussion type is resource adn rm is enable
                $acpOptions = XenForo_Application::getOptions();
                if($response->params['thread']['discussion_type'] == 'resource' && $acpOptions->xfa_ec_rm_res_enable)
                {
                    $resourceModel = XenForo_Model::create('XenResource_Model_Resource');

                    $resource = $resourceModel->getResourceByDiscussionId(
                        $response->params['thread']['thread_id'], array()
                    );

                    $noResourceInfos = true;
                    if($resource)
                    {
                        /* @var $categoryModel XenResource_Model_Category */
                        $categoryModel = XenForo_Model::create('XenResource_Model_Category');
                        $category = $categoryModel->getCategoryById(
                            $resource['resource_category_id'], array()
                        );

                        if($category)
                        {
                            $noResourceInfos = false;
                        }
                    }
                    if($noResourceInfos)
                    {
                        $params = $extendedCoverModelThread->getCoverParams($response->params['thread']['thread_id'], $response->params['forum'], $response->params['thread']);
                    }
                    else
                    {
                        $params = $extendedCoverModelRmResource->getCoverParams($resource['resource_id'], $category, $resource, true);
                    }
                }
                // If is normal thread
                else
                {
                    $params = $extendedCoverModelThread->getCoverParams($response->params['thread']['thread_id'], $response->params['forum'], $response->params['thread']);
                }

                $params['xfa_ec_useContentTemplate'] = true;
                // Merge Params
                $response->params = array_merge($params, $response->params);
                $response->containerParams = array_merge($params, $response->containerParams);
                $response->containerParams['xfa_ec_addCoverTrigger'] = $addCoverTrigger;
                $response->containerParams['thread'] = $response->params['thread'];
            }
      }

      return $response;
    }

   public function actionLive()
   {
      // Get response of parent action
      $response = parent::actionLive();

      if ($response instanceof XenForo_ControllerResponse_View)
      {
          if(isset($response->params['thread'])) {
                // Get Model Thread and Rm Resource for extended Cover
                $extendedCoverModelThread = $this->_getExtendedCoverModelThread();
                $extendedCoverModelRmResource = $this->_getExtendedCoverModelRmResource();

                // Get in session trigger for open overlay
                $session = XenForo_Application::getSession();
                $addCoverTrigger = $session->get('xfa_ec_addCoverTrigger');
                if ($addCoverTrigger)
                {
                    $session->remove('xfa_ec_addCoverTrigger');
                }

                // If discussion type is resource
                if($response->params['thread']['discussion_type'] == 'resource')
                {
                    $resourceModel = XenForo_Model::create('XenResource_Model_Resource');

                    $resource = $resourceModel->getResourceByDiscussionId(
                        $response->params['thread']['thread_id'], array()
                    );

                    $noResourceInfos = true;
                    if($resource)
                    {
                        /* @var $categoryModel XenResource_Model_Category */
                        $categoryModel = XenForo_Model::create('XenResource_Model_Category');
                        $category = $categoryModel->getCategoryById(
                            $resource['resource_category_id'], array()
                        );

                        if($category)
                        {
                            $noResourceInfos = false;
                        }
                    }
                    if($noResourceInfos)
                    {
                        $params = $extendedCoverModelThread->getCoverParams($response->params['thread']['thread_id'], $response->params['forum'], $response->params['thread']);
                    }
                    else
                    {
                        $params = $extendedCoverModelRmResource->getCoverParams($resource['resource_id'], $category, $resource, true);
                    }
                }
                // If is normal thread
                else
                {
                    $params = $extendedCoverModelThread->getCoverParams($response->params['thread']['thread_id'], $response->params['forum'], $response->params['thread']);
                }

                $params['xfa_ec_useContentTemplate'] = true;
                // Merge Params
                $response->params = array_merge($params, $response->params);
                $response->containerParams = array_merge($params, $response->containerParams);
                $response->containerParams['xfa_ec_addCoverTrigger'] = $addCoverTrigger;
                $response->containerParams['thread'] = $response->params['thread'];
            }
      }

      return $response;
   }

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

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

}

and tell me if this fix your issue
 

Alfa1

New Member
Now I get this:

ErrorException: Fatal Error: Class 'XFA_ExtendedCover_Extends_XenForo_ControllerPublic_Thread' not found - library/XenForo/Application.php(528) : eval()'d code:1
Generated By: Unknown Account, 1 minute ago
Stack Trace
#0 [internal function]: XenForo_Application::handleFatalError()
#1 {main}
Request State
array(3) {
["url"] => string(82) "https://my-forum.com/threads/ 329010/save-draft"
["_GET"] => array(0) {
}
["_POST"] => array(9) {
["message_html"] => string(754) "<p>xx></p>"
["_xfRelativeResolver"] => string(72) "https://my-forum.com/threads/ 329010/"
["attachment_hash"] => string(32) "9a41f6a3056c61cef39894147e838b4a"
["last_date"] => string(10) "1509136777"
["last_known_date"] => string(10) "1509136777"
["_xfToken"] => string(8) "********"
["_xfRequestUri"] => string(49) "/threads/ 329010/"
["_xfNoRedirect"] => string(1) "1"
["_xfResponseType"] => string(4) "json"
}
}
 

Alfa1

New Member
If I dump the code above in the Thread.php file and save it then I get errors that code contains characters that cannot be converted to ANSI - LATIN.
If I ignore it, then I get another error and if I then finally save it and upload it, I get the above errorexception.
 
Top