Keyword

Advanced Search

Search Results (Searched for: Fatal Error K2)

  • Neal Barnett
  • Neal Barnett's Avatar
30 Aug 2012 14:55
Replied by Neal Barnett on topic Urgent help - Fatal error: Cannot redeclare class

Urgent help - Fatal error: Cannot redeclare class

Category: English K2 Community

Anders wrote: Problem solved.

It was Smart Search - K2" plugin that caused this.

After disabling that plugin everything was working again.



Confirmed - I had the same error and disabling Smart Search solved it.

Is there a fix so that Smart Search can be added back?
  • educnoor
  • educnoor's Avatar
30 Aug 2012 10:14

A problem when create a new catagory this masssag

Category: English K2 Community

Hello there , ;)
i have a problem with k2
The problem when create a new catagory ; show this massage error

Fatal error: Call to undefined function mb_internal_encoding() in /home/public_html/administrator/components/com_k2/tables/k2category.php on line 92


so plz What is the solution ?

:dry:
  • Lefteris
  • Lefteris's Avatar
24 Aug 2012 16:26 - 24 Aug 2012 22:27

Featured Notice and Ratings in Tagged Items List

Category: English K2 Community

Can anyone help me with the proper syntax for adding the Featured notice and the Ratings stars to add to my Tagged item list template I made?

I hoped it might be as easy as pasting in the following from the item.php template
 
  • Pilar Romero
  • Pilar Romero's Avatar
23 Aug 2012 14:56

Problem avec K2:imposible publier plus de 2 items!

Category: Communauté française K2

Bonjour à tous,
après de passer 2 jours à tourner le problème dans tous les sens et regarder dans tous les forums, je me decide à demander de l'aide:

Problème:
Je n'arrive pas à publier plus de 2 items du composant k2 dans un module mod_k2_content;
D'ailleurs, je n'arrive pas à faire tourner plus de 2 items, car, à partir du 3eme item publie dans le composant k2, le 3eme, publié ou pas, ne fonctionne pas, et je m'explique:
1) je crée item 1, item 2 et item 3
2) je publie item 1 et item 2, et ça marche
3) mais, si je publie item 1 et item 3, ça ne marche pas, ou même item 3 tout seul, ne marche pas non plus
(item 3 apparait dans la liste "items" de k2 mais il plante le site, avec le message d'erreur suivant:

Message d'erreur:
Fatal error: Call to a member function init() on a non-object in mondomaineetc/templates/rt_clarion_j15/error.php on line 20

Configuration de mon système:
Version de PHP:5.2.13
Serveur Web:Apache/2
Version de Joomla!: Joomla! 1.5.23 Stable

Alors...une idee?

Merci d'avance,
  • Majid
  • Majid's Avatar
22 Aug 2012 17:53
Replied by Majid on topic K2 menu items don't work

K2 menu items don't work

Category: English K2 Community

I set error reporting to "Maximum", and it is new error:

"Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in /home/.../domains/mashhadsara.com/public_html/libraries/joomla/database/database/mysql.php on line 712"

Now what is the solution?

Thanks again...
  • SlaterT
  • SlaterT's Avatar
20 Aug 2012 19:59
Replied by SlaterT on topic Articles are blank

Articles are blank

Category: English K2 Community

I reinstalled it and now this appears when trying to view an item:

Warning: require_once(/home/eastten1/public_html/home/components/com_mailto/helpers/mailto.php) [function.require-once]: failed to open stream: No such file or directory in /home/eastten1/public_html/home/components/com_k2/views/item/view.html.php on line 244

Fatal error: require_once() [function.require]: Failed opening required '/home/eastten1/public_html/home/components/com_mailto/helpers/mailto.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eastten1/public_html/home/components/com_k2/views/item/view.html.php on line 244


I found another thread on this forum that seemed to somewhat solve the problem. I modified /components/com_k2/views/item/view.html.php at line 244. I commented out the following section:

require_once(JPATH_SITE.DS.'components'.DS.'com_mailto'.DS.'helpers'.DS.'mailto.php');
$item->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&link='.MailToHelper::addLink($item->absoluteURL));

This made the items appear but I cannot email the item. Either way, I just did this as a temporary fix.
  • swedeboy71
  • swedeboy71's Avatar
11 Aug 2012 15:49
Replied by swedeboy71 on topic Urgent help - Fatal error: Cannot redeclare class

Urgent help - Fatal error: Cannot redeclare class

Category: English K2 Community

Problem solved.

It was Smart Search - K2" plugin that caused this.

After disabling that plugin everything was working again.
  • swedeboy71
  • swedeboy71's Avatar
10 Aug 2012 19:34 - 11 Aug 2012 07:29

Urgent help - Fatal error: Cannot redeclare class

Category: English K2 Community

Hello,

Hope someone can help us solve this issue.

When we try to save articles we're getting the following error

Fatal error: Cannot redeclare class K2HelperPermissions in /home/queermag/public_html/components/com_k2/helpers/permissions.php on line 15

This is the reply we got from our host

If in the code you include both of the files then you'll get this error. Essentially, you click save in backend and it goes to a particular php script. That script has includes or requires which take other scripts and include them (to use the code inside of those scripts). The scripts which are included have more includes and requires and so on. The first time you access (include or require) one of the files below the class gets declared. Then at some point another script includes another one of the files and the class tries to declare again which is what causes the error.

components/com_k2/helpers/permissions.j16.php
components/com_k2/helpers/permissions.php
development/components/com_k2/helpers/permissions.j16.php
development/components/com_k2/helpers/permissions.php

This is a programming safety feature so that all classes have to be declared and can only be declared one time.

After that reply we uninstalled the K2 component from our development server.

New response from our host

Yes, I see the two development files gone, but the two which are left are each have a call named K2HelperPermissions. I've looked at the classes and they are very different of one another. I was hoping they were the same so I could simply remove one of them and link the files together.

I've edited administrator/components/com_aceftp/quixplorer/_include/fun_admin.php and changed:

require "./_include/permissions.php";

To:

require_once "./_include/permissions.php";

Does this make any difference?

That didn't help

What can be wrong?

Right now we can't publish or save any articles


System Information

Web Server: Apache
PHP version: 5.3.15
MySQL version: 5.1.63-cll
GD image library: bundled (2.0.34 compatible)
Multibyte string support: Enabled
Upload limit: 20M
Memory limit: 232M
Open remote files (allow url fopen): Yes
  • Vladimír Vaněk
  • Vladimír Vaněk's Avatar
06 Aug 2012 12:20
Error after upgrade to Joomla 2.5 was created by Vladimír Vaněk

Error after upgrade to Joomla 2.5

Category: English K2 Community

Hi i have upgraded my site from J1.5 to the newest via jupgrade... But after that i have problem with my K2 component. On frontend i have blank page with error message

Use of undefined constant K2_CB - assumed 'K2_CB'
Fatal error: Call to a member function userProfileUrl() on a non-object in D:\xampp\htdocs\lochneska\jupgrade\components\com_k2\helpers\route.php on line 45

Really dont know where is problem, i didn´t use Community builder or any additional plugins
  • MAG
  • MAG's Avatar
03 Aug 2012 12:20 - 03 Aug 2012 12:22
Replied by MAG on topic I can't create categories

I can't create categories

Category: English K2 Community

Thanks.

The error reporting shows me this:

Fatal error: Call to undefined function mb_internal_encoding() in /srv/www/######/administrator/components/com_k2/tables/k2category.php on line 92

(##### is the name of my company)
  • webscillabiz
  • webscillabiz's Avatar
27 Jul 2012 11:22
Fatal error: Allowed memory size of was created by webscillabiz

Fatal error: Allowed memory size of

Category: Simple Image Gallery PRO

Hello to All,

I am using SIGPRO from months, but today i tried to upload a gallery into K2 item and this error came back:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 10432 bytes) in /home/knnewsbg/public_html/plugins/content/jw_sigpro/jw_sigpro/includes/helper.php on line 196

Please, help!

Thank you!

Scilla
  • Buldre
  • Buldre's Avatar
23 Jul 2012 22:56
Replied by Buldre on topic Importing over 50k articles breaks K2

Importing over 50k articles breaks K2

Category: English K2 Community

It seems that many websites are having trouble importing content from Joomla to K2, as errors or white page.

I should import a few thousand articles to K2 v2.5.7 from Joomla 2.5.6, but the import function in K2 only managed only two thousand articles before it got error messages and everything stopped.

I consider this as a weakness with K2, "the powerful content extensions for Joomla", which are unable to import articles from the same Joomla installation.

Is there any possibility that JoomlaWorks in the near future improves the import function?

Here is the error message I got:

Notice: Trying to get property of non-object in /home/2/f/xxxxxxx/www/administrator/components/com_k2/models/items.php on line 1024

Notice: Trying to get property of non-object in /home/2/f/xxxxxxx/www/administrator/components/com_k2/models/items.php on line 1024

Notice: Trying to get property of non-object in /home/2/f/xxxxxxx/www/administrator/components/com_k2/models/items.php on line 1024

Fatal error: Maximum execution time of 60 seconds exceeded in /home/2/f/xxxxxxx/www/libraries/joomla/utilities/arrayhelper.php on line 255
  • Tony-K2
  • Tony-K2's Avatar
15 Jul 2012 03:45

Fatal error: Call to undefined function mb_interna

Category: English K2 Community

I have just installed K2 and got the same error:
"Fatal error: Call to undefined function mb_internal_encoding() in …\administrator\components\com_k2\tables\k2category.php on line 92"

The problem is in the php.ini file;
go to: …/php/pgp.ini and open the file in the editor; locate the following line:

; extension=php_mbstring.dll

un-comment it – delete the “;” something like this.

extension=php_mbstring.dll ; Tony-K2 uncommented 7/14/2012

Exit - save the file.
This may require restarting your server Apache.
If you’re on local server you can do this:
  • Windows -> Control Panel -> Administrative Tools - > Services
  • Select
the Apache service and click – Restart.

Go to Joomla-K2 and try to import, should be working.
Let me know if this helped! :)

God bless,
Tony-K2
  • william white
  • william white's Avatar
11 Jul 2012 11:00
Replied by william white on topic Fatal error: Call to undefined function mb_interna

Fatal error: Call to undefined function mb_interna

Category: English K2 Community

Check your K2 information tab and see if mb string is enabled on your server.
  • robert
  • robert's Avatar
11 Jul 2012 08:32

Fatal error: Call to undefined function mb_interna

Category: English K2 Community

when editing any K2 items i am getting this error.

Fatal error: Call to undefined function mb_internal_encoding() in E:\domains\p\penman.co.uk\user\htdocs\administrator\components\com_k2\tables\k2item.php on line 80


now the sites live and i can see that it is trying to point to E:\ but i am not sure how you change this

any ideas?

thanks
  • Jerry
  • Jerry's Avatar
10 Jul 2012 20:48
Replied by Jerry on topic 404 on new K2 item

404 on new K2 item

Category: English K2 Community

Lefteris Kavadas wrote: Hi. Please ensure that the user who is clicking the link is logged in and belongs to a K2 group that have the appropriate permissions.


Ah, that's something else... I haven't made any K2 User Groups yet. Didn't realize that was necessary.

And it works! :) Unfortunately, Next thing I get is this:

Fatal error: Call to a member function get() on a non-object in /home/MYNAME/domains/MYNAME.MYSERVER/public_html/olv/components/com_k2fields/helpers/utility.php on line 95

k2fields installed but not used yet. Anyway, the original problem has been solved, thanks!!
  • iChris
  • iChris's Avatar
06 Jul 2012 17:42 - 06 Jul 2012 18:07
Hello ! K2 Error + blank page was created by iChris

Hello ! K2 Error + blank page

Category: English K2 Community

[SOLVED]

Hello,

Christian, from Belgium. I use K2 for a long time, it is the only good free tool to manage an item. Thank you!

I would contact you because I have a problem with K2.

I develop a Joomla extension that I want the system compatible with K2, because I think your brilliant concept!

Articles must be imported into K2 from an external source.

Currently, the import completes successfully but in FRONTEND, I get this error: "Fatal error: Call to undefined method K2ModelItem :: getUserProfile () in / home/www/fashion/components/com_k2/helpers/utilities.php it line 63 "and a blank page.

I use the class ". ModelItem :: save" slightly modified. (Item entire model is imported into the extension).
In the database, everything seems OK (I compared with native recording) FRONTEND but nothing works.

Could you help me and tell me what I missed please?

Thanking you in advance.

Here k2 modified class I use:

function save($front = false, $toStore)
{

$mainframe = &JFactory::getApplication();
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.archive');
require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'lib'.DS.'class.upload.php');
$db = &JFactory::getDBO();
$user = &JFactory::getUser();
$row = &JTable::getInstance('K2Item', 'Table');
$params = &JComponentHelper::getParams('com_k2');
$nullDate = $db->getNullDate();
define( 'K2_JVERSION', '16' );
$jpath = JPATH_SITE.DS.'components'.DS.'com_k2';
define( 'JPATH_COMPONENT', $jpath );

if (!$row->bind($toStore))
{
$mainframe->redirect('index.php?option=com_k2&view=items', $row->getError(), 'error');
}

if ($front && $row->id == NULL)
{
JLoader::register('K2HelperPermissions', JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'permissions.php');
if (!K2HelperPermissions::canAddItem($row->catid))
{
$mainframe->redirect('index.php?option=com_k2&view=item&task=add&tmpl=component', JText::_('K2_YOU_ARE_NOT_ALLOWED_TO_POST_TO_THIS_CATEGORY_SAVE_FAILED'), 'error');
}
}

($row->id) ? $isNew = false : $isNew = true;

if ($params->get('mergeEditors'))
{
$text = $row->introtext;
if ($params->get('xssFiltering'))
{
$filter = new JFilterInput( array(), array(), 1, 1, 0);
$text = $filter->clean($text);
}
$pattern = '#<hr\s+id=("|\')system-readmore("|\')\s*\/*>#i';
$tagPos = preg_match($pattern, $text);
if ($tagPos == 0)
{
$row->introtext = $text;
$row->fulltext = '';
}
else
list($row->introtext, $row->fulltext) = preg_split($pattern, $text, 2);
}
else
{
$row->introtext = JRequest::getVar('introtext', '', 'post', 'string', 2);
$row->fulltext = JRequest::getVar('fulltext', '', 'post', 'string', 2);
if ($params->get('xssFiltering'))
{
$filter = new JFilterInput( array(), array(), 1, 1, 0);
$row->introtext = $filter->clean($row->introtext);
$row->fulltext = $filter->clean($row->fulltext);
}
}

if ($row->id)
{
$datenow = &JFactory::getDate();
$row->modified = $datenow->toMySQL();
$row->modified_by = $user->get('id');
}
else
{
$row->ordering = $row->getNextOrder("catid = {$row->catid} AND trash = 0");
if ($row->featured)
$row->featured_ordering = $row->getNextOrder("featured = 1 AND trash = 0", 'featured_ordering');
}

$row->created_by = $row->created_by ? $row->created_by : $user->get('id');

if ($front)
{
$K2Permissions = &K2Permissions::getInstance();
if (!$K2Permissions->permissions->get('editAll'))
{
$row->created_by = $user->get('id');
}
}

if ($row->created && strlen(trim($row->created)) <= 10)
{
$row->created .= ' 00:00:00';
}

$config = &JFactory::getConfig();
$tzoffset = $config->getValue('config.offset');
$date = &JFactory::getDate($row->created, $tzoffset);
$row->created = $date->toMySQL();

if (strlen(trim($row->publish_up)) <= 10)
{
$row->publish_up .= ' 00:00:00';
}

$date = &JFactory::getDate($row->publish_up, $tzoffset);
$row->publish_up = $date->toMySQL();

if (trim($row->publish_down) == JText::_('K2_NEVER') || trim($row->publish_down) == '')
{
$row->publish_down = $nullDate;
}
else
{
if (strlen(trim($row->publish_down)) <= 10)
{
$row->publish_down .= ' 00:00:00';
}
$date = &JFactory::getDate($row->publish_down, $tzoffset);
$row->publish_down = $date->toMySQL();
}

$metadata = JRequest::getVar('meta', null, 'post', 'array');
if (is_array($metadata))
{
$txt = array();
foreach ($metadata as $k => $v)
{
if ($k == 'description')
{
$row->metadesc = $v;
}
elseif ($k == 'keywords')
{
$row->metakey = $v;
}
else
{
$txt[] = "$k=$v";
}
}
$row->metadata = implode("\n", $txt);
}

if (!$row->check())
{
$mainframe->redirect('index.php?option=com_k2&view=item&cid='.$row->id, $row->getError(), 'error');
}

$dispatcher = &JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$result = $dispatcher->trigger('onBeforeK2Save', array(&$row, $isNew));
if (in_array(false, $result, true))
{
JError::raiseError(500, $row->getError());
return false;
}

//Trigger the finder before save event
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('finder');
$results = $dispatcher->trigger('onFinderBeforeSave', array('com_k2.item', $row, $isNew));

// Try to save the video if there is no need to wait for item ID
if (!JRequest::getBool('del_video'))
{
if (!isset($files))
{

if (JRequest::getVar('remoteVideo'))
{
$fileurl = JRequest::getVar('remoteVideo');
$filetype = JFile::getExt($fileurl);
$row->video = '{'.$filetype.'remote}'.$fileurl.'{/'.$filetype.'remote}';
}

if (JRequest::getVar('videoID'))
{
$provider = JRequest::getWord('videoProvider');
$videoID = JRequest::getVar('videoID');
$row->video = '{'.$provider.'}'.$videoID.'{/'.$provider.'}';
}

if (JRequest::getVar('embedVideo', '', 'post', 'string', JREQUEST_ALLOWRAW))
{
$row->video = JRequest::getVar('embedVideo', '', 'post', 'string', JREQUEST_ALLOWRAW);
}
}
}

// JoomFish! Front-end editing compatibility
if ($mainframe->isSite() && JFile::exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_joomfish'.DS.'joomfish.php'))
{
if (version_compare(phpversion(), '5.0') < 0)
{
$tmpRow = $row;
}
else
{
$tmpRow = clone($row);
}
}

if (!$row->store())
{
$mainframe->redirect('index.php?option=com_k2&view=items', $row->getError(), 'error');
}

// JoomFish! Front-end editing compatibility
if ($mainframe->isSite() && JFile::exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_joomfish'.DS.'joomfish.php'))
{
$itemID = $row->id;
$row = $tmpRow;
$row->id = $itemID;
}

if (!$params->get('disableCompactOrdering'))
{
$row->reorder("catid = {$row->catid} AND trash = 0");
}
if ($row->featured && !$params->get('disableCompactOrdering'))
{
$row->reorder("featured = 1 AND trash = 0", 'featured_ordering');
}
$files = JRequest::get('files');

//Image
if ((int)$params->get('imageMemoryLimit'))
{
ini_set('memory_limit', (int)$params->get('imageMemoryLimit').'M');
}
$existingImage = JRequest::getVar('existingImage');
if (($files === 0 || $existingImage) && !JRequest::getBool('del_image'))
{

if ($files === 0)
{
$image = $files;
}
else
{
$image = JPATH_SITE.DS.JPath::clean($existingImage);
}

$handle = new Upload($image);
$handle->allowed = array('image/*');

if ($handle->uploaded)
{

//Image params
$category = &JTable::getInstance('K2Category', 'Table');
$category->load($row->catid);
$cparams = new JParameter($category->params);

if ($cparams->get('inheritFrom'))
{
$masterCategoryID = $cparams->get('inheritFrom');
$query = "SELECT * FROM #__k2_categories WHERE id=".(int)$masterCategoryID;
$db->setQuery($query, 0, 1);
$masterCategory = $db->loadObject();
$cparams = new JParameter($masterCategory->params);
}

$params->merge($cparams);

//Original image
$savepath = JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'src';
$handle->image_convert = 'jpg';
$handle->jpeg_quality = 100;
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = md5("Image".$row->id);
$handle->Process($savepath);

$filename = $handle->file_dst_name_body;
$savepath = JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache';

//XLarge image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_XL';
if (JRequest::getInt('itemImageXL'))
{
$imageWidth = JRequest::getInt('itemImageXL');
}
else
{
$imageWidth = $params->get('itemImageXL', '800');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);

//Large image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_L';
if (JRequest::getInt('itemImageL'))
{
$imageWidth = JRequest::getInt('itemImageL');
}
else
{
$imageWidth = $params->get('itemImageL', '600');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);

//Medium image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_M';
if (JRequest::getInt('itemImageM'))
{
$imageWidth = JRequest::getInt('itemImageM');
}
else
{
$imageWidth = $params->get('itemImageM', '400');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);

//Small image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_S';
if (JRequest::getInt('itemImageS'))
{
$imageWidth = JRequest::getInt('itemImageS');
}
else
{
$imageWidth = $params->get('itemImageS', '200');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);

//XSmall image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_XS';
if (JRequest::getInt('itemImageXS'))
{
$imageWidth = JRequest::getInt('itemImageXS');
}
else
{
$imageWidth = $params->get('itemImageXS', '100');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);

//Generic image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_Generic';
$imageWidth = $params->get('itemImageGeneric', '300');
$handle->image_x = $imageWidth;
$handle->Process($savepath);

if ($files === 0)
$handle->Clean();

}
else
{
$mainframe->redirect('index.php?option=com_k2&view=items', $handle->error, 'error');
}

}

if (JRequest::getBool('del_image'))
{

$current = &JTable::getInstance('K2Item', 'Table');
$current->load($row->id);
$filename = md5("Image".$current->id);

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'src'.DS.$filename.'.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'src'.DS.$filename.'.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_XS.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_XS.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_S.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_S.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_M.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_M.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_L.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_L.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_XL.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_XL.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_Generic.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_Generic.jpg');
}

$row->image_caption = '';
$row->image_credits = '';

}

//Attachments
$attachments = JRequest::getVar('attachment_file', NULL, 'FILES', 'array');
$attachments_names = JRequest::getVar('attachment_name', '', 'POST', 'array');
$attachments_titles = JRequest::getVar('attachment_title', '', 'POST', 'array');
$attachments_title_attributes = JRequest::getVar('attachment_title_attribute', '', 'POST', 'array');
$attachments_existing_files = JRequest::getVar('attachment_existing_file', '', 'POST', 'array');

$attachmentFiles = array();

if (count($attachments))
{

foreach ($attachments as $k => $l)
{
foreach ($l as $i => $v)
{
if (!array_key_exists($i, $attachmentFiles))
$attachmentFiles[$i] = array();
$attachmentFiles[$i][$k] = $v;
}

}

$path = $params->get('attachmentsFolder', NULL);
if (is_null($path))
{
$savepath = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'attachments';
}
else
{
$savepath = $path;
}

$counter = 0;

foreach ($attachmentFiles as $key => $file)
{

if ($file["tmp_name"] || $attachments_existing_files[$key])
{

$attachmentCleanUpFlag = true;

if ($attachments_existing_files[$key])
{
$file = JPATH_SITE.DS.JPath::clean($attachments_existing_files[$key]);
$attachmentCleanUpFlag = false;
}

$handle = new Upload($file);

if ($handle->uploaded)
{
$handle->file_auto_rename = true;
$handle->allowed[] = 'application/x-zip';
$handle->allowed[] = 'application/download';
$handle->Process($savepath);
$filename = $handle->file_dst_name;
if ($attachmentCleanUpFlag)
{
$handle->Clean();
}

$attachment = &JTable::getInstance('K2Attachment', 'Table');
$attachment->itemID = $row->id;
$attachment->filename = $filename;
$attachment->title = ( empty($attachments_titles[$counter])) ? $filename : $attachments_titles[$counter];
$attachment->titleAttribute = ( empty($attachments_title_attributes[$counter])) ? $filename : $attachments_title_attributes[$counter];
$attachment->store();
}
else
{
$mainframe->redirect('index.php?option=com_k2&view=items', $handle->error, 'error');
}
}

$counter++;
}

}

//Gallery
$flickrGallery = JRequest::getVar('flickrGallery');
if ($flickrGallery)
{
$row->gallery = '{gallery}'.$flickrGallery.'{/gallery}';
}

if (isset($files) && $files == 0 && !JRequest::getBool('del_gallery'))
{
$handle = new Upload($files);
$handle->file_auto_rename = true;
$savepath = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'galleries';
$handle->allowed = array("application/download", "application/rar", "application/x-rar-compressed", "application/arj", "application/gnutar", "application/x-bzip", "application/x-bzip2", "application/x-compressed", "application/x-gzip", "application/x-zip-compressed", "application/zip", "multipart/x-zip", "multipart/x-gzip", "application/x-unknown", "application/x-zip");

if ($handle->uploaded)
{

$handle->Process($savepath);
$handle->Clean();

if (JFolder::exists($savepath.DS.$row->id))
{
JFolder::delete($savepath.DS.$row->id);
}

if (!JArchive::extract($savepath.DS.$handle->file_dst_name, $savepath.DS.$row->id))
{
$mainframe->redirect('index.php?option=com_k2&view=items', JText::_('K2_GALLERY_UPLOAD_ERROR_CANNOT_EXTRACT_ARCHIVE'), 'error');
}
else
{
$row->gallery = '{gallery}'.$row->id.'{/gallery}';
}
JFile::delete($savepath.DS.$handle->file_dst_name);
$handle->Clean();

}
else
{
$mainframe->redirect('index.php?option=com_k2&view=items', $handle->error, 'error');
}
}

if (JRequest::getBool('del_gallery'))
{

$current = &JTable::getInstance('K2Item', 'Table');
$current->load($row->id);

if (JFolder::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'galleries'.DS.$current->id))
{
JFolder::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'galleries'.DS.$current->id);
}
$row->gallery = '';
}

//Video
if (!JRequest::getBool('del_video'))
{
if (isset($files) && $files == 0)
{

$videoExtensions = array("flv", "mp4", "ogv", "webm", "f4v", "m4v", "3gp", "3g2", "mov", "mpeg", "mpg", "avi", "wmv", "divx");
$audioExtensions = array("mp3", "aac", "m4a", "ogg", "wma");
$validExtensions = array_merge($videoExtensions, $audioExtensions);
$filetype = JFile::getExt($files);

if (!in_array($filetype, $validExtensions))
{
$mainframe->redirect('index.php?option=com_k2&view=items', JText::_('K2_INVALID_VIDEO_FILE'), 'error');
}

if (in_array($filetype, $videoExtensions))
{
$savepath = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'videos';
}
else
{
$savepath = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'audio';
}

$filename = JFile::stripExt($files);

JFile::upload($files, $savepath.DS.$row->id.'.'.$filetype);
$filetype = JFile::getExt($files);
$row->video = '{'.$filetype.'}'.$row->id.'{/'.$filetype.'}';

}

}
else
{

$current = &JTable::getInstance('K2Item', 'Table');
$current->load($row->id);

preg_match_all("#^{(.*?)}(.*?){#", $current->video, $matches, PREG_PATTERN_ORDER);
$videotype = $matches[1][0];
$videofile = $matches[2][0];

if (in_array($videotype, $videoExtensions))
{
if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'videos'.DS.$videofile.'.'.$videotype))
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'videos'.DS.$videofile.'.'.$videotype);
}

if (in_array($videotype, $audioExtensions))
{
if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'audio'.DS.$videofile.'.'.$videotype))
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'audio'.DS.$videofile.'.'.$videotype);
}

$row->video = '';
$row->video_caption = '';
$row->video_credits = '';
}

//Extra fields
$objects = array();
$variables = JRequest::get('post', 4);
foreach ($variables as $key => $value)
{
if (( bool )JString::stristr($key, 'K2ExtraField_'))
{
$object = new JObject;
$object->set('id', JString::substr($key, 13));
$object->set('value', $value);
unset($object->_errors);
$objects[] = $object;
}
}

$csvFiles = JRequest::get('files');
foreach ($csvFiles as $key => $file)
{
if (( bool )JString::stristr($key, 'K2ExtraField_'))
{
$object = new JObject;
$object->set('id', JString::substr($key, 13));
$csvFile = $file[0];
if (!empty($csvFile) && JFile::getExt($file[0]) == 'csv')
{
$handle = @fopen($csvFile, 'r');
$csvData = array();
while (($data = fgetcsv($handle, 1000)) !== FALSE)
{
$csvData[] = $data;
}
fclose($handle);
$object->set('value', $csvData);
}
else
{
require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'lib'.DS.'JSON.php');
$json = new Services_JSON;
$object->set('value', $json->decode(JRequest::getVar('K2CSV_'.$object->id)));
if (JRequest::getBool('K2ResetCSV_'.$object->id))
$object->set('value', null);
}
unset($object->_errors);
$objects[] = $object;
}
}

require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'lib'.DS.'JSON.php');
$json = new Services_JSON;
$row->extra_fields = $json->encode($objects);

require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'models'.DS.'extrafield.php');
$extraFieldModel = new K2ModelExtraField;
$row->extra_fields_search = '';

foreach ($objects as $object)
{
$row->extra_fields_search .= $extraFieldModel->getSearchValue($object->id, $object->value);
$row->extra_fields_search .= ' ';
}

//Tags
if ($user->gid < 24 && $params->get('lockTags'))
$params->set('taggingSystem', 0);
$db = &JFactory::getDBO();
$query = "DELETE FROM #__k2_tags_xref WHERE itemID={intval($row->id)}";
$db->setQuery($query);
$db->query();

if ($params->get('taggingSystem'))
{

if ($user->gid < 24 && $params->get('lockTags'))
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));

$tags = JRequest::getVar('tags', NULL, 'POST', 'array');
if (count($tags))
{
$tags = array_unique($tags);
foreach ($tags as $tag)
{
$tag = str_replace('-', '', $tag);
$query = "SELECT id FROM #__k2_tags WHERE name=".$db->Quote($tag);
$db->setQuery($query);
$tagID = $db->loadResult();
if ($tagID)
{
$query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {intval($tagID)}, {intval($row->id)})";
$db->setQuery($query);
$db->query();
}
else
{
$K2Tag = &JTable::getInstance('K2Tag', 'Table');
$K2Tag->name = $tag;
$K2Tag->published = 1;
$K2Tag->check();
$K2Tag->store();
$query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {intval($K2Tag->id)}, {intval($row->id)})";
$db->setQuery($query);
$db->query();
}
}
}

}
else
{
$tags = JRequest::getVar('selectedTags', NULL, 'POST', 'array');
if (count($tags))
{
foreach ($tags as $tagID)
{
$query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {intval($tagID)}, {intval($row->id)})";
$db->setQuery($query);
$db->query();
}
}

}

if ($front)
{
if (!K2HelperPermissions::canPublishItem($row->catid) && $row->published)
{
$row->published = 0;
$mainframe->enqueueMessage(JText::_('K2_YOU_DONT_HAVE_THE_PERMISSION_TO_PUBLISH_ITEMS'), 'notice');
}
}

$query = "UPDATE #__k2_items SET
video_caption = ".$db->Quote($row->video_caption).",
video_credits = ".$db->Quote($row->video_credits).", ";

if (!is_null($row->video))
{
$query .= " video = ".$db->Quote($row->video).", ";
}
if (!is_null($row->gallery))
{
$query .= " gallery = ".$db->Quote($row->gallery).", ";
}
$query .= " extra_fields = ".$db->Quote($row->extra_fields).",
extra_fields_search = ".$db->Quote($row->extra_fields_search)." ,
published = ".$db->Quote($row->published)."
WHERE id = ".$row->id;
$db->setQuery($query);

if (!$db->query())
{
$mainframe->redirect('index.php?option=com_k2&view=items', $db->getErrorMsg(), 'error');
}

$row->checkin();

$cache = &JFactory::getCache('com_k2');
$cache->clean();

$dispatcher->trigger('onAfterK2Save', array(&$row, $isNew));
if (K2_JVERSION == '16')
{
$dispatcher->trigger('onContentAfterSave', array(&$row, $isNew));
}
else
{
$dispatcher->trigger('onAfterContentSave', array(&$row, $isNew));
}

//Trigger the finder after save event
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('finder');
$results = $dispatcher->trigger('onFinderAfterSave', array('com_k2.item', $row, $isNew));

switch (JRequest::getCmd('task'))
{
case 'apply' :
$msg = JText::_('K2_CHANGES_TO_ITEM_SAVED');
$link = 'index.php?option=com_k2&view=item&cid='.$row->id;
break;
case 'saveAndNew' :
$msg = JText::_('K2_ITEM_SAVED');
$link = 'index.php?option=com_k2&view=item';
break;
case 'save' :
default :
$msg = JText::_('K2_ITEM_SAVED');
if ($front)
$link = 'index.php?option=com_k2&view=item&task=edit&cid='.$row->id.'&tmpl=component&Itemid='.JRequest::getInt('Itemid');
else
$link = 'index.php?option=com_k2&view=items';
break;
}
return $row->id;
}

  • Uldis
  • Uldis's Avatar
06 Jul 2012 07:25
Replied by Uldis on topic problems with category submenu

problems with category submenu

Category: English K2 Community

I found this code
 
  • sd12013
  • sd12013's Avatar
05 Jul 2012 21:58 - 05 Jul 2012 22:45
Replied by sd12013 on topic File and FOlder Permission Settings

File and FOlder Permission Settings

Category: English K2 Community

Fatal error: Call to undefined function mb_internal_encoding() in [my server address]/components/com_k2/tables/k2category.php on line 80

I tried uninstalling K2 and re-installing but when I try to create a category, I get:
Fatal error: Call to undefined function mb_internal_encoding() in [my server address]/components/com_k2/tables/k2category.php on line 92


**edit**
I noticed in another similar thread that someone pointed out Multibyte string support had to be enabled. Mine is not. I'm also not sure from the thread if after multibyte string support was enabled the issue was solved. My K2 information panel says Multibyte string support is disabled and if I check phpinfo.php I show something called Zend Multibyte Support. Is that the same thing?
  • sd12013
  • sd12013's Avatar
02 Jul 2012 18:03
File and FOlder Permission Settings was created by sd12013

File and FOlder Permission Settings

Category: English K2 Community

My host took it upon themselves to change the permission settings on my site so now I can no longer create a new item or category without a fatal error.

Is there a list of what permission settings are needed for K2 to function properly?
Displaying 721 - 740 out of 1119 results.