Exemplo n.º 1
0
/**
 * Template uninstall method
 * @param int The id of the module
 * @param string The URL option
 * @param int The client id
 */
function template_uninstall($id, $option, $client = 0)
{
    $id = str_replace(array('\\', '/'), '', $id);
    $mosConfig_absolute_path = mamboCore::get('mosConfig_absolute_path');
    // Find if normal or admin template and delete corresponding files & directories
    if ($client == 'admin') {
        $basepath = mamboCore::get('mosConfig_absolute_path') . '/administrator/templates/' . $id;
    } else {
        $basepath = mamboCore::get('mosConfig_absolute_path') . '/templates/' . $id;
    }
    //Use $basepath to remove the template files and directory
    $tdir = new mosDirectory($basepath);
    $tdir->deleteAll();
    $message = new mosError(T_('Uninstall template - '), _MOS_ERROR_INFORM);
    HTML_installer::showInstallMessage($message, T_('Success'), returnTo($option, 'template', $client));
    exit;
}
Exemplo n.º 2
0
 /**
  * Enter description here...
  *
  */
 function deleteAll()
 {
     if (!file_exists($this->path)) {
         return;
     }
     $subdirs =& $this->listAll('dir', false, true);
     foreach ($subdirs as $subdir) {
         $subdirectory = new mosDirectory($subdir);
         $subdirectory->deleteAll();
         unset($subdirectory);
     }
     $filemanager =& mosFileManager::getInstance();
     $files =& $this->listAll('file', false, true);
     foreach ($files as $file) {
         $filemanager->deleteFile($file);
     }
     $filemanager->deleteDirectory($this->path);
 }
Exemplo n.º 3
0
 function &getIcons()
 {
     $iconList = '';
     $live_site = mamboCore::get('mosConfig_live_site');
     $iconDir = new mosDirectory(mamboCore::get('mosConfig_absolute_path') . '/administrator/components/com_containers/images/folder_icons');
     $files = $iconDir->listAll();
     $ss = 0;
     foreach ($files as $file) {
         $iconList .= "\n<a href=\"JavaScript:paste_strinL('{$file}')\" onmouseover=\"window.status='{$file}'; return true\"><img src=\"{$live_site}/administrator/components/com_containers/images/folder_icons/{$file}\" width=\"32\" height=\"32\" border=\"0\" alt=\"{$file}\" /></a>&nbsp;&nbsp;";
         $ss++;
         if ($ss % 10 == 0) {
             $iconList .= "<br/>\n";
         }
     }
     return $iconList;
 }
Exemplo n.º 4
0
 /**
  * This routine is not called - uninstalling templates is done by just deleting
  * the whole directory.  It might be better to manage the uninstall via the XML.
  * Just deleting the template leaves all the files in the "media" directory.
  * But the following code has never been tested.
  **/
 function uninstall_template()
 {
     $name = str_replace(' ', '_', strtolower($this->getName('template')));
     $client_id = $this->client == 'administrator' ? 1 : 0;
     if ($client_id) {
         $this->user_dir = mosPathName(mamboCore::get('mosConfig_absolute_path') . '/administrator/templates/');
     } else {
         $this->user_dir = mosPathName(mamboCore::get('mosConfig_absolute_path') . '/templates/' . $name);
     }
     $userdir = new mosDirectory($this->user_dir);
     $userdir->deleteAll();
     $mediadir = mamboCore::get('mosConfig_absolute_path') . '/images/stories/';
     $this->deleteFileSet($this->media, $mediadir);
     $fmanager =& mosFileManager::getInstance();
     $fmanager->deleteFile($this->xmlfile);
     $this->errors->addErrorDetails($this->getDescription('template'), _MOS_ERROR_INFORM);
 }
Exemplo n.º 5
0
 function end_element_param()
 {
     $type = mosGetParam($this->paramattrs, 'TYPE', '');
     $name = mosGetParam($this->paramattrs, 'NAME', '');
     $label = T_(mosGetParam($this->paramattrs, 'LABEL', $name));
     $default = T_(mosGetParam($this->paramattrs, 'DEFAULT', ''));
     if ($description = mosGetParam($this->paramattrs, 'DESCRIPTION', '')) {
         $tooltip = mosToolTip(T_($description), $name);
     } else {
         $tooltip = '';
     }
     if (is_object($this->mosParameter)) {
         $mp = $this->mosParameter;
         $value = $mp->get($name, $default);
     } else {
         $value = $default;
     }
     $this->html[] = '<tr>';
     if ($label == '@spacer') {
         $label = '<hr />';
     } elseif ($label) {
         $label .= ':';
     }
     $this->html[] = '<td width="35%" align="right" valign="top">' . $label . '</td>';
     $controlname = $this->name;
     switch ($type) {
         case 'text':
             $size = mosGetParam($this->paramattrs, 'SIZE', 0);
             $controlstring = '<input type="text" name="' . $this->name . '[' . $name . ']" value="' . $value . '" class="text_area" size="' . $size . '" />';
             break;
         case 'list':
             $controlstring = mosHTML::selectList($this->options, $controlname . '[' . $name . ']', 'class="inputbox"', 'value', 'text', $value);
             break;
         case 'radio':
             $controlstring = mosHTML::radioList($this->options, $controlname . '[' . $name . ']', '', $value);
             break;
         case 'imagelist':
             $directory = new mosDirectory(mamboCore::get('mosConfig_absolute_path') . mosGetParam($this->paramattrs, 'DIRECTORY', ''));
             $files = $directory->listFiles('\\.png$|\\.gif$|\\.jpg$|\\.bmp$|\\.ico$');
             $options = array();
             foreach ($files as $file) {
                 $options[] = mosHTML::makeOption($file, $file);
             }
             if (!isset($this->paramattrs['HIDE_NONE'])) {
                 array_unshift($options, mosHTML::makeOption('-1', '- Do not use an image -'));
             }
             if (!isset($this->paramattrs['HIDE_DEFAULT'])) {
                 array_unshift($options, mosHTML::makeOption('', '- Use Default image -'));
             }
             $controlstring = mosHTML::selectList($options, $controlname . '[' . $name . ']', 'class="inputbox"', 'value', 'text', $value);
             break;
         case 'textarea':
             $rows = mosGetParam($this->paramattrs, 'ROWS', 0);
             $cols = mosGetParam($this->paramattrs, 'COLS', 0);
             $value = str_replace('<br />', "\n", $value);
             $controlstring = "<textarea name='params[{$name}]' cols='{$cols}' rows='{$rows}' class='text_area'>{$value}</textarea>";
             break;
         case 'spacer':
             $controlstring = $value ? $value : '<hr />';
             break;
         case 'mos_section':
             $controlstring = $this->_form_mos_section($name, $value, $controlname);
             break;
         case 'mos_category':
             $controlstring = $this->_form_mos_category($name, $value, $controlname);
             break;
         case 'mos_menu':
             $controlstring = $this->_form_mos_menu($name, $value, $controlname);
             break;
         default:
             $controlstring = T_('Handler not defined for type') . '=' . $type;
     }
     //		$this->html[] = "<td>$type</td>";
     $this->html[] = "<td>{$controlstring}</td>";
     $this->html[] = "<td width='10%' align='left' valign='top'>{$tooltip}</td>";
     $this->html[] = '</tr>';
     $this->options = array();
     $this->paramattrs = array();
     $this->paramcount++;
 }