Exemplo n.º 1
0
                 // nampiditra comment
                 if ($comment) {
                     $daty = gmmktime();
                     $qry = $DB->query("INSERT INTO #__namana_sary_comments (user, saryid, comment, daty) VALUES('{$USER->username}', '{$saryid}', '{$comment}', {$daty})");
                     $nbcomments = $DB->get_var("SELECT count(id) FROM #__namana_sary_comments WHERE saryid='{$saryid}'");
                     $qry = $DB->query("UPDATE #__namana_sary SET comments = {$nbcomments} WHERE saryid='{$saryid}'");
                     del_cache("namana|sary|comments|" . $saryid);
                 }
             }
             $debut = $debut ? $debut : 0;
             $limite = 20;
             $total = $nbcomments > 0 ? $nbcomments : $DB->get_var("SELECT count(id) FROM  #__namana_sary_comments WHERE saryid='{$saryid}' ");
             $comments = get_cache("SELECT * FROM #__namana_sary_comments WHERE saryid='{$saryid}' ORDER BY id LIMIT {$debut}, {$limite}", -1, "namana|sary|comments|" . $saryid);
             $sary->comments = $comments;
             $smarty->assign("sary", $sary);
             if (is_blocked($sary->user)) {
                 $smarty->assign("blocked", true);
             }
             $smarty->assign("debut", $debut);
             $smarty->assign("limite", $limite);
             $smarty->assign("total", $total);
             $x_body .= $smarty->fetch($CFG->moddir . "namana/templates/sary_comments.htm");
         }
     }
     break;
 case "blog":
     $x_title = "Sary halefa any amin'ny blaogy.com";
     $x_body = "";
     if ($saryid) {
         if (!$hash) {
             // satria efa md5-ed ny pass dia tsy maintsy takiana indray
/**
 * Private functions (Undocumented)
 *
 * @param string $text
 * @param string $link
 * @param bool $priv
 * @param bool $pop
 * @param bool $popsize
 * @return mixed
 */
function private_addnav($text, $link = false, $priv = false, $pop = false, $popsize = "500x300")
{
    //don't call this directly please.  I'll break your thumbs if you do.
    global $nav, $session, $accesskeys, $REQUEST_URI, $quickkeys, $navschema, $notranslate;
    if (is_blocked($link)) {
        return false;
    }
    $thisnav = "";
    $unschema = 0;
    $translate = true;
    if (isset($notranslate)) {
        if (in_array(array($text, $link), $notranslate)) {
            $translate = false;
        }
    }
    if (is_array($text)) {
        if ($text[0] && $session['loggedin']) {
            if ($link === false) {
                $schema = "!array!" . serialize($text);
            } else {
                $schema = $text[0];
            }
            if ($translate) {
                tlschema($navschema[$schema]);
                $unschema = 1;
            }
        }
        if ($link != "!!!addraw!!!") {
            if ($translate) {
                $text[0] = translate($text[0]);
            }
            $text = call_user_func_array("sprintf", $text);
        } else {
            $text = call_user_func_array("sprintf", $text);
        }
    } else {
        if ($text && $session['loggedin'] && $translate) {
            tlschema($navschema[$text]);
            $unschema = 1;
        }
        if ($link != "!!!addraw!!!" && $text > "" && $translate) {
            $text = translate($text);
        }
        //leave the hack in here for now, use addnav_notl please
    }
    $extra = "";
    $ignoreuntil = "";
    if ($link === false) {
        //$text = holidayize($text,'nav');
        $thisnav .= tlbutton_pop() . templatereplace("navhead", array("title" => appoencode($text, $priv)));
    } elseif ($link === "") {
        //$text = holidayize($text,'nav');
        $thisnav .= tlbutton_pop() . templatereplace("navhelp", array("text" => appoencode($text, $priv)));
    } elseif ($link == "!!!addraw!!!") {
        $thisnav .= $text;
    } else {
        if ($text != "") {
            $extra = "";
            if (strpos($link, "?")) {
                $extra = "&c={$session['counter']}";
            } else {
                $extra = "?c={$session['counter']}";
            }
            $extra .= "-" . date("His");
            //hotkey for the link.
            $key = "";
            if ($text[1] == "?") {
                // check to see if a key was specified up front.
                $hchar = strtolower($text[0]);
                if ($hchar == ' ' || array_key_exists($hchar, $accesskeys) && $accesskeys[$hchar] == 1) {
                    $text = substr($text, 2);
                    //$text = holidayize($text,'nav');
                    if ($hchar == ' ') {
                        $key = " ";
                    }
                } else {
                    $key = $text[0];
                    $text = substr($text, 2);
                    //$text = holidayize($text,'nav');
                    $found = false;
                    $text_len = strlen($text);
                    for ($i = 0; $i < $text_len; ++$i) {
                        $char = $text[$i];
                        if ($ignoreuntil == $char) {
                            $ignoreuntil = "";
                        } else {
                            if ($ignoreuntil != "") {
                                if ($char == "<") {
                                    $ignoreuntil = ">";
                                }
                                if ($char == "&") {
                                    $ignoreuntil = ";";
                                }
                                if ($char == "`") {
                                    $ignoreuntil = $text[$i + 1];
                                }
                            } else {
                                if ($char == $key) {
                                    $found = true;
                                    break;
                                }
                            }
                        }
                    }
                    if ($found == false) {
                        //the hotkey for this link wasn't actually in the
                        //text, prepend it in parens.
                        if (strpos($text, "__") !== false) {
                            $text = str_replace("__", "(" . $key . ") ", $text);
                        } else {
                            $text = "(" . strtoupper($key) . ") " . $text;
                        }
                        $i = strpos($text, $key);
                    }
                }
            } else {
                //$text = holidayize($text,'nav');
            }
            if ($key == "") {
                //we have no previously defined key.  Look for a new one.
                $tlength = strlen($text);
                for ($i = 0; $i < $tlength; $i++) {
                    $char = substr($text, $i, 1);
                    if ($ignoreuntil == $char) {
                        $ignoreuntil = "";
                    } else {
                        if (isset($accesskeys[strtolower($char)]) && $accesskeys[strtolower($char)] == 1 || strpos("abcdefghijklmnopqrstuvwxyz0123456789", strtolower($char)) === false || $ignoreuntil != "") {
                            if ($char == "<") {
                                $ignoreuntil = ">";
                            }
                            if ($char == "&") {
                                $ignoreuntil = ";";
                            }
                            if ($char == "`") {
                                $ignoreuntil = substr($text, $i + 1, 1);
                            }
                        } else {
                            break;
                        }
                    }
                }
            }
            if (!isset($i)) {
                $i = 0;
            }
            if ($i < strlen($text) && $key != ' ') {
                $key = substr($text, $i, 1);
                $accesskeys[strtolower($key)] = 1;
                $keyrep = " accesskey=\"{$key}\" ";
            } else {
                $key = "";
                $keyrep = "";
            }
            if ($key == "" || $key == " ") {
            } else {
                $pattern1 = "/^" . preg_quote($key, "/") . "/";
                $pattern2 = "/([^`])" . preg_quote($key, "/") . "/";
                $rep1 = "`H{$key}`H";
                $rep2 = "\$1`H{$key}`H";
                $text = preg_replace($pattern1, $rep1, $text, 1);
                if (strpos($text, "`H") === false) {
                    $text = preg_replace($pattern2, $rep2, $text, 1);
                }
                if ($pop) {
                    if ($popsize == "") {
                        $quickkeys[$key] = "window.open('{$link}')";
                    } else {
                        $quickkeys[$key] = popup($link, $popsize);
                    }
                } else {
                    $quickkeys[$key] = "window.location='{$link}{$extra}'";
                }
            }
            $n = templatereplace("navitem", array("text" => appoencode($text, $priv), "link" => HTMLEntities($link . ($pop != true ? $extra : ""), ENT_COMPAT, getsetting("charset", "ISO-8859-1")), "accesskey" => $keyrep, "popup" => $pop == true ? "target='_blank'" . ($popsize > "" ? " onClick=\"" . popup($link, $popsize) . "; return false;\"" : "") : ""));
            $n = str_replace("<a ", tlbutton_pop() . "<a ", $n);
            $thisnav .= $n;
        }
        $session['allowednavs'][$link . $extra] = true;
        $session['allowednavs'][str_replace(" ", "%20", $link) . $extra] = true;
        $session['allowednavs'][str_replace(" ", "+", $link) . $extra] = true;
        if (($pos = strpos($link, "#")) !== false) {
            $sublink = substr($link, 0, $pos);
            $session['allowednavs'][$sublink . $extra] = true;
        }
    }
    if ($unschema) {
        tlschema();
    }
    $nav .= $thisnav;
    return $thisnav;
}
Exemplo n.º 3
0
<?php

namespace MFP\BlockUsers;

/**
 * Shows a blocked notice when viewing user has blocked content owner.
 */
$title = elgg_echo('block_users:blocked_user_notice');
$content = elgg_view_title($title);
$user = get_user_by_username(get_input('blocked_username'));
if ($user instanceof \ElggUser) {
    // don't show if not blocked
    if (!is_blocked($user, elgg_get_logged_in_user_entity())) {
        forward();
    }
    $next = get_input('next', '/block_users/blocked_users');
    $message = elgg_view('output/url', array('href' => 'action/block_users/unblock?blocked_user_guid=' . $user->getGUID() . '&next=' . urlencode($next), 'text' => elgg_echo('block_users:unblock_user_name', array($user->name)), 'confirm' => true));
} else {
    $url = '/block_users/blocked_users';
    $message = elgg_view('output/url', array('href' => $url, 'text' => elgg_echo('block_users:manage_blocked_users')));
}
$body = elgg_view_layout('one_column', array('content' => $content . $message));
echo elgg_view_page($title, $body);
Exemplo n.º 4
0
function messages_send_action($hook, $type, $return, $params)
{
    $user = get_user_by_username(get_input('recipient_username'));
    if (is_blocked(elgg_get_logged_in_user_entity(), $user)) {
        elgg_make_sticky_form('messages');
        register_error(elgg_echo('block_users:blocked_content_notice'));
        return false;
    }
}
Exemplo n.º 5
0
<?php

namespace MFP\BlockUsers;

/**
 * Unblock a user
 */
$blocked_user = get_entity(get_input('blocked_user_guid'));
$blocking_user = get_entity(get_input('blocking_user_guid', elgg_get_logged_in_user_guid()));
if (!is_blocked($blocked_user, $blocking_user)) {
    register_error(elgg_echo('block_users:unblock:cannot_unblock'));
    forward(REFERRER);
}
if (unblock_user($blocked_user, $blocking_user)) {
    system_message(elgg_echo('block_users:unblock:unblocked_user'));
} else {
    register_error(elgg_echo('block_users:unblock:cannot_unblock'));
}
$next = get_input('next', REFERRER);
forward($next);