コード例 #1
0
ファイル: admin_classes.php プロジェクト: VTAMAGNO/gpEasy-CMS
 /**
  * Display form for selecting classes
  *
  */
 function ClassesForm()
 {
     global $dataDir, $langmessage, $addonPathCode, $addonRelativeCode, $page;
     echo '<h2 class="hmargin">Manage Classes</h2>';
     $cmd = common::GetCommand();
     switch ($cmd) {
         case 'LoadDefault':
             $classes = self::Defaults();
             break;
         case 'LoadBootstrap':
             $classes = self::Bootstrap();
             break;
         default:
             $classes = self::GetClasses();
             break;
     }
     $classes[] = array('names' => '', 'desc' => '');
     $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="' . common::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>';
 }
コード例 #2
0
function ProtectOptions($title, $menu_key, $menu_value, $layout_info)
{
    global $protect_object;
    $is_protected = $protect_object->IsProtected($menu_key);
    if (!$is_protected) {
        $label = 'Protect Page';
    } elseif ($is_protected === 1) {
        $label = 'Remove Protection';
    } elseif ($is_protected === 2) {
        $label = 'Parent Protected';
    }
    $img = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" height="16" width="16" />';
    //echo common::Link($title,$img.$label,'cmd=passprotect','name="gpajax"');
    echo common::Link('Admin_Menu', $img . $label, 'cmd=passprotect&index=' . $menu_key, 'name="postlink"');
    //menupost
}
コード例 #3
0
 function GalleryEditBox($title, $info)
 {
     if (is_array($info)) {
         $icon = $info['icon'];
     } else {
         $icon = $info;
     }
     if (empty($icon)) {
         $thumbPath = common::GetDir('/include/imgs/blank.gif');
     } elseif (strpos($icon, '/thumbnails/') === false) {
         $thumbPath = common::GetDir('/data/_uploaded/image/thumbnails' . $icon . '.jpg');
     } else {
         $thumbPath = common::GetDir('/data/_uploaded' . $icon);
     }
     echo '<div class="draggable">';
     echo common::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>';
 }
コード例 #4
0
ファイル: Plugins.php プロジェクト: rizub4u/gpEasy-CMS
 /**
  * Set global path variables for the current addon
  * @param string $addon_key Key used to identify a plugin uniquely in the configuration
  *
  */
 function SetDataFolder($addon_key)
 {
     global $dataDir, $config;
     global $addonDataFolder, $addonCodeFolder;
     //deprecated
     global $addonRelativeCode, $addonRelativeData, $addonPathData, $addonPathCode, $addonFolderName, $addon_current_id, $addon_current_version;
     if (!isset($config['addons'][$addon_key])) {
         return;
     }
     gpPlugin::StackPush();
     $data_folder = gpPlugin::GetDataFolder($addon_key);
     $addon_current_id = $addon_current_version = false;
     if (isset($config['addons'][$addon_key]['id'])) {
         $addon_current_id = $config['addons'][$addon_key]['id'];
     }
     if (isset($config['addons'][$addon_key]['version'])) {
         $addon_current_version = $config['addons'][$addon_key]['version'];
     }
     $addonFolderName = $addon_key;
     $addonPathCode = $addonCodeFolder = $dataDir . '/data/_addoncode/' . $addon_key;
     $addonPathData = $addonDataFolder = $dataDir . '/data/_addondata/' . $data_folder;
     $addonRelativeCode = common::GetDir('/data/_addoncode/' . $addon_key);
     $addonRelativeData = common::GetDir('/data/_addondata/' . $data_folder);
 }
コード例 #5
0
 function CurrentRating($rating)
 {
     $width = 16 * 5;
     $pos = min($width, ceil($width * $rating));
     $pos2 = $width - ceil($pos);
     echo '<span title="' . number_format($rating * 100, 0) . '%" class="addon_rating">';
     echo '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="' . $pos . '" />';
     echo '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="' . $pos2 . '" style="background-position:' . $pos2 . 'px -16px" />';
     echo '</span> ';
 }
コード例 #6
0
ファイル: admin_tools.php プロジェクト: Bomberus/gpEasy-CMS
 /**
  * Output the link areas that are displayed in the main admin toolbar and admin_main
  * @param bool $in_panel Whether or not the links will be displayed in the toolbar
  * @static
  */
 static function AdminPanelLinks($in_panel = true)
 {
     global $langmessage, $page, $gpAdmin;
     $expand_class = 'expand_child';
     $id_piece = '';
     if (!$in_panel) {
         $expand_class = 'expand_child_click';
         $id_piece = '_click';
     }
     //current page
     if ($in_panel && !isset($GLOBALS['GP_ARRANGE_CONTENT']) && $page->pagetype != 'admin_display') {
         echo '<div class="panelgroup" id="current_page_panel">';
         self::PanelHeading($in_panel, $langmessage['Current Page'], 'icon_page_gear', 'cur');
         echo '<ul class="submenu">';
         echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['Current Page'] . '</a></li>';
         foreach ($page->admin_links as $label => $link) {
             echo '<li>';
             if (is_array($link)) {
                 echo call_user_func_array(array('common', 'Link'), $link);
                 /* preferred */
             } elseif (is_numeric($label)) {
                 echo $link;
                 //just a text label
             } elseif (empty($link)) {
                 echo '<span>';
                 echo $label;
                 echo '</span>';
             } else {
                 echo '<a href="' . $link . '">';
                 echo $label;
                 echo '</a>';
             }
             echo '</li>';
         }
         echo '<li class="' . $expand_class . '" id="editable_areas_list"><a>' . $langmessage['Editable Areas'] . '</a>';
         echo '<ul class="in_window">';
         if ($page->pagetype == 'display') {
             echo '<li class="separator">';
             echo common::Link($page->title, $langmessage['Manage Sections'] . '...', 'cmd=ManageSections', array('data-cmd' => 'inline_edit_generic', 'data-arg' => 'manage_sections'));
             echo '</li>';
         }
         echo '<li style="display:none"></li>';
         //for valid html
         echo '</ul>';
         echo '</li>';
         echo '</ul>';
         echo '</div>';
         echo '</div>';
     }
     //content
     if ($links = admin_tools::GetAdminGroup('content')) {
         echo '<div class="panelgroup" id="panelgroup_content' . $id_piece . '">';
         self::PanelHeading($in_panel, $langmessage['Content'], 'icon_page', 'con');
         echo '<ul class="submenu">';
         echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['Content'] . '</a></li>';
         echo $links;
         echo '</ul>';
         echo '</div>';
         echo '</div>';
     }
     //appearance
     if ($links = self::GetAppearanceGroup($in_panel)) {
         echo '<div class="panelgroup" id="panelgroup_appearance' . $id_piece . '">';
         self::PanelHeading($in_panel, $langmessage['Appearance'], 'icon_app', 'app');
         echo '<ul class="submenu">';
         echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['Appearance'] . '</a></li>';
         echo $links;
         echo '</ul>';
         echo '</div>';
         echo '</div>';
     }
     //add-ons
     $links = admin_tools::GetAddonLinks($in_panel);
     if (!empty($links)) {
         echo '<div class="panelgroup" id="panelgroup_addons' . $id_piece . '">';
         self::PanelHeading($in_panel, $langmessage['plugins'], 'icon_plug', 'add');
         echo '<ul class="submenu">';
         echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['plugins'] . '</a></li>';
         echo $links;
         echo '</ul>';
         echo '</div>';
         echo '</div>';
     }
     //settings
     if ($links = admin_tools::GetAdminGroup('settings')) {
         echo '<div class="panelgroup" id="panelgroup_settings' . $id_piece . '">';
         self::PanelHeading($in_panel, $langmessage['Settings'], 'icon_edapp', 'set');
         echo '<ul class="submenu">';
         echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['Settings'] . '</a></li>';
         echo $links;
         echo '</ul>';
         echo '</div>';
         echo '</div>';
     }
     //updates
     if (count(self::$new_versions) > 0) {
         ob_start();
         if (gp_remote_update && isset(self::$new_versions['core'])) {
             echo '<li>';
             echo '<a href="' . common::GetDir('/include/install/update.php') . '">gpEasy ' . self::$new_versions['core'] . '</a>';
             echo '</li>';
         }
         foreach (self::$new_versions as $addon_id => $new_addon_info) {
             if (!is_numeric($addon_id)) {
                 continue;
             }
             $label = $new_addon_info['name'] . ':  ' . $new_addon_info['version'];
             if ($new_addon_info['type'] == 'theme' && gp_remote_themes) {
                 $url = 'Themes';
             } elseif ($new_addon_info['type'] == 'plugin' && gp_remote_plugins) {
                 $url = 'Plugins';
             } else {
                 continue;
             }
             echo '<li><a href="' . addon_browse_path . '/' . $url . '/' . $addon_id . '" data-cmd="remote">' . $label . '</a></li>';
         }
         $list = ob_get_clean();
         if (!empty($list)) {
             echo '<div class="panelgroup" id="panelgroup_versions' . $id_piece . '">';
             self::PanelHeading($in_panel, $langmessage['updates'], 'icon_rfrsh', 'upd');
             echo '<ul class="submenu">';
             echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['updates'] . '</a></li>';
             echo $list;
             echo '</ul>';
             echo '</div>';
             echo '</div>';
         }
     }
     //username
     echo '<div class="panelgroup" id="panelgroup_user' . $id_piece . '">';
     self::PanelHeading($in_panel, $gpAdmin['useralias'], 'icon_user', 'use');
     echo '<ul class="submenu">';
     echo '<li class="submenu_top"><a class="submenu_top">' . $gpAdmin['username'] . '</a></li>';
     admin_tools::GetFrequentlyUsed($in_panel);
     echo '<li>';
     echo common::Link('Admin_Preferences', $langmessage['Preferences']);
     echo '</li>';
     echo '<li>';
     echo common::Link($page->title, $langmessage['logout'], 'cmd=logout', array('data-cmd' => 'creq'));
     echo '</li>';
     echo '<li>';
     echo common::Link('Admin_About', 'About gpEasy');
     echo '</li>';
     echo '</ul>';
     echo '</div>';
     echo '</div>';
     //gpEasy stats
     echo '<div class="panelgroup" id="panelgroup_gpeasy' . $id_piece . '">';
     self::PanelHeading($in_panel, $langmessage['Performance'], 'icon_chart', 'gpe');
     echo '<ul class="submenu">';
     echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['Performance'] . '</a></li>';
     echo '<li><a><span gpeasy-memory-usage>?</span> Memory</a></li>';
     echo '<li><a><span gpeasy-memory-max>?</span> Max Memory</a></li>';
     echo '<li><a><span gpeasy-seconds>?</span> Seconds</a></li>';
     echo '<li><a><span gpeasy-ms>?</span> Milliseconds</a></li>';
     echo '<li><a>0 DB Queries</a></li>';
     echo '</ul>';
     echo '</div>';
     echo '</div>';
     //resources
     if ($page->pagetype === 'admin_display') {
         echo '<div class="panelgroup" id="panelgroup_resources' . $id_piece . '">';
         self::PanelHeading($in_panel, $langmessage['resources'], 'icon_page_gear', 'res');
         echo '<ul class="submenu">';
         if (gp_remote_plugins && admin_tools::HasPermission('Admin_Addons')) {
             echo '<li>' . common::Link('Admin_Addons/Remote', $langmessage['Download Plugins']) . '</li>';
         }
         if (gp_remote_themes && admin_tools::HasPermission('Admin_Theme_Content')) {
             echo '<li>' . common::Link('Admin_Theme_Content/Remote', $langmessage['Download Themes']) . '</li>';
         }
         echo '<li><a href="http://gpeasy.com/Forum">Support Forum</a></li>';
         echo '<li><a href="http://gpeasy.com/Services">Service Providers</a></li>';
         echo '<li><a href="http://gpeasy.com">Official gpEasy Site</a></li>';
         echo '<li><a href="https://github.com/oyejorge/gpEasy-CMS/issues">Report A Bug</a></li>';
         echo '</ul>';
         echo '</div>';
         echo '</div>';
         if ($in_panel) {
             echo '<div class="gpversion">';
             echo 'gpEasy ' . gpversion;
             echo '</div>';
         }
     }
 }
コード例 #7
0
ファイル: admin_port.php プロジェクト: GedionChang/gpEasy-CMS
 function Exported()
 {
     global $langmessage;
     if (count($this->exported) == 0) {
         return;
     }
     echo '<table class="bordered">';
     echo '<tr><th>';
     echo $langmessage['Previous Exports'];
     echo '</th><th> &nbsp; </th><th>';
     echo $langmessage['File Size'];
     echo '</th><th>';
     echo $langmessage['options'];
     echo '</th></tr>';
     $total_size = 0;
     $total_count = 0;
     foreach ($this->exported as $file) {
         $info = $this->FileInfo($file);
         if (!$info) {
             continue;
         }
         $full_path = $this->export_dir . '/' . $file;
         if ($total_count % 2 == 0) {
             echo '<tr class="even">';
         } else {
             echo '<tr>';
         }
         echo '<td>';
         echo str_replace(' ', '&nbsp;', $info['time']);
         echo '</td><td>';
         echo implode(', ', $info['exported']);
         echo '</td><td>';
         $size = filesize($full_path);
         echo admin_tools::FormatBytes($size);
         echo ' ';
         echo $info['ext'];
         echo '</td><td>';
         echo '<a href="' . common::GetDir('/data/_exports/' . $file) . '">' . $langmessage['Download'] . '</a>';
         echo '&nbsp;&nbsp;';
         if ($this->CanRevert($info['bits'])) {
             echo common::Link('Admin_Port', $langmessage['Revert'], 'cmd=revert&archive=' . rawurlencode($file), '', $file);
         } else {
             echo $langmessage['Revert'];
         }
         echo '&nbsp;&nbsp;';
         echo common::Link('Admin_Port', $langmessage['delete'], 'cmd=delete&file=' . rawurlencode($file), array('data-cmd' => 'postlink', 'title' => $langmessage['delete_confirm'], 'class' => 'gpconfirm'), $file);
         echo '</td></tr>';
         $total_count++;
         $total_size += $size;
     }
     //totals
     echo '<tr><th>';
     echo $langmessage['Total'];
     echo ': ';
     echo $total_count;
     echo '</th><th>&nbsp;</th><th>';
     echo admin_tools::FormatBytes($total_size);
     echo '</th><th>&nbsp;</th></tr>';
     echo '</table>';
 }
コード例 #8
0
ファイル: admin_missing.php プロジェクト: VTAMAGNO/gpEasy-CMS
 function ShowRedirection()
 {
     global $langmessage, $page, $gp_index, $config;
     $page->head_js[] = '/include/thirdparty/tablesorter/tablesorter.js';
     $page->jQueryCode .= '$("table.tablesorter").tablesorter({cssHeader:"gp_header",cssAsc:"gp_header_asc",cssDesc:"gp_header_desc"});';
     echo '<p>' . $langmessage['About_Redirection'] . '</p>';
     echo common::Link('Admin_Missing', $langmessage['New Redirection'], 'cmd=newform', array('data-cmd' => 'gpabox'));
     if (empty($this->error_data['redirects'])) {
         return;
     }
     echo '<table class="bordered tablesorter full_width">';
     echo '<thead>';
     echo '<tr><th>';
     echo $langmessage['Source URL'];
     echo '</th><th>';
     echo $langmessage['Target URL'];
     echo '</th><th>';
     echo $langmessage['Similarity'];
     echo '</th><th>';
     echo $langmessage['Method'];
     echo '</th><th>';
     echo $langmessage['options'];
     echo '</th></tr>';
     echo '</thead>';
     echo '<tbody>';
     $has_invalid_target = false;
     $admin_urls = admin_tools::AdminScripts();
     foreach ($this->error_data['redirects'] as $source => $data) {
         echo '<tr><td>';
         $raw_source = $source;
         if (!empty($data['raw_source'])) {
             $raw_source = $data['raw_source'];
         }
         echo htmlspecialchars($raw_source);
         echo '</td><td>';
         $target_show = $data['target'];
         if (strlen($target_show) > 40) {
             $target_show = substr($target_show, 0, 15) . ' ... ' . substr($target_show, -15);
         }
         $full_target = $this->GetTarget($data['target'], false);
         echo '<a href="' . htmlspecialchars($full_target) . '">' . str_replace(' ', '&nbsp;', htmlspecialchars($target_show)) . '</a>';
         $is_gplink = $this->isGPLink($data['target']);
         if (!empty($data['target']) && $is_gplink) {
             if (!isset($gp_index[$data['target']]) && !isset($admin_urls[$data['target']])) {
                 $has_invalid_target = true;
                 echo ' <img src="' . common::GetDir('/include/imgs/error.png') . '" alt="" height="16" width="16" style="vertical-align:middle" title="' . $langmessage['Target URL Invalid'] . '"/> ';
             }
         }
         echo '</td><td>';
         if ($is_gplink) {
             $lower_source = strtolower($raw_source);
             $lower_target = strtolower($target_show);
             similar_text($lower_source, $lower_target, $percent);
             if ($config['auto_redir'] > 0 && $percent >= $config['auto_redir']) {
                 //echo '<span style="color:orange">'.number_format($percent,1).'%</span>';
                 echo number_format($percent, 1) . '%';
             } else {
                 echo number_format($percent, 1) . '%';
             }
         } else {
             echo '&nbsp;';
         }
         echo '</td><td>';
         echo $this->GetCodeLanguage($data['code']);
         echo '</td><td>';
         echo common::Link('Admin_Missing', $langmessage['edit'], 'cmd=editredir&source=' . urlencode($source), array('data-cmd' => 'gpabox'));
         echo ' &nbsp; ';
         echo common::Link($source, $langmessage['Test']);
         echo ' &nbsp; ';
         $title = sprintf($langmessage['generic_delete_confirm'], $source);
         echo common::Link('Admin_Missing', $langmessage['delete'], 'cmd=rmredir&link=' . urlencode($source), array('data-cmd' => 'postlink', 'title' => $title, 'class' => 'gpconfirm'));
         echo '</td></tr>';
     }
     echo '</tbody>';
     echo '</table>';
     echo '<p>';
     echo common::Link('Admin_Missing', $langmessage['New Redirection'], 'cmd=newform', array('data-cmd' => 'gpabox'));
     echo '</p>';
     if ($has_invalid_target) {
         echo '<p>';
         echo ' <img src="' . common::GetDir('/include/imgs/error.png') . '" alt="" height="16" width="16" style="vertical-align:middle" title="' . $langmessage['Target URL Invalid'] . '"/> ';
         echo $langmessage['Target URL Invalid'];
         echo '</p>';
     }
 }
コード例 #9
0
ファイル: combine.php プロジェクト: AndFer22/Typesetter
 function CSS_FixUrl($url, $pos, $pos2)
 {
     global $dataDir;
     $url = trim($url);
     $url = trim($url, '"\'');
     if (empty($url)) {
         return;
     }
     //relative url
     if ($url[0] == '/') {
         return;
     } elseif (strpos($url, '://') > 0) {
         return;
     } elseif (preg_match('/^data:/i', $url)) {
         return;
     }
     //use a relative path so sub.domain.com and domain.com/sub both work
     $replacement = common::GetDir(dirname($this->file) . '/' . $url);
     $replacement = $this->ReduceUrl($replacement);
     $replacement = '"' . $replacement . '"';
     $this->content = substr_replace($this->content, $replacement, $pos, $pos2 - $pos);
 }
コード例 #10
0
 /**
  * @static
  */
 static function DefaultContent($default_content, $type)
 {
     if (!self::ContentKeyMatch($type)) {
         return $default_content;
     }
     $section = array();
     ob_start();
     $id = 'carousel_' . time();
     echo '<div id="' . $id . '" class="gp_twitter_carousel carousel slide">';
     echo '<div style="padding-bottom:30%">';
     echo '<ol class="carousel-indicators">';
     echo '<li class="active gp_to_remove"></li>';
     echo '</ol>';
     //<!-- Carousel items -->
     echo '<div class="carousel-inner">';
     echo '<div class="item active gp_to_remove"><img/></div>';
     echo '</div>';
     //<!-- Carousel nav -->
     echo '<a class="carousel-control left" data-target="#' . $id . '" data-slide="prev">&lsaquo;</a>';
     echo '<a class="carousel-control right" data-target="#' . $id . '" data-slide="next">&rsaquo;</a>';
     echo '<span class="gp_blank_img" data-src="' . common::GetDir('/include/imgs/blank.gif') . '" style="display:none"></span>';
     echo '</div></div>';
     $section['content'] = ob_get_clean();
     $section['height'] = '30%';
     $section['auto_start'] = false;
     $section['interval_speed'] = 5000;
     return $section;
 }
コード例 #11
0
ファイル: connector.php プロジェクト: VTAMAGNO/gpEasy-CMS
    return $args;
}
function rename_check($event, $args, $finder)
{
    $name = $args['name'];
    if (gp_restrict_uploads && !admin_uploaded::AllowedExtension($name)) {
        return false;
    }
    $args['name'] = $name;
    return $args;
}
function SaveFinderData($data)
{
    global $config;
    $config['finder_data'] = $data;
    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' => common::GetDir('data/_uploaded'), 'accessControl' => 'access', 'tmbPath' => $dataDir . '/data/_elthumbs', 'tmbURL' => common::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('admin_uploaded', 'FinderChange'), 'upload-before' => 'upload_check', 'rename-before' => 'rename_check'));
$opts = gpPlugin::Filter('FinderOptionsServer', array($opts));
gpSettingsOverride('finder_options_server', $opts);
// run Finder
$connector = new Finder($opts);
$connector->run();
コード例 #12
0
 /**
  * Parse the ini a second time with variables
  *
  */
 function IniContents()
 {
     global $dataDir, $dirPrefix;
     $folder = basename($this->dest);
     $variables = array('{$addon}' => $folder, '{$plugin}' => $folder, '{$dataDir}' => $dataDir, '{$dirPrefix}' => $dirPrefix, '{$addonRelativeData}' => common::GetDir('/data/_addondata/' . $this->data_folder), '{$addonRelativeCode}' => common::GetDir($this->addon_folder_rel . '/' . $folder));
     $this->ini_contents = gp_ini::ParseString($this->ini_text, $variables);
 }
コード例 #13
0
ファイル: admin_uploaded.php プロジェクト: rizub4u/gpEasy-CMS
 /**
  * Delete a single file or folder
  *
  */
 function DeleteConfirmed()
 {
     global $langmessage, $page;
     if ($this->isThumbDir) {
         return false;
     }
     if (!common::verify_nonce('delete')) {
         message($langmessage['OOPS'] . ' (Invalid Nonce)');
         return;
     }
     $file = $this->CheckFile();
     if (!$file) {
         return;
     }
     $full_path = $this->currentDir . '/' . $file;
     $rel_path = common::GetDir('/data/_uploaded' . $this->subdir . '/' . $file);
     if (!gpFiles::RmAll($full_path)) {
         message($langmessage['OOPS']);
         return;
     }
     $page->ajaxReplace[] = array('img_deleted', '', $rel_path);
     return;
 }
コード例 #14
0
 /**
  * @static
  */
 static function ShowFile_Gallery($dir_piece, $file)
 {
     global $langmessage, $dataDir;
     if (!admin_uploaded::IsImg($file)) {
         return false;
     }
     //for gallery editing
     $rel_path = '/data/_uploaded' . $dir_piece . '/' . $file;
     $id = self::ImageId($rel_path);
     $file_url = common::GetDir($rel_path);
     $full_path = $dataDir . $rel_path;
     //thumbnail
     $thumb_url = common::ThumbnailPath($file_url);
     $thumb = ' <img src="' . $thumb_url . '" alt="" />';
     //get size
     $size = '';
     $size_a = getimagesize($full_path);
     if ($size_a) {
         $size = ' data-width="' . $size_a[0] . '" data-height="' . $size_a[1] . '"';
     }
     $query_string = 'file_cmd=delete&show=inline&file=' . urlencode($file);
     return '<span class="expand_child" id="' . $id . '">' . '<a href="' . $file_url . '" data-cmd="gp_gallery_add" ' . $size . '>' . $thumb . '</a>' . common::Link('Admin_Uploaded' . $dir_piece, '', $query_string, array('class' => 'delete gpconfirm', 'data-cmd' => 'gpajax', 'title' => $langmessage['delete_confirm']), 'delete') . '</span>';
 }
コード例 #15
0
ファイル: image.php プロジェクト: VTAMAGNO/gpEasy-CMS
 /**
  * Check the path of the img, return full path of image if the requested image is found
  *
  */
 function __construct()
 {
     global $dataDir;
     if (!isset($_GET['w']) || !isset($_GET['h']) || !isset($_GET['img'])) {
         self::Send404();
         //dies
     }
     $img = $_GET['img'];
     $height = $_GET['h'];
     $width = $_GET['w'];
     $index = $_GET['i'];
     if (!is_numeric($height) || !is_numeric($width)) {
         self::Send404();
         //dies
     }
     $img = gpFiles::NoNull($img);
     //check file path
     if (strpos($img, './') !== false || strpos($img, '%2f') !== false || strpos($img, '%2F') !== false) {
         return false;
     }
     //make sure the index is set
     gp_resized::SetIndex();
     if (!isset(self::$index[$index])) {
         self::Send404();
         //dies
     }
     //if the image has been renamed, redirect to the new name
     $index_img = self::$index[$index];
     if ($index_img != $img) {
         $path = common::GetDir('/include/image.php', false) . '?i=' . $index . '&w=' . $width . '&h=' . $height . '&img=' . rawurlencode($index_img);
         common::Redirect($path);
     }
     $info = self::ImageInfo($img, $width, $height);
     $folder = $dataDir . '/data/_resized/' . $info['index'];
     $full_path = $folder . '/' . $info['name'];
     //if it exists return true
     if (file_exists($full_path)) {
         header('Cache-Control: public, max-age=5184000');
         //60 days
         //attempt to send 304
         $stats = lstat($full_path);
         if ($stats) {
             common::Send304(common::GenEtag($stats['mtime'], $stats['size']));
         }
         header('Content-Transfer-Encoding: binary');
         header('Content-Type: ' . $info['ctype']);
         readfile($full_path);
         die;
     }
     //redirect to next largest image if available
     $usage = self::GetUsage($info['index']);
     foreach ($usage as $size => $data) {
         if (!$data['uses']) {
             continue;
         }
         list($use_width, $use_height) = explode('x', $size);
         if ($use_width >= $width && $use_height > $height || $use_width > $width && $use_height >= $height) {
             $path = common::GetDir('/include/image.php', false) . '?i=' . $index . '&w=' . $use_width . '&h=' . $use_height . '&img=' . rawurlencode($img);
             common::Redirect($path);
             //dies
         }
     }
     //redirect to full size image
     $original = common::GetDir('/data/_uploaded' . $img, false);
     common::Redirect($original);
     //dies
 }
コード例 #16
0
ファイル: common.php プロジェクト: rizub4u/gpEasy-CMS
 /**
  * Output Javascript code to set variable defaults
  *
  */
 function JsStart()
 {
     //default gpEasy Variables
     echo 'var gplinks={},gpinputs={},gpresponse={}' . ',gpRem=true' . ',isadmin=false' . ',gpBase="' . rtrim(common::GetDir(''), '/') . '"' . ',post_nonce="";';
 }
コード例 #17
0
ファイル: ajax.php プロジェクト: GedionChang/gpEasy-CMS
 static function InlineEdit_Text($scripts)
 {
     includeFile('tool/editing.php');
     // autocomplete
     echo gp_edit::AutoCompleteValues(true);
     // ckeditor basepath and configuration
     $options = array('extraPlugins' => 'sharedspace', 'sharedSpaces' => array('top' => 'ckeditor_top', 'bottom' => ' ckeditor_bottom'));
     $ckeditor_basepath = common::GetDir('/include/thirdparty/ckeditor_34/');
     echo 'CKEDITOR_BASEPATH = ' . gpAjax::quote($ckeditor_basepath) . ';';
     echo 'var gp_ckconfig = ' . gp_edit::CKConfig($options, 'json', $plugins) . ';';
     // extra plugins
     echo 'var gp_add_plugins = ' . json_encode($plugins) . ';';
     // scripts
     $scripts[] = '/include/thirdparty/ckeditor_34/ckeditor.js';
     $scripts[] = '/include/js/ckeditor_config.js';
     $scripts[] = '/include/js/inline_edit/inlineck.js';
     return $scripts;
 }
コード例 #18
0
ファイル: editing.php プロジェクト: rizub4u/gpEasy-CMS
 static function CKConfig($options = array(), $config_name = 'config')
 {
     global $config;
     $defaults = array();
     $defaults['browser'] = true;
     //not actually a ckeditor configuration value, but we're keeping it now for reverse compat
     $defaults['smiley_path'] = common::GetDir('/include/thirdparty/ckeditor_34/plugins/smiley/images/');
     $defaults['customConfig'] = common::GetDir('/include/js/ckeditor_config.js');
     if ($config['langeditor'] == 'inherit') {
         $defaults['language'] = $config['language'];
     } else {
         $defaults['language'] = $config['langeditor'];
     }
     $options += $defaults;
     $values = $config_name . ' = (function(a){';
     //keep for reverse compat;
     if (isset($options['config_text'])) {
         $values .= $options['config_text'];
         unset($options['config_text']);
     }
     //browser paths
     if ($options['browser']) {
         $values .= 'a.filebrowserBrowseUrl = "' . common::GetUrl('Admin_Browser') . '?type=all";';
         $values .= 'a.filebrowserImageBrowseUrl = "' . common::GetUrl('Admin_Browser') . '?dir=%2Fimage";';
         $values .= 'a.filebrowserFlashBrowseUrl = "' . common::GetUrl('Admin_Browser') . '?dir=%2Fflash";';
     }
     unset($options['browser']);
     foreach ($options as $key => $value) {
         if ($value === true) {
             $values .= 'a.' . $key . '=true;';
         } elseif ($value === false) {
             $values .= 'a.' . $key . '=false;';
         } elseif ($value === null) {
             $values .= 'a.' . $key . '=null;';
         } else {
             $values .= 'a.' . $key . '="' . $value . '";';
         }
     }
     $values .= ';return a;})(' . $config_name . ');';
     return $values;
 }
コード例 #19
0
ファイル: admin_tools.php プロジェクト: rizub4u/gpEasy-CMS
 /**
  * Output the link areas that are displayed in the main admin toolbar and admin_main
  * @param bool $in_panel Whether or not the links will be displayed in the toolbar
  * @param array $new_versions Data about newly available versions of gpEasy and addons
  * @static
  */
 function AdminPanelLinks($in_panel = true, $new_versions = array())
 {
     global $langmessage, $page, $gpAdmin, $config;
     $group2 = '<div class="panelgroup2 in_window" %s>';
     //current page
     if ($in_panel && !isset($GLOBALS['GP_ARRANGE_CONTENT'])) {
         echo '<div class="panelgroup" id="current_page_panel">';
         if (!$in_panel) {
             echo '<span>' . $langmessage['Current Page'] . '</span>';
             echo '<div class="panelgroup2">';
         } else {
             echo '<a class="toplink icon_page_gear" name="toplink" rel="cur">';
             echo '<span>' . $langmessage['Current Page'] . '</span>';
             echo '</a>';
             if ($gpAdmin['gpui_vis'] == 'cur') {
                 echo '<div class="panelgroup2 in_window">';
             } else {
                 echo '<div class="panelgroup2 in_window nodisplay">';
             }
         }
         echo '<ul class="submenu">';
         echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['Current Page'] . '</a></li>';
         foreach ($page->admin_links as $label => $link) {
             echo '<li>';
             if (is_array($link)) {
                 echo call_user_func_array(array('common', 'Link'), $link);
                 /* preferred */
             } elseif (is_numeric($label)) {
                 echo $link;
                 //just a text label
             } elseif (empty($link)) {
                 echo '<span>';
                 echo $label;
                 echo '</span>';
             } else {
                 echo '<a href="' . $link . '">';
                 echo $label;
                 echo '</a>';
             }
             echo '</li>';
         }
         echo '<li class="expand_child"><a>' . $langmessage['Editable Areas'] . '</a>';
         echo '<ul class="in_window" id="editable_areas_list">';
         echo '<li><a>empty</a></li>';
         echo '</ul>';
         echo '</li>';
         echo '</ul>';
         echo '</div>';
         echo '</div>';
     }
     //content
     if ($links = admin_tools::GetAdminGroup('content')) {
         echo '<div class="panelgroup">';
         $label = '<span>' . $langmessage['Content'] . '</span>';
         if (!$in_panel) {
             echo '<span class="icon_page">' . $label . '</span>';
             echo '<div class="panelgroup2">';
         } else {
             echo '<a class="toplink icon_page" name="toplink" rel="con">';
             echo $label;
             echo '</a>';
             if ($gpAdmin['gpui_vis'] == 'con') {
                 echo '<div class="panelgroup2 in_window">';
             } else {
                 echo '<div class="panelgroup2 in_window nodisplay">';
             }
         }
         echo '<ul class="submenu">';
         echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['Content'] . '</a></li>';
         echo $links;
         echo '</ul>';
         echo '</div>';
         echo '</div>';
     }
     //appearance
     if ($links = admin_tools::GetAdminGroup('appearance')) {
         echo '<div class="panelgroup">';
         $label = '<span>' . $langmessage['Appearance'] . '</span>';
         if (!$in_panel) {
             echo '<span class="icon_app">' . $label . '</span>';
             echo '<div class="panelgroup2">';
         } else {
             echo '<a class="toplink icon_app" name="toplink" rel="app">';
             echo $label;
             echo '</a>';
             if ($gpAdmin['gpui_vis'] == 'app') {
                 echo '<div class="panelgroup2 in_window">';
             } else {
                 echo '<div class="panelgroup2 in_window nodisplay">';
             }
         }
         echo '<ul class="submenu">';
         echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['Appearance'] . '</a></li>';
         echo $links;
         echo '</ul>';
         echo '</div>';
         echo '</div>';
     }
     //add-ons
     $links = admin_tools::GetAddonLinks($in_panel);
     if (!empty($links)) {
         echo '<div class="panelgroup">';
         $label = '<span>' . $langmessage['plugins'] . '</span>';
         if (!$in_panel) {
             echo '<span class="icon_plug">' . $label . '</span>';
             echo '<div class="panelgroup2">';
         } else {
             echo '<a class="toplink icon_plug" name="toplink" rel="add">';
             echo $label;
             echo '</a>';
             if ($gpAdmin['gpui_vis'] == 'add') {
                 echo '<div class="panelgroup2 in_window">';
             } else {
                 echo '<div class="panelgroup2 in_window nodisplay">';
             }
         }
         echo '<ul class="submenu">';
         echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['plugins'] . '</a></li>';
         echo $links;
         echo '</ul>';
         echo '</div>';
         echo '</div>';
     }
     //settings
     if ($links = admin_tools::GetAdminGroup('settings')) {
         echo '<div class="panelgroup">';
         $label = '<span>' . $langmessage['Settings'] . '</span>';
         if (!$in_panel) {
             echo '<span class="icon_cog">' . $label . '</span>';
             echo '<div class="panelgroup2">';
         } else {
             echo '<a class="toplink icon_cog" name="toplink" rel="set">';
             echo $label;
             echo '</a>';
             if ($gpAdmin['gpui_vis'] == 'set') {
                 echo '<div class="panelgroup2 in_window">';
             } else {
                 echo '<div class="panelgroup2 in_window nodisplay">';
             }
         }
         echo '<ul class="submenu">';
         echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['Settings'] . '</a></li>';
         echo $links;
         echo '</ul>';
         echo '</div>';
         echo '</div>';
     }
     //updates
     if (count($new_versions) > 0) {
         echo '<div class="panelgroup">';
         $label = '<span>' . $langmessage['updates'] . '</span>';
         if (!$in_panel) {
             echo '<span class="icon_rfrsh">' . $label . '</span>';
             echo '<div class="panelgroup2">';
         } else {
             echo '<a class="toplink icon_rfrsh" name="toplink" rel="upd">';
             echo $label;
             echo '</a>';
             if ($gpAdmin['gpui_vis'] == 'upd') {
                 echo '<div class="panelgroup2 in_window">';
             } else {
                 echo '<div class="panelgroup2 in_window nodisplay">';
             }
         }
         echo '<ul class="submenu">';
         echo '<li class="submenu_top"><a class="submenu_top">' . $langmessage['updates'] . '</a></li>';
         if (isset($new_versions['core'])) {
             echo '<li>';
             echo '<a href="' . common::GetDir('/include/install/update.php') . '">gpEasy ' . $new_versions['core'] . '</a>';
             echo '</li>';
         }
         foreach ($new_versions as $addon_id => $new_addon_info) {
             if (!is_numeric($addon_id)) {
                 continue;
             }
             $label = $new_addon_info['name'] . ':  ' . $new_addon_info['version'];
             if ($new_addon_info['type'] == 'theme') {
                 echo '<li>' . common::Link('Admin_Theme_Content', $label, 'cmd=remote') . '</li>';
             } elseif ($new_addon_info['type'] == 'plugin') {
                 echo '<li>' . common::Link('Admin_Addons', $label, 'cmd=remote') . '</li>';
             } else {
                 continue;
             }
         }
         echo '</ul>';
         echo '</div>';
         echo '</div>';
     }
     //username
     echo '<div class="panelgroup">';
     $label = '<span>' . $gpAdmin['username'] . '</span>';
     if (!$in_panel) {
         echo '<span class="icon_user">' . $label . '</span>';
         echo '<div class="panelgroup2">';
     } else {
         echo '<a class="toplink icon_user" name="toplink" rel="use">';
         echo $label;
         echo '</a>';
         if ($gpAdmin['gpui_vis'] == 'use') {
             echo '<div class="panelgroup2 in_window">';
         } else {
             echo '<div class="panelgroup2 in_window nodisplay">';
         }
     }
     echo '<ul class="submenu">';
     echo '<li class="submenu_top"><a class="submenu_top">' . $gpAdmin['username'] . '</a></li>';
     admin_tools::GetFrequentlyUsed($in_panel);
     echo '<li>';
     echo common::Link('Admin_Preferences', $langmessage['Preferences'], '', 'name="gpabox"');
     echo '</li>';
     echo '<li>';
     echo common::Link($page->title, $langmessage['logout'], 'cmd=logout', ' name="creq" ');
     echo '</li>';
     echo '<li>';
     echo common::Link('Admin_About', 'About gpEasy', '', ' name="gpabox" ');
     echo '</li>';
     echo '</ul>';
     echo '</div>';
     echo '</div>';
 }
コード例 #20
0
ファイル: gpOutput.php プロジェクト: rizub4u/gpEasy-CMS
 /**
  * Combine the files in $files into a combine.php request
  * If $page->head_force_inline is true, resources will be included inline in the document
  *
  * @param array $files Array of files relative to $dataDir
  * @param string $type The type of resource being combined
  * @param string $theme_stylesheet The current theme identifier
  *
  */
 function CombineFiles($files, $type, $combine, $theme_stylesheet = false)
 {
     global $page;
     includeFile('combine.php');
     $html = "\n" . '<script type="text/javascript" src="%s" %s></script>';
     if ($type == 'css') {
         $html = "\n" . '<link rel="stylesheet" type="text/css" href="%s" %s/>';
     }
     //option to prevent combining files for debugging
     if (isset($_GET['no_combine']) && common::LoggedIn()) {
         $combine = false;
     }
     $files = array_unique($files);
     $combine_request = array();
     foreach ($files as $file) {
         $id = $file == $theme_stylesheet ? 'id="theme_stylesheet"' : '';
         // Force resources to be included inline
         // CheckFile will fix the $file path if needed
         if ($page->head_force_inline) {
             $full_path = gp_combine::CheckFile($file, false);
             if (!$full_path) {
                 continue;
             }
             echo "\n";
             if ($type == 'css') {
                 echo '<style type="text/css">';
                 readfile($full_path);
                 echo '</style>';
             } else {
                 echo '<script type="text/javascript">/* <![CDATA[ */';
                 readfile($full_path);
                 echo '/* ]]> */</script>';
             }
             continue;
         }
         // Combine multiple resources into one
         // CheckFile will be
         if ($combine) {
             $combine_request[] = $type . '%5B%5D=' . rawurlencode($file);
             continue;
         }
         // Include resources individually
         // CheckFile will fix the $file path if needed
         gp_combine::CheckFile($file, false);
         echo sprintf($html, common::GetDir($file, true), $id);
     }
     if (count($combine_request) == 0) {
         return;
     }
     $id = $type == 'css' ? 'id="theme_stylesheet"' : '';
     $combine_request[] = 'etag=' . gp_combine::GenerateEtag($files);
     $combine_request = implode('&amp;', $combine_request);
     //message('<a href="'.common::GetDir($combine_request).'">combined files: '.$type.'</a>');
     echo sprintf($html, common::GetDir('/include/combine.php', true) . '?' . $combine_request, $id);
 }
コード例 #21
0
 /**
  * Convert array of html attributes into a string for output
  *
  */
 static function SectionAttributes($attrs, $type)
 {
     switch ($type) {
         case 'image':
             $attrs['src'] = common::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;
 }
コード例 #22
0
ファイル: editing_page.php プロジェクト: Bomberus/gpEasy-CMS
 /**
  * Return a list of section types
  * @static
  */
 static function NewSections($checkboxes = false)
 {
     $types_with_imgs = array('text', 'image', 'gallery');
     $section_types = section_content::GetTypes();
     $links = array();
     foreach ($section_types as $type => $type_info) {
         $img = '';
         if (in_array($type, $types_with_imgs)) {
             $img = common::GetDir('/include/imgs/section-' . $type . '.png');
         }
         $links[] = array($type, $img);
     }
     $links[] = array(array('text.gpCol-6', 'image.gpCol-6'), common::GetDir('/include/imgs/section-combo-text-image.png'));
     $links[] = array(array('text.gpCol-6', 'gallery.gpCol-6'), common::GetDir('/include/imgs/section-combo-text-gallery.png'));
     //section combo: text & gallery
     $links = gpPlugin::Filter('NewSections', array($links));
     foreach ($links as $link) {
         $link += array('', '', 'gpRow');
         echo self::NewSectionLink($link[0], $link[1], $link[2], $checkboxes);
     }
 }
コード例 #23
0
ファイル: common.php プロジェクト: Knuzen/gpEasy-CMS
 /**
  * Output Javascript code to set variable defaults
  *
  */
 static function JsStart()
 {
     //default gpEasy Variables
     echo 'var gplinks={},gpinputs={},gpresponse={}' . ',isadmin=false' . ',gpBase="' . rtrim(common::GetDir(''), '/') . '"' . ',post_nonce=""' . ',req_type="' . strtolower(htmlspecialchars($_SERVER['REQUEST_METHOD'])) . '";' . "\n";
 }
コード例 #24
0
ファイル: editing.php プロジェクト: GedionChang/gpEasy-CMS
 /**
  * Display a form for creating a new directory
  *
  */
 function NewDirForm()
 {
     global $langmessage, $page;
     includeFile('admin/admin_uploaded.php');
     ob_start();
     echo '<div class="inline_box">';
     $img = '<img src="' . common::GetDir('/include/imgs/folder.png') . '" height="16" width="16" alt=""/> ';
     echo '<h2>' . $img . $langmessage['create_dir'] . '</h2>';
     echo '<form action="' . common::GetUrl($page->title) . '" method="post" >';
     echo '<p>';
     echo htmlspecialchars($_GET['dir']) . '/';
     echo ' <input type="text" class="gpinput" name="newdir" size="30" />';
     echo '</p>';
     echo '<p>';
     if (!empty($_GET['dir'])) {
         echo ' <input type="hidden" name="dir" value="' . htmlspecialchars($_GET['dir']) . '" />';
     }
     echo '<input type="submit" name="aaa" value="' . $langmessage['create_dir'] . '" class="gp_gallery_folder_add gpsubmit"/>';
     echo ' <input type="submit" name="" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel"/>';
     echo '</p>';
     echo '</form>';
     echo '</div>';
     return ob_get_clean();
 }
コード例 #25
0
ファイル: gpOutput.php プロジェクト: Bomberus/gpEasy-CMS
 /**
  * Handle the processing of multiple less files into css
  *
  * @return mixed Compiled css string or false
  *
  */
 static function ParseLess(&$less_files, $files_hash = false)
 {
     global $dataDir;
     if (!$files_hash) {
         $files_hash = common::ArrayHash($less_files);
     }
     $compiled = false;
     // don't use less if the memory limit is less than 64M
     $limit = @ini_get('memory_limit');
     if ($limit) {
         $limit = common::getByteValue($limit);
         //if less than 64M, disable less compiler if we can't increase
         if ($limit < 67108864 && @ini_set('memory_limit', '96M') === false) {
             if (common::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();
     //$options['compress']			= true;
     /*
     $source_map_file = '/data/_cache/'.$files_hash.'.map';
     $options['sourceMap']			= true;
     $options['sourceMapBasepath']	= $dataDir;
     $options['sourceMapWriteTo']	= $dataDir.$source_map_file;
     $options['sourceMapURL']		= common::GetDir($source_map_file);
     */
     //prepare the compiler
     includeFile('thirdparty/less.php/Less.php');
     $parser = new Less_Parser($options);
     $import_dirs[$dataDir] = common::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 (strpos($less, $dataDir) === false) {
                 $relative = $less;
                 $less = $dataDir . '/' . ltrim($less, '/');
             } else {
                 $relative = substr($less, strlen($dataDir));
             }
             $parser->ParseFile($less, common::GetDir(dirname($relative)));
         }
         $compiled = $parser->getCss();
     } catch (Exception $e) {
         if (common::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;
 }
コード例 #26
0
ファイル: Plugins.php プロジェクト: VTAMAGNO/gpEasy-CMS
 /**
  * Return settings of addon defined by $addon_key
  *
  */
 static function GetAddonConfig($addon_key)
 {
     global $config, $dataDir;
     if (!array_key_exists($addon_key, $config['addons'])) {
         return false;
     }
     $addon_config = $config['addons'][$addon_key];
     if (!is_array($addon_config)) {
         trigger_error('Corrupted configuration for addon: ' . $addon_key);
         //.pre($config['addons']));
         return false;
     }
     $addon_config += array('version' => false, 'id' => false, 'data_folder' => $addon_key, 'order' => false, 'code_folder_part' => '/data/_addoncode/' . $addon_key, 'name' => $addon_key);
     //data folder
     $addon_config['data_folder_part'] = '/data/_addondata/' . $addon_config['data_folder'];
     $addon_config['data_folder_full'] = $dataDir . $addon_config['data_folder_part'];
     $addon_config['data_folder_rel'] = common::GetDir($addon_config['data_folder_part']);
     // Code folder
     //$addon_config['code_folder_part'] = $addon_config['code_folder'].'/'.$addon_key;
     $addon_config['code_folder_full'] = $dataDir . $addon_config['code_folder_part'];
     $addon_config['code_folder_rel'] = common::GetDir($addon_config['code_folder_part']);
     return $addon_config;
 }
コード例 #27
0
ファイル: display.php プロジェクト: jozefkrz/gpEasy-CMS
 /**
  * Set the page's theme name and path information according to the specified $layout
  * If $layout is not found, use the installation's default theme
  *
  */
 function SetTheme($layout = false)
 {
     global $dataDir;
     if ($layout === false) {
         $layout = display::OrConfig($this->gp_index, 'gpLayout');
     }
     $layout_info = common::LayoutInfo($layout);
     if (!$layout_info) {
         $default_theme = explode('/', gp_default_theme);
         $this->gpLayout = false;
         $this->theme_name = $default_theme[0];
         $this->theme_color = $default_theme[1];
         $this->theme_rel = '/themes/' . $this->theme_name . '/' . $this->theme_color;
         $this->theme_dir = $dataDir . '/themes/' . $this->theme_name;
     } else {
         $this->gpLayout = $layout;
         $this->theme_name = $layout_info['theme_name'];
         $this->theme_color = $layout_info['theme_color'];
         $this->theme_rel = $layout_info['path'];
         $this->theme_dir = $layout_info['dir'];
         if (isset($layout_info['addon_id'])) {
             $this->theme_addon_id = $layout_info['addon_id'];
         }
         $this->theme_is_addon = $layout_info['is_addon'];
         //if installed in /themes or /data/_themes
         //css preferences
         if (isset($layout_info['menu_css_ordered']) && !$layout_info['menu_css_ordered']) {
             $this->menu_css_ordered = false;
         }
         if (isset($layout_info['menu_css_indexed']) && !$layout_info['menu_css_indexed']) {
             $this->menu_css_indexed = false;
         }
     }
     $this->theme_path = common::GetDir($this->theme_rel);
 }
コード例 #28
0
 function GenerateOutput()
 {
     global $langmessage, $page;
     common::ShowingGallery();
     echo '<h2>';
     echo gpOutput::ReturnText('galleries');
     echo '</h2>';
     includeFile('admin/admin_tools.php');
     $wrap = admin_tools::CanEdit($page->gp_index);
     if ($wrap) {
         echo gpOutput::EditAreaLink($edit_index, 'Special_Galleries', $langmessage['edit'], 'cmd=edit');
         echo '<div class="editable_area cf" id="ExtraEditArea' . $edit_index . '">';
         // class="edit_area" added by javascript
     }
     $image_text = gpOutput::ReturnText('image');
     $images_text = gpOutput::ReturnText('images');
     $list = '';
     $shown = 0;
     foreach ($this->galleries as $title => $info) {
         //page is hidden
         if (!$this->GalleryVisible($title, $info)) {
             continue;
         }
         $count = '';
         if (is_array($info)) {
             $icon = $info['icon'];
             if ($info['count'] == 1) {
                 $count = $info['count'] . ' ' . gpOutput::ReturnText('image');
             } elseif ($info['count'] > 1) {
                 $count = $info['count'] . ' ' . gpOutput::ReturnText('images');
             }
         } else {
             $icon = $info;
         }
         if (empty($icon)) {
             continue;
         }
         if (strpos($icon, '/thumbnails/') === false) {
             $thumbPath = common::GetDir('/data/_uploaded/image/thumbnails' . $icon . '.jpg');
         } else {
             $thumbPath = common::GetDir('/data/_uploaded' . $icon);
         }
         $label = common::GetLabel($title);
         $title_attr = ' title="' . common::GetBrowserTitle($title) . '"';
         $label_img = ' <img src="' . $thumbPath . '" alt=""/>';
         $list .= '<li>' . common::Link($title, $label_img, '', $title_attr) . '<div>' . common::Link($title, $label, '', $title_attr) . '<p>' . $count . '</p>' . '</div>' . '</li>';
     }
     if (!empty($list)) {
         echo '<ul class="gp_gallery gp_galleries">';
         echo $list;
         echo '</ul>';
     }
     if ($wrap) {
         echo '</div>';
     }
     $this->PostSave();
 }
コード例 #29
0
 /**
  * Show images available in themes
  *
  */
 function ShowThemeImages()
 {
     global $page, $langmessage, $dirPrefix;
     $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 = common::GetDir($current_info['rel']);
         //current layout
     } else {
         $layout_info = common::LayoutInfo($this->curr_layout, false);
         $current_label = $layout_info['theme_name'];
         $current_dir = $layout_info['dir'];
         $current_url = common::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) {
         echo common::Link('Admin_Theme_Content/' . rawurlencode($this->curr_layout), '<span class="folder"></span>' . $info['name'], 'cmd=theme_images&theme=' . rawurlencode($theme_id), ' data-cmd="gpajax" class="gp_gallery_folder" ');
     }
     echo '</div>';
     echo '</div>';
     $gp_option_area = ob_get_clean();
     //images in theme
     includeFile('tool/Images.php');
     $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) {
         $page->ajaxReplace[] = array('inner', '#gp_option_area', $gp_option_area);
         $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>';
         $page->ajaxReplace[] = array('inner', '#gp_image_area', $content);
     }
     $page->ajaxReplace[] = array('inner', '#gp_folder_options', '');
     //remove upload button
 }
コード例 #30
0
 function RateForm()
 {
     global $config, $dirPrefix;
     //get appropriate variables
     $id = $this->addon_info['id'];
     if (isset($_REQUEST['rating'])) {
         $rating = $_REQUEST['rating'];
     } elseif (isset($this->addonReviews[$id])) {
         $rating = $this->addonReviews[$id]['rating'];
     } else {
         $rating = 5;
     }
     if (isset($_REQUEST['review'])) {
         $review = $_REQUEST['review'];
     } elseif (isset($this->addonReviews[$id])) {
         $review = $this->addonReviews[$id]['review'];
     } else {
         $review = '';
     }
     echo '<h2>';
     echo $this->addon_info['name'] . ' &#187; ' . 'Rate';
     echo '</h2>';
     if (isset($this->addonReviews[$id])) {
         echo 'You posted the following review on ' . date('M j, Y', $this->addonReviews[$id]['time']);
     }
     echo '<form action="' . common::GetUrl($this->scriptUrl, 'cmd=rate&arg=' . $this->addon_info['pass_arg']) . '" method="post">';
     echo '<table cellpadding="7">';
     echo '<tr>';
     echo '<td>';
     echo 'Rating';
     echo '</td>';
     echo '<td>';
     echo '<span class="rating">';
     $label = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="16">';
     echo '<a href="javascript:void(0);" rel="1">' . $label . '</a>';
     $label = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="16">';
     echo '<a href="javascript:void(0);" rel="2">' . $label . '</a>';
     $label = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="16">';
     echo '<a href="javascript:void(0);" rel="3">' . $label . '</a>';
     $label = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="16">';
     echo '<a href="javascript:void(0);" rel="4">' . $label . '</a>';
     $label = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="16">';
     echo '<a href="javascript:void(0);" rel="5">' . $label . '</a>';
     echo '<input type="hidden" name="rating" value="' . htmlspecialchars($rating) . '" />';
     echo '</span> ';
     echo '</td>';
     echo '</tr>';
     echo '<tr>';
     echo '<td>Review</td>';
     echo '<td>';
     echo '<textarea name="review" cols="50" rows="7" class="gptextarea">';
     echo htmlspecialchars($review);
     echo '</textarea>';
     echo '</td>';
     echo '</tr>';
     echo '<tr>';
     echo '<td>From</td>';
     echo '<td>';
     $host = $_SERVER['HTTP_HOST'] . $dirPrefix;
     echo '<input type="text" name="host"  size="50" value="' . htmlspecialchars($host) . '" readonly="readonly" class="gpinput gpreadonly" />';
     echo '<br/>';
     echo '<input type="checkbox" name="show_site" value="hidden" /> Click to hide your site information on gpEasy.com.';
     echo '</td>';
     echo '</tr>';
     echo '<tr>';
     echo '<td>';
     echo '</td>';
     echo '<td>';
     if (isset($this->addonReviews[$id])) {
         echo '<input type="submit" name="cmd" value="Update Review" class="gpsubmit"/>';
     } else {
         echo '<input type="submit" name="cmd" value="Send Review" class="gpsubmit"/>';
     }
     echo ' ';
     echo '<input type="submit" name="cmd" value="Cancel" class="gpcancel"/>';
     echo '</td>';
     echo '</tr>';
     echo '</table>';
     echo '</form>';
     return true;
 }