コード例 #1
0
 public static function ipHead($head)
 {
     $vars = array('siteName' => ipGetOptionLang('Config.websiteTitle'));
     $defaultTitle = ipGetOptionLang('FacebookTags.defaultTitle');
     if ($defaultTitle) {
         $vars['title'] = $defaultTitle;
     }
     $defaultImage = array(ipGetOptionLang('FacebookTags.defaultImage'));
     if ($defaultImage) {
         $vars['images'] = $defaultImage;
     }
     $adminId = ipGetOptionLang('FacebookTags.adminId');
     if ($adminId) {
         $vars['adminId'] = $adminId;
     }
     $pageTags = Service::facebookTags();
     if (!empty($pageTags['images'])) {
         foreach ($pageTags['images'] as &$image) {
             $image = ipFileUrl('file/repository/' . $image);
         }
     } else {
         unset($pageTags['images']);
     }
     $vars = array_merge($vars, $pageTags);
     $tags = ipView('view/tags.php', $vars)->render();
     $head .= $tags;
     return $head;
 }
コード例 #2
0
ファイル: Controller.php プロジェクト: Umz/ImpressPages
 /**
  * @param \Ip\Form $form
  * @param array $postData
  * @param array $data
  */
 public function sendEmail($form, $postData, $data)
 {
     $contentData = array();
     $websiteName = ipGetOptionLang('Config.websiteTitle');
     $websiteEmail = ipGetOptionLang('Config.websiteEmail');
     $from = $websiteEmail;
     $files = array();
     foreach ($form->getFields() as $field) {
         if ($field->getType() == \Ip\Form\Field::TYPE_REGULAR) {
             if (!isset($postData[$field->getName()])) {
                 $postData[$field->getName()] = null;
             }
             $title = $field->getLabel();
             $value = $field->getValueAsString($postData, $field->getName());
             $contentData[] = array('fieldClass' => get_class($field), 'title' => $title, 'value' => $value);
         }
         if (get_class($field) == 'Ip\\Form\\Field\\Email') {
             $userFrom = $field->getValueAsString($postData, $field->getName());
             if ($userFrom != '') {
                 $from = $userFrom;
             }
         }
         if (get_class($field) == 'Ip\\Form\\Field\\File') {
             $uploadedFiles = $field->getFiles($postData, $field->getName());
             $originalNames = $field->originalFileNames($postData, $field->getName());
             foreach ($uploadedFiles as $key => $uploadedFile) {
                 $files[] = array($uploadedFile, $originalNames[$key]);
             }
         }
     }
     $content = ipView('helperView/email_content.php', array('values' => $contentData))->render();
     $emailData = array('content' => $content);
     $email = ipEmailTemplate($emailData);
     //get page where this widget sits :)
     $fullWidgetRecord = \Ip\Internal\Content\Model::getWidgetRecord($postData['widgetId']);
     $pageTitle = '';
     if (isset($fullWidgetRecord['revisionId'])) {
         $revision = \Ip\Internal\Revision::getRevision($fullWidgetRecord['revisionId']);
         if (!empty($revision['pageId'])) {
             $pageTitle = ipPage($revision['pageId'])->getTitle();
         }
     }
     $subject = $websiteName . ': ' . $pageTitle;
     $emailQueue = new \Ip\Internal\Email\Module();
     if (!empty($data['sendTo']) && $data['sendTo'] == 'custom') {
         if (empty($data['emails'])) {
             $data['emails'] = '';
         }
         $emailList = preg_split("/[\\s,]+/", $data['emails']);
     } else {
         $emailList = array($websiteEmail);
     }
     foreach ($emailList as $listItem) {
         $emailQueue->addEmail($from, '', $listItem, '', $subject, $email, false, true, $files);
     }
     $emailQueue->send();
 }
コード例 #3
0
ファイル: Logo.php プロジェクト: Umz/ImpressPages
 /**
  * @param array|string $data
  * @param string $defaultLogo
  */
 public function __construct($data, $defaultLogo = null)
 {
     if (is_string($data)) {
         $data = $this->parseStr($data);
     }
     if (!isset($data['type'])) {
         if ($defaultLogo) {
             $data['type'] = self::TYPE_IMAGE;
         } else {
             $data['type'] = self::TYPE_TEXT;
         }
     }
     switch ($data['type']) {
         case self::TYPE_TEXT:
             $this->type = self::TYPE_TEXT;
             break;
         case self::TYPE_IMAGE:
             $this->type = self::TYPE_IMAGE;
             break;
         default:
             $this->type = self::TYPE_TEXT;
             break;
     }
     if (!empty($data['imageOrig']) && file_exists(ipFile('file/repository/' . $data['imageOrig']))) {
         $this->imageOrig = $data['imageOrig'];
         if (isset($data['x1']) && isset($data['y1']) && isset($data['x2']) && isset($data['y2'])) {
             $this->x1 = $data['x1'];
             $this->y1 = $data['y1'];
             $this->x2 = $data['x2'];
             $this->y2 = $data['y2'];
             if (empty($data['requiredWidth'])) {
                 $data['requiredWidth'] = $this->x2 - $this->x1;
             }
             if (empty($data['requiredHeight'])) {
                 $data['requiredHeight'] = $this->y2 - $this->y1;
             }
             $this->requiredWidth = $data['requiredWidth'];
             $this->requiredHeight = $data['requiredHeight'];
             $transform = array('type' => 'crop', 'x1' => $this->getX1(), 'y1' => $this->getY1(), 'x2' => $this->getX2(), 'y2' => $this->getY2(), 'width' => $this->getRequiredWidth(), 'height' => $this->getRequiredHeight(), 'quality' => 100);
             $requestedName = \Ip\Internal\Text\Specialchars::url(ipGetOptionLang('Config.websiteTitle'));
             $this->image = ipReflection($this->getImageOrig(), $transform, $requestedName);
         }
     } else {
         $this->image = $defaultLogo;
     }
     if (!empty($data['text'])) {
         $this->setText($data['text']);
     } else {
         $this->setText(ipGetOptionLang('Config.websiteTitle'));
     }
     if (isset($data['color'])) {
         $this->setColor($data['color']);
     }
     if (isset($data['font'])) {
         $this->setFont($data['font']);
     }
 }
コード例 #4
0
ファイル: Event.php プロジェクト: Umz/ImpressPages
 public static function ipLanguageUpdated($data)
 {
     $oldCode = $data['old']['code'];
     $newCode = $data['new']['code'];
     if ($oldCode != $newCode) {
         $title = ipGetOptionLang('Config.websiteTitle', $oldCode);
         $email = ipGetOptionLang('Config.websiteEmail', $oldCode);
         ipRemoveOptionLang('Config.websiteTitle', $oldCode);
         ipRemoveOptionLang('Config.websiteEmail', $oldCode);
         ipSetOptionLang('Config.websiteTitle', $title, $newCode);
         ipSetOptionLang('Config.websiteEmail', $email, $newCode);
     }
 }
コード例 #5
0
ファイル: Forms.php プロジェクト: Umz/ImpressPages
 public static function getForm()
 {
     $form = new \Ip\Form();
     $form->addClass('ipsConfigForm');
     $form->setAjaxSubmit(0);
     $field = new FieldOptionTextLang(array('optionName' => 'Config.websiteTitle', 'name' => 'websiteTitle', 'label' => __('Website title', 'Ip-admin', false), 'hint' => __('Used as a sender name in emails and as default website logo.', 'Ip-admin')));
     $field->addClass('ipsAutoSave');
     $form->addField($field);
     $field = new FieldOptionTextLang(array('optionName' => 'Config.websiteEmail', 'name' => 'websiteEmail', 'value' => ipGetOptionLang('Config.websiteEmail'), 'label' => __('Website email', 'Ip-admin', false), 'hint' => __('Email address used as a sender to send emails on behalf of the website.', 'Ip-admin')));
     $field->addValidator('Email');
     $field->addClass('ipsAutoSave');
     $form->addField($field);
     return $form;
 }
コード例 #6
0
ファイル: Model.php プロジェクト: Umz/ImpressPages
 public static function sendResetPasswordLink($userId)
 {
     $user = self::get($userId);
     if (!$user) {
         throw new \Ip\Exception("User doesn't exist");
     }
     $urlData = array('sa' => 'Admin.passwordReset', 'id' => $userId, 'secret' => self::generatePasswordResetSecret($userId));
     $contentData = array('link' => ipActionUrl($urlData));
     $content = ipView('view/passwordResetContent.php', $contentData)->render();
     $emailData = array('content' => $content);
     $email = ipEmailTemplate($emailData);
     $from = ipGetOptionLang('Config.websiteEmail');
     $fromName = ipGetOptionLang('Config.websiteTitle');
     $subject = __('Password reset instructions', 'Ip-admin', false);
     $to = $user['email'];
     $toName = $user['username'];
     ipSendEmail($from, $fromName, $to, $toName, $subject, $email);
 }
コード例 #7
0
    public function render($doctype, $environment)
    {
        $languages = ipContent()->getLanguages();
        $answer = '';
        foreach ($languages as $language) {
            $value = ipGetOptionLang($this->getOptionName(), $language->getCode(), $this->getValue());
            $fieldId = $this->getName() . '_' . $language->getId() . '';
            $answer .= '
<div class="input-group">
  <span class="input-group-addon">' . esc($language->getAbbreviation()) . '</span>
  <input
  data-fieldname="' . $this->getName() . '"
  data-fieldid="' . $fieldId . '"
  id="' . $fieldId . '"
  ' . $this->getAttributesStr($doctype) . ' data-languageid="' . $language->getId() . '" class="ips' . $this->getName() . ' form-control ' . implode(' ', $this->getClasses()) . '" name="' . esc($fieldId, 'attr') . '" ' . $this->getValidationAttributesStr($doctype) . ' type="optionTextLang" value="' . esc($value, 'attr') . '" />
</div>
            ';
        }
        return $answer;
    }
コード例 #8
0
ファイル: Forms.php プロジェクト: impresspages/impresspages
 public static function getForm()
 {
     $form = new \Ip\Form();
     $form->addClass('ipsConfigForm');
     $form->setAjaxSubmit(0);
     $field = new FieldOptionTextLang(array('optionName' => 'Config.websiteTitle', 'name' => 'websiteTitle', 'label' => __('Website title', 'Ip-admin', false), 'hint' => __('Used as a sender name in emails and as default website logo.', 'Ip-admin')));
     $field->addClass('ipsAutoSave');
     $form->addField($field);
     $field = new FieldOptionTextLang(array('optionName' => 'Config.websiteEmail', 'name' => 'websiteEmail', 'value' => ipGetOptionLang('Config.websiteEmail'), 'label' => __('Website email', 'Ip-admin', false), 'hint' => __('Email address used as a sender to send emails on behalf of the website.', 'Ip-admin')));
     $field->addValidator('Email');
     $field->addClass('ipsAutoSave');
     $form->addField($field);
     $field = new \Ip\Form\Field\Text(array('name' => 'gmapsApiKey', 'value' => ipGetOption('Config.gmapsApiKey'), 'label' => __('Google Maps API key', 'Ip-admin', false), 'note' => __('You must provide Google Maps API key for Map widget to work.', 'Ip-admin', false) . ' <a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank">' . __('Follow instructions.', 'Ip-admin', false) . '</a>'));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     return $form;
 }
コード例 #9
0
ファイル: SiteController.php プロジェクト: Umz/ImpressPages
 public function login()
 {
     if (\Ip\Internal\Admin\Backend::userId()) {
         //user has already been logged in
         \Ip\Internal\Content\Service::setManagementMode(1);
         return new \Ip\Response\Redirect(ipHomeUrl());
     }
     // If none of the administrator exist, we create default one and log in user
     $administrators = \Ip\Internal\Administrators\Model::getAll();
     if (empty($administrators)) {
         $adminUsername = '******';
         $adminEmail = ipGetOptionLang('Config.websiteEmail');
         $adminPassword = Model::randString(8);
         $adminId = \Ip\Internal\Administrators\Service::add($adminUsername, $adminEmail, $adminPassword);
         \Ip\Internal\AdminPermissionsModel::addPermission('Super admin', $adminId);
         // Set variable to know that user is autogenerated
         ipStorage()->set('Ip', 'adminIsAutogenerated', $adminPassword);
         // Logging in new admin
         $model = Model::instance();
         if ($model->login($adminUsername, $adminPassword)) {
             \Ip\Internal\System\Model::sendUsageStatistics(array('action' => 'Install.adminIsAutogenerated'));
             $redirectUrl = ipHomeUrl();
             return new \Ip\Response\Redirect($redirectUrl);
         } else {
             \Ip\Internal\System\Model::sendUsageStatistics(array('action' => 'Install.adminIsAutogeneratedFailed'));
             // todo: handle errors
             // $errors = $model->getErrors();
         }
     }
     $content = ipView('view/login.php', array('loginForm' => FormHelper::getLoginForm()));
     ipAddJs('Ip/Internal/Admin/assets/login.js');
     $response = ipResponse();
     $response->setLayout('Ip/Internal/Admin/view/loginLayout.php');
     $response->setLayoutVariable('content', $content);
     ipAddJs('assets/languageSelect.js');
     $response->setLayoutVariable('languageSelectForm', FormHelper::getLanguageSelectForm());
     return $response;
 }
コード例 #10
0
ファイル: Helper.php プロジェクト: sspaeti/ImpressPages
 public static function sendMailNotification($page, $author, $date, $comm, $emailAuthor, $pageTitle = '', $vcode = '')
 {
     $sendEmail = ipGetOption('Comment.useSeparateEmail');
     if (empty($sendEmail)) {
         $sendEmail = ipGetOptionLang('Config.websiteEmail');
     }
     $noUser = '******' . __("You are not a registered user, or pehaps you were not logged in when have commented. So, you need to verify " . "your email address before your comment is moderated and published. Please, click on the following link for " . "such a thing: ", "Comments") . '<a href="' . ipHomeUrl() . ipContent()->getCurrentLanguage()->getUrlPath() . 'comments/' . $vcode . '-!' . $emailAuthor . '">' . __('Email verification', 'Comments') . '</a>' . __(" If it doesn't work, please copy and past the following in your web browser: ", "Comments") . "<strong>" . ipHomeUrl() . ipContent()->getCurrentLanguage()->getUrlPath() . "comments/" . $vcode . '-!' . $emailAuthor . '</strong></div><br />';
     if (ipUser()->isLoggedIn()) {
         $noUser = '';
     }
     //array can has: 'title', 'content', 'signature', 'footer'.
     $contentAdmin = sprintf('<div><strong>' . __('Page', 'Comments') . ':</strong> ' . __($pageTitle, 'Comments') . ' (%s)</div>' . '<div><strong>' . __('Author', 'Comments') . ':</strong> %s - ' . $emailAuthor . '</div>' . '<div><strong>' . __('Date', 'Comments') . ':</strong> %s</div>' . '<div><strong>' . __('Comment', 'Comments') . ':</strong></div>' . '<div><cite class="mail">%s</cite></div>', $page, $author, $date, $comm);
     $templateAdmin = array('title' => __('You just received a comment', 'Comments'), 'content' => $contentAdmin, 'signature' => '<h4>' . __('Internal Administration', 'Comments') . '</h4>', 'footer' => '<h4>' . ipGetOptionLang('Config.websiteTitle') . '</h4>');
     $contentAuthor = sprintf(__('Your comment has been sent and it is awaiting moderation. Thank you.', 'Comments') . $noUser . '<div><strong>' . __('Page', 'Comments') . ':</strong> ' . __($pageTitle, 'Comments') . ' (%s)</div>' . '<div><strong>' . __('Author', 'Comments') . ':</strong> %s - ' . $emailAuthor . '</div>' . '<div><strong>' . __('Date', 'Comments') . ':</strong> %s</div>' . '<div><strong>' . __('Comment', 'Comments') . ':</strong></div>' . '<div><cite class="mail">%s</cite></div>', $page, $author, $date, $comm);
     $templateAuthor = array('title' => __('You just sent a comment', 'Comments'), 'content' => $contentAuthor, 'signature' => '<div>' . __('Kindest regards', 'Comments') . ',</div>', 'footer' => '<h4>' . ipGetOptionLang('Config.websiteTitle') . '</h4>');
     /* ipSendEmail ( string $from , string $fromName , string $to , 
     		string $toName , string $subject , string $content , [ boolean $urgent ] ,
     		[ boolean $html ] , [ string|array|null $files ] ) */
     if (ipGetOption('Comments.informAboutNewComments') == 'Yes') {
         //ipSendEmail() Administration
         ipSendEmail($sendEmail, __('Site Comment', 'Comments'), $sendEmail, __('Comment Moderation', 'Comments'), __('There is a new comment', 'Comments') . ': ' . __($pageTitle, 'Comments'), ipEmailTemplate($templateAdmin), true, true);
     }
     if (ipGetOption('Comments.requireEmailConfirmation') == 'Yes') {
         //ipSendMail Author
         ipSendEmail($sendEmail, ipGetOptionLang('Config.websiteTitle'), $emailAuthor, $author, __('You have just done a comment in our website', 'Comments') . ': ' . __($pageTitle, 'Comments'), ipEmailTemplate($templateAuthor), true, true);
     }
 }
コード例 #11
0
ファイル: email.php プロジェクト: Umz/ImpressPages
    ?>
        <?php 
    echo $signature;
    ?>
    <?php 
} else {
    ?>
        <?php 
    echo esc(ipGetOptionLang('Config.websiteTitle'));
    ?>
        <br/>
        <a href="mailto:<?php 
    echo esc(ipGetOptionLang('Config.websiteEmail'));
    ?>
"><?php 
    echo esc(ipGetOptionLang('Config.websiteEmail'));
    ?>
</a>
    <?php 
}
?>
</p>
<p> </p>
<?php 
if (isset($footer)) {
    ?>
    <?php 
    echo $footer;
} else {
    ?>
    <p style="text-align: right;"><span style="color: #6d6b70; font-family: Verdana, Tahoma, Arial; font-size: 10px;">Powered by </span><a style="text-decoration: underline; font-family: Verdana, Tahoma, Arial; font-size: 10px; color: #6d6b70;" href="http://www.impresspages.org">ImpressPages</a></p>
コード例 #12
0
ファイル: Page404.php プロジェクト: Umz/ImpressPages
 public function getMetaTitle()
 {
     return ipGetOptionLang('Config.websiteTitle', null, 'Page not found');
 }
コード例 #13
0
ファイル: Job.php プロジェクト: Umz/ImpressPages
 public static function ipReplacePlaceholders($info)
 {
     $content = $info['content'];
     $userData = ipUser()->data();
     $userEmail = !empty($userData['email']) ? $userData['email'] : '';
     $userName = !empty($userData['name']) ? $userData['name'] : '';
     $values = array('{websiteTitle}' => ipGetOptionLang('Config.websiteTitle'), '{websiteEmail}' => ipGetOptionLang('Config.websiteEmail'), '{websiteUrl}' => ipConfig()->baseUrl(), '{userId}' => ipUser()->userId(), '{userEmail}' => $userEmail, '{userName}' => $userName);
     foreach ($info['customValues'] as $key => $value) {
         $values['{' . $key . '}'] = $value;
     }
     $values = ipFilter('ipReplacePlaceholdersValues', $values, $info);
     $answer = strtr($content, $values);
     $answer = ipFilter('ipReplacePlaceholders', $answer, $info);
     return $answer;
 }
コード例 #14
0
ファイル: Helper.php プロジェクト: Umz/ImpressPages
 /**
  * @param string $pluginName
  * @param \Ip\Form $form
  * @param array $options
  */
 public static function getOptionsForm($pluginName, $form, $options)
 {
     foreach ($options as $option) {
         if (empty($option['type'])) {
             $option['type'] = 'text';
         }
         if (in_array($option['type'], array('select', 'text', 'textarea', 'richText', 'color', 'range', 'checkbox', 'password'))) {
             $option['type'] = ucfirst($option['type']);
         }
         $className = $option['type'];
         if (class_exists($className)) {
             $newField = new $className($option);
         } else {
             $className = 'Ip\\Form\\Field\\' . $option['type'];
             if (class_exists($className)) {
                 $newField = new $className($option);
             }
         }
         if (!isset($newField)) {
             //field type is not recognised
             continue;
         }
         $default = isset($option['default']) ? $option['default'] : null;
         if (!empty($option['name'])) {
             $newField->setName($option['name']);
             $optionKey = "{$pluginName}.{$option['name']}";
             if ($newField instanceof \Ip\Form\FieldLang) {
                 $value = array();
                 foreach (ipContent()->getLanguages() as $language) {
                     $value[$language->getCode()] = ipGetOptionLang($optionKey, $language->getCode(), $default);
                 }
                 $newField->setValue($value);
             } else {
                 $newField->setValue(ipGetOption($optionKey, $default));
             }
         }
         $newField->setLabel(empty($option['label']) ? '' : $option['label']);
         if (!empty($option['note'])) {
             $newField->setNote($option['note']);
         }
         if (!empty($option['validators'])) {
             $newField->addValidator($option['validators']);
         }
         $form->addfield($newField);
     }
 }
コード例 #15
0
ファイル: logo.php プロジェクト: Umz/ImpressPages
    ?>
    <a href="<?php 
    echo isset($link) ? $link : '';
    ?>
" style="<?php 
    echo !empty($color) ? 'color: ' . htmlspecialchars($color) . ';' : '';
    ?>
 <?php 
    echo !empty($font) ? 'font-family: ' . htmlspecialchars($font) . ';' : '';
    ?>
">
        <img src="<?php 
    echo escAttr(!empty($image) ? ipFileUrl($image) : ipFileUrl('Ip/Internal/InlineManagement/assets/empty.gif'));
    ?>
" alt="<?php 
    echo esc(ipGetOptionLang('Config.websiteTitle'));
    ?>
" />
    </a>
<?php 
} else {
    ?>
    <a href="<?php 
    echo isset($link) ? $link : '';
    ?>
" style="<?php 
    echo !empty($color) ? 'color: ' . htmlspecialchars($color) . ';' : '';
    ?>
 <?php 
    echo !empty($font) ? 'font-family: ' . htmlspecialchars($font) . ';' : '';
    ?>