예제 #1
0
 public function convertDb()
 {
     $sdp = UserNotesHelper::getStorageBase();
     $cids = $this->input->get('cid', array(), 'array');
     $view = $this->input->get('view');
     $tc = $view == 'usernotes' ? '@' : '_';
     foreach ($cids as $cid) {
         UserNotesHelperDb::convertDb(JPATH_ROOT . '/' . $sdp . '/' . $tc . $cid . '/' . JApplicationHelper::getComponentName());
     }
     $this->setRedirect('index.php?option=com_usernotes&view=' . $view, JText::_('COM_USERSCHED_MSG_COMPLETE'));
 }
예제 #2
0
 public function __construct($config = array())
 {
     $this->_storPath = UserNotesHelper::userDataPath();
     $udbPath = $this->_storPath . '/usernotes.db3';
     $doInit = !file_exists($udbPath);
     $option = array('driver' => 'sqlite', 'database' => $udbPath);
     $db = JDatabaseDriver::getInstance($option);
     $db->connect();
     $db->getConnection()->sqliteCreateFunction('b64d', 'base64_decode', 1);
     if ($doInit) {
         require_once JPATH_COMPONENT . '/helpers/db.php';
         UserNotesHelperDb::buildDb($db);
     }
     $config['dbo'] = $db;
     parent::__construct($config);
 }