We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25663 MODX Staff
    • 12,272 Posts
    Got it installed as the latest version but the file tables are empty of course. Does the script require the tables to have something in them. I can’t get the add files or any other way to interact working.
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 25663 MODX Staff
      • 12,272 Posts
      I get the listing of actions, but clicks on any of the links results in getting an error page.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 25663 MODX Staff
        • 12,272 Posts
        More investigation: I think it’s because of the multilanguage stuff based on how the links are being built. For example: http://prescott.vertexworks.com/index.php?id=&publiclist=true doesn’t include an actual page ID.

        update:
        Actually, upon further investigation, in menu.php it appears that the $pageID variable is never set. Where do I start looking now?

        Resolution for now:
        I think it’s breakign because of friendly URLs and accessing directly via document number. Change line 3 of menu.php from:
        $pageID = $_GET['id'];

        to:
        $pageID = $modx->documentObject['id'];
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 25663 MODX Staff
          • 12,272 Posts
          More errors after the above fix. Clicking the categories link results in a fatal error, probably because there are no categories in the category table by default with a clean install:
          PHP error debug
          ? Error: 	mysql_data_seek() [function.mysql-data-seek]: Offset 0 is invalid for MySQL result index 23 (or the query data is unbuffered)	 
          ? Error type/ Nr.: 	Warning - 2	 
          ? File: 	/home/httpd/assets/snippets/docman/includes/categoryform.php	 
          ? Line: 	13	 
          ? Line 13 source: 	mysql_data_seek($results, 0);


          update: Definitely due to the empty default category. I think there’s more issues caused by an empty default DB... like when clicking on the Tidy link in the default page:
          MODx encountered the following error while attempting to parse the requested resource:
          ? Execution of a query to the database failed ?
          ? ? ? SQL: DELETE FROM `dbprescott`.files_perms USING `dbprescott`.files_perms fp LEFT JOIN `dbprescott`.etomite_web_groups wg ON wg.webuser = fp.uid WHERE wg.webuser is NULL 
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 25663 MODX Staff
            • 12,272 Posts
            Found one other minor bug to report quickly: When adding a file it does not save the description. When editing a file properties, however, it does.
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Corrected menu.php (decided to set the docid in the snippet itself for easy use, just never caught the change in the menu.php)

              <?php
              // check to see if user has management rights
              $fm .= "<table id='dmMenuBar' cellspacing='0' cellpadding='0' border='0'><tr>";
              
                  // docmanager menu
              if(isset($_SESSION['webgroups'])) {
                  if(in_array($wgmanageID,$_SESSION['webgroups'])) {
                      $fm .= "<td><a href='index.php?id=$docid&categoryform=true' title='".$_docman['manage_categories']."'>".$_docman['manage_categories']."</a> | </td>"; 
                      $fm .= "<td><a href='index.php?id=$docid&addform=true' title='".$_docman['uploadnew']."'>".$_docman['addnew']."</a> | </td>"; 
                      $fm .= "<td><a href='index.php?id=$docid&tidy=true' title='".$_docman['removeperms']."' onclick='return confirm(\"".$_docman['confirm_tidy']."\");'>".$_docman['tidy']."</a> | </td>"; 
                  }
              }
                  // general menu
              $fm .= "<td><a href='index.php?id=$docid' title='".$_docman['listfiles']."'>".$_docman['list']."</a> </td>";
              $fm .= "<td><form name='selcat' action='index.php?id=$docid' method='post'>";
              $fm .= "<select name='dmCatmenu' class='dm100' onChange='this.form.submit();'>";
              $fm .= "<option>".$_docman['by_cat']."</option>";
              $sql = "SELECT * FROM $dbase.files_categories ORDER BY catname";
              $res = $modx->dbQuery($sql);
              while($row = $modx->fetchRow($res)) {
                  $fm .= "<option value='".$row['id']."'>".$row['catname']."</option>";
              }
              $fm .= "</select></form></td></tr></table>";
              
              ?>
              
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                About the db errors on empty tables. I don’t see any way to supress the errors using $modx->dbQuery. I’ll start working on queries to check for content, then use an "if" clause. Should be a better way. Probably is.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  re the no description issue. Correct add.php, line 23 should read:
                  $description = isset($_POST['description']) ? $_POST['description'] : "No description available.";
                  
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    The category form should never be empty. The sql file in the install folder has the table creation code, as well as one insert line and one update line.

                    CREATE TABLE `files_categories` (
                      `id` int(11) NOT NULL auto_increment,
                      `catname` varchar(255) NOT NULL default '',
                      PRIMARY KEY  (`id`)
                    ) TYPE=MyISAM COMMENT='Categories for uploaded files';
                    
                    INSERT INTO `files_categories` (`catid`,`catname`) VALUES (0,'Any');
                    UPDATE `files_categories` SET `id` = '0' WHERE `id` = '1';
                    


                    I guess that wasn’t in the older versions, since the category functions hadn’t been enabled yet. Basically, there needs to be a category with ID of 0. Doesn’t matter much what you call it, Default, Top, Any... it’s a general catch-all; especially if deleting a category all files in that category get their categories set to 0.
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      As far as the categoryform.php file, don’t ask me what the <bleep> that mysql_data_seek line is doing there. Sometimes my logic is too convoluted even for me to comprehend (especially when it doesn’t work anyway!). So line 13 should just be deleted. I think. I would be sure if I knew why I’d put it there in the first place! That will solve the issue of not having even the default category installed, although that in itself will cause problems when deleting categories. <sigh> it’s always the error conditions that make the most trouble, and I think account for a large percentage of any body of code! Too bad computers are so stupid!
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org