/**
 * Parse Textile
 *
 * Takes a string as input and parse the Textile
 *
 * @param	string	$str			The string to be parsed
 * @param	bool	$parse_smileys	Parse the smileys or not
 * @return	string
 */
function parse($str, $clear = 0, $parse_smileys = FALSE)
{
    $ci =& get_instance();
    if (!class_exists('Textile')) {
        $ci->load->library('Textile');
    }
    $str = htmlspecialchars_decode($str);
    $str = $ci->textile->TextileThis($str);
    if ($parse_smileys) {
        // All this funky code applys smileys to anything OUTSIDE code blocks
        preg_match_all('/<code>.*?<\\/code>/s', $str, $code_blocks, PREG_PATTERN_ORDER);
        $block_num = 0;
        foreach ($code_blocks[0] as $block) {
            $str = str_replace($block, "{block_{$block_num}}", $str);
            $block_num++;
        }
        $str = parse_smileys($str, image_url("smileys/"));
        $block_num = 0;
        foreach ($code_blocks[0] as $block) {
            $str = str_replace("{block_{$block_num}}", $block, $str);
            $block_num++;
        }
    }
    $str = preg_replace('/<code>*\\s*/s', '<code>', $str);
    return preg_replace('/\\s*<\\/code>/s', '</code>', $str);
}
Exemple #2
0
 public function post($year = NULL, $month = NULL, $day = NULL, $url_title = NULL)
 {
     $this->load->module_model('blog', 'comments_model', 'comments');
     $this->load->module_model('blog', 'users_model', 'users');
     if ($data['post'] = $this->blog->get_post_by_url($year, $month, $day, $url_title)) {
         $data['post']['url'] = post_url($data['post']['url_title'], $data['post']['date_posted']);
         $data['post']['display_name'] = $this->users->get_user_display_name($data['post']['author']);
         if ($data['post']['allow_comments'] == 1) {
             $this->comment($data['post']['id'], $data['post']['url']);
         }
         $data['comments'] = $this->comments->get_comments($data['post']['id']);
         if ($data['comments'] != "") {
             foreach ($data['comments'] as $key => $comment) {
                 $data['comments'][$key]['content'] = parse_bbcode(nl2br(parse_smileys($comment['content'], base_url() . 'application/views/admin/static/javascript/tiny_mce/plugins/emotions/img/')));
                 if ($comment['user_id'] != "") {
                     $website = $this->users->get_user_website($comment['user_id']);
                     $display_name = $this->users->get_user_display_name($comment['user_id']);
                     $data['comments'][$key]['author'] = '<a href="' . prep_url($website) . '" target="_blank">' . $display_name . '</a>';
                 } else {
                     if ($comment['author_website'] != "") {
                         $data['comments'][$key]['author'] = '<a href="' . prep_url($comment['author_website']) . '" target="_blank">' . $comment['author'] . '</a>';
                     }
                 }
             }
         }
         $this->_template['page'] = 'blog/single_post';
     } else {
         $this->_template['page'] = 'errors/404';
     }
     $this->system_library->load($this->_template['page'], $data);
 }
Exemple #3
0
function smiles_custom($content)
{
    $CI =& get_instance();
    $CI->load->helper('smiley');
    $content = parse_smileys($content, getinfo('uploads_url') . 'smiles/');
    return $content;
}
Exemple #4
0
/**
* Parse bbCode
*
* Takes a string as input and replace bbCode by (x)HTML tags
*
* @access    public
* @param    string    the text to be parsed
* @return    string
*/
function parse_bbcode($str, $clear = 0, $parse_smileys = FALSE)
{
    $bbcode_to_parse = _get_bbcode_to_parse_array();
    if (FALSE === $bbcode_to_parse) {
        return FALSE;
    }
    foreach ($bbcode_to_parse as $key => $val) {
        for ($i = 1; $i <= $bbcode_to_parse[$key][2]; $i++) {
            $str = preg_replace($key, $bbcode_to_parse[$key][$clear], $str);
        }
    }
    $str = break_lines($str);
    if ($parse_smileys) {
        // All this funky code applys smileys to anything OUTSIDE code blocks
        preg_match_all('/<code>.*?<\\/code>/s', $str, $code_blocks, PREG_PATTERN_ORDER);
        $block_num = 0;
        foreach ($code_blocks[0] as $block) {
            $str = str_replace($block, "{block_{$block_num}}", $str);
            $block_num++;
        }
        $str = parse_smileys($str, image_url("smileys/"));
        $block_num = 0;
        foreach ($code_blocks[0] as $block) {
            $str = str_replace("{block_{$block_num}}", $block, $str);
            $block_num++;
        }
    }
    $str = preg_replace('/<code>*\\s*/s', '<code>', $str);
    return preg_replace('/\\s*<\\/code>/s', '</code>', $str);
}
Exemple #5
0
 /**
  * Parse BBcode as HTML
  * @param String $content
  * @param Array $disabled_tools
  * @return String
  */
 public function parse($content, $disabled_tools = false)
 {
     $tools = $this->getTools($disabled_tools);
     // Convert each tool output into bbcode
     foreach ($tools as $tool) {
         if (!empty($tool['parse']['regex_search']) && !empty($tool['parse']['regex_replace']) && $tool['enabled']) {
             $content = preg_replace($tool['parse']['regex_search'], $tool['parse']['regex_replace'], $content);
         }
     }
     // Re-create the line breaks
     $content = nl2br($content);
     // Convert space into actual HTML space
     $content = preg_replace("/  /", "&nbsp;&nbsp;", $content);
     // Show emoticons
     $content = parse_smileys($content, base_url() . $this->CI->config->item('smiley_path'));
     return $content;
 }
 public function parse_string($template, $data = array(), $return = FALSE, $config = array())
 {
     if (!is_array($config)) {
         $config = array();
     }
     $config = array_merge($this->config, $config);
     if ($config['image_url'] == '') {
         $config['image_url'] = image_url('lib/smileys/');
     }
     $ci = $this->ci;
     $is_mx = false;
     if (!$return) {
         list($ci, $is_mx) = $this->detect_mx();
     }
     $template = parse_smileys($template, (string) $config['image_url'], $config['smileys']);
     return $this->output($template, $return, $ci, $is_mx);
 }
Exemple #7
0
 public function updates()
 {
     $new_exists = false;
     $user_id = $this->authentication->read('identifier');
     $last_seen = $this->last->get_by('user_id', $user_id);
     $last_seen = empty($last_seen) ? 0 : $last_seen->message_id;
     $exists = $this->message->latest_message($user_id, $last_seen);
     //echo $exists;
     if ($exists) {
         $new_exists = true;
     }
     // THIS WHOLE SECTION NEED A GOOD OVERHAUL TO CHANGE THE FUNCTIONALITY
     if ($new_exists) {
         $new_messages = $this->message->unread($user_id);
         $thread = array();
         $senders = array();
         foreach ($new_messages as $message) {
             if (!isset($senders[$message->from])) {
                 $senders[$message->from]['count'] = 1;
             } else {
                 $senders[$message->from]['count'] += 1;
             }
             $owner = $this->user->get($message->from);
             $chat = array('msg' => $message->id, 'sender' => $message->from, 'recipient' => $message->to, 'avatar' => $owner->avatar != '' ? $owner->avatar : 'no-image.jpg', 'body' => parse_smileys($message->message, $this->smiley_url), 'time' => date("M j, Y, g:i a", strtotime($message->time)), 'type' => $message->from == $user_id ? 'out' : 'in', 'name' => $message->from == $user_id ? 'You' : ucwords($owner->firstname));
             array_push($thread, $chat);
         }
         $groups = array();
         foreach ($senders as $key => $sender) {
             $sender = array('user' => $key, 'count' => $sender['count']);
             array_push($groups, $sender);
         }
         // END OF THE SECTION THAT NEEDS OVERHAUL DESIGN
         $this->last->update_lastSeen($user_id);
         $response = array('success' => true, 'messages' => $thread, 'senders' => $groups);
         //add the header here
         header('Content-Type: application/json');
         echo json_encode($response);
     }
 }
    // On récupère le message
    // On cherche l'auteur du potin
    include_once 'modele/infos_potin.php';
    $auteur_potin = auteur_du_potin($_POST['id_Potin'], $bdd);
    if ($auteur_potin != $id_user) {
        // Notification à l'auteur du potin
        include_once 'modele/notifications.php';
        if (!notif_existe_deja($auteur_potin, 'comment_mypotin', $_POST['id_Potin'], 0, $bdd)) {
            nouvelle_notif($auteur_potin, 'comment_mypotin', $_POST['id_Potin'], 0, $bdd);
        }
    }
    // On cherche tous les commentateurs du potin
    include_once 'modele/commentaires.php';
    $auteurs_com = qui_a_commente_potin($_POST['id_Potin'], $bdd);
    if ($auteurs_com != 'erreur_nocom') {
        // Notification à tous ceux qui ont commenté, sauf l'auteur du potin
        foreach ($auteurs_com as $key => $auteur_courant) {
            if ($auteur_courant != $id_user && $auteur_courant != $auteur_potin) {
                include_once 'modele/notifications.php';
                if (!notif_existe_deja($auteur_courant, 'reply_comment', $_POST['id_Potin'], 0, $bdd)) {
                    nouvelle_notif($auteur_courant, 'reply_comment', $_POST['id_Potin'], 0, $bdd);
                }
            }
        }
    }
    // On écrit le commentaire dans la bdd
    $req = $bdd->prepare('INSERT INTO commentaires(id_auteur, id_potin, date_com, texte) VALUES(?, ?, NOW(), ?)');
    $req->execute(array($id_user, $_POST['id_Potin'], $_POST['comment']));
}
echo '<p><span class="fa fa-comment-o" style="color:grey;" aria-hidden="true"></span> ' . parse_smileys(str_replace("\n", "<br/>", $commentaire)) . '</p>';
Exemple #9
0
<?php 
}
?>


<h2><?php 
echo $album;
?>
 <small><?php 
echo $num_photos;
?>
 photos</small></h2>

<div id="intro">
	<p><?php 
echo parse_smileys(nl2br($full_txt), base_url() . '/assets/i/smileys/');
?>
</p>

</div>

<?php 
foreach ($query->result() as $row) {
    $img = '<img src="' . base_url() . $row->photo . '_thumb' . $row->photo_type . '" alt="' . $row->name . '" />';
    ?>

	<div class="photo">
		<div class="frame">
            <?php 
    echo anchor(base_url() . $row->photo . '_mid' . $row->photo_type, $img, array('class' => 'frame', 'rel' => 'lightbox-album', 'title' => $row->name));
    ?>
Exemple #10
0
function vue_affichage_potin($potin_courant, $id_user, $bdd)
{
    include_once 'controleur/includes/fonctions/parse_smiley.php';
    include_once 'modele/infos_potin.php';
    include_once 'modele/requetes_vote.php';
    include_once 'modele/commentaires.php';
    include_once 'modele/contenu_vu.php';
    // Si on n'avait pas vu ce potin
    if (!contenu_deja_vu($id_user, $potin_courant['id_Potin'], 'potin', $bdd)) {
        // On l'enregistre comme vu
        new_contenu_vu($id_user, $potin_courant['id_Potin'], 'potin', $bdd);
    }
    $resultat = '';
    $resultat .= '<div class="col-xs-12 col-potin-test" id="potin-' . $potin_courant['id_Potin'] . '"  typePotin="v3">

	<div class="row row-potin-test">
					
				<div class="potin-g-test">';
    if ($potin_courant['id_auteur'] == $id_user) {
        $resultat .= '<div class="dropdown dropdown-potin">
					    <span id="dLabel" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
					    	<span class="caret"></span>
					    </span>
					    
					  
					  <ul class="dropdown-menu dropdown-potin-menu" role="menu" aria-labelledby="dLabel">
					    <li><a class="drop-supprimer-potin" idPotin="' . $potin_courant['id_Potin'] . '" href="#">Supprimer</a></li>
					  </ul>
					</div>';
    }
    $resultat .= '<div class="potin-potin">
						<h4>';
    $nom_concernes = explode(',', $potin_courant['concernes']);
    $id_concernes = explode(',', $potin_courant['id_Concernes']);
    $nb_concernes = count($nom_concernes);
    $resultat .= 'Sur ';
    for ($i = 0; $i < $nb_concernes - 1; $i++) {
        //index.php?page=page_membre&id_concerne=3&onglet=potins
        $resultat .= '<a href="' . INDEX . '?page=page_membre&id_concerne=' . $id_concernes[$i] . '&onglet=potins">' . htmlspecialchars($nom_concernes[$i]) . '</a>';
        if ($i == $nb_concernes - 2) {
            $resultat .= ' et ';
        } else {
            $resultat .= ', ';
        }
    }
    $resultat .= '<a href="' . INDEX . '?page=page_membre&id_concerne=' . $id_concernes[$i] . '&onglet=potins">' . htmlspecialchars($nom_concernes[$nb_concernes - 1]) . '</a>';
    $resultat .= ' dans <a href="' . INDEX . '?page=groupe&id_groupe=' . $potin_courant['id_Groupe'] . '">' . htmlspecialchars($potin_courant['nom_groupe']) . '</a>';
    $resultat .= '</h4>
					
						<h5>';
    $resultat .= 'Quelqu\'un a écrit, le ' . htmlspecialchars($potin_courant['nom_jour_potin']) . ' ' . htmlspecialchars($potin_courant['jour_potin']) . ' ' . htmlspecialchars($potin_courant['mois_potin']) . ' ' . htmlspecialchars($potin_courant['annee_potin']) . '<br>';
    $resultat .= '</h5>
					
						<p>' . parse_smileys(str_replace("\n", "<br/>", $potin_courant['Potin'])) . '</p>

						<p>';
    // Affichage de l'image, si il y en a une
    if ($potin_courant['Image'] != '') {
        $resultat .= '<img class="image-potin-test" src="' . $potin_courant['Image'] . '" alt="Photo du potin"/>';
    } else {
        $resultat .= '<br>';
    }
    $resultat .= '</p>

					</div>';
    // On détermine la véracité du potin
    switch (resultat_vote($potin_courant['id_Potin'], $bdd)) {
        case 'sur':
            $resv_css = 'sur';
            $resv_text = 'C\'est sûr !';
            $resultat .= '<br>';
            // On ajoute un espacement
            break;
        case 'possible':
            $resv_css = 'possible';
            $resv_text = 'C\'est possible.';
            $resultat .= '<br>';
            break;
        case 'surement_faux':
            $resv_css = 'surement_faux';
            $resv_text = 'C\'est sûrement faux ...';
            $resultat .= '<br>';
            break;
        case 'faux':
            $resv_css = 'faux';
            $resv_text = 'C\'est faux !';
            $resultat .= '<br>';
            break;
        case 'calomnie':
            $resv_css = 'calomnie';
            $resv_text = 'Ce n\'est que pure calomnie !';
            $resultat .= '<br>';
            break;
        default:
            $resv_css = 'none';
            $resv_text = '';
            break;
    }
    $resultat .= '<div class="potin-vote-wrapper">';
    // Affichage de la véracité du potin
    $resultat .= '<div class="potin-resultat-vote resv-' . $resv_css . '" data-toggle="tooltip" data-placement="top" title="Cet avis est donné par un algorithme secret">
						' . $resv_text . '
					</div>';
    $resultat_votes = resultat_vote($potin_courant['id_Potin'], $bdd);
    $nb_votes_pos = nb_votes_positif($potin_courant['id_Potin'], $bdd);
    $nb_votes_neut = nb_votes_ne_sait_pas($potin_courant['id_Potin'], $bdd);
    $nb_votes_neg = nb_votes_negatif($potin_courant['id_Potin'], $bdd);
    $nb_de_votants = nb_votants($potin_courant['id_Potin'], $bdd);
    if ($nb_de_votants != 0) {
        $barre_positif = $nb_votes_pos / $nb_de_votants * 100;
        $barre_negatif = $nb_votes_neg / $nb_de_votants * 100;
        $barre_neutre = $nb_votes_neut / $nb_de_votants * 100;
    } else {
        $barre_positif = 0;
        $barre_negatif = 0;
        $barre_neutre = 0;
    }
    if ($id_user == auteur_du_potin($potin_courant['id_Potin'], $bdd)) {
        $resultat .= '<div class="vote-progressbar-wraper">';
        if ($barre_positif != 0) {
            $resultat .= '<span class="vote-progressbar" style="border: 1px solid #5cb85c; width: ' . $barre_positif . '%;"></span>';
        }
        if ($barre_neutre != 0) {
            $resultat .= '<span class="vote-progressbar" style="border: 1px solid #5bc0de; width: ' . $barre_neutre . '%;"></span>';
        }
        if ($barre_negatif != 0) {
            $resultat .= '<span class="vote-progressbar" style="border: 1px solid #d9534f; width: ' . $barre_negatif . '%;"></span>';
        }
        $resultat .= '</div>';
    } else {
        if (deja_vote($potin_courant['id_Potin'], $id_user, $bdd)) {
            $resultat .= '<div class="vote-progressbar-wraper">';
            if ($barre_positif != 0) {
                $resultat .= '<span class="vote-progressbar" style="border: 1px solid #5cb85c; width: ' . $barre_positif . '%;"></span>';
            }
            if ($barre_neutre != 0) {
                $resultat .= '<span class="vote-progressbar" style="border: 1px solid #5bc0de; width: ' . $barre_neutre . '%;"></span>';
            }
            if ($barre_negatif != 0) {
                $resultat .= '<span class="vote-progressbar" style="border: 1px solid #d9534f; width: ' . $barre_negatif . '%;"></span>';
            }
            $resultat .= '</div>';
            $vote_user = vote_user($potin_courant['id_Potin'], $id_user, $bdd);
            $resultat .= '<div class="boutons-vote-wrapper">';
            $resultat .= '<span class="potin-bouton Bvrai';
            if ($vote_user == 1) {
                $resultat .= '-active';
            }
            $resultat .= '" typeBouton="vrai" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3">C\'est vrai</span>';
            $resultat .= '<span class="potin-bouton Bnesaitpas';
            if ($vote_user == 0) {
                $resultat .= '-active';
            }
            $resultat .= '" typeBouton="nesaitpas" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3">Je ne sais pas</span>';
            $resultat .= '<span class="potin-bouton Bfaux';
            if ($vote_user == -1) {
                $resultat .= '-active';
            }
            $resultat .= '" typeBouton="faux" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3">C\'est faux</span>';
            $resultat .= '</div>';
        } else {
            $resultat .= '<div class="boutons-vote-wrapper">';
            $resultat .= '<span class="potin-bouton Bvrai" typeBouton="vrai" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3">C\'est vrai</span>';
            $resultat .= '<span class="potin-bouton Bnesaitpas" typeBouton="nesaitpas" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3">Je ne sais pas</span>';
            $resultat .= '<span class="potin-bouton Bfaux" typeBouton="faux" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3">C\'est faux</span>';
            $resultat .= '</div>';
        }
    }
    $resultat .= '</div>
				</div>
		
				<div class="potin-d-test">
					<div class="potin-commentaires">
					
					  	<h4>Commentaires</h4>';
    $commentaires = rechercher_commentaires($potin_courant['id_Potin'], $bdd);
    if ($commentaires != 'erreur_nocom') {
        foreach ($commentaires as $clef => $valeur) {
            $com_courant = infos_commentaire($valeur, $bdd);
            // Si on n'avait pas vu ce commentaire
            if (!contenu_deja_vu($id_user, $com_courant['id_com'], 'comment', $bdd)) {
                // On l'enregistre comme vu
                new_contenu_vu($id_user, $com_courant['id_com'], 'comment', $bdd);
            }
            //$resultat .=  '<h5>'.$com_courant['prenom'].' '.$com_courant['nom'].'</h5>';
            $resultat .= '<p><span class="fa fa-comment-o" style="color:grey;" aria-hidden="true"></span> ' . parse_smileys(str_replace("\n", "<br/>", $com_courant['texte'])) . '</p>';
        }
    } else {
        $resultat .= '<h5>Soyez le premier à commenter !</h5>';
    }
    $resultat .= '</div>

					<div class="potin-form-com">
						<textarea class="potin-textarea-com" rows="1" id="potin-com" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3" placeholder="Commentez !"></textarea>
					

						<div class="potin-envoyer-com" idUser="******" idPotin="' . $potin_courant['id_Potin'] . '" typePotin="v3"><span class="glyphicon glyphicon-send" aria-hidden="true"></span></div>
					</div>
				</div>
				
	</div>

</div>';
    return $resultat;
}
Exemple #11
0
 function getPost()
 {
     if ($this->tank_auth->is_logged_in()) {
         $user_id = $this->tank_auth->get_user_id();
     } else {
         $user_id = 1;
     }
     $PostId = $_POST['str'];
     $data['get_post_by_id'] = $this->post_model->get_post_by_id($PostId);
     $noofcomment = $this->post_model->get_Nocomment_by_Postid($PostId);
     foreach ($data['get_post_by_id'] as $value) {
         if ($value->postBG != "") {
             $style = "width:558px;height:61px;padding:20px;word-wrap:break-word;color:#fff;background-image:url('" . asset_url() . "img/bg/" . $value->postBG . "')";
         } else {
             $style = "width:558px;height:61px;padding:20px;word-wrap:break-word;";
         }
         //we can add gender after username in comment by adding this line (<small><a href='#'>Gender</a></small>)
         $show = "\n\t <div class='modal-dialog'>\n                <div class='modal-content'>\n                    <div class='modal-header'>\n                        <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>\n                        <h4 class='modal-title text-primary'><a type='button' class='btn btn-primary btn-circle'><i class='fa fa-comment'></i></a>&nbsp;\t\t\t\t\t\t\t\t                 <strong>POST</strong></h4>\n                    </div>\n                    \n                    <div class='modal-body'>\n                   <h3 class='timeline-header'><a href='#'>" . $value->categories_name . "</a>&nbsp; By " . $value->username . "</h3>\n                     <div class='timeline-body text-center' style=" . $style . "> " . parse_smileys($value->postContent, asset_url() . "smileys/") . "</div>&nbsp;\n\t\t\t\t\t\t\t\t\t\t <!-- Chat box -->\n                            <div class='box box-success'>\n                                <div class='box-header'> \n                                 <span style='margin-top:6px;' class='btn btn-primary btn-circle pull-left' ><i class='fa fa-comments'></i></span>\n                                 <h3 class='box-title'> Comments</h3>\n                                </div>\n\t\t\t\t\t\t\t\t<div class='box-body chat scroll' id='chat-box'><!--open chat item -->";
         if ($noofcomment > 0) {
             $data['getCommentBYPostId'] = $this->post_model->get_comment_by_Postid($PostId);
             foreach ($data['getCommentBYPostId'] as $commentvalue) {
                 $date = explode(' ', $commentvalue->commentAt);
                 $userimg = $commentvalue->user_image;
                 if ($userimg == '') {
                     $userpath = "img/avatar3.png";
                 } else {
                     $userpath = "img/profile_pics/" . $userimg;
                 }
                 $show .= "<div class='item'>\n                                       <img src='" . asset_url() . $userpath . "' alt='user image' class='offline'/>\n                                        <p class='message'>\n                                            <a href='#' class='name'>\n                                                <small class='text-muted pull-right'><i class='fa fa-clock-o'></i> " . $date[1] . "</small>\n                                                " . $commentvalue->username . "\n                                            </a>\n                                           " . $commentvalue->commentText . "\n                                        </p>\n                                    </div>";
             }
         }
         $show .= "</div>\n\t\t\t <div class='box-footer'>\n\t\t\t  <form action='" . base_url() . "Posts/doComment'  method='post' onclick='return getlocaltimeComment()'>\n                                    <div class='input-group'>\n\t\t\t\t\t\t\t\t\t<input type='hidden' name='gettimeComment' id='gettimeComment' value=''/>\n                                   <input type='hidden' name='userid' id='userid' value='" . $user_id . "'/>\n                                    <input type='hidden' name='postid' id='postid' value='" . $PostId . "'/>\n                                         <input class='form-control' name='commentText' type='text' placeholder='Type comment...'/>\n                                        <div class='input-group-btn'>\n                                            <button type='submit' class='btn btn-success'><i class='fa fa-plus'></i></button>\n                                        </div>\n                                    </div></form>\n                               </div><!-- /.footer -->\n                            </div><!-- /.box (chat box) -->\n                            </div>\n                    \n                </div><!-- /.modal-content -->\n            </div><!-- /.modal-dialog -->";
         echo $show;
     }
 }
Exemple #12
0
/**
 *
 *
 * @global string $db_url
 * @global dom $dom
 * @param boolean $parse_smileys Defaults to TRUE
 * @param boolean $filter_words Defaults to FALSE
 * @param boolean $processUsername Defaults to FALSE
 * @param boolean $processTime Defaults to FALSE
 * @param boolean $apply_filter Defaults to TRUE
 * @return array
 */
function get_all_data($parse_smileys = true, $filter_words = false, $processUsername = false, $processTime = false, $apply_filter = true)
{
    global $db_url;
    global $dom;
    $db = YDB::factory($db_url);
    $data = array();
    $data = $db->queryAll(parse_tbprefix("SELECT p.pid AS id, p.ip AS ip , p.uid AS uid ,p.uname AS uname,p.content AS post_content,p.post_time AS time,r.content AS reply_content,r.r_time AS reply_time ,u.username AS b_username FROM <post> AS p LEFT JOIN <reply> AS r ON p.pid=r.pid LEFT JOIN <sysuser> AS u ON p.uid=u.uid ORDER BY p.post_time DESC"));
    foreach ($data as &$_data) {
        if ($apply_filter && ZFramework::app()->filter_type == ConfigController::FILTER_TRIPTAGS) {
            if (strstr(ZFramework::app()->allowed_tags, 'code')) {
                $_data['post_content'] = preg_replace_callback('|<code>(.*)</code>|sU', create_function('$matches', 'return "<pre class=\'prettyprint\'>".str_replace(">","&gt;",str_replace("<","&lt;",$matches[1]))."</pre>";'), $_data['post_content']);
                $_data['reply_content'] = preg_replace_callback('|<code>(.*)</code>|sU', create_function('$matches', 'return "<pre class=\'prettyprint\'>".str_replace(">","&gt;",str_replace("<","&lt;",$matches[1]))."</pre>";'), $_data['reply_content']);
                if (!strstr(ZFramework::app()->allowed_tags, 'pre')) {
                    ZFramework::app()->allowed_tags .= "<pre>";
                }
            }
            $_data['post_content'] = strip_tags($_data['post_content'], ZFramework::app()->allowed_tags);
            $_data['reply_content'] = strip_tags($_data['reply_content'], ZFramework::app()->allowed_tags);
        } else {
            $_data['post_content'] = htmlentities($_data['post_content'], ENT_COMPAT, 'UTF-8');
            $_data['reply_content'] = htmlentities($_data['reply_content'], ENT_COMPAT, 'UTF-8');
        }
        if ($parse_smileys) {
            $dom->loadHTML($_data['post_content']);
            $_data['post_content'] = html_entity_decode(parse_smileys($_data['post_content'], SMILEYDIR, getSmileys()));
            if ($_data['reply_content']) {
                $dom->loadHTML($_data['reply_content']);
                $_data['reply_content'] = html_entity_decode(parse_smileys($_data['reply_content'], SMILEYDIR, getSmileys()));
            }
        }
        if ($filter_words) {
            $_data['post_content'] = filter_words($_data['post_content']);
        }
        if ($processUsername) {
            $_data['user'] = $_data['uname'] == ZFramework::app()->admin ? "<font color='red'>{$_data['uname']}</font>" : $_data['uname'];
        }
        if ($processTime) {
            $_data['time'] = date('m-d H:i', $_data['time'] + ZFramework::app()->timezone * 60 * 60);
            $_data['reply_time'] = date('m-d H:i', $_data['reply_time'] + ZFramework::app()->timezone * 60 * 60);
        }
    }
    return $data;
}
Exemple #13
0
 function postParse($message, $smileys = 1)
 {
     $message = parse_bbcode($message);
     if ($smileys) {
         $message = parse_smileys($message);
     }
     $message = nl2br(stripslashes($message));
     return $message;
 }
Exemple #14
0
        </section>
    </section>
    <div id="fadeandscale" style="">
            <div class="box">
                <div id="type">
                        <h3>What's New</h3>
                        <?php 
$str = '
                        -> Improved User Interface :)<br>
                        -> More Secure than ever. :coolsmile:<br>
                        -> One password for all sub-domains. All logins will now have<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;same username and password. :cheese:<br>
                        -> Added Forgot Password functionality. :question:<br>
                        -> Performance Enhancements. Browse faster and better. :coolhmm:<br>
                        -> Bugs or Issues? Drop an email: saurabhgarg510@gmail.com 8-/';
$str = parse_smileys($str, base_url() . 'public/smileys');
echo $str;
?>

                </div>
            </div>
    </div>
    <!-- Include jQuery Popup Overlay -->
    <script src="<?php 
echo base_url();
?>
public/js/jquery.popupoverlay.js"></script>
    <script>
        $(document).ready(function() {
            // Initialize the plugin
            $('#fadeandscale').popup({
Exemple #15
0
    echo $ins_id;
    ?>
">X</a></p>
        <div class="imageUnit-content">
        
          <h4><a href="#" ><?php 
    echo $fulln;
    ?>
</a></h4>
          <p>0 sec ago</p>
         
        </div>
    </div>

      <p class="msg_wrap"><?php 
    echo parse_smileys(make_clickable(nl2br(stripslashes($message))), $smiley_folder);
    ?>
</p>
       <?php 
    if (!empty($video)) {
        ?>
          <iframe width="400" height="300" src="http://www.youtube.com/embed/<?php 
        echo get_youtubeid($video);
        ?>
" frameborder="0" allowfullscreen></iframe>
          <?php 
    } elseif (!empty($image)) {
        ?>
          <img src="<?php 
        echo $base_url;
        ?>
Exemple #16
0
 public function add($material_id = '')
 {
     $this->load->library('table');
     $this->load->library('captcha_lib');
     $this->load->library('typography');
     // Подготавливаем массив с картинками-смайлами
     $img_array = get_clickable_smileys(base_url() . 'img/smileys/', 'comment_text');
     $col_array = $this->table->make_columns($img_array, 15);
     $data = array();
     //Массив по свежим материалам
     $data['latest_materials'] = $this->materials_model->get_latest();
     //Массив по популярным материалам
     $data['popular_materials'] = $this->materials_model->get_popular();
     // Архив
     $data['archive_list'] = $this->administration_model->get_archive();
     //Массив по одному материалу
     $data['main_info'] = $this->materials_model->get($material_id);
     // Комментарии к материалу
     $data['comments_list'] = $this->comments_model->get_by($material_id);
     // Готовая таблица смайлов
     $data['smiley_table'] = $this->table->generate($col_array);
     $data['links'] = $this->comments_model->get_links($material_id);
     $data['main_info']['ban_img_url'] = $this->sections_model->get_ban_url_by($material_id);
     // Признак слайдирования баннера
     $data['ban_slide'] = FALSE;
     // Не нажата кнопка "Комментировать"
     if (!isset($_POST['post_comment'])) {
         $data['info'] = 'Вы обратились к файлу напрямую, не нажав кнопку "Комментировать"';
         $name = 'info';
         $this->display_lib->user_info_page($data, $name);
     } else {
         //Установка правил валидации
         $this->form_validation->set_rules($this->comments_model->add_rules);
         $val_res = $this->form_validation->run();
         // Если валидация пройдена
         if ($val_res == TRUE) {
             //Получаем значение поля капча
             $entered_captcha = $this->input->post('captcha');
             //Если оно совпадает со значением в сессии (значение там уже есть - сессия с цифрами капчи создается
             //при просмотре материала, а комментирование идет только со страницы материала)
             if ($entered_captcha == $this->session->userdata('rnd_captcha')) {
                 $comment_text = $this->input->post('comment_text');
                 // TRUE - более двух переводов строки все равно считаются за два перевода
                 $comment_text = $this->typography->auto_typography($comment_text, TRUE);
                 $comment_text = parse_smileys($comment_text, base_url() . 'img/smileys/');
                 // Массив для вставки данных по комментарию
                 $comment_data = array();
                 //Уже передан как параметр функции add
                 $comment_data['material_id'] = $material_id;
                 $comment_data['author'] = $this->input->post('author');
                 $comment_data['comment_text'] = $comment_text;
                 $comment_data['date'] = date('Y-m-d');
                 //Вставляем комментарий в базу
                 $this->comments_model->add_new($comment_data);
                 //Готовим данные для отправки письма-оповещения администратору
                 //Имя отправителя
                 $author = $this->input->post('author');
                 // Переносы после 70 знаков (ограничение функции mail в PHP)
                 $comment_text = wordwrap($comment_text, 70);
                 // Удаляем html-тэги для удобства чтения
                 $comment_text = strip_tags($comment_text);
                 //Куда отправляется письмо
                 //$address = "*****@*****.**";
                 //$address = "";
                 // Тема письма
                 $subject = "Комментарий к материалу: " . $data['main_info']['title'];
                 // Сообщение
                 $message = "Написал(а):{$author}\nТекст комментария:\n{$comment_text}\nСсылка: http://abclass.ru/materials/{$material_id}#captcha";
                 // Оправляем письмо-оповощение
                 mail($address, $subject, $message, "Content-type:text/plain;charset = utf-8\r\n");
                 $data['fail_captcha'] = '';
                 $data['success_comment'] = 'Ваш комментарий успешно добавлен<br><a href="#new_comment">Просмотреть комментарий</a>';
                 //получаем код капчи
                 $data['imgcode'] = $this->captcha_lib->captcha_actions();
                 //Получаем список комментариев к материалу заново (так как только что был добавлен новый комментарий)
                 $data['comments_list'] = $this->comments_model->get_by($material_id);
                 $name = 'materials/content';
                 $this->display_lib->user_mat_page($data, $name);
             } else {
                 $data['fail_captcha'] = 'Неверно введены цифры с картинки<br><a href="#captcha">Ввести еще раз!<a>';
                 //получаем код капчи
                 $data['imgcode'] = $this->captcha_lib->captcha_actions();
                 $data['success_comment'] = '';
                 $name = 'materials/content';
                 $this->display_lib->user_mat_page($data, $name);
             }
         } else {
             $data['fail_captcha'] = '';
             $data['imgcode'] = $this->captcha_lib->captcha_actions();
             //получаем код капчи
             $data['success_comment'] = '';
             $name = 'materials/content';
             $this->display_lib->user_page($data, $name);
         }
     }
 }
Exemple #17
0
 /**
  * Format text
  * @param String $text
  * @param Boolean $nl2br
  * @param Boolean $smileys
  * @param Boolean $xss
  * @param Mixed $break
  */
 public function format($text, $nl2br = false, $smileys = true, $xss = true, $break = false)
 {
     // Prevent Cross Site Scripting
     if ($xss && is_string($text)) {
         $text = $this->CI->security->xss_clean($text);
         $text = htmlspecialchars($text);
     }
     // Wordwrap
     if ($break) {
         $text = wordwrap($text, $break, "<br />", true);
     }
     // Convert new lines to <br>
     if ($nl2br) {
         $text = nl2br($text);
     }
     // Show emoticons
     if ($smileys) {
         $text = parse_smileys($text, base_url() . $this->CI->config->item('smiley_path'));
     }
     return $text;
 }
Exemple #18
0
 private function format($str)
 {
     $this->load->helper('smiley');
     $this->load->helper('typography');
     return str_replace("\n", "", auto_typography(parse_smileys($str, asset_url('smileys/'))));
 }
Exemple #19
0
 public function smiley_helper()
 {
     //DEPRECATED
     $this->load->helper('smiley');
     $this->load->library('table');
     $image_array = get_clickable_smileys(base_url('/smileys'), 'comments');
     $col_array = $this->table->make_columns($image_array, 8);
     $data['smiley_table'] = $this->table->generate($col_array);
     //$image_array = smiley_js("comment_textarea_alias", "comments");
     $str = 'Here are some smileys: :-)  ;-)';
     $str = parse_smileys($str, base_url('/smileys'));
     echo $str;
     $this->load->view('smiley_view', $data);
     //get_clickable_smileys($image_url[, $alias = ''[, $smileys = NULL]]
     //smiley_js([$alias = ''[, $field_id = ''[, $inline = TRUE]]])
     //parse_smileys([$str = ''[, $image_url = ''[, $smileys = NULL]]])
 }
Exemple #20
0
 /**
  * Insert items into the cart and save it to the session table
  *
  * @access	public
  * @param	string
  * @return	void
  */
 function album($album_url = FALSE, $photo_id = FALSE)
 {
     if (!$album_url) {
         show_404();
     }
     $album = $this->Gallery_model->get_album_title($album_url);
     if (!$album) {
         show_404();
     }
     if ($photo_id) {
         return $this->view_photo($album, $photo_id);
     }
     $data['title'] = 'Album: ' . $album['name'];
     $data['heading'] = $album['name'];
     $data['album'] = $album['name'];
     $data['album_url'] = $album['url'];
     $data['theme'] = $album['theme'];
     $data['private'] = $album['private'];
     $data['js'] = $this->Gallery_model->get_theme_js($data['theme']);
     $data['favicon'] = $this->Gallery_model->get_theme_favicon($data['theme']);
     $data['num_photos'] = $this->Gallery_model->count_photos($album['id']);
     $data['full_txt'] = parse_smileys(nl2br($album['full_txt']), $this->config->item('base_url') . "/assets/i/smileys");
     $data['query'] = $this->Gallery_model->get_photos($album['id']);
     $data['main'] = 'gallery/album';
     $data['referer'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : FALSE;
     $this->load->view('gallery/gallery', $data);
 }
Exemple #21
0
<?php

$content = parse_smileys($content, site_url() . 'assets/img/smilies/');
?>
<h1><?php 
echo $title;
?>
</h1>
<div class="content">
    <?php 
echo $content;
?>
</div>
<div class="page-share">
    <div>
        <g:plusone size="tall"></g:plusone>
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="vertical" data-via="navruzm" data-lang="tr">Tweet</a>
        <?php 
add_js_link('//apis.google.com/js/plusone.js');
?>
        <?php 
add_js_link('//platform.twitter.com/widgets.js');
?>
    </div>
</div>
Exemple #22
0
 function showFullPost()
 {
     $postid = $_POST['postid'];
     $data['query'] = $this->post_model->getpostbyid($postid);
     foreach ($data['query'] as $value) {
         if ($value->postStatus == "Active") {
             $btnclass = 'btn-danger';
             $icon = "<i class='fa fa-times'></i>";
             $val = "Make Deactive";
         } else {
             $btnclass = ' btn-primary';
             $icon = "<i class='fa fa-check'></i>";
             $val = "Make Active";
         }
         if ($value->postIsSeen == 0) {
             $this->post_model->readPost($postid);
         }
         //we can add gender after username in comment by adding this line (<small><a href='#'>Gender</a></small>)
         $show = "\n\t <div class='modal-dialog'>\n                <div class='modal-content'>\n                    <div class='modal-header'>\n                        <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>\n                        <h4 class='modal-title text-primary'><a type='button' class='btn btn-primary btn-circle'><i class='fa fa-comment'></i></a>&nbsp;\t\t\t\t\t\t\t\t                 <strong>POST</strong></h4>\n                    </div>\n                    \n                    <div class='modal-body'>\n                   <h3 class='timeline-header'><a href='#'>" . $value->categories_name . "</a>&nbsp; By " . $value->username . "</h3>\n                     <div class='timeline-body' style='word-wrap:break-word;'> " . parse_smileys($value->postContent, asset_url() . "smileys/") . "</div>&nbsp;\n\t\t\t\t\t\t\t\t\t\t <!-- Chat box -->\n                           \n\t\t\t\t\t\t\t\t <div class='box-footer'>\n\t\t\t  \t\t\t\t<a href=" . base_url() . "admin/changePostStatus/" . $value->postId . " class='btn btn-block " . $btnclass . "'>\n\t\t\t\t\t\t\t" . $icon . " " . $val . "</a>\n\t\t\t\t\t\t\t<a href=" . base_url() . "admin/managepost class='btn btn-block btn-default'>\n\t\t\t\t\t\t\tClose</a>\n                                 </div><!-- /.footer -->\n                            </div><!-- /.box (chat box) -->\n                            </div>\n                    \n                </div><!-- /.modal-content -->\n            </div><!-- /.modal-dialog -->";
         echo $show;
     }
 }
Exemple #23
0
 function getCommentOnLoad()
 {
     $show = "<div class='box-body chat scroll' id='chat-box'><!--open chat item -->";
     $data['getCommentBYPostId'] = $this->post_model->get_comment_by_Postid($PostId);
     foreach ($data['getCommentBYPostId'] as $commentvalue) {
         $date = explode(' ', $commentvalue->commentAt);
         $userimg = $commentvalue->user_image;
         if ($userimg == '') {
             $userpath = "img/avatar3.png";
         } else {
             $userpath = "img/profile_pics/" . $userimg;
         }
         $show .= "<div class='item'>\n        \t\t<img src='" . asset_url() . $userpath . "' alt='user image' class='offline'/>\n                 <p class='message'>\n                 <a href='#' class='name'>\n                 <small class='text-muted pull-right'><i class='fa fa-clock-o'></i> " . $date[1] . "</small>\n                  " . $commentvalue->username . "\n                 </a>" . parse_smileys($commentvalue->commentText, asset_url() . "smileys/") . "\n                   </p>\n                   </div>";
     }
 }
Exemple #24
0
function parse_smileys_call()
{
echo parse_smileys($message, $smiley_folder);
}
Exemple #25
0
'>
										<?php 
        echo $row->categories_name;
        // $this->lang->line('cate'.$row->categories_id);
        ?>
</a>&nbsp; By 
										<?php 
        echo $row->username;
        ?>
</h3>
                                        <div class="timeline-body text-center" <?php 
        echo "style=" . $style;
        ?>
>
                                           <?php 
        echo parse_smileys($row->postContent, asset_url() . "smileys/");
        ?>
                                            <?php 
        if ($row->postFileContent != "") {
            $ext = explode(".", $row->postFileContent);
            if ($ext[1] == 'jpg' || $ext[1] == 'jpeg' || $ext[1] == 'gif' || $ext[1] == 'png' || $ext[1] == 'JPG' || $ext[1] == 'PNG' || $ext[1] == 'JPEG') {
                echo "<img src=" . asset_url() . "UploadFiles/" . $row->postFileContent . ">";
            } elseif ($ext[1] == "avi" || $ext[1] == "flv" || $ext[1] == "wmv" || $ext[1] == "mp4") {
                ?>
                                            <video width="400" controls>
                                            <source src="<?php 
                echo asset_url() . "UploadFiles/" . $row->postFileContent;
                ?>
" type="video/<?php 
                echo $ext[1];
                ?>
Exemple #26
0
<li id="li-comment-<?php 
    echo $ins_id;
    ?>
">
<div class="acomment-avatar">
<a href="#" rel="nofollow">
<img src="<?php 
    echo $base_url;
    ?>
img/avatar04.png" alt="Avatar Image" >
</a>
<p style="float:right; text-align:right; font-size:10px;"><a href="javascript:;" rel="<?php 
    echo $post_id;
    ?>
" class="comment-delete" id="comment_delete_<?php 
    echo $ins_id;
    ?>
">X</a></p>
</div>
<div class="acomment-meta">
<a href="#" target="_blank"><?php 
    echo $fulln;
    ?>
</a>  0 sec ago 
</div>
<div class="acomment-content"><p class="msg_wrap"><?php 
    echo parse_smileys(make_clickable(nl2br(stripslashes($comment))), $smiley_folder);
    ?>
</p></div></li>
<?php 
}
Exemple #27
0
        ?>
" />							
					</div>
					<div class="thecomment">
						<div class="author"><?php 
        echo $row->comment_author;
        ?>
</div>
						<div class="time"><?php 
        echo date($this->config->item('comment_date_format'), $row->comment_date);
        ?>
</div>
						<div class="clear"></div>
						<div class="text">
							<p><?php 
        echo nl2br_except_pre(parse_smileys($row->comment_content, $this->config->item('base_url') . "/images/"));
        ?>
</p>
						</div>
					</div>
				</div>											
			<?php 
    }
    ?>
		<?php 
} else {
    ?>
			<p><?php 
    echo lang('kb_no_comments');
    ?>
</p>
Exemple #28
0
<html>
<head>
<title>Smileys</title>

<?php 
echo smiley_js();
?>

</head>
<body>

<form name="blog">
<textarea name="comments" id="comments" cols="40" rows="4"></textarea>
</form>

<p>Click to insert a smiley!</p>

<?php 
echo $smiley_table;
$str = 'Here are some simileys: :-) ;-) :P';
$str = parse_smileys($str, asset_url() . "smileys/");
echo $str;
?>
</body>
</html>
Exemple #29
0
  </div>
<?php 
}
if ($success) {
    ?>
				<div class="success">
 <span class="message_content">Data Sukses Disimpan</span>
</div>
<?php 
    unset($v);
}
?>
			<?php 
if ($tguestbook_list) {
    foreach ($tguestbook_list as $value) {
        echo "<li><strong><u>" . $value['nama'] . "</u></strong> ( " . $value['tanggal'] . " ): " . nl2br(parse_smileys($value['komentar'], "http://localhost/blogger/smileys/")) . " <hr></li>";
    }
}
echo $page_links;
echo js_insert_smiley('bukutamu', 'komentar');
?>
				<form name="bukutamu" method="post">
				<label>Nama</label><input name="nama" size="24" class="form-control" placeholder="isikan Nama lengkap anda" value="<?php 
echo $v->nama;
?>
">
				<label>Email</label><input name="email" size="24" class="form-control" placeholder="*****@*****.**" value=<?php 
echo $v->email;
?>
>
				<label>Komentar</label><textarea  name="komentar" class="form-control" placeholder="isi komentar..."><?php 
Exemple #30
0
 /**
  * Show the printer page
  *
  * @access	public
  */
 function printer()
 {
     $this->load->helper('typography');
     $uri = $this->uri->segment(3, 0);
     if ($uri != '' && $uri != 'index') {
         $uri = $this->input->xss_clean($uri);
         $data['article'] = $this->article_model->get_article_by_uri($uri);
         $data['article']->article_description = parse_smileys($data['article']->article_description, $this->config->item('base_url') . "/images/");
         $data['title'] = $data['article']->article_title . ' | ' . $this->init_model->get_setting('site_name');
     } else {
         $data = '';
     }
     echo $this->init_model->load_body('printer', 'front', $data);
 }