Jump to content

Featured Replies

  • Replies 132
  • Просмотров 50,2k
  • Created
  • Последний ответ

Лучшие авторы в теме

Most Popular Posts

  • @Desti THANX FOR UPDATE NEW VERSION 4.6.12.1 PHP8 TESTED Advanced Tags & Prefixes v3.2.2   Advanced Tags & Prefixes v3.2.2.tar

  • Advanced Tags & Prefixes 3.1.10 What's New in Version 3.1.10 Fixed SQL schema issue causing installation error on some environments. Potential fix for lingering mas

  • @SlawkA обнови. Advanced Tags & Prefixes 3.2.1.zip

Posted Images

comment_199202
ArgumentCountError: Too few arguments to function IPS\forums\_Forum::clubForm(), 1 passed in /html/init.php(913) : eval()'d code on line 213 and exactly 2 expected (0)
#0 /html/init.php(913) : eval()'d code(213): IPS\forums\_Forum->clubForm()
#1 /html/applications/core/modules/admin/clubs/clubs.php(468): IPS\forums\advancedtagsprefixes_hook_forumLastPostPrefix->clubForm()
#2 /html/system/Dispatcher/Controller.php(90): IPS\core\modules\admin\clubs\_clubs->nodeForm()
#3 /html/applications/core/modules/admin/clubs/clubs.php(38): IPS\Dispatcher\_Controller->execute()
#4 /html/system/Dispatcher/Dispatcher.php(153): IPS\core\modules\admin\clubs\_clubs->execute()
#5 /html/siteadminant/index.php(13): IPS\_Dispatcher->run()
#6 {main}

При создании в клубах, темы, вызывает окно с ошибкой и не дает создать темы

comment_199204

На 4.7 такая же ситуцация. Нужно деактивировать приложение Advanced Tags & Prefixes, создать форум в клубе, затем активировать приложение. Ну, или обратиться к кодеру. Там проблема в какой-то одной строке, скорее всего, как показывает практика.

comment_199208

hooks/ForunLasrPostPrefix.php

найти
 parent::clubForm( $form );

заменить на
 parent::clubForm( $form, $club );

найти
 public function setLastComment( \IPS\Content\Comment $comment=NULL )

заменить на
 public function setLastComment( \IPS\Content\Comment $comment=NULL, \IPS\Content\Item $updatedItem = null )

Больше не искал, всплывет еще что-то - пишите.
 

comment_199209
9 минут назад, Desti сказал:

hooks/ForunLasrPostPrefix.php

найти
 parent::clubForm( $form );

заменить на
 parent::clubForm( $form, $club );

найти
 public function setLastComment( \IPS\Content\Comment $comment=NULL )

заменить на
 public function setLastComment( \IPS\Content\Comment $comment=NULL, \IPS\Content\Item $updatedItem = null )

Больше не искал, всплывет еще что-то - пишите.
 

Спасибо. Попробую вечером 😙

comment_199211
1 час назад, Zero108 сказал:

Форумы теперь дает создавать в клубах.

А через ац дает создавать темы в клубах?

И редактировать 

comment_199213

в том же файле 

найти
 if ( isset( $values['allowed_prefixes'] ) and !empty( $values['allowed_prefixes'] ) )

добавить перед 
 $values['club_node_public'] = 0;
 

темы после этого создает и редактирует.

comment_199215
38 минут назад, Desti сказал:

в том же файле 

найти
 if ( isset( $values['allowed_prefixes'] ) and !empty( $values['allowed_prefixes'] ) )

добавить перед 
 $values['club_node_public'] = 0;
 

темы после этого создает и редактирует.

Испробуем) сколько с меня золотых?)

comment_199217
7 часов назад, Zero108 сказал:

Форумы теперь дает создавать в клубах.

можешь кинуть исправленный файл? нА 4.6 не заводится что то..

ArgumentCountError: Too few arguments to function IPS\forums\_Forum::clubForm(), 1 passed in /html/init.php(913) : eval()'d code on line 213 and exactly 2 expected (0)
#0 /antcod4.ru/html/init.php(913) : eval()'d code(213): IPS\forums\_Forum->clubForm()
#1 //html/applications/core/modules/front/clubs/view.php(1545): IPS\forums\advancedtagsprefixes_hook_forumLastPostPrefix->clubForm()
#2 /html/system/Dispatcher/Controller.php(90): IPS\core\modules\front\clubs\_view->nodeForm()
#3 /html/applications/core/modules/front/clubs/view.php(120): IPS\Dispatcher\_Controller->execute()
#4 /html/system/Dispatcher/Dispatcher.php(153): IPS\core\modules\front\clubs\_view->execute()
#5 /html/index.php(13): IPS\_Dispatcher->run()
#6 {main}

 

comment_199218
Цитата

 

//<?php

class advancedtagsprefixes_hook_forumLastPostPrefix extends _HOOK_CLASS_
{
	/**
	 * Set last comment
	 *
	 * @param	\IPS\Content\Comment	$comment	The latest comment or NULL to work it out
	 * @return	void
	 */
	public function setLastComment( \IPS\Content\Comment $comment=NULL, \IPS\Content\Item $updatedItem = null )
	{
		try
		{
			try
			{
		/**
		 * Save prefix off with the topic
		 */
				if ( $comment === NULL )
				{
					try
					{
						$select = \IPS\Db::i()->select( '*', 'forums_topics', array( "forums_topics.forum_id={$this->id} AND forums_topics.approved=1" ), 'forums_topics.last_post DESC', 1 )->first();
						$topic = \IPS\forums\Topic::constructFromData( $select );
						
						$this->last_prefix = $topic->prefix();
						return call_user_func_array( 'parent::setLastComment', func_get_args() );
					}
					catch ( \UnderflowException $e )
					{
						$this->last_prefix = NULL;
						return call_user_func_array( 'parent::setLastComment', func_get_args() );
					}
				}
				
				$this->last_prefix = $comment->item()->prefix();
				
				return call_user_func_array( 'parent::setLastComment', func_get_args() );
			}
			catch ( \RuntimeException $e )
			{
				if ( method_exists( get_parent_class(), __FUNCTION__ ) )
				{
					return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
				}
				else
				{
					throw $e;
				}
			}
		}
		catch ( \RuntimeException $e )
		{
			if ( method_exists( get_parent_class(), __FUNCTION__ ) )
			{
				return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
			}
			else
			{
				throw $e;
			}
		}
	}

	/**
	 * Get last post data
	 *
	 * @return	array|NULL
	 */
	public function lastPost()
	{
		try
		{
			try
			{
		/**
		 * Load prefix for display with last post info
		 */
				$result = call_user_func_array( 'parent::lastPost', func_get_args() );
				
				if( !is_null( $result ) )
				{
			/**
			 * Must recreate the condition structure to get the data from the right place.
			 */
					if
					(
						!$this->can_view_others
						and
						(
							!(
								\IPS\Member::loggedIn()->modPermission( 'forums' ) === -1
								or
								(
									is_array( \IPS\Member::loggedIn()->modPermission( 'forums' ) )
									and
									in_array( $this->_id, \IPS\Member::loggedIn()->modPermission( 'forums' ) )
								)
							)
							and
							!\IPS\Member::loggedIn()->modPermission( 'can_read_all_topics' )
						)
					)
					{
						try
						{
							$lastPost = \IPS\forums\Topic\Post::constructFromData( \IPS\Db::i()->select( '*', 'forums_posts', array( 'topic_id=? AND queued=0', \IPS\Db::i()->select( 'tid', 'forums_topics', array( 'forum_id=? AND approved=1 AND starter_id=?', $this->_id, \IPS\Member::loggedIn()->member_id ), 'last_post DESC', 1 )->first() ), 'post_date DESC', 1 )->first() );
							
							$result['prefix']			= $lastPost->item()->prefix();
							$result['prefix_encoded']	= rawurlencode( $result['prefix'] );
						}
						catch ( \UnderflowException $e )
						{
						}
					}
					elseif ( !$this->permission_showtopic and !$this->can('read') )
					{
					}
					else
					{
						if( $this->last_post and $result['date'] == $this->last_post )
						{
							$result['prefix']			= $this->last_prefix;
							$result['prefix_encoded']	= rawurlencode( $result['prefix'] );
						}
					}
				}
				
				return $result;
			}
			catch ( \RuntimeException $e )
			{
				if ( method_exists( get_parent_class(), __FUNCTION__ ) )
				{
					return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
				}
				else
				{
					throw $e;
				}
			}
		}
		catch ( \RuntimeException $e )
		{
			if ( method_exists( get_parent_class(), __FUNCTION__ ) )
			{
				return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
			}
			else
			{
				throw $e;
			}
		}
	}
  	
	/**
	 * [Node] Add/Edit Form
	 *
	 * @param	\IPS\Helpers\Form	$form	The form
	 * @return	void
	 */
	public function form( &$form )
	{
		try
		{
			try
			{
				parent::form( $form );
				
				if ( \IPS\Settings::i()->tags_enabled )
				{
					$form->add( new \IPS\Helpers\Form\YesNo( 'show_prefix_in_desc', $this->show_prefix_in_desc, FALSE, array(), NULL, NULL, NULL, 'show_prefix_in_desc' ) );
				}
			}
			catch ( \RuntimeException $e )
			{
				if ( method_exists( get_parent_class(), __FUNCTION__ ) )
				{
					return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
				}
				else
				{
					throw $e;
				}
			}
		}
		catch ( \RuntimeException $e )
		{
			if ( method_exists( get_parent_class(), __FUNCTION__ ) )
			{
				return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
			}
			else
			{
				throw $e;
			}
		}
	}

    /**
     * Set form for creating a node of this type in a club
     *
     * @param	\IPS\Helpers\Form	$form	Form object
     * @return	void
     */
    public function clubForm( \IPS\Helpers\Form $form, \IPS\Member\Club $club )
    {
	try
	{
		try
		{
		        parent::clubForm( $form, $club );
		
		        if ( static::isTaggable() === TRUE )
		        {
            /**
             * If there are multiple tabs, add another one for ours.
             */
		            if ( count( $form->elements ) > 1 )
		            {
                // No icon: looks nice, but no way to tell if the existing tabs have icons. aarg.
		                $form->addTab( 'advancedtagsprefixes_node_tab'/*, 'tags'*/ );
		            }
		
		            $form->addHeader('advancedtagsprefixes_node_tab');
		
		            $isForum = ( $this instanceof \IPS\forums\Forum ) ? TRUE : FALSE;
		
		            if ( $isForum === TRUE )
		            {
                /**
                 * If forums, toggle our settings on the 'allow prefixes' and 'allow tags' settings.
                 */
		                $tagFieldKeys		= array( 'bw_disable_prefixes', 'forum_tag_predefined', 'tag_mode', 'require_prefix', 'default_prefix', 'default_tags', 'show_prefix_in_desc', 'tag_min', 'tag_max' );
		                $prefixFieldKeys	= array( 'require_prefix', 'default_prefix', 'show_prefix_in_desc', 'allowed_prefixes' );
		
		                $form->add( new \IPS\Helpers\Form\YesNo( 'bw_disable_tagging', !$this->forums_bitoptions['bw_disable_tagging'], FALSE, array( 'togglesOn' => $tagFieldKeys ), NULL, NULL, NULL, 'bw_disable_tagging' ), NULL );
		                $form->add( new \IPS\Helpers\Form\YesNo( 'bw_disable_prefixes', !$this->forums_bitoptions['bw_disable_prefixes'], FALSE, array( 'togglesOn' => $prefixFieldKeys ), NULL, NULL, NULL, 'bw_disable_prefixes' ), NULL );
		            }
		
            /**
             * Gather sources for settings
             */
		            $tagModes		= array(
		                'inherit'	=> \IPS\Member::loggedIn()->language()->addToStack('advancedtagsprefixes_tagmode_inherit'),
		                'open'		=> \IPS\Member::loggedIn()->language()->addToStack('advancedtagsprefixes_tagmode_open'),
		                'closed'	=> \IPS\Member::loggedIn()->language()->addToStack('advancedtagsprefixes_tagmode_closed'),
		                'prefix'	=> \IPS\Member::loggedIn()->language()->addToStack('advancedtagsprefixes_tagmode_prefix'),
		            );
		
		            $app			= \IPS\Application::load('advancedtagsprefixes');
		
		            $allowedTags	= array();
		            foreach ( explode( ',', $this->tag_predefined ) as $v )
		            {
		                $allowedTags[ $v ] = $v;
		            }
		
		            $allPrefixes	= array();
		            foreach ( $app->getPrefixCache() as $k => $v )
		            {
		                $prefix		= \IPS\advancedtagsprefixes\Prefix::constructFromData( $v );
		
		                if ( $prefix !== FALSE )
		                {
		                    $allPrefixes[ $k ]	= $k;
		                }
		            }
		
		            if ( count( $allPrefixes ) < 2 )
		            {
		                $allPrefixes	= array( '' => '' ) + $allPrefixes;
		            }
		
            /**
             * Add our special settings
             */
		            if ( $isForum === TRUE )
		            {
                // Adding input that may otherwise be missing (if \IPS\Settings::i()->tags_open_system)
		                $form->add( new \IPS\Helpers\Form\Text( 'forum_tag_predefined', implode( ',', $allowedTags ), FALSE, array( 'autocomplete' => array( 'unique' => 'true' ), 'nullLang' => 'forum_tag_predefined_unlimited' ), NULL, NULL, NULL, 'forum_tag_predefined' ), NULL );
		            }
		
		            $form->add( new \IPS\Helpers\Form\YesNo( 'require_prefix', $this->require_prefix, FALSE, array(), NULL, NULL, NULL, 'require_prefix' ) );
		            $form->add( new \IPS\Helpers\Form\Select( 'tag_mode', $this->tag_mode, FALSE, array( 'options' => $tagModes ), NULL, NULL, NULL, 'tag_mode' ) );
		            $form->add( new \IPS\Helpers\Form\Text( 'default_tags', $this->default_tags, FALSE, array( 'autocomplete' => array( 'unique' => 'true' ), 'nullLang' => NULL ), NULL, NULL, NULL, 'default_tags' ) );
		            $form->add( new \IPS\Helpers\Form\Text( 'allowed_prefixes', $this->allowed_prefixes, FALSE, array( 'autocomplete' => array( 'unique' => 'true', 'source' => $allPrefixes, 'freeChoice' => FALSE ) ), NULL, NULL, NULL, 'allowed_prefixes' ) );
		            $form->add( new \IPS\Helpers\Form\Select( 'default_prefix', $this->default_prefix, FALSE, array( 'options' => array( '' => '' ) + $allPrefixes ), NULL, NULL, NULL, 'default_prefix' ) );
		            $form->add( new \IPS\Helpers\Form\Number( 'tag_min', !is_null( $this->tag_min ) ? $this->tag_min : -1, FALSE, array( 'unlimited' => -1, 'unlimitedLang' => 'use_default' ), NULL, NULL, NULL, 'tag_min' ) );
		            $form->add( new \IPS\Helpers\Form\Number( 'tag_max', !is_null( $this->tag_max ) ? $this->tag_max : -1, FALSE, array( 'unlimited' => -1, 'unlimitedLang' => 'use_default' ), NULL, NULL, NULL, 'tag_max' ) );
		        }
		}
		catch ( \RuntimeException $e )
		{
			if ( method_exists( get_parent_class(), __FUNCTION__ ) )
			{
				return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
			}
			else
			{
				throw $e;
			}
		}
	}
	catch ( \RuntimeException $e )
	{
		if ( method_exists( get_parent_class(), __FUNCTION__ ) )
		{
			return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
		}
		else
		{
			throw $e;
		}
	}
    }

    /**
     * Determine whether the current node class is taggable. Only way to find this is through the child content item class. Isn't that grand?
     */
    public static function isTaggable()
    {
	try
	{
		try
		{
		        if ( isset( static::$contentItemClass ) and \IPS\Settings::i()->tags_enabled and in_array( 'IPS\Content\Tags', class_implements( static::$contentItemClass ) ) )
		        {
		            return TRUE;
		        }
		
		        return FALSE;
		}
		catch ( \RuntimeException $e )
		{
			if ( method_exists( get_parent_class(), __FUNCTION__ ) )
			{
				return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
			}
			else
			{
				throw $e;
			}
		}
	}
	catch ( \RuntimeException $e )
	{
		if ( method_exists( get_parent_class(), __FUNCTION__ ) )
		{
			return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
		}
		else
		{
			throw $e;
		}
	}
    }

    /**
     * Save club form
     *
     * @param	\IPS\Member\Club	$club	The club
     * @param	array				$values	Values
     * @return	void
     */
    public function saveClubForm( \IPS\Member\Club $club, $values )
    {
	try
	{
		try
		{
        /**
         * Unpack our values and cleanse.
         */
				$values['club_node_public'] = 0;
		        if ( isset( $values['allowed_prefixes'] ) and !empty( $values['allowed_prefixes'] ) )
		        {
		            if( !is_array( $values['allowed_prefixes'] ) )
		            {
		                $values['allowed_prefixes'] = explode( ',', $values['allowed_prefixes'] );
		            }
		
		            array_map( 'trim', $values['allowed_prefixes'] );
		
		            $values['allowed_prefixes'] = array_filter( $values['allowed_prefixes'] );
		        }
		
		        $nodeSettings = array();
		        foreach ( \IPS\advancedtagsprefixes\Application::$nodeSettingsKeys as $key )
		        {
		            $nodeSettings[ $key ] = isset( $values[ $key ] ) ? $values[ $key ] : NULL;
		
		            unset( $values[ $key ] );
		        }
		
        /**
         * Set default tag values
         */
		        $this->forums_bitoptions['bw_disable_tagging'] = !$values['bw_disable_tagging'];
		        $this->forums_bitoptions['bw_disable_prefixes'] = !$values['bw_disable_prefixes'];
		        $this->tag_predefined = implode( ',', $values['forum_tag_predefined'] );
		
        /**
         * Do the normal node save hereish.
         */
		        parent::saveClubForm( $club, $values );
		
        /**
         * Save our values after the node.
         */
		        $this->saveNodeSettings( $nodeSettings );
		}
		catch ( \RuntimeException $e )
		{
			if ( method_exists( get_parent_class(), __FUNCTION__ ) )
			{
				return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
			}
			else
			{
				throw $e;
			}
		}
	}
	catch ( \RuntimeException $e )
	{
		if ( method_exists( get_parent_class(), __FUNCTION__ ) )
		{
			return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
		}
		else
		{
			throw $e;
		}
	}
    }

    /**
     * Save AT&P node data to the DB.
     *
     * @param  array $nodeSettings
     * @return $this
     */
    protected function saveNodeSettings( $nodeSettings )
    {
	try
	{
		try
		{
		        if ( static::isTaggable() === TRUE and !is_null( static::$permApp ) and !is_null( static::$permType ) and !empty( $nodeSettings ) )
		        {
		            $primaryKey	= static::$databaseColumnId;
		
		            if ( !isset( $nodeSettings['default_tags'] ) )
		            {
		                $nodeSettings['default_tags'] = array();
		            }
		
		            if ( !is_array( $nodeSettings['default_tags'] ) )
		            {
		                $nodeSettings['default_tags'] = explode( ',', $nodeSettings['default_tags'] );
		            }
		
		            if ( !isset( $nodeSettings['allowed_prefixes'] ) )
		            {
		                $nodeSettings['allowed_prefixes'] = array();
		            }
		
		            if ( !is_array( $nodeSettings['allowed_prefixes'] ) )
		            {
		                $nodeSettings['allowed_prefixes'] = explode( ',', $nodeSettings['allowed_prefixes'] );
		            }
		
		            $data		= array(
		                'node_app'			=> static::$permApp,
		                'node_type'			=> static::$permType,
		                'node_id'			=> $this->$primaryKey,
		                'require_prefix'	=> isset( $nodeSettings['require_prefix'] ) ? (int)$nodeSettings['require_prefix'] : 0,
		                'default_prefix'	=> $nodeSettings['default_prefix'] ?: NULL,
		                'default_tags'		=> !empty( $nodeSettings['default_tags'] ) ? implode( ',', $nodeSettings['default_tags'] ) : NULL,
		                'tag_mode'			=> $nodeSettings['tag_mode'] ?: NULL,
		                'allowed_prefixes'	=> !empty( $nodeSettings['allowed_prefixes'] ) ? implode( ',', $nodeSettings['allowed_prefixes'] ) : NULL,
		                'tag_min'			=> (int)$nodeSettings['tag_min'],
		                'tag_max'			=> (int)$nodeSettings['tag_max'],
		            );
		
		            \IPS\Db::i()->insert( 'advancedtagsprefixes_node_settings', $data, TRUE );
		
		            \IPS\Application::load('advancedtagsprefixes')->flushNodeSettingsCache();
		        }
		
		        return $this;
		}
		catch ( \RuntimeException $e )
		{
			if ( method_exists( get_parent_class(), __FUNCTION__ ) )
			{
				return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
			}
			else
			{
				throw $e;
			}
		}
	}
	catch ( \RuntimeException $e )
	{
		if ( method_exists( get_parent_class(), __FUNCTION__ ) )
		{
			return \call_user_func_array( 'parent::' . __FUNCTION__, \func_get_args() );
		}
		else
		{
			throw $e;
		}
	}
    }
}

 

 

comment_199223

Вот, это должно работать на 4.6 и 4.7, проверяйте.

 

 

Advanced Tags & Prefixes 3.2.2a.tar

comment_199227
1 час назад, Desti сказал:

Вот, это должно работать на 4.6 и 4.7, проверяйте.

 

 

Advanced Tags & Prefixes 3.2.2a.tar 267.5 kB · 1 загрузка

Это в загрузки надо добавить. Спасибо, добрый человек!!

comment_199228
5 часов назад, Desti сказал:

Вот, это должно работать на 4.6 и 4.7, проверяйте.

Можно список измененных файлов, чтобы всё не проверять? Не хочу, чтобы кастомные изменения слетели.

comment_199230

Все без исключения, везде криворукость разработчика. Один хук темы только без ошибок. 

  • 1 месяц спустя...
comment_201553
On 2/3/2024 at 3:28 AM, Desti said:

Вот, это должно работать на 4.6 и 4.7, проверяйте.

 

 

Advanced Tags & Prefixes 3.2.2a.tar 267.5 kB · 22 downloads

 

I had version 3.2.2 installed, and after upgrading to PHP8.1 and version 4.7.16, the system announced after upgrading that this program is not compatible with PHP8.1 and will be disabled.

I saw a version updated by @Desti to version 3.2.2a is this version updated for new PHP version ????

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.


Guest
Ответить в этой теме...

Последние посетители 0

  • No registered users viewing this page.