<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div>

</div>
<br><div><div>On Feb 11, 2014, at 3:42 AM, Petko Yotov wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Petko Yotov writes:<br><br><blockquote type="cite">Crisses writes:<br></blockquote><blockquote type="cite"><blockquote type="cite">« HTML content follows »<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Hi,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I've spent a day trying to fix this, so I have to figure that the documentation or myself (or both) aren't up to the task...<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I have an array of (xml scalar) variables being passed to PmWiki via ?action=xmlrpc, including the author & password.  All the xmlrpc functions are in their own classes, including extracting the password from the xml data.  It works just fine, can dump the vars and all is (apparently?) in order.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I'm using basic PmWiki passwording.  I've set up the password to be passed to $_POST['authpw'] and the username to go into $_POST['authid'] and (global) $Author.<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><font class="Apple-style-span" color="#006312"><br></font><blockquote type="cite">If you use basic PmWiki passwording (shared password) you need to set $_POST['authpw'] before calling RetrieveAuthPage().<br></blockquote><br>Or, you should be able to call SessionAuth($pagename, $pass); before calling RetrieveAuthPage(), no need to set $_POST['authpw'].<br><br>After you have authenticated, just get and return the PHPSESSID cookie when you access the other pages, no need to repost user/pass every time.<br><br>Petko<br></div></blockquote></div><div><br></div><div><br></div><div>Apparently I'm still not "getting it"....  Note: I'm just using basic passwords (for now) and not trying to make it compatible with authuser.php (yet).</div><div><br></div><div>I don't think the XMLRPC clients (Ecto, MarsEdit, etc.) have session cookies.  </div><div><br></div><div>$password and $username are set just fine as far as I can tell from the scalarval() (no whitespace chars added, etc...).  xes_error & xes_dump are debug functions which write to the error_log.  xes_dump does a print_r($var, true).  $page and $page['text'] comes out blank every time, unless I use ReadPage().  CondAuth would work to skip the rest of the loop, but the auth fails.  The remainder of the GetRecentPages function runs fine when I use ReadPage including client-side XML output, and with authentication the blank pages are sent to the XMLRPC client as if nothing else is wrong.</div><div><br></div><div><br></div><div>(parent function(s) called via $HandleActions['xmlrpc'] = 'HandleXMLRPC'; )</div><div><br></div><div>...</div><div><br></div><div><div><div>        // Retrieves a certain number of PmWiki pages ordered by date</div><div>        public static function GetRecentPages($params) {</div><div>                xes_error("Calling GetRecentPages.");</div><div>                global $XMLRPC_AuthPage;</div><div>                $blogidp=$params->getParam(0); $groupname=$blogidp->scalarval();</div><div>                $usernamep=$params->getParam(1); $username=$usernamep->scalarval();</div><div>                $passwordp=$params->getParam(2); $password=$passwordp->scalarval();</div><div>                $passp=$params->getParam(3); $number=$passp->scalarval();</div><div>                ValidateUser($username,$password);</div><div><br></div><div>                // Gather pages in an array for sorting by time</div><div>                $grouppages = $fullpages = Array();</div><div>                $pattern = "/^$groupname\\./";</div><div>                $grouppages = ListPages($pattern);</div><div>                foreach($grouppages as $pagename) {</div><div>                        xes_dump($pagename, "Next Name: ");</div><div>                        // Skip pages we do not have access to</div><div>                        if (! CondAuth($pagename, 'edit')) xes_error("No Text 4 u!");</div><div>                        $page = RetrieveAuthPage($pagename, 'edit', false, 0);</div><div>                        #$page = ReadPage($pagename);</div><div>                        xes_dump($page, "Page: ");</div><div>                        $fullpages[] = $page;</div><div>                }</div><div>                //Needs an empty error! No pages found....</div></div><div><br></div><div>                function ComparePageTime($a, $b) {</div><div>                        if ($a['time'] > $b['time']) return -1;</div><div>                        if ($a['time'] < $b['time']) return 1;</div><div>                        return 0;</div><div>                }</div><div>                usort($fullpages, "ComparePageTime");</div><div><br></div><div>                $arrayval = Array();</div><div>                $pagenum = 0;</div><div>                // Only return as many pages as are requested</div><div>                foreach($fullpages as $page) {</div><div>                        if($pagenum++ >= $number) break;</div><div><br></div><div>                        $arrayval[]= BloggerXMLRPC::PageAsXMLStruct($page);</div><div>                }</div><div>                $myVal=new xmlrpcval($arrayval, "array");</div><div>                return new xmlrpcresp($myVal);</div><div>        }</div></div><div><br></div><div>...</div><div><br></div><div><br></div><div><div>separate "helper" function (I know it's not performing validation, I inherited the namespace from the former recipe author and haven't corrected it yet -- it used to support UserAuth and return false on failure):</div><div><br></div><div><div>function ValidateUser ($username, $password) {</div><div>        global $Author;</div><div>        xes_error("Calling ValidateUser");</div><div>        $Author = $_POST['authid'] = $username;</div><div>        $_POST['authpw'] = $password;</div><div>        return true;</div><div>}</div></div></div><div><br></div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Comic Sans MS" size="3" style="font: normal normal normal 12px/normal 'Comic Sans MS'; ">Crisses</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">--If PmWiki plug-ins are recipes, then I'm a chef! Or at least a line cook.  :)</div></div></body></html>