Example #1
0
 public function sendMessage($toUserID, $strSubject, $strMessage)
 {
     if (!$this->isAvailable()) {
         return false;
     }
     $intUserID = $toUserID;
     $arrNotificationSettings = $this->pdh->get('user', 'notification_settings', array($intUserID));
     $jabberAccount = $arrNotificationSettings['ntfy_xmpp_user'];
     if ($jabberAccount == "") {
         return false;
     }
     $this->objJabber = new jabber($this->config->get('xmpp_server'), $this->config->get('xmpp_port'), $this->config->get('xmpp_user'), $this->config->get('xmpp_password'), $this->config->get('xmpp_use_ssl'));
     if (!$this->objJabber->connect()) {
         if (defined('DEBUG') && DEBUG > 1) {
             pd("Jabber Connection Error:<br/>" . $this->objJabber->get_log());
         }
         return false;
     }
     if (!$this->objJabber->login()) {
         if (defined('DEBUG') && DEBUG > 1) {
             pd("Jabber Login Error:<br/>" . $this->objJabber->get_log());
         }
         return false;
     }
     $this->objJabber->send_message($jabberAccount, $strMessage, $strSubject);
     $this->objJabber->disconnect();
     return true;
 }
Example #2
0
 public function ver()
 {
     if (isset($_COOKIE['lista_isbns'])) {
         $data = unserialize($_COOKIE['lista_isbns']);
         echo "cookie definido como " . pd($data);
     } else {
         echo "cookie NAO definido ";
     }
 }
 function pd($fs)
 {
     echo '<ul>';
     foreach ($fs as $f) {
         if (is_dir($f) || 0 < preg_match('/^inc\\.cls\\.mod_([0-9a-z_]+)\\.php$/', basename($f), $parrMatches)) {
             $c = explode('/', substr($f, strlen(PROJECT_CONTROLLERS) + 1));
             if (!is_dir($f)) {
                 $c[count($c) - 1] = $parrMatches[1];
             }
             echo '<li><a title="' . $f . '" href="' . str_replace('-N', '-' . rand(1, 3545), implode('-', $c)) . '">' . basename($f) . '</a>';
             if (is_dir($f)) {
                 echo '<ul>';
                 pd(glob($f . '/*'));
                 echo '</ul>';
             }
             echo '</li>';
         }
     }
     echo '</ul>';
 }
Example #4
0
 /**
  * Loads a specific core Language
  * 
  * @param string $lang_name
  * @return boolean
  */
 public function init_lang($lang_name = '')
 {
     if ($lang_name == "") {
         $lang_name = $this->config->get('default_lang');
     }
     if (!$lang_name) {
         return false;
     }
     $this->strLangCode = $lang_name;
     if (isset($this->arrLang[$lang_name])) {
         return true;
     }
     $file_path = $this->root_path . 'language/' . $lang_name . '/';
     $tmp_lang = array();
     //If there is no main language file, abbort
     if (!file_exists($file_path . 'lang_main.php')) {
         $this->arrLang[$lang_name] = "error";
         pd("Error loading language " . $lang_name);
         return false;
     }
     include $file_path . 'lang_main.php';
     if (is_array($lang)) {
         $tmp_lang = array_merge($tmp_lang, $lang);
         unset($lang);
     }
     if (defined('IN_ADMIN')) {
         include $file_path . 'lang_admin.php';
         if (is_array($lang)) {
             $tmp_lang = array_merge($tmp_lang, $lang);
             unset($lang);
         }
     }
     if (defined('MAINTENANCE_MODE')) {
         include $file_path . 'lang_mmode.php';
         if (is_array($lang)) {
             $tmp_lang = array_merge($tmp_lang, $lang);
             unset($lang);
         }
     }
     $this->arrLang[$lang_name] =& $tmp_lang;
 }
Example #5
0
 /**
  * 自定义异常处理
  *
  * @access public
  * @param mixed $e 异常对象
  */
 public static function appException($e)
 {
     Plugin::hook('alpha.before_throw_exception', $e);
     $error = array();
     $error['message'] = $e->getMessage();
     $trace = $e->getTrace();
     foreach ($trace as $key => $val) {
         $error['files'][$key] = $val;
     }
     if (!$GLOBALS['debug']) {
         //正式环境 只显示‘系统错误’并将错误信息记录到日志
         Log::emergency($error['message'], array($error['files'][0]));
         $error = array();
         $error['message'] = Lang::get('_ERROR_');
     }
     if (Request::isCli()) {
         pd($error);
     } else {
         header('HTTP/1.1 500 Internal Server Error');
         require Config::get('html_exception');
     }
 }
Example #6
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
pd($data);
?>

		
		<div class="wrapper" role="main">
			<div class="container">
				<div class="row">
					
                                    
					<!-- Sidebar -->
					<div id="sidebar" class="col-md-3">
						
						<div class="busca">
							<h3>Busca</h3>
							<form method="GET" action=" <?php 
echo $this->config->base_url("SearchBrowse");
?>
" >
								<div class="form-group">
									<label class="sr-only" for="exampleInputEmail2">Busca</label>
									<input type="text" class="form-control" name="palavra_buscada" id="palavra_buscada" placeholder="Buscar por palavra">
									<input type="hidden" name="tipo" value="palavra"/>
								</div>
								<button type="submit" class="btn btn-success">Buscar</button>
Example #7
0
 public function copy()
 {
     $bz_ids = $this->in->getArray('bz_ids', '');
     $zones = array();
     pd($bz_ids);
     foreach ($bz_ids as $bz_id) {
         if (strpos($bz_id, 'z') !== 0) {
             continue;
         }
         $zones[] = substr($bz_id, 1);
     }
     pd($zones);
     foreach ($zones as $id) {
         $data = array(implode($this->config->get('bz_parse', 'raidlogimport'), $this->pdh->get('rli_zone', 'string', array($id))), $this->pdh->get('rli_zone', 'event', array($id)), $this->pdh->get('rli_zone', 'timebonus', array($id)), $this->in->get('diff', 0), $this->pdh->get('rli_zone', 'sort', array($id)));
         $new_id = $this->pdh->put('rli_zone', 'add', $data);
         if ($new_id) {
             $bosses = $this->pdh->get('rli_boss', 'bosses2zone', array($id));
             foreach ($bosses as $bid) {
                 $boss_diff = $this->pdh->get('rli_boss', 'diff', array($bid));
                 $data = array(implode($this->config->get('bz_parse', 'raidlogimport'), $this->pdh->get('rli_boss', 'string', array($bid))), $this->pdh->get('rli_boss', 'note', array($bid)), $this->pdh->get('rli_boss', 'bonus', array($bid)), $this->pdh->get('rli_boss', 'timebonus', array($bid)), $boss_diff ? $this->in->get('diff', 0) : 0, $new_id, $this->pdh->get('rli_boss', 'sort', array($bid)));
                 $this->pdh->put('rli_boss', 'add', $data);
             }
             $message['bz_copy_suc'][] = $this->pdh->geth('rli_zone', 'event', array($id, false));
         } else {
             $message['bz_no_copy'][] = $this->pdh->geth('rli_zone', 'event', array($id, false));
         }
     }
     $this->display($message);
 }
Example #8
0
                $action = 'STRONG BUY';
            } else {
                if ($abs > $buy) {
                    $action = 'BUY';
                } else {
                    $action = 'HOLD';
                }
            }
        }
        $stats['action'] = $action;
        foreach ($stats as $stat => $value) {
            echo substr(str_pad($value, COLUMN_WIDTH, ' ', STR_PAD_RIGHT), 0, COLUMN_WIDTH) . ' | ';
        }
        echo "\n";
    } catch (Exception $e) {
        pd($e);
    }
}
echo str_repeat('-', strlen($line)) . "\n";
function fetch($array, $key, $default = '')
{
    if (array_key_exists($key, $array)) {
        return $array[$key];
    }
    return $default;
}
function pp($array)
{
    print_r($array);
    echo "\n";
}
Example #9
0
 /**
  * Monta la consulta i la executa
  * @param  int $id   Si es vol filtrar per id
  * @return array     Consulta executada
  */
 public function obtenir($id = null, $que = array())
 {
     if (!is_null($id)) {
         if (!is_array($id)) {
             $this->on('id', '=', $id);
         } else {
             $que = $id;
         }
     }
     if (count($que) > 0) {
         $this->selects = $que;
     }
     // SELECT
     $this->consulta = 'SELECT ';
     $this->consulta .= is_null($this->selects) ? '* ' . "\n" : "\n\t" . implode(",\n\t", $this->selects) . "\n";
     // FROM
     $this->consulta .= 'FROM ' . $this->taula . "\n";
     // INNER JOIN
     foreach ($this->joins as $join) {
         $this->consulta .= "\tINNER JOIN {$join['taula']} ON {$join['clau']} = {$join['valor']}\n";
     }
     // WHERE
     $whereUsat = false;
     foreach ($this->wheres as $valor) {
         $this->consulta .= $whereUsat ? "\t" . 'AND ' : 'WHERE ';
         $this->consulta .= "{$valor['clau']} {$valor['operacio']} {$valor['valor']} \n";
         $whereUsat = true;
     }
     // GROUP BY
     if (count($this->groupBy) > 0) {
         $this->consulta .= 'GROUP BY ' . implode(', ', $this->groupBy) . "\n";
     }
     // ORDER BY
     if (count($this->orderBy['que']) > 0) {
         $this->consulta .= 'ORDER BY ' . implode(', ', $this->orderBy['que']) . " {$this->orderBy['metode']} \n";
     }
     // LIMIT
     if (!is_null($this->limit)) {
         $this->consulta .= "LIMIT {$this->limit}";
     }
     pd($this->consulta);
     return BD::cru($this->consulta);
 }
Example #10
0
 public function display($messages = false)
 {
     if ($messages) {
         $this->core->messages($messages);
     }
     $job_list = $this->apa->list_apas();
     $used_funcs = array();
     if (is_array($job_list)) {
         foreach ($job_list as $key => $details) {
             pd($details['exectime']);
             $this->tpl->assign_block_vars('apa_row', array('ID' => $key, 'TYPE' => $this->user->lang('apa_type_' . $details['type']), 'NAME' => $details['name'], 'EXECTIME' => $this->time->date('H:i', $details['exectime']), 'POOLS' => implode(', ', $this->pdh->aget('multidkp', 'name', 0, array($details['pools'])))));
             if (isset($details['calc_func'])) {
                 $used_funcs[$details['calc_func']][] = $details['name'];
             }
         }
     }
     $funcs = $this->apa->get_calc_function();
     if (is_array($funcs)) {
         foreach ($funcs as $name) {
             $this->tpl->assign_block_vars('func_row', array('NAME' => $name, 'USED' => isset($used_funcs[$name]) ? implode(', ', $used_funcs[$name]) : '', 'EXPL' => $this->apa->run_calc_func($name, array(50, $this->time->time, $this->time->time - 24 * 7 * 2 * 3600, 100)), 'NODEL' => isset($used_funcs[$name]) ? true : false));
         }
     }
     //Types
     $types = $this->apa->scan_types();
     $type_dd = array();
     foreach ($types as $type) {
         $type_dd[$type] = $this->user->lang('apa_type_' . $type);
     }
     $this->jquery->dialog('apa_edit', sprintf($this->user->lang('apa_edit'), ''), array('url' => "manage_auto_points.php" . $this->SID . "&simple_head=true&edit=true&id='+content+'", 'width' => '700', 'height' => '550', 'withid' => 'content', 'onclose' => $this->env->link . "admin/manage_auto_points.php" . $this->SID));
     $this->jquery->dialog('apa_new', sprintf($this->user->lang('apa_new'), ''), array('url' => "manage_auto_points.php" . $this->SID . "&simple_head=true&edit=true&type='+content+'", 'width' => '700', 'height' => '550', 'withid' => 'content', 'onclose' => $this->env->link . "admin/manage_auto_points.php" . $this->SID));
     $this->jquery->dialog('func_edit', $this->user->lang('apa_edit_function'), array('url' => "manage_auto_points.php" . $this->SID . "&simple_head=true&edit_func=true&func='+content+'", 'width' => '700', 'height' => '550', 'withid' => 'content', 'onclose' => $this->env->link . "admin/manage_auto_points.php" . $this->SID));
     $this->jquery->dialog('func_new', $this->user->lang('apa_add_func'), array('url' => "manage_auto_points.php" . $this->SID . "&simple_head=true&edit_func=true", 'width' => '700', 'height' => '550', 'onclose' => $this->env->link . "admin/manage_auto_points.php" . $this->SID));
     $this->confirm_delete($this->user->lang('apa_confirm_delete'), "manage_auto_points.php" . $this->SID . "&id='+content+'", false, array('withid' => 'content', 'force_ajax' => true));
     $this->confirm_delete($this->user->lang('apa_confirm_delete_func'), "manage_auto_points.php" . $this->SID . "&func='+content+'", false, array('withid' => 'content', 'force_ajax' => true, 'function' => 'delete_func', 'handler' => 'del_func'));
     $this->tpl->add_js("\n\t\t\t\$('#add_apa').click(function(){\n\t\t\t\tapa_new(\$('#apa_type').val());\n\t\t\t});\n\t\t\t\$('.apa_edit').click(function(){\n\t\t\t\tapa_edit(\$(this).attr('alt'));\n\t\t\t});\n\t\t\t\$('.apa_del').click(function(){\n\t\t\t\tdelete_warning(\$(this).attr('alt'));\n\t\t\t});\n\t\t\t\$('#add_func').click(function(){\n\t\t\t\tfunc_new(\$('#apa_type').val());\n\t\t\t});\n\t\t\t\$('.func_edit').click(function(){\n\t\t\t\tfunc_edit(\$(this).attr('alt'));\n\t\t\t});\n\t\t\t\$('.func_del').click(function(){\n\t\t\t\tdelete_func(\$(this).attr('alt'));\n\t\t\t});", 'docready');
     $this->tpl->assign_vars(array('L_APA_ADD' => sprintf($this->user->lang('apa_add'), ''), 'TYPE_DD' => new hdropdown('apa_type', array('options' => $type_dd))));
     $this->core->set_vars(array('page_title' => $this->user->lang('apa_manager'), 'template_file' => 'admin/manage_auto_points.html', 'header_format' => $this->simple_head, 'display' => true));
 }
 /**
  * Checks if $string is given in format $format
  * @string 	$string		a formatted timestring
  * @string 	$format		a correct format for date()
  * @return	boolean
  */
 private function check_format($string, $format)
 {
     $flen = strlen($format);
     $slen = strlen($string);
     $cb = '';
     $ca = '';
     $escape = false;
     $stroff = 0;
     for ($i = 0; $i < $flen; $i++) {
         if ($stroff && $stroff >= $slen) {
             $this->pdl->log('time_error', 'Unexpected end in ' . $string . ' compared to format ' . $format . '.');
             return false;
         }
         $c = substr($format, $i, 1);
         $ca = substr($format, $i + 1, 1);
         if ($c == '/' && $cb != '/' && in_array($ca, $this->backslash_sequence)) {
             $escape = true;
             $cb = $c;
             continue;
         }
         if (in_array($c, array_keys($this->possible_formats)) && !$escape) {
             if (is_string($this->possible_formats[$c])) {
                 if (strpos($this->possible_formats[$c], '#') === 0) {
                     $new_format = substr($format, 0, $i) . substr($this->possible_formats[$c], 1) . substr($format, $i + 1);
                     return $this->check_format($string, $new_format);
                 }
                 //handle strings with no given length
                 $partial_string = substr($string, $stroff);
                 $match = array();
                 preg_match('#^([a-zA-Z]+)#', $partial_string, $match);
                 if (isset($match[1])) {
                     $stroff += strlen($match[1]) - 1;
                 } else {
                     $this->pdl->log('time_error', 'Format mismatch at position (' . ($stroff + 1) . '.) in ' . $string . ' compared to format ' . $format . '.');
                     return false;
                 }
             } elseif (is_array($this->possible_formats[$c])) {
                 //Search for next char in the string which is no number
                 $partial_string = substr($string, $stroff, $this->possible_formats[$c][1]);
                 //maximum length string
                 $k = 0;
                 for ($j = $this->possible_formats[$c][0]; $j <= $this->possible_formats[$c][1]; $j++) {
                     $psc = substr($partial_string, $j, 1);
                     if (!is_numeric($psc)) {
                         $k = $j;
                         break;
                     }
                 }
                 if ($k) {
                     $stroff += $k - 1;
                 } else {
                     $this->pdl->log('time_error', 'Format mismatch at position (' . ($stroff + $this->possible_formats[$c][1]) . ') in ' . $string . ' compared to format ' . $format . '.');
                     return false;
                 }
             } elseif ($this->possible_formats[$c] > 0) {
                 $stroff += $this->possible_formats[$c] - 1;
             }
         } elseif ($c != substr($string, $stroff, 1)) {
             pd($c);
             pd(substr($string, $stroff, 1));
             $this->pdl->log('time_error', 'Format mismatch at position (' . ($stroff + 1) . ') in ' . $string . ' compared to format ' . $format . '.');
             return false;
         }
         $escape = false;
         $cb = $c;
         $stroff++;
     }
     return true;
 }
Example #12
0
 /**
  * Generate the Mail Body & rest
  *
  * @param $subject				Subject of the Mail
  * @param $templatename	Name of the Email template to use
  * @param $bodyvars			Array with input variables to change in mail body
  * @return traue/false
  */
 private function GenerateMail($subject, $templatename, $bodyvars, $from)
 {
     $this->From = $this->adminmail;
     $this->FromName = $from;
     $this->ClearReplyTos();
     $this->addReplyTo($from, $from);
     $this->CharSet = 'UTF-8';
     $this->Subject = $this->generateSubject($subject);
     $this->Signature = $this->config->get('lib_email_signature') ? "\n" . $this->config->get('lib_email_signature_value') : '';
     $tmp_body = $this->Template($templatename, $bodyvars);
     if ($this->myoptions['mail_type'] == 'text') {
         // Text Mail
         $this->Body = $tmp_body . $this->Signature;
     } else {
         // HTML Mail
         $this->MsgHTML($tmp_body);
         $this->AltBody = $this->nohtmlmssg;
     }
     if (DEBUG == 4) {
         pd($this->Body);
     }
 }
 public function display()
 {
     if ($this->in->get('hookid', 0) > 0 && $this->in->get('hookapp', '') != '') {
         $arrHookData = $this->hooks->process('calendarevent_prefill', array('hookapp' => $this->in->get('hookapp'), 'hookid' => $this->in->get('hookid', 0)), true);
         $eventdata = $arrHookData['eventdata'];
         $this->values_available = true;
     } else {
         $eventdata = $this->pdh->get('calendar_events', 'data', array($this->url_id));
         $this->values_available = $this->url_id > 0 ? true : false;
     }
     if ($this->in->get('debug', 0) == 1) {
         pd($eventdata);
     }
     // the repeat array
     $drpdwn_repeat = array('0' => '--', '1' => $this->user->lang('calendar_repeat_daily'), '7' => $this->user->lang('calendar_repeat_weekly'), '14' => $this->user->lang('calendar_repeat_2weeks'), 'custom' => $this->user->lang('calendar_repeat_custom'));
     // raid/ role distri
     $raidmode_array = array('class' => $this->user->lang('calendar_class_distri'), 'role' => $this->user->lang('calendar_role_distri'), 'none' => $this->user->lang('calendar_no_distri'));
     // Calendar Mode
     $calendar_mode_array = array('event' => $this->user->lang('calendar_mode_event'), 'raid' => $this->user->lang('calendar_mode_raid'));
     // Repeat array
     $radio_repeat_array = array('0' => $this->user->lang('calendar_event_editone'), '1' => $this->user->lang('calendar_event_editall'), '2' => $this->user->lang('calendar_event_editall_future'));
     // raid status array
     $raidcal_status = $this->config->get('calendar_raid_status');
     $raidstatus = array();
     if (is_array($raidcal_status)) {
         foreach ($raidcal_status as $raidcalstat_id) {
             if ($raidcalstat_id != 4) {
                 $raidstatus[$raidcalstat_id] = $this->user->lang(array('raidevent_raid_status', $raidcalstat_id));
             }
         }
     }
     // The roles Fields
     foreach ($this->pdh->get('roles', 'roles', array()) as $row) {
         $this->tpl->assign_block_vars('raid_roles', array('LABEL' => $row['name'], 'NAME' => "roles_" . $row['id'] . "_count", 'CLSSID' => $row['id'], 'COUNT' => isset($eventdata['extension']) && $eventdata['extension']['distribution'][$row['id']] ? $eventdata['extension']['distribution'][$row['id']] : '0', 'ICON' => $this->game->decorate('roles', $row['id']), 'DISABLED' => isset($eventdata['extension']) && $eventdata['extension']['raidmode'] == 'class' ? 'disabled="disabled"' : ''));
     }
     // The class fields
     $classdata = $this->game->get_primary_classes(array('id_0'));
     foreach ($classdata as $classid => $classname) {
         $this->tpl->assign_block_vars('raid_classes', array('LABEL' => $classname, 'NAME' => "classes_" . $classid . "_count", 'CLSSID' => $classid, 'COUNT' => isset($eventdata['extension']['distribution'][$classid]) && $eventdata['extension']['distribution'][$classid] ? $eventdata['extension']['distribution'][$classid] : '0', 'ICON' => $this->game->decorate('primary', $classid), 'DISABLED' => isset($eventdata['extension']) && $eventdata['extension']['raidmode'] == 'role' ? 'disabled="disabled"' : ''));
     }
     // Raidleaders
     $raidleader_array = $this->pdh->aget('member', 'name', 0, array($this->pdh->get('member', 'id_list')));
     asort($raidleader_array);
     // Load the default dates
     $default_deadlineoffset = $this->config->get('calendar_addraid_deadline') ? $this->config->get('calendar_addraid_deadline') : 1;
     if ($this->values_available > 0) {
         $defdates = array('start' => $eventdata['timestamp_start'], 'end' => $eventdata['timestamp_end'], 'deadline' => isset($eventdata['extension']['deadlinedate']) && $eventdata['extension']['deadlinedate'] > 0 ? $eventdata['extension']['deadlinedate'] : $default_deadlineoffset);
     } else {
         $default_raidduration = ($this->config->get('calendar_addraid_duration') ? $this->config->get('calendar_addraid_duration') : 120) * 60;
         // if the default time should be used, set it...
         if ($this->config->get('calendar_addraid_use_def_start') && preg_match('#[:]#', $this->config->get('calendar_addraid_def_starttime'))) {
             $starttimestamp = $this->in->get('timestamp', 0) > 0 ? $this->time->newtime($this->in->get('timestamp', 0), $this->config->get('calendar_addraid_def_starttime')) : $this->time->fromformat($this->config->get('calendar_addraid_def_starttime'), $this->user->style['time']);
         } else {
             $starttimestamp = $this->in->get('timestamp', 0) > 0 ? $this->time->newtime($this->in->get('timestamp', 0)) : $this->time->time;
         }
         $defdates = array('start' => $starttimestamp, 'end' => $starttimestamp + $default_raidduration, 'deadline' => $default_deadlineoffset);
     }
     $beforeclosefunc = "\n\t\t\t\$.post('" . $this->routing->build('editcalendarevent') . "&ajax_dropdown=true', { raidevent_id: \$('body').data('raidevent_id') }, function(data) {\n\t\t\t\t\$('#raidevent_dropdown').html(data);\n\t\t\t});";
     // Set the code for the second timepicker difference
     $startdate_onselect = "var startDate = \$(this).datetimepicker('getDate');\n\t\t\t\tvar endDate = new Date(startDate.getTime() + (" . ($this->config->get('calendar_addraid_duration') > 0 ? $this->config->get('calendar_addraid_duration') : 120) . "*60000))\n\t\t\t\tvar newDate\t= new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate(), endDate.getHours(), endDate.getMinutes());\n\t\t\t\t\$('#cal_enddate').datetimepicker('setDate', newDate);";
     $this->jquery->Dialog('AddEventDialog', $this->user->lang('raidevent_raidevent_add'), array('url' => $this->server_path . 'admin/manage_events.php' . $this->SID . '&upd=true&simple_head=true&calendar=true', 'width' => '600', 'height' => '420', 'beforeclose' => $beforeclosefunc));
     if (isset($eventdata['extension']) && $eventdata['extension']['calendarmode']) {
         $calendermode = $eventdata['extension']['calendarmode'];
     } elseif ($this->url_id > 0) {
         $calendermode = 'event';
     } else {
         $calendermode = $this->config->get('calendar_addevent_mode') ? $this->config->get('calendar_addevent_mode') : 'event';
     }
     // build json for calendar dropdown
     $calendar_data = $this->pdh->get('calendars', 'data', array());
     $calendars = array();
     if (is_array($calendar_data)) {
         foreach ($calendar_data as $calendar_id => $calendar_value) {
             if ($calendar_value['restricted'] == '1' && !$this->user->check_auth('a_cal_addrestricted', false)) {
                 continue;
             }
             if ($calendar_value['type'] != '3') {
                 $calendars[$calendar_id] = array('id' => $calendar_id, 'name' => $calendar_value['name'], 'type' => $calendar_value['type']);
             }
         }
     }
     // the hack for the custom repeating period
     $dr_repeat_custom = 1;
     if (isset($eventdata['repeating']) && $eventdata['repeating'] > 0 && !in_array((int) $eventdata['repeating'], array(1, 7, 14))) {
         $eventdata['repeating'] = 'custom';
         $dr_repeat_custom = $eventdata['repeating'];
     } elseif ($this->url_id > 0 && isset($eventdata['repeating']) && $eventdata['repeating'] == 0) {
         $dr_repeat_custom = 0;
     }
     $this->tpl->assign_vars(array('IS_EDIT' => $this->url_id > 0 ? true : false, 'IS_CLONED' => isset($eventdata['repeating']) && $eventdata['repeating'] > 0 ? true : false, 'DKP_ENABLED' => $this->config->get('disable_points') == 0 ? true : false, 'DR_CALENDAR_JSON' => json_encode($calendars), 'DR_CALENDAR_CID' => isset($eventdata['calendar_id']) ? $eventdata['calendar_id'] : 0, 'DR_REPEAT' => new hdropdown('repeat_dd', array('options' => $drpdwn_repeat, 'value' => isset($eventdata['repeating']) && $eventdata['repeating'] > 0 ? $eventdata['repeating'] : '0')), 'REPEAT_CUSTOM' => $dr_repeat_custom, 'DR_TEMPLATE' => new hdropdown('raidtemplate', array('options' => $this->pdh->get('calendar_raids_templates', 'dropdowndata'), 'id' => 'cal_raidtemplate')), 'DR_CALENDARMODE' => new hdropdown('calendarmode', array('options' => $calendar_mode_array, 'value' => $calendermode, 'id' => 'selectmode', 'class' => 'dropdown')), 'DR_EVENT' => new hdropdown('raid_eventid', array('options' => $this->pdh->aget('event', 'name', 0, array($this->pdh->sort($this->pdh->get('event', 'id_list'), 'event', 'name'))), 'value' => isset($eventdata['extension']) ? $eventdata['extension']['raid_eventid'] : '', 'id' => 'input_eventid', 'class' => 'resettemplate_input')), 'DR_RAIDMODE' => new hdropdown('raidmode', array('options' => $raidmode_array, 'value' => isset($eventdata['extension']) ? $eventdata['extension']['raidmode'] : '', 'id' => 'cal_raidmodeselect')), 'DR_RAIDLEADER' => $this->jquery->MultiSelect('raidleader', $raidleader_array, isset($eventdata['extension']) ? $eventdata['extension']['raidleader'] : $this->pdh->get('member', 'mainchar', array($this->user->data['user_id'])), array('width' => 300, 'filter' => true)), 'DR_GROUPS' => new hmultiselect('asi_group', array('options' => $this->pdh->aget('user_groups', 'name', 0, array($this->pdh->get('user_groups', 'id_list'))), 'value' => $this->config->get('calendar_raid_autocaddchars'))), 'DR_SHARE_USERS' => new hmultiselect('invited', array('options' => $this->pdh->aget('user', 'name', 0, array($this->pdh->get('user', 'id_list'))), 'filter' => true, 'value' => isset($eventdata['extension']) && $eventdata['extension']['invited'] ? $eventdata['extension']['invited'] : array())), 'DR_STATUS' => new hdropdown('asi_status', array('options' => $raidstatus, 'value' => 0)), 'CB_ALLDAY' => new hcheckbox('allday', array('options' => array(1 => ''), 'value' => isset($eventdata['allday']) ? $eventdata['allday'] : 0, 'class' => 'allday_cb')), 'CB_PRIVATE' => new hcheckbox('private', array('options' => array(1 => ''), 'value' => isset($eventdata['private']) ? $eventdata['private'] : 0)), 'RADIO_EDITCLONES' => new hradio('edit_clones', array('options' => $radio_repeat_array)), 'BBCODE_NOTE' => new hbbcodeeditor('note', array('rows' => 3, 'value' => isset($eventdata['notes']) ? $eventdata['notes'] : '', 'id' => 'input_note')), 'LP_LOCATION' => new hplacepicker('location', array('value' => isset($eventdata['extension']) && isset($eventdata['extension']['location']) ? $eventdata['extension']['location'] : '')), 'JQ_DATE_START' => $this->jquery->Calendar('startdate', $this->time->user_date($defdates['start'], true, false, false), '', array('timepicker' => true, 'onselect' => $startdate_onselect)), 'JQ_DATE_END' => $this->jquery->Calendar('enddate', $this->time->user_date($defdates['end'], true, false, false), '', array('timepicker' => true)), 'DATE_DEADLINE' => $defdates['deadline'] > 0 ? $defdates['deadline'] : 2, 'EVENT_ID' => $this->url_id, 'LOCATION' => isset($eventdata['extension']) && isset($eventdata['extension']['location']) ? $eventdata['extension']['location'] : '', 'NOTE' => isset($eventdata['notes']) ? $eventdata['notes'] : '', 'EVENTNAME' => isset($eventdata['name']) ? $eventdata['name'] : '', 'RAID_VALUE' => isset($eventdata['extension']) ? $eventdata['extension']['raid_value'] : '', 'ATTENDEE_COUNT' => isset($eventdata['extension']) ? $eventdata['extension']['attendee_count'] : 0, 'RAIDMODE_NONE' => isset($eventdata['extension']['raidmode']) && $eventdata['extension']['raidmode'] == 'none' ? true : false, 'CSRF_DELETETEMPLATE' => $this->CSRFGetToken('deletetemplate')));
     $this->core->set_vars(array('page_title' => $this->user->lang('calendars_add_title'), 'template_file' => 'calendar/addevent.html', 'header_format' => $this->simple_head, 'display' => true));
 }