set_id('album'); $tabsheet->select('metaog-album'); $tabsheet->assign(); $template->assign( 'metaoggestalbum', array( 'A' => 'A' )); if (isset($_GET['cat_id']) and !isset($_GET['image_id'])){ global $template, $prefixeTable, $conf; $pageog=$_GET['cat_id']; $metaog = pwg_db_fetch_assoc(pwg_query("SELECT * FROM " . METAOG_TABLE . " WHERE type = 3 AND idobj = '".$_GET['cat_id']."';")); if(empty($metaog)){ $metaog['id']=''; $metaog['metaogtitle']=''; $metaog['metaogdescription']=''; $metaog['metaogimage']=''; } if(isset($conf['mogshowpaa']) and $conf['mogshowpaa']==true){ $tab_picture = listphotosmog(); $metaog['path']=''; if (pwg_db_num_rows($tab_picture)){ while ($info_photos = pwg_db_fetch_assoc($tab_picture)) { if($info_photos['id']==$metaog['metaogimage']){ $select="SELECTED"; $metaog['path']=$info_photos['path']; }else{ $select=""; } if(empty($info_photos['name'])){$legend=$info_photos['file'];}else{$legend=$info_photos['name'];} $items = array( 'PHOTOID' => $info_photos['id'], 'PHOTOINFO' => $info_photos['id'].' - '.$legend, 'PHOTOSELECT' => $select, 'PHOTOURL' => get_absolute_root_url().PWG_DERIVATIVE_DIR.substr($info_photos['path'], 2, -4)."-th".substr($info_photos['path'],-4), ); $template->append('info_photos', $items); } } if (empty($metaog['metaogimage'])){unset($metaog['metaogimage']);} if(isset($metaog['metaogimage'])){ $metaogpath=get_absolute_root_url().PWG_DERIVATIVE_DIR.substr($metaog['path'], 2, -4)."-th".substr($metaog['path'],-4); }else{ $metaogpath=""; $metaog['metaogimage']=""; } $template->assign('SHOWMOGI', "1"); }else{ $template->assign('SHOWMOGI', "0"); } if(!isset($metaogpath)){$metaogpath="";} $tab_album = pwg_db_fetch_assoc(pwg_query("SELECT id,representative_picture_id FROM " . CATEGORIES_TABLE . " WHERE id = '".$_GET['cat_id']."';")); $template->assign( 'metaog_editA', array( 'metaogidid' => $metaog['id'], 'metaogidobj' => $pageog, 'metaogtitle' => $metaog['metaogtitle'], 'metaogdescription' => $metaog['metaogdescription'], 'metaogimage' => $metaog['metaogimage'], 'metaogpath' => $metaogpath, 'metaogrealbum' => $tab_album['representative_picture_id'], )); } if (isset($_POST['submitmetaogalbum'])){ if (isset($_POST['metaogimagesaveA'])){ if($_POST['metaogimagesaveA']=="-10" || $_POST['metaogimagesaveA']==$tab_album['representative_picture_id']){$_POST['metaogimagesaveA']='';} }else{ $_POST['metaogimagesaveA']=''; } if(!empty($_POST['metaogidA'])){ if($_POST['metaogidobjA'] == $_POST['metaogimagesaveA']){$_POST['metaogimagesaveA']='';} $query = ' UPDATE ' . METAOG_TABLE . ' SET metaogtitle= \''.$_POST['metaogtitlesaveA'].'\' ,metaogdescription= \''.$_POST['metaogdescriptionsaveA'].'\' ,metaogimage= \''.$_POST['metaogimagesaveA'].'\' WHERE id = \''.$_POST['metaogidA'].'\' ;'; pwg_query($query); }else{ $q = 'INSERT INTO ' . $prefixeTable . 'metaog(type,idobj,metaogtitle,metaogdescription,metaogimage)VALUES (3,"' . $_POST['metaogidobjA'] . '","' . $_POST['metaogtitlesaveA'] . '","' . $_POST['metaogdescriptionsaveA'] . '","' . $_POST['metaogimagesaveA'] .'");'; pwg_query($q); } header('Location:'.get_root_url().'admin.php?page=plugin-meta_og-album&cat_id='.$cat_id); $page['infos'][] = l10n('Album updated successfully'); } }else{ if (!isset($_GET['tab'])) $page['tab'] = 'gestion'; else $page['tab'] = $_GET['tab']; $tabsheet = new tabsheet(); $tabsheet->add('gestion', l10n('Add Open Graph metadata'), METAOG_ADMIN . '-gestion'); $tabsheet->add('config', l10n('Configuration'), METAOG_ADMIN . '-config'); $tabsheet->select($page['tab']); $tabsheet->assign(); } // Tab Title on specials pages switch ($page['tab']) { case 'gestion': global $pwg_loaded_plugins; $metaogpagelistT = array( l10n('Select Page'), '----------------------', l10n('Home'), l10n('Best rated'), l10n('Most visited'), l10n('Recent pictures'), l10n('Recent categories'), l10n('Favorites'), l10n('Tags'), l10n('Comments'), l10n('About'), l10n('search'), l10n('Random pictures'), l10n('Notification'), ); $metaogpagelist = array( '', '', 'categories', 'best_rated', 'most_visited', 'recent_pics', 'recent_cats', 'favorites', 'tags', 'comments', 'about', 'search', 'list', 'notification', ); if (isset($pwg_loaded_plugins['ContactForm'])){ $metaogpagelistT[]=l10n('contact'); $metaogpagelist[]='contact'; } if (isset($pwg_loaded_plugins['GuestBook'])){ $metaogpagelistT[]=l10n('GuestBook'); $metaogpagelist[]='GuestBook'; } if (isset($pwg_loaded_plugins['GuestBook'])){ $result = pwg_query('SELECT id,title FROM ' . ADD_PAGES_TABLE . ' ORDER BY id ASC;'); while ($row = pwg_db_fetch_assoc($result)) { $metaogpagelistT[]=l10n('Additional Page').' : '.$row['title']; $metaogpagelist[]=$row['id']; } } $template->assign( 'metagestion', array( 'a' => 'a', )); $template->assign('metaogpagelist', $metaogpagelist); $template->assign('metaogpagelistT', $metaogpagelistT); if (isset($_POST['submetaogchp'])){ if(empty($_POST['metaoglist'])){ array_push($page['errors'], l10n('You must select a page')); break; } $pageog=$_POST['metaoglist']; if(is_numeric($pageog)){$type='4';}else{$type='1';} $metaog = pwg_db_fetch_assoc(pwg_query("SELECT * FROM " . METAOG_TABLE . " WHERE type = ".$type." AND page = '".$_POST['metaoglist']."';")); if(empty($metaog)){ $metaog['id']=''; $metaog['metaogtitle']=''; $metaog['metaogdescription']=''; $metaog['metaogimage']=''; } $metaog['path']=''; $tab_picture = listphotosmog(); if (pwg_db_num_rows($tab_picture)) { while ($info_photos = pwg_db_fetch_assoc($tab_picture)) { if($info_photos['id']==$metaog['metaogimage']){ $select="SELECTED"; $metaog['path']=$info_photos['path']; }else{ $select=""; $path=""; } if(empty($info_photos['name'])){$legend=$info_photos['file'];}else{$legend=$info_photos['name'];} $items = array( 'PHOTOID' => $info_photos['id'], 'PHOTOINFO' => $info_photos['id'].' - '.$legend, 'PHOTOSELECT' => $select, 'PHOTOURL' => get_absolute_root_url().PWG_DERIVATIVE_DIR.substr($info_photos['path'], 2, -4)."-th".substr($info_photos['path'],-4), ); $template->append('info_photos', $items); } } if (empty($metaog['metaogimage'])){unset($metaog['metaogimage']);} if(isset($metaog['metaogimage'])){ $metaogpath=get_absolute_root_url().PWG_DERIVATIVE_DIR.substr($metaog['path'], 2, -4)."-th".substr($metaog['path'],-4); }else{ $metaogpath=""; $metaog['metaogimage']=""; } $template->assign( 'metaog_edit', array( 'id' => $metaog['id'], 'VALUE' => $pageog, 'metaogtitle' => $metaog['metaogtitle'], 'metaogdescription' => $metaog['metaogdescription'], 'metaogimage' => $metaog['metaogimage'], 'metaogpath' => $metaogpath, )); } if (isset($_POST['submetaogsave'])){ if($_POST['metaogimagesave']=="-10" || $_POST['metaogimagesave']=="-20"){$_POST['metaogimagesave']='';} if(!empty($_POST['metaogid'])){ $query = ' UPDATE ' . METAOG_TABLE . ' SET metaogtitle= \''.$_POST['metaogtitlesave'].'\' ,metaogdescription= \''.$_POST['metaogdescriptionsave'].'\' ,metaogimage= \''.$_POST['metaogimagesave'].'\' WHERE id = \''.$_POST['metaogid'].'\' ;'; pwg_query($query); }else{ if(is_numeric($_POST['metaogpage'])){$type='4';}else{$type='1';} $q = 'INSERT INTO ' . $prefixeTable . 'metaog(type,page,metaogtitle,metaogdescription,metaogimage)VALUES ('.$type.',"' . $_POST['metaogpage'] . '","' . $_POST['metaogtitlesave'] . '","' . $_POST['metaogdescriptionsave'] . '","' . $_POST['metaogimagesave'] .'");'; pwg_query($q); } array_push($page['infos'], l10n('Metadata Open Graph updated')); } break; case 'config': $metaogsizelistT = array( l10n('2small'), l10n('size thumbnails bootstrap'), l10n('thumb'), l10n('square'), l10n('xsmall'), l10n('small'), l10n('medium'), l10n('large'), l10n('Original'), ); $metaogsizelist = array( '2s', 'cu', 'th', 'sq', 'xs', 'sm', 'me', 'la', 'original', ); $template->assign('metaogsizelist', $metaogsizelist); $template->assign('metaogsizelistT', $metaogsizelistT); $tab_lang = pwg_query('SELECT id,name FROM ' . LANGUAGES_TABLE . ' order by id;'); if (pwg_db_num_rows($tab_lang)) { while ($info_lang = pwg_db_fetch_assoc($tab_lang)) { if($info_lang['id']==$conf['moglocal']){ $select="SELECTED"; }else if($conf['moglocal']=='ar_AR'& $info_lang['id']=='ar_SA'){ $select="SELECTED"; }else if($conf['moglocal']=='en_US'& $info_lang['id']=='en_UK'){ $select="SELECTED"; }else if($conf['moglocal']=='en_LA'& $info_lang['id']=='es_ES'){ $select="SELECTED"; }else{ $select=""; } $items = array( 'OGLID' => $info_lang['id'], 'OGLNAME' => $info_lang['name'], 'LANGSELECT' => $select, ); $template->append('info_lang', $items); } } $template->assign(array( 'languages_other' => '', 'CACHE_KEYS' => get_admin_client_cache_keys(array('languages')), 'PWG_TOKEN' => get_pwg_token(), )); $metaogtwcalistT = array( l10n('empty'), 'summary : '.l10n('share your pages with a small squared thumbnail and informations'), 'summary_large_image : '.l10n('share your pages with a full width picture and informations'), //'app : '.l10n('explain app'), //'player : '.l10n('explain player'), ); $metaogtwcalist = array( 'a', 'summary', 'summary_large_image', //'app', //'player', ); $template->assign('metaogtwcalist', $metaogtwcalist); $template->assign('metaogtwcalistT', $metaogtwcalistT); if(isset($conf['moglista'])){ $listchose=safe_unserialize($conf['moglista']); }else{ $listchose=""; } if(!isset($conf['mogshowpa'])){$conf['mogshowpa']=1;} if(!isset($conf['mogshowpai'])){if($conf['mogshowpa']==2 | $conf['mogshowpa']==4){$conf['mogshowpai']=true;}else{$conf['mogshowpai']=false;}} if(!isset($conf['mogshowpaa'])){if($conf['mogshowpa']==3 | $conf['mogshowpa']==4){$conf['mogshowpaa']=true;}else{$conf['mogshowpaa']=false;}} $template->assign( 'metaogconfig', array( 'MOGsize' => $conf['mogsize'], 'MOGFB' => $conf['fb:app_id'], 'MOGSN' => $conf['mogsitename'], 'MOGTCA' => $conf['mogtwcard'], 'MOGTS' => $conf['mogtwsite'], 'MOGTCR' => $conf['mogtwcreator'], 'MOGSPAI' => $conf['mogshowpai'], 'MOGSPAA' => $conf['mogshowpaa'], 'choose_albums' => $listchose, )); $template->assign(array( 'CACHE_KEYS' => get_admin_client_cache_keys(array('tags', 'categories')), 'PWG_TOKEN' => get_pwg_token(), )); if (isset($_POST['submitogconfig'])){ if (isset($_POST['mogshowpai'])){conf_update_param('mogshowpai', $_POST['mogshowpai']);}else{conf_update_param('mogshowpai', false);} if (isset($_POST['mogshowpaa'])){conf_update_param('mogshowpaa', $_POST['mogshowpaa']);}else{conf_update_param('mogshowpaa', false);} if (isset($_POST['moglistea'])){conf_update_param('moglista', $_POST['moglistea']);}else{conf_update_param('moglista', false);} if (isset($_POST['metaogconfigsize'])){conf_update_param('mogsize', $_POST['metaogconfigsize']);} if (isset($_POST['metaogconfigfb'])){conf_update_param('fb:app_id', $_POST['metaogconfigfb']);} if (isset($_POST['metaogconfiglo'])){ if($_POST['metaogconfiglo']=="a" || $_POST['metaogconfiglo']=="b"){$_POST['metaogconfiglo']='';} if($_POST['metaogconfiglo']=='en_UK'){ $_POST['metaogconfiglo']='en_US'; } if($_POST['metaogconfiglo']=='ar_SA'||$_POST['metaogconfiglo']=='ar_MA'||$_POST['metaogconfiglo']=='ar_EG'){ $_POST['metaogconfiglo']='ar_AR'; } if($_POST['metaogconfiglo']=='es_ES'){ $_POST['metaogconfiglo']='en_LA'; } conf_update_param('moglocal', $_POST['metaogconfiglo']); } if (isset($_POST['metaogconfigsname'])){ conf_update_param('mogsitename', $_POST['metaogconfigsname']); } if (isset($_POST['metaogconfigtwca'])){ if($_POST['metaogconfigtwca']=='a'){$_POST['metaogconfigtwca']='';} conf_update_param('mogtwcard', $_POST['metaogconfigtwca']); } if (isset($_POST['metaogconfitws'])){ conf_update_param('mogtwsite', $_POST['metaogconfitws']); } if (isset($_POST['metaogconfitwcr'])){ conf_update_param('mogtwcreator', $_POST['metaogconfitwcr']); } header('Location:'.METAOG_ADMIN . '-config'); } break; } $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl')); $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); ?>