Пример #1
0
function ReplaceInFTrad($ss, $TableColumn, $IdRecord, $IdTrad = 0, $IdOwner = 0)
{
    if ($IdOwner == 0) {
        $IdMember = $_SESSION['IdMember'];
    } else {
        $IdMember = $IdOwner;
    }
    //  echo "in ReplaceInMTrad \$ss=[".$ss."] \$IdTrad=",$IdTrad," \$IdOwner=",$IdMember,"<br />";
    $IdLanguage = $_SESSION['IdLanguage'];
    if ($IdTrad == 0) {
        return InsertInFTrad($ss, $TableColumn, $IdRecord, $IdMember);
        // Create a full new translation
    }
    $IdTranslator = $_SESSION['IdMember'];
    // the recorded translator will always be the current logged member
    $str = "select * from forum_trads where IdTrad=" . $IdTrad . " and IdLanguage=" . $IdLanguage;
    $rr = LoadRow($str);
    if (!isset($rr->id)) {
        //	  echo "[$str] not found so inserted <br />";
        return InsertInFTrad($ss, $TableColumn, $IdRecord, $IdMember, $IdLanguage, $IdTrad);
        // just insert a new record in memberstrads in this new language
    } else {
        if ($ss != addslashes($rr->Sentence)) {
            // Update only if sentence has changed
            MakeRevision($rr->id, "forum_trads");
            // create revision
            $str = "update forum_trads set TableColumn='" . $TableColumn . "',IdRecord=" . $IdRecord . ",IdTranslator=" . $IdTranslator . ",Sentence='" . $ss . "' where id=" . $rr->id;
            sql_query($str);
        }
    }
    return $IdTrad;
}
Пример #2
0
function DisplayAdminLogs($tData, $username, $type, $ip, $andS1, $andS2, $notAndS1, $notAndS2, $maxpos)
{
    global $title;
    $rTime = LoadRow("select now() as ss");
    $title = "Admin logs Server time: " . $rTime->ss;
    require_once "header.php";
    Menu1("", "Admin Logs page");
    // Displays the top menu
    Menu2("admin/adminlogs.php", ww('MainPage'));
    // Displays the second menu
    DisplayHeaderShortUserContent($title);
    ShowLeftColumn("", VolMenu());
    // Show the Actions
    // middle column
    echo "      <div id=\"col3\"> \n";
    echo "        <div id=\"col3_content\" class=\"clearfix\"> \n";
    echo "          <div class=\"info clearfix\">\n";
    $max = count($tData);
    $infoStyles = array(0 => "              <tr class=\"blank\" align=\"left\" valign=\"center\">\n", 1 => "              <tr class=\"highlight\" align=\"left\" valign=\"center\">\n");
    echo "          <table cellspacing=\"10\" cellpadding=\"10\" style=\"font-size:11px;\">\n";
    echo "            <tr>\n";
    if (empty($username)) {
        echo "              <th>Username</th>\n";
        echo "              <th>Type</th>\n";
        echo "              <th>Str</th>\n";
        echo "              <th>created</th>\n";
        echo "              <th>ip</th>\n";
    } else {
        echo "              <th colspan=4 align=center> Logs for ", LinkWithUsername(fUsername($username)), "</th>\n";
    }
    echo "</tr>\n";
    for ($ii = 0; $ii < $max; $ii++) {
        $logs = $tData[$ii];
        echo $infoStyles[$ii % 2];
        // this displays the <tr>
        if (!empty($logs->Username)) {
            echo "<td>";
            echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?Username="******"\">" . $logs->Username . "</a>";
            echo "</td>";
        } else {
            echo "<td>";
            // To do according to ip addresses replace with Google, Yahoo .. etc - an external solution is to be find
            switch (long2ip($logs->IpAddress)) {
                case "66.249.72.206":
                    echo "Googlebot/2.1";
                    break;
                case "74.6.23.107":
                    echo "Yahoo slurp";
                    break;
                case "127.0.0.1":
                    echo "<i>localhost</i>";
                    break;
                default:
                    echo "<i>not logged</i>";
                    break;
                    break;
            }
            echo "</td>";
        }
        echo "<td>";
        echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?Type=" . $logs->Type . "\">" . $logs->Type . "</a>";
        //    echo $logs->Type;
        echo "</td>";
        echo "<td>";
        echo $logs->Str;
        echo "</td>";
        echo "<td>{$logs->created}</td><td>&nbsp;";
        echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?ip=" . long2ip($logs->IpAddress) . "\">" . long2ip($logs->IpAddress) . "</a>";
        echo " <a href=\"http://ws.arin.net/whois/?queryinput=+" . long2ip($logs->IpAddress) . " \" target=\"new\">arinc</a>";
        echo " <a href=\"http://outils-rezo.info/cgi-bin/action.cgi?valeur=" . long2ip($logs->IpAddress) . "&cmd=Whois\" target=\"new\">whois</a>";
        echo "</td>";
        echo "</tr>\n";
    }
    echo "          </table>\n<br>";
    if ($max > 0) {
        echo _Pagination($maxpos);
    }
    echo "          <hr />\n";
    echo "          <table>\n";
    echo "            <form method='post' action='adminlogs.php'>\n";
    if (HasRight("Logs") > 1) {
        echo "              <tr>\n";
        echo "                <td>Username</td><td><input type=\"text\" name=\"Username\" value=\"" . (!empty($username) ? $username : '') . "\"></td>\n";
    } else {
        echo "              <tr>\n";
        echo "                <td>Username</td><td><input type=\"text\" readonly=\"readonly\" name=\"Username\" value=\"" . $username . "\"></td>";
    }
    echo "                <td>Type</td><td><input type=text name=Type value=\"" . $type . "\"></td>\n";
    echo "                <td>Ip</td><td><input type=text name=ip value=\"" . $ip . "\"></td>\n";
    echo "              </tr>\n";
    echo "              <tr><td>    Having</td><td><input type=text name=andS1 value=\"" . $andS1 . "\"></td></tr>";
    echo "        <tr><td>and Having</td><td><input type=text name=andS2 value=\"" . $andS2 . "\"></td></tr>";
    echo "        <tr><td>and not Having</td><td><input type=text name=NotandS1 value=\"" . $notAndS1 . "\"></td></tr>";
    echo "        <tr><td>and not Having</td><td><input type=text name=NotandS2 value=\"" . $notAndS2 . "\"></td></tr>";
    echo "                <tr><td colspan=2 align=center>";
    echo "<input type=submit id=submit>";
    echo "</td>\n";
    echo "              </tr>\n";
    echo "            </form>\n";
    echo "          </table>\n";
    echo "        </div>\n";
    require_once "footer.php";
}
Пример #3
0
    $meta_description = ww("default_meta_description");
}
echo "  <meta name=\"description\" content=\"", $meta_description, "\" />\n";
if (empty($meta_keyword)) {
    $meta_keyword = ww("default_meta_keyword");
}
echo "  <meta name=\"keywords\" content=\"", $meta_keyword, "\" />\n";
echo "  <meta name=\"ROBOTS\" content=\"INDEX, FOLLOW\" />\n";
echo "  <link rel=\"shortcut icon\" href=\"" . PVars::getObj("env")->baseuri . "favicon.ico\" />\n";
$stylesheet = "minimal";
// this is the default style sheet
// If is logged try to load appropriated style sheet
if (IsLoggedIn()) {
    if (!isset($_SESSION["stylesheet"])) {
        // cache in session to avoid a reload at each new page
        $rrstylesheet = LoadRow("select Value from memberspreferences where IdMember=" . $_SESSION['IdMember'] . " and IdPreference=6");
        if (isset($rrstylesheet->Value)) {
            $_SESSION["stylesheet"] = $stylesheet = $rrstylesheet->Value;
        }
    }
    $stylesheet = "minimal";
    // force YAML also for logged member (for now, todo several layout)
}
echo '  <link href="/styles/css/' . $stylesheet . '/minimal.css?3" rel="stylesheet" type="text/css" media="screen" />';
echo '<!--[if lte IE 7]>';
echo '  <link href="/styles/css/' . $stylesheet . '/patches/iehacks_3col_vlines.css" rel="stylesheet" type="text/css" media="screen" />';
echo '<![endif]-->';
echo "</head>";
if (isset($onLoadAction)) {
    echo "<body onload='{$onLoadAction}'>";
} else {
Пример #4
0
function DisplayAdminMassprepareenque($rBroadCast, $TGroupList, $TCountries, $TData, $count = 0, $countnonews = 0, $query = "")
{
    global $title;
    $title = "Admin Mass Mails";
    require_once "header.php";
    Menu1("", ww('MainPage'));
    // Displays the top menu
    Menu2("admin/adminmassmails.php", ww('MainPage'));
    // Displays the second menu
    $MenuAction = "            <li><a href=\"adminmassmails.php\">Admin Massmails</a></li>\n";
    $MenuAction .= "            <li><a href=\"adminmassmails.php?action=createbroadcast\">Create new broadcast</a></li>\n";
    if (HasRight("MassMail", "Send")) {
        // if has right to trig
        $MenuAction .= "            <li><a href=\"adminmassmails.php?action=ShowPendingTrigs\">Trigger mass mails</a></li>\n";
    }
    DisplayHeaderShortUserContent("Admin Mails - Broadcast Messages", "");
    ShowLeftColumn($MenuAction, VolMenu());
    $Name = $rBroadCast->Name;
    $IdGroup = GetParam("IdGroup", 0);
    $CountryIsoCode = GetParam("CountryIsoCode", 0);
    echo "    <div id=\"col3\"> \n";
    echo "      <div id=\"col3_content\" class=\"clearfix\"> \n";
    echo "        <div class=\"info clearfix\">\n";
    echo "<h2>For broadcast <b>", $Name, "</b></h2>";
    if ($count > 0) {
        echo "<p class=\"note\"> {$count} enqueued messages !<br /><i>{$countnonews} will not receive the mail because of their preference</i></p>";
    }
    $BroadCast_Title_ = getBroadCastElement("BroadCast_Title_" . $Name, 0);
    $BroadCast_Body_ = getBroadCastElement("BroadCast_Body_" . $Name, 0);
    $rr = LoadRow("select * from words where code='BroadCast_Title_" . $Name . "' and IdLanguage=0");
    if (isset($rr->Description)) {
        $Description = $rr->Description;
    } else {
        $Description = "";
    }
    echo "<h3>", nl2br($BroadCast_Title_), "</h3>";
    echo "<p>", nl2br($BroadCast_Body_), "</p>";
    echo "<br /><form method=\"post\" action=\"adminmassmails.php\" name=\"adminmassmails\" class=\"yform full\">\n";
    echo "<input type=\"hidden\" Name=\"IdBroadCast\" value=" . GetParam("IdBroadCast", 0) . ">\n";
    echo "<h3> Filtering the scope of the mass mail</h3>";
    echo "<div class=\"type-text\">";
    echo "<label for=\"Usernames\">Restrict to some members (ex : lupochen;kiwiflave;jeanyves)</label>";
    echo "<input type=\"text\" id=\"Usernames\" name=\"Usernames\" value=\"" . GetStrParam("Usernames", ""), "\" />\n";
    echo "</div>";
    echo "<div class=\"type-select\">";
    echo "<label for=\"CountryIsoCode\">Choose a country</label>";
    echo "<select id=\"CountryIsoCode\" name=\"CountryIsoCode\">";
    echo "<option value=\"0\">All countries</option>";
    for ($ii = 0; $ii < count($TCountries); $ii++) {
        echo "<option value=\"", $TCountries[$ii]->isoCode . '"';
        if (strcmp($TCountries[$ii]->isoCode, $CountryIsoCode) === 0) {
            echo " selected";
        }
        echo ">", $TCountries[$ii]->Name;
        echo "</option>";
    }
    echo "</select>\n";
    echo "</div>";
    echo "<div class=\"type-select\">";
    echo "<label for=\"IdGroup\">Choose a group</label>";
    echo "<select id=\"IdGroup\" name=\"IdGroup\">";
    echo "<option value=\"0\">All groups</option>";
    for ($ii = 0; $ii < count($TGroupList); $ii++) {
        echo "<option value=", $TGroupList[$ii]->id;
        if ($TGroupList[$ii]->id == $IdGroup) {
            echo " selected";
        }
        echo ">", $TGroupList[$ii]->Name, ":", $TGroupList[$ii]->Name;
        echo "</option>";
    }
    echo "</select>\n";
    echo "</div>";
    echo "<div class=\"type-text\">";
    echo "<label for =\"MemberStatus\">Member with status</label>";
    echo "<input type=\"text\" id=\"MemberStatus\" name=\"MemberStatus\" value=\"" . GetStrParam("MemberStatus", "Active") . "\" />\n";
    echo "</div>";
    echo '<div class="type-text">';
    echo '<label for="Limit">Maximum number of members (i.e. 100)</label>';
    echo '<input type="text" id="limit" name="limit" value="' . GetStrParam("limit", "") . '" />';
    echo '</div>';
    if (GetStrParam("random_order", "") == "on") {
        $random_order_checked = ' checked="checked"';
    } else {
        $random_order_checked = '';
    }
    echo '<div class="type-check">';
    echo '<p>';
    echo '<input type="checkbox"' . $random_order_checked . ' id="random_order" name="random_order" /> ';
    echo '<label for="random_order">Select random members</label>';
    echo '<br>Note: If this option is checked the recipients list below is only an example and does not reflect the list of members the mail will actually be sent to. Members will be randomly selected again when pressing "enqueue".';
    echo '</p>';
    echo '</div>';
    if (HasRight('MassMail', "test")) {
        if (GetStrParam("hide_recipients", "") == "on") {
            $checked = ' checked="checked"';
        } else {
            $checked = '';
        }
        echo '<div class="type-check">';
        echo '<p>';
        echo '<input type="checkbox"' . $checked . ' id="hide_recipients" name="hide_recipients" /> ';
        echo '<label for="hide_recipients">Hide recipients list</label>';
        echo '</p>';
        echo '</div>';
        echo '<p>';
        echo '<input type="submit" name="action" value="test" />';
        echo ' (Shows number of matching members and list of recipients)';
        echo '</p>';
    }
    // if it was a test action display the result build from previous filtering
    if (GetStrParam("action") == "test") {
        $max = count($TData);
        echo "<h3>This newsletter will be sent to {$max} members</h3>\n";
        if (GetStrParam("hide_recipients", "") != "on") {
            echo "<table>\n";
            echo "<tr align=left><th>Username</th><th>country</th>";
            if (IsAdmin()) {
                echo "<th>email</th>";
            }
            echo "<th>Status</th><th>Will try in</th></tr>";
            for ($ii = 0; $ii < $max; $ii++) {
                $m = $TData[$ii];
                echo "<tr class=\"highlight\">";
                echo "<td>", $m->Username, "</td>";
                echo "<td>", getcountrynamebycode($m->isoCode), "</td>";
                if (IsAdmin()) {
                    echo "<td>", GetEmail($m->id), "</td>";
                }
                echo "<td>", $m->Status, "</td>";
                $iLang = GetDefaultLanguage($m->id);
                $PrefLanguageName = LanguageName($iLang);
                echo "<td>", $PrefLanguageName, "</td>";
                echo "</tr>\n";
                echo "<tr>";
                echo "<td colspan=5 class=\"blank\">";
                echo getBroadCastElement("BroadCast_Title_" . $Name, $iLang, $m->Username), "<br />";
                echo getBroadCastElement("BroadCast_Body_" . $Name, $iLang, $m->Username), "<br />";
                echo "</td>";
                echo "</tr>";
            }
            echo "</table>\n";
        }
    }
    if (HasRight('MassMail', "enqueue")) {
        echo "<div class=\"note\">";
        echo "<div class=\"type-check\">";
        echo "<input type=\"checkbox\" id=\"enqueuetick\"  name=\"enqueuetick\" />";
        echo "<label for=\"enqueuetick\">Tick this if you really want to enqueue the messages to send and click on enqueue</label>";
        echo "</div>";
        echo "<div class=\"type-button\">";
        echo "<input type=\"submit\" name=\"action\" value=\"enqueue\" />\n";
        echo "</div>";
        echo "</div>";
    }
    echo "</form>\n";
    echo "<div> <!-- info -->\n";
    require_once "footer.php";
}
Пример #5
0
     $ss = "select rightsvolunteers.*,rights.Name as RightName,members.Username,members.STatus as MemberStatus from rightsvolunteers,rights,members where rights.id=rightsvolunteers.IdRight and rightsvolunteers.Level>=1 and rights.Name='SqlForVolunteers' and (Scope like '%\"" . $IdQuery . "\"%' or Scope like '%\"All\"%') and members.id=rightsvolunteers.IdMember";
     $TResult = array();
     $qry = sql_query($ss);
     while ($rr = mysql_fetch_object($qry)) {
         array_push($TResult, $rr);
     }
     DisplayUsers($rrQuery, $TResult, NULL, $Message);
     break;
 case "execute":
     $IdQuery = (int) GetParam("IdQuery", 0);
     $rrQuery = LoadRow("select * from sqlforvolunteers where id=" . $IdQuery);
     if (!isset($rrQuery->id)) {
         DisplayMyResults(array(), array(), array(), $rrQuery, "Sorry your query has failed #IdQuery=<b>" . $IdQuery . "</b>", $TList);
         break;
     }
     $IsQueryAllowedInGroup = LoadRow("select count(*) as cnt  from sqlforgroupsmembers where IdGroup in (" . $membergrouplist . ") and IdQuery=" . $IdQuery);
     if (!HasRight('SqlForVolunteers', '"' . $IdQuery . '"') and $IsQueryAllowedInGroup->cnt == 0) {
         DisplayMyResults(array(), array(), array(), $rrQuery, "Sorry you miss right scope for query <b>" . $rrQuery->Name . "</b>", $TList);
         LogStr("Trying to use a not allowed query (" . $rrQuery->Name . ")", "adminquery");
         break;
     }
     $_TResult = array();
     $_TTitle = array();
     $_TTsqry = array();
     $_rrQuery = array();
     $tQuery = explode(";", $rrQuery->Query);
     for ($jj = 0; $jj < count($tQuery); $jj++) {
         $sQry = ltrim($tQuery[$jj]);
         if (empty($sQry)) {
             continue;
         }
Пример #6
0
function ComputeSpamCheck($IdMess)
{
    $Mes = LoadRow("select * from messages where id=" . $IdMess);
    if (isset($Mes->id)) {
        $CheckerComment = $Mes->CheckerComment;
        // Case NeverCheckSendMail
        if (HasFlag("NeverCheckSendMail", "", $Mes->IdSender)) {
            $Status = 'ToSend';
            $SpamInfo = "NotSpam";
            $CheckerComment .= "Sent by member with NeverCheckSendMail \n";
            $str = "update messages set Status='" . $Status . "',CheckerComment='" . $CheckerComment . "',SpamInfo='" . $SpamInfo . "' where id=" . $Mes->id . " and Status!='Sent'";
            sql_query($str);
            LogStr("NeverCheckSendMail for message #" . $IdMess . " from <b>" . fUsername($Mes->IdSender) . "</b> to <b>" . fUsername($Mes->IdReceiver) . "</b>", "AutoSpamCheck");
            return $Status;
        }
        // Test what the Spam mark should be
        $SpamInfo = "NotSpam";
        // By default its not a Spam
        $tt = explode(";", wwinlang("MessageBlackWord", 0));
        $max = count($tt);
        for ($ii = 0; $ii < $max; $ii++) {
            if (strstr($Mes->Message, $tt[$ii]) != "" and $tt[$ii] != "") {
                $SpamInfo = "SpamBlkWord";
                $CheckerComment .= "Has BlackWord <b>" . $tt[$ii] . "</b>\n";
            }
        }
        $tt = explode(";", wwinlang("MessageBlackWord", GetDefaultLanguage($Mes->IdSender)));
        $max = count($tt);
        for ($ii = 0; $ii < $max; $ii++) {
            if (strstr($Mes->Message, $tt[$ii]) != "" and $tt[$ii] != "") {
                $SpamInfo = "SpamBlkWord";
                $CheckerComment .= "Has BlackWord (in sender language)<b>" . $tt[$ii] . "</b>\n";
            }
        }
        // End of Test what the Spam mark should be
        // Case AlwayCheckSendMail
        if (HasFlag("AlwayCheckSendMail", "", $Mes->IdSender)) {
            $Status = 'ToCheck';
            $CheckerComment .= "Sent by member with AlwayCheckSendMail \n";
            $str = "update messages set Status='" . $Status . "',CheckerComment='" . $CheckerComment . "',SpamInfo='" . $SpamInfo . "' where id=" . $Mes->id . " and Status!='Sent'";
            sql_query($str);
            LogStr("AlwayCheckSendMail for message #" . $IdMess . " from <b>" . fUsername($Mes->IdSender) . "</b> to <b>" . fUsername($Mes->IdReceiver) . "</b>", "AutoSpamCheck");
            return $Status;
        }
        // Case if receiver has preference PreferenceCheckMyMail set to "Yes"  : mail is always set to toCheck
        $rPrefCheckMyMail = LoadRow("select *  from memberspreferences where IdMember=" . $Mes->IdReceiver . " and IdPreference=4");
        // PreferenceCheckMyMail --> IdPref=4
        if (isset($rPrefCheckMyMail->Value) and $rPrefCheckMyMail->Value == 'Yes') {
            // if member has choosen CheckMyMail
            $Status = 'ToCheck';
            $CheckerComment .= "Member has asked for checking\n";
            $str = "update messages set Status='" . $Status . "',CheckerComment='" . $CheckerComment . "',SpamInfo='" . $SpamInfo . "' where id=" . $Mes->id . " and Status!='Sent'";
            sql_query($str);
            LogStr("PreferenceCheckMyMail for message #" . $IdMess . " from <b>" . fUsername($Mes->IdSender) . "</b> to <b>" . fUsername($Mes->IdReceiver) . "</b>", "AutoSpamCheck");
            return $Status;
        }
        // Default case
        $Status = 'ToSend';
        $str = "update messages set Status='" . $Status . "',CheckerComment='" . $CheckerComment . "',SpamInfo='" . $SpamInfo . "' where id=" . $Mes->id . " and Status!='Sent'";
        sql_query($str);
        return $Status;
    }
}
Пример #7
0
}
// If there is a Scope limit logs to the type in this Scope (unless it his own logs)
if (!HasRight('Logs', "\"All\"")) {
    $scope = RightScope("Logs");
    str_replace($scope, "\"", "'");
    $where .= " AND (Type IN (" . $scope . ") OR IdMember=" . $_SESSION["IdMember"] . ") ";
}
switch (GetParam("action")) {
    case "del":
        // case a delete is requested
        break;
}
$tData = array();
if (empty($where) and $start_rec == 0) {
    // In this case we will avoid the FOUND_ROW which is a performance killer
    $str = "SELECT logs.*,Username " . "FROM " . $_SYSHCVOL['ARCH_DB'] . ".logs LEFT JOIN members ON members.id=logs.IdMember " . "ORDER BY " . $_SYSHCVOL['ARCH_DB'] . ".logs.id DESC LIMIT {$start_rec}," . $limitcount;
    $qry = sql_query($str);
    $rCount = LoadRow("SELECT count(*)  AS cnt from " . $_SYSHCVOL['ARCH_DB'] . ".logs");
} else {
    $str = "SELECT SQL_CALC_FOUND_ROWS logs.*,Username " . "FROM " . $_SYSHCVOL['ARCH_DB'] . ".logs LEFT JOIN members ON members.id=logs.IdMember " . "WHERE 1=1 " . $where . " " . "ORDER BY " . $_SYSHCVOL['ARCH_DB'] . ".logs.id DESC LIMIT {$start_rec}," . $limitcount;
    $qry = sql_query($str);
    $rCount = LoadRow("SELECT FOUND_ROWS() AS cnt");
}
while ($rr = mysql_fetch_object($qry)) {
    array_push($tData, $rr);
}
if ($username != "0") {
    // Usage of adminlog is logged
    LogStr("Is using adminlog on profile <b>" . $username . "</b>", "adminlog");
}
DisplayAdminLogs($tData, $username, $type, $ip, $andS1, $andS2, $notAndS1, $notAndS2, $rCount->cnt);
Пример #8
0
function MyLoadRow($ss)
{
    if (function_exists("LoadRow")) {
        return LoadRow($ss);
    } else {
        $qq = mysql_query($ss);
        if (!$qq) {
            error_log("failed in MyLoadRow(" . $ss . ")");
            die("failure in MyLoadRow");
        }
        return mysql_fetch_object($qq);
    }
}
Пример #9
0
    // admin can alter other profiles
    $IdMember = GetParam("cid", $_SESSION['IdMember']);
}
$m = prepareProfileHeader($IdMember, "", 0);
// This is the profile of the contact which is going to be used
switch (GetParam("action")) {
    case "del":
        $str = "delete from intermembertranslations where IdTranslator=" . GetParam("IdTranslator") . " and IdMember=" . $IdMember;
        sql_query($str);
        LogStr("Removing translator <b>" . fUserName(GetParam("IdTranslator")) . "</b>", "mytranslators");
        break;
    case "add":
        // todo
        $IdTranslator = IdMember(GetParam("Username"), 0);
        $IdLanguage = Getparam("IdLanguage");
        $rr = LoadRow("select id from intermembertranslations where IdTranslator=" . $IdTranslator . " and IdMember=" . $IdMember . " and IdLanguage=" . $IdLanguage);
        if (!isset($rr->id) and $IdTranslator != 0) {
            // if not allready exists
            $str = "insert into intermembertranslations(IdTranslator,IdMember,IdLanguage) values(" . $IdTranslator . "," . $IdMember . "," . $IdLanguage . ")";
            sql_query($str);
            LogStr("Adding translator <b>" . fUserName(GetParam("IdTranslator")) . "</b> for language", "mytranslators");
        }
        break;
}
$TData = array();
$str = "select intermembertranslations.*,members.Username,members.ProfileSummary,cities.Name as cityname,regions.Name as regionname,countries.Name as countryname,membersphotos.FilePath as photo,membersphotos.Comment";
$str .= " from intermembertranslations,cities,countries,regions,recentvisits,members left join membersphotos on membersphotos.IdMember=members.id and membersphotos.SortOrder=0 where cities.IdRegion=regions.id and countries.id=cities.IdCountry and cities.id=members.IdCity and status='Active' and members.id=intermembertranslations.IdTranslator and intermembertranslations.IdMember=" . $IdMember . " and members.status='Active' GROUP BY members.id order by intermembertranslations.updated desc";
$qry = sql_query($str);
while ($rr = mysql_fetch_object($qry)) {
    if ($rr->ProfileSummary > 0) {
        $rr->ProfileSummary = FindTrad($rr->ProfileSummary);
Пример #10
0
function DisplayFaq($TFaq)
{
    global $title;
    $IdFaq = GetParam("IdFaq", 0);
    $argv = $_SERVER["argv"];
    if (isset($argv[1])) {
        $IdFaq = $argv[1];
    }
    if ($IdFaq == 0) {
        $title = ww('FaqPage');
    } elseif ($TFaq[0]->PageTitle != "") {
        $title = ww($TFaq[0]->PageTitle);
    } else {
        $title = ww("FaqQ_" . $TFaq[0]->QandA);
    }
    include "header.php";
    Menu1("faq.php", ww('FaqPage'));
    // Displays the top menu
    Menu2("faq.php", ww('GetAnswers'));
    echo "\n";
    echo "    <div id=\"main\">\n";
    echo "      <div id=\"teaser_bg\">\n";
    echo "      <div id=\"teaser\">\n";
    echo "        <h1>", $title, " </h1>\n";
    echo "      </div>\n";
    //menugetanswers("faq.php", $title); // Display the generic header
    echo "      </div>\n";
    // Content with just two columns
    echo "\n";
    echo "      <div id=\"col3\" class=\"twocolumns\">\n";
    echo "        <div id=\"col3_content\" class=\"clearfix\">\n";
    $iiMax = count($TFaq);
    $LastCat = "";
    // Display the list of the questions
    echo "<div class=\"info\">\n";
    for ($ii = 0; $ii < $iiMax; $ii++) {
        if ($LastCat != $TFaq[$ii]->CategoryName) {
            $LastCat = $TFaq[$ii]->CategoryName;
            if (HasRight("Faq") > 0) {
                echo "[<a href=\"faq.php?action=insert&IdCategory=", $TFaq[$ii]->IdCategory, "\">insert new faq in this category</a>]\n";
            }
            if ($IdFaq == 0) {
                if ($ii > 0) {
                    echo "</ul><br/>\n";
                }
                echo " <h3>", ww($TFaq[$ii]->CategoryName), "</h3>\n<ul>\n";
            }
        }
        $Q = ww("FaqQ_" . $TFaq[$ii]->QandA);
        if ($IdFaq == 0) {
            echo "<li>";
        }
        if ($TFaq[$ii]->QandA == "") {
            $Q = " new ";
        }
        if (HasRight("Faq") > 0) {
            if ($TFaq[$ii]->QandA == "") {
                echo " [<a href=\"faq.php?action=edit&IdFaq=", $TFaq[$ii]->id, "\">edit this new faq</a>]\n";
            } else {
                echo " [<a href=\"faq.php?action=edit&IdFaq=", $TFaq[$ii]->id, "\">edit</a>]\n";
            }
        }
        //		echo " <a href=\"" . $_SERVER["PHP_SELF"] . "?IdFaq=", $TFaq[$ii]->id, "\">", $Q, "</a>";
        if ($IdFaq == 0) {
            if (IsLoggedIn()) {
                echo " <a href=\"faq.php?IdFaq=" . $TFaq[$ii]->id . "\">", $Q, "</a></li>\n";
            } else {
                // If not login provide links to specific files
                $ss = "select code from words where code=\"FaqA_" . $TFaq[$ii]->QandA . "\" and IdLanguage=" . $_SESSION["IdLanguage"];
                //					echo $ss ;
                $rFak = LoadRow($ss);
                if (empty($rFak->code)) {
                    echo " <a href=\"faq_" . $TFaq[$ii]->QandA . "_en.php\">", $Q, "</a></li>\n";
                    // Force english if the text is not yet translated to avoid several page with the same english default text
                } else {
                    echo " <a href=\"faq_" . $TFaq[$ii]->QandA . "_" . $_SESSION["lang"] . ".php\">", $Q, "</a></li>\n";
                }
            }
        }
    }
    // end of for $ii
    if ($IdFaq == 0) {
        echo "</ul><br/>\n";
    }
    // Display the list of the answers
    for ($ii = 0; $ii < $iiMax and (IsLoggedIn() or $IdFaq != 0); $ii++) {
        //    echo "					<div class=\"clear\" />\n";
        if ($IdFaq == 0) {
            echo " <h3>", ww($TFaq[$ii]->CategoryName), "</h3>";
        }
        $Q = ww("FaqQ_" . $TFaq[$ii]->QandA);
        $A = ww("FaqA_" . $TFaq[$ii]->QandA);
        if ($IdFaq == 0) {
            echo "<h4><a name=\"", $TFaq[$ii]->id, "\"></a> ", $Q, "</h4>\n";
        }
        echo "<p>", str_replace("\n", "", $A), "</p>\n";
    }
    if (IsAdmin()) {
        echo "<br/><p><a href=\"faq.php?action=rebuildextraphpfiles\">rebuild extra php files</a></p>";
    }
    include "footer.php";
    exit(0);
}
Пример #11
0
function getBroadCastElement($wordCode, $languageId, $username = false, $email = false)
{
    $sentence = "";
    $rr = LoadRow("select SQL_CACHE Sentence,donottranslate from words where code='{$wordCode}' and IdLanguage='" . $languageId . "'");
    if (isset($rr->Sentence)) {
        $sentence = stripslashes($rr->Sentence);
    }
    if ($sentence == "") {
        $rEnglish = LoadRow("select SQL_CACHE Sentence,donottranslate from words where code='{$wordCode}' and IdLanguage=0");
        if (!isset($rEnglish->Sentence)) {
            $sentence = $wordCode;
            // The code of the word will be return
        } else {
            $sentence = stripslashes($rEnglish->Sentence);
        }
    }
    if ($username) {
        // we prepare to send or display the send mail therefore change nls to <br>
        $sentence = nl2br($sentence);
        // backwards compatibility replace %s with username and %% with % (just in case someone
        // wants to send an old newsletter again
        $sentence = str_replace('%s', $username, $sentence);
        $sentence = str_replace('%%', '%', $sentence);
        // replace %username% with real username. allow some different writings.
        $sentence = str_replace('%UserName%', $username, $sentence);
        $sentence = str_replace('%username%', $username, $sentence);
        $sentence = str_replace('%Username%', $username, $sentence);
    }
    if ($email) {
        $sentence = str_replace('%emailaddress%', $email, $sentence);
        $sentence = str_replace('%Emailaddress%', $email, $sentence);
        $sentence = str_replace('%EmailAddress%', $email, $sentence);
    }
    return $sentence;
}
Пример #12
0
 case "AdminCommentMustCheck":
     $Message = "Set comment to be checked by Admin Comment";
     $str = "Update comments set AdminAction='AdminCommentMustCheck' where id=" . Getparam("IdComment");
     sql_query($str);
     LogStr(" Setting to <b>tobe check by Admin Comment</b> for IdComment #" . Getparam("IdComment"), "AdminComment");
     break;
 case "del":
     if (!HasRight("Comments", "DeleteComment")) {
         $Message = "You don't have the right to delete comments";
         // call the layout
         DisplayAdminComments(loaddata("", " and comments.id=" . GetParam("IdComment")), $Message);
         exit(0);
         break;
     }
     $Message = " Delete comment #" . GetParam("IdComment");
     $c = LoadRow("select * from comments where id=" . GetParam("IdComment"));
     if (!isset($c->id)) {
         $Message = "No such coment";
         // call the layout
         DisplayAdminComments(loaddata("", " and comments.id=" . GetParam("IdComment")), $Message);
         exit(0);
         break;
     }
     $str = "delete from comments  where id=" . GetParam("IdComment");
     sql_query($str);
     LogStr("Deleting comment #" . GetParam("IdComment") . " previous where=" . $c->TextWhere . " previous text=" . $c->TextFree . " previous Quality=" . $c->Quality, "AdminComment");
     // call the layout
     DisplayAdminComments(loaddata("", " and comments.IdToMember=" . $c->IdToMember), $Message);
     exit(0);
     break;
 case "Checked":
Пример #13
0
function BuildVolMenu()
{
    $res = array();
    if (HasRight("Grep")) {
        array_push($res, new CVolMenu("admin/admingrep.php", "AdminGrep", "Grepping files"));
    }
    if (HasRight("Group")) {
        array_push($res, new CVolMenu("admin/admingroups.php", "AdminGroup", "Group managment"));
    }
    if (HasRight("Flags")) {
        array_push($res, new CVolMenu("admin/adminflags.php", "AdminFlags", "administration of members flags"));
    }
    if (HasRight("Rights")) {
        array_push($res, new CVolMenu("/admin/rights", "AdminRights", "administration of members rights"));
    }
    if (HasRight("Logs")) {
        array_push($res, new CVolMenu("admin/adminlogs.php", "AdminLogs", "logs of activity"));
    }
    if (HasRight("Comments")) {
        array_push($res, new CVolMenu("admin/admincomments.php", "AdminComments", "managing comments"));
    }
    if (HasRight("Pannel")) {
        array_push($res, new CVolMenu("admin/adminpanel.php", "AdminPanel", "managing panel (may be obsolete)"));
    }
    if (HasRight("Checker")) {
        $rr = LoadRow("SELECT COUNT(*) AS cnt FROM messages WHERE Status='ToCheck' AND messages.WhenFirstRead='0000-00-00 00:00:00'");
        $rrSpam = LoadRow("SELECT COUNT(*) AS cnt FROM messages,members AS mSender, members AS mReceiver WHERE mSender.id=IdSender AND messages.SpamInfo='SpamSayMember' AND mReceiver.id=IdReceiver AND (mSender.Status='Active' or mSender.Status='Pending')");
        $text = "AdminChecker" . "(" . $rr->cnt . "/" . $rrSpam->cnt . ")";
        array_push($res, new CVolMenu("admin/adminchecker.php", $text, "Mail Checking"));
    }
    if (HasRight("Debug", "ShowErrorLog")) {
        array_push($res, new CVolMenu("admin/phplog.php?showerror=10", "php error log", "php error log"));
    }
    if (HasRight("Debug", "ShowSlowQuery")) {
        array_push($res, new CVolMenu("admin/phplog.php?ShowSlowQuery=10", "Slow queries", "Mysql Slow queries"));
    }
    if (HasRight("MassMail")) {
        array_push($res, new CVolMenu("admin/adminmassmails.php", "mass mails", "Broadcast messages"));
    }
    return $res;
}
Пример #14
0
function CanTranslate($IdMember)
{
    if (empty($_SESSION["IdMember"])) {
        return false;
    }
    $IdTranslator = $_SESSION["IdMember"];
    $IdLanguage = $_SESSION["IdLanguage"];
    $rr = LoadRow("select SQL_CACHE id from intermembertranslations where IdMember=" . $IdMember . " and IdTranslator=" . $IdTranslator . " and IdLanguage=" . $IdLanguage);
    if (!isset($rr->id)) {
        return false;
    } else {
        return $rr->id;
    }
}
Пример #15
0
            exit(0);
        }
        $Faq = LoadRow("SELECT * FROM faq WHERE id=" . $IdFaq);
        $rwq = LoadRow("SELECT * FROM words WHERE code='" . "FaqQ_" . GetStrParam("QandA") . "' and IdLanguage=0");
        $rwa = LoadRow("SELECT * FROM words WHERE code='" . "FaqA_" . GetStrParam("QandA") . "' and IdLanguage=0");
        if (!isset($rwq->id)) {
            $str = "INSERT INTO words\n                                    (code,\n                                     Description,\n                                     IdLanguage,\n                                     ShortCode,\n                                     created)\n                                VALUES\n                                    ('FaqQ_" . GetStrParam("QandA") . "',\n                                     'This is the questiontext for a Frequently Asked Question.',\n                                     0,\n                                     '" . $_SESSION['lang'] . "',\n                                     NOW())";
            sql_query($str);
        }
        if (!isset($rwa->id)) {
            $str = "INSERT INTO words\n                                    (code,\n                                     Description,\n                                     IdLanguage,\n                                     ShortCode,\n                                     created)\n                                VALUES\n                                    ('FaqA_" . GetStrParam("QandA") . "',\n                                     'This is the answertext for a Frequently Asked Question.',\n                                     0,\n                                     '" . $_SESSION['lang'] . "',\n                                     NOW())";
            sql_query($str);
        }
        // reload for case it was just inserted before
        $rwq = LoadRow("SELECT * FROM words WHERE code='" . "FaqQ_" . GetStrParam("QandA") . "' and IdLanguage=0");
        $rwa = LoadRow("SELECT * FROM words WHERE code='" . "FaqA_" . GetStrParam("QandA") . "' and IdLanguage=0");
        if (GetStrParam('changetype') == 'major') {
            $majorupdate = ',majorupdate = NOW() ';
        } else {
            $majorupdate = '';
        }
        $str = "UPDATE words SET Description='" . addslashes($rwq->Description) . "',Sentence='" . GetStrParam("Question") . "' {$majorupdate} WHERE id=" . $rwq->id;
        sql_query($str);
        $str = "UPDATE words SET Description='" . addslashes($rwa->Description) . "',Sentence='" . GetStrParam("Answer") . "' {$majorupdate} WHERE id=" . $rwa->id;
        sql_query($str);
        $str = "UPDATE faq SET IdCategory=" . GetParam("IdCategory") . ",QandA='" . GetParam("QandA") . "',Active='" . GetStrParam("Status") . "',SortOrder=" . GetParam("SortOrder") . " WHERE id=" . $Faq->id;
        sql_query($str);
        LogStr("updating Faq #" . $Faq->id, "Update Faq");
        break;
}
// prepare the list
Пример #16
0
function VolMenu($link = "", $tt = "")
{
    $res = "";
    if (HasRight("Words")) {
        $res .= "\n<li><a";
        if ($link == "admin/word") {
            $res .= " id=current ";
        } else {
            $res .= " href=\"/admin/word\" method='post' ";
        }
        $res .= " title=\"Words management\">AdminWord</a></li>\n";
    }
    if (HasRight("Verifier")) {
        $res .= "\n<li><a";
        if ($link == "verify") {
            $res .= " id=current ";
        } else {
            $res .= " href=\"" . bwlink("../verify") . "\" method='post' ";
        }
        $res .= " title=\"verify a member\">" . ww("LinkToVerifyPage") . "</a></li>\n";
    }
    if (HasRight("Grep")) {
        $res .= "<li><a";
        if ($link == "admin/admingrep.php") {
            $res .= " id=current ";
        } else {
            $res .= " href=\"" . bwlink("admin/admingrep.php") . "\" method='post' ";
        }
        $res .= " title=\"Greping files\">AdminGrep</a></li>\n";
    }
    if (HasRight("SqlForVolunteers")) {
        $res .= "<li><a";
        if ($link == "admin/adminquery.php") {
            $res .= " id=current ";
        } else {
            $res .= " href=\"" . bwlink("admin/adminquery.php") . "\" method='post' ";
        }
        $res .= " title=\"access to volunteers dedicated queries\">Queries fo volunteers</a></li>\n";
    }
    if (HasRight("Flags")) {
        $res .= "<li><a";
        if ($link == "admin/adminflags.php") {
            $res .= " id=current ";
        } else {
            $res .= " href=\"" . bwlink("admin/adminflags.php") . "\" method=post ";
        }
        $res .= " title=\"administration of members flags\">AdminFlags</a></li>\n";
    }
    if (HasRight("Rights")) {
        $res .= "<li><a";
        if ($link == "/admin/rights") {
            $res .= " id=current ";
        } else {
            $res .= ' href="/admin/rights" method=post ';
        }
        $res .= " title=\"administration of members rights\">AdminRights</a></li>\n";
    }
    if (HasRight("Logs")) {
        $res .= "<li><a";
        if ($link == "admin/adminlogs.php") {
            $res .= " id=current ";
        } else {
            $res .= " href=\"" . bwlink("admin/adminlogs.php") . "\" method=post ";
        }
        $res .= " title=\"logs of activity\">AdminLogs</a></li>\n";
    }
    if (HasRight("Comments")) {
        $res .= "<li><a";
        if ($link == "admin/admincomments.php") {
            $res .= " id=current ";
        } else {
            $res .= " href=\"" . bwlink("admin/admincomments.php") . "\" method=post ";
        }
        $res .= " title=\"managing comments\">AdminComments</a></li>\n";
    }
    if (HasRight("NewMembersBeWelcome") || HasRight("SafetyTeam") || HasRight("Admin")) {
        $res .= "<li><a";
        if ($link == "admin/newmembers") {
            $res .= " id=current ";
        } else {
            $res .= " href=\"admin/newmembers\" method=post ";
        }
        $res .= " title=\"Greet new members\">AdminPanel</a></li>\n";
    }
    if (HasRight("Pannel")) {
        $res .= "<li><a";
        if ($link == "admin/adminpanel.php") {
            $res .= " id=current ";
        } else {
            $res .= " href=\"" . bwlink("admin/adminpanel.php") . "\" method=post ";
        }
        $res .= " title=\"managing Panel\">AdminPanel</a></li>\n";
    }
    if (HasRight("AdminFlags")) {
        $res .= "<li><a";
        if ($link == "admin/adminflags.php") {
            $res .= " id=current ";
        } else {
            $res .= " href=\"" . bwlink("admin/adminflags.php") . "\" method=post ";
        }
        $res .= " title=\"managing flags\">AdminFlags</a></li>\n";
    }
    if (HasRight("Checker")) {
        $rr = LoadRow("SELECT COUNT(*) AS cnt FROM messages WHERE Status='ToCheck' AND messages.WhenFirstRead='0000-00-00 00:00:00'");
        $rrSpam = LoadRow("SELECT COUNT(*) AS cnt FROM messages,members AS mSender, members AS mReceiver WHERE mSender.id=IdSender AND messages.SpamInfo='SpamSayMember' AND mReceiver.id=IdReceiver AND (mSender.Status='Active' or mSender.Status='Pending')");
        $res .= "<li><a";
        if ($link == "admin/adminchecker.php") {
            $res .= " id='current' ";
        } else {
            $res .= " href=\"" . bwlink("admin/adminchecker.php") . "\" method='post' ";
        }
        $res .= " title=\"Mail Checking\">AdminChecker";
        $res .= "(" . $rr->cnt . "/" . $rrSpam->cnt . ")";
        $res .= "</a></li>\n";
    }
    if (HasRight("Debug")) {
        $res .= "<li><a";
        if ($link == "phplog.php") {
            $res .= " id=current ";
        } else {
            $res .= " href=\"" . bwlink("admin/phplog.php?showerror=10") . "\"";
        }
        $res .= " title=\"Show last 10 phps error in log\">php error log</a></li>\n";
    }
    if (HasRight("MassMail")) {
        $res .= "<li><a";
        if ($link == "admin/massmail") {
            $res .= " id=current ";
        } else {
            $res .= " href=\"/admin/massmail\" method=post ";
        }
        $res .= " title=\"broadcast messages\">mass mails</a></li>\n";
    }
    return $res;
}
Пример #17
0
    // Get action code
    LoadFormValues();
    // Get form values
} else {
    $categories->CurrentAction = "I";
    // Default action is display
}
// Check if valid key
if ($categories->id->CurrentValue == "") {
    Page_Terminate($categories->getReturnUrl());
}
// Invalid key, exit
switch ($categories->CurrentAction) {
    case "I":
        // Get a record to display
        if (!LoadRow()) {
            // Load Record based on key
            $_SESSION[EW_SESSION_MESSAGE] = "No records found";
            // No record found
            Page_Terminate($categories->getReturnUrl());
            // Return to caller
        }
        break;
    case "U":
        // Update
        $categories->SendEmail = TRUE;
        // Send email on update success
        if (EditRow()) {
            // Update Record based on key
            $_SESSION[EW_SESSION_MESSAGE] = "Update successful";
            // Update success
Пример #18
0
     // call the layout
     exit(0);
 case "check":
     // Load the Message list
     $ii = 0;
     if (GetStrParam("IdSender", "") != "") {
         $strlist = "select messages.*,messages.Status as MessageStatus,mSender.Username as Username_sender,mReceiver.Username as Username_receiver from messages,members as mSender,members as mReceiver where messages.Status='ToCheck' and mSender.id=IdSender and mReceiver.id=IdReceiver and messages.IdSender=" . IdMember(GetStrParam("IdSender")) . " order by messages.id desc";
         //			 echo $strlist,"<br>\n" ;
     } else {
         $strlist = "select messages.*,messages.Status as MessageStatus,mSender.Username as Username_sender,mReceiver.Username as Username_receiver from messages,members as mSender,members as mReceiver where messages.Status='ToCheck' and mSender.id=IdSender and mReceiver.id=IdReceiver order by messages.id desc";
     }
     $qry = sql_query($strlist);
     $count = 0;
     while (GetParam("IdMess_" . $ii, 0) != 0) {
         $ss = "select messages.*,messages.Status as MessageStatus,mSender.Username as Username_sender,mReceiver.Username as Username_receiver from messages,members as mSender,members as mReceiver where mSender.id=IdSender and mReceiver.id=IdReceiver and messages.id=" . GetParam("IdMess_" . $ii);
         $rr = LoadRow($ss);
         //	    echo "checking :",$rr->id," [",GetStrParam("Approve_" . $ii)."] IdMess_".$ii,"=",GetParam("IdMess_" . $ii),"<br> " ;
         if (GetParam("IdMess_" . $ii) == $rr->id) {
             // If this message is in the list of checked message
             //				  echo "Approve_",$ii,"=",GetStrParam("Approve_".$ii),"<br>";
             $SpamChange = "";
             if ($rr->SpamInfo == "NotSpam" and GetStrParam("Mark_Spam_" . $ii) == "on") {
                 // If it was not considered as spam, but checker say it is a spam
                 $SpamChange = ",SpamInfo='SpamSayChecker'";
             }
             if ($rr->SpamInfo == "SpamBlkWord" and GetStrParam("Mark_Spam_" . $ii) == "") {
                 // If it was considered as spam, but checker say it is not
                 $SpamChange = ",SpamInfo='NotSpam'";
             }
             if (GetStrParam("Approve_" . $ii) == "on") {
                 $count++;