CMS MADE SIMPLE FORGE

Simple Tagging

 

[#7011] No compatible 1.10

avatar
Created By: rams (Rams)
Date Submitted: Tue Oct 25 06:54:26 -0400 2011

Assigned To: Henning Schaefer (hschaefer)
Version: 0.3.1
CMSMS Version: 1.10
Severity: Critical
Resolution: None
State: Open
Summary:
No compatible 1.10
Detailed Description:
Fatal error: Cannot access protected property Content::$mName in
/public_html/dev-beta/modules/simpletagging/action.related.php on line 53


History

Comments
avatar
Date: 2011-11-07 12:08
Posted By: Nicholas Wittering (swarfega)

I also get:

Fatal error: Cannot access protected property Content::$mId in
/var/www/vhosts/thriplow.org.uk/httpdocs/cms/modules/simpletagging/simpletagging.module.php
on line 292
      
avatar
Date: 2012-02-11 10:54
Posted By: Madlen Reinke (Madlen)

Hello,

same problem here.

Has anyone found a fix?

Greetings
      
avatar
Date: 2012-03-19 05:50
Posted By: Simon Brown (uptoeleven)

I have the same problem, don't have time to debug, just disabled it but it's not
a workable solution if you need tagging. I would imagine that in the new
architecture of CMSMS there is a method you call instead but I don't know for
sure
      
avatar
Date: 2012-03-20 15:26
Posted By: Goran Ilic (uniqu3)

Here is a diff for simpletagging module that works for 1.10
If you use Tortoise SVN, you can pull svn version and simply apply this patch
from Tortoise SVN context menu.

Index: action.default.php
===================================================================
--- action.default.php	(revision 16)
+++ action.default.php	(working copy)
@@ -1,8 +1,5 @@
 <?php
-
-if (!isset($gCms))
-    exit;
-
+if (!is_object(cmsms())) exit;
 /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
   Code for simpletagging "default" action
@@ -14,7 +11,7 @@
 
  */
 
-$q = "SELECT tag, tag_id FROM " . cms_db_prefix() . "module_simpletagging WHERE
page_id = " . $gCms->variables['content_id'];
+$q      = "SELECT tag, tag_id FROM " . cms_db_prefix() . "module_simpletagging
WHERE page_id = " . cmsms()->variables['content_id'];
 $result = $db->Execute($q);
 
 $taglist = "";
Index: action.defaultadmin.php
===================================================================
--- action.defaultadmin.php	(revision 16)
+++ action.defaultadmin.php	(working copy)
@@ -1,8 +1,6 @@
 <?php
-if (!isset($gCms)) exit;
-
-if (! $this->CheckAccess())
-	{
+if (!is_object(cmsms())) exit;
+if (!$this->CheckAccess()) {
return $this->DisplayErrorPage($id, $params,
$returnid,$this->Lang('accessdenied'));
 	}
 
@@ -17,16 +15,12 @@
    
 */
 
-
-if (isset($params['submit_template']))
-{
+if (isset($params['submit_template'])) {
 	$this->SetPreference('searchtemplate', $params['searchtemplate']);
 	$this->SetPreference('tagtemplate', $params['tagtemplate']);
 	$this->SetPreference('relatedtemplate', $params['relatedtemplate']);
$params = array('tab_message'=> 'templates_saved', 'active_tab' =>
'tagsearchtemplate');
-}
-elseif (isset($params['submit_tagcloud']))
-{
+} elseif (isset($params['submit_tagcloud'])) {
 	$this->SetPreference('minfontsize', $params['minfontsize']);
 	$this->SetPreference('maxfontsize', $params['maxfontsize']);
         $this->SetPreference('delimiter', $params['delimiter']);
@@ -34,24 +28,19 @@
 	$this->SetPreference('relmax', $params['relmax']);
         $this->SetPreference('resultpage', (int)$params['resultpage']);
$params = array('tab_message'=> 'settings_saved', 'active_tab' =>
'tagcloudsettings');
-}
-elseif (isset($params['submit_reload']))
-{
+} elseif (isset($params['submit_reload'])) {
 	$params = $this->reloadTags();
 }
 
 $tabheaders = $this->StartTabHeaders();
 
-if (FALSE == empty($params['active_tab']))
-{
+if (FALSE == empty($params['active_tab'])) {
     $tab = $params['active_tab'];
 } else {
     $tab = '';
 }
 
-$tabheaders .= 
$this->SetTabHeader('tagsearchtemplate',$this->Lang('title_tagsearchtemplate'),('tagsearchtemplate'
== $tab)).
-	
$this->SetTabHeader('tagcloudsettings',$this->Lang('title_tagcloudsettings'),('tagcloudsettings'
== $tab)).
-		$this->EndTabHeaders().$this->StartTabContent();
+$tabheaders .= $this->SetTabHeader('tagsearchtemplate',
$this->Lang('title_tagsearchtemplate'), ('tagsearchtemplate' == $tab)) .
$this->SetTabHeader('tagcloudsettings', $this->Lang('title_tagcloudsettings'),
('tagcloudsettings' == $tab)) . $this->EndTabHeaders() .
$this->StartTabContent();
 $this->smarty->assign('tab_headers', $tabheaders);
 $this->smarty->assign('end_tab',$this->EndTab());
 $this->smarty->assign('tab_footers',$this->EndTabContent());
@@ -103,6 +92,4 @@
$this->smarty->assign('admin_footer_text',$this->Lang('simpletagging_admin_footer'));
 
 echo $this->ProcessTemplate('adminpanel.tpl');
-
-
 ?>
\ No newline at end of file
Index: action.pagetags.php
===================================================================
--- action.pagetags.php	(revision 16)
+++ action.pagetags.php	(working copy)
@@ -1,6 +1,5 @@
 <?php
-if (!isset($gCms)) exit;
-
+if (!is_object(cmsms())) exit;
 /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
    Code for simpletagging "pagetags" action
@@ -11,7 +10,4 @@
    or do some other task.
    
 */
-
-
-
 ?>
\ No newline at end of file
Index: action.related.php
===================================================================
--- action.related.php	(revision 16)
+++ action.related.php	(working copy)
@@ -1,8 +1,5 @@
 <?php
-
-if (!isset($gCms))
-    exit;
-
+if (!is_object(cmsms())) exit;
 /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
   Code for simpletagging "default" action
@@ -14,7 +11,7 @@
 
  */
 
-$q = "SELECT tag FROM " . cms_db_prefix() . "module_simpletagging WHERE page_id
= " . $gCms->variables['content_id'];
+$q = "SELECT tag FROM " . cms_db_prefix() . "module_simpletagging WHERE page_id
= " .   cmsms()->variables['content_id'];
 $result = $db->Execute($q);
 
 $related = array();
@@ -22,7 +19,6 @@
 $coverage = $this->GetPreference('relcoverage', 50);
 $tagcount = 0;
 
-
$q = "SELECT COUNT(*) AS count, page_id FROM " . cms_db_prefix() .
"module_simpletagging WHERE (";
 
 while ($result && !$result->EOF) {
@@ -45,12 +41,12 @@
         break;
     }
     $tmp = array();
-    $curnode = & $hm->getNodeById($result->fields['page_id']);
+    $curnode = $hm->getNodeById($result->fields['page_id']);
     $curcontent = $curnode->getContent();
if (isset($curcontent) && $curcontent->Active() &&
$curcontent->ShowInMenu()) {
 
         $tmp['url'] = $curcontent->GetURL();
-        $tmp['title'] = $curcontent->mName;
+        $tmp['title'] = $curcontent->Name();
         $percentage = round(($result->fields['count'] / $tagcount) * 100);
         $tmp['percentage'] = $percentage;
         array_push($related, $tmp);
@@ -58,7 +54,6 @@
     $result->moveNext();
 }
 
-
 if (count($related) > 0) {
     $smarty->assign('related', $related);
echo $this->ProcessTemplateFromData($this->GetPreference('relatedtemplate',
$this->getDefaultRelatedTemplate()));
Index: action.searchtags.php
===================================================================
--- action.searchtags.php	(revision 16)
+++ action.searchtags.php	(working copy)
@@ -1,6 +1,5 @@
 <?php
-if (!isset($gCms)) exit;
-
+if (!is_object(cmsms())) exit;
 /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
    Code for simpletagging "searchtags" action
@@ -15,7 +14,6 @@
$q = "SELECT tag FROM ".cms_db_prefix()."module_simpletagging WHERE tag_id = ".
$params['tagid'];
 $searchtag = $db->GetOne($q);
 $this->smarty->assign('searchtag', $searchtag);
-$this->smarty->assign('canonical', $_SERVER['REQUEST_URI']);
 
$q = "SELECT page_id FROM ".cms_db_prefix()."module_simpletagging WHERE tag =
'". $searchtag ."'";
 $result = $db->Execute($q);
@@ -27,19 +25,16 @@
     $returnid = $this->GetPreference('resultpage');
 }
 
-while ($result && !$result->EOF) 
-{
+while ($result && !$result->EOF) {
 	$res = array();
-	$curnode =& $hm->getNodeById($result->fields['page_id']);
-	$curcontent =& $curnode->GetContent();
+    $curnode          = $hm->getNodeById($result->fields['page_id']);
+    $curcontent       = $curnode->GetContent();
 	$res['url'] = $curcontent->GetURL();
-	$res['title'] = $curcontent->mName;
+    $res['title']     = $curcontent->Name();
 	$res['othertags'] = array();
$result1 = $db->Execute("SELECT tag, tag_id FROM
".cms_db_prefix()."module_simpletagging WHERE page_id =
".$result->fields['page_id']." ORDER BY tag ASC");
-	while ($result1 && !$result1->EOF) 
-	{
-		if ($result1->fields['tag'] != $searchtag)
-		{
+    while ($result1 && !$result1->EOF) {
+        if ($result1->fields['tag_id'] != $params['tagid']) {
$taglink = $this->CreateLink($id, 'searchtags', $returnid, '',
array('tagid'=>$result1->fields['tag_id']),'', true, false, '', false,
'tags/'.$returnid.'/'.$result1->fields['tag_id'].'/'.
munge_string_to_url($result1->fields['tag']));
array_push($res['othertags'], "<a href='".$taglink."'
class='taglink'>".$result1->fields['tag']."</a>");
 		}
@@ -53,5 +48,4 @@
 $this->smarty->assign('results', $results);
 
echo $this->ProcessTemplateFromData($this->GetPreference('searchtemplate',
$this->getDefaultSearchTemplate()));
-
 ?>
\ No newline at end of file
Index: action.tagcloud.php
===================================================================
--- action.tagcloud.php	(revision 16)
+++ action.tagcloud.php	(working copy)
@@ -1,6 +1,5 @@
 <?php
-if (!isset($gCms)) exit;
-
+if (!is_object(cmsms())) exit;
 /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
    Code for simpletagging "tagcloud" action
@@ -22,10 +21,8 @@
 $max = $result->fields['count'];
 $result->moveLast();
 $min = $result->fields['count'];
-
 $diff = $max - $min;
 $diff = max(1, $diff);
-
 $font_diff = $max_fontsize - $min_fontsize;
 $step = round($font_diff / $diff);
 
@@ -33,9 +30,7 @@
 $result = $db->Execute($q);
 
 $cloud = "";
-
-while ($result && !$result->EOF)
-{
+while ($result && !$result->EOF) {
 	if ($result->fields['tag'] != '') {
 		$fontsize = $min_fontsize + ($result->fields['count'] - 1) * $font_diff;
                 if ($this->GetPreference('resultpage') > 0) {
@@ -46,6 +41,5 @@
 	}
 	$result->moveNext();
 }
-
 echo substr($cloud, 0, strlen($cloud) - strlen($delimiter));
 ?>
\ No newline at end of file
Index: method.install.php
===================================================================
--- method.install.php	(revision 16)
+++ method.install.php	(working copy)
@@ -1,8 +1,6 @@
 <?php
-
-if (!isset($gCms))
+if (!is_object(cmsms()))
     exit;
-
 /* ---------------------------------------------------------
   Install()
   When your module is installed, you may need to do some
@@ -20,7 +18,7 @@
   --------------------------------------------------------- */
 
 // Typical Database Initialization
-$db = & $gCms->GetDb();
+$db = cmsms()->GetDb();
 
 // mysql-specific, but ignored by other database
 $taboptarray = array('mysql' => 'TYPE=MyISAM');
@@ -48,7 +46,6 @@
 
 $this->RegisterEvents();
 
-
 // put mention into the admin log
$this->Audit(0, $this->Lang('friendlyname'), $this->Lang('installed',
$this->GetVersion()));
 ?>
\ No newline at end of file
Index: method.uninstall.php
===================================================================
--- method.uninstall.php	(revision 16)
+++ method.uninstall.php	(working copy)
@@ -1,6 +1,5 @@
 <?php
-if (!isset($gCms)) exit;
-
+if (!is_object(cmsms()))exit ;
 	/*---------------------------------------------------------
 	   Uninstall()
 	   Sometimes, an exceptionally unenlightened or ignorant
@@ -12,9 +11,8 @@
 	   This is the method where we do this.
 	  ---------------------------------------------------------*/
 
-		
 		// Typical Database Removal
-		$db =& $gCms->GetDb();
+$db = cmsms()->GetDb();
 		
 		// remove the database table
 		$dict = NewDataDictionary( $db );
@@ -37,8 +35,6 @@
 		// remove the permissions
 		$this->RemovePermission('Use Simple Tagging');
 
-		
 		// put mention into the admin log
 		$this->Audit( 0, $this->Lang('friendlyname'), $this->Lang('uninstalled'));
-
 ?>
\ No newline at end of file
Index: method.upgrade.php
===================================================================
--- method.upgrade.php	(revision 16)
+++ method.upgrade.php	(working copy)
@@ -1,8 +1,5 @@
 <?php
-
-if (!isset($gCms))
-    exit;
-
+if (!is_object(cmsms()))exit ;
 /* ---------------------------------------------------------
   Upgrade()
   If your module version number does not match the version
@@ -15,7 +12,7 @@
   module in the standard CMS install.
   --------------------------------------------------------- */
 $dict = NewDataDictionary($db);
-$db = & $this->GetDb();
+$db = cmsms()->GetDb();
 $current_version = $oldversion;
 switch ($current_version) {
     case "0.1":
Index: simpletagging.module.php
===================================================================
--- simpletagging.module.php	(revision 16)
+++ simpletagging.module.php	(working copy)
@@ -287,21 +287,24 @@
     }
 
     function DoEvent($originator, $eventname, &$params) {
+
         if ($originator == 'Core') {
-            if ($eventname == 'ContentEditPost' &&
isset($params['content']->mProperties->mPropertyValues['Tags'])) {
-                $pageid = $params['content']->mId;
-                $tags =
$params['content']->mProperties->mPropertyValues['Tags'];
+            if ($eventname == 'ContentEditPost') {
+                $tags = $params['content']->GetPropertyValue('Tags');
+                if (!empty($tags)) {
+                    $pageid = $params['content']->Id();
                 $this->removeTags($pageid);
                 $this->addTags($pageid, $tags);
             }
+            }
             if ($eventname == 'ContentDeletePost') {
-                $this->removeTags($params[content]->mId);
+                $this->removeTags($params['content']->Id());
             }
         }
     }
 
     function removeTags($pageid) {
-        $db = & $this->GetDb();
+        $db = $this->GetDb();
$db->Execute("DELETE FROM " . cms_db_prefix() . "module_simpletagging
WHERE page_id = " . $pageid);
     }
 
@@ -361,5 +364,4 @@
     }
 
 }
-
 ?>

      
avatar
Date: 2012-04-26 13:34
Posted By: david vargas (davidvm)

Hello Goran.
I have the same problem (simpletagging worked on my previous version but when
updated it shows the same error that was discussed before).

I tried to copy the parts of the code that you made on my simpletagging module's
files.
Nevertheless it didn't work.

Is there any chance that you could help me sending me the .php files working
right.
I would really appreciate that, because right now I don't know what else to do.

Tahnks in advance for your attention and help.

Sincerely
davidvm

      
avatar
Date: 2012-05-08 06:31
Posted By: Bas Hesselink (hesbas)

Gorans trick works!

David, if you sill looking for the php-files, mail me!

Grtz, Bas
      
avatar
Date: 2013-02-13 10:33
Posted By: Magal (magallo)

hi, is it possible to have the php files? the instructions above can be
confusing.
Thanks