function CommentRow($page_index, $comment) { global $gp_index, $gp_titles, $langmessage; $key =& $comment['key']; echo '<tr class="easy_comment_' . $page_index . '_' . $key . '">'; echo '<td>'; $title = common::IndexToTitle($page_index); $label = common::GetLabelIndex($page_index); echo common::Link($title, $label); echo '</td>'; echo '<td>'; echo date('D, j M Y H:i', $comment['time']); echo '</td>'; echo '<td>'; if (!empty($comment['website'])) { echo '<b><a href="' . $comment['website'] . '">' . $comment['name'] . '</a></b>'; } else { echo 'no website'; echo $comment['name']; } echo '</td>'; echo '<td>'; echo $comment['abbr']; echo '</td>'; echo '<td>'; echo common::Link('Admin_Easy_Comments', $langmessage['delete'], 'cmd=easy_admin_rm&pg=' . $page_index . '&i=' . $key, ' name="gpajax"'); echo '</td>'; echo '</tr>'; }
function BlogSearch($args) { global $addonPathData; $this->Init(); $search_obj = $args[0]; $label = common::GetLabelIndex('special_blog'); $full_path = $addonPathData . '/index.php'; // config of installed addon to get to know how many post files are if (!file_exists($full_path)) { return; } require $full_path; $fileIndexMax = floor($blogData['post_index'] / 20); // '20' I found in SimpleBlogCommon.php function GetPostFile (line 62) for ($fileIndex = 0; $fileIndex <= $fileIndexMax; $fileIndex++) { $postFile = $addonPathData . '/posts_' . $fileIndex . '.php'; if (!file_exists($postFile)) { continue; } require $postFile; foreach ($posts as $id => $post) { $title = $label . ': ' . str_replace('_', ' ', $post['title']); $content = str_replace('_', ' ', $post['title']) . ' ' . $post['content']; SimpleBlogCommon::UrlQuery($id, $url, $query); $search_obj->FindString($content, $title, $url, $query); } $posts = array(); } }
function __construct($args) { SimpleBlogCommon::Init(); $search_obj = $args[0]; $blog_label = common::GetLabelIndex('special_blog'); $post_ids = SimpleBlogCommon::AStrToArray('str_index'); foreach ($post_ids as $id) { $post = SimpleBlogCommon::GetPostContent($id); if (!$post) { continue; } $title = $blog_label . ': ' . str_replace('_', ' ', $post['title']); $content = str_replace('_', ' ', $post['title']) . ' ' . $post['content']; SimpleBlogCommon::UrlQuery($id, $url, $query); $search_obj->FindString($content, $title, $url, $query); } }
/** * Language selection popup * */ public function TitleSettings($args = array()) { global $gp_titles, $langmessage, $langmessage, $gp_index; $args += array('to_lang' => '', 'to_slug' => ''); $page_index = $_REQUEST['index']; if (!isset($gp_titles[$page_index])) { echo $langmessage['OOPS'] . ' (Invalid Title - 3)'; return; } $list = $this->GetList($page_index); echo '<div>'; echo '<form method="post" action="' . common::GetUrl('Admin_MultiLang') . '">'; echo '<input type="hidden" name="cmd" value="TitleSettingsSave" />'; echo '<input type="hidden" name="index" value="' . $page_index . '" />'; echo '<h3>Page Settings</h3>'; echo '<table class="bordered"><tr><th>Language</th><th>Title</th><th>Options</th></tr>'; //not set yet if (!$list) { $in_menu = $this->InMenu($page_index); echo '<tr><td>'; if ($in_menu) { echo $this->language; } else { $this->Select('from_lang', '#lang_data'); } echo '</td><td>'; $title = common::IndexToTitle($page_index); echo common::Link_Page($title); echo '</td><td>'; echo '</td></tr>'; } //current settings foreach ($this->avail_langs as $lang => $language) { if (!isset($list[$lang])) { continue; } $index = $list[$lang]; echo '<tr><td>'; echo $language . ' (' . $lang . ')'; echo '</td><td>'; $title = common::IndexToTitle($index); echo common::Link_Page($title); echo '</td><td>'; echo common::Link('Admin_MultiLang', 'Remove', 'cmd=RemoveTitle&index=' . $page_index . '&rmindex=' . $index, 'name="gpabox" class="gpconfirm" title="Remove this entry?"'); echo '</td></tr>'; } //option to add another title echo '<tr><td>'; $this->Select('to_lang', '#lang_data', $args['to_lang']); echo '</td><td>'; $this->Select('to_slug', '#lang_titles', $args['to_slug']); echo '</td><td>'; echo '<input type="submit" value="' . $langmessage['save'] . '" class="gpabox gpbutton" /> '; echo '</td></tr>'; echo '</table>'; echo '</form>'; $this->SmLinks(); //add languages as json $data = array(); foreach ($this->langs as $code => $label) { $data[] = array($label, $code); } echo "\n"; echo '<span id="lang_data" data-json=\'' . htmlspecialchars(json_encode($data), ENT_QUOTES & ~ENT_COMPAT) . '\'></span>'; //add titles as json $data = array(); foreach ($gp_index as $slug => $index) { $label = common::GetLabelIndex($index); $data[] = array($slug, common::LabelSpecialChars($label)); } echo "\n"; echo '<span id="lang_titles" data-json=\'' . htmlspecialchars(json_encode($data), ENT_QUOTES & ~ENT_COMPAT, 'UTF-8', false) . '\'></span>'; echo '</div>'; }
/** * 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']) . ' » <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>'; }
/** * Get a list of titles matching the search criteria * */ function GetSearchList() { global $gp_index; $key =& $_REQUEST['q']; if (empty($key)) { return array(); } $key = strtolower($key); $show_list = array(); foreach ($gp_index as $title => $index) { if (strpos(strtolower($title), $key) !== false) { $show_list[$index] = $title; continue; } $label = common::GetLabelIndex($index); if (strpos(strtolower($label), $key) !== false) { $show_list[$index] = $title; continue; } } return $show_list; }
function InheritingLayout($searchLevel, &$menu, &$result) { global $gp_titles; $children = true; do { $menu_key = key($menu); $info = current($menu); if (!isset($info['level'])) { break; } $level = $info['level']; if ($level < $searchLevel) { return; } if ($level > $searchLevel) { if ($children) { page_layout::InheritingLayout($level, $menu, $result); } else { unset($menu[$menu_key]); } continue; } unset($menu[$menu_key]); if (!empty($gp_titles[$menu_key]['gpLayout'])) { $children = false; continue; } $children = true; //exclude external links if ($menu_key[0] == '_') { continue; } $label = common::GetLabelIndex($menu_key, false); $result[] = common::LabelSpecialChars($label); } while (count($menu) > 0); }
function HomepageDisplay() { global $langmessage, $config; $label = common::GetLabelIndex($config['homepath_key']); echo '<span class="gpicon_home"></span>'; echo $langmessage['Homepage'] . ': '; echo common::Link('Admin_Menu', $label, 'cmd=homepage_select', 'data-cmd="gpabox"'); }
/** * Set global variables ( $gp_index, $gp_titles, $gp_menu and $gpLayouts ) from _site/pages.php * */ static function GetPagesPHP() { global $gp_index, $gp_titles, $gp_menu, $gpLayouts, $config; $gp_index = array(); $pages = gpFiles::Get('_site/pages'); //update for < 2.0a3 if (array_key_exists('gpmenu', $pages) && array_key_exists('gptitles', $pages) && !array_key_exists('gp_titles', $pages) && !array_key_exists('gp_menu', $pages)) { foreach ($pages['gptitles'] as $title => $info) { $index = common::NewFileIndex(); $gp_index[$title] = $index; $gp_titles[$index] = $info; } foreach ($pages['gpmenu'] as $title => $level) { $index = $gp_index[$title]; $gp_menu[$index] = array('level' => $level); } return; } $gpLayouts = $pages['gpLayouts']; $gp_index = $pages['gp_index']; $gp_titles = $pages['gp_titles']; $gp_menu = $pages['gp_menu']; if (!is_array($gp_menu)) { common::stop(); } //update for 3.5, if (!isset($gp_titles['special_gpsearch'])) { $gp_titles['special_gpsearch'] = array(); $gp_titles['special_gpsearch']['label'] = 'Search'; $gp_titles['special_gpsearch']['type'] = 'special'; $gp_index['Search'] = 'special_gpsearch'; //may overwrite special_search settings } //fix the gpmenu if (version_compare(gpFiles::$last_version, '3.0b1', '<')) { $gp_menu = gpOutput::FixMenu($gp_menu); // fix gp_titles for gpEasy 3.0+ // just make sure any ampersands in the label are escaped foreach ($gp_titles as $key => $value) { if (isset($gp_titles[$key]['label'])) { $gp_titles[$key]['label'] = common::GetLabelIndex($key, true); } } } //title related configuration settings if (empty($config['homepath_key'])) { $config['homepath_key'] = key($gp_menu); } $config['homepath'] = common::IndexToTitle($config['homepath_key']); }
/** * Display the permission options for a file * */ function FilePermissions() { global $gp_titles, $langmessage; $index = $_REQUEST['index']; if (!isset($gp_titles[$index])) { message($langmessage['OOPS'] . ' (Invalid Title)'); return; } 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="' . $index . '">'; $label = strip_tags(common::GetLabelIndex($index)); //echo '<h3>'.sprintf($langmessage['Permissions_for'],$label).'</h3>'; echo '<h2>' . common::Link('Admin_Users', $langmessage['user_permissions']) . ' » <i>' . $label . '</i></h2>'; 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'], ',' . $index . ',') !== false) { $attr = ' checked="checked"'; } echo '<label class="all_checkbox"><input type="checkbox" name="users[' . htmlspecialchars($username) . ']" value="' . htmlspecialchars($username) . '" ' . $attr . '/> ' . $username . '</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>'; }
static function RenameForm($index, $action) { global $langmessage, $page, $gp_index, $gp_titles; $label = common::GetLabelIndex($index); $title = common::IndexToTitle($index); $title_info = $gp_titles[$index]; if (empty($_REQUEST['new_title'])) { $new_title = common::LabelSpecialChars($label); } else { $new_title = htmlspecialchars($_REQUEST['new_title']); } $new_title = str_replace('_', ' ', $new_title); //show more options? $hidden_rows = false; ob_start(); echo '<div class="inline_box">'; echo '<form action="' . $action . '" method="post" id="gp_rename_form">'; echo '<input type="hidden" name="old_title" value="' . htmlspecialchars(str_replace('_', ' ', $title)) . '" />'; echo '<h2>' . $langmessage['rename/details'] . '</h2>'; echo '<input type="hidden" name="title" value="' . htmlspecialchars($title) . '" />'; echo '<table class="bordered full_width" id="gp_rename_table">'; echo '<thead>'; echo '<tr>'; echo '<th colspan="2">'; echo $langmessage['options']; echo '</th>'; echo '</tr>'; echo '</thead>'; //label echo '<tbody>'; echo '<tr><td class="formlabel">' . $langmessage['label'] . '</td>'; echo '<td><input type="text" class="title_label gpinput" name="new_label" maxlength="100" size="50" value="' . $new_title . '" />'; echo '</td></tr>'; //slug $attr = ''; $class = 'new_title'; $editable = true; if ($title == admin_tools::LabelToSlug($label)) { $attr = 'disabled="disabled" '; $class .= ' sync_label'; } echo '<tr><td class="formlabel">' . $langmessage['Slug/URL'] . '</td>'; echo '<td><input type="text" class="' . $class . ' gpinput" name="new_title" maxlength="100" size="50" value="' . htmlspecialchars($title) . '" ' . $attr . '/>'; if ($editable) { echo ' <div class="label_synchronize">'; if (empty($attr)) { echo '<a href="#">' . $langmessage['sync_with_label'] . '</a>'; echo '<a href="#" class="slug_edit nodisplay">' . $langmessage['edit'] . '</a>'; } else { echo '<a href="#" class="nodisplay">' . $langmessage['sync_with_label'] . '</a>'; echo '<a href="#" class="slug_edit">' . $langmessage['edit'] . '</a>'; } echo '</div>'; } echo '</td>'; echo '</tr>'; //browser title defaults to label $attr = ''; $class = 'browser_title'; if (isset($title_info['browser_title'])) { echo '<tr>'; $browser_title = $title_info['browser_title']; } else { echo '<tr class="nodisplay">'; $hidden_rows = true; $browser_title = $label; $attr = 'disabled="disabled" '; $class .= ' sync_label'; } echo '<td class="formlabel">'; echo $langmessage['browser_title']; echo '</td>'; echo '<td>'; echo '<input type="text" class="' . $class . ' gpinput" size="50" name="browser_title" value="' . $browser_title . '" ' . $attr . '/>'; echo ' <div class="label_synchronize">'; if (empty($attr)) { echo '<a href="#">' . $langmessage['sync_with_label'] . '</a>'; echo '<a href="#" class="slug_edit nodisplay">' . $langmessage['edit'] . '</a>'; } else { echo '<a href="#" class="nodisplay">' . $langmessage['sync_with_label'] . '</a>'; echo '<a href="#" class="slug_edit">' . $langmessage['edit'] . '</a>'; } echo '</div>'; echo '</td>'; echo '</tr>'; //meta keywords $keywords = ''; if (isset($title_info['keywords'])) { echo '<tr>'; $keywords = $title_info['keywords']; } else { echo '<tr class="nodisplay">'; $hidden_rows = true; } echo '<td class="formlabel">'; echo $langmessage['keywords']; echo '</td>'; echo '<td>'; echo '<input type="text" class="gpinput" size="50" name="keywords" value="' . $keywords . '" />'; echo '</td>'; echo '</tr>'; //meta description $description = ''; if (isset($title_info['description'])) { echo '<tr>'; $description = $title_info['description']; } else { echo '<tr class="nodisplay">'; $hidden_rows = true; } echo '<td class="formlabel">'; echo $langmessage['description']; echo '</td>'; echo '<td>'; //echo '<input type="text" class="gpinput" size="50" name="description" value="'.$description.'" />'; echo '<textarea class="gptextarea show_character_count" rows="2" cols="50" name="description">' . $description . '</textarea>'; $count_label = sprintf($langmessage['_characters'], '<span>' . strlen($description) . '</span>'); echo '<div class="character_count">' . $count_label . '</div>'; echo '</td>'; echo '</tr>'; //robots $rel = ''; if (isset($title_info['rel'])) { echo '<tr>'; $rel = $title_info['rel']; } else { echo '<tr class="nodisplay">'; $hidden_rows = true; } echo '<td class="formlabel">'; echo $langmessage['robots']; echo '</td>'; echo '<td>'; echo '<label>'; $checked = strpos($rel, 'nofollow') !== false ? 'checked="checked"' : ''; echo '<input type="checkbox" name="nofollow" value="nofollow" ' . $checked . '/> '; echo ' Nofollow '; echo '</label>'; echo '<label>'; $checked = strpos($rel, 'noindex') !== false ? 'checked="checked"' : ''; echo '<input type="checkbox" name="noindex" value="noindex" ' . $checked . '/> '; echo ' Noindex'; echo '</label>'; echo '</td>'; echo '</tr>'; echo '</tbody>'; echo '</table>'; //redirection echo '<p id="gp_rename_redirect" class="nodisplay">'; echo '<label>'; echo '<input type="checkbox" name="add_redirect" value="add" /> '; echo sprintf($langmessage['Auto Redirect'], '"' . $title . '"'); echo '</label>'; echo '</p>'; echo '<p>'; if ($hidden_rows) { echo ' <a data-cmd="showmore" >+ ' . $langmessage['more_options'] . '</a>'; } echo '</p>'; echo '<p>'; echo '<input type="hidden" name="cmd" value="renameit"/> '; echo '<input type="submit" name="" value="' . $langmessage['save_changes'] . '...' . '" class="gpsubmit" data-cmd="gppost"/>'; echo '<input type="button" class="admin_box_close gpcancel" name="" value="' . $langmessage['cancel'] . '" />'; echo '</p>'; echo '</form>'; echo '</div>'; $content = ob_get_clean(); $page->ajaxReplace = array(); $array = array(); $array[0] = 'admin_box_data'; $array[1] = ''; $array[2] = $content; $page->ajaxReplace[] = $array; //call renameprep function after admin_box $array = array(); $array[0] = 'renameprep'; $array[1] = ''; $array[2] = ''; $page->ajaxReplace[] = $array; }
if (!array_key_exists('datafilter', $config)) { $config['datafilter'] = ""; } if ($config['wap']) { $page->head_js[] = $addonRelativeCode . '/js/catalog_wap.js'; } else { $page->head_js[] = $addonRelativeCode . '/js/catalog.js'; } if (common::LoggedIn()) { $page->head .= "\n" . '<script type="text/javascript">gpFinder_url = "' . common::GetUrl('Admin_Browser') . '";</script>' . "\n"; $page->head_js[] = $addonRelativeCode . '/js/catalog_menu.js'; $pageIndexJS = 'var gpE_availablelabels = ['; $i = 0; foreach ($gp_index as $key => $value) { $i++; $pageIndexJS .= '"' . common::GetLabelIndex($value) . '"' . ($i == count($gp_index) ? '' : ', '); } $pageIndexJS .= '];'; $page->head_script .= "\n" . $pageIndexJS . "\n"; if (array_key_exists("menus", $GLOBALS['config']) and $GLOBALS['config']['menus'] != "") { $menus = 'var gpE_menus = {'; $i = 0; foreach ($GLOBALS['config']['menus'] as $key => $value) { $i++; $menus .= '"' . $key . '":"' . $value . '"' . ($i == count($GLOBALS['config']['menus']) ? '' : ', '); } $menus .= '};'; $page->head_script .= "\n" . $menus . "\n"; } else { $menus = 'var gpE_menus = {'; $menus .= '};';
function TitleSelect($default_index, $exclude = array()) { global $gp_index, $gp_titles, $langmessage; $exclude = (array) $exclude; echo '<div>'; $data = array(); foreach ($gp_index as $url => $index) { if (in_array($index, $exclude)) { continue; } $label = common::GetLabelIndex($index); $data[] = array(common::LabelSpecialChars($label), $url); } //$data = array_slice($data,107,1); echo '<span class="data" style="display:none">'; $data = json_encode($data); echo htmlspecialchars($data, ENT_NOQUOTES); echo '</span>'; $default_url = ''; if ($default_index) { $default_url = common::IndexToTitle($default_index); } echo '<span class="gpinput combobox">'; echo '<input type="text" name="title" value="' . htmlspecialchars($default_url) . '" class="combobox"/>'; echo '</span>'; echo '</div>'; }
/** * Set global variables ( $gp_index, $gp_titles, $gp_menu and $gpLayouts ) from _site/pages.php * */ function GetPagesPHP() { global $gp_index, $gp_titles, $gp_menu, $dataDir, $gpLayouts; $gp_index = array(); $pages = array(); require $dataDir . '/data/_site/pages.php'; $GLOBALS['fileModTimes']['pages.php'] = $fileModTime; $gpLayouts = $pages['gpLayouts']; //update for < 2.0a3 if (isset($pages['gpmenu']) && isset($pages['gptitles'])) { //1.7b2 if (!isset($pages['gptitles']['Special_Missing'])) { $pages['gptitles']['Special_Missing']['type'] = 'special'; $pages['gptitles']['Special_Missing']['label'] = 'Missing'; } foreach ($pages['gptitles'] as $title => $info) { $index = common::NewFileIndex(); $gp_index[$title] = $index; $gp_titles[$index] = $info; } foreach ($pages['gpmenu'] as $title => $level) { $index = $gp_index[$title]; $gp_menu[$index] = array('level' => $level); } return; } $gp_index = $pages['gp_index']; $gp_titles = $pages['gp_titles']; $gp_menu = $pages['gp_menu']; //fix the gpmenu if (version_compare($fileVersion, '3.0b1', '<')) { $gp_menu = gpOutput::FixMenu($gp_menu); // fix gp_titles for gpEasy 3.0+ // just make sure any ampersands in the label are escaped foreach ($gp_titles as $key => $value) { if (isset($gp_titles[$key]['label'])) { $gp_titles[$key]['label'] = common::GetLabelIndex($key, true); } } } }
function CheckifNav($indexofparent) { global $gp_titles; $page_label = common::GetLabelIndex($indexofparent); if (isset($this->catpages) and $this->catpages != "") { foreach ($this->catpages as $catpage) { if (mb_strtolower($page_label) == mb_strtolower($catpage['label'])) { if ($catpage['navi'] and $catpage['source'] == 0) { return true; } } if (mb_strtolower($page_label) == mb_strtolower($catpage['sourcepages'])) { if ($catpage['navi'] and $catpage['source'] == 1) { return true; } } if (mb_strtolower($page_label) == mb_strtolower($catpage['sourcepages'])) { if ($catpage['navi'] and $catpage['source'] == 2) { $this->another_parent = $indexofparent; $index = Catalog_Easy::array_find_deep($gp_titles, $catpage['label']); $page_index = $index[0]; $this->page_cat = $page_index; return true; } } } } return false; }