Example #1
0
 public function __construct()
 {
     global $langmessage;
     $cmd = \gp\tool::GetCommand();
     switch ($cmd) {
         case 'continue':
             $this->uninstall();
             break;
         case 'restore':
             $this->restore();
             break;
     }
     echo '<h2>Uninstall Preparation</h2>';
     echo '<form class="renameform" action="' . \gp\tool::GetUrl('Admin/Uninstall') . '" method="post">';
     echo '<p>';
     echo 'For some installations, you won\'t be able to delete ' . CMS_NAME . '\'s data files from your server untill the access permissions have been changed. ';
     echo ' This script will change file permissions for files and folders in the /data directory to 0777.';
     echo ' <br/><em>You should not continue unless you plan on deleting all ' . CMS_NAME . ' files from your server.</em>';
     echo '<input type="hidden" name="cmd" value="continue" />';
     echo ' <input type="submit" name="aaa" value="' . $langmessage['continue'] . '" class="gpsubmit"/>';
     //echo ' <input type="submit" name="cmd" value="'.$langmessage['cancel'].'" />';
     echo '</p>';
     echo '</form>';
     echo '<h2>Change Your Mind?</h2>';
     echo '<form class="renameform" action="' . \gp\tool::GetUrl('Admin/Uninstall') . '" method="post">';
     echo 'You can restore the file permissions for added security here: ';
     echo '<input type="hidden" name="cmd" value="restore" />';
     echo '<input type="submit" name="aaa" value="' . $langmessage['restore'] . '" class="gpsubmit"/>';
     echo '</form>';
 }
Example #2
0
 /**
  * Display form for selecting classes
  *
  */
 function ClassesForm()
 {
     global $dataDir, $langmessage;
     echo '<h2 class="hmargin">Manage Classes</h2>';
     $cmd = \gp\tool::GetCommand();
     switch ($cmd) {
         case 'LoadDefault':
             $classes = self::Defaults();
             break;
         case 'LoadBootstrap':
             $classes = self::Bootstrap();
             break;
         default:
             $classes = self::GetClasses();
             break;
     }
     $classes[] = array('names' => '', 'desc' => '');
     $this->page->jQueryCode .= '$(".sortable_table").sortable({items : "tr",handle: "td"});';
     // FORM
     echo '<form action="' . $this->admin_link . '" method="post">';
     echo '<table class="bordered full_width sortable_table">';
     echo '<thead><tr><th>className(s)</th><th>Description (optional)</th></tr></thead>';
     echo '<tbody>';
     foreach ($classes as $key => $classArray) {
         echo '<tr><td>';
         echo '<img alt="" src="' . \gp\tool::GetDir('/include/imgs/drag_handle.gif') . '" /> &nbsp; ';
         echo '<input size="16" class="gpinput" type="text" name="class_names[]" value="' . $classArray['names'] . '"/>';
         echo '</td><td>';
         echo '<input size="64" class="gpinput" type="text" name="class_desc[]" value="' . $classArray['desc'] . '"/> ';
         echo '<a class="gpbutton rm_table_row" title="Remove Item" data-cmd="rm_table_row">&times;</a>';
         echo '</td></tr>';
     }
     echo '<tr><td colspan="3">';
     echo '<a data-cmd="add_table_row">Add Row</a>';
     echo '</td></tr>';
     echo '</tbody>';
     echo '</table>';
     echo '<br/>';
     // SAVE / CANCEL BUTTONS
     echo '<button type="submit" name="cmd" value="SaveClasses" class="gpsubmit">' . $langmessage['save'] . '</button>';
     echo '<button type="submit" name="cmd" value="" class="gpcancel">' . $langmessage['cancel'] . '</button>';
     echo '<div style="margin-top:2em; border:1px solid #ccc; background:#fafafa; border-radius:3px; padding:12px;">';
     echo 'CSS classNames you set here will be easily selectable in the Section Attributes dialog.';
     echo '<ul>';
     echo '<li>Single classNames (like <em>gpRow</em>) will show as checkboxes</li>';
     echo '<li>Multiple, space separated classNames (like <em>gpCol-1 gpCol-2 gpCol-3 [&hellip;]</em> will show as checkable dropdown list.</li>';
     echo '<li>The list is drag&rsquo;n&rsquo;drop sortable.</li>';
     echo '</ul><hr/>';
     echo '</form>';
     //$tooltip = $isBootswatchTheme ? ":-) Your current default theme is Bootstrap based - cleared for Take Off!" : ":-/ You will have to use a Bootstrap based theme for this preset!";
     echo '<p>';
     echo '<form action="' . $this->admin_link . '" method="get">';
     echo '<button class="gpbutton" name="cmd" value="LoadBootstrap">Load the Bootstrap Preset</button> ';
     echo '<button class="gpbutton" name="cmd" value="LoadDefault">Load the Default Preset</button>';
     echo '</p>';
     echo '</div>';
 }
Example #3
0
 public function SessionStart()
 {
     \gp\tool::GetConfig();
     $username = '******';
     $users = gpFiles::Get('_site/users');
     $userinfo = $users[$username];
     $session_id = \gp\tool\Session::create($userinfo, $username, $sessions);
     $logged_in = \gp\tool\Session::start($session_id, $sessions);
     self::AssertTrue($logged_in, 'Not Logged In');
 }
Example #4
0
 /**
  * Show files in the cache
  *
  */
 protected function ShowFiles()
 {
     global $langmessage;
     $this->page->head_js[] = '/include/thirdparty/tablesorter/tablesorter.js';
     $this->page->jQueryCode .= '$("table.tablesorter").tablesorter({cssHeader:"gp_header",cssAsc:"gp_header_asc",cssDesc:"gp_header_desc"});';
     if (!$this->all_files) {
         return;
     }
     echo '<p>';
     echo \gp\tool::Link('Admin/Cache', 'Empty Cache', 'cmd=EmptyResourceCache', array('data-cmd' => 'cnreq', 'class' => 'gpconfirm', 'title' => 'Empty the resource cache?'));
     echo '</p>';
     echo '<table class="bordered tablesorter full_width">';
     echo '<thead>';
     echo '<tr><th>';
     echo $langmessage['file_name'];
     echo '</th><th>';
     echo $langmessage['File Size'];
     echo '</th><th>';
     echo 'Touched';
     echo '</th><th>';
     echo $langmessage['options'];
     echo '</th></tr>';
     echo '</thead>';
     $total_size = 0;
     echo '<tbody>';
     foreach ($this->all_files as $file) {
         $full = $this->cache_dir . '/' . $file;
         echo '<tr><td>';
         echo '<a href="?cmd=ViewFile&amp;file=' . rawurlencode($file) . '">';
         echo $file;
         echo '</a>';
         echo '</td><td>';
         $size = filesize($full);
         echo '<span style="display:none">' . $size . '</span>';
         echo \gp\admin\Tools::FormatBytes($size);
         $total_size += $size;
         echo '</td><td>';
         $elapsed = \gp\admin\Tools::Elapsed(time() - filemtime($full));
         echo sprintf($langmessage['_ago'], $elapsed);
         echo '</td><td>';
         echo \gp\tool::Link('Admin/Cache', $langmessage['delete'], 'cmd=DeleteFile&amp;file=' . rawurlencode($file), array('data-cmd' => 'cnreq', 'class' => 'gpconfirm', 'title' => $langmessage['delete_confirm']));
         echo '</tr>';
     }
     echo '</tbody>';
     //totals
     echo '<tfoot>';
     echo '<tr><td>';
     echo number_format(count($this->all_files)) . ' Files';
     echo '</td><td>';
     echo \gp\admin\Tools::FormatBytes($total_size);
     echo '</td><td>';
     echo '</tr>';
     echo '</table>';
 }
Example #5
0
 /**
  * Determine which class is needed to write to $context
  *
  * @param string $context
  */
 public static function get_filesystem_method($context)
 {
     while (!file_exists($context)) {
         $context = \gp\tool::DirName($context);
     }
     if (gp_is_writable($context)) {
         return 'gp_filesystem_direct';
     }
     if (function_exists('ftp_connect')) {
         return 'gp_filesystem_ftp';
     }
 }
Example #6
0
 function testKeys()
 {
     global $langmessage, $languages;
     //get en language
     \gp\tool::GetLangFile('main.inc', 'en');
     $keys_en = array_keys($langmessage);
     //compare keys in other languages
     foreach ($languages as $code => $lang) {
         $langmessage = array();
         \gp\tool::GetLangFile('main.inc', $code);
         $keys = array_keys($langmessage);
         self::AssertEquals($keys_en, $keys, 'Keys in language file don\'t match for ' . $lang . ' (' . $code . ')');
     }
 }
Example #7
0
 function xml()
 {
     global $gp_menu;
     header('Content-Type: text/xml; charset=UTF-8');
     echo '<?xml version="1.0" encoding="UTF-8"?>';
     echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
     foreach ($gp_menu as $key => $info) {
         $title = \gp\tool::IndexToTitle($key);
         if (isset($info['level'])) {
             echo "\n";
             echo '<url>';
             echo '<loc>';
             echo isset($info['url']) ? $info['url'] : 'http://' . $_SERVER['SERVER_NAME'] . \gp\tool::GetUrl($title);
             echo '</loc>';
             echo '</url>';
         }
     }
     echo '</urlset>';
     die;
 }
Example #8
0
 /**
  * Update the gp_index, gp_titles and menus so that special pages can be renamed
  *
  */
 function Upgrade_234()
 {
     global $gp_index, $gp_titles, $gp_menu, $config, $dataDir;
     $special_indexes = array();
     $new_index = array();
     $new_titles = array();
     foreach ($gp_index as $title => $index) {
         $info = $gp_titles[$index];
         $type = \gp\tool::SpecialOrAdmin($title);
         if ($type === 'special') {
             $special_indexes[$index] = strtolower($title);
             $index = strtolower($title);
             $info['type'] = 'special';
             //some older versions didn't maintain this value well
         }
         $new_index[$title] = $index;
         $new_titles[$index] = $info;
     }
     $gp_titles = $new_titles;
     $gp_index = $new_index;
     //update gp_menu
     $gp_menu = $this->FixMenu($gp_menu, $special_indexes);
     //save pages
     if (!\gp\admin\Tools::SavePagesPHP()) {
         return;
     }
     $config['gpversion'] = '2.3.4';
     \gp\admin\Tools::SaveConfig();
     //update alt menus
     if (isset($config['menus']) && is_array($config['menus'])) {
         foreach ($config['menus'] as $key => $value) {
             $menu_file = $dataDir . '/data/_menus/' . $key . '.php';
             if (\gp\tool\Files::Exists($menu_file)) {
                 $menu = \gp\tool\Output::GetMenuArray($key);
                 $menu = $this->FixMenu($menu, $special_indexes);
                 \gp\tool\Files::SaveData($menu_file, 'menu', $menu);
             }
         }
     }
 }
Example #9
0
 /**
  * Show CDN Options
  *
  */
 protected function ShowForm()
 {
     global $config;
     $possible = $this->getPossible();
     echo '<form action="' . \gp\tool::GetUrl($this->page->requested) . '" method="post">';
     echo '<h2>CDN</h2>';
     echo '<table class="bordered"><tr><td></td>';
     foreach ($possible['cdn'] as $cdn_val => $cdn) {
         $checked = $cdn_val === $config['cdn'] ? 'checked' : '';
         echo '<td>';
         echo '<label class="all_checkbox">';
         echo '<input type="radio" name="cdn" value="' . $cdn_val . '" ' . $checked . '/>';
         echo '<span>' . $cdn . '</span>';
         echo '</label> ';
         echo '</td>';
     }
     echo '</tr>';
     //display which scripts can be served bythe cdn
     foreach (\gp\tool\Output\Combine::$scripts as $key => $script_info) {
         if (!isset($script_info['cdn']) || !isset($script_info['label'])) {
             continue;
         }
         $config_key = 'cdn_' . $key;
         $code = '\\gp\\tool::LoadComponents(\'' . $key . '\');';
         echo '<tr><td title="' . htmlspecialchars($code) . '">';
         echo $script_info['label'];
         echo '</td>';
         foreach ($possible['cdn'] as $cdn) {
             echo '<td class="text-center">';
             if (isset($script_info['cdn'][$cdn])) {
                 echo '<i class="fa fa-check"></i>';
             }
             echo '</td>';
         }
         echo '</div></td></tr>';
     }
     echo '</table>';
     $this->SaveButtons();
     echo '</form>';
 }
Example #10
0
 public function EditText()
 {
     global $config, $langmessage, $page;
     if (!isset($_GET['key'])) {
         message($langmessage['OOPS'] . ' (0)');
         return;
     }
     $default = $value = $key = $_GET['key'];
     if (isset($langmessage[$key])) {
         $default = $value = $langmessage[$key];
     }
     if (isset($config['customlang'][$key])) {
         $value = $config['customlang'][$key];
     }
     echo '<div class="inline_box">';
     echo '<form action="' . \gp\tool::GetUrl('Admin_Theme_Content/Text') . '" method="post">';
     echo '<input type="hidden" name="cmd" value="savetext" />';
     echo '<input type="hidden" name="key" value="' . htmlspecialchars($key) . '" />';
     echo '<input type="hidden" name="return" value="" />';
     //will be populated by javascript
     echo '<table class="bordered">';
     echo '<tr><th>';
     echo $langmessage['default'];
     echo '</th><th>';
     echo '</th></tr>';
     echo '<tr><td>';
     echo $default;
     echo '</td><td>';
     //$value is already escaped using htmlspecialchars()
     echo '<input type="text" name="value" value="' . $value . '" class="gpinput"/>';
     echo '<p>';
     echo ' <input type="submit" name="aaa" value="' . $langmessage['save'] . '" class="gpsubmit"/>';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</p>';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
     echo '</div>';
 }
Example #11
0
 public function GalleryEditBox($title, $info)
 {
     if (is_array($info)) {
         $icon = $info['icon'];
     } else {
         $icon = $info;
     }
     if (empty($icon)) {
         $thumbPath = \gp\tool::GetDir('/include/imgs/blank.gif');
     } elseif (strpos($icon, '/thumbnails/') === false) {
         $thumbPath = \gp\tool::GetDir('/data/_uploaded/image/thumbnails' . $icon . '.jpg');
     } else {
         $thumbPath = \gp\tool::GetDir('/data/_uploaded' . $icon);
     }
     echo '<div class="draggable">';
     echo \gp\tool::Link('Special_Galleries', htmlspecialchars($title), 'cmd=drag&to=%s&title=' . urlencode($title), 'data-cmd="gpajax" class="dragdroplink nodisplay" ');
     echo '<input type="hidden" name="title" value="' . htmlspecialchars($title) . '" class="title" />';
     echo ' <img src="' . $thumbPath . '" alt="" class="icon"/>';
     echo '<div class="caption">';
     echo str_replace('_', ' ', $title);
     echo '</div>';
     echo '</div>';
 }
Example #12
0
    static function Install_DataFiles_New($destination = false, $config = array(), $base_install = true)
    {
        global $langmessage;
        if ($destination === false) {
            $destination = $GLOBALS['dataDir'];
        }
        //set config variables
        //$config = array(); //because of ftp values
        $gpLayouts = array();
        //use bootswatch theme if server has enough memory
        $gpLayouts['default']['theme'] = 'Bootswatch_Scss/Flatly';
        $gpLayouts['default']['label'] = 'Bootswatch_Scss/Flatly';
        $gpLayouts['default']['color'] = '#93c47d';
        $_config['toemail'] = $_POST['email'];
        $_config['gpLayout'] = 'default';
        $_config['title'] = self::Install_Title();
        $_config['keywords'] = CMS_NAME . ' , Easy CMS, Content Management, PHP, Free CMS, Website builder, Open Source';
        $_config['desc'] = 'A new ' . CMS_NAME . ' installation. You can change your site\'s description in the configuration.';
        $_config['timeoffset'] = '0';
        $_config['langeditor'] = 'inherit';
        $_config['dateformat'] = '%m/%d/%y - %I:%M %p';
        $_config['gpversion'] = gpversion;
        $_config['passhash'] = 'sha512';
        $_config['gpuniq'] = \gp\tool::RandomString(20);
        $_config['combinecss'] = self::BooleanValue('combinecss', true);
        $_config['combinejs'] = self::BooleanValue('combinejs', true);
        $_config['etag_headers'] = self::BooleanValue('etag_headers', true);
        $_config['language'] = 'en';
        $_config['addons'] = array();
        $config += $_config;
        //directories
        \gp\tool\Files::CheckDir($destination . '/data/_uploaded/image');
        \gp\tool\Files::CheckDir($destination . '/data/_uploaded/media');
        \gp\tool\Files::CheckDir($destination . '/data/_uploaded/file');
        \gp\tool\Files::CheckDir($destination . '/data/_uploaded/flash');
        \gp\tool\Files::CheckDir($destination . '/data/_sessions');
        // gp_index
        $new_index = array();
        $new_index['Home'] = 'a';
        $new_index['Heading_Page'] = 'b';
        $new_index['Help_Videos'] = 'c';
        $new_index['Child_Page'] = 'd';
        $new_index['More'] = 'e';
        $new_index['About'] = 'f';
        $new_index['Contact'] = 'special_contact';
        $new_index['Site_Map'] = 'special_site_map';
        $new_index['Galleries'] = 'special_galleries';
        $new_index['Missing'] = 'special_missing';
        $new_index['Search'] = 'special_gpsearch';
        //	gpmenu
        $new_menu = array();
        $new_menu['a'] = array('level' => 0);
        $new_menu['b'] = array('level' => 0);
        $new_menu['c'] = array('level' => 1);
        $new_menu['d'] = array('level' => 1);
        $new_menu['e'] = array('level' => 0);
        $new_menu['f'] = array('level' => 1);
        $new_menu['special_contact'] = array('level' => 1);
        //	links
        $new_titles = array();
        $new_titles['a']['label'] = 'Home';
        $new_titles['a']['type'] = 'text';
        $new_titles['b']['label'] = 'Heading Page';
        $new_titles['b']['type'] = 'text';
        $new_titles['c']['label'] = 'Help Videos';
        $new_titles['c']['type'] = 'text';
        $new_titles['d']['label'] = 'Child Page';
        $new_titles['d']['type'] = 'text';
        $new_titles['e']['label'] = 'More';
        $new_titles['e']['type'] = 'text';
        $new_titles['f']['label'] = 'About';
        $new_titles['f']['type'] = 'text';
        $new_titles['special_contact']['lang_index'] = 'contact';
        $new_titles['special_contact']['type'] = 'special';
        $new_titles['special_site_map']['lang_index'] = 'site_map';
        $new_titles['special_site_map']['type'] = 'special';
        $new_titles['special_galleries']['lang_index'] = 'galleries';
        $new_titles['special_galleries']['type'] = 'special';
        $new_titles['special_missing']['label'] = 'Missing';
        $new_titles['special_missing']['type'] = 'special';
        $new_titles['special_gpsearch']['label'] = 'Search';
        $new_titles['special_gpsearch']['type'] = 'special';
        $pages = array();
        $pages['gp_index'] = $new_index;
        $pages['gp_menu'] = $new_menu;
        $pages['gp_titles'] = $new_titles;
        $pages['gpLayouts'] = $gpLayouts;
        echo '<li>';
        if (!\gp\tool\Files::SaveData($destination . '/data/_site/pages.php', 'pages', $pages)) {
            echo '<span class="failed">';
            //echo 'Could not save pages.php';
            echo sprintf($langmessage['COULD_NOT_SAVE'], 'pages.php');
            echo '</span>';
            echo '</li>';
            return false;
        }
        echo '<span class="passed">';
        //echo 'Pages.php saved.';
        echo sprintf($langmessage['_SAVED'], 'pages.php');
        echo '</span>';
        echo '</li>';
        // Home
        $content = '<h2>Welcome to Your ' . CMS_NAME . ' Powered Site!</h2>
		<p class="lead">Now that ' . CMS_NAME . ' is installed, you can start editing the content and customizing your site.</p>
		<div class="row">
		<div class="col-sm-6">

		<h3>Getting Started</h3>
		<hr/>
		<p>You are currently viewing the default home page of your website. Here\'s a quick description of how to edit this page.</p>
		<ol>
		<li>First make sure you&#39;re ' . self::Install_Link_Content('Admin', 'logged in', 'file=Home') . '.</li>
		<li>Then click the &quot;Edit&quot; link that appears when you move your mouse over the content.</li>
		<li>Your changes will be saved to a draft automatically. Click "Publish Draft" to make them live.</li>
		</ol>

		</div>
		<div class="col-sm-6">

		<h3>More Options</h3>
		<hr/>
		<ul>
		<li>Adding, renaming, deleting and organising your pages can all be done in the ' . self::Install_Link_Content('Admin/Menu', 'Page Manager') . '.</li>
		<li>Choose from a ' . self::Install_Link_Content('Admin_Theme_Content', 'variety of themes') . ' to give your site a custom look.</li>
		<li>Then, you can ' . self::Install_Link_Content('Admin_Theme_Content/Edit', 'add, remove and rearrange') . ' the content of your site without editing the html.</li>
		<li>Take a look at the Administrator Toolbar to access all the features of ' . CMS_NAME . '.</li>
		</ul>

		</div>
		</div>

		<div class="row">
		<div class="col-sm-6">

		<h3>Online Resources</h3>
		<hr/>
		<p>' . CMS_READABLE_DOMAIN . ' has a number of resources to help you do even more.</p>
		<ul>
		<li>Find more community developed <a href="' . CMS_DOMAIN . '/Themes" title="' . CMS_NAME . ' Themes">themes</a> and <a href="' . CMS_DOMAIN . '/Plugins" title="' . CMS_NAME . ' Plugin">plugins</a> to enhance your site.</li>
		<li>Get help in the <a href="' . CMS_DOMAIN . '/Forum" title="' . CMS_NAME . ' Forum">' . CMS_NAME . ' forum</a>.</li>
		<li>Show off your <a href="' . CMS_DOMAIN . '/Showcase" title="Sites Using ' . CMS_NAME . '">' . CMS_NAME . ' powered site</a> or list your <a href="' . CMS_DOMAIN . '/Providers" title="Businesses Using ' . CMS_NAME . '">' . CMS_NAME . ' related business</a>.</li>
		</ul>

		</div>
		<div class="col-sm-6">

		<h3>Git Social</h3>
		<hr/>
		<p>There are many ways to contribute to our project:</p>
		<ul>
		<li>Fork ' . CMS_NAME . ' on <a href="https://github.com/Typesetter/Typesetter" target="_blank">github</a>.</li>
		<li>Like us on <a href="https://www.facebook.com/Typesetter.cms" target="_blank">Facebook</a>.</li>
		<li>Follow us on <a href="https://twitter.com/TypesetterCMS" target="_blank">Twitter</a>.</li>
		</ul>

		</div>
		</div>
		';
        self::NewTitle($destination, 'Home', $content, $config, $new_index);
        // Heading Page
        $content = '<h1>A Heading Page</h1>
		<ul><li>' . self::Install_Link_Content('Help_Videos', 'Help Videos') . '</li>
		<li>' . self::Install_Link_Content('Child_Page', 'Child Page') . '</li>
		</ul>';
        self::NewTitle($destination, 'Heading_Page', $content, $config, $new_index);
        // Help Videos
        $content = '<h1>Help Videos</h1>
		<p>Video tutorials are often a fast and easy way to learn new things quickly.
		We now have an English version and Deutsch (German) available below.
		If you make a video tutorial for ' . CMS_NAME . ', <a href="' . CMS_DOMAIN . '/Contact">let us know</a>, and we\'ll make sure it\'s included in our list.
		</p>
		<p>And as always, to edit this page, just click the "Edit" button while logged in.</p>

		<h2>Português</h2>
		<p><iframe width="640" height="360" src="http://www.youtube.com/embed/KCnGpUzYTbQ" frameborder="0" allowfullscreen></iframe></p>

		<h2>Deutsch</h2>
		<p>Created by <a href="' . CMS_DOMAIN . '/Service_Provider?id=57" title="IT Ricther on ' . CMS_READABLE_DOMAIN . '">IT Richter</a></p>
		<p><iframe width="640" height="360" src="http://www.youtube.com/embed/04cNgR1EiFY" frameborder="0" allowfullscreen></iframe></p>';
        self::NewTitle($destination, 'Help_Videos', $content, $config, $new_index);
        // Child Page
        $content = '<h1>A Child Page</h1><p>This was created as a subpage of your <em>Help Videos</em> . You can easily change the arrangement of all your pages using the ' . self::Install_Link_Content('Admin/Menu', 'Page Manager') . '.</p>';
        self::NewTitle($destination, 'Child_Page', $content, $config, $new_index);
        // More
        $content = '<h1>More</h1>
		<ul><li>' . self::Install_Link_Content('About', 'About') . '</li>
		<li>' . self::Install_Link_Content('Contact', 'Contact') . '</li>
		</ul>';
        self::NewTitle($destination, 'More', $content, $config, $new_index);
        // About
        $content = '<h1>About ' . CMS_NAME . '</h1><p><a href="' . CMS_DOMAIN . '" title="' . CMS_READABLE_DOMAIN . '">' . CMS_NAME . '</a> is a complete Content Management System (CMS) that can help you create rich and flexible web sites with a simple and easy to use interface.</p>
		<h2>' . CMS_NAME . ' How To</h2>
		<p>Learn how to <a href="' . CMS_DOMAIN . '/Docs/Main/Admin" title="' . CMS_NAME . ' File Management">manage your files</a>,
		<a href="' . CMS_DOMAIN . '/Docs/Main/Creating%20Galleries" title="Creating Galleries in ' . CMS_NAME . '">create galleries</a> and more in the
		<a href="' . CMS_DOMAIN . '/Docs/index.php/" title="' . CMS_NAME . ' Documentation">' . CMS_NAME . ' Documentation</a>.
		</p>

		<h2>' . CMS_NAME . ' Features</h2>
		<ul>
		<li>True WYSIWYG (Using CKEditor)</li>
		<li>Galleries (Using ColorBox)</li>
		<li>SEO Friendly Links</li>
		<li>Free and Open Source (GPL)</li>
		<li>Runs on PHP</li>
		<li>File Upload Manager</li>
		<li>Drag \'n Drop Theme Content</li>
		<li>Deleted File Trash Can</li>
		<li>Multiple User Administration</li>
		<li>Flat File Storage</li>
		<li>Fast Page Loading</li>
		<li>Fast and Easy Installation</li>
		<li>reCaptcha for Contact Form</li>
		<li>HTML Tidy (when available)</li>
		</ul>';
        self::NewTitle($destination, 'About', $content, $config, $new_index);
        //Side_Menu
        $file = $destination . '/data/_extra/Side_Menu.php';
        $content = '<h3>Join the ' . CMS_NAME . ' Community</h3>
		<p>Visit ' . CMS_READABLE_DOMAIN . ' to access the many <a href="' . CMS_DOMAIN . '/Resources" title="' . CMS_NAME . ' Community Resources">available resources</a> to help you get the most out of our CMS.</p>
		<ul>
		<li><a href="' . CMS_DOMAIN . '/Themes" title="' . CMS_NAME . ' Themes">Download Themes</a></li>
		<li><a href="' . CMS_DOMAIN . '/Plugins" title="' . CMS_NAME . ' Plugin">Download Plugins</a></li>
		<li><a href="' . CMS_DOMAIN . '/Forum" title="' . CMS_NAME . ' Forum">Get Help in the Forum</a></li>
		<li><a href="' . CMS_DOMAIN . '/Powered_by" title="Sites using ' . CMS_NAME . '">Show off Your Site</a></li>
		<li><a href="' . CMS_DOMAIN . '/Resources" title="' . CMS_NAME . ' Community Resources">And Much More...</a></li>
		</ul>
		<p class="sm">(Edit this content by clicking &quot;Edit&quot;, it&#39;s that easy!)</p>';
        self::NewExtra($file, $content);
        //Header
        $file = $destination . '/data/_extra/Header.php';
        $content = '<h1>' . $config['title'] . '</h1>
		<h4>' . 'The Fast and Easy CMS' . '</h4>';
        self::NewExtra($file, $content);
        //Footer
        $file = $destination . '/data/_extra/Footer.php';
        $content = '<h3><a href="' . CMS_DOMAIN . '/Our_CMS" title="Features of Our CMS">' . CMS_NAME . ' Features</a></h3>
		<p>Easy to use True WYSIWYG Editing.</p>
		<p>Flat-file data storage and advanced resource management for fast websites.</p>
		<p>Community driven development</p>
		<p><a href="' . CMS_DOMAIN . '/Our_CMS" title="Features of Our CMS">And More...</a></p>
		<p>If you like ' . CMS_NAME . ', then you might also like
		<a href="http://lessphp.typesettercms.com" title="A Less to CSS compiler based on the official lesscss project">Less.php</a>,
		<a href="http://whatcms.org" title="What CMS? Find out what CMS a site is using">WhatCMS.org</a> and
		<a href="http://whichcms.org" title="Which CMS? Find out which CMS has the features you\'re looking for.">WhichCMS.org</a>.
		</p>';
        self::NewExtra($file, $content);
        //Another example area
        $file = $destination . '/data/_extra/Lorem.php';
        $content = '<h3>Heading</h3>
		<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>';
        self::NewExtra($file, $content);
        //contact html
        $file = $destination . '/data/_extra/Contact.php';
        self::NewExtra($file, '<h2>Contact Us</h2><p>Use the form below to contact us, and be sure to enter a valid email address if you want to hear back from us.</p>');
        //users
        echo '<li>';
        $user_info = array();
        $user_info['password'] = \gp\tool::hash($_POST['password'], 'sha512');
        $user_info['passhash'] = 'sha512';
        $user_info['granted'] = 'all';
        $user_info['editing'] = 'all';
        $user_info['email'] = $_POST['email'];
        $users = array();
        $username = $_POST['username'];
        //log user in here to finish user_info
        if ($base_install) {
            gp_defined('gp_session_cookie', \gp\tool\Session::SessionCookie($config['gpuniq']));
            \gp\tool\Session::create($user_info, $username, $sessions);
        }
        $users[$username] = $user_info;
        if (!\gp\tool\Files::SaveData($destination . '/data/_site/users.php', 'users', $users)) {
            echo '<span class="failed">';
            echo sprintf($langmessage['COULD_NOT_SAVE'], 'users.php');
            echo '</span>';
            echo '</li>';
            return false;
        }
        echo '<span class="passed">';
        echo sprintf($langmessage['_SAVED'], 'users.php');
        echo '</span>';
        echo '</li>';
        //save config
        //not using SaveConfig() because $config is not global here
        echo '<li>';
        $config['file_count'] = self::$file_count;
        if (!\gp\tool\Files::SaveData($destination . '/data/_site/config.php', 'config', $config)) {
            echo '<span class="failed">';
            echo sprintf($langmessage['COULD_NOT_SAVE'], 'config.php');
            echo '</span>';
            echo '</li>';
            return false;
        }
        echo '<span class="passed">';
        echo sprintf($langmessage['_SAVED'], 'config.php');
        echo '</span>';
        echo '</li>';
        if ($base_install) {
            self::InstallHtaccess($destination, $config);
        }
        \gp\tool\Files::Unlock('write', gp_random);
        return true;
    }
Example #13
0
defined('is_running') or define('is_running', true);
require_once 'common.php';
\gp\tool::EntryPoint(0);
/*
 *	Flow Control
 */
if (!empty($GLOBALS['config']['updating_message'])) {
    die($GLOBALS['config']['updating_message']);
}
$title = \gp\tool::WhichPage();
$type = \gp\tool::SpecialOrAdmin($title);
switch ($type) {
    case 'special':
        $page = new \gp\special\Page($title, $type);
        break;
    case 'admin':
        if (\gp\tool::LoggedIn()) {
            $page = new \gp\admin\Page($title, $type);
        } else {
            $page = new \gp\admin\Login($title, $type);
        }
        break;
    default:
        if (\gp\tool::LoggedIn()) {
            $page = new \gp\Page\Edit($title, $type);
        } else {
            $page = new \gp\Page($title, $type);
        }
        break;
}
\gp\tool\Output::RunOut();
Example #14
0
 /**
  * Rename a page
  *
  */
 public static function RenamePage()
 {
     global $langmessage, $gp_index, $page;
     $new_title = self::RenameFile($page->title);
     if ($new_title !== false && $new_title != $page->title) {
         msg(sprintf($langmessage['will_redirect'], \gp\tool::Link_Page($new_title)));
         $page->head .= '<meta http-equiv="refresh" content="15;url=' . \gp\tool::GetUrl($new_title) . '">';
         $page->ajaxReplace[] = array('location', \gp\tool::GetUrl($new_title), 15000);
         return true;
     }
     return false;
 }
Example #15
0
 function GetSiteLabelLink()
 {
     global $config;
     echo \gp\tool::Link('', $config['title']);
 }
Example #16
0
 /**
  * View the contents of a trash file
  *
  */
 public function ViewTrashFile($trash_index)
 {
     global $dataDir, $langmessage, $trash_file;
     $title_info = self::GetInfo($trash_index);
     //delete / restore links
     echo '<div class="pull-right">';
     echo \gp\tool::Link('Admin/Trash', $langmessage['restore'], 'cmd=RestoreDeleted&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'cnreq', 'class' => 'gpsubmit'));
     echo ' &nbsp; ';
     echo \gp\tool::Link('Admin/Trash', $langmessage['delete'], 'cmd=DeleteFromTrash&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'cnreq', 'class' => 'gpsubmit'));
     echo '</div>';
     echo '<h2 class="hmargin">';
     echo \gp\tool::Link('Admin/Trash', $langmessage['trash']);
     echo ' &#187; ';
     echo htmlspecialchars($title_info['title']);
     echo '</h2>';
     echo '<hr>';
     //get file sections
     $file_sections = \gp\tool\Files::Get($title_info['page_file'], 'file_sections');
     if ($file_sections) {
         echo \gp\tool\Output\Sections::Render($file_sections, $title_info['title']);
     } else {
         echo '<p>This page no longer has any content</p>';
     }
 }
Example #17
0
 /**
  * Convert array of html attributes into a string for output
  *
  */
 static function SectionAttributes($attrs, $type)
 {
     switch ($type) {
         case 'image':
             $attrs['src'] = \gp\tool::GetDir($attrs['src']);
             break;
     }
     $attrs += array('class' => '');
     $attrs['class'] = trim('GPAREA filetype-' . $type . ' ' . $attrs['class']);
     $attr_string = '';
     foreach ($attrs as $attr => $value) {
         $attr_string .= ' ' . htmlspecialchars($attr) . '="' . htmlspecialchars($value) . '"';
     }
     return $attr_string;
 }
Example #18
0
 /**
  * Save the posted page as the homepage
  *
  */
 public function HomepageSave()
 {
     global $langmessage, $config, $gp_index, $gp_titles;
     $homepage = $_POST['homepage'];
     $homepage_key = false;
     if (isset($gp_index[$homepage])) {
         $homepage_key = $gp_index[$homepage];
     } else {
         foreach ($gp_titles as $index => $title) {
             if ($title['label'] === $homepage) {
                 $homepage_key = $index;
                 break;
             }
         }
         if (!$homepage_key) {
             msg($langmessage['OOPS']);
             return;
         }
     }
     $config['homepath_key'] = $homepage_key;
     $config['homepath'] = \gp\tool::IndexToTitle($config['homepath_key']);
     if (!\gp\admin\Tools::SaveConfig(true)) {
         return;
     }
     //update the display
     ob_start();
     $this->HomepageDisplay();
     $content = ob_get_clean();
     $this->page->ajaxReplace[] = array('inner', '.homepage_setting', $content);
 }
Example #19
0
 /**
  * Start the link attributes array
  *
  */
 protected function MenuAttributesA()
 {
     global $gp_titles;
     $attributes = array('href' => '', 'attr' => '', 'value' => '', 'title' => '', 'class' => array());
     //external
     if (isset($this->curr_info['url'])) {
         if (empty($this->curr_info['title_attr'])) {
             $this->curr_info['title_attr'] = strip_tags($this->curr_info['label']);
         }
         $attributes['href'] = $this->curr_info['url'];
         $attributes['value'] = $this->curr_info['label'];
         $attributes['title'] = $this->curr_info['title_attr'];
         if (isset($this->curr_info['new_win'])) {
             $attributes['target'] = '_blank';
         }
         //internal link
     } else {
         $title = \gp\tool::IndexToTitle($this->curr_key);
         $attributes['href'] = \gp\tool::GetUrl($title);
         $attributes['value'] = \gp\tool::GetLabel($title);
         $attributes['title'] = \gp\tool::GetBrowserTitle($title);
         //get valid rel attr
         if (!empty($gp_titles[$this->curr_key]['rel'])) {
             $rel = explode(',', $gp_titles[$this->curr_key]['rel']);
             $attributes['rel'] = array_intersect(array('alternate', 'author', 'bookmark', 'help', 'icon', 'license', 'next', 'nofollow', 'noreferrer', 'prefetch', 'prev', 'search', 'stylesheet', 'tag'), $rel);
         }
     }
     return $attributes;
 }
 /**
  * Test if function exists.  Also handles case where function is disabled via Suhosin.
  * Modified from: http://dev.piwik.org/trac/browser/trunk/plugins/Installation/Controller.php
  *
  * @param string $function Function name
  * @return bool True if function exists (not disabled); False otherwise.
  */
 static function function_exists($function)
 {
     $function = strtolower($function);
     // eval() is a language construct
     if ($function == 'eval') {
         // does not check suhosin.executor.eval.whitelist (or blacklist)
         if (extension_loaded('suhosin') && \gp\tool::IniGet('suhosin.executor.disable_eval')) {
             return false;
         }
         return true;
     }
     if (!function_exists($function)) {
         return false;
     }
     $blacklist = @ini_get('disable_functions');
     if (extension_loaded('suhosin')) {
         $blacklist .= ',' . @ini_get('suhosin.executor.func.blacklist');
     }
     $blacklist = explode(',', $blacklist);
     $blacklist = array_map('trim', $blacklist);
     $blacklist = array_map('strtolower', $blacklist);
     if (in_array($function, $blacklist)) {
         return false;
     }
     return true;
 }
Example #21
0
 /**
  * Show images available in themes
  *
  */
 public function ShowThemeImages()
 {
     global $langmessage;
     $this->page->ajaxReplace = array();
     $current_theme = false;
     //which theme folder
     if (isset($_REQUEST['theme']) && isset($this->avail_addons[$_REQUEST['theme']])) {
         $current_theme = $_REQUEST['theme'];
         $current_info = $this->avail_addons[$current_theme];
         $current_label = $current_info['name'];
         $current_dir = $current_info['full_dir'];
         $current_url = \gp\tool::GetDir($current_info['rel']);
         //current layout
     } else {
         $layout_info = \gp\tool::LayoutInfo($this->curr_layout, false);
         $current_label = $layout_info['theme_name'];
         $current_dir = $layout_info['dir'];
         $current_url = \gp\tool::GetDir(dirname($layout_info['path']));
     }
     //list of themes
     ob_start();
     echo '<div class="gp_edit_select ckeditor_control">';
     echo '<a class="gp_selected_folder"><span class="folder"></span>';
     echo $current_label;
     echo '</a>';
     echo '<div class="gp_edit_select_options">';
     foreach ($this->avail_addons as $theme_id => $info) {
         $slug = 'Admin_Theme_Content/Image/' . rawurlencode($this->curr_layout);
         echo \gp\tool::Link($slug, '<span class="folder"></span>' . $info['name'], 'cmd=ShowThemeImages&theme=' . rawurlencode($theme_id), ' data-cmd="gpajax" class="gp_gallery_folder" ');
     }
     echo '</div>';
     echo '</div>';
     $gp_option_area = ob_get_clean();
     //images in theme
     $images = array();
     self::GetAvailThemeImages($current_dir, $current_url, $images);
     ob_start();
     foreach ($images as $image) {
         echo '<span class="expand_child">' . '<a href="' . $image['url'] . '" data-cmd="gp_gallery_add" data-width="' . $image['width'] . '" data-height="' . $image['height'] . '">' . '<img src="' . $image['url'] . '" alt=""/>' . '</a></span>';
     }
     $gp_gallery_avail_imgs = ob_get_clean();
     if ($current_theme) {
         $this->page->ajaxReplace[] = array('inner', '#gp_option_area', $gp_option_area);
         $this->page->ajaxReplace[] = array('inner', '#gp_gallery_avail_imgs', $gp_gallery_avail_imgs);
     } else {
         $content = '<div id="gp_option_area">' . $gp_option_area . '</div>' . '<div id="gp_gallery_avail_imgs">' . $gp_gallery_avail_imgs . '</div>';
         $this->page->ajaxReplace[] = array('inner', '#gp_image_area', $content);
     }
     $this->page->ajaxReplace[] = array('inner', '#gp_folder_options', '');
     //remove upload button
 }
Example #22
0
 /**
  * Attempt to increase php's memory limit using the current memory used and the post_max_size value
  * Generally speaking, memory_limit should be larger than post_max_size http://php.net/manual/en/ini.core.php
  * @static
  */
 static function AdjustMemoryLimit()
 {
     //get memory limit in bytes
     $limit = @ini_get('memory_limit') or '8M';
     $limit = \gp\tool::getByteValue($limit);
     //get memory usage or use a default value
     if (function_exists('memory_get_usage')) {
         $memoryUsed = memory_get_usage();
     } else {
         $memoryUsed = 3 * 1048576;
         //sizable buffer 3MB
     }
     //since imageHeight and imageWidth aren't always available
     //use post_max_size to figure maximum memory limit
     $max_post = @ini_get('post_max_size') or '8M';
     //defaults to 8M
     $max_post = \gp\tool::getByteValue($max_post);
     $needed = $max_post + $memoryUsed;
     if ($limit < $needed) {
         @ini_set('memory_limit', $needed);
     }
 }
Example #23
0
 public function Form_Entry()
 {
     global $langmessage;
     echo '<form action="' . \gp\tool::GetUrl('') . '" method="post">';
     echo '<table class="styledtable">';
     \gp\install\Tools::Form_UserDetails();
     \gp\install\Tools::Form_Configuration();
     echo '</table>';
     echo '<p>';
     echo '<input type="hidden" name="cmd" value="Install" />';
     echo '<input type="submit" class="submit install_button" name="aaa" value="' . $langmessage['Install'] . '" />';
     echo '</p>';
     echo '</form>';
 }
Example #24
0
 /**
  * Show the default admin page
  *
  */
 private function AdminPanel()
 {
     global $langmessage;
     $cmd = \gp\tool::GetCommand();
     switch ($cmd) {
         case 'embededcheck':
             new \gp\admin\Update('embededcheck');
             return;
         case 'autocomplete-titles':
             $opts = array('var_name' => false);
             echo \gp\tool\Editing::AutoCompleteValues(false, $opts);
             die;
     }
     $this->head_js[] = '/include/js/auto_width.js';
     echo '<h2>' . $langmessage['administration'] . '</h2>';
     echo '<div id="adminlinks2">';
     \gp\admin\Tools::AdminPanelLinks(false);
     echo '</div>';
 }
Example #25
0
 /**
  * Get Archive Root
  *
  */
 public function GetRoot($search_file = 'Addon.ini')
 {
     $archive_files = $this->ListFiles();
     $archive_root = null;
     foreach ($archive_files as $file) {
         if (strpos($file['name'], $search_file) === false) {
             continue;
         }
         $root = \gp\tool::DirName($file['name']);
         if ($root == '.') {
             $root = '';
         }
         if (is_null($archive_root) || strlen($root) < strlen($archive_root)) {
             $archive_root = $root;
         }
     }
     return $archive_root;
 }
Example #26
0
 /**
  * Remove folders and files that are no longer needed
  *
  */
 function CleanUp()
 {
     global $langmessage;
     //delete old folders
     if (isset($_POST['old_folder']) && is_array($_POST['old_folder'])) {
         $this->CleanUpFolders($_POST['old_folders']);
     }
     //failed install message
     if (isset($_POST['failed_install'])) {
         $this->msg($langmessage['settings_restored']);
         echo '<h3>';
         echo \gp\tool::link('', $langmessage['return_to_your_site']);
         echo ' &nbsp; &nbsp; ';
         echo '<a href="?cmd=update">' . $langmessage['try_again'] . '</a>';
         echo '</h3>';
         return true;
     }
     //delete zip file
     if (!empty($this->core_package['file']) && file_exists($this->core_package['file'])) {
         unlink($this->core_package['file']);
     }
     $this->msg($langmessage['settings_restored']);
     $this->msg($langmessage['software_updated']);
     echo '<h3>';
     echo \gp\tool::link('', '&#187; ' . $langmessage['return_to_your_site']);
     echo '</h3>';
     return true;
 }
Example #27
0
 /**
  * Handle the processing of multiple less files into css
  *
  * @return mixed Compiled css string or false
  *
  */
 static function ParseLess(&$less_files)
 {
     global $dataDir;
     $compiled = false;
     // don't use less if the memory limit is less than 64M
     $limit = @ini_get('memory_limit');
     if ($limit) {
         $limit = \gp\tool::getByteValue($limit);
         //if less than 64M, disable less compiler if we can't increase
         if ($limit < 67108864 && @ini_set('memory_limit', '96M') === false) {
             if (\gp\tool::LoggedIn()) {
                 msg('LESS compilation disabled. Please increase php\'s memory_limit');
             }
             return false;
             //if less than 96M, try to increase
         } elseif ($limit < 100663296) {
             @ini_set('memory_limit', '96M');
         }
     }
     //compiler options
     $options = array();
     //prepare the compiler
     includeFile('thirdparty/less.php/Less.php');
     $parser = new \Less_Parser($options);
     $import_dirs[$dataDir] = \gp\tool::GetDir('/');
     $parser->SetImportDirs($import_dirs);
     $parser->cache_method = 'php';
     $parser->SetCacheDir($dataDir . '/data/_cache');
     // combine files
     try {
         foreach ($less_files as $less) {
             //treat as less markup if there are newline characters
             if (strpos($less, "\n") !== false) {
                 $parser->Parse($less);
                 continue;
             }
             // handle relative and absolute paths
             if (!empty($dataDir) && strpos($less, $dataDir) === false) {
                 $relative = $less;
                 $less = $dataDir . '/' . ltrim($less, '/');
             } else {
                 $relative = substr($less, strlen($dataDir));
             }
             $parser->ParseFile($less, \gp\tool::GetDir(dirname($relative)));
         }
         $compiled = $parser->getCss();
     } catch (Exception $e) {
         if (\gp\tool::LoggedIn()) {
             msg('LESS Compile Failed: ' . $e->getMessage());
         }
         return false;
     }
     // significant difference in used memory 15,000,000 -> 6,000,000. Max still @ 15,000,000
     if (function_exists('gc_collect_cycles')) {
         gc_collect_cycles();
     }
     $less_files = $parser->allParsedFiles();
     return $compiled;
 }
Example #28
0
 /**
  * Plugin option links
  *
  */
 function OptionLinks($addon_key, $addon_config, $format = false)
 {
     global $langmessage, $gpLayouts;
     $list = array();
     if (!isset($addon_config['is_theme']) || !$addon_config['is_theme']) {
         //editable text
         if (isset($addon_config['editable_text']) && \gp\admin\Tools::HasPermission('Admin_Theme_Content')) {
             $list[] = \gp\tool::Link('Admin_Theme_Content/Text', $langmessage['editable_text'], 'cmd=AddonTextForm&addon=' . urlencode($addon_key), array('title' => urlencode($langmessage['editable_text']), 'data-cmd' => 'gpabox'));
         }
         //upgrade link
         if (isset($addon_config['upgrade_from'])) {
             $list[] = '<a href="?cmd=LocalInstall&source=' . rawurlencode($addon_config['upgrade_from']) . '" data-cmd="cnreq">' . $langmessage['upgrade'] . '</a>';
         }
         //uninstall
         $list[] = \gp\tool::Link('Admin/Addons', $langmessage['uninstall'], 'cmd=uninstall&addon=' . rawurlencode($addon_key), 'data-cmd="gpabox"');
         //version
         if (!empty($addon_config['version'])) {
             $list[] = '<a>' . $langmessage['Your_version'] . ' ' . $addon_config['version'] . '</a>';
         }
         //rating
         if (isset($addon_config['id']) && is_numeric($addon_config['id'])) {
             $id = $addon_config['id'];
             $rating = 5;
             if (isset($this->addonReviews[$id])) {
                 $rating = $this->addonReviews[$id]['rating'];
             }
             $label = $langmessage['rate_this_addon'] . ' ' . $this->ShowRating($id, $rating);
             $list[] = '<span>' . $label . '</span>';
         }
         echo $this->FormatList($list, $langmessage['options'], $format);
         return;
     }
     //show list of themes using these addons
     foreach ($gpLayouts as $layout_id => $layout_info) {
         if (!isset($layout_info['addon_key']) || $layout_info['addon_key'] !== $addon_key) {
             continue;
         }
         $item = '<span><span class="layout_color_id" style="background:' . $layout_info['color'] . '"></span> ';
         $item .= \gp\tool::Link('Admin_Theme_Content', $layout_info['label']);
         $item .= ' ( ';
         $item .= \gp\tool::Link('Admin_Theme_Content/Edit/' . $layout_id, $langmessage['edit']);
         $item .= ' )</span>';
         $list[] = $item;
     }
     echo $this->FormatList($list, $langmessage['layouts'], $format);
 }
Example #29
0
 /**
  * Output Javascript code to set variable defaults
  *
  */
 public static function JsStart()
 {
     global $linkPrefix;
     //default Variables
     \gp\tool\Output::$inline_vars['isadmin'] = false;
     \gp\tool\Output::$inline_vars['gpBase'] = rtrim(self::GetDir(''), '/');
     \gp\tool\Output::$inline_vars['post_nonce'] = '';
     \gp\tool\Output::$inline_vars['req_type'] = strtolower(htmlspecialchars($_SERVER['REQUEST_METHOD']));
     if (gpdebugjs) {
         if (is_string(gpdebugjs)) {
             \gp\tool\Output::$inline_vars['debugjs'] = 'send';
         } else {
             \gp\tool\Output::$inline_vars['debugjs'] = true;
         }
     }
     if (self::LoggedIn()) {
         \gp\tool\Output::$inline_vars['isadmin'] = true;
         \gp\tool\Output::$inline_vars['req_time'] = time();
         \gp\tool\Output::$inline_vars['gpBLink'] = self::HrefEncode($linkPrefix, false);
         \gp\tool\Output::$inline_vars['post_nonce'] = self::new_nonce('post', true);
         \gp\tool\Output::$inline_vars['gpFinderUrl'] = \gp\tool::GetUrl('Admin/Browser');
         \gp\tool\Session::GPUIVars();
     }
     echo 'var gplinks={},gpinputs={},gpresponse={}';
     foreach (\gp\tool\Output::$inline_vars as $key => $value) {
         echo ',' . $key . '=' . json_encode($value);
     }
     echo ';';
 }
Example #30
0
    return $args;
}
function rename_check($event, $args, $finder)
{
    $name = $args['name'];
    if (gp_restrict_uploads && !\gp\admin\Content\Uploaded::AllowedExtension($name)) {
        return false;
    }
    $args['name'] = $name;
    return $args;
}
function SaveFinderData($data)
{
    global $config;
    $config['finder_data'] = $data;
    \gp\admin\Tools::SaveConfig();
}
function ReturnFinderData()
{
    global $config;
    if (isset($config['finder_data'])) {
        return $config['finder_data'];
    }
    return false;
}
$opts = array('debug' => gpdebug, 'saveData' => 'SaveFinderData', 'returnData' => 'ReturnFinderData', 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => $dataDir . '/data/_uploaded/', 'URL' => \gp\tool::GetDir('data/_uploaded'), 'accessControl' => 'access', 'tmbPath' => $dataDir . '/data/_elthumbs', 'tmbURL' => \gp\tool::GetDir('data/_elthumbs'), 'separator' => '/', 'tmbBgColor' => 'transparent', 'copyOverwrite' => false, 'uploadOverwrite' => false, 'tmbPathMode' => gp_chmod_dir, 'dirMode' => gp_chmod_dir, 'fileMode' => gp_chmod_file)), 'bind' => array('duplicate upload rename rm paste resize' => array('\\gp\\admin\\Content\\Uploaded', 'FinderChange'), 'upload-before' => 'upload_check', 'rename-before' => 'rename_check'));
$opts = \gp\tool\Plugins::Filter('FinderOptionsServer', array($opts));
gpSettingsOverride('finder_options_server', $opts);
// run Finder
$connector = new Finder($opts);
$connector->run();