News:

Wondering if this will always be free?  See why free is better.

Main Menu

Allegati come posso fare....

Started by fdr77, December 11, 2010, 03:46:39 PM

Previous topic - Next topic

fdr77

usavo questa mod nella 1.1
http://custom.simplemachines.org/mods/index.php?mod=1180
che quando non si davano permessi di visualizzazione degli allegati agli ospiti invece di lasciare lo spazio bianco ...scriveva ci sono tot allegati in questo post ma non puoi visualizzarli.Accedi o registrati.
Ora lì dice che per la 2.0 beta3  può funzionare ma non mi da il parse....posso utilizzarla?esiste un altro modo per fare la stessa cosa?

fdr77

#1
provato a fare le modifiche come dice l'instal 2.0 ma da questo errore
Parse error: syntax error, unexpected T_ELSEIF in /var/www/vhosts/discusrewind.net/httpdocs/Sources/Display.php on line 1006

riporto la parte
originale
// This is better than sorting it with the query...
ksort($temp);

foreach ($temp as $row)
$attachments[$row['id_msg']][] = $row;
}

// What?  It's not like it *couldn't* be only guests in this topic...


con la modifica
// This is better than sorting it with the query...
            ksort($temp);
elseif (!empty($modSettings['attachmentEnable']) && !allowedTo('view_attachments'))
{
$request = $smcFunc['db_query']('','
SELECT
id_msg, filename
FROM {db_prefix}attachments
WHERE ID_MSG IN ({array_int:message_list})
AND attachment_type = {int:attachment_type}' . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : '
AND approved = {int:is_approved}'),
array(
'message_list' => $messages,
'attachment_type' => 0,
'is_approved' => 1,
));
$temp = array();
while($row = mysql_fetch_assoc($request))
{
$temp[$row['filename']] = $row;
if(!isset($attachments['disabled_'.$row['id_msg']]))
$attachments['disabled_'.$row['id_msg']] = array();
}
mysql_free_result($request);

ksort($temp);

foreach($temp as $row)
$attachments['disabled_'.$row['id_msg']][] = $row;
}

foreach ($temp as $row)
$attachments[$row['id_msg']][] = $row;
}

// What?  It's not like it *couldn't* be only guests in this topic...


Metto il display.php ho incrociato in 3000 modi ma niente :(

emanuele

Nel tuo codice modificato, il pezzo:

foreach($temp as $row)
$attachments['disabled_'.$row['id_msg']][] = $row;
}

foreach ($temp as $row)
$attachments[$row['id_msg']][] = $row;
}

// What?  It's not like it *couldn't* be only guests in this topic...

devi farlo diventare così:

foreach($temp as $row)
$attachments['disabled_'.$row['id_msg']][] = $row;
}

// What?  It's not like it *couldn't* be only guests in this topic...


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

fdr77

#3
Niente da fare sempre uguale

allora metto i pezzi
nel display.php
// This is better than sorting it with the query...
            ksort($temp);
elseif(!empty($modSettings['attachmentEnable']) && !allowedTo('view_attachments'))
{
$request = $smcFunc['db_query']('','
SELECT
id_msg, filename
FROM {db_prefix}attachments
WHERE ID_MSG IN ({array_int:message_list})
AND attachment_type = {int:attachment_type}' . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : '
AND approved = {int:is_approved}'),
array(
'message_list' => $messages,
'attachment_type' => 0,
'is_approved' => 1,
));
$temp = array();
while($row = mysql_fetch_assoc($request))
{
$temp[$row['filename']] = $row;
if(!isset($attachments['disabled_'.$row['id_msg']]))
$attachments['disabled_'.$row['id_msg']] = array();
}
mysql_free_result($request);

ksort($temp);

foreach($temp as $row)
$attachments['disabled_'.$row['id_msg']][] = $row;
}

// What?  It's not like it *couldn't* be only guests in this topic...


e
// Compose the memory eat- I mean message array.
$output = array(
'attachment' => loadAttachmentContext($message['id_msg']),
'disabled_attachments' => isset($attachments['disabled_'.$message['id_msg']]) ? $attachments['disabled_'.$message['id_msg']] : array(),
'num_disabled_attachments' => isset($attachments['disabled_'.$message['id_msg']]) ? count($attachments['disabled_'.$message['id_msg']]) : 0,
'alternate' => $counter % 2,
'id' => $message['id_msg'],



nel displaytemplate

echo '
</div>
<div class="moderatorbar">
<div class="smalltext modified" id="modified_', $message['id'], '">'; if(!empty($message['disabled_attachments']))
{
echo '
<hr width="100%" size="1" class="hrcolor" />
<div style="overflow: auto; width: 100%;">
<span class="smalltext" style="color:#FF0000">',sprintf($txt['num_disabled_attachments'],$message['num_disabled_attachments']),'</span>';
foreach($message['disabled_attachments'] as $attachment)
echo '<div style="color:#FF0000">',$attachment['filename'],'</div>';
echo '</div>';
}

Dove sbaglio?




emanuele

Quote from: fdr77 on December 11, 2010, 06:45:32 PM
Niente da fare sempre uguale
Se l'errore è sempre lo stesso vuol dire che non hai corretto ciò che ti ho detto io: ritenta, l'errore è quello. ;)
Se l'errore è diverso riporta il nuovo errore. ;D


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

fdr77

mi dice che l'errore è in questa linea
elseif(!empty($modSettings['attachmentEnable']) && !allowedTo('view_attachments'))
manca forse il ;

emanuele

#6
Errore mio dovuto all'ora tarda...hai sbagliato ad incollare il pezzo di codice, nel parse per la 1.1.4 (l'unico che funziona...) dice:
Code (find) Select

foreach ($temp as $row)
$attachments[$row['ID_MSG']][] = $row;
}

Code (aggiungi dopo) Select

elseif(!empty($modSettings['attachmentEnable']) && !allowedTo('view_attachments'))
{
$request = db_query("
SELECT
a.ID_MSG, a.filename
FROM {$db_prefix}attachments AS a
WHERE a.ID_MSG IN (".implode(',', $messages) . ")
AND a.attachmentType = 0",__FILE__,__LINE__);
$temp = array();
while($row = mysql_fetch_assoc($request))
{
$temp[$row['filename']] = $row;
if(!isset($attachments['disabled_'.$row['ID_MSG']]))
$attachments['disabled_'.$row['ID_MSG']] = array();
}
mysql_free_result($request);

ksort($temp);

foreach($temp as $row)
$attachments['disabled_'.$row['ID_MSG']][] = $row;
}


mentre tu l'hai aggiunto prima. ;)

Quel pezzo deve diventare:

foreach ($temp as $row)
$attachments[$row['ID_MSG']][] = $row;
}

elseif(!empty($modSettings['attachmentEnable']) && !allowedTo('view_attachments'))
{
$request = db_query("
SELECT
a.ID_MSG, a.filename
FROM {$db_prefix}attachments AS a
WHERE a.ID_MSG IN (".implode(',', $messages) . ")
AND a.attachmentType = 0",__FILE__,__LINE__);
$temp = array();
while($row = mysql_fetch_assoc($request))
{
$temp[$row['filename']] = $row;
if(!isset($attachments['disabled_'.$row['ID_MSG']]))
$attachments['disabled_'.$row['ID_MSG']] = array();
}
mysql_free_result($request);

ksort($temp);

foreach($temp as $row)
$attachments['disabled_'.$row['ID_MSG']][] = $row;
}


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

fdr77

#7
così dice :
Fatal error: Call to undefined function db_query() in /var/www/vhosts/discusrewind.net/httpdocs/Sources/Display.php on line 1012

penso sia questo pezzo che non piace a 2.0

AND a.attachmentType = 0",__FILE__,__LINE__);

allora ho provato cosi
// This is better than sorting it with the query...
ksort($temp);
foreach ($temp as $row)
$attachments[$row['ID_MSG']][] = $row;
}

elseif(!empty($modSettings['attachmentEnable']) && !allowedTo('view_attachments'))
{
$request = $smcFunc['db_query']('','
SELECT
id_msg, filename
FROM {db_prefix}attachments
WHERE ID_MSG IN ({array_int:message_list})
AND attachment_type = {int:attachment_type}' . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : '
AND approved = {int:is_approved}'),
array(
'message_list' => $messages,
'attachment_type' => 0,
'is_approved' => 1,
));
$temp = array();
while($row = mysql_fetch_assoc($request))
{
$temp[$row['filename']] = $row;
if(!isset($attachments['disabled_'.$row['id_msg']]))
$attachments['disabled_'.$row['id_msg']] = array();
}
mysql_free_result($request);

ksort($temp);

foreach($temp as $row)
$attachments['disabled_'.$row['ID_MSG']][] = $row;
}


Non va in errore ma non prende la stringa   >:( >:(

emanuele


foreach ($temp as $row)
$attachments[$row['ID_MSG']][] = $row;
}

elseif(!empty($modSettings['attachmentEnable']) && !allowedTo('view_attachments'))
{
$request = $smcFunc['db_query']('','
SELECT
id_msg, filename
FROM {db_prefix}attachments
WHERE ID_MSG IN ({array_int:message_list})
AND attachment_type = {int:attachment_type}' . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : '
AND approved = {int:is_approved}'),
array(
'message_list' => $messages,
'attachment_type' => 0,
'is_approved' => 1,
));
$temp = array();
while($row = mysql_fetch_assoc($request))
{
$temp[$row['filename']] = $row;
if(!isset($attachments['disabled_'.$row['id_msg']]))
$attachments['disabled_'.$row['id_msg']] = array();
}
mysql_free_result($request);

ksort($temp);

foreach($temp as $row)
$attachments['disabled_'.$row['id_msg']][] = $row;
}


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

fdr77

Niente errori ma niente scritta...si vede che non può funzionare con questa versione ....
Grazie comunque :)

emanuele

Probabilmente non cambia molto nei casi rimanenti, ma vorrei farti notare che ho l'impressione che stai facendo le modifiche al contrario: quando nel file xml trovi qualcosa tipo:
<search position="after"><![CDATA['attachment' => loadAttachmentContext($message['id_msg']),]]></search>
<add><![CDATA[
'disabled_attachments' => isset($attachments['disabled_'.$message['id_msg']]) ? $attachments['disabled_'.$message['id_msg']] : array(),
'num_disabled_attachments' => isset($attachments['disabled_'.$message['id_msg']]) ? count($attachments['disabled_'.$message['id_msg']]) : 0,]]></add>


significa che quanto sta tra i tag <add> deve essere posizionato prima di quanto riportato nel tag <search>, non dopo! ;)
Quindi nell'esempio sopra il risultato finale deve essere:

'disabled_attachments' => isset($attachments['disabled_'.$message['id_msg']]) ? $attachments['disabled_'.$message['id_msg']] : array(),
'num_disabled_attachments' => isset($attachments['disabled_'.$message['id_msg']]) ? count($attachments['disabled_'.$message['id_msg']]) : 0,
'attachment' => loadAttachmentContext($message['id_msg']),



Se invece trovassi: <search position="before"> allora quanto sta tra i tag <add> va messo dopo quanto riportato nei tag search.

Quindi in particolare il codice che hai messo in display.template.php è ancora al contrario ed il risultato dovrà essere più o meno:

if(!empty($message['disabled_attachments']))
{
echo '
<hr width="100%" size="1" class="hrcolor" />
<div style="overflow: auto; width: 100%;">
<span class="smalltext" style="color:#FF0000">',sprintf($txt['num_disabled_attachments'],$message['num_disabled_attachments']),'</span>';
foreach($message['disabled_attachments'] as $attachment)
echo '<div style="color:#FF0000">',$attachment['filename'],'</div>';
echo '</div>';
}

echo '
</div>
<div class="moderatorbar">
<div class="smalltext modified" id="modified_', $message['id'], '">';


Per il fatto che non appare la scritta...messa la traduzione in italiano?


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

fdr77

A quello ci avevo pensato e avevo provato ad invertire prima e dopo...ma
ero convinto di aver inserito questa parte
'Disabled_attachments' => isset ($ allegati ['disabled_'. $ Messaggio 'id_msg' []])? [. 'Disabled_'] 'id_msg' [messaggio $] allegati $: array (),
'Num_disabled_attachments' => isset ($ allegati ['disabled_'. $ Messaggio 'id_msg' []])? count ($ allegati ['disabled_' $ [messaggio 'id_msg'].]): 0,

invece..... :-[ :-[
grazie adesso è tutto ok :)

emanuele

eheheh succede. ;)
Quindi "mark as solved"?


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

fdr77

però per gli ospiti funziona..... il problema che adesso i registrati non possono vedere le foto....cioè
per gli ospiti appare la stringa che sta nel language....per i registrati non appaionoi le foto ma neanche la stringa

fdr77

Potrebbe essere questo comando?
Cosa dice di fare in pratica
array(
'message_list' => $messages,
'attachment_type' => 0,
'is_approved' => 1,
));

emanuele

Se funziona con una 2 precedente la logica funziona, quindi non è quello il problema.
Io ti suggerirei di ricontrollare le modifiche che hai fatto.

Per rispondere alle tue domande:
Quote from: fdr77 on December 12, 2010, 02:32:15 PM
Potrebbe essere questo comando?
Dubito.

Quote from: fdr77 on December 12, 2010, 02:32:15 PM
Cosa dice di fare in pratica
array(
'message_list' => $messages,
'attachment_type' => 0,
'is_approved' => 1,
));

Da solo niente, prendendo però la query in cui si trova:

$request = $smcFunc['db_query']('','
SELECT
id_msg, filename
FROM {db_prefix}attachments
WHERE ID_MSG IN ({array_int:message_list})
AND attachment_type = {int:attachment_type}' . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : '
AND approved = {int:is_approved}'),
array(
'message_list' => $messages,
'attachment_type' => 0,
'is_approved' => 1,
));

dice alla funzione che fa le query di fare le seguenti sostituzioni prima di eseguire la query:
{array_int:message_list} => $messages
{int:attachment_type} => 0
{int:is_approved} => 1

E comunque, questo codice viene eseguito solo gli allegati sono abilitati e chi sta guardando non ha l'autorizzazione a vedere gli allegati.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

fdr77

#16
eliminati e rimessi tali e quali però invertendo l'ordine prima il display e poi il display template e tutto funziona....a saperlo prima evitavo di scervellarmi tutto il giorno....che cosa è cambiato tra prima e adesso proprio non lo sò....
per completare l'opera  ho fatto anche questo cioè disabilitare per gli ospiti  il tag url-iurl e img
Siccome la mod  ( http://custom.simplemachines.org/mods/index.php?mod=342 ) è stata modificata ma non lavora come vorrei ho dovuto fare a memoria (ritrovando i vecchi appunti) impostando come nella versione precedente
puoi dare un occhio se ho fatto danni (a me pare funzionare)
tag img
array(
'tag' => 'img',
'type' => 'unparsed_content',
'parameters' => array(
'alt' => array('optional' => true),
'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
),
'content' =>  $user_info['is_guest'] ? $txt['no_view_img'] . "\n" . '<a href="' . $scripturl . '?action=register">' . $txt['txt_reg_img_register'] . '</a>&nbsp;' . $txt['txt_reg_img_or'] . '&nbsp;<a href="' . $scripturl . '?action=login">' . $txt['txt_reg_img_login'] . '</a>' :'<img src="$1" alt="{alt}"{width}{height} class="bbc_img resized" />',
'validate' => create_function('&$tag, &$data, $disabled', '
$data = strtr($data, array(\'<br />\' => \'\'));
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
'disabled_content' => $user_info['is_guest'] ?  '' : '($1)',
),
array(
'tag' => 'img',
'type' => 'unparsed_content',
'content' => $user_info['is_guest'] ? $txt['no_view_img'] . "\n" . '<a href="' . $scripturl . '?action=register">' . $txt['txt_reg_img_register'] . '</a>&nbsp;' . $txt['txt_reg_img_or'] . '&nbsp;<a href="' . $scripturl . '?action=login">' . $txt['txt_reg_img_login'] . '</a>' :'<img src="$1" alt="" class="bbc_img" />',
'validate' => create_function('&$tag, &$data, $disabled', '
$data = strtr($data, array(\'<br />\' => \'\'));
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
'disabled_content' => $user_info['is_guest'] ?  '' : '($1)',
),


tag iurl
array(
'tag' => 'iurl',
'type' => 'unparsed_content',
'content' =>  $user_info['is_guest'] ? $txt['no_view_links'] . "\n" . '<a class="bbc_link" href="' . $scripturl . '?action=register">' . $txt['txt_reg_links_register'] . '</a>&nbsp;' . $txt['txt_reg_links_or'] . '&nbsp;<a class="bbc_link" href="' . $scripturl . '?action=login">' . $txt['txt_reg_links_login'] . '</a><FONT COLOR="BLUE"> per vedere link, video e usare le funzioni avanzate del sito</FONT> ]' : '<a href="$1" class="bbc_link" target="_blank">$1</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
$data = strtr($data, array(\'<br />\' => \'\'));
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
),
array(
'tag' => 'iurl',
'type' => 'unparsed_equals',
'before' => $user_info['is_guest'] ? $txt['no_view_links'] . "\n" . '<a class="bbc_link" href="' . $scripturl . '?action=register">' . $txt['txt_reg_links_register'] . '</a>&nbsp;' . $txt['txt_reg_links_or'] . '&nbsp;<a class="bbc_link" href="' . $scripturl . '?action=login">' . $txt['txt_reg_links_login'] . '</a><FONT COLOR="BLUE"> per vedere link, video e usare le funzioni avanzate del sito</FONT> ]<div style="visibility:hidden;display:none;">' : '<a href="$1" target="_blank" class="bbc_link">',
'after' => $user_info['is_guest'] ?  '</div>' : '</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
if (substr($data, 0, 1) == \'#\')
$data = \'#post_\' . substr($data, 1);
elseif (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_after' => $user_info['is_guest'] ?  '' : ' ($1)',
),


tag url
array(
'tag' => 'url',
'type' => 'unparsed_content',
'content' => $user_info['is_guest'] ? $txt['no_view_links'] . "\n" . '<a class="bbc_link new_win" href="' . $scripturl . '?action=register">' . $txt['txt_reg_links_register'] . '</a>&nbsp;' . $txt['txt_reg_links_or'] . '&nbsp;<a class="bbc_link new_win" href="' . $scripturl . '?action=login">' . $txt['txt_reg_links_login'] . '</a>' : '<FONT COLOR="BLUE"> per vedere link, video e usare le funzioni avanzate del sito</FONT> ]<a href="$1" class="bbc_link new_win" target="_blank">$1</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
$data = strtr($data, array(\'<br />\' => \'\'));
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
),
array(
'tag' => 'url',
'type' => 'unparsed_equals',
'before' => $user_info['is_guest'] ? $txt['no_view_links'] . "\n" . '<a class="bbc_link new_win" href="' . $scripturl . '?action=register">' . $txt['txt_reg_links_register'] . '</a>&nbsp;' . $txt['txt_reg_links_or'] . '&nbsp;<a class="bbc_link new_win" href="' . $scripturl . '?action=login">' . $txt['txt_reg_links_login'] . '</a><FONT COLOR="BLUE"> per vedere link, video e usare le funzioni avanzate del sito</FONT> ]<div style="visibility:hidden;display:none;">' : '<a href="$1" class="bbc_link new_win" target="_blank">',
'after' => $user_info['is_guest'] ?  '</div>' : '</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_after' => $user_info['is_guest'] ?  '' : ' ($1)',
),


nei due default/ language english e italian(naturalmente tradotto)
//Begin Reg Links
$txt['no_view_links'] = '<FONT COLOR="RED">Please</FONT> ';
$txt['txt_reg_links_register'] = 'Register';
$txt['txt_reg_links_login'] = 'Login';
$txt['txt_reg_links_or'] = '<FONT COLOR="RED">or</FONT>';

//END Reg Links Text Strings
//Begin Reg img
$txt['no_view_img'] = 'You are not allowed to view links.';
$txt['txt_reg_img_register'] = 'Register';
$txt['txt_reg_img_login'] = 'Login';
$txt['txt_reg_img_or'] = 'or';

//END Reg img Text Strings


Vado tranquillo?

emanuele

Quote from: fdr77 on December 12, 2010, 03:56:43 PM
per completare l'opera  ho fatto anche questo cioè disabilitare per gli ospiti  il tag url-iurl e img
Siccome la mod  ( http://custom.simplemachines.org/mods/index.php?mod=342 ) è stata modificata ma non lavora come vorrei ho dovuto fare a memoria (ritrovando i vecchi appunti)
Per "non lavora come vorrei" intendi che nasconde solo i link e non i tag img?...se sì ti mando un pm.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

fdr77

#18
esattamente copre solo i link singoli ....diciamo normali.
i link dei video you tube e i tag img (per esempio degli articoli) non li copre
Per i video you tube(in particolare) con questa modifica aggiornata fa una cosa strana....e cioè con aeva inserisco solo il link della pagina you tube ma prende solo il titolo come link facendo vedere però il video.

Per capirci questo è come mette in automatico un video you tube il sito
[url=http://www.youtube.com/watch?v=COcWi0pUuUQ#]042[/url]

Lo 042 giustamente lo prende come link  e inserisce al suo posto le stringhe di linguaggio ma sopra fa vedere il video...quindi mi serve a poco la mod in questa maniera.
Stavo leggendo(nel topic di supporto) che come ho fatto io potrebbe creare qualche problema ma è tutto in inglese e ci capisco poco.

fdr77

#19
Nel frattempo ho rimediato questa e mi sono reso conto che non andava bene come avevo fatto :(

Questi i tre pezzi orginali ma il mio pezzo url è diverso.... io ho due volte questo comando "  'validate' => create_function('&$tag, &$data, $disabled', '   "  e li lo riporta una volta solo ...quindi non saprei se va bene lo stesso
Comunque sempre che non ci fosse altra soluzione ecco le parti originali
tag img
array(
'tag' => 'img',
'type' => 'unparsed_content',
'parameters' => array(
'alt' => array('optional' => true),
'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
),
'content' => '<img src="$1" alt="{alt}"{width}{height} class="bbc_img resized" />',
'validate' => create_function('&$tag, &$data, $disabled', '
$data = strtr($data, array(\'<br />\' => \'\'));
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
'disabled_content' => '($1)',
),
array(
'tag' => 'img',
'type' => 'unparsed_content',
'content' => '<img src="$1" alt="" class="bbc_img" />',
'validate' => create_function('&$tag, &$data, $disabled', '
$data = strtr($data, array(\'<br />\' => \'\'));
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
'disabled_content' => '($1)',
),


tag iurl
array(
'tag' => 'iurl',
'type' => 'unparsed_content',
'content' => '<a href="$1" class="bbc_link">$1</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
$data = strtr($data, array(\'<br />\' => \'\'));
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
),
array(
'tag' => 'iurl',
'type' => 'unparsed_equals',
'before' => '<a href="$1" class="bbc_link">',
'after' => '</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
if (substr($data, 0, 1) == \'#\')
$data = \'#post_\' . substr($data, 1);
elseif (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_after' => ' ($1)',
),


tag url
array(
'tag' => 'url',
'type' => 'unparsed_content',
'content' => '<a href="$1" class="bbc_link new_win" target="_blank">$1</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
$data = strtr($data, array(\'<br />\' => \'\'));
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
),
array(
'tag' => 'url',
'type' => 'unparsed_equals',
'before' => '<a href="$1" class="bbc_link new_win" target="_blank">',
'after' => '</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_after' => ' ($1)',
),


E sotto come l'ho modificato seguendo le "istruzioni" che vi dicevo

Advertisement: