Exemplo n.º 1
0
function PageCompPageMainCodeWithForm()
{
    global $oTemplConfig, $site;
    $aForm = array('form_attrs' => array('id' => 'post_us_form', 'action' => BX_DOL_URL_ROOT . 'contact.php', 'method' => 'post'), 'params' => array('db' => array('submit_name' => 'do_submit')), 'inputs' => array('name' => array('type' => 'text', 'name' => 'name', 'caption' => _t('_Your name'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(1, 150), 'error' => _t('_Name is required'))), 'email' => array('type' => 'text', 'name' => 'email', 'caption' => _t('_Your email'), 'required' => true, 'checker' => array('func' => 'email', 'error' => _t('_Incorrect Email'))), 'message_subject' => array('type' => 'text', 'name' => 'subject', 'caption' => _t('_message_subject'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(5, 300), 'error' => _t('_ps_ferr_incorrect_length'))), 'message_text' => array('type' => 'textarea', 'name' => 'body', 'caption' => _t('_Message text'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(10, 5000), 'error' => _t('_ps_ferr_incorrect_length'))), 'captcha' => array('type' => 'captcha', 'caption' => _t('_Enter what you see'), 'name' => 'securityImageValue', 'required' => true, 'checker' => array('func' => 'captcha', 'error' => _t('_Incorrect Captcha'))), 'submit' => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit'))));
    $oForm = new BxTemplFormView($aForm);
    $sForm = $oForm->getCode();
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        $sSenderName = process_pass_data($_POST['name'], BX_TAGS_STRIP);
        $sSenderEmail = process_pass_data($_POST['email'], BX_TAGS_STRIP);
        $sLetterSubject = process_pass_data($_POST['subject'], BX_TAGS_STRIP);
        $sLetterBody = process_pass_data($_POST['body'], BX_TAGS_STRIP);
        $sLetterBody = $sLetterBody . "\r\n" . '============' . "\r\n" . _t('_from') . ' ' . $sSenderName . "\r\n" . 'with email ' . $sSenderEmail;
        if (sendMail($site['email'], $sLetterSubject, $sLetterBody)) {
            $sActionKey = '_ADM_PROFILE_SEND_MSG';
        } else {
            $sActionKey = '_Email sent failed';
        }
        $sActionText = MsgBox(_t($sActionKey));
        $sForm = $sActionText . $sForm;
    } else {
        $sForm = $oForm->getCode();
    }
    return DesignBoxContent(_t('_CONTACT_H1'), $sForm, $oTemplConfig->PageCompThird_db_num);
}
Exemplo n.º 2
0
function getPreValues($sKey, $aFields = array(), $iTagsFilter = BX_TAGS_NO_ACTION)
{
    $sKeyDb = process_db_input($sKey, $iTagsFilter);
    $sKey = process_pass_data($sKey);
    $sqlFields = "*";
    if (is_array($aFields) && !empty($aFields)) {
        foreach ($aFields as $sValue) {
            $sqlFields .= "`{$sValue}`, ";
        }
        $sqlFields = trim($sqlFields, ', ');
    }
    $sqlQuery = "SELECT {$sqlFields} FROM `" . BX_SYS_PRE_VALUES_TABLE . "`\n                WHERE `Key` = '{$sKeyDb}'\n                ORDER BY `Order` ASC";
    return $GLOBALS['MySQL']->getAllWithKey($sqlQuery, 'Value');
}
Exemplo n.º 3
0
/**
 * page code function
 */
function PageCompPageMainCode()
{
    $aForm = array('form_attrs' => array('id' => 'test_email_templates', 'action' => BX_DOL_URL_ROOT . '_ml.php', 'method' => 'post'), 'params' => array('db' => array('submit_name' => 'do_submit')), 'inputs' => array('l_new' => array('type' => 'textarea', 'name' => 'l_new', 'caption' => 'New Language'), 'l_old' => array('type' => 'textarea', 'name' => 'l_old', 'caption' => 'Old Language'), 'module_lang_file' => array('type' => 'checkbox', 'name' => 'module_lang_file', 'caption' => 'Module language file', 'value' => 1, 'checked' => true), 'submit' => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit'))));
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        $isModuleLangFile = $_POST['module_lang_file'] ? true : false;
        $aLang71 = getLangArray(process_pass_data($_POST['l_new']), $isModuleLangFile);
        $aLang70 = getLangArray(process_pass_data($_POST['l_old']), $isModuleLangFile);
        if (is_array($aLang71) && is_array($aLang70)) {
            $s .= prepareTextarea('Added Keys', findAddedKeys($aLang71, $aLang70));
            $s .= prepareTextarea('Changed Keys', findChangedKeys($aLang71, $aLang70));
            $aDeletedKeys = findDeletedKeys($aLang71, $aLang70);
            $s .= prepareTextarea('Deleted Keys', $aDeletedKeys);
            $s .= prepareTextareaWithDeltedKeys($aDeletedKeys);
        } else {
            $s = MsgBox("Invalid arrays") . $oForm->getCode();
        }
    } else {
        $s = $oForm->getCode();
    }
    return DesignBoxContent($GLOBALS['_page']['header'], $s, 11);
}
Exemplo n.º 4
0
 function saveItem($aData)
 {
     $this->genSaveItemHeader();
     $this->isHaveErrors = false;
     //echoDbg( $aData );
     $iItemID = (int) $aData['id'];
     $aItem = db_assoc_arr("SELECT * FROM `sys_profile_fields` WHERE `ID` = {$iItemID}");
     if (!$aItem) {
         $this->genSaveItemError(_t('_adm_fields_warning_field_not_found'));
         $this->genSaveItemFooter();
         return false;
     }
     // just a flag
     $bHaveErrors = false;
     // this array will be put into db
     $aUpdate = array();
     // check name
     if ($aItem['Type'] != 'system' and $aItem['Deletable']) {
         //we can change the name
         $sName = trim(strip_tags(process_pass_data($aData['Name'])));
         if ($sName === '') {
             $this->genSaveItemError(_t('_adm_fields_error_you_must_enter_name'), 'Name');
             $bHaveErrors = true;
         } elseif ($aItem['Type'] != 'block' and !preg_match('/^[a-z][a-z0-9_]*$/i', $sName)) {
             $this->genSaveItemError(_t('_adm_fields_error_name_latin'), 'Name');
             $bHaveErrors = true;
         } elseif ($GLOBALS['MySQL']->getOne("SELECT COUNT(*) FROM `sys_profile_fields` WHERE `Name`='" . $sName . "' AND `ID`<>'" . $iItemID . "'") || $sName != $aItem['Name'] && $GLOBALS['MySQL']->isFieldExists('Profiles', $sName)) {
             $this->genSaveItemError(_t('_adm_fields_error_name_already_exists'), 'Name');
             $bHaveErrors = true;
         } elseif ($sName == $aItem['Name']) {
             // all ok. don't change
         } else {
             $aUpdate['Name'] = $sName;
         }
         //change
     }
     $sNewName = isset($aUpdate['Name']) ? $aUpdate['Name'] : $aItem['Name'];
     $this->fieldCaption = "_FieldCaption_{$sNewName}_{$this->areaPageName}";
     // _FieldCaption_Sex_Join
     $this->fieldDesc = "_FieldDesc_{$sNewName}_{$this->areaPageName}";
     // _FieldDesc_Sex_Join
     // check Caption
     $sCaption = trim(process_pass_data($aData['Caption']));
     if ($sCaption === '') {
         $this->genSaveItemError(_t('_adm_fields_error_you_must_enter_caption'), 'Caption');
         $bHaveErrors = true;
     } elseif ($this->getLangString($this->fieldCaption) == $sCaption) {
         // all ok dont change
     } else {
         $this->updateLangString($this->fieldCaption, $sCaption);
     }
     // check Description
     $sDesc = trim(process_pass_data($aData['Desc']));
     if ($this->getLangString($this->fieldDesc) != $sDesc) {
         $this->updateLangString($this->fieldDesc, $sDesc);
     }
     // check type
     if ($aItem['Type'] != 'system' and $aItem['Type'] != 'block') {
         //we can change the type
         $sType = trim(strip_tags(process_pass_data($aData['Type'])));
         if (!isset($this->aTypes[$sType])) {
             $this->genSaveItemError(_t('_adm_fields_error_i_dont_know_this_type'), 'Type');
             $bHaveErrors = true;
         } elseif ($sType == $aItem['Type']) {
             // all ok. don't change
         } else {
             $aUpdate['Type'] = $sType;
         }
         //change
         // check the additional properties
         if (!$bHaveErrors) {
             // do not continue if have errors
             // check selectors controls
             if ($sType == 'select_one') {
                 if ($aData['Control_one'] == $aItem['Control']) {
                     //all ok
                 } elseif ($aData['Control_one'] == 'select' or $aData['Control_one'] == 'radio') {
                     $aUpdate['Control'] = $aData['Control_one'];
                 } else {
                     $this->genSaveItemError(_t('_adm_fields_error_i_dont_know_this_control_type'), 'Control_one');
                     $bHaveErrors = true;
                 }
             } elseif ($sType == 'select_set') {
                 if ($aData['Control_set'] == $aItem['Control']) {
                     //all ok
                 } elseif ($aData['Control_set'] == 'select' or $aData['Control_set'] == 'checkbox') {
                     $aUpdate['Control'] = $aData['Control_set'];
                 } else {
                     $this->genSaveItemError(_t('_adm_fields_error_i_dont_know_this_control_type'), 'Control_set');
                     $bHaveErrors = true;
                 }
             } else {
                 $aUpdate['Control'] = null;
             }
             //check Min
             $iMin = trim($aData['Min']);
             if ($iMin === '' || $sType == 'bool' || $sType == 'select_one' || $sType == 'select_set') {
                 $iMin = null;
             } else {
                 $iMin = (int) $iMin;
                 if (($sType == 'area' || $sType == 'html_area') && $iMin > 65534) {
                     $iMin = 65534;
                 } else {
                     if ($sType != 'area' && $sType != 'html_area' && $iMin > 254) {
                         $iMin = 254;
                     } else {
                         if ($iMin < 0) {
                             $iMin = 0;
                         }
                     }
                 }
             }
             $aUpdate['Min'] = $iMin;
             //check Max
             $iMax = trim($aData['Max']);
             if ($iMax === '' || $sType == 'bool' || $sType == 'select_one' || $sType == 'select_set') {
                 $iMax = null;
             } else {
                 $iMax = (int) $iMax;
                 if (($sType == 'area' || $sType == 'html_area') && $iMax > 65534) {
                     $iMax = 65534;
                 } else {
                     if ($sType != 'area' && $sType != 'html_area' && $iMax > 254) {
                         $iMax = 254;
                     } else {
                         if ($iMax < 0) {
                             $iMax = 0;
                         }
                     }
                 }
             }
             $aUpdate['Max'] = $iMax;
             // set min and max search age
             if ($sNewName == 'DateOfBirth') {
                 $this->setMinMaxAge($iMin ? $iMin : 18, $iMax ? $iMax : 75);
             }
             //check Check :)
             if ($sType == 'select_one' or $sType == 'select_set' or $sType == 'bool') {
                 $aUpdate['Check'] = '';
             } else {
                 $sCheck = trim(process_pass_data($aData['Check']));
                 if ($aItem['Check'] != $sCheck) {
                     $aUpdate['Check'] = $sCheck;
                 }
             }
             //Unique
             $aUpdate['Unique'] = (isset($aData['Unique']) and $aData['Unique'] == 'yes' and ($sType == 'text' or $sType == 'area' or $sType == 'html_area' or $sType == 'num')) ? 1 : 0;
             //Mandatory
             $aUpdate['Mandatory'] = (isset($aData['Mandatory']) and $aData['Mandatory'] == 'yes') ? 1 : 0;
             //check Values
             if ($sType == 'select_one' or $sType == 'select_set') {
                 $sValues = trim(strip_tags(process_pass_data($aData['Values'])));
                 $sValues = str_replace("\r", "\n", $sValues);
                 // for mac
                 $sValues = str_replace("\n\n", "\n", $sValues);
                 // for win
                 // for *nix ;)
                 if ($sValues === '') {
                     $this->genSaveItemError(_t('_adm_fields_error_you_must_enter_values'), 'Values');
                     $bHaveErrors = true;
                 } elseif ($sValues != $aItem['Values']) {
                     if (substr($sValues, 0, 2) == $this->sLinkPref and !$this->checkValuesLink(substr($sValues, 2))) {
                         $this->genSaveItemError(_t('_adm_fields_error_you_entered_incorrect_link'), 'Values');
                         $bHaveErrors = true;
                     } else {
                         $aUpdate['Values'] = $sValues;
                     }
                 }
                 // get LKey
                 $sUseLKey = trim(process_pass_data($aData['UseLKey']));
                 if (!$sUseLKey) {
                     $sUseLKey = 'LKey';
                 }
                 $aUpdate['UseLKey'] = $sUseLKey;
                 if (substr($sValues, 0, 2) != $this->sLinkPref) {
                     // if not a link
                     //Add Lang key for each value: _FieldValues_Example
                     $aValues2LF = explode("\n", $sValues);
                     foreach ($aValues2LF as $sValues2LF) {
                         $sLFKey = '_FieldValues_' . $sValues2LF;
                         $sLFValue = $sValues2LF;
                         //print "{$sLFKey}<br />";
                         if ($this->getLangString($sLFKey) != $sLFValue) {
                             $this->updateLangString($sLFKey, $sLFValue);
                         }
                     }
                 }
             } elseif ($aItem['Values'] != '') {
                 $aUpdate['Values'] = '';
             }
             if (!$bHaveErrors) {
                 //Default
                 switch ($sType) {
                     case 'text':
                         $aUpdate['Default'] = trim(process_pass_data($aData['Default']));
                         break;
                     case 'pass':
                     case 'area':
                     case 'html_area':
                     case 'select_set':
                         $aUpdate['Default'] = '';
                         break;
                     case 'num':
                         $aUpdate['Default'] = (int) $aData['Default'];
                         break;
                     case 'bool':
                         $aUpdate['Default'] = (int) (bool) $aData['Default'];
                         break;
                     case 'range':
                         if (trim($aData['Default']) == '') {
                             $aUpdate['Default'] = '';
                         } else {
                             list($sFirst, $sSecond) = explode('-', trim($aData['Default'], 2));
                             $sFirst = (int) trim($sFirst);
                             $sSecond = (int) trim($sSecond);
                             $aUpdate['Default'] = "{$sFirst}-{$sSecond}";
                         }
                         break;
                     case 'date':
                         if ($aData['Default'] === '') {
                             $aUpdate['Default'] = '';
                         } else {
                             $aUpdate['Default'] = date('Y-m-d', strtotime(trim(process_pass_data($aData['Default']))));
                         }
                         break;
                     case 'select_one':
                         $sDefault = trim(process_pass_data($aData['Default']));
                         if ($sDefault === '') {
                             $aUpdate['Default'] = '';
                         } else {
                             if ($this->checkSelectDefault($sValues, $sDefault)) {
                                 $aUpdate['Default'] = $sDefault;
                             } else {
                                 $this->genSaveItemError(_t('_adm_fields_error_you_entered_incorrect_value'), 'Default');
                                 $bHaveErrors = true;
                             }
                         }
                         break;
                 }
                 //matching. not implemented yet
             }
         }
     }
     if ($aItem['Type'] == 'block' and $this->iAreaID == 1) {
         //Join
         //get JoinPage
         $iJoinPage = (int) $aData['JoinPage'];
         if ($aItem['JoinPage'] != $iJoinPage) {
             $aUpdate['JoinPage'] = $iJoinPage;
         }
     }
     //system fields properties
     if ($aItem['Name'] == 'Keyword') {
         if (is_array($aData['KeywordFields'])) {
             $sKeywordFields = implode("\n", $aData['KeywordFields']);
             if (process_pass_data($sKeywordFields) != $aItem['Extra']) {
                 $aUpdate['Extra'] = $sKeywordFields;
             }
         }
     }
     if ($aItem['Name'] == 'Couple') {
         if (is_array($aData['CoupleFields'])) {
             $sKeywordFields = implode("\n", $aData['CoupleFields']);
             if (process_pass_data($sKeywordFields) != $aItem['Extra']) {
                 $aUpdate['Extra'] = $sKeywordFields;
             }
         }
     }
     // update error messages
     foreach (array('Mandatory', 'Min', 'Max', 'Unique', 'Check') as $sErrName) {
         $sErrMsg = trim(process_pass_data($aData[$sErrName . '_msg']));
         if (empty($sErrMsg)) {
             continue;
         }
         $sErrKey = "_FieldError_{$sNewName}_{$sErrName}";
         $this->updateLangString($sErrKey, $sErrMsg);
     }
     // add matching
     if (isset($aData['MatchField']) and (int) $aData['MatchField'] != $aItem['MatchField']) {
         $aUpdate['MatchField'] = (int) $aData['MatchField'];
     }
     if (isset($aData['MatchPercent']) and (int) $aData['MatchPercent'] != $aItem['MatchPercent']) {
         $aUpdate['MatchPercent'] = (int) $aData['MatchPercent'];
     }
     if (!empty($aUpdate) and !$bHaveErrors) {
         $this->doUpdateItem($aItem, $aUpdate);
         if (isset($aUpdate['Name'])) {
             $this->genSaveItemFormUpdate('updateItem', $iItemID, $aUpdate['Name']);
         }
         if ($aItem['Type'] == 'block' and $aUpdate['Name']) {
             $sQuery = "\n                    UPDATE `sys_page_compose` SET\n                        `Caption` = '_FieldCaption_" . addslashes($sNewName) . "_View'\n                    WHERE\n                        `Func` = 'PFBlock' AND\n                        `Content` = '{$iItemID}'\n                    ";
             db_res($sQuery);
         }
     }
     if (!$bHaveErrors) {
         $this->genSaveItemFormClose();
     }
     $this->genSaveItemFooter();
 }
Exemplo n.º 5
0
 function getBlockCode_Search()
 {
     global $logged;
     $aProfile = $logged['member'] ? getProfileInfo((int) $_COOKIE['memberID']) : array();
     // default params for search form
     $sCountry = '';
     $mixedCountry = bx_get('Country');
     if ($mixedCountry && is_array($mixedCountry)) {
         $sCountry = process_pass_data($mixedCountry[0], 1);
     } elseif ($mixedCountry && is_string($mixedCountry)) {
         $sCountry = process_pass_data($mixedCountry, 1);
     }
     $sSex = '';
     $mixedSex = bx_get('Sex');
     if ($mixedSex && is_array($mixedSex)) {
         $sSex = array();
         foreach ($mixedSex as $v) {
             $sSex[] = process_pass_data($v, 1);
         }
     } elseif ($mixedSex && is_string($mixedSex)) {
         $sSex = process_pass_data($mixedSex, 1);
     }
     $aDefaultParams = array('LookingFor' => bx_get('LookingFor') ? process_pass_data(bx_get('LookingFor'), 1) : ($aProfile['Sex'] ? $aProfile['Sex'] : 'male'), 'Sex' => $sSex ? $sSex : ($aProfile['LookingFor'] ? $aProfile['LookingFor'] : 'female'), 'Country' => $sCountry ? $sCountry : ($aProfile['Country'] ? $aProfile['Country'] : getParam('default_country')), 'DateOfBirth' => bx_get('DateOfBirth') ? process_pass_data(bx_get('DateOfBirth'), 1) : getParam('search_start_age') . '-' . getParam('search_end_age'), 'Tags' => bx_get('Tags') ? process_pass_data(bx_get('Tags'), 1) : '', 'online_only' => bx_get('online_only') ? process_pass_data(bx_get('online_only'), 1) : '', 'photos_only' => bx_get('photos_only') ? process_pass_data(bx_get('photos_only'), 1) : '');
     bx_import('BxDolProfileFields');
     $oPF = new BxDolProfileFields(9);
     $a = array('default_params' => $aDefaultParams, 'form_attrs' => array('action' => $this->oConfig->getBaseUri()), 'inputs' => array(array('type' => 'hidden', 'name' => 'r', 'value' => $this->oMain->_aModule['uri'])));
     $aVars = array('content' => $oPF->getFormCode($a));
     return $this->oTemplate->parseHtmlByName('search_form_wrapper', $aVars);
 }
Exemplo n.º 6
0
function PreviewMessage()
{
    $oEmailTemplate = new BxDolEmailTemplates();
    $aMessage = $oEmailTemplate->parseTemplate('t_AdminEmail', array('MessageText' => process_pass_data($_POST['body'])));
    return DesignBoxContent(_t('_Preview'), $aMessage['body'], 11);
}
        }
        if (!file_exists($checkout_filename)) {
            $status_text = 'Checkout file not found';
        } else {
            require_once $checkout_filename;
            $validate_res = moduleValidateConfiguration($status_text);
            if ($validate_res) {
                $status_text = 'Configuration is valid';
            }
        }
    }
} elseif ($_REQUEST['action'] == 'save_settings') {
    $res_setparam1 = setParam('currency_code', $_POST['currency_code']);
    $res_setparam3 = setParam('enable_recurring', $_POST['enable_recurring']);
    if ($res_setparam1 && $res_setparam3) {
        $currency_code = process_pass_data($_POST['currency_code']);
        $enable_recurring = $_POST['enable_recurring'] == 'on';
        $settings_status_text = 'Settings successfully saved';
    } else {
        $settings_status_text = 'Failed to save settings';
    }
}
TopCodeAdmin();
ContentBlockHead("Common settings");
if (strlen($settings_status_text)) {
    echo "\r\n<center>\r\n\t<div class=\"err\">{$settings_status_text}</div>\r\n</center>";
}
?>

<center>
<form id="settingsForm" action="<?php 
Exemplo n.º 8
0
 function collectRequestString($aGetParams, $sKeyPref = '', $sKeyPostf = '')
 {
     if (!is_array($aGetParams)) {
         return '';
     }
     $sRet = '';
     foreach ($aGetParams as $sKey => $sValue) {
         if ($sValue === '') {
             continue;
         }
         if (!is_array($sValue)) {
             $sRet .= '&' . urlencode($sKeyPref . $sKey . $sKeyPostf) . '=' . urlencode(process_pass_data($sValue));
         } else {
             $sRet .= $this->collectRequestString($sValue, "{$sKeyPref}{$sKey}{$sKeyPostf}[", "]");
             //recursive call
         }
     }
     return $sRet;
 }
Exemplo n.º 9
0
/**
 * Cange story
 */
function MemberEditStory()
{
    global $max_l;
    global $max_h;
    global $member;
    global $ADMIN;
    $story_id = (int) $_POST['edit_id'];
    $story_text = strlen($_POST['text']) > $max_l ? "LEFT ( '" . addslashes(clear_xss(process_pass_data($_POST['text']))) . "', {$max_l} )" : "'" . addslashes(clear_xss(process_pass_data($_POST['text']))) . "'";
    $story_header = strlen($_POST['header']) > $max_h ? "LEFT ( '" . process_db_input($_POST['header']) . "', {$max_h} )" : "'" . process_db_input($_POST['header']) . "'";
    $story_sender = $ADMIN ? (int) $_POST['sender'] : $member['ID'];
    $story_active_add = $ADMIN ? '' : ", `active`=''";
    //if admin logged, don't update status. if member - set inactive
    $sQuery = "UPDATE `Stories` SET `Date` = NOW(), `Header` = {$story_header}, `Text` = {$story_text} {$story_active_add} WHERE `ID` = {$story_id} AND `Sender` = {$story_sender}";
    $res = db_res($sQuery);
    return $res;
}
Exemplo n.º 10
0
 function getBlockCode_Results($iBlockID)
 {
     //collect inputs
     $aRequestParams = $this->oPF->collectSearchRequestParams();
     if (isset($_REQUEST['Tags']) and trim($_REQUEST['Tags'])) {
         $aRequestParams['Tags'] = trim(process_pass_data($_REQUEST['Tags']));
     }
     if (isset($_REQUEST['distance']) and (int) $_REQUEST['distance']) {
         $aRequestParams['distance'] = (int) $_REQUEST['distance'];
     }
     // start page generation
     $oProfile = new BxBaseProfileGenerator(getLoggedId());
     switch ($_REQUEST['show']) {
         case 'match':
             list($aDBTopMenu, $sResults) = $this->showMatchProfiles($iBlockID);
             break;
         case 'calendar':
             list($sResults, $aDBTopMenu, $sPagination, $sTopFilter) = $oProfile->GenProfilesCalendarBlock();
             break;
         default:
             $this->collectFilteredSettings();
             list($sResults, $aDBTopMenu, $sPagination, $sTopFilter) = $oProfile->GenSearchResultBlock($this->oPF->aBlocks, $aRequestParams, $this->aFilterSortSettings, 'search.php');
             break;
     }
     return array($sTopFilter . $sResults . $sPagination, $aDBTopMenu, array(), $this->getTitle());
 }
Exemplo n.º 11
0
/**
 * collect data from source
 */
function CollectCheckoutInfo($source)
{
    global $collectDataArr;
    global $collectDataInputs;
    if (!isset($source['checkout_action']) || strlen($source['data']) == 0) {
        return false;
    }
    $collectDataArr['checkout_action'] = process_pass_data($source['checkout_action']);
    $collectDataArr['amount'] = process_pass_data($source['amount']);
    $collectDataArr['data'] = process_pass_data($source['data']);
    if (isset($source['allow_subscribe'])) {
        $collectDataArr['allow_subscribe'] = process_pass_data($source['allow_subscribe']);
    }
    if (isset($source['subscribe_days'])) {
        $collectDataArr['subscribe_days'] = process_pass_data($source['subscribe_days']);
    }
    $collectDataArr['description'] = returnDescByAction($collectDataArr['checkout_action'], $collectDataArr['data'], true);
    if (strlen($collectDataArr['description']) == 0) {
        return false;
    }
    $collectDataInputs = '';
    $collectDataInputs .= "<input type=\"hidden\" name=\"checkout_action\" value=\"{$collectDataArr['checkout_action']}\" />\n";
    $collectDataInputs .= "<input type=\"hidden\" name=\"amount\" value=\"{$collectDataArr['amount']}\" />\n";
    $collectDataInputs .= "<input type=\"hidden\" name=\"data\" value=\"{$collectDataArr['data']}\" />\n";
    if (isset($source['allow_subscribe'])) {
        $collectDataInputs .= "<input type=\"hidden\" name=\"allow_subscribe\" value=\"{$collectDataArr['allow_subscribe']}\" />\n";
    }
    if (isset($source['subscribe_days'])) {
        $collectDataInputs .= "<input type=\"hidden\" name=\"subscribe_days\" value=\"{$collectDataArr['subscribe_days']}\" />\n";
    }
    return true;
}
Exemplo n.º 12
0
    {
        bx_import('BxTemplMenuQlinks2');
        $oMenu = new BxTemplMenuQlinks2();
        $sCodeBlock = $oMenu->getCode();
        return $sCodeBlock;
    }
}
//-------------------------------------------------------------------------------------------------------//
// --------------- page variables and login
$_page['name_index'] = 81;
$_page['css_name'] = array('member_panel.css', 'categories.css', 'alert.css');
$_page['extra_js'] = "<script type=\"text/javascript\">urlIconLoading = \"" . getTemplateIcon('loading.gif') . "\";\n\t\$(document).ready( function() {\n\t\t\n\t\tvar sSendUrl = '" . $site['url'] . "alerts.php';\n\t\t\n\t\t\$('input', '#alertsMenu').click(function(){\n\t\t\tvar sQuery = \$('input', '#alertsMenu').serialize();\n\t\t\t\$.post(sSendUrl, sQuery, function(data) {\n\t\t\t\t\$('#alertsView').html(data);\n\t\t\t}\n\t\t);\n\t\t\n\t} );})\n\t</script>";
$_page['header'] = _t("_My Account");
// --------------- GET/POST actions
$member['ID'] = process_pass_data(empty($_POST['ID']) ? '' : $_POST['ID']);
$member['Password'] = process_pass_data(empty($_POST['Password']) ? '' : $_POST['Password']);
$bAjxMode = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') ? true : false;
if (!(isset($_POST['ID']) && $_POST['ID'] && isset($_POST['Password']) && $_POST['Password']) && (!empty($_COOKIE['memberID']) && $_COOKIE['memberID'] && $_COOKIE['memberPassword'])) {
    if (!($logged['member'] = member_auth(0, false))) {
        login_form(_t("_LOGIN_OBSOLETE"), 0, $bAjxMode);
    }
} else {
    if (!isset($_POST['ID']) && !isset($_POST['Password'])) {
        // this is dynamic page -  send headers to not cache this page
        send_headers_page_changed();
        login_form('', 0, $bAjxMode);
    } else {
        require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php';
        $oZ = new BxDolAlerts('profile', 'before_login', 0, 0, array('login' => $member['ID'], 'password' => $member['Password'], 'ip' => getVisitorIP()));
        $oZ->alert();
        $member['ID'] = getID($member['ID']);
Exemplo n.º 13
0
 function actionBrowse($sParamName = '', $sParamValue = '', $sParamValue1 = '', $sParamValue2 = '', $sParamValue3 = '')
 {
     $bAlbumView = false;
     if ($sParamName == 'album' && $sParamValue1 == 'owner') {
         $bAlbumView = true;
         $aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileUri' => $sParamValue, 'owner' => getID($sParamValue2)), array('ID', 'Caption', 'Owner', 'AllowAlbumView', 'Description'));
         if (empty($aAlbumInfo)) {
             $this->_oTemplate->displayPageNotFound();
             exit;
         } else {
             if ($aAlbumInfo['Owner'] == $this->_iProfileId && $sParamValue2 === getUsername($this->_iProfileId)) {
                 $this->actionAlbumsViewMy('main_objects', $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3);
                 return;
             } elseif (!empty($aAlbumInfo['AllowAlbumView']) && !$this->oAlbumPrivacy->check('album_view', $aAlbumInfo['ID'], $this->_iProfileId)) {
                 $sKey = _t('_' . $this->_oConfig->getMainPrefix() . '_access_denied');
                 $sCode = DesignBoxContent($sKey, MsgBox($sKey), 1);
                 $this->aPageTmpl['header'] = $sKey;
                 $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode));
                 return;
             } else {
                 $GLOBALS['oTopMenu']->setCustomSubHeader($aAlbumInfo['Caption']);
             }
         }
     }
     if ('calendar' == $sParamName) {
         $sParamValue = (int) $sParamValue;
         $sParamValue1 = (int) $sParamValue1;
         $sParamValue2 = (int) $sParamValue2;
     }
     $sClassName = $this->_oConfig->getClassPrefix() . 'Search';
     bx_import('Search', $this->_aModule);
     $oSearch = new $sClassName($sParamName, $sParamValue, $sParamValue1, $sParamValue2);
     $sRss = bx_get('rss');
     if ($sRss !== false && $sRss) {
         $oSearch->aCurrent['paginate']['perPage'] = 10;
         header('Content-Type: text/xml; charset=UTF-8');
         echo $oSearch->rss();
         exit;
     }
     $sTopPostfix = isset($oSearch->aCurrent['restriction'][$sParamName]) || $oSearch->aCurrent['sorting'] == $sParamName ? $sParamName : 'all';
     $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_top_menu_' . $sTopPostfix);
     if (!empty($sParamValue) && isset($oSearch->aCurrent['restriction'][$sParamName])) {
         $sParamValue = $this->getBrowseParam($sParamName, $sParamValue);
         $oSearch->aCurrent['restriction'][$sParamName]['value'] = $sParamValue;
         $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_browse_by_' . $sParamName, htmlspecialchars_adv(process_pass_data($sParamValue)));
     }
     if ($bAlbumView) {
         $oSearch->aCurrent['restriction']['allow_view']['value'] = array($aAlbumInfo['AllowAlbumView']);
         $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_browse_by_' . $sParamName, $aAlbumInfo['Caption']);
         $this->_oTemplate->setPageDescription(substr(strip_tags($aAlbumInfo['Description']), 0, 255));
     } else {
         $oSearch->aCurrent['restriction']['not_allow_view']['value'] = array(BX_DOL_PG_HIDDEN);
     }
     if ($sParamName == 'calendar') {
         $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_caption_browse_by_day') . ': ' . getLocaleDate(strtotime("{$sParamValue}-{$sParamValue1}-{$sParamValue2}"), BX_DOL_LOCALE_DATE_SHORT);
     }
     $oSearch->aCurrent['paginate']['perPage'] = (int) $this->_oConfig->getGlParam('number_all');
     $sCode = $oSearch->displayResultBlock();
     $sPaginate = '';
     if ($oSearch->aCurrent['paginate']['totalNum'] > 0) {
         $aAdd = array($sParamName, $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3);
         foreach ($aAdd as $sValue) {
             if (strlen($sValue) > 0) {
                 $sArg .= '/' . $sValue;
             } else {
                 break;
             }
         }
         $sLink = $this->_oConfig->getBaseUri() . 'browse' . $sArg;
         $oPaginate = new BxDolPaginate(array('page_url' => $sLink . '&page={page}&per_page={per_page}', 'count' => $oSearch->aCurrent['paginate']['totalNum'], 'per_page' => $oSearch->aCurrent['paginate']['perPage'], 'page' => $oSearch->aCurrent['paginate']['page'], 'on_change_per_page' => 'return !loadDynamicBlock(1, \'' . $sLink . '&page=1&per_page=\' + this.value);'));
         $sPaginate = $oPaginate->getPaginate();
     } else {
         $sCode = MsgBox(_t('_Empty'));
     }
     $aMenu = array();
     $sCode = DesignBoxContent($sCaption, $sCode . $sPaginate, 1);
     if ($bAlbumView) {
         $sCode = $this->getAlbumPageView($aAlbumInfo, $sCode);
     }
     $this->aPageTmpl['css_name'] = array('browse.css');
     $this->aPageTmpl['header'] = $sCaption;
     $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode));
 }
Exemplo n.º 14
0
 function actionBrowse($sParamName = '', $sParamValue = '', $sParamValue1 = '', $sParamValue2 = '', $sParamValue3 = '')
 {
     $bAlbumView = false;
     if ($sParamName == 'album' && $sParamValue1 == 'owner') {
         $bAlbumView = true;
         $aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileUri' => $sParamValue, 'owner' => getID($sParamValue2)), array('ID', 'Caption', 'Owner', 'AllowAlbumView'));
         $GLOBALS['oTopMenu']->setCustomSubHeader($aAlbumInfo['Caption']);
         $GLOBALS['oTopMenu']->setCustomBreadcrumbs(array(_t('_' . $this->_oConfig->getMainPrefix()) => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'home/', $aAlbumInfo['Caption'] => ''));
         $sAlbumPreview = '';
         if ($this->_oConfig->getGlParam('album_slideshow_on') == 'on') {
             $sAlbumPreview = $this->_oTemplate->getAlbumPreview('rss/album/' . $sParamValue . '/owner/' . $sParamValue2);
             if (strlen($sAlbumPreview) > 0) {
                 $sAlbumPreview = DesignBoxContent($aAlbumInfo['Caption'], $sAlbumPreview, 1);
             }
         }
     }
     if (!empty($aAlbumInfo) && $aAlbumInfo['Owner'] == $this->_iProfileId && $sParamValue2 === getNickName($this->_iProfileId)) {
         $this->actionAlbumsViewMy('main_objects', $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3);
         return;
     }
     if ($bAlbumView && !empty($aAlbumInfo['AllowAlbumView']) && !$this->oAlbumPrivacy->check('album_view', $aAlbumInfo['ID'], $this->_iProfileId)) {
         $sKey = _t('_' . $this->_oConfig->getMainPrefix() . '_access_denied');
         $sCode = DesignBoxContent($sKey, MsgBox($sKey), 1);
         $this->aPageTmpl['header'] = $sKey;
         $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode));
         return;
     }
     $sClassName = $this->_oConfig->getClassPrefix() . 'Search';
     bx_import('Search', $this->_aModule);
     $oSearch = new $sClassName($sParamName, $sParamValue, $sParamValue1, $sParamValue2);
     $sRss = bx_get('rss');
     if ($sRss !== false && $sRss) {
         $oSearch->aCurrent['paginate']['perPage'] = 10;
         echo $oSearch->rss();
         exit;
     }
     $sTopPostfix = isset($oSearch->aCurrent['restriction'][$sParamName]) || $oSearch->aCurrent['sorting'] == $sParamName ? $sParamName : 'all';
     $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_top_menu_' . $sTopPostfix);
     if (mb_strlen($sParamValue) > 0 && isset($oSearch->aCurrent['restriction'][$sParamName])) {
         $sParamValue = $this->getBrowseParam($sParamName, $sParamValue);
         $oSearch->aCurrent['restriction'][$sParamName]['value'] = $sParamValue;
         $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_browse_by_' . $sParamName, process_pass_data($sParamValue));
     }
     if ($bAlbumView) {
         $oSearch->aCurrent['restriction']['allow_view']['value'] = array($aAlbumInfo['AllowAlbumView']);
         $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_browse_by_' . $sParamName, $aAlbumInfo['Caption']);
     }
     if ($sParamName == 'calendar') {
         $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_caption_browse_by_day') . ': ' . getLocaleDate(strtotime("{$sParamValue}-{$sParamValue1}-{$sParamValue2}"), BX_DOL_LOCALE_DATE_SHORT);
     }
     $oSearch->aCurrent['paginate']['perPage'] = (int) $this->_oConfig->getGlParam('number_all');
     $sCode = $oSearch->displayResultBlock();
     if ($oSearch->aCurrent['paginate']['totalNum'] > 0) {
         $sCode = $GLOBALS['oFunctions']->centerContent($sCode, '.sys_file_search_unit');
         $aAdd = array($sParamName, $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3);
         foreach ($aAdd as $sValue) {
             if (strlen($sValue) > 0) {
                 $sArg .= '/' . rawurlencode($sValue);
             } else {
                 break;
             }
         }
         $sLink = $this->_oConfig->getBaseUri() . 'browse' . $sArg;
         $oPaginate = new BxDolPaginate(array('page_url' => $sLink . '&page={page}&per_page={per_page}', 'count' => $oSearch->aCurrent['paginate']['totalNum'], 'per_page' => $oSearch->aCurrent['paginate']['perPage'], 'page' => $oSearch->aCurrent['paginate']['page'], 'per_page_changer' => true, 'page_reloader' => true, 'on_change_per_page' => 'document.location=\'' . BX_DOL_URL_ROOT . $sLink . '&page=1&per_page=\' + this.value;'));
         $sPaginate = $oPaginate->getPaginate();
     } else {
         $sCode = MsgBox(_t('_Empty'));
     }
     $aMenu = array();
     $sCode = DesignBoxContent($sCaption, $sCode . $sPaginate, 1, $this->_oTemplate->getExtraTopMenu($aMenu, BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri()));
     $this->aPageTmpl['css_name'] = array('browse.css');
     $this->aPageTmpl['header'] = $sCaption;
     $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode . $sAlbumPreview));
 }
Exemplo n.º 15
0
/**	
 * Validate if transaction real and successful
 * 
 * @param array $dataArr				- array with data to validate
 * @param string &$errorMessage			- error message when return result is not 1
 * 
 * @return int 							- validation result
 * 										  possible variants:
 * 											-1 - fraud attempt
 * 											 0 - transaction was declined
 * 											 1 - transaction was approved
 * 											 2 - inner error
 * 
 * 
 */
function moduleValidateTransaction(&$dataArr, &$errorMessage)
{
    global $providerConf;
    $maxReadSize = 8192;
    if ($providerConf['Param_process_type'] == 'Direct' || $providerConf['Param_process_type'] == 'IPN') {
        if ($dataArr['payment_status'] != 'Completed') {
            $errorMessage = 'Payment is not completed';
            return 0;
        }
        if ($providerConf['Mode'] != 'live') {
            $businessValue = $providerConf['Param_test_business'];
        } else {
            $businessValue = $providerConf['Param_business'];
        }
        if ($dataArr['business'] != $businessValue) {
            $errorMessage = 'Wrong receiver email';
            return -1;
        }
        if ($providerConf['Debug']) {
            writeDebugLog('Direct/IPN validation for transaction', $dataArr, false);
        }
        $req = 'cmd=_notify-validate';
        foreach ($dataArr as $key => $value) {
            $req .= '&' . urlencode($key) . '=' . urlencode(process_pass_data($value));
        }
        // post back to PayPal system to validate
        $header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
        $header .= "Host: www.paypal.com\r\n";
        $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
        $header .= "Content-Length: " . strlen($req) . "\r\n";
        $header .= "Connection: close\r\n\r\n";
        // open socket
        if ($providerConf['Mode'] != 'live') {
            $connectURL = 'www.sandbox.paypal.com';
        } else {
            $connectURL = 'www.paypal.com';
        }
        if ($providerConf['Param_connection_type'] == 'SSL') {
            $fp = fsockopen("ssl://{$connectURL}", 443, $errno, $errstr, 60);
        } else {
            $fp = fsockopen("tcp://{$connectURL}", 80, $errno, $errstr, 60);
        }
        if (!$fp) {
            $errorMessage = "Can't connect to remote host for validation ({$errstr})";
            return 2;
        }
        // send data
        fputs($fp, $header . $req);
        // read the body data
        $response = fread($fp, $maxReadSize);
        $responseArr = explode("\r\n\r\n", $response);
        $responseHeader = $responseArr[0];
        $res = $responseArr[1];
        // parse the data
        $lines = explode("\n", $res);
        array_walk($lines, create_function('&$arg', "\$arg = trim(\$arg);"));
        if ($providerConf['Debug']) {
            writeDebugLog('Direct/IPN reply lines', $lines, false);
        }
        if (strcmp($lines[0], "INVALID") == 0) {
            $errorMessage = 'Transaction verification failed';
            fclose($fp);
            return -1;
        } elseif (strcmp($lines[0], "VERIFIED") != 0) {
            $errorMessage = 'No verification status received';
            fclose($fp);
            return 2;
        }
        $paymentAmount = getPaymentAmount($dataArr);
        if (!commonValidateTransaction($dataArr['item_number'], $paymentAmount, $errorMessage)) {
            return -1;
        }
        if (!customCheck($dataArr, $errorMessage)) {
            return -1;
        }
        fclose($fp);
        return 1;
    } elseif ($providerConf['Param_process_type'] == 'PDT') {
        if ($providerConf['Debug']) {
            writeDebugLog('PDT validation for transaction', $dataArr, false);
        }
        $req = 'cmd=_notify-synch';
        $req .= "&tx={$dataArr['tx']}&at={$providerConf['Param_auth_token']}";
        // post back to PayPal system to validate
        $header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
        $header .= "Host: www.paypal.com\r\n";
        $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
        $header .= "Content-Length: " . strlen($req) . "\r\n";
        $header .= "Connection: close\r\n\r\n";
        // open socket
        if ($providerConf['Mode'] != 'live') {
            $connectURL = 'www.sandbox.paypal.com';
        } else {
            $connectURL = 'www.paypal.com';
        }
        if ($providerConf['Param_connection_type'] == 'SSL') {
            $fp = fsockopen("ssl://{$connectURL}", 443, $errno, $errstr, 60);
        } else {
            $fp = fsockopen("tcp://{$connectURL}", 80, $errno, $errstr, 60);
        }
        if (!$fp) {
            $errorMessage = "Can't connect to remote host for validation ({$errstr})";
            return 2;
        }
        // send data
        fputs($fp, $header . $req);
        // read the body data
        $res = '';
        $headerdone = false;
        while (!feof($fp)) {
            $line = fgets($fp, 1024);
            if (strcmp($line, "\r\n") == 0) {
                // read the header
                $headerdone = true;
            } elseif ($headerdone) {
                // header has been read. now read the contents
                $res .= $line;
            }
        }
        // parse the data
        $lines = explode("\n", $res);
        if ($providerConf['Debug']) {
            writeDebugLog('PDT reply lines', $lines, false);
        }
        if (strcmp($lines[0], "FAIL") == 0) {
            $errorMessage = 'Transaction verification failed';
            fclose($fp);
            return -1;
        } elseif (strcmp($lines[0], "SUCCESS") != 0) {
            $errorMessage = 'No verification status received';
            fclose($fp);
            return 2;
        }
        fclose($fp);
        for ($i = 1; $i < count($lines); $i++) {
            list($key, $val) = explode("=", $lines[$i]);
            $keyarray[urldecode($key)] = urldecode($val);
        }
        $dataArr['item_name'] = $keyarray['item_name'];
        $dataArr['item_number'] = $keyarray['item_number'];
        $dataArr['payment_status'] = $keyarray['payment_status'];
        $dataArr['custom'] = $keyarray['custom'];
        $dataArr['memo'] = $keyarray['memo'];
        $dataArr['business'] = $keyarray['business'];
        $dataArr['payment_gross'] = $keyarray['payment_gross'];
        $dataArr['mc_gross'] = $keyarray['mc_gross'];
        $dataArr['mc_currency'] = $keyarray['mc_currency'];
        $dataArr['settle_amount'] = $keyarray['settle_amount'];
        $dataArr['settle_currency'] = $keyarray['settle_currency'];
        $dataArr['exchange_rate'] = $keyarray['exchange_rate'];
        $dataArr['payer_email'] = $keyarray['payer_email'];
        $dataArr['txn_id'] = $keyarray['txn_id'];
        if ($dataArr['payment_status'] != 'Completed') {
            $errorMessage = 'Payment is not completed';
            return 0;
        }
        if ($providerConf['Mode'] != 'live') {
            $businessValue = $providerConf['Param_test_business'];
        } else {
            $businessValue = $providerConf['Param_business'];
        }
        if ($dataArr['business'] != $businessValue) {
            $errorMessage = 'Wrong receiver email';
            return -1;
        }
        $paymentAmount = getPaymentAmount($dataArr);
        if (!commonValidateTransaction($dataArr['item_number'], $paymentAmount, $errorMessage)) {
            return -1;
        }
        if (!customCheck($dataArr, $errorMessage)) {
            return -1;
        }
        return 1;
    }
    return 2;
}
Exemplo n.º 16
0
function member_auth($member = 0, $error_handle = true, $bAjx = false)
{
    global $site;
    switch ($member) {
        case 0:
            $mem = 'member';
            $login_page = BX_DOL_URL_ROOT . "member.php";
            $iRole = BX_DOL_ROLE_MEMBER;
            break;
        case 1:
            $mem = 'admin';
            $login_page = BX_DOL_URL_ADMIN . "index.php";
            $iRole = BX_DOL_ROLE_ADMIN;
            break;
    }
    if (empty($_COOKIE['memberID']) || !isset($_COOKIE['memberPassword'])) {
        if ($error_handle) {
            $text = _t("_LOGIN_REQUIRED_AE1");
            if ($member == 0) {
                $text .= "<br />" . _t("_LOGIN_REQUIRED_AE2", $site['images'], BX_DOL_URL_ROOT, $site['title']);
            }
            $bAjxMode = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') ? true : false;
            if ($member = 1 && $bAjx == true) {
                $bAjxMode = true;
            }
            login_form($text, $member, $bAjxMode);
        }
        return false;
    }
    return check_login(process_pass_data($_COOKIE['memberID']), process_pass_data($_COOKIE['memberPassword']), $iRole, $error_handle);
}
Exemplo n.º 17
0
<?php

/**
 * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
 * CC-BY License - http://creativecommons.org/licenses/by/3.0/
 */
require_once './inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'admin.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'db.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolPageView.php';
check_logged();
$_page['name_index'] = 81;
$sPageName = process_pass_data($_GET['ID']);
$oIPV = new BxDolPageView($sPageName);
if ($oIPV->isLoaded()) {
    $sPageTitle = htmlspecialchars($oIPV->getPageTitle());
    $_page['header'] = $sPageTitle;
    $_page['header_text'] = $sPageTitle;
    $_ni = $_page['name_index'];
    $_page_cont[$_ni]['page_main_code'] = $oIPV->getCode();
    PageCode();
} else {
    $oSysTemplate->displayPageNotFound();
}
 function saveItem($aData)
 {
     $iID = (int) $aData['id'];
     $sQuery = "SELECT `Func` FROM `{$this->sDBTable}` WHERE `ID` = {$iID}";
     $sFunc = db_value($sQuery);
     if (!$sFunc) {
         return;
     }
     $sCaption = process_db_input($aData['Caption']);
     $sVisible = implode(',', $aData['Visible']);
     if ($sFunc == 'RSS') {
         $sContentUpd = "`Content` = '" . process_db_input($aData['Url']) . '#' . (int) $aData['Num'] . "',";
     } elseif ($sFunc == 'Echo') {
         $sContentUpd = "`Content` = '" . process_db_input($aData['Content']) . "',";
     } else {
         $sContentUpd = '';
     }
     $sQuery = "\r\n\t\t\tUPDATE `{$this->sDBTable}` SET\r\n\t\t\t\t`Caption` = '{$sCaption}',\r\n\t\t\t\t{$sContentUpd}\r\n\t\t\t\t`Visible` = '{$sVisible}'\r\n\t\t\tWHERE `ID` = {$iID}\r\n\t\t";
     db_res($sQuery);
     echo _t(process_pass_data($aData['Caption']));
 }
Exemplo n.º 19
0
 function _addThumbToForm($sThumbHTML, &$aParam)
 {
     $aParam['thumbnail'] = process_pass_data($sThumbHTML);
     $aParam['thumbnail_html'] = process_pass_data($sThumbHTML);
 }
Exemplo n.º 20
0
function PageCompPageMainCode()
{
    global $iAmInPopup;
    global $aFields;
    $sPopupAdd = $iAmInPopup ? '&popup=1' : '';
    $sResultMsg = '';
    if (isset($_POST['action']) and $_POST['action'] == 'Save' and isset($_POST['PreList']) and is_array($_POST['PreList'])) {
        if (true === saveList($_POST['list'], $_POST['PreList'])) {
            $sResultMsg = _t('_Success');
        } else {
            $sResultMsg = _t('_Failed to apply changes');
        }
    }
    //get lists
    $aLists = array();
    $aKeys = getPreKeys();
    foreach ($aKeys as $aList) {
        $aLists[$aList['Key']] = $aList['Key'];
    }
    $sListIn = bx_get('list');
    if ($sListIn !== false) {
        $sList_db = process_db_input($sListIn);
        $sList = process_pass_data($sListIn);
        $iCount = getPreValuesCount($sListIn);
        if (!$iCount) {
            //if no rows returned...
            $aLists[$sList] = $sList;
        }
        //create new list
    } else {
        $sList = '';
    }
    ob_start();
    if ($sResultMsg) {
        echo MsgBox($sResultMsg);
    }
    ?>
    <script type="text/javascript">
        function createNewList()
        {
            var sNewList = prompt( '<?php 
    echo bx_js_string(_t('_adm_pvalues_msg_enter_list_name'));
    ?>
' );

            if( sNewList == null )
                return false;

            sNewList = $.trim( sNewList );

            if( !sNewList.length ) {
                alert( '<?php 
    echo bx_js_string(_t('_adm_pvalues_msg_enter_correct_name'));
    ?>
' );
                return false;
            }

            window.location = '<?php 
    echo $GLOBALS['site']['url_admin'] . 'preValues.php';
    ?>
?list=' + encodeURIComponent( sNewList ) + '<?php 
    echo $sPopupAdd;
    ?>
';
        }

        function addRow( eImg )
        {
            $( eImg ).parent().parent().before(
                '<tr>' +
                <?php 
    foreach ($aFields as $sField => $sHelp) {
        ?>
                    '<td><input type="text" class="value_input" name="PreList[' + iNextInd + '][<?php 
        echo $sField;
        ?>
]" value="" /></td>' +
                    <?php 
    }
    ?>
                    '<th class="row_controls">' +
                    	'<a class="row_control bx-def-margin-thd-left-auto" href="javascript:void(0)" onclick="javascript:delRow(this);" title="<?php 
    echo bx_html_attribute(_t('_Delete'));
    ?>
"><i class="sys-icon times"></i></a>' +
                		'<a class="row_control bx-def-margin-thd-left-auto" href="javascript:void(0)" onclick="javascript:moveUpRow(this);" title="<?php 
    echo bx_html_attribute(_t('_adm_pvalues_txt_move_up'));
    ?>
"><i class="sys-icon arrow-up"></i></a>' +
                		'<a class="row_control bx-def-margin-thd-left-auto" href="javascript:void(0)" onclick="javascript:moveDownRow(this);" title="<?php 
    echo bx_html_attribute(_t('_adm_pvalues_txt_move_down'));
    ?>
"><i class="sys-icon arrow-down"></i></a>' +
                    '</th>' +
                '</tr>'
            );

            iNextInd ++;

            sortZebra();
        }

        function delRow( eImg )
        {
            $( eImg ).parent().parent().remove();
            sortZebra();
        }

        function moveUpRow( eImg )
        {
            var oCur = $( eImg ).parent().parent();
            var oPrev = oCur.prev( ':not(.headers)' );
            if( !oPrev.length )
                return;

            // swap elements values
            var oCurElems  = $('input', oCur.get(0));
            var oPrevElems = $('input', oPrev.get(0));

            oCurElems.each( function(iInd) {
                var oCurElem  = $( this );
                var oPrevElem = oPrevElems.filter( ':eq(' + iInd + ')' );

                // swap them
                var sCurValue = oCurElem.val();
                oCurElem.val( oPrevElem.val() );
                oPrevElem.val( sCurValue );
            } );
        }

        function moveDownRow( eImg )
        {
            var oCur = $( eImg ).parent().parent();
            var oPrev = oCur.next( ':not(.headers)' );
            if( !oPrev.length )
                return;

            // swap elements values
            var oCurElems  = $('input', oCur.get(0));
            var oPrevElems = $('input', oPrev.get(0));

            oCurElems.each( function(iInd) {
                var oCurElem  = $( this );
                var oPrevElem = oPrevElems.filter( ':eq(' + iInd + ')' );

                // swap them
                var sCurValue = oCurElem.val();
                oCurElem.val( oPrevElem.val() );
                oPrevElem.val( sCurValue );
            } );
        }

        function sortZebra()
        {
            $( '#listEdit tr:even' ).removeClass( 'even odd' ).addClass( 'even' );
            $( '#listEdit tr:odd'  ).removeClass( 'even odd' ).addClass( 'odd'  );
        }

        //just a design
        $( document ).ready( sortZebra );
    </script>

    <form action="<?php 
    echo $GLOBALS['site']['url_admin'] . 'preValues.php';
    ?>
" method="post" enctype="multipart/form-data">
    	<div class="adm-pv-cp-selector bx-def-margin-bottom">
			<div class="adm-pv-cp-item">
				<span><?php 
    echo _t('_adm_pvalues_txt_select_list');
    ?>
:</span>
				<div class="input_wrapper input_wrapper_select bx-def-margin-sec-leftright clearfix">
					<select class="form_input_select bx-def-font-inputs" name="list" onchange="if( this.value != '' ) window.location = '<?php 
    echo $GLOBALS['site']['url_admin'] . 'preValues.php';
    ?>
' + '?list=' + encodeURIComponent( this.value ) + '<?php 
    echo $sPopupAdd;
    ?>
';"><?php 
    echo genListOptions($aLists, $sList);
    ?>
</select>
				</div>
			</div>
			<div class="input_wrapper input_wrapper_submit clearfix">
				<input  class="form_input_submit bx-btn" type="button" value="<?php 
    echo bx_html_attribute(_t('_adm_pvalues_txt_create_new'));
    ?>
" onclick="createNewList();" />
			</div>
		</div>
        <table class="bx-def-table" id="listEdit" cellpadding="0" cellspacing="1"><?php 
    $iNextInd = $sList !== '' ? genListRows($sList_db) : 0;
    ?>
</table>
		<div class="adm-pv-submit bx-def-margin-top">
			<input type="hidden" name="popup" value="<?php 
    echo $iAmInPopup;
    ?>
" />
			<input type="hidden" name="action" value="Save" />
			<div class="input_wrapper input_wrapper_submit clearfix">
				<input class="form_input_submit bx-btn" type="submit" name="submit" value="<?php 
    echo bx_html_attribute(_t('_Save'));
    ?>
" />
			</div>
		</div>
        <script type="text/javascript">
            iNextInd = <?php 
    echo $iNextInd;
    ?>
;
        </script>
    </form>
    <?php 
    return $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => ob_get_clean()));
}
    function showPagination($iTotalPages, $iCurPage, $iPerPage = 10, $bAdmin = false)
    {
        $sMainUrl = '';
        $iTotalPages = (int) $iTotalPages;
        $iCurPage = (int) $iCurPage;
        $iPerPage = (int) $iPerPage;
        $bLinkMode = $this->isPermalinkEnabled() ? true : false;
        $bLinkMode = $bAdmin ? false : $bLinkMode;
        if ($iTotalPages > 1) {
            if ($bLinkMode) {
                $sMainUrl = $this->sType . '/all';
                $aFields = array('ownerName', 'tag', 'rate');
                foreach ($aFields as $field) {
                    if (isset($_GET[$field])) {
                        $sParam = htmlentities(process_pass_data($_GET[$field]));
                        switch ($field) {
                            case 'ownerName':
                                $sMainUrl = $this->sType . '/gallery/all/' . $sParam;
                                break;
                            case 'tag':
                                $sMainUrl = $this->sType . '/gallery_tag/' . $sParam;
                                break;
                            case 'rate':
                                $sMainUrl = $this->sType . '/gallery_top';
                                break;
                        }
                    }
                }
                $sMainUrl = $GLOBALS['site']['url'] . $sMainUrl;
                $sReloc = "'{$sMainUrl}/' + this.value + '/{$iCurPage}'";
                $sLinkTempl = $sMainUrl . "/{$iPerPage}/{page}";
            } else {
                $sRequest = $_SERVER['PHP_SELF'] . '?';
                $aFields = array('userID', 'tag', 'rate');
                if ($bAdmin) {
                    $aFields[] = 'type';
                }
                foreach ($aFields as $field) {
                    if (isset($_GET[$field])) {
                        $sRequest .= "&amp;{$field}=" . htmlentities(process_pass_data($_GET[$field]));
                    }
                }
                $sReloc = "'{$sRequest}&amp;page={$iCurPage}&amp;per_page=' + this.value";
                $sLinkTempl = $sRequest . "&amp;page={page}&amp;per_page={$iPerPage}";
            }
            $sPagination = '<div style="text-align: center; position: relative; margin: 10px 0px;">' . _t("_Results per page") . ':
					<select name="per_page" onchange="window.location=' . $sReloc . ';">
						<option value="10"' . ($iPerPage == 10 ? ' selected="selected"' : '') . '>10</option>
						<option value="20"' . ($iPerPage == 20 ? ' selected="selected"' : '') . '>20</option>
						<option value="50"' . ($iPerPage == 50 ? ' selected="selected"' : '') . '>50</option>
						<option value="100"' . ($iPerPage == 100 ? ' selected="selected"' : '') . '>100</option>
					</select></div>';
            $sPagination .= genPagination($iTotalPages, $iCurPage, $sLinkTempl);
        } else {
            return '';
        }
        return $sPagination;
    }
Exemplo n.º 22
0
function AddRecord()
{
    global $record_maxlength;
    global $period;
    global $record_limit;
    global $logged;
    $ret = "";
    $record_text = addslashes(clear_xss(process_pass_data($_POST['newrecord'])));
    $record_sender = strlen($_COOKIE['memberID']) ? (int) $_COOKIE['memberID'] : "";
    $record_recipient = (int) $_REQUEST['owner'];
    $ip = getenv('HTTP_CLIENT_IP') ? getenv('HTTP_CLIENT_IP') : getenv('REMOTE_ADDR');
    if (!$record_recipient) {
        return $ret;
    }
    // Test if IP is defined
    if (!$ip) {
        $ret .= "<br />\r\n\t\t\t<table width=\"100%\" cellpadding=\"1\" cellspacing=\"1\" border=\"0\">\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=\"text\" align=\"center\">\r\n\t\t\t\t\t\t<br />" . _t_err("_sorry, i can not define you ip adress. IT'S TIME TO COME OUT !") . "<br />\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table>\n";
        return $ret;
    }
    // Test if last message is old enough
    $last_count = db_arr("SELECT COUNT( * ) AS `last_count` FROM `Guestbook` WHERE `IP` = '{$ip}' AND (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`Date`) < {$period}*60)");
    if ($last_count['last_count'] != 0) {
        $ret .= "<br />\r\n\t\t\t<table width=\"100%\" cellpadding=\"1\" cellspacing=\"1\" border=\"0\">\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=\"text\" align=\"center\">\r\n\t\t\t\t\t\t<br />" . _t_err("_You have to wait for PERIOD minutes before you can write another message!", $period) . "<br />\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table>\n";
        return $ret;
    }
    // Restrict with total records count
    $total_count = db_arr("SELECT COUNT(*) AS `total_count` FROM `Guestbook` WHERE `Recipient` = '{$record_recipient}'");
    if ($total_count['total_count'] - 1 > $record_limit) {
        $del_res = db_res("SELECT `ID` FROM `Guestbook` WHERE `Recipient` = '{$record_recipient}' ORDER BY `Date` ASC LIMIT " . ($total_count['total_count'] - $record_limit + 1));
        while ($del_arr = mysql_fetch_array($del_res)) {
            db_res("DELETE FROM `Guestbook` WHERE `ID` = {$del_arr['ID']}");
        }
    }
    // Perform insertion
    db_res("INSERT INTO `Guestbook` SET `Date` = NOW(), `IP` = '{$ip}', `Sender` = '{$record_sender}', `Recipient` = '{$record_recipient}', `Text` = '{$record_text}', `New` = '1'");
    return $ret;
}
Exemplo n.º 23
0
 function actionShare($sFileUri)
 {
     $sLangPref = '_' . $this->_oConfig->getMainPrefix() . '_';
     $sFileUrl = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $sFileUri;
     $aForm = $this->getSubmitForm($sFileUri, 'share');
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         if ($this->sendFileInfo($_POST['email'], nl2br(process_pass_data($_POST['messageText'])), $sFileUrl, $_POST['mediaAction'])) {
             $sCode = $GLOBALS['oFunctions']->msgBox(_t('_File info was sent'));
         } else {
             $sCode = $GLOBALS['oFunctions']->msgBox(_t('_Error'));
         }
     } else {
         $sCode = $this->_oTemplate->parseHtmlByName('default_padding.html', array('content' => $oForm->getCode()));
         $sCode = $this->_oTemplate->parseHtmlByName('popup.html', array('title' => _t('_Share'), 'content' => $sCode));
         $sCode = $GLOBALS['oFunctions']->transBox($sCode, TRUE);
     }
     header('Content-type:text/html;charset=utf-8');
     echo $sCode;
     exit;
 }
<?php

/***************************************************************************
*                            Dolphin Smart Community Builder
*                              -----------------
*     begin                : Mon Mar 23 2006
*     copyright            : (C) 2006 BoonEx Group
*     website              : http://www.boonex.com/
* This file is part of Dolphin - Smart Community Builder
*
* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License. 
* http://creativecommons.org/licenses/by/3.0/
*
* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the Creative Commons Attribution 3.0 License for more details. 
* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin, 
* see license.txt file; if not, write to marketing@boonex.com
***************************************************************************/
require_once 'inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
$sUrl = 'http://www.boonex.com/unity/id/export';
$sID = process_pass_data($_GET['ID']);
$sPassword = process_pass_data($_GET['Password']);
$sRequest = $sUrl . '?username='******'&password='******'&r=' . rand();
header('Content-Type: application/xml');
echo file_get_contents($sRequest);
Exemplo n.º 25
0
 function collectSearchRequestParams()
 {
     $aParams = array();
     if (empty($_GET) and empty($_POST)) {
         return $aParams;
     }
     foreach ($this->aBlocks as $aBlock) {
         foreach ($aBlock['Items'] as $aItem) {
             $sItemName = $aItem['Name'];
             $mValue = null;
             switch ($aItem['Type']) {
                 case 'text':
                 case 'area':
                 case 'html_area':
                     if (isset($_REQUEST[$sItemName]) and $_REQUEST[$sItemName]) {
                         $mValue = process_pass_data($_REQUEST[$sItemName]);
                     }
                     break;
                 case 'num':
                 case 'date':
                 case 'range':
                     if (isset($_REQUEST[$sItemName]) and !empty($_REQUEST[$sItemName])) {
                         $mValue = explode('-', $_REQUEST[$sItemName], 2);
                         $mValue[0] = (int) $mValue[0];
                         $mValue[1] = (int) $mValue[1];
                         if (!$mValue[0] and !$mValue[1]) {
                             $mValue = null;
                         }
                         // if no values entered, skip them
                     }
                     break;
                 case 'select_one':
                 case 'select_set':
                     if (isset($_REQUEST[$sItemName]) and !empty($_REQUEST[$sItemName])) {
                         if (is_array($_REQUEST[$sItemName])) {
                             $mValue = array();
                             foreach ($_REQUEST[$sItemName] as $sValue) {
                                 $sValue = trim(process_pass_data($sValue));
                                 if ($sValue) {
                                     $mValue[] = $sValue;
                                 }
                             }
                         } else {
                             $mValue = trim(process_pass_data($_REQUEST[$sItemName]));
                         }
                     }
                     if (!$mValue) {
                         $mValue = null;
                     }
                     break;
                 case 'bool':
                     if (isset($_REQUEST[$sItemName]) and $_REQUEST[$sItemName]) {
                         $mValue = true;
                     }
                     break;
                 case 'system':
                     switch ($sItemName) {
                         case 'ID':
                             if (isset($_REQUEST[$sItemName]) and (int) $_REQUEST[$sItemName]) {
                                 $mValue = (int) $_REQUEST[$sItemName];
                             }
                             break;
                         case 'Couple':
                             if (isset($_REQUEST[$sItemName]) and is_array($_REQUEST[$sItemName])) {
                                 if (isset($_REQUEST[$sItemName][0]) and isset($_REQUEST[$sItemName][1])) {
                                     $mValue = '-1';
                                 } elseif (isset($_REQUEST[$sItemName][0])) {
                                     $mValue = 0;
                                 } elseif (isset($_REQUEST[$sItemName][1])) {
                                     $mValue = 1;
                                 }
                             } elseif (isset($_REQUEST[$sItemName])) {
                                 $mValue = 'yes' == $_REQUEST[$sItemName] ? 1 : 0;
                             }
                             break;
                         case 'Location':
                             break;
                         case 'Keyword':
                             if (isset($_REQUEST[$sItemName]) and trim($_REQUEST[$sItemName])) {
                                 $mValue = trim(process_pass_data($_REQUEST[$sItemName]));
                             }
                             break;
                     }
                     break;
             }
             if (!is_null($mValue)) {
                 $aParams[$sItemName] = $mValue;
             }
         }
     }
     return $aParams;
 }
Exemplo n.º 26
0
 function formTester()
 {
     $sMsg = '';
     if ($_POST['tester_submit']) {
         $sRecipient = process_pass_data($_POST['recipient']);
         $sSubj = process_pass_data($_POST['subject']);
         $sBody = process_pass_data($_POST['body']);
         $isHTML = $_POST['html'] == 'on' ? true : false;
         if (sendMail($sRecipient, $sSubj, $sBody, 0, array(), $isHTML ? 'html' : '')) {
             $sMsg = MsgBox(_t('_bx_smtp_send_ok'));
         } else {
             $sMsg = MsgBox(_t('_bx_smtp_send_fail'));
         }
     }
     $aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/', 'method' => 'post'), 'inputs' => array('header' => array('type' => 'block_header', 'caption' => _t('_bx_smtp_tester')), 'recipient' => array('type' => 'text', 'name' => 'recipient', 'caption' => _t('_bx_smtp_recipient'), 'value' => ''), 'subject' => array('type' => 'text', 'name' => 'subject', 'caption' => _t('_bx_smtp_subject'), 'value' => ''), 'body' => array('type' => 'textarea', 'name' => 'body', 'caption' => _t('_bx_smtp_body'), 'value' => ''), 'html' => array('type' => 'checkbox', 'name' => 'html', 'caption' => _t('_bx_smtp_is_html'), 'checked' => false), 'Submit' => array('type' => 'submit', 'name' => 'tester_submit', 'value' => _t("_Submit"))));
     bx_import('BxTemplFormView');
     $oForm = new BxTemplFormView($aForm);
     return $sMsg . $oForm->getCode();
 }
Exemplo n.º 27
0
 * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
 * CC-BY License - http://creativecommons.org/licenses/by/3.0/
 */
require_once '../inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
bx_import('BxRSS');
bx_import('BxDolAdminDashboard');
define('BX_DOL_ADMIN_INDEX', 1);
$bLogged = isLogged();
$bNeedCheck = $bLogged && isAdmin() && $_POST['relocate'] && strncasecmp($_POST['relocate'], BX_DOL_URL_ADMIN . 'license.php', strlen(BX_DOL_URL_ADMIN . 'license.php')) == 0;
if ($bNeedCheck || isset($_POST['ID']) && isset($_POST['Password'])) {
    $iId = getID($_POST['ID']);
    $sPassword = process_pass_data($_POST['Password']);
    if (!$bLogged) {
        $oZ = new BxDolAlerts('profile', 'before_login', 0, 0, array('login' => $iId, 'password' => $sPassword, 'ip' => getVisitorIP()));
        $oZ->alert();
    }
    if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
        echo check_password($iId, $sPassword, BX_DOL_ROLE_ADMIN, false) ? 'OK' : 'Fail';
    } else {
        if ($bNeedCheck || check_password($iId, $sPassword, BX_DOL_ROLE_ADMIN)) {
            if ($_POST['relocate'] && (strncasecmp($_POST['relocate'], BX_DOL_URL_ROOT, strlen(BX_DOL_URL_ROOT)) == 0 || strncasecmp($_POST['relocate'], BX_DOL_URL_ADMIN . 'license.php', strlen(BX_DOL_URL_ADMIN . 'license.php')) == 0)) {
                $sUrlRelocate = $_POST['relocate'];
            } else {
                $sUrlRelocate = BX_DOL_URL_ADMIN . 'index.php';
            }
            $sUrlRelocate = bx_html_attribute($sUrlRelocate);
            $r = $l($a);
Exemplo n.º 28
0
            $between_date1 = 0;
        } elseif ($_POST['tr_between_date1'] == 'now') {
            $between_date1 = time();
        } else {
            $between_date1 = strtotime($_POST['tr_between_date1']);
        }
        // Second date parse
        if ($_POST['tr_between_date2'] == 'start') {
            $between_date2 = 0;
        } elseif ($_POST['tr_between_date2'] == 'now') {
            $between_date2 = time();
        } else {
            $between_date2 = strtotime($_POST['tr_between_date2']);
        }
        $tr['between_date1'] = process_pass_data($_POST['tr_between_date1']);
        $tr['between_date2'] = process_pass_data($_POST['tr_between_date2']);
        if ($between_date1 != -1 && $between_date2 != -1) {
            $tr_query = "SELECT `ID`, `IDMember`, `IDProvider`, `gtwTransactionID`, DATE_FORMAT(`Date`,  '{$date_format}' ) AS 'Date', `Amount`, `Currency`, `Status`, `Data`, `Description`, `Note` FROM `Transactions` INNER JOIN `aff_members` ON (`idProfile` = `IDMember`) WHERE `idAff` = {$affID} AND ( TO_DAYS( FROM_UNIXTIME({$between_date1}) ) <= TO_DAYS( `Date` ) AND TO_DAYS( FROM_UNIXTIME({$between_date2}) ) >= TO_DAYS( `Date` ) ) AND `Status` = 'approved' ORDER BY `Date` DESC";
        } else {
            $tr_query = "";
            $tr['error_text'] = "Please specify correct dates";
        }
        $between_disabled = "";
        break;
}
// Calculations
if (strlen($tr_query)) {
    $fin = getFinanceAffStat($affID, $tr);
}
// Transactions
if (strlen($tr_query)) {
function browseCode()
{
    global $site;
    global $rData;
    global $iTotalPages;
    global $iCurPage;
    $sCode = '<div id = "browseMain">';
    $sCode .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">';
    if (mysql_num_rows($rData)) {
        while ($aData = mysql_fetch_array($rData)) {
            $sStyle = $aData['Approved'] == 'true' ? ' style="border: 2px solid #00CC00;"' : ' style="border: 2px solid #CC0000;"';
            $sProf = '<a href="' . $site['url'] . 'profile_edit.php?ID=' . $aData['medProfId'] . '">' . $aData['NickName'] . '</a>';
            $sCode .= '<div class="browseUnit"' . $sStyle . '>';
            $sCode .= '<div class="browseCheckbox"><input type="checkbox" name="Check[]" value="' . $aData['medID'] . '"></div>';
            $sCode .= '<div class="lastFilesPic"><img src="' . $site['url_admin'] . 'images/music.png"></div>';
            $sCode .= '<div class="browseInfo"><div><a href="' . $site['url'] . 'viewMusic.php?fileID=' . $aData['medID'] . '"><b>' . $aData['medTitle'] . '</b></a></div>';
            $sCode .= '<div>' . _t("_Added") . ': <b>' . defineTimeInterval($aData['medDate']) . '</b> by ' . $sProf . '</div>';
            $sCode .= '<div>' . _t("_Playbacks") . ': <b>' . $aData['medListens'] . '</b></div></div>';
            $sCode .= '</div>';
        }
    } else {
        $sCode .= '<div>There are no files</div>';
    }
    $sCode .= '</div>';
    $sCode .= '<div class="clear_both"></div>';
    $sCode .= '<div class="bottomPart"><input type="submit" name="Delete" value="Delete"><input type="submit" name="Approve" value="Change status"></div>';
    // generate pagination
    if ($iTotalPages > 1) {
        $sRequest = $_SERVER['PHP_SELF'] . '?page={page}';
        $aFields = array('userID', 'tag');
        foreach ($aFields as $field) {
            if (isset($_GET[$field])) {
                $sRequest .= "&{$field}=" . htmlentities(process_pass_data($_GET[$field]));
            }
        }
        $pagination = '<div style="text-align:center;">' . genPagination($iTotalPages, $iCurPage, $sRequest) . '</div>';
    } else {
        $pagination = '';
    }
    return $sCode . $pagination . '</form>';
}
Exemplo n.º 30
0
 function _validateCheckout(&$aData)
 {
     $iMode = (int) $this->getOption('mode');
     if ($iMode == PP_MODE_LIVE) {
         $sBusiness = $this->getOption('business');
         $sConnectionUrl = 'www.paypal.com';
     } else {
         $sBusiness = $this->getOption('sandbox');
         $sConnectionUrl = 'www.sandbox.paypal.com';
     }
     $iPrcType = $this->getOption('prc_type');
     if ($iPrcType == PP_PRC_TYPE_DIRECT || $iPrcType == PP_PRC_TYPE_IPN) {
         if ($aData['payment_status'] != 'Completed') {
             return array('code' => 0, 'message' => _t('_payment_pp_err_not_completed'));
         }
         if ($aData['business'] != $sBusiness) {
             return array('code' => -1, 'message' => _t('_payment_pp_err_wrong_business'));
         }
         $sRequest = 'cmd=_notify-validate';
         foreach ($aData as $sKey => $sValue) {
             $sRequest .= '&' . urlencode($sKey) . '=' . urlencode(process_pass_data($sValue));
         }
         $aResponse = $this->_readValidationData($sConnectionUrl, $sRequest);
         if ((int) $aResponse['code'] !== 0) {
             return $aResponse;
         }
         array_walk($aResponse['content'], create_function('&$arg', "\$arg = trim(\$arg);"));
         if (strcmp($aResponse['content'][0], "INVALID") == 0) {
             return array('code' => -1, 'message' => _t('_payment_pp_err_wrong_transaction'));
         } else {
             if (strcmp($aResponse['content'][0], "VERIFIED") != 0) {
                 return array('code' => 2, 'message' => _t('_payment_pp_err_wrong_verification_status'));
             }
         }
     } else {
         if ($iPrcType == PP_PRC_TYPE_PDT) {
             $sRequest = "cmd=_notify-synch&tx=" . $aData['tx'] . "&at=" . $this->getOption('token');
             $aResponse = $this->_readValidationData($sConnectionUrl, $sRequest);
             if ((int) $aResponse['code'] !== 0) {
                 return $aResponse;
             }
             if (strcmp($aResponse['content'][0], "FAIL") == 0) {
                 return array('code' => -1, 'message' => _t('_payment_pp_err_wrong_transaction'));
             } else {
                 if (strcmp($aResponse['content'][0], "SUCCESS") != 0) {
                     return array('code' => 2, 'message' => _t('_payment_pp_err_wrong_verification_status'));
                 }
             }
             $aKeys = array();
             foreach ($aResponse['content'] as $sLine) {
                 list($sKey, $sValue) = explode("=", $sLine);
                 $aKeys[urldecode($sKey)] = urldecode($sValue);
             }
             $aData = array_merge($aData, $aKeys);
             if ($aData['payment_status'] != 'Completed') {
                 return array('code' => 0, 'message' => _t('_payment_pp_err_not_completed'));
             }
             if ($aData['business'] != $sBusiness) {
                 return array('code' => -1, 'message' => _t('_payment_pp_err_wrong_business'));
             }
         }
     }
     $aPending = $this->_oDb->getPending(array('type' => 'id', 'id' => $aData['item_number']));
     $aVendor = $this->_oDb->getVendorInfoProfile($aPending['seller_id']);
     $fAmount = (double) $this->_getReceivedAmount($aVendor['currency_code'], $aData);
     if ($fAmount != (double) $aPending['amount']) {
         return array('code' => -1, 'message' => _t('_payment_pp_err_wrong_amount'));
     }
     if ($aData['custom'] != md5($aPending['seller_id'] . $aPending['id'])) {
         return array('code' => -1, 'message' => _t('_payment_pp_err_wrong_custom_data'));
     }
     return array('code' => 1, 'message' => _t('_payment_pp_msg_verified'));
 }