예제 #1
0
    public function handle_hook($hook_name)
    {
        if ($hook_name == 'top_menu_end' && module_config::c('timer_enabled', 1) && module_security::is_logged_in() && self::can_i('view', 'Task Timer') && get_display_mode() != 'mobile') {
            ?>

            <li id="timer_menu_button">
                <div id="timer_menu_options">
                    <div class="timer_title">
                        <?php 
            _e('Active Timers');
            ?>

                    </div>
                    <ul id="active_timer_list">
                    </ul>
                </div>
                <a href="#" onclick="return false;" title="<?php 
            _e('Timer');
            ?>
"><span><?php 
            _e('Timers');
            ?>
<span class="menu_label" id="current_timer_count">1</span></span></a>
            </li>
            <?php 
        }
    }
예제 #2
0
 function init()
 {
     $this->module_name = "language";
     $language_code = basename(module_config::c('default_language'));
     if (module_security::is_logged_in()) {
         $user = module_user::get_user(module_security::get_loggedin_id(), false);
         if ($user && $user['user_id'] && isset($user['language']) && $user['language']) {
             $language_code = basename($user['language']);
         }
     }
     // language code, like en, gb, etc..
     self::set_ui_language($language_code);
 }
예제 #3
0
 public function pre_menu()
 {
     if (self::is_plugin_enabled()) {
         if (module_security::has_feature_access(array('name' => 'Settings', 'module' => 'config', 'category' => 'Config', 'view' => 1, 'description' => 'view'))) {
             $this->links[] = array("name" => "Social", "p" => "social_settings", "args" => array('social_id' => false), 'holder_module' => 'config', 'holder_module_page' => 'config_admin', 'menu_include_parent' => 0);
         }
         if ($this->can_i('view', 'Social') && class_exists('ucm_twitter', false) && class_exists('ucm_facebook', false)) {
             $twitter = new ucm_twitter();
             $facebook = new ucm_facebook();
             $unread = $facebook->get_unread_count() + $twitter->get_unread_count();
             $this->links['social'] = array("name" => _l('Social') . ($unread > 0 ? " <span class='menu_label'>" . $unread . "</span>" : ''), "p" => "social_admin", 'icon_name' => 'comment-o');
         }
     }
 }
예제 #4
0
파일: help.php 프로젝트: sgh1986915/php-crm
 public function init()
 {
     $this->links = array();
     $this->help_types = array();
     $this->module_name = "help";
     $this->module_position = 16;
     $this->version = 2.11;
     //2.11 - 2014-04-05 - url help js
     //2.1 - 2014-03-14 - initial release of new help system
     if (module_help::is_plugin_enabled() && (module_config::c('help_only_for_admin', 1) && module_security::get_loggedin_id() == 1 || !module_config::c('help_only_for_admin', 1) && module_help::can_i('view', 'Help'))) {
         // hook for help icon in top bar
         hook_add('header_buttons', 'module_help::hook_filter_var_header_buttons');
         hook_add('header_print_js', 'module_help::header_print_js');
         module_config::register_js('help', 'help.js');
         if (module_config::can_i('view', 'Settings')) {
             $this->links[] = array("name" => "Help", "p" => "help_settings", 'holder_module' => 'config', 'holder_module_page' => 'config_admin', 'menu_include_parent' => 0);
         }
     }
 }
예제 #5
0
 public static function can_i($actions, $name = false, $category = false, $module = false)
 {
     $class_name = $module;
     if (!$module) {
         // php5.2 doesn't have get_called_class() :(
         if (function_exists('get_called_class')) {
             $class_name = get_called_class();
         } else {
             if (is_callable('self::get_class()')) {
                 eval('$class_name = self::get_class();');
             } else {
                 // doesn't work in php5.2
                 eval('$class_name = static::get_class();');
             }
         }
         if (!$class_name) {
             echo 'no class found - please upgrade to php5.3';
         }
     }
     if (!$name) {
         $name = ucwords(str_replace('_', ' ', str_replace('module_', '', $class_name)));
     }
     if (!$name) {
         return false;
     }
     if (!$category) {
         $category = ucwords(str_replace('_', ' ', str_replace('module_', '', $class_name)));
     }
     $perms = array('name' => $name, 'module' => str_replace('module_', '', $class_name), 'category' => $category, 'description' => 'Permissions');
     if (!is_array($actions)) {
         $actions = array($actions);
     }
     foreach ($actions as $action) {
         $perms[$action] = 1;
     }
     return module_security::has_feature_access($perms);
 }
예제 #6
0
파일: map.php 프로젝트: sgh1986915/php-crm
 public function init()
 {
     $this->links = array();
     $this->map_types = array();
     $this->module_name = "map";
     $this->module_position = 14;
     $this->version = 2.21;
     //2.21 - 2015-09-10 - map marker fix
     //2.2 - 2015-09-09 - map marker fix
     //2.1 - 2015-06-10 - initial release
     // the link within Admin > Settings > Maps.
     if (module_security::has_feature_access(array('name' => 'Settings', 'module' => 'config', 'category' => 'Config', 'view' => 1, 'description' => 'view'))) {
         $this->links[] = array("name" => "Maps", "p" => "map_settings", 'holder_module' => 'config', 'holder_module_page' => 'config_admin', 'menu_include_parent' => 0);
     }
     if ($this->can_i('view', 'Maps') && module_config::c('enable_customer_maps', 1) && module_map::is_plugin_enabled()) {
         // only display if a customer has been created.
         if (isset($_REQUEST['customer_id']) && $_REQUEST['customer_id'] && $_REQUEST['customer_id'] != 'new') {
             // how many maps?
             $name = 'Maps';
             $this->links[] = array("name" => $name, "p" => "map_admin", 'args' => array('map_id' => false), 'holder_module' => 'customer', 'holder_module_page' => 'customer_admin_open', 'menu_include_parent' => 0, 'icon_name' => 'globe');
         }
         $this->links[] = array("name" => 'Maps', "p" => "map_admin", 'args' => array('map_id' => false), 'icon_name' => 'globe');
     }
 }
$widget_id = (int) $_REQUEST['widget_id'];
$widget = module_widget::get_widget($widget_id);
if ($widget_id > 0 && $widget['widget_id'] == $widget_id) {
    $module->page_title = 'Widget' . ': ' . $widget['name'];
} else {
    $module->page_title = 'Widget' . ': ' . _l('New');
}
if ($widget_id > 0 && $widget) {
    if (class_exists('module_security', false)) {
        module_security::check_page(array('module' => $module->module_name, 'feature' => 'edit'));
    }
} else {
    if (class_exists('module_security', false)) {
        module_security::check_page(array('module' => $module->module_name, 'feature' => 'create'));
    }
    module_security::sanatise_data('widget', $widget);
}
?>


	
<form action="" method="post">
	<input type="hidden" name="_process" value="save_widget" />
    <input type="hidden" name="widget_id" value="<?php 
echo $widget_id;
?>
" />


    <?php 
$fields = array('fields' => array('name' => 'Name'));
예제 #8
0
 public static function get_finance_summary($week_start, $week_end, $multiplyer = 1, $row_limit = 7)
 {
     $cache_key = 'finance_sum_' . md5(module_security::get_loggedin_id() . '_' . serialize(func_get_args()));
     $cache_timeout = module_config::c('cache_objects', 60);
     if ($cached_item = module_cache::get('finance', $cache_key)) {
         return $cached_item;
     }
     $base_href = module_finance::link_generate(false, array('full' => false, 'page' => 'dashboard_popup', 'arguments' => array('display_mode' => 'ajax')), array('foo'));
     $base_href .= '&';
     /*$base_href .= (strpos($base_href,'?')!==false) ? '&' : '?';
       $base_href .= 'display_mode=ajax&';
       $base_href .= 'home_page_stats=true&';*/
     // init structure:
     if ($multiplyer > 1) {
         $row_limit++;
     }
     for ($x = 0; $x < $row_limit; $x++) {
         //$time = strtotime("+$x days",strtotime($week_start));
         $time = strtotime("+" . $x * $multiplyer . " days", strtotime($week_start));
         $data[date("Ymd", $time)] = array("day" => $time, "hours" => 0, "amount" => 0, "amount_invoiced" => 0, "amount_paid" => 0, "amount_spent" => 0);
         if (class_exists('module_envato', false)) {
             $data[date("Ymd", $time)]['envato_earnings'] = 0;
         }
     }
     $data['total'] = array('day' => _l('Totals:'), 'week' => _l('Totals:'), 'hours' => 0, 'amount' => 0, 'amount_invoiced' => 0, 'amount_paid' => 0, 'amount_spent' => 0);
     if (class_exists('module_envato', false)) {
         $data['total']['envato_earnings'] = 0;
     }
     if (class_exists('module_job', false)) {
         module_debug::log(array('title' => 'Finance Dashboard Job', 'data' => ''));
         // find all task LOGS completed within these dayes
         $sql = "SELECT t.task_id, tl.date_created, t.hours AS task_hours, t.amount, tl.hours AS hours_logged, p.job_id, p.hourly_rate, t.date_done ";
         //            $sql .= " FROM `"._DB_PREFIX."task_log` tl ";
         //            $sql .= " LEFT JOIN `"._DB_PREFIX."task` t ON tl.task_id = t.task_id ";
         $sql .= " FROM `" . _DB_PREFIX . "task` t";
         $sql .= " LEFT JOIN `" . _DB_PREFIX . "task_log` tl ON t.task_id = tl.task_id ";
         $sql .= " LEFT JOIN `" . _DB_PREFIX . "job` p ON t.job_id = p.job_id";
         $sql .= " WHERE ( (tl.date_created >= '{$week_start}' AND tl.date_created < '{$week_end}') OR (t.fully_completed = 1 AND t.date_done >= '{$week_start}' AND t.date_done < '{$week_end}') )";
         $sql .= " AND t.job_id IN ( ";
         $valid_job_ids = module_job::get_valid_job_ids();
         if (count($valid_job_ids)) {
             foreach ($valid_job_ids as $valid_job_id) {
                 $sql .= (int) $valid_job_id['job_id'] . ", ";
             }
             $sql = rtrim($sql, ', ');
         } else {
             $sql .= ' NULL ';
         }
         $sql .= " ) ";
         //            echo $sql;
         $tasks = query($sql);
         $logged_tasks = array();
         while ($r = mysql_fetch_assoc($tasks)) {
             if (!$r['date_created']) {
                 $r['date_created'] = $r['date_done'];
             }
             if ($multiplyer > 1) {
                 $week_day = date('w', strtotime($r['date_created'])) - 1;
                 $r['date_created'] = date('Y-m-d', strtotime('-' . $week_day . ' days', strtotime($r['date_created'])));
             }
             $key = date("Ymd", strtotime($r['date_created']));
             if (!isset($data[$key])) {
                 // for some reason we're getting results here that shouldn't be in the list
                 // for now we just skip these results until I figure out why (only had 1 guy report this error, maybe misconfig)
                 continue;
             }
             // copied from dashboard_popup_hours_logged.php
             // needed get_tasks call to do the _JOB_TASK_ACCESS_ASSIGNED_ONLY permission check
             $jobtasks = module_job::get_tasks($r['job_id']);
             $task = isset($jobtasks[$r['task_id']]) ? $jobtasks[$r['task_id']] : false;
             if (!$task) {
                 continue;
             }
             if (!isset($task['manual_task_type']) || $task['manual_task_type'] < 0) {
                 $task['manual_task_type'] = $task['default_task_type'];
             }
             if (isset($r['hours_logged']) && $r['hours_logged'] > 0) {
                 if ($r['hours_logged'] == $task['completed']) {
                     // this listing is the only logged hours for this task.
                     if ($task['fully_completed']) {
                         // task complete, we show the final amount and hours.
                         if ($task['amount'] > 0) {
                             if ($task['manual_task_type'] == _TASK_TYPE_QTY_AMOUNT) {
                                 $display_amount = $task['amount'] * $task['hours'];
                             } else {
                                 $display_amount = $task['amount'];
                             }
                         } else {
                             $display_amount = $r['task_hours'] * $r['hourly_rate'];
                         }
                     } else {
                         // task isn't fully completed yet, just use hourly rate for now.
                         $display_amount = $r['hours_logged'] * $r['hourly_rate'];
                     }
                 } else {
                     // this is part of a bigger log of hours for this single task.
                     $display_amount = $r['hours_logged'] * $r['hourly_rate'];
                 }
                 $hours_logged = $r['task_hours'] > 0 ? $r['hours_logged'] : 0;
             } else {
                 // there are no logged hours for this particular task, but it is set to completed.
                 // we just assume it is completed on this day.
                 if ($task['amount'] > 0) {
                     if ($task['manual_task_type'] == _TASK_TYPE_QTY_AMOUNT) {
                         $display_amount = $task['amount'] * $task['hours'];
                     } else {
                         $display_amount = $task['amount'];
                     }
                 } else {
                     $display_amount = $r['task_hours'] * $r['hourly_rate'];
                 }
                 $hours_logged = $task['hours'];
             }
             $data[$key]['amount'] += $display_amount;
             $data['total']['amount'] += $display_amount;
             $data[$key]['hours'] += $hours_logged;
             $data['total']['hours'] += $hours_logged;
             /*$hourly_rate = $r['hourly_rate'];
               if($hours_logged > 0 && $r['amount'] > 0 && $hourly_rate > 0){
                   // there is a custom amount assigned to thsi task.
                   // only calculate this amount if the full hours is complete.
                   $hourly_rate = $r['amount'] / $r['task_hours'];
               }
               if($hours_logged > 0 && $hourly_rate > 0){
                   $data[$key]['amount'] += ($hours_logged * $hourly_rate);
                   $data['total']['amount'] += ($hours_logged * $hourly_rate);
               }*/
         }
     }
     module_debug::log(array('title' => 'Finance Dashboard Invoices', 'data' => ''));
     // find invoices sent this week.
     $sql = "SELECT i.* ";
     $sql .= " FROM `" . _DB_PREFIX . "invoice` i ";
     $sql .= " LEFT JOIN `" . _DB_PREFIX . "invoice_item` ii ON i.invoice_id = ii.invoice_id ";
     if (class_exists('module_job', false)) {
         $sql .= " LEFT JOIN `" . _DB_PREFIX . "task` t ON ii.task_id = t.task_id ";
         $sql .= " LEFT JOIN `" . _DB_PREFIX . "job` p ON t.job_id = p.job_id ";
     }
     $sql .= " WHERE (i.date_create >= '{$week_start}' AND i.date_create <= '{$week_end}')";
     $sql .= " GROUP BY i.invoice_id";
     // todo - sql in here to limit what they can see.
     $invoices = query($sql);
     // group invoices into days of the week.
     while ($invoice_data = mysql_fetch_assoc($invoices)) {
         //$invoice_data = module_invoice::get_invoice($i['invoice_id']);
         if ($invoice_data) {
             if ($multiplyer > 1) {
                 $week_day = date('w', strtotime($invoice_data['date_create'])) - 1;
                 $invoice_data['date_create'] = date('Y-m-d', strtotime('-' . $week_day . ' days', strtotime($invoice_data['date_create'])));
             }
             $key = date("Ymd", strtotime($invoice_data['date_create']));
             if (!isset($data[$key])) {
                 // for some reason we're getting results here that shouldn't be in the list
                 // for now we just skip these results until I figure out why (only had 1 guy report this error, maybe misconfig)
                 continue;
             }
             if (isset($data[$key])) {
                 $data[$key]['amount_invoiced'] += $invoice_data['c_total_amount'];
                 $data['total']['amount_invoiced'] += $invoice_data['c_total_amount'];
             }
         }
     }
     module_debug::log(array('title' => 'Finance Dashboard Finances', 'data' => ''));
     // find all payments made this week.
     // we also have to search for entries in the new "finance" table and make sure we dont double up here.
     $finance_records = module_finance::get_finances(array('date_from' => $week_start, 'date_to' => $week_end));
     foreach ($finance_records as $finance_record) {
         if (isset($finance_record['payment_type']) && ($finance_record['payment_type'] == _INVOICE_PAYMENT_TYPE_OVERPAYMENT_CREDIT || $finance_record['payment_type'] == _INVOICE_PAYMENT_TYPE_CREDIT)) {
             // CODE COPIED FROM FINANCE_LIST.PHP
             // dont add these ones to the totals on the dashboard
             continue;
         }
         if ($finance_record['credit'] > 0) {
             if ($multiplyer > 1) {
                 $week_day = date('w', strtotime($finance_record['transaction_date'])) - 1;
                 $finance_record['transaction_date'] = date('Y-m-d', strtotime('-' . $week_day . ' days', strtotime($finance_record['transaction_date'])));
             }
             $key = date("Ymd", strtotime($finance_record['transaction_date']));
             if (isset($data[$key])) {
                 $data[$key]['amount_paid'] += $finance_record['amount'];
                 $data['total']['amount_paid'] += $finance_record['amount'];
             }
         }
         if ($finance_record['debit'] > 0) {
             if ($multiplyer > 1) {
                 $week_day = date('w', strtotime($finance_record['transaction_date'])) - 1;
                 $finance_record['transaction_date'] = date('Y-m-d', strtotime('-' . $week_day . ' days', strtotime($finance_record['transaction_date'])));
             }
             $key = date("Ymd", strtotime($finance_record['transaction_date']));
             if (isset($data[$key])) {
                 $data[$key]['amount_spent'] += $finance_record['amount'];
                 $data['total']['amount_spent'] += $finance_record['amount'];
             }
         }
     }
     module_debug::log(array('title' => 'Finance Dashboard DONE!', 'data' => ''));
     /*$sql = "SELECT p.* ";
       $sql .= " FROM `"._DB_PREFIX."invoice_payment` p ";
       $sql .= " WHERE (p.date_paid >= '$week_start' AND p.date_paid <= '$week_end')";
       // todo - sql in here to limit what they can see.
       $payments = query($sql);
       // group invoices into days of the week.
       while($payment = mysql_fetch_assoc($payments)){
           //$invoice_data = module_invoice::get_invoice($i['invoice_id']);
           if($multiplyer > 1){
               $week_day = date('w',strtotime($payment['date_paid'])) - 1;
               $payment['date_paid'] = date('Y-m-d',strtotime('-'.$week_day.' days',strtotime($payment['date_paid'])));
           }
           $key = date("Ymd",strtotime($payment['date_paid']));
           if(isset($data[$key])){
               $data[$key]['amount_paid'] += $payment['amount'];
               $data['total']['amount_paid'] += $payment['amount'];
           }
       }*/
     if (class_exists('module_envato', false)) {
         $envato_currency = "USD";
         $envato = new envato_api();
         $local_currency = $envato->read_setting("local_currency", "AUD");
         $currency_convert_multiplier = $envato->currency_convert($envato_currency, $local_currency);
         // find summary of earnings between these dates in the envato statement.
         $week_start_time = strtotime($week_start);
         $week_end_time = strtotime($week_end);
         $sql = "SELECT * FROM `" . _DB_PREFIX . "envato_statement` s WHERE `time` >= '{$week_start_time}' AND `time` <= {$week_end_time}";
         $sql .= " AND ( `type` = 'sale' OR `type` = 'referral_cut' )";
         foreach (qa($sql) as $sale) {
             $sale_time = $sale['time'];
             if ($multiplyer > 1) {
                 $week_day = date('w', $sale_time) - 1;
                 $sale_time = strtotime('-' . $week_day . ' days', $sale_time);
             }
             $key = date("Ymd", $sale_time);
             if (!isset($data[$key])) {
                 continue;
             }
             $data[$key]['envato_earnings'] += round($currency_convert_multiplier * $sale['earnt'], 2);
             $data['total']['envato_earnings'] += round($currency_convert_multiplier * $sale['earnt'], 2);
             /*if($sale['type']=='sale'){
                   $sales_count++;
               }
               $sales_amount+= $sale['earnt'];*/
         }
     }
     if ($multiplyer > 1) {
         // dont want totals on previous weeks listing
         unset($data['total']);
     }
     foreach ($data as $data_id => $row) {
         //$row['amount'] = dollar($row['amount']);
         $row['chart_amount'] = $row['amount'];
         $row['amount'] = currency((int) $row['amount']);
         $row['chart_amount_invoiced'] = $row['amount_invoiced'];
         $row['amount_invoiced'] = currency((int) $row['amount_invoiced']);
         $row['chart_amount_paid'] = $row['amount_paid'];
         $row['amount_paid'] = currency((int) $row['amount_paid']);
         $row['chart_amount_spent'] = $row['amount_spent'];
         $row['amount_spent'] = currency((int) $row['amount_spent']);
         if (class_exists('module_envato', false)) {
             $row['chart_envato_earnings'] = $row['envato_earnings'];
             $row['envato_earnings'] = currency((int) $row['envato_earnings']);
         }
         // combine together
         $row['chart_hours'] = $row['hours'];
         $row['hours'] = sprintf('%s (%s)', $row['hours'], $row['amount']);
         if (is_numeric($row['day'])) {
             $time = $row['day'];
             $date = date('Y-m-d', $time);
             $row['date'] = $date;
             if ($multiplyer > 1) {
                 $date .= '|' . date('Y-m-d', strtotime('+' . $multiplyer . ' days', $time));
             }
             //$row['hours'] = '<a href="'.$base_href.'w=hours&date='.$date.'" class="summary_popup">'. _l('%s hours',$row['hours']) . '</a>';
             $row['hours_link'] = '<a href="' . $base_href . 'w=hours&date=' . $date . '" class="summary_popup">' . $row['hours'] . '</a>';
             $row['amount_link'] = '<a href="' . $base_href . 'w=hours&date=' . $date . '" class="summary_popup">' . $row['amount'] . '</a>';
             $row['amount_invoiced_link'] = '<a href="' . $base_href . 'w=amount_invoiced&date=' . $date . '" class="summary_popup">' . $row['amount_invoiced'] . '</a>';
             $row['amount_paid_link'] = '<a href="' . $base_href . 'w=amount_paid&date=' . $date . '" class="summary_popup">' . $row['amount_paid'] . '</a>';
             $row['amount_spent_link'] = '<a href="' . $base_href . 'w=amount_spent&date=' . $date . '" class="summary_popup">' . $row['amount_spent'] . '</a>';
             $row['day'] = _l(date('D', $time)) . ' ' . date('j', $time) . _l(date('S', $time));
             $row['week'] = _l(date('M', $time)) . ' ' . date('j', $time) . _l(date('S', $time));
             // if it's today.
             if ($time == strtotime(date("Y-m-d"))) {
                 $row['highlight'] = true;
             }
         } else {
         }
         $data[$data_id] = $row;
     }
     module_cache::put('finance', $cache_key, $data, $cache_timeout);
     return $data;
 }
예제 #9
0
파일: file.php 프로젝트: sgh1986915/php-crm
 public function has_viewed()
 {
     // close off any notifications here.
     if ($this->file_id > 0) {
         $sql = "UPDATE `" . _DB_PREFIX . "file_notification` SET `view_time` = '" . time() . "' WHERE `view_time` = 0 AND `user_id` = " . module_security::get_loggedin_id() . " AND file_id = " . (int) $this->file_id;
         query($sql);
     }
 }
예제 #10
0
 public function init()
 {
     $this->module_name = "config";
     $this->module_position = 40;
     $this->version = 2.416;
     //2.416 - 2015-06-07 - new settings button
     //2.415 - 2015-04-05 - stuck plugin update fix
     //2.414 - 2015-04-05 - character encoding fix
     //2.413 - 2015-03-14 - speed improvement
     //2.412 - 2015-02-08 - theme/custom override js file support
     //2.411 - 2015-01-20 - more speed improvements
     //2.41 - 2014-12-22 - ssl fix
     //2.4 - 2014-11-17 - much faster upgrade system
     //2.393 - 2014-11-04 - upgrade page improvement
     //2.392 - 2014-11-04 - upgrade page improvement
     //2.391 - 2014-10-07 - showing latest updates/blog posts in upgrade window.
     //2.39 - 2014-09-29 - faster update checking
     //2.389 - 2014-09-05 - improved config defaults
     //2.388 - 2014-08-12 - faster updates
     //2.387 - 2014-08-10 - fixed updater
     //2.386 - 2014-08-10 - fixed updater
     //2.385 - 2014-08-10 - progress showing in upgrader
     //2.384 - 2014-08-09 - bug fix for older jquery
     //2.383 - 2014-08-06 - better js handling
     //2.382 - 2014-07-25 - faster updates
     //2.381 - 2014-07-09 - js_combine / css_combine for much faster page loading
     //2.38 - 2014-07-05 - js_combine / css_combine for much faster page loading
     //2.379 - 2014-07-02 - js_combine / css_combine for much faster page loading
     //2.378 - 2014-03-12 - improved upgrader
     //2.377 - 2014-02-25 - improved installer
     //2.376 - 2013-11-13 - company config bug fix
     //2.375 - 2013-10-06 - software update reminder on dashboard
     //2.374 - 2013-10-05 - settings page improvement
     //2.373 - 2013-09-06 - installation improvement
     //2.372 - 2013-09-01 - fix for cache bug
     //2.371 - 2013-06-21 - different config vars per company
     //2.37 - 2013-04-30 - clearer upgrade instructions
     //2.31 - putting date_input to the general settings area
     //2.32 - friendly licence code names
     //2.33 - menu fix.
     //2.34 - js / css callbacks
     //2.35 - skipping custom files in the upgrade process
     //2.36 - permission fixes
     //2.361 - memory limit via config
     //2.362 - memory limit fix
     //2.363 - upload php limit fix
     //2.364 - php5/6 fix
     //2.365 - date format settings fix
     //2.366 - css/js updates
     //2.367 - css loading fix
     //2.368 - upgrade fixing
     //2.369 - click to edit config values
     // load some default configurations.
     if (!defined('_DATE_FORMAT')) {
         define('_DATE_FORMAT', module_config::c('date_format', 'd/m/Y'));
         // todo: read from database
     }
     if (!defined('_DATE_INPUT')) {
         // 1 = DD/MM/YYYY
         // 2 = YYYY/MM/DD
         // 3 = MM/DD/YYYY
         define('_DATE_INPUT', module_config::c('date_input', '1'));
     }
     if (!defined('_ERROR_EMAIL')) {
         define('_ERROR_EMAIL', module_config::c('admin_email_address', 'info@' . $_SERVER['HTTP_HOST']));
     }
     date_default_timezone_set(module_config::c('timezone', 'America/New_York'));
     if (module_security::is_logged_in() && isset($_POST['_config_settings_hook']) && $_POST['_config_settings_hook'] == 'save_config') {
         $this->_handle_save_settings_hook();
     }
     // try to set our memory limit.
     $desired_limit_r = module_config::c('php_memory_limit', '64M');
     $desired_limit = trim($desired_limit_r);
     $last = strtolower($desired_limit[strlen($desired_limit) - 1]);
     switch ($last) {
         // The 'G' modifier is available since PHP 5.1.0
         case 'g':
             $desired_limit *= 1024;
         case 'm':
             $desired_limit *= 1024;
         case 'k':
             $desired_limit *= 1024;
     }
     $memory_limit = ini_get('memory_limit');
     $val = trim($memory_limit);
     $last = strtolower($val[strlen($val) - 1]);
     switch ($last) {
         // The 'G' modifier is available since PHP 5.1.0
         case 'g':
             $val *= 1024;
         case 'm':
             $val *= 1024;
         case 'k':
             $val *= 1024;
     }
     if (!$memory_limit || $val < $desired_limit) {
         // try to increase to 64M
         if (!_DEMO_MODE) {
             @ini_set('memory_limit', $desired_limit_r);
         }
     }
     /*
             // try to set our post_max_size limit.
             $desired_limit_r = module_config::c('php_post_max_size','10M');
             $desired_limit = trim($desired_limit_r);
             $last = strtolower($desired_limit[strlen($desired_limit)-1]);
             switch($last) {
                 // The 'G' modifier is available since PHP 5.1.0
                 case 'g':
                     $desired_limit *= 1024;
                 case 'm':
                     $desired_limit *= 1024;
                 case 'k':
                     $desired_limit *= 1024;
             }
     
             $post_max_size_limit = ini_get('post_max_size');
             $val = trim($post_max_size_limit);
             $last = strtolower($val[strlen($val)-1]);
             switch($last) {
                 // The 'G' modifier is available since PHP 5.1.0
                 case 'g':
                     $val *= 1024;
                 case 'm':
                     $val *= 1024;
                 case 'k':
                     $val *= 1024;
             }
     
     
             if(!$post_max_size_limit || $val < $desired_limit){
                 // try to increase to 64M
                 if(!_DEMO_MODE){
                     @ini_set('post_max_size',$desired_limit_r);
                 }
             }*/
     self::register_js('config', 'settings.js');
 }
예제 #11
0
        $contact_type_permission = 'Vendor';
        $contact_module_name = 'vendor';
        break;
    default:
        die('Unsupported type');
}
$module->page_title = _l($contact_type_permission . ' Contacts');
if (!isset($search[$use_master_key]) || !$search[$use_master_key]) {
    // we are just showing a list of all customer contacts.
    $show_customer_details = true;
    // check they have permissions to view all customer contacts.
    if (class_exists('module_security', false)) {
        // if they are not allowed to "edit" a page, but the "view" permission exists
        // then we automatically grab the page and regex all the crap out of it that they are not allowed to change
        // eg: form elements, submit buttons, etc..
        module_security::check_page(array('category' => $contact_type, 'page_name' => 'All ' . $contact_type_permission . ' Contacts', 'module' => $contact_module_name, 'feature' => 'view'));
    }
    //throw new Exception('Please create a user correctly');
} else {
    $show_customer_details = false;
}
$users = module_user::get_contacts($search, true, false);
if (class_exists('module_group', false)) {
    module_group::enable_pagination_hook(array('fields' => array('owner_id' => 'user_id', 'owner_table' => 'user', 'name' => 'name', 'email' => 'email')));
}
// hack to add a "export" option to the pagination results.
if (class_exists('module_import_export', false) && module_user::can_i('view', 'Export ' . $contact_type_permission . ' Contacts')) {
    if (isset($_REQUEST['import_export_go'])) {
        $users = query_to_array($users);
        foreach ($users as $user_id => $user) {
            $users[$user_id]['is_primary'] = $user['is_primary'] == $user['user_id'] ? _l('Yes') : _l('No');
예제 #12
0
파일: data.php 프로젝트: sgh1986915/php-crm
    function get_form_element($element, $viewing_revision = false, $data_record = array())
    {
        $has_write_access = !$viewing_revision;
        // convert our data field to an element.
        $element['name'] = isset($element['name']) && !empty($element['name']) ? $element['name'] : 'data_field[' . $element['data_field_id'] . ']';
        $element['id'] = 'data_field_' . $element['data_field_id'] . '';
        $element['type'] = $element['field_type'];
        if (!isset($element['value'])) {
            $element['value'] = '';
        }
        if (!$has_write_access) {
            //$element['disabled'] = 'disabled';
            $element['class'] = 'data_field_view';
        }
        $highlight = false;
        $this->ajax_edit = false;
        $input_name = $element['name'];
        if (!$input_name) {
            return false;
        }
        if (isset($element['id']) && $element['id']) {
            $input_id = $element['id'];
        } else {
            $element['id'] = $input_name;
            $input_id = $input_name;
        }
        //if(!$value && isset($_REQUEST[$input_name]))$value = $_REQUEST[$input_name];
        if (!$element['value']) {
            $element['value'] = $element['default'];
        }
        if (!is_array($element['value'])) {
            //$value=htmlspecialchars($value);
        }
        if (!isset($element['class'])) {
            $element['class'] = '';
        }
        $attr = $attr_other = '';
        if ($has_write_access) {
            if ($element['type'] == 'radio' || $element['type'] == 'checkbox_list') {
                // hacky!
                if ($element['required']) {
                    $attr_other .= ' class="form_field form_field_required"';
                } else {
                    $attr_other .= ' class="form_field"';
                }
            } else {
                $element['class'] .= " form_field";
                if ($element['required']) {
                    $element['class'] .= " form_field_required";
                }
            }
            switch ($element['type']) {
                case 'date':
                    $element['class'] .= " date_field";
                    if (!isset($element['size']) || !$element['size']) {
                        $element['size'] = 8;
                    }
                    if (strtolower($element['value']) == 'now') {
                        $element['value'] = print_date(time());
                    }
                    break;
                case 'datetime':
                    $element['class'] .= " date_time_field";
                    if (!isset($element['size']) || !$element['size']) {
                        $element['size'] = 12;
                    }
                    if (strtolower($element['value']) == 'now') {
                        $element['value'] = print_date(time(), true);
                    }
                    break;
            }
        }
        switch ($element['type']) {
            case 'checkbox_list':
            case 'radio':
                $element['attributes'] = array();
                foreach (explode("\n", trim($element['field_data'])) as $line) {
                    $line = trim($line);
                    if (preg_match('/^attributes=/', $line)) {
                        $line = preg_replace('/^attributes=/', '', $line);
                        $element['attributes'] = explode("|", $line);
                        break;
                    }
                }
                break;
            case 'select':
                if (!isset($element['attributes']) || !is_array($element['attributes']) || !count($element['attributes'])) {
                    $element['attributes'] = array();
                    foreach (explode("\n", trim($element['field_data'])) as $line) {
                        $line = trim($line);
                        if (preg_match('/^attributes=/', $line)) {
                            $line = preg_replace('/^attributes=/', '', $line);
                            if (preg_match('#hook:([\\w_]+)$#', $line, $matches)) {
                                // see if we get anything back from this hook.
                                $attributes = array();
                                $attributes = hook_filter_var($matches[1], $attributes, $element);
                                if (is_array($attributes)) {
                                    $element['attributes'] = $attributes;
                                } else {
                                    $element['attributes'] = array('Unable to call hook: ' . $matches[1]);
                                }
                            } else {
                                $element['attributes'] = explode("|", $line);
                            }
                            break;
                        }
                    }
                }
                break;
        }
        if (!isset($element['style'])) {
            $element['style'] = '';
        }
        // we have to apply some custom width/height styles if they exist.
        $width = $height = false;
        foreach (explode("\n", trim($element['field_data'])) as $line) {
            $line = trim($line);
            if (preg_match('/^width=/', $line)) {
                $line = preg_replace('/^width=/', '', $line);
                $width = (int) $line;
            }
            if (preg_match('/^height=/', $line)) {
                $line = preg_replace('/^height=/', '', $line);
                $height = (int) $line;
            }
        }
        if (!$height && $height < _MIN_INPUT_HEIGHT) {
            $height = _MIN_INPUT_HEIGHT;
        }
        switch ($element['type']) {
            case 'text':
            case 'date':
            case 'datetime':
                if ($width) {
                    $element['style'] .= 'width:' . $width . 'px; ';
                }
                break;
            case 'radio':
                if ($width) {
                    $attr_other .= ' style="width:' . $width . 'px; "';
                }
                break;
            case 'textarea':
            case 'textbox':
                if ($width) {
                    $element['style'] .= 'width:' . $width . 'px; ';
                }
                if ($has_write_access && $height) {
                    $element['style'] .= 'height:' . $height . 'px; ';
                }
                break;
        }
        if (isset($element['width'])) {
            unset($element['width']);
        }
        if (isset($element['height'])) {
            unset($element['height']);
        }
        if (isset($element['multiple']) && $element['multiple']) {
            $element['multiple'] = true;
            // pass 'multiple' through to the UCM form builder which should handle everything
            $value_unserialize = @unserialize($element['value']);
            if (is_array($value_unserialize)) {
                $element['values'] = $value_unserialize;
                // 'values' is used in the UCM field generation tool
            }
            $element['name'] = $element['name'] . '[]';
        } else {
            $element['multiple'] = false;
        }
        if (!$has_write_access && $element['multiple'] && isset($element['values']) && is_array($element['values'])) {
            $element['value'] = $element['values'];
        }
        if (is_array($element['value']) && count($element['value'])) {
            $all_values = $element['value'];
        } else {
            $all_values = array($element['value']);
        }
        if ($element['type'] == 'checkbox_list') {
            $test = @unserialize($element['value']);
            if (is_array($test) && count($test)) {
                $all_values = array($test);
            } else {
                $all_values = array($element['value']);
            }
        }
        if ($element['type'] == "cancel" && !isset($element['onclick'])) {
            $element['onclick'] = "history.go(-1);";
        }
        if ($highlight) {
            $element['class'] .= " form_field_highlight";
        }
        /*if(!$has_write_access){
        			$element['class'] .= ' form_disabled';
        		}*/
        $attribute_keys = array('class', 'disabled', 'onclick', 'onfocus', 'onmouseup', 'onmousedown', 'onchange', 'size', 'cols', 'rows', 'width', 'style');
        foreach ($element as $key => $val) {
            if (!is_array($val) && !trim($val)) {
                continue;
            }
            if (in_array(strtolower($key), $attribute_keys)) {
                if (in_array(strtolower($key), array('size', 'cols', 'rows', 'width', 'height')) && (int) $val == 0) {
                    continue;
                }
                $attr .= ' ' . $key . '="' . $val . '"';
            }
        }
        // check for default values, these are cleared when submitting the form
        if ($element['default']) {
            $has_default = true;
        }
        $real_input_id = $input_id;
        $real_input_name = $input_name;
        ob_start();
        foreach ($all_values as $value_key => $value) {
            if (!$has_write_access) {
                // disabled.
                if (isset($width) && $width && $element['type'] != 'encrypted') {
                    echo '<span ' . $attr;
                    echo ' style="width:' . $width . 'px;"';
                    echo '>&nbsp;';
                }
                // display value differently depending on value type.
                switch ($element['type']) {
                    case 'checkbox_list':
                        $other = '';
                        if (is_array($value)) {
                            if (isset($value['other_val'])) {
                                $other = $value['other_val'];
                                unset($value['other_val']);
                            }
                            echo implode(', ', array_keys($value));
                        }
                        echo ' ' . $other;
                        break;
                    case 'select':
                        if (isset($element['attributes'])) {
                            $attributes = $element['attributes'];
                        } else {
                            $attributes = array();
                        }
                        if (isset($attributes[0])) {
                            $new_attributes = array();
                            foreach ($attributes as $aid => $a) {
                                $new_attributes[$aid + 1] = $a;
                            }
                            $attributes = $new_attributes;
                        }
                        if (isset($attributes[$value])) {
                            echo $attributes[$value];
                        }
                        break;
                    case 'textarea':
                    case 'textbox':
                        echo nl2br(htmlspecialchars($value));
                        break;
                    case 'file':
                        if ($value) {
                            $file_data = @unserialize($value);
                            $file_link = 'includes/plugin_data/upload/' . $file_data['file'];
                            if (is_file($file_link)) {
                                $download_link = self::link_public_file_download($data_record['data_record_id'], $data_record['data_type_id'], $element['data_field_group_id'], $element['data_field_id']);
                                echo '<a href="' . $download_link . '" target="_blank">' . $file_data['name'] . '</a>';
                            } else {
                                echo 'File Not Found';
                            }
                        }
                        break;
                    case 'wysiwyg':
                        echo module_security::purify_html($value);
                        break;
                    case 'encrypted':
                        if (class_exists('module_encrypt', false)) {
                            ob_start();
                            $element['type'] = 'text';
                            module_form::generate_form_element($element);
                            $enc_html = ob_get_clean();
                            echo module_encrypt::parse_html_input('custom_data', $enc_html, false);
                        }
                        break;
                    case 'created_date_time':
                        echo isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], true) : _l('N/A');
                        break;
                    case 'created_date':
                        echo isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], false) : _l('N/A');
                        break;
                    case 'created_time':
                        echo isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? date(module_config::c('time_format', 'g:ia'), strtotime($data_record['date_created'])) : _l('N/A');
                        break;
                    case 'updated_date_time':
                        echo isset($data_record['date_updated']) && $data_record['date_updated'] != '0000-00-00 00:00:00' ? print_date($data_record['date_updated'], true) : (isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], true) : _l('N/A'));
                        break;
                    case 'updated_date':
                        echo isset($data_record['date_updated']) && $data_record['date_updated'] != '0000-00-00 00:00:00' ? print_date($data_record['date_updated'], false) : (isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], false) : _l('N/A'));
                        break;
                    case 'updated_time':
                        echo isset($data_record['date_updated']) && $data_record['date_updated'] != '0000-00-00 00:00:00' ? date(module_config::c('time_format', 'g:ia'), strtotime($data_record['date_updated'])) : (isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? date(module_config::c('time_format', 'g:ia'), strtotime($data_record['date_created'])) : _l('N/A'));
                        break;
                    case 'created_by':
                        echo isset($data_record['create_user_id']) && (int) $data_record['create_user_id'] > 0 ? module_user::link_open($data_record['create_user_id'], true) : _l('N/A');
                        break;
                    case 'updated_by':
                        echo isset($data_record['update_user_id']) && (int) $data_record['update_user_id'] > 0 ? module_user::link_open($data_record['update_user_id'], true) : (isset($data_record['create_user_id']) && (int) $data_record['create_user_id'] > 0 ? module_user::link_open($data_record['create_user_id'], true) : _l('N/A'));
                        break;
                    case 'url':
                        echo '<a href="' . htmlspecialchars($value) . '" target="_blank">' . htmlspecialchars($value) . '</a>';
                        break;
                    default:
                        echo htmlspecialchars($value);
                        break;
                }
                if (isset($width) && $width && $element['type'] != 'encrypted') {
                    echo '&nbsp;</span>';
                }
            } else {
                // update for UCM: use the ucm form generator
                if (isset($element['default']) && $element['default'] && !$element['value']) {
                    $element['value'] = $element['default'];
                }
                switch ($element['type']) {
                    case 'wysiwyg':
                        $element['options']['inline'] = false;
                        module_form::generate_form_element($element);
                        break;
                    case "radio":
                        $has_val = false;
                        foreach ($element['attributes'] as $attribute) {
                            $this_input_id = $input_id . preg_replace('/[^a-zA-Z]/', '', $attribute);
                            ?>

                            <span class="field_radio">
                            <input type="radio" name="<?php 
                            echo $input_name;
                            ?>
" id="<?php 
                            echo $this_input_id;
                            ?>
" value="<?php 
                            echo htmlspecialchars($attribute);
                            ?>
"<?php 
                            if ($attribute == $value || strtolower($attribute) == 'other' && !$has_val) {
                                // assumes "OTHER" is always last... fix with a separate loop before hand checking all vals
                                if (strtolower($attribute) != 'other') {
                                    $has_val = true;
                                }
                                echo " checked";
                            }
                            echo ' ' . $attr;
                            if (strtolower($attribute) == 'other') {
                                echo ' onmouseup="if(this.checked)$(\'#other_' . $this_input_id . '\')[0].focus();"';
                                echo ' onchange="if(this.checked)$(\'#other_' . $this_input_id . '\')[0].focus();"';
                            }
                            ?>
>
                                <label for="<?php 
                            echo $this_input_id;
                            ?>
"><?php 
                            echo $attribute;
                            ?>
</label>
                                <?php 
                            if (strtolower($attribute) == 'other') {
                                ?>

                                    <span class="data_field_input">
                                    <input type="text" name="other_<?php 
                                echo $input_name;
                                ?>
" id="other_<?php 
                                echo $this_input_id;
                                ?>
" value="<?php 
                                if (!$has_val) {
                                    echo htmlspecialchars($value);
                                }
                                ?>
" onchange="$('input[type=radio]',$(this).parent())[0].checked = true;" <?php 
                                echo $attr . $attr_other;
                                ?>
>
                                    </span>
                                <?php 
                            }
                            ?>

                            </span>
                            <?php 
                        }
                        break;
                    case "checkbox_list":
                        $has_val = false;
                        if (!is_array($value)) {
                            $value = array();
                        }
                        foreach ($element['attributes'] as $attribute) {
                            $this_input_id = $input_id . preg_replace('/[^a-zA-Z]/', '', $attribute);
                            ?>

                            <span class="field_radio">
                            <input type="checkbox" name="<?php 
                            echo $input_name;
                            ?>
[<?php 
                            echo htmlspecialchars($attribute);
                            ?>
]" id="<?php 
                            echo $this_input_id;
                            ?>
" value="1"<?php 
                            if (isset($value[$attribute])) {
                                if (strtolower($attribute) != 'other') {
                                    $has_val = true;
                                }
                                echo " checked";
                            }
                            echo ' ' . $attr;
                            if (strtolower($attribute) == 'other') {
                                echo ' onmouseup="if(this.checked)$(\'#other_' . $this_input_id . '\')[0].focus();"';
                                echo ' onchange="if(this.checked)$(\'#other_' . $this_input_id . '\')[0].focus();"';
                            }
                            ?>
>
                                <label for="<?php 
                            echo $this_input_id;
                            ?>
"><?php 
                            echo $attribute;
                            ?>
</label>
                                <?php 
                            if (strtolower($attribute) == 'other') {
                                ?>

                                    <span class="data_field_input">
                                        <input type="text" name="<?php 
                                echo $input_name;
                                ?>
[other_val]" id="other_<?php 
                                echo $this_input_id;
                                ?>
" value="<?php 
                                echo isset($value['other_val']) ? htmlspecialchars($value['other_val']) : '';
                                ?>
" onchange="$('input[type=radio]',$(this).parent())[0].checked = true;" <?php 
                                echo $attr . $attr_other;
                                ?>
>
                                    </span>
                                <?php 
                            }
                            ?>

                            </span>
                            <?php 
                        }
                        break;
                    case "file":
                        $this->has_files = true;
                        ?>

                        <input type="file" name="<?php 
                        echo $input_name;
                        ?>
" id="<?php 
                        echo $input_id;
                        ?>
" value="<?php 
                        echo $value;
                        ?>
"<?php 
                        echo $attr;
                        ?>
>
                        <?php 
                        break;
                    case 'select':
                        $attributes = isset($element['attributes']) ? $element['attributes'] : array();
                        if (isset($attributes[0])) {
                            $new_attributes = array();
                            foreach ($attributes as $aid => $a) {
                                $new_attributes[$aid + 1] = $a;
                            }
                            $attributes = $new_attributes;
                        }
                        $element['options'] = $attributes;
                        module_form::generate_form_element($element);
                        break;
                    case 'encrypted':
                        if (class_exists('module_encrypt', false)) {
                            ob_start();
                            $element['type'] = 'text';
                            module_form::generate_form_element($element);
                            $enc_html = ob_get_clean();
                            echo module_encrypt::parse_html_input('custom_data', $enc_html);
                        }
                        break;
                    case 'created_date_time':
                        echo isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], true) : _l('N/A');
                        break;
                    case 'created_date':
                        echo isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], false) : _l('N/A');
                        break;
                    case 'created_time':
                        echo isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? date(module_config::c('time_format', 'g:ia'), strtotime($data_record['date_created'])) : _l('N/A');
                        break;
                    case 'updated_date_time':
                        echo isset($data_record['date_updated']) && $data_record['date_updated'] != '0000-00-00 00:00:00' ? print_date($data_record['date_updated'], true) : (isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], true) : _l('N/A'));
                        break;
                    case 'updated_date':
                        echo isset($data_record['date_updated']) && $data_record['date_updated'] != '0000-00-00 00:00:00' ? print_date($data_record['date_updated'], false) : (isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], false) : _l('N/A'));
                        break;
                    case 'updated_time':
                        echo isset($data_record['date_updated']) && $data_record['date_updated'] != '0000-00-00 00:00:00' ? date(module_config::c('time_format', 'g:ia'), strtotime($data_record['date_updated'])) : (isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? date(module_config::c('time_format', 'g:ia'), strtotime($data_record['date_created'])) : _l('N/A'));
                        break;
                    case 'created_by':
                        echo isset($data_record['create_user_id']) && (int) $data_record['create_user_id'] > 0 ? module_user::link_open($data_record['create_user_id'], true) : _l('N/A');
                        break;
                    case 'updated_by':
                        echo isset($data_record['update_user_id']) && (int) $data_record['update_user_id'] > 0 ? module_user::link_open($data_record['update_user_id'], true) : (isset($data_record['create_user_id']) && (int) $data_record['create_user_id'] > 0 ? module_user::link_open($data_record['create_user_id'], true) : _l('N/A'));
                        break;
                    case 'url':
                        $element['type'] = 'text';
                        module_form::generate_form_element($element);
                        break;
                    default:
                        module_form::generate_form_element($element);
                }
                if (isset($element['after_link']) && $element['after_link']) {
                    if (preg_match('/^https?:\\/\\//', $value) || ($have_www = preg_match('/^www\\./', $value) || ($have_www = preg_match('/\\.com/', $value) && !preg_match('/\\w@\\w/', $value)))) {
                        // we have a url
                        if ($have_www) {
                            $value = "http://" . $value;
                        }
                        ?>

						<a href="<?php 
                        echo $value;
                        ?>
" target="_blank">&raquo;</a>
						<?php 
                    }
                    if (preg_match('/\\w@\\w/', $value)) {
                        ?>

						<a href="mailto:<?php 
                        echo $value;
                        ?>
">&raquo;</a>
					<?php 
                    }
                }
            }
            // editable
            echo '&nbsp;';
        }
        // foreach all values
        //${$element_id} = ob_get_clean();
        // we just print the html for now
        return ob_get_clean();
    }
예제 #13
0
 * Copyright: dtbaker 2012
 * Licence: Please check CodeCanyon.net for licence details. 
 * More licence clarification available here:  http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ 
 * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
 * Package Date: 2015-11-25 02:55:20 
 * IP Address: 67.79.165.254
 */
/* <div data-role="footer">
		<h4>Footer content</h4>
	</div><!-- /footer --> */
?>

</div><!-- /page -->
<?php 
if (module_config::c('mobile_content_scroll', 1) && module_security::is_logged_in()) {
    ?>
<script type="text/javascript">
    var contentscroll = [];
    var content = null;
    window.addEventListener("resize", function() {
        // Get screen size (inner/outerWidth, inner/outerHeight)
//        var headerheight = 20;
//        $('div[data-role="header"]').each(function(){
//            headerheight+= $(this).height();
//        });
//        if(content != null)content.width(window.innerWidth-10).height(window.innerHeight-headerheight);
//        if(contentscroll != null)contentscroll.refresh();
        for (var i in contentscroll){
            if(typeof contentscroll[i] == 'object'){
                contentscroll[i].refresh();
예제 #14
0
            <div class="content_box_wheader" style="padding-bottom: 20px">
                <p>
                    <?php 
    _e('This ticket is not assigned to anyone.');
    ?>
<br/>
                    <?php 
    _e('If you are able to solve this ticket please assign it to yourself.');
    ?>

                </p>
                <input type="button" name="butt_assign_me" value="<?php 
    _e('Assign this ticket to me');
    ?>
" class="submit_button btn btn-success" onclick="$('#assigned_user_id').val(<?php 
    echo module_security::get_loggedin_id();
    ?>
); this.form.submit();">
	            <p>
		            <?php 
    _e('If you cannot solve this ticket please assign it to someone else in the drop down list.');
    ?>

	            </p>
            </div>
            <?php 
    $fieldset_data = array('heading' => array('title' => _l('Unassigned Ticket'), 'type' => 'h3'), 'elements_before' => ob_get_clean());
    echo module_form::generate_fieldset($fieldset_data);
    unset($fieldset_data);
}
/** TICKET MESSAGES */
예제 #15
0
<?php

/** 
 * Copyright: dtbaker 2012
 * Licence: Please check CodeCanyon.net for licence details. 
 * More licence clarification available here:  http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ 
 * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
 * Package Date: 2015-11-25 02:55:20 
 * IP Address: 67.79.165.254
 */
if (!_UCM_INSTALLED) {
    module_security::logout();
}
$setup_errors = false;
// see if we can write to a file, ext.php or design_menu.php
if (!touch(_UCM_FOLDER . 'cron.php') || !touch(_UCM_FOLDER . 'ext.php') || !touch(_UCM_FOLDER . 'design_menu.php')) {
    set_error('Sorry, the base folder <strong>' . _UCM_FOLDER . '</strong> is not writable by PHP. Please contact your hosting provider and ask for this folder to be set writable by PHP. Or change the permissions to writable (777 in most cases) using your FTP program.');
    $setup_errors = true;
}
// check folder permissions and the like.
$temp_folder = _UCM_FOLDER . "temp/";
if (!is_dir($temp_folder) || !is_writable($temp_folder)) {
    if ($temp_folder === false) {
        // doesn't exist.
        $temp_folder = '/temp/';
    }
    set_error('Sorry, the folder <strong>' . $temp_folder . '</strong> is not writable. Please contact your hosting provider and ask for this folder to be set writable by PHP. Or change the permissions to writable using your FTP program.');
    $setup_errors = true;
}
// check folder permissions and the like.
예제 #16
0
        ?>
" id="taxable_t_new">
                    <input type="hidden" name="job_task[new][manual_task_type]" value="-1" id="manual_task_type_new">
                </td>
            </tr>
            </tbody>
            <?php 
    }
    ?>

            <?php 
    $c = 0;
    $task_number = 0;
    foreach ($job_tasks as $task_id => $task_data) {
        $task_number++;
        if (module_security::is_page_editable() && module_job::can_i('edit', 'Job Tasks')) {
            ?>

                    <tbody id="task_edit_<?php 
            echo $task_id;
            ?>
" style="display:none;" class="task_edit"></tbody>
                <?php 
        } else {
            $task_editable = false;
        }
        echo module_job::generate_task_preview($job_id, $job, $task_id, $task_data, false, array('from_quote' => isset($_REQUEST['from_quote_id'])));
        ?>

                <input type="hidden" name="job_task[new<?php 
        echo $task_number;
예제 #17
0
} else {
    if ($invoice['date_paid'] && $invoice['date_paid'] != '0000-00-00') {
        $original_template_name = $template_name = $template_prefix . '_paid';
    } else {
        if ($invoice['overdue'] && $invoice['date_sent'] && $invoice['date_sent'] != '0000-00-00') {
            $original_template_name = $template_name = $template_prefix . '_overdue';
        } else {
            $original_template_name = $template_name = $template_prefix . '_due';
        }
    }
}
$template_name = isset($_REQUEST['template_name']) ? $_REQUEST['template_name'] : $template_name;
$template_name = hook_filter_var('invoice_email_template', $template_name, $invoice_id, $invoice);
$template = module_template::get_template_by_key($template_name);
$replace = module_invoice::get_replace_fields($invoice_id, $invoice);
$replace['from_name'] = module_security::get_loggedin_name();
// generate the PDF ready for sending.
$pdf = module_invoice::generate_pdf($invoice_id);
// find available "to" recipients.
// customer contacts.
$to_select = false;
$to = array();
if ($invoice['customer_id']) {
    $customer = module_customer::get_customer($invoice['customer_id']);
    $replace['customer_name'] = $customer['customer_name'];
    if ($invoice['user_id']) {
        $primary = module_user::get_user($invoice['user_id']);
        if ($primary) {
            $to_select = $primary['email'];
        }
    } else {
예제 #18
0
if (!module_config::can_i('edit', 'Settings')) {
    redirect_browser(_BASE_HREF);
}
$company_id = (int) $_REQUEST['company_id'];
$company = array();
if ($company_id > 0) {
    if (class_exists('module_security', false)) {
        module_security::check_page(array('category' => 'Company', 'page_name' => 'Company', 'module' => 'company', 'feature' => 'edit'));
    }
    $company = module_company::get_company($company_id);
} else {
}
if (!$company) {
    $company_id = 'new';
    $company = array('company_id' => 'new', 'name' => '');
    module_security::sanatise_data('company', $company);
}
?>

<form action="" method="post">

	<input type="hidden" name="_process" value="save_company" />
	<input type="hidden" name="company_id" value="<?php 
echo $company_id;
?>
" />

    <?php 
module_form::print_form_auth();
module_form::prevent_exit(array('valid_exits' => array('.submit_button')));
$fieldset_data = array('heading' => array('type' => 'h3', 'title' => 'Company Details'), 'elements' => array(array('title' => _l('Company Name'), 'field' => array('name' => 'name', 'value' => $company['name'], 'type' => 'text'))));
예제 #19
0
/** 
 * Copyright: dtbaker 2012
 * Licence: Please check CodeCanyon.net for licence details. 
 * More licence clarification available here:  http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ 
 * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
 * Package Date: 2015-11-25 02:55:20 
 * IP Address: 67.79.165.254
 */
if (!module_config::can_i('view', 'Settings') || !module_security::can_i('view', 'Security Roles', 'Security')) {
    redirect_browser(_BASE_HREF);
}
$search = isset($_REQUEST['search']) && is_array($_REQUEST['search']) ? $_REQUEST['search'] : array();
$roles = $module->get_roles($search);
$header = array('type' => 'h2', 'title' => _l('Security Roles'), 'main' => true, 'button' => array('title' => 'Add New Role', 'type' => 'add', 'url' => module_security::link_open_role('new')));
print_heading($header);
?>



<form action="" method="post">


<?php 
/** START TABLE LAYOUT **/
$table_manager = module_theme::new_table_manager();
$columns = array();
$columns['name'] = array('title' => 'Name', 'callback' => function ($role) use(&$module) {
    echo $module->link_open_role($role['security_role_id'], true);
}, 'cell_class' => 'row_action');
예제 #20
0
파일: ajax.php 프로젝트: sgh1986915/php-crm
<?php

/** 
 * Copyright: dtbaker 2012
 * Licence: Please check CodeCanyon.net for licence details. 
 * More licence clarification available here:  http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ 
 * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca, 0a3014a3-2b8f-460b-8850-d6025aa845f8
 * Package Date: 2015-11-25 03:08:17 
 * IP Address: 67.79.165.254
 */
$start_search_time = microtime(true);
$noredirect = true;
header('Content-Type: text/html; charset=UTF-8');
require_once 'init.php';
if (module_security::is_logged_in()) {
    if (!isset($_SESSION['previous_search'])) {
        $_SESSION['previous_search'] = array();
    }
    $search_text = isset($_REQUEST['ajax_search_text']) ? trim(urldecode($_REQUEST['ajax_search_text'])) : false;
    if ($search_text) {
        $search_results = array();
        foreach ($plugins as $plugin_name => &$plugin) {
            // we work out if we bother searching this plugin for results or not.
            if (strlen($search_text) > module_config::c('search_ajax_min_length', 2)) {
                if (isset($_SESSION['previous_search'][$plugin_name]) && $_SESSION['previous_search'][$plugin_name]['c'] == 0 && strlen($search_text) >= strlen($_SESSION['previous_search'][$plugin_name]['l']) && strpos($search_text, $_SESSION['previous_search'][$plugin_name]['l']) === 0) {
                    $_SESSION['previous_search'][$plugin_name]['l'] = $search_text;
                    // not really needed. but when you backspace a failed search it will force refresh all which might be good.
                    //$this_plugin_results=array('skipping ' . $search_text.' in '.$plugin_name.' last search was '.$_SESSION['previous_search'][$plugin_name]['l'],);
                    continue;
                } else {
예제 #21
0
    public static function display_extras($options)
    {
        $owner_id = isset($options['owner_id']) && $options['owner_id'] ? (int) $options['owner_id'] : false;
        $owner_table = isset($options['owner_table']) && $options['owner_table'] ? $options['owner_table'] : false;
        $layout = isset($options['layout']) && $options['layout'] ? $options['layout'] : false;
        $allow_new = true;
        if (isset($options['allow_new']) && !$options['allow_new']) {
            $allow_new = false;
        }
        $allow_edit = !isset($options['allow_edit']) || isset($options['allow_edit']) && $options['allow_edit'];
        if (!module_security::is_page_editable()) {
            $allow_edit = false;
        }
        // todo ^^ flow this permission check through to the "save" section.
        $html = '';
        if ($owner_table) {
            $default_fields = self::get_defaults($owner_table);
            // we have all that we need to display some extras!! yey!!
            if ($owner_id) {
                $extra_items = self::get_extras(array('owner_table' => $owner_table, 'owner_id' => $owner_id));
                $extra_items = self::sort_extras($extra_items, $default_fields);
            } else {
                $extra_items = array();
            }
            foreach ($extra_items as $extra_item) {
                $extra_id = $extra_item['extra_id'];
                $id = 'extra_' . preg_replace('#\\W+#', '_', $extra_item['extra_key']);
                ob_start();
                ?>

                <tr id="extra_<?php 
                echo $extra_id;
                ?>
">
                    <th <?php 
                if (module_config::can_i('edit', 'Settings') && self::can_i('edit', 'Extra Fields') && isset($default_fields[$extra_item['extra_key']]['field_type'])) {
                    echo ' data-settings-url="' . module_extra::link_open_extra_default($default_fields[$extra_item['extra_key']]['extra_default_id'], false) . '"';
                }
                ?>
>
                        <?php 
                if ($allow_edit) {
                    ?>

                            <span class="extra_field_key" onclick="$(this).hide(); $(this).parent().find('input').show();"><?php 
                    echo htmlspecialchars($extra_item['extra_key']);
                    ?>
</span>
                            <input type="text" name="extra_<?php 
                    echo $owner_table;
                    ?>
_field[<?php 
                    echo $extra_id;
                    ?>
][key]" value="<?php 
                    echo htmlspecialchars($extra_item['extra_key']);
                    ?>
" class="extra_field" style="display:none;">
                        <?php 
                } else {
                    echo htmlspecialchars($extra_item['extra_key']);
                    ?>

                            <input type="hidden" name="extra_<?php 
                    echo $owner_table;
                    ?>
_field[<?php 
                    echo $extra_id;
                    ?>
][key]" value="<?php 
                    echo htmlspecialchars($extra_item['extra_key']);
                    ?>
">
                        <?php 
                }
                ?>

                    </th>
                    <td>
                        <?php 
                if ($allow_edit) {
                    $field_type = 'text';
                    if (isset($default_fields[$extra_item['extra_key']]['field_type'])) {
                        $field_type = $default_fields[$extra_item['extra_key']]['field_type'];
                    }
                    if (!$field_type) {
                        $field_type = 'text';
                    }
                    $form_element = array('type' => $field_type, 'name' => 'extra_' . $owner_table . '_field[' . $extra_id . '][val]', 'value' => $extra_item['extra'], 'class' => 'extra_value_input', 'id' => $id);
                    if ($field_type == 'select') {
                        $form_element['options'] = array();
                        if (isset($default_fields[$extra_item['extra_key']]['options']) && is_array($default_fields[$extra_item['extra_key']]['options']) && isset($default_fields[$extra_item['extra_key']]['options']['select'])) {
                            foreach (explode("\n", $default_fields[$extra_item['extra_key']]['options']['select']) as $val) {
                                $val = trim($val);
                                if ($val === '') {
                                    continue;
                                }
                                $form_element['options'][$val] = $val;
                            }
                        }
                    }
                    module_form::generate_form_element($form_element);
                } else {
                    echo nl2br($extra_item['extra']);
                }
                /* <input type="text" name="extra_<?php echo $owner_table;?>_field[<?php echo $extra_id;?>][val]" id="<?php echo $id;?>" class="extra_value_input" value="<?php echo htmlspecialchars($extra_item['extra']);?>"> */
                ?>

                    </td>
                </tr>
                <?php 
                $html .= ob_get_clean();
            }
            if (module_security::is_page_editable() && $allow_new) {
                $extra_id = 'new';
                ob_start();
                // check if there are any "more" fields to add
                $more_fields_available = $allow_new;
                //if(!$more_fields_available){
                foreach ($default_fields as $default_id => $default) {
                    // check this key islany already existing.
                    foreach ($extra_items as $extra_item) {
                        if ($extra_item['extra_key'] == $default['key']) {
                            unset($default_fields[$default_id]);
                            continue 2;
                        }
                    }
                    $more_fields_available = true;
                }
                //}
                if ($more_fields_available) {
                    ?>

                    <tr id="extra_<?php 
                    echo $owner_table;
                    ?>
_options_<?php 
                    echo $extra_id;
                    ?>
" <?php 
                    if (!module_config::c('hide_extra', 1)) {
                        ?>
style="display:none;"<?php 
                    }
                    ?>
>
                        <th>

                        </th>
                        <td>
                            <a href="#" onclick="$('#extra_<?php 
                    echo $owner_table;
                    ?>
_options_<?php 
                    echo $extra_id;
                    ?>
').hide();$('#extra_<?php 
                    echo $owner_table;
                    ?>
_holder_<?php 
                    echo $extra_id;
                    ?>
').show(); return false;"><?php 
                    _e('more fields &raquo;');
                    ?>
</a>
                        </td>
                    </tr>
                <?php 
                }
                // more fields available
                ?>


                <?php 
                if (count($default_fields) || $allow_new) {
                    ?>

                    <tbody id="extra_<?php 
                    echo $owner_table;
                    ?>
_holder_<?php 
                    echo $extra_id;
                    ?>
" <?php 
                    if (module_config::c('hide_extra', 1)) {
                        ?>
style="display:none;"<?php 
                    }
                    ?>
>
                    <!-- show all other options here from this $owner_table -->
                    <?php 
                    $defaultid = 0;
                    foreach ($default_fields as $default) {
                        $defaultid++;
                        $id = 'extra_' . preg_replace('#\\W+#', '_', $default['key']);
                        ?>

                        <tr>
                            <th>

                                <?php 
                        if ($allow_edit) {
                            ?>

                                    <span class="extra_field_key" onclick="$(this).hide(); $(this).parent().find('input').show();"><?php 
                            echo htmlspecialchars($default['key']);
                            ?>
</span>
                                    <input type="text" name="extra_<?php 
                            echo $owner_table;
                            ?>
_field[new<?php 
                            echo $defaultid;
                            ?>
][key]" value="<?php 
                            echo htmlspecialchars($default['key']);
                            ?>
" class="extra_field" style="display:none;">
                                <?php 
                        } else {
                            echo htmlspecialchars($default['key']);
                            ?>

                                    <input type="hidden" name="extra_<?php 
                            echo $owner_table;
                            ?>
_field[new<?php 
                            echo $defaultid;
                            ?>
][key]" value="<?php 
                            echo htmlspecialchars($default['key']);
                            ?>
">
                                <?php 
                        }
                        ?>


                            </th>
                            <td>
                                <?php 
                        $field_type = $default['field_type'];
                        if (!$field_type) {
                            $field_type = 'text';
                        }
                        $form_element = array('type' => $field_type, 'name' => 'extra_' . $owner_table . '_field[new' . $defaultid . '][val]', 'value' => '', 'class' => 'extra_value_input', 'id' => $id);
                        if ($field_type == 'select') {
                            $form_element['options'] = array();
                            if (isset($default['options']) && is_array($default['options']) && isset($default['options']['select'])) {
                                foreach (explode("\n", $default['options']['select']) as $val) {
                                    $val = trim($val);
                                    if ($val === '') {
                                        continue;
                                    }
                                    $form_element['options'][$val] = $val;
                                }
                            }
                        }
                        module_form::generate_form_element($form_element);
                        /*<input type="text" name="extra_<?php echo $owner_table;?>_field[new<?php echo $defaultid;?>][val]" id="<?php echo $id;?>" value="<?php ?>">*/
                        ?>


                            </td>
                        </tr>
                    <?php 
                    }
                    ?>

                    <?php 
                    if ($allow_new) {
                        ?>

                        <tr id="extra_<?php 
                        echo $extra_id;
                        ?>
">
                            <th>
                                <input type="text" name="extra_<?php 
                        echo $owner_table;
                        ?>
_field[<?php 
                        echo $extra_id;
                        ?>
][key]" value="<?php 
                        ?>
" class="extra_field">
                            </th>
                            <td>
                                <input type="text" name="extra_<?php 
                        echo $owner_table;
                        ?>
_field[<?php 
                        echo $extra_id;
                        ?>
][val]" value="<?php 
                        ?>
">
                                <?php 
                        _h('Enter anything you like in this blank field. eg: Passwords, Links, Notes, etc..');
                        ?>

                            </td>
                        </tr>
                    <?php 
                    }
                    ?>

                    </tbody>
                <?php 
                }
                // defaults / allow new
                $html .= ob_get_clean();
            }
            // is page editable
        }
        // pass it out for a hook
        // this is really only used in the security module.
        if (function_exists('hook_filter_var')) {
            $html = hook_filter_var('extra_fields_output', $html, $owner_table, $owner_id);
        } else {
            $result = hook_handle_callback('extra_fields_output', $html, $owner_table, $owner_id);
            if ($result && count($result)) {
                foreach ($result as $r) {
                    $html = $r;
                    // bad. handle multiple hooks.
                }
            }
        }
        print $html;
    }
예제 #22
0
    die('failed');
}
if (!module_quote::can_i('edit', 'Quotes')) {
    die('no perms');
}
$quote_id = (int) $_REQUEST['quote_id'];
$quote = module_quote::get_quote($quote_id);
// template for sending emails.
// are we sending the paid one? or the dueone.
//$template_name = 'quote_email';
$template_name = isset($_REQUEST['template_name']) ? $_REQUEST['template_name'] : 'quote_email';
$template = module_template::get_template_by_key($template_name);
$quote['total_amount_print'] = dollar($quote['total_amount'], true, $quote['currency_id']);
$quote['total_amount_due_print'] = dollar($quote['total_amount_due'], true, $quote['currency_id']);
$quote['quote_name'] = $quote['name'];
$quote['from_name'] = module_security::get_loggedin_name();
$quote['quote_url'] = module_quote::link_public($quote_id);
ob_start();
include module_theme::include_ucm('includes/plugin_quote/template/quote_task_list.php');
$public_html = ob_get_clean();
$quote['task_list'] = $public_html;
/*ob_start();
$quote_data = $quote;
$ignore_task_hook=true;
$for_email=true;
include('quote_public.php');
$quote['quote_tasks'] = ob_get_clean();*/
// generate the PDF ready for sending.
$pdf = module_quote::generate_pdf($quote_id);
// find available "to" recipients.
// customer contacts.
예제 #23
0
                foreach ($details['log'] as $log) {
                    echo '<li>' . htmlspecialchars($log) . '</li>';
                }
                ?>

                                                    </ul>
                                                </div>
                                                <?php 
            }
        }
        ?>

                                    </td>
                                    <td align="center" style="white-space: nowrap">
	                                    <?php 
        if (module_invoice::can_i('edit', 'Invoice Payments') && module_security::is_page_editable()) {
            ?>

		                                    <a href="#"
		                                       onclick="editinvoice_payment('<?php 
            echo $invoice_payment_id;
            ?>
',0); return false;"><?php 
            _e('Edit');
            ?>
</a> |
	                                    <?php 
        }
        // more details to the finance section
        if (class_exists('module_finance', false) && module_finance::is_plugin_enabled() && module_finance::can_i('view', 'Finance') && module_finance::is_enabled()) {
            // check if this finance has been added to the finance section yet.
예제 #24
0
$website_id = (int) $_REQUEST['website_id'];
$website = module_website::get_website($website_id);
if ($website_id > 0 && $website['website_id'] == $website_id) {
    $module->page_title = module_config::c('project_name_single', 'Website') . ': ' . $website['name'];
} else {
    $module->page_title = module_config::c('project_name_single', 'Website') . ': ' . _l('New');
}
if ($website_id > 0 && $website) {
    if (class_exists('module_security', false)) {
        module_security::check_page(array('module' => $module->module_name, 'feature' => 'edit'));
    }
} else {
    if (class_exists('module_security', false)) {
        module_security::check_page(array('module' => $module->module_name, 'feature' => 'create'));
    }
    module_security::sanatise_data('website', $website);
}
?>



	
<form action="" method="post">
	<input type="hidden" name="_process" value="save_website" />
    <input type="hidden" name="website_id" value="<?php 
echo $website_id;
?>
" />


    <?php 
예제 #25
0
 public function login_link($report_id)
 {
     return module_security::generate_auto_login_link($report_id);
 }
예제 #26
0
    echo _l($link['name']);
    ?>
				</a>
			</li>
		<?php 
}
unset($menu_holder);
unset($menu_type);
unset($current_link);
unset($menu_allow_nesting);
?>
        <?php 
if (isset($show_quick_search) && $show_quick_search) {
    ?>
        <?php 
    if (module_security::getcred() && module_security::can_user(module_security::get_loggedin_id(), 'Show Quick Search') && $display_mode != 'mobile') {
        if (module_config::c('global_search_focus', 1) == 1) {
            module_form::set_default_field('ajax_search_text');
        }
        ?>
            <li>
                <div id="quick_search_box">
                    <div id="quick_search_placeholder"><div><?php 
        _e('Quick Search:');
        ?>
</div></div>
                    <input type="text" name="quick_search" id="ajax_search_text" size="10" value="">
                    <div id="ajax_search_result"></div>
                </div>
            </li>
         <?php 
예제 #27
0
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
 * Package Date: 2015-11-25 02:55:20 
 * IP Address: 67.79.165.254
 */
if (!module_config::can_i('view', 'Settings') || !module_template::can_i('edit', 'Templates')) {
    redirect_browser(_BASE_HREF);
}
$template_id = $_REQUEST['template_id'];
$template = array();
if ((int) $template_id && $template_id != 'new') {
    $template = module_template::get_template($template_id);
}
if (!$template) {
    $template_id = 'new';
    $template = array('template_id' => 'new', 'template_key' => '', 'description' => '', 'content' => '', 'name' => '', 'default_text' => '', 'wysiwyg' => 1);
    module_security::sanatise_data('template', $template);
}
?>

<form action="<?php 
echo module_template::link_open(false);
?>
" method="post" id="template_form">

      <?php 
module_form::prevent_exit(array('valid_exits' => array('.submit_button')));
if ($template) {
    // is there a company template?
    if (class_exists('module_company', false) && defined('COMPANY_UNIQUE_CONFIG') && COMPANY_UNIQUE_CONFIG) {
        if (module_company::get_current_logged_in_company_id()) {
            // we restrict this template editing to only this template.
 * IP Address: 67.79.165.254
 */
if (!$module->can_i('view', 'Products') || !$module->can_i('edit', 'Products')) {
    redirect_browser(_BASE_HREF);
}
// check permissions.
if (class_exists('module_security', false)) {
    if ($product_category_id > 0 && $product_category['product_category_id'] == $product_category_id) {
        // if they are not allowed to "edit" a page, but the "view" permission exists
        // then we automatically grab the page and regex all the crap out of it that they are not allowed to change
        // eg: form elements, submit buttons, etc..
        module_security::check_page(array('category' => 'Product', 'page_name' => 'Products', 'module' => 'product', 'feature' => 'Edit'));
    } else {
        module_security::check_page(array('category' => 'Product', 'page_name' => 'Products', 'module' => 'product', 'feature' => 'Create'));
    }
    module_security::sanatise_data('product', $product_category);
}
?>

<form action="" method="post" id="product_category_form">
	<input type="hidden" name="_process" value="save_product_category" />
	<input type="hidden" name="product_category_id" value="<?php 
echo (int) $product_category_id;
?>
" />

    <?php 
module_form::set_required(array('fields' => array('name' => 'Name')));
module_form::prevent_exit(array('valid_exits' => array('.submit_button')));
$fieldset_data = array('heading' => array('type' => 'h3', 'title' => 'Product Information'), 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array());
$fieldset_data['elements'][] = array('title' => 'Name', 'fields' => array(array('type' => 'text', 'name' => 'product_category_name', 'value' => $product_category['product_category_name'])));
예제 #29
0
파일: note.php 프로젝트: sgh1986915/php-crm
    public static function print_note($note_id, $note_item, $display_summary = false, $can_edit = true, $can_delete = true, $options = array())
    {
        if (!$note_item) {
            $note_item = self::get_note($note_id);
        }
        static $x = 0;
        global $plugins;
        $can_view = $can_edit = $can_create = $can_delete = false;
        // re-check permissions...
        if (isset($options) && isset($options['owner_table']) && $options['owner_table'] && isset($options['title']) && $options['title']) {
            $can_view = $plugins[$options['owner_table']]->can_i('view', $options['title']);
            $can_edit = $plugins[$options['owner_table']]->can_i('edit', $options['title']);
            $can_create = $plugins[$options['owner_table']]->can_i('create', $options['title']);
            $can_delete = $plugins[$options['owner_table']]->can_i('delete', $options['title']);
        } else {
        }
        if (!module_security::is_page_editable()) {
            //$can_edit=$can_create=$can_delete=false;
        }
        if (isset($options['summary_owners'])) {
            unset($options['summary_owners']);
        }
        if (isset($options['display_summary'])) {
            unset($options['display_summary']);
        }
        //
        if (!trim($note_item['note'])) {
            $note_item['note'] = 'none';
        }
        ob_start();
        /** START TABLE LAYOUT **/
        $table_manager = module_theme::new_table_manager();
        $columns = array();
        $columns['date'] = array('title' => 'Date', 'width' => 60, 'callback' => function ($note_item) {
            if ($note_item['reminder']) {
                echo '<strong>';
            }
            echo print_date($note_item['note_time']);
            if ($note_item['reminder']) {
                echo '</strong>';
            }
        });
        $columns['description'] = array('title' => 'Description', 'callback' => function ($note_item) {
            if (isset($note_item['public']) && $note_item['public']) {
                echo '* ';
            }
            if ($note_item['can_edit']) {
                $note_text = nl2br(htmlspecialchars(substr($note_item['note'], 0, module_config::c('note_trim_length', 35))));
                $note_text .= strlen($note_item['note']) > module_config::c('note_trim_length', 35) ? '...' : '';
                ?>

                <a href="<?php 
                echo module_note::link_open($note_item['note_id'], false, $note_item['options']);
                ?>
" data-options="<?php 
                echo htmlspecialchars(base64_encode(serialize($note_item['options'])));
                ?>
" class="note_edit note_options_link" rel="<?php 
                echo $note_item['note_id'];
                ?>
"> <?php 
                echo $note_text;
                ?>
 </a>
                <?php 
            } else {
                echo forum_text($note_item['note']);
            }
        });
        $columns['info'] = array('title' => 'Info', 'width' => 40, 'callback' => function ($note_item) {
            if ($note_item['display_summary']) {
                if ($note_item['rel_data']) {
                    global $plugins;
                    echo $plugins[$note_item['owner_table']]->link_open($note_item['owner_id'], true);
                }
            } else {
                // find the user name who made thsi note.
                $user_data = module_user::get_user($note_item['create_user_id']);
                echo $user_data['name'];
            }
        });
        if ($can_delete) {
            $columns['del'] = array('title' => ' ', 'callback' => function ($note_item) {
                if ($note_item['can_delete']) {
                    ?>
 <a href="<?php 
                    echo module_note::link_open($note_item['note_id'], false, array_merge($note_item['options'], array('do_delete' => 'yes', 'note_id' => $note_item['note_id'])));
                    ?>
" data-options="<?php 
                    echo htmlspecialchars(base64_encode(serialize(array_merge($note_item['options'], array('do_delete' => 'yes', 'note_id' => $note_item['note_id'])))));
                    ?>
" rel="<?php 
                    echo $note_item['note_id'];
                    ?>
" onclick="if(confirm('<?php 
                    _e('Really Delete Note?');
                    ?>
'))return true; else return false;" class="note_delete note_options_link delete ui-state-default ui-corner-all ui-icon ui-icon-trash">[x]</a> <?php 
                }
            });
        }
        $table_manager->set_columns($columns);
        $table_manager->inline_table = true;
        $table_manager->row_callback = function ($row_data, &$row_object) use($display_summary, $can_edit, $can_delete, &$options) {
            $row_data['display_summary'] = $display_summary;
            $row_data['can_edit'] = $can_edit;
            $row_data['can_delete'] = $can_delete;
            $row_data['options'] = $options;
            $row_object->row_id = 'note_' . $row_data['note_id'];
            return $row_data;
        };
        $table_manager->print_row($note_item);
        /*?>
        		<tr id="note_<?php echo $note_item['note_id'];?>" class="<?php echo ($x++%2)?'odd':'even';?>">
        			<td>
                        <?php
                        if($note_item['reminder'])echo '<strong>';
                        echo print_date($note_item['note_time']);
                        if($note_item['reminder'])echo '</strong>';
                        ?>
        			</td>
        			<td>
                        <?php
                        if(isset($note_item['public']) && $note_item['public'])echo '* ';
                        if($can_edit){
                            $note_text = nl2br(htmlspecialchars(substr($note_item['note'],0,module_config::c('note_trim_length',35))));
                            $note_text .= strlen($note_item['note']) > module_config::c('note_trim_length',35) ? '...' : '';
                            ?>
                        <a href="<?php echo self::link_open($note_item['note_id'],false,$options);?>" data-options="<?php echo htmlspecialchars(base64_encode(serialize($options)));?>" class="note_edit note_options_link" rel="<?php echo $note_item['note_id'];?>"> <?php echo $note_text; ?> </a>
                        <?php }else{
                            echo forum_text($note_item['note']);
                        } ?>
        			</td>
        			<td nowrap="nowrap">
        				<?php
        				if($display_summary){
        					if($note_item['rel_data']){
                                echo $plugins[$note_item['owner_table']]->link_open($note_item['owner_id'],true);
        					}
        				}else{
        					// find the user name who made thsi note.
        					$user_data = module_user::get_user($note_item['create_user_id']);
        					echo $user_data['name'];
        				}
        				?>
        			</td>
                    <?php if($can_delete){ ?>
                    <td><a href="<?php echo self::link_open($note_item['note_id'],false,array_merge($options,array('do_delete'=>'yes','note_id'=>$note_item['note_id'])));?>" data-options="<?php echo htmlspecialchars(base64_encode(serialize(array_merge($options,array('do_delete'=>'yes','note_id'=>$note_item['note_id'])))));?>" rel="<?php echo $note_item['note_id'];?>" onclick="if(confirm('<?php _e('Really Delete Note?');?>'))return true; else return false;" class="note_delete note_options_link delete ui-state-default ui-corner-all ui-icon ui-icon-trash">[x]</a></td>
                    <?php } ?>
        		</tr>
        		<?php
        		*/
        return ob_get_clean();
    }
예제 #30
0
        redirect_browser(module_customer::link_open($_REQUEST['customer_id']));
    }
}
if ($user_id == 1 && module_security::get_loggedin_id() != 1) {
    set_error('Sorry, only the Administrator can access this page.');
    redirect_browser(_UCM_HOST . _BASE_HREF);
}
// permission check.
if (!$user_id) {
    // check if can create.
    module_security::check_page(array('category' => 'Config', 'page_name' => 'Users', 'module' => 'user', 'feature' => 'Create'));
    // are we creating a new user?
    $user['roles'] = array(array('security_role_id' => module_config::c('user_default_role', 0)));
} else {
    // check if can view/edit.
    module_security::check_page(array('category' => 'Config', 'page_name' => 'Users', 'module' => 'user', 'feature' => 'Edit'));
}
// work out the user type and invluce that particular file
/*$user_type_id = (int)$user['user_type_id'];
if(!$user_type_id){
    if(in_array('config',$load_modules)){
        $user_type_id = 1;

    }else{
        $user_type_id = 2;
    }
}*/
//include('user_admin_edit'.$user_type_id.'.php');
//include('user_admin_edit1.php');
if (isset($user['customer_id']) && $user['customer_id'] || isset($user['vendor_id']) && $user['vendor_id']) {
    // we have a contact!