⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmlrpcserver.class.php

📁 一个用PHP编写的
💻 PHP
📖 第 1 页 / 共 4 页
字号:
	    		CacheControl::resetBlogCache( $blogInfo->getId());				$this->setResponseCharset( $blogInfo );	            return true;	        } else	        {	            return new IXR_Error(-1, 'You did not provide the correct password');	        }	    }	    function metaWeblogEditPost($args)	    {			$users = new Users();			$articles = new Articles();			$category = new ArticleCategories();	        $postid     = $args[0];	        $username   = $args[1];	        $password   = $args[2];	        $content    = $args[3];	        $publish    = $args[4];	        /*	            boolean, true or false	        */	        $userInfo = $users->getUserInfo( $username, $password );	        if( $userInfo ) {			            if ($publish) {	                $status = POST_STATUS_PUBLISHED;	            } 				else {	                $status = POST_STATUS_DRAFT;	            }                            $title = $content["title"];                                // Check to see if the MovableType extnensions have been added	            $mt_excerpt = $content["mt_excerpt"]; 	            $mt_text_more = $content["mt_text_more"]; 	            $mt_allow_comments = $content["mt_allow_comments"];                                 if ( $mt_text_more != NULL && trim($mt_text_more) != "") {                    $body = $content["description"] . POST_EXTENDED_TEXT_MODIFIER . $mt_text_more;                }                else {                    $body = $content["description"];                }	            $article = $articles->getBlogArticle($postid,	                                                 -1, // blogId	                                                 true, // includeHiddenFields	                                                 -1, // date	                                                 -1, // categoryId	                                                 $userInfo->getId());					// check that the article is valid				if( !$article ) {					return( new IXR_Error(-1, 'Incorrect article' ));									}								// see that the user can update articles	            $blogid = $article->getBlog();				$blogInfo = $article->getBlogInfo();				if( !$this->userHasPermission( $userInfo, $blogInfo, "update_post" )) {					return( new IXR_Error(-1, 'This user does not have enough permissions' ));				}                $catList = NULL;				if ( array_key_exists( "categories",  $content ) ) {                    $catList = $content["categories"];	            }	            //	            // :KLUDGE:	            // not exactly the smartest and fastest bit of code ever but it seems to work :-)	            //	            $categories = Array();	            $cats = $category->getBlogCategories($blogid);	            if ( $catList != NULL )	            {	                foreach( $catList as $categoryName ) {	                    foreach( $cats as $blogCategory ) {	                        $categoryName = trim($categoryName);	                        if ( strcmp( $categoryName, $blogCategory->getName()) == 0 )	                        {	                            $categories[] = $blogCategory->getId();	                        }	                    }	                }                    $article->setCategoryIds( $categories );	            }	            else if ( count($article->getCategories()) == 0) {                    // Only assign a new category if there isn't one                       	                // if no category, let's pick a random one	                $blogCategory = array_pop( $cats );	                $categories[] = $blogCategory->getId();	                                    $article->setCategoryIds( $categories );	            }	            $article->setText($body);	            $article->setTopic($title);	            $article->setStatus($status);				// Get the plugin manager				$plugMgr =& PluginManager::getPluginManager();				$plugMgr->setBlogInfo( $blogInfo );				$plugMgr->setUserInfo( $userInfo );				$plugMgr->loadPlugins();				// Send the EVENT_PRE_POST_UPDATE message				$plugMgr->notifyEvent( EVENT_PRE_POST_UPDATE, Array( "article" => &$article ));            	            $articles->updateArticle($article);	            // Send the EVENT_POST_POST_UPDATE messages to the plugins	            $plugMgr->notifyEvent( EVENT_POST_POST_UPDATE, Array( "article" => &$article ));					    		CacheControl::resetBlogCache( $blogid );            					$this->setResponseCharset( $blogInfo );	            return true;	        } else	        {	            return new IXR_Error(-1, 'You did not provide the correct password');	        }	    }	    function deletePost($args)	    {			$users = new Users();			$articles = new Articles();			$blogsG = new Blogs();	        $appkey     = $args[0];	        $postid     = $args[1];	        $username   = $args[2];	        $password   = $args[3];	        $publish    = $args[4];	        $userInfo = $users->getUserInfo( $username, $password );	        if( $userInfo ) {	            $article = $articles->getBlogArticle($postid,	                                                 -1, // blogId	                                                 true, // includeHiddenFields	                                                 -1, // date	                                                 -1, // categoryId	                                                 $userInfo->getId());					// check if the article that was pulled is valid at all				if( !$article ) {					return( new IXR_Error(-1, 'The article is not correct' ));				}								// check the permissions				$blogInfo = $article->getBlogInfo();				if( !$this->userHasPermission( $userInfo, $blogInfo, "update_post" )) {					return( new IXR_Error(-1, 'This user does not have enough permissions' ));				}								// Get the plugin manager				$plugMgr =& PluginManager::getPluginManager();				$plugMgr->setBlogInfo( $blogInfo );				$plugMgr->setUserInfo( $userInfo );				$plugMgr->loadPlugins();				// Send the EVENT_PRE_POST_DELETE message				$plugMgr->notifyEvent( EVENT_PRE_POST_DELETE, Array( "article" => &$article ));            	            $articles->deleteArticle(	                $postid,	                $userInfo->getId(), // userid	                $article->getBlog()	            );	            // Send the EVENT_POST_POST_DELETE messages to the plugins	            $plugMgr->notifyEvent( EVENT_POST_POST_DELETE, Array( "article" => &$article ));					    		CacheControl::resetBlogCache( $blogInfo->getId());				$this->setResponseCharset( $blogInfo );	            return true;	        } 			else {	            return new IXR_Error(-1, 'You did not provide the correct password');	        }	    }	    function getRecentPosts($args)	    {			$users = new Users();			$articles = new Articles();			$blogs = new Blogs();		        /*	            "userid" =>	            "dateCreated" =>	            "content" =>	            "postid" =>	        */	        $appkey     = $args[0];	        $blogid     = $args[1];	        $username   = $args[2];	        $password   = $args[3];	        $number     = $args[4];	        $userInfo = $users->getUserInfo($username,$password);	        if( $userInfo )	        {				$blogInfo = $blogs->getBlogInfo( $blogid );				if( !$blogInfo ) {					return new IXR_Error(-1, 'Incorrect blog id');									}								// check this user's permissions				if( !$this->userHasPermission( $userInfo, $blogInfo, "view_posts" )) {					return new IXR_Error(-1, 'This user does not have enough permissions' );				}				            $ret = array();	            $list = $articles->getBlogArticles(	                $blogid,	                -1, // date	                $number,  // amount	                -1  // any category id	            );		            foreach( $list as $item ) {	                $dateObject = $item->getDateObject();	                lt_include( PLOG_CLASS_PATH."class/data/timestamp.class.php" );	                // Get the unix time stamp 	                $time = $dateObject->getTimestamp(DATE_FORMAT_UNIXTIME);	                $dummy                  = array();					$userInfo               = $item->getUserInfo();	                $dummy["userid"]        = $userInfo->getId();	                $dummy["dateCreated"]   = new IXR_Date($time);	                $dummy["content"]       = $item->getTopic() . "\r\n" . $item->getText(false) . " ";	                $dummy["postid"]        = $item->getId();	                $ret[]                  = $dummy;	            }					$this->setResponseCharset( $blogInfo );		            return $ret;	        } else	        {	            return new IXR_Error(-1, 'You did not provide the correct password');	        }	    }	    function metaWeblogGetRecentPosts($args)	    {			$users = new Users();			$articles = new Articles();	        $blogid     = $args[0];	        $username   = $args[1];	        $password   = $args[2];	        $number     = $args[3];	        $userInfo = $users->getUserInfo( $username, $password );	        if( $userInfo ) {	            $ret = array();	            $list = $articles->getBlogArticles(	                $blogid,  	                -1,  // date	                $number, // number of articles	                -1  // category id	            );	            $blogs = new Blogs();	            $blogInfo = $blogs->getBlogInfo( $blogid );					// check if the blog is valid				if( !$blogInfo ) {					return new IXR_Error(-1, 'The blog identifier is not valid' );				}								// check this user's permissions				if( !$this->userHasPermission( $userInfo, $blogInfo, "view_posts" )) {					return new IXR_Error(-1, 'This user does not have enough permissions' );				}					                $url = $blogInfo->getBlogRequestGenerator();                $blogSettings = $blogInfo->getSettings();	            foreach($list as $item)	            {	                $dateObject = $item->getDateObject();	                lt_include( PLOG_CLASS_PATH."class/data/timestamp.class.php" );	                // Get the unix time stamp 	                $time = $dateObject->getTimestamp( DATE_FORMAT_UNIXTIME );	                $articleCat = $item->getCategory();	                $dummy                  = array();					$userInfo               = $item->getUserInfo();	                $dummy["userid"]        = $userInfo->getId();	                $dummy["dateCreated"]   = new IXR_Date($time);	                $dummy["title"]         = $item->getTopic();                     $dummy["description"]   = $item->getIntroText(); 	                $dummy["postid"]        = $item->getId();	                $dummy["link"]          = $url->postLink( $item );	                $dummy["permaLink"]     = $url->postPermalink( $item );	                $catArray               = array();                    foreach( $item->getCategories() as $category ) {                        $catArray[]             = $category->getName();                    }                    $dummy["categories"]      = $catArray;                    // The MovableType Extensions                    $dummy["mt_text_more"]       = $item->getExtendedText();                     $dummy["mt_allow_comments"]  = $item->getCommentsEnabled(); 	            						$this->setResponseCharset( $blogInfo );	                $ret[]                  = $dummy;	            }	            return $ret;	        } 			else {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -