protected function beforeRun($action, $params, $render) { $this->client = new \GO\Googledrive\Client(); $this->client->setRedirectUri(\GO::url($this->getRoute("connect"), array(), false, false, false)); $this->service = new Google_DriveService($this->client); $token = \GO::config()->get_setting('googledrive_token', \GO::user()->id); if ($token) { $this->client->setAccessToken($token); } return parent::beforeRun($action, $params, $render); }
protected function actionRenderJupload($params) { //$cookieParams = session_get_cookie_params(); $sessionCookie = 'Cookie: ' . session_name() . '=' . session_id(); //TODO: Check if code below is necessary // if(!empty($cookieParams['domain'])) // $sessionCookie .= '; Domain='.$cookieParams['domain']; // // $sessionCookie .= '; Path='.$cookieParams['path']; // // if(!empty($cookieParams['lifetime'])) // $sessionCookie .= '; Expires='.gmdate('D, d M Y H:i:s \G\M\T', time()+$cookieParams['lifetime']); // // if($cookieParams['secure']) // $sessionCookie .= '; Secure'; // // if($cookieParams['httponly']) // $sessionCookie .= '; HttpOnly'; $afterUploadScript = ' <script type="text/javascript"> function afterUpload(success){ // opener.GO.files.juploadFileBrowser.sendOverwrite({upload:true}); if(success){ window.uploadSuccess=true; setTimeout("self.close();", 1000); } } </script> '; $appletCode = ' <applet code="wjhk.jupload2.JUploadApplet" name="JUpload" archive="' . \GO::config()->host . 'go/vendor/jupload/wjhk.jupload.jar' . '" width="640" height="480" mayscript="true" alt="The java pugin must be installed."> <param name="lang" value="' . \GO::user()->language . '" /> <param name="readCookieFromNavigator" value="false" /> <!--<param name="lookAndFeel" value="system" />--> <param name="postURL" value="' . \GO::url('files/jupload/handleUploads') . '" /> <param name="afterUploadURL" value="javascript:afterUpload(%success%);" /> <param name="showLogWindow" value="false" /> <param name="maxChunkSize" value="1048576" /> <param name="specificHeaders" value="' . $sessionCookie . '" /> <param name="maxFileSize" value="' . intval(\GO::config()->max_file_size) . '" /> <param name="nbFilesPerRequest" value="5" /> <!--<param name="debugLevel" value="99" />--> Java 1.5 or higher plugin required. </applet>'; $this->render('jupload', array('applet' => $appletCode, 'afterUploadScript' => $afterUploadScript)); }
protected function getThumbURL() { if ($this->logo != '') { if ($this->public_icon == '1') { return \GO::modules()->host . 'modules/bookmarks/' . $this->logo; } else { return \GO::url('core/thumb', array('src' => $this->logo, 'w' => 16, 'h' => 16)); } } else { return false; } }
protected function afterDisplay(&$response, &$model, &$params) { $response['data']['path'] = $model->path; $response['data']['size'] = \GO\Base\Util\Number::formatSize($model->fsFile->size()); $response['data']['extension'] = strtolower($model->fsFile->extension()); $response['data']['type'] = \GO::t($response['data']['extension'], 'base', 'filetypes'); $response['data']['locked_user_name'] = $model->lockedByUser ? $model->lockedByUser->name : ''; $response['data']['locked'] = $model->isLocked(); $response['data']['unlock_allowed'] = $model->unlockAllowed(); if (!empty($model->random_code) && time() < $model->expire_time) { $response['data']['expire_time'] = \GO\Base\Util\Date::get_timestamp(\GO\Base\Util\Date::date_add($model->expire_time, -1), false); $response['data']['download_link'] = $model->emailDownloadURL; } else { $response['data']['expire_time'] = ""; $response['data']['download_link'] = ""; } $response['data']['url'] = \GO::url('files/file/download', array('id' => $model->id), false, true); if ($model->fsFile->isImage()) { $response['data']['thumbnail_url'] = $model->thumbURL; } else { $response['data']['thumbnail_url'] = ""; } $response['data']['handler'] = 'startjs:function(){' . $model->getDefaultHandler()->getHandler($model) . '}:endjs'; try { if (\GO::modules()->filesearch) { $filesearch = \GO\Filesearch\Model\Filesearch::model()->findByPk($model->id); // if(!$filesearch){ // $filesearch = \GO\Filesearch\Model\Filesearch::model()->createFromFile($model); // } if ($filesearch) { $response['data'] = array_merge($filesearch->getAttributes('formatted'), $response['data']); if (!empty($params['query_params'])) { $qp = json_decode($params['query_params'], true); if (isset($qp['content_all'])) { $c = new \GO\Filesearch\Controller\FilesearchController(); $response['data']['text'] = $c->highlightSearchParams($qp, $response['data']['text']); } } } else { $response['data']['text'] = \GO::t('notIndexedYet', 'filesearch'); } } } catch (\Exception $e) { \GO::debug((string) $e); $response['data']['text'] = "Index out of date. Please rebuild it using the admin tools."; } return parent::afterDisplay($response, $model, $params); }
protected function actionDownloadWin7($params) { $url = \GO::url('email/message/mailto', array('mailto' => '-mailto-'), false, false, false); //this is necessary because we don't want %1 to be urlencoded. $url = str_replace('-mailto-', '%1', $url); $data = 'Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\\mailto] @="URL:MailTo Protocol" "EditFlags"=hex:02,00,00,00 "URL Protocol"="" [HKEY_CLASSES_ROOT\\mailto\\DefaultIcon] @="" [HKEY_CLASSES_ROOT\\mailto\\shell] [HKEY_CLASSES_ROOT\\mailto\\shell\\open] [HKEY_CLASSES_ROOT\\mailto\\shell\\open\\command] @="rundll32.exe url.dll,FileProtocolHandler ' . $url . '\\" [HKEY_CLASSES_ROOT\\Group-Office.Url.mailto] @="MailTo Protocol" "URL Protocol"="" [HKEY_CLASSES_ROOT\\Group-Office.Url.mailto\\DefaultIcon] @="" [HKEY_CLASSES_ROOT\\Group-Office.Url.mailto\\shell] [HKEY_CLASSES_ROOT\\Group-Office.Url.mailto\\shell\\open] "FriendlyAppName"="Group-Office" [HKEY_CLASSES_ROOT\\Group-Office.Url.mailto\\shell\\open\\command] @="rundll32.exe url.dll,FileProtocolHandler ' . $url . '" [HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\mailto] [HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\mailto\\UserChoice] "Progid"="Group-Office.Url.mailto" '; \GO\Base\Util\Http::downloadFile(new \GO\Base\Fs\MemoryFile('Group-Office_email.reg', $data)); }
public function getZipOfAttachmentsUrl() { return \GO::url("savemailas/linkedEmail/zipOfAttachments", array("tmpdir" => str_replace(\GO::config()->tmpdir, '', $this->_getTempDir()))); }
<li><a href="<?php echo GO::url("email/responsive/load"); ?> ">Address book</a></li> </ul> <ul class="nav navbar-nav navbar-right"> <li><a href="<?php echo GO::url('setttings/edit'); ?> "><span class="glyphicon glyphicon-user"></span> <?php echo GO::user()->name; ?> </a></li> <li><a href="<?php echo GO::url('auth/logout'); ?> "><?php echo GO::t('logout'); ?> </a></li> </ul> </div><!--/.nav-collapse --> </div><!--/.container-fluid --> </div> <?php } ?> <div id="goMessageContainer"></div> <div id="go-module-container">
public function getHandler(\GO\Files\Model\File $file) { return 'window.open("' . \GO::url("webodf/file/edit", array('id' => $file->id)) . '");'; }
public function getUrl() { if ($this->hasTempFile()) { return parent::getUrl(); } else { $params = array("account_id" => $this->account->id, "mailbox" => $this->mailbox, "uid" => $this->uid, "number" => $this->number, "encoding" => $this->encoding, "filename" => $this->name); } $nameArr = explode('.', $this->name); if (\GO::modules()->isInstalled('addressbook') && $nameArr[count($nameArr) - 1] == 'vcf') { return \GO::url('addressbook/contact/handleAttachedVCard', $params); } return \GO::url('email/message/attachment', $params); }
protected function actionBatchSend($params) { $this->requireCli(); $this->_sentEmails = array(); \GO::$disableModelCache = true; $mailing = \GO\Addressbook\Model\SentMailing::model()->findByPk($params['mailing_id']); if (!$mailing) { throw new \Exception("Mailing not found!\n"); } \GO::session()->runAs($mailing->user_id); echo 'Status: ' . $mailing->status . "\n"; if (empty($mailing->status)) { echo "Starting mailing at " . \GO\Base\Util\Date::get_timestamp(time()) . "\n"; $mailing->reset(); } elseif (!empty($params['restart'])) { echo "Restarting mailing at " . \GO\Base\Util\Date::get_timestamp(time()) . "\n"; $mailing->reset(); } elseif ($mailing->status == \GO\Addressbook\Model\SentMailing::STATUS_PAUSED) { echo "Resuming mailing at " . \GO\Base\Util\Date::get_timestamp(time()) . "\n"; $mailing->status = \GO\Addressbook\Model\SentMailing::STATUS_RUNNING; $mailing->save(); } $htmlToText = new \GO\Base\Util\Html2Text(); //$addresslist = \GO\Addressbook\Model\Addresslist::model()->findByPk($mailing->addresslist_id); $mimeData = file_get_contents(\GO::config()->file_storage_path . $mailing->message_path); $message = \GO\Base\Mail\Message::newInstance()->loadMimeMessage($mimeData); $joinCriteria = \GO\Base\Db\FindCriteria::newInstance()->addRawCondition('t.id', 'a.account_id'); $findParams = \GO\Base\Db\FindParams::newInstance()->single()->join(\GO\Email\Model\Alias::model()->tableName(), $joinCriteria, 'a')->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('id', $mailing->alias_id, '=', 'a')); if ($mailing->campaign_id > 0 && \GO::modules()->isAvailable('campaigns')) { $account = new \GO\Email\Model\Account(); $account->username = \GO::config()->campaigns_imap_user; $account->password = \GO::config()->campaigns_imap_pass; $account->host = \GO::config()->campaigns_imap_server; $account->port = \GO::config()->campaigns_imap_port; $account->smtp_username = \GO::config()->campaigns_smtp_user; $account->smtp_password = \GO::config()->campaigns_smtp_pass; $account->smtp_host = \GO::config()->campaigns_smtp_server; $account->smtp_port = \GO::config()->campaigns_smtp_port; $message->setFrom(\GO::config()->campaigns_from); } else { $account = \GO\Email\Model\Account::model()->find($findParams); if (!$account->store_password && !empty($mailing->temp_pass)) { $account->smtp_password = $mailing->temp_pass; } } $mailer = \GO\Base\Mail\Mailer::newGoInstance(\GO\Email\Transport::newGoInstance($account)); echo "Will send emails from " . $account->username . ".\n"; if (empty(\GO::config()->mailing_messages_per_minute)) { \GO::config()->mailing_messages_per_minute = 30; } //Rate limit to 100 emails per-minute $mailer->registerPlugin(new \Swift_Plugins_ThrottlerPlugin(\GO::config()->mailing_messages_per_minute, \Swift_Plugins_ThrottlerPlugin::MESSAGES_PER_MINUTE)); // Use AntiFlood to re-connect after 50 emails $mailer->registerPlugin(new \Swift_Plugins_AntiFloodPlugin(\GO::config()->mailing_messages_per_minute)); echo 'Sending a maximum of ' . \GO::config()->mailing_messages_per_minute . ' messages per minute' . "\n"; $failedRecipients = array(); $bodyWithTags = $message->getBody(); foreach ($mailing->contacts as $contact) { $sentMailingContactModel = \GO\Addressbook\Model\SentMailingContact::model()->findSingleByAttributes(array('sent_mailing_id' => $mailing->id, 'contact_id' => $contact->id)); if (!$sentMailingContactModel->sent) { $errors = 1; $unsubscribeHref = \GO::url('addressbook/sentMailing/unsubscribe', array('addresslist_id' => $mailing->addresslist_id, 'contact_id' => $contact->id, 'token' => md5($contact->ctime . $contact->addressbook_id . $contact->firstEmail)), false, true); $body = str_replace('%unsubscribe_href%', $unsubscribeHref, $bodyWithTags); //curly brackets don't work inside links in browser wysiwyg editors. $templateModel = \GO\Addressbook\Model\Template::model(); $templateModel->htmlSpecialChars = false; $body = $templateModel->replaceCustomTags($body, array('unsubscribe_link' => '<a href="' . $unsubscribeHref . '" target="_blank">' . \GO::t("unsubscription", "addressbook") . '</a>'), true); $templateModel->htmlSpecialChars = true; try { if (!$contact->email_allowed) { echo "Skipping contact " . $contact->firstEmail . " because newsletter sending is disabled in the addresslists tab.\n\n"; } elseif (empty($contact->firstEmail)) { echo "Skipping contact " . $contact->name . " no e-mail address was set.\n\n"; } else { $body = \GO\Addressbook\Model\Template::model()->replaceContactTags($body, $contact); $message->setTo($contact->firstEmail, $contact->name); $message->setBody($body); $plainTextPart = $message->findPlainTextBody(); if ($plainTextPart) { $htmlToText->set_html($body); $plainTextPart->setBody($htmlToText->get_text()); } // Check mail limit $nSentMails = \GO::config()->get_setting('campaigns_number_sent_mails', 0); if ($mailing->campaign_id > 0 && $nSentMails >= \GO::config()->campaigns_max_mails_per_period) { $this->_pauseMailing($mailing->id); echo "Error for " . $contact->firstEmail . ": \n"; echo str_replace('%maxMails', \GO::config()->campaigns_max_mails_per_period, \GO::t('sentMailLimitReached', 'campaigns')); exit; } $this->_sendmail($message, $contact, $mailer, $mailing); \GO::config()->save_setting('campaigns_number_sent_mails', $nSentMails + 1, 0); $errors = 0; } } catch (\Exception $e) { echo "Error for " . $contact->firstEmail . ": " . $e->getMessage() . "\n"; } if ($errors) { $mailing->errors++; $mailing->save(); } } } foreach ($mailing->companies as $company) { $sentMailingCompanyModel = \GO\Addressbook\Model\SentMailingCompany::model()->findSingleByAttributes(array('sent_mailing_id' => $mailing->id, 'company_id' => $company->id)); if (!$sentMailingCompanyModel->sent) { $errors = 1; $unsubscribeHref = \GO::url('addressbook/sentMailing/unsubscribe', array('addresslist_id' => $mailing->addresslist_id, 'company_id' => $company->id, 'token' => md5($company->ctime . $company->addressbook_id . $company->email)), true, true); $body = str_replace('%unsubscribe_href%', $unsubscribeHref, $bodyWithTags); //curly brackets don't work inside links in browser wysiwyg editors. $body = \GO\Addressbook\Model\Template::model()->replaceCustomTags($body, array('unsubscribe_link' => '<a href="' . $unsubscribeHref . '">' . \GO::t("unsubscription", "addressbook") . '</a>'), true); try { if (!$company->email_allowed) { echo "Skipping company " . $company->email . " because newsletter sending is disabled in the addresslists tab.\n\n"; } elseif (empty($company->email)) { echo "Skipping company " . $company->name . " no e-mail address was set.\n\n"; } else { $body = \GO\Addressbook\Model\Template::model()->replaceModelTags($body, $company); $message->setTo($company->email, $company->name); $message->setBody($body); $plainTextPart = $message->findPlainTextBody(); if ($plainTextPart) { $htmlToText->set_html($body); $plainTextPart->setBody($htmlToText->get_text()); } // Check mail limit $nSentMails = \GO::config()->get_setting('campaigns_number_sent_mails', 0); if ($mailing->campaign_id > 0 && $nSentMails >= \GO::config()->campaigns_max_mails_per_period) { $this->_pauseMailing($mailing->id); echo "Error for " . $contact->firstEmail . ": \n"; echo str_replace('%maxMails', \GO::config()->campaigns_max_mails_per_period, \GO::t('sentMailLimitReached', 'campaigns')); exit; } $this->_sendmail($message, $company, $mailer, $mailing); \GO::config()->save_setting('campaigns_number_sent_mails', $nSentMails + 1, 0); $errors = 0; } } catch (\Exception $e) { echo "Error for " . $company->email . ": " . $e->getMessage() . "\n"; } if ($errors) { $mailing->errors++; $mailing->save(); } } } $mailing->status = \GO\Addressbook\Model\SentMailing::STATUS_FINISHED; // Unset the temp_pass if (!empty($mailing->temp_pass)) { $mailing->temp_pass = ""; } $mailing->save(); echo "Mailing finished at " . \GO\Base\Util\Date::get_timestamp(time()) . "\n"; }
/** * Get the download URL * @return string */ public function getUrl() { if ($this->getExtension() == 'dat') { return \GO::url('email/message/tnefAttachmentFromTempFile', array('tmp_file' => $this->getTempFile())); } else { return \GO::url('core/downloadTempFile', array('path' => $this->getTempFile())); } }
/** * Action to be called from browser address bar. It compares all the language * fields of lang1 and lang2 in the current Group-Office installation, and * echoes the fields that are in one language but not the other. * @param type $params MUST contain $params['lang1'] AND $params['lang2'] */ protected function actionCheckLanguage($params) { header('Content-Type: text/html; charset=UTF-8'); $lang1code = empty($params['lang1']) ? 'en' : $params['lang1']; $lang2code = empty($params['lang2']) ? 'nl' : $params['lang2']; $commonLangFolder = new \GO\Base\Fs\Folder(\GO::config()->root_path . 'language/'); $commonLangFolderContentArr = $commonLangFolder->ls(); $moduleModelArr = \GO::modules()->getAllModules(); echo "<h1>Translate tool</h1>"; echo '<p><a href="' . \GO::url("maintenance/zipLanguage", array("lang" => $lang2code)) . '">Download zip file for ' . $lang2code . '</a></p>'; foreach ($commonLangFolderContentArr as $commonContentEl) { if (get_class($commonContentEl) == 'GO\\Base\\Fs\\Folder') { echo '<h3>' . $commonContentEl->path() . '</h3>'; echo $this->_compareLangFiles($commonContentEl->path() . '/' . $lang1code . '.php', $commonContentEl->path() . '/' . $lang2code . '.php'); echo '<hr>'; } else { // $commonContentEl = new \GO\Base\Fs\File(); // $langFileContentString = $commonContentEl->getContents(); } } foreach ($moduleModelArr as $moduleModel) { echo '<h3>' . $moduleModel->path . '</h3>'; echo $this->_compareLangFiles($moduleModel->path . 'language/' . $lang1code . '.php', $moduleModel->path . 'language/' . $lang2code . '.php'); echo '<hr>'; } }
protected function getThumbURL() { $params = array('src' => $this->path, 'foldericon' => $this->acl_id ? 'folder_public.png' : 'folder.png', 'lw' => 100, 'ph' => 100, 'zc' => 1, 'filemtime' => $this->mtime); return \GO::url('core/thumb', $params); }
public function getZipOfAttachmentsUrl() { // return \GO::config()->host.'modules/email/'. // 'zip_attachments.php?account_id='.$this->account->id. // '&mailbox='.urlencode($this->mailbox). // '&uid='.$this->uid.'&filename='.urlencode($this->subject); // $params = array("account_id" => $this->account->id, "mailbox" => $this->mailbox, "uid" => $this->uid); return \GO::url('email/message/zipAllAttachments', $params); }
public function actionRemoveDuplicates($params) { \GO::setMaxExecutionTime(300); \GO::setMemoryLimit(1024); $this->render('externalHeader'); $tasklist = \GO\Tasks\Model\Tasklist::model()->findByPk($params['tasklist_id']); if (!$tasklist) { throw new \GO\Base\Exception\NotFound(); } \GO\Base\Fs\File::setAllowDeletes(false); //VERY IMPORTANT: \GO\Files\Model\Folder::$deleteInDatabaseOnly = true; \GO::session()->closeWriting(); //close writing otherwise concurrent requests are blocked. $checkModels = array("GO\\Tasks\\Model\\Task" => array('name', 'start_time', 'due_time', 'rrule', 'user_id', 'tasklist_id')); foreach ($checkModels as $modelName => $checkFields) { if (empty($params['model']) || $modelName == $params['model']) { echo '<h1>' . \GO::t('removeDuplicates') . '</h1>'; $checkFieldsStr = 't.' . implode(', t.', $checkFields); $findParams = \GO\Base\Db\FindParams::newInstance()->ignoreAcl()->select('t.id, count(*) AS n, ' . $checkFieldsStr)->group($checkFields)->having('n>1'); $findParams->getCriteria()->addCondition('tasklist_id', $tasklist->id); $stmt1 = \GO::getModel($modelName)->find($findParams); echo '<table border="1">'; echo '<tr><td>ID</th><th>' . implode('</th><th>', $checkFields) . '</th></tr>'; $count = 0; while ($dupModel = $stmt1->fetch()) { $select = 't.id'; if (\GO::getModel($modelName)->hasFiles()) { $select .= ', t.files_folder_id'; } $findParams = \GO\Base\Db\FindParams::newInstance()->ignoreAcl()->select($select . ', ' . $checkFieldsStr)->order('id', 'ASC'); $findParams->getCriteria()->addCondition('tasklist_id', $tasklist->id); foreach ($checkFields as $field) { $findParams->getCriteria()->addCondition($field, $dupModel->getAttribute($field)); } $stmt = \GO::getModel($modelName)->find($findParams); $first = true; while ($model = $stmt->fetch()) { echo '<tr><td>'; if (!$first) { echo '<span style="color:red">'; } echo $model->id; if (!$first) { echo '</span>'; } echo '</th>'; foreach ($checkFields as $field) { echo '<td>' . $model->getAttribute($field, 'html') . '</td>'; } echo '</tr>'; if (!$first) { if (!empty($params['delete'])) { if ($model->hasLinks() && $model->countLinks()) { echo '<tr><td colspan="99">' . \GO::t('skippedDeleteHasLinks') . '</td></tr>'; } elseif (($filesFolder = $model->getFilesFolder(false)) && ($filesFolder->hasFileChildren() || $filesFolder->hasFolderChildren())) { echo '<tr><td colspan="99">' . \GO::t('skippedDeleteHasFiles') . '</td></tr>'; } else { $model->delete(); } } $count++; } $first = false; } } echo '</table>'; echo '<p>' . sprintf(\GO::t('foundDuplicates'), $count) . '</p>'; echo '<br /><br /><a href="' . \GO::url('tasks/tasklist/removeDuplicates', array('delete' => true, 'tasklist_id' => $tasklist->id)) . '">' . \GO::t('clickToDeleteDuplicates') . '</a>'; } } $this->render('externalFooter'); }
public function getCachedStylesheet() { $modules = \GO::modules()->getAllModules(true); $mods = ''; foreach ($modules as $module) { $mods .= $module->id; } $hash = md5(\GO::config()->mtime . $mods); $cacheFolder = \GO::config()->getCacheFolder(); $cssFile = $cacheFolder->createChild($hash . '-' . $this->getTheme()->getName() . '-style.css'); if (!$cssFile->exists() || \GO::config()->debug) { $css = ''; //$fp = fopen($cssFile->path(), 'w+'); foreach ($this->_stylesheets as $s) { $baseurl = str_replace(\GO::config()->root_path, \GO::config()->host, dirname($s)) . '/'; $css .= $this->_replaceUrl(file_get_contents($s), $baseurl); //fputs($fp, $this->_replaceUrl(file_get_contents($s),$baseurl)); } //fclose($fp); if (\GO::config()->minify) { $cssMin = new \GO\Base\Util\Minify\CSSMin(); $css = $cssMin->run($css); } $cssFile->putContents($css); } //$cssurl = $GLOBALS['GO_CONFIG']->host.'compress.php?file='.basename($relpath); $cssurl = \GO::url('core/compress', array('file' => $cssFile->name(), 'mtime' => $cssFile->mtime())); return $cssurl; }
public function getThumbURL($urlParams = array("lw" => 100, "ph" => 100, "zc" => 1)) { $urlParams['filemtime'] = $this->mtime; $urlParams['src'] = $this->path; if ($this->extension == 'svg') { return $this->getDownloadURL(false, true); } else { return \GO::url('core/thumb', $urlParams); } }
public function getThumbURL($urlParams = array("lw" => 100, "ph" => 100, "zc" => 1)) { $urlParams['filemtime'] = $this->mtime; $urlParams['src'] = $this->path; return \GO::url('core/thumb', $urlParams); }
public function getPhotoThumbURL($urlParams = array("lw" => 120, "pw" => 120, "zc" => 0)) { if ($this->getPhotoFile()->exists()) { $urlParams['filemtime'] = $this->getPhotoFile()->mtime(); $urlParams['src'] = $this->getPhotoFile()->stripFileStoragePath(); return \GO::url('core/thumb', $urlParams); } else { return \GO::config()->host . 'modules/addressbook/themes/Default/images/unknown-person.png'; } }
if ($module->permissionLevel) { if (file_exists($module->moduleManager->path() . 'scripts.inc.php')) { require $module->moduleManager->path() . 'scripts.inc.php'; } if (file_exists($module->moduleManager->path() . 'views/Extjs3/scripts.inc.php')) { require $module->moduleManager->path() . 'views/Extjs3/scripts.inc.php'; } } } $filename = $user_id . '-scripts.js'; $path = $cacheFolder->path() . '/' . $filename; if ($GO_SCRIPTS_JS != @file_get_contents($path)) { file_put_contents($path, $GO_SCRIPTS_JS); } if (file_exists($path)) { $url = \GO::url("core/compress", array('file' => $filename, 'mtime' => filemtime($path))); echo '<script type="text/javascript" src="' . $url . '"></script>' . "\n"; } } ?> <script type="text/javascript"> Ext.BLANK_IMAGE_URL = '<?php echo \GO::config()->host; ?> views/Extjs3/ext/resources/images/default/s.gif'; Ext.state.Manager.setProvider(new GO.state.HttpProvider()); <?php if (isset(\GO::session()->values['security_token'])) { echo 'Ext.Ajax.extraParams={security_token:"' . \GO::session()->values['security_token'] . '"};'; } GO::router()->getController()->fireEvent('inlinescripts');
} //check if GO is installed if (empty($_REQUEST['r']) && PHP_SAPI != 'cli') { if (\GO::user() && isset($_SESSION['GO_SESSION']['after_login_url'])) { $url = \GO::session()->values['after_login_url']; unset(\GO::session()->values['after_login_url']); header('Location: ' . $url); exit; } $installed = true; if (!\GO::config()->get_config_file() || empty(\GO::config()->db_user)) { $installed = false; } else { $stmt = \GO::getDbConnection()->query("SHOW TABLES"); if (!$stmt->rowCount()) { $installed = false; } } if (!$installed) { header('Location: ' . \GO::config()->host . 'install/'); exit; } //check for database upgrades $mtime = \GO::config()->get_setting('upgrade_mtime'); if ($mtime != \GO::config()->mtime) { \GO::infolog("Running system update"); header('Location: ' . \GO::url('maintenance/upgrade')); exit; } } \GO::router()->runController();
/** * Sends a meeting request to all participants. If the participant is not a Group-Office user * or the organizer has no permissions to schedule an event it will include an * icalendar attachment so the calendar software can schedule it. * * @return boolean * @throws Exception */ public function sendMeetingRequest($newParticipantsOnly = false, $update = false) { if (!$this->is_organizer) { throw new \Exception("Meeting request can only be send from the organizer's event"); } $stmt = $this->participants; //handle missing user if (!$this->user) { $this->user_id = 1; $this->save(true); } while ($participant = $stmt->fetch()) { if (!$newParticipantsOnly || isset(\GO::session()->values['new_participant_ids']) && in_array($participant->user_id, \GO::session()->values['new_participant_ids'])) { //don't invite organizer if ($participant->is_organizer) { continue; } // Set the language of the email to the language of the participant. $language = false; if (!empty($participant->user_id)) { $user = \GO\Base\Model\User::model()->findByPk($participant->user_id); if ($user) { \GO::language()->setLanguage($user->language); } } //if participant status is pending then send a new inviation subject. Otherwise send it as update if (!$update) { $subject = \GO::t('invitation', 'calendar') . ': ' . $this->name; $bodyLine = \GO::t('invited', 'calendar'); } else { $subject = \GO::t('invitation_update', 'calendar') . ': ' . $this->name; $bodyLine = \GO::t('eventUpdated', 'calendar'); } //create e-mail message $message = \GO\Base\Mail\Message::newInstance($subject)->setFrom($this->user->email, $this->user->name)->addTo($participant->email, $participant->name); //check if we have a Group-Office event. If so, we can handle accepting //and declining in Group-Office. Otherwise we'll use ICS calendar objects by mail $participantEvent = $participant->getParticipantEvent(); $body = '<p>' . $bodyLine . ': </p>' . $this->toHtml(); // if(!$participantEvent){ //build message for external program $acceptUrl = \GO::url("calendar/event/invitation", array("id" => $this->id, 'accept' => 1, 'email' => $participant->email, 'participantToken' => $participant->getSecurityToken()), false); $declineUrl = \GO::url("calendar/event/invitation", array("id" => $this->id, 'accept' => 0, 'email' => $participant->email, 'participantToken' => $participant->getSecurityToken()), false); // if($participantEvent){ //hide confusing buttons if user has a GO event. $body .= '<div class="go-hidden">'; // } $body .= '<p><br /><b>' . \GO::t('linkIfCalendarNotSupported', 'calendar') . '</b></p>' . '<p>' . \GO::t('acccept_question', 'calendar') . '</p>' . '<a href="' . $acceptUrl . '">' . \GO::t('accept', 'calendar') . '</a>' . ' | ' . '<a href="' . $declineUrl . '">' . \GO::t('decline', 'calendar') . '</a>'; // if($participantEvent){ $body .= '</div>'; // } $ics = $this->toICS("REQUEST"); $a = \Swift_Attachment::newInstance($ics, \GO\Base\Fs\File::stripInvalidChars($this->name) . '.ics', 'text/calendar; METHOD="REQUEST"'); $a->setEncoder(new Swift_Mime_ContentEncoder_PlainContentEncoder("8bit")); $a->setDisposition("inline"); $message->attach($a); //for outlook 2003 compatibility $a2 = \Swift_Attachment::newInstance($ics, 'invite.ics', 'application/ics'); $a2->setEncoder(new Swift_Mime_ContentEncoder_PlainContentEncoder("8bit")); $message->attach($a2); if ($participantEvent) { $url = \GO::createExternalUrl('calendar', 'openCalendar', array('unixtime' => $this->start_time)); $body .= '<br /><a href="' . $url . '">' . \GO::t('openCalendar', 'calendar') . '</a>'; } $message->setHtmlAlternateBody($body); // Set back the original language if ($language !== false) { \GO::language()->setLanguage($language); } \GO\Base\Mail\Mailer::newGoInstance()->send($message); } } unset(\GO::session()->values['new_participant_ids']); return true; }
public function getPhotoThumbURL($urlParams = array("w" => 120, "h" => 160, "zc" => 1)) { if ($this->getPhotoFile()->exists()) { $urlParams['filemtime'] = $this->getPhotoFile()->mtime(); $urlParams['src'] = $this->getPhotoFile()->stripFileStoragePath(); return \GO::url('core/thumb', $urlParams); } else { // TODO: Finish the implementation of gravatar (Scaling gravatar image etc..) // $hash = $this->_getGravatarHash(); // if(!empty($hash)) // return 'http://www.gravatar.com/avatar/'.$hash.'.jpg?s='.$urlParams['h'].'&d=mm'; // else return \GO::config()->host . 'modules/addressbook/themes/Default/images/unknown-person.png'; } }