We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10190
    • 187 Posts
    Quote from: sottwell at Feb 02, 2007, 05:23 PM

    I got a fix for a friendly URL problem I was having on one server from the Gallery forums. It seems that you need to add
    Options +FollowSymLinks
    to the .htaccess file before starting the rewrite engine.

    Hi Susan,

    it would be great to have it that easy - should I alter the .htaccess file of modx or the one of gallery2? Or even both? I think the one of modx is parsed first, but since both should be parsed it could be that it works in either of them?

    For the time being I have "RewriteEngine Off" in both files - did you take the original .htaccess files and leave them as they were?

    It would be great if you could check them both and tell me whether you have both enabled or not - I need FURLs desperatly! wink

    Cheers!
    Frisco
      • 10190
      • 187 Posts
      Hi,

      I tested it right this moment, it seems to work fine! I put your modification in the modx .htaccess file and enabled the rewrite engine in both files. Afterwards I looked up the configuration section in the manager and enabled FURLs there as well. That’s it.

      Unbelievable a waited over six month, wrote uncountable forum messages and searched the net ’til my finger tips went numb and all necessary was this single, simple line!

      Susan, thanks so much, you really made my day!

      Cheers!
      Frisco
        • 20644
        • 37 Posts
        Quote from: RaVen69 at Feb 02, 2007, 11:43 AM

        So I will test this over the weekend and report my experiences (success & errors/problems) here.
        Quote from: Frisco at Feb 02, 2007, 04:08 PM

        that’s great, I’ll try to test it on the weekend.

        Thanks for Testing! laugh

        Additionally,I fixed "install/setup.info.php" $moduleVersion = "1.0"; to $moduleVersion = "1.1";
        I attach this fixed file.
        But I tried on another machine, I didn’t succeed to upgrade using installer(1.0 to 1.1).
        Installer displayed Upgrade Succeeded but no change.
        To upgrade, it need to delete old module maybe.



        I love MODx and Gallery2! grin
          • 10190
          • 187 Posts
          Quote from: muramoto at Feb 03, 2007, 12:28 AM

          Thanks for Testing! laugh

          Well, I haven’t tested your code yet, I tested Susans .htaccess modification. For your module I need some more time, but don’t worry, I’ll test it definetly! wink

          Quote from: muramoto at Feb 03, 2007, 12:28 AM

          Additionally,I fixed "install/setup.info.php" $moduleVersion = "1.0"; to $moduleVersion = "1.1";
          I attach this fixed file.
          But I tried on another machine, I didn’t succeed to upgrade using installer(1.0 to 1.1).
          Installer displayed Upgrade Succeeded but no change.
          To upgrade, it need to delete old module maybe.
          ...
          I love MODx and Gallery2! grin

          Well, that could be that uninstallation before is necessary. And I’m absolutly on your side, modx and G2 is THE combination for me! smiley

          Cheers!
          Frisco
            • 21475
            • 80 Posts
            Thanks muramoto smiley

            Everthing seems to work fine, except my users aren’t automaticaly logged into gallery.
            In my gallery, only Regitered Members can see albums... so when i go to the gallery in embed mode, its works, but gallery ask me to log in... huh

            Any clue?

            Thanks!
              • 20644
              • 37 Posts
              Quote from: nicpan at Feb 03, 2007, 03:24 PM

              Everthing seems to work fine, except my users aren’t automaticaly logged into gallery.
              In my gallery, only Regitered Members can see albums... so when i go to the gallery in embed mode, its works, but gallery ask me to log in... huh

              Hi nicpan

              Modify the line of gallery2 plugin (near weblogin)

              GalleryEmbed::isExternalIdMapped($uid,’GalleryUser’)==GalleryStatus::success())

              to

              GalleryEmbed::isExternalIdMapped($uid,’GalleryUser’)==null)

              Good Luck!
                • 21475
                • 80 Posts
                Thanks for your reply muramoto.

                I took your gallery module, with its plugin, every line where already replaced (GalleryEmbed::isExternalIdMapped($uid,’GalleryUser’)==GalleryStatus::success()) by
                GalleryEmbed::isExternalIdMapped($uid,’GalleryUser’)==null) )

                But i am still not logged into the gallery.

                I wonder why there’s not ’OnWebLogin’ event checked, and why there’s no management on this case in the plugin, as this was done for the smf connector...

                I read (a bit) the doc for embedding the gallery, well it seems that you just have to map your user with gallery, and if you pass the active user id to the init function, the user should be logged.

                I tried to use this, but i have this error :
                Error (ERROR_MISSING_OBJECT) : 35 GalleryUser


                Well, i’m a bit lost...

                Any help would be appreciated!

                  • 10190
                  • 187 Posts
                  Hi muramoto,

                  I’ve tested your module now, but I have the following error when starting the module in the manager:

                  Warning: execute(/var/www/modx/gallery2embed.php) [function.execute]: failed to open stream: No such file or directory in /var/www/MODx-0.9.1/assets/modules/gallery/g2cms.admin.class.inc.php on line 24

                  Fatal error: execute() [function.require]: Failed opening required ’/var/www/modx/gallery2embed.php’ (include_path=’/var/www/MODx-0.9.1/manager/includes/’) in /var/www/MODx-0.9.1/assets/modules/gallery/g2cms.admin.class.inc.php on line 24

                  I upgraded G2 to 2.1.2-typical, modx is 0.9.5. I deleted the old files in assets/.... before installing via your web based installer.

                  As I have G2 in a subdirectory modx/gallery2 I modified the snippet, module and plugin in the manager.

                  But the only "embed-file" from G2 I can find is gallery2/embed.php, nothing in modx as requested in the error message above.

                  I tried a symlink in dir modx/gallery2embed.php -> gallery2/embed.php, which gets rid of the error message, but shows a crippled version of the admin interface. It seems as if there are images missing and such.

                  Any clue?

                  Cheers!
                  Frisco
                    • 21475
                    • 80 Posts
                    Have you edited the configuration of the module? I forgot to did that the first time... smiley
                    In fact, it seems the module seeks a wrong file in a wrong place, it might be a good place to start.

                    nicpan
                      • 21475
                      • 80 Posts
                      Hi all,

                      Finally, i think this should work. With this, your user should be logged into the gallery.
                      Modify the plugin (add the lines in bold) to have :
                      /**
                       *	Gallery Plugin for MODx
                       *	Written by Raymond Irving, Sept 2005
                       *  Modyfied by Hisanori Muramoto, Feb, 2007
                       *	Integrates Gallery2 with MODx
                       *
                       *	Events:
                       *		OnWebChangePassword,OnWebDeleteUser,OnWebSaveUser,OnWebLogout 
                       *
                       *	Version: 1.1
                       *
                       */
                      
                      
                      
                      $e = &$modx->event;
                      
                      # build mod path
                      $modpath = $modx->config["base_path"].($mpth ? $mpth:"assets/modules/gallery/");
                      
                      # include main class
                      include_once $modpath."g2cms.base.class.inc.php";
                      $g2base = new G2CMS_Base();
                      
                      // include Gallery API
                      require_once($g2base->g2Path.'embed.php'); 
                      $ret = GalleryEmbed::init(array(
                      	'embedUri' => $g2base->embedUri,
                      	'g2Uri' => $g2base->g2Uri,
                      	'activeUserId' => $modx->getLoginUserName()
                      ));
                      
                      if ($ret) { 
                      	 $modx->logEvent(0,2,$ret->getAsHtml(),'Gallery');
                      	 exit; 
                      } 
                      		
                      // Event switch
                      switch($e->name) {
                      
                      	case "OnWebLogin": 
                      		$ret = GalleryEmbed::login($modx->getLoginUserName());
                      		if ($ret) { 
                      			 $modx->logEvent(0,2,$ret->getAsHtml(),'Gallery');
                      			 exit; 
                      		} 		
                      		break;
                      
                      	case "OnWebLogout": 
                      		$ret = GalleryEmbed::logout(array(
                      			'embedUri' => $g2base->embedUri,
                      			'embedPath' => $g2base->embedPath
                      		));
                      		if ($ret) { 
                      			 $modx->logEvent(0,2,$ret->getAsHtml(),'Gallery');
                      			 exit; 
                      		} 		
                      		break;
                      
                      	case "OnWebSaveUser":
                      
                      		$uid = $username;
                      		$args = array(
                      			'username'	=> $username,
                      			'fullname' => $userfullname,
                      			'email' => $useremail,
                      			'hashmethod' => 'md5',
                      			'hashedpassword' => md5($userpassword)
                      		);
                      			
                      		if($mode=="new") {		
                      			$ret = GalleryEmbed::createUser($uid,$args);
                      			if (!$ret->isSuccess()) {
                      				$modx->logEvent(0,2,"Unable to create Gallery user account ($username)<br /><br />".$ret->getAsHtml(),"Gallery");
                      			}			
                      		}
                      		else if($mode=="upd"){
                      			$uid=($oldusername ? $oldusername:$username);
                      			if(GalleryEmbed::isExternalIdMapped($uid,'GalleryUser')==null) {
                      				$ret = GalleryEmbed::updateUser($uid,$args);
                      				if (!$ret->isSuccess()) {
                      					$modx->logEvent(0,2,"Unable to update Gallery user account ($username)<br /><br />".$ret->getAsHtml(),"Gallery");
                      				}
                      			}
                      		}
                      		break;
                      
                      	case "OnWebChangePassword":
                      		if(GalleryEmbed::isExternalIdMapped($username,'GalleryUser')==null) {
                      			$ret = GalleryEmbed::updateUser($username,array(
                      				'username'=>$username,
                      				'password'=>$userpassword,
                      			));
                      			if (!$ret->isSuccess()) {
                      				$modx->logEvent(0,2,"Unable to update Gallery user ($username) password<br /><br />".$ret->getAsHtml(),"Gallery");
                      			}
                      		}
                      		break;
                      
                      	case "OnWebDeleteUser":
                      		if(strpos(strtolower($ondel),'delete')!==false) {;
                      			if(GalleryEmbed::isExternalIdMapped($username,'GalleryUser')==null) {
                      				$ret = GalleryEmbed::deleteUser($username);
                      				if (!$ret->isSuccess()) {
                      					$modx->logEvent(0,2,"Unable to update Gallery user ($username) password<br /><br />".$ret->getAsHtml(),"Gallery");
                      				}
                      			}
                      		}
                      		break;
                      
                      	default:
                      		return;
                      		break;
                      }
                      


                      i’ve add ’activeUserId’ => $modx->getLoginUserName() to the gallery init, and the onweblogin event.
                      Finally tick "OnWebLogin" system event. I have to do more tests, be i think it’s close to what i was looking for smiley
                      If anyone can tell me if this is working on his website...

                      thanks

                      nicpan