• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP tpl_fetch函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中tpl_fetch函数的典型用法代码示例。如果您正苦于以下问题:PHP tpl_fetch函数的具体用法?PHP tpl_fetch怎么用?PHP tpl_fetch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: execute

 /**
  * Execute the script
  *
  * @param void
  * @return boolean
  */
 function execute()
 {
     // ---------------------------------------------------
     //  Check MySQL version
     // ---------------------------------------------------
     $mysql_version = mysql_get_server_info($this->database_connection);
     if ($mysql_version && version_compare($mysql_version, '4.1', '>=')) {
         $constants['DB_CHARSET'] = 'utf8';
         @mysql_query("SET NAMES 'utf8'", $this->database_connection);
         tpl_assign('default_collation', $default_collation = 'collate utf8_unicode_ci');
         tpl_assign('default_charset', $default_charset = 'DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci');
     } else {
         tpl_assign('default_collation', $default_collation = '');
         tpl_assign('default_charset', $default_charset = '');
     }
     // if
     tpl_assign('table_prefix', TABLE_PREFIX);
     // ---------------------------------------------------
     //  Execute migration
     // ---------------------------------------------------
     $total_queries = 0;
     $executed_queries = 0;
     $upgrade_script = tpl_fetch(get_template_path('db_migration/1_0_milanga'));
     if ($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) {
         $this->printMessage("Database schema transformations executed (total queries: {$total_queries})");
     } else {
         $this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true);
         return false;
     }
     // if
     $this->printMessage('Feng Office has been upgraded. You are now running Feng Office ' . $this->getVersionTo() . ' Enjoy!');
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:38,代码来源:MilangaUpgradeScript.class.php


示例2: advanced_pagination

/**
 * Advanced pagination. Differenced between simple and advanced paginations is that 
 * advanced pagination uses template so its output can be changed in a great number of ways.
 * 
 * All variables are just passed to the template, nothing is done inside the function!
 *
 * @access public
 * @param DataPagination $pagination Pagination object
 * @param string $url_base Base URL in witch we will insert current page number
 * @param string $template Template that will be used. It can be absolute path to existing file
 *   or template name that used with get_template_path will return real template path
 * @param string $page_placeholder Short string inside of $url_base that will be replaced with
 *   current page numer
 * @return null
 */
function advanced_pagination(DataPagination $pagination, $url_base, $template = 'advanced_pagination', $page_placeholder = '#PAGE#')
{
    tpl_assign(array('advanced_pagination_object' => $pagination, 'advanced_pagination_url_base' => $url_base, 'advanced_pagination_page_placeholder' => urlencode($page_placeholder)));
    // tpl_assign
    $template_path = is_file($template) ? $template : get_template_path($template);
    return tpl_fetch($template_path);
}
开发者ID:469306621,项目名称:Languages,代码行数:22,代码来源:pagination.php


示例3: smarty_function_include_layout

/**
 * Include layout
 * 
 * Parameters:
 * 
 * - name - layout name
 * - module - module name
 *
 * @param array $params
 * @param Smarty $smarty
 * @return null
 */
function smarty_function_include_layout($params, &$smarty)
{
    $name = array_var($params, 'name');
    if (empty($name)) {
        return new InvalidParamError('name', $name, "'name' property is required for 'include_layout' helper", true);
    }
    // if
    $module = array_var($params, 'module');
    if (empty($module)) {
        return new InvalidParamError('module', $module, "'module' property is required for 'include_layout' helper", true);
    }
    // if
    return tpl_fetch(get_layout_path($name, $module));
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:26,代码来源:function.include_layout.php


示例4: ajx_check_login

/**
 * Checks whether the user is logged in and if not returns an error response.
 *
 */
function ajx_check_login()
{
    if (is_ajax_request() && !logged_user() instanceof Contact && (array_var($_GET, 'c') != 'access' || array_var($_GET, 'a') != 'relogin')) {
        // error, user not logged in => return error message
        $response = AjaxResponse::instance();
        $response->setCurrentContent("empty");
        $response->setError(SESSION_EXPIRED_ERROR_CODE, lang("session expired error"));
        // display the object as json
        tpl_assign("object", $response);
        $content = tpl_fetch(Env::getTemplatePath("json"));
        tpl_assign("content_for_layout", $content);
        tpl_display(Env::getLayoutPath("json"));
        exit;
    }
}
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:19,代码来源:ajax.php


示例5: execute

 /**
  * Execute the script
  *
  * @param void
  * @return boolean
  */
 function execute()
 {
     // ---------------------------------------------------
     //  Check MySQL version
     // ---------------------------------------------------
     $mysql_version = mysql_get_server_info($this->database_connection);
     if ($mysql_version && version_compare($mysql_version, '4.1', '>=')) {
         $constants['DB_CHARSET'] = 'utf8';
         @mysql_query("SET NAMES 'utf8'", $this->database_connection);
         tpl_assign('default_collation', $default_collation = 'collate utf8_unicode_ci');
         tpl_assign('default_charset', $default_charset = 'DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci');
     } else {
         tpl_assign('default_collation', $default_collation = '');
         tpl_assign('default_charset', $default_charset = '');
     }
     // if
     tpl_assign('table_prefix', TABLE_PREFIX);
     if (defined('DB_ENGINE')) {
         tpl_assign('engine', DB_ENGINE);
     } else {
         tpl_assign('engine', 'InnoDB');
     }
     // ---------------------------------------------------
     //  Execute migration
     // ---------------------------------------------------
     $total_queries = 0;
     $executed_queries = 0;
     $installed_version = installed_version();
     if (version_compare($installed_version, "1.1") <= 0) {
         $upgrade_script = tpl_fetch(get_template_path('db_migration/1_2_chinchulin'));
     } else {
         $upgrade_script = "DELETE FROM `" . TABLE_PREFIX . "config_options` WHERE `name` = 'time_format_use_24';\r\n\t\t\tUPDATE `" . TABLE_PREFIX . "config_options` SET `category_name` = 'modules' WHERE `name` = 'enable_email_module';\r\n\t\t\tALTER TABLE `" . TABLE_PREFIX . "mail_contents` ADD COLUMN `content_file_id` VARCHAR(40) NOT NULL default '';\r\n\t\t\t";
     }
     @unlink("../../language/de_de/._lang.js");
     if ($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) {
         $this->printMessage("Database schema transformations executed (total queries: {$total_queries})");
     } else {
         $this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true);
         return false;
     }
     // if
     $this->printMessage('Feng Office has been upgraded. You are now running Feng Office ' . $this->getVersionTo() . ' Enjoy!');
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:49,代码来源:ChinchulinUpgradeScript.class.php


示例6: load_help

function load_help($template){
	$dir = Localization::instance()->getLanguageDirPath().'/'.Localization::instance()->getLocale();
	$help_file = $dir.'/help/'.$template.'.html';
	if(is_file($help_file)){
		return tpl_fetch($help_file);
	}else{
		$default = Localization::instance()->getLanguageDirPath().'/en_us/help/'.$template.'.html';
		if(is_file($default)){
			return tpl_fetch($default);
		}else{
			$noHelp = Localization::instance()->getLanguageDirPath().'/en_us/help/no_help.html';
			if(is_file($noHelp)){
				return tpl_fetch($noHelp);
			}else{
				return '';
			}
		}
	}	
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:19,代码来源:help.php


示例7: setSidebar

 /**
  * Set page sidebar
  *
  * @access public
  * @param string $template Path of sidebar template
  * @return null
  * @throws FileDnxError if $template file does not exists
  */
 protected function setSidebar($template)
 {
     tpl_assign('content_for_sidebar', tpl_fetch($template));
 }
开发者ID:469306621,项目名称:Languages,代码行数:12,代码来源:ApplicationController.class.php


示例8: render_project_application_logs

/**
 * Render one project's application logs
 * 
 * This helper will render array of log entries.
 *
 * @param array $project The project.
 * @param array $log_entries An array of entries for this project.
 * @return null
 */
function render_project_application_logs($project, $log_entries)
{
    tpl_assign('application_logs_project', $project);
    tpl_assign('application_logs_entries', $log_entries);
    return tpl_fetch(get_template_path('render_project_application_logs', 'application'));
}
开发者ID:469306621,项目名称:Languages,代码行数:15,代码来源:application.php


示例9: execute

 /**
  * Execute the script
  *
  * @param void
  * @return boolean
  */
 function execute()
 {
     // ---------------------------------------------------
     //  Check MySQL version
     // ---------------------------------------------------
     $mysql_version = mysql_get_server_info($this->database_connection);
     if ($mysql_version && version_compare($mysql_version, '4.1', '>=')) {
         $constants['DB_CHARSET'] = 'utf8';
         @mysql_query("SET NAMES 'utf8'", $this->database_connection);
         tpl_assign('default_collation', $default_collation = 'collate utf8_unicode_ci');
         tpl_assign('default_charset', $default_charset = 'DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci');
     } else {
         tpl_assign('default_collation', $default_collation = '');
         tpl_assign('default_charset', $default_charset = '');
     }
     // if
     tpl_assign('table_prefix', TABLE_PREFIX);
     if (defined('DB_ENGINE')) {
         tpl_assign('engine', DB_ENGINE);
     } else {
         tpl_assign('engine', 'InnoDB');
     }
     // ---------------------------------------------------
     //  Execute migration
     // ---------------------------------------------------
     // RUN QUERIES
     $total_queries = 0;
     $executed_queries = 0;
     $installed_version = installed_version();
     if (version_compare($installed_version, $this->getVersionFrom()) <= 0) {
         // upgrading from a version lower than this script's 'from' version
         $upgrade_script = tpl_fetch(get_template_path('db_migration/1_7_pastafrola'));
     } else {
         // upgrading from a pre-release of this version (beta, rc, etc)
         $upgrade_script = "";
         if (version_compare($installed_version, '1.7-beta') <= 0) {
             $upgrade_script .= "\r\n\t\t\t\t\tINSERT INTO `" . TABLE_PREFIX . "config_options` (`category_name`, `name`, `value`, `config_handler_class`, `is_system`, `option_order`, `dev_comment`) VALUES\r\n\t\t\t\t\t\t('system', 'notification_from_address', '', 'StringConfigHandler', 1, 0, 'Address to use as from field in email notifications. If empty, users address is used');\r\n\t\t\t\t";
         }
         if (version_compare($installed_version, '1.7-rc') <= 0) {
             $upgrade_script .= "\r\n\t\t\t\t\tINSERT INTO `" . TABLE_PREFIX . "config_options` (`category_name`, `name`, `value`, `config_handler_class`, `is_system`, `option_order`, `dev_comment`) VALUES\r\n\t\t\t\t\t\t('general', 'use_owner_company_logo_at_header', '0', 'BoolConfigHandler', 0, 0, '')\r\n\t\t\t\t\tON DUPLICATE KEY UPDATE id=id;\r\n\t\t\t\t\tDELETE FROM `" . TABLE_PREFIX . "config_options` WHERE `category_name`='general' AND `name`='detect_mime_type_from_extension';\r\n\t\t\t\t\tINSERT INTO `" . TABLE_PREFIX . "user_ws_config_options` (`category_name`, `name`, `default_value`, `config_handler_class`, `is_system`, `option_order`, `dev_comment`) VALUES \r\n \t\t\t\t\t\t('general', 'detect_mime_type_from_extension', '0', 'BoolConfigHandler', 0, 800, '')\r\n\t\t\t\t\tON DUPLICATE KEY UPDATE id=id;\r\n\t\t\t\t";
         }
         if (version_compare($installed_version, '1.7-rc2') <= 0) {
             $upgrade_script .= "\r\n\t\t\t\t\tALTER TABLE `" . TABLE_PREFIX . "administration_tools` ADD COLUMN `visible` BOOLEAN NOT NULL DEFAULT 1;\r\n\t\t\t\t\tUPDATE `" . TABLE_PREFIX . "administration_tools` SET `visible`=0 WHERE `name`='mass_mailer';\r\n\t\t\t\t";
         }
         if (version_compare($installed_version, '1.7') <= 0) {
             $upgrade_script .= "\r\n\t\t\t\t\tALTER TABLE `" . TABLE_PREFIX . "mail_accounts` \r\n\t\t\t\t\t ADD COLUMN `last_error_date` DATETIME NOT NULL default '0000-00-00 00:00:00',\r\n\t\t\t\t\t ADD COLUMN `last_error_msg` VARCHAR(255) NOT NULL default '',\r\n\t\t\t\t\t ADD COLUMN `sync_addr` VARCHAR( 100 ) NOT NULL default '',\r\n\t\t\t\t\t ADD COLUMN `sync_pass` VARCHAR( 40 ) NOT NULL default '',\r\n\t\t\t\t\t ADD COLUMN `sync_server` VARCHAR( 100 ) NOT NULL default '',\r\n\t\t\t\t\t ADD COLUMN `sync_ssl` BOOL NOT NULL DEFAULT '0',\r\n\t\t\t\t\t ADD COLUMN `sync_ssl_port` INT( 11 ) NOT NULL DEFAULT '993',\r\n\t\t\t\t\t ADD COLUMN `sync_folder` VARCHAR( 100 ) NOT NULL default '';\r\n\t\t\t\t\tALTER TABLE `" . TABLE_PREFIX . "mail_account_users` ADD COLUMN `last_error_state` INT(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '0:no error,1:err unread, 2:err read';\r\n\t\t\t\t\tINSERT INTO `" . TABLE_PREFIX . "user_ws_config_options` (`category_name`, `name`, `default_value`, `config_handler_class`, `is_system`, `option_order`, `dev_comment`) VALUES \r\n\t\t\t\t\t ('mails panel', 'mail_account_err_check_interval', '300', 'IntegerConfigHandler', 0, 120, NULL),\r\n\t\t\t\t\t ('mails panel', 'classify_mail_with_conversation', '1', 'BoolConfigHandler', 0, 130, NULL),\r\n\t\t\t\t\t ('task panel', 'tasksShowEmptyMilestones', '1', 'BoolConfigHandler', 1, 0, '')\r\n\t\t\t\t\tON DUPLICATE KEY UPDATE id=id;\r\n\t\t\t\t\tINSERT INTO `" . TABLE_PREFIX . "file_types` (`extension`, `icon`, `is_searchable`, `is_image`) VALUES\r\n\t\t\t\t\t\t('docx', 'doc.png', 0, 0),\r\n\t\t\t\t\t\t('xlsx', 'xls.png', 0, 0)\r\n\t\t\t\t\tON DUPLICATE KEY UPDATE id=id;\r\n\t\t\t\t\tINSERT INTO `" . TABLE_PREFIX . "config_options` (`category_name`, `name`, `value`, `config_handler_class`, `is_system`, `option_order`, `dev_comment`) VALUES\r\n\t\t\t\t\t\t('system', 'min_chars_for_match', '3', 'IntegerConfigHandler', 1, 0, 'If search criteria len is less than this, then use always LIKE'),\r\n\t\t\t\t\t\t('mailing', 'sent_mails_sync', '1', 'BoolConfigHandler', '0', '0', 'imap email accounts synchronization possibility')\r\n\t\t\t\t\tON DUPLICATE KEY UPDATE id=id;\r\n\t\t\t\t\tALTER TABLE `" . TABLE_PREFIX . "application_logs` MODIFY COLUMN `action` enum('upload','open','close','delete','edit','add','trash','untrash','subscribe','unsubscribe','tag','untag','comment','link','unlink','login','logout','archive','unarchive','move','copy','read','download','checkin','checkout') collate utf8_unicode_ci default NULL;\r\n\t\t\t\t\tALTER TABLE `" . TABLE_PREFIX . "mail_contents` ADD COLUMN `sync` BOOL NOT NULL DEFAULT '0';\r\n\t\t\t\t";
         }
         if (version_compare($installed_version, '1.7.2') <= 0) {
             $upgrade_script .= "\r\n\t\t\t\t\tINSERT INTO `" . TABLE_PREFIX . "config_options` (`category_name`, `name`, `value`, `config_handler_class`, `is_system`, `option_order`, `dev_comment`) VALUES\r\n\t\t\t\t\t\t('passwords', 'block_login_after_x_tries', '0', 'BoolConfigHandler', '0', '20', NULL),\r\n\t\t\t\t\t\t('mailing', 'check_spam_in_subject', '0', 'BoolConfigHandler', 0, 0, '')\r\n\t\t\t\t\tON DUPLICATE KEY UPDATE id=id;\r\n\t\t\t\t";
         }
         if (!$this->checkTableExists(TABLE_PREFIX . 'administration_logs', $this->database_connection)) {
             $upgrade_script .= "\r\n\t\t\t\t\tCREATE TABLE  `" . TABLE_PREFIX . "administration_logs` (\r\n\t\t\t\t\t  `id` int(10) unsigned NOT NULL auto_increment,\r\n\t\t\t\t\t  `created_on` datetime NOT NULL default '0000-00-00 00:00:00',\r\n\t\t\t\t\t  `title` varchar(50) NOT NULL default '',\r\n\t\t\t\t\t  `log_data` text NOT NULL,\r\n\t\t\t\t\t  `category` enum('system','security') NOT NULL,\r\n\t\t\t\t\t  PRIMARY KEY  (`id`),\r\n\t\t\t\t\t  KEY `created_on` (`created_on`),\r\n\t\t\t\t\t  KEY `category` (`category`)\r\n\t\t\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\r\n\t\t\t\t";
         }
     }
     if ($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) {
         $this->printMessage("Database schema transformations executed (total queries: {$total_queries})");
     } else {
         $this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true);
         return false;
     }
     // if
     $this->printMessage('Feng Office has been upgraded. You are now running Feng Office ' . $this->getVersionTo() . ' Enjoy!');
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:69,代码来源:PastafrolaUpgradeScript.class.php


示例10: setContentFromTemplate

 /**
  * Set content from template
  *
  * @access public
  * @param void
  * @return null
  */
 function setContentFromTemplate($template)
 {
     tpl_assign('content_for_layout', tpl_fetch(get_template_path($template)));
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:11,代码来源:ScriptInstallerStep.class.php


示例11: writeConfigFile

 /**
  * Write $constants in config file
  *
  * @access public
  * @param array $constants
  * @return boolean
  */
 function writeConfigFile($constants)
 {
     tpl_assign('config_file_constants', $constants);
     return file_put_contents(INSTALLATION_PATH . '/config/config.php', tpl_fetch(get_template_path('config_file.php')));
 }
开发者ID:federosky,项目名称:ProjectPier-Core,代码行数:12,代码来源:installation.class.php


示例12: render

 /**
  * Render content... If template and/layout are NULL script will resolve 
  * their names based on controller name and action. 
  * 
  * PageController::index will map with:
  *  - template => views/page/index.php
  *  - layout => layouts/page.php
  *
  * @param string $template
  * @param string $layout
  * @param boolean $die
  * @return boolean
  * @throws FileDnxError
  */
 function render($template = null, $layout = null, $die = true)
 {
     trace(__FILE__, "render({$template}, {$layout}, {$die})");
     // Set template and layout...
     if (!is_null($template)) {
         $this->setTemplate($template);
     }
     // if
     if (!is_null($layout)) {
         $this->setLayout($layout);
     }
     // if
     // Get template and layout paths
     $template_path = $this->getTemplatePath();
     $layout_path = $this->getLayoutPath();
     trace(__FILE__, "tpl_fetch({$template_path})");
     // Fetch content...
     $content = tpl_fetch($template_path);
     trace(__FILE__, "renderLayout({$layout_path} <xmp>{$content}</xmp>)");
     // Assign content and render layout
     $this->renderLayout($layout_path, $content);
     // Die!
     if ($die) {
         session_write_close();
         die;
     }
     // if
     // We are done here...
     return true;
 }
开发者ID:469306621,项目名称:Languages,代码行数:44,代码来源:PageController.class.php


示例13: render_co_view_member_path

/**
 * 
 * Renders members vinculations for the object
 * @param ContentDataObject $object
 */
function render_co_view_member_path(ContentDataObject $object) {
	tpl_assign('object', $object);
	return tpl_fetch(get_template_path('member_path', 'co'));
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:9,代码来源:application.php


示例14: execute

 /**
  * Execute the script
  *
  * @param void
  * @return boolean
  */
 function execute()
 {
     // ---------------------------------------------------
     //  Check MySQL version
     // ---------------------------------------------------
     $mysql_version = mysql_get_server_info($this->database_connection);
     if ($mysql_version && version_compare($mysql_version, '4.1', '>=')) {
         $constants['DB_CHARSET'] = 'utf8';
         @mysql_query("SET NAMES 'utf8'", $this->database_connection);
         tpl_assign('default_collation', $default_collation = 'collate utf8_unicode_ci');
         tpl_assign('default_charset', $default_charset = 'DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci');
     } else {
         tpl_assign('default_collation', $default_collation = '');
         tpl_assign('default_charset', $default_charset = '');
     }
     // if
     $installed_version = installed_version();
     $t_prefix = TABLE_PREFIX;
     if (version_compare($installed_version, '1.7.5') <= 0 && TABLE_PREFIX != "fo_") {
         $t_prefix = "fo_";
     }
     tpl_assign('table_prefix', $t_prefix);
     if (defined('DB_ENGINE')) {
         tpl_assign('engine', DB_ENGINE);
     } else {
         tpl_assign('engine', 'InnoDB');
     }
     // ---------------------------------------------------
     //  Execute migration
     // ---------------------------------------------------
     $additional_upgrade_steps = array();
     // RUN QUERIES
     $total_queries = 0;
     $executed_queries = 0;
     $upgrade_script = "";
     // upgrading from version 1.x
     if (version_compare($installed_version, '2.0.0.0-beta') < 0) {
         ini_set('memory_limit', '1024M');
         @set_time_limit(0);
         $upgrade_script .= tpl_fetch(get_template_path('db_migration/2_0_asado'));
         if ($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) {
             $this->printMessage("Database schema transformations executed (total queries: {$total_queries})");
         } else {
             $this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true);
             return false;
         }
         $_SESSION['from_feng1'] = true;
         $upgrade_script = "";
         @unlink(ROOT . '/cache/autoloader.php');
         include ROOT . '/environment/classes/AutoLoader.class.php';
         include ROOT . '/environment/constants.php';
         if (!($callbacks = spl_autoload_functions())) {
             $callbacks = array();
         }
         foreach ($callbacks as $callback) {
             spl_autoload_unregister($callback);
         }
         spl_autoload_register('feng_upg_autoload');
         foreach ($callbacks as $callback) {
             spl_autoload_register($callback);
         }
         @(include ROOT . '/cache/autoloader.php');
         define('DONT_LOG', true);
         define('FORCED_TABLE_PREFIX', 'fo_');
         if (!defined('FILE_STORAGE_FILE_SYSTEM')) {
             define('FILE_STORAGE_FILE_SYSTEM', 'fs');
         }
         if (!defined('FILE_STORAGE_MYSQL')) {
             define('FILE_STORAGE_MYSQL', 'mysql');
         }
         if (!defined('MAX_SEARCHABLE_FILE_SIZE')) {
             define('MAX_SEARCHABLE_FILE_SIZE', 1048576);
         }
         try {
             DB::connect(DB_ADAPTER, array('host' => DB_HOST, 'user' => DB_USER, 'pass' => DB_PASS, 'name' => DB_NAME, 'persist' => DB_PERSIST));
             if (defined('DB_CHARSET') && trim(DB_CHARSET)) {
                 DB::execute("SET NAMES ?", DB_CHARSET);
             }
         } catch (Exception $e) {
             $this->printMessage("Error connecting to database: " . $e->getMessage() . "\n" . $e->getTraceAsString());
         }
         try {
             $db_result = DB::execute("SELECT value FROM " . $t_prefix . "config_options WHERE name = 'file_storage_adapter'");
             $db_result_row = $db_result->fetchRow();
             if ($db_result_row['value'] == FILE_STORAGE_FILE_SYSTEM) {
                 if (!defined('FILES_DIR')) {
                     define('FILES_DIR', ROOT . '/upload');
                 }
                 FileRepository::setBackend(new FileRepository_Backend_FileSystem(FILES_DIR, TABLE_PREFIX));
             } else {
                 FileRepository::setBackend(new FileRepository_Backend_DB(TABLE_PREFIX));
             }
             PublicFiles::setRepositoryPath(ROOT . '/public/files');
             if (!defined('PUBLIC_FOLDER')) {
//.........这里部分代码省略.........
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:101,代码来源:AsadoUpgradeScript.class.php


示例15: upgrade


//.........这里部分代码省略.........
                     $this->printMessage("File '{$relative_path}' exists and is writable");
                 } else {
                     $this->printMessage("File '{$relative_path}' is not writable", true);
                     return false;
                 }
                 // if
             } else {
                 if (is_dir($path)) {
                     if (folder_is_writable($path)) {
                         $this->printMessage("Folder '{$relative_path}' exists and is writable");
                     } else {
                         $this->printMessage("Folder '{$relative_path}' is not writable", true);
                         return false;
                     }
                     // if
                 } else {
                     $this->printMessage("'{$relative_path}' does not exists on the system", true);
                     return false;
                 }
             }
             // if
         }
         // foreach
         // check for loaded extensions
         foreach ($ext_checks as $extension_name) {
             if (extension_loaded($extension_name)) {
                 $this->printMessage("Extension '{$extension_name}' is loaded");
             } else {
                 $this->printMessage("Extension '{$extension_name}' is not loaded", true);
                 return false;
             }
             // if
         }
         // foreach
         // connect to database
         if ($dbc = mysql_connect(DB_HOST, DB_USER, DB_PASS)) {
             if (mysql_select_db(DB_NAME, $dbc)) {
                 $this->printMessage('Upgrade script has connected to the database.');
             } else {
                 $this->printMessage('Failed to select database ' . DB_NAME);
                 return false;
             }
             // if
         } else {
             $this->printMessage('Failed to connect to database');
             return false;
         }
         // if
         // check MySQL version
         $mysql_version = mysql_get_server_info($dbc);
         if ($mysql_version && version_compare($mysql_version, "4.1", '>=')) {
             $constants['DB_CHARSET'] = 'utf8';
             @mysql_query("SET NAMES 'utf8'", $dbc);
             tpl_assign('default_collation', $default_collation = 'collate utf8_unicode_ci');
             tpl_assign('default_charset', $default_charset = 'DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci');
         } else {
             tpl_assign('default_collation', $default_collation = '');
             tpl_assign('default_charset', $default_charset = '');
         }
         // if
         tpl_assign('table_prefix', TABLE_PREFIX);
         if (defined('DB_ENGINE')) {
             tpl_assign('engine', DB_ENGINE);
         } else {
             tpl_assign('engine', 'InnoDB');
         }
         // check test query
         $test_table_name = TABLE_PREFIX . 'test_table';
         $test_table_sql = "CREATE TABLE `{$test_table_name}` (\n\t\t\t\t`id` int(10) unsigned NOT NULL auto_increment,\n\t\t\t\t`name` varchar(50) {$default_collation} NOT NULL default '',\n\t\t\t\tPRIMARY KEY  (`id`)\n\t\t\t\t) ENGINE=InnoDB {$default_charset};";
         if (@mysql_query($test_table_sql, $dbc)) {
             $this->printMessage('Test query has been executed. Its safe to proceed with database migration.');
             @mysql_query("DROP TABLE `{$test_table_name}`", $dbc);
         } else {
             $this->printMessage('Failed to executed test query. MySQL said: ' . mysql_error($dbc), true);
             return false;
         }
         // if
         // execute scripts
         foreach ($scripts as $script) {
             if (version_compare($script->getVersionTo(), $version_from) > 0 && version_compare($script->getVersionTo(), $version_to) <= 0) {
                 $script->setDatabaseConnection($dbc);
                 if ($script->execute() === false) {
                     $this->printMessage("Error upgrading to version " . $script->getVersionTo());
                     break;
                 }
                 $last_correct_version = $script->getVersionTo();
                 tpl_assign('version', $last_correct_version);
                 file_put_contents(INSTALLATION_PATH . '/config/installed_version.php', tpl_fetch(get_template_path('installed_version')));
             }
             // if
         }
         // foreach
         if (isset($last_correct_version)) {
             @mysql_query("UPDATE `" . TABLE_PREFIX . "config_options` SET `value` = 0 WHERE `name` = 'upgrade_last_check_new_version'");
             tpl_assign('version', $last_correct_version);
             return file_put_contents(INSTALLATION_PATH . '/config/installed_version.php', tpl_fetch(get_template_path('installed_version')));
         }
     }
     // if
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:101,代码来源:ScriptUpgrader.class.php


示例16: notifyDependantTaskAssignedUsersOfTaskCompletion

 /**
  * When a task is completed, sends a notification to the assigned users of all the 
  * dependant tasks of the completed task to inform that the previous task has been completed.
  * @param $object The task that has been completed
  */
 static function notifyDependantTaskAssignedUsersOfTaskCompletion($object)
 {
     /* @var $object ProjectTask */
     $emails = array();
     // get dependant tasks
     $dependant_tasks = ProjectTaskDependencies::getDependantTasks($object->getId());
     // set sender user as the one who completed the task
     $sender = $object->getCompletedBy();
     if ($sender instanceof Contact) {
         $sendername = $sender->getObjectName();
         $senderemail = $sender->getEmailAddress();
     } else {
         return;
     }
     foreach ($dependant_tasks as $dep_task) {
         /* @var $dep_task ProjectTask */
         $assigned_user = $dep_task->getAssignedTo();
         // check that dependant task is assigned to a valid user
         if ($assigned_user instanceof Contact && $assigned_user->isUser()) {
             // check that all previous tasks are completed
             $all_previous_completed = true;
             $previous_tasks = ProjectTaskDependencies::getPreviousTasks($dep_task->getId());
             foreach ($previous_tasks as $pt) {
                 if ($pt->getId() == $object->getId()) {
                     continue;
                 }
                 if ($pt->getCompletedById() == 0) {
                     $all_previous_completed = false;
                     break;
                 }
             }
             // send the notification only if all previous tasks of this task are completed
             if ($all_previous_completed) {
                 // set notificated user localization
                 Localization::instance()->loadSettings($assigned_user->getLocale(), ROOT . '/language');
                 // format notification data
                 $assigned_by_name = $dep_task->getAssignedBy() instanceof Contact ? $dep_task->getAssignedBy()->getObjectName() : "";
                 $assigned_to_name = $dep_task->getAssignedToName();
                 tpl_assign('object', $dep_task);
                 tpl_assign('title', lang('task x can be started', $dep_task->getObjectName()));
                 tpl_assign('by', $assigned_by_name);
                 tpl_assign('asigned', $assigned_to_name);
                 tpl_assign('description', $dep_task->getDescription());
                 $contexts = self::buildContextObjectForNotification($dep_task);
                 tpl_assign('contexts', $contexts);
                 $priority_data = self::getTaskPriorityData($dep_task);
                 tpl_assign('priority', $priority_data);
                 $start_date = self::getTaskDateFormatted($dep_task, 'start_date', $assigned_user->getTimezone());
                 tpl_assign('start_date', $start_date);
                 $due_date = self::getTaskDateFormatted($dep_task, 'due_date', $assigned_user->getTimezone());
                 tpl_assign('due_date', $due_date);
                 $attachments = array();
                 $attachments['logo'] = self::getLogoAttachmentData($assigned_user->getEmailAddress());
                 tpl_assign('attachments', $attachments);
                 // send notification
                 $to_addresses = array();
                 $to_addresses[$assigned_user->getId()] = self::prepareEmailAddress($assigned_user->getEmailAddress(), $assigned_user->getObjectName());
                 $subject = lang('all previous tasks have been completed', $dep_task->getObjectName());
                 $recipients_field = config_option('notification_recipients_field', 'to');
                 $emails[] = array("{$recipients_field}" => $to_addresses, "from" => self::prepareEmailAddress($senderemail, $sendername), "subject" => $subject, "body" => tpl_fetch(get_template_path('previous_task_completed', 'notifier')), "attachments" => $attachments);
             }
         }
     }
     if (count($emails) > 0) {
         self::queueEmails($emails);
         $locale = logged_user() instanceof Contact ? logged_user()->getLocale() : DEFAULT_LOCALIZATION;
         Localization::instance()->loadSettings($locale, ROOT . '/language');
     }
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:74,代码来源:Notifier.class.php


示例17: installPlugins

 /**
  * @author Ignacio Vazquez - [email protected]
  * @param array of string $pluginNames
  */
 function installPlugins($pluginNames)
 {
     if (count($pluginNames)) {
         foreach ($pluginNames as $name) {
             $path = INSTALLATION_PATH . "/plugins/{$name}/info.php";
             if (file_exists($path)) {
                 //1. Insert into PLUGIN TABLE
                 $pluginInfo = (include_once $path);
                 $cols = "name, is_installed, is_activated, version";
                 $values = "'{$name}', 1, 1, " . array_var($pluginInfo, 'version');
                 if (is_numeric(array_var($pluginInfo, 'id'))) {
                     $cols = "id, " . $cols;
                     $values = array_var($pluginInfo, 'id') . ", " . $values;
                 }
                 $sql = "INSERT INTO " . $this->table_prefix . "plugins ({$cols}) VALUES ({$values}) ";
                 if (@mysql_query($sql)) {
                     $id = @mysql_insert_id();
                     $pluginInfo['id'] = $id;
                 } else {
                     return false;
                 }
                 //2. IF Plugin defines types, INSERT INTO ITS TABLE
                 if (count(array_var($pluginInfo, 'types'))) {
                     foreach ($pluginInfo['types'] as $k => $type) {
                         if (isset($type['name'])) {
                             $sql = "\n\t\t\t\t\t\t\t\t\tINSERT INTO " . $this->table_prefix . "object_types (name, handler_class, table_name, type, icon, plugin_id)\n\t\t\t\t\t\t\t\t\t \tVALUES (\n\t\t\t\t\t\t\t\t\t \t'" . array_var($type, "name") . "', \n\t\t\t\t\t\t\t\t\t \t'" . array_var($type, "handler_class") . "', \n\t\t\t\t\t\t\t\t\t \t'" . array_var($type, "table_name") . "', \n\t\t\t\t\t\t\t\t\t \t'" . array_var($type, "type") . "', \n\t\t\t\t\t\t\t\t\t \t'" . array_var($type, "icon") . "', \n\t\t\t\t\t\t\t\t\t\t{$id}\n\t\t\t\t\t\t\t\t\t)";
                             if (@mysql_query($sql)) {
                                 $pluginInfo['types'][$k]['id'] = @mysql_insert_id();
                                 $type['id'] = @mysql_insert_id();
                             } else {
                                 echo "FAIL INSTALLING TYPES <br>";
                                 echo mysql_error() . "<br/>";
                                 echo $sql . "<br/>";
                             }
                         }
                     }
                 }
                 //2. IF Plugin defines tabs, INSERT INTO ITS TABLE
                 if (count(array_var($pluginInfo, 'tabs'))) {
                     foreach ($pluginInfo['tabs'] as $k => $tab) {
                         if (isset($tab['title'])) {
                             $type_id = array_var($type, "id");
                             $sql = "\n\t\t\t\t\t\t\t\t\tINSERT INTO " . $this->table_prefix . "tab_panels (\n\t\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\t\ttitle, \n\t\t\t\t\t\t\t\t\t\ticon_cls, \n\t\t\t\t\t\t\t\t\t\trefresh_on_context_change, \n\t\t\t\t\t\t\t\t\t\tdefault_controller, \n\t\t\t\t\t\t\t\t\t\tdefault_action, \n\t\t\t\t\t\t\t\t\t\tinitial_controller, \n\t\t\t\t\t\t\t\t\t\tinitial_action, \n\t\t\t\t\t\t\t\t\t\tenabled, \n\t\t\t\t\t\t\t\t\t\ttype,  \n\t\t\t\t\t\t\t\t\t\tplugin_id, \n\t\t\t\t\t\t\t\t\t\tobject_type_id )\n\t\t\t\t\t\t\t\t \tVALUES (\n\t\t\t\t\t\t\t\t \t\t'" . array_var($tab, 'id') . "', \n\t\t\t\t\t\t\t\t \t\t'" . array_var($tab, 'title') . "', \n\t\t\t\t\t\t\t\t \t\t'" . array_var($tab, 'icon_cls') . "',\n\t\t\t\t\t\t\t\t \t\t'" . array_var($tab, 'refresh_on_context_change') . "',\n\t\t\t\t\t\t\t\t \t\t'" . array_var($tab, 'default_controller') . "',\n\t\t\t\t\t\t\t\t \t\t'" . array_var($tab, 'default_action') . "',\n\t\t\t\t\t\t\t\t\t\t'" . array_var($tab, 'initial_controller') . "',\n\t\t\t\t\t\t\t\t\t\t'" . array_var($tab, 'initial_action') . "',\n\t\t\t\t\t\t\t\t\t\t'" . array_var($tab, 'enabled', 1) . "',\n\t\t\t\t\t\t\t\t\t\t'" . array_var($tab, 'type') . "',\n\t\t\t\t\t\t\t\t\t\t{$id},\n\t\t\t\t\t\t\t\t\t\t" . array_var($tab, 'object_type_id') . "\n\t\t\t\t\t\t\t\t\t)";
                             if (!@mysql_query($sql)) {
                                 echo $sql;
                                 echo mysql_error();
                             }
                         }
                     }
                 }
                 // Create schema sql query
                 $schema_creation = INSTALLATION_PATH . "/plugins/{$name}/install/sql/mysql_schema.php";
                 if (file_exists($schema_creation)) {
                     $total_queries = 0;
                     $executed_queries = 0;
                     if ($this->executeMultipleQueries(tpl_fetch($schema_creation), $total_queries, $executed_queries)) {
                         $this->printMessage("Schema created for plugin {$name} ");
                     } else {
                         $this->breakExecution("Error while creating schema for plugin {$name}" . mysql_error());
                         //$this->printMessage("Error while creating schema for plugin $name".mysql_error());
                     }
                 }
                 // Create schema sql query
                 $schema_query = INSTALLATION_PATH . "/plugins/{$name}/install/sql/mysql_initial_data.php";
                 if (file_exists($schema_query)) {
                     $total_queries = 0;
                     $executed_queries = 0;
                     if ($this->executeMultipleQueries(tpl_fetch($schema_query), $total_queries, $executed_queries)) {
                         $this->printMessage("Initial data loaded for plugin  '{$name}'." . mysql_error());
                     } else {
                         $this->breakExecution("Error while loading inital data for plugin '{$name}'." . mysql_error());
                     }
                 }
                 $install_script = INSTALLATION_PATH . "/plugins/{$name}/install/install.php";
                 if (file_exists($install_script)) {
                     include_once $install_script;
                 }
             }
         }
     }
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:85,代码来源:acInstallation.class.php


示例18: fixConfigFile

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP tpl_flush函数代码示例发布时间:2022-05-23
下一篇:
PHP tpl_favicon函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap