User Rights Management and Frontend Editing

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
betabi
Posts: 26
Joined: Thu 23. Jun 2005, 17:28
Location: Hamburg
Contact:

User Rights Management and Frontend Editing

Post by betabi »

1. User Rights Management
In phpwcm dev 1.2.5 Oliver Georgi invented a field called "authorized to access" in the "admin" -> "site structure" -> edit structure level menu. Altough you can easily add users in order to authorize them, this has no effect on their editing rights as far as articles are concerned. In phpwcm dev 1.2.5 still only the admin or the owner of the article is authorized to edit it, which means that it is not possible to share rights.

For this reason I tried to get use out of the "authorized to access"-field and modified the "inc_lib" -> "admin.functions.inc.php"-file which is responsible for rendering the editing features (pictos) in the "article center"->"site structure and article list" and the "admin"->"site structure" menu.


What does the hack do?

Next to give editing rights depending on the article's owner, my hack gives any user access to any article within a special structure level as far as the user is part of the "authorized to access" -list of this special structure level.
Arrrgh, it is difficult to explain – especially in english –, but i will give you an example:


fig. 1

Image


the logged in user "news_redakteur" is part of the "authorized to access" -list of the following structure levels:
- "Ausbildung"
- "Fächer und Lehrer"
for this reason "news_redakteur" may edit any article/contentpart on those two structure levels and add a new article.

"news_redakteur" is not authorized for the "Blockzeiten" structure level but owner of the article "Medien : Blockzeiten". So this user can not add any article on this structure level, but edit his own one.

the reffering "authorized to access" -list for structure level "Blockzeiten" in "admin" -> "site structure" -> "edit structure level menu" looks like this:

fig. 2

Image

Only the admin and the user "kaufmann_redakteur" are authorized to acces the structure level "Blockzeiten".

Notice: If you leave the field "authorized to access" blank, all users will be authorized.

How does the hack work?
Well, I don’t know anything about PHP or database structures so I hacked the backend fuctions using a trail and error method.
All my added code should be corrected by someone who knows what he does.
Especially the for-loop in which I try to read the $beta_innertest array does not look very smart to me. But any array function like "in_array()" did not work out.

/////////////////////////////////////////////////////////////////
code coming soon
Last edited by betabi on Sun 19. Feb 2006, 19:07, edited 1 time in total.
betabi
Posts: 26
Joined: Thu 23. Jun 2005, 17:28
Location: Hamburg
Contact:

Code Part 1/2

Post by betabi »

/////////////////////////////////////////////////////////////////
admin.functions.inc.php

Code: Select all

<?php
/*************************************************************************************
   Copyright notice

   (c) 2002-2005 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.

   This script is part of PHPWCMS. The PHPWCMS web content management system is
   free software; you can redistribute it and/or modify it under the terms of
   the GNU General Public License as published by the Free Software Foundation;
   either version 2 of the License, or (at your option) any later version.

   The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
   A copy is found in the textfile GPL.txt and important notices to the license
   from the author is found in LICENSE.txt distributed with these scripts.

   This script is distributed in the hope that it will be useful, but WITHOUT ANY
   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
   PARTICULAR PURPOSE.  See the GNU General Public License for more details.

   This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/

//26-04-2004 Oliver Georgi -> $level seems to be unused
//19-11-2004 Fernando Batista -> Copy article, Copy strutures :http://fernandobatista.web.pt
//31-03-2005 Fernando Batista -> copy&cut Article Content :http://fernandobatista.web.pt




function struct_list ($id, $dbcon, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $cut_article, $listmode=1, $forbid_cut=0, $forbid_copy=0, $counter=0) {

        $counter++;
        $sql  = "SELECT * FROM ".DB_PREPEND."phpwcms_articlecat WHERE acat_trash=0 AND acat_struct=".intval($id)." ORDER BY acat_sort;";
        if($result = mysql_query($sql, $dbcon) or die("error while browsing structure".$sql)) {
                $count_row = 0;
                while($row = mysql_fetch_array($result)) {
                        //$struct[$sx] = $row; $sx++;
                        $struct[$count_row] = $row;
                        $count_row++;
                }
                mysql_free_result($result);

                if(isset($struct[0])) {
                        foreach($struct as $key => $value) {

                               struct_levellist($struct, $key, $counter, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $forbid_cut, $forbid_copy, $listmode, $cut_article, $count_row, $dbcon);
                        }
                }
        }
}

function struct_levellist($struct, $key, $counter, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $forbid_cut, $forbid_copy, $listmode, $cut_article, $count_row, $dbcon) {

        $page_val                = ($listmode) ? "do=admin&p=6" : "do=articles";
        $child_count        = get_root_childcount($struct[$key]["acat_id"], $dbcon);
        $child_sort         = (($child_count+1)*10);

        $forbid_cut                = ($struct[$key]["acat_struct"] == $cut_id || $forbid_cut) ? 1 : 0;
        $forbid_copy               = ($struct[$key]["acat_struct"] == $copy_id || $forbid_copy) ? 1 : 0;


///////////////////////////////////////////////////////////////////////////////////////////
//////////////// edit article depending on category permission // beta_bi

		$beta_test = $struct[$key]["acat_permit"]; // store category's permissions in $beta_test
				
		
///////////////////////////////////////////////////////////////////////////////////////////
        $an = html_specialchars($struct[$key]["acat_name"]);
        $a  = "<tr onMouseOver=\"this.bgColor='#CCFF00';\" onMouseOut=\"this.bgColor='#FFFFFF';\">\n";
		$a .= "<td width=\"450\">";
        $a .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n";
        $a .= "<td nowrap><img src=\"img/leer.gif\" width=\"".(14+(14*($counter-1)))."\" height=\"1\">"; //14
        $a .= ($child_count) ? "<a href=\"phpwcms.php?".$page_val."&open=".$struct[$key]["acat_id"].":".((!empty($_SESSION["structure"][$struct[$key]["acat_id"]]))?0:1)."\">" : "";
        $a .= "<img src=\"img/symbole/plus_".(($child_count) ? ((!empty($_SESSION["structure"][ $struct[$key]["acat_id"] ])) ? "close" : "open") : "empty");
        $a .= ".gif\" width=\"15\" height=\"15\" border=\"0\">".(($child_count) ? "</a>" : "");
        $a .= "<img src=\"img/symbole/page_".((!$struct[$key]["acat_hidden"])?1:7).".gif\" width=\"11\" height=\"15\" ";
        $a .= getAltTitle('ID: '.$struct[$key]["acat_id"].($struct[$key]["acat_alias"] ? " \nALIAS: ".html_specialchars($struct[$key]["acat_alias"]) : ""));
        $a .= "></td>\n";
        $a .= "<td><img src=\"img/leer.gif\" width=\"2\" height=\"15\"></td>\n";
        $a .= "<td class=\"dir\"><strong>".$an."</strong></td>\n</tr>\n</table></td>\n<td width=\"88\" nowrap>";

///////////////////////////////////////////////////////////////////////////////////////////
//////////////// edit article depending on category permission // beta_bi
        //$a .=  ($listmode,$struct,$key,$an,$copy_article_content,$cut_article_content,$copy_article,$copy_id,$cut_article,$cut_id,$forbid_cut,$forbid_copy,$count_row,$child_sort);

	    $a .= listmode_edits ($listmode,$struct,$key,$an,$copy_article_content,$cut_article_content,$copy_article,$copy_id,$cut_article,$cut_id,$forbid_cut,$forbid_copy,$count_row,$child_sort,$beta_test);

///////////////////////////////////////////////////////////////////////////////////////////

        $a .= "</td>\n</tr>\n";
        echo $a;

        if(isset($_SESSION["structure"][$struct[$key]["acat_id"]]) && $_SESSION["structure"][$struct[$key]["acat_id"]]) {

                if(!$listmode) {
				
///////////////////////////////////////////////////////////////////////////////////////////
//////////////// edit article depending on category permission // beta_bi

				// pass $beta_test (=permissions) to function struct_articlelist		
				struct_articlelist ($struct[$key]["acat_id"], $counter, $copy_article_content, $cut_article_content, $copy_article, $cut_article, $struct[$key]["acat_order"], $beta_test);
				//struct_articlelist ($struct[$key]["acat_id"], $counter, $copy_article_content, $cut_article_content, $copy_article, $cut_article, $struct[$key]["acat_order"]);

///////////////////////////////////////////////////////////////////////////////////////////
				}

                //26-04-2004 Oliver Georgi
                //struct_list ($struct[$key]["acat_id"], $dbcon, $cut_id, $cut_article, $listmode, $forbid_cut, $counter, $level);
                //$level seems to be unused
                struct_list ($struct[$key]["acat_id"], $dbcon, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $cut_article, $listmode, $forbid_cut, $forbid_copy, $counter);

        }

}

function get_root_childcount($id, $dbcon) {
        //Ermittelt Anzahl bereits vorhandener aktiver Unterlevels
        $p1_count = $p2_count = 0;
        $id = intval($id);
        if($p_result = mysql_query("SELECT COUNT(acat_id) FROM ".DB_PREPEND."phpwcms_articlecat WHERE acat_trash=0 AND acat_struct=".$id.";", $dbcon)) {
                if($p_row = mysql_fetch_row($p_result)) $p1_count = $p_row[0];
                mysql_free_result($p_result);
        }
        if($p_result = mysql_query("SELECT COUNT(article_id) FROM ".DB_PREPEND."phpwcms_article WHERE article_deleted=0 AND article_cid=".$id.";", $dbcon)) {
                if($p_row = mysql_fetch_row($p_result)) $p2_count = $p_row[0];
                mysql_free_result($p_result);
        }
        return $p1_count + $p2_count;
}

//31-03-2005 Fernando Batista start-----------------------------------------------------------------------------------------------------------
function get_article_content_count($id, $dbcon) {
        $p_count = 0;
        $id = intval($id);
        if($p_result = mysql_query("SELECT COUNT(acontent_id) FROM ".DB_PREPEND."phpwcms_articlecontent WHERE acontent_trash=0 AND acontent_aid=".$id.";", $dbcon)) {
                if($p_row = mysql_fetch_row($p_result)) $p_count = $p_row[0];
                mysql_free_result($p_result);
        }
        return $p_count;
}
//31-03-2005 Fernando Batista  end-------------------


///////////////////////////////////////////////////////////////////////////////////////////
//////////////// edit article depending on category permission // beta_bi

// function struct_articlelist ($struct_id, $counter, $copy_article_content, $cut_article_content, $copy_article, $cut_article, $article_order=0) {
function struct_articlelist ($struct_id, $counter, $copy_article_content, $cut_article_content, $copy_article, $cut_article, $article_order=0, $beta_innertest) {
///////////////////////////////////////////////////////////////////////////////////////////

        $count_article        = 0;
        $article_order        = intval($article_order);
        $show_sort = (!$article_order || $article_order == 1) ? 1 : 0;

        $ao = get_order_sort($article_order);
        echo "\n\n\n".'<!-- ORDER: '.$ao[2].' //-->'."\n\n\n";

        $sql =        "SELECT article_id, article_cid, article_title, article_public, article_aktiv, article_uid, ".
        "date_format(article_tstamp, '%Y-%m-%d %H:%i:%s') AS article_date FROM ".
        DB_PREPEND."phpwcms_article WHERE article_cid='".$struct_id."' AND article_deleted=0 ".
        "ORDER BY ".$ao[2].";";
        //"ORDER BY article_sort;";
        if($result = mysql_query($sql, $GLOBALS['db']) or die ("error while browsing related articles")) {
                while($row = mysql_fetch_array($result)) {
                        $article[$count_article] = $row;
                        $count_article++;
                }
                mysql_free_result($result);
        }

        if(isset($article[0])) {
                foreach($article as $akey => $avalue) {
///////////////////////////////////////////////////////////////////////////////////////////
//////////////// edit article depending on category permission // beta_bi
					
					
					// look if logged in user has got permission to edit category or not / max: 20 users
					$hasPermission = false;
					
					if ($beta_innertest == '') {
						// if no permissions are defined
						$hasPermission = true;
					}
					else {
						for ($loop = 0; $loop < 20; $loop++) {
							if ($_SESSION["wcs_user_id"] == $beta_innertest[$loop]) {
								$hasPermission = true;
								break;
							}
						}
					}
///////////////////////////////////////////////////////////////////////////////////////////					
			
                        $at = html_specialchars(str_replace("'", '"', $article[$akey]["article_title"])); 
                                            
//31-03-2005 Fernando Batista start-----------------------------------------------------------------------------------------------------------
				    if($cut_article == $article[$akey]["article_id"] ) {
                        $a = "<tr bgColor='#B4E101'>\n";
                    }elseif($copy_article == $article[$akey]["article_id"]){  
                    	$a = "<tr bgColor='#B4E101'>\n";  
				    }else{
                        $a = "<tr onMouseOver=\"this.bgColor='#CCFF00';\" onMouseOut=\"this.bgColor='#FFFFFF';\">\n";
				    }	
                        
                        $a .= "<td width=\"450\">";
                        $a .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n";
    
                        $acontent_count =  get_article_content_count($article[$akey]["article_id"], $GLOBALS['db']);
///////////////////////////////////////////////////////////////////////////////////////////
                        if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"] || $hasPermission == true) {
///////////////////////////////////////////////////////////////////////////////////////////
 
                              $a .= "<td nowrap><img src=\"img/leer.gif\" width=\"".(14+14+(14*($counter-1)))."\" height=\"1\">";
                              $a .= ($acontent_count) ? "<a href=\"phpwcms.php?do=articles&opena=".$article[$akey]["article_id"].":".((!empty($_SESSION["structure"]["article"][$article[$akey]["article_id"]]))?0:1)."\">" : "";
                              $a .= "<img src=\"img/symbole/plus_".(($acontent_count) ? ((!empty($_SESSION["structure"]["article"][ $article[$akey]["article_id"] ])) ? "close" : "open") : "empty");
                              $a .= ".gif\" width=\"15\" height=\"15\" border=\"0\">".(($acontent_count) ? "</a>" : "");
                        }else{
                              $a .= "<td nowrap><img src=\"img/leer.gif\" width=\"".(14+29+(14*($counter-1)))."\" height=\"1\">";
                        }
//31-03-2005 Fernando Batista  end-------------------

                        $a .= "<img src=\"img/symbole/text_1.gif\" width=\"11\" height=\"15\" ";
                        $a .= getAltTitle($GLOBALS["BL"]['be_func_struct_articleID'].": ".$article[$akey]["article_id"]);
                        $a .= "></td>\n";
                        $a .= "<td><img src=\"img/leer.gif\" width=\"2\" height=\"15\"></td>\n";
                        $a .= "<td class=\"dir\"><a href=\"index.php?id=".$article[$akey]["article_cid"].",".$article[$akey]["article_id"];
                        $a .= ",0,0,1,0\" target=\"_blank\" title=\"".$GLOBALS["BL"]['be_func_struct_preview'].": ".$at."\">";
                        $a .= $at."</a></td>\n</tr>\n</table></td>\n<td width=\"88\" nowrap>";

///////////////////////////////////////////////////////////////////////////////////////////
						if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"] || $hasPermission == true ) {
///////////////////////////////////////////////////////////////////////////////////////////

                        
                                $a .= "<a href=\"phpwcms.php?do=articles&p=2&s=1&id=".$article[$akey]["article_id"];
                                $a .= "\" title=\"".$GLOBALS["BL"]['be_func_struct_edit']." \n[".$at."]\">";
                                $a .= "<img src=\"img/button/edit_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<img src=\"img/button/edit_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\">";
                        }

                        if($cut_article != $article[$akey]["article_id"] && !$cut_article_content) {
                                $a .= "<a href=\"phpwcms.php?do=articles&acut=".$article[$akey]["article_id"];
                                $a .= "\" title=\"".$GLOBALS["BL"]['be_func_struct_cut']." \n[".$at."]\">";
                                $a .= "<img src=\"img/button/cut_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
//31-03-2005 Fernando Batista start-----------------------------------------------------------------------------------------------------------
                       } elseif($cut_article_content) {
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=7|".$cut_article_content."|".$article[$akey]["article_id"]."|-10";
                                $a .= "\" title=\"".$GLOBALS['BL']['be_func_content_paste0'];
                                $a .= " [".$at."]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";                    
//31-03-2005 Fernando Batista  end-------------------
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$GLOBALS["BL"]['be_func_struct_nocut'].'">';
                                $a .= "<img src=\"img/button/cut_11x11_3.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }

                        if($copy_article != $article[$akey]["article_id"] && !$copy_article_content) {
                                $a .= "<a href=\"phpwcms.php?do=articles&acopy=".$article[$akey]["article_id"];
                                $a .= "\" title=\"".$GLOBALS["BL"]['be_func_struct_copy']." \n[".$at."]\">";
                                $a .= "<img src=\"img/button/copy_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
//31-03-2005 Fernando Batista start-----------------------------------------------------------------------------------------------------------
                        } elseif($copy_article_content) {
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=8|".$copy_article_content."|".$article[$akey]["article_id"]."|-10";
                                $a .= "\" title=\"".$GLOBALS['BL']['be_func_content_paste0'];
                                $a .= " [".$at."]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";                    
//31-03-2005 Fernando Batista  end-------------------
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$GLOBALS["BL"]['be_func_struct_nocopy'].'">';
                                $a .= "<img src=\"img/button/copy_11x11_3.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }

                        //Sortierungslink
                        $sort_up        = ($count_article > 1 && $akey && $show_sort) ? 1 : 0;
                        $sort_down        = ($count_article > 1 && $akey + 1 < $count_article && $show_sort) ? 1 : 0;

                        //davor sortieren
                        $a .= ($sort_up) ? '<a href="include/inc_act/act_structure.php?do=4|'.$article[$akey]["article_id"].'|'.
                        ($akey*10).'|'.$article[$akey-1]["article_id"].'|'.(($akey+1)*10).
                        '" title="'.$GLOBALS['BL']['be_func_struct_sort_up'].'">':'';
                        $a .= "<img src=\"img/button/sort_1_".$sort_up.".gif\" width=\"11\" height=\"11\" border=\"0\">".(($sort_up)?"</a>":"");
                        //dahinter sortieren
                        $a .= ($sort_down) ? '<a href="include/inc_act/act_structure.php?do=4|'.$article[$akey]["article_id"]."|".
                        (($akey+2)*10)."|".$article[$akey+1]["article_id"]."|".(($akey+1)*10).
                        '" title="'.$GLOBALS['BL']['be_func_struct_sort_down'].'">':'';
                        $a .= "<img src=\"img/button/sort_2_".$sort_down.".gif\" width=\"11\" height=\"11\" border=\"0\">".(($sort_down)?"</a>":"");

                        //active und visible Status wechseln
                        $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=3,".$article[$akey]["article_id"].",,".(($article[$akey]["article_aktiv"])?0:1);
                        $a .= '" title="'.$GLOBALS["BL"]['be_func_struct_svisible'].'">';
                        $a .= "<img src=\"img/button/visible_11x11_".$article[$akey]["article_aktiv"].".gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=4,".$article[$akey]["article_id"].",,".(($article[$akey]["article_public"])?0:1);
                        $a .= '" title="'.$GLOBALS["BL"]['be_func_struct_spublic'].'">';
                        $a .= "<img src=\"img/button/public_11x11_".$article[$akey]["article_public"].".gif\" width=\"11\" height=\"11\" border=\"0\"></a>";

                        //Article Löschen
///////////////////////////////////////////////////////////////////////////////////////////
						if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"] || $hasPermission == true ) {
///////////////////////////////////////////////////////////////////////////////////////////
                                $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=1,".$article[$akey]["article_id"];
                                $a .= "\" title=\"".$GLOBALS['BL']['be_func_struct_del_article']." \n[".$at."]\" ";
                                $a .= "onClick=\"GP_popupConfirmMsg('".$GLOBALS['BL']['be_func_struct_del_jsmsg']." \\n[".js_singlequote($at)."] ');return document.MM_returnValue\">";
                                $a .= "<img src=\"img/button/del_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<img src=\"img/button/del_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\">";
                        }
                        $a .= "</td>\n</tr>\n";
                        echo $a;
//31-03-2005 Fernando Batista start-----------------------------------------------------------------------------------------------------------

			$sql  = "SELECT acontent_id, acontent_sorting, acontent_trash, acontent_block FROM ".DB_PREPEND."phpwcms_articlecontent ";
			$sql .= "WHERE acontent_aid=".$article[$akey]["article_id"]." ORDER BY acontent_block, acontent_sorting, acontent_id";
			if($result = mysql_query($sql, $GLOBALS['db']) or die("error while listing contents for this article")) {
				$sc = 0; $scc = 0; //Sort-Zwischenzähler
				while($row = mysql_fetch_row($result)) {
					$scc++;
					if($row[2] == 0) {
						$sc++;
						$sbutton[$sc]["id"]    = $row[0];
						$sbutton[$sc]["sort"]  = $row[1];
						$sbutton[$sc]["block"] = $row[3];
					}
				}
			}
			if($sc) {
				//Jetzt aufbauen der Sortieranweisung
				foreach($sbutton as $key => $value) {
					if($key == 1) {
						// if 1st content part in list
						$sbutton[$key]["top"] = "<img src=\"img/button/sort_1_0.gif\" border=\"0\">";
						
					} elseif(isset($sbutton[$key-1]["block"]) && $sbutton[$key-1]["block"] != $sbutton[$key]["block"]) {
						// if this content part is selected for different block than previous
						$sbutton[$key]["top"] = "<img src=\"img/button/sort_1_0.gif\" border=\"0\">";
						
					} else {
						$sbutton[$key]["top"] = "<a href=\"include/inc_act/act_articlecontent.php?sort=".
						$sbutton[$key]["id"].":".$sbutton[$key-1]["sort"]."|".
						$sbutton[$key-1]["id"].":".$sbutton[$key]["sort"].
						"\" title=\"".$GLOBALS["BL"]['be_article_cnt_up']."\"><img src=\"img/button/sort_1_1.gif\" border=\"0\"></a>";
	
					}
					if($key == $sc) {
						// if this is the last content part in list
						$sbutton[$key]["bottom"] = "<img src=\"img/button/sort_2_0.gif\" border=\"0\">";
					
					} elseif(isset($sbutton[$key+1]["block"]) && $sbutton[$key+1]["block"] != $sbutton[$key]["block"]) {
						// if this is the last content part in current block and next is different
					    $sbutton[$key]["bottom"] = "<img src=\"img/button/sort_2_0.gif\" border=\"0\">";
						
					} else {
						$sbutton[$key]["bottom"] = "<a href=\"include/inc_act/act_articlecontent.php?sort=".
						$sbutton[$key]["id"].":".$sbutton[$key+1]["sort"]."|".
						$sbutton[$key+1]["id"].":".$sbutton[$key]["sort"].
						"\" title=\"".$GLOBALS["BL"]['be_article_cnt_down']."\"><img src=\"img/button/sort_2_1.gif\" border=\"0\"></a>";

					}
					$sbutton_string[$sbutton[$key]["id"]] = $sbutton[$key]["top"].
					//changed - not neccessary - Oliver: 10-04-2005
					//"<img src=\"img/leer.gif\" width=\"1\" height=\"1\">".
					$sbutton[$key]["bottom"];
				}
				unset($sbutton);
			}

//-----------------------

/////////////////////////////////////////////////////////////////
//////////////// edit article depending on category permission // beta_bi
						if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"] || $hasPermission == true ) {
/////////////////////////////////////////////////////////////////
							if(isset($_SESSION["structure"]["article"][$article[$akey]["article_id"]]) && $_SESSION["structure"]["article"][$article[$akey]["article_id"]]) {
                        		struct_articlecontentlist ($article, $akey, $copy_article_content, $cut_article_content, $counter, $sbutton_string, $GLOBALS['db'], $beta_innertest);
                       		}
                        }
//31-03-2005 Fernando Batista  end-------------------

                }
        }
}


//31-03-2005 Fernando Batista start-----------------------------------------------------------------------------------------------------------


//////////////////////////////////////////////////////////////
function struct_articlecontentlist ($article, $akey, $copy_article_content, $cut_article_content, $counter, $sbutton_string, $db, $beta_innertest){

		$a = '';
	
         $sql =  "SELECT * FROM ".DB_PREPEND."phpwcms_articlecontent ".
                 "WHERE acontent_aid=".$article[$akey]["article_id"]." AND acontent_trash=0 ".
                 "ORDER BY acontent_block, acontent_sorting, acontent_id;";
         if($result = mysql_query($sql, $db) or die("error while listing contents for this article")) {

             while($article_content = mysql_fetch_assoc($result)) {

				if($cut_article_content == $article_content["acontent_id"] ) {
                       $a .= "<tr bgColor='#FFA801'>\n";
                }elseif($copy_article_content == $article_content["acontent_id"]){       
                	   $a .= "<tr bgColor='#FFA801'>\n";
				}else{
                       $a .= "<tr onMouseOver=\"this.bgColor='#FFDE01';\" onMouseOut=\"this.bgColor='#FFFFFF';\">\n";	//#F1F5F9							
				}					
                       $a .= "<td><img src=\"img/leer.gif\" width=\"".(14+14+29+(14*($counter-1)))."\" height=\"1\"><td>";	//$counter-1           
                       $a .= "<td align=\"right\"><img src=\"img/symbole/content_9x11.gif\" width=\"9\" height=\"11\" border=\"0\"><img src=\"img/leer.gif\" width=\"5\" height=\"1\"></td>";
                       $a .= "<td width=\"300\" class=\"v09\" style=\"color:#727889;\" style=\"padding-top:1px;padding-bottom:1px;\">";
                       $a .= "[ID:".$article_content["acontent_id"]."] ";
                       $a .= "<strong>".$GLOBALS["wcs_content_type"][$article_content["acontent_type"]]."</strong>";                       
                       $a .= "</td>";                                                   
                       $a .= "<td align=\"left\"><img src=\"img/leer.gif\" width=\"5\" height=\"1\"><img src=\"img/symbole/block.gif\" width=\"9\" height=\"11\" border=\"0\"><img src=\"img/leer.gif\" width=\"5\" height=\"1\"></td>";  
                       $a .= "<td width=\"150\" align=\"left\"  class=\"v09\" style=\"color:#727889;\">".htmlentities(' {'.$article_content['acontent_block'].'} ')."</td>";                     
                       $a .= '<td width="88" nowrap style="padding-top:1px;padding-bottom:1px;">';

					   $at = " [ID:".$article_content["acontent_id"]."] ".$GLOBALS["wcs_content_type"][$article_content["acontent_type"]]." ";                       

///////////////////////////////////////////////////////////////////////////////////////////
//////////////// edit article depending on category permission // beta_bi

// look if logged in user has got permission to edit category or not / max: 20 users
$hasPermission = false;

if ($beta_innertest == '') {
	// if no permissions are defined
	$hasPermission = true;
}
else {
	for ($loop = 0; $loop < 20; $loop++) {
		if ($_SESSION["wcs_user_id"] == $beta_innertest[$loop]) {
			$hasPermission = true;
			break;
		}
	}
}
						if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"] || $hasPermission == true ) {              
///////////////////////////////////////////////////////////////////////////////////////////
                                $a .= "<a href=\"phpwcms.php?do=articles&p=2&s=1&aktion=2&id=".$article[$akey]["article_id"]."&acid=".$article_content["acontent_id"];
                                $a .= "\" title=\"".$GLOBALS["BL"]['be_func_content_edit']." [".$at."]\">";
                                $a .= "<img src=\"img/button/edit_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<img src=\"img/button/edit_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\">";
                        }
//----------------
                                                                                 
                if($cut_article_content) {
                        if($cut_article_content != $article_content["acontent_id"]) {
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=7|".$cut_article_content."|".$article_content["acontent_aid"]."|".$article_content["acontent_sorting"];
                                $a .= "\" title=\"".$GLOBALS['BL']['be_func_content_paste'];
                                $a .= " [".$at."]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"";
                                $a .= $GLOBALS['BL']['be_func_content_paste_cancel']." [".$at."]";
                                $a .= "\"><img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                } else {
                        if($article_content["acontent_id"]) {
                                $a .= "<a href=\"phpwcms.php?do=articles&accut=".$article_content["acontent_id"]."\" title=\"";
                                $a .= $GLOBALS['BL']['be_func_content_cut']." [".$at;
                                $a .= "]\"><img src=\"img/button/cut_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$GLOBALS['BL']['be_func_content_no_cut']."\">";
                                $a .= "<img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                }
                if($copy_article_content) {
                        if($copy_article_content != $article_content["acontent_id"]) {
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=8|".$copy_article_content."|".$article_content["acontent_aid"]."|".$article_content["acontent_sorting"];
                                $a .= "\" title=\"".$GLOBALS['BL']['be_func_content_paste'];
                                $a .= " [".$at."]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"";
                                $a .= $GLOBALS['BL']['be_func_content_paste_cancel']." [".$at."]";
                                $a .= "\"><img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                } else {
                        if($article_content["acontent_id"]) {
                                $a .= "<a href=\"phpwcms.php?do=articles&accopy=".$article_content["acontent_id"]."\" title=\"";
                                $a .= $GLOBALS['BL']['be_func_content_copy']." [".$at;
                                $a .= "]\"><img src=\"img/button/copy_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$GLOBALS['BL']['be_func_content_no_copy']."\">";
                                $a .= "<img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                } 
                
                		$a .=$sbutton_string[$article_content["acontent_id"]];
                 
                        $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=2,".$article_content["acontent_aid"].",".$article_content["acontent_id"].",".(($article_content["acontent_visible"])?0:1);
                        $a .= '" title="'.$GLOBALS["BL"]['be_func_struct_svisible'].'">';
                        $a .= "<img src=\"img/button/visible_11x11_".$article_content["acontent_visible"].".gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
						
						// added space between visible icon and delete icon
						$a .= '<img src="img/leer.gif" width="11" height="1" border="0" alt="">';
///////////////////////////////////////////////////////////////////////////////////////////
                        if($article_content["acontent_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"] || hasPermission == true) {
///////////////////////////////////////////////////////////////////////////////////////////
                                $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=9,".$article_content["acontent_aid"].",".$article_content["acontent_id"];
                                $a .= "\" title=\"".$GLOBALS['BL']['be_article_cnt_delpart']." [".$at."]\" ";
                                $a .= "onClick=\"GP_popupConfirmMsg('".$GLOBALS['BL']['be_article_cnt_delpart']." \\n[".js_singlequote($at)."] ');return document.MM_returnValue\">";
                                $a .= "<img src=\"img/button/del_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<img src=\"img/button/del_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\">";
                        }
                        	                                         
//-------                                   
                        $a .= "</td>";
                        $a .= "\n</tr>";
            }
                
                		if($a){
                		$aa  = "<tr>\n<td colspan=\"2\">"; // bgColor=#F1F5F9 
                        $aa .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"538\">\n";
                		$aa .= $a;	
                 		$aa .= "</table></td></tr>";	
                		echo $aa;
                		}                                                          
         }
}
//31-03-2005 Fernando Batista  end-------------------




///////////////////////////////////////////////////////////////////////////////////////////
//////////////// edit article depending on category permission // beta_bi

//function listmode_edits ($listmode, $struct, $key, $an, $copy_article_content, $cut_article_content, $copy_article, $copy_id, $cut_article, $cut_id, $forbid_cut, $forbid_copy, $count_row, $child_sort) {
function listmode_edits ($listmode, $struct, $key, $an, $copy_article_content, $cut_article_content, $copy_article, $copy_id, $cut_article, $cut_id, $forbid_cut, $forbid_copy, $count_row, $child_sort, $beta_innertest) {
///////////////////////////////////////////////////////////////////////////////////////////

        //Unterscheidung, welche bearbeitungsfunktionen angezeigt werden sollen
        $a = ""; 
        switch($listmode) {
		
		
		
				// case 0 = structlevels in "structlevel and articlelist"
		
                case 0:                
				
///////////////////////////////////////////////////////////////////////////////////////////
//////////////// edit article depending on category permission // beta_bi

// look if logged in user has got permission to edit category or not / max: 20 users
$hasPermission = false;

if ($beta_innertest == '') {
	// if no permissions are defined
	$hasPermission = true;
}
else {
	for ($loop = 0; $loop < 20; $loop++) {
		if ($_SESSION["wcs_user_id"] == $beta_innertest[$loop]) {
			$hasPermission = true;
			break;
		}
	}
}
///////////////////////////////////////////////////////////////////////////////////////////
				if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"] || $hasPermission == true ) {
					$a .= "<a href=\"phpwcms.php?do=articles&p=1&struct=".$struct[$key]["acat_id"]."\" ";
                	$a .= "title=\"".$GLOBALS['BL']['be_func_struct_new_article']." \n[".$an."]\">";
                	$a .= "<img src=\"img/button/add_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
				}
				
				
///////////////////////////////////////////////////////////////////////////////////////////

                if($cut_article) { //Wenn ID zum Artikelausschneiden angegeben
                        $a .= "<a href=\"include/inc_act/act_structure.php?do=3|".$cut_article."|";
                        $a .= $struct[$key]["acat_id"]."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_article']." \n[".$an;
                        $a .= "]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                } else {
                        $a .= "<img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\">";
                }
                if($copy_article) {
                        $a .= "<a href=\"include/inc_act/act_structure.php?do=5|".$copy_article."|";
                        $a .= $struct[$key]["acat_id"]."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_article']." \n[".$an;
                        $a .= "]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                } else {
                        $a .= "<img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\">";
                }

                $a .= "<img src=\"img/button/sort_1_0.gif\" width=\"11\" height=\"11\" border=\"0\">";
                $a .= "<img src=\"img/button/sort_2_0.gif\" width=\"11\" height=\"11\" border=\"0\">";
                $a .= "<img src=\"img/button/visible_11x11a_".$struct[$key]["acat_aktiv"].".gif\" width=\"11\" height=\"11\" border=\"0\">";
                $a .= "<img src=\"img/button/public_11x11a_".$struct[$key]["acat_public"].".gif\" width=\"11\" height=\"11\" border=\"0\">";
                break;


				// case 0 = structlevels in "structlevel admin"



                case 1:          $a .= "<a href=\"phpwcms.php?do=admin&p=6&struct=".$struct[$key]["acat_id"]."&sort=".$child_sort."\" title=\"";
                $a .= $GLOBALS['BL']['be_func_struct_insert_level']." [".$an."]\"><img src=\"img/button/add_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";

                if($cut_id) {
                        if($cut_id != $struct[$key]["acat_id"] && !$forbid_cut) {
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=1|".$cut_id."|".$struct[$key]["acat_id"]."|";
                                $a .= $child_sort."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_level'];
                                $a .= " [".$an."]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6\" title=\"";
                                $a .= ($forbid_cut) ? $GLOBALS['BL']['be_func_struct_no_paste1']."\n[".$an."]\n".
                                $GLOBALS['BL']['be_func_struct_no_paste2']."\n".
                                $GLOBALS['BL']['be_func_struct_no_paste3'] :
                                $GLOBALS['BL']['be_func_struct_paste_cancel']." [".$an."]";
                                $a .= "\"><img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                } else {
                        if($struct[$key]["acat_id"]) {
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6&cut=".$struct[$key]["acat_id"]."\" title=\"";
                                $a .= $GLOBALS['BL']['be_func_struct_cut_level']." [".$an;
                                $a .= "]\"><img src=\"img/button/cut_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6\" title=\"".$GLOBALS['BL']['be_func_struct_no_cut']."\">";
                                $a .= "<img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                }
                if($copy_id) {
                        if($copy_id != $struct[$key]["acat_id"] && !$forbid_copy) {
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=6|".$copy_id."|".$struct[$key]["acat_id"]."|";
                                $a .= $child_sort."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_level'];
                                $a .= " [".$an."]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6\" title=\"";
                                $a .= ($forbid_copy) ? $GLOBALS['BL']['be_func_struct_no_paste1']."\n[".$an."]\n".
                                $GLOBALS['BL']['be_func_struct_no_paste2']."\n".
                                $GLOBALS['BL']['be_func_struct_no_paste3'] :
                                $GLOBALS['BL']['be_func_struct_paste_cancel']." [".$an."]";
                                $a .= "\"><img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                } else {
                        if($struct[$key]["acat_id"]) {
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6&cop=".$struct[$key]["acat_id"]."\" title=\"";
                                $a .= $GLOBALS['BL']['be_func_struct_copy_level']." [".$an;
                                $a .= "]\"><img src=\"img/button/copy_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6\" title=\"".$GLOBALS['BL']['be_func_struct_no_copy']."\">";
                                $a .= "<img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                }
                //if($struct[$key]["acat_id"]) {
                $a .= "<a href=\"phpwcms.php?do=admin&p=6&struct=";
                if($struct[$key]["acat_id"]) {
                        $a .= $struct[$key]["acat_struct"]."&cat=".$struct[$key]["acat_id"];
                } else {
                        $a .= 'index';
                }
                $a .= '" title="'.$GLOBALS['BL']['be_func_struct_sedit'].' ['.$an.']">';
                $a .= "<img src=\"img/button/edit_22x11.gif\" width=\"22\" height=\"11\" border=\"0\"></a>";
                //} else {
                //        $a .= "<img src=\"img/leer.gif\" width=\"22\" height=\"1\">";
                //}

                //Sortierungslink
                $sort_up        = (($count_row>1 && $key)?1:0);
                $sort_down        = (($count_row>1 && $key+1<$count_row)?1:0);

                //davor sortieren
                $a .= ($sort_up)? "<a href=\"include/inc_act/act_structure.php?do=2|".$struct[$key]["acat_id"]."|".($key*10)."|".$struct[$key-1]["acat_id"].
                "|".(($key+1)*10).'" title="'.$GLOBALS['BL']['be_func_struct_sort_up'].'">':'';
                $a .= "<img src=\"img/button/sort_1_".$sort_up.".gif\" width=\"11\" height=\"11\" border=\"0\">".(($sort_up)?"</a>":"");
                //dahinter sortieren
                $a .= ($sort_down)? "<a href=\"include/inc_act/act_structure.php?do=2|".$struct[$key]["acat_id"]."|".(($key+2)*10)."|".$struct[$key+1]["acat_id"].
                "|".(($key+1)*10).'" title="'.$GLOBALS['BL']['be_func_struct_sort_down'].'">':'';
                $a .= "<img src=\"img/button/sort_2_".$sort_down.".gif\" width=\"11\" height=\"11\" border=\"0\">".(($sort_down)?"</a>":"");

                if($struct[$key]["acat_id"]) {
                        $a .= "<a href=\"include/inc_act/act_structure.php?do=9|".$struct[$key]["acat_id"];
                        $a .= "\" title=\"".$GLOBALS['BL']['be_func_struct_del_struct']." [".$an."]\" ";
                        $a .= "onClick=\"GP_popupConfirmMsg('".$GLOBALS['BL']['be_func_struct_del_sjsmsg']." \\n\\n[".js_singlequote($an)."] ');return document.MM_returnValue\">";
                        $a .= "<img src=\"img/button/del_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                }
                break;

                default:        $a .= "&nbsp;";
        }
        return $a;
}

?>
///////////////////////////////////////////////
betabi
Posts: 26
Joined: Thu 23. Jun 2005, 17:28
Location: Hamburg
Contact:

Post by betabi »

///////////////////////////////////////////////
article.structlist.tmpl.php

Code: Select all

<?php
/*************************************************************************************
   Copyright notice
   
   (c) 2002-2005 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.

This script is part of PHPWCMS. The PHPWCMS web content management system is
free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.

The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
A copy is found in the textfile GPL.txt and important notices to the license
from the author is found in LICENSE.txt distributed with these scripts.

This script is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU General Public License for more details.

This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/

//19-11-2004 Fernando Batista -> Copy article, Copy strutures :http://fernandobatista.web.pt
//31-03-2005 Fernando Batista -> copy&cut Article Content :http://fernandobatista.web.pt

?><table width="538" border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2" class="title"><?php echo $BL['be_article_title'] ?></td></tr>
<tr><td colspan="2" class="title"><img src="img/leer.gif" width="1" height="4"></td></tr>
<tr><td colspan="2"><img src="img/lines/l538_70.gif" width="538" height="1"></td></tr>
<tr><td colspan="2"><img src="img/leer.gif" width="1" height="5"></td></tr>
<?php
//echo "<tr onMouseOver=\"this.bgColor='#CCFF00';\" onMouseOut=\"this.bgColor='#FFFFFF';\">\n";

$listmode = 0;
$cut_id = (isset($_GET["cut"])) ? intval($_GET["cut"]) : 0;
$cut_article = (isset($_GET["acut"])) ? intval($_GET["acut"]) : 0;

$copy_id = (isset($_GET["cop"])) ? intval($_GET["cop"]) : 0;
$copy_article = (isset($_GET["acopy"])) ? intval($_GET["acopy"]) : 0;

if(isset($_GET["open"])) {
        list($open_id, $open_value) = explode(":", $_GET["open"]);
        $_SESSION["structure"][intval($open_id)] = $open_value;
        mysql_query("UPDATE ".DB_PREPEND."phpwcms_user SET usr_var_structure='".serialize($_SESSION["structure"])."' WHERE usr_id=".$_SESSION["wcs_user_id"], $db);
}

//31-03-2005 Fernando Batista  start---------------------------------------------------------------------------
$cut_article_content = (isset($_GET["accut"])) ? intval($_GET["accut"]) : 0;
$copy_article_content = (isset($_GET["accopy"])) ? intval($_GET["accopy"]) : 0;
if(isset($_GET["opena"])) {
        list($open_id, $open_value) = explode(":", $_GET["opena"]);
        $_SESSION["structure"]["article"][intval($open_id)] = $open_value;
        mysql_query("UPDATE ".DB_PREPEND."phpwcms_user SET usr_var_structure='".serialize($_SESSION["structure"])."' WHERE usr_id=".$_SESSION["wcs_user_id"], $db);
}
//31-03-2005 Fernando Batista  end-------------------

$child_count = get_root_childcount(0, $db);
//$an = $BL['be_admin_struct_index'];
$an = $indexpage['acat_name'];

$a  = "<tr onMouseOver=\"this.bgColor='#CCFF00';\" onMouseOut=\"this.bgColor='#FFFFFF';\">\n";
$a .= "<td width=\"450\">";
$a .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n";
$a .= "<td nowrap>";
$a .= ($child_count) ? "<a href=\"phpwcms.php?do=articles&open=0:".(($_SESSION["structure"][0])?0:1)."\">" : "";
$a .= "<img src=\"img/symbole/plus_".(($child_count) ? (($_SESSION["structure"][0]) ? "close" : "open") : "empty");
$a .= ".gif\" width=\"15\" height=\"15\" border=\"0\">".(($child_count) ? "</a>" : "");
$a .= "<img src=\"img/symbole/page_1.gif\" width=\"11\" height=\"15\" alt=\"ID:0\"></td>\n";
$a .= "<td><img src=\"img/leer.gif\" width=\"2\" height=\"15\"></td>\n";
$a .= "<td class=\"dir\"><strong>".$an."</strong></td>\n</tr>\n</table></td>\n";

echo $a;
echo "<td width=\"88\" nowrap>";

$struct[0]["acat_id"]		= 0;
$struct[0]["acat_aktiv"]	= 1;
$struct[0]["acat_public"]	= 1;
$struct[0]["acat_struct"]	= 0;

///////////////////////////////////////////////////////////////////////////////////////////
//////////////// edit article depending on category permission // beta_bi
$beta_test = $indexpage['acat_permit'];
echo listmode_edits ($listmode, $struct, 0, $an, $copy_article_content, $cut_article_content, $copy_article, $copy_id, $cut_article, $cut_id, 0, 0, 0, 0,$beta_test);
echo "</td>\n</tr>\n";

if($_SESSION["structure"][0]) {
       struct_articlelist(0, 0, $copy_article_content, $cut_article_content, $copy_article, $cut_article, $indexpage['acat_order'],$beta_test);//$template_default["article_order"]
       struct_list(0, $db, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $cut_article, $listmode,$beta_test);
}
///////////////////////////////////////////////////////////////////////////////////////////

?>
<tr><td colspan="2"><img src="img/leer.gif" width="1" height="5"></td></tr>
<tr><td colspan="2"><img src="img/lines/l538_70.gif" width="538" height="1"></td></tr>
<tr><td colspan="2"><img src="img/leer.gif" width="1" height="4"></td></tr>
</table>
betabi
Posts: 26
Joined: Thu 23. Jun 2005, 17:28
Location: Hamburg
Contact:

Post by betabi »

2. Frontend editing

What does the hack do?
It gives logged in users the possibility while browsing the frontend to directly access the article's / contentpart's editor.
Wheather you get the "edit" button or not depends on the user's rights managed the way described above.

fig. 3

Image
Last edited by betabi on Sun 19. Feb 2006, 19:03, edited 1 time in total.
betabi
Posts: 26
Joined: Thu 23. Jun 2005, 17:28
Location: Hamburg
Contact:

Post by betabi »

update: content.article.inc.php !!!!!!!!!!!!!!!!!!!
line: 286 to 307

Code: Select all

<?php
/*************************************************************************************
Copyright notice

(c) 2002-2005 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.

This script is part of PHPWCMS. The PHPWCMS web content management system is
free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.

The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
A copy is found in the textfile GPL.txt and important notices to the license
from the author is found in LICENSE.txt distributed with these scripts.

This script is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU General Public License for more details.

This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/


// all for creating article
$sql  =	"SELECT *, UNIX_TIMESTAMP(article_tstamp) AS article_date ";
$sql .=	"FROM ".DB_PREPEND."phpwcms_article LEFT JOIN ".DB_PREPEND."phpwcms_articlecat ON ";
$sql .=	DB_PREPEND."phpwcms_article.article_cid=".DB_PREPEND."phpwcms_articlecat.acat_id WHERE ";
$sql .= DB_PREPEND."phpwcms_article.article_id=".$aktion[1]." AND ";
// VISIBLE_MODE: 0 = frontend (all) mode, 1 = article user mode, 2 = admin user mode
switch(VISIBLE_MODE) {
	case 0: $sql .= DB_PREPEND."phpwcms_article.article_public=1 AND ";
			$sql .= DB_PREPEND."phpwcms_article.article_aktiv=1 AND ";
			break;
	case 1: $sql .= DB_PREPEND."phpwcms_article.article_uid=".$_SESSION["wcs_user_id"]." AND ";
			break;
	//case 2: admin mode no additional neccessary
}
$sql .= DB_PREPEND."phpwcms_article.article_deleted=0 AND ".DB_PREPEND."phpwcms_article.article_begin<NOW() ";
$sql .= "AND ".DB_PREPEND."phpwcms_article.article_end>NOW() LIMIT 1;";

if($result = mysql_query($sql, $db) or die("error while reading article datas")) {
	if($row = mysql_fetch_assoc($result)) {
		//Da max. 1 Datensatz -> sofort Datenbankverbindung kappen
		mysql_free_result($result);
		
		// now try to retrieve alias article information
		if($row["article_aliasid"]) {
			$alias_sql  = "SELECT *, UNIX_TIMESTAMP(article_tstamp) AS article_date FROM ".DB_PREPEND."phpwcms_article ";
			$alias_sql .= "WHERE article_deleted=0 AND article_id=".intval($row["article_aliasid"]);
			if(!$row["article_headerdata"]) {
				switch(VISIBLE_MODE) {
					case 0: $alias_sql .= " AND article_public=1 AND article_aktiv=1";
								break;
					case 1: $alias_sql .= " AND article_uid=".$_SESSION["wcs_user_id"];
								break;
				}
				$alias_sql .= " AND article_begin < NOW() AND article_end > NOW()";
			}
			$alias_sql .= " AND article_deleted=0 LIMIT 1";
			if($alias_result = mysql_query($alias_sql, $db)) {
				if($alias_row = mysql_fetch_assoc($alias_result)) {
					$row["article_id"] = $alias_row["article_id"];
					// use alias article header data
					if(!$row["article_headerdata"]) {
						$row["article_title"]		= $alias_row["article_title"];
						$row["article_subtitle"]	= $alias_row["article_subtitle"];
						$row["article_keyword"]		= $alias_row["article_keyword"];
						$row["article_summary"]		= $alias_row["article_summary"];
						$row["article_redirect"]	= $alias_row["article_redirect"];
						$row["article_date"]		= $alias_row["article_date"];
						$row["article_image"]		= $alias_row["article_image"];
					}
				}
				mysql_free_result($alias_result);
			}
		}

		//Kategoriebezeichner
		$article["cat"] = ($row["acat_name"]) ? $row["acat_name"] : $indexpage['acat_name'];
		$article['cat'] = html_specialchars($article['cat']);

		//redirection definition
		if($row["article_redirect"]) {

			$row["article_redirect"] = str_replace('{SITE}', PHPWCMS_URL, $row["article_redirect"]);
			list($content["redirect"]["link"], $content["redirect"]["target"]) = explode(" ", $row["article_redirect"]);

			//check how to redirect - new window or self window
			if(	!$content["redirect"]["target"]	|| $content["redirect"]["target"] == "_self" ||
			$content["redirect"]["target"] == "_top" ||	$content["redirect"]["target"] == "_parent") {
				// direct redirection in the same window
				header("Location: ".$content["redirect"]["link"]);
				exit();
			} else {
				// redirection by using a special <meta><javascript> html head part
				$content["redirect"]["code"]  = "\n<noscript>\n";
				$content["redirect"]["code"] .= '<meta http-equiv="refresh" content="0;URL=';
				$content["redirect"]["code"] .= $content["redirect"]["link"];
				$content["redirect"]["code"] .= "\">\n</noscript>\n";
				$content["redirect"]["code"] .= '<script language="JavaScript" type="text/javascript">';
				$content["redirect"]["code"] .= "\n<!--\nvar redirectWin;\n";
				$content["redirect"]["code"] .= 'window.open("'.$content["redirect"]["link"].'", redirectWin);';
				$content["redirect"]["code"] .= "\n//-->\n</script>\n";
			}
		}

		//set cache timeout for this article
		if($row['article_cache'] != '') {
			$phpwcms['cache_timeout'] = $row['article_cache'];
		}
		//get value for article search (on/off)
		if($row['article_nosearch'] != '') {
			$cache_searchable = '1';
		}

		//add category and article name to $content["pagetitle"]
		if($row["acat_name"] && !empty($pagelayout["layout_title_cat"])) {
			if($content["pagetitle"]) {
				$content["pagetitle"] .= " | ";
			}
			$content["pagetitle"] .= $row["acat_name"];
		}
		if($row["article_title"] && !empty($pagelayout["layout_title_article"])) {
			if($content["pagetitle"]) {
				$content["pagetitle"] .= " | ";
			}
			$content["pagetitle"] .= $row["article_title"];
		}
		$content["pagetitle"] = html_specialchars($content["pagetitle"]);
		$content['all_keywords'] = $row['article_keyword'];

		$content["main"] .= "<a name=\"jump".$row["article_id"]."\"></a>";

		// only copy the catname to a special var for multiple for use in any block
		$content["cat"]			= html_specialchars($article["cat"]);
		$content["cat_id"]		= $aktion[0] = $row["article_cid"]; //set category ID to actual category value
		$content["article_id"] 	= $row["article_id"];
		$content["summary"]		= '';

		$content["article_date"] = $row["article_date"]; // article date
		$content["article_created"] = $row["article_created"]; // article created

		//retrieve image info
		$row["article_image"] = unserialize($row["article_image"]);
		$caption	= explode('|', $row["article_image"]["caption"]);
		$row["article_image"]["caption"] = $caption[0]; //$caption[0]
				
		//build image/image link
		$thumb_image = false;
		$thumb_img = '';
		if(!empty($row["article_image"]["hash"])) {

			$thumb_image = get_cached_image(
			array(	"target_ext"	=>	$row["article_image"]['ext'],
					"image_name"	=>	$row["article_image"]['hash'] . '.' . $row["article_image"]['ext'],
					"max_width"		=>	$row["article_image"]['width'],
					"max_height"	=>	$row["article_image"]['height'],
					"thumb_name"	=>	md5($row["article_image"]['hash'].$row["article_image"]['width'].$row["article_image"]['height'].$GLOBALS['phpwcms']["sharpen_level"])
			));

			if($thumb_image != false) {
			
				$caption[1] = (!isset($caption[1])) ? '' : html_specialchars($caption[1]);
				if(!isset($caption[2])) {
					$caption[2] = array('',' target="_blank"');
				} else {
					//proof target of link
					$caption[2] = explode(' ', trim($caption[2]));
					$caption[2][1] = (!isset($caption[2][1])) ? '' : ' target="'.$caption[2][1].'"';
				}
			
				$thumb_img = '<img src="'.PHPWCMS_IMAGES . $thumb_image[0] .'" border="0" '.$thumb_image[3].' alt="'.$caption[1].'" title="'.$caption[1].'">';

				if($row["article_image"]["zoom"]) {

					$zoominfo = get_cached_image(
					array(	"target_ext"	=>	$row["article_image"]['ext'],
					"image_name"	=>	$row["article_image"]['hash'] . '.' . $row["article_image"]['ext'],
					"max_width"		=>	$GLOBALS['phpwcms']["img_prev_width"],
					"max_height"	=>	$GLOBALS['phpwcms']["img_prev_height"],
					"thumb_name"	=>	md5($row["article_image"]['hash'].$GLOBALS['phpwcms']["img_prev_width"].$GLOBALS['phpwcms']["img_prev_height"].$GLOBALS['phpwcms']["sharpen_level"])
					));

					if($zoominfo != false) {
					
						$popup_img = 'image_zoom.php?show='.base64_encode($zoominfo[0].'?'.$zoominfo[3]);
					
						if(!empty($caption[2][0])) {
							$open_link = $caption[2][0];
							$return_false = '';
						} else {
							$open_link = $popup_img;
							$return_false = 'return false;';
						}

						$thumb_img = '<a href="'.$popup_img.'" onClick="window.open(\''.$open_link.
						"','previewpic','width=".$zoominfo[1].",height=".$zoominfo[2]."');".$return_false.
						'"'.$caption[2][1].'>'.$thumb_img.'</a>';
						
						
					}
				} else {
						
					if($caption[2][0]) {
						$thumb_img = '<a href="'.$caption[2][0].'"'.$caption[2][1].'>'.$thumb_img.'</a>';
					}
				}
			}
		}

		// check for custom full article summary template
		if(!empty($row["article_image"]['tmplfull']) && $row["article_image"]['tmplfull']!='default') {
			// try to read the template files
			$row["article_image"]['tmplfull'] = include_ext_php(PHPWCMS_TEMPLATE.'inc_cntpart/articlesummary/article/'.$row["article_image"]['tmplfull'], 1);
			if($row["article_image"]['tmplfull']) {
				//rendering
				$row["article_image"]['tmplfull'] = render_cnt_template($row["article_image"]['tmplfull'], 'TITLE', html_specialchars($row["article_title"]));
				$row["article_image"]['tmplfull'] = render_cnt_template($row["article_image"]['tmplfull'], 'SUB', html_specialchars($row["article_subtitle"]));
				$row["article_image"]['tmplfull'] = render_cnt_template($row["article_image"]['tmplfull'], 'SUMMARY', $row["article_summary"]);
				$row["article_image"]['tmplfull'] = render_cnt_template($row["article_image"]['tmplfull'], 'IMAGE', $thumb_img);
				$row["article_image"]['tmplfull'] = render_cnt_template($row["article_image"]['tmplfull'], 'CAPTION', nl2br(html_specialchars($row["article_image"]["caption"])));
				$row["article_image"]['tmplfull'] = render_cnt_date($row["article_image"]['tmplfull'], $content["article_date"]);
				$content["summary"] .= $row["article_image"]['tmplfull'];
				$row["article_image"]['tmplfull'] = 1;
			} else {
				$row["article_image"]['tmplfull'] = 0;
			}
		}

		if (empty($row["article_image"]['tmplfull']) || $row["article_image"]['tmplfull'] == 'default') {
			//Artikelüberschrift, Subheadline, Summary
			if($row["article_title"] && !$row["article_notitle"]) {
				$content["summary"] .= $template_default["article"]["title_before"];
				$content["summary"] .= html_specialchars($row["article_title"]); //span_class(html_specialchars($row["article_title"]),$template_default["article"]["title_class"]).
				$content["summary"] .= $template_default["article"]["title_after"];
			}
			if($row["article_subtitle"]) {
				$content["summary"] .= $template_default["article"]["subtitle_before"];
				$content["summary"] .= html_specialchars($row["article_subtitle"]); //span_class(html_specialchars($row["article_subtitle"]),$template_default["article"]["subtitle_class"]).
				$content["summary"] .= $template_default["article"]["subtitle_after"];
			}
			if(($row["article_summary"] || !empty($thumb_img)) && !$row["article_hidesummary"]) {
				$content["summary"] .= $template_default["article"]["summary_before"];
				if(!empty($thumb_img)) {
					$content["summary"] .= '<table width="1%" cellspacing="0" border="0" cellpadding="0" align="left" ';
					if($template_default["article"]["image_table_bgcolor"]) {
						$content["summary"] .= 'bgcolor="'.$template_default["article"]["image_table_bgcolor"].'" ';
					}
					$content["summary"] .= 'style="float:left;margin:2px 5px 3px 0;">';
					$content["summary"] .= "\n<tr><td";
					if($template_default["article"]["image_class"]) {
						$content["summary"] .= ' class="'.$template_default["article"]["image_class"].'"';
					}
					$content["summary"] .= ">".$thumb_img."</td></tr>\n";
					if($row["article_image"]["caption"]) {
						//$content["summary"] .= '<tr><td><img src="img/leer.gif" alt="" width="1" height="3"></td></tr>';
						$content["summary"] .= "\n<tr><td";

						if($template_default["article"]["image_caption_class"]) {
							$content["summary"] .= ' class="'.$template_default["article"]["image_caption_class"].'"';
						}
						if($template_default["article"]["image_caption_bgcolor"]) {
							$content["summary"] .= ' bgcolor="'.$template_default["article"]["image_caption_bgcolor"].'"';
						}
						if($template_default["article"]["image_caption_valign"]) {
							$content["summary"] .= ' valign="'.$template_default["article"]["image_caption_valign"].'"';
						}
						if($template_default["article"]["image_caption_align"]) {
							$content["summary"] .= ' align="'.$template_default["article"]["image_caption_align"].'"';
						}
						$content["summary"] .= '>';
						$content["summary"] .= $template_default["article"]["image_caption_before"];
						$content["summary"] .= nl2br(html_specialchars($row["article_image"]["caption"]));
						$content["summary"] .= $template_default["article"]["image_caption_after"];
						$content["summary"] .= "</td></tr>\n";
					}
					$content["summary"] .= '</table>';
				}
				$content["summary"] .= $row["article_summary"]; //div_class($row["article_summary"],$template_default["article"]["summary_class"]).
				$content["summary"] .= $template_default["article"]["summary_after"];
			}
		}
		if($content["summary"]) {
			$content["main"] .= $content["summary"];
		
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// add link to edit article basic information / beta_bi

// look if logged in user has got permission to edit category or not / max: 20 users
$hasPermission = false;
if ($GLOBALS['content']['struct'][$GLOBALS['content']['cat_id']]['acat_permit'][0] == '' && $_SESSION["wcs_user_id"] !="") {
	// if no permissions are defined
	$hasPermission = true;
}
else {

	for ($loop = 0; $loop < 20; $loop++) {
		if ($_SESSION["wcs_user_id"] == $GLOBALS['content']['struct'][$GLOBALS['content']['cat_id']]['acat_permit'][$loop] && $_SESSION["wcs_user_id"] !="") {
			$hasPermission = true;
			break;
		}
	}
}
				if($row["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"] || $hasPermission == true) {
				$content["main"] .= "<div ><a style=\"color:#f00; background-color:#fff\" href=\"phpwcms.php?do=articles&p=2&s=1&id=".$GLOBALS['content']['article_id']."&aktion=1\" target=\"_blank\">[edit]</a></div>";
			}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////		
			$content["main"] .= $template_default["article"]["head_after"];
		}

		// render content parts
		$sql_cnt  = "SELECT * FROM ".DB_PREPEND."phpwcms_articlecontent WHERE acontent_aid=".$row["article_id"]." ".
					"AND acontent_visible=1 AND acontent_trash=0 ORDER BY acontent_sorting, acontent_id;";
		if($cresult = mysql_query($sql_cnt, $db) or die("error while listing contents for this article")) {
			while($crow = mysql_fetch_assoc($cresult)) { // 24-07-2005 mysql_fetch_array
			
				// do everything neccessary for alias content part
				if($crow["acontent_type"] == 24) {
					// first retrieve alias ID information and settings
					$content["thisAlias"] = unserialize($crow["acontent_form"]);
					if(!empty($content["thisAlias"]['alias_ID'])) {
						$content["thisAlias"]['alias_ID'] = intval($content["thisAlias"]['alias_ID']);
						$sql_alias  = "SELECT * FROM ".DB_PREPEND."phpwcms_articlecontent WHERE acontent_id=";
						$sql_alias .= $content["thisAlias"]['alias_ID'];
						$sql_alias .= " AND acontent_trash=0 LIMIT 1"; //AND acontent_visible=1 
						if($alias_result = mysql_query($sql_alias, $db)) {
							if($alias_row = mysql_fetch_assoc($alias_result)) {
								if(empty($content["thisAlias"]['alias_block'])) {
									$alias_row['acontent_block'] = $crow['acontent_block'];
								}
								if(empty($content["thisAlias"]['alias_spaces'])) {
									$alias_row['acontent_before'] = $crow['acontent_before'];
									$alias_row['acontent_after']  = $crow['acontent_after'];
								}
								if(empty($content["thisAlias"]['alias_title'])) {
									$alias_row['acontent_title']     = $crow['acontent_title'];
									$alias_row['acontent_subtitle']  = $crow['acontent_subtitle'];
								}
								if(empty($content["thisAlias"]['alias_toplink'])) {
									$alias_row['acontent_top'] = $crow['acontent_top'];
								}
								$crow = $alias_row;
							}
							mysql_free_result($alias_result);
						}
					}
				}
			
				// every article content  will be rendered into temp var 
				$CNT_TMP = '';

				// Space before
				if($crow["acontent_before"]) {
					if(!empty($template_default["article"]["div_spacer"])) {
						$CNT_TMP .= '<div style="margin:'.$crow["acontent_before"].'px 0 0 0; padding:0 0 0 0; clear:both;"></div>';
					} else {
						$CNT_TMP .= "<br>".spacer(1,$crow["acontent_before"]);
					}
				}
				
				// include content part code section
				include("include/inc_front/content/cnt".$crow["acontent_type"].".article.inc.php");

				//check if top link should be shown
				if($crow["acontent_top"]) {
					if($template_default["article"]["top_sign_before"].$template_default["article"]["top_sign_after"]) {
						$CNT_TMP .= $template_default["article"]["top_sign_before"];
						$CNT_TMP .= '<a href="#top">'.$template_default["article"]["top_sign"].'</a>';
						$CNT_TMP .= $template_default["article"]["top_sign_after"];
					} else {
						$CNT_TMP .= '<br><a href="#top">'.$template_default["article"]["top_sign"].'</a>';
					}
				}
				

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// add link to edit article content parts / beta_bi

			if($row["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"] || $hasPermission == true) {
				$CNT_TMP .= "<div ><a style=\"color:#ff0000; background-color:#fff\" href=\"phpwcms.php?do=articles&p=2&s=1&id=".$GLOBALS['content']['article_id']."&aktion=2&id=".$row["article_id"]."&acid=".$crow["acontent_id"]."\" target=\"_blank\">[edit]</a></div>";
			}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
				
				
				// Space after
				if($crow["acontent_after"]) {
					if(!empty($template_default["article"]["div_spacer"])) {
						$CNT_TMP .= '<div style="margin:0 0 '.$crow["acontent_after"].'px 0; padding:0 0 0 0; clear:both;"></div>';
					} else {
						$CNT_TMP .= "<br>".spacer(1,$crow["acontent_after"]);
					}
				}
				
				// now add rendered content part to right frontend content 
				// var given by block -> $content['CB'][$crow['acontent_block']]
				if($crow['acontent_block'] == '' || $crow['acontent_block'] == 'CONTENT') {
					// default content block
					$content["main"] .= $CNT_TMP;
				} else {
					// check if content block var is set
					if(!isset($content['CB'][$crow['acontent_block']])) {
						$content['CB'][$crow['acontent_block']] = '';
					}
					$content['CB'][$crow['acontent_block']] .= $CNT_TMP;
				}
				
				

			}
			mysql_free_result($cresult);
		}
	}
}

if(empty($template_default["article"]["div_spacer"])) {
	$content["main"] = str_replace("</table>\n<br>", "</table>\n", $content["main"]);
	$content["main"] = str_replace("</table><br>", "</table>", $content["main"]);
	$content["main"] = str_replace("</div><br>", "</div>", $content["main"]);
}

?>
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

Hi Betabi 8)
I really like the possibility to directly go to edit any article
directly from the frontend.
This hack sounds really like a big plus.
Although... Did anyone sucessfully got it to work? :roll:
betabi wrote:2. Frontend editing

What does the hack do?
It gives logged in users the possibility while browsing the frontend to directly access the article's / contentpart's editor.
Wheather you get the "edit" button or not depends on the user's rights managed the way described above.

fig. 3

Image
Cheers,
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
User avatar
Kosse
Posts: 1066
Joined: Thu 9. Sep 2004, 12:08
Location: Brussels, Belgium
Contact:

Post by Kosse »

StudioZ wrote:Hi Betabi 8)
I really like the possibility to directly go to edit any article
directly from the frontend.
This hack sounds really like a big plus.
Although... Did anyone sucessfully got it to work? :roll:
Just tested it, works ...almost .... like a charm!!!!

This can be a MAJOR breakthrough 4 phpwcms again,
beta-bi you've managed to add the frontend editing feature to phpwcms!
My most kind respects :D and admiration :shock: and WOOOOOOOOOW to u and xxxxxxxxx thanks!

EDITED: Oops, but in backend some bugs still...

Code: Select all

Warning: Missing argument 15 for listmode_edits() in /home/www/xxxxxxxxxxxxx/web/include/inc_lib/admin.functions.inc.php on line 528

Code: Select all

Warning: Missing argument 8 for struct_articlelist() in /home/www/xxxxxxxxxxxxx/web/include/inc_lib/admin.functions.inc.php on line 149
Not big bugs apparently, but some missing argument somewhere... doesn't like $beta_innertest ???

Cheers

PS: just a short note on how BIG events can be overlooked when there are no live examples ;)
betabi
Posts: 26
Joined: Thu 23. Jun 2005, 17:28
Location: Hamburg
Contact:

Post by betabi »

StudioZ wrote:Hi Betabi 8)
I really like the possibility to directly go to edit any article
directly from the frontend.
This hack sounds really like a big plus.
Although... Did anyone sucessfully got it to work?


well, it does work for me of course.
after having changed the "content.article.inc.php"-file you just have to log in first . take the admin (so you won't have the assign any rights). then launch the frontend-view (by clicking any article for example): now you should get the [edit]-link for any content-part (it does not work for article listings).

hope this will help you.
User avatar
Kosse
Posts: 1066
Joined: Thu 9. Sep 2004, 12:08
Location: Brussels, Belgium
Contact:

Post by Kosse »

betabi wrote:
StudioZ wrote:Hi Betabi 8)
I really like the possibility to directly go to edit any article
directly from the frontend.
This hack sounds really like a big plus.
Although... Did anyone sucessfully got it to work?


well, it does work for me of course.
after having changed the "content.article.inc.php"-file you just have to log in first . take the admin (so you won't have the assign any rights). then launch the frontend-view (by clicking any article for example): now you should get the [edit]-link for any content-part (it does not work for article listings).

hope this will help you.
I works perfectly as you say Betabi, nevertheless, in backend the Mysql warnings appear... so I guess that's the last thing to do and your addition would be PERFECT (article listing is not that a big deal, as they are often attached to an article -with html content part- itself).
The big plus is actually not having to scroll like a madman into backend to find the article you want to change, but simple click on your edit buttons, big improvment for huge sites or mutlilingual ones.

Cheers
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

Kosse wrote: I works perfectly as you say Betabi, nevertheless, in backend the Mysql warnings appear... so I guess that's the last thing to do and your addition would be PERFECT (article listing is not that a big deal, as they are often attached to an article -with html content part- itself).
The big plus is actually not having to scroll like a madman into backend to find the article you want to change, but simple click on your edit buttons, big improvment for huge sites or mutlilingual ones.

Cheers
Yep :wink:
Very well explained Kosse :D
Myself too, working on "huge sites or mutlilingual ones" I can only say that Betabi's hack is a MUST for phpWCMS.
Wish we can get the backend errors out soon :wink: 8)

Cheers,
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

wow

Post by phalancs »

i did not imagine how much fun this is. This is great. I have changed it a little bit, so that only admins have access. But it is a very big thing!

The problem is that that i have installed the user - section right tweak, and i guess i cannot combine this tweak with yours.

The user selection field is used for giving read access rights there and not for giving write rights.

hmm, needs some dev. i guess.
2008
jareeq
Posts: 22
Joined: Wed 15. Feb 2006, 21:49
Contact:

Post by jareeq »

this is realy good, now I'm only waiting for groups administration in some future version of phpwcms an I'l be happy.


this is realy good enhancement
st3fek
Posts: 17
Joined: Thu 4. Aug 2005, 11:17
Location: Poland, Sosnowiec
Contact:

Post by st3fek »

Hi betabi!

I'm wondering is your hack will be compatible with latest PHPWCMS version?
Anyway I'll try to implement it with newest version...

Best regards,
Stefan
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

Post by phalancs »

it is.
2008
netkiller
Posts: 26
Joined: Fri 7. Jan 2005, 10:43

Post by netkiller »

it woks fine!!

ThX for this mod :D
Post Reply