Example #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);
}
Example #2
0
 function getPostForm($iUnitID = 0)
 {
     $sAddNewC = _t('_bx_quotes_add_new');
     $sAction = 'add';
     $sQText = $sQText = '';
     if ($iUnitID) {
         $aQinfo = $this->_oDb->getQuote($iUnitID);
         $sQText = $aQinfo['Text'];
         $sQAuthor = $aQinfo['Author'];
         $sAction = 'edit';
     }
     $aForm = array('form_attrs' => array('name' => 'create_quotes_form', 'action' => BX_DOL_URL_ROOT . 'modules/?r=quotes/administration/', 'method' => 'post'), 'params' => array('db' => array('table' => 'bx_quotes_units', 'key' => 'ID', 'submit_name' => 'add_button')), 'inputs' => array('action' => array('type' => 'hidden', 'name' => 'action', 'value' => $sAction), 'Text' => array('type' => 'textarea', 'name' => 'Text', 'caption' => _t('_bx_quotes_text'), 'required' => true, 'value' => $sQText, 'checker' => array('func' => 'length', 'params' => array(3, 1024), 'error' => _t('_bx_quotes_text_err', 1024)), 'db' => array('pass' => 'Xss')), 'Author' => array('type' => 'text', 'name' => 'Author', 'caption' => _t('_bx_quotes_author'), 'required' => true, 'value' => $sQAuthor, 'checker' => array('func' => 'length', 'params' => array(3, 128), 'error' => _t('_bx_quotes_author_err', 128)), 'db' => array('pass' => 'Xss')), 'add_button' => array('type' => 'submit', 'name' => 'add_button', 'value' => _t('_Submit'))));
     if ($iUnitID) {
         $aForm['inputs']['hidden_unitid'] = array('type' => 'hidden', 'name' => 'ID', 'value' => $iUnitID);
     }
     $sCode = '';
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $sCode = MsgBox(_t('_bx_quotes_fail'), 1);
         $aValsAdd = array();
         $iLastId = -1;
         if ($iUnitID > 0) {
             $oForm->update($iUnitID, $aValsAdd);
             $iLastId = $iUnitID;
             $sCode = MsgBox(_t('_bx_quotes_edited_success'), 1);
         } else {
             $iLastId = $oForm->insert($aValsAdd);
             $sCode = MsgBox(_t('_bx_quotes_success'), 1);
         }
     }
     return DesignBoxAdmin($sAddNewC, $sCode . $oForm->getCode(), '', '', 11);
 }
Example #3
0
 public function getForm($iDesignBoxTemplate = BX_DB_PADDING_DEF, $sTitle = false)
 {
     if ($this->_sMetaType) {
         return '';
     }
     if (false === $sTitle) {
         $sTitle = _t("_Search");
     }
     $aValues = $this->getKeyTitlesPairs();
     $aValue = isset($_GET['type']) ? bx_process_input($_GET['type']) : array_keys($aValues);
     $sIdForm = $this->_sIdForm . ($this->_bLiveSearch ? $this->_sSuffixLiveSearch : '');
     $sIdResults = $this->_sIdResults . ($this->_bLiveSearch ? $this->_sSuffixLiveSearch : '');
     $sIdLoadingContainer = $this->_bLiveSearch ? $sIdResults : $sIdForm;
     $sJsParams = "5, '#{$sIdForm}', '#{$sIdResults}', '#{$sIdLoadingContainer}', '{$this->_bLiveSearch}'";
     $aForm = array('form_attrs' => array('id' => $sIdForm, 'action' => BX_DOL_URL_ROOT . 'searchKeyword.php', 'method' => 'post'), 'csrf' => array('disable' => true), 'inputs' => array('live_search' => array('type' => 'hidden', 'name' => 'live_search', 'value' => $this->_bLiveSearch ? 1 : 0), 'section' => array('type' => 'checkbox_set', 'name' => 'section', 'caption' => _t('_Section'), 'values' => $aValues, 'value' => $aValue), 'keyword' => array('type' => 'text', 'name' => 'keyword', 'caption' => _t('_Keyword'), 'value' => bx_get('keyword') ? bx_process_input(bx_get('keyword')) : ''), 'search' => array('type' => 'submit', 'name' => 'search', 'value' => _t('_Search'))));
     if ($this->_bLiveSearch) {
         unset($aForm['inputs']['section']);
         unset($aForm['inputs']['search']);
         unset($aForm['inputs']['keyword']['caption']);
         $aForm['inputs']['keyword']['attrs']['placeholder'] = _t('_sys_search_placeholder');
         $aForm['inputs']['keyword']['attrs']['onkeypress'] = "return bx_search_on_type(event, {$sJsParams});";
         $aForm['inputs']['keyword']['attrs']['onpaste'] = $aForm['inputs']['keyword']['attrs']['onkeypress'];
     }
     bx_import('BxTemplFormView');
     $oForm = new BxTemplFormView($aForm);
     $sForm = $oForm->getCode();
     if (!$this->_bLiveSearch) {
         bx_import('BxTemplPaginate');
         $o = new BxTemplPaginate(array());
         $o->addCssJs();
     }
     return DesignBoxContent($sTitle, $sForm, $iDesignBoxTemplate);
 }
Example #4
0
function getSearchForm()
{
    $aList = $GLOBALS['MySQL']->fromCache('sys_objects_search', 'getAllWithKey', 'SELECT `ID` as `id`,
                   `Title` as `title`,
                   `ClassName` as `class`,
                   `ClassPath` as `file`,
                   `ObjectName`
            FROM `sys_objects_search`', 'ObjectName');
    $aValues = array();
    foreach ($aList as $sKey => $aValue) {
        $aValues[$sKey] = _t($aValue['title']);
        if (!class_exists($aValue['class'])) {
            $sPath = BX_DIRECTORY_PATH_ROOT . str_replace('{tmpl}', $GLOBALS['tmpl'], $aValue['file']);
            require_once $sPath;
        }
        $oClass = new $aValue['class']();
        $oClass->addCustomParts();
    }
    if (isset($_GET['type'])) {
        $aValue = strip_tags($_GET['type']);
    } else {
        $aValue = array_keys($aValues);
    }
    $aForm = array('form_attrs' => array('id' => 'searchForm', 'action' => '', 'method' => 'post', 'onsubmit' => ''), 'inputs' => array('section' => array('type' => 'checkbox_set', 'name' => 'section', 'caption' => _t('_Section'), 'values' => $aValues, 'value' => $aValue), 'keyword' => array('type' => 'text', 'name' => 'keyword', 'caption' => _t('_Keyword')), 'search' => array('type' => 'submit', 'name' => 'search', 'value' => _t('_Search'))));
    $oForm = new BxTemplFormView($aForm);
    $sFormVal = $oForm->getCode();
    return DesignBoxContent(_t("_Search"), $sFormVal, 11);
}
Example #5
0
 function getFormCode()
 {
     $oForm = new BxTemplFormView($this->aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $aValsAdd = array('Date' => time(), 'Uri' => $oForm->generateUri(), 'Status' => 'active', 'Owner' => $this->iOwnerId);
         if ($this->iAlbumId > 0 && $this->aInfo['Owner'] == $this->iOwnerId) {
             $aValsAdd = array('Date' => time());
             if (!$oForm->update($this->iAlbumId, $aValsAdd)) {
                 return MsgBox(_t('_sys_album_save_error'));
             } else {
                 return MsgBox(_t('_sys_album_save_succ'));
             }
         } else {
             $iAlbumId = $oForm->insert($aValsAdd);
             if (!$iAlbumId) {
                 return MsgBox(_t('_sys_album_save_error'));
             } else {
                 return MsgBox(_t('_sys_album_save_succ'));
             }
         }
     } else {
         return $oForm->getCode();
     }
 }
function _getList($mixedResult, $bActive = false)
{
    $aForm = array('form_attrs' => array('id' => 'adm-email-templates', 'action' => $GLOBALS['site']['url_admin'] . 'email_templates.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'sys_email_templates', 'key' => 'ID', 'uri' => '', 'uri_title' => '', 'submit_name' => 'adm-emial-templates-save')), 'inputs' => array());
    $aLanguages = $GLOBALS['MySQL']->getAll("SELECT `ID` AS `id`, `Title` AS `title` FROM `sys_localization_languages`");
    $aLanguageChooser = array(array('key' => 0, 'value' => 'default'));
    foreach ($aLanguages as $aLanguage) {
        $aLanguageChooser[] = array('key' => $aLanguage['id'], 'value' => $aLanguage['title']);
    }
    $sLanguageCpt = _t('_adm_txt_email_language');
    $sSubjectCpt = _t('_adm_txt_email_subject');
    $sBodyCpt = _t('_adm_txt_email_body');
    $aEmails = $GLOBALS['MySQL']->getAll("SELECT `ID` AS `id`, `Name` AS `name`, `Subject` AS `subject`, `Body` AS `body`, `Desc` AS `description` FROM `sys_email_templates` WHERE `LangID`='0' ORDER BY `ID`");
    foreach ($aEmails as $aEmail) {
        $aForm['inputs'] = array_merge($aForm['inputs'], array($aEmail['name'] . '_Beg' => array('type' => 'block_header', 'caption' => $aEmail['description'], 'collapsable' => true, 'collapsed' => true), $aEmail['name'] . '_Language' => array('type' => 'select', 'name' => $aEmail['name'] . '_Language', 'caption' => $sLanguageCpt, 'value' => 0, 'values' => $aLanguageChooser, 'db' => array('pass' => 'Int'), 'attrs' => array('onchange' => "javascript:getTranslations(this)")), $aEmail['name'] . '_Subject' => array('type' => 'text', 'name' => $aEmail['name'] . '_Subject', 'caption' => $sSubjectCpt, 'value' => $aEmail['subject'], 'db' => array('pass' => 'Xss')), $aEmail['name'] . '_Body' => array('type' => 'textarea', 'name' => $aEmail['name'] . '_Body', 'caption' => $sBodyCpt, 'value' => $aEmail['body'], 'db' => array('pass' => 'XssHtml')), $aEmail['name'] . '_End' => array('type' => 'block_end')));
    }
    $aForm['inputs']['adm-emial-templates-save'] = array('type' => 'submit', 'name' => 'adm-emial-templates-save', 'value' => _t('_adm_btn_email_save'));
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    $sResult = "";
    if ($oForm->isSubmittedAndValid()) {
        $iResult = 0;
        foreach ($aEmails as $aEmail) {
            $iEmailId = (int) $GLOBALS['MySQL']->getOne("SELECT `ID` FROM `sys_email_templates` WHERE `Name`='" . process_db_input($aEmail['name']) . "' AND `LangID`='" . (int) $_POST[$aEmail['name'] . '_Language'] . "' LIMIT 1");
            if ($iEmailId != 0) {
                $iResult += (int) $GLOBALS['MySQL']->query("UPDATE `sys_email_templates` SET `Subject`='" . process_db_input($_POST[$aEmail['name'] . '_Subject']) . "', `Body`='" . process_db_input($_POST[$aEmail['name'] . '_Body']) . "' WHERE `ID`='" . $iEmailId . "'");
            } else {
                $iResult += (int) $GLOBALS['MySQL']->query("INSERT INTO `sys_email_templates` SET `Name`='" . process_db_input($aEmail['name']) . "', `Subject`='" . process_db_input($_POST[$aEmail['name'] . '_Subject']) . "', `Body`='" . process_db_input($_POST[$aEmail['name'] . '_Body']) . "', `LangID`='" . (int) $_POST[$aEmail['name'] . '_Language'] . "'");
            }
        }
        $bActive = true;
        $sResult .= MsgBox(_t($iResult > 0 ? "_adm_txt_email_success_save" : "_adm_txt_email_nothing_changed"), 3);
    }
    $sResult .= $oForm->getCode();
    return $GLOBALS['oAdmTemplate']->parseHtmlByName('email_templates_list.html', array('display' => $bActive ? 'block' : 'none', 'content' => stripslashes($sResult), 'loading' => LoadingBox('adm-email-loading')));
}
/**
 * page code function
 */
function PageCompPageMainCode($iID, $sConfCode)
{
    global $site;
    $ID = (int) $iID;
    $ConfCode = clear_xss($sConfCode);
    $p_arr = getProfileInfo($ID);
    if (!$p_arr) {
        $_page['header'] = _t("_Error");
        $_page['header_text'] = _t("_Profile Not found");
        return MsgBox(_t('_Profile Not found Ex'));
    }
    $aCode = array('message_status' => '', 'message_info' => '', 'bx_if:form' => array('condition' => false, 'content' => array('form' => '')), 'bx_if:next' => array('condtion' => false, 'content' => array('next_url' => '')));
    if ($p_arr['Status'] == 'Unconfirmed') {
        $ConfCodeReal = base64_encode(base64_encode(crypt($p_arr[Email], CRYPT_EXT_DES ? "secret_co" : "se")));
        if (strcmp($ConfCode, $ConfCodeReal) != 0) {
            $aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . 'profile_activate.php', 'method' => 'post', 'name' => 'form_change_status'), 'inputs' => array('conf_id' => array('type' => 'hidden', 'name' => 'ConfID', 'value' => $ID), 'conf_code' => array('type' => 'text', 'name' => 'ConfCode', 'value' => '', 'caption' => _t("_Confirmation code")), 'submit' => array('type' => 'submit', 'name' => 'submit', 'value' => _t("_Submit"))));
            $oForm = new BxTemplFormView($aForm);
            $aCode['message_status'] = _t("_Profile activation failed");
            $aCode['message_info'] = _t("_EMAIL_CONF_FAILED_EX");
            $aCode['bx_if:form']['condition'] = true;
            $aCode['bx_if:form']['content']['form'] = $oForm->getCode();
        } else {
            $aCode['bx_if:next']['condition'] = true;
            $aCode['bx_if:next']['content']['next_url'] = BX_DOL_URL_ROOT . 'member.php';
            $send_act_mail = false;
            if (getParam('autoApproval_ifJoin') == 'on' && !(getParam('sys_dnsbl_enable') && 'approval' == getParam('sys_dnsbl_behaviour') && bx_is_ip_dns_blacklisted('', 'join'))) {
                $status = 'Active';
                $send_act_mail = true;
                $aCode['message_info'] = _t("_PROFILE_CONFIRM");
            } else {
                $status = 'Approval';
                $aCode['message_info'] = _t("_EMAIL_CONF_SUCCEEDED", $site['title']);
            }
            $update = bx_admin_profile_change_status($ID, $status, $send_act_mail);
            // Promotional membership
            if (getParam('enable_promotion_membership') == 'on') {
                $memership_days = getParam('promotion_membership_days');
                setMembership($p_arr['ID'], MEMBERSHIP_ID_PROMOTION, $memership_days, true);
            }
            // check couple profile;
            if ($p_arr['Couple']) {
                $update = bx_admin_profile_change_status($p_arr['Couple'], $status);
                //Promotional membership
                if (getParam('enable_promotion_membership') == 'on') {
                    $memership_days = getParam('promotion_membership_days');
                    setMembership($p_arr['Couple'], MEMBERSHIP_ID_PROMOTION, $memership_days, true);
                }
            }
            if (getParam('newusernotify')) {
                $oEmailTemplates = new BxDolEmailTemplates();
                $aTemplate = $oEmailTemplates->getTemplate('t_UserConfirmed', $p_arr['ID']);
                sendMail($site['email_notify'], $aTemplate['Subject'], $aTemplate['Body'], $p_arr['ID']);
            }
        }
    } else {
        $aCode['message_info'] = _t('_ALREADY_ACTIVATED');
    }
    return $GLOBALS['oSysTemplate']->parseHtmlByName('profile_activate.html', $aCode);
}
Example #8
0
 function actionGetInvitation()
 {
     $aForm = array('form_attrs' => array('name' => 'invitation_form'), 'params' => array('remove_form' => true), 'inputs' => array(array('type' => 'input_set', 'colspan' => true, 0 => array('type' => 'button', 'name' => 'accept', 'value' => _t("_messenger_invitation_accept"), 'attrs' => array('class' => 'bx-btn-small', 'onclick' => 'BxMsgPerformAction("__sender_id__", "accept");')), 1 => array('type' => 'button', 'name' => 'decline', 'value' => _t("_messenger_invitation_decline"), 'attrs' => array('class' => 'bx-btn-small', 'onclick' => 'BxMsgPerformAction("__sender_id__", "decline");')), 2 => array('type' => 'button', 'name' => 'block', 'value' => _t("_messenger_invitation_block"), 'attrs' => array('class' => 'bx-btn-small', 'onclick' => 'BxMsgPerformAction("__sender_id__", "block");')), 3 => array('type' => 'button', 'name' => 'report', 'value' => _t("_messenger_invitation_report"), 'attrs' => array('class' => 'bx-btn-small', 'onclick' => 'BxMsgPerformAction("__sender_id__", "spam");')))));
     $oForm = new BxTemplFormView($aForm);
     $aVariables = array('invitation_buttons' => $oForm->getCode());
     $sResult = $this->_oTemplate->parseHtmlByName("invitation.html", $aVariables);
     return $sResult;
 }
Example #9
0
function PageCodeLogo($mixedResultLogo)
{
    $aForm = array('form_attrs' => array('id' => 'adm-settings-form-logo', 'name' => 'adm-settings-form-logo', 'action' => $GLOBALS['site']['url_admin'] . 'basic_settings.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array(), 'inputs' => array('upload_header_beg' => array('type' => 'block_header', 'caption' => _t('_adm_txt_settings_logo_header'), 'collapsable' => false, 'collapsed' => false), 'old_file' => array('type' => 'custom', 'content' => getMainLogo(), 'colspan' => true), 'new_file' => array('type' => 'file', 'name' => 'new_file', 'caption' => _t('_adm_txt_settings_logo_upload'), 'value' => ''), 'resize_header_beg' => array('type' => 'block_header', 'caption' => _t('_adm_txt_settings_resize_header'), 'collapsable' => false, 'collapsed' => false), 'resize' => array('type' => 'checkbox', 'name' => 'resize', 'caption' => _t('_adm_txt_settings_resize_enable'), 'value' => 'yes', 'checked' => true), 'new_width' => array('type' => 'text', 'name' => 'new_width', 'caption' => _t('_adm_txt_settings_resize_width'), 'value' => '64'), 'new_height' => array('type' => 'text', 'name' => 'new_height', 'caption' => _t('_adm_txt_settings_resize_height'), 'value' => '64'), 'resize_header_end' => array('type' => 'block_end'), 'upload' => array('type' => 'submit', 'name' => 'upload', 'value' => _t("_adm_btn_settings_upload"))));
    $oForm = new BxTemplFormView($aForm);
    $sResult = $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $oForm->getCode()));
    if ($mixedResultLogo !== true && !empty($mixedResultLogo)) {
        $sResult = MsgBox(_t($mixedResultLogo), 3) . $sResult;
    }
    return DesignBoxAdmin(_t('_adm_box_cpt_logo'), $sResult);
}
Example #10
0
/**
 * page code function
 */
function PageCompPageMainCode()
{
    if ($_POST['DELETE']) {
        profile_delete(getLoggedId());
        bx_logout();
        return MsgBox(_t("_DELETE_SUCCESS"));
    }
    $aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . 'unregister.php', 'method' => 'post', 'name' => 'form_unregister'), 'inputs' => array('delete' => array('type' => 'hidden', 'name' => 'DELETE', 'value' => '1'), 'info' => array('type' => 'custom', 'content' => _t("_DELETE_TEXT"), 'colspan' => true), 'submit' => array('type' => 'submit', 'name' => 'submit', 'value' => _t("_Delete account"))));
    $oForm = new BxTemplFormView($aForm);
    return $oForm->getCode();
}
Example #11
0
/**
 * page code function
 */
function PageCompMainCode()
{
    ob_start();
    $aForm = array('form_attrs' => array('id' => 'sample_form', 'action' => BX_DOL_URL_ROOT . 'samples/forms.php', 'method' => 'post'), 'params' => array('db' => array('submit_name' => 'do_submit')), 'inputs' => array('header_contact' => array('type' => 'block_header', 'caption' => 'Contact details'), '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'))), 'date' => array('type' => 'datepicker', 'name' => 'date', 'caption' => _t('Date'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('Date is required'))), 'datetime' => array('type' => 'datetime', 'name' => 'datetime', 'caption' => _t('Datetime'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('Datetime is required'))), 'email' => array('type' => 'text', 'name' => 'email', 'caption' => _t('_Your email'), 'required' => true, 'checker' => array('func' => 'email', 'error' => _t('_Incorrect Email'))), 'header_message' => array('type' => 'block_header', 'caption' => 'Message details', 'collapsable' => true, 'collapsed' => false), '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'))), 'header_advanced' => array('type' => 'block_header', 'caption' => 'Advanced details', 'collapsable' => true, 'collapsed' => true), 'select_something' => array('type' => 'select', 'name' => 'select_something', 'caption' => _t('Select something'), 'values' => array(1 => 'One', 'Two', 'Three', 'Four', 'Five'), 'required' => true), 'select_radio' => array('type' => 'radio_set', 'name' => 'select_radio', 'caption' => _t('Select radio something'), 'values' => array(1 => 'One', 'Two', 'Three'), 'required' => true), 'choose_something' => array('type' => 'checkbox_set', 'name' => 'choose_something', 'caption' => _t('Choose something'), 'values' => array(1 => 'One', 'Two', 'Three', 'Four', 'Five'), 'required' => true), 'select_multiple' => array('type' => 'select_multiple', 'name' => 'select_multiple', 'caption' => _t('Multiple select'), 'values' => array(1 => 'One', 'Two', 'Three', 'Four', 'Five'), 'required' => true), 'doublerange' => array('type' => 'doublerange', 'name' => 'doublerange', 'caption' => _t('Double Range'), 'attrs' => array('min' => 10, 'max' => 200), 'value' => '20-30', 'required' => true), 'header_submit' => array('type' => 'block_header', 'caption' => ''), 'iagree' => array('type' => 'checkbox', 'name' => 'iagree', 'value' => '1', 'caption' => _t('Do you like it?'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('Form can not be submitted if you don\'t like it.'))), 'submit' => array('type' => 'input_set', 0 => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit')), 1 => array('type' => 'reset', 'name' => 'close', 'value' => _t('_Reset'), 'attrs' => array('class' => 'bx-def-margin-sec-left')))));
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        echo MsgBox('Data was successfully submitted');
    }
    echo $oForm->getCode();
    $s = ob_get_clean();
    return DesignBoxContent("Sample form", $s, BX_DB_PADDING_DEF);
}
Example #12
0
/**
 * page code function
 */
function PageCompPageMainCode()
{
    $iUserId = getLoggedId();
    if ($_POST['DELETE']) {
        profile_delete($iUserId);
        bx_logout();
        return MsgBox(_t("_DELETE_SUCCESS"));
    }
    $aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . 'unregister.php', 'method' => 'post', 'name' => 'form_unregister'), 'inputs' => array('delete' => array('type' => 'hidden', 'name' => 'DELETE', 'value' => '1'), 'info' => array('type' => 'custom', 'content' => _t("_DELETE_TEXT"), 'colspan' => true), 'submit' => array('type' => 'submit', 'name' => 'submit', 'value' => _t("_Delete account"))));
    $oForm = new BxTemplFormView($aForm);
    $GLOBALS['oTopMenu']->setCurrentProfileID($iUserId);
    return $GLOBALS['oSysTemplate']->parseHtmlByName('default_margin.html', array('content' => $oForm->getCode()));
}
Example #13
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);
}
Example #14
0
function PageCodeEdit()
{
    $aForm = array('form_attrs' => array('id' => 'adm-css-edit', 'name' => 'adm-css-edit', 'action' => $GLOBALS['site']['url_admin'] . 'css_file.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => '', 'key' => '', 'uri' => '', 'uri_title' => '', 'submit_name' => 'adm-css-save')), 'inputs' => array('css_file' => array('type' => 'select', 'name' => 'css_file', 'caption' => _t('_adm_txt_css_file'), 'value' => '', 'values' => array(), 'attrs' => array('onchange' => "javascript:document.forms['adm-css-edit'].submit();")), 'content' => array('type' => 'textarea', 'name' => 'content', 'caption' => _t('_adm_txt_css_content', $sFileName), 'value' => '', 'db' => array('pass' => 'XssHtml')), 'adm-css-save' => array('type' => 'submit', 'name' => 'adm-css-save', 'value' => _t('_adm_btn_css_save'))));
    //--- Get CSS files ---//
    $aItems = array();
    $sBasePath = BX_DIRECTORY_PATH_ROOT . "templates/tmpl_" . $GLOBALS['oSysTemplate']->getCode() . "/css/";
    $rHandle = opendir($sBasePath);
    while (($sFile = readdir($rHandle)) !== false) {
        if (is_file($sBasePath . $sFile) && substr($sFile, -3) == 'css') {
            $aItems[] = array('key' => $sFile, 'value' => $sFile);
        }
    }
    closedir($rHandle);
    $sCurrentFile = isset($_POST['css_file']) && preg_match("/^\\w+\\.css\$/", $_POST['css_file']) ? $_POST['css_file'] : $aItems[0]['key'];
    $aForm['inputs']['css_file']['value'] = $sCurrentFile;
    $aForm['inputs']['css_file']['values'] = $aItems;
    //--- Get CSS file's content ---//
    $sContent = '';
    $sAbsolutePath = $sBasePath . $sCurrentFile;
    if (strlen($sCurrentFile) > 0 && is_file($sAbsolutePath)) {
        $rHandle = fopen($sAbsolutePath, 'r');
        while (!feof($rHandle)) {
            $sContent .= fgets($rHandle, 4096);
        }
        fclose($rHandle);
    }
    //$aForm['inputs']['content']['value'] = isset($_POST['content']) ? $_POST['content'] : $sContent;
    $aForm['inputs']['content']['value'] = $sContent;
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        if (file_exists($sAbsolutePath) && isRWAccessible($sAbsolutePath)) {
            $rHandle = fopen($sAbsolutePath, 'w');
            if ($rHandle) {
                fwrite($rHandle, clear_xss($_POST['content']));
                fclose($rHandle);
                $mixedResult = '_adm_txt_css_success_save';
            } else {
                $mixedResult = '_adm_txt_css_failed_save';
            }
        } else {
            $mixedResult = '_adm_txt_css_cannot_write';
        }
    }
    $sResult = $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $oForm->getCode()));
    if ($mixedResult !== true && !empty($mixedResult)) {
        $sResult = MsgBox(_t($mixedResult, $sCurrentFile), 3) . $sResult;
    }
    return $sResult;
}
Example #15
0
 function displayManualOrderWindow($aForm)
 {
     $oForm = new BxTemplFormView($aForm);
     $sContent = $this->parseHtmlByName('manual_order_form.html', array('form' => $oForm->getCode(), 'loading' => LoadingBox('pmt-order-manual-loading')));
     return PopupBox('pmt-manual-order', _t($this->_sLangsPrefix . 'wcpt_manual_order'), $sContent);
 }
Example #16
0
 function getBlockCode_AccountControl()
 {
     global $oTemplConfig, $aPreValues;
     //Labels
     $sProfileStatusC = _t('_Profile status');
     $sPresenceC = _t('_Presence');
     $sMembershipC = _t('_Membership2');
     $sLastLoginC = _t('_Last login');
     $sRegistrationC = _t('_Registration');
     $sEmailC = _t('_Email');
     $sMembersC = ' ' . _t('_Members');
     $sProfileC = _t('_Profile');
     $sContentC = _t('_Content');
     //--- General Info block ---//
     $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", $this->aMemberInfo['ID'], $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;
     }
     $oForm = bx_instance('BxDolFormCheckerHelper');
     $sMembStatus = GetMembershipStatus($this->aMemberInfo['ID']);
     $sLastLogin = '******';
     if (!empty($this->aMemberInfo['DateLastLogin']) && $this->aMemberInfo['DateLastLogin'] != "0000-00-00 00:00:00") {
         $sLastLoginTS = $oForm->_passDateTime($this->aMemberInfo['DateLastLogin']);
         $sLastLogin = getLocaleDate($sLastLoginTS, BX_DOL_LOCALE_DATE);
     }
     $sRegistration = 'never';
     if (!empty($this->aMemberInfo['DateReg']) && $this->aMemberInfo['DateReg'] != "0000-00-00 00:00:00") {
         $sRegistrationTS = $oForm->_passDateTime($this->aMemberInfo['DateReg']);
         $sRegistration = getLocaleDate($sRegistrationTS, BX_DOL_LOCALE_DATE);
     }
     //--- Presence block ---//
     require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolUserStatusView.php';
     $oStatusView = new BxDolUserStatusView();
     $sUserStatus = $oStatusView->getMemberMenuStatuses();
     //--- Content block ---//
     $aAccountCustomStatElements = $GLOBALS['MySQL']->fromCache('sys_account_custom_stat_elements', 'getAllWithKey', 'SELECT * FROM `sys_account_custom_stat_elements`', 'ID');
     $aPQStatisticsElements = $GLOBALS['MySQL']->fromCache('sys_stat_member', 'getAllWithKey', 'SELECT * FROM `sys_stat_member`', 'Type');
     $aCustomElements = array();
     foreach ($aAccountCustomStatElements as $iID => $aMemberStats) {
         $sUnparsedLabel = $aMemberStats['Label'];
         $sUnparsedValue = $aMemberStats['Value'];
         $sLabel = _t($sUnparsedLabel);
         $sUnparsedValue = str_replace('__site_url__', BX_DOL_URL_ROOT, $sUnparsedValue);
         //step 1 - replacements of keys
         $sLblTmpl = '__l_';
         $sTmpl = '__';
         while (($iStartPos = strpos($sUnparsedValue, $sLblTmpl)) !== false) {
             $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1);
             if ($iEndPos <= $iStartPos) {
                 break;
             }
             $sSubstr = substr($sUnparsedValue, $iStartPos + strlen($sLblTmpl), $iEndPos - $iStartPos - strlen($sLblTmpl));
             $sKeyValue = mb_strtolower(_t('_' . $sSubstr));
             $sUnparsedValue = str_replace($sLblTmpl . $sSubstr . $sTmpl, $sKeyValue, $sUnparsedValue);
         }
         //step 2 - replacements of Stat keys
         while (($iStartPos = strpos($sUnparsedValue, $sTmpl, 0)) !== false) {
             $iEndPos = strpos($sUnparsedValue, $sTmpl, $iStartPos + 1);
             if ($iEndPos <= $iStartPos) {
                 break;
             }
             $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);
         }
         $sTrimmedLabel = trim($sUnparsedLabel, '_');
         $aCustomElements[$sTrimmedLabel] = array('type' => 'custom', 'name' => $sTrimmedLabel, 'content' => '<b>' . $sLabel . ':</b> ' . $sUnparsedValue, 'colspan' => true);
     }
     $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' => get_member_thumbnail($this->aMemberInfo['ID'], 'none', true), 'colspan' => true), 'Status' => array('type' => 'custom', 'name' => 'Status', 'content' => '<b>' . $sProfileStatusC . ':</b> ' . $sProfileStatus . '<br />' . $sProfileStatusMess, 'colspan' => true), 'Email' => array('type' => 'custom', 'name' => 'Email', 'content' => '<b>' . $sEmailC . ':</b> ' . $this->aMemberInfo['Email'] . '<br />' . _t('_sys_txt_ac_manage_subscriptions'), '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), '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')));
     //custom
     if (!empty($aCustomElements)) {
         $aForm['inputs'] = array_merge($aForm['inputs'], array('header5' => array('type' => 'block_header', 'caption' => $sContentC, 'collapsable' => true, 'collapsed' => true)), $aCustomElements, array('header5_end' => array('type' => 'block_end')));
     }
     $oForm = new BxTemplFormView($aForm);
     $sContent = $GLOBALS['oSysTemplate']->parseHtmlByName('member_account_control.html', array('content' => $oForm->getCode()));
     return array($sContent, array(), array(), false);
 }
 function getBlockCode_delete()
 {
     if (!in_array('delete', $this->aCurrentBlocks['blocks'])) {
         return '';
     }
     $aForm = array('form_attrs' => array(), 'inputs' => array('info' => array('type' => 'custom', 'content' => _t('_' . $this->oConfig->getMainPrefix() . '_album_delete_warning')), 'submit' => array('type' => 'submit', 'name' => 'submit', 'value' => _t('_' . $this->oConfig->getMainPrefix() . '_album_delete_confirm'), 'attrs' => array('onclick' => "getHtmlData('ajaxy_popup_result_div', '" . BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . "album_delete/" . $this->aAddParams[1] . "'); return false;"))));
     bx_import("BxTempFormView");
     $oForm = new BxTemplFormView($aForm);
     $sCode = $oForm->getCode() . '<div id="ajaxy_popup_result_div"></div>';
     return array($sCode, $this->getTopMenu('delete'));
 }
Example #18
0
    $mail_ret = sendMail($recipient, $aTemplate['Subject'], $aTemplate['Body'], $memb_arr['ID'], $aPlus, 'html', false, true);
    // create system event
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php';
    $oZ = new BxDolAlerts('profile', 'password_restore', $memb_arr['ID']);
    $oZ->alert();
    $_page['header'] = _t("_Recognized");
    $_page['header_text'] = _t("_RECOGNIZED", $site['title']);
    if ($mail_ret) {
        $action_result = _t("_MEMBER_RECOGNIZED_MAIL_SENT", $site['url'], $site['title']);
    } else {
        $action_result = _t("_MEMBER_RECOGNIZED_MAIL_NOT_SENT", $site['title']);
    }
    $sForm = '';
} else {
    $action_result = _t("_FORGOT", $site['title']);
    $sForm = $oForm->getCode();
}
$sPageCode = <<<BLAH
            <div class="bx-def-margin-sec-bottom bx-def-font-large">
                {$action_result}
            </div>
            {$sForm}
BLAH;
$_page_cont[$_ni]['page_main_code'] = DesignBoxContent($_page['header_text'], $sPageCode, 11);
// --------------- [END] page components
PageCode();
// --------------- page components functions
function generateUserNewPwd($ID)
{
    $sPwd = genRndPwd();
    $sSalt = genRndSalt();
 function showJoinForm()
 {
     //echoDbg( $this -> aValues );exit;
     $aFormAttrs = array('id' => 'join_form', 'onsubmit' => 'return validateJoinForm(this);');
     $aTableAttrs = array('id' => 'join_form_table');
     $aFormParams = array('hidden' => $this->genHiddenFieldsArray());
     $aTableParams = array('double' => $this->bCoupleEnabled, 'second_enabled' => $this->bCouple);
     $aTableParams['headers'] = array('', _t('_First Person'), _t('_Second Person'));
     $aTableParams['headers_add'] = 'class="header form_second_col"' . ($this->bCouple ? '' : ' style="display: none;"');
     $aButtons = array(array('type' => 'submit', 'value' => _t('_Submit'), 'class' => 'input_submit'));
     /* @var $oForm BxTemplFormView */
     $oForm = new BxTemplFormView('join_form');
     $oForm->begin($aFormAttrs, $aTableAttrs, $aFormParams, $aTableParams);
     $aBlocks = $this->oPF->aArea[$this->iPage];
     foreach ($aBlocks as $aBlock) {
         $oForm->beginBlock(_t($aBlock['Caption']));
         foreach ($aBlock['Items'] as $aItem) {
             $aCol0 = array();
             $aCol0['Type'] = $aItem['Type'];
             $aCol0['Name'] = $aItem['Type'] == 'system' ? $aItem['Name'] : $aItem['Name'] . '[0]';
             $aCol0['Mandatory'] = $aItem['Mandatory'];
             $aCol0['Control'] = $aItem['Control'];
             $aCol0['Values'] = $aItem['Values'];
             $aCol0['UseLKey'] = $aItem['UseLKey'];
             $aCol0['Caption'] = _t($aItem['Caption']);
             $aCol0['Desc'] = _t($aItem['Desc'], $aItem['Min'], $aItem['Max']);
             if ($aCol0['Desc'] == $aItem['Desc']) {
                 $aCol0['Desc'] = '';
             }
             // set value
             if (isset($this->aValues[0][$aItem['Name']])) {
                 $aCol0['Value'] = $this->aValues[0][$aItem['Name']];
             } elseif ($aItem['Name'] == 'Couple') {
                 $aCol0['Value'] = $this->bCouple;
             }
             // set error
             if (isset($this->aErrors[0][$aItem['Name']])) {
                 $aCol0['Error'] = $this->aErrors[0][$aItem['Name']];
             }
             // check second person's field
             if ($this->bCoupleEnabled and !in_array($aItem['Name'], $this->aCoupleMutualItems)) {
                 $aCol1 = array();
                 $aCol1['Type'] = $aItem['Type'];
                 $aCol1['Name'] = $aItem['Name'] . '[1]';
                 $aCol1['Control'] = $aItem['Control'];
                 $aCol1['Values'] = $aItem['Values'];
                 $aCol1['UseLKey'] = $aItem['UseLKey'];
                 // set value
                 if (isset($this->aValues[1][$aItem['Name']])) {
                     $aCol1['Value'] = $this->aValues[1][$aItem['Name']];
                 }
                 // set error
                 if (isset($this->aErrors[1][$aItem['Name']])) {
                     $aCol1['Error'] = $this->aValues[1][$aItem['Name']];
                 }
                 $oForm->addRow($aCol0, $aCol1);
             } else {
                 $oForm->addRow($aCol0);
             }
         }
         $oForm->endBlock();
     }
     $oForm->end($aButtons);
     echo $oForm->getCode();
     //boonex id
     /* if( getParam( 'enable_get_boonex_id' ) )
     		{
     			global $tmpl;
     			
     			echo "<div class=\"import_boonex_id\">";
     			$action = "boonex";
     			$text = '<div class="boonex_id">' . _t( '_Import BoonEx ID' ) . '</div>';
     			$table       = "Profiles";
     			$login_page  = "{$site['url']}member.php";
     			$join_page   = "{$site['url']}join_form.php";
     			$forgot_page = '';
     			$template    = "{$dir['root']}templates/tmpl_{$tmpl}/join_login_form.html";
     
     			echo LoginForm( $text,$action,$table,$login_page,$forgot_page,$template );
     
     			echo "</div>";
     		} */
 }
Example #20
0
 /**
  * Generate a Form to Create Blog
  *
  * @return HTML presentation of data
  */
 function GenCreateBlogForm($bBox = true)
 {
     $this->CheckLogged();
     if (!$this->isAllowedPostAdd()) {
         return $this->_oTemplate->displayAccessDenied();
     }
     $sRetHtml = $sCreateForm = '';
     $sActionsC = _t('_Actions');
     $sPleaseCreateBlogC = _t('_bx_blog_Please_create_blog');
     $sNoBlogC = _t('_bx_blog_No_blogs_available');
     $sMyBlogC = _t('_bx_blog_My_blog');
     $sNewBlogDescC = _t('_bx_blog_description');
     $sErrorC = _t('_bx_blog_create_blog_form_error');
     $sSubmitC = _t('_Submit');
     $sRetHtml .= MsgBox($sNoBlogC);
     if ($this->_iVisitorID || $this->isAdmin()) {
         $sRetHtml = MsgBox($sPleaseCreateBlogC);
         $sLink = $this->genBlogFormUrl();
         $sAddingForm = '';
         //adding form
         $aForm = array('form_attrs' => array('name' => 'CreateBlogForm', 'action' => $sLink, 'method' => 'post'), 'params' => array('db' => array('table' => $this->_oConfig->sSQLBlogsTable, 'key' => 'ID', 'submit_name' => 'add_button')), 'inputs' => array('header1' => array('type' => 'block_header', 'caption' => $sPleaseCreateBlogC), 'Description' => array('type' => 'textarea', 'html' => 0, 'name' => 'Description', 'caption' => $sNewBlogDescC, 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 255), 'error' => $sErrorC), 'db' => array('pass' => 'XssHtml')), 'hidden_action' => array('type' => 'hidden', 'name' => 'action', 'value' => 'create_blog'), 'add_button' => array('type' => 'submit', 'name' => 'add_button', 'value' => $sSubmitC)));
         $oForm = new BxTemplFormView($aForm);
         $oForm->initChecker();
         if ($oForm->isSubmittedAndValid()) {
             $this->CheckLogged();
             $iOwnID = $this->_iVisitorID;
             $aBlogsRes = $this->_oDb->getBlogInfo($iOwnID);
             if (!$aBlogsRes) {
                 $aValsAdd = array('OwnerID' => $iOwnID);
                 $iBlogID = $oForm->insert($aValsAdd);
                 //return $this->GenMemberBlog($iOwnID, false);
                 $bUseFriendlyLinks = $this->isPermalinkEnabled();
                 $sBlogAddLink = $bUseFriendlyLinks ? BX_DOL_URL_ROOT . 'blogs/my_page/add/' : $this->genBlogFormUrl() . '?action=my_page&mode=add';
                 header('Location:' . $sBlogAddLink);
                 return $this->GenMyPageAdmin('add');
             } else {
                 return MsgBox($sErrorC);
             }
         } else {
             $sAddingForm = $oForm->getCode();
         }
         $aVars = array('content' => $sAddingForm);
         $sAddingForm = $this->_oTemplate->parseHtmlByName('default_padding.html', $aVars);
         $sCreateForm = $bBox ? DesignBoxContent($sActionsC, $sAddingForm, 1) : $sAddingForm;
     }
     $sMyBlogResult = $bBox ? DesignBoxContent($sMyBlogC, $sRetHtml, 1) : $sRetHtml;
     return $sMyBlogResult . $sCreateForm;
 }
Example #21
0
 /**
  * Get quick upload form in popup.
  * @param string $sSelected - album URI (optional)
  */
 function actionUpload($sSelected = '')
 {
     header('Content-Type: text/html; charset=UTF-8');
     $sLangPref = '_' . $this->_oConfig->getMainPrefix();
     if (!$this->_iProfileId || !$this->isAllowedAdd()) {
         $sKey = _t($sLangPref . '_access_denied');
         echo DesignBoxContent($sKey, MsgBox($sKey), 1);
         exit;
     }
     $this->checkDefaultAlbums($this->_iProfileId);
     $aAlbumParams = array('owner' => $this->_iProfileId, 'show_empty' => TRUE, 'hide_default' => TRUE);
     $iAlbumsCount = $this->oAlbums->getAlbumCount($aAlbumParams);
     $aAlbums = array();
     if ($iAlbumsCount) {
         $aAlbumsList = $this->oAlbums->getAlbumList($aAlbumParams, 1, $iAlbumsCount);
         foreach ($aAlbumsList as $aAlbum) {
             $aAlbums[$aAlbum['ID']] = $aAlbum['Caption'];
         }
         if (!empty($sSelected)) {
             $aAlbum = $this->oAlbums->getAlbumInfo(array('fileuri' => $sSelected), array('ID', 'Uri'));
             $sSelected = !empty($aAlbum) && is_array($aAlbum) ? (int) $aAlbum['ID'] : '';
         }
     } else {
         $aDefaultAlbums = $this->_oConfig->getDefaultAlbums(true, array('{nickname}' => getUsername($this->_iProfileId)));
         foreach ($aDefaultAlbums as $sDefaultAlbum) {
             $aAlbums[$sDefaultAlbum] = $sDefaultAlbum;
         }
     }
     $aPrivFieldView = $this->oAlbumPrivacy->getGroupChooser($this->_iProfileId, $this->_oConfig->getUri(), 'album_view', array(), _t($sLangPref . '_album_view'));
     $aForm = $this->getInstanceUploadFormArray($aAlbums, $aPrivFieldView);
     if (!empty($sSelected)) {
         $aForm['inputs']['albums']['value'] = $sSelected;
         $aForm['inputs']['title']['tr_attrs']['style'] = 'display:none';
         $aForm['inputs']['allow_view']['tr_attrs']['style'] = 'display:none';
     }
     $oForm = new BxTemplFormView($aForm);
     $sCode = $this->_oTemplate->parseHtmlByName('popup.html', array('title' => _t($sLangPref . '_upload_instance'), 'content' => $this->_oTemplate->parseHtmlByName('default_padding.html', array('content' => $this->_oTemplate->addJs(array('albums.js'), TRUE) . $oForm->getCode()))));
     echo $GLOBALS['oFunctions']->transBox($sCode, TRUE);
     exit;
 }
 function _GenSendFileInfoForm($iFileID, $aDefaultValues = array(), $aPossibleImage = array(), $aPossibleDuration = array())
 {
     header("Content-type: text/html; charset=utf-8");
     $this->addJsTranslation(array('_bx_' . $this->sUploadTypeLC . 's_val_title_err', '_bx_' . $this->sUploadTypeLC . 's_val_descr_err'));
     $oCategories = new BxDolCategories();
     $oCategories->getTagObjectConfig();
     $aFormCategories['categories'] = $oCategories->getGroupChooser('bx_' . $this->sUploadTypeLC . 's', $this->_iOwnerId, true);
     $aFormCategories['categories']['required'] = false;
     $sKey = 'album';
     $aAlbums = array();
     if ($this->_aExtras[$sKey] != '') {
         $aAlbums[BX_DOL_UPLOADER_EP_PREFIX . $sKey] = array('type' => 'hidden', 'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey, 'value' => stripslashes($this->_aExtras[$sKey]));
     } else {
         $oAlbum = new BxDolAlbums('bx_' . $this->sUploadTypeLC . 's');
         $aAlbumList = $oAlbum->getAlbumList(array('owner' => $this->_iOwnerId));
         if (count($aAlbumList) > 0) {
             foreach ($aAlbumList as $aValue) {
                 $aList[$aValue['ID']] = stripslashes($aValue['Caption']);
             }
         } else {
             $sDefName = $oAlbum->getAlbumDefaultName();
             $aList[$sDefName] = stripslashes($sDefName);
         }
         $aAlbums['album'] = array('type' => 'select_box', 'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey, 'caption' => _t('_sys_album'), 'values' => $aList);
     }
     $sCaptionVal = $this->sSendFileInfoFormCaption != '' ? $this->sSendFileInfoFormCaption : _t('_Info');
     // processing of possible default values
     $aInputValues = array('title', 'tags', 'description', 'type', $this->sUploadTypeLC);
     foreach ($aInputValues as $sField) {
         $sEmpty = $sField == 'type' ? 'upload' : '';
         $sTemp = isset($aDefaultValues[$sField]) ? strip_tags($aDefaultValues[$sField]) : $sEmpty;
         $aDefaultValues[$sField] = $sTemp;
     }
     $aForm = array('form_attrs' => array('id' => $this->sUploadTypeLC . '_file_info_form', 'method' => 'post', 'action' => $this->sWorkingFile, 'target' => 'upload_file_info_frame_' . $iFileID), 'inputs' => array('header2' => array('type' => 'block_header', 'caption' => $sCaptionVal, 'collapsable' => false), 'title' => array('type' => 'text', 'name' => 'title', 'caption' => _t('_Title'), 'required' => true, 'value' => $aDefaultValues['title']), 'tags' => array('type' => 'text', 'name' => 'tags', 'caption' => _t('_Tags'), 'info' => _t('_Tags_desc'), 'value' => $aDefaultValues['tags']), 'description' => array('type' => 'textarea', 'name' => 'description', 'caption' => _t('_Description'), 'value' => $aDefaultValues['description']), 'media_id' => array('type' => 'hidden', 'name' => 'file_id', 'value' => $iFileID), 'hidden_action' => array('type' => 'hidden', 'name' => 'action', 'value' => 'accept_file_info'), $this->sUploadTypeLC => array('type' => 'hidden', 'name' => $this->sUploadTypeLC, 'value' => $aDefaultValues[$this->sUploadTypeLC]), 'type' => array('type' => 'hidden', 'name' => 'type', 'value' => $aDefaultValues['type'])));
     //--- Process Extras ---//
     foreach ($this->_aExtras as $sKey => $mixedValue) {
         $aForm['inputs'][BX_DOL_UPLOADER_EP_PREFIX . $sKey] = array('type' => 'hidden', 'name' => BX_DOL_UPLOADER_EP_PREFIX . $sKey, 'value' => $mixedValue);
     }
     // merging categories
     $aForm['inputs'] = $this->getUploadFormArray($aForm['inputs'], array($aFormCategories, $aAlbums));
     if (is_array($aPossibleImage) && count($aPossibleImage) > 0) {
         $aForm['inputs'] = array_merge($aForm['inputs'], $aPossibleImage);
     }
     if (is_array($aPossibleDuration) && count($aPossibleDuration) > 0) {
         $aForm['inputs'] = array_merge($aForm['inputs'], $aPossibleDuration);
     }
     $aForm['inputs'][] = array('type' => 'input_set', 'colspan' => true, 0 => array('type' => 'submit', 'name' => 'upload', 'value' => _t('_Submit'), 'colspan' => true, 'attrs' => array('onclick' => "return parent." . $this->_sJsPostObject . ".doValidateFileInfo(this, '" . $iFileID . "');")), 1 => array('type' => 'button', 'name' => 'delete', 'value' => _t('_bx_' . $this->sUploadTypeLC . 's_admin_delete'), 'colspan' => true, 'attrs' => array('onclick' => "return parent." . $this->_sJsPostObject . ".cancelSendFileInfo('" . $iFileID . "', '" . $this->sWorkingFile . "'); ")));
     $oForm = new BxTemplFormView($aForm);
     $sForm = $this->parseHtmlByName('uploader_regular_info.html', array('id' => $iFileID, 'form' => $oForm->getCode()));
     $sForm = str_replace(array("'", "\r", "\n"), array("\\'"), $sForm);
     return "<script src='" . BX_DOL_URL_ROOT . "inc/js/jquery.webForms.js' type='text/javascript' language='javascript'></script><script type='text/javascript'>parent." . $this->_sJsPostObject . ".genSendFileInfoForm('" . $iFileID . "', '" . $sForm . "'); parent." . $this->_sJsPostObject . "._loading(false);</script>";
 }
Example #23
0
 function getForm($iUserId)
 {
     $aInputs = $this->_oDb->getForm();
     if (empty($aInputs)) {
         return '';
     }
     $sLangsPrefix = $this->_oConfig->getLangsPrefix();
     if ($iUserId == BX_PMT_ADMINISTRATOR_ID) {
         $this->_aForm['form_attrs']['action'] = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'admin/';
     }
     $bCollapsed = $this->_bCollapseFirst;
     $iProviderId = 0;
     $sProviderName = "";
     $aUserValues = $this->_oDb->getFormData($iUserId);
     foreach ($aInputs as $aInput) {
         $sReturnDataUrl = $this->_oConfig->getDataReturnUrl() . $sProviderName . '/' . $iUserId;
         if ($iProviderId != $aInput['provider_id']) {
             if (!empty($iProviderId)) {
                 $this->_aForm['inputs']['provider_' . $iProviderId . '_end'] = array('type' => 'block_end');
             }
             $this->_aForm['inputs']['provider_' . $aInput['provider_id'] . '_begin'] = array('type' => 'block_header', 'caption' => _t($aInput['provider_caption']), 'collapsable' => true, 'collapsed' => $bCollapsed);
             $iProviderId = $aInput['provider_id'];
             $sProviderName = $aInput['provider_name'];
             $bCollapsed = true;
         }
         $this->_aForm['inputs'][$aInput['name']] = array('type' => $aInput['type'], 'name' => $aInput['name'], 'caption' => _t($aInput['caption']), 'value' => $aUserValues[$aInput['id']]['value'], 'info' => _t($aInput['description']), 'attrs' => array('bx-data-provider' => $iProviderId), 'checker' => array('func' => $aInput['check_type'], 'params' => $aInput['check_params'], 'error' => _t($aInput['check_error'])));
         //--- Make some field dependent actions ---//
         switch ($aInput['type']) {
             case 'select':
                 if (empty($aInput['extra'])) {
                     break;
                 }
                 $aAddon = array('values' => array());
                 $aPairs = explode(',', $aInput['extra']);
                 foreach ($aPairs as $sPair) {
                     $aPair = explode('|', $sPair);
                     $aAddon['values'][] = array('key' => $aPair[0], 'value' => _t($aPair[1]));
                 }
                 break;
             case 'checkbox':
                 $this->_aForm['inputs'][$aInput['name']]['value'] = 'on';
                 $aAddon = array('checked' => $aUserValues[$aInput['id']]['value'] == 'on' ? true : false);
                 break;
             case 'value':
                 if (str_replace($aInput['provider_option_prefix'], '', $aInput['name']) == 'return_url') {
                     $this->_aForm['inputs'][$aInput['name']]['value'] = $sReturnDataUrl;
                 }
                 break;
         }
         if (!empty($aAddon) && is_array($aAddon)) {
             $this->_aForm['inputs'][$aInput['name']] = array_merge($this->_aForm['inputs'][$aInput['name']], $aAddon);
         }
     }
     $this->_aForm['inputs']['provider_' . $iProviderId . '_end'] = array('type' => 'block_end');
     $this->_aForm['inputs']['submit'] = array('type' => 'submit', 'name' => 'submit', 'value' => _t($sLangsPrefix . 'details_submit'));
     bx_import('BxTemplFormView');
     $oForm = new BxTemplFormView($this->_aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $aOptions = $this->_oDb->getOptions();
         foreach ($aOptions as $aOption) {
             $this->_oDb->updateOption($iUserId, $aOption['id'], process_db_input(isset($_POST[$aOption['name']]) ? $_POST[$aOption['name']] : "", BX_TAGS_STRIP));
         }
         header('Location: ' . $oForm->aFormAttrs['action']);
     } else {
         foreach ($oForm->aInputs as $aInput) {
             if (!empty($aInput['error'])) {
                 $iProviderId = (int) $aInput['attrs']['bx-data-provider'];
                 $oForm->aInputs['provider_' . $iProviderId . '_begin']['collapsed'] = false;
             }
         }
         return $oForm->getCode();
     }
 }
Example #24
0
function getQueueMessage()
{
    global $aPreValues;
    if ($_POST['msgs_id']) {
        $aSexValues = getFieldValues('Sex');
        foreach ($aSexValues as $sKey => $sValue) {
            $aSexValues[$sKey] = _t($sValue);
        }
        $aAgeValues = array('all' => _t('_All'), 'selectively' => _t('_Selectively'));
        $aStartAgesOptions = array();
        $aEndAgesOptions = array();
        $gl_search_start_age = (int) getParam('search_start_age');
        $gl_search_end_age = (int) getParam('search_end_age');
        for ($i = $gl_search_start_age; $i <= $gl_search_end_age; $i++) {
            $aStartAgesOptions[$i] = $i;
        }
        for ($i = $gl_search_start_age; $i <= $gl_search_end_age; $i++) {
            $aEndAgesOptions[$i] = $i;
        }
        $aCountryOptions = array('all' => _t('_All'));
        foreach ($aPreValues['Country'] as $key => $value) {
            $aCountryOptions[$key] = _t($value['LKey']);
        }
        $aMembershipOptions = array('all' => _t('_All'));
        $memberships_arr = getMemberships();
        foreach ($memberships_arr as $membershipID => $membershipName) {
            if ($membershipID == MEMBERSHIP_ID_NON_MEMBER) {
                continue;
            }
            $aMembershipOptions[$membershipID] = $membershipName;
        }
        $iRecipientMembers = (int) $GLOBALS['MySQL']->getOne("SELECT COUNT(`ID`) AS `count` FROM `Profiles` WHERE `Status`<>'Unconfirmed' AND `EmailNotify` = 1 LIMIT 1");
        $aForm = array('form_attrs' => array('name' => 'form_queue', 'class' => 'form_queue_form', 'action' => $GLOBALS['site']['url_admin'] . 'notifies.php', 'method' => 'post'), 'inputs' => array('Send1' => array('type' => 'checkbox', 'name' => 'send_to_subscribers', 'label' => _t('_adm_mmail_Send_to_subscribers'), 'value' => 'non', 'checked' => true), 'Send2' => array('type' => 'checkbox', 'name' => 'send_to_members', 'label' => _t('_adm_mmail_Send_to_members'), 'value' => 'memb', 'checked' => true, 'attrs' => array('onClick' => 'setControlsState();'), 'info' => _t('_adm_mmail_Send_to_members_info', $iRecipientMembers)), 'sex' => array('type' => 'checkbox_set', 'name' => 'sex', 'values' => $aSexValues, 'value' => array_keys($aSexValues)), 'Age' => array('type' => 'select', 'name' => 'age', 'caption' => _t('_adm_mmail_Age'), 'value' => 'all', 'values' => $aAgeValues, 'attrs' => array('onClick' => 'setAgeState();')), 'StartAge' => array('type' => 'select', 'name' => 'age_start', 'caption' => _t('_from'), 'values' => $aStartAgesOptions, 'value' => $gl_search_start_age), 'EndAge' => array('type' => 'select', 'name' => 'age_end', 'caption' => _t('_to'), 'values' => $aEndAgesOptions, 'value' => $gl_search_end_age), 'Country' => array('type' => 'select', 'name' => 'country', 'caption' => _t('_Country'), 'values' => $aCountryOptions, 'value' => 'all'), 'Membership' => array('type' => 'select', 'name' => 'membership', 'caption' => _t('_adm_mmi_membership_levels'), 'values' => $aMembershipOptions, 'value' => 'all'), 'msgs_id' => array('type' => 'hidden', 'name' => 'msgs_id', 'value' => (int) $_POST['msgs_id']), 'submit' => array('type' => 'submit', 'name' => 'queue_message', 'value' => _t('_Submit'))));
        $oForm = new BxTemplFormView($aForm);
        $sTmplResult = $GLOBALS['oAdmTemplate']->parseHtmlByName('notifies_filter.html', array());
        return DesignBoxContent(_t('_adm_mmail_Queue_message'), $oForm->getCode() . $sTmplResult, 11);
    }
}
Example #25
0
    function getFormsSearch($aParams)
    {
        // original member profile, used for setting default search params
        $aDefaultParams = $aParams['default_params'];
        $sSearchModeName = $this->iAreaID == 10 ? 'quick' : ($this->iAreaID == 11 ? 'adv' : 'simple');
        $sResult = '';
        $iFormCounter = 1;
        // generate blocks
        foreach ($this->aBlocks as $iBlockId => $aBlock) {
            $bAddFlags = true;
            // flags "online only" and "photos only"
            //collect inputs
            $aInputs = array();
            // create search mode hidden input
            $aInputs[] = array('type' => 'hidden', 'name' => 'search_mode', 'value' => $sSearchModeName);
            // generate block input
            $aInputs[] = array('type' => 'block_header', 'caption' => _t($aBlock['Caption']));
            // generate inputs for items of this block
            foreach ($aBlock['Items'] as $iItemId => $aItem) {
                if ($iItemId == 1 or $iItemId == 2) {
                    $bAddFlags = false;
                }
                // do not add flags when username or id available
                // generate input
                $aFormInput = array('name' => $aItem['Name'], 'caption' => _t($aItem['Caption']) != $aItem['Caption'] ? _t($aItem['Caption']) : null, 'info' => _t($aItem['Desc']) != $aItem['Desc'] ? _t($aItem['Desc']) : null, 'value' => empty($aDefaultParams[$aItem['Name']]) ? '' : $aDefaultParams[$aItem['Name']]);
                switch ($aItem['Type']) {
                    case 'text':
                    case 'area':
                        // search in area like simple keyword
                    // search in area like simple keyword
                    case 'html_area':
                        // search in area like simple keyword
                        $aFormInput['type'] = 'text';
                        break;
                    case 'bool':
                        $aFormInput['value'] = 'yes';
                        $aFormInput['type'] = 'checkbox';
                        break;
                    case 'select_one':
                    case 'select_set':
                        switch ($aItem['Control']) {
                            case 'select':
                                $aFormInput['type'] = 'select_box';
                                $aFormInput['attrs']['add_other'] = 'false';
                                break;
                            case 'checkbox':
                                $aFormInput['type'] = $aItem['Name'] == 'LookingFor' ? 'select' : 'checkbox_set';
                                break;
                            default:
                                $aFormInput['type'] = $aItem['Name'] == 'Sex' ? 'checkbox_set' : 'select';
                        }
                        $aFormInput['values'] = $this->convertValues4Input($aItem['Values'], $aItem['UseLKey']);
                        if (is_array($aFormInput['value'])) {
                            $aFormInput['value'] = $aFormInput['value'][0];
                        }
                        break;
                    case 'date':
                    case 'num':
                    case 'range':
                        $aFormInput['type'] = 'doublerange';
                        /* Changed because of realisation of WebForms 2.0 */
                        $aFormInput['attrs'] = array('min' => $aItem['Min'], 'max' => $aItem['Max']);
                        break;
                    case 'system':
                        switch ($aItem['Name']) {
                            case 'ID':
                                $aFormInput['type'] = 'number';
                                $aFormInput['attrs']['min'] = 1;
                                break;
                            case 'Keyword':
                                $aFormInput['type'] = 'text';
                                break;
                            case 'Location':
                                $sLivingWithinC = _t("_living within");
                                $sMilesC = _t("_miles");
                                $sKmC = _t("_kilometers");
                                $sFromZipC = _t("_from zip/postal code");
                                $aFormInput['type'] = 'custom';
                                $aFormInput['content'] = <<<EOF
                                    <div class="location_wrapper">
                                        <div>
                                            <input type="text" name="distance" class="form_input_distance bx-def-round-corners-with-border bx-def-font" />
                                            <select name="metric" class="form_input_select form_input_metric">
                                                <option selected="selected" value="miles">{$sMilesC}</option>
                                                <option value="km">{$sKmC}</option>
                                            </select>
                                        </div>
                                        <div>
                                            {$sFromZipC}
                                            <input type="text" name="zip" class="form_input_zip bx-def-round-corners-with-border bx-def-font" />
                                        </div>
                                    </div>
EOF;
                                break;
                            case 'Couple':
                                if ('on' == getParam('enable_global_couple')) {
                                    $aFormInput['type'] = 'select';
                                    $aFormInput['values'] = array('no' => _t('_Single'), 'yes' => _t('_Couple'));
                                } else {
                                    $aFormInput['type'] = 'hidden';
                                    $aFormInput['value'] = 'no';
                                }
                                break;
                        }
                        break;
                }
                $aInputs[] = $aFormInput;
            }
            if ($bAddFlags) {
                // create input for "online only"
                $aInputs[] = array('type' => 'checkbox', 'name' => 'online_only', 'label' => _t('_online only'), 'checked' => !empty($aDefaultParams['online_only']) && $aDefaultParams['online_only'] == 'on');
                // create input for "with photos only"
                bx_import('BxDolMemberInfo');
                $oMemberInfo = BxDolMemberInfo::getObjectInstance(getParam('sys_member_info_thumb'));
                if ($oMemberInfo->isAvatarSearchAllowed()) {
                    $aInputs[] = array('type' => 'checkbox', 'name' => 'photos_only', 'label' => _t('_With photos only'), 'checked' => !empty($aDefaultParams['photos_only']) && $aDefaultParams['photos_only'] == 'on');
                }
            }
            // create submit button
            $aInputs[] = array('type' => 'submit', 'name' => 'submit', 'value' => _t('_Search'), 'colspan' => true);
            // create form array
            $aForm = array('form_attrs' => array('method' => 'get', 'action' => $GLOBALS['site']['url'] . 'search.php', 'name' => $sSearchModeName . '_search_form' . $iFormCounter), 'inputs' => $aInputs);
            if (isset($aParams['form_attrs']) && is_array($aParams['form_attrs'])) {
                $aForm['form_attrs'] = array_merge($aForm['form_attrs'], $aParams['form_attrs']);
            }
            if (isset($aParams['inputs']) && is_array($aParams['inputs'])) {
                $aForm['inputs'] = array_merge($aForm['inputs'], $aParams['inputs']);
            }
            $oForm = new BxTemplFormView($aForm);
            $sResult .= $oForm->getCode();
            $iFormCounter++;
        }
        // block generation finished
        return $sResult;
    }
 function getSearchForm($aRedInputs = array(), $aRedForm = array())
 {
     $aForm = array('form_attrs' => array('id' => 'searchForm', 'action' => '', 'method' => 'post', 'enctype' => 'multipart/form-data', 'onsubmit' => ''), 'inputs' => array('keyword' => array('type' => 'text', 'name' => 'keyword', 'caption' => _t('_Keyword')), 'ownerName' => array('type' => 'text', 'name' => 'owner', 'caption' => _t('_Member'), 'attrs' => array('id' => 'ownerName')), 'status' => array('type' => 'select', 'name' => 'status', 'caption' => _t('_With status'), 'values' => array('any' => _t('_' . $this->_oConfig->getMainPrefix() . '_any'), 'approved' => _t('_' . $this->_oConfig->getMainPrefix() . '_approved'), 'disapproved' => _t('_' . $this->_oConfig->getMainPrefix() . '_disapproved'), 'pending' => _t('_' . $this->_oConfig->getMainPrefix() . '_pending'))), 'search' => array('type' => 'submit', 'name' => 'search', 'value' => _t('_Search'))));
     if (!empty($aRedInputs) && is_array($aRedInputs)) {
         $aForm['inputs'] = array_merge($aForm['inputs'], $aRedInputs);
     }
     if (!empty($aRedForm) && is_array($aRedForm)) {
         $aForm['form_attrs'] = array_merge($aForm['form_attrs'], $aRedForm);
     }
     $oForm = new BxTemplFormView($aForm);
     return $oForm->getCode();
 }
 /**
  * 'recheck' action handler
  */
 public function performActionAdd()
 {
     bx_import('BxTemplFormView');
     $aForm = array('form_attrs' => array('id' => 'bx_antispam_form_dnsbl_add', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=bx_antispam_grid_dnsbl&a=add', 'method' => 'post'), 'params' => array('db' => array('table' => 'bx_antispam_dnsbl_rules', 'key' => 'id', 'submit_name' => 'do_submit')), 'inputs' => array('country' => array('type' => 'select', 'name' => 'country', 'caption' => _t('_bx_antispam_field_country'), 'values' => BxDolForm::getDataItems('Country')), 'chain' => array('type' => 'radio_set', 'name' => 'chain', 'caption' => _t('_bx_antispam_field_action'), 'values' => array('spammers' => _t('_bx_antispam_chain_spammers'), 'whitelist' => _t('_bx_antispam_chain_whitelist')), 'value' => 'spammers'), 'submit' => array('type' => 'input_set', 0 => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_sys_submit')), 1 => array('type' => 'reset', 'name' => 'close', 'value' => _t('_sys_close'), 'attrs' => array('class' => 'bx-def-margin-sec-left', 'onclick' => '$(\'.bx-popup-applied:visible\').dolPopupHide();')))));
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         // if form is submitted and all fields are valid
         $aCustomValues = array('chain' => $oForm->getCleanValue('chain'), 'zonedomain' => sprintf("%s.countries.nerd.dk.", strtolower($oForm->getCleanValue('country'))), 'postvresp' => '127.0.0.2', 'url' => 'http://countries.nerd.dk/', 'comment' => '_bx_antispam_rule_note_country', 'added' => time(), 'active' => 1);
         $iRecentId = $oForm->insert($aCustomValues, true);
         // insert new record
         if ($iRecentId) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $iRecentId);
         } else {
             $aRes = array('msg' => _t('_sys_txt_error_occured'));
         }
         // if record adding failed, display error message
         $this->_echoResultJson($aRes, true);
     } else {
         // if form is not submitted or some fields are invalid, display popup with form
         bx_import('BxTemplFunctions');
         $s = BxTemplFunctions::getInstance()->popupBox($oForm->getId() . '_form', _t('_bx_antispam_popup_dnsbl_add'), $oForm->getCode() . '
             <script>
                 $(document).ready(function () {
                     $("#' . $oForm->getId() . '").ajaxForm({
                         dataType: "json",
                         beforeSubmit: function (formData, jqForm, options) {
                             bx_loading($("#' . $oForm->getId() . '"), true);
                         },
                         success: function (data) {
                             $(".bx-popup-applied:visible").dolPopupHide();
                             glGrids.' . $this->_sObject . '.processJson(data, "add");
                         }
                     });
                 });
             </script>');
         $this->_echoResultJson(array('popup' => array('html' => $s, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
Example #28
0
 function getAddSubcatForm($iSubCategoryID = 0, $bOnlyForm = false)
 {
     //admin side only
     $sSubmitC = _t('_bx_ads_add_subcategory');
     $sAction = 'add_sub_category';
     $aParentCategories = array();
     $vParentValues = $this->_oDb->getAllCatsInfo();
     while ($aCategInfo = mysql_fetch_assoc($vParentValues)) {
         $iID = $aCategInfo['ID'];
         $sName = $aCategInfo['Name'];
         $aParentCategories[$iID] = $sName;
     }
     $sTitle = $sDescription = '';
     $iParentID = 0;
     if ($iSubCategoryID) {
         $aSubcatInfos = $this->_oDb->getSubcatInfo($iSubCategoryID);
         $sTitle = $aSubcatInfos[0]['NameSub'];
         $sDescription = $aSubcatInfos[0]['Description'];
         $iParentID = (int) $aSubcatInfos[0]['IDClassified'];
     }
     //adding form
     $aForm = array('form_attrs' => array('name' => 'create_sub_cats_form', 'action' => 'javascript: void(0)', 'method' => 'post'), 'params' => array('db' => array('table' => $this->_oConfig->sSQLSubcatTable, 'key' => 'ID', 'submit_name' => 'add_button')), 'inputs' => array('action' => array('type' => 'hidden', 'name' => 'action', 'value' => $sAction), 'IDClassified' => array('type' => 'select', 'name' => 'IDClassified', 'caption' => _t('_bx_ads_parent_category'), 'values' => $aParentCategories, 'value' => $iParentID, 'db' => array('pass' => 'Int')), 'NameSub' => array('type' => 'text', 'name' => 'NameSub', 'caption' => _t('_Title'), 'required' => true, 'value' => $sTitle, 'checker' => array('func' => 'length', 'params' => array(3, 128), 'error' => _t('_bx_ads_title_error_desc', 128)), 'db' => array('pass' => 'Xss')), 'Description' => array('type' => 'text', 'name' => 'Description', 'caption' => _t('_Description'), 'value' => $sDescription, 'db' => array('pass' => 'Xss')), 'add_button' => array('type' => 'submit', 'name' => 'add_button', 'value' => $sSubmitC, 'attrs' => array('onClick' => "AdmCreateSubcategory('{$this->sHomeUrl}{$this->sCurrBrowsedFile}'); return false;"))));
     if ($iSubCategoryID) {
         $aForm['inputs']['hidden_postid'] = array('type' => 'hidden', 'name' => 'id', 'value' => $iSubCategoryID);
     }
     $sCode = '';
     $sJS = $this->_oTemplate->addJs('main.js', true);
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $aValsAdd = array();
         if ($iSubCategoryID == 0) {
             $sCategUri = uriGenerate(bx_get('NameSub'), $this->_oConfig->sSQLSubcatTable, 'SEntryUri');
             $aValsAdd['SEntryUri'] = $sCategUri;
         }
         $iLastId = -1;
         if ($iSubCategoryID > 0) {
             $oForm->update($iSubCategoryID, $aValsAdd);
             $iLastId = $iSubCategoryID;
         } else {
             $iLastId = $oForm->insert($aValsAdd);
         }
         if ($iLastId > 0) {
             $sCode = MsgBox(_t('_bx_ads_Sub_category_successfully_added'), 3);
         } else {
             $sCode = MsgBox(_t('_bx_ads_Sub_category_failed_add'), 3);
         }
     }
     if ($bOnlyForm) {
         return $sCode . $oForm->getCode();
     }
     $sResult = $sJS . $sCode . $oForm->getCode();
     if (bx_get('mode') == 'json') {
         require_once BX_DIRECTORY_PATH_PLUGINS . 'Services_JSON.php';
         $oJson = new Services_JSON();
         return $oJson->encode($sResult);
         exit;
     }
     $sResult = $this->_oTemplate->parseHtmlByName('default_margin.html', array('content' => $sResult));
     return $GLOBALS['oFunctions']->popupBox('ads_add_sub_category', _t('_bx_ads_add_subcategory'), $sResult);
 }
Example #29
0
function getManageBannersBlock()
{
    $sAsNew = _t('_adm_bann_Insert_as_new');
    $sErrorC = _t('_Error Occured');
    $sApplyChangesC = _t('_Submit');
    $sTopC = _t('_Top');
    $sLeftC = _t('_adm_bann_Left');
    $sRightC = _t('_adm_bann_Right');
    $sBottomC = _t('_Bottom');
    $sHShiftC = _t('_adm_bann_HShift');
    $sVShiftC = _t('_adm_bann_VShift');
    $sTitleC = _t('_Title');
    $sUrlC = _t('_URL');
    $sActiveC = _t('_Active');
    $sTextC = _t('_Text');
    $sStartDateC = _t('_Start date');
    $sEndDateC = _t('_Expiration date');
    $sDefaultC = _t('_adm_bann_default');
    $sPositionOnPageC = _t('_adm_bann_Position_on_the_page');
    // get start & end dates
    $start_date_default = "2008-01-01 00:00:00";
    $end_date_default = "2015-01-01 00:00:00";
    $start_date = bx_get('start_date') !== false ? bx_get('start_date') : $start_date_default;
    $end_date = bx_get('end_date') !== false ? bx_get('end_date') : $end_date_default;
    $Title = $Url = $Active = $Text = $Position = $lhshift = $lvshift = $rhshift = $rvshift = '';
    $iBannerID = (int) $_GET['banner_id'];
    $action = "new";
    if ($iBannerID > 0 && !strlen(bx_get('action'))) {
        //banner edit
        $banns_arr = db_arr("SELECT * FROM `sys_banners` WHERE `ID`='{$iBannerID}'");
        $action = "modify";
        $Title = $banns_arr['Title'];
        $Url = $banns_arr['Url'];
        $Text = $banns_arr['Text'];
        $Active = $banns_arr['Active'];
        $Position = $banns_arr['Position'];
        $lhshift = $banns_arr['lhshift'];
        $lvshift = $banns_arr['lvshift'];
        $rhshift = $banns_arr['rhshift'];
        $rvshift = $banns_arr['rvshift'];
        list($iYearStart, $iMonthStart, $iDayStart) = explode('-', $banns_arr['campaign_start']);
        //$start_date = "{$iDayStart}/{$iMonthStart}/{$iYearStart}";
        $start_date = "{$iYearStart}-{$iMonthStart}-{$iDayStart} 00:00:00";
        list($iYearEnd, $iMonthEnd, $iDayEnd) = explode('-', $banns_arr['campaign_end']);
        //$end_date = "{$iDayEnd}/{$iMonthEnd}/{$iYearEnd}";
        $end_date = "{$iYearEnd}-{$iMonthEnd}-{$iDayEnd} 00:00:00";
    }
    $sFormTitle = htmlspecialchars($Title);
    $sFormUrl = htmlspecialchars($Url);
    $sFormActiveState = $Active ? 'checked="checked"' : '';
    $sFormActiveStateVal = $Active ? 'yes' : '';
    $sFormActiveStateChk = $Active ? true : false;
    $sFormBannerText = $Text;
    $sFormStartDate = $start_date;
    $sFormStartDateDef = $start_date_default;
    $sFormEndDate = $end_date;
    $sFormEndDateDef = $end_date_default;
    $sTopPosState = substr_count($Position, "1") > 0 ? 'checked="checked"' : '';
    $sLeftPosState = substr_count($Position, "2") > 0 ? 'checked="checked"' : '';
    $sRightPosState = substr_count($Position, "3") > 0 ? 'checked="checked"' : '';
    $sBottomPosState = substr_count($Position, "4") > 0 ? 'checked="checked"' : '';
    $sTopShift = substr_count($Position, "2") > 0 ? $lhshift : '';
    $sLeftShift = substr_count($Position, "2") > 0 ? $lvshift : '';
    $sRightShift = substr_count($Position, "3") > 0 ? $rhshift : '';
    $sBottomShift = substr_count($Position, "3") > 0 ? $rvshift : '';
    $sActionAdd = $action == "modify" ? $sAsNew . '&nbsp;<input type=checkbox name=as_new />' : '';
    $sCustomPositions = <<<EOF
<table border=0 width=100% cellspacing=10 cellpading=20>
\t<tr>
\t\t<td colspan=5 align=center><input type=checkbox name="pos_top" {$sTopPosState} />{$sTopC}</td>
\t</tr>
\t<tr>
\t\t<td colspan=2 align=center><input type=checkbox name="pos_left" {$sLeftPosState} />{$sLeftC}</td>
\t\t<td>&nbsp;</td>
\t\t<td colspan=2 align=center><input type=checkbox name="pos_right" {$sRightPosState} />{$sRightC}</td>
\t</tr>
\t<tr>
\t\t<td>{$sHShiftC}</td>
\t\t<td>{$sVShiftC}</td>
\t\t<td>&nbsp;</td>
\t\t<td>{$sHShiftC}</td>
\t\t<td>{$sVShiftC}</td>
\t</tr>
\t<tr>
\t\t<td><input name="lhshift" type=input size=5 value={$sTopShift} /></td>
\t\t<td><input name="lvshift" type=input size=5 value={$sLeftShift} /></td>
\t\t<td>&nbsp;</td>
\t\t<td><input name="rhshift" type=input size=5 value={$sRightShift} /></td>
\t\t<td><input name="rvshift" type=input size=5 value={$sBottomShift} /></td>
\t</tr>
\t<tr>
\t\t<td colspan=5 align=center><input type=checkbox name="pos_bottom" {$sBottomPosState} />{$sBottomC}</td>
\t</tr>
</table>
{$sActionAdd}
EOF;
    $aForm = array('form_attrs' => array('name' => 'apply_ip_list_form', 'action' => $GLOBALS['site']['url_admin'] . 'banners.php', 'method' => 'post'), 'params' => array('db' => array('table' => 'sys_banners', 'key' => 'ID', 'submit_name' => 'add_button')), 'inputs' => array('BannerTitle' => array('type' => 'text', 'name' => 'Title', 'value' => $sFormTitle, 'caption' => $sTitleC, 'required' => true, 'checker' => array('func' => 'length', 'params' => array(2, 128), 'error' => _t('_chars_to_chars', 2, 128)), 'db' => array('pass' => 'Xss')), 'BannerUrl' => array('type' => 'text', 'name' => 'Url', 'value' => $sFormUrl, 'caption' => $sUrlC, 'required' => false, 'db' => array('pass' => 'Xss')), 'BannerActive' => array('type' => 'checkbox', 'name' => 'Active', 'caption' => $sActiveC, 'value' => 1, 'checked' => $sFormActiveStateChk), 'BannerText' => array('type' => 'textarea', 'name' => 'Text', 'value' => $sFormBannerText, 'caption' => $sTextC, 'required' => true, 'checker' => array('func' => 'length', 'params' => array(10, 32000), 'error' => _t('_chars_to_chars', 10, 32000)), 'db' => array('pass' => 'All')), 'StartDate' => array('type' => 'datetime', 'name' => 'start_date', 'value' => $sFormStartDate, 'caption' => $sStartDateC, 'label' => "{$sDefaultC}: {$sFormStartDateDef}", 'required' => true, 'checker' => array('func' => 'DateTime', 'error' => $sErrorC), 'display' => 'filterDate'), 'EndDate' => array('type' => 'datetime', 'name' => 'end_date', 'value' => $sFormEndDate, 'caption' => $sEndDateC, 'label' => "{$sDefaultC}: {$sFormEndDateDef}", 'required' => true, 'checker' => array('func' => 'DateTime', 'error' => $sErrorC), 'display' => 'filterDate'), 'Positions' => array('type' => 'custom', 'name' => 'Position', 'caption' => $sPositionOnPageC, 'content' => $sCustomPositions), 'ID' => array('type' => 'hidden', 'name' => 'banner_id', 'value' => $iBannerID), 'Action' => array('type' => 'hidden', 'name' => 'action', 'value' => $action), 'add_button' => array('type' => 'submit', 'name' => 'add_button', 'value' => $sApplyChangesC)));
    $sResult = '';
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        list($iYearStart, $iMonthStart, $iDayStart) = explode('-', $oForm->getCleanValue('start_date'));
        $sDateStart = "{$iYearStart}-{$iMonthStart}-{$iDayStart}";
        list($iYearEnd, $iMonthEnd, $iDayEnd) = explode('-', $oForm->getCleanValue('end_date'));
        $sDateEnd = "{$iYearEnd}-{$iMonthEnd}-{$iDayEnd}";
        $sCurTime = date("Y-m-d");
        // 2010-12-31
        $iLastId = (int) $oForm->getCleanValue('banner_id');
        $banner_pos = "";
        if ($oForm->getCleanValue('pos_top') == "on") {
            $banner_pos .= '1';
        }
        if ($oForm->getCleanValue('pos_left') == "on") {
            $banner_pos .= '2';
        }
        if ($oForm->getCleanValue('pos_right') == "on") {
            $banner_pos .= '3';
        }
        if ($oForm->getCleanValue('pos_bottom') == "on") {
            $banner_pos .= '4';
        }
        $banner_pos = (int) $banner_pos;
        $banner_lhshift = (int) $oForm->getCleanValue('lhshift');
        $banner_lvshift = (int) $oForm->getCleanValue('lvshift');
        $banner_rhshift = (int) $oForm->getCleanValue('rhshift');
        $banner_rvshift = (int) $oForm->getCleanValue('rvshift');
        $aValsAdd = array('Position' => $banner_pos, 'Active' => '' != $oForm->getCleanValue('Active') ? 1 : 0, 'Created' => $sCurTime, 'campaign_start' => $sDateStart, 'campaign_end' => $sDateEnd, 'lhshift' => $banner_lhshift, 'lvshift' => $banner_lvshift, 'rhshift' => $banner_rhshift, 'rvshift' => $banner_rvshift);
        if ($oForm->getCleanValue('action') == 'modify' && $oForm->getCleanValue('as_new') != "on" && $iLastId > 0) {
            $oForm->update($iLastId, $aValsAdd);
        }
        if ($oForm->getCleanValue('action') == 'new' || $oForm->getCleanValue('as_new') == "on" && $oForm->getCleanValue('action') == 'modify') {
            $iLastId = $oForm->insert($aValsAdd);
        }
        $sResult = $iLastId > 0 ? MsgBox(_t('_Success'), 3) : MsgBox($sErrorC);
    }
    return DesignBoxContent(_t('_adm_bann_title'), $sResult . $oForm->getCode(), 1);
}
Example #30
0
 function getBlockCode_edit()
 {
     if (!in_array('edit', $this->aCurrentBlocks['blocks'])) {
         return '';
     }
     $aInfo = $this->oAlbum->getAlbumInfo(array('fileUri' => $this->aAddParams[1], 'owner' => $this->iOwnerId));
     if ($aInfo['Owner'] != $this->iOwnerId) {
         $sCode = MsgBox(_t('_Access denied'));
     }
     $oAlbumPrivacy = new BxPhotosPrivacy('sys_albums', 'ID', 'Owner');
     $aPrivFieldView = $oAlbumPrivacy->getGroupChooser($this->iOwnerId, $this->oConfig->getUri(), 'album_view');
     $aPrivFieldView['value'] = $aInfo['AllowAlbumView'];
     $aReInputs = array('title' => array('name' => 'Caption', 'value' => $aInfo['Caption']), 'location' => array('name' => 'Location', 'value' => $aInfo['Location']), 'description' => array('name' => 'Description', 'value' => $aInfo['Description']), 'allow_view' => $aPrivFieldView, 'id' => array('type' => 'hidden', 'name' => 'ID', 'value' => (int) $aInfo['ID']), 'uri' => array('type' => 'hidden', 'name' => 'Uri', 'value' => $this->aAddParams[1]));
     $aReForm = array('id' => $this->oConfig->getMainPrefix() . '_upload_form', 'method' => 'post', 'action' => $this->oConfig->getBaseUri() . 'albums/my/edit/' . strip_tags($this->aAddParams[1] . '/' . strip_tags($this->aAddParams[2]) . '/' . strip_tags($this->aAddParams[3])));
     $aForm = $this->oTemplate->getAlbumFormEditArray($aReInputs, $aReForm);
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $aFields = array('Caption', 'Location', 'Description', 'AllowAlbumView');
         $aData = array();
         foreach ($aFields as $sValue) {
             if (isset($_POST[$sValue])) {
                 $aData[$sValue] = $_POST[$sValue];
             }
         }
         if ($this->oAlbum->updateAlbumById((int) $_POST['ID'], $aData)) {
             $sKey = $this->oConfig->getMainPrefix() . '_album_save_success';
         } else {
             $sKey = 'Error';
         }
         $sCode = MsgBox(_t('_' . $sKey));
     } else {
         $sCode = $oForm->getCode();
     }
     $GLOBALS['oTopMenu']->setCustomSubHeader($aInfo['Caption']);
     return array($sCode, $this->getTopMenu('edit'));
 }