/**
  * Adds notifications if there are new theme version available.
  * Runs on time a day
  *
  * @return void
  */
 public static function check_update()
 {
     $lastChecked = (int) option::get('theme_last_checked');
     $temp_version = get_transient('wpzoom_temp_theme_version');
     // force a check if we think theme was updated
     if (!$temp_version) {
         set_transient('wpzoom_temp_theme_version', WPZOOM::$themeVersion);
     } else {
         if (version_compare($temp_version, WPZOOM::$themeVersion, '!=')) {
             $lastChecked = 0;
             set_transient('wpzoom_temp_theme_version', WPZOOM::$themeVersion);
         }
     }
     if ($lastChecked == 0 || $lastChecked + 60 * 60 * 24 < time()) {
         if (self::has_update()) {
             option::set('theme_status', 'needs_update');
         } else {
             option::delete('theme_status');
         }
         option::set('theme_last_checked', time());
     }
     if (option::get('theme_status') == 'needs_update' && current_user_can('update_themes')) {
         add_action('admin_notices', array(__CLASS__, 'notification'));
     }
 }
Esempio n. 2
0
 public static function ajax()
 {
     if ($_POST['type'] == 'framework-notification-hide') {
         option::set('framework_last_checked', time() + 60 * 60 * 48);
         option::delete('framework_status');
         die;
     }
     if ($_POST['type'] == 'theme-notification-hide') {
         option::set('theme_last_checked', time() + 60 * 60 * 48);
         option::delete('theme_status');
         die;
     }
     die;
 }
Esempio n. 3
0
            $mark = new mark();
            $markData = array('source' => 'topic', 'source_id' => $topic_ids, 'state' => $state, 'type_state' => 'team');
            $mark->update_mark_state($markData);
            if ($state == 0) {
                //删除话题搜索
                $this->teamApi->delete_search($topic_ids, 'topic');
            } elseif ($state == 1) {
                //插入话题搜索
                $this->teamApi->add_search($topic_ids, 'topic');
            }
            //删除话题
            $this->topic->update(array('state' => $state, 'type_state' => 'team'), $topic_ids);
        }
    }
    /**
	 * 删除小组所有信息
	 * @param String $ids
	 */
    public function real_del()
    {
        $team_ids = trim(urldecode($this->input['team_id']));
        //删除小组的关注
        $option = new option();
        $attenData = array('source' => 'team', 'source_id' => $team_ids, 'action' => 'attention');
        $option->delete($attenData);
        //删除小组的标签
        $mark = new mark();
        $markData = array('source' => 'team', 'source_id' => $team_ids, 'action' => 'team_tag');
        $mark->delete_source_id_mark($markData);
        //删除小组的主题标签
        $themeMarkData = array('source' => 'team', 'source_id' => $team_ids, 'action' => 'team_theme');
        $mark->delete_source_id_mark($themeMarkData);
        //删除小组下的行动召集者
        $this->team->del_apply($team_ids);
        //删除小组下的黑名单
Esempio n. 4
0
 /**
  * Checks if we are going to make an update and updates current framework to latest version
  */
 public static function update_init()
 {
     global $r;
     if (!isset($_GET['page'])) {
         return;
     }
     $requestedPage = strtolower(strip_tags(trim($_REQUEST['page'])));
     if ($requestedPage != 'wpzoom_update') {
         return;
     }
     $fsmethod = get_filesystem_method();
     $fs = WP_Filesystem();
     if ($fs == false) {
         function framework_update_filesystem_warning()
         {
             $method = get_filesystem_method();
             echo "<p>Failed: Filesystem preventing downloads. ({$method})</p>";
         }
         add_action('admin_notices', 'framework_update_filesystem_warning');
         return;
     }
     if (isset($_POST['wpzoom-update-do'])) {
         $action = strtolower(trim(strip_tags($_POST['wpzoom-update-do'])));
         if ($action == 'update') {
             $fwUrl = 'http://framework.wpzoom.com/wpzoom-framework.zip';
             $fwFile = download_url($fwUrl);
             if (is_wp_error($fwUrl)) {
                 $error = $fwFile->get_error_code();
                 if ($error == 'http_no_url') {
                     $r = "<p>Failed: Invalid URL Provided</p>";
                 } else {
                     $r = "<p>Failed: Upload - {$error}</p>";
                 }
                 function framework_update_warning()
                 {
                     global $r;
                     echo "<p>{$r}</p>";
                 }
                 add_action('admin_notices', 'framework_update_warning');
                 return;
             }
         }
         global $wp_filesystem;
         $to = WPZOOM::get_wpzoom_root();
         $dounzip = unzip_file($fwFile, $to);
         unlink($fwFile);
         if (is_wp_error($dounzip)) {
             $error = $dounzip->get_error_code();
             $data = $dounzip->get_error_data($error);
             if ($error == 'incompatible_archive') {
                 //The source file was not found or is invalid
                 function framework_update_no_archive_warning()
                 {
                     echo "<p>Failed: Incompatible archive</p>";
                 }
                 add_action('admin_notices', 'framework_update_no_archive_warning');
             }
             if ($error == 'empty_archive') {
                 function framework_update_empty_archive_warning()
                 {
                     echo "<p>Failed: Empty Archive</p>";
                 }
                 add_action('admin_notices', 'framework_update_empty_archive_warning');
             }
             if ($error == 'mkdir_failed') {
                 function framework_update_mkdir_warning()
                 {
                     echo "<p>Failed: mkdir Failure</p>";
                 }
                 add_action('admin_notices', 'framework_update_mkdir_warning');
             }
             if ($error == 'copy_failed') {
                 function framework_update_copy_fail_warning()
                 {
                     echo "<p>Failed: Copy Failed</p>";
                 }
                 add_action('admin_notices', 'update_copy_fail_warning');
             }
             return;
         }
         function framework_updated_success()
         {
             echo '<div class="updated fade"><p>New framework successfully downloaded, extracted and updated.</p></div>';
         }
         add_action('admin_notices', 'framework_updated_success');
         remove_action('admin_notices', array('WPZOOM', 'notification'));
         option::delete('framework_status');
         option::set('framework_last_checked', time());
     }
 }
        $start = false;
        $changelog = WPZOOM_Framework_Updater::get_changelog();
        $changelog = explode("\n", $changelog);
        foreach ($changelog as $line) {
            if (preg_match("/v ((?:\\d+(?!\\.\\*)\\.)+)(\\d+)?(\\.\\*)?/i", $line)) {
                $start = true;
                echo '<h4>' . $line . '</h4>';
            } elseif ($start && trim($line)) {
                echo '<pre>' . $line . '</pre>';
            }
        }
        ?>
            </div>
            <?php 
    }
    ?>
        <?php 
} else {
    ?>
            <p>&rarr; <strong>You are using latest framework version:</strong> <?php 
    echo $localVersion;
    ?>
</p>
            <?php 
    option::delete('framework_status');
    ?>
        <?php 
}
?>
</div><!-- end .wrap -->
Esempio n. 6
0
		$this->addItem($result);
		$this->output();
	}
	*/
    /*
	//批量审核话题数据
	public function audit()
	{	
		$topic_ids = $this->validate_data();
		$result = $this->topic->update(array('state' => 1), $topic_ids);
		$this->setXmlNode('topic_info', 'topic');
		$this->addItem($result);
		$this->output();
	}
	*/
    /*
	//批量打回(屏蔽)话题数据
	public function back()
	{
		$topic_ids = $this->validate_data();
		$result = $this->topic->update(array('state' => -1), $topic_ids);
		$this->setXmlNode('topic_info', 'topic');
		$this->addItem($result);
		$this->output();
	}