Ejemplo n.º 1
0
    if ($wonderful_third_data && $wonderful_third_data['active'] == 1) {
        @($file_data = $fileops->read_file($wonderful_file_path . $wonderful_third_data['user_info']));
        if ($file_data) {
            $file_data = str_replace('pw:', '', $file_data);
            $fileops->set_file('../assets/data/projectwonderful.xml');
            $fileops->set_contents($file_data);
            $fileops->save_file();
        }
    }
}
/*****
 * ! Display logic
 */
// Get all ads.
$ad_list = get_ads(null, $db);
$current_theme = get_site_theme($milieu_list['tone_id']['value'], $db);
///////// Read PW data.
// Get the login ID, if any.
$wonderful_third_data ? $wonderful_third_data : ($wonderful_third_data = get_third_login('projectwonderful', $db));
if ($wonderful_third_data && $wonderful_third_data['active'] == 1) {
    // Find the saved XML file.
    $wonderful_xml = file_get_contents('../assets/data/projectwonderful.xml');
    // Got a raw string? Interpret its XML.
    if ($wonderful_xml) {
        $wonderful_xml_obj = simplexml_load_string($wonderful_xml);
        $wonderful_ad_list = interpret_wonderful_xml($wonderful_xml_obj, $ad_list, $db);
    }
    // Got wonderful ads? Great! Build a list for the artist.
    if ($wonderful_ad_list) {
        $heading_list = array();
        // reset
Ejemplo n.º 2
0
 /**
  * 操作Smarty库接口
  *
  * @return Smarty 返回操作Smarty的对象
  */
 public static function &smarty()
 {
     if (is_object(self::$_smarty)) {
         return self::$_smarty;
     }
     require DIR_ROOT . '/smarty/Smarty.class.php';
     $site_theme = get_site_theme();
     //获取站点模板主题
     $doc_root = get_doc_root_name();
     //获取站点目录名称
     /**
      * SMARTY 缓冲目录
      */
     $smarty_cache_dir = SMARTY_CACHE_DIR . "{$doc_root}/{$site_theme}";
     if (!file_exists($smarty_cache_dir)) {
         @mkdir($smarty_cache_dir, 0777, true);
     }
     /**
      * SMARTY 模板目录
      */
     $smarty_template_dir = DIR_ROOT . "/{$doc_root}/site/{$site_theme}";
     if (!file_exists($smarty_template_dir)) {
         @mkdir($smarty_template_dir, 0777, true);
     }
     /**
      * SMARTY 编译目录
      */
     $smarty_compile_dir = SMARTY_COMPILE_DIR . "{$doc_root}/{$site_theme}";
     if (!file_exists($smarty_compile_dir)) {
         @mkdir($smarty_compile_dir, 0777, true);
     }
     self::$_smarty = new Smarty();
     self::$_smarty->caching = SMARTY_CACHE;
     self::$_smarty->debugging = SMARTY_DEBUGGING;
     self::$_smarty->cache_lifetime = SMARTY_CACHE_LIFETIME;
     self::$_smarty->cache_dir = $smarty_cache_dir;
     self::$_smarty->template_dir = $smarty_template_dir;
     self::$_smarty->compile_dir = $smarty_compile_dir;
     self::$_smarty->left_delimiter = SMARTY_LEFT_DELIMITER;
     self::$_smarty->right_delimiter = SMARTY_RIGHT_DELIMITER;
     return self::$_smarty;
 }