PHP define Examples

PHP define - 30 examples found. These are the top rated real world PHP examples of define extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
1
 function getdata($style, $parameter)
 {
     $array = array();
     foreach ($parameter as $key => $value) {
         if (is_array($value)) {
             $parameter[$key] = implode(',', $value);
         }
     }
     $parameter['clientid'] = $this->blockdata['clientid'];
     $parameter['op'] = 'getdata';
     $parameter['charset'] = CHARSET;
     $parameter['version'] = $this->blockdata['version'];
     $xmlurl = $this->blockdata['url'];
     $parse = parse_url($xmlurl);
     if (!empty($parse['host'])) {
         define('IN_ADMINCP', true);
         require_once libfile('function/importdata');
         $importtxt = @dfsockopen($xmlurl, 0, create_sign_url($parameter, $this->blockdata['key'], $this->blockdata['signtype']));
     } else {
         $importtxt = @file_get_contents($xmlurl);
     }
     if ($importtxt) {
         require libfile('class/xml');
         $array = xml2array($importtxt);
     }
     $idtype = 'xml_' . $this->blockdata['id'];
     foreach ($array['data'] as $key => $value) {
         $value['idtype'] = $idtype;
         $array['data'][$key] = $value;
     }
     if (empty($array['data'])) {
         $array['data'] = null;
     }
     return $array;
 }
 /**
  * Class constructor
  */
 public function __construct()
 {
     self::setconfig();
     define('M', $this->_m);
     define('F', $this->_f);
     define('V', $this->_v);
 }
function sendPushNotificationToGCM($registration_ids, $message)
{
    $GCM_SERVER_API_KEY = $_ENV["GCM_SERVER_API_KEY"];
    $url = 'https://fcm.googleapis.com/fcm/send';
    $fields = array('registration_ids' => $registration_ids, 'data' => $message);
    // Update your Google Cloud Messaging API Key
    if (!defined('GOOGLE_API_KEY')) {
        define("GOOGLE_API_KEY", $GCM_SERVER_API_KEY);
    }
    $headers = array('Authorization: key=' . GOOGLE_API_KEY, 'Content-Type: application/json');
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
    $result = curl_exec($ch);
    if ($result === FALSE) {
        die('Curl failed: ' . curl_error($ch));
    }
    curl_close($ch);
    return $result;
}
Example #4
0
 function initForm()
 {
     global $db, $cp, $spconfig;
     $do = $cp->getParam('do');
     // Cache Phrases
     $this->phrase = $cp->getPhrases("userIndex");
     $cp->header();
     switch ($_REQUEST['do']) {
         case 'add':
             $this->addAnnouncementForm();
             break;
         case 'add_confirm':
             $this->addAnnouncementCommit();
             break;
         case 'edit':
             $this->editAnnouncementForm();
             break;
         case 'edit_confirm':
             $this->editAnnouncementCommit();
             break;
         case 'delete':
             $this->deleteAnnouncementCommit();
             break;
         default:
             define('SUPPORTID', 'CPHOME');
             $this->mainForm();
             break;
     }
     $cp->footer();
 }
Example #5
0
 function cherry_plugin_settings()
 {
     global $wpdb;
     if (!function_exists('get_plugin_data')) {
         require_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     $upload_dir = wp_upload_dir();
     $plugin_data = get_plugin_data(plugin_dir_path(__FILE__) . 'cherry-plugin.php');
     //Cherry plugin constant variables
     define('CHERRY_PLUGIN_DIR', plugin_dir_path(__FILE__));
     define('CHERRY_PLUGIN_URL', plugin_dir_url(__FILE__));
     define('CHERRY_PLUGIN_DOMAIN', $plugin_data['TextDomain']);
     define('CHERRY_PLUGIN_DOMAIN_DIR', $plugin_data['DomainPath']);
     define('CHERRY_PLUGIN_VERSION', $plugin_data['Version']);
     define('CHERRY_PLUGIN_NAME', $plugin_data['Name']);
     define('CHERRY_PLUGIN_SLUG', plugin_basename(__FILE__));
     define('CHERRY_PLUGIN_DB', $wpdb->prefix . CHERRY_PLUGIN_DOMAIN);
     define('CHERRY_PLUGIN_REMOTE_SERVER', esc_url('http://tmbhtest.com/cherryframework.com/components_update/'));
     //Other constant variables
     define('CURRENT_THEME_DIR', get_stylesheet_directory());
     define('CURRENT_THEME_URI', get_stylesheet_directory_uri());
     define('UPLOAD_BASE_DIR', str_replace("\\", "/", $upload_dir['basedir']));
     define('UPLOAD_DIR', str_replace("\\", "/", $upload_dir['path'] . '/'));
     // if ( !defined('API_URL') ) {
     // 	define( 'API_URL', esc_url( 'http://updates.cherry.template-help.com/cherrymoto/v3/api/' ) );
     // }
     load_plugin_textdomain(CHERRY_PLUGIN_DOMAIN, false, dirname(plugin_basename(__FILE__)) . '/' . CHERRY_PLUGIN_DOMAIN_DIR);
     do_action('cherry_plugin_settings');
 }
Example #6
0
 /**
  * Perform installation.
  */
 function execute()
 {
     define('RUNNING_UPGRADE', 1);
     $templateMgr = TemplateManager::getManager($this->_request);
     $installer = new Upgrade($this->_data);
     // FIXME Use logger?
     // FIXME Mostly common with InstallForm
     if ($installer->execute()) {
         if (!$installer->wroteConfig()) {
             // Display config file contents for manual replacement
             $templateMgr->assign(array('writeConfigFailed' => true, 'configFileContents' => $installer->getConfigContents()));
         }
         $templateMgr->assign('notes', $installer->getNotes());
         $templateMgr->assign('newVersion', $installer->getNewVersion());
         $templateMgr->display('install/upgradeComplete.tpl');
     } else {
         switch ($installer->getErrorType()) {
             case INSTALLER_ERROR_DB:
                 $this->dbInstallError($installer->getErrorMsg());
                 break;
             default:
                 $this->installError($installer->getErrorMsg());
                 break;
         }
     }
     $installer->destroy();
 }
 function GPC()
 {
     if (!defined('str')) {
         define('str', 2);
     }
     if (!defined('int')) {
         define('int', 1);
     }
     if (!defined('arr_str')) {
         define('arr_str', 5);
     }
     if (!defined('arr_int')) {
         define('arr_int', 4);
     }
     if (!defined('none')) {
         define('none', 0);
     }
     if (!defined('arr_none')) {
         define('arr_none', 3);
     }
     if (!defined('db_esc')) {
         define('db_esc', 6);
     }
     if (!defined('html_enc')) {
         define('html_enc', 7);
     }
     if (!defined('path')) {
         define('path', 8);
     }
     $this->prepare_original = array('"', "'", '<', '>');
     $this->prepare_entity = array('&quot;', '&#039;', '&lt;', '&gt;');
     $this->php523 = version_compare(PHP_VERSION, '5.2.3', '>=');
 }
 /**
  * Set nocache constants and headers.
  *
  * @access private
  * @return void
  */
 private function nocache()
 {
     if (!defined('DONOTCACHEPAGE')) {
         define("DONOTCACHEPAGE", "true");
     }
     nocache_headers();
 }
 public function __construct()
 {
     define('job_bm_plugin_url', WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/');
     define('job_bm_plugin_dir', plugin_dir_path(__FILE__));
     define('job_bm_wp_url', 'https://wordpress.org/plugins/job-board-manager/');
     define('job_bm_wp_reviews', 'http://wordpress.org/support/view/plugin-reviews/job-board-manager');
     define('job_bm_pro_url', 'http://www.pickplugins.com/item/job-board-manager-create-job-site-for-wordpress/');
     define('job_bm_demo_url', 'www.pickplugins.com/demo/job-board-manager/');
     define('job_bm_conatct_url', 'http://www.pickplugins.com/contact/');
     define('job_bm_qa_url', 'http://www.pickplugins.com/questions/');
     define('job_bm_plugin_name', 'Job Board Manager');
     define('job_bm_plugin_version', '1.0.11');
     define('job_bm_customer_type', 'free');
     // pro & free
     define('job_bm_share_url', 'https://wordpress.org/plugins/job-board-manager/');
     define('job_bm_tutorial_video_url', '//www.youtube.com/embed/Z-ZzJiyVNJ4?rel=0');
     // Class
     require_once plugin_dir_path(__FILE__) . 'includes/class-post-types.php';
     require_once plugin_dir_path(__FILE__) . 'includes/class-post-meta.php';
     require_once plugin_dir_path(__FILE__) . 'includes/class-shortcodes.php';
     require_once plugin_dir_path(__FILE__) . 'includes/class-functions.php';
     require_once plugin_dir_path(__FILE__) . 'includes/class-settings.php';
     require_once plugin_dir_path(__FILE__) . 'includes/class-emails.php';
     //Front-end Forms Input Class
     require_once plugin_dir_path(__FILE__) . 'includes/class-frontend-forms-input.php';
     require_once plugin_dir_path(__FILE__) . 'includes/class-frontend-form-edit-job.php';
     require_once plugin_dir_path(__FILE__) . 'includes/class-frontend-form-new-job.php';
     require_once plugin_dir_path(__FILE__) . 'includes/ajax-upload.php';
     // Function's
     require_once plugin_dir_path(__FILE__) . 'includes/functions.php';
     add_action('admin_enqueue_scripts', 'wp_enqueue_media');
     add_action('wp_enqueue_scripts', array($this, 'job_bm_front_scripts'));
     add_action('admin_enqueue_scripts', array($this, 'job_bm_admin_scripts'));
 }
Example #10
0
 public function initializeContext()
 {
     global $smarty;
     // Clean all cache values
     Cache::clean('*');
     Context::getContext()->shop = new Shop(1);
     Shop::setContext(Shop::CONTEXT_SHOP, 1);
     Configuration::loadConfiguration();
     if (!isset(Context::getContext()->language) || !Validate::isLoadedObject(Context::getContext()->language)) {
         if ($id_lang = (int) Configuration::get('PS_LANG_DEFAULT')) {
             Context::getContext()->language = new Language($id_lang);
         }
     }
     if (!isset(Context::getContext()->country) || !Validate::isLoadedObject(Context::getContext()->country)) {
         if ($id_country = (int) Configuration::get('PS_COUNTRY_DEFAULT')) {
             Context::getContext()->country = new Country((int) $id_country);
         }
     }
     if (!isset(Context::getContext()->currency) || !Validate::isLoadedObject(Context::getContext()->currency)) {
         if ($id_currency = (int) Configuration::get('PS_CURRENCY_DEFAULT')) {
             Context::getContext()->currency = new Currency((int) $id_currency);
         }
     }
     Context::getContext()->cart = new Cart();
     Context::getContext()->employee = new Employee(1);
     if (!defined('_PS_SMARTY_FAST_LOAD_')) {
         define('_PS_SMARTY_FAST_LOAD_', true);
     }
     require_once _PS_ROOT_DIR_ . '/config/smarty.config.inc.php';
     Context::getContext()->smarty = $smarty;
 }
 function cs_framework_init()
 {
     // active modules
     defined('CS_ACTIVE_FRAMEWORK') or define('CS_ACTIVE_FRAMEWORK', true);
     defined('CS_ACTIVE_METABOX') or define('CS_ACTIVE_METABOX', true);
     defined('CS_ACTIVE_SHORTCODE') or define('CS_ACTIVE_SHORTCODE', true);
     defined('CS_ACTIVE_CUSTOMIZE') or define('CS_ACTIVE_CUSTOMIZE', true);
     // helpers
     cs_locate_template('functions/deprecated.php');
     cs_locate_template('functions/helpers.php');
     cs_locate_template('functions/actions.php');
     cs_locate_template('functions/enqueue.php');
     cs_locate_template('functions/sanitize.php');
     cs_locate_template('functions/validate.php');
     // classes
     cs_locate_template('classes/abstract.class.php');
     cs_locate_template('classes/options.class.php');
     cs_locate_template('classes/framework.class.php');
     cs_locate_template('classes/metabox.class.php');
     cs_locate_template('classes/taxonomy.class.php');
     cs_locate_template('classes/shortcode.class.php');
     cs_locate_template('classes/customize.class.php');
     // configs
     require_once locate_template('includes/resource/framework.config.php');
     require_once locate_template('includes/resource/metabox.config.php');
     require_once locate_template('includes/resource/taxonomy.config.php');
     require_once locate_template('includes/resource/shortcode.config.php');
     require_once locate_template('includes/resource/customize.config.php');
 }
Example #12
0
 function fuzzyTime($time)
 {
     define("ONE_DAY", 86400);
     $now = time();
     // sod = start of day :)
     $sod = mktime(0, 0, 0, date("m", $time), date("d", $time), date("Y", $time));
     $sod_now = mktime(0, 0, 0, date("m", $now), date("d", $now), date("Y", $now));
     // check 'today'
     if ($sod_now == $sod) {
         return "Today at " . date("g:ia", $time);
     }
     // check 'yesterday'
     if ($sod_now - $sod <= 86400) {
         return "Yesterday at " . date("g:ia", $time);
     }
     // give a day name if within the last 5 days
     if ($sod_now - $sod <= ONE_DAY * 5) {
         return date("l \\a\\t g:ia", $time);
     }
     // miss off the year if it's this year
     if (date("Y", $now) == date("Y", $time)) {
         return date("F j,Y \\a\\t g:ia", $time);
     }
     // return the date as normal
     return date("M j, Y \\a\\t g:ia", $time);
 }
Example #13
0
 /**
  * Constructor function. Arguments:
  * $params - An assoc array of parameters:
  *
  *   host    - The hostname of the smtp server		Default: localhost
  *   port    - The port the smtp server runs on		Default: 25
  *   helo    - What to send as the HELO command		Default: localhost
  *             (typically the hostname of the
  *             machine this script runs on)
  *   auth    - Whether to use basic authentication	Default: FALSE
  *   user    - Username for authentication			Default: <blank>
  *   pass    - Password for authentication			Default: <blank>
  *   timeout - The timeout in seconds for the call	Default: 5
  *             to fsockopen()
  */
 function smtp($params = array())
 {
     if (!defined('CRLF')) {
         define('CRLF', "\r\n", TRUE);
     }
     $this->authenticated = FALSE;
     $this->timeout = 5;
     $this->status = SMTP_STATUS_NOT_CONNECTED;
     if (!empty($GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST'])) {
         $helo = $GLOBALS['HTTP_SERVER_VARS']['HTTP_HOST'];
     } elseif (!empty($GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME'])) {
         $helo = $GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME'];
     } else {
         $helo = 'localhost';
     }
     $this->host = $_SESSION['SMTPSettings']['host'];
     $this->port = $_SESSION['SMTPSettings']['port'];
     $this->helo = $_SESSION['SMTPSettings']['heloaddress'];
     $this->auth = $_SESSION['SMTPSettings']['auth'];
     $this->user = html_entity_decode($_SESSION['SMTPSettings']['username']);
     $this->pass = html_entity_decode($_SESSION['SMTPSettings']['password']);
     $this->errors = array();
     foreach ($params as $key => $value) {
         $this->{$key} = $value;
     }
 }
Example #14
0
/**
 * Things to run during init hook
 *
 * @since 0.8.6
 */
function nktagcloud_init()
{
    // http://codex.wordpress.org/Determining_Plugin_and_Content_Directories
    // Pre-2.6 compatibility
    if (!defined('WP_CONTENT_URL')) {
        define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
    }
    if (!defined('WP_CONTENT_DIR')) {
        define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
    }
    if (!defined('WP_PLUGIN_URL')) {
        define('WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins');
    }
    if (!defined('WP_PLUGIN_DIR')) {
        define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');
    }
    global $nktagcloud;
    $nktagcloud = array('path' => WP_PLUGIN_DIR . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)), 'url' => WP_PLUGIN_URL . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)));
    // always needed for footer link
    // TODO which footer link? we don't need this in admin, or do we?
    require_once 'inc/page.php';
    if (is_admin()) {
        require_once 'inc/admin.php';
        add_action('admin_menu', 'nktagcloud_add_pages');
        register_widget_control(__('Better Tag Cloud', 'nktagcloud'), 'nktagcloud_control');
        register_sidebar_widget(__('Better Tag Cloud', 'nktagcloud'), 'widget_nktagcloud');
    } else {
        add_shortcode('nktagcloud', 'nktagcloud_shortcode');
        add_shortcode('nktagcloud_single', 'nktagcloud_single_shortcode');
        register_sidebar_widget(__('Better Tag Cloud', 'nktagcloud'), 'widget_nktagcloud');
    }
}
Example #15
0
 function constants($options)
 {
     define("THEME_DIR", get_template_directory());
     define("THEME_DIR_URI", get_template_directory_uri());
     define("THEME_NAME", $options["theme_name"]);
     if (defined("ICL_LANGUAGE_CODE")) {
         $lang = "_" . ICL_LANGUAGE_CODE;
     } else {
         $lang = "";
     }
     define("THEME_OPTIONS", $options["theme_name"] . '_options' . $lang);
     define("THEME_SLUG", $options["theme_slug"]);
     define("THEME_STYLES", THEME_DIR_URI . "/stylesheet/css");
     define("THEME_IMAGES", THEME_DIR_URI . "/images");
     define("THEME_JS", THEME_DIR_URI . "/js");
     define('FONTFACE_DIR', THEME_DIR . '/fontface');
     define('FONTFACE_URI', THEME_DIR_URI . '/fontface');
     define("THEME_FRAMEWORK", THEME_DIR . "/framework");
     define("THEME_PLUGINS", THEME_FRAMEWORK . "/plugins");
     define("THEME_ACTIONS", THEME_FRAMEWORK . "/actions");
     define("THEME_PLUGINS_URI", THEME_DIR_URI . "/framework/plugins");
     define("THEME_SHORTCODES", THEME_FRAMEWORK . "/shortcodes");
     define("THEME_WIDGETS", THEME_FRAMEWORK . "/widgets");
     define("THEME_SLIDERS", THEME_FRAMEWORK . "/sliders");
     define("THEME_HELPERS", THEME_FRAMEWORK . "/helpers");
     define("THEME_FUNCTIONS", THEME_FRAMEWORK . "/functions");
     define("THEME_CLASSES", THEME_FRAMEWORK . "/classes");
     define('THEME_ADMIN', THEME_FRAMEWORK . '/admin');
     define('THEME_METABOXES', THEME_ADMIN . '/metaboxes');
     define('THEME_ADMIN_POST_TYPES', THEME_ADMIN . '/post-types');
     define('THEME_GENERATORS', THEME_ADMIN . '/generators');
     define('THEME_ADMIN_URI', THEME_DIR_URI . '/framework/admin');
     define('THEME_ADMIN_ASSETS_URI', THEME_DIR_URI . '/framework/admin/assets');
 }
 public function setUp()
 {
     if (!defined('PHPEXCEL_ROOT')) {
         define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
     }
     require_once PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php';
 }
Example #17
0
 /**
  * Define Meta Slider constants
  */
 private function define_constants()
 {
     define('METASLIDER_VERSION', $this->version);
     define('METASLIDER_BASE_URL', trailingslashit(plugins_url('ml-slider')));
     define('METASLIDER_ASSETS_URL', trailingslashit(METASLIDER_BASE_URL . 'assets'));
     define('METASLIDER_PATH', plugin_dir_path(__FILE__));
 }
Example #18
0
 function sendMemberDaytimeToAdmin($member_id, $service_id, $daytime_id)
 {
     define("BodyMemberDaytimeToAdmin", "<h1>Nouvelle inscription à une tranche horaire</h1><p>Un bénévole s'est inscrit à un secteur / tranche horaire.</p><p><strong>Nom :</strong> %s <br /><strong>Secteur :</strong> %s<br /><strong>Date :</strong> %s<br /><strong>Tranche horaire :</strong> %s</p><p><a href=\"" . JURI::root() . "/administrator/index.php?option=com_estivole&view=member&layout=edit&member_id=%s\">Cliquez ici</a> pour valider l'inscription et/ou recontacter le bénévole.</p>");
     define("SubjectMemberDaytimeToAdmin", "Nouvelle inscription à une tranche horaire");
     $db = JFactory::getDBO();
     $query = $db->getQuery(TRUE);
     $this->user = JFactory::getUser();
     // Get the dispatcher and load the user's plugins.
     $dispatcher = JEventDispatcher::getInstance();
     JPluginHelper::importPlugin('user');
     $data = new JObject();
     $data->id = $this->user->id;
     // Trigger the data preparation event.
     $dispatcher->trigger('onContentPrepareData', array('com_users.profilestivole', &$data));
     $userProfilEstivole = $data;
     $userName = $userProfilEstivole->profilestivole['firstname'] . ' ' . $userProfilEstivole->profilestivole['lastname'];
     $query->select('*');
     $query->from('#__estivole_members as b, #__estivole_services as s, #__estivole_daytimes as d');
     $query->where('b.member_id = ' . (int) $member_id);
     $query->where('s.service_id = ' . (int) $service_id);
     $query->where('d.daytime_id = ' . (int) $daytime_id);
     $db->setQuery($query);
     $mailModel = $db->loadObject();
     $mail = JFactory::getMailer();
     $mail->setBody(sprintf(constant("BodyMemberDaytimeToAdmin"), $userName, $mailModel->service_name, date('d-m-Y', strtotime($mailModel->daytime_day)), date('H:i', strtotime($mailModel->daytime_hour_start)) . ' - ' . date('H:i', strtotime($mailModel->daytime_hour_end)), $mailModel->member_id));
     $mail->setSubject(constant("SubjectMemberDaytimeToAdmin"));
     $mail->isHtml();
     $recipient = array('benevoles@estivale.ch', $mailModel->email_responsable);
     $mail->addRecipient($recipient);
     $mail->Send('estivole@estivale.ch');
 }
 /**
  * @param ContainerInterface $container
  * @param $options
  * @return DOMPDF
  */
 public function createPDF(ContainerInterface $container, $options)
 {
     if (defined('DOMPDF_DIR') === false) {
         define("DOMPDF_DIR", __DIR__ . '/../../../../../../dompdf/dompdf');
     }
     if (defined('DOMPDF_INC_DIR') === false) {
         define("DOMPDF_INC_DIR", DOMPDF_DIR . "/include");
     }
     if (defined('DOMPDF_LIB_DIR') === false) {
         define("DOMPDF_LIB_DIR", DOMPDF_DIR . "/lib");
     }
     if (defined('DOMPDF_AUTOLOAD_PREPEND') === false) {
         define("DOMPDF_AUTOLOAD_PREPEND", false);
     }
     if (defined('DOMPDF_ADMIN_USERNAME') === false) {
         define("DOMPDF_ADMIN_USERNAME", false);
     }
     if (defined('DOMPDF_ADMIN_PASSWORD') === false) {
         define("DOMPDF_ADMIN_PASSWORD", false);
     }
     foreach ($options as $key => $value) {
         if (!array_key_exists($key, static::$configCompatMapping)) {
             continue;
         }
         if (defined(static::$configCompatMapping[$key])) {
             continue;
         }
         define(static::$configCompatMapping[$key], $value);
     }
     require_once DOMPDF_LIB_DIR . '/html5lib/Parser.php';
     require_once DOMPDF_INC_DIR . '/functions.inc.php';
     return new DOMPDF();
 }
Example #20
0
 public static function construct()
 {
     global $cookie_lifetime;
     $path = str_replace("index.php", "", $_SERVER['SCRIPT_FILENAME']);
     foreach (array("components", "plugins") as $folder) {
         if (strpos($_SERVER['SCRIPT_FILENAME'], $folder)) {
             $path = substr($_SERVER['SCRIPT_FILENAME'], 0, strpos($_SERVER['SCRIPT_FILENAME'], $folder));
             break;
         }
     }
     if (file_exists($path . 'config.php')) {
         require_once $path . 'config.php';
     }
     if (!defined('BASE_PATH')) {
         define('BASE_PATH', rtrim(str_replace("index.php", "", $_SERVER['SCRIPT_FILENAME']), "/"));
     }
     if (!defined('COMPONENTS')) {
         define('COMPONENTS', BASE_PATH . '/components');
     }
     if (!defined('PLUGINS')) {
         define('PLUGINS', BASE_PATH . '/plugins');
     }
     if (!defined('DATA')) {
         define('DATA', BASE_PATH . '/data');
     }
     if (!defined('THEMES')) {
         define("THEMES", BASE_PATH . "/themes");
     }
     if (!defined('THEME')) {
         define("THEME", "default");
     }
 }
Example #21
0
 public static function init()
 {
     list($id, $key) = self::_get_id_and_key();
     if (!$id || !$key) {
         define('CLOUD_NOT_INITED', true);
     }
 }
 function _extract($package, $target)
 {
     // First extract files
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.archive');
     jimport('joomla.filesystem.path');
     $adapter =& JArchive::getAdapter('zip');
     $result = $adapter->extract($package, $target);
     if (!is_dir($target)) {
         require_once PATH_ROOT . 'administrator' . DS . 'includes' . DS . 'pcl' . DS . 'pclzip.lib.php';
         require_once PATH_ROOT . 'administrator' . DS . 'includes' . DS . 'pcl' . DS . 'pclerror.lib.php';
         $extract = new PclZip($package);
         if (substr(PHP_OS, 0, 3) == 'WIN') {
             if (!defined('OS_WINDOWS')) {
                 define('OS_WINDOWS', 1);
             }
         } else {
             if (!defined('OS_WINDOWS')) {
                 define('OS_WINDOWS', 0);
             }
         }
         $result = $extract->extract(PCLZIP_OPT_PATH, $target);
     }
     return $result;
 }
Example #23
0
 /**
  * [__construct description]
  */
 function __construct()
 {
     if (!defined("WOABSPATH")) {
         define("WOABSPATH", dirname(__FILE__));
     }
     if (!defined("WOURI")) {
         define("WOURI", plugins_url("/", __FILE__));
     }
     if (function_exists("__autoload")) {
         spl_autoload_register("__autoload");
     }
     spl_autoload_register(array($this, 'autoload'));
     /**
      * Custom auth hook
      * This MUST run before anything just to be safe. 20 seems to be the highest so we will stay close with 
      * priority set to 21
      *
      * @since 3.1.3
      */
     add_filter('determine_current_user', array($this, '_wo_authenicate_bypass'), 10);
     /** 
      * load all dependents
      *
      * @since 1.0.0
      */
     add_action("init", array(__CLASS__, "includes"));
 }
Example #24
0
function run_propel_build_sql_diff($task, $args)
{
    if (!count($args)) {
        throw new Exception('You must provide the application.');
    }
    $app = $args[0];
    if (!is_dir(sfConfig::get('sf_app_dir') . DIRECTORY_SEPARATOR . $app)) {
        throw new Exception(sprintf('The app "%s" does not exist.', $app));
    }
    run_propel_build_sql($task, $args);
    pake_echo_action('propel-sql-diff', "building database patch");
    define('SF_ROOT_DIR', realpath(dirname(__FILE__) . '/../../../..'));
    define('SF_APP', $app);
    define('SF_ENVIRONMENT', isset($args[1]) ? $args[1] : 'dev');
    define('SF_DEBUG', 1);
    require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
    $databaseManager = new sfDatabaseManager();
    $databaseManager->initialize();
    $i = new dbInfo();
    $i->loadFromDb();
    $i2 = new dbInfo();
    $i2->loadAllFilesInDir(sfConfig::get('sf_data_dir') . '/sql');
    $diff = $i->getDiffWith($i2);
    $filename = sfConfig::get('sf_data_dir') . '/sql/diff.sql';
    if ($diff == '') {
        pake_echo_comment("no difference found");
    }
    pake_echo_action('propel-sql-diff', "writing file {$filename}");
    file_put_contents($filename, $diff);
}
 public function submitPayment()
 {
     $dir = $this->getMethodDirectory();
     require_once $dir . 'anet_php_sdk/AuthorizeNet.php';
     $METHOD_TO_USE = "AIM";
     define("AUTHORIZENET_API_LOGIN_ID", Config::get('vividstore.authnetLoginID'));
     // Add your API LOGIN ID
     define("AUTHORIZENET_TRANSACTION_KEY", Config::get('vividstore.authnetTransactionKey'));
     // Add your API transaction key
     define("AUTHORIZENET_SANDBOX", Config::get('vividstore.authnetTestmode'));
     // Set to false to test against production
     define("TEST_REQUEST", "FALSE");
     // You may want to set to true if testing against production
     //define("AUTHORIZENET_MD5_SETTING","");                // Add your MD5 Setting.
     //$site_root = ""; // Add the URL to your site
     if (AUTHORIZENET_API_LOGIN_ID == "") {
         die('Enter your merchant credentials');
     }
     $transaction = new AuthorizeNetAIM();
     $transaction->setSandbox(AUTHORIZENET_SANDBOX);
     $transaction->setFields(array('amount' => Price::getFloat(VividCart::getTotal()), 'card_num' => $_POST['authnet-checkout-credit-card'], 'exp_date' => $_POST['authnet-checkout-exp-month'] . $_POST['authnet-checkout-exp-year']));
     $response = $transaction->authorizeAndCapture();
     if ($response->approved) {
         return true;
     } else {
         return array('error' => 1, 'errorMessage' => $response->error_message . " Error Code: " . $response->response_code . ". Message: " . $response->response_reason_text);
     }
 }
 /**
  * Constructor
  *
  * @access	public
  * @param	object		ipsRegistry reference
  * @param	array 		Configuration info for this method
  * @param	array 		Custom configuration info for this method
  * @return	void
  */
 public function __construct(ipsRegistry $registry, $method, $conf = array())
 {
     $this->method_config = $method;
     $this->openid_config = $conf;
     parent::__construct($registry);
     //-----------------------------------------
     // Fix include path for OpenID libs
     //-----------------------------------------
     $path_extra = dirname(__FILE__);
     $path = ini_get('include_path');
     $path = $path_extra . PATH_SEPARATOR . $path;
     ini_set('include_path', $path);
     define('Auth_OpenID_RAND_SOURCE', null);
     //-----------------------------------------
     // OpenID libraries are not STRICT compliant
     //-----------------------------------------
     ob_start();
     /**
      * Turn off strict error reporting for openid
      */
     if (version_compare(PHP_VERSION, '5.2.0', '>=')) {
         error_reporting(E_ERROR | E_WARNING | E_PARSE | E_RECOVERABLE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_USER_WARNING);
     } else {
         error_reporting(E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR | E_USER_ERROR | E_USER_WARNING);
     }
     //-----------------------------------------
     // And grab libs
     //-----------------------------------------
     require_once "Auth/OpenID/Consumer.php";
     require_once "Auth/OpenID/FileStore.php";
     require_once "Auth/OpenID/SReg.php";
     require_once "Auth/OpenID/PAPE.php";
 }
Example #27
0
 public static function apiUpdateOrder($order, $response)
 {
     if (!defined('ORDER_MANAGEMENT')) {
         define('ORDER_MANAGEMENT', true);
     }
     if (!empty($order['status'])) {
         $statuses = fn_get_statuses(STATUSES_ORDER, false, true);
         if (!isset($statuses[$order['status']])) {
             $response->addError('ERROR_OBJECT_UPDATE', str_replace('[object]', 'orders', __('twgadmin_wrong_api_object_data')));
         } else {
             fn_change_order_status($order['order_id'], $order['status']);
         }
     }
     $cart = array();
     fn_clear_cart($cart, true);
     $customer_auth = fn_fill_auth(array(), array(), false, 'C');
     fn_form_cart($order['order_id'], $cart, $customer_auth);
     $cart['order_id'] = $order['order_id'];
     // update only profile data
     $profile_data = fn_check_table_fields($order, 'user_profiles');
     $cart['user_data'] = fn_array_merge($cart['user_data'], $profile_data);
     $cart['user_data'] = fn_array_merge($cart['user_data'], $order);
     fn_calculate_cart_content($cart, $customer_auth, 'A', true, 'I');
     if (!empty($order['details'])) {
         db_query('UPDATE ?:orders SET details = ?s WHERE order_id = ?i', $order['details'], $order['order_id']);
     }
     if (!empty($order['notes'])) {
         $cart['notes'] = $order['notes'];
     }
     fn_update_payment_surcharge($cart, $customer_auth);
     list($order_id, $process_payment) = fn_place_order($cart, $customer_auth, 'save');
     return array($order_id, $process_payment);
 }
Example #28
0
 /**
  * Index Page for this controller.
  *
  * Maps to the following URL
  * 		http://example.com/index.php/welcome
  *	- or -  
  * 		http://example.com/index.php/welcome/index
  *	- or -
  * Since this controller is set as the default controller in 
  * config/routes.php, it's displayed at http://example.com/
  *
  * So any other public methods not prefixed with an underscore will
  * map to /index.php/welcome/<method_name>
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 function __construct()
 {
     parent::__construct();
     $this->load->library('session');
     $this->load->library('encrypt');
     // Si la sesion no tiene datos, redireccionarlo fuera del sistema
     $ci_session = $this->session->userdata('username');
     if (empty($ci_session) === TRUE) {
         redirect(base_url('entrar'));
     }
     // Se Definen constantes para facilitar la programacion
     define("SUPERROL", 1);
     // "SuperAdministrador"
     define('ROL', $this->session->userdata('rol'));
     define('COMPONENTE', $this->uri->segment(1));
     define('USER', $this->session->userdata('username'));
     //
     $this->load->model('permisos_model');
     $this->load->model('tbl_empleado_crud_model');
     $this->load->model('tbl_internet_crud_model');
     $this->load->model('tbl_roles_model');
     /*
      * Tabla de Roles:
      * 1.- Super Administrador
      * 2.- Administrador
      * 3.- Capturista
      */
 }
 /**
  * Add facebook user
  */
 public function addUserFacebook($aVals, $iFacebookUserId, $sAccessToken)
 {
     if (!defined('PHPFOX_IS_FB_USER')) {
         define('PHPFOX_IS_FB_USER', true);
     }
     //get facebook setting
     $bFbConnect = Phpfox::getParam('facebook.enable_facebook_connect');
     if ($bFbConnect == false) {
         return false;
     } else {
         if (Phpfox::getService('accountapi.facebook')->checkUserFacebook($iFacebookUserId) == false) {
             if (Phpfox::getParam('user.disable_username_on_sign_up')) {
                 $aVals['user_name'] = Phpfox::getLib('parse.input')->cleanTitle($aVals['full_name']);
             }
             $aVals['country_iso'] = null;
             if (Phpfox::getParam('user.split_full_name')) {
                 $aNameSplit = preg_split('[ ]', $aVals['full_name']);
                 $aVals['first_name'] = $aNameSplit[0];
                 unset($aNameSplit[0]);
                 $aVals['last_name'] = implode(' ', $aNameSplit);
             }
             $iUserId = Phpfox::getService('user.process')->add($aVals);
             if ($iUserId === false) {
                 return false;
             } else {
                 Phpfox::getService('facebook.process')->addUser($iUserId, $iFacebookUserId);
                 //update fb profile image to db
                 $bCheck = Phpfox::getService('accountapi.facebook')->addImagePicture($sAccessToken, $iUserId);
             }
         }
     }
     return true;
 }
Example #30
0
 /**
  * initialize method
  *
  * Merge settings and set Config.language to a valid locale
  *
  * @return void
  * @access public
  */
 function initialize(&$Controller, $config = array())
 {
     App::import('Vendor', 'Mi.MiCache');
     $lang = MiCache::setting('Site.lang');
     if (!$lang) {
         if (!defined('DEFAULT_LANGUAGE')) {
             return;
         }
         $lang = DEFAULT_LANGUAGE;
     } elseif (!defined('DEFAULT_LANGUAGE')) {
         define('DEFAULT_LANGUAGE', $lang);
     }
     Configure::write('Config.language', $lang);
     App::import('Core', 'I18n');
     $I18n =& I18n::getInstance();
     $I18n->domain = 'default_' . $lang;
     $I18n->__lang = $lang;
     $I18n->l10n->get($lang);
     if (!empty($Controller->plugin)) {
         $config['plugins'][] = Inflector::underscore($Controller->plugin);
     }
     if (!empty($config['plugins'])) {
         $plugins = array_intersect(MiCache::mi('plugins'), $config['plugins']);
         $Inst = App::getInstance();
         foreach ($plugins as $path => $name) {
             $Inst->locales[] = $path . DS . 'locale' . DS;
         }
     }
 }