Esempio n. 1
0
 public function activate()
 {
     $version = \Ip\Application::getVersion();
     $parts = explode('.', $version);
     if (empty($parts[1]) || $parts[0] < 4 || $parts[1] < 2) {
         throw new \Ip\Exception('ImpressPages 4.2.0 or later required');
     }
 }
Esempio n. 2
0
 /**
  * MasonryGrid.js ask to provide widget management popup HTML. This controller does this.
  * @return \Ip\Response\Json
  * @throws \Ip\Exception\View
  */
 public function widgetPopupHtml()
 {
     $versionParts = explode('.', \Ip\Application::getVersion());
     if (version_compare(\Ip\Application::getVersion(), '4.2.1') < 0) {
         return new \Ip\Response('This widget can be used on ImpressPages 4.2.1 or later.');
     }
     $widgetId = ipRequest()->getQuery('widgetId');
     $widgetRecord = \Ip\Internal\Content\Model::getWidgetRecord($widgetId);
     $widgetData = $widgetRecord['data'];
     $plugin = ipRoute()->plugin();
     //Render form and popup HTML
     $viewData = array('gridUrl' => ipActionUrl(array('aa' => $plugin . '.grid', 'disableAdminNavbar' => 1, 'widgetId' => $widgetId)));
     $popupHtml = ipView('view/editPopup.php', $viewData)->render();
     $data = array('popup' => $popupHtml);
     //Return rendered widget management popup HTML in JSON format
     return new \Ip\Response\Json($data);
 }
Esempio n. 3
0
 /**
  * GridWidget.js ask to provide widget management popup HTML. This controller does this.
  * @return \Ip\Response\Json
  * @throws \Ip\Exception\View
  */
 public function widgetPopupHtml()
 {
     $versionParts = explode('.', \Ip\Application::getVersion());
     if (empty($versionParts[2]) || $versionParts[0] < 4 || $versionParts[0] == 4 && $versionParts[1] < 2 || $versionParts[0] == 4 && ($versionParts[1] = 2 && $versionParts[2] < 1)) {
         return new \Ip\Response('This widget can be used on ImpressPages 4.2.1 or later.');
     }
     $widgetId = ipRequest()->getQuery('widgetId');
     $widgetRecord = \Ip\Internal\Content\Model::getWidgetRecord($widgetId);
     $widgetData = $widgetRecord['data'];
     //create form prepopulated with current widget data
     $form = $this->managementForm($widgetData);
     $plugin = ipRoute()->plugin();
     //Render form and popup HTML
     $viewData = array('gridUrl' => ipActionUrl(array('aa' => $plugin . '.grid', 'disableAdminNavbar' => 1, 'widgetId' => $widgetId)));
     $popupHtml = ipView('view/editPopup.php', $viewData)->render();
     $data = array('popup' => $popupHtml);
     //Return rendered widget management popup HTML in JSON format
     return new \Ip\Response\Json($data);
 }
Esempio n. 4
0
 public static function sendUsageStatistics($data = array(), $timeout = 3)
 {
     if (!function_exists('curl_init')) {
         return;
     }
     if (!isset($data['action'])) {
         $data['action'] = 'Ping.default';
     }
     if (!isset($data['php'])) {
         $data['php'] = phpversion();
     }
     if (!isset($data['db'])) {
         $data['db'] = null;
         // todo: make a db type/version check stable to work during install and later on
         //            if (class_exists('PDO')) {
         //                $pdo = ipDb()->getConnection();
         //                if ($pdo) {
         //                    $data['db'] = $pdo->getAttribute(\PDO::ATTR_SERVER_VERSION);
         //                }
         //            }
     }
     if (!isset($data['developmentEnvironment'])) {
         $data['developmentEnvironment'] = ipConfig()->get('developmentEnvironment');
     }
     if (!isset($data['showErrors'])) {
         $data['showErrors'] = ipConfig()->get('showErrors');
     }
     if (!isset($data['debugMode'])) {
         $data['debugMode'] = ipConfig()->get('debugMode');
     }
     if (!isset($data['timezone'])) {
         $data['timezone'] = ipConfig()->get('timezone');
     }
     if (!isset($data['data'])) {
         $data['data'] = array();
     }
     if (!isset($data['websiteId'])) {
         $data['websiteId'] = ipStorage()->get('Ip', 'websiteId');
     }
     if (!isset($data['websiteUrl'])) {
         $data['websiteUrl'] = ipConfig()->baseUrl();
     }
     if (!isset($data['version'])) {
         $data['version'] = \Ip\Application::getVersion();
     }
     if (!isset($data['locale'])) {
         $data['locale'] = \Ip\ServiceLocator::translator()->getAdminLocale();
     }
     if (!isset($data['doSupport'])) {
         $data['doSupport'] = ipStorage()->get('Ip', 'getImpressPagesSupport');
     }
     if (!isset($data['administrators'])) {
         $administrators = \Ip\Internal\Administrators\Model::getAll();
         $adminCollection = array();
         foreach ($administrators as $admin) {
             $permissions = \Ip\Internal\AdminPermissionsModel::getUserPermissions($admin['id']);
             $adminCollection[] = array('id' => $admin['id'], 'email' => $admin['email'], 'permissions' => $permissions);
         }
         $data['administrators'] = $adminCollection;
     }
     if (!isset($data['themes'])) {
         $data['themes'] = array('active' => ipConfig()->theme(), 'all' => \Ip\Internal\Design\Model::instance()->getAvailableThemes());
     }
     if (!isset($data['plugins'])) {
         $plugins = \Ip\Internal\Plugins\Model::getAllPluginNames();
         $activePlugins = \Ip\Internal\Plugins\Service::getActivePluginNames();
         $pluginCollection = array();
         foreach ($plugins as $pluginName) {
             $pluginCollection[] = array('name' => $pluginName, 'active' => in_array($pluginName, $activePlugins) ? true : false);
         }
         $data['plugins'] = $pluginCollection;
     }
     if (!isset($data['languages'])) {
         $data['languages'] = ipContent()->getLanguages();
     }
     if (!isset($data['pages'])) {
         $result = array();
         try {
             $table = ipTable('page');
             $sql = "\n                    SELECT\n                        `languageCode` AS `language`, COUNT( 1 ) AS `quantity`\n                    FROM\n                        {$table}\n                    GROUP BY\n                        `languageCode`\n                ";
             $result = ipDb()->fetchAll($sql);
         } catch (\Exception $e) {
             // Do nothing.
         }
         $data['pages'] = $result;
     }
     $postFields = 'data=' . urlencode(serialize($data));
     // Use sockets instead of CURL
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, ipConfig()->get('usageStatisticsUrl', 'http://service.impresspages.org/stats'));
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
     //        curl_setopt($ch, CURLOPT_REFERER, ipConfig()->baseUrl());
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
     curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
     curl_exec($ch);
 }
Esempio n. 5
0
">
                                            <?php 
    echo htmlspecialchars($language);
    ?>
                                        </a>
                                    </li>
                            <?php 
}
?>
                        </ul>
                    </div>
                    <h3><?php 
_e('ImpressPages installation wizard', 'Install');
?>
                        <small><?php 
echo esc(sprintf(__('Version %s', 'Install', false), \Ip\Application::getVersion()));
?>
</small></h3>
                </div>
                <div class="row">
                    <div class="col-md-3">
                        <?php 
echo \Plugin\Install\Helper::generateMenu(!empty($_GET['step']) ? $_GET['step'] : \Plugin\Install\Helper::$firstStep);
?>
                    </div>
                    <div class="col-md-9 ipsContent">
                        <?php 
echo ipBlock('main')->render();
?>
                    </div>
                </div>