[RC] Import old .paks files :idea:

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Anti-Spam Guide
User avatar
AGC
Registered User
Posts: 292
Joined: Sat Sep 15, 2007 10:26 pm

[RC] Import old .paks files :idea:

Post by AGC »

If you want to import an old* .pak file. *(phpBB2 vers. which are not support in phpBB3)
Now you can Download a packed zip file.

OR
You can add this code to "acp_icons.php", look for "}" sign at Line 418* (apprx.),
and adds the entire code after that line as it is. :shock: * see important notes

Note: There are commeted (/*) lines for the 'replace' command (I think it's not needed), but if you want it uncommet these lines. :) Enjoy. ;)

Code: Select all

						else if ($data= split('=\+:',$pak_entry))
						{
							$img = stripslashes($data[0]);
							list($width, $height ) = getimagesize($phpbb_root_path . $img_path."/".$img);
							$display_on_posting = '1'; 
							if (isset($data[1]) && isset($data[2]))
							{
								$emotion = stripslashes($data[1]);
								$code = trim(str_replace('"',""",$data[2]));
							}

						/*	if ($current == 'replace' && 
								(($mode == 'smilies' && !empty($cur_img[$code])) ))
							{
								$replace_sql = ($mode == 'smilies') ? $code : $img;
								$sql = array(
									$fields . '_url'		=> $img,
									$fields . '_height'		=> (int) $height,
									$fields . '_width'		=> (int) $width,
									'display_on_posting'	=> (int) $display_on_posting,
								);

								if ($mode == 'smilies')
								{
									$sql = array_merge($sql, array(
										'emotion'				=> $emotion,
									));
								}

								$sql = "UPDATE $table SET " . $db->sql_build_array('UPDATE', $sql) . " 
									WHERE $field_sql = '" . $db->sql_escape($replace_sql) . "'";
								$db->sql_query($sql);
							}
							else
							{*/ // IF rep
								++$order;

								$sql = array(
									$fields . '_url'	=> $img,
									$fields . '_height'	=> (int) $height,
									$fields . '_width'	=> (int) $width,
									$fields . '_order'	=> (int) $order,
									'display_on_posting'=> (int) $display_on_posting,
								);

								if ($mode == 'smilies')
								{
									$sql = array_merge($sql, array(
										'code'				=> $code,
										'emotion'			=> $emotion,
									));
								}
								$db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql));
							//} //IF replace
Usefull, isn't it :?: :idea:
Last edited by AGC on Tue Feb 15, 2011 5:59 pm, edited 2 times in total.
(phpBB 2.0.x): []Admin Topics List[] MOD. << Description & Download. , []Highlight Author[] MOD.

Donate-paypal
(phpBB 3.0.x)[ver] MODs: [RC1] >Import old *.pak files MOD. + . . .[8] > ACP - Modules Quick Access (MQA) MOD. + . . . [7-PL1] > Multi Smile (actions) MOD
User avatar
AGC
Registered User
Posts: 292
Joined: Sat Sep 15, 2007 10:26 pm

Re: [RC] Import old .paks files :idea: (UPDATE)

Post by AGC »

I notice that the smilies code got escape. :oops: So with that note,
The "htmlspecialchars" function and the escape smilies chars cause the smilies code who has them to mass up
the display and the process of the code.
To Fix it You need to change the
$code = stripslashes($data[2]);
to

Code: Select all

$code = trim(str_replace('"',""",$date[2] ));
Note: Those who copy the old code should change&update it.
The original(first post) code already updated.

P.S
I'm trying to figure out the MODX format and to make a proper install file to download for the one that :) struggles with the code.(And by a request from the phpBB Team). :o ;)
(phpBB 2.0.x): []Admin Topics List[] MOD. << Description & Download. , []Highlight Author[] MOD.

Donate-paypal
(phpBB 3.0.x)[ver] MODs: [RC1] >Import old *.pak files MOD. + . . .[8] > ACP - Modules Quick Access (MQA) MOD. + . . . [7-PL1] > Multi Smile (actions) MOD
User avatar
AGC
Registered User
Posts: 292
Joined: Sat Sep 15, 2007 10:26 pm

Re: [RC] Import old .paks files :idea:

Post by AGC »

If you want to limit the smilies that are display on the post form.

Find:

Code: Select all

$display_on_posting = '1';
Replace with:

Code: Select all

$display_on_posting = ($order < 26);
Change the 26 number to the number of smilies you want to be displayed.

P.S :idea:
If there wouldn't be any reports about bugs or error for couple of days. I will pack and submit it to be validated. :arrow:
Thank You.
(phpBB 2.0.x): []Admin Topics List[] MOD. << Description & Download. , []Highlight Author[] MOD.

Donate-paypal
(phpBB 3.0.x)[ver] MODs: [RC1] >Import old *.pak files MOD. + . . .[8] > ACP - Modules Quick Access (MQA) MOD. + . . . [7-PL1] > Multi Smile (actions) MOD
User avatar
AGC
Registered User
Posts: 292
Joined: Sat Sep 15, 2007 10:26 pm

Re: [RC] Import old .paks files :idea:

Post by AGC »

In the final version the acp_icons.php change and they added another check for the .pak file (I wonder why, too :idea: :?: ) to see if the .pak is illegal.

So that line wont be accurate:
AGC wrote:You can add this code to "acp_icons.php", look for "}" sign at Line 418 (apprx.),
and adds the entire code after that line as it is.
Use this instead.
Find:

Code: Select all

						$db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql));
					}
				}
Furthermore. Find this line (*):

Code: Select all

		// Make sure the pak_ary is valid
		foreach ($pak_ary as $pak_entry)
And Add before it

Code: Select all

 		/*
Find:

Code: Select all

		// The user has already selected a smilies_pak file
		if ($current == 'delete')
Add before:

Code: Select all

 		*/
:!: * Note: If you don't find the exact phrase then do not perform the last two operations.

soon I'll add a link to a fresh & updated packed zip file.
(phpBB 2.0.x): []Admin Topics List[] MOD. << Description & Download. , []Highlight Author[] MOD.

Donate-paypal
(phpBB 3.0.x)[ver] MODs: [RC1] >Import old *.pak files MOD. + . . .[8] > ACP - Modules Quick Access (MQA) MOD. + . . . [7-PL1] > Multi Smile (actions) MOD
User avatar
AGC
Registered User
Posts: 292
Joined: Sat Sep 15, 2007 10:26 pm

Re: [RC] Import old .paks files :idea:

Post by AGC »

Added a link to download packed zip file. :arrow:
Check it out. :D
(phpBB 2.0.x): []Admin Topics List[] MOD. << Description & Download. , []Highlight Author[] MOD.

Donate-paypal
(phpBB 3.0.x)[ver] MODs: [RC1] >Import old *.pak files MOD. + . . .[8] > ACP - Modules Quick Access (MQA) MOD. + . . . [7-PL1] > Multi Smile (actions) MOD

Return to “[3.0.x] MODs in Development”