Example #1
0
    function passiveField($name = false, $caption = false, $subtable = false, $subtable_fields = false, $link_url = false, $concat_char = false, $f_id_field = false, $order_by = false, $order_asc = false, $link_is_tab = false, $limit_is_curdate = false, $create_db_field = false, $default_value = false, $dont_fill_automatically = false)
    {
        global $CFG;
        $HTML = '';
        if ($this->table && $create_db_field) {
            $type = $create_db_field == 'datetime' ? 'date' : $create_db_field;
            $this->db_fields[$name] = $type;
            $value = empty($this->info[$name]) && $default_value !== false ? $default_value : $this->info[$name];
            $value1 = $value;
            if ($create_db_field == 'date' || $create_db_field == 'datetime') {
                $time = $create_db_field == 'datetime' ? ' ' . $CFG->default_time_format : '';
                if (!$dont_fill_automatically) {
                    $value = !empty($value) ? $value : date($CFG->default_date_format . $time);
                    $value1 = date('Y-m-d H:i:s', strtotime($value));
                }
            }
            $HTML .= "<input type=\"hidden\" name=\"{$this->name}[{$name}]\" value=\"{$value1}\" id=\"{$this->name}_{$name}\"/>";
        }
        $CFG->o_method_id = $CFG->method_id;
        $CFG->o_method_name = 'passiveField';
        $record = new Record($this->table, $this->record_id);
        $HTML .= '<div id="passive_' . $this->name . '_' . $name . '">' . $record->field($name, $caption, $subtable, $subtable_fields, $link_url, $concat_char, true, $f_id_field, $order_by, $order_asc, $this->record_id, $link_is_tab, $limit_is_curdate, $value) . '</div>';
        if ($f_id_field) {
            if (stristr($f_id_field, ',')) {
                $f_parts = explode(',', $f_id_field);
                $f_id_field1 = $f_parts[0];
            } else {
                $f_id_field1 = $f_id_field;
            }
            if (strstr($f_id_field1, '.')) {
                $f_parts1 = explode('.', $f_id_field1);
                $get_field = $f_parts1[1];
            } else {
                $get_field = $f_id_field1;
            }
            if ($get_field && !$CFG->pm_editor) {
                $HTML .= '
				<script type="text/javascript">
					getPassiveValue(\'ajax.passive.php?table=' . $this->table . '&name=' . $name . '&caption=' . $caption . '&subtable=' . $subtable . '&subtable_fields=' . urlencode(serialize($subtable_fields)) . '&link_url=' . $link_url . '&concat_char=' . $concat_char . '&f_id_field=' . $f_id_field . '&order_by=' . $order_by . '&order_asc=' . $order_asc . '&link_is_tab=' . $link_is_tab . '&limit_is_curdate=' . $limit_is_curdate . '&record_id=' . $this->record_id . '\',\'passive_' . $this->name . '_' . $name . '\',\'' . $this->name . '_' . $get_field . '\');
				</script>
				';
            }
        }
        $this->HTML[] = $HTML;
    }
Example #2
0
    private function show($comments)
    {
        global $CFG;
        if ($comments) {
            echo '<ul>';
            foreach ($comments as $comment) {
                $elapsed = time() + Settings::mysqlTimeDiff() * 3600 - strtotime($comment['date']);
                if ($elapsed < 60) {
                    $time_ago = $CFG->comments_less_than_minute;
                } elseif ($elapsed > 60 && $elapsed < 60 * 60) {
                    $minutes = floor($elapsed / 60);
                    $time_ago = str_ireplace('[field]', $minutes, $CFG->comments_minutes_ago);
                } elseif ($elapsed > 60 * 60 && $elapsed < 60 * 60 * 24) {
                    $hours = floor($elapsed / 60 / 60);
                    $time_ago = str_ireplace('[field]', $hours, $CFG->comments_hours_ago);
                } elseif ($elapsed > 60 * 60 * 24 && $elapsed < 60 * 60 * 24 * 30.4) {
                    $days = floor($elapsed / 60 / 60 / 24);
                    $time_ago = str_ireplace('[field]', $days, $CFG->comments_days_ago);
                } else {
                    $months = floor($elapsed / 60 / 60 / 24 / 30.4);
                    $time_ago = str_ireplace('[field]', $months, $CFG->comments_months_ago);
                }
                if ($comment['user_id'] > 0) {
                    $user = DB::getRecord($this->user_table, $comment['user_id'], false, true);
                    $name = !empty($comment['website']) ? Link::url($comment['website'], $user['user']) : $user['user'];
                } else {
                    $name = !empty($comment['website']) ? Link::url($comment['website'], $comment['name']) : $comment['name'];
                }
                $short = $this->short_version ? '_short' : '';
                $icon = $comment['type'] ? eval('return $CFG->comment_type_' . $comment['type'] . ';') : $CFG->comment_type_1;
                $action = $comment['type'] ? eval('return $CFG->comments_action_' . $comment['type'] . $short . ';') : $CFG->comments_wrote_label;
                $action = String::doFormulaReplacements($action, unserialize($comment['f_table_row']), 1, 1);
                echo '
				<li id="comment_' . $comment['id'] . '" class="level_' . $comment['type'] . '">
					<div class="c_head">';
                if ($this->fields) {
                    foreach ($this->fields as $f_name => $field) {
                        $CFG->o_method_id = $field['method_id'];
                        $CFG->o_method_name = 'field';
                        $record = new Record($field['table'], $comment['record_id']);
                        echo '<div class="added_field">' . $record->field($field['name'], $field['caption'], $field['subtable'], $field['subtable_fields'], $field['link_url'], $field['concat_char'], true, $field['f_id_field'], $field['order_by'], $field['order_asc'], $comment['record_id'], $field['link_is_tab'], $field['limit_is_curdate'], false, $field['link_id_field']) . '</div>';
                    }
                }
                echo '
						' . $icon . ' ' . $name . ' (' . $time_ago . ') ' . $action . '
					</div>';
                if (!$this->short_version) {
                    echo '
						<div class="c_comment">
							' . (strlen($comment['comments']) != strlen(strip_tags($comment['comments'])) ? $comment['comments'] : nl2br($comment['comments'])) . '
						</div>';
                }
                echo '
					' . ($comment['type'] <= 1 && !$this->short_version ? '<div class="c_reply"><a href="#" onclick="showReplyBox(' . $comment['id'] . ',' . $this->i . ');return false;">' . $CFG->comments_reply_label . '</a></div>' : '') . '
					<div class="c_form"></div>
				</li>';
                if (is_array($comment['children'])) {
                    Comments::show($comment['children']);
                }
            }
            echo '<div style="clear:both;height:0;"></div></ul>';
        }
    }
Example #3
0
    function passiveField($name = false, $caption = false, $subtable = false, $subtable_fields = false, $link_url = false, $concat_char = false, $f_id_field = false, $order_by = false, $order_asc = false, $link_is_tab = false, $limit_is_curdate = false, $create_db_field = false, $default_value = false, $dont_fill_automatically = false)
    {
        global $CFG;
        $HTML = '';
        $record = new Record($this->table, $this->record_id);
        $HTML .= '<div id="passive_' . $this->name . '_' . $name . '">' . $record->field($name, $caption, $subtable, $subtable_fields, $link_url, $concat_char, true, $f_id_field, $order_by, $order_asc, $this->record_id, $link_is_tab, $limit_is_curdate, $value) . '</div>';
        if ($f_id_field) {
            if (stristr($f_id_field, ',')) {
                $f_parts = explode(',', $f_id_field);
                $f_id_field1 = $f_parts[0];
            } else {
                $f_id_field1 = $f_id_field;
            }
            if (strstr($f_id_field1, '.')) {
                $f_parts1 = explode('.', $f_id_field1);
                $get_field = $f_parts1[1];
            } else {
                $get_field = $f_id_field1;
            }
            if ($get_field) {
                $HTML .= '
				<script type="text/javascript">
					getPassiveValue(\'ajax.passive.php?table=' . $this->table . '&name=' . $name . '&caption=' . $caption . '&subtable=' . $subtable . '&subtable_fields=' . urlencode(serialize($subtable_fields)) . '&link_url=' . $link_url . '&concat_char=' . $concat_char . '&f_id_field=' . $f_id_field . '&order_by=' . $order_by . '&order_asc=' . $order_asc . '&link_is_tab=' . $link_is_tab . '&limit_is_curdate=' . $limit_is_curdate . '&record_id=' . $this->record_id . '\',\'passive_' . $this->name . '_' . $name . '\',\'' . $this->name . '_' . $get_field . '\');
				</script>
				';
            }
        }
        $this->HTML[] = $HTML;
    }
Example #4
0
 if ($_REQUEST['table'] == 'admin_tabs') {
     if (!in_array('hidden', $table_fields)) {
         $sql = "ALTER TABLE admin_tabs ADD admin_tabs.hidden ENUM( 'Y', 'N' ) NOT NULL";
         db_query($sql);
     }
     if (!in_array('is_ctrl_panel', $table_fields)) {
         $sql = "ALTER TABLE admin_tabs ADD admin_tabs.is_ctrl_panel ENUM( 'Y', 'N' ) NOT NULL";
         db_query($sql);
     }
     if (!in_array('for_group', $table_fields)) {
         $sql = "ALTER TABLE admin_tabs ADD admin_tabs.for_group INT( 10 ) UNSIGNED NOT NULL";
         db_query($sql);
     }
 }
 $record = new Record($_REQUEST['table'], $_REQUEST['id']);
 $record->field('name', 'Name:');
 $record->field('url', 'Url');
 $record->field('order', 'Order');
 if ($_REQUEST['table'] == 'admin_tabs') {
     $record->field('hidden', 'Hidden?');
     $record->field('is_ctrl_panel', 'Is Control Panel?');
     $record->field('for_group', 'For Group', 'admin_groups', array('name'));
 } elseif ($_REQUEST['table'] == 'admin_pages') {
     if (in_array('icon', $table_fields)) {
         $record->field('icon', 'Icon');
     }
 }
 $record->display();
 $form = new Form('dummy');
 $form->button(false, $CFG->ok_button, false, false, false, false, 'onclick="closePopup(this);"');
 $form->display();
Example #5
0
<?php

include 'lib/common.php';
$CFG->passive_override_id = $_REQUEST['get_id'];
$record = new Record($_REQUEST['table'], $_REQUEST['record_id']);
if ($_REQUEST['action'] == 'indicator') {
    echo $record->indicator($_REQUEST['name'], $_REQUEST['formula'], $_REQUEST['caption'], $_REQUEST['subtable'], @unserialize($_REQUEST['subtable_fields']), $_REQUEST['concat_char'], $_REQUEST['formula_id_field'], $_REQUEST['f_id_field'], $_REQUEST['link_url'], $_REQUEST['link_is_tab'], $_REQUEST['run_in_sql'], 1);
} else {
    echo $record->field($_REQUEST['name'], $_REQUEST['caption'], $_REQUEST['subtable'], @unserialize($_REQUEST['subtable_fields']), $_REQUEST['link_url'], $_REQUEST['concat_char'], true, $_REQUEST['f_id_field'], $_REQUEST['order_by'], $_REQUEST['order_asc'], 1, $_REQUEST['link_is_tab'], $_REQUEST['limit_is_curdate'], $_REQUEST['get_id']);
}
unset($record);
Example #6
0
date_default_timezone_set($CFG->default_timezone);
String::magicQuotesOff();
if ($_REQUEST['users_form']) {
    $form = new Form('users_form', false, false, false, $_REQUEST['table']);
    $form->verify();
    $form->save();
    $form->get($_REQUEST['id']);
    $form->show_errors();
    $form->show_messages();
    PermissionEditor::save();
}
if ($CFG->action == 'record') {
    $view = new Record($_REQUEST['table'], $_REQUEST['id']);
    if ($_REQUEST['table'] == 'admin_groups') {
        $view->field('name', $CFG->user_group_name);
    } else {
        $view->field('id', 'ID');
        $view->field('first_name', $CFG->user_first_name);
        $view->field('last_name', $CFG->user_last_name);
        $view->field('phone', $CFG->user_phone);
        $view->field('email', $CFG->user_email);
        $view->field('f_id', $CFG->user_group, 'admin_groups', array('name'));
        $view->field('is_admin', $CFG->user_is_admin);
    }
    $view->display();
    if ($_REQUEST['table'] == 'admin_groups') {
        $pe = new PermissionEditor('admin', $_REQUEST['id']);
    }
    $form = new Form('dummy');
    //$form->button(false,$CFG->ok_button,false,false,false,false,'onclick="closePopup(this);"');