Exemple #1
0
function get_addons_list_under_category($category)
{
    $categories = array();
    $addons = get_details_of_addons();
    $addons_here = array();
    foreach ($addons as $k => $addon) {
        if ($addon['Category'] == $category) {
            $addons_here[] = $k;
        }
    }
    return $addons_here;
}
if (!is_file($FILE_BASE . '/sources/global.php')) {
    exit('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . chr(10) . '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN"><head><title>Critical startup error</title></head><body><h1>ocPortal startup error</h1><p>The second most basic ocPortal startup file, sources/global.php, could not be located. This is almost always due to an incomplete upload of the ocPortal system, so please check all files are uploaded correctly.</p><p>Once all ocPortal files are in place, ocPortal must actually be installed by running the installer. You must be seeing this message either because your system has become corrupt since installation, or because you have uploaded some but not all files from our manual installer package: the quick installer is easier, so you might consider using that instead.</p><p>ocProducts maintains full documentation for all procedures and tools, especially those for installation. These may be found on the <a href="http://ocportal.com">ocPortal website</a>. If you are unable to easily solve this problem, we may be contacted from our website and can help resolve it for you.</p><hr /><p style="font-size: 0.8em">ocPortal is a website engine created by ocProducts.</p></body></html>');
}
require $FILE_BASE . '/sources/global.php';
require_code('addons');
require_code('dump_addons');
require_code('version');
require_code('downloads2');
$version = ocp_version_number();
$version_for_name = preg_replace('/\\./', '', float_to_raw_string($version));
$get_cat = get_param('cat', NULL);
if ($get_cat === NULL) {
    exit("Please pass the category name in the URL (?cat=name).");
}
// $file_list = get_file_list_of_addons();
$addon_list = get_details_of_addons();
$parent_id = $GLOBALS['SITE_DB']->query_value_null_ok('download_categories c JOIN ' . get_table_prefix() . 'translate t ON t.id=c.category', 'c.id AS id', array('parent_id' => 1, 't.text_original' => 'Addons'));
$c_main_id = check_and_add_category($get_cat, $parent_id);
/*$cat_id=add_download_category('Themes',$c_main_id,'','','');
$all_groups=$GLOBALS['FORUM_DRIVER']->get_usergroup_list(true);
foreach (array_keys($all_groups) as $_group_id)
{
	$GLOBALS['SITE_DB']->query_insert('group_category_access',array('module_the_name'=>'downloads','category_name'=>strval($cat_id),'group_id'=>$_group_id));
}*/
header('Content-type: text/plain');
$admin = 2;
if (get_param_integer('import_addons', 1) == 1) {
    $categories = category_list_from_details();
    //if(!is_dir("uploads/downloads/$get_cat"))
    //	mkdir("uploads/downloads/$get_cat");
    foreach ($categories as $category) {