<h2 class="render-title"><?php _e('Watermark Image Settings'); ?> </h2> <div class="form-row"> <div class="form-label"><?php _e('Image'); ?> </div> <div class="form-controls"> <input type="file" name="watermark_image" id="watermark_image_file"/> <?php if (osc_is_watermark_image() != '') { ?> <div class="help-box"><img width="100px" src="<?php echo osc_base_url() . str_replace(osc_base_path(), '', osc_uploads_path()) . "watermark.png"; ?> " /></div> <?php } ?> <div class="help-box"><?php _e("It has to be a .PNG image"); ?> </div> <div class="help-box"><?php _e("Osclass doesn't check the watermark image size"); ?> </div> </div> </div>
function logo_footer() { $html = '<a id="logo-footer" href="' . osc_base_url() . '"><img border="0" alt="' . osc_page_title() . '" src="' . osc_base_url() . str_replace(ABS_PATH, '', osc_uploads_path()) . "realestate-logo-footer.jpg" . '" /></a>'; if (file_exists(osc_uploads_path() . "realestate-logo-footer.jpg")) { return $html; } else { return '<a id="logo-footer" class="logo-footer-text" href="' . osc_base_url() . '">' . osc_page_title() . '</a>'; } }
function fn_email_item_inquiry($aItem) { $id = $aItem['id']; $yourEmail = $aItem['yourEmail']; $yourName = $aItem['yourName']; $phoneNumber= $aItem['phoneNumber']; $message = nl2br( strip_tags( $aItem['message'] ) ); $path = null; $item = Item::newInstance()->findByPrimaryKey( $id ); View::newInstance()->_exportVariableToView('item', $item); $mPages = new Page(); $aPage = $mPages->findByInternalName('email_item_inquiry'); $locale = osc_current_user_locale(); if( isset($aPage['locale'][$locale]['s_title']) ) { $content = $aPage['locale'][$locale]; } else { $content = current($aPage['locale']); } $item_url = osc_item_url(); $item_url = '<a href="' . $item_url . '" >' . $item_url . '</a>'; $words = array(); $words[] = array( '{CONTACT_NAME}', '{USER_NAME}', '{USER_EMAIL}', '{USER_PHONE}', '{ITEM_TITLE}', '{ITEM_URL}', '{ITEM_LINK}', '{COMMENT}' ); $words[] = array( $item['s_contact_name'], $yourName, $yourEmail, $phoneNumber, $item['s_title'], osc_item_url(), $item_url, $message ); $title = osc_apply_filter('email_item_inquiry_title_after', osc_mailBeauty(osc_apply_filter('email_title', osc_apply_filter('email_item_inquiry_title', $content['s_title'], $aItem)), $words), $aItem); $body = osc_apply_filter('email_item_inquiry_description_after', osc_mailBeauty(osc_apply_filter('email_description', osc_apply_filter('email_item_inquiry_description', $content['s_text'], $aItem)), $words), $aItem); $from = osc_contact_email(); $from_name = osc_page_title(); $emailParams = array( 'from' => $from, 'from_name' => $from_name, 'subject' => $title, 'to' => $item['s_contact_email'], 'to_name' => $item['s_contact_name'], 'body' => $body, 'alt_body' => $body, 'reply_to' => $yourEmail ); if( osc_notify_contact_item() ) { $emailParams['add_bcc'] = osc_contact_email(); } if( osc_item_attachment() ) { $attachment = Params::getFiles('attachment'); $resourceName = $attachment['name']; $tmpName = $attachment['tmp_name']; $path = osc_uploads_path() . time() . '_' . $resourceName; if( !is_writable(osc_uploads_path()) ) { osc_add_flash_error_message( _m('There has been some errors sending the message') ); } if( !move_uploaded_file($tmpName, $path) ) { unset($path); } } if( isset($path) ) { $emailParams['attachment'] = $path; } osc_sendMail($emailParams); @unlink($path); }
function doModel() { switch ($this->action) { case 'logout': // unset only the required parameters in Session osc_run_hook('logout_admin'); $this->logout(); $this->redirectTo(osc_admin_base_url(true)); break; default: //default dashboard page (main page at oc-admin) $this->_exportVariableToView("numItemsPerCategory", osc_get_non_empty_categories()); $this->_exportVariableToView("numUsers", User::newInstance()->count()); $this->_exportVariableToView("numItems", Item::newInstance()->count()); // stats $items = array(); $stats_items = Stats::newInstance()->new_items_count(date('Y-m-d H:i:s', mktime(0, 0, 0, date("m"), date("d") - 10, date("Y"))), 'day'); for ($k = 10; $k >= 0; $k--) { $items[date('Y-m-d', mktime(0, 0, 0, date("m"), date("d") - $k, date("Y")))] = 0; } foreach ($stats_items as $item) { $items[$item['d_date']] = $item['num']; } $users = array(); $stats_users = Stats::newInstance()->new_users_count(date('Y-m-d H:i:s', mktime(0, 0, 0, date("m"), date("d") - 10, date("Y"))), 'day'); for ($k = 10; $k >= 0; $k--) { $users[date('Y-m-d', mktime(0, 0, 0, date("m"), date("d") - $k, date("Y")))] = 0; } foreach ($stats_users as $user) { $users[$user['d_date']] = $user['num']; } if (function_exists('disk_free_space')) { $freedisk = @disk_free_space(osc_uploads_path()); if ($freedisk !== false && $freedisk < 52428800) { //52428800 = 50*1024*1024 osc_add_flash_error_message(_m('You have very few free space left, users will not be able to upload pictures'), 'admin'); } } // show messages subscribed $status_subscribe = Params::getParam('subscribe_osclass'); if ($status_subscribe != '') { switch ($status_subscribe) { case -1: osc_add_flash_error_message(_m('Entered an invalid email'), 'admin'); break; case 0: osc_add_flash_warning_message(_m("You're already subscribed"), 'admin'); break; case 1: osc_add_flash_ok_message(_m('Subscribed correctly'), 'admin'); break; default: osc_add_flash_warning_message(_m("Error subscribing"), 'admin'); break; } } $this->_exportVariableToView("item_stats", $items); $this->_exportVariableToView("user_stats", $users); //calling the view... $this->doView('main/index.php'); } }
@unlink(osc_base_path() . 'language.php'); @unlink(osc_base_path() . 'login.php'); @unlink(osc_base_path() . 'main.php'); @unlink(osc_base_path() . 'page.php'); @unlink(osc_base_path() . 'register.php'); @unlink(osc_base_path() . 'search.php'); @unlink(osc_base_path() . 'user-non-secure.php'); @unlink(osc_base_path() . 'user.php'); @unlink(osc_base_path() . 'readme.php'); @unlink(osc_lib_path() . 'osclass/plugins.php'); @unlink(osc_lib_path() . 'osclass/feeds.php'); $comm->query(sprintf('UPDATE %st_user t, (SELECT pk_i_id FROM %st_user) t1 SET t.s_username = t1.pk_i_id WHERE t.pk_i_id = t1.pk_i_id', DB_TABLE_PREFIX, DB_TABLE_PREFIX)); osc_set_preference('username_blacklist', 'admin,user', 'osclass', 'STRING'); osc_set_preference('rewrite_user_change_username', 'username/change'); osc_set_preference('csrf_name', 'CSRF' . mt_rand(0, mt_getrandmax())); @mkdir(osc_uploads_path() . 'page-images'); } if (osc_version() < 320) { osc_set_preference('mailserver_mail_from', ''); osc_set_preference('mailserver_name_from', ''); osc_set_preference('seo_url_search_prefix', ''); $comm->query(sprintf("ALTER TABLE %st_category ADD `b_price_enabled` TINYINT(1) NOT NULL DEFAULT 1", DB_TABLE_PREFIX)); osc_set_preference('subdomain_type', ''); osc_set_preference('subdomain_host', ''); // email_new_admin $comm->query(sprintf("INSERT INTO %st_pages (s_internal_name, b_indelible, dt_pub_date) VALUES ('email_new_admin', 1, '%s' )", DB_TABLE_PREFIX, date('Y-m-d H:i:s'))); $comm->query(sprintf("INSERT INTO %st_pages_description (fk_i_pages_id, fk_c_locale_code, s_title, s_text) VALUES (%d, 'en_US', '{WEB_TITLE} - Success creating admin account!', '<p>Hi {ADMIN_NAME},</p><p>The admin of {WEB_LINK} has created an account for you,</p><ul><li>Username: {USERNAME}</li><li>Password: {PASSWORD}</li></ul><p>You can access the admin panel here {WEB_ADMIN_LINK}.</p><p>Thank you!</p><p>Regards,</p>')", DB_TABLE_PREFIX, $comm->insertedId())); osc_set_preference('warn_expiration', '0', 'osclass', 'INTEGER'); $comm->query(sprintf("INSERT INTO %st_pages (s_internal_name, b_indelible, dt_pub_date) VALUES ('email_warn_expiration', 1, '%s' )", DB_TABLE_PREFIX, date('Y-m-d H:i:s'))); $comm->query(sprintf("INSERT INTO %st_pages_description (fk_i_pages_id, fk_c_locale_code, s_title, s_text) VALUES (%d, 'en_US', '{WEB_TITLE} - Your ad is about to expire', '<p>Hi {USER_NAME},</p><p>Your listing <a href=\"{ITEM_URL}\">{ITEM_TITLE}</a> is about to expire at {WEB_LINK}.')", DB_TABLE_PREFIX, $comm->insertedId())); osc_set_preference('force_aspect_image', '0', 'osclass', 'BOOLEAN');
//disable image editor and text editor define('CONFIG_OPTIONS_SEARCH', false); //disable to search documents //FILESYSTEM CONFIG /* * CONFIG_SYS_DEFAULT_PATH is the default folder where the files would be uploaded to and it must be a folder under the CONFIG_SYS_ROOT_PATH or the same folder these two paths accept relative path only, don't use absolute path */ define('CONFIG_SYS_DEFAULT_PATH', '../../../../../../../' . str_replace(osc_base_path(), '', osc_uploads_path()) . 'page-images/'); //accept relative path only define('CONFIG_SYS_ROOT_PATH', '../../../../../../../' . str_replace(osc_base_path(), '', osc_uploads_path()) . 'page-images/'); //accept relative path only define('CONFIG_SYS_FOLDER_SHOWN_ON_TOP', true); //show your folders on the top of list if true or order by name define("CONFIG_SYS_DIR_SESSION_PATH", '../../../../../../../' . str_replace(osc_base_path(), '', osc_uploads_path()) . 'page-images/'); define("CONFIG_SYS_PATTERN_FORMAT", 'list'); //three options: reg ,csv, list, this option define the parttern format for the following patterns /** * reg => regulare expression * csv => a list of comma separated file/folder name, (exactly match the specified file/folders) * list => a list of comma spearated vague file/folder name (partially match the specified file/folders) * */ //more details about regular expression please visit http://nz.php.net/manual/en/function.eregi.php define('CONFIG_SYS_INC_DIR_PATTERN', ''); //force listing of folders with such pattern(s). separated by , if multiple define('CONFIG_SYS_EXC_DIR_PATTERN', ''); //will prevent listing of folders with such pattern(s). separated by , if multiple define('CONFIG_SYS_INC_FILE_PATTERN', ''); //force listing of fiels with such pattern(s). separated by , if multiple
$logo_prefence = osc_get_preference('logo', 'pop_theme'); if (is_writable(osc_uploads_path())) { ?> <?php if ($logo_prefence) { ?> <h3 class="render-title"><?php _e('Preview', 'pop'); ?> </h3> <p class="preview_logo"> <img border="2" alt="<?php echo osc_esc_html(osc_page_title()); ?> " src="<?php echo pop_logo_url() . '?' . filemtime(osc_uploads_path() . osc_get_preference('logo', 'pop_theme')); ?> " /> </p> <form action="<?php echo osc_admin_render_theme_url('oc-content/themes/pop/admin/header.php'); ?> " method="post" enctype="multipart/form-data" class="nocsrf"> <input type="hidden" name="action_specific" value="remove" /> <fieldset> <div class="form-horizontal"> <div class="form-actions"> <input id="button_remove" type="submit" value="<?php echo osc_esc_html(__('Remove logo', 'pop')); ?> " class="btn btn-red">
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_theme'); 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_theme'); osc_set_preference('footer_link', $footerLink ? '1' : '0', 'bender_theme'); osc_set_preference('defaultShowAs@all', Params::getParam('defaultShowAs@all'), 'bender_theme'); osc_set_preference('defaultShowAs@search', Params::getParam('defaultShowAs@all')); 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_theme'); 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_theme'); $path = osc_uploads_path() . $logo; if (file_exists($path)) { @unlink($path); osc_delete_preference('logo', 'bender_theme'); 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; } }
function osc_uploads_url($item = '') { $logo = osc_get_preference('logo', 'bender'); if ($logo != '' && file_exists(osc_uploads_path() . $logo)) { $path = str_replace(ABS_PATH, '', osc_uploads_path() . '/'); return osc_base_url() . $path . $item; } }
<?php $logo_prefence = osc_get_preference('logo', 'osclassclsx'); if (is_writable(osc_uploads_path())) { ?> <?php if ($logo_prefence) { ?> <h3 class="render-title"><?php _e('Preview', 'osclassclsx'); ?> </h3> <img border="0" alt="<?php echo osc_esc_html(osc_page_title()); ?> " src="<?php echo osclassclsx_logo_url() . '?' . filemtime(osc_uploads_path() . osc_get_preference('logo', 'osclassclsx')); ?> " /> <form action="<?php echo osc_admin_render_theme_url('oc-content/themes/osclassclsx/admin/header.php'); ?> " method="post" enctype="multipart/form-data" class="nocsrf"> <input type="hidden" name="action_specific" value="remove" /> <fieldset> <div class="form-horizontal"> <div class="form-actions"> <input id="button_remove" type="submit" value="<?php echo osc_esc_html(__('Remove logo', 'osclassclsx')); ?> " class="btn btn-red"> </div>
function osc_change_permissions($dir = ABS_PATH) { if (strpos($dir, "../") !== false || strpos($dir, "..\\") !== false) { return false; } clearstatcache(); if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if ($file != "." && $file != ".." && substr($file, 0, 1) != ".") { if (is_dir(str_replace("//", "/", $dir . "/" . $file))) { if (!is_writable(str_replace("//", "/", $dir . "/" . $file))) { $res = @chmod(str_replace("//", "/", $dir . "/" . $file), 0777); if (!$res) { return false; } } if (str_replace("//", "/", $dir) == ABS_PATH . "oc-content/themes") { if ($file == "modern" || $file == "index.php") { $res = osc_change_permissions(str_replace("//", "/", $dir . "/" . $file)); if (!$res) { return false; } } } else { if (str_replace("//", "/", $dir) == ABS_PATH . "oc-content/plugins") { if ($file == "google_maps" || $file == "google_analytics" || $file == "index.php") { $res = osc_change_permissions(str_replace("//", "/", $dir . "/" . $file)); if (!$res) { return false; } } } else { if (str_replace("//", "/", $dir) == ABS_PATH . "oc-content/languages") { if ($file == "en_US" || $file == "index.php") { $res = osc_change_permissions(str_replace("//", "/", $dir . "/" . $file)); if (!$res) { return false; } } } else { if (str_replace("//", "/", $dir) == ABS_PATH . "oc-content/downloads") { } else { if (str_replace("//", "/", $dir) == osc_uploads_path()) { } else { $res = osc_change_permissions(str_replace("//", "/", $dir . "/" . $file)); if (!$res) { return false; } } } } } } } else { if (!is_writable(str_replace("//", "/", $dir . "/" . $file))) { return @chmod(str_replace("//", "/", $dir . "/" . $file), 0777); } else { return true; } } } } closedir($dh); } return true; }
<?php $logo_prefence = osc_get_preference('homeimage', 'osclasswizards_theme'); if (is_writable(osc_uploads_path())) { ?> <?php if ($logo_prefence) { ?> <h3 class="render-title"><?php _e('Preview', 'osclasswizards'); ?> </h3> <img style="max-width:100%;" border="0" alt="<?php echo osc_esc_html(osc_page_title()); ?> " src="<?php echo osclasswizards_homeimage_url() . '?' . filemtime(osc_uploads_path() . osc_get_preference('homeimage', 'osclasswizards_theme')); ?> " /> <form action="<?php echo osc_admin_render_theme_url('oc-content/themes/osclasswizards/admin/settings.php'); ?> " method="post" enctype="multipart/form-data" class="nocsrf"> <input type="hidden" name="action_specific" value="remove_homeimage" /> <fieldset> <div class="form-horizontal"> <div class="form-actions"> <input id="button_remove" type="submit" value="<?php echo osc_esc_html(__('Remove image', 'osclasswizards')); ?> " class="btn btn-red"> </div>
function theme_flatter_actions_admin() { //if(OC_ADMIN) switch (Params::getParam('action_specific')) { case 'settings': $googleCode = Params::getParam('google_analytics'); $googleWebmaster = Params::getParam('google_webmaster'); $contactEnable = Params::getParam('contact_enable'); $subscribeShow = Params::getParam('subscribe_show'); $geoAds = Params::getParam('geo_ads'); $Anim = Params::getParam('anim'); $usefulInfo = Params::getParam('usefulinfo_show'); $popEnable = Params::getParam('pop_enable'); $locationInput = Params::getParam('location_input'); osc_set_preference('subscribe_show', $subscribeShow ? '1' : '0', 'flatter_theme'); osc_set_preference('geo_ads', $geoAds ? '1' : '0', 'flatter_theme'); osc_set_preference('anim', $Anim ? '1' : '0', 'flatter_theme'); osc_set_preference('usefulinfo_show', $usefulInfo ? '1' : '0', 'flatter_theme'); osc_set_preference('usefulinfo_msg', Params::getParam('usefulinfo_msg', false, false), 'flatter_theme'); osc_set_preference('keyword_placeholder', Params::getParam('keyword_placeholder'), 'flatter_theme'); osc_set_preference('fpromo_text', Params::getParam('fpromo_text'), 'flatter_theme'); osc_set_preference('premium_count', Params::getParam('premium_count'), 'flatter_theme'); osc_set_preference('defaultShowAs@all', Params::getParam('defaultShowAs@all'), 'flatter_theme'); osc_set_preference('defaultShowAs@search', Params::getParam('defaultShowAs@all')); osc_set_preference('defaultColor@all', Params::getParam('defaultColor@all'), 'flatter_theme'); osc_set_preference('contact_enable', $contactEnable ? '1' : '0', 'flatter_theme'); osc_set_preference('contact_address', Params::getParam('contact_address', false, false), 'flatter_theme'); osc_set_preference('address_map', Params::getParam('address_map', false, false), 'flatter_theme'); osc_set_preference('google_analytics', $googleCode ? '1' : '0', 'flatter_theme'); osc_set_preference('g_analytics', Params::getParam('g_analytics'), 'flatter_theme'); osc_set_preference('google_webmaster', $googleWebmaster ? '1' : '0', 'flatter_theme'); osc_set_preference('g_webmaster', Params::getParam('g_webmaster'), 'flatter_theme'); osc_set_preference('custom_css', Params::getParam('custom_css', false, false), 'flatter_theme'); osc_set_preference('location_input', $locationInput ? '1' : '0', 'flatter_theme'); osc_set_preference('pop_enable', $popEnable ? '1' : '0', 'flatter_theme'); osc_set_preference('pop_heading', Params::getParam('pop_heading'), 'flatter_theme'); osc_set_preference('landing_pop', Params::getParam('landing_pop', false, false), 'flatter_theme'); osc_add_flash_ok_message(__('Theme settings updated correctly', 'flatter'), 'admin'); osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/flatter/admin/settings.php')); break; case 'page_settings': osc_set_preference('terms_link', Params::getParam('terms_link'), 'flatter_theme'); osc_set_preference('privacy_link', Params::getParam('privacy_link'), 'flatter_theme'); osc_set_preference('facebook_page', Params::getParam('facebook_page'), 'flatter_theme'); osc_set_preference('twitter_page', Params::getParam('twitter_page'), 'flatter_theme'); osc_set_preference('gplus_page', Params::getParam('gplus_page'), 'flatter_theme'); osc_set_preference('pinterest_page', Params::getParam('pinterest_page'), 'flatter_theme'); osc_add_flash_ok_message(__('Page / Social links updated correctly', 'flatter'), 'admin'); osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/flatter/admin/settings.php#page')); break; case 'category_settings': $i = 0; while (osc_has_categories()) { osc_set_preference('cat_icon_' . osc_category_id(), Params::getParam('cat_icon_' . osc_category_id()), 'flatter_theme'); $i++; } osc_add_flash_ok_message(__('Category icons updated correctly', 'flatter'), 'admin'); osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/flatter/admin/settings.php#category')); break; case 'adsense_settings': $adsenseEnable = Params::getParam('google_adsense'); osc_set_preference('google_adsense', $adsenseEnable ? '1' : '0', 'flatter_theme'); osc_set_preference('ads_pubid', Params::getParam('ads_pubid'), 'flatter_theme'); osc_set_preference('ads_slotid', Params::getParam('ads_slotid'), 'flatter_theme'); osc_add_flash_ok_message(__('Adsense settings updated correctly', 'flatter'), 'admin'); osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/flatter/admin/settings.php#adsense')); break; case 'footer_settings': $facebookLink = Params::getParam('facebook_likebox'); $footerLink = Params::getParam('footer_link'); osc_set_preference('facebook_likebox', $facebookLink ? '1' : '0', 'flatter_theme'); osc_set_preference('footer_link', $footerLink ? '1' : '0', 'flatter_theme'); osc_add_flash_ok_message(__('Widgets updated correctly', 'flatter'), 'admin'); osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/flatter/admin/settings.php#footerwidget')); break; case 'other_settings': $position1 = Params::getParam('position1_enable'); $position2 = Params::getParam('position2_enable'); $position3 = Params::getParam('position3_enable'); $position4 = Params::getParam('position4_enable'); $position5 = Params::getParam('position5_enable'); $position6 = Params::getParam('position6_enable'); $position7 = Params::getParam('position7_enable'); $position8 = Params::getParam('position8_enable'); $position9 = Params::getParam('position9_enable'); $position10 = Params::getParam('position10_enable'); $positionhide1 = Params::getParam('position1_hide'); $positionhide2 = Params::getParam('position2_hide'); $positionhide3 = Params::getParam('position3_hide'); $positionhide4 = Params::getParam('position4_hide'); $positionhide5 = Params::getParam('position5_hide'); $positionhide6 = Params::getParam('position6_hide'); $positionhide7 = Params::getParam('position7_hide'); $positionhide8 = Params::getParam('position8_hide'); $positionhide9 = Params::getParam('position9_hide'); $positionhide10 = Params::getParam('position10_hide'); osc_set_preference('position1_enable', $position1 ? '1' : '0', 'flatter_theme'); osc_set_preference('position2_enable', $position2 ? '1' : '0', 'flatter_theme'); osc_set_preference('position3_enable', $position3 ? '1' : '0', 'flatter_theme'); osc_set_preference('position4_enable', $position4 ? '1' : '0', 'flatter_theme'); osc_set_preference('position5_enable', $position5 ? '1' : '0', 'flatter_theme'); osc_set_preference('position6_enable', $position6 ? '1' : '0', 'flatter_theme'); osc_set_preference('position7_enable', $position7 ? '1' : '0', 'flatter_theme'); osc_set_preference('position8_enable', $position8 ? '1' : '0', 'flatter_theme'); osc_set_preference('position9_enable', $position9 ? '1' : '0', 'flatter_theme'); osc_set_preference('position10_enable', $position10 ? '1' : '0', 'flatter_theme'); osc_set_preference('position1_hide', $positionhide1 ? '1' : '0', 'flatter_theme'); osc_set_preference('position2_hide', $positionhide2 ? '1' : '0', 'flatter_theme'); osc_set_preference('position3_hide', $positionhide3 ? '1' : '0', 'flatter_theme'); osc_set_preference('position4_hide', $positionhide4 ? '1' : '0', 'flatter_theme'); osc_set_preference('position5_hide', $positionhide5 ? '1' : '0', 'flatter_theme'); osc_set_preference('position6_hide', $positionhide6 ? '1' : '0', 'flatter_theme'); osc_set_preference('position7_hide', $positionhide7 ? '1' : '0', 'flatter_theme'); osc_set_preference('position8_hide', $positionhide8 ? '1' : '0', 'flatter_theme'); osc_set_preference('position9_hide', $positionhide9 ? '1' : '0', 'flatter_theme'); osc_set_preference('position10_hide', $positionhide10 ? '1' : '0', 'flatter_theme'); osc_set_preference('position1_content', Params::getParam('position1_content', false, false), 'flatter_theme'); osc_set_preference('position2_content', Params::getParam('position2_content', false, false), 'flatter_theme'); osc_set_preference('position3_content', Params::getParam('position3_content', false, false), 'flatter_theme'); osc_set_preference('position4_content', Params::getParam('position4_content', false, false), 'flatter_theme'); osc_set_preference('position5_content', Params::getParam('position5_content', false, false), 'flatter_theme'); osc_set_preference('position6_content', Params::getParam('position6_content', false, false), 'flatter_theme'); osc_set_preference('position7_content', Params::getParam('position7_content', false, false), 'flatter_theme'); osc_set_preference('position8_content', Params::getParam('position8_content', false, false), 'flatter_theme'); osc_set_preference('position9_content', Params::getParam('position9_content', false, false), 'flatter_theme'); osc_set_preference('position10_content', Params::getParam('position10_content', false, false), 'flatter_theme'); osc_add_flash_ok_message(__('Settings updated correctly', 'flatter'), 'admin'); osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/flatter/admin/settings.php#others')); 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 = 'flatter_logo'; $logo_name .= '.' . $ext; $path = osc_uploads_path() . $logo_name; $img->saveToFile($path); osc_set_preference('logo', $logo_name, 'flatter_theme'); osc_add_flash_ok_message(__('The logo image has been uploaded correctly', 'flatter'), 'admin'); } else { osc_add_flash_error_message(__("An error has occurred, please try again", 'flatter'), 'admin'); } osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/flatter/admin/settings.php#logo')); break; case 'remove': $logo = osc_get_preference('logo', 'flatter_theme'); $path = osc_uploads_path() . $logo; if (file_exists($path)) { @unlink($path); osc_delete_preference('logo', 'flatter_theme'); osc_reset_preferences(); osc_add_flash_ok_message(__('The logo image has been removed', 'flatter'), 'admin'); } else { osc_add_flash_error_message(__("Image not found", 'flatter'), 'admin'); } osc_redirect_to(osc_admin_render_theme_url('oc-content/themes/flatter/admin/settings.php#logo')); break; } }
<?php $logo_prefence = osc_get_preference('logo', 'bender'); if (is_writable(osc_uploads_path())) { ?> <?php if ($logo_prefence) { ?> <h3 class="render-title"><?php _e('Preview', 'bender'); ?> </h3> <img border="0" alt="<?php echo osc_esc_html(osc_page_title()); ?> " src="<?php echo bender_logo_url() . '?' . filemtime(osc_uploads_path() . osc_get_preference('logo', 'bender')); ?> " /> <form action="<?php echo osc_admin_render_theme_url('oc-content/themes/bender/admin/header.php'); ?> " method="post" enctype="multipart/form-data" class="nocsrf"> <input type="hidden" name="action_specific" value="remove" /> <fieldset> <div class="form-horizontal"> <div class="form-actions"> <input id="button_remove" type="submit" value="<?php echo osc_esc_html(__('Remove logo', 'bender')); ?> " class="btn btn-red"> </div>
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; } }
<div class="form-actions"> <button type="submit" class="col-sm-offset-2 btn btn-success"><?php _e('Save changes', 'flatter'); ?> </button> </div> </form> </div><!-- Page Settings --> <div class="tab-pane" id="logo"> <?php $logo_prefence = osc_get_preference('logo', 'flatter_theme'); ?> <?php if (is_writable(osc_uploads_path())) { ?> <?php if ($logo_prefence) { ?> <div class="panel panel-default"> <div class="panel-heading"><strong><?php _e('Logo Preview', 'flatter'); ?> </strong></div> <div class="panel-body"> <img border="0" alt="<?php echo osc_esc_html(osc_page_title()); ?> " src="<?php echo flatter_logo_url();
define('CONFIG_OPTIONS_COPY', false); define('CONFIG_OPTIONS_NEWFOLDER', false); define('CONFIG_OPTIONS_RENAME', true); define('CONFIG_OPTIONS_UPLOAD', true); // define('CONFIG_OPTIONS_EDITABLE', true); //disable image editor and text editor //FILESYSTEM CONFIG /* * CONFIG_SYS_DEFAULT_PATH is the default folder where the files would be uploaded to and it must be a folder under the CONFIG_SYS_ROOT_PATH or the same folder these two paths accept relative path only, don't use absolute path */ define('CONFIG_SYS_DEFAULT_PATH', '../../../../../../../' . str_replace(osc_base_path(), '', osc_uploads_path()) . 'page-images/'); //accept relative path only define('CONFIG_SYS_ROOT_PATH', '../../../../../../../' . str_replace(osc_base_path(), '', osc_uploads_path()) . 'page-images/'); //accept relative path only define('CONFIG_SYS_FOLDER_SHOWN_ON_TOP', true); //show your folders on the top of list if true or order by name define("CONFIG_SYS_DIR_SESSION_PATH", 'session/'); define("CONFIG_SYS_PATTERN_FORMAT", 'list'); //three options: reg ,csv, list, this option define the parttern format for the following patterns /** * reg => regulare expression * csv => a list of comma separated file/folder name, (exactly match the specified file/folders) * list => a list of comma spearated vague file/folder name (partially match the specified file/folders) * */ //more details about regular expression please visit http://nz.php.net/manual/en/function.eregi.php define('CONFIG_SYS_INC_DIR_PATTERN', ''); //force listing of folders with such pattern(s). separated by , if multiple
</div> <div style="clear: both;"></div> <?php } else { ?> <div id="flash_message"> <p> <?php $msg = sprintf(__('The images folder %s is not writable on your server', 'realestate'), osc_uploads_path()) . ", "; $msg .= __('Osclass can\'t upload logo image from the administration panel', 'realestate') . '. '; $msg .= __('Please make the mentioned images folder writable', 'realestate') . '.'; echo $msg; ?> </p> <p> <?php _e('To make a directory writable under UNIX execute this command from the shell', 'realestate'); ?> : </p> <p style="background-color: white; border: 1px solid black; padding: 8px;"> chmod a+w <?php echo osc_uploads_path(); ?> </p> </div> <?php }
<?php $logo_prefence = osc_get_preference('favicon', 'osclasswizards_theme'); if (is_writable(osc_uploads_path())) { ?> <?php if ($logo_prefence) { ?> <h3 class="render-title"><?php _e('Preview', 'osclasswizards'); ?> </h3> <img style="max-width:100%;" border="0" alt="<?php echo osc_esc_html(osc_page_title()); ?> " src="<?php echo osclasswizards_favicon_url() . '?' . filemtime(osc_uploads_path() . osc_get_preference('favicon', 'osclasswizards_theme')); ?> " /> <form action="<?php echo osc_admin_render_theme_url('oc-content/themes/osclasswizards/admin/settings.php'); ?> " method="post" enctype="multipart/form-data" class="nocsrf"> <input type="hidden" name="action_specific" value="remove_favicon" /> <fieldset> <div class="form-horizontal"> <div class="form-actions"> <input id="button_remove" type="submit" value="<?php echo osc_esc_html(__('Remove image', 'osclasswizards')); ?> " class="btn btn-red"> </div>
<?php $map_image = str_replace(osc_uploads_url(), osc_uploads_path(), pop_get_listing_map_image(osc_item_id())); if (!file_exists($map_image)) { pop_listing_location_img(osc_item()); } // meta tag robots osc_add_hook('header', 'pop_follow_construct'); pop_add_body_class('item'); osc_enqueue_script('jquery-validate'); osc_enqueue_script('jquery-bxslider'); osc_enqueue_style('jquery-bxslider-css', osc_current_web_theme_url('css/jquery.bxslider.css')); View::newInstance()->_exportVariableToView('user', User::newInstance()->findByPrimaryKey(osc_item_user_id())); ?> <?php osc_current_web_theme_path('header.php'); $class = ''; if (osc_count_item_resources() == 0) { $class = "no-image"; } ?> <div class="box photos <?php echo $class; ?> "> <div class="photos-slider"> <?php if (osc_count_item_resources() > 0) { ?> <ul class="bxslider">
private static function _purify($value, $xss_check) { if (!$xss_check) { return $value; } self::$_config = HTMLPurifier_Config::createDefault(); self::$_config->set('HTML.Allowed', ''); self::$_config->set('Cache.SerializerPath', osc_uploads_path()); if (!isset(self::$_purifier)) { self::$_purifier = new HTMLPurifier(self::$_config); } if (is_array($value)) { foreach ($value as $k => &$v) { $v = self::_purify($v, $xss_check); // recursive } } else { $value = self::$_purifier->purify($value); } return $value; }
/* * Copyright 2014 Osclass * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ define('CACHE_PATH', osc_uploads_path()); /** * This is the simplest cache service on earth. * * @author Osclass * @version 1.0 */ class Cache { private $objectKey; private $expiration; public function __construct($objectKey, $expiration = 900) { $this->objectKey = $objectKey; $this->expiration = $expiration; }
function pop_listing_location_img($aItem) { $location_string = pop_get_listing_location_string($aItem); $url = 'http://maps.googleapis.com/maps/api/staticmap?center=' . urlencode($location_string) . '&zoom=15&size=640x200&scale=1'; $img_path = osc_uploads_path() . $aItem['pk_i_id'] . '_map.png'; file_put_contents($img_path, file_get_contents($url)); }
public function doWatermarkImage() { $this->_watermarked = true; $path_watermark = osc_uploads_path() . 'watermark.png'; if (osc_use_imagick()) { $wm = new Imagick($path_watermark); $wgeo = $wm->getImageGeometry(); switch (osc_watermark_place()) { case 'tl': $dest_x = 0; $dest_y = 0; break; case 'tr': $dest_x = $this->_width - $wgeo['width']; $dest_y = 0; break; case 'bl': $dest_x = 0; $dest_y = $this->_height - $wgeo['height']; break; case 'br': $dest_x = $this->_width - $wgeo['width']; $dest_y = $this->_height - $wgeo['height']; break; default: $dest_x = ($this->_width - $wgeo['width']) / 2; $dest_y = ($this->_height - $wgeo['height']) / 2; break; } $this->im->compositeImage($wm, imagick::COMPOSITE_OVER, $dest_x, $dest_y); $wm->destroy(); } else { $watermark = imagecreatefrompng($path_watermark); $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); switch (osc_watermark_place()) { case 'tl': $dest_x = 0; $dest_y = 0; break; case 'tr': $dest_x = $this->_width - $watermark_width; $dest_y = 0; break; case 'bl': $dest_x = 0; $dest_y = $this->_height - $watermark_height; break; case 'br': $dest_x = $this->_width - $watermark_width; $dest_y = $this->_height - $watermark_height; break; default: $dest_x = ($this->_width - $watermark_width) / 2; $dest_y = ($this->_height - $watermark_height) / 2; break; } $this->_imagecopymerge_alpha($this->im, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); imagedestroy($watermark); } return $this; }
public function uploadItemResources($aResources,$itemId) { if($aResources != '') { $itemResourceManager = ItemResource::newInstance(); $folder = osc_uploads_path().(floor($itemId/100))."/"; $numImagesItems = osc_max_images_per_item(); $numImages = $itemResourceManager->countResources($itemId); foreach ($aResources['error'] as $key => $error) { if($numImagesItems==0 || ($numImagesItems>0 && $numImages<$numImagesItems)) { if ($error == UPLOAD_ERR_OK) { $tmpName = $aResources['tmp_name'][$key]; $imgres = ImageResizer::fromFile($tmpName); $extension = osc_apply_filter('upload_image_extension', $imgres->getExt()); $mime = osc_apply_filter('upload_image_mime', $imgres->getMime()); // Create normal size $normal_path = $path = $tmpName."_normal"; $size = explode('x', osc_normal_dimensions()); $img = ImageResizer::fromFile($tmpName)->autoRotate()->resizeTo($size[0], $size[1]); if( osc_is_watermark_text() ) { $img->doWatermarkText(osc_watermark_text(), osc_watermark_text_color()); } else if ( osc_is_watermark_image() ){ $img->doWatermarkImage(); } $img->saveToFile($path, $extension); // Create preview $path = $tmpName."_preview"; $size = explode('x', osc_preview_dimensions()); ImageResizer::fromFile($normal_path)->resizeTo($size[0], $size[1])->saveToFile($path, $extension); // Create thumbnail $path = $tmpName."_thumbnail"; $size = explode('x', osc_thumbnail_dimensions()); ImageResizer::fromFile($normal_path)->resizeTo($size[0], $size[1])->saveToFile($path, $extension); $numImages++; $itemResourceManager->insert(array( 'fk_i_item_id' => $itemId )); $resourceId = $itemResourceManager->dao->insertedId(); if(!is_dir($folder)) { if (!@mkdir($folder, 0755, true)) { return 3; // PATH CAN NOT BE CREATED } } osc_copy($tmpName.'_normal', $folder.$resourceId.'.'.$extension); osc_copy($tmpName.'_preview', $folder.$resourceId.'_preview.'.$extension); osc_copy($tmpName.'_thumbnail', $folder.$resourceId.'_thumbnail.'.$extension); if( osc_keep_original_image() ) { $path = $folder.$resourceId.'_original.'.$extension; osc_copy($tmpName, $path); } @unlink($tmpName."_normal"); @unlink($tmpName."_preview"); @unlink($tmpName."_thumbnail"); @unlink($tmpName); $s_path = str_replace(osc_base_path(), '', $folder); $itemResourceManager->update( array( 's_path' => $s_path ,'s_name' => osc_genRandomPassword() ,'s_extension' => $extension ,'s_content_type' => $mime ) ,array( 'pk_i_id' => $resourceId ,'fk_i_item_id' => $itemId ) ); osc_run_hook('uploaded_file', ItemResource::newInstance()->findByPrimaryKey($resourceId)); } } } unset($itemResourceManager); } return 0; // NO PROBLEMS }
<?php $logo_prefence = osc_get_preference('logo', 'osclasswizards_theme'); if (is_writable(osc_uploads_path())) { ?> <?php if ($logo_prefence) { ?> <h3 class="render-title"><?php _e('Preview', OSCLASSWIZARDS_THEME_FOLDER); ?> </h3> <img style="max-width:100%;" border="0" alt="<?php echo osc_esc_html(osc_page_title()); ?> " src="<?php echo osclasswizards_logo_url() . '?' . filemtime(osc_uploads_path() . osc_get_preference('logo', 'osclasswizards_theme')); ?> " /> <form action="<?php echo osc_admin_render_theme_url('oc-content/themes/' . OSCLASSWIZARDS_THEME_FOLDER . '/admin/settings.php'); ?> " method="post" enctype="multipart/form-data" class="nocsrf"> <input type="hidden" name="action_specific" value="remove" /> <fieldset> <div class="form-horizontal"> <div class="form-actions"> <input id="button_remove" type="submit" value="<?php echo osc_esc_html(__('Remove logo', OSCLASSWIZARDS_THEME_FOLDER)); ?> " class="btn btn-red"> </div>