'.cplang('adv_admin').''; $operation = $operation ? $operation : 'list'; $defaulttargets = array('portal', 'home', 'member', 'forum', 'group', 'userapp', 'plugin'); if(!empty($_GET['preview'])) { $_GET['advnew'][$_GET['advnew']['style']]['url'] = $_GET['TMPadvnew'.$_GET['advnew']['style']] ? $_GET['TMPadvnew'.$_GET['advnew']['style']] : $_GET['advnew'.$_GET['advnew']['style']]; $data = encodeadvcode($_GET['advnew']); ?>
1 && preg_match('/^[\w\_:]+$/', $type)) { if(ispluginkey($etype[0]) && preg_match('/^\w$/', $etype[1])) { $advfile = DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/adv/adv_'.$etype[1].'.php'; $advclass = 'adv_'.$etype[1]; } } else { $advfile = libfile('adv/'.$type, 'class'); $advclass = 'adv_'.$type; } if($advfile && file_exists($advfile)) { require_once $advfile; $advclassv = new $advclass(); if(class_exists($advclass)) { $advsetting = $advclassv->getsetting(); $typeadd = ' - '.lang('adv/'.$type, $advclassv->name); if($type == 'custom') { $typeadd .= ' '.$advclassv->customname; } $typeadd .= ' ('.cplang('adv_admin_listall').')'; } } } showsubmenu($root.' » '.cplang('adv_list').$typeadd); showformheader('adv&operation=ad'); showtableheader('', 'fixpadding'); showsubtitle(array('', 'display_order', 'available', 'subject', !$type ? 'type' : '', 'adv_style', 'start_time', 'end_time', 'adv_targets', '')); $advppp = $type != 'custom' ? 25 : 9999; $conditions = ''; $order_by = 'displayorder, advid DESC, targets DESC'; $start_limit = ($page - 1) * $advppp; $title = $_GET['title']; $starttime = $_GET['starttime']; $endtime = $_GET['endtime']; $orderby = $_GET['orderby']; $advnum = C::t('common_advertisement')->count_search($title, $starttime, $endtime, $type, $target); if(!$type) { $customadv = array(); foreach(C::t('common_advertisement_custom')->fetch_all_data() as $custom) { $customadv[$custom['id']] = $custom['name']; } } $typenames = array(); foreach(C::t('common_advertisement')->fetch_all_search($title, $starttime, $endtime, $type, $target, $orderby, $start_limit, $advppp) as $adv) { if(!$type) { $advfile = ''; $etype = explode(':', $adv['type']); if(count($etype) > 1 && preg_match('/^[\w\_:]+$/', $adv['type'])) { $advfile = DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/adv/adv_'.$etype[1].'.php'; $advclass = 'adv_'.$etype[1]; } else { $advfile = libfile('adv/'.$adv['type'], 'class'); $advclass = 'adv_'.$adv['type']; } if(!$advfile || !file_exists($advfile)) { continue; } if(!isset($typenames[$adv['type']])) { require_once $advfile; if(class_exists($advclass)) { $advclassv = new $advclass(); $typenames[$adv['type']] = lang('adv/'.$adv['type'], $advclassv->name); } else { $typenames[$adv['type']] = $adv['type']; } } } $adv['parameters'] = dunserialize($adv['parameters']); if($adv['type'] == 'custom' && $type && $_GET['customid'] != $adv['parameters']['extra']['customid']) { continue; } $targets = array(); foreach(explode("\t", $adv['targets']) as $t) { if('adv_edit_targets_'.$t != 'adv_edit_targets_custom') { $targets[] = $lang['adv_edit_targets_'.$t] ? $lang['adv_edit_targets_'.$t] : $t; } } showtablerow('', array('class="td25"', 'class="td25"', 'class="td25"'), array( "", "", "", "", !$type ? ''.$typenames[$adv['type']].($adv['type'] != 'custom' ? '' : ' '.$customadv[$adv['parameters']['extra']['customid']]).'' : '', $lang['adv_style_'.$adv['parameters']['style']], $adv['starttime'] ? dgmdate($adv['starttime'], 'd') : $lang['unlimited'], $adv['endtime'] ? dgmdate($adv['endtime'], 'd') : $lang['unlimited'], $adv['type'] != 'custom' ? implode(', ', $targets) : $lang['custom'], "$lang[edit]" )); } $multipage = multi($advnum, $advppp, $page, ADMINSCRIPT.'?action=adv&operation=ad'.($type ? '&type='.rawurlencode($type) : '').($target ? '&target='.rawurlencode($target) : '').($title ? '&title='.rawurlencode($title) : '').($starttime ? "&starttime=$starttime" : '').($endtime ? "&endtime=$endtime" : '').($orderby ? "&orderby=$orderby" : ''), 0, 3, TRUE, TRUE); $starttimecheck = array($starttime => 'selected="selected"'); $endtimecheck = array($endtime => 'selected="selected"'); $orderbycheck = array($orderby => 'selected="selected"'); $targetselect = ''; showsubmit('advsubmit', 'submit', 'del', $type ? '' : '', $multipage.'             '.$targetselect.'      '); showtablefooter(); showformfooter(); } else { if($_GET['delete']) { C::t('common_advertisement')->delete($_GET['delete']); } if(is_array($_GET['titlenew'])) { foreach($_GET['titlenew'] as $advid => $title) { C::t('common_advertisement')->update($advid, array( 'available' => $_GET['availablenew'][$advid], 'displayorder' => $_GET['displayordernew'][$advid], 'title' => cutstr($_GET['titlenew'][$advid], 50) )); } } updatecache('advs'); updatecache('setting'); cpmsg('adv_update_succeed', dreferer(), 'succeed'); } } elseif($operation == 'add' && !empty($_GET['type']) || $operation == 'edit' && !empty($_GET['advid'])) { if(!submitcheck('advsubmit')) { if($operation == 'edit') { $advid = $_GET['advid']; $adv = C::t('common_advertisement')->fetch($advid); if(!$adv) { cpmsg('advertisement_nonexistence', '', 'error'); } $adv['parameters'] = dunserialize($adv['parameters']); $type = $adv['type']; } else { $adv['parameters']['style'] = 'code'; $type = $_GET['type']; } $etype = explode(':', $type); if(count($etype) > 1 && preg_match('/^[\w\_:]+$/', $type)) { include_once DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/adv/adv_'.$etype[1].'.php'; $advclass = 'adv_'.$etype[1]; } else { require_once libfile('adv/'.$type, 'class'); $advclass = 'adv_'.$type; } $advclass = new $advclass; $advsetting = $advclass->getsetting(); $advtitle = lang('adv/'.$type, $advclass->name).($type != 'custom' ? '' : ' '.$advclass->customname); $returnurl = 'action=adv&operation=ad'.(empty($_GET['from']) ? '&type='.$type.($type != 'custom' ? '' : '&customid='.$_GET['customid']) : ''); $return = ''.cplang('adv_list').(empty($_GET['from']) ? ' - '.$advtitle : '').''; shownav('extended', 'adv_admin'); showsubmenu($root.' » '.$return.' » '.($operation == 'edit' ? cplang('adv_edit') : cplang('adv_add'))); echo '
'; $targets = array(); foreach($advclass->targets as $target) { if($target != 'custom') { $targets[] = array($target, $lang['adv_edit_targets_'.$target]); } else { $ets = explode("\t", $adv['targets']); $customv = array(); foreach($ets as $et) { if(!in_array($et, $advclass->targets)) { $customv[] = $et; } } $targets[] = array($target, ''); } } $imagesizes = ''; if(!empty($advclass->imagesizes)) { foreach($advclass->imagesizes as $size) { $imagesizes .= ''; } } $adv['starttime'] = $adv['starttime'] ? dgmdate($adv['starttime'], 'Y-n-j') : ''; $adv['endtime'] = $adv['endtime'] ? dgmdate($adv['endtime'], 'Y-n-j') : ''; echo ''. '

'.lang('adv/'.$type, $advclass->name).'

'. '
'. (count($etype) > 1 && preg_match('/^[\w\_:]+$/', $type) ? (file_exists(DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/adv/adv_'.$etype[1].'.gif') ? '' : '') : (file_exists(DISCUZ_ROOT.'./static/image/admincp/'.$type.'.gif') ? '' : '')). ''.lang('adv/'.$type, $advclass->description).'
'. '
'.lang('adv/'.$type, $advclass->copyright).'
'; if($operation == 'edit') { echo ''; echo ''; } showformheader("adv&operation=$operation".($operation == 'add' ? '&type='.$type : '&advid='.$advid), 'enctype'); if($type == 'custom') { showhiddenfields(array('parameters[extra][customid]' => $_GET['customid'])); } showhiddenfields(array('referer' => $returnurl)); showtableheader(); showtableheader(($operation == 'edit' ? cplang('adv_edit') : cplang('adv_add')).' - '.lang('adv/'.$type, $advclass->name), 'fixpadding'); showsetting('adv_edit_title', 'advnew[title]', $adv['title'], 'text'); if($type != 'custom') { showsetting('adv_edit_targets', array('advnew[targets]', $targets), explode("\t",$adv['targets']), 'mcheckbox'); } if(is_array($advsetting)) { foreach($advsetting as $settingvar => $setting) { if(!empty($setting['value']) && is_array($setting['value'])) { foreach($setting['value'] as $k => $v) { $setting['value'][$k][1] = lang('adv/'.$type, $setting['value'][$k][1]); } } $varname = in_array($setting['type'], array('mradio', 'mcheckbox', 'select', 'mselect')) ? ($setting['type'] == 'mselect' ? array('parameters[extra]['.$settingvar.'][]', $setting['value']) : array('parameters[extra]['.$settingvar.']', $setting['value'])) : 'parameters['.$settingvar.']'; $value = $adv['parameters']['extra'][$settingvar] != '' ? $adv['parameters']['extra'][$settingvar] : $setting['default']; $comment = lang('adv/'.$type, $setting['title'].'_comment'); $comment = $comment != $setting['title'].'_comment' ? $comment : ''; showsetting(lang('adv/'.$type, $setting['title']).':', $varname, $value, $setting['type'], '', 0, $comment); } } $adtypearray = array(); $adtypes = array('code', 'text', 'image', 'flash'); foreach($adtypes as $adtype) { $displayary = array(); foreach($adtypes as $adtype1) { $displayary['style_'.$adtype1] = $adtype1 == $adtype ? '' : 'none'; } $adtypearray[] = array($adtype, $lang['adv_style_'.$adtype], $displayary); } showsetting('adv_edit_starttime', 'advnew[starttime]', $adv['starttime'], 'calendar'); showsetting('adv_edit_endtime', 'advnew[endtime]', $adv['endtime'], 'calendar'); showsetting('adv_edit_style', array('advnew[style]', $adtypearray), $adv['parameters']['style'], 'mradio'); showtagheader('tbody', 'style_code', $adv['parameters']['style'] == 'code'); showtitle('adv_edit_style_code'); showsetting('adv_edit_style_code_html', 'advnew[code][html]', $adv['parameters']['html'], 'textarea'); showtagfooter('tbody'); showtagheader('tbody', 'style_text', $adv['parameters']['style'] == 'text'); showtitle('adv_edit_style_text'); showsetting('adv_edit_style_text_title', 'advnew[text][title]', $adv['parameters']['title'], 'htmltext'); showsetting('adv_edit_style_text_link', 'advnew[text][link]', $adv['parameters']['link'], 'text'); showsetting('adv_edit_style_text_size', 'advnew[text][size]', $adv['parameters']['size'], 'text'); showtagfooter('tbody'); showtagheader('tbody', 'style_image', $adv['parameters']['style'] == 'image'); showtitle('adv_edit_style_image'); showsetting('adv_edit_style_image_url', 'advnewimage', $adv['parameters']['url'], 'filetext'); showsetting('adv_edit_style_image_link', 'advnew[image][link]', $adv['parameters']['link'], 'text'); showsetting('adv_edit_style_image_alt', 'advnew[image][alt]', $adv['parameters']['alt'], 'text'); if($imagesizes) { $v = $adv['parameters']['width'].'x'.$adv['parameters']['height']; showsetting('adv_edit_style_image_size', '', '', ''); } showsetting('adv_edit_style_image_width', 'advnew[image][width]', $adv['parameters']['width'], 'text', '', 0, '', 'id="imagewidth" onchange="setpreview(\'image\')"'); showsetting('adv_edit_style_image_height', 'advnew[image][height]', $adv['parameters']['height'], 'text', '', 0, '', 'id="imageheight" onchange="setpreview(\'image\')"'); showtagfooter('tbody'); showtagheader('tbody', 'style_flash', $adv['parameters']['style'] == 'flash'); showtitle('adv_edit_style_flash'); showsetting('adv_edit_style_flash_url', 'advnewflash', $adv['parameters']['url'], 'filetext'); if($imagesizes) { $v = $adv['parameters']['flash'].'x'.$adv['parameters']['flash']; showsetting('adv_edit_style_flash_size', '', '', ''); } showsetting('adv_edit_style_flash_width', 'advnew[flash][width]', $adv['parameters']['width'], 'text', '', 0, '', 'id="flashwidth" onchange="setpreview(\'flash\')"'); showsetting('adv_edit_style_flash_height', 'advnew[flash][height]', $adv['parameters']['height'], 'text', '', 0, '', 'id="flashheight" onchange="setpreview(\'flash\')"'); showtagfooter('tbody'); echo ''; if($operation == 'edit') { echo '   '; } echo ''; showtablefooter(); showtableheader(); echo ''; echo ''; showtablefooter(); showformfooter(); echo ''; } else { if($operation == 'edit') { $advid = $_GET['advid']; $adv = C::t('common_advertisement')->fetch($advid); $type = $adv['type']; $adv['parameters'] = dunserialize($adv['parameters']); } else { $type = $_GET['type']; } $etype = explode(':', $type); if(count($etype) > 1 && preg_match('/^[\w\_:]+$/', $type)) { include_once DISCUZ_ROOT.'./source/plugin/'.$etype[0].'/adv/adv_'.$etype[1].'.php'; $advclass = 'adv_'.$etype[1]; } else { require_once libfile('adv/'.$type, 'class'); $advclass = 'adv_'.$type; } $advclass = new $advclass; $advnew = $_GET['advnew']; $parameters = !empty($_GET['parameters']) ? $_GET['parameters'] : array(); if(@in_array('custom', $advnew['targets'])) { $targetcustom = explode(',', $advnew['targetcustom']); $advnew['targets'] = array_merge($advnew['targets'], $targetcustom); } $advclass->setsetting($advnew, $parameters); $advnew['starttime'] = $advnew['starttime'] ? strtotime($advnew['starttime']) : 0; $advnew['endtime'] = $advnew['endtime'] ? strtotime($advnew['endtime']) : 0; if(!$advnew['title']) { cpmsg('adv_title_invalid', '', 'error'); } elseif(strlen($advnew['title']) > 50) { cpmsg('adv_title_more', '', 'error'); } elseif($advnew['endtime'] && ($advnew['endtime'] <= TIMESTAMP || $advnew['endtime'] <= $advnew['starttime'])) { cpmsg('adv_endtime_invalid', '', 'error'); } elseif(($advnew['style'] == 'code' && !$advnew['code']['html']) || ($advnew['style'] == 'text' && (!$advnew['text']['title'] || !$advnew['text']['link'])) || ($advnew['style'] == 'image' && (!$_FILES['advnewimage'] && !$_GET['advnewimage'] || !$advnew['image']['link'])) || ($advnew['style'] == 'flash' && (!$_FILES['advnewflash'] && !$_GET['advnewflash'] || !$advnew['flash']['width'] || !$advnew['flash']['height']))) { cpmsg('adv_parameter_invalid', '', 'error'); } if($operation == 'add') { $advid = C::t('common_advertisement')->insert(array('available' => 1, 'type' => $type), true); } if($advnew['style'] == 'image' || $advnew['style'] == 'flash') { if($_FILES['advnew'.$advnew['style']]) { $upload = new discuz_upload(); if($upload->init($_FILES['advnew'.$advnew['style']], 'common') && $upload->save(1)) { $advnew[$advnew['style']]['url'] = (!strstr($_G['setting']['attachurl'], '://') ? $_G['siteurl'] : '').$_G['setting']['attachurl'].'common/'.$upload->attach['attachment']; } } else { $advnew[$advnew['style']]['url'] = $_GET['advnew'.$advnew['style']]; } } $advnew['displayorder'] = isset($advnew['displayorder']) ? implode("\t", $advnew['displayorder']) : ''; $advnew['code'] = encodeadvcode($advnew); $extra = $type != 'custom' ? '' : '&customid='.$parameters['extra']['customid']; $advnew['parameters'] = serialize(array_merge(is_array($parameters) ? $parameters : array(), array('style' => $advnew['style']), $advnew['style'] == 'code' ? array() : $advnew[$advnew['style']], array('html' => $advnew['code']), array('displayorder' => $advnew['displayorder']))); C::t('common_advertisement')->update($advid, array( 'title' => $advnew['title'], 'targets' => $advnew['targets'], 'parameters' => $advnew['parameters'], 'code' => $advnew['code'], 'starttime' => $advnew['starttime'], 'endtime' => $advnew['endtime'] )); updatecache('advs'); updatecache('setting'); cpmsg('adv_succeed', 'action=adv&operation=edit&advid='.$advid.$extra, 'succeed'); } } elseif($operation == 'setting') { if(submitcheck('advsubmit')) { $_GET['advexpirationnew']['allow'] = $_GET['advexpirationnew']['allow'] && $_GET['advexpirationnew']['day'] > 0 && $_GET['advexpirationnew']['method'] && $_GET['advexpirationnew']['users']; C::t('common_setting')->update('advexpiration', $_GET['advexpirationnew']); updatecache('setting'); cpmsg('setting_update_succeed', 'action=adv&operation=setting', 'succeed'); } else { shownav('extended', 'adv_admin'); showsubmenu('adv_admin', array( array('adv_admin_setting', 'adv&operation=setting', 1), array('adv_admin_list', 'adv&operation=list', 0), array('adv_admin_listall', 'adv&operation=ad', 0), array('adv_admin_discuzunion', 'http://union.discuz.qq.com/?ADTAG=CP.DISCUZ. ADSET.TAG', 0, 1, 1) )); $advexpiration = C::t('common_setting')->fetch('advexpiration', true); showformheader('adv&operation=setting'); showtableheader(); showsetting('adv_setting_advexpiration', 'advexpirationnew[allow]', $advexpiration['allow'], 'radio', 0, 1); showsetting('adv_setting_advexpiration_day', 'advexpirationnew[day]', $advexpiration['day'], 'text'); showsetting('adv_setting_advexpiration_method', array('advexpirationnew[method]', array( array('email', cplang('adv_setting_advexpiration_method_email')), array('notice', cplang('adv_setting_advexpiration_method_notice')), )), $advexpiration['method'], 'mcheckbox'); showsetting('adv_setting_advexpiration_users', 'advexpirationnew[users]', $advexpiration['users'], 'textarea'); showtagfooter('tbody'); showsubmit('advsubmit'); showtablefooter(); showformfooter(); } } elseif($operation == 'list') { shownav('extended', 'adv_admin'); showsubmenu('adv_admin', array( array('adv_admin_setting', 'adv&operation=setting', 0), array('adv_admin_list', 'adv&operation=list', 1), array('adv_admin_listall', 'adv&operation=ad', 0), array('adv_admin_discuzunion', 'http://union.discuz.qq.com/?ADTAG=CP.DISCUZ. ADSET.TAG', 0, 1, 1), )); showtips('adv_list_tip'); $advs = getadvs(); showtableheader('', 'fixpadding'); echo ''.$lang['adv_targets'].':    '; foreach($defaulttargets as $target) { echo ''.$lang['adv_edit_targets_'.$target].'    '; } $row = 4; $rowwidth = 1 / $row * 100; $customadv = $ads = array(); $tmp = $advs['adv_custom.php']; unset($advs['adv_custom.php']); $advs['adv_custom.php'] = $tmp; foreach(C::t('common_advertisement')->fetch_all_type() as $ad) { $ads[$ad['type']] = $ad['count']; } foreach(C::t('common_advertisement')->fetch_all_by_type('custom') as $ad) { $parameters = dunserialize($ad['parameters']); $ads['custom_'.$parameters['extra']['customid']]++; } if($advs) { $i = $row; foreach($advs as $adv) { if($i == $row) { echo ''; } if($adv['class'] == 'custom') { $customadv = $adv; echo ''; echo $img.$lang['adv_custom_add']; showformheader("adv&operation=custom&do=add"); echo ''; showformfooter(); echo ''; } else { echo ''; $eclass = explode(':', $adv['class']); if(count($eclass) > 1) { echo file_exists(DISCUZ_ROOT.'./source/plugin/'.$eclass[0].'/adv/adv_'.$eclass[1].'.gif') ? '
' : ''; } else { echo file_exists(DISCUZ_ROOT.'./static/image/admincp/'.$adv['class'].'.gif') ? '
' : ''; } echo $adv['name'].($ads[$adv['class']] ? '('.$ads[$adv['class']].')' : '').($adv['filemtime'] > TIMESTAMP - 86400 ? ' New!' : ''); echo '
'; } $i--; if(!$i) { $i = $row; } } if($i != $row) { echo str_repeat('', $i); } } else { showtablerow('', '', $lang['adv_nonexistence']); } if($customadv) { $img = file_exists(DISCUZ_ROOT.'./static/image/admincp/'.$customadv['class'].'.gif') ? '
' : ''; $i = $row; foreach(C::t('common_advertisement_custom')->fetch_all_data() as $custom) { if($i == $row) { echo ''; } echo '
'; echo $img.$lang['adv_custom'].' '.$custom['name'].($ads['custom_'.$custom['id']] ? '('.$ads['custom_'.$custom['id']].')' : ''); echo '
'; echo ''.$lang['edit'].' '; echo ''.$lang['delete'].''; echo '
'; $i--; if(!$i) { $i = $row; } } if($i != $row) { echo str_repeat('', $i); } } echo ''.str_repeat('', $row).''; showtablefooter(); } elseif($operation == 'custom') { if($do == 'add') { $addcustom = strip_tags($_GET['addcustom']); if($addcustom) { if(!($customid = C::t('common_advertisement_custom')->get_id_by_name($addcustom))) { $customid = C::t('common_advertisement_custom')->insert(array('name' => $addcustom), true); } dheader('location: '.ADMINSCRIPT.'?action=adv&operation=add&type=custom&customid='.$customid); } } elseif($do == 'edit') { $custom = C::t('common_advertisement_custom')->fetch($_GET['id']); $name = $custom['name']; if(!submitcheck('submit')) { ajaxshowheader(); showformheader("adv&operation=custom&do=edit&id=$_GET[id]"); echo $lang['adv_custom_edit'].'
 '. ' '. ''; showformfooter(); ajaxshowfooter(); } else { $customnew = strip_tags($_GET['customnew']); if($_GET['customnew'] != $name) { C::t('common_advertisement_custom')->update($_GET['id'], array('name' => $customnew)); } } } elseif($do == 'delete') { if(!submitcheck('submit')) { ajaxshowheader(); showformheader("adv&operation=custom&do=delete&id=$_GET[id]"); echo $lang['adv_custom_delete'].'
 '. ''; showformfooter(); ajaxshowfooter(); } else { C::t('common_advertisement_custom')->delete($_GET['id']); } } dheader('location: '.ADMINSCRIPT.'?action=adv&operation=list'); } function encodeadvcode($advnew) { switch($advnew['style']) { case 'code': $advnew['code'] = $advnew['code']['html']; break; case 'text': $advnew['code'] = ''.$advnew['text']['title'].''; break; case 'image': $advnew['code'] = ''.$advnew['image']['alt'].''; break; case 'flash': $advnew['code'] = ''; break; } return $advnew['code']; } function getadvs() { global $_G; $checkdirs = array_merge(array(''), $_G['setting']['plugins']['available']); $advs = array(); foreach($checkdirs as $key) { if($key) { $dir = DISCUZ_ROOT.'./source/plugin/'.$key.'/adv'; } else { $dir = DISCUZ_ROOT.'./source/class/adv'; } if(!file_exists($dir)) { continue; } $advdir = dir($dir); while($entry = $advdir->read()) { if(!in_array($entry, array('.', '..')) && preg_match("/^adv\_[\w\.]+$/", $entry) && substr($entry, -4) == '.php' && strlen($entry) < 30 && is_file($dir.'/'.$entry)) { @include_once $dir.'/'.$entry; $advclass = substr($entry, 0, -4); if(class_exists($advclass)) { $adv = new $advclass(); $script = substr($advclass, 4); $script = ($key ? $key.':' : '').$script; $advs[$entry] = array( 'class' => $script, 'name' => lang('adv/'.$script, $adv->name), 'version' => $adv->version, 'copyright' => lang('adv/'.$script, $adv->copyright), 'filemtime' => @filemtime($dir.'/'.$entry) ); } } } } uasort($advs, 'filemtimesort'); return $advs; } ?>