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


PHP JApplication::getCfg方法代码示例

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


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

示例1: _prepareConnectRequest

 /**
  * Set client object to perform request
  * for connection to analytics service
  *
  */
 protected function _prepareConnectRequest()
 {
     $hClient =& Sh404sefHelperAnalytics::getHttpClient();
     // set params
     $hClient->setUri($this->_authPoint);
     $hClient->setConfig(array('maxredirects' => 0, 'timeout' => 10));
     // request details
     $hClient->setMethod(Sh_Zend_Http_Client::POST);
     $hClient->setEncType('application/x-www-form-urlencoded');
     // request data
     $postData = array('accountType' => 'GOOGLE', 'Email' => $this->_config->analyticsUser, 'Passwd' => $this->_config->analyticsPassword, 'service' => 'analytics', 'source' => JApplication::getCfg('sitename') . '-sh404sef-' . $this->_config->version);
     $hClient->setParameterPost($postData);
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:18,代码来源:analyticsga.php

示例2: onProfileDisplay

 function onProfileDisplay()
 {
     if (!file_exists($this->_path . DS . 'admin.jreviews.php')) {
         return JText::_('jReviews is not installed. Please contact site administrator.');
     } else {
         $user = CFactory::getActiveProfile();
         $userId = $user->id;
         $cacheSetting = $this->params->get('cache', 1) ? JApplication::getCfg('caching') : 0;
         # Load CSS stylesheets -- done here because when cache is on css is not loaded
         if ($cacheSetting) {
             # MVC initalization script
             if (!defined('DS')) {
                 define('DS', DIRECTORY_SEPARATOR);
             }
             require 'components' . DS . 'com_jreviews' . DS . 'jreviews' . DS . 'framework.php';
             $cache_file = 'jreviews_config_' . md5(cmsFramework::getConfig('secret'));
             $Config =& S2Cache::read($cache_file);
             if (!is_object($Config)) {
                 //Create config file
                 $eParams['data']['controller'] = 'common';
                 $eParams['data']['action'] = 'index';
                 $Dispatcher = new S2Dispatcher('jreviews', false, true);
                 $Dispatcher->dispatch($eParams);
                 $Config =& S2Cache::read($cache_file);
                 unset($Dispatcher);
             }
             App::import('Helper', 'html');
             $Html =& RegisterClass::getInstance('HtmlHelper');
             $Html->viewTheme = $Config->template;
             $Html->app = 'jreviews';
             $Html->startup();
             App::import('Helper', 'libraries', 'jreviews');
             $Libraries =& RegisterClass::getInstance('LibrariesHelper');
             $Html->css(array('theme', 'plugins', 'paginator'));
             $Html->js(array('jreviews', 'jquery' => 'jquery', 'jq.scrollable'), $Libraries->js());
         }
         $cache =& JFactory::getCache('plgCommunityJreviews_myfavorites');
         $cache->setCaching($cacheSetting);
         $callback = array('plgCommunityJreviews_myfavorites', '_getPage');
         $contents = $cache->call($callback, $userId, $this->params, $cacheSetting);
         return $contents;
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:43,代码来源:jreviews_myfavorites.php

示例3: _actionLoad

 /**
  * Loads the application.
  */
 protected function _actionLoad($context)
 {
     //already loaded
     if ($this->_application instanceof JApplication) {
         return;
     }
     //legacy register error handling
     JError::setErrorHandling(E_ERROR, 'callback', array($this, 'exception'));
     //register exception handler
     set_exception_handler(array($this, 'exception'));
     $identifier = clone $this->getIdentifier();
     $identifier->name = 'application';
     //load the JSite
     $this->getService('koowa:loader')->loadIdentifier($identifier);
     jimport('joomla.application.component.helper');
     //no need to create session when using CLI (command line interface)
     $this->_application = JFactory::getApplication($this->_application, array('session' => PHP_SAPI !== 'cli'));
     global $mainframe;
     $mainframe = $this->_application;
     $error_reporting = $this->_application->getCfg('error_reporting');
     define('JDEBUG', $this->_application->getCfg('debug'));
     //taken from nooku application dispatcher
     if ($error_reporting > 0) {
         error_reporting($error_reporting);
         ini_set('display_errors', 1);
         ini_set('display_startup_errors', 1);
     }
     $this->getService()->set($identifier, $this->_application);
     $this->getService()->setAlias('application', $identifier);
     //set the session handler to none for
     if (PHP_SAPI == 'cli') {
         JFactory::getConfig()->setValue('config.session_handler', 'none');
         JFactory::getConfig()->setValue('config.cache_handler', 'file');
     }
     //set the default timezone to UTC
     date_default_timezone_set('UTC');
     KRequest::root(str_replace('/' . $this->_application->getName(), '', KRequest::base()));
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:41,代码来源:dispatcher.php

示例4: onAfterContentSave

 /**
  * Versioning after save content method
  *
  *
  * @param 	object		A JTableContent object
  * @param 	bool		If the content is just about to be created
  * @return	bool		If false, abort the save
  */
 function onAfterContentSave(&$article, $isNew)
 {
     global $mainframe;
     $admin_notify = "";
     $version_limit = 0;
     $db =& JFactory::getDBO();
     if (@$this->params) {
         $version_limit = (int) $this->params->get('version_limit');
         $admin_notify = trim($this->params->get('admin_notify'));
     }
     //clean out the autosaves!
     if ($isNew === false) {
         if ($article->id > 0) {
             $id = (int) $article->id;
             //delete autosaves
             $sql = "DELETE FROM #__version WHERE content_id = {$id} AND autosaved=1";
             $db->setQuery($sql);
             $db->Query($sql);
         }
     } elseif ($isNew === true) {
         if (isset($_SESSION['content_id'])) {
             $content_id = (int) $_SESSION['content_id'];
             if ($content_id > 0) {
                 //delete autosaves of new articles
                 $sql = "DELETE FROM #__version WHERE content_id = {$content_id} AND autosaved=1";
                 $db->setQuery($sql);
                 $db->Query($sql);
             }
         }
     }
     //check the number of versions, and FIFO
     if ($version_limit > 0 && $article->id > 0) {
         $id = (int) $article->id;
         $sql = "SELECT COUNT(id) AS cnt FROM #__version WHERE content_id = {$id}  AND (autosaved != '1' or autosaved is null)";
         $db->setQuery($sql);
         $res = $db->loadObject();
         //if we're at the version limit
         if ($res->cnt > $version_limit) {
             //if we're over the version limit, we need to delete
             $difference = (int) $res->cnt - $version_limit;
             $sql = "DELETE FROM #__version WHERE content_id = {$id}  AND (autosaved != '1' or autosaved is null) ORDER BY id ASC LIMIT {$difference}";
             $db->setQuery($sql);
             $db->Query($sql);
         }
     }
     //get a copy of the version table
     $doc = JTable::getInstance('version', 'Table');
     //duplicate the article object
     $vars = get_class_vars(get_class($article));
     //copy it to the version object
     foreach ($vars as $name => $value) {
         $doc->{$name} = $article->{$name};
     }
     //store the article id
     $doc->content_id = (int) $doc->id;
     $doc->_tbl = "#__version";
     //they're always new
     $doc->id = null;
     //does the latest workflow record indicate that this version should be staged?
     $sql = "SELECT stage FROM #__fc_workflow WHERE content_id = " . $doc->content_id . "  order by id desc limit 1";
     $db->setQuery($sql);
     $stage = (int) $db->loadResult();
     //set this version as staged
     if ($stage > 0) {
         $doc->stage = 1;
     }
     //Check if this version is any different
     if (!$doc->store()) {
         JError::raiseError(500, $doc->getError());
         return false;
     }
     //check if the admin notify parameter is set
     if (strlen($admin_notify) > 0) {
         if (JMailHelper::isEmailAddress($admin_notify) === true) {
             $mailSender =& JFactory::getMailer();
             $mailSender->addRecipient($admin_notify);
             $mailSender->setSubject(JText::_('EMAIL_SUBJECT') . " " . $doc->title);
             $modified_by_user =& JFactory::getUser((int) @$article->modified_by);
             $created_by_user =& JFactory::getUser((int) @$article->created_by);
             $body = JText::_('EMAIL_BODY') . "<br />" . JText::_('Created by:') . $created_by_user;
             $body .= JText::_('Modified by:') . $modified_by_user . "<br />";
             $body .= "<br />" . $doc->introtext . $doc->fulltext;
             //send the content
             $mailSender->setBody($body);
             $mailSender->IsHTML(true);
             //get the from address for SMTP
             $mail_from = JApplication::getCfg('mailfrom');
             $from_name = JApplication::getCfg('fromname');
             if (JMailHelper::isEmailAddress($mail_from) === true) {
                 $from_address = array($mail_from, $from_name);
                 $mailSender->setSender($from_address);
             }
//.........这里部分代码省略.........
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:101,代码来源:version.php

示例5: delete

 /**
  * Method to delete one or more records.
  *
  * @param	array	$pks	An array of record primary keys.
  *
  * @return	boolean	True if successful, false if an error occurs.
  * @since	1.6
  */
 public function delete(&$pks)
 {
     // Initialise variables.
     $dispatcher = JDispatcher::getInstance();
     $user = JFactory::getUser();
     $pks = (array) $pks;
     $table = $this->getTable();
     $app = JFactory::getApplication();
     // Include the content plugins for the on delete events.
     JPluginHelper::importPlugin('content');
     $post = JRequest::get('post');
     $deleteDepth = $post['jform']['recordsDeleteDepth'];
     $drop = $post['jform']['dropTablesFromDB'];
     $feModel = $this->getFEModel();
     $fabrikDatabase = $feModel->getDb();
     $dbconfigprefix = JApplication::getCfg("dbprefix");
     // Iterate the items to delete each one.
     foreach ($pks as $i => $pk) {
         if ($table->load($pk)) {
             if ($this->canDelete($table)) {
                 $context = $this->option . '.' . $this->name;
                 // Trigger the onContentBeforeDelete event.
                 $result = $dispatcher->trigger($this->event_before_delete, array($context, $table));
                 if (in_array(false, $result, true)) {
                     $this->setError($table->getError());
                     return false;
                 }
                 if (!$table->delete($pk)) {
                     $this->setError($table->getError());
                     return false;
                 }
                 // Trigger the onContentAfterDelete event.
                 $dispatcher->trigger($this->event_after_delete, array($context, $table));
                 // get the tables form
             } else {
                 // Prune items that you can't change.
                 unset($pks[$i]);
                 return JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_EDIT_STATE_NOT_PERMITTED'));
             }
             switch ($deleteDepth) {
                 case 0:
                     //list only
                 //list only
                 default:
                     break;
                 case 1:
                     //list and form
                     $form = $this->deleteAssociatedForm($table);
                     break;
                 case 2:
                     //list form and groups
                     $form = $this->deleteAssociatedForm($table);
                     $this->deleteAssociatedGroups($form, false);
                     break;
                 case 3:
                     //list form groups and elements
                     $form = $this->deleteAssociatedForm($table);
                     $this->deleteAssociatedGroups($form, true);
                     break;
             }
             if ($drop) {
                 if (strncasecmp($table->db_table_name, $dbconfigprefix, strlen($dbconfigprefix)) == 0) {
                     $app->enqueueMessage(JText::sprintf('COM_FABRIK_TABLE_NOT_DROPPED_PREFIX', $table->db_table_name, $dbconfigprefix), 'notice');
                 } else {
                     $fabrikDatabase->setQuery("DROP " . $table->db_table_name);
                     $fabrikDatabase->query();
                     $app->enqueueMessage(JText::sprintf('COM_FABRIK_TABLE_DROPPED', $table->db_table_name));
                 }
             } else {
                 $app->enqueueMessage(JText::sprintf('COM_FABRIK_TABLE_NOT_DROPPED', $table->db_table_name));
             }
         } else {
             $this->setError($table->getError());
             return false;
         }
     }
     return true;
 }
开发者ID:juliano-hallac,项目名称:fabrik,代码行数:86,代码来源:list.php

示例6: __construct

 /**
  * @param string $entity
  */
 public function __construct($entity, $init)
 {
     $this->app = JFactory::getApplication();
     $this->db = JFactory::getDBO();
     $option = 'com_acctexp';
     $this->filtered = false;
     $this->limit = $this->app->getUserStateFromRequest("viewlistlimit", 'limit', $this->app->getCfg('list_limit'));
     $this->limitstart = $this->app->getUserStateFromRequest("viewconf{$option}limitstart", 'limitstart', 0);
     $this->search = xJ::escape($this->db, trim(strtolower($this->app->getUserStateFromRequest("search{$option}_subscr", 'search', ''))));
     if (!empty($this->search)) {
         $this->filtered = true;
     }
     $this->filter = new stdClass();
     if (!empty($init['filter'])) {
         foreach ($init['filter'] as $key => $default) {
             $value = $this->app->getUserStateFromRequest('aec_' . $entity . '_' . $key, $entity . '_' . $key, $default);
             if (!empty($_REQUEST[$key])) {
                 $value = $_REQUEST[$key];
             }
             if (is_array($default) && !is_array($value)) {
                 $value = array($value);
             }
             $this->filter->{$key} = $value;
             if ($this->filter->{$key} != $default) {
                 $this->filtered = true;
             }
         }
     }
     if (!empty($init['sort'])) {
         $this->{$key} = $this->app->getUserStateFromRequest('aec_' . $entity . '_sort', $entity . '_sort', $init['sort']);
     }
     if (empty($this->sort)) {
         $this->sort = 'id ASC';
     }
 }
开发者ID:Ibrahim1,项目名称:aec,代码行数:38,代码来源:admin.acctexp.php

示例7: filterNonJoomla

 /**
  * Filters all non-Joomla! tables
  *
  */
 function filterNonJoomla()
 {
     $tableList = $this->getTableList();
     if (!empty($tableList)) {
         $prefix = JApplication::getCfg('dbprefix');
         foreach ($tableList as $tableName) {
             $table = str_replace($prefix, '#__', $tableName);
             // Get abstract name
             if ($table == $tableName) {
                 $this->enableFilter($table);
             }
         }
     }
 }
开发者ID:albertobraschi,项目名称:Hab,代码行数:18,代码来源:dbef.php

示例8: showMarkedImage

 /**
  * Function that takes an image and returns the url to watermarked image
  * @param string Name of the image in question
  * @param string Font used for watermark
  * @param string Text size in pixels
  * @param int Vertical spacing between text
  * @param int Horizontal spacing between text
  * @param boolean Shadow text yes or no
  * @return url to watermarked image
  */
 function showMarkedImage($imagename, $imagetype = 'display', $font = "arial.ttf", $shadow = true)
 {
     global $rsgConfig, $mainframe;
     $pepper = 'RSG2Watermarked';
     $salt = JApplication::getCfg('secret');
     $filename = $imagetype . md5($pepper . $imagename . $salt) . '.jpg';
     if (!JFile::exists(JPATH_WATERMARKED . DS . $filename)) {
         if ($imagetype == 'display') {
             $imagepath = JPATH_DISPLAY . DS . $imagename . ".jpg";
         } else {
             $imagepath = JPATH_ORIGINAL . DS . $imagename;
         }
         $imark = new waterMarker();
         $imark->waterMarkText = $rsgConfig->get('watermark_text');
         $imark->imagePath = $imagepath;
         $imark->font = JPATH_RSGALLERY2_ADMIN . DS . "fonts" . DS . $rsgConfig->get('watermark_font');
         $imark->size = $rsgConfig->get('watermark_font_size');
         $imark->shadow = $shadow;
         $imark->angle = $rsgConfig->get('watermark_angle');
         $imark->imageTargetPath = JPATH_WATERMARKED . DS . $filename;
         $imark->mark($imagetype);
         //draw watermark
     }
     return trim(JURI_SITE, '/') . $rsgConfig->get('imgPath_watermarked') . '/' . $filename;
 }
开发者ID:realityking,项目名称:rsgallery2,代码行数:35,代码来源:img.utils.php

示例9: getTablesHTML

    function getTablesHTML()
    {
        jpimport('classes.filter.dbef');
        jpimport('helpers.lang');
        $resetHTML = JoomlapackLangManager::_('DBEF_RESET');
        $filter1HTML = JoomlapackLangManager::_('DBEF_QUICK1');
        $out = <<<END
\t\t\t<p>
\t\t\t<a href='javascript:Reset();'>{$resetHTML}</a> -
\t\t\t<a href='javascript:FilterNonJ();'>{$filter1HTML}</a>
\t\t\t</p>
\t\t\t<table class="adminlist">
\t\t\t\t<tr>
\t\t\t\t\t<th align="left" width="50">
END;
        $out .= JoomlapackLangManager::_('DBEF_EXCLUDE') . "\n" . "</th><th class=\"title\">" . JoomlapackLangManager::_('DBEF_TABLE') . "</th></tr>";
        $dbef = new JoomlapackFilterDBEF();
        $dbef->init();
        $filters = $dbef->getFilters('database');
        $tables = $this->getTables();
        $id = 0;
        // Get db prefix
        global $mosConfig_dbprefix;
        $prefix = defined('_JEXEC') ? JApplication::getCfg('dbprefix') : $mosConfig_dbprefix;
        foreach ($tables as $table) {
            // Get abstract name
            $tableAbstract = str_replace($prefix, '#__', $table);
            $isJoomla = $tableAbstract != $table;
            $checked = in_array($tableAbstract, $filters) ? " checked = \"true\" " : '';
            $id++;
            $out .= "\n<tr><td align=\"center\">";
            $out .= "<input type=\"checkbox\" {$checked} onclick=\"ToggleFilter('" . $tableAbstract . "', 'dbef-{$id}');\" id=\"dbef-{$id}\">";
            $out .= "</td><td align=\"left\">";
            $out .= ($isJoomla ? "<b>" : "") . htmlentities($table) . ($isJoomla ? "</b>" : "");
        }
        $out .= "\n</table>";
        return $out;
    }
开发者ID:reeleis,项目名称:ohiocitycycles,代码行数:38,代码来源:dbef.php

示例10: _getTablesToBackup

 /**
  * Finds the table names to be included in the backup set and puts them in the
  * $this->_tables array.
  */
 function _getTablesToBackup()
 {
     // Get db prefix
     global $mosConfig_dbprefix;
     $prefix = defined('_JEXEC') ? JApplication::getCfg('dbprefix') : $mosConfig_dbprefix;
     JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackDumperDefault :: Finding tables to include in the backup set");
     $db = $this->_getDB();
     if ($this->hasError()) {
         return;
     }
     $sql = "show tables";
     $db->setQuery($sql);
     $db->query();
     $allTables = $db->loadResultArray();
     if (count($this->_exclusionFilters) > 0) {
         // If we have filters, make sure the tables pass the filtering
         $this->_tables = array();
         foreach ($allTables as $myTable) {
             $tableAbstract = str_replace($prefix, '#__', $myTable);
             if (!in_array($tableAbstract, $this->_exclusionFilters)) {
                 $this->_tables[] = $myTable;
             }
         }
     } else {
         // If no filters are set, just include every single table
         $this->_tables = $allTables;
     }
 }
开发者ID:reeleis,项目名称:ohiocitycycles,代码行数:32,代码来源:default.php

示例11: defined

    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this module.  If not, see <http://www.gnu.org/licenses/>.
************************************************************************************/
// no direct access
defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.tooltip');
// ---------------------------- Variables ----------------------------
//Main variables
$Config_live_site = JURI::base();
$db =& JFactory::getDBO();
$my =& JFactory::getUser();
$access = !JApplication::getCfg('shownoauth');
//FLEXIcheck - Lets the module check if FLEXIcontent has been installed on the site
$flexicheck = 'components/com_flexicontent/index.html';
if (file_exists($flexicheck)) {
    $fc = 1;
} else {
    $fc = 0;
}
//Language Strings (and other variables related to language)
$fish = $params->get('fishsupport', 0);
if ($fc) {
    if ($fish == 1 || $fish == 2) {
        $lingua = JRequest::getWord('lang', '');
        $limitlang = $params->get('limitlang');
    }
}
开发者ID:bizanto,项目名称:Hooked,代码行数:31,代码来源:default.php

示例12: getCfg

 function getCfg($config)
 {
     switch ($config) {
         case 'absolute_path':
             if (checkJversion() >= 1) {
                 return JPATH_SITE;
             }
             break;
         case 'live_site':
             if (checkJversion() >= 1) {
                 if ($this->getUi() == 1) {
                     $live_site = JURI::base();
                 } elseif (checkJversion() == 2) {
                     $live_site = preg_replace('%administrator/%', '', JURI::base());
                 } else {
                     $live_site = $this->_baseFramework->getSiteURL();
                 }
                 if (substr($live_site, -1, 1) == '/') {
                     // fix erroneous ending / in some joomla 1.5 versions:
                     return substr($live_site, 0, -1);
                 } else {
                     return $live_site;
                 }
             }
             break;
         case 'lang':
             return $this->_myLanguage;
             break;
         case 'lang_tag':
             return $this->_myLanguageTag;
             break;
         case 'uniquemail':
             if (checkJversion() >= 1) {
                 return '1';
             }
             break;
         case 'frontend_userparams':
             if (checkJversion() == -1) {
                 return '0';
             }
             // NO break; on purpose for fall-through:
         // NO break; on purpose for fall-through:
         case 'allowUserRegistration':
         case 'useractivation':
         case 'new_usertype':
             if (checkJversion() >= 1) {
                 $usersConfig = JComponentHelper::getParams('com_users');
                 $setting = $usersConfig->get($config);
                 if ($config == 'new_usertype' && checkJversion() == 2) {
                     $setting = $this->acl->get_group_name((int) $setting);
                 }
                 if ($config == 'new_usertype' && !$setting) {
                     $setting = 'Registered';
                 }
                 return $setting;
             } else {
                 if ($config == 'new_usertype') {
                     return 'Registered';
                 }
             }
             break;
         case 'hits':
         case 'vote':
             if (checkJversion() >= 1) {
                 $contentConfig = JComponentHelper::getParams('com_content');
                 return $contentConfig->get('show_' . $config);
             }
             break;
         case 'dirperms':
         case 'fileperms':
             if (checkJversion() >= 1) {
                 return '';
                 //TBD: these two missing configs should one day go to CB
             }
             break;
             // CB-Specific config params:
         // CB-Specific config params:
         case 'tmp_path':
             $abs_path = $this->getCfg('absolute_path');
             $tmpDir = $abs_path . '/tmp';
             if (@is_dir($tmpDir) && @is_writable($tmpDir)) {
                 return $tmpDir;
             }
             $tmpDir = $abs_path . '/media';
             if (@is_dir($tmpDir) && @is_writable($tmpDir)) {
                 return $tmpDir;
             }
             // First try the new PHP 5.2.1+ function:
             if (function_exists('sys_get_temp_dir')) {
                 $tmpDir = @sys_get_temp_dir();
                 if (@is_dir($tmpDir) && @is_writable($tmpDir)) {
                     return $tmpDir;
                 }
             }
             // Based on http://www.phpit.net/article/creating-zip-tar-archives-dynamically-php/2/
             $varsToTry = array('TMP', 'TMPDIR', 'TEMP');
             foreach ($varsToTry as $v) {
                 if (!empty($_ENV[$v])) {
                     $tmpDir = realpath($v);
                     if (@is_dir($tmpDir) && @is_writable($tmpDir)) {
//.........这里部分代码省略.........
开发者ID:rogatnev-nikita,项目名称:cloudinterpreter,代码行数:101,代码来源:plugin.foundation.php

示例13: _doMySQLDump

 /**
  * Runs mysqldump
  * 
  * @access private
  * 
  */
 function _doMySQLDump()
 {
     JoomlapackLogger::WriteLog(_JP_LOG_INFO, 'Starting mysqldump to dump database ' . $this->_database);
     $this->_Step = "Performing mysqldump on " . $this->_database;
     // Get absolute path to the utility
     $shellCommand = MYSQLDUMPPATH;
     // Add authentication parameters
     $shellCommand .= ' --host=' . $this->_host . (trim($this->_port) != '' ? ':' . $this->_port : '');
     $shellCommand .= ' --user=' . $this->_username;
     $shellCommand .= $this->_password != '' ? ' --pass=' . $this->_password : '';
     // Add our secret ingredient... the correct command line options :p
     $shellCommand .= ' -c --no-create-db -q -Q --compact --skip-set-charset --skip-extended-insert';
     // If MySQL4 compatibility is required, let's add another secret ingredient
     $configuration =& JoomlapackConfiguration::getInstance();
     if ($configuration->get('MySQLCompat', 'default') != 'default') {
         $shellCommand .= ' --compatible=mysql4';
     }
     // Get db prefix
     global $mosConfig_dbprefix;
     $prefix = defined('_JEXEC') ? JApplication::getCfg('dbprefix') : $mosConfig_dbprefix;
     // Next up, table filters!
     if (is_array($this->_exclusionFilters) && count($this->_exclusionFilters) > 0) {
         foreach ($this->_exclusionFilters as $skiptable) {
             $skiptable = str_replace('#__', $prefix, $skiptable);
             $shellCommand .= ' --ignore-table=' . $this->_database . '.' . $skiptable;
         }
     }
     // Add the file path to dump to
     $shellCommand .= ' --result-file=' . $this->_tempMSDfile;
     // Finally, the database name itself!
     $shellCommand .= ' ' . $this->_database . '';
     // Execute the shell command
     JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, 'mysqldump command line: ' . $shellCommand);
     exec(escapeshellcmd($shellCommand), $result, $errNo);
     $result = implode(" \n", $result);
     // Normally, mysqldump should be silent as a fish. If anything was sput out,
     // there must have been an error.
     if (strlen(trim($result)) > 0 || $errNo != 0) {
         $result .= "System error number {$errNo}";
         $this->_error = true;
         $this->_errorMessage = "Error calling mysqldump: " . $result . " \n Command line was: \n " . $shellCommand . " \n Please check the path to mysqldump and that mysqldump is able to communicate with your database.";
         $this->setError($this->_errorMessage);
     } else {
         // No errors, mark this step as complete
         $this->_mysqldumpHasRan = true;
         JoomlapackLogger::WriteLog(_JP_LOG_INFO, 'mysqldump on ' . $this->_database . ' is complete.');
     }
 }
开发者ID:reeleis,项目名称:ohiocitycycles,代码行数:54,代码来源:mysqldump.php

示例14: doCyberTigerRemove

 function doCyberTigerRemove()
 {
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $recordsDeleteDepth = JRequest::getInt('recordsDeleteDepth', 0);
     $dropTablesFromDB = JRequest::getInt('dropTablesFromDB', 0);
     $feedbackMessage = "";
     // Initialize variables
     $db =& JFactory::getDBO();
     $cid = JRequest::getVar('cid', array(), 'post', 'array');
     $n = count($cid);
     JArrayHelper::toInteger($cid);
     $model =& JModel::getInstance('Table', 'FabrikModel');
     foreach ($cid as $id) {
         $model->setId($id);
         $model->_table = null;
         $table = $model->getTable();
         if ($dropTablesFromDB == 1) {
             // if user has declared that he wants the actual tables removed...
             // then lets remove them...but only if they are not joomla tables
             // i.e. tables that have the prefix in them
             $dbconfigprefix = JApplication::getCfg("dbprefix");
             if (strncasecmp($table->db_table_name, $dbconfigprefix, strlen($dbconfigprefix)) == 0) {
                 // do nothing
                 $feedbackMessage .= JText::sprintf("The table %s has will not be dropped from the database.", $table->db_table_name);
                 $feedbackMessage .= "</li><li>";
             } else {
                 $model->drop();
                 $feedbackMessage .= JText::sprintf("The table %s has now been dropped from the database.", $table->db_table_name);
                 $feedbackMessage .= "</li><li>";
             }
         } else {
             $feedbackMessage .= JText::sprintf("The table %s has been left in the database.", $table->db_table_name);
             $feedbackMessage .= "</li><li>";
         }
         $model->_oForm = null;
         $formModel =& $model->getForm();
         // This is a bug i think in Rob's code. The getGroupsHiarachy returns the groups and the elements
         // But they are not stored so the subsequent foreach loops will be skipped.
         // $formModel->getGroupsHiarachy( false, false);
         // So to fix the bug the following line has been placed insted.
         $groups =& $formModel->getGroupsHiarachy();
         foreach ($groups as $groupModel) {
             $groupModel->setContext($formModel, $model);
             $elementModels =& $groupModel->getMyElements();
             if ($recordsDeleteDepth == 3) {
                 // user wants the elements also deleted
                 // now lets delete the elements that belong to the groups
                 // that are used in the forms that are associated with the tables.
                 foreach ($elementModels as $elementModel) {
                     $db->setQuery("DELETE FROM #__fabrik_elements WHERE id = " . (int) $elementModel->_id);
                     $db->query();
                     $db->setQuery("DELETE FROM #__fabrik_jsactions WHERE element_id = " . (int) $elementModel->_id);
                     $db->query();
                 }
             } else {
                 // The user does not want his custom elements deleted. So,
                 // dont remove the elements that the user has created. But do remove the elements
                 // that were auto created for the table (id and time_date)
                 //
                 // The following lines will remove id and time_date elements from the group
                 // However, they have been commented because i am not sure how they would affect the db
                 // in case of joins and multiple forms...To be further looked into by Hugh and Rob.
                 // $db->setQuery("DELETE FROM #__fabrik_elements WHERE name = 'id' and group_id = '$groupModel->_id'");
                 // $db->query();
                 // $db->setQuery("DELETE FROM #__fabrik_elements WHERE name = 'time_date' and group_id = '$groupModel->_id'");
                 // $db->query();
             }
             if ($recordsDeleteDepth > 1) {
                 // user wants groups also removed
                 $db->setQuery("DELETE FROM #__fabrik_groups WHERE id = " . (int) $groupModel->_id);
                 $db->query();
             }
         }
         // Lets do some housekeeping for the forms
         if ($recordsDeleteDepth > 0) {
             // user wants forms, groups and elements records removed
             $db->setQuery("DELETE FROM #__fabrik_forms WHERE id = " . (int) $formModel->_id);
             $db->query();
             $db->setQuery("DELETE FROM #__fabrik_formgroup WHERE form_id = " . (int) $formModel->_id);
             $db->query();
         } else {
             // The table records are always deleted.. see below
             // (maybe we should check if the table has been deleted too?
             // update the formgroup table so that the form is not marked as bound to any table
             $db->setQuery("UPDATE #__fabrik_forms SET record_in_database = 0 WHERE id = " . (int) $formModel->_id);
             $db->query();
         }
     }
     if ($n) {
         $query = 'DELETE FROM #__fabrik_tables' . ' WHERE id = ' . implode(' OR id = ', $cid);
         $db->setQuery($query);
         if (!$db->query()) {
             JError::raiseWarning(500, $db->getError());
         }
     }
     $this->setMessage($feedbackMessage . JText::sprintf('ITEMS REMOVED', $n));
     $this->setRedirect('index.php?option=com_fabrik&c=table');
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:99,代码来源:table.php

示例15: getTablePane

    /**
     * Returns the HTML for the table pane
     *
     * @return string The HTML
     */
    function getTablePane()
    {
        // Get the "backup method"
        jpimport('models.registry', true);
        $profile =& JoomlapackModelRegistry::getInstance();
        $method = $profile->get('backupMethod');
        // Load the model
        if (!class_exists('JoomlapackModelDbef')) {
            jpimport('models.dbef', true);
        }
        $model = new JoomlapackModelDbef();
        // Get tables of the current database
        $tables = $model->getTableList();
        $prefix = JApplication::getCfg('dbprefix');
        // Initialize output
        $txt_tables = JText::_('DBEF_LABEL_TABLES');
        $out = <<<ENDHTML
<table class="adminlist">
\t<thead>
\t\t<tr>
\t\t\t<th>{$txt_tables}</th>
\t\t</tr>
\t</thead>
\t<tbody>
ENDHTML;
        // Do we have tables?
        if (empty($tables)) {
            // No, warn user
            $out .= "<tr><td><p>" . JText::_('DBEF_ERROR_NOTABLES') . '</p></td></tr>';
        } else {
            $urlbase = JURI::base() . '/index.php?option=com_joomlapack&view=dbef&task=toggle&table=';
            foreach ($tables as $tableName) {
                $table = str_replace($prefix, '#__', $tableName);
                // Get abstract name
                if ($method == 'ajax') {
                    $href = 'javascript:toggle(\'' . addslashes($table) . '\');';
                } else {
                    $href = $urlbase . urlencode($table);
                }
                $htmlTable = htmlentities($tableName);
                // Make excluded table red and bold
                if ($excluded = $model->isSetFor($table)) {
                    $style = 'style="color:red; font-weight: bold; text-decoration: none"';
                } else {
                    $style = 'style="text-decoration: none"';
                }
                $out .= <<<ENDHTML
\t\t<tr>
\t\t\t<td>
\t\t\t\t<a href="{$href}" {$style}>{$htmlTable}</a>
\t\t\t</td>
\t\t</tr>
ENDHTML;
            }
        }
        $out .= <<<ENDHTML
\t</tbody>
</table>
ENDHTML;
        return $out;
    }
开发者ID:albertobraschi,项目名称:Hab,代码行数:66,代码来源:dbef.php


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