Changeset 43
- Timestamp:
- 03/15/06 14:01:59 (2 years ago)
- Files:
-
- trunk/public_html/akarru.lib/memes.php (modified) (5 diffs)
- trunk/public_html/post.php (modified) (5 diffs)
- trunk/smarty/configs/site.conf (modified) (2 diffs)
- trunk/smarty/templates/comment.tpl (modified) (1 diff)
- trunk/smarty/templates/memes_grid.tpl (modified) (1 diff)
- trunk/smarty/templates/post_1.tpl (modified) (1 diff)
- trunk/smarty/templates/post_2.tpl (modified) (1 diff)
- trunk/smarty/templates/post_3.tpl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/public_html/akarru.lib/memes.php
r38 r43 2 2 include_once('lib/xmlrpc.inc'); 3 3 include_once('lib/xmlrpcs.inc'); 4 5 function get_youtube($url) 6 { 7 $matches = array(); 8 @preg_match('/v=(.*)$/', $url, $matches); 9 if (empty($matches[1])) { 10 return ''; 11 } 12 $url = 'http://youtube.com/v/'.$matches[1]; 13 return '<object width="300" height="250"><param name="movie" value="'.$url.'"></param><embed src="'.$url.'" type="application/x-shockwave-flash" width="300" height="250"></embed></object>'; 14 } 4 15 5 16 class memes { … … 82 93 function get_meme($id) 83 94 { 84 $sql = 'select p.title,p. content,p.date_posted,p.date_promo,p.rank,p.clicks,p.category,p.url,p.submitted_user_id,p.ID,pc.cat_title,u.username, u.email, pc.ID as cat_id, p.votes as vote_count, comments as comment_count from posts p, post_cats pc, users u where pc.ID=p.category and u.ID=p.submitted_user_id ';95 $sql = 'select p.title,p.is_micro_content,p.content,p.date_posted,p.date_promo,p.rank,p.clicks,p.category,p.url,p.submitted_user_id,p.ID,pc.cat_title,u.username, u.email, pc.ID as cat_id, p.votes as vote_count, comments as comment_count from posts p, post_cats pc, users u where pc.ID=p.category and u.ID=p.submitted_user_id '; 85 96 $sql .= ' and p.ID='.$id; 86 97 $result = $this->db->fetch_object($sql); 87 98 $result->small_gravatar = get_gravatar($bm_url, $result->email, 16); 99 if ($result->is_micro_content == 2) { 100 $result->micro_content = get_youtube($result->url); 101 } 88 102 return $result; 89 103 } … … 106 120 function get_comments($meme_id) 107 121 { 108 $sql = ' select c.title, c.content, c.date_posted, u.username, u.email ';122 $sql = ' select c.title, c.content, c.date_posted, u.username, u.email, c.post_id as ID ' ; 109 123 $sql .= ' from post_comments c left join users u on c.user_id = u.ID '; 110 124 $sql .= ' where post_id = '.$meme_id; … … 196 210 $meme_id = $meme->ID; 197 211 $uid = $this->user_id; 198 if ( empty($uid)) {199 $ uid = 0;212 if (!empty($uid) && !empty($meme_id)) { 213 $meme->voted = $this->db->fetch_scalar("select count(*) from post_votes where post_id = $meme_id and user_id = $uid "); 200 214 } 201 $meme->voted = $this->db->fetch_scalar("select count(*) from post_votes where post_id = $meme_id and user_id = $uid "); 215 $mc = $meme->is_micro_content; 216 if ($mc == 2) { 217 $meme->micro_content = get_youtube($meme->url); 218 } 202 219 $result[] = $meme; 203 220 } … … 305 322 $date_posted = time(); 306 323 $trackback = $data['meme_trackback']; 307 $sql = 'insert into posts(title,content,date_posted,date_promo,category,url,submitted_user_id,trackback) '; 308 $sql .= "values('$title','$content',$date_posted,$date_posted,$category,'$url',$user_id,'$trackback')"; 324 $content_type = $data['content_type']; 325 $sql = 'insert into posts(title,content,date_posted,date_promo,category,url,submitted_user_id,trackback,is_micro_content) '; 326 $sql .= "values('$title','$content',$date_posted,$date_posted,$category,'$url',$user_id,'$trackback', $content_type)"; 309 327 if ($this->db->execute($sql)) 310 328 { trunk/public_html/post.php
r8 r43 32 32 $title = $_POST['title']; 33 33 $url = $_POST['url']; 34 $smarty->assign('content_type', $_POST['content_type']); 34 35 if (empty($title)) { 35 36 $smarty->assign('error_title', true); … … 58 59 } 59 60 elseif ($_POST['step'] == 2) { 61 $smarty->assign('content_type', $_POST['content_type']); 60 62 $title = $_POST['title']; 61 63 $url = $_POST['url']; … … 81 83 $smarty->assign('meme_trackback', check_plain($meme_trackback)); 82 84 $smarty->assign('meme_tags', check_plain($meme_tags)); 85 $smarty->assign('micro_content', get_youtube($url)); 83 86 if ($bm_errors == 0) { 84 87 $step = 3; … … 91 94 } 92 95 else if ($_POST['step'] == 3) { 96 $smarty->assign('content_type', $_POST['content_type']); 93 97 if (!empty($_POST['do_edit'])) { 94 98 $step = 2; … … 109 113 $smarty->assign('meme_tags', check_plain($meme_tags)); 110 114 $smarty->assign('cats', $bm_options); 115 $smarty->assign('micro_content', get_youtube($url)); 111 116 } 112 117 else trunk/smarty/configs/site.conf
r40 r43 1 1 site_caption="Blog Memes" 2 2 promote_label_url="promueve noticias" 3 post_label_url="envía una noticia"3 post_label_url="envía contenido" 4 4 popular_label_url="lo más popular" 5 5 unpopular_label_url="lo menos popular" … … 38 38 label_register_submit="registra cuenta" 39 39 label_recover_pass_submit="recuperar email" 40 40 label_content_type="tipo de contenido:" 41 41 post_instructions='un meme es una unidad de transmisión cultural' 42 42 post_criteria='<ul><li><b>Calidad del contenido </b>¿Es relevante o interesante la historia que estás publicando?</li><li><b>¿Está escrita en Castellano o Español?</b></li><li><b>Se descriptivo:</b> Eres tu propio editor, se breve y explica porqué la historia a publicar es relevante.</li></ul>' trunk/smarty/templates/comment.tpl
r26 r43 23 23 {if $meme->vote_count > 7} |  <a href="circulation.php?meme_id={$meme->ID}">circulación</a>{/if}</div> 24 24 </div> 25 {if $meme->micro_content} 26 <div style="padding:2px">{$meme->micro_content}</div> 27 {/if} 28 25 29 <p> 26 30 {$meme->content|nl2br} trunk/smarty/templates/memes_grid.tpl
r36 r43 32 32 {$meme->date_posted|date_format:$bf_date_posted} 33 33 {if $meme->vote_count > 7} |  <a href="circulation.php?meme_id={$meme->ID}">circulación</a>{/if}</div> 34 34 35 <p style="right-margin:1em"> 36 {if $meme->micro_content} 37 <div style="padding:4px">{$meme->micro_content}</div> 38 {/if} 35 39 {$meme->content|nl2br} 36 40 </p> trunk/smarty/templates/post_1.tpl
r2 r43 17 17 {if $error_duplicate_url}<tr><td class="error">{#error_duplicate_url#}</td></tr>{/if} 18 18 {if $error_url}<tr><td class="error">{#error_url#}</td></tr>{/if} 19 <tr><td class="view-label-class">{#label_content_type#}</td></tr> 20 <tr><td> 21 <select class="view-input-class" name="content_type"> 22 <option value="0" selected="selected">url</option> 23 <option value="2">youtube</option> 24 </select> 25 </td></tr> 19 26 <tr><td><input type="hidden" name="step" value="{$step}" /><input class="view-button-class" type="submit" value="{#post_submit_label#}" name="do_post" /> 20 27 </table> trunk/smarty/templates/post_2.tpl
r2 r43 18 18 <tr><td><input class="view-input-class" value="{$meme_trackback}" name="meme_trackback" size="60" /></td></tr> 19 19 {if $error_trackback}<tr><td class="error">{#error_trackback#}</td></tr>{/if} 20 <tr><td><input type="hidden" name=" step" value="{$step}" />20 <tr><td><input type="hidden" name="content_type" value="{$content_type}" /><input type="hidden" name="step" value="{$step}" /> 21 21 <input class="view-button-class" type="submit" value="{#post_submit_label#}" name="do_post" /> 22 22 </td></tr> trunk/smarty/templates/post_3.tpl
r2 r43 22 22 style="font-size:10px" href="profile.php?user_name={$logged_username}">{$logged_username}</a> 23 23 {$meme->date_posted|date_format:$bf_date_posted}</div> 24 {if $micro_content} 25 <div style="padding:2px">{$micro_content}</div> 26 {/if} 24 27 <p> 25 28 {$content_body|nl2br} … … 30 33 {if $meme_tags}etiquetas: {$meme_tags} | {/if}<input type="hidden" name="meme_tags" value="{$meme_tags}" /> {if $meme_trackback}| <a href="{$meme_trackback}" alt="{$meme_trackback}">trackback</a><input type="hidden" name="meme_trackback" value="{$meme_trackback}" /> {/if} 31 34 <input type="hidden" name="step" value="{$step}" /> 35 <input type="hidden" name="content_type" value="{$content_type}" /> 32 36 </div></td> 33 37 </tr>
