function public_news() { global $c, $s, $config; $news = array(); $res = $c->Execute("SELECT * FROM news n, news_" . $_SESSION["language"] . " nl WHERE n.id_news=nl.id_news AND n.status='a' order by date DESC"); $i = 0; while (!$res->EOF and $i < $config["news_count"]) { $row = $res->GetRowAssoc(false); $news[$i]["id_news"] = $row["id_news"]; $news[$i]["date"] = date("j F Y", strtotime($row["date"] . " + 1 sec")); $news[$i]["title"] = html_entity_decode($row["title"]); $news[$i]["content"] = cut_text(stripslashes($row["content"]), $config["news_length"]); $news[$i]["content"] = str_replace('{$config.company}', $config["company"], $news[$i]["content"]); $i++; $res->MoveNext(); } $s->assign("news", $news); }
function insert_fb_in_head() { global $post; if (!is_singular()) { //if it is not a post or a page echo '<meta property="fb:admins" content="690907201"/>'; echo '<meta property="og:title" content="' . get_bloginfo('name') . '"/>'; echo '<meta property="og:type" content="website"/>'; echo '<meta property="og:locale" content="fr_FR"/>'; echo '<meta property="og:url" content="' . get_bloginfo('url') . '"/>'; echo '<meta property="og:site_name" content="' . get_bloginfo('name') . ' : ' . get_bloginfo('description') . '"/>'; echo "<meta property=\"og:description\" content=\"" . get_bloginfo('description') . "\"/>"; echo '<meta property="og:image" content="' . get_bloginfo('stylesheet_directory') . '/images/avatar_fb.jpg" />'; return; } else { echo '<meta property="fb:admins" content="690907201"/>'; echo '<meta property="og:title" content="' . get_bloginfo('name') . " - " . get_the_title() . '"/>'; echo '<meta property="og:type" content="article"/>'; echo '<meta property="og:locale" content="fr_FR"/>'; echo '<meta property="og:url" content="' . get_permalink() . '"/>'; echo '<meta property="og:site_name" content="' . get_bloginfo('name') . ' : ' . get_bloginfo('description') . '"/>'; } $content = $post->post_content; $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); $meta = strip_tags($content); $meta = str_replace(array("\n", "\r", "\t"), ' ', $meta); $meta = cut_text($meta); echo "<meta property=\"og:description\" content=\"" . $meta . "\"/>"; $custom_fields = get_post_custom($post->ID); $elts = explode("\r\n", $custom_fields['illustration'][0]); if ("" . $elts[0] != "") { //the post does not have featured image, use a default image $img = catch_that_image(); } else { $img = $elts[0]; } echo '<meta property="og:image" content="' . $img . '"/>'; }
if (get('download') && $system->checkForRight('GENERAL')) { $file = base64_decode(get('download')); download_file($file); } function rcms_loadAdminLib($lib) { require_once ADMIN_PATH . 'libs/' . $lib . '.php'; } //------------------------------------------------------------------------------------------------------// // preparations... if (post('admin_selected_skin')) { setcookie('admin_skin', $_POST['admin_selected_skin'], FOREVER_COOKIE); rcms_redirect(''); } $admin_skin = cookie('admin_skin', 'default'); $admin_skin = cut_text(preg_replace("/[^a-zA-Z]+/", '', $admin_skin)); //only letters define('ADMIN_SKIN', ADMIN_PATH . 'skins/' . $admin_skin . '/'); $rights =& $system->rights; $root =& $system->root; if (!LOGGED_IN) { $message = __('Access denied'); $message .= '<br /> <form method="post" action=""> <input type="hidden" name="login_form" value="1" /> <table cellpadding="2" cellspacing="1" style="width: 100%;"> <tr> <td class="row1">' . __('Username') . ':</td> <td class="row1" style="width: 100%;"><input type="text" name="username" style="text-align: left; width: 95%;" /></td> </tr> <tr>
function rcms_parse_dynamik_menu($format) { global $system; function convertArray($ar) { $var = '{ '; foreach ($ar as $key => $val) { $var .= '"' . $key . '" : '; if (is_array($val)) { $var .= convertArray($val) . ', '; } else { $var .= '"' . $val . '", '; } } if ($var[strlen($var) - 2] == ',') { $var[strlen($var) - 2] = ' '; } return $var . '} '; } $pic_right = ' <b>�</b> '; //Commented becouse f*****g IE, Microsoft, Gates and his mother... //$pic_right = ' <img src = \''.SKIN_PATH.'arrow_right.gif\'>'; //$pic_down = '<img src = \''.SKIN_PATH.'arrow_down.gif\'>'; $pic_down = ''; $navigation = parse_ini_file(CONFIG_PATH . 'navigation.ini', true); $dyna = parse_ini_file(CONFIG_PATH . 'dynamik.ini', true); $result = array(); foreach ($navigation as $link) { if (substr($link['url'], 0, 9) == 'external:') { $target = '_blank'; $link['url'] = substr($link['url'], 9); } else { $target = ''; } $tdata = explode(':', $link['url'], 2); if (count($tdata) == 2) { list($modifier, $value) = $tdata; } else { $modifier = $tdata[0]; } if (!empty($value) && !empty($system->navmodifiers[$modifier])) { if ($clink = call_user_func($system->navmodifiers[$modifier]['m'], $value)) { $result[] = array($clink[0], empty($link['name']) ? $clink[1] : __($link['name']), $target); } } else { $result[] = array($link['url'], __($link['name'])); } } $menu = ' <script type="text/javascript" src="modules/jsc/navigation.js"></script> <div class="dhtml_menu"> <div class="horz_menu"> '; foreach ($result as $item) { if (empty($item[2])) { $item[2] = '_top'; } if (empty($item[4])) { $item[4] = ''; } // Begin of Icons support by Migel //$arr = array(); if ($item[0] == '?module=articles') { if (!isset($dyna['use_art'])) { $articles = new articles(); $containers = $articles->getContainers(); $count = 0; if (is_array($containers)) { $item[1] .= ' ' . $pic_down; $containers = array_reverse($containers); foreach ($containers as $conkey => $conval) { $count++; if ($count != $dyna['max']) { $arr['ddm_article'][' ' . cut_text($conval) . ' '] = '?module=articles&c=' . $conkey; if (!isset($dyna['min'])) { $articles->setWorkContainer($conkey); $art = $articles->getCategories(); $count2 = 0; if (is_array($art)) { unset($arr['ddm_article'][' ' . cut_text($conval) . ' ']); $arr['ddm_article'][$pic_right . ' ' . cut_text($conval) . ' '] = array('-' => '?module=articles&c=' . $conkey); $art = array_reverse($art); foreach ($art as $artkey => $artval) { $count2++; if ($count2 != $dyna['max']) { $arr['ddm_article'][$pic_right . ' ' . cut_text($conval) . ' '][' ' . cut_text($artval['title']) . ' '] = '?module=articles&c=' . $conkey . '&b=' . $artval['id']; $art2 = $articles->getArticles($artval['id']); $count3 = 0; if (count($art2) > 0) { unset($arr['ddm_article'][$pic_right . ' ' . cut_text($conval) . ' '][' ' . cut_text($artval['title']) . ' ']); $arr['ddm_article'][$pic_right . ' ' . cut_text($conval) . ' '][$pic_right . ' ' . cut_text($artval['title']) . ' '] = array('-' => '?module=articles&c=' . $conkey . '&b=' . $artval['id']); $art2 = array_reverse($art2); foreach ($art2 as $art2key => $art2val) { $count3++; if ($count3 != $dyna['max']) { $arr['ddm_article'][$pic_right . ' ' . cut_text($conval) . ' '][$pic_right . ' ' . cut_text($artval['title']) . ' '][' ' . cut_text($art2val['title']) . ' '] = '?module=articles&c=' . $conkey . '&b=' . $artval['id'] . '&a=' . $art2val['id']; } } } } } } } } } } $item[4] = 'ddm_article'; } $item[3] = 'articles.png'; } elseif ($item[0] == '?module=gallery') { if (!isset($dyna['use_gal'])) { $gallery = new gallery(); $kw = $gallery->getAvaiableValues('keywords'); $count = 0; if (is_array($kw)) { $kw = array_reverse($kw); $count++; if (!isset($dyna['min'])) { foreach ($kw as $key => $val) { if ($count != $dyna['max']) { $arr['ddm_gallery'][$pic_right . ' ' . __('By keywords') . ' '][$pic_right . ' ' . cut_text($val) . ' '] = array('-' => '?module=gallery&keyword=' . $val); $kw2 = $gallery->getLimitedImagesList('keywords', $val); $kw2 = array_reverse($kw2); $count2 = 0; foreach ($kw2 as $key2 => $val2) { $count2++; if ($count2 != $dyna['max']) { $arr['ddm_gallery'][$pic_right . ' ' . __('By keywords') . ' '][$pic_right . ' ' . cut_text($val) . ' '][' ' . cut_text($val2) . ' '] = '?module=gallery&id=' . $val2; } } } } } } $kw = $gallery->getAvaiableValues('size'); $count = 0; if (is_array($kw)) { $kw = array_reverse($kw); $count++; $item[1] .= ' ' . $pic_down; if (!isset($dyna['min'])) { foreach ($kw as $key => $val) { if ($count != $dyna['max']) { $arr['ddm_gallery'][$pic_right . ' ' . __('By size') . ' '][$pic_right . ' ' . cut_text($val) . ' '] = array('-' => '?module=gallery&size=' . $val); $kw2 = $gallery->getLimitedImagesList('size', $val); $kw2 = array_reverse($kw2); $count2 = 0; foreach ($kw2 as $key2 => $val2) { $count2++; if ($count2 != $dyna['max']) { $arr['ddm_gallery'][$pic_right . ' ' . __('By size') . ' '][$pic_right . ' ' . cut_text($val) . ' '][' ' . cut_text($val2) . ' '] = '?module=gallery&id=' . $val2; } } } } } } $kw = $gallery->getAvaiableValues('type'); $count = 0; if (is_array($kw)) { $kw = array_reverse($kw); $count++; if (!isset($dyna['min'])) { foreach ($kw as $key => $val) { if ($count != $dyna['max']) { $arr['ddm_gallery'][$pic_right . ' ' . __('By type') . ' '][$pic_right . ' ' . cut_text($val) . ' '] = array('-' => '?module=gallery&type=' . $val); $kw2 = $gallery->getLimitedImagesList('type', $val); $kw2 = array_reverse($kw2); $count2 = 0; foreach ($kw2 as $key2 => $val2) { $count2++; if ($count2 != $dyna['max']) { $arr['ddm_gallery'][$pic_right . ' ' . __('By type') . ' '][$pic_right . ' ' . cut_text($val) . ' '][' ' . cut_text($val2) . ' '] = '?module=gallery&id=' . $val2; } } } } } } $kw = $gallery->getFullImagesList(); $count = 0; if (count($kw) > 0) { $kw = array_reverse($kw); $count++; foreach ($kw as $key => $val) { if ($count != $dyna['max']) { $arr['ddm_gallery'][' ' . cut_text($val) . ' '] = '?module=gallery&id=' . $val; } } } $item[4] = 'ddm_gallery'; } $item[3] = 'gallery.png'; } elseif ($item[0] == '?module=user.list') { if (!isset($dyna['use_mem'])) { $userlist = $system->getUserList('*', 'nickname'); $count = 0; if (count($userlist) > 0) { $item[1] .= ' ' . $pic_down; $userlist = array_reverse($userlist); foreach ($userlist as $conkey => $conval) { $count++; if ($count != $dyna['max']) { $arr['ddm_users'][' ' . cut_text($conval['nickname']) . ' '] = '?module=user.list&user='******'username']; } } } $item[4] = 'ddm_users'; } $item[3] = 'userlist.png'; } elseif ($item[0] == '?module=filesdb') { if (!isset($dyna['use_fdb'])) { $filesdb = new linksdb(DOWNLOADS_DATAFILE); $count = 0; if (!empty($filesdb->data)) { $item[1] .= ' ' . $pic_down; $fdb = array_reverse($filesdb->data); foreach ($fdb as $conkey => $conval) { $count++; if ($count != $dyna['max']) { $arr['ddm_filesdb'][' ' . cut_text($conval['name']) . ' '] = '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1)); if (count($conval['files']) > 0) { if (!isset($dyna['min'])) { unset($arr['ddm_filesdb'][' ' . cut_text($conval['name']) . ' ']); $arr['ddm_filesdb'][$pic_right . ' ' . cut_text($conval['name']) . ' '] = array('-' => '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1))); $count2 = 0; $conval['files'] = array_reverse($conval['files']); foreach ($conval['files'] as $artkey => $artval) { $count2++; if ($count2 != $dyna['max']) { $arr['ddm_filesdb'][$pic_right . ' ' . cut_text($conval['name']) . ' '][' ' . cut_text($artval['name']) . ' '] = '?module=filesdb&id=' . (sizeof($fdb) - ($count - 1)) . '&fid=' . (sizeof($conval['files']) - ($count2 - 1)); } } } } } } } $item[4] = 'ddm_filesdb'; } $item[3] = 'files.png'; } elseif ($item[0] == '?module=forum') { if (!isset($dyna['use_for'])) { $topics = @unserialize(@file_get_contents(FORUM_PATH . 'topic_index.dat')); $count = 0; if (count($topics) > 0) { $item[1] .= ' ' . $pic_down; if (is_array($topics)) { $topics = array_reverse($topics); foreach ($topics as $conkey => $conval) { $count++; if ($count != $dyna['max']) { $arr['ddm_forum'][' ' . cut_text($conval['title']) . ' '] = '?module=forum&id=' . (sizeof($topics) - $count) . '&action=topic'; } } } } $item[4] = 'ddm_forum'; } $item[3] = 'forum.png'; } elseif ($item[1] == 'CUSTOM1') { $item[1] = __(file_get_contents(CONFIG_PATH . 'custom_menu_title_1.txt')) . ' ' . $pic_down; $arr['ddm_custom1'] = arr2ddm(unserialize(file_get_contents(CONFIG_PATH . 'custom_menu_1.dat'))); $item[4] = 'ddm_custom1'; $item[3] = 'custom1.png'; } elseif ($item[1] == 'CUSTOM2') { $item[1] = __(file_get_contents(CONFIG_PATH . 'custom_menu_title_2.txt')) . ' ' . $pic_down; $arr['ddm_custom2'] = arr2ddm(unserialize(file_get_contents(CONFIG_PATH . 'custom_menu_2.dat'))); $item[4] = 'ddm_custom2'; $item[3] = 'custom2.png'; } elseif ($item[1] == 'CUSTOM3') { $item[1] = __(file_get_contents(CONFIG_PATH . 'custom_menu_title_3.txt')) . ' ' . $pic_down; $arr['ddm_custom3'] = arr2ddm(unserialize(file_get_contents(CONFIG_PATH . 'custom_menu_3.dat'))); $item[4] = 'ddm_custom3'; $item[3] = 'custom3.png'; } else { $item[3] = 'default.png'; } if (isset($dyna['ico'])) { $item[3] = '<img src="skins/icons/' . $item[3] . '">'; } else { $item[3] = ''; } $menu .= str_replace('{link}', $item[0], str_replace('{title}', $item[1], str_replace('{target}', @$item[2], str_replace('{icon}', $item[3], str_replace('{id}', $item[4], $format))))); // End of Icons support by Migel } $menu .= ' <br clear="both" /> </div>'; $result = $menu . ' <script type="text/javascript"> dhtmlmenu_build(' . convertArray($arr, 'arr') . ');</script></div>'; return $result; }
function tee_file($result, $dirri, $tiedostonnimi, $ftpkuvahost, $ftpkuvauser, $ftpkuvapass) { //lähetetään tiedosto $conn_id = ftp_connect($ftpkuvahost); // jos connectio ok, kokeillaan loginata if ($conn_id) { $login_result = ftp_login($conn_id, $ftpkuvauser, $ftpkuvapass); if ($login_result === FALSE) { $syy .= "Could not login to remote host ({$conn_id}, {$ftpkuvauser}, {$ftpkuvapass})\n"; } } else { $syy .= "Could not connect to remote host. ({$ftpkuvahost})\n"; } // jos login ok kokeillaan uploadata if ($login_result) { ftp_pasv($conn_id, true); $kokonimi = $dirri . "/" . $tiedostonnimi; if (!file_exists($kokonimi)) { $handle = fopen("{$kokonimi}", "x"); if ($handle === FALSE) { $syy .= "Tiedoston {$kokonimi} luonti epäonnistui!\n"; } else { $fields = mysql_num_fields($result); $ulos = ""; for ($i = 0; $i < $fields; $i++) { $ulos .= mysql_field_name($result, $i); if ($i == $fields - 1) { $ulos .= "\n"; } else { $ulos .= "\t"; } } $order = array("\r\n", "\n", "\r"); while ($row = mysql_fetch_array($result)) { for ($i = 0; $i < $fields; $i++) { if (strpos($row[$i], '"') !== FALSE) { $row[$i] = str_replace('"', "", $row[$i]); } if (strpos($temp = mysql_field_name($result, $i), "lyhytkuvaus") !== FALSE) { $row[$i] = cut_text($row[$i], 100); } /* if (strpos(($temp = mysql_field_name($result, $i)),"mainosteksti") !== FALSE or strpos(($temp = mysql_field_name($result, $i)),"kuvaus") !== FALSE) { $from = array("[lihavoitu]", "[/lihavoitu]", "[kursivoitui]", "[/kursivoitu]", "[alleviivaus]", "[/alleviivaus]", "[lista]", "[/lista]"); $to = array("<b>", "</b>", "<i>", "</i>", "<u>", "</u>", "<ul>", "</li></ul>"); $row[$i] = str_replace($from,$to,$row[$i]); $ulcount = substr_count($row[$i], "<ul>"); $ulppos = 0; for ($s=0; $s < $ulcount; $s++) { $ulpos = strpos($row[$i], "<ul>",$ulpos); $ilpos = strpos($row[$i], "[*]", $ulpos); $row[$i] = substr_replace($row[$i],"<li>",$ilpos,3); $ulpos = $ilpos; } $row[$i] = str_replace("[*]","</li><li>",$row[$i]); }*/ $ulos .= str_replace($order, "<br>", $row[$i]); if ($i == $fields - 1) { $ulos .= "\n"; } else { $ulos .= "\t"; } } } fputs($handle, $ulos); fclose($handle); $upload = ftp_put($conn_id, $tiedostonnimi, realpath($kokonimi), FTP_BINARY); //check upload if ($upload === FALSE) { $syy .= "Transfer failed ({$conn_id}, {$tiedostonnimi}, " . realpath($kokonimi) . ")\n"; } } //poistetaan filu system("rm -f '{$kokonimi}'"); } } if ($conn_id) { ftp_close($conn_id); } return $syy; }
public function display() { $this->bbcode->SetSmiliePath($this->server_path . 'images/smilies'); //Get all conversations, sorted by last message date $arrConversations = $this->pdh->get("chat_conversations", "id_list"); $arrMyConversations = array(); foreach ($arrConversations as $key) { $arrUser = $this->pdh->get("chat_conversations", "user", array($key)); if (in_array($this->user->id, $arrUser)) { $arrMyConversations[] = $key; } } $firstKey = false; if (count($arrMyConversations)) { //Get latest Messages $objQuery = $this->db->prepare("SELECT m1.*\n\t\tFROM __chat_messages m1 LEFT JOIN __chat_messages m2\n\t\t ON (m1.conversation_key = m2.conversation_key AND m1.id < m2.id)\n\t\tWHERE m2.id IS NULL AND m1.conversation_key :in ORDER BY date DESC")->in($arrMyConversations)->execute(); if ($objQuery) { //Get last visits $objLatestVisits = $this->db->prepare("SELECT * FROM __chat_conversation_lastvisit WHERE conversation_key :in AND user_id=?")->in($arrMyConversations)->execute($this->user->id); $arrLatestVisits = array(); if ($objLatestVisits) { while ($row = $objLatestVisits->fetchAssoc()) { $arrLatestVisits[$row['conversation_key']] = (int) $row['date']; } } while ($row = $objQuery->fetchAssoc()) { if ($firstKey === false) { $firstKey = $row['conversation_key']; } $arrUser = $this->pdh->get("chat_conversations", "user", array($row['conversation_key'])); if (count($arrUser) <= 2) { foreach ($arrUser as $user_id) { if ($this->user->id == $user_id) { continue; } $strAvatar = $this->pdh->geth('user', 'avatarimglink', array((int) $user_id)); } } else { $strAvatar = '<i class="fa fa-group fa-4x"></i>'; } //Get Unread data $blnUnread = false; if (count($arrUser) <= 2) { if ((int) $row['user_id'] != $this->user->id && (int) $row['reed'] == 0) { $blnUnread = true; } } else { if ((int) $row['date'] > $arrLatestVisits[$row['conversation_key']]) { $blnUnread = true; } } $this->tpl->assign_block_vars("chat_conversation_row", array('TITLE' => $this->pdh->get("chat_conversations", "title", array($row['conversation_key'])), 'KEY' => $row['conversation_key'], 'avatar' => $strAvatar, 'user_id' => (int) $row['user_id'], 'text' => nl2br($this->bbcode->MyEmoticons($row['text'])), 'reed' => (int) $row['user_id'] == $this->user->id ? 1 : (int) $row['reed'], 'date' => $this->time->user_date((int) $row['date'], true), 'timestamp' => (int) $row['date'], 'LAST_BY_ME' => (int) $row['user_id'] == $this->user->id ? true : false, 'S_UNREAD' => $blnUnread, 'U_LINK' => $this->routing->build("chathistory", $this->pdh->get("chat_conversations", "title", array($row['conversation_key'])), $this->pdh->get("chat_conversations", "id", array($row['conversation_key']))))); } } } if ($this->url_id != "") { $firstKey = $this->pdh->get("chat_conversations", "key", array($this->url_id)); } $rows = 0; if ($firstKey !== false) { $arrHTML = array(); $lastElement = false; $objQuery = $this->db->prepare("SELECT * FROM __chat_messages WHERE conversation_key=? ORDER BY date DESC")->limit(20)->execute($firstKey); if ($objQuery) { $rows = $objQuery->numRows; $arrUser = $this->pdh->get("chat_conversations", "user", array($firstKey)); $lastvisit = false; if (count($arrUser) > 2) { $lastvisit = $this->pdh->get("chat_conversation_lastvisit", "lastVisit", array($this->user->id, $firstKey)); } while ($row = $objQuery->fetchAssoc()) { if ($lastElement === false) { $lastElement = $row; } $reed = $lastvisit === false ? (int) $row['user_id'] != $this->user->id && (int) $row['reed'] == 0 ? false : true : ((int) $row['date'] > $lastvisit ? false : true); $strAvatar = $this->pdh->geth('user', 'avatarimglink', array((int) $row['user_id'])); $strUsername = $this->pdh->get('user', 'name', array((int) $row['user_id'])); $mine = (int) $row['user_id'] === $this->user->id ? ' mine' : ''; $arrHTML[] = '<div class="chatPost' . (!$reed ? ' chatNewPost' : '') . $mine . '" data-post-id="' . (int) $row['id'] . '"> <div class="chatAvatar" title="' . $strUsername . '"><a href="' . $this->routing->build('user', $strUsername, 'u' . $row['user_id']) . '">' . $strAvatar . '</a></div> <div class="chatMsgContainer"> <div class="chatUsername">' . $strUsername . '</div> <div class="chatTime">' . $this->time->user_date((int) $row['date'], true) . '</div> <div class="chatMessage">' . nl2br($this->bbcode->MyEmoticons($row['text'])) . '</div><div class="clear"></div> </div> </div>'; } } $arrHTML = array_reverse($arrHTML); $this->tpl->assign_vars(array("CHAT_CONTENT" => implode("", $arrHTML), "CHAT_LAST_MESSAGE" => cut_text($lastElement['date'], 50), "CHAT_LASTBYME" => (int) $lastElement['user_id'] == $this->user->id ? 1 : 0)); } $strChatTitle = $this->pdh->get("chat_conversations", "title", array($firstKey)); $this->tpl->assign_vars(array('CHAT_MORE_POSTS' => $rows == 20 ? 'true' : 'false', 'CHAT_KEY' => $firstKey, 'CHAT_TITLE' => strlen($strChatTitle) ? $strChatTitle : " - ", 'CHAT_COUNT' => count($this->pdh->get("chat_conversations", "user", array($firstKey))))); // -- EQDKP --------------------------------------------------------------- $this->core->set_vars(array('page_title' => $this->user->lang('chat_conversation'), 'template_path' => $this->pm->get_data('chat', 'template_path'), 'template_file' => 'chathistory.html', 'display' => true)); }
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)); }
public function unreadTooltip() { header('Content-type: text/html; charset=UTF-8'); $arrUnread = $this->getUnreadChats(false); if (count($arrUnread) == 0) { echo '<div class="chatTooltipRemove">' . $this->user->lang('chat_no_unread') . '</div>'; die; } $strOut = ""; foreach ($arrUnread as $key => $row) { $strLink = $this->routing->build("chathistory", $this->pdh->get("chat_conversations", "title", array($key)), $this->pdh->get("chat_conversations", "id", array($key))); $arrUser = $this->pdh->get("chat_conversations", "user", array($key)); if (count($arrUser) <= 2) { foreach ($arrUser as $user_id) { if ($this->user->id == $user_id) { continue; } $strAvatar = $this->pdh->geth('user', 'avatarimglink', array((int) $user_id)); } } else { $strAvatar = '<i class="fa fa-group fa-4x"></i>'; } $strOut .= '<li class="chatTooltipRemove"><a href="' . $strLink . '"> <div class="chatTooltipAvatar"> ' . $strAvatar . ' </div> <div class="chatTooltipDate"> ' . $this->time->user_date((int) $row['date'], true) . ' </div> <div class="chatTooltipTitle"> ' . $this->pdh->get("chat_conversations", "title", array($key)) . ' </div> <div class="chatTooltipLastMessage">'; if ((int) $row['user_id'] == $this->user->id) { $strOut .= '<i class="fa fa-reply"></i>'; } $strOut .= cut_text($row['text'], 50) . '</div> <div class="clear"></div> </a></li>'; } echo $strOut; die; }
if ($objPrevPicture) { $objPictureTemplate->setText('PREV', "<a href='index.php?action=picture&" . $objPrevPicture->getIDPair() . "'>Previous<br>" . $objPrevPicture->getHtmlThumbnail(64, 64) . "</a>"); } else { $objPictureTemplate->setText('PREV', "<span class='disabled'>At the start</span>"); } if ($objNextPicture) { $objPictureTemplate->setText('NEXT', "<a href='index.php?action=picture&" . $objNextPicture->getIDPair() . "'>Next<br>" . $objNextPicture->getHtmlThumbnail(64, 64) . "</a>"); } else { $objPictureTemplate->setText('NEXT', "<span class='disabled'>At the end</span>"); } $objPictureTemplate->setText('TITLE', $objPicture->get('title')); $objPictureTemplate->setText('USERNAME', $objPicture->getUsername()); $objPictureTemplate->setText('PICTURE', $objPicture->getHtml()); $objPictureTemplate->setText('CAPTION', "<span id='more' style='display: none;'>" . bbcode_format($objPicture->get('caption')) . "<br><a href='#' onClick='\$(\"more\").style.display=\"none\"; \$(\"less\").style.display=\"block\"'>Less</a></span>"); $objPictureTemplate->setText('CAPTION', "<span id='less' style='display: inline;'>" . cut_text(bbcode_format($objPicture->get('caption')), MAX_CAPTION, "<br><a href='#' onClick='\$(\"less\").style.display=\"none\"; \$(\"more\").style.display=\"block\"'>More</a></span>")); $strCaption = cut_text(bbcode_format($objPicture->get('caption')), MAX_CAPTION, " (<a href='index.php?action=picture&all=1&" . $objPicture->getIDPair() . "'>more</a>)"); /* Voting code. */ if (clsVote::canVote($objPicture, $objUser, $_SERVER['REMOTE_ADDR'])) { $objPictureTemplate->setText('RATING', clsVote::getVoteField($objPicture)); } else { if (clsVote::getVoteCount($objPicture)) { $objPictureTemplate->setText('RATING', "Ranked <span class='rating'>" . clsVote::getRating($objPicture) . "</span> / " . clsVote::getMaxRating() . " (" . clsVote::getVoteCount($objPicture) . " votes)"); } } /* Commenting code. */ $arrComments = $objPicture->getComments(); foreach ($arrComments as $objComment) { $objComment = new clsComment($objComment->get('id')); $objCommentTemplate = new clsTemplate('comment'); $objCommentTemplate->setText('TITLE', $objComment->get('title') . ' ' . $objComment->getNewIcon($objUser)); $objCommentTemplate->setText('USERNAME', $objComment->getUsername());
public function PrintDebugSelf($level, $last = false) { if (!empty($this->tokens)) { $description = implode(" ", $this->tokens); } elseif (!empty($this->data)) { $description = cut_text(preg_replace("/\\s+/", " ", $this->data), 300); } else { $description = ""; } $whitespace = ''; for ($i = 0; $i < $level; $i++) { if ($this->parser->last[$i]) { $whitespace .= ' '; } else { $whitespace .= '| '; } } $character = $last === true ? '`' : '|'; $level_text = str_repeat(" ", 3 - strlen((string) $level)) . $level; return "\n[{$level_text}]{$whitespace}{$character}-[{$this->type}] {$description}"; }
public function run() { register('pm'); $arrFeeds = $this->pdh->get('feedposter_feeds', 'id_list', array()); foreach ($arrFeeds as $intFeedID) { $arrData = $this->pdh->get('feedposter_feeds', 'data', array($intFeedID)); if (!$arrData['enabled']) { continue; } //Check Interval Time if ($arrData['lastUpdated'] + $arrData['interval'] > $this->time->time) { continue; } //Twitter $arrTwitterOut = array(); if (preg_match("/http(s?):\\/\\/twitter.com\\/(.*)/i", $arrData['url'], $arrTwitterOut)) { $strScreename = $arrTwitterOut[2]; if ($strScreename == "" || !$strScreename) { continue; } include_once $this->root_path . 'libraries/twitter/codebird.class.php'; Codebird::setConsumerKey(TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET); // static, see 'Using multiple Codebird instances' $cb = Codebird::getInstance(); $cb->setReturnFormat(CODEBIRD_RETURNFORMAT_ARRAY); $cb->setToken(TWITTER_OAUTH_TOKEN, TWITTER_OAUTH_SECRET); $params = array('screen_name' => $strScreename); $objJSON = $cb->statuses_userTimeline($params); if (is_array($objJSON)) { $i = 0; foreach ($objJSON as $itemData) { //No Replies or Retweets if (strlen($itemData['in_reply_to_user_id'])) { continue; } if (isset($itemData['retweeted_status'])) { continue; } $hash = sha1($itemData['id_str']); $time = strtotime($itemData['created_at']); $arrTags = array(); if (isset($itemData['entities']['hashtags'])) { foreach ($itemData['entities']['hashtags'] as $val) { $arrTags[] = $val['text']; } } // get data $data[$hash] = array('title' => $arrData['name'] . ': ' . cut_text($itemData['text'], 40, true), 'link' => 'https://twitter.com/' . $strScreename . '/status/' . $itemData['id_str'], 'description' => $this->twitterify($itemData['text']), 'time' => $time, 'hash' => $hash, 'tags' => $arrTags); // check max results $i++; if ($arrData['maxPosts'] && $i == $arrData['maxPosts']) { break; } } if (empty($data)) { continue; } //Build Hash-Array of Feed $arrHashList = $this->pdh->get('feedposter_log', 'hash_list', array($intFeedID)); $intLastUpdate = $arrData['lastUpdated']; foreach ($data as $key => $val) { if ($val['time'] > $intLastUpdate && !in_array($val['hash'], $arrHashList)) { $strTitle = $val['title']; $strText = $val['description']; $strText = nl2br($strText); if ($arrData['maxTextLength']) { if (strlen($strText) > $arrData['maxTextLength']) { $strText = cut_text($strText, $arrData['maxTextLength'], true); } } $strFeedType = 'twitter'; $strText = '<div class="feedposter feedid_' . $intFeedID . ' feedtype_' . $strFeedType . '"><blockquote>' . strip_tags($strText, '<img><a>') . '</blockquote>' . $this->user->lang('fp_source') . ': <a href="' . sanitize(strip_tags($val['link'])) . '">' . sanitize(strip_tags($val['link'])) . '</a></div>'; $strPreviewimage = ""; $strAlias = $strTitle; $intPublished = 1; $intFeatured = 0; $intCategory = $arrData['categoryID']; $intUserID = $arrData['userID']; $intComments = $arrData['allowComments']; $intVotes = 0; $intHideHeader = 0; $arrFeedTags = unserialize($arrData['tags']); if (!is_array($arrFeedTags)) { $arrFeedTags = array(); } $arrFeedTags = $arrFeedTags[0] != "" ? array_merge($arrFeedTags, $val['tags']) : $val['tags']; $arrTags = $arrFeedTags; $intDate = $val['time']; $strShowFrom = $strShowTo = ""; $blnResult = $this->pdh->put('articles', 'add', array($strTitle, $strText, $arrTags, $strPreviewimage, $strAlias, $intPublished, $intFeatured, $intCategory, $intUserID, $intComments, $intVotes, $intDate, $strShowFrom, $strShowTo, $intHideHeader)); //Write Log $this->pdh->put('feedposter_log', 'add', array($intFeedID, $val['hash'], $this->time->time)); //Prevent double input $arrHashList[] = $val['hash']; } } //Set Last Updated $this->pdh->put('feedposter_feeds', 'set_last_update', array($intFeedID, $this->time->time)); $this->pdh->process_hook_queue(); } else { //Update Error $this->pdh->put('feedposter_feeds', 'set_error', array($intFeedID, 'Invalid Json')); $this->pdh->process_hook_queue(); } } else { //Normal RSS/ATOM Feed $strContent = register('urlfetcher')->fetch($arrData['url']); if ($strContent) { try { $document = new \DOMDocument('1.0', 'UTF-8'); $document->preserveWhiteSpace = false; $document->loadXML($strContent); $xpath = new \DOMXPath($document); if ($document->documentElement !== null && $document->documentElement !== false && is_object($document->documentElement)) { $namespace = $document->documentElement->getAttribute('xmlns'); $xpath->registerNamespace('ns', $namespace); } else { //Update Error $this->pdh->put('feedposter_feeds', 'set_error', array($intFeedID)); $this->pdh->process_hook_queue(); continue; } $rootNode = $xpath->query('/*')->item(0); if ($rootNode === null) { //Update Error $this->pdh->put('feedposter_feeds', 'set_error', array($intFeedID)); $this->pdh->process_hook_queue(); continue; } if ($rootNode->nodeName == 'feed') { $data = $this->readAtomFeed($xpath, $arrData); $strFeedType = 'rss'; } else { if ($rootNode->nodeName == 'rss') { $data = $this->readRssFeed($xpath, $arrData); $strFeedType = 'rss'; } else { if ($rootNode->nodeName == 'response') { $data = $this->readEQdkpFeed($xpath, $arrData); $strFeedType = 'eqdkp'; } else { //Update Error $this->pdh->put('feedposter_feeds', 'set_error', array($intFeedID)); $this->pdh->process_hook_queue(); continue; } } } if (empty($data)) { continue; } //Build Hash-Array of Feed $arrHashList = $this->pdh->get('feedposter_log', 'hash_list', array($intFeedID)); $intLastUpdate = $arrData['lastUpdated']; foreach ($data as $key => $val) { if ($val['time'] > $intLastUpdate && !in_array($val['hash'], $arrHashList)) { $strTitle = $val['title']; $strText = $val['description']; $strText = nl2br($strText); if ($arrData['maxTextLength']) { if (strlen($strText) > $arrData['maxTextLength']) { $strText = cut_text($strText, $arrData['maxTextLength'], true); } } if ($strFeedType == 'eqdkp') { $strText = '<div class="feedposter feedid_' . $intFeedID . ' feedtype_' . $strFeedType . ' feedsource_category_' . $val['category_id'] . '">' . $strText . '</div>'; } else { $strText = preg_replace("'<style[^>]*>.*</style>'siU", '', $strText); $strText = '<div class="feedposter feedid_' . $intFeedID . ' feedtype_' . $strFeedType . '"><blockquote>' . strip_tags($strText, '<img>') . '</blockquote>' . $this->user->lang('fp_source') . ': <a href="' . sanitize(strip_tags($val['link'])) . '">' . sanitize(strip_tags($val['link'])) . '</a></div>'; } $strPreviewimage = ""; $strAlias = $strTitle; $intPublished = 1; $intFeatured = $arrData['featured']; $intCategory = $arrData['categoryID']; $intUserID = $arrData['userID']; $intComments = $arrData['allowComments']; $intVotes = 0; $intHideHeader = 0; $arrTags = unserialize($arrData['tags']); $intDate = $val['time']; $strShowFrom = $strShowTo = ""; if ($arrData['showForDays'] > 0) { $strShowTo = $intDate + $arrData['showForDays'] * 86400; } $blnResult = $this->pdh->put('articles', 'add', array($strTitle, $strText, $arrTags, $strPreviewimage, $strAlias, $intPublished, $intFeatured, $intCategory, $intUserID, $intComments, $intVotes, $intDate, $strShowFrom, $strShowTo, $intHideHeader)); //Write Log $this->pdh->put('feedposter_log', 'add', array($intFeedID, $val['hash'], $this->time->time)); //Prevent double input $arrHashList[] = $val['hash']; } } //Set Last Updated $this->pdh->put('feedposter_feeds', 'set_last_update', array($intFeedID, $this->time->time)); } catch (Exception $e) { //Update Error $this->pdh->put('feedposter_feeds', 'set_error', array($intFeedID, 'Parsing error')); $this->pdh->process_hook_queue(); } $this->pdh->process_hook_queue(); } else { //Update Error $this->pdh->put('feedposter_feeds', 'set_error', array($intFeedID, 'Fetching error')); $this->pdh->process_hook_queue(); } } } }
if (!isset($_SESSION['objUser'])) { $objUser = clsUser::getCookie(); } else { $objUser = $_SESSION['objUser']; } header("Content-type: application/xhtml+xml"); $arrPictures = clsPicture::getRecentPictures($objUser, 10); $url = "http://" . $_SERVER['HTTP_HOST'] . "/" . preg_replace("/\\/[a-zA-Z0-9.]*\$/", "/index.php", $_SERVER['PHP_SELF']); print "<?xml version='1.0' encoding='UTF-8'?>\n<!-- generator='OSPAP2' -->\n<rss version='2.0'\n\txmlns:content='http://purl.org/rss/1.0/modules/content/'\n\txmlns:wfw='http://wellformedweb.org/CommentAPI/'\n\txmlns:dc='http://purl.org/dc/elements/1.1/'\n\t>\n\n<channel>\n\t<title>" . SITE_NAME . "</title>\n\t<link>{$url}</link>\n\t<description>" . SITE_DESCRIPTION . "</description>\n\t<generator>http://www.javaop.com/~ron/ospap2</generator>\n\t<language>en</language>\n"; foreach ($arrPictures as $objPicture) { $objPicture = new clsPicture($objPicture->get('id')); $link = "http://" . $_SERVER['HTTP_HOST'] . "/" . preg_replace("/\\/[a-zA-Z0-9.]*\$/", "/index.php?action=picture&" . $objPicture->getIDPair(), $_SERVER['PHP_SELF']); print "\t<item>\n"; print "\t\t<title>" . $objPicture->get('title') . "</title>\n"; print "\t\t<link>{$link}</link>\n"; print "\t\t<comments>{$link}</comments>\n"; print "\t\t<pubDate>" . date("D M j Y G:i:s T", strtotime($objPicture->get('date'))) . "</pubDate>\n"; print "\t\t<dc:creator>" . $objPicture->getFrom('user', 'username') . "</dc:creator>\n"; print "\t\t<category><![CDATA[" . $objPicture->getFrom('album', 'name') . "]]></category>\n"; print "\t\t<guid isPermaLink=\"true\">{$link}</guid>\n"; print "\t\t<description><![CDATA[" . cut_text($objPicture->get('caption'), 200) . "<br><br>" . $objPicture->getHtmlThumbnail(150, 150) . "]]></description>\n"; print "\t\t<content:encoded><![CDATA[" . $objPicture->get('caption') . "<br><br>" . $objPicture->getHtml() . "]]></content:encoded>\n"; print "\t\t<wfw:commentRss>" . $_SERVER['PHP_SELF'] . "</wfw:commentRss>\n"; print "\t</item>\n"; } print "</channel>\n"; print "</rss>\n"; } catch (Exception $e) { $_SESSION['e'] = $e; header("Location: index.php?action=exception&message=" . $e->getMessage()); }
<p><i><?php echo my_format_date($news_element['publish_date']); ?> </i> <b><?php echo $news_element['title']; ?> </b></p> <p><?php echo cut_text($news_element['text']); ?> </p> <p><a href="<?php echo PROJECT_PATH; ?> /news/?id=<?php echo $id; ?> ">подробнее</a></p> <hr>
<div class="forum-buttons"> <a href="/forum/category/<?php echo $var_id; ?> /new">Create new thread</a> <div class="clear"></div> </div> <table class="forum-table"> <tr> <th class="forum-header-threads-name">Thread Title</th> <th class="forum-header-threads-replies">Replies</th> </tr> <?php if ($result = mysql_query_cached("SELECT * FROM forum_posts WHERE `CategoryId`='{$catid}' AND `ParentId`='0' ORDER BY `LastReplyTime` DESC", 10)) { foreach ($result->data as $post) { $teaser = cut_text(utf8entities(stripslashes($post['Body'])), 90); $topic = utf8entities(stripslashes($post['Topic'])); echo "<tr>\n\t\t\t\t\t<td class=\"forum-item-threads-name\">\n\t\t\t\t\t\t<a class=\"forum-table-link\" href=\"/forum/post/{$post['Id']}\">\n\t\t\t\t\t\t\t<div class=\"forum-table-name\">{$topic}</div>\n\t\t\t\t\t\t\t<div class=\"forum-table-teaser\">{$teaser}</div>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class=\"forum-item-threads-replies\">{$post['Replies']}</td>\n\t\t\t\t</tr>"; } } else { echo "<tr>\n\t\t\t\t<td colspan=\"2\">There are no threads in this category yet.</td>\n\t\t\t</tr>"; } ?> </table> <?php } else { $var_code = ANONNEWS_ERROR_NOT_FOUND; require "module.error.php"; }