/** * Searches a specific pattern in one or more albums / assets / fields * @param type $search the pattern to search (array containing a selection of words to find) * @param type $fields the bookmark fields where to search : * it can be the title, the description and/or the keywords * @param type $level the level where to search * @param type $albums an array containing the albums where to search * @param type $asset a string containing a specific asset * @return the list of matching bookmarks; false if an error occurs; null * no bookmark matches the pattern */ function toc_bookmarks_search($search, $fields, $level, $albums, $asset = '') { if (!isset($level) || $level < 0 || $level > 4) { $level = 0; } $bookmarks = array(); if (isset($asset) && $asset != '') { if (isset($albums[0]) && $albums[0] != '') { $bookmarks = toc_asset_bookmark_list_get($albums[0], $asset); } } else { if (isset($albums) && count($albums) > 0) { foreach ($albums as $album) { $bookmarks = array_merge($bookmarks, toc_album_bookmarks_list_get($album)); } } } if ((!isset($search) || count($search) == 0) && $level == 0) { return $bookmarks; } return search_in_array($search, $bookmarks, $fields, $level); }
/** * Convert talent from icon to id * * @param $name name/id to convert * @return string/int output */ public function ConvertTalent($name) { return key(search_in_array($name, $this->convert['talent'])); }
/** * Resolve the EQDKP Page the user is surfing on.. * * @param string $member * @return string */ function resolve_eqdkp_page($strPage) { $matches = explode('&', $strPage); $strPath = $matches[0]; if (strlen($strPath)) { $strQuery = isset($matches[1]) ? $matches[1] : ""; $arrQuery = array(); parse_str($strQuery, $arrQuery); $arrFolder = explode('/', $strPath); $strOut = ""; //Prefixes for Admin, Plugins, Maintenance switch ($arrFolder[0]) { case 'admin': $strPrefix = registry::fetch('user')->lang('menu_admin_panel') . ': '; break; case 'plugins': $strPrefix = registry::fetch('user')->lang('pi_title') . ': '; $strOut = registry::fetch('user')->lang($arrFolder[1]) ? registry::fetch('user')->lang($arrFolder[1]) : ucfirst($arrFolder[1]); break; case 'maintenance': $strPrefix = registry::fetch('user')->lang('maintenance'); $strOut = " "; break; case 'portal': $strPrefix = registry::fetch('user')->lang('portal') . ': '; $strOut = registry::fetch('user')->lang($arrFolder[1]) ? registry::fetch('user')->lang($arrFolder[1]) : ucfirst($arrFolder[1]); break; default: $strPrefix = ''; } //Resolve Admin Pages if ($arrFolder[0] == "admin") { //First, some admin pages without menu entry switch ($strPath) { case 'admin/info_php': $strOut = '<a href="' . $this->root_path . 'admin/info_php.php' . $this->SID . '">PHP-Info</a>'; break; case 'admin/manage_articles': $strOut = '<a href="' . $this->root_path . 'admin/manage_articles.php' . $this->SID . '&' . $strQuery . '">' . $this->user->lang('manage_articles') . '</a>'; break; case 'admin/manage_styles': $strOut = '<a href="' . $this->root_path . 'admin/manage_styles.php' . $this->SID . '&' . $strQuery . '">' . $this->user->lang('styles_title') . '</a>'; break; case 'admin': case 'admin/index': $strOut = registry::fetch('user')->lang('menu_admin_panel'); $strPrefix = ""; break; } //Now check if there is an menu entry if ($strOut == "") { $admin_menu = $this->adminmenu(false); $result = search_in_array($strPath . ".php" . $this->SID, $admin_menu); if ($result) { $arrMenuEntry = arraykey_for_array($result, $admin_menu); if ($arrMenuEntry) { $strOut = '<a href="' . $this->root_path . $arrMenuEntry['link'] . '">' . $arrMenuEntry['text'] . '</a>'; } } } } //Resolve Frontend Page if ($strOut == "" && $strPrefix == "") { $intArticleID = $intCategoryID = 0; $arrPath = array_reverse($arrFolder); //Suche Alias in Artikeln $intArticleID = $this->pdh->get('articles', 'resolve_alias', array(str_replace(".html", "", utf8_strtolower($arrPath[0])))); if (!$intArticleID) { //Suche Alias in Kategorien $intCategoryID = $this->pdh->get('article_categories', 'resolve_alias', array(str_replace(".html", "", utf8_strtolower($arrPath[0])))); //Suche in Artikeln mit nächstem Index, denn könnte ein dynamischer Systemartikel sein if (!$intCategoryID && isset($arrPath[1])) { $intArticleID = $this->pdh->get('articles', 'resolve_alias', array(str_replace(".html", "", utf8_strtolower($arrPath[1])))); } } if ($intArticleID) { $strOut = $this->user->lang('article') . ': <a href="' . $this->controller_path . $this->pdh->get('articles', 'path', array($intArticleID)) . '">' . $this->pdh->get('articles', 'title', array($intArticleID)) . '</a>'; } elseif ($intCategoryID) { $strOut = $this->user->lang('category') . ': <a href="' . $this->server_path . $this->pdh->get('article_categories', 'path', array($intCategoryID)) . '">' . $this->pdh->get('article_categories', 'name', array($intCategoryID)) . '</a>'; } elseif (register('routing')->staticRoute($arrPath[0]) || register('routing')->staticRoute($arrPath[1])) { $strPageObject = register('routing')->staticRoute($arrPath[0]); if (!$strPageObject) { $strPageObject = register('routing')->staticRoute($arrPath[1]); } if ($strPageObject) { $strID = str_replace("-", "", strrchr(str_replace(".html", "", $arrPath[0]), "-")); $arrMatches = array(); $myVar = false; preg_match_all('/[a-z]+|[0-9]+/', $strID, $arrMatches, PREG_PATTERN_ORDER); if (isset($arrMatches[0]) && count($arrMatches[0])) { if (count($arrMatches[0]) == 2) { $myVar = $arrMatches[0][1]; } } if (strlen($strID) && count($arrMatches[0]) != 2) { $myVar = $strID; } switch ($strPageObject) { case 'settings': $strOut = registry::fetch('user')->lang('settings_title'); break; case 'login': $strOut = registry::fetch('user')->lang('login_title'); break; case 'mycharacters': $strOut = registry::fetch('user')->lang('manage_members_titl'); break; case 'search': $strOut = registry::fetch('user')->lang('search'); break; case 'register': $strOut = registry::fetch('user')->lang('register_title'); break; //TODO Add Title //TODO Add Title case 'addcharacter': $strOut = ''; break; case 'editarticle': $strOut = $this->user->lang('manage_articles'); if (isset($arrQuery['aid']) && $arrQuery['aid']) { $strOut .= ': <a href="' . $this->controller_path . $this->pdh->get('articles', 'path', array($arrQuery['aid'])) . '">' . $this->pdh->get('articles', 'title', array($arrQuery['aid'])) . '</a>'; } break; case 'user': $strOut = $this->user->lang('user'); if ($myVar) { $strOut .= ': <a href="' . $this->server_path . sanitize($strPage) . '">' . $this->pdh->get('user', 'name', array($myVar)) . '</a>'; } break; case 'usergroup': $strOut = $this->user->lang('usergroup'); if ($myVar) { $strOut .= ': <a href="' . $this->server_path . sanitize($strPage) . '">' . $this->pdh->get('user_groups', 'name', array((int) $myVar)) . '</a>'; } break; case 'rss': $strOut = "RSS"; break; case 'wrapper': if ($arrFolder[1] == "board" || $arrFolder[1] == "boardregister" || $arrFolder[1] == "lostpassword") { $strOut = '<a href="' . $this->routing->build('External', 'Board') . '">' . $this->user->lang('forum') . '</a>'; } elseif ($myVar) { $strOut = $this->user->lang('viewing_wrapper') . ': <a href="' . $this->routing->build('External', $this->pdh->get('links', 'name', array(intval($myVar))), intval($myVar)) . '">' . $this->pdh->get('links', 'name', array(intval($myVar))) . '</a>'; } else { $strOut = $this->user->lang('viewing_wrapper'); } break; case 'tag': $strOut .= $this->user->lang('tag') . ': <a href="' . $this->routing->build('tag', sanitize($arrFolder[1])) . '">' . sanitize($arrFolder[1]) . '</a>'; break; } } } else { //Some special frontend pages switch ($strPath) { case "api": case "exchange": $strOut = registry::fetch('user')->lang('viewing_exchange'); break; } } } } if ($strOut == '') { $strOut = '<span style="font-style:italic;">' . $this->user->lang('unknown') . '</span>'; } return $strPrefix . $strOut; }
public function ParseRaidProgression($chardata) { $a_raidprogress = array(); if (isset($chardata['progression']['raids']) && is_array($chardata['progression']['raids'])) { foreach ($chardata['progression']['raids'] as $v_progression) { // parse the bosses $a_bosses = array('progress_normal' => 0, 'progress_heroic' => 0, 'progress_mythic' => 0); if (isset($v_progression['bosses']) && is_array($v_progression['bosses'])) { foreach ($v_progression['bosses'] as $bosses) { $a_bosses['bosses'] = $bosses; // progress count if ($bosses['normalKills'] > 0) { $a_bosses['progress_normal']++; } if ($bosses['heroicKills'] > 0) { $a_bosses['progress_heroic']++; } if (isset($bosses['mythicKills']) && $bosses['mythicKills'] > 0) { $a_bosses['progress_mythic']++; } } } // put all together in an array $a_category = array_keys(search_in_array($v_progression['id'], $this->ArrInstanceCategories)); $v_progresscat = isset($a_category[0]) ? $a_category[0] : 'default'; $a_raidprogress[$v_progresscat][$v_progression['id']] = array('id' => $v_progression['id'], 'name' => $v_progression['name'], 'icon' => $this->server_path . 'games/wow/events/' . $v_progression['id'] . '.png', 'bosses' => $v_progression['bosses'], 'bosses_max' => count($v_progression['bosses']), 'bosses_normal' => $a_bosses['progress_normal'], 'bosses_heroic' => $a_bosses['progress_heroic'], 'bosses_mythic' => $a_bosses['progress_mythic'], 'runs_normal' => $v_progression['normal'], 'runs_heroic' => $v_progression['heroic'], 'runs_mythic' => $v_progression['mythic']); } } return $a_raidprogress; }
//echo "enabled: ".$ENABLED."\n"; //echo "ENABLED: ".$ENABLED."\n"; if ($ENABLED != "1") { logEntry("Plugin Status: DISABLED Please enable in Plugin Setup to use & Restart FPPD Daemon"); lockHelper::unlock(); exit(0); } //$SEPARATOR = urldecode(ReadSettingFromFile("SEPARATOR",$pluginName)); $SPORTS_READ = explode(",", $SPORTS); //echo "Incoming sports reading: \n"; //print_r($SPORTS_READ); //print_r($SPORTS_DATA_ARRAY); $messageText = ""; for ($i = 0; $i <= count($SPORTS_READ) - 1; $i++) { //echo "Retrieving data for: ".$SPORTS_READ[$i]."\n"; if (search_in_array($SPORTS_READ[$i], $SPORTS_DATA_ARRAY) > 0) { //echo $SPORTS_READ[$i]. " is in Sports data array\n"; //fetch the information $sportsScores = file_get_contents($SPORTS_DATA_ARRAY[$i][1]); $new = str_replace('&', "|", $sportsScores); //$new = str_replace('&',"|",$output); $stats = explode('&', $sportsScores); //print_r($stats); foreach ($stats as $item) { $split = explode("=", $item); $left = $split[0]; $right = (string) urldecode($split[1]); if (substr($left, 0, 10) == strtolower($SPORTS_READ[$i] . "_s_left")) { //echo $right."<br/>"; //echo $split[0]." --- ".$right."<br/>"; if (substr($right, 0, 1) == "^") {
function search_in_array($child, $haystack, $strict = false, $key = '') { foreach ($haystack as $k => $v) { if (is_array($v)) { $return = search_in_array($child, $v); if (is_array($return)) { return array($k => $return); } } else { if (!$strict and $v == $child or $strict and $v === $child) { if ($key == '' or $key != '' and $k == $key) { return array($k => $child); // got a match, stack it & return it } } } } return false; // nothing found }
public function display() { //Get Extensions $arrExtensionList = $this->repo->getExtensionList(); $arrExtensionListNamed = array(); if (is_array($arrExtensionList)) { foreach ($arrExtensionList as $catid => $extensions) { if (is_array($extensions)) { foreach ($extensions as $id => $ext) { if (!isset($arrExtensionListNamed[$catid])) { $arrExtensionListNamed[$catid] = array(); } $arrExtensionListNamed[$catid][$ext['plugin']] = $id; } } } } //Get Updates $urgendUpdates = $this->repo->BuildUpdateArray(); $allUpdates = $this->repo->BuildUpdateArray(false); $arrUpdateCount = array(1 => array('red' => 0, 'yellow' => 0), 2 => array('red' => 0, 'yellow' => 0), 3 => array('red' => 0, 'yellow' => 0), 4 => array('red' => 0, 'yellow' => 0), 7 => array('red' => 0, 'yellow' => 0)); //================================================================= //Plugins $this->pm->search(); //search for new plugins $plugins_array = $this->pm->get_plugins(PLUGIN_ALL); //maybe plugins want to auto-install portalmodules $this->portal->get_all_modules(); $plugin_count = count($plugins_array); $db_plugins = $this->pdh->get('plugins', 'id_list'); foreach ($plugins_array as $plugin_code) { if ($plugin_code == 'pluskernel') { continue; } $contact = $this->pm->get_data($plugin_code, 'contact'); $version = $this->pm->get_data($plugin_code, 'version'); $description = $this->pm->get_data($plugin_code, 'description'); $long_description = $this->pm->get_data($plugin_code, 'long_description'); $manuallink = $this->pm->get_data($plugin_code, 'manuallink'); $homepagelink = $this->pm->get_data($plugin_code, 'homepage'); $author = $this->pm->get_data($plugin_code, 'author'); if ($this->pm->check($plugin_code, PLUGIN_BROKEN)) { $this->tpl->assign_block_vars('plugins_row_broken', array('NAME' => $plugin_code, 'CODE' => $plugin_code, 'DELETE' => in_array($plugin_code, $db_plugins) ? true : false, 'DEL_LINK' => 'manage_extensions.php' . $this->SID . '&cat=1&mode=delete&code=' . $plugin_code . '&link_hash=' . $this->CSRFGetToken('mode'))); continue; } //dependencies $dep['plusv'] = $this->pm->check_dependency($plugin_code, 'plus_version'); $dep['games'] = $this->pm->check_dependency($plugin_code, 'games'); $dep['phpf'] = $this->pm->check_dependency($plugin_code, 'php_functions'); //show missing functions $deptt['phpf'] = $this->user->lang('plug_dep_phpf'); $needed_functions = $this->pm->get_plugin($plugin_code)->get_dependency('php_functions'); if (is_array($needed_functions) && count($needed_functions) > 0) { $deptt['phpf'] .= ':<br />'; foreach ($needed_functions as $function) { $deptt['phpf'] .= function_exists($function) ? '<span class="positive">' . $function . '</span><br />' : '<span class="negative">' . $function . '</span><br />'; } } $dep_all = $dep['plusv'] && $dep['games'] && $dep['phpf']; if ($this->pm->check($plugin_code, PLUGIN_DISABLED)) { $link = $dep_all ? '<a href="manage_extensions.php' . $this->SID . '&cat=1&mode=enable&code=' . $plugin_code . '&link_hash=' . $this->CSRFGetToken('mode') . '" title="' . $this->user->lang('plug_enable_info') . '">' . $this->user->lang('enable') . '</a>' : $this->user->lang('plug_dep_broken_deps'); $row = 'yellow'; } elseif ($this->pm->check($plugin_code, PLUGIN_INSTALLED)) { if (isset($urgendUpdates[$plugin_code])) { $row = 'red'; $link = '<a href="javascript:repo_update(1, \'' . $plugin_code . '\');">' . $this->user->lang('uc_bttn_update') . '</a>'; $arrUpdateCount[1]['red']++; } else { $row = 'green'; $link = $dep_all ? '<a href="manage_extensions.php' . $this->SID . '&cat=1&mode=uninstall&code=' . $plugin_code . '&link_hash=' . $this->CSRFGetToken('mode') . '">' . $this->user->lang('uninstall') . '</a>' : $this->user->lang('plug_dep_broken_deps'); } } elseif (isset($allUpdates[$plugin_code])) { $row = 'yellow'; $link = '<a href="javascript:repo_update(1, \'' . $plugin_code . '\');">' . $this->user->lang('uc_bttn_update') . '</a>'; $arrUpdateCount[1]['yellow']++; } else { $row = 'grey'; $link = $dep_all ? '<a href="manage_extensions.php' . $this->SID . '&cat=1&mode=install&code=' . $plugin_code . '&link_hash=' . $this->CSRFGetToken('mode') . '">' . $this->user->lang('install') . '</a>' : $this->user->lang('plug_dep_broken_deps'); } $this->tpl->assign_block_vars('plugins_row_' . $row, array('NAME' => isset($arrExtensionListNamed[1][$plugin_code]) ? '<a href="javascript:repoinfo(' . $arrExtensionListNamed[1][$plugin_code] . ')">' . $this->pm->get_data($plugin_code, 'name') . '</a>' : $this->pm->get_data($plugin_code, 'name'), 'VERSION' => !empty($version) ? $version : ' ', 'CODE' => $plugin_code, 'CONTACT' => !empty($contact) ? !empty($author) ? '<a href="mailto:' . $contact . '">' . $author . '</a>' : '<a href="mailto:' . $contact . '">' . $contact . '</a>' : $author, 'DESCRIPTION' => !empty($description) ? $description : ' ', 'LONG_DESCRIPTION' => $this->html->ToolTip($long_description, $this->html->toggleIcons($long_description, 'help.png', 'help_off.png', 'images/glyphs/', $this->user->lang('description'), false, false)), 'HOMEPAGE' => $this->html->ToolTip($this->user->lang('homepage'), $this->html->toggleIcons($homepagelink, 'browser.png', 'browser_off.png', 'images/glyphs/', $this->user->lang('homepage'), $homepagelink, false)), 'MANUAL' => $this->html->ToolTip($this->user->lang('manual'), $this->html->toggleIcons($manuallink, 'acroread.png', 'acroread_off.png', 'images/glyphs/', $this->user->lang('manual'), $manuallink, false)), 'ACTION_LINK' => $link)); foreach ($dep as $key => $depdata) { $tt = isset($deptt[$key]) ? $deptt[$key] : $this->user->lang('plug_dep_' . $key); $this->tpl->assign_block_vars('plugins_row_' . $row . '.dep_row', array('DEPENDENCY_STATUS' => $this->html->ToolTip($tt, $this->html->toggleIcons($depdata, 'status_green.gif', 'status_red.gif', 'images/glyphs/') . ' ' . $this->user->lang('plug_dep_' . $key . '_short')))); } } //Now bring the Extensions from the REPO to template if (isset($arrExtensionList[1]) && is_array($arrExtensionList[1])) { foreach ($arrExtensionList[1] as $id => $extension) { if ($this->pm->search($extension['plugin']) || $extension['plugin'] == 'pluskernel') { continue; } $row = 'grey_repo'; $dep['plusv'] = version_compare($extension['dep_coreversion'], $this->config->get('plus_version'), '<='); $dep['games'] = 'skip'; $dep['phpf'] = 'skip'; $dl_link = '<a href="javascript:repo_install(1, \'' . sanitize($extension['plugin']) . '\');" >' . $this->user->lang('backup_action_download') . '</a>'; $link = $dep['plusv'] ? $dl_link : ''; $this->tpl->assign_block_vars('plugins_row_' . $row, array('NAME' => '<a href="javascript:repoinfo(' . $id . ')">' . $extension['name'] . '</a>', 'VERSION' => sanitize($extension['version']), 'CODE' => sanitize($extension['plugin']), 'CONTACT' => sanitize($extension['author']), 'DESCRIPTION' => sanitize($extension['shortdesc']), 'ACTION_LINK' => $link)); foreach ($dep as $key => $depdata) { $tt = $this->user->lang('plug_dep_' . $key); $this->tpl->assign_block_vars('plugins_row_' . $row . '.dep_row', array('DEPENDENCY_STATUS' => $depdata === 'skip' ? ' ' : $this->html->ToolTip($tt, $this->html->toggleIcons($depdata, 'status_green.gif', 'status_red.gif', 'images/glyphs/') . ' ' . $this->user->lang('plug_dep_' . $key . '_short')))); } } } $badge = ''; if ($arrUpdateCount[1]['red']) { $badge = '<span class="update_available">' . $arrUpdateCount[1]['red'] . '</span>'; } elseif ($arrUpdateCount[1]['yellow']) { $badge = '<span class="update_available_yellow">' . $arrUpdateCount[1]['yellow'] . '</span>'; } $this->tpl->assign_vars(array('DEP_COUNT' => 3, 'BADGE_1' => $badge)); //================================================================= //Templates $default_style = $this->config->get('default_style'); $arrTemplates = $this->pdh->get('styles', 'styles'); $arrLocalStyleUpdates = $this->objStyles->getLocalStyleUpdates(); $arrUninstalledStyles = $this->objStyles->getUninstalledStyles(); $arrStyles = array(); foreach ($arrUninstalledStyles as $key => $install_xml) { $plugin_code = $key; if (isset($allUpdates[$plugin_code])) { $row = 'yellow'; $link = '<a href="javascript:repo_update(2, \'' . $plugin_code . '\');">' . $this->user->lang('uc_bttn_update') . '</a>'; $arrUpdateCount[2]['yellow']++; } else { $row = 'grey'; $link = '<a href="manage_extensions.php' . $this->SID . '&cat=2&mode=install&code=' . $key . '&link_hash=' . $this->CSRFGetToken('mode') . '">' . $this->user->lang('install') . '</a>'; } $screenshot = ''; if (file_exists($this->root_path . 'templates/' . $plugin_code . '/screenshot.png')) { $screenshot = '<img src=\'' . $this->root_path . 'templates/' . $plugin_code . '/screenshot.png\' style=\'max-width:300px;\' alt="" />'; } elseif (file_exists($this->root_path . 'templates/' . $plugin_code . '/screenshot.jpg')) { $screenshot = '<img src=\'' . $this->root_path . 'templates/' . $plugin_code . '/screenshot.jpg\' style=\'max-width:300px;\' alt="" />'; } $this->tpl->assign_block_vars('styles_row_' . $row, array('NAME' => $this->html->ToolTip($screenshot, $install_xml->name ? $install_xml->name : stripslashes($key)), 'VERSION' => $install_xml->version, 'AUTHOR' => $install_xml->authorEmail != "" ? '<a href="mailto:' . $install_xml->authorEmail . '">' . $install_xml->author . '</a>' : $install_xml->author, 'ACTION_LINK' => $link, 'TEMPLATE' => $key)); $arrStyles[] = $install_xml->name ? $install_xml->name : stripslashes($key); } foreach ($arrTemplates as $row) { $screenshot = ''; if (file_exists($this->root_path . 'templates/' . $row['template_path'] . '/screenshot.png')) { $screenshot = '<img src=\'' . $this->root_path . 'templates/' . $row['template_path'] . '/screenshot.png\' style=\'max-width:300px;\' alt="" />'; } elseif (file_exists($this->root_path . 'templates/' . $row['template_path'] . '/screenshot.jpg')) { $screenshot = '<img src=\'' . $this->root_path . 'templates/' . $row['template_path'] . '/screenshot.jpg\' style=\'max-width:300px;\' alt="" />'; } $plugin_code = $row['template_path']; if (isset($urgendUpdates[$plugin_code])) { if (isset($arrLocalStyleUpdates[$plugin_code])) { $rowname = 'red_local'; $link = '<a href="manage_extensions.php' . $this->SID . '&cat=2&mode=update&code=' . $row['style_id'] . '&link_hash=' . $this->CSRFGetToken('mode') . '">' . $this->user->lang('uc_bttn_update') . '</a>'; } else { $rowname = 'red'; $link = '<a href="javascript:repo_update(2, \'' . $plugin_code . '\');">' . $this->user->lang('uc_bttn_update') . '</a>'; } $arrUpdateCount[2]['red']++; } elseif (isset($allUpdates[$plugin_code])) { $rowname = 'yellow'; $link = '<a href="javascript:repo_update(2, \'' . $plugin_code . '\');">' . $this->user->lang('uc_bttn_update') . '</a>'; $arrUpdateCount[2]['yellow']++; } else { $rowname = 'green'; $link = $row['style_id'] == $default_style ? '' : '<a href="javascript:style_delete_warning(' . $row['style_id'] . ');">' . $this->user->lang('uninstall') . '</a>'; } $this->jquery->Dialog('style_preview', $this->user->lang('template_preview'), array('url' => $this->root_path . "viewnews.php" . $this->SID . "&style='+ styleid+'", 'width' => '750', 'height' => '520', 'modal' => true, 'withid' => 'styleid')); $this->tpl->assign_block_vars('styles_row_' . $rowname, array('ID' => $row['style_id'], 'U_EDIT_STYLE' => 'manage_styles.php' . $this->SID . '&edit=true&styleid=' . $row['style_id'], 'U_DOWNLOAD_STYLE' => 'manage_extensions.php' . $this->SID . '&cat=2&mode=export&code=' . $row['style_id'] . '&link_hash=' . $this->CSRFGetToken('mode'), 'ENABLE_ICON' => $row['enabled'] == '1' ? 'green' : 'red', 'ENABLE_ICON_INFO' => $row['enabled'] == '1' ? $this->user->lang('style_enabled_info') : $this->user->lang('style_disabled_info'), 'L_ENABLE' => $row['enabled'] == '1' ? $this->user->lang('deactivate') : $this->user->lang('activate'), 'ENABLE' => $row['enabled'] == '1' ? 'disable' : 'enable', 'U_ENABLE' => $row['enabled'] == '1' ? 'manage_extensions.php' . $this->SID . '&cat=2&mode=disable&code=' . $row['style_id'] . '&link_hash=' . $this->CSRFGetToken('mode') : 'manage_extensions.php' . $this->SID . '&mode=enable&cat=2&code=' . $row['style_id'] . '&link_hash=' . $this->CSRFGetToken('mode'), 'S_DEFAULT' => $row['style_id'] == $default_style ? true : false, 'S_DEACTIVATED' => $row['enabled'] != '1' ? true : false, 'STANDARD' => $row['style_id'] == $default_style ? 'checked="checked"' : '', 'VERSION' => $row['style_version'], 'AUTHOR' => $row['style_contact'] != "" ? '<a href="mailto:' . $row['style_contact'] . '">' . $row['style_author'] . '</a>' : $row['style_author'], 'NAME' => $this->html->ToolTip($screenshot, isset($arrExtensionListNamed[2][$plugin_code]) ? '<a href="javascript:repoinfo(' . $arrExtensionListNamed[2][$plugin_code] . ')">' . $row['style_name'] . '</a>' : $row['style_name']), 'TEMPLATE' => $row['template_path'], 'USERS' => $row['users'], 'ACTION_LINK' => $link)); $arrStyles[] = $plugin_code; } //Now bring the Extensions from the REPO to template if (isset($arrExtensionList[2]) && is_array($arrExtensionList[2])) { foreach ($arrExtensionList[2] as $id => $extension) { if (in_array($extension['plugin'], $arrStyles)) { continue; } $row = 'grey'; $link = '<a href="javascript:repo_install(2, \'' . sanitize($extension['plugin']) . '\');" >' . $this->user->lang('backup_action_download') . '</a>'; $this->tpl->assign_block_vars('styles_row_' . $row, array('NAME' => '<a href="javascript:repoinfo(' . $id . ')">' . $extension['name'] . '</a>', 'VERSION' => sanitize($extension['version']), 'CODE' => sanitize($extension['plugin']), 'AUTHOR' => sanitize($extension['author']), 'TEMPLATE' => sanitize($extension['plugin']), 'DESCRIPTION' => sanitize($extension['shortdesc']), 'ACTION_LINK' => $link)); } } $this->jquery->dialog('style_default_info', $this->user->lang('default_style'), array('message' => $this->user->lang('style_default_info') . '<br /><br /><label><input type="radio" name="override" value="0" onchange="change_override(1);">' . $this->user->lang('yes') . '</label> <label><input type="radio" name="override" value="1" checked="checked" onchange="change_override(0);">' . $this->user->lang('no') . '</label>', 'custom_js' => 'submit_form();', 'height' => 200), 'confirm'); $this->jquery->dialog('style_reset_warning', $this->user->lang('reset_style'), array('message' => $this->user->lang('style_confirm_reset'), 'height' => 200, 'url' => $this->root_path . 'admin/manage_extensions.php' . $this->SID . '&link_hash=' . $this->CSRFGetToken('mode') . "&cat=2&mode=reset&code='+ styleid+'", 'withid' => 'styleid'), 'confirm'); $this->jquery->dialog('style_delete_warning', $this->user->lang('delete_style'), array('message' => $this->user->lang('confirm_delete_style'), 'height' => 200, 'url' => $this->root_path . 'admin/manage_extensions.php' . $this->SID . '&link_hash=' . $this->CSRFGetToken('mode') . "&cat=2&mode=uninstall&code='+ styleid+'", 'withid' => 'styleid'), 'confirm'); $badge = ''; if ($arrUpdateCount[2]['red']) { $badge = '<span class="update_available">' . $arrUpdateCount[2]['red'] . '</span>'; } elseif ($arrUpdateCount[2]['yellow']) { $badge = '<span class="update_available_yellow">' . $arrUpdateCount[2]['yellow'] . '</span>'; } $this->tpl->assign_vars(array('BADGE_2' => $badge)); //================================================================= //Portal Modules $arrTmpModules = array(); if (isset($arrExtensionList[3]) && is_array($arrExtensionList[3])) { foreach ($arrExtensionList[3] as $id => $extension) { $arrTmpModules[$extension['plugin']] = $extension; } } $arrModules = $this->pdh->aget('portal', 'portal', 0, array($this->pdh->get('portal', 'id_list'))); if (is_array($arrModules)) { foreach ($arrModules as $id => $value) { $row = 'green'; $link = ''; $plugin_code = $value['path']; //Ignore Plugin Moduls in terms of repo-updates if (empty($value['plugin'])) { if (isset($urgendUpdates[$plugin_code])) { $row = 'red'; $link = '<a href="javascript:repo_update(3, \'' . $plugin_code . '\');">' . $this->user->lang('uc_bttn_update') . '</a>'; $arrUpdateCount[3]['red']++; } elseif (isset($allUpdates[$plugin_code])) { $row = 'yellow'; $link = '<a href="javascript:repo_update(3, \'' . $plugin_code . '\');">' . $this->user->lang('uc_bttn_update') . '</a>'; $arrUpdateCount[3]['yellow']++; } } //Add Reinstall Link if no update available if ($row == 'green') { $link = '<img src="' . $this->root_path . 'images/global/update.png" alt="' . $this->user->lang('reinstall') . '" title="' . $this->user->lang('reinstall') . '" onclick="javascript:reinstall_portal(\'' . $plugin_code . '\')" style="cursor:pointer;" />'; } $this->tpl->assign_block_vars('pm_row_' . $row, array('NAME' => isset($arrExtensionListNamed[3][$value['path']]) ? '<a href="javascript:repoinfo(' . $arrExtensionListNamed[3][$value['path']] . ')">' . $value['name'] . '</a>' : $value['name'], 'VERSION' => sanitize($value['version']), 'CODE' => sanitize($value['path']), 'CONTACT' => sanitize($value['autor']), 'ACTION_LINK' => $link, 'DESCRIPTION' => isset($arrTmpModules[$value['path']]) ? '<a href="javascript:repoinfo(' . $arrExtensionListNamed[3][$value['path']] . ')">' . sanitize(cut_text($arrTmpModules[$value['path']]['shortdesc'], 100)) . '</a>' : '')); } $this->confirm_delete($this->user->lang('portal_reinstall_warn'), 'manage_extensions.php' . $this->SID . '&cat=3', true, array('function' => 'reinstall_portal', 'handler' => 'mode')); } //Now bring the Extensions from the REPO to template if (isset($arrExtensionList[3]) && is_array($arrExtensionList[3])) { foreach ($arrExtensionList[3] as $id => $extension) { if (is_array(search_in_array($extension['plugin'], $arrModules, true, 'path'))) { continue; } $row = 'grey'; $link = '<a href="javascript:repo_install(3, \'' . sanitize($extension['plugin']) . '\');" >' . $this->user->lang('backup_action_download') . '</a>'; $this->tpl->assign_block_vars('pm_row_' . $row, array('NAME' => '<a href="javascript:repoinfo(' . $id . ')">' . $extension['name'] . '</a>', 'VERSION' => sanitize($extension['version']), 'CODE' => sanitize($extension['plugin']), 'CONTACT' => sanitize($extension['author']), 'DESCRIPTION' => '<a href="javascript:repoinfo(' . $id . ')">' . sanitize(cut_text($extension['shortdesc'])) . '</a>', 'ACTION_LINK' => $link, 'RATING' => $this->jquery->StarRating('extension_' . md5($extension['plugin']), array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5), '', $extension['rating'], true))); } } $badge = ''; if ($arrUpdateCount[3]['red']) { $badge = '<span class="update_available">' . count($arrUpdateCount[3]['red']) . '</span>'; } elseif ($arrUpdateCount[3]['yellow']) { $badge = '<span class="update_available_yellow">' . count($arrUpdateCount[3]['yellow']) . '</span>'; } $this->tpl->assign_vars(array('BADGE_3' => $badge)); //================================================================= //Games $arrGames = $this->game->get_games(); $arrGameVersions = $this->game->get_versions(); $arrTmpExtension = array(); if (isset($arrExtensionList[7]) && is_array($arrExtensionList[7])) { foreach ($arrExtensionList[7] as $id => $extension) { $arrTmpExtension[$extension['plugin']] = $extension; } } if (is_array($arrGames)) { foreach ($arrGames as $id => $value) { $plugin_code = $value; if (isset($urgendUpdates[$plugin_code])) { $row = 'red'; $link = '<a href="javascript:repo_update(7, \'' . $plugin_code . '\');">' . $this->user->lang('uc_bttn_update') . '</a>'; $arrUpdateCount[7]['red']++; } elseif (isset($allUpdates[$plugin_code])) { $row = 'yellow'; $link = '<a href="javascript:repo_update(7, \'' . $plugin_code . '\');">' . $this->user->lang('uc_bttn_update') . '</a>'; $arrUpdateCount[7]['yellow']++; } else { $row = 'green'; $link = ''; } $this->tpl->assign_block_vars('games_row_' . $row, array('NAME' => isset($arrExtensionListNamed[7][$plugin_code]) ? '<a href="javascript:repoinfo(' . $arrExtensionListNamed[7][$plugin_code] . ')">' . $this->game->game_name($plugin_code) . '</a>' : $this->game->game_name($plugin_code), 'VERSION' => $arrGameVersions[$plugin_code], 'CODE' => sanitize($plugin_code), 'CONTACT' => isset($arrTmpExtension[$plugin_code]) ? $arrTmpExtension[$plugin_code]['author'] : '', 'DESCRIPTION' => isset($arrTmpExtension[$plugin_code]) ? '<a href="javascript:repoinfo(' . $arrExtensionListNamed[7][$plugin_code] . ')">' . cut_text($arrTmpExtension[$plugin_code]['shortdesc'], 100) . '</a>' : '', 'RATING' => isset($arrTmpExtension[$plugin_code]) ? $this->jquery->StarRating('extension_' . md5($arrTmpExtension[$plugin_code]['plugin']), array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5), '', $arrTmpExtension[$plugin_code]['rating'], true) : '', 'ACTION_LINK' => $link)); } } //Now bring the Extensions from the REPO to template if (isset($arrExtensionList[7]) && is_array($arrExtensionList[7])) { foreach ($arrExtensionList[7] as $id => $extension) { if (in_array($extension['plugin'], $arrGames)) { continue; } $row = 'grey'; $link = '<a href="javascript:repo_install(7, \'' . sanitize($extension['plugin']) . '\');" >' . $this->user->lang('backup_action_download') . '</a>'; $this->tpl->assign_block_vars('games_row_' . $row, array('NAME' => '<a href="javascript:repoinfo(' . $id . ')">' . $extension['name'] . '</a>', 'VERSION' => sanitize($extension['version']), 'CODE' => sanitize($extension['plugin']), 'CONTACT' => sanitize($extension['author']), 'DESCRIPTION' => sanitize(cut_text($extension['shortdesc'], 100)), 'ACTION_LINK' => $link, 'RATING' => $this->jquery->StarRating('extension_' . md5($extension['plugin']), array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5), '', $extension['rating'], true))); } } $badge = ''; if ($arrUpdateCount[7]['red']) { $badge = '<span class="update_available">' . $arrUpdateCount[7]['red'] . '</span>'; } elseif ($arrUpdateCount[7]['yellow']) { $badge = '<span class="update_available_yellow">' . $arrUpdateCount[7]['yellow'] . '</span>'; } $this->tpl->assign_vars(array('BADGE_7' => $badge)); //================================================================= //Languages $arrLanguages = $arrLanguageVersions = array(); // Build language array if ($dir = @opendir($this->core->root_path . 'language/')) { while ($file = @readdir($dir)) { if (!is_file($this->root_path . 'language/' . $file) && !is_link($this->root_path . 'language/' . $file) && valid_folder($file)) { include $this->root_path . 'language/' . $file . '/lang_main.php'; $lang_name_tp = $lang['ISO_LANG_NAME'] ? $lang['ISO_LANG_NAME'] . ' (' . $lang['ISO_LANG_SHORT'] . ')' : ucfirst($file); $arrLanguages[$file] = $lang_name_tp; $arrLanguageVersions[$file] = $lang['LANG_VERSION']; } } } if (is_array($arrLanguages)) { foreach ($arrLanguages as $id => $value) { $plugin_code = $id; if (isset($urgendUpdates[$plugin_code])) { $row = 'red'; $link = '<a href="javascript:repo_update(11, \'' . $plugin_code . '\');">' . $this->user->lang('uc_bttn_update') . '</a>'; $arrUpdateCount[11]['red']++; } elseif (isset($allUpdates[$plugin_code])) { $row = 'yellow'; $link = '<a href="javascript:repo_update(11, \'' . $plugin_code . '\');">' . $this->user->lang('uc_bttn_update') . '</a>'; $arrUpdateCount[11]['yellow']++; } else { $row = 'green'; $link = ''; } $this->tpl->assign_block_vars('language_row_' . $row, array('NAME' => isset($arrExtensionListNamed[11][$plugin_code]) ? '<a href="javascript:repoinfo(' . $arrExtensionListNamed[11][$plugin_code] . ')">' . $value . '</a>' : $value, 'VERSION' => $arrLanguageVersions[$plugin_code], 'ACTION_LINK' => $link)); } } //Now bring the Extensions from the REPO to template if (isset($arrExtensionList[11]) && is_array($arrExtensionList[11])) { foreach ($arrExtensionList[11] as $id => $extension) { if (isset($arrLanguages[$extension['plugin']])) { continue; } $row = 'grey'; $link = '<a href="javascript:repo_install(11, \'' . sanitize($extension['plugin']) . '\');" >' . $this->user->lang('backup_action_download') . '</a>'; $this->tpl->assign_block_vars('language_row_' . $row, array('NAME' => '<a href="javascript:repoinfo(' . $id . ')">' . $extension['name'] . '</a>', 'VERSION' => sanitize($extension['version']), 'ACTION_LINK' => $link)); } } $badge = ''; if ($arrUpdateCount[11]['red']) { $badge = '<span class="update_available">' . $arrUpdateCount[11]['red'] . '</span>'; } elseif ($arrUpdateCount[11]['yellow']) { $badge = '<span class="update_available_yellow">' . $arrUpdateCount[11]['yellow'] . '</span>'; } $this->tpl->assign_vars(array('BADGE_11' => $badge)); //================================================================= //Common Output //Tabs $this->jquery->Tab_header('plus_plugins_tab', true); if ($this->in->exists('tab')) { $this->jquery->Tab_Select('plus_plugins_tab', $this->in->get('tab', 0)); } $this->jquery->Dialog('update_confirm', '', array('custom_js' => 'repo_update_start(cat, extensioncode);', 'message' => $this->user->lang('repo_updatewarning') . '<br /><br /><input type="checkbox" onclick="hide_update_warning(this.checked);" value="1" />' . $this->user->lang('repo_hide_updatewarning'), 'withid' => 'cat, extensioncode', 'width' => 300, 'height' => 300), 'confirm'); $this->jquery->Dialog('repoinfo', $this->user->lang('repo_extensioninfo'), array('url' => $this->root_path . "admin/manage_extensions.php" . $this->SID . "&info='+moduleid+'", 'width' => '700', 'height' => '600', 'withid' => 'moduleid')); foreach ($this->repo->DisplayCategories() as $key => $category) { $this->tpl->assign_vars(array('L_CATEGORY_' . $key => $category)); } $this->tpl->assign_vars(array('S_HIDE_UPDATEWARNING' => (int) $this->config->get('repo_hideupdatewarning'), 'CSRF_MODE_TOKEN' => $this->CSRFGetToken('mode'), 'CSRF_UPDATEWARNING_TOKEN' => $this->CSRFGetToken('hide_update_warning'))); $this->tpl->add_css(' .ui-progressbar { position:relative; height:30px;} .nl_progressbar_label { position: absolute; width: 90%; text-align: center; line-height: 30px; left:5%; right:5%;} '); $this->core->set_vars(array('page_title' => $this->user->lang('extensions'), 'template_file' => 'admin/manage_extensions.html', 'display' => true)); }
public function display() { //Show error / success messages if ($this->in->exists('mes')) { $arrMessage = unserialize(base64_decode($this->in->get('mes'))); if (isset($arrMessage[0]) && $arrMessage[1]) { $this->core->message($arrMessage[0], $arrMessage[1], $arrMessage[2]); } } //Get Extensions $arrExtensionList = $this->repo->getExtensionList(); $arrExtensionListNamed = array(); if (is_array($arrExtensionList)) { foreach ($arrExtensionList as $catid => $extensions) { if (is_array($extensions)) { foreach ($extensions as $id => $ext) { if (!isset($arrExtensionListNamed[$catid])) { $arrExtensionListNamed[$catid] = array(); } $arrExtensionListNamed[$catid][$ext['plugin']] = $id; } } } } //Get Updates $urgendUpdates = $this->repo->BuildUpdateArray(); $allUpdates = $this->repo->BuildUpdateArray(false); $arrUpdateCount = array(1 => array('red' => 0, 'yellow' => 0), 2 => array('red' => 0, 'yellow' => 0), 3 => array('red' => 0, 'yellow' => 0), 4 => array('red' => 0, 'yellow' => 0), 7 => array('red' => 0, 'yellow' => 0), 11 => array('red' => 0, 'yellow' => 0)); //================================================================= //Plugins $this->pm->search(); //search for new plugins $plugins_array = $this->pm->get_plugins(PLUGIN_ALL); //maybe plugins want to auto-install portalmodules $this->portal->get_all_modules(); $plugin_count = count($plugins_array); $db_plugins = $this->pdh->get('plugins', 'id_list'); foreach ($plugins_array as $plugin_code) { if ($plugin_code == 'pluskernel') { continue; } $contact = $this->pm->get_data($plugin_code, 'contact'); $version = $this->pm->get_data($plugin_code, 'version'); $description = $this->pm->get_data($plugin_code, 'description'); $long_description = $this->pm->get_data($plugin_code, 'long_description'); $manuallink = $this->pm->get_data($plugin_code, 'manuallink'); $homepagelink = $this->pm->get_data($plugin_code, 'homepage'); $author = $this->pm->get_data($plugin_code, 'author'); $bugtracker_url = isset($arrExtensionListNamed[1][$plugin_code]) ? sanitize($this->pdh->get('repository', 'bugtracker_url', array(1, $arrExtensionListNamed[1][$plugin_code]))) : ''; if ($this->pm->check($plugin_code, PLUGIN_BROKEN)) { //Delete it from database if plugin is broken - means it isn't there anymore. $this->pm->delete($plugin_code); /* $this->tpl->assign_block_vars('plugins_row_broken', array( 'NAME' => $plugin_code, 'CODE' => $plugin_code, 'DELETE' => (in_array($plugin_code, $db_plugins)) ? true : false, 'DEL_LINK' => 'manage_extensions.php'.$this->SID.'&cat=1&mode=delete&code='.$plugin_code.'&link_hash='.$this->CSRFGetToken('mode'), )); */ continue; } //dependencies $dep['plusv'] = $this->pm->check_dependency($plugin_code, 'plus_version'); $dep['games'] = $this->pm->check_dependency($plugin_code, 'games'); $dep['phpf'] = $this->pm->check_dependency($plugin_code, 'php_functions'); //show missing functions $deptt['phpf'] = $this->user->lang('plug_dep_phpf'); $needed_functions = $this->pm->get_plugin($plugin_code)->get_dependency('php_functions'); if (is_array($needed_functions) && count($needed_functions) > 0) { $deptt['phpf'] .= ':<br />'; foreach ($needed_functions as $function) { $deptt['phpf'] .= function_exists($function) ? '<span class="positive">' . $function . '</span><br />' : '<span class="negative">' . $function . '</span><br />'; } } $dep_all = $dep['plusv'] && $dep['games'] && $dep['phpf']; if ($this->pm->check($plugin_code, PLUGIN_DISABLED)) { $link = $dep_all ? '<a href="manage_extensions.php' . $this->SID . '&cat=1&mode=enable&code=' . $plugin_code . '&link_hash=' . $this->CSRFGetToken('mode') . '" title="' . $this->user->lang('enable') . '"><i class="fa fa-lg fa-toggle-off"></i></a>' : '<i class="fa fa-lg fa-exclamation-triangle" title="' . $this->user->lang('plug_dep_broken_deps') . '"></i>'; $row = 'yellow'; } elseif ($this->pm->check($plugin_code, PLUGIN_INSTALLED)) { if (isset($urgendUpdates[$plugin_code])) { $row = 'red'; $link = '<a href="javascript:repo_update(' . $urgendUpdates[$plugin_code]['plugin_id'] . ', 1, \'' . $plugin_code . '\');" class="needs_update" data-id="' . $urgendUpdates[$plugin_code]['plugin_id'] . '" data-category="1" data-code="' . $plugin_code . '" title="' . $this->user->lang('uc_bttn_update') . '"><i class="fa fa-lg fa-refresh"></i>'; $arrUpdateCount[1]['red']++; } else { $row = 'green'; $link = $dep_all ? '<a href="manage_extensions.php' . $this->SID . '&cat=1&mode=uninstall&code=' . $plugin_code . '&link_hash=' . $this->CSRFGetToken('mode') . '" title="' . $this->user->lang('uninstall') . '"><i class="fa fa-lg fa-toggle-on"></i></a>' : '<i class="fa fa-lg fa-exclamation-triangle" title="' . $this->user->lang('plug_dep_broken_deps') . '"></i>'; } } elseif (isset($allUpdates[$plugin_code])) { $row = 'yellow'; $link = '<a href="javascript:repo_update(' . $allUpdates[$plugin_code]['plugin_id'] . ', 1, \'' . $plugin_code . '\');" class="needs_update" data-id="' . $allUpdates[$plugin_code]['plugin_id'] . '" data-category="1" data-code="' . $plugin_code . '" title="' . $this->user->lang('uc_bttn_update') . '"><i class="fa fa-lg fa-refresh"></i></a>'; $arrUpdateCount[1]['yellow']++; $link .= ' <a href="manage_extensions.php' . $this->SID . '&cat=1&mode=remove&code=' . $plugin_code . '&link_hash=' . $this->CSRFGetToken('mode') . '" title="' . $this->user->lang('delete') . '"><i class="fa fa-lg fa-trash-o"></i></a>'; } else { $row = 'grey'; $link = $dep_all ? '<a href="manage_extensions.php' . $this->SID . '&cat=1&mode=install&code=' . $plugin_code . '&link_hash=' . $this->CSRFGetToken('mode') . '" title="' . $this->user->lang('install') . '"><i class="fa fa-lg fa-toggle-off"></i></a>' : '<i class="fa fa-lg fa-exclamation-triangle" title="' . $this->user->lang('plug_dep_broken_deps') . '"></i>'; $link .= ' <a href="manage_extensions.php' . $this->SID . '&cat=1&mode=remove&code=' . $plugin_code . '&link_hash=' . $this->CSRFGetToken('mode') . '" title="' . $this->user->lang('delete') . '"><i class="fa fa-lg fa-trash-o"></i></a>'; } $this->tpl->assign_block_vars('plugins_row_' . $row, array('NAME' => isset($arrExtensionListNamed[1][$plugin_code]) ? '<a href="javascript:repoinfo(' . $arrExtensionListNamed[1][$plugin_code] . ')">' . $this->pm->get_data($plugin_code, 'name') . '</a>' : $this->pm->get_data($plugin_code, 'name'), 'VERSION' => !empty($version) ? $version : ' ', 'CODE' => $plugin_code, 'CONTACT' => !empty($contact) ? !empty($author) ? '<a href="mailto:' . $contact . '">' . $author . '</a>' : '<a href="mailto:' . $contact . '">' . $contact . '</a>' : $author, 'DESCRIPTION' => !empty($description) ? $description : ' ', 'LONG_DESCRIPTION' => $long_description, 'HOMEPAGE_LINK' => $homepagelink != '' ? $homepagelink : false, 'HOMEPAGE' => $this->user->lang('homepage'), 'MANUAL_LINK' => $manuallink != '' ? $manuallink : false, 'MANUAL' => $this->user->lang('manual'), 'ACTION_LINK' => $link, 'BUGTRACKER_URL' => $bugtracker_url)); foreach ($dep as $key => $depdata) { $tt = isset($deptt[$key]) ? $deptt[$key] : $this->user->lang('plug_dep_' . $key); $this->tpl->assign_block_vars('plugins_row_' . $row . '.dep_row', array('DEPENDENCY_TT' => $tt, 'DEPENDENCY_NAME' => $this->user->lang('plug_dep_' . $key . '_short'), 'ICON' => $depdata ? 'eqdkp-icon-online' : 'eqdkp-icon-offline')); } } //Now bring the Extensions from the REPO to template if (isset($arrExtensionList[1]) && is_array($arrExtensionList[1])) { foreach ($arrExtensionList[1] as $id => $extension) { if ($this->pm->search($extension['plugin']) || $extension['plugin'] == 'pluskernel') { continue; } $row = 'grey_repo'; $dep['plusv'] = version_compare($extension['dep_coreversion'], $this->config->get('plus_version'), '<='); $dep['games'] = 'skip'; $dep['phpf'] = 'skip'; $dl_link = '<a href="javascript:repo_install(' . $extension['plugin_id'] . ', 1, \'' . sanitize($extension['plugin']) . '\');" ><i class="fa fa-toggle-off fa-lg" title="' . $this->user->lang('install') . '"></i></a>'; $link = $dep['plusv'] ? $dl_link : ''; $this->tpl->assign_block_vars('plugins_row_' . $row, array('NAME' => '<a href="javascript:repoinfo(' . $id . ')">' . $extension['name'] . '</a>', 'VERSION' => sanitize($extension['version']), 'CODE' => sanitize($extension['plugin']), 'CONTACT' => sanitize($extension['author']), 'DESCRIPTION' => sanitize($extension['description']), 'ACTION_LINK' => $link, 'BUGTRACKER_URL' => sanitize($extension['bugtracker_url']))); foreach ($dep as $key => $depdata) { $tt = $this->user->lang('plug_dep_' . $key); $this->tpl->assign_block_vars('plugins_row_' . $row . '.dep_row', array('DEPENDENCY_TT' => $tt, 'DEPENDENCY_NAME' => $this->user->lang('plug_dep_' . $key . '_short'), 'ICON' => $depdata ? 'eqdkp-icon-online' : 'eqdkp-icon-offline')); } } } $badge = ''; if ($arrUpdateCount[1]['red']) { $badge = '<span class="update_available">' . (int) $arrUpdateCount[1]['red'] . '</span>'; } elseif ($arrUpdateCount[1]['yellow']) { $badge = '<span class="update_available_yellow">' . (int) $arrUpdateCount[1]['yellow'] . '</span>'; } $this->tpl->assign_vars(array('DEP_COUNT' => 3, 'BADGE_1' => $badge)); //================================================================= //Templates $default_style = $this->config->get('default_style'); $arrTemplates = $this->pdh->get('styles', 'styles'); $arrLocalStyleUpdates = $this->objStyles->getLocalStyleUpdates(); $arrUninstalledStyles = $this->objStyles->getUninstalledStyles(); $arrStyles = array(); foreach ($arrUninstalledStyles as $key => $install_xml) { $plugin_code = $key; if (isset($allUpdates[$plugin_code])) { $row = 'yellow'; $link = '<a href="javascript:repo_update(' . $allUpdates[$plugin_code]['plugin_id'] . ',2, \'' . $plugin_code . '\');" class="needs_update" data-id="' . $allUpdates[$plugin_code]['plugin_id'] . '" data-category="2" data-code="' . $plugin_code . '" title="' . $this->user->lang('uc_bttn_update') . '"><i class="fa fa-lg fa-refresh"></i></a>'; $link .= ' <a href="manage_extensions.php' . $this->SID . '&cat=2&mode=remove&code=' . $plugin_code . '&link_hash=' . $this->CSRFGetToken('mode') . '" title="' . $this->user->lang('delete') . '"><i class="fa fa-lg fa-trash-o"></i></a>'; $arrUpdateCount[2]['yellow']++; } else { $row = 'grey'; $link = '<a href="manage_extensions.php' . $this->SID . '&cat=2&mode=install&code=' . $key . '&link_hash=' . $this->CSRFGetToken('mode') . '" title="' . $this->user->lang('install') . '"><i class="fa fa-lg fa-toggle-off"></i></a>'; $link .= ' <a href="manage_extensions.php' . $this->SID . '&cat=2&mode=remove&code=' . $plugin_code . '&link_hash=' . $this->CSRFGetToken('mode') . '" title="' . $this->user->lang('delete') . '"><i class="fa fa-lg fa-trash-o"></i></a>'; } $screenshot = ''; if (file_exists($this->root_path . 'templates/' . $plugin_code . '/screenshot.png')) { $screenshot = '<img src="' . $this->root_path . 'templates/' . $plugin_code . '/screenshot.png" style="max-width:300px;" alt="" />'; } elseif (file_exists($this->root_path . 'templates/' . $plugin_code . '/screenshot.jpg')) { $screenshot = '<img src="' . $this->root_path . 'templates/' . $plugin_code . '/screenshot.jpg" style="max-width:300px;" alt="" />'; } $this->tpl->assign_block_vars('styles_row_' . $row, array('TT_CONTENT' => $screenshot, 'TT_NAME' => $install_xml->name ? $install_xml->name : stripslashes($key), 'VERSION' => $install_xml->version, 'AUTHOR' => $install_xml->authorEmail != "" ? '<a href="mailto:' . $install_xml->authorEmail . '">' . $install_xml->author . '</a>' : $install_xml->author, 'ACTION_LINK' => $link, 'TEMPLATE' => $key)); $arrStyles[] = $install_xml->folder ? $install_xml->folder : stripslashes($key); } foreach ($arrTemplates as $row) { $screenshot = ''; if (file_exists($this->root_path . 'templates/' . $row['template_path'] . '/screenshot.png')) { $screenshot = '<img src="' . $this->root_path . 'templates/' . $row['template_path'] . '/screenshot.png" style="max-width:300px;" alt="" />'; } elseif (file_exists($this->root_path . 'templates/' . $row['template_path'] . '/screenshot.jpg')) { $screenshot = '<img src="' . $this->root_path . 'templates/' . $row['template_path'] . '/screenshot.jpg" style="max-width:300px;" alt="" />'; } $plugin_code = $row['template_path']; if (isset($urgendUpdates[$plugin_code])) { if (isset($arrLocalStyleUpdates[$plugin_code])) { $rowname = 'red_local'; $link = '<a href="manage_extensions.php' . $this->SID . '&cat=2&mode=update&code=' . $row['style_id'] . '&link_hash=' . $this->CSRFGetToken('mode') . '" title="' . $this->user->lang('uc_bttn_update') . '"><i class="fa fa-lg fa-refresh"></i></a>'; } else { $rowname = 'red'; $link = '<a href="javascript:repo_update(' . $urgendUpdates[$plugin_code]['plugin_id'] . ', 2, \'' . $plugin_code . '\');" class="needs_update" data-id="' . $urgendUpdates[$plugin_code]['plugin_id'] . '" data-category="2" data-code="' . $plugin_code . '" title="' . $this->user->lang('uc_bttn_update') . '"><i class="fa fa-lg fa-refresh"></i></a>'; } $arrUpdateCount[2]['red']++; } elseif (isset($allUpdates[$plugin_code])) { $rowname = 'yellow'; $link = '<a href="javascript:repo_update(' . $allUpdates[$plugin_code]['plugin_id'] . ', 2, \'' . $plugin_code . '\');" class="needs_update" data-id="' . $allUpdates[$plugin_code]['plugin_id'] . '" data-category="2" data-code="' . $plugin_code . '" title="' . $this->user->lang('uc_bttn_update') . '"><i class="fa fa-lg fa-refresh"></i></a>'; $arrUpdateCount[2]['yellow']++; } else { $rowname = 'green'; $link = $row['style_id'] == $default_style ? '' : '<a href="javascript:style_delete_warning(' . $row['style_id'] . ');" title="' . $this->user->lang('uninstall') . '"><i class="fa fa-lg fa-toggle-on"></i></a>'; } $this->jquery->Dialog('style_preview', $this->user->lang('template_preview'), array('url' => $this->server_path . "" . $this->SID . "&style='+ styleid+'", 'width' => '750', 'height' => '520', 'modal' => true, 'withid' => 'styleid')); $this->tpl->assign_block_vars('styles_row_' . $rowname, array('ID' => $row['style_id'], 'U_EDIT_STYLE' => 'manage_styles.php' . $this->SID . '&edit=true&styleid=' . $row['style_id'], 'U_DOWNLOAD_STYLE' => 'manage_extensions.php' . $this->SID . '&cat=2&mode=export&code=' . $row['style_id'] . '&link_hash=' . $this->CSRFGetToken('mode'), 'L_ENABLE' => $row['enabled'] == '1' ? $this->user->lang('deactivate') : $this->user->lang('activate'), 'ENABLE' => $row['enabled'] == '1' ? 'fa fa-check-square-o fa-lg icon-color-green' : 'fa fa-square-o fa-lg icon-color-red', 'U_ENABLE' => $row['enabled'] == '1' ? 'manage_extensions.php' . $this->SID . '&cat=2&mode=disable&code=' . $row['style_id'] . '&link_hash=' . $this->CSRFGetToken('mode') : 'manage_extensions.php' . $this->SID . '&mode=enable&cat=2&code=' . $row['style_id'] . '&link_hash=' . $this->CSRFGetToken('mode'), 'S_DEFAULT' => $row['style_id'] == $default_style ? true : false, 'S_DEACTIVATED' => $row['enabled'] != '1' ? true : false, 'STANDARD' => $row['style_id'] == $default_style ? 'checked="checked"' : '', 'VERSION' => $row['style_version'], 'AUTHOR' => $row['style_contact'] != "" ? '<a href="mailto:' . $row['style_contact'] . '">' . $row['style_author'] . '</a>' : $row['style_author'], 'TT_CONTENT' => $screenshot, 'TT_NAME' => isset($arrExtensionListNamed[2][$plugin_code]) ? '<a href="javascript:repoinfo(' . $arrExtensionListNamed[2][$plugin_code] . ')">' . $row['style_name'] . '</a>' : $row['style_name'], 'TEMPLATE' => $row['template_path'], 'USERS' => $row['users'], 'ACTION_LINK' => $link, 'BUGTRACKER_URL' => isset($arrExtensionListNamed[2][$plugin_code]) ? sanitize($this->pdh->get('repository', 'bugtracker_url', array(2, $arrExtensionListNamed[2][$plugin_code]))) : '')); $arrStyles[] = $plugin_code; } //Now bring the Extensions from the REPO to template if (isset($arrExtensionList[2]) && is_array($arrExtensionList[2])) { foreach ($arrExtensionList[2] as $id => $extension) { if (in_array($extension['plugin'], $arrStyles)) { continue; } $row = 'grey'; $link = '<a href="javascript:repo_install(' . $extension['plugin_id'] . ',2, \'' . sanitize($extension['plugin']) . '\');" ><i class="fa fa-toggle-off fa-lg" title="' . $this->user->lang('install') . '"></i></a>'; $this->tpl->assign_block_vars('styles_row_' . $row, array('TT_NAME' => '<a href="javascript:repoinfo(' . $id . ')">' . $extension['name'] . '</a>', 'VERSION' => sanitize($extension['version']), 'CODE' => sanitize($extension['plugin']), 'AUTHOR' => sanitize($extension['author']), 'TEMPLATE' => sanitize($extension['plugin']), 'DESCRIPTION' => sanitize($extension['description']), 'ACTION_LINK' => $link, 'BUGTRACKER_URL' => sanitize($extension['bugtracker_url']), 'TT_CONTENT' => '<img src="http://cdn1.eqdkp-plus.eu/repository/screenshot.php?extid=' . $extension['plugin_id'] . '" style="max-width:300px;" alt="No Preview available" />')); } } $this->jquery->dialog('style_default_info', $this->user->lang('default_style'), array('message' => $this->user->lang('style_default_info') . '<br /><br /><label><input type="radio" name="override" value="0" onchange="change_override(1);">' . $this->user->lang('yes') . '</label> <label><input type="radio" name="override" value="1" checked="checked" onchange="change_override(0);">' . $this->user->lang('no') . '</label>', 'custom_js' => 'submit_form();', 'height' => 200), 'confirm'); $this->jquery->dialog('style_reset_warning', $this->user->lang('reset_style'), array('message' => $this->user->lang('style_confirm_reset'), 'height' => 200, 'url' => $this->root_path . 'admin/manage_extensions.php' . $this->SID . '&link_hash=' . $this->CSRFGetToken('mode') . "&cat=2&mode=reset&code='+ styleid+'", 'withid' => 'styleid'), 'confirm'); $this->jquery->dialog('style_delete_warning', $this->user->lang('delete_style'), array('message' => $this->user->lang('confirm_delete_style'), 'height' => 200, 'url' => $this->root_path . 'admin/manage_extensions.php' . $this->SID . '&link_hash=' . $this->CSRFGetToken('mode') . "&cat=2&mode=uninstall&code='+ styleid+'", 'withid' => 'styleid'), 'confirm'); $badge = ''; if ($arrUpdateCount[2]['red']) { $badge = '<span class="update_available">' . (int) $arrUpdateCount[2]['red'] . '</span>'; } elseif ($arrUpdateCount[2]['yellow']) { $badge = '<span class="update_available_yellow">' . (int) $arrUpdateCount[2]['yellow'] . '</span>'; } $this->tpl->assign_vars(array('BADGE_2' => $badge)); //================================================================= //Portal Modules $arrTmpModules = array(); if (isset($arrExtensionList[3]) && is_array($arrExtensionList[3])) { foreach ($arrExtensionList[3] as $id => $extension) { $arrTmpModules[$extension['plugin']] = $extension; } } $arrModules = $this->pdh->aget('portal', 'portal', 0, array($this->pdh->get('portal', 'id_list'))); if (is_array($arrModules)) { foreach ($arrModules as $id => $value) { if ((int) $value['child'] === 1) { continue; } $row = 'green'; $link = ''; $plugin_code = $value['path']; $class_name = $plugin_code . '_portal'; $del_link = ""; //Ignore Plugin Moduls in terms of repo-updates if (empty($value['plugin'])) { if (isset($urgendUpdates[$plugin_code])) { $row = 'red'; $link = '<a href="javascript:repo_update(' . $urgendUpdates[$plugin_code]['plugin_id'] . ',3, \'' . $plugin_code . '\');" class="needs_update" data-id="' . $urgendUpdates[$plugin_code]['plugin_id'] . '" data-category="3" data-code="' . $plugin_code . '" title="' . $this->user->lang('uc_bttn_update') . '"><i class="fa fa-refresh fa-lg"></i></a>'; $arrUpdateCount[3]['red']++; } elseif (isset($allUpdates[$plugin_code])) { $row = 'yellow'; $link = '<a href="javascript:repo_update(' . $allUpdates[$plugin_code]['plugin_id'] . ',3, \'' . $plugin_code . '\');" class="needs_update" data-id="' . $allUpdates[$plugin_code]['plugin_id'] . '" data-category="3" data-code="' . $plugin_code . '" title="' . $this->user->lang('uc_bttn_update') . '"><i class="fa fa-refresh fa-lg"></i></a>'; $arrUpdateCount[3]['yellow']++; } $del_link = '<a href="manage_extensions.php' . $this->SID . '&cat=3&mode=remove&code=' . $plugin_code . '&link_hash=' . $this->CSRFGetToken('mode') . '" title="' . $this->user->lang('delete') . '"><i class="fa fa-lg fa-trash-o"></i></a>'; } //Add Reinstall Link if no update available $reinst_link = '<i class="fa fa-retweet fa-lg" title="' . $this->user->lang('reinstall') . '" onclick="javascript:reinstall_portal(\'' . $plugin_code . '\')" style="cursor:pointer;"></i>'; $this->tpl->assign_block_vars('pm_row_' . $row, array('NAME' => isset($arrExtensionListNamed[3][$value['path']]) ? '<a href="javascript:repoinfo(' . $arrExtensionListNamed[3][$value['path']] . ')">' . $value['name'] . '</a>' : $value['name'], 'VERSION' => sanitize($value['version']), 'CODE' => sanitize($value['path']), 'CONTACT' => sanitize($class_name::get_data('contact')), 'ACTION_LINK' => $link, 'REINSTALL_LINK' => $row == 'green' ? $reinst_link : '', 'DELETE_LINK' => $del_link, 'DESCRIPTION' => isset($arrTmpModules[$value['path']]) ? '<a href="javascript:repoinfo(' . $arrExtensionListNamed[3][$value['path']] . ')">' . sanitize(cut_text($arrTmpModules[$value['path']]['description'], 100)) . '</a>' : '', 'BUGTRACKER_URL' => isset($arrExtensionListNamed[3][$plugin_code]) ? sanitize($this->pdh->get('repository', 'bugtracker_url', array(3, $arrExtensionListNamed[3][$plugin_code]))) : '')); } $this->confirm_delete($this->user->lang('portal_reinstall_warn'), 'manage_extensions.php' . $this->SID . '&cat=3', true, array('function' => 'reinstall_portal', 'handler' => 'mode')); } //Now bring the Extensions from the REPO to template if (isset($arrExtensionList[3]) && is_array($arrExtensionList[3])) { foreach ($arrExtensionList[3] as $id => $extension) { if (is_array(search_in_array($extension['plugin'], $arrModules, true, 'path'))) { continue; } $row = 'grey'; $link = '<a href="javascript:repo_install(' . $extension['plugin_id'] . ',3, \'' . sanitize($extension['plugin']) . '\');" title="' . $this->user->lang('install') . '"><i class="fa fa-toggle-off fa-lg"></i></a>'; $this->tpl->assign_block_vars('pm_row_' . $row, array('NAME' => '<a href="javascript:repoinfo(' . $id . ')">' . $extension['name'] . '</a>', 'VERSION' => sanitize($extension['version']), 'CODE' => sanitize($extension['plugin']), 'CONTACT' => sanitize($extension['author']), 'DESCRIPTION' => '<a href="javascript:repoinfo(' . $id . ')">' . sanitize(cut_text($extension['description'])) . '</a>', 'ACTION_LINK' => $link, 'RATING' => $this->jquery->starrating('extension_' . md5($extension['plugin']), $this->env->phpself, array('score' => $extension['rating'], 'readonly' => true)), 'BUGTRACKER_URL' => sanitize($extension['bugtracker_url']))); } } $badge = ''; if ($arrUpdateCount[3]['red']) { $badge = '<span class="update_available">' . (int) $arrUpdateCount[3]['red'] . '</span>'; } elseif ($arrUpdateCount[3]['yellow']) { $badge = '<span class="update_available_yellow">' . (int) $arrUpdateCount[3]['yellow'] . '</span>'; } $this->tpl->assign_vars(array('BADGE_3' => $badge)); //================================================================= //Games $arrGames = $this->game->get_games(); $arrGameVersions = $this->game->get_versions(); $arrGameAuthors = $this->game->get_authors(); $arrTmpExtension = array(); if (isset($arrExtensionList[7]) && is_array($arrExtensionList[7])) { foreach ($arrExtensionList[7] as $id => $extension) { $arrTmpExtension[$extension['plugin']] = $extension; } } if (is_array($arrGames)) { foreach ($arrGames as $id => $value) { $plugin_code = $value; if (isset($urgendUpdates[$plugin_code])) { $row = 'red'; $link = '<a href="javascript:repo_update(' . $urgendUpdates[$plugin_code]['plugin_id'] . ',7, \'' . $plugin_code . '\');" class="needs_update" data-id="' . $urgendUpdates[$plugin_code]['plugin_id'] . '" data-category="7" data-code="' . $plugin_code . '" title="' . $this->user->lang('uc_bttn_update') . '"><i class="fa fa-refresh fa-lg"></i></a>'; $arrUpdateCount[7]['red']++; } elseif (isset($allUpdates[$plugin_code])) { $row = 'yellow'; $link = '<a href="javascript:repo_update(' . $allUpdates[$plugin_code]['plugin_id'] . ',7, \'' . $plugin_code . '\');" class="needs_update" data-id="' . $allUpdates[$plugin_code]['plugin_id'] . '" data-category="7" data-code="' . $plugin_code . '" title="' . $this->user->lang('uc_bttn_update') . '"><i class="fa fa-refresh fa-lg" ></i></a>'; $arrUpdateCount[7]['yellow']++; } else { $row = 'green'; $link = ''; } $this->tpl->assign_block_vars('games_row_' . $row, array('NAME' => isset($arrExtensionListNamed[7][$plugin_code]) ? '<a href="javascript:repoinfo(' . $arrExtensionListNamed[7][$plugin_code] . ')">' . $this->game->game_name($plugin_code) . '</a>' : $this->game->game_name($plugin_code), 'VERSION' => $arrGameVersions[$plugin_code], 'CODE' => sanitize($plugin_code), 'CONTACT' => isset($arrTmpExtension[$plugin_code]) ? $arrTmpExtension[$plugin_code]['author'] : $arrGameAuthors[$plugin_code], 'DESCRIPTION' => isset($arrTmpExtension[$plugin_code]) ? '<a href="javascript:repoinfo(' . $arrExtensionListNamed[7][$plugin_code] . ')">' . cut_text($arrTmpExtension[$plugin_code]['description'], 100) . '</a>' : '', 'RATING' => isset($arrTmpExtension[$plugin_code]) ? $this->jquery->starrating('extension_' . md5($arrTmpExtension[$plugin_code]['plugin']), $this->env->phpself, array('score' => $arrTmpExtension[$plugin_code]['rating'], 'readonly' => true)) : '', 'ACTION_LINK' => $link, 'DELETE_LINK' => $plugin_code != $this->config->get('default_game') ? '<a href="manage_extensions.php' . $this->SID . '&cat=7&mode=remove&code=' . $plugin_code . '&link_hash=' . $this->CSRFGetToken('mode') . '" title="' . $this->user->lang('delete') . '"><i class="fa fa-lg fa-trash-o"></i></a>' : '', 'BUGTRACKER_URL' => isset($arrExtensionListNamed[7][$plugin_code]) ? sanitize($this->pdh->get('repository', 'bugtracker_url', array(7, $arrExtensionListNamed[7][$plugin_code]))) : '')); } } //Now bring the Extensions from the REPO to template if (isset($arrExtensionList[7]) && is_array($arrExtensionList[7])) { foreach ($arrExtensionList[7] as $id => $extension) { if (in_array($extension['plugin'], $arrGames)) { continue; } $row = 'grey'; $link = '<a href="javascript:repo_install(' . $extension['plugin_id'] . ',7, \'' . sanitize($extension['plugin']) . '\');" title="' . $this->user->lang('install') . '"><i class="fa fa-toggle-off fa-lg"></i></a>'; $this->tpl->assign_block_vars('games_row_' . $row, array('NAME' => '<a href="javascript:repoinfo(' . $id . ')">' . $extension['name'] . '</a>', 'VERSION' => sanitize($extension['version']), 'CODE' => sanitize($extension['plugin']), 'CONTACT' => sanitize($extension['author']), 'DESCRIPTION' => sanitize(cut_text($extension['description'], 100)), 'ACTION_LINK' => $link, 'RATING' => $this->jquery->starrating('extension_' . md5($extension['plugin']), $this->env->phpself, array('score' => $extension['rating'], 'readonly' => true)), 'BUGTRACKER_URL' => sanitize($extension['bugtracker_url']))); } } $badge = ''; if ($arrUpdateCount[7]['red']) { $badge = '<span class="update_available">' . (int) $arrUpdateCount[7]['red'] . '</span>'; } elseif ($arrUpdateCount[7]['yellow']) { $badge = '<span class="update_available_yellow">' . (int) $arrUpdateCount[7]['yellow'] . '</span>'; } $this->tpl->assign_vars(array('BADGE_7' => $badge)); //================================================================= //Languages $arrLanguages = $arrLanguageVersions = array(); // Build language array if ($dir = @opendir($this->core->root_path . 'language/')) { while ($file = @readdir($dir)) { if (!is_file($this->root_path . 'language/' . $file) && !is_link($this->root_path . 'language/' . $file) && valid_folder($file)) { include $this->root_path . 'language/' . $file . '/lang_main.php'; $lang_name_tp = $lang['ISO_LANG_NAME'] ? $lang['ISO_LANG_NAME'] . ' (' . $lang['ISO_LANG_SHORT'] . ')' : ucfirst($file); $arrLanguages[$file] = $lang_name_tp; $arrLanguageVersions[$file] = $lang['LANG_VERSION']; } } } if (is_array($arrLanguages)) { foreach ($arrLanguages as $id => $value) { $plugin_code = $id; if (isset($urgendUpdates[$plugin_code])) { $row = 'red'; $link = '<a href="javascript:repo_update(' . $urgendUpdates[$plugin_code]['plugin_id'] . ',11, \'' . $plugin_code . '\');" class="needs_update" data-id="' . $urgendUpdates[$plugin_code]['plugin_id'] . '" data-category="11" data-code="' . $plugin_code . '" title="' . $this->user->lang('uc_bttn_update') . '"><i class="fa fa-refresh fa-lg"></i></a>'; $arrUpdateCount[11]['red']++; } elseif (isset($allUpdates[$plugin_code])) { $row = 'yellow'; $link = '<a href="javascript:repo_update(' . $allUpdates[$plugin_code]['plugin_id'] . ',11, \'' . $plugin_code . '\');" class="needs_update" data-id="' . $allUpdates[$plugin_code]['plugin_id'] . '" data-category="11" data-code="' . $plugin_code . '" title="' . $this->user->lang('uc_bttn_update') . '"><i class="fa fa-refresh fa-lg"></i></a>'; $arrUpdateCount[11]['yellow']++; } else { $row = 'green'; $link = ''; } $this->tpl->assign_block_vars('language_row_' . $row, array('NAME' => isset($arrExtensionListNamed[11][$plugin_code]) ? '<a href="javascript:repoinfo(' . $arrExtensionListNamed[11][$plugin_code] . ')">' . $value . '</a>' : $value, 'VERSION' => $arrLanguageVersions[$plugin_code], 'ACTION_LINK' => $link, 'BUGTRACKER_URL' => isset($arrExtensionListNamed[11][$plugin_code]) ? sanitize($this->pdh->get('repository', 'bugtracker_url', array(11, $arrExtensionListNamed[11][$plugin_code]))) : '')); } } //Now bring the Extensions from the REPO to template if (isset($arrExtensionList[11]) && is_array($arrExtensionList[11])) { foreach ($arrExtensionList[11] as $id => $extension) { if (isset($arrLanguages[$extension['plugin']])) { continue; } $row = 'grey'; $link = '<a href="javascript:repo_install(' . $extension['plugin_id'] . ', 11, \'' . sanitize($extension['plugin']) . '\');" title="' . $this->user->lang('install') . '"><i class="fa fa-toggle-off fa-lg"></i></a>'; $this->tpl->assign_block_vars('language_row_' . $row, array('NAME' => '<a href="javascript:repoinfo(' . $id . ')">' . $extension['name'] . '</a>', 'VERSION' => sanitize($extension['version']), 'ACTION_LINK' => $link, 'BUGTRACKER_URL' => sanitize($extension['bugtracker_url']))); } } $badge = ''; if ($arrUpdateCount[11]['red']) { $badge = '<span class="update_available">' . (int) $arrUpdateCount[11]['red'] . '</span>'; } elseif ($arrUpdateCount[11]['yellow']) { $badge = '<span class="update_available_yellow">' . (int) $arrUpdateCount[11]['yellow'] . '</span>'; } $this->tpl->assign_vars(array('BADGE_11' => $badge)); //================================================================= //Common Output //Tabs $this->jquery->Tab_header('plus_plugins_tab', true); if ($this->in->exists('tab')) { $this->jquery->Tab_Select('plus_plugins_tab', $this->in->get('tab', 0)); } $this->jquery->Dialog('update_confirm', '', array('custom_js' => 'repo_update_start(extid, cat, extensioncode);', 'message' => $this->user->lang('repo_updatewarning') . '<br /><br /><input type="checkbox" onclick="hide_update_warning(this.checked);" value="1" />' . $this->user->lang('repo_hide_updatewarning'), 'withid' => 'extid, cat, extensioncode', 'width' => 300, 'height' => 300), 'confirm'); $this->jquery->Dialog('repoinfo', $this->user->lang('repo_extensioninfo'), array('url' => $this->root_path . "admin/manage_extensions.php" . $this->SID . "&info='+moduleid+'", 'width' => '700', 'height' => '600', 'withid' => 'moduleid')); foreach ($this->repo->DisplayCategories() as $key => $category) { $this->tpl->assign_vars(array('L_CATEGORY_' . $key => $category)); } $this->tpl->assign_vars(array('S_HIDE_UPDATEWARNING' => (int) $this->config->get('repo_hideupdatewarning'), 'CSRF_MODE_TOKEN' => $this->CSRFGetToken('mode'), 'CSRF_UPDATEWARNING_TOKEN' => $this->CSRFGetToken('hide_update_warning'), 'AUTOUPD_ON' => $this->in->get('autoupd', 0) ? true : false, 'AUTOUPD_CURRENT' => $this->in->get('current', 0), 'AUTOUPD_TRY' => $this->in->get('try', 0))); $this->tpl->add_css(' .ui-progressbar { position:relative; height:30px;} .nl_progressbar_label { position: absolute; width: 90%; text-align: center; line-height: 30px; left:5%; right:5%;} '); $this->core->set_vars(array('page_title' => $this->user->lang('extensions'), 'template_file' => 'admin/manage_extensions.html', 'display' => true)); }
/** * Searches a specific pattern in one or more albums / assets / fields * @param type $user the user who owns the personal bookmarks * @param type $search the pattern to search (array containing a selection of words to find) * @param type $fields the bookmark fields where to search : * it can be the title, the description and/or the keywords * @param type $level the level where to search * @param type $albums an array containing the albums where to search * @param type $asset a string containing a specific asset * @return the list of matching bookmarks; false if an error occurs; null * no bookmark matches the pattern */ function user_prefs_bookmarks_search($user, $search, $fields, $level, $albums, $asset = '') { // Sanity check if (!isset($user) || $user == '') { return null; } if (!isset($level) || $level < 0 || $level > 4) { $level = 0; } $bookmarks = array(); if (isset($asset) && $asset != '') { if (isset($albums[0]) && $albums[0] != '') { $bookmarks = user_prefs_asset_bookmarks_list_get($user, $albums[0], $asset); } } else { if (isset($albums) && count($albums) > 0) { foreach ($albums as $album) { $bookmarks = array_merge($bookmarks, user_prefs_album_bookmarks_list_get($user, $album)); } } } // we have now the list of all eligible bookmarks to search in if ((!isset($search) || count($search) == 0) && $level == 0) { return $bookmarks; } return search_in_array($search, $bookmarks, $fields, $level); }
public function get_key($intId) { $result = search_in_array($intId, $this->data, false, "id"); if (is_array($result) && count($result)) { $arrKey = array_keys($result); return $arrKey[0]; } return false; }
<?php define("checkaccess", true); require dirname(__FILE__) . "/incl/init.php"; require dirname(__FILE__) . "/incl/_header.php"; $getdata = query("SELECT\n*\nFROM tvevent\nWHERE epgData_yes=1\n LIMIT 10000"); foreach ($getdata as $part_array) { $meta = json_decode($part_array["epgData"], true); // print_r($meta); $genres = search_in_array("genre", $meta); if (!empty($genres)) { print_r($genres); foreach ($genres as $genre) { query("INSERT IGNORE INTO genres (genre,gtype) VALUES (" . escapesql(utf8_decode($genre)) . ",'')"); $getgenre = query("SELECT genres_id FROM genres WHERE `genre` =" . escapesql(utf8_decode($genre)) . ""); if (!empty($getgenre[0]["genres_id"])) { query("INSERT IGNORE INTO videos_genres (videos_id,genres_id) VALUES (" . escapesql($part_array["videos_id"]) . "," . escapesql($getgenre[0]["genres_id"]) . ")"); } } echo '<br>'; } } require dirname(__FILE__) . "/incl/_footer.php";
function csv_valid_voters($csvFields = array(), $query_result = array(), $fields = array(), $status = 0) { $data = array(); $emails = array_unique(array_values_recursive($csvFields)); $valid_voters_emails = array(); $valid_voters_id = array(); $valid_users_emails = array(); $i = 0; foreach ($emails as $email) { foreach ($query_result as $row) { if (search_in_array($email, $row)) { $valid_voters_id[$i][$fields[0]] = $row[$fields[0]]; $valid_voters_emails[$i] = $row[$fields[count($fields) - 1]]; $i++; } } } foreach ($emails as $email) { if (!in_array($email, $valid_voters_emails)) { $valid_users_emails[] = $email; } } if (!empty($valid_voters_id) && $status === 0) { return $valid_voters_id; } else { if (!empty($valid_users_emails) && $status === 1) { return $valid_users_emails; } else { return false; } } }
function search_in_array($value, $array) { if (in_array($value, $array)) { return true; } foreach ($array as $item) { if (is_array($item) && search_in_array($value, $item)) { return true; } } return false; }
function search_in_array($needle, $haystack) { $return = array(); if (is_array($haystack)) { foreach ($haystack as $key => $var) { if (stristr($key, $needle)) { if (is_array($var)) { $tmp = search_in_array($needle, $var); if ($tmp) { $return = $return + $tmp; } } else { if ($var) { $return[] = $var; } } } else { if (is_array($var)) { $tmp = search_in_array($needle, $var); if ($tmp) { $return = $return + $tmp; } } } } } return $return; }
public function get_userid($name) { $name = clean_username($name); if (is_array(search_in_array($name, $this->users, true, 'username_clean'))) { $array = array_keys(search_in_array($name, $this->users, true, 'username_clean')); return $array[0]; } else { return ANONYMOUS; } }