Exemple #1
0
/**
 * Create Stage
 *
 * Creates a stage for concerto by name or through a stage archive
 */
function createStage($name, $file = null)
{
    // Check if a stage of the same name exists
    global $stages;
    foreach ($stages->stages as $stage) {
        if (strtolower($stage['name']) == strtolower($name)) {
            return 0;
        }
    }
    $name = ucfirst($name);
    if (is_writable(CONCERTO_STAGES)) {
        $dir = CONCERTO_STAGES . $name;
        if (!is_dir($dir) && !is_readable($dir)) {
            @mkdir($dir, 0755);
        }
        if (is_dir($dir) && is_readable($dir)) {
            $file = $file != null ? $file : CONCERTO_LIBS . 'stage' . _DS . 'default.zip';
            if (file_exists($file)) {
                if (class_exists('ZipArchive')) {
                    $zip = new ZipArchive();
                    if ($zip->open($file) === TRUE) {
                        if (is_numeric($zip->locateName('style.css'))) {
                            $zip->extractTo($dir);
                            $zip->close();
                            if ($zip->locateName('options.cfwconf')) {
                                // we read the configuration file from the stage
                                importConcertoOptions($dir . _DS . 'options.cfwconf', strtolower($name));
                                @unlink($dir . _DS . 'options.cfwconf');
                            }
                            return 1;
                        }
                        @rmdir($dir);
                        return 0;
                    }
                }
                return 16;
                // ZipArchive class is not available
            }
            return 8;
            // File does not exist
        }
        return 4;
        // Couldn't make the stage folder
    }
    return 2;
    // Stage folder not writable
}
Exemple #2
0
                // Create a nonce for swfupload
                update_option('concerto_upload_nonce', md5(microtime()));
                update_option('concerto_upload_nonce_made', 1);
            }
        }
        // We Register Options
        $this->registerSettings();
    }
    /**
	 * Menu
	 *
	 * Binds menus to the Concerto Admin Dashboard
	 *
	 * @return void
	 */
    public function menu()
    {
        global $menu;
        $menu[99] = array('', 'read', 'separator-concerto', '', 'wp-menu-separator');
        add_menu_page('General', 'Concérto', 'switch_themes', 'concerto_admin_menu', 'admin_general', null, 100);
        add_submenu_page('concerto_admin_menu', 'Concérto - General', 'General', 'switch_themes', 'concerto_admin_menu', 'admin_general');
        add_submenu_page('concerto_admin_menu', 'Concérto - Design', 'Design', 'switch_themes', 'concerto_admin_design', 'admin_design');
        add_submenu_page('concerto_admin_menu', 'Concérto - Tools', 'Tools', 'switch_themes', 'concerto_admin_tools', 'admin_tools');
        add_submenu_page('concerto_admin_menu', 'Concérto - Support', 'Support', 'switch_themes', 'concerto_admin_support', 'admin_support');
    }
    /**
	 * Register Settings
	 *
	 * Registers settings for option pages in Concerto
	 *
	 * @return void