Keyword

Advanced Search

Search Results (Searched for: change K2 item images path)

  • Jo
  • Jo's Avatar
07 Dec 2014 22:55
Replied by Jo on topic Default Item Image

Default Item Image

Category: English K2 Community

I got it finally, posting if it help sombody else.
For category_item.php use this code and change the path to your image.
Works for me anyway!
<?php if($this->item->params->get('itemImage')):?> <?php if(!empty($this->item->image)): ?> <!-- Item Image --> <div class="itemImageBlock"> <span class="itemImage"> <a href="<?php echo $this->item->link; ?>"><img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" /></a> </span> <div class="clr"></div> </div> <?php else: //no K2 image is present ?> <div class="itemImageBlock"> <span class="itemImage"> <a href="<?php echo $this->item->link; ?>"><img src="<?php echo JURI::root(); ?>templates/default/images/myimage.jpg" alt="<?php echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" /></a> </span> </div> <?php endif; ?> <?php endif; ?>
  • alex
  • alex's Avatar
01 Nov 2014 04:48 - 01 Nov 2014 04:51
How Change the URL image? was created by alex

How Change the URL image?

Category: English K2 Community

:(
Hello, I use K2 and when i want to put a image for any article, i use the IMAGE default boton but i notice that every image on my web has a URL like this:

mywebsitecom/media/k2/items/cache/a27a3b73d355048c6bab885897085f62_XL.jpg

Not friendly for SEO

Is there any way that K2 do not create a cheche imagen and use the real path of the image?, like this:

www.mywebsite.com/images/picture.jpg

¿?
Thank you
  • Lefteris
  • Lefteris's Avatar
13 Oct 2014 13:30
Replied by Lefteris on topic Watermark to K2 Item Image

Watermark to K2 Item Image

Category: English K2 Community

Hi. Hacking K2 is not a good idea since you will lose your changes in future updates. I strongly suggest that you move your code to a K2 or content plugin. Regarding the actual code, the class that K2 uses for generating thumbnails has already support for watermarks. There is no need to write all this code. You can add a watermark when the image is resized by using the following code:
$handle->image_watermark = 'PATH_TO_THE_WATERMARK_FILE';
Note that you need to pass the absolute filesystem path to the watermark file. For example if your watermark is located at the images folder and is named "watermark.png" then you should use it like:
$handle->image_watermark = JPATH_SITE.'/images/watermark.png';
The class has several options regarding the watermark. You can find them at www.verot.net/php_class_upload_docs.htm .
  • Tero Kankaanperä
  • Tero Kankaanperä's Avatar
26 Sep 2014 20:08
Replied by Tero Kankaanperä on topic FPSS messes up the assets table!

FPSS messes up the assets table!

Category: Frontpage Slideshow

The reason they get parent_id zero is that the asset of the category is not saved correctly. That's why i asked you to edit the category and save it.

The asset category has now been opened and saved.

When slides are saved their asset entries should get as parent the asset id of the category. If that's zero then you have a problem.

I know.

The category's asset entry now should have as parent the id of the component entry. Once again if this is zero there is a problem.

This has been the case the whole time.

How you transferred the slides out of the category? Have you moved them to a different category? Have the assets changed correctly when you moved them? Can you check all the FPSS relevant asset entries? Can you verify that FPSS is indeed inserting zeros while the data is different in the assets table? A dump of the FPSS related entries of your database would be very helpful.

I created a new category called "temp" and opened the slides one by one and set them to this new category. After that did the same transfering them back to the original category. I did not check the database in between the transfers to make sure that the cahnges took place but on the Slides-view they seem to have the correct category.
I opened the assets-table in PHPMyAdmin and searched the name field for fpss with the LIKE %..% search. This resulted in six entries.
One for com_fpss (the component) with parent_id 1, level 1 and id 863.
One for com_fpss_category.2 with parent_id 863 and level 2 and id 2167
One for each com_fpss_slide.5 through 8 with parent_id 0 and level 3 each.
I then manually corrected the parent_ids of the slides to 2167.
This problem has now surfaced two times and these are the only times that slides have been added to FPSS, so I would deem the connection established and causality confirmed but certainly I can try to duplicate it once more.

Here's a FPA generated report on the site:

Part of the message is hidden for the guests. Please log in or register to see it.
  • Voiceconnect Internet Solutions
  • Voiceconnect Internet Solutions's Avatar
26 Sep 2014 15:31 - 26 Sep 2014 15:35
Replied by Voiceconnect Internet Solutions on topic [SOLVED] K2 image cache rebuild

[SOLVED] K2 image cache rebuild

Category: English K2 Community

ok so - have figured this out being also a non developer. The file they have you downloaded is a html sort of file actually and not a real php file - below is the php part - copy this and paste in new file and save as rebuild.php - then to run it, just open it on your web server by just adding /media/k2/items/rebuild.php after your url like localhost/testsite/media/k2/items/rebuild.php

This will then actually run the script - as they said, it takes a long time to run so make sure your max_execution_time = 6000 in your php.ini file is set high - i changed mine to 6000 for the test.

hope this helps someone like me that did not understand run it :woohoo:

oh - remember to change the sizes in the first part of the script to replicate your parameters and the quality setting - that is all you need to change.

<?php
/**
* How to use:
*
* 1) Copy this file as rebuild.php into "JPATH_ROOT/media/k2/items"
* 2) Check Variables, use a size of 0 for not processing this image size
* 3) run it "php -f rebuild.php" (it overwrites existing files without notice)
*
* @author Robert Deutz <This email address is being protected from spambots. You need JavaScript enabled to view it.>
*/
// Variabels
$sizeG = 436;
$sizeL = 525;
$sizeM = 436;
$sizeS = 200;
$sizeXL = 900;
$sizeXS = 150;
$jpeg_quality = 75;
/**
* DO NOT CHANGE ANYTHING AFTER THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING!
*/
$uploadclassfile = dirname(__FILE__).'/../../../administrator/components/com_k2/lib/class.upload.php';
if(!file_exists($uploadclassfile))
{
echo "Can't find class.upload.php! Is K2 installed? Did you copy rebuild.php to the right directory?";
}
define('_JEXEC',1);
require_once ($uploadclassfile);
// dirs
$sourcedir = dirname(__FILE__).'/src';
$targetdir = dirname(__FILE__).'/cache';
$sizes = array('Generic' => $sizeG,'L' => $sizeL,'M' => $sizeM,'S' => $sizeS,'XL' => $sizeXL,'XS' => $sizeXS);
if ($fhandle = opendir($sourcedir)) {
while (false !== ($entry = readdir($fhandle)))
{
$file = $sourcedir.'/'.$entry;
if (is_file($file))
{
echo '.';
$r = buildImages($file, $targetdir, $sizes, $jpeg_quality);
if ($r === true)
{
echo "File: ".$entry . " SUCCESSFUL\n";
}
else
{
echo "File: ".$entry . " FAIL\n";
echo "Details:\n";
foreach($sizes AS $key => $value)
{
$result = 'Success';
if (array_key_exists($key, $r))
{
$result = 'Failed';
}
echo "Size $key ($value px): ".$result."\n";
}
}
}
}
closedir($fhandle);
}
function buildImages($sourcefile, $targetdir, $sizes, $jpeg_quality=70)
{
$resultsummery = true;
foreach($sizes AS $key => $value)
{
if ($value != 0)
{
$filename = basename($sourcefile,'.jpg');
$targetfile = $targetdir.'/'.$filename.'_'.$key.'.jpg';
if (buildImage($sourcefile, $targetfile, $value) !== true)
{
// Successful
$resultdetails[$key] = true;
}
else
{
// Failed
$resultsummery = false;
$resultdetails[$key] = false;
}
}
}
return $resultsummery ? true : $resultdetails;
}
function buildImage($sourcefile, $targetfile, $size, $jpeg_quality=70)
{
$handle = new Upload($sourcefile);
$savepath = dirname($targetfile);
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $jpeg_quality;
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = basename($targetfile,'.jpg');
$handle->image_x = (int) $size;
return $handle->Process($savepath);
}
  • kelvin
  • kelvin's Avatar
08 Sep 2014 18:55 - 08 Sep 2014 20:19

Tool for importing / exporting items to / from K2

Category: English K2 Community

Individual IT wrote: Hi,
please try not to place the images into the same folder as on the source system. Place them into the tmp folder of joomla and in the CSV file give the path starting from the joomla root without leading slash.
Please check also the documentation www.individual-it.net/en/Instructions-for-K2-Import-Component.html

Afterwards please report if you still have problems.

Thanks a lot. I finally got it working, after i created a menu item for the imported category i noticed my imported items were not showing, i noticed that access level was set to 0 on the CSV file so i changed a few access level on some k2 items in the k2 component and the few i changed showed up on the front page with out issues.
My Question! when editing my other CSV files, in the access level column what value should i set for public access instead of the 0 value? thanks for your patience am almost done!

Solved! i simply changed the value from 0 to 1 in all my exported CSV files. that way they become public on the frontend. This is one plugin i enjoyed working with. thanks!
  • Dominic Danson
  • Dominic Danson's Avatar
08 Sep 2014 11:53
Replied by Dominic Danson on topic Text field in plugin won't save

Text field in plugin won't save

Category: English K2 Community

Hi Mohamed,

Sure:

video.xml:

<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin" group="k2" method="upgrade">
<name>Video Backgroud plugin</name>
<author>Dominic Danson</author>
<creationDate>September 5th, 2014</creationDate>
<version>1.2</version>
<license>www.gnu.org/licenses/gpl-2.0.html GNU/GPL
<description>A plugin to place a video background onto pages.</description>
<files>
<filename plugin="video">video.php</filename>
</files>
<config>
<fields name="params">
<fieldset name="basic">
</fieldset>
</fields>
</config>
<fields group="item-content">
<field name="videoURL" type="textarea" size="60" label="URL to the mp4 source file" description="" />
<field name="image" type="media" directory="images" label="Fallback image" description="" />
</fields>
</extension>

video.php:

<?php
defined('_JEXEC') or die ;

JLoader::register('K2Plugin', JPATH_ADMINISTRATOR.'/components/com_k2/lib/k2plugin.php');

class plgK2Video extends K2Plugin
{

// Some params
var $pluginName = 'video';
var $pluginNameHumanReadable = 'Video Background plugin';

function plgK2Video(&$subject, $params)
{
parent::__construct($subject, $params);
}

function onK2PrepareContent(&$item, &$params, $limitstart)
{
$mainframe = JFactory::getApplication();
//$item->text = 'It works! '.$item->text;
}

function onK2BeforeDisplay(&$item, &$params, $limitstart)
{
$mainframe = JFactory::getApplication();

// Get the output of the K2 plugin fields (the data entered by your site maintainers)
$plugins = new K2Parameter($item->plugins, '', $this->pluginName);

$videoURL = $plugins->get('videoURL');
$image = $plugins->get('image');

// Check if we have a value entered
if (empty($videoURL))
return;

// Output
$output = '
$image
<script>
$(function() {
var BV = new $.BigVideo({container: $("#video-wrap")});
BV.init();
BV.show("'.$videoURL.'", {ambient:true});
BV.getPlayer().on("durationchange",function(){
$("#video-wrap").fadeIn();
});
});
</script>
';

return $output;
}

}


Thanks!
  • Sławomir Kamiński
  • Sławomir Kamiński's Avatar
13 Aug 2014 21:13
Replied by Sławomir Kamiński on topic K2 tag counter (muliticategory substitution)

K2 tag counter (muliticategory substitution)

Category: English K2 Community

Finally I decided to use Tags cloud from K2 tools module. I edited file \modules\mod_k2_tools\tmpl\tags.php so now it looks this way:
<?php /** * @version 2.6.x * @package K2 * @author JoomlaWorks https://www.joomlaworks.net * @copyright Copyright (c) 2006 - 2014 JoomlaWorks Ltd. All rights reserved. * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html */ // no direct access defined('_JEXEC') or die; ?> <?php $colNumber = 0; ?> <div id="k2ModuleBox<?php echo $module->id; ?>" class="k2TagCloudBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>"> <?php foreach ($tags as $tag): ?> <?php if(!empty($tag->tag)): ?> <?php $path = "images/pix/categories/"; // path do 'category' image directory $default_img = $path . "default.png"; // name of picture to display for categories without image dedicated $polishChars = array('ą', 'ć', 'ę', 'ł', 'ń', 'ó', 'ś', 'ż', 'ź'); $replace = array('a', 'c', 'e', 'l', 'n', 'o', 's', 'z', 'z'); $img = mb_strtolower($tag->tag, 'UTF-8'); $img = str_replace($polishChars, $replace, $img); // get rid of polish accents $img = $path . strtolower(str_replace(" ", "_", $img)) . ".png"; // exchange spaces to '_' & make lowercase if (!file_exists($img)) $img = $default_img; ?> <?php if ($colNumber % 3 == 0) echo "<div class=\"singleTagRow\">"; ?> <div class="singleTag"> <a href="<?php echo $tag->link; ?>" style="font-size:<?php echo $tag->size; ?>%" title="<?php echo $tag->count.' '.JText::_('K2_ITEMS_TAGGED_WITH').' '.K2HelperUtilities::cleanHtml($tag->tag); ?>"> <div class="singleTagImg"> <img src="<?php echo $img; ?>"> </div> <div class="singleTagTxt"> <?php echo $tag->tag; ?> (<?php echo $tag->count; ?>) </div> </a> </div> <?php if ($colNumber++ % 3 == 2) echo "</div>"; ?> <?php endif; ?> <?php endforeach; ?> <?php if (($colNumber-1) % 3 !=2) echo "</div>"; ?> <div class="clr"></div> </div> <hr id="companiesListHR">

Playing a bit with template.css file I got result like on screenshot in attachment. If exists an image with the same name as tag name, it's loaded automaticaly. If not, default image is used.

Attachment not found

  • Manos Krokos
  • Manos Krokos's Avatar
09 Aug 2014 11:17
Serving K2 images from a subdomain was created by Manos Krokos

Serving K2 images from a subdomain

Category: English K2 Community

Hello, is it possible to change the path of the /media/k2/items/cache and source from relative to absolute somehow?

I am experimenting with Cookie-free domains and I would like to serve all static content from a subomain. The position of the files remains the same, just their URL will change.

Kind regards,
Manos K
  • Ivan Shilin
  • Ivan Shilin's Avatar
23 Jul 2014 13:28 - 23 Jul 2014 13:29
Replied by Ivan Shilin on topic K2 - css/js problem with .htaccess

K2 - css/js problem with .htaccess

Category: English K2 Community

Yes, i use some derectives from master htaccess protection: docs.joomla.org/Htaccess_examples_%28security%29

No security extensions used by me.

Thx, for fast reply.

Here is the full .htaccess file, failed to put under spoiler sorry:

IndexIgnore *
Options +FollowSymLinks All -Indexes

## Mod_rewrite in use.

RewriteEngine On

########## Begin - File execution order, by Komra.de
DirectoryIndex index.php index.html
########## End - File execution order

## Удаляем .html c конца URL
RewriteRule ^index.html$ / [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} \.html$
RewriteRule ^(.*)\.html$ /$1 [R,L]
## Удаляем .html c конца URL

RewriteCond %{HTTP_HOST} ^mysite\.ru
RewriteRule ^(.*)$ www.mysite.ru/$1 [R=permanent,L]

## Фильтруем кавычки в url
RewriteRule ^(.*) /$1 [R=301,L]
## Фильтруем кавычки в url

## Удаляем слеш с конца урл
RewriteCond %{REQUEST_URI} ^.*/$ [NC]
RewriteCond %{REQUEST_URI} !^/administrator
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
## Удаляем слеш с конца урл

<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php)$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>

########## Begin - Add optional bad user agent or IP blocking code
#
# If you need to block certain user agents or IP addresses and
# other signatures, place that code here. Ensure the rules use
# the correct RewriteRule syntax and the [F] flag.
#
########## End - Add optional bad user agent or IP blocking code

########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
# If the request query string contains /proc/self/environ (by SigSiu.net)
RewriteCond %{QUERY_STRING} proc/self/environ [OR]
# Block out any script trying to set a mosConfig value through the URL
# (these attacks wouldn't work w/out Joomla! 1.5's Legacy Mode plugin)
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode or base64_decode data within the URL
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
########## End - Rewrite rules to block out some common exploits

########## Begin - File injection protection, by SigSiu.net
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]
RewriteRule .* - [F]
########## End - File injection protection

########## Begin - Basic antispam Filter, by SigSiu.net
## I removed some common words, tweak to your liking
## This code uses PCRE and works only with Apache 2.x.
## This code will NOT work with Apache 1.x servers.
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]
## Note: The final RewriteCond must NOT use the [OR] flag.
RewriteRule .* - [F]
## Note: The previous lines are a "compressed" version
## of the filters. You can add your own filters as:
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]
## where "badword" is the word you want to exclude.
########## End - Basic antispam Filter, by SigSiu.net

########## Begin - Advanced server protection - query strings, referrer and config
# Advanced server protection, version 3.2 - May 2011
# by Nicholas K. Dionysopoulos

## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine
## your PHP version). See www.0php.com/php_easter_egg.php and
## osvdb.org/12184 for more information
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]
RewriteRule .* - [F]

## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @
## www.sigsiu.net/presentations/fortifying_your_joomla_website.html
## May cause problems on legitimate requests
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]
RewriteRule .* - [F]

## Referrer filtering for common media files. Replace with your own domain name.
## This blocks most common fingerprinting attacks ;)
## Note: Change www\.example\.com with your own domain name, substituting the
## dots with \. i.e. use www\.example\.com for www.example.com
RewriteRule ^(images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?))$ - [L]
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?mysite\.ru [NC]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [F]

## Disallow visual fingerprinting of Joomla! sites (module position dump)
## Initial idea by Brian Teeman and Ken Crowder, see:
## www.slideshare.net/brianteeman/hidden-joomla-secrets
## Improved by @nikosdion to work more efficiently and handle template
## and tmpl query parameters
RewriteCond %{QUERY_STRING} (^|&)tmpl=(component|system) [NC]
RewriteRule .* - [L]
RewriteCond %{QUERY_STRING} (^|&)t(p|emplate|mpl)= [NC]
RewriteRule .* - [F]

## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]

########## End - Advanced server protection - query strings, referrer and config

########## Begin - Advanced server protection rules exceptions ####
##
## These are sample exceptions to the Advanced Server Protection 3.1
## rule set further down this file.
##
## Allow UddeIM CAPTCHA
##RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]
## Allow Phil Taylor's Turbo Gears
##RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]
## Allow JoomlaWorks AllVideos
##RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]
## Allow Admin Tools Joomla! updater to run
##RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]
## Allow Akeeba Backup Professional's integrated restoration script to run
##RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]
## Allow Akeeba Kickstart
##RewriteRule ^kickstart\.php$ - [L]

# Add more rules to single PHP files here

## Allow Agora attachments, but not PHP files in that directory!
##RewriteCond %{REQUEST_FILENAME} !(\.php)$
##RewriteCond %{REQUEST_FILENAME} -f
##RewriteRule ^components/com_agora/img/members/ - [L]

# Add more rules for allowing full access (except PHP files) on more directories here

## Uncomment to allow full access to the cache directory (strongly not recommended!)
#RewriteRule ^cache/ - [L]
## Uncomment to allow full access to the tmp directory (strongly not recommended!)
#RewriteRule ^tmp/ - [L]

# Add more full access rules here

########## End - Advanced server protection rules exceptions ####

########## Begin - Advanced server protection - paths and files
# Advanced server protection, version 3.2 - May 2011
# by Nicholas K. Dionysopoulos

## Back-end protection
## This also blocks fingerprinting attacks browsing for XML and INI files
RewriteRule ^administrator/?$ - [L]
RewriteRule ^administrator/index\.(php|html?)$ - [L]
RewriteRule ^administrator/index[23]\.php$ - [L]
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|ico|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]
RewriteRule ^administrator/ - [F]

## Explicitly allow access only to XML-RPC's xmlrpc/index.php or plain xmlrpc/ directory
RewriteRule ^xmlrpc/(index\.php)?$ - [L]
RewriteRule ^xmlrpc/ - [F]

## Disallow front-end access for certain Joomla! system directories
RewriteRule ^includes/js/ - [L]
RewriteRule ^(includes|language|libraries|logs|tmp)/ - [F]

## Allow limited access for certain Joomla! system directories with client-accessible content
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|ico|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]
## Uncomment this line if you have extensions which require direct access to their own
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed
## for being so lame, lazy and security unconscious.
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]
## Uncomment the following line if your template requires direct access to PHP files
## inside its directory, e.g. GZip compressed copies of its CSS files
# RewriteRule ^templates/([^/]+/)*([^/.]+\.)+php$ - [L]
RewriteRule ^(components|modules|plugins|templates)/ - [F]

## Disallow access to rogue PHP files throughout the site, unless they are explicitly allowed
RewriteCond %{REQUEST_FILENAME} \.php$
RewriteCond %{REQUEST_FILENAME} !/index[23]?\.php$
## The next line is to explicitly allow the forum post assistant(fpa-xx)script to run
RewriteCond %{REQUEST_FILENAME} !/fpa-[a-z]{2}\.php
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^([^/]+/)*([^/.]+\.)+php$ - [F]

########## End - Advanced server protection - paths and files

########## Begin - Google Apps redirection, by Komra.de
## Uncomment the following line to enable:
# RewriteRule ^mail mail.google.com/a/example.com [R=301,L]
## If the above doesn't work on your server, try this:
## RewriteRule ^mail mail.google.com/a/example.com [R,L]
########## End - Google Apps redirection

########## Begin - Redirect index.php to /
## Note: Change example.com to reflect your own domain name
RewriteCond %{THE_REQUEST} !^POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteCond %{SERVER_PORT}>s ^(443>(s)|[0-9]+>s)$
RewriteRule ^index\.php$ http%2://www.mysite.ru/$1 [R=301,L]
## If the above line throws a 500 error, change [R=301,L] to [R,L]
########## End - Redirect index.php to /

########## Begin - Joomla! core SEF Section
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the request is for the site root, or for an extensionless URL,
# or the requested URL ends with one of the listed extensions
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
########## End - Joomla! core SEF Section

ServerSignature Off

RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]
RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]

RewriteCond %{HTTP_USER_AGENT} ^$ [OR]
RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (<|>|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]

#Block mySQL injects
RewriteCond %{QUERY_STRING} (;|<|>|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]

RewriteCond %{QUERY_STRING} \.\./\.\. [OR]

RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]
RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]
RewriteCond %{QUERY_STRING} (<|>|’|%0A|%0D|%27|%3C|%3E|%00) [NC]
# Note: The final RewriteCond must NOT use the [OR] flag.

# Return 403 Forbidden error.
RewriteRule .* index.php [F]

AddDefaultCharset utf-8

php_value max_execution_time 180
php_value memory_limit 512M

ErrorDocument 404 www.mysite.ru/error404



########## Block bad user agents
## The following list may include bots that no longer exist or are not a problem
## for your site. The list will always be incomplete and it is therefore wise to
## follow discussions on one of the many "security" mailing lists or on a forum
## such as www.webmasterworld.com/search_engine_spiders/
## It is also unwise to rely on this list as your ONLY security mechanism.
RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]
RewriteCond %{HTTP_USER_AGENT} ^Bot\ This email address is being protected from spambots. You need JavaScript enabled to view it. [OR]
RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]
RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]
RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]
RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]
RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]
RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]
RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]
RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]
RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]
RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]
RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]
RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]
RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]
RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]
RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]
RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]
RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]
RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]
RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]
RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]
RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]
RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]
RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]
RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]
RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]
RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]
RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]
RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]
RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]
RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]
RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]
RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]
RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]
RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]
RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]
RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]
RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]
RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]
RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]
RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]
RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]
RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]
RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]
RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]
RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]
RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]
RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]
RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]
RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]
RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]
RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]
RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]
RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]
RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus
## Note: The final RewriteCond must NOT use the [OR] flag.

## Return 403 Forbidden error.
RewriteRule .* - [F]
  • Joseph Rebele
  • Joseph Rebele's Avatar
09 Jul 2014 21:23
File browse on server was created by Joseph Rebele

File browse on server

Category: English K2 Community

Folks,

I have a large number of files that I need to attach to various K2 items. They are all located on our server until public_html/Content/Awards/... I go into a K2 item, click the Attachments tab, click on Add Attachment File, and then " or select a file on the server". The dialog box for the browser opens and it is positioned at /images. I need this to position at the Joomla root. How can I change the default path? Is it possible to use the JCE Editor instead of this elFinder?

Thanks,
Joe
  • Tim Hewison
  • Tim Hewison's Avatar
16 Jun 2014 02:52
Replied by Tim Hewison on topic show email and print icon

show email and print icon

Category: English K2 Community

Paul van Haren wrote: You may want to use the following lines of JS somewhere....

$K2(document).ready(function(){ $K2('.itemPrintLink span').replaceWith('<img src="' + K2SitePath + 'media/system/images/printButton.png" alt="Print">'); $K2('.itemEmailLink span').replaceWith('<img src="' + K2SitePath + 'media/system/images/emailButton.png" alt="Print">'); $K2('.itemEditLink a').html('<img src="' + K2SitePath + 'media/system/images/edit.png" alt="Edit">'); $K2('.itemCommentsLink').html('<img src="' + K2SitePath + 'media/k2/assets/images/system/tick.png" alt="Feedback">'); });

These lines would nicely fit at the bottom of your k2.js files.



Thanks, Paul

Works great! I had some errors with img src path and K2SitePath and just changed lines to read:

replaceWith('<img src="www.yoursite.com/media/system/images/printButton.png" alt="Print"> Print');

The last 'Print' in the line will display the text as well as the icon. If you just want the icon, delete the last 'Print' in the line after the >.
  • จจจจจอออออห์นนนนนน
  • จจจจจอออออห์นนนนนน's Avatar
22 May 2014 11:41 - 22 May 2014 11:43
Replied by จจจจจอออออห์นนนนนน on topic [Problem] K2 Item Images Not Show and Disappear

[Problem] K2 Item Images Not Show and Disappear

Category: English K2 Community

OK I CAN SOLVED this problem. :cheer: THX MY BESTFRIEND :lol:

When I added new item in K2 and I notice image at K2 items in old item I've added is disappear.

In FTP site are stored in two cache folders :
/media/k2/items/cache (all generated sizes for new image I added lastest)
/media/k2/items/cache_ (all generated sizes for old image added)

I solved it by COPY all image file in /media/k2/items/cache_ to /media/k2/items/cache
And refresh website. Image in K2 item bring back to show again.

I think because of path link : http://(my website)/media/k2/items/cache/ (link of image item)
can't link to all generated sizes for old image added.
Cause of folder's name is change to cache_ (I don't know why it change)

B)
  • Individual IT
  • Individual IT's Avatar
13 May 2014 13:39
Replied by Individual IT on topic Tool for importing / exporting items to / from K2

Tool for importing / exporting items to / from K2

Category: English K2 Community

Yes that could be done with some limitations.
The category structure will not be transfered.
Images are exported as path to the file. so you would have to copy them
somewhere you can reach them from the new page and maybe change the path
in the CSV file.
Some minor fields might not be transfered.

It's bad for business but I give you an other idea:
1. make a full backup of both pages
2. update K2 on Joomla 2.5 to the same version as on J3.3
3. export all k2_* tables via phpmyadmin from J2.5
4. import all this tables to J3.3
  • Joseph Rebele
  • Joseph Rebele's Avatar
13 Feb 2014 18:54
Replied by Joseph Rebele on topic [SOLVED] K2 Attachments Path

[SOLVED] K2 Attachments Path

Category: English K2 Community

Yiota,

Thanks for the prompt reply. Now I understand that root folder for attachments. But if you do want to add an attachment using browser server, the default root folder is images/. I would think it would be media/k2/attachments.

Here is my problem. I have over 2,000 documents that I have placed in a folder under $ROOT/Content. I imported the document names into the k2_items_attachments table and have them associated with the proper K2 items. I can look at each of the items and see that the attachments are correct. If you try to download it, it says file does not exist. Is there any way to change the attachments folder location? At the moment, I have all the documents in media/k2/attachments and when I try to download, it says file does not exist. I even tried putting the files in images/ and I still get the error message file does not exist. Any thoughts on what I am doing wrong here?

Thanks,
Joe
  • Bill52
  • Bill52's Avatar
13 Feb 2014 14:58
Replied by Bill52 on topic image-type menu link path is wrong

image-type menu link path is wrong

Category: English K2 Community

Yiota Ziaggou wrote: When you open the browse popup from the menu item you see the path correctly and only in the frontend you see it changed?

Correct.

Yiota Ziaggou wrote: Have you checked in your template folder to see if you have a menu template override?
Check in templates/your_Template/html/ for a mod_menu folder.

Excellent idea, thanks. Unfortunately for me, it's not the case, there is no template override at all.

Meanwhile i installed a new J!3.2.2, added K2, AllVideo and JCE - no problem at all, the menu-item image shows as it should.

Searching for the 'images/stories' path it seems that some JoomlaWorks modules use this as a default path: Simple image Gallery.
www.joomlaworks.net/extensions/free-premium/simple-image-gallery
"... if we have a folder called "my_trip_to_Paris" located in images/stories/my_trip_to_Paris, then we can create our gallery by simply entering the tag {gallery}my_trip_to_Paris{/gallery} ..."
This suggests to me that there is a fixed path to images/stories/.

They also have a similar approach in AllVideos. One just need to enter the YouTube ID to play the video. It must have a hard coded path to YT.

But it needs to be confirmed that this indeed is the problem.

Cheers,

PS: Please use a more readable captcha!
  • felipergueza
  • felipergueza's Avatar
17 Jan 2014 08:28 - 17 Jan 2014 08:32
Replied by felipergueza on topic [SOLVED] Customize front end of K2

[SOLVED] Customize front end of K2

Category: English K2 Community

Thank you for your answer Krikor Boghossian:

I have searched the following path

Componente/com_k2/templates/default/itemform.php
<h2 class="header icon-48-k2">
<? php echo (JRequest :: getInt ('cid'))? JText :: _ ('K2_EDIT_ITEM'): JText :: _ ('K2_ADD_ITEM')>?
</ h2>

I modified to:
<h2 class="header icon-48-k2">
<? php echo (JRequest :: getInt ('cid'))? JText :: _ ('Add Product'): JText :: _ ('Agregar Producto')>?
</ h2>

With this I have managed to solve the problem of the text.[/b

On the other hand I found a solution Antonios Pazarlis k2 forum where he mentions the following to changed
It Should be under:

public_html/sitename/media/k2/assets/images/system

named as K2_Logo and remember to clear your browsers cache Because You Could continue seeing it, as it gets saved in the cache.ar k2 logo on the front end:

On this route I have replaced the three logos I asiganado k2 and joomla logo as an example.

The result was satisfactoriom see pictures.


Attachment not found



Attachment not found

  • Frank van Driel
  • Frank van Driel's Avatar
11 Oct 2013 15:34 - 11 Oct 2013 15:34
Replied by Frank van Driel on topic change K2 item images path

change K2 item images path

Category: English K2 Community

Amy! Did you already found an appropriate solution?

I've got exactly the same problem with MightySites!

Looking forward to your reply.
  • Frank van Driel
  • Frank van Driel's Avatar
27 Sep 2013 14:30
Replied by Frank van Driel on topic Change K2 Image Path - Main website vs sub-domains

Change K2 Image Path - Main website vs sub-domains

Category: English K2 Community

Another way to make this work might to add additional codes components\com_k2\models\item.php. which also write cache images to the /subfolder/media/k2/items/cache?

Who think this will work?
  • Frank van Driel
  • Frank van Driel's Avatar
26 Sep 2013 19:10 - 26 Sep 2013 19:15

Change K2 Image Path - Main website vs sub-domains

Category: English K2 Community

I'm not new to K2 and I know this issue is quite sophisticated. It should be marked as a non-standard question whereas the solution probably needs a core-hack. However, still I wonder whether somebody can help me.

I've got three Joomla websites, one installed at the public_html map, two installed in sub-folders (as sub-domains). With an extension of Alterbrains, I've already successfully managed to handle all K2 items, categories etc. for all three websites in just one database.

Now just one problem exist. The K2 images are placed into media/k2/items/cache, as normal. Images at the sub-folders (sub-domains) are pointed to /subfolder/media/k2/items/cache, however, this maps is empty as a consequence of the shared database.

In my view, for my two sub-domains I need to change to path for K2 images. I want to point the path to the media folder in the public_html, the one of the main website. I already found where to change this: components\com_k2\models\item.php.

Is this possible, if yes, which steps do I need to take?
Displaying 21 - 40 out of 98 results.

Powered by Kunena Forum