コード例 #1
0
ファイル: view.html.php プロジェクト: ErickLopez76/offiria
 function display($tpl = null)
 {
     jimport('joomla.html.pagination');
     $configHelper = new JXConfig();
     $usersInvite = AccountFactory::getModel('usersInvite');
     $my = JXFactory::getUser();
     $total = $usersInvite->getTotal(array('from_email' => $my->email));
     $result = $usersInvite->getList(array('from_email' => $my->email, 'order_by' => 'status, last_invite_date'), $configHelper->get('list_limit'), JRequest::getVar('limitstart', 0));
     $inviteEmail = '';
     if ($_POST) {
         $postVar = JRequest::getVar('params');
         $inviteEmail = $postVar['invitation'];
     }
     // Extranet/Limited groups
     $groupModel = StreamFactory::getModel('groups');
     $myJoinedGroups = $groupModel->getGroups(array('id' => $my->getParam('groups_member')), 100);
     // Pagination
     $pagination = new JPagination($total, JRequest::getVar('limitstart', 0), $configHelper->get('list_limit'));
     $pendingStat = AccountTableUsersInvite::PENDING;
     $doc = JFactory::getDocument();
     $doc->setTitle(JText::_("COM_ACCOUNT_LABEL_INVITE_USERS"));
     $this->assignRef('inviteEmail', $inviteEmail);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('pendingStat', $pendingStat);
     $this->assign('allowInvite', $configHelper->allowUsersRegister());
     $this->assignRef('results', $result);
     $this->assignRef('myJoinedGroups', $myJoinedGroups);
     parent::display($tpl);
 }
コード例 #2
0
ファイル: view.html.php プロジェクト: ErickLopez76/offiria
 function display($tpl = null)
 {
     $configHelper = new JXConfig();
     $this->assign('logo', $configHelper->get(JXConfig::LOGO));
     $this->assign('style', $configHelper->get(JXConfig::STYLE));
     $this->assignRef('configHelper', $configHelper);
     $doc = JFactory::getDocument();
     $doc->setTitle(JText::_("COM_ACCOUNT_LABEL_MANAGE_THEME"));
     parent::display($tpl);
 }
コード例 #3
0
ファイル: view.html.php プロジェクト: ErickLopez76/offiria
 function display($tpl = null)
 {
     $configHelper = new JXConfig();
     $my = JFactory::getUser();
     $defaultLang = JText::_('JXLIB_DEFAULT_LANGUAGE');
     $defaultTz = JText::_('JXLIB_DEFAULT_TIMEZONE');
     $defaultInvite = JXConfig::DISALLOW;
     $defaultAnon = JXConfig::ALLOW;
     // Additional Configuration which are not Joomla! native variables
     $siteName = $configHelper->get(JXConfig::SITENAME) == '' ? '' : $configHelper->get(JXConfig::SITENAME);
     $timeZone = $configHelper->getTimezone();
     $language = $configHelper->getLanguage();
     $allowAnon = $configHelper->get(JXConfig::ALLOW_ANON) == '' ? $defaultAnon : $configHelper->get(JXConfig::ALLOW_ANON);
     $allowInvite = $configHelper->get(JXConfig::ALLOW_INVITE) == '' ? $defaultInvite : $configHelper->get(JXConfig::ALLOW_INVITE);
     $limitEmailDomain = $configHelper->get(JXConfig::LIMIT_EMAIL_DOMAIN) == '' ? '' : $configHelper->get(JXConfig::LIMIT_EMAIL_DOMAIN);
     $domainName = $configHelper->getDomainName(true) == '' ? '' : $configHelper->getDomainName(true);
     //overwrite value with postParam when save error
     $error = array();
     if ($_POST) {
         $postParam = JRequest::getVar('params');
         $timeZone = isset($postParam['timezone']) ? $postParam['timezone'] : $timeZone;
         $language = isset($postParam['language']) ? $postParam['language'] : $language;
         $siteName = isset($postParam['sitename']) ? $postParam['sitename'] : $configHelper->get('sitename');
         $allowInvite = isset($postParam['allow_invite']) ? $postParam['allow_invite'] : $allowInvite;
         $limitEmailDomain = isset($postParam['limit_email_domain']) ? $postParam['limit_email_domain'] : $limitEmailDomain;
         $domainName = isset($postParam['domain_name']) ? $postParam['domain_name'] : $domainName;
     }
     $form = JForm::getInstance('profileForm', JPATH_ROOT . DS . 'components' . DS . 'com_profile' . DS . 'models' . DS . 'forms' . DS . 'edit.xml');
     $this->assignRef('profileForm', $form);
     $this->assignRef('my', $my);
     $this->assignRef('sitename', $siteName);
     $this->assignRef('default_timezone', $timeZone);
     $this->assignRef('default_language', $language);
     $this->assignRef('domain_name', $domainName);
     $this->assignRef('limit_email_domain', $limitEmailDomain);
     $this->assignRef('allow_invite', $allowInvite);
     $this->assignRef('allow_anon', $allowAnon);
     $this->assign('domain_editable', $configHelper->allowChangeDomain());
     $doc = JFactory::getDocument();
     $doc->setTitle(JText::_("COM_ACCOUNT_LABEL_ACCOUNT_SETTING"));
     parent::display($tpl);
 }
コード例 #4
0
ファイル: diffbot.php プロジェクト: ErickLopez76/offiria
 /**
  * @return string JSON string
  */
 public function grab($url, $opt = array())
 {
     /* some request need to be ignored */
     if (self::ignore($url)) {
         /* certain link should fetch the information */
         return json_encode($this->ERROR_TAG_WITH_IGNORE);
     }
     jimport('joomla.http.http');
     $jxConfig = new JXConfig();
     /* pass token in url since cannot be set to request body */
     //$uri = 'http://www.diffbot.com/api/article?token='.self::DEVELOPER_KEY.'&url='.$url;
     $uri = 'http://www.diffbot.com/api/article?token=' . $jxConfig->get(JXConfig::DIFFBOT) . '&url=' . $url;
     $u = JUri::getInstance($uri);
     $registry = new JRegistry();
     $curl = new JHttpTransportXCurl($registry);
     $timeout = !empty($opt) && is_numeric($opt['timeout']) ? $opt['timeout'] : self::MAXIMUM_RESPONSE_TIME;
     /* expected object is JHttpResponse */
     $result = new JHttpResponse();
     try {
         /* passing token by data wont work, just use to pass timeout option */
         $result = $curl->request('GET', $u, null, null, $timeout);
         /* response is set to return empty $result->body if exceeding timeout */
         if (!$result->body) {
             throw new Exception('Timeout exceeded');
         }
     } catch (Exception $e) {
         /* catch more error codes */
         if (!empty($result->code) && $result->code != 200) {
             return false;
         }
         /* to check the content of retrieved value */
         $body = json_decode($result->body);
         /* if its an errornous request fallback to error handler */
         if (!empty($body->error)) {
             /* now $body contains $body->error and $body->errorCode */
             $err = array('error' => $body->error, 'code' => $body->errorCode);
             $err = array_merge($err, $this->ERROR_TAG_WITH_IGNORE);
             $result->body = json_encode($err);
         } else {
             /* under some circumstances, the service will failed to load the excerpt from the url
              * if so, tagged with ignore as this will exhaust the request if we keep fetching them */
             $result->body = json_encode($this->ERROR_TAG_WITH_IGNORE);
         }
     }
     /* preserve the json result and format using format() */
     return $result->body;
 }
コード例 #5
0
ファイル: view.html.php プロジェクト: ErickLopez76/offiria
 function display($tpl = null)
 {
     $jxConfig = new JXConfig();
     $doc = JFactory::getDocument();
     $doc->setTitle(JText::_("COM_ACCOUNT_LABEL_BILLING"));
     $total = 0;
     /*$payments = JModel::getInstance('payments', 'AccountModel');
     		$total	 = $payments->getTotal();
     		$payments->getList(null, $jxConfig->get('list_limit'), JRequest::getVar('limitstart', 0));		
     		*/
     $pagination = new JPagination($total, JRequest::getVar('limitstart', 0), $jxConfig->get('list_limit'));
     $this->assignRef('availablePlans', $jxConfig->getAvailablePlans());
     $this->assignRef('plan', $jxConfig->getCurrentPlan());
     $this->assignRef('jxConfig', $jxConfig);
     $this->assignRef('payments', $payments);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
コード例 #6
0
ファイル: file.php プロジェクト: ErickLopez76/offiria
 /**
  * Prep crocodocs preview
  */
 public function preparePreview()
 {
     $jxConfig = new JXConfig();
     $my = JXFactory::getUser();
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_POST, true);
     // copy file to tmp path
     $tmpPath = $jxConfig->get('tmp_path') . DS . $this->filename;
     JFile::copy(JPATH_ROOT . DS . $this->path, $tmpPath);
     // if Crocodocs is enabled
     if ($jxConfig->isCrocodocsEnabled()) {
         curl_setopt($ch, CURLOPT_URL, 'https://crocodoc.com/api/v2/document/upload');
         $post = array("token" => $jxConfig->get("crocodocs"), "file" => "@" . $tmpPath);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
         $response = curl_exec($ch);
         // @todo: validate json
         $responseObj = json_decode($response);
         if (!isset($responseObj->uuid)) {
             return false;
         }
         $uuid = $responseObj->uuid;
         $this->setParam('uuid', $uuid);
         $this->setParam('preview-ready', 0);
     } elseif ($jxConfig->isScribdEnabled()) {
         curl_setopt($ch, CURLOPT_URL, "http://api.scribd.com/api?api_key=" . $jxConfig->get(JXConfig::SCRIBD_API));
         $post = array("method" => "docs.upload", "api_key" => $jxConfig->get(JXConfig::SCRIBD_API), "api_sig" => $jxConfig->get(JXConfig::SCRIBD_SECRET), "my_user_id" => $my->id, "paid_content" => 1, "file" => "@" . $tmpPath);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
         $response = curl_exec($ch);
         $result = simplexml_load_string($response);
         if (!isset($result->doc_id) && !isset($result->access_key)) {
             return false;
         }
         $this->setParam('doc_id', (string) $result->doc_id);
         $this->setParam('access_key', (string) $result->access_key);
         $this->setParam('preview-ready', 0);
     }
     JFile::delete($tmpPath);
     $this->store();
     return true;
 }
コード例 #7
0
ファイル: view.html.php プロジェクト: ErickLopez76/offiria
 function display($tpl = null)
 {
     $defaultAdmin = JXFactory::getUser(42);
     $configHelper = new JXConfig();
     $crocodocs = $configHelper->get('crocodocs');
     $crocodocsenable = $configHelper->get('crocodocsenable');
     $scribd_api = $configHelper->get('scribd_api');
     $scribd_secret = $configHelper->get('scribd_secret');
     $scribdenable = $configHelper->get('scribdenable');
     $diffbot = $configHelper->get('diffbot');
     $mailer = $configHelper->get('mailer');
     $mailfrom = $configHelper->get('mailfrom');
     // admin email ?
     $fromname = $configHelper->get('fromname');
     // admin name ?
     $sendmail = $configHelper->get('sendmail');
     // /usr/sbin/sendmail
     $smtpauth = $configHelper->get('smtpauth');
     $smtpuser = $configHelper->get('smtpuser');
     $smtppass = $configHelper->get('smtppass');
     $smtphost = $configHelper->get('smtphost');
     $smtpsecure = $configHelper->get('smtpsecure');
     $smtpport = $configHelper->get('smtpport');
     // 25
     //overwrite value with postParam when save error
     $error = array();
     if ($_POST) {
         $postParam = JRequest::getVar('jform');
         $crocodocs = $postParam['crocodocs'];
         $crocodocsenable = $postParam['crocodocsenable'];
         $scribd_api = $postParam['scribd_api'];
         $scribd_secret = $postParam['scribd_secret'];
         $scribdenable = $postParam['scribdenable'];
         $diffbot = $postParam['diffbot'];
         $mailer = $postParam['mailer'];
         $mailfrom = $postParam['mailfrom'];
         $fromname = $postParam['fromname'];
         $sendmail = $postParam['sendmail'];
         $smtpauth = $postParam['smtpauth'];
         $smtpuser = $postParam['smtpuser'];
         $smtppass = $postParam['smtppass'];
         $smtphost = $postParam['smtphost'];
         $smtpsecure = $postParam['smtpsecure'];
         $smtpport = $postParam['smtpport'];
     }
     $this->assignRef('crocodocs', $crocodocs);
     $this->assignRef('crocodocsenable', $crocodocsenable);
     $this->assignRef('scribd_api', $scribd_api);
     $this->assignRef('scribd_secret', $scribd_secret);
     $this->assignRef('scribdenable', $scribdenable);
     $this->assignRef('diffbot', $diffbot);
     $this->assignRef('mailer', $mailer);
     $this->assignRef('mailfrom', $mailfrom);
     $this->assignRef('fromname', $fromname);
     $this->assignRef('sendmail', $sendmail);
     $this->assignRef('smtpauth', $smtpauth);
     $this->assignRef('smtpuser', $smtpuser);
     $this->assignRef('smtppass', $smtppass);
     $this->assignRef('smtphost', $smtphost);
     $this->assignRef('smtpsecure', $smtpsecure);
     $this->assignRef('smtpport', $smtpport);
     $doc = JFactory::getDocument();
     $doc->setTitle(JText::_("COM_ACCOUNT_LABEL_ACCOUNT_ADVANCE_SETTING"));
     parent::display($tpl);
 }
コード例 #8
0
ファイル: system.php プロジェクト: ErickLopez76/offiria
 /**
  * 
  */
 public function preview()
 {
     $my = JXFactory::getUser();
     $fileid = JRequest::getVar('file_id');
     $file = JTable::getInstance('File', 'StreamTable');
     $jxConfig = new JXConfig();
     $data = array();
     $data['reload'] = false;
     if ($file->load($fileid) && $my->authorise('stream.file.download', $file) && ($jxConfig->isCrocodocsEnabled() || $jxConfig->isScribdEnabled())) {
         // Grab the uuid
         $uuid = $file->getParam('uuid');
         $docid = $file->getParam('doc_id');
         if ($jxConfig->isCrocodocsEnabled() && empty($uuid) || $jxConfig->isScribdEnabled() && empty($docid)) {
             // haven't been uploaded yet, upload and grab the uuid
             $store = $file->preparePreview();
             // reload file for updated content
             $file->load($fileid);
             $uuid = $file->getParam('uuid');
             $docid = $file->getParam('doc_id');
         }
         // Check if file is ready
         $previewReady = $file->getParam('preview-ready');
         $isViewable = false;
         if (empty($previewReady)) {
             if ($jxConfig->isCrocodocsEnabled()) {
                 // Preview not ready, query status
                 $options = new JRegistry();
                 $transport = new JHttpTransportCurl($options);
                 $http = new JHttp($options, $transport);
                 $response = $http->get('https://crocodoc.com/api/v2/document/status?token=' . $jxConfig->get(JXConfig::CROCODOCS) . '&uuids=' . $file->getParam('uuid'));
                 $responseObj = json_decode($response->body);
                 //print_r($responseObj); exit;
                 if (!isset($responseObj->error)) {
                     $isViewable = !empty($responseObj[0]->viewable);
                     if ($isViewable) {
                         $previewReady = true;
                         $file->setParam('preview-ready', 1);
                         $file->store();
                     }
                 }
             } else {
                 // Query Scribd Preview status
                 $http = new JHttp();
                 $statusUrl = 'http://api.scribd.com/api?api_key=' . $jxConfig->get(JXConfig::SCRIBD_API) . '&doc_id=' . $file->getParam('doc_id') . '&method=docs.getConversionStatus&my_user_id=' . $file->user_id;
                 $response = $http->get($statusUrl);
                 $result = simplexml_load_string($response->body);
                 if (isset($result->conversion_status) && $result->conversion_status == 'DONE') {
                     $previewReady = true;
                     $file->setParam('preview-ready', 1);
                     $file->store();
                 }
             }
         }
         if ($previewReady && (!empty($uuid) || !empty($docid))) {
             if ($jxConfig->isCrocodocsEnabled()) {
                 $session_id = $file->getParam('previewSession');
                 if (time() > $file->getParam('previewExpiry')) {
                     // File uploaded, try to create session
                     $options = new JRegistry();
                     $transport = new JHttpTransportCurl($options);
                     $http = new JHttp($options, $transport);
                     $response = $http->post('https://crocodoc.com/api/v2/session/create', array('token' => '$jxConfig->get(JXConfig::CROCODOCS)', 'uuid' => $file->getParam('uuid')));
                     //$response =  $http->post( 'https://crocodoc.com/api/v2/session/create' , array('token' => 'Oe8fA1mQ59LSwtBlKy4Nkbvn', 'uuid' => $uuid ) );
                     $responseObj = json_decode($response->body);
                     $session_id = $responseObj->session;
                     // Store this session so that we don't have to fetch it again
                     $file->setParam('previewSession', $session_id);
                     $file->setParam('previewExpiry', time() + 60 * 50);
                     // ste it 50 mins from now
                     $file->store();
                 }
                 $html = '<iframe style="border:0px;width:100%;height:100%" src="https://crocodoc.com/view/' . $session_id . '"></iframe>';
             } else {
                 $html = "<div id='embedded_doc' data-doc_id=\"" . $file->getParam("doc_id") . "\" data-access_key=\"" . $file->getParam("access_key") . "\"><a href='http://www.scribd.com'>Scribd</a></div>\t\t\t\t\t\t\n\t\t\t\t\t\t\t <script type=\"text/javascript\">\n\t\t\t\t\t\t\t\t// Instantiate iPaper\n\t\t\t\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\t\t\tscribd_doc = scribd.Document.getDoc(\$('#embedded_doc').data('doc_id'), \$('#embedded_doc').data('access_key'));\n\t\t\t\t\t\t\t\t\t// Parameters\n\t\t\t\t\t\t\t\t\tscribd_doc.addParam('height', 750);\n\t\t\t\t\t\t\t\t\tscribd_doc.addParam('width', 750);\n\t\t\t\t\t\t\t\t\tscribd_doc.addParam('auto_size', true);\n\t\t\t\t\t\t\t\t\tscribd_doc.addParam('mode', 'slideshow');\n\t\t\t\t\t\t\t\t\tscribd_doc.addParam('jsapi_version', 2);\n\n\t\t\t\t\t\t\t\t\t// Attach event listeners\n\t\t\t\t\t\t\t\t\tscribd_doc.addEventListener('docReady', onDocReady);\n\n\t\t\t\t\t\t\t\t\t// Write the instance\n\t\t\t\t\t\t\t\t\tscribd_doc.write('embedded_doc');\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t  \n\t\t\t\t\t\t\t\tvar onDocReady = function(e) {\n\t\t\t\t\t\t\t\t\tscribd_doc.api.setPage(1);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t  \n\t\t\t\t\t\t\t\t// Bookmark Helpers\n\t\t\t\t\t\t\t\tvar goToPage = function(page) {\n\t\t\t\t\t\t\t\t\tif (scribd_doc.api){\n\t\t\t\t\t\t\t\t\t\tscribd_doc.api.setPage(page);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t  \n\t\t\t\t\t\t\t\tvar goToMiddle = function() {\n\t\t\t\t\t\t\t\t\tif (scribd_doc.api){\n\t\t\t\t\t\t\t\t\t\tgoToPage( Math.floor(scribd_doc.api.getPageCount()/2) );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvar goToEnd = function() {\n\t\t\t\t\t\t\t\t\tif (scribd_doc.api) {\n\t\t\t\t\t\t\t\t\t\tgoToPage(scribd_doc.api.getPageCount());\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t  </script>";
             }
             $data['html'] = $html;
         } else {
             $data['reload'] = 1;
             $data['file_id'] = $fileid;
             $data['html'] = '<p>Please wait while we prepare your document</p>';
         }
     } else {
         $data['html'] = "<p>Not allowed to preview.</p>";
     }
     echo json_encode($data);
     exit;
 }