Exemplo n.º 1
0
        }
        $new_addon_files = array();
        foreach ($addon_row['addon_files'] as $_file) {
            if (substr($_file, -9) != '.editfrom') {
                // This would have been added back in automatically
                $new_addon_files[] = $_file;
            }
        }
        create_addon($file, $new_addon_files, $addon_row['addon_name'], implode(',', $addon_row['addon_incompatibilities']), implode(',', $addon_row['addon_dependencies']), $addon_row['addon_author'], $addon_row['addon_organisation'], $addon_row['addon_version'], $addon_row['addon_description'], 'exports/mods');
    }
    if ($only !== NULL) {
        echo "All bundled addons have been exported to 'export/mods/'\n";
    }
}
if (get_param_integer('export_addons', 1) == 1) {
    $file_list = get_file_list_of_addons();
    $addon_list = get_details_of_addons();
    foreach ($file_list as $addon => $files) {
        if ($only !== NULL && $only !== $addon) {
            continue;
        }
        if ($addon == 'proper_name') {
            continue;
        }
        if (!isset($addon_list[$addon])) {
            $addon_list[$addon] = array('name' => $addon, 'incompatibilities' => '', 'dependencies' => '', 'author' => 'ocProducts', 'version' => '1.0', 'description' => '');
        }
        $val = $addon_list[$addon];
        $file = preg_replace('#^[\\_\\.\\-]#', 'x', preg_replace('#[^\\w\\.\\-]#', '_', $addon)) . $version_for_name . '.tar';
        $name = $addon_list[$addon]['Addon name'];
        $author = $addon_list[$addon]['Author'];
function get_addon_structure()
{
    $struct = array('bundled' => array(), 'non_bundled' => array());
    if (file_exists(get_file_base() . '/sources_custom/dump_addons.php')) {
        require_code('dump_addons');
        $struct['non_bundled'] = get_file_list_of_addons();
        ksort($struct['non_bundled']);
    } else {
        $struct['non_bundled'] = array();
    }
    $hooks = find_all_hooks('systems', 'addon_registry');
    foreach (array_keys($hooks) as $hook) {
        require_code('hooks/systems/addon_registry/' . filter_naughty_harsh($hook));
        $hook_ob = object_factory('Hook_addon_registry_' . $hook, true);
        $file_list = $hook_ob->get_file_list();
        $_file_list = array();
        foreach ($file_list as $file) {
            if (preg_match('#^[^/]*\\.tpl$#', $file) != 0) {
                $_file_list[] = 'themes/default/templates/' . $file;
            } elseif (preg_match('#^[^/]*\\.css$#', $file) != 0) {
                $_file_list[] = 'themes/default/css/' . $file;
            } else {
                $_file_list[] = $file;
            }
        }
        $struct['bundled'][$hook] = $_file_list;
    }
    ksort($struct['bundled']);
    return $struct;
}