Fork me on GitHub

Wierd error Static Docs maybe ???  Bottom

  • Hi every one
    I am working with static doc module. works great for what I need, but I am trying to create a sub admin group that can edit but not have master admin control of the settings and such. all seems to be going well the permisions work and they have access to the edit functions. But here is the catch when they try to submit the edited update I get this error

    Code

    Not authorized to access Template module

    I have conntacted Simon Wunderlin who wrote the module and he seems to thing it may have something to do with changes in PN (xanthia) since he wrote it. he is no longer working on this so I need to figure this out. has any one ran accross this and if so where might I start to make this module work with the new PN.


    I believe this is the code that controls this. are some of these function calls maybe out dated?

    Code

    function static_docs_admin_modify()
    {
        // Create output object
        $output = new myHTML();
        // Get parameters
        $file = pnVarCleanFromInput('f');

        if (!pnSecAuthAction(0, 'Static Docs::', $file . '::', ACCESS_EDIT)) {
            $output->Text(_TEMPLATENOAUTH);
            return $output->GetOutput();
        }
        // Load user API to obtain item information function
        if (!pnModAPILoad('Static_Docs', 'user')) {
            $output->Text(_LOADFAILED);
            return $output->GetOutput();
        }
        // Get item information
        $item = pnModAPIFunc('Static_Docs',
                             'user',
                             'get',
                             array('file' => $file));

        if ($item == false) {
            $output->Text(_SDM_NOSUCHITEM);
            return $output->GetOutput();
        }

        // Security check
        // if (!pnSecAuthAction(0, 'Static Docs::', "$item[name]::$item[file_id]", ACCESS_EDIT)) {
        // $output->Text(_TEMPLATENOAUTH);
        // return $output->GetOutput();
        // }

        // Add menu to output
        $output->SetInputMode(_PNH_VERBATIMINPUT);
        $output->Text(static_docs_adminmenu());
        $output->SetInputMode(_PNH_PARSEINPUT);

        // Start form
        $output->FormStart(pnModURL('Static_Docs', 'admin', 'update'));
        $output->FormHidden('authid', pnSecGenAuthKey());
        $output->FormHidden('file', pnVarPrepForDisplay($file));
        $output->FormHidden('mimetype', pnVarPrepForDisplay($item['mimetype']->sContent_type));
        $output->FormHidden('file_id', pnVarPrepForDisplay($item['file_id']));

        $output->TableStart();

        // $handler = loadHandler( &$item );
        // $handler = $item['mimetype_types']->mime_loadHandler();
        $handler = &sdm_load_handler($item['mimetype']->getContentType());

        $output->output .= $handler->edit($item);
        if ($handler->type == SDFRM_HANDLERTYPE_INLINE)
            $output->output .= $handler->get_footer($item);
        $output->TableEnd();

        if (SDFRM_DEBUG) {
            ob_start();
            var_dump($item);
            $dbg = ob_get_contents();
            ob_end_clean();

            $output->output .= "<table cellpadding=\"5\" cellspacing=\"0\" ";
            $output->output .= "\"border=\"1\" width=\"100%\"><tr><td><b>DEBUG";
            $output->output .= "</b><pre>" . $dbg . "</pre></td></tr></table>";
        }

        $output->Linebreak(2);
        $output->FormSubmit(_SDM_BTN_UPDATE);
        $output->FormCancel(_SDM_BTN_CANCEL);
        $output->Text(' ');
        $output->FormReset(_SDM_BTN_RESET);
        $output->FormEnd();

        return $output->GetOutput();
    }


    Hope that made some sense

    thanx dave

This list is based on users active over the last 60 minutes.