Changeset 27998 for extensions/TakeATour/main.inc.php
- Timestamp:
- Mar 28, 2014, 7:17:44 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/TakeATour/main.inc.php
r27898 r27998 18 18 { 19 19 pwg_set_session_var('tour_to_launch', $_POST['submited_tour']); 20 global $TAT _restart;21 $TAT _restart=true;20 global $TAT; 21 $TAT['restart']=true; 22 22 } 23 23 elseif ( isset($_GET['tour_ended']) and in_array($_GET['tour_ended'], $avalaible_tour) and defined('IN_ADMIN') and IN_ADMIN ) 24 24 { 25 25 pwg_unset_session_var('tour_to_launch'); 26 pwg_unset_session_var('TAT_image_id'); 27 pwg_unset_session_var('TAT_cat_id'); 26 28 } 27 29 … … 32 34 function TAT_add_js_css() 33 35 { 34 global $template, $TAT _restart;36 global $template, $TAT; 35 37 $tour_to_launch=pwg_get_session_var('tour_to_launch'); 36 38 load_language('plugin.lang', PHPWG_PLUGINS_PATH .'TakeATour/'); 37 39 $template->set_filename('TAT_js_css', PHPWG_PLUGINS_PATH.'TakeATour/tpl/js_css.tpl'); 38 40 $template->parse('TAT_js_css');//http://piwigo.org/forum/viewtopic.php?id=23248 39 if (isset($TAT _restart) and $TAT_restart)40 { 41 $TAT _restart=false;41 if (isset($TAT['restart']) and $TAT['restart']) 42 { 43 $TAT['restart']=false; 42 44 $template->assign('TAT_restart',true); 43 45 } 44 46 $tat_path=str_replace(basename($_SERVER['SCRIPT_NAME']),'', $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']); 45 //$tat_path=$_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];46 47 $template->assign('TAT_path', $tat_path); 48 //picture id 49 if (isset($_GET['page']) and preg_match('/^photo-(\d+)(?:-(.*))?$/', $_GET['page'], $matches)) 50 { 51 $_GET['image_id'] = $matches[1]; 52 } 53 check_input_parameter('image_id', $_GET, false, PATTERN_ID); 54 if (isset($_GET['image_id']) and pwg_get_session_var('TAT_image_id')==null) 55 { 56 $template->assign('TAT_image_id', $_GET['image_id']); 57 pwg_set_session_var('TAT_image_id', $_GET['image_id']); 58 } 59 elseif (is_numeric(pwg_get_session_var('TAT_image_id'))) 60 { 61 $template->assign('TAT_image_id', pwg_get_session_var('TAT_image_id')); 62 } 63 else 64 { 65 $query = ' 66 SELECT id 67 FROM '.IMAGES_TABLE.' 68 ORDER BY RAND() 69 LIMIT 1 70 ;'; 71 $row = pwg_db_fetch_assoc(pwg_query($query)); 72 $template->assign('TAT_image_id', $row['id']); 73 } 74 //album id 75 if (isset($_GET['page']) and preg_match('/^album-(\d+)(?:-(.*))?$/', $_GET['page'], $matches)) 76 { 77 $_GET['cat_id'] = $matches[1]; 78 } 79 check_input_parameter('cat_id', $_GET, false, PATTERN_ID); 80 if (isset($_GET['cat_id']) and pwg_get_session_var('TAT_cat_id')==null) 81 { 82 $template->assign('TAT_cat_id', $_GET['cat_id']); 83 pwg_set_session_var('TAT_cat_id', $_GET['cat_id']); 84 } 85 elseif (is_numeric(pwg_get_session_var('TAT_cat_id'))) 86 { 87 $template->assign('TAT_cat_id', pwg_get_session_var('TAT_cat_id')); 88 } 89 else 90 { 91 $query = ' 92 SELECT id 93 FROM '.CATEGORIES_TABLE.' 94 ORDER BY RAND() 95 LIMIT 1 96 ;'; 97 $row = pwg_db_fetch_assoc(pwg_query($query)); 98 $template->assign('TAT_cat_id', $row['id']); 99 } 100 47 101 $template->set_filename('TAT_tour_tpl', PHPWG_PLUGINS_PATH.'TakeATour/tpl/'.$tour_to_launch.'.tpl'); 48 102 $template->parse('TAT_tour_tpl'); … … 60 114 } 61 115 62 function TAT_FC_14() { 116 function TAT_FC_14() 117 { 63 118 global $template; 64 119 $template->set_prefilter('batch_manager_global', 'TAT_FC_14_prefilter'); 65 120 } 66 function TAT_FC_14_prefilter ($content, &$smarty) { 121 function TAT_FC_14_prefilter ($content, &$smarty) 122 { 67 123 $search = '<span class="wrap2'; 68 124 $replacement = '{counter print=false assign=TAT_FC_14}<span {if $TAT_FC_14==1}id="TAT_FC_14"{/if} class="wrap2'; 69 return str_replace($search, $replacement, $content); 70 } 71 function TAT_FC_16() { 125 $content = str_replace($search, $replacement, $content); 126 $search = 'target="_blank">{\'Edit\''; 127 $replacement = '>{\'Edit\''; 128 return str_replace($search, $replacement, $content); 129 } 130 function TAT_FC_16() 131 { 72 132 global $template; 73 133 $template->set_prefilter('picture_modify', 'TAT_FC_16_prefilter'); 74 134 } 75 function TAT_FC_16_prefilter ($content, &$smarty) { 135 function TAT_FC_16_prefilter ($content, &$smarty) 136 { 76 137 $search = '<strong>{\'Linked albums\'|@translate}</strong>'; 77 138 $replacement = '<span id="TAT_FC_16"><strong>{\'Linked albums\'|@translate}</strong></span>'; 78 139 return str_replace($search, $replacement, $content); 79 140 } 80 function TAT_FC_17() { 141 function TAT_FC_17() 142 { 81 143 global $template; 82 144 $template->set_prefilter('picture_modify', 'TAT_FC_17_prefilter'); 83 145 } 84 function TAT_FC_17_prefilter ($content, &$smarty) { 146 function TAT_FC_17_prefilter ($content, &$smarty) 147 { 85 148 $search = '<strong>{\'Representation of albums\'|@translate}</strong>'; 86 149 $replacement = '<span id="TAT_FC_17"><strong>{\'Representation of albums\'|@translate}</strong></span>'; 87 150 return str_replace($search, $replacement, $content); 88 151 } 89 function TAT_FC_23() { 152 function TAT_FC_23() 153 { 90 154 global $template; 91 155 $template->set_prefilter('album_properties', 'TAT_FC_23_prefilter'); 92 156 } 93 function TAT_FC_23_prefilter ($content, &$smarty) { 157 function TAT_FC_23_prefilter ($content, &$smarty) 158 { 94 159 $search = '<strong>{\'Lock\'|@translate}</strong>'; 95 160 $replacement = '<span id="TAT_FC_23"><strong>{\'Lock\'|@translate}</strong></span>'; 96 161 return str_replace($search, $replacement, $content); 97 162 } 98 function TAT_FC_35() { 163 function TAT_FC_35() 164 { 99 165 global $template; 100 166 $template->set_prefilter('themes', 'TAT_FC_35_prefilter'); 101 167 } 102 function TAT_FC_35_prefilter ($content, &$smarty) { 168 function TAT_FC_35_prefilter ($content, &$smarty) 169 { 103 170 $search = '<a href="{$set_default_baseurl}{$theme.ID}" class="tiptip"'; 104 171 $replacement = '{counter print=false assign=TAT_FC_35}<a href="{$set_default_baseurl}{$theme.ID}" class="tiptip" {if $TAT_FC_35==1}id="TAT_FC_35"{/if}';
Note: See TracChangeset
for help on using the changeset viewer.