copy articles and structures (patch)

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
fbatista
Posts: 36
Joined: Tue 2. Nov 2004, 21:53
Location: Portugal
Contact:

copy articles and structures (patch)

Post by fbatista »

Hi

I increased the functions of copying

This allows to copy articles and structures in the front end.
Link: http://ww2.estg.ipleiria.pt/~fbatista/p ... hp?phpwcms

Regards
Fernando Batista

[UPDATE 21-11-2004 by Oliver]
http://www.phpwcms.de/forum/viewtopic.php?p=26692#26692
User avatar
isac
Posts: 410
Joined: Tue 18. Nov 2003, 13:13
Location: Portugal
Contact:

Post by isac »

Link don't work :?:
bachi
Posts: 308
Joined: Fri 6. Aug 2004, 17:52
Location: Western Styria, AUSTRIA
Contact:

Post by bachi »

It works...

A very fine mod :D
I like it
cyrano
Posts: 1598
Joined: Sat 31. Jan 2004, 18:33
Location: Stuttgart
Contact:

Post by cyrano »

I also can't get the link working...
Gruß/ regards cyrano
--------------------------------------------------------
templates -> http://www.128.weitzelmedia.de
planepix -> http://www.planepix.de
XING -> https://www.xing.com/profile/Thomas_Weitzel3
User avatar
Oliver Georgi
Site Admin
Posts: 9913
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

Great work - I have it implemented.

Here are some optimized buttons:
http://www.phpwcms.de/support/button.zip

...and there is a bug in act_structure.php (small mistake):

Code: Select all

function copy_article_to_level($do, $dbcon) {

         $sql  = "SELECT * FROM ".DB_PREPEND."phpwcms_article WHERE article_deleted=0 AND article_id=".$do[1].";";
               if($result = mysql_query($sql, $dbcon) or die("error while connecting to database: <br><pre>".$sql."</pre>")) {

                            if($row = mysql_fetch_assoc($result)) {
                                      $row["article_cid"] = $do[2];
                                      $row["article_created"] = time();

                                      foreach($row as $key => $value) {
                                              if($key == "article_id" ){
                                                 $keys   = $key;
                                                 $values = "''";
                                              }else{
                                                    $keys   .= ", ".$key;
                                                    $values .= ", '".$value."'";
                                              }
                                      }
                            }
                            mysql_free_result($result);

                   $sql =  "INSERT INTO ".DB_PREPEND."phpwcms_article (".$keys.") VALUES (".$values.");" ;

                        if($result = mysql_query($sql, $dbcon) or die("error while copy article <br>error while connecting to database: <br><pre>".$sql."</pre>")) {

                           $article_insert_id = mysql_insert_id($dbcon);
//a small bug ===============================================
                           //mysql_free_result($result);
//===========================================================

                           $sql1  = "SELECT * FROM ".DB_PREPEND."phpwcms_articlecontent WHERE acontent_aid=".$do[1].";";
                                  if($result1 = mysql_query($sql1, $dbcon) or die("error sql")) {
                                     while ($row1 = mysql_fetch_array($result1, MYSQL_ASSOC)) {
                                           $row1["acontent_aid"] = $article_insert_id;
                                           foreach($row1 as $key1 => $value1) {
                                                   if($key1 == "acontent_id" ){
                                                      $key1s   = $key1;
                                                      $value1s = "''";
                                                   }else{
                                                         $key1s   .= ", ".$key1;
                                                         $value1s .= ", '".$value1."'";
                                                   }
                                           }
                                           $sql2 =  "INSERT INTO ".DB_PREPEND."phpwcms_articlecontent (".$key1s.") VALUES (".$value1s.");" ;
                                           $result = mysql_query($sql2, $dbcon) or die("error while copy article content <br>error while connecting to database: <br><pre>".$sql2."</pre>");
                                     }
                                     mysql_free_result($result1);
                                  }

                           }

               }
}
Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
cyrano
Posts: 1598
Joined: Sat 31. Jan 2004, 18:33
Location: Stuttgart
Contact:

Post by cyrano »

hi oliver,

is this the code we could get when the link is working?

where to replace/add it?
Gruß/ regards cyrano
--------------------------------------------------------
templates -> http://www.128.weitzelmedia.de
planepix -> http://www.planepix.de
XING -> https://www.xing.com/profile/Thomas_Weitzel3
spirelli
Posts: 996
Joined: Tue 27. Jul 2004, 13:37
Location: London

Post by spirelli »

Wow, very nice, Fernando.
Link is working for me.
User avatar
Oliver Georgi
Site Admin
Posts: 9913
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

OK - The original download link seems not to work anymore.

I have fixed some additional things in the MOD files. Here are all files again including new button images and patched language files.
http://prdownloads.sourceforge.net/phpw ... p?download

It's no MOD anymore - it's official :)

But!!! Backup database and older files before upgrading. Maybe there are bugs I haven't found.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
sustia
Posts: 651
Joined: Fri 2. Apr 2004, 22:29
Location: Lecce (Italy)
Contact:

Post by sustia »

Great!
It works very fine and it's really useful to clone a section in order to, for istance, clone a section an make a new language section.

Great work fbatista :D
Campeones del mundo!
Vegetables!
herbu
Posts: 31
Joined: Mon 10. Nov 2003, 10:46

Fatal error:

Post by herbu »

Ich habe das Problem, dass ich in der Artikelstruktur folgende Fehlermeldung erhalte:
Fatal error: Call to undefined function: get_order_sort() in /xxx/xxxx/xx/xxxx/xxxxx/include/inc_lib/admin.functions.inc.php on line 77
In der Adminstruktur funktioniert alles einwandfrei. Hat jehmand eine Lösung.
User avatar
Oliver Georgi
Site Admin
Posts: 9913
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

Ich habe dieses Verhalten auch gesehen - und zwar wenn der Zend Optimizer in Version 2.1 genutzt wird. Ich konnte das Ergebnis reproduzieren und habe sofort mit Optimizer 2.5.5 (Apache/Windows) getestet - saubere Installation - alles in Ordnung.

Ich kann nur warnen - der Zend Optimizer bringt nichts, solange man keine encodierten PHP Scripte benutzt. Wenn PHP Beschleunigung dann nur Turck MMCache.

---

I have seen this too yesterday on a system running PHP in combination with Zend Optimizer 2.1. I can not recommend Zend Optimizer as long as you use encoded PHP scripts. For PHP acceleration use Turck MMCache only. I have tried using Zend Optimizer 2.5.5 on Windows - and it works. So if you need Optimizer - update to most current release of Zend Optimizer.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
nekket
Posts: 613
Joined: Tue 18. Nov 2003, 15:46
Location: Baden-Baden
Contact:

Post by nekket »

Das Kopieren von Artikeln und Strukturen klappt bei mir, aber nicht immer. Bei machen Strukturen mit viel Content bringt er eine Fehlermeldung:
error while copy article content
error while connecting to database:.....

Jemand gleiche Probleme?
Pappnase

Post by Pappnase »

nekket wrote:Das Kopieren von Artikeln und Strukturen klappt bei mir, aber nicht immer. Bei machen Strukturen mit viel Content bringt er eine Fehlermeldung:
error while copy article content
error while connecting to database:.....

Jemand gleiche Probleme?
hello

look at this!

http://www.phpwcms.de/forum/viewtopic.php?t=4524
User avatar
Oliver Georgi
Site Admin
Posts: 9913
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

OK,
I have patched the copy article/structure a very litte bit - now special chars are escaped before sent back to MySQL.

http://prdownloads.sourceforge.net/phpw ... p?download

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
harrybo
Posts: 23
Joined: Wed 2. Feb 2005, 16:27

Post by harrybo »

I'm using Release 1.1-RC4 27-08-2004 and I just installed the patch, it took me about two minutes. PHANTASTIC! Thank you, Fernando and Oliver for your great work and for saving me hours to offer a second language section for a quite complex existing structure.

Regards
Harry
Post Reply