1 - отображение ошибок включил
2- модуль (оба , и суперхук и Многофункциональный Блок произвольного текста или HTML от phrasespot в нужный хук попадают.
но после включения отобр. ошибок появляется ошибка от другого модуля- отзывы(гостевая)
Notice: Undefined variable: resulthome in /var/www/a61635/data/www/soapexpert.ru/modules/blockfeedback/blockfeedback.php on line 211
Если выключить этот модуль (гостевая) - ошибок нет... Даже не знаю, хорошо это или плохо...
А по пункту третьему - я РНР код "не читаю" ... Привожу полностью содержимое superhook.php
Прошу прощение за "простыню"
Не смог спрятать сообщение.
Код:
<?php
/*
* Author: Burhan Bavkır
* Developed and all copyrights owned by www.bvkyazilim.com
*/
function superhook_template($rsrc_name, &$source, $smarty){
if(isset(SuperHook::$_contents[$rsrc_name])){
$source=SuperHook::$_contents[$rsrc_name]['content'];
return true;
}else{
return false;
}
}
function superhook_timestamp($rsrc_name, &$timestamp, $smarty){
if(isset(SuperHook::$_contents[$rsrc_name])){
$timestamp=SuperHook::$_contents[$rsrc_name]['stamp'];
return true;
}else{
return false;
}
}
function superhook_secure($rsrc_name, $smarty){
return true;
}
function superhook_trusted($rsrc_name, $smarty){
return true;
}
class SuperHook extends Module{
private $errors=array();
private $settings=array();
private $message=false;
public static $_contents=array();
private $pv=0;
public function __construct(){
$this->name = 'superhook';
$this->version = '0.2';
$version=explode('.', _PS_VERSION_);
$i=0;
$pv=0;
foreach($version AS $v){
$i+=floor($v/10);
$pv+=$v*(1/pow(10, $i));
$i++;
}
$this->pv=$pv;
switch(round($this->pv, 1)){
case 1.4:
$this->tab = 'content_management';
break;
default:
$this->tab = 'Tools';
break;
}
/* The parent construct is required for translations */
parent::__construct();
$this->page = basename(__FILE__, '.php');
$this->displayName = $this->l('Super Hook');
$this->description = $this->l('A module to insert text in any hook you would like.');
$this->settings=array(
'editorenabled'=>array(
'n'=>'editorenabled',
'l'=>$this->l('Enable TinyMCE Editor'),
's'=>'SH_ENABLE_EDITOR',
'v'=>1,
'o'=>array(0=>$this->l('Disabled'), 1=>$this->l('Enabled'))
)
);
foreach($this->settings AS &$setting){
if(Configuration::get($setting['s'])!==false){
$setting['v']=Configuration::get($setting['s']);
}elseif(!isset($setting['v'])){
$setting['v']='';
}
}
}
public function install()
{
if (!parent::install())
return false;
Db::getInstance()->Execute('CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'superhook` (
`id_content` int(10) unsigned NOT NULL auto_increment,
`hook` VARCHAR(64),
`title` varchar(100),
`content` TEXT,
`order` tinyint unsigned not null DEFAULT \'0\',
`active` ENUM( \'0\', \'1\' ) NOT NULL DEFAULT \'1\',
`smarty` tinyint unsigned not null DEFAULT \'0\',
`id_lang` int(10) unsigned NOT NULL,
`stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id_content`),
INDEX ( `hook` )
) DEFAULT CHARSET=utf8');
// echo mysql_error();
return true;
}
public function uninstall()
{
if (!parent::uninstall())
return false;
Db::getInstance()->Execute('DROP TABLE `'._DB_PREFIX_.'superhook`');
return true;
}
function getContent()
{
global $smarty, $cookie;
$baseurl='?tab=AdminModules&configure='.$this->name.'&token='.$_GET['token'];
$smarty->assign('baseurl', $baseurl);
$smarty->assign('name', $this->displayName);
$smarty->assign('tab', 0);
if(isset($_POST['updatesettings'])){
foreach($this->settings AS &$setting){
$setting['v']=Tools::getValue($setting['n']);
Configuration::updateValue($setting['s'], $setting['v']);
}
}
if($id_content=Tools::getValue('up')){
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'superhook AS sh1, '._DB_PREFIX_.'superhook AS sh2 SET sh1.`order`=sh2.`order`, sh2.`order`=sh1.`order` WHERE sh1.hook=sh2.hook AND sh1.order=sh2.order-1 AND sh2.id_content='.intval($id_content));
Tools::redirectAdmin($baseurl);
}
if($id_content=Tools::getValue('down')){
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'superhook AS sh1, '._DB_PREFIX_.'superhook AS sh2 SET sh1.`order`=sh2.`order`, sh2.`order`=sh1.`order` WHERE sh1.hook=sh2.hook AND sh1.order=sh2.order+1 AND sh2.id_content='.intval($id_content));
Tools::redirectAdmin($baseurl);
}
if(Tools::isSubmit('addtohook')){
if(Tools::getValue('edit')){
if($hook=Db::getInstance()->getRow('SELECT h.id_hook, sh.hook FROM '._DB_PREFIX_.'superhook AS sh, '._DB_PREFIX_.'hook AS h WHERE h.name=sh.hook AND sh.`id_content`='.intval(Tools::getValue('edit')))){
// print_r($hook);
$corder=false;
if($hook['hook']!=Tools::getValue('hook')){
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'superhook AS sh1, '._DB_PREFIX_.'superhook AS sh2 SET sh1.`order`=sh1.`order`-1 WHERE sh1.hook=sh2.hook AND sh1.order>sh2.order AND sh2.id_content='.intval(Tools::getValue('edit')));
$corder=Db::getInstance()->getValue('SELECT COUNT(*) AS c FROM '._DB_PREFIX_.'superhook WHERE `hook`="'.pSQL(Tools::getValue('hook')).'"')+1;
}
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'superhook SET `hook`="'.pSQL(Tools::getValue('hook')).'", `content`="'.pSQL(Tools::getValue('content'), true).'", `id_lang`='.intval(Tools::getValue('lang')).', `title`="'.pSQL(Tools::getValue('title')).'", `smarty`='.intval(Tools::getValue('smarty')).($corder?', `order`='.intval($corder):'').' WHERE id_content='.intval(Tools::getValue('edit')));
echo mysql_error();
$hcount=Db::getInstance()->ExecuteS('SELECT COUNT(*) AS c FROM '._DB_PREFIX_.'superhook WHERE `hook`="'.pSQL($hook['hook']).'"');
if($hcount[0]['c']==0){
$this->unregisterHook($hook['id_hook']);
}
echo mysql_error();
}
}else{
$hcount=Db::getInstance()->getValue('SELECT COUNT(*) AS c FROM '._DB_PREFIX_.'superhook WHERE `hook`="'.pSQL(Tools::getValue('hook')).'"')+1;
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'superhook(`hook`, `content`, `id_lang`, `title`, `smarty`, `order`) VALUES("'.pSQL(Tools::getValue('hook')).'", "'.pSQL(Tools::getValue('content'), true).'", '.intval(Tools::getValue('lang')).', "'.pSQL(Tools::getValue('title')).'", '.intval(Tools::getValue('smarty')).', '.intval($hcount).')');
}
echo mysql_error();
$this->registerHook(Tools::getValue('hook'));
}
if(Tools::getValue('delete')){
if($hook=Db::getInstance()->getRow('SELECT h.id_hook, sh.hook FROM '._DB_PREFIX_.'superhook AS sh, '._DB_PREFIX_.'hook AS h WHERE h.name=sh.hook AND sh.`id_content`='.intval(Tools::getValue('delete')))){
// print_r($hook);
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'superhook AS sh1, '._DB_PREFIX_.'superhook AS sh2 SET sh1.`order`=sh1.`order`-1 WHERE sh1.hook=sh2.hook AND sh1.order>sh2.order AND sh2.id_content='.intval(Tools::getValue('delete')));
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'superhook WHERE `id_content`='.intval(Tools::getValue('delete')));
echo mysql_error();
$hcount=Db::getInstance()->ExecuteS('SELECT COUNT(*) AS c FROM '._DB_PREFIX_.'superhook WHERE `hook`="'.pSQL($hook['hook']).'"');
if($hcount[0]['c']==0){
$this->unregisterHook($hook['id_hook']);
}
echo mysql_error();
}
}
$contentlist=false;
if($contents=Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'superhook WHERE 1 ORDER BY `order` ASC')){
foreach($contents AS $content){
$contentlist[$content['hook']][]=$content;
}
}
$contenthooks=false;
if($contentlist){
$contenthooks=Db::getInstance()->ExecuteS('SELECT title, name FROM '._DB_PREFIX_.'hook WHERE name IN ("'.implode('", "', array_keys($contentlist)).'")');
}
$content=false;
if(Tools::getValue('edit')){
$content=Db::getInstance()->getRow('SELECT * FROM '._DB_PREFIX_.'superhook WHERE id_content='.intval(Tools::getValue('edit')));
echo mysql_error();
}
$smarty->assign('editorenabled', $this->settings['editorenabled']['v']);
$smarty->assign('content', $content);
$smarty->assign('contentlist', $contentlist);
$smarty->assign('contenthooks', $contenthooks);
$smarty->assign('hooklist', Hook::getHooks());
$smarty->assign('langlist', Language::getLanguages());
$smarty->assign('settings', $this->settings);
$smarty->assign('errors', $this->errors);
$smarty->assign('message', $this->message);
if($this->pv>=1.41){
echo '<script type="text/javascript" src="'.__PS_BASE_URI__.'js/tiny_mce/tiny_mce.js"></script>';
}else{
echo '<script type="text/javascript" src="'.__PS_BASE_URI__.'js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>';
}
$this->_html .= $this->display(__FILE__, 'admin_main.tpl');
return $this->_html;
}
public function __call($name, $params){
global $smarty, $cookie;
$params=$params[0];
if (!$this->active)
return;
if(substr(_PS_VERSION_, 0, 3)=="1.4" && !Configuration::get('PS_FORCE_SMARTY_2')){
$smarty->registerResource("superhook", array("superhook_template", "superhook_timestamp", "superhook_secure", "superhook_trusted"));
}else{
$smarty->register_resource("superhook", array("superhook_template", "superhook_timestamp", "superhook_secure", "superhook_trusted"));
}
$name=str_replace('hook', '', $name);
$html='';
//print_r($params);
$smarty->assign($params);
if($contentlist=Db::getInstance()->ExecuteS('SELECT id_content, content, smarty, UNIX_TIMESTAMP(stamp) AS stamp FROM '._DB_PREFIX_.'superhook WHERE hook="'.pSQL($name).'" AND (id_lang=0 OR id_lang='.intval($cookie->id_lang).') ORDER BY `order` ASC')){
foreach($contentlist AS $content){
if($content['smarty']==1){
self::$_contents[$content['id_content']]=$content;
$html.=$smarty->fetch("superhook:".$content['id_content']);
}else{
$html.=$content['content'];
}
}
}
return $html;
}
}
?>
Сообщение отредактировано Michel II 04-08-2014 12:55 ...