Ejemplo n.º 1
0
    public static function header_print_js()
    {
        $pages = isset($_REQUEST['p']) ? is_array($_REQUEST['p']) ? $_REQUEST['p'] : array($_REQUEST['p']) : array();
        $modules = isset($_REQUEST['m']) ? is_array($_REQUEST['m']) ? $_REQUEST['m'] : array($_REQUEST['m']) : array();
        foreach ($pages as $pid => $p) {
            $pages[$pid] = preg_replace('#[^a-z_]#', '', $p);
        }
        foreach ($modules as $pid => $p) {
            $modules[$pid] = preg_replace('#[^a-z_]#', '', $p);
        }
        ?>
		<script type="text/javascript">
			ucm.help.current_modules = '<?php 
        echo implode('/', $modules);
        ?>
';
			ucm.help.current_pages = '<?php 
        echo implode('/', $pages);
        ?>
';
			ucm.help.lang.help = '<?php 
        _e('Help');
        ?>
';
			ucm.help.url_extras = '&codes=<?php 
        echo base64_encode(module_config::c('_installation_code'));
        ?>
&host=<?php 
        echo urlencode(htmlspecialchars(full_link('/')));
        ?>
';
		</script>
		<?php 
    }
Ejemplo n.º 2
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 
        }
    }
Ejemplo n.º 3
0
 public static function check_captcha_form()
 {
     $privatekey = module_config::c('recaptcha_private_key', '6Leym88SAAAAANbBjtrjNfeu6NXDSCXGBSbKzqnN');
     require_once 'inc/recaptchalib.php';
     $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], isset($_POST["recaptcha_challenge_field"]) ? $_POST["recaptcha_challenge_field"] : '', isset($_POST["recaptcha_response_field"]) ? $_POST["recaptcha_response_field"] : '');
     if (!$resp->is_valid) {
         // What happens when the CAPTCHA was entered incorrectly
         return false;
     } else {
         return true;
     }
 }
Ejemplo n.º 4
0
 public function ajax_search($search_key)
 {
     // return results based on an ajax search.
     $ajax_results = array();
     $search_key = trim($search_key);
     if (strlen($search_key) > module_config::c('search_ajax_min_length', 2)) {
         $results = $this->get_widgets(array('generic' => $search_key));
         if (count($results)) {
             foreach ($results as $result) {
                 $match_string = _l('Widget: ');
                 $match_string .= _shl($result['name'], $search_key);
                 $ajax_results[] = '<a href="' . $this->link_open($result['widget_id']) . '">' . $match_string . '</a>';
             }
         }
     }
     return $ajax_results;
 }
Ejemplo n.º 5
0
 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');
     }
 }
Ejemplo n.º 6
0
	display: inline;
}
#panel {
    position: absolute;
    top: 5px;
    left: 50%;
    margin-left: -180px;
    z-index: 5;
    background-color: #fff;
    padding: 5px;
    border: 1px solid #999;
  }
</style>

<script src="https://maps.googleapis.com/maps/api/js?key=<?php 
echo htmlspecialchars(module_config::c('google_maps_api_key', 'AIzaSyDFYt1ozmTn34lp96W0AakC-tSJVzEdXjk'));
?>
&callback=initializeMaps" async defer></script>
<script>
var geocoder;
var map;
var infowindow = false;
function createInfoWindow(item,content) {
    if(!infowindow){
        infowindow = new google.maps.InfoWindow({});
    }
    google.maps.event.addListener(item, 'click', function(event) {
        infowindow.close();
        infowindow = new google.maps.InfoWindow({
            content: content,
            position: event.latLng
Ejemplo n.º 7
0
 public static function is_mobile_browser()
 {
     if (!module_config::c('mobile_enabled', 1)) {
         return false;
     }
     if (!isset($_SERVER['HTTP_USER_AGENT'])) {
         return false;
     }
     if (!isset($_SERVER['HTTP_ACCEPT'])) {
         return false;
     }
     $mobile_browser = '0';
     if (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|android)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {
         $mobile_browser++;
     }
     if (strpos(strtolower($_SERVER['HTTP_ACCEPT']), 'application/vnd.wap.xhtml+xml') > 0 or (isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE']))) {
         $mobile_browser++;
     }
     $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4));
     $mobile_agents = array('w3c ', 'acs-', 'alav', 'alca', 'amoi', 'audi', 'avan', 'benq', 'bird', 'blac', 'blaz', 'brew', 'cell', 'cldc', 'cmd-', 'dang', 'doco', 'eric', 'hipt', 'inno', 'ipaq', 'java', 'jigs', 'kddi', 'keji', 'leno', 'lg-c', 'lg-d', 'lg-g', 'lge-', 'maui', 'maxo', 'midp', 'mits', 'mmef', 'mobi', 'mot-', 'moto', 'mwbp', 'nec-', 'newt', 'noki', 'oper', 'palm', 'pana', 'pant', 'phil', 'play', 'port', 'prox', 'qwap', 'sage', 'sams', 'sany', 'sch-', 'sec-', 'send', 'seri', 'sgh-', 'shar', 'sie-', 'siem', 'smal', 'smar', 'sony', 'sph-', 'symb', 't-mo', 'teli', 'tim-', 'tosh', 'tsm-', 'upg1', 'upsi', 'vk-v', 'voda', 'wap-', 'wapa', 'wapi', 'wapp', 'wapr', 'webc', 'winw', 'winw', 'xda ', 'xda-');
     if (in_array($mobile_ua, $mobile_agents)) {
         $mobile_browser++;
     }
     if (isset($_SERVER['ALL_HTTP']) && strpos(strtolower($_SERVER['ALL_HTTP']), 'OperaMini') > 0) {
         $mobile_browser++;
     }
     if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'windows') > 0) {
         $mobile_browser = 0;
     }
     return $mobile_browser;
 }
Ejemplo n.º 8
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();
Ejemplo n.º 9
0
); 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 */
if (!$done_messages) {
    $tickets_in_reverse = module_config::c('ticket_messages_in_reverse', 0);
    include module_theme::include_ucm('includes/plugin_ticket/pages/ticket_admin_edit_messages.php');
}
hook_handle_callback('layout_column_half', 'end');
echo $action_buttons;
?>


</form>

<?php 
if (($last_response_from == 'customer' || $last_response_from == 'autoreply') && $ticket['status_id'] != _TICKET_STATUS_RESOLVED_ID) {
    // don't do this for resolved tickets
    // only set the default field if the last respose was from the customer.
    module_form::set_default_field('new_ticket_message');
}
Ejemplo n.º 10
0
            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 {
                    $this_plugin_results = $plugin->ajax_search($search_text);
                    $_SESSION['previous_search'][$plugin_name] = array('l' => $search_text, 'c' => count($this_plugin_results));
                }
                $search_results = array_merge($search_results, $this_plugin_results);
            }
        }
        if (count($search_results)) {
            echo '<ul>';
            foreach ($search_results as $r) {
                echo '<li>' . $r . '</li>';
            }
            echo '</ul>';
        } else {
            //_e('No results');
        }
    } else {
        echo '';
    }
    if (module_config::c('search_ajax_show_time', 0)) {
        echo '<br>';
        echo 'Search took: ' . round(microtime(true) - $start_search_time, 5);
    }
    exit;
}
Ejemplo n.º 11
0
 public function get_data()
 {
     if (count($this->_get_data_cache)) {
         return $this->_get_data_cache;
     }
     $file = false;
     if ($this->file_id > 0) {
         $file = get_single("file", "file_id", $this->file_id);
     }
     // check user has permissions to view this file.
     // for now we just base this on the customer id check
     if ($file) {
         // staff listing
         $staff = get_multiple('file_user_rel', array('file_id' => $file['file_id']), 'user_id');
         $file['staff_ids'] = array_keys($staff);
         $file['type'] = isset($file['file_url']) && $file['file_url'] ? 'remote' : (isset($file['bucket']) && $file['bucket'] ? 'bucket' : 'upload');
         if ($this->do_permissions) {
             switch (module_file::get_file_data_access()) {
                 case _FILE_ACCESS_ALL:
                     // all files, no limits on SQL here
                     break;
                 case _FILE_ACCESS_JOBS:
                     $jobs = module_job::get_jobs(array(), array('columns' => 'u.job_id AS id'));
                     if (!$file['job_id'] || !isset($jobs[$file['job_id']])) {
                         $file = false;
                     }
                     break;
                 case _FILE_ACCESS_ME:
                     if ($file['create_user_id'] != module_security::get_loggedin_id()) {
                         $file = false;
                     }
                     break;
                 case _FILE_ACCESS_ASSIGNED:
                     if (!in_array(module_security::get_loggedin_id(), $file['staff_ids'])) {
                         $file = false;
                     }
                     break;
                 case _FILE_ACCESS_CUSTOMERS:
                 default:
                     if (class_exists('module_customer', false)) {
                         //added for compat in newsletter system that doesn't have customer module
                         $customer_permission_check = module_customer::get_customer($file['customer_id']);
                         if ($customer_permission_check['customer_id'] != $file['customer_id']) {
                             $file = false;
                         }
                     }
             }
             // file data access switch
         }
     }
     if (!$file) {
         $file = array('new' => true, 'type' => 'upload', 'file_id' => 0, 'customer_id' => isset($_REQUEST['customer_id']) ? $_REQUEST['customer_id'] : 0, 'job_id' => isset($_REQUEST['job_id']) ? $_REQUEST['job_id'] : 0, 'quote_id' => isset($_REQUEST['quote_id']) ? $_REQUEST['quote_id'] : 0, 'description' => '', 'status' => module_config::c('file_default_status', 'Uploaded'), 'file_name' => '', 'file_url' => '', 'staff_ids' => array(), 'bucket' => 0, 'bucket_parent_file_id' => 0, 'approved_time' => 0);
     }
     $this->_get_data_cache = $file;
     return $file;
 }
Ejemplo n.º 12
0
                            $('#manual_send_paused').hide();
                            $('#manual_send_running').hide();
                            $('#manual_send_status').prepend('<li><?php 
_e('Sending complete. Please <a href="%s">click here</a> to refresh the page.', module_newsletter::link_queue_watch($newsletter_id, $send_id));
?>
</li>');
                            $('#change_status_buttons').hide();
                        }
                        function do_manual_send(){
                            if(!run_manual_send){
                                return;
                            }
                            // do an ajax call to the newsletter_queue_manual.php script
                            // parse the result and update the corresponding recipient in the listing
                            $('#manual_send_status').prepend('<li><?php 
_e('Telling server to send in batches of %s, please wait...', module_config::c('newsletter_send_burst_count', 40));
?>
</li>');
                            $.ajax({
                                type: 'POST',
                                url: '<?php 
echo module_newsletter::link_queue_manual($newsletter_id, $send_id);
?>
',
                                data: 'retry_failures=<?php 
echo $retry_failures ? 'yes' : '';
?>
&retry_pending=<?php 
echo $retry_pending ? 'yes' : '';
?>
',
Ejemplo n.º 13
0
    }
    if ($task_data['user_id'] && $task_data['user_id'] != $current_user_id && $task_data['user_id'] != $customer['primary_user_id']) {
        $send_to_staff_ids[$task_data['user_id']] = module_config::c('job_discussion_staff_checked', 1);
    }
    if (!module_security::is_logged_in()) {
        echo '<div style="display:none;">';
    }
    foreach ($send_to_customer_ids as $user_id => $tf) {
        // we are the admin, sending an email to customer
        ?>
        <br/>
        <input type="checkbox" name="sendemail_customer[]" value="<?php 
        echo $user_id;
        ?>
" <?php 
        echo module_config::c('job_discussion_customer_checked', 1) && $user_id == $customer['primary_user_id'] ? 'checked="checked"' : '';
        ?>
 class="sendemail_customer"> <?php 
        _e('Yes, send email to customer contact %s', module_user::link_open($user_id, true, array(), true));
        ?>
        <?php 
        echo $user_id == $customer['primary_user_id'] ? _l('(primary)') : '';
        ?>
        <?php 
    }
    foreach ($send_to_staff_ids as $staff_id => $checked) {
        // we are the admin, sending an email to assigned staff member
        ?>
        <br/>
        <input type="checkbox" name="sendemail_staff[]" value="<?php 
        echo $staff_id;
Ejemplo n.º 14
0
                <td valign="top">
                    <input type="checkbox" name="job_task[new][new_fully_completed]" value="1">
                </td>
                <td align="center" valign="top">
                    <input type="submit" name="save" value="<?php 
        _e('New Task');
        ?>
" class="save_task small_button">

                    <!-- these are overridden from the products selection -->
                    <input type="hidden" name="job_task[new][billable_t]" value="1">
                    <input type="hidden" name="job_task[new][billable]" value="1" id="billable_t_new">
                    <input type="hidden" name="job_task[new][taxable_t]" value="1">
                    <input type="hidden" name="job_task[new][taxable]" value="<?php 
        echo module_config::c('task_taxable_default', 1) ? 1 : 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++;
Ejemplo n.º 15
0
$module->page_title = 'Recurring';
$search = isset($_REQUEST['search']) ? $_REQUEST['search'] : array();
if (module_config::c('finance_recurring_show_finished', 0)) {
    $search['show_finished'] = true;
}
if (!isset($search['date_to'])) {
    $search['date_to'] = print_date(strtotime('+' . (int) module_config::c('finance_recurring_months', 6) . ' months'));
}
$balance = isset($_REQUEST['balance']) ? (double) $_REQUEST['balance'] : module_config::c('finance_recurring_start_balance', 0);
module_config::save_config('finance_recurring_start_balance', $balance);
$_SESSION['_finance_recurring_ids'] = array();
module_debug::log(array('title' => 'calling get_recurrings', 'data' => ''));
$upcoming_finances_unsorted = module_finance::get_recurrings($search);
module_debug::log(array('title' => 'finished calling get_recurrings', 'data' => 'count: ' . count($upcoming_finances_unsorted)));
$upcoming_finances = array();
$limit_timestamp = isset($search['date_to']) && !empty($search['date_to']) ? strtotime(input_date($search['date_to'])) : strtotime('+' . (int) module_config::c('finance_recurring_months', 6) . ' months');
$duplicate_limit = 30;
$upcoming_finance_key = 0;
foreach ($upcoming_finances_unsorted as $recurring) {
    $time = strtotime($recurring['next_due_date']);
    $original = true;
    $count = 0;
    while ($time < $limit_timestamp) {
        $next_time = 0;
        if ($count++ > $duplicate_limit) {
            break;
        }
        // we need a special case for the first one that hasn't had a last trasnaction
        // we need a specicl case for the last one that the due date is on the finish date.
        if ($recurring['next_due_date'] == '0000-00-00' || !$recurring['days'] && !$recurring['months'] && !$recurring['years']) {
            // it's a once off..
Ejemplo n.º 16
0
?>
" />
	<input type="hidden" name="customer_id" value="<?php 
echo $user['customer_id'];
?>
" />


    <?php 
module_form::print_form_auth();
module_form::prevent_exit(array('valid_exits' => array('.submit_button')));
module_form::set_required(array('fields' => array('name' => 'Name', 'email' => 'Email')));
hook_handle_callback('layout_column_half', 1);
$title = 'User Details';
include module_theme::include_ucm('includes/plugin_user/pages/contact_admin_form.php');
if (module_config::c('users_have_address', 0)) {
    ob_start();
    handle_hook("address_block", $module, "physical", "user", "user_id");
    $fieldset_data = array('heading' => array('type' => 'h3', 'title' => 'Address'), 'elements_before' => ob_get_clean());
    echo module_form::generate_fieldset($fieldset_data);
    unset($fieldset_data);
}
if ((int) $user_id > 0) {
    //handle_hook("note_list",$module,"user","user_id",$user_id);
    if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
        module_note::display_notes(array('title' => 'User Notes', 'owner_table' => 'user', 'owner_id' => $user_id, 'view_link' => $module->link_open($user_id)));
    }
    if (class_exists('module_group', false) && module_group::is_plugin_enabled()) {
        module_group::display_groups(array('title' => 'User Groups', 'owner_table' => 'user', 'owner_id' => $user_id, 'view_link' => module_user::link_open($user_id)));
    }
}
Ejemplo n.º 17
0
 public static function check_for_upgrades($requested_plugin = '', $get_file_contents = 0)
 {
     // compile a list of current plugins
     // along with the users installation code
     // send it to our server and get a response with a list of available updates for this user.
     $current_plugins = array();
     $current_files = array();
     global $plugins;
     if (_DEBUG_MODE) {
         module_debug::log(array('title' => 'Checking for upgrades:', 'data' => 'start'));
     }
     foreach ($plugins as $plugin_name => $p) {
         if ($requested_plugin && $requested_plugin != $plugin_name) {
             continue;
         }
         if (!$p->is_plugin_enabled()) {
             $p->init();
         }
         $current_plugins[$plugin_name] = $p->get_plugin_version();
         // find all the files related to this plugin.
         if (function_exists('getFilesFromDir') && module_config::c('upgrade_post_file_list', 1)) {
             $directory = 'includes/plugin_' . $plugin_name . '/';
             $files = getFilesFromDir($directory);
             $files = array_flip($files);
             foreach ($files as $file => $tf) {
                 // ignore certain files.
                 if (strpos($file, 'plugin_file/upload') !== false || strpos($file, 'plugin_data/upload') !== false || strpos($file, '/cache/') !== false || strpos($file, '/html2ps/') !== false || strpos($file, 'backup/backups/backup_') !== false || strpos($file, '/attachments/') !== false || strpos($file, '/temp/') !== false || strpos($file, '/tmp/') !== false) {
                     unset($files[$file]);
                 } else {
                     $d = preg_replace('#Envato:[^\\r\\n]*#', '', preg_replace('#Package Date:[^\\r\\n]*#', '', preg_replace('#IP Address:[^\\r\\n]*#', '', preg_replace('#Licence:[^\\r\\n]*#', '', file_get_contents($file)))));
                     $files[$file] = md5(base64_encode($d));
                 }
             }
             $current_files[$plugin_name] = $files;
         }
         if (_DEBUG_MODE) {
             module_debug::log(array('title' => 'Checking for upgrades:', 'data' => $plugin_name . ' done'));
         }
     }
     //print_r($current_files);exit;
     $available_updates = array();
     $post_fields = array('application' => _APPLICATION_ID, 'installation_code' => module_config::c('_installation_code'), 'current_version' => module_config::c('_admin_system_version', 2.1), 'current_plugins' => json_encode($current_plugins), 'current_files' => json_encode($current_files), 'client_ip' => $_SERVER['REMOTE_ADDR'], 'installation_location' => full_link('/'), 'requested_plugin' => $requested_plugin, 'get_file_contents' => $get_file_contents);
     $url = module_config::c('ucm_upgrade_url', 'http://api.ultimateclientmanager.com/upgrade.php');
     if ($url == 'http://ultimateclientmanager.com/api/upgrade.php') {
         $url = 'http://api.ultimateclientmanager.com/upgrade.php';
         // hack to use new update subdomain
     }
     if ($url != 'http://ultimateclientmanager.com/api/upgrade.php' && $url != 'http://api.ultimateclientmanager.com/upgrade.php') {
         set_error('Incorrect API url');
         redirect_browser(_BASE_HREF);
     }
     if (_DEBUG_MODE) {
         module_debug::log(array('title' => 'Checking for upgrades:', 'data' => 'Posting to API'));
     }
     if (!function_exists('curl_init')) {
         $postdata = http_build_query($post_fields);
         $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
         $context = stream_context_create($opts);
         $result = file_get_contents($url, false, $context);
     } else {
         //$url = 'http://localhost/ucm/web/api/upgrade.php';
         $ch = curl_init($url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_HEADER, false);
         curl_setopt($ch, CURLOPT_POST, true);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
         curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
         // fixes netregistr, may break others?
         $result = curl_exec($ch);
     }
     $data = json_decode($result, true);
     if (_DEBUG_MODE) {
         module_debug::log(array('title' => 'Checking for upgrades:', 'data' => 'Received response from API'));
     }
     if ($data && isset($data['available_updates']) && is_array($data['available_updates'])) {
         $available_updates = $data['available_updates'];
     }
     if ($data && isset($data['licence_codes']) && is_array($data['licence_codes'])) {
         // find out what the licence codes  are (url / name) so we can dispaly this under each code nicely.
         foreach ($data['licence_codes'] as $code => $foo) {
             if (strlen($code) > 10 && strlen($foo) > 10) {
                 module_config::save_config('_licence_code_' . $code, $foo);
                 // this might not be working
             }
         }
     }
     if (!$data) {
         echo $result;
     }
     //echo '<pre>';print_r($current_plugins);print_r($result);echo '</pre>';
     return $available_updates;
 }
Ejemplo n.º 18
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;
    }
Ejemplo n.º 19
0
 public function get_upgrade_sql()
 {
     $sql = '';
     $fields = get_fields('finance_recurring');
     if (!isset($fields['next_due_date_custom'])) {
         $sql .= "ALTER TABLE `" . _DB_PREFIX . "finance_recurring` ADD  `next_due_date_custom` TINYINT( 1 ) NOT NULL DEFAULT  '0' AFTER  `next_due_date`;";
     }
     if (!isset($fields['currency_id'])) {
         $sql .= "ALTER TABLE `" . _DB_PREFIX . "finance_recurring` ADD  `currency_id` int( 11 ) NOT NULL DEFAULT  '" . module_config::c('default_currency_id', 1) . "' AFTER  `amount`;";
     }
     $fields = get_fields('finance');
     if (!isset($fields['currency_id'])) {
         $sql .= "ALTER TABLE `" . _DB_PREFIX . "finance` ADD  `currency_id` int( 11 ) NOT NULL DEFAULT  '" . module_config::c('default_currency_id', 1) . "' AFTER  `type`;";
     }
     if (!isset($fields['customer_id'])) {
         $sql .= "ALTER TABLE `" . _DB_PREFIX . "finance` ADD  `customer_id` int( 11 ) NOT NULL DEFAULT  '0' AFTER  `finance_recurring_id`;";
     }
     if (!isset($fields['job_id'])) {
         $sql .= "ALTER TABLE `" . _DB_PREFIX . "finance` ADD  `job_id` int( 11 ) NOT NULL DEFAULT  '0' AFTER  `customer_id`;";
     }
     if (!isset($fields['invoice_id'])) {
         $sql .= "ALTER TABLE `" . _DB_PREFIX . "finance` ADD  `invoice_id` int( 11 ) NOT NULL DEFAULT  '0' AFTER  `job_id`;";
     }
     if (!isset($fields['company_id'])) {
         $sql .= "ALTER TABLE `" . _DB_PREFIX . "finance` ADD  `company_id` int( 11 ) NOT NULL DEFAULT  '0' AFTER  `invoice_id`;";
     }
     if (!isset($fields['sub_amount'])) {
         $sql .= "ALTER TABLE `" . _DB_PREFIX . "finance` ADD  `sub_amount` decimal(10,2) NOT NULL DEFAULT  '0' AFTER  `description`;";
         $sql .= "UPDATE `" . _DB_PREFIX . "finance` SET  `sub_amount` = `amount` WHERE `sub_amount` = 0 AND `amount` > 0;";
     }
     if (!isset($fields['user_id'])) {
         $sql .= "ALTER TABLE `" . _DB_PREFIX . "finance` ADD  `user_id` int( 11 ) NOT NULL DEFAULT  '0' AFTER  `company_id`;";
     }
     if (!isset($fields['job_staff_expense'])) {
         $sql .= "ALTER TABLE `" . _DB_PREFIX . "finance` ADD  `job_staff_expense` int( 11 ) NOT NULL DEFAULT  '0' AFTER  `user_id`;";
     }
     if (!isset($fields['taxable_amount'])) {
         $sql .= "ALTER TABLE `" . _DB_PREFIX . "finance` ADD  `taxable_amount` decimal(10,2) NOT NULL DEFAULT  '0' AFTER  `sub_amount`;";
         if (isset($fields['taxible_amount'])) {
             // typo - damnnn
             $sql .= "UPDATE `" . _DB_PREFIX . "finance` SET  `taxable_amount` = `taxible_amount` WHERE `taxable_amount` = 0 AND `taxible_amount` > 0;";
         } else {
             $sql .= "UPDATE `" . _DB_PREFIX . "finance` SET  `taxable_amount` = `sub_amount` WHERE `taxable_amount` = 0 AND `sub_amount` > 0;";
         }
     }
     if (!isset($fields['tax_mode'])) {
         $sql .= "ALTER TABLE `" . _DB_PREFIX . "finance` ADD  `tax_mode` tinyint(1) NOT NULL DEFAULT '0' AFTER  `sub_amount`;";
     }
     self::add_table_index('finance', 'job_id');
     self::add_table_index('finance', 'invoice_id');
     self::add_table_index('finance', 'customer_id');
     self::add_table_index('finance', 'type');
     self::add_table_index('finance', 'company_id');
     self::add_table_index('finance', 'amount');
     self::add_table_index('finance', 'user_id');
     self::add_table_index('finance', 'job_staff_expense');
     if (!self::db_table_exists('finance_tax')) {
         $sql .= "CREATE TABLE IF NOT EXISTS `" . _DB_PREFIX . "finance_tax` (\n  `finance_tax_id` int(11) NOT NULL AUTO_INCREMENT,\n  `finance_id` int(11) NOT NULL,\n  `percent` decimal(10,2) NOT NULL,\n  `amount` decimal(10,2) NOT NULL,\n  `name` varchar(50) NOT NULL,\n  `order` int(4) NOT NULL DEFAULT '0',\n  `increment` tinyint(1) NOT NULL DEFAULT '0',\n  `create_user_id` int(11) NOT NULL,\n  `update_user_id` int(11) DEFAULT NULL,\n  `date_created` date NOT NULL,\n  `date_updated` date DEFAULT NULL,\n  PRIMARY KEY (`finance_tax_id`),\n  KEY (`finance_id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
     }
     return $sql;
 }
Ejemplo n.º 20
0
								    <?php 
                    }
                    ?>

							    </tr>
						    <?php 
                }
                ?>

						    </tbody>
					    </table>
				    </div>
			        <?php 
                $fieldset_data['elements_before'] = ob_get_clean();
            }
            echo module_form::generate_fieldset($fieldset_data);
        }
    }
    // and a hook for our new change request plugin
    hook_handle_callback('website_main', $website_id);
}
hook_handle_callback('layout_column_half', 'end');
$form_actions = array('class' => 'action_bar action_bar_center', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save ' . module_config::c('project_name_single', 'Website'))), array('ignore' => !((int) $website_id && module_website::can_i('delete', 'Websites')), 'type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete')), array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . module_website::link_open(false) . "';")));
echo module_form::generate_form_actions($form_actions);
?>




</form>
Ejemplo n.º 21
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
 */
// UPDATE:::: to modify this layout please now go to Settings > Templates and look for "invoice_payment_history"
if (module_config::c('invoice_show_payment_history', 1)) {
    $payment_historyies = module_invoice::get_invoice_payments($invoice_id);
    foreach ($payment_historyies as $invoice_payment_id => $invoice_payment_data) {
        if (module_config::c('invoice_hide_pending_payments', 1)) {
            if (!trim($invoice_payment_data['date_paid']) || $invoice_payment_data['date_paid'] == '0000-00-00') {
                unset($payment_historyies[$invoice_payment_id]);
            }
        }
    }
    if (count($payment_historyies)) {
        ob_start();
        ?>
		<table cellpadding="4" cellspacing="0" class="table tableclass tableclass_rows" style="width: 100%" id="invoice_payment_history">
			<thead>
				<tr class="task_header">
                    <th>{l:Payment Date}</th>
                    <th>{l:Payment Method}</th>
                    <th>{l:Details}</th>
                    <th>{l:Amount}</th>
Ejemplo n.º 22
0
 public static function calculate_fee($invoice_id, $invoice_data, $payment_amount, $options)
 {
     /* options array(
            'percent' => $fee_percent,
            'amount' => $fee_amount,
            'description' => $fee_description,
        ) */
     if (module_config::c('invoice_fee_calculate_reverse', 0)) {
         $fee_total = round(($payment_amount + (isset($options['amount']) ? $options['amount'] : 0)) / (isset($options['percent']) ? 1 - $options['percent'] / 100 : 1), 2) - $payment_amount;
     } else {
         $fee_total = round($payment_amount * ((isset($options['percent']) ? $options['percent'] : 0) / 100) + (isset($options['amount']) ? $options['amount'] : 0), 2);
     }
     // do we add in taxes ? nfi. for not - no
     return $fee_total;
 }
Ejemplo n.º 23
0
</a>
                                    </td>
                                </tr>
                        <?php 
    }
    ?>

                        </tbody>
					</table>
                        </div>

                        <?php 
    $fieldset_data = array('heading' => array('title' => _l('Invoice Payment History'), 'type' => 'h3'), 'elements_before' => ob_get_clean());
    echo module_form::generate_fieldset($fieldset_data);
    unset($fieldset_data);
    if (class_exists('module_finance', false) && module_finance::is_plugin_enabled() && module_finance::can_i('view', 'Finance') && module_finance::is_enabled() && is_file('includes/plugin_finance/pages/finance_invoice_edit.php') && module_config::c('invoice_show_finances', 1)) {
        include 'includes/plugin_finance/pages/finance_invoice_edit.php';
    }
}
// invoice_id check
hook_handle_callback('layout_column_half', 'end');
$form_actions = array('class' => 'action_bar action_bar_left', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'onclick' => "\$('#form_redirect').val('" . (!$invoice_id && isset($_REQUEST['job_id']) && (int) $_REQUEST['job_id'] > 0 ? module_job::link_open($_REQUEST['job_id']) : module_invoice::link_open(false)) . "');", 'value' => _l('Save and Return')), array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save'))));
if ((int) $invoice_id) {
    if ($invoice['date_paid'] && $invoice['date_paid'] != '0000-00-00') {
        $form_actions['elements'][] = array('type' => 'save_button', 'class' => 'submit_button', 'name' => 'butt_email', 'value' => _l('Email Receipt'));
    } else {
        $form_actions['elements'][] = array('type' => 'submit', 'class' => 'submit_button', 'name' => 'butt_email', 'value' => _l('Email Invoice'));
    }
    if (function_exists('convert_html2pdf')) {
        if (!module_invoice::can_i('edit', 'Invoices')) {
            $form_actions['elements'][] = array('type' => 'button', 'class' => 'submit_button no_permissions', 'name' => 'butt_print', 'value' => _l('Print PDF'), 'onclick' => "window.location.href='" . module_invoice::link_public_print($invoice_id) . "';");
                    <td><?php 
            echo isset($row['amount_paid_link']) ? $row['amount_paid_link'] : $row['amount_paid'];
            ?>
</td>
                    <?php 
            if (module_finance::is_expense_enabled()) {
                ?>
                        <td><?php 
                echo isset($row['amount_spent_link']) ? $row['amount_spent_link'] : $row['amount_spent'];
                ?>
</td>
                    <?php 
            }
            ?>
                    <?php 
            if (class_exists('module_envato', false) && module_config::c('envato_include_in_dashbaord', 1)) {
                ?>
                    <td><?php 
                echo isset($row['envato_earnings_link']) ? $row['envato_earnings_link'] : $row['envato_earnings'];
                ?>
</td>
                    <?php 
            }
            ?>
                </tr>
            <?php 
        }
        ?>
            </tbody>
        </table>
        <?php 
Ejemplo n.º 25
0
 public function __construct($config = array())
 {
     $this->config = array_merge(array('consumer_key' => module_config::c('social_twitter_api_key', ''), 'consumer_secret' => module_config::c('social_twitter_api_secret', ''), 'user_agent' => 'UCM Twitter 0.1'), $config);
     parent::__construct($this->config);
 }
Ejemplo n.º 26
0
      }else{
          echo 'success_text';
      }
      echo '">';
      if($invoice['total_amount_due']>0){
          echo dollar($invoice['total_amount_due'],true,$job['currency_id']);
          echo ' '._l('due');
      }else{
          echo _l('All paid');
      }
      echo '</span>';*/
} else {
    if ($task_editable) {
        ?>
                <?php 
        if (module_config::c('job_task_edit_icon', 0)) {
            // old icon:
            ?>
                <a href="#" class="ui-state-default ui-corner-all ui-icon ui-icon-<?php 
            echo $percentage == 1 ? 'pencil' : 'check';
            ?>
" title="<?php 
            _e($percentage == 1 ? 'Edit' : 'Complete');
            ?>
" onclick="edittask(<?php 
            echo $task_id;
            ?>
,<?php 
            echo $task_data['hours'] != 0 ? $task_data['hours'] - $task_data['completed'] : 1;
            ?>
); return false;"><?php 
Ejemplo n.º 27
0
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.
$to_select = false;
if ($quote['customer_id']) {
    $customer = module_customer::get_customer($quote['customer_id']);
    $quote['customer_name'] = $customer['customer_name'];
    $to = module_user::get_contacts(array('customer_id' => $quote['customer_id']));
    if ($quote['contact_user_id']) {
        $primary = module_user::get_user($quote['contact_user_id']);
        if ($primary) {
            $to_select = $primary['email'];
        }
    } else {
        if ($customer['primary_user_id']) {
            $primary = module_user::get_user($customer['primary_user_id']);
            if ($primary) {
                $to_select = $primary['email'];
            }
        }
    }
} else {
    $to = array();
}
$template->assign_values($quote);
ob_start();
module_email::print_compose(array('title' => _l('Email Quote: %s', $quote['name']), 'find_other_templates' => 'quote_email', 'current_template' => $template_name, 'customer_id' => $quote['customer_id'], 'quote_id' => $quote['quote_id'], 'debug_message' => 'Sending quote as email', 'to' => $to, 'to_select' => $to_select, 'bcc' => module_config::c('admin_email_address', ''), 'content' => $template->render('html'), 'subject' => $template->replace_description(), 'success_url' => module_quote::link_open($quote_id), 'cancel_url' => module_quote::link_open($quote_id), 'attachments' => array(array('path' => $pdf, 'name' => basename($pdf), 'preview' => module_quote::link_public_print($quote_id)))));
Ejemplo n.º 28
0
    ?>
				</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 
    }
Ejemplo n.º 29
0
    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();
    }
Ejemplo n.º 30
0
    $columns['quote_website'] = array('title' => module_config::c('project_name_single', 'Website'), 'callback' => function ($quote) {
        echo module_website::link_open($quote['website_id'], true);
    });
}
if (!isset($_REQUEST['customer_id']) && module_customer::can_i('view', 'Customers')) {
    $columns['quote_customer'] = array('title' => 'Customer', 'callback' => function ($quote) {
        echo module_customer::link_open($quote['customer_id'], true);
    });
}
$columns['quote_type'] = array('title' => 'Type', 'callback' => function ($quote) {
    echo htmlspecialchars($quote['type']);
});
$columns['quote_status'] = array('title' => 'Status', 'callback' => function ($quote) {
    echo htmlspecialchars($quote['status']);
});
if (module_config::c('quote_allow_staff_assignment', 1)) {
    $columns['quote_staff'] = array('title' => 'Staff Member', 'callback' => function ($quote) {
        echo module_user::link_open($quote['user_id'], true);
    });
}
if (module_job::can_i('view', 'Jobs')) {
    $job_ids = array();
    $columns['job'] = array('title' => 'Job', 'callback' => function ($quote) use(&$job_ids) {
        $job_ids = array();
        foreach (module_job::get_jobs(array('quote_id' => $quote['quote_id'])) as $job) {
            $job = module_job::get_job($job['job_id']);
            if (!$job) {
                continue;
            }
            echo module_job::link_open($job['job_id'], true);
            $job_ids[] = $job['job_id'];