Exemple #1
0
 function status($status, $limit = FALSE)
 {
     $this->load->view('admin/header');
     $this->load->view('admin/pagetitle', array('pagetitle' => "Applications: " . format_status($status)));
     $this->_status($status, $limit);
     $this->load->view('admin/footer');
 }
Exemple #2
0
function format_log_event($event, $html = TRUE)
{
    if ($event->userid) {
        $displayName = $event->firstname || $event->lastname ? "{$event->firstname} {$event->lastname}" : "[User {$event->userid}]";
        if ($html) {
            $user = anchor("admin/volunteers/show/{$event->userid}", $displayName);
        } else {
            if ($event->firstname || $event->lastname) {
                $user = "******";
            } else {
                $user = $displayName;
            }
        }
    } else {
        $user = '******';
    }
    $byAdmin = $event->adminid ? " by {$event->admin}" : '';
    switch ($event->messageid) {
        case LOG_USER_CREATED:
            return "{$user} registered";
        case LOG_USER_LOGIN:
            return "{$user} logged in";
        case LOG_USER_STATE_CHANGE:
            $state = format_status((int) $event->state);
            return "{$user} moved to state {$state}" . $byAdmin;
        case LOG_NOTE_ADDED:
            return "{$event->admin} added a note to {$user}";
        case LOG_NOTE_DELETED:
            return "{$event->admin} deleted a note from {$user}";
        case LOG_TRAVEL_INFO_UPDATE:
            $details = $html ? "<pre>" . htmlspecialchars($event->state) . "</pre>" : $event->state;
            $delim = $html ? "<br/>" : "\n";
            return "{$event->admin} updated travel dates/details for {$user}{$delim}{$details}";
        case LOG_USER_DELETED:
            return "{$event->admin} deleted {$user}";
        case LOG_MAIL_TEMPLATE_EDITED:
            return "{$event->admin} edited mail template [{$event->state}]";
    }
}
Exemple #3
0
function broadcast_basicauth($notice, $flink)
{
    $user = $flink->getUser();
    $statustxt = format_status($notice);
    $params = twitter_update_params($notice);
    $client = new TwitterBasicAuthClient($flink);
    $status = null;
    try {
        $status = $client->statusesUpdate($statustxt, $params);
    } catch (BasicAuthException $e) {
        return process_error($e, $flink, $notice);
    }
    if (empty($status)) {
        $errmsg = sprintf('Twitter bridge - No data returned by Twitter API when ' . 'trying to post notice %d for %s (user id %d).', $notice->id, $user->nickname, $user->id);
        common_log(LOG_WARNING, $errmsg);
        $errmsg = sprintf('No data returned by Twitter API when ' . 'trying to post notice %d for %s (user id %d).', $notice->id, $user->nickname, $user->id);
        common_log(LOG_WARNING, $errmsg);
        return false;
    }
    $msg = sprintf('Twitter bridge - posted notice %d to Twitter using ' . 'HTTP basic auth for User %s (user id %d).', $notice->id, $user->nickname, $user->id);
    common_log(LOG_INFO, $msg);
    return true;
}
    function install_visitor()
    {
        $this->EE->load->dbforge();
        if (version_compare(APP_VER, '2.4.0', '<')) {
        } else {
            $this->EE->load->helper('security');
        }
        $errors = array();
        $success = array();
        // =======================================
        // = Is Zoo Visitor fieldtype installed? =
        // =======================================
        $this->EE->db->where('name', 'zoo_visitor');
        $query = $this->EE->db->get('fieldtypes');
        if ($query->num_rows() > 0) {
            $zoo_visitor_fieldtype_id = $query->row()->fieldtype_id;
        } else {
            $errors[] = 'fieldtype_not_installed';
            $this->EE->session->set_flashdata('errors', 'fieldtype_not_installed');
            $this->EE->functions->redirect(BASE . AMP . 'C=addons_modules' . AMP . 'M=show_module_cp' . AMP . 'module=zoo_visitor' . AMP . 'method=installation');
        }
        // ======================
        // =Create fieldgroup =
        // ======================
        $this->EE->db->where('group_name', 'Zoo Visitor Fields');
        $this->EE->db->where('site_id', $this->EE->config->item('site_id'));
        $query = $this->EE->db->get('field_groups');
        if ($query->num_rows() > 0) {
            //channel exists, get id
            $field_group_id = $query->row()->group_id;
            $errors[] = 'field_group_exists';
        } else {
            //generate field group
            $field_group_data = array();
            $field_group_data['site_id'] = $this->EE->config->item('site_id');
            $field_group_data['group_name'] = 'Zoo Visitor Fields';
            $this->EE->db->insert('field_groups', $field_group_data);
            $field_group_id = $this->EE->db->insert_id();
            $success[] = 'field_group_generated';
        }
        /// ==================
        // = Create channel =
        // ==================
        $this->EE->db->where('channel_name', 'zoo_visitor');
        $this->EE->db->where('site_id', $this->EE->config->item('site_id'));
        $query = $this->EE->db->get('channels');
        if ($query->num_rows() > 0) {
            //channel exists, get id
            $channel_id = $query->row()->channel_id;
            $errors[] = 'member_channel_exists';
        } else {
            //generate channel
            $data['site_id'] = $this->EE->config->item('site_id');
            $data['channel_name'] = 'zoo_visitor';
            $data['channel_title'] = 'Zoo Visitor Members';
            $data['channel_url'] = '';
            $data['channel_lang'] = $this->EE->config->item('xml_lang');
            $data['field_group'] = $field_group_id;
            $data['status_group'] = 1;
            $this->EE->db->insert('channels', $data);
            $channel_id = $this->EE->db->insert_id();
            $success[] = 'channel_generated';
        }
        $this->EE->db->update('channels', array("field_group" => $field_group_id), "site_id = '" . $this->EE->config->item('site_id') . "' AND channel_id = '" . $channel_id . "'");
        $this->EE->db->update(strtolower($this->class_name) . '_settings', array("var_value" => $channel_id), "var = 'member_channel_id'");
        // =============================================================
        // = Allow guests to post in this channel, member registration =
        // =============================================================
        $this->EE->db->where('channel_id', $channel_id);
        $this->EE->db->where('group_id', '3');
        $query = $this->EE->db->get('channel_member_groups');
        if ($query->num_rows() == 0) {
            $this->EE->db->insert('channel_member_groups', array('group_id' => '3', 'channel_id' => $channel_id));
        }
        // ======================
        // = Create statusgroup =
        // ======================
        $this->EE->db->where('group_name', 'Zoo Visitor Membergroup');
        $this->EE->db->where('site_id', $this->EE->config->item('site_id'));
        $query = $this->EE->db->get('status_groups');
        if ($query->num_rows() > 0) {
            $status_group_id = $query->row()->group_id;
        } else {
            $status_group_data = array();
            $status_group_data['site_id'] = $this->EE->config->item('site_id');
            $status_group_data['group_name'] = 'Zoo Visitor Membergroup';
            $this->EE->db->insert('status_groups', $status_group_data);
            $status_group_id = $this->EE->db->insert_id();
            $group_query = $this->EE->member_model->get_member_groups();
            foreach ($group_query->result() as $row) {
                $status_data = array();
                $status_data['status'] = format_status($row->group_title, $row->group_id);
                $status_data['site_id'] = $this->EE->config->item('site_id');
                $status_data['group_id'] = $status_group_id;
                $status_data['status_order'] = '';
                $this->EE->db->insert('statuses', $status_data);
            }
        }
        $this->EE->db->update('channels', array("status_group" => $status_group_id), "site_id = '" . $this->EE->config->item('site_id') . "' AND channel_id = '" . $channel_id . "'");
        // ===============================
        // = Assign fields to fieldgroup =
        // ===============================
        $def_settings = 'YTo2OntzOjE4OiJmaWVsZF9zaG93X3NtaWxleXMiO3M6MToibiI7czoxOToiZmllbGRfc2hvd19nbG9zc2FyeSI7czoxOiJuIjtzOjIxOiJmaWVsZF9zaG93X3NwZWxsY2hlY2siO3M6MToibiI7czoyNjoiZmllbGRfc2hvd19mb3JtYXR0aW5nX2J0bnMiO3M6MToibiI7czoyNDoiZmllbGRfc2hvd19maWxlX3NlbGVjdG9yIjtzOjE6Im4iO3M6MjA6ImZpZWxkX3Nob3dfd3JpdGVtb2RlIjtzOjE6Im4iO30=';
        $fields = array();
        $fields[] = array('Member account', 'member_account', 'zoo_visitor', '');
        $fields[] = array('Firstname', 'member_firstname', 'text', '');
        $fields[] = array('Lastname', 'member_lastname', 'text', '');
        $fields[] = array('Gender', 'member_gender', 'radio', 'Male
		Female');
        $fields[] = array('Birthday', 'member_birthday', 'date', '');
        $field_order = 1;
        foreach ($fields as $field) {
            $field_data = array();
            $field_data['site_id'] = $this->EE->config->item('site_id');
            $field_data['group_id'] = $field_group_id;
            $field_data['field_name'] = $field[1];
            $field_data['field_label'] = $field[0];
            $field_data['field_type'] = $field[2];
            $field_data['field_list_items'] = $field[3];
            if (version_compare(APP_VER, '2.6.0', '<')) {
                $field_data['field_related_to'] = 'channel';
                $field_data['field_related_id'] = $channel_id;
            }
            $field_data['field_show_fmt'] = 'n';
            $field_data['field_settings'] = $def_settings;
            $field_data['field_order'] = $field_order;
            $field_data['field_content_type'] = 'any';
            $this->EE->db->where('field_name', $field[1]);
            $this->EE->db->where('site_id', $this->EE->config->item('site_id'));
            $query = $this->EE->db->get('channel_fields');
            if ($query->num_rows() == 0) {
                $this->EE->db->insert('channel_fields', $field_data);
                $field_id = $this->EE->db->insert_id();
                if ($field[2] == 'date') {
                    $this->EE->dbforge->add_column('channel_data', array('field_id_' . $field_id => array('type' => 'int(10)')));
                } else {
                    $this->EE->dbforge->add_column('channel_data', array('field_id_' . $field_id => array('type' => 'text', 'null' => FALSE)));
                }
                $this->EE->dbforge->add_column('channel_data', array('field_ft_' . $field_id => array('type' => 'tinytext')));
                if ($field[2] == 'date') {
                    $this->EE->dbforge->add_column('channel_data', array('field_dt_' . $field_id => array('type' => 'varchar(8)')));
                }
                foreach (array('none', 'br', 'xhtml') as $field_fmt) {
                    $this->EE->db->insert('field_formatting', array('field_id' => $field_id, 'field_fmt' => $field_fmt));
                }
                $field_order++;
            }
        }
        $override_val = 'member_firstname member_lastname';
        $this->EE->db->where('field_name', 'member_firstname');
        $this->EE->db->or_where('field_name', 'member_lastname');
        $this->EE->db->where('site_id', $this->EE->config->item('site_id'));
        $query = $this->EE->db->get('channel_fields');
        if ($query->num_rows() > 0) {
            foreach ($query->result_array() as $row) {
                $override_val = str_replace($row['field_name'], 'field_id_' . $row['field_id'], $override_val);
            }
            $this->EE->db->update(strtolower($this->class_name) . '_settings', array("var_value" => $override_val), "var = 'screen_name_override' AND site_id = '" . $this->EE->config->item('site_id') . "'");
        }
        // =======================
        // = Create template group  =
        // =======================
        $template_group_name = 'zoo_visitor_example';
        $this->EE->db->where('group_name', $template_group_name);
        $this->EE->db->where('site_id', $this->EE->config->item('site_id'));
        $query = $this->EE->db->get('template_groups');
        if ($query->num_rows() > 0) {
            //template group exists, get id
            $template_group_id = $query->row()->group_id;
            $errors[] = 'template_group_exists';
        } else {
            //generate channel
            $template_group_data = array();
            $template_group_data['site_id'] = $this->EE->config->item('site_id');
            $template_group_data['group_name'] = $template_group_name;
            $this->EE->db->insert('template_groups', $template_group_data);
            $template_group_id = $this->EE->db->insert_id();
            $success[] = 'template_group_generated';
        }
        // =================================
        // = create anonymous guest member =
        // =================================
        $this->EE->db->where('username', 'zoo_visitor_guest');
        $query = $this->EE->db->get('members');
        if ($query->num_rows() == 0) {
            $data = array();
            $data['group_id'] = 3;
            // Guests
            $data['username'] = '******';
            $data['password'] = version_compare(APP_VER, '2.6.0', '<') ? $this->EE->functions->hash('zoo_visitor_login') : md5('zoo_visitor_login');
            $data['ip_address'] = $this->EE->input->ip_address();
            $data['unique_id'] = $this->EE->functions->random('encrypt');
            $data['join_date'] = $this->EE->localize->now;
            $data['email'] = '*****@*****.**';
            $data['screen_name'] = 'zoo_visitor_guest';
            $data['language'] = $this->EE->config->item('deft_lang') ? $this->EE->config->item('deft_lang') : 'english';
            //$data['time_format'] = ($this->EE->config->item('time_format')) ? $this->EE->config->item('time_format') : 'us';
            //$data['timezone']	= ($this->EE->config->item('default_site_timezone') && $this->EE->config->item('default_site_timezone') != '') ? $this->EE->config->item('default_site_timezone') : $this->EE->config->item('server_timezone');
            //$data['daylight_savings'] = 'n';
            $this->EE->db->query($this->EE->db->insert_string('exp_members', $data));
            $anonymous_member_id = $this->EE->db->insert_id();
        } else {
            $anonymous_member_id = $query->row()->member_id;
        }
        $this->EE->db->update(strtolower($this->class_name) . '_settings', array("var_value" => $anonymous_member_id), "var = 'anonymous_member_id'");
        // ====================
        // = Create templates =
        // ====================
        $templates = array('index', 'menu', 'register', 'profile', 'login', 'login_ajax', 'change_password', 'change_login', 'forgot_password', 'reset_password');
        $template_data['site_id'] = $this->EE->config->item('site_id');
        $template_data['group_id'] = $template_group_id;
        $template_data['template_type'] = 'webpage';
        $template_data['edit_date'] = $this->EE->localize->now;
        require_once PATH_THIRD . 'zoo_visitor/helpers/zoo_visitor_helper.php';
        $this->EE->load->helper('file');
        foreach ($templates as $template) {
            $this->EE->db->where('template_name', $template);
            $this->EE->db->where('group_id', $template_group_id);
            $this->EE->db->where('site_id', $this->EE->config->item('site_id'));
            $query = $this->EE->db->get('templates');
            if ($query->num_rows() == 0) {
                $template_content = read_file(PATH_THIRD . 'zoo_visitor/views/templates/' . $template . '.html');
                $template_data['template_name'] = $template;
                $template_data['template_data'] = $template_content;
                $this->EE->db->insert('templates', $template_data);
            }
        }
        $this->EE->session->set_flashdata('installation', 'ran');
        $this->EE->functions->redirect(BASE . AMP . 'C=addons_modules' . AMP . 'M=show_module_cp' . AMP . 'module=zoo_visitor' . AMP . 'method=installation');
        //return array($errors, $success);
    }
Exemple #5
0
function broadcast_oauth($notice, $flink)
{
    $user = $flink->getUser();
    $statustxt = format_status($notice);
    $params = twitter_update_params($notice);
    $token = TwitterOAuthClient::unpackToken($flink->credentials);
    $client = new TwitterOAuthClient($token->key, $token->secret);
    $status = null;
    try {
        $status = $client->statusesUpdate($statustxt, $params);
        if (!empty($status)) {
            Notice_to_status::saveNew($notice->id, twitter_id($status));
        }
    } catch (OAuthClientException $e) {
        return process_error($e, $flink, $notice);
    }
    if (empty($status)) {
        // This could represent a failure posting,
        // or the Twitter API might just be behaving flakey.
        $errmsg = sprintf('Twitter bridge - No data returned by Twitter API when ' . 'trying to post notice %d for User %s (user id %d).', $notice->id, $user->nickname, $user->id);
        common_log(LOG_WARNING, $errmsg);
        return false;
    }
    // Notice crossed the great divide
    $msg = sprintf('Twitter bridge - posted notice %d to Twitter using ' . 'OAuth for User %s (user id %d).', $notice->id, $user->nickname, $user->id);
    common_log(LOG_INFO, $msg);
    return true;
}
Exemple #6
0
            ?>
</td>
    <td>
        <?php 
            echo $smsc['id'];
            ?>
 [<?php 
            echo $smsc['admin-id'];
            ?>
]<br />
        <?php 
            echo $smsc['name'];
            ?>
    </td>
    <td><?php 
            echo format_status($st);
            ?>
</td>
    <td><?php 
            echo $uptime;
            ?>
</td>
    <td><?php 
            echo nf($smsc['sms'][0]['received']);
            ?>
</td>
    <td><?php 
            echo nf($smsc['dlr'][0]['received']);
            ?>
</td>
    <td><?php 
 function update_membergroup_status($membergroup_name, $group_id, $new_group_id = 0)
 {
     //group_id is not set, this is a new membergroup, get next auto_increment value
     if (empty($group_id)) {
         $query = $this->EE->db->query("SELECT MAX(group_id) as max_group FROM exp_member_groups");
         $group_id = $query->row('max_group') + 1;
     }
     $status = format_status($membergroup_name, $group_id);
     $exists = FALSE;
     //check based on $group_id if the status exists
     $query_statusgroups = $this->EE->db->select('group_id')->where('group_name', 'Zoo Visitor Membergroup')->get('status_groups');
     //->where('site_id',$this->EE->config->item('site_id'))->get('status_groups');
     if ($query_statusgroups->num_rows() > 0) {
         $query_statusses = $this->EE->db->select('status, status_id')->where('group_id', $query_statusgroups->row()->group_id)->get('statuses');
         //->where('site_id',$this->EE->config->item('site_id'))->get('statuses');
         if ($query_statusses->num_rows() > 0) {
             foreach ($query_statusses->result() as $row) {
                 $status_id = explode('-id', $row->status);
                 //status exists => update
                 if ($status_id[1] == $group_id) {
                     if ($new_group_id != 0) {
                         $new_membergroup = $this->EE->db->select('*')->where('group_id', $new_group_id)->where('site_id', $this->EE->config->item('site_id'))->get('member_groups');
                         $status = format_status($new_membergroup->row()->group_title, $new_group_id);
                     }
                     $this->EE->db->update('statuses', array("status" => $status), "status_id = '" . $row->status_id . "'");
                     $this->EE->db->update('channel_titles', array("status" => $status), "status = '" . $row->status . "'");
                     $exists = TRUE;
                     break;
                 }
             }
             if (!$exists) {
                 $this->EE->db->insert('statuses', array('status' => $status, 'group_id' => $query_statusgroups->row()->group_id, 'site_id' => $this->EE->config->item('site_id'), 'status_order' => '0', 'highlight' => ''));
             }
         }
     }
 }
Exemple #8
0
<div id="status">
  Status:

  <span class="statustimeline">
    <?php 
$progression = array(STATUS_CREATED, STATUS_DRAFT, STATUS_SUBMITTED, STATUS_ACCEPTED, STATUS_CONFIRMED);
if (in_array($user->status, $progression)) {
    foreach ($progression as $status) {
        echo "<span class='statusvalue' id='status{$status}'>" . htmlspecialchars(format_status($status)) . '</span>';
        if ($status != $progression[sizeof($progression) - 1]) {
            echo " &rarr; ";
        }
    }
} else {
    echo "<span class='statusvalue' id='status{$user->status}'>" . htmlspecialchars(format_status($user->status)) . '</span>';
}
?>
  </span>
  <?php 
if (format_status_nextstep($user->status)) {
    ?>
    <div class="nextstep">
      <strong>Next step:</strong> <?php 
    echo htmlspecialchars(format_status_nextstep($user->status));
    ?>
    </div>
  <?php 
}
?>
</div>
Exemple #9
0
});
</script>

<div style="float: right">
   <?php 
echo anchor('admin/volunteers', 'Back to list');
?>
</div>

<h1><?php 
echo format_value("{$user->firstname} {$user->lastname}");
?>
</h1>

<div id="status">Status: <span id="statusvalue"><?php 
echo htmlspecialchars(format_status($user->status));
?>
</span></div>

<?php 
if ($user->status == STATUS_SUBMITTED) {
    ?>
<form action="acceptreject.php" method="POST">
<input type="hidden" name="id" value="<?php 
    echo $user->id;
    ?>
"
<button id="btnAccept" type="submit" name="action" value="accept"><h3 style="color: #060">Accept</h3></button>
<button id="btnReject" type="submit" name="action" value="reject"><h3 style="color: #D00">Reject</h3></button>
</form>
<?php 
Exemple #10
0
    foreach ($projects as $i => $project) {
        ?>
    <tr class="<?php 
        echo (fmod($i, 2) ? 'even' : 'odd') . ($project->isDisabled() ? ' disabled' : '');
        ?>
">
      <td class="left"><?php 
        echo link_to($project->formatName(isset($showCompleteName) && $showCompleteName), 'project_show', $project);
        ?>
</td>
      <td class="center"><?php 
        echo $project->getVersion();
        ?>
</td>
      <td class="center"><?php 
        echo format_status($project->isEnabled());
        ?>
</td>
      <td class="center"><?php 
        echo $project->getIterations()->count();
        ?>
</td>
      <td class="center"><?php 
        echo $project->getStories()->count();
        ?>
</td>
      <td class="center"><?php 
        echo $project->getTasks()->count();
        ?>
</td>
      <td class="center">