function getProfileInfoBlock($sCaption, $sContent)
 {
     global $site;
     $iBlockID = (int) $sContent;
     if (!isset($this->aPFBlocks[$iBlockID]) or empty($this->aPFBlocks[$iBlockID]['Items'])) {
         return false;
     }
     $aItems = $this->aPFBlocks[$iBlockID]['Items'];
     $aRet = array();
     foreach ($aItems as $aItem) {
         $sValue1 = htmlspecialchars_decode($this->oPF->getViewableValue($aItem, $this->_aProfile[$aItem['Name']]), ENT_COMPAT);
         if ($aItem['Name'] == 'Age') {
             $sValue1 = isset($this->_aProfile['DateOfBirth']) ? age($this->_aProfile['DateOfBirth']) : _t("_uknown");
         }
         if (!$sValue1) {
             continue;
         }
         $aStruct = array();
         $aStruct['Caption'] = new xmlrpcval(strip_tags(_t($aItem['Caption'])));
         $aStruct['Type'] = new xmlrpcval($aItem['Type']);
         $aStruct['Value1'] = new xmlrpcval(strip_tags($sValue1));
         if ($this->bCouple) {
             if (!in_array($aItem['Name'], $this->aCoupleMutualItems)) {
                 $sValue2 = htmlspecialchars_decode($this->oPF->getViewableValue($aItem, $this->_aCouple[$aItem['Name']]), ENT_COMPAT);
                 if ($aItem['Name'] == 'Age') {
                     $sValue2 = isset($this->_aCouple['DateOfBirth']) ? age($this->_aCouple['DateOfBirth']) : _t("_uknown");
                 }
                 $aStruct['Value2'] = new xmlrpcval(strip_tags($sValue2));
             }
         }
         $aRet[] = new xmlrpcval($aStruct, "struct");
     }
     return new xmlrpcval(array('Info' => new xmlrpcval($aRet, "array"), 'Title' => new xmlrpcval(_t($sCaption))), "struct");
 }
/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $site;
    global $prof;
    $query = "\n\t\tSELECT\n\t\t\t`id_poll`,\n\t\t\t`id_profile`,\n\t\t\t`poll_question`,\n\t\t\t`Profiles`.*\n\t\tFROM `ProfilesPolls`\n\t\tLEFT JOIN `Profiles` ON\n\t\t\t`id_profile` = `Profiles`.`ID`\n\t\tWHERE\n\t\t\t`poll_status` = 'active'\n\t\t\tAND `poll_approval`\n\t\tORDER BY `id_poll` DESC\n\t\t";
    //$query = "SELECT `ID`, `Question` FROM `polls_q` WHERE `Active` = 'on' ORDER BY `Question`";
    $res = db_res($query);
    if ($res and mysql_num_rows($res)) {
        $ret = '<div class="clear_both"></div>';
        while ($arr = mysql_fetch_array($res)) {
            $age_str = _t("_y/o", age($arr['DateOfBirth']));
            $y_o_sex = $age_str . '&nbsp;' . _t("_" . $arr['Sex']);
            $poll_coutry = _t("__" . $prof['countries'][$arr['Country']]);
            $ret .= '<div class="pollBody">';
            $ret .= '<div class="clear_both"></div>';
            $ret .= '<div class="pollInfo">';
            $ret .= get_member_icon($arr['id_profile'], 'left');
            $ret .= '<div class="pollInfo_nickname">';
            $ret .= _t('_Submitted by', $arr['NickName']);
            $ret .= '</div>';
            $ret .= '<div class="pollInfo_info">';
            $ret .= $y_o_sex . '<br />' . $poll_coutry;
            $ret .= '</div>';
            $ret .= '</div>';
            $ret .= '<div class="clear_both"></div>';
            $ret .= ShowPoll($arr['id_poll']);
            $ret .= '<div class="clear_both"></div>';
            $ret .= '</div>';
        }
        $ret .= '<div class="clear_both"></div>';
    } else {
        $ret = "<div align=center>" . _t("_No polls available") . "</div>\n";
    }
    return $ret;
}
function printSupp()
{
    # Set up table to display in
    global $PRDMON;
    $cur = date("m");
    $from = getMonthName($PRDMON[1]) . " " . getYearOfFinMon($PRDMON[1]);
    $to = getMonthName($cur) . " " . getYearOfFinMon($cur);
    $printSupp = "\n\t\t<h3>Creditors Age Analysis</h3>\n\t\t<h4>Period: {$from} to {$to}</h4>\n\t\t<li class='err'>Please note that because age analysis is calculated and stored as is displayed below it is not\n\t\tpossible to change the period for which you wish to see the age analysis.</li>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Acc no.</th>\n\t\t\t\t<th>Suppliers</th>\n\t\t\t\t<th>Current</th>\n\t\t\t\t<th>30 days</th>\n\t\t\t\t<th>60 days</th>\n\t\t\t\t<th>90 days</th>\n\t\t\t\t<th>120 days</th>\n\t\t\t\t<th>Total Outstanding</th>\n\t\t\t</tr>";
    # connect to database
    db_connect();
    # Query server
    $i = 0;
    $sql = "SELECT * FROM suppliers WHERE div = '" . USER_DIV . "' ORDER BY supname ASC";
    $suppRslt = db_exec($sql) or errDie("Unable to retrieve Suppliers from database.");
    if (pg_numrows($suppRslt) < 1) {
        return "<li>There are no Suppliers in Cubit.</li>";
    }
    # totals
    $totcurr = 0;
    $tot30 = 0;
    $tot60 = 0;
    $tot90 = 0;
    $tot120 = 0;
    $alltot = 0;
    while ($supp = pg_fetch_array($suppRslt)) {
        # Get all ages
        $curr = age($supp['supid'], 29);
        $age30 = age($supp['supid'], 59);
        $age60 = age($supp['supid'], 89);
        $age90 = age($supp['supid'], 119);
        $age120 = age($supp['supid'], 149);
        # Suppliers total
        $supptot = sprint($curr + $age30 + $age60 + $age90 + $age120);
        if ($supptot < $supp['balance']) {
            $curr = sprint($curr + ($supp['balance'] - $supptot));
            $supptot = sprint($supptot + $supp['balance'] - $supptot);
        }
        $printSupp .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$supp['supno']}</td>\n\t\t\t\t<td>{$supp['supname']}</td>\n\t\t\t\t<td>" . CUR . " {$curr}</td>\n\t\t\t\t<td>" . CUR . " {$age30}</td>\n\t\t\t\t<td>" . CUR . " {$age60}</td>\n\t\t\t\t<td>" . CUR . " {$age90}</td>\n\t\t\t\t<td>" . CUR . " {$age120}</td>\n\t\t\t\t<td>" . CUR . " {$supptot}</td>\n\t\t\t</tr>";
        # hold totals
        $totcurr += $curr;
        $tot30 += $age30;
        $tot60 += $age60;
        $tot90 += $age90;
        $tot120 += $age120;
        $alltot += $supptot;
        $i++;
    }
    $totcurr = sprint($totcurr);
    $tot30 = sprint($tot30);
    $tot60 = sprint($tot60);
    $tot90 = sprint($tot90);
    $tot120 = sprint($tot120);
    $alltot = sprint($alltot);
    $printSupp .= "\n\t\t<tr><td><br></td></tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='2'><b>Totals</b></td>\n\t\t\t<td><b>" . CUR . " {$totcurr}</b></td>\n\t\t\t<td><b>" . CUR . " {$tot30}</b></td>\n\t\t\t<td><b>" . CUR . " {$tot60}</b></td>\n\t\t\t<td><b>" . CUR . " {$tot90}</b></td>\n\t\t\t<td><b>" . CUR . " {$tot120}</b></td>\n\t\t\t<td><b>" . CUR . " {$alltot}</b></td>\n\t\t</tr>\n\t\t<tr><td><br></td></tr>\n\t\t<tr>\n\t\t\t<td align='center' colspan='10'>\n\t\t\t\t<form action='../xls/cred-age-analysis-xls.php' method='POST' name='form'>\n\t\t\t\t\t<input type='submit' name='xls' value='Export to spreadsheet'>\n\t\t\t\t</form>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n\t<p>\n\t<table " . TMPL_tblDflts . " width='15%'>\n\t\t<tr><td><br></td></tr>\n\t\t<tr>\n\t\t\t<th>Quick Links</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><a href='index-reports.php'>Financials</a></td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><a href='index-reports-debtcred.php'>Debtors & Creditors Reports</a></td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><a href='../supp-new.php'>Add Supplier</a></td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><a href='../supp-view.php'>View Suppliers</a></td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><a href='../main.php'>Main Menu</a></td>\n\t\t</tr>\n\t</table>";
    return $printSupp;
}
Exemplo n.º 4
0
function printPartnerTable($partner_list)
{
    $str = "<tr style='color:white; background-color:gray;' ><td style='width:50px'>id</td>" . "<td style='width:200px;'>name</td>" . "<td>type</td>" . "<td>url</td>" . "<td>age</td>" . "<td>views</td>" . "<td>plays</td>" . "<td>entries</td></tr>";
    $i = 0;
    foreach ($partner_list as $p) {
        $i++;
        $url = $p->getUrl1();
        $str .= "<tr style='background-color: " . ($i % 2 ? "lightgray" : "lightblue") . "'>" . "<td>" . $p->getId() . "</td>" . "<td>" . substr($p->getPartnerName(), 0, 50) . "</td>" . "<td>" . partnerType($p) . "</td>" . "<td>" . "<a href='{$url}'>{$url}</a>" . "</td>" . "<td>" . age($p) . "</td>" . "<td>" . prop($p, "views") . "</td>" . "<td>" . prop($p, "plays") . "</td>" . "<td>" . prop($p, "entries") . "</td>" . "</tr>";
    }
    return $str;
}
function printSupp()
{
    # Set up table to display in
    $printSupp = "\r\n\t\t<table>\r\n\t\t\t<tr><th colspan='3'><h3>Creditors Age Analysis</h3></th></tr>\r\n\t\t\t<tr><th></th></tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<th><u>Acc no.</u></th>\r\n\t\t\t\t<th><u>Suppliers</u></th>\r\n\t\t\t\t<th><u>Current</u></th>\r\n\t\t\t\t<th><u>30 days</u></th>\r\n\t\t\t\t<th><u>60 days</u></th>\r\n\t\t\t\t<th><u>90 days</u></th>\r\n\t\t\t\t<th><u>120 days</u></th>\r\n\t\t\t\t<th><u>Total Outstanding</u></th>\r\n\t\t\t</tr>";
    # connect to database
    db_connect();
    # Query server
    $i = 0;
    $sql = "SELECT * FROM suppliers WHERE div = '" . USER_DIV . "' ORDER BY supname ASC";
    $suppRslt = db_exec($sql) or errDie("Unable to retrieve Suppliers from database.");
    if (pg_numrows($suppRslt) < 1) {
        return "<li>There are no Suppliers in Cubit.</li>";
    }
    # totals
    $totcurr = 0;
    $tot30 = 0;
    $tot60 = 0;
    $tot90 = 0;
    $tot120 = 0;
    $alltot = 0;
    while ($supp = pg_fetch_array($suppRslt)) {
        # Get all ages
        $curr = age($supp['supid'], 29);
        $age30 = age($supp['supid'], 59);
        $age60 = age($supp['supid'], 89);
        $age90 = age($supp['supid'], 119);
        $age120 = age($supp['supid'], 149);
        # Suppliers total
        $supptot = $curr + $age30 + $age60 + $age90 + $age120;
        if ($supptot < $supp['balance']) {
            $curr = sprint($curr + ($supp['balance'] - $supptot));
            $supptot = sprint($supptot + $supp['balance'] - $supptot);
        }
        $printSupp .= "\r\n\t\t\t<tr>\r\n\t\t\t\t<td>{$supp['supno']}</td>\r\n\t\t\t\t<td>{$supp['supname']}</td>\r\n\t\t\t\t<td>" . CUR . " {$curr}</td>\r\n\t\t\t\t<td>" . CUR . " {$age30}</td>\r\n\t\t\t\t<td>" . CUR . " {$age60}</td>\r\n\t\t\t\t<td>" . CUR . " {$age90}</td>\r\n\t\t\t\t<td>" . CUR . " {$age120}</td>\r\n\t\t\t\t<td>" . CUR . " {$supptot}</td>\r\n\t\t\t</tr>";
        # hold totals
        $totcurr += $curr;
        $tot30 += $age30;
        $tot60 += $age60;
        $tot90 += $age90;
        $tot120 += $age120;
        $alltot += $supptot;
        $i++;
    }
    $printSupp .= "\r\n\t\t\t<tr><td><br></td></tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td colspan='2'><b>Totals</b></td>\r\n\t\t\t\t<td><b>" . CUR . " {$totcurr}</b></td>\r\n\t\t\t\t<td><b>" . CUR . " {$tot30}</b></td>\r\n\t\t\t\t<td><b>" . CUR . " {$tot60}</b></td>\r\n\t\t\t\t<td><b>" . CUR . " {$tot90}</b></td>\r\n\t\t\t\t<td><b>" . CUR . " {$tot120}</b></td>\r\n\t\t\t\t<td><b>" . CUR . " {$alltot}</b></td>\r\n\t\t\t</tr>\r\n\t\t</table>";
    # Send the stream
    include "temp.xls.php";
    Stream("CredAgeAnalysis", $printSupp);
}
Exemplo n.º 6
0
/**
 * Returns the age of a date/time,
 * or the date if it is outside of 'today'.
 *
 *		Usage example:
 *			{$account.date_created|age_date} # 23 hours ago
 *			{$product.date_created|age_date} # Dec 25 2012
 */
function age_date($params)
{
    $date = is_array($params) && $params['of'] ? $params['of'] : $params;
    if (!($time = strtotime($date))) {
        return '';
    }
    // Today.
    if (date('Y-m-d') == date('Y-m-d', $time)) {
        return age($date);
    }
    if (date('Y') == date('Y', $time)) {
        return date('M j', $time);
    } else {
        return date('M j Y', $time);
    }
}
function printAgeInv()
{
    # Set up table to display in
    $printCust = "\n    <h3>Debtors Age Analysis</h3>\n    <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n    <tr><th>Acc no.</th><th>Customer</th><th>Contact Name</th><th>Tel No.</th><th>Current</th><th>30 days</th><th>60 days</th><th>90 days</th><th>120 days</th><th>Total Outstanding</th></tr>";
    # Connect to database
    db_connect();
    # Query server
    $i = 0;
    $sql = "SELECT * FROM customers ORDER BY accno ASC";
    $custRslt = db_exec($sql) or errDie("Unable to retrieve Customers from database.");
    if (pg_numrows($custRslt) < 1) {
        return "<li>There are no Customers in Cubit.";
    }
    # Totals
    $totcurr = 0;
    $tot30 = 0;
    $tot60 = 0;
    $tot90 = 0;
    $tot120 = 0;
    $alltot = 0;
    while ($cust = pg_fetch_array($custRslt)) {
        # Get all ages
        $curr = age($cust['cusnum'], 29);
        $age30 = age($cust['cusnum'], 59);
        $age60 = age($cust['cusnum'], 89);
        $age90 = age($cust['cusnum'], 119);
        $age120 = age($cust['cusnum'], 149);
        # Customer total
        $custtot = $curr + $age30 + $age60 + $age90 + $age120;
        # Alternate bgcolor
        $printCust .= "<tr class='" . bg_class() . "'><td>{$cust['accno']}</td><td>{$cust['surname']}</td><td>{$cust['contname']}</td><td>{$cust['tel']}</td><td>" . CUR . " {$curr}</td><td>" . CUR . " {$age30}</td><td>" . CUR . " {$age60}</td><td>" . CUR . " {$age90}</td><td>" . CUR . " {$age120}</td><td>" . CUR . " {$custtot}</td></tr>";
        # Hold totals
        $totcurr += $curr;
        $tot30 += $age30;
        $tot60 += $age60;
        $tot90 += $age90;
        $tot120 += $age120;
        $alltot += $custtot;
        $i++;
    }
    $printCust .= "<tr><td><br></td></tr>\n\t<tr class='bg-even'><td colspan=4><b>Totals</b></td><td><b>" . CUR . " {$totcurr}</b></td><td><b>" . CUR . " {$tot30}</b></td><td><b>" . CUR . " {$tot60}</b></td><td><b>" . CUR . " {$tot90}</b></td><td><b>" . CUR . " {$tot120}</b></td><td><b>" . CUR . " {$alltot}</b></td></tr>\n\t<tr><td><br></td></tr>\n\n\t<!--\n\t<tr><td align=center colspan=10>\n\t\t<form action='../xls/debt-age-analysis-xls.php' method=post name=form>\n\t\t<input type=submit name=xls value='Export to spreadsheet'>\n\t\t</form>\n\t</td></tr>\n\t-->\n\n\t</table>\n    <p>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=15%>\n        <tr><td><br></td></tr>\n        <tr><th>Quick Links</th></tr>\n\t\t<tr class='bg-odd'><td><a href='../customers-new.php'>Add Customer</a></td></tr>\n\t\t<tr class='bg-odd'><td><a href='../customers-view.php'>View Customers</a></td></tr>\n\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t</table>";
    return $printCust;
}
Exemplo n.º 8
0
 /**
  * Get member info
  */
 public function get($aData)
 {
     switch ($this->_sObject) {
         case 'sys_username':
             return $aData['NickName'];
         case 'sys_full_name':
             return htmlspecialchars_adv($aData['FullName'] ? $aData['FullName'] : $aData['NickName']);
         case 'sys_first_name':
             return $aData['FirstName'] ? $aData['FirstName'] : $aData['NickName'];
         case 'sys_first_name_last_name':
             return $aData['FirstName'] || $aData['LastName'] ? $aData['FirstName'] . ' ' . $aData['LastName'] : $aData['NickName'];
         case 'sys_last_name_firs_name':
             return $aData['FirstName'] || $aData['LastName'] ? $aData['LastName'] . ' ' . $aData['FirstName'] : $aData['NickName'];
         case 'sys_status_message':
             return $aData['UserStatusMessage'];
         case 'sys_age_sex':
             $s = ('0000-00-00' == $aData['DateOfBirth'] ? '' : _t('_y/o', age($aData['DateOfBirth'])) . ' ') . _t('_' . $aData['Sex']);
             if ($aData['Couple'] > 0) {
                 $aData2 = getProfileInfo($aData['Couple']);
                 $s .= '<br />' . ('0000-00-00' == $aData2['DateOfBirth'] ? '' : _t('_y/o', age($aData2['DateOfBirth'])) . ' ') . _t('_' . $aData2['Sex']);
             }
             return $s;
         case 'sys_location':
             return (empty($aData['City']) ? '' : htmlspecialchars_adv($aData['City']) . ', ') . _t($GLOBALS['aPreValues']['Country'][$aData['Country']]['LKey']);
         case 'sys_avatar_2x':
             if (!$aData || !@(include_once BX_DIRECTORY_PATH_MODULES . 'boonex/avatar/include.php')) {
                 return false;
             }
             return $aData['Avatar'] ? BX_AVA_URL_USER_AVATARS . $aData['Avatar'] . 'b' . BX_AVA_EXT : '';
         case 'sys_avatar':
         case 'sys_avatar_icon_2x':
             if (!$aData || !@(include_once BX_DIRECTORY_PATH_MODULES . 'boonex/avatar/include.php')) {
                 return false;
             }
             return $aData['Avatar'] ? BX_AVA_URL_USER_AVATARS . $aData['Avatar'] . BX_AVA_EXT : '';
         case 'sys_avatar_icon':
             if (!$aData || !@(include_once BX_DIRECTORY_PATH_MODULES . 'boonex/avatar/include.php')) {
                 return false;
             }
             return $aData['Avatar'] ? BX_AVA_URL_USER_AVATARS . $aData['Avatar'] . 'i' . BX_AVA_EXT : '';
     }
 }
function printSupp()
{
    # Set up table to display in
    $printSupp = "<h3>Creditors Age Analysis</h3>\n    <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n    <tr><th>Acc no.</th><th>Suppliers</th><th>Current</th><th>30 days</th><th>60 days</th><th>90 days</th><th>120 days</th><th>Total Outstanding</th></tr>";
    # connect to database
    db_connect();
    # Query server
    $i = 0;
    $sql = "SELECT * FROM suppliers ORDER BY supname ASC";
    $suppRslt = db_exec($sql) or errDie("Unable to retrieve Suppliers from database.");
    if (pg_numrows($suppRslt) < 1) {
        return "<li>There are no Suppliers in Cubit.";
    }
    # totals
    $totcurr = 0;
    $tot30 = 0;
    $tot60 = 0;
    $tot90 = 0;
    $tot120 = 0;
    $alltot = 0;
    while ($supp = pg_fetch_array($suppRslt)) {
        # Get all ages
        $curr = age($supp['supid'], 29);
        $age30 = age($supp['supid'], 59);
        $age60 = age($supp['supid'], 89);
        $age90 = age($supp['supid'], 119);
        $age120 = age($supp['supid'], 149);
        # Suppliers total
        $supptot = $curr + $age30 + $age60 + $age90 + $age120;
        $printSupp .= "<tr class='" . bg_class() . "'><td>{$supp['div']}-{$supp['supno']}</td><td>{$supp['supname']}</td><td>" . CUR . " {$curr}</td><td>" . CUR . " {$age30}</td><td>" . CUR . " {$age60}</td><td>" . CUR . " {$age90}</td><td>" . CUR . " {$age120}</td><td>" . CUR . " {$supptot}</td></tr>";
        # hold totals
        $totcurr += $curr;
        $tot30 += $age30;
        $tot60 += $age60;
        $tot90 += $age90;
        $tot120 += $age120;
        $alltot += $supptot;
        $i++;
    }
    $printSupp .= "<tr><td><br></td></tr>\n\t<tr class='bg-even'><td colspan=2><b>Totals</b></td><td><b>" . CUR . " {$totcurr}</b></td><td><b>" . CUR . " {$tot30}</b></td><td><b>" . CUR . " {$tot60}</b></td><td><b>" . CUR . " {$tot90}</b></td><td><b>" . CUR . " {$tot120}</b></td><td><b>" . CUR . " {$alltot}</b></td></tr>\n\t<tr><td><br></td></tr>\n\n\t<!--\n\t<tr><td align=center colspan=10>\n\t\t<form action='../xls/cred-age-analysis-xls.php' method=post name=form>\n\t\t<input type=submit name=xls value='Export to spreadsheet'>\n\t\t</form>\n\t</td></tr>\n\t-->\n\n\t</table>\n    <p>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=15%>\n        <tr><td><br></td></tr>\n        <tr><th>Quick Links</th></tr>\n\t\t<tr class='bg-odd'><td><a href='../supp-new.php'>Add Supplier</a></td></tr>\n\t\t<tr class='bg-odd'><td><a href='../supp-view.php'>View Suppliers</a></td></tr>\n\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t</table>";
    return $printSupp;
}
Exemplo n.º 10
0
function save()
{
    db_connect();
    $sql = "SELECT * FROM customers";
    $custRslt = db_exec($sql) or errDie("Unable to view customer");
    if (pg_numrows($custRslt) < 1) {
        return "<li class=err>Invalid Customer Number.";
    }
    $Sl = "DELETE FROM ages";
    $Ri = db_exec($Sl);
    while ($cust = pg_fetch_array($custRslt)) {
        if ($cust['location'] == 'int') {
            $cust['balance'] = $cust['fbalance'];
        }
        $cust['balance'] = sprint($cust['balance']);
        # Check type of age analisys
        if (div_isset("DEBT_AGE", "mon")) {
            $curr = ageage($cust['cusnum'], 0, $cust['fcid'], $cust['location']);
            $age30 = ageage($cust['cusnum'], 1, $cust['fcid'], $cust['location']);
            $age60 = ageage($cust['cusnum'], 2, $cust['fcid'], $cust['location']);
            $age90 = ageage($cust['cusnum'], 3, $cust['fcid'], $cust['location']);
            $age120 = ageage($cust['cusnum'], 4, $cust['fcid'], $cust['location']);
        } else {
            $curr = age($cust['cusnum'], 29, $cust['fcid'], $cust['location']);
            $age30 = age($cust['cusnum'], 59, $cust['fcid'], $cust['location']);
            $age60 = age($cust['cusnum'], 89, $cust['fcid'], $cust['location']);
            $age90 = age($cust['cusnum'], 119, $cust['fcid'], $cust['location']);
            $age120 = age($cust['cusnum'], 149, $cust['fcid'], $cust['location']);
        }
        $custtot = $curr + $age30 + $age60 + $age90 + $age120;
        if (sprint($custtot) != sprint($cust['balance'])) {
            $curr = sprint($curr + $cust['balance'] - $custtot);
            $custtot = sprint($cust['balance']);
        }
        $Sl = "INSERT INTO ages(cust,curr,age30,age60,age90,age120) VALUES('{$cust['cusnum']}','{$curr}','{$age30}','{$age60}','{$age90}','{$age120}')";
        $Ri = db_exec($Sl);
        $age = "<table cellpadding='3' cellspacing='1' border=0 width=100% bordercolor='#000000'>\n\t\t\t<tr><th>Current</th><th>30 days</th><th>60 days</th><th>90 days</th><th>120 days +</th></tr>\n\t\t\t<tr><td align=right>{$cust['currency']} {$curr}</td><td align=right>{$cust['currency']} {$age30}</td><td align=right>{$cust['currency']} {$age60}</td>\n\t\t\t<td align=right>{$cust['currency']} {$age90}</td><td align=right>{$cust['currency']} {$age120}</td></tr>\n\t\t\t</table>";
    }
    $out = "<p><br><table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<tr><th>Done</th></tr>\n\t<tr class='bg-odd'><td>Age analysis saved.</td></tr>\n\t</table>";
    return $out;
}
Exemplo n.º 11
0
 if ($displaytrackerurl == TRUE) {
     // echo $item['tracker_url'];
     $urlstyle = $tracker_hilite_default;
     foreach ($tracker_hilite as $hilite) {
         foreach ($hilite as $thisurl) {
             if (stristr($item['tracker_url'], $thisurl) == TRUE) {
                 $urlstyle = $hilite[0];
             }
         }
     }
     echo "<div class='trackerurl' id='tracker' ><a style='color: {$urlstyle} ;' id='tracker' href='?settrackerfilter=" . $item['tracker_url'] . "&setfilterinvert=0'>" . $item['tracker_url'] . "</a>&nbsp;</div>";
 }
 // Torrent name
 echo "<input type='checkbox' name='select[]' value='" . $item['hash'] . "'  /> ";
 echo "<a class='submodal-600-520 {$statusstyle}' href='view.php?hash=" . $item['hash'] . "'>" . htmlspecialchars($item['name'], ENT_QUOTES) . "</a>&nbsp;";
 echo "<span class='age' id='t" . $item['hash'] . "filemtime'>" . age($item['filemtime']) . "</span>\n";
 echo "</div>\n";
 // message...
 echo "<div class='errorcol' id='t" . $item['hash'] . "message'>\n";
 if ($eta != "") {
     echo $eta . " Remaining... ";
 }
 if ($item['message'] != "") {
     echo $item['message'] . "\n";
 }
 echo "</div>\n";
 // Stop/start controls...
 echo "<div class='datacol'  style='width:89px;'>\n";
 echo "<a href='control.php?hash=" . $item['hash'] . "&amp;cmd=" . ($item['is_active'] == 1 ? "stop" : "start") . "'>" . ($item['is_active'] == 1 ? "<img alt='Stop torrent' border=0 src='images/stop.gif' width=16 height=16 />" : "<img alt='Start torrent' border=0 src='images/start.gif' width=16 height=16 />") . "</a> \n";
 echo "<a href='control.php?hash=" . $item['hash'] . "&amp;cmd=delete' onClick='return confirm(\"Delete torrent - are you sure? (This will not delete data from disk)\");'><img align='bottom' alt='Delete torrent' border=0 src='images/delete.gif' width=16 height=16 /></a> \n";
 echo "<a class='submodal-600-520' href='view.php?hash=" . $item['hash'] . "'><img alt='Torrent info' src='images/view.gif' width=16 height=16 /></a><br/>\n";
Exemplo n.º 12
0
/**
 * @brief Push local channel updates to a local directory server.
 *
 * This is called from include/directory.php if a profile is to be pushed to the
 * directory and the local hub in this case is any kind of directory server.
 *
 * @param int $uid
 * @param boolean $force
 */
function local_dir_update($uid, $force)
{
    logger('local_dir_update: uid: ' . $uid, LOGGER_DEBUG);
    $p = q("select channel.channel_hash, channel_address, channel_timezone, profile.* from profile left join channel on channel_id = uid where uid = %d and is_default = 1", intval($uid));
    $profile = array();
    $profile['encoding'] = 'zot';
    if ($p) {
        $hash = $p[0]['channel_hash'];
        $profile['description'] = $p[0]['pdesc'];
        $profile['birthday'] = $p[0]['dob'];
        if ($age = age($p[0]['dob'], $p[0]['channel_timezone'], '')) {
            $profile['age'] = $age;
        }
        $profile['gender'] = $p[0]['gender'];
        $profile['marital'] = $p[0]['marital'];
        $profile['sexual'] = $p[0]['sexual'];
        $profile['locale'] = $p[0]['locality'];
        $profile['region'] = $p[0]['region'];
        $profile['postcode'] = $p[0]['postal_code'];
        $profile['country'] = $p[0]['country_name'];
        $profile['about'] = $p[0]['about'];
        $profile['homepage'] = $p[0]['homepage'];
        $profile['hometown'] = $p[0]['hometown'];
        if ($p[0]['keywords']) {
            $tags = array();
            $k = explode(' ', $p[0]['keywords']);
            if ($k) {
                foreach ($k as $kk) {
                    if (trim($kk)) {
                        $tags[] = trim($kk);
                    }
                }
            }
            if ($tags) {
                $profile['keywords'] = $tags;
            }
        }
        $hidden = 1 - intval($p[0]['publish']);
        logger('hidden: ' . $hidden);
        $r = q("select xchan_hidden from xchan where xchan_hash = '%s' limit 1", dbesc($p[0]['channel_hash']));
        if (intval($r[0]['xchan_hidden']) != $hidden) {
            $r = q("update xchan set xchan_hidden = %d where xchan_hash = '%s'", intval($hidden), dbesc($p[0]['channel_hash']));
        }
        $arr = array('channel_id' => $uid, 'hash' => $hash, 'profile' => $profile);
        call_hooks('local_dir_update', $arr);
        $address = $p[0]['channel_address'] . '@' . App::get_hostname();
        if (perm_is_allowed($uid, '', 'view_profile')) {
            import_directory_profile($hash, $arr['profile'], $address, 0);
        } else {
            // they may have made it private
            $r = q("delete from xprof where xprof_hash = '%s'", dbesc($hash));
            $r = q("delete from xtag where xtag_hash = '%s'", dbesc($hash));
        }
    }
    $ud_hash = random_string() . '@' . App::get_hostname();
    update_modtime($hash, $ud_hash, $p[0]['channel_address'] . '@' . App::get_hostname(), $force ? UPDATE_FLAGS_FORCED : UPDATE_FLAGS_UPDATED);
}
Exemplo n.º 13
0
 /**
  * Function will generate received rows ;
  *
  * @return  : Html presentation data ;
  */
 function getProcessingRows($bShowEmpty = true)
 {
     global $oSysTemplate, $site, $oFunctions;
     // ** init some needed variables ;
     $sPageContent = $sActionsList = $sSettings = '';
     $bShowSettings = false;
     $aRows = array();
     $sEmptyMessage = '_Empty';
     $sRowsTemplName = $this->aUsedTemplates['communicator_page'];
     $sJsObject = $this->_getJsObject();
     // define the member's nickname;
     $sMemberNickName = getNickName($this->aCommunicatorSettings['member_id']);
     // all primary language's keys ;
     $aLanguageKeys = array('author' => _t('_Author'), 'type' => _t('_Type'), 'date' => _t('_Date'), 'click_sort' => _t('_Click to sort'), 'from_me' => _t('_From') . ' ' . $sMemberNickName, 'to_me' => _t('_To') . ' ' . $sMemberNickName, 'accept' => _t('_sys_cnts_btn_fr_accept'), 'reject' => _t('_sys_cnts_btn_fr_reject'), 'delete' => _t('_Delete'), 'back_invite' => _t('_Back Invite'), 'fave' => _t('_sys_cnts_btn_fave'), 'visitor' => _t('_Visitor'), 'unblock' => _t('_Unblock'), 'block' => _t('_Block'), 'select' => _t('_Select'), 'all' => _t('_All'), 'none' => _t('_None'), 'read' => _t('_Read'), 'unread' => _t('_Unread'));
     // get all requests from DB ;
     switch ($this->aCommunicatorSettings['communicator_mode']) {
         case 'friends_requests':
             $sEmptyMessage = '_sys_cnts_msg_fr_empty';
             $sRowsTemplName = $this->aUsedTemplates['communicator_page_fr'];
             $aTypes = array('from' => _t('_MEMBERS_INVITE_YOU_FRIENDLIST'), 'to' => _t('_MEMBERS_YOU_INVITED_FRIENDLIST'));
             $aRows = $this->getRequests('sys_friend_list', $aTypes, ' AND `sys_friend_list`.`Check` = 0 ');
             break;
         case 'hotlist_requests':
             $aTypes = array('from' => _t('_MEMBERS_YOU_HOTLISTED'), 'to' => _t('_MEMBERS_YOU_HOTLISTED_BY'));
             $aRows = $this->getRequests('sys_fave_list', $aTypes);
             break;
         case 'greeting_requests':
             $aTypes = array('from' => _t('_MEMBERS_YOU_KISSED'), 'to' => _t('_MEMBERS_YOU_KISSED_BY'), 'specific_key' => '_N times');
             $aRows = $this->getRequests('sys_greetings', $aTypes, null, 'Number');
             break;
         case 'blocks_requests':
             $aTypes = array('from' => _t('_MEMBERS_YOU_BLOCKLISTED'), 'to' => _t('_MEMBERS_YOU_BLOCKLISTED_BY'));
             $aRows = $this->getRequests('sys_block_list', $aTypes);
             break;
         case 'friends_list':
             $aTypes = array('from' => _t('_Friend list'), 'to' => _t('_Friend list'));
             $aRows = $this->getRequests('sys_friend_list', $aTypes, ' AND `sys_friend_list`.`Check` = 1 OR ( `sys_friend_list`.`ID` = ' . $this->aCommunicatorSettings['member_id'] . ' AND `sys_friend_list`.`Check` = 1 )');
             break;
         default:
             $aTypes = array('from' => _t('_MEMBERS_INVITE_YOU_FRIENDLIST'), 'to' => _t('_MEMBERS_YOU_INVITED_FRIENDLIST'));
             $aRows = $this->getRequests('sys_friend_list', $aTypes, ' AND `sys_friend_list`.`Check` = 0 ');
     }
     if (empty($aRows) && !$bShowEmpty) {
         return '';
     }
     // ** Generate the page's pagination ;
     // fill array with all necessary `get` parameters ;
     $aNeededParameters = array('communicator_mode', 'person_switcher', 'sorting');
     // collect the page's URL ;
     $sRequest = BX_DOL_URL_ROOT . 'communicator.php?action=get_page';
     // add additional parameters ;
     foreach ($aNeededParameters as $sKey) {
         $sRequest .= (array_key_exists($sKey, $this->aCommunicatorSettings) and $this->aCommunicatorSettings[$sKey]) ? '&' . $sKey . '=' . $this->aCommunicatorSettings[$sKey] : null;
     }
     $sCuttedUrl = $sRequest;
     $sRequest .= '&page={page}&per_page={per_page}';
     // create  the pagination object ;
     $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $this->iTotalRequestsCount, 'per_page' => $this->aCommunicatorSettings['per_page'], 'sorting' => $this->aCommunicatorSettings['sorting'], 'page' => $this->aCommunicatorSettings['page'], 'per_page_changer' => false, 'page_reloader' => true, 'on_change_page' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".getPaginatePage('{$sRequest}')", 'on_change_per_page' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".getPage(this.value, '{$sCuttedUrl}')"));
     $sPagination = $oPaginate->getPaginate();
     // process received requests;
     if ($aRows) {
         $iIndex = 1;
         foreach ($aRows as $iKey => $aItems) {
             // if member not a visitor ;
             if ($aItems['member_id']) {
                 // ** some member's information ;
                 $aProfileInfo = getProfileInfo($aItems['member_id']);
                 // member's Icon ;
                 $sMemberIcon = get_member_thumbnail($aProfileInfo['ID'], 'left', $this->aCommunicatorSettings['communicator_mode'] != 'friends_requests');
                 // member's profile location ;
                 $sMemberLocation = getProfileLink($aProfileInfo['ID']);
                 // member's nickname ;
                 $sMemberNickName = getNickName($aProfileInfo['ID']);
                 // define the member's age ;
                 $sMemberAge = $aProfileInfo['DateOfBirth'] != "0000-00-00" ? _t("_y/o", age($aProfileInfo['DateOfBirth'])) : null;
                 // define the member's country, sex, etc ... ;
                 $sMemberCountry = $aProfileInfo['Country'];
                 $sMemberFlag = $site['flags'] . strtolower($sMemberCountry) . $this->sMembersFlagExtension;
                 $sMemberSexImg = $oFunctions->genSexIcon($aProfileInfo['Sex']);
                 if ($sMemberCountry) {
                     $sMemberCountryFlag = '<img src="' . $sMemberFlag . '" alt="' . $sMemberCountry . '" />';
                 }
                 $iMemberMutualFriends = getMutualFriendsCount($aItems['member_id'], getLoggedId());
             } else {
                 // ** if it's a visitor
                 // member's Icon ;
                 $sMemberIcon = $aLanguageKeys['visitor'];
                 // member's profile location ;
                 $sMemberLocation = null;
                 $sMemberSexImg = null;
                 $sMemberAge = null;
                 $sMemberCountryFlag = null;
                 $sMemberCountry = null;
             }
             $aProcessedRows[] = array('js_object' => $sJsObject, 'row_value' => $aItems['member_id'], 'member_icon' => $sMemberIcon, 'member_nick_name' => $sMemberNickName, 'member_location' => $sMemberLocation ? '<a href="' . $sMemberLocation . '">' . $sMemberNickName . '</a>' : '', 'member_sex_img' => $sMemberSexImg ? ' <img src="' . $sMemberSexImg . '" alt="' . $aProfileInfo['Sex'] . '" />' : '', 'member_age' => $sMemberAge, 'member_flag' => $sMemberCountryFlag, 'member_country' => $sMemberCountry, 'member_mutual_friends' => _t('_sys_cnts_txt_mutual_friends', $iMemberMutualFriends > 0 ? $iMemberMutualFriends : _t('_sys_cnts_txt_mf_no')), 'type' => $aItems['type'], 'message_date' => $aItems['date']);
             $iIndex++;
         }
         // init the sort toggle ellements ;
         switch ($this->aCommunicatorSettings['sorting']) {
             case 'date':
                 $aSortToglleElements['date_sort_toggle'] = 'toggle_up';
                 break;
             case 'date_desc':
                 $aSortToglleElements['date_sort_toggle'] = 'toggle_down';
                 break;
             case 'author':
                 $aSortToglleElements['author_sort_toggle'] = 'toggle_up';
                 break;
             case 'author_desc':
                 $aSortToglleElements['author_sort_toggle'] = 'toggle_down';
                 break;
         }
         // define the actions list for type of requests;
         switch ($this->aCommunicatorSettings['communicator_mode']) {
             case 'friends_requests':
                 // define the person mode ;
                 switch ($this->aCommunicatorSettings['person_switcher']) {
                     case 'to':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['accept'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'accept_friends_request', 'getProcessingRows')")), 1 => array('type' => 'button', 'value' => $aLanguageKeys['reject'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'reject_friends_request', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                     case 'from':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['back_invite'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'delete_friends_request', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                 }
                 break;
             case 'hotlist_requests':
                 // define the person mode ;
                 switch ($this->aCommunicatorSettings['person_switcher']) {
                     case 'to':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['fave'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'add_hotlist', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                     case 'from':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'delete_hotlisted', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                 }
                 break;
             case 'greeting_requests':
                 $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'delete_greetings', 'getProcessingRows')")))));
                 $oForm = new BxTemplFormView($aForm);
                 $sActionsList = $oForm->getCode();
                 break;
             case 'blocks_requests':
                 // define the person mode ;
                 switch ($this->aCommunicatorSettings['person_switcher']) {
                     case 'to':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['block'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'block_unblocked', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                     case 'from':
                         $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['unblock'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'unblock_blocked', 'getProcessingRows')")))));
                         $oForm = new BxTemplFormView($aForm);
                         $sActionsList = $oForm->getCode();
                         break;
                 }
                 break;
             case 'friends_list':
                 $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => "if ( typeof " . $sJsObject . " != 'undefined' ) " . $sJsObject . ".sendAction('communicator_container', 'reject_friends_request', 'getProcessingRows')")))));
                 $oForm = new BxTemplFormView($aForm);
                 $sActionsList = $oForm->getCode();
                 break;
         }
         // processing the sort link ;
         $sSortLink = getClearedParam('sorting', $sCuttedUrl) . '&page=' . $this->aCommunicatorSettings['page'] . '&per_page=' . $this->aCommunicatorSettings['per_page'];
         // fill array with template keys ;
         $aTemplateKeys = array('js_object' => $sJsObject, 'from_me' => $aLanguageKeys['from_me'], 'to_me' => $aLanguageKeys['to_me'], 'selected_from' => $this->aCommunicatorSettings['person_switcher'] == 'from' ? 'checked="checked"' : null, 'selected_to' => $this->aCommunicatorSettings['person_switcher'] == 'to' ? 'checked="checked"' : null, 'page_sort_url' => $sSortLink, 'sort_date' => $this->aCommunicatorSettings['sorting'] == 'date' ? 'date_desc' : 'date', 'sort_author' => $this->aCommunicatorSettings['sorting'] == 'author' ? 'author_desc' : 'author', 'date_sort_toggle_ellement' => $aSortToglleElements['date_sort_toggle'], 'author_sort_toggle_ellement' => $aSortToglleElements['author_sort_toggle'], 'author' => $aLanguageKeys['author'], 'type' => $aLanguageKeys['type'], 'date' => $aLanguageKeys['date'], 'click_sort' => $aLanguageKeys['click_sort'], 'bx_repeat:rows' => $aProcessedRows, 'actions_list' => $sActionsList, 'current_page' => 'communicator.php', 'select' => $aLanguageKeys['select'], 'all_messages' => $aLanguageKeys['all'], 'none_messages' => $aLanguageKeys['none'], 'read_messages' => $aLanguageKeys['read'], 'unread_messages' => $aLanguageKeys['unread'], 'page_pagination' => $sPagination);
         $sPageContent = $oSysTemplate->parseHtmlByName($sRowsTemplName, $aTemplateKeys);
     } else {
         $sPageContent = $oSysTemplate->parseHtmlByName('default_margin.html', array('content' => MsgBox(_t($sEmptyMessage))));
     }
     // ** Process the final template ;
     // generate the page settings ;
     if ($bShowSettings) {
         $aTemplateKeys = array('js_object' => $sJsObject, 'from_me' => $aLanguageKeys['from_me'], 'to_me' => $aLanguageKeys['to_me'], 'selected_from' => $this->aCommunicatorSettings['person_switcher'] == 'from' ? 'checked="checked"' : null, 'selected_to' => $this->aCommunicatorSettings['person_switcher'] == 'to' ? 'checked="checked"' : null);
         $sSettings = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['communicator_settings'], $aTemplateKeys);
     }
     // fill array with template keys ;
     $aTemplateKeys = array('js_object' => $sJsObject, 'current_page' => 'communicator.php', 'communicator_mode' => $this->aCommunicatorSettings['communicator_mode'], 'communicator_person_mode' => $this->aCommunicatorSettings['person_switcher'], 'error_message' => bx_js_string(_t('_Please, select at least one message')), 'sure_message' => bx_js_string(_t('_Are you sure?')), 'settings' => $sSettings, 'page_content' => $sPageContent);
     return $oSysTemplate->parseHtmlByName($this->aUsedTemplates['communicator_settings_page'], $aTemplateKeys);
 }
Exemplo n.º 14
0
include 'core/function.php';
?>
<!-- content -->
        <section id="content">
        <div class="container">
            <div class="row">
                <div class="col-xs-12 col-sm-4 wow fadeInDown visibility">
                    <div class="testimonial">
                       <!--  <center><h2>Welkom</h2></center> -->
                         <div class="media testimonial-inner">
                            <div class="pull-left">
                            <img src="images/Adriel.jpg"  class="img-responsive img-circle index_img " alt="Responsive image" align="left">
                            </div>
                              <div class="container">
                                <p class="text-muted">Ik ben Adriel Walter en ik ben <?php 
echo age();
?>
.
                                    ik studeer informatica aan de Hogeschool Rotterdam. Oorspronkelijk kom ik uit
                                    Curaçao maar sinds 27 juli 2011 woon ik in Nederland.</p>
                                
                                <p class="text-muted">Ik ben een jonge, sociale jongen met ambities op gebied
                                    van website development. Ik heb voornamelijk ervaring met PHP, HTML, JAVA, JAVAScript en CSS.
                                </p>

                                <p class="text-muted">Verder kan je lezen in de &quot;About Me&quot; page meer over mij .</p>
                                <p class="text-muted"> Kijk gerust eens rond!</p> 
                            </div>
                         </div>
                    </div>
                </div>
Exemplo n.º 15
0
		</div>
		
		<div class="infoProfil">
			<div>Compte Xbox live</div>
			<?php 
echo trim($infos['idXboxlive']) != '' ? $infos['idXboxlive'] : '-';
?>
		</div>
		
		<div class="infoProfil">
			<div>Date de naissance</div>
			<?php 
echo $infos['birth'] != '0000-00-00' ? date('d/m/Y', date2timestamp($infos['birth'])) : '-';
?>
 - <?php 
echo $infos['birth'] != '0000-00-00' ? age($infos['birth']) . ' ans' : '';
?>
		</div>
				
		<div class="infoProfil">
			<div>Messages postés</div>
			<?php 
echo $infos['nbPost'];
?>
		</div>
		
		<div class="infoProfil">
			<div>Messages chatbox</div>
			<?php 
echo $infos['nbPostChatbox'];
?>
Exemplo n.º 16
0
 /**
  * Function will generate the messages rows ;
  *
  * @return         : Html presentation data ;
  */
 function genMessagesRows()
 {
     global $oSysTemplate;
     global $oFunctions;
     global $site;
     // init some needed variables ;
     $sOutputHtml = null;
     $sMessageBoxActions = null;
     $sMessagesTypesList = null;
     $sPerPageBlock = null;
     $aSortToglleElements = array('date_sort_toggle', 'subject_sort_toggle', 'type_sort_toggle', 'author_sort_toggle');
     $aMessageRows = array();
     // language keys ;
     $aLanguageKeys = array('author' => _t('_Author'), 'type' => _t('_Type'), 'subject' => _t('_Subject'), 'date' => _t('_Date'), 'new' => _t('_new'), 'select' => _t('_Select'), 'all' => _t('_All'), 'none' => _t('_None'), 'read' => _t('_Read'), 'unread' => _t('_Unread'), 'delete' => _t('_Delete'), 'spam' => _t('_Spam report'), 'more' => _t('_More actions'), 'mark_read' => _t('_Mark as old'), 'mark_unread' => _t('_Mark as New'), 'restore' => _t('_Restore'), 'click_sort' => _t('_Click to sort'), 'recipient' => _t('_Recipient'));
     // get messages array ;
     $aMessages =& $this->getMessages();
     // generate list of messages types
     if (is_array($this->aRegisteredMessageTypes) and !empty($this->aRegisteredMessageTypes)) {
         foreach ($this->aRegisteredMessageTypes as $iKey => $sRegisteredType) {
             $sChecked = null;
             if (!empty($this->aReceivedMessagesTypes) and in_array($sRegisteredType, $this->aReceivedMessagesTypes)) {
                 $sChecked = ' checked="checked" ';
             }
             $aTemplateKeys = array('letters_type' => $sRegisteredType, 'letters_type_caption' => _t('_' . $sRegisteredType), 'checked' => $sChecked);
             $sMessagesTypesList .= $oSysTemplate->parseHtmlByName($this->aUsedTemplates['messages_types_list'], $aTemplateKeys);
         }
         unset($aTemplateKeys);
     }
     // processing all messages ;
     if (is_array($aMessages) and !empty($aMessages)) {
         // need for row devide ;
         $iIndex = 1;
         foreach ($aMessages as $iKey => $aItems) {
             // generate image and keyword for type of message ;
             $sTypeIcon = getTemplateIcon($this->sMessageIconPrefix . $aItems['Type'] . $this->sMessageIconExtension);
             $sTypeLang = _t('_' . $aItems['Type']);
             // get message's subject ;
             $sSubject = mb_strlen($aItems['Subject']) > $this->iMessageSubjectLength ? mb_substr($aItems['Subject'], 0, $this->iMessageSubjectLength) . '...' : $aItems['Subject'];
             // get message's description ;
             $sDescription = strip_tags($aItems['Text']);
             mb_strlen($sDescription) > $this->iMessageDescrLength ? $sDescription = mb_substr($sDescription, 0, $this->iMessageDescrLength) . '...' : null;
             // generate the `new` message's icon ;
             $sNewMessageImg = $aItems['New'] ? getTemplateIcon('new_message.png') : getTemplateIcon(null);
             // color devider ;
             $sFiledCss = !($iIndex % 2) ? 'filled' : 'not_filled';
             $aProfileInfo = $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? getProfileInfo($aItems['Sender']) : getProfileInfo($aItems['Recipient']);
             $sMemberIcon = $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? get_member_icon($aItems['Sender'], 'left') : get_member_icon($aItems['Recipient'], 'left');
             $sMemberLocation = $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? getProfileLink($aItems['Sender']) : getProfileLink($aItems['Recipient']);
             $sMemberNickName = $aProfileInfo['NickName'];
             $sMemberAge = $aProfileInfo['DateOfBirth'] != "0000-00-00" ? _t("_y/o", age($aProfileInfo['DateOfBirth'])) : null;
             $sMemberCountry = $aProfileInfo['Country'];
             $sMemberFlag = $site['flags'] . strtolower($sMemberCountry) . $this->sMembersFlagExtension;
             $sMemberSexImg = $oFunctions->genSexIcon($aProfileInfo['Sex']);
             if ($sMemberCountry) {
                 $sMemberCountryFlag = '<img src="' . $sMemberFlag . '" alt="' . $sMemberCountry . '" />';
             }
             // generate the message status ;
             $sMessageStatus = $aItems['New'] ? 'unread' : 'read';
             $aMessageRows[] = array('message_id' => $aItems['ID'], 'message_status' => $sMessageStatus, 'message_owner' => $aItems['Sender'], 'message_link' => $aItems['ID'], 'message_page' => 'mail.php', 'member_icon' => $sMemberIcon, 'member_location' => $sMemberLocation, 'member_nickname' => $sMemberNickName, 'member_sex_img' => $sMemberSexImg, 'member_sex' => $aProfileInfo['Sex'], 'member_age' => $sMemberAge, 'member_flag' => $sMemberCountryFlag, 'member_country' => $sMemberCountry, 'message_type' => $sTypeLang, 'message_type_icon' => $sTypeIcon, 'message_subject' => $sSubject, 'message_new_img' => $sNewMessageImg, 'message_new' => $aLanguageKeys['new'], 'message_descr' => $sDescription, 'message_date' => $aItems['Date'], 'filled_class' => $sFiledCss);
             $iIndex++;
         }
     }
     // init sort toggle ellements ;
     switch ($this->aMailBoxSettings['sort_mode']) {
         case 'date':
             $aSortToglleElements['date_sort_toggle'] = 'toggle_up';
             break;
         case 'date_desc':
             $aSortToglleElements['date_sort_toggle'] = 'toggle_down';
             break;
         case 'subject':
             $aSortToglleElements['subject_sort_toggle'] = 'toggle_up';
             break;
         case 'subject_desc':
             $aSortToglleElements['subject_sort_toggle'] = 'toggle_down';
             break;
         case 'type':
             $aSortToglleElements['type_sort_toggle'] = 'toggle_up';
             break;
         case 'type_desc':
             $aSortToglleElements['type_sort_toggle'] = 'toggle_down';
             break;
         case 'author':
             $aSortToglleElements['author_sort_toggle'] = 'toggle_up';
             break;
         case 'author_desc':
             $aSortToglleElements['author_sort_toggle'] = 'toggle_down';
             break;
     }
     // generate the pagination ;
     $sRequest = BX_DOL_URL_ROOT . 'mail.php?';
     // need for additional parameters ;
     $aGetParams = array('mode', 'sorting', 'messages_types');
     if (is_array($aGetParams) and !empty($aGetParams)) {
         foreach ($aGetParams as $sValue) {
             if (isset($_GET[$sValue])) {
                 $sRequest .= '&amp;' . $sValue . '=' . $_GET[$sValue];
             }
         }
     }
     $sCuttedUrl = $sRequest;
     $sRequest = $sRequest . '&amp;page={page}&amp;per_page={per_page}';
     $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $this->iTotalMessageCount, 'per_page' => $this->aMailBoxSettings['per_page'], 'sorting' => $this->aMailBoxSettings['sort_mode'], 'page' => $this->aMailBoxSettings['page'], 'per_page_changer' => false, 'page_reloader' => true, 'on_change_page' => "oMailBoxMessages.getPaginatePage('{$sRequest}')", 'on_change_per_page' => "oMailBoxMessages.getPage(this.value, '{$sCuttedUrl}')"));
     $sPagination = $oPaginate->getPaginate();
     // generate messages section
     if (!empty($aMessageRows)) {
         $aTemplateKeys = array('per_page' => $this->aMailBoxSettings['per_page'], 'page_number' => $this->aMailBoxSettings['page'], 'page_mode' => $this->aMailBoxSettings['mailbox_mode'], 'messages_types' => $this->aMailBoxSettings['messages_types'], 'messages_types_list' => $sMessagesTypesList, 'per_page_block' => $oPaginate->getPages(), 'author' => $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? $aLanguageKeys['author'] : $aLanguageKeys['recipient'], 'type' => $aLanguageKeys['type'], 'subject' => $aLanguageKeys['subject'], 'date' => $aLanguageKeys['date'], 'click_sort' => $aLanguageKeys['click_sort'], 'bx_repeat:messages' => $aMessageRows, 'sort_date' => $this->aMailBoxSettings['sort_mode'] == 'date' ? 'date_desc' : 'date', 'sort_subject' => $this->aMailBoxSettings['sort_mode'] == 'subject' ? 'subject_desc' : 'subject', 'sort_type' => $this->aMailBoxSettings['sort_mode'] == 'type' ? 'type_desc' : 'type', 'sort_author' => $this->aMailBoxSettings['sort_mode'] == 'author' ? 'author_desc' : 'author', 'date_sort_toggle_ellement' => $aSortToglleElements['date_sort_toggle'], 'subject_sort_toggle_ellement' => $aSortToglleElements['subject_sort_toggle'], 'type_sort_toggle_ellement' => $aSortToglleElements['type_sort_toggle'], 'author_sort_toggle_ellement' => $aSortToglleElements['author_sort_toggle'], 'select' => $aLanguageKeys['select'], 'current_page' => 'mail.php', 'all_messages' => $aLanguageKeys['all'], 'none_messages' => $aLanguageKeys['none'], 'read_messages' => $aLanguageKeys['read'], 'unread_messages' => $aLanguageKeys['unread'], 'pagination_block' => $sPagination);
         // generate extended mailbox actions
         switch ($this->aMailBoxSettings['mailbox_mode']) {
             case 'inbox':
                 $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['spam'], 'attrs' => array('onclick' => 'if (typeof oMailBoxMessages != \'undefined\') oMailBoxMessages.spamMessages(\'messages_container\')')), 1 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.deleteMessages(\'messages_container\', \'genMessagesRows\')')), 2 => array('type' => 'select', 'values' => array('' => $aLanguageKeys['more'], 'unread' => $aLanguageKeys['mark_unread'], 'read' => $aLanguageKeys['mark_read']), 'attrs' => array('onchange' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.markMessages(this.value, \'genMessagesRows\')')))));
                 $oForm = new BxTemplFormView($aForm);
                 $sMessageBoxActions = $oForm->getCode();
                 break;
             case 'outbox':
                 $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.deleteMessages(\'messages_container\', \'genMessagesRows\')')))));
                 $oForm = new BxTemplFormView($aForm);
                 $sMessageBoxActions = $oForm->getCode();
                 break;
             case 'trash':
                 $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['restore'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.restoreMessages(\'messages_container\', \'genMessagesRows\')')), 1 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.hideDeletedMessages(\'messages_container\', \'genMessagesRows\')')))));
                 $oForm = new BxTemplFormView($aForm);
                 $sMessageBoxActions = $oForm->getCode();
                 break;
         }
         $aTemplateKeys['messages_actions_block'] = $sMessageBoxActions;
         //return builded rows ;
         $sMessagesSection = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['messages_box'], $aTemplateKeys);
         $sPerPageBlock = $oPaginate->getPages();
     } else {
         $sMessagesSection = MsgBox(_t('_Empty'));
     }
     // generate mailboxe's top section ;
     $aTemplateKeys = array('per_page' => $this->aMailBoxSettings['per_page'], 'page_number' => $this->aMailBoxSettings['page'], 'page_mode' => $this->aMailBoxSettings['mailbox_mode'], 'messages_types' => $this->aMailBoxSettings['messages_types'], 'messages_sort' => $this->aMailBoxSettings['sort_mode'], 'messages_section' => $sMessagesSection, 'messages_types_list' => $sMessagesTypesList, 'per_page_block' => $sPerPageBlock);
     $sOutputHtml = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['messages_top_section'], $aTemplateKeys);
     // return all builded data ;
     return $sOutputHtml;
 }
Exemplo n.º 17
0
 function getViewableValue($aItem, $sValue)
 {
     global $site;
     switch ($aItem['Type']) {
         case 'text':
         case 'num':
         case 'area':
             return nl2br(htmlspecialchars_adv($sValue));
         case 'html_area':
             return $sValue;
         case 'date':
             return $this->getViewableDate($sValue);
         case 'range':
             return htmlspecialchars_adv(str_replace(',', ' - ', $sValue));
         case 'bool':
             return _t($sValue ? '_Yes' : '_No');
         case 'select_one':
             $sValueView = $this->getViewableSelectOne($aItem['Values'], $sValue);
             if ($aItem['Name'] == 'Country') {
                 $sFlagName = strtolower($sValue);
                 $sValueView = '<img src="' . $site['flags'] . $sFlagName . '.gif" /> ' . $sValueView;
             }
             return $sValueView;
         case 'select_set':
             return $this->getViewableSelectSet($aItem['Values'], $sValue);
         case 'system':
             switch ($aItem['Name']) {
                 case 'Age':
                     return age($sValue);
                 case 'DateReg':
                 case 'DateLastEdit':
                 case 'DateLastLogin':
                     return $this->getViewableDate($sValue, BX_DOL_LOCALE_DATE);
                 case 'Status':
                     return _t("_{$sValue}");
                 case 'ID':
                     return $sValue;
                 case 'Featured':
                     return _t($sValue ? '_Yes' : '_No');
                 default:
                     return '&nbsp;';
             }
             break;
         case 'pass':
         default:
             return '&nbsp;';
     }
 }
Exemplo n.º 18
0
 function get()
 {
     if (get_config('system', 'block_public') && !local_channel() && !remote_channel()) {
         notice(t('Public access denied.') . EOL);
         return;
     }
     $observer = get_observer_hash();
     $globaldir = get_directory_setting($observer, 'globaldir');
     // override your personal global search pref if we're doing a navbar search of the directory
     if (intval($_REQUEST['navsearch'])) {
         $globaldir = 1;
     }
     $safe_mode = get_directory_setting($observer, 'safemode');
     $pubforums = get_directory_setting($observer, 'pubforums');
     $o = '';
     nav_set_selected('directory');
     if (x($_POST, 'search')) {
         $search = notags(trim($_POST['search']));
     } else {
         $search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : '';
     }
     if (strpos($search, '=') && local_channel() && get_pconfig(local_channel(), 'feature', 'expert')) {
         $advanced = $search;
     }
     $keywords = $_GET['keywords'] ? $_GET['keywords'] : '';
     // Suggest channels if no search terms or keywords are given
     $suggest = local_channel() && x($_REQUEST, 'suggest') ? $_REQUEST['suggest'] : '';
     if ($suggest) {
         $r = suggestion_query(local_channel(), get_observer_hash());
         // Remember in which order the suggestions were
         $addresses = array();
         $common = array();
         $index = 0;
         foreach ($r as $rr) {
             $common[$rr['xchan_addr']] = $rr['total'];
             $addresses[$rr['xchan_addr']] = $index++;
         }
         // Build query to get info about suggested people
         $advanced = '';
         foreach (array_keys($addresses) as $address) {
             $advanced .= "address=\"{$address}\" ";
         }
         // Remove last space in the advanced query
         $advanced = rtrim($advanced);
     }
     $tpl = get_markup_template('directory_header.tpl');
     $dirmode = intval(get_config('system', 'directory_mode'));
     if ($dirmode == DIRECTORY_MODE_PRIMARY || $dirmode == DIRECTORY_MODE_STANDALONE) {
         $url = z_root() . '/dirsearch';
     }
     if (!$url) {
         $directory = find_upstream_directory($dirmode);
         if (!$directory || !array_key_exists('url', $directory) || !$directory['url']) {
             logger('CRITICAL: No directory server URL');
         }
         $url = $directory['url'] . '/dirsearch';
     }
     $token = get_config('system', 'realm_token');
     logger('mod_directory: URL = ' . $url, LOGGER_DEBUG);
     $contacts = array();
     if (local_channel()) {
         $x = q("select abook_xchan from abook where abook_channel = %d", intval(local_channel()));
         if ($x) {
             foreach ($x as $xx) {
                 $contacts[] = $xx['abook_xchan'];
             }
         }
     }
     if ($url) {
         $numtags = get_config('system', 'directorytags');
         $kw = intval($numtags) > 0 ? intval($numtags) : 50;
         if (get_config('system', 'disable_directory_keywords')) {
             $kw = 0;
         }
         $query = $url . '?f=&kw=' . $kw . ($safe_mode != 1 ? '&safe=' . $safe_mode : '');
         if ($token) {
             $query .= '&t=' . $token;
         }
         if (!$globaldir) {
             $query .= '&hub=' . \App::get_hostname();
         }
         if ($search) {
             $query .= '&name=' . urlencode($search) . '&keywords=' . urlencode($search);
         }
         if (strpos($search, '@')) {
             $query .= '&address=' . urlencode($search);
         }
         if ($keywords) {
             $query .= '&keywords=' . urlencode($keywords);
         }
         if ($advanced) {
             $query .= '&query=' . urlencode($advanced);
         }
         if (!is_null($pubforums)) {
             $query .= '&pubforums=' . intval($pubforums);
         }
         $directory_sort_order = get_config('system', 'directory_sort_order');
         if (!$directory_sort_order) {
             $directory_sort_order = 'date';
         }
         $sort_order = x($_REQUEST, 'order') ? $_REQUEST['order'] : $directory_sort_order;
         if ($sort_order) {
             $query .= '&order=' . urlencode($sort_order);
         }
         if (\App::$pager['page'] != 1) {
             $query .= '&p=' . \App::$pager['page'];
         }
         logger('mod_directory: query: ' . $query);
         $x = z_fetch_url($query);
         logger('directory: return from upstream: ' . print_r($x, true), LOGGER_DATA);
         if ($x['success']) {
             $t = 0;
             $j = json_decode($x['body'], true);
             if ($j) {
                 if ($j['results']) {
                     $entries = array();
                     $photo = 'thumb';
                     foreach ($j['results'] as $rr) {
                         $profile_link = chanlink_url($rr['url']);
                         $pdesc = $rr['description'] ? $rr['description'] . '<br />' : '';
                         $connect_link = local_channel() ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '';
                         // Checking status is disabled ATM until someone checks the performance impact more carefully
                         //$online = remote_online_status($rr['address']);
                         $online = '';
                         if (in_array($rr['hash'], $contacts)) {
                             $connect_link = '';
                         }
                         $location = '';
                         if (strlen($rr['locale'])) {
                             $location .= $rr['locale'];
                         }
                         if (strlen($rr['region'])) {
                             if (strlen($rr['locale'])) {
                                 $location .= ', ';
                             }
                             $location .= $rr['region'];
                         }
                         if (strlen($rr['country'])) {
                             if (strlen($location)) {
                                 $location .= ', ';
                             }
                             $location .= $rr['country'];
                         }
                         $age = '';
                         if (strlen($rr['birthday'])) {
                             if (($years = age($rr['birthday'], 'UTC', '')) != 0) {
                                 $age = $years;
                             }
                         }
                         $page_type = '';
                         if ($rr['total_ratings']) {
                             $total_ratings = sprintf(tt("%d rating", "%d ratings", $rr['total_ratings']), $rr['total_ratings']);
                         } else {
                             $total_ratings = '';
                         }
                         $profile = $rr;
                         if (x($profile, 'locale') == 1 || x($profile, 'region') == 1 || x($profile, 'postcode') == 1 || x($profile, 'country') == 1) {
                             $gender = x($profile, 'gender') == 1 ? t('Gender: ') . $profile['gender'] : False;
                         }
                         $marital = x($profile, 'marital') == 1 ? t('Status: ') . $profile['marital'] : False;
                         $homepage = x($profile, 'homepage') == 1 ? t('Homepage: ') : False;
                         $homepageurl = x($profile, 'homepage') == 1 ? $profile['homepage'] : '';
                         $hometown = x($profile, 'hometown') == 1 ? $profile['hometown'] : False;
                         $about = x($profile, 'about') == 1 ? bbcode($profile['about']) : False;
                         $keywords = x($profile, 'keywords') ? $profile['keywords'] : '';
                         $out = '';
                         if ($keywords) {
                             $keywords = str_replace(',', ' ', $keywords);
                             $keywords = str_replace('  ', ' ', $keywords);
                             $karr = explode(' ', $keywords);
                             if ($karr) {
                                 if (local_channel()) {
                                     $r = q("select keywords from profile where uid = %d and is_default = 1 limit 1", intval(local_channel()));
                                     if ($r) {
                                         $keywords = str_replace(',', ' ', $r[0]['keywords']);
                                         $keywords = str_replace('  ', ' ', $keywords);
                                         $marr = explode(' ', $keywords);
                                     }
                                 }
                                 foreach ($karr as $k) {
                                     if (strlen($out)) {
                                         $out .= ', ';
                                     }
                                     if ($marr && in_arrayi($k, $marr)) {
                                         $out .= '<strong>' . $k . '</strong>';
                                     } else {
                                         $out .= $k;
                                     }
                                 }
                             }
                         }
                         $entry = array('id' => ++$t, 'profile_link' => $profile_link, 'public_forum' => $rr['public_forum'], 'photo' => $rr['photo'], 'hash' => $rr['hash'], 'alttext' => $rr['name'] . (local_channel() || remote_channel() ? ' ' . $rr['address'] : ''), 'name' => $rr['name'], 'age' => $age, 'age_label' => t('Age:'), 'profile' => $profile, 'address' => $rr['address'], 'nickname' => substr($rr['address'], 0, strpos($rr['address'], '@')), 'location' => $location, 'location_label' => t('Location:'), 'gender' => $gender, 'total_ratings' => $total_ratings, 'viewrate' => true, 'canrate' => local_channel() ? true : false, 'pdesc' => $pdesc, 'pdesc_label' => t('Description:'), 'marital' => $marital, 'homepage' => $homepage, 'homepageurl' => linkify($homepageurl), 'hometown' => $hometown, 'hometown_label' => t('Hometown:'), 'about' => $about, 'about_label' => t('About:'), 'conn_label' => t('Connect'), 'forum_label' => t('Public Forum:'), 'connect' => $connect_link, 'online' => $online, 'kw' => $out ? t('Keywords: ') : '', 'keywords' => $out, 'ignlink' => $suggest ? z_root() . '/directory?ignore=' . $rr['hash'] : '', 'ignore_label' => t('Don\'t suggest'), 'common_friends' => $common[$rr['address']] ? intval($common[$rr['address']]) : '', 'common_label' => t('Common connections:'), 'common_count' => intval($common[$rr['address']]), 'safe' => $safe_mode);
                         $arr = array('contact' => $rr, 'entry' => $entry);
                         call_hooks('directory_item', $arr);
                         unset($profile);
                         unset($location);
                         if (!$arr['entry']) {
                             continue;
                         }
                         if ($sort_order == '' && $suggest) {
                             $entries[$addresses[$rr['address']]] = $arr['entry'];
                             // Use the same indexes as originally to get the best suggestion first
                         } else {
                             $entries[] = $arr['entry'];
                         }
                     }
                     ksort($entries);
                     // Sort array by key so that foreach-constructs work as expected
                     if ($j['keywords']) {
                         \App::$data['directory_keywords'] = $j['keywords'];
                     }
                     logger('mod_directory: entries: ' . print_r($entries, true), LOGGER_DATA);
                     if ($_REQUEST['aj']) {
                         if ($entries) {
                             $o = replace_macros(get_markup_template('directajax.tpl'), array('$entries' => $entries));
                         } else {
                             $o = '<div id="content-complete"></div>';
                         }
                         echo $o;
                         killme();
                     } else {
                         $maxheight = 94;
                         $dirtitle = $globaldir ? t('Global Directory') : t('Local Directory');
                         $o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; divmore_height = " . intval($maxheight) . ";  </script>";
                         $o .= replace_macros($tpl, array('$search' => $search, '$desc' => t('Find'), '$finddsc' => t('Finding:'), '$safetxt' => htmlspecialchars($search, ENT_QUOTES, 'UTF-8'), '$entries' => $entries, '$dirlbl' => $suggest ? t('Channel Suggestions') : $dirtitle, '$submit' => t('Find'), '$next' => alt_pager($a, $j['records'], t('next page'), t('previous page')), '$sort' => t('Sort options'), '$normal' => t('Alphabetic'), '$reverse' => t('Reverse Alphabetic'), '$date' => t('Newest to Oldest'), '$reversedate' => t('Oldest to Newest'), '$suggest' => $suggest ? '&suggest=1' : ''));
                     }
                 } else {
                     if ($_REQUEST['aj']) {
                         $o = '<div id="content-complete"></div>';
                         echo $o;
                         killme();
                     }
                     if (\App::$pager['page'] == 1 && $j['records'] == 0 && strpos($search, '@')) {
                         goaway(z_root() . '/chanview/?f=&address=' . $search);
                     }
                     info(t("No entries (some entries may be hidden).") . EOL);
                 }
             }
         }
     }
     return $o;
 }
Exemplo n.º 19
0
<?php

echo date('Y-m-d H:i:s');
function age($birthday)
{
    list($day, $month, $year) = explode("/", $birthday);
    $year_diff = date("Y") - $year;
    $month_diff = date("m") - $month;
    $day_diff = date("d") - $day;
    if ($day_diff < 0 && $month_diff == 0) {
        $year_diff--;
    }
    if ($day_diff < 0 && $month_diff < 0) {
        $year_diff--;
    }
    return $year_diff;
}
$dob = '1981-03-24';
echo age($dob);
Exemplo n.º 20
0
function PrintInfo($id = 0)
{
    if ($id > 0) {
        $info_arr = getProfileInfo($id);
        $info_sex = _t("_{$info_arr['Sex']}");
        $info_age = age($info_arr['DateOfBirth']);
        $ret = "<p align=\"left\">" . _t("_Nickname") . ": <strong>{$info_arr['NickName']}</strong><br />" . _t("_Sex") . ": <strong>{$info_sex}</strong><br />" . _t("_DateOfBirth") . ": <strong>{$info_age}</strong><br /></p>";
    } else {
        $ret = _t("_no_info");
    }
    return $ret;
}
Exemplo n.º 21
0
/**
 * match profiles
 * return number ( 0-100 ) in percent, how match this profiles
 */
function match_profiles($Member, $Profile)
{
    $fields = array();
    $extras = array();
    $match_fields = array();
    $match_types = array();
    $match_extras = array();
    $i = 0;
    $res = db_res("SELECT `name`, `match_field`, `extra`, `match_type`, `match_extra` FROM `ProfilesDesc` WHERE `match_type` <> '' AND `match_type` <> 'none'");
    while ($arr = mysql_fetch_array($res)) {
        $fields[$i] = get_field_name($arr);
        $extras[$i] = $arr['extra'];
        $match_fields[$i] = $arr['match_field'];
        $match_types[$i] = $arr['match_type'];
        $match_extras[$i] = $arr['match_extra'];
        $i++;
    }
    foreach ($match_fields as $n => $m_field) {
        $m_field = trim($m_field);
        if (!strlen($m_field)) {
            continue;
        }
        if (!$n) {
            $sql_add_m .= " {$m_field}";
            $sql_add_p .= " {$fields[$n]}";
        } else {
            $sql_add_m .= ", {$m_field}";
            $sql_add_p .= ", {$fields[$n]}";
        }
    }
    $arr_m = db_arr("SELECT {$sql_add_p} FROM Profiles WHERE ID = {$Member}");
    $arr_p = db_arr("SELECT {$sql_add_m} FROM Profiles WHERE ID = {$Profile}");
    if (!$arr_m || !$arr_p) {
        return 0;
    }
    $ret = 0;
    foreach ($match_fields as $n => $m_field) {
        switch ($match_types[$n]) {
            case "enum":
            case "enum_ref":
                if ($arr_m[$fields[$n]] == $arr_p[$match_fields[$n]]) {
                    $ret += $match_extras[$n];
                }
                break;
            case "set":
                $vals = preg_split("/[,\\']+/", $extras[$n], -1, PREG_SPLIT_NO_EMPTY);
                $vals_m = preg_split("/[,\\']+/", $arr_m[$fields[$n]], -1, PREG_SPLIT_NO_EMPTY);
                $vals_p = preg_split("/[,\\']+/", $arr_p[$match_fields[$n]], -1, PREG_SPLIT_NO_EMPTY);
                $count = count($vals);
                $count_m = count($vals_m);
                $count_p = count($vals_p);
                if ($count_p + $count_m > 0) {
                    $per = $match_extras[$n] / max($count_p, $count_m);
                    foreach ($vals as $key => $val) {
                        if (strlen(strstr($arr_m[$fields[$n]], $val)) > 0 && strlen(strstr($arr_p[$match_fields[$n]], $val)) > 0) {
                            $ret += $per;
                        }
                    }
                }
                break;
            case "daterange":
                $rg = split("-", $arr_m[$fields[$n]]);
                $age = age($arr_p[$match_fields[$n]]);
                if ($age >= $rg[0] && $age <= $rg[1]) {
                    $ret += $match_extras[$n];
                }
                break;
        }
    }
    return (int) $ret;
}
Exemplo n.º 22
0
    function getBlockCode_AccountControl()
    {
        global $oTemplConfig, $site, $aPreValues;
        //--- Load cache of sys_account_custom_stat_elements ---//
        $aAccountCustomStatElements = $GLOBALS['MySQL']->fromCache('sys_account_custom_stat_elements', 'getAllWithKey', 'SELECT * FROM `sys_account_custom_stat_elements`', 'ID');
        //--- Load cache of sys_stat_member ---//
        $aPQStatisticsElements = $GLOBALS['MySQL']->fromCache('sys_stat_member', 'getAllWithKey', 'SELECT * FROM `sys_stat_member`', 'Type');
        //--- end of loading caches ---//
        //Labels
        $sUsernameC = _t('_NickName');
        $sProfileStatusC = _t('_Profile status');
        $sPresenceC = _t('_Presence');
        $sMembershipC = _t('_Membership2');
        $sLastLoginC = _t('_Last login');
        $sRegistrationC = _t('_Registration');
        $sEmailC = _t('_Email');
        $sGreetedC = _t('_greeted');
        $sGreetedMeC = _t('_Greeted me');
        $sBlockedC = _t('_blocked');
        $sViewedMeC = _t('_Viewed me');
        $sMembersC = ' ' . _t('_Members');
        $sEditProfileInfoC = _t('_Edit profile info');
        $sProfileC = _t('_Profile');
        $sAccountInfoC = _t('_Account Info');
        $sActivityC = _t('_Tracker');
        $sCustomC = _t('_Custom');
        $sMaleIcon = getTemplateIcon('male.png');
        $sFemaleIcon = getTemplateIcon('female.png');
        // Values
        $sUsername = $this->aMemberInfo['NickName'];
        $sUserLink = getProfileLink($this->aMemberInfo['ID']);
        $sOwnerThumb = get_member_thumbnail($this->aMemberInfo['ID'], 'none', true);
        $iYears = age($this->aMemberInfo['DateOfBirth']);
        $sYearsOld = _t('_y/o', $iYears);
        $sProfileIcon = $this->aMemberInfo['Sex'] == 'male' ? $sMaleIcon : $sFemaleIcon;
        $sCustomElements = '';
        $sCountryName = empty($this->aMemberInfo['Country']) ? '' : _t($aPreValues['Country'][$this->aMemberInfo['Country']]['LKey']);
        $sCityName = $this->aMemberInfo['City'];
        $sCountryPic = $this->aMemberInfo['Country'] == '' ? '' : ' <img alt="' . $this->aMemberInfo['Country'] . '" src="' . ($site['flags'] . strtolower($this->aMemberInfo['Country'])) . '.gif"/>';
        $sProfileStatus = _t("__{$this->aMemberInfo['Status']}");
        $sProfileStatusMess = '';
        switch ($this->aMemberInfo['Status']) {
            case 'Unconfirmed':
                $sProfileStatusMess = _t("_ATT_UNCONFIRMED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
                break;
            case 'Approval':
                $sProfileStatusMess = _t("_ATT_APPROVAL", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
                break;
            case 'Active':
                $sProfileStatusMess = _t("_ATT_ACTIVE", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
                break;
            case 'Rejected':
                $sProfileStatusMess = _t("_ATT_REJECTED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
                break;
            case 'Suspended':
                $sProfileStatusMess = _t("_ATT_SUSPENDED", $oTemplConfig->popUpWindowWidth, $oTemplConfig->popUpWindowHeight);
                break;
        }
        $sMembership = '';
        $sMembStatus = GetMembershipStatus($this->aMemberInfo['ID']);
        $sMembership = <<<EOF
\t<tr class="account_control_tr">
\t\t<td valign=top class="account_control_left">{$sMembershipC}:</td>
\t\t<td valign=top class="account_control_right">
\t\t\t{$sMembStatus}
\t\t</td>
\t</tr>
EOF;
        $oForm = bx_instance('BxDolFormCheckerHelper');
        if (!$this->aMemberInfo['DateLastLogin'] || $this->aMemberInfo['DateLastLogin'] == "0000-00-00 00:00:00") {
            $sLastLogin = '******';
        } else {
            $sLastLoginTS = $oForm->_passDateTime($this->aMemberInfo['DateLastLogin']);
            $sLastLogin = getLocaleDate($sLastLoginTS, BX_DOL_LOCALE_DATE);
        }
        if (!$this->aMemberInfo['DateReg'] || $this->aMemberInfo['DateReg'] == "0000-00-00 00:00:00") {
            $sRegistration = 'never';
        } else {
            $sRegistrationTS = $oForm->_passDateTime($this->aMemberInfo['DateReg']);
            $sRegistration = getLocaleDate($sRegistrationTS, BX_DOL_LOCALE_DATE);
        }
        $sEmail = $this->aMemberInfo['Email'];
        $this->aMemberInfo = getProfileInfo($this->aMemberInfo['ID']);
        //my greeted contacts
        $sMGCSQL = $aPQStatisticsElements['mgc']['SQL'];
        $sMGCSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sMGCSQL);
        $iGreetedContactsCnt = (int) db_value($sMGCSQL);
        //my greeted me contacts
        $sMGMCSQL = $aPQStatisticsElements['mgmc']['SQL'];
        $sMGMCSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sMGMCSQL);
        $iGreetedMeContactsCnt = (int) db_value($sMGMCSQL);
        //my blocked contacts
        $sMBCSQL = $aPQStatisticsElements['mbc']['SQL'];
        $sMBCSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sMBCSQL);
        $iBlockedContactsCnt = (int) db_value($sMBCSQL);
        $iViewedMeContactsCnt = (int) $this->aMemberInfo['Views'];
        $bModuleExists = false;
        $aCustomElements = array();
        $aCustomElements['header5'] = array('type' => 'block_header', 'caption' => $sCustomC, 'collapsable' => true);
        foreach ($aAccountCustomStatElements as $iID => $aMemberStats) {
            $sUnparsedLabel = $aMemberStats['Label'];
            $sUnparsedValue = $aMemberStats['Value'];
            $sLabel = _t($sUnparsedLabel);
            $sUnparsedValue = str_replace('__site_url__', $site['url'], $sUnparsedValue);
            //step 1 - replacements of keys
            $sLblTmpl = '__l_';
            $sTmpl = '__';
            while ($iStartPos = strpos($sUnparsedValue, $sLblTmpl)) {
                $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1);
                if ($iEndPos > $iStartPos) {
                    $sSubstr = substr($sUnparsedValue, $iStartPos + strlen($sLblTmpl), $iEndPos - $iStartPos - strlen($sLblTmpl));
                    $sKeyValue = strtolower(_t('_' . $sSubstr));
                    $sUnparsedValue = str_replace($sLblTmpl . $sSubstr . $sTmpl, $sKeyValue, $sUnparsedValue);
                } else {
                    break;
                }
            }
            //step 2 - replacements of Stat keys
            while (($iStartPos = strpos($sUnparsedValue, $sTmpl, 0)) >= 0) {
                $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1);
                if ($iEndPos > $iStartPos) {
                    $iCustomCnt = 0;
                    $sSubstr = process_db_input(substr($sUnparsedValue, $iStartPos + strlen($sTmpl), $iEndPos - $iStartPos - strlen($sTmpl)), BX_TAGS_STRIP);
                    if ($sSubstr) {
                        $sCustomSQL = $aPQStatisticsElements[$sSubstr]['SQL'];
                        $sCustomSQL = str_replace('__member_id__', $this->aMemberInfo['ID'], $sCustomSQL);
                        $sCustomSQL = str_replace('__profile_media_define_photo__', _t('_ProfilePhotos'), $sCustomSQL);
                        $sCustomSQL = str_replace('__profile_media_define_music__', _t('_ProfileMusic'), $sCustomSQL);
                        $sCustomSQL = str_replace('__profile_media_define_video__', _t('_ProfileVideos'), $sCustomSQL);
                        $sCustomSQL = str_replace('__member_nick__', process_db_input($this->aMemberInfo['NickName'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION), $sCustomSQL);
                        $iCustomCnt = $sCustomSQL != '' ? (int) db_value($sCustomSQL) : '';
                    }
                    $sUnparsedValue = str_replace($sTmpl . $sSubstr . $sTmpl, $iCustomCnt, $sUnparsedValue);
                } else {
                    break;
                }
            }
            $sCustomElements .= <<<EOF
\t<tr class="account_control_tr">
\t    <td class="account_control_left">{$sLabel}: </td>
\t    <td class="account_control_right">
\t\t\t{$sUnparsedValue}
\t\t</td>
\t</tr>
EOF;
            $sTrimmedLabel = trim($sUnparsedLabel, '_');
            $aCustomElements[$sTrimmedLabel] = array('type' => 'custom', 'name' => $sTrimmedLabel, 'content' => '<b>' . $sLabel . ':</b> ' . $sUnparsedValue, 'colspan' => true);
            if (!$bModuleExists) {
                $bModuleExists = true;
            }
        }
        $aCustomElements['header5_end'] = array('type' => 'block_end');
        $sProfileInfoCont = <<<EOF
<div class="infoMain">
\t<div class="memberPic" style="margin-left:0px;padding:0px;text-align:center;width:70px;">
\t\t{$sOwnerThumb}
\t</div>
\t<div class="infoText">
\t\t<div class="infoUnit">
\t\t\t<img src="{$sProfileIcon}" />
\t\t\t{$sYearsOld}
\t\t</div>
\t\t<div class="infoUnit">
\t\t\t{$sCountryPic} {$sCountryName}, {$sCityName}
\t\t</div>
\t\t<div class="infoUnit">
\t\t\t<a href="{$site['url']}pedit.php?ID={$this->aMemberInfo['ID']}">{$sEditProfileInfoC}</a>
\t\t</div>
\t</div>
</div>
<div class="clear_both"></div>
EOF;
        require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolUserStatusView.php';
        $oStatusView = new BxDolUserStatusView();
        $sUserStatus = '';
        if ($oStatusView->aStatuses) {
            foreach ($oStatusView->aStatuses as $sKey => $aItems) {
                $sTitle = _t($aItems['title']);
                $sOnclick = strtolower($this->aMemberInfo['UserStatus']) == strtolower($sKey) ? "" : "onclick=\"if (typeof oBxUserStatus != 'undefined' ) { oBxUserStatus.setUserStatus('{$sKey}', \$(this).parents('ul:first')); \$('#user_status_ac .block_collapse_btn').attr('src', aDolImages['collapse_closed']); \$('#user_status_ac').parent().toggleClass('collapsed').next('tbody').fadeOut(400); location.reload(); }return false\"";
                $aTemplateKeys = array('bx_if:item_img' => array('condition' => true, 'content' => array('item_img_src' => $GLOBALS['oFunctions']->getTemplateIcon($aItems['icon']), 'item_img_alt' => $sTitle, 'item_img_width' => 16, 'item_img_height' => 16)), 'item_link' => 'javascript:void(0)', 'item_onclick' => $sOnclick, 'item_title' => $sTitle, 'extra_info' => null);
                $sUserStatus .= $GLOBALS['oSysTemplate']->parseHtmlByName('account_control_member_status.html', $aTemplateKeys);
            }
        }
        $aForm = array('form_attrs' => array('action' => '', 'method' => 'post'), 'params' => array('remove_form' => true), 'inputs' => array('header1' => array('type' => 'block_header', 'caption' => $sProfileC, 'collapsable' => true), 'Info' => array('type' => 'custom', 'name' => 'Info', 'content' => $sProfileInfoCont, 'colspan' => true), 'header1_end' => array('type' => 'block_end'), 'header2' => array('type' => 'block_header', 'caption' => $sPresenceC, 'collapsable' => true, 'collapsed' => true, 'attrs' => array('id' => 'user_status_ac')), 'UserStatus' => array('type' => 'custom', 'name' => 'Info', 'content' => $sUserStatus, 'colspan' => true), 'header2_end' => array('type' => 'block_end'), 'header3' => array('type' => 'block_header', 'caption' => $sAccountInfoC, 'collapsable' => true), 'Username' => array('type' => 'custom', 'name' => 'Username', 'content' => '<b>' . $sUsernameC . ':</b> <a href="' . $sUserLink . '" >' . $sUsername . '</a>', 'colspan' => true), 'Email' => array('type' => 'custom', 'name' => 'Email', 'content' => '<b>' . $sEmailC . ':</b> ' . $sEmail, 'colspan' => true), 'Status' => array('type' => 'custom', 'name' => 'Status', 'content' => '<b>' . $sProfileStatusC . ':</b> ' . $sProfileStatus . ' ' . $sProfileStatusMess, 'colspan' => true), 'Membership' => array('type' => 'custom', 'name' => 'Membership', 'content' => '<b>' . $sMembershipC . ':</b> ' . $sMembStatus, 'colspan' => true), 'LastLogin' => array('type' => 'custom', 'name' => 'LastLogin', 'content' => '<b>' . $sLastLoginC . ':</b> ' . $sLastLogin, 'colspan' => true), 'Registration' => array('type' => 'custom', 'name' => 'Registration', 'content' => '<b>' . $sRegistrationC . ':</b> ' . $sRegistration, 'colspan' => true), 'header3_end' => array('type' => 'block_end'), 'header4' => array('type' => 'block_header', 'caption' => $sActivityC, 'collapsable' => true), 'ViewedMe' => array('type' => 'custom', 'name' => 'ViewedMe', 'content' => '<b>' . $sViewedMeC . ':</b> ' . _t('_N times', $iViewedMeContactsCnt), 'colspan' => true), 'Blocked' => array('type' => 'custom', 'name' => 'Blocked', 'content' => '<b>' . $sBlockedC . ':</b> ' . $iBlockedContactsCnt . $sMembersC, 'colspan' => true), 'Greeted' => array('type' => 'custom', 'name' => 'Greeted', 'content' => '<b>' . $sGreetedC . ':</b> ' . _t('_N times', $iGreetedContactsCnt), 'colspan' => true), 'GreetedMe' => array('type' => 'custom', 'name' => 'GreetedMe', 'content' => '<b>' . $sGreetedMeC . ':</b> ' . $iGreetedMeContactsCnt . $sMembersC, 'colspan' => true), 'header4_end' => array('type' => 'block_end')));
        //custom
        if ($bModuleExists) {
            $aForm['inputs'] = array_merge($aForm['inputs'], $aCustomElements);
        }
        $oForm = new BxTemplFormView($aForm);
        return '<div class="dbContent">' . $oForm->getCode() . '</div>';
    }
Exemplo n.º 23
0
		<li>Итоговая страховая премия:  <span class="text-danger"><b>' . $tarif . '</b></span></li>
		</ul>
		</em>
		<hr class="hr_red_2">
		</div>
	</div>
	';
}
if ($ins_prog_3) {
    for ($n = 1; $n <= $prog_3_num; $n++) {
        $koef = 1;
        $koef_sport = 1;
        $koef_work = 1;
        $koef_health = 1;
        $koef_medical_examination = 1;
        $age = age(${"date_birth_" . $n});
        //Основной коэффициент
        $query = mysql_query("SELECT * FROM `hypothec_private_" . $prog_3_type . "_tb` WHERE `age` = " . $age . " AND `id_bank` = " . $id_bank);
        if (mysql_num_rows($query) < 1) {
            echo '<center><span class="text-danger"><b>Ошибка! Не удалось получить коэффициент по личному страхованию для застрахованного №' . $n . '. Обратитесь к администратору.</b></span></center>';
            echo $button_return;
            exit;
        }
        $koef_data = mysql_fetch_assoc($query);
        $koef = $koef_data[${"sex_" . $n}];
        //Коэффициент за спорт
        if (${"sport_" . $n} == 'yes') {
            $query = mysql_query("SELECT * FROM `hypothec_sport_koef` WHERE `id` = " . ${"sport_category_" . $n} . " AND `id_bank` = " . $id_bank . " AND `active` = 1");
            if (mysql_num_rows($query) < 1) {
                echo '<center><span class="text-danger"><b>Ошибка! Не удалось получить коэффициент за спорт для застрахованного №' . $n . '. Обратитесь к администратору.</b></span></center>';
                echo $button_return;
Exemplo n.º 24
0
/**
 * @brief Wrapper for date selector, tailored for use in birthday fields.
 *
 * @param string $dob Date of Birth
 * @return string
 */
function dob($dob)
{
    list($year, $month, $day) = sscanf($dob, '%4d-%2d-%2d');
    $f = get_config('system', 'birthday_input_format');
    if (!$f) {
        $f = 'ymd';
    }
    if ($dob === '0000-00-00') {
        $value = '';
    } else {
        $value = $year ? datetime_convert('UTC', 'UTC', $dob, 'Y-m-d') : datetime_convert('UTC', 'UTC', $dob, 'm-d');
    }
    $o = replace_macros(get_markup_template("field_input.tpl"), array('$field' => array('dob', t('Birthday'), $value, intval($value) ? t('Age: ') . age($value, App::$user['timezone'], App::$user['timezone']) : '', '', 'placeholder="' . t('YYYY-MM-DD or MM-DD') . '"')));
    //	if ($dob && $dob != '0000-00-00')
    //		$o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year),'dob');
    //	else
    //		$o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),false,'dob');
    return $o;
}
Exemplo n.º 25
0
 $ci_slots = size($ci['slots']);
 $ci_size = size($ci['size']);
 $ci_avail = size($ci['avail']);
 $ci = number_formats($ci, $numkeys);
 $hits_avg_h = number_format(array_avg($ci['hits_by_hour']), 2);
 $hits_avg_s = number_format(array_avg($ci['hits_by_second']), 2);
 $hits_graph_h = get_cache_hits_graph($ci, 'hits_by_hour');
 if (!empty($ci['istotal'])) {
     $ci['status'] = '-';
     $ci['can_readonly'] = '-';
 } else {
     if ($ci['disabled']) {
         $ci['status'] = $l_disabled . sprintf("(%s)", age($ci['disabled']));
     } else {
         if ($ci['type'] == XC_TYPE_PHP) {
             $ci['status'] = $ci['compiling'] ? $l_compiling . sprintf("(%s)", age($ci['compiling'])) : $l_normal;
         } else {
             $ci['status'] = '-';
         }
     }
     $ci['can_readonly'] = $ci['can_readonly'] ? 'yes' : 'no';
 }
 $enabledisable = $ci['disabled'] ? 'enable' : 'disable';
 $l_enabledisable = $ci['disabled'] ? $l_enable : $l_disable;
 echo <<<EOS
t<th>{$ci['cache_name']}</th>
t<td align="right" title="{$ci['slots']}">{$ci_slots}</td>
t<td align="right" title="{$ci['size']}">{$ci_size}</td>
t<td align="right" title="{$ci['avail']}">{$ci_avail}</td>
t<td title="{$pvalue} %"
t\t><div class="percent" style="width: {$w}px"
Exemplo n.º 26
0
 function fillProfileArray($a, $sImage = 'icon', $iIdViewer = 0)
 {
     if (!$iIdViewer) {
         $iIdViewer = $_COOKIE['memberID'];
     }
     $sImageKey = ucfirst($sImage);
     $sImage = BxDolXMLRPCUtil::getThumbLink($a['ID'], $sImage);
     bx_import('BxDolAlbums');
     return array('ID' => new xmlrpcval($a['ID']), 'Title' => new xmlrpcval($a['Headline']), 'Nick' => new xmlrpcval($a['NickName']), 'Sex' => new xmlrpcval($a['Sex']), 'Age' => new xmlrpcval(age($a['DateOfBirth'])), 'Country' => new xmlrpcval(_t($GLOBALS['aPreValues']['Country'][$a['Country']]['LKey'])), 'City' => new xmlrpcval($a['City']), 'CountPhotos' => new xmlrpcval(BxDolXMLRPCMedia::_getMediaCount('photo', $iId, $iIdViewer)), 'CountVideos' => new xmlrpcval(BxDolXMLRPCMedia::_getMediaCount('video', $iId, $iIdViewer)), 'CountSounds' => new xmlrpcval(BxDolXMLRPCMedia::_getMediaCount('music', $iId, $iIdViewer)), 'CountFriends' => new xmlrpcval(getFriendNumber($a['ID'])), $sImageKey => new xmlrpcval($sImage));
 }
Exemplo n.º 27
0
function advanced_profile(&$a)
{
    require_once 'include/text.php';
    if (!perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_profile')) {
        return '';
    }
    $o = '';
    $o .= '<h2>' . t('Profile') . '</h2>';
    if ($a->profile['name']) {
        $tpl = get_markup_template('profile_advanced.tpl');
        $profile = array();
        $profile['fullname'] = array(t('Full Name:'), $a->profile['name']);
        if ($a->profile['gender']) {
            $profile['gender'] = array(t('Gender:'), $a->profile['gender']);
        }
        $ob_hash = get_observer_hash();
        if ($ob_hash && perm_is_allowed($a->profile['profile_uid'], $ob_hash, 'post_like')) {
            $profile['canlike'] = true;
            $profile['likethis'] = t('Like this channel');
            $profile['profile_guid'] = $a->profile['profile_guid'];
        }
        $likers = q("select liker, xchan.*  from likes left join xchan on liker = xchan_hash where channel_id = %d and target_type = '%s' and verb = '%s'", intval($a->profile['profile_uid']), dbesc(ACTIVITY_OBJ_PROFILE), dbesc(ACTIVITY_LIKE));
        $profile['likers'] = array();
        $profile['like_count'] = count($likers);
        $profile['like_button_label'] = tt('Like', 'Likes', $profile['like_count'], 'noun');
        if ($likers) {
            foreach ($likers as $l) {
                $profile['likers'][] = array('name' => $l['xchan_name'], 'url' => zid($l['xchan_url']));
            }
        }
        if ($a->profile['dob'] && $a->profile['dob'] != '0000-00-00') {
            $val = '';
            if (substr($a->profile['dob'], 5, 2) === '00' || substr($a->profile['dob'], 8, 2) === '00') {
                $val = substr($a->profile['dob'], 0, 4);
            }
            $year_bd_format = t('j F, Y');
            $short_bd_format = t('j F');
            if (!$val) {
                $val = intval($a->profile['dob']) ? day_translate(datetime_convert('UTC', 'UTC', $a->profile['dob'] . ' 00:00 +00:00', $year_bd_format)) : day_translate(datetime_convert('UTC', 'UTC', '2001-' . substr($a->profile['dob'], 5) . ' 00:00 +00:00', $short_bd_format));
            }
            $profile['birthday'] = array(t('Birthday:'), $val);
        }
        if ($age = age($a->profile['dob'], $a->profile['timezone'], '')) {
            $profile['age'] = array(t('Age:'), $age);
        }
        if ($a->profile['marital']) {
            $profile['marital'] = array(t('Status:'), $a->profile['marital']);
        }
        if ($a->profile['with']) {
            $profile['marital']['with'] = bbcode($a->profile['with']);
        }
        if (strlen($a->profile['howlong']) && $a->profile['howlong'] !== NULL_DATE) {
            $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
        }
        if ($a->profile['sexual']) {
            $profile['sexual'] = array(t('Sexual Preference:'), $a->profile['sexual']);
        }
        if ($a->profile['homepage']) {
            $profile['homepage'] = array(t('Homepage:'), linkify($a->profile['homepage']));
        }
        if ($a->profile['hometown']) {
            $profile['hometown'] = array(t('Hometown:'), linkify($a->profile['hometown']));
        }
        if ($a->profile['keywords']) {
            $profile['keywords'] = array(t('Tags:'), $a->profile['keywords']);
        }
        if ($a->profile['politic']) {
            $profile['politic'] = array(t('Political Views:'), $a->profile['politic']);
        }
        if ($a->profile['religion']) {
            $profile['religion'] = array(t('Religion:'), $a->profile['religion']);
        }
        if ($txt = prepare_text($a->profile['about'])) {
            $profile['about'] = array(t('About:'), $txt);
        }
        if ($txt = prepare_text($a->profile['interest'])) {
            $profile['interest'] = array(t('Hobbies/Interests:'), $txt);
        }
        if ($txt = prepare_text($a->profile['likes'])) {
            $profile['likes'] = array(t('Likes:'), $txt);
        }
        if ($txt = prepare_text($a->profile['dislikes'])) {
            $profile['dislikes'] = array(t('Dislikes:'), $txt);
        }
        if ($txt = prepare_text($a->profile['contact'])) {
            $profile['contact'] = array(t('Contact information and Social Networks:'), $txt);
        }
        if ($txt = prepare_text($a->profile['channels'])) {
            $profile['channels'] = array(t('My other channels:'), $txt);
        }
        if ($txt = prepare_text($a->profile['music'])) {
            $profile['music'] = array(t('Musical interests:'), $txt);
        }
        if ($txt = prepare_text($a->profile['book'])) {
            $profile['book'] = array(t('Books, literature:'), $txt);
        }
        if ($txt = prepare_text($a->profile['tv'])) {
            $profile['tv'] = array(t('Television:'), $txt);
        }
        if ($txt = prepare_text($a->profile['film'])) {
            $profile['film'] = array(t('Film/dance/culture/entertainment:'), $txt);
        }
        if ($txt = prepare_text($a->profile['romance'])) {
            $profile['romance'] = array(t('Love/Romance:'), $txt);
        }
        if ($txt = prepare_text($a->profile['work'])) {
            $profile['work'] = array(t('Work/employment:'), $txt);
        }
        if ($txt = prepare_text($a->profile['education'])) {
            $profile['education'] = array(t('School/education:'), $txt);
        }
        if ($a->profile['extra_fields']) {
            foreach ($a->profile['extra_fields'] as $f) {
                $x = q("select * from profdef where field_name = '%s' limit 1", dbesc($f));
                if ($x && ($txt = prepare_text($a->profile[$f]))) {
                    $profile[$f] = array($x[0]['field_desc'] . ':', $txt);
                }
            }
            $profile['extra_fields'] = $a->profile['extra_fields'];
        }
        $things = get_things($a->profile['profile_guid'], $a->profile['profile_uid']);
        //		logger('mod_profile: things: ' . print_r($things,true), LOGGER_DATA);
        return replace_macros($tpl, array('$title' => t('Profile'), '$canlike' => $profile['canlike'] ? true : false, '$likethis' => t('Like this thing'), '$profile' => $profile, '$things' => $things));
    }
    return '';
}
Exemplo n.º 28
0
 /**
  * @description : function will generate profile block (used the profile template );
  * @return 		: Html presentation data ;
  */
 function PrintSearhResult($aProfileInfo, $aCoupleInfo = '', $aExtendedKey = null, $sTemplateName = '', $oCustomTemplate = null)
 {
     global $site;
     global $aPreValues;
     $iVisitorID = getLoggedId();
     $bExtMode = !empty($_GET['mode']) && $_GET['mode'] == 'extended' || !empty($_GET['search_result_mode']) && $_GET['search_result_mode'] == 'ext';
     $enable_zodiac = $bExtMode ? getParam('zodiac') : false;
     if ($bExtMode && count($this->aAllovedAvtionsOfVisitor) == 0) {
         //like init
         $aCheckGreet = checkAction($iVisitorID, ACTION_ID_SEND_VKISS);
         $this->aAllovedAvtionsOfVisitor['GREET'] = $aCheckGreet;
         $aCheckMess = checkAction($iVisitorID, ACTION_ID_SEND_MESSAGE);
         $this->aAllovedAvtionsOfVisitor['MESS'] = $aCheckMess;
     }
     $aOnline = array();
     if (isset($aProfileInfo['is_online'])) {
         $aOnline['is_online'] = $aProfileInfo['is_online'];
     }
     $sProfileThumb = get_member_thumbnail($aProfileInfo['ID'], 'none', !$bExtMode, 'visitor', $aOnline);
     // profile Nick/Age/Sex etc.
     $sAgeStr = $aProfileInfo['DateOfBirth'] != "0000-00-00" ? _t("_y/o", age($aProfileInfo['DateOfBirth'])) . ' ' : "";
     $sAgeOnly = $aProfileInfo['DateOfBirth'] != "0000-00-00" ? age($aProfileInfo['DateOfBirth']) : "";
     $y_o_sex = $sAgeStr;
     $city = _t("_City") . ": " . process_line_output($aProfileInfo['City']);
     $country = $aProfileInfo['Country'] ? _t("_Country") . ": " . _t($aPreValues['Country'][$aProfileInfo['Country']]['LKey']) . '&nbsp;<img src="' . ($site['flags'] . strtolower($aProfileInfo['Country'])) . '.gif" alt="flag" />' : '';
     // country flag
     $sFlag = $aProfileInfo['Country'] != '' ? '&nbsp;<img src="' . ($site['flags'] . strtolower($aProfileInfo['Country'])) . '.gif" alt="flag" />' : '';
     $sCityName = $aProfileInfo['City'] ? process_line_output($aProfileInfo['City']) . ', ' : null;
     if (!empty($aProfileInfo['Country'])) {
         $city_con = $sFlag . ' ' . $sCityName . _t($aPreValues['Country'][$aProfileInfo['Country']]['LKey']);
     } else {
         $city_con = '';
     }
     $id = _t("_ID") . ": " . $aProfileInfo['ID'];
     // description
     $i_am = $i_am2 = _t("_I am");
     $i_am_desc = trim(strip_tags($aProfileInfo['DescriptionMe']));
     if (mb_strlen($i_am_desc) > 130) {
         $i_am_desc = mb_substr($i_am_desc, 0, 130) . '...';
     }
     $you_are = $you_are2 = _t("_You are");
     $sCity = $aProfileInfo['City'];
     //--- Greeting start ---//
     if ($bExtMode && $aAllovedAvtionsOfVisitor['GREET'][CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED && $iVisitorID != $aProfileInfo['ID']) {
         $iKissIcon = getTemplateIcon('action_greet_small.gif');
         $sAiKiss = "<img alt=\"" . _t("_Greet") . "\" class=\"links_image\" name=i01{$aProfileInfo['ID']} src=\"" . $iKissIcon . "\" />";
         $al_kiss = '<a target=_blank href="greet.php?sendto=' . $aProfileInfo[ID] . '"';
         $al_kiss .= ">";
         $al_kiss = "<span class=\"links_span\">" . $sAiKiss . $al_kiss . _t("_Greet") . "</a></span>";
     } else {
         $al_kiss = '';
     }
     //--- Greeting end ---//
     //--- Contact start ---//
     if ($bExtMode && $aAllovedAvtionsOfVisitor['MESS'][CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED && $iVisitorID != $aProfileInfo['ID']) {
         $sSendMsgIcon = getTemplateIcon('action_send_small.gif');
         $ai_sendmsg = "<img alt=\"" . _t("_SEND_MESSAGE") . "\" name=i02{$aProfileInfo['ID']} src=\"{$sSendMsgIcon}\" class=\"links_image\" />";
         $al_sendmsg = "<a href=\"compose.php?ID={$aProfileInfo['ID']}\"";
         $al_sendmsg .= ">";
         $al_sendmsg = "<span class=\"links_span\">" . $ai_sendmsg . $al_sendmsg . _t("_Contact") . "</a></span>";
     } else {
         $al_sendmsg = '';
     }
     //--- Contact end ---//
     $more = '<a href="' . getProfileLink($aProfileInfo['ID']) . '" target="_blank">';
     $more .= '<img src="' . $site['icons'] . 'desc_more.gif" alt="' . _t('_more') . '" />';
     $more .= '</a>';
     $sProfile2ASc1 = $sProfile2ASc2 = $sProfile2Nick = $sProfile2AgeSex = $sProfile2CityCon = $sProfile2Desc = $sProfile2Match = '';
     if ($aCoupleInfo) {
         // profile Nick/Age/Sex etc.
         $sNickName2 = '<a href="' . getProfileLink($aCoupleInfo['ID']) . '">' . $aCoupleInfo['NickName'] . '</a>';
         $sAgeStr2 = $aCoupleInfo['DateOfBirth'] != "0000-00-00" ? _t("_y/o", age($aCoupleInfo['DateOfBirth'])) . ' ' : "";
         $sAgeOnly2 = $aCoupleInfo['DateOfBirth'] != "0000-00-00" ? age($aCoupleInfo['DateOfBirth']) : "";
         $y_o_sex2 = $sAgeStr2;
         // . _t("_".$aCoupleInfo['Sex']);
         $city2 = _t("_City") . ": " . process_line_output($aCoupleInfo['City']);
         $country2 = _t("_Country") . ": " . _t($aPreValues['Country'][$aCoupleInfo['Country']]['LKey']) . '&nbsp;<img src="' . ($site['flags'] . strtolower($aCoupleInfo['Country'])) . '.gif" alt="flag" />';
         $city_con2 = '&nbsp;&nbsp;' . $sFlag . ' ' . process_line_output($aCoupleInfo['City']) . ", " . _t($aPreValues['Country'][$aCoupleInfo['Country']]['LKey']);
         $city_con2 = preg_replace("/,\$/", '', trim($city_con2));
         $id2 = _t("_ID") . ": " . $aCoupleInfo['ID'];
         // description
         $i_am = $i_am2 = _t("_I am");
         $i_am_desc2 = trim(strip_tags($aCoupleInfo['DescriptionMe']));
         if (mb_strlen($i_am_desc2) > 130) {
             $i_am_desc2 = mb_substr($i_am_desc2, 0, 130) . '...';
         }
         $sCity2 = $aCoupleInfo['City'];
         $sProfile2ASc1 = 'float:left;width:31%;margin-right:10px;';
         $sProfile2ASc2 = 'float:left;width:31%;display:block;';
         $sProfile2Nick = $sNickName2;
         $sProfile2AgeSex = $y_o_sex2;
         $sProfile2CityCon = $city_con2;
         $sProfile2Desc = $i_am_desc2;
         $sProfile2Match = $bExtMode && isLogged() && $iVisitorID != $aCoupleInfo['ID'] && getParam('view_match_percent') ? $GLOBALS['oFunctions']->getProfileMatch($iVisitorID, $aCoupleInfo['ID']) : '';
     } else {
         $sProfile2ASc2 = 'display:none;';
     }
     // match progress bar
     $sProfileMatch = $bExtMode && isLogged() && $iVisitorID != $aProfileInfo['ID'] && getParam('view_match_percent') ? $GLOBALS['oFunctions']->getProfileMatch($iVisitorID, $aProfileInfo['ID']) : '';
     $sHeadline = null;
     if ($aProfileInfo['Headline']) {
         $sHeadline = mb_strlen($aProfileInfo['Headline']) > 30 ? mb_substr($aProfileInfo['Headline'], 0, 30) . '...' : $aProfileInfo['Headline'];
     }
     $sNickName = getNickName($aProfileInfo['ID']);
     $Link = getProfileLink($aProfileInfo['ID']);
     $sProfileNickname = $sHeadline ? "<a href='{$Link}'>" . $sNickName . '</a> :' : "<a href='{$Link}'>" . $sNickName . '</a>';
     $sSexIcon = $GLOBALS['oFunctions']->genSexIcon($aProfileInfo['Sex']);
     $sProfileZodiac = $enable_zodiac ? $GLOBALS['oFunctions']->getProfileZodiac($aProfileInfo['DateOfBirth']) : '';
     $aKeys = array('thumbnail' => $sProfileThumb, 'nick' => $sProfileNickname, 'head_line' => $sHeadline, 'age' => $y_o_sex, 'city_con' => $city_con, 'i_am_desc' => $i_am_desc, 'sex_image' => $sSexIcon, 'add_style_c1' => $sProfile2ASc1, 'add_style_c2' => $sProfile2ASc2, 'nick2' => $sProfile2Nick, 'age_sex2' => $sProfile2AgeSex, 'city_con2' => $sProfile2CityCon, 'i_am_desc2' => $sProfile2Desc, 'match2' => $sProfile2Match, 'row_title' => process_line_output($aProfileInfo['Headline']), 'thumbnail' => $sProfileThumb, 'match' => $sProfileMatch, 'sex_image' => $sSexIcon, 'age' => $y_o_sex, 'city' => $city, 'just_city' => $sCity, 'just_age' => $sAgeOnly, 'city_con' => $city_con, 'country' => $country, 'id' => $id, 'zodiac_sign' => $sProfileZodiac, 'i_am' => $i_am, 'i_am_desc' => $i_am_desc, 'you_are' => $you_are, 'ai_kiss' => empty($sAiKiss) ? '' : $sAiKiss, 'al_kiss' => $al_kiss, 'ai_sendmsg' => empty($ai_sendmsg) ? '' : $ai_sendmsg, 'al_sendmsg' => $al_sendmsg, 'more' => $more, 'images' => $site['images']);
     if ($aExtendedKey and is_array($aExtendedKey) and !empty($aExtendedKey)) {
         foreach ($aExtendedKey as $sKey => $sValue) {
             $aKeys[$sKey] = $sValue;
         }
     } else {
         $aKeys['ext_css_class'] = '';
     }
     return $oCustomTemplate ? $oCustomTemplate->parseHtmlByName($sTemplateName, $aKeys) : $GLOBALS['oSysTemplate']->parseHtmlByName($sTemplateName, $aKeys);
 }
Exemplo n.º 29
0
Arquivo: zot.php Projeto: 23n/hubzilla
function zotinfo($arr)
{
    $ret = array('success' => false);
    $zhash = x($arr, 'guid_hash') ? $arr['guid_hash'] : '';
    $zguid = x($arr, 'guid') ? $arr['guid'] : '';
    $zguid_sig = x($arr, 'guid_sig') ? $arr['guid_sig'] : '';
    $zaddr = x($arr, 'address') ? $arr['address'] : '';
    $ztarget = x($arr, 'target') ? $arr['target'] : '';
    $zsig = x($arr, 'target_sig') ? $arr['target_sig'] : '';
    $zkey = x($arr, 'key') ? $arr['key'] : '';
    $mindate = x($arr, 'mindate') ? $arr['mindate'] : '';
    $feed = x($arr, 'feed') ? intval($arr['feed']) : 0;
    if ($ztarget) {
        if (!$zkey || !$zsig || !rsa_verify($ztarget, base64url_decode($zsig), $zkey)) {
            logger('zfinger: invalid target signature');
            $ret['message'] = t("invalid target signature");
            return $ret;
        }
    }
    $r = null;
    if (strlen($zhash)) {
        $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash \n\t\t\twhere channel_hash = '%s' limit 1", dbesc($zhash));
    } elseif (strlen($zguid) && strlen($zguid_sig)) {
        $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash \n\t\t\twhere channel_guid = '%s' and channel_guid_sig = '%s' limit 1", dbesc($zguid), dbesc($zguid_sig));
    } elseif (strlen($zaddr)) {
        if (strpos($zaddr, '[system]') === false) {
            /* normal address lookup */
            $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash\n\t\t\t\twhere ( channel_address = '%s' or xchan_addr = '%s' ) limit 1", dbesc($zaddr), dbesc($zaddr));
        } else {
            /**
             * The special address '[system]' will return a system channel if one has been defined,
             * Or the first valid channel we find if there are no system channels. 
             *
             * This is used by magic-auth if we have no prior communications with this site - and
             * returns an identity on this site which we can use to create a valid hub record so that
             * we can exchange signed messages. The precise identity is irrelevant. It's the hub
             * information that we really need at the other end - and this will return it.
             *
             */
            $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash\n\t\t\t\twhere channel_system = 1 order by channel_id limit 1");
            if (!$r) {
                $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash\n\t\t\t\t\twhere channel_removed = 0 order by channel_id limit 1");
            }
        }
    } else {
        $ret['message'] = 'Invalid request';
        return $ret;
    }
    if (!$r) {
        $ret['message'] = 'Item not found.';
        return $ret;
    }
    $e = $r[0];
    $id = $e['channel_id'];
    $sys_channel = intval($e['channel_system']) ? true : false;
    $special_channel = $e['channel_pageflags'] & PAGE_PREMIUM ? true : false;
    $adult_channel = $e['channel_pageflags'] & PAGE_ADULT ? true : false;
    $censored = $e['channel_pageflags'] & PAGE_CENSORED ? true : false;
    $searchable = $e['channel_pageflags'] & PAGE_HIDDEN ? false : true;
    $deleted = intval($e['xchan_deleted']) ? true : false;
    if ($deleted || $censored || $sys_channel) {
        $searchable = false;
    }
    $public_forum = false;
    $role = get_pconfig($e['channel_id'], 'system', 'permissions_role');
    if ($role === 'forum' || $role === 'repository') {
        $public_forum = true;
    } else {
        // check if it has characteristics of a public forum based on custom permissions.
        $t = q("select abook_my_perms from abook where abook_channel = %d and abook_self = 1 limit 1", intval($e['channel_id']));
        if ($t && ($t[0]['abook_my_perms'] & PERMS_W_TAGWALL && !($t[0]['abook_my_perms'] & PERMS_W_STREAM))) {
            $public_forum = true;
        }
    }
    //  This is for birthdays and keywords, but must check access permissions
    $p = q("select * from profile where uid = %d and is_default = 1", intval($e['channel_id']));
    $profile = array();
    if ($p) {
        if (!intval($p[0]['publish'])) {
            $searchable = false;
        }
        $profile['description'] = $p[0]['pdesc'];
        $profile['birthday'] = $p[0]['dob'];
        if ($profile['birthday'] != '0000-00-00' && ($bd = z_birthday($p[0]['dob'], $e['channel_timezone'])) !== '') {
            $profile['next_birthday'] = $bd;
        }
        if ($age = age($p[0]['dob'], $e['channel_timezone'], '')) {
            $profile['age'] = $age;
        }
        $profile['gender'] = $p[0]['gender'];
        $profile['marital'] = $p[0]['marital'];
        $profile['sexual'] = $p[0]['sexual'];
        $profile['locale'] = $p[0]['locality'];
        $profile['region'] = $p[0]['region'];
        $profile['postcode'] = $p[0]['postal_code'];
        $profile['country'] = $p[0]['country_name'];
        $profile['about'] = $p[0]['about'];
        $profile['homepage'] = $p[0]['homepage'];
        $profile['hometown'] = $p[0]['hometown'];
        if ($p[0]['keywords']) {
            $tags = array();
            $k = explode(' ', $p[0]['keywords']);
            if ($k) {
                foreach ($k as $kk) {
                    if (trim($kk, " \t\n\r\v,")) {
                        $tags[] = trim($kk, " \t\n\r\v,");
                    }
                }
            }
            if ($tags) {
                $profile['keywords'] = $tags;
            }
        }
    }
    $ret['success'] = true;
    // Communication details
    $ret['guid'] = $e['xchan_guid'];
    $ret['guid_sig'] = $e['xchan_guid_sig'];
    $ret['key'] = $e['xchan_pubkey'];
    $ret['name'] = $e['xchan_name'];
    $ret['name_updated'] = $e['xchan_name_date'];
    $ret['address'] = $e['xchan_addr'];
    $ret['photo_mimetype'] = $e['xchan_photo_mimetype'];
    $ret['photo'] = $e['xchan_photo_l'];
    $ret['photo_updated'] = $e['xchan_photo_date'];
    $ret['url'] = $e['xchan_url'];
    $ret['connections_url'] = $e['xchan_connurl'] ? $e['xchan_connurl'] : z_root() . '/poco/' . $e['channel_address'];
    $ret['target'] = $ztarget;
    $ret['target_sig'] = $zsig;
    $ret['searchable'] = $searchable;
    $ret['adult_content'] = $adult_channel;
    $ret['public_forum'] = $public_forum;
    if ($deleted) {
        $ret['deleted'] = $deleted;
    }
    if (intval($e['channel_removed'])) {
        $ret['deleted_locally'] = true;
    }
    // premium or other channel desiring some contact with potential followers before connecting.
    // This is a template - %s will be replaced with the follow_url we discover for the return channel.
    if ($special_channel) {
        $ret['connect_url'] = z_root() . '/connect/' . $e['channel_address'];
    }
    // This is a template for our follow url, %s will be replaced with a webbie
    $ret['follow_url'] = z_root() . '/follow?f=&url=%s';
    $ztarget_hash = $ztarget && $zsig ? make_xchan_hash($ztarget, $zsig) : '';
    $permissions = get_all_perms($e['channel_id'], $ztarget_hash, false);
    if ($ztarget_hash) {
        $permissions['connected'] = false;
        $b = q("select * from abook where abook_xchan = '%s' and abook_channel = %d limit 1", dbesc($ztarget_hash), intval($e['channel_id']));
        if ($b) {
            $permissions['connected'] = true;
        }
    }
    $ret['permissions'] = $ztarget && $zkey ? crypto_encapsulate(json_encode($permissions), $zkey) : $permissions;
    if ($permissions['view_profile']) {
        $ret['profile'] = $profile;
    }
    // array of (verified) hubs this channel uses
    $x = zot_encode_locations($e);
    if ($x) {
        $ret['locations'] = $x;
    }
    $ret['site'] = array();
    $ret['site']['url'] = z_root();
    $ret['site']['url_sig'] = base64url_encode(rsa_sign(z_root(), $e['channel_prvkey']));
    $dirmode = get_config('system', 'directory_mode');
    if ($dirmode === false || $dirmode == DIRECTORY_MODE_NORMAL) {
        $ret['site']['directory_mode'] = 'normal';
    }
    if ($dirmode == DIRECTORY_MODE_PRIMARY) {
        $ret['site']['directory_mode'] = 'primary';
    } elseif ($dirmode == DIRECTORY_MODE_SECONDARY) {
        $ret['site']['directory_mode'] = 'secondary';
    } elseif ($dirmode == DIRECTORY_MODE_STANDALONE) {
        $ret['site']['directory_mode'] = 'standalone';
    }
    if ($dirmode != DIRECTORY_MODE_NORMAL) {
        $ret['site']['directory_url'] = z_root() . '/dirsearch';
    }
    // hide detailed site information if you're off the grid
    if ($dirmode != DIRECTORY_MODE_STANDALONE) {
        $register_policy = intval(get_config('system', 'register_policy'));
        if ($register_policy == REGISTER_CLOSED) {
            $ret['site']['register_policy'] = 'closed';
        }
        if ($register_policy == REGISTER_APPROVE) {
            $ret['site']['register_policy'] = 'approve';
        }
        if ($register_policy == REGISTER_OPEN) {
            $ret['site']['register_policy'] = 'open';
        }
        $access_policy = intval(get_config('system', 'access_policy'));
        if ($access_policy == ACCESS_PRIVATE) {
            $ret['site']['access_policy'] = 'private';
        }
        if ($access_policy == ACCESS_PAID) {
            $ret['site']['access_policy'] = 'paid';
        }
        if ($access_policy == ACCESS_FREE) {
            $ret['site']['access_policy'] = 'free';
        }
        if ($access_policy == ACCESS_TIERED) {
            $ret['site']['access_policy'] = 'tiered';
        }
        $ret['site']['accounts'] = account_total();
        require_once 'include/identity.php';
        $ret['site']['channels'] = channel_total();
        $ret['site']['version'] = PLATFORM_NAME . ' ' . RED_VERSION . '[' . DB_UPDATE_VERSION . ']';
        $ret['site']['admin'] = get_config('system', 'admin_email');
        $a = get_app();
        $visible_plugins = array();
        if (is_array($a->plugins) && count($a->plugins)) {
            $r = q("select * from addon where hidden = 0");
            if ($r) {
                foreach ($r as $rr) {
                    $visible_plugins[] = $rr['name'];
                }
            }
        }
        $ret['site']['plugins'] = $visible_plugins;
        $ret['site']['sitehash'] = get_config('system', 'location_hash');
        $ret['site']['sitename'] = get_config('system', 'sitename');
        $ret['site']['sellpage'] = get_config('system', 'sellpage');
        $ret['site']['location'] = get_config('system', 'site_location');
        $ret['site']['realm'] = get_directory_realm();
        $ret['site']['project'] = PLATFORM_NAME;
    }
    check_zotinfo($e, $x, $ret);
    call_hooks('zot_finger', $ret);
    return $ret;
}
Exemplo n.º 30
0
    }
}
if (isset($_POST['delete_tvdata'])) {
    $db = new db();
    $result = $db->query('videos', "DELETE FROM info WHERE id='{$_POST['id']}'");
    if (!$result) {
        echo 'DELETE DATA FAILED!';
    } else {
        ?>
<script>window.location='./?admin&vdata'</script><?php 
    }
}
if (isset($_POST['save_profile'])) {
    $db = new db();
    $result = $db->query('users', "UPDATE users SET name='{$_POST['name']}',birthdate='{$_POST['birthdate']}' WHERE username='******'username']}' AND password='******'password']}'");
    $_SESSION['age'] = age($_POST['birthdate']);
    $_SESSION['name'] = $_POST['name'];
    if (!$result) {
        echo 'Profile not updated!' . "DEBUG: UPDATE users SET name='{$_POST['name']}',birthdate='{$_POST['birthdate']}' WHERE username='******'username']}' AND password='******'password']}'<br>";
    }
    $result = null;
    flush();
    ob_flush();
    ?>
<script>window.location='./?profile'</script><?php 
}
if (isset($_GET['logout'])) {
    session_destroy();
    ?>
<script>window.location='./'</script><?php 
}