当前位置: 首页>>代码示例>>PHP>>正文


PHP module_security::is_logged_in方法代码示例

本文整理汇总了PHP中module_security::is_logged_in方法的典型用法代码示例。如果您正苦于以下问题:PHP module_security::is_logged_in方法的具体用法?PHP module_security::is_logged_in怎么用?PHP module_security::is_logged_in使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在module_security的用法示例。


在下文中一共展示了module_security::is_logged_in方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle_hook

    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 
        }
    }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:27,代码来源:timer.php

示例2: init

 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);
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:13,代码来源:language.php

示例3: redirect_browser

 * 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')) {
    redirect_browser(_BASE_HREF);
}
$show_theme_selector = false;
$themes = module_theme::get_available_themes();
if (count($themes) > 1) {
    $show_theme_selector = true;
}
if ($show_theme_selector) {
    $settings = array(array('key' => 'theme_name', 'default' => 'default', 'type' => 'select', 'options' => $themes, 'options_array_id' => 'name', 'description' => 'Default theme to use'), array('key' => _THEME_CONFIG_PREFIX . 'theme_logo', 'default' => _BASE_HREF . 'images/logo.png', 'type' => 'text', 'description' => 'URL for header logo'), array('key' => _THEME_CONFIG_PREFIX . 'theme_favicon', 'default' => '', 'type' => 'text', 'description' => 'URL for favicon', 'help' => 'Please google for "How to make a favicon". It should be a small PNG or ICO image.'), array('key' => _THEME_CONFIG_PREFIX . 'theme_custom_css', 'default' => '', 'type' => 'textarea', 'description' => 'Custom CSS Code', 'help' => 'Add your own custom CSS code here and it will be included in all pages of the website. You may have to clear your browser cache in order to see these changes. This code is added to the "ext.php?m=theme&amp;h=css" file if you are looking at the page source code.'));
    if (module_security::is_logged_in() && module_config::c('theme_per_user', 0)) {
        $default_theme = is_dir('includes/plugin_theme/themes/metis/') ? 'metis' : 'default';
        $settings[] = array('key' => 'theme_name_' . module_security::get_loggedin_id(), 'default' => module_config::c('theme_name', $default_theme), 'options' => $themes, 'options_array_id' => 'name', 'type' => 'select', 'description' => 'Theme to use when logged into your account');
    }
    module_config::print_settings_form(array('title' => _l('Theme Settings'), 'settings' => $settings));
}
?>

<form action="" method="post">
    <input type="hidden" name="_config_settings_hook" value="save_config">

    <?php 
module_form::print_form_auth();
module_form::prevent_exit(array('valid_exits' => array('.submit_button')));
?>
开发者ID:sgh1986915,项目名称:php-crm,代码行数:30,代码来源:theme_settings.php

示例4: microtime

<?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 {
开发者ID:sgh1986915,项目名称:php-crm,代码行数:31,代码来源:ajax.php

示例5: init

 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);
         }
//.........这里部分代码省略.........
开发者ID:sgh1986915,项目名称:php-crm,代码行数:101,代码来源:config.php

示例6: init

    public function init()
    {
        $this->links = array();
        $this->product_types = array();
        $this->module_name = "product";
        $this->module_position = 31;
        $this->version = 2.155;
        // 2.155 - 2015-07-18 - product search
        // 2.154 - 2015-06-28 - started work on product API
        // 2.153 - 2015-02-12 - ui fix and product defaults (tax/bill/type)
        // 2.152 - 2014-01-23 - new quote feature
        // 2.151 - 2013-11-15 - working on new UI
        // 2.15 - 2013-10-02 - bulk product delete and product category import fix
        // 2.149 - 2013-09-08 - faq permission fix
        // 2.148 - 2013-08-07 - css improvement
        // 2.147 - 2013-06-16 - javascript fix
        // 2.146 - 2013-06-07 - further work on product categories
        // 2.145 - 2013-05-28 - further work on product categories
        // 2.144 - 2013-05-28 - started work on product categories
        // 2.143 - 2013-04-27 - css fix for large product list
        // 2.142 - 2013-04-16 - product fix in invoice
        // 2.141 - 2013-04-05 - product support in invoices
        // 2.14 - product import via CSV
        // 2.13 - permission fix
        // 2.12 - product permissions
        // 2.11 - initial release
        hook_add('api_callback_product', 'module_product::api_filter_product');
        if (module_security::is_logged_in() && self::can_i('view', 'Products')) {
            module_config::register_css('product', 'product.css');
            module_config::register_js('product', 'product.js');
            if (isset($_REQUEST['_products_ajax'])) {
                switch ($_REQUEST['_products_ajax']) {
                    case 'products_ajax_search':
                        //                        $sent = headers_sent($file, $line);
                        //                        echo 'here';
                        //                        print_r($sent);
                        //                        print_r($file);
                        //                        print_r($line);
                        if (self::$_product_count === false) {
                            self::$_product_count = count(self::get_products());
                        }
                        $product_name = isset($_REQUEST['product_name']) ? $_REQUEST['product_name'] : '';
                        if (self::$_product_count > 0) {
                            $search = array();
                            if (strlen($product_name) > 2) {
                                $search['general'] = $product_name;
                            }
                            $products = self::get_products($search);
                            if (count($products) > 0) {
                                // sort products by categories.
                                $products_in_categories = array();
                                foreach ($products as $product_id => $product) {
                                    if ($product['product_category_id'] && $product['product_category_name']) {
                                        if (!isset($products_in_categories[$product['product_category_name']])) {
                                            $products_in_categories[$product['product_category_name']] = array();
                                        }
                                        $products_in_categories[$product['product_category_name']][] = $product;
                                        unset($products[$product_id]);
                                    } else {
                                    }
                                }
                                $cat_id = 1;
                                ?>

                                <ul>
                                    <?php 
                                foreach ($products_in_categories as $category_name => $cat_products) {
                                    ?>

                                        <li>
                                            <a href="#" class="product_category_parent"><?php 
                                    echo htmlspecialchars($category_name);
                                    ?>
</a> (<?php 
                                    _e('%s products', count($cat_products));
                                    ?>
)
                                            <ul style="display:none;" id="product_category_<?php 
                                    echo $cat_id++;
                                    ?>
">
                                                <?php 
                                    foreach ($cat_products as $product) {
                                        ?>

                                                    <li>
                                                       <a href="#" onclick="return ucm.product.select_product(<?php 
                                        echo $product['product_id'];
                                        ?>
);"> <?php 
                                        echo htmlspecialchars($product['name']);
                                        ?>
</a>
                                                    </li>
                                                <?php 
                                    }
                                    ?>

                                            </ul>

//.........这里部分代码省略.........
开发者ID:sgh1986915,项目名称:php-crm,代码行数:101,代码来源:product.php

示例7: replace_content

 public function replace_content()
 {
     $content = $this->content;
     $this->add_tags($this->template_key, $this->values);
     // add todays date values
     if (!isset($this->values['day'])) {
         $this->values['day'] = date('d');
     }
     if (!isset($this->values['month'])) {
         $this->values['month'] = date('m');
     }
     if (!isset($this->values['year'])) {
         $this->values['year'] = date('y');
     }
     if (!isset($this->values['current_user']) && module_security::is_logged_in()) {
         $this->values['current_user'] = module_security::get_loggedin_id();
         $user_details = module_user::get_replace_fields(module_security::get_loggedin_id());
         foreach ($user_details as $key => $val) {
             $this->values['current_' . $key . ''] = $val;
         }
     }
     // basic conditional tags - eg: {if:name}Dear {name},{else:name}Hello,{endif:name}
     // todo - support nested if - pass to template module.
     $debug = false;
     if (preg_match_all('#\\{if:([^\\}=]+)([^\\}]*)\\}(.*){endif:\\1\\}.*#imsU', $content, $matches)) {
         foreach ($matches[1] as $key => $template_tag) {
             // does this first if have a conditional statement (eg: {if:STATUS=New}sdfasdf{else}asdfasdf{/if:STATUS}
             $bits = preg_split('#{else[^\\}]*}#', $matches[3][$key]);
             preg_match_all('#\\{(else)?(if:([^\\}=]+)([^\\}]*))?\\}#ims', $matches[0][$key], $elseif_matches);
             $new_content = false;
             if ($debug) {
                 echo $matches[0][$key] . "\n";
             }
             if ($debug) {
                 print_r($bits);
             }
             if ($debug) {
                 print_r($elseif_matches);
             }
             foreach ($elseif_matches[0] as $elseif_key => $elseif_condition) {
                 $template_tag_value = isset($this->values[strtolower($elseif_matches[3][$elseif_key])]) ? trim($this->values[strtolower($elseif_matches[3][$elseif_key])]) : '';
                 if (!strlen(trim($elseif_matches[3][$elseif_key]))) {
                     // we are at the final {else} statement, this means all other checks before have failed. we use this content.
                     if ($debug) {
                         echo "Reached final {else} statement, using this value\n";
                     }
                     $new_content = $bits[$elseif_key];
                     break;
                 } else {
                     if ($debug) {
                         echo "Checking {$elseif_condition} against " . $elseif_matches[3][$elseif_key] . " which has the value: " . $template_tag_value . "\n";
                     }
                     if (strlen($elseif_matches[4][$elseif_key]) && $elseif_matches[4][$elseif_key][0] == '=') {
                         // the if/elseif tag is checking a condition, rather than just an "does exist" check
                         $check_matching_value = ltrim(trim($elseif_matches[4][$elseif_key]), '=');
                         if ($debug) {
                             echo "Checking if it matches {$check_matching_value} \n";
                         }
                         if ($check_matching_value == $template_tag_value) {
                             if ($debug) {
                                 echo "YES WE HAVE A MATCH \n";
                             }
                             // this first if statement matches this query! yes!
                             // use its value in the final $new_content
                             $new_content = $bits[$elseif_key];
                             break;
                         } else {
                             if ($debug) {
                                 echo "No match this time \n";
                             }
                         }
                     } else {
                         // we're just checking if this value exists or not.
                         if (strlen($template_tag_value) > 0 && $template_tag_value != '0000-00-00' && $template_tag_value != _l('N/A')) {
                             // it's a match!
                             $new_content = $bits[$elseif_key];
                             break;
                         } else {
                             // no match, move onto next bit.
                         }
                     }
                 }
             }
             if ($debug) {
                 echo "Final content to use will be: \n" . $new_content;
             }
             $content = str_replace($matches[0][$key], $new_content, $content);
         }
     }
     foreach ($this->values as $key => $val) {
         if (is_array($val)) {
             continue;
         }
         // if this isn't a html field we add newlines.
         if (!preg_match('#<[^>]+>#', $val)) {
             // raw text. nl2br
             $val = nl2br($val);
         }
         $content = str_replace('{' . strtoupper($key) . '}', $val, $content);
         // we perform some basic arithmetic on some replace fields.
//.........这里部分代码省略.........
开发者ID:sgh1986915,项目名称:php-crm,代码行数:101,代码来源:template.php

示例8: run_cron

 public static function run_cron($debug = false)
 {
     // we only want to perform these cron actions if we're after a certain time of day
     // because we dont want to be generating these renewals and sending them at midnight, can get confusing
     $after_time = module_config::c('invoice_automatic_after_time', 7);
     $time_of_day = date('G');
     if ($time_of_day < $after_time) {
         if ($debug) {
             echo "Not performing automatic subscription operations until after {$after_time}:00 - it is currently {$time_of_day}:" . date('i') . "<br>\n";
         }
         return;
     }
     // find all automatic subscriptions and renew them (if applicable)
     $sql = "SELECT * FROM `" . _DB_PREFIX . "subscription` s ";
     $sql .= " WHERE s.automatic_renew = 1";
     $subscriptions = qa($sql);
     foreach ($subscriptions as $subscription) {
         if ($subscription['automatic_renew']) {
             if ($debug) {
                 echo "<br>\nProcessing subscription renewals for subscription " . module_subscription::link_open($subscription['subscription_id'], true) . "<br>\n<br>\n";
             }
             // find all the members/customers from this subscription
             //$members = module_subscription::get_subscribed_members($subscription['subscription_id']);
             //$customers = module_subscription::get_subscribed_customers($subscription['subscription_id']);
             $owners = module_subscription::get_subscribed_owners($subscription['subscription_id']);
             foreach ($owners as $member) {
                 if (!$member['next_generation_date'] || $member['next_generation_date'] == '0000-00-00') {
                     continue;
                 }
                 if (!$member['next_due_date'] || $member['next_due_date'] == '0000-00-00') {
                     continue;
                 }
                 if ($debug) {
                     echo "Doing: " . $member['owner_table'] . " " . $member['owner_id'] . "<br>\n";
                 }
                 // check permissions for logged in users, dont want the cron to run when someone is logged in and no access to this account.
                 if (module_security::is_logged_in()) {
                     switch ($member['owner_table']) {
                         case 'website':
                             $website_perm_check = module_website::get_website($member['owner_id']);
                             if (!$website_perm_check || $website_perm_check['website_id'] != $member['owner_id']) {
                                 continue 2;
                             }
                             if ($debug) {
                                 echo "permission pass for website: " . $website_perm_check['website_id'];
                             }
                             break;
                         case 'customer':
                             $customer_perm_check = module_customer::get_customer($member['owner_id']);
                             if (!$customer_perm_check || $customer_perm_check['customer_id'] != $member['owner_id']) {
                                 continue 2;
                             }
                             if ($debug) {
                                 echo "permission pass for customer: " . $customer_perm_check['customer_id'];
                             }
                             break;
                     }
                 }
                 // is the last invoice unpaid?
                 $history = self::get_subscription_history($subscription['subscription_id'], $member['owner_table'], $member['owner_id']);
                 $next_due_time_invoice_created = false;
                 $invoice_unpaid = false;
                 if (isset($member['recur_limit']) && (int) $member['recur_limit'] > 0 && count($history) >= (int) $member['recur_limit']) {
                     if ($debug) {
                         echo " - not renewing this one because it has hit our recur limit of " . $member['recur_limit'] . "<br>\n";
                     }
                     continue;
                 }
                 foreach ($history as $h) {
                     $last_invoice = module_invoice::get_invoice($h['invoice_id']);
                     if (!$last_invoice || $last_invoice['date_cancel'] != '0000-00-00') {
                         continue;
                     }
                     // check the new 'next_due_date' entry in the db table
                     if (isset($h['from_next_due_date']) && $h['from_next_due_date'] && $h['from_next_due_date'] != '0000-00-00') {
                         // we're using the new method of checking when an invoice was generated, rather than the confusing invoice 'date_create' check below
                         if ($debug) {
                             echo " - checking if next_due_date " . print_date($member['next_due_date']) . " matches subscription history from_next_due_date for invoice " . module_invoice::link_open($h['invoice_id'], true, $last_invoice) . " from_next_due_date: " . print_date($h['from_next_due_date']) . " (invoice create_date: " . print_date($last_invoice['date_create']) . ")<br>\n";
                         }
                         if (print_date($member['next_due_date']) == print_date($h['from_next_due_date'])) {
                             //print_date($last_invoice['date_create'])){
                             // this invoice is for the next due date.
                             $next_due_time_invoice_created = $last_invoice;
                         }
                     } else {
                         if ($debug) {
                             echo " - checking if next_generation_date (" . print_date($member['next_generation_date']) . ") or next_due_date (" . print_date($member['next_due_date']) . ") matches invoice " . module_invoice::link_open($h['invoice_id'], true, $last_invoice) . " created date (" . print_date($last_invoice['date_create']) . ") <br>\n";
                         }
                         if (print_date($member['next_generation_date']) == print_date($last_invoice['date_create']) || print_date($member['next_due_date']) == print_date($last_invoice['date_create'])) {
                             //print_date($last_invoice['date_create'])){
                             // this invoice is for the next due date.
                             $next_due_time_invoice_created = $last_invoice;
                         }
                     }
                     if ($last_invoice['total_amount_due'] > 0) {
                         $invoice_unpaid = true;
                     }
                 }
                 //self::generate_subscription_invoice($subscription_id, $customer_hack, $member_id, $date, $amount)
                 $next_due_time = strtotime($member['next_generation_date']);
//.........这里部分代码省略.........
开发者ID:sgh1986915,项目名称:php-crm,代码行数:101,代码来源:subscription.php

示例9: save_quote_tasks

 private static function save_quote_tasks($quote_id, $data)
 {
     $result = array('status' => false);
     $check_completed = false;
     $quote_data = false;
     // check for new tasks or changed tasks.
     $tasks = self::get_tasks($quote_id);
     if (isset($data['quote_task']) && is_array($data['quote_task'])) {
         foreach ($data['quote_task'] as $quote_task_id => $task_data) {
             if (isset($task_data['manual_percent']) && strlen($task_data['manual_percent']) == 0) {
                 unset($task_data['manual_percent']);
             }
             $original_quote_task_id = $quote_task_id;
             $quote_task_id = (int) $quote_task_id;
             if (!is_array($task_data)) {
                 continue;
             }
             if ($quote_task_id > 0 && !isset($tasks[$quote_task_id])) {
                 $quote_task_id = 0;
                 // creating a new task on this quote.
             }
             if (!isset($task_data['description']) || $task_data['description'] == '' || $task_data['description'] == _TASK_DELETE_KEY) {
                 if ($quote_task_id > 0 && $task_data['description'] == _TASK_DELETE_KEY) {
                     // remove task.
                     // but onyl remove it if it hasn't been invoiced.
                     $sql = "DELETE FROM `" . _DB_PREFIX . "quote_task` WHERE quote_task_id = '{$quote_task_id}' AND quote_id = {$quote_id} LIMIT 1";
                     query($sql);
                     $result['status'] = 'deleted';
                     $result['quote_task_id'] = $quote_task_id;
                 }
                 continue;
             }
             // add / save this task.
             $task_data['quote_id'] = $quote_id;
             $task_data['hours'] = function_exists('decimal_time_in') ? decimal_time_in($task_data['hours']) : $task_data['hours'];
             // remove the amount of it equals the hourly rate.
             if (isset($task_data['amount']) && $task_data['amount'] != 0 && isset($task_data['hours']) && $task_data['hours'] > 0) {
                 if (isset($data['hourly_rate']) && $task_data['amount'] - $task_data['hours'] * $data['hourly_rate'] == 0) {
                     unset($task_data['amount']);
                 }
             }
             // check if we haven't unticked a non-hourly task
             // check if we haven't unticked a billable task
             if (isset($task_data['billable_t']) && $task_data['billable_t'] && !isset($task_data['billable'])) {
                 $task_data['billable'] = 0;
             }
             // set default taxable status
             if (!isset($task_data['taxable_t'])) {
                 // we're creating a new task.
                 $task_data['taxable'] = module_config::c('task_taxable_default', 1);
             }
             if (isset($task_data['taxable_t']) && $task_data['taxable_t'] && !isset($task_data['taxable'])) {
                 $task_data['taxable'] = 0;
             }
             // todo: move the task creation code into a public method so that the public user can add tasks to their quotes.
             if (!$quote_task_id && module_security::is_logged_in() && !module_quote::can_i('create', 'Quote Tasks')) {
                 continue;
                 // dont allow new tasks.
             }
             // check if the user is allowed to create new tasks.
             $quote_task_id = update_insert('quote_task_id', $quote_task_id, 'quote_task', $task_data);
             // todo - fix cross task quote boundary issue. meh.
             $result['quote_task_id'] = $quote_task_id;
             if ($quote_task_id != $original_quote_task_id) {
                 $result['status'] = 'created';
             } else {
                 $result['status'] = 'edited';
             }
         }
     }
     if ($check_completed) {
         self::update_quote_completion_status($quote_id);
     }
     module_cache::clear('quote');
     return $result;
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:76,代码来源:quote.php

示例10: process

    public function process()
    {
        if ("ajax_dashboard_tabs" == $_REQUEST['_process']) {
            header("Content-type: text/javascript");
            if (module_security::is_logged_in() && module_security::can_user(module_security::get_loggedin_id(), 'Show Dashboard Alerts')) {
                $items_to_hide = json_decode(module_config::c('_dashboard_item_hide' . module_security::get_loggedin_id(), '{}'), true);
                if (!is_array($items_to_hide)) {
                    $items_to_hide = array();
                }
                //$results = handle_hook("home_alerts");
                global $plugins;
                $tabid = 1;
                // Implicitly flush the buffer(s)
                @ini_set('implicit_flush', true);
                @ob_implicit_flush(true);
                ?>

	            var tabs = $('#dashboard_tabs'); //.tabs();
	            var ul = tabs.find( "ul" );
	            <?php 
                if (is_array($plugins)) {
                    foreach ($plugins as $plugin_name => $plugin) {
                        if (is_callable(array($plugin, 'handle_hook'))) {
                            $argv = array('home_alerts');
                            $this_return = call_user_func_array(array(&$plugin, 'handle_hook'), $argv);
                            if ($this_return !== false && $this_return !== null && is_array($this_return) && count($this_return)) {
                                // we found some home dashboard alerts! yew! print these out for our ajax display and exit, waiting for the next one.
                                uasort($this_return, 'sort_ajax_alert');
                                $dashboard_alerts = array();
                                foreach ($this_return as $alert) {
                                    $group_key = isset($alert['group']) ? $alert['group'] : $alert['item'];
                                    if (!isset($dashboard_alerts[$group_key])) {
                                        $dashboard_alerts[$group_key] = array();
                                    }
                                    $dashboard_alerts[$group_key][] = $alert;
                                }
                                if (!isset($_REQUEST['show_hidden'])) {
                                    foreach ($dashboard_alerts as $key => $val) {
                                        // see if any of these "$val" alert entries are marked as hidden
                                        foreach ($val as $k => $v) {
                                            $hide_key = md5($v['link'] . $v['item'] . (isset($v['name']) ? $v['name'] : ''));
                                            $dashboard_alerts[$key][$k]['hide_key'] = $val[$k]['hide_key'] = $hide_key;
                                            if (in_array($hide_key, $items_to_hide)) {
                                                unset($val[$k]);
                                                unset($dashboard_alerts[$key][$k]);
                                            }
                                        }
                                    }
                                }
                                //print_r($dashboard_alerts);
                                foreach ($dashboard_alerts as $key => $alerts) {
                                    if (!count($alerts)) {
                                        continue;
                                    }
                                    $tabid++;
                                    ?>

	                                $( "<li><a href='#newtab<?php 
                                    echo $tabid;
                                    ?>
'><?php 
                                    echo $key;
                                    ?>
 (<?php 
                                    echo count($alerts);
                                    ?>
)</a></li>" ).appendTo( ul );
	                                <?php 
                                    ob_start();
                                    if (isset(module_dashboard::$group_settings[$key])) {
                                        ?>

	                                <table class="tableclass tableclass_rows tableclass_full" id="alert_table_<?php 
                                        echo strtolower(str_replace(' ', '', $key));
                                        ?>
">
	                                    <thead>
		                                    <tr>
		                                        <?php 
                                        foreach (module_dashboard::$group_settings[$key]['columns'] as $column_key => $column_title) {
                                            ?>

		                                        <th class="alert_column_<?php 
                                            echo $column_key;
                                            ?>
"><?php 
                                            echo $column_title;
                                            ?>
</th>
		                                        <?php 
                                        }
                                        ?>

		                                        <th width="10" class="alert_column_delete"></th>
		                                    </tr>
	                                    </thead>
	                                    <tbody>
	                                        <?php 
                                        if (count($alerts)) {
                                            $y = 0;
//.........这里部分代码省略.........
开发者ID:sgh1986915,项目名称:php-crm,代码行数:101,代码来源:dashboard.php

示例11: put

 public static function put($group, $cache_key, $data, $seconds = false)
 {
     if (!module_config::c('cache_enabled', 1)) {
         return false;
     }
     if (!$seconds) {
         $seconds = module_config::c('cache_objects', 60);
     }
     $cache_key = module_security::get_loggedin_id() . '/' . $cache_key;
     $full_cache_key = $group . '||' . $cache_key;
     //if(!isset($_SESSION['_cache_keys']))$_SESSION['_cache_keys'] = array();
     //if(!isset($_SESSION['_cache_keys'][$group]))$_SESSION['_cache_keys'][$group] = array();
     //$_SESSION['_cache_keys'][$group][$cache_key] = true;
     //self::time_save($group.'||'.$cache_key,$data,$timeout);
     $data = array('create' => time(), 'd' => $data, 'e' => time() + $seconds);
     if (self::$_use_memcache) {
         // version this as well
         if (_DEBUG_MODE && module_config::c('cache_debug', 0)) {
             module_debug::log(array('title' => 'MemCache Time Save', 'data' => "For: {$full_cache_key} = Storing for {$seconds}"));
         }
         if (!self::$_memcache_instance->replace(self::$_memcache_prefix . $full_cache_key, $data, 0, $seconds)) {
             self::$_memcache_instance->set(self::$_memcache_prefix . $full_cache_key, $data, 0, $seconds);
         }
     } else {
         if (module_security::is_logged_in()) {
             self::$_db_cache[$group][$cache_key] = $data;
             //$data = serialize($data);
             if (_DEBUG_MODE && module_config::c('cache_debug', 0)) {
                 module_debug::log(array('title' => 'Cache Time Save', 'data' => "For: {$group} - {$cache_key} = Storing for {$seconds}"));
             }
             //if(strlen($data)>3000)return; // can have issues with sessions stored in db?
             /*if(self::db_table_exists('cache_store')){
                   $sql = "REPLACE INTO `"._DB_PREFIX."cache_store` SET `cache_group` = '".mysql_real_escape_string($group)."', `cache_key` = '".mysql_real_escape_string($cache_key)."', cache_data = '".mysql_real_escape_string($data)."', `create_user_id` = ".module_security::get_loggedin_id().", expire_time = ".((int)time()+$seconds);
                   query($sql);
               }*/
         }
         // just save in session for amount of time.
         /*if(!isset($_SESSION['_c'])){
               $_SESSION['_c'] = array();
           }
           $_SESSION['_c'][$full_cache_key] = array(
               'e' => time()+$seconds,
               'd'=>$data,
           );*/
     }
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:46,代码来源:cache.php

示例12: get_current_theme

 public static function get_current_theme()
 {
     if (_DEMO_MODE && get_display_mode() != 'mobile' && is_dir('includes/plugin_theme/themes/pro/')) {
         hook_add('header_print_js', 'module_theme::hook_header_print_js_demo');
         if (isset($_REQUEST['demo_theme'])) {
             $_SESSION['_demo_theme'] = basename($_REQUEST['demo_theme']);
             if (!$_SESSION['_demo_theme']) {
                 $_SESSION['_demo_theme'] = module_config::c('theme_name', 'default');
             }
         }
         $current_theme = isset($_SESSION['_demo_theme']) ? $_SESSION['_demo_theme'] : module_config::c('theme_name', 'default');
     } else {
         $current_theme = module_config::c('theme_name', is_dir('includes/plugin_theme/themes/metis/') ? 'metis' : 'default');
         if (module_security::is_logged_in() && module_config::c('theme_per_user', 0)) {
             // we allow users to pick their own themes.
             $current_theme = module_config::c('theme_name_' . module_security::get_loggedin_id(), self::$current_theme);
         }
     }
     return $current_theme;
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:20,代码来源:theme.php

示例13: ob_get_contents

                 $content = ob_get_contents();
                 ob_clean();
                 echo '<div class="final_content_wrap">';
                 echo $content;
                 echo '</div>';
             }
         }
         if (isset($links)) {
             unset($links);
         }
     }
     $inner_content[] = ob_get_clean();
     // END INNER CONTENT OB
 }
 // see if this module has a page title.
 if ($module && module_security::is_logged_in()) {
     if ($module->get_page_title()) {
         $page_title = htmlspecialchars($module->get_page_title()) . $page_title_delim . $page_title;
     }
 }
 if (isset($module)) {
     unset($module);
 }
 /*if(preg_match('#\{INNER_CONTENT\}#',$inner_content)){
 			$inner_content = preg_replace('#\{INNER_CONTENT\}#',$this_content,$inner_content);
 		}else{
 			$inner_content .= $this_content;
 		}
 		unset($this_content);*/
 unset($load_page);
 if ($display_mode == 'iframe' || $display_mode == 'ajax') {
开发者ID:sgh1986915,项目名称:php-crm,代码行数:31,代码来源:index.php

示例14: can_edit_tickets

 public static function can_edit_tickets()
 {
     return module_security::is_logged_in() && self::can_i('edit', 'Tickets');
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:4,代码来源:ticket.php

示例15: external_hook

    public function external_hook($hook)
    {
        switch ($hook) {
            case 'popup':
                // popup not used any more. cross domain issues.
                // load up the full script to be injected into our clients website.
                $website_id = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : false;
                $change_request_id = $change_id = isset($_REQUEST['change_id']) ? (int) $_REQUEST['change_id'] : false;
                $hash = isset($_REQUEST['hash']) ? $_REQUEST['hash'] : false;
                $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : false;
                if ($type == 'popupjs') {
                    @ob_end_clean();
                    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
                    header("Cache-Control: no-cache");
                    header("Pragma: no-cache");
                    header("Content-type: text/javascript");
                }
                if ($website_id && $hash && module_change_request::link_popup($website_id, true) == $hash) {
                    $change_history = module_change_request::get_remaining_changes($website_id);
                    $step = isset($_REQUEST['step']) ? (int) $_REQUEST['step'] : 0;
                    // get the change details out
                    if ($change_request_id) {
                        $change_request = module_change_request::get_change_request_by_website($website_id, $change_request_id);
                    } else {
                        $change_request = array();
                    }
                    if (!$change_request) {
                        $change_request = array('change_request_id' => 0, 'name' => '', 'request' => '', 'attachments' => array());
                    }
                    switch ($type) {
                        case 'save':
                            // saving a change.
                            $data = $_POST;
                            $data['url'] = urldecode($data['url']);
                            $data['website_id'] = $website_id;
                            $data['change_request_id'] = $change_request['change_request_id'];
                            if (isset($_REQUEST['completed_test'])) {
                                if (!isset($_REQUEST['completed']) || !$_REQUEST['completed']) {
                                    $data['status'] = _CHANGE_REQUEST_STATUS_NEW;
                                    // not completed.
                                } else {
                                    $data['status'] = _CHANGE_REQUEST_STATUS_COMPLETE;
                                    // completed!
                                }
                            }
                            if (isset($_REQUEST['delete_request'])) {
                                $data['status'] = _CHANGE_REQUEST_STATUS_DELETE;
                                // deleted
                            }
                            $change_request_id = update_insert('change_request_id', $change_request['change_request_id'], 'change_request', $data);
                            // redirect to send email page if we're logged in
                            if (module_security::is_logged_in() && isset($_REQUEST['completed_send_email']) && $_REQUEST['completed_send_email'] && self::can_i('edit', 'Change Requests')) {
                                // don't do the template, do the redirect to the email page (todo!)
                                redirect_browser(self::link_open($change_request_id));
                            } else {
                                // send email to administrator (everyone with change request edit permissions?) about this change request.
                                $alert_users = module_user::get_users_by_permission(array('category' => 'Change Request', 'name' => 'Change Requests', 'module' => 'change_request', 'edit' => 1));
                                $email_data = get_single('change_request', 'change_request_id', $change_request_id);
                                $customer_data = $website_data = array();
                                if ($website_id) {
                                    $website_data = module_website::get_website($website_id);
                                    $email_data['website_name'] = $website_data['name'];
                                    $email_data['website_link'] = module_website::link_open($website_id, true);
                                    if ($website_data && $website_data['customer_id']) {
                                        $customer_data = module_customer::get_customer($website_data['customer_id'], true);
                                    }
                                }
                                if (isset($email_data['request'])) {
                                    $email_data['request'] = nl2br($email_data['request']);
                                    // for the plain text emails.
                                }
                                foreach ($alert_users as $alert_user) {
                                    // todo: make sure this staff member has access to this website?
                                    // nfi how to figure this out. maybe we just look for staff members who are assigned jobs/tasks against this website?
                                    $template = module_template::get_template_by_key('change_request_alert_email');
                                    $template->assign_values(array_merge($customer_data, $website_data, $email_data));
                                    $html = $template->render('html');
                                    // send an email to this user.
                                    $email = module_email::new_email();
                                    $email->replace_values = array_merge($customer_data, $website_data, $email_data);
                                    $email->set_to('user', $alert_user['user_id']);
                                    $email->set_from('user', module_security::get_loggedin_id() ? module_security::get_loggedin_id() : isset($customer_data['primary_user_id']) ? $customer_data['primary_user_id'] : 0);
                                    $email->set_subject($template->description);
                                    // do we send images inline?
                                    $email->set_html($html);
                                    if ($email->send()) {
                                        // it worked successfully!!
                                        // sweet.
                                    } else {
                                        /// log err?
                                        set_error(_l('Failed to send change notification email to User ID: %s Email: %s Status: %s Error: %s', $alert_user['user_id'], json_encode($email->to), $email->status, $email->error_text));
                                    }
                                }
                            }
                            // display thankyou template.
                            module_template::init_template('change_request_submitted', '<h2>Change Request</h2>
    <p>Thank you. Your change request has been submitted successfully.</p>
    <p>Please <a href="{URL}">click here</a> to continue.</p>
    ', 'Displayed after a change request is created/updated.', 'code');
                            // correct!
//.........这里部分代码省略.........
开发者ID:sgh1986915,项目名称:php-crm,代码行数:101,代码来源:change_request.php


注:本文中的module_security::is_logged_in方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。