Jump to content
View in the app

A better way to browse. Learn more.

IPBMafia.ru - поддержка Invision Community, релизы, темы, плагины и приложения

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Есть у кого опыт работы с IPB XML RPC?

После обновления до 3.4.1 Перестал работать метод postTopic.

На 3.3.4 все было отлично.

  • Author

Ну судя по исходникам есть небольшие изменения, но чисто косметические, там логирование вынесено в отдельный метод.

 

/**
	 * Posts a topic to the board remotely
	 * 
	 * @param	string  $api_key		Authentication Key
	 * @param	string  $api_module		Module
	 * @param	string	$member_field	Member field to check (valid: "id", "email", "username", "displayname")
	 * @param	string	$member_key		Member key to check for
	 * @param	integer	$forum_id		Forum id to post in
	 * @param	string	$topic_title	Topic title
	 * @param	string	$topic_description	Topic description
	 * @param	string	$post_content	Posted content
	 * @return	string	xml
	 */	
	public function postTopic( $api_key, $api_module, $member_field, $member_key, $forum_id, $topic_title, $topic_description, $post_content )
	{
		//-----------------------------------------
		// INIT
		//-----------------------------------------

		$api_key                = IPSText::md5Clean( $api_key );
		$api_module             = IPSText::parseCleanValue( $api_module );
		$member_field           = IPSText::parseCleanValue( $member_field );
		$member_key             = IPSText::parseCleanValue( $member_key );
		$topic_title            = IPSText::parseCleanValue( $topic_title );
		$forum_id			    = intval( $forum_id );
		$UNCLEANED_post_content = $post_content;
		
		//-----------------------------------------
		// Authenticate
		//-----------------------------------------
		
		if ( $this->__authenticate( $api_key, $api_module, 'postTopic' ) !== FALSE )
		{
			//-----------------------------------------
			// Add log
			//-----------------------------------------
			
			$this->addLogging( $api_key );

			//-----------------------------------------
			// Member field...
			//-----------------------------------------
			
			$member	= IPSMember::load( $member_key, 'all', $member_field );
			
			//-----------------------------------------
			// Got a member?
			//-----------------------------------------
			
			if ( ! $member['member_id'] )
			{
				$this->classApiServer->apiSendError( '10', "IP.Board could not locate a member using $member_key / $member_field" );
			}
			
			//-----------------------------------------
			// Get some classes
			//-----------------------------------------

			ipsRegistry::getAppClass( 'forums' );

			require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPost.php' );/*noLibHook*/
			$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/post/classPostForms.php', 'classPostForms', 'forums' );
			$_postClass = new $classToLoad( $this->registry );
			
			/* reset forum list to allow all access */
			$this->registry->getClass('class_forums')->strip_invisible = false;
			$this->registry->getClass('class_forums')->forumsInit();
				
			//-----------------------------------------
			// Set the data
			//-----------------------------------------
		
			$_postClass->setIsPreview( false );
			$_postClass->setForumData( $this->registry->getClass('class_forums')->forum_by_id[ $forum_id ] );
			$_postClass->setForumID( $forum_id );
			$_postClass->setPostContent( $UNCLEANED_post_content );
			$_postClass->setAuthor( $member['member_id'] );
			$_postClass->setPublished( true );
			$_postClass->setSettings( array( 'enableSignature' => 1,
												   'enableEmoticons' => 1,
												   'post_htmlstatus' => 0,
												   'enableTracker'   => 0 ) );
			$_postClass->setTopicTitle( $topic_title );

			# Switch off perm checks
			$_postClass->setBypassPermissionCheck(true);
			/**
			 * And post it...
			 */
			try
			{
				if ( $_postClass->addTopic() === FALSE )
				{
					$this->classApiServer->apiSendError( '10', "IP.Board could not post the topic: " . $_postClass->getPostError() );
				}
			}
			catch( Exception $error )
			{
				$this->classApiServer->apiSendError( '10', "IP.Board post class exception: " . $error->getMessage() );
			}

			$this->classApiServer->apiSendReply( array( 
														'result'   => 'success',
														'topic_id' => $_postClass->getTopicData('tid')
												)	);
			exit();
		}
	}

 

 

 

При этом всем, метод fetchMember нормально работает, как и до апгрейда...

Весь процесс отладки еще усложняет тот факт, что с XML-RPC я работаю с Flash приложения, и при обработке ответа от postTopic не возвращается ответ в формате XML-RPC, так как обработчик "обваливается" на неверном формате.

  • Author

Проверил. Нет никакого ответа от выполнения скрипта, вообще, пустой ответ.



Еще добавлю, что вызовы методов XML-RPC успешно пишутся в логи, в том числе и postTopic

  • Author

Поковырялся в исходнике обработки postTopic, проблему нашел в этой строке:

 

 

try
			{

				if ( $_postClass->addTopic() === FALSE )

 

 

после вызова addTopic настает гробовая тишина. Не срабатывает в том числе и Exeption.

 

P.S.

Кстати, а в чем может быть проблема, не могу авторизироваться на официальном форуме IPB, что бы подергать разработчиков. Сообщает, что пароль неверный, хотя даже прохожу полностью восстановление пароля (раз 5 уже это делал) и ввожу даже предложенный пароль системой восстановления.

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.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.