/**
 * Handle on_milestone_add_links event
 *
 * @param Milestone $milestone
 * @param User $user
 * @param array $links
 * @return null
 */
function tickets_handle_on_milestone_add_links($milestone, $user, &$links)
{
    if ($user->getProjectPermission('ticket', $milestone->getProject()) >= PROJECT_PERMISSION_CREATE) {
        $links[lang('Ticket')] = tickets_module_add_ticket_url($milestone->getProject(), array('milestone_id' => $milestone->getId()));
    }
    // if
}
 public function submitInfo()
 {
     $this->load->model("settings_model");
     // Gather the values
     $values = array('nickname' => htmlspecialchars($this->input->post("nickname")), 'location' => htmlspecialchars($this->input->post("location")));
     // Change language
     if ($this->config->item('show_language_chooser')) {
         $values['language'] = $this->input->post("language");
         if (!is_dir("application/language/" . $values['language'])) {
             die("3");
         } else {
             $this->user->setLanguage($values['language']);
             $this->plugins->onSetLanguage($this->user->getId(), $values['language']);
         }
     }
     // Remove the nickname field if it wasn't changed
     if ($values['nickname'] == $this->user->getNickname()) {
         $values = array('location' => $this->input->post("location"));
     } elseif (strlen($values['nickname']) < 4 || strlen($values['nickname']) > 14 || !preg_match("/[A-Za-z0-9]*/", $values['nickname'])) {
         die(lang("nickname_error", "ucp"));
     } elseif ($this->internal_user_model->nicknameExists($values['nickname'])) {
         die("2");
     }
     if (strlen($values['location']) > 32 && !ctype_alpha($values['location'])) {
         die(lang("location_error", "ucp"));
     }
     $this->settings_model->saveSettings($values);
     $this->plugins->onSaveSettings($this->user->getId(), $values);
     die("1");
 }
Ejemplo n.º 3
0
 /**
  * 删除
  */
 public function delAction()
 {
     $dir = base64_decode($this->get('name'));
     $name = $this->dir . $dir;
     $name = substr($name, -1) == '/' ? substr($name, 0, -1) : $name;
     if ($this->checkFileName($name)) {
         $this->adminMsg(lang('m-con-20'));
     }
     if ($this->dir == $name || $this->dir == $name . '/') {
         $this->adminMsg(lang('a-att-0'));
     }
     if (!file_exists($name)) {
         $this->adminMsg(lang('a-att-1', array('1' => $name)));
     }
     if (is_dir($name)) {
         //删除目录
         $this->delDir($name);
         $this->adminMsg(lang('a-att-2'), url('admin/attachment/index', array('dir' => base64_encode(str_replace(basename($dir), '', $dir)))), 3, 1, 1);
     }
     if (is_file($name)) {
         //删除文件
         unlink($name);
         $this->adminMsg(lang('a-att-3'), url('admin/attachment/index', array('dir' => base64_encode(str_replace(basename($dir), '', $dir)))), 3, 1, 1);
     }
 }
Ejemplo n.º 4
0
 public function all_notification()
 {
     $data = $this->data;
     $data['menu_name']['nama'] = lang('lbl_notification');
     $data['menu_name']['keterangan'] = lang('lbl_all_notification');
     $data['datatable'] = "";
     $data['method'] = $this->method_master;
     $data['no_left_menu'] = TRUE;
     $data['this_modul'] = FALSE;
     $data['controller'] = $this->controller_notification;
     $data['notif'] = $this->model_basic->get_data($this->tbl_notifikasi, array('where_array' => array('id_group' => $data['user_level']), 'limit' => 20, 'sort_by' => 'id', 'sort' => 'DESC'))->result();
     foreach ($data['notif'] as $n) {
         $user = $this->model_basic->get_data($this->tbl_user, array('where_array' => array('id' => $n->id_user)))->row();
         $data['peg'][$n->id] = $this->model_basic->get_data($this->tbl_pegawai, array('where_array' => array('id' => $user->id_pegawai)))->row();
         $waktu = explode(' ', $n->tanggal);
         $data['waktu'][$n->id] = $this->mydate($waktu[0]) . ' ' . $waktu[1];
     }
     $data['breadcrumbs'] = array(1 => array('target' => $this->controller_notification . '/all_notification', 'nama' => $data['menu_name']['nama']));
     if (count($data['modul']) > 0) {
         $this->load->view('template/header', $data);
     } else {
         $this->load->view('template/header_no_module', $data);
     }
     $this->load->view('global/notification');
     $this->load->view('template/footer');
 }
Ejemplo n.º 5
0
 /**
  * Constructor
  *
  * @see Filter::$options for the format of the options array
  *
  * @param array $options An associative array of options
  */
 public function __construct(array $options = array())
 {
     $this->name = 'filter_by_site';
     $this->label = 'site';
     $this->placeholder = lang('filter_by_site');
     $this->options = $options;
 }
Ejemplo n.º 6
0
 /**
  * Display settings sub-form for this variable type
  *
  * @param      mixed     $var_id        The id of the variable: 'new' or numeric
  * @param      array     $var_settings  The settings of the variable
  * @return     array
  */
 function display_settings($var_id, $var_settings)
 {
     // -------------------------------------
     //  Init return value
     // -------------------------------------
     $r = array();
     // -------------------------------------
     //  Check current value from settings
     // -------------------------------------
     $rows = $this->get_setting('rows', $var_settings);
     // -------------------------------------
     //  Build settings for rows
     // -------------------------------------
     $r[] = array($this->setting_label(lang('variable_rows')), form_input(array('name' => $this->input_name('rows'), 'value' => $rows, 'maxlength' => '4', 'class' => 'x-small')));
     // -------------------------------------
     //  Build settings text_direction
     // -------------------------------------
     $dir_options = '';
     foreach (array('ltr', 'rtl') as $dir) {
         $dir_options .= '<label class="low-radio">' . form_radio($this->input_name('text_direction'), $dir, $this->get_setting('text_direction', $var_settings) == $dir) . ' ' . lang("text_direction_{$dir}") . '</label>';
     }
     $r[] = array($this->setting_label(lang('text_direction')), $dir_options);
     // -------------------------------------
     //  Return output
     // -------------------------------------
     return $r;
 }
 public function userCakeAddUser()
 {
     global $db, $emailActivation, $websiteUrl, $db_table_prefix;
     //Construct a secure hash for the plain text password
     $secure_pass = generateHash($this->clean_password);
     //Construct a unique activation token
     $this->activation_token = generateActivationToken();
     //Do we need to send out an activation email?
     if ($emailActivation) {
         //User must activate their account first
         $this->user_active = 0;
         $mail = new userCakeMail();
         //Build the activation message
         $activation_message = lang("ACTIVATION_MESSAGE", array($websiteUrl, $this->activation_token));
         //Define more if you want to build larger structures
         $hooks = array("searchStrs" => array("#ACTIVATION-MESSAGE", "#ACTIVATION-KEY", "#USERNAME#"), "subjectStrs" => array($activation_message, $this->activation_token, $this->unclean_username));
         /* Build the template - Optional, you can just use the sendMail function 
         			Instead to pass a message. */
         if (!$mail->newTemplateMsg("new-registration.txt", $hooks)) {
             $this->mail_failure = true;
         } else {
             //Send the mail. Specify users email here and subject.
             //SendMail can have a third parementer for message if you do not wish to build a template.
             if (!$mail->sendMail($this->clean_email, "Επιβεβαιώστε την εγγραφή σας στο Σύλλογο Αποφοίτων")) {
                 $this->mail_failure = true;
             }
         }
     } else {
         //Instant account activation
         $this->user_active = 1;
     }
     //Insert the user into the database providing no errors have been found.
     $sql = "INSERT INTO `" . $db_table_prefix . "Users` (\n\t\t\t\t`Username`,\n\t\t\t\t`Username_Clean`,\n\t\t\t\t`Password`,\n\t\t\t\t`Email`,\n\t\t\t\t`ActivationToken`,\n\t\t\t\t`LastActivationRequest`,\n\t\t\t\t`LostPasswordRequest`, \n\t\t\t\t`Active`,\n\t\t\t\t`Group_ID`,\n\t\t\t\t`SignUpDate`,\n\t\t\t\t`LastSignIn`\n\t\t\t\t)\n\t\t \t\tVALUES (\n\t\t\t\t'" . $db->sql_escape($this->unclean_username) . "',\n\t\t\t\t'" . $db->sql_escape($this->clean_username) . "',\n\t\t\t\t'" . $secure_pass . "',\n\t\t\t\t'" . $db->sql_escape($this->clean_email) . "',\n\t\t\t\t'" . $this->activation_token . "',\n\t\t\t\t'" . time() . "',\n\t\t\t\t'0',\n\t\t\t\t'" . $this->user_active . "',\n\t\t\t\t'1',\n\t\t\t\t'" . time() . "',\n\t\t\t\t'0'\n\t\t\t\t)";
     return $db->sql_query($sql);
 }
Ejemplo n.º 8
0
 function getsetting()
 {
     global $_G;
     $settings = $this->setting;
     if ($settings['catid']) {
         $settings['catid']['value'][] = array(0, lang('portalcp', 'block_all_category'));
         loadcache('portalcategory');
         foreach ($_G['cache']['portalcategory'] as $value) {
             if ($value['level'] == 0) {
                 $settings['catid']['value'][] = array($value['catid'], $value['catname']);
                 if ($value['children']) {
                     foreach ($value['children'] as $catid2) {
                         $value2 = $_G['cache']['portalcategory'][$catid2];
                         $settings['catid']['value'][] = array($value2['catid'], '-- ' . $value2['catname']);
                         if ($value2['children']) {
                             foreach ($value2['children'] as $catid3) {
                                 $value3 = $_G['cache']['portalcategory'][$catid3];
                                 $settings['catid']['value'][] = array($value3['catid'], '---- ' . $value3['catname']);
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($settings['tag']) {
         $tagnames = article_tagnames();
         foreach ($tagnames as $k => $v) {
             $settings['tag']['value'][] = array($k, $v);
         }
     }
     return $settings;
 }
Ejemplo n.º 9
0
 public function site()
 {
     $api = array("user_id" => $this->user->getId(), "username" => $this->user->getUsername(), "user_ip" => $this->input->ip_address());
     $vote_site_id = $this->input->post('id');
     //The site where we are voting for.
     if (!$vote_site_id) {
         die("Please specify topsite ID");
     }
     //Get the vote site info, returns false if the site does not exists!!
     $vote_site = $this->vote_model->getVoteSite($vote_site_id);
     //Check if they already voted with that ip.
     $can_vote = $this->vote_model->canVote($vote_site_id);
     //Check if that site exists and that the user didn't voted for it yet.
     if ($vote_site && $can_vote) {
         //Update the vp if needed or else just go to the url if we got vote callback enabled.
         if ($vote_site['callback_enabled']) {
             $vote_url = preg_replace("/\\{user_id\\}/", $this->user->getId(), $vote_site['vote_url']);
             if ($this->input->post("isFirefoxHerpDerp")) {
                 die($vote_url);
             }
             redirect($vote_url);
         } else {
             $this->vote_model->vote_log($api['user_id'], $api['user_ip'], $vote_site_id);
             $this->vote_model->updateVp($this->user->getId(), $vote_site['points_per_vote']);
             $this->plugins->onVote($api['user_id'], $vote_site);
             if ($this->input->post("isFirefoxHerpDerp")) {
                 die($vote_site['vote_url']);
             }
             redirect($vote_site['vote_url']);
         }
     } else {
         die(lang("already_voted", "vote"));
     }
 }
 /**
  * Settings form
  * 
  * @param void
  * @return null
  */
 function index()
 {
     js_assign('test_svn_url', assemble_url('admin_source_test_svn'));
     $source_data = $this->request->post('source');
     if (!is_foreachable($source_data)) {
         $source_data = array('svn_path' => ConfigOptions::getValue('source_svn_path'), 'svn_config_dir' => ConfigOptions::getValue('source_svn_config_dir'), 'source_svn_use_output_redirect' => ConfigOptions::getValue('source_svn_use_output_redirect'), 'source_svn_trust_server_cert' => ConfigOptions::getValue('source_svn_trust_server_cert'));
     }
     // if
     if ($this->request->isSubmitted()) {
         $svn_path = array_var($source_data, 'svn_path', null);
         $svn_path = $svn_path ? with_slash($svn_path) : null;
         ConfigOptions::setValue('source_svn_path', $svn_path);
         $svn_config_dir = array_var($source_data, 'svn_config_dir') == '' ? null : array_var($source_data, 'svn_config_dir');
         ConfigOptions::setValue('source_svn_config_dir', $svn_config_dir);
         $svn_use_output_redirection = array_var($source_data, 'source_svn_use_output_redirect') == "1";
         ConfigOptions::setValue('source_svn_use_output_redirect', $svn_use_output_redirection);
         $svn_trust_server_certificate = array_var($source_data, 'source_svn_trust_server_cert') == "1";
         ConfigOptions::setValue('source_svn_trust_server_cert', $svn_trust_server_certificate);
         flash_success("Source settings successfully saved");
         $this->redirectTo('admin_source');
     }
     // if
     if (!RepositoryEngine::executableExists()) {
         $this->wireframe->addPageMessage(lang("SVN executable not found. You won't be able to use this module"), 'error');
     }
     // if
     $this->smarty->assign(array('source_data' => $source_data));
 }
Ejemplo n.º 11
0
 public function reject($id)
 {
     $this->auth->checkIfOperationIsAllowed('reject_overtime');
     $this->load->model('users_model');
     $this->load->model('delegations_model');
     $extra = $this->overtime_model->getExtras($id);
     if (empty($extra)) {
         redirect('notfound');
     }
     $employee = $this->users_model->getUsers($extra['employee']);
     $is_delegate = $this->delegations_model->isDelegateOfManager($this->user_id, $employee['manager']);
     if ($this->user_id == $employee['manager'] || $this->is_hr || $is_delegate) {
         $this->overtime_model->rejectExtra($id);
         $this->sendMail($id);
         $this->session->set_flashdata('msg', lang('overtime_reject_flash_msg_success'));
         if (isset($_GET['source'])) {
             redirect($_GET['source']);
         } else {
             redirect('overtime');
         }
     } else {
         log_message('error', 'User #' . $this->user_id . ' illegally tried to reject extra #' . $id);
         $this->session->set_flashdata('msg', lang('overtime_reject_flash_msg_error'));
         redirect('leaves');
     }
 }
Ejemplo n.º 12
0
 public function latest_fotos_configure($action = 'show_settings', $widget_data = array())
 {
     if ($this->dx_auth->is_admin() == FALSE) {
         exit;
     }
     switch ($action) {
         case 'show_settings':
             //$this->display_tpl('latest_fotos_form', array('widget' => $widget_data));
             $this->render('latest_fotos_form', array('widget' => $widget_data));
             break;
         case 'update_settings':
             $this->load->library('Form_validation');
             $this->form_validation->set_rules('limit', lang("Image limit", 'gallery'), 'trim|required|integer');
             if ($this->form_validation->run($this) == FALSE) {
                 showMessage(validation_errors(), false, 'r');
                 exit;
             }
             $data = array('limit' => $_POST['limit'], 'order' => $_POST['order']);
             $this->load->module('admin/widgets_manager')->update_config($widget_data['id'], $data);
             showMessage(lang("Settings have been saved", 'gallery'));
             if ($_POST['action'] == 'tomain') {
                 pjax('/admin/widgets_manager/index');
             }
             break;
         case 'install_defaults':
             $data = array('limit' => 5, 'order' => 'latest');
             $this->load->module('admin/widgets_manager')->update_config($widget_data['id'], $data);
             break;
     }
 }
Ejemplo n.º 13
0
 /**
  * [creat_payment 创建支付]
  * @param  [type] $buyer   [description]
  * @param  [type] $pids    [description]
  * @param  [type] $amount  [description]
  * @param  [type] $tel     [description]
  * @param  [type] $address [description]
  * @return [type]          [description]
  */
 public function creat_payment($buyer, $pids, $amount, $tel, $address, $channel)
 {
     $arr = explode(',', $pids);
     $total_fee = 0;
     $title_str = "";
     foreach ($arr as $k => $v) {
         //传递参数被篡改
         if (!is_numeric($v)) {
             $this->error->output('TRANSACT_DATA');
         }
         $p = $this->production_model->get_production_by_id($v);
         //商品不存在,已售出,下架
         if (empty($p) || $p['status'] == 1 || $p['status'] == 2) {
             $this->error->output('NO_GOOD');
         }
         $total_fee += (double) $p['price'];
         $title_str .= $p['name'] . ", ";
     }
     //显示价格被篡改
     if ($total_fee != $amount) {
         $this->error->output('TRANSACT_DATA');
     }
     $order_no = time() . 'u_' . $buyer;
     $subject = lang('BUY_SUBJECT');
     $body = $title_str;
     $extra_common_param = array('buyer' => $buyer, 'pids' => $pids, 'amount' => $amount, 'tel' => $tel, 'address' => $address);
     $extra_common_param = json_encode($extra_common_param);
     //创建支付
     switch ($channel) {
         case 'alipay':
             return $this->_alipay();
             break;
     }
 }
/**
 * Render select_default_assignment_filter control
 * 
 * Parameters:
 * 
 * - user - User - User using the page
 * - value - integer - ID of selected filter
 * - optional - boolean - Value is optional?
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_select_default_assignment_filter($params, &$smarty)
{
    $user = array_var($params, 'user', null, true);
    $value = array_var($params, 'value', null, true);
    $optional = array_var($params, 'optional', true, true);
    $default_filter_id = (int) ConfigOptions::getValue('default_assignments_filter');
    $default_filter = $default_filter_id ? AssignmentFilters::findById($default_filter_id) : null;
    $options = array();
    if (instance_of($default_filter, 'AssignmentFilter') && $optional) {
        $options[] = option_tag(lang('-- System Default (:filter) --', array('filter' => $default_filter->getName())), '');
    }
    // if
    $grouped_filters = AssignmentFilters::findGrouped($user, true);
    if (is_foreachable($grouped_filters)) {
        foreach ($grouped_filters as $group_name => $filters) {
            $group_options = array();
            foreach ($filters as $filter) {
                $group_options[] = option_tag($filter->getName(), $filter->getId(), array('selected' => $value == $filter->getId()));
            }
            // foreach
            if (count($options) > 0) {
                $options[] = option_tag('', '');
            }
            // if
            $options[] = option_group_tag($group_name, $group_options);
        }
        // foreach
    }
    // if
    return select_box($options, $params);
}
Ejemplo n.º 15
0
 function getsetting()
 {
     global $_G;
     $settings = $this->setting;
     if ($settings['fids']) {
         loadcache('forums');
         $settings['fids']['value'][] = array(0, lang('portalcp', 'block_all_forum'));
         foreach ($_G['cache']['forums'] as $fid => $forum) {
             $settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')) . $forum['name']);
         }
     }
     if ($settings['sortids']) {
         $defaultvalue = '';
         $query = DB::query("SELECT typeid, name, special FROM " . DB::table('forum_threadtype') . " ORDER BY typeid DESC");
         while ($threadtype = DB::fetch($query)) {
             if ($threadtype['special']) {
                 if (empty($defaultvalue)) {
                     $defaultvalue = $threadtype['typeid'];
                 }
                 $settings['sortids']['value'][] = array($threadtype['typeid'], $threadtype['name']);
             }
         }
         $settings['sortids']['default'] = $defaultvalue;
     }
     return $settings;
 }
Ejemplo n.º 16
0
 public function forgotten_password($email)
 {
     $this->auth_model->get_by_email($email);
     if ($this->auth_model->exists()) {
         $new_password = mt_rand(100000, 999999);
         $user = $this->auth_model->all[0];
         $user->password = $new_password;
         $user->confirm_password = $new_password;
         if ($user->save()) {
             $CI =& ci_get_instance();
             $msg = new stdClass();
             $msg->subject = lang('auth_password_change_successful');
             $msg->body = array();
             $msg->body[] = lang('common_email') . ': ' . $email;
             $msg->body[] = lang('common_password') . ': ' . $new_password;
             $msg_id = $CI->hc_notifier->add_message($msg);
             $CI->hc_notifier->enqueue_message($msg_id, $user);
             return TRUE;
         } else {
             $this->error = $this->auth_model->string;
             return FALSE;
         }
     } else {
         $this->error = lang('auth_forgot_password_unsuccessful') . ': ' . $email . ' Not Found';
         return FALSE;
     }
 }
Ejemplo n.º 17
0
 public function index()
 {
     $this->template->registerMeta("ROBOTS", "NOINDEX, NOFOLLOW");
     $this->core->set_meta_tags(lang('Feedback', 'feedback'));
     $this->load->library('form_validation');
     // Create captcha
     $this->dx_auth->captcha();
     $tpl_data['cap_image'] = $this->dx_auth->get_captcha_image();
     $this->template->add_array($tpl_data);
     if (count($_POST) > 0) {
         $this->form_validation->set_rules('name', lang('Your name', 'feedback'), 'trim|required|min_length[3]|max_length[' . $this->username_max_len . ']|xss_clean');
         $this->form_validation->set_rules('email', lang('Email', 'feedback'), 'trim|required|valid_email|xss_clean');
         $this->form_validation->set_rules('theme', lang('Subject', 'feedback'), 'trim|required|max_length[' . $this->theme_max_len . ']|xss_clean');
         $this->form_validation->set_rules('message', lang('Message', 'feedback'), 'trim|required|max_length[' . $this->message_max_len . ']|xss_clean');
         if ($this->dx_auth->use_recaptcha) {
             $this->form_validation->set_rules('recaptcha_response_field', lang("Protection code", 'feedback'), 'trim|xss_clean|required|callback_recaptcha_check');
         } else {
             $this->form_validation->set_rules('captcha', lang("Protection code", 'feedback'), 'trim|required|xss_clean|callback_captcha_check');
         }
         if ($this->form_validation->run($this) == FALSE) {
             // there are errors
             $this->form_validation->set_error_delimiters("", "");
             CMSFactory\assetManager::create()->setData('validation', $this->form_validation);
         } else {
             // form is validate
             $this->message = strip_tags(nl2br(lang('Theme', 'feedback') . ' : ' . $this->input->post('theme') . lang('Name', 'feedback') . ' : ' . $this->input->post('name') . lang('E-mail', 'feedback') . ' : ' . $this->input->post('email') . lang('Message', 'feedback') . ' : ' . $this->input->post('message')));
             $this->_send_message();
         }
     }
     CMSFactory\assetManager::create()->render('feedback');
 }
Ejemplo n.º 18
0
 public function getDataColumns()
 {
     $return = array();
     $return['summary'] = array();
     $return['summary'][] = array('data' => lang('reports_no'), 'align' => 'left');
     $return['summary'][] = array('data' => lang('reports_customer'), 'align' => 'left');
     $return['summary'][] = array('data' => lang('pawns_amount'), 'align' => 'right');
     $return['summary'][] = array('data' => lang('pawns_pay_amount'), 'align' => 'right');
     $return['summary'][] = array('data' => lang('pawns_amount_due'), 'align' => 'right');
     //$return['summary'][] = array('data'=>lang('pawns_deposit'), 'align'=> 'right');
     $return['summary'][] = array('data' => lang('pawns_rate_no_percent'), 'align' => 'right');
     //$return['summary'][] = array('data'=>lang('pawns_pay_rate'), 'align'=> 'right');
     $return['summary'][] = array('data' => lang('pawns_pay_rate'), 'align' => 'right');
     if ($this->Employee->has_module_action_permission('reports', 'show_profit', $this->Employee->get_logged_in_employee_info()->person_id)) {
         $return['summary'][] = array('data' => lang('reports_profit'), 'align' => 'right');
     }
     $return['details'] = array();
     $return['details'][] = array('data' => lang('reports_no'), 'align' => 'left');
     $return['details'][] = array('data' => lang('reports_date'), 'align' => 'left');
     $return['details'][] = array('data' => lang('pawns_amount'), 'align' => 'right');
     $return['details'][] = array('data' => lang('pawns_pay_amount'), 'align' => 'right');
     $return['details'][] = array('data' => lang('pawns_amount_due'), 'align' => 'right');
     //$return['details'][] = array('data'=>lang('pawns_deposit'), 'align'=> 'right');
     $return['details'][] = array('data' => lang('pawns_rate'), 'align' => 'right');
     $return['details'][] = array('data' => lang('pawns_pay_rate'), 'align' => 'right');
     $return['details'][] = array('data' => lang('pawns_number_of_day_late'), 'align' => 'right');
     $return['details'][] = array('data' => lang('pawns_fine'), 'align' => 'right');
     if ($this->Employee->has_module_action_permission('reports', 'show_profit', $this->Employee->get_logged_in_employee_info()->person_id)) {
         $return['details'][] = array('data' => lang('reports_profit'), 'align' => 'right');
     }
     return $return;
 }
 function index()
 {
     if ($this->request->isAsyncCall()) {
         $my_pub_key = ConfigOptions::getValue('frosso_auth_my_pub_key', false);
         $my_pri_key = ConfigOptions::getValue('frosso_auth_my_pri_key', false);
         $token = ConfigOptions::getValue('frosso_auth_my_pri_token', false);
         $this->smarty->assign(array('my_pub_key' => $my_pub_key, 'my_pri_key' => $my_pri_key, 'token' => $token));
         if ($this->request->isSubmitted()) {
             $my_pub_sub = $this->request->post('my_pub_key');
             $my_pri_sub = $this->request->post('my_pri_key');
             $sub_token = $this->request->post('token');
             if ($sub_token) {
                 if (FrossoAuthModel::isValidKey($my_pub_sub, $my_pri_sub)) {
                     ConfigOptions::setValue('frosso_auth_my_pub_key', $my_pub_sub);
                     ConfigOptions::setValue('frosso_auth_my_pri_key', $my_pri_sub);
                     ConfigOptions::setValue('frosso_auth_my_pri_token', $sub_token);
                     $my_pub_key = $my_pub_sub;
                     $my_pri_key = $my_pri_sub;
                     $this->response->ok();
                 } else {
                     $this->response->exception(new ValidationErrors(array('my_pub_key' => lang("Public key and private key must be valid"))));
                 }
             } else {
                 $this->response->exception(new ValidationErrors(array('token' => lang("Token must be valid"))));
             }
         }
         // isSubmitted
     } else {
         $this->response->badRequest();
     }
     // if
 }
Ejemplo n.º 20
0
 public function newTemplateMsg($template, $additionalHooks)
 {
     global $mail_templates_dir, $debug_mode;
     $this->contents = file_get_contents($mail_templates_dir . $template);
     //Check to see we can access the file / it has some contents
     if (!$this->contents || empty($this->contents)) {
         if ($debug_mode) {
             if (!$this->contents) {
                 echo lang("MAIL_TEMPLATE_DIRECTORY_ERROR", array(getenv("DOCUMENT_ROOT")));
                 die;
             } else {
                 if (empty($this->contents)) {
                     echo lang("MAIL_TEMPLATE_FILE_EMPTY");
                     die;
                 }
             }
         }
         return false;
     } else {
         //Replace default hooks
         $this->contents = replaceDefaultHook($this->contents);
         //Replace defined / custom hooks
         $this->contents = str_replace($additionalHooks["searchStrs"], $additionalHooks["subjectStrs"], $this->contents);
         //Do we need to include an email footer?
         //Try and find the #INC-FOOTER hook
         if (strpos($this->contents, "#INC-FOOTER#") !== FALSE) {
             $footer = file_get_contents($mail_templates_dir . "email-footer.html");
             if ($footer && !empty($footer)) {
                 $this->contents .= replaceDefaultHook($footer);
             }
             $this->contents = str_replace("#INC-FOOTER#", "", $this->contents);
         }
         return true;
     }
 }
Ejemplo n.º 21
0
 /**
  * Return all project files that were automatically checked out (on edit) by the user
  *
  * @param User $user 
  * @return array
  */
 static function closeAutoCheckedoutFilesByUser($user = null)
 {
     if (!$user) {
         $user = logged_user();
     }
     try {
         $condstr = 'checked_out_by_id = ' . $user->getId() . ' AND was_auto_checked_out = 1 AND checked_out_on <> \'' . EMPTY_DATETIME . '\'';
         $files = self::findAll(array('conditions' => $condstr));
         // findAll
         if ($files) {
             foreach ($files as $file) {
                 $file->setWasAutoCheckedAuto($autoCheckOut);
                 $file->setCheckedOutById(0);
                 $file->setCheckedOutOn(EMPTY_DATETIME);
                 $file->setMarkTimestamps(false);
                 $file->save();
             }
             return true;
         }
         return false;
     } catch (Exception $exc) {
         flash_error(lang('error checkin file'));
         return false;
     }
 }
Ejemplo n.º 22
0
    function printfooter($dbstats = null)
    {
        ?>
  <div id="site_admin_nav">
   <div id="site_admin_nav_upper">
    <div id="site_admin_nav_upper_linkbar">
<?php 
        echo $this->get_menu(1);
        ?>
    </div>
   </div>
   <div id="site_admin_nav_lower">
    <div id="site_admin_nav_lower_infobar">
     <span id="site_admin_nav_lower_infobar_pending">
<?php 
        echo lang('pending_quotes') . ": " . $dbstats['pending_quotes'] . ";\n";
        ?>
     </span>
     <span id="site_admin_nav_lower_infobar_approved">
<?php 
        echo lang('approved_quotes') . ": " . $dbstats['approved_quotes'] . "\n";
        ?>
     </span>
    </div>
   </div>
  </div>
 </div>
</body>
</html>
<?php 
    }
Ejemplo n.º 23
0
 public function global_cpnav_extra1()
 {
     $custom_zone = getcookie('bacy_gmt_cz');
     if (!$custom_zone) {
         $custom_zone = 8;
     }
     $data = lang('home/template', 'timezone');
     $command_str = "\$timezone=array({$data});";
     eval($command_str);
     $gmt = '<script type="text/javascript" src="./source/plugin/bacy_gmt/gmt.js" ></script>';
     $gmt .= '<a id="bacy_gmt" href="javascript:;" style="text-decoration:none;" onmouseover="delayShow(this, function(){showMenu({\'ctrlid\':\'bacy_gmt\',\'pos\':\'43!\',\'duration\':\'3\'})});"></a>';
     $gmt .= '<table id="bacy_gmt_menu" class="p_pop" style="display:none;">';
     $gmt .= '<tr><td><div class="y"><a href="plugin.php?id=bacy_gmt:gmt&act=aboutme" onclick="showWindow(\'gmt_aboutme\',this.href);return false;">[About Me]</a><a href="javascript:;" onclick="hideMenu(\'bacy_gmt_menu\');">[X]</a></div><strong>' . lang('plugin/bacy_gmt', 'info') . '</strong></td></tr>';
     $gmt .= '<tr><td><select id="bacy_gmt_timeoffset" onchange="hideMenu(\'bacy_gmt_menu\'),setcookie(\'bacy_gmt_cz\',this.value,86400 * 30);startGmtClock();">';
     foreach ($timezone as $key => $desc) {
         if ($key < 9999) {
             if ($key == $custom_zone) {
                 $gmt .= '<option value="' . $key . '" selected >' . $desc . '</option>';
             } else {
                 $gmt .= '<option value="' . $key . '" >' . $desc . '</option>';
             }
         }
     }
     $gmt .= '</select></td></tr><tr><td></td></tr>';
     $gmt .= '</table>';
     $gmt .= '<script type="text/javascript">startGmtClock()</script>';
     return $gmt;
 }
Ejemplo n.º 24
0
    public function all()
    {
        global $_FANWE;
        $is_best = false;
        $is_all = true;
        $_FANWE['nav_title'] = lang('common', 'daren');
        $count = FDB::resultFirst('SELECT COUNT(uid) FROM ' . FDB::table('user_daren') . ' WHERE status = 1');
        $pager = buildPage('daren/all', array(), $count, $_FANWE['page'], 18);
        $col = 3;
        $index = 0;
        $list = array();
        $today_time = getTodayTime();
        $sql = 'SELECT ud.*,u.user_name,u.server_code,uc.fans,uc.goods,uc.shares,
			up.reside_province,up.reside_city,up.introduce 
			FROM ' . FDB::table('user_daren') . ' AS ud 
			INNER JOIN ' . FDB::table('user') . ' AS u ON u.uid = ud.uid 
			INNER JOIN ' . FDB::table('user_count') . ' AS uc ON uc.uid = u.uid 
			INNER JOIN ' . FDB::table('user_profile') . ' AS up ON up.uid = ud.uid 
			WHERE ud.status = 1 
			ORDER BY ud.day_time DESC,ud.id DESC LIMIT ' . $pager['limit'];
        $res = FDB::query($sql);
        while ($data = FDB::fetch($res)) {
            $data['today_best'] = false;
            $data['url'] = FU('u/index', array('uid' => $data['uid']));
            $province = $_FANWE['cache']['citys']['all'][$data['reside_province']]['name'];
            $city = $_FANWE['cache']['citys']['all'][$data['reside_city']]['name'];
            $data['city'] = $province . '&nbsp;' . $city;
            $list[$index % $col][] = $data;
            $index++;
        }
        include template('page/daren');
        display();
    }
Ejemplo n.º 25
0
function fieldlist($fname, $field = array(), $mode = 'ch')
{
    global $datatypearr, $chid, $mchid, $matid;
    if ($mode == 'ch') {
        echo "<tr class=\"txt\">\n" . "<td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$fname}]\" value=\"{$fname}\"" . (!empty($field['mcommon']) || !empty($field['issystem']) ? ' disabled' : '') . "></td>\n" . "<td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"fieldsnew[{$fname}][available]\" value=\"1\"" . ($field['available'] ? ' checked' : '') . (!empty($field['issystem']) ? ' disabled' : '') . "></td>\n" . "<td class=\"txtL\"><input type=\"text\" size=\"25\" name=\"fieldsnew[{$fname}][cname]\" value=\"" . mhtmlspecialchars($field['cname']) . "\"></td>\n" . "<td class=\"txtC w60\"><input class=\"checkbox\" type=\"checkbox\" name=\"fieldsnew[{$fname}][isadmin]\" value=\"1\"" . (!empty($field['issystem']) ? ' disabled' : '') . ($field['isadmin'] ? ' checked' : '') . "></td>\n" . "<td class=\"txtC w60\"><input type=\"text\" size=\"4\" name=\"fieldsnew[{$fname}][vieworder]\" value=\"{$field['vieworder']}\"></td>\n" . "<td class=\"txtC\">" . mhtmlspecialchars($fname) . "</td>\n" . "<td class=\"txtC w100\">" . $datatypearr[$field['datatype']] . "</td>\n" . "<td class=\"txtC w50\"><a href=\"?entry=channels&action=fielddetail&chid={$chid}&fieldename={$fname}\" onclick=\"return floatwin('open_fielddetail',this)\">" . lang('detail') . "</a></td>\n" . "</tr>";
    } elseif ($mode == 'fch') {
        echo "<tr class=\"txt\">\n" . "<td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$fname}]\" value=\"{$fname}\"" . (!empty($field['issystem']) ? ' disabled' : '') . "></td>\n" . "<td class=\"txtL\"><input type=\"text\" size=\"25\" name=\"fieldsnew[{$fname}][cname]\" value=\"" . mhtmlspecialchars($field['cname']) . "\"></td>\n" . "<td class=\"txtC w60\"><input class=\"checkbox\" type=\"checkbox\" name=\"fieldsnew[{$fname}][isadmin]\" value=\"1\"" . (!empty($field['issystem']) ? ' disabled' : '') . ($field['isadmin'] ? ' checked' : '') . "></td>\n" . "<td class=\"txtC w60\"><input type=\"text\" size=\"4\" name=\"fieldsnew[{$fname}][vieworder]\" value=\"{$field['vieworder']}\"></td>\n" . "<td class=\"txtC\">" . mhtmlspecialchars($fname) . "</td>\n" . "<td class=\"txtC w100\">" . $datatypearr[$field['datatype']] . "</td>\n" . "<td class=\"txtC w50\"><a href=\"?entry=fchannels&action=fielddetail&chid={$chid}&fieldename={$fname}\" onclick=\"return floatwin('open_fielddetail',this)\">" . lang('detail') . "</a></td>\n" . "</tr>";
    } elseif ($mode == 'init') {
        echo "<tr class=\"txt\">\n" . "<td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$fname}]\" value=\"{$fname}\"" . (empty($field['iscustom']) ? ' disabled' : '') . "></td>\n" . "<td class=\"txtL\"><input type=\"text\" size=\"25\" name=\"fieldsnew[{$fname}][cname]\" value=\"" . mhtmlspecialchars($field['cname']) . "\"></td>\n" . "<td class=\"txtC\">" . mhtmlspecialchars($fname) . "</td>\n" . "<td class=\"txtC w100\">" . $datatypearr[$field['datatype']] . "</td>\n" . "<td class=\"txtC w60\"><a href=\"?entry=channels&action=initfielddetail&fieldename={$fname}\" onclick=\"return floatwin('open_fielddetail',this)\">" . lang('detail') . "</a></td>\n" . "</tr>";
    } elseif ($mode == 'initm') {
        echo "<tr class=\"txt\">\n" . "<td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$fname}]\" value=\"{$fname}\"" . ($field['issystem'] ? ' disabled' : '') . "></td>\n" . "<td class=\"txtL\"><input type=\"text\" size=\"25\" name=\"fieldsnew[{$fname}][cname]\" value=\"" . mhtmlspecialchars($field['cname']) . "\"></td>\n" . "<td class=\"txtC\">" . mhtmlspecialchars($fname) . "</td>\n" . "<td class=\"txtC w100\">" . $datatypearr[$field['datatype']] . "</td>\n" . "<td class=\"txtC w60\">" . ($field['issystem'] ? lang('system') : "<a href=\"?entry=mchannels&action=initmfielddetail&fieldename={$fname}\" onclick=\"return floatwin('open_fielddetail',this)\">" . lang('detail') . "</a>") . "</td>\n" . "</tr>";
    } elseif ($mode == 'member') {
        echo "<tr class=\"txt\">\n" . "<td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$fname}]\" value=\"{$fname}\"" . ($field['mcommon'] ? ' disabled' : '') . "></td>\n" . "<td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"fieldsnew[{$fname}][available]\" value=\"1\"" . ($field['available'] ? ' checked' : '') . ($field['issystem'] ? ' disabled' : '') . "></td>\n" . "<td class=\"txtC\"><input type=\"text\" size=\"20\" name=\"fieldsnew[{$fname}][cname]\" value=\"" . mhtmlspecialchars($field['cname']) . "\"></td>\n" . "<td class=\"txtC\">" . mhtmlspecialchars($fname) . "</td>\n" . "<td class=\"txtC w60\"><input class=\"checkbox\" type=\"checkbox\" name=\"fieldsnew[{$fname}][isadmin]\" value=\"1\"" . (!empty($field['issystem']) ? ' disabled' : '') . ($field['isadmin'] ? ' checked' : '') . "></td>\n" . "<td class=\"txtC w60\"><input type=\"text\" size=\"4\" name=\"fieldsnew[{$fname}][vieworder]\" value=\"{$field['vieworder']}\"></td>\n" . "<td class=\"txtC w100\">" . $datatypearr[$field['datatype']] . "</td>\n" . "<td class=\"txtC w50\">" . ($field['issystem'] ? lang('system') : "<a href=\"?entry=mchannels&action=mfielddetail&mchid={$mchid}&fieldename={$fname}\" onclick=\"return floatwin('open_fielddetail',this)\">" . lang('detail') . "</a>") . "</td>\n" . "</tr>";
    } elseif ($mode == 'ca') {
        echo "<tr class=\"txt\">\n" . "<td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$fname}]\" value=\"{$fname}\"></td>\n" . "<td class=\"txtL\"><input type=\"text\" size=\"25\" name=\"fieldsnew[{$fname}][cname]\" value=\"" . mhtmlspecialchars($field['cname']) . "\"></td>\n" . "<td class=\"txtC w60\"><input type=\"text\" size=\"4\" name=\"fieldsnew[{$fname}][vieworder]\" value=\"{$field['vieworder']}\"></td>\n" . "<td class=\"txtC\">" . mhtmlspecialchars($fname) . "</td>\n" . "<td class=\"txtC w100\">" . $datatypearr[$field['datatype']] . "</td>\n" . "<td class=\"txtC w60\"><a href=\"?entry=catalogs&action=cafielddetail&fieldename={$fname}\" onclick=\"return floatwin('open_fielddetail',this)\">" . lang('detail') . "</a></td>\n" . "</tr>";
    } elseif ($mode == 'cc') {
        echo "<tr class=\"txt\">\n" . "<td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$fname}]\" value=\"{$fname}\"></td>\n" . "<td class=\"txtL\"><input type=\"text\" size=\"25\" name=\"fieldsnew[{$fname}][cname]\" value=\"" . mhtmlspecialchars($field['cname']) . "\"></td>\n" . "<td class=\"txtC w60\"><input type=\"text\" size=\"4\" name=\"fieldsnew[{$fname}][vieworder]\" value=\"{$field['vieworder']}\"></td>\n" . "<td class=\"txtC\">" . mhtmlspecialchars($fname) . "</td>\n" . "<td class=\"txtC w100\">" . $datatypearr[$field['datatype']] . "</td>\n" . "<td class=\"txtC w60\"><a href=\"?entry=cotypes&action=ccfielddetail&fieldename={$fname}\" onclick=\"return floatwin('open_fielddetail',this)\">" . lang('detail') . "</a></td>\n" . "</tr>";
    } elseif ($mode == 'ma') {
        echo "<tr class=\"txt\">\n" . "<td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$fname}]\" value=\"{$fname}\"></td>\n" . "<td class=\"txtL\"><input type=\"text\" size=\"25\" name=\"fieldsnew[{$fname}][cname]\" value=\"" . mhtmlspecialchars($field['cname']) . "\"></td>\n" . "<td class=\"txtC\">" . mhtmlspecialchars($fname) . "</td>\n" . "<td class=\"txtC w60\"><input class=\"checkbox\" type=\"checkbox\" name=\"fieldsnew[{$fname}][isadmin]\" value=\"1\"" . (!empty($field['issystem']) ? ' disabled' : '') . ($field['isadmin'] ? ' checked' : '') . "></td>\n" . "<td class=\"txtC w60\"><input type=\"text\" size=\"4\" name=\"fieldsnew[{$fname}][vieworder]\" value=\"{$field['vieworder']}\"></td>\n" . "<td class=\"txtC w100\">" . $datatypearr[$field['datatype']] . "</td>\n" . "<td class=\"txtC w60\"><a href=\"?entry=matypes&action=fielddetail&matid={$matid}&fieldename={$fname}\" onclick=\"return floatwin('open_fielddetail',this)\">" . lang('detail') . "</a></td>\n" . "</tr>";
    } elseif (in_array($mode, array('p', 'o', 'r', 'c', 'b'))) {
        echo "<tr class=\"txt\">\n" . "<td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$fname}]\" value=\"{$fname}\"></td>\n" . "<td class=\"txtL\"><input type=\"text\" size=\"25\" name=\"fieldsnew[{$fname}][cname]\" value=\"" . mhtmlspecialchars($field['cname']) . "\"></td>\n" . "<td class=\"txtC w60\"><input class=\"checkbox\" type=\"checkbox\" name=\"fieldsnew[{$fname}][isadmin]\" value=\"1\"" . ($field['isadmin'] ? ' checked' : '') . "></td>\n" . "<td class=\"txtC w60\"><input type=\"text\" size=\"4\" name=\"fieldsnew[{$fname}][vieworder]\" value=\"{$field['vieworder']}\"></td>\n" . "<td class=\"txtC\">" . mhtmlspecialchars($fname) . "</td>\n" . "<td class=\"txtC w100\">" . $datatypearr[$field['datatype']] . "</td>\n" . "<td class=\"txtC w50\"><a href=\"?entry=cufields&action=" . $mode . "fielddetail&fieldename={$fname}\" onclick=\"return floatwin('open_fielddetail',this)\">" . lang('detail') . "</a></td>\n" . "</tr>";
    } elseif (in_array($mode, array('mf', 'ml', 'mc', 'mr', 'mb'))) {
        $nowarr = array('mf' => 1, 'ml' => 2, 'mc' => 3, 'mr' => 4, 'mb' => 5);
        echo "<tr class=\"txt\">\n" . "<td class=\"txtC w40\"><input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$fname}]\" value=\"{$fname}\"></td>\n" . "<td class=\"txtL\"><input type=\"text\" size=\"25\" name=\"fieldsnew[{$fname}][cname]\" value=\"" . mhtmlspecialchars($field['cname']) . "\"></td>\n" . "<td class=\"txtC w60\"><input class=\"checkbox\" type=\"checkbox\" name=\"fieldsnew[{$fname}][isadmin]\" value=\"1\"" . ($field['isadmin'] ? ' checked' : '') . "></td>\n" . "<td class=\"txtC w60\"><input type=\"text\" size=\"4\" name=\"fieldsnew[{$fname}][vieworder]\" value=\"{$field['vieworder']}\"></td>\n" . "<td class=\"txtC\">" . mhtmlspecialchars($fname) . "</td>\n" . "<td class=\"txtC w100\">" . $datatypearr[$field['datatype']] . "</td>\n" . "<td class=\"txtC w50\"><a href=\"?entry=mcufields&action=fielddetail&cu={$nowarr[$mode]}&fieldename={$fname}\" onclick=\"return floatwin('open_fielddetail',this)\">" . lang('detail') . "</a></td>\n" . "</tr>";
    }
}
Ejemplo n.º 26
0
 /**
  * @todo Document this please.
  */
 public function __construct()
 {
     parent::__construct();
     // Not logged in or not an admin and don't have permission to see files
     if (!$this->current_user or $this->current_user->group !== 'admin' and (!isset($this->permissions['files']) or !isset($this->permissions['files']['wysiwyg']))) {
         $this->load->language('files/files');
         show_error(lang('files:no_permissions'));
     }
     ci()->admin_theme = $this->theme_m->get_admin();
     // Using a bad slug? Weak
     if (empty($this->admin_theme->slug)) {
         show_error('This site has been set to use an admin theme that does not exist.');
     }
     // Make a constant as this is used in a lot of places
     defined('ADMIN_THEME') or define('ADMIN_THEME', $this->admin_theme->slug);
     // Set the location of assets
     Asset::add_path('module', APPPATH . 'modules/wysiwyg/');
     Asset::add_path('theme', $this->admin_theme->web_path . '/');
     Asset::set_path('theme');
     $this->load->library('files/files');
     $this->lang->load('files/files');
     $this->lang->load('wysiwyg');
     $this->lang->load('buttons');
     $this->template->set_theme(ADMIN_THEME)->set_layout('wysiwyg', 'admin')->enable_parser(false)->append_css('module::wysiwyg.css')->append_css('jquery/ui-lightness/jquery-ui.css')->append_js('jquery/jquery.js')->append_js('jquery/jquery-ui.min.js')->append_js('plugins.js')->append_js('module::wysiwyg.js');
 }
/**
 * on_time_report_footer_options event handler implementation
 *
 * @param TimeReport $report
 * @param array $options
 * @param Project $project
 * @param User $user
 * @return null
 */
function invoicing_handle_on_time_report_footer_options(&$report, &$options, &$project, &$user)
{
    if (Invoice::canAdd($user)) {
        $options[] = array('url' => instance_of($project, 'Project') ? assemble_url('invoices_add', array('time_report_id' => $report->getId(), 'project_id' => $project->getId())) : assemble_url('invoices_add', array('time_report_id' => $report->getId())), 'text' => lang('New Invoice'), 'icon' => get_image_url('create-invoice.gif', INVOICING_MODULE));
    }
    // if
}
Ejemplo n.º 28
0
 function common()
 {
     global $_G;
     if (!$_G['wechat']['setting']) {
         $_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']);
     }
     if ($_G['uid']) {
         if ($_G['wechat']['setting']['wechat_qrtype']) {
             $_G['wechatuser'] = C::t('#wechat#common_member_wechatmp')->fetch($_G['uid']);
             if ($_G['wechatuser'] && !$_G['wechatuser']['status']) {
                 $_G['wechatuser']['isregister'] = 1;
             }
         } else {
             $_G['wechatuser'] = C::t('#wechat#common_member_wechat')->fetch($_G['uid']);
         }
         if ($_G['wechatuser'] && $wechatuser['status'] == 1) {
             C::t('#wechat#common_member_wechat')->update($_G['uid'], array('status' => 0));
             require_once libfile('function/member');
             clearcookies();
         }
     }
     if (!$_G['uid'] && !defined('IN_MOBILE') && $_G['wechat']['setting']['wsq_allow']) {
         $_G['setting']['pluginhooks']['global_login_text'] .= wechat_tpl_login_bar();
     }
     $_G['Plang'] = $_G['setting']['wechatviewpluginid'] ? lang('plugin/' . $_G['setting']['wechatviewpluginid']) : array();
     if (!$_G['Plang'] || !$_G['wechatuser']) {
         unset($_G['setting']['plugins']['spacecp']['wechat:spacecp']);
     }
 }
Ejemplo n.º 29
0
function more_less_str($str)
{
    //    pre_print($str);
    $lines = explode('<br />', trim($str));
    $lessed = $lines[0];
    if (count($lines) >= 2) {
        $words = explode(' ', $lines[0]);
        if (count($words) > 30) {
            $arr = array_slice($words, 0, 40);
            $lessed = implode(' ', $arr);
        } else {
            $lessed = implode(' ', $words);
            $words2 = explode(' ', $lines[1]);
            if (count($words) + count($words2) >= 60) {
                $arr = array_slice($words2, 0, 20);
                $lessed .= '<br>' . implode(' ', $arr);
            } else {
                $lessed .= '<br>' . implode(' ', $words2);
            }
        }
    } else {
        $words = explode(' ', $lines[0]);
        if (count($words) > 54) {
            $arr = array_slice($words, 0, 40);
            $lessed = implode(' ', $arr);
        }
    }
    $lessed = count(explode(' ', trim($str))) <= count(explode(' ', trim($lessed))) ? $lessed : $lessed . '...<span class="see_more link">' . lang('global_more') . '</span>';
    return '<div class="lessed">' . $lessed . '</div>' . '<div class="mored"  style="display:none">' . implode('<br>', $lines) . ' <span class="see_less">...Less</span></div>';
    //    pre_print($lines);
}
Ejemplo n.º 30
0
 /**
  * 添加扩展模型
  * 
  * @param	array	$data
  * @return	string|TRUE
  */
 public function add($data)
 {
     if (!$data['name'] || !$data['table']) {
         return lang('238');
     }
     if (!preg_match('/^[a-z]+[a-z0-9_\\-]+$/i', $data['table']) || $this->link->where('table', $data['table'])->count_all_results($this->prefix)) {
         return lang('239');
     }
     $data['setting'] = dr_array2string($data['setting']);
     if ($this->link->insert($this->prefix, $data)) {
         $id = $this->link->insert_id();
         $name = 'Form_' . SITE_ID . '_' . $id;
         $file = FCPATH . 'omooo/controllers/admin/' . $name . '.php';
         if (!file_put_contents($file, '<?php' . PHP_EOL . PHP_EOL . 'require FCPATH.\'omooo/core/D_Form.php\';' . PHP_EOL . PHP_EOL . 'class ' . $name . ' extends D_Form {' . PHP_EOL . PHP_EOL . '	public function __construct() {' . PHP_EOL . '		parent::__construct();' . PHP_EOL . '	}' . PHP_EOL . PHP_EOL . '	public function add() {' . PHP_EOL . '		$this->_addc();' . PHP_EOL . '	}' . PHP_EOL . PHP_EOL . '	public function edit() {' . PHP_EOL . '		$this->_editc();' . PHP_EOL . '	}' . PHP_EOL . PHP_EOL . '	public function index() {' . PHP_EOL . '		$this->_listc();' . PHP_EOL . '	}' . PHP_EOL . PHP_EOL . '}')) {
             $this->db->where('id', $id)->delete($this->prefix);
             return dr_lang('243', '/omooo/controllers/admin/');
         }
         $file = FCPATH . 'omooo/controllers/' . $name . '.php';
         if (!file_put_contents($file, '<?php' . PHP_EOL . PHP_EOL . 'require FCPATH.\'omooo/core/D_Form.php\';' . PHP_EOL . PHP_EOL . 'class ' . $name . ' extends D_Form {' . PHP_EOL . PHP_EOL . '	public function __construct() {' . PHP_EOL . '		parent::__construct();' . PHP_EOL . '	}' . PHP_EOL . PHP_EOL . '	public function index() {' . PHP_EOL . '		$this->_post();' . PHP_EOL . '	}' . PHP_EOL . PHP_EOL . '}')) {
             $this->db->where('id', $id)->delete($this->prefix);
             return dr_lang('243', '/omooo/controllers/');
         }
         $sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS `" . $this->prefix . '_' . $data['table'] . "` (\n\t\t\t  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t  `title` varchar(255) DEFAULT NULL COMMENT '主题',\n\t\t\t  `inputip` varchar(30) DEFAULT NULL COMMENT '录入者ip',\n\t\t\t  `inputtime` int(10) unsigned NOT NULL COMMENT '录入时间',\n\t\t\t  `displayorder` tinyint(3) NOT NULL DEFAULT '0',\n\t\t\t  PRIMARY KEY `id` (`id`),\n\t\t\t  KEY `inputtime` (`inputtime`),\n\t\t\t  KEY `displayorder` (`displayorder`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='" . $data['name'] . "表单表';";
         $this->link->query($sql);
         $this->db->insert('field', array('name' => '主题', 'fieldname' => 'title', 'fieldtype' => 'Text', 'relatedid' => $id, 'relatedname' => 'form-' . SITE_ID, 'isedit' => 1, 'ismain' => 1, 'ismember' => 1, 'issystem' => 1, 'issearch' => 1, 'disabled' => 0, 'setting' => dr_array2string(array('option' => array('width' => 400, 'fieldtype' => 'VARCHAR', 'fieldlength' => '255'), 'validate' => array('xss' => 1, 'required' => 1))), 'displayorder' => 0));
     }
     return TRUE;
 }