Error loading component com.cck on joomla 2.5 - joomla

Whenever i try to add an article from frontend i get the error as written in the subject. I login as author, Textfilters are set to no filtering.
I have also tried to log in as admin - same error.
I receive a message and the article is there but it is not that pretty to have an error message when trying to add articles.
Joomla version 2.5.4 - all should be updated.
What could be the problem?
Thanks

Remove Seblod function if you are not using Seblod CCK Component.
Find file: modules\mod_news_pro_gk4\gk_classes\gk_utils.php
Find & Remove Lines 17 to 27 which is below.
//
$cck_path = JPATH_BASE . DS . 'components' . DS . 'com_cck';
if (file_exists($cck_path)) {
if(JComponentHelper::isEnabled('com_cck', true)){
// Force parsing plugin if SEBLOD is used
if($this->config['parse_plugins'] == FALSE) {
$text = JHtml::_('content.prepare', $text);
}
$text = trim(substr(strip_tags( $text,"<br /><br><strong></strong><p></p><i></i><b></b><span></span><ul></ul><li></li><blockquote></blockquote>"),0));
}
}

Related

JApplicationCli Cronjob

I have the following script:
// Initialize Joomla framework
const _JEXEC = 1;
// Load system defines
if (file_exists(dirname(__DIR__) . '/defines.php'))
{
require_once dirname(__DIR__) . '/defines.php';
}
if (!defined('_JDEFINES'))
{
define('JPATH_BASE', dirname(__DIR__));
require_once JPATH_BASE . '/includes/defines.php';
}
// Get the framework.
require_once JPATH_LIBRARIES . '/import.legacy.php';
// Bootstrap the CMS libraries.
require_once JPATH_LIBRARIES . '/cms.php';
/**
* Cron job to trash expired cache data.
*
* #since 2.5
*/
class DoCron extends JApplicationCli
{
public function doExecute()
{
echo 'ok3';
$this->out('Fetching updates...');
}
}
JApplicationCli::getInstance('DoCron')->execute();
I have added this in CPanel with a Cronjob and get the results of excecution by e-mail.
Now I hoped for an e-mail with 'ok3' or 'Fetching updates...' but none of that all. I do get an e-mail but it is an reference to php excecution.
When I add an 'echo ok' tag right before:
JApplicationCli::getInstance('DoCron')->execute();
I get that 'ok' as a result in the e-mail.
Any thoughts on what goes wrong here? The script is based on general scripts coming with joomla 3.6.5. Those scripts also give no result.
I had the same problem. It turns out that the default php binary for most hosts is the PHP CGI. Running under PHP CGI results in no stdout, stderr and stdin which is why you are not seeing the correct output.
Instead, check your CPanel documentation and look for the CLI version of PHP. It is most likely called php-cli. For example, I had to run a cron job for a Joomla CLI app and found the following to work:
/usr/bin/php-cli /path/to/joomla/cli/my-cli -a b -c d --verbose

Render Partial TemplateView in Typo3 using Extbase

I want to lazy load several PartialTemplates in an Extbase Controller via Ajax.
Therefore I found the following script to render only a Partials but it doesn't work in my context:
private function renderPartial($partialName='', $data = array()){
if($partialName==''){
throw new \TYPO3\CMS\Extbase\Mvc\Exception\RequiredArgumentMissingException('The Partial name must be defined.', 123456789);
}
$this->templateView = $this->objectManager->create('TYPO3\CMS\Fluid\View\TemplateView');
$res = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->controllerContext->getRequest()->getControllerExtensionKey()) . 'Resources/Private/';
$this->templateView->setLayoutRootPath($res);
$this->templateView->setPartialRootPath($res . 'Partials/');
$this->templateView->setRenderingContext($this->objectManager->create('TYPO3\CMS\Fluid\Core\Rendering\RenderingContext'));
$this->templateView->setControllerContext($this->controllerContext);
return $this->templateView->renderPartial($partialName, Null, $data);
}
This results in the following Error:
Fatal error: __clone method called on non-object in /var/www/html/typo3_src-7.6.0/typo3/sysext/fluid/Classes/View/AbstractTemplateView.php on line 281
I Goolge for this and found many posts having the same problem. What can I do to make this working. A workaround using the StandaloneView and setTemplatePathAndFilename() works well. Is it possible to use Partial without a Layout/Section?
EDIT:
I added some debug Informations and the Controller Action...
public function searchAction(\PCON\Avm\Domain\Model\DemandSearch $demandSearch = NULL) {
//GlobalSearch
if($demandSearch != NULL) {
$searchResult = $this->demandSearchRepository->findDemanded($demandSearch);
$this->view->assign('searchResult', $searchResult);
}
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->controllerContext);
$this->templateView = $this->objectManager->get('TYPO3\\CMS\\Fluid\\View\\TemplateView');
$res = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->controllerContext->getRequest()->getControllerExtensionKey()) . 'Resources/Private/';
$this->templateView->setLayoutRootPath($res);
$this->templateView->setPartialRootPath($res . 'Partials/');
$this->templateView->setRenderingContext($this->objectManager->get('TYPO3\\CMS\\Fluid\\Core\\Rendering\\RenderingContext'));
$this->templateView->setControllerContext($this->controllerContext);
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($this->templateView);
return $this->templateView->renderPartial('Search/SearchForm.html', Null, array('searchResult'=>$searchResult));
}
I do not think that this is a AJAX Problem (definded by PageNum).
If I call the controller Action without AJAX the same error appears ...
You can't use renderPartial() oder renderSection() from extbase/php in StandaloneView. It's a missing feature that will probably not be implemented in TYPO3 7.6 and below. See this task: https://forge.typo3.org/issues/54509
However, you can use partials and sections in Fluid. Just assign your variables, then render your template with
$this->templateView->render();
And use partials and section in your Fluid template.

CodeIgniter set_message()

When I am trying to set the custom message for an error under from_validation library in CodeIgniter using the following statement..
$this->form_validation->set_message("is_unique", "%s already registered. Try a different %s");
Instead of getting Username already registered. Try a different Username I'm getting Username already registered. Try a different users.username
While the documentation says If you include %s in your error string, it will be replaced with the "human" name you used for your field when you set your rules.
Please get me out of the trap.
Looking at your problem it seems that the language file you are using does not have an index user.username. Define it in the user language file and see what happens.
Here is the Reference to language
Codeigniter Language Class
And
Codeigntier Language Helper
I faced same problem , while i am searching i found this answer which mentioned the line in Codeigniter that builds the error message (located in file system/libraries/form_validation.php) near line 673:
// Build the error message
$message = sprintf($line, $this->_translate_fieldname($row['label']), $param);
I edited it to :
// Build the error message
if($rule == 'is_unique') { //my code here
$vars_num = substr_count($line, '%s'); //my code here
for($i = 0; $i < $vars_num; $i++){ //my code here
$params[] = $this->_translate_fieldname($row['label']); //my code here
} //my code here
$message = vsprintf($line, $params); //my code here
} else { //my code here
$message = sprintf($line, $this->_translate_fieldname($row['label']), $param);
}
and it works fine for me .
i know it is not best practice to edit system libraries but maybe it will help you.
Try this:
$this->form_validation->set_message("is_unique", "{field} already registered. Try a different {field}");
You can set Custom Message with Message library of codigniter
For Example
in Model Coding Like this
if(duplicate_user_name ==true){
$this->messages->add('$user already registered. Try a different $user ', 'error');
}
and Print this message with following View
$messages = $this->messages->get();
if (is_array($messages)):
foreach ($messages as $type => $msgs):
if (count($msgs > 0)):
foreach ($msgs as $message):
echo ('<div class="' . $type .'">' . $message . '</div>');
endforeach;
endif;
endforeach;
endif;

Loading and using models in opencart

Open cart is based on CodeIgniter as I understand but in CodeIgniter to load and use the model you do something like this
$this->load->model('Model_name');
$this->Model_name->function();
In OpenCart you do something like this
$this->load->model('catalog/product');
$this->model_catalog_product->getTotalProducts()
How does this work and where does the "model_catalog_product" come from?
It seems like they have 0 developer documentation besides their forums.
OpenCart's loader class seems to be inspired by CodeIgniter, but it's not based on it. You can look into the source of OpenCart, see file system/engine/loader.php (Line 39).
public function model($model) {
$file = DIR_APPLICATION . 'model/' . $model . '.php';
$class = 'Model' . preg_replace('/[^a-zA-Z0-9]/', '', $model);
if (file_exists($file)) {
include_once($file);
// Right here. Replaces slash by underscore.
$this->registry->set('model_' . str_replace('/', '_', $model), new $class($this->registry));
} else {
trigger_error('Error: Could not load model ' . $model . '!');
exit();
}
}
You can clearly see that it replaces slashes with underscores and append 'model_' before the model's name. That's why you end up with model_catalog_product.
The model_catalog_product comes from the path folder structure and file name within the model folder, so model_catalog_product is the model/catalog/product.php file, with the extension removed and the slashes changed to underscores. Also, notice that the model class name also refers to a similar structure, which is ModelCatalogProduct. As for the documentation, there was some documentation for developers, but just checked briefly and it appears that it's been removed for whatever reason. I learn't from lots of trial and error unfortunately, as have most developers using it

joomla 2.5 ajax api

I would like to setup some little ajax support for my joomla page, in detail: I would like to send logging messages from the frontend to the backend via ajax and store them in database.
In drupal this can be done by adding a path and a callback inside a module, so how can this be achieved in joomla 2.5, so that there is an url like:
http://www.domain.com/log which leads to a function call?
Greetings..
The proper way would be to create a component to handle the call, but as you write most of the time it seems a bit overkill for just a module.
Another way would be to create a standalone php-file that uses the Joomla-library. This file could then easily be called from wherever you like. It's like a mini-version of Joomla with the advantage of having all libraries available:
define( 'DS', DIRECTORY_SEPARATOR );
if (!defined('JPATH_BASE')){
define('JPATH_BASE', '..'.DS.'..'.DS.'..');
}
define('JPATH_LIBRARIES', JPATH_BASE . DS . 'libraries');
require_once JPATH_LIBRARIES . DS . 'import.php';
$var = JRequest::getVar('my_var');
To access the DB-object, you would need to manually set the options to the DB-object since this file won't access the configuration files (you can program this of course).
$option = array(); //prevent problems
$option['driver']   = 'mysql';            // Database driver name
$option['host']     = 'db.myhost.com';    // Database host name
$option['user']     = 'myuser';       // User for database authentication
$option['password'] = 'mypass';   // Password for database authentication
$option['database'] = 'bigdatabase';      // Database name
$option['prefix']   = 'abc_';             // Database prefix (may be empty)
$db = & JDatabase::getInstance( $option );

Resources