Ejemplo n.º 1
0
	public function edit($row) {
		if($this->is_back())
			$this->pop_box0();

		$f = $this->init_module('Libs/QuickForm');
		
		if($row) {
			$a = Base_RegionalSettingsCommon::time2reg($row['alert_on'],true,true,true,false);
			$f->setDefaults(array_merge($row,array('alert_date'=>$a,'alert_time'=>$a)));
		} else {
			$tt = $this->def_date;
			$tt = $tt-$tt%300;
			$f->setDefaults(array('alert_date'=>$tt,'alert_time'=>$tt));
		}

		$f->addElement('textarea', 'message', __('Message'));
		$f->addElement('datepicker', 'alert_date', __('Alert date'));
		$lang_code = Base_LangCommon::get_lang_code();
		$time_format = Base_RegionalSettingsCommon::time_12h()?'h:i a':'H:i';
		$f->addElement('date', 'alert_time', __('Alert time'), array('format'=>$time_format, 'optionIncrement'  => array('i' => 5), 'language'=>$lang_code));
		
		if(is_array($this->users)) {
			foreach($this->users as $k=>$r) {
				if(!Base_User_SettingsCommon::get($this->get_type(),'allow_other',$k) && Acl::get_user()!=$k)
					unset($this->users[$k]);
			}
			$f->addElement('multiselect', 'users', __('Assigned users'), $this->users);
			$f->addRule('users', __('At least one user must be assigned to an alarm.'), 'required');
			$f->setDefaults(array('users'=>array_keys($this->users)));
		}

		if($f->validate()) {
			$ret = $f->exportValues();
			if($row)
				$ret = array_merge($row,$ret);
			if(Base_RegionalSettingsCommon::time_12h())
				$ret['alert_on'] = strtotime($ret['alert_date'])+($ret['alert_time']['h']%12)*3600+(($ret['alert_time']['a']=='pm')?(3600*12):0)+$ret['alert_time']['i']*60;
			else
				$ret['alert_on'] = strtotime($ret['alert_date'])+$ret['alert_time']['H']*3600+$ret['alert_time']['i']*60;
			$ret['alert_on'] = Base_RegionalSettingsCommon::reg2time(date('Y-m-d H:i:s',$ret['alert_on']));
			if($row) {
				DB::Execute('UPDATE utils_messenger_message SET message=%s,alert_on=%T WHERE page_id=\''.$this->mid.'\' AND id=%d',array($ret['message'],$ret['alert_on'],$row['id']));
				$id = $row['id'];
				DB::Execute('DELETE FROM utils_messenger_users WHERE message_id=%d',array($id));
			} else {
				DB::Execute('INSERT INTO utils_messenger_message(page_id,parent_module,message,callback_method,callback_args,created_on,created_by,alert_on) VALUES(%s,%s,%s,%s,%s,%T,%d,%T)',array($this->mid,$this->parent_type,$ret['message'],serialize($this->callback_method),serialize($this->callback_args),time(),Acl::get_user(),$ret['alert_on']));
				$id = DB::Insert_ID('utils_messenger_message','id');
			}
			if(is_array($this->users)) {
				foreach($ret['users'] as $r)
					DB::Execute('INSERT INTO utils_messenger_users(message_id,user_login_id) VALUES (%d,%d)',array($id,$r));
			} else
				DB::Execute('INSERT INTO utils_messenger_users(message_id,user_login_id) VALUES (%d,%d)',array($id,$this->users));
			$this->pop_box0();
		}
		
		Base_ActionBarCommon::add('save',__('Save'),$f->get_submit_form_href());
		Base_ActionBarCommon::add('back',__('Back'),$this->create_back_href());
		$f->display_as_column();
	}
Ejemplo n.º 2
0
 public static function check_12h($v, $form)
 {
     $t = strtotime('2010-01-01 20:00');
     $curr_locale = setlocale(LC_TIME, 0);
     $lang_code = Base_LangCommon::get_lang_code();
     setlocale(LC_TIME, $lang_code . '_' . strtoupper($lang_code) . '.utf8', $lang_code . '_' . strtoupper($lang_code) . '.UTF-8', $lang_code . '.utf8', $lang_code . '.UTF-8', isset(self::$countries[$lang_code]) ? self::$countries[$lang_code] : null);
     //win32
     $ret = $t == strtotime('2010-01-01 ' . strftime($v, $t));
     setlocale(LC_TIME, $curr_locale);
     return $ret;
 }
Ejemplo n.º 3
0
 public static function available_new_languages()
 {
     $all_langs = Base_LangCommon::get_all_languages();
     $installed_langs = Base_LangCommon::get_installed_langs();
     foreach ($installed_langs as $lang_code => $language_name) {
         unset($all_langs[$lang_code]);
     }
     foreach ($all_langs as $code => $name) {
         $all_langs[$code] .= " ({$code})";
     }
     return $all_langs;
 }
Ejemplo n.º 4
0
 public function install()
 {
     $this->create_data_dir();
     if (!is_dir(DATA_DIR . '/Base_Lang/base')) {
         mkdir(DATA_DIR . '/Base_Lang/base');
     }
     if (!is_dir(DATA_DIR . '/Base_Lang/custom')) {
         mkdir(DATA_DIR . '/Base_Lang/custom');
     }
     ModuleManager::include_common('Base_Lang', 0);
     Base_LangCommon::install_translations(Base_LangInstall::module_name());
     return Variable::set('default_lang', 'en');
 }
Ejemplo n.º 5
0
 function _createElements()
 {
     $time_format = Base_RegionalSettingsCommon::time_12h() ? 'h:i a' : 'H:i';
     $lang_code = Base_LangCommon::get_lang_code();
     $this->_options['format'] = $time_format;
     if (!isset($this->_options['optionIncrement'])) {
         $this->_options['optionIncrement'] = array('i' => 5);
     }
     $this->_options['language'] = $lang_code;
     if (!isset($this->_options['date'])) {
         $this->_options['date'] = true;
     }
     $this->_elements['__date'] = new HTML_QuickForm_date('__date', null, $this->_options, $this->getAttributes());
     if ($this->_options['date']) {
         $this->_elements['__datepicker'] = new HTML_QuickForm_datepicker('__datepicker', null, $this->getAttributes());
     }
 }
Ejemplo n.º 6
0
 public function action()
 {
     $success = true;
     ini_set('display_errors', true);
     set_time_limit(0);
     switch ($this->get_step()) {
         case 1:
             $this->_patches_ran = PatchUtil::apply_new();
             $this->set_next_step(2);
             break;
         case 2:
             ModuleManager::create_common_cache();
             Base_ThemeCommon::themeup();
             Base_LangCommon::update_translations();
             Cache::clear();
             break;
     }
     return $success;
 }
Ejemplo n.º 7
0
 protected function load_libs()
 {
     $m = $this->get_module_dir();
     load_css($m . 'bootstrap-compat.css');
     load_css($m . 'query-builder.default.css');
     load_js($m . 'query-builder.standalone.js');
     load_js($m . 'helper.js');
     $lang_code = Base_LangCommon::get_lang_code();
     if ($lang_code) {
         $lang_file = $this->get_module_dir() . 'i18n/query-builder.' . $lang_code . '.js';
         if (file_exists($lang_file)) {
             load_js($lang_file);
         }
     }
 }
Ejemplo n.º 8
0
 public function action()
 {
     Base_LangCommon::update_translations();
     return true;
 }
Ejemplo n.º 9
0
 public function check_if_langpack_exists($langpack)
 {
     $langs = Base_LangCommon::get_installed_langs();
     return isset($langs[$langpack]) == false;
 }
Ejemplo n.º 10
0
    foreach ($langs as $l) {
        $rest[$l] = isset($labels[$l]) ? $labels[$l] : $l;
    }
    asort($list);
    asort($rest);
    $list = array_merge(array('en' => $labels['en']), $list);
    print '<div id="complete_translations">';
    foreach ($list as $l => $label) {
        Base_LangCommon::print_flag($l, $label, 'href="?install_lang=' . $l . '"');
        unset($rest[$l]);
    }
    print '</div>';
    print '<a class="show_incomplete button" onclick="this.style.display=\'none\';document.getElementById(\'incomplete_translations\').style.display=\'\';">Show incomplete translations</a>';
    print '<div id="incomplete_translations" style="display:none;">';
    foreach ($rest as $l => $label) {
        Base_LangCommon::print_flag($l, $label, 'href="?install_lang=' . $l . '"');
    }
    print '</div>';
    set_header('Select Language');
    die;
}
/**
 * Check access to working directories
 */
if (file_exists('easyinstall.php')) {
    unlink('easyinstall.php');
}
if (isset($_GET['check'])) {
    require_once 'check.php';
    print '<br><br><a class="button" href="index.php?install_lang=' . $install_lang_load . '" style="display:block;width:200px; margin:0 auto;">' . __('Continue with installation') . '</a>';
    die;
Ejemplo n.º 11
0
 function toHtml()
 {
     if ($this->_flagFrozen) {
         return $this->getFrozenHtml();
     } else {
         if (!isset($this->config['language'])) {
             $this->config['language'] = substr(Base_LangCommon::get_lang_code(), 0, 2);
         }
         if (!isset($this->config['scayt_sLang'])) {
             $this->config['scayt_sLang'] = Base_LangCommon::get_lang_code();
         }
         if (!isset($this->config['scayt_autoStartup'])) {
             $this->config['scayt_autoStartup'] = 0;
         }
         eval_js('ckeditors_hib["' . $this->_attributes['id'] . '"]=' . json_encode($this->config));
         return $this->_getTabs() . '<textarea' . $this->_getAttrString($this->_attributes) . '>' . preg_replace("/(\r\n|\n|\r)/", '&#010;', htmlspecialchars($this->_value)) . '</textarea>';
     }
 }
Ejemplo n.º 12
0
	/**
	 * Displays the table.
	 *
	 * @param string template file that should be used to display the table, use Base_ThemeCommon::get_template_filename() for proper filename
	 * @param bool enabling paging, true by default
	 */
	public function body($template=null,$paging=true){
		if(!$this->columns) trigger_error('columns array empty, please call set_table_columns',E_USER_ERROR);
		$md5_id = md5($this->get_path());
		$this->set_module_variable('first_display','done');
		$theme = $this->init_module('Base/Theme');
		$per_page = $this->get_module_variable('per_page');
		$order = $this->get_module_variable('order');
        $this->expandable = $this->get_module_variable('expandable',$this->expandable);
        $expand_action_only = false;
        if ($this->expandable) {
            if(!$this->en_actions) {
                $expand_action_only = true;
                $this->en_actions = true;
            }
        }
		if ($this->en_actions) $actions_position = Base_User_SettingsCommon::get('Utils/GenericBrowser','actions_position');

		$ch_adv_search = $this->get_unique_href_variable('adv_search');
		if (isset($ch_adv_search)) {
			$this->set_module_variable('adv_search',$ch_adv_search);
			$this->set_module_variable('search',array());
			location(array());
		}

		$search = $this->get_module_variable('search');

		$renderer = new HTML_QuickForm_Renderer_TCMSArraySmarty();
		$form_p = $this->init_module('Libs/QuickForm');
		$pager_on = false;
		if(isset($this->rows_qty) && $paging) {
			if(!$this->forced_per_page) {
				$form_p->addElement('select','per_page',__('Number of rows per page'), Utils_GenericBrowserCommon::$possible_vals_for_per_page, 'onChange="'.$form_p->get_submit_form_js(false).'"');
				$form_p->setDefaults(array('per_page'=>$per_page));
			}
			$qty_pages = ceil($this->rows_qty/$this->per_page);
			if ($qty_pages<=25) {
					$pages = array();
				if($this->rows_qty==0)
					$pages[0] = 1;
				else
					foreach (range(1, $qty_pages) as $v) $pages[$v] = $v;
				$form_p->addElement('select','page',__('Page'), $pages, 'onChange="'.$form_p->get_submit_form_js(false).'"');
				$form_p->setDefaults(array('page'=>(int)(ceil($this->offset/$this->per_page)+1)));
			} else {
				$form_p->addElement('text','page',__('Page (%s to %s)', array(1,$qty_pages)), array('onclick'=>'this.focus();this.select();', 'onChange'=>$form_p->get_submit_form_js(false), 'style'=>'width:'.(7*strlen($qty_pages)).'px;'));
				$form_p->setDefaults(array('page'=>(int)(ceil($this->offset/$this->per_page)+1)));
			}
			$pager_on = true;
		}
		$search_on=false;
		if(!$this->is_adv_search_on()) {
			foreach($this->columns as $k=>$v)
				if (isset($v['search'])) {
					$this->form_s->addElement('text','search',__('Keyword'), array('id'=>'gb_search_field', 'placeholder'=>__('search keyword...'), 'x-webkit-speech'=>'x-webkit-speech', 'lang'=>Base_LangCommon::get_lang_code(), 'onwebkitspeechchange'=>$this->form_s->get_submit_form_js()));
					$this->form_s->setDefaults(array('search'=>isset($search['__keyword__'])?$search['__keyword__']:''));
					$search_on=true;
					break;
				}
		} else {
			$search_fields = array();
			if ($this->en_actions && $actions_position==0) $mov = 1;
			else $mov=0;
			foreach($this->columns as $k=>$v) {
				if(isset($v['display']) && !$v['display']) {
					$mov--;
					continue;
				}
				if (isset($v['search'])) {
					$this->form_s->addElement('hidden','search__'.$v['search'],'');
					$default = isset($search[$v['search']])?$search[$v['search']]:'';
					$this->form_s->setDefaults(array('search__'.$v['search']=>$default));
					$in = '<input value="'.$default.'" x-webkit-speech="x-webkit-speech" lang="'.Base_LangCommon::get_lang_code().'" name="search__textbox_'.$v['search'].'" placeholder="'.__('search keyword...').'" onblur="document.forms[\''.$this->form_s->getAttribute('name').'\'].search__'.$v['search'].'.value = this.value;" onkeydown="if (event.keyCode==13) {document.forms[\''.$this->form_s->getAttribute('name').'\'].search__'.$v['search'].'.value = this.value;'.$this->form_s->get_submit_form_js().';}" />';
					$search_fields[$k+$mov] = $in;
					$search_on=true;
				}
			}
			$theme->assign('search_fields', $search_fields);
		}
		if ($search_on) {
			$this->form_s->addElement('submit','submit_search',__('Search'), array('id'=>'gb_search_button'));
			if (Base_User_SettingsCommon::get($this->get_type(), 'show_all_button')) {
				$el = $this->form_s->addElement('hidden','show_all_pressed');
				$this->form_s->addElement('button','show_all',__('Show all'), array('onclick'=>'document.forms["'.$this->form_s->getAttribute('name').'"].show_all_pressed.value="1";'.$this->form_s->get_submit_form_js()));
				$el->setValue('0');
			}
		}
		if ($pager_on) {
			$form_p->accept($renderer);
			$form_array = $renderer->toArray();
			$theme->assign('form_data_paging', $form_array);
			$theme->assign('form_name_paging', $form_p->getAttribute('name'));

			// form processing
			if($form_p->validate()) {
				$values = $form_p->exportValues();
				if(isset($values['per_page'])) {
					$this->set_module_variable('per_page',$values['per_page']);
					Base_User_SettingsCommon::save('Utils/GenericBrowser','per_page',$values['per_page']);
				}
				if(isset($values['page']) && is_numeric($values['page']) && ($values['page']>=1 && $values['page']<=$qty_pages)) {
					$this->set_module_variable('offset',($values['page']-1)*$this->per_page);
				}
				location(array());
				return;
			}
		}
		if ($search_on) {
			$this->form_s->accept($renderer);
			$form_array = $renderer->toArray();
			$theme->assign('form_data_search', $form_array);
			$theme->assign('form_name_search', $this->form_s->getAttribute('name'));

			// form processing
			if($this->form_s->validate()) {
				$values = $this->form_s->exportValues();
				if (isset($values['show_all_pressed']) && $values['show_all_pressed']) {
					$this->set_module_variable('search',array());
					$this->set_module_variable('show_all_triggered',true);
					location(array());
					return;
				}
				$search = array();
				foreach ($values as $k=>$v){
					if ($k=='search') {
						if ($v!=__('search keyword...') && $v!='')
							$search['__keyword__'] = $v;
						break;
					}
					if (substr($k,0,8)=='search__') {
						$val = substr($k,8);
						if ($v!=__('search keyword...') && $v!='') $search[$val] = $v;
					}
				}
				$this->set_module_variable('search',$search);
				location(array());
				return;
			}
		}

		$headers = array();
		if ($this->en_actions) {
			$max_actions = 0; // Possibly improve it to calculate it during adding actions
			foreach($this->actions as $i=>$v) {
				$this_width = 0;
				foreach ($v as $vv) {
					$this_width += $vv['size'];
				}
				if ($this_width>$max_actions) $max_actions = $this_width;
			}
			if ($actions_position==0) $headers[-1] = array('label'=>'<span>'.'&nbsp;'.'</span>','attrs'=>'style="width: '.($max_actions*16+6).'px;" class="Utils_GenericBrowser__actions"');
			else $headers[count($this->columns)] = array('label'=>'<span>'.'&nbsp;'.'</span>','attrs'=>'style="width: '.($max_actions*16+6).'px;" class="Utils_GenericBrowser__actions"');
		}

		$all_width = 0;
		foreach($this->columns as $k=>$v) {
			if (!isset($this->columns[$k]['width'])) $this->columns[$k]['width'] = 100;
			if (!is_numeric($this->columns[$k]['width'])) continue;
			$all_width += $this->columns[$k]['width'];
			if (isset($v['quickjump'])) {
				$quickjump = $this->set_module_variable('quickjump',$v['quickjump']);
				$quickjump_col = $k;
			}
		}
		$i = 0;
		$is_order = false;
		$adv_history = Base_User_SettingsCommon::get('Utils/GenericBrowser','adv_history');
		foreach($this->columns as $v) {
			if (array_key_exists('display', $v) && $v['display']==false) {
				$i++;
				continue;
			}
			if(isset($v['order'])) $is_order = true;
			if(!isset($headers[$i])) $headers[$i] = array('label'=>'');
			if (!$adv_history && $v['name'] && $v['name']==$order[0]['column']) $label = '<span style="padding-right: 12px; margin-right: 12px; background-image: url('.Base_ThemeCommon::get_template_file('Utils_GenericBrowser','sort-'.strtolower($order[0]['direction']).'ending.png').'); background-repeat: no-repeat; background-position: right;">'.$v['name'].'</span>';
			else $label = $v['name'];
			$headers[$i]['label'] .= (isset($v['preppend'])?$v['preppend']:'').(isset($v['order'])?'<a '.$this->create_unique_href(array('change_order'=>$v['name'])).'>' . $label . '</a>':$label).(isset($v['append'])?$v['append']:'');
			//if ($v['search']) $headers[$i] .= $form_array['search__'.$v['search']]['label'].$form_array['search__'.$v['search']]['html'];
            if ($this->absolute_width) {
                 $headers[$i]['attrs'] = 'width="'.$v['width'].'" ';
            } elseif (!is_numeric($v['width'])) {
                $headers[$i]['attrs'] = 'style="width:'.$v['width'].'" ';
            } else {
                $headers[$i]['attrs'] = 'width="'.intval(100*$v['width']/$all_width).'%" ';
            }
			$headers[$i]['attrs'] .= 'nowrap="1" ';
			if (isset($v['attrs'])) $headers[$i]['attrs'] .= $v['attrs'].' ';
			$i++;
		}
		ksort($headers);
		$out_headers = array_values($headers);
		unset($headers);

		$out_data = array();

        if($this->expandable) {
            eval_js_once('gb_expandable["'.$md5_id.'"] = {};');
            eval_js_once('gb_expanded["'.$md5_id.'"] = 0;');

            eval_js_once('gb_expand_icon = "'.Base_ThemeCommon::get_template_file('Utils/GenericBrowser', 'expand.gif').'";');
            eval_js_once('gb_collapse_icon = "'.Base_ThemeCommon::get_template_file('Utils/GenericBrowser', 'collapse.gif').'";');
            eval_js_once('gb_expand_icon_off = "'.Base_ThemeCommon::get_template_file('Utils/GenericBrowser', 'expand_gray.gif').'";');
            eval_js_once('gb_collapse_icon_off = "'.Base_ThemeCommon::get_template_file('Utils/GenericBrowser', 'collapse_gray.gif').'";');
        }

		foreach($this->rows as $i=>$r) {
			$col = array();

            if($this->expandable) {
                $row_id =  $md5_id.'_'.$i;
                $this->__add_row_action($i,'style="display:none;" href="javascript:void(0)" onClick="gb_expand(\''.$md5_id.'\',\''.$i.'\')" id="gb_more_'.$row_id.'"','Expand', null, Base_ThemeCommon::get_template_file('Utils/GenericBrowser', 'plus_gray.png'), 1001);
                $this->__add_row_action($i,'style="display:none;" href="javascript:void(0)" onClick="gb_collapse(\''.$md5_id.'\',\''.$i.'\')" id="gb_less_'.$row_id.'"','Collapse', null, Base_ThemeCommon::get_template_file('Utils/GenericBrowser', 'minus_gray.png'), 1001, false, 0);
                $this->__add_row_js($i,'gb_expandable_init("'.Epesi::escapeJS($md5_id,true,false).'","'.Epesi::escapeJS($i,true,false).'")');
                if(!isset($this->row_attrs[$i])) $this->row_attrs[$i]='';
                $this->row_attrs[$i] .= 'id="gb_row_'.$row_id.'"';
            }

            if ($this->en_actions) {
				if ($actions_position==0) $column_no = -1;
				else $column_no = count($this->columns);
				$col[$column_no]['attrs'] = '';
				if (!empty($this->actions[$i])) {
					uasort($this->actions[$i], array($this,'sort_actions'));
					$actions = '';
					foreach($this->actions[$i] as $icon=>$arr) {
						$actions .= '<a '.Utils_TooltipCommon::open_tag_attrs($arr['tooltip']!==null?$arr['tooltip']:$arr['label'], $arr['tooltip']===null).' '.$arr['tag_attrs'].'>';
					    if ($icon=='view' || $icon=='delete' || $icon=='edit' || $icon=='info' || $icon=='restore' || $icon=='append data' || $icon=='active-on' || $icon=='active-off' || $icon=='history' || $icon=='move-down' || $icon=='move-up' || $icon=='history_inactive' || $icon=='print' || $icon == 'move-up-down') {
							$actions .= '<img class="action_button" src="'.Base_ThemeCommon::get_template_file('Utils/GenericBrowser',$icon.($arr['off']?'-off':'').'.png').'" border="0">';
					    } elseif(file_exists($icon)) {
							$actions .= '<img class="action_button" src="'.$icon.'" border="0">';
					    } else {
							$actions .= $arr['label'];
					    }
						$actions .= '</a>';
					}
					$col[$column_no]['label'] = $actions;
                    $col[$column_no]['attrs'] .= ' class="Utils_GenericBrowser__actions Utils_GenericBrowser__td"';

					// Add overflow_box to actions
					$settings = Base_User_SettingsCommon::get('Utils_GenericBrowser', 'zoom_actions');
					if ($settings==2 || ($settings==1 && detect_iphone()))
						$col[$column_no]['attrs'] .= ' onmouseover="if(typeof(table_overflow_show)!=\'undefined\')table_overflow_show(this,true);"';
				} else {
					$col[$column_no]['label'] = '&nbsp;';
                    $col[$column_no]['attrs'] .= 'nowrap="nowrap"'.' class="Utils_GenericBrowser__td"';
				}
				if (isset($this->no_actions[$i]))
					$col[$column_no]['attrs'] .= ' style="display:none;"';
			}
			foreach($r as $k=>$v) {
				if (is_array($v) && isset($v['dummy'])) $v['style'] = 'display:none;';
				if (array_key_exists('display',$this->columns[$k]) && $this->columns[$k]['display']==false) continue;
				if (is_array($v) && isset($v['attrs'])) $col[$k]['attrs'] = $v['attrs'];
				else $col[$k]['attrs'] = '';
				if ($this->absolute_width) $col[$k]['attrs'] .= ' width="'.$this->columns[$k]['width'].'"';
				if (!is_array($v)) $v = array('value'=>$v);
				$col[$k]['label'] = $v['value'];
				if (!isset($v['overflow_box']) || $v['overflow_box']) {
					$col[$k]['attrs'] .= ' onmouseover="if(typeof(table_overflow_show)!=\'undefined\')table_overflow_show(this);"';
				} else {
					if (!isset($v['style'])) $v['style'] = '';
					$v['style'] .= 'white-space: normal;';
				}
				$col[$k]['attrs'] .= ' class="Utils_GenericBrowser__td '.(isset($v['class'])?$v['class']:'').'"';
				$col[$k]['attrs'] .= isset($v['style'])? ' style="'.$v['style'].'"':'';
				if (isset($quickjump_col) && $k==$quickjump_col) $col[$k]['attrs'] .= ' class="Utils_GenericBrowser__quickjump"';
				if ((!isset($this->columns[$k]['wrapmode']) || $this->columns[$k]['wrapmode']!='cut') && isset($v['hint'])) $col[$k]['attrs'] .= ' title="'.$v['hint'].'"';
				$col[$k]['attrs'] .= (isset($this->columns[$k]['wrapmode']) && $this->columns[$k]['wrapmode']=='nowrap')?' nowrap':'';
				if ($all_width!=0)
        				$max_width = 130*$this->columns[$k]['width']/$all_width*(7+(isset($this->columns[$k]['fontsize'])?$this->columns[$k]['fontsize']:0));
        			else
        			        $max_width = 0;
				if (isset($this->columns[$k]['wrapmode']) && $this->columns[$k]['wrapmode']=='cut'){
					if (strlen($col[$k]['label'])>$max_width){
						if (is_array($v) && isset($v['hint'])) $col[$k]['attrs'] .= ' title="'.$col[$k]['label'].': '.$v['hint'].'"';
						else $col[$k]['attrs'] .= ' title="'.$col[$k]['label'].'"';
						$col[$k]['label'] = substr($col[$k]['label'],0,$max_width-3).'...';
					} elseif (is_array($v) && isset($v['hint'])) $col[$k]['attrs'] .= ' title="'.$v['hint'].'"';
					$col[$k]['attrs'] .= ' nowrap';
				}
			}
			ksort($col);
			$expanded = $this->expandable ? ' expanded' : '';
			foreach($col as $v)
				$out_data[] = array('label'=>'<div class="expandable'.$expanded.'">'.$v['label'].'</div>','attrs'=>$v['attrs']);
			if(isset($this->rows_jses[$i]))
				eval_js($this->rows_jses[$i]);
		}
		if (isset($quickjump)) {
			$quickjump_to = $this->get_module_variable('quickjump_to');
			$all = '<span class="all">'.__('All').'</span>';
			if (isset($quickjump_to) && $quickjump_to != '') $all = '<a class="all" '.$this->create_unique_href(array('quickjump_to'=>'')).'>'.__('All').'</a>';
			$letter_links = array(0 => $all);
			if ($quickjump_to != '0')
				$letter_links[] .= '<a class="all" '.$this->create_unique_href(array('quickjump_to'=>'0')).'>'.'123'.'</a>';
			else
				$letter_links[] .= '<span class="all">' . '123' . '</span>';
			$letter = 'A';
			while ($letter<='Z') {
				if ($quickjump_to != $letter)
					$letter_links[] .= '<a class="letter" '.$this->create_unique_href(array('quickjump_to'=>$letter)).'>'.$letter.'</a>';
				else
					$letter_links[] .= '<span class="letter">' . $letter . '</span>';
				$letter = chr(ord($letter)+1);
			}
			$theme->assign('letter_links', $letter_links);
			$theme->assign('quickjump_to', $quickjump_to);
		}

		$theme->assign('data', $out_data);
		$theme->assign('cols', $out_headers);

		$theme->assign('row_attrs', $this->row_attrs);

        $theme->assign('table_id','table_'.$md5_id);
        if($expand_action_only) {
            eval_js('gb_expandable_hide_actions("'.$md5_id.'")');
        }
		$theme->assign('table_prefix', $this->table_prefix);
		$theme->assign('table_postfix', $this->table_postfix);

		$theme->assign('summary', $this->summary());
		$theme->assign('first', $this->gb_first());
		$theme->assign('prev', $this->gb_prev());
		$theme->assign('next', $this->gb_next());
		$theme->assign('last', $this->gb_last());
		$theme->assign('custom_label', $this->custom_label);
		$theme->assign('custom_label_args', $this->custom_label_args);

        if($this->expandable) {
            $theme->assign('expand_collapse',array(
                'e_label'=>__('Expand All'),
                'e_href'=>'href="javascript:void(0);" onClick=\'gb_expand_all("'.$md5_id.'")\'',
                'e_id'=>'expand_all_button_'.$md5_id,
                'c_label'=>__('Collapse All'),
                'c_href'=>'href="javascript:void(0);" onClick=\'gb_collapse_all("'.$md5_id.'")\'',
                'c_id'=>'collapse_all_button_'.$md5_id
            ));
            $max_actions = isset($max_actions) ? $max_actions : 0;
            eval_js('gb_expandable_adjust_action_column("'.$md5_id.'", ' . $max_actions . ')');
            eval_js('gb_show_hide_buttons("'.$md5_id.'")');
        }

		if ($search_on) $theme->assign('adv_search','<a id="switch_search_'.($this->is_adv_search_on()?'simple':'advanced').'" class="button" '.$this->create_unique_href(array('adv_search'=>!$this->is_adv_search_on())).'>' . ($this->is_adv_search_on()?__('Simple Search'):__('Advanced Search')) . '&nbsp;&nbsp;&nbsp;<img src="' . Base_ThemeCommon::get_template_file($this -> get_type(), 'advanced.png') . '" width="8px" height="20px" border="0" style="vertical-align: middle;"></a>');
		else $theme->assign('adv_search','');

		if (Base_User_SettingsCommon::get('Utils/GenericBrowser','adv_history') && $is_order){
			$theme->assign('reset', '<a '.$this->create_unique_href(array('action'=>'reset_order')).'>'.__('Reset Order').'</a>');
			$theme->assign('order',$this->get_module_variable('order_history_display'));
		}
		$theme->assign('id',md5($this->get_path()));
		
		if ($this->resizable_columns) {
			load_js($this->get_module_dir().'js/col_resizable.js');
				
			$fixed_col_setting = !empty($this->fixed_columns_selector)? ', skipColumnClass:"'.$this->fixed_columns_selector.'"':'';
			eval_js('jq("#table_'.$md5_id.'").colResizable({liveDrag:true, postbackSafe:true, partialRefresh:true'.$fixed_col_setting.'});');
		}
		
		if(isset($template))
			$theme->display($template,true);
		else
			$theme->display();
		$this->set_module_variable('show_all_triggered',false);
	}
Ejemplo n.º 13
0
 private function prepare_post_data($function, &$params, $serialize_response)
 {
     return array(IClient::param_function => $function, IClient::param_installation_key => $this->license_key, IClient::param_client_version => IClient::client_version, IClient::param_serialize => $serialize_response, IClient::param_arguments => serialize($params), IClient::param_lang => Base_LangCommon::get_lang_code(), IClient::param_epesi_version => EPESI_VERSION);
 }
Ejemplo n.º 14
0
 public static function QFfield_duration(&$form, $field, $label, $mode, $default, $desc)
 {
     if ($mode == 'add' || $mode == 'edit') {
         $dur = array(-1 => '---', 300 => __('5 minutes'), 900 => __('15 minutes'), 1800 => __('30 minutes'), 2700 => __('45 minutes'), 3600 => __('1 hour'), 7200 => __('2 hours'), 14400 => __('4 hours'), 28800 => __('8 hours'));
         if (isset($dur[$default])) {
             $duration_switch = '1';
         } else {
             $duration_switch = '0';
         }
         $form->addElement('select', $field, $label, $dur, array('id' => $field));
         $time_format = Base_RegionalSettingsCommon::time_12h() ? 'h:i a' : 'H:i';
         $lang_code = Base_LangCommon::get_lang_code();
         $form->addElement('timestamp', 'end_time', __('End Time'), array('date' => false, 'format' => $time_format, 'optionIncrement' => array('i' => 5), 'language' => $lang_code, 'id' => 'end_time'));
         $form->addElement('hidden', 'duration_switch', $duration_switch, array('id' => 'duration_switch'));
         eval_js_once('crm_calendar_duration_switcher = function(x) {' . 'var sw = $(\'duration_switch\');' . 'if((!x && sw.value==\'0\') || (x && sw.value==\'1\')) {' . 'var end_b=$(\'crm_calendar_event_end_block\');if(end_b)end_b.hide();' . 'var dur_b=$(\'crm_calendar_duration_block\');if(dur_b)dur_b.show();' . 'sw.value=\'1\';' . '} else {' . 'var end_b=$(\'crm_calendar_event_end_block\');if(end_b)end_b.show();' . 'var dur_b=$(\'crm_calendar_duration_block\');if(dur_b)dur_b.hide();' . 'sw.value=\'0\';' . '}}');
         eval_js_once('crm_calendar_event_timeless = function(val) {' . 'var cal_style;' . 'var tdb=$(\'toggle_duration_button\');' . 'if(tdb==null) return;' . 'if(val){' . 'cal_style = \'none\';' . '}else{' . 'cal_style = \'\';' . '}' . 'var db = $(\'duration_end_date__data_\');' . 'if(db) db.style.display = cal_style;' . 'var ts = $(\'time_s\');' . 'if(ts) ts.style.display = cal_style;' . '}');
         $form->addElement('button', 'toggle', __('Toggle'), array('onclick' => 'crm_calendar_duration_switcher()', 'id' => 'toggle_duration_button', 'class' => 'button'));
         $form->addElement('checkbox', 'timeless', __('Timeless'), null, array('onClick' => 'crm_calendar_event_timeless(this.checked)', 'id' => 'timeless'));
         eval_js('crm_calendar_event_timeless($("timeless").checked)');
         eval_js('crm_calendar_duration_switcher(1)');
         $form->setDefaults(array('duration_switch' => $duration_switch));
         $form->setDefaults(array($field => $default));
         $form->setDefaults(array('timeless' => $default == -1 ? 1 : 0));
         if (class_exists('Utils_RecordBrowser') && isset(Utils_RecordBrowser::$last_record['time'])) {
             $form->setDefaults(array('end_time' => strtotime('+' . $default . ' seconds', Utils_RecordBrowser::$last_record['time'])));
         }
         $form->addFormRule(array('CRM_MeetingCommon', 'check_date_and_time'));
     } else {
         $form->addElement('checkbox', 'timeless', __('Timeless'));
         $form->setDefaults(array('timeless' => $default == -1 ? 1 : 0));
     }
     //messanger
     if ($mode == 'add') {
         eval_js_once('crm_calendar_event_messenger = function(v) {var mb=$("messenger_block");if(!mb)return;if(v)mb.show();else mb.hide();}');
         $form->addElement('select', 'messenger_before', __('Popup alert'), array(0 => __('on event start'), 900 => __('15 minutes before event'), 1800 => __('30 minutes before event'), 2700 => __('45 minutes before event'), 3600 => __('1 hour before event'), 2 * 3600 => __('2 hours before event'), 3 * 3600 => __('3 hours before event'), 4 * 3600 => __('4 hours before event'), 8 * 3600 => __('8 hours before event'), 12 * 3600 => __('12 hours before event'), 24 * 3600 => __('24 hours before event')));
         $form->addElement('textarea', 'messenger_message', __('Popup message'), array('id' => 'messenger_message'));
         $form->addElement('select', 'messenger_on', __('Alert'), array('none' => __('None'), 'me' => __('me'), 'all' => __('all selected employees')), array('onChange' => 'crm_calendar_event_messenger(this.value!="none");$("messenger_message").value=$("title").value;'));
         //			$form->addElement('checkbox','messenger_on',__('Alert me'),null,array('onClick'=>'crm_calendar_event_messenger(this.checked);$("messenger_message").value=$("event_title").value;'));
         eval_js('crm_calendar_event_messenger(' . ($form->exportValue('messenger_on') != 'none' && $form->exportValue('messenger_on') != '' ? 1 : 0) . ')');
         $form->registerRule('check_my_user', 'callback', array('CRM_MeetingCommon', 'check_my_user'));
         $form->addRule(array('messenger_on', 'emp_id'), __('You have to select your contact to set alarm on it'), 'check_my_user');
     }
 }
Ejemplo n.º 15
0
 /**
  * For internal use only.
  */
 public static function install_translations($mod_name, $lang_dir = 'lang')
 {
     global $translations;
     $directory = 'modules/' . str_replace('_', '/', $mod_name) . '/' . $lang_dir;
     if (!is_dir($directory)) {
         return;
     }
     $content = scandir($directory);
     $trans_backup = $translations;
     self::update_translations();
     // cleanup translations file
     foreach ($content as $name) {
         if ($name == '.' || $name == '..' || preg_match('/^[\\.~]/', $name)) {
             continue;
         }
         $langcode = substr($name, 0, strpos($name, '.'));
         $translations = array();
         // prepare to receive translations
         include $directory . '/' . $name;
         // read translations
         Base_LangCommon::append_base($langcode, $translations);
         // extend base translations
     }
     $translations = $trans_backup;
     self::refresh_cache();
 }
Ejemplo n.º 16
0
 public function mini()
 {
     if (!Base_AclCommon::check_permission('Search')) {
         return '';
     }
     $form = $this->init_module(Libs_QuickForm::module_name(), __('Searching'));
     $form->addElement('text', 'quick_search', __('Quick Search'), array('x-webkit-speech' => 'x-webkit-speech', 'lang' => Base_LangCommon::get_lang_code(), 'onwebkitspeechchange' => $form->get_submit_form_js()));
     $form->addElement('submit', 'quick_search_submit', __('Search'), array('class' => 'mini_submit'));
     $theme = $this->pack_module(Base_Theme::module_name());
     $theme->assign('submit_href', $form->get_submit_form_href());
     $theme->assign('submit_label', __('Search'));
     $form->assign_theme('form', $theme);
     $theme->assign('form_mini', 'yes');
     $theme->display('Search');
     if ($form->validate()) {
         $search = $form->exportValues();
         Base_BoxCommon::location('Base_Search', null, null, null, array('quick_search' => $search['quick_search']));
     }
 }
Ejemplo n.º 17
0
 public static function set_locale()
 {
     self::$curr_locale = setlocale(LC_ALL, 0);
     if (ModuleManager::is_installed('Base_Lang') !== -1) {
         $lang_code = strtolower(Base_LangCommon::get_lang_code());
     } else {
         $lang_code = 'en';
     }
     setlocale(LC_ALL, $lang_code . '_' . strtoupper($lang_code) . '.utf8', $lang_code . '_' . strtoupper($lang_code) . '.UTF-8', $lang_code . '.utf8', $lang_code . '.UTF-8', isset(self::$countries[$lang_code]) ? self::$countries[$lang_code] : null);
     //win32
     setlocale(LC_NUMERIC, 'en_EN.utf8', 'en_EN.UTF-8', 'en_US.utf8', 'en_US.UTF-8', 'C', 'POSIX', 'en_EN', 'en_US', 'en', 'en.utf8', 'en.UTF-8', 'english');
     // detect turkish issues - fixed in php 5.5
     // https://bugs.php.net/bug.php?id=18556
     // http://www.i18nguy.com/unicode/turkish-i18n.html#problem
     if (version_compare(phpversion(), '5.5', '<') && strtolower('I') != 'i') {
         setlocale(LC_CTYPE, 'en_EN.utf8', 'en_EN.UTF-8', 'en_US.utf8', 'en_US.UTF-8', 'C', 'POSIX', 'en_EN', 'en_US', 'en', 'en.utf8', 'en.UTF-8', 'english');
     }
 }
Ejemplo n.º 18
0
 public function done($d)
 {
     @set_time_limit(0);
     if (count($this->ini) == 1) {
         $pkgs = reset($this->ini);
         $pkgs = $pkgs['package'];
     } else {
         $pkgs = isset($this->ini[$d[0]['setup_type']]['package']) ? $this->ini[$d[0]['setup_type']]['package'] : array();
     }
     $t = microtime(true);
     error_log(date('Y-m-d H:i:s') . ': installing "Base" ...' . "\n", 3, DATA_DIR . '/firstrun.log');
     if (!ModuleManager::install('Base', null, false)) {
         print 'Unable to install Base module pack.';
         return false;
     }
     error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
     $t = microtime(true);
     error_log(date('Y-m-d H:i:s') . ': creating admin user ...' . "\n", 3, DATA_DIR . '/firstrun.log');
     if (!Base_UserCommon::add_user($d['simple_user']['login'])) {
         print 'Unable to create user';
         return false;
     }
     $user_id = Base_UserCommon::get_user_id($d['simple_user']['login']);
     if ($user_id === false) {
         print 'Unable to get admin user id';
         return false;
     }
     if (!DB::Execute('INSERT INTO user_password(user_login_id,password,mail) VALUES(%d,%s, %s)', array($user_id, md5($d['simple_user']['pass']), $d['simple_user']['mail']))) {
         print 'Unable to set user password';
         return false;
     }
     if (!Base_UserCommon::change_admin($user_id, 2)) {
         print 'Unable to update admin account data (groups).';
         return false;
     }
     Acl::set_user($user_id, true);
     Variable::set('anonymous_setup', false);
     error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
     $t = microtime(true);
     error_log(date('Y-m-d H:i:s') . ': setting mail server ...' . "\n", 3, DATA_DIR . '/firstrun.log');
     $method = $d['simple_mail']['mail_method'];
     Variable::set('mail_method', $method);
     Variable::set('mail_from_addr', $d['simple_user']['mail']);
     Variable::set('mail_from_name', $d['simple_user']['login']);
     if ($method == 'smtp') {
         Variable::set('mail_host', $d['simple_mail_smtp']['mail_host']);
         if ($d['simple_mail_smtp']['mail_user'] !== '' && $d['simple_mail_smtp']['mail_user'] !== '') {
             $auth = true;
         } else {
             $auth = false;
         }
         Variable::set('mail_auth', $auth);
         if ($auth) {
             Variable::set('mail_user', $d['simple_mail_smtp']['mail_user']);
             Variable::set('mail_password', $d['simple_mail_smtp']['mail_password']);
         }
     }
     error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
     $t = microtime(true);
     error_log(date('Y-m-d H:i:s') . ': Installing modules ...' . "\n", 3, DATA_DIR . '/firstrun.log');
     foreach ($pkgs as $p) {
         if (!is_dir('modules/' . $p)) {
             continue;
         }
         $t2 = microtime(true);
         error_log(' * ' . date('Y-m-d H:i:s') . ' - ' . $p . ' (', 3, DATA_DIR . '/firstrun.log');
         if (!ModuleManager::install(str_replace('/', '_', $p), null, false)) {
             print '<b>Unable to install ' . str_replace('_', '/', $p) . ' module.</b>';
         }
         error_log(microtime(true) - $t2 . "s)\n", 3, DATA_DIR . '/firstrun.log');
     }
     error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
     $t = microtime(true);
     error_log(date('Y-m-d H:i:s') . ': Refreshing cache of modules ...' . "\n", 3, DATA_DIR . '/firstrun.log');
     ModuleManager::create_load_priority_array();
     Base_SetupCommon::refresh_available_modules();
     error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
     $t = microtime(true);
     error_log(date('Y-m-d H:i:s') . ': Creating cache of template files ...' . "\n", 3, DATA_DIR . '/firstrun.log');
     Base_ThemeCommon::create_cache();
     error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
     $t = microtime(true);
     error_log(date('Y-m-d H:i:s') . ': Updating translation files ...' . "\n", 3, DATA_DIR . '/firstrun.log');
     Base_LangCommon::update_translations();
     error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
     $processed = ModuleManager::get_processed_modules();
     $_SESSION['first-run_post-install'] = $processed['install'];
     location();
 }
Ejemplo n.º 19
0
<?php

/**
 * @author Arkadiusz Bisaga <*****@*****.**>
 * @copyright Copyright &copy; 2008, Telaxus LLC
 * @license MIT
 * @version 1.0
 * @package epesi-lang
 * @subpackage timesheet
 */
if (!isset($_POST['original']) || !isset($_POST['new']) || !isset($_POST['cid'])) {
    die('alert(\'Invalid request\')');
}
define('JS_OUTPUT', 1);
define('CID', $_POST['cid']);
define('READ_ONLY_SESSION', true);
require_once '../../../../include.php';
ModuleManager::load_modules();
if (!Base_AdminCommon::get_access('Base_Lang_Administrator', 'translate')) {
    die('Unauthorized access');
}
$original = $_POST['original'];
$new = $_POST['new'];
$lang = $_SESSION['client']['base_lang_administrator']['currently_translating'];
Base_LangCommon::append_custom($lang, array($original => $new));
Base_Lang_AdministratorCommon::send_translation($lang, $original, $new);
Ejemplo n.º 20
0
 public function install()
 {
     Base_LangCommon::install_translations($this->get_type());
     Base_ThemeCommon::install_default_theme(Base_BoxInstall::module_name());
     return true;
 }
Ejemplo n.º 21
0
 public static function new_mailer()
 {
     $mailer = new PHPMailer();
     $mailer->SetLanguage(Base_LangCommon::get_lang_code(), 'modules/Base/Mail/language/');
     return $mailer;
 }
Ejemplo n.º 22
0
 public function form_payment_frame($order_id, $value, $curr_code, $modules = null)
 {
     $this->back_button();
     $this->payments_data_button();
     $payment_url = Base_EssClientCommon::get_payments_url();
     $description = $modules ? "Payment for: {$modules}" : "Order id: {$order_id}";
     $data = array('action_url' => $payment_url, 'record_id' => $order_id, 'record_type' => 'ess_orders', 'amount' => $value, 'currency' => $curr_code, 'description' => $description, 'auto_process' => '1', 'lang' => Base_LangCommon::get_lang_code(), 'hide_page_banner' => '1');
     $credentials = Base_EpesiStoreCommon::get_payment_credentials();
     foreach (array('first_name', 'last_name', 'address_1', 'address_2', 'city', 'postal_code', 'country', 'email', 'phone') as $key) {
         if (isset($credentials[$key])) {
             $data[$key] = $credentials[$key];
         }
     }
     print '<iframe name="payments" width="800px" style="border: none;" height="600px"></iframe>';
     $html = create_html_form($form_name, $payment_url, $data, 'payments');
     print $html;
     $open_js = "document.{$form_name}.submit()";
     eval_js($open_js);
 }
Ejemplo n.º 23
0
 public function display_date_picker($datepicker_defaults = array(), $form = null, $show_dates = true)
 {
     if ($form === null) {
         $form = $this->init_module(Libs_QuickForm::module_name());
     }
     $theme = $this->init_module(Base_Theme::module_name());
     $minyear = date('Y', strtotime('-5 years'));
     $maxyear = date('Y', strtotime('+5 years'));
     if ($show_dates) {
         $display_stuff_js = 'document.getElementById(\'day_elements\').style.display=\'none\';document.getElementById(\'month_elements\').style.display=\'none\';document.getElementById(\'week_elements\').style.display=\'none\';document.getElementById(\'year_elements\').style.display=\'none\';document.getElementById(this.value+\'_elements\').style.display=\'block\';';
         $form->addElement('select', 'date_range_type', __('Display report'), array('day' => __('Days'), 'week' => __('Weeks'), 'month' => __('Months'), 'year' => __('Years')), array('onChange' => $display_stuff_js, 'onKeyUp' => $display_stuff_js));
         $form->addElement('datepicker', 'from_day', __('From Date'));
         $form->addElement('datepicker', 'to_day', __('To Date'));
         $form->addElement('date', 'from_week', __('From week'), array('format' => 'Y W', 'language' => Base_LangCommon::get_lang_code(), 'minYear' => $minyear, 'maxYear' => $maxyear));
         $form->addElement('date', 'to_week', __('To week'), array('format' => 'Y W', 'language' => Base_LangCommon::get_lang_code(), 'minYear' => $minyear, 'maxYear' => $maxyear));
         $form->addElement('date', 'from_month', __('From month'), array('format' => 'Y m', 'language' => Base_LangCommon::get_lang_code(), 'minYear' => $minyear, 'maxYear' => $maxyear));
         $form->addElement('date', 'to_month', __('To month'), array('format' => 'Y m', 'language' => Base_LangCommon::get_lang_code(), 'minYear' => $minyear, 'maxYear' => $maxyear));
         $form->addElement('date', 'from_year', __('From year'), array('format' => 'Y', 'language' => Base_LangCommon::get_lang_code(), 'minYear' => $minyear, 'maxYear' => $maxyear));
         $form->addElement('date', 'to_year', __('To year'), array('format' => 'Y', 'language' => Base_LangCommon::get_lang_code(), 'minYear' => $minyear, 'maxYear' => $maxyear));
         $form->registerRule('check_dates', 'callback', 'check_dates', $this);
         $form->addRule(array('date_range_type', 'from_day', 'to_day', 'from_week', 'to_week', 'from_month', 'to_month', 'from_year', 'to_year'), __('\'From\' date must be earlier than \'To\' date'), 'check_dates');
     }
     if ($this->isset_module_variable('vals')) {
         $vals = $this->get_module_variable('vals');
         unset($vals['submited']);
         $form->setDefaults($vals);
     } else {
         foreach (array('week' => 3, 'day' => 13, 'month' => 5, 'year' => 5) as $v => $k) {
             $form->setDefaults(array('from_' . $v => date('Y-m-d H:i:s', strtotime('-' . $k . ' ' . $v))));
             $form->setDefaults(array('to_' . $v => date('Y-m-d H:i:s')));
         }
         $form->setDefaults(array('date_range_type' => 'month'));
         $form->setDefaults($datepicker_defaults);
     }
     $form->addElement('submit', 'submit', __('Show'));
     //		$failed = false;
     $other = $vals = $form->exportValues();
     $this->set_module_variable('vals', $vals);
     //		if ($vals['submited'] && !$form->validate()) {
     //			$this->date_range = 'error';
     //			$failed = true;
     //		}
     $theme->assign('show_dates', $show_dates);
     $form->assign_theme('form', $theme);
     $theme->display('date_picker');
     if ($show_dates) {
         $type = $vals['date_range_type'];
         foreach (array('week', 'day', 'year', 'month') as $v) {
             if ($v != $type) {
                 eval_js('document.getElementById(\'' . $v . '_elements\').style.display=\'none\';');
             }
         }
         //		if ($failed) {
         //			return array('type'=>'day', 'dates'=>array());
         //		}
         $this->date_range = array();
         foreach (array('date_range_type', 'from_' . $type, 'to_' . $type) as $v) {
             $this->date_range[$v] = $vals[$v];
         }
         $header = array();
         $start_p = $start = $this->get_date($type, $this->date_range['from_' . $type]);
         $end_p = $end = $this->get_date($type, $this->date_range['to_' . $type]);
         $header[] = $start;
         while (true) {
             switch ($type) {
                 case 'day':
                     $start = strtotime(date('Y-m-d 12:00:00', $start + 86400));
                     $start_format = 'Y-m-d';
                     $end_format = 'Y-m-d';
                     break;
                 case 'week':
                     $start = strtotime(date('Y-m-d 12:00:00', $start + 604800));
                     $start_format = 'Y-m-d';
                     $end_format = 'Y-m-d';
                     $fdow = Utils_PopupCalendarCommon::get_first_day_of_week();
                     $start_p -= (4 - $fdow) * 24 * 60 * 60;
                     $end_p += (2 + $fdow) * 24 * 60 * 60;
                     break;
                 case 'month':
                     $start = strtotime(date('Y-m-15 12:00:00', $start + 2592000));
                     $start_format = 'Y-m-01';
                     $end_format = 'Y-m-t';
                     break;
                 case 'year':
                     $start = strtotime(date('Y-06-15 12:00:00', $start + 2592000 * 12));
                     $start_format = 'Y-01-01';
                     $end_format = 'Y-12-31';
                     break;
             }
             if ($start > $end) {
                 break;
             }
             $header[] = $start;
         }
         return array('type' => $type, 'dates' => $header, 'start' => date($start_format, $start_p), 'end' => date($end_format, $end), 'other' => $other);
     } else {
         return array('other' => $other);
     }
 }
Ejemplo n.º 24
0
 public static function smarty_modifier_translate($string)
 {
     return Base_LangCommon::translate($string);
 }
Ejemplo n.º 25
0
    protected function perform_update_end()
    {
        $this->turn_on_maintenance_mode();

        Base_ThemeCommon::themeup();
        Base_LangCommon::update_translations();
        ModuleManager::create_load_priority_array();

        Variable::set('version', EPESI_VERSION);
        MaintenanceMode::turn_off();
    }
Ejemplo n.º 26
0
 public static function send_email_notifications($event_id)
 {
     $event = DB::GetRow('SELECT * FROM utils_watchdog_event WHERE id=%d', array($event_id));
     if (!$event) {
         return;
     }
     $category_id = $event['category_id'];
     $id = $event['internal_id'];
     $message = $event['message'];
     $subscribers = self::get_subscribers($category_id, $id);
     $c_user = Acl::get_user();
     self::email_mode(true);
     foreach ($subscribers as $user_id) {
         $wants_email = Base_User_SettingsCommon::get('Utils_Watchdog', 'email', $user_id);
         if (!$wants_email) {
             continue;
         }
         Acl::set_user($user_id);
         Base_LangCommon::load();
         $email_data = self::display_events($category_id, array($event_id => $message), $id, true);
         if (!$email_data) {
             continue;
         }
         $contact = Utils_RecordBrowserCommon::get_id('contact', 'login', $user_id);
         if (!$contact) {
             continue;
         }
         $email = Utils_RecordBrowserCommon::get_value('contact', $contact, 'email');
         if (!$email) {
             continue;
         }
         $title = __('%s notification - %s - %s', array(EPESI, $email_data['category'], strip_tags($email_data['title'])));
         Base_MailCommon::send($email, $title, $email_data['events'], null, null, true);
     }
     Acl::set_user($c_user);
     Base_LangCommon::load();
     self::email_mode(false);
 }
Ejemplo n.º 27
0
 public static function QFfield_time(&$form, $field, $label, $mode, $default, $desc, $rb_obj)
 {
     if (self::QFfield_static_display($form, $field, $label, $mode, $default, $desc, $rb_obj)) {
         return;
     }
     $time_format = Base_RegionalSettingsCommon::time_12h() ? 'h:i a' : 'H:i';
     $lang_code = Base_LangCommon::get_lang_code();
     $label = Utils_RecordBrowserCommon::get_field_tooltip($label, $desc['type']);
     $minute_increment = 5;
     if ($desc['param']) {
         $minute_increment = $desc['param'];
     }
     $form->addElement('timestamp', $field, $label, array('date' => false, 'format' => $time_format, 'optionIncrement' => array('i' => $minute_increment), 'language' => $lang_code, 'id' => $field));
     if ($mode !== 'add' && $default) {
         $form->setDefaults(array($field => $default));
     }
 }
Ejemplo n.º 28
0
}
if ($config && class_exists('Base_AclCommon')) {
    if (Base_AclCommon::i_am_user()) {
        if (!Base_AclCommon::i_am_sa()) {
            die('Only super admin can access this page');
        }
    } else {
        $auth = SimpleLogin::form();
        if ($auth) {
            print $auth;
            die;
        }
    }
}
if (class_exists('Base_LangCommon')) {
    Base_LangCommon::update_translations();
}
if (class_exists('Base_ThemeCommon')) {
    Base_ThemeCommon::create_cache();
}
if (class_exists('ModuleManager')) {
    ModuleManager::create_load_priority_array();
}
$html = '';
$checks = array();
// checking:
// DB - creating tables, selects, locking tables
// Strict Standards
// error display
// file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration
// memory check
Ejemplo n.º 29
0
<?php

define('CID', false);
require_once '../../../../include.php';
ModuleManager::load_modules();
$lang = Base_LangCommon::get_lang_code();
function filename($lang)
{
    return 'modules/Base/EssClient/tos/' . $lang . '_privacy.html';
}
if (!file_exists(filename($lang))) {
    $lang = 'en';
}
$message = file_get_contents(filename($lang));
Utils_FrontPageCommon::display(__('Privacy Policy'), $message);
Ejemplo n.º 30
0
 public function install()
 {
     Base_LangCommon::install_translations($this->get_type());
     Base_ThemeCommon::install_default_theme('Base/Box');
     return true;
 }