Esempio n. 1
0
 function clk_prepare()
 {
     $local_input = "/home/hadoop/lq/kan114/BaiduHotKeyWords/BKW_Src/JBKW/input/";
     $local_dec_input = "/home/hadoop/lq/kan114/BaiduHotKeyWords/BKW_Src/JBKW/temp/conv_input";
     decode_text($local_input, $local_dec_input);
     $hdfs_input = "/user/jbkw/" . $this->day . "/raw_input";
     $hdfs_output = "/user/jbkw/" . $this->day . "/prepare_output_prepare";
     //$this->ha_utils->remove_hdfs($hdfs_input);
     $ret = $this->ha_utils->load_raw_hdfs($local_dec_input, $hdfs_input);
     echo "this_day:" . $this->day . "\n";
     echo "hdfs_input:" . $hdfs_input . "\n";
     echo "hdfs_output:" . $hdfs_output . "\n";
     $ret = $this->ha_utils->remove_hdfs($hdfs_output);
     $cmd = "jar out/jbkw.jar RankUserUrl {$this->day} {$hdfs_input} {$hdfs_output}";
     $ret = $this->ha_utils->run_raw($cmd);
     if ($ret == false) {
         $this->error("Can not prepare jbkw:" . $this->day);
         return false;
     }
     /*
       $local_tt_input="/home/hadoop/lq/kan114/BaiduHotKeyWords/BKW_Src/JBKW/tt";
       $hdfs_tt_input="/user/jbkw/".$this->day."/raw_tt_input";
       $ret=$this->ha_utils->load_raw_hdfs($local_tt_input,$hdfs_tt_input);
     */
     $hdfs_tt_sec_output = "/user/jbkw/" . $this->day . "/prepare_output_sec_tt";
     $this->ha_utils->remove_hdfs($hdfs_tt_sec_output);
     $cmd = "jar  out/jbkw.jar RankUserUrlSec {$this->day} {$hdfs_output} {$hdfs_tt_sec_output} ";
     $ret = $this->ha_utils->run_raw($cmd);
     if ($ret == false) {
         $this->error("Can not prepare jbkw sec:" . $this->day);
         return false;
     }
 }
Esempio n. 2
0
 /**
  *	Returns menu name	
  */
 public function GetName()
 {
     if (isset($this->menu['menu_name'])) {
         return decode_text($this->menu['menu_name']);
     } else {
         return '';
     }
 }
 /**
  *	Returns parameter value by name
  *		@param $field_name	
  */
 public function GetParameter($field_name = '')
 {
     if (isset($this->res[$field_name])) {
         return decode_text($this->res[$field_name]);
     } else {
         return '';
     }
 }
Esempio n. 4
0
				<td nowrap="nowrap"><input type="password" id="frmReg_user_password1" name="user_password1" size="32" maxlength="20" value="<?php 
        echo decode_text($user_password1);
        ?>
" autocomplete='off' /></td>
			</tr>		    
			<tr>
				<td align="<?php 
        echo Application::Get('defined_right');
        ?>
"><?php 
        echo _CONFIRM_PASSWORD;
        ?>
</td>
				<td class="mandatory_star">*</td>
				<td nowrap="nowrap"><input type="password" id="frmReg_user_password2" name="user_password2" size="32" maxlength="20" value="<?php 
        echo decode_text($user_password2);
        ?>
" autocomplete='off' /></td>
			</tr>

			<?php 
        if ($image_verification_allow == 'yes') {
            ?>
			<tr><td height="20" colspan="3"><b><?php 
            echo _IMAGE_VERIFICATION;
            ?>
</b><hr size="1" noshade="noshade" /></td></tr>
			<tr valign="top">
			<td align="<?php 
            echo Application::Get('defined_left');
            ?>
Esempio n. 5
0
			<script type="text/javascript">
			 google.load(\'visualization\', \'1\', {\'packages\': [\'geomap\']});
			 google.setOnLoadCallback(drawMap);
			
			  function drawMap() {
				var data = new google.visualization.DataTable();
				';
        if ($result[1] > 0) {
            $first_tab_content .= $nl . 'data.addRows(' . $result[1] . ');';
            $first_tab_content .= $nl . 'data.addColumn(\'string\', \'' . _COUNTRY . '\');';
            $first_tab_content .= $nl . 'data.addColumn(\'number\', \'' . _POPULARITY . '\');';
            $first_tab_content .= $nl . 'data.addColumn(\'string\', \'HOVER\', \'\');';
            for ($i = 0; $i < $result[1]; $i++) {
                $first_tab_content .= $nl . 'data.setValue(' . $i . ', 0, \'' . $result[0][$i]['country_abbrv'] . '\');';
                $first_tab_content .= $nl . 'data.setValue(' . $i . ', 1, ' . (int) $result[0][$i]['cnt'] . ');';
                $first_tab_content .= $nl . 'data.setValue(' . $i . ', 2, \'' . decode_text($result[0][$i]['country_name']) . '\');';
            }
        } else {
            $first_tab_content .= $nl . 'data.addRows(1);';
            $first_tab_content .= $nl . 'data.addColumn(\'string\', \'' . _COUNTRY . '\');';
            $first_tab_content .= $nl . 'data.addColumn(\'number\', \'' . _POPULARITY . '\');';
            $first_tab_content .= $nl . 'data.addColumn(\'string\', \'HOVER\', \'\');';
            $first_tab_content .= $nl . 'data.setValue(0, 0, \'USA\');';
            $first_tab_content .= $nl . 'data.setValue(0, 1, 0);';
            $first_tab_content .= $nl . 'data.setValue(0, 2, \'USA\');';
        }
        $first_tab_content .= '	
				var options = {};
				options[\'dataMode\'] = \'regions\';
				options[\'width\'] = \'675px\';
				options[\'showLegend\'] = true;
Esempio n. 6
0
    /**
     *	Draws all modules
     *		return: html output
     */
    public function DrawModules()
    {
        global $objLogin;
        $margin = 'margin:-97px 0px 0px -44px;';
        $nl = "\n";
        if ($this->modulesCount > 0) {
            $this->IncludeJSFunctions();
            echo '<form name="frmMicroGrid_' . $this->tableName . '" id="frmMicroGrid_' . $this->tableName . '" action="' . $this->formActionURL . '" method="post">' . $nl;
            draw_hidden_field($this->uPrefix . 'mg_action', 'view');
            echo $nl;
            draw_hidden_field('mg_rid', '');
            echo $nl;
            draw_hidden_field('mg_sorting_fields', 'id');
            echo $nl;
            draw_hidden_field('mg_sorting_types', '');
            echo $nl;
            draw_hidden_field('mg_page', '');
            echo $nl;
            draw_hidden_field('mg_operation', '');
            echo $nl;
            draw_hidden_field('mg_operation_type', '');
            echo $nl;
            draw_hidden_field('mg_operation_field', '');
            echo $nl;
            draw_hidden_field('mg_search_status', '');
            echo $nl;
            draw_hidden_field('mg_language_id', '');
            echo $nl;
            draw_hidden_field('mg_operation_code', self::GetRandomString(20));
            echo $nl;
            draw_token_field();
            echo $nl;
            echo '<table width="100%" border="0" cellspacing="0" cellpadding="1">';
            echo '<tr><td>';
            $modules_output = '';
            for ($i = 0; $i < $this->modules[1]; $i++) {
                if ($this->modules[0][$i]['is_system'] == '1') {
                    if ($objLogin->IsLoggedInAs($this->modules[0][$i]['settings_access_by'])) {
                        $modules_output .= '<div style="width:120px;float:' . Application::Get('defined_left') . ';text-align:center;margin:5px;">
							<div><b>' . decode_text(constant($this->modules[0][$i]['name_const'])) . '</b></div>
							<div><img src="images/modules_icons/' . $this->modules[0][$i]['icon_file'] . '" title="' . @decode_text(constant($this->modules[0][$i]['description_const'])) . '" alt="" style="cursor:help;margin:2px;border:1px solid #dedede"></div>
							<div>' . ($this->modules[0][$i]['is_installed'] == 1 ? '<img src="images/success_sign.gif" style="position:absolute;' . $margin . '" alt="">' : '<img src="images/error_sign.gif" style="position:absolute;' . $margin . '" alt="">') . '</div>
							<div><a href="javascript:void(0);" onclick="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'edit\', \'' . $this->modules[0][$i]['id'] . '\');">[ ' . _EDIT_WORD . ' ]</a></div>
						</div>';
                    }
                }
            }
            if ($modules_output != '') {
                echo draw_sub_title_bar(_SYSTEM_MODULES, false);
                echo $modules_output;
            }
            echo '</td></tr><tr><td>';
            $modules_output = '';
            for ($i = 0; $i < $this->modules[1]; $i++) {
                if ($this->modules[0][$i]['is_system'] == '0') {
                    if ($objLogin->IsLoggedInAs($this->modules[0][$i]['settings_access_by'])) {
                        $modules_output .= '<div style="width:120px;float:' . Application::Get('defined_left') . ';text-align:center;margin:5px;">
							<div><b>' . decode_text(constant($this->modules[0][$i]['name_const'])) . '</b></div>
							<div><img src="images/modules_icons/' . $this->modules[0][$i]['icon_file'] . '" title="' . @decode_text(constant($this->modules[0][$i]['description_const'])) . '" alt="" style="cursor:help;margin:2px;border:1px solid #dedede"></div>			
							<div>' . ($this->modules[0][$i]['is_installed'] == 1 ? '<img src="images/success_sign.gif" style="position:absolute;' . $margin . '" alt="">' : '<img src="images/error_sign.gif" style="position:absolute;' . $margin . '" alt="">') . '</div>
							<div><a href="javascript:void(0);" onclick="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'edit\', \'' . $this->modules[0][$i]['id'] . '\');">[ ' . _EDIT_WORD . ' ]</a></div>
						</div>';
                    }
                }
            }
            if ($modules_output != '') {
                echo draw_sub_title_bar(_ADDITIONAL_MODULES, false);
                echo $modules_output;
            }
            echo '</td></tr>';
            echo '</table>';
            echo '</form>' . $nl;
        }
    }
Esempio n. 7
0
    /**
     *	Draws mass mail form
     *		$param $draw
     */
    public function DrawMassMailForm($draw = true)
    {
        global $objSettings;
        $template_subject = '';
        $template_content = '';
        $result = database_query('SELECT COUNT(*) as cnt FROM ' . $this->TABLE_NAME . ' WHERE is_active = 1 AND email_notifications = 1 AND email != \'\'', DATA_ONLY, FIRST_ROW_ONLY);
        $members_emails_count = isset($result['cnt']) ? $result['cnt'] : 0;
        $result = database_query('SELECT COUNT(*) as cnt FROM ' . TABLE_ACCOUNTS . ' WHERE is_active = 1 AND email != \'\'', DATA_ONLY, FIRST_ROW_ONLY);
        $admins_emails_count = isset($result['cnt']) ? $result['cnt'] : 0;
        $emails_count = $members_emails_count + $admins_emails_count;
        $result = database_query('SELECT COUNT(*) as cnt FROM ' . TABLE_NEWS_SUBSCRIBED . ' WHERE email != \'\'', DATA_ONLY, FIRST_ROW_ONLY);
        $newsletter_subscribers_count = isset($result['cnt']) ? $result['cnt'] : 0;
        $send_copy_to_admin = '1';
        $email_from = $objSettings->GetParameter('admin_email');
        $template_code = isset($_GET['template_code']) ? prepare_input($_GET['template_code']) : '';
        $duration = isset($_POST['duration']) ? (int) $_POST['duration'] : '5';
        $members_module_installed = Modules::IsModuleInstalled($this->MODULE_NAME);
        // load appropriate email template
        if ($template_code != '') {
            $template = $this->GetTemplate($template_code, Application::Get('lang'));
            $template_subject = $template['template_subject'];
            $template_content = $template['template_content'];
        }
        if ($this->error == true) {
            $template_code = isset($_POST['template_name']) ? prepare_input($_POST['template_name']) : '';
            $template_subject = isset($_POST['subject']) ? prepare_input($_POST['subject']) : '';
            $template_content = isset($_POST['message']) ? prepare_input($_POST['message']) : '';
        }
        $output = '<script type="text/javascript">
			function duration_OnChange(val){
				var el_package_size = (document.getElementById(\'package_size\')) ? document.getElementById(\'package_size\') : null;
				if(val == \'\' && el_package_size){
					el_package_size.selectedIndex = 0;
					el_package_size.disabled = \'disabled\';
				}else{
					el_package_size.disabled = \'\';
				}
			}
			
			function email_to_OnChange(val){
				var el_send_copy_to_admin = (document.getElementById(\'send_copy_to_admin\')) ? document.getElementById(\'send_copy_to_admin\') : null;
				if(val == \'admins\' && el_send_copy_to_admin){
					el_send_copy_to_admin.disabled = \'disabled\';
				}else{
					el_send_copy_to_admin.disabled = \'\';
				}
			}
					
			function OnSubmit_Check(){
				var email_to = (document.getElementById(\'email_to\')) ? document.getElementById(\'email_to\').value : \'\';
				var email_from = (document.getElementById(\'email_from\')) ? document.getElementById(\'email_from\').value : \'\';
				var subject = (document.getElementById(\'subject\')) ? document.getElementById(\'subject\').value : \'\';
				var message = (document.getElementById(\'message\')) ? document.getElementById(\'message\').value : \'\';
				if(email_to == \'\'){
					alert(\'' . str_replace('_FIELD_', _EMAIL_TO, _FIELD_CANNOT_BE_EMPTY) . '\');
					document.getElementById(\'email_to\').focus();
					return false;            
				}else if(email_from == \'\'){
					alert(\'' . str_replace('_FIELD_', _EMAIL_FROM, _FIELD_CANNOT_BE_EMPTY) . '\');
					document.getElementById(\'email_from\').focus();
					return false;
				}else if(email_from != \'\' && !appIsEmail(email_from)){
					alert(\'' . str_replace('_FIELD_', _EMAIL_FROM, _FIELD_MUST_BE_EMAIL) . '\');
					document.getElementById(\'email_from\').focus();
					return false;			
				}else if(subject == \'\'){
					alert(\'' . str_replace('_FIELD_', _SUBJECT, _FIELD_CANNOT_BE_EMPTY) . '\');
					document.getElementById(\'subject\').focus();
					return false;
				}else if(message == \'\'){
					alert(\'' . str_replace('_FIELD_', _MESSAGE, _FIELD_CANNOT_BE_EMPTY) . '\');
					document.getElementById(\'message\').focus();
					return false;
				}else if(email_to == \'all\'){
					if(!confirm(\'' . _PERFORM_OPERATION_COMMON_ALERT . '\')){
						return false;
					}
				}
				return true;
			}
		</script>';
        $output .= '<form action="index.php?admin=mass_mail" method="post" style="margin:0px;">
			' . draw_hidden_field('task', 'send', false) . '
			' . draw_hidden_field('email_random_code', get_random_string(10), false) . '
			' . draw_token_field(false) . '
			
			<table border="0" cellspacing="10">
			<tr>
				<td align="left" valign="top">
					<fieldset style="height:410px;">
					<legend><b>' . _FORM . ':</b></legend>
					<table width="97%" align="center" border="0" cellspacing="5">
					<tr>
						<td align="right" nowrap="nowrap">
							<label>' . _EMAIL_TEMPLATES . ':</label><br>
							' . prepare_permanent_link('index.php?admin=email_templates', '[ ' . _MANAGE_TEMPLATES . ' ]', '', '') . '
						</td>
						<td></td>
						<td>
							<table cellpadding="0" cellspacing="0">
							<tr valign="middle">
								<td>
									<select name="template_name" id="template_name" style="margin-bottom:3px;" onchange="javascript:appGoTo(\'admin=mass_mail&template_code=\'+this.value)">
										<option value="">-- ' . _NO_TEMPLATE . ' --</option>';
        $templates = $this->GetAllTemplates('is_system_template=0');
        for ($i = 0; $i < $templates[1]; $i++) {
            $output .= '<option';
            $output .= $templates[0][$i]['is_system_template'] == '1' ? ' style="background-color:#ffffcc;color:#000055"' : '';
            $output .= $template_code == $templates[0][$i]['template_code'] ? ' selected="selected"' : '';
            $output .= ' value="' . encode_text($templates[0][$i]['template_code']) . '">' . $templates[0][$i]['template_name'] . '</option>';
        }
        $output .= '
									</select>						
								</td>
							</tr>
							</table>                    
						</td>
					</tr>
					<tr>
						<td align="right" nowrap="nowrap"><label>' . _EMAIL_TO . ':</label></td>
						<td><span class="mandatory_star">*</span></td>
						<td>
							<select name="email_to" id="email_to" style="margin-bottom:3px;" onchange="email_to_OnChange(this.value)">
								<option value="">-- ' . _SELECT . ' --</option>
								<option value="test" style="background-color:#ffffcc;color:#000055">' . _TEST_EMAIL . ' (' . $email_from . ')</option>';
        if (Modules::IsModuleInstalled('news')) {
            $output .= '<option value="newsletter_subscribers" style="background-color:#ffccff;color:#000055">' . _NEWSLETTER_SUBSCRIBERS . ' (' . $newsletter_subscribers_count . ')</option>';
        }
        if ($members_module_installed) {
            $output .= '<optgroup label="' . $this->MEMBERS_NAME . '">';
            $output .= '<option value="members|all">' . _ALL . ' (' . $members_emails_count . ')</option>';
            if (self::$PROJECT == 'ShoppingCart' || self::$PROJECT == 'BusinessDirectory' || self::$PROJECT == 'HotelSite') {
                $arrMembersGroups = CustomerGroups::GetAllGroupsByCustomers();
            } else {
                if (self::$PROJECT == 'MedicalAppointment') {
                    $arrMembersGroups = PatientGroups::GetAllGroupsByPatiens();
                } else {
                    $arrMembersGroups = UserGroups::GetAllGroupsByUsers();
                }
            }
            $member_groups_emails_count = 0;
            if ($arrMembersGroups[1] > 0) {
                foreach ($arrMembersGroups[0] as $key => $val) {
                    if ($val[$this->MODULE_NAME . '_count']) {
                        $output .= '<option value="members|' . $val['id'] . '">' . $val['name'] . ' (' . $val[$this->MODULE_NAME . '_count'] . ')</option>';
                        $member_groups_emails_count += $val[$this->MODULE_NAME . '_count'];
                    }
                }
            }
            $member_non_groups_emails = $members_emails_count - $member_groups_emails_count;
            $output .= '<option value="members|uncategorized">' . _UNCATEGORIZED . ' (' . $member_non_groups_emails . ')</option>';
            $output .= '</optgroup>';
        }
        $output .= '<option value="admins">' . _ADMINS . ' (' . $admins_emails_count . ')</option>';
        if ($members_module_installed) {
            $output .= '<option value="all">' . $this->ADMINS_MEMBERS_NAME . ' (' . $emails_count . ')</option>';
        }
        $output .= '</select>
						</td>
					</tr>            
					<tr>
						<td align="right" nowrap="nowrap"><label for="email">' . _EMAIL_FROM . ':</label></td>
						<td><span class="mandatory_star">*</span></td>
						<td>
							<input type="text" name="email_from" style="width:210px" id="email_from" value="' . decode_text($email_from) . '" maxlength="70" />
						</td>
					</tr>
					<tr valign="top">
						<td align="right" nowrap="nowrap"><label>' . _SUBJECT . ':</label></td>
						<td><span class="mandatory_star">*</span></td>
						<td>
							<input type="text" style="width:410px" name="subject" id="subject" value="' . decode_text($template_subject) . '" maxlength="255" />
						</td>
					</tr>
					<tr valign="top">
						<td align="right" nowrap="nowrap"><label>' . _MESSAGE . ':</label></td>
						<td><span class="mandatory_star">*</span></td>
						<td>
							<textarea style="width:465px;margin-right:10px;" rows="10" name="message" id="message">' . $template_content . '</textarea>
						</td>
					</tr>';
        $output .= '<tr valign="middle">
						<td colspan="2"></td>
						<td><img src="images/question_mark.png" alt="">' . _MASS_MAIL_ALERT . '</td>
					</tr>';
        $output .= '<tr><td colspan="3" nowrap style="height:6px;"></td></tr>
					<tr>
						<td align="right" nowrap="nowrap"><a href="javascript:void(0);" onclick="appPopupWindow(\'mail_preview.html\',\'message\')">[ ' . _PREVIEW . ' ]</a></td>
						<td></td>
						<td>
							<div style="float:left"><input type="checkbox" class="form_checkbox" name="send_copy_to_admin" id="send_copy_to_admin" ' . ($send_copy_to_admin == '1' ? 'checked="checked"' : '') . ' value="1"> <label for="send_copy_to_admin">' . _SEND_COPY_TO_ADMIN . '</label></div>
							<div style="float:right"><input class="form_button" type="submit" name="btnSubmit" value="' . _SEND . '" onclick="return OnSubmit_Check();">&nbsp;&nbsp;</div>
						</td>
					</tr>
					</table>
					</fieldset>
				</td>        
				<td align="left" valign="top">
					<fieldset style="padding-' . Application::Get('defined_right') . ':10px;">
					<legend>' . _PREDEFINED_CONSTANTS . ':</legend>
					<ul>
						<li>{FIRST NAME} <br><span style="color:a0a0a0">' . _PC_FIRST_NAME_TEXT . '</span></li>
						<li>{LAST NAME} <br><span style="color:a0a0a0">' . _PC_LAST_NAME_TEXT . '</span></li>
						<li>{USER NAME} <br><span style="color:a0a0a0">' . _PC_USER_NAME_TEXT . '</span></li>
						<li>{USER EMAIL} <br><span style="color:a0a0a0">' . _PC_USER_EMAIL_TEXT . '</span></li>
						<li>{BASE URL} <br><span style="color:a0a0a0">' . _PC_WEB_SITE_BASED_URL_TEXT . '</span></li>
						<li>{WEB SITE} <br><span style="color:a0a0a0">' . _PC_WEB_SITE_URL_TEXT . '</span></li>
						<li>{YEAR} <br><span style="color:a0a0a0">' . _PC_YEAR_TEXT . '</span></li>
					</ul>
					</fieldset>
				</td>
			</tr>
			</table>    
		</form>';
        if ($draw) {
            echo $output;
        } else {
            return $output;
        }
    }
Esempio n. 8
0
/**
 * Normalize tag to avoid duplicate noise.
 *
 * Currently we trim spaces, lowercase, remove quotes and HTML entities, and
 * treat 'star wars', 'star-wars', 'star+wars' and 'star_wars' as similar
 * (with the underscore version as the base case).
 *
 * @todo Since tag is used as filename not all characters should be allowed.
 *
 * @param string $tag
 * @return string
 */
function normalizeTag($tag)
{
    $tag = trim($tag);
    $tag = decode_text($tag, 'special');
    // Decode the rest of the HTML enities if possible.
    $tag = unentify($tag);
    $tag = trim(strtolower($tag));
    $tag = str_replace(array("'", '"'), "", $tag);
    $tag = str_replace(array(" ", "-", "+"), "_", $tag);
    // Replacing character(s) not allowed in filenames.
    $tag = str_replace("/", "_", $tag);
    // Remove HTML enities we didn't manage to decode.
    $tag = preg_replace("/&([a-z\\d]{2,7}|#\\d{2,5});/i", "", $tag);
    if (empty($tag)) {
        $tag = "__empty__";
    }
    return $tag;
}
Esempio n. 9
0
    /**
     *	Draws registration form
     *		@param $news_id
     *		@param $event_title
     *		@param $draw
     */
    public function DrawRegistrationForm($news_id = '0', $event_title = '', $draw = true)
    {
        if (!$news_id) {
            return '';
        }
        global $objSettings, $objLogin;
        $lang = Application::Get('lang');
        $focus_element = 'first_name';
        // post fields
        $task = isset($_POST['task']) ? prepare_input($_POST['task']) : '';
        $event_id = isset($_POST['event_id']) ? (int) $_POST['event_id'] : '0';
        $first_name = isset($_POST['first_name']) ? prepare_input($_POST['first_name']) : '';
        $last_name = isset($_POST['last_name']) ? prepare_input($_POST['last_name']) : '';
        $email = isset($_POST['email']) ? prepare_input($_POST['email']) : '';
        $phone = isset($_POST['phone']) ? prepare_input($_POST['phone']) : '';
        $message = isset($_POST['message']) ? substr(prepare_input($_POST['message']), 0, 2048) : '';
        $captcha_code = isset($_POST['captcha_code']) ? prepare_input($_POST['captcha_code']) : '';
        $admin_email = $objSettings->GetParameter('admin_email');
        $msg = '';
        if ($task == 'register_to_event') {
            include_once 'modules/captcha/securimage.php';
            $objImg = new Securimage();
            if ($first_name == '') {
                $msg = draw_important_message(_FIRST_NAME_EMPTY_ALERT, false);
                $focus_element = 'first_name';
            } else {
                if ($last_name == '') {
                    $msg = draw_important_message(_LAST_NAME_EMPTY_ALERT, false);
                    $focus_element = 'last_name';
                } else {
                    if ($email == '') {
                        $msg = draw_important_message(_EMAIL_EMPTY_ALERT, false);
                        $focus_element = 'email';
                    } else {
                        if ($email != '' && !check_email_address($email)) {
                            $msg = draw_important_message(_EMAIL_VALID_ALERT, false);
                            $focus_element = 'email';
                        } else {
                            if ($phone == '') {
                                $msg = draw_important_message(str_replace('_FIELD_', _PHONE, _FIELD_CANNOT_BE_EMPTY), false);
                                $focus_element = 'phone';
                            } else {
                                if (!$objImg->check($captcha_code)) {
                                    $msg = draw_important_message(_WRONG_CODE_ALERT, false);
                                    $focus_element = 'captcha_code';
                                } else {
                                    $sql = 'SELECT * FROM ' . TABLE_EVENTS_REGISTERED . ' WHERE event_id = \'' . (int) $event_id . '\' AND email = \'' . $email . '\'';
                                    if (database_query($sql, ROWS_ONLY, FIRST_ROW_ONLY) > 0) {
                                        $msg = draw_important_message(_EVENT_USER_ALREADY_REGISTERED, false);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            // deny all operations in demo version
            if (strtolower(SITE_MODE) == 'demo') {
                $msg = draw_important_message(_OPERATION_BLOCKED, false);
            }
            if ($msg == '') {
                if ($objLogin->IpAddressBlocked(get_current_ip())) {
                    $msg = draw_important_message(_IP_ADDRESS_BLOCKED, false);
                } else {
                    if ($objLogin->EmailBlocked($email)) {
                        $msg = draw_important_message(_EMAIL_BLOCKED, false);
                    } else {
                        $sql = 'INSERT INTO ' . TABLE_EVENTS_REGISTERED . ' (id, event_id, first_name, last_name, email, phone, message, date_registered)
							VALUES (NULL, ' . (int) $event_id . ', \'' . encode_text($first_name) . '\', \'' . encode_text($last_name) . '\', \'' . encode_text($email) . '\', \'' . encode_text($phone) . '\', \'' . encode_text($message) . '\', \'' . @date('Y-m-d H:i:s') . '\')';
                        if (database_void_query($sql)) {
                            $msg = draw_success_message(_EVENT_REGISTRATION_COMPLETED, false);
                            ////////////////////////////////////////////////////////////
                            send_email($email, $admin_email, 'events_new_registration', array('{FIRST NAME}' => $first_name, '{LAST NAME}' => $last_name, '{EVENT}' => '<b>' . $event_title . '</b>'), '', $admin_email, 'Events - new user was registered (admin copy)');
                            ////////////////////////////////////////////////////////////
                            $first_name = $last_name = $email = $phone = $message = '';
                        } else {
                            ///echo mysql_error();
                            $msg = draw_important_message(_TRY_LATER, false);
                        }
                    }
                }
            }
        }
        $output = '
		' . ($msg != '' ? $msg : '') . '<br />
		<fieldset style="border:1px solid #cccccc;padding-left:10px;margin:0px 12px 12px 12px;">
		<legend><b>' . _REGISTRATION_FORM . '</b></legend>
		<form method="post" name="frmEventRegistration" id="frmEventRegistration">
			' . draw_hidden_field('task', 'register_to_event', false) . '
			' . draw_hidden_field('event_id', $news_id, false) . '
			' . draw_token_field(false);
        $output .= '
			<table cellspacing="1" cellpadding="2" border="0" width="100%">
			<tbody>
			<tr>
				<td width="25%" align="' . Application::Get('defined_right') . '">' . _FIRST_NAME . ':</td>
				<td><span class="mandatory_star">*</span></td>
				<td nowrap="nowrap" align="' . Application::Get('defined_left') . '"><input type="text" id="first_name" name="first_name" size="34" maxlength="32" value="' . decode_text($first_name) . '" autocomplete="off" /></td>
			</tr>
			<tr>
				<td align="' . Application::Get('defined_right') . '">' . _LAST_NAME . ':</td>
				<td><span class="mandatory_star">*</span></td>
				<td nowrap="nowrap" align="' . Application::Get('defined_left') . '"><input type="text" id="last_name" name="last_name" size="34" maxlength="32" value="' . decode_text($last_name) . '" autocomplete="off" /></td>
			</tr>
			<tr>
				<td align="' . Application::Get('defined_right') . '">' . _EMAIL_ADDRESS . ':</td>
				<td><span class="mandatory_star">*</span></td>
				<td nowrap="nowrap" align="' . Application::Get('defined_left') . '"><input type="text" id="email" name="email" size="34" maxlength="70" value="' . decode_text($email) . '" autocomplete="off" /></td>
			</tr>
			<tr>
				<td align="' . Application::Get('defined_right') . '">' . _PHONE . ':</td>
				<td><span class="mandatory_star">*</span></td>
				<td nowrap="nowrap" align="' . Application::Get('defined_left') . '"><input type="text" id="phone" name="phone" size="22" maxlength="32" value="' . decode_text($phone) . '" autocomplete="off" /></td>
			</tr>
		    <tr valign="top">
                <td align="' . Application::Get('defined_right') . '">' . _MESSAGE . ':</td>
                <td></td>
                <td nowrap="nowrap" align="' . Application::Get('defined_left') . '">
                    <textarea id="message" name="message" style="width:390px;" rows="4" maxlength="2048">' . $message . '</textarea>                
                </td>
		    </tr>
			<tr>
				<td colspan="2"></td>
				<td colspan="2">';
        $output .= '<table border="0" cellspacing="2" cellpadding="2">
					<tr>
						<td>
							<img id="captcha_image" src="modules/captcha/securimage_show.php?sid=' . md5(uniqid(time())) . '" />
						</td>	
						<td>
							<img style="cursor:pointer; padding:0px; margin:0px;" id="captcha_image_reload" src="modules/captcha/images/refresh.gif" style="cursor:pointer;" onclick="document.getElementById(\'captcha_image\').src = \'modules/captcha/securimage_show.php?sid=\' + Math.random(); appSetFocus(\'captcha_code\'); return false" title="' . _REFRESH . '" alt="' . _REFRESH . '" /><br />
							<a href="modules/captcha/securimage_play.php"><img border="0" style="padding:0px; margin:0px;" id="captcha_image_play" src="modules/captcha/images/audio_icon.gif" title="' . _PLAY . '" alt="' . _PLAY . '" /></a>						
						</td>					
						<td>
							' . _TYPE_CHARS . '<br />								
							<input type="text" name="captcha_code" id="captcha_code" style="width:175px;margin-top:5px;" value="" maxlength="20" autocomplete="off" />
						</td>
					</tr>
					</table>';
        $output .= '</td>
			</tr>
			<tr><td height="20" colspan="3">&nbsp;</td></tr>            
			<tr>
				<td colspan="3" align="center">
				<input type="submit" class="form_button" name="btnSubmitPD" id="btnSubmitPD" value=" ' . _SEND . ' ">
				</td>
			</tr>
			<tr><td colspan="3">&nbsp;</td></tr>		    		    
			</table>
			</form>
			
		</form>
		</fieldset>';
        if ($focus_element != '') {
            $output .= '<script type="text/javascript">appSetFocus(\'' . $focus_element . '\');</script>';
        }
        if ($draw) {
            echo $output;
        } else {
            return $output;
        }
    }
Esempio n. 10
0
 /**
  * Returns page text
  */
 public function GetText()
 {
     if (isset($this->page['page_text'])) {
         return decode_text($this->page['page_text'], false);
     } else {
         return '';
     }
 }
Esempio n. 11
0
 /**
  * Draws search result
  *		@param $search_result - search result
  *		@param $page
  *		@param $keyword
  *		@param $type
  */
 public function DrawSearchResult($search_result, $page = 1, $keyword = '', $type = 'quick')
 {
     $total_pages = (int) ($this->totalSearchRecords / $this->pageSize);
     if (!is_numeric($total_pages) || (int) $total_pages <= 0) {
         $total_pages = 1;
     }
     if ($search_result != '' && $search_result[1] > 0) {
         echo '<div class="pages_contents">';
         for ($i = 0; $i < $search_result[1]; $i++) {
             if ($search_result[0][$i]['content_type'] == 'article') {
                 echo $i + 1 . '. ' . prepare_permanent_link('index.php?' . $search_result[0][$i]['url'], decode_text($search_result[0][$i]['title'])) . '<br />';
                 if (isset($search_result[0][$i]['image_file_thumb'])) {
                     echo '<img src="images/listings/' . $search_result[0][$i]['image_file_thumb'] . '" style="width:42px;height:42px;margin:4px;" align="' . Application::Get('defined_left') . '" alt="" />';
                 }
                 $page_text = $search_result[0][$i]['text'];
                 $page_text = str_replace(array('\\r', '\\n'), '', $page_text);
                 $page_text = preg_replace('/{module:(.*?)}/i', '', $page_text);
                 $page_text = strip_tags($page_text);
                 $page_text = decode_text($page_text);
                 if (!empty($keyword)) {
                     $page_text = $this->HighLight($page_text, array($keyword));
                 }
                 echo substr_by_word($page_text, 512) . '...<br />';
             } else {
                 echo $i + 1 . '. <a href="' . $search_result[0][$i]['link_url'] . '">' . decode_text($search_result[0][$i]['title']) . '</a> <img src="images/external_link.gif" alt="" /><br />';
             }
             echo '<br />';
             draw_line();
             echo '<br />';
         }
         echo '<b>' . _PAGES . ':</b> ';
         for ($i = 1; $i <= $total_pages; $i++) {
             echo '<a class="paging_link" href="javascript:void(0);" onclick="javascript:appPerformSearch(' . $i . ', \'' . ($type == 'advanced' ? 'frmAdvSearch' : 'frmQuickSearch') . '\');">' . ($i == $page ? '<b>[' . $i . ']</b>' : $i) . '</a> ';
         }
         echo '</div>';
     } else {
         draw_important_message(_NO_RECORDS_FOUND);
     }
 }
Esempio n. 12
0
			' . draw_hidden_field('tabid', $tabid, false) . '
			' . draw_hidden_field('sel_language_id', $language_id, false) . '
			' . draw_token_field(false) . '
			
			<table width="99%" border="0" cellspacing="5" cellpadding="5" class="main_text">
			<tr valign="top">
				<td width="150px">' . _HDR_HEADER_TEXT . ' <span class="required">*</span>:</td>
				<td><textarea class="form_text" name="header_text" id="header_text" cols="54" rows="3">' . decode_text($params_tab2a['header_text']) . '</textarea></td>
			</tr>
			<tr valign="top">
				<td width="150px">' . _HDR_SLOGAN_TEXT . ':</td>
				<td><textarea class="form_text" name="slogan_text" id="slogan_text" cols="54" rows="3">' . decode_text($params_tab2a['slogan_text']) . '</textarea></td>
			</tr>
			<tr valign="top">
				<td width="150px">' . _HDR_FOOTER_TEXT . ':</td>
				<td><textarea class="form_text" name="footer_text" id="footer_text" cols="54" rows="3">' . decode_text($params_tab2a['footer_text']) . '</textarea></td>
			</tr>
			<tr><td colspan="2" nowrap height="5px"></td></tr>
			<tr>
				<td style="padding-left:5px;" colspan="2"><input class="form_button" type="submit" name="btnSubmit" value="' . _BUTTON_CHANGE . '"></td>
			</tr>
			</table>
		</form>
		</fieldset>
		
		<br />

		<fieldset style="margin:10px;">
		<legend>' . _META_TAGS . '</legend>
			<form action="index.php?admin=settings" method="post">
			' . draw_hidden_field('submition_type', 'meta_tags', false) . '
Esempio n. 13
0
/**
 * Sends notification for any type - currently only entries/comments.
 *
 * @param string $type
 * @param array $data
 * @return void
 */
function notify_new($type, $data)
{
    global $Paths, $Current_weblog, $Users, $Weblogs, $i18n_use;
    // FIXME:
    // $contact_addr used below is not set because there is really no
    // good setting for that - the comment_emailto setting for each e-mail
    // isn't meant for the from header...
    if ($type == 'comment') {
        // splitting up input data
        $entry = $data[0];
        $comment = $data[1];
        if (isset($data[2]) && $data[2]) {
            debug("Notification of new comment surpressed.");
            return;
        }
        // make a nice title for the mail..
        if (strlen($entry['title']) > 2) {
            $title = $entry['title'];
            $title = strip_tags($title);
        } else {
            $title = substr($entry['introduction'], 0, 300);
            $title = strip_tags($title);
            $title = str_replace("\n", "", $title);
            $title = str_replace("\r", "", $title);
            $title = substr($title, 0, 60);
        }
        $id = safe_string($comment["name"], TRUE) . "-" . format_date($comment["date"], "%ye%%month%%day%%hour24%%minute%");
        // Make the array of users that want to be notified via email..
        $notify_arr = array();
        foreach ($entry['comments'] as $temp_comm) {
            if ($temp_comm['notify'] == 1 && isemail($temp_comm['email'])) {
                $notify_arr[$temp_comm['email']] = 1;
            }
            if ($temp_comm['notify'] == 0 && isemail($temp_comm['email'])) {
                unset($notify_arr[$temp_comm['email']]);
            }
        }
        // don't send to the user that did the comment...
        if (isset($notify_arr[$comment['email']])) {
            unset($notify_arr[$comment['email']]);
        }
        // send mail to those on the 'notify me' list..
        if (count($notify_arr) > 0) {
            $contact_addr = $Users[$entry['user']]['email'];
            $user = $Users[$entry['user']]['nick'];
            if (empty($user)) {
                $user = $entry['user'];
            }
            if (!$i18n_use) {
                $user = utf8_encode($user);
            }
            $body = sprintf(lang('comment', 'email_posted_comm') . ":\n\n", unentify($comment['name']));
            $body .= sprintf("%s", unentify($comment['comment']));
            $body .= sprintf("\n\n-------------\n");
            $body .= sprintf(lang('weblog_text', 'name') . ": %s\n", unentify($comment['name']));
            $body .= sprintf(lang('comment', 'email_comm_on') . "\n", $title);
            $body .= sprintf("\n%s:\n%s%s\n", lang('comment', 'email_view_entry'), $Paths['host'], make_filelink($entry['code'], "", ""));
            $body .= sprintf("%s:\n%s%s\n", lang('comment', 'email_view_comm'), $Paths['host'], make_filelink($entry['code'], "", $id));
            if (!$i18n_use) {
                $body = utf8_encode($body);
            }
            $body = decode_text($body, 'special');
            $contact_name = '=?UTF-8?B?' . base64_encode($user) . '?=';
            $add_header = sprintf("From: \"'%s'\" <%s>\n", $contact_name, $contact_addr);
            $add_header .= "MIME-Version: 1.0\n";
            $add_header .= "Content-Type: text/plain; charset=UTF-8; format=flowed\n";
            $add_header .= "Content-Transfer-Encoding: 8bit\n";
            $subject = lang('comment', 'email_subject_notify') . " Re: {$title}";
            if (!$i18n_use) {
                $subject = utf8_encode($subject);
            }
            $subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
            foreach ($notify_arr as $addr => $val) {
                $addr = trim($addr);
                @mail($addr, $subject, $body, $add_header);
                debug("Sent Notify to {$addr} from '" . $comment['name'] . "'");
            }
        }
    } else {
        if ($type == 'entry') {
            $entry = $data;
            // We need to determine the current weblog..
            $weblogs = find_weblogs_with_cat($entry['category']);
            $Current_weblog = current($weblogs);
            // make a nice title for the mail..
            if (strlen($entry['title']) > 2) {
                $title = $entry['title'];
                $title = strip_tags($title);
            } else {
                $title = substr($entry['introduction'], 0, 300);
                $title = strip_tags($title);
                $title = str_replace("\n", "", $title);
                $title = str_replace("\r", "", $title);
                $title = substr($title, 0, 60);
            }
            $title = unentify($title);
            // Make the array of users that want to be notified via email..
            $comment_users = get_registered_visitors();
            $notify_arr = array();
            foreach ($comment_users as $commuserdata) {
                if ($commuserdata['verified'] && !$commuserdata['disabled'] && $commuserdata['notify_entries']) {
                    $notify_arr[$commuserdata['email']] = $commuserdata['name'];
                }
            }
            // send mail to those on the 'notify me' list..
            if (count($notify_arr) > 0) {
                $contact_addr = $Users[$entry['user']]['email'];
                // Get the user's nickname (or username if nickname
                // isn't set), and the weblog's name.
                $user = $Users[$entry['user']]['nick'];
                if (empty($user)) {
                    $user = $entry['user'];
                }
                if (!$i18n_use) {
                    $user = utf8_encode($user);
                }
                $weblog = find_weblogs_with_cat($entry['category']);
                $weblog = $Weblogs[$weblog[0]]['name'];
                $defaultbody = sprintf(lang('comment', 'email_posted_entry') . ":\n\n", $user);
                $defaultbody .= sprintf("%s\n\n%s\n", $title, unentify(strip_tags($entry['introduction'])));
                $defaultbody .= sprintf("\n\n-------------\n");
                $defaultbody .= sprintf("\n%s:\n%s%s\n", lang('comment', 'email_view_fullentry'), $Paths['host'], make_filelink($entry, "", ""));
                $defaultbody .= sprintf("\n%s:\n%s%suser.php%s\n", lang('comment', 'email_view_settings'), $Paths['host'], $Paths['pivot_url'], "?w=" . para_weblog($Current_weblog));
                $defaultbody .= sprintf("\n%s: %%name%% (%%addr%%)\n", lang('comment', 'email_sent_to'), $Paths['host'], $Paths['pivot_url']);
                $defaultbody = decode_text($defaultbody, 'special');
                if (!$i18n_use) {
                    $defaultbody = utf8_encode($defaultbody);
                }
                $contact_name = '=?UTF-8?B?' . base64_encode($user) . '?=';
                $add_header = sprintf("From: \"'%s'\" <%s>\n", $contact_name, $contact_addr);
                $add_header .= "MIME-Version: 1.0\n";
                $add_header .= "Content-Type: text/plain; charset=UTF-8; format=flowed\n";
                $add_header .= "Content-Transfer-Encoding: 8bit\n";
                $subject = lang('comment', 'email_subject_notify') . " {$title} - {$weblog}";
                if (!$i18n_use) {
                    $subject = utf8_encode($subject);
                }
                $subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
                $notified = array();
                foreach ($notify_arr as $addr => $name) {
                    $addr = trim($addr);
                    $body = $defaultbody;
                    $body = str_replace("%name%", $name, $body);
                    $body = str_replace("%addr%", $addr, $body);
                    @mail($addr, $subject, $body, $add_header);
                    debug("Sent Notify to {$addr} from '" . $entry['user'] . "'");
                    $notified[] = sprintf("%s (%s)", $name, $addr);
                }
                $notified = sprintf("%s: %s", lang('comment', 'email_notified'), implode(", ", $notified));
                return $notified;
            }
        } else {
            if ($type == 'visitor_registration') {
                $type = $data[0];
                $name = $data[1];
                // Only sending notification to superadmin
                foreach ($Users as $key => $value) {
                    if ($value['userlevel'] == 4) {
                        $user = $key;
                        break;
                    }
                }
                $contact_addr = $Users[$user]['email'];
                $contact_name = $Users[$user]['nick'];
                if (empty($contact_name)) {
                    $contact_name = $user;
                }
                if ($type == 'add') {
                    $subject = "New visitor registration - {$name}";
                } else {
                    $subject = "New visitor confirmed - {$name}";
                }
                $body = $subject;
                $body .= sprintf("\n\nView visitor information:\n%s%s?menu=admin&func=admin&do=seecommusers\n", $Paths['host'], $Paths['pivot_url']);
                if (!$i18n_use) {
                    $contact_name = utf8_encode($contact_name);
                    $subject = utf8_encode($subject);
                    $body = utf8_encode($body);
                }
                $contact_name = '=?UTF-8?B?' . base64_encode($contact_name) . '?=';
                $add_header = sprintf("From: \"'%s'\" <%s>\n", $contact_name, $contact_addr);
                $add_header .= "MIME-Version: 1.0\n";
                $add_header .= "Content-Type: text/plain; charset=UTF-8; format=flowed\n";
                $add_header .= "Content-Transfer-Encoding: 8bit\n";
                $subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
                @mail($contact_addr, $subject, $body, $add_header);
                debug("Sent registered visitor notification for {$name}");
                return;
            } else {
                debug("Unknown notify type '{$type}'");
            }
        }
    }
}
Esempio n. 14
0
			<?php 
    if ($customer_info['group_id'] != 0) {
        echo '<tr><td align="right">' . _USER_GROUP . '</td><td class="mandatory_star"></td><td nowrap="nowrap"><label>';
        echo $arr_groups[$customer_info['group_id']];
        echo '</label></td></tr>';
    }
    ?>
		
			<tr>
				<td align="right"><?php 
    echo _USERNAME;
    ?>
</td>
				<td></td>
				<td nowrap="nowrap"><label><?php 
    echo decode_text($customer_info['user_name']);
    ?>
</label></td>
			</tr>		    
			<tr>
				<td align="right"><?php 
    echo _PASSWORD;
    ?>
</td>
				<td><span class="required">*</span></td>
				<td nowrap="nowrap"><input type="password" id="user_password1" name="user_password1" style="width:150px" maxlength="32" value="" /></td>
			</tr>		    
			<tr>
				<td align="right"><?php 
    echo _CONFIRM_PASSWORD;
    ?>
Esempio n. 15
0
 /**
  * Get field
  */
 public function GetField($param = '', $decode = true)
 {
     $output = '';
     if (isset($this->listing_info[0][$param])) {
         $output = $decode ? decode_text($this->listing_info[0][$param]) : $this->listing_info[0][$param];
     }
     return $output;
 }
Esempio n. 16
0
    /**
     * Draws vocabulary
     * 		@param $key
     */
    public function DrawVocabulary($key)
    {
        $align_left = Application::Get('lang_dir') == 'ltr' ? 'left' : 'right';
        $align_right = Application::Get('lang_dir') == 'ltr' ? 'right' : 'left';
        $this->GetVocabulary($this->whereClause);
        echo '<a name="top"></a>';
        echo '<table width="100%" align="center" border="0" cellspacing="0" cellpadding="2" class="main_text">
			  <tr>
				<td>' . _FILTER_BY . ': ';
        echo prepare_permanent_link('index.php?admin=vocabulary' . $this->langIdByUrl, _ALL) . ' - ';
        for ($i = 65; $i < 91; $i++) {
            if ($this->filterBy == chr($i)) {
                $chr_i = '<b><u>' . chr($i) . '</u></b>';
            } else {
                $chr_i = chr($i);
            }
            echo prepare_permanent_link('index.php?admin=vocabulary&filter_by=' . chr($i) . $this->langIdByUrl, $chr_i) . ' ';
        }
        echo ' - ';
        for ($i = 1; $i <= 5; $i++) {
            if ($this->filterBy == $i) {
                $chr_i = '<b><u>' . $i . '</u></b>';
            } else {
                $chr_i = $i;
            }
            echo prepare_permanent_link('index.php?admin=vocabulary&filter_by=' . $i . $this->langIdByUrl, $chr_i) . ' ';
        }
        echo '</td>
				<td width="7%" align="center" nowrap="nowrap">
				' . _TOTAL . ': ' . count($this->keys) . '
				</td>
			  </tr>';
        echo '<tr align="center"><td colspan="2">' . draw_line('line_no_margin', IMAGE_DIRECTORY, false) . '</td></tr>';
        echo '</table>';
        if (!empty($this->keys)) {
            echo '<table width="100%" align="center" border="0" cellspacing="0" cellpadding="3" class="main_text">';
            echo '<tr>
					<th width="1%">#</th>
					<th width="25%" align="' . $align_left . '">' . _KEY . '</th>
					<th width="65%" align="' . $align_left . '">' . _VALUE . '</th>
					<th width="9%"></th>';
            for ($i = 0; $i < $this->vocabularySize; $i++) {
                // Prepare key_text for displaying
                $decoded_text = strip_tags(decode_text($this->keys[$i]['key_text']));
                if (strlen($decoded_text) > 90) {
                    $key_text = '<span style="cursor:help;" title="' . $decoded_text . '">' . substr_by_word($decoded_text, 95, true) . '</span>';
                } else {
                    $key_text = $decoded_text;
                }
                // Display vocabulary row
                if ($this->keys[$i]['key_value'] == $this->currentKey) {
                    echo '<tr>';
                    echo '<td align="' . $align_right . '" class="voc_row_edit_' . $align_left . '" nowrap="nowrap">' . ($i + 1) . '.</td>';
                    echo '<td align="' . $align_left . '" class="voc_row_edit_middle" nowrap="nowrap">' . $this->keys[$i]['key_value'] . '</td>';
                    echo '<td align="' . $align_left . '" class="voc_row_edit_middle">' . $key_text . '</td>
					      <td align="center" class="voc_row_edit_' . $align_right . '">' . prepare_permanent_link('index.php?admin=vocabulary&key=' . $this->keys[$i]['id'] . '&act=edit' . $this->filterByUrl . $this->langIdByUrl, '[ ' . _EDIT_WORD . ' ]') . '</td>
					</tr>';
                } else {
                    if ($this->keys[$i]['id'] == (int) $key) {
                        echo '<tr>';
                        echo '<td align="' . $align_right . '" class="voc_row_update_' . $align_left . '" nowrap="nowrap">' . ($i + 1) . '.</td>';
                        echo '<td align="' . $align_left . '" class="voc_row_update_middle" nowrap="nowrap">' . $this->keys[$i]['key_value'] . '</td>';
                        echo '<td align="' . $align_left . '" class="voc_row_update_middle">' . $key_text . '</td>
					      <td align="center" class="voc_row_update_' . $align_right . '">' . prepare_permanent_link('index.php?admin=vocabulary&key=' . $this->keys[$i]['id'] . '&act=edit' . $this->filterByUrl . $this->langIdByUrl, '[ ' . _EDIT_WORD . ' ]') . '</td>
					</tr>';
                    } else {
                        echo '<tr ' . highlight(0) . ' onmouseover="oldColor=this.style.backgroundColor;this.style.backgroundColor=\'#ededed\';" onmouseout="this.style.backgroundColor=oldColor">';
                        echo '<td align="' . $align_right . '" nowrap="nowrap">' . ($i + 1) . '.</td>';
                        echo '<td align="' . $align_left . '" nowrap="nowrap">' . $this->keys[$i]['key_value'] . '</td>';
                        echo '<td align="' . $align_left . '">' . $key_text . '</td>
					      <td align="center">' . prepare_permanent_link('index.php?admin=vocabulary&key=' . $this->keys[$i]['id'] . '&act=edit' . $this->filterByUrl . $this->langIdByUrl, '[ ' . _EDIT_WORD . ' ]') . '</td>
					</tr>';
                    }
                }
            }
            echo '<tr><td colspan="4" nowrap="nowrap" height="10px"></td></tr>';
            if ($this->vocabularySize > 15) {
                echo '<tr valign="bottom"><td colspan="3"></td><td align="center">' . prepare_permanent_link('index.php?admin=vocabulary' . $this->filterByUrl . $this->langIdByUrl . '#top', _TOP . ' ^') . '</td></tr>';
            }
            echo '</table>';
        } else {
            draw_important_message(_VOC_NOT_FOUND);
        }
    }
Esempio n. 17
0
    /**
     *	Draws comment submission form
     *		@param $article_id
     *		@param $image_verification
     *		@param $focus_field
     *		@param $task_completed
     *		@param $draw
     */
    private function DrawCommentsForm($article_id = '', $image_verification = 'no', $focus_field = '', $task_completed = false, $draw = true)
    {
        if (!$article_id) {
            return '';
        }
        global $objLogin;
        $user_id = '';
        $user_name = '';
        $user_name = isset($_POST['comment_user_name']) && !$task_completed ? decode_text(prepare_input($_POST['comment_user_name'])) : '';
        $user_email = isset($_POST['comment_user_email']) && !$task_completed ? decode_text(prepare_input($_POST['comment_user_email'])) : '';
        $comment_text = isset($_POST['comment_text']) && !$task_completed ? prepare_input($_POST['comment_text']) : '';
        $comment_length = ModulesSettings::Get('comments', 'comment_length');
        if ($objLogin->IsLoggedInAs($this->user_type_name)) {
            $user_id = $objLogin->GetLoggedID();
            $user_name = $objLogin->GetLoggedName();
        }
        $output = '
		<div class="comments_form_container">
		<form class="comments-form" method="post" name="frmComments" id="frmComments">
			' . draw_hidden_field('task', 'publish_comment', false, 'comment_task') . '
			' . draw_hidden_field('comment_id', '', false, 'comment_id') . '
			' . draw_hidden_field('article_id', $article_id, false) . '
			' . draw_hidden_field('user_id', $user_id, false) . '
			' . draw_token_field(false) . '
			
			<table border="0" width="98%">
			<tr><td colspan="3" nowrap height="7px"></td></tr>
			<tr>
				<td colspan="3">
					<b>' . _LEAVE_YOUR_COMMENT . '</b>	
				</td>
			</tr>
			<tr>
				<td>';
        if ($user_id == '') {
            $output .= _YOUR_NAME . ': <input type="text" name="comment_user_name" id="comment_user_name" style="width:140px" value="' . $user_name . '" maxlength="50" autocomplete="off" />&nbsp;';
            $output .= '<nobr>' . _YOUR_EMAIL . ': <input type="text" name="comment_user_email" id="comment_user_email" style="width:140px" value="' . $user_email . '" maxlength="70" autocomplete="off" /></nobr><br /><br />';
        } else {
            $output .= draw_hidden_field('comment_user_name', $user_name, false);
            $output .= draw_hidden_field('comment_user_email', $user_email, false);
        }
        $output .= _COMMENT_TEXT . ':<br />
				<textarea id="comment_text" name="comment_text" maxlength="' . $comment_length . '" style="width:96%" rows="5">' . stripcslashes($comment_text) . '</textarea><br />
				' . _CAN_USE_TAGS_MSG . ' &lt;b&gt;, &lt;i&gt;, &lt;u&gt;, &lt;br&gt; <br /><br />';
        //'._IMAGE_VERIFICATION.':<br />
        $output .= '</td>
				<td>&nbsp;</td>
				<td valign="top" width="180px" align="center">';
        if ($image_verification == 'yes') {
            $output .= '<table border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td>
								<img style="padding:0px;margin:0px;" id="captcha_image" src="modules/captcha/securimage_show.php?sid=' . md5(uniqid(time())) . '" />
							</td>	
							<td>
								<img style="cursor:pointer;padding:0px;margin:0px;" id="captcha_image_reload" src="modules/captcha/images/refresh.gif" style="cursor:pointer;" onclick="document.getElementById(\'captcha_image\').src = \'modules/captcha/securimage_show.php?sid=\' + Math.random(); appSetFocus(\'frmComments_captcha_code\'); return false" title="' . _REFRESH . '" alt="' . _REFRESH . '" /><br />
								<a href="modules/captcha/securimage_play.php"><img border="0" style="padding:0px; margin:0px;" id="captcha_image_play" src="modules/captcha/images/audio_icon.gif" title="' . _PLAY . '" alt="' . _PLAY . '" /></a>						
							</td>					
						</tr>
						<tr><td colspan="2" nowrap="nowrap" height="20px"></td></tr>
						<tr>
							<td colspan="2" align="center">
								' . _TYPE_CHARS . '
							</td>
						</tr>
						<tr><td colspan="2" nowrap="nowrap" height="10px"></td></tr>
						<tr>
							<td colspan="2">
								<input type="text" name="captcha_code" id="frmComments_captcha_code" style="width:175px" value="" maxlength="20" autocomplete="off" />
							</td>
						</tr>
						</table>';
        }
        $output .= '</td>
			</tr>			
			</table>
			<input type="submit" ' . ($objLogin->IsLoggedInAsAdmin() ? 'disabled' : '') . ' class="form_button" name="btnSubmitPC" id="btnSubmitPC" value="' . _PUBLISH_YOUR_COMMENT . '">
		</form>
		</div>';
        if ($focus_field != '') {
            $output .= '<script type="text/javascript">appSetFocus("' . $focus_field . '");</script>';
        }
        if ($draw) {
            echo $output;
        } else {
            return $output;
        }
    }
Esempio n. 18
0
         }
     }
     /* if the array is empty there's only text so we can simply get the body-part */
 } else {
     /* decode if body is encoded */
     if ($structure->encoding > 0) {
         $xp_body_text = decode_text(imap_body($inbox, $x), $encoding[$structure->encoding]);
         $parts_structure .= '<strong>0</strong> _ text/plain <em>' . $encoding[$structure->encoding] . '</em> _ [' . $structure->bytes . ']<br />';
     } else {
         $xp_body_text = imap_body($inbox, $x);
         $parts_structure .= '<strong>0</strong> _ text/plain <em>7bit</em> _ [' . $structure->bytes . ']<br />';
     }
 }
 /* if we have no text till now we try to check for the html-part */
 if ($xp_body_text == '' && $temp_html_key) {
     $xp_body_text = strip_tags(decode_text(imap_fetchbody($inbox, $x, str_replace("_", "", $temp_html_key)), $parts_encoding[$temp_html_key]));
 }
 /* the raw email will be saved or not according to prefs */
 if ($insert_raw == TRUE) {
     $xp_header_raw = imap_fetchheader($inbox, $x);
     $xp_body_raw = imap_body($inbox, $x);
 }
 /* replacing line breaks according to prefs */
 $xp_body_text = preg_replace("/(\r\n)|(\r)|(\n)/", "{$line_break}", $xp_body_text);
 $xp_attachments = str_replace("{$line_break}{$line_break}", "{$line_break}", $xp_attachments);
 /* calculating the message size */
 if (is_array($parts_size)) {
     $xp_size = ceil(array_sum($parts_size) / 1024);
 } else {
     $xp_size = ceil($structure->bytes / 1024);
 }
Esempio n. 19
0
/**
 * Prepare link
 * 		@param $page_type
 * 		@param $page_id_param
 * 		@param $page_id
 * 		@param $page_url_name
 * 		@param $page_name
 * 		@param $css_class
 * 		@param $title
 * 		@param $href_only
 */
function prepare_link($page_type, $page_id_param, $page_id, $page_url_name, $page_name, $css_class = '', $title = '', $href_only = false)
{
    global $objSettings;
    $css_class = $css_class != '' ? ' class="' . $css_class . '"' : '';
    $title = $title != '' ? ' title="' . decode_text($title) . '"' : '';
    $page_url_name = str_replace(array(' ', '#', "'", '"'), '-', $page_url_name != '' ? $page_url_name : $page_name);
    // Use SEO optimized link
    if ($objSettings->GetParameter('seo_urls') == '1') {
        $href = $page_type . ($page_id != '' ? '/' . $page_id : '') . ($page_url_name != 'index' ? '/' . $page_url_name . '.html' : '.html');
        if ($href_only) {
            return $href;
        } else {
            return '<a' . $css_class . $title . ' href="' . APPHP_BASE . $href . '">' . $page_name . '</a>';
        }
    } else {
        $href = 'index.php?page=' . $page_type . ($page_id_param != '' ? '&amp;' . $page_id_param . '=' . $page_id : '');
        if ($href_only) {
            return $href;
        } else {
            return '<a' . $css_class . $title . ' href="' . APPHP_BASE . $href . '">' . decode_text($page_name) . '</a>';
        }
    }
}
Esempio n. 20
0
 /**
  *	Draws languages bar
  *		@param $draw
  */
 public function DrawLanguagesBar($draw = true)
 {
     global $objLogin, $objSettings;
     $allow_opacity = true;
     $opacity = '';
     $output = '';
     $all_languages = Languages::GetAllLanguages(' priority_order ASC', '', 'is_active = 1 AND (used_on = \'global\' OR used_on = \'front-end\')');
     if ($all_languages > 0) {
         for ($i = 0; $i < $all_languages[1]; $i++) {
             $url = get_page_url();
             $base_url = APPHP_BASE;
             if (!$objLogin->IsLoggedInAsAdmin()) {
                 // prevent wrong re-loading for some problematic cases
                 $url = str_replace(array('page=search'), 'page=index', $url);
                 if (self::$PROJECT == 'HotelSite') {
                     $url = str_replace(array('page=booking_payment'), 'page=booking_checkout', $url);
                     $url = str_replace(array('page=check_availability'), 'page=index', $url);
                 } else {
                     if (self::$PROJECT == 'ShoppingCart') {
                         $url = str_replace(array('&act=add', '&act=remove'), '', $url);
                         $url = str_replace(array('page=order_proccess'), 'page=checkout', $url);
                     }
                 }
                 if ($objSettings->GetParameter('seo_urls') == '1') {
                     if (self::$PROJECT == 'ShoppingCart' || self::$PROJECT == 'HotelSite') {
                         // remove currency parameters
                         $url = str_replace('/' . Application::Get('currency_code') . '/', '/', $url);
                     }
                     if (preg_match('/\\/' . Application::Get('lang') . '\\//i', $url)) {
                         $url = str_replace('/' . Application::Get('lang') . '/', '/' . $all_languages[0][$i]['abbreviation'] . '/', $url);
                     } else {
                         $url = str_replace($base_url, $base_url . $all_languages[0][$i]['abbreviation'] . '/', $url);
                     }
                 } else {
                     if (preg_match('/lang=' . Application::Get('lang') . '/i', $url)) {
                         $url = str_replace('lang=' . Application::Get('lang'), 'lang=' . $all_languages[0][$i]['abbreviation'], $url);
                     } else {
                         $url .= (preg_match('/\\?/', $url) ? '&amp;' : '?') . 'lang=' . $all_languages[0][$i]['abbreviation'];
                     }
                 }
             }
             if ($allow_opacity = true) {
                 if (Application::Get('lang') == $all_languages[0][$i]['abbreviation']) {
                     $opacity = ' class="opacity_on"';
                 } else {
                     $opacity = ' class="opacity" onmouseover="opacity_onmouseover(this)" onmouseout="opacity_onmouseout(this)"';
                 }
             }
             $output .= '<a href="' . $url . '" title="' . decode_text($all_languages[0][$i]['lang_name']) . '">';
             $output .= $all_languages[0][$i]['icon_image'] != '' && file_exists('images/flags/' . $all_languages[0][$i]['icon_image']) ? '<img src="images/flags/' . $all_languages[0][$i]['icon_image'] . '" height="11px" title="' . decode_text($all_languages[0][$i]['lang_name']) . '" alt="' . decode_text($all_languages[0][$i]['lang_name']) . '"' . $opacity . ' />' : $all_languages[0][$i]['lang_name'];
             $output .= '</a> ';
         }
     }
     if ($draw) {
         echo $output;
     } else {
         return $output;
     }
 }
Esempio n. 21
0
 /**
  * Draw header tooltip
  */
 private function DrawHeaderTooltip($field)
 {
     echo isset($field['header_tooltip']) && !empty($field['header_tooltip']) ? ' <img src="images/microgrid_icons/question.png" class="help" title="' . decode_text($field['header_tooltip']) . '" alt="" />' : '';
 }
Esempio n. 22
0
    /**
     *	Draws Contact Us form
     *		@param $draw
     */
    public function DrawContactUsForm($draw = true)
    {
        global $objSettings, $objSiteDescription, $objLogin;
        $align_left = Application::Get('defined_left');
        $align_right = Application::Get('defined_right');
        if (!Modules::IsModuleInstalled('contact_us')) {
            return '';
        }
        $output = '';
        $from_email = $objSettings->GetParameter('admin_email');
        $admin_email = ModulesSettings::Get('contact_us', 'email');
        $delay_length = ModulesSettings::Get('contact_us', 'delay_length');
        $is_send_delay = ModulesSettings::Get('contact_us', 'is_send_delay');
        $image_verification = ModulesSettings::Get('contact_us', 'image_verification_allow');
        $focus_element = '';
        // post fields
        $task = isset($_POST['task']) ? prepare_input($_POST['task']) : '';
        $first_name = isset($_POST['first_name']) ? prepare_input($_POST['first_name']) : '';
        $last_name = isset($_POST['last_name']) ? prepare_input($_POST['last_name']) : '';
        $email = isset($_POST['email']) ? prepare_input($_POST['email']) : '';
        $phone = isset($_POST['phone']) ? prepare_input($_POST['phone']) : '';
        $subject = isset($_POST['subject']) ? prepare_input($_POST['subject']) : '';
        $message = isset($_POST['message']) ? prepare_input($_POST['message']) : '';
        $captcha_code = isset($_POST['captcha_code']) ? prepare_input($_POST['captcha_code']) : '';
        $msg = '';
        $contact_mail_sent = (bool) Session::Get('contact_mail_sent');
        $contact_mail_sent_time = Session::Get('contact_mail_sent_time');
        if ($image_verification == 'yes') {
            include_once 'modules/captcha/securimage.php';
            $objImg = new Securimage();
        }
        if ($task == 'contact') {
            $time_elapsed = time_diff(date('Y-m-d H:i:s'), $contact_mail_sent_time);
            if ($contact_mail_sent && $is_send_delay == 'yes' && $time_elapsed < $delay_length) {
                $msg = draw_message(str_replace('_WAIT_', $delay_length - $time_elapsed, _CONTACT_US_ALREADY_SENT), false);
            } else {
                if ($first_name == '') {
                    $msg = draw_important_message(_FIRST_NAME_EMPTY_ALERT, false);
                    $focus_element = 'first_name';
                } else {
                    if ($last_name == '') {
                        $msg = draw_important_message(_LAST_NAME_EMPTY_ALERT, false);
                        $focus_element = 'last_name';
                    } else {
                        if ($email == '') {
                            $msg = draw_important_message(_EMAIL_EMPTY_ALERT, false);
                            $focus_element = 'email';
                        } else {
                            if ($email != '' && !check_email_address($email)) {
                                $msg = draw_important_message(_EMAIL_VALID_ALERT, false);
                                $focus_element = 'email';
                            } else {
                                if ($subject == '') {
                                    $msg = draw_important_message(_SUBJECT_EMPTY_ALERT, false);
                                    $focus_element = 'subject';
                                    #}else if($phone == ''){
                                    #	$msg = draw_important_message(str_replace('_FIELD_', _PHONE, _FIELD_CANNOT_BE_EMPTY), false);
                                    #	$focus_element = 'phone';
                                } else {
                                    if ($message == '') {
                                        $msg = draw_important_message(_MESSAGE_EMPTY_ALERT, false);
                                        $focus_element = 'message';
                                    } else {
                                        if (strlen($message) > 1024) {
                                            $msg = draw_important_message(str_replace(array('_FIELD_', '_LENGTH_'), array('<b>' . _MESSAGE . '</b>', 1024), _FIELD_LENGTH_EXCEEDED), false);
                                            $focus_element = 'message';
                                        } else {
                                            if ($image_verification == 'yes' && !$objImg->check($captcha_code)) {
                                                $msg = draw_important_message(_WRONG_CODE_ALERT, false);
                                                $focus_element = 'captcha_code';
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                // deny all operations in demo version
                if (strtolower(SITE_MODE) == 'demo') {
                    $msg = draw_important_message(_OPERATION_BLOCKED, false);
                }
                if ($msg == '') {
                    ////////////////////////////////////////////////////////////
                    send_email_wo_template($admin_email, $from_email, 'Question from visitor (via Contact Us - ' . $objSiteDescription->GetParameter('header_text') . ')', _FIRST_NAME . ': ' . str_replace('\\', '', $first_name) . '<br />' . _LAST_NAME . ': ' . str_replace('\\', '', $last_name) . '<br />' . _EMAIL_ADDRESS . ': ' . str_replace('\\', '', $email) . '<br />' . _PHONE . ': ' . str_replace('\\', '', $phone) . '<br />' . _SUBJECT . ': ' . str_replace('\\', '', $subject) . '<br />' . _MESSAGE . ': ' . str_replace('\\', '', $message));
                    ////////////////////////////////////////////////////////////
                    $msg = draw_success_message(_CONTACT_US_EMAIL_SENT, false);
                    Session::Set('contact_mail_sent', true);
                    Session::Set('contact_mail_sent_time', date('Y-m-d H:i:s'));
                    $first_name = $last_name = $email = $phone = $subject = $message = '';
                }
            }
        }
        $output .= ($msg != '' ? $msg . '<br />' : '') . '
        <form method="post" name="frmContactUs" id="frmContactUs">
			' . draw_hidden_field('task', 'contact', false) . '
			' . draw_token_field(false) . '
			
		    <table class="tblContactUs" border="0" width="99%">
		    <tbody>
		    <tr>
			    <td width="25%" align="' . $align_right . '">' . _FIRST_NAME . ':</td>
			    <td><span class="mandatory_star">*</span></td>
			    <td nowrap="nowrap" align="' . $align_left . '"><input type="text" id="first_name" name="first_name" size="34" maxlength="40" value="' . decode_text($first_name) . '" autocomplete="off" /></td>
		    </tr>
		    <tr>
			    <td align="' . $align_right . '">' . _LAST_NAME . ':</td>
			    <td><span class="mandatory_star">*</span></td>
			    <td nowrap="nowrap" align="' . $align_left . '"><input type="text" id="last_name" name="last_name" size="34" maxlength="40" value="' . decode_text($last_name) . '" autocomplete="off" /></td>
		    </tr>
		    <tr>
                <td align="' . $align_right . '">' . _EMAIL_ADDRESS . ':</td>
                <td><span class="mandatory_star">*</span></td>
                <td nowrap="nowrap" align="' . $align_left . '"><input type="text" id="email" name="email" size="34" maxlength="70" value="' . decode_text($email) . '" autocomplete="off"  /></td>
		    </tr>
		    <tr>
                <td align="' . $align_right . '">' . _PHONE . ':</td>
                <td></td>
                <td nowrap="nowrap" align="' . $align_left . '"><input type="text" id="phone" name="phone" size="22" maxlength="40" value="' . decode_text($phone) . '" autocomplete="off"  /></td>
		    </tr>
		    <tr>
                <td align="' . $align_right . '">' . _SUBJECT . ':</td>
                <td><span class="mandatory_star">*</span></td>
                <td nowrap="nowrap" align="' . $align_left . '"><input type="text" id="subject" name="subject" style="width:385px;" maxlength="128" value="' . decode_text($subject) . '" autocomplete="off"  /></td>
		    </tr>
		    <tr valign="top">
                <td align="' . $align_right . '">' . _MESSAGE . ':</td>
                <td><span class="mandatory_star">*</span></td>
                <td nowrap="nowrap" align="' . $align_left . '">
                    <textarea id="message" name="message" style="width:385px;" maxlength="1024" rows="8">' . $message . '</textarea>                
                </td>
		    </tr>
			<tr>
				<td colspan="2"></td>
				<td>';
        if ($image_verification == 'yes') {
            $output .= '<table border="0">
						<tr>
							<td>
								<img id="captcha_image" src="' . APPHP_BASE . 'modules/captcha/securimage_show.php?sid=' . md5(uniqid(time())) . '" />
							</td>	
							<td width="30px" align="center">
								<img style="cursor:pointer; padding:0px; margin:0px;" id="captcha_image_reload"
								src="modules/captcha/images/refresh.gif" style="cursor:pointer;"
								onclick="document.getElementById(\'captcha_image\').src = \'modules/captcha/securimage_show.php?sid=\' + Math.random(); appSetFocus(\'captcha_code\'); return false;" title="' . _REFRESH . '" alt="' . _REFRESH . '" /><br />
								<a href="modules/captcha/securimage_play.php"><img border="0" style="padding:0px; margin:0px;" id="captcha_image_play" src="modules/captcha/images/audio_icon.gif" title="' . _PLAY . '" alt="' . _PLAY . '" /></a>						
							</td>					
							<td align="left">
								' . _TYPE_CHARS . '<br />								
								<input type="text" name="captcha_code" id="captcha_code" style="width:175px;margin-top:5px;" value="" maxlength="20" autocomplete="off" />
							</td>
						</tr>
						</table>';
        }
        $output .= '</td>
			</tr>
		    <tr><td height="25" nowrap colspan="3"></td></tr>            
		    <tr>
				<td colspan="3" align="center">
					<input type="submit" ' . ($objLogin->IsLoggedInAsAdmin() ? 'disabled' : '') . ' class="form_button" name="btnSubmitPD" id="btnSubmitPD" value="' . _SEND . '" />
				</td>
		    </tr>
		    <tr><td height="25" nowrap colspan="3"></td></tr>            
		    </table>
		</form>';
        if ($focus_element != '') {
            $output .= '<script type="text/javascript">appSetFocus(\'' . $focus_element . '\');</script>';
        }
        if ($draw) {
            echo $output;
        } else {
            return $output;
        }
    }