Exemplo n.º 1
0
 /**
  * method to run after an install/update/uninstall method
  *
  * @return void
  */
 function postflight($type, $parent)
 {
     $source = $parent->getParent()->getPath('source');
     require_once $source . DS . 'admin' . DS . 'updatedb.php';
     $updater = new FSFUpdater();
     global $log;
     $log = $updater->Process($source);
     // think this has to be done last
     InstallExtras($source);
     FSF_Done();
 }
Exemplo n.º 2
0
 function SaveAPI()
 {
     $username = JRequest::getVar('username');
     $apikey = JRequest::getVar('apikey');
     $db =& JFactory::getDBO();
     $qry = "REPLACE INTO #__fsf_settings (setting, value) VALUES ('fsj_username','" . FSFJ3Helper::getEscaped($db, $username) . "')";
     $db->setQuery($qry);
     $db->Query();
     $qry = "REPLACE INTO #__fsf_settings (setting, value) VALUES ('fsj_apikey','" . FSFJ3Helper::getEscaped($db, $apikey) . "')";
     $db->setQuery($qry);
     $db->Query();
     // update url links
     if (FSFAdminHelper::Is16()) {
         $updater = new FSFUpdater();
         $updater->SortAPIKey($username, $apikey);
     }
     $mainframe = JFactory::getApplication();
     $link = FSFRoute::x('index.php?option=com_fsf&view=backup', false);
     $mainframe->redirect($link);
 }
Exemplo n.º 3
0
 function RegisterModules($path)
 {
     if (!FSFUpdater::DBIs16()) {
         return "Not needed for Joomla 1.5";
     }
     $log = "";
     $db = JFactory::getDBO();
     $qry = "SELECT * FROM #__extensions WHERE element = 'mod_fsf_support'";
     $db->setQuery($qry);
     $rows = $db->loadObjectList();
     if (count($rows) == 0) {
         $filename = JPATH_SITE . DS . 'modules' . DS . 'mod_fsf_support' . DS . 'mod_fsf_support.xml';
         if (file_exists($filename)) {
             //echo "<pre>";
             $order = 1;
             $xml = simplexml_load_file($filename);
             $name = $xml->name;
             //echo $name."<br>";
             $qry = "INSERT INTO #__extensions (name, type, element, client_id, enabled, access) VALUES ('" . FSFJ3Helper::getEscaped($db, $name) . "', 'module', 'mod_fsf_support', 0, 1, 0)";
             $db->setQuery($qry);
             $db->Query($qry);
             //exit;
             $log .= "Registering module {$name}\n";
             $installer = new JInstaller();
             // Check for a database error.
             if ($db->getErrorNum()) {
                 $log .= JText::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $db->getErrorNum(), $db->getErrorMsg()) . '<br />';
                 return $log;
             }
             $id = $db->insertid();
             if (!$installer->refreshManifestCache($id)) {
                 $log .= "ERROR updating manifest for {$id} - {$name} updated ok<br>";
             } else {
                 $log .= "Manifest for {$id} - {$name} updated ok<br>";
             }
         } else {
             $log .= "XML file missing\n";
         }
     } else {
         $log .= "Support module already registered\n";
     }
     return $log;
 }