array( 'controller' => 'media_admin_ui', 'path' => null, 'ui' => 'media_form_ui', 'uipath' => null ), 'cat' => array( 'controller' => 'faq_cat_ui', 'path' => null, 'ui' => 'faq_cat_form_ui', 'uipath' => null ) ); protected $adminMenu = array( 'main/list' => array('caption'=> 'Media Library', 'perm' => 'A'), 'main/create' => array('caption'=> "Add New Media", 'perm' => 'A'), 'main/import' => array('caption'=> "Batch Media Import", 'perm' => 'A'), 'cat/list' => array('caption'=> 'Media Categories', 'perm' => 'A'), // 'cat/create' => array('caption'=> "Create Category", 'perm' => 'A'), 'main/icons' => array('caption'=> IMALAN_71, 'perm' => 'A'), 'main/settings' => array('caption'=> LAN_PREFS, 'perm' => 'A'), 'main/avatar' => array('caption'=> IMALAN_23, 'perm' => 'A') ); /* $var['main']['text'] = IMALAN_7; $var['main']['link'] = e_SELF; $var['icons']['text'] = IMALAN_71; $var['icons']['link'] = e_SELF."?icons"; $var['avatars']['text'] = IMALAN_23; $var['avatars']['link'] = e_SELF."?avatars"; $var['editor']['text'] = "Image Manipulation (future release)"; $var['editor']['link'] = e_SELF."?editor";*/ protected $adminMenuAliases = array( 'main/edit' => 'main/list' ); protected $menuTitle = LAN_MEDIAMANAGER; } class faq_cat_ui extends e_admin_ui { protected $pluginTitle = 'Media Categories'; protected $pluginName = 'core'; protected $table = "core_media_cat"; protected $pid = "media_cat_id"; protected $perPage = 0; //no limit protected $batchDelete = false; // protected $listQry = "SELECT * FROM #faq_info"; // without any Order or Limit. // protected $editQry = "SELECT * FROM #faq_info WHERE faq_info_id = {ID}"; protected $fields = array( 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), 'media_cat_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE, 'readonly'=>TRUE), 'media_cat_nick' => array('title'=> "Nickname", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>TRUE), 'media_cat_title' => array('title'=> LAN_TITLE, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>TRUE), 'media_cat_diz' => array('title'=> LAN_DESCRIPTION, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1','readonly'=>TRUE), // Display name 'media_cat_class' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'width' => 'auto', 'data' => 'int'), // 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center') ); /** * Get FAQ Category data * * @param integer $id [optional] get category title, false - return whole array * @param mixed $default [optional] default value if not found (default 'n/a') * @return */ function getFaqCategoryTree($id = false, $default = 'n/a') { // TODO get faq category tree } } class faq_cat_form_ui extends e_admin_form_ui { public function faq_info_parent($curVal,$mode) { // TODO - catlist combo without current cat ID in write mode, parents only for batch/filter // Get UI instance $controller = $this->getController(); switch($mode) { case 'read': return e107::getParser()->toHTML($controller->getFaqCategoryTree($curVal), false, 'TITLE'); break; case 'write': return $this->selectbox('faq_info_parent', $controller->getFaqCategoryTree(), $curVal); break; case 'filter': case 'batch': return $controller->getFaqCategoryTree(); break; } } } class media_form_ui extends e_admin_form_ui { private $cats = array(); function init() { $sql = e107::getDb(); // $sql->db_Select_gen("SELECT media_cat_title, media_title_nick FROM #core_media as m LEFT JOIN #core_media_cat as c ON m.media_category = c.media_cat_nick GROUP BY m.media_category"); $sql->db_Select_gen("SELECT media_cat_title, media_cat_nick FROM #core_media_cat"); while($row = $sql->db_Fetch()) { $cat = $row['media_cat_nick']; $this->cats[$cat] = $row['media_cat_title']; } asort($this->cats); } function media_category($curVal,$mode) // not really necessary since we can use 'dropdown' - but just an example of a custom function. { if($mode == 'read') { return $this->cats[$curVal].' (custom!)'; } if($mode == 'batch') // Custom Batch List for release_type { return $this->cats; } if($mode == 'filter') // Custom Filter List for release_type { return $this->cats; } $text = ""; return $text; } } class media_admin_ui extends e_admin_ui { protected $pluginTitle = LAN_MEDIAMANAGER; protected $pluginName = 'core'; protected $table = "core_media"; // protected $listQry = "SELECT * FROM #core_media"; // without any Order or Limit. // //protected $editQry = "SELECT * FROM #comments WHERE comment_id = {ID}"; // protected $tableJoin = array( // 'u.user' => array('leftField' => 'media_author', 'rightField' => 'user_id', 'fields' => 'user_id,user_loginname,user_name') // ); protected $pid = "media_id"; protected $perPage = 10; protected $batchDelete = true; //TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields /* * We need a column with a preview that is generated from the path of another field. * ie. the preview column should show a thumbnail which is generated from the media_url column. * It needs to also take into consideration the type of media (image, video etc) which comes from another field. */ protected $fields = array( 'checkboxes' => array('title'=> '', 'type' => null, 'data'=> null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), 'media_id' => array('title'=> LAN_ID, 'type' => 'number', 'data'=> 'int', 'width' =>'5%', 'forced'=> TRUE, 'nolist'=>TRUE), 'media_url' => array('title'=> 'Preview', 'type' => 'image', 'data'=> 'str', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=100', 'width' => 'auto','readonly'=>TRUE), // 'media_preview' => array('title'=> "Preview", 'type' => 'image', 'data'=> null, 'width' => '10%'), 'media_upload' => array('title'=> "Upload File", 'type' => 'upload', 'data'=> false, 'readParm' => 'hidden', 'width' => '10%', 'nolist' => true), 'media_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'data'=> 'str', 'width' => 'auto'), 'media_caption' => array('title'=> "Caption", 'type' => 'text', 'data'=> 'str', 'width' => 'auto'), 'media_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'bbarea', 'data'=> 'str', 'width' => 'auto', 'thclass' => 'left first', 'readParms' => 'truncate=100', 'writeParms' => 'counter=0'), 'media_category' => array('title'=> LAN_CATEGORY, 'type' => 'method', 'data'=> 'str', 'width' => 'auto', 'filter' => true, 'batch' => true,), 'media_type' => array('title'=> "Mime Type", 'type' => 'text', 'data'=> 'str', 'width' => 'auto', 'noedit'=>TRUE), // 'media_author' => array('title'=> LAN_AUTHOR, 'type' => 'user', 'data'=> 'int'), 'media_author' => array('title'=> LAN_USER, 'type' => 'user', 'data'=> 'int', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'noedit'=>TRUE ), 'media_datestamp' => array('title'=> LAN_DATESTAMP, 'type' => 'datestamp', 'data'=> 'int', 'width' => '10%', 'noedit'=>TRUE), // User date 'media_size' => array('title'=> "Size", 'type' => 'number', 'data'=> 'int', 'width' => 'auto', 'noedit'=>TRUE), 'media_dimensions' => array('title'=> "Dimensions", 'type' => 'text', 'data'=> 'str', 'width' => '5%', 'noedit'=>TRUE, 'class'=>'nowrap'), 'media_userclass' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'data'=> 'str', 'width' => '10%', 'thclass' => 'center','filter'=>TRUE,'batch'=>TRUE ), 'media_tags' => array('title'=> "Tags/Keywords", 'type' => 'text', 'data'=> 'str', 'width' => '10%', 'filter'=>TRUE,'batch'=>TRUE ), 'media_usedby' => array('title'=> '', 'type' => 'text', 'data'=> 'text', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'nolist'=>true, 'readonly'=>TRUE ), 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'data'=> null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center') ); protected $mimePaths = array( 'text' => 'files', 'multipart' => 'files', 'application' => 'files', 'audio' => 'audio', 'image' => 'images', 'video' => 'video', 'other' => 'files' ); // protected $fieldpref = array('checkboxes','media_url', 'media_id', 'media_thumb', 'media_title', 'media_caption', 'media_description', 'media_category', 'media_datestamp','media_userclass', 'options'); /* protected $prefs = array( 'pref_type' => array('title'=> 'type', 'type'=>'text'), 'pref_folder' => array('title'=> 'folder', 'type' => 'boolean'), 'pref_name' => array('title'=> 'name', 'type' => 'text') );*/ protected $cats = array(); function init() { //FIXME - would prefer not to have to read this twice on the same page. $sql = e107::getDb(); // $sql->db_Select_gen("SELECT media_cat_title, media_title_nick FROM #core_media as m LEFT JOIN #core_media_cat as c ON m.media_category = c.media_cat_nick GROUP BY m.media_category"); $sql->db_Select_gen("SELECT media_cat_title, media_cat_nick FROM #core_media_cat"); while($row = $sql->db_Fetch()) { $cat = $row['media_cat_nick']; $this->cats[$cat] = $row['media_cat_title']; } asort($this->cats); if(varset($_POST['batch_import_selected'])) { $this->batchImport(); } } function importPage() { $this->batchImportForm(); } function settingsPage() { main_config(); } function avatarPage() { show_avatars(); } function iconsPage() { $this->icon_editor(); } /** * Invoked just before item create event * @return array */ public function beforeCreate($new_data) { // return data to be merged with posted model data $this->getRequest()->setPosted('media_upload', null); //$dataFields = $this->getModel()->getDataFields(); //unset($dataFields['media_upload']); $this->getModel()->setDataFields($dataFields); return $this->observeUploaded($new_data); } /** * Same as beforeCreate() but invoked on edit * @return */ public function beforeUpdate($new_data, $old_data, $id) { // return data to be merged with posted model data return $this->observeUploaded($new_data); } // XXX - strict mysql error on Create without UPLOAD! function observeUploaded($new_data) { $fl = e107::getFile(); $mes = e107::getMessage(); $pref['upload_storagetype'] = "1"; require_once(e_HANDLER."upload_handler.php"); //TODO - still not a class! $uploaded = process_uploaded_files(e_MEDIA.'temp/'); //FIXME doesn't handle xxx.JPG (uppercase) foreach($uploaded as $upload) { if(vartrue($upload['error'])) { $mes->add($upload['message'], E_MESSAGE_ERROR); return FALSE; } if(!$typePath = $this->getPath($upload['type'])) { return FALSE; } $oldpath = 'temp/'.$upload['name']; $newpath = $typePath.'/'.$upload['name']; $info = $fl->get_file_info(e_MEDIA.$oldpath); $upload_data = array( // not saved if 'noedit' is active. 'media_type' => $upload['type'], 'media_datestamp' => time(), 'media_url' => "{e_MEDIA}".$newpath, 'media_size' => $upload['size'], 'media_author' => USERID, 'media_usedby' => '', 'media_tags' => '', 'media_dimensions' => $info['img-width']." x ".$info['img-height'] ); if(!varset($new_data['media_name'])) { $upload_data['media_name'] = $upload['name']; } // only one upload? Not sure what's the idea here // we are currently creating one media item if(!rename(e_MEDIA.$oldpath, e_MEDIA.$newpath)) { $mes->add("Couldn't move file from ".$oldpath." to ".$newpath, E_MESSAGE_ERROR); return FALSE; }; return $upload_data; } } function beforeDelete($data, $id) // call before 'delete' is executed. - return false to prevent delete execution (e.g. some dependencies check) { return true; } function afterDelete($deleted_data, $id) // call after 'delete' is successfully executed. - delete the file with the db record (optional pref) { } function getPath($mime) { $mes = e107::getMessage(); list($pmime,$tmp) = explode('/',$mime); if(!vartrue($this->mimePaths[$pmime])) { $mes->add("Couldn't detected mime-type($type). Upload failed.", E_MESSAGE_ERROR); return FALSE; } $dir = $this->mimePaths[$pmime]."/".date("Y-m"); if(!is_dir(e_MEDIA.$dir)) { if(!mkdir(e_MEDIA.$dir, 0755)) { $mes->add("Couldn't create folder ($dir).", E_MESSAGE_ERROR); return FALSE; }; } return $dir; } function batchImportForm() { $frm = e107::getForm(); $mes = e107::getMessage(); $fl = e107::getFile(); $fl->setFileInfo('all'); $files = $fl->get_files(e_MEDIA."temp/"); //TODO Detect XML file, and if found - read that instead of the directory. if(!vartrue($_POST['batch_import_selected'])) { $mes->add("Scanning Media in folder: ".e_MEDIA."temp/", E_MESSAGE_INFO); } if(!count($files)) { $mes->add("No media Found!", E_MESSAGE_INFO); return; } $text = "
".DBLAN_20." "; foreach($files as $f) { $text .= ""; } $text .= "
Checkbox Preview ".LAN_NAME." Mime Type File Size ".LAN_DATESTAMP." Dimensions
".$frm->checkbox("batch_selected[]",$f['fname'])." ".$this->preview($f)." ".$f['fname']." ".$f['mime']." ".$f['fsize']." ".e107::getDateConvert()->convert_date($f['modified'])." ".$f['img-width']." x ".$f['img-height']."
Import into Category: ".$frm->selectbox('batch_category',$this->cats)."
".$frm->admin_button('batch_import_selected', "Import Selected Files", 'import')."
"; echo $mes->render().$text; } function batchImport() { $fl = e107::getFile(); $mes = e107::getMessage(); $sql = e107::getDb(); foreach($_POST['batch_selected'] as $file) { $oldpath = "temp/".$file; $f = $fl->get_file_info(e_MEDIA.$oldpath); $newpath = $this->getPath($f['mime']).'/'.$file; $f['fname'] = $file; if(rename(e_MEDIA.$oldpath,e_MEDIA.$newpath)) { $insert = array( 'media_caption' => $f['fname'], 'media_description' => '', 'media_category' => $_POST['batch_category'], 'media_datestamp' => $f['modified'], 'media_url' => "{e_MEDIA}".$newpath, 'media_userclass' => 0, 'media_name' => $f['fname'], 'media_author' => USERID, 'media_size' => $f['fsize'], 'media_dimensions' => $f['img-width']." x ".$f['img-height'], 'media_usedby' => '', 'media_tags' => '', 'media_type' => $f['mime'] ); if($sql->db_Insert("core_media",$insert)) { $mes->add("Importing Media: ".$f['fname'], E_MESSAGE_SUCCESS); } else { rename(e_MEDIA.$newpath,e_MEDIA.$oldpath); //move it back. } } } } function preview($f) { list($type,$tmp) = explode("/",$f['mime']); if($type == 'image') { return "\"".$f['name']."\""; } else { return; //TODO generic icon/image for no preview. } } function icon_editor() { global $iconpool, $e107; $ns = e107::getRender(); $tp = e107::getParser(); $frm = e107::getForm(); $mes = e107::getMessage(); ksort($iconpool); $text = "
".DBLAN_20." "; $tmp = array(16, 32, 48, 64, 128); foreach($iconpool as $key => $val) { $tmp1 = array(); foreach($val as $icon) { $filepath = $icon; $filepath_abs = $tp->replaceConstants($icon); $icon_file = basename($filepath_abs); $str = "{$icon_file}"; foreach ($tmp as $isize) { if(strpos($icon_file, '_'.$isize.'.') !== false) { $tmp1[$isize] = varset($tmp1[$isize]).str_replace('%%size%%', ' S'.$isize, $str); continue 2; } } $tmp1['other'] = varset($tmp1['other']).$str;//other } $ptext = "
".str_replace('%%size%%', '', implode('
', $tmp1))."
"; // $ptext = (is_array($val)) ? "
".print_r($val, TRUE)."
" : htmlspecialchars($val, ENT_QUOTES, CHARSET); // $ptext = $e107->tp->textclean($ptext, 80); $text .= " "; } $text .= "
".LAN_DELETE." ".LAN_CATEGORY." ".IMALAN_72." ".LAN_OPTIONS."
".$frm->checkbox("delpref2[$key]", 1)." {$key} {$ptext} ".$frm->submit_image("delpref[$key]", LAN_DELETE, 'delete', LAN_CONFIRMDEL." [$key]")."
".$frm->admin_button('delpref_checked', LAN_DELCHECKED, 'delete')."
"; //$text .= "
".DBLAN_13."
\n"; // $ns->tablerender(LAN_MEDIAMANAGER." :: ".IMALAN_71, $mes->render().$text); echo $mes->render().$text; } } new media_admin(); require_once(e_ADMIN."auth.php"); e107::getAdminUI()->runPage(); // ----------------------------------------------------------------------- $action = e_QUERY; if(isset($_POST['delpref']) || (isset($_POST['delpref_checked']) && isset($_POST['delpref2']))) { del_pref_val(); } if(varset($_GET['action']) == "icons") { // icon_editor(); } if(varset($_GET['action']) == "avatars") { // show_avatars(); } if(varset($_GET['action']) == 'settings') { // main_config(); } /* * DELETE CHECKED AVATARS - SHOW AVATAR SCREEN */ if (isset($_POST['submit_show_delete_multi'])) { if(varset($_POST['multiaction'])) { $tmp = array(); $tmp1 = array(); $message = array(); foreach ($_POST['multiaction'] as $todel) { $todel = explode('#', $todel); $todel[1] = basename($todel[1]); $image_type = 2; if(strpos($todel[1], '-upload-') === 0) { $image_type = 1; $todel[1] = substr($todel[1], strlen('-upload-')); } //delete it from server @unlink(e_UPLOAD."avatars/".$todel[1]); //admin log & sysmessage $message[] = $todel[1]; //It's owned by an user if($todel[0]) { switch ($image_type) { case 1: //avatar $tmp[] = intval($todel[0]); break; case 2: //photo $tmp1[] = intval($todel[0]); break; } } } //Reset all deleted user avatars with one query if(!empty($tmp)) { $sql->db_Update("user", "user_image='' WHERE user_id IN (".implode(',', $tmp).")"); } //Reset all deleted user photos with one query if(!empty($tmp1)) { $sql->db_Update("user", "user_sess='' WHERE user_id IN (".implode(',', $tmp1).")"); } unset($tmp, $tmp1); //Format system message if(!empty($message)) { $admin_log->log_event('IMALAN_01', implode('[!br!]', $message), E_LOG_INFORMATIVE, ''); $emessage->add(implode(', ', $message).' '.IMALAN_28, E_MESSAGE_SUCCESS); } } } /* * DELETE ALL UNUSED IMAGES - SHOW AVATAR SCREEN */ if (isset($_POST['submit_show_deleteall'])) { $handle = opendir(e_UPLOAD."avatars/"); $dirlist = array(); while ($file = readdir($handle)) { if (!is_dir(e_UPLOAD."avatars/{$file}") && $file != '.' && $file != '..' && $file != "index.html" && $file != "null.txt" && $file != '/' && $file != 'CVS' && $file != 'Thumbs.db') { $dirlist[] = $file; } } closedir($handle); if(!empty($dirlist)) { $imgList = ''; $count = 0; foreach ($dirlist as $image_name) { $image_name = basename($image_name); $image_todb = $tp->toDB($image_name); if (!$sql->db_Count('user', '(*)', "WHERE user_image='-upload-{$image_todb}' OR user_sess='{$image_todb}'")) { unlink(e_UPLOAD."avatars/".$image_name); $imgList .= '[!br!]'.$image_name; $count++; } } $message = $count." ".IMALAN_26; $emessage->add($message, E_MESSAGE_SUCCESS); $admin_log->log_event('IMALAN_02', $message.$imgList,E_LOG_INFORMATIVE, ''); unset($imgList); } } /* * DELETE ALL CHECKED BAD IMAGES - VALIDATE SCREEN */ if (isset($_POST['submit_avdelete_multi'])) { require_once(e_HANDLER."avatar_handler.php"); $avList = array(); $tmp = array(); $uids = array(); //Sanitize $_POST['multiaction'] = $tp->toDB($_POST['multiaction']); //sql queries significant reduced if(!empty($_POST['multiaction']) && $sql->db_Select("user", 'user_id, user_name, user_image', "user_id IN (".implode(',', $_POST['multiaction']).")")) { $search_users = $sql->db_getList('ALL', FALSE, FALSE, 'user_id'); foreach($_POST['multiaction'] as $uid) { if (varsettrue($search_users[$uid])) { $avname = avatar($search_users[$uid]['user_image']); if (strpos($avname, "http://") === FALSE) { // Internal file, so unlink it @unlink($avname); } $uids[] = $uid; $tmp[] = $search_users[$uid]['user_name']; $avList[] = $uid.':'.$search_users[$uid]['user_name'].':'.$search_users[$uid]['user_image']; } } //sql queries significant reduced if(!empty($uids)) { $sql->db_Update("user", "user_image='' WHERE user_id IN (".implode(',', $uids).")"); } $emessage->add(IMALAN_51.''.implode(', ', $tmp).' '.IMALAN_28, E_MESSAGE_SUCCESS); $admin_log->log_event('IMALAN_03', implode('[!br!]', $avList), E_LOG_INFORMATIVE, ''); unset($search_users); } unset($avList, $tmp, $uids); } /* * UPDATE IMAGE OPTIONS - MAIN SCREEN */ if (isset($_POST['update_options'])) { $tmp = array(); $tmp['image_post'] = intval($_POST['image_post']); $tmp['resize_method'] = $tp->toDB($_POST['resize_method']); $tmp['im_path'] = trim($tp->toDB($_POST['im_path'])); $tmp['image_post_class'] = intval($_POST['image_post_class']); $tmp['image_post_disabled_method'] = intval($_POST['image_post_disabled_method']); $tmp['enable_png_image_fix'] = intval($_POST['enable_png_image_fix']); if ($admin_log->logArrayDiffs($tmp, $pref, 'IMALAN_04')) { save_prefs(); // Only save if changes $emessage->add(IMALAN_9, E_MESSAGE_SUCCESS); } else { $emessage->add(IMALAN_20, E_MESSAGE_INFO); } } /* * SHOW AVATARS SCREEN */ function show_avatars() { global $e107, $pref; $ns = e107::getRender(); $sql = e107::getDb(); $frm = e107::getForm(); $tp = e107::getParser(); $mes = e107::getMessage(); $handle = opendir(e_UPLOAD."avatars/"); //TODO replace with $fl $dirlist = array(); while ($file = readdir($handle)) { if ($file != '.' && $file != '..' && $file != "index.html" && $file != "null.txt" && $file != '/' && $file != 'CVS' && $file != 'Thumbs.db' && !is_dir($file)) { $dirlist[] = $file; } } closedir($handle); $text = ''; if (empty($dirlist)) { $text .= IMALAN_29; } else { $text = "
"; $count = 0; while (list($key, $image_name) = each($dirlist)) { $users = IMALAN_21." | "; $row = array('user_id' => ''); $image_pre = ''; $disabled = false; if ($sql->db_Select("user", "*", "user_image='-upload-".$tp->toDB($image_name)."' OR user_sess='".$tp->toDB($image_name)."'")) { $row = $sql->db_Fetch(); if($row['user_image'] == '-upload-'.$image_name) $image_pre = '-upload-'; $users .= "{$row['user_name']} (".($row['user_sess'] == $image_name ? IMALAN_24 : IMALAN_23).")"; } else { $users = ''.IMALAN_22.''; } //directory? if(is_dir(e_UPLOADE."avatars/".$image_name)) { //File info $users = "".IMALAN_66.": {$image_name} ".IMALAN_69.""; //Friendly UI - click text to select a form element $img_src = ''.IMALAN_70.''; $disabled = true; } else { //File info $users = "".IMALAN_66.": {$image_name} ".$users; // Control over the image size (design) $image_size = getimagesize(e_UPLOAD."avatars/".$image_name); //Friendly UI - click text to select a form element $img_src = ""; if ($image_size[0] > $pref['im_width'] || $image_size[1] > $pref['im_height']) { $img_src = "".IMALAN_57.""; } } //style attribute allowed here - server side width/height control //autocheck class - used for JS selectors (see eCoreImage object) $text .= "
{$users}
{$img_src}
".$frm->checkbox('multiaction[]', "{$row['user_id']}#{$image_pre}{$image_name}", false, array('id' => false, 'disabled' => $disabled))."
"; $count++; } $text .= "
".$frm->admin_button('check_all', LAN_CHECKALL, 'action')." ".$frm->admin_button('uncheck_all', LAN_UNCHECKALL, 'action')." ".$frm->admin_button('submit_show_delete_multi', LAN_DELCHECKED, 'delete')." ".$frm->admin_button('submit_show_deleteall', IMALAN_25, 'delete')." ".$frm->admin_button('submit_cancel_show', IMALAN_68, 'cancel')."
"; } echo $mes->render().$text; return; // $ns->tablerender(LAN_MEDIAMANAGER." :: ".IMALAN_18, $mes->render().$text); } /* * CHECK AVATARS SCREEN */ if (isset($_POST['check_avatar_sizes'])) { // Set up to track what we've done // $iUserCount = 0; $iAVinternal = 0; $iAVexternal = 0; $iAVnotfound = 0; $iAVtoobig = 0; require_once(e_HANDLER."avatar_handler.php"); $text = "
".CACLAN_3." "; // // Loop through avatar field for every user // $iUserCount = $sql->db_Count("user"); $found = false; $allowedWidth = intval($pref['im_width']); $allowedHeight = intval($pref['im_width']); if ($sql->db_Select("user", "*", "user_image!=''")) { while ($row = $sql->db_Fetch()) { //Check size $avname=avatar($row['user_image']); if (strpos($avname,"http://")!==FALSE) { $iAVexternal++; $bAVext=TRUE; } else { $iAVinternal++; $bAVext=FALSE; } $image_stats = getimagesize($avname); $sBadImage=""; if (!$image_stats) { $iAVnotfound++; // allow delete $sBadImage=IMALAN_42; } else { $imageWidth = $image_stats[0]; $imageHeight = $image_stats[1]; if ( ($imageHeight > $allowedHeight) || ($imageWidth > $allowedWidth) ) { // Too tall or too wide $iAVtoobig++; if ($imageWidth > $allowedWidth) { $sBadImage = IMALAN_40." ($imageWidth)"; } if ($imageHeight > $allowedHeight) { if (strlen($sBadImage)) { $sBadImage .= ", "; } $sBadImage .= IMALAN_41." ($imageHeight)"; } } } //If not found or too large, allow delete if (strlen($sBadImage)) { $found = true; $text .= " "; } } } //Nothing found if(!$found) { $text .= " "; } $text .= "
".LAN_OPTIONS." ".LAN_USER." ".IMALAN_62." ".LAN_URL."
".$row['user_name']." ".$sBadImage." ".$avname."
".IMALAN_65."
".$frm->admin_button('check_all', LAN_CHECKALL, 'action')." ".$frm->admin_button('uncheck_all', LAN_UNCHECKALL, 'action')." ".$frm->admin_button('submit_avdelete_multi', LAN_DELCHECKED, 'delete')."
".IMALAN_38." {$allowedWidth}
".IMALAN_39." {$allowedHeight}
".IMALAN_45." {$iAVnotfound}
".IMALAN_46." {$iAVtoobig}
".IMALAN_47." {$iAVinternal}
".IMALAN_48." {$iAVexternal}
".IMALAN_49." ".($iAVexternal+$iAVinternal)." (".(int)(100.0*(($iAVexternal+$iAVinternal)/$iUserCount)).'%, '.$iUserCount." ".IMALAN_50.")
"; $ns->tablerender(IMALAN_37, $emessage->render().$text); } /* * MAIN CONFIG SCREEN */ function main_config() { global $pref; $frm = e107::getForm(); $tp = e107::getParser(); $sql = e107::getDb(); $ns = e107::getRender(); $mes = e107::getMessage(); if(function_exists('gd_info')) { $gd_info = gd_info(); $gd_version = $gd_info['GD Version']; } else { $gd_version = " ".IMALAN_55.""; } $IM_NOTE = ""; if($pref['im_path'] != "") { $im_file = $pref['im_path'].'convert'; if(!file_exists($im_file)) { $IM_NOTE = "".IMALAN_52.""; } else { $cmd = "{$im_file} -version"; $tmp = `$cmd`; if(strpos($tmp, "ImageMagick") === FALSE) { $IM_NOTE = "".IMALAN_53.""; } } } $text = "
".IMALAN_7."
".IMALAN_1."
".$frm->checkbox('image_post', 1, $pref['image_post'])."
".IMALAN_2."
".IMALAN_10." ".r_userclass('image_post_class',$pref['image_post_class'],"off","public,guest,nobody,member,admin,main,classes")."
".IMALAN_11."
".IMALAN_12." ".$frm->select_open('image_post_disabled_method')." ".$frm->option(IMALAN_14, '0', ($pref['image_post_disabled_method'] == "0"))." ".$frm->option(IMALAN_15, '1', ($pref['image_post_disabled_method'] == "1"))." ".$frm->select_close()."
".IMALAN_13."
".IMALAN_3."
".IMALAN_54." {$gd_version}
".$frm->select_open('resize_method')." ".$frm->option('gd1', 'gd1', ($pref['resize_method'] == "gd1"))." ".$frm->option('gd2', 'gd2', ($pref['resize_method'] == "gd2"))." ".$frm->option('ImageMagick', 'ImageMagick', ($pref['resize_method'] == "ImageMagick"))." ".$frm->select_close()."
".IMALAN_4."
".IMALAN_5."
{$IM_NOTE}
".$frm->text('im_path', $pref['im_path'])."
".IMALAN_6."
".IMALAN_34."
".$frm->checkbox('enable_png_image_fix', 1, ($pref['enable_png_image_fix']))."
".IMALAN_35."
".IMALAN_36." ".$frm->admin_button('check_avatar_sizes', ADLAN_145)."
".$frm->admin_button('update_options', IMALAN_8, 'update')."
"; echo $mes->render().$text; return; $ns->tablerender(LAN_MEDIAMANAGER." :: ".IMALAN_7, $mes->render().$text); } //Just in case... if(!e_AJAX_REQUEST) require_once("footer.php"); function del_pref_val() { global $iconpool, $e107cache, $emessage; $del = array_keys($_POST['delpref']); $delpref = key($_POST['delpref']); if($delpref) { unset($iconpool[$delpref]); $deleted_list .= "
  • ".$delpref."
  • "; } if($_POST['delpref2']) { foreach($_POST['delpref2'] as $k => $v) { $deleted_list .= "
  • ".$k."
  • "; unset($iconpool[$k]); } } if(save_prefs('iconpool')) { $emessage->add(LAN_DELETED.""); $e107cache->clear(); } //$e107->ns->tablerender(LAN_DELETED,$message); } /** * Handle page DOM within the page header * * @return string JS source */ //function headerjs() //{ // require_once(e_HANDLER.'js_helper.php'); // //FIXME - how exactly to auto-call JS lan? This and more should be solved in Stage II. // $ret = " // // // "; // // return $ret; //} ?>