Ejemplo n.º 1
0
 function Example_Ajax()
 {
     global $page, $addonRelativeCode;
     //prepare the page
     $page->head_js[] = $addonRelativeCode . 'static/02_script.js';
     $page->admin_js = true;
     //get request parameters and execute any commands
     $string = '';
     if (isset($_REQUEST['string'])) {
         $string = $_REQUEST['string'];
     }
     $cmd = common::GetCommand();
     switch ($cmd) {
         case 'randomstring':
             $string = common::RandomString(10);
             break;
     }
     //display the form
     echo '<h2>Example Ajax Requests</h2>';
     echo '<form method="post" action="' . $page->title . '">';
     echo 'Text: <input type="text" name="string" value="' . htmlspecialchars($string) . '" size="30" />';
     echo ' <input type="submit" class="gpajax" value="Post Form Asynchronosly" /> ';
     echo common::Link($page->title, 'Get Random String', 'cmd=randomstring', 'name="gpajax"');
     echo '</form>';
     //output the $_REQUEST variable
     echo '<h3>Request</h3>';
     echo showArray($_REQUEST);
     //plugin example navigation
     gpPlugin::incl('navigation.php');
     PluginExampleNavigation();
 }
Ejemplo n.º 2
0
 /**
  * Get The Image
  *
  */
 public function Child($title)
 {
     global $dirPrefix;
     $content = $this->TitleContent($title);
     $img_pos = strpos($content, '<img');
     if ($img_pos === false) {
         return;
     }
     $src_pos = strpos($content, 'src=', $img_pos);
     if ($src_pos === false) {
         return;
     }
     $src = substr($content, $src_pos + 4);
     $quote = $src[0];
     if ($quote != '"' && $quote != "'") {
         return;
     }
     $src_pos = strpos($src, $quote, 1);
     $src = substr($src, 1, $src_pos - 1);
     // check for resized image, get original source if img is resized
     if (strpos($src, 'image.php') !== false && strpos($src, 'img=') !== false) {
         $src = $dirPrefix . '/data/_uploaded/' . urldecode(substr($src, strpos($src, 'img=') + 4));
     }
     $thumb_path = common::ThumbnailPath($src);
     echo '<li>';
     echo '<img src="' . $thumb_path . '"/>';
     $label = common::GetLabel($title);
     echo common::Link($title, $label);
     echo '</li>';
 }
Ejemplo n.º 3
0
 /**
  *  Print all categories and their contents on gadget
  *
  */
 function Run()
 {
     echo '<div class="simple_blog_gadget"><div>';
     echo '<span class="simple_blog_gadget_label">';
     echo gpOutput::GetAddonText('Categories');
     echo '</span>';
     echo '<ul>';
     foreach ($this->categories as $catdata) {
         if (!$catdata['visible']) {
             continue;
             //skip hidden categories
         }
         echo '<li>';
         $sum = count($catdata['posts']);
         echo '<a class="blog_gadget_link">' . $catdata['ct'] . ' (' . $sum . ')</a>';
         if ($sum) {
             echo '<ul class="nodisplay">';
             foreach ($catdata['posts'] as $post_index => $post_title) {
                 echo '<li>';
                 echo common::Link('Special_Blog', $post_title, 'id=' . $post_index);
                 echo '</li>';
             }
             echo '</ul>';
         }
         echo '</li>';
     }
     echo '</ul>';
     echo '</div></div>';
 }
Ejemplo n.º 4
0
 function Special_Example()
 {
     echo '<h2>This is a Special Script</h2>';
     echo '<p>This is an example of a gpEasy Addon in the form of a Special page.</p>';
     echo '<p>Special pages can be used to add more than just content to a gpEasy installation. </p>';
     echo '<p>';
     echo common::Link('Admin_Example', 'An Example Link');
     echo '</p>';
     echo '<p>You can download <a href="http://gpeasy.com/Special_Addon_Plugins?id=160">a plugin with addtional examples</a> from gpEasy.com </p>';
 }
Ejemplo n.º 5
0
 function __construct()
 {
     echo '<h2>This is an Admin Only Script</h2>';
     echo '<p>This is an example of a gpEasy Addon in the form of a Admin page.</p>';
     echo '<p>Admin pages are only accessible to users with appropriate permissions on your installation of gpEasy. </p>';
     echo '<p>';
     echo \common::Link('Special_Example', 'An Example Link');
     echo '</p>';
     echo '<p>You can download <a href="http://gpeasy.com/Special_Addon_Plugins?id=160">a plugin with addtional examples</a> from gpEasy.com </p>';
 }
Ejemplo n.º 6
0
 /**
  * Show files in the cache
  *
  */
 function ShowFiles()
 {
     global $page, $langmessage;
     $page->head_js[] = '/include/thirdparty/tablesorter/tablesorter.js';
     $page->jQueryCode .= '$("table.tablesorter").tablesorter({cssHeader:"gp_header",cssAsc:"gp_header_asc",cssDesc:"gp_header_desc"});';
     if (!$this->all_files) {
         return;
     }
     echo '<p>';
     echo common::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 admin_tools::FormatBytes($size);
         $total_size += $size;
         echo '</td><td>';
         $elapsed = admin_tools::Elapsed(time() - filemtime($full));
         echo sprintf($langmessage['_ago'], $elapsed);
         echo '</td><td>';
         echo common::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 admin_tools::FormatBytes($total_size);
     echo '</td><td>';
     echo '</tr>';
     echo '</table>';
 }
Ejemplo n.º 7
0
 function RunScript()
 {
     global $gp_index, $langmessage, $page;
     $scriptinfo = special_display::GetScriptInfo($this->requested);
     if ($scriptinfo === false) {
         switch ($this->requested) {
             case 'Special_ExtraJS':
                 $this->ExtraJS();
                 //dies
         }
         $this->Error_404($this->title);
         return;
     }
     $this->gp_index = $gp_index[$this->requested];
     $this->label = common::GetLabel($this->requested);
     $this->TitleInfo = $scriptinfo;
     $menu_permissions = false;
     if (common::LoggedIn()) {
         $menu_permissions = admin_tools::HasPermission('Admin_Menu');
         if ($menu_permissions) {
             $page->admin_links[] = common::Link($this->title, $langmessage['rename/details'], 'cmd=renameform', ' name="gpajax" ');
             $page->admin_links[] = common::Link('Admin_Menu', $langmessage['current_layout'], 'cmd=layout&from=page&index=' . urlencode($this->gp_index), ' title="' . $langmessage['current_layout'] . '" name="gpabox"');
         }
         if (admin_tools::HasPermission('Admin_User')) {
             $page->admin_links[] = common::Link('Admin_Users', $langmessage['permissions'], 'cmd=file_permissions&index=' . urlencode($this->gp_index), ' title="' . $langmessage['permissions'] . '" name="gpabox" ');
         }
     }
     //allow addons to affect page actions and how a page is displayed
     $cmd = common::GetCommand();
     $cmd_after = gpPlugin::Filter('PageRunScript', array($cmd));
     if ($cmd !== $cmd_after) {
         $cmd = $cmd_after;
         if ($cmd === 'return') {
             return;
         }
     }
     if ($menu_permissions) {
         switch ($cmd) {
             // rename & details
             case 'renameform':
                 $this->RenameForm();
                 return;
             case 'renameit':
                 if ($this->RenameFile()) {
                     return;
                 }
                 break;
         }
     }
     $this->contentBuffer = special_display::ExecInfo($scriptinfo);
 }
Ejemplo n.º 8
0
 /**
  * Add multi language elements to the $page
  *
  */
 public function AddResources()
 {
     global $page, $addonRelativeCode;
     static $added = false;
     if ($added) {
         return;
     }
     if ($page->pagetype == 'display') {
         $page->admin_links[] = common::Link('Admin_MultiLang', 'Multi Language', 'cmd=TitleSettings&index=' . $page->gp_index, ' name="gpabox"');
     }
     $page->head_js[] = $addonRelativeCode . '/script.js';
     //needed for admin pages as well
     $page->css_admin[] = $addonRelativeCode . '/admin.css';
     $added = true;
 }
Ejemplo n.º 9
0
 function AdminProtect()
 {
     global $gp_menu;
     $this->PageProtect();
     echo '<h2>';
     echo common::Link('Admin_Protect', 'Protected Pages');
     echo '</h2>';
     $cmd = common::GetCommand();
     switch ($cmd) {
         case 'savecontent':
             $this->SaveContent();
         case 'editcontent':
             $this->EditContent();
             return;
     }
     echo '<p>';
     echo '<b>' . common::Link('Admin_Protect', 'Protected Content', 'cmd=editcontent') . '</b> ';
     echo 'Edit the content users will see if they navigate to a protected page and aren\'t logged in.';
     echo '</p>';
     if (!count($this->config['pages'])) {
         echo '<p>There aren\'t any protected pages.</p>';
         return;
     }
     echo '<table class="bordered">';
     echo '<tr><th>Pages</th><th>Child Pages</th></tr>';
     foreach ($this->config['pages'] as $page_index => $bool) {
         $title = common::IndexToTitle($page_index);
         //may be deleted
         if (!$title) {
             continue;
         }
         echo '<tr>';
         echo '<td>';
         echo common::Link_Page($title);
         echo '</td>';
         echo '<td>';
         $affected = common::Descendants($page_index, $gp_menu);
         $titles = array();
         foreach ($affected as $temp_index) {
             $title = common::IndexToTitle($temp_index);
             $titles[] = common::Link_Page($title);
         }
         echo implode(', ', $titles);
         echo '</td>';
         echo '</tr>';
     }
     echo '</table>';
 }
Ejemplo n.º 10
0
 function ShowRating($arg, $rating)
 {
     echo '<span class="rating">';
     $label = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="16"/>';
     echo common::Link($this->scriptUrl, $label, 'cmd=rate&rating=1&arg=' . $arg, ' rel="1" ');
     $label = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="16"/>';
     echo common::Link($this->scriptUrl, $label, 'cmd=rate&rating=2&arg=' . $arg, ' rel="2" ');
     $label = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="16"/>';
     echo common::Link($this->scriptUrl, $label, 'cmd=rate&rating=3&arg=' . $arg, ' rel="3" ');
     $label = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="16"/>';
     echo common::Link($this->scriptUrl, $label, 'cmd=rate&rating=4&arg=' . $arg, ' rel="4" ');
     $label = '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" alt="" border="0" height="16" width="16"/>';
     echo common::Link($this->scriptUrl, $label, 'cmd=rate&rating=5&arg=' . $arg, ' rel="5" ');
     echo '<input type="hidden" name="rating" value="' . htmlspecialchars($rating) . '" readonly="readonly"/>';
     echo '</span> ';
 }
Ejemplo n.º 11
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
}
Ejemplo n.º 12
0
function PluginExampleNavigation()
{
    global $page;
    $examples = array();
    $examples['special_example_map'] = 'Google Map Example with Directions';
    $examples['special_example_ajax'] = 'Asynchronous Form Submission and Page Loading';
    echo '<h3>All Examples</h3>';
    echo '<ol>';
    foreach ($examples as $slug => $label) {
        if ($page->gp_index == $slug) {
            echo '<li><b>' . $label . '</b></li>';
        } else {
            echo '<li>' . common::Link($slug, $label) . '</li>';
        }
    }
    echo '</ol>';
}
Ejemplo n.º 13
0
 /**
  * Get The Image
  *
  */
 function Child($title)
 {
     global $dirPrefix;
     $file = gpFiles::PageFile($title);
     $file_sections = $file_stats = array();
     ob_start();
     require $file;
     ob_get_clean();
     if (!is_array($file_sections)) {
         return;
     }
     //get the image
     $content = section_content::Render($file_sections, $title, $file_stats);
     $img_pos = strpos($content, '<img');
     if ($img_pos === false) {
         return;
     }
     $src_pos = strpos($content, 'src=', $img_pos);
     if ($src_pos === false) {
         return;
     }
     $src = substr($content, $src_pos + 4);
     $quote = $src[0];
     if ($quote != '"' && $quote != "'") {
         return;
     }
     $src_pos = strpos($src, $quote, 1);
     $src = substr($src, 1, $src_pos - 1);
     // check for resized image, get original source if img is resized
     if (strpos($src, 'image.php') !== false && strpos($src, 'img=') !== false) {
         $src = $dirPrefix . '/data/_uploaded/' . urldecode(substr($src, strpos($src, 'img=') + 4));
     }
     $thumb_path = common::ThumbnailPath($src);
     $img_pos2 = strpos($content, '>', $img_pos);
     $img = substr($content, $img_pos, $img_pos2 - $img_pos + 1);
     echo '<li>';
     echo '<img src="' . $thumb_path . '"/>';
     //echo $img;
     $label = common::GetLabel($title);
     echo common::Link($title, $label);
     echo '</li>';
 }
Ejemplo n.º 14
0
 function special_map()
 {
     global $page, $langmessage, $config;
     /*
     An xml site map will not show any of the pages from dynamic add-ons
     ... which is precisely what the regular sitemap shows
     */
     if (isset($_GET['xml'])) {
         $this->xml();
         return;
     }
     $this->MultiSiteData();
     echo '<div class="sitemap_xml">';
     echo common::Link('Special_Site_Map', 'XML', 'xml');
     echo '</div>';
     echo '<h2>';
     echo gpOutput::ReturnText('site_map');
     echo '</h2>';
     gpOutput::GetFullMenu();
 }
Ejemplo n.º 15
0
 /**
  * @param string $current
  */
 function Heading($current)
 {
     global $langmessage;
     $options = array('Admin_Blog' => 'Posts', 'Admin_BlogConfig' => $langmessage['configuration'], 'Admin_BlogCategories' => 'Categories', 'Admin_BlogComments' => gpOutput::SelectText('Comments'));
     $links = array();
     foreach ($options as $slug => $label) {
         if ($slug == $current) {
             $links[] = $label;
         } else {
             $links[] = common::Link($slug, $label);
         }
     }
     echo common::Link('Admin_Blog', 'New Blog Post', 'cmd=new_form', ' class="gpsubmit" style="float:right"');
     echo '<h2 class="hmargin">';
     $label = gpOutput::SelectText('Blog');
     echo common::Link('Special_Blog', $label);
     echo ' &#187; ';
     echo implode('<span>|</span>', $links);
     echo '</h2>';
 }
Ejemplo n.º 16
0
 /**
  *  Print all archives and their contents on gadget
  *
  */
 function Run()
 {
     if (!count($this->archives)) {
         return;
     }
     echo '<div class="simple_blog_gadget"><div>';
     echo '<span class="simple_blog_gadget_label">';
     echo gpOutput::GetAddonText('Archives');
     echo '</span>';
     $prev_year = false;
     echo '<ul>';
     foreach ($this->archives as $ym => $posts) {
         $y = floor($ym / 100);
         $m = $ym % 100;
         if ($y != $prev_year) {
             if ($prev_year !== false) {
                 echo '</li>';
             }
             echo '<li><div class="simple_blog_gadget_year">' . $y . '</div>';
             $prev_year = $y;
         }
         $sum = count($posts);
         if (!$sum) {
             continue;
         }
         echo '<ul>';
         echo '<li><a class="blog_gadget_link">' . $this->months[$m - 1] . ' (' . $sum . ')</a>';
         echo '<ul class="simple_blog_category_posts nodisplay">';
         foreach ($posts as $post_index => $post_title) {
             echo '<li>';
             echo common::Link('Special_Blog', $post_title, 'id=' . $post_index);
             echo '</li>';
         }
         echo '</ul>';
         echo '</li>';
         echo '</ul>';
     }
     echo '</li></ul>';
     echo '</div></div>';
 }
Ejemplo n.º 17
0
 function OutputComment($comment)
 {
     global $langmessage;
     echo '<tr><td class="user_submitted">';
     echo '<b>' . $comment['name'] . '</b>';
     echo '<p>';
     echo $comment['comment'];
     echo '</p>';
     echo '</td><td>';
     //echo strftime(SimpleBlogCommon::$data['strftime_format'],$comment['time']);
     echo strftime("%Y-%m-%d %H:%M:%S", $comment['time']);
     echo '<br/>';
     if (SimpleBlogCommon::$data['commenter_website'] == 'nofollow' && !empty($comment['website'])) {
         echo '<a href="' . $comment['website'] . '" rel="nofollow">' . $comment['website'] . '</a>';
     } elseif (SimpleBlogCommon::$data['commenter_website'] == 'link' && !empty($comment['website'])) {
         echo '<a href="' . $comment['website'] . '">' . $comment['website'] . '</a>';
     }
     echo '</td><td>';
     echo SimpleBlogCommon::PostLink($comment['post_id'], 'View&nbsp;Post');
     echo ' &nbsp; ';
     echo common::Link('Admin_BlogComments', $langmessage['delete'], 'cmd=delete_comment&id=' . $comment['post_id'] . '&comment_time=' . $comment['time'], array('name' => 'postlink', 'class' => 'gpconfirm', 'title' => $langmessage['delete_confirm']));
     echo '</td></tr>';
 }
Ejemplo n.º 18
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>';
 }
Ejemplo n.º 19
0
 function Installed()
 {
     global $langmessage;
     echo '<h4>' . $langmessage['Installation_Was_Successfull'] . '</h4>';
     echo '<h2>';
     echo common::Link('', $langmessage['View_your_web_site']);
     echo '</h2>';
     echo '</ul>';
     echo '<p>';
     echo 'For added security, you may delete the /include/install/install.php file from your server.';
     echo '</p>';
 }
Ejemplo n.º 20
0
 /**
  * Display the permission options for a file
  *
  */
 function FilePermissions()
 {
     global $gp_titles, $langmessage;
     $indexes = $this->RequestedIndexes();
     if (!$indexes) {
         return;
     }
     $count = count($indexes);
     $first_index = $indexes[0];
     echo '<div class="inline_box">';
     echo '<form action="' . common::GetUrl('Admin_Users') . '" method="post">';
     echo '<input type="hidden" name="cmd" value="save_file_permissions">';
     echo '<input type="hidden" name="index" value="' . htmlspecialchars($_REQUEST['index']) . '">';
     //heading
     echo '<h2>' . common::Link('Admin_Users', $langmessage['user_permissions']) . ' &#187; <i>';
     if ($count > 1) {
         echo sprintf($langmessage['%s Pages'], $count);
     } else {
         echo strip_tags(common::GetLabelIndex($indexes[0]));
     }
     echo '</i></h2>';
     //list of files
     if ($count > 1) {
         $labels = array();
         foreach ($indexes as $index) {
             $labels[] = strip_tags(common::GetLabelIndex($index));
         }
         echo '<p>';
         echo implode(', ', $labels);
         echo '</p>';
     }
     //list of users
     echo '<div class="all_checkboxes">';
     foreach ($this->users as $username => $userinfo) {
         $attr = '';
         if ($userinfo['editing'] == 'all') {
             $attr = ' checked="checked" disabled="disabled"';
         } elseif (strpos($userinfo['editing'], ',' . $first_index . ',') !== false) {
             $attr = ' checked="checked"';
         }
         echo '<label class="all_checkbox">';
         echo '<input type="checkbox" name="users[' . htmlspecialchars($username) . ']" value="' . htmlspecialchars($username) . '" ' . $attr . '/>';
         echo $username;
         echo '</label> ';
     }
     echo '</div>';
     echo '<p>';
     echo '<input type="submit" name="aaa" value="' . $langmessage['save'] . '" class="gpabox gpsubmit" />';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</p>';
     echo '</form>';
     echo '</div>';
 }
Ejemplo n.º 21
0
 function SearchDisplay()
 {
     global $langmessage, $gpLayouts, $gp_index, $gp_menu;
     $Inherit_Info = admin_menu_tools::Inheritance_Info();
     switch ($this->curr_menu_id) {
         case 'search':
             $show_list = $this->GetSearchList();
             break;
         case 'all':
             $show_list = array_keys($gp_index);
             break;
         case 'hidden':
             $show_list = $this->GetAvailable();
             break;
         case 'nomenus':
             $show_list = $this->GetNoMenus();
             break;
     }
     $show_list = array_values($show_list);
     //to reset the keys
     $show_list = array_reverse($show_list);
     //show newest first
     $max = count($show_list);
     while ($this->search_page * $this->search_max_per_page > $max) {
         $this->search_page--;
     }
     $start = $this->search_page * $this->search_max_per_page;
     $stop = min(($this->search_page + 1) * $this->search_max_per_page, $max);
     ob_start();
     echo '<div class="gp_search_links">';
     echo '<span class="showing">';
     echo sprintf($langmessage['SHOWING'], $start + 1, $stop, $max);
     echo '</span>';
     if ($start !== 0 || $stop < $max) {
         for ($i = 0; $i * $this->search_max_per_page < $max; $i++) {
             $class = '';
             if ($i == $this->search_page) {
                 $class = ' class="current"';
             }
             echo $this->Link('Admin_Menu', $i + 1, 'page=' . $i, 'name="gpajax"' . $class);
         }
     }
     echo $this->Link('Admin_Menu', $langmessage['create_new_file'], 'cmd=add_hidden', ' title="' . $langmessage['create_new_file'] . '" name="gpajax"');
     echo '</div>';
     $links = ob_get_clean();
     echo $links;
     echo '<table class="bordered">';
     echo '<thead>';
     echo '<tr><th>';
     echo $langmessage['file_name'];
     echo '</th><th>';
     echo $langmessage['Child Pages'];
     echo '</th>';
     echo '</tr>';
     echo '</thead>';
     echo '<tbody>';
     if (count($show_list) > 0) {
         for ($i = $start; $i < $stop; $i++) {
             $title = $show_list[$i];
             $title_index = $gp_index[$title];
             echo '<tr><td>';
             $label = common::GetLabel($title);
             echo common::Link($title, common::LabelSpecialChars($label));
             //area only display on mouseover
             echo '<div>';
             echo '<b>Options:</b>';
             $img = '<span class="menu_icon page_edit_icon"></span>';
             echo $this->Link('Admin_Menu', $img . $langmessage['rename/details'], 'cmd=renameform&title=' . urlencode($title), ' title="' . $langmessage['rename/details'] . '" name="gpajax" ');
             $img = '<span class="menu_icon copy_icon"></span>';
             echo $this->Link('Admin_Menu', $img . $langmessage['Copy'], 'cmd=copypage&title=' . urlencode($title), ' title="' . $langmessage['Copy'] . '" name="gpabox"');
             $layout = admin_menu_tools::CurrentLayout($title_index);
             $layout_info = $gpLayouts[$layout];
             $img = '<span style="background-color:' . $layout_info['color'] . ';" class="layout_icon"></span>';
             echo $this->Link('Admin_Menu', $img . $layout_info['label'], 'cmd=layout&index=' . urlencode($title_index), ' title="' . $langmessage['layout'] . '" name="gpabox"');
             $is_special = common::SpecialOrAdmin($title);
             if (!$is_special) {
                 $img = '<span class="menu_icon bin_icon"></span>';
                 echo $this->Link('Admin_Menu', $img . $langmessage['delete'], 'cmd=trash&index=' . urlencode($title_index), ' title="' . $langmessage['delete_page'] . '" name="menupost" class="gpconfirm" ');
             }
             gpPlugin::Action('MenuPageOptions', array($title, $title_index, false, $layout_info));
             //stats
             echo '<br/>';
             echo '<b>' . $langmessage['Page Info'] . ':</b>';
             $this->FileStats($title_index, $title, $is_special);
             echo '</div>';
             echo '</td><td>';
             if (isset($Inherit_Info[$title_index]) && isset($Inherit_Info[$title_index]['children'])) {
                 echo $Inherit_Info[$title_index]['children'];
             } elseif (isset($gp_menu[$title_index])) {
                 echo '0';
             } else {
                 echo $langmessage['Not In Main Menu'];
             }
             echo '</td></tr>';
         }
     }
     echo '</tbody>';
     echo '</table>';
     if (count($show_list) == 0) {
         echo '<p>';
         echo $langmessage['Empty'];
         echo '</p>';
     }
     echo '<br/>';
     echo $links;
 }
Ejemplo n.º 22
0
 function LayoutLink($layout, $label, $query, $attr)
 {
     $url = $this->LayoutUrl($layout, $query);
     return common::Link($url, $label, $query, $attr);
 }
Ejemplo n.º 23
0
 /**
  * Return a formatted list of links associated with $addon
  * @return string
  */
 static function GetAddonSubLinks($addon = false)
 {
     global $config;
     $special_links = admin_tools::GetAddonTitles($addon);
     $admin_links = admin_tools::GetAddonComponents($config['admin_links'], $addon);
     $result = '';
     foreach ($special_links as $linkName => $linkInfo) {
         $result .= '<li>';
         $result .= common::Link($linkName, $linkInfo['label']);
         $result .= '</li>';
     }
     foreach ($admin_links as $linkName => $linkInfo) {
         if (admin_tools::HasPermission($linkName)) {
             $result .= '<li>';
             $result .= common::Link($linkName, $linkInfo['label']);
             $result .= '</li>';
         }
     }
     return $result;
 }
Ejemplo n.º 24
0
 function showForm()
 {
     global $langmessage;
     $possible_values = $this->getPossible();
     $array = $this->getValues();
     echo '<form action="' . common::GetUrl('Admin_Configuration') . '" method="post">';
     echo '<div class="collapsible">';
     //order by the possible values
     $openbody = false;
     foreach ($possible_values as $key => $possible_value) {
         if ($possible_value === false) {
             $class = $style = '';
             if ($openbody) {
                 echo '</table>';
                 echo '</div>';
                 $class = ' gp_collapsed';
                 $style = ' nodisplay';
             }
             echo '<h4 class="head' . $class . ' one">';
             echo '<a data-cmd="collapsible">';
             if (isset($langmessage[$key])) {
                 echo $langmessage[$key];
             } else {
                 echo str_replace('_', ' ', $key);
             }
             echo '</a>';
             echo '</h4>';
             //start new
             echo '<div class="collapsearea' . $style . '">';
             echo '<table class="bordered configuration">';
             $openbody = true;
             continue;
         }
         if (isset($array[$key])) {
             $value = $array[$key];
         } else {
             $value = '';
         }
         echo "\n\n";
         echo '<tr><td style="white-space:nowrap">';
         if (isset($langmessage[$key])) {
             echo $langmessage[$key];
         } else {
             echo str_replace('_', ' ', $key);
         }
         echo '</td>';
         echo '<td>';
         if (is_array($possible_value)) {
             self::formSelect($key, $possible_value, $value);
         } else {
             switch ($possible_value) {
                 case 'boolean':
                     $this->formCheckbox($key, $value);
                     break;
                 case 'textarea':
                     $this->formTextarea($key, $value);
                     break;
                 default:
                     $this->formInput($key, $value, $possible_value);
                     break;
             }
         }
         if (isset($langmessage['about_config'][$key])) {
             echo $langmessage['about_config'][$key];
         }
         echo '</td></tr>';
     }
     echo '</table>';
     echo '</div>';
     echo '</div>';
     //end collapsible
     echo '<div style="margin:1em 0">';
     echo '<input type="hidden" name="cmd" value="save_config" />';
     if (isset($_GET['gpreq']) && $_GET['gpreq'] == 'json') {
         echo '<input value="' . $langmessage['save'] . '" type="submit" name="aaa" accesskey="s" class="gppost gpsubmit" />';
     } else {
         echo '<input value="' . $langmessage['save'] . '" type="submit" name="aaa" accesskey="s" class="gpsubmit"/>';
     }
     echo ' <input type="button" class="admin_box_close gpcancel" name="" value="' . $langmessage['cancel'] . '" />';
     echo '</div>';
     echo '<p class="admin_note">';
     echo '<b>';
     echo $langmessage['see_also'];
     echo '</b> ';
     echo common::Link('Admin_Preferences', $langmessage['Preferences'], '', 'data-cmd="gpabox"');
     echo '</p>';
     echo '</form>';
 }
Ejemplo n.º 25
0
 function ShowOptions()
 {
     //$pagedata=self::LoadData();
     global $page, $config, $langmessage, $addonRelativeCode, $dirPrefix, $dataDir;
     if (!isset($_REQUEST['index'])) {
         msg($langmessage['OOPS'] . ' - no index passed!');
     }
     $index = $_REQUEST['index'];
     echo '<div class="inline_box">';
     echo '<form id="menu_appearance_form" action="' . common::GetUrl('Admin_Menu') . '" method="post">';
     echo '<input type="hidden" name="cmd" value="menu_ec_save" />';
     echo '<input type="hidden" name="index" value="' . $index . '" />';
     $temp = new Catalog_Easy();
     $temp->getConfig();
     //omg lazy to change
     if (array_key_exists($index, $temp->pagedata)) {
         if (array_key_exists('image_url', $temp->pagedata[$index])) {
             if ($temp->pagedata[$index]['image_url'] != "") {
                 $image_url = urldecode($temp->pagedata[$index]['image_url']);
             } else {
                 $image_url = $addonRelativeCode . '/img/default_thumb.jpg';
             }
         } else {
             $image_url = $addonRelativeCode . '/img/default_thumb.jpg';
         }
     } else {
         $image_url = $addonRelativeCode . '/img/default_thumb.jpg';
     }
     echo '<h3>';
     echo 'Catalog Easy';
     echo '</h3>';
     //img
     echo '<p>Image for page to display in Easy Catalog <br>(if not set, first image from page content will be used)</p>';
     echo '<div id="img_container">';
     echo '<img style="width:100px;" src="' . $image_url . '"/>';
     echo '<img id="del_img_EC" style="cursor:pointer;" src="' . $addonRelativeCode . '/img/delete.png' . '" />';
     echo '</div>';
     echo '<p>';
     echo ' <button class="EC_browse_files gpbutton">' . $langmessage['Select Image'] . '</button>';
     echo '</p>';
     if ($image_url == $addonRelativeCode . '/img/default_thumb.jpg') {
         $image_url = "";
     }
     echo '<input id="EC_custom_img" name="custom_img" type="hidden" value="' . $image_url . '" />';
     echo '<h5>';
     echo 'Define Sortable portfolio categories for this page';
     echo '</h5>';
     if (isset($temp->datafilter) and $temp->datafilter != "") {
         $pieces = explode(",", $temp->datafilter);
         foreach ($pieces as $piece) {
             if (isset($temp->pagedata[$index]) and $temp->pagedata[$index] != "") {
                 $pieces2 = explode(",", $temp->pagedata[$index]['datafilter']);
                 $echo = false;
                 foreach ($pieces2 as $flag) {
                     if ($flag == $piece) {
                         echo ' <input type="checkbox" name="datafilter[]" value=' . $piece . ' checked>' . $piece . '<br />';
                         $echo = true;
                     }
                 }
                 if (!$echo) {
                     echo ' <input type="checkbox" name="datafilter[]" value=' . $piece . '>' . $piece . '<br />';
                 }
             } else {
                 echo ' <input type="checkbox" name="datafilter[]" value=' . $piece . '>' . $piece . '<br />';
             }
         }
     } else {
         echo 'You need to enter some categoties on ' . common::Link('Admin_Catalog_Easy', 'Plugin Catalog Easy Admin page');
     }
     //added opts for future extensions
     if ($temp->addlay_folder != "") {
         foreach ($temp->addlay_folder as $folder) {
             $template = $dataDir . $folder . "/tmpls_options/ec_options.php";
             if (file_exists($template)) {
                 include $template;
             }
         }
     }
     echo '<p style="clear:both">';
     echo '<input type="submit" name="aa" value="' . htmlspecialchars($langmessage['save']) . '" class="gpsubmit" data-cmd="gppost" />';
     echo ' <input type="submit" value="' . htmlspecialchars($langmessage['cancel']) . '" class="admin_box_close gpcancel" /> ';
     echo '</p>';
     echo '</form>';
     echo '</div>';
 }
Ejemplo n.º 26
0
 function findString(&$content, &$pattern, &$title, $link = '', $link_query = '')
 {
     $content = str_replace('>', '> ', $content);
     $content = strip_tags($content);
     $match_count = preg_match_all($pattern, $content, $matches, PREG_OFFSET_CAPTURE);
     if ($match_count < 1) {
         return;
     }
     $rating = $match_count / strlen($content);
     $result = '<div>';
     $result .= '<b>';
     $label = common::GetLabel($title);
     if (empty($link)) {
         $result .= common::Link($title, $label, $link_query);
     } else {
         $result .= common::Link($link, $label, $link_query);
     }
     $result .= '</b>';
     $result .= '<p>';
     $content = str_replace(array("\n", "\r", "\t"), array(' ', ' ', ' '), $content);
     //reduce a little bit
     $start = $matches[0][0][1];
     //find a space at the beginning to start from
     $i = 0;
     do {
         $i++;
         $start_offset = $i * 10;
         $start = max(0, $start - $start_offset);
         $trimmed = substr($content, $start, 300);
         $space = strpos($trimmed, ' ');
         if ($space < $start_offset) {
             $content = substr($trimmed, $space);
             break;
         }
     } while ($start - $start_offset > 0);
     //find a space at the end
     if (strlen($content) > 250) {
         $space2 = strpos($content, ' ', $space + 220);
         if ($space2 > 0) {
             $content = substr($content, 0, $space2);
         }
     }
     $result .= preg_replace($pattern, '<b>\\1</b>', $content);
     $result .= '</p>';
     $result .= '</div>';
     while (isset($this->files[(string) $rating])) {
         $rating++;
     }
     $this->files[(string) $rating] = $result;
 }
Ejemplo n.º 27
0
 /**
  * View all pages of the requested language
  *
  */
 public function AllTitles()
 {
     global $langmessage;
     echo '<h2>' . $langmessage['Pages'] . '</h2>';
     $lang_lists = array();
     foreach ($this->lists as $list_index => $list) {
         foreach ($list as $lang => $index) {
             $lang_lists[$lang][] = $index;
         }
     }
     foreach ($lang_lists as $lang => $indexes) {
         echo '<div class="ml_stats"><div>';
         echo '<table class="bordered striped">';
         echo '<thead><tr><th>' . $this->avail_langs[$lang] . '</th><th>' . $langmessage['options'] . '</th></tr>';
         echo '<tbody>';
         foreach ($indexes as $index) {
             echo '<tr><td>';
             $title = common::IndexToTitle($index);
             echo common::Link_Page($title);
             echo '</td><td>';
             echo common::Link('Admin_MultiLang', $langmessage['options'], 'cmd=TitleSettings&index=' . $index, ' name="gpabox"');
             echo '</td></tr>';
         }
         echo '</tbody>';
         echo '</table>';
         echo '</div></div>';
     }
 }
Ejemplo n.º 28
0
 function SearchNavLinks()
 {
     global $langmessage;
     echo '<div class="search_pages">';
     if ($this->searchPage > 0) {
         //previous
         if ($this->searchPage > 1) {
             echo common::Link($this->browser_path, $langmessage['Previous'], $this->searchQuery . '&page=' . ($this->searchPage - 1));
         } else {
             echo common::Link($this->browser_path, $langmessage['Previous'], $this->searchQuery);
         }
     } else {
         echo '<span>' . $langmessage['Previous'] . '</span>';
     }
     //always show link for first page
     $start_page = max(0, $this->searchPage - 5);
     if ($start_page > 0) {
         echo common::Link($this->browser_path, '1', $this->searchQuery);
         //.'&offset=0');
         if ($start_page > 1) {
             echo '<span>...</span>';
         }
     }
     $pages = ceil($this->searchMax / $this->searchPerPage);
     $max_page = min($start_page + 9, $pages);
     for ($j = $start_page; $j < $max_page; $j++) {
         $new_offset = $j * $this->searchPerPage;
         if ($this->searchOffset == $new_offset) {
             echo '<span>' . ($j + 1) . '</span>';
         } else {
             if ($j == 0) {
                 echo common::Link($this->browser_path, $j + 1, $this->searchQuery);
             } else {
                 echo common::Link($this->browser_path, $j + 1, $this->searchQuery . '&page=' . $j);
             }
         }
     }
     //always show link to last page
     if ($max_page < $pages) {
         if ($max_page + 1 < $pages) {
             echo '<span>...</span>';
         }
         echo common::Link($this->browser_path, $pages, $this->searchQuery . '&page=' . ($pages - 1));
     }
     $last = $this->searchOffset + $this->searchPerPage;
     if ($last < $this->searchMax) {
         //next
         echo common::Link($this->browser_path, $langmessage['Next'], $this->searchQuery . '&page=' . ($this->searchPage + 1));
     } else {
         echo '<span>' . $langmessage['Next'] . '</span>';
     }
     echo '</div>';
 }
Ejemplo n.º 29
0
 function GetSiteLabelLink()
 {
     global $config;
     echo common::Link('', $config['title']);
 }
Ejemplo n.º 30
-3
 function ShowInstalled(&$available)
 {
     global $langmessage, $config, $dataDir;
     //show installed addons
     $show = $config['addons'];
     if (!is_array($show)) {
         return false;
     }
     //versions available online
     includeFile('tool/update.php');
     update_class::VersionsAndCheckTime($new_versions);
     //set upgrade_from
     foreach ($available as $folder => $info) {
         if (!$info['upgrade_key']) {
             continue;
         }
         $upgrade_key = $info['upgrade_key'];
         if (!isset($show[$upgrade_key])) {
             continue;
         }
         $show[$upgrade_key]['upgrade_from'] = $folder;
         if (isset($info['Addon_Version'])) {
             $show[$upgrade_key]['upgrade_version'] = $info['Addon_Version'];
         }
     }
     echo '<table class="bordered" style="min-width:700px">';
     echo '<tr>';
     echo '<th>';
     echo $langmessage['name'];
     echo '</th>';
     echo '<th>';
     echo $langmessage['version'];
     echo '</th>';
     echo '<th>';
     echo $langmessage['options'];
     echo '</th>';
     echo '<th>';
     echo 'Order';
     echo '</th>';
     echo '</tr>';
     $i = 0;
     foreach ($show as $folder => $info) {
         $addonName = $info['name'];
         $developerInstall = false;
         $installFolder = $dataDir . '/data/_addoncode/' . $folder;
         echo '<tr class="' . ($i % 2 ? 'even' : '') . '">';
         $i++;
         echo '<td>';
         $label = $addonName;
         echo common::Link('Admin_Addons', $label, 'cmd=show&addon=' . $folder);
         if (is_link($installFolder)) {
             echo '<br/> <em class="admin_note">' . $langmessage['developer_install'] . '</em>';
             $developerInstall = true;
             //check symbolic links, fix if necessary
             $link_folder = readlink($installFolder);
             $source_folder = $dataDir . '/addons/' . $info['upgrade_from'];
             if ($source_folder != $link_folder && basename($source_folder) == basename($link_folder)) {
                 if (unlink($installFolder)) {
                     symlink($source_folder, $installFolder);
                 }
             }
         }
         echo '</td>';
         echo '<td>';
         if (isset($info['version'])) {
             echo $info['version'];
         } else {
             $info['version'] = '0';
             echo '&nbsp;';
         }
         if (isset($info['upgrade_from'])) {
             if (isset($info['upgrade_version'])) {
                 if (version_compare($info['upgrade_version'], $info['version'], '>')) {
                     echo ' <br/> <b>' . $langmessage['new_version'] . '</b>';
                 }
             }
         }
         if (isset($info['id']) && isset($new_versions[$info['id']])) {
             echo ' <br/> <b>' . $langmessage['new_version'] . ' (gpEasy.com)</b>';
         }
         echo '</td>';
         echo '<td>';
         if (isset($info['id'])) {
             echo common::Link('Admin_Addons', $langmessage['rate'], 'cmd=rate&arg=' . $info['id']);
             echo ' &nbsp; ';
             $forum_id = 1000 + $info['id'];
             echo '<a href="' . $GLOBALS['addonBrowsePath'] . '/Special_Forum?show=f' . $forum_id . '" target="_blank">' . $langmessage['Support'] . '</a>';
         } else {
             echo '<span class="unavail">' . $langmessage['rate'] . '</span>';
             echo ' &nbsp; ';
             echo '<span class="unavail">' . $langmessage['Support'] . '</span>';
         }
         //upgrade link
         if (isset($info['upgrade_from'])) {
             echo ' &nbsp; ';
             if ($developerInstall) {
                 echo common::Link('Admin_Addons', $langmessage['upgrade'], 'cmd=step1&mode=dev&source=' . $info['upgrade_from']);
             } else {
                 echo common::Link('Admin_Addons', $langmessage['upgrade'], 'cmd=step1&source=' . $info['upgrade_from']);
             }
         }
         if (isset($info['id']) && isset($new_versions[$info['id']])) {
             echo ' &nbsp; ';
             echo ' <a href="' . $GLOBALS['addonBrowsePath'] . '/Special_Addon_Plugins?id=' . $info['id'] . '" name="remote">';
             echo $langmessage['upgrade'] . ' (gpEasy.com)';
             echo '</a>';
         }
         echo ' &nbsp; ';
         echo common::Link('Admin_Addons', $langmessage['uninstall'], 'cmd=uninstall&addon=' . $folder, ' name="gpabox"');
         echo '</td>';
         echo '<td>';
         if (isset($info['order'])) {
             echo $info['order'];
         }
         echo '&nbsp;</td>';
         echo '</tr>';
     }
     echo '</table>';
     return true;
 }