Exemple #1
0
/**
 * Makes this plugin the first to be loaded.
 * - Bumps this plugin at the top of the active_plugins stack.
 */
function mdh_emailmagick_bump_me()
{
    if (OC_ADMIN) {
        // @legacy : ALWAYS remove this if active.
        if (osc_plugin_is_enabled("madhouse_utils/index.php")) {
            Plugins::deactivate("madhouse_utils/index.php");
        }
        // Sanitize & get the {PLUGIN_NAME}/index.php.
        $path = str_replace(osc_plugins_path(), '', osc_plugin_path(__FILE__));
        if (osc_plugin_is_installed($path)) {
            // Get the active plugins.
            $plugins_list = unserialize(osc_active_plugins());
            if (!is_array($plugins_list)) {
                return false;
            }
            // Remove $path from the active plugins list
            foreach ($plugins_list as $k => $v) {
                if ($v == $path) {
                    unset($plugins_list[$k]);
                }
            }
            // Re-add the $path at the beginning of the active plugins.
            array_unshift($plugins_list, $path);
            // Serialize the new active_plugins list.
            osc_set_preference('active_plugins', serialize($plugins_list));
            if (Params::getParam("page") === "plugins" && Params::getParam("action") === "enable" && Params::getParam("plugin") === $path) {
                //osc_redirect_to(osc_admin_base_url(true) . "?page=plugins");
            } else {
                osc_redirect_to(osc_admin_base_url(true) . "?" . http_build_query(Params::getParamsAsArray("get")));
            }
        }
    }
}
function nm_copypaste_plugin_actions()
{
    $dao_preference = new Preference();
    $option = Params::getParam('nomoreoption');
    if (Params::getParam('file') != 'nm_copypaste_plugin/admin/settings.php') {
        return '';
    }
    if ($option == 'nomoresettings') {
        osc_set_preference('nm_id', Params::getParam("nm_id") ? Params::getParam("nm_id") : '0', 'nm_copypaste_plugin', 'STRING');
        osc_add_flash_ok_message(__('Nomore copy/paste settings has been updated', 'nm_copypaste_plugin'), 'admin');
        osc_redirect_to(osc_admin_render_plugin_url('nm_copypaste_plugin/admin/settings.php'));
    }
}
Exemple #3
0
function google_analytics_actions()
{
    $dao_preference = new Preference();
    $option = Params::getParam('option');
    if (Params::getParam('file') != 'google_analytics/admin.php') {
        return '';
    }
    if ($option == 'stepone') {
        $webid = Params::getParam('webid');
        Preference::newInstance()->update(array("s_value" => $webid), array("s_section" => "plugin-google_analytics", "s_name" => "google_analytics_id"));
        osc_add_flash_ok_message(__('The tracking ID has been updated', 'google_analytics'), 'admin');
        osc_redirect_to(osc_admin_render_plugin_url('google_analytics/admin.php'));
    }
}
Exemple #4
0
function seo_init_admin()
{
    //scripts
    osc_enqueue_style('seoCSS', osc_plugin_url(SEO_PLUGIN_FOLDER . '/css/style.css') . 'style.css');
    //admin menu pages
    osc_add_admin_menu_page(__('SEO Wiz', SEO_PLUGIN_FOLDER), osc_admin_render_plugin_url(osc_plugin_folder(__FILE__) . 'configure.php'), 'seo_dashboard');
    osc_add_admin_submenu_page('seo_dashboard', __('Configure Plugin', SEO_PLUGIN_FOLDER), osc_admin_render_plugin_url(osc_plugin_folder(__FILE__) . 'configure.php'), 'configure');
    osc_add_admin_submenu_page('seo_dashboard', __('Titles & Metas', SEO_PLUGIN_FOLDER), osc_admin_render_plugin_url(osc_plugin_folder(__FILE__) . 'titles_metas.php'), 'titles_metas');
    //form actions
    switch (Params::getParam('seo_action')) {
        //configure page
        case 'seo_configure':
            $page_title_separator = Params::getParam('page_title_separator', false, false, false);
            osc_set_preference('page_title_separator', $page_title_separator, 'seo_plugin');
            osc_add_flash_ok_message(__('Saved correctly', SEO_PLUGIN_FOLDER), 'admin');
            osc_redirect_to(osc_admin_render_plugin_url(osc_plugin_folder(__FILE__) . 'configure.php'));
            break;
            //titles_metas_home
        //titles_metas_home
        case 'titles_metas_home':
            $seo_titles = Params::getParam('seo_titles');
            if (!empty($seo_titles)) {
                foreach ($seo_titles as $key => $value) {
                    osc_set_preference($key, trim($value), 'seo_plugin');
                }
            }
            osc_add_flash_ok_message(__('Saved correctly', SEO_PLUGIN_FOLDER), 'admin');
            osc_redirect_to(osc_admin_render_plugin_url(osc_plugin_folder(__FILE__) . 'titles_metas.php#home'));
            break;
            //titles_metas_pages
        //titles_metas_pages
        case 'titles_metas_pages':
            $seo_titles = Params::getParam('seo_titles');
            if (!empty($seo_titles)) {
                foreach ($seo_titles as $key => $value) {
                    osc_set_preference($key, trim($value), 'seo_plugin');
                }
            }
            osc_add_flash_ok_message(__('Saved correctly', SEO_PLUGIN_FOLDER), 'admin');
            osc_redirect_to(osc_admin_render_plugin_url(osc_plugin_folder(__FILE__) . 'titles_metas.php#pages'));
            break;
    }
}
Exemple #5
0
function theme_modern_actions_admin()
{
    if (Params::getParam('file') == 'oc-content/themes/modern/admin/settings.php') {
        if (Params::getParam('donation') == 'successful') {
            osc_set_preference('donation', '1', 'modern_theme');
            osc_reset_preferences();
        }
    }
    switch (Params::getParam('action_specific')) {
        case 'settings':
            $footerLink = Params::getParam('footer_link');
            $defaultLogo = Params::getParam('default_logo');
            osc_set_preference('keyword_placeholder', Params::getParam('keyword_placeholder'), 'modern_theme');
            osc_set_preference('footer_link', $footerLink ? '1' : '0', 'modern_theme');
            osc_set_preference('default_logo', $defaultLogo ? '1' : '0', 'modern_theme');
            osc_add_flash_ok_message(__('Theme settings updated correctly', 'modern'), 'admin');
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/modern/admin/settings.php'));
            break;
        case 'upload_logo':
            $package = Params::getFiles('logo');
            if ($package['error'] == UPLOAD_ERR_OK) {
                if (move_uploaded_file($package['tmp_name'], WebThemes::newInstance()->getCurrentThemePath() . "images/logo.jpg")) {
                    osc_add_flash_ok_message(__('The logo image has been uploaded correctly', 'modern'), 'admin');
                } else {
                    osc_add_flash_error_message(__("An error has occurred, please try again", 'modern'), 'admin');
                }
            } else {
                osc_add_flash_error_message(__("An error has occurred, please try again", 'modern'), 'admin');
            }
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/modern/admin/header.php'));
            break;
        case 'remove':
            if (file_exists(WebThemes::newInstance()->getCurrentThemePath() . "images/logo.jpg")) {
                @unlink(WebThemes::newInstance()->getCurrentThemePath() . "images/logo.jpg");
                osc_add_flash_ok_message(__('The logo image has been removed', 'modern'), 'admin');
            } else {
                osc_add_flash_error_message(__("Image not found", 'modern'), 'admin');
            }
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/modern/admin/header.php'));
            break;
    }
}
function fb_page_plugin_actions()
{
    $dao_preference = new Preference();
    $option = Params::getParam('fbpageoption');
    if (Params::getParam('file') != 'fb_page_plugin/admin.php') {
        return '';
    }
    if ($option == 'fbpagesettings') {
        osc_set_preference('fb_page_url', Params::getParam("fb_page_url") ? Params::getParam("fb_page_url") : '0', 'fb_page_plugin', 'STRING');
        osc_set_preference('fb_page_width', Params::getParam("fb_page_width") ? Params::getParam("fb_page_width") : '0', 'fb_page_plugin', 'STRING');
        osc_set_preference('fb_page_height', Params::getParam("fb_page_height") ? Params::getParam("fb_page_height") : '0', 'fb_page_plugin', 'STRING');
        osc_set_preference('fb_show_faces', Params::getParam("fb_show_faces") ? Params::getParam("fb_show_faces") : '0', 'fb_page_plugin', 'STRING');
        osc_set_preference('show_page_posts', Params::getParam("show_page_posts") ? Params::getParam("show_page_posts") : '0', 'fb_page_plugin', 'STRING');
        osc_set_preference('hide_page_cover', Params::getParam("hide_page_cover") ? Params::getParam("hide_page_cover") : '0', 'fb_page_plugin', 'STRING');
        osc_set_preference('use_small_header', Params::getParam("use_small_header") ? Params::getParam("use_small_header") : '0', 'fb_page_plugin', 'STRING');
        osc_set_preference('adapt_container_width', Params::getParam("adapt_container_width") ? Params::getParam("adapt_container_width") : '0', 'fb_page_plugin', 'STRING');
        osc_add_flash_ok_message(__('Facebook page plugin has been updated', 'fb_page_plugin'), 'admin');
        osc_redirect_to(osc_admin_render_plugin_url('fb_page_plugin/admin.php'));
    }
}
Exemple #7
0
function theme_osclasswizards_actions_admin()
{
    if (Params::getParam('file') == 'oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php') {
        if (Params::getParam('donation') == 'successful') {
            osc_set_preference('donation', '1', 'osclasswizards_theme');
            osc_reset_preferences();
        }
    }
    switch (Params::getParam('action_specific')) {
        case 'settings':
            osc_set_preference('welcome_message', Params::getParam('welcome_message'), 'osclasswizards_theme');
            osc_set_preference('defaultShowAs@all', Params::getParam('defaultShowAs@all'), 'osclasswizards_theme');
            osc_set_preference('defaultShowAs@search', Params::getParam('defaultShowAs@all'));
            osc_add_flash_ok_message(__('Theme settings updated correctly', OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php'));
            break;
        case 'templates_home':
            osc_set_preference('show_banner', Params::getParam('show_banner') ? '1' : '0', 'osclasswizards_theme');
            osc_set_preference('keyword_placeholder', Params::getParam('keyword_placeholder'), 'osclasswizards_theme');
            osc_set_preference('show_search_country', Params::getParam('show_search_country') ? '1' : '0', 'osclasswizards_theme');
            osc_set_preference('premium_listings_shown_home', Params::getParam('premium_listings_shown_home'), 'osclasswizards_theme');
            osc_set_preference('sub_cat_limit', Params::getParam('sub_cat_limit'), 'osclasswizards_theme');
            osc_set_preference('show_popular', Params::getParam('show_popular'), 'osclasswizards_theme');
            osc_set_preference('show_popular_regions', Params::getParam('show_popular_regions'), 'osclasswizards_theme');
            osc_set_preference('show_popular_cities', Params::getParam('show_popular_cities'), 'osclasswizards_theme');
            osc_set_preference('show_popular_searches', Params::getParam('show_popular_searches'), 'osclasswizards_theme');
            osc_set_preference('popular_regions_limit', Params::getParam('popular_regions_limit'), 'osclasswizards_theme');
            osc_set_preference('popular_cities_limit', Params::getParam('popular_cities_limit'), 'osclasswizards_theme');
            osc_set_preference('popular_searches_limit', Params::getParam('popular_searches_limit'), 'osclasswizards_theme');
            osc_add_flash_ok_message(__('Templates settings updated correctly', OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php#templates'));
            break;
        case 'templates_search':
            osc_set_preference('premium_listings_shown', Params::getParam('premium_listings_shown'), 'osclasswizards_theme');
            osc_add_flash_ok_message(__('Templates settings updated correctly', OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php#templates'));
            break;
        case 'templates_item_post':
            $locations_input_as = Params::getParam('locations_input_as', 'osclasswizards_theme');
            $locations_required = Params::getParam('locations_required', 'osclasswizards_theme');
            $category_multiple_selects = Params::getParam('category_multiple_selects', 'osclasswizards_theme');
            osc_set_preference('title_minimum_length', Params::getParam('title_minimum_length', 'osclasswizards_theme'), 'osclasswizards_theme');
            osc_set_preference('description_minimum_length', Params::getParam('description_minimum_length', 'osclasswizards_theme'), 'osclasswizards_theme');
            osc_set_preference('locations_input_as', $locations_input_as, 'osclasswizards_theme');
            osc_set_preference('locations_required', $locations_required ? '1' : '0', 'osclasswizards_theme');
            osc_set_preference('category_multiple_selects', $category_multiple_selects ? '1' : '0', 'osclasswizards_theme');
            osc_add_flash_ok_message(__('Templates settings updated correctly', OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php#templates'));
            break;
        case 'ads_mgmt':
            osc_set_preference('header-728x90', trim(Params::getParam('header-728x90', false, false, false)), 'osclasswizards_theme');
            osc_set_preference('homepage-728x90', trim(Params::getParam('homepage-728x90', false, false, false)), 'osclasswizards_theme');
            osc_set_preference('sidebar-300x250', trim(Params::getParam('sidebar-300x250', false, false, false)), 'osclasswizards_theme');
            osc_set_preference('search-results-top-728x90', trim(Params::getParam('search-results-top-728x90', false, false, false)), 'osclasswizards_theme');
            osc_set_preference('search-results-middle-728x90', trim(Params::getParam('search-results-middle-728x90', false, false, false)), 'osclasswizards_theme');
            osc_add_flash_ok_message(__('Ads management updated correctly', OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php#ads'));
            break;
        case 'categories_icons':
            $catsIcons = Params::getParam('cat-icons');
            foreach ($catsIcons as $catId => $iconName) {
                osc_set_preference('cat-icons-' . $catId, $iconName, 'osclasswizards_theme_cat_icons');
            }
            osc_add_flash_ok_message(__('Category icons settings updated correctly', OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php#category-icons'));
            break;
        case 'theme_style':
            $color_mode = Params::getParam('theme_color_mode');
            osc_set_preference('theme_color_mode', $color_mode, 'osclasswizards_theme');
            osc_set_preference('google_fonts', Params::getParam('google_fonts'), 'osclasswizards_theme');
            $rtl_view = Params::getParam('rtl_view', 'osclasswizards_theme');
            osc_set_preference('rtl_view', $rtl_view ? '1' : '0', 'osclasswizards_theme');
            osc_set_preference('custom_css', trim(Params::getParam('custom_css', false, false, false)), 'osclasswizards_theme');
            osc_add_flash_ok_message(__('Theme color settings updated correctly', OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php#theme-style'));
            break;
        case 'facebook':
            osc_set_preference('facebook-url', trim(Params::getParam('facebook-url', false, false, false)), 'osclasswizards_theme');
            osc_set_preference('facebook-width', trim(Params::getParam('facebook-width', false, false, false)), 'osclasswizards_theme');
            osc_set_preference('facebook-height', trim(Params::getParam('facebook-height', false, false, false)), 'osclasswizards_theme');
            osc_set_preference('facebook-hidecover', trim(Params::getParam('facebook-hidecover', false, false, false)), 'osclasswizards_theme');
            osc_set_preference('facebook-showface', trim(Params::getParam('facebook-showface', false, false, false)), 'osclasswizards_theme');
            osc_set_preference('facebook-showpost', trim(Params::getParam('facebook-showpost', false, false, false)), 'osclasswizards_theme');
            osc_set_preference('facebook-showitem', trim(Params::getParam('facebook-showitem', false, false, false)), 'osclasswizards_theme');
            osc_set_preference('facebook-showsearch', trim(Params::getParam('facebook-showsearch', false, false, false)), 'osclasswizards_theme');
            osc_add_flash_ok_message(__('Facebook Page settings updated correctly', OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php#facebook'));
            break;
        case 'upload_favicon':
            $package = Params::getFiles('favicon');
            if ($package['error'] == UPLOAD_ERR_OK) {
                $img = ImageResizer::fromFile($package['tmp_name']);
                $ext = $img->getExt();
                $logo_name = 'favicon';
                $logo_name .= '.' . $ext;
                $path = osc_uploads_path() . $logo_name;
                $img->saveToFile($path);
                osc_set_preference('favicon', $logo_name, 'osclasswizards_theme');
                osc_add_flash_ok_message(__('The favicon image has been uploaded correctly', OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            } else {
                osc_add_flash_error_message(__("An error has occurred, please try again", OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            }
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php#favicon'));
            break;
        case 'upload_logo':
            $package = Params::getFiles('logo');
            if ($package['error'] == UPLOAD_ERR_OK) {
                $img = ImageResizer::fromFile($package['tmp_name']);
                $ext = $img->getExt();
                $logo_name = 'logo';
                $logo_name .= '.' . $ext;
                $path = osc_uploads_path() . $logo_name;
                $img->saveToFile($path);
                osc_set_preference('logo', $logo_name, 'osclasswizards_theme');
                osc_add_flash_ok_message(__('The logo image has been uploaded correctly', OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            } else {
                osc_add_flash_error_message(__("An error has occurred, please try again", OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            }
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php#logo'));
            break;
        case 'remove_favicon':
            $logo = osc_get_preference('favicon', 'osclasswizards_theme');
            $path = osc_uploads_path() . $logo;
            if (file_exists($path)) {
                @unlink($path);
                osc_delete_preference('favicon', 'osclasswizards_theme');
                osc_reset_preferences();
                osc_add_flash_ok_message(__('The favicon image has been removed', OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            } else {
                osc_add_flash_error_message(__("Image not found", OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            }
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php#favicon'));
            break;
        case 'remove':
            $logo = osc_get_preference('logo', 'osclasswizards_theme');
            $path = osc_uploads_path() . $logo;
            if (file_exists($path)) {
                @unlink($path);
                osc_delete_preference('logo', 'osclasswizards_theme');
                osc_reset_preferences();
                osc_add_flash_ok_message(__('The logo image has been removed', OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            } else {
                osc_add_flash_error_message(__("Image not found", OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            }
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php#logo'));
            break;
        case 'upload_homeimage':
            $package = Params::getFiles('homeimage');
            if ($package['error'] == UPLOAD_ERR_OK) {
                $img = ImageResizer::fromFile($package['tmp_name']);
                $ext = $img->getExt();
                $logo_name = 'homeimage';
                $logo_name .= '.' . $ext;
                $path = osc_uploads_path() . $logo_name;
                $img->saveToFile($path);
                osc_set_preference('homeimage', $logo_name, 'osclasswizards_theme');
                osc_add_flash_ok_message(__('The banner image has been uploaded correctly', OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            } else {
                osc_add_flash_error_message(__("An error has occurred, please try again", OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            }
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php#banner'));
            break;
        case 'remove_homeimage':
            $logo = osc_get_preference('homeimage', 'osclasswizards_theme');
            $path = osc_uploads_path() . $logo;
            if (file_exists($path)) {
                @unlink($path);
                osc_delete_preference('homeimage', 'osclasswizards_theme');
                osc_reset_preferences();
                osc_add_flash_ok_message(__('The banner image has been removed', OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            } else {
                osc_add_flash_error_message(__("Image not found", OSCLASSWIZARDS_THEME_FOLDER), 'admin');
            }
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php#banner'));
            break;
    }
}
        // PAID
        ModelPaymentPro::newInstance()->enableItem($id);
        ModelPaymentPro::newInstance()->payPublishFee($id, 'ADMIN');
        osc_add_flash_ok_message(__('Listing paid', 'payment_pro'), 'admin');
        break;
    case 2:
        // BLOCK
        if (ModelPaymentPro::newInstance()->publishFeeIsPaid($id)) {
            $mItems = new ItemActions(false);
            $mItems->disable($id);
        } else {
            ModelPaymentPro::newInstance()->disableItem($id);
        }
        osc_add_flash_ok_message(__('Listing disabled', 'payment_pro'), 'admin');
        break;
    case 3:
        // UNBLOCK
        if (ModelPaymentPro::newInstance()->publishFeeIsPaid($id)) {
            //$mItems = new ItemActions(false);
            //$mItems->enable($id);
        } else {
            ModelPaymentPro::newInstance()->enableItem($id);
        }
        osc_add_flash_ok_message(__('Listing enabled', 'payment_pro'), 'admin');
        break;
    default:
        break;
}
ob_get_clean();
osc_redirect_to(osc_admin_base_url(true) . '?page=items');
Exemple #9
0
<?php

/**
 * delete selected files
 * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
 * @link www.phpletter.com
 * @since 22/April/2007
 *
 */
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php";
if (!osc_is_admin_user_logged_in()) {
    exit('Direct access is not allowed.');
}
if (!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) {
    $path = $_GET['path'];
    //check if the file size
    $fileSize = @filesize($path);
    if ($fileSize > getMemoryLimit()) {
        //larger then the php memory limit, redirect to the file
        osc_redirect_to($path);
    } else {
        //open it up and send out with php
        downloadFile($path);
    }
} else {
    die(ERR_DOWNLOAD_FILE_NOT_FOUND);
}
Exemple #10
0
function breadcrumbs_help()
{
    if (osc_version() < 320) {
        osc_admin_render_plugin(osc_plugin_path(dirname(__FILE__)) . '/help.php');
    } else {
        osc_redirect_to(osc_route_admin_url('breadcrumbs-admin-help'));
    }
}
Exemple #11
0
//include different config base file according to query string "config"
$configBaseFileName = 'config.base.php';
if (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['config']) && file_exists(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config.' . secureFileName($_GET['config']) . ".php") {
    $configBaseFileName = 'config.' . secureFileName($_GET['config']) . ".php";
}
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . $configBaseFileName;
require_once DIR_AJAX_LANGS . CONFIG_LANG_DEFAULT . ".php";
require_once DIR_AJAX_INC . "function.base.php";
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.session.php";
$session = new MySession();
$auth = new Auth();
if (CONFIG_ACCESS_CONTROL_MODE == 1) {
    //access control enabled
    if (!$auth->isLoggedIn() && strtolower(basename($_SERVER['PHP_SELF']) != strtolower(basename(CONFIG_LOGIN_PAGE)))) {
        //
        osc_redirect_to(appendQueryString(CONFIG_LOGIN_PAGE, makeQueryString()));
    }
}
addNoCacheHeaders();
//URL Declartions
define('CONFIG_URL_IMAGE_PREVIEW', 'ajax_image_preview.php');
define('CONFIG_URL_CREATE_FOLDER', 'ajax_create_folder.php');
define('CONFIG_URL_DELETE', 'ajax_delete_file.php');
define('CONFIG_URL_HOME', 'ajaxfilemanager.php');
define("CONFIG_URL_UPLOAD", 'ajax_file_upload.php');
define('CONFIG_URL_PREVIEW', 'ajax_preview.php');
define('CONFIG_URL_SAVE_NAME', 'ajax_save_name.php');
define('CONFIG_URL_IMAGE_EDITOR', 'ajax_image_editor.php');
define('CONFIG_URL_IMAGE_SAVE', 'ajax_image_save.php');
define('CONFIG_URL_IMAGE_RESET', 'ajax_editor_reset.php');
define('CONFIG_URL_IMAGE_UNDO', 'ajax_image_undo.php');
function theme_pop_actions_admin()
{
    //if(OC_ADMIN)
    if (Params::getParam('file') == 'oc-content/themes/pop/admin/settings.php') {
        if (Params::getParam('donation') == 'successful') {
            osc_set_preference('donation', '1', 'pop_theme');
            osc_reset_preferences();
        }
    }
    switch (Params::getParam('subaction')) {
        case 'color-update':
            /* theme color staff here */
            $aParams = Params::getParamsAsArray();
            unset($aParams['page']);
            unset($aParams['action']);
            unset($aParams['file']);
            unset($aParams['CSRFName']);
            unset($aParams['CSRFToken']);
            osc_set_preference('pop-theme-colors', json_encode($aParams), 'pop_theme');
            osc_add_flash_ok_message(__('Theme settings updated correctly', 'pop'), 'admin');
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/pop/admin/color_settings.php'));
            break;
        case 'color-restore':
            $aParams = pop_getColorScheme(true);
            osc_set_preference('pop-theme-colors', json_encode($aParams), 'pop_theme');
            osc_add_flash_ok_message(__('Theme settings updated correctly', 'pop'), 'admin');
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/pop/admin/color_settings.php'));
            break;
        default:
            break;
    }
    switch (Params::getParam('action_specific')) {
        case 'settings':
            $footerLink = Params::getParam('footer_link');
            osc_set_preference('pop_max_premium', Params::getParam('pop_max_premium'), 'pop_theme');
            osc_set_preference('keyword_placeholder', Params::getParam('keyword_placeholder'), 'pop_theme');
            osc_set_preference('footer_link', $footerLink ? '1' : '0', 'pop_theme');
            osc_set_preference('header-728x90', trim(Params::getParam('header-728x90', false, false, false)), 'pop_theme');
            osc_set_preference('search-results-300x250', trim(Params::getParam('search-results-300x250', false, false, false)), 'pop_theme');
            osc_set_preference('item-detail-300x250', trim(Params::getParam('item-detail-300x250', false, false, false)), 'pop_theme');
            osc_add_flash_ok_message(__('Theme settings updated correctly', 'pop'), 'admin');
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/pop/admin/settings.php'));
            break;
        case 'upload_logo':
            $package = Params::getFiles('logo');
            if ($package['error'] == UPLOAD_ERR_OK) {
                $img = ImageResizer::fromFile($package['tmp_name']);
                $ext = $img->getExt();
                $logo_name = 'pop_logo';
                $logo_name .= '.' . $ext;
                $path = osc_uploads_path() . $logo_name;
                move_uploaded_file($package['tmp_name'], $path);
                osc_set_preference('logo', $logo_name, 'pop_theme');
                osc_add_flash_ok_message(__('The logo image has been uploaded correctly', 'pop'), 'admin');
            } else {
                osc_add_flash_error_message(__("An error has occurred, please try again", 'pop'), 'admin');
            }
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/pop/admin/header.php'));
            break;
        case 'remove':
            $logo = osc_get_preference('logo', 'pop_theme');
            $path = osc_uploads_path() . $logo;
            if (file_exists($path)) {
                @unlink($path);
                osc_delete_preference('logo', 'pop_theme');
                osc_reset_preferences();
                osc_add_flash_ok_message(__('The logo image has been removed', 'pop'), 'admin');
            } else {
                osc_add_flash_error_message(__("Image not found", 'pop'), 'admin');
            }
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/pop/admin/header.php'));
            break;
    }
}
Exemple #13
0
function userlogin()
{
    osc_redirect_to(osc_user_dashboard_url());
}
Exemple #14
0
    /**
     * Check is CSRF token is valid, die in other case
     *
     * @since 3.1
     */

    function osc_csrf_check() {
        $error      = false;
        $str_error  = '';
        if(Params::getParam('CSRFName')=='' || Params::getParam('CSRFToken')=='') {
            $str_error = _m('Probable invalid request.') ;
            $error = true;
        } else {
            $name   = Params::getParam('CSRFName');
            $token  = Params::getParam('CSRFToken');
            if (!osc_csrfguard_validate_token($name, $token)) {
                $str_error = _m('Invalid CSRF token.');
                $error = true;
            }
        }

        if( defined('IS_AJAX') ) {
            if($error && IS_AJAX === true ) {
                echo json_encode(array(
                    'error' => 1,
                    'msg'   => $str_error
                ));
                exit;
            }
        }

        // ¿ check if is ajax request ?
        if($error) {
            if(OC_ADMIN) {
                osc_add_flash_error_message($str_error, 'admin');
            } else {
                osc_add_flash_error_message($str_error);
            }

            $url = osc_get_http_referer();
            // be sure that drop session referer
            Session::newInstance()->_dropReferer();
            if($url!='') {
                osc_redirect_to($url);
            }

            if(OC_ADMIN) {
                osc_redirect_to( osc_admin_base_url(true) );
            } else {
                osc_redirect_to( osc_base_url(true) );
            }
        }
    }
 *             GNU Affero General Public License for more details.
 *
 *      You should have received a copy of the GNU Affero General Public
 * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
$mp = ModelPayment::newInstance();
if (Params::getParam('plugin_action') == 'done') {
    $pub_prices = Params::getParam("pub_prices");
    $pr_prices = Params::getParam("pr_prices");
    foreach ($pr_prices as $k => $v) {
        $mp->insertPrice($k, $pub_prices[$k] == '' ? NULL : $pub_prices[$k], $v == '' ? NULL : $v);
    }
    // HACK : This will make possible use of the flash messages ;)
    ob_get_clean();
    osc_add_flash_ok_message(__('Congratulations, the plugin is now configured', 'payment'), 'admin');
    osc_redirect_to(osc_route_admin_url('payment-admin-prices'));
}
$categories = Category::newInstance()->toTreeAll();
$prices = ModelPayment::newInstance()->getCategoriesPrices();
$cat_prices = array();
foreach ($prices as $p) {
    $cat_prices[$p['fk_i_category_id']]['f_publish_cost'] = $p['f_publish_cost'];
    $cat_prices[$p['fk_i_category_id']]['f_premium_cost'] = $p['f_premium_cost'];
}
function drawCategories($categories, $depth = 0, $cat_prices)
{
    foreach ($categories as $c) {
        ?>
            <tr>
                <td>
                    <?php 
Exemple #16
0
<?php

if (Params::getParam('plugin_action') == 'done') {
    osc_set_preference('analytics_msg', trim(Params::getParam("analytics_msg", false, false)), 'cookie', 'STRING');
    osc_set_preference('non_analytics_msg', trim(Params::getParam("non_analytics_msg", false, false)), 'cookie', 'STRING');
    osc_set_preference('analytics_id', trim(Params::getParam("analytics_id")), 'cookie', 'STRING');
    osc_set_preference('policy_link', trim(Params::getParam("policy_link")), 'cookie', 'STRING');
    osc_set_preference('what_are_link', trim(Params::getParam("what_are_link")), 'cookie', 'STRING');
    osc_set_preference('domain', Params::getParam("domain"), 'cookie', 'STRING');
    osc_set_preference('accept', Params::getParam("accept") == 1 ? 1 : 0, 'cookie', 'BOOLEAN');
    osc_set_preference('decline', Params::getParam("decline") == 1 ? 1 : 0, 'cookie', 'BOOLEAN');
    osc_set_preference('reset', Params::getParam("reset") == 1 ? 1 : 0, 'cookie', 'BOOLEAN');
    // HACK : This will make possible use of the flash messages ;)
    ob_get_clean();
    osc_add_flash_ok_message(__('Congratulations, the plugin is now configured', 'cookie'), 'admin');
    osc_redirect_to(osc_route_admin_url('cookie-conf'));
}
?>
<script type="text/javascript" >
    $(document).ready(function () {
        $.cookie("cc_cookie_accept", null, { path: '/' });
        $.cookie("cc_cookie_decline", null, { path: '/' });

        var options = new Object();

        function get_options() {
            options.cookieAcceptButton = $("#accept").prop("checked");
            options.cookieDeclineButton = $("#decline").prop("checked");
            options.cookieResetButton = $("#reset").prop("checked");
            options.cookiePolicyLink = $("#policy_link").prop("value");
            options.cookieWhatAreTheyLink = $("#what_are_link").prop("value");
Exemple #17
0
<?php

/**
 * access control login form
 * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
 * @link www.phpletter.com
 * @since 22/April/2007
 *
 */
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php";
if (!osc_is_admin_user_logged_in()) {
    exit('Direct access is not allowed.');
}
if (isset($_POST['username'])) {
    if ($auth->login()) {
        osc_redirect_to(appendQueryString(CONFIG_URL_HOME, makeQueryString()));
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" href="theme/<?php 
echo CONFIG_THEME_NAME;
?>
/css/login.css" rel="stylesheet" />
<title><?php 
echo LOGIN_PAGE_TITLE;
?>
</title>
Exemple #18
0
function theme_bender_actions_admin()
{
    //if(OC_ADMIN)
    if (Params::getParam('file') == 'oc-content/themes/bender/admin/settings.php') {
        if (Params::getParam('donation') == 'successful') {
            osc_set_preference('donation', '1', 'bender');
            osc_reset_preferences();
        }
    }
    switch (Params::getParam('action_specific')) {
        case 'settings':
            $footerLink = Params::getParam('footer_link');
            osc_set_preference('keyword_placeholder', Params::getParam('keyword_placeholder'), 'bender');
            osc_set_preference('footer_link', $footerLink ? '1' : '0', 'bender');
            osc_set_preference('defaultShowAs@all', Params::getParam('defaultShowAs@all'), 'bender');
            osc_set_preference('defaultShowAs@search', Params::getParam('defaultShowAs@all'));
            osc_set_preference('defaultLocationShowAs', Params::getParam('defaultLocationShowAs'), 'bender');
            osc_set_preference('header-728x90', trim(Params::getParam('header-728x90', false, false, false)), 'bender');
            osc_set_preference('homepage-728x90', trim(Params::getParam('homepage-728x90', false, false, false)), 'bender');
            osc_set_preference('sidebar-300x250', trim(Params::getParam('sidebar-300x250', false, false, false)), 'bender');
            osc_set_preference('search-results-top-728x90', trim(Params::getParam('search-results-top-728x90', false, false, false)), 'bender');
            osc_set_preference('search-results-middle-728x90', trim(Params::getParam('search-results-middle-728x90', false, false, false)), 'bender');
            osc_add_flash_ok_message(__('Theme settings updated correctly', 'bender'), 'admin');
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/bender/admin/settings.php'));
            break;
        case 'upload_logo':
            $package = Params::getFiles('logo');
            if ($package['error'] == UPLOAD_ERR_OK) {
                $img = ImageResizer::fromFile($package['tmp_name']);
                $ext = $img->getExt();
                $logo_name = 'bender_logo';
                $logo_name .= '.' . $ext;
                $path = osc_uploads_path() . $logo_name;
                $img->saveToFile($path);
                osc_set_preference('logo', $logo_name, 'bender');
                osc_add_flash_ok_message(__('The logo image has been uploaded correctly', 'bender'), 'admin');
            } else {
                osc_add_flash_error_message(__("An error has occurred, please try again", 'bender'), 'admin');
            }
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/bender/admin/header.php'));
            break;
        case 'remove':
            $logo = osc_get_preference('logo', 'bender');
            $path = osc_uploads_path() . $logo;
            if (file_exists($path)) {
                @unlink($path);
                osc_delete_preference('logo', 'bender');
                osc_reset_preferences();
                osc_add_flash_ok_message(__('The logo image has been removed', 'bender'), 'admin');
            } else {
                osc_add_flash_error_message(__("Image not found", 'bender'), 'admin');
            }
            osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/bender/admin/header.php'));
            break;
    }
}
Exemple #19
0
<?php

$data = payment_get_custom(Params::getParam('extra'));
$product_type = explode('x', Params::getParam('item_number'));
osc_add_flash_info_message(__('We are processing your payment, if we did not finish in a few minutes, please contact us', 'payment'));
if ($product_type[0] == 301) {
    if (osc_is_web_user_logged_in()) {
        osc_redirect_to(osc_route_url('payment-user-pack'));
    } else {
        // THIS SHOULD NOT HAPPEN
        osc_redirect_to(osc_base_path());
    }
} else {
    if (osc_is_web_user_logged_in()) {
        osc_redirect_to(osc_route_url('payment-user-menu'));
    } else {
        View::newInstance()->_exportVariableToView('item', Item::newInstance()->findByPrimaryKey($product_type[2]));
        osc_redirect_to(osc_item_url());
    }
}
Exemple #20
0
<?php

$item = Item::newInstance()->findByPrimaryKey(Params::getParam('itemId'));
if ($item['b_premium'] == 1) {
    osc_add_flash_error_message(_m('Seems like this item is premium already'));
    osc_redirect_to(osc_user_dashboard_url());
}
?>
<div class="container">
  <div style="float:left; width: 50%;">
      <label style="font-weight: bold;"><?php 
_e("Item's title", 'classified');
?>
:</label> <?php 
echo $item['s_title'];
?>
<br/>
      <label style="font-weight: bold;"><?php 
_e("Premium enhancement price", 'classified');
?>
:</label> <?php 
echo osc_get_preference('premium_cost', 'classified');
?>
<br/>
  </div>
  
        <input type="hidden" name="itemId" value="<?php 
echo Params::getParam('itemId');
?>
"/>
        <div>
Exemple #21
0
 function doModel()
 {
     parent::doModel();
     if (time() - (int) osc_market_data_update() > 86400) {
         //84600 = 24*60*60
         $json = osc_file_get_contents(osc_market_url() . 'categories/', array('api_key' => osc_market_api_connect()));
         $data = @json_decode($json, true);
         if (is_array($data)) {
             osc_set_preference('marketCategories', $json);
             osc_set_preference('marketDataUpdate', time());
             osc_reset_preferences();
         }
     }
     switch ($this->action) {
         case 'buy':
             osc_csrf_check();
             $json = osc_file_get_contents(osc_market_url() . 'token/', array('api_key' => osc_market_api_connect()));
             $data = json_decode($json, true);
             osc_redirect_to(Params::getParam('url') . '?token=' . @$data['token']);
             break;
         case 'purchases':
         case 'plugins':
         case 'themes':
         case 'languages':
             $section = $this->action;
             $title = array('plugins' => __('Recommended plugins for You'), 'themes' => __('Recommended themes for You'), 'languages' => __('Languages for this version'), 'purchases' => __('My purchases'));
             // page number
             $marketPage = Params::getParam("mPage");
             $url_actual = osc_admin_base_url(true) . '?page=market&action=' . $section . '&mPage=' . $marketPage;
             if ($marketPage >= 1) {
                 $marketPage--;
             }
             // api
             $url = osc_market_url($section) . (Params::getParam('sCategory') != '' ? 'category/' . Params::getParam('sCategory') . '/' : '') . "page/" . $marketPage . '/length/9/';
             // default sort
             $sort_actual = '';
             $sort_download = $url_actual . '&sort=downloads&order=desc';
             $sort_updated = $url_actual . '&sort=updated&order=desc';
             // sorting options (default)
             $_order = 'desc';
             $order_download = $_order;
             $order_updated = $_order;
             $sort = Params::getParam("sort");
             $order = Params::getParam("order");
             if ($sort == '') {
                 $sort = 'updated';
             }
             if ($order == '') {
                 $order = $_order;
             }
             $aux = $order == 'desc' ? 'asc' : 'desc';
             switch ($sort) {
                 case 'downloads':
                     $sort_actual = '&sort=downloads&order=';
                     $sort_download = $url_actual . $sort_actual . $aux;
                     $sort_actual .= $order;
                     $order_download = $order;
                     // market api call
                     $url .= 'order/downloads/' . $order;
                     break;
                 case 'updated':
                     $sort_actual = '&sort=updated&order=';
                     $sort_updated = $url_actual . $sort_actual . $aux;
                     $sort_actual .= $order;
                     $order_updated = $order;
                     // market api call
                     $url .= 'order/updated/' . $order;
                     break;
                 default:
                     break;
             }
             // pageSize or length attribute is hardcoded
             $out = osc_file_get_contents($url, array('api_key' => osc_market_api_connect()));
             $array = json_decode($out, true);
             $output_pagination = '';
             if (is_numeric($array['total']) && $array['total'] > 0) {
                 $totalPages = ceil($array['total'] / $array['sizePage']);
                 $pageActual = $array['page'];
                 $params = array('total' => $totalPages, 'selected' => $pageActual, 'url' => osc_admin_base_url(true) . '?page=market' . '&amp;action=' . $section . '&amp;mPage={PAGE}' . $sort_actual, 'sides' => 5);
                 // set pagination
                 $pagination = new Pagination($params);
                 $output_pagination = $pagination->doPagination();
             } else {
                 $array['total'] = 0;
             }
             // export variable to view
             $this->_exportVariableToView("sort", $sort);
             $this->_exportVariableToView("title", $title);
             $this->_exportVariableToView("section", $section);
             $this->_exportVariableToView("array", $array);
             $this->_exportVariableToView("sort_download", $sort_download);
             $this->_exportVariableToView("sort_updated", $sort_updated);
             $this->_exportVariableToView("order_download", $order_download);
             $this->_exportVariableToView("order_updated", $order_updated);
             $this->_exportVariableToView("market_categories", json_decode(osc_market_categories(), true));
             $this->_exportVariableToView('pagination', $output_pagination);
             $this->doView("market/section.php");
             break;
         default:
             $aPlugins = array();
             $aThemes = array();
             $aLanguages = array();
             $out_plugin = osc_file_get_contents(osc_market_featured_url('plugins', 6));
             $array_plugins = json_decode($out_plugin, true);
             if (isset($array_plugins)) {
                 $aPlugins = $array_plugins['plugins'];
             }
             $out_themes = osc_file_get_contents(osc_market_featured_url('themes', 6));
             $array_themes = json_decode($out_themes, true);
             if (isset($array_themes)) {
                 $aThemes = $array_themes['themes'];
             }
             $out_languages = osc_file_get_contents(osc_market_featured_url('languages', 6));
             $array_languages = json_decode($out_languages, true);
             if (isset($array_languages)) {
                 $aLanguages = $array_languages['languages'];
             }
             $count = json_decode(osc_file_get_contents(osc_market_count_url()), true);
             if (!isset($count['pluginsTotal'])) {
                 $count['pluginsTotal'] = 0;
             }
             if (!isset($count['themesTotal'])) {
                 $count['themesTotal'] = 0;
             }
             if (!isset($count['languagesTotal'])) {
                 $count['languagesTotal'] = 0;
             }
             $this->_exportVariableToView("count", $count);
             $this->_exportVariableToView("aPlugins", $aPlugins);
             $this->_exportVariableToView("aThemes", $aThemes);
             $this->_exportVariableToView("aLanguages", $aLanguages);
             $this->_exportVariableToView("market_categories", json_decode(osc_market_categories(), true));
             $this->doView("market/index.php");
             break;
     }
 }
Exemple #22
0
/**
 * Show custom plugin administrationfile
 *
 * @param string $file
 * @return void
 */
function osc_admin_render_plugin($file = '')
{
    osc_redirect_to(osc_admin_render_plugin_url($file));
}
Exemple #23
0
 function redirectTo($url)
 {
     osc_redirect_to($url);
 }
Exemple #24
0
function item_success_redirect($item)
{
    if (!OC_ADMIN) {
        if (isset($item['pk_i_id'])) {
            Session::newInstance()->_dropKeepForm();
            if ($item['b_active'] == 0) {
                osc_add_flash_ok_message(_m('Check your inbox to validate your listing'));
            } else {
                // only if enabled and active can show item-success page
                if ($item['b_active'] == 1 && $item['b_enabled'] == 1) {
                    // item-success redirect
                    Session::newInstance()->_set('inserted_item', $item);
                    osc_redirect_to(osc_route_url('item-success'));
                    exit;
                }
            }
            $itemId = Params::getParam('itemId');
            $category = Category::newInstance()->findByPrimaryKey(Params::getParam('catId'));
            View::newInstance()->_exportVariableToView('category', $category);
            osc_redirect_to(osc_search_category_url());
        }
    }
}
closedir($dir);
if (Params::getParam('plugin_action') == 'done') {
    osc_set_preference('default_premium_cost', Params::getParam("default_premium_cost") ? Params::getParam("default_premium_cost") : '1.0', 'payment_pro', 'STRING');
    osc_set_preference('allow_premium', Params::getParam("allow_premium") ? Params::getParam("allow_premium") : '0', 'payment_pro', 'BOOLEAN');
    osc_set_preference('default_publish_cost', Params::getParam("default_premium_cost") ? Params::getParam("default_publish_cost") : '1.0', 'payment_pro', 'STRING');
    osc_set_preference('pay_per_post', Params::getParam("pay_per_post") ? Params::getParam("pay_per_post") : '0', 'payment_pro', 'BOOLEAN');
    osc_set_preference('premium_days', Params::getParam("premium_days") ? Params::getParam("premium_days") : '7', 'payment_pro', 'INTEGER');
    osc_set_preference('currency', Params::getParam("currency") ? Params::getParam("currency") : 'USD', 'payment_pro', 'STRING');
    osc_set_preference('pack_price_1', Params::getParam("pack_price_1"), 'payment_pro', 'STRING');
    osc_set_preference('pack_price_2', Params::getParam("pack_price_2"), 'payment_pro', 'STRING');
    osc_set_preference('pack_price_3', Params::getParam("pack_price_3"), 'payment_pro', 'STRING');
    osc_run_hook('payment_pro_conf_save');
    // HACK : This will make possible use of the flash messages ;)
    ob_get_clean();
    osc_add_flash_ok_message(__('Congratulations, the plugin is now configured', 'payment_pro'), 'admin');
    osc_redirect_to(osc_route_admin_url('payment-pro-admin-conf'));
}
?>


<?php 
if (PAYMENT_PRO_CRYPT_KEY == 'randompasswordchangethis') {
    echo '<div style="text-align:center; font-size:22px; background-color:#dd0000;"><p>' . sprintf(__('Please, change the crypt key (PAYMENT_PRO_CRYPT_KEY) in %s. <a id="howto" href="javascript:void(0);" onclick="$(\'#dialog-howto\').dialog(\'open\');">How to do it.</a>', 'payment_pro'), PAYMENT_PRO_PATH . 'config.php') . '</p></div>';
}
?>
<div id="general-setting">
    <div id="general-settings">
        <h2 class="render-title"><?php 
_e('Payments settings', 'payment_pro');
?>
</h2>
Exemple #26
0
function payment_configure_link()
{
    osc_redirect_to(osc_route_admin_url('payment-admin-conf'));
}
function make_userlogin()
{
    if (isset($_GET['page'])) {
        return;
    }
    $facebookData = FacebookClassified::newInstance()->selectFacebookData();
    $api_id = osc_get_preference('facebook_api_id', 'classified');
    $api_secret = osc_get_preference('facebook_api_secret', 'classified');
    if (isset($_GET['code']) and !empty($_GET['code'])) {
        $code = $_GET['code'];
        if (!empty($code)) {
            $get_access_data = facebookall_get_fb_contents("https://graph.facebook.com/v2.3/oauth/access_token?" . 'client_id=' . $api_id . '&redirect_uri=' . urlencode(osc_base_url()) . '&client_secret=' . $api_secret . '&code=' . urlencode($code));
            $access_data = json_decode($get_access_data, true);
        }
        if (empty($access_data['access_token'])) {
            $get_access_data = facebookall_get_fb_contents("https://graph.facebook.com/v2.3/oauth/access_token?" . 'client_id=' . $api_id . '&redirect_uri=' . urlencode(osc_base_url()) . '&client_secret=' . $api_secret . '&code=' . urlencode($code));
            $access_data = json_decode($get_access_data, true);
        }
        if (!empty($access_data['access_token'])) {
            $access_token = $access_data['access_token'];
        } else {
            echo 'Error : Could not get access token please check your app settings for more about this error<br> Or Follow our doc setion <a href="http://sourceaddons.com/documentation">Documentation Section</a>.';
            exit;
        }
        ?>
    <script>
      window.opener.FbAll.parentRedirect({'action' : 'fball', 'fball_access_token' : '<?php 
        echo $access_token;
        ?>
'});
      window.close();
    </script>
    <?php 
    }
    if (!empty($_REQUEST['fball_access_token']) and isset($_REQUEST['fball_redirect'])) {
        $user_info = json_decode(facebookall_get_fb_contents("https://graph.facebook.com/v2.3/me?access_token=" . $_REQUEST['fball_access_token']));
        Session::newInstance()->_set('fb-token', $_REQUEST['fball_access_token']);
        $user_data = get_userprofile_data($user_info);
        if (!empty($user_data['email']) and !empty($user_data['id'])) {
            // Filter username form data.
            if (!empty($user_data['name'])) {
                $username = $user_data['name'];
            } else {
                if (!empty($user_data['first_name']) && !empty($user_data['last_name'])) {
                    $username = $user_data['first_name'] . $user_data['last_name'];
                } else {
                    $user_emailname = explode('@', $user_data['email']);
                    $username = $user_emailname[0];
                }
            }
            $user_login = $username;
            $new_user = false;
            $user_id = get_userid($user_data['id']);
            if (empty($user_id)) {
                //Not Registered As Facebook User
                $u_data = User::newInstance()->findByEmail($user_data['email']);
                if (!empty($u_data)) {
                    //Registered As OSClass but not as Facebook User
                    $user = User::newInstance()->findByEmail($user_data['email']);
                    insert_facebook_user_data($user['pk_i_id'], $user_data['id']);
                } else {
                    //New User Not Registered as Facebook User And OSClass User
                    $new_user = true;
                    register_user($user_data);
                }
            }
            $manager = User::newInstance();
            $oscUser = $manager->findByEmail($user_data['email']);
            $email = $oscUser['pk_i_id'];
            require_once osc_lib_path() . 'osclass/UserActions.php';
            $uActions = new UserActions(false);
            $logged = $uActions->bootstrap_login($oscUser['pk_i_id']);
            // Redirect user.
            osc_redirect_to(osc_user_dashboard_url());
            /*
              if (!empty ($_GET['redirect_to'])) {
                $redirect_to = $_GET['redirect_to'];
                wp_safe_redirect ($redirect_to);
              }
              else {
                $redirect_to = facebookall_redirect_loggedin_user();
                wp_redirect ($redirect_to);
              }
              exit();
            }
            */
        }
    }
}
                //Redirect to thank you page
            } else {
                osc_add_flash_ok_message(_m('Changes have been applied'));
                osc_redirect_to(osc_route_url('payment-publish', array('itemId' => $iItemId)));
            }
        } elseif (isset($result_array->name)) {
            osc_add_flash_ok_message(_m($result_array->name));
            osc_redirect_to(osc_route_url('payment-publish', array('itemId' => $iItemId)));
        }
    }
}
if (isset($_POST['paypal-payment'])) {
    $item_title = Params::getParam('item_title');
    $premium_cost = Params::getParam('premium_cost');
    $paypal_api_server = osc_get_preference('paypal_server_classic', 'classified');
    $paypal_server = osc_get_preference('paypal_server', 'classified');
    $username = osc_get_preference('paypal_username', 'classified');
    $password = osc_get_preference('paypal_password', 'classified');
    $signature = osc_get_preference('paypal_signature', 'classified');
    $currency = osc_get_preference('default_currency', 'classified');
    $id = Params::getParam('itemId');
    $post_data = array('USER' => $username, 'PWD' => $password, 'SIGNATURE' => $signature, 'VERSION' => '93', 'PAYMENTREQUEST_0_PAYMENTACTION' => 'SALE', 'PAYMENTREQUEST_0_AMT' => $premium_cost, 'PAYMENTREQUEST_0_ITEMAMT' => $premium_cost, 'PAYMENTREQUEST_0_CURRENCYCODE' => $currency, 'PAYMENTREQUEST_0_DESC' => 'Premium payment for ' . $item_title, 'METHOD' => 'SetExpressCheckout', 'RETURNURL' => osc_route_url('payment-return', array('itemId' => $id)), 'CANCELURL' => osc_route_url('payment-cancel', array('itemId' => $id)), 'L_PAYMENTREQUEST_0_AMT0' => $premium_cost, 'L_PAYMENTREQUEST_0_QTY0' => 1, 'L_PAYMENTREQUEST_0_NAME0' => 'Premium payment for ' . $item_title);
    $response = execute_paypal_nvp_post($post_data, $paypal_api_server);
    if ($response['ACK'] == 'Success') {
        $token = $response['TOKEN'];
        header('Location:' . $paypal_server . 'cgi-bin/webscr?cmd=_express-checkout&token=' . $token);
    } elseif ($response['ACK'] == 'Failure') {
        osc_add_flash_error_message(_m($response['L_LONGMESSAGE0']));
        osc_redirect_to(osc_route_url('payment-publish', array('itemId' => $id)));
    }
}
Exemple #29
0
<?php

if (!defined('ABS_PATH')) {
    exit('ABS_PATH is not loaded. Direct access is not allowed.');
}
if (Params::getParam('plugin_action') == 'done') {
    butler_cron();
    // HACK : This will make possible use of the flash messages ;)
    ob_get_clean();
    osc_add_flash_ok_message(__('Butler has cleaned your listings and users', 'butler'), 'admin');
    osc_redirect_to(osc_route_admin_url('butler-admin-stats'));
}
?>

<div id="general-setting">
    <div id="general-settings">
        <h2 class="render-title"><?php 
_e('Butler settings', 'butler');
?>
</h2>
        <ul id="error_list"></ul>
        <form name="payment_pro_form" action="<?php 
echo osc_admin_base_url(true);
?>
" method="post">
            <input type="hidden" name="page" value="plugins" />
            <input type="hidden" name="action" value="renderplugin" />
            <input type="hidden" name="route" value="butler-admin-stats" />
            <input type="hidden" name="plugin_action" value="done" />
            <fieldset>
                <div class="form-horizontal">
$invoicesDataTable->table($params);
$aData = $invoicesDataTable->getData();
View::newInstance()->_exportVariableToView('aData', $aData);
if (count($aData['aRows']) == 0 && $page != 1) {
    $total = (int) $aData['iTotalDisplayRecords'];
    $maxPage = ceil($total / (int) $aData['iDisplayLength']);
    $url = osc_admin_base_url(true) . '?' . $_SERVER['QUERY_STRING'];
    if ($maxPage == 0) {
        $url = preg_replace('/&iPage=(\\d)+/', '&iPage=1', $url);
        ob_get_clean();
        osc_redirect_to($url);
    }
    if ($page > $maxPage) {
        $url = preg_replace('/&iPage=(\\d)+/', '&iPage=' . $maxPage, $url);
        ob_get_clean();
        osc_redirect_to($url);
    }
}
$columns = $aData['aColumns'];
$rows = $aData['aRows'];
?>
<style>
     /* overlay */


    .overlay {
        position:absolute;
        top:0;
        left:0;
        right:0;
        bottom:0;