Support Forums | Demo Gallery [1.x] [2.x] | Downloads | News | Site Map ]
Nuked Gallery
  Create a FREE account or Login   As a guest, you don't have access to our FULL navigation system.
 Forum FAQForum FAQ   StatisticsStatistics   SearchSearch   UsergroupsUsergroups   FavoritesFavorites  

Sorry...been busy
Goto page Previous  1, 2
 
Post new topic   Reply to topic    NukedGallery.net Forum Index » phpBB Integration » phpBB3 / Gallery 2 Integration View previous topicPrinter friendly versionView next topic
Author Message
timnsal

Novice
Novice


Joined: Aug 08, 2007
Posts: 20

PostPosted: Fri Oct 19, 2007 11:45 am    Post subject: Re: Sorry...been busy Reply with quote

I've been trying to ignore those Embarassed and I'm giving up on the groups thing for now. It seems to be when it tries to call IsExternalIdMapped and it wasn't, so it returns null and then nothing else happens.
Back to top
Offline View user's profile Send private message
AdBot
   Post subject: Re: Sorry...been busy  

Back to top
jettyrat

Moderator
Moderator


Joined: Nov 28, 2005
Posts: 1144

PostPosted: Fri Oct 19, 2007 11:38 pm    Post subject: Re: Sorry...been busy Reply with quote

I got the group create and group delete functions working now...one change to the mod instructions and a few changes to g2helper.inc...

There hasn't been much interest in this integration until now, so as you can tell, everything hasn't been tested very well Embarassed

Making good progress now though!
Back to top
Offline View user's profile Send private message
jettyrat

Moderator
Moderator


Joined: Nov 28, 2005
Posts: 1144

PostPosted: Fri Oct 19, 2007 11:48 pm    Post subject: Re: Sorry...been busy Reply with quote

This change to the mod instructions to includes/functions_user.php (was after, add)
Code: › #
#-----[ FIND ]------------------------------------------
#
   // Delete group
   $sql = 'DELETE FROM ' . GROUPS_TABLE . "
      WHERE group_id = $group_id";
   $db->sql_query($sql);

#
#-----[ BEFORE, ADD ]------------------------------------------
#
   // Delete group in Gallery
   require($phpbb_root_path . 'g2helper.inc');
   $g2h = new g2helper($db);
   $g2h->deleteGroup($group_id);


Replace these functions in g2helper.inc
Code: ›    function createGroup($groupName) {
      global $user;

      $this->_initAdmin();

      $ret = GalleryEmbed::isExternalIdMapped($groupName, 'GalleryGroup');
      if (isset($ret) && $ret->getErrorCode() & ERROR_MISSING_OBJECT) {
         $ret = GalleryEmbed::createGroup($groupName, $groupName);
         if (isset($ret)) {
            msg_handler(E_G2_ERROR, sprintf($user->lang['G2_CREATEGROUP_FAILED'], $groupName) . $user->lang['G2_ERROR'] . $ret->getAsHtml(), __FILE__, __LINE__);
         }
      }
      elseif (empty($ret)) {
         /*
         * Group already exists in gallery, so do nothing!
         */
      }
      else {
         msg_handler(E_G2_ERROR, sprintf($user->lang['G2_ISEXTERNALIDMAPPED_FAILED'], $groupName), __FILE__, __LINE__);
      }

      $this->done();
   }

   function updateGroup($group_id, $newGroupName) {
      global $db, $user;

      $this->_initAdmin();

      $sql = 'SELECT group_name FROM ' . GROUPS_TABLE . " WHERE group_id = $group_id";
      if (!$row = $db->sql_fetchrow($db->sql_query_limit($sql, 1))) {
         msg_handler(E_G2_ERROR, $user->lang['FETCH_GROUPDATA_FAILED'], __FILE__, __LINE__);
      }

      $ret = GalleryEmbed::isExternalIdMapped($row['group_name'], 'GalleryGroup');
      if (empty($ret)) {
         $ret = GalleryEmbed::updateGroup($row['group_name'], array('groupname' => $newGroupName));
         if (isset($ret)) {
            msg_handler(E_G2_ERROR, sprintf($user->lang['G2_UPDATEGROUP_FAILED'], $newGroupName) . $user->lang['G2_ERROR'] . $ret->getAsHtml(), __FILE__, __LINE__);
         }

         $ret = GalleryCoreApi::updateMapEntry('ExternalIdMap', array('externalId' => $row['group_name']) , array('externalId' => $newGroupName));
         if (isset($ret)) {
            msg_handler(E_G2_ERROR, sprintf($user->lang['G2_UPDATEMAPENTRY_FAILED'], $row['group_name']) . $user->lang['G2_ERROR'] . $ret->getAsHtml(), __FILE__, __LINE__);
         }
      }
      elseif (isset($ret) && $ret->getErrorCode() & ERROR_MISSING_OBJECT) {
         /*
         * Group does not exist in gallery, so do nothing!
         */
      }
      else {
         msg_handler(E_G2_ERROR, sprintf($user->lang['G2_ISEXTERNALIDMAPPED_FAILED'], $row['group_name']), __FILE__, __LINE__);
      }

      $this->done();
   }

   function deleteGroup($groupId) {
      global $db, $user;

      $this->_initAdmin();

      $sql = 'SELECT group_name FROM ' . GROUPS_TABLE . "   WHERE group_id = $groupId";
      if (!$row = $db->sql_fetchrow($db->sql_query_limit($sql, 1))) {
         msg_handler(E_G2_ERROR, $user->lang['FETCH_GROUPDATA_FAILED'], __FILE__, __LINE__);
      }

      $ret = GalleryEmbed::isExternalIdMapped($row['group_name'], 'GalleryGroup');
      if (empty($ret)) {
         $ret = GalleryEmbed::deleteGroup($row['group_name']);
         if (isset($ret)) {
            msg_handler(E_G2_ERROR, sprintf($user->lang['G2_DELETEGROUP_FAILED'], $row['group_name']) . $user->lang['G2_ERROR'] . $ret->getAsHtml(), __FILE__, __LINE__);
         }
      }
      elseif (isset($ret) && $ret->getErrorCode() & ERROR_MISSING_OBJECT) {
         /*
         * Group does not exist in gallery, so do nothing!
         */
      }
      else {
         msg_handler(E_G2_ERROR, sprintf($user->lang['G2_ISEXTERNALIDMAPPED_FAILED'], $row['group_name']), __FILE__, __LINE__);
      }

      $this->done();
   }

   function addUserToGroup($members, $groupId) {
      global $db, $user;

      $this->_initAdmin();

      $sql = 'SELECT group_name FROM ' . GROUPS_TABLE . " WHERE group_id = $groupId";
      if (!$row = $db->sql_fetchrow($db->sql_query_limit($sql, 1))) {
         msg_handler(E_G2_ERROR, $user->lang['FETCH_GROUPDATA_FAILED'], __FILE__, __LINE__);
      }

      $ret = GalleryEmbed::isExternalIdMapped($row['group_name'], 'GalleryGroup');
      if (empty($ret)) {
         $id[] = explode(', ', $members);

         for ($i = 0; $i < count($id); $i++) {
            $ret = GalleryEmbed::isExternalIdMapped($id[$i][0], 'GalleryUser');
            if (empty($ret)) {
               $ret = GalleryEmbed::addUserToGroup($id[$i][0], $row['group_name']);
               if (isset($ret)) {
                  msg_handler(E_G2_ERROR, sprintf($user->lang['G2_ADDUSERTOGROUP_FAILED'], $row['group_name'], $id[$i][0]) . $user->lang['G2_ERROR'] . $ret->getAsHtml(), __FILE__, __LINE__);
               }
            }
            elseif (isset($ret) && $ret->getErrorCode() & ERROR_MISSING_OBJECT) {
               /*
               * User does not exist in gallery, so do nothing!
               */
            }
            else {
               msg_handler(E_G2_ERROR, sprintf($user->lang['G2_ISEXTERNALIDMAPPED_FAILED'], $id[$i][0]), __FILE__, __LINE__);
            }
         }
      }
      elseif (isset($ret) && $ret->getErrorCode() & ERROR_MISSING_OBJECT) {
         /*
         * Group does not exist in gallery, so do nothing!
         */
      }
      else {
         msg_handler(E_G2_ERROR, sprintf($user->lang['G2_ISEXTERNALIDMAPPED_FAILED'], $row['group_name']), __FILE__, __LINE__);
      }

      $this->done();
   }

   function removeUserFromGroup($members, $groupId) {
      global $db, $user;

      $this->_initAdmin();

      $sql = 'SELECT group_name FROM ' . GROUPS_TABLE . " WHERE group_id = $groupId";
      if (!$row = $db->sql_fetchrow($db->sql_query_limit($sql, 1))) {
         msg_handler(E_G2_ERROR, $user->lang['FETCH_GROUPDATA_FAILED'], __FILE__, __LINE__);
      }

      $ret = GalleryEmbed::isExternalIdMapped($row['group_name'], 'GalleryGroup');
      if (empty($ret)) {
         $id[] = explode(', ', $members);

         for ($i = 0; $i < count($id); $i++) {
            $ret = GalleryEmbed::isExternalIdMapped($id[$i][0], 'GalleryUser');
            if (empty($ret)) {
               $ret = GalleryEmbed::removeUserFromGroup($id[$i][0], $row['group_name']);
               if (isset($ret)) {
                  msg_handler(E_G2_ERROR, sprintf($user->lang['G2_REMOVEUSERFROMGROUP_FAILED'], $groupId, $id[$i][0]) . $user->lang['G2_ERROR'] . $ret->getAsHtml(), __FILE__, __LINE__);
               }
            }
            elseif (isset($ret) && $ret->getErrorCode() & ERROR_MISSING_OBJECT) {
               /*
               * User does not exist in gallery, so do nothing!
               */
            }
            else {
               msg_handler(E_G2_ERROR, sprintf($user->lang['G2_ISEXTERNALIDMAPPED_FAILED'], $id[$i][0]), __FILE__, __LINE__);
            }
         }
      }
      elseif (isset($ret) && $ret->getErrorCode() & ERROR_MISSING_OBJECT) {
         /*
         * Group does not exist in gallery, so do nothing!
         */
      }
      else {
         msg_handler(E_G2_ERROR, sprintf($user->lang['G2_ISEXTERNALIDMAPPED_FAILED'], $row['group_name']), __FILE__, __LINE__);
      }

      $this->done();
   }
Back to top
Offline View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NukedGallery.net Forum Index » phpBB Integration » phpBB3 / Gallery 2 Integration View previous topicPrinter friendly versionView next topic
Goto page Previous  1, 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours

Powered by phpBB © phpBB Group



Sponsors: Dedicated ServersDomain NamesWeb HostingDomain Name RegistrationDedicated Web HostingWeb Design New YorkCompare VoIPseo packagesSEO CompanyNew York Yellow PagesFind LocationsVOIP Phone ServiceNeckermannBluetooth HeadsetOnline internetSEOchina factoryDressesRestaurant Locatorandroid tablet

8th year online! 2003-2011
Legal • Use of this site consitutes agreement to the Acceptable Use Policy
Hosted by Implosion WorksSourceForge.net Logo • Theme by TonicMedia