Example #1
0
 /**
 * method to install the component
 *
 * @return void
 * <div id="system-message-container">
 <div id="system-message">
 <div class="alert alert-message"><a class="close" data-dismiss="alert">×</a>
 <h4 class="alert-heading">Message</h4>
 <div>
 		<p>Installing component was successful.</p>
 </div>
 </div>
 </div>
 </div>
 */
 function install($parent)
 {
     // $parent is the class calling this method
     echo '<div id="system-message-container">';
     $msgtext = "";
     echo '<div id="system-message">
             <div style=" overflow:hidden; margin:8px 0 8px 0; padding:5px;" >
             <div style=" font-size:12px; margin:0px 0 0px 0; padding:5px; position:relative; float:right;"><div>Powered by Percha.com</div></div>
             <div style="float:left; margin:0 20px 20px 0;"><img src="http://www.fieldsattach.com/images/logo_fieldsattach_small.png" alt="fieldsattach.com" /></div>
             <div style="   margin:30px 0 8px 0; padding:5px; font-size:23px; color:#4892AB;">Thanks for install the Fieldsattach component.</div>
             </div>';
     //INSTALL THE PLUGINS *******************************************************************************
     $installer = new JInstaller();
     //$installer->_overwrite = true;
     $pkg_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_fieldsattach' . DS . 'extensions' . DS;
     $pkgs = array('input.zip' => 'Plugin fieldsattachment <strong>Input</strong>', 'file.zip' => 'Plugin fieldsattachment <strong>File</strong>', 'image.zip' => 'Plugin fieldsattachment <strong>image</strong>', 'imagegallery.zip' => 'Plugin fieldsattachment <strong>imagegallery</strong>', 'select.zip' => 'Plugin fieldsattachment <strong>select</strong>', 'textarea.zip' => 'Plugin fieldsattachment <strong>textarea</strong>', 'content_fieldsattachment.zip' => 'Plugin Content FieldsAttachment', 'system_fieldsattachment.zip' => 'Plugin System FieldsAttachment', 'advancedsearch_fieldsattachment.zip' => 'Plugin Advanced Search FieldsAttachment', 'filterarticles.zip' => 'Plugin Advanced FILTER FieldsAttachment');
     foreach ($pkgs as $pkg => $pkgname) {
         $package = JInstallerHelper::unpack($pkg_path . $pkg);
         if ($installer->install($package['dir'])) {
             $msgtext .= '<div id="system-message-container"><div class="alert alert-message">' . $pkgname . ' successfully installed.</div></div>';
             //ACTIVE IT
         } else {
             $msgtext .= '<div id="system-message-container"><div class="alert alert-message">ERROR: Could not install the $pkgname. Please install manually</div></div>';
         }
         //ACTIVE THE PLUGINS *******************************************************************************
         $db = JFactory::getDBO();
         $sql = "UPDATE #__extensions  SET enabled = 1 WHERE  element = 'fieldsattachment'";
         $db->setQuery($sql);
         $db->query();
         $db = JFactory::getDBO();
         $sql = "UPDATE #__extensions  SET enabled = 1 WHERE  element = 'fieldsattachmentadvanced'";
         $db->setQuery($sql);
         $db->query();
         $db = JFactory::getDBO();
         $sql = "UPDATE #__extensions  SET enabled = 1 WHERE  folder = 'fieldsattachment'";
         $db->setQuery($sql);
         $db->query();
         //DESACTIVE OLD SEARCH
         $db = JFactory::getDBO();
         $sql = "UPDATE #__extensions  SET enabled = 0 WHERE  element = 'fieldsattachment' AND folder='search'";
         $db->setQuery($sql);
         $db->query();
         JInstallerHelper::cleanupInstall($pkg_path . $pkg, $package['dir']);
     }
     //DELETE EXTENSIONS
     $pkg_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_fieldsattach' . DS . 'extensions' . DS;
     destroy_dir($pkg_path);
     $msgtext .= '<div id="system-message-container"><div class="alert alert-message">Clean install directory:  ' . $pkg_path . '</div></div>';
     echo $msgtext;
     echo '</div>';
     //$parent->getParent()->setRedirectURL('index.php?option=com_helloworld');
 }
Example #2
0
 public static function delete($fname)
 {
     list($dirname, $root, $protocol, $fname) = getRealPath($fname);
     if ($protocol === "osjs://") {
         throw new Exception("Not allowed");
     }
     if (is_file($fname)) {
         if (!is_writeable($fname)) {
             throw new Exception("Read permission denied");
         }
     } else {
         if (is_dir($fname)) {
             if (!is_writeable(dirname($fname))) {
                 throw new Exception("Read permission denied");
             }
             return destroy_dir($fname);
         } else {
             throw new exception("No such file or directory!");
         }
     }
     return unlink($fname);
 }
Example #3
0
 /**
  * Delete ALL Caches
  * @return	boolean
  */
 function delete_caches()
 {
     //Destroy all files in the cache dir
     if (destroy_dir(CACHE_DIR, false)) {
         return true;
     }
 }
Example #4
0
File: Epan.php Project: xepan/xepan
 function beforeDelete()
 {
     // throw new Exception($new_dir_name, 1);
     if ($this->ref('Aliases')->count()->getOne() > 0) {
         $this->api->js()->univ()->errorMessage('Delete Non Default Aliases first')->execute();
     }
     $new_dir_name = getcwd() . "/epans/" . $this['name'];
     if (is_dir($new_dir_name)) {
         // throw new Exception("yap it is ", 1);
         if (!destroy_dir($new_dir_name)) {
             throw $this->exception('Couldn\'t delete forlder at ' . $new_dir_name . ', exiting process ...');
         }
     }
     foreach ($a = $this->ref('Aliases') as $junk) {
         $a->memorize('force_delete', true);
         $a->delete();
     }
     // Delete All users
     $this->ref('Users')->deleteAll();
     // Remove Epan Pages
     foreach ($ep = $this->ref('EpanPage') as $junk) {
         foreach ($snp = $ep->ref('EpanPageSnapshots') as $junk2) {
             $snp->delete();
         }
         $ep->delete();
     }
     // Remove Epan Templates
     $this->ref('EpanTemplates')->deleteAll();
     // Remove Messages and alerts
     $this->ref('Messages')->deleteAll();
     $this->ref('Alerts')->deleteAll();
     // Uninstall Epan installed Components
     $saved_current_website = $this->api->current_website;
     $this->api->current_website = $this;
     //  unistall components
     foreach ($comp = $this->ref('InstalledComponents') as $junk) {
         $comp->uninstall();
     }
     $this->api->current_website = $saved_current_website;
 }
Example #5
0
function destroy_dirs($dir_path)
{
    if (is_dir($dir_path)) {
        if (($dp = opendir($dir_path)) == false) {
            echo "open {$dir_path} failed.\n";
            return -1;
        }
        while (($file_name = readdir($dp)) != false) {
            if ($file_name == "." || $file_name == "..") {
                continue;
            }
            $sub_path = $dir_path . "/" . $file_name;
            if (is_dir($sub_path)) {
                destroy_dirs($sub_path);
            } else {
                delete_file($sub_path);
            }
        }
        closedir($dp);
        destroy_dir($dir_path);
        return 0;
    }
    return 0;
}