Pereiti prie turinio

Rekomenduojami pranešimai

Gal kas esat susidure su siuo pluginu

ir pavyko palaiesti pas mane kazkodel nepaiso pavaiksliuko

 

 

http://www.willyoumary.me/2009/01/28/love-songs/

 

Darau pagal nustatymus

Chmod is 755

paveiksliukus kaip ir priklauso sukuria

taciau nerodo po komentaru.

 

WP 2.7 draw comments 0.0.9

Redagavo petriux
Nuoroda į pranešimą
Dalintis kituose puslapiuose

Tai va kodai

 

comments php

 

<?php // Do not delete these lines

if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))

die ('Please do not load this page directly. Thanks!');

 

if (!empty($post->post_password)) { // if there's a password

if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie

?>

 

<p class="nocomments">This post is password protected. Enter the password to view comments.</p>

 

<?php

return;

}

}

 

/* This variable is for alternating comment background */

$oddcomment = 'class="alt" ';

?>

 

<!-- You can start editing here. -->

 

<?php if ($comments) : ?>

<h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3>

 

<ol class="commentlist">

 

<?php foreach ($comments as $comment) : ?>

 

<li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>">

<?php echo get_avatar( $comment, 32 ); ?>

<cite><?php comment_author_link() ?></cite> Says:

<?php if ($comment->comment_approved == '0') : ?>

<em>Your comment is awaiting moderation.</em>

<?php endif; ?>

<br />

 

<small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a> <?php edit_comment_link('edit','  ',''); ?></small>

 

<?php comment_text() ?>

 

</li>

 

<?php

/* Changes every other comment to a different class */

$oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';

?>

 

<?php endforeach; /* end for each comment */ ?>

 

</ol>

 

<?php else : // this is displayed if there are no comments so far ?>

 

<?php if ('open' == $post->comment_status) : ?>

<!-- If comments are open, but there are no comments. -->

 

<?php else : // comments are closed ?>

<!-- If comments are closed. -->

<p class="nocomments">Comments are closed.</p>

 

<?php endif; ?>

<?php endif; ?>

 

 

<?php if ('open' == $post->comment_status) : ?>

 

<h3 id="respond">Leave a Reply</h3>

 

<?php if ( get_option('comment_registration') && !$user_ID ) : ?>

<p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> to post a comment.</p>

<?php else : ?>

 

<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

 

<?php if ( $user_ID ) : ?>

 

<p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Log out »</a></p>

 

<?php else : ?>

 

<p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />

<label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p>

 

<p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />

<label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p>

 

<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />

<label for="url"><small>Website</small></label></p>

 

<?php endif; ?>

 

<!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></small></p>-->

 

<p><textarea name="comment" id="comment" cols="50%" rows="10" tabindex="4"></textarea>

</p>

 

<p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />

<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />

</p>

<?php do_action('comment_form', $post->ID); ?>

</form>

 

<?php endif; // If registration required and not logged in ?>

 

<?php endif; // if you delete this the sky will fall on your head ?>

 

komentaro piesimo failas

draw_comments.php

 

 

<?php

/*

Plugin Name: Draw Comments

Plugin URI: http://wpdemo.azettl.de/2008/11/draw-comments/

Description: This plugin allows your visitors to draw an image as extra comment.

Version: 0.0.9

Author: Andreas Zettl

Author URI: http://azettl.de/

Min WP Version: 2.6.2

Max WP Version: 2.7.0

*/

 

add_action('admin_menu', 'draw_add_menu');

add_action('comment_form', 'comment_form');

add_action('preprocess_comment', 'add_image',1);

add_filter('comment_text', 'replace_image');

add_filter('comment_excerpt', 'replace_image');

 

$draw_do_action = get_option('draw_do_action');

if ('insert' == $HTTP_POST_VARS['action']){

update_option("draw_do_action",$HTTP_POST_VARS['draw_do_action']);

}

 

function draw_option_page() {

echo '<div class="wrap">

<div id="icon-options-general" class="icon32"><br /></div>

<h2>Draw Comments</h2>

<form name="form1" method="post" action="'.$location.'">

<table class="form-table">

<tr valign="top">

<th scope="row">Embed Type </th>

<td>

<fieldset>

<legend class="hidden">Embed Type </legend>

<select name="draw_do_action" style="width:60px;">

<option value="1" '.((get_option("draw_do_action") == '1') ? 'selected="selected"' : '').'>Yes</option>

<option value="-1" '.((get_option("draw_do_action") == '-1') ? 'selected="selected"' : '').'>No</option>

</select>

<label for="draw_do_action">

Use '.highlight_string('do_action(\'comment_form\', $post->ID);', true).' to embed the drawing area

(If "No" selected, you have to use '.highlight_string('echo getDrawArea().getColors();', true).' instead of '.highlight_string('do_action', true).').

</label>

</fieldset>

</td>

</tr>

</table>

<p class="submit">

<input type="submit" name="Submit" class="button-primary" value="Save Changes" />

</p>

<input name="action" value="insert" type="hidden" />

</form>

</div>';

}

 

function draw_add_menu() {

add_option("draw_do_action","");

add_options_page('Draw Comments', 'Draw Comments', 9, __FILE__, 'draw_option_page');

}

 

function getDrawArea(){

$rows = 40;

$cols = 40;

 

$ret = '<input type="hidden" id="draw_state" />';

$ret .= '<input type="hidden" id="draw_color" value="#000000" />';

$ret .= '<table cellpadding="0" cellspacing="0" style="height:150px;width:250px;border-collapse:collapse;" onmousedown="document.getElementById(\'draw_state\').value=1;" onmouseup="document.getElementById(\'draw_state\').value=0;">';

for($i = 0; $i < $rows; $i++){

$ret .= '<tr>';

for($j = 0; $j < $cols; $j++){

if(!empty($_POST['cell-'.$i.'-'.$j.''])){

$ret .= '<td style="width:8px;height:8px;line-height:8px;padding:0px;margin:0px;border:1px solid #808080;" bgcolor="'.$_POST['cell-'.$i.'-'.$j.''].'" onmouseover="if(document.getElementById(\'draw_state\').value == 1){ this.bgColor=document.getElementById(\'draw_color\').value; document.getElementById(\'cell-'.$i.'-'.$j.'\').value = document.getElementById(\'draw_color\').value }">';

$ret .= '<input type="hidden" name="cell-'.$i.'-'.$j.'" id="cell-'.$i.'-'.$j.'" value="'.$_POST['cell-'.$i.'-'.$j.''].'" />';

$ret .= '</td>';

}else{

$ret .= '<td style="width:8px;height:8px;line-height:8px;padding:0px;margin:0px;border:1px solid #808080;" onmouseover="if(document.getElementById(\'draw_state\').value == 1){ this.bgColor=document.getElementById(\'draw_color\').value; document.getElementById(\'cell-'.$i.'-'.$j.'\').value = document.getElementById(\'draw_color\').value }">';

$ret .= '<input type="hidden" name="cell-'.$i.'-'.$j.'" id="cell-'.$i.'-'.$j.'" />';

$ret .= '</td>';

}

}

$ret .= '</tr>';

}

$ret .= '</table>';

$ret .= '<script type="text/javascript">

function clearDrawArea(){

var rows = 40;

var cols = 40;

 

for(var i = 0; i < rows; i++){

for(var j = 0; j < cols; j++){

document.getElementById("cell-" + i + "-" + j).value = "";

}

}

}

clearDrawArea();

</script>';

return $ret;

}

 

function getColors(){

$ret = '<table cellpadding="4" cellspacing="4" style="height:12px;line-height:12px;font-size:12px;">';

$ret .= '<tr>';

$ret .= '<td>Choose Color: </td>';

$ret .= '<td style="width:12px;background-color:#FF0000;border:2px solid #808080;" onclick="document.getElementById(\'draw_color\').value=\'#FF0000\';"> </td>';

$ret .= '<td style="width:12px;background-color:#0000FF;border:2px solid #808080;" onclick="document.getElementById(\'draw_color\').value=\'#0000FF\';"> </td>';

$ret .= '<td style="width:12px;background-color:#FFFF00;border:2px solid #808080;" onclick="document.getElementById(\'draw_color\').value=\'#FFFF00\';"> </td>';

$ret .= '<td style="width:12px;background-color:#00FF00;border:2px solid #808080;" onclick="document.getElementById(\'draw_color\').value=\'#00FF00\';"> </td>';

$ret .= '<td style="width:12px;background-color:#000000;border:2px solid #808080;" onclick="document.getElementById(\'draw_color\').value=\'#000000\';"> </td>';

$ret .= '<td style="width:12px;background-color:#FFFFFF;border:2px solid #808080;" onclick="document.getElementById(\'draw_color\').value=\'#FFFFFF\';"> </td>';

$ret .= '</tr>';

$ret .= '</table>';

return $ret;

}

 

function createImage(){

$im = @ImageCreate (240, 160)

or die ("Kann keinen neuen GD-Bild-Stream erzeugen");

$background_color = ImageColorAllocate ($im, 255, 255, 255);

 

 

$color_FF0000 = ImageColorAllocate ($im, 255, 0, 0);

$color_0000FF = ImageColorAllocate ($im, 0, 0, 255);

$color_FFFF00 = ImageColorAllocate ($im, 255, 255, 0);

$color_00FF00 = ImageColorAllocate ($im, 0, 255, 0);

$color_000000 = ImageColorAllocate ($im, 0, 0, 0);

$color_FFFFFF = ImageColorAllocate ($im, 255, 255, 255);

 

$drawn = 0;

foreach($_POST as $pos => $color){

if(!eregi('cell-', $pos)) continue;

$position = explode("-", $pos);

$changedpos1 = $position['1'] * 4;

$changedpos2 = $position['2'] * 4;

if(!empty($color)){

switch($color){

case '#FF0000':

$imgcolor = $color_FF0000;

$drawn = 1;

break;

case '#0000FF':

$imgcolor = $color_0000FF;

$drawn = 1;

break;

case '#FFFF00':

$imgcolor = $color_FFFF00;

$drawn = 1;

break;

case '#00FF00':

$imgcolor = $color_00FF00;

$drawn = 1;

break;

case '#000000':

$imgcolor = $color_000000;

$drawn = 1;

break;

case '#FFFFFF':

$imgcolor = $color_FFFFFF;

break;

}

imagefilledrectangle ($im, $changedpos2, $changedpos1, ($changedpos2+4), ($changedpos1+4), $imgcolor);

}

}

 

if($drawn == 0) return false;

 

@mkdir('wp-content/uploads/', 0755);

@mkdir('wp-content/uploads/comments/', 0755);

@mkdir('wp-content/uploads/comments/'.date('Y'), 0755);

@mkdir('wp-content/uploads/comments/'.date('Y').'/'.date('m'), 0755);

$image = 'wp-content/uploads/comments/'.date('Y').'/'.date('m').'/'.md5(uniqid(rand(), true)).'.jpg';

ImagePNG ($im, $image);

return $image;

}

 

function comment_form() {

if(get_option('draw_do_action') != '-1'){

echo getDrawArea().getColors();

}

}

 

function add_image($comment){

$image = createImage();

if($image === false) return $comment;

$comment['comment_content'] .= ' ['.date('Y').'|'.date('m').'|'.str_replace('.jpg','', basename($image)).']';

return $comment;

}

 

function replace_image($comment){

preg_match("/\[(.*)\]/", $comment, $result);

preg_match("/(.*)\|(.*)\|(.*)/", $result['1'], $splitresult);

 

echo getcwd();

echo "<pre>";

print_r($splitresult);

echo "</pre>";

 

 

if(is_file('./wp-content/uploads/comments/'.$splitresult['1'].'/'.$splitresult['2'].'/'.$splitresult['3'].'.jpg')

|| is_file('../wp-content/uploads/comments/'.$splitresult['1'].'/'.$splitresult['2'].'/'.$splitresult['3'].'.jpg')){

$image = '<br/><img src="'.get_option('siteurl').'/wp-content/uploads/comments/'.$splitresult['1'].'/'.$splitresult['2'].'/'.$splitresult['3'].'.jpg" />';

$comment = str_replace($result['0'], $image,$comment);

return convert_smilies($comment);

}else{

return convert_smilies($comment);

}

}

?>

 

esme ta kad paveiksliuka kazkur sugeneruoja nes ji per admin console rodo

 

o komentaruose puslapyje kazkaip nenuskaito to paveiksliuko.

 

komentare isspausdina tik sugeneruota paveiksliuko pavadinima

Redagavo petriux
Nuoroda į pranešimą
Dalintis kituose puslapiuose

http://www.willyoumary.me/2009/01/love-songs/

 

kai rasai komentara apacioje yra dar drawing boardas

gali nusipiesti paveiksliuka dar po komentaru jei nori.

 

Ir kai ivyksta post comment

salia komentaro atsiranda paveiksliukas

 

dabar atsiranda tik 2009|02|130481380b1e89cb240a2bbe7fe7d907

 

as ne programuotojas bet kaip suprantu is drawing boardo yra sugeneruojamas .jpg paveikslelis ir kazkur idedamas

paveikslelio pavadinimas yra 130481380b1e89cb240a2bbe7fe7d907.jpg

 

ir kai paspaudi post comments turetu jisai pasirodyti salia komentaro.

idomiausia tai kad viskas puikiai veikia WP admin consoleje

 

http://www.willyoumary.me/screen.jpg

 

Gal dabar aiskiau ko as noriu :)

Nuoroda į pranešimą
Dalintis kituose puslapiuose

Paveiksliukas sukurtas

http://www.willyoumary.me/tvswordpress/wp-...2a7909e54ec.jpg

 

bet as ji matau tik per asmin panele

 

http://www.willyoumary.me/tvswordpress/wp-content/uploads/comments/2009/02/8a1d2bfc6cf733d5a4cb82a7909e54ec.jpg

 

komentaruose tik tas tekstas paveikslelio pavadinimas be .JPG

 

jei pades tai dar

 

Return getcwd funcija duoda tokias reiksmes

Page : /usr/local/psa/home/vhosts/willyoumary.me/httpdocs

 

Admin panel : /usr/local/psa/home/vhosts/willyoumary.me/httpdocs/tvswordpress/wp-admin

Redagavo petriux
Nuoroda į pranešimą
Dalintis kituose puslapiuose
duok ta faila , kuriame turetu isvest ta paveiksliuka ;]. papostink ji cia

 

kaip suprantu tai ci ta daro funkcija is temos pradzioje nurodyto failo draw-Comments

 

function createImage(){

$im = @ImageCreate (240, 160)

or die ("Kann keinen neuen GD-Bild-Stream erzeugen");

$background_color = ImageColorAllocate ($im, 255, 255, 255);

 

 

$color_FF0000 = ImageColorAllocate ($im, 255, 0, 0);

$color_0000FF = ImageColorAllocate ($im, 0, 0, 255);

$color_FFFF00 = ImageColorAllocate ($im, 255, 255, 0);

$color_00FF00 = ImageColorAllocate ($im, 0, 255, 0);

$color_000000 = ImageColorAllocate ($im, 0, 0, 0);

$color_FFFFFF = ImageColorAllocate ($im, 255, 255, 255);

 

$drawn = 0;

foreach($_POST as $pos => $color){

if(!eregi('cell-', $pos)) continue;

$position = explode("-", $pos);

$changedpos1 = $position['1'] * 4;

$changedpos2 = $position['2'] * 4;

if(!empty($color)){

switch($color){

case '#FF0000':

$imgcolor = $color_FF0000;

$drawn = 1;

break;

case '#0000FF':

$imgcolor = $color_0000FF;

$drawn = 1;

break;

case '#FFFF00':

$imgcolor = $color_FFFF00;

$drawn = 1;

break;

case '#00FF00':

$imgcolor = $color_00FF00;

$drawn = 1;

break;

case '#000000':

$imgcolor = $color_000000;

$drawn = 1;

break;

case '#FFFFFF':

$imgcolor = $color_FFFFFF;

break;

}

imagefilledrectangle ($im, $changedpos2, $changedpos1, ($changedpos2+4), ($changedpos1+4), $imgcolor);

}

}

 

if($drawn == 0) return false;

 

@mkdir('wp-content/uploads/', 0755);

@mkdir('wp-content/uploads/comments/', 0755);

@mkdir('wp-content/uploads/comments/'.date('Y'), 0755);

@mkdir('wp-content/uploads/comments/'.date('Y').'/'.date('m'), 0755);

$image = 'wp-content/uploads/comments/'.date('Y').'/'.date('m').'/'.md5(uniqid(rand(), true)).'.jpg';

ImagePNG ($im, $image);

return $image;

}

Nuoroda į pranešimą
Dalintis kituose puslapiuose

o ten ne tas kitas failas comments.php kur irgi virsui idejau ?

ar kazko nesuprantu jeigu reikia bandysiu dar kokiu failu paieskoti

tam wordprese :)

 

Templates

404 Template (404.php)

Archives (archive.php)

Archives Page Template (archives.php)

Comments (comments.php)

Footer (footer.php)

Header (header.php)

Image Attachment Template (image.php)

Links Page Template (links.php)

Main Index Template (index.php)

Page Template (page.php)

Popup Comments (comments-popup.php)

Search Form (searchform.php)

Search Results (search.php)

Sidebar (sidebar.php)

Single Post (single.php)

Theme Functions (functions.php)

Styles

RTL Stylesheet (rtl.css)

Stylesheet (style.css)

 

kurio reikia ?

Redagavo petriux
Nuoroda į pranešimą
Dalintis kituose puslapiuose

Upload the full directory into your wp-content/plugins directory

Activate the plugin through the 'Plugins' menu in WordPress

Make sure you placed <?php do_action('comment_form', $post->ID); ?> in your comment templates

 

viska taip padarei?? ;] man atrodo ,kad paskutines eilutes neispildei ;]

Nuoroda į pranešimą
Dalintis kituose puslapiuose

draw_comments.php

 

The problem is, your website root is not the wordpress root,

where's your "wp-content" folder?

 

I guess, cause the admin panel works fine, the folder is here:

 

/usr/local/psa/home/vhosts/willyoumary.me/httpdocs/tvswordpress/wp-admin

 

 

The Website root is this folder

 

"/usr/local/psa/home/vhosts/willyoumary.me/httpdocs"

 

but i think there's no "wp-content", so my plugin don't find the images

at the website.

 

 

""

 

 

Try the complete path to your

"wp-content" =>

/usr/local/psa/home/vhosts/willyoumary.me/httpdocs/tvswordpress/ =>

 

""

if(is_file('/usr/local/psa/home/vhosts/willyoumary.me/httpdocs/tvswordpress/wp-content/uploads/comments/'.$splitresult['1'].'/'.$splitresult['2'].'/'.$splitresult['3'].'.jpg')

 

||

is_file('../wp-content/uploads/comments/'.$splitresult['1'].'/'.$splitresult['2'].'/'.$splitresult['3'].'.jpg')){

""

Nuoroda į pranešimą
Dalintis kituose puslapiuose

Prisijunkite prie diskusijos

Jūs galite rašyti dabar, o registruotis vėliau. Jeigu turite paskyrą, prisijunkite dabar, kad rašytumėte iš savo paskyros.

Svečias
Parašykite atsakymą...

×   Įdėta kaip raiškusis tekstas.   Atkurti formatavimą

  Only 75 emoji are allowed.

×   Nuorodos turinys įdėtas automatiškai.   Rodyti kaip įprastą nuorodą

×   Jūsų anksčiau įrašytas turinys buvo atkurtas.   Išvalyti redaktorių

×   You cannot paste images directly. Upload or insert images from URL.

Įkraunama...
  • Dabar naršo   0 narių

    Nei vienas registruotas narys šiuo metu nežiūri šio puslapio.

×
×
  • Pasirinkite naujai kuriamo turinio tipą...