error->add( __('Cache directory is not writable.') ); } if (!is_writable($repo)) { $core->error->add( __('Path to repository is not writable.') ); } if (empty($file_a)) { $core->error->add( __('You must specify the name of package to export.') ); } if (!is_writable(dirname($repo.'/'.$file_a))) { $core->error->add( __('Path to first export package is not writable.') ); } if (!empty($file_b) && !is_writable(dirname($repo.'/'.$file_b))) { $core->error->add( __('Path to second export package is not writable.') ); } return !$core->error->flag(); } public static function is_writable($path, $file) { return !( empty($path) || empty($file) || !is_writable(dirname($path.'/'.$file)) ); } public static function modules($core, $modules, $type, $title) { $type = $type == 'themes' ? 'themes' : 'plugins'; echo '
'. '

'.$title.'

'; if (empty($modules) && !is_array($modules)) { echo '

'.__('There are no modules.').'

'. '
'; return null; } echo '
'. ''. ''. ''. ''. ''. ''; foreach (self::sort($modules) as $id => $module) { echo ''. ''. ''. ''. ''. ''; } echo '
'.__('Id').''.__('Version').''.__('Name').''.__('Root').'
'. html::escapeHTML($module['version']). ''. __(html::escapeHTML($module['name'])). ''. dirname(path::real($module['root'], false)). '
'. '

'. '

'. (!empty($_REQUEST['redir']) ? form::hidden( array('redir'), html::escapeHTML($_REQUEST['redir']) ) : '' ). form::hidden(array('p'), 'pacKman'). form::hidden(array('type'), $type). form::hidden(array('action'), 'packup'). ''. $core->formNonce().'

'. '
'. '
'; } public static function repository($core, $modules, $type, $title) { if (!in_array($type,array('plugins','themes','repository'))) { return null; } echo '
'. '

'.$title.'

'; if (empty($modules) || !is_array($modules)) { echo '

'.__('There are no packages').'

'. '
'; return null; } $combo_action = array(__('delete') => 'delete'); if ($type == 'plugins' || $type == 'themes') { $combo_action[__('install')] = 'install'; } if ($type != 'plugins') { $combo_action[sprintf(__('copy to %s directory'), __('plugins'))] = 'copy_to_plugins'; $combo_action[sprintf(__('move to %s directory'), __('plugins'))] = 'move_to_plugins'; } if ($type != 'themes') { $combo_action[sprintf(__('copy to %s directory'), __('themes'))] = 'copy_to_themes'; $combo_action[sprintf(__('move to %s directory'), __('themes'))] = 'move_to_themes'; } if ($type != 'repository') { $combo_action[sprintf(__('copy to %s directory'), __('repository'))] = 'copy_to_repository'; $combo_action[sprintf(__('move to %s directory'), __('repository'))] = 'move_to_repository'; } echo '
'. ''. ''. ''. ''. ''. ''; $dup = array(); foreach(self::sort($modules) AS $module) { if (isset($dup[$module['root']])) { continue; } $dup[$module['root']] = 1; echo ''. ''. ''. ''. ''. ''; } echo '
'.__('Id').''.__('Version').''.__('Name').''.__('File').'
'. html::escapeHTML($module['version']). ''. __(html::escapeHTML($module['name'])). ''. ''. html::escapeHTML(basename($module['root'])).''. '
'. '
'. '

'. '

'.__('Selected modules action:').' '. form::combo(array('action'), $combo_action). ''. form::hidden(array('p'), 'pacKman'). form::hidden(array('tab'), 'repository'). form::hidden(array('type'), $type). $core->formNonce(). '

'. '
'. '
'. '
'; } protected static function sort($modules) { $sorter = array(); foreach($modules as $id => $module) { $sorter[$id] = $id; } array_multisort($sorter, SORT_ASC, $modules); return $modules; } }