name : pkg_script.php
<?php
/**
 
 * @package     pkg_dearflip
 * @since       1.0.0
 * @copyright   Copyright © 2007 Free Software Foundation, Inc. All rights reserved.
 * @license   GNU General Public License version 3 or later; see https://www.gnu.org/licenses/gpl-3.0.en.html
 
 */

defined( '_JEXEC' ) or die( 'Restricted access' );


class pkg_dearflipInstallerScript {
  
  function postflight( $type, $parent ) {
// We only need to perform this if the extension is being installed, not updated
    if(strtolower( $type ) === 'install' or strtolower( $type ) === 'update' ){
      
      ?>
      <style >
			.dfintro-info { padding: 20px 30px 10px; margin: 0 0 20px 0; background: #ffffff; color: #000000; border: 0.5px solid #E7E7D7; font-family: Arial, Helvetica, sans-serif; font-size: 13px; font-weight: normal; -webkit-border-radius: 4px; border-radius: 4px; }
			.dfintro-title { text-transform: uppercase; font-weight: bold; font-size: 18px; padding: 10px;
      }
			.dfintro-info a:link, .dfintro-info a:visited, .dfintro-info a:hover {   color:#ffffff; text-decoration:underline; font-weight: 600; }
          .dfintro-info img { float: left; margin: 0 30px 10px 0; }

      .dfintro-info .goto-link{background-color: #007f71; padding:5px; margin:5px 0 5px 0; border-radius: 2px;}

		</style>
		<div class="dfintro-info">
			<a href="index.php?option=com_dearflip"><img alt="dearflip joomla flipbook" src="components/com_dearflip/assets/dearflip1.jpg" /></a>
			<p class="dfintro-title">Thank you for installing Dearflip!</p>
      <p>Now you can create amazing 2D and 3D flipbooks from both Images and PDF files. </p><p><a class="goto-link" href="index.php?option=com_dearflip">Go to Dearflip!</a></p>
      <p>Keep using Dearflip to create & display professional & realistic flipbook in your Joomla site. Make your PDFs interactive and generate more customer attention. </p>
      
      <p>Please read Documentation and FAQ section before you begin!</p> <p> <a class="goto-link" target="_blank" href="http://joomla.dearflip.com">How to get started?</a></p>
			
			<div style="clear:both"></div>
   
		</div>
<?php
    }
    
    if ( strtolower( $type ) === 'install' ) {
      
      
      $db    = JFactory::getDbo();
      $query = $db->getQuery( true );
      
      $fields = array(
          $db->quoteName( 'enabled' ) . ' = 1',
      );
      
      $conditions = array(
          $db->quoteName( 'element' ) . ' = ' . $db->quote( 'dearflip' ),
          $db->quoteName( 'type' ) . ' = ' . $db->quote( 'plugin' )
      );
      
      $query->update( $db->quoteName( '#__extensions' ) )->set( $fields )->where( $conditions );
      
      $db->setQuery( $query );
      $db->execute();
      
      
      
      
      
      
      
      
    }

    
  }
  
    
  public function update($parent)
  {
      try {
//add column hide controls if not exits

          $db    = JFactory::getDBO();
          $query = "SHOW COLUMNS FROM `#__dearflip` LIKE 'dfx_hide_controls' ";
          //$query="SELECT COUNT('id') FROM `#__dearflip`";
          $db->setQuery($query);
          $res = $db->loadResult();
          if ($res == null) {
              $db  = JFactory::getDBO();
              $sql = "ALTER TABLE #__dearflip ADD COLUMN dfx_hide_controls text";
              $db->setQuery($sql);
              $result = $db->execute();
          }


      } catch (exception $e) {
      }

  }
//}
}

© 2025 Cubjrnet7